nitro-nightly 3.0.1-20260106-122901-e9c3a660 → 3.0.1-20260106-130706-e20c92d9
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/rolldown.mjs +7 -9
- package/dist/_build/rollup.mjs +7 -9
- package/dist/_build/shared.mjs +1 -1
- package/dist/_build/shared3.mjs +1 -1
- package/dist/_build/shared4.mjs +10 -8
- package/dist/_build/vite.build.mjs +4 -6
- package/dist/_build/vite.plugin.mjs +5 -5
- package/dist/_dev.mjs +2 -2
- package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +1 -1
- package/dist/_libs/@rollup/plugin-commonjs.mjs +2031 -2031
- package/dist/_libs/@rollup/plugin-inject.mjs +1 -1
- package/dist/_libs/@rollup/plugin-node-resolve.mjs +1 -1
- package/dist/_libs/@rollup/plugin-replace.mjs +1 -1
- package/dist/_libs/c12.mjs +1114 -1114
- package/dist/_libs/chokidar.mjs +2 -2
- package/dist/_libs/confbox.mjs +730 -730
- package/dist/_libs/giget.mjs +22 -22
- package/dist/_libs/local-pkg.mjs +5 -5
- package/dist/_libs/tinyglobby.mjs +1 -1
- package/dist/_libs/tsconfck.mjs +1 -1
- package/dist/_libs/unimport.mjs +209 -200
- package/dist/_libs/unwasm.mjs +2 -2
- package/dist/_nitro.mjs +5 -6
- package/dist/_nitro2.mjs +5 -6
- package/dist/_presets.mjs +7 -7
- package/dist/builder.mjs +4 -4
- package/dist/vite.mjs +4 -6
- package/package.json +1 -1
package/dist/_libs/giget.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { n as __exportAll } from "../_rolldown.mjs";
|
|
2
2
|
import { A as resolve$2, E as normalize$2, S as dirname$2, T as join$2, p as readPackageJSON, x as basename$2 } from "./c12.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
-
import { delimiter, dirname, normalize, resolve } from "node:path";
|
|
5
|
-
import { cwd } from "node:process";
|
|
6
4
|
import { createWriteStream, existsSync, readdirSync, renameSync } from "node:fs";
|
|
7
|
-
import { promisify } from "node:util";
|
|
8
|
-
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
9
5
|
import nativeFs from "fs";
|
|
10
|
-
import path
|
|
11
|
-
import { createRequire as createRequire$1 } from "module";
|
|
12
|
-
import { homedir, tmpdir } from "node:os";
|
|
6
|
+
import path from "path";
|
|
13
7
|
import Ds from "crypto";
|
|
8
|
+
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
9
|
+
import { homedir, tmpdir } from "node:os";
|
|
10
|
+
import { delimiter, dirname as dirname$1, normalize as normalize$1, resolve as resolve$1 } from "node:path";
|
|
11
|
+
import { cwd } from "node:process";
|
|
12
|
+
import { promisify } from "node:util";
|
|
14
13
|
import { defu } from "defu";
|
|
14
|
+
import { createRequire as createRequire$1 } from "module";
|
|
15
15
|
import { PassThrough, pipeline } from "node:stream";
|
|
16
16
|
import { spawn } from "node:child_process";
|
|
17
17
|
import j$1 from "assert";
|
|
@@ -69,9 +69,9 @@ function S$1(e$7, t$7) {
|
|
|
69
69
|
let o$6 = e$7;
|
|
70
70
|
let s$8;
|
|
71
71
|
do {
|
|
72
|
-
i$8.push(resolve(o$6, "node_modules", ".bin"));
|
|
72
|
+
i$8.push(resolve$1(o$6, "node_modules", ".bin"));
|
|
73
73
|
s$8 = o$6;
|
|
74
|
-
o$6 = dirname(o$6);
|
|
74
|
+
o$6 = dirname$1(o$6);
|
|
75
75
|
} while (o$6 !== s$8);
|
|
76
76
|
return {
|
|
77
77
|
key: t$7.key,
|
|
@@ -488,7 +488,7 @@ const B = {
|
|
|
488
488
|
const V = { windowsHide: true };
|
|
489
489
|
function H$2(e$7, t$7) {
|
|
490
490
|
return {
|
|
491
|
-
command: normalize(e$7),
|
|
491
|
+
command: normalize$1(e$7),
|
|
492
492
|
args: t$7 ?? []
|
|
493
493
|
};
|
|
494
494
|
}
|
|
@@ -994,7 +994,7 @@ var k, w;
|
|
|
994
994
|
function E() {
|
|
995
995
|
if (w) return k;
|
|
996
996
|
w = 1;
|
|
997
|
-
const u$6 = n$3(), x$1 = path
|
|
997
|
+
const u$6 = n$3(), x$1 = path.posix, y$4 = w$1(), P$2 = Symbol("slurp"), a$11 = Symbol("type");
|
|
998
998
|
class B$1 {
|
|
999
999
|
constructor(e$7, t$7, i$8, h$2) {
|
|
1000
1000
|
this.cksumValid = false, this.needPax = false, this.nullBlock = false, this.block = null, this.path = null, this.mode = null, this.uid = null, this.gid = null, this.size = null, this.mtime = null, this.cksum = null, this[a$11] = "0", this.linkpath = null, this.uname = null, this.gname = null, this.devmaj = 0, this.devmin = 0, this.atime = null, this.ctime = null, Buffer.isBuffer(e$7) ? this.decode(e$7, t$7 || 0, i$8, h$2) : e$7 && this.set(e$7);
|
|
@@ -1518,7 +1518,7 @@ var r$2, a$5;
|
|
|
1518
1518
|
function f$2() {
|
|
1519
1519
|
if (a$5) return r$2;
|
|
1520
1520
|
a$5 = 1;
|
|
1521
|
-
const c$6 = E(), d$1 = path
|
|
1521
|
+
const c$6 = E(), d$1 = path;
|
|
1522
1522
|
class h$2 {
|
|
1523
1523
|
constructor(e$7, n$4) {
|
|
1524
1524
|
this.atime = e$7.atime || null, this.charset = e$7.charset || null, this.comment = e$7.comment || null, this.ctime = e$7.ctime || null, this.gid = e$7.gid || null, this.gname = e$7.gname || null, this.linkpath = e$7.linkpath || null, this.mtime = e$7.mtime || null, this.path = e$7.path || null, this.size = e$7.size || null, this.uid = e$7.uid || null, this.uname = e$7.uname || null, this.dev = e$7.dev || null, this.ino = e$7.ino || null, this.nlink = e$7.nlink || null, this.global = n$4 || false;
|
|
@@ -2473,7 +2473,7 @@ var e$1, t$1;
|
|
|
2473
2473
|
function u$2() {
|
|
2474
2474
|
if (t$1) return e$1;
|
|
2475
2475
|
t$1 = 1;
|
|
2476
|
-
const s$8 = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform, { resolve: o$6, parse: n$4 } = path
|
|
2476
|
+
const s$8 = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform, { resolve: o$6, parse: n$4 } = path;
|
|
2477
2477
|
return e$1 = (r) => {
|
|
2478
2478
|
if (/\0/.test(r)) throw Object.assign(/* @__PURE__ */ new TypeError("path must be a string without null bytes"), {
|
|
2479
2479
|
path: r,
|
|
@@ -2493,7 +2493,7 @@ var i$1, c$2;
|
|
|
2493
2493
|
function t() {
|
|
2494
2494
|
if (c$2) return i$1;
|
|
2495
2495
|
c$2 = 1;
|
|
2496
|
-
const { dirname: u$6 } = path
|
|
2496
|
+
const { dirname: u$6 } = path, f$5 = (r, e$7, n$4 = void 0) => n$4 === e$7 ? Promise.resolve() : r.statAsync(e$7).then((d$1) => d$1.isDirectory() ? n$4 : void 0, (d$1) => d$1.code === "ENOENT" ? f$5(r, u$6(e$7), e$7) : void 0), o$6 = (r, e$7, n$4 = void 0) => {
|
|
2497
2497
|
if (n$4 !== e$7) try {
|
|
2498
2498
|
return r.statSync(e$7).isDirectory() ? n$4 : void 0;
|
|
2499
2499
|
} catch (d$1) {
|
|
@@ -2509,7 +2509,7 @@ var o$3, a$4;
|
|
|
2509
2509
|
function y$2() {
|
|
2510
2510
|
if (a$4) return o$3;
|
|
2511
2511
|
a$4 = 1;
|
|
2512
|
-
const { dirname: f$5 } = path
|
|
2512
|
+
const { dirname: f$5 } = path, t$7 = (n$4, e$7, c$6) => {
|
|
2513
2513
|
e$7.recursive = false;
|
|
2514
2514
|
const i$8 = f$5(n$4);
|
|
2515
2515
|
return i$8 === n$4 ? e$7.mkdirAsync(n$4, e$7).catch((r) => {
|
|
@@ -2553,7 +2553,7 @@ var c$1, m$1;
|
|
|
2553
2553
|
function s$3() {
|
|
2554
2554
|
if (m$1) return c$1;
|
|
2555
2555
|
m$1 = 1;
|
|
2556
|
-
const { dirname: u$6 } = path
|
|
2556
|
+
const { dirname: u$6 } = path, { findMade: d$1, findMadeSync: t$1$1 } = t(), { mkdirpManual: a$11, mkdirpManualSync: k$2 } = y$2();
|
|
2557
2557
|
return c$1 = {
|
|
2558
2558
|
mkdirpNative: (e$7, r) => (r.recursive = true, u$6(e$7) === e$7 ? r.mkdirAsync(e$7, r) : d$1(r, e$7).then((n$4) => r.mkdirAsync(e$7, r).then(() => n$4).catch((i$8) => {
|
|
2559
2559
|
if (i$8.code === "ENOENT") return a$11(e$7, r);
|
|
@@ -2592,7 +2592,7 @@ var y$1, O;
|
|
|
2592
2592
|
function F$1() {
|
|
2593
2593
|
if (O) return y$1;
|
|
2594
2594
|
O = 1;
|
|
2595
|
-
const c$6 = nativeFs, a$11 = path
|
|
2595
|
+
const c$6 = nativeFs, a$11 = path, T$2 = c$6.lchown ? "lchown" : "chown", I$1 = c$6.lchownSync ? "lchownSync" : "chownSync", i$8 = c$6.lchown && !process.version.match(/v1[1-9]+\./) && !process.version.match(/v10\.[6-9]/), u$6 = (r, e$7, n$4) => {
|
|
2596
2596
|
try {
|
|
2597
2597
|
return c$6[I$1](r, e$7, n$4);
|
|
2598
2598
|
} catch (t$7) {
|
|
@@ -2672,7 +2672,7 @@ var R;
|
|
|
2672
2672
|
function H() {
|
|
2673
2673
|
if (R) return r$1.exports;
|
|
2674
2674
|
R = 1;
|
|
2675
|
-
const g$1 = S(), l$3 = nativeFs, p$2 = path
|
|
2675
|
+
const g$1 = S(), l$3 = nativeFs, p$2 = path, x$1 = F$1(), y$4 = a$7();
|
|
2676
2676
|
class D$1 extends Error {
|
|
2677
2677
|
constructor(e$7, s$8) {
|
|
2678
2678
|
super("Cannot extract through symbolic link"), this.path = s$8, this.symlink = e$7;
|
|
@@ -2792,7 +2792,7 @@ var u$1, f$1;
|
|
|
2792
2792
|
function z() {
|
|
2793
2793
|
if (f$1) return u$1;
|
|
2794
2794
|
f$1 = 1;
|
|
2795
|
-
const l$3 = j$1, m$4 = a$1(), g$1 = s(), { join: d$1 } = path
|
|
2795
|
+
const l$3 = j$1, m$4 = a$1(), g$1 = s(), { join: d$1 } = path, q$2 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
|
|
2796
2796
|
return u$1 = () => {
|
|
2797
2797
|
const i$8 = /* @__PURE__ */ new Map(), c$6 = /* @__PURE__ */ new Map(), v$3 = (e$7) => e$7.split("/").slice(0, -1).reduce((o$6, r) => (o$6.length && (r = d$1(o$6[o$6.length - 1], r)), o$6.push(r || "/"), o$6), []), a$11 = /* @__PURE__ */ new Set(), w$3 = (e$7) => {
|
|
2798
2798
|
const s$8 = c$6.get(e$7);
|
|
@@ -2838,7 +2838,7 @@ var o$1, u;
|
|
|
2838
2838
|
function c$5() {
|
|
2839
2839
|
if (u) return o$1;
|
|
2840
2840
|
u = 1;
|
|
2841
|
-
const { isAbsolute: l$3, parse: t$7 } = path
|
|
2841
|
+
const { isAbsolute: l$3, parse: t$7 } = path.win32;
|
|
2842
2842
|
return o$1 = (r) => {
|
|
2843
2843
|
let s$8 = "", e$7 = t$7(r);
|
|
2844
2844
|
for (; l$3(r) || e$7.root;) {
|
|
@@ -2859,7 +2859,7 @@ var G, y;
|
|
|
2859
2859
|
function Os() {
|
|
2860
2860
|
if (y) return G;
|
|
2861
2861
|
y = 1;
|
|
2862
|
-
const ss = j$1, is = rt(), r = nativeFs, es = X(), w$3 = path
|
|
2862
|
+
const ss = j$1, is = rt(), r = nativeFs, es = X(), w$3 = path, M$1 = H(), K$1 = p(), ts = z(), os$1 = c$5(), l$3 = a$7(), rs = s(), hs = a$1(), H$1$1 = Symbol("onEntry"), q$2 = Symbol("checkFs"), Y = Symbol("checkFs2"), v$3 = Symbol("pruneCache"), N$1 = Symbol("isReusable"), d$1 = Symbol("makeFs"), U$1 = Symbol("file"), F$1$1 = Symbol("directory"), O$4 = Symbol("link"), B$1 = Symbol("symlink"), z$1$1 = Symbol("hardlink"), W$1 = Symbol("unsupported"), j$3 = Symbol("checkPath"), b$1 = Symbol("mkdir"), m$4 = Symbol("onError"), $ = Symbol("pending"), V$1 = Symbol("pend"), S$2 = Symbol("unpend"), P$2 = Symbol("ended"), A$1 = Symbol("maybeClose"), x$1 = Symbol("skip"), E$2 = Symbol("doChown"), R$3 = Symbol("uid"), _$2 = Symbol("gid"), g$1 = Symbol("checkedCwd"), X$1$1 = Ds, J$1 = F(), C$2 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32", cs = 1024, as = (a$11, s$8) => {
|
|
2863
2863
|
if (!C$2) return r.unlink(a$11, s$8);
|
|
2864
2864
|
const i$8 = a$11 + ".DELETE." + X$1$1.randomBytes(16).toString("hex");
|
|
2865
2865
|
r.rename(a$11, i$8, (e$7) => {
|
|
@@ -3267,7 +3267,7 @@ var f, q;
|
|
|
3267
3267
|
function v() {
|
|
3268
3268
|
if (q) return f;
|
|
3269
3269
|
q = 1;
|
|
3270
|
-
const w$3 = s$6(), u$6 = Os(), p$2 = nativeFs, y$4 = X(), l$3 = path
|
|
3270
|
+
const w$3 = s$6(), u$6 = Os(), p$2 = nativeFs, y$4 = X(), l$3 = path, m$4 = s();
|
|
3271
3271
|
f = (r, e$7, o$6) => {
|
|
3272
3272
|
typeof r == "function" ? (o$6 = r, e$7 = null, r = {}) : Array.isArray(r) && (e$7 = r, r = {}), typeof e$7 == "function" && (o$6 = e$7, e$7 = null), e$7 ? e$7 = Array.from(e$7) : e$7 = [];
|
|
3273
3273
|
const t$7 = w$3(r);
|
package/dist/_libs/local-pkg.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { A as resolve$2, E as normalize$1, T as join$1, w as isAbsolute$1 } from "./c12.mjs";
|
|
2
|
+
import { n as h, r as x } from "./confbox.mjs";
|
|
2
3
|
import { r as tokenizer } from "./acorn.mjs";
|
|
3
|
-
import { l as h, u as x } from "./confbox.mjs";
|
|
4
4
|
import { builtinModules, createRequire } from "node:module";
|
|
5
|
-
import path, { dirname, join, win32 } from "node:path";
|
|
6
|
-
import process$1 from "node:process";
|
|
7
5
|
import fs, { promises, realpathSync, statSync } from "node:fs";
|
|
8
|
-
import
|
|
6
|
+
import fsp from "node:fs/promises";
|
|
9
7
|
import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
+
import path, { dirname, join, win32 } from "node:path";
|
|
10
9
|
import assert from "node:assert";
|
|
10
|
+
import process$1 from "node:process";
|
|
11
11
|
import v8 from "node:v8";
|
|
12
12
|
import { format, inspect } from "node:util";
|
|
13
|
-
import
|
|
13
|
+
import { joinURL } from "ufo";
|
|
14
14
|
|
|
15
15
|
//#region node_modules/.pnpm/pkg-types@1.3.1/node_modules/pkg-types/dist/index.mjs
|
|
16
16
|
const defaultFindOptions = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __toESM } from "../_rolldown.mjs";
|
|
2
|
-
import { c as
|
|
2
|
+
import { c as Builder, s as require_picomatch } from "./@rollup/plugin-commonjs.mjs";
|
|
3
3
|
import nativeFs from "fs";
|
|
4
4
|
import path, { posix } from "path";
|
|
5
5
|
import { fileURLToPath } from "url";
|
package/dist/_libs/tsconfck.mjs
CHANGED
package/dist/_libs/unimport.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "../_rolldown.mjs";
|
|
2
2
|
import { A as resolve$1, E as normalize$2, O as parse$1, S as dirname$1, T as join$1, h as resolvePackageJSON, k as relative$1, p as readPackageJSON, w as isAbsolute$2, x as basename$1 } from "./c12.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { s as require_picomatch } from "./@rollup/plugin-commonjs.mjs";
|
|
4
|
+
import { t as glob } from "./tinyglobby.mjs";
|
|
4
5
|
import { n as parse$2, t as Parser } from "./acorn.mjs";
|
|
5
6
|
import { a as findTypeExports, c as parseStaticImport, i as findStaticImports, l as resolve$2, n as detectSyntax, r as findExports, t as resolveModule, u as resolveModuleExportNames } from "./local-pkg.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { t as glob } from "./tinyglobby.mjs";
|
|
8
|
-
import { t as remapping } from "./@jridgewell/remapping.mjs";
|
|
7
|
+
import { a as MagicString, i as stripLiteral } from "./@hiogawa/vite-plugin-fullstack.mjs";
|
|
9
8
|
import { t as walk } from "./estree-walker.mjs";
|
|
9
|
+
import { t as remapping } from "./@jridgewell/remapping.mjs";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
|
-
import path, { basename, dirname, extname, isAbsolute, normalize, resolve } from "node:path";
|
|
12
|
-
import process$1 from "node:process";
|
|
13
|
-
import { camelCase, kebabCase } from "scule";
|
|
14
11
|
import fs, { accessSync, constants, existsSync, promises, readFileSync } from "node:fs";
|
|
15
|
-
import { fileURLToPath } from "node:url";
|
|
16
12
|
import { readFile } from "node:fs/promises";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
17
14
|
import os from "node:os";
|
|
15
|
+
import path, { basename, dirname, extname, isAbsolute, normalize, resolve } from "node:path";
|
|
16
|
+
import process$1 from "node:process";
|
|
17
|
+
import { camelCase, kebabCase } from "scule";
|
|
18
18
|
import { Buffer } from "node:buffer";
|
|
19
19
|
import * as querystring from "node:querystring";
|
|
20
20
|
|
|
@@ -558,7 +558,7 @@ function parseVirtualImportsRegex(strippedCode, importMap, virtualImports) {
|
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
560
|
async function detectImports(code, ctx, options) {
|
|
561
|
-
if (options?.parser === "acorn") return import("./unimport.mjs").then((n) => n.
|
|
561
|
+
if (options?.parser === "acorn") return import("./unimport.mjs").then((n) => n.s).then((r) => r.detectImportsAcorn(code, ctx, options));
|
|
562
562
|
return detectImportsRegex(code, ctx, options);
|
|
563
563
|
}
|
|
564
564
|
const FileExtensionLookup = [
|
|
@@ -1767,6 +1767,200 @@ async function resolveImports(ctx, imports, id) {
|
|
|
1767
1767
|
}))).filter(Boolean);
|
|
1768
1768
|
}
|
|
1769
1769
|
|
|
1770
|
+
//#endregion
|
|
1771
|
+
//#region node_modules/.pnpm/unimport@5.6.0/node_modules/unimport/dist/index.mjs
|
|
1772
|
+
var dist_exports = /* @__PURE__ */ __exportAll({ createUnimport: () => createUnimport });
|
|
1773
|
+
|
|
1774
|
+
//#endregion
|
|
1775
|
+
//#region node_modules/.pnpm/unimport@5.6.0/node_modules/unimport/dist/chunks/detect-acorn.mjs
|
|
1776
|
+
var detect_acorn_exports = /* @__PURE__ */ __exportAll({
|
|
1777
|
+
createVirtualImportsAcronWalker: () => createVirtualImportsAcronWalker,
|
|
1778
|
+
detectImportsAcorn: () => detectImportsAcorn,
|
|
1779
|
+
traveseScopes: () => traveseScopes
|
|
1780
|
+
});
|
|
1781
|
+
async function detectImportsAcorn(code, ctx, options) {
|
|
1782
|
+
const s = getMagicString(code);
|
|
1783
|
+
const map = await ctx.getImportMap();
|
|
1784
|
+
let matchedImports = [];
|
|
1785
|
+
const enableAutoImport = options?.autoImport !== false;
|
|
1786
|
+
const enableTransformVirtualImports = options?.transformVirtualImports !== false && ctx.options.virtualImports?.length;
|
|
1787
|
+
if (enableAutoImport || enableTransformVirtualImports) {
|
|
1788
|
+
const ast = parse$2(s.original, {
|
|
1789
|
+
sourceType: "module",
|
|
1790
|
+
ecmaVersion: "latest",
|
|
1791
|
+
locations: true
|
|
1792
|
+
});
|
|
1793
|
+
const virtualImports = createVirtualImportsAcronWalker(map, ctx.options.virtualImports);
|
|
1794
|
+
const scopes = traveseScopes(ast, enableTransformVirtualImports ? virtualImports.walk : {});
|
|
1795
|
+
if (enableAutoImport) {
|
|
1796
|
+
const identifiers = scopes.unmatched;
|
|
1797
|
+
matchedImports.push(...Array.from(identifiers).map((name) => {
|
|
1798
|
+
const item = map.get(name);
|
|
1799
|
+
if (item && !item.disabled) return item;
|
|
1800
|
+
return null;
|
|
1801
|
+
}).filter(Boolean));
|
|
1802
|
+
for (const addon of ctx.addons) matchedImports = await addon.matchImports?.call(ctx, identifiers, matchedImports) || matchedImports;
|
|
1803
|
+
}
|
|
1804
|
+
virtualImports.ranges.forEach(([start, end]) => {
|
|
1805
|
+
s.remove(start, end);
|
|
1806
|
+
});
|
|
1807
|
+
matchedImports.push(...virtualImports.imports);
|
|
1808
|
+
}
|
|
1809
|
+
return {
|
|
1810
|
+
s,
|
|
1811
|
+
strippedCode: code.toString(),
|
|
1812
|
+
matchedImports,
|
|
1813
|
+
isCJSContext: false,
|
|
1814
|
+
firstOccurrence: 0
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
function traveseScopes(ast, additionalWalk) {
|
|
1818
|
+
const scopes = [];
|
|
1819
|
+
let scopeCurrent = void 0;
|
|
1820
|
+
const scopesStack = [];
|
|
1821
|
+
function pushScope(node) {
|
|
1822
|
+
scopeCurrent = {
|
|
1823
|
+
node,
|
|
1824
|
+
parent: scopeCurrent,
|
|
1825
|
+
declarations: /* @__PURE__ */ new Set(),
|
|
1826
|
+
references: /* @__PURE__ */ new Set()
|
|
1827
|
+
};
|
|
1828
|
+
scopes.push(scopeCurrent);
|
|
1829
|
+
scopesStack.push(scopeCurrent);
|
|
1830
|
+
}
|
|
1831
|
+
function popScope(node) {
|
|
1832
|
+
if (scopesStack.pop()?.node !== node) throw new Error("Scope mismatch");
|
|
1833
|
+
scopeCurrent = scopesStack[scopesStack.length - 1];
|
|
1834
|
+
}
|
|
1835
|
+
pushScope(void 0);
|
|
1836
|
+
walk(ast, {
|
|
1837
|
+
enter(node, parent, prop, index) {
|
|
1838
|
+
additionalWalk?.enter?.call(this, node, parent, prop, index);
|
|
1839
|
+
switch (node.type) {
|
|
1840
|
+
case "ImportSpecifier":
|
|
1841
|
+
case "ImportDefaultSpecifier":
|
|
1842
|
+
case "ImportNamespaceSpecifier":
|
|
1843
|
+
scopeCurrent.declarations.add(node.local.name);
|
|
1844
|
+
return;
|
|
1845
|
+
case "FunctionDeclaration":
|
|
1846
|
+
case "ClassDeclaration":
|
|
1847
|
+
if (node.id) scopeCurrent.declarations.add(node.id.name);
|
|
1848
|
+
return;
|
|
1849
|
+
case "VariableDeclarator":
|
|
1850
|
+
if (node.id.type === "Identifier") scopeCurrent.declarations.add(node.id.name);
|
|
1851
|
+
else walk(node.id, { enter(node2) {
|
|
1852
|
+
if (node2.type === "ObjectPattern") node2.properties.forEach((i) => {
|
|
1853
|
+
if (i.type === "Property" && i.value.type === "Identifier") scopeCurrent.declarations.add(i.value.name);
|
|
1854
|
+
else if (i.type === "RestElement" && i.argument.type === "Identifier") scopeCurrent.declarations.add(i.argument.name);
|
|
1855
|
+
});
|
|
1856
|
+
else if (node2.type === "ArrayPattern") node2.elements.forEach((i) => {
|
|
1857
|
+
if (i?.type === "Identifier") scopeCurrent.declarations.add(i.name);
|
|
1858
|
+
if (i?.type === "RestElement" && i.argument.type === "Identifier") scopeCurrent.declarations.add(i.argument.name);
|
|
1859
|
+
});
|
|
1860
|
+
} });
|
|
1861
|
+
return;
|
|
1862
|
+
case "BlockStatement":
|
|
1863
|
+
switch (parent?.type) {
|
|
1864
|
+
case "FunctionDeclaration":
|
|
1865
|
+
case "ArrowFunctionExpression":
|
|
1866
|
+
case "FunctionExpression": {
|
|
1867
|
+
const parameterIdentifiers = parent.params.filter((p) => p.type === "Identifier");
|
|
1868
|
+
for (const id of parameterIdentifiers) scopeCurrent.declarations.add(id.name);
|
|
1869
|
+
break;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
pushScope(node);
|
|
1873
|
+
return;
|
|
1874
|
+
case "Identifier":
|
|
1875
|
+
switch (parent?.type) {
|
|
1876
|
+
case "CallExpression":
|
|
1877
|
+
if (parent.callee === node || parent.arguments.includes(node)) scopeCurrent.references.add(node.name);
|
|
1878
|
+
return;
|
|
1879
|
+
case "MemberExpression":
|
|
1880
|
+
if (parent.object === node) scopeCurrent.references.add(node.name);
|
|
1881
|
+
return;
|
|
1882
|
+
case "VariableDeclarator":
|
|
1883
|
+
if (parent.init === node) scopeCurrent.references.add(node.name);
|
|
1884
|
+
return;
|
|
1885
|
+
case "SpreadElement":
|
|
1886
|
+
if (parent.argument === node) scopeCurrent.references.add(node.name);
|
|
1887
|
+
return;
|
|
1888
|
+
case "ClassDeclaration":
|
|
1889
|
+
if (parent.superClass === node) scopeCurrent.references.add(node.name);
|
|
1890
|
+
return;
|
|
1891
|
+
case "Property":
|
|
1892
|
+
if (parent.value === node) scopeCurrent.references.add(node.name);
|
|
1893
|
+
return;
|
|
1894
|
+
case "TemplateLiteral":
|
|
1895
|
+
if (parent.expressions.includes(node)) scopeCurrent.references.add(node.name);
|
|
1896
|
+
return;
|
|
1897
|
+
case "AssignmentExpression":
|
|
1898
|
+
if (parent.right === node) scopeCurrent.references.add(node.name);
|
|
1899
|
+
return;
|
|
1900
|
+
case "IfStatement":
|
|
1901
|
+
case "WhileStatement":
|
|
1902
|
+
case "DoWhileStatement":
|
|
1903
|
+
if (parent.test === node) scopeCurrent.references.add(node.name);
|
|
1904
|
+
return;
|
|
1905
|
+
case "SwitchStatement":
|
|
1906
|
+
if (parent.discriminant === node) scopeCurrent.references.add(node.name);
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
if (parent?.type.includes("Expression")) scopeCurrent.references.add(node.name);
|
|
1910
|
+
}
|
|
1911
|
+
},
|
|
1912
|
+
leave(node, parent, prop, index) {
|
|
1913
|
+
additionalWalk?.leave?.call(this, node, parent, prop, index);
|
|
1914
|
+
switch (node.type) {
|
|
1915
|
+
case "BlockStatement": popScope(node);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
});
|
|
1919
|
+
const unmatched = /* @__PURE__ */ new Set();
|
|
1920
|
+
for (const scope of scopes) for (const name of scope.references) {
|
|
1921
|
+
let defined = false;
|
|
1922
|
+
let parent = scope;
|
|
1923
|
+
while (parent) {
|
|
1924
|
+
if (parent.declarations.has(name)) {
|
|
1925
|
+
defined = true;
|
|
1926
|
+
break;
|
|
1927
|
+
}
|
|
1928
|
+
parent = parent?.parent;
|
|
1929
|
+
}
|
|
1930
|
+
if (!defined) unmatched.add(name);
|
|
1931
|
+
}
|
|
1932
|
+
return {
|
|
1933
|
+
unmatched,
|
|
1934
|
+
scopes
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
function createVirtualImportsAcronWalker(importMap, virtualImports = []) {
|
|
1938
|
+
const imports = [];
|
|
1939
|
+
const ranges = [];
|
|
1940
|
+
return {
|
|
1941
|
+
imports,
|
|
1942
|
+
ranges,
|
|
1943
|
+
walk: { enter(node) {
|
|
1944
|
+
if (node.type === "ImportDeclaration") {
|
|
1945
|
+
if (virtualImports.includes(node.source.value)) {
|
|
1946
|
+
ranges.push([node.start, node.end]);
|
|
1947
|
+
node.specifiers.forEach((i) => {
|
|
1948
|
+
if (i.type === "ImportSpecifier" && i.imported.type === "Identifier") {
|
|
1949
|
+
const original = importMap.get(i.imported.name);
|
|
1950
|
+
if (!original) throw new Error(`[unimport] failed to find "${i.imported.name}" imported from "${node.source.value}"`);
|
|
1951
|
+
imports.push({
|
|
1952
|
+
from: original.from,
|
|
1953
|
+
name: original.name,
|
|
1954
|
+
as: i.local.name
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
} }
|
|
1961
|
+
};
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1770
1964
|
//#endregion
|
|
1771
1965
|
//#region node_modules/.pnpm/unplugin@2.3.11/node_modules/unplugin/dist/context-Csj9j3eN.js
|
|
1772
1966
|
function toArray$2(array) {
|
|
@@ -3303,6 +3497,11 @@ function createFilter(include, exclude, options) {
|
|
|
3303
3497
|
|
|
3304
3498
|
//#endregion
|
|
3305
3499
|
//#region node_modules/.pnpm/unimport@5.6.0/node_modules/unimport/dist/unplugin.mjs
|
|
3500
|
+
var unplugin_exports = /* @__PURE__ */ __exportAll({
|
|
3501
|
+
default: () => unplugin,
|
|
3502
|
+
defaultExcludes: () => defaultExcludes,
|
|
3503
|
+
defaultIncludes: () => defaultIncludes
|
|
3504
|
+
});
|
|
3306
3505
|
const defaultIncludes = [
|
|
3307
3506
|
/\.[jt]sx?$/,
|
|
3308
3507
|
/\.vue$/,
|
|
@@ -3341,194 +3540,4 @@ const unplugin = createUnplugin((options = {}) => {
|
|
|
3341
3540
|
});
|
|
3342
3541
|
|
|
3343
3542
|
//#endregion
|
|
3344
|
-
|
|
3345
|
-
var detect_acorn_exports = /* @__PURE__ */ __exportAll({
|
|
3346
|
-
createVirtualImportsAcronWalker: () => createVirtualImportsAcronWalker,
|
|
3347
|
-
detectImportsAcorn: () => detectImportsAcorn,
|
|
3348
|
-
traveseScopes: () => traveseScopes
|
|
3349
|
-
});
|
|
3350
|
-
async function detectImportsAcorn(code, ctx, options) {
|
|
3351
|
-
const s = getMagicString(code);
|
|
3352
|
-
const map = await ctx.getImportMap();
|
|
3353
|
-
let matchedImports = [];
|
|
3354
|
-
const enableAutoImport = options?.autoImport !== false;
|
|
3355
|
-
const enableTransformVirtualImports = options?.transformVirtualImports !== false && ctx.options.virtualImports?.length;
|
|
3356
|
-
if (enableAutoImport || enableTransformVirtualImports) {
|
|
3357
|
-
const ast = parse$2(s.original, {
|
|
3358
|
-
sourceType: "module",
|
|
3359
|
-
ecmaVersion: "latest",
|
|
3360
|
-
locations: true
|
|
3361
|
-
});
|
|
3362
|
-
const virtualImports = createVirtualImportsAcronWalker(map, ctx.options.virtualImports);
|
|
3363
|
-
const scopes = traveseScopes(ast, enableTransformVirtualImports ? virtualImports.walk : {});
|
|
3364
|
-
if (enableAutoImport) {
|
|
3365
|
-
const identifiers = scopes.unmatched;
|
|
3366
|
-
matchedImports.push(...Array.from(identifiers).map((name) => {
|
|
3367
|
-
const item = map.get(name);
|
|
3368
|
-
if (item && !item.disabled) return item;
|
|
3369
|
-
return null;
|
|
3370
|
-
}).filter(Boolean));
|
|
3371
|
-
for (const addon of ctx.addons) matchedImports = await addon.matchImports?.call(ctx, identifiers, matchedImports) || matchedImports;
|
|
3372
|
-
}
|
|
3373
|
-
virtualImports.ranges.forEach(([start, end]) => {
|
|
3374
|
-
s.remove(start, end);
|
|
3375
|
-
});
|
|
3376
|
-
matchedImports.push(...virtualImports.imports);
|
|
3377
|
-
}
|
|
3378
|
-
return {
|
|
3379
|
-
s,
|
|
3380
|
-
strippedCode: code.toString(),
|
|
3381
|
-
matchedImports,
|
|
3382
|
-
isCJSContext: false,
|
|
3383
|
-
firstOccurrence: 0
|
|
3384
|
-
};
|
|
3385
|
-
}
|
|
3386
|
-
function traveseScopes(ast, additionalWalk) {
|
|
3387
|
-
const scopes = [];
|
|
3388
|
-
let scopeCurrent = void 0;
|
|
3389
|
-
const scopesStack = [];
|
|
3390
|
-
function pushScope(node) {
|
|
3391
|
-
scopeCurrent = {
|
|
3392
|
-
node,
|
|
3393
|
-
parent: scopeCurrent,
|
|
3394
|
-
declarations: /* @__PURE__ */ new Set(),
|
|
3395
|
-
references: /* @__PURE__ */ new Set()
|
|
3396
|
-
};
|
|
3397
|
-
scopes.push(scopeCurrent);
|
|
3398
|
-
scopesStack.push(scopeCurrent);
|
|
3399
|
-
}
|
|
3400
|
-
function popScope(node) {
|
|
3401
|
-
if (scopesStack.pop()?.node !== node) throw new Error("Scope mismatch");
|
|
3402
|
-
scopeCurrent = scopesStack[scopesStack.length - 1];
|
|
3403
|
-
}
|
|
3404
|
-
pushScope(void 0);
|
|
3405
|
-
walk(ast, {
|
|
3406
|
-
enter(node, parent, prop, index) {
|
|
3407
|
-
additionalWalk?.enter?.call(this, node, parent, prop, index);
|
|
3408
|
-
switch (node.type) {
|
|
3409
|
-
case "ImportSpecifier":
|
|
3410
|
-
case "ImportDefaultSpecifier":
|
|
3411
|
-
case "ImportNamespaceSpecifier":
|
|
3412
|
-
scopeCurrent.declarations.add(node.local.name);
|
|
3413
|
-
return;
|
|
3414
|
-
case "FunctionDeclaration":
|
|
3415
|
-
case "ClassDeclaration":
|
|
3416
|
-
if (node.id) scopeCurrent.declarations.add(node.id.name);
|
|
3417
|
-
return;
|
|
3418
|
-
case "VariableDeclarator":
|
|
3419
|
-
if (node.id.type === "Identifier") scopeCurrent.declarations.add(node.id.name);
|
|
3420
|
-
else walk(node.id, { enter(node2) {
|
|
3421
|
-
if (node2.type === "ObjectPattern") node2.properties.forEach((i) => {
|
|
3422
|
-
if (i.type === "Property" && i.value.type === "Identifier") scopeCurrent.declarations.add(i.value.name);
|
|
3423
|
-
else if (i.type === "RestElement" && i.argument.type === "Identifier") scopeCurrent.declarations.add(i.argument.name);
|
|
3424
|
-
});
|
|
3425
|
-
else if (node2.type === "ArrayPattern") node2.elements.forEach((i) => {
|
|
3426
|
-
if (i?.type === "Identifier") scopeCurrent.declarations.add(i.name);
|
|
3427
|
-
if (i?.type === "RestElement" && i.argument.type === "Identifier") scopeCurrent.declarations.add(i.argument.name);
|
|
3428
|
-
});
|
|
3429
|
-
} });
|
|
3430
|
-
return;
|
|
3431
|
-
case "BlockStatement":
|
|
3432
|
-
switch (parent?.type) {
|
|
3433
|
-
case "FunctionDeclaration":
|
|
3434
|
-
case "ArrowFunctionExpression":
|
|
3435
|
-
case "FunctionExpression": {
|
|
3436
|
-
const parameterIdentifiers = parent.params.filter((p) => p.type === "Identifier");
|
|
3437
|
-
for (const id of parameterIdentifiers) scopeCurrent.declarations.add(id.name);
|
|
3438
|
-
break;
|
|
3439
|
-
}
|
|
3440
|
-
}
|
|
3441
|
-
pushScope(node);
|
|
3442
|
-
return;
|
|
3443
|
-
case "Identifier":
|
|
3444
|
-
switch (parent?.type) {
|
|
3445
|
-
case "CallExpression":
|
|
3446
|
-
if (parent.callee === node || parent.arguments.includes(node)) scopeCurrent.references.add(node.name);
|
|
3447
|
-
return;
|
|
3448
|
-
case "MemberExpression":
|
|
3449
|
-
if (parent.object === node) scopeCurrent.references.add(node.name);
|
|
3450
|
-
return;
|
|
3451
|
-
case "VariableDeclarator":
|
|
3452
|
-
if (parent.init === node) scopeCurrent.references.add(node.name);
|
|
3453
|
-
return;
|
|
3454
|
-
case "SpreadElement":
|
|
3455
|
-
if (parent.argument === node) scopeCurrent.references.add(node.name);
|
|
3456
|
-
return;
|
|
3457
|
-
case "ClassDeclaration":
|
|
3458
|
-
if (parent.superClass === node) scopeCurrent.references.add(node.name);
|
|
3459
|
-
return;
|
|
3460
|
-
case "Property":
|
|
3461
|
-
if (parent.value === node) scopeCurrent.references.add(node.name);
|
|
3462
|
-
return;
|
|
3463
|
-
case "TemplateLiteral":
|
|
3464
|
-
if (parent.expressions.includes(node)) scopeCurrent.references.add(node.name);
|
|
3465
|
-
return;
|
|
3466
|
-
case "AssignmentExpression":
|
|
3467
|
-
if (parent.right === node) scopeCurrent.references.add(node.name);
|
|
3468
|
-
return;
|
|
3469
|
-
case "IfStatement":
|
|
3470
|
-
case "WhileStatement":
|
|
3471
|
-
case "DoWhileStatement":
|
|
3472
|
-
if (parent.test === node) scopeCurrent.references.add(node.name);
|
|
3473
|
-
return;
|
|
3474
|
-
case "SwitchStatement":
|
|
3475
|
-
if (parent.discriminant === node) scopeCurrent.references.add(node.name);
|
|
3476
|
-
return;
|
|
3477
|
-
}
|
|
3478
|
-
if (parent?.type.includes("Expression")) scopeCurrent.references.add(node.name);
|
|
3479
|
-
}
|
|
3480
|
-
},
|
|
3481
|
-
leave(node, parent, prop, index) {
|
|
3482
|
-
additionalWalk?.leave?.call(this, node, parent, prop, index);
|
|
3483
|
-
switch (node.type) {
|
|
3484
|
-
case "BlockStatement": popScope(node);
|
|
3485
|
-
}
|
|
3486
|
-
}
|
|
3487
|
-
});
|
|
3488
|
-
const unmatched = /* @__PURE__ */ new Set();
|
|
3489
|
-
for (const scope of scopes) for (const name of scope.references) {
|
|
3490
|
-
let defined = false;
|
|
3491
|
-
let parent = scope;
|
|
3492
|
-
while (parent) {
|
|
3493
|
-
if (parent.declarations.has(name)) {
|
|
3494
|
-
defined = true;
|
|
3495
|
-
break;
|
|
3496
|
-
}
|
|
3497
|
-
parent = parent?.parent;
|
|
3498
|
-
}
|
|
3499
|
-
if (!defined) unmatched.add(name);
|
|
3500
|
-
}
|
|
3501
|
-
return {
|
|
3502
|
-
unmatched,
|
|
3503
|
-
scopes
|
|
3504
|
-
};
|
|
3505
|
-
}
|
|
3506
|
-
function createVirtualImportsAcronWalker(importMap, virtualImports = []) {
|
|
3507
|
-
const imports = [];
|
|
3508
|
-
const ranges = [];
|
|
3509
|
-
return {
|
|
3510
|
-
imports,
|
|
3511
|
-
ranges,
|
|
3512
|
-
walk: { enter(node) {
|
|
3513
|
-
if (node.type === "ImportDeclaration") {
|
|
3514
|
-
if (virtualImports.includes(node.source.value)) {
|
|
3515
|
-
ranges.push([node.start, node.end]);
|
|
3516
|
-
node.specifiers.forEach((i) => {
|
|
3517
|
-
if (i.type === "ImportSpecifier" && i.imported.type === "Identifier") {
|
|
3518
|
-
const original = importMap.get(i.imported.name);
|
|
3519
|
-
if (!original) throw new Error(`[unimport] failed to find "${i.imported.name}" imported from "${node.source.value}"`);
|
|
3520
|
-
imports.push({
|
|
3521
|
-
from: original.from,
|
|
3522
|
-
name: original.name,
|
|
3523
|
-
as: i.local.name
|
|
3524
|
-
});
|
|
3525
|
-
}
|
|
3526
|
-
});
|
|
3527
|
-
}
|
|
3528
|
-
}
|
|
3529
|
-
} }
|
|
3530
|
-
};
|
|
3531
|
-
}
|
|
3532
|
-
|
|
3533
|
-
//#endregion
|
|
3534
|
-
export { unplugin as a, traveseScopes as i, detectImportsAcorn as n, createUnimport as o, detect_acorn_exports as r, toExports as s, createVirtualImportsAcronWalker as t };
|
|
3543
|
+
export { stripCommentsAndStrings as A, excludeRE as C, normalizeImports as D, matchRE as E, toTypeReExports as F, vueTemplateAddon as I, toExports as M, toTypeDeclarationFile as N, separatorRE as O, toTypeDeclarationItems as P, defineUnimportPreset as S, importAsRE as T, scanExports as _, createVirtualImportsAcronWalker as a, addImportToCode as b, traveseScopes as c, createUnimport as d, dedupeDtsExports as f, scanDirExports as g, resolvePreset as h, unplugin_exports as i, stripFileExtension as j, stringifyImports as k, dist_exports as l, resolveBuiltinPresets as m, defaultIncludes as n, detectImportsAcorn as o, normalizeScanDirs as p, unplugin as r, detect_acorn_exports as s, defaultExcludes as t, builtinPresets as u, scanFilesFromDir as v, getMagicString as w, dedupeImports as x, version as y };
|
package/dist/_libs/unwasm.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as MagicString } from "./@hiogawa/vite-plugin-fullstack.mjs";
|
|
1
|
+
import { x as basename, y as resolveModulePath } from "./c12.mjs";
|
|
3
2
|
import { a as genString, i as genSafeVariableName, n as genObjectFromRaw, t as genImport } from "./knitwork.mjs";
|
|
3
|
+
import { a as MagicString } from "./@hiogawa/vite-plugin-fullstack.mjs";
|
|
4
4
|
import { existsSync, promises } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { createHash } from "node:crypto";
|