@pandacss/node 0.0.0-dev-20240129191307 → 0.0.0-dev-20240130182551
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 +63 -17
- package/dist/index.mjs +62 -17
- package/package.json +10 -10
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,
|
|
@@ -2327,8 +2328,8 @@ var nodeRuntime = {
|
|
|
2327
2328
|
readDirSync: import_fs_extra.default.readdirSync,
|
|
2328
2329
|
rmDirSync: import_fs_extra.default.emptyDirSync,
|
|
2329
2330
|
rmFileSync: import_fs_extra.default.removeSync,
|
|
2330
|
-
ensureDirSync(
|
|
2331
|
-
return import_fs_extra.default.ensureDirSync(
|
|
2331
|
+
ensureDirSync(path3) {
|
|
2332
|
+
return import_fs_extra.default.ensureDirSync(path3);
|
|
2332
2333
|
},
|
|
2333
2334
|
watch(options) {
|
|
2334
2335
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -2495,10 +2496,11 @@ var PandaContext = class extends import_generator2.Generator {
|
|
|
2495
2496
|
})
|
|
2496
2497
|
);
|
|
2497
2498
|
};
|
|
2498
|
-
watchFiles = (cb) => {
|
|
2499
|
+
watchFiles = (cb, opts) => {
|
|
2499
2500
|
const { include, exclude, poll, cwd } = this.config;
|
|
2500
2501
|
import_logger5.logger.info("ctx:watch", this.messages.watch());
|
|
2501
2502
|
const watcher = this.runtime.fs.watch({
|
|
2503
|
+
...opts,
|
|
2502
2504
|
include,
|
|
2503
2505
|
exclude,
|
|
2504
2506
|
poll,
|
|
@@ -2837,12 +2839,12 @@ async function debug(ctx, options) {
|
|
|
2837
2839
|
const measureTotal = import_logger9.logger.time.debug(`Done parsing ${files.length} files`);
|
|
2838
2840
|
ctx.config.minify = false;
|
|
2839
2841
|
ctx.config.optimize = true;
|
|
2840
|
-
const { fs:
|
|
2842
|
+
const { fs: fs3, path: path3 } = ctx.runtime;
|
|
2841
2843
|
const outdir = options.outdir;
|
|
2842
2844
|
if (!options.dry && outdir) {
|
|
2843
|
-
|
|
2845
|
+
fs3.ensureDirSync(outdir);
|
|
2844
2846
|
import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/config.json`)}`);
|
|
2845
|
-
await
|
|
2847
|
+
await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2846
2848
|
}
|
|
2847
2849
|
if (options.onlyConfig) {
|
|
2848
2850
|
measureTotal();
|
|
@@ -2867,14 +2869,14 @@ async function debug(ctx, options) {
|
|
|
2867
2869
|
if (outdir) {
|
|
2868
2870
|
filesWithCss.push(file);
|
|
2869
2871
|
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(
|
|
2872
|
+
const relative2 = path3.relative(ctx.config.cwd, parsedPath.dir);
|
|
2873
|
+
const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path3.sep, "__");
|
|
2874
|
+
const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path3.sep, "__");
|
|
2873
2875
|
import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2874
2876
|
import_logger9.logger.info("cli", `Writing ${import_logger9.colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2875
2877
|
return Promise.allSettled([
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
+
fs3.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2879
|
+
fs3.writeFile(`${outdir}/${cssPath}`, css)
|
|
2878
2880
|
]);
|
|
2879
2881
|
}
|
|
2880
2882
|
});
|
|
@@ -2968,11 +2970,47 @@ function setupGitIgnore(ctx) {
|
|
|
2968
2970
|
}
|
|
2969
2971
|
}
|
|
2970
2972
|
|
|
2973
|
+
// src/logstream.ts
|
|
2974
|
+
init_cjs_shims();
|
|
2975
|
+
var import_logger11 = require("@pandacss/logger");
|
|
2976
|
+
var import_node_fs = __toESM(require("fs"));
|
|
2977
|
+
var import_node_path = __toESM(require("path"));
|
|
2978
|
+
var setLogStream = (options) => {
|
|
2979
|
+
const { cwd = process.cwd() } = options;
|
|
2980
|
+
let stream;
|
|
2981
|
+
if (options.logfile) {
|
|
2982
|
+
const outPath = import_node_path.default.resolve(cwd, options.logfile);
|
|
2983
|
+
ensure(outPath);
|
|
2984
|
+
import_logger11.logger.info("logfile", outPath);
|
|
2985
|
+
stream = import_node_fs.default.createWriteStream(outPath, { flags: "a" });
|
|
2986
|
+
import_logger11.logger.onLog = (entry) => {
|
|
2987
|
+
stream?.write(JSON.stringify(entry) + "\n");
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
process.once("SIGINT", () => {
|
|
2991
|
+
stream?.end();
|
|
2992
|
+
});
|
|
2993
|
+
return {
|
|
2994
|
+
end() {
|
|
2995
|
+
stream?.end();
|
|
2996
|
+
},
|
|
2997
|
+
[Symbol.dispose]: () => {
|
|
2998
|
+
stream?.end();
|
|
2999
|
+
}
|
|
3000
|
+
};
|
|
3001
|
+
};
|
|
3002
|
+
var ensure = (outPath) => {
|
|
3003
|
+
const dirname2 = import_node_path.default.dirname(outPath);
|
|
3004
|
+
import_node_fs.default.mkdirSync(dirname2, { recursive: true });
|
|
3005
|
+
return outPath;
|
|
3006
|
+
};
|
|
3007
|
+
|
|
2971
3008
|
// src/setup-config.ts
|
|
2972
3009
|
init_cjs_shims();
|
|
2973
3010
|
var import_config7 = require("@pandacss/config");
|
|
2974
3011
|
var import_core2 = require("@pandacss/core");
|
|
2975
|
-
var
|
|
3012
|
+
var import_logger12 = require("@pandacss/logger");
|
|
3013
|
+
var import_shared3 = require("@pandacss/shared");
|
|
2976
3014
|
var import_fs_extra2 = __toESM(require("fs-extra"));
|
|
2977
3015
|
var import_look_it_up2 = require("look-it-up");
|
|
2978
3016
|
var import_outdent2 = require("outdent");
|
|
@@ -2981,15 +3019,22 @@ var import_preferred_pm = __toESM(require("preferred-pm"));
|
|
|
2981
3019
|
var import_prettier = __toESM(require("prettier"));
|
|
2982
3020
|
async function setupConfig(cwd, opts = {}) {
|
|
2983
3021
|
const { force, outExtension, jsxFramework, syntax } = opts;
|
|
2984
|
-
|
|
3022
|
+
let configFile;
|
|
3023
|
+
try {
|
|
3024
|
+
configFile = (0, import_config7.findConfig)({ cwd });
|
|
3025
|
+
} catch (err) {
|
|
3026
|
+
if (!(err instanceof import_shared3.PandaError)) {
|
|
3027
|
+
throw err;
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
2985
3030
|
const pmResult = await (0, import_preferred_pm.default)(cwd);
|
|
2986
3031
|
const pm = pmResult?.name ?? "npm";
|
|
2987
3032
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2988
3033
|
const isTs = (0, import_look_it_up2.lookItUpSync)("tsconfig.json", cwd);
|
|
2989
3034
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2990
|
-
|
|
3035
|
+
import_logger12.logger.info("init:config", `creating panda config file: ${(0, import_logger12.quote)(file)}`);
|
|
2991
3036
|
if (!force && configFile) {
|
|
2992
|
-
|
|
3037
|
+
import_logger12.logger.warn("init:config", import_core2.messages.configExists(cmd));
|
|
2993
3038
|
} else {
|
|
2994
3039
|
const content = import_outdent2.outdent`
|
|
2995
3040
|
import { defineConfig } from "@pandacss/dev"
|
|
@@ -3022,11 +3067,11 @@ syntax: '${syntax}'` : ""}
|
|
|
3022
3067
|
})
|
|
3023
3068
|
`;
|
|
3024
3069
|
await import_fs_extra2.default.writeFile((0, import_path6.join)(cwd, file), import_prettier.default.format(content, { parser: "babel" }));
|
|
3025
|
-
|
|
3070
|
+
import_logger12.logger.log(import_core2.messages.thankYou());
|
|
3026
3071
|
}
|
|
3027
3072
|
}
|
|
3028
3073
|
async function setupPostcss(cwd) {
|
|
3029
|
-
|
|
3074
|
+
import_logger12.logger.info("init:postcss", `creating postcss config file: ${(0, import_logger12.quote)("postcss.config.cjs")}`);
|
|
3030
3075
|
const content = import_outdent2.outdent`
|
|
3031
3076
|
module.exports = {
|
|
3032
3077
|
plugins: {
|
|
@@ -3048,6 +3093,7 @@ module.exports = {
|
|
|
3048
3093
|
generate,
|
|
3049
3094
|
loadConfigAndCreateContext,
|
|
3050
3095
|
parseDependency,
|
|
3096
|
+
setLogStream,
|
|
3051
3097
|
setupConfig,
|
|
3052
3098
|
setupGitIgnore,
|
|
3053
3099
|
setupPostcss,
|
package/dist/index.mjs
CHANGED
|
@@ -2302,8 +2302,8 @@ var nodeRuntime = {
|
|
|
2302
2302
|
readDirSync: fsExtra.readdirSync,
|
|
2303
2303
|
rmDirSync: fsExtra.emptyDirSync,
|
|
2304
2304
|
rmFileSync: fsExtra.removeSync,
|
|
2305
|
-
ensureDirSync(
|
|
2306
|
-
return fsExtra.ensureDirSync(
|
|
2305
|
+
ensureDirSync(path3) {
|
|
2306
|
+
return fsExtra.ensureDirSync(path3);
|
|
2307
2307
|
},
|
|
2308
2308
|
watch(options) {
|
|
2309
2309
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -2470,10 +2470,11 @@ var PandaContext = class extends Generator2 {
|
|
|
2470
2470
|
})
|
|
2471
2471
|
);
|
|
2472
2472
|
};
|
|
2473
|
-
watchFiles = (cb) => {
|
|
2473
|
+
watchFiles = (cb, opts) => {
|
|
2474
2474
|
const { include, exclude, poll, cwd } = this.config;
|
|
2475
2475
|
logger5.info("ctx:watch", this.messages.watch());
|
|
2476
2476
|
const watcher = this.runtime.fs.watch({
|
|
2477
|
+
...opts,
|
|
2477
2478
|
include,
|
|
2478
2479
|
exclude,
|
|
2479
2480
|
poll,
|
|
@@ -2812,12 +2813,12 @@ async function debug(ctx, options) {
|
|
|
2812
2813
|
const measureTotal = logger9.time.debug(`Done parsing ${files.length} files`);
|
|
2813
2814
|
ctx.config.minify = false;
|
|
2814
2815
|
ctx.config.optimize = true;
|
|
2815
|
-
const { fs:
|
|
2816
|
+
const { fs: fs3, path: path3 } = ctx.runtime;
|
|
2816
2817
|
const outdir = options.outdir;
|
|
2817
2818
|
if (!options.dry && outdir) {
|
|
2818
|
-
|
|
2819
|
+
fs3.ensureDirSync(outdir);
|
|
2819
2820
|
logger9.info("cli", `Writing ${colors2.bold(`${outdir}/config.json`)}`);
|
|
2820
|
-
await
|
|
2821
|
+
await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2821
2822
|
}
|
|
2822
2823
|
if (options.onlyConfig) {
|
|
2823
2824
|
measureTotal();
|
|
@@ -2842,14 +2843,14 @@ async function debug(ctx, options) {
|
|
|
2842
2843
|
if (outdir) {
|
|
2843
2844
|
filesWithCss.push(file);
|
|
2844
2845
|
const parsedPath = parse2(file);
|
|
2845
|
-
const relative2 =
|
|
2846
|
-
const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(
|
|
2847
|
-
const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(
|
|
2846
|
+
const relative2 = path3.relative(ctx.config.cwd, parsedPath.dir);
|
|
2847
|
+
const astJsonPath = `${relative2}/${parsedPath.name}.ast.json`.replaceAll(path3.sep, "__");
|
|
2848
|
+
const cssPath = `${relative2}/${parsedPath.name}.css`.replaceAll(path3.sep, "__");
|
|
2848
2849
|
logger9.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2849
2850
|
logger9.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
|
|
2850
2851
|
return Promise.allSettled([
|
|
2851
|
-
|
|
2852
|
-
|
|
2852
|
+
fs3.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2853
|
+
fs3.writeFile(`${outdir}/${cssPath}`, css)
|
|
2853
2854
|
]);
|
|
2854
2855
|
}
|
|
2855
2856
|
});
|
|
@@ -2943,11 +2944,47 @@ function setupGitIgnore(ctx) {
|
|
|
2943
2944
|
}
|
|
2944
2945
|
}
|
|
2945
2946
|
|
|
2947
|
+
// src/logstream.ts
|
|
2948
|
+
init_esm_shims();
|
|
2949
|
+
import { logger as logger11 } from "@pandacss/logger";
|
|
2950
|
+
import fs2 from "node:fs";
|
|
2951
|
+
import path2 from "node:path";
|
|
2952
|
+
var setLogStream = (options) => {
|
|
2953
|
+
const { cwd = process.cwd() } = options;
|
|
2954
|
+
let stream;
|
|
2955
|
+
if (options.logfile) {
|
|
2956
|
+
const outPath = path2.resolve(cwd, options.logfile);
|
|
2957
|
+
ensure(outPath);
|
|
2958
|
+
logger11.info("logfile", outPath);
|
|
2959
|
+
stream = fs2.createWriteStream(outPath, { flags: "a" });
|
|
2960
|
+
logger11.onLog = (entry) => {
|
|
2961
|
+
stream?.write(JSON.stringify(entry) + "\n");
|
|
2962
|
+
};
|
|
2963
|
+
}
|
|
2964
|
+
process.once("SIGINT", () => {
|
|
2965
|
+
stream?.end();
|
|
2966
|
+
});
|
|
2967
|
+
return {
|
|
2968
|
+
end() {
|
|
2969
|
+
stream?.end();
|
|
2970
|
+
},
|
|
2971
|
+
[Symbol.dispose]: () => {
|
|
2972
|
+
stream?.end();
|
|
2973
|
+
}
|
|
2974
|
+
};
|
|
2975
|
+
};
|
|
2976
|
+
var ensure = (outPath) => {
|
|
2977
|
+
const dirname2 = path2.dirname(outPath);
|
|
2978
|
+
fs2.mkdirSync(dirname2, { recursive: true });
|
|
2979
|
+
return outPath;
|
|
2980
|
+
};
|
|
2981
|
+
|
|
2946
2982
|
// src/setup-config.ts
|
|
2947
2983
|
init_esm_shims();
|
|
2948
2984
|
import { findConfig as findConfig2 } from "@pandacss/config";
|
|
2949
2985
|
import { messages } from "@pandacss/core";
|
|
2950
|
-
import { logger as
|
|
2986
|
+
import { logger as logger12, quote } from "@pandacss/logger";
|
|
2987
|
+
import { PandaError as PandaError2 } from "@pandacss/shared";
|
|
2951
2988
|
import fsExtra2 from "fs-extra";
|
|
2952
2989
|
import { lookItUpSync as lookItUpSync2 } from "look-it-up";
|
|
2953
2990
|
import { outdent as outdent2 } from "outdent";
|
|
@@ -2956,15 +2993,22 @@ import getPackageManager from "preferred-pm";
|
|
|
2956
2993
|
import prettier from "prettier";
|
|
2957
2994
|
async function setupConfig(cwd, opts = {}) {
|
|
2958
2995
|
const { force, outExtension, jsxFramework, syntax } = opts;
|
|
2959
|
-
|
|
2996
|
+
let configFile;
|
|
2997
|
+
try {
|
|
2998
|
+
configFile = findConfig2({ cwd });
|
|
2999
|
+
} catch (err) {
|
|
3000
|
+
if (!(err instanceof PandaError2)) {
|
|
3001
|
+
throw err;
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
2960
3004
|
const pmResult = await getPackageManager(cwd);
|
|
2961
3005
|
const pm = pmResult?.name ?? "npm";
|
|
2962
3006
|
const cmd = pm === "npm" ? "npm run" : pm;
|
|
2963
3007
|
const isTs = lookItUpSync2("tsconfig.json", cwd);
|
|
2964
3008
|
const file = isTs ? "panda.config.ts" : "panda.config.mjs";
|
|
2965
|
-
|
|
3009
|
+
logger12.info("init:config", `creating panda config file: ${quote(file)}`);
|
|
2966
3010
|
if (!force && configFile) {
|
|
2967
|
-
|
|
3011
|
+
logger12.warn("init:config", messages.configExists(cmd));
|
|
2968
3012
|
} else {
|
|
2969
3013
|
const content = outdent2`
|
|
2970
3014
|
import { defineConfig } from "@pandacss/dev"
|
|
@@ -2997,11 +3041,11 @@ syntax: '${syntax}'` : ""}
|
|
|
2997
3041
|
})
|
|
2998
3042
|
`;
|
|
2999
3043
|
await fsExtra2.writeFile(join2(cwd, file), prettier.format(content, { parser: "babel" }));
|
|
3000
|
-
|
|
3044
|
+
logger12.log(messages.thankYou());
|
|
3001
3045
|
}
|
|
3002
3046
|
}
|
|
3003
3047
|
async function setupPostcss(cwd) {
|
|
3004
|
-
|
|
3048
|
+
logger12.info("init:postcss", `creating postcss config file: ${quote("postcss.config.cjs")}`);
|
|
3005
3049
|
const content = outdent2`
|
|
3006
3050
|
module.exports = {
|
|
3007
3051
|
plugins: {
|
|
@@ -3022,6 +3066,7 @@ export {
|
|
|
3022
3066
|
generate,
|
|
3023
3067
|
loadConfigAndCreateContext,
|
|
3024
3068
|
parseDependency,
|
|
3069
|
+
setLogStream,
|
|
3025
3070
|
setupConfig,
|
|
3026
3071
|
setupGitIgnore,
|
|
3027
3072
|
setupPostcss,
|
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-20240130182551",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"ts-pattern": "5.0.5",
|
|
54
54
|
"tsconfck": "^2.1.2",
|
|
55
55
|
"v8-profiler-next": "^1.10.0",
|
|
56
|
-
"@pandacss/config": "0.0.0-dev-
|
|
57
|
-
"@pandacss/core": "0.0.0-dev-
|
|
58
|
-
"@pandacss/extractor": "0.0.0-dev-
|
|
59
|
-
"@pandacss/generator": "0.0.0-dev-
|
|
60
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
61
|
-
"@pandacss/parser": "0.0.0-dev-
|
|
62
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
63
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
64
|
-
"@pandacss/types": "0.0.0-dev-
|
|
56
|
+
"@pandacss/config": "0.0.0-dev-20240130182551",
|
|
57
|
+
"@pandacss/core": "0.0.0-dev-20240130182551",
|
|
58
|
+
"@pandacss/extractor": "0.0.0-dev-20240130182551",
|
|
59
|
+
"@pandacss/generator": "0.0.0-dev-20240130182551",
|
|
60
|
+
"@pandacss/logger": "0.0.0-dev-20240130182551",
|
|
61
|
+
"@pandacss/parser": "0.0.0-dev-20240130182551",
|
|
62
|
+
"@pandacss/shared": "0.0.0-dev-20240130182551",
|
|
63
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20240130182551",
|
|
64
|
+
"@pandacss/types": "0.0.0-dev-20240130182551"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/fs-extra": "11.0.4",
|