@pandacss/node 0.11.0 → 0.11.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 CHANGED
@@ -190,26 +190,26 @@ declare class Builder {
190
190
  */
191
191
  context: PandaContext | undefined;
192
192
  configDependencies: Set<string>;
193
- writeFileCss(file: string, css: string): void;
194
- checkConfigDeps(configPath: string, deps: Set<string>): ConfigDepsResult;
195
- getConfigPath(): string;
196
- setup(options?: {
193
+ writeFileCss: (file: string, css: string) => void;
194
+ checkConfigDeps: (configPath: string, deps: Set<string>) => ConfigDepsResult;
195
+ getConfigPath: () => string;
196
+ setup: (options?: {
197
197
  configPath?: string;
198
198
  cwd?: string;
199
- }): Promise<void>;
200
- setupContext(options: {
199
+ }) => Promise<void>;
200
+ setupContext: (options: {
201
201
  configPath: string;
202
202
  depsModifiedMap: Map<string, number>;
203
- }): Promise<void>;
204
- getContextOrThrow(): PandaContext;
203
+ }) => Promise<void>;
204
+ getContextOrThrow: () => PandaContext;
205
205
  get fileModifiedMap(): Map<string, number>;
206
206
  get fileCssMap(): Map<string, string>;
207
- extractFile(ctx: PandaContext, file: string): Promise<string | undefined>;
208
- extract(): Promise<void>;
209
- toString(): string;
210
- isValidRoot(root: Root): boolean;
211
- write(root: Root): void;
212
- registerDependency(fn: (dep: Message) => void): void;
207
+ extractFile: (ctx: PandaContext, file: string) => Promise<string | undefined>;
208
+ extract: () => Promise<void>;
209
+ toString: () => string;
210
+ isValidRoot: (root: Root) => boolean;
211
+ write: (root: Root) => void;
212
+ registerDependency: (fn: (dep: Message) => void) => void;
213
213
  }
214
214
 
215
215
  declare function findConfig(): string | undefined;
package/dist/index.d.ts CHANGED
@@ -190,26 +190,26 @@ declare class Builder {
190
190
  */
191
191
  context: PandaContext | undefined;
192
192
  configDependencies: Set<string>;
193
- writeFileCss(file: string, css: string): void;
194
- checkConfigDeps(configPath: string, deps: Set<string>): ConfigDepsResult;
195
- getConfigPath(): string;
196
- setup(options?: {
193
+ writeFileCss: (file: string, css: string) => void;
194
+ checkConfigDeps: (configPath: string, deps: Set<string>) => ConfigDepsResult;
195
+ getConfigPath: () => string;
196
+ setup: (options?: {
197
197
  configPath?: string;
198
198
  cwd?: string;
199
- }): Promise<void>;
200
- setupContext(options: {
199
+ }) => Promise<void>;
200
+ setupContext: (options: {
201
201
  configPath: string;
202
202
  depsModifiedMap: Map<string, number>;
203
- }): Promise<void>;
204
- getContextOrThrow(): PandaContext;
203
+ }) => Promise<void>;
204
+ getContextOrThrow: () => PandaContext;
205
205
  get fileModifiedMap(): Map<string, number>;
206
206
  get fileCssMap(): Map<string, string>;
207
- extractFile(ctx: PandaContext, file: string): Promise<string | undefined>;
208
- extract(): Promise<void>;
209
- toString(): string;
210
- isValidRoot(root: Root): boolean;
211
- write(root: Root): void;
212
- registerDependency(fn: (dep: Message) => void): void;
207
+ extractFile: (ctx: PandaContext, file: string) => Promise<string | undefined>;
208
+ extract: () => Promise<void>;
209
+ toString: () => string;
210
+ isValidRoot: (root: Root) => boolean;
211
+ write: (root: Root) => void;
212
+ registerDependency: (fn: (dep: Message) => void) => void;
213
213
  }
214
214
 
215
215
  declare function findConfig(): string | undefined;
package/dist/index.js CHANGED
@@ -2444,19 +2444,18 @@ function parseDependency(fileOrGlob) {
2444
2444
  var configCache = /* @__PURE__ */ new Map();
2445
2445
  var contentFilesCache = /* @__PURE__ */ new WeakMap();
2446
2446
  var setupCount = 0;
2447
- var layersName = ["reset", "base", "tokens", "recipes", "utilities"];
2448
2447
  var Builder = class {
2449
2448
  /**
2450
2449
  * The current panda context
2451
2450
  */
2452
2451
  context;
2453
2452
  configDependencies = /* @__PURE__ */ new Set();
2454
- writeFileCss(file, css) {
2453
+ writeFileCss = (file, css) => {
2455
2454
  const oldCss = this.fileCssMap?.get(file) ?? "";
2456
2455
  const newCss = (0, import_core2.mergeCss)(oldCss, css);
2457
2456
  this.fileCssMap?.set(file, newCss);
2458
- }
2459
- checkConfigDeps(configPath, deps) {
2457
+ };
2458
+ checkConfigDeps = (configPath, deps) => {
2460
2459
  let modified = false;
2461
2460
  const newModified = /* @__PURE__ */ new Map();
2462
2461
  const prevModified = configCache.get(configPath)?.depsModifiedMap;
@@ -2480,15 +2479,15 @@ var Builder = class {
2480
2479
  import_logger4.logger.debug("builder", "\u2699\uFE0F Config changed, reloading");
2481
2480
  }
2482
2481
  return { isModified: true, modifiedMap: newModified };
2483
- }
2484
- getConfigPath() {
2482
+ };
2483
+ getConfigPath = () => {
2485
2484
  const configPath = findConfig();
2486
2485
  if (!configPath) {
2487
2486
  throw new import_error.ConfigNotFoundError();
2488
2487
  }
2489
2488
  return configPath;
2490
- }
2491
- async setup(options = {}) {
2489
+ };
2490
+ setup = async (options = {}) => {
2492
2491
  import_logger4.logger.debug("builder", "\u{1F6A7} Setup");
2493
2492
  const configPath = options.configPath ?? this.getConfigPath();
2494
2493
  const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
@@ -2517,8 +2516,8 @@ var Builder = class {
2517
2516
  });
2518
2517
  }
2519
2518
  setupCount++;
2520
- }
2521
- async setupContext(options) {
2519
+ };
2520
+ setupContext = async (options) => {
2522
2521
  const { configPath, depsModifiedMap } = options;
2523
2522
  this.context = await loadConfigAndCreateContext({ configPath });
2524
2523
  if (setupCount > 0) {
@@ -2533,13 +2532,13 @@ var Builder = class {
2533
2532
  fileCssMap: /* @__PURE__ */ new Map(),
2534
2533
  fileModifiedMap: /* @__PURE__ */ new Map()
2535
2534
  });
2536
- }
2537
- getContextOrThrow() {
2535
+ };
2536
+ getContextOrThrow = () => {
2538
2537
  if (!this.context) {
2539
2538
  throw new Error("context not loaded");
2540
2539
  }
2541
2540
  return this.context;
2542
- }
2541
+ };
2543
2542
  get fileModifiedMap() {
2544
2543
  const ctx = this.getContextOrThrow();
2545
2544
  return contentFilesCache.get(ctx).fileModifiedMap;
@@ -2548,7 +2547,7 @@ var Builder = class {
2548
2547
  const ctx = this.getContextOrThrow();
2549
2548
  return contentFilesCache.get(ctx).fileCssMap;
2550
2549
  }
2551
- async extractFile(ctx, file) {
2550
+ extractFile = async (ctx, file) => {
2552
2551
  const mtime = (0, import_fs.existsSync)(file) ? (0, import_fs_extra2.statSync)(file).mtimeMs : -Infinity;
2553
2552
  const isUnchanged = this.fileModifiedMap.has(file) && mtime === this.fileModifiedMap.get(file);
2554
2553
  if (isUnchanged)
@@ -2559,32 +2558,31 @@ var Builder = class {
2559
2558
  this.fileModifiedMap.set(file, mtime);
2560
2559
  this.writeFileCss(file, css);
2561
2560
  return css;
2562
- }
2563
- async extract() {
2561
+ };
2562
+ extract = async () => {
2564
2563
  const ctx = this.getContextOrThrow();
2565
2564
  const done = import_logger4.logger.time.info("Extracted in");
2566
2565
  await Promise.all(ctx.getFiles().map((file) => this.extractFile(ctx, file)));
2567
2566
  done();
2568
- }
2569
- toString() {
2567
+ };
2568
+ toString = () => {
2570
2569
  const ctx = this.getContextOrThrow();
2571
2570
  return ctx.getCss({
2572
2571
  files: Array.from(this.fileCssMap.values()),
2573
2572
  resolve: true
2574
2573
  });
2575
- }
2576
- isValidRoot(root) {
2577
- let found = false;
2574
+ };
2575
+ isValidRoot = (root) => {
2576
+ const ctx = this.getContextOrThrow();
2577
+ let valid = false;
2578
2578
  root.walkAtRules("layer", (rule) => {
2579
- const foundLayers = /* @__PURE__ */ new Set();
2580
- rule.params.split(",").forEach((name) => foundLayers.add(name.trim()));
2581
- if (foundLayers.size >= 5 && layersName.every((name) => foundLayers.has(name))) {
2582
- found = true;
2579
+ if (ctx.isValidLayerRule(rule.params)) {
2580
+ valid = true;
2583
2581
  }
2584
2582
  });
2585
- return found;
2586
- }
2587
- write(root) {
2583
+ return valid;
2584
+ };
2585
+ write = (root) => {
2588
2586
  const rootCssContent = root.toString();
2589
2587
  root.removeAll();
2590
2588
  root.append(
@@ -2593,8 +2591,8 @@ var Builder = class {
2593
2591
  ${this.toString()}
2594
2592
  `)
2595
2593
  );
2596
- }
2597
- registerDependency(fn) {
2594
+ };
2595
+ registerDependency = (fn) => {
2598
2596
  const ctx = this.getContextOrThrow();
2599
2597
  for (const fileOrGlob of ctx.config.include) {
2600
2598
  const dependency = parseDependency(fileOrGlob);
@@ -2608,7 +2606,7 @@ var Builder = class {
2608
2606
  for (const file of this.configDependencies) {
2609
2607
  fn({ type: "dependency", file: (0, import_path2.resolve)(file) });
2610
2608
  }
2611
- }
2609
+ };
2612
2610
  };
2613
2611
 
2614
2612
  // src/debug-files.ts
package/dist/index.mjs CHANGED
@@ -2430,19 +2430,18 @@ function parseDependency(fileOrGlob) {
2430
2430
  var configCache = /* @__PURE__ */ new Map();
2431
2431
  var contentFilesCache = /* @__PURE__ */ new WeakMap();
2432
2432
  var setupCount = 0;
2433
- var layersName = ["reset", "base", "tokens", "recipes", "utilities"];
2434
2433
  var Builder = class {
2435
2434
  /**
2436
2435
  * The current panda context
2437
2436
  */
2438
2437
  context;
2439
2438
  configDependencies = /* @__PURE__ */ new Set();
2440
- writeFileCss(file, css) {
2439
+ writeFileCss = (file, css) => {
2441
2440
  const oldCss = this.fileCssMap?.get(file) ?? "";
2442
2441
  const newCss = mergeCss2(oldCss, css);
2443
2442
  this.fileCssMap?.set(file, newCss);
2444
- }
2445
- checkConfigDeps(configPath, deps) {
2443
+ };
2444
+ checkConfigDeps = (configPath, deps) => {
2446
2445
  let modified = false;
2447
2446
  const newModified = /* @__PURE__ */ new Map();
2448
2447
  const prevModified = configCache.get(configPath)?.depsModifiedMap;
@@ -2466,15 +2465,15 @@ var Builder = class {
2466
2465
  logger4.debug("builder", "\u2699\uFE0F Config changed, reloading");
2467
2466
  }
2468
2467
  return { isModified: true, modifiedMap: newModified };
2469
- }
2470
- getConfigPath() {
2468
+ };
2469
+ getConfigPath = () => {
2471
2470
  const configPath = findConfig();
2472
2471
  if (!configPath) {
2473
2472
  throw new ConfigNotFoundError();
2474
2473
  }
2475
2474
  return configPath;
2476
- }
2477
- async setup(options = {}) {
2475
+ };
2476
+ setup = async (options = {}) => {
2478
2477
  logger4.debug("builder", "\u{1F6A7} Setup");
2479
2478
  const configPath = options.configPath ?? this.getConfigPath();
2480
2479
  const tsOptions = this.context?.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
@@ -2503,8 +2502,8 @@ var Builder = class {
2503
2502
  });
2504
2503
  }
2505
2504
  setupCount++;
2506
- }
2507
- async setupContext(options) {
2505
+ };
2506
+ setupContext = async (options) => {
2508
2507
  const { configPath, depsModifiedMap } = options;
2509
2508
  this.context = await loadConfigAndCreateContext({ configPath });
2510
2509
  if (setupCount > 0) {
@@ -2519,13 +2518,13 @@ var Builder = class {
2519
2518
  fileCssMap: /* @__PURE__ */ new Map(),
2520
2519
  fileModifiedMap: /* @__PURE__ */ new Map()
2521
2520
  });
2522
- }
2523
- getContextOrThrow() {
2521
+ };
2522
+ getContextOrThrow = () => {
2524
2523
  if (!this.context) {
2525
2524
  throw new Error("context not loaded");
2526
2525
  }
2527
2526
  return this.context;
2528
- }
2527
+ };
2529
2528
  get fileModifiedMap() {
2530
2529
  const ctx = this.getContextOrThrow();
2531
2530
  return contentFilesCache.get(ctx).fileModifiedMap;
@@ -2534,7 +2533,7 @@ var Builder = class {
2534
2533
  const ctx = this.getContextOrThrow();
2535
2534
  return contentFilesCache.get(ctx).fileCssMap;
2536
2535
  }
2537
- async extractFile(ctx, file) {
2536
+ extractFile = async (ctx, file) => {
2538
2537
  const mtime = existsSync2(file) ? statSync(file).mtimeMs : -Infinity;
2539
2538
  const isUnchanged = this.fileModifiedMap.has(file) && mtime === this.fileModifiedMap.get(file);
2540
2539
  if (isUnchanged)
@@ -2545,32 +2544,31 @@ var Builder = class {
2545
2544
  this.fileModifiedMap.set(file, mtime);
2546
2545
  this.writeFileCss(file, css);
2547
2546
  return css;
2548
- }
2549
- async extract() {
2547
+ };
2548
+ extract = async () => {
2550
2549
  const ctx = this.getContextOrThrow();
2551
2550
  const done = logger4.time.info("Extracted in");
2552
2551
  await Promise.all(ctx.getFiles().map((file) => this.extractFile(ctx, file)));
2553
2552
  done();
2554
- }
2555
- toString() {
2553
+ };
2554
+ toString = () => {
2556
2555
  const ctx = this.getContextOrThrow();
2557
2556
  return ctx.getCss({
2558
2557
  files: Array.from(this.fileCssMap.values()),
2559
2558
  resolve: true
2560
2559
  });
2561
- }
2562
- isValidRoot(root) {
2563
- let found = false;
2560
+ };
2561
+ isValidRoot = (root) => {
2562
+ const ctx = this.getContextOrThrow();
2563
+ let valid = false;
2564
2564
  root.walkAtRules("layer", (rule) => {
2565
- const foundLayers = /* @__PURE__ */ new Set();
2566
- rule.params.split(",").forEach((name) => foundLayers.add(name.trim()));
2567
- if (foundLayers.size >= 5 && layersName.every((name) => foundLayers.has(name))) {
2568
- found = true;
2565
+ if (ctx.isValidLayerRule(rule.params)) {
2566
+ valid = true;
2569
2567
  }
2570
2568
  });
2571
- return found;
2572
- }
2573
- write(root) {
2569
+ return valid;
2570
+ };
2571
+ write = (root) => {
2574
2572
  const rootCssContent = root.toString();
2575
2573
  root.removeAll();
2576
2574
  root.append(
@@ -2579,8 +2577,8 @@ var Builder = class {
2579
2577
  ${this.toString()}
2580
2578
  `)
2581
2579
  );
2582
- }
2583
- registerDependency(fn) {
2580
+ };
2581
+ registerDependency = (fn) => {
2584
2582
  const ctx = this.getContextOrThrow();
2585
2583
  for (const fileOrGlob of ctx.config.include) {
2586
2584
  const dependency = parseDependency(fileOrGlob);
@@ -2594,7 +2592,7 @@ var Builder = class {
2594
2592
  for (const file of this.configDependencies) {
2595
2593
  fn({ type: "dependency", file: resolve2(file) });
2596
2594
  }
2597
- }
2595
+ };
2598
2596
  };
2599
2597
 
2600
2598
  // src/debug-files.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
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.4",
36
36
  "tsconfck": "^2.1.2",
37
- "@pandacss/config": "0.11.0",
38
- "@pandacss/core": "0.11.0",
39
- "@pandacss/error": "0.11.0",
40
- "@pandacss/extractor": "0.11.0",
41
- "@pandacss/generator": "0.11.0",
42
- "@pandacss/is-valid-prop": "0.11.0",
43
- "@pandacss/logger": "0.11.0",
44
- "@pandacss/parser": "0.11.0",
45
- "@pandacss/shared": "0.11.0",
46
- "@pandacss/token-dictionary": "0.11.0",
47
- "@pandacss/types": "0.11.0"
37
+ "@pandacss/config": "0.11.1",
38
+ "@pandacss/core": "0.11.1",
39
+ "@pandacss/error": "0.11.1",
40
+ "@pandacss/extractor": "0.11.1",
41
+ "@pandacss/generator": "0.11.1",
42
+ "@pandacss/is-valid-prop": "0.11.1",
43
+ "@pandacss/logger": "0.11.1",
44
+ "@pandacss/parser": "0.11.1",
45
+ "@pandacss/shared": "0.11.1",
46
+ "@pandacss/token-dictionary": "0.11.1",
47
+ "@pandacss/types": "0.11.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/fs-extra": "11.0.1",
@@ -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.11.0"
56
+ "@pandacss/fixture": "0.11.1"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "tsup src/index.ts --format=cjs,esm --shims --dts",