@pandacss/node 0.26.2 → 0.27.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.
Files changed (3) hide show
  1. package/dist/index.js +27 -22
  2. package/dist/index.mjs +28 -23
  3. package/package.json +12 -11
package/dist/index.js CHANGED
@@ -791,6 +791,7 @@ var import_core = require("@pandacss/core");
791
791
  var import_error = require("@pandacss/error");
792
792
  var import_logger6 = require("@pandacss/logger");
793
793
  var import_fs = require("fs");
794
+ var import_pathe3 = require("pathe");
794
795
 
795
796
  // src/codegen.ts
796
797
  init_cjs_shims();
@@ -2238,6 +2239,7 @@ init_cjs_shims();
2238
2239
  var import_config2 = require("@pandacss/config");
2239
2240
  var import_hookable = require("hookable");
2240
2241
  var import_tsconfck = require("tsconfck");
2242
+ var import_browserslist = __toESM(require("browserslist"));
2241
2243
 
2242
2244
  // src/create-context.ts
2243
2245
  init_cjs_shims();
@@ -2459,6 +2461,7 @@ var PandaContext = class extends import_generator2.Generator {
2459
2461
  };
2460
2462
  };
2461
2463
  writeCss = (sheet) => {
2464
+ import_logger5.logger.info("css", this.runtime.path.join(...this.paths.root, "styles.css"));
2462
2465
  return this.output.write({
2463
2466
  id: "styles.css",
2464
2467
  dir: this.paths.root,
@@ -2512,6 +2515,9 @@ async function loadConfigAndCreateContext(options = {}) {
2512
2515
  if (options.cwd) {
2513
2516
  conf.config.cwd = options.cwd;
2514
2517
  }
2518
+ if (conf.config.lightningcss && !conf.config.browserslist) {
2519
+ conf.config.browserslist ||= import_browserslist.default.findConfig(cwd)?.defaults;
2520
+ }
2515
2521
  const tsconfigResult = await (0, import_tsconfck.parse)(conf.path, {
2516
2522
  root: cwd,
2517
2523
  // @ts-ignore
@@ -2574,18 +2580,17 @@ function parseDependency(fileOrGlob) {
2574
2580
  let message = null;
2575
2581
  if ((0, import_is_glob.default)(fileOrGlob)) {
2576
2582
  const { base, glob: glob2 } = parseGlob(fileOrGlob);
2577
- message = { type: "dir-dependency", dir: (0, import_pathe2.resolve)(base), glob: glob2 };
2583
+ message = { type: "dir-dependency", dir: (0, import_pathe2.normalize)((0, import_pathe2.resolve)(base)), glob: glob2 };
2578
2584
  } else {
2579
- message = { type: "dependency", file: (0, import_pathe2.resolve)(fileOrGlob) };
2585
+ message = { type: "dependency", file: (0, import_pathe2.normalize)((0, import_pathe2.resolve)(fileOrGlob)) };
2580
2586
  }
2581
2587
  if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
2582
- message = { type: "dependency", file: (0, import_pathe2.resolve)(message.dir) };
2588
+ message = { type: "dependency", file: (0, import_pathe2.normalize)((0, import_pathe2.resolve)(message.dir)) };
2583
2589
  }
2584
2590
  return message;
2585
2591
  }
2586
2592
 
2587
2593
  // src/builder.ts
2588
- var import_pathe3 = require("pathe");
2589
2594
  var fileModifiedMap = /* @__PURE__ */ new Map();
2590
2595
  var Builder = class {
2591
2596
  /**
@@ -2710,20 +2715,24 @@ var Builder = class {
2710
2715
  const ctx = this.getContextOrThrow();
2711
2716
  const sheet = ctx.createSheet();
2712
2717
  ctx.appendBaselineCss(sheet);
2713
- ctx.appendParserCss(sheet);
2714
2718
  const css = ctx.getCss(sheet);
2715
- root.append((0, import_core.optimizeCss)(css));
2719
+ root.append(
2720
+ (0, import_core.optimizeCss)(css, {
2721
+ browserslist: ctx.config.browserslist,
2722
+ minify: ctx.config.minify,
2723
+ lightningcss: ctx.config.lightningcss
2724
+ })
2725
+ );
2716
2726
  };
2717
2727
  registerDependency = (fn) => {
2718
2728
  const ctx = this.getContextOrThrow();
2719
2729
  for (const fileOrGlob of ctx.config.include) {
2720
2730
  const dependency = parseDependency(fileOrGlob);
2721
- if (dependency) {
2731
+ if (dependency)
2722
2732
  fn(dependency);
2723
- }
2724
2733
  }
2725
2734
  for (const file of this.configDependencies) {
2726
- fn({ type: "dependency", file: ctx.runtime.path.resolve(file) });
2735
+ fn({ type: "dependency", file: (0, import_pathe3.normalize)((0, import_pathe3.resolve)(file)) });
2727
2736
  }
2728
2737
  };
2729
2738
  };
@@ -2732,38 +2741,33 @@ var Builder = class {
2732
2741
  init_cjs_shims();
2733
2742
  var import_logger7 = require("@pandacss/logger");
2734
2743
  var cssgen = async (ctx, options) => {
2735
- const { cwd, outfile, type, minimal } = options;
2736
- let outPath = ctx.runtime.path.join(...ctx.paths.getFilePath("styles.css"));
2744
+ const { outfile, type, minimal } = options;
2737
2745
  const sheet = ctx.createSheet();
2738
2746
  if (type) {
2747
+ const done = import_logger7.logger.time.info(ctx.messages.cssArtifactComplete(type));
2739
2748
  ctx.appendCssOfType(type, sheet);
2740
2749
  if (outfile) {
2741
- outPath = ctx.output.ensure(outfile, cwd);
2742
2750
  const css = ctx.getCss(sheet);
2743
2751
  ctx.runtime.fs.writeFileSync(outfile, css);
2744
2752
  } else {
2745
2753
  await ctx.writeCss(sheet);
2746
2754
  }
2747
- const msg = ctx.messages.cssArtifactComplete(type);
2748
- import_logger7.logger.info("css:emit:path", outPath);
2749
- import_logger7.logger.info("css:emit:artifact", msg);
2755
+ done();
2750
2756
  } else {
2757
+ const { files } = ctx.parseFiles();
2758
+ const done = import_logger7.logger.time.info(ctx.messages.buildComplete(files.length));
2751
2759
  if (!minimal) {
2752
2760
  ctx.appendLayerParams(sheet);
2753
2761
  ctx.appendBaselineCss(sheet);
2754
2762
  }
2755
- const { files } = ctx.parseFiles();
2756
2763
  ctx.appendParserCss(sheet);
2757
2764
  if (outfile) {
2758
- outPath = ctx.output.ensure(outfile, cwd);
2759
2765
  const css = ctx.getCss(sheet);
2760
2766
  ctx.runtime.fs.writeFileSync(outfile, css);
2761
2767
  } else {
2762
2768
  await ctx.writeCss(sheet);
2763
2769
  }
2764
- const msg = ctx.messages.buildComplete(files.length);
2765
- import_logger7.logger.info("css:emit:path", outPath);
2766
- import_logger7.logger.info("css:emit:out", msg);
2770
+ done();
2767
2771
  }
2768
2772
  };
2769
2773
 
@@ -2830,13 +2834,14 @@ async function build(ctx, artifactIds) {
2830
2834
  if (ctx.config.emitTokensOnly) {
2831
2835
  return import_logger9.logger.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens \u2728");
2832
2836
  }
2837
+ const done = import_logger9.logger.time.info("");
2833
2838
  const sheet = ctx.createSheet();
2834
2839
  ctx.appendLayerParams(sheet);
2835
2840
  ctx.appendBaselineCss(sheet);
2836
- ctx.parseFiles();
2841
+ const parsed = ctx.parseFiles();
2837
2842
  ctx.appendParserCss(sheet);
2838
2843
  await ctx.writeCss(sheet);
2839
- import_logger9.logger.info("css:emit", "Successfully built the css files \u2728");
2844
+ done(ctx.messages.buildComplete(parsed.files.length));
2840
2845
  }
2841
2846
  async function generate(config, configPath) {
2842
2847
  let ctx = await loadConfigAndCreateContext({ config, configPath });
package/dist/index.mjs CHANGED
@@ -767,6 +767,7 @@ import { optimizeCss } from "@pandacss/core";
767
767
  import { ConfigNotFoundError } from "@pandacss/error";
768
768
  import { logger as logger6 } from "@pandacss/logger";
769
769
  import { existsSync, statSync } from "fs";
770
+ import { normalize as normalize2, resolve as resolve3 } from "pathe";
770
771
 
771
772
  // src/codegen.ts
772
773
  init_esm_shims();
@@ -2214,6 +2215,7 @@ init_esm_shims();
2214
2215
  import { convertTsPathsToRegexes, loadConfig as loadConfig2 } from "@pandacss/config";
2215
2216
  import { createDebugger, createHooks } from "hookable";
2216
2217
  import { parse } from "tsconfck";
2218
+ import browserslist from "browserslist";
2217
2219
 
2218
2220
  // src/create-context.ts
2219
2221
  init_esm_shims();
@@ -2435,6 +2437,7 @@ var PandaContext = class extends Generator2 {
2435
2437
  };
2436
2438
  };
2437
2439
  writeCss = (sheet) => {
2440
+ logger5.info("css", this.runtime.path.join(...this.paths.root, "styles.css"));
2438
2441
  return this.output.write({
2439
2442
  id: "styles.css",
2440
2443
  dir: this.paths.root,
@@ -2488,6 +2491,9 @@ async function loadConfigAndCreateContext(options = {}) {
2488
2491
  if (options.cwd) {
2489
2492
  conf.config.cwd = options.cwd;
2490
2493
  }
2494
+ if (conf.config.lightningcss && !conf.config.browserslist) {
2495
+ conf.config.browserslist ||= browserslist.findConfig(cwd)?.defaults;
2496
+ }
2491
2497
  const tsconfigResult = await parse(conf.path, {
2492
2498
  root: cwd,
2493
2499
  // @ts-ignore
@@ -2519,7 +2525,7 @@ async function loadConfigAndCreateContext(options = {}) {
2519
2525
  // src/parse-dependency.ts
2520
2526
  init_esm_shims();
2521
2527
  import isGlob from "is-glob";
2522
- import { resolve as resolve2 } from "pathe";
2528
+ import { resolve as resolve2, normalize } from "pathe";
2523
2529
 
2524
2530
  // src/parse-glob.ts
2525
2531
  init_esm_shims();
@@ -2550,18 +2556,17 @@ function parseDependency(fileOrGlob) {
2550
2556
  let message = null;
2551
2557
  if (isGlob(fileOrGlob)) {
2552
2558
  const { base, glob: glob2 } = parseGlob(fileOrGlob);
2553
- message = { type: "dir-dependency", dir: resolve2(base), glob: glob2 };
2559
+ message = { type: "dir-dependency", dir: normalize(resolve2(base)), glob: glob2 };
2554
2560
  } else {
2555
- message = { type: "dependency", file: resolve2(fileOrGlob) };
2561
+ message = { type: "dependency", file: normalize(resolve2(fileOrGlob)) };
2556
2562
  }
2557
2563
  if (message.type === "dir-dependency" && process.env.ROLLUP_WATCH === "true") {
2558
- message = { type: "dependency", file: resolve2(message.dir) };
2564
+ message = { type: "dependency", file: normalize(resolve2(message.dir)) };
2559
2565
  }
2560
2566
  return message;
2561
2567
  }
2562
2568
 
2563
2569
  // src/builder.ts
2564
- import { resolve as resolve3 } from "pathe";
2565
2570
  var fileModifiedMap = /* @__PURE__ */ new Map();
2566
2571
  var Builder = class {
2567
2572
  /**
@@ -2686,20 +2691,24 @@ var Builder = class {
2686
2691
  const ctx = this.getContextOrThrow();
2687
2692
  const sheet = ctx.createSheet();
2688
2693
  ctx.appendBaselineCss(sheet);
2689
- ctx.appendParserCss(sheet);
2690
2694
  const css = ctx.getCss(sheet);
2691
- root.append(optimizeCss(css));
2695
+ root.append(
2696
+ optimizeCss(css, {
2697
+ browserslist: ctx.config.browserslist,
2698
+ minify: ctx.config.minify,
2699
+ lightningcss: ctx.config.lightningcss
2700
+ })
2701
+ );
2692
2702
  };
2693
2703
  registerDependency = (fn) => {
2694
2704
  const ctx = this.getContextOrThrow();
2695
2705
  for (const fileOrGlob of ctx.config.include) {
2696
2706
  const dependency = parseDependency(fileOrGlob);
2697
- if (dependency) {
2707
+ if (dependency)
2698
2708
  fn(dependency);
2699
- }
2700
2709
  }
2701
2710
  for (const file of this.configDependencies) {
2702
- fn({ type: "dependency", file: ctx.runtime.path.resolve(file) });
2711
+ fn({ type: "dependency", file: normalize2(resolve3(file)) });
2703
2712
  }
2704
2713
  };
2705
2714
  };
@@ -2708,38 +2717,33 @@ var Builder = class {
2708
2717
  init_esm_shims();
2709
2718
  import { logger as logger7 } from "@pandacss/logger";
2710
2719
  var cssgen = async (ctx, options) => {
2711
- const { cwd, outfile, type, minimal } = options;
2712
- let outPath = ctx.runtime.path.join(...ctx.paths.getFilePath("styles.css"));
2720
+ const { outfile, type, minimal } = options;
2713
2721
  const sheet = ctx.createSheet();
2714
2722
  if (type) {
2723
+ const done = logger7.time.info(ctx.messages.cssArtifactComplete(type));
2715
2724
  ctx.appendCssOfType(type, sheet);
2716
2725
  if (outfile) {
2717
- outPath = ctx.output.ensure(outfile, cwd);
2718
2726
  const css = ctx.getCss(sheet);
2719
2727
  ctx.runtime.fs.writeFileSync(outfile, css);
2720
2728
  } else {
2721
2729
  await ctx.writeCss(sheet);
2722
2730
  }
2723
- const msg = ctx.messages.cssArtifactComplete(type);
2724
- logger7.info("css:emit:path", outPath);
2725
- logger7.info("css:emit:artifact", msg);
2731
+ done();
2726
2732
  } else {
2733
+ const { files } = ctx.parseFiles();
2734
+ const done = logger7.time.info(ctx.messages.buildComplete(files.length));
2727
2735
  if (!minimal) {
2728
2736
  ctx.appendLayerParams(sheet);
2729
2737
  ctx.appendBaselineCss(sheet);
2730
2738
  }
2731
- const { files } = ctx.parseFiles();
2732
2739
  ctx.appendParserCss(sheet);
2733
2740
  if (outfile) {
2734
- outPath = ctx.output.ensure(outfile, cwd);
2735
2741
  const css = ctx.getCss(sheet);
2736
2742
  ctx.runtime.fs.writeFileSync(outfile, css);
2737
2743
  } else {
2738
2744
  await ctx.writeCss(sheet);
2739
2745
  }
2740
- const msg = ctx.messages.buildComplete(files.length);
2741
- logger7.info("css:emit:path", outPath);
2742
- logger7.info("css:emit:out", msg);
2746
+ done();
2743
2747
  }
2744
2748
  };
2745
2749
 
@@ -2806,13 +2810,14 @@ async function build(ctx, artifactIds) {
2806
2810
  if (ctx.config.emitTokensOnly) {
2807
2811
  return logger9.info("css:emit", "Successfully rebuilt the css variables and js function to query your tokens \u2728");
2808
2812
  }
2813
+ const done = logger9.time.info("");
2809
2814
  const sheet = ctx.createSheet();
2810
2815
  ctx.appendLayerParams(sheet);
2811
2816
  ctx.appendBaselineCss(sheet);
2812
- ctx.parseFiles();
2817
+ const parsed = ctx.parseFiles();
2813
2818
  ctx.appendParserCss(sheet);
2814
2819
  await ctx.writeCss(sheet);
2815
- logger9.info("css:emit", "Successfully built the css files \u2728");
2820
+ done(ctx.messages.buildComplete(parsed.files.length));
2816
2821
  }
2817
2822
  async function generate(config, configPath) {
2818
2823
  let ctx = await loadConfigAndCreateContext({ config, configPath });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.26.2",
3
+ "version": "0.27.1",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -32,6 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
+ "browserslist": "^4.22.2",
35
36
  "chokidar": "^3.5.3",
36
37
  "fast-glob": "^3.3.1",
37
38
  "file-size": "^1.0.0",
@@ -53,16 +54,16 @@
53
54
  "ts-morph": "19.0.0",
54
55
  "ts-pattern": "5.0.5",
55
56
  "tsconfck": "^2.1.2",
56
- "@pandacss/config": "0.26.2",
57
- "@pandacss/core": "0.26.2",
58
- "@pandacss/error": "0.26.2",
59
- "@pandacss/extractor": "0.26.2",
60
- "@pandacss/generator": "0.26.2",
61
- "@pandacss/logger": "0.26.2",
62
- "@pandacss/parser": "0.26.2",
63
- "@pandacss/shared": "0.26.2",
64
- "@pandacss/token-dictionary": "0.26.2",
65
- "@pandacss/types": "0.26.2"
57
+ "@pandacss/config": "0.27.1",
58
+ "@pandacss/core": "0.27.1",
59
+ "@pandacss/error": "0.27.1",
60
+ "@pandacss/extractor": "0.27.1",
61
+ "@pandacss/generator": "0.27.1",
62
+ "@pandacss/logger": "0.27.1",
63
+ "@pandacss/parser": "0.27.1",
64
+ "@pandacss/shared": "0.27.1",
65
+ "@pandacss/token-dictionary": "0.27.1",
66
+ "@pandacss/types": "0.27.1"
66
67
  },
67
68
  "devDependencies": {
68
69
  "@types/fs-extra": "11.0.4",