@plumeria/turbopack-loader 16.2.10 → 16.2.12
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 +21 -29
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -90,6 +90,25 @@ async function loader(source) {
|
|
|
90
90
|
err.stack = err.message;
|
|
91
91
|
throw err;
|
|
92
92
|
};
|
|
93
|
+
const assertResolvable = (node) => {
|
|
94
|
+
if (utils_1.t.isIdentifier(node) && node.value === 'undefined')
|
|
95
|
+
return;
|
|
96
|
+
if (utils_1.t.isMemberExpression(node) ||
|
|
97
|
+
utils_1.t.isIdentifier(node) ||
|
|
98
|
+
utils_1.t.isCallExpression(node) ||
|
|
99
|
+
utils_1.t.isArrowFunctionExpression(node) ||
|
|
100
|
+
utils_1.t.isFunctionExpression(node)) {
|
|
101
|
+
const rootId = (0, utils_1.getRootIdentifier)(node);
|
|
102
|
+
const isPlumeriaStyle = rootId &&
|
|
103
|
+
((localCreateStyles[rootId] !== undefined &&
|
|
104
|
+
localCreateStyles[rootId].type !== 'constant') ||
|
|
105
|
+
mergedCreateTable[rootId] !== undefined ||
|
|
106
|
+
mergedVariantsTable[rootId] !== undefined);
|
|
107
|
+
if (!isPlumeriaStyle) {
|
|
108
|
+
throwCompilationError(`Plumeria: Dynamic or unresolvable style object "${getSource(node)}" is not supported.`, node);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
93
112
|
for (const node of ast.body) {
|
|
94
113
|
if (node.type === 'ImportDeclaration') {
|
|
95
114
|
const sourcePath = node.source.value;
|
|
@@ -746,24 +765,6 @@ async function loader(source) {
|
|
|
746
765
|
let groupIdCounter = 0;
|
|
747
766
|
let baseStyle = {};
|
|
748
767
|
let isOptimizable = true;
|
|
749
|
-
const getRootIdentifier = (node) => {
|
|
750
|
-
if (utils_1.t.isIdentifier(node)) {
|
|
751
|
-
return node.value;
|
|
752
|
-
}
|
|
753
|
-
if (utils_1.t.isMemberExpression(node)) {
|
|
754
|
-
return getRootIdentifier(node.object);
|
|
755
|
-
}
|
|
756
|
-
if (utils_1.t.isCallExpression(node)) {
|
|
757
|
-
const callee = node.callee;
|
|
758
|
-
if (callee.type !== 'Super' && callee.type !== 'Import') {
|
|
759
|
-
return getRootIdentifier(callee);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
if (node.type === 'ParenthesisExpression') {
|
|
763
|
-
return getRootIdentifier(node.expression);
|
|
764
|
-
}
|
|
765
|
-
return null;
|
|
766
|
-
};
|
|
767
768
|
const resolveCreateObject = (varName) => {
|
|
768
769
|
const localStyle = localCreateStyles[varName];
|
|
769
770
|
if (localStyle?.type === 'create')
|
|
@@ -828,6 +829,7 @@ async function loader(source) {
|
|
|
828
829
|
else if (node.type === 'ParenthesisExpression') {
|
|
829
830
|
return collectConditions(node.expression, currentTestStrings);
|
|
830
831
|
}
|
|
832
|
+
assertResolvable(node);
|
|
831
833
|
return false;
|
|
832
834
|
};
|
|
833
835
|
for (const arg of args) {
|
|
@@ -1034,17 +1036,7 @@ async function loader(source) {
|
|
|
1034
1036
|
const handled = collectConditions(expr);
|
|
1035
1037
|
if (handled)
|
|
1036
1038
|
continue;
|
|
1037
|
-
|
|
1038
|
-
const rootId = getRootIdentifier(expr);
|
|
1039
|
-
const isPlumeriaStyle = rootId &&
|
|
1040
|
-
((localCreateStyles[rootId] !== undefined &&
|
|
1041
|
-
localCreateStyles[rootId].type !== 'constant') ||
|
|
1042
|
-
mergedCreateTable[rootId] !== undefined ||
|
|
1043
|
-
mergedVariantsTable[rootId] !== undefined);
|
|
1044
|
-
if (!isPlumeriaStyle) {
|
|
1045
|
-
throwCompilationError(`Plumeria: Dynamic or unresolvable style object "${getSource(expr)}" is not supported.`, expr);
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1039
|
+
assertResolvable(expr);
|
|
1048
1040
|
isOptimizable = false;
|
|
1049
1041
|
break;
|
|
1050
1042
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/turbopack-loader",
|
|
3
|
-
"version": "16.2.
|
|
3
|
+
"version": "16.2.12",
|
|
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": "^16.2.
|
|
25
|
+
"@plumeria/utils": "^16.2.12"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@swc/core": "1.15.43",
|
|
29
|
-
"zss-engine": "2.3.
|
|
29
|
+
"zss-engine": "2.3.2"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public",
|