@pandacss/node 0.5.0 → 0.5.1
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 +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +45 -25
- package/dist/index.mjs +48 -29
- package/package.json +14 -13
package/dist/index.d.mts
CHANGED
|
@@ -225,16 +225,29 @@ declare function debugFiles(ctx: PandaContext, options: {
|
|
|
225
225
|
declare function execCommand(cmd: string, cwd: string): Promise<void>;
|
|
226
226
|
|
|
227
227
|
declare function extractFile(ctx: PandaContext, file: string): string | undefined;
|
|
228
|
-
declare function emitArtifacts(ctx: PandaContext): Promise<
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
declare function emitArtifacts(ctx: PandaContext): Promise<{
|
|
229
|
+
box: string;
|
|
230
|
+
msg: string;
|
|
231
|
+
}>;
|
|
232
|
+
declare function emitAndExtract(ctx: PandaContext): Promise<{
|
|
233
|
+
files: string[];
|
|
234
|
+
msg: string;
|
|
235
|
+
}>;
|
|
236
|
+
declare function extractCss(ctx: PandaContext): Promise<{
|
|
237
|
+
files: string[];
|
|
238
|
+
msg: string;
|
|
239
|
+
}>;
|
|
240
|
+
declare function bundleCss(ctx: PandaContext, outfile: string): Promise<{
|
|
241
|
+
files: string[];
|
|
242
|
+
msg: string;
|
|
243
|
+
}>;
|
|
231
244
|
|
|
232
245
|
declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
233
246
|
|
|
234
|
-
declare function parseDependency(fileOrGlob: string): Message | null;
|
|
235
|
-
|
|
236
247
|
declare function setupGitIgnore(ctx: PandaContext): void;
|
|
237
248
|
|
|
249
|
+
declare function parseDependency(fileOrGlob: string): Message | null;
|
|
250
|
+
|
|
238
251
|
type SetupOptions = Partial<Config> & {
|
|
239
252
|
force?: boolean;
|
|
240
253
|
};
|
|
@@ -243,4 +256,4 @@ declare function setupPostcss(cwd: string): Promise<void>;
|
|
|
243
256
|
|
|
244
257
|
declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
|
|
245
258
|
|
|
246
|
-
export { Builder, PandaContext, analyzeTokens, createContext, debugFiles, emitAndExtract, emitArtifacts, execCommand, extractCss, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
|
|
259
|
+
export { Builder, PandaContext, analyzeTokens, bundleCss, createContext, debugFiles, emitAndExtract, emitArtifacts, execCommand, extractCss, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
|
package/dist/index.d.ts
CHANGED
|
@@ -225,16 +225,29 @@ declare function debugFiles(ctx: PandaContext, options: {
|
|
|
225
225
|
declare function execCommand(cmd: string, cwd: string): Promise<void>;
|
|
226
226
|
|
|
227
227
|
declare function extractFile(ctx: PandaContext, file: string): string | undefined;
|
|
228
|
-
declare function emitArtifacts(ctx: PandaContext): Promise<
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
declare function emitArtifacts(ctx: PandaContext): Promise<{
|
|
229
|
+
box: string;
|
|
230
|
+
msg: string;
|
|
231
|
+
}>;
|
|
232
|
+
declare function emitAndExtract(ctx: PandaContext): Promise<{
|
|
233
|
+
files: string[];
|
|
234
|
+
msg: string;
|
|
235
|
+
}>;
|
|
236
|
+
declare function extractCss(ctx: PandaContext): Promise<{
|
|
237
|
+
files: string[];
|
|
238
|
+
msg: string;
|
|
239
|
+
}>;
|
|
240
|
+
declare function bundleCss(ctx: PandaContext, outfile: string): Promise<{
|
|
241
|
+
files: string[];
|
|
242
|
+
msg: string;
|
|
243
|
+
}>;
|
|
231
244
|
|
|
232
245
|
declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
233
246
|
|
|
234
|
-
declare function parseDependency(fileOrGlob: string): Message | null;
|
|
235
|
-
|
|
236
247
|
declare function setupGitIgnore(ctx: PandaContext): void;
|
|
237
248
|
|
|
249
|
+
declare function parseDependency(fileOrGlob: string): Message | null;
|
|
250
|
+
|
|
238
251
|
type SetupOptions = Partial<Config> & {
|
|
239
252
|
force?: boolean;
|
|
240
253
|
};
|
|
@@ -243,4 +256,4 @@ declare function setupPostcss(cwd: string): Promise<void>;
|
|
|
243
256
|
|
|
244
257
|
declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
|
|
245
258
|
|
|
246
|
-
export { Builder, PandaContext, analyzeTokens, createContext, debugFiles, emitAndExtract, emitArtifacts, execCommand, extractCss, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
|
|
259
|
+
export { Builder, PandaContext, analyzeTokens, bundleCss, createContext, debugFiles, emitAndExtract, emitArtifacts, execCommand, extractCss, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
|
package/dist/index.js
CHANGED
|
@@ -405,6 +405,7 @@ var src_exports = {};
|
|
|
405
405
|
__export(src_exports, {
|
|
406
406
|
Builder: () => Builder,
|
|
407
407
|
analyzeTokens: () => analyzeTokens,
|
|
408
|
+
bundleCss: () => bundleCss,
|
|
408
409
|
createContext: () => createContext,
|
|
409
410
|
debugFiles: () => debugFiles,
|
|
410
411
|
discardDuplicate: () => import_core3.discardDuplicate,
|
|
@@ -791,6 +792,7 @@ init_cjs_shims();
|
|
|
791
792
|
var import_config = require("@pandacss/config");
|
|
792
793
|
var import_hookable = require("hookable");
|
|
793
794
|
var import_look_it_up = require("look-it-up");
|
|
795
|
+
var import_tsconfck = require("tsconfck");
|
|
794
796
|
|
|
795
797
|
// src/create-context.ts
|
|
796
798
|
init_cjs_shims();
|
|
@@ -950,6 +952,7 @@ var createContext = (conf) => (0, import_lil_fp.pipe)(
|
|
|
950
952
|
}),
|
|
951
953
|
import_lil_fp.Obj.bind("project", ({ getFiles, runtime: { fs }, parserOptions }) => {
|
|
952
954
|
return (0, import_parser.createProject)({
|
|
955
|
+
...conf.tsconfig,
|
|
953
956
|
getFiles,
|
|
954
957
|
readFile: fs.readFileSync,
|
|
955
958
|
hooks: conf.hooks,
|
|
@@ -980,6 +983,11 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
980
983
|
if (options.cwd) {
|
|
981
984
|
conf.config.cwd = options.cwd;
|
|
982
985
|
}
|
|
986
|
+
const tsconfigResult = await (0, import_tsconfck.parse)(conf.path, { root: cwd, resolveWithEmptyIfConfigNotFound: true });
|
|
987
|
+
if (tsconfigResult) {
|
|
988
|
+
conf.tsconfig = tsconfigResult.tsconfig;
|
|
989
|
+
conf.tsconfigFile = tsconfigResult.tsconfigFile;
|
|
990
|
+
}
|
|
983
991
|
conf.config.outdir ??= "styled-system";
|
|
984
992
|
if (conf.config.hooks) {
|
|
985
993
|
hooks.addHooks(conf.config.hooks);
|
|
@@ -2295,12 +2303,14 @@ var createBox = (options) => boxen(options.content, {
|
|
|
2295
2303
|
});
|
|
2296
2304
|
|
|
2297
2305
|
// src/extract.ts
|
|
2306
|
+
var import_promises2 = require("fs/promises");
|
|
2298
2307
|
async function bundleChunks(ctx) {
|
|
2299
2308
|
const files = ctx.chunks.getFiles();
|
|
2300
|
-
|
|
2309
|
+
await ctx.output.write({
|
|
2301
2310
|
dir: ctx.paths.root,
|
|
2302
2311
|
files: [{ file: "styles.css", code: ctx.getCss({ files }) }]
|
|
2303
2312
|
});
|
|
2313
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2304
2314
|
}
|
|
2305
2315
|
async function writeFileChunk(ctx, file) {
|
|
2306
2316
|
const { path: path2 } = ctx.runtime;
|
|
@@ -2342,21 +2352,29 @@ async function emitArtifacts(ctx) {
|
|
|
2342
2352
|
if (ctx.config.clean)
|
|
2343
2353
|
ctx.output.empty();
|
|
2344
2354
|
await Promise.all(ctx.getArtifacts().map(ctx.output.write));
|
|
2345
|
-
return
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2355
|
+
return {
|
|
2356
|
+
box: createBox({
|
|
2357
|
+
content: ctx.messages.codegenComplete(),
|
|
2358
|
+
title: `\u{1F43C} ${pickRandom(randomWords)}! \u2728`
|
|
2359
|
+
}),
|
|
2360
|
+
msg: ctx.messages.artifactsGenerated()
|
|
2361
|
+
};
|
|
2349
2362
|
}
|
|
2350
2363
|
async function emitAndExtract(ctx) {
|
|
2351
2364
|
await emitArtifacts(ctx);
|
|
2352
|
-
if (ctx.config.emitTokensOnly)
|
|
2353
|
-
return "Successfully rebuilt the css variables and js function to query your tokens \u2728";
|
|
2365
|
+
if (ctx.config.emitTokensOnly) {
|
|
2366
|
+
return { files: [], msg: "Successfully rebuilt the css variables and js function to query your tokens \u2728" };
|
|
2367
|
+
}
|
|
2354
2368
|
return extractCss(ctx);
|
|
2355
2369
|
}
|
|
2356
2370
|
async function extractCss(ctx) {
|
|
2357
2371
|
await extractFiles(ctx);
|
|
2358
|
-
|
|
2359
|
-
|
|
2372
|
+
return bundleChunks(ctx);
|
|
2373
|
+
}
|
|
2374
|
+
async function bundleCss(ctx, outfile) {
|
|
2375
|
+
const files = ctx.chunks.getFiles();
|
|
2376
|
+
await (0, import_promises2.writeFile)(outfile, ctx.getCss({ files, resolve: true }));
|
|
2377
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2360
2378
|
}
|
|
2361
2379
|
|
|
2362
2380
|
// src/parse-dependency.ts
|
|
@@ -2449,7 +2467,18 @@ var Builder = class {
|
|
|
2449
2467
|
async setup(options = {}) {
|
|
2450
2468
|
import_logger4.logger.debug("builder", "\u{1F6A7} Setup");
|
|
2451
2469
|
const configPath = options.configPath ?? this.getConfigPath();
|
|
2452
|
-
|
|
2470
|
+
let tsOptions = { baseUrl: void 0, pathMappings: [] };
|
|
2471
|
+
if (this.context?.tsconfig) {
|
|
2472
|
+
const options2 = this.context.tsconfig.compilerOptions;
|
|
2473
|
+
if (options2?.paths) {
|
|
2474
|
+
const baseUrl = options2.baseUrl;
|
|
2475
|
+
tsOptions = {
|
|
2476
|
+
baseUrl,
|
|
2477
|
+
pathMappings: (0, import_config2.convertTsPathsToRegexes)(options2?.paths, baseUrl ?? this.context.config.cwd)
|
|
2478
|
+
};
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
const { deps: configDeps } = (0, import_config2.getConfigDependencies)(configPath, tsOptions);
|
|
2453
2482
|
const deps = this.checkConfigDeps(configPath, configDeps);
|
|
2454
2483
|
if (deps.isModified) {
|
|
2455
2484
|
await this.setupContext({
|
|
@@ -2585,12 +2614,11 @@ async function debugFiles(ctx, options) {
|
|
|
2585
2614
|
measure();
|
|
2586
2615
|
if (!result)
|
|
2587
2616
|
return;
|
|
2588
|
-
const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
|
|
2589
2617
|
const css = ctx.getParserCss(result);
|
|
2590
2618
|
if (!css)
|
|
2591
2619
|
return;
|
|
2592
2620
|
if (options.dry) {
|
|
2593
|
-
console.log({ path: file, ast:
|
|
2621
|
+
console.log({ path: file, ast: result, code: css });
|
|
2594
2622
|
return Promise.resolve();
|
|
2595
2623
|
}
|
|
2596
2624
|
if (outdir) {
|
|
@@ -2602,7 +2630,7 @@ async function debugFiles(ctx, options) {
|
|
|
2602
2630
|
import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2603
2631
|
import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2604
2632
|
return Promise.all([
|
|
2605
|
-
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(
|
|
2633
|
+
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2606
2634
|
fs.writeFile(`${outdir}/${cssPath}`, css)
|
|
2607
2635
|
]);
|
|
2608
2636
|
}
|
|
@@ -2611,15 +2639,6 @@ async function debugFiles(ctx, options) {
|
|
|
2611
2639
|
import_logger5.logger.info("cli", `Found ${import_logger5.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2612
2640
|
measureTotal();
|
|
2613
2641
|
}
|
|
2614
|
-
var debugResultSerializer = (_key, value) => {
|
|
2615
|
-
if (value instanceof Set) {
|
|
2616
|
-
return Array.from(value);
|
|
2617
|
-
}
|
|
2618
|
-
if (value instanceof Map) {
|
|
2619
|
-
return Object.fromEntries(value);
|
|
2620
|
-
}
|
|
2621
|
-
return value;
|
|
2622
|
-
};
|
|
2623
2642
|
|
|
2624
2643
|
// src/exec-command.ts
|
|
2625
2644
|
init_cjs_shims();
|
|
@@ -2658,7 +2677,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2658
2677
|
|
|
2659
2678
|
// src/generate.ts
|
|
2660
2679
|
async function build(ctx) {
|
|
2661
|
-
const msg = await emitAndExtract(ctx);
|
|
2680
|
+
const { msg } = await emitAndExtract(ctx);
|
|
2662
2681
|
import_logger7.logger.info("css:emit", msg);
|
|
2663
2682
|
}
|
|
2664
2683
|
async function generate(config, configPath) {
|
|
@@ -2794,7 +2813,7 @@ module.exports = {
|
|
|
2794
2813
|
init_cjs_shims();
|
|
2795
2814
|
var import_logger9 = require("@pandacss/logger");
|
|
2796
2815
|
var import_parser2 = require("@pandacss/parser");
|
|
2797
|
-
var
|
|
2816
|
+
var import_promises3 = require("fs/promises");
|
|
2798
2817
|
var path = __toESM(require("path"));
|
|
2799
2818
|
async function shipFiles(ctx, outfile) {
|
|
2800
2819
|
const files = ctx.getFiles();
|
|
@@ -2814,13 +2833,14 @@ async function shipFiles(ctx, outfile) {
|
|
|
2814
2833
|
const minify = ctx.config.minify;
|
|
2815
2834
|
import_logger9.logger.info("cli", `Writing ${minify ? "[min] " : " "}${import_logger9.colors.bold(outfile)}`);
|
|
2816
2835
|
const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
|
|
2817
|
-
await (0,
|
|
2836
|
+
await (0, import_promises3.writeFile)(outfile, output);
|
|
2818
2837
|
import_logger9.logger.info("cli", "Done!");
|
|
2819
2838
|
}
|
|
2820
2839
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2821
2840
|
0 && (module.exports = {
|
|
2822
2841
|
Builder,
|
|
2823
2842
|
analyzeTokens,
|
|
2843
|
+
bundleCss,
|
|
2824
2844
|
createContext,
|
|
2825
2845
|
debugFiles,
|
|
2826
2846
|
discardDuplicate,
|
package/dist/index.mjs
CHANGED
|
@@ -756,7 +756,7 @@ var writeAnalyzeJSON = (fileName, result, ctx) => {
|
|
|
756
756
|
|
|
757
757
|
// src/builder.ts
|
|
758
758
|
init_esm_shims();
|
|
759
|
-
import { getConfigDependencies } from "@pandacss/config";
|
|
759
|
+
import { getConfigDependencies, convertTsPathsToRegexes } from "@pandacss/config";
|
|
760
760
|
import { discardDuplicate, mergeCss as mergeCss2 } from "@pandacss/core";
|
|
761
761
|
import { ConfigNotFoundError } from "@pandacss/error";
|
|
762
762
|
import { logger as logger4 } from "@pandacss/logger";
|
|
@@ -769,6 +769,7 @@ init_esm_shims();
|
|
|
769
769
|
import { loadConfigFile } from "@pandacss/config";
|
|
770
770
|
import { createDebugger, createHooks } from "hookable";
|
|
771
771
|
import { lookItUpSync } from "look-it-up";
|
|
772
|
+
import { parse } from "tsconfck";
|
|
772
773
|
|
|
773
774
|
// src/create-context.ts
|
|
774
775
|
init_esm_shims();
|
|
@@ -937,6 +938,7 @@ var createContext = (conf) => pipe(
|
|
|
937
938
|
}),
|
|
938
939
|
Obj.bind("project", ({ getFiles, runtime: { fs }, parserOptions }) => {
|
|
939
940
|
return createProject({
|
|
941
|
+
...conf.tsconfig,
|
|
940
942
|
getFiles,
|
|
941
943
|
readFile: fs.readFileSync,
|
|
942
944
|
hooks: conf.hooks,
|
|
@@ -967,6 +969,11 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
967
969
|
if (options.cwd) {
|
|
968
970
|
conf.config.cwd = options.cwd;
|
|
969
971
|
}
|
|
972
|
+
const tsconfigResult = await parse(conf.path, { root: cwd, resolveWithEmptyIfConfigNotFound: true });
|
|
973
|
+
if (tsconfigResult) {
|
|
974
|
+
conf.tsconfig = tsconfigResult.tsconfig;
|
|
975
|
+
conf.tsconfigFile = tsconfigResult.tsconfigFile;
|
|
976
|
+
}
|
|
970
977
|
conf.config.outdir ??= "styled-system";
|
|
971
978
|
if (conf.config.hooks) {
|
|
972
979
|
hooks.addHooks(conf.config.hooks);
|
|
@@ -2282,12 +2289,14 @@ var createBox = (options) => boxen(options.content, {
|
|
|
2282
2289
|
});
|
|
2283
2290
|
|
|
2284
2291
|
// src/extract.ts
|
|
2292
|
+
import { writeFile as writeFile3 } from "fs/promises";
|
|
2285
2293
|
async function bundleChunks(ctx) {
|
|
2286
2294
|
const files = ctx.chunks.getFiles();
|
|
2287
|
-
|
|
2295
|
+
await ctx.output.write({
|
|
2288
2296
|
dir: ctx.paths.root,
|
|
2289
2297
|
files: [{ file: "styles.css", code: ctx.getCss({ files }) }]
|
|
2290
2298
|
});
|
|
2299
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2291
2300
|
}
|
|
2292
2301
|
async function writeFileChunk(ctx, file) {
|
|
2293
2302
|
const { path: path2 } = ctx.runtime;
|
|
@@ -2329,21 +2338,29 @@ async function emitArtifacts(ctx) {
|
|
|
2329
2338
|
if (ctx.config.clean)
|
|
2330
2339
|
ctx.output.empty();
|
|
2331
2340
|
await Promise.all(ctx.getArtifacts().map(ctx.output.write));
|
|
2332
|
-
return
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2341
|
+
return {
|
|
2342
|
+
box: createBox({
|
|
2343
|
+
content: ctx.messages.codegenComplete(),
|
|
2344
|
+
title: `\u{1F43C} ${pickRandom(randomWords)}! \u2728`
|
|
2345
|
+
}),
|
|
2346
|
+
msg: ctx.messages.artifactsGenerated()
|
|
2347
|
+
};
|
|
2336
2348
|
}
|
|
2337
2349
|
async function emitAndExtract(ctx) {
|
|
2338
2350
|
await emitArtifacts(ctx);
|
|
2339
|
-
if (ctx.config.emitTokensOnly)
|
|
2340
|
-
return "Successfully rebuilt the css variables and js function to query your tokens \u2728";
|
|
2351
|
+
if (ctx.config.emitTokensOnly) {
|
|
2352
|
+
return { files: [], msg: "Successfully rebuilt the css variables and js function to query your tokens \u2728" };
|
|
2353
|
+
}
|
|
2341
2354
|
return extractCss(ctx);
|
|
2342
2355
|
}
|
|
2343
2356
|
async function extractCss(ctx) {
|
|
2344
2357
|
await extractFiles(ctx);
|
|
2345
|
-
|
|
2346
|
-
|
|
2358
|
+
return bundleChunks(ctx);
|
|
2359
|
+
}
|
|
2360
|
+
async function bundleCss(ctx, outfile) {
|
|
2361
|
+
const files = ctx.chunks.getFiles();
|
|
2362
|
+
await writeFile3(outfile, ctx.getCss({ files, resolve: true }));
|
|
2363
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2347
2364
|
}
|
|
2348
2365
|
|
|
2349
2366
|
// src/parse-dependency.ts
|
|
@@ -2436,7 +2453,18 @@ var Builder = class {
|
|
|
2436
2453
|
async setup(options = {}) {
|
|
2437
2454
|
logger4.debug("builder", "\u{1F6A7} Setup");
|
|
2438
2455
|
const configPath = options.configPath ?? this.getConfigPath();
|
|
2439
|
-
|
|
2456
|
+
let tsOptions = { baseUrl: void 0, pathMappings: [] };
|
|
2457
|
+
if (this.context?.tsconfig) {
|
|
2458
|
+
const options2 = this.context.tsconfig.compilerOptions;
|
|
2459
|
+
if (options2?.paths) {
|
|
2460
|
+
const baseUrl = options2.baseUrl;
|
|
2461
|
+
tsOptions = {
|
|
2462
|
+
baseUrl,
|
|
2463
|
+
pathMappings: convertTsPathsToRegexes(options2?.paths, baseUrl ?? this.context.config.cwd)
|
|
2464
|
+
};
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
const { deps: configDeps } = getConfigDependencies(configPath, tsOptions);
|
|
2440
2468
|
const deps = this.checkConfigDeps(configPath, configDeps);
|
|
2441
2469
|
if (deps.isModified) {
|
|
2442
2470
|
await this.setupContext({
|
|
@@ -2572,12 +2600,11 @@ async function debugFiles(ctx, options) {
|
|
|
2572
2600
|
measure();
|
|
2573
2601
|
if (!result)
|
|
2574
2602
|
return;
|
|
2575
|
-
const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
|
|
2576
2603
|
const css = ctx.getParserCss(result);
|
|
2577
2604
|
if (!css)
|
|
2578
2605
|
return;
|
|
2579
2606
|
if (options.dry) {
|
|
2580
|
-
console.log({ path: file, ast:
|
|
2607
|
+
console.log({ path: file, ast: result, code: css });
|
|
2581
2608
|
return Promise.resolve();
|
|
2582
2609
|
}
|
|
2583
2610
|
if (outdir) {
|
|
@@ -2589,7 +2616,7 @@ async function debugFiles(ctx, options) {
|
|
|
2589
2616
|
logger5.info("cli", `Writing ${colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2590
2617
|
logger5.info("cli", `Writing ${colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2591
2618
|
return Promise.all([
|
|
2592
|
-
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(
|
|
2619
|
+
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2593
2620
|
fs.writeFile(`${outdir}/${cssPath}`, css)
|
|
2594
2621
|
]);
|
|
2595
2622
|
}
|
|
@@ -2598,15 +2625,6 @@ async function debugFiles(ctx, options) {
|
|
|
2598
2625
|
logger5.info("cli", `Found ${colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2599
2626
|
measureTotal();
|
|
2600
2627
|
}
|
|
2601
|
-
var debugResultSerializer = (_key, value) => {
|
|
2602
|
-
if (value instanceof Set) {
|
|
2603
|
-
return Array.from(value);
|
|
2604
|
-
}
|
|
2605
|
-
if (value instanceof Map) {
|
|
2606
|
-
return Object.fromEntries(value);
|
|
2607
|
-
}
|
|
2608
|
-
return value;
|
|
2609
|
-
};
|
|
2610
2628
|
|
|
2611
2629
|
// src/exec-command.ts
|
|
2612
2630
|
init_esm_shims();
|
|
@@ -2645,7 +2663,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2645
2663
|
|
|
2646
2664
|
// src/generate.ts
|
|
2647
2665
|
async function build(ctx) {
|
|
2648
|
-
const msg = await emitAndExtract(ctx);
|
|
2666
|
+
const { msg } = await emitAndExtract(ctx);
|
|
2649
2667
|
logger7.info("css:emit", msg);
|
|
2650
2668
|
}
|
|
2651
2669
|
async function generate(config, configPath) {
|
|
@@ -2714,7 +2732,7 @@ function setupGitIgnore(ctx) {
|
|
|
2714
2732
|
init_esm_shims();
|
|
2715
2733
|
import { messages } from "@pandacss/generator";
|
|
2716
2734
|
import { logger as logger8, quote } from "@pandacss/logger";
|
|
2717
|
-
import { writeFile as
|
|
2735
|
+
import { writeFile as writeFile4 } from "fs-extra";
|
|
2718
2736
|
import { lookItUpSync as lookItUpSync3 } from "look-it-up";
|
|
2719
2737
|
import { outdent as outdent2 } from "outdent";
|
|
2720
2738
|
import { join as join2 } from "path";
|
|
@@ -2761,7 +2779,7 @@ jsxFramework: '${jsxFramework}'` : ""}
|
|
|
2761
2779
|
syntax: '${syntax}'` : ""}
|
|
2762
2780
|
})
|
|
2763
2781
|
`;
|
|
2764
|
-
await
|
|
2782
|
+
await writeFile4(join2(cwd, file), content);
|
|
2765
2783
|
logger8.log(messages.thankYou());
|
|
2766
2784
|
}
|
|
2767
2785
|
}
|
|
@@ -2774,14 +2792,14 @@ module.exports = {
|
|
|
2774
2792
|
},
|
|
2775
2793
|
}
|
|
2776
2794
|
`;
|
|
2777
|
-
await
|
|
2795
|
+
await writeFile4(join2(cwd, "postcss.config.cjs"), content);
|
|
2778
2796
|
}
|
|
2779
2797
|
|
|
2780
2798
|
// src/ship-files.ts
|
|
2781
2799
|
init_esm_shims();
|
|
2782
2800
|
import { colors as colors2, logger as logger9 } from "@pandacss/logger";
|
|
2783
2801
|
import { createParserResult } from "@pandacss/parser";
|
|
2784
|
-
import { writeFile as
|
|
2802
|
+
import { writeFile as writeFile5 } from "fs/promises";
|
|
2785
2803
|
import * as path from "path";
|
|
2786
2804
|
async function shipFiles(ctx, outfile) {
|
|
2787
2805
|
const files = ctx.getFiles();
|
|
@@ -2801,12 +2819,13 @@ async function shipFiles(ctx, outfile) {
|
|
|
2801
2819
|
const minify = ctx.config.minify;
|
|
2802
2820
|
logger9.info("cli", `Writing ${minify ? "[min] " : " "}${colors2.bold(outfile)}`);
|
|
2803
2821
|
const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
|
|
2804
|
-
await
|
|
2822
|
+
await writeFile5(outfile, output);
|
|
2805
2823
|
logger9.info("cli", "Done!");
|
|
2806
2824
|
}
|
|
2807
2825
|
export {
|
|
2808
2826
|
Builder,
|
|
2809
2827
|
analyzeTokens,
|
|
2828
|
+
bundleCss,
|
|
2810
2829
|
createContext,
|
|
2811
2830
|
debugFiles,
|
|
2812
2831
|
discardDuplicate2 as discardDuplicate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,17 +33,18 @@
|
|
|
33
33
|
"preferred-pm": "^3.0.3",
|
|
34
34
|
"ts-morph": "18.0.0",
|
|
35
35
|
"ts-pattern": "4.3.0",
|
|
36
|
-
"
|
|
37
|
-
"@pandacss/
|
|
38
|
-
"@pandacss/
|
|
39
|
-
"@pandacss/
|
|
40
|
-
"@pandacss/
|
|
41
|
-
"@pandacss/
|
|
42
|
-
"@pandacss/
|
|
43
|
-
"@pandacss/
|
|
44
|
-
"@pandacss/
|
|
45
|
-
"@pandacss/
|
|
46
|
-
"@pandacss/
|
|
36
|
+
"tsconfck": "^2.1.1",
|
|
37
|
+
"@pandacss/config": "0.5.1",
|
|
38
|
+
"@pandacss/core": "0.5.1",
|
|
39
|
+
"@pandacss/error": "0.5.1",
|
|
40
|
+
"@pandacss/extractor": "0.5.1",
|
|
41
|
+
"@pandacss/generator": "0.5.1",
|
|
42
|
+
"@pandacss/is-valid-prop": "0.5.1",
|
|
43
|
+
"@pandacss/logger": "0.5.1",
|
|
44
|
+
"@pandacss/parser": "0.5.1",
|
|
45
|
+
"@pandacss/shared": "0.5.1",
|
|
46
|
+
"@pandacss/token-dictionary": "0.5.1",
|
|
47
|
+
"@pandacss/types": "0.5.1"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@types/fs-extra": "11.0.1",
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"@types/lodash.merge": "4.6.7",
|
|
53
54
|
"@types/pluralize": "0.0.29",
|
|
54
55
|
"boxen": "^7.1.0",
|
|
55
|
-
"@pandacss/fixture": "0.5.
|
|
56
|
+
"@pandacss/fixture": "0.5.1"
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|
|
58
59
|
"build": "tsup src/index.ts --format=cjs,esm --shims --dts",
|