@plumeria/compiler 18.5.2 → 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 +10 -28
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -129,7 +129,6 @@ const dynamicTablesOf = (ctx) => ({
|
|
|
129
129
|
createHashTable: ctx.mergedCreateTable,
|
|
130
130
|
createStaticHashTable: ctx.mergedCreateStaticHashTable,
|
|
131
131
|
createStaticObjectTable: ctx.scannedTables.createStaticObjectTable,
|
|
132
|
-
variantsHashTable: ctx.mergedVariantsTable,
|
|
133
132
|
});
|
|
134
133
|
function extractStylesFromExpression(expression, ctx) {
|
|
135
134
|
let expr = expression;
|
|
@@ -270,7 +269,6 @@ function compileCSS(options) {
|
|
|
270
269
|
const viewTransitionImportMap = {};
|
|
271
270
|
const createImportMap = {};
|
|
272
271
|
const createFunctionImportMap = {};
|
|
273
|
-
const variantsImportMap = {};
|
|
274
272
|
const createThemeImportMap = {};
|
|
275
273
|
const createStaticImportMap = {};
|
|
276
274
|
const plumeriaAliases = {};
|
|
@@ -326,9 +324,6 @@ function compileCSS(options) {
|
|
|
326
324
|
scannedTables.createHashTable[uniqueKey];
|
|
327
325
|
if (scannedTables.createFunctionTable[uniqueKey])
|
|
328
326
|
createFunctionImportMap[localName] = (0, utils_1.styleFunctionsOf)(scannedTables.createFunctionTable[uniqueKey]);
|
|
329
|
-
if (scannedTables.variantsHashTable[uniqueKey])
|
|
330
|
-
variantsImportMap[localName] =
|
|
331
|
-
scannedTables.variantsHashTable[uniqueKey];
|
|
332
327
|
if (scannedTables.createThemeHashTable[uniqueKey])
|
|
333
328
|
createThemeImportMap[localName] =
|
|
334
329
|
scannedTables.createThemeHashTable[uniqueKey];
|
|
@@ -410,17 +405,6 @@ function compileCSS(options) {
|
|
|
410
405
|
for (const key of Object.keys(createImportMap)) {
|
|
411
406
|
mergedCreateTable[key] = createImportMap[key];
|
|
412
407
|
}
|
|
413
|
-
const mergedVariantsTable = {};
|
|
414
|
-
for (const key of Object.keys(scannedTables.variantsHashTable)) {
|
|
415
|
-
mergedVariantsTable[key] = scannedTables.variantsHashTable[key];
|
|
416
|
-
if (key.startsWith(`${resourcePath}-`)) {
|
|
417
|
-
const varName = key.slice(resourcePath.length + 1);
|
|
418
|
-
mergedVariantsTable[varName] = scannedTables.variantsHashTable[key];
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
for (const key of Object.keys(variantsImportMap)) {
|
|
422
|
-
mergedVariantsTable[key] = variantsImportMap[key];
|
|
423
|
-
}
|
|
424
408
|
const ctx = {
|
|
425
409
|
resourcePath,
|
|
426
410
|
mergedStaticTable,
|
|
@@ -429,7 +413,6 @@ function compileCSS(options) {
|
|
|
429
413
|
mergedCreateThemeHashTable,
|
|
430
414
|
mergedCreateStaticHashTable,
|
|
431
415
|
mergedCreateTable,
|
|
432
|
-
mergedVariantsTable,
|
|
433
416
|
scannedTables,
|
|
434
417
|
createFunctionImportMap,
|
|
435
418
|
localCreateStyles: {},
|
|
@@ -551,7 +534,7 @@ function compileCSS(options) {
|
|
|
551
534
|
return merged;
|
|
552
535
|
}
|
|
553
536
|
if (utils_1.t.isObjectExpression(expr)) {
|
|
554
|
-
return (0, utils_1.objectExpressionToObject)(expr, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable
|
|
537
|
+
return (0, utils_1.objectExpressionToObject)(expr, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable);
|
|
555
538
|
}
|
|
556
539
|
else if (utils_1.t.isMemberExpression(expr) &&
|
|
557
540
|
utils_1.t.isIdentifier(expr.object) &&
|
|
@@ -610,8 +593,7 @@ function compileCSS(options) {
|
|
|
610
593
|
const rootId = (0, utils_1.getRootIdentifier)(node);
|
|
611
594
|
const isPlumeriaStyle = rootId &&
|
|
612
595
|
(ctx.localCreateStyles[rootId] !== undefined ||
|
|
613
|
-
ctx.mergedCreateTable[rootId] !== undefined
|
|
614
|
-
ctx.mergedVariantsTable[rootId] !== undefined);
|
|
596
|
+
ctx.mergedCreateTable[rootId] !== undefined);
|
|
615
597
|
if (!isPlumeriaStyle) {
|
|
616
598
|
const origin = rootId ? localImports[rootId] : undefined;
|
|
617
599
|
const failure = origin
|
|
@@ -668,7 +650,7 @@ function compileCSS(options) {
|
|
|
668
650
|
properties: argExpr.properties.filter((prop) => prop.type === 'Identifier' ||
|
|
669
651
|
(prop.type === 'KeyValueProperty' &&
|
|
670
652
|
isStaticArgValue(prop.value))),
|
|
671
|
-
}, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable
|
|
653
|
+
}, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable);
|
|
672
654
|
if (func.named) {
|
|
673
655
|
const argExpr = callArgs[0]?.expression;
|
|
674
656
|
if (callArgs.length > 1 ||
|
|
@@ -925,14 +907,14 @@ function compileCSS(options) {
|
|
|
925
907
|
else if (propName === 'keyframes' &&
|
|
926
908
|
args.length > 0 &&
|
|
927
909
|
utils_1.t.isObjectExpression(args[0].expression)) {
|
|
928
|
-
const obj = (0, utils_1.objectExpressionToObject)(args[0].expression, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable
|
|
910
|
+
const obj = (0, utils_1.objectExpressionToObject)(args[0].expression, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable);
|
|
929
911
|
const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
|
|
930
912
|
ctx.scannedTables.keyframesObjectTable[hash] = obj;
|
|
931
913
|
}
|
|
932
914
|
else if (propName === 'viewTransition' &&
|
|
933
915
|
args.length > 0 &&
|
|
934
916
|
utils_1.t.isObjectExpression(args[0].expression)) {
|
|
935
|
-
const obj = (0, utils_1.objectExpressionToObject)(args[0].expression, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable
|
|
917
|
+
const obj = (0, utils_1.objectExpressionToObject)(args[0].expression, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable);
|
|
936
918
|
const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
|
|
937
919
|
ctx.scannedTables.viewTransitionObjectTable[hash] = obj;
|
|
938
920
|
}
|
|
@@ -949,7 +931,7 @@ function compileCSS(options) {
|
|
|
949
931
|
throw new Error(`[plumeria] Unsupported at-rule: "${selector}". createTheme only supports ` +
|
|
950
932
|
`nesting at-rules such as @media, @container, @supports, @layer, and @scope. (${path.basename(resourcePath)})`);
|
|
951
933
|
}
|
|
952
|
-
const obj = (0, utils_1.objectExpressionToObject)(args[1].expression, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable
|
|
934
|
+
const obj = (0, utils_1.objectExpressionToObject)(args[1].expression, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable);
|
|
953
935
|
const hash = (0, utils_1.themeHashOf)(selector, obj);
|
|
954
936
|
ctx.scannedTables.createThemeObjectTable[hash] = obj;
|
|
955
937
|
if (ctx.scannedTables.createThemeSelectorTable) {
|
|
@@ -959,7 +941,7 @@ function compileCSS(options) {
|
|
|
959
941
|
else if (propName === 'createStatic' &&
|
|
960
942
|
args.length > 0 &&
|
|
961
943
|
utils_1.t.isObjectExpression(args[0].expression)) {
|
|
962
|
-
const obj = (0, utils_1.objectExpressionToObject)(args[0].expression, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable
|
|
944
|
+
const obj = (0, utils_1.objectExpressionToObject)(args[0].expression, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable);
|
|
963
945
|
const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
|
|
964
946
|
ctx.scannedTables.createStaticObjectTable[hash] = obj;
|
|
965
947
|
}
|
|
@@ -1009,7 +991,7 @@ function compileCSS(options) {
|
|
|
1009
991
|
? ctx.scannedTables.createAtomicMapTable[ctx.mergedCreateThemeHashTable[name]]
|
|
1010
992
|
: undefined);
|
|
1011
993
|
if (pName === 'create') {
|
|
1012
|
-
const obj = (0, utils_1.objectExpressionToObject)(arg, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable,
|
|
994
|
+
const obj = (0, utils_1.objectExpressionToObject)(arg, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable, resolveVariable);
|
|
1013
995
|
if (obj) {
|
|
1014
996
|
const styleFunctions = (0, utils_1.styleFunctionsOf)(arg);
|
|
1015
997
|
ctx.localCreateStyles[node.id.value] = {
|
|
@@ -1030,7 +1012,7 @@ function compileCSS(options) {
|
|
|
1030
1012
|
throw new Error(`[plumeria] Unsupported at-rule: "${selector}". createTheme only supports ` +
|
|
1031
1013
|
`nesting at-rules such as @media, @container, @supports, @layer, and @scope. (${path.basename(resourcePath)})`);
|
|
1032
1014
|
}
|
|
1033
|
-
const obj = (0, utils_1.objectExpressionToObject)(arg, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable
|
|
1015
|
+
const obj = (0, utils_1.objectExpressionToObject)(arg, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable);
|
|
1034
1016
|
const hash = (0, utils_1.themeHashOf)(selector, obj);
|
|
1035
1017
|
const uKey = `${resourcePath}-${node.id.value}`;
|
|
1036
1018
|
ctx.scannedTables.createThemeHashTable[uKey] = hash;
|
|
@@ -1051,7 +1033,7 @@ function compileCSS(options) {
|
|
|
1051
1033
|
};
|
|
1052
1034
|
}
|
|
1053
1035
|
else if (pName === 'createStatic') {
|
|
1054
|
-
const obj = (0, utils_1.objectExpressionToObject)(arg, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable
|
|
1036
|
+
const obj = (0, utils_1.objectExpressionToObject)(arg, ctx.mergedStaticTable, ctx.mergedKeyframesTable, ctx.mergedViewTransitionTable, ctx.mergedCreateThemeHashTable, ctx.scannedTables.createThemeObjectTable, ctx.mergedCreateTable, ctx.mergedCreateStaticHashTable, ctx.scannedTables.createStaticObjectTable);
|
|
1055
1037
|
if (obj) {
|
|
1056
1038
|
const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
|
|
1057
1039
|
const uKey = `${resourcePath}-${node.id.value}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/compiler",
|
|
3
|
-
"version": "18.5.
|
|
3
|
+
"version": "18.5.4",
|
|
4
4
|
"description": "Plumeria swc based compiler for statically extracting css",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dist/"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@plumeria/utils": "^18.5.
|
|
24
|
+
"@plumeria/utils": "^18.5.4"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@rust-gear/glob": "1.1.1",
|