@fuzdev/fuz_util 0.50.0 → 0.50.1
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.
|
@@ -113,7 +113,8 @@ export declare const build_static_bindings: (ast: AST.Root) => Map<string, strin
|
|
|
113
113
|
* Resolves local names that import from specified source paths.
|
|
114
114
|
*
|
|
115
115
|
* Scans `ImportDeclaration` nodes in both the instance and module scripts.
|
|
116
|
-
* Handles default, named, and aliased imports. Skips namespace imports
|
|
116
|
+
* Handles default, named, and aliased imports. Skips namespace imports
|
|
117
|
+
* and `import type` declarations (both whole-declaration and per-specifier).
|
|
117
118
|
* Returns import node references alongside names to support import removal.
|
|
118
119
|
*
|
|
119
120
|
* @param ast The parsed Svelte AST root node.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svelte_preprocess_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/svelte_preprocess_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAEX,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAEzC,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACpC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;CAC1B;AAED,qDAAqD;AACrD,MAAM,WAAW,uBAAuB;IACvC,gEAAgE;IAChE,WAAW,EAAE,iBAAiB,CAAC;IAC/B,mDAAmD;IACnD,SAAS,EAAE,eAAe,GAAG,sBAAsB,CAAC;CACpD;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,MAAM,KAAG,GAAG,CAAC,SAAS,GAAG,SAOlF,CAA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AC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;CAAC,EACxE,MAAM,iBAAiB,GAAG;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,EACtD,qBAAqB,iBAAiB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAC5D,QAAQ,MAAM,EACd,mBAAkB,MAAW,KAC3B,IAgCF,CAAC;AAiBF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GACnC,OAAO,OAAO,EACd,QAAQ,MAAM,EACd,UAAU,MAAM,GAAG,SAAS,EAC5B,UAAU,OAAO,GAAG,KAAK,KACvB,IAOF,CAAC"}
|
|
@@ -207,7 +207,8 @@ export const build_static_bindings = (ast) => {
|
|
|
207
207
|
* Resolves local names that import from specified source paths.
|
|
208
208
|
*
|
|
209
209
|
* Scans `ImportDeclaration` nodes in both the instance and module scripts.
|
|
210
|
-
* Handles default, named, and aliased imports. Skips namespace imports
|
|
210
|
+
* Handles default, named, and aliased imports. Skips namespace imports
|
|
211
|
+
* and `import type` declarations (both whole-declaration and per-specifier).
|
|
211
212
|
* Returns import node references alongside names to support import removal.
|
|
212
213
|
*
|
|
213
214
|
* @param ast The parsed Svelte AST root node.
|
|
@@ -224,9 +225,16 @@ export const resolve_component_names = (ast, component_imports) => {
|
|
|
224
225
|
continue;
|
|
225
226
|
if (!component_imports.includes(node.source.value))
|
|
226
227
|
continue;
|
|
228
|
+
// Skip `import type` declarations — estree types don't declare importKind,
|
|
229
|
+
// but Svelte's parser preserves it from the TypeScript syntax.
|
|
230
|
+
if (node.importKind === 'type')
|
|
231
|
+
continue;
|
|
227
232
|
for (const specifier of node.specifiers) {
|
|
228
233
|
if (specifier.type === 'ImportNamespaceSpecifier')
|
|
229
234
|
continue;
|
|
235
|
+
// Skip `import {type Foo}` specifiers
|
|
236
|
+
if (specifier.importKind === 'type')
|
|
237
|
+
continue;
|
|
230
238
|
names.set(specifier.local.name, { import_node: node, specifier });
|
|
231
239
|
}
|
|
232
240
|
}
|
package/package.json
CHANGED
|
@@ -249,7 +249,8 @@ export const build_static_bindings = (ast: AST.Root): Map<string, string> => {
|
|
|
249
249
|
* Resolves local names that import from specified source paths.
|
|
250
250
|
*
|
|
251
251
|
* Scans `ImportDeclaration` nodes in both the instance and module scripts.
|
|
252
|
-
* Handles default, named, and aliased imports. Skips namespace imports
|
|
252
|
+
* Handles default, named, and aliased imports. Skips namespace imports
|
|
253
|
+
* and `import type` declarations (both whole-declaration and per-specifier).
|
|
253
254
|
* Returns import node references alongside names to support import removal.
|
|
254
255
|
*
|
|
255
256
|
* @param ast The parsed Svelte AST root node.
|
|
@@ -266,8 +267,13 @@ export const resolve_component_names = (
|
|
|
266
267
|
for (const node of script.content.body) {
|
|
267
268
|
if (node.type !== 'ImportDeclaration') continue;
|
|
268
269
|
if (!component_imports.includes(node.source.value as string)) continue;
|
|
270
|
+
// Skip `import type` declarations — estree types don't declare importKind,
|
|
271
|
+
// but Svelte's parser preserves it from the TypeScript syntax.
|
|
272
|
+
if ((node as any).importKind === 'type') continue;
|
|
269
273
|
for (const specifier of node.specifiers) {
|
|
270
274
|
if (specifier.type === 'ImportNamespaceSpecifier') continue;
|
|
275
|
+
// Skip `import {type Foo}` specifiers
|
|
276
|
+
if ((specifier as any).importKind === 'type') continue;
|
|
271
277
|
names.set(specifier.local.name, {import_node: node, specifier});
|
|
272
278
|
}
|
|
273
279
|
}
|