@plumeria/turbopack-loader 11.1.3 → 11.2.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/index.js +35 -9
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -412,16 +412,42 @@ async function loader(source) {
|
|
|
412
412
|
};
|
|
413
413
|
(0, utils_1.traverse)(ast, {
|
|
414
414
|
ImportDeclaration({ node }) {
|
|
415
|
-
if (node.
|
|
416
|
-
node.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
415
|
+
if (node.source.value === '@plumeria/core') {
|
|
416
|
+
if (node.typeOnly)
|
|
417
|
+
return;
|
|
418
|
+
const typeOnlySpecs = node.specifiers.filter((s) => s.type === 'ImportSpecifier' && s.isTypeOnly);
|
|
419
|
+
if (typeOnlySpecs.length > 0) {
|
|
420
|
+
const names = typeOnlySpecs
|
|
421
|
+
.map((s) => {
|
|
422
|
+
if (s.type !== 'ImportSpecifier')
|
|
423
|
+
return;
|
|
424
|
+
const imported = s.imported ? s.imported.value : s.local.value;
|
|
425
|
+
const local = s.local.value;
|
|
426
|
+
return imported === local ? imported : `${imported} as ${local}`;
|
|
427
|
+
})
|
|
428
|
+
.join(', ');
|
|
429
|
+
replacements.push({
|
|
430
|
+
start: node.span.start - baseByteOffset,
|
|
431
|
+
end: node.span.end - baseByteOffset,
|
|
432
|
+
content: `import type { ${names} } from '@plumeria/core'`,
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
replacements.push({
|
|
437
|
+
start: node.span.start - baseByteOffset,
|
|
438
|
+
end: node.span.end - baseByteOffset,
|
|
439
|
+
content: '',
|
|
440
|
+
});
|
|
441
|
+
}
|
|
424
442
|
}
|
|
443
|
+
node.specifiers.forEach((specifier) => {
|
|
444
|
+
if (specifier.local) {
|
|
445
|
+
excludedSpans.add(specifier.local.span.start);
|
|
446
|
+
}
|
|
447
|
+
if (specifier.type === 'ImportSpecifier' && specifier.imported) {
|
|
448
|
+
excludedSpans.add(specifier.imported.span.start);
|
|
449
|
+
}
|
|
450
|
+
});
|
|
425
451
|
},
|
|
426
452
|
ExportDeclaration({ node }) {
|
|
427
453
|
if (utils_1.t.isVariableDeclaration(node.declaration)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/turbopack-loader",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Plumeria Turbopack-loader",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"zero-virtual.css"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@plumeria/utils": "^11.
|
|
25
|
+
"@plumeria/utils": "^11.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@swc/core": "1.15.21",
|