@plumeria/turbopack-loader 18.3.3 → 18.3.5
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 +11 -9
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -603,16 +603,17 @@ async function loader(source) {
|
|
|
603
603
|
if (utils_1.t.isIdentifier(node.id)) {
|
|
604
604
|
idSpans.add(node.id.span.start);
|
|
605
605
|
}
|
|
606
|
-
let selector = '';
|
|
607
606
|
const selectorExpr = init.arguments[0].expression;
|
|
608
|
-
|
|
609
|
-
|
|
607
|
+
const selector = (0, utils_1.resolveThemeSelector)(selectorExpr, mergedStaticTable, mergedCreateStaticHashTable, scannedTables.createStaticObjectTable);
|
|
608
|
+
if (!selector) {
|
|
609
|
+
throwCompilationError(`Plumeria: createTheme needs a selector it can read at build time. ` +
|
|
610
|
+
`Pass a string literal such as ".dark", or a name this file declares as one.`, selectorExpr);
|
|
610
611
|
}
|
|
611
612
|
if (selector.startsWith('@') && !(0, zss_engine_1.isAtRule)(selector)) {
|
|
612
613
|
throwCompilationError(`Plumeria: Unsupported at-rule: "${selector}". createTheme only supports nesting at-rules such as @media, @container, @supports, @layer, and @scope.`, selectorExpr);
|
|
613
614
|
}
|
|
614
615
|
const obj = (0, utils_1.objectExpressionToObject)(init.arguments[1].expression, mergedStaticTable, mergedKeyframesTable, mergedViewTransitionTable, mergedCreateThemeHashTable, scannedTables.createThemeObjectTable, mergedCreateTable, mergedCreateStaticHashTable, scannedTables.createStaticObjectTable, mergedVariantsTable);
|
|
615
|
-
const hash = (0,
|
|
616
|
+
const hash = (0, utils_1.themeHashOf)(selector, obj);
|
|
616
617
|
if (utils_1.t.isIdentifier(node.id)) {
|
|
617
618
|
const uniqueKey = `${resourcePath}-${node.id.value}`;
|
|
618
619
|
scannedTables.createThemeHashTable[uniqueKey] = hash;
|
|
@@ -624,7 +625,7 @@ async function loader(source) {
|
|
|
624
625
|
const themeHashMap = {};
|
|
625
626
|
for (const [key, value] of Object.entries(obj)) {
|
|
626
627
|
const cssVarName = (0, zss_engine_1.camelToKebabCase)(key);
|
|
627
|
-
const atomicHash = (0, zss_engine_1.genBase36Hash)({ [key]: value }, 1, 8);
|
|
628
|
+
const atomicHash = (0, zss_engine_1.genBase36Hash)({ _theme: hash, [key]: value }, 1, 8);
|
|
628
629
|
themeHashMap[key] = `var(--${atomicHash}-${cssVarName})`;
|
|
629
630
|
}
|
|
630
631
|
localCreateStyles[node.id.value] = {
|
|
@@ -783,16 +784,17 @@ async function loader(source) {
|
|
|
783
784
|
else if (propName === 'createTheme' &&
|
|
784
785
|
args.length >= 2 &&
|
|
785
786
|
utils_1.t.isObjectExpression(args[1].expression)) {
|
|
786
|
-
let selector = '';
|
|
787
787
|
const selectorExpr = args[0].expression;
|
|
788
|
-
|
|
789
|
-
|
|
788
|
+
const selector = (0, utils_1.resolveThemeSelector)(selectorExpr, mergedStaticTable, mergedCreateStaticHashTable, scannedTables.createStaticObjectTable);
|
|
789
|
+
if (!selector) {
|
|
790
|
+
throwCompilationError(`Plumeria: createTheme needs a selector it can read at build time. ` +
|
|
791
|
+
`Pass a string literal such as ".dark", or a name this file declares as one.`, selectorExpr);
|
|
790
792
|
}
|
|
791
793
|
if (selector.startsWith('@') && !(0, zss_engine_1.isAtRule)(selector)) {
|
|
792
794
|
throwCompilationError(`Plumeria: Unsupported at-rule: "${selector}". createTheme only supports nesting at-rules such as @media, @container, @supports, @layer, and @scope.`, selectorExpr);
|
|
793
795
|
}
|
|
794
796
|
const obj = (0, utils_1.objectExpressionToObject)(args[1].expression, mergedStaticTable, mergedKeyframesTable, mergedViewTransitionTable, mergedCreateThemeHashTable, scannedTables.createThemeObjectTable, mergedCreateTable, mergedCreateStaticHashTable, scannedTables.createStaticObjectTable, mergedVariantsTable);
|
|
795
|
-
const hash = (0,
|
|
797
|
+
const hash = (0, utils_1.themeHashOf)(selector, obj);
|
|
796
798
|
scannedTables.createThemeObjectTable[hash] = obj;
|
|
797
799
|
if (scannedTables.createThemeSelectorTable) {
|
|
798
800
|
scannedTables.createThemeSelectorTable[hash] = selector;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/turbopack-loader",
|
|
3
|
-
"version": "18.3.
|
|
3
|
+
"version": "18.3.5",
|
|
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.3.
|
|
33
|
-
"@plumeria/utils": "^18.3.
|
|
32
|
+
"@plumeria/compiler": "^18.3.5",
|
|
33
|
+
"@plumeria/utils": "^18.3.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@swc/core": "1.15.47",
|