@pandacss/node 0.22.0 → 0.23.0
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -13
- package/dist/index.mjs +17 -13
- package/package.json +13 -14
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2656,6 +2656,7 @@ var Builder = class {
|
|
|
2656
2656
|
*/
|
|
2657
2657
|
context;
|
|
2658
2658
|
hasEmitted = false;
|
|
2659
|
+
hasFilesChanged = true;
|
|
2659
2660
|
affecteds;
|
|
2660
2661
|
getConfigPath = () => {
|
|
2661
2662
|
const configPath = findConfig();
|
|
@@ -2675,18 +2676,21 @@ var Builder = class {
|
|
|
2675
2676
|
this.context = new PandaContext({ ...conf, hooks: ctx.hooks });
|
|
2676
2677
|
this.context.appendBaselineCss();
|
|
2677
2678
|
});
|
|
2679
|
+
import_logger6.logger.debug("builder", this.affecteds);
|
|
2678
2680
|
if (this.affecteds.hasConfigChanged) {
|
|
2679
2681
|
import_logger6.logger.debug("builder", "\u2699\uFE0F Config changed, reloading");
|
|
2680
2682
|
await ctx.hooks.callHook("config:change", ctx.config);
|
|
2681
2683
|
return;
|
|
2682
2684
|
}
|
|
2683
|
-
|
|
2684
|
-
if (hasFilesChanged) {
|
|
2685
|
+
this.hasFilesChanged = this.checkFilesChanged(ctx.getFiles());
|
|
2686
|
+
if (this.hasFilesChanged) {
|
|
2687
|
+
import_logger6.logger.debug("builder", "Files changed, invalidating them");
|
|
2685
2688
|
ctx.project.reloadSourceFiles();
|
|
2686
2689
|
}
|
|
2687
2690
|
};
|
|
2688
2691
|
async emit() {
|
|
2689
2692
|
if (this.hasEmitted && this.affecteds?.hasConfigChanged) {
|
|
2693
|
+
import_logger6.logger.debug("builder", "Emit artifacts after config change");
|
|
2690
2694
|
await emitArtifacts(this.getContextOrThrow(), Array.from(this.affecteds.artifacts));
|
|
2691
2695
|
}
|
|
2692
2696
|
this.hasEmitted = true;
|
|
@@ -2711,7 +2715,7 @@ var Builder = class {
|
|
|
2711
2715
|
};
|
|
2712
2716
|
extractFile = async (ctx, file) => {
|
|
2713
2717
|
const meta = this.getFileMeta(file);
|
|
2714
|
-
if (meta.isUnchanged) {
|
|
2718
|
+
if (meta.isUnchanged && this.affecteds?.hasConfigChanged) {
|
|
2715
2719
|
ctx.appendParserCss(parserResultMap.get(file));
|
|
2716
2720
|
return;
|
|
2717
2721
|
}
|
|
@@ -2726,11 +2730,13 @@ var Builder = class {
|
|
|
2726
2730
|
return files.some((file) => !this.getFileMeta(file).isUnchanged);
|
|
2727
2731
|
}
|
|
2728
2732
|
extract = async () => {
|
|
2733
|
+
const hasConfigChanged = this.affecteds ? this.affecteds.hasConfigChanged : true;
|
|
2734
|
+
if (!this.hasFilesChanged && !hasConfigChanged) {
|
|
2735
|
+
import_logger6.logger.debug("builder", "No files or config changed, skipping extract");
|
|
2736
|
+
return;
|
|
2737
|
+
}
|
|
2729
2738
|
const ctx = this.getContextOrThrow();
|
|
2730
2739
|
const files = ctx.getFiles();
|
|
2731
|
-
const hasConfigChanged = this.affecteds ? this.affecteds.hasConfigChanged : false;
|
|
2732
|
-
if (hasConfigChanged)
|
|
2733
|
-
return;
|
|
2734
2740
|
const done = import_logger6.logger.time.info("Extracted in");
|
|
2735
2741
|
const promises = files.map((file) => limit2(() => this.extractFile(ctx, file)));
|
|
2736
2742
|
await Promise.allSettled(promises);
|
|
@@ -2756,9 +2762,10 @@ var Builder = class {
|
|
|
2756
2762
|
this.initialRoot = root.toString();
|
|
2757
2763
|
}
|
|
2758
2764
|
root.removeAll();
|
|
2765
|
+
const css2 = this.toString();
|
|
2759
2766
|
const newCss = (0, import_core.optimizeCss)(`
|
|
2760
2767
|
${this.initialRoot}
|
|
2761
|
-
${
|
|
2768
|
+
${css2}
|
|
2762
2769
|
`);
|
|
2763
2770
|
root.append(newCss);
|
|
2764
2771
|
};
|
|
@@ -2794,7 +2801,6 @@ async function debugFiles(ctx, options) {
|
|
|
2794
2801
|
measureTotal();
|
|
2795
2802
|
return;
|
|
2796
2803
|
}
|
|
2797
|
-
const filesWithCss = [];
|
|
2798
2804
|
const results = await Promise.all(
|
|
2799
2805
|
files.map(async (file) => {
|
|
2800
2806
|
const measure = import_logger7.logger.time.debug(`Parsed ${file}`);
|
|
@@ -2803,9 +2809,8 @@ async function debugFiles(ctx, options) {
|
|
|
2803
2809
|
return { file, result };
|
|
2804
2810
|
})
|
|
2805
2811
|
);
|
|
2806
|
-
results.
|
|
2807
|
-
|
|
2808
|
-
return;
|
|
2812
|
+
const filteredResults = results.filter(({ result }) => result && !result.isEmpty());
|
|
2813
|
+
filteredResults.forEach(({ file, result }) => {
|
|
2809
2814
|
ctx.stylesheet.clean();
|
|
2810
2815
|
ctx.appendParserCss(result);
|
|
2811
2816
|
const css2 = ctx.stylesheet.toCss({ optimize: true, minify: false });
|
|
@@ -2813,7 +2818,6 @@ async function debugFiles(ctx, options) {
|
|
|
2813
2818
|
console.log({ path: file, ast: result, code: css2 });
|
|
2814
2819
|
}
|
|
2815
2820
|
if (outdir) {
|
|
2816
|
-
filesWithCss.push(file);
|
|
2817
2821
|
const parsedPath = (0, import_pathe4.parse)(file);
|
|
2818
2822
|
const relative3 = path2.relative(ctx.config.cwd, parsedPath.dir);
|
|
2819
2823
|
const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
|
|
@@ -2826,7 +2830,7 @@ async function debugFiles(ctx, options) {
|
|
|
2826
2830
|
]);
|
|
2827
2831
|
}
|
|
2828
2832
|
});
|
|
2829
|
-
import_logger7.logger.info("cli", `Found ${import_logger7.colors.bold(`${
|
|
2833
|
+
import_logger7.logger.info("cli", `Found ${import_logger7.colors.bold(`${filteredResults.length}/${files.length}`)} files using Panda`);
|
|
2830
2834
|
measureTotal();
|
|
2831
2835
|
}
|
|
2832
2836
|
|
package/dist/index.mjs
CHANGED
|
@@ -2630,6 +2630,7 @@ var Builder = class {
|
|
|
2630
2630
|
*/
|
|
2631
2631
|
context;
|
|
2632
2632
|
hasEmitted = false;
|
|
2633
|
+
hasFilesChanged = true;
|
|
2633
2634
|
affecteds;
|
|
2634
2635
|
getConfigPath = () => {
|
|
2635
2636
|
const configPath = findConfig();
|
|
@@ -2649,18 +2650,21 @@ var Builder = class {
|
|
|
2649
2650
|
this.context = new PandaContext({ ...conf, hooks: ctx.hooks });
|
|
2650
2651
|
this.context.appendBaselineCss();
|
|
2651
2652
|
});
|
|
2653
|
+
logger6.debug("builder", this.affecteds);
|
|
2652
2654
|
if (this.affecteds.hasConfigChanged) {
|
|
2653
2655
|
logger6.debug("builder", "\u2699\uFE0F Config changed, reloading");
|
|
2654
2656
|
await ctx.hooks.callHook("config:change", ctx.config);
|
|
2655
2657
|
return;
|
|
2656
2658
|
}
|
|
2657
|
-
|
|
2658
|
-
if (hasFilesChanged) {
|
|
2659
|
+
this.hasFilesChanged = this.checkFilesChanged(ctx.getFiles());
|
|
2660
|
+
if (this.hasFilesChanged) {
|
|
2661
|
+
logger6.debug("builder", "Files changed, invalidating them");
|
|
2659
2662
|
ctx.project.reloadSourceFiles();
|
|
2660
2663
|
}
|
|
2661
2664
|
};
|
|
2662
2665
|
async emit() {
|
|
2663
2666
|
if (this.hasEmitted && this.affecteds?.hasConfigChanged) {
|
|
2667
|
+
logger6.debug("builder", "Emit artifacts after config change");
|
|
2664
2668
|
await emitArtifacts(this.getContextOrThrow(), Array.from(this.affecteds.artifacts));
|
|
2665
2669
|
}
|
|
2666
2670
|
this.hasEmitted = true;
|
|
@@ -2685,7 +2689,7 @@ var Builder = class {
|
|
|
2685
2689
|
};
|
|
2686
2690
|
extractFile = async (ctx, file) => {
|
|
2687
2691
|
const meta = this.getFileMeta(file);
|
|
2688
|
-
if (meta.isUnchanged) {
|
|
2692
|
+
if (meta.isUnchanged && this.affecteds?.hasConfigChanged) {
|
|
2689
2693
|
ctx.appendParserCss(parserResultMap.get(file));
|
|
2690
2694
|
return;
|
|
2691
2695
|
}
|
|
@@ -2700,11 +2704,13 @@ var Builder = class {
|
|
|
2700
2704
|
return files.some((file) => !this.getFileMeta(file).isUnchanged);
|
|
2701
2705
|
}
|
|
2702
2706
|
extract = async () => {
|
|
2707
|
+
const hasConfigChanged = this.affecteds ? this.affecteds.hasConfigChanged : true;
|
|
2708
|
+
if (!this.hasFilesChanged && !hasConfigChanged) {
|
|
2709
|
+
logger6.debug("builder", "No files or config changed, skipping extract");
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2703
2712
|
const ctx = this.getContextOrThrow();
|
|
2704
2713
|
const files = ctx.getFiles();
|
|
2705
|
-
const hasConfigChanged = this.affecteds ? this.affecteds.hasConfigChanged : false;
|
|
2706
|
-
if (hasConfigChanged)
|
|
2707
|
-
return;
|
|
2708
2714
|
const done = logger6.time.info("Extracted in");
|
|
2709
2715
|
const promises = files.map((file) => limit2(() => this.extractFile(ctx, file)));
|
|
2710
2716
|
await Promise.allSettled(promises);
|
|
@@ -2730,9 +2736,10 @@ var Builder = class {
|
|
|
2730
2736
|
this.initialRoot = root.toString();
|
|
2731
2737
|
}
|
|
2732
2738
|
root.removeAll();
|
|
2739
|
+
const css2 = this.toString();
|
|
2733
2740
|
const newCss = optimizeCss(`
|
|
2734
2741
|
${this.initialRoot}
|
|
2735
|
-
${
|
|
2742
|
+
${css2}
|
|
2736
2743
|
`);
|
|
2737
2744
|
root.append(newCss);
|
|
2738
2745
|
};
|
|
@@ -2768,7 +2775,6 @@ async function debugFiles(ctx, options) {
|
|
|
2768
2775
|
measureTotal();
|
|
2769
2776
|
return;
|
|
2770
2777
|
}
|
|
2771
|
-
const filesWithCss = [];
|
|
2772
2778
|
const results = await Promise.all(
|
|
2773
2779
|
files.map(async (file) => {
|
|
2774
2780
|
const measure = logger7.time.debug(`Parsed ${file}`);
|
|
@@ -2777,9 +2783,8 @@ async function debugFiles(ctx, options) {
|
|
|
2777
2783
|
return { file, result };
|
|
2778
2784
|
})
|
|
2779
2785
|
);
|
|
2780
|
-
results.
|
|
2781
|
-
|
|
2782
|
-
return;
|
|
2786
|
+
const filteredResults = results.filter(({ result }) => result && !result.isEmpty());
|
|
2787
|
+
filteredResults.forEach(({ file, result }) => {
|
|
2783
2788
|
ctx.stylesheet.clean();
|
|
2784
2789
|
ctx.appendParserCss(result);
|
|
2785
2790
|
const css2 = ctx.stylesheet.toCss({ optimize: true, minify: false });
|
|
@@ -2787,7 +2792,6 @@ async function debugFiles(ctx, options) {
|
|
|
2787
2792
|
console.log({ path: file, ast: result, code: css2 });
|
|
2788
2793
|
}
|
|
2789
2794
|
if (outdir) {
|
|
2790
|
-
filesWithCss.push(file);
|
|
2791
2795
|
const parsedPath = parse2(file);
|
|
2792
2796
|
const relative3 = path2.relative(ctx.config.cwd, parsedPath.dir);
|
|
2793
2797
|
const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
|
|
@@ -2800,7 +2804,7 @@ async function debugFiles(ctx, options) {
|
|
|
2800
2804
|
]);
|
|
2801
2805
|
}
|
|
2802
2806
|
});
|
|
2803
|
-
logger7.info("cli", `Found ${colors.bold(`${
|
|
2807
|
+
logger7.info("cli", `Found ${colors.bold(`${filteredResults.length}/${files.length}`)} files using Panda`);
|
|
2804
2808
|
measureTotal();
|
|
2805
2809
|
}
|
|
2806
2810
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"ts-morph": "19.0.0",
|
|
49
49
|
"ts-pattern": "5.0.5",
|
|
50
50
|
"tsconfck": "^2.1.2",
|
|
51
|
-
"@pandacss/config": "0.
|
|
52
|
-
"@pandacss/
|
|
53
|
-
"@pandacss/
|
|
54
|
-
"@pandacss/
|
|
55
|
-
"@pandacss/
|
|
56
|
-
"@pandacss/
|
|
57
|
-
"@pandacss/
|
|
58
|
-
"@pandacss/parser": "0.
|
|
59
|
-
"@pandacss/shared": "0.
|
|
60
|
-
"@pandacss/token-dictionary": "0.
|
|
61
|
-
"@pandacss/types": "0.
|
|
51
|
+
"@pandacss/config": "0.23.0",
|
|
52
|
+
"@pandacss/extractor": "0.23.0",
|
|
53
|
+
"@pandacss/error": "0.23.0",
|
|
54
|
+
"@pandacss/core": "0.23.0",
|
|
55
|
+
"@pandacss/generator": "0.23.0",
|
|
56
|
+
"@pandacss/logger": "0.23.0",
|
|
57
|
+
"@pandacss/is-valid-prop": "0.23.0",
|
|
58
|
+
"@pandacss/parser": "0.23.0",
|
|
59
|
+
"@pandacss/shared": "0.23.0",
|
|
60
|
+
"@pandacss/token-dictionary": "0.23.0",
|
|
61
|
+
"@pandacss/types": "0.23.0"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@types/fs-extra": "11.0.4",
|
|
@@ -67,8 +67,7 @@
|
|
|
67
67
|
"@types/lodash.merge": "4.6.8",
|
|
68
68
|
"@types/pluralize": "0.0.33",
|
|
69
69
|
"boxen": "^7.1.1",
|
|
70
|
-
"p-limit": "^4.0.0"
|
|
71
|
-
"@pandacss/fixture": "0.22.0"
|
|
70
|
+
"p-limit": "^4.0.0"
|
|
72
71
|
},
|
|
73
72
|
"scripts": {
|
|
74
73
|
"build": "tsup src/index.ts --format=cjs,esm --shims --dts",
|