@plumeria/turbopack-loader 6.1.0 → 6.1.2
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 +46 -36
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -150,6 +150,9 @@ async function loader(source) {
|
|
|
150
150
|
const processedDecls = new Set();
|
|
151
151
|
const idSpans = new Set();
|
|
152
152
|
const excludedSpans = new Set();
|
|
153
|
+
if (scannedTables.extractedSheet) {
|
|
154
|
+
addSheet(scannedTables.extractedSheet);
|
|
155
|
+
}
|
|
153
156
|
const checkVariantAssignment = (decl) => {
|
|
154
157
|
if (decl.init &&
|
|
155
158
|
utils_1.t.isCallExpression(decl.init) &&
|
|
@@ -387,9 +390,30 @@ async function loader(source) {
|
|
|
387
390
|
if (utils_1.t.isIdentifier(node.object) && utils_1.t.isIdentifier(node.property)) {
|
|
388
391
|
const varName = node.object.value;
|
|
389
392
|
const propName = node.property.value;
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
+
const uniqueKey = `${this.resourcePath}-${varName}`;
|
|
394
|
+
let hash = scannedTables.createHashTable[uniqueKey];
|
|
395
|
+
if (!hash) {
|
|
396
|
+
hash = mergedCreateTable[varName];
|
|
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
|
+
if (hash) {
|
|
413
|
+
let atomMap;
|
|
414
|
+
if (scannedTables.createAtomicMapTable[hash]) {
|
|
415
|
+
atomMap = scannedTables.createAtomicMapTable[hash][propName];
|
|
416
|
+
}
|
|
393
417
|
if (atomMap) {
|
|
394
418
|
replacements.push({
|
|
395
419
|
start: node.span.start - ast.span.start,
|
|
@@ -399,29 +423,6 @@ async function loader(source) {
|
|
|
399
423
|
return;
|
|
400
424
|
}
|
|
401
425
|
}
|
|
402
|
-
const hash = mergedCreateTable[varName];
|
|
403
|
-
if (hash) {
|
|
404
|
-
const obj = scannedTables.createObjectTable[hash];
|
|
405
|
-
if (obj && obj[propName]) {
|
|
406
|
-
const style = obj[propName];
|
|
407
|
-
if (typeof style === 'object' && style !== null) {
|
|
408
|
-
const records = (0, utils_1.getStyleRecords)(propName, style, 2);
|
|
409
|
-
if (!isProduction) {
|
|
410
|
-
(0, utils_1.extractOndemandStyles)(style, extractedSheets, scannedTables);
|
|
411
|
-
records.forEach((r) => addSheet(r.sheet));
|
|
412
|
-
}
|
|
413
|
-
const atomMap = {};
|
|
414
|
-
records.forEach((r) => (atomMap[r.key] = r.hash));
|
|
415
|
-
if (Object.keys(atomMap).length > 0) {
|
|
416
|
-
replacements.push({
|
|
417
|
-
start: node.span.start - ast.span.start,
|
|
418
|
-
end: node.span.end - ast.span.start,
|
|
419
|
-
content: JSON.stringify(atomMap),
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
426
|
}
|
|
426
427
|
},
|
|
427
428
|
CallExpression({ node }) {
|
|
@@ -481,17 +482,21 @@ async function loader(source) {
|
|
|
481
482
|
}
|
|
482
483
|
else if (utils_1.t.isIdentifier(expr)) {
|
|
483
484
|
const varName = expr.value;
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
|
|
485
|
+
const uniqueKey = `${this.resourcePath}-${varName}`;
|
|
486
|
+
let hash = scannedTables.createHashTable[uniqueKey];
|
|
487
|
+
if (!hash) {
|
|
488
|
+
hash = mergedCreateTable[varName];
|
|
487
489
|
}
|
|
488
|
-
const hash = mergedCreateTable[varName];
|
|
489
490
|
if (hash) {
|
|
490
491
|
const obj = scannedTables.createObjectTable[hash];
|
|
491
492
|
if (obj && typeof obj === 'object') {
|
|
492
493
|
return obj;
|
|
493
494
|
}
|
|
494
495
|
}
|
|
496
|
+
const styleInfo = localCreateStyles[varName];
|
|
497
|
+
if (styleInfo && styleInfo.obj) {
|
|
498
|
+
return styleInfo.obj;
|
|
499
|
+
}
|
|
495
500
|
if (localCreateStyles[varName]) {
|
|
496
501
|
return localCreateStyles[varName].obj;
|
|
497
502
|
}
|
|
@@ -511,13 +516,18 @@ async function loader(source) {
|
|
|
511
516
|
if (utils_1.t.isCallExpression(expr) && utils_1.t.isIdentifier(expr.callee)) {
|
|
512
517
|
const varName = expr.callee.value;
|
|
513
518
|
let variantObj;
|
|
514
|
-
|
|
515
|
-
|
|
519
|
+
const uniqueKey = `${this.resourcePath}-${varName}`;
|
|
520
|
+
let hash = scannedTables.variantsHashTable[uniqueKey];
|
|
521
|
+
if (!hash) {
|
|
522
|
+
hash = mergedVariantsTable[varName];
|
|
523
|
+
}
|
|
524
|
+
if (hash && scannedTables.variantsObjectTable[hash]) {
|
|
525
|
+
variantObj = scannedTables.variantsObjectTable[hash];
|
|
516
526
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
variantObj =
|
|
527
|
+
if (!variantObj) {
|
|
528
|
+
if (localCreateStyles[varName] &&
|
|
529
|
+
localCreateStyles[varName].obj) {
|
|
530
|
+
variantObj = localCreateStyles[varName].obj;
|
|
521
531
|
}
|
|
522
532
|
}
|
|
523
533
|
if (variantObj) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/turbopack-loader",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.2",
|
|
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": "^6.1.
|
|
25
|
+
"@plumeria/utils": "^6.1.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@swc/core": "1.15.8",
|