@plumeria/turbopack-loader 18.5.3 → 18.5.4
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 +22 -12
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -546,16 +546,25 @@ async function loader(source) {
|
|
|
546
546
|
};
|
|
547
547
|
const replacements = [];
|
|
548
548
|
const deferredSources = [];
|
|
549
|
-
const
|
|
549
|
+
const deferRange = (start, end) => {
|
|
550
550
|
const token = `__plumeria_preserved_${deferredSources.length}__`;
|
|
551
|
-
deferredSources.push({
|
|
552
|
-
token,
|
|
553
|
-
start: node.span.start - baseByteOffset,
|
|
554
|
-
end: node.span.end - baseByteOffset,
|
|
555
|
-
stripObject,
|
|
556
|
-
});
|
|
551
|
+
deferredSources.push({ token, start, end });
|
|
557
552
|
return token;
|
|
558
553
|
};
|
|
554
|
+
const deferSource = (node) => deferRange(node.span.start - baseByteOffset, node.span.end - baseByteOffset);
|
|
555
|
+
const deferProperty = (property) => {
|
|
556
|
+
const node = property;
|
|
557
|
+
const range = node.spread && node.arguments
|
|
558
|
+
? { start: node.spread.start, end: node.arguments.span.end }
|
|
559
|
+
: node.span
|
|
560
|
+
? { start: node.span.start, end: node.span.end }
|
|
561
|
+
: node.key && node.value
|
|
562
|
+
? { start: node.key.span.start, end: node.value.span.end }
|
|
563
|
+
: null;
|
|
564
|
+
return range
|
|
565
|
+
? deferRange(range.start - baseByteOffset, range.end - baseByteOffset)
|
|
566
|
+
: null;
|
|
567
|
+
};
|
|
559
568
|
const dynamicFnCalls = [];
|
|
560
569
|
const processedDecls = new Set();
|
|
561
570
|
const separatelyExported = new Set();
|
|
@@ -2289,8 +2298,11 @@ async function loader(source) {
|
|
|
2289
2298
|
if (styleAttrExisting.value?.type === 'JSXExpressionContainer') {
|
|
2290
2299
|
const innerExpr = styleAttrExisting.value?.expression;
|
|
2291
2300
|
if (innerExpr.type === 'ObjectExpression') {
|
|
2292
|
-
|
|
2293
|
-
|
|
2301
|
+
for (const property of innerExpr.properties) {
|
|
2302
|
+
const token = deferProperty(property);
|
|
2303
|
+
if (token)
|
|
2304
|
+
existingStyleParts.push(token);
|
|
2305
|
+
}
|
|
2294
2306
|
}
|
|
2295
2307
|
else {
|
|
2296
2308
|
existingStyleExpr = `...(${deferSource(innerExpr)})`;
|
|
@@ -2449,9 +2461,7 @@ async function loader(source) {
|
|
|
2449
2461
|
cursor = replacement.end;
|
|
2450
2462
|
}
|
|
2451
2463
|
pieces.push(sourceBuffer.subarray(cursor, deferred.end).toString('utf-8'));
|
|
2452
|
-
|
|
2453
|
-
if (deferred.stripObject)
|
|
2454
|
-
content = content.slice(1, -1).trim();
|
|
2464
|
+
const content = pieces.join('');
|
|
2455
2465
|
for (const replacement of replacements)
|
|
2456
2466
|
replacement.content = replacement.content.replaceAll(deferred.token, content);
|
|
2457
2467
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/turbopack-loader",
|
|
3
|
-
"version": "18.5.
|
|
3
|
+
"version": "18.5.4",
|
|
4
4
|
"description": "Plumeria Turbopack-loader",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"zero-virtual.css"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@plumeria/compiler": "^18.5.
|
|
33
|
-
"@plumeria/utils": "^18.5.
|
|
32
|
+
"@plumeria/compiler": "^18.5.4",
|
|
33
|
+
"@plumeria/utils": "^18.5.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@swc/core": "1.15.47",
|