@voidzero-dev/vite-plus-core 0.2.9 → 0.3.1
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/rolldown/cli.mjs +6 -6
- package/dist/rolldown/config.d.mts +1 -1
- package/dist/rolldown/config.mjs +2 -2
- package/dist/rolldown/experimental-index.d.mts +34 -5
- package/dist/rolldown/experimental-index.mjs +36 -9
- package/dist/rolldown/experimental-runtime-types.d.ts +2 -2
- package/dist/rolldown/experimental-runtime.d.ts +2 -2
- package/dist/rolldown/experimental-runtime.mjs +2 -2
- package/dist/rolldown/filter-index.d.mts +1 -1
- package/dist/rolldown/filter-index.mjs +1 -3
- package/dist/rolldown/index.d.mts +3 -3
- package/dist/rolldown/index.mjs +4 -4
- package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
- package/dist/rolldown/parallel-plugin.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.d.mts +1 -1
- package/dist/rolldown/parse-ast-index.mjs +1 -1
- package/dist/rolldown/plugins-index.d.mts +3 -3
- package/dist/rolldown/plugins-index.mjs +2 -2
- package/dist/rolldown/shared/{binding-CVtkJvyl.d.mts → binding-DZuNHVw4.d.mts} +88 -5
- package/dist/rolldown/shared/{binding-CKyeQZen.mjs → binding-DmImI4pj.mjs} +29 -27
- package/dist/rolldown/shared/{bindingify-input-options-44iPAymO.mjs → bindingify-input-options-BYClWKnj.mjs} +11 -9
- package/dist/rolldown/shared/{constructors-XaIbWpwJ.d.mts → constructors-BM20b11r.d.mts} +2 -2
- package/dist/rolldown/shared/{constructors-6Zc-JFd7.mjs → constructors-mRbcbLyX.mjs} +1 -1
- package/dist/rolldown/shared/{create-bundler-option-e1FU0w0P.mjs → create-bundler-option-CHTBktos.mjs} +49 -6
- package/dist/rolldown/shared/{define-config-DVsXPNaU.d.mts → define-config-DNX0WekP.d.mts} +46 -7
- package/dist/rolldown/shared/{error-BzLGqhSQ.mjs → error-BP8lJHle.mjs} +1 -1
- package/dist/rolldown/shared/{load-config-C6QXSnoS.mjs → load-config-Cx5fx_8Q.mjs} +1 -1
- package/dist/rolldown/shared/{normalize-string-or-regex-DYjJ67tj.mjs → normalize-string-or-regex-Dm69lpQ-.mjs} +1 -1
- package/dist/rolldown/shared/{parse-uDDyc1el.mjs → parse-8sr82jSR.mjs} +2 -2
- package/dist/rolldown/shared/{resolve-tsconfig-Bcd82vVT.mjs → resolve-tsconfig-BlNGaH3Y.mjs} +10 -6
- package/dist/rolldown/shared/{rolldown-CCbQNGZt.mjs → rolldown-CaX_Wmqc.mjs} +5 -4
- package/dist/rolldown/shared/{transform-WmU_cI8e.d.mts → transform-CVse9_mH.d.mts} +8 -4
- package/dist/rolldown/shared/{watch-vuOCmvFs.mjs → watch-YKfJgIxz.mjs} +4 -4
- package/dist/rolldown/utils-index.d.mts +3 -3
- package/dist/rolldown/utils-index.mjs +5 -5
- package/dist/tsdown/{build-D_enfyvD-Dg1eKRD4.js → build-JVmLFaZt-kqQJ2U7s.js} +1705 -239
- package/dist/tsdown/debug-CpC4hV25-tvH_Dsg5.js +247 -0
- package/dist/tsdown/{detect-DGhJGEqb-6CTf16BW.js → detect-Bg-d8iUV-KfbO7neP.js} +10 -12
- package/dist/tsdown/{dist-DyXLnzyh.js → dist-Cuw3Ngo4.js} +1226 -893
- package/dist/tsdown/index-types.d.ts +277 -355
- package/dist/tsdown/index.js +4 -4
- package/dist/tsdown/internal-D-JfB5uT.js +29 -0
- package/dist/tsdown/internal-lhH-5yya.js +62 -0
- package/dist/tsdown/{main-DiierkER.js → main-CyNcZUzu.js} +8 -214
- package/dist/tsdown/{resolver-cwLsPb2o-Dk4xdAGE.js → resolver-DE0_sy8o-ZQqHQjRu.js} +4 -4
- package/dist/tsdown/rolldown-runtime-B4iAMlE-.js +35 -0
- package/dist/tsdown/run.js +44 -8
- package/dist/tsdown/{src-drVPfX63.js → src-BWidcM5N.js} +5 -5
- package/dist/tsdown/{tsc-JnMl2z7d.js → tsc-ChjRhsoQ.js} +26 -20
- package/dist/tsdown/tsdown-css.js +17 -11
- package/dist/tsdown/tsdown-exe.js +16 -5
- package/dist/tsdown/version-CQ98ZBpL-Obdnv4J7.js +141 -0
- package/dist/vite/client/bundledDevClient.mjs +69 -19
- package/dist/vite/client/client.mjs +4 -4
- package/dist/vite/node/chunks/build.js +21 -21
- package/dist/vite/node/chunks/lib.js +2 -2
- package/dist/vite/node/chunks/node.js +159 -114
- package/dist/vite/node/chunks/postcss-import.js +13 -16
- package/dist/vite/node/index.d.ts +58 -55
- package/dist/vite/node/module-runner.d.ts +13 -13
- package/dist/vite/node/module-runner.js +3 -4
- package/package.json +30 -30
- package/dist/tsdown/debug-CKcBYQLP-C3NhYhrk.js +0 -157
- package/dist/tsdown/dist-CMKwGGNp.js +0 -1059
- package/dist/tsdown/internal-DKworeK4.js +0 -3
- package/dist/tsdown/target-Bab3CUeB-DQ0pKhCv.js +0 -582
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { r as createDebug } from "./main-
|
|
2
|
-
import {
|
|
3
|
-
import { n as globalContext, t as
|
|
1
|
+
import { r as createDebug } from "./main-CyNcZUzu.js";
|
|
2
|
+
import { n as RE_DTS, r as RE_DTS_MAP } from "./internal-D-JfB5uT.js";
|
|
3
|
+
import { n as globalContext, t as requireTSApi } from "./dist-Cuw3Ngo4.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
6
|
-
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.
|
|
6
|
+
//#region ../../node_modules/.pnpm/rolldown-plugin-dts@0.28.5_@typescript+native-preview@7.0.0-dev.20260605.1_oxc-resolver_395c84c3f0e463da1bb9023138bdcb2e/node_modules/rolldown-plugin-dts/dist/tsc-9-3lXpbY.mjs
|
|
7
7
|
const debug$3 = createDebug("rolldown-plugin-dts:tsc-system");
|
|
8
|
-
const ts$3 =
|
|
8
|
+
const ts$3 = requireTSApi();
|
|
9
9
|
/**
|
|
10
10
|
* A system that writes files to both memory and disk. It will try read files
|
|
11
11
|
* from memory firstly and fallback to disk if not found.
|
|
@@ -21,7 +21,7 @@ function createFsSystem(files) {
|
|
|
21
21
|
return ts$3.sys.resolvePath(path);
|
|
22
22
|
},
|
|
23
23
|
directoryExists(directory) {
|
|
24
|
-
if (
|
|
24
|
+
if (files.keys().some((path) => path.startsWith(directory))) return true;
|
|
25
25
|
return ts$3.sys.directoryExists(directory);
|
|
26
26
|
},
|
|
27
27
|
fileExists(fileName) {
|
|
@@ -53,7 +53,7 @@ function createMemorySystem(files) {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
const ts$2 =
|
|
56
|
+
const ts$2 = requireTSApi();
|
|
57
57
|
const formatHost = {
|
|
58
58
|
getCurrentDirectory: () => ts$2.sys.getCurrentDirectory(),
|
|
59
59
|
getNewLine: () => ts$2.sys.newLine,
|
|
@@ -81,7 +81,7 @@ function setSourceMapRoot(map, originalFilePath, finalFilePath) {
|
|
|
81
81
|
const finalDir = path.posix.dirname(pathToFileURL(finalFilePath).pathname);
|
|
82
82
|
if (originalDir !== finalDir) map.sourceRoot = path.posix.relative(finalDir, originalDir);
|
|
83
83
|
}
|
|
84
|
-
const ts$1 =
|
|
84
|
+
const ts$1 = requireTSApi();
|
|
85
85
|
const debug$2 = createDebug("rolldown-plugin-dts:tsc-build");
|
|
86
86
|
function tscEmitBuild(tscOptions) {
|
|
87
87
|
const { id, tsconfig, incremental, context = globalContext, sourcemap } = tscOptions;
|
|
@@ -152,7 +152,11 @@ function buildProjects(fsSystem, tsconfig, force, sourcemap) {
|
|
|
152
152
|
debug$2(`start building projects for ${tsconfig}`);
|
|
153
153
|
const projects = collectProjectGraph(tsconfig, fsSystem, force, sourcemap);
|
|
154
154
|
debug$2("collected %d projects: %j", projects.length, projects.map((project) => project.tsconfigPath));
|
|
155
|
-
const host = ts$1.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions
|
|
155
|
+
const host = ts$1.createSolutionBuilderHost(fsSystem, createProgramWithPatchedCompilerOptions({
|
|
156
|
+
force,
|
|
157
|
+
sourcemap,
|
|
158
|
+
tsconfigPath: tsconfig
|
|
159
|
+
}));
|
|
156
160
|
const exitStatus = ts$1.createSolutionBuilder(host, [tsconfig], {
|
|
157
161
|
force,
|
|
158
162
|
verbose: true
|
|
@@ -182,7 +186,7 @@ function collectProjectGraph(rootTsconfigPath, fsSystem, force, sourcemap) {
|
|
|
182
186
|
parsedConfig.options = patchCompilerOptions(parsedConfig.options, {
|
|
183
187
|
tsconfigPath,
|
|
184
188
|
force,
|
|
185
|
-
sourcemap
|
|
189
|
+
sourcemap: sourcemap && parsedConfig.fileNames.length > 0
|
|
186
190
|
});
|
|
187
191
|
projects.push({
|
|
188
192
|
tsconfigPath,
|
|
@@ -231,11 +235,13 @@ function patchCompilerOptions(options, extraOptions) {
|
|
|
231
235
|
}
|
|
232
236
|
return options;
|
|
233
237
|
}
|
|
234
|
-
|
|
235
|
-
return
|
|
236
|
-
};
|
|
238
|
+
function createProgramWithPatchedCompilerOptions(patchOptions) {
|
|
239
|
+
return (rootNames, options, ...args) => {
|
|
240
|
+
return ts$1.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, patchCompilerOptions(options ?? {}, patchOptions), ...args);
|
|
241
|
+
};
|
|
242
|
+
}
|
|
237
243
|
const debug$1 = createDebug("rolldown-plugin-dts:tsc-compiler");
|
|
238
|
-
const ts =
|
|
244
|
+
const ts = requireTSApi();
|
|
239
245
|
const defaultCompilerOptions = {
|
|
240
246
|
declaration: true,
|
|
241
247
|
noEmit: false,
|
|
@@ -268,10 +274,10 @@ function createOrGetTsModule(options) {
|
|
|
268
274
|
context.programs.push(module.program);
|
|
269
275
|
return module;
|
|
270
276
|
}
|
|
271
|
-
function createTsProgram({ entries, id, tsconfig, tsconfigRaw,
|
|
277
|
+
function createTsProgram({ entries, id, tsconfig, tsconfigRaw, languageContext, cwd, context = globalContext }) {
|
|
272
278
|
const fsSystem = createFsSystem(context.files);
|
|
273
279
|
const baseDir = tsconfig ? path.dirname(tsconfig) : cwd;
|
|
274
|
-
const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir, void 0, void 0, void 0,
|
|
280
|
+
const parsedConfig = ts.parseJsonConfigFileContent(tsconfigRaw, fsSystem, baseDir, void 0, void 0, void 0, languageContext.getExtraFileExtensions());
|
|
275
281
|
debug$1(`creating program for root project: ${baseDir}`);
|
|
276
282
|
return createTsProgramFromParsedConfig({
|
|
277
283
|
parsedConfig,
|
|
@@ -279,20 +285,20 @@ function createTsProgram({ entries, id, tsconfig, tsconfigRaw, volarContext, cwd
|
|
|
279
285
|
baseDir,
|
|
280
286
|
id,
|
|
281
287
|
entries,
|
|
282
|
-
|
|
288
|
+
languageContext
|
|
283
289
|
});
|
|
284
290
|
}
|
|
285
|
-
function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id, entries,
|
|
291
|
+
function createTsProgramFromParsedConfig({ parsedConfig, fsSystem, baseDir, id, entries, languageContext }) {
|
|
286
292
|
const compilerOptions = {
|
|
287
293
|
...defaultCompilerOptions,
|
|
288
294
|
...parsedConfig.options,
|
|
289
295
|
$configRaw: parsedConfig.raw,
|
|
290
296
|
$rootDir: baseDir,
|
|
291
|
-
...
|
|
297
|
+
...languageContext.languages.length ? { allowNonTsExtensions: true } : void 0
|
|
292
298
|
};
|
|
293
299
|
const rootNames = [...new Set([id, ...entries || parsedConfig.fileNames].map((f) => fsSystem.resolvePath(f)))];
|
|
294
300
|
const host = ts.createCompilerHost(compilerOptions, true);
|
|
295
|
-
const program =
|
|
301
|
+
const program = languageContext.getCreateProgram(ts)({
|
|
296
302
|
rootNames,
|
|
297
303
|
options: compilerOptions,
|
|
298
304
|
host,
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as expandBaselineTarget } from "./
|
|
3
|
-
import "./internal-DKworeK4.js";
|
|
1
|
+
import { i as __toESM } from "./rolldown-runtime-B4iAMlE-.js";
|
|
2
|
+
import { a as resolveComma, i as importWithError, o as toArray, r as expandBaselineTarget } from "./internal-lhH-5yya.js";
|
|
4
3
|
import path from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
7
|
import { ResolverFactory } from "@voidzero-dev/vite-plus-core/rolldown/experimental";
|
|
9
|
-
//#region ../../node_modules/.pnpm/@tsdown+css@0.
|
|
8
|
+
//#region ../../node_modules/.pnpm/@tsdown+css@0.23.0_jiti@2.7.0_postcss-import@16.2.0_postcss@8.5.26__postcss-modules@9.0_5274324ff2ff6c48cc66985619453a8b/node_modules/@tsdown/css/dist/index.mjs
|
|
10
9
|
const defaultCssBundleName = "style.css";
|
|
11
10
|
function resolveCssOptions(options = {}, topLevelTarget, unbundle) {
|
|
12
11
|
let cssTarget;
|
|
@@ -40,9 +39,13 @@ function modulesToEsm(modules) {
|
|
|
40
39
|
function dashToCamel(str) {
|
|
41
40
|
return str.replaceAll(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
42
41
|
}
|
|
43
|
-
function applyLocalsConvention(modules, convention) {
|
|
42
|
+
function applyLocalsConvention(modules, convention, inputFile) {
|
|
44
43
|
const result = {};
|
|
45
44
|
for (const [key, value] of Object.entries(modules)) {
|
|
45
|
+
if (typeof convention === "function") {
|
|
46
|
+
result[convention(key, value, inputFile)] = value;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
46
49
|
const camelized = dashToCamel(key);
|
|
47
50
|
switch (convention) {
|
|
48
51
|
case "camelCase":
|
|
@@ -426,6 +429,7 @@ async function bundleWithLightningCSS(filename, options, code) {
|
|
|
426
429
|
sourceMap: options.sourceMap,
|
|
427
430
|
resolver: {
|
|
428
431
|
async read(filePath) {
|
|
432
|
+
if (filePath !== filename) deps.push(filePath);
|
|
429
433
|
let fileCode;
|
|
430
434
|
if (code != null && filePath === filename) fileCode = code;
|
|
431
435
|
else fileCode = readFileSync(filePath, "utf8");
|
|
@@ -604,7 +608,7 @@ async function loadFileConfig(searchPath) {
|
|
|
604
608
|
if (cached !== void 0) return cached;
|
|
605
609
|
const promise = (async () => {
|
|
606
610
|
try {
|
|
607
|
-
const postcssrc = (await import("./src-
|
|
611
|
+
const postcssrc = (await import("./src-BWidcM5N.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1))).default;
|
|
608
612
|
const result = await postcssrc({}, searchPath);
|
|
609
613
|
return {
|
|
610
614
|
options: result.options,
|
|
@@ -636,9 +640,9 @@ async function processWithPostCSS$1(code, filename, postcssOption, cwd, injectIm
|
|
|
636
640
|
let modules;
|
|
637
641
|
if (modulesOptions?.isModule) {
|
|
638
642
|
const postcssModules = await importWithError("postcss-modules");
|
|
639
|
-
const
|
|
643
|
+
const userGetJSON = modulesOptions.config?.getJSON;
|
|
640
644
|
plugins.push((postcssModules.default ?? postcssModules)({
|
|
641
|
-
...
|
|
645
|
+
...modulesOptions.config,
|
|
642
646
|
getJSON(cssFileName, json, outputFileName) {
|
|
643
647
|
modules = json;
|
|
644
648
|
userGetJSON?.(cssFileName, json, outputFileName);
|
|
@@ -751,8 +755,10 @@ function CssPlugin(config, { logger }) {
|
|
|
751
755
|
if (code.length && !code.endsWith("\n")) code += "\n";
|
|
752
756
|
if (modules) {
|
|
753
757
|
const modulesConfig = typeof cssConfig.css.modules === "object" ? cssConfig.css.modules : void 0;
|
|
754
|
-
if (
|
|
755
|
-
|
|
758
|
+
if (cssConfig.css.transformer === "lightningcss") {
|
|
759
|
+
if (modulesConfig?.localsConvention) modules = applyLocalsConvention(modules, modulesConfig.localsConvention, cleanId);
|
|
760
|
+
modulesConfig?.getJSON?.(cleanId, modules, cleanId);
|
|
761
|
+
}
|
|
756
762
|
modulesMap.set(id, modules);
|
|
757
763
|
}
|
|
758
764
|
return {
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import { n as x, r as createDebug } from "./main-
|
|
2
|
-
import {
|
|
3
|
-
import "./internal-
|
|
1
|
+
import { n as x, r as createDebug } from "./main-CyNcZUzu.js";
|
|
2
|
+
import { g as tryParse, n as normalize$1, p as isGreaterOrEqual } from "./version-CQ98ZBpL-Obdnv4J7.js";
|
|
3
|
+
import { n as NODE_SEA_MIN_VERSION_PARSED, t as NODE_SEA_MIN_VERSION } from "./internal-lhH-5yya.js";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { pipeline } from "node:stream/promises";
|
|
7
7
|
import { Readable } from "node:stream";
|
|
8
8
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
9
|
-
import { chmod, mkdir, rename } from "node:fs/promises";
|
|
9
|
+
import { access, chmod, mkdir, rename, rm } from "node:fs/promises";
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
|
-
//#region ../../node_modules/.pnpm
|
|
12
|
+
//#region ../../node_modules/.pnpm/tsdown@0.23.0_@arethetypeswrong+core@0.18.2_@tsdown+css@0.23.0_@tsdown+exe@0.23.0_@type_fb7663f033a892291c41712eea6060f6/node_modules/tsdown/dist/format-DLxyxnif.mjs
|
|
13
|
+
function fsExists(path) {
|
|
14
|
+
return access(path).then(() => true, () => false);
|
|
15
|
+
}
|
|
16
|
+
function fsRemove(path) {
|
|
17
|
+
return rm(path, {
|
|
18
|
+
force: true,
|
|
19
|
+
recursive: true
|
|
20
|
+
}).catch(() => {});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../../node_modules/.pnpm/@tsdown+exe@0.23.0_tsdown@0.23.0/node_modules/@tsdown/exe/dist/index.mjs
|
|
13
24
|
function getCacheDir() {
|
|
14
25
|
const home = os.homedir();
|
|
15
26
|
if (process.platform === "win32") {
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/comparison-DenM3wCn.js
|
|
2
|
+
const LETTER_DASH_NUMBER = "[a-zA-Z0-9-]";
|
|
3
|
+
const NUMERIC_IDENTIFIER = String.raw`0|[1-9]\d*`;
|
|
4
|
+
const NUMERIC_IDENTIFIER_LOOSE = String.raw`\d+`;
|
|
5
|
+
const NON_NUMERIC_IDENTIFIER = String.raw`\d*[a-zA-Z-]${LETTER_DASH_NUMBER}*`;
|
|
6
|
+
const MAIN_VERSION = String.raw`(${NUMERIC_IDENTIFIER})\.(${NUMERIC_IDENTIFIER})\.(${NUMERIC_IDENTIFIER})`;
|
|
7
|
+
const MAIN_VERSION_LOOSE = String.raw`(${NUMERIC_IDENTIFIER_LOOSE})\.(${NUMERIC_IDENTIFIER_LOOSE})\.(${NUMERIC_IDENTIFIER_LOOSE})`;
|
|
8
|
+
const PRERELEASE_IDENTIFIER = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER})`;
|
|
9
|
+
const PRERELEASE_IDENTIFIER_LOOSE = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER_LOOSE})`;
|
|
10
|
+
const PRERELEASE = String.raw`(?:-(${PRERELEASE_IDENTIFIER}(?:\.${PRERELEASE_IDENTIFIER})*))`;
|
|
11
|
+
const PRERELEASE_LOOSE = String.raw`(?:-?(${PRERELEASE_IDENTIFIER_LOOSE}(?:\.${PRERELEASE_IDENTIFIER_LOOSE})*))`;
|
|
12
|
+
const BUILD_IDENTIFIER = `${LETTER_DASH_NUMBER}+`;
|
|
13
|
+
const BUILD = String.raw`(?:\+(${BUILD_IDENTIFIER}(?:\.${BUILD_IDENTIFIER})*))`;
|
|
14
|
+
const FULL_PLAIN = `v?${MAIN_VERSION}${PRERELEASE}?${BUILD}?`;
|
|
15
|
+
const LOOSE_PLAIN = String.raw`[v=\s]*${MAIN_VERSION_LOOSE}${PRERELEASE_LOOSE}?${BUILD}?`;
|
|
16
|
+
const GREATER_LESS_THAN = "((?:<|>)?=?)";
|
|
17
|
+
const XRANGE_IDENTIFIER = String.raw`${NUMERIC_IDENTIFIER}|x|X|\*`;
|
|
18
|
+
const XRANGE_IDENTIFIER_LOOSE = String.raw`${NUMERIC_IDENTIFIER_LOOSE}|x|X|\*`;
|
|
19
|
+
const XRANGE_PLAIN = String.raw`[v=\s]*(${XRANGE_IDENTIFIER})(?:\.(${XRANGE_IDENTIFIER})(?:\.(${XRANGE_IDENTIFIER})(?:${PRERELEASE})?${BUILD}?)?)?`;
|
|
20
|
+
const XRANGE_PLAIN_LOOSE = String.raw`[v=\s]*(${XRANGE_IDENTIFIER_LOOSE})(?:\.(${XRANGE_IDENTIFIER_LOOSE})(?:\.(${XRANGE_IDENTIFIER_LOOSE})(?:${PRERELEASE_LOOSE})?${BUILD}?)?)?`;
|
|
21
|
+
const LONE_TILDE = "(?:~>?)";
|
|
22
|
+
const LONE_CARET = String.raw`(?:\^)`;
|
|
23
|
+
const COERCE_PLAIN = String.raw`(^|[^\d])(\d{1,${16}})(?:\.(\d{1,${16}}))?(?:\.(\d{1,${16}}))?`;
|
|
24
|
+
const COERCE = String.raw`${COERCE_PLAIN}(?:$|[^\d])`;
|
|
25
|
+
const COERCE_FULL = String.raw`${COERCE_PLAIN}(?:${PRERELEASE})?(?:${BUILD})?(?:$|[^\d])`;
|
|
26
|
+
function makeSafeRegexSource(source) {
|
|
27
|
+
const replacements = [
|
|
28
|
+
[String.raw`\s`, 1],
|
|
29
|
+
[String.raw`\d`, 256],
|
|
30
|
+
[LETTER_DASH_NUMBER, 250]
|
|
31
|
+
];
|
|
32
|
+
for (const [token, maximum] of replacements) source = source.split(`${token}*`).join(`${token}{0,${maximum}}`).split(`${token}+`).join(`${token}{1,${maximum}}`);
|
|
33
|
+
return source;
|
|
34
|
+
}
|
|
35
|
+
function safeRegex(source, flags) {
|
|
36
|
+
return new RegExp(makeSafeRegexSource(source), flags);
|
|
37
|
+
}
|
|
38
|
+
const FULL = safeRegex(`^${FULL_PLAIN}$`);
|
|
39
|
+
const LOOSE = safeRegex(`^${LOOSE_PLAIN}$`);
|
|
40
|
+
const NUMERIC$1 = /^\d+$/;
|
|
41
|
+
function formatComparableVersion(version) {
|
|
42
|
+
const base = `${version.major}.${version.minor}.${version.patch}`;
|
|
43
|
+
return version.prerelease?.length ? `${base}-${version.prerelease.join(".")}` : base;
|
|
44
|
+
}
|
|
45
|
+
function parse(version, options = {}) {
|
|
46
|
+
if (typeof version !== "string") return version;
|
|
47
|
+
if (version.length > 256) throw new TypeError(`Version exceeds the maximum length of 256 characters`);
|
|
48
|
+
const match = version.trim().match(options.loose ? LOOSE : FULL);
|
|
49
|
+
if (!match) throw new TypeError(`Invalid version syntax: ${version}`);
|
|
50
|
+
const major = Number(match[1]);
|
|
51
|
+
const minor = Number(match[2]);
|
|
52
|
+
const patch = Number(match[3]);
|
|
53
|
+
if (major > Number.MAX_SAFE_INTEGER || major < 0) throw new TypeError(`Invalid major version: ${match[1]}`);
|
|
54
|
+
if (minor > Number.MAX_SAFE_INTEGER || minor < 0) throw new TypeError(`Invalid minor version: ${match[2]}`);
|
|
55
|
+
if (patch > Number.MAX_SAFE_INTEGER || patch < 0) throw new TypeError(`Invalid patch version: ${match[3]}`);
|
|
56
|
+
const prerelease = match[4] ? match[4].split(".").map((identifier) => {
|
|
57
|
+
if (NUMERIC$1.test(identifier)) {
|
|
58
|
+
const numeric = Number(identifier);
|
|
59
|
+
if (numeric >= 0 && numeric < Number.MAX_SAFE_INTEGER) return numeric;
|
|
60
|
+
}
|
|
61
|
+
return identifier;
|
|
62
|
+
}) : void 0;
|
|
63
|
+
return {
|
|
64
|
+
build: match[5]?.split("."),
|
|
65
|
+
major,
|
|
66
|
+
minor,
|
|
67
|
+
patch,
|
|
68
|
+
prerelease
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function tryParse(version, options = {}) {
|
|
72
|
+
try {
|
|
73
|
+
return parse(version, options);
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const NUMERIC = /^\d+$/;
|
|
79
|
+
function compareIdentifiers(left, right) {
|
|
80
|
+
if (typeof left === "number" && typeof right === "number") return left === right ? 0 : left < right ? -1 : 1;
|
|
81
|
+
const leftNumeric = NUMERIC.test(String(left));
|
|
82
|
+
const rightNumeric = NUMERIC.test(String(right));
|
|
83
|
+
const normalizedLeft = leftNumeric ? Number(left) : left;
|
|
84
|
+
const normalizedRight = rightNumeric ? Number(right) : right;
|
|
85
|
+
return normalizedLeft === normalizedRight ? 0 : leftNumeric && !rightNumeric ? -1 : rightNumeric && !leftNumeric ? 1 : normalizedLeft < normalizedRight ? -1 : 1;
|
|
86
|
+
}
|
|
87
|
+
function compareMainParsed(left, right) {
|
|
88
|
+
return left.major === right.major ? left.minor === right.minor ? left.patch === right.patch ? 0 : left.patch < right.patch ? -1 : 1 : left.minor < right.minor ? -1 : 1 : left.major < right.major ? -1 : 1;
|
|
89
|
+
}
|
|
90
|
+
function comparePrereleaseParsed(left, right) {
|
|
91
|
+
const leftPrerelease = left.prerelease;
|
|
92
|
+
const rightPrerelease = right.prerelease;
|
|
93
|
+
if (leftPrerelease?.length && !rightPrerelease?.length) return -1;
|
|
94
|
+
if (!leftPrerelease?.length && rightPrerelease?.length) return 1;
|
|
95
|
+
if (!leftPrerelease?.length && !rightPrerelease?.length) return 0;
|
|
96
|
+
for (let index = 0;; index++) {
|
|
97
|
+
const leftIdentifier = leftPrerelease?.[index];
|
|
98
|
+
const rightIdentifier = rightPrerelease?.[index];
|
|
99
|
+
if (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;
|
|
100
|
+
if (rightIdentifier === void 0) return 1;
|
|
101
|
+
if (leftIdentifier === void 0) return -1;
|
|
102
|
+
if (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function compareParsed(left, right) {
|
|
106
|
+
return compareMainParsed(left, right) || comparePrereleaseParsed(left, right);
|
|
107
|
+
}
|
|
108
|
+
function compare(left, right, options = {}) {
|
|
109
|
+
return compareParsed(parse(left, options), parse(right, options));
|
|
110
|
+
}
|
|
111
|
+
function isGreaterOrEqual(left, right, options = {}) {
|
|
112
|
+
return compare(left, right, options) >= 0;
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region ../../node_modules/.pnpm/verkit@0.4.0/node_modules/verkit/dist/version-CQ98ZBpL.js
|
|
116
|
+
const COERCE_EXACT = safeRegex(COERCE);
|
|
117
|
+
const COERCE_FULL_EXACT = safeRegex(COERCE_FULL);
|
|
118
|
+
safeRegex(`^${PRERELEASE}$`);
|
|
119
|
+
safeRegex(`^${PRERELEASE_LOOSE}$`);
|
|
120
|
+
function normalize(version, options = {}) {
|
|
121
|
+
const parsed = tryParse(version, options);
|
|
122
|
+
return parsed ? formatComparableVersion(parsed) : null;
|
|
123
|
+
}
|
|
124
|
+
function coerce(value, options = {}) {
|
|
125
|
+
if (typeof value === "object") return value;
|
|
126
|
+
const input = typeof value === "number" ? String(value) : value;
|
|
127
|
+
let match = null;
|
|
128
|
+
if (options.rtl) {
|
|
129
|
+
const expression = safeRegex(options.includePrerelease ? COERCE_FULL : COERCE, "g");
|
|
130
|
+
let next;
|
|
131
|
+
while ((next = expression.exec(input)) && (!match || match.index + match[0].length !== input.length)) {
|
|
132
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
133
|
+
expression.lastIndex = next.index + next[1].length + next[2].length;
|
|
134
|
+
}
|
|
135
|
+
} else match = (options.includePrerelease ? COERCE_FULL_EXACT : COERCE_EXACT).exec(input);
|
|
136
|
+
if (!match) return null;
|
|
137
|
+
const major = match[2];
|
|
138
|
+
return tryParse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
export { GREATER_LESS_THAN as a, LOOSE_PLAIN as c, compareParsed as d, formatComparableVersion as f, tryParse as g, safeRegex as h, FULL_PLAIN as i, XRANGE_PLAIN as l, parse as m, normalize as n, LONE_CARET as o, isGreaterOrEqual as p, BUILD as r, LONE_TILDE as s, coerce as t, XRANGE_PLAIN_LOOSE as u };
|
|
@@ -41,7 +41,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
41
41
|
}) : target, mod));
|
|
42
42
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
43
|
//#endregion
|
|
44
|
-
//#region \0@oxc-project+runtime@0.
|
|
44
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/typeof.js
|
|
45
45
|
function _typeof(o) {
|
|
46
46
|
"@babel/helpers - typeof";
|
|
47
47
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -51,7 +51,7 @@ function _typeof(o) {
|
|
|
51
51
|
}, _typeof(o);
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
|
-
//#region \0@oxc-project+runtime@0.
|
|
54
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPrimitive.js
|
|
55
55
|
function toPrimitive(t, r) {
|
|
56
56
|
if ("object" != _typeof(t) || !t) return t;
|
|
57
57
|
var e = t[Symbol.toPrimitive];
|
|
@@ -63,13 +63,13 @@ function toPrimitive(t, r) {
|
|
|
63
63
|
return ("string" === r ? String : Number)(t);
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
|
-
//#region \0@oxc-project+runtime@0.
|
|
66
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPropertyKey.js
|
|
67
67
|
function toPropertyKey(t) {
|
|
68
68
|
var i = toPrimitive(t, "string");
|
|
69
69
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
|
-
//#region \0@oxc-project+runtime@0.
|
|
72
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/defineProperty.js
|
|
73
73
|
function _defineProperty(e, r, t) {
|
|
74
74
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
75
75
|
value: t,
|
|
@@ -287,9 +287,9 @@ var DevRuntime = class {
|
|
|
287
287
|
}
|
|
288
288
|
/**
|
|
289
289
|
* @param {string} id
|
|
290
|
-
* @param {{ exports: any }} exportsHolder
|
|
290
|
+
* @param {{ exports: any }} [exportsHolder]
|
|
291
291
|
*/
|
|
292
|
-
registerModule(id, exportsHolder) {
|
|
292
|
+
registerModule(id, exportsHolder = { exports: {} }) {
|
|
293
293
|
const module = new Module(id);
|
|
294
294
|
module.exportsHolder = exportsHolder;
|
|
295
295
|
this.moduleCache.set(id, module);
|
|
@@ -585,7 +585,11 @@ var BundledDevHMRClient = class extends HMRClient {
|
|
|
585
585
|
reason: `update propagated back to ${firstInvalidatedBy}, which already called \`import.meta.hot.invalidate()\``
|
|
586
586
|
};
|
|
587
587
|
if (this.isSelfAccepted(id)) {
|
|
588
|
-
boundaries.push(
|
|
588
|
+
boundaries.push({
|
|
589
|
+
boundary: id,
|
|
590
|
+
acceptedVia: id,
|
|
591
|
+
isWithinCircularImport: this.isNodeWithinCircularImports(id, stack)
|
|
592
|
+
});
|
|
589
593
|
return;
|
|
590
594
|
}
|
|
591
595
|
const parents = this.runtime.getImporters(id).filter((p) => this.runtime.isExecuted(p));
|
|
@@ -594,17 +598,52 @@ var BundledDevHMRClient = class extends HMRClient {
|
|
|
594
598
|
reason: `no hmr boundary found for module \`${id}\``
|
|
595
599
|
};
|
|
596
600
|
for (const parent of parents) {
|
|
601
|
+
const subChain = [...stack, parent];
|
|
597
602
|
if (this.acceptsDep(parent, id)) {
|
|
598
|
-
boundaries.push(
|
|
603
|
+
boundaries.push({
|
|
604
|
+
boundary: parent,
|
|
605
|
+
acceptedVia: id,
|
|
606
|
+
isWithinCircularImport: this.isNodeWithinCircularImports(parent, subChain)
|
|
607
|
+
});
|
|
599
608
|
continue;
|
|
600
609
|
}
|
|
601
|
-
if (stack.includes(parent))
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
|
|
610
|
+
if (!stack.includes(parent)) {
|
|
611
|
+
const fullReload = this.bubble(parent, subChain, updateSet, boundaries, firstInvalidatedBy, traversedModules);
|
|
612
|
+
if (fullReload) return fullReload;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Check importers recursively if it's an import loop. An accepted module within
|
|
618
|
+
* an import loop cannot recover its execution order and should be reloaded.
|
|
619
|
+
*
|
|
620
|
+
* @param node The node that accepts HMR and is a boundary
|
|
621
|
+
* @param nodeChain The chain of nodes/imports that lead to the node.
|
|
622
|
+
* (The last node in the chain imports the `node` parameter)
|
|
623
|
+
* @param currentChain The current chain tracked from the `node` parameter
|
|
624
|
+
* @param traversedModules The set of modules that have traversed
|
|
625
|
+
*/
|
|
626
|
+
isNodeWithinCircularImports(node, nodeChain, currentChain = [node], traversedModules = /* @__PURE__ */ new Set()) {
|
|
627
|
+
if (traversedModules.has(node)) return false;
|
|
628
|
+
traversedModules.add(node);
|
|
629
|
+
for (const importer of this.runtime.getImporters(node)) {
|
|
630
|
+
if (importer === node) continue;
|
|
631
|
+
const importerIndex = nodeChain.indexOf(importer);
|
|
632
|
+
if (importerIndex > -1) {
|
|
633
|
+
const importChain = [
|
|
634
|
+
importer,
|
|
635
|
+
...[...currentChain].reverse(),
|
|
636
|
+
...nodeChain.slice(importerIndex, -1).reverse()
|
|
637
|
+
];
|
|
638
|
+
this.logger.debug(`circular imports detected: ${importChain.join(" -> ")}`);
|
|
639
|
+
return true;
|
|
640
|
+
}
|
|
641
|
+
if (!currentChain.includes(importer)) {
|
|
642
|
+
const result = this.isNodeWithinCircularImports(importer, nodeChain, currentChain.concat(importer), traversedModules);
|
|
643
|
+
if (result) return result;
|
|
644
|
+
}
|
|
607
645
|
}
|
|
646
|
+
return false;
|
|
608
647
|
}
|
|
609
648
|
handlePush(payload) {
|
|
610
649
|
this.applyQueue = this.applyQueue.then(() => this.applyPush(payload)).catch((err) => {
|
|
@@ -674,15 +713,25 @@ var BundledDevHMRClient = class extends HMRClient {
|
|
|
674
713
|
this.requestFullReload(`no factory for module \`${id}\``);
|
|
675
714
|
return;
|
|
676
715
|
}
|
|
677
|
-
const applies = update.boundaries.map((
|
|
716
|
+
const applies = update.boundaries.map(({ boundary, acceptedVia, isWithinCircularImport }) => ({
|
|
678
717
|
boundary,
|
|
679
718
|
acceptedVia,
|
|
719
|
+
isWithinCircularImport,
|
|
680
720
|
callbacks: this.hotModulesMap.get(boundary)?.callbacks.filter((c) => c.deps.includes(acceptedVia)) ?? []
|
|
681
721
|
}));
|
|
682
722
|
for (const id of update.updateSet) this.runtime.removeModuleCache(id);
|
|
683
|
-
for (const { boundary, acceptedVia, callbacks } of applies) {
|
|
684
|
-
|
|
685
|
-
|
|
723
|
+
for (const { boundary, acceptedVia, isWithinCircularImport, callbacks } of applies) {
|
|
724
|
+
let fresh;
|
|
725
|
+
try {
|
|
726
|
+
this.runtime.initModule(acceptedVia);
|
|
727
|
+
fresh = this.runtime.loadExports(acceptedVia);
|
|
728
|
+
} catch (err) {
|
|
729
|
+
if (isWithinCircularImport) {
|
|
730
|
+
this.requestFullReload(`${acceptedVia} failed to apply HMR as it's within a circular import. Reloading page to reset the execution order.`);
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
throw err;
|
|
734
|
+
}
|
|
686
735
|
try {
|
|
687
736
|
this.currentFirstInvalidatedBy = firstInvalidatedBy;
|
|
688
737
|
for (const { deps, fn } of callbacks) fn(deps.map((dep) => dep === acceptedVia ? fresh : void 0));
|
|
@@ -695,11 +744,12 @@ var BundledDevHMRClient = class extends HMRClient {
|
|
|
695
744
|
toUpdatePayload(boundaries, firstInvalidatedBy) {
|
|
696
745
|
return {
|
|
697
746
|
type: "update",
|
|
698
|
-
updates: boundaries.map((
|
|
747
|
+
updates: boundaries.map(({ boundary, acceptedVia, isWithinCircularImport }) => ({
|
|
699
748
|
type: "js-update",
|
|
700
749
|
path: boundary,
|
|
701
750
|
acceptedPath: acceptedVia,
|
|
702
751
|
timestamp: Date.now(),
|
|
752
|
+
isWithinCircularImport,
|
|
703
753
|
firstInvalidatedBy
|
|
704
754
|
}))
|
|
705
755
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@vite/env";
|
|
2
|
-
//#region \0@oxc-project+runtime@0.
|
|
2
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/typeof.js
|
|
3
3
|
function _typeof(o) {
|
|
4
4
|
"@babel/helpers - typeof";
|
|
5
5
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -9,7 +9,7 @@ function _typeof(o) {
|
|
|
9
9
|
}, _typeof(o);
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
|
-
//#region \0@oxc-project+runtime@0.
|
|
12
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPrimitive.js
|
|
13
13
|
function toPrimitive(t, r) {
|
|
14
14
|
if ("object" != _typeof(t) || !t) return t;
|
|
15
15
|
var e = t[Symbol.toPrimitive];
|
|
@@ -21,13 +21,13 @@ function toPrimitive(t, r) {
|
|
|
21
21
|
return ("string" === r ? String : Number)(t);
|
|
22
22
|
}
|
|
23
23
|
//#endregion
|
|
24
|
-
//#region \0@oxc-project+runtime@0.
|
|
24
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/toPropertyKey.js
|
|
25
25
|
function toPropertyKey(t) {
|
|
26
26
|
var i = toPrimitive(t, "string");
|
|
27
27
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
|
-
//#region \0@oxc-project+runtime@0.
|
|
30
|
+
//#region \0@oxc-project+runtime@0.148.0/helpers/esm/defineProperty.js
|
|
31
31
|
function _defineProperty(e, r, t) {
|
|
32
32
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
33
33
|
value: t,
|