nitro-nightly 3.0.1-20260106-130706-e20c92d9 → 3.0.1-20260106-202835-5325b208
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 +6 -14
- package/dist/_build/rollup.mjs +6 -41
- package/dist/_build/rollup2.mjs +56 -0
- package/dist/_build/shared.mjs +2 -1
- package/dist/_build/shared2.mjs +1 -1
- package/dist/_build/shared3.mjs +1 -1
- package/dist/_build/vite.build.mjs +1 -19
- package/dist/_dev.mjs +2 -1
- package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +5 -1560
- package/dist/_libs/@jridgewell/gen-mapping.mjs +2 -304
- package/dist/_libs/@jridgewell/remapping.mjs +2 -1
- package/dist/_libs/@jridgewell/resolve-uri.mjs +166 -0
- package/dist/_libs/@jridgewell/sourcemap-codec.mjs +167 -0
- package/dist/_libs/@jridgewell/trace-mapping.mjs +141 -0
- package/dist/_libs/@rolldown/pluginutils.mjs +31 -0
- package/dist/_libs/@rollup/plugin-commonjs.mjs +33 -2636
- package/dist/_libs/@rollup/plugin-inject.mjs +3 -2
- package/dist/_libs/@rollup/plugin-json.mjs +1 -1
- package/dist/_libs/@rollup/plugin-node-resolve.mjs +7 -1111
- package/dist/_libs/@rollup/plugin-replace.mjs +2 -2
- package/dist/_libs/@rollup/pluginutils.mjs +241 -0
- package/dist/_libs/c12.mjs +63 -2513
- package/dist/_libs/chokidar.mjs +1 -234
- package/dist/_libs/commondir.mjs +22 -0
- package/dist/_libs/confbox.mjs +1102 -502
- package/dist/_libs/deepmerge.mjs +86 -0
- package/dist/_libs/dotenv.mjs +345 -0
- package/dist/_libs/estree-walker.mjs +144 -1
- package/dist/_libs/exsolve.mjs +1007 -0
- package/dist/_libs/fdir.mjs +514 -0
- package/dist/_libs/function-bind.mjs +63 -0
- package/dist/_libs/giget.mjs +1376 -2234
- package/dist/_libs/hasown.mjs +14 -0
- package/dist/_libs/is-core-module.mjs +220 -0
- package/dist/_libs/is-module.mjs +13 -0
- package/dist/_libs/is-reference.mjs +33 -0
- package/dist/_libs/js-tokens.mjs +382 -0
- package/dist/_libs/local-pkg.mjs +6 -1560
- package/dist/_libs/magic-string.mjs +939 -0
- package/dist/_libs/mlly.mjs +1415 -0
- package/dist/_libs/node-fetch-native.mjs +7 -0
- package/dist/_libs/nypm.mjs +239 -0
- package/dist/_libs/path-parse.mjs +47 -0
- package/dist/_libs/pathe.mjs +163 -2
- package/dist/_libs/perfect-debounce.mjs +89 -0
- package/dist/_libs/picomatch.mjs +1673 -0
- package/dist/_libs/pkg-types.mjs +197 -0
- package/dist/_libs/quansync.mjs +90 -0
- package/dist/_libs/rc9.mjs +136 -0
- package/dist/_libs/readdirp.mjs +237 -0
- package/dist/_libs/resolve.mjs +689 -0
- package/dist/_libs/strip-literal.mjs +51 -0
- package/dist/_libs/tinyexec.mjs +627 -0
- package/dist/_libs/tinyglobby.mjs +2 -1
- package/dist/_libs/unimport.mjs +42 -1575
- package/dist/_libs/unplugin-utils.mjs +61 -0
- package/dist/_libs/unplugin.mjs +1225 -0
- package/dist/_libs/unwasm.mjs +3 -2
- package/dist/_libs/webpack-virtual-modules.mjs +272 -0
- package/dist/_nitro.mjs +7 -4
- package/dist/_nitro2.mjs +3 -3
- package/dist/_presets.mjs +5 -3
- package/dist/builder.mjs +4 -4
- package/dist/cli/_chunks/{build.mjs → build2.mjs} +1 -1
- package/dist/cli/_chunks/dev.mjs +1 -1
- package/dist/cli/_chunks/list.mjs +1 -1
- package/dist/cli/_chunks/prepare.mjs +1 -1
- package/dist/cli/_chunks/run.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/vite.mjs +1824 -19
- package/package.json +2 -2
- package/dist/_build/shared4.mjs +0 -1114
- package/dist/_build/vite.plugin.mjs +0 -712
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/native.mjs
|
|
2
|
+
const e = globalThis.Blob, o = globalThis.File, a = globalThis.FormData, s = globalThis.Headers, t = globalThis.Request, h = globalThis.Response, i = globalThis.AbortController, l = globalThis.fetch || (() => {
|
|
3
|
+
throw new Error("[node-fetch-native] Failed to fetch: `globalThis.fetch` is not available!");
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { l as t };
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { n as __exportAll } from "../_rolldown.mjs";
|
|
2
|
+
import { o as join, s as normalize, u as resolve } from "./pathe.mjs";
|
|
3
|
+
import { s as readPackageJSON } from "./pkg-types.mjs";
|
|
4
|
+
import { t as K } from "./tinyexec.mjs";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { readFile } from "node:fs/promises";
|
|
8
|
+
|
|
9
|
+
//#region node_modules/.pnpm/nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.mjs
|
|
10
|
+
async function findup(cwd, match, options = {}) {
|
|
11
|
+
const segments = normalize(cwd).split("/");
|
|
12
|
+
while (segments.length > 0) {
|
|
13
|
+
const result = await match(segments.join("/") || "/");
|
|
14
|
+
if (result || !options.includeParentDirs) return result;
|
|
15
|
+
segments.pop();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function cached(fn) {
|
|
19
|
+
let v;
|
|
20
|
+
return () => {
|
|
21
|
+
if (v === void 0) v = fn().then((r) => {
|
|
22
|
+
v = r;
|
|
23
|
+
return v;
|
|
24
|
+
});
|
|
25
|
+
return v;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const hasCorepack = cached(async () => {
|
|
29
|
+
if (globalThis.process?.versions?.webcontainer) return false;
|
|
30
|
+
try {
|
|
31
|
+
const { exitCode } = await K("corepack", ["--version"]);
|
|
32
|
+
return exitCode === 0;
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
async function executeCommand(command, args, options = {}) {
|
|
38
|
+
const xArgs = command === "npm" || command === "bun" || command === "deno" || !await hasCorepack() ? [command, args] : ["corepack", [command, ...args]];
|
|
39
|
+
const { exitCode, stdout, stderr } = await K(xArgs[0], xArgs[1], { nodeOptions: {
|
|
40
|
+
cwd: resolve(options.cwd || process.cwd()),
|
|
41
|
+
env: options.env,
|
|
42
|
+
stdio: options.silent ? "pipe" : "inherit"
|
|
43
|
+
} });
|
|
44
|
+
if (exitCode !== 0) throw new Error(`\`${xArgs.flat().join(" ")}\` failed.${options.silent ? [
|
|
45
|
+
"",
|
|
46
|
+
stdout,
|
|
47
|
+
stderr
|
|
48
|
+
].join("\n") : ""}`);
|
|
49
|
+
}
|
|
50
|
+
const NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG = "No package manager auto-detected.";
|
|
51
|
+
async function resolveOperationOptions(options = {}) {
|
|
52
|
+
const cwd = options.cwd || process.cwd();
|
|
53
|
+
const env = {
|
|
54
|
+
...process.env,
|
|
55
|
+
...options.env
|
|
56
|
+
};
|
|
57
|
+
const packageManager = (typeof options.packageManager === "string" ? packageManagers.find((pm) => pm.name === options.packageManager) : options.packageManager) || await detectPackageManager(options.cwd || process.cwd());
|
|
58
|
+
if (!packageManager) throw new Error(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
|
|
59
|
+
return {
|
|
60
|
+
cwd,
|
|
61
|
+
env,
|
|
62
|
+
silent: options.silent ?? false,
|
|
63
|
+
packageManager,
|
|
64
|
+
dev: options.dev ?? false,
|
|
65
|
+
workspace: options.workspace,
|
|
66
|
+
global: options.global ?? false,
|
|
67
|
+
dry: options.dry ?? false
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function getWorkspaceArgs(options) {
|
|
71
|
+
if (!options.workspace) return [];
|
|
72
|
+
const workspacePkg = typeof options.workspace === "string" && options.workspace !== "" ? options.workspace : void 0;
|
|
73
|
+
if (options.packageManager.name === "pnpm") return workspacePkg ? ["--filter", workspacePkg] : ["--workspace-root"];
|
|
74
|
+
if (options.packageManager.name === "npm") return workspacePkg ? ["-w", workspacePkg] : ["--workspaces"];
|
|
75
|
+
if (options.packageManager.name === "yarn") if (!options.packageManager.majorVersion || options.packageManager.majorVersion === "1") return workspacePkg ? ["--cwd", workspacePkg] : ["-W"];
|
|
76
|
+
else return workspacePkg ? ["workspace", workspacePkg] : [];
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
function parsePackageManagerField(packageManager) {
|
|
80
|
+
const [name, _version] = (packageManager || "").split("@");
|
|
81
|
+
const [version, buildMeta] = _version?.split("+") || [];
|
|
82
|
+
if (name && name !== "-" && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) return {
|
|
83
|
+
name,
|
|
84
|
+
version,
|
|
85
|
+
buildMeta
|
|
86
|
+
};
|
|
87
|
+
const sanitized = name.replace(/\W+/g, "");
|
|
88
|
+
return {
|
|
89
|
+
name: sanitized,
|
|
90
|
+
version,
|
|
91
|
+
buildMeta,
|
|
92
|
+
warnings: [`Abnormal characters found in \`packageManager\` field, sanitizing from \`${name}\` to \`${sanitized}\``]
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const packageManagers = [
|
|
96
|
+
{
|
|
97
|
+
name: "npm",
|
|
98
|
+
command: "npm",
|
|
99
|
+
lockFile: "package-lock.json"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "pnpm",
|
|
103
|
+
command: "pnpm",
|
|
104
|
+
lockFile: "pnpm-lock.yaml",
|
|
105
|
+
files: ["pnpm-workspace.yaml"]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "bun",
|
|
109
|
+
command: "bun",
|
|
110
|
+
lockFile: ["bun.lockb", "bun.lock"]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "yarn",
|
|
114
|
+
command: "yarn",
|
|
115
|
+
lockFile: "yarn.lock",
|
|
116
|
+
files: [".yarnrc.yml"]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "deno",
|
|
120
|
+
command: "deno",
|
|
121
|
+
lockFile: "deno.lock",
|
|
122
|
+
files: ["deno.json"]
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
async function detectPackageManager(cwd, options = {}) {
|
|
126
|
+
const detected = await findup(resolve(cwd || "."), async (path) => {
|
|
127
|
+
if (!options.ignorePackageJSON) {
|
|
128
|
+
const packageJSONPath = join(path, "package.json");
|
|
129
|
+
if (existsSync(packageJSONPath)) {
|
|
130
|
+
const packageJSON = JSON.parse(await readFile(packageJSONPath, "utf8"));
|
|
131
|
+
if (packageJSON?.packageManager) {
|
|
132
|
+
const { name, version = "0.0.0", buildMeta, warnings } = parsePackageManagerField(packageJSON.packageManager);
|
|
133
|
+
if (name) {
|
|
134
|
+
const majorVersion = version.split(".")[0];
|
|
135
|
+
const packageManager = packageManagers.find((pm) => pm.name === name && pm.majorVersion === majorVersion) || packageManagers.find((pm) => pm.name === name);
|
|
136
|
+
return {
|
|
137
|
+
name,
|
|
138
|
+
command: name,
|
|
139
|
+
version,
|
|
140
|
+
majorVersion,
|
|
141
|
+
buildMeta,
|
|
142
|
+
warnings,
|
|
143
|
+
files: packageManager?.files,
|
|
144
|
+
lockFile: packageManager?.lockFile
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (existsSync(join(path, "deno.json"))) return packageManagers.find((pm) => pm.name === "deno");
|
|
150
|
+
}
|
|
151
|
+
if (!options.ignoreLockFile) {
|
|
152
|
+
for (const packageManager of packageManagers) if ([packageManager.lockFile, packageManager.files].flat().filter(Boolean).some((file) => existsSync(resolve(path, file)))) return { ...packageManager };
|
|
153
|
+
}
|
|
154
|
+
}, { includeParentDirs: options.includeParentDirs ?? true });
|
|
155
|
+
if (!detected && !options.ignoreArgv) {
|
|
156
|
+
const scriptArg = process.argv[1];
|
|
157
|
+
if (scriptArg) {
|
|
158
|
+
for (const packageManager of packageManagers) if ((/* @__PURE__ */ new RegExp(`[/\\\\]\\.?${packageManager.command}`)).test(scriptArg)) return packageManager;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return detected;
|
|
162
|
+
}
|
|
163
|
+
async function installDependencies(options = {}) {
|
|
164
|
+
const resolvedOptions = await resolveOperationOptions(options);
|
|
165
|
+
const commandArgs = options.frozenLockFile ? {
|
|
166
|
+
npm: ["ci"],
|
|
167
|
+
yarn: ["install", "--immutable"],
|
|
168
|
+
bun: ["install", "--frozen-lockfile"],
|
|
169
|
+
pnpm: ["install", "--frozen-lockfile"],
|
|
170
|
+
deno: ["install", "--frozen"]
|
|
171
|
+
}[resolvedOptions.packageManager.name] : ["install"];
|
|
172
|
+
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
|
|
173
|
+
cwd: resolvedOptions.cwd,
|
|
174
|
+
silent: resolvedOptions.silent
|
|
175
|
+
});
|
|
176
|
+
return { exec: {
|
|
177
|
+
command: resolvedOptions.packageManager.command,
|
|
178
|
+
args: commandArgs
|
|
179
|
+
} };
|
|
180
|
+
}
|
|
181
|
+
async function addDependency(name, options = {}) {
|
|
182
|
+
const resolvedOptions = await resolveOperationOptions(options);
|
|
183
|
+
const names = Array.isArray(name) ? name : [name];
|
|
184
|
+
if (resolvedOptions.packageManager.name === "deno") {
|
|
185
|
+
for (let i = 0; i < names.length; i++) if (!/^(npm|jsr|file):.+$/.test(names[i])) names[i] = `npm:${names[i]}`;
|
|
186
|
+
}
|
|
187
|
+
if (names.length === 0) return {};
|
|
188
|
+
const args = (resolvedOptions.packageManager.name === "yarn" ? [
|
|
189
|
+
...getWorkspaceArgs(resolvedOptions),
|
|
190
|
+
resolvedOptions.global && resolvedOptions.packageManager.majorVersion === "1" ? "global" : "",
|
|
191
|
+
"add",
|
|
192
|
+
resolvedOptions.dev ? "-D" : "",
|
|
193
|
+
...names
|
|
194
|
+
] : [
|
|
195
|
+
resolvedOptions.packageManager.name === "npm" ? "install" : "add",
|
|
196
|
+
...getWorkspaceArgs(resolvedOptions),
|
|
197
|
+
resolvedOptions.dev ? "-D" : "",
|
|
198
|
+
resolvedOptions.global ? "-g" : "",
|
|
199
|
+
...names
|
|
200
|
+
]).filter(Boolean);
|
|
201
|
+
if (!resolvedOptions.dry) await executeCommand(resolvedOptions.packageManager.command, args, {
|
|
202
|
+
cwd: resolvedOptions.cwd,
|
|
203
|
+
silent: resolvedOptions.silent
|
|
204
|
+
});
|
|
205
|
+
if (!resolvedOptions.dry && options.installPeerDependencies) {
|
|
206
|
+
const existingPkg = await readPackageJSON(resolvedOptions.cwd);
|
|
207
|
+
const peerDeps = [];
|
|
208
|
+
const peerDevDeps = [];
|
|
209
|
+
for (const _name of names) {
|
|
210
|
+
const pkgName = _name.match(/^(.[^@]+)/)?.[0];
|
|
211
|
+
const pkg = await readPackageJSON(pkgName, { url: resolvedOptions.cwd }).catch(() => ({}));
|
|
212
|
+
if (!pkg.peerDependencies || pkg.name !== pkgName) continue;
|
|
213
|
+
for (const [peerDependency, version] of Object.entries(pkg.peerDependencies)) {
|
|
214
|
+
if (pkg.peerDependenciesMeta?.[peerDependency]?.optional) continue;
|
|
215
|
+
if (existingPkg.dependencies?.[peerDependency] || existingPkg.devDependencies?.[peerDependency]) continue;
|
|
216
|
+
(pkg.peerDependenciesMeta?.[peerDependency]?.dev ? peerDevDeps : peerDeps).push(`${peerDependency}@${version}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (peerDeps.length > 0) await addDependency(peerDeps, { ...resolvedOptions });
|
|
220
|
+
if (peerDevDeps.length > 0) await addDevDependency(peerDevDeps, { ...resolvedOptions });
|
|
221
|
+
}
|
|
222
|
+
return { exec: {
|
|
223
|
+
command: resolvedOptions.packageManager.command,
|
|
224
|
+
args
|
|
225
|
+
} };
|
|
226
|
+
}
|
|
227
|
+
async function addDevDependency(name, options = {}) {
|
|
228
|
+
return await addDependency(name, {
|
|
229
|
+
...options,
|
|
230
|
+
dev: true
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region node_modules/.pnpm/nypm@0.6.2/node_modules/nypm/dist/index.mjs
|
|
236
|
+
var dist_exports = /* @__PURE__ */ __exportAll({ addDevDependency: () => addDevDependency });
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
export { installDependencies as a, detectPackageManager as i, addDependency as n, packageManagers as o, addDevDependency as r, dist_exports as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { t as __commonJSMin } from "../_rolldown.mjs";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/path-parse@1.0.7/node_modules/path-parse/index.js
|
|
4
|
+
var require_path_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
+
var isWindows = process.platform === "win32";
|
|
6
|
+
var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
|
|
7
|
+
var win32 = {};
|
|
8
|
+
function win32SplitPath(filename) {
|
|
9
|
+
return splitWindowsRe.exec(filename).slice(1);
|
|
10
|
+
}
|
|
11
|
+
win32.parse = function(pathString) {
|
|
12
|
+
if (typeof pathString !== "string") throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
|
|
13
|
+
var allParts = win32SplitPath(pathString);
|
|
14
|
+
if (!allParts || allParts.length !== 5) throw new TypeError("Invalid path '" + pathString + "'");
|
|
15
|
+
return {
|
|
16
|
+
root: allParts[1],
|
|
17
|
+
dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
|
|
18
|
+
base: allParts[2],
|
|
19
|
+
ext: allParts[4],
|
|
20
|
+
name: allParts[3]
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
|
|
24
|
+
var posix = {};
|
|
25
|
+
function posixSplitPath(filename) {
|
|
26
|
+
return splitPathRe.exec(filename).slice(1);
|
|
27
|
+
}
|
|
28
|
+
posix.parse = function(pathString) {
|
|
29
|
+
if (typeof pathString !== "string") throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
|
|
30
|
+
var allParts = posixSplitPath(pathString);
|
|
31
|
+
if (!allParts || allParts.length !== 5) throw new TypeError("Invalid path '" + pathString + "'");
|
|
32
|
+
return {
|
|
33
|
+
root: allParts[1],
|
|
34
|
+
dir: allParts[0].slice(0, -1),
|
|
35
|
+
base: allParts[2],
|
|
36
|
+
ext: allParts[4],
|
|
37
|
+
name: allParts[3]
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
if (isWindows) module.exports = win32.parse;
|
|
41
|
+
else module.exports = posix.parse;
|
|
42
|
+
module.exports.posix = posix.parse;
|
|
43
|
+
module.exports.win32 = win32.parse;
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { require_path_parse as t };
|
package/dist/_libs/pathe.mjs
CHANGED
|
@@ -1,5 +1,166 @@
|
|
|
1
|
-
|
|
1
|
+
//#region node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
2
|
+
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
3
|
+
function normalizeWindowsPath(input = "") {
|
|
4
|
+
if (!input) return input;
|
|
5
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
6
|
+
}
|
|
7
|
+
const _UNC_REGEX = /^[/\\]{2}/;
|
|
8
|
+
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
9
|
+
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
10
|
+
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
11
|
+
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
12
|
+
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
13
|
+
const normalize = function(path) {
|
|
14
|
+
if (path.length === 0) return ".";
|
|
15
|
+
path = normalizeWindowsPath(path);
|
|
16
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
17
|
+
const isPathAbsolute = isAbsolute(path);
|
|
18
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
19
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
20
|
+
if (path.length === 0) {
|
|
21
|
+
if (isPathAbsolute) return "/";
|
|
22
|
+
return trailingSeparator ? "./" : ".";
|
|
23
|
+
}
|
|
24
|
+
if (trailingSeparator) path += "/";
|
|
25
|
+
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
26
|
+
if (isUNCPath) {
|
|
27
|
+
if (!isPathAbsolute) return `//./${path}`;
|
|
28
|
+
return `//${path}`;
|
|
29
|
+
}
|
|
30
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
31
|
+
};
|
|
32
|
+
const join = function(...segments) {
|
|
33
|
+
let path = "";
|
|
34
|
+
for (const seg of segments) {
|
|
35
|
+
if (!seg) continue;
|
|
36
|
+
if (path.length > 0) {
|
|
37
|
+
const pathTrailing = path[path.length - 1] === "/";
|
|
38
|
+
const segLeading = seg[0] === "/";
|
|
39
|
+
if (pathTrailing && segLeading) path += seg.slice(1);
|
|
40
|
+
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
41
|
+
} else path += seg;
|
|
42
|
+
}
|
|
43
|
+
return normalize(path);
|
|
44
|
+
};
|
|
45
|
+
function cwd() {
|
|
46
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
47
|
+
return "/";
|
|
48
|
+
}
|
|
49
|
+
const resolve = function(...arguments_) {
|
|
50
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
51
|
+
let resolvedPath = "";
|
|
52
|
+
let resolvedAbsolute = false;
|
|
53
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
54
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
55
|
+
if (!path || path.length === 0) continue;
|
|
56
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
57
|
+
resolvedAbsolute = isAbsolute(path);
|
|
58
|
+
}
|
|
59
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
60
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
61
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
62
|
+
};
|
|
63
|
+
function normalizeString(path, allowAboveRoot) {
|
|
64
|
+
let res = "";
|
|
65
|
+
let lastSegmentLength = 0;
|
|
66
|
+
let lastSlash = -1;
|
|
67
|
+
let dots = 0;
|
|
68
|
+
let char = null;
|
|
69
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
70
|
+
if (index < path.length) char = path[index];
|
|
71
|
+
else if (char === "/") break;
|
|
72
|
+
else char = "/";
|
|
73
|
+
if (char === "/") {
|
|
74
|
+
if (lastSlash === index - 1 || dots === 1);
|
|
75
|
+
else if (dots === 2) {
|
|
76
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
77
|
+
if (res.length > 2) {
|
|
78
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
79
|
+
if (lastSlashIndex === -1) {
|
|
80
|
+
res = "";
|
|
81
|
+
lastSegmentLength = 0;
|
|
82
|
+
} else {
|
|
83
|
+
res = res.slice(0, lastSlashIndex);
|
|
84
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
85
|
+
}
|
|
86
|
+
lastSlash = index;
|
|
87
|
+
dots = 0;
|
|
88
|
+
continue;
|
|
89
|
+
} else if (res.length > 0) {
|
|
90
|
+
res = "";
|
|
91
|
+
lastSegmentLength = 0;
|
|
92
|
+
lastSlash = index;
|
|
93
|
+
dots = 0;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (allowAboveRoot) {
|
|
98
|
+
res += res.length > 0 ? "/.." : "..";
|
|
99
|
+
lastSegmentLength = 2;
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
103
|
+
else res = path.slice(lastSlash + 1, index);
|
|
104
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
105
|
+
}
|
|
106
|
+
lastSlash = index;
|
|
107
|
+
dots = 0;
|
|
108
|
+
} else if (char === "." && dots !== -1) ++dots;
|
|
109
|
+
else dots = -1;
|
|
110
|
+
}
|
|
111
|
+
return res;
|
|
112
|
+
}
|
|
113
|
+
const isAbsolute = function(p) {
|
|
114
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
115
|
+
};
|
|
116
|
+
const extname = function(p) {
|
|
117
|
+
if (p === "..") return "";
|
|
118
|
+
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
119
|
+
return match && match[1] || "";
|
|
120
|
+
};
|
|
121
|
+
const relative = function(from, to) {
|
|
122
|
+
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
123
|
+
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
124
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
|
|
125
|
+
const _fromCopy = [..._from];
|
|
126
|
+
for (const segment of _fromCopy) {
|
|
127
|
+
if (_to[0] !== segment) break;
|
|
128
|
+
_from.shift();
|
|
129
|
+
_to.shift();
|
|
130
|
+
}
|
|
131
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
132
|
+
};
|
|
133
|
+
const dirname = function(p) {
|
|
134
|
+
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
135
|
+
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
136
|
+
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
137
|
+
};
|
|
138
|
+
const basename = function(p, extension) {
|
|
139
|
+
const segments = normalizeWindowsPath(p).split("/");
|
|
140
|
+
let lastSegment = "";
|
|
141
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
142
|
+
const val = segments[i];
|
|
143
|
+
if (val) {
|
|
144
|
+
lastSegment = val;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
149
|
+
};
|
|
150
|
+
const parse = function(p) {
|
|
151
|
+
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
152
|
+
const base = basename(p);
|
|
153
|
+
const extension = extname(base);
|
|
154
|
+
return {
|
|
155
|
+
root,
|
|
156
|
+
dir: dirname(p),
|
|
157
|
+
base,
|
|
158
|
+
ext: extension,
|
|
159
|
+
name: base.slice(0, base.length - extension.length)
|
|
160
|
+
};
|
|
161
|
+
};
|
|
2
162
|
|
|
163
|
+
//#endregion
|
|
3
164
|
//#region node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/utils.mjs
|
|
4
165
|
const pathSeparators = /* @__PURE__ */ new Set([
|
|
5
166
|
"/",
|
|
@@ -38,4 +199,4 @@ function hasTrailingSlash(path = "/") {
|
|
|
38
199
|
}
|
|
39
200
|
|
|
40
201
|
//#endregion
|
|
41
|
-
export { resolveAlias as t };
|
|
202
|
+
export { isAbsolute as a, parse as c, extname as i, relative as l, basename as n, join as o, dirname as r, normalize as s, resolveAlias as t, resolve as u };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/perfect-debounce@2.0.0/node_modules/perfect-debounce/dist/index.mjs
|
|
2
|
+
const DEBOUNCE_DEFAULTS = { trailing: true };
|
|
3
|
+
/**
|
|
4
|
+
Debounce functions
|
|
5
|
+
@param fn - Promise-returning/async function to debounce.
|
|
6
|
+
@param wait - Milliseconds to wait before calling `fn`. Default value is 25ms
|
|
7
|
+
@returns A function that delays calling `fn` until after `wait` milliseconds have elapsed since the last time it was called.
|
|
8
|
+
@example
|
|
9
|
+
```
|
|
10
|
+
import { debounce } from 'perfect-debounce';
|
|
11
|
+
const expensiveCall = async input => input;
|
|
12
|
+
const debouncedFn = debounce(expensiveCall, 200);
|
|
13
|
+
for (const number of [1, 2, 3]) {
|
|
14
|
+
console.log(await debouncedFn(number));
|
|
15
|
+
}
|
|
16
|
+
//=> 1
|
|
17
|
+
//=> 2
|
|
18
|
+
//=> 3
|
|
19
|
+
```
|
|
20
|
+
*/
|
|
21
|
+
function debounce(fn, wait = 25, options = {}) {
|
|
22
|
+
options = {
|
|
23
|
+
...DEBOUNCE_DEFAULTS,
|
|
24
|
+
...options
|
|
25
|
+
};
|
|
26
|
+
if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
|
|
27
|
+
let leadingValue;
|
|
28
|
+
let timeout;
|
|
29
|
+
let resolveList = [];
|
|
30
|
+
let currentPromise;
|
|
31
|
+
let trailingArgs;
|
|
32
|
+
const applyFn = (_this, args) => {
|
|
33
|
+
currentPromise = _applyPromised(fn, _this, args);
|
|
34
|
+
currentPromise.finally(() => {
|
|
35
|
+
currentPromise = null;
|
|
36
|
+
if (options.trailing && trailingArgs && !timeout) {
|
|
37
|
+
const promise = applyFn(_this, trailingArgs);
|
|
38
|
+
trailingArgs = null;
|
|
39
|
+
return promise;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return currentPromise;
|
|
43
|
+
};
|
|
44
|
+
const debounced = function(...args) {
|
|
45
|
+
if (options.trailing) trailingArgs = args;
|
|
46
|
+
if (currentPromise) return currentPromise;
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
const shouldCallNow = !timeout && options.leading;
|
|
49
|
+
clearTimeout(timeout);
|
|
50
|
+
timeout = setTimeout(() => {
|
|
51
|
+
timeout = null;
|
|
52
|
+
const promise = options.leading ? leadingValue : applyFn(this, args);
|
|
53
|
+
trailingArgs = null;
|
|
54
|
+
for (const _resolve of resolveList) _resolve(promise);
|
|
55
|
+
resolveList = [];
|
|
56
|
+
}, wait);
|
|
57
|
+
if (shouldCallNow) {
|
|
58
|
+
leadingValue = applyFn(this, args);
|
|
59
|
+
resolve(leadingValue);
|
|
60
|
+
} else resolveList.push(resolve);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const _clearTimeout = (timer) => {
|
|
64
|
+
if (timer) {
|
|
65
|
+
clearTimeout(timer);
|
|
66
|
+
timeout = null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
debounced.isPending = () => !!timeout;
|
|
70
|
+
debounced.cancel = () => {
|
|
71
|
+
_clearTimeout(timeout);
|
|
72
|
+
resolveList = [];
|
|
73
|
+
trailingArgs = null;
|
|
74
|
+
};
|
|
75
|
+
debounced.flush = () => {
|
|
76
|
+
_clearTimeout(timeout);
|
|
77
|
+
if (!trailingArgs || currentPromise) return;
|
|
78
|
+
const args = trailingArgs;
|
|
79
|
+
trailingArgs = null;
|
|
80
|
+
return applyFn(this, args);
|
|
81
|
+
};
|
|
82
|
+
return debounced;
|
|
83
|
+
}
|
|
84
|
+
async function _applyPromised(fn, _this, args) {
|
|
85
|
+
return await fn.apply(_this, args);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { debounce as t };
|