nitro-nightly 3.0.1-20251107-000224-0e58602b → 3.0.1-20251107-104441-121cb7ef

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.
@@ -13,8 +13,8 @@ import "../_libs/tinyglobby.mjs";
13
13
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
14
14
  import "../_libs/std-env.mjs";
15
15
  import "../_libs/dot-prop.mjs";
16
- import { n as writeBuildInfo } from "../_chunks/zV3n76Yk.mjs";
17
- import { i as scanHandlers, n as writeTypes } from "../_chunks/thLbatgM.mjs";
16
+ import { n as writeBuildInfo } from "../_chunks/Ba5tS9Y6.mjs";
17
+ import { i as scanHandlers, n as writeTypes } from "../_chunks/Dk8nyx2j.mjs";
18
18
  import "../_libs/mime.mjs";
19
19
  import "../_libs/pathe.mjs";
20
20
  import "../_libs/untyped.mjs";
@@ -27,7 +27,7 @@ import { n as baseBuildConfig, r as replace, t as baseBuildPlugins } from "./com
27
27
  import "../_libs/remapping.mjs";
28
28
  import "../_libs/unwasm.mjs";
29
29
  import "../_libs/etag.mjs";
30
- import { n as raw, t as generateFSTree } from "../_chunks/H3oOYREn.mjs";
30
+ import { n as raw, t as generateFSTree } from "../_chunks/BUUEtsO2.mjs";
31
31
  import "../_libs/duplexer.mjs";
32
32
  import "../_libs/gzip-size.mjs";
33
33
  import "../_libs/pretty-bytes.mjs";
@@ -46,6 +46,7 @@ const getRolldownConfig = (nitro) => {
46
46
  ["\0nitro-wasm:", "wasm"],
47
47
  ["\0", "virtual"]
48
48
  ];
49
+ const tsc = nitro.options.typescript.tsConfig?.compilerOptions;
49
50
  let config = {
50
51
  cwd: nitro.options.rootDir,
51
52
  input: nitro.options.entry,
@@ -71,9 +72,10 @@ const getRolldownConfig = (nitro) => {
71
72
  transform: {
72
73
  inject: base.env.inject,
73
74
  jsx: {
74
- runtime: nitro.options.esbuild?.options?.jsx === "automatic" ? "automatic" : "classic",
75
- pragma: nitro.options.esbuild?.options?.jsxFactory,
76
- pragmaFrag: nitro.options.esbuild?.options?.jsxFragment,
75
+ runtime: tsc?.jsx === "react" ? "classic" : "automatic",
76
+ pragma: tsc?.jsxFactory,
77
+ pragmaFrag: tsc?.jsxFragmentFactory,
78
+ importSource: tsc?.jsxImportSource,
77
79
  development: nitro.options.dev
78
80
  }
79
81
  },
@@ -13,8 +13,8 @@ import "../_libs/tinyglobby.mjs";
13
13
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
14
14
  import "../_libs/std-env.mjs";
15
15
  import "../_libs/dot-prop.mjs";
16
- import { n as writeBuildInfo } from "../_chunks/zV3n76Yk.mjs";
17
- import { i as scanHandlers, n as writeTypes } from "../_chunks/thLbatgM.mjs";
16
+ import { n as writeBuildInfo } from "../_chunks/Ba5tS9Y6.mjs";
17
+ import { i as scanHandlers, n as writeTypes } from "../_chunks/Dk8nyx2j.mjs";
18
18
  import "../_libs/mime.mjs";
19
19
  import "../_libs/pathe.mjs";
20
20
  import "../_libs/untyped.mjs";
@@ -29,7 +29,7 @@ import { n as baseBuildConfig, r as replace, t as baseBuildPlugins } from "./com
29
29
  import "../_libs/remapping.mjs";
30
30
  import "../_libs/unwasm.mjs";
31
31
  import "../_libs/etag.mjs";
32
- import { n as raw, t as generateFSTree } from "../_chunks/H3oOYREn.mjs";
32
+ import { n as raw, t as generateFSTree } from "../_chunks/BUUEtsO2.mjs";
33
33
  import "../_libs/duplexer.mjs";
34
34
  import "../_libs/gzip-size.mjs";
35
35
  import "../_libs/pretty-bytes.mjs";
@@ -140,6 +140,7 @@ const getRollupConfig = (nitro) => {
140
140
  function getChunkGroup(id) {
141
141
  if (id.startsWith(runtimeDir) || id.startsWith(base.presetsDir)) return "nitro";
142
142
  }
143
+ const tsc = nitro.options.typescript.tsConfig?.compilerOptions;
143
144
  let config = {
144
145
  input: nitro.options.entry,
145
146
  external: [...base.env.external],
@@ -149,6 +150,11 @@ const getRollupConfig = (nitro) => {
149
150
  target: "esnext",
150
151
  sourceMap: nitro.options.sourceMap,
151
152
  minify: nitro.options.minify,
153
+ jsx: tsc?.jsx === "react" ? "transform" : "automatic",
154
+ jsxFactory: tsc?.jsxFactory,
155
+ jsxFragment: tsc?.jsxFragmentFactory,
156
+ jsxDev: nitro.options.dev,
157
+ jsxImportSource: tsc?.jsxImportSource,
152
158
  ...nitro.options.esbuild?.options
153
159
  }),
154
160
  alias({ entries: base.aliases }),
@@ -13,11 +13,12 @@ import "../_libs/tinyglobby.mjs";
13
13
  import "../_libs/compatx.mjs";
14
14
  import "../_libs/klona.mjs";
15
15
  import { r as a } from "../_libs/std-env.mjs";
16
- import "../_chunks/qtb0dNRk.mjs";
16
+ import "../_chunks/CtS_EIO5.mjs";
17
17
  import "../_libs/escape-string-regexp.mjs";
18
+ import "../_libs/tsconfck.mjs";
18
19
  import "../_libs/dot-prop.mjs";
19
- import "../_chunks/zV3n76Yk.mjs";
20
- import "../_chunks/thLbatgM.mjs";
20
+ import "../_chunks/Ba5tS9Y6.mjs";
21
+ import "../_chunks/Dk8nyx2j.mjs";
21
22
  import "../_libs/rou3.mjs";
22
23
  import "../_libs/mime.mjs";
23
24
  import "../_libs/pathe.mjs";
@@ -2,9 +2,9 @@ import { C as join$1, D as relative$1, O as resolve$1, S as isAbsolute$1, b as d
2
2
  import { f as sanitizeFilePath } from "../_libs/local-pkg.mjs";
3
3
  import { t as formatCompatibilityDate } from "../_libs/compatx.mjs";
4
4
  import { n as T, r as a } from "../_libs/std-env.mjs";
5
- import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/qtb0dNRk.mjs";
6
- import { a as prettyPath, n as writeBuildInfo, t as getBuildInfo } from "../_chunks/zV3n76Yk.mjs";
7
- import { i as scanHandlers } from "../_chunks/thLbatgM.mjs";
5
+ import { a as createNitro, n as prepare, r as copyPublicAssets } from "../_chunks/CtS_EIO5.mjs";
6
+ import { a as prettyPath, n as writeBuildInfo, t as getBuildInfo } from "../_chunks/Ba5tS9Y6.mjs";
7
+ import { i as scanHandlers } from "../_chunks/Dk8nyx2j.mjs";
8
8
  import { i as NodeDevWorker, r as NitroDevApp } from "../_dev.mjs";
9
9
  import { i as watch$1 } from "../_libs/chokidar.mjs";
10
10
  import { t as alias } from "../_libs/plugin-alias.mjs";
@@ -1,7 +1,7 @@
1
1
  import { D as relative, O as resolve, b as dirname, x as extname } from "../_libs/c12.mjs";
2
2
  import { t as glob } from "../_libs/tinyglobby.mjs";
3
3
  import { r as a } from "../_libs/std-env.mjs";
4
- import { t as runParallel } from "./thLbatgM.mjs";
4
+ import { t as runParallel } from "./Dk8nyx2j.mjs";
5
5
  import { t as src_default } from "../_libs/mime.mjs";
6
6
  import { t as gzipSize } from "../_libs/gzip-size.mjs";
7
7
  import { t as prettyBytes } from "../_libs/pretty-bytes.mjs";
@@ -7,8 +7,9 @@ import { n as resolveCompatibilityDates, r as resolveCompatibilityDatesFromEnv }
7
7
  import { t as klona } from "../_libs/klona.mjs";
8
8
  import { i as d, r as a } from "../_libs/std-env.mjs";
9
9
  import { t as escapeStringRegexp } from "../_libs/escape-string-regexp.mjs";
10
- import { a as prettyPath, i as isDirectory, o as resolveNitroPath, s as writeFile$1 } from "./zV3n76Yk.mjs";
11
- import { i as scanHandlers, r as scanAndSyncOptions, t as runParallel } from "./thLbatgM.mjs";
10
+ import { n as parse, t as TSConfckCache } from "../_libs/tsconfck.mjs";
11
+ import { a as prettyPath, i as isDirectory, o as resolveNitroPath, s as writeFile$1 } from "./Ba5tS9Y6.mjs";
12
+ import { i as scanHandlers, r as scanAndSyncOptions, t as runParallel } from "./Dk8nyx2j.mjs";
12
13
  import { a as findRoute, i as findAllRoutes, n as addRoute, r as createRouter, t as compileRouterToString } from "../_libs/rou3.mjs";
13
14
  import { t as src_default } from "../_libs/mime.mjs";
14
15
  import { n as z, t as P } from "../_libs/ultrahtml.mjs";
@@ -86,17 +87,14 @@ const NitroDefaults = {
86
87
  replace: {},
87
88
  node: true,
88
89
  sourceMap: true,
89
- esbuild: { options: {
90
- jsxFactory: "h",
91
- jsxFragment: "Fragment"
92
- } },
90
+ esbuild: {},
93
91
  typescript: {
94
92
  strict: true,
95
93
  generateRuntimeConfigTypes: false,
96
94
  generateTsConfig: false,
97
95
  tsconfigPath: "tsconfig.json",
98
96
  internalPaths: false,
99
- tsConfig: {}
97
+ tsConfig: void 0
100
98
  },
101
99
  nodeModulesDirs: [],
102
100
  hooks: {},
@@ -298,6 +296,53 @@ async function resolveOpenAPIOptions(options) {
298
296
  }
299
297
  }
300
298
 
299
+ //#endregion
300
+ //#region src/config/resolvers/tsconfig.ts
301
+ async function resolveTsconfig(options) {
302
+ const root = resolve(options.rootDir || ".") + "/";
303
+ if (!options.typescript.tsConfig) options.typescript.tsConfig = await loadTsconfig(root);
304
+ if (options.experimental.tsconfigPaths !== false && options.typescript.tsConfig.compilerOptions?.paths) options.alias = {
305
+ ...tsConfigToAliasObj(options.typescript.tsConfig, root),
306
+ ...options.alias
307
+ };
308
+ }
309
+ async function loadTsconfig(root) {
310
+ const opts = {
311
+ root,
312
+ cache: loadTsconfig["__cache"] ??= new TSConfckCache(),
313
+ ignoreNodeModules: true
314
+ };
315
+ const tsConfigPath = join(root, "tsconfig.json");
316
+ const parsed = await parse(tsConfigPath, opts).catch(() => void 0);
317
+ if (!parsed) return {};
318
+ const { tsconfig, tsconfigFile } = parsed;
319
+ tsconfig.compilerOptions ??= {};
320
+ if (!tsconfig.compilerOptions.baseUrl) tsconfig.compilerOptions.baseUrl = resolve(tsconfigFile, "..");
321
+ return tsconfig;
322
+ }
323
+ function tsConfigToAliasObj(tsconfig, root) {
324
+ const compilerOptions = tsconfig?.compilerOptions;
325
+ if (!compilerOptions?.paths) return {};
326
+ const paths = compilerOptions.paths;
327
+ const alias = {};
328
+ for (const [key, targets] of Object.entries(paths)) {
329
+ let source = key;
330
+ let target = targets?.[0];
331
+ if (!target) continue;
332
+ if (source.includes("*") || target.includes("*")) {
333
+ source = source.replace(/\/\*$/, "");
334
+ target = target.replace(/\/\*$/, "");
335
+ if (source.includes("*") || target.includes("*")) continue;
336
+ }
337
+ if (target.startsWith(".")) {
338
+ if (!compilerOptions.baseUrl) continue;
339
+ target = resolve(root, compilerOptions.baseUrl, target) + (key.endsWith("*") ? "/" : "");
340
+ }
341
+ alias[source] = target;
342
+ }
343
+ return alias;
344
+ }
345
+
301
346
  //#endregion
302
347
  //#region src/config/resolvers/paths.ts
303
348
  const RESOLVE_EXTENSIONS = [
@@ -566,6 +611,7 @@ async function resolveBuilder(options) {
566
611
  //#region src/config/loader.ts
567
612
  const configResolvers = [
568
613
  resolveCompatibilityOptions,
614
+ resolveTsconfig,
569
615
  resolvePathOptions,
570
616
  resolveImportsOptions,
571
617
  resolveRouteRulesOptions,
@@ -3,7 +3,7 @@ import { C as join, D as relative, O as resolve, S as isAbsolute, b as dirname,
3
3
  import { c as parseNodeModulePath, s as lookupNodeModuleSubpath } from "../_libs/local-pkg.mjs";
4
4
  import { s as toExports } from "../_libs/unimport.mjs";
5
5
  import { t as glob } from "../_libs/tinyglobby.mjs";
6
- import { i as isDirectory, o as resolveNitroPath, s as writeFile } from "./zV3n76Yk.mjs";
6
+ import { i as isDirectory, o as resolveNitroPath, s as writeFile } from "./Ba5tS9Y6.mjs";
7
7
  import { t as resolveAlias } from "../_libs/pathe.mjs";
8
8
  import { n as resolveSchema, t as generateTypes } from "../_libs/untyped.mjs";
9
9
  import { existsSync, promises } from "node:fs";
package/dist/_dev.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { C as join$1, O as resolve$1, n as debounce, x as extname$1 } from "./_libs/c12.mjs";
2
2
  import { n as T, r as a } from "./_libs/std-env.mjs";
3
- import { r as writeDevBuildInfo } from "./_chunks/zV3n76Yk.mjs";
3
+ import { r as writeDevBuildInfo } from "./_chunks/Ba5tS9Y6.mjs";
4
4
  import { t as src_default } from "./_libs/mime.mjs";
5
5
  import { n as createProxyServer } from "./_libs/httpxy.mjs";
6
6
  import { i as watch$1 } from "./_libs/chokidar.mjs";
@@ -0,0 +1,832 @@
1
+ import path from "node:path";
2
+ import fs, { promises } from "node:fs";
3
+ import { createRequire } from "module";
4
+
5
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/util.js
6
+ const POSIX_SEP_RE = new RegExp("\\" + path.posix.sep, "g");
7
+ const NATIVE_SEP_RE = new RegExp("\\" + path.sep, "g");
8
+ /** @type {Map<string,RegExp>}*/
9
+ const PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
10
+ const GLOB_ALL_PATTERN = `**/*`;
11
+ const TS_EXTENSIONS = [
12
+ ".ts",
13
+ ".tsx",
14
+ ".mts",
15
+ ".cts"
16
+ ];
17
+ const TSJS_EXTENSIONS = TS_EXTENSIONS.concat([
18
+ ".js",
19
+ ".jsx",
20
+ ".mjs",
21
+ ".cjs"
22
+ ]);
23
+ const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
24
+ const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
25
+ const IS_POSIX = path.posix.sep === path.sep;
26
+ /**
27
+ * @template T
28
+ * @returns {{resolve:(result:T)=>void, reject:(error:any)=>void, promise: Promise<T>}}
29
+ */
30
+ function makePromise() {
31
+ let resolve$1, reject;
32
+ return {
33
+ promise: new Promise((res, rej) => {
34
+ resolve$1 = res;
35
+ reject = rej;
36
+ }),
37
+ resolve: resolve$1,
38
+ reject
39
+ };
40
+ }
41
+ /**
42
+ * @param {string} filename
43
+ * @param {import('./cache.js').TSConfckCache} [cache]
44
+ * @returns {Promise<string|void>}
45
+ */
46
+ async function resolveTSConfigJson(filename, cache) {
47
+ if (path.extname(filename) !== ".json") return;
48
+ const tsconfig = path.resolve(filename);
49
+ if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) return tsconfig;
50
+ return promises.stat(tsconfig).then((stat) => {
51
+ if (stat.isFile() || stat.isFIFO()) return tsconfig;
52
+ else throw new Error(`${filename} exists but is not a regular file.`);
53
+ });
54
+ }
55
+ /**
56
+ *
57
+ * @param {string} dir an absolute directory path
58
+ * @returns {boolean} if dir path includes a node_modules segment
59
+ */
60
+ const isInNodeModules = IS_POSIX ? (dir) => dir.includes("/node_modules/") : (dir) => dir.match(/[/\\]node_modules[/\\]/);
61
+ /**
62
+ * convert posix separator to native separator
63
+ *
64
+ * eg.
65
+ * windows: C:/foo/bar -> c:\foo\bar
66
+ * linux: /foo/bar -> /foo/bar
67
+ *
68
+ * @param {string} filename with posix separators
69
+ * @returns {string} filename with native separators
70
+ */
71
+ const posix2native = IS_POSIX ? (filename) => filename : (filename) => filename.replace(POSIX_SEP_RE, path.sep);
72
+ /**
73
+ * convert native separator to posix separator
74
+ *
75
+ * eg.
76
+ * windows: C:\foo\bar -> c:/foo/bar
77
+ * linux: /foo/bar -> /foo/bar
78
+ *
79
+ * @param {string} filename - filename with native separators
80
+ * @returns {string} filename with posix separators
81
+ */
82
+ const native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, path.posix.sep);
83
+ /**
84
+ * converts params to native separator, resolves path and converts native back to posix
85
+ *
86
+ * needed on windows to handle posix paths in tsconfig
87
+ *
88
+ * @param dir {string|null} directory to resolve from
89
+ * @param filename {string} filename or pattern to resolve
90
+ * @returns string
91
+ */
92
+ const resolve2posix = IS_POSIX ? (dir, filename) => dir ? path.resolve(dir, filename) : path.resolve(filename) : (dir, filename) => native2posix(dir ? path.resolve(posix2native(dir), posix2native(filename)) : path.resolve(posix2native(filename)));
93
+ /**
94
+ *
95
+ * @param {import('./public.d.ts').TSConfckParseResult} result
96
+ * @param {import('./public.d.ts').TSConfckParseOptions} [options]
97
+ * @returns {string[]}
98
+ */
99
+ function resolveReferencedTSConfigFiles(result, options) {
100
+ const dir = path.dirname(result.tsconfigFile);
101
+ return result.tsconfig.references.map((ref) => {
102
+ return resolve2posix(dir, ref.path.endsWith(".json") ? ref.path : path.join(ref.path, options?.configName ?? "tsconfig.json"));
103
+ });
104
+ }
105
+ /**
106
+ * @param {string} filename
107
+ * @param {import('./public.d.ts').TSConfckParseResult} result
108
+ * @returns {import('./public.d.ts').TSConfckParseResult}
109
+ */
110
+ function resolveSolutionTSConfig(filename, result) {
111
+ const extensions = result.tsconfig.compilerOptions?.allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
112
+ if (result.referenced && extensions.some((ext) => filename.endsWith(ext)) && !isIncluded(filename, result)) {
113
+ const solutionTSConfig = result.referenced.find((referenced) => isIncluded(filename, referenced));
114
+ if (solutionTSConfig) return solutionTSConfig;
115
+ }
116
+ return result;
117
+ }
118
+ /**
119
+ *
120
+ * @param {string} filename
121
+ * @param {import('./public.d.ts').TSConfckParseResult} result
122
+ * @returns {boolean}
123
+ */
124
+ function isIncluded(filename, result) {
125
+ const dir = native2posix(path.dirname(result.tsconfigFile));
126
+ const files = (result.tsconfig.files || []).map((file) => resolve2posix(dir, file));
127
+ const absoluteFilename = resolve2posix(null, filename);
128
+ if (files.includes(filename)) return true;
129
+ const allowJs = result.tsconfig.compilerOptions?.allowJs;
130
+ if (isGlobMatch(absoluteFilename, dir, result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN]), allowJs)) return !isGlobMatch(absoluteFilename, dir, result.tsconfig.exclude || [], allowJs);
131
+ return false;
132
+ }
133
+ /**
134
+ * test filenames agains glob patterns in tsconfig
135
+ *
136
+ * @param filename {string} posix style abolute path to filename to test
137
+ * @param dir {string} posix style absolute path to directory of tsconfig containing patterns
138
+ * @param patterns {string[]} glob patterns to match against
139
+ * @param allowJs {boolean} allowJs setting in tsconfig to include js extensions in checks
140
+ * @returns {boolean} true when at least one pattern matches filename
141
+ */
142
+ function isGlobMatch(filename, dir, patterns, allowJs) {
143
+ const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
144
+ return patterns.some((pattern) => {
145
+ let lastWildcardIndex = pattern.length;
146
+ let hasWildcard = false;
147
+ let hasExtension = false;
148
+ let hasSlash = false;
149
+ let lastSlashIndex = -1;
150
+ for (let i = pattern.length - 1; i > -1; i--) {
151
+ const c = pattern[i];
152
+ if (!hasWildcard) {
153
+ if (c === "*" || c === "?") {
154
+ lastWildcardIndex = i;
155
+ hasWildcard = true;
156
+ }
157
+ }
158
+ if (!hasSlash) {
159
+ if (c === ".") hasExtension = true;
160
+ else if (c === "/") {
161
+ lastSlashIndex = i;
162
+ hasSlash = true;
163
+ }
164
+ }
165
+ if (hasWildcard && hasSlash) break;
166
+ }
167
+ if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
168
+ pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
169
+ lastWildcardIndex = pattern.length - 1;
170
+ hasWildcard = true;
171
+ }
172
+ if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) return false;
173
+ if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) return false;
174
+ if (pattern === GLOB_ALL_PATTERN) return filename.startsWith(`${dir}/`);
175
+ const resolvedPattern = resolve2posix(dir, pattern);
176
+ let firstWildcardIndex = -1;
177
+ for (let i = 0; i < resolvedPattern.length; i++) if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
178
+ firstWildcardIndex = i;
179
+ hasWildcard = true;
180
+ break;
181
+ }
182
+ if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) return false;
183
+ if (!hasWildcard) return filename === resolvedPattern;
184
+ else if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) return true;
185
+ if (PATTERN_REGEX_CACHE.has(resolvedPattern)) return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
186
+ const regex = pattern2regex(resolvedPattern, allowJs);
187
+ PATTERN_REGEX_CACHE.set(resolvedPattern, regex);
188
+ return regex.test(filename);
189
+ });
190
+ }
191
+ /**
192
+ * @param {string} resolvedPattern
193
+ * @param {boolean} allowJs
194
+ * @returns {RegExp}
195
+ */
196
+ function pattern2regex(resolvedPattern, allowJs) {
197
+ let regexStr = "^";
198
+ for (let i = 0; i < resolvedPattern.length; i++) {
199
+ const char = resolvedPattern[i];
200
+ if (char === "?") {
201
+ regexStr += "[^\\/]";
202
+ continue;
203
+ }
204
+ if (char === "*") {
205
+ if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
206
+ i += 2;
207
+ regexStr += "(?:[^\\/]*\\/)*";
208
+ continue;
209
+ }
210
+ regexStr += "[^\\/]*";
211
+ continue;
212
+ }
213
+ if ("/.+^${}()|[]\\".includes(char)) regexStr += `\\`;
214
+ regexStr += char;
215
+ }
216
+ if (resolvedPattern.endsWith("*")) regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
217
+ regexStr += "$";
218
+ return new RegExp(regexStr);
219
+ }
220
+ /**
221
+ * replace tokens like ${configDir}
222
+ * @param {import('./public.d.ts').TSConfckParseResult} result
223
+ */
224
+ function replaceTokens(result) {
225
+ if (result.tsconfig) result.tsconfig = JSON.parse(JSON.stringify(result.tsconfig).replaceAll(/"\${configDir}/g, `"${native2posix(path.dirname(result.tsconfigFile))}`));
226
+ }
227
+
228
+ //#endregion
229
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/find.js
230
+ /**
231
+ * find the closest tsconfig.json file
232
+ *
233
+ * @param {string} filename - path to file to find tsconfig for (absolute or relative to cwd)
234
+ * @param {import('./public.d.ts').TSConfckFindOptions} [options] - options
235
+ * @returns {Promise<string|null>} absolute path to closest tsconfig.json or null if not found
236
+ */
237
+ async function find(filename, options) {
238
+ let dir = path.dirname(path.resolve(filename));
239
+ if (options?.ignoreNodeModules && isInNodeModules(dir)) return null;
240
+ const cache = options?.cache;
241
+ const configName = options?.configName ?? "tsconfig.json";
242
+ if (cache?.hasConfigPath(dir, configName)) return cache.getConfigPath(dir, configName);
243
+ const { promise, resolve: resolve$1, reject } = makePromise();
244
+ if (options?.root && !path.isAbsolute(options.root)) options.root = path.resolve(options.root);
245
+ findUp(dir, {
246
+ promise,
247
+ resolve: resolve$1,
248
+ reject
249
+ }, options);
250
+ return promise;
251
+ }
252
+ /**
253
+ *
254
+ * @param {string} dir
255
+ * @param {{promise:Promise<string|null>,resolve:(result:string|null)=>void,reject:(err:any)=>void}} madePromise
256
+ * @param {import('./public.d.ts').TSConfckFindOptions} [options] - options
257
+ */
258
+ function findUp(dir, { resolve: resolve$1, reject, promise }, options) {
259
+ const { cache, root, configName } = options ?? {};
260
+ if (cache) if (cache.hasConfigPath(dir, configName)) {
261
+ let cached;
262
+ try {
263
+ cached = cache.getConfigPath(dir, configName);
264
+ } catch (e) {
265
+ reject(e);
266
+ return;
267
+ }
268
+ if (cached?.then) cached.then(resolve$1).catch(reject);
269
+ else resolve$1(cached);
270
+ } else cache.setConfigPath(dir, promise, configName);
271
+ const tsconfig = path.join(dir, options?.configName ?? "tsconfig.json");
272
+ fs.stat(tsconfig, (err, stats) => {
273
+ if (stats && (stats.isFile() || stats.isFIFO())) resolve$1(tsconfig);
274
+ else if (err?.code !== "ENOENT") reject(err);
275
+ else {
276
+ let parent;
277
+ if (root === dir || (parent = path.dirname(dir)) === dir) resolve$1(null);
278
+ else findUp(parent, {
279
+ promise,
280
+ resolve: resolve$1,
281
+ reject
282
+ }, options);
283
+ }
284
+ });
285
+ }
286
+
287
+ //#endregion
288
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/find-all.js
289
+ /**
290
+ * @typedef WalkState
291
+ * @interface
292
+ * @property {string[]} files - files
293
+ * @property {number} calls - number of ongoing calls
294
+ * @property {(dir: string)=>boolean} skip - function to skip dirs
295
+ * @property {boolean} err - error flag
296
+ * @property {string[]} configNames - config file names
297
+ */
298
+ const sep$1 = path.sep;
299
+
300
+ //#endregion
301
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/to-json.js
302
+ /**
303
+ * convert content of tsconfig.json to regular json
304
+ *
305
+ * @param {string} tsconfigJson - content of tsconfig.json
306
+ * @returns {string} content as regular json, comments and dangling commas have been replaced with whitespace
307
+ */
308
+ function toJson(tsconfigJson) {
309
+ const stripped = stripDanglingComma(stripJsonComments(stripBom(tsconfigJson)));
310
+ if (stripped.trim() === "") return "{}";
311
+ else return stripped;
312
+ }
313
+ /**
314
+ * replace dangling commas from pseudo-json string with single space
315
+ * implementation heavily inspired by strip-json-comments
316
+ *
317
+ * @param {string} pseudoJson
318
+ * @returns {string}
319
+ */
320
+ function stripDanglingComma(pseudoJson) {
321
+ let insideString = false;
322
+ let offset = 0;
323
+ let result = "";
324
+ let danglingCommaPos = null;
325
+ for (let i = 0; i < pseudoJson.length; i++) {
326
+ const currentCharacter = pseudoJson[i];
327
+ if (currentCharacter === "\"") {
328
+ if (!isEscaped(pseudoJson, i)) insideString = !insideString;
329
+ }
330
+ if (insideString) {
331
+ danglingCommaPos = null;
332
+ continue;
333
+ }
334
+ if (currentCharacter === ",") {
335
+ danglingCommaPos = i;
336
+ continue;
337
+ }
338
+ if (danglingCommaPos) {
339
+ if (currentCharacter === "}" || currentCharacter === "]") {
340
+ result += pseudoJson.slice(offset, danglingCommaPos) + " ";
341
+ offset = danglingCommaPos + 1;
342
+ danglingCommaPos = null;
343
+ } else if (!currentCharacter.match(/\s/)) danglingCommaPos = null;
344
+ }
345
+ }
346
+ return result + pseudoJson.substring(offset);
347
+ }
348
+ /**
349
+ *
350
+ * @param {string} jsonString
351
+ * @param {number} quotePosition
352
+ * @returns {boolean}
353
+ */
354
+ function isEscaped(jsonString, quotePosition) {
355
+ let index = quotePosition - 1;
356
+ let backslashCount = 0;
357
+ while (jsonString[index] === "\\") {
358
+ index -= 1;
359
+ backslashCount += 1;
360
+ }
361
+ return Boolean(backslashCount % 2);
362
+ }
363
+ /**
364
+ *
365
+ * @param {string} string
366
+ * @param {number?} start
367
+ * @param {number?} end
368
+ */
369
+ function strip(string, start, end) {
370
+ return string.slice(start, end).replace(/\S/g, " ");
371
+ }
372
+ const singleComment = Symbol("singleComment");
373
+ const multiComment = Symbol("multiComment");
374
+ /**
375
+ * @param {string} jsonString
376
+ * @returns {string}
377
+ */
378
+ function stripJsonComments(jsonString) {
379
+ let isInsideString = false;
380
+ /** @type {false | symbol} */
381
+ let isInsideComment = false;
382
+ let offset = 0;
383
+ let result = "";
384
+ for (let index = 0; index < jsonString.length; index++) {
385
+ const currentCharacter = jsonString[index];
386
+ const nextCharacter = jsonString[index + 1];
387
+ if (!isInsideComment && currentCharacter === "\"") {
388
+ if (!isEscaped(jsonString, index)) isInsideString = !isInsideString;
389
+ }
390
+ if (isInsideString) continue;
391
+ if (!isInsideComment && currentCharacter + nextCharacter === "//") {
392
+ result += jsonString.slice(offset, index);
393
+ offset = index;
394
+ isInsideComment = singleComment;
395
+ index++;
396
+ } else if (isInsideComment === singleComment && currentCharacter + nextCharacter === "\r\n") {
397
+ index++;
398
+ isInsideComment = false;
399
+ result += strip(jsonString, offset, index);
400
+ offset = index;
401
+ } else if (isInsideComment === singleComment && currentCharacter === "\n") {
402
+ isInsideComment = false;
403
+ result += strip(jsonString, offset, index);
404
+ offset = index;
405
+ } else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
406
+ result += jsonString.slice(offset, index);
407
+ offset = index;
408
+ isInsideComment = multiComment;
409
+ index++;
410
+ } else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
411
+ index++;
412
+ isInsideComment = false;
413
+ result += strip(jsonString, offset, index + 1);
414
+ offset = index + 1;
415
+ }
416
+ }
417
+ return result + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
418
+ }
419
+ /**
420
+ * @param {string} string
421
+ * @returns {string}
422
+ */
423
+ function stripBom(string) {
424
+ if (string.charCodeAt(0) === 65279) return string.slice(1);
425
+ return string;
426
+ }
427
+
428
+ //#endregion
429
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/parse.js
430
+ const not_found_result = {
431
+ tsconfigFile: null,
432
+ tsconfig: {}
433
+ };
434
+ /**
435
+ * parse the closest tsconfig.json file
436
+ *
437
+ * @param {string} filename - path to a tsconfig .json or a source file or directory (absolute or relative to cwd)
438
+ * @param {import('./public.d.ts').TSConfckParseOptions} [options] - options
439
+ * @returns {Promise<import('./public.d.ts').TSConfckParseResult>}
440
+ * @throws {TSConfckParseError}
441
+ */
442
+ async function parse(filename, options) {
443
+ /** @type {import('./cache.js').TSConfckCache} */
444
+ const cache = options?.cache;
445
+ if (cache?.hasParseResult(filename)) return getParsedDeep(filename, cache, options);
446
+ const { resolve: resolve$1, reject, promise } = makePromise();
447
+ cache?.setParseResult(filename, promise, true);
448
+ try {
449
+ let tsconfigFile = await resolveTSConfigJson(filename, cache) || await find(filename, options);
450
+ if (!tsconfigFile) {
451
+ resolve$1(not_found_result);
452
+ return promise;
453
+ }
454
+ let result;
455
+ if (filename !== tsconfigFile && cache?.hasParseResult(tsconfigFile)) result = await getParsedDeep(tsconfigFile, cache, options);
456
+ else {
457
+ result = await parseFile(tsconfigFile, cache, filename === tsconfigFile);
458
+ await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
459
+ }
460
+ replaceTokens(result);
461
+ resolve$1(resolveSolutionTSConfig(filename, result));
462
+ } catch (e) {
463
+ reject(e);
464
+ }
465
+ return promise;
466
+ }
467
+ /**
468
+ * ensure extends and references are parsed
469
+ *
470
+ * @param {string} filename - cached file
471
+ * @param {import('./cache.js').TSConfckCache} cache - cache
472
+ * @param {import('./public.d.ts').TSConfckParseOptions} options - options
473
+ */
474
+ async function getParsedDeep(filename, cache, options) {
475
+ const result = await cache.getParseResult(filename);
476
+ if (result.tsconfig.extends && !result.extended || result.tsconfig.references && !result.referenced) {
477
+ const promise = Promise.all([parseExtends(result, cache), parseReferences(result, options)]).then(() => result);
478
+ cache.setParseResult(filename, promise, true);
479
+ return promise;
480
+ }
481
+ return result;
482
+ }
483
+ /**
484
+ *
485
+ * @param {string} tsconfigFile - path to tsconfig file
486
+ * @param {import('./cache.js').TSConfckCache} [cache] - cache
487
+ * @param {boolean} [skipCache] - skip cache
488
+ * @returns {Promise<import('./public.d.ts').TSConfckParseResult>}
489
+ */
490
+ async function parseFile(tsconfigFile, cache, skipCache) {
491
+ if (!skipCache && cache?.hasParseResult(tsconfigFile) && !cache.getParseResult(tsconfigFile)._isRootFile_) return cache.getParseResult(tsconfigFile);
492
+ const promise = promises.readFile(tsconfigFile, "utf-8").then(toJson).then((json) => {
493
+ const parsed = JSON.parse(json);
494
+ applyDefaults(parsed, tsconfigFile);
495
+ return {
496
+ tsconfigFile,
497
+ tsconfig: normalizeTSConfig(parsed, path.dirname(tsconfigFile))
498
+ };
499
+ }).catch((e) => {
500
+ throw new TSConfckParseError(`parsing ${tsconfigFile} failed: ${e}`, "PARSE_FILE", tsconfigFile, e);
501
+ });
502
+ if (!skipCache && (!cache?.hasParseResult(tsconfigFile) || !cache.getParseResult(tsconfigFile)._isRootFile_)) cache?.setParseResult(tsconfigFile, promise);
503
+ return promise;
504
+ }
505
+ /**
506
+ * normalize to match the output of ts.parseJsonConfigFileContent
507
+ *
508
+ * @param {any} tsconfig - typescript tsconfig output
509
+ * @param {string} dir - directory
510
+ */
511
+ function normalizeTSConfig(tsconfig, dir) {
512
+ const baseUrl = tsconfig.compilerOptions?.baseUrl;
513
+ if (baseUrl && !baseUrl.startsWith("${") && !path.isAbsolute(baseUrl)) tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
514
+ return tsconfig;
515
+ }
516
+ /**
517
+ *
518
+ * @param {import('./public.d.ts').TSConfckParseResult} result
519
+ * @param {import('./public.d.ts').TSConfckParseOptions} [options]
520
+ * @returns {Promise<void>}
521
+ */
522
+ async function parseReferences(result, options) {
523
+ if (!result.tsconfig.references) return;
524
+ const referencedFiles = resolveReferencedTSConfigFiles(result, options);
525
+ const referenced = await Promise.all(referencedFiles.map((file) => parseFile(file, options?.cache)));
526
+ await Promise.all(referenced.map((ref) => parseExtends(ref, options?.cache)));
527
+ referenced.forEach((ref) => {
528
+ ref.solution = result;
529
+ replaceTokens(ref);
530
+ });
531
+ result.referenced = referenced;
532
+ }
533
+ /**
534
+ * @param {import('./public.d.ts').TSConfckParseResult} result
535
+ * @param {import('./cache.js').TSConfckCache}[cache]
536
+ * @returns {Promise<void>}
537
+ */
538
+ async function parseExtends(result, cache) {
539
+ if (!result.tsconfig.extends) return;
540
+ /** @type {import('./public.d.ts').TSConfckParseResult[]} */
541
+ const extended = [{
542
+ tsconfigFile: result.tsconfigFile,
543
+ tsconfig: JSON.parse(JSON.stringify(result.tsconfig))
544
+ }];
545
+ let pos = 0;
546
+ /** @type {string[]} */
547
+ const extendsPath = [];
548
+ let currentBranchDepth = 0;
549
+ while (pos < extended.length) {
550
+ const extending = extended[pos];
551
+ extendsPath.push(extending.tsconfigFile);
552
+ if (extending.tsconfig.extends) {
553
+ currentBranchDepth += 1;
554
+ /** @type {string[]} */
555
+ let resolvedExtends;
556
+ if (!Array.isArray(extending.tsconfig.extends)) resolvedExtends = [resolveExtends(extending.tsconfig.extends, extending.tsconfigFile)];
557
+ else resolvedExtends = extending.tsconfig.extends.reverse().map((ex) => resolveExtends(ex, extending.tsconfigFile));
558
+ const circularExtends = resolvedExtends.find((tsconfigFile) => extendsPath.includes(tsconfigFile));
559
+ if (circularExtends) throw new TSConfckParseError(`Circular dependency in "extends": ${extendsPath.concat([circularExtends]).join(" -> ")}`, "EXTENDS_CIRCULAR", result.tsconfigFile);
560
+ extended.splice(pos + 1, 0, ...await Promise.all(resolvedExtends.map((file) => parseFile(file, cache))));
561
+ } else {
562
+ extendsPath.splice(-currentBranchDepth);
563
+ currentBranchDepth = 0;
564
+ }
565
+ pos = pos + 1;
566
+ }
567
+ result.extended = extended;
568
+ for (const ext of result.extended.slice(1)) extendTSConfig(result, ext);
569
+ }
570
+ /**
571
+ *
572
+ * @param {string} extended
573
+ * @param {string} from
574
+ * @returns {string}
575
+ */
576
+ function resolveExtends(extended, from) {
577
+ if ([".", ".."].includes(extended)) extended = extended + "/tsconfig.json";
578
+ const req = createRequire(from);
579
+ let error;
580
+ try {
581
+ return req.resolve(extended);
582
+ } catch (e) {
583
+ error = e;
584
+ }
585
+ if (extended[0] !== "." && !path.isAbsolute(extended)) try {
586
+ return req.resolve(`${extended}/tsconfig.json`);
587
+ } catch (e) {
588
+ error = e;
589
+ }
590
+ throw new TSConfckParseError(`failed to resolve "extends":"${extended}" in ${from}`, "EXTENDS_RESOLVE", from, error);
591
+ }
592
+ const EXTENDABLE_KEYS = [
593
+ "compilerOptions",
594
+ "files",
595
+ "include",
596
+ "exclude",
597
+ "watchOptions",
598
+ "compileOnSave",
599
+ "typeAcquisition",
600
+ "buildOptions"
601
+ ];
602
+ /**
603
+ *
604
+ * @param {import('./public.d.ts').TSConfckParseResult} extending
605
+ * @param {import('./public.d.ts').TSConfckParseResult} extended
606
+ * @returns void
607
+ */
608
+ function extendTSConfig(extending, extended) {
609
+ const extendingConfig = extending.tsconfig;
610
+ const extendedConfig = extended.tsconfig;
611
+ const relativePath = native2posix(path.relative(path.dirname(extending.tsconfigFile), path.dirname(extended.tsconfigFile)));
612
+ for (const key of Object.keys(extendedConfig).filter((key$1) => EXTENDABLE_KEYS.includes(key$1))) if (key === "compilerOptions") {
613
+ if (!extendingConfig.compilerOptions) extendingConfig.compilerOptions = {};
614
+ for (const option of Object.keys(extendedConfig.compilerOptions)) {
615
+ if (Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) continue;
616
+ extendingConfig.compilerOptions[option] = rebaseRelative(option, extendedConfig.compilerOptions[option], relativePath);
617
+ }
618
+ } else if (extendingConfig[key] === void 0) if (key === "watchOptions") {
619
+ extendingConfig.watchOptions = {};
620
+ for (const option of Object.keys(extendedConfig.watchOptions)) extendingConfig.watchOptions[option] = rebaseRelative(option, extendedConfig.watchOptions[option], relativePath);
621
+ } else extendingConfig[key] = rebaseRelative(key, extendedConfig[key], relativePath);
622
+ }
623
+ const REBASE_KEYS = [
624
+ "files",
625
+ "include",
626
+ "exclude",
627
+ "baseUrl",
628
+ "rootDir",
629
+ "rootDirs",
630
+ "typeRoots",
631
+ "outDir",
632
+ "outFile",
633
+ "declarationDir",
634
+ "excludeDirectories",
635
+ "excludeFiles"
636
+ ];
637
+ /** @typedef {string | string[]} PathValue */
638
+ /**
639
+ *
640
+ * @param {string} key
641
+ * @param {PathValue} value
642
+ * @param {string} prependPath
643
+ * @returns {PathValue}
644
+ */
645
+ function rebaseRelative(key, value, prependPath) {
646
+ if (!REBASE_KEYS.includes(key)) return value;
647
+ if (Array.isArray(value)) return value.map((x) => rebasePath(x, prependPath));
648
+ else return rebasePath(value, prependPath);
649
+ }
650
+ /**
651
+ *
652
+ * @param {string} value
653
+ * @param {string} prependPath
654
+ * @returns {string}
655
+ */
656
+ function rebasePath(value, prependPath) {
657
+ if (path.isAbsolute(value) || value.startsWith("${configDir}")) return value;
658
+ else return path.posix.normalize(path.posix.join(prependPath, value));
659
+ }
660
+ var TSConfckParseError = class TSConfckParseError extends Error {
661
+ /**
662
+ * error code
663
+ * @type {string}
664
+ */
665
+ code;
666
+ /**
667
+ * error cause
668
+ * @type { Error | undefined}
669
+ */
670
+ cause;
671
+ /**
672
+ * absolute path of tsconfig file where the error happened
673
+ * @type {string}
674
+ */
675
+ tsconfigFile;
676
+ /**
677
+ *
678
+ * @param {string} message - error message
679
+ * @param {string} code - error code
680
+ * @param {string} tsconfigFile - path to tsconfig file
681
+ * @param {Error?} cause - cause of this error
682
+ */
683
+ constructor(message, code, tsconfigFile, cause) {
684
+ super(message);
685
+ Object.setPrototypeOf(this, TSConfckParseError.prototype);
686
+ this.name = TSConfckParseError.name;
687
+ this.code = code;
688
+ this.cause = cause;
689
+ this.tsconfigFile = tsconfigFile;
690
+ }
691
+ };
692
+ /**
693
+ *
694
+ * @param {any} tsconfig
695
+ * @param {string} tsconfigFile
696
+ */
697
+ function applyDefaults(tsconfig, tsconfigFile) {
698
+ if (isJSConfig(tsconfigFile)) tsconfig.compilerOptions = {
699
+ ...DEFAULT_JSCONFIG_COMPILER_OPTIONS,
700
+ ...tsconfig.compilerOptions
701
+ };
702
+ }
703
+ const DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
704
+ allowJs: true,
705
+ maxNodeModuleJsDepth: 2,
706
+ allowSyntheticDefaultImports: true,
707
+ skipLibCheck: true,
708
+ noEmit: true
709
+ };
710
+ /**
711
+ * @param {string} configFileName
712
+ */
713
+ function isJSConfig(configFileName) {
714
+ return path.basename(configFileName) === "jsconfig.json";
715
+ }
716
+
717
+ //#endregion
718
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/parse-native.js
719
+ /** @typedef TSDiagnosticError {
720
+ code: number;
721
+ category: number;
722
+ messageText: string;
723
+ start?: number;
724
+ } TSDiagnosticError */
725
+
726
+ //#endregion
727
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/cache.js
728
+ /** @template T */
729
+ var TSConfckCache = class {
730
+ /**
731
+ * clear cache, use this if you have a long running process and tsconfig files have been added,changed or deleted
732
+ */
733
+ clear() {
734
+ this.#configPaths.clear();
735
+ this.#parsed.clear();
736
+ }
737
+ /**
738
+ * has cached closest config for files in dir
739
+ * @param {string} dir
740
+ * @param {string} [configName=tsconfig.json]
741
+ * @returns {boolean}
742
+ */
743
+ hasConfigPath(dir, configName = "tsconfig.json") {
744
+ return this.#configPaths.has(`${dir}/${configName}`);
745
+ }
746
+ /**
747
+ * get cached closest tsconfig for files in dir
748
+ * @param {string} dir
749
+ * @param {string} [configName=tsconfig.json]
750
+ * @returns {Promise<string|null>|string|null}
751
+ * @throws {unknown} if cached value is an error
752
+ */
753
+ getConfigPath(dir, configName = "tsconfig.json") {
754
+ const key = `${dir}/${configName}`;
755
+ const value = this.#configPaths.get(key);
756
+ if (value == null || value.length || value.then) return value;
757
+ else throw value;
758
+ }
759
+ /**
760
+ * has parsed tsconfig for file
761
+ * @param {string} file
762
+ * @returns {boolean}
763
+ */
764
+ hasParseResult(file) {
765
+ return this.#parsed.has(file);
766
+ }
767
+ /**
768
+ * get parsed tsconfig for file
769
+ * @param {string} file
770
+ * @returns {Promise<T>|T}
771
+ * @throws {unknown} if cached value is an error
772
+ */
773
+ getParseResult(file) {
774
+ const value = this.#parsed.get(file);
775
+ if (value.then || value.tsconfig) return value;
776
+ else throw value;
777
+ }
778
+ /**
779
+ * @internal
780
+ * @private
781
+ * @param file
782
+ * @param {boolean} isRootFile a flag to check if current file which involking the parse() api, used to distinguish the normal cache which only parsed by parseFile()
783
+ * @param {Promise<T>} result
784
+ */
785
+ setParseResult(file, result, isRootFile = false) {
786
+ Object.defineProperty(result, "_isRootFile_", {
787
+ value: isRootFile,
788
+ writable: false,
789
+ enumerable: false,
790
+ configurable: false
791
+ });
792
+ this.#parsed.set(file, result);
793
+ result.then((parsed) => {
794
+ if (this.#parsed.get(file) === result) this.#parsed.set(file, parsed);
795
+ }).catch((e) => {
796
+ if (this.#parsed.get(file) === result) this.#parsed.set(file, e);
797
+ });
798
+ }
799
+ /**
800
+ * @internal
801
+ * @private
802
+ * @param {string} dir
803
+ * @param {Promise<string|null>} configPath
804
+ * @param {string} [configName=tsconfig.json]
805
+ */
806
+ setConfigPath(dir, configPath, configName = "tsconfig.json") {
807
+ const key = `${dir}/${configName}`;
808
+ this.#configPaths.set(key, configPath);
809
+ configPath.then((path$1) => {
810
+ if (this.#configPaths.get(key) === configPath) this.#configPaths.set(key, path$1);
811
+ }).catch((e) => {
812
+ if (this.#configPaths.get(key) === configPath) this.#configPaths.set(key, e);
813
+ });
814
+ }
815
+ /**
816
+ * map directories to their closest tsconfig.json
817
+ * @internal
818
+ * @private
819
+ * @type{Map<string,(Promise<string|null>|string|null)>}
820
+ */
821
+ #configPaths = /* @__PURE__ */ new Map();
822
+ /**
823
+ * map files to their parsed tsconfig result
824
+ * @internal
825
+ * @private
826
+ * @type {Map<string,(Promise<T>|T)> }
827
+ */
828
+ #parsed = /* @__PURE__ */ new Map();
829
+ };
830
+
831
+ //#endregion
832
+ export { parse as n, TSConfckCache as t };
package/dist/builder.mjs CHANGED
@@ -13,11 +13,12 @@ import "./_libs/tinyglobby.mjs";
13
13
  import "./_libs/compatx.mjs";
14
14
  import "./_libs/klona.mjs";
15
15
  import "./_libs/std-env.mjs";
16
- import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/qtb0dNRk.mjs";
16
+ import { a as createNitro, c as loadOptions, i as build, n as prepare, o as listTasks, r as copyPublicAssets, s as runTask, t as prerender } from "./_chunks/CtS_EIO5.mjs";
17
17
  import "./_libs/escape-string-regexp.mjs";
18
+ import "./_libs/tsconfck.mjs";
18
19
  import "./_libs/dot-prop.mjs";
19
- import { t as getBuildInfo } from "./_chunks/zV3n76Yk.mjs";
20
- import { n as writeTypes } from "./_chunks/thLbatgM.mjs";
20
+ import { t as getBuildInfo } from "./_chunks/Ba5tS9Y6.mjs";
21
+ import { n as writeTypes } from "./_chunks/Dk8nyx2j.mjs";
21
22
  import "./_libs/rou3.mjs";
22
23
  import "./_libs/mime.mjs";
23
24
  import "./_libs/pathe.mjs";
@@ -1,7 +1,7 @@
1
1
  import { O as resolve } from "../../_libs/c12.mjs";
2
2
  import "../../_libs/std-env.mjs";
3
3
  import "../../_libs/dot-prop.mjs";
4
- import "../../_chunks/zV3n76Yk.mjs";
4
+ import "../../_chunks/Ba5tS9Y6.mjs";
5
5
  import "../../_libs/mime.mjs";
6
6
  import "../../_libs/httpxy.mjs";
7
7
  import { t as NitroDevServer } from "../../_dev.mjs";
@@ -2918,6 +2918,12 @@ interface NitroOptions extends PresetOptions {
2918
2918
  * @see https://nitro.build/guide/tasks
2919
2919
  */
2920
2920
  tasks?: boolean;
2921
+ /**
2922
+ * Infer path aliases from tsconfig.json
2923
+ *
2924
+ * @default true
2925
+ */
2926
+ tsconfigPaths?: boolean;
2921
2927
  };
2922
2928
  future: {
2923
2929
  nativeSWR: boolean;
package/dist/vite.mjs CHANGED
@@ -13,11 +13,12 @@ import "./_libs/tinyglobby.mjs";
13
13
  import "./_libs/compatx.mjs";
14
14
  import "./_libs/klona.mjs";
15
15
  import "./_libs/std-env.mjs";
16
- import "./_chunks/qtb0dNRk.mjs";
16
+ import "./_chunks/CtS_EIO5.mjs";
17
17
  import "./_libs/escape-string-regexp.mjs";
18
+ import "./_libs/tsconfck.mjs";
18
19
  import "./_libs/dot-prop.mjs";
19
- import "./_chunks/zV3n76Yk.mjs";
20
- import "./_chunks/thLbatgM.mjs";
20
+ import "./_chunks/Ba5tS9Y6.mjs";
21
+ import "./_chunks/Dk8nyx2j.mjs";
21
22
  import "./_libs/rou3.mjs";
22
23
  import "./_libs/mime.mjs";
23
24
  import "./_libs/pathe.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251107-000224-0e58602b",
3
+ "version": "3.0.1-20251107-104441-121cb7ef",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",
@@ -142,6 +142,7 @@
142
142
  "source-map": "^0.7.6",
143
143
  "std-env": "^3.10.0",
144
144
  "tinyglobby": "^0.2.15",
145
+ "tsconfck": "^3.1.6",
145
146
  "typescript": "^5.9.3",
146
147
  "ufo": "^1.6.1",
147
148
  "ultrahtml": "^1.6.0",
File without changes