Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5bd7959

Browse files
committed
refactor(core): rename internal core modules for clarity
1 parent f234661 commit 5bd7959

File tree

7 files changed

+14
-15
lines changed

7 files changed

+14
-15
lines changed

‎package.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272
"types": "svelte-check",
7373
"types:legacy": "svelte-check --tsconfig tsconfig.legacy.json",
7474
"validate": "npm-run-all test:vitest:* test:jest types build",
75-
"build": "tsc -p tsconfig.build.json && cp src/component-types.d.ts types",
75+
"build": "npm-run-all build:*",
76+
"build:tsc": "tsc -p tsconfig.build.json",
77+
"build:copy-dts": "cp src/core/types.d.ts types/core",
7678
"contributors:add": "all-contributors add",
7779
"contributors:generate": "all-contributors generate",
7880
"preview-release": "./scripts/preview-release",

‎src/core/index.js‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
* Will switch to legacy, class-based mounting logic
66
* if it looks like we're in a Svelte <= 4 environment.
77
*/
8-
import * as LegacyCore from './legacy.js'
9-
import * as ModernCore from './modern.svelte.js'
10-
import {
11-
createValidateOptions,
12-
UnknownSvelteOptionsError,
13-
} from './validate-options.js'
8+
import * as MountLegacy from './mount-legacy.js'
9+
import * as MountModern from './mount-modern.svelte.js'
10+
import { createValidateOptions, UnknownSvelteOptionsError } from './prepare.js'
1411

1512
const { mount, unmount, updateProps, allowedOptions } =
16-
ModernCore.IS_MODERN_SVELTE ? ModernCore : LegacyCore
13+
MountModern.IS_MODERN_SVELTE ? MountModern : MountLegacy
1714

1815
/** Validate component options. */
1916
const validateOptions = createValidateOptions(allowedOptions)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎src/pure.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const componentCache = new Set()
1313
/**
1414
* Customize how Svelte renders the component.
1515
*
16-
* @template {import('./component-types.js').Component} C
17-
* @typedef {import('./component-types.js').Props<C> | Partial<import('./component-types.js').MountOptions<C>>} SvelteComponentOptions
16+
* @template {import('./core/types.js').Component} C
17+
* @typedef {import('./core/types.js').Props<C> | Partial<import('./core/types.js').MountOptions<C>>} SvelteComponentOptions
1818
*/
1919

2020
/**
@@ -30,15 +30,15 @@ const componentCache = new Set()
3030
/**
3131
* The rendered component and bound testing functions.
3232
*
33-
* @template {import('./component-types.js').Component} C
33+
* @template {import('./core/types.js').Component} C
3434
* @template {import('@testing-library/dom').Queries} [Q=typeof import('@testing-library/dom').queries]
3535
*
3636
* @typedef {{
3737
* container: HTMLElement
3838
* baseElement: HTMLElement
39-
* component: import('./component-types.js').Exports<C>
39+
* component: import('./core/types.js').Exports<C>
4040
* debug: (el?: HTMLElement | DocumentFragment) => void
41-
* rerender: (props: Partial<import('./component-types.js').Props<C>>) => Promise<void>
41+
* rerender: (props: Partial<import('./core/types.js').Props<C>>) => Promise<void>
4242
* unmount: () => void
4343
* } & {
4444
* [P in keyof Q]: import('@testing-library/dom').BoundFunction<Q[P]>
@@ -48,10 +48,10 @@ const componentCache = new Set()
4848
/**
4949
* Render a component into the document.
5050
*
51-
* @template {import('./component-types.js').Component} C
51+
* @template {import('./core/types.js').Component} C
5252
* @template {import('@testing-library/dom').Queries} [Q=typeof import('@testing-library/dom').queries]
5353
*
54-
* @param {import('./component-types.js').ComponentType<C>} Component - The component to render.
54+
* @param {import('./core/types.js').ComponentType<C>} Component - The component to render.
5555
* @param {SvelteComponentOptions<C>} options - Customize how Svelte renders the component.
5656
* @param {RenderOptions<Q>} renderOptions - Customize how Testing Library sets up the document and binds queries.
5757
* @returns {RenderResult<C, Q>} The rendered component and bound testing functions.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /