@plumeria/turbopack-loader 18.0.0 → 18.0.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.
Files changed (2) hide show
  1. package/dist/index.js +11 -21
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -222,6 +222,13 @@ async function loader(source) {
222
222
  const actualPath = (0, utils_1.resolveImportPath)(sourcePath, resourcePath);
223
223
  if (actualPath) {
224
224
  node.specifiers.forEach((specifier) => {
225
+ if (specifier.type === 'ImportNamespaceSpecifier') {
226
+ localImports[specifier.local.value] = {
227
+ actualPath,
228
+ importedName: '*',
229
+ };
230
+ return;
231
+ }
225
232
  if (specifier.type === 'ImportSpecifier' ||
226
233
  specifier.type === 'ImportDefaultSpecifier') {
227
234
  const importedName = specifier.type === 'ImportDefaultSpecifier'
@@ -1278,12 +1285,8 @@ async function loader(source) {
1278
1285
  };
1279
1286
  (0, utils_1.traverse)(ast, {
1280
1287
  JSXOpeningElement({ node }) {
1281
- let tagName = '';
1282
- if (node.name.type === 'Identifier') {
1283
- tagName = node.name.value;
1284
- }
1285
1288
  jsxOpeningElementMap.set(node.span.start, {
1286
- tagName,
1289
+ compKey: (0, utils_1.resolveComponentKey)(node.name, resourcePath, localImports),
1287
1290
  attributes: node.attributes,
1288
1291
  });
1289
1292
  },
@@ -1463,30 +1466,17 @@ async function loader(source) {
1463
1466
  return;
1464
1467
  const attrName = node.name.value;
1465
1468
  if (attrName !== styleProp) {
1466
- let parentTagName = '';
1469
+ let compKey = null;
1467
1470
  for (const [, val] of jsxOpeningElementMap) {
1468
1471
  const found = val.attributes
1469
1472
  .filter((a) => a.type === 'JSXAttribute')
1470
1473
  .find((a) => a.span.start === node.span.start);
1471
1474
  if (found) {
1472
- parentTagName = val.tagName;
1475
+ compKey = val.compKey;
1473
1476
  break;
1474
1477
  }
1475
1478
  }
1476
- if (parentTagName &&
1477
- parentTagName[0] === parentTagName[0].toUpperCase()) {
1478
- let compKey;
1479
- const imported = localImports[parentTagName];
1480
- if (imported) {
1481
- compKey = `${imported.actualPath}-${imported.importedName}`;
1482
- const resolved = (0, utils_1.resolveExport)(imported.actualPath, imported.importedName);
1483
- if (resolved) {
1484
- compKey = `${resolved.filePath}-${resolved.localName}`;
1485
- }
1486
- }
1487
- else {
1488
- compKey = `${resourcePath}-${parentTagName}`;
1489
- }
1479
+ if (compKey) {
1490
1480
  const list = scannedTables.componentPropsTable?.[compKey]?.[attrName];
1491
1481
  if (list &&
1492
1482
  node.value &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/turbopack-loader",
3
- "version": "18.0.0",
3
+ "version": "18.0.1",
4
4
  "description": "Plumeria Turbopack-loader",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -22,8 +22,8 @@
22
22
  "zero-virtual.css"
23
23
  ],
24
24
  "dependencies": {
25
- "@plumeria/compiler": "^18.0.0",
26
- "@plumeria/utils": "^18.0.0"
25
+ "@plumeria/compiler": "^18.0.1",
26
+ "@plumeria/utils": "^18.0.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@swc/core": "1.15.43",