@plumeria/utils 7.1.2 → 7.2.1
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/parser.d.ts +1 -1
- package/dist/parser.js +5 -11
- package/dist/variants.d.ts +0 -1
- package/dist/variants.js +0 -10
- package/package.json +1 -1
package/dist/parser.d.ts
CHANGED
|
@@ -28,6 +28,6 @@ export declare function traverse(node: Module, visitor: {
|
|
|
28
28
|
}): void;
|
|
29
29
|
export declare function objectExpressionToObject(node: ObjectExpression, staticTable: StaticTable, keyframesHashTable: KeyframesHashTable, viewTransitionHashTable: ViewTransitionHashTable, createThemeHashTable: CreateThemeHashTable, createThemeObjectTable: CreateThemeObjectTable, createHashTable: CreateHashTable, createStaticHashTable: CreateStaticHashTable, createStaticObjectTable: CreateStaticObjectTable, variantsHashTable: VariantsHashTable, resolveVariable?: (name: string) => any): CSSObject;
|
|
30
30
|
export declare function collectLocalConsts(ast: Module): Record<string, any>;
|
|
31
|
-
export declare function scanAll(): Tables;
|
|
31
|
+
export declare function scanAll(isExtractSheet: boolean): Tables;
|
|
32
32
|
export declare function extractOndemandStyles(obj: any, extractedSheets: string[], t: Tables): void;
|
|
33
33
|
export declare function deepMerge(target: Record<string, any>, source: Record<string, any>): Record<string, any>;
|
package/dist/parser.js
CHANGED
|
@@ -493,7 +493,7 @@ function resolveCreateStaticTableMemberExpression(node, createStaticHashTable, c
|
|
|
493
493
|
}
|
|
494
494
|
const fileCache = {};
|
|
495
495
|
let globalAgregatedTables = null;
|
|
496
|
-
function scanAll() {
|
|
496
|
+
function scanAll(isExtractSheet) {
|
|
497
497
|
if (process.env.NODE_ENV === 'production' && globalAgregatedTables) {
|
|
498
498
|
return globalAgregatedTables;
|
|
499
499
|
}
|
|
@@ -516,7 +516,6 @@ function scanAll() {
|
|
|
516
516
|
};
|
|
517
517
|
const files = fs_1.default.globSync(PATTERN_PATH, GLOB_OPTIONS);
|
|
518
518
|
const totalExtractedSheets = [];
|
|
519
|
-
const currentScanThemeObjectTable = {};
|
|
520
519
|
for (let passNumber = 1; passNumber <= 2; passNumber++) {
|
|
521
520
|
const isFirstPass = passNumber === 1;
|
|
522
521
|
for (const filePath of files) {
|
|
@@ -552,8 +551,6 @@ function scanAll() {
|
|
|
552
551
|
for (const key of Object.keys(cached.createThemeObjectTable)) {
|
|
553
552
|
localTables.createThemeObjectTable[key] =
|
|
554
553
|
cached.createThemeObjectTable[key];
|
|
555
|
-
currentScanThemeObjectTable[key] =
|
|
556
|
-
cached.createThemeObjectTable[key];
|
|
557
554
|
}
|
|
558
555
|
for (const key of Object.keys(cached.createStaticHashTable)) {
|
|
559
556
|
localTables.createStaticHashTable[`${filePath}-${key}`] =
|
|
@@ -633,7 +630,6 @@ function scanAll() {
|
|
|
633
630
|
const localCreateStaticObjectTable = {};
|
|
634
631
|
const plumeriaAliases = {};
|
|
635
632
|
const fileExtractedSheets = [];
|
|
636
|
-
const isProduction = process.env.NODE_ENV === 'production';
|
|
637
633
|
for (const node of ast.body) {
|
|
638
634
|
if (node.type === 'ImportDeclaration') {
|
|
639
635
|
const sourceValue = node.source.value;
|
|
@@ -781,9 +777,8 @@ function scanAll() {
|
|
|
781
777
|
localTables.keyframesObjectTable[hash] = obj;
|
|
782
778
|
localTables.keyframesObjectTable[hash] = obj;
|
|
783
779
|
localKeyframesObjectTable[hash] = obj;
|
|
784
|
-
if (
|
|
780
|
+
if (isExtractSheet)
|
|
785
781
|
extractOndemandStyles({ kf: `kf-${hash}` }, fileExtractedSheets, localTables);
|
|
786
|
-
}
|
|
787
782
|
}
|
|
788
783
|
else if (method === 'viewTransition') {
|
|
789
784
|
const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
|
|
@@ -792,9 +787,8 @@ function scanAll() {
|
|
|
792
787
|
localTables.viewTransitionObjectTable[hash] = obj;
|
|
793
788
|
localTables.viewTransitionObjectTable[hash] = obj;
|
|
794
789
|
localViewTransitionObjectTable[hash] = obj;
|
|
795
|
-
if (
|
|
790
|
+
if (isExtractSheet)
|
|
796
791
|
extractOndemandStyles({ vt: `vt-${hash}` }, fileExtractedSheets, localTables);
|
|
797
|
-
}
|
|
798
792
|
}
|
|
799
793
|
else if (method === 'createTheme') {
|
|
800
794
|
const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
|
|
@@ -802,7 +796,7 @@ function scanAll() {
|
|
|
802
796
|
localCreateThemeObjectTable[hash] = obj;
|
|
803
797
|
localCreateThemeHashTable[name] = hash;
|
|
804
798
|
localTables.createThemeHashTable[uniqueKey] = hash;
|
|
805
|
-
|
|
799
|
+
localTables.createThemeObjectTable[hash] = obj;
|
|
806
800
|
const hashMap = {};
|
|
807
801
|
for (const [key] of Object.entries(obj)) {
|
|
808
802
|
const cssVarName = (0, zss_engine_1.camelToKebabCase)(key);
|
|
@@ -822,7 +816,7 @@ function scanAll() {
|
|
|
822
816
|
const atomMap = {};
|
|
823
817
|
records.forEach((r) => (atomMap[r.key] = r.hash));
|
|
824
818
|
hashMap[key] = atomMap;
|
|
825
|
-
if (
|
|
819
|
+
if (isExtractSheet) {
|
|
826
820
|
extractOndemandStyles(style, fileExtractedSheets, localTables);
|
|
827
821
|
records.forEach((r) => {
|
|
828
822
|
if (!fileExtractedSheets.includes(r.sheet)) {
|
package/dist/variants.d.ts
CHANGED
package/dist/variants.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.processVariants = processVariants;
|
|
|
4
4
|
const parser_1 = require("./parser");
|
|
5
5
|
const create_1 = require("./create");
|
|
6
6
|
function processVariants(variants) {
|
|
7
|
-
const sheets = [];
|
|
8
7
|
const variantKeys = Object.keys(variants);
|
|
9
8
|
const variantProperties = {};
|
|
10
9
|
variantKeys.forEach((key) => {
|
|
@@ -66,10 +65,6 @@ function processVariants(variants) {
|
|
|
66
65
|
const optionMap = {};
|
|
67
66
|
Object.entries(variants[key]).forEach(([optKey, style]) => {
|
|
68
67
|
const records = (0, create_1.getStyleRecords)(style);
|
|
69
|
-
records.forEach((r) => {
|
|
70
|
-
if (!sheets.includes(r.sheet))
|
|
71
|
-
sheets.push(r.sheet);
|
|
72
|
-
});
|
|
73
68
|
optionMap[optKey] = records.map((r) => r.hash).join(' ');
|
|
74
69
|
});
|
|
75
70
|
hashMap[key] = optionMap;
|
|
@@ -89,10 +84,6 @@ function processVariants(variants) {
|
|
|
89
84
|
}
|
|
90
85
|
});
|
|
91
86
|
const records = (0, create_1.getStyleRecords)(mergedStyle);
|
|
92
|
-
records.forEach((r) => {
|
|
93
|
-
if (!sheets.includes(r.sheet))
|
|
94
|
-
sheets.push(r.sheet);
|
|
95
|
-
});
|
|
96
87
|
const className = records.map((r) => r.hash).join(' ');
|
|
97
88
|
if (className) {
|
|
98
89
|
compoundMap[comboKeyParts.join(':')] = className;
|
|
@@ -116,6 +107,5 @@ function processVariants(variants) {
|
|
|
116
107
|
}
|
|
117
108
|
return {
|
|
118
109
|
hashMap,
|
|
119
|
-
sheets,
|
|
120
110
|
};
|
|
121
111
|
}
|