svelte-shaker 0.5.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{types/src/analyze.d.ts → analyze.d.ts} +23 -10
- package/dist/analyze.js +1140 -0
- package/dist/{types/src/css.d.ts → css.d.ts} +2 -2
- package/dist/css.js +256 -0
- package/dist/{types/src/dead.d.ts → dead.d.ts} +2 -2
- package/dist/dead.js +195 -0
- package/dist/{types/src/engine.d.ts → engine.d.ts} +3 -3
- package/dist/engine.js +109 -0
- package/dist/{types/src/eval.d.ts → eval.d.ts} +2 -2
- package/dist/eval.js +222 -0
- package/dist/{types/src/index.d.ts → index.d.ts} +11 -11
- package/dist/index.js +86 -1
- package/dist/ir.js +15 -0
- package/dist/{types/src/mono.d.ts → mono.d.ts} +3 -3
- package/dist/mono.js +451 -0
- package/dist/{types/src/parse.d.ts → parse.d.ts} +4 -0
- package/dist/parse.js +19 -0
- package/dist/{types/src/rsvelte-parse.d.ts → rsvelte-parse.d.ts} +1 -1
- package/dist/rsvelte-parse.js +31 -0
- package/dist/{types/src/scan.d.ts → scan.d.ts} +2 -2
- package/dist/scan.js +40 -1
- package/dist/{types/src/transform.d.ts → transform.d.ts} +4 -4
- package/dist/transform.js +825 -0
- package/dist/{types/src/vite.d.ts → vite.d.ts} +10 -2
- package/dist/vite.js +328 -1
- package/package.json +9 -18
- package/dist/index.cjs +0 -1
- /package/dist/{types/src/ir.d.ts → ir.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type AnyNode, type Parse, type ParseCache, type Root } from './parse';
|
|
2
|
-
import { type AnalyzeInput, type ComponentId, type ComponentPlan, type Literal } from './ir';
|
|
3
|
-
import { type Span } from './dead';
|
|
1
|
+
import { type AnyNode, type Parse, type ParseCache, type Root } from './parse.js';
|
|
2
|
+
import { type AnalyzeInput, type ComponentId, type ComponentPlan, type Literal } from './ir.js';
|
|
3
|
+
import { type Span } from './dead.js';
|
|
4
4
|
export type Resolve = (source: string, importer: ComponentId) => Promise<ComponentId | null> | ComponentId | null;
|
|
5
5
|
export type ReadFile = (id: ComponentId) => Promise<string> | string;
|
|
6
6
|
/** One declared prop in a `$props()` destructuring. */
|
|
@@ -81,11 +81,15 @@ export interface ChildCall {
|
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* One value passed explicitly to a prop at one call site, after last-write-wins
|
|
84
|
-
* has been resolved (`{
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
84
|
+
* has been resolved. An explicit write is either a real attribute (`a={1}`) OR a
|
|
85
|
+
* key expanded out of a statically-known object-literal spread (`{...{a:1}}`,
|
|
86
|
+
* docs §4.1) — both name a prop and a value the same way. `dynamic` means the
|
|
87
|
+
* value is non-literal (`bind:`, a dynamic expression, or a spread key whose
|
|
88
|
+
* value is non-literal): used, value not statically known. `afterLastSpread`
|
|
89
|
+
* records whether this write happened after the site's last *unknown* spread (one
|
|
90
|
+
* we could not expand) — only then can no spread silently override it (docs §4.1,
|
|
91
|
+
* "後勝ち順序で救う"). A known object-literal spread is expanded, not opaque, so
|
|
92
|
+
* it never counts as an "unknown spread" here.
|
|
89
93
|
*/
|
|
90
94
|
export interface ExplicitProp {
|
|
91
95
|
value: Literal;
|
|
@@ -94,7 +98,12 @@ export interface ExplicitProp {
|
|
|
94
98
|
}
|
|
95
99
|
/** How a child component is called at one `<Child .../>` site. */
|
|
96
100
|
export interface CallSite {
|
|
97
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Did this site have at least one spread we could NOT statically expand (an
|
|
103
|
+
* identifier / call / `{...{…computed/nested…}}`)? A fully-known object-literal
|
|
104
|
+
* spread is expanded into {@link ExplicitProp} writes instead, so it does not
|
|
105
|
+
* set this — only an opaque spread, which may set any prop, does (docs §4.1).
|
|
106
|
+
*/
|
|
98
107
|
hadSpread: boolean;
|
|
99
108
|
/** Last-write-wins explicit props at this site, keyed by prop name. */
|
|
100
109
|
explicit: Map<string, ExplicitProp>;
|
|
@@ -160,7 +169,11 @@ export declare function remapToLocalNames<V>(map: Map<string, V>, model: FileMod
|
|
|
160
169
|
* Read one `<Child .../>` into a {@link CallSite}. Attributes are in source
|
|
161
170
|
* order, so we resolve last-write-wins (a later `a={…}` overrides an earlier
|
|
162
171
|
* one) and record, per prop, whether its winning write came *after* the last
|
|
163
|
-
* spread — the only case a spread cannot silently override it (docs
|
|
172
|
+
* *unknown* spread — the only case a spread cannot silently override it (docs
|
|
173
|
+
* §4.1). A statically-known object-literal spread (`{...{a:1, b:2}}`) is not
|
|
174
|
+
* opaque: we expand its keys into explicit writes at the spread's position, so it
|
|
175
|
+
* both contributes those literals AND does not poison props it cannot set (docs
|
|
176
|
+
* §4.1, "{...obj} が object literal ならキー展開").
|
|
164
177
|
*/
|
|
165
178
|
export declare function readCallSite(component: AnyNode): CallSite;
|
|
166
179
|
/** Decide what to fold for one component from its global usage. */
|