@pandacss/config 0.27.2 → 0.28.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/chunk-TP2SOWHU.mjs +108 -0
- package/dist/diff-config.d.mts +11 -0
- package/dist/diff-config.d.ts +11 -0
- package/dist/diff-config.js +142 -0
- package/dist/diff-config.mjs +6 -0
- package/dist/index.d.mts +4 -14
- package/dist/index.d.ts +4 -14
- package/dist/index.js +5 -7
- package/dist/index.mjs +8 -112
- package/package.json +9 -9
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// src/diff-config.ts
|
|
2
|
+
import { dashCase } from "@pandacss/shared";
|
|
3
|
+
import microdiff from "microdiff";
|
|
4
|
+
|
|
5
|
+
// src/create-matcher.ts
|
|
6
|
+
function createMatcher(id, patterns) {
|
|
7
|
+
if (!patterns?.length)
|
|
8
|
+
return () => void 0;
|
|
9
|
+
const includePatterns = [];
|
|
10
|
+
const excludePatterns = [];
|
|
11
|
+
const deduped = new Set(patterns);
|
|
12
|
+
deduped.forEach((pattern) => {
|
|
13
|
+
const regexString = pattern.replace(/\*/g, ".*");
|
|
14
|
+
if (pattern.startsWith("!")) {
|
|
15
|
+
excludePatterns.push(regexString.slice(1));
|
|
16
|
+
} else {
|
|
17
|
+
includePatterns.push(regexString);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const include = new RegExp(includePatterns.join("|"));
|
|
21
|
+
const exclude = new RegExp(excludePatterns.join("|"));
|
|
22
|
+
return (path) => {
|
|
23
|
+
if (excludePatterns.length && exclude.test(path))
|
|
24
|
+
return;
|
|
25
|
+
return include.test(path) ? id : void 0;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/config-deps.ts
|
|
30
|
+
var all = ["outdir", "forceConsistentTypeExtension", "outExtension"];
|
|
31
|
+
var format = ["syntax", "hash", "prefix", "separator"];
|
|
32
|
+
var tokens = ["utilities", "conditions", "theme.tokens", "theme.semanticTokens", "theme.breakpoints"];
|
|
33
|
+
var jsx = ["jsxFramework", "jsxFactory", "jsxStyleProps", "syntax"];
|
|
34
|
+
var css = ["layers", "optimize", "minify"];
|
|
35
|
+
var common = tokens.concat(jsx, format);
|
|
36
|
+
var artifactConfigDeps = {
|
|
37
|
+
helpers: ["syntax", "jsxFramework"],
|
|
38
|
+
keyframes: ["theme.keyframes", "layers"],
|
|
39
|
+
"design-tokens": ["layers", "!utilities.*.className"].concat(tokens),
|
|
40
|
+
types: ["!utilities.*.className"].concat(common),
|
|
41
|
+
"css-fn": common,
|
|
42
|
+
cva: ["syntax"],
|
|
43
|
+
sva: ["syntax"],
|
|
44
|
+
cx: [],
|
|
45
|
+
"create-recipe": ["separator", "prefix", "hash"],
|
|
46
|
+
"recipes-index": ["theme.recipes", "theme.slotRecipes"],
|
|
47
|
+
recipes: ["theme.recipes", "theme.slotRecipes"],
|
|
48
|
+
"patterns-index": ["syntax", "patterns"],
|
|
49
|
+
patterns: ["syntax", "patterns"],
|
|
50
|
+
"jsx-is-valid-prop": common,
|
|
51
|
+
"jsx-factory": jsx,
|
|
52
|
+
"jsx-helpers": jsx,
|
|
53
|
+
"jsx-patterns": jsx.concat("patterns"),
|
|
54
|
+
"jsx-patterns-index": jsx.concat("patterns"),
|
|
55
|
+
"css-index": ["syntax"],
|
|
56
|
+
"reset.css": ["preflight", "layers"],
|
|
57
|
+
"global.css": ["globalCss"].concat(css),
|
|
58
|
+
"static.css": ["staticCss", "theme.breakpoints"].concat(css),
|
|
59
|
+
"styles.css": tokens.concat(format),
|
|
60
|
+
"package.json": ["emitPackage"]
|
|
61
|
+
};
|
|
62
|
+
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
63
|
+
if (!paths.length)
|
|
64
|
+
return () => void 0;
|
|
65
|
+
return createMatcher(key, paths.concat(all));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// src/diff-config.ts
|
|
69
|
+
var runIfFn = (fn) => typeof fn === "function" ? fn() : fn;
|
|
70
|
+
function diffConfigs(config, prevConfig) {
|
|
71
|
+
const affected = {
|
|
72
|
+
artifacts: /* @__PURE__ */ new Set(),
|
|
73
|
+
hasConfigChanged: false,
|
|
74
|
+
diffs: []
|
|
75
|
+
};
|
|
76
|
+
if (!prevConfig) {
|
|
77
|
+
affected.hasConfigChanged = true;
|
|
78
|
+
return affected;
|
|
79
|
+
}
|
|
80
|
+
const configDiff = microdiff(prevConfig, runIfFn(config));
|
|
81
|
+
if (!configDiff.length) {
|
|
82
|
+
return affected;
|
|
83
|
+
}
|
|
84
|
+
affected.hasConfigChanged = true;
|
|
85
|
+
affected.diffs = configDiff;
|
|
86
|
+
configDiff.forEach((change) => {
|
|
87
|
+
const changePath = change.path.join(".");
|
|
88
|
+
artifactMatchers.forEach((matcher) => {
|
|
89
|
+
const id = matcher(changePath);
|
|
90
|
+
if (!id)
|
|
91
|
+
return;
|
|
92
|
+
if (id === "recipes") {
|
|
93
|
+
const name = dashCase(change.path.slice(1, 3).join("."));
|
|
94
|
+
affected.artifacts.add(name);
|
|
95
|
+
}
|
|
96
|
+
if (id === "patterns") {
|
|
97
|
+
const name = dashCase(change.path.slice(0, 2).join("."));
|
|
98
|
+
affected.artifacts.add(name);
|
|
99
|
+
}
|
|
100
|
+
affected.artifacts.add(id);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
return affected;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
diffConfigs
|
|
108
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Config, DiffConfigResult } from '@pandacss/types';
|
|
2
|
+
export { DiffConfigResult } from '@pandacss/types';
|
|
3
|
+
|
|
4
|
+
type ConfigOrFn = Config | (() => Config);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Diff the two config objects and return the list of affected properties
|
|
8
|
+
*/
|
|
9
|
+
declare function diffConfigs(config: ConfigOrFn, prevConfig: Config | undefined): DiffConfigResult;
|
|
10
|
+
|
|
11
|
+
export { diffConfigs };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Config, DiffConfigResult } from '@pandacss/types';
|
|
2
|
+
export { DiffConfigResult } from '@pandacss/types';
|
|
3
|
+
|
|
4
|
+
type ConfigOrFn = Config | (() => Config);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Diff the two config objects and return the list of affected properties
|
|
8
|
+
*/
|
|
9
|
+
declare function diffConfigs(config: ConfigOrFn, prevConfig: Config | undefined): DiffConfigResult;
|
|
10
|
+
|
|
11
|
+
export { diffConfigs };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all2) => {
|
|
9
|
+
for (var name in all2)
|
|
10
|
+
__defProp(target, name, { get: all2[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/diff-config.ts
|
|
31
|
+
var diff_config_exports = {};
|
|
32
|
+
__export(diff_config_exports, {
|
|
33
|
+
diffConfigs: () => diffConfigs
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(diff_config_exports);
|
|
36
|
+
var import_shared = require("@pandacss/shared");
|
|
37
|
+
var import_microdiff = __toESM(require("microdiff"));
|
|
38
|
+
|
|
39
|
+
// src/create-matcher.ts
|
|
40
|
+
function createMatcher(id, patterns) {
|
|
41
|
+
if (!patterns?.length)
|
|
42
|
+
return () => void 0;
|
|
43
|
+
const includePatterns = [];
|
|
44
|
+
const excludePatterns = [];
|
|
45
|
+
const deduped = new Set(patterns);
|
|
46
|
+
deduped.forEach((pattern) => {
|
|
47
|
+
const regexString = pattern.replace(/\*/g, ".*");
|
|
48
|
+
if (pattern.startsWith("!")) {
|
|
49
|
+
excludePatterns.push(regexString.slice(1));
|
|
50
|
+
} else {
|
|
51
|
+
includePatterns.push(regexString);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const include = new RegExp(includePatterns.join("|"));
|
|
55
|
+
const exclude = new RegExp(excludePatterns.join("|"));
|
|
56
|
+
return (path) => {
|
|
57
|
+
if (excludePatterns.length && exclude.test(path))
|
|
58
|
+
return;
|
|
59
|
+
return include.test(path) ? id : void 0;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/config-deps.ts
|
|
64
|
+
var all = ["outdir", "forceConsistentTypeExtension", "outExtension"];
|
|
65
|
+
var format = ["syntax", "hash", "prefix", "separator"];
|
|
66
|
+
var tokens = ["utilities", "conditions", "theme.tokens", "theme.semanticTokens", "theme.breakpoints"];
|
|
67
|
+
var jsx = ["jsxFramework", "jsxFactory", "jsxStyleProps", "syntax"];
|
|
68
|
+
var css = ["layers", "optimize", "minify"];
|
|
69
|
+
var common = tokens.concat(jsx, format);
|
|
70
|
+
var artifactConfigDeps = {
|
|
71
|
+
helpers: ["syntax", "jsxFramework"],
|
|
72
|
+
keyframes: ["theme.keyframes", "layers"],
|
|
73
|
+
"design-tokens": ["layers", "!utilities.*.className"].concat(tokens),
|
|
74
|
+
types: ["!utilities.*.className"].concat(common),
|
|
75
|
+
"css-fn": common,
|
|
76
|
+
cva: ["syntax"],
|
|
77
|
+
sva: ["syntax"],
|
|
78
|
+
cx: [],
|
|
79
|
+
"create-recipe": ["separator", "prefix", "hash"],
|
|
80
|
+
"recipes-index": ["theme.recipes", "theme.slotRecipes"],
|
|
81
|
+
recipes: ["theme.recipes", "theme.slotRecipes"],
|
|
82
|
+
"patterns-index": ["syntax", "patterns"],
|
|
83
|
+
patterns: ["syntax", "patterns"],
|
|
84
|
+
"jsx-is-valid-prop": common,
|
|
85
|
+
"jsx-factory": jsx,
|
|
86
|
+
"jsx-helpers": jsx,
|
|
87
|
+
"jsx-patterns": jsx.concat("patterns"),
|
|
88
|
+
"jsx-patterns-index": jsx.concat("patterns"),
|
|
89
|
+
"css-index": ["syntax"],
|
|
90
|
+
"reset.css": ["preflight", "layers"],
|
|
91
|
+
"global.css": ["globalCss"].concat(css),
|
|
92
|
+
"static.css": ["staticCss", "theme.breakpoints"].concat(css),
|
|
93
|
+
"styles.css": tokens.concat(format),
|
|
94
|
+
"package.json": ["emitPackage"]
|
|
95
|
+
};
|
|
96
|
+
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
97
|
+
if (!paths.length)
|
|
98
|
+
return () => void 0;
|
|
99
|
+
return createMatcher(key, paths.concat(all));
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// src/diff-config.ts
|
|
103
|
+
var runIfFn = (fn) => typeof fn === "function" ? fn() : fn;
|
|
104
|
+
function diffConfigs(config, prevConfig) {
|
|
105
|
+
const affected = {
|
|
106
|
+
artifacts: /* @__PURE__ */ new Set(),
|
|
107
|
+
hasConfigChanged: false,
|
|
108
|
+
diffs: []
|
|
109
|
+
};
|
|
110
|
+
if (!prevConfig) {
|
|
111
|
+
affected.hasConfigChanged = true;
|
|
112
|
+
return affected;
|
|
113
|
+
}
|
|
114
|
+
const configDiff = (0, import_microdiff.default)(prevConfig, runIfFn(config));
|
|
115
|
+
if (!configDiff.length) {
|
|
116
|
+
return affected;
|
|
117
|
+
}
|
|
118
|
+
affected.hasConfigChanged = true;
|
|
119
|
+
affected.diffs = configDiff;
|
|
120
|
+
configDiff.forEach((change) => {
|
|
121
|
+
const changePath = change.path.join(".");
|
|
122
|
+
artifactMatchers.forEach((matcher) => {
|
|
123
|
+
const id = matcher(changePath);
|
|
124
|
+
if (!id)
|
|
125
|
+
return;
|
|
126
|
+
if (id === "recipes") {
|
|
127
|
+
const name = (0, import_shared.dashCase)(change.path.slice(1, 3).join("."));
|
|
128
|
+
affected.artifacts.add(name);
|
|
129
|
+
}
|
|
130
|
+
if (id === "patterns") {
|
|
131
|
+
const name = (0, import_shared.dashCase)(change.path.slice(0, 2).join("."));
|
|
132
|
+
affected.artifacts.add(name);
|
|
133
|
+
}
|
|
134
|
+
affected.artifacts.add(id);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
return affected;
|
|
138
|
+
}
|
|
139
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
140
|
+
0 && (module.exports = {
|
|
141
|
+
diffConfigs
|
|
142
|
+
});
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
|
-
import { Config,
|
|
3
|
-
|
|
2
|
+
import { Config, ConfigTsOptions } from '@pandacss/types';
|
|
3
|
+
export { DiffConfigResult } from '@pandacss/types';
|
|
4
|
+
export { diffConfigs } from './diff-config.mjs';
|
|
4
5
|
import { P as PathMapping } from './ts-config-paths-2lh9mwzL.mjs';
|
|
5
6
|
export { c as convertTsPathsToRegexes } from './ts-config-paths-2lh9mwzL.mjs';
|
|
6
7
|
import { TSConfig } from 'pkg-types';
|
|
@@ -18,17 +19,6 @@ interface BundleConfigResult<T = Config> {
|
|
|
18
19
|
}
|
|
19
20
|
declare function bundleConfig(options: ConfigFileOptions): Promise<BundleConfigResult>;
|
|
20
21
|
|
|
21
|
-
interface DiffConfigResult {
|
|
22
|
-
hasConfigChanged: boolean;
|
|
23
|
-
artifacts: Set<ArtifactId>;
|
|
24
|
-
diffs: Difference[];
|
|
25
|
-
}
|
|
26
|
-
type ConfigOrFn = Config | (() => Config);
|
|
27
|
-
/**
|
|
28
|
-
* Diff the two config objects and return the list of affected properties
|
|
29
|
-
*/
|
|
30
|
-
declare function diffConfigs(config: ConfigOrFn, prevConfig: Config | undefined): DiffConfigResult;
|
|
31
|
-
|
|
32
22
|
declare function findConfig({ cwd, file }: Partial<ConfigFileOptions>): string | undefined;
|
|
33
23
|
|
|
34
24
|
interface GetDepsOptions {
|
|
@@ -60,4 +50,4 @@ declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promi
|
|
|
60
50
|
*/
|
|
61
51
|
declare function loadConfig(options: ConfigFileOptions): Promise<_pandacss_types.LoadConfigResult>;
|
|
62
52
|
|
|
63
|
-
export { type BundleConfigResult, type
|
|
53
|
+
export { type BundleConfigResult, type GetDepsOptions, bundleConfig, findConfig, getConfigDependencies, getResolvedConfig, loadConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
|
-
import { Config,
|
|
3
|
-
|
|
2
|
+
import { Config, ConfigTsOptions } from '@pandacss/types';
|
|
3
|
+
export { DiffConfigResult } from '@pandacss/types';
|
|
4
|
+
export { diffConfigs } from './diff-config.js';
|
|
4
5
|
import { P as PathMapping } from './ts-config-paths-2lh9mwzL.js';
|
|
5
6
|
export { c as convertTsPathsToRegexes } from './ts-config-paths-2lh9mwzL.js';
|
|
6
7
|
import { TSConfig } from 'pkg-types';
|
|
@@ -18,17 +19,6 @@ interface BundleConfigResult<T = Config> {
|
|
|
18
19
|
}
|
|
19
20
|
declare function bundleConfig(options: ConfigFileOptions): Promise<BundleConfigResult>;
|
|
20
21
|
|
|
21
|
-
interface DiffConfigResult {
|
|
22
|
-
hasConfigChanged: boolean;
|
|
23
|
-
artifacts: Set<ArtifactId>;
|
|
24
|
-
diffs: Difference[];
|
|
25
|
-
}
|
|
26
|
-
type ConfigOrFn = Config | (() => Config);
|
|
27
|
-
/**
|
|
28
|
-
* Diff the two config objects and return the list of affected properties
|
|
29
|
-
*/
|
|
30
|
-
declare function diffConfigs(config: ConfigOrFn, prevConfig: Config | undefined): DiffConfigResult;
|
|
31
|
-
|
|
32
22
|
declare function findConfig({ cwd, file }: Partial<ConfigFileOptions>): string | undefined;
|
|
33
23
|
|
|
34
24
|
interface GetDepsOptions {
|
|
@@ -60,4 +50,4 @@ declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promi
|
|
|
60
50
|
*/
|
|
61
51
|
declare function loadConfig(options: ConfigFileOptions): Promise<_pandacss_types.LoadConfigResult>;
|
|
62
52
|
|
|
63
|
-
export { type BundleConfigResult, type
|
|
53
|
+
export { type BundleConfigResult, type GetDepsOptions, bundleConfig, findConfig, getConfigDependencies, getResolvedConfig, loadConfig };
|
package/dist/index.js
CHANGED
|
@@ -479,14 +479,12 @@ async function resolveConfig(result, cwd) {
|
|
|
479
479
|
}
|
|
480
480
|
result.config.presets = Array.from(presets);
|
|
481
481
|
const mergedConfig = await getResolvedConfig(result.config, cwd);
|
|
482
|
-
const
|
|
482
|
+
const hooks = result.config.hooks ?? {};
|
|
483
|
+
const loadConfigResult = { ...result, config: mergedConfig };
|
|
484
|
+
await hooks["config:resolved"]?.({ conf: loadConfigResult });
|
|
485
|
+
const serialized = (0, import_shared2.stringifyJson)(loadConfigResult.config);
|
|
483
486
|
const deserialize = () => (0, import_shared2.parseJson)(serialized);
|
|
484
|
-
return {
|
|
485
|
-
...result,
|
|
486
|
-
serialized,
|
|
487
|
-
deserialize,
|
|
488
|
-
config: mergedConfig
|
|
489
|
-
};
|
|
487
|
+
return { ...loadConfigResult, serialized, deserialize, hooks };
|
|
490
488
|
}
|
|
491
489
|
|
|
492
490
|
// src/load-config.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mergeConfigs
|
|
3
3
|
} from "./chunk-PROY5XLZ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
diffConfigs
|
|
6
|
+
} from "./chunk-TP2SOWHU.mjs";
|
|
4
7
|
import {
|
|
5
8
|
resolveTsPathPattern
|
|
6
9
|
} from "./chunk-RPIVZP2I.mjs";
|
|
@@ -54,111 +57,6 @@ async function bundleConfig(options) {
|
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
59
|
|
|
57
|
-
// src/diff-config.ts
|
|
58
|
-
import { dashCase } from "@pandacss/shared";
|
|
59
|
-
import microdiff from "microdiff";
|
|
60
|
-
|
|
61
|
-
// src/create-matcher.ts
|
|
62
|
-
function createMatcher(id, patterns) {
|
|
63
|
-
if (!patterns?.length)
|
|
64
|
-
return () => void 0;
|
|
65
|
-
const includePatterns = [];
|
|
66
|
-
const excludePatterns = [];
|
|
67
|
-
const deduped = new Set(patterns);
|
|
68
|
-
deduped.forEach((pattern) => {
|
|
69
|
-
const regexString = pattern.replace(/\*/g, ".*");
|
|
70
|
-
if (pattern.startsWith("!")) {
|
|
71
|
-
excludePatterns.push(regexString.slice(1));
|
|
72
|
-
} else {
|
|
73
|
-
includePatterns.push(regexString);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
const include = new RegExp(includePatterns.join("|"));
|
|
77
|
-
const exclude = new RegExp(excludePatterns.join("|"));
|
|
78
|
-
return (path2) => {
|
|
79
|
-
if (excludePatterns.length && exclude.test(path2))
|
|
80
|
-
return;
|
|
81
|
-
return include.test(path2) ? id : void 0;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// src/config-deps.ts
|
|
86
|
-
var all = ["outdir", "forceConsistentTypeExtension", "outExtension"];
|
|
87
|
-
var format = ["syntax", "hash", "prefix", "separator"];
|
|
88
|
-
var tokens = ["utilities", "conditions", "theme.tokens", "theme.semanticTokens", "theme.breakpoints"];
|
|
89
|
-
var jsx = ["jsxFramework", "jsxFactory", "jsxStyleProps", "syntax"];
|
|
90
|
-
var css = ["layers", "optimize", "minify"];
|
|
91
|
-
var common = tokens.concat(jsx, format);
|
|
92
|
-
var artifactConfigDeps = {
|
|
93
|
-
helpers: ["syntax", "jsxFramework"],
|
|
94
|
-
keyframes: ["theme.keyframes", "layers"],
|
|
95
|
-
"design-tokens": ["layers", "!utilities.*.className"].concat(tokens),
|
|
96
|
-
types: ["!utilities.*.className"].concat(common),
|
|
97
|
-
"css-fn": common,
|
|
98
|
-
cva: ["syntax"],
|
|
99
|
-
sva: ["syntax"],
|
|
100
|
-
cx: [],
|
|
101
|
-
"create-recipe": ["separator", "prefix", "hash"],
|
|
102
|
-
"recipes-index": ["theme.recipes", "theme.slotRecipes"],
|
|
103
|
-
recipes: ["theme.recipes", "theme.slotRecipes"],
|
|
104
|
-
"patterns-index": ["syntax", "patterns"],
|
|
105
|
-
patterns: ["syntax", "patterns"],
|
|
106
|
-
"jsx-is-valid-prop": common,
|
|
107
|
-
"jsx-factory": jsx,
|
|
108
|
-
"jsx-helpers": jsx,
|
|
109
|
-
"jsx-patterns": jsx.concat("patterns"),
|
|
110
|
-
"jsx-patterns-index": jsx.concat("patterns"),
|
|
111
|
-
"css-index": ["syntax"],
|
|
112
|
-
"reset.css": ["preflight", "layers"],
|
|
113
|
-
"global.css": ["globalCss"].concat(css),
|
|
114
|
-
"static.css": ["staticCss", "theme.breakpoints"].concat(css),
|
|
115
|
-
"styles.css": tokens.concat(format),
|
|
116
|
-
"package.json": ["emitPackage"]
|
|
117
|
-
};
|
|
118
|
-
var artifactMatchers = Object.entries(artifactConfigDeps).map(([key, paths]) => {
|
|
119
|
-
if (!paths.length)
|
|
120
|
-
return () => void 0;
|
|
121
|
-
return createMatcher(key, paths.concat(all));
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// src/diff-config.ts
|
|
125
|
-
var runIfFn = (fn) => typeof fn === "function" ? fn() : fn;
|
|
126
|
-
function diffConfigs(config, prevConfig) {
|
|
127
|
-
const affected = {
|
|
128
|
-
artifacts: /* @__PURE__ */ new Set(),
|
|
129
|
-
hasConfigChanged: false,
|
|
130
|
-
diffs: []
|
|
131
|
-
};
|
|
132
|
-
if (!prevConfig) {
|
|
133
|
-
affected.hasConfigChanged = true;
|
|
134
|
-
return affected;
|
|
135
|
-
}
|
|
136
|
-
const configDiff = microdiff(prevConfig, runIfFn(config));
|
|
137
|
-
if (!configDiff.length) {
|
|
138
|
-
return affected;
|
|
139
|
-
}
|
|
140
|
-
affected.hasConfigChanged = true;
|
|
141
|
-
affected.diffs = configDiff;
|
|
142
|
-
configDiff.forEach((change) => {
|
|
143
|
-
const changePath = change.path.join(".");
|
|
144
|
-
artifactMatchers.forEach((matcher) => {
|
|
145
|
-
const id = matcher(changePath);
|
|
146
|
-
if (!id)
|
|
147
|
-
return;
|
|
148
|
-
if (id === "recipes") {
|
|
149
|
-
const name = dashCase(change.path.slice(1, 3).join("."));
|
|
150
|
-
affected.artifacts.add(name);
|
|
151
|
-
}
|
|
152
|
-
if (id === "patterns") {
|
|
153
|
-
const name = dashCase(change.path.slice(0, 2).join("."));
|
|
154
|
-
affected.artifacts.add(name);
|
|
155
|
-
}
|
|
156
|
-
affected.artifacts.add(id);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
return affected;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
60
|
// src/get-mod-deps.ts
|
|
163
61
|
import fs from "fs";
|
|
164
62
|
import path from "path";
|
|
@@ -335,14 +233,12 @@ async function resolveConfig(result, cwd) {
|
|
|
335
233
|
}
|
|
336
234
|
result.config.presets = Array.from(presets);
|
|
337
235
|
const mergedConfig = await getResolvedConfig(result.config, cwd);
|
|
338
|
-
const
|
|
236
|
+
const hooks = result.config.hooks ?? {};
|
|
237
|
+
const loadConfigResult = { ...result, config: mergedConfig };
|
|
238
|
+
await hooks["config:resolved"]?.({ conf: loadConfigResult });
|
|
239
|
+
const serialized = stringifyJson(loadConfigResult.config);
|
|
339
240
|
const deserialize = () => parseJson(serialized);
|
|
340
|
-
return {
|
|
341
|
-
...result,
|
|
342
|
-
serialized,
|
|
343
|
-
deserialize,
|
|
344
|
-
config: mergedConfig
|
|
345
|
-
};
|
|
241
|
+
return { ...loadConfigResult, serialized, deserialize, hooks };
|
|
346
242
|
}
|
|
347
243
|
|
|
348
244
|
// src/load-config.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Find and load panda config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -64,19 +64,19 @@
|
|
|
64
64
|
"merge-anything": "^5.1.7",
|
|
65
65
|
"microdiff": "^1.3.2",
|
|
66
66
|
"typescript": "^5.3.3",
|
|
67
|
-
"@pandacss/error": "0.
|
|
68
|
-
"@pandacss/logger": "0.
|
|
69
|
-
"@pandacss/preset-base": "0.
|
|
70
|
-
"@pandacss/preset-panda": "0.
|
|
71
|
-
"@pandacss/shared": "0.
|
|
72
|
-
"@pandacss/types": "0.
|
|
67
|
+
"@pandacss/error": "0.28.0",
|
|
68
|
+
"@pandacss/logger": "0.28.0",
|
|
69
|
+
"@pandacss/preset-base": "0.28.0",
|
|
70
|
+
"@pandacss/preset-panda": "0.28.0",
|
|
71
|
+
"@pandacss/shared": "0.28.0",
|
|
72
|
+
"@pandacss/types": "0.28.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"pkg-types": "1.0.3"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
|
-
"build": "
|
|
79
|
-
"build-fast": "
|
|
78
|
+
"build": "tsup --tsconfig tsconfig.build.json --dts",
|
|
79
|
+
"build-fast": "tsup --no-dts",
|
|
80
80
|
"dev": "pnpm build-fast --watch"
|
|
81
81
|
}
|
|
82
82
|
}
|