@pandacss/node 0.29.1 → 0.30.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 +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +73 -30
- package/dist/index.mjs +72 -30
- package/package.json +10 -11
package/dist/index.d.mts
CHANGED
|
@@ -53,7 +53,7 @@ declare class PandaContext extends Generator {
|
|
|
53
53
|
};
|
|
54
54
|
writeCss: (sheet?: Stylesheet) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
55
55
|
watchConfig: (cb: (file: string) => void | Promise<void>, opts?: Omit<WatchOptions, 'include'>) => void;
|
|
56
|
-
watchFiles: (cb: (event: WatcherEventType, file: string) => void | Promise<void>) => void;
|
|
56
|
+
watchFiles: (cb: (event: WatcherEventType, file: string) => void | Promise<void>, opts?: Omit<WatchOptions, 'include' | 'exclude' | 'poll' | 'cwd' | 'logger'>) => void;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
interface Options {
|
|
@@ -246,14 +246,14 @@ declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
|
246
246
|
msg: string;
|
|
247
247
|
}>;
|
|
248
248
|
|
|
249
|
-
declare const startProfiling: (cwd: string, prefix: string) => Promise<() => void>;
|
|
250
|
-
|
|
251
249
|
declare function loadConfigAndCreateContext(options?: {
|
|
252
250
|
cwd?: string;
|
|
253
251
|
config?: Config;
|
|
254
252
|
configPath?: string;
|
|
255
253
|
}): Promise<PandaContext>;
|
|
256
254
|
|
|
255
|
+
declare const startProfiling: (cwd: string, prefix: string) => Promise<() => void>;
|
|
256
|
+
|
|
257
257
|
interface CssGenOptions {
|
|
258
258
|
cwd: string;
|
|
259
259
|
outfile?: string;
|
|
@@ -273,6 +273,15 @@ declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
|
273
273
|
|
|
274
274
|
declare function setupGitIgnore(ctx: PandaContext): void;
|
|
275
275
|
|
|
276
|
+
interface LogstreamOptions {
|
|
277
|
+
cwd?: string;
|
|
278
|
+
logfile?: string;
|
|
279
|
+
}
|
|
280
|
+
declare const setLogStream: (options: LogstreamOptions) => {
|
|
281
|
+
end(): void;
|
|
282
|
+
[Symbol.dispose]: () => void;
|
|
283
|
+
};
|
|
284
|
+
|
|
276
285
|
declare function parseDependency(fileOrGlob: string): Message | null;
|
|
277
286
|
|
|
278
287
|
type SetupOptions = Partial<Config> & {
|
|
@@ -281,4 +290,4 @@ type SetupOptions = Partial<Config> & {
|
|
|
281
290
|
declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
|
|
282
291
|
declare function setupPostcss(cwd: string): Promise<void>;
|
|
283
292
|
|
|
284
|
-
export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, startProfiling, writeAnalyzeJSON };
|
|
293
|
+
export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setLogStream, setupConfig, setupGitIgnore, setupPostcss, startProfiling, writeAnalyzeJSON };
|
package/dist/index.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ declare class PandaContext extends Generator {
|
|
|
53
53
|
};
|
|
54
54
|
writeCss: (sheet?: Stylesheet) => Promise<PromiseSettledResult<void>[]> | undefined;
|
|
55
55
|
watchConfig: (cb: (file: string) => void | Promise<void>, opts?: Omit<WatchOptions, 'include'>) => void;
|
|
56
|
-
watchFiles: (cb: (event: WatcherEventType, file: string) => void | Promise<void>) => void;
|
|
56
|
+
watchFiles: (cb: (event: WatcherEventType, file: string) => void | Promise<void>, opts?: Omit<WatchOptions, 'include' | 'exclude' | 'poll' | 'cwd' | 'logger'>) => void;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
interface Options {
|
|
@@ -246,14 +246,14 @@ declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
|
|
|
246
246
|
msg: string;
|
|
247
247
|
}>;
|
|
248
248
|
|
|
249
|
-
declare const startProfiling: (cwd: string, prefix: string) => Promise<() => void>;
|
|
250
|
-
|
|
251
249
|
declare function loadConfigAndCreateContext(options?: {
|
|
252
250
|
cwd?: string;
|
|
253
251
|
config?: Config;
|
|
254
252
|
configPath?: string;
|
|
255
253
|
}): Promise<PandaContext>;
|
|
256
254
|
|
|
255
|
+
declare const startProfiling: (cwd: string, prefix: string) => Promise<() => void>;
|
|
256
|
+
|
|
257
257
|
interface CssGenOptions {
|
|
258
258
|
cwd: string;
|
|
259
259
|
outfile?: string;
|
|
@@ -273,6 +273,15 @@ declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
|
273
273
|
|
|
274
274
|
declare function setupGitIgnore(ctx: PandaContext): void;
|
|
275
275
|
|
|
276
|
+
interface LogstreamOptions {
|
|
277
|
+
cwd?: string;
|
|
278
|
+
logfile?: string;
|
|
279
|
+
}
|
|
280
|
+
declare const setLogStream: (options: LogstreamOptions) => {
|
|
281
|
+
end(): void;
|
|
282
|
+
[Symbol.dispose]: () => void;
|
|
283
|
+
};
|
|
284
|
+
|
|
276
285
|
declare function parseDependency(fileOrGlob: string): Message | null;
|
|
277
286
|
|
|
278
287
|
type SetupOptions = Partial<Config> & {
|
|
@@ -281,4 +290,4 @@ type SetupOptions = Partial<Config> & {
|
|
|
281
290
|
declare function setupConfig(cwd: string, opts?: SetupOptions): Promise<void>;
|
|
282
291
|
declare function setupPostcss(cwd: string): Promise<void>;
|
|
283
292
|
|
|
284
|
-
export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, startProfiling, writeAnalyzeJSON };
|
|
293
|
+
export { Builder, type CssGenOptions, PandaContext, analyzeTokens, buildInfo, codegen, cssgen, debug, generate, loadConfigAndCreateContext, parseDependency, setLogStream, setupConfig, setupGitIgnore, setupPostcss, startProfiling, writeAnalyzeJSON };
|
package/dist/index.js
CHANGED
|
@@ -413,6 +413,7 @@ __export(src_exports, {
|
|
|
413
413
|
generate: () => generate,
|
|
414
414
|
loadConfigAndCreateContext: () => loadConfigAndCreateContext,
|
|
415
415
|
parseDependency: () => parseDependency,
|
|
416
|
+
setLogStream: () => setLogStream,
|
|
416
417
|
setupConfig: () => setupConfig,
|
|
417
418
|
setupGitIgnore: () => setupGitIgnore,
|
|
418
419
|
setupPostcss: () => setupPostcss,
|
|
@@ -2223,7 +2224,9 @@ var limit = pLimit(20);
|
|
|
2223
2224
|
async function codegen(ctx, ids) {
|
|
2224
2225
|
if (ctx.config.clean)
|
|
2225
2226
|
ctx.output.empty();
|
|
2226
|
-
const
|
|
2227
|
+
const artifacts = ctx.getArtifacts(ids);
|
|
2228
|
+
await ctx.hooks["codegen:prepare"]?.({ changed: ids, artifacts });
|
|
2229
|
+
const promises = artifacts.map((artifact) => limit(() => ctx.output.write(artifact)));
|
|
2227
2230
|
await Promise.allSettled(promises);
|
|
2228
2231
|
await ctx.hooks["codegen:done"]?.({ changed: ids });
|
|
2229
2232
|
return {
|
|
@@ -2327,8 +2330,8 @@ var nodeRuntime = {
|
|
|
2327
2330
|
readDirSync: import_fs_extra.default.readdirSync,
|
|
2328
2331
|
rmDirSync: import_fs_extra.default.emptyDirSync,
|
|
2329
2332
|
rmFileSync: import_fs_extra.default.removeSync,
|
|
2330
|
-
ensureDirSync(
|
|
2331
|
-
return import_fs_extra.default.ensureDirSync(
|
|
2333
|
+
ensureDirSync(path3) {
|
|
2334
|
+
return import_fs_extra.default.ensureDirSync(path3);
|
|
2332
2335
|
},
|
|
2333
2336
|
watch(options) {
|
|
2334
2337
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -2495,10 +2498,11 @@ var PandaContext = class extends import_generator2.Generator {
|
|
|
2495
2498
|
})
|
|
2496
2499
|
);
|
|
2497
2500
|
};
|
|
2498
|
-
watchFiles = (cb) => {
|
|
2501
|
+
watchFiles = (cb, opts) => {
|
|
2499
2502
|
const { include, exclude, poll, cwd } = this.config;
|
|
2500
2503
|
import_logger5.logger.info("ctx:watch", this.messages.watch());
|
|
2501
2504
|
const watcher = this.runtime.fs.watch({
|
|
2505
|
+
...opts,
|
|
2502
2506
|
include,
|
|
2503
2507
|
exclude,
|
|
2504
2508
|
poll,
|
|
@@ -2768,25 +2772,28 @@ var import_logger7 = require("@pandacss/logger");
|
|
|
2768
2772
|
var import_fs2 = __toESM(require("fs"));
|
|
2769
2773
|
var import_path4 = __toESM(require("path"));
|
|
2770
2774
|
var startProfiling = async (cwd, prefix) => {
|
|
2771
|
-
const
|
|
2772
|
-
const
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2775
|
+
const inspector = await import("inspector").then((r) => r.default);
|
|
2776
|
+
const session = new inspector.Session();
|
|
2777
|
+
session.connect();
|
|
2778
|
+
await new Promise((resolve4) => {
|
|
2779
|
+
session.post("Profiler.enable", () => {
|
|
2780
|
+
session.post("Profiler.start", resolve4);
|
|
2781
|
+
});
|
|
2782
|
+
});
|
|
2777
2783
|
const stopProfiling = () => {
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
console.error(error);
|
|
2784
|
+
session.post("Profiler.stop", (err, { profile }) => {
|
|
2785
|
+
if (err) {
|
|
2786
|
+
import_logger7.logger.error("cpu-prof", err);
|
|
2782
2787
|
return;
|
|
2783
2788
|
}
|
|
2784
|
-
if (!
|
|
2789
|
+
if (!profile)
|
|
2785
2790
|
return;
|
|
2791
|
+
const date = /* @__PURE__ */ new Date();
|
|
2792
|
+
const timestamp = date.toISOString().replace(/[-:.]/g, "");
|
|
2793
|
+
const title = `panda-${prefix}-${timestamp}`;
|
|
2786
2794
|
const outfile = import_path4.default.join(cwd, `${title}.cpuprofile`);
|
|
2787
|
-
import_fs2.default.writeFileSync(outfile,
|
|
2795
|
+
import_fs2.default.writeFileSync(outfile, JSON.stringify(profile));
|
|
2788
2796
|
import_logger7.logger.info("cpu-prof", outfile);
|
|
2789
|
-
profile.delete();
|
|
2790
2797
|
});
|
|
2791
2798
|
};
|
|
2792
2799
|
return stopProfiling;
|
|
@@ -2837,12 +2844,12 @@ async function debug(ctx, options) {
|
|
|
2837
2844
|
const measureTotal = import_logger9.logger.time.debug(`Done parsing ${files.length} files`);
|
|
2838
2845
|
ctx.config.minify = false;
|
|
2839
2846
|
ctx.config.optimize = true;
|
|
2840
|
-
const { fs:
|
|
2847
|
+
const { fs: fs3, path: path3 } = ctx.runtime;
|
|
2841
2848
|
const outdir = options.outdir;
|
|
2842
2849
|
if (!options.dry && outdir) {
|
|
2843
|
-
|
|
2850
|
+
fs3.ensureDirSync(outdir);
|
|
2844
2851
|
import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/config.json`)}`);
|
|
2845
|
-
await
|
|
2852
|
+
await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2846
2853
|
}
|
|
2847
2854
|
if (options.onlyConfig) {
|
|
2848
2855
|
measureTotal();
|
|
@@ -2867,14 +2874,14 @@ async function debug(ctx, options) {
|
|
|
2867
2874
|
if (outdir) {
|
|
2868
2875
|
filesWithCss.push(file);
|
|
2869
2876
|
const parsedPath = (0, import_path5.parse)(file);
|
|
2870
|
-
const relative2 =
|
|
2871
|
-
const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(
|
|
2872
|
-
const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(
|
|
2877
|
+
const relative2 = path3.relative(ctx.config.cwd, parsedPath.dir);
|
|
2878
|
+
const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path3.sep, "__");
|
|
2879
|
+
const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path3.sep, "__");
|
|
2873
2880
|
import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2874
2881
|
import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2875
2882
|
return Promise.allSettled([
|
|
2876
|
-
|
|
2877
|
-
|
|
2883
|
+
fs3.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2884
|
+
fs3.writeFile(`${outdir}/${cssPath}`, css)
|
|
2878
2885
|
]);
|
|
2879
2886
|
}
|
|
2880
2887
|
});
|
|
@@ -2968,11 +2975,46 @@ function setupGitIgnore(ctx) {
|
|
|
2968
2975
|
}
|
|
2969
2976
|
}
|
|
2970
2977
|
|
|
2978
|
+
// src/logstream.ts
|
|
2979
|
+
init_cjs_shims();
|
|
2980
|
+
var import_logger11 = require("@pandacss/logger");
|
|
2981
|
+
var import_node_fs = __toESM(require("fs"));
|
|
2982
|
+
var import_node_path = __toESM(require("path"));
|
|
2983
|
+
var setLogStream = (options) => {
|
|
2984
|
+
const { cwd = process.cwd() } = options;
|
|
2985
|
+
let stream;
|
|
2986
|
+
if (options.logfile) {
|
|
2987
|
+
const outPath = import_node_path.default.resolve(cwd, options.logfile);
|
|
2988
|
+
ensure(outPath);
|
|
2989
|
+
import_logger11.logger.info("logfile", outPath);
|
|
2990
|
+
stream = import_node_fs.default.createWriteStream(outPath, { flags: "a" });
|
|
2991
|
+
import_logger11.logger.onLog = (entry) => {
|
|
2992
|
+
stream?.write(JSON.stringify(entry) + "\n");
|
|
2993
|
+
};
|
|
2994
|
+
}
|
|
2995
|
+
process.once("SIGINT", () => {
|
|
2996
|
+
stream?.end();
|
|
2997
|
+
});
|
|
2998
|
+
return {
|
|
2999
|
+
end() {
|
|
3000
|
+
stream?.end();
|
|
3001
|
+
},
|
|
3002
|
+
[Symbol.dispose]: () => {
|
|
3003
|
+
stream?.end();
|
|
3004
|
+
}
|
|
3005
|
+
};
|
|
3006
|
+
};
|
|
3007
|
+
var ensure = (outPath) => {
|
|
3008
|
+
const dirname2 = import_node_path.default.dirname(outPath);
|
|
3009
|
+
import_node_fs.default.mkdirSync(dirname2, { recursive: true });
|
|
3010
|
+
return outPath;
|
|
3011
|
+
};
|
|
3012
|
+
|
|
2971
3013
|
// src/setup-config.ts
|
|
2972
3014
|
init_cjs_shims();
|
|
2973
3015
|
var import_config7 = require("@pandacss/config");
|
|
2974
3016
|
var import_core2 = require("@pandacss/core");
|
|
2975
|
-
var
|
|
3017
|
+
var import_logger12 = require("@pandacss/logger");
|
|
2976
3018
|
var import_shared3 = require("@pandacss/shared");
|
|
2977
3019
|
var import_fs_extra2 = __toESM(require("fs-extra"));
|
|
2978
3020
|
var import_look_it_up2 = require("look-it-up");
|
|
@@ -2995,9 +3037,9 @@ async function setupConfig(cwd, opts = {}) {
|
|
|
2995
3037
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2996
3038
|
const isTs = (0, import_look_it_up2.lookItUpSync)("tsconfig.json", cwd);
|
|
2997
3039
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2998
|
-
|
|
3040
|
+
import_logger12.logger.info("init:config", `creating panda config file: ${(0, import_logger12.quote)(file)}`);
|
|
2999
3041
|
if (!force && configFile) {
|
|
3000
|
-
|
|
3042
|
+
import_logger12.logger.warn("init:config", import_core2.messages.configExists(cmd));
|
|
3001
3043
|
} else {
|
|
3002
3044
|
const content = import_outdent2.outdent`
|
|
3003
3045
|
import { defineConfig } from "@pandacss/dev"
|
|
@@ -3030,11 +3072,11 @@ syntax: '${syntax}'` : ""}
|
|
|
3030
3072
|
})
|
|
3031
3073
|
`;
|
|
3032
3074
|
await import_fs_extra2.default.writeFile((0, import_path6.join)(cwd, file), import_prettier.default.format(content, { parser: "babel" }));
|
|
3033
|
-
|
|
3075
|
+
import_logger12.logger.log(import_core2.messages.thankYou());
|
|
3034
3076
|
}
|
|
3035
3077
|
}
|
|
3036
3078
|
async function setupPostcss(cwd) {
|
|
3037
|
-
|
|
3079
|
+
import_logger12.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger12.quote)("postcss.config.cjs")}`);
|
|
3038
3080
|
const content = import_outdent2.outdent`
|
|
3039
3081
|
module.exports = {
|
|
3040
3082
|
plugins: {
|
|
@@ -3056,6 +3098,7 @@ module.exports = {
|
|
|
3056
3098
|
generate,
|
|
3057
3099
|
loadConfigAndCreateContext,
|
|
3058
3100
|
parseDependency,
|
|
3101
|
+
setLogStream,
|
|
3059
3102
|
setupConfig,
|
|
3060
3103
|
setupGitIgnore,
|
|
3061
3104
|
setupPostcss,
|
package/dist/index.mjs
CHANGED
|
@@ -2198,7 +2198,9 @@ var limit = pLimit(20);
|
|
|
2198
2198
|
async function codegen(ctx, ids) {
|
|
2199
2199
|
if (ctx.config.clean)
|
|
2200
2200
|
ctx.output.empty();
|
|
2201
|
-
const
|
|
2201
|
+
const artifacts = ctx.getArtifacts(ids);
|
|
2202
|
+
await ctx.hooks["codegen:prepare"]?.({ changed: ids, artifacts });
|
|
2203
|
+
const promises = artifacts.map((artifact) => limit(() => ctx.output.write(artifact)));
|
|
2202
2204
|
await Promise.allSettled(promises);
|
|
2203
2205
|
await ctx.hooks["codegen:done"]?.({ changed: ids });
|
|
2204
2206
|
return {
|
|
@@ -2302,8 +2304,8 @@ var nodeRuntime = {
|
|
|
2302
2304
|
readDirSync: fsExtra.readdirSync,
|
|
2303
2305
|
rmDirSync: fsExtra.emptyDirSync,
|
|
2304
2306
|
rmFileSync: fsExtra.removeSync,
|
|
2305
|
-
ensureDirSync(
|
|
2306
|
-
return fsExtra.ensureDirSync(
|
|
2307
|
+
ensureDirSync(path3) {
|
|
2308
|
+
return fsExtra.ensureDirSync(path3);
|
|
2307
2309
|
},
|
|
2308
2310
|
watch(options) {
|
|
2309
2311
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -2470,10 +2472,11 @@ var PandaContext = class extends Generator2 {
|
|
|
2470
2472
|
})
|
|
2471
2473
|
);
|
|
2472
2474
|
};
|
|
2473
|
-
watchFiles = (cb) => {
|
|
2475
|
+
watchFiles = (cb, opts) => {
|
|
2474
2476
|
const { include, exclude, poll, cwd } = this.config;
|
|
2475
2477
|
logger5.info("ctx:watch", this.messages.watch());
|
|
2476
2478
|
const watcher = this.runtime.fs.watch({
|
|
2479
|
+
...opts,
|
|
2477
2480
|
include,
|
|
2478
2481
|
exclude,
|
|
2479
2482
|
poll,
|
|
@@ -2743,25 +2746,28 @@ import { logger as logger7 } from "@pandacss/logger";
|
|
|
2743
2746
|
import fs from "fs";
|
|
2744
2747
|
import path from "path";
|
|
2745
2748
|
var startProfiling = async (cwd, prefix) => {
|
|
2746
|
-
const
|
|
2747
|
-
const
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2749
|
+
const inspector = await import("node:inspector").then((r) => r.default);
|
|
2750
|
+
const session = new inspector.Session();
|
|
2751
|
+
session.connect();
|
|
2752
|
+
await new Promise((resolve4) => {
|
|
2753
|
+
session.post("Profiler.enable", () => {
|
|
2754
|
+
session.post("Profiler.start", resolve4);
|
|
2755
|
+
});
|
|
2756
|
+
});
|
|
2752
2757
|
const stopProfiling = () => {
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
console.error(error);
|
|
2758
|
+
session.post("Profiler.stop", (err, { profile }) => {
|
|
2759
|
+
if (err) {
|
|
2760
|
+
logger7.error("cpu-prof", err);
|
|
2757
2761
|
return;
|
|
2758
2762
|
}
|
|
2759
|
-
if (!
|
|
2763
|
+
if (!profile)
|
|
2760
2764
|
return;
|
|
2765
|
+
const date = /* @__PURE__ */ new Date();
|
|
2766
|
+
const timestamp = date.toISOString().replace(/[-:.]/g, "");
|
|
2767
|
+
const title = `panda-${prefix}-${timestamp}`;
|
|
2761
2768
|
const outfile = path.join(cwd, `${title}.cpuprofile`);
|
|
2762
|
-
fs.writeFileSync(outfile,
|
|
2769
|
+
fs.writeFileSync(outfile, JSON.stringify(profile));
|
|
2763
2770
|
logger7.info("cpu-prof", outfile);
|
|
2764
|
-
profile.delete();
|
|
2765
2771
|
});
|
|
2766
2772
|
};
|
|
2767
2773
|
return stopProfiling;
|
|
@@ -2812,12 +2818,12 @@ async function debug(ctx, options) {
|
|
|
2812
2818
|
const measureTotal = logger9.time.debug(`Done parsing ${files.length} files`);
|
|
2813
2819
|
ctx.config.minify = false;
|
|
2814
2820
|
ctx.config.optimize = true;
|
|
2815
|
-
const { fs:
|
|
2821
|
+
const { fs: fs3, path: path3 } = ctx.runtime;
|
|
2816
2822
|
const outdir = options.outdir;
|
|
2817
2823
|
if (!options.dry && outdir) {
|
|
2818
|
-
|
|
2824
|
+
fs3.ensureDirSync(outdir);
|
|
2819
2825
|
logger9.info("cli", `Writing ${colors2.bold(`${outdir}/config.json`)}`);
|
|
2820
|
-
await
|
|
2826
|
+
await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2821
2827
|
}
|
|
2822
2828
|
if (options.onlyConfig) {
|
|
2823
2829
|
measureTotal();
|
|
@@ -2842,14 +2848,14 @@ async function debug(ctx, options) {
|
|
|
2842
2848
|
if (outdir) {
|
|
2843
2849
|
filesWithCss.push(file);
|
|
2844
2850
|
const parsedPath = parse2(file);
|
|
2845
|
-
const relative2 =
|
|
2846
|
-
const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(
|
|
2847
|
-
const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(
|
|
2851
|
+
const relative2 = path3.relative(ctx.config.cwd, parsedPath.dir);
|
|
2852
|
+
const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path3.sep, "__");
|
|
2853
|
+
const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path3.sep, "__");
|
|
2848
2854
|
logger9.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2849
2855
|
logger9.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
|
|
2850
2856
|
return Promise.allSettled([
|
|
2851
|
-
|
|
2852
|
-
|
|
2857
|
+
fs3.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2858
|
+
fs3.writeFile(`${outdir}/${cssPath}`, css)
|
|
2853
2859
|
]);
|
|
2854
2860
|
}
|
|
2855
2861
|
});
|
|
@@ -2943,11 +2949,46 @@ function setupGitIgnore(ctx) {
|
|
|
2943
2949
|
}
|
|
2944
2950
|
}
|
|
2945
2951
|
|
|
2952
|
+
// src/logstream.ts
|
|
2953
|
+
init_esm_shims();
|
|
2954
|
+
import { logger as logger11 } from "@pandacss/logger";
|
|
2955
|
+
import fs2 from "node:fs";
|
|
2956
|
+
import path2 from "node:path";
|
|
2957
|
+
var setLogStream = (options) => {
|
|
2958
|
+
const { cwd = process.cwd() } = options;
|
|
2959
|
+
let stream;
|
|
2960
|
+
if (options.logfile) {
|
|
2961
|
+
const outPath = path2.resolve(cwd, options.logfile);
|
|
2962
|
+
ensure(outPath);
|
|
2963
|
+
logger11.info("logfile", outPath);
|
|
2964
|
+
stream = fs2.createWriteStream(outPath, { flags: "a" });
|
|
2965
|
+
logger11.onLog = (entry) => {
|
|
2966
|
+
stream?.write(JSON.stringify(entry) + "\n");
|
|
2967
|
+
};
|
|
2968
|
+
}
|
|
2969
|
+
process.once("SIGINT", () => {
|
|
2970
|
+
stream?.end();
|
|
2971
|
+
});
|
|
2972
|
+
return {
|
|
2973
|
+
end() {
|
|
2974
|
+
stream?.end();
|
|
2975
|
+
},
|
|
2976
|
+
[Symbol.dispose]: () => {
|
|
2977
|
+
stream?.end();
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
};
|
|
2981
|
+
var ensure = (outPath) => {
|
|
2982
|
+
const dirname2 = path2.dirname(outPath);
|
|
2983
|
+
fs2.mkdirSync(dirname2, { recursive: true });
|
|
2984
|
+
return outPath;
|
|
2985
|
+
};
|
|
2986
|
+
|
|
2946
2987
|
// src/setup-config.ts
|
|
2947
2988
|
init_esm_shims();
|
|
2948
2989
|
import { findConfig as findConfig2 } from "@pandacss/config";
|
|
2949
2990
|
import { messages } from "@pandacss/core";
|
|
2950
|
-
import { logger as
|
|
2991
|
+
import { logger as logger12, quote } from "@pandacss/logger";
|
|
2951
2992
|
import { PandaError as PandaError2 } from "@pandacss/shared";
|
|
2952
2993
|
import fsExtra2 from "fs-extra";
|
|
2953
2994
|
import { lookItUpSync as lookItUpSync2 } from "look-it-up";
|
|
@@ -2970,9 +3011,9 @@ async function setupConfig(cwd, opts = {}) {
|
|
|
2970
3011
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2971
3012
|
const isTs = lookItUpSync2("tsconfig.json", cwd);
|
|
2972
3013
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2973
|
-
|
|
3014
|
+
logger12.info("init:config", `creating panda config file: ${quote(file)}`);
|
|
2974
3015
|
if (!force && configFile) {
|
|
2975
|
-
|
|
3016
|
+
logger12.warn("init:config", messages.configExists(cmd));
|
|
2976
3017
|
} else {
|
|
2977
3018
|
const content = outdent2`
|
|
2978
3019
|
import { defineConfig } from "@pandacss/dev"
|
|
@@ -3005,11 +3046,11 @@ syntax: '${syntax}'` : ""}
|
|
|
3005
3046
|
})
|
|
3006
3047
|
`;
|
|
3007
3048
|
await fsExtra2.writeFile(join2(cwd, file), prettier.format(content, { parser: "babel" }));
|
|
3008
|
-
|
|
3049
|
+
logger12.log(messages.thankYou());
|
|
3009
3050
|
}
|
|
3010
3051
|
}
|
|
3011
3052
|
async function setupPostcss(cwd) {
|
|
3012
|
-
|
|
3053
|
+
logger12.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
|
|
3013
3054
|
const content = outdent2`
|
|
3014
3055
|
module.exports = {
|
|
3015
3056
|
plugins: {
|
|
@@ -3030,6 +3071,7 @@ export {
|
|
|
3030
3071
|
generate,
|
|
3031
3072
|
loadConfigAndCreateContext,
|
|
3032
3073
|
parseDependency,
|
|
3074
|
+
setLogStream,
|
|
3033
3075
|
setupConfig,
|
|
3034
3076
|
setupGitIgnore,
|
|
3035
3077
|
setupPostcss,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -52,16 +52,15 @@
|
|
|
52
52
|
"ts-morph": "19.0.0",
|
|
53
53
|
"ts-pattern": "5.0.5",
|
|
54
54
|
"tsconfck": "^2.1.2",
|
|
55
|
-
"
|
|
56
|
-
"@pandacss/
|
|
57
|
-
"@pandacss/
|
|
58
|
-
"@pandacss/
|
|
59
|
-
"@pandacss/
|
|
60
|
-
"@pandacss/
|
|
61
|
-
"@pandacss/
|
|
62
|
-
"@pandacss/
|
|
63
|
-
"@pandacss/
|
|
64
|
-
"@pandacss/types": "0.29.1"
|
|
55
|
+
"@pandacss/config": "0.30.0",
|
|
56
|
+
"@pandacss/core": "0.30.0",
|
|
57
|
+
"@pandacss/extractor": "0.30.0",
|
|
58
|
+
"@pandacss/generator": "0.30.0",
|
|
59
|
+
"@pandacss/logger": "0.30.0",
|
|
60
|
+
"@pandacss/parser": "0.30.0",
|
|
61
|
+
"@pandacss/shared": "0.30.0",
|
|
62
|
+
"@pandacss/token-dictionary": "0.30.0",
|
|
63
|
+
"@pandacss/types": "0.30.0"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
66
|
"@types/fs-extra": "11.0.4",
|