@plumeria/turbopack-loader 11.0.0 → 11.0.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 +17 -9
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1139,19 +1139,23 @@ async function loader(source) {
|
|
|
1139
1139
|
if (styleInfo?.functions?.[propKey]) {
|
|
1140
1140
|
const func = styleInfo.functions[propKey];
|
|
1141
1141
|
const callArgs = expr.arguments;
|
|
1142
|
-
const
|
|
1143
|
-
if (callArgs.length
|
|
1144
|
-
const
|
|
1142
|
+
const hasSpread = callArgs.some((a) => a.spread);
|
|
1143
|
+
if (!hasSpread && callArgs.length >= 1) {
|
|
1144
|
+
const tempStaticTable = { ...mergedStaticTable };
|
|
1145
1145
|
const cssVarInfo = {};
|
|
1146
|
-
if (
|
|
1147
|
-
|
|
1146
|
+
if (callArgs.length === 1 &&
|
|
1147
|
+
callArgs[0].expression.type === 'ObjectExpression') {
|
|
1148
|
+
const argObj = (0, utils_1.objectExpressionToObject)(callArgs[0].expression, mergedStaticTable, mergedKeyframesTable, mergedViewTransitionTable, mergedCreateThemeHashTable, scannedTables.createThemeObjectTable, mergedCreateTable, mergedCreateStaticHashTable, scannedTables.createStaticObjectTable, mergedVariantsTable);
|
|
1148
1149
|
func.params.forEach((p) => {
|
|
1149
1150
|
if (argObj[p] !== undefined)
|
|
1150
1151
|
tempStaticTable[p] = argObj[p];
|
|
1151
1152
|
});
|
|
1152
1153
|
}
|
|
1153
1154
|
else {
|
|
1154
|
-
|
|
1155
|
+
callArgs.forEach((_callArg, i) => {
|
|
1156
|
+
const p = func.params[i];
|
|
1157
|
+
if (!p)
|
|
1158
|
+
return;
|
|
1155
1159
|
const cssVar = `--${propKey}-${p}`;
|
|
1156
1160
|
tempStaticTable[p] = `var(${cssVar})`;
|
|
1157
1161
|
cssVarInfo[p] = { cssVar, propKey: '' };
|
|
@@ -1164,12 +1168,16 @@ async function loader(source) {
|
|
|
1164
1168
|
if (hashes)
|
|
1165
1169
|
dynamicClassParts.push(JSON.stringify(hashes));
|
|
1166
1170
|
if (Object.keys(cssVarInfo).length > 0) {
|
|
1167
|
-
Object.entries(cssVarInfo).forEach(([
|
|
1171
|
+
Object.entries(cssVarInfo).forEach(([paramName, info]) => {
|
|
1168
1172
|
const targetProp = Object.keys(substituted).find((k) => typeof substituted[k] === 'string' &&
|
|
1169
1173
|
substituted[k].includes(info.cssVar));
|
|
1170
1174
|
if (targetProp) {
|
|
1171
|
-
const
|
|
1172
|
-
const
|
|
1175
|
+
const paramIndex = func.params.indexOf(paramName);
|
|
1176
|
+
const srcArg = paramIndex >= 0 && callArgs[paramIndex]
|
|
1177
|
+
? callArgs[paramIndex].expression
|
|
1178
|
+
: callArgs[0].expression;
|
|
1179
|
+
const argStart = srcArg.span.start - baseByteOffset;
|
|
1180
|
+
const argEnd = srcArg.span.end - baseByteOffset;
|
|
1173
1181
|
const argSource = sourceBuffer
|
|
1174
1182
|
.subarray(argStart, argEnd)
|
|
1175
1183
|
.toString('utf-8');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/turbopack-loader",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.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": "^11.0.
|
|
25
|
+
"@plumeria/utils": "^11.0.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@swc/core": "1.15.21",
|