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