@pandacss/config 0.29.0 → 0.30.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.
@@ -2,6 +2,7 @@
2
2
  import { mergeAndConcat } from "merge-anything";
3
3
 
4
4
  // src/utils.ts
5
+ import { traverse } from "@pandacss/shared";
5
6
  var isObject = (v) => Object.prototype.toString.call(v) === "[object Object]";
6
7
  function mergeWith(target, ...sources) {
7
8
  const customizer = sources.pop();
@@ -31,6 +32,19 @@ function assign(target, ...sources) {
31
32
  }
32
33
  return target;
33
34
  }
35
+ var omit = (obj, paths) => {
36
+ const result = { ...obj };
37
+ traverse(obj, ({ path, parent, key }) => {
38
+ if (paths.includes(path)) {
39
+ delete parent[key];
40
+ }
41
+ });
42
+ return result;
43
+ };
44
+ var utils = {
45
+ omit,
46
+ traverse
47
+ };
34
48
 
35
49
  // src/merge-config.ts
36
50
  function getExtends(items) {
@@ -88,5 +102,6 @@ function mergeConfigs(configs) {
88
102
  }
89
103
 
90
104
  export {
105
+ utils,
91
106
  mergeConfigs
92
107
  };
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ async function bundleConfig(options) {
93
93
  throw new import_shared2.PandaError("CONFIG_ERROR", `\u{1F4A5} Config must export or return an object.`);
94
94
  }
95
95
  result.config.outdir ??= "styled-system";
96
- result.config.validation ??= "error";
96
+ result.config.validation ??= "warn";
97
97
  return {
98
98
  ...result,
99
99
  config: result.config,
@@ -376,6 +376,7 @@ function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }, compi
376
376
  var import_merge_anything = require("merge-anything");
377
377
 
378
378
  // src/utils.ts
379
+ var import_shared4 = require("@pandacss/shared");
379
380
  var isObject = (v) => Object.prototype.toString.call(v) === "[object Object]";
380
381
  function mergeWith(target, ...sources) {
381
382
  const customizer = sources.pop();
@@ -405,6 +406,19 @@ function assign(target, ...sources) {
405
406
  }
406
407
  return target;
407
408
  }
409
+ var omit = (obj, paths) => {
410
+ const result = { ...obj };
411
+ (0, import_shared4.traverse)(obj, ({ path: path2, parent, key }) => {
412
+ if (paths.includes(path2)) {
413
+ delete parent[key];
414
+ }
415
+ });
416
+ return result;
417
+ };
418
+ var utils = {
419
+ omit,
420
+ traverse: import_shared4.traverse
421
+ };
408
422
 
409
423
  // src/merge-config.ts
410
424
  function getExtends(items) {
@@ -481,7 +495,7 @@ async function getResolvedConfig(config, cwd) {
481
495
  }
482
496
 
483
497
  // src/resolve-config.ts
484
- var import_shared7 = require("@pandacss/shared");
498
+ var import_shared8 = require("@pandacss/shared");
485
499
 
486
500
  // src/bundled-preset.ts
487
501
  var import_preset_base = require("@pandacss/preset-base");
@@ -499,7 +513,7 @@ var getBundledPreset = (preset) => {
499
513
 
500
514
  // src/validate-config.ts
501
515
  var import_logger2 = require("@pandacss/logger");
502
- var import_shared6 = require("@pandacss/shared");
516
+ var import_shared7 = require("@pandacss/shared");
503
517
 
504
518
  // src/validation/validate-artifact.ts
505
519
  var validateArtifactNames = (names, addError) => {
@@ -519,14 +533,14 @@ var validateArtifactNames = (names, addError) => {
519
533
  };
520
534
 
521
535
  // src/validation/validate-breakpoints.ts
522
- var import_shared4 = require("@pandacss/shared");
536
+ var import_shared5 = require("@pandacss/shared");
523
537
  var validateBreakpoints = (breakpoints, addError) => {
524
538
  if (!breakpoints)
525
539
  return;
526
540
  const units = /* @__PURE__ */ new Set();
527
541
  const values = Object.values(breakpoints);
528
542
  for (const value of values) {
529
- const unit = (0, import_shared4.getUnit)(value) ?? "px";
543
+ const unit = (0, import_shared5.getUnit)(value) ?? "px";
530
544
  units.add(unit);
531
545
  }
532
546
  if (units.size > 1) {
@@ -576,7 +590,7 @@ var validateRecipes = (options) => {
576
590
  };
577
591
 
578
592
  // src/validation/validate-tokens.ts
579
- var import_shared5 = require("@pandacss/shared");
593
+ var import_shared6 = require("@pandacss/shared");
580
594
 
581
595
  // src/validation/get-final-paths.ts
582
596
  var getFinalPaths = (paths) => {
@@ -628,7 +642,7 @@ var validateTokens = (options) => {
628
642
  return;
629
643
  const { tokenNames, semanticTokenNames, valueAtPath, refsByPath } = tokens2;
630
644
  if (theme.tokens) {
631
- (0, import_shared5.traverse)(theme.tokens, (node) => {
645
+ (0, import_shared6.traverse)(theme.tokens, (node) => {
632
646
  if (node.depth >= 1) {
633
647
  tokenNames.add(node.path);
634
648
  valueAtPath.set(node.path, node.value);
@@ -646,7 +660,7 @@ var validateTokens = (options) => {
646
660
  });
647
661
  }
648
662
  if (theme.semanticTokens) {
649
- (0, import_shared5.traverse)(theme.semanticTokens, (node) => {
663
+ (0, import_shared6.traverse)(theme.semanticTokens, (node) => {
650
664
  if (node.depth >= 1) {
651
665
  semanticTokenNames.add(node.path);
652
666
  valueAtPath.set(node.path, node.value);
@@ -669,11 +683,6 @@ var validateTokens = (options) => {
669
683
  });
670
684
  validateTokenReferences(valueAtPath, refsByPath, addError);
671
685
  }
672
- semanticTokenNames.forEach((semanticTokenName) => {
673
- if (tokenNames.has(semanticTokenName)) {
674
- addError("tokens", `This token name is already used in \`config.theme.token\`: \`${semanticTokenName}\``);
675
- }
676
- });
677
686
  };
678
687
 
679
688
  // src/validate-config.ts
@@ -685,7 +694,7 @@ var validateConfig = (config) => {
685
694
  if (config.validation === "warn") {
686
695
  warnings.add(`[${scope}]: ` + message);
687
696
  } else {
688
- throw new import_shared6.PandaError("CONFIG_ERROR", `[${scope}]: ` + message);
697
+ throw new import_shared7.PandaError("CONFIG_ERROR", `[${scope}]: ` + message);
689
698
  }
690
699
  };
691
700
  validateBreakpoints(config.theme?.breakpoints, addError);
@@ -739,9 +748,19 @@ async function resolveConfig(result, cwd) {
739
748
  ...result,
740
749
  config
741
750
  };
742
- await hooks["config:resolved"]?.({ conf: loadConfigResult });
743
- const serialized = (0, import_shared7.stringifyJson)(loadConfigResult.config);
744
- const deserialize = () => (0, import_shared7.parseJson)(serialized);
751
+ if (hooks["config:resolved"]) {
752
+ const result2 = await hooks["config:resolved"]({
753
+ config: loadConfigResult.config,
754
+ path: loadConfigResult.path,
755
+ dependencies: loadConfigResult.dependencies,
756
+ utils
757
+ });
758
+ if (result2) {
759
+ loadConfigResult.config = result2;
760
+ }
761
+ }
762
+ const serialized = (0, import_shared8.stringifyJson)(loadConfigResult.config);
763
+ const deserialize = () => (0, import_shared8.parseJson)(serialized);
745
764
  return { ...loadConfigResult, serialized, deserialize, hooks };
746
765
  }
747
766
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
- mergeConfigs
3
- } from "./chunk-PROY5XLZ.mjs";
2
+ mergeConfigs,
3
+ utils
4
+ } from "./chunk-XG56JT63.mjs";
4
5
  import {
5
6
  diffConfigs
6
7
  } from "./chunk-5YOGLJPA.mjs";
@@ -60,7 +61,7 @@ async function bundleConfig(options) {
60
61
  throw new PandaError2("CONFIG_ERROR", `\u{1F4A5} Config must export or return an object.`);
61
62
  }
62
63
  result.config.outdir ??= "styled-system";
63
- result.config.validation ??= "error";
64
+ result.config.validation ??= "warn";
64
65
  return {
65
66
  ...result,
66
67
  config: result.config,
@@ -401,11 +402,6 @@ var validateTokens = (options) => {
401
402
  });
402
403
  validateTokenReferences(valueAtPath, refsByPath, addError);
403
404
  }
404
- semanticTokenNames.forEach((semanticTokenName) => {
405
- if (tokenNames.has(semanticTokenName)) {
406
- addError("tokens", `This token name is already used in \`config.theme.token\`: \`${semanticTokenName}\``);
407
- }
408
- });
409
405
  };
410
406
 
411
407
  // src/validate-config.ts
@@ -471,7 +467,17 @@ async function resolveConfig(result, cwd) {
471
467
  ...result,
472
468
  config
473
469
  };
474
- await hooks["config:resolved"]?.({ conf: loadConfigResult });
470
+ if (hooks["config:resolved"]) {
471
+ const result2 = await hooks["config:resolved"]({
472
+ config: loadConfigResult.config,
473
+ path: loadConfigResult.path,
474
+ dependencies: loadConfigResult.dependencies,
475
+ utils
476
+ });
477
+ if (result2) {
478
+ loadConfigResult.config = result2;
479
+ }
480
+ }
475
481
  const serialized = stringifyJson(loadConfigResult.config);
476
482
  const deserialize = () => parseJson(serialized);
477
483
  return { ...loadConfigResult, serialized, deserialize, hooks };
@@ -26,6 +26,7 @@ module.exports = __toCommonJS(merge_config_exports);
26
26
  var import_merge_anything = require("merge-anything");
27
27
 
28
28
  // src/utils.ts
29
+ var import_shared = require("@pandacss/shared");
29
30
  var isObject = (v) => Object.prototype.toString.call(v) === "[object Object]";
30
31
  function mergeWith(target, ...sources) {
31
32
  const customizer = sources.pop();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mergeConfigs
3
- } from "./chunk-PROY5XLZ.mjs";
3
+ } from "./chunk-XG56JT63.mjs";
4
4
  export {
5
5
  mergeConfigs
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "Find and load panda config",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -59,16 +59,16 @@
59
59
  "dist"
60
60
  ],
61
61
  "dependencies": {
62
- "bundle-n-require": "^1.0.1",
62
+ "bundle-n-require": "^1.1.0",
63
63
  "escalade": "3.1.1",
64
64
  "merge-anything": "^5.1.7",
65
65
  "microdiff": "^1.3.2",
66
66
  "typescript": "^5.3.3",
67
- "@pandacss/logger": "0.29.0",
68
- "@pandacss/preset-base": "0.29.0",
69
- "@pandacss/preset-panda": "0.29.0",
70
- "@pandacss/shared": "0.29.0",
71
- "@pandacss/types": "0.29.0"
67
+ "@pandacss/logger": "0.30.0",
68
+ "@pandacss/preset-base": "0.30.0",
69
+ "@pandacss/preset-panda": "0.30.0",
70
+ "@pandacss/shared": "0.30.0",
71
+ "@pandacss/types": "0.30.0"
72
72
  },
73
73
  "devDependencies": {
74
74
  "pkg-types": "1.0.3"