@pandacss/node 0.16.0 → 0.17.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.js +47 -40
- package/dist/index.mjs +47 -40
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.31_typescript@5.2.2/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.
|
|
38
|
+
"../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.31_typescript@5.2.2/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
39
|
"use strict";
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -782,7 +782,7 @@ init_cjs_shims();
|
|
|
782
782
|
var import_config2 = require("@pandacss/config");
|
|
783
783
|
var import_core3 = require("@pandacss/core");
|
|
784
784
|
var import_error = require("@pandacss/error");
|
|
785
|
-
var
|
|
785
|
+
var import_logger5 = require("@pandacss/logger");
|
|
786
786
|
var import_fs = require("fs");
|
|
787
787
|
var import_fs_extra2 = require("fs-extra");
|
|
788
788
|
var import_path2 = require("path");
|
|
@@ -927,22 +927,29 @@ var getOutputEngine = ({
|
|
|
927
927
|
const { dir = paths.root, files } = output;
|
|
928
928
|
fs.ensureDirSync(path2.join(...dir));
|
|
929
929
|
return Promise.allSettled(
|
|
930
|
-
files.map(async (
|
|
930
|
+
files.map(async (artifact) => {
|
|
931
|
+
if (!artifact)
|
|
932
|
+
return;
|
|
933
|
+
const { file, code } = artifact;
|
|
931
934
|
const absPath = path2.join(...dir, file);
|
|
932
|
-
if (code)
|
|
933
|
-
return
|
|
934
|
-
|
|
935
|
+
if (!code)
|
|
936
|
+
return;
|
|
937
|
+
return fs.writeFile(absPath, code);
|
|
935
938
|
})
|
|
936
939
|
);
|
|
937
940
|
}
|
|
938
941
|
});
|
|
939
942
|
|
|
940
943
|
// src/create-context.ts
|
|
944
|
+
var import_logger3 = require("@pandacss/logger");
|
|
941
945
|
var createContext = (conf) => {
|
|
942
946
|
const generator = (0, import_generator.createGenerator)(conf);
|
|
943
947
|
const config = conf.config;
|
|
944
948
|
const runtime = nodeRuntime;
|
|
945
949
|
config.cwd ||= runtime.cwd();
|
|
950
|
+
if (config.logLevel) {
|
|
951
|
+
import_logger3.logger.level = config.logLevel;
|
|
952
|
+
}
|
|
946
953
|
const { include, exclude, cwd } = config;
|
|
947
954
|
const getFiles = () => runtime.fs.glob({ include, exclude, cwd });
|
|
948
955
|
const ctx = {
|
|
@@ -1005,7 +1012,7 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
1005
1012
|
|
|
1006
1013
|
// src/extract.ts
|
|
1007
1014
|
init_cjs_shims();
|
|
1008
|
-
var
|
|
1015
|
+
var import_logger4 = require("@pandacss/logger");
|
|
1009
1016
|
var import_lil_fp = require("lil-fp");
|
|
1010
1017
|
|
|
1011
1018
|
// src/cli-box.ts
|
|
@@ -2335,7 +2342,7 @@ async function bundleStyleChunksWithImports(ctx) {
|
|
|
2335
2342
|
}
|
|
2336
2343
|
async function writeFileChunk(ctx, file) {
|
|
2337
2344
|
const { path: path2 } = ctx.runtime;
|
|
2338
|
-
|
|
2345
|
+
import_logger4.logger.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
|
|
2339
2346
|
const css = extractFile(ctx, file);
|
|
2340
2347
|
if (!css)
|
|
2341
2348
|
return;
|
|
@@ -2349,16 +2356,16 @@ function extractFile(ctx, file) {
|
|
|
2349
2356
|
} = ctx;
|
|
2350
2357
|
return (0, import_lil_fp.pipe)(
|
|
2351
2358
|
{ file: path2.abs(cwd, file) },
|
|
2352
|
-
(0, import_lil_fp.tap)(() =>
|
|
2353
|
-
import_lil_fp.Obj.bind("measure", () =>
|
|
2359
|
+
(0, import_lil_fp.tap)(() => import_logger4.logger.debug("file:extract", file)),
|
|
2360
|
+
import_lil_fp.Obj.bind("measure", () => import_logger4.logger.time.debug(`Extracted ${file}`)),
|
|
2354
2361
|
import_lil_fp.Obj.bind(
|
|
2355
2362
|
"result",
|
|
2356
2363
|
(0, import_lil_fp.tryCatch)(
|
|
2357
2364
|
({ file: file2 }) => ctx.project.parseSourceFile(file2),
|
|
2358
|
-
(error) =>
|
|
2365
|
+
(error) => import_logger4.logger.error("file:parse", error)
|
|
2359
2366
|
)
|
|
2360
2367
|
),
|
|
2361
|
-
import_lil_fp.Obj.bind("measureCss", () =>
|
|
2368
|
+
import_lil_fp.Obj.bind("measureCss", () => import_logger4.logger.time.debug(`Parsed ${file}`)),
|
|
2362
2369
|
import_lil_fp.Obj.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
|
|
2363
2370
|
(0, import_lil_fp.tap)(({ measure, measureCss }) => [measureCss(), measure()]),
|
|
2364
2371
|
import_lil_fp.Obj.get("css")
|
|
@@ -2405,7 +2412,7 @@ async function bundleMinimalFilesCss(ctx, outfile) {
|
|
|
2405
2412
|
const filesWithCss = [];
|
|
2406
2413
|
const collector = (0, import_parser2.createParserResult)();
|
|
2407
2414
|
files.forEach((file) => {
|
|
2408
|
-
const measure =
|
|
2415
|
+
const measure = import_logger4.logger.time.debug(`Parsed ${file}`);
|
|
2409
2416
|
const result = ctx.project.parseSourceFile(file);
|
|
2410
2417
|
measure();
|
|
2411
2418
|
if (!result)
|
|
@@ -2514,7 +2521,7 @@ var Builder = class {
|
|
|
2514
2521
|
delete require.cache[file];
|
|
2515
2522
|
}
|
|
2516
2523
|
if (setupCount > 0) {
|
|
2517
|
-
|
|
2524
|
+
import_logger5.logger.debug("builder", "\u2699\uFE0F Config changed, reloading");
|
|
2518
2525
|
}
|
|
2519
2526
|
return { isModified: true, modifiedMap: newModified };
|
|
2520
2527
|
};
|
|
@@ -2526,7 +2533,7 @@ var Builder = class {
|
|
|
2526
2533
|
return configPath;
|
|
2527
2534
|
};
|
|
2528
2535
|
setup = async (options = {}) => {
|
|
2529
|
-
|
|
2536
|
+
import_logger5.logger.debug("builder", "\u{1F6A7} Setup");
|
|
2530
2537
|
const configPath = options.configPath ?? this.getConfigPath();
|
|
2531
2538
|
const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
|
|
2532
2539
|
const compilerOptions = this.context?.tsconfig?.compilerOptions ?? {};
|
|
@@ -2599,7 +2606,7 @@ var Builder = class {
|
|
|
2599
2606
|
};
|
|
2600
2607
|
extract = async () => {
|
|
2601
2608
|
const ctx = this.getContextOrThrow();
|
|
2602
|
-
const done =
|
|
2609
|
+
const done = import_logger5.logger.time.info("Extracted in");
|
|
2603
2610
|
await Promise.allSettled(ctx.getFiles().map((file) => this.extractFile(ctx, file)));
|
|
2604
2611
|
done();
|
|
2605
2612
|
};
|
|
@@ -2649,24 +2656,24 @@ var Builder = class {
|
|
|
2649
2656
|
|
|
2650
2657
|
// src/debug-files.ts
|
|
2651
2658
|
init_cjs_shims();
|
|
2652
|
-
var
|
|
2659
|
+
var import_logger6 = require("@pandacss/logger");
|
|
2653
2660
|
var nodePath = __toESM(require("path"));
|
|
2654
2661
|
async function debugFiles(ctx, options) {
|
|
2655
2662
|
const files = ctx.getFiles();
|
|
2656
|
-
const measureTotal =
|
|
2663
|
+
const measureTotal = import_logger6.logger.time.debug(`Done parsing ${files.length} files`);
|
|
2657
2664
|
ctx.config.minify = false;
|
|
2658
2665
|
ctx.config.optimize = true;
|
|
2659
2666
|
const { fs, path: path2 } = ctx.runtime;
|
|
2660
2667
|
const outdir = options.outdir;
|
|
2661
2668
|
if (!options.dry && outdir) {
|
|
2662
2669
|
fs.ensureDirSync(outdir);
|
|
2663
|
-
|
|
2670
|
+
import_logger6.logger.info("cli", `Writing ${import_logger6.colors.bold(`${outdir}/config.json`)}`);
|
|
2664
2671
|
await fs.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2665
2672
|
}
|
|
2666
2673
|
const filesWithCss = [];
|
|
2667
2674
|
await Promise.allSettled(
|
|
2668
2675
|
files.map(async (file) => {
|
|
2669
|
-
const measure =
|
|
2676
|
+
const measure = import_logger6.logger.time.debug(`Parsed ${file}`);
|
|
2670
2677
|
const result = ctx.project.parseSourceFile(file);
|
|
2671
2678
|
measure();
|
|
2672
2679
|
if (!result)
|
|
@@ -2684,8 +2691,8 @@ async function debugFiles(ctx, options) {
|
|
|
2684
2691
|
const relative3 = path2.relative(ctx.config.cwd, parsedPath.dir);
|
|
2685
2692
|
const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
|
|
2686
2693
|
const cssPath = `${relative3}/${parsedPath.name}.css`.replaceAll(path2.sep, "__");
|
|
2687
|
-
|
|
2688
|
-
|
|
2694
|
+
import_logger6.logger.info("cli", `Writing ${import_logger6.colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2695
|
+
import_logger6.logger.info("cli", `Writing ${import_logger6.colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2689
2696
|
return Promise.allSettled([
|
|
2690
2697
|
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2691
2698
|
fs.writeFile(`${outdir}/${cssPath}`, css)
|
|
@@ -2693,13 +2700,13 @@ async function debugFiles(ctx, options) {
|
|
|
2693
2700
|
}
|
|
2694
2701
|
})
|
|
2695
2702
|
);
|
|
2696
|
-
|
|
2703
|
+
import_logger6.logger.info("cli", `Found ${import_logger6.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2697
2704
|
measureTotal();
|
|
2698
2705
|
}
|
|
2699
2706
|
|
|
2700
2707
|
// src/exec-command.ts
|
|
2701
2708
|
init_cjs_shims();
|
|
2702
|
-
var
|
|
2709
|
+
var import_logger7 = require("@pandacss/logger");
|
|
2703
2710
|
var import_child_process = require("child_process");
|
|
2704
2711
|
var import_preferred_pm = __toESM(require("preferred-pm"));
|
|
2705
2712
|
async function execCommand(cmd, cwd) {
|
|
@@ -2711,13 +2718,13 @@ async function execCommand(cmd, cwd) {
|
|
|
2711
2718
|
}
|
|
2712
2719
|
const check = (0, import_child_process.spawnSync)(pm, args, { cwd, stdio: "pipe" });
|
|
2713
2720
|
if (check.status !== 0) {
|
|
2714
|
-
|
|
2721
|
+
import_logger7.logger.error("exec", check.stderr.toString());
|
|
2715
2722
|
}
|
|
2716
2723
|
}
|
|
2717
2724
|
|
|
2718
2725
|
// src/generate.ts
|
|
2719
2726
|
init_cjs_shims();
|
|
2720
|
-
var
|
|
2727
|
+
var import_logger8 = require("@pandacss/logger");
|
|
2721
2728
|
var import_ts_pattern2 = require("ts-pattern");
|
|
2722
2729
|
|
|
2723
2730
|
// src/load-context.ts
|
|
@@ -2735,7 +2742,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2735
2742
|
// src/generate.ts
|
|
2736
2743
|
async function build(ctx) {
|
|
2737
2744
|
const { msg } = await emitArtfifactsAndCssChunks(ctx);
|
|
2738
|
-
|
|
2745
|
+
import_logger8.logger.info("css:emit", msg);
|
|
2739
2746
|
}
|
|
2740
2747
|
async function generate(config, configPath) {
|
|
2741
2748
|
const [ctxRef, loadCtx] = await loadContext(config, configPath);
|
|
@@ -2749,14 +2756,14 @@ async function generate(config, configPath) {
|
|
|
2749
2756
|
if (ctx.config.watch) {
|
|
2750
2757
|
const configWatcher = fs.watch({ include: dependencies });
|
|
2751
2758
|
configWatcher.on("change", async () => {
|
|
2752
|
-
|
|
2759
|
+
import_logger8.logger.info("config:change", "Config changed, restarting...");
|
|
2753
2760
|
await loadCtx();
|
|
2754
2761
|
await ctxRef.current.hooks.callHook("config:change", ctxRef.current.config);
|
|
2755
2762
|
return build(ctxRef.current);
|
|
2756
2763
|
});
|
|
2757
2764
|
const contentWatcher = fs.watch(ctx.config);
|
|
2758
2765
|
contentWatcher.on("all", async (event, file) => {
|
|
2759
|
-
|
|
2766
|
+
import_logger8.logger.info(`file:${event}`, file);
|
|
2760
2767
|
(0, import_ts_pattern2.match)(event).with("unlink", () => {
|
|
2761
2768
|
ctx.project.removeSourceFile(path2.abs(cwd, file));
|
|
2762
2769
|
ctx.chunks.rm(file);
|
|
@@ -2770,7 +2777,7 @@ async function generate(config, configPath) {
|
|
|
2770
2777
|
}).otherwise(() => {
|
|
2771
2778
|
});
|
|
2772
2779
|
});
|
|
2773
|
-
|
|
2780
|
+
import_logger8.logger.info("ctx:watch", ctx.messages.watch());
|
|
2774
2781
|
}
|
|
2775
2782
|
}
|
|
2776
2783
|
|
|
@@ -2802,7 +2809,7 @@ function setupGitIgnore(ctx) {
|
|
|
2802
2809
|
// src/setup-config.ts
|
|
2803
2810
|
init_cjs_shims();
|
|
2804
2811
|
var import_generator2 = require("@pandacss/generator");
|
|
2805
|
-
var
|
|
2812
|
+
var import_logger9 = require("@pandacss/logger");
|
|
2806
2813
|
var import_fs_extra3 = require("fs-extra");
|
|
2807
2814
|
var import_look_it_up3 = require("look-it-up");
|
|
2808
2815
|
var import_outdent2 = require("outdent");
|
|
@@ -2816,9 +2823,9 @@ async function setupConfig(cwd, opts = {}) {
|
|
|
2816
2823
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2817
2824
|
const isTs = (0, import_look_it_up3.lookItUpSync)("tsconfig.json", cwd);
|
|
2818
2825
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2819
|
-
|
|
2826
|
+
import_logger9.logger.info("init:config", `creating panda config file: ${(0, import_logger9.quote)(file)}`);
|
|
2820
2827
|
if (!force && configFile) {
|
|
2821
|
-
|
|
2828
|
+
import_logger9.logger.warn("init:config", import_generator2.messages.configExists(cmd));
|
|
2822
2829
|
} else {
|
|
2823
2830
|
const content = import_outdent2.outdent`
|
|
2824
2831
|
import { defineConfig } from "@pandacss/dev"
|
|
@@ -2851,11 +2858,11 @@ syntax: '${syntax}'` : ""}
|
|
|
2851
2858
|
})
|
|
2852
2859
|
`;
|
|
2853
2860
|
await (0, import_fs_extra3.writeFile)((0, import_path3.join)(cwd, file), content);
|
|
2854
|
-
|
|
2861
|
+
import_logger9.logger.log(import_generator2.messages.thankYou());
|
|
2855
2862
|
}
|
|
2856
2863
|
}
|
|
2857
2864
|
async function setupPostcss(cwd) {
|
|
2858
|
-
|
|
2865
|
+
import_logger9.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger9.quote)("postcss.config.cjs")}`);
|
|
2859
2866
|
const content = import_outdent2.outdent`
|
|
2860
2867
|
module.exports = {
|
|
2861
2868
|
plugins: {
|
|
@@ -2868,7 +2875,7 @@ module.exports = {
|
|
|
2868
2875
|
|
|
2869
2876
|
// src/ship-files.ts
|
|
2870
2877
|
init_cjs_shims();
|
|
2871
|
-
var
|
|
2878
|
+
var import_logger10 = require("@pandacss/logger");
|
|
2872
2879
|
var import_parser3 = require("@pandacss/parser");
|
|
2873
2880
|
var import_promises3 = require("fs/promises");
|
|
2874
2881
|
var path = __toESM(require("path"));
|
|
@@ -2886,12 +2893,12 @@ async function shipFiles(ctx, outfile) {
|
|
|
2886
2893
|
extractResult.merge(result);
|
|
2887
2894
|
filesWithCss.push(path.relative(ctx.config.cwd, file));
|
|
2888
2895
|
});
|
|
2889
|
-
|
|
2896
|
+
import_logger10.logger.info("cli", `Found ${import_logger10.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2890
2897
|
const minify = ctx.config.minify;
|
|
2891
|
-
|
|
2898
|
+
import_logger10.logger.info("cli", `Writing ${minify ? "[min] " : " "}${import_logger10.colors.bold(outfile)}`);
|
|
2892
2899
|
const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
|
|
2893
2900
|
await (0, import_promises3.writeFile)(outfile, output);
|
|
2894
|
-
|
|
2901
|
+
import_logger10.logger.info("cli", "Done!");
|
|
2895
2902
|
}
|
|
2896
2903
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2897
2904
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
mod
|
|
35
35
|
));
|
|
36
36
|
|
|
37
|
-
// ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.
|
|
37
|
+
// ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.31_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js
|
|
38
38
|
var init_esm_shims = __esm({
|
|
39
|
-
"../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.
|
|
39
|
+
"../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.31_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js"() {
|
|
40
40
|
"use strict";
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -758,7 +758,7 @@ init_esm_shims();
|
|
|
758
758
|
import { getConfigDependencies } from "@pandacss/config";
|
|
759
759
|
import { optimizeCss as optimizeCss2, mergeCss as mergeCss2 } from "@pandacss/core";
|
|
760
760
|
import { ConfigNotFoundError } from "@pandacss/error";
|
|
761
|
-
import { logger as
|
|
761
|
+
import { logger as logger5 } from "@pandacss/logger";
|
|
762
762
|
import { existsSync as existsSync2 } from "fs";
|
|
763
763
|
import { statSync } from "fs-extra";
|
|
764
764
|
import { resolve as resolve2 } from "path";
|
|
@@ -912,22 +912,29 @@ var getOutputEngine = ({
|
|
|
912
912
|
const { dir = paths.root, files } = output;
|
|
913
913
|
fs.ensureDirSync(path2.join(...dir));
|
|
914
914
|
return Promise.allSettled(
|
|
915
|
-
files.map(async (
|
|
915
|
+
files.map(async (artifact) => {
|
|
916
|
+
if (!artifact)
|
|
917
|
+
return;
|
|
918
|
+
const { file, code } = artifact;
|
|
916
919
|
const absPath = path2.join(...dir, file);
|
|
917
|
-
if (code)
|
|
918
|
-
return
|
|
919
|
-
|
|
920
|
+
if (!code)
|
|
921
|
+
return;
|
|
922
|
+
return fs.writeFile(absPath, code);
|
|
920
923
|
})
|
|
921
924
|
);
|
|
922
925
|
}
|
|
923
926
|
});
|
|
924
927
|
|
|
925
928
|
// src/create-context.ts
|
|
929
|
+
import { logger as logger3 } from "@pandacss/logger";
|
|
926
930
|
var createContext = (conf) => {
|
|
927
931
|
const generator = createGenerator(conf);
|
|
928
932
|
const config = conf.config;
|
|
929
933
|
const runtime = nodeRuntime;
|
|
930
934
|
config.cwd ||= runtime.cwd();
|
|
935
|
+
if (config.logLevel) {
|
|
936
|
+
logger3.level = config.logLevel;
|
|
937
|
+
}
|
|
931
938
|
const { include, exclude, cwd } = config;
|
|
932
939
|
const getFiles = () => runtime.fs.glob({ include, exclude, cwd });
|
|
933
940
|
const ctx = {
|
|
@@ -990,7 +997,7 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
990
997
|
|
|
991
998
|
// src/extract.ts
|
|
992
999
|
init_esm_shims();
|
|
993
|
-
import { logger as
|
|
1000
|
+
import { logger as logger4 } from "@pandacss/logger";
|
|
994
1001
|
import { Obj, pipe, tap, tryCatch } from "lil-fp";
|
|
995
1002
|
|
|
996
1003
|
// src/cli-box.ts
|
|
@@ -2320,7 +2327,7 @@ async function bundleStyleChunksWithImports(ctx) {
|
|
|
2320
2327
|
}
|
|
2321
2328
|
async function writeFileChunk(ctx, file) {
|
|
2322
2329
|
const { path: path2 } = ctx.runtime;
|
|
2323
|
-
|
|
2330
|
+
logger4.debug("chunk:write", `File: ${path2.relative(ctx.config.cwd, file)}`);
|
|
2324
2331
|
const css = extractFile(ctx, file);
|
|
2325
2332
|
if (!css)
|
|
2326
2333
|
return;
|
|
@@ -2334,16 +2341,16 @@ function extractFile(ctx, file) {
|
|
|
2334
2341
|
} = ctx;
|
|
2335
2342
|
return pipe(
|
|
2336
2343
|
{ file: path2.abs(cwd, file) },
|
|
2337
|
-
tap(() =>
|
|
2338
|
-
Obj.bind("measure", () =>
|
|
2344
|
+
tap(() => logger4.debug("file:extract", file)),
|
|
2345
|
+
Obj.bind("measure", () => logger4.time.debug(`Extracted ${file}`)),
|
|
2339
2346
|
Obj.bind(
|
|
2340
2347
|
"result",
|
|
2341
2348
|
tryCatch(
|
|
2342
2349
|
({ file: file2 }) => ctx.project.parseSourceFile(file2),
|
|
2343
|
-
(error) =>
|
|
2350
|
+
(error) => logger4.error("file:parse", error)
|
|
2344
2351
|
)
|
|
2345
2352
|
),
|
|
2346
|
-
Obj.bind("measureCss", () =>
|
|
2353
|
+
Obj.bind("measureCss", () => logger4.time.debug(`Parsed ${file}`)),
|
|
2347
2354
|
Obj.bind("css", ({ result }) => result ? ctx.getParserCss(result) : void 0),
|
|
2348
2355
|
tap(({ measure, measureCss }) => [measureCss(), measure()]),
|
|
2349
2356
|
Obj.get("css")
|
|
@@ -2390,7 +2397,7 @@ async function bundleMinimalFilesCss(ctx, outfile) {
|
|
|
2390
2397
|
const filesWithCss = [];
|
|
2391
2398
|
const collector = createParserResult();
|
|
2392
2399
|
files.forEach((file) => {
|
|
2393
|
-
const measure =
|
|
2400
|
+
const measure = logger4.time.debug(`Parsed ${file}`);
|
|
2394
2401
|
const result = ctx.project.parseSourceFile(file);
|
|
2395
2402
|
measure();
|
|
2396
2403
|
if (!result)
|
|
@@ -2499,7 +2506,7 @@ var Builder = class {
|
|
|
2499
2506
|
delete __require.cache[file];
|
|
2500
2507
|
}
|
|
2501
2508
|
if (setupCount > 0) {
|
|
2502
|
-
|
|
2509
|
+
logger5.debug("builder", "\u2699\uFE0F Config changed, reloading");
|
|
2503
2510
|
}
|
|
2504
2511
|
return { isModified: true, modifiedMap: newModified };
|
|
2505
2512
|
};
|
|
@@ -2511,7 +2518,7 @@ var Builder = class {
|
|
|
2511
2518
|
return configPath;
|
|
2512
2519
|
};
|
|
2513
2520
|
setup = async (options = {}) => {
|
|
2514
|
-
|
|
2521
|
+
logger5.debug("builder", "\u{1F6A7} Setup");
|
|
2515
2522
|
const configPath = options.configPath ?? this.getConfigPath();
|
|
2516
2523
|
const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
|
|
2517
2524
|
const compilerOptions = this.context?.tsconfig?.compilerOptions ?? {};
|
|
@@ -2584,7 +2591,7 @@ var Builder = class {
|
|
|
2584
2591
|
};
|
|
2585
2592
|
extract = async () => {
|
|
2586
2593
|
const ctx = this.getContextOrThrow();
|
|
2587
|
-
const done =
|
|
2594
|
+
const done = logger5.time.info("Extracted in");
|
|
2588
2595
|
await Promise.allSettled(ctx.getFiles().map((file) => this.extractFile(ctx, file)));
|
|
2589
2596
|
done();
|
|
2590
2597
|
};
|
|
@@ -2634,24 +2641,24 @@ var Builder = class {
|
|
|
2634
2641
|
|
|
2635
2642
|
// src/debug-files.ts
|
|
2636
2643
|
init_esm_shims();
|
|
2637
|
-
import { colors, logger as
|
|
2644
|
+
import { colors, logger as logger6 } from "@pandacss/logger";
|
|
2638
2645
|
import * as nodePath from "path";
|
|
2639
2646
|
async function debugFiles(ctx, options) {
|
|
2640
2647
|
const files = ctx.getFiles();
|
|
2641
|
-
const measureTotal =
|
|
2648
|
+
const measureTotal = logger6.time.debug(`Done parsing ${files.length} files`);
|
|
2642
2649
|
ctx.config.minify = false;
|
|
2643
2650
|
ctx.config.optimize = true;
|
|
2644
2651
|
const { fs, path: path2 } = ctx.runtime;
|
|
2645
2652
|
const outdir = options.outdir;
|
|
2646
2653
|
if (!options.dry && outdir) {
|
|
2647
2654
|
fs.ensureDirSync(outdir);
|
|
2648
|
-
|
|
2655
|
+
logger6.info("cli", `Writing ${colors.bold(`${outdir}/config.json`)}`);
|
|
2649
2656
|
await fs.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2650
2657
|
}
|
|
2651
2658
|
const filesWithCss = [];
|
|
2652
2659
|
await Promise.allSettled(
|
|
2653
2660
|
files.map(async (file) => {
|
|
2654
|
-
const measure =
|
|
2661
|
+
const measure = logger6.time.debug(`Parsed ${file}`);
|
|
2655
2662
|
const result = ctx.project.parseSourceFile(file);
|
|
2656
2663
|
measure();
|
|
2657
2664
|
if (!result)
|
|
@@ -2669,8 +2676,8 @@ async function debugFiles(ctx, options) {
|
|
|
2669
2676
|
const relative3 = path2.relative(ctx.config.cwd, parsedPath.dir);
|
|
2670
2677
|
const astJsonPath = `${relative3}/${parsedPath.name}.ast.json`.replaceAll(path2.sep, "__");
|
|
2671
2678
|
const cssPath = `${relative3}/${parsedPath.name}.css`.replaceAll(path2.sep, "__");
|
|
2672
|
-
|
|
2673
|
-
|
|
2679
|
+
logger6.info("cli", `Writing ${colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2680
|
+
logger6.info("cli", `Writing ${colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2674
2681
|
return Promise.allSettled([
|
|
2675
2682
|
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2676
2683
|
fs.writeFile(`${outdir}/${cssPath}`, css)
|
|
@@ -2678,13 +2685,13 @@ async function debugFiles(ctx, options) {
|
|
|
2678
2685
|
}
|
|
2679
2686
|
})
|
|
2680
2687
|
);
|
|
2681
|
-
|
|
2688
|
+
logger6.info("cli", `Found ${colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2682
2689
|
measureTotal();
|
|
2683
2690
|
}
|
|
2684
2691
|
|
|
2685
2692
|
// src/exec-command.ts
|
|
2686
2693
|
init_esm_shims();
|
|
2687
|
-
import { logger as
|
|
2694
|
+
import { logger as logger7 } from "@pandacss/logger";
|
|
2688
2695
|
import { spawnSync } from "child_process";
|
|
2689
2696
|
import getPackageManager from "preferred-pm";
|
|
2690
2697
|
async function execCommand(cmd, cwd) {
|
|
@@ -2696,13 +2703,13 @@ async function execCommand(cmd, cwd) {
|
|
|
2696
2703
|
}
|
|
2697
2704
|
const check = spawnSync(pm, args, { cwd, stdio: "pipe" });
|
|
2698
2705
|
if (check.status !== 0) {
|
|
2699
|
-
|
|
2706
|
+
logger7.error("exec", check.stderr.toString());
|
|
2700
2707
|
}
|
|
2701
2708
|
}
|
|
2702
2709
|
|
|
2703
2710
|
// src/generate.ts
|
|
2704
2711
|
init_esm_shims();
|
|
2705
|
-
import { logger as
|
|
2712
|
+
import { logger as logger8 } from "@pandacss/logger";
|
|
2706
2713
|
import { match as match2 } from "ts-pattern";
|
|
2707
2714
|
|
|
2708
2715
|
// src/load-context.ts
|
|
@@ -2720,7 +2727,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2720
2727
|
// src/generate.ts
|
|
2721
2728
|
async function build(ctx) {
|
|
2722
2729
|
const { msg } = await emitArtfifactsAndCssChunks(ctx);
|
|
2723
|
-
|
|
2730
|
+
logger8.info("css:emit", msg);
|
|
2724
2731
|
}
|
|
2725
2732
|
async function generate(config, configPath) {
|
|
2726
2733
|
const [ctxRef, loadCtx] = await loadContext(config, configPath);
|
|
@@ -2734,14 +2741,14 @@ async function generate(config, configPath) {
|
|
|
2734
2741
|
if (ctx.config.watch) {
|
|
2735
2742
|
const configWatcher = fs.watch({ include: dependencies });
|
|
2736
2743
|
configWatcher.on("change", async () => {
|
|
2737
|
-
|
|
2744
|
+
logger8.info("config:change", "Config changed, restarting...");
|
|
2738
2745
|
await loadCtx();
|
|
2739
2746
|
await ctxRef.current.hooks.callHook("config:change", ctxRef.current.config);
|
|
2740
2747
|
return build(ctxRef.current);
|
|
2741
2748
|
});
|
|
2742
2749
|
const contentWatcher = fs.watch(ctx.config);
|
|
2743
2750
|
contentWatcher.on("all", async (event, file) => {
|
|
2744
|
-
|
|
2751
|
+
logger8.info(`file:${event}`, file);
|
|
2745
2752
|
match2(event).with("unlink", () => {
|
|
2746
2753
|
ctx.project.removeSourceFile(path2.abs(cwd, file));
|
|
2747
2754
|
ctx.chunks.rm(file);
|
|
@@ -2755,7 +2762,7 @@ async function generate(config, configPath) {
|
|
|
2755
2762
|
}).otherwise(() => {
|
|
2756
2763
|
});
|
|
2757
2764
|
});
|
|
2758
|
-
|
|
2765
|
+
logger8.info("ctx:watch", ctx.messages.watch());
|
|
2759
2766
|
}
|
|
2760
2767
|
}
|
|
2761
2768
|
|
|
@@ -2787,7 +2794,7 @@ function setupGitIgnore(ctx) {
|
|
|
2787
2794
|
// src/setup-config.ts
|
|
2788
2795
|
init_esm_shims();
|
|
2789
2796
|
import { messages } from "@pandacss/generator";
|
|
2790
|
-
import { logger as
|
|
2797
|
+
import { logger as logger9, quote } from "@pandacss/logger";
|
|
2791
2798
|
import { writeFile as writeFile4 } from "fs-extra";
|
|
2792
2799
|
import { lookItUpSync as lookItUpSync3 } from "look-it-up";
|
|
2793
2800
|
import { outdent as outdent2 } from "outdent";
|
|
@@ -2801,9 +2808,9 @@ async function setupConfig(cwd, opts = {}) {
|
|
|
2801
2808
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2802
2809
|
const isTs = lookItUpSync3("tsconfig.json", cwd);
|
|
2803
2810
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2804
|
-
|
|
2811
|
+
logger9.info("init:config", `creating panda config file: ${quote(file)}`);
|
|
2805
2812
|
if (!force && configFile) {
|
|
2806
|
-
|
|
2813
|
+
logger9.warn("init:config", messages.configExists(cmd));
|
|
2807
2814
|
} else {
|
|
2808
2815
|
const content = outdent2`
|
|
2809
2816
|
import { defineConfig } from "@pandacss/dev"
|
|
@@ -2836,11 +2843,11 @@ syntax: '${syntax}'` : ""}
|
|
|
2836
2843
|
})
|
|
2837
2844
|
`;
|
|
2838
2845
|
await writeFile4(join2(cwd, file), content);
|
|
2839
|
-
|
|
2846
|
+
logger9.log(messages.thankYou());
|
|
2840
2847
|
}
|
|
2841
2848
|
}
|
|
2842
2849
|
async function setupPostcss(cwd) {
|
|
2843
|
-
|
|
2850
|
+
logger9.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
|
|
2844
2851
|
const content = outdent2`
|
|
2845
2852
|
module.exports = {
|
|
2846
2853
|
plugins: {
|
|
@@ -2853,7 +2860,7 @@ module.exports = {
|
|
|
2853
2860
|
|
|
2854
2861
|
// src/ship-files.ts
|
|
2855
2862
|
init_esm_shims();
|
|
2856
|
-
import { colors as colors2, logger as
|
|
2863
|
+
import { colors as colors2, logger as logger10 } from "@pandacss/logger";
|
|
2857
2864
|
import { createParserResult as createParserResult2 } from "@pandacss/parser";
|
|
2858
2865
|
import { writeFile as writeFile5 } from "fs/promises";
|
|
2859
2866
|
import * as path from "path";
|
|
@@ -2871,12 +2878,12 @@ async function shipFiles(ctx, outfile) {
|
|
|
2871
2878
|
extractResult.merge(result);
|
|
2872
2879
|
filesWithCss.push(path.relative(ctx.config.cwd, file));
|
|
2873
2880
|
});
|
|
2874
|
-
|
|
2881
|
+
logger10.info("cli", `Found ${colors2.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2875
2882
|
const minify = ctx.config.minify;
|
|
2876
|
-
|
|
2883
|
+
logger10.info("cli", `Writing ${minify ? "[min] " : " "}${colors2.bold(outfile)}`);
|
|
2877
2884
|
const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
|
|
2878
2885
|
await writeFile5(outfile, output);
|
|
2879
|
-
|
|
2886
|
+
logger10.info("cli", "Done!");
|
|
2880
2887
|
}
|
|
2881
2888
|
export {
|
|
2882
2889
|
Builder,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -29,22 +29,22 @@
|
|
|
29
29
|
"pathe": "^1.1.1",
|
|
30
30
|
"pkg-types": "1.0.3",
|
|
31
31
|
"pluralize": "8.0.0",
|
|
32
|
-
"postcss": "8.4.
|
|
32
|
+
"postcss": "^8.4.31",
|
|
33
33
|
"preferred-pm": "^3.0.3",
|
|
34
34
|
"ts-morph": "19.0.0",
|
|
35
35
|
"ts-pattern": "5.0.5",
|
|
36
36
|
"tsconfck": "^2.1.2",
|
|
37
|
-
"@pandacss/config": "0.
|
|
38
|
-
"@pandacss/core": "0.
|
|
39
|
-
"@pandacss/error": "0.
|
|
40
|
-
"@pandacss/extractor": "0.
|
|
41
|
-
"@pandacss/generator": "0.
|
|
42
|
-
"@pandacss/is-valid-prop": "0.
|
|
43
|
-
"@pandacss/logger": "0.
|
|
44
|
-
"@pandacss/parser": "0.
|
|
45
|
-
"@pandacss/shared": "0.
|
|
46
|
-
"@pandacss/token-dictionary": "0.
|
|
47
|
-
"@pandacss/types": "0.
|
|
37
|
+
"@pandacss/config": "0.17.0",
|
|
38
|
+
"@pandacss/core": "0.17.0",
|
|
39
|
+
"@pandacss/error": "0.17.0",
|
|
40
|
+
"@pandacss/extractor": "0.17.0",
|
|
41
|
+
"@pandacss/generator": "0.17.0",
|
|
42
|
+
"@pandacss/is-valid-prop": "0.17.0",
|
|
43
|
+
"@pandacss/logger": "0.17.0",
|
|
44
|
+
"@pandacss/parser": "0.17.0",
|
|
45
|
+
"@pandacss/shared": "0.17.0",
|
|
46
|
+
"@pandacss/token-dictionary": "0.17.0",
|
|
47
|
+
"@pandacss/types": "0.17.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/fs-extra": "11.0.2",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/lodash.merge": "4.6.7",
|
|
54
54
|
"@types/pluralize": "0.0.30",
|
|
55
55
|
"boxen": "^7.1.1",
|
|
56
|
-
"@pandacss/fixture": "0.
|
|
56
|
+
"@pandacss/fixture": "0.17.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsup src/index.ts --format=cjs,esm --shims --dts",
|