nitro 3.0.260415-beta → 3.0.260522-beta
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/THIRD-PARTY-LICENSES.md.gz +0 -0
- package/dist/_build/common.mjs +157 -45
- package/dist/_build/rolldown.mjs +6 -6
- package/dist/_build/rollup.mjs +11 -11
- package/dist/_build/vite.build.mjs +3 -3
- package/dist/_build/vite.dev.mjs +149 -0
- package/dist/_build/vite.env.mjs +177 -0
- package/dist/_chunks/nitro.mjs +241 -14
- package/dist/_chunks/nitro2.mjs +117 -90
- package/dist/_chunks/utils.mjs +4 -4
- package/dist/_common.mjs +2 -2
- package/dist/_dev.d.mts +1 -1
- package/dist/_dev.mjs +7 -6
- package/dist/_libs/c12+rc9.mjs +24 -11
- package/dist/_libs/c12+readdirp+chokidar.d.mts +7 -8
- package/dist/_libs/citty.mjs +1 -1
- package/dist/_libs/common.d.mts +37 -0
- package/dist/_libs/commondir+is-reference.mjs +3 -3
- package/dist/_libs/compatx.d.mts +1 -1
- package/dist/_libs/compatx.mjs +1 -1
- package/dist/_libs/estree+pluginutils.d.mts +1 -1
- package/dist/_libs/estree-walker.mjs +1 -1
- package/dist/_libs/hasown+resolve+deepmerge.mjs +62 -49
- package/dist/_libs/httpxy.d.mts +2 -4
- package/dist/_libs/httpxy.mjs +13 -9
- package/dist/_libs/jsonc-parser+workers-utils.d.mts +1579 -0
- package/dist/_libs/klona.mjs +1 -1
- package/dist/_libs/magic-string.d.mts +1 -1
- package/dist/_libs/mlly.d.mts +1 -1
- package/dist/_libs/nypm+tinyexec.mjs +137 -113
- package/dist/_libs/openapi-types.d.mts +730 -0
- package/dist/_libs/perfect-debounce.mjs +1 -1
- package/dist/_libs/pkg-types.d.mts +8 -5
- package/dist/_libs/plugin-alias.mjs +2 -2
- package/dist/_libs/plugin-inject.mjs +4 -2
- package/dist/_libs/plugin-json.mjs +2 -2
- package/dist/_libs/pluginutils.mjs +18 -5
- package/dist/_libs/readdirp+chokidar.mjs +4 -3
- package/dist/_libs/remapping.mjs +2 -2
- package/dist/_libs/resolve-uri+gen-mapping.mjs +2 -5
- package/dist/_libs/rou3.d.mts +1 -1
- package/dist/_libs/rou3.mjs +1 -1
- package/dist/_libs/std-env.d.mts +1 -1
- package/dist/_libs/tsconfck.mjs +1 -1
- package/dist/_libs/ultrahtml.mjs +1 -1
- package/dist/_libs/unimport+unplugin.mjs +61 -39
- package/dist/_libs/unplugin+unimport.d.mts +4 -4
- package/dist/_libs/unwasm.d.mts +1 -1
- package/dist/_presets.mjs +118 -91
- package/dist/builder.d.mts +1 -1
- package/dist/builder.mjs +3 -3
- package/dist/cli/_chunks/build.mjs +3 -3
- package/dist/cli/_chunks/common.mjs +1 -1
- package/dist/cli/_chunks/deploy.mjs +2 -2
- package/dist/cli/_chunks/dev.mjs +4 -4
- package/dist/cli/_chunks/docs.mjs +1 -1
- package/dist/cli/_chunks/list.mjs +2 -2
- package/dist/cli/_chunks/prepare.mjs +3 -3
- package/dist/cli/_chunks/preview.mjs +4 -4
- package/dist/cli/_chunks/run.mjs +2 -2
- package/dist/cli/_chunks/task.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/docs/0.docs/5.cache.md +53 -9
- package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +3 -3
- package/dist/docs/1.deploy/2.providers/21.vercel.md +6 -0
- package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +1 -1
- package/dist/node_modules/ufo/dist/index.mjs +2 -2
- package/dist/node_modules/ufo/package.json +9 -9
- package/dist/presets/azure/runtime/azure-swa.mjs +2 -0
- package/dist/presets/vercel/runtime/queue.dev.mjs +41 -0
- package/dist/runtime/internal/app.mjs +4 -111
- package/dist/runtime/internal/route-rules.d.mts +1 -0
- package/dist/runtime/internal/route-rules.mjs +29 -1
- package/dist/runtime/internal/routes/scalar.mjs +1 -0
- package/dist/runtime/virtual/app.d.mts +4 -0
- package/dist/runtime/virtual/app.mjs +32 -0
- package/dist/types/index.d.mts +959 -1836
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +23 -331
- package/package.json +43 -44
- package/dist/THIRD-PARTY-LICENSES.md +0 -1646
- package/dist/_chunks/nitro3.mjs +0 -136
- package/dist/_chunks/nitro4.mjs +0 -127
- package/dist/_libs/_.mjs +0 -2
- package/dist/_libs/_2.mjs +0 -2
- package/dist/_libs/_3.mjs +0 -2
- package/dist/_libs/_4.mjs +0 -2
- package/dist/_libs/_5.mjs +0 -2
- package/dist/_libs/_6.mjs +0 -2
- package/dist/_libs/_7.mjs +0 -2
- package/dist/_libs/escape-string-regexp.mjs +0 -5
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as ts from "typescript";
|
|
2
|
+
//#endregion
|
|
3
|
+
//#region src/tsconfig/types.d.ts
|
|
2
4
|
type StripEnums<T extends Record<string, any>> = { [K in keyof T]: T[K] extends boolean ? T[K] : T[K] extends string ? T[K] : T[K] extends object ? T[K] : T[K] extends Array<any> ? T[K] : T[K] extends undefined ? undefined : any };
|
|
3
5
|
interface TSConfig {
|
|
4
|
-
compilerOptions?: StripEnums<CompilerOptions>;
|
|
6
|
+
compilerOptions?: StripEnums<ts.CompilerOptions>;
|
|
5
7
|
exclude?: string[];
|
|
6
8
|
compileOnSave?: boolean;
|
|
7
9
|
extends?: string | string[];
|
|
8
10
|
files?: string[];
|
|
9
11
|
include?: string[];
|
|
10
|
-
typeAcquisition?: TypeAcquisition;
|
|
12
|
+
typeAcquisition?: ts.TypeAcquisition;
|
|
11
13
|
references?: {
|
|
12
14
|
path: string;
|
|
13
15
|
}[];
|
|
14
|
-
}
|
|
16
|
+
} //#endregion
|
|
17
|
+
//#region src/tsconfig/utils.d.ts
|
|
15
18
|
/**
|
|
16
19
|
* Defines a TSConfig structure.
|
|
17
20
|
* @param tsconfig - The contents of `tsconfig.json` as an object. See {@link TSConfig}.
|
|
18
21
|
* @returns the same `tsconfig.json` object.
|
|
19
22
|
*/
|
|
20
|
-
export { TSConfig
|
|
23
|
+
export type { TSConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
var dist_exports = /* @__PURE__ */ __exportAll({ default: () => alias });
|
|
4
4
|
function matches(pattern, importee) {
|
|
@@ -59,4 +59,4 @@ function alias(options = {}) {
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
export {
|
|
62
|
+
export { alias, dist_exports };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
2
|
+
import { MagicString, attachScopes, createFilter, makeLegalIdentifier, walk } from "../_build/common.mjs";
|
|
2
3
|
import { sep } from "path";
|
|
4
|
+
var es_exports = /* @__PURE__ */ __exportAll({ default: () => inject });
|
|
3
5
|
var escape = function(str) {
|
|
4
6
|
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
5
7
|
};
|
|
@@ -126,4 +128,4 @@ function inject(options) {
|
|
|
126
128
|
}
|
|
127
129
|
};
|
|
128
130
|
}
|
|
129
|
-
export { inject
|
|
131
|
+
export { es_exports, inject };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createFilter, dataToEsm } from "../_build/common.mjs";
|
|
2
2
|
function json(options) {
|
|
3
3
|
if (options === void 0) options = {};
|
|
4
4
|
var filter = createFilter(options.include, options.exclude);
|
|
@@ -29,4 +29,4 @@ function json(options) {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
export { json
|
|
32
|
+
export { json };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
2
|
+
import { MagicString, stripLiteral } from "../_build/common.mjs";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import "node:assert";
|
|
6
7
|
import { createHash } from "node:crypto";
|
|
7
|
-
import { isCSSRequest, normalizePath } from "vite";
|
|
8
8
|
import assert$1 from "node:assert/strict";
|
|
9
9
|
function exactRegex(str, flags) {
|
|
10
10
|
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
|
@@ -81,6 +81,13 @@ function slash(p) {
|
|
|
81
81
|
return p.replace(windowsSlashRE, "/");
|
|
82
82
|
}
|
|
83
83
|
const isWindows = typeof process !== "undefined" && process.platform === "win32";
|
|
84
|
+
function normalizePath(id) {
|
|
85
|
+
return path.posix.normalize(isWindows ? slash(id) : id);
|
|
86
|
+
}
|
|
87
|
+
const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
|
88
|
+
function isCSSRequest(request) {
|
|
89
|
+
return CSS_LANGS_RE.test(request);
|
|
90
|
+
}
|
|
84
91
|
function injectQuery(url, queryToInject) {
|
|
85
92
|
const { file, postfix } = splitFileAndPostfix(url);
|
|
86
93
|
return `${isWindows ? slash(file) : file}?${queryToInject}${postfix[0] === "?" ? `&${postfix.slice(1)}` : postfix}`;
|
|
@@ -272,7 +279,7 @@ function assetsPlugin(pluginOpts) {
|
|
|
272
279
|
load: {
|
|
273
280
|
filter: { id: /^\0virtual:fullstack\// },
|
|
274
281
|
async handler(id) {
|
|
275
|
-
if (id === "\0virtual:fullstack/runtime") return `export const mergeAssets = ${(await
|
|
282
|
+
if (id === "\0virtual:fullstack/runtime") return `export const mergeAssets = ${(await Promise.resolve().then(() => runtime_exports)).mergeAssets.toString()};`;
|
|
276
283
|
const parsed = parseAssetsVirtual(id);
|
|
277
284
|
if (!parsed) return;
|
|
278
285
|
assert$1.notEqual(this.environment.name, "client");
|
|
@@ -490,7 +497,12 @@ function collectAssetDepsInner(fileName, bundle) {
|
|
|
490
497
|
};
|
|
491
498
|
}
|
|
492
499
|
function patchViteClientPlugin() {
|
|
493
|
-
|
|
500
|
+
let viteClientPath;
|
|
501
|
+
try {
|
|
502
|
+
viteClientPath = normalizePath(fileURLToPath(import.meta.resolve("vite/dist/client/client.mjs")));
|
|
503
|
+
} catch {
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
494
506
|
function endIndexOf(code, searchValue) {
|
|
495
507
|
const i = code.lastIndexOf(searchValue);
|
|
496
508
|
return i === -1 ? i : i + searchValue.length;
|
|
@@ -595,6 +607,7 @@ function assetsURL(url, config) {
|
|
|
595
607
|
function assetsURLDev(url, config) {
|
|
596
608
|
return config.base + url;
|
|
597
609
|
}
|
|
610
|
+
var runtime_exports = /* @__PURE__ */ __exportAll({ mergeAssets: () => mergeAssets });
|
|
598
611
|
function mergeAssets(...args) {
|
|
599
612
|
const js = uniqBy(args.flatMap((h) => h.js), (a) => a.href);
|
|
600
613
|
const css = uniqBy(args.flatMap((h) => h.css), (a) => a.href);
|
|
@@ -617,4 +630,4 @@ function mergeAssets(...args) {
|
|
|
617
630
|
});
|
|
618
631
|
}
|
|
619
632
|
}
|
|
620
|
-
export { assetsPlugin
|
|
633
|
+
export { assetsPlugin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_common.mjs";
|
|
2
2
|
import { stat, unwatchFile, watch, watchFile } from "node:fs";
|
|
3
3
|
import { lstat, open, readdir, realpath, stat as stat$1 } from "node:fs/promises";
|
|
4
4
|
import { type } from "node:os";
|
|
@@ -1338,7 +1338,8 @@ var FSWatcher = class extends EventEmitter {
|
|
|
1338
1338
|
if (!this._userIgnored) {
|
|
1339
1339
|
const { cwd } = this.options;
|
|
1340
1340
|
const ignored = (this.options.ignored || []).map(normalizeIgnored(cwd));
|
|
1341
|
-
|
|
1341
|
+
const list = [...[...this._ignoredPaths].map(normalizeIgnored(cwd)), ...ignored];
|
|
1342
|
+
this._userIgnored = anymatch(list, void 0);
|
|
1342
1343
|
}
|
|
1343
1344
|
return this._userIgnored(path, stats);
|
|
1344
1345
|
}
|
|
@@ -1430,4 +1431,4 @@ var chokidar_default = {
|
|
|
1430
1431
|
watch: watch$1,
|
|
1431
1432
|
FSWatcher
|
|
1432
1433
|
};
|
|
1433
|
-
export { watch$1 as
|
|
1434
|
+
export { chokidar_exports, watch$1 as watch };
|
package/dist/_libs/remapping.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GenMapping, TraceMap, decodedMappings, maybeAddSegment, setIgnore, setSourceContent, toDecodedMap, toEncodedMap, traceSegment } from "./resolve-uri+gen-mapping.mjs";
|
|
2
2
|
var SOURCELESS_MAPPING = /* @__PURE__ */ SegmentObject("", -1, -1, "", null, false);
|
|
3
3
|
var EMPTY_SOURCES = [];
|
|
4
4
|
function SegmentObject(source, line, column, name, content, ignore) {
|
|
@@ -110,4 +110,4 @@ function remapping(input, loader, options) {
|
|
|
110
110
|
};
|
|
111
111
|
return new SourceMap(traceMappings(buildSourceMapTree(input, loader)), opts);
|
|
112
112
|
}
|
|
113
|
-
export { remapping
|
|
113
|
+
export { remapping };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decode, encode } from "../_build/common.mjs";
|
|
2
2
|
const schemeRegex = /^[\w+.-]+:\/\//;
|
|
3
3
|
const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
4
4
|
const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
@@ -358,8 +358,6 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
|
|
|
358
358
|
if (skipable && skipSourceless(line, index)) return;
|
|
359
359
|
return insert(line, index, [genColumn]);
|
|
360
360
|
}
|
|
361
|
-
assert(sourceLine);
|
|
362
|
-
assert(sourceColumn);
|
|
363
361
|
const sourcesIndex = put(sources, source);
|
|
364
362
|
const namesIndex = name ? put(names, name) : NO_NAME;
|
|
365
363
|
if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
|
|
@@ -377,7 +375,6 @@ function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLin
|
|
|
377
375
|
sourceColumn
|
|
378
376
|
]);
|
|
379
377
|
}
|
|
380
|
-
function assert(_val) {}
|
|
381
378
|
function getIndex(arr, index) {
|
|
382
379
|
for (let i = arr.length; i <= index; i++) arr[i] = [];
|
|
383
380
|
return arr[index];
|
|
@@ -407,4 +404,4 @@ function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIn
|
|
|
407
404
|
if (prev.length === 1) return false;
|
|
408
405
|
return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);
|
|
409
406
|
}
|
|
410
|
-
export {
|
|
407
|
+
export { GenMapping, TraceMap, decodedMappings, maybeAddSegment, setIgnore, setSourceContent, toDecodedMap, toEncodedMap, traceSegment };
|
package/dist/_libs/rou3.d.mts
CHANGED
package/dist/_libs/rou3.mjs
CHANGED
|
@@ -464,4 +464,4 @@ function serializeData(ctx, value) {
|
|
|
464
464
|
}
|
|
465
465
|
return `$${index}`;
|
|
466
466
|
}
|
|
467
|
-
export {
|
|
467
|
+
export { addRoute, compileRouterToString, createRouter, findAllRoutes, findRoute };
|
package/dist/_libs/std-env.d.mts
CHANGED
package/dist/_libs/tsconfck.mjs
CHANGED
package/dist/_libs/ultrahtml.mjs
CHANGED
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { __exportAll, __toESM } from "../_common.mjs";
|
|
2
|
+
import { MagicString, createUnimport, getMagicString, importModule, isAbsolute as isAbsolute$2, isPackageExists, join as join$1, parse as parse$1, require_picomatch, resolve as resolve$1 } from "../_build/common.mjs";
|
|
3
|
+
import { walk } from "./estree-walker.mjs";
|
|
4
|
+
import { remapping } from "./remapping.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import fs, { promises } from "node:fs";
|
|
7
7
|
import path, { basename, dirname, extname, isAbsolute, normalize, resolve } from "node:path";
|
|
8
8
|
import process$1 from "node:process";
|
|
9
9
|
import { Buffer } from "node:buffer";
|
|
10
10
|
import * as querystring from "node:querystring";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
function createEstreeDetector(parse) {
|
|
12
|
+
return async (code, ctx, options) => {
|
|
13
|
+
const s = getMagicString(code);
|
|
14
|
+
const map = await ctx.getImportMap();
|
|
15
|
+
let matchedImports = [];
|
|
16
|
+
const enableAutoImport = options?.autoImport !== false;
|
|
17
|
+
const enableTransformVirtualImports = options?.transformVirtualImports !== false && ctx.options.virtualImports?.length;
|
|
18
|
+
if (enableAutoImport || enableTransformVirtualImports) {
|
|
19
|
+
const ast = parse(s.original);
|
|
20
|
+
const virtualImports = createVirtualImports(map, ctx.options.virtualImports);
|
|
21
|
+
const scopes = traveseScopes(ast, enableTransformVirtualImports ? virtualImports.walk : {});
|
|
22
|
+
if (enableAutoImport) {
|
|
23
|
+
const identifiers = scopes.unmatched;
|
|
24
|
+
matchedImports.push(...Array.from(identifiers).map((name) => {
|
|
25
|
+
const item = map.get(name);
|
|
26
|
+
if (item && !item.disabled) return item;
|
|
27
|
+
return null;
|
|
28
|
+
}).filter(Boolean));
|
|
29
|
+
for (const addon of ctx.addons) matchedImports = await addon.matchImports?.call(ctx, identifiers, matchedImports) || matchedImports;
|
|
30
|
+
}
|
|
31
|
+
virtualImports.ranges.forEach(([start, end]) => {
|
|
32
|
+
s.remove(start, end);
|
|
33
|
+
});
|
|
34
|
+
matchedImports.push(...virtualImports.imports);
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
s
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
strippedCode: code.toString(),
|
|
42
|
-
matchedImports,
|
|
43
|
-
isCJSContext: false,
|
|
44
|
-
firstOccurrence: 0
|
|
36
|
+
return {
|
|
37
|
+
s,
|
|
38
|
+
strippedCode: code.toString(),
|
|
39
|
+
matchedImports,
|
|
40
|
+
isCJSContext: false,
|
|
41
|
+
firstOccurrence: 0
|
|
42
|
+
};
|
|
45
43
|
};
|
|
46
44
|
}
|
|
47
45
|
function traveseScopes(ast, additionalWalk) {
|
|
@@ -164,7 +162,7 @@ function traveseScopes(ast, additionalWalk) {
|
|
|
164
162
|
scopes
|
|
165
163
|
};
|
|
166
164
|
}
|
|
167
|
-
function
|
|
165
|
+
function createVirtualImports(importMap, virtualImports = []) {
|
|
168
166
|
const imports = [];
|
|
169
167
|
const ranges = [];
|
|
170
168
|
return {
|
|
@@ -190,6 +188,25 @@ function createVirtualImportsAcronWalker(importMap, virtualImports = []) {
|
|
|
190
188
|
} }
|
|
191
189
|
};
|
|
192
190
|
}
|
|
191
|
+
var detect_acorn_exports = /* @__PURE__ */ __exportAll({ detectImportsAcorn: () => detectImportsAcorn });
|
|
192
|
+
const detectImportsAcorn = createEstreeDetector((code) => parse$1(code, {
|
|
193
|
+
sourceType: "module",
|
|
194
|
+
ecmaVersion: "latest",
|
|
195
|
+
locations: true
|
|
196
|
+
}));
|
|
197
|
+
var detect_oxc_exports = /* @__PURE__ */ __exportAll({ detectImportsOxc: () => detectImportsOxc });
|
|
198
|
+
let detectorPromise;
|
|
199
|
+
async function loadDetector() {
|
|
200
|
+
let parseSync;
|
|
201
|
+
if (isPackageExists("rolldown")) parseSync = (await importModule("rolldown/utils")).parseSync;
|
|
202
|
+
else if (isPackageExists("oxc-parser")) parseSync = (await importModule("oxc-parser")).parseSync;
|
|
203
|
+
else throw new Error("[unimport] the `oxc` parser requires either `rolldown` or `oxc-parser` to be installed.");
|
|
204
|
+
return createEstreeDetector((code) => parseSync("", code, { sourceType: "module" }).program);
|
|
205
|
+
}
|
|
206
|
+
async function detectImportsOxc(code, ctx, options) {
|
|
207
|
+
detectorPromise ??= loadDetector();
|
|
208
|
+
return (await detectorPromise)(code, ctx, options);
|
|
209
|
+
}
|
|
193
210
|
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch(), 1);
|
|
194
211
|
function toArray$2(array) {
|
|
195
212
|
array = array || [];
|
|
@@ -1602,6 +1619,11 @@ function createFilter(include, exclude, options) {
|
|
|
1602
1619
|
return !includeMatchers.length;
|
|
1603
1620
|
};
|
|
1604
1621
|
}
|
|
1622
|
+
var unplugin_exports = /* @__PURE__ */ __exportAll({
|
|
1623
|
+
default: () => unplugin,
|
|
1624
|
+
defaultExcludes: () => defaultExcludes,
|
|
1625
|
+
defaultIncludes: () => defaultIncludes
|
|
1626
|
+
});
|
|
1605
1627
|
const defaultIncludes = [
|
|
1606
1628
|
/\.[jt]sx?$/,
|
|
1607
1629
|
/\.vue$/,
|
|
@@ -1638,4 +1660,4 @@ const unplugin = createUnplugin((options = {}) => {
|
|
|
1638
1660
|
}
|
|
1639
1661
|
};
|
|
1640
1662
|
});
|
|
1641
|
-
export {
|
|
1663
|
+
export { detect_acorn_exports, detect_oxc_exports, unplugin_exports };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MagicString } from "./magic-string.mjs";
|
|
2
|
+
import { ESMExport } from "./mlly.mjs";
|
|
3
3
|
//#region src/filter.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* A valid `picomatch` glob pattern, or array of patterns.
|
|
@@ -367,7 +367,7 @@ interface InjectImportsOptions {
|
|
|
367
367
|
*
|
|
368
368
|
* @default 'regex'
|
|
369
369
|
*/
|
|
370
|
-
parser?: 'acorn' | 'regex';
|
|
370
|
+
parser?: 'acorn' | 'oxc' | 'regex';
|
|
371
371
|
/**
|
|
372
372
|
* Inject the imports at the end of other imports
|
|
373
373
|
*
|
|
@@ -413,4 +413,4 @@ interface UnimportPluginOptions extends UnimportOptions {
|
|
|
413
413
|
*/
|
|
414
414
|
autoImport?: boolean;
|
|
415
415
|
}
|
|
416
|
-
export {
|
|
416
|
+
export { Unimport, type UnimportPluginOptions };
|
package/dist/_libs/unwasm.d.mts
CHANGED