nitro-nightly 3.0.1-20260124-165031-9c6abf17 → 3.0.1-20260127-164246-ef01b092
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/_build/common.mjs +2084 -3212
- package/dist/_build/rolldown.mjs +12 -25
- package/dist/_build/rollup.mjs +11 -27
- package/dist/_build/vite.build.mjs +7 -11
- package/dist/_chunks/dev.mjs +20 -42
- package/dist/_chunks/nitro.mjs +13 -92
- package/dist/_chunks/nitro2.mjs +1 -5
- package/dist/_chunks/utils.mjs +10 -24
- package/dist/_common.mjs +12 -24
- package/dist/_libs/citty.mjs +1 -13
- package/dist/_libs/commondir+is-reference.mjs +12 -22
- package/dist/_libs/compatx.mjs +1 -4
- package/dist/_libs/confbox.mjs +363 -376
- package/dist/_libs/escape-string-regexp.mjs +1 -4
- package/dist/_libs/estree-walker.mjs +4 -92
- package/dist/_libs/hasown+resolve+deepmerge.mjs +144 -230
- package/dist/_libs/httpxy.mjs +5 -21
- package/dist/_libs/klona.mjs +1 -4
- package/dist/_libs/nypm+giget+tinyexec.mjs +874 -926
- package/dist/_libs/plugin-alias.mjs +1 -5
- package/dist/_libs/plugin-inject.mjs +1 -5
- package/dist/_libs/plugin-json.mjs +1 -5
- package/dist/_libs/pluginutils+plugin-commonjs.d.mts +2 -2
- package/dist/_libs/pluginutils.mjs +1 -31
- package/dist/_libs/rc9+c12+dotenv.mjs +43 -83
- package/dist/_libs/readdirp+chokidar.mjs +184 -360
- package/dist/_libs/remapping.mjs +1 -5
- package/dist/_libs/resolve-uri+gen-mapping.mjs +12 -48
- package/dist/_libs/rou3.mjs +1 -32
- package/dist/_libs/tsconfck.mjs +21 -334
- package/dist/_libs/ultrahtml.mjs +3 -16
- package/dist/_libs/unimport+unplugin.mjs +15 -75
- package/dist/_presets.mjs +260 -445
- package/dist/builder.mjs +1 -2
- package/dist/cli/_chunks/build.mjs +1 -5
- package/dist/cli/_chunks/common.mjs +1 -4
- package/dist/cli/_chunks/dev.mjs +1 -5
- package/dist/cli/_chunks/list.mjs +1 -5
- package/dist/cli/_chunks/prepare.mjs +1 -5
- package/dist/cli/_chunks/run.mjs +1 -5
- package/dist/cli/_chunks/task.mjs +1 -5
- package/dist/cli/index.mjs +1 -5
- package/dist/types/index.d.mts +5 -5
- package/dist/types/index.mjs +1 -2
- package/dist/vite.mjs +44 -63
- package/package.json +21 -21
package/dist/_libs/tsconfck.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import fs, { promises } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
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
4
|
const POSIX_SEP_RE = new RegExp("\\" + path.posix.sep, "g");
|
|
7
5
|
const NATIVE_SEP_RE = new RegExp("\\" + path.sep, "g");
|
|
8
|
-
/** @type {Map<string,RegExp>}*/
|
|
9
6
|
const PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
|
|
10
7
|
const GLOB_ALL_PATTERN = `**/*`;
|
|
11
8
|
const TS_EXTENSIONS = [
|
|
@@ -23,90 +20,36 @@ const TSJS_EXTENSIONS = TS_EXTENSIONS.concat([
|
|
|
23
20
|
const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
|
|
24
21
|
const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
|
|
25
22
|
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
23
|
function makePromise() {
|
|
31
|
-
let resolve
|
|
24
|
+
let resolve, reject;
|
|
32
25
|
return {
|
|
33
26
|
promise: new Promise((res, rej) => {
|
|
34
|
-
resolve
|
|
27
|
+
resolve = res;
|
|
35
28
|
reject = rej;
|
|
36
29
|
}),
|
|
37
|
-
resolve
|
|
30
|
+
resolve,
|
|
38
31
|
reject
|
|
39
32
|
};
|
|
40
33
|
}
|
|
41
|
-
/**
|
|
42
|
-
* @param {string} filename
|
|
43
|
-
* @param {import('./cache.js').TSConfckCache} [cache]
|
|
44
|
-
* @returns {Promise<string|void>}
|
|
45
|
-
*/
|
|
46
34
|
async function resolveTSConfigJson(filename, cache) {
|
|
47
35
|
if (path.extname(filename) !== ".json") return;
|
|
48
36
|
const tsconfig = path.resolve(filename);
|
|
49
37
|
if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) return tsconfig;
|
|
50
|
-
return promises.stat(tsconfig).then((stat
|
|
51
|
-
if (stat
|
|
38
|
+
return promises.stat(tsconfig).then((stat) => {
|
|
39
|
+
if (stat.isFile() || stat.isFIFO()) return tsconfig;
|
|
52
40
|
else throw new Error(`${filename} exists but is not a regular file.`);
|
|
53
41
|
});
|
|
54
42
|
}
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
* @param {string} dir an absolute directory path
|
|
58
|
-
* @returns {boolean} if dir path includes a node_modules segment
|
|
59
|
-
*/
|
|
60
43
|
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
44
|
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
45
|
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
46
|
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
47
|
function resolveReferencedTSConfigFiles(result, options) {
|
|
100
48
|
const dir = path.dirname(result.tsconfigFile);
|
|
101
49
|
return result.tsconfig.references.map((ref) => {
|
|
102
50
|
return resolve2posix(dir, ref.path.endsWith(".json") ? ref.path : path.join(ref.path, options?.configName ?? "tsconfig.json"));
|
|
103
51
|
});
|
|
104
52
|
}
|
|
105
|
-
/**
|
|
106
|
-
* @param {string} filename
|
|
107
|
-
* @param {import('./public.d.ts').TSConfckParseResult} result
|
|
108
|
-
* @returns {import('./public.d.ts').TSConfckParseResult}
|
|
109
|
-
*/
|
|
110
53
|
function resolveSolutionTSConfig(filename, result) {
|
|
111
54
|
const extensions = result.tsconfig.compilerOptions?.allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
|
|
112
55
|
if (result.referenced && extensions.some((ext) => filename.endsWith(ext)) && !isIncluded(filename, result)) {
|
|
@@ -115,12 +58,6 @@ function resolveSolutionTSConfig(filename, result) {
|
|
|
115
58
|
}
|
|
116
59
|
return result;
|
|
117
60
|
}
|
|
118
|
-
/**
|
|
119
|
-
*
|
|
120
|
-
* @param {string} filename
|
|
121
|
-
* @param {import('./public.d.ts').TSConfckParseResult} result
|
|
122
|
-
* @returns {boolean}
|
|
123
|
-
*/
|
|
124
61
|
function isIncluded(filename, result) {
|
|
125
62
|
const dir = native2posix(path.dirname(result.tsconfigFile));
|
|
126
63
|
const files = (result.tsconfig.files || []).map((file) => resolve2posix(dir, file));
|
|
@@ -130,15 +67,6 @@ function isIncluded(filename, result) {
|
|
|
130
67
|
if (isGlobMatch(absoluteFilename, dir, result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN]), allowJs)) return !isGlobMatch(absoluteFilename, dir, result.tsconfig.exclude || [], allowJs);
|
|
131
68
|
return false;
|
|
132
69
|
}
|
|
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
70
|
function isGlobMatch(filename, dir, patterns, allowJs) {
|
|
143
71
|
const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
|
|
144
72
|
return patterns.some((pattern) => {
|
|
@@ -188,11 +116,6 @@ function isGlobMatch(filename, dir, patterns, allowJs) {
|
|
|
188
116
|
return regex.test(filename);
|
|
189
117
|
});
|
|
190
118
|
}
|
|
191
|
-
/**
|
|
192
|
-
* @param {string} resolvedPattern
|
|
193
|
-
* @param {boolean} allowJs
|
|
194
|
-
* @returns {RegExp}
|
|
195
|
-
*/
|
|
196
119
|
function pattern2regex(resolvedPattern, allowJs) {
|
|
197
120
|
let regexStr = "^";
|
|
198
121
|
for (let i = 0; i < resolvedPattern.length; i++) {
|
|
@@ -217,45 +140,25 @@ function pattern2regex(resolvedPattern, allowJs) {
|
|
|
217
140
|
regexStr += "$";
|
|
218
141
|
return new RegExp(regexStr);
|
|
219
142
|
}
|
|
220
|
-
/**
|
|
221
|
-
* replace tokens like ${configDir}
|
|
222
|
-
* @param {import('./public.d.ts').TSConfckParseResult} result
|
|
223
|
-
*/
|
|
224
143
|
function replaceTokens(result) {
|
|
225
144
|
if (result.tsconfig) result.tsconfig = JSON.parse(JSON.stringify(result.tsconfig).replaceAll(/"\${configDir}/g, `"${native2posix(path.dirname(result.tsconfigFile))}`));
|
|
226
145
|
}
|
|
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
146
|
async function find(filename, options) {
|
|
238
147
|
let dir = path.dirname(path.resolve(filename));
|
|
239
148
|
if (options?.ignoreNodeModules && isInNodeModules(dir)) return null;
|
|
240
149
|
const cache = options?.cache;
|
|
241
150
|
const configName = options?.configName ?? "tsconfig.json";
|
|
242
151
|
if (cache?.hasConfigPath(dir, configName)) return cache.getConfigPath(dir, configName);
|
|
243
|
-
const { promise, resolve
|
|
152
|
+
const { promise, resolve, reject } = makePromise();
|
|
244
153
|
if (options?.root && !path.isAbsolute(options.root)) options.root = path.resolve(options.root);
|
|
245
154
|
findUp(dir, {
|
|
246
155
|
promise,
|
|
247
|
-
resolve
|
|
156
|
+
resolve,
|
|
248
157
|
reject
|
|
249
158
|
}, options);
|
|
250
159
|
return promise;
|
|
251
160
|
}
|
|
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) {
|
|
161
|
+
function findUp(dir, { resolve, reject, promise }, options) {
|
|
259
162
|
const { cache, root, configName } = options ?? {};
|
|
260
163
|
if (cache) if (cache.hasConfigPath(dir, configName)) {
|
|
261
164
|
let cached;
|
|
@@ -265,58 +168,30 @@ function findUp(dir, { resolve: resolve$1, reject, promise }, options) {
|
|
|
265
168
|
reject(e);
|
|
266
169
|
return;
|
|
267
170
|
}
|
|
268
|
-
if (cached?.then) cached.then(resolve
|
|
269
|
-
else resolve
|
|
171
|
+
if (cached?.then) cached.then(resolve).catch(reject);
|
|
172
|
+
else resolve(cached);
|
|
270
173
|
} else cache.setConfigPath(dir, promise, configName);
|
|
271
174
|
const tsconfig = path.join(dir, options?.configName ?? "tsconfig.json");
|
|
272
175
|
fs.stat(tsconfig, (err, stats) => {
|
|
273
|
-
if (stats && (stats.isFile() || stats.isFIFO())) resolve
|
|
176
|
+
if (stats && (stats.isFile() || stats.isFIFO())) resolve(tsconfig);
|
|
274
177
|
else if (err?.code !== "ENOENT") reject(err);
|
|
275
178
|
else {
|
|
276
179
|
let parent;
|
|
277
|
-
if (root === dir || (parent = path.dirname(dir)) === dir) resolve
|
|
180
|
+
if (root === dir || (parent = path.dirname(dir)) === dir) resolve(null);
|
|
278
181
|
else findUp(parent, {
|
|
279
182
|
promise,
|
|
280
|
-
resolve
|
|
183
|
+
resolve,
|
|
281
184
|
reject
|
|
282
185
|
}, options);
|
|
283
186
|
}
|
|
284
187
|
});
|
|
285
188
|
}
|
|
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
|
-
*/
|
|
189
|
+
path.sep;
|
|
308
190
|
function toJson(tsconfigJson) {
|
|
309
191
|
const stripped = stripDanglingComma(stripJsonComments(stripBom(tsconfigJson)));
|
|
310
192
|
if (stripped.trim() === "") return "{}";
|
|
311
193
|
else return stripped;
|
|
312
194
|
}
|
|
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
195
|
function stripDanglingComma(pseudoJson) {
|
|
321
196
|
let insideString = false;
|
|
322
197
|
let offset = 0;
|
|
@@ -345,12 +220,6 @@ function stripDanglingComma(pseudoJson) {
|
|
|
345
220
|
}
|
|
346
221
|
return result + pseudoJson.substring(offset);
|
|
347
222
|
}
|
|
348
|
-
/**
|
|
349
|
-
*
|
|
350
|
-
* @param {string} jsonString
|
|
351
|
-
* @param {number} quotePosition
|
|
352
|
-
* @returns {boolean}
|
|
353
|
-
*/
|
|
354
223
|
function isEscaped(jsonString, quotePosition) {
|
|
355
224
|
let index = quotePosition - 1;
|
|
356
225
|
let backslashCount = 0;
|
|
@@ -360,24 +229,13 @@ function isEscaped(jsonString, quotePosition) {
|
|
|
360
229
|
}
|
|
361
230
|
return Boolean(backslashCount % 2);
|
|
362
231
|
}
|
|
363
|
-
/**
|
|
364
|
-
*
|
|
365
|
-
* @param {string} string
|
|
366
|
-
* @param {number?} start
|
|
367
|
-
* @param {number?} end
|
|
368
|
-
*/
|
|
369
232
|
function strip(string, start, end) {
|
|
370
233
|
return string.slice(start, end).replace(/\S/g, " ");
|
|
371
234
|
}
|
|
372
235
|
const singleComment = Symbol("singleComment");
|
|
373
236
|
const multiComment = Symbol("multiComment");
|
|
374
|
-
/**
|
|
375
|
-
* @param {string} jsonString
|
|
376
|
-
* @returns {string}
|
|
377
|
-
*/
|
|
378
237
|
function stripJsonComments(jsonString) {
|
|
379
238
|
let isInsideString = false;
|
|
380
|
-
/** @type {false | symbol} */
|
|
381
239
|
let isInsideComment = false;
|
|
382
240
|
let offset = 0;
|
|
383
241
|
let result = "";
|
|
@@ -416,39 +274,23 @@ function stripJsonComments(jsonString) {
|
|
|
416
274
|
}
|
|
417
275
|
return result + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
|
|
418
276
|
}
|
|
419
|
-
/**
|
|
420
|
-
* @param {string} string
|
|
421
|
-
* @returns {string}
|
|
422
|
-
*/
|
|
423
277
|
function stripBom(string) {
|
|
424
278
|
if (string.charCodeAt(0) === 65279) return string.slice(1);
|
|
425
279
|
return string;
|
|
426
280
|
}
|
|
427
|
-
|
|
428
|
-
//#endregion
|
|
429
|
-
//#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/parse.js
|
|
430
281
|
const not_found_result = {
|
|
431
282
|
tsconfigFile: null,
|
|
432
283
|
tsconfig: {}
|
|
433
284
|
};
|
|
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
285
|
async function parse(filename, options) {
|
|
443
|
-
/** @type {import('./cache.js').TSConfckCache} */
|
|
444
286
|
const cache = options?.cache;
|
|
445
287
|
if (cache?.hasParseResult(filename)) return getParsedDeep(filename, cache, options);
|
|
446
|
-
const { resolve
|
|
288
|
+
const { resolve, reject, promise } = makePromise();
|
|
447
289
|
cache?.setParseResult(filename, promise, true);
|
|
448
290
|
try {
|
|
449
291
|
let tsconfigFile = await resolveTSConfigJson(filename, cache) || await find(filename, options);
|
|
450
292
|
if (!tsconfigFile) {
|
|
451
|
-
resolve
|
|
293
|
+
resolve(not_found_result);
|
|
452
294
|
return promise;
|
|
453
295
|
}
|
|
454
296
|
let result;
|
|
@@ -458,19 +300,12 @@ async function parse(filename, options) {
|
|
|
458
300
|
await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
|
|
459
301
|
}
|
|
460
302
|
replaceTokens(result);
|
|
461
|
-
resolve
|
|
303
|
+
resolve(resolveSolutionTSConfig(filename, result));
|
|
462
304
|
} catch (e) {
|
|
463
305
|
reject(e);
|
|
464
306
|
}
|
|
465
307
|
return promise;
|
|
466
308
|
}
|
|
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
309
|
async function getParsedDeep(filename, cache, options) {
|
|
475
310
|
const result = await cache.getParseResult(filename);
|
|
476
311
|
if (result.tsconfig.extends && !result.extended || result.tsconfig.references && !result.referenced) {
|
|
@@ -480,13 +315,6 @@ async function getParsedDeep(filename, cache, options) {
|
|
|
480
315
|
}
|
|
481
316
|
return result;
|
|
482
317
|
}
|
|
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
318
|
async function parseFile(tsconfigFile, cache, skipCache) {
|
|
491
319
|
if (!skipCache && cache?.hasParseResult(tsconfigFile) && !cache.getParseResult(tsconfigFile)._isRootFile_) return cache.getParseResult(tsconfigFile);
|
|
492
320
|
const promise = promises.readFile(tsconfigFile, "utf-8").then(toJson).then((json) => {
|
|
@@ -502,23 +330,11 @@ async function parseFile(tsconfigFile, cache, skipCache) {
|
|
|
502
330
|
if (!skipCache && (!cache?.hasParseResult(tsconfigFile) || !cache.getParseResult(tsconfigFile)._isRootFile_)) cache?.setParseResult(tsconfigFile, promise);
|
|
503
331
|
return promise;
|
|
504
332
|
}
|
|
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
333
|
function normalizeTSConfig(tsconfig, dir) {
|
|
512
334
|
const baseUrl = tsconfig.compilerOptions?.baseUrl;
|
|
513
335
|
if (baseUrl && !baseUrl.startsWith("${") && !path.isAbsolute(baseUrl)) tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
|
|
514
336
|
return tsconfig;
|
|
515
337
|
}
|
|
516
|
-
/**
|
|
517
|
-
*
|
|
518
|
-
* @param {import('./public.d.ts').TSConfckParseResult} result
|
|
519
|
-
* @param {import('./public.d.ts').TSConfckParseOptions} [options]
|
|
520
|
-
* @returns {Promise<void>}
|
|
521
|
-
*/
|
|
522
338
|
async function parseReferences(result, options) {
|
|
523
339
|
if (!result.tsconfig.references) return;
|
|
524
340
|
const referencedFiles = resolveReferencedTSConfigFiles(result, options);
|
|
@@ -530,20 +346,13 @@ async function parseReferences(result, options) {
|
|
|
530
346
|
});
|
|
531
347
|
result.referenced = referenced;
|
|
532
348
|
}
|
|
533
|
-
/**
|
|
534
|
-
* @param {import('./public.d.ts').TSConfckParseResult} result
|
|
535
|
-
* @param {import('./cache.js').TSConfckCache}[cache]
|
|
536
|
-
* @returns {Promise<void>}
|
|
537
|
-
*/
|
|
538
349
|
async function parseExtends(result, cache) {
|
|
539
350
|
if (!result.tsconfig.extends) return;
|
|
540
|
-
/** @type {import('./public.d.ts').TSConfckParseResult[]} */
|
|
541
351
|
const extended = [{
|
|
542
352
|
tsconfigFile: result.tsconfigFile,
|
|
543
353
|
tsconfig: JSON.parse(JSON.stringify(result.tsconfig))
|
|
544
354
|
}];
|
|
545
355
|
let pos = 0;
|
|
546
|
-
/** @type {string[]} */
|
|
547
356
|
const extendsPath = [];
|
|
548
357
|
let currentBranchDepth = 0;
|
|
549
358
|
while (pos < extended.length) {
|
|
@@ -551,7 +360,6 @@ async function parseExtends(result, cache) {
|
|
|
551
360
|
extendsPath.push(extending.tsconfigFile);
|
|
552
361
|
if (extending.tsconfig.extends) {
|
|
553
362
|
currentBranchDepth += 1;
|
|
554
|
-
/** @type {string[]} */
|
|
555
363
|
let resolvedExtends;
|
|
556
364
|
if (!Array.isArray(extending.tsconfig.extends)) resolvedExtends = [resolveExtends(extending.tsconfig.extends, extending.tsconfigFile)];
|
|
557
365
|
else resolvedExtends = extending.tsconfig.extends.reverse().map((ex) => resolveExtends(ex, extending.tsconfigFile));
|
|
@@ -567,12 +375,6 @@ async function parseExtends(result, cache) {
|
|
|
567
375
|
result.extended = extended;
|
|
568
376
|
for (const ext of result.extended.slice(1)) extendTSConfig(result, ext);
|
|
569
377
|
}
|
|
570
|
-
/**
|
|
571
|
-
*
|
|
572
|
-
* @param {string} extended
|
|
573
|
-
* @param {string} from
|
|
574
|
-
* @returns {string}
|
|
575
|
-
*/
|
|
576
378
|
function resolveExtends(extended, from) {
|
|
577
379
|
if ([".", ".."].includes(extended)) extended = extended + "/tsconfig.json";
|
|
578
380
|
const req = createRequire(from);
|
|
@@ -599,17 +401,11 @@ const EXTENDABLE_KEYS = [
|
|
|
599
401
|
"typeAcquisition",
|
|
600
402
|
"buildOptions"
|
|
601
403
|
];
|
|
602
|
-
/**
|
|
603
|
-
*
|
|
604
|
-
* @param {import('./public.d.ts').TSConfckParseResult} extending
|
|
605
|
-
* @param {import('./public.d.ts').TSConfckParseResult} extended
|
|
606
|
-
* @returns void
|
|
607
|
-
*/
|
|
608
404
|
function extendTSConfig(extending, extended) {
|
|
609
405
|
const extendingConfig = extending.tsconfig;
|
|
610
406
|
const extendedConfig = extended.tsconfig;
|
|
611
407
|
const relativePath = native2posix(path.relative(path.dirname(extending.tsconfigFile), path.dirname(extended.tsconfigFile)));
|
|
612
|
-
for (const key of Object.keys(extendedConfig).filter((key
|
|
408
|
+
for (const key of Object.keys(extendedConfig).filter((key) => EXTENDABLE_KEYS.includes(key))) if (key === "compilerOptions") {
|
|
613
409
|
if (!extendingConfig.compilerOptions) extendingConfig.compilerOptions = {};
|
|
614
410
|
for (const option of Object.keys(extendedConfig.compilerOptions)) {
|
|
615
411
|
if (Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) continue;
|
|
@@ -634,52 +430,19 @@ const REBASE_KEYS = [
|
|
|
634
430
|
"excludeDirectories",
|
|
635
431
|
"excludeFiles"
|
|
636
432
|
];
|
|
637
|
-
/** @typedef {string | string[]} PathValue */
|
|
638
|
-
/**
|
|
639
|
-
*
|
|
640
|
-
* @param {string} key
|
|
641
|
-
* @param {PathValue} value
|
|
642
|
-
* @param {string} prependPath
|
|
643
|
-
* @returns {PathValue}
|
|
644
|
-
*/
|
|
645
433
|
function rebaseRelative(key, value, prependPath) {
|
|
646
434
|
if (!REBASE_KEYS.includes(key)) return value;
|
|
647
435
|
if (Array.isArray(value)) return value.map((x) => rebasePath(x, prependPath));
|
|
648
436
|
else return rebasePath(value, prependPath);
|
|
649
437
|
}
|
|
650
|
-
/**
|
|
651
|
-
*
|
|
652
|
-
* @param {string} value
|
|
653
|
-
* @param {string} prependPath
|
|
654
|
-
* @returns {string}
|
|
655
|
-
*/
|
|
656
438
|
function rebasePath(value, prependPath) {
|
|
657
439
|
if (path.isAbsolute(value) || value.startsWith("${configDir}")) return value;
|
|
658
440
|
else return path.posix.normalize(path.posix.join(prependPath, value));
|
|
659
441
|
}
|
|
660
442
|
var TSConfckParseError = class TSConfckParseError extends Error {
|
|
661
|
-
/**
|
|
662
|
-
* error code
|
|
663
|
-
* @type {string}
|
|
664
|
-
*/
|
|
665
443
|
code;
|
|
666
|
-
/**
|
|
667
|
-
* error cause
|
|
668
|
-
* @type { Error | undefined}
|
|
669
|
-
*/
|
|
670
444
|
cause;
|
|
671
|
-
/**
|
|
672
|
-
* absolute path of tsconfig file where the error happened
|
|
673
|
-
* @type {string}
|
|
674
|
-
*/
|
|
675
445
|
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
446
|
constructor(message, code, tsconfigFile, cause) {
|
|
684
447
|
super(message);
|
|
685
448
|
Object.setPrototypeOf(this, TSConfckParseError.prototype);
|
|
@@ -689,11 +452,6 @@ var TSConfckParseError = class TSConfckParseError extends Error {
|
|
|
689
452
|
this.tsconfigFile = tsconfigFile;
|
|
690
453
|
}
|
|
691
454
|
};
|
|
692
|
-
/**
|
|
693
|
-
*
|
|
694
|
-
* @param {any} tsconfig
|
|
695
|
-
* @param {string} tsconfigFile
|
|
696
|
-
*/
|
|
697
455
|
function applyDefaults(tsconfig, tsconfigFile) {
|
|
698
456
|
if (isJSConfig(tsconfigFile)) tsconfig.compilerOptions = {
|
|
699
457
|
...DEFAULT_JSCONFIG_COMPILER_OPTIONS,
|
|
@@ -707,81 +465,31 @@ const DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
|
|
|
707
465
|
skipLibCheck: true,
|
|
708
466
|
noEmit: true
|
|
709
467
|
};
|
|
710
|
-
/**
|
|
711
|
-
* @param {string} configFileName
|
|
712
|
-
*/
|
|
713
468
|
function isJSConfig(configFileName) {
|
|
714
469
|
return path.basename(configFileName) === "jsconfig.json";
|
|
715
470
|
}
|
|
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
471
|
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
472
|
clear() {
|
|
734
473
|
this.#configPaths.clear();
|
|
735
474
|
this.#parsed.clear();
|
|
736
475
|
}
|
|
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
476
|
hasConfigPath(dir, configName = "tsconfig.json") {
|
|
744
477
|
return this.#configPaths.has(`${dir}/${configName}`);
|
|
745
478
|
}
|
|
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
479
|
getConfigPath(dir, configName = "tsconfig.json") {
|
|
754
480
|
const key = `${dir}/${configName}`;
|
|
755
481
|
const value = this.#configPaths.get(key);
|
|
756
482
|
if (value == null || value.length || value.then) return value;
|
|
757
483
|
else throw value;
|
|
758
484
|
}
|
|
759
|
-
/**
|
|
760
|
-
* has parsed tsconfig for file
|
|
761
|
-
* @param {string} file
|
|
762
|
-
* @returns {boolean}
|
|
763
|
-
*/
|
|
764
485
|
hasParseResult(file) {
|
|
765
486
|
return this.#parsed.has(file);
|
|
766
487
|
}
|
|
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
488
|
getParseResult(file) {
|
|
774
489
|
const value = this.#parsed.get(file);
|
|
775
490
|
if (value.then || value.tsconfig) return value;
|
|
776
491
|
else throw value;
|
|
777
492
|
}
|
|
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
493
|
setParseResult(file, result, isRootFile = false) {
|
|
786
494
|
Object.defineProperty(result, "_isRootFile_", {
|
|
787
495
|
value: isRootFile,
|
|
@@ -796,37 +504,16 @@ var TSConfckCache = class {
|
|
|
796
504
|
if (this.#parsed.get(file) === result) this.#parsed.set(file, e);
|
|
797
505
|
});
|
|
798
506
|
}
|
|
799
|
-
/**
|
|
800
|
-
* @internal
|
|
801
|
-
* @private
|
|
802
|
-
* @param {string} dir
|
|
803
|
-
* @param {Promise<string|null>} configPath
|
|
804
|
-
* @param {string} [configName=tsconfig.json]
|
|
805
|
-
*/
|
|
806
507
|
setConfigPath(dir, configPath, configName = "tsconfig.json") {
|
|
807
508
|
const key = `${dir}/${configName}`;
|
|
808
509
|
this.#configPaths.set(key, configPath);
|
|
809
|
-
configPath.then((path
|
|
810
|
-
if (this.#configPaths.get(key) === configPath) this.#configPaths.set(key, path
|
|
510
|
+
configPath.then((path) => {
|
|
511
|
+
if (this.#configPaths.get(key) === configPath) this.#configPaths.set(key, path);
|
|
811
512
|
}).catch((e) => {
|
|
812
513
|
if (this.#configPaths.get(key) === configPath) this.#configPaths.set(key, e);
|
|
813
514
|
});
|
|
814
515
|
}
|
|
815
|
-
/**
|
|
816
|
-
* map directories to their closest tsconfig.json
|
|
817
|
-
* @internal
|
|
818
|
-
* @private
|
|
819
|
-
* @type{Map<string,(Promise<string|null>|string|null)>}
|
|
820
|
-
*/
|
|
821
516
|
#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
517
|
#parsed = /* @__PURE__ */ new Map();
|
|
829
518
|
};
|
|
830
|
-
|
|
831
|
-
//#endregion
|
|
832
|
-
export { parse as n, TSConfckCache as t };
|
|
519
|
+
export { parse as n, TSConfckCache as t };
|
package/dist/_libs/ultrahtml.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var S = Symbol("Fragment"), D = new Set([
|
|
1
|
+
var D = new Set([
|
|
3
2
|
"area",
|
|
4
3
|
"base",
|
|
5
4
|
"br",
|
|
@@ -119,20 +118,8 @@ var T = class {
|
|
|
119
118
|
await Promise.all(n);
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
|
-
}
|
|
123
|
-
constructor(t) {
|
|
124
|
-
this.callback = t;
|
|
125
|
-
}
|
|
126
|
-
visit(t, i, r) {
|
|
127
|
-
if (this.callback(t, i, r), Array.isArray(t.children)) for (let n = 0; n < t.children.length; n++) {
|
|
128
|
-
let a = t.children[n];
|
|
129
|
-
this.visit(a, t, n);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}, p = Symbol("HTMLString"), M = Symbol("AttrString"), f = Symbol("RenderFn");
|
|
121
|
+
};
|
|
133
122
|
function z(e, t) {
|
|
134
123
|
return new T(t).visit(e);
|
|
135
124
|
}
|
|
136
|
-
|
|
137
|
-
//#endregion
|
|
138
|
-
export { z as n, P as t };
|
|
125
|
+
export { z as n, P as t };
|