@pandacss/node 1.9.1 → 1.10.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 CHANGED
@@ -120,6 +120,10 @@ declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
120
120
  msg: string;
121
121
  }>;
122
122
 
123
+ /**
124
+ * Load config and create context with auto-injected plugins.
125
+ * Used by the CLI and PostCSS plugin.
126
+ */
123
127
  declare function loadConfigAndCreateContext(options?: {
124
128
  cwd?: string;
125
129
  config?: Config;
package/dist/index.d.ts CHANGED
@@ -120,6 +120,10 @@ declare function codegen(ctx: PandaContext, ids?: ArtifactId[]): Promise<{
120
120
  msg: string;
121
121
  }>;
122
122
 
123
+ /**
124
+ * Load config and create context with auto-injected plugins.
125
+ * Used by the CLI and PostCSS plugin.
126
+ */
123
127
  declare function loadConfigAndCreateContext(options?: {
124
128
  cwd?: string;
125
129
  config?: Config;
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.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
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.6_tsx@4.20.6_typescript@6.0.2_yaml@2.8.1/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.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"() {
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.6_tsx@4.20.6_typescript@6.0.2_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -378,7 +378,6 @@ async function buildInfo(ctx, outfile) {
378
378
  // src/builder.ts
379
379
  init_cjs_shims();
380
380
  var import_config4 = require("@pandacss/config");
381
- var import_core = require("@pandacss/core");
382
381
  var import_logger5 = require("@pandacss/logger");
383
382
  var import_shared2 = require("@pandacss/shared");
384
383
  var import_fs = require("fs");
@@ -407,6 +406,9 @@ async function codegen(ctx, ids) {
407
406
  // src/config.ts
408
407
  init_cjs_shims();
409
408
  var import_config3 = require("@pandacss/config");
409
+ var import_plugin_lightningcss = require("@pandacss/plugin-lightningcss");
410
+ var import_plugin_svelte = require("@pandacss/plugin-svelte");
411
+ var import_plugin_vue = require("@pandacss/plugin-vue");
410
412
  var import_browserslist = __toESM(require("browserslist"));
411
413
 
412
414
  // src/create-context.ts
@@ -1860,8 +1862,8 @@ var nodeRuntime = {
1860
1862
  readDirSync: import_fs_extra.default.readdirSync,
1861
1863
  rmDirSync: import_fs_extra.default.emptyDirSync,
1862
1864
  rmFileSync: import_fs_extra.default.removeSync,
1863
- ensureDirSync(path3) {
1864
- return import_fs_extra.default.ensureDirSync(path3);
1865
+ ensureDirSync(path5) {
1866
+ return import_fs_extra.default.ensureDirSync(path5);
1865
1867
  },
1866
1868
  watch(options) {
1867
1869
  const { include, exclude, cwd, poll } = options;
@@ -1872,8 +1874,8 @@ var nodeRuntime = {
1872
1874
  const watcher = import_chokidar.default.watch(dirnames, {
1873
1875
  usePolling: poll,
1874
1876
  cwd,
1875
- ignored(path3, stats) {
1876
- const relativePath = (0, import_path2.relative)(workingDir, path3);
1877
+ ignored(path5, stats) {
1878
+ const relativePath = (0, import_path2.relative)(workingDir, path5);
1877
1879
  return !!stats?.isFile() && !isValidPath(relativePath);
1878
1880
  },
1879
1881
  ignoreInitial: true,
@@ -1890,10 +1892,10 @@ var nodeRuntime = {
1890
1892
  };
1891
1893
  process.setMaxListeners(Infinity);
1892
1894
  process.on("unhandledRejection", (reason) => {
1893
- import_logger2.logger.error("\u274C", reason);
1895
+ import_logger2.logger.caughtError("process", "Unhandled rejection", reason);
1894
1896
  });
1895
- process.on("uncaughtException", (reason) => {
1896
- import_logger2.logger.error("\u274C", reason);
1897
+ process.on("uncaughtException", (error) => {
1898
+ import_logger2.logger.caughtError("process", "Uncaught exception", error);
1897
1899
  });
1898
1900
 
1899
1901
  // src/output-engine.ts
@@ -1987,7 +1989,7 @@ var PandaContext = class extends import_generator2.Generator {
1987
1989
  const encoder = styleEncoder || this.parserOptions.encoder;
1988
1990
  result = this.project.parseSourceFile(file, encoder);
1989
1991
  } catch (error) {
1990
- import_logger4.logger.error("file:extract", error);
1992
+ import_logger4.logger.caughtError("file:extract", `Failed to parse ${file}`, error);
1991
1993
  }
1992
1994
  measure();
1993
1995
  return result;
@@ -2020,13 +2022,13 @@ var PandaContext = class extends import_generator2.Generator {
2020
2022
  });
2021
2023
  };
2022
2024
  writeSplitCss = async (sheet) => {
2023
- const { path: pathUtil, fs: fs3 } = this.runtime;
2025
+ const { path: pathUtil, fs: fs4 } = this.runtime;
2024
2026
  const rootDir = this.paths.root;
2025
2027
  const stylesDir = [...rootDir, "styles"];
2026
2028
  const artifacts = this.getSplitCssArtifacts(sheet);
2027
2029
  const subDirs = new Set([...artifacts.recipes, ...artifacts.themes].map((a) => a.dir).filter(Boolean));
2028
- fs3.ensureDirSync(pathUtil.join(...stylesDir));
2029
- subDirs.forEach((dir) => fs3.ensureDirSync(pathUtil.join(...stylesDir, dir)));
2030
+ fs4.ensureDirSync(pathUtil.join(...stylesDir));
2031
+ subDirs.forEach((dir) => fs4.ensureDirSync(pathUtil.join(...stylesDir, dir)));
2030
2032
  const styleFiles = [];
2031
2033
  for (const layer of artifacts.layers) {
2032
2034
  styleFiles.push({ file: layer.file, code: layer.code });
@@ -2096,31 +2098,268 @@ var PandaContext = class extends import_generator2.Generator {
2096
2098
  // src/load-tsconfig.ts
2097
2099
  init_cjs_shims();
2098
2100
  var import_config2 = require("@pandacss/config");
2099
- async function loadTsConfig(conf, cwd) {
2100
- const { parse: parse2 } = await import("tsconfck");
2101
- const tsconfigResult = await parse2(conf.path, {
2102
- root: cwd,
2103
- //@ts-ignore
2104
- resolveWithEmptyIfConfigNotFound: true
2101
+ var import_node_path2 = __toESM(require("path"));
2102
+
2103
+ // src/tsconfig-utils.ts
2104
+ init_cjs_shims();
2105
+ var import_node_fs = require("fs");
2106
+ var import_node_path = __toESM(require("path"));
2107
+ async function resolveDirectTsconfigJson(filename) {
2108
+ if (import_node_path.default.extname(filename) !== ".json") return null;
2109
+ const resolved = import_node_path.default.resolve(filename);
2110
+ try {
2111
+ const stat = await import_node_fs.promises.stat(resolved);
2112
+ if (stat.isFile() || stat.isFIFO()) return resolved;
2113
+ throw new Error(`${filename} exists but is not a regular file.`);
2114
+ } catch (e) {
2115
+ if (e && typeof e === "object" && "code" in e && e.code === "ENOENT") {
2116
+ return null;
2117
+ }
2118
+ throw e;
2119
+ }
2120
+ }
2121
+ async function findClosestTsconfig(filename, root, configName = "tsconfig.json") {
2122
+ const resolvedRoot = import_node_path.default.resolve(root);
2123
+ let dir = import_node_path.default.dirname(import_node_path.default.resolve(filename));
2124
+ for (; ; ) {
2125
+ const candidate = import_node_path.default.join(dir, configName);
2126
+ try {
2127
+ const stat = await import_node_fs.promises.stat(candidate);
2128
+ if (stat.isFile() || stat.isFIFO()) {
2129
+ return candidate;
2130
+ }
2131
+ } catch {
2132
+ }
2133
+ if (dir === resolvedRoot || import_node_path.default.dirname(dir) === dir) {
2134
+ return null;
2135
+ }
2136
+ dir = import_node_path.default.dirname(dir);
2137
+ }
2138
+ }
2139
+ function resolveBaseUrlForCompilerOptions(baseUrl, tsconfigFile, cwd) {
2140
+ if (baseUrl == null) return cwd;
2141
+ if (baseUrl.startsWith("${")) return baseUrl;
2142
+ if (import_node_path.default.isAbsolute(baseUrl)) return baseUrl;
2143
+ return import_node_path.default.resolve(import_node_path.default.dirname(tsconfigFile), baseUrl);
2144
+ }
2145
+ var SOURCE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
2146
+ function resolveReferencedTsconfigPath(refPath, fromDir, configName = "tsconfig.json") {
2147
+ const p = refPath.endsWith(".json") ? refPath : import_node_path.default.join(refPath, configName);
2148
+ return import_node_path.default.resolve(fromDir, p);
2149
+ }
2150
+ async function resolveSolutionTsconfigForFile(absoluteFilename, rootTsconfigPath, rootParsed, getTsconfigModule) {
2151
+ const { parseTsconfig } = getTsconfigModule;
2152
+ if (isSourceFileIncludedInTsconfig(absoluteFilename, rootTsconfigPath, rootParsed)) {
2153
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2154
+ }
2155
+ const refs = rootParsed.references;
2156
+ if (!refs?.length) {
2157
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2158
+ }
2159
+ if (!SOURCE_EXTENSIONS.some((ext) => absoluteFilename.endsWith(ext))) {
2160
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2161
+ }
2162
+ const rootDir = import_node_path.default.dirname(rootTsconfigPath);
2163
+ for (const ref of refs) {
2164
+ const refPath = resolveReferencedTsconfigPath(ref.path, rootDir);
2165
+ try {
2166
+ await import_node_fs.promises.access(refPath);
2167
+ } catch {
2168
+ continue;
2169
+ }
2170
+ const childParsed = parseTsconfig(refPath);
2171
+ if (isSourceFileIncludedInTsconfig(absoluteFilename, refPath, childParsed)) {
2172
+ return { tsconfig: childParsed, tsconfigFile: refPath };
2173
+ }
2174
+ }
2175
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2176
+ }
2177
+ var POSIX_SEP_RE = new RegExp("\\" + import_node_path.default.posix.sep, "g");
2178
+ var NATIVE_SEP_RE = new RegExp("\\" + import_node_path.default.sep, "g");
2179
+ var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
2180
+ var GLOB_ALL_PATTERN = `**/*`;
2181
+ var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
2182
+ var JS_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
2183
+ var TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
2184
+ var TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
2185
+ var TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
2186
+ var IS_POSIX = import_node_path.default.posix.sep === import_node_path.default.sep;
2187
+ var native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, import_node_path.default.posix.sep);
2188
+ var resolve2posix = IS_POSIX ? (dir, filename) => dir ? import_node_path.default.resolve(dir, filename) : import_node_path.default.resolve(filename) : (dir, filename) => {
2189
+ const posix2native = (f) => f.replace(POSIX_SEP_RE, import_node_path.default.sep);
2190
+ return native2posix(
2191
+ dir ? import_node_path.default.resolve(posix2native(dir), posix2native(filename)) : import_node_path.default.resolve(posix2native(filename))
2192
+ );
2193
+ };
2194
+ function isGlobMatch(filename, dir, patterns, allowJs) {
2195
+ const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
2196
+ return patterns.some((patternArg) => {
2197
+ let pattern = patternArg;
2198
+ let lastWildcardIndex = pattern.length;
2199
+ let hasWildcard = false;
2200
+ let hasExtension = false;
2201
+ let hasSlash = false;
2202
+ let lastSlashIndex = -1;
2203
+ for (let i = pattern.length - 1; i > -1; i--) {
2204
+ const c = pattern[i];
2205
+ if (!hasWildcard) {
2206
+ if (c === "*" || c === "?") {
2207
+ lastWildcardIndex = i;
2208
+ hasWildcard = true;
2209
+ }
2210
+ }
2211
+ if (!hasSlash) {
2212
+ if (c === ".") {
2213
+ hasExtension = true;
2214
+ } else if (c === "/") {
2215
+ lastSlashIndex = i;
2216
+ hasSlash = true;
2217
+ }
2218
+ }
2219
+ if (hasWildcard && hasSlash) {
2220
+ break;
2221
+ }
2222
+ }
2223
+ if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
2224
+ pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
2225
+ lastWildcardIndex = pattern.length - 1;
2226
+ hasWildcard = true;
2227
+ }
2228
+ if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
2229
+ return false;
2230
+ }
2231
+ if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) {
2232
+ return false;
2233
+ }
2234
+ if (pattern === GLOB_ALL_PATTERN) {
2235
+ return filename.startsWith(`${dir}/`);
2236
+ }
2237
+ const resolvedPattern = resolve2posix(dir, pattern);
2238
+ let firstWildcardIndex = -1;
2239
+ for (let i = 0; i < resolvedPattern.length; i++) {
2240
+ if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
2241
+ firstWildcardIndex = i;
2242
+ hasWildcard = true;
2243
+ break;
2244
+ }
2245
+ }
2246
+ if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
2247
+ return false;
2248
+ }
2249
+ if (!hasWildcard) {
2250
+ return filename === resolvedPattern;
2251
+ }
2252
+ if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) {
2253
+ return true;
2254
+ }
2255
+ if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
2256
+ return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
2257
+ }
2258
+ const regex2 = pattern2regex(resolvedPattern, allowJs);
2259
+ PATTERN_REGEX_CACHE.set(resolvedPattern, regex2);
2260
+ return regex2.test(filename);
2105
2261
  });
2106
- if (!tsconfigResult) return;
2107
- const { tsconfig, tsconfigFile } = tsconfigResult;
2108
- const { compilerOptions } = tsconfig;
2262
+ }
2263
+ function pattern2regex(resolvedPattern, allowJs) {
2264
+ let regexStr = "^";
2265
+ for (let i = 0; i < resolvedPattern.length; i++) {
2266
+ const char = resolvedPattern[i];
2267
+ if (char === "?") {
2268
+ regexStr += "[^\\/]";
2269
+ continue;
2270
+ }
2271
+ if (char === "*") {
2272
+ if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
2273
+ i += 2;
2274
+ regexStr += "(?:[^\\/]*\\/)*";
2275
+ continue;
2276
+ }
2277
+ regexStr += "[^\\/]*";
2278
+ continue;
2279
+ }
2280
+ if ("/.+^${}()|[]\\".includes(char)) {
2281
+ regexStr += "\\";
2282
+ }
2283
+ regexStr += char;
2284
+ }
2285
+ if (resolvedPattern.endsWith("*")) {
2286
+ regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
2287
+ }
2288
+ regexStr += "$";
2289
+ return new RegExp(regexStr);
2290
+ }
2291
+ function isIncluded(filename, tsconfigFile, tsconfig) {
2292
+ const dir = native2posix(import_node_path.default.dirname(tsconfigFile));
2293
+ const files = (tsconfig.files || []).map((file) => resolve2posix(dir, file));
2294
+ const absoluteFilename = resolve2posix(null, filename);
2295
+ if (files.includes(filename)) {
2296
+ return true;
2297
+ }
2298
+ const allowJs = tsconfig.compilerOptions?.allowJs;
2299
+ const included = isGlobMatch(
2300
+ absoluteFilename,
2301
+ dir,
2302
+ tsconfig.include || (tsconfig.files ? [] : [GLOB_ALL_PATTERN]),
2303
+ allowJs
2304
+ );
2305
+ if (included) {
2306
+ const excluded = isGlobMatch(absoluteFilename, dir, tsconfig.exclude || [], allowJs);
2307
+ return !excluded;
2308
+ }
2309
+ return false;
2310
+ }
2311
+ function isSourceFileIncludedInTsconfig(absoluteFilename, tsconfigFile, tsconfig) {
2312
+ return isIncluded(absoluteFilename, tsconfigFile, tsconfig);
2313
+ }
2314
+
2315
+ // src/load-tsconfig.ts
2316
+ async function loadTsConfig(conf, cwd) {
2317
+ const root = cwd;
2318
+ let tsconfigFile = await resolveDirectTsconfigJson(conf.path);
2319
+ if (!tsconfigFile) {
2320
+ tsconfigFile = await findClosestTsconfig(conf.path, root, "tsconfig.json");
2321
+ }
2322
+ if (!tsconfigFile) {
2323
+ return {
2324
+ tsconfig: {},
2325
+ tsconfigFile: void 0
2326
+ };
2327
+ }
2328
+ const gtc = await import("get-tsconfig");
2329
+ const rootParsed = gtc.parseTsconfig(tsconfigFile);
2330
+ const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await resolveSolutionTsconfigForFile(
2331
+ import_node_path2.default.resolve(conf.path),
2332
+ tsconfigFile,
2333
+ rootParsed,
2334
+ gtc
2335
+ );
2336
+ const compilerOptions = tsconfig?.compilerOptions;
2109
2337
  const result = {
2110
2338
  tsconfig,
2111
- tsconfigFile
2339
+ tsconfigFile: effectiveTsconfigPath
2112
2340
  };
2113
2341
  if (compilerOptions?.paths) {
2114
2342
  const baseUrl = compilerOptions.baseUrl;
2115
2343
  result.tsOptions = {
2116
2344
  baseUrl,
2117
- pathMappings: (0, import_config2.convertTsPathsToRegexes)(compilerOptions.paths, baseUrl ?? cwd)
2345
+ pathMappings: (0, import_config2.convertTsPathsToRegexes)(
2346
+ compilerOptions.paths,
2347
+ resolveBaseUrlForCompilerOptions(baseUrl, effectiveTsconfigPath, cwd)
2348
+ )
2118
2349
  };
2119
2350
  }
2120
2351
  return result;
2121
2352
  }
2122
2353
 
2123
2354
  // src/config.ts
2355
+ var RESOLVED_HOOKS_NAME = "__resolved__";
2356
+ function getAutoPlugins(config) {
2357
+ const plugins = [(0, import_plugin_vue.pluginVue)(), (0, import_plugin_svelte.pluginSvelte)()];
2358
+ if (config.lightningcss) {
2359
+ plugins.push((0, import_plugin_lightningcss.pluginLightningcss)());
2360
+ }
2361
+ return plugins;
2362
+ }
2124
2363
  async function loadConfigAndCreateContext(options = {}) {
2125
2364
  const { config, configPath } = options;
2126
2365
  const cwd = options.cwd ?? options?.config?.cwd ?? process.cwd();
@@ -2134,6 +2373,9 @@ async function loadConfigAndCreateContext(options = {}) {
2134
2373
  if (conf.config.lightningcss && !conf.config.browserslist) {
2135
2374
  conf.config.browserslist ||= import_browserslist.default.findConfig(cwd)?.defaults;
2136
2375
  }
2376
+ const autoPlugins = getAutoPlugins(conf.config);
2377
+ conf.hooks = (0, import_config3.mergeHooks)([...autoPlugins, { name: RESOLVED_HOOKS_NAME, hooks: conf.hooks }]);
2378
+ conf.config.plugins = [...autoPlugins, ...conf.config.plugins ?? []];
2137
2379
  const tsConfResult = await loadTsConfig(conf, cwd);
2138
2380
  if (tsConfResult) {
2139
2381
  Object.assign(conf, tsConfResult);
@@ -2318,13 +2560,7 @@ var Builder = class {
2318
2560
  const sheet = ctx.createSheet();
2319
2561
  ctx.appendBaselineCss(sheet);
2320
2562
  const css = ctx.getCss(sheet);
2321
- root.append(
2322
- (0, import_core.optimizeCss)(css, {
2323
- browserslist: ctx.config.browserslist,
2324
- minify: ctx.config.minify,
2325
- lightningcss: ctx.config.lightningcss
2326
- })
2327
- );
2563
+ root.append(css);
2328
2564
  };
2329
2565
  registerDependency = (fn) => {
2330
2566
  const ctx = this.getContextOrThrow();
@@ -2341,8 +2577,8 @@ var Builder = class {
2341
2577
  // src/cpu-profile.ts
2342
2578
  init_cjs_shims();
2343
2579
  var import_logger6 = require("@pandacss/logger");
2344
- var import_node_fs = __toESM(require("fs"));
2345
- var import_node_path = __toESM(require("path"));
2580
+ var import_node_fs2 = __toESM(require("fs"));
2581
+ var import_node_path3 = __toESM(require("path"));
2346
2582
  var import_node_readline = __toESM(require("readline"));
2347
2583
  var startProfiling = async (cwd, prefix, isWatching) => {
2348
2584
  const inspector = await import("inspector").then((r) => r.default);
@@ -2406,8 +2642,8 @@ var startProfiling = async (cwd, prefix, isWatching) => {
2406
2642
  const date = /* @__PURE__ */ new Date();
2407
2643
  const timestamp = date.toISOString().replace(/[-:.]/g, "");
2408
2644
  const title = `panda-${prefix}-${timestamp}`;
2409
- const outfile = import_node_path.default.join(cwd, `${title}.cpuprofile`);
2410
- import_node_fs.default.writeFileSync(outfile, JSON.stringify(params.profile));
2645
+ const outfile = import_node_path3.default.join(cwd, `${title}.cpuprofile`);
2646
+ import_node_fs2.default.writeFileSync(outfile, JSON.stringify(params.profile));
2411
2647
  import_logger6.logger.info("cpu-prof", outfile);
2412
2648
  cb?.();
2413
2649
  });
@@ -2461,12 +2697,12 @@ async function debug(ctx, options) {
2461
2697
  const files = ctx.getFiles();
2462
2698
  const measureTotal = import_logger8.logger.time.debug(`Done parsing ${files.length} files`);
2463
2699
  ctx.config.minify = false;
2464
- const { fs: fs3, path: path3 } = ctx.runtime;
2700
+ const { fs: fs4, path: path5 } = ctx.runtime;
2465
2701
  const outdir = options.outdir;
2466
2702
  if (!options.dry && outdir) {
2467
- fs3.ensureDirSync(outdir);
2703
+ fs4.ensureDirSync(outdir);
2468
2704
  import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/config.json`)}`);
2469
- await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2705
+ await fs4.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2470
2706
  }
2471
2707
  if (options.onlyConfig) {
2472
2708
  measureTotal();
@@ -2489,14 +2725,14 @@ async function debug(ctx, options) {
2489
2725
  if (outdir) {
2490
2726
  filesWithCss.push(file);
2491
2727
  const parsedPath = (0, import_path5.parse)(file);
2492
- const relative2 = path3.relative(ctx.config.cwd, parsedPath.dir);
2493
- const astJsonPath = `${relative2}${path3.sep}${parsedPath.name}.ast.json`.replaceAll(path3.sep, "__");
2494
- const cssPath = `${relative2}${path3.sep}${parsedPath.name}.css`.replaceAll(path3.sep, "__");
2728
+ const relative2 = path5.relative(ctx.config.cwd, parsedPath.dir);
2729
+ const astJsonPath = `${relative2}${path5.sep}${parsedPath.name}.ast.json`.replaceAll(path5.sep, "__");
2730
+ const cssPath = `${relative2}${path5.sep}${parsedPath.name}.css`.replaceAll(path5.sep, "__");
2495
2731
  import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/${astJsonPath}`)}`);
2496
2732
  import_logger8.logger.info("cli", `Writing ${import_logger8.colors.bold(`${outdir}/${cssPath}`)}`);
2497
2733
  return Promise.allSettled([
2498
- fs3.writeFile(`${outdir}${path3.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2499
- fs3.writeFile(`${outdir}${path3.sep}${cssPath}`, css)
2734
+ fs4.writeFile(`${outdir}${path5.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2735
+ fs4.writeFile(`${outdir}${path5.sep}${cssPath}`, css)
2500
2736
  ]);
2501
2737
  }
2502
2738
  });
@@ -2593,16 +2829,16 @@ function setupGitIgnore(ctx) {
2593
2829
  // src/logstream.ts
2594
2830
  init_cjs_shims();
2595
2831
  var import_logger10 = require("@pandacss/logger");
2596
- var import_node_fs2 = __toESM(require("fs"));
2597
- var import_node_path2 = __toESM(require("path"));
2832
+ var import_node_fs3 = __toESM(require("fs"));
2833
+ var import_node_path4 = __toESM(require("path"));
2598
2834
  var setLogStream = (options) => {
2599
2835
  const { cwd = process.cwd() } = options;
2600
2836
  let stream;
2601
2837
  if (options.logfile) {
2602
- const outPath = import_node_path2.default.resolve(cwd, options.logfile);
2838
+ const outPath = import_node_path4.default.resolve(cwd, options.logfile);
2603
2839
  ensure(outPath);
2604
2840
  import_logger10.logger.info("logfile", outPath);
2605
- stream = import_node_fs2.default.createWriteStream(outPath, { flags: "a" });
2841
+ stream = import_node_fs3.default.createWriteStream(outPath, { flags: "a" });
2606
2842
  import_logger10.logger.onLog = (entry) => {
2607
2843
  stream?.write(JSON.stringify(entry) + "\n");
2608
2844
  };
@@ -2620,15 +2856,15 @@ var setLogStream = (options) => {
2620
2856
  };
2621
2857
  };
2622
2858
  var ensure = (outPath) => {
2623
- const dirname2 = import_node_path2.default.dirname(outPath);
2624
- import_node_fs2.default.mkdirSync(dirname2, { recursive: true });
2859
+ const dirname2 = import_node_path4.default.dirname(outPath);
2860
+ import_node_fs3.default.mkdirSync(dirname2, { recursive: true });
2625
2861
  return outPath;
2626
2862
  };
2627
2863
 
2628
2864
  // src/setup-config.ts
2629
2865
  init_cjs_shims();
2630
2866
  var import_config7 = require("@pandacss/config");
2631
- var import_core2 = require("@pandacss/core");
2867
+ var import_core = require("@pandacss/core");
2632
2868
  var import_logger11 = require("@pandacss/logger");
2633
2869
  var import_shared3 = require("@pandacss/shared");
2634
2870
  var import_fs_extra2 = __toESM(require("fs-extra"));
@@ -2654,7 +2890,7 @@ async function setupConfig(cwd, opts = {}) {
2654
2890
  const file = isTs ? "panda.config.ts" : "panda.config.mjs";
2655
2891
  import_logger11.logger.info("init:config", `creating panda config file: ${(0, import_logger11.quote)(file)}`);
2656
2892
  if (!force && configFile) {
2657
- import_logger11.logger.warn("init:config", import_core2.messages.configExists(cmd));
2893
+ import_logger11.logger.warn("init:config", import_core.messages.configExists(cmd));
2658
2894
  } else {
2659
2895
  const content = import_outdent2.outdent`
2660
2896
  import { defineConfig } from "@pandacss/dev"
@@ -2687,7 +2923,7 @@ syntax: '${syntax}'` : ""}
2687
2923
  })
2688
2924
  `;
2689
2925
  await import_fs_extra2.default.writeFile((0, import_path6.join)(cwd, file), await import_prettier.default.format(content, { parser: "babel" }));
2690
- import_logger11.logger.log(import_core2.messages.thankYou());
2926
+ import_logger11.logger.log(import_core.messages.thankYou());
2691
2927
  }
2692
2928
  }
2693
2929
  async function setupPostcss(cwd) {
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.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js
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.6_tsx@4.20.6_typescript@6.0.2_yaml@2.8.1/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.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js"() {
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.6_tsx@4.20.6_typescript@6.0.2_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js"() {
35
35
  "use strict";
36
36
  }
37
37
  });
@@ -354,7 +354,6 @@ async function buildInfo(ctx, outfile) {
354
354
  // src/builder.ts
355
355
  init_esm_shims();
356
356
  import { findConfig, getConfigDependencies } from "@pandacss/config";
357
- import { optimizeCss } from "@pandacss/core";
358
357
  import { logger as logger5 } from "@pandacss/logger";
359
358
  import { PandaError, uniq as uniq2 } from "@pandacss/shared";
360
359
  import { existsSync, statSync } from "fs";
@@ -382,7 +381,10 @@ async function codegen(ctx, ids) {
382
381
 
383
382
  // src/config.ts
384
383
  init_esm_shims();
385
- import { loadConfig as loadConfig2 } from "@pandacss/config";
384
+ import { loadConfig as loadConfig2, mergeHooks } from "@pandacss/config";
385
+ import { pluginLightningcss } from "@pandacss/plugin-lightningcss";
386
+ import { pluginSvelte } from "@pandacss/plugin-svelte";
387
+ import { pluginVue } from "@pandacss/plugin-vue";
386
388
  import browserslist from "browserslist";
387
389
 
388
390
  // src/create-context.ts
@@ -1836,8 +1838,8 @@ var nodeRuntime = {
1836
1838
  readDirSync: fsExtra.readdirSync,
1837
1839
  rmDirSync: fsExtra.emptyDirSync,
1838
1840
  rmFileSync: fsExtra.removeSync,
1839
- ensureDirSync(path4) {
1840
- return fsExtra.ensureDirSync(path4);
1841
+ ensureDirSync(path6) {
1842
+ return fsExtra.ensureDirSync(path6);
1841
1843
  },
1842
1844
  watch(options) {
1843
1845
  const { include, exclude, cwd, poll } = options;
@@ -1848,8 +1850,8 @@ var nodeRuntime = {
1848
1850
  const watcher = chokidar.watch(dirnames, {
1849
1851
  usePolling: poll,
1850
1852
  cwd,
1851
- ignored(path4, stats) {
1852
- const relativePath = relative(workingDir, path4);
1853
+ ignored(path6, stats) {
1854
+ const relativePath = relative(workingDir, path6);
1853
1855
  return !!stats?.isFile() && !isValidPath(relativePath);
1854
1856
  },
1855
1857
  ignoreInitial: true,
@@ -1866,10 +1868,10 @@ var nodeRuntime = {
1866
1868
  };
1867
1869
  process.setMaxListeners(Infinity);
1868
1870
  process.on("unhandledRejection", (reason) => {
1869
- logger2.error("\u274C", reason);
1871
+ logger2.caughtError("process", "Unhandled rejection", reason);
1870
1872
  });
1871
- process.on("uncaughtException", (reason) => {
1872
- logger2.error("\u274C", reason);
1873
+ process.on("uncaughtException", (error) => {
1874
+ logger2.caughtError("process", "Uncaught exception", error);
1873
1875
  });
1874
1876
 
1875
1877
  // src/output-engine.ts
@@ -1963,7 +1965,7 @@ var PandaContext = class extends Generator2 {
1963
1965
  const encoder = styleEncoder || this.parserOptions.encoder;
1964
1966
  result = this.project.parseSourceFile(file, encoder);
1965
1967
  } catch (error) {
1966
- logger4.error("file:extract", error);
1968
+ logger4.caughtError("file:extract", `Failed to parse ${file}`, error);
1967
1969
  }
1968
1970
  measure();
1969
1971
  return result;
@@ -1996,13 +1998,13 @@ var PandaContext = class extends Generator2 {
1996
1998
  });
1997
1999
  };
1998
2000
  writeSplitCss = async (sheet) => {
1999
- const { path: pathUtil, fs: fs3 } = this.runtime;
2001
+ const { path: pathUtil, fs: fs4 } = this.runtime;
2000
2002
  const rootDir = this.paths.root;
2001
2003
  const stylesDir = [...rootDir, "styles"];
2002
2004
  const artifacts = this.getSplitCssArtifacts(sheet);
2003
2005
  const subDirs = new Set([...artifacts.recipes, ...artifacts.themes].map((a) => a.dir).filter(Boolean));
2004
- fs3.ensureDirSync(pathUtil.join(...stylesDir));
2005
- subDirs.forEach((dir) => fs3.ensureDirSync(pathUtil.join(...stylesDir, dir)));
2006
+ fs4.ensureDirSync(pathUtil.join(...stylesDir));
2007
+ subDirs.forEach((dir) => fs4.ensureDirSync(pathUtil.join(...stylesDir, dir)));
2006
2008
  const styleFiles = [];
2007
2009
  for (const layer of artifacts.layers) {
2008
2010
  styleFiles.push({ file: layer.file, code: layer.code });
@@ -2072,31 +2074,268 @@ var PandaContext = class extends Generator2 {
2072
2074
  // src/load-tsconfig.ts
2073
2075
  init_esm_shims();
2074
2076
  import { convertTsPathsToRegexes } from "@pandacss/config";
2075
- async function loadTsConfig(conf, cwd) {
2076
- const { parse: parse2 } = await import("tsconfck");
2077
- const tsconfigResult = await parse2(conf.path, {
2078
- root: cwd,
2079
- //@ts-ignore
2080
- resolveWithEmptyIfConfigNotFound: true
2077
+ import path3 from "path";
2078
+
2079
+ // src/tsconfig-utils.ts
2080
+ init_esm_shims();
2081
+ import { promises as fs } from "fs";
2082
+ import path2 from "path";
2083
+ async function resolveDirectTsconfigJson(filename) {
2084
+ if (path2.extname(filename) !== ".json") return null;
2085
+ const resolved = path2.resolve(filename);
2086
+ try {
2087
+ const stat = await fs.stat(resolved);
2088
+ if (stat.isFile() || stat.isFIFO()) return resolved;
2089
+ throw new Error(`${filename} exists but is not a regular file.`);
2090
+ } catch (e) {
2091
+ if (e && typeof e === "object" && "code" in e && e.code === "ENOENT") {
2092
+ return null;
2093
+ }
2094
+ throw e;
2095
+ }
2096
+ }
2097
+ async function findClosestTsconfig(filename, root, configName = "tsconfig.json") {
2098
+ const resolvedRoot = path2.resolve(root);
2099
+ let dir = path2.dirname(path2.resolve(filename));
2100
+ for (; ; ) {
2101
+ const candidate = path2.join(dir, configName);
2102
+ try {
2103
+ const stat = await fs.stat(candidate);
2104
+ if (stat.isFile() || stat.isFIFO()) {
2105
+ return candidate;
2106
+ }
2107
+ } catch {
2108
+ }
2109
+ if (dir === resolvedRoot || path2.dirname(dir) === dir) {
2110
+ return null;
2111
+ }
2112
+ dir = path2.dirname(dir);
2113
+ }
2114
+ }
2115
+ function resolveBaseUrlForCompilerOptions(baseUrl, tsconfigFile, cwd) {
2116
+ if (baseUrl == null) return cwd;
2117
+ if (baseUrl.startsWith("${")) return baseUrl;
2118
+ if (path2.isAbsolute(baseUrl)) return baseUrl;
2119
+ return path2.resolve(path2.dirname(tsconfigFile), baseUrl);
2120
+ }
2121
+ var SOURCE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
2122
+ function resolveReferencedTsconfigPath(refPath, fromDir, configName = "tsconfig.json") {
2123
+ const p = refPath.endsWith(".json") ? refPath : path2.join(refPath, configName);
2124
+ return path2.resolve(fromDir, p);
2125
+ }
2126
+ async function resolveSolutionTsconfigForFile(absoluteFilename, rootTsconfigPath, rootParsed, getTsconfigModule) {
2127
+ const { parseTsconfig } = getTsconfigModule;
2128
+ if (isSourceFileIncludedInTsconfig(absoluteFilename, rootTsconfigPath, rootParsed)) {
2129
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2130
+ }
2131
+ const refs = rootParsed.references;
2132
+ if (!refs?.length) {
2133
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2134
+ }
2135
+ if (!SOURCE_EXTENSIONS.some((ext) => absoluteFilename.endsWith(ext))) {
2136
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2137
+ }
2138
+ const rootDir = path2.dirname(rootTsconfigPath);
2139
+ for (const ref of refs) {
2140
+ const refPath = resolveReferencedTsconfigPath(ref.path, rootDir);
2141
+ try {
2142
+ await fs.access(refPath);
2143
+ } catch {
2144
+ continue;
2145
+ }
2146
+ const childParsed = parseTsconfig(refPath);
2147
+ if (isSourceFileIncludedInTsconfig(absoluteFilename, refPath, childParsed)) {
2148
+ return { tsconfig: childParsed, tsconfigFile: refPath };
2149
+ }
2150
+ }
2151
+ return { tsconfig: rootParsed, tsconfigFile: rootTsconfigPath };
2152
+ }
2153
+ var POSIX_SEP_RE = new RegExp("\\" + path2.posix.sep, "g");
2154
+ var NATIVE_SEP_RE = new RegExp("\\" + path2.sep, "g");
2155
+ var PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
2156
+ var GLOB_ALL_PATTERN = `**/*`;
2157
+ var TS_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts"];
2158
+ var JS_EXTENSIONS = [".js", ".jsx", ".mjs", ".cjs"];
2159
+ var TSJS_EXTENSIONS = TS_EXTENSIONS.concat(JS_EXTENSIONS);
2160
+ var TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
2161
+ var TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.slice(1)).join("|")})`;
2162
+ var IS_POSIX = path2.posix.sep === path2.sep;
2163
+ var native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, path2.posix.sep);
2164
+ var resolve2posix = IS_POSIX ? (dir, filename) => dir ? path2.resolve(dir, filename) : path2.resolve(filename) : (dir, filename) => {
2165
+ const posix2native = (f) => f.replace(POSIX_SEP_RE, path2.sep);
2166
+ return native2posix(
2167
+ dir ? path2.resolve(posix2native(dir), posix2native(filename)) : path2.resolve(posix2native(filename))
2168
+ );
2169
+ };
2170
+ function isGlobMatch(filename, dir, patterns, allowJs) {
2171
+ const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
2172
+ return patterns.some((patternArg) => {
2173
+ let pattern = patternArg;
2174
+ let lastWildcardIndex = pattern.length;
2175
+ let hasWildcard = false;
2176
+ let hasExtension = false;
2177
+ let hasSlash = false;
2178
+ let lastSlashIndex = -1;
2179
+ for (let i = pattern.length - 1; i > -1; i--) {
2180
+ const c = pattern[i];
2181
+ if (!hasWildcard) {
2182
+ if (c === "*" || c === "?") {
2183
+ lastWildcardIndex = i;
2184
+ hasWildcard = true;
2185
+ }
2186
+ }
2187
+ if (!hasSlash) {
2188
+ if (c === ".") {
2189
+ hasExtension = true;
2190
+ } else if (c === "/") {
2191
+ lastSlashIndex = i;
2192
+ hasSlash = true;
2193
+ }
2194
+ }
2195
+ if (hasWildcard && hasSlash) {
2196
+ break;
2197
+ }
2198
+ }
2199
+ if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
2200
+ pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
2201
+ lastWildcardIndex = pattern.length - 1;
2202
+ hasWildcard = true;
2203
+ }
2204
+ if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) {
2205
+ return false;
2206
+ }
2207
+ if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) {
2208
+ return false;
2209
+ }
2210
+ if (pattern === GLOB_ALL_PATTERN) {
2211
+ return filename.startsWith(`${dir}/`);
2212
+ }
2213
+ const resolvedPattern = resolve2posix(dir, pattern);
2214
+ let firstWildcardIndex = -1;
2215
+ for (let i = 0; i < resolvedPattern.length; i++) {
2216
+ if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
2217
+ firstWildcardIndex = i;
2218
+ hasWildcard = true;
2219
+ break;
2220
+ }
2221
+ }
2222
+ if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) {
2223
+ return false;
2224
+ }
2225
+ if (!hasWildcard) {
2226
+ return filename === resolvedPattern;
2227
+ }
2228
+ if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) {
2229
+ return true;
2230
+ }
2231
+ if (PATTERN_REGEX_CACHE.has(resolvedPattern)) {
2232
+ return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
2233
+ }
2234
+ const regex2 = pattern2regex(resolvedPattern, allowJs);
2235
+ PATTERN_REGEX_CACHE.set(resolvedPattern, regex2);
2236
+ return regex2.test(filename);
2081
2237
  });
2082
- if (!tsconfigResult) return;
2083
- const { tsconfig, tsconfigFile } = tsconfigResult;
2084
- const { compilerOptions } = tsconfig;
2238
+ }
2239
+ function pattern2regex(resolvedPattern, allowJs) {
2240
+ let regexStr = "^";
2241
+ for (let i = 0; i < resolvedPattern.length; i++) {
2242
+ const char = resolvedPattern[i];
2243
+ if (char === "?") {
2244
+ regexStr += "[^\\/]";
2245
+ continue;
2246
+ }
2247
+ if (char === "*") {
2248
+ if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
2249
+ i += 2;
2250
+ regexStr += "(?:[^\\/]*\\/)*";
2251
+ continue;
2252
+ }
2253
+ regexStr += "[^\\/]*";
2254
+ continue;
2255
+ }
2256
+ if ("/.+^${}()|[]\\".includes(char)) {
2257
+ regexStr += "\\";
2258
+ }
2259
+ regexStr += char;
2260
+ }
2261
+ if (resolvedPattern.endsWith("*")) {
2262
+ regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
2263
+ }
2264
+ regexStr += "$";
2265
+ return new RegExp(regexStr);
2266
+ }
2267
+ function isIncluded(filename, tsconfigFile, tsconfig) {
2268
+ const dir = native2posix(path2.dirname(tsconfigFile));
2269
+ const files = (tsconfig.files || []).map((file) => resolve2posix(dir, file));
2270
+ const absoluteFilename = resolve2posix(null, filename);
2271
+ if (files.includes(filename)) {
2272
+ return true;
2273
+ }
2274
+ const allowJs = tsconfig.compilerOptions?.allowJs;
2275
+ const included = isGlobMatch(
2276
+ absoluteFilename,
2277
+ dir,
2278
+ tsconfig.include || (tsconfig.files ? [] : [GLOB_ALL_PATTERN]),
2279
+ allowJs
2280
+ );
2281
+ if (included) {
2282
+ const excluded = isGlobMatch(absoluteFilename, dir, tsconfig.exclude || [], allowJs);
2283
+ return !excluded;
2284
+ }
2285
+ return false;
2286
+ }
2287
+ function isSourceFileIncludedInTsconfig(absoluteFilename, tsconfigFile, tsconfig) {
2288
+ return isIncluded(absoluteFilename, tsconfigFile, tsconfig);
2289
+ }
2290
+
2291
+ // src/load-tsconfig.ts
2292
+ async function loadTsConfig(conf, cwd) {
2293
+ const root = cwd;
2294
+ let tsconfigFile = await resolveDirectTsconfigJson(conf.path);
2295
+ if (!tsconfigFile) {
2296
+ tsconfigFile = await findClosestTsconfig(conf.path, root, "tsconfig.json");
2297
+ }
2298
+ if (!tsconfigFile) {
2299
+ return {
2300
+ tsconfig: {},
2301
+ tsconfigFile: void 0
2302
+ };
2303
+ }
2304
+ const gtc = await import("get-tsconfig");
2305
+ const rootParsed = gtc.parseTsconfig(tsconfigFile);
2306
+ const { tsconfig, tsconfigFile: effectiveTsconfigPath } = await resolveSolutionTsconfigForFile(
2307
+ path3.resolve(conf.path),
2308
+ tsconfigFile,
2309
+ rootParsed,
2310
+ gtc
2311
+ );
2312
+ const compilerOptions = tsconfig?.compilerOptions;
2085
2313
  const result = {
2086
2314
  tsconfig,
2087
- tsconfigFile
2315
+ tsconfigFile: effectiveTsconfigPath
2088
2316
  };
2089
2317
  if (compilerOptions?.paths) {
2090
2318
  const baseUrl = compilerOptions.baseUrl;
2091
2319
  result.tsOptions = {
2092
2320
  baseUrl,
2093
- pathMappings: convertTsPathsToRegexes(compilerOptions.paths, baseUrl ?? cwd)
2321
+ pathMappings: convertTsPathsToRegexes(
2322
+ compilerOptions.paths,
2323
+ resolveBaseUrlForCompilerOptions(baseUrl, effectiveTsconfigPath, cwd)
2324
+ )
2094
2325
  };
2095
2326
  }
2096
2327
  return result;
2097
2328
  }
2098
2329
 
2099
2330
  // src/config.ts
2331
+ var RESOLVED_HOOKS_NAME = "__resolved__";
2332
+ function getAutoPlugins(config) {
2333
+ const plugins = [pluginVue(), pluginSvelte()];
2334
+ if (config.lightningcss) {
2335
+ plugins.push(pluginLightningcss());
2336
+ }
2337
+ return plugins;
2338
+ }
2100
2339
  async function loadConfigAndCreateContext(options = {}) {
2101
2340
  const { config, configPath } = options;
2102
2341
  const cwd = options.cwd ?? options?.config?.cwd ?? process.cwd();
@@ -2110,6 +2349,9 @@ async function loadConfigAndCreateContext(options = {}) {
2110
2349
  if (conf.config.lightningcss && !conf.config.browserslist) {
2111
2350
  conf.config.browserslist ||= browserslist.findConfig(cwd)?.defaults;
2112
2351
  }
2352
+ const autoPlugins = getAutoPlugins(conf.config);
2353
+ conf.hooks = mergeHooks([...autoPlugins, { name: RESOLVED_HOOKS_NAME, hooks: conf.hooks }]);
2354
+ conf.config.plugins = [...autoPlugins, ...conf.config.plugins ?? []];
2113
2355
  const tsConfResult = await loadTsConfig(conf, cwd);
2114
2356
  if (tsConfResult) {
2115
2357
  Object.assign(conf, tsConfResult);
@@ -2294,13 +2536,7 @@ var Builder = class {
2294
2536
  const sheet = ctx.createSheet();
2295
2537
  ctx.appendBaselineCss(sheet);
2296
2538
  const css = ctx.getCss(sheet);
2297
- root.append(
2298
- optimizeCss(css, {
2299
- browserslist: ctx.config.browserslist,
2300
- minify: ctx.config.minify,
2301
- lightningcss: ctx.config.lightningcss
2302
- })
2303
- );
2539
+ root.append(css);
2304
2540
  };
2305
2541
  registerDependency = (fn) => {
2306
2542
  const ctx = this.getContextOrThrow();
@@ -2317,8 +2553,8 @@ var Builder = class {
2317
2553
  // src/cpu-profile.ts
2318
2554
  init_esm_shims();
2319
2555
  import { logger as logger6 } from "@pandacss/logger";
2320
- import fs from "fs";
2321
- import path2 from "path";
2556
+ import fs2 from "fs";
2557
+ import path4 from "path";
2322
2558
  import readline from "readline";
2323
2559
  var startProfiling = async (cwd, prefix, isWatching) => {
2324
2560
  const inspector = await import("inspector").then((r) => r.default);
@@ -2382,8 +2618,8 @@ var startProfiling = async (cwd, prefix, isWatching) => {
2382
2618
  const date = /* @__PURE__ */ new Date();
2383
2619
  const timestamp = date.toISOString().replace(/[-:.]/g, "");
2384
2620
  const title = `panda-${prefix}-${timestamp}`;
2385
- const outfile = path2.join(cwd, `${title}.cpuprofile`);
2386
- fs.writeFileSync(outfile, JSON.stringify(params.profile));
2621
+ const outfile = path4.join(cwd, `${title}.cpuprofile`);
2622
+ fs2.writeFileSync(outfile, JSON.stringify(params.profile));
2387
2623
  logger6.info("cpu-prof", outfile);
2388
2624
  cb?.();
2389
2625
  });
@@ -2437,12 +2673,12 @@ async function debug(ctx, options) {
2437
2673
  const files = ctx.getFiles();
2438
2674
  const measureTotal = logger8.time.debug(`Done parsing ${files.length} files`);
2439
2675
  ctx.config.minify = false;
2440
- const { fs: fs3, path: path4 } = ctx.runtime;
2676
+ const { fs: fs4, path: path6 } = ctx.runtime;
2441
2677
  const outdir = options.outdir;
2442
2678
  if (!options.dry && outdir) {
2443
- fs3.ensureDirSync(outdir);
2679
+ fs4.ensureDirSync(outdir);
2444
2680
  logger8.info("cli", `Writing ${colors2.bold(`${outdir}/config.json`)}`);
2445
- await fs3.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2681
+ await fs4.writeFile(`${outdir}/config.json`, JSON.stringify(ctx.config, null, 2));
2446
2682
  }
2447
2683
  if (options.onlyConfig) {
2448
2684
  measureTotal();
@@ -2465,14 +2701,14 @@ async function debug(ctx, options) {
2465
2701
  if (outdir) {
2466
2702
  filesWithCss.push(file);
2467
2703
  const parsedPath = parse(file);
2468
- const relative2 = path4.relative(ctx.config.cwd, parsedPath.dir);
2469
- const astJsonPath = `${relative2}${path4.sep}${parsedPath.name}.ast.json`.replaceAll(path4.sep, "__");
2470
- const cssPath = `${relative2}${path4.sep}${parsedPath.name}.css`.replaceAll(path4.sep, "__");
2704
+ const relative2 = path6.relative(ctx.config.cwd, parsedPath.dir);
2705
+ const astJsonPath = `${relative2}${path6.sep}${parsedPath.name}.ast.json`.replaceAll(path6.sep, "__");
2706
+ const cssPath = `${relative2}${path6.sep}${parsedPath.name}.css`.replaceAll(path6.sep, "__");
2471
2707
  logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${astJsonPath}`)}`);
2472
2708
  logger8.info("cli", `Writing ${colors2.bold(`${outdir}/${cssPath}`)}`);
2473
2709
  return Promise.allSettled([
2474
- fs3.writeFile(`${outdir}${path4.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2475
- fs3.writeFile(`${outdir}${path4.sep}${cssPath}`, css)
2710
+ fs4.writeFile(`${outdir}${path6.sep}${astJsonPath}`, JSON.stringify(result.toJSON(), null, 2)),
2711
+ fs4.writeFile(`${outdir}${path6.sep}${cssPath}`, css)
2476
2712
  ]);
2477
2713
  }
2478
2714
  });
@@ -2569,16 +2805,16 @@ function setupGitIgnore(ctx) {
2569
2805
  // src/logstream.ts
2570
2806
  init_esm_shims();
2571
2807
  import { logger as logger10 } from "@pandacss/logger";
2572
- import fs2 from "fs";
2573
- import path3 from "path";
2808
+ import fs3 from "fs";
2809
+ import path5 from "path";
2574
2810
  var setLogStream = (options) => {
2575
2811
  const { cwd = process.cwd() } = options;
2576
2812
  let stream;
2577
2813
  if (options.logfile) {
2578
- const outPath = path3.resolve(cwd, options.logfile);
2814
+ const outPath = path5.resolve(cwd, options.logfile);
2579
2815
  ensure(outPath);
2580
2816
  logger10.info("logfile", outPath);
2581
- stream = fs2.createWriteStream(outPath, { flags: "a" });
2817
+ stream = fs3.createWriteStream(outPath, { flags: "a" });
2582
2818
  logger10.onLog = (entry) => {
2583
2819
  stream?.write(JSON.stringify(entry) + "\n");
2584
2820
  };
@@ -2596,8 +2832,8 @@ var setLogStream = (options) => {
2596
2832
  };
2597
2833
  };
2598
2834
  var ensure = (outPath) => {
2599
- const dirname2 = path3.dirname(outPath);
2600
- fs2.mkdirSync(dirname2, { recursive: true });
2835
+ const dirname2 = path5.dirname(outPath);
2836
+ fs3.mkdirSync(dirname2, { recursive: true });
2601
2837
  return outPath;
2602
2838
  };
2603
2839
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/node",
3
- "version": "1.9.1",
3
+ "version": "1.10.0",
4
4
  "description": "The core css panda library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -46,22 +46,25 @@
46
46
  "p-limit": "5.0.0",
47
47
  "perfect-debounce": "1.0.0",
48
48
  "pkg-types": "2.3.0",
49
- "picomatch": "4.0.3",
49
+ "picomatch": "4.0.4",
50
50
  "pluralize": "8.0.0",
51
51
  "postcss": "8.5.6",
52
52
  "prettier": "3.2.5",
53
- "ts-morph": "27.0.2",
53
+ "ts-morph": "28.0.0",
54
54
  "ts-pattern": "5.9.0",
55
- "tsconfck": "3.1.6",
56
- "@pandacss/config": "1.9.1",
57
- "@pandacss/core": "1.9.1",
58
- "@pandacss/generator": "1.9.1",
59
- "@pandacss/reporter": "1.9.1",
60
- "@pandacss/logger": "1.9.1",
61
- "@pandacss/parser": "1.9.1",
62
- "@pandacss/shared": "1.9.1",
63
- "@pandacss/token-dictionary": "1.9.1",
64
- "@pandacss/types": "1.9.1"
55
+ "get-tsconfig": "^4.13.0",
56
+ "@pandacss/config": "1.10.0",
57
+ "@pandacss/core": "1.10.0",
58
+ "@pandacss/generator": "1.10.0",
59
+ "@pandacss/plugin-lightningcss": "1.10.0",
60
+ "@pandacss/plugin-svelte": "1.10.0",
61
+ "@pandacss/plugin-vue": "1.10.0",
62
+ "@pandacss/reporter": "1.10.0",
63
+ "@pandacss/logger": "1.10.0",
64
+ "@pandacss/parser": "1.10.0",
65
+ "@pandacss/shared": "1.10.0",
66
+ "@pandacss/token-dictionary": "1.10.0",
67
+ "@pandacss/types": "1.10.0"
65
68
  },
66
69
  "devDependencies": {
67
70
  "@types/picomatch": "4.0.2",