@pandacss/config 2.0.0-beta.14 → 2.0.0-beta.16

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.
@@ -14,7 +14,6 @@ var sectionKeySet = /* @__PURE__ */ new Set([
14
14
  "globalCss",
15
15
  "globalVars",
16
16
  "globalFontface",
17
- "globalPositionTry",
18
17
  "staticCss",
19
18
  "themes"
20
19
  ]);
@@ -28,7 +27,8 @@ var themeEntryKeys = /* @__PURE__ */ new Set([
28
27
  "layerStyles",
29
28
  "recipes",
30
29
  "slotRecipes",
31
- "textStyles"
30
+ "textStyles",
31
+ "viewTransitions"
32
32
  ]);
33
33
  var SourceTracker = class {
34
34
  sources;
@@ -106,7 +106,6 @@ var sectionKeys = [
106
106
  "globalCss",
107
107
  "globalVars",
108
108
  "globalFontface",
109
- "globalPositionTry",
110
109
  "staticCss",
111
110
  "themes"
112
111
  ];
@@ -1,5 +1,7 @@
1
1
  import {
2
- compact
2
+ compact,
3
+ createConfigError,
4
+ isPlainObject
3
5
  } from "./chunk-R4R5RHIS.js";
4
6
 
5
7
  // src/serialize.ts
@@ -49,9 +51,55 @@ function normalizeHook(value, name) {
49
51
  return { filter: record.filter, handler: record.handler };
50
52
  }
51
53
 
54
+ // src/utility-global-vars.ts
55
+ function mergeUtilityGlobalVars(config) {
56
+ const utilities = config.utilities;
57
+ if (!isPlainObject(utilities)) return config;
58
+ const merged = {};
59
+ const owners = /* @__PURE__ */ new Map();
60
+ let found = false;
61
+ const nextUtilities = {};
62
+ for (const [name, utility] of Object.entries(utilities)) {
63
+ if (!isPlainObject(utility) || !isPlainObject(utility.globalVars)) {
64
+ nextUtilities[name] = utility;
65
+ continue;
66
+ }
67
+ found = true;
68
+ const { globalVars, ...rest } = utility;
69
+ nextUtilities[name] = rest;
70
+ for (const [key, definition] of Object.entries(globalVars)) {
71
+ const previous = merged[key];
72
+ if (previous !== void 0 && !isSameDefinition(previous, definition)) {
73
+ throw createConfigError(
74
+ `The \`${owners.get(key)}\` and \`${name}\` utilities both register \`${key}\`, with different definitions.
75
+ A CSS variable has one registration for the whole document, so share one definition between them.`
76
+ );
77
+ }
78
+ merged[key] = definition;
79
+ owners.set(key, name);
80
+ }
81
+ }
82
+ if (!found) return config;
83
+ const configVars = isPlainObject(config.globalVars) ? config.globalVars : {};
84
+ return {
85
+ ...config,
86
+ utilities: nextUtilities,
87
+ globalVars: { ...merged, ...configVars },
88
+ utilityGlobalVars: Object.fromEntries(owners)
89
+ };
90
+ }
91
+ function isSameDefinition(a, b) {
92
+ if (a === b) return true;
93
+ if (!isPlainObject(a) || !isPlainObject(b)) return false;
94
+ const keys = Object.keys(a);
95
+ if (keys.length !== Object.keys(b).length) return false;
96
+ return keys.every((key) => a[key] === b[key]);
97
+ }
98
+
52
99
  // src/serialize.ts
53
100
  var runtimeOnlyKeys = /* @__PURE__ */ new Set(["hooks", "plugins", "presets", "name"]);
54
- function createConfigSnapshot(config) {
101
+ function createConfigSnapshot(input) {
102
+ const config = mergeUtilityGlobalVars(input);
55
103
  const callbacks = {};
56
104
  const hooks = serializeHooks(config, callbacks, sanitize, hashCallbackSource);
57
105
  const serialized = {
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  mergeConfigs,
3
3
  mergeConfigsWithSources
4
- } from "./chunk-PER4IFQZ.js";
4
+ } from "./chunk-LESQDSAI.js";
5
5
  import {
6
6
  collectPluginHookHandlers,
7
7
  createConfigSnapshot,
8
8
  normalizeHook
9
- } from "./chunk-U6KCSKCU.js";
9
+ } from "./chunk-Y642H6DU.js";
10
10
  import {
11
11
  PandaError,
12
12
  clone,
@@ -25,7 +25,7 @@ import { existsSync, realpathSync } from "fs";
25
25
  import { mkdir, unlink, writeFile } from "fs/promises";
26
26
  import { builtinModules } from "module";
27
27
  import { tmpdir } from "os";
28
- import { dirname, isAbsolute as isAbsolute2, join, normalize, relative } from "path";
28
+ import { basename, dirname, isAbsolute as isAbsolute2, join, normalize, relative } from "path";
29
29
  import { pathToFileURL as pathToFileURL2 } from "url";
30
30
 
31
31
  // src/bundle-plugins.ts
@@ -105,6 +105,7 @@ async function bundleConfig(filepath, cwd) {
105
105
  }
106
106
  async function loadBundledModule(filepath, code) {
107
107
  const target = tempTargetFor(filepath);
108
+ let evalError;
108
109
  if (target) {
109
110
  try {
110
111
  await mkdir(dirname(target), { recursive: true });
@@ -117,14 +118,23 @@ async function loadBundledModule(filepath, code) {
117
118
  } finally {
118
119
  void unlink(target).catch(() => void 0);
119
120
  }
120
- } catch {
121
+ } catch (error) {
122
+ if (!isUnresolvedTempModule(error, target)) evalError = error;
121
123
  }
122
124
  }
123
125
  const dataUrl = `data:text/javascript;base64,${Buffer.from(code).toString("base64")}`;
124
- return await import(
125
- /* @vite-ignore */
126
- dataUrl
127
- );
126
+ try {
127
+ return await import(
128
+ /* @vite-ignore */
129
+ dataUrl
130
+ );
131
+ } catch (error) {
132
+ throw evalError ?? error;
133
+ }
134
+ }
135
+ function isUnresolvedTempModule(error, target) {
136
+ const message = error instanceof Error ? error.message : "";
137
+ return message.includes("Cannot find module") && message.includes(basename(target));
128
138
  }
129
139
  function tempTargetFor(filepath) {
130
140
  const unique = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
@@ -373,7 +383,6 @@ var RUNTIME_OPTION_KEYS = [
373
383
  "jsxFramework",
374
384
  "jsxFactory",
375
385
  "jsxStyleProps",
376
- "syntax",
377
386
  "strictTokens",
378
387
  "strictPropertyValues",
379
388
  "shorthands"
@@ -1453,7 +1462,6 @@ var ALL_DEPENDENCIES = [
1453
1462
  "prefix",
1454
1463
  "recipes",
1455
1464
  "separator",
1456
- "syntax",
1457
1465
  "themes",
1458
1466
  "tokens",
1459
1467
  "utilities"
@@ -1507,8 +1515,6 @@ function classify(path) {
1507
1515
  return { deps: ["patterns"], pattern: second };
1508
1516
  case "themes":
1509
1517
  return { deps: ["themes"] };
1510
- case "syntax":
1511
- return { deps: ["syntax"] };
1512
1518
  case "hash":
1513
1519
  return { deps: ["hash"] };
1514
1520
  case "prefix":
package/dist/merge.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mergeConfigs,
3
3
  mergeConfigsWithSources
4
- } from "./chunk-PER4IFQZ.js";
4
+ } from "./chunk-LESQDSAI.js";
5
5
  import "./chunk-R4R5RHIS.js";
6
6
  export {
7
7
  mergeConfigs,
@@ -12,6 +12,6 @@ interface ConfigSnapshot {
12
12
  * pattern's `transform`/`defaultValues` source as `codegenSource` for the Rust
13
13
  * pattern generator.
14
14
  */
15
- declare function createConfigSnapshot(config: UserConfig): ConfigSnapshot;
15
+ declare function createConfigSnapshot(input: UserConfig): ConfigSnapshot;
16
16
 
17
17
  export { type ConfigSnapshot, createConfigSnapshot };
package/dist/serialize.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createConfigSnapshot
3
- } from "./chunk-U6KCSKCU.js";
3
+ } from "./chunk-Y642H6DU.js";
4
4
  import "./chunk-R4R5RHIS.js";
5
5
  export {
6
6
  createConfigSnapshot
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "2.0.0-beta.14",
3
+ "version": "2.0.0-beta.16",
4
4
  "description": "Self-contained loader that bundles and serializes a Panda config for the Rust compiler",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,14 +39,14 @@
39
39
  "dist"
40
40
  ],
41
41
  "dependencies": {
42
+ "@pandacss/compiler-shared": "2.0.0-beta.16",
43
+ "@pandacss/types": "2.0.0-beta.16",
42
44
  "acorn": "^8.17.0",
43
45
  "acorn-walk": "^8.3.5",
44
46
  "javascript-stringify": "2.1.0",
45
47
  "magic-string": "^0.30.21",
46
48
  "microdiff": "1.5.0",
47
- "rolldown": "1.0.0-rc.17",
48
- "@pandacss/compiler-shared": "2.0.0-beta.14",
49
- "@pandacss/types": "2.0.0-beta.14"
49
+ "rolldown": "1.2.7"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=22"