@pandacss/config 0.26.1 → 0.27.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/index.d.mts +14 -4
- package/dist/index.d.ts +14 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +106 -4
- package/package.json +9 -10
- package/dist/chunk-DQCK3AP6.mjs +0 -108
- package/dist/diff-config.d.mts +0 -15
- package/dist/diff-config.d.ts +0 -15
- package/dist/diff-config.js +0 -142
- package/dist/diff-config.mjs +0 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
|
-
import { Config, ConfigTsOptions } from '@pandacss/types';
|
|
3
|
-
|
|
2
|
+
import { Config, ArtifactId, ConfigTsOptions } from '@pandacss/types';
|
|
3
|
+
import { Difference } from 'microdiff';
|
|
4
4
|
import { P as PathMapping } from './ts-config-paths-2lh9mwzL.mjs';
|
|
5
5
|
export { c as convertTsPathsToRegexes } from './ts-config-paths-2lh9mwzL.mjs';
|
|
6
6
|
import { TSConfig } from 'pkg-types';
|
|
7
7
|
export { mergeConfigs } from './merge-config.mjs';
|
|
8
|
-
import 'microdiff';
|
|
9
8
|
|
|
10
9
|
interface ConfigFileOptions {
|
|
11
10
|
cwd: string;
|
|
@@ -19,6 +18,17 @@ interface BundleConfigResult<T = Config> {
|
|
|
19
18
|
}
|
|
20
19
|
declare function bundleConfig(options: ConfigFileOptions): Promise<BundleConfigResult>;
|
|
21
20
|
|
|
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
|
+
|
|
22
32
|
declare function findConfig({ cwd, file }: Partial<ConfigFileOptions>): string | undefined;
|
|
23
33
|
|
|
24
34
|
interface GetDepsOptions {
|
|
@@ -50,4 +60,4 @@ declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promi
|
|
|
50
60
|
*/
|
|
51
61
|
declare function loadConfig(options: ConfigFileOptions): Promise<_pandacss_types.LoadConfigResult>;
|
|
52
62
|
|
|
53
|
-
export { type BundleConfigResult, type GetDepsOptions, bundleConfig, findConfig, getConfigDependencies, getResolvedConfig, loadConfig };
|
|
63
|
+
export { type BundleConfigResult, type DiffConfigResult, type GetDepsOptions, bundleConfig, diffConfigs, findConfig, getConfigDependencies, getResolvedConfig, loadConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
|
-
import { Config, ConfigTsOptions } from '@pandacss/types';
|
|
3
|
-
|
|
2
|
+
import { Config, ArtifactId, ConfigTsOptions } from '@pandacss/types';
|
|
3
|
+
import { Difference } from 'microdiff';
|
|
4
4
|
import { P as PathMapping } from './ts-config-paths-2lh9mwzL.js';
|
|
5
5
|
export { c as convertTsPathsToRegexes } from './ts-config-paths-2lh9mwzL.js';
|
|
6
6
|
import { TSConfig } from 'pkg-types';
|
|
7
7
|
export { mergeConfigs } from './merge-config.js';
|
|
8
|
-
import 'microdiff';
|
|
9
8
|
|
|
10
9
|
interface ConfigFileOptions {
|
|
11
10
|
cwd: string;
|
|
@@ -19,6 +18,17 @@ interface BundleConfigResult<T = Config> {
|
|
|
19
18
|
}
|
|
20
19
|
declare function bundleConfig(options: ConfigFileOptions): Promise<BundleConfigResult>;
|
|
21
20
|
|
|
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
|
+
|
|
22
32
|
declare function findConfig({ cwd, file }: Partial<ConfigFileOptions>): string | undefined;
|
|
23
33
|
|
|
24
34
|
interface GetDepsOptions {
|
|
@@ -50,4 +60,4 @@ declare function getResolvedConfig(config: ExtendableConfig, cwd: string): Promi
|
|
|
50
60
|
*/
|
|
51
61
|
declare function loadConfig(options: ConfigFileOptions): Promise<_pandacss_types.LoadConfigResult>;
|
|
52
62
|
|
|
53
|
-
export { type BundleConfigResult, type GetDepsOptions, bundleConfig, findConfig, getConfigDependencies, getResolvedConfig, loadConfig };
|
|
63
|
+
export { type BundleConfigResult, type DiffConfigResult, type GetDepsOptions, bundleConfig, diffConfigs, findConfig, getConfigDependencies, getResolvedConfig, loadConfig };
|
package/dist/index.js
CHANGED
|
@@ -306,7 +306,7 @@ function getDeps(opts, fromAlias) {
|
|
|
306
306
|
}
|
|
307
307
|
try {
|
|
308
308
|
const found = import_typescript.default.resolveModuleName(mod, absoluteFile, compilerOptions, import_typescript.default.sys).resolvedModule;
|
|
309
|
-
if (found && found.extension
|
|
309
|
+
if (found && found.extension.endsWith("ts")) {
|
|
310
310
|
getDeps(Object.assign({}, nextOpts, { filename: found.resolvedFileName }));
|
|
311
311
|
return;
|
|
312
312
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mergeConfigs
|
|
3
3
|
} from "./chunk-PROY5XLZ.mjs";
|
|
4
|
-
import {
|
|
5
|
-
diffConfigs
|
|
6
|
-
} from "./chunk-DQCK3AP6.mjs";
|
|
7
4
|
import {
|
|
8
5
|
resolveTsPathPattern
|
|
9
6
|
} from "./chunk-RPIVZP2I.mjs";
|
|
@@ -57,6 +54,111 @@ async function bundleConfig(options) {
|
|
|
57
54
|
};
|
|
58
55
|
}
|
|
59
56
|
|
|
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
|
+
|
|
60
162
|
// src/get-mod-deps.ts
|
|
61
163
|
import fs from "fs";
|
|
62
164
|
import path from "path";
|
|
@@ -149,7 +251,7 @@ function getDeps(opts, fromAlias) {
|
|
|
149
251
|
}
|
|
150
252
|
try {
|
|
151
253
|
const found = ts.resolveModuleName(mod, absoluteFile, compilerOptions, ts.sys).resolvedModule;
|
|
152
|
-
if (found && found.extension
|
|
254
|
+
if (found && found.extension.endsWith("ts")) {
|
|
153
255
|
getDeps(Object.assign({}, nextOpts, { filename: found.resolvedFileName }));
|
|
154
256
|
return;
|
|
155
257
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Find and load panda config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -61,23 +61,22 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"bundle-n-require": "^1.0.1",
|
|
63
63
|
"escalade": "3.1.1",
|
|
64
|
-
"jiti": "^1.19.1",
|
|
65
64
|
"merge-anything": "^5.1.7",
|
|
66
65
|
"microdiff": "^1.3.2",
|
|
67
66
|
"typescript": "^5.3.3",
|
|
68
|
-
"@pandacss/error": "0.
|
|
69
|
-
"@pandacss/logger": "0.
|
|
70
|
-
"@pandacss/preset-base": "0.
|
|
71
|
-
"@pandacss/preset-panda": "0.
|
|
72
|
-
"@pandacss/shared": "0.
|
|
73
|
-
"@pandacss/types": "0.
|
|
67
|
+
"@pandacss/error": "0.27.0",
|
|
68
|
+
"@pandacss/logger": "0.27.0",
|
|
69
|
+
"@pandacss/preset-base": "0.27.0",
|
|
70
|
+
"@pandacss/preset-panda": "0.27.0",
|
|
71
|
+
"@pandacss/shared": "0.27.0",
|
|
72
|
+
"@pandacss/types": "0.27.0"
|
|
74
73
|
},
|
|
75
74
|
"devDependencies": {
|
|
76
75
|
"pkg-types": "1.0.3"
|
|
77
76
|
},
|
|
78
77
|
"scripts": {
|
|
79
|
-
"build": "pnpm tsup --dts",
|
|
80
|
-
"build-fast": "pnpm tsup --no-dts",
|
|
78
|
+
"build": "pnpm tsup --tsconfig tsconfig.build.json src/index.ts src/merge-config.ts src/resolve-ts-path-pattern.ts --format=esm,cjs --shims --dts",
|
|
79
|
+
"build-fast": "pnpm tsup src/index.ts src/merge-config.ts src/resolve-ts-path-pattern.ts --format=esm,cjs --shims --no-dts",
|
|
81
80
|
"dev": "pnpm build-fast --watch"
|
|
82
81
|
}
|
|
83
82
|
}
|
package/dist/chunk-DQCK3AP6.mjs
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/diff-config.d.mts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ArtifactId, Config } from '@pandacss/types';
|
|
2
|
-
import { Difference } from 'microdiff';
|
|
3
|
-
|
|
4
|
-
interface DiffConfigResult {
|
|
5
|
-
hasConfigChanged: boolean;
|
|
6
|
-
artifacts: Set<ArtifactId>;
|
|
7
|
-
diffs: Difference[];
|
|
8
|
-
}
|
|
9
|
-
type ConfigOrFn = Config | (() => Config);
|
|
10
|
-
/**
|
|
11
|
-
* Diff the two config objects and return the list of affected properties
|
|
12
|
-
*/
|
|
13
|
-
declare function diffConfigs(config: ConfigOrFn, prevConfig: Config | undefined): DiffConfigResult;
|
|
14
|
-
|
|
15
|
-
export { type DiffConfigResult, diffConfigs };
|
package/dist/diff-config.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ArtifactId, Config } from '@pandacss/types';
|
|
2
|
-
import { Difference } from 'microdiff';
|
|
3
|
-
|
|
4
|
-
interface DiffConfigResult {
|
|
5
|
-
hasConfigChanged: boolean;
|
|
6
|
-
artifacts: Set<ArtifactId>;
|
|
7
|
-
diffs: Difference[];
|
|
8
|
-
}
|
|
9
|
-
type ConfigOrFn = Config | (() => Config);
|
|
10
|
-
/**
|
|
11
|
-
* Diff the two config objects and return the list of affected properties
|
|
12
|
-
*/
|
|
13
|
-
declare function diffConfigs(config: ConfigOrFn, prevConfig: Config | undefined): DiffConfigResult;
|
|
14
|
-
|
|
15
|
-
export { type DiffConfigResult, diffConfigs };
|
package/dist/diff-config.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
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
|
-
});
|