@plumeria/turbopack-loader 6.1.2 → 6.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.
Files changed (2) hide show
  1. package/dist/index.js +38 -15
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -395,20 +395,6 @@ async function loader(source) {
395
395
  if (!hash) {
396
396
  hash = mergedCreateTable[varName];
397
397
  }
398
- if (!hash) {
399
- const styleInfo = localCreateStyles[varName];
400
- if (styleInfo) {
401
- const atomMap = styleInfo.hashMap[propName];
402
- if (atomMap) {
403
- replacements.push({
404
- start: node.span.start - ast.span.start,
405
- end: node.span.end - ast.span.start,
406
- content: JSON.stringify(atomMap),
407
- });
408
- return;
409
- }
410
- }
411
- }
412
398
  if (hash) {
413
399
  let atomMap;
414
400
  if (scannedTables.createAtomicMapTable[hash]) {
@@ -420,11 +406,48 @@ async function loader(source) {
420
406
  end: node.span.end - ast.span.start,
421
407
  content: JSON.stringify(atomMap),
422
408
  });
423
- return;
424
409
  }
425
410
  }
426
411
  }
427
412
  },
413
+ Identifier({ node }) {
414
+ if (excludedSpans.has(node.span.start))
415
+ return;
416
+ if (idSpans.has(node.span.start))
417
+ return;
418
+ const styleInfo = localCreateStyles[node.value];
419
+ if (styleInfo) {
420
+ replacements.push({
421
+ start: node.span.start - ast.span.start,
422
+ end: node.span.end - ast.span.start,
423
+ content: JSON.stringify(styleInfo.hashMap),
424
+ });
425
+ return;
426
+ }
427
+ const varName = node.value;
428
+ const uniqueKey = `${this.resourcePath}-${varName}`;
429
+ let hash = scannedTables.createHashTable[uniqueKey];
430
+ if (!hash) {
431
+ hash = mergedCreateTable[varName];
432
+ }
433
+ if (hash) {
434
+ const obj = scannedTables.createObjectTable[hash];
435
+ const atomicMap = scannedTables.createAtomicMapTable[hash];
436
+ if (obj && atomicMap) {
437
+ const hashMap = {};
438
+ Object.keys(obj).forEach((key) => {
439
+ if (atomicMap[key]) {
440
+ hashMap[key] = atomicMap[key];
441
+ }
442
+ });
443
+ replacements.push({
444
+ start: node.span.start - ast.span.start,
445
+ end: node.span.end - ast.span.start,
446
+ content: JSON.stringify(hashMap),
447
+ });
448
+ }
449
+ }
450
+ },
428
451
  CallExpression({ node }) {
429
452
  const callee = node.callee;
430
453
  let isPropsCall = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/turbopack-loader",
3
- "version": "6.1.2",
3
+ "version": "6.2.0",
4
4
  "description": "Plumeria Turbopack-loader",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "zero-virtual.css"
23
23
  ],
24
24
  "dependencies": {
25
- "@plumeria/utils": "^6.1.2"
25
+ "@plumeria/utils": "^6.2.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.8",
29
- "zss-engine": "2.1.2"
29
+ "zss-engine": "2.2.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public",