@pandacss/node 0.5.0 → 0.6.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 +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +46 -25
- package/dist/index.mjs +49 -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,30 @@ 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
|
+
await extractFiles(ctx);
|
|
2376
|
+
const files = ctx.chunks.getFiles();
|
|
2377
|
+
await (0, import_promises2.writeFile)(outfile, ctx.getCss({ files, resolve: true }));
|
|
2378
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2360
2379
|
}
|
|
2361
2380
|
|
|
2362
2381
|
// src/parse-dependency.ts
|
|
@@ -2449,7 +2468,18 @@ var Builder = class {
|
|
|
2449
2468
|
async setup(options = {}) {
|
|
2450
2469
|
import_logger4.logger.debug("builder", "\u{1F6A7} Setup");
|
|
2451
2470
|
const configPath = options.configPath ?? this.getConfigPath();
|
|
2452
|
-
|
|
2471
|
+
let tsOptions = { baseUrl: void 0, pathMappings: [] };
|
|
2472
|
+
if (this.context?.tsconfig) {
|
|
2473
|
+
const options2 = this.context.tsconfig.compilerOptions;
|
|
2474
|
+
if (options2?.paths) {
|
|
2475
|
+
const baseUrl = options2.baseUrl;
|
|
2476
|
+
tsOptions = {
|
|
2477
|
+
baseUrl,
|
|
2478
|
+
pathMappings: (0, import_config2.convertTsPathsToRegexes)(options2?.paths, baseUrl ?? this.context.config.cwd)
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
const { deps: configDeps } = (0, import_config2.getConfigDependencies)(configPath, tsOptions);
|
|
2453
2483
|
const deps = this.checkConfigDeps(configPath, configDeps);
|
|
2454
2484
|
if (deps.isModified) {
|
|
2455
2485
|
await this.setupContext({
|
|
@@ -2585,12 +2615,11 @@ async function debugFiles(ctx, options) {
|
|
|
2585
2615
|
measure();
|
|
2586
2616
|
if (!result)
|
|
2587
2617
|
return;
|
|
2588
|
-
const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
|
|
2589
2618
|
const css = ctx.getParserCss(result);
|
|
2590
2619
|
if (!css)
|
|
2591
2620
|
return;
|
|
2592
2621
|
if (options.dry) {
|
|
2593
|
-
console.log({ path: file, ast:
|
|
2622
|
+
console.log({ path: file, ast: result, code: css });
|
|
2594
2623
|
return Promise.resolve();
|
|
2595
2624
|
}
|
|
2596
2625
|
if (outdir) {
|
|
@@ -2602,7 +2631,7 @@ async function debugFiles(ctx, options) {
|
|
|
2602
2631
|
import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2603
2632
|
import_logger5.logger.info("cli", `Writing ${import_logger5.colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2604
2633
|
return Promise.all([
|
|
2605
|
-
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(
|
|
2634
|
+
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2606
2635
|
fs.writeFile(`${outdir}/${cssPath}`, css)
|
|
2607
2636
|
]);
|
|
2608
2637
|
}
|
|
@@ -2611,15 +2640,6 @@ async function debugFiles(ctx, options) {
|
|
|
2611
2640
|
import_logger5.logger.info("cli", `Found ${import_logger5.colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2612
2641
|
measureTotal();
|
|
2613
2642
|
}
|
|
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
2643
|
|
|
2624
2644
|
// src/exec-command.ts
|
|
2625
2645
|
init_cjs_shims();
|
|
@@ -2658,7 +2678,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2658
2678
|
|
|
2659
2679
|
// src/generate.ts
|
|
2660
2680
|
async function build(ctx) {
|
|
2661
|
-
const msg = await emitAndExtract(ctx);
|
|
2681
|
+
const { msg } = await emitAndExtract(ctx);
|
|
2662
2682
|
import_logger7.logger.info("css:emit", msg);
|
|
2663
2683
|
}
|
|
2664
2684
|
async function generate(config, configPath) {
|
|
@@ -2794,7 +2814,7 @@ module.exports = {
|
|
|
2794
2814
|
init_cjs_shims();
|
|
2795
2815
|
var import_logger9 = require("@pandacss/logger");
|
|
2796
2816
|
var import_parser2 = require("@pandacss/parser");
|
|
2797
|
-
var
|
|
2817
|
+
var import_promises3 = require("fs/promises");
|
|
2798
2818
|
var path = __toESM(require("path"));
|
|
2799
2819
|
async function shipFiles(ctx, outfile) {
|
|
2800
2820
|
const files = ctx.getFiles();
|
|
@@ -2814,13 +2834,14 @@ async function shipFiles(ctx, outfile) {
|
|
|
2814
2834
|
const minify = ctx.config.minify;
|
|
2815
2835
|
import_logger9.logger.info("cli", `Writing ${minify ? "[min] " : " "}${import_logger9.colors.bold(outfile)}`);
|
|
2816
2836
|
const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
|
|
2817
|
-
await (0,
|
|
2837
|
+
await (0, import_promises3.writeFile)(outfile, output);
|
|
2818
2838
|
import_logger9.logger.info("cli", "Done!");
|
|
2819
2839
|
}
|
|
2820
2840
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2821
2841
|
0 && (module.exports = {
|
|
2822
2842
|
Builder,
|
|
2823
2843
|
analyzeTokens,
|
|
2844
|
+
bundleCss,
|
|
2824
2845
|
createContext,
|
|
2825
2846
|
debugFiles,
|
|
2826
2847
|
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,30 @@ 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
|
+
await extractFiles(ctx);
|
|
2362
|
+
const files = ctx.chunks.getFiles();
|
|
2363
|
+
await writeFile3(outfile, ctx.getCss({ files, resolve: true }));
|
|
2364
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2347
2365
|
}
|
|
2348
2366
|
|
|
2349
2367
|
// src/parse-dependency.ts
|
|
@@ -2436,7 +2454,18 @@ var Builder = class {
|
|
|
2436
2454
|
async setup(options = {}) {
|
|
2437
2455
|
logger4.debug("builder", "\u{1F6A7} Setup");
|
|
2438
2456
|
const configPath = options.configPath ?? this.getConfigPath();
|
|
2439
|
-
|
|
2457
|
+
let tsOptions = { baseUrl: void 0, pathMappings: [] };
|
|
2458
|
+
if (this.context?.tsconfig) {
|
|
2459
|
+
const options2 = this.context.tsconfig.compilerOptions;
|
|
2460
|
+
if (options2?.paths) {
|
|
2461
|
+
const baseUrl = options2.baseUrl;
|
|
2462
|
+
tsOptions = {
|
|
2463
|
+
baseUrl,
|
|
2464
|
+
pathMappings: convertTsPathsToRegexes(options2?.paths, baseUrl ?? this.context.config.cwd)
|
|
2465
|
+
};
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
const { deps: configDeps } = getConfigDependencies(configPath, tsOptions);
|
|
2440
2469
|
const deps = this.checkConfigDeps(configPath, configDeps);
|
|
2441
2470
|
if (deps.isModified) {
|
|
2442
2471
|
await this.setupContext({
|
|
@@ -2572,12 +2601,11 @@ async function debugFiles(ctx, options) {
|
|
|
2572
2601
|
measure();
|
|
2573
2602
|
if (!result)
|
|
2574
2603
|
return;
|
|
2575
|
-
const list = result.toArray().map((resultItem) => resultItem.box?.toJSON?.() ?? resultItem);
|
|
2576
2604
|
const css = ctx.getParserCss(result);
|
|
2577
2605
|
if (!css)
|
|
2578
2606
|
return;
|
|
2579
2607
|
if (options.dry) {
|
|
2580
|
-
console.log({ path: file, ast:
|
|
2608
|
+
console.log({ path: file, ast: result, code: css });
|
|
2581
2609
|
return Promise.resolve();
|
|
2582
2610
|
}
|
|
2583
2611
|
if (outdir) {
|
|
@@ -2589,7 +2617,7 @@ async function debugFiles(ctx, options) {
|
|
|
2589
2617
|
logger5.info("cli", `Writing ${colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2590
2618
|
logger5.info("cli", `Writing ${colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2591
2619
|
return Promise.all([
|
|
2592
|
-
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(
|
|
2620
|
+
fs.writeFile(`${outdir}/${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2593
2621
|
fs.writeFile(`${outdir}/${cssPath}`, css)
|
|
2594
2622
|
]);
|
|
2595
2623
|
}
|
|
@@ -2598,15 +2626,6 @@ async function debugFiles(ctx, options) {
|
|
|
2598
2626
|
logger5.info("cli", `Found ${colors.bold(`${filesWithCss.length}/${files.length}`)} files using Panda`);
|
|
2599
2627
|
measureTotal();
|
|
2600
2628
|
}
|
|
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
2629
|
|
|
2611
2630
|
// src/exec-command.ts
|
|
2612
2631
|
init_esm_shims();
|
|
@@ -2645,7 +2664,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2645
2664
|
|
|
2646
2665
|
// src/generate.ts
|
|
2647
2666
|
async function build(ctx) {
|
|
2648
|
-
const msg = await emitAndExtract(ctx);
|
|
2667
|
+
const { msg } = await emitAndExtract(ctx);
|
|
2649
2668
|
logger7.info("css:emit", msg);
|
|
2650
2669
|
}
|
|
2651
2670
|
async function generate(config, configPath) {
|
|
@@ -2714,7 +2733,7 @@ function setupGitIgnore(ctx) {
|
|
|
2714
2733
|
init_esm_shims();
|
|
2715
2734
|
import { messages } from "@pandacss/generator";
|
|
2716
2735
|
import { logger as logger8, quote } from "@pandacss/logger";
|
|
2717
|
-
import { writeFile as
|
|
2736
|
+
import { writeFile as writeFile4 } from "fs-extra";
|
|
2718
2737
|
import { lookItUpSync as lookItUpSync3 } from "look-it-up";
|
|
2719
2738
|
import { outdent as outdent2 } from "outdent";
|
|
2720
2739
|
import { join as join2 } from "path";
|
|
@@ -2761,7 +2780,7 @@ jsxFramework: '${jsxFramework}'` : ""}
|
|
|
2761
2780
|
syntax: '${syntax}'` : ""}
|
|
2762
2781
|
})
|
|
2763
2782
|
`;
|
|
2764
|
-
await
|
|
2783
|
+
await writeFile4(join2(cwd, file), content);
|
|
2765
2784
|
logger8.log(messages.thankYou());
|
|
2766
2785
|
}
|
|
2767
2786
|
}
|
|
@@ -2774,14 +2793,14 @@ module.exports = {
|
|
|
2774
2793
|
},
|
|
2775
2794
|
}
|
|
2776
2795
|
`;
|
|
2777
|
-
await
|
|
2796
|
+
await writeFile4(join2(cwd, "postcss.config.cjs"), content);
|
|
2778
2797
|
}
|
|
2779
2798
|
|
|
2780
2799
|
// src/ship-files.ts
|
|
2781
2800
|
init_esm_shims();
|
|
2782
2801
|
import { colors as colors2, logger as logger9 } from "@pandacss/logger";
|
|
2783
2802
|
import { createParserResult } from "@pandacss/parser";
|
|
2784
|
-
import { writeFile as
|
|
2803
|
+
import { writeFile as writeFile5 } from "fs/promises";
|
|
2785
2804
|
import * as path from "path";
|
|
2786
2805
|
async function shipFiles(ctx, outfile) {
|
|
2787
2806
|
const files = ctx.getFiles();
|
|
@@ -2801,12 +2820,13 @@ async function shipFiles(ctx, outfile) {
|
|
|
2801
2820
|
const minify = ctx.config.minify;
|
|
2802
2821
|
logger9.info("cli", `Writing ${minify ? "[min] " : " "}${colors2.bold(outfile)}`);
|
|
2803
2822
|
const output = JSON.stringify(extractResult.toJSON(), null, minify ? 0 : 2);
|
|
2804
|
-
await
|
|
2823
|
+
await writeFile5(outfile, output);
|
|
2805
2824
|
logger9.info("cli", "Done!");
|
|
2806
2825
|
}
|
|
2807
2826
|
export {
|
|
2808
2827
|
Builder,
|
|
2809
2828
|
analyzeTokens,
|
|
2829
|
+
bundleCss,
|
|
2810
2830
|
createContext,
|
|
2811
2831
|
debugFiles,
|
|
2812
2832
|
discardDuplicate2 as discardDuplicate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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.6.0",
|
|
38
|
+
"@pandacss/core": "0.6.0",
|
|
39
|
+
"@pandacss/error": "0.6.0",
|
|
40
|
+
"@pandacss/extractor": "0.6.0",
|
|
41
|
+
"@pandacss/generator": "0.6.0",
|
|
42
|
+
"@pandacss/is-valid-prop": "0.6.0",
|
|
43
|
+
"@pandacss/logger": "0.6.0",
|
|
44
|
+
"@pandacss/parser": "0.6.0",
|
|
45
|
+
"@pandacss/shared": "0.6.0",
|
|
46
|
+
"@pandacss/token-dictionary": "0.6.0",
|
|
47
|
+
"@pandacss/types": "0.6.0"
|
|
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.
|
|
56
|
+
"@pandacss/fixture": "0.6.0"
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|
|
58
59
|
"build": "tsup src/index.ts --format=cjs,esm --shims --dts",
|