@plumeria/utils 7.5.1 → 7.5.3
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 +1 -25
- package/dist/types.d.ts +0 -1
- 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(
|
|
31
|
+
export declare function scanAll(): 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() {
|
|
497
497
|
if (process.env.NODE_ENV === 'production' && globalAgregatedTables) {
|
|
498
498
|
return globalAgregatedTables;
|
|
499
499
|
}
|
|
@@ -512,10 +512,8 @@ function scanAll(isExtractSheet) {
|
|
|
512
512
|
createThemeHashTable: {},
|
|
513
513
|
createStaticHashTable: {},
|
|
514
514
|
createStaticObjectTable: {},
|
|
515
|
-
extractedSheet: '',
|
|
516
515
|
};
|
|
517
516
|
const files = fs_1.default.globSync(PATTERN_PATH, GLOB_OPTIONS);
|
|
518
|
-
const totalExtractedSheets = [];
|
|
519
517
|
for (let passNumber = 1; passNumber <= 2; passNumber++) {
|
|
520
518
|
const isFirstPass = passNumber === 1;
|
|
521
519
|
for (const filePath of files) {
|
|
@@ -580,9 +578,6 @@ function scanAll(isExtractSheet) {
|
|
|
580
578
|
localTables.variantsObjectTable[key] =
|
|
581
579
|
cached.variantsObjectTable[key];
|
|
582
580
|
}
|
|
583
|
-
if (cached.extractedSheet) {
|
|
584
|
-
totalExtractedSheets.push(cached.extractedSheet);
|
|
585
|
-
}
|
|
586
581
|
}
|
|
587
582
|
continue;
|
|
588
583
|
}
|
|
@@ -605,7 +600,6 @@ function scanAll(isExtractSheet) {
|
|
|
605
600
|
createStaticHashTable: {},
|
|
606
601
|
createStaticObjectTable: {},
|
|
607
602
|
hasCssUsage: false,
|
|
608
|
-
extractedSheet: '',
|
|
609
603
|
};
|
|
610
604
|
continue;
|
|
611
605
|
}
|
|
@@ -629,7 +623,6 @@ function scanAll(isExtractSheet) {
|
|
|
629
623
|
const localCreateStaticHashTable = {};
|
|
630
624
|
const localCreateStaticObjectTable = {};
|
|
631
625
|
const plumeriaAliases = {};
|
|
632
|
-
const fileExtractedSheets = [];
|
|
633
626
|
for (const node of ast.body) {
|
|
634
627
|
if (node.type === 'ImportDeclaration') {
|
|
635
628
|
const sourceValue = node.source.value;
|
|
@@ -777,8 +770,6 @@ function scanAll(isExtractSheet) {
|
|
|
777
770
|
localTables.keyframesObjectTable[hash] = obj;
|
|
778
771
|
localTables.keyframesObjectTable[hash] = obj;
|
|
779
772
|
localKeyframesObjectTable[hash] = obj;
|
|
780
|
-
if (isExtractSheet)
|
|
781
|
-
extractOndemandStyles({ kf: `kf-${hash}` }, fileExtractedSheets, localTables);
|
|
782
773
|
}
|
|
783
774
|
else if (method === 'viewTransition') {
|
|
784
775
|
const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
|
|
@@ -787,8 +778,6 @@ function scanAll(isExtractSheet) {
|
|
|
787
778
|
localTables.viewTransitionObjectTable[hash] = obj;
|
|
788
779
|
localTables.viewTransitionObjectTable[hash] = obj;
|
|
789
780
|
localViewTransitionObjectTable[hash] = obj;
|
|
790
|
-
if (isExtractSheet)
|
|
791
|
-
extractOndemandStyles({ vt: `vt-${hash}` }, fileExtractedSheets, localTables);
|
|
792
781
|
}
|
|
793
782
|
else if (method === 'createTheme') {
|
|
794
783
|
const hash = (0, zss_engine_1.genBase36Hash)(obj, 1, 8);
|
|
@@ -816,14 +805,6 @@ function scanAll(isExtractSheet) {
|
|
|
816
805
|
const atomMap = {};
|
|
817
806
|
records.forEach((r) => (atomMap[r.key] = r.hash));
|
|
818
807
|
hashMap[key] = atomMap;
|
|
819
|
-
if (isExtractSheet) {
|
|
820
|
-
extractOndemandStyles(style, fileExtractedSheets, localTables);
|
|
821
|
-
records.forEach((r) => {
|
|
822
|
-
if (!fileExtractedSheets.includes(r.sheet)) {
|
|
823
|
-
fileExtractedSheets.push(r.sheet);
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
808
|
});
|
|
828
809
|
localCreateAtomicMapTable[hash] = hashMap;
|
|
829
810
|
localTables.createAtomicMapTable[hash] = hashMap;
|
|
@@ -857,18 +838,13 @@ function scanAll(isExtractSheet) {
|
|
|
857
838
|
createStaticHashTable: localCreateStaticHashTable,
|
|
858
839
|
createStaticObjectTable: localCreateStaticObjectTable,
|
|
859
840
|
hasCssUsage: true,
|
|
860
|
-
extractedSheet: fileExtractedSheets.join(''),
|
|
861
841
|
};
|
|
862
|
-
if (fileExtractedSheets.length > 0) {
|
|
863
|
-
totalExtractedSheets.push(fileExtractedSheets.join(''));
|
|
864
|
-
}
|
|
865
842
|
}
|
|
866
843
|
}
|
|
867
844
|
catch (e) {
|
|
868
845
|
}
|
|
869
846
|
}
|
|
870
847
|
}
|
|
871
|
-
localTables.extractedSheet = totalExtractedSheets.join('');
|
|
872
848
|
if (process.env.NODE_ENV === 'production') {
|
|
873
849
|
globalAgregatedTables = localTables;
|
|
874
850
|
}
|
package/dist/types.d.ts
CHANGED