@pandacss/node 1.11.4 → 1.12.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.js +66 -272
- package/dist/index.mjs +58 -258
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.14_supports-col_417629c956fdcd14cb97372bbc8200e9/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.
|
|
38
|
+
"../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.14_supports-col_417629c956fdcd14cb97372bbc8200e9/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
39
|
"use strict";
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -374,7 +374,7 @@ async function buildInfo(ctx, outfile) {
|
|
|
374
374
|
|
|
375
375
|
// src/builder.ts
|
|
376
376
|
init_cjs_shims();
|
|
377
|
-
var
|
|
377
|
+
var import_config5 = require("@pandacss/config");
|
|
378
378
|
var import_logger5 = require("@pandacss/logger");
|
|
379
379
|
var import_shared2 = require("@pandacss/shared");
|
|
380
380
|
var import_fs = require("fs");
|
|
@@ -402,11 +402,31 @@ async function codegen(ctx, ids) {
|
|
|
402
402
|
|
|
403
403
|
// src/config.ts
|
|
404
404
|
init_cjs_shims();
|
|
405
|
-
var
|
|
405
|
+
var import_config4 = require("@pandacss/config");
|
|
406
|
+
|
|
407
|
+
// src/auto-plugins.ts
|
|
408
|
+
init_cjs_shims();
|
|
409
|
+
var import_config = require("@pandacss/config");
|
|
406
410
|
var import_plugin_lightningcss = require("@pandacss/plugin-lightningcss");
|
|
407
411
|
var import_plugin_svelte = require("@pandacss/plugin-svelte");
|
|
408
412
|
var import_plugin_vue = require("@pandacss/plugin-vue");
|
|
409
413
|
var import_browserslist = __toESM(require("browserslist"));
|
|
414
|
+
var RESOLVED_HOOKS_NAME = "__resolved__";
|
|
415
|
+
function getAutoPlugins(config) {
|
|
416
|
+
const plugins = [(0, import_plugin_vue.pluginVue)(), (0, import_plugin_svelte.pluginSvelte)()];
|
|
417
|
+
if (config.lightningcss) {
|
|
418
|
+
plugins.push((0, import_plugin_lightningcss.pluginLightningcss)());
|
|
419
|
+
}
|
|
420
|
+
return plugins;
|
|
421
|
+
}
|
|
422
|
+
function applyAutoPlugins(conf, cwd) {
|
|
423
|
+
if (conf.config.lightningcss && !conf.config.browserslist) {
|
|
424
|
+
conf.config.browserslist ||= import_browserslist.default.findConfig(cwd)?.defaults;
|
|
425
|
+
}
|
|
426
|
+
const autoPlugins = getAutoPlugins(conf.config);
|
|
427
|
+
conf.hooks = (0, import_config.mergeHooks)([...autoPlugins, { name: RESOLVED_HOOKS_NAME, hooks: conf.hooks }]);
|
|
428
|
+
conf.config.plugins = [...autoPlugins, ...conf.config.plugins ?? []];
|
|
429
|
+
}
|
|
410
430
|
|
|
411
431
|
// src/create-context.ts
|
|
412
432
|
init_cjs_shims();
|
|
@@ -1758,7 +1778,7 @@ var createBox = (options) => boxen(options.content, {
|
|
|
1758
1778
|
|
|
1759
1779
|
// src/diff-engine.ts
|
|
1760
1780
|
init_cjs_shims();
|
|
1761
|
-
var
|
|
1781
|
+
var import_config2 = require("@pandacss/config");
|
|
1762
1782
|
var import_generator = require("@pandacss/generator");
|
|
1763
1783
|
var DiffEngine = class {
|
|
1764
1784
|
constructor(ctx) {
|
|
@@ -1770,9 +1790,10 @@ var DiffEngine = class {
|
|
|
1770
1790
|
* Reload config from disk and refresh the context
|
|
1771
1791
|
*/
|
|
1772
1792
|
async reloadConfigAndRefreshContext(fn) {
|
|
1773
|
-
const conf = await (0,
|
|
1793
|
+
const conf = await (0, import_config2.loadConfig)({ cwd: this.ctx.config.cwd, file: this.ctx.conf.path });
|
|
1774
1794
|
const { tsconfig, tsconfigFile, tsOptions } = this.ctx.conf;
|
|
1775
1795
|
Object.assign(conf, { tsconfig, tsconfigFile, tsOptions });
|
|
1796
|
+
applyAutoPlugins(conf, this.ctx.config.cwd);
|
|
1776
1797
|
return this.refresh(conf, fn);
|
|
1777
1798
|
}
|
|
1778
1799
|
/**
|
|
@@ -1781,7 +1802,7 @@ var DiffEngine = class {
|
|
|
1781
1802
|
* Returns the list of affected artifacts/engines
|
|
1782
1803
|
*/
|
|
1783
1804
|
refresh(conf, fn) {
|
|
1784
|
-
const affected = (0,
|
|
1805
|
+
const affected = (0, import_config2.diffConfigs)(() => conf.deserialize(), this.prevConfig);
|
|
1785
1806
|
if (!affected.hasConfigChanged || !this.prevConfig) return affected;
|
|
1786
1807
|
fn?.(conf);
|
|
1787
1808
|
this.prevConfig = conf.deserialize();
|
|
@@ -1859,8 +1880,8 @@ var nodeRuntime = {
|
|
|
1859
1880
|
readDirSync: import_fs_extra.default.readdirSync,
|
|
1860
1881
|
rmDirSync: import_fs_extra.default.emptyDirSync,
|
|
1861
1882
|
rmFileSync: import_fs_extra.default.removeSync,
|
|
1862
|
-
ensureDirSync(
|
|
1863
|
-
return import_fs_extra.default.ensureDirSync(
|
|
1883
|
+
ensureDirSync(path4) {
|
|
1884
|
+
return import_fs_extra.default.ensureDirSync(path4);
|
|
1864
1885
|
},
|
|
1865
1886
|
watch(options) {
|
|
1866
1887
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -1871,8 +1892,8 @@ var nodeRuntime = {
|
|
|
1871
1892
|
const watcher = import_chokidar.default.watch(dirnames, {
|
|
1872
1893
|
usePolling: poll,
|
|
1873
1894
|
cwd,
|
|
1874
|
-
ignored(
|
|
1875
|
-
const relativePath = (0, import_path2.relative)(workingDir,
|
|
1895
|
+
ignored(path4, stats) {
|
|
1896
|
+
const relativePath = (0, import_path2.relative)(workingDir, path4);
|
|
1876
1897
|
return !!stats?.isFile() && !isValidPath(relativePath);
|
|
1877
1898
|
},
|
|
1878
1899
|
ignoreInitial: true,
|
|
@@ -2026,13 +2047,13 @@ var PandaContext = class extends import_generator2.Generator {
|
|
|
2026
2047
|
});
|
|
2027
2048
|
};
|
|
2028
2049
|
writeSplitCss = async (sheet) => {
|
|
2029
|
-
const { path: pathUtil, fs:
|
|
2050
|
+
const { path: pathUtil, fs: fs3 } = this.runtime;
|
|
2030
2051
|
const rootDir = this.paths.root;
|
|
2031
2052
|
const stylesDir = [...rootDir, "styles"];
|
|
2032
2053
|
const artifacts = this.getSplitCssArtifacts(sheet);
|
|
2033
2054
|
const subDirs = new Set([...artifacts.recipes, ...artifacts.themes].map((a) => a.dir).filter(Boolean));
|
|
2034
|
-
|
|
2035
|
-
subDirs.forEach((dir) =>
|
|
2055
|
+
fs3.ensureDirSync(pathUtil.join(...stylesDir));
|
|
2056
|
+
subDirs.forEach((dir) => fs3.ensureDirSync(pathUtil.join(...stylesDir, dir)));
|
|
2036
2057
|
const styleFiles = [];
|
|
2037
2058
|
for (const layer of artifacts.layers) {
|
|
2038
2059
|
styleFiles.push({ file: layer.file, code: layer.code });
|
|
@@ -2101,227 +2122,13 @@ var PandaContext = class extends import_generator2.Generator {
|
|
|
2101
2122
|
|
|
2102
2123
|
// src/load-tsconfig.ts
|
|
2103
2124
|
init_cjs_shims();
|
|
2104
|
-
var
|
|
2105
|
-
var import_node_path2 = __toESM(require("path"));
|
|
2106
|
-
|
|
2107
|
-
// src/tsconfig-utils.ts
|
|
2108
|
-
init_cjs_shims();
|
|
2109
|
-
var import_node_fs = require("fs");
|
|
2125
|
+
var import_config3 = require("@pandacss/config");
|
|
2110
2126
|
var import_node_path = __toESM(require("path"));
|
|
2111
|
-
async function resolveDirectTsconfigJson(filename) {
|
|
2112
|
-
if (import_node_path.default.extname(filename) !== ".json") return null;
|
|
2113
|
-
const resolved = import_node_path.default.resolve(filename);
|
|
2114
|
-
try {
|
|
2115
|
-
const stat = await import_node_fs.promises.stat(resolved);
|
|
2116
|
-
if (stat.isFile() || stat.isFIFO()) return resolved;
|
|
2117
|
-
throw new Error(`${filename} exists but is not a regular file.`);
|
|
2118
|
-
} catch (e) {
|
|
2119
|
-
if (e && typeof e === "object" && "code" in e && e.code === "ENOENT") {
|
|
2120
|
-
return null;
|
|
2121
|
-
}
|
|
2122
|
-
throw e;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
async function findClosestTsconfig(filename, root, configName = "tsconfig.json") {
|
|
2126
|
-
const resolvedRoot = import_node_path.default.resolve(root);
|
|
2127
|
-
let dir = import_node_path.default.dirname(import_node_path.default.resolve(filename));
|
|
2128
|
-
for (; ; ) {
|
|
2129
|
-
const candidate = import_node_path.default.join(dir, configName);
|
|
2130
|
-
try {
|
|
2131
|
-
const stat = await import_node_fs.promises.stat(candidate);
|
|
2132
|
-
if (stat.isFile() || stat.isFIFO()) {
|
|
2133
|
-
return candidate;
|
|
2134
|
-
}
|
|
2135
|
-
} catch {
|
|
2136
|
-
}
|
|
2137
|
-
if (dir === resolvedRoot || import_node_path.default.dirname(dir) === dir) {
|
|
2138
|
-
return null;
|
|
2139
|
-
}
|
|
2140
|
-
dir = import_node_path.default.dirname(dir);
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
function resolveBaseUrlForCompilerOptions(baseUrl, tsconfigFile, cwd) {
|
|
2144
|
-
if (baseUrl == null) return cwd;
|
|
2145
|
-
if (baseUrl.startsWith("${")) return baseUrl;
|
|
2146
|
-
if (import_node_path.default.isAbsolute(baseUrl)) return baseUrl;
|
|
2147
|
-
return import_node_path.default.resolve(import_node_path.default.dirname(tsconfigFile), baseUrl);
|
|
2148
|
-
}
|
|
2149
|
-
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
2150
|
-
function resolveReferencedTsconfigPath(refPath, fromDir, configName = "tsconfig.json") {
|
|
2151
|
-
const p = refPath.endsWith(".json") ? refPath : import_node_path.default.join(refPath, configName);
|
|
2152
|
-
return import_node_path.default.resolve(fromDir, p);
|
|
2153
|
-
}
|
|
2154
|
-
async function resolveSolutionTsconfigForFile(absoluteFilename, rootTsconfigPath, rootParsed, getTsconfigModule) {
|
|
2155
|
-
const { parseTsconfig } = getTsconfigModule;
|
|
2156
|
-
if (isSourceFileIncludedInTsconfig(absoluteFilename, rootTsconfigPath, rootParsed)) {
|
|
2157
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2158
|
-
}
|
|
2159
|
-
const refs = rootParsed.references;
|
|
2160
|
-
if (!refs?.length) {
|
|
2161
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2162
|
-
}
|
|
2163
|
-
if (!SOURCE_EXTENSIONS.some((ext) => absoluteFilename.endsWith(ext))) {
|
|
2164
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2165
|
-
}
|
|
2166
|
-
const rootDir = import_node_path.default.dirname(rootTsconfigPath);
|
|
2167
|
-
for (const ref of refs) {
|
|
2168
|
-
const refPath = resolveReferencedTsconfigPath(ref.path, rootDir);
|
|
2169
|
-
try {
|
|
2170
|
-
await import_node_fs.promises.access(refPath);
|
|
2171
|
-
} catch {
|
|
2172
|
-
continue;
|
|
2173
|
-
}
|
|
2174
|
-
const childParsed = parseTsconfig(refPath);
|
|
2175
|
-
if (isSourceFileIncludedInTsconfig(absoluteFilename, refPath, childParsed)) {
|
|
2176
|
-
return { tsconfig: childParsed, tsconfigFile: refPath };
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2179
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2180
|
-
}
|
|
2181
|
-
var POSIX_SEP_RE = new RegExp("\\" + import_node_path.default.posix.sep, "g");
|
|
2182
|
-
var NATIVE_SEP_RE = new RegExp("\\" + import_node_path.default.sep, "g");
|
|
2183
|
-
var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
|
|
2184
|
-
var GLOB_ALL_PATTERN = `**/*`;
|
|
2185
|
-
var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
2186
|
-
var JS_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
|
|
2187
|
-
var TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
|
|
2188
|
-
var TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
2189
|
-
var TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
2190
|
-
var IS_POSIX = import_node_path.default.posix.sep === import_node_path.default.sep;
|
|
2191
|
-
var native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, import_node_path.default.posix.sep);
|
|
2192
|
-
var resolve2posix = IS_POSIX ? (dir, filename) => dir ? import_node_path.default.resolve(dir, filename) : import_node_path.default.resolve(filename) : (dir, filename) => {
|
|
2193
|
-
const posix2native = (f) => f.replace(POSIX_SEP_RE, import_node_path.default.sep);
|
|
2194
|
-
return native2posix(
|
|
2195
|
-
dir ? import_node_path.default.resolve(posix2native(dir), posix2native(filename)) : import_node_path.default.resolve(posix2native(filename))
|
|
2196
|
-
);
|
|
2197
|
-
};
|
|
2198
|
-
function isGlobMatch(filename, dir, patterns, allowJs) {
|
|
2199
|
-
const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
|
|
2200
|
-
return patterns.some((patternArg) => {
|
|
2201
|
-
let pattern = patternArg;
|
|
2202
|
-
let lastWildcardIndex = pattern.length;
|
|
2203
|
-
let hasWildcard = false;
|
|
2204
|
-
let hasExtension = false;
|
|
2205
|
-
let hasSlash = false;
|
|
2206
|
-
let lastSlashIndex = -1;
|
|
2207
|
-
for (let i = pattern.length - 1; i > -1; i--) {
|
|
2208
|
-
const c = pattern[i];
|
|
2209
|
-
if (!hasWildcard) {
|
|
2210
|
-
if (c === "*" || c === "?") {
|
|
2211
|
-
lastWildcardIndex = i;
|
|
2212
|
-
hasWildcard = true;
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
if (!hasSlash) {
|
|
2216
|
-
if (c === ".") {
|
|
2217
|
-
hasExtension = true;
|
|
2218
|
-
} else if (c === "/") {
|
|
2219
|
-
lastSlashIndex = i;
|
|
2220
|
-
hasSlash = true;
|
|
2221
|
-
}
|
|
2222
|
-
}
|
|
2223
|
-
if (hasWildcard && hasSlash) {
|
|
2224
|
-
break;
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
|
|
2228
|
-
pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
|
|
2229
|
-
lastWildcardIndex = pattern.length - 1;
|
|
2230
|
-
hasWildcard = true;
|
|
2231
|
-
}
|
|
2232
|
-
if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
|
|
2233
|
-
return false;
|
|
2234
|
-
}
|
|
2235
|
-
if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) {
|
|
2236
|
-
return false;
|
|
2237
|
-
}
|
|
2238
|
-
if (pattern === GLOB_ALL_PATTERN) {
|
|
2239
|
-
return filename.startsWith(`${dir}/`);
|
|
2240
|
-
}
|
|
2241
|
-
const resolvedPattern = resolve2posix(dir, pattern);
|
|
2242
|
-
let firstWildcardIndex = -1;
|
|
2243
|
-
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
2244
|
-
if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
|
|
2245
|
-
firstWildcardIndex = i;
|
|
2246
|
-
hasWildcard = true;
|
|
2247
|
-
break;
|
|
2248
|
-
}
|
|
2249
|
-
}
|
|
2250
|
-
if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
|
|
2251
|
-
return false;
|
|
2252
|
-
}
|
|
2253
|
-
if (!hasWildcard) {
|
|
2254
|
-
return filename === resolvedPattern;
|
|
2255
|
-
}
|
|
2256
|
-
if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) {
|
|
2257
|
-
return true;
|
|
2258
|
-
}
|
|
2259
|
-
if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
|
|
2260
|
-
return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
|
|
2261
|
-
}
|
|
2262
|
-
const regex2 = pattern2regex(resolvedPattern, allowJs);
|
|
2263
|
-
PATTERN_REGEX_CACHE.set(resolvedPattern, regex2);
|
|
2264
|
-
return regex2.test(filename);
|
|
2265
|
-
});
|
|
2266
|
-
}
|
|
2267
|
-
function pattern2regex(resolvedPattern, allowJs) {
|
|
2268
|
-
let regexStr = "^";
|
|
2269
|
-
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
2270
|
-
const char = resolvedPattern[i];
|
|
2271
|
-
if (char === "?") {
|
|
2272
|
-
regexStr += "[^\\/]";
|
|
2273
|
-
continue;
|
|
2274
|
-
}
|
|
2275
|
-
if (char === "*") {
|
|
2276
|
-
if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
|
|
2277
|
-
i += 2;
|
|
2278
|
-
regexStr += "(?:[^\\/]*\\/)*";
|
|
2279
|
-
continue;
|
|
2280
|
-
}
|
|
2281
|
-
regexStr += "[^\\/]*";
|
|
2282
|
-
continue;
|
|
2283
|
-
}
|
|
2284
|
-
if ("/.+^${}()|[]\\".includes(char)) {
|
|
2285
|
-
regexStr += "\\";
|
|
2286
|
-
}
|
|
2287
|
-
regexStr += char;
|
|
2288
|
-
}
|
|
2289
|
-
if (resolvedPattern.endsWith("*")) {
|
|
2290
|
-
regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
|
|
2291
|
-
}
|
|
2292
|
-
regexStr += "$";
|
|
2293
|
-
return new RegExp(regexStr);
|
|
2294
|
-
}
|
|
2295
|
-
function isIncluded(filename, tsconfigFile, tsconfig) {
|
|
2296
|
-
const dir = native2posix(import_node_path.default.dirname(tsconfigFile));
|
|
2297
|
-
const files = (tsconfig.files || []).map((file) => resolve2posix(dir, file));
|
|
2298
|
-
const absoluteFilename = resolve2posix(null, filename);
|
|
2299
|
-
if (files.includes(filename)) {
|
|
2300
|
-
return true;
|
|
2301
|
-
}
|
|
2302
|
-
const allowJs = tsconfig.compilerOptions?.allowJs;
|
|
2303
|
-
const included = isGlobMatch(
|
|
2304
|
-
absoluteFilename,
|
|
2305
|
-
dir,
|
|
2306
|
-
tsconfig.include || (tsconfig.files ? [] : [GLOB_ALL_PATTERN]),
|
|
2307
|
-
allowJs
|
|
2308
|
-
);
|
|
2309
|
-
if (included) {
|
|
2310
|
-
const excluded = isGlobMatch(absoluteFilename, dir, tsconfig.exclude || [], allowJs);
|
|
2311
|
-
return !excluded;
|
|
2312
|
-
}
|
|
2313
|
-
return false;
|
|
2314
|
-
}
|
|
2315
|
-
function isSourceFileIncludedInTsconfig(absoluteFilename, tsconfigFile, tsconfig) {
|
|
2316
|
-
return isIncluded(absoluteFilename, tsconfigFile, tsconfig);
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
// src/load-tsconfig.ts
|
|
2320
2127
|
async function loadTsConfig(conf, cwd) {
|
|
2321
2128
|
const root = cwd;
|
|
2322
|
-
let tsconfigFile = await resolveDirectTsconfigJson(conf.path);
|
|
2129
|
+
let tsconfigFile = await (0, import_config3.resolveDirectTsconfigJson)(conf.path);
|
|
2323
2130
|
if (!tsconfigFile) {
|
|
2324
|
-
tsconfigFile = await findClosestTsconfig(conf.path, root, "tsconfig.json");
|
|
2131
|
+
tsconfigFile = await (0, import_config3.findClosestTsconfig)(conf.path, root, "tsconfig.json");
|
|
2325
2132
|
}
|
|
2326
2133
|
if (!tsconfigFile) {
|
|
2327
2134
|
return {
|
|
@@ -2331,8 +2138,8 @@ async function loadTsConfig(conf, cwd) {
|
|
|
2331
2138
|
}
|
|
2332
2139
|
const gtc = await import("get-tsconfig");
|
|
2333
2140
|
const rootParsed = gtc.parseTsconfig(tsconfigFile);
|
|
2334
|
-
const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await resolveSolutionTsconfigForFile(
|
|
2335
|
-
|
|
2141
|
+
const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await (0, import_config3.resolveSolutionTsconfigForFile)(
|
|
2142
|
+
import_node_path.default.resolve(conf.path),
|
|
2336
2143
|
tsconfigFile,
|
|
2337
2144
|
rootParsed,
|
|
2338
2145
|
gtc
|
|
@@ -2346,9 +2153,9 @@ async function loadTsConfig(conf, cwd) {
|
|
|
2346
2153
|
const baseUrl = compilerOptions.baseUrl;
|
|
2347
2154
|
result.tsOptions = {
|
|
2348
2155
|
baseUrl,
|
|
2349
|
-
pathMappings: (0,
|
|
2156
|
+
pathMappings: (0, import_config3.convertTsPathsToRegexes)(
|
|
2350
2157
|
compilerOptions.paths,
|
|
2351
|
-
resolveBaseUrlForCompilerOptions(baseUrl, effectiveTsconfigPath, cwd)
|
|
2158
|
+
(0, import_config3.resolveBaseUrlForCompilerOptions)(baseUrl, effectiveTsconfigPath, cwd)
|
|
2352
2159
|
)
|
|
2353
2160
|
};
|
|
2354
2161
|
}
|
|
@@ -2356,30 +2163,17 @@ async function loadTsConfig(conf, cwd) {
|
|
|
2356
2163
|
}
|
|
2357
2164
|
|
|
2358
2165
|
// src/config.ts
|
|
2359
|
-
var RESOLVED_HOOKS_NAME = "__resolved__";
|
|
2360
|
-
function getAutoPlugins(config) {
|
|
2361
|
-
const plugins = [(0, import_plugin_vue.pluginVue)(), (0, import_plugin_svelte.pluginSvelte)()];
|
|
2362
|
-
if (config.lightningcss) {
|
|
2363
|
-
plugins.push((0, import_plugin_lightningcss.pluginLightningcss)());
|
|
2364
|
-
}
|
|
2365
|
-
return plugins;
|
|
2366
|
-
}
|
|
2367
2166
|
async function loadConfigAndCreateContext(options = {}) {
|
|
2368
2167
|
const { config, configPath } = options;
|
|
2369
2168
|
const cwd = options.cwd ?? options?.config?.cwd ?? process.cwd();
|
|
2370
|
-
const conf = await (0,
|
|
2169
|
+
const conf = await (0, import_config4.loadConfig)({ cwd, file: configPath });
|
|
2371
2170
|
if (config) {
|
|
2372
2171
|
Object.assign(conf.config, config);
|
|
2373
2172
|
}
|
|
2374
2173
|
if (options.cwd) {
|
|
2375
2174
|
conf.config.cwd = options.cwd;
|
|
2376
2175
|
}
|
|
2377
|
-
|
|
2378
|
-
conf.config.browserslist ||= import_browserslist.default.findConfig(cwd)?.defaults;
|
|
2379
|
-
}
|
|
2380
|
-
const autoPlugins = getAutoPlugins(conf.config);
|
|
2381
|
-
conf.hooks = (0, import_config3.mergeHooks)([...autoPlugins, { name: RESOLVED_HOOKS_NAME, hooks: conf.hooks }]);
|
|
2382
|
-
conf.config.plugins = [...autoPlugins, ...conf.config.plugins ?? []];
|
|
2176
|
+
applyAutoPlugins(conf, cwd);
|
|
2383
2177
|
const tsConfResult = await loadTsConfig(conf, cwd);
|
|
2384
2178
|
if (tsConfResult) {
|
|
2385
2179
|
Object.assign(conf, tsConfResult);
|
|
@@ -2446,7 +2240,7 @@ var Builder = class {
|
|
|
2446
2240
|
setConfigDependencies(options) {
|
|
2447
2241
|
const tsOptions = this.context?.conf.tsOptions ?? { baseUrl: void 0, pathMappings: [] };
|
|
2448
2242
|
const compilerOptions = this.context?.conf.tsconfig?.compilerOptions ?? {};
|
|
2449
|
-
const { deps: foundDeps } = (0,
|
|
2243
|
+
const { deps: foundDeps } = (0, import_config5.getConfigDependencies)(options.configPath, tsOptions, compilerOptions);
|
|
2450
2244
|
const cwd = options?.cwd ?? this.context?.config.cwd ?? process.cwd();
|
|
2451
2245
|
const configDeps = /* @__PURE__ */ new Set([
|
|
2452
2246
|
...foundDeps,
|
|
@@ -2460,7 +2254,7 @@ var Builder = class {
|
|
|
2460
2254
|
}
|
|
2461
2255
|
setup = async (options = {}) => {
|
|
2462
2256
|
import_logger5.logger.debug("builder", "\u{1F6A7} Setup");
|
|
2463
|
-
const configPath = options.configPath ?? (0,
|
|
2257
|
+
const configPath = options.configPath ?? (0, import_config5.findConfig)({ cwd: options.cwd });
|
|
2464
2258
|
this.setConfigDependencies({ configPath, cwd: options.cwd });
|
|
2465
2259
|
if (!this.context) {
|
|
2466
2260
|
return this.setupContext({ configPath, cwd: options.cwd });
|
|
@@ -2586,8 +2380,8 @@ var Builder = class {
|
|
|
2586
2380
|
// src/cpu-profile.ts
|
|
2587
2381
|
init_cjs_shims();
|
|
2588
2382
|
var import_logger6 = require("@pandacss/logger");
|
|
2589
|
-
var
|
|
2590
|
-
var
|
|
2383
|
+
var import_node_fs = __toESM(require("fs"));
|
|
2384
|
+
var import_node_path2 = __toESM(require("path"));
|
|
2591
2385
|
var import_node_readline = __toESM(require("readline"));
|
|
2592
2386
|
var startProfiling = async (cwd, prefix, isWatching) => {
|
|
2593
2387
|
const inspector = await import("inspector").then((r) => r.default);
|
|
@@ -2651,8 +2445,8 @@ var startProfiling = async (cwd, prefix, isWatching) => {
|
|
|
2651
2445
|
const date = /* @__PURE__ */ new Date();
|
|
2652
2446
|
const timestamp = date.toISOString().replace(/[-:.]/g, "");
|
|
2653
2447
|
const title = `panda-${prefix}-${timestamp}`;
|
|
2654
|
-
const outfile =
|
|
2655
|
-
|
|
2448
|
+
const outfile = import_node_path2.default.join(cwd, `${title}.cpuprofile`);
|
|
2449
|
+
import_node_fs.default.writeFileSync(outfile, JSON.stringify(params.profile));
|
|
2656
2450
|
import_logger6.logger.info("cpu-prof", outfile);
|
|
2657
2451
|
cb?.();
|
|
2658
2452
|
});
|
|
@@ -2706,12 +2500,12 @@ async function debug(ctx, options) {
|
|
|
2706
2500
|
const files = ctx.getFiles();
|
|
2707
2501
|
const measureTotal = import_logger8.logger.time.debug(`Done parsing ${files.length} files`);
|
|
2708
2502
|
ctx.config.minify = false;
|
|
2709
|
-
const { fs:
|
|
2503
|
+
const { fs: fs3, path: path4 } = ctx.runtime;
|
|
2710
2504
|
const outdir = options.outdir;
|
|
2711
2505
|
if (!options.dry && outdir) {
|
|
2712
|
-
|
|
2506
|
+
fs3.ensureDirSync(outdir);
|
|
2713
2507
|
import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/config.json`)}`);
|
|
2714
|
-
await
|
|
2508
|
+
await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2715
2509
|
}
|
|
2716
2510
|
if (options.onlyConfig) {
|
|
2717
2511
|
measureTotal();
|
|
@@ -2734,14 +2528,14 @@ async function debug(ctx, options) {
|
|
|
2734
2528
|
if (outdir) {
|
|
2735
2529
|
filesWithCss.push(file);
|
|
2736
2530
|
const parsedPath = (0, import_path5.parse)(file);
|
|
2737
|
-
const relative2 =
|
|
2738
|
-
const astJsonPath = `${relative2}${
|
|
2739
|
-
const cssPath = `${relative2}${
|
|
2531
|
+
const relative2 = path4.relative(ctx.config.cwd, parsedPath.dir);
|
|
2532
|
+
const astJsonPath = `${relative2}${path4.sep}${parsedPath.name}.ast.json`.replaceAll(path4.sep, "__");
|
|
2533
|
+
const cssPath = `${relative2}${path4.sep}${parsedPath.name}.css`.replaceAll(path4.sep, "__");
|
|
2740
2534
|
import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2741
2535
|
import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/${cssPath}`)}`);
|
|
2742
2536
|
return Promise.allSettled([
|
|
2743
|
-
|
|
2744
|
-
|
|
2537
|
+
fs3.writeFile(`${outdir}${path4.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2538
|
+
fs3.writeFile(`${outdir}${path4.sep}${cssPath}`, css)
|
|
2745
2539
|
]);
|
|
2746
2540
|
}
|
|
2747
2541
|
});
|
|
@@ -2836,16 +2630,16 @@ function setupGitIgnore(ctx) {
|
|
|
2836
2630
|
// src/logstream.ts
|
|
2837
2631
|
init_cjs_shims();
|
|
2838
2632
|
var import_logger10 = require("@pandacss/logger");
|
|
2839
|
-
var
|
|
2840
|
-
var
|
|
2633
|
+
var import_node_fs2 = __toESM(require("fs"));
|
|
2634
|
+
var import_node_path3 = __toESM(require("path"));
|
|
2841
2635
|
var setLogStream = (options) => {
|
|
2842
2636
|
const { cwd = process.cwd() } = options;
|
|
2843
2637
|
let stream;
|
|
2844
2638
|
if (options.logfile) {
|
|
2845
|
-
const outPath =
|
|
2639
|
+
const outPath = import_node_path3.default.resolve(cwd, options.logfile);
|
|
2846
2640
|
ensure(outPath);
|
|
2847
2641
|
import_logger10.logger.info("logfile", outPath);
|
|
2848
|
-
stream =
|
|
2642
|
+
stream = import_node_fs2.default.createWriteStream(outPath, { flags: "a" });
|
|
2849
2643
|
import_logger10.logger.onLog = (entry) => {
|
|
2850
2644
|
stream?.write(JSON.stringify(entry) + "\n");
|
|
2851
2645
|
};
|
|
@@ -2863,14 +2657,14 @@ var setLogStream = (options) => {
|
|
|
2863
2657
|
};
|
|
2864
2658
|
};
|
|
2865
2659
|
var ensure = (outPath) => {
|
|
2866
|
-
const dirname2 =
|
|
2867
|
-
|
|
2660
|
+
const dirname2 = import_node_path3.default.dirname(outPath);
|
|
2661
|
+
import_node_fs2.default.mkdirSync(dirname2, { recursive: true });
|
|
2868
2662
|
return outPath;
|
|
2869
2663
|
};
|
|
2870
2664
|
|
|
2871
2665
|
// src/setup-config.ts
|
|
2872
2666
|
init_cjs_shims();
|
|
2873
|
-
var
|
|
2667
|
+
var import_config8 = require("@pandacss/config");
|
|
2874
2668
|
var import_core = require("@pandacss/core");
|
|
2875
2669
|
var import_logger11 = require("@pandacss/logger");
|
|
2876
2670
|
var import_shared3 = require("@pandacss/shared");
|
|
@@ -2883,7 +2677,7 @@ async function setupConfig(cwd, opts = {}) {
|
|
|
2883
2677
|
const { force, outExtension, jsxFramework, syntax, outdir = "styled-system" } = opts;
|
|
2884
2678
|
let configFile;
|
|
2885
2679
|
try {
|
|
2886
|
-
configFile = (0,
|
|
2680
|
+
configFile = (0, import_config8.findConfig)({ cwd });
|
|
2887
2681
|
} catch (err) {
|
|
2888
2682
|
if (!(err instanceof import_shared3.PandaError)) {
|
|
2889
2683
|
throw err;
|
package/dist/index.mjs
CHANGED
|
@@ -27,11 +27,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
|
|
30
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.
|
|
30
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.14_supports-col_417629c956fdcd14cb97372bbc8200e9/node_modules/tsup/assets/esm_shims.js
|
|
31
31
|
import path from "path";
|
|
32
32
|
import { fileURLToPath } from "url";
|
|
33
33
|
var init_esm_shims = __esm({
|
|
34
|
-
"../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.
|
|
34
|
+
"../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.3_@swc+helpers@0.5.17__jiti@2.6.1_postcss@8.5.14_supports-col_417629c956fdcd14cb97372bbc8200e9/node_modules/tsup/assets/esm_shims.js"() {
|
|
35
35
|
"use strict";
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -378,11 +378,31 @@ async function codegen(ctx, ids) {
|
|
|
378
378
|
|
|
379
379
|
// src/config.ts
|
|
380
380
|
init_esm_shims();
|
|
381
|
-
import { loadConfig as loadConfig2
|
|
381
|
+
import { loadConfig as loadConfig2 } from "@pandacss/config";
|
|
382
|
+
|
|
383
|
+
// src/auto-plugins.ts
|
|
384
|
+
init_esm_shims();
|
|
385
|
+
import { mergeHooks } from "@pandacss/config";
|
|
382
386
|
import { pluginLightningcss } from "@pandacss/plugin-lightningcss";
|
|
383
387
|
import { pluginSvelte } from "@pandacss/plugin-svelte";
|
|
384
388
|
import { pluginVue } from "@pandacss/plugin-vue";
|
|
385
389
|
import browserslist from "browserslist";
|
|
390
|
+
var RESOLVED_HOOKS_NAME = "__resolved__";
|
|
391
|
+
function getAutoPlugins(config) {
|
|
392
|
+
const plugins = [pluginVue(), pluginSvelte()];
|
|
393
|
+
if (config.lightningcss) {
|
|
394
|
+
plugins.push(pluginLightningcss());
|
|
395
|
+
}
|
|
396
|
+
return plugins;
|
|
397
|
+
}
|
|
398
|
+
function applyAutoPlugins(conf, cwd) {
|
|
399
|
+
if (conf.config.lightningcss && !conf.config.browserslist) {
|
|
400
|
+
conf.config.browserslist ||= browserslist.findConfig(cwd)?.defaults;
|
|
401
|
+
}
|
|
402
|
+
const autoPlugins = getAutoPlugins(conf.config);
|
|
403
|
+
conf.hooks = mergeHooks([...autoPlugins, { name: RESOLVED_HOOKS_NAME, hooks: conf.hooks }]);
|
|
404
|
+
conf.config.plugins = [...autoPlugins, ...conf.config.plugins ?? []];
|
|
405
|
+
}
|
|
386
406
|
|
|
387
407
|
// src/create-context.ts
|
|
388
408
|
init_esm_shims();
|
|
@@ -1749,6 +1769,7 @@ var DiffEngine = class {
|
|
|
1749
1769
|
const conf = await loadConfig({ cwd: this.ctx.config.cwd, file: this.ctx.conf.path });
|
|
1750
1770
|
const { tsconfig, tsconfigFile, tsOptions } = this.ctx.conf;
|
|
1751
1771
|
Object.assign(conf, { tsconfig, tsconfigFile, tsOptions });
|
|
1772
|
+
applyAutoPlugins(conf, this.ctx.config.cwd);
|
|
1752
1773
|
return this.refresh(conf, fn);
|
|
1753
1774
|
}
|
|
1754
1775
|
/**
|
|
@@ -1835,8 +1856,8 @@ var nodeRuntime = {
|
|
|
1835
1856
|
readDirSync: fsExtra.readdirSync,
|
|
1836
1857
|
rmDirSync: fsExtra.emptyDirSync,
|
|
1837
1858
|
rmFileSync: fsExtra.removeSync,
|
|
1838
|
-
ensureDirSync(
|
|
1839
|
-
return fsExtra.ensureDirSync(
|
|
1859
|
+
ensureDirSync(path5) {
|
|
1860
|
+
return fsExtra.ensureDirSync(path5);
|
|
1840
1861
|
},
|
|
1841
1862
|
watch(options) {
|
|
1842
1863
|
const { include, exclude, cwd, poll } = options;
|
|
@@ -1847,8 +1868,8 @@ var nodeRuntime = {
|
|
|
1847
1868
|
const watcher = chokidar.watch(dirnames, {
|
|
1848
1869
|
usePolling: poll,
|
|
1849
1870
|
cwd,
|
|
1850
|
-
ignored(
|
|
1851
|
-
const relativePath = relative(workingDir,
|
|
1871
|
+
ignored(path5, stats) {
|
|
1872
|
+
const relativePath = relative(workingDir, path5);
|
|
1852
1873
|
return !!stats?.isFile() && !isValidPath(relativePath);
|
|
1853
1874
|
},
|
|
1854
1875
|
ignoreInitial: true,
|
|
@@ -2002,13 +2023,13 @@ var PandaContext = class extends Generator2 {
|
|
|
2002
2023
|
});
|
|
2003
2024
|
};
|
|
2004
2025
|
writeSplitCss = async (sheet) => {
|
|
2005
|
-
const { path: pathUtil, fs:
|
|
2026
|
+
const { path: pathUtil, fs: fs3 } = this.runtime;
|
|
2006
2027
|
const rootDir = this.paths.root;
|
|
2007
2028
|
const stylesDir = [...rootDir, "styles"];
|
|
2008
2029
|
const artifacts = this.getSplitCssArtifacts(sheet);
|
|
2009
2030
|
const subDirs = new Set([...artifacts.recipes, ...artifacts.themes].map((a) => a.dir).filter(Boolean));
|
|
2010
|
-
|
|
2011
|
-
subDirs.forEach((dir) =>
|
|
2031
|
+
fs3.ensureDirSync(pathUtil.join(...stylesDir));
|
|
2032
|
+
subDirs.forEach((dir) => fs3.ensureDirSync(pathUtil.join(...stylesDir, dir)));
|
|
2012
2033
|
const styleFiles = [];
|
|
2013
2034
|
for (const layer of artifacts.layers) {
|
|
2014
2035
|
styleFiles.push({ file: layer.file, code: layer.code });
|
|
@@ -2077,222 +2098,14 @@ var PandaContext = class extends Generator2 {
|
|
|
2077
2098
|
|
|
2078
2099
|
// src/load-tsconfig.ts
|
|
2079
2100
|
init_esm_shims();
|
|
2080
|
-
import {
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2101
|
+
import {
|
|
2102
|
+
convertTsPathsToRegexes,
|
|
2103
|
+
findClosestTsconfig,
|
|
2104
|
+
resolveBaseUrlForCompilerOptions,
|
|
2105
|
+
resolveDirectTsconfigJson,
|
|
2106
|
+
resolveSolutionTsconfigForFile
|
|
2107
|
+
} from "@pandacss/config";
|
|
2086
2108
|
import path2 from "path";
|
|
2087
|
-
async function resolveDirectTsconfigJson(filename) {
|
|
2088
|
-
if (path2.extname(filename) !== ".json") return null;
|
|
2089
|
-
const resolved = path2.resolve(filename);
|
|
2090
|
-
try {
|
|
2091
|
-
const stat = await fs.stat(resolved);
|
|
2092
|
-
if (stat.isFile() || stat.isFIFO()) return resolved;
|
|
2093
|
-
throw new Error(`${filename} exists but is not a regular file.`);
|
|
2094
|
-
} catch (e) {
|
|
2095
|
-
if (e && typeof e === "object" && "code" in e && e.code === "ENOENT") {
|
|
2096
|
-
return null;
|
|
2097
|
-
}
|
|
2098
|
-
throw e;
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
async function findClosestTsconfig(filename, root, configName = "tsconfig.json") {
|
|
2102
|
-
const resolvedRoot = path2.resolve(root);
|
|
2103
|
-
let dir = path2.dirname(path2.resolve(filename));
|
|
2104
|
-
for (; ; ) {
|
|
2105
|
-
const candidate = path2.join(dir, configName);
|
|
2106
|
-
try {
|
|
2107
|
-
const stat = await fs.stat(candidate);
|
|
2108
|
-
if (stat.isFile() || stat.isFIFO()) {
|
|
2109
|
-
return candidate;
|
|
2110
|
-
}
|
|
2111
|
-
} catch {
|
|
2112
|
-
}
|
|
2113
|
-
if (dir === resolvedRoot || path2.dirname(dir) === dir) {
|
|
2114
|
-
return null;
|
|
2115
|
-
}
|
|
2116
|
-
dir = path2.dirname(dir);
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
function resolveBaseUrlForCompilerOptions(baseUrl, tsconfigFile, cwd) {
|
|
2120
|
-
if (baseUrl == null) return cwd;
|
|
2121
|
-
if (baseUrl.startsWith("${")) return baseUrl;
|
|
2122
|
-
if (path2.isAbsolute(baseUrl)) return baseUrl;
|
|
2123
|
-
return path2.resolve(path2.dirname(tsconfigFile), baseUrl);
|
|
2124
|
-
}
|
|
2125
|
-
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
2126
|
-
function resolveReferencedTsconfigPath(refPath, fromDir, configName = "tsconfig.json") {
|
|
2127
|
-
const p = refPath.endsWith(".json") ? refPath : path2.join(refPath, configName);
|
|
2128
|
-
return path2.resolve(fromDir, p);
|
|
2129
|
-
}
|
|
2130
|
-
async function resolveSolutionTsconfigForFile(absoluteFilename, rootTsconfigPath, rootParsed, getTsconfigModule) {
|
|
2131
|
-
const { parseTsconfig } = getTsconfigModule;
|
|
2132
|
-
if (isSourceFileIncludedInTsconfig(absoluteFilename, rootTsconfigPath, rootParsed)) {
|
|
2133
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2134
|
-
}
|
|
2135
|
-
const refs = rootParsed.references;
|
|
2136
|
-
if (!refs?.length) {
|
|
2137
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2138
|
-
}
|
|
2139
|
-
if (!SOURCE_EXTENSIONS.some((ext) => absoluteFilename.endsWith(ext))) {
|
|
2140
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2141
|
-
}
|
|
2142
|
-
const rootDir = path2.dirname(rootTsconfigPath);
|
|
2143
|
-
for (const ref of refs) {
|
|
2144
|
-
const refPath = resolveReferencedTsconfigPath(ref.path, rootDir);
|
|
2145
|
-
try {
|
|
2146
|
-
await fs.access(refPath);
|
|
2147
|
-
} catch {
|
|
2148
|
-
continue;
|
|
2149
|
-
}
|
|
2150
|
-
const childParsed = parseTsconfig(refPath);
|
|
2151
|
-
if (isSourceFileIncludedInTsconfig(absoluteFilename, refPath, childParsed)) {
|
|
2152
|
-
return { tsconfig: childParsed, tsconfigFile: refPath };
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
|
|
2156
|
-
}
|
|
2157
|
-
var POSIX_SEP_RE = new RegExp("\\" + path2.posix.sep, "g");
|
|
2158
|
-
var NATIVE_SEP_RE = new RegExp("\\" + path2.sep, "g");
|
|
2159
|
-
var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
|
|
2160
|
-
var GLOB_ALL_PATTERN = `**/*`;
|
|
2161
|
-
var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
|
|
2162
|
-
var JS_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
|
|
2163
|
-
var TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
|
|
2164
|
-
var TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
2165
|
-
var TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
|
|
2166
|
-
var IS_POSIX = path2.posix.sep === path2.sep;
|
|
2167
|
-
var native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, path2.posix.sep);
|
|
2168
|
-
var resolve2posix = IS_POSIX ? (dir, filename) => dir ? path2.resolve(dir, filename) : path2.resolve(filename) : (dir, filename) => {
|
|
2169
|
-
const posix2native = (f) => f.replace(POSIX_SEP_RE, path2.sep);
|
|
2170
|
-
return native2posix(
|
|
2171
|
-
dir ? path2.resolve(posix2native(dir), posix2native(filename)) : path2.resolve(posix2native(filename))
|
|
2172
|
-
);
|
|
2173
|
-
};
|
|
2174
|
-
function isGlobMatch(filename, dir, patterns, allowJs) {
|
|
2175
|
-
const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
|
|
2176
|
-
return patterns.some((patternArg) => {
|
|
2177
|
-
let pattern = patternArg;
|
|
2178
|
-
let lastWildcardIndex = pattern.length;
|
|
2179
|
-
let hasWildcard = false;
|
|
2180
|
-
let hasExtension = false;
|
|
2181
|
-
let hasSlash = false;
|
|
2182
|
-
let lastSlashIndex = -1;
|
|
2183
|
-
for (let i = pattern.length - 1; i > -1; i--) {
|
|
2184
|
-
const c = pattern[i];
|
|
2185
|
-
if (!hasWildcard) {
|
|
2186
|
-
if (c === "*" || c === "?") {
|
|
2187
|
-
lastWildcardIndex = i;
|
|
2188
|
-
hasWildcard = true;
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
if (!hasSlash) {
|
|
2192
|
-
if (c === ".") {
|
|
2193
|
-
hasExtension = true;
|
|
2194
|
-
} else if (c === "/") {
|
|
2195
|
-
lastSlashIndex = i;
|
|
2196
|
-
hasSlash = true;
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
if (hasWildcard && hasSlash) {
|
|
2200
|
-
break;
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
|
|
2204
|
-
pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
|
|
2205
|
-
lastWildcardIndex = pattern.length - 1;
|
|
2206
|
-
hasWildcard = true;
|
|
2207
|
-
}
|
|
2208
|
-
if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
|
|
2209
|
-
return false;
|
|
2210
|
-
}
|
|
2211
|
-
if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) {
|
|
2212
|
-
return false;
|
|
2213
|
-
}
|
|
2214
|
-
if (pattern === GLOB_ALL_PATTERN) {
|
|
2215
|
-
return filename.startsWith(`${dir}/`);
|
|
2216
|
-
}
|
|
2217
|
-
const resolvedPattern = resolve2posix(dir, pattern);
|
|
2218
|
-
let firstWildcardIndex = -1;
|
|
2219
|
-
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
2220
|
-
if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
|
|
2221
|
-
firstWildcardIndex = i;
|
|
2222
|
-
hasWildcard = true;
|
|
2223
|
-
break;
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
|
|
2227
|
-
return false;
|
|
2228
|
-
}
|
|
2229
|
-
if (!hasWildcard) {
|
|
2230
|
-
return filename === resolvedPattern;
|
|
2231
|
-
}
|
|
2232
|
-
if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) {
|
|
2233
|
-
return true;
|
|
2234
|
-
}
|
|
2235
|
-
if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
|
|
2236
|
-
return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
|
|
2237
|
-
}
|
|
2238
|
-
const regex2 = pattern2regex(resolvedPattern, allowJs);
|
|
2239
|
-
PATTERN_REGEX_CACHE.set(resolvedPattern, regex2);
|
|
2240
|
-
return regex2.test(filename);
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
function pattern2regex(resolvedPattern, allowJs) {
|
|
2244
|
-
let regexStr = "^";
|
|
2245
|
-
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
2246
|
-
const char = resolvedPattern[i];
|
|
2247
|
-
if (char === "?") {
|
|
2248
|
-
regexStr += "[^\\/]";
|
|
2249
|
-
continue;
|
|
2250
|
-
}
|
|
2251
|
-
if (char === "*") {
|
|
2252
|
-
if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
|
|
2253
|
-
i += 2;
|
|
2254
|
-
regexStr += "(?:[^\\/]*\\/)*";
|
|
2255
|
-
continue;
|
|
2256
|
-
}
|
|
2257
|
-
regexStr += "[^\\/]*";
|
|
2258
|
-
continue;
|
|
2259
|
-
}
|
|
2260
|
-
if ("/.+^${}()|[]\\".includes(char)) {
|
|
2261
|
-
regexStr += "\\";
|
|
2262
|
-
}
|
|
2263
|
-
regexStr += char;
|
|
2264
|
-
}
|
|
2265
|
-
if (resolvedPattern.endsWith("*")) {
|
|
2266
|
-
regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
|
|
2267
|
-
}
|
|
2268
|
-
regexStr += "$";
|
|
2269
|
-
return new RegExp(regexStr);
|
|
2270
|
-
}
|
|
2271
|
-
function isIncluded(filename, tsconfigFile, tsconfig) {
|
|
2272
|
-
const dir = native2posix(path2.dirname(tsconfigFile));
|
|
2273
|
-
const files = (tsconfig.files || []).map((file) => resolve2posix(dir, file));
|
|
2274
|
-
const absoluteFilename = resolve2posix(null, filename);
|
|
2275
|
-
if (files.includes(filename)) {
|
|
2276
|
-
return true;
|
|
2277
|
-
}
|
|
2278
|
-
const allowJs = tsconfig.compilerOptions?.allowJs;
|
|
2279
|
-
const included = isGlobMatch(
|
|
2280
|
-
absoluteFilename,
|
|
2281
|
-
dir,
|
|
2282
|
-
tsconfig.include || (tsconfig.files ? [] : [GLOB_ALL_PATTERN]),
|
|
2283
|
-
allowJs
|
|
2284
|
-
);
|
|
2285
|
-
if (included) {
|
|
2286
|
-
const excluded = isGlobMatch(absoluteFilename, dir, tsconfig.exclude || [], allowJs);
|
|
2287
|
-
return !excluded;
|
|
2288
|
-
}
|
|
2289
|
-
return false;
|
|
2290
|
-
}
|
|
2291
|
-
function isSourceFileIncludedInTsconfig(absoluteFilename, tsconfigFile, tsconfig) {
|
|
2292
|
-
return isIncluded(absoluteFilename, tsconfigFile, tsconfig);
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
|
-
// src/load-tsconfig.ts
|
|
2296
2109
|
async function loadTsConfig(conf, cwd) {
|
|
2297
2110
|
const root = cwd;
|
|
2298
2111
|
let tsconfigFile = await resolveDirectTsconfigJson(conf.path);
|
|
@@ -2308,7 +2121,7 @@ async function loadTsConfig(conf, cwd) {
|
|
|
2308
2121
|
const gtc = await import("get-tsconfig");
|
|
2309
2122
|
const rootParsed = gtc.parseTsconfig(tsconfigFile);
|
|
2310
2123
|
const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await resolveSolutionTsconfigForFile(
|
|
2311
|
-
|
|
2124
|
+
path2.resolve(conf.path),
|
|
2312
2125
|
tsconfigFile,
|
|
2313
2126
|
rootParsed,
|
|
2314
2127
|
gtc
|
|
@@ -2332,14 +2145,6 @@ async function loadTsConfig(conf, cwd) {
|
|
|
2332
2145
|
}
|
|
2333
2146
|
|
|
2334
2147
|
// src/config.ts
|
|
2335
|
-
var RESOLVED_HOOKS_NAME = "__resolved__";
|
|
2336
|
-
function getAutoPlugins(config) {
|
|
2337
|
-
const plugins = [pluginVue(), pluginSvelte()];
|
|
2338
|
-
if (config.lightningcss) {
|
|
2339
|
-
plugins.push(pluginLightningcss());
|
|
2340
|
-
}
|
|
2341
|
-
return plugins;
|
|
2342
|
-
}
|
|
2343
2148
|
async function loadConfigAndCreateContext(options = {}) {
|
|
2344
2149
|
const { config, configPath } = options;
|
|
2345
2150
|
const cwd = options.cwd ?? options?.config?.cwd ?? process.cwd();
|
|
@@ -2350,12 +2155,7 @@ async function loadConfigAndCreateContext(options = {}) {
|
|
|
2350
2155
|
if (options.cwd) {
|
|
2351
2156
|
conf.config.cwd = options.cwd;
|
|
2352
2157
|
}
|
|
2353
|
-
|
|
2354
|
-
conf.config.browserslist ||= browserslist.findConfig(cwd)?.defaults;
|
|
2355
|
-
}
|
|
2356
|
-
const autoPlugins = getAutoPlugins(conf.config);
|
|
2357
|
-
conf.hooks = mergeHooks([...autoPlugins, { name: RESOLVED_HOOKS_NAME, hooks: conf.hooks }]);
|
|
2358
|
-
conf.config.plugins = [...autoPlugins, ...conf.config.plugins ?? []];
|
|
2158
|
+
applyAutoPlugins(conf, cwd);
|
|
2359
2159
|
const tsConfResult = await loadTsConfig(conf, cwd);
|
|
2360
2160
|
if (tsConfResult) {
|
|
2361
2161
|
Object.assign(conf, tsConfResult);
|
|
@@ -2562,8 +2362,8 @@ var Builder = class {
|
|
|
2562
2362
|
// src/cpu-profile.ts
|
|
2563
2363
|
init_esm_shims();
|
|
2564
2364
|
import { logger as logger6 } from "@pandacss/logger";
|
|
2565
|
-
import
|
|
2566
|
-
import
|
|
2365
|
+
import fs from "fs";
|
|
2366
|
+
import path3 from "path";
|
|
2567
2367
|
import readline from "readline";
|
|
2568
2368
|
var startProfiling = async (cwd, prefix, isWatching) => {
|
|
2569
2369
|
const inspector = await import("inspector").then((r) => r.default);
|
|
@@ -2627,8 +2427,8 @@ var startProfiling = async (cwd, prefix, isWatching) => {
|
|
|
2627
2427
|
const date = /* @__PURE__ */ new Date();
|
|
2628
2428
|
const timestamp = date.toISOString().replace(/[-:.]/g, "");
|
|
2629
2429
|
const title = `panda-${prefix}-${timestamp}`;
|
|
2630
|
-
const outfile =
|
|
2631
|
-
|
|
2430
|
+
const outfile = path3.join(cwd, `${title}.cpuprofile`);
|
|
2431
|
+
fs.writeFileSync(outfile, JSON.stringify(params.profile));
|
|
2632
2432
|
logger6.info("cpu-prof", outfile);
|
|
2633
2433
|
cb?.();
|
|
2634
2434
|
});
|
|
@@ -2682,12 +2482,12 @@ async function debug(ctx, options) {
|
|
|
2682
2482
|
const files = ctx.getFiles();
|
|
2683
2483
|
const measureTotal = logger8.time.debug(`Done parsing ${files.length} files`);
|
|
2684
2484
|
ctx.config.minify = false;
|
|
2685
|
-
const { fs:
|
|
2485
|
+
const { fs: fs3, path: path5 } = ctx.runtime;
|
|
2686
2486
|
const outdir = options.outdir;
|
|
2687
2487
|
if (!options.dry && outdir) {
|
|
2688
|
-
|
|
2488
|
+
fs3.ensureDirSync(outdir);
|
|
2689
2489
|
logger8.info("cli", `Writing ${colors2.bold(`${outdir}/config.json`)}`);
|
|
2690
|
-
await
|
|
2490
|
+
await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
|
|
2691
2491
|
}
|
|
2692
2492
|
if (options.onlyConfig) {
|
|
2693
2493
|
measureTotal();
|
|
@@ -2710,14 +2510,14 @@ async function debug(ctx, options) {
|
|
|
2710
2510
|
if (outdir) {
|
|
2711
2511
|
filesWithCss.push(file);
|
|
2712
2512
|
const parsedPath = parse(file);
|
|
2713
|
-
const relative2 =
|
|
2714
|
-
const astJsonPath = `${relative2}${
|
|
2715
|
-
const cssPath = `${relative2}${
|
|
2513
|
+
const relative2 = path5.relative(ctx.config.cwd, parsedPath.dir);
|
|
2514
|
+
const astJsonPath = `${relative2}${path5.sep}${parsedPath.name}.ast.json`.replaceAll(path5.sep, "__");
|
|
2515
|
+
const cssPath = `${relative2}${path5.sep}${parsedPath.name}.css`.replaceAll(path5.sep, "__");
|
|
2716
2516
|
logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
|
|
2717
2517
|
logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
|
|
2718
2518
|
return Promise.allSettled([
|
|
2719
|
-
|
|
2720
|
-
|
|
2519
|
+
fs3.writeFile(`${outdir}${path5.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
|
|
2520
|
+
fs3.writeFile(`${outdir}${path5.sep}${cssPath}`, css)
|
|
2721
2521
|
]);
|
|
2722
2522
|
}
|
|
2723
2523
|
});
|
|
@@ -2812,16 +2612,16 @@ function setupGitIgnore(ctx) {
|
|
|
2812
2612
|
// src/logstream.ts
|
|
2813
2613
|
init_esm_shims();
|
|
2814
2614
|
import { logger as logger10 } from "@pandacss/logger";
|
|
2815
|
-
import
|
|
2816
|
-
import
|
|
2615
|
+
import fs2 from "fs";
|
|
2616
|
+
import path4 from "path";
|
|
2817
2617
|
var setLogStream = (options) => {
|
|
2818
2618
|
const { cwd = process.cwd() } = options;
|
|
2819
2619
|
let stream;
|
|
2820
2620
|
if (options.logfile) {
|
|
2821
|
-
const outPath =
|
|
2621
|
+
const outPath = path4.resolve(cwd, options.logfile);
|
|
2822
2622
|
ensure(outPath);
|
|
2823
2623
|
logger10.info("logfile", outPath);
|
|
2824
|
-
stream =
|
|
2624
|
+
stream = fs2.createWriteStream(outPath, { flags: "a" });
|
|
2825
2625
|
logger10.onLog = (entry) => {
|
|
2826
2626
|
stream?.write(JSON.stringify(entry) + "\n");
|
|
2827
2627
|
};
|
|
@@ -2839,8 +2639,8 @@ var setLogStream = (options) => {
|
|
|
2839
2639
|
};
|
|
2840
2640
|
};
|
|
2841
2641
|
var ensure = (outPath) => {
|
|
2842
|
-
const dirname2 =
|
|
2843
|
-
|
|
2642
|
+
const dirname2 = path4.dirname(outPath);
|
|
2643
|
+
fs2.mkdirSync(dirname2, { recursive: true });
|
|
2844
2644
|
return outPath;
|
|
2845
2645
|
};
|
|
2846
2646
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "The core css panda library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -53,18 +53,18 @@
|
|
|
53
53
|
"ts-morph": "28.0.0",
|
|
54
54
|
"ts-pattern": "5.9.0",
|
|
55
55
|
"get-tsconfig": "^4.13.0",
|
|
56
|
-
"@pandacss/config": "1.
|
|
57
|
-
"@pandacss/core": "1.
|
|
58
|
-
"@pandacss/generator": "1.
|
|
59
|
-
"@pandacss/plugin-lightningcss": "1.
|
|
60
|
-
"@pandacss/plugin-svelte": "1.
|
|
61
|
-
"@pandacss/plugin-vue": "1.
|
|
62
|
-
"@pandacss/reporter": "1.
|
|
63
|
-
"@pandacss/logger": "1.
|
|
64
|
-
"@pandacss/parser": "1.
|
|
65
|
-
"@pandacss/shared": "1.
|
|
66
|
-
"@pandacss/token-dictionary": "1.
|
|
67
|
-
"@pandacss/types": "1.
|
|
56
|
+
"@pandacss/config": "1.12.0",
|
|
57
|
+
"@pandacss/core": "1.12.0",
|
|
58
|
+
"@pandacss/generator": "1.12.0",
|
|
59
|
+
"@pandacss/plugin-lightningcss": "1.12.0",
|
|
60
|
+
"@pandacss/plugin-svelte": "1.12.0",
|
|
61
|
+
"@pandacss/plugin-vue": "1.12.0",
|
|
62
|
+
"@pandacss/reporter": "1.12.0",
|
|
63
|
+
"@pandacss/logger": "1.12.0",
|
|
64
|
+
"@pandacss/parser": "1.12.0",
|
|
65
|
+
"@pandacss/shared": "1.12.0",
|
|
66
|
+
"@pandacss/token-dictionary": "1.12.0",
|
|
67
|
+
"@pandacss/types": "1.12.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/picomatch": "4.0.2",
|