@pandacss/node 0.0.0-dev-20231010194422 → 0.0.0-dev-20231010202758
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 +30 -3
- package/dist/index.d.ts +30 -3
- package/dist/index.js +58 -21
- package/dist/index.mjs +53 -18
- package/package.json +13 -13
package/dist/index.d.mts
CHANGED
|
@@ -226,23 +226,50 @@ declare function debugFiles(ctx: PandaContext, options: {
|
|
|
226
226
|
|
|
227
227
|
declare function execCommand(cmd: string, cwd: string): Promise<void>;
|
|
228
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Parse a file and return the corresponding css
|
|
231
|
+
*/
|
|
229
232
|
declare function extractFile(ctx: PandaContext, file: string): string | undefined;
|
|
230
233
|
declare function emitArtifacts(ctx: PandaContext): Promise<{
|
|
231
234
|
box: string;
|
|
232
235
|
msg: string;
|
|
233
236
|
}>;
|
|
234
|
-
declare function
|
|
237
|
+
declare function emitArtfifactsAndCssChunks(ctx: PandaContext): Promise<{
|
|
235
238
|
files: string[];
|
|
236
239
|
msg: string;
|
|
237
240
|
}>;
|
|
238
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Writes all the css chunks in outdir/chunks/{file}.css
|
|
243
|
+
* and bundles them in outdir/styles.css
|
|
244
|
+
*/
|
|
245
|
+
declare function writeAndBundleCssChunks(ctx: PandaContext): Promise<{
|
|
239
246
|
files: string[];
|
|
240
247
|
msg: string;
|
|
241
248
|
}>;
|
|
249
|
+
/**
|
|
250
|
+
* Bundles all the included files CSS into the given outfile
|
|
251
|
+
* Including the root CSS artifact files content (global, static, reset, tokens, keyframes)
|
|
252
|
+
* Without any imports
|
|
253
|
+
*/
|
|
242
254
|
declare function bundleCss(ctx: PandaContext, outfile: string): Promise<{
|
|
243
255
|
files: string[];
|
|
244
256
|
msg: string;
|
|
245
257
|
}>;
|
|
258
|
+
/**
|
|
259
|
+
* Bundles all the files CSS into outdir/chunks/{file}.css
|
|
260
|
+
* Without writing any chunks or needing any imports
|
|
261
|
+
*/
|
|
262
|
+
declare function bundleMinimalFilesCss(ctx: PandaContext, outfile: string): Promise<{
|
|
263
|
+
files: string[];
|
|
264
|
+
msg: string;
|
|
265
|
+
}>;
|
|
266
|
+
type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
|
|
267
|
+
/**
|
|
268
|
+
* Generates the CSS for a given artifact type
|
|
269
|
+
*/
|
|
270
|
+
declare function generateCssArtifactOfType(ctx: PandaContext, cssType: CssArtifactType, outfile: string): Promise<{
|
|
271
|
+
msg: string;
|
|
272
|
+
}>;
|
|
246
273
|
|
|
247
274
|
declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
248
275
|
|
|
@@ -258,4 +285,4 @@ declare function setupPostcss(cwd: string): Promise<void>;
|
|
|
258
285
|
|
|
259
286
|
declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
|
|
260
287
|
|
|
261
|
-
export { Builder, PandaContext, analyzeTokens, bundleCss, createContext, debugFiles,
|
|
288
|
+
export { Builder, CssArtifactType, PandaContext, analyzeTokens, bundleCss, bundleMinimalFilesCss, createContext, debugFiles, emitArtfifactsAndCssChunks, emitArtifacts, execCommand, extractFile, findConfig, generate, generateCssArtifactOfType, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON, writeAndBundleCssChunks };
|
package/dist/index.d.ts
CHANGED
|
@@ -226,23 +226,50 @@ declare function debugFiles(ctx: PandaContext, options: {
|
|
|
226
226
|
|
|
227
227
|
declare function execCommand(cmd: string, cwd: string): Promise<void>;
|
|
228
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Parse a file and return the corresponding css
|
|
231
|
+
*/
|
|
229
232
|
declare function extractFile(ctx: PandaContext, file: string): string | undefined;
|
|
230
233
|
declare function emitArtifacts(ctx: PandaContext): Promise<{
|
|
231
234
|
box: string;
|
|
232
235
|
msg: string;
|
|
233
236
|
}>;
|
|
234
|
-
declare function
|
|
237
|
+
declare function emitArtfifactsAndCssChunks(ctx: PandaContext): Promise<{
|
|
235
238
|
files: string[];
|
|
236
239
|
msg: string;
|
|
237
240
|
}>;
|
|
238
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Writes all the css chunks in outdir/chunks/{file}.css
|
|
243
|
+
* and bundles them in outdir/styles.css
|
|
244
|
+
*/
|
|
245
|
+
declare function writeAndBundleCssChunks(ctx: PandaContext): Promise<{
|
|
239
246
|
files: string[];
|
|
240
247
|
msg: string;
|
|
241
248
|
}>;
|
|
249
|
+
/**
|
|
250
|
+
* Bundles all the included files CSS into the given outfile
|
|
251
|
+
* Including the root CSS artifact files content (global, static, reset, tokens, keyframes)
|
|
252
|
+
* Without any imports
|
|
253
|
+
*/
|
|
242
254
|
declare function bundleCss(ctx: PandaContext, outfile: string): Promise<{
|
|
243
255
|
files: string[];
|
|
244
256
|
msg: string;
|
|
245
257
|
}>;
|
|
258
|
+
/**
|
|
259
|
+
* Bundles all the files CSS into outdir/chunks/{file}.css
|
|
260
|
+
* Without writing any chunks or needing any imports
|
|
261
|
+
*/
|
|
262
|
+
declare function bundleMinimalFilesCss(ctx: PandaContext, outfile: string): Promise<{
|
|
263
|
+
files: string[];
|
|
264
|
+
msg: string;
|
|
265
|
+
}>;
|
|
266
|
+
type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
|
|
267
|
+
/**
|
|
268
|
+
* Generates the CSS for a given artifact type
|
|
269
|
+
*/
|
|
270
|
+
declare function generateCssArtifactOfType(ctx: PandaContext, cssType: CssArtifactType, outfile: string): Promise<{
|
|
271
|
+
msg: string;
|
|
272
|
+
}>;
|
|
246
273
|
|
|
247
274
|
declare function generate(config: Config, configPath?: string): Promise<void>;
|
|
248
275
|
|
|
@@ -258,4 +285,4 @@ declare function setupPostcss(cwd: string): Promise<void>;
|
|
|
258
285
|
|
|
259
286
|
declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
|
|
260
287
|
|
|
261
|
-
export { Builder, PandaContext, analyzeTokens, bundleCss, createContext, debugFiles,
|
|
288
|
+
export { Builder, CssArtifactType, PandaContext, analyzeTokens, bundleCss, bundleMinimalFilesCss, createContext, debugFiles, emitArtfifactsAndCssChunks, emitArtifacts, execCommand, extractFile, findConfig, generate, generateCssArtifactOfType, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON, writeAndBundleCssChunks };
|
package/dist/index.js
CHANGED
|
@@ -406,23 +406,25 @@ __export(src_exports, {
|
|
|
406
406
|
Builder: () => Builder,
|
|
407
407
|
analyzeTokens: () => analyzeTokens,
|
|
408
408
|
bundleCss: () => bundleCss,
|
|
409
|
+
bundleMinimalFilesCss: () => bundleMinimalFilesCss,
|
|
409
410
|
createContext: () => createContext,
|
|
410
411
|
debugFiles: () => debugFiles,
|
|
411
412
|
discardDuplicate: () => import_core3.discardDuplicate,
|
|
412
|
-
|
|
413
|
+
emitArtfifactsAndCssChunks: () => emitArtfifactsAndCssChunks,
|
|
413
414
|
emitArtifacts: () => emitArtifacts,
|
|
414
415
|
execCommand: () => execCommand,
|
|
415
|
-
extractCss: () => extractCss,
|
|
416
416
|
extractFile: () => extractFile,
|
|
417
417
|
findConfig: () => findConfig,
|
|
418
418
|
generate: () => generate,
|
|
419
|
+
generateCssArtifactOfType: () => generateCssArtifactOfType,
|
|
419
420
|
loadConfigAndCreateContext: () => loadConfigAndCreateContext,
|
|
420
421
|
parseDependency: () => parseDependency,
|
|
421
422
|
setupConfig: () => setupConfig,
|
|
422
423
|
setupGitIgnore: () => setupGitIgnore,
|
|
423
424
|
setupPostcss: () => setupPostcss,
|
|
424
425
|
shipFiles: () => shipFiles,
|
|
425
|
-
writeAnalyzeJSON: () => writeAnalyzeJSON
|
|
426
|
+
writeAnalyzeJSON: () => writeAnalyzeJSON,
|
|
427
|
+
writeAndBundleCssChunks: () => writeAndBundleCssChunks
|
|
426
428
|
});
|
|
427
429
|
module.exports = __toCommonJS(src_exports);
|
|
428
430
|
init_cjs_shims();
|
|
@@ -2322,7 +2324,9 @@ var createBox = (options) => boxen(options.content, {
|
|
|
2322
2324
|
|
|
2323
2325
|
// src/extract.ts
|
|
2324
2326
|
var import_promises2 = require("fs/promises");
|
|
2325
|
-
|
|
2327
|
+
var import_parser2 = require("@pandacss/parser");
|
|
2328
|
+
var import_ts_pattern = require("ts-pattern");
|
|
2329
|
+
async function bundleStyleChunksWithImports(ctx) {
|
|
2326
2330
|
const files = ctx.chunks.getFiles();
|
|
2327
2331
|
await ctx.output.write({
|
|
2328
2332
|
dir: ctx.paths.root,
|
|
@@ -2361,7 +2365,7 @@ function extractFile(ctx, file) {
|
|
|
2361
2365
|
import_lil_fp.Obj.get("css")
|
|
2362
2366
|
);
|
|
2363
2367
|
}
|
|
2364
|
-
function
|
|
2368
|
+
function writeChunks(ctx) {
|
|
2365
2369
|
return Promise.allSettled(ctx.getFiles().map((file) => writeFileChunk(ctx, file)));
|
|
2366
2370
|
}
|
|
2367
2371
|
var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
|
|
@@ -2379,23 +2383,54 @@ async function emitArtifacts(ctx) {
|
|
|
2379
2383
|
msg: ctx.messages.artifactsGenerated()
|
|
2380
2384
|
};
|
|
2381
2385
|
}
|
|
2382
|
-
async function
|
|
2386
|
+
async function emitArtfifactsAndCssChunks(ctx) {
|
|
2383
2387
|
await emitArtifacts(ctx);
|
|
2384
2388
|
if (ctx.config.emitTokensOnly) {
|
|
2385
2389
|
return { files: [], msg: "Successfully rebuilt the css variables and js function to query your tokens \u2728" };
|
|
2386
2390
|
}
|
|
2387
|
-
return
|
|
2391
|
+
return writeAndBundleCssChunks(ctx);
|
|
2388
2392
|
}
|
|
2389
|
-
async function
|
|
2390
|
-
await
|
|
2391
|
-
return
|
|
2393
|
+
async function writeAndBundleCssChunks(ctx) {
|
|
2394
|
+
await writeChunks(ctx);
|
|
2395
|
+
return bundleStyleChunksWithImports(ctx);
|
|
2392
2396
|
}
|
|
2393
2397
|
async function bundleCss(ctx, outfile) {
|
|
2394
|
-
const extracted = await
|
|
2398
|
+
const extracted = await writeChunks(ctx);
|
|
2395
2399
|
const files = ctx.chunks.getFiles();
|
|
2396
2400
|
await (0, import_promises2.writeFile)(outfile, ctx.getCss({ files, resolve: true }));
|
|
2397
2401
|
return { files, msg: ctx.messages.buildComplete(extracted.length) };
|
|
2398
2402
|
}
|
|
2403
|
+
async function bundleMinimalFilesCss(ctx, outfile) {
|
|
2404
|
+
const files = ctx.getFiles();
|
|
2405
|
+
const filesWithCss = [];
|
|
2406
|
+
const collector = (0, import_parser2.createParserResult)();
|
|
2407
|
+
files.forEach((file) => {
|
|
2408
|
+
const measure = import_logger3.logger.time.debug(`Parsed ${file}`);
|
|
2409
|
+
const result = ctx.project.parseSourceFile(file);
|
|
2410
|
+
measure();
|
|
2411
|
+
if (!result)
|
|
2412
|
+
return;
|
|
2413
|
+
collector.merge(result);
|
|
2414
|
+
filesWithCss.push(file);
|
|
2415
|
+
});
|
|
2416
|
+
const css = ctx.getParserCss(collector);
|
|
2417
|
+
if (!css)
|
|
2418
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2419
|
+
await (0, import_promises2.writeFile)(outfile, css);
|
|
2420
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2421
|
+
}
|
|
2422
|
+
async function generateCssArtifactOfType(ctx, cssType, outfile) {
|
|
2423
|
+
let notFound = false;
|
|
2424
|
+
const css = (0, import_ts_pattern.match)(cssType).with("preflight", () => ctx.getResetCss(ctx)).with("tokens", () => ctx.getTokenCss(ctx)).with("static", () => ctx.getStaticCss(ctx)).with("global", () => ctx.getGlobalCss(ctx)).with("keyframes", () => ctx.getKeyframeCss(ctx)).otherwise(() => {
|
|
2425
|
+
notFound = true;
|
|
2426
|
+
});
|
|
2427
|
+
if (notFound)
|
|
2428
|
+
return { msg: `No css artifact of type <${cssType}> was found` };
|
|
2429
|
+
if (!css)
|
|
2430
|
+
return { msg: `No css to generate for type <${cssType}>` };
|
|
2431
|
+
await (0, import_promises2.writeFile)(outfile, css);
|
|
2432
|
+
return { msg: `Successfully generated ${cssType} css artifact \u2728` };
|
|
2433
|
+
}
|
|
2399
2434
|
|
|
2400
2435
|
// src/parse-dependency.ts
|
|
2401
2436
|
init_cjs_shims();
|
|
@@ -2681,7 +2716,7 @@ async function execCommand(cmd, cwd) {
|
|
|
2681
2716
|
// src/generate.ts
|
|
2682
2717
|
init_cjs_shims();
|
|
2683
2718
|
var import_logger7 = require("@pandacss/logger");
|
|
2684
|
-
var
|
|
2719
|
+
var import_ts_pattern2 = require("ts-pattern");
|
|
2685
2720
|
|
|
2686
2721
|
// src/load-context.ts
|
|
2687
2722
|
init_cjs_shims();
|
|
@@ -2697,7 +2732,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2697
2732
|
|
|
2698
2733
|
// src/generate.ts
|
|
2699
2734
|
async function build(ctx) {
|
|
2700
|
-
const { msg } = await
|
|
2735
|
+
const { msg } = await emitArtfifactsAndCssChunks(ctx);
|
|
2701
2736
|
import_logger7.logger.info("css:emit", msg);
|
|
2702
2737
|
}
|
|
2703
2738
|
async function generate(config, configPath) {
|
|
@@ -2720,16 +2755,16 @@ async function generate(config, configPath) {
|
|
|
2720
2755
|
const contentWatcher = fs.watch(ctx.config);
|
|
2721
2756
|
contentWatcher.on("all", async (event, file) => {
|
|
2722
2757
|
import_logger7.logger.info(`file:${event}`, file);
|
|
2723
|
-
(0,
|
|
2758
|
+
(0, import_ts_pattern2.match)(event).with("unlink", () => {
|
|
2724
2759
|
ctx.project.removeSourceFile(path2.abs(cwd, file));
|
|
2725
2760
|
ctx.chunks.rm(file);
|
|
2726
2761
|
}).with("change", async () => {
|
|
2727
2762
|
ctx.project.reloadSourceFile(file);
|
|
2728
2763
|
await writeFileChunk(ctxRef.current, file);
|
|
2729
|
-
return
|
|
2764
|
+
return bundleStyleChunksWithImports(ctxRef.current);
|
|
2730
2765
|
}).with("add", async () => {
|
|
2731
2766
|
ctx.project.createSourceFile(file);
|
|
2732
|
-
return
|
|
2767
|
+
return bundleStyleChunksWithImports(ctxRef.current);
|
|
2733
2768
|
}).otherwise(() => {
|
|
2734
2769
|
});
|
|
2735
2770
|
});
|
|
@@ -2832,12 +2867,12 @@ module.exports = {
|
|
|
2832
2867
|
// src/ship-files.ts
|
|
2833
2868
|
init_cjs_shims();
|
|
2834
2869
|
var import_logger9 = require("@pandacss/logger");
|
|
2835
|
-
var
|
|
2870
|
+
var import_parser3 = require("@pandacss/parser");
|
|
2836
2871
|
var import_promises3 = require("fs/promises");
|
|
2837
2872
|
var path = __toESM(require("path"));
|
|
2838
2873
|
async function shipFiles(ctx, outfile) {
|
|
2839
2874
|
const files = ctx.getFiles();
|
|
2840
|
-
const extractResult = (0,
|
|
2875
|
+
const extractResult = (0, import_parser3.createParserResult)();
|
|
2841
2876
|
const filesWithCss = [];
|
|
2842
2877
|
files.forEach(async (file) => {
|
|
2843
2878
|
const result = ctx.project.parseSourceFile(file);
|
|
@@ -2861,21 +2896,23 @@ async function shipFiles(ctx, outfile) {
|
|
|
2861
2896
|
Builder,
|
|
2862
2897
|
analyzeTokens,
|
|
2863
2898
|
bundleCss,
|
|
2899
|
+
bundleMinimalFilesCss,
|
|
2864
2900
|
createContext,
|
|
2865
2901
|
debugFiles,
|
|
2866
2902
|
discardDuplicate,
|
|
2867
|
-
|
|
2903
|
+
emitArtfifactsAndCssChunks,
|
|
2868
2904
|
emitArtifacts,
|
|
2869
2905
|
execCommand,
|
|
2870
|
-
extractCss,
|
|
2871
2906
|
extractFile,
|
|
2872
2907
|
findConfig,
|
|
2873
2908
|
generate,
|
|
2909
|
+
generateCssArtifactOfType,
|
|
2874
2910
|
loadConfigAndCreateContext,
|
|
2875
2911
|
parseDependency,
|
|
2876
2912
|
setupConfig,
|
|
2877
2913
|
setupGitIgnore,
|
|
2878
2914
|
setupPostcss,
|
|
2879
2915
|
shipFiles,
|
|
2880
|
-
writeAnalyzeJSON
|
|
2916
|
+
writeAnalyzeJSON,
|
|
2917
|
+
writeAndBundleCssChunks
|
|
2881
2918
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -2308,7 +2308,9 @@ var createBox = (options) => boxen(options.content, {
|
|
|
2308
2308
|
|
|
2309
2309
|
// src/extract.ts
|
|
2310
2310
|
import { writeFile as writeFile3 } from "fs/promises";
|
|
2311
|
-
|
|
2311
|
+
import { createParserResult } from "@pandacss/parser";
|
|
2312
|
+
import { match } from "ts-pattern";
|
|
2313
|
+
async function bundleStyleChunksWithImports(ctx) {
|
|
2312
2314
|
const files = ctx.chunks.getFiles();
|
|
2313
2315
|
await ctx.output.write({
|
|
2314
2316
|
dir: ctx.paths.root,
|
|
@@ -2347,7 +2349,7 @@ function extractFile(ctx, file) {
|
|
|
2347
2349
|
Obj.get("css")
|
|
2348
2350
|
);
|
|
2349
2351
|
}
|
|
2350
|
-
function
|
|
2352
|
+
function writeChunks(ctx) {
|
|
2351
2353
|
return Promise.allSettled(ctx.getFiles().map((file) => writeFileChunk(ctx, file)));
|
|
2352
2354
|
}
|
|
2353
2355
|
var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
|
|
@@ -2365,23 +2367,54 @@ async function emitArtifacts(ctx) {
|
|
|
2365
2367
|
msg: ctx.messages.artifactsGenerated()
|
|
2366
2368
|
};
|
|
2367
2369
|
}
|
|
2368
|
-
async function
|
|
2370
|
+
async function emitArtfifactsAndCssChunks(ctx) {
|
|
2369
2371
|
await emitArtifacts(ctx);
|
|
2370
2372
|
if (ctx.config.emitTokensOnly) {
|
|
2371
2373
|
return { files: [], msg: "Successfully rebuilt the css variables and js function to query your tokens \u2728" };
|
|
2372
2374
|
}
|
|
2373
|
-
return
|
|
2375
|
+
return writeAndBundleCssChunks(ctx);
|
|
2374
2376
|
}
|
|
2375
|
-
async function
|
|
2376
|
-
await
|
|
2377
|
-
return
|
|
2377
|
+
async function writeAndBundleCssChunks(ctx) {
|
|
2378
|
+
await writeChunks(ctx);
|
|
2379
|
+
return bundleStyleChunksWithImports(ctx);
|
|
2378
2380
|
}
|
|
2379
2381
|
async function bundleCss(ctx, outfile) {
|
|
2380
|
-
const extracted = await
|
|
2382
|
+
const extracted = await writeChunks(ctx);
|
|
2381
2383
|
const files = ctx.chunks.getFiles();
|
|
2382
2384
|
await writeFile3(outfile, ctx.getCss({ files, resolve: true }));
|
|
2383
2385
|
return { files, msg: ctx.messages.buildComplete(extracted.length) };
|
|
2384
2386
|
}
|
|
2387
|
+
async function bundleMinimalFilesCss(ctx, outfile) {
|
|
2388
|
+
const files = ctx.getFiles();
|
|
2389
|
+
const filesWithCss = [];
|
|
2390
|
+
const collector = createParserResult();
|
|
2391
|
+
files.forEach((file) => {
|
|
2392
|
+
const measure = logger3.time.debug(`Parsed ${file}`);
|
|
2393
|
+
const result = ctx.project.parseSourceFile(file);
|
|
2394
|
+
measure();
|
|
2395
|
+
if (!result)
|
|
2396
|
+
return;
|
|
2397
|
+
collector.merge(result);
|
|
2398
|
+
filesWithCss.push(file);
|
|
2399
|
+
});
|
|
2400
|
+
const css = ctx.getParserCss(collector);
|
|
2401
|
+
if (!css)
|
|
2402
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2403
|
+
await writeFile3(outfile, css);
|
|
2404
|
+
return { files, msg: ctx.messages.buildComplete(files.length) };
|
|
2405
|
+
}
|
|
2406
|
+
async function generateCssArtifactOfType(ctx, cssType, outfile) {
|
|
2407
|
+
let notFound = false;
|
|
2408
|
+
const css = match(cssType).with("preflight", () => ctx.getResetCss(ctx)).with("tokens", () => ctx.getTokenCss(ctx)).with("static", () => ctx.getStaticCss(ctx)).with("global", () => ctx.getGlobalCss(ctx)).with("keyframes", () => ctx.getKeyframeCss(ctx)).otherwise(() => {
|
|
2409
|
+
notFound = true;
|
|
2410
|
+
});
|
|
2411
|
+
if (notFound)
|
|
2412
|
+
return { msg: `No css artifact of type <${cssType}> was found` };
|
|
2413
|
+
if (!css)
|
|
2414
|
+
return { msg: `No css to generate for type <${cssType}>` };
|
|
2415
|
+
await writeFile3(outfile, css);
|
|
2416
|
+
return { msg: `Successfully generated ${cssType} css artifact \u2728` };
|
|
2417
|
+
}
|
|
2385
2418
|
|
|
2386
2419
|
// src/parse-dependency.ts
|
|
2387
2420
|
init_esm_shims();
|
|
@@ -2667,7 +2700,7 @@ async function execCommand(cmd, cwd) {
|
|
|
2667
2700
|
// src/generate.ts
|
|
2668
2701
|
init_esm_shims();
|
|
2669
2702
|
import { logger as logger7 } from "@pandacss/logger";
|
|
2670
|
-
import { match } from "ts-pattern";
|
|
2703
|
+
import { match as match2 } from "ts-pattern";
|
|
2671
2704
|
|
|
2672
2705
|
// src/load-context.ts
|
|
2673
2706
|
init_esm_shims();
|
|
@@ -2683,7 +2716,7 @@ var loadContext = async (config, configPath) => {
|
|
|
2683
2716
|
|
|
2684
2717
|
// src/generate.ts
|
|
2685
2718
|
async function build(ctx) {
|
|
2686
|
-
const { msg } = await
|
|
2719
|
+
const { msg } = await emitArtfifactsAndCssChunks(ctx);
|
|
2687
2720
|
logger7.info("css:emit", msg);
|
|
2688
2721
|
}
|
|
2689
2722
|
async function generate(config, configPath) {
|
|
@@ -2706,16 +2739,16 @@ async function generate(config, configPath) {
|
|
|
2706
2739
|
const contentWatcher = fs.watch(ctx.config);
|
|
2707
2740
|
contentWatcher.on("all", async (event, file) => {
|
|
2708
2741
|
logger7.info(`file:${event}`, file);
|
|
2709
|
-
|
|
2742
|
+
match2(event).with("unlink", () => {
|
|
2710
2743
|
ctx.project.removeSourceFile(path2.abs(cwd, file));
|
|
2711
2744
|
ctx.chunks.rm(file);
|
|
2712
2745
|
}).with("change", async () => {
|
|
2713
2746
|
ctx.project.reloadSourceFile(file);
|
|
2714
2747
|
await writeFileChunk(ctxRef.current, file);
|
|
2715
|
-
return
|
|
2748
|
+
return bundleStyleChunksWithImports(ctxRef.current);
|
|
2716
2749
|
}).with("add", async () => {
|
|
2717
2750
|
ctx.project.createSourceFile(file);
|
|
2718
|
-
return
|
|
2751
|
+
return bundleStyleChunksWithImports(ctxRef.current);
|
|
2719
2752
|
}).otherwise(() => {
|
|
2720
2753
|
});
|
|
2721
2754
|
});
|
|
@@ -2818,12 +2851,12 @@ module.exports = {
|
|
|
2818
2851
|
// src/ship-files.ts
|
|
2819
2852
|
init_esm_shims();
|
|
2820
2853
|
import { colors as colors2, logger as logger9 } from "@pandacss/logger";
|
|
2821
|
-
import { createParserResult } from "@pandacss/parser";
|
|
2854
|
+
import { createParserResult as createParserResult2 } from "@pandacss/parser";
|
|
2822
2855
|
import { writeFile as writeFile5 } from "fs/promises";
|
|
2823
2856
|
import * as path from "path";
|
|
2824
2857
|
async function shipFiles(ctx, outfile) {
|
|
2825
2858
|
const files = ctx.getFiles();
|
|
2826
|
-
const extractResult =
|
|
2859
|
+
const extractResult = createParserResult2();
|
|
2827
2860
|
const filesWithCss = [];
|
|
2828
2861
|
files.forEach(async (file) => {
|
|
2829
2862
|
const result = ctx.project.parseSourceFile(file);
|
|
@@ -2846,21 +2879,23 @@ export {
|
|
|
2846
2879
|
Builder,
|
|
2847
2880
|
analyzeTokens,
|
|
2848
2881
|
bundleCss,
|
|
2882
|
+
bundleMinimalFilesCss,
|
|
2849
2883
|
createContext,
|
|
2850
2884
|
debugFiles,
|
|
2851
2885
|
discardDuplicate2 as discardDuplicate,
|
|
2852
|
-
|
|
2886
|
+
emitArtfifactsAndCssChunks,
|
|
2853
2887
|
emitArtifacts,
|
|
2854
2888
|
execCommand,
|
|
2855
|
-
extractCss,
|
|
2856
2889
|
extractFile,
|
|
2857
2890
|
findConfig,
|
|
2858
2891
|
generate,
|
|
2892
|
+
generateCssArtifactOfType,
|
|
2859
2893
|
loadConfigAndCreateContext,
|
|
2860
2894
|
parseDependency,
|
|
2861
2895
|
setupConfig,
|
|
2862
2896
|
setupGitIgnore,
|
|
2863
2897
|
setupPostcss,
|
|
2864
2898
|
shipFiles,
|
|
2865
|
-
writeAnalyzeJSON
|
|
2899
|
+
writeAnalyzeJSON,
|
|
2900
|
+
writeAndBundleCssChunks
|
|
2866
2901
|
};
|
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-20231010202758",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"ts-morph": "19.0.0",
|
|
35
35
|
"ts-pattern": "5.0.5",
|
|
36
36
|
"tsconfck": "^2.1.2",
|
|
37
|
-
"@pandacss/config": "0.0.0-dev-
|
|
38
|
-
"@pandacss/core": "0.0.0-dev-
|
|
39
|
-
"@pandacss/error": "0.0.0-dev-
|
|
40
|
-
"@pandacss/extractor": "0.0.0-dev-
|
|
41
|
-
"@pandacss/generator": "0.0.0-dev-
|
|
42
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
43
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
44
|
-
"@pandacss/parser": "0.0.0-dev-
|
|
45
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
46
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
47
|
-
"@pandacss/types": "0.0.0-dev-
|
|
37
|
+
"@pandacss/config": "0.0.0-dev-20231010202758",
|
|
38
|
+
"@pandacss/core": "0.0.0-dev-20231010202758",
|
|
39
|
+
"@pandacss/error": "0.0.0-dev-20231010202758",
|
|
40
|
+
"@pandacss/extractor": "0.0.0-dev-20231010202758",
|
|
41
|
+
"@pandacss/generator": "0.0.0-dev-20231010202758",
|
|
42
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20231010202758",
|
|
43
|
+
"@pandacss/logger": "0.0.0-dev-20231010202758",
|
|
44
|
+
"@pandacss/parser": "0.0.0-dev-20231010202758",
|
|
45
|
+
"@pandacss/shared": "0.0.0-dev-20231010202758",
|
|
46
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20231010202758",
|
|
47
|
+
"@pandacss/types": "0.0.0-dev-20231010202758"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/fs-extra": "11.0.2",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/lodash.merge": "4.6.7",
|
|
54
54
|
"@types/pluralize": "0.0.30",
|
|
55
55
|
"boxen": "^7.1.1",
|
|
56
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
56
|
+
"@pandacss/fixture": "0.0.0-dev-20231010202758"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsup src/index.ts --format=cjs,esm --shims --dts",
|