@pandacss/node 0.15.5 → 0.16.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 CHANGED
@@ -1,4 +1,3 @@
1
- export { discardDuplicate } from '@pandacss/core';
2
1
  import * as _pandacss_types from '@pandacss/types';
3
2
  import { PandaHookable, Artifact, ConfigResultWithHooks, Runtime as Runtime$1, ParserResultType, Config } from '@pandacss/types';
4
3
  import { Generator } from '@pandacss/generator';
@@ -226,23 +225,50 @@ declare function debugFiles(ctx: PandaContext, options: {
226
225
 
227
226
  declare function execCommand(cmd: string, cwd: string): Promise<void>;
228
227
 
228
+ /**
229
+ * Parse a file and return the corresponding css
230
+ */
229
231
  declare function extractFile(ctx: PandaContext, file: string): string | undefined;
230
232
  declare function emitArtifacts(ctx: PandaContext): Promise<{
231
233
  box: string;
232
234
  msg: string;
233
235
  }>;
234
- declare function emitAndExtract(ctx: PandaContext): Promise<{
236
+ declare function emitArtfifactsAndCssChunks(ctx: PandaContext): Promise<{
235
237
  files: string[];
236
238
  msg: string;
237
239
  }>;
238
- declare function extractCss(ctx: PandaContext): Promise<{
240
+ /**
241
+ * Writes all the css chunks in outdir/chunks/{file}.css
242
+ * and bundles them in outdir/styles.css
243
+ */
244
+ declare function writeAndBundleCssChunks(ctx: PandaContext): Promise<{
239
245
  files: string[];
240
246
  msg: string;
241
247
  }>;
248
+ /**
249
+ * Bundles all the included files CSS into the given outfile
250
+ * Including the root CSS artifact files content (global, static, reset, tokens, keyframes)
251
+ * Without any imports
252
+ */
242
253
  declare function bundleCss(ctx: PandaContext, outfile: string): Promise<{
243
254
  files: string[];
244
255
  msg: string;
245
256
  }>;
257
+ /**
258
+ * Bundles all the files CSS into outdir/chunks/{file}.css
259
+ * Without writing any chunks or needing any imports
260
+ */
261
+ declare function bundleMinimalFilesCss(ctx: PandaContext, outfile: string): Promise<{
262
+ files: string[];
263
+ msg: string;
264
+ }>;
265
+ type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
266
+ /**
267
+ * Generates the CSS for a given artifact type
268
+ */
269
+ declare function generateCssArtifactOfType(ctx: PandaContext, cssType: CssArtifactType, outfile: string): Promise<{
270
+ msg: string;
271
+ }>;
246
272
 
247
273
  declare function generate(config: Config, configPath?: string): Promise<void>;
248
274
 
@@ -258,4 +284,4 @@ declare function setupPostcss(cwd: string): Promise<void>;
258
284
 
259
285
  declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
260
286
 
261
- export { Builder, PandaContext, analyzeTokens, bundleCss, createContext, debugFiles, emitAndExtract, emitArtifacts, execCommand, extractCss, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
287
+ 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
@@ -1,4 +1,3 @@
1
- export { discardDuplicate } from '@pandacss/core';
2
1
  import * as _pandacss_types from '@pandacss/types';
3
2
  import { PandaHookable, Artifact, ConfigResultWithHooks, Runtime as Runtime$1, ParserResultType, Config } from '@pandacss/types';
4
3
  import { Generator } from '@pandacss/generator';
@@ -226,23 +225,50 @@ declare function debugFiles(ctx: PandaContext, options: {
226
225
 
227
226
  declare function execCommand(cmd: string, cwd: string): Promise<void>;
228
227
 
228
+ /**
229
+ * Parse a file and return the corresponding css
230
+ */
229
231
  declare function extractFile(ctx: PandaContext, file: string): string | undefined;
230
232
  declare function emitArtifacts(ctx: PandaContext): Promise<{
231
233
  box: string;
232
234
  msg: string;
233
235
  }>;
234
- declare function emitAndExtract(ctx: PandaContext): Promise<{
236
+ declare function emitArtfifactsAndCssChunks(ctx: PandaContext): Promise<{
235
237
  files: string[];
236
238
  msg: string;
237
239
  }>;
238
- declare function extractCss(ctx: PandaContext): Promise<{
240
+ /**
241
+ * Writes all the css chunks in outdir/chunks/{file}.css
242
+ * and bundles them in outdir/styles.css
243
+ */
244
+ declare function writeAndBundleCssChunks(ctx: PandaContext): Promise<{
239
245
  files: string[];
240
246
  msg: string;
241
247
  }>;
248
+ /**
249
+ * Bundles all the included files CSS into the given outfile
250
+ * Including the root CSS artifact files content (global, static, reset, tokens, keyframes)
251
+ * Without any imports
252
+ */
242
253
  declare function bundleCss(ctx: PandaContext, outfile: string): Promise<{
243
254
  files: string[];
244
255
  msg: string;
245
256
  }>;
257
+ /**
258
+ * Bundles all the files CSS into outdir/chunks/{file}.css
259
+ * Without writing any chunks or needing any imports
260
+ */
261
+ declare function bundleMinimalFilesCss(ctx: PandaContext, outfile: string): Promise<{
262
+ files: string[];
263
+ msg: string;
264
+ }>;
265
+ type CssArtifactType = 'preflight' | 'tokens' | 'static' | 'global' | 'keyframes';
266
+ /**
267
+ * Generates the CSS for a given artifact type
268
+ */
269
+ declare function generateCssArtifactOfType(ctx: PandaContext, cssType: CssArtifactType, outfile: string): Promise<{
270
+ msg: string;
271
+ }>;
246
272
 
247
273
  declare function generate(config: Config, configPath?: string): Promise<void>;
248
274
 
@@ -258,4 +284,4 @@ declare function setupPostcss(cwd: string): Promise<void>;
258
284
 
259
285
  declare function shipFiles(ctx: PandaContext, outfile: string): Promise<void>;
260
286
 
261
- export { Builder, PandaContext, analyzeTokens, bundleCss, createContext, debugFiles, emitAndExtract, emitArtifacts, execCommand, extractCss, extractFile, findConfig, generate, loadConfigAndCreateContext, parseDependency, setupConfig, setupGitIgnore, setupPostcss, shipFiles, writeAnalyzeJSON };
287
+ 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,27 +406,27 @@ __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
- discardDuplicate: () => import_core3.discardDuplicate,
412
- emitAndExtract: () => emitAndExtract,
412
+ emitArtfifactsAndCssChunks: () => emitArtfifactsAndCssChunks,
413
413
  emitArtifacts: () => emitArtifacts,
414
414
  execCommand: () => execCommand,
415
- extractCss: () => extractCss,
416
415
  extractFile: () => extractFile,
417
416
  findConfig: () => findConfig,
418
417
  generate: () => generate,
418
+ generateCssArtifactOfType: () => generateCssArtifactOfType,
419
419
  loadConfigAndCreateContext: () => loadConfigAndCreateContext,
420
420
  parseDependency: () => parseDependency,
421
421
  setupConfig: () => setupConfig,
422
422
  setupGitIgnore: () => setupGitIgnore,
423
423
  setupPostcss: () => setupPostcss,
424
424
  shipFiles: () => shipFiles,
425
- writeAnalyzeJSON: () => writeAnalyzeJSON
425
+ writeAnalyzeJSON: () => writeAnalyzeJSON,
426
+ writeAndBundleCssChunks: () => writeAndBundleCssChunks
426
427
  });
427
428
  module.exports = __toCommonJS(src_exports);
428
429
  init_cjs_shims();
429
- var import_core3 = require("@pandacss/core");
430
430
 
431
431
  // src/analyze-tokens.ts
432
432
  init_cjs_shims();
@@ -780,7 +780,7 @@ var writeAnalyzeJSON = (fileName, result, ctx) => {
780
780
  // src/builder.ts
781
781
  init_cjs_shims();
782
782
  var import_config2 = require("@pandacss/config");
783
- var import_core2 = require("@pandacss/core");
783
+ var import_core3 = require("@pandacss/core");
784
784
  var import_error = require("@pandacss/error");
785
785
  var import_logger4 = require("@pandacss/logger");
786
786
  var import_fs = require("fs");
@@ -2322,7 +2322,10 @@ var createBox = (options) => boxen(options.content, {
2322
2322
 
2323
2323
  // src/extract.ts
2324
2324
  var import_promises2 = require("fs/promises");
2325
- async function bundleChunks(ctx) {
2325
+ var import_parser2 = require("@pandacss/parser");
2326
+ var import_ts_pattern = require("ts-pattern");
2327
+ var import_core2 = require("@pandacss/core");
2328
+ async function bundleStyleChunksWithImports(ctx) {
2326
2329
  const files = ctx.chunks.getFiles();
2327
2330
  await ctx.output.write({
2328
2331
  dir: ctx.paths.root,
@@ -2361,7 +2364,7 @@ function extractFile(ctx, file) {
2361
2364
  import_lil_fp.Obj.get("css")
2362
2365
  );
2363
2366
  }
2364
- function extractFiles(ctx) {
2367
+ function writeChunks(ctx) {
2365
2368
  return Promise.allSettled(ctx.getFiles().map((file) => writeFileChunk(ctx, file)));
2366
2369
  }
2367
2370
  var randomWords = ["Sweet", "Divine", "Pandalicious", "Super"];
@@ -2379,23 +2382,57 @@ async function emitArtifacts(ctx) {
2379
2382
  msg: ctx.messages.artifactsGenerated()
2380
2383
  };
2381
2384
  }
2382
- async function emitAndExtract(ctx) {
2385
+ async function emitArtfifactsAndCssChunks(ctx) {
2383
2386
  await emitArtifacts(ctx);
2384
2387
  if (ctx.config.emitTokensOnly) {
2385
2388
  return { files: [], msg: "Successfully rebuilt the css variables and js function to query your tokens \u2728" };
2386
2389
  }
2387
- return extractCss(ctx);
2390
+ return writeAndBundleCssChunks(ctx);
2388
2391
  }
2389
- async function extractCss(ctx) {
2390
- await extractFiles(ctx);
2391
- return bundleChunks(ctx);
2392
+ async function writeAndBundleCssChunks(ctx) {
2393
+ await writeChunks(ctx);
2394
+ return bundleStyleChunksWithImports(ctx);
2392
2395
  }
2393
2396
  async function bundleCss(ctx, outfile) {
2394
- const extracted = await extractFiles(ctx);
2397
+ const extracted = await writeChunks(ctx);
2395
2398
  const files = ctx.chunks.getFiles();
2396
- await (0, import_promises2.writeFile)(outfile, ctx.getCss({ files, resolve: true }));
2399
+ const minify = ctx.config.minify;
2400
+ await (0, import_promises2.writeFile)(outfile, (0, import_core2.optimizeCss)(ctx.getCss({ files, resolve: true }), { minify }));
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
+ const minify = ctx.config.minify;
2420
+ await (0, import_promises2.writeFile)(outfile, (0, import_core2.optimizeCss)(css, { minify }));
2421
+ return { files, msg: ctx.messages.buildComplete(files.length) };
2422
+ }
2423
+ async function generateCssArtifactOfType(ctx, cssType, outfile) {
2424
+ let notFound = false;
2425
+ 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(() => {
2426
+ notFound = true;
2427
+ });
2428
+ if (notFound)
2429
+ return { msg: `No css artifact of type <${cssType}> was found` };
2430
+ if (!css)
2431
+ return { msg: `No css to generate for type <${cssType}>` };
2432
+ const minify = ctx.config.minify;
2433
+ await (0, import_promises2.writeFile)(outfile, (0, import_core2.optimizeCss)(css, { minify }));
2434
+ return { msg: `Successfully generated ${cssType} css artifact \u2728` };
2435
+ }
2399
2436
 
2400
2437
  // src/parse-dependency.ts
2401
2438
  init_cjs_shims();
@@ -2453,7 +2490,7 @@ var Builder = class {
2453
2490
  configDependencies = /* @__PURE__ */ new Set();
2454
2491
  writeFileCss = (file, css) => {
2455
2492
  const oldCss = this.fileCssMap?.get(file) ?? "";
2456
- const newCss = (0, import_core2.mergeCss)(oldCss, css);
2493
+ const newCss = (0, import_core3.mergeCss)(oldCss, css);
2457
2494
  this.fileCssMap?.set(file, newCss);
2458
2495
  };
2459
2496
  checkConfigDeps = (configPath, deps) => {
@@ -2587,7 +2624,7 @@ var Builder = class {
2587
2624
  const rootCssContent = root.toString();
2588
2625
  root.removeAll();
2589
2626
  root.append(
2590
- (0, import_core2.discardDuplicate)(`
2627
+ (0, import_core3.optimizeCss)(`
2591
2628
  ${rootCssContent}
2592
2629
  ${this.toString()}
2593
2630
  `)
@@ -2681,7 +2718,7 @@ async function execCommand(cmd, cwd) {
2681
2718
  // src/generate.ts
2682
2719
  init_cjs_shims();
2683
2720
  var import_logger7 = require("@pandacss/logger");
2684
- var import_ts_pattern = require("ts-pattern");
2721
+ var import_ts_pattern2 = require("ts-pattern");
2685
2722
 
2686
2723
  // src/load-context.ts
2687
2724
  init_cjs_shims();
@@ -2697,7 +2734,7 @@ var loadContext = async (config, configPath) => {
2697
2734
 
2698
2735
  // src/generate.ts
2699
2736
  async function build(ctx) {
2700
- const { msg } = await emitAndExtract(ctx);
2737
+ const { msg } = await emitArtfifactsAndCssChunks(ctx);
2701
2738
  import_logger7.logger.info("css:emit", msg);
2702
2739
  }
2703
2740
  async function generate(config, configPath) {
@@ -2720,16 +2757,16 @@ async function generate(config, configPath) {
2720
2757
  const contentWatcher = fs.watch(ctx.config);
2721
2758
  contentWatcher.on("all", async (event, file) => {
2722
2759
  import_logger7.logger.info(`file:${event}`, file);
2723
- (0, import_ts_pattern.match)(event).with("unlink", () => {
2760
+ (0, import_ts_pattern2.match)(event).with("unlink", () => {
2724
2761
  ctx.project.removeSourceFile(path2.abs(cwd, file));
2725
2762
  ctx.chunks.rm(file);
2726
2763
  }).with("change", async () => {
2727
2764
  ctx.project.reloadSourceFile(file);
2728
2765
  await writeFileChunk(ctxRef.current, file);
2729
- return bundleChunks(ctxRef.current);
2766
+ return bundleStyleChunksWithImports(ctxRef.current);
2730
2767
  }).with("add", async () => {
2731
2768
  ctx.project.createSourceFile(file);
2732
- return bundleChunks(ctxRef.current);
2769
+ return bundleStyleChunksWithImports(ctxRef.current);
2733
2770
  }).otherwise(() => {
2734
2771
  });
2735
2772
  });
@@ -2832,12 +2869,12 @@ module.exports = {
2832
2869
  // src/ship-files.ts
2833
2870
  init_cjs_shims();
2834
2871
  var import_logger9 = require("@pandacss/logger");
2835
- var import_parser2 = require("@pandacss/parser");
2872
+ var import_parser3 = require("@pandacss/parser");
2836
2873
  var import_promises3 = require("fs/promises");
2837
2874
  var path = __toESM(require("path"));
2838
2875
  async function shipFiles(ctx, outfile) {
2839
2876
  const files = ctx.getFiles();
2840
- const extractResult = (0, import_parser2.createParserResult)();
2877
+ const extractResult = (0, import_parser3.createParserResult)();
2841
2878
  const filesWithCss = [];
2842
2879
  files.forEach(async (file) => {
2843
2880
  const result = ctx.project.parseSourceFile(file);
@@ -2861,21 +2898,22 @@ async function shipFiles(ctx, outfile) {
2861
2898
  Builder,
2862
2899
  analyzeTokens,
2863
2900
  bundleCss,
2901
+ bundleMinimalFilesCss,
2864
2902
  createContext,
2865
2903
  debugFiles,
2866
- discardDuplicate,
2867
- emitAndExtract,
2904
+ emitArtfifactsAndCssChunks,
2868
2905
  emitArtifacts,
2869
2906
  execCommand,
2870
- extractCss,
2871
2907
  extractFile,
2872
2908
  findConfig,
2873
2909
  generate,
2910
+ generateCssArtifactOfType,
2874
2911
  loadConfigAndCreateContext,
2875
2912
  parseDependency,
2876
2913
  setupConfig,
2877
2914
  setupGitIgnore,
2878
2915
  setupPostcss,
2879
2916
  shipFiles,
2880
- writeAnalyzeJSON
2917
+ writeAnalyzeJSON,
2918
+ writeAndBundleCssChunks
2881
2919
  });
package/dist/index.mjs CHANGED
@@ -403,7 +403,6 @@ var require_ansi_align = __commonJS({
403
403
 
404
404
  // src/index.ts
405
405
  init_esm_shims();
406
- import { discardDuplicate as discardDuplicate2 } from "@pandacss/core";
407
406
 
408
407
  // src/analyze-tokens.ts
409
408
  init_esm_shims();
@@ -757,7 +756,7 @@ var writeAnalyzeJSON = (fileName, result, ctx) => {
757
756
  // src/builder.ts
758
757
  init_esm_shims();
759
758
  import { getConfigDependencies } from "@pandacss/config";
760
- import { discardDuplicate, mergeCss as mergeCss2 } from "@pandacss/core";
759
+ import { optimizeCss as optimizeCss2, mergeCss as mergeCss2 } from "@pandacss/core";
761
760
  import { ConfigNotFoundError } from "@pandacss/error";
762
761
  import { logger as logger4 } from "@pandacss/logger";
763
762
  import { existsSync as existsSync2 } from "fs";
@@ -2308,7 +2307,10 @@ var createBox = (options) => boxen(options.content, {
2308
2307
 
2309
2308
  // src/extract.ts
2310
2309
  import { writeFile as writeFile3 } from "fs/promises";
2311
- async function bundleChunks(ctx) {
2310
+ import { createParserResult } from "@pandacss/parser";
2311
+ import { match } from "ts-pattern";
2312
+ import { optimizeCss } from "@pandacss/core";
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 extractFiles(ctx) {
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,57 @@ async function emitArtifacts(ctx) {
2365
2367
  msg: ctx.messages.artifactsGenerated()
2366
2368
  };
2367
2369
  }
2368
- async function emitAndExtract(ctx) {
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 extractCss(ctx);
2375
+ return writeAndBundleCssChunks(ctx);
2374
2376
  }
2375
- async function extractCss(ctx) {
2376
- await extractFiles(ctx);
2377
- return bundleChunks(ctx);
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 extractFiles(ctx);
2382
+ const extracted = await writeChunks(ctx);
2381
2383
  const files = ctx.chunks.getFiles();
2382
- await writeFile3(outfile, ctx.getCss({ files, resolve: true }));
2384
+ const minify = ctx.config.minify;
2385
+ await writeFile3(outfile, optimizeCss(ctx.getCss({ files, resolve: true }), { minify }));
2383
2386
  return { files, msg: ctx.messages.buildComplete(extracted.length) };
2384
2387
  }
2388
+ async function bundleMinimalFilesCss(ctx, outfile) {
2389
+ const files = ctx.getFiles();
2390
+ const filesWithCss = [];
2391
+ const collector = createParserResult();
2392
+ files.forEach((file) => {
2393
+ const measure = logger3.time.debug(`Parsed ${file}`);
2394
+ const result = ctx.project.parseSourceFile(file);
2395
+ measure();
2396
+ if (!result)
2397
+ return;
2398
+ collector.merge(result);
2399
+ filesWithCss.push(file);
2400
+ });
2401
+ const css = ctx.getParserCss(collector);
2402
+ if (!css)
2403
+ return { files, msg: ctx.messages.buildComplete(files.length) };
2404
+ const minify = ctx.config.minify;
2405
+ await writeFile3(outfile, optimizeCss(css, { minify }));
2406
+ return { files, msg: ctx.messages.buildComplete(files.length) };
2407
+ }
2408
+ async function generateCssArtifactOfType(ctx, cssType, outfile) {
2409
+ let notFound = false;
2410
+ 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(() => {
2411
+ notFound = true;
2412
+ });
2413
+ if (notFound)
2414
+ return { msg: `No css artifact of type <${cssType}> was found` };
2415
+ if (!css)
2416
+ return { msg: `No css to generate for type <${cssType}>` };
2417
+ const minify = ctx.config.minify;
2418
+ await writeFile3(outfile, optimizeCss(css, { minify }));
2419
+ return { msg: `Successfully generated ${cssType} css artifact \u2728` };
2420
+ }
2385
2421
 
2386
2422
  // src/parse-dependency.ts
2387
2423
  init_esm_shims();
@@ -2573,7 +2609,7 @@ var Builder = class {
2573
2609
  const rootCssContent = root.toString();
2574
2610
  root.removeAll();
2575
2611
  root.append(
2576
- discardDuplicate(`
2612
+ optimizeCss2(`
2577
2613
  ${rootCssContent}
2578
2614
  ${this.toString()}
2579
2615
  `)
@@ -2667,7 +2703,7 @@ async function execCommand(cmd, cwd) {
2667
2703
  // src/generate.ts
2668
2704
  init_esm_shims();
2669
2705
  import { logger as logger7 } from "@pandacss/logger";
2670
- import { match } from "ts-pattern";
2706
+ import { match as match2 } from "ts-pattern";
2671
2707
 
2672
2708
  // src/load-context.ts
2673
2709
  init_esm_shims();
@@ -2683,7 +2719,7 @@ var loadContext = async (config, configPath) => {
2683
2719
 
2684
2720
  // src/generate.ts
2685
2721
  async function build(ctx) {
2686
- const { msg } = await emitAndExtract(ctx);
2722
+ const { msg } = await emitArtfifactsAndCssChunks(ctx);
2687
2723
  logger7.info("css:emit", msg);
2688
2724
  }
2689
2725
  async function generate(config, configPath) {
@@ -2706,16 +2742,16 @@ async function generate(config, configPath) {
2706
2742
  const contentWatcher = fs.watch(ctx.config);
2707
2743
  contentWatcher.on("all", async (event, file) => {
2708
2744
  logger7.info(`file:${event}`, file);
2709
- match(event).with("unlink", () => {
2745
+ match2(event).with("unlink", () => {
2710
2746
  ctx.project.removeSourceFile(path2.abs(cwd, file));
2711
2747
  ctx.chunks.rm(file);
2712
2748
  }).with("change", async () => {
2713
2749
  ctx.project.reloadSourceFile(file);
2714
2750
  await writeFileChunk(ctxRef.current, file);
2715
- return bundleChunks(ctxRef.current);
2751
+ return bundleStyleChunksWithImports(ctxRef.current);
2716
2752
  }).with("add", async () => {
2717
2753
  ctx.project.createSourceFile(file);
2718
- return bundleChunks(ctxRef.current);
2754
+ return bundleStyleChunksWithImports(ctxRef.current);
2719
2755
  }).otherwise(() => {
2720
2756
  });
2721
2757
  });
@@ -2818,12 +2854,12 @@ module.exports = {
2818
2854
  // src/ship-files.ts
2819
2855
  init_esm_shims();
2820
2856
  import { colors as colors2, logger as logger9 } from "@pandacss/logger";
2821
- import { createParserResult } from "@pandacss/parser";
2857
+ import { createParserResult as createParserResult2 } from "@pandacss/parser";
2822
2858
  import { writeFile as writeFile5 } from "fs/promises";
2823
2859
  import * as path from "path";
2824
2860
  async function shipFiles(ctx, outfile) {
2825
2861
  const files = ctx.getFiles();
2826
- const extractResult = createParserResult();
2862
+ const extractResult = createParserResult2();
2827
2863
  const filesWithCss = [];
2828
2864
  files.forEach(async (file) => {
2829
2865
  const result = ctx.project.parseSourceFile(file);
@@ -2846,21 +2882,22 @@ export {
2846
2882
  Builder,
2847
2883
  analyzeTokens,
2848
2884
  bundleCss,
2885
+ bundleMinimalFilesCss,
2849
2886
  createContext,
2850
2887
  debugFiles,
2851
- discardDuplicate2 as discardDuplicate,
2852
- emitAndExtract,
2888
+ emitArtfifactsAndCssChunks,
2853
2889
  emitArtifacts,
2854
2890
  execCommand,
2855
- extractCss,
2856
2891
  extractFile,
2857
2892
  findConfig,
2858
2893
  generate,
2894
+ generateCssArtifactOfType,
2859
2895
  loadConfigAndCreateContext,
2860
2896
  parseDependency,
2861
2897
  setupConfig,
2862
2898
  setupGitIgnore,
2863
2899
  setupPostcss,
2864
2900
  shipFiles,
2865
- writeAnalyzeJSON
2901
+ writeAnalyzeJSON,
2902
+ writeAndBundleCssChunks
2866
2903
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.15.5",
3
+ "version": "0.16.0",
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.15.5",
38
- "@pandacss/core": "0.15.5",
39
- "@pandacss/error": "0.15.5",
40
- "@pandacss/extractor": "0.15.5",
41
- "@pandacss/generator": "0.15.5",
42
- "@pandacss/is-valid-prop": "0.15.5",
43
- "@pandacss/logger": "0.15.5",
44
- "@pandacss/parser": "0.15.5",
45
- "@pandacss/shared": "0.15.5",
46
- "@pandacss/token-dictionary": "0.15.5",
47
- "@pandacss/types": "0.15.5"
37
+ "@pandacss/config": "0.16.0",
38
+ "@pandacss/core": "0.16.0",
39
+ "@pandacss/error": "0.16.0",
40
+ "@pandacss/extractor": "0.16.0",
41
+ "@pandacss/generator": "0.16.0",
42
+ "@pandacss/is-valid-prop": "0.16.0",
43
+ "@pandacss/logger": "0.16.0",
44
+ "@pandacss/parser": "0.16.0",
45
+ "@pandacss/shared": "0.16.0",
46
+ "@pandacss/token-dictionary": "0.16.0",
47
+ "@pandacss/types": "0.16.0"
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.15.5"
56
+ "@pandacss/fixture": "0.16.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",