nitro-nightly 3.0.1-alpha.1 → 3.0.1-alpha.2
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/README.md +2 -0
- package/dist/_build/common.mjs +24924 -52
- package/dist/_build/rolldown.mjs +29 -63
- package/dist/_build/rollup.mjs +22 -110
- package/dist/_build/vite.build.mjs +3 -43
- package/dist/{_dev.mjs → _chunks/dev.mjs} +45 -43
- package/dist/_chunks/{B-D1JOIz.mjs → nitro.mjs} +144 -308
- package/dist/_chunks/nitro2.mjs +101 -0
- package/dist/_chunks/utils.mjs +254 -0
- package/dist/{_chunks/Bqks5huO.mjs → _common.mjs} +24 -10
- package/dist/_libs/c12+giget+readdirp+chokidar.d.mts +214 -0
- package/dist/_libs/citty.mjs +140 -110
- package/dist/_libs/{plugin-commonjs.mjs → commondir+is-reference.mjs} +59 -250
- package/dist/_libs/compatx.d.mts +47 -0
- package/dist/_libs/confbox.mjs +388 -799
- package/dist/_libs/esbuild.d.mts +20 -0
- package/dist/_libs/estree-walker.mjs +1 -144
- package/dist/_libs/{plugin-node-resolve.mjs → hasown+resolve+deepmerge.mjs} +497 -78
- package/dist/_libs/httpxy.d.mts +79 -0
- package/dist/_libs/httpxy.mjs +6 -1
- package/dist/_libs/magic-string.d.mts +220 -0
- package/dist/_libs/mlly.d.mts +57 -0
- package/dist/_libs/nypm+giget+tinyexec.mjs +3603 -0
- package/dist/_libs/pkg-types.d.mts +23 -0
- package/dist/_libs/plugin-alias.mjs +4 -2
- package/dist/_libs/plugin-inject.mjs +5 -5
- package/dist/_libs/plugin-json.mjs +2 -2
- package/dist/_libs/pluginutils+plugin-commonjs.d.mts +241 -0
- package/dist/_libs/{vite-plugin-fullstack.mjs → pluginutils.mjs} +244 -153
- package/dist/_libs/rc9+c12+dotenv.mjs +972 -0
- package/dist/_libs/{chokidar.mjs → readdirp+chokidar.mjs} +237 -187
- package/dist/_libs/remapping.mjs +1 -1
- package/dist/_libs/{gen-mapping.mjs → resolve-uri+gen-mapping.mjs} +2 -166
- package/dist/_libs/rou3.d.mts +43 -0
- package/dist/_libs/rou3.mjs +9 -6
- package/dist/_libs/std-env.d.mts +4 -0
- package/dist/_libs/tsconfck.mjs +3 -3
- package/dist/_libs/{unimport.mjs → unimport+unplugin.mjs} +226 -1961
- package/dist/_libs/unplugin+unimport.d.mts +426 -0
- package/dist/_libs/unwasm.d.mts +29 -0
- package/dist/_presets.mjs +130 -80
- package/dist/builder.d.mts +4 -4
- package/dist/builder.mjs +6 -30
- package/dist/cli/_chunks/build.mjs +1 -1
- package/dist/cli/_chunks/dev.mjs +5 -11
- 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/node_modules/@poppinss/colors/build/index.js +130 -160
- package/dist/node_modules/@poppinss/colors/package.json +20 -18
- package/dist/node_modules/@poppinss/exception/build/index.js +36 -55
- package/dist/node_modules/@poppinss/exception/package.json +19 -16
- package/dist/node_modules/@sindresorhus/is/distribution/index.js +46 -5
- package/dist/node_modules/@sindresorhus/is/package.json +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
- package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
- package/dist/node_modules/@speed-highlight/core/package.json +2 -2
- package/dist/node_modules/hookable/dist/index.mjs +5 -6
- package/dist/node_modules/hookable/package.json +13 -13
- package/dist/node_modules/ufo/dist/index.mjs +16 -9
- package/dist/node_modules/ufo/package.json +15 -14
- package/dist/node_modules/unctx/package.json +16 -16
- package/dist/node_modules/youch/build/{chunk-4XB2BYKC.js → chunk-7QV3D5YX.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-PUHGL6HA.js → chunk-AUGPHE32.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-F4I6KX4R.js → chunk-CM7DWJNZ.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-YYEJ3AGB.js → chunk-EJH674NB.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-EUJBVOYB.js → chunk-OIJ3WD7L.js} +2 -4
- package/dist/node_modules/youch/build/{chunk-HFSXRSKS.js → chunk-P36L72PL.js} +5 -3
- package/dist/node_modules/youch/build/{chunk-4YEN7HVQ.js → chunk-PE3GG3TN.js} +5 -1
- package/dist/node_modules/youch/build/{chunk-PINJDICN.js → chunk-X53OIOJH.js} +2 -4
- package/dist/node_modules/youch/build/index.js +8 -9
- package/dist/node_modules/youch/build/public/error_info/style.css +1 -0
- package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
- package/dist/node_modules/youch/build/public/error_stack/style.css +2 -3
- package/dist/node_modules/youch/package.json +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.d.mts +1 -1
- package/dist/presets/_nitro/runtime/nitro-dev.mjs +5 -6
- package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +1 -1
- package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -1
- package/dist/presets/_nitro/runtime/service-worker.d.mts +1 -1
- package/dist/presets/_nitro/runtime/service-worker.mjs +2 -2
- package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +1 -1
- package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +1 -1
- package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -5
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +9 -11
- package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +1 -1
- package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +1 -1
- package/dist/presets/azure/runtime/azure-swa.d.mts +1 -1
- package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
- package/dist/presets/bun/runtime/bun.d.mts +1 -1
- package/dist/presets/bun/runtime/bun.mjs +7 -8
- package/dist/presets/cloudflare/runtime/_module-handler.d.mts +3 -3
- package/dist/presets/cloudflare/runtime/_module-handler.mjs +19 -17
- package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +17 -16
- package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +8 -9
- package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +1 -1
- package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +12 -18
- package/dist/presets/deno/runtime/deno-deploy.d.mts +1 -1
- package/dist/presets/deno/runtime/deno-deploy.mjs +4 -5
- package/dist/presets/deno/runtime/deno-server.d.mts +1 -1
- package/dist/presets/deno/runtime/deno-server.mjs +5 -6
- package/dist/presets/netlify/runtime/netlify-edge.d.mts +1 -2
- package/dist/presets/netlify/runtime/netlify-edge.mjs +3 -2
- package/dist/presets/netlify/runtime/netlify.d.mts +3 -2
- package/dist/presets/netlify/runtime/netlify.mjs +3 -1
- package/dist/presets/node/runtime/node-cluster.d.mts +1 -1
- package/dist/presets/node/runtime/node-cluster.mjs +5 -6
- package/dist/presets/node/runtime/node-middleware.d.mts +1 -1
- package/dist/presets/node/runtime/node-middleware.mjs +4 -5
- package/dist/presets/node/runtime/node-server.d.mts +1 -1
- package/dist/presets/node/runtime/node-server.mjs +5 -6
- package/dist/presets/standard/runtime/server.d.mts +1 -1
- package/dist/presets/standard/runtime/server.mjs +1 -1
- package/dist/presets/stormkit/runtime/stormkit.d.mts +1 -1
- package/dist/presets/stormkit/runtime/stormkit.mjs +1 -1
- package/dist/presets/vercel/runtime/isr.d.mts +2 -0
- package/dist/presets/vercel/runtime/isr.mjs +19 -0
- package/dist/presets/vercel/runtime/vercel.node.d.mts +1 -1
- package/dist/presets/vercel/runtime/vercel.node.mjs +16 -7
- package/dist/presets/vercel/runtime/vercel.web.d.mts +1 -1
- package/dist/presets/vercel/runtime/vercel.web.mjs +18 -13
- package/dist/presets/winterjs/runtime/winterjs.d.mts +1 -2
- package/dist/presets/winterjs/runtime/winterjs.mjs +1 -1
- package/dist/presets/zeabur/runtime/zeabur.d.mts +1 -1
- package/dist/presets/zeabur/runtime/zeabur.mjs +1 -1
- package/dist/runtime/app.d.mts +1 -1
- package/dist/runtime/app.mjs +1 -1
- package/dist/runtime/internal/app.d.mts +7 -3
- package/dist/runtime/internal/app.mjs +29 -22
- package/dist/runtime/internal/database.mjs +1 -1
- package/dist/runtime/internal/error/dev.d.mts +0 -1
- package/dist/runtime/internal/error/dev.mjs +1 -1
- package/dist/runtime/internal/route-rules.d.mts +0 -4
- package/dist/runtime/internal/routes/dev-tasks.mjs +1 -1
- package/dist/runtime/internal/routes/openapi.d.mts +0 -1
- package/dist/runtime/internal/routes/openapi.mjs +3 -3
- package/dist/runtime/internal/routes/renderer-template.dev.mjs +1 -1
- package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
- package/dist/runtime/internal/routes/scalar.d.mts +0 -1
- package/dist/runtime/internal/routes/scalar.mjs +4 -4
- package/dist/runtime/internal/routes/swagger.d.mts +0 -1
- package/dist/runtime/internal/routes/swagger.mjs +3 -3
- package/dist/runtime/internal/runtime-config.mjs +8 -8
- package/dist/runtime/internal/static.mjs +1 -1
- package/dist/runtime/internal/storage.mjs +1 -1
- package/dist/runtime/internal/task.mjs +1 -1
- package/dist/runtime/internal/vite/dev-entry.mjs +3 -4
- package/dist/runtime/internal/vite/{dev-worker.mjs → node-runner.mjs} +51 -6
- package/dist/runtime/meta.d.mts +1 -1
- package/dist/runtime/meta.mjs +1 -1
- package/dist/runtime/nitro.d.mts +0 -3
- package/dist/runtime/nitro.mjs +1 -1
- package/dist/runtime/virtual/_runtime_warn.d.mts +1 -0
- package/dist/runtime/virtual/_runtime_warn.mjs +5 -0
- package/dist/runtime/virtual/database.d.mts +8 -0
- package/dist/runtime/virtual/database.mjs +2 -0
- package/dist/runtime/virtual/error-handler.d.mts +6 -0
- package/dist/runtime/virtual/error-handler.mjs +9 -0
- package/dist/runtime/virtual/feature-flags.d.mts +7 -0
- package/dist/runtime/virtual/feature-flags.mjs +7 -0
- package/dist/runtime/virtual/plugins.d.mts +3 -0
- package/dist/runtime/virtual/plugins.mjs +2 -0
- package/dist/runtime/virtual/polyfills.d.mts +3 -0
- package/dist/runtime/virtual/polyfills.mjs +2 -0
- package/dist/runtime/virtual/public-assets.d.mts +9 -0
- package/dist/runtime/virtual/public-assets.mjs +8 -0
- package/dist/runtime/virtual/renderer-template.d.mts +4 -0
- package/dist/runtime/virtual/renderer-template.mjs +7 -0
- package/dist/runtime/virtual/routing-meta.d.mts +7 -0
- package/dist/runtime/virtual/routing-meta.mjs +2 -0
- package/dist/runtime/virtual/routing.d.mts +8 -0
- package/dist/runtime/virtual/routing.mjs +11 -0
- package/dist/runtime/virtual/runtime-config.d.mts +3 -0
- package/dist/runtime/virtual/runtime-config.mjs +5 -0
- package/dist/runtime/virtual/server-assets.d.mts +6 -0
- package/dist/runtime/virtual/server-assets.mjs +12 -0
- package/dist/runtime/virtual/storage.d.mts +3 -0
- package/dist/runtime/virtual/storage.mjs +5 -0
- package/dist/runtime/virtual/tasks.d.mts +10 -0
- package/dist/runtime/virtual/tasks.mjs +3 -0
- package/dist/types/index.d.mts +292 -371
- package/dist/types/index.mjs +10 -0
- package/dist/vite.d.mts +7 -12
- package/dist/vite.mjs +734 -41
- package/lib/vite.types.d.mts +26 -0
- package/lib/vite.types.mjs +2 -0
- package/package.json +82 -53
- package/dist/_build/common2.mjs +0 -772
- package/dist/_build/vite.plugin.mjs +0 -768
- package/dist/_chunks/ANM1K1bE.mjs +0 -304
- package/dist/_chunks/BX9-zVkM.mjs +0 -59
- package/dist/_chunks/C7CbzoI1.mjs +0 -39
- package/dist/_libs/acorn.mjs +0 -5034
- package/dist/_libs/c12.mjs +0 -2858
- package/dist/_libs/commondir.mjs +0 -22
- package/dist/_libs/deepmerge.mjs +0 -86
- package/dist/_libs/dot-prop.mjs +0 -138
- package/dist/_libs/duplexer.mjs +0 -71
- package/dist/_libs/etag.mjs +0 -80
- package/dist/_libs/fdir.mjs +0 -514
- package/dist/_libs/function-bind.mjs +0 -63
- package/dist/_libs/giget.mjs +0 -19289
- package/dist/_libs/gzip-size.mjs +0 -21
- package/dist/_libs/hasown.mjs +0 -14
- package/dist/_libs/is-core-module.mjs +0 -220
- package/dist/_libs/is-module.mjs +0 -13
- package/dist/_libs/is-reference.mjs +0 -32
- package/dist/_libs/js-tokens.mjs +0 -382
- package/dist/_libs/knitwork.mjs +0 -124
- package/dist/_libs/local-pkg.mjs +0 -1686
- package/dist/_libs/magic-string.mjs +0 -939
- package/dist/_libs/mime.mjs +0 -1391
- package/dist/_libs/node-fetch-native.mjs +0 -173
- package/dist/_libs/path-parse.mjs +0 -47
- package/dist/_libs/pathe.mjs +0 -41
- package/dist/_libs/picomatch.mjs +0 -1673
- package/dist/_libs/plugin-replace.mjs +0 -104
- package/dist/_libs/pretty-bytes.mjs +0 -116
- package/dist/_libs/std-env.mjs +0 -158
- package/dist/_libs/strip-literal.mjs +0 -51
- package/dist/_libs/tinyglobby.mjs +0 -292
- package/dist/_libs/untyped.mjs +0 -271
- package/dist/_libs/unwasm.mjs +0 -5836
- package/dist/cli/_chunks/detect-acorn.mjs +0 -12
- package/dist/cli/_chunks/dist.mjs +0 -3
- package/dist/cli/_chunks/dist2.mjs +0 -3
- package/dist/cli/_chunks/dist3.mjs +0 -3
- package/dist/cli/_chunks/dist4.mjs +0 -4
- package/dist/cli/_chunks/dist5.mjs +0 -4
- package/dist/cli/_chunks/esm.mjs +0 -3
- package/dist/cli/_chunks/json5.mjs +0 -4
- package/dist/cli/_chunks/jsonc.mjs +0 -4
- package/dist/cli/_chunks/multipart-parser.mjs +0 -6
- package/dist/cli/_chunks/toml.mjs +0 -4
- package/dist/cli/_chunks/yaml.mjs +0 -4
- package/dist/node_modules/kleur/index.js +0 -110
- package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +0 -6
- package/lib/deps/ofetch.mjs +0 -1
- package/lib/deps/ofetch.mts +0 -1
- /package/dist/runtime/{vite-runtime.d.mts → vite.d.mts} +0 -0
- /package/dist/runtime/{vite-runtime.mjs → vite.mjs} +0 -0
- /package/lib/{deps/h3.d.mts → h3.d.mts} +0 -0
- /package/lib/{deps/h3.mjs → h3.mjs} +0 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import { t as MagicString } from "./magic-string.mjs";
|
|
2
|
+
import { t as ESMExport } from "./mlly.mjs";
|
|
3
|
+
import "vite";
|
|
4
|
+
import "rolldown";
|
|
5
|
+
import "rollup";
|
|
6
|
+
import "webpack";
|
|
7
|
+
import "@farmfe/core";
|
|
8
|
+
import "@rspack/core";
|
|
9
|
+
import "unloader";
|
|
10
|
+
|
|
11
|
+
//#region node_modules/.pnpm/unplugin-utils@0.3.1/node_modules/unplugin-utils/dist/index.d.ts
|
|
12
|
+
//#region src/filter.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* A valid `picomatch` glob pattern, or array of patterns.
|
|
15
|
+
*/
|
|
16
|
+
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
17
|
+
/**
|
|
18
|
+
* Constructs a filter function which can be used to determine whether or not
|
|
19
|
+
* certain modules should be operated upon.
|
|
20
|
+
* @param include If `include` is omitted or has zero length, filter will return `true` by default.
|
|
21
|
+
* @param exclude ID must not match any of the `exclude` patterns.
|
|
22
|
+
* @param options Additional options.
|
|
23
|
+
* @param options.resolve Optionally resolves the patterns against a directory other than `process.cwd()`.
|
|
24
|
+
* If a `string` is specified, then the value will be used as the base directory.
|
|
25
|
+
* Relative paths will be resolved against `process.cwd()` first.
|
|
26
|
+
* If `false`, then the patterns will not be resolved against any directory.
|
|
27
|
+
* This can be useful if you want to create a filter for virtual module names.
|
|
28
|
+
*/
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region node_modules/.pnpm/unimport@5.6.0/node_modules/unimport/dist/shared/unimport.C0UbTDPO.d.mts
|
|
31
|
+
declare const builtinPresets: {
|
|
32
|
+
'@vue/composition-api': InlinePreset;
|
|
33
|
+
'@vueuse/core': () => Preset;
|
|
34
|
+
'@vueuse/head': InlinePreset;
|
|
35
|
+
pinia: InlinePreset;
|
|
36
|
+
preact: InlinePreset;
|
|
37
|
+
quasar: InlinePreset;
|
|
38
|
+
react: InlinePreset;
|
|
39
|
+
'react-router': InlinePreset;
|
|
40
|
+
'react-router-dom': InlinePreset;
|
|
41
|
+
svelte: InlinePreset;
|
|
42
|
+
'svelte/animate': InlinePreset;
|
|
43
|
+
'svelte/easing': InlinePreset;
|
|
44
|
+
'svelte/motion': InlinePreset;
|
|
45
|
+
'svelte/store': InlinePreset;
|
|
46
|
+
'svelte/transition': InlinePreset;
|
|
47
|
+
'vee-validate': InlinePreset;
|
|
48
|
+
vitepress: InlinePreset;
|
|
49
|
+
'vue-demi': InlinePreset;
|
|
50
|
+
'vue-i18n': InlinePreset;
|
|
51
|
+
'vue-router': InlinePreset;
|
|
52
|
+
'vue-router-composables': InlinePreset;
|
|
53
|
+
vue: InlinePreset;
|
|
54
|
+
'vue/macros': InlinePreset;
|
|
55
|
+
vuex: InlinePreset;
|
|
56
|
+
vitest: InlinePreset;
|
|
57
|
+
'uni-app': InlinePreset;
|
|
58
|
+
'solid-js': InlinePreset;
|
|
59
|
+
'solid-app-router': InlinePreset;
|
|
60
|
+
rxjs: InlinePreset;
|
|
61
|
+
'date-fns': InlinePreset;
|
|
62
|
+
};
|
|
63
|
+
type BuiltinPresetName = keyof typeof builtinPresets;
|
|
64
|
+
type ModuleId = string;
|
|
65
|
+
type ImportName = string;
|
|
66
|
+
interface ImportCommon {
|
|
67
|
+
/** Module specifier to import from */
|
|
68
|
+
from: ModuleId;
|
|
69
|
+
/**
|
|
70
|
+
* Priority of the import, if multiple imports have the same name, the one with the highest priority will be used
|
|
71
|
+
* @default 1
|
|
72
|
+
*/
|
|
73
|
+
priority?: number;
|
|
74
|
+
/** If this import is disabled */
|
|
75
|
+
disabled?: boolean;
|
|
76
|
+
/** Won't output import in declaration file if true */
|
|
77
|
+
dtsDisabled?: boolean;
|
|
78
|
+
/** Import declaration type like const / var / enum */
|
|
79
|
+
declarationType?: ESMExport['declarationType'];
|
|
80
|
+
/**
|
|
81
|
+
* Metadata of the import
|
|
82
|
+
*/
|
|
83
|
+
meta?: {
|
|
84
|
+
/** Short description of the import */description?: string; /** URL to the documentation */
|
|
85
|
+
docsUrl?: string; /** Additional metadata */
|
|
86
|
+
[key: string]: any;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* If this import is a pure type import
|
|
90
|
+
*/
|
|
91
|
+
type?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Using this as the from when generating type declarations
|
|
94
|
+
*/
|
|
95
|
+
typeFrom?: ModuleId;
|
|
96
|
+
}
|
|
97
|
+
interface Import extends ImportCommon {
|
|
98
|
+
/** Import name to be detected */
|
|
99
|
+
name: ImportName;
|
|
100
|
+
/** Import as this name */
|
|
101
|
+
as?: ImportName;
|
|
102
|
+
/**
|
|
103
|
+
* With properties
|
|
104
|
+
*
|
|
105
|
+
* Ignored for CJS imports.
|
|
106
|
+
*/
|
|
107
|
+
with?: Record<string, string>;
|
|
108
|
+
}
|
|
109
|
+
type PresetImport = Omit<Import, 'from'> | ImportName | [name: ImportName, as?: ImportName, from?: ModuleId];
|
|
110
|
+
interface InlinePreset extends ImportCommon {
|
|
111
|
+
imports: (PresetImport | InlinePreset)[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Auto extract exports from a package for auto import
|
|
115
|
+
*/
|
|
116
|
+
interface PackagePreset {
|
|
117
|
+
/**
|
|
118
|
+
* Name of the package
|
|
119
|
+
*/
|
|
120
|
+
package: string;
|
|
121
|
+
/**
|
|
122
|
+
* Path of the importer
|
|
123
|
+
* @default process.cwd()
|
|
124
|
+
*/
|
|
125
|
+
url?: string;
|
|
126
|
+
/**
|
|
127
|
+
* RegExp, string, or custom function to exclude names of the extracted imports
|
|
128
|
+
*/
|
|
129
|
+
ignore?: (string | RegExp | ((name: string) => boolean))[];
|
|
130
|
+
/**
|
|
131
|
+
* Use local cache if exits
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
134
|
+
cache?: boolean;
|
|
135
|
+
}
|
|
136
|
+
type Preset = InlinePreset | PackagePreset;
|
|
137
|
+
interface UnimportContext {
|
|
138
|
+
readonly version: string;
|
|
139
|
+
options: Partial<UnimportOptions>;
|
|
140
|
+
staticImports: Import[];
|
|
141
|
+
dynamicImports: Import[];
|
|
142
|
+
addons: Addon[];
|
|
143
|
+
getImports: () => Promise<Import[]>;
|
|
144
|
+
getImportMap: () => Promise<Map<string, Import>>;
|
|
145
|
+
getMetadata: () => UnimportMeta | undefined;
|
|
146
|
+
modifyDynamicImports: (fn: (imports: Import[]) => Thenable<void | Import[]>) => Promise<void>;
|
|
147
|
+
clearDynamicImports: () => void;
|
|
148
|
+
replaceImports: (imports: UnimportOptions['imports']) => Promise<Import[]>;
|
|
149
|
+
invalidate: () => void;
|
|
150
|
+
resolveId: (id: string, parentId?: string) => Thenable<string | null | undefined | void>;
|
|
151
|
+
}
|
|
152
|
+
interface DetectImportResult {
|
|
153
|
+
s: MagicString;
|
|
154
|
+
strippedCode: string;
|
|
155
|
+
isCJSContext: boolean;
|
|
156
|
+
matchedImports: Import[];
|
|
157
|
+
firstOccurrence: number;
|
|
158
|
+
}
|
|
159
|
+
interface Unimport {
|
|
160
|
+
readonly version: string;
|
|
161
|
+
init: () => Promise<void>;
|
|
162
|
+
clearDynamicImports: UnimportContext['clearDynamicImports'];
|
|
163
|
+
getImportMap: UnimportContext['getImportMap'];
|
|
164
|
+
getImports: UnimportContext['getImports'];
|
|
165
|
+
getInternalContext: () => UnimportContext;
|
|
166
|
+
getMetadata: UnimportContext['getMetadata'];
|
|
167
|
+
modifyDynamicImports: UnimportContext['modifyDynamicImports'];
|
|
168
|
+
generateTypeDeclarations: (options?: TypeDeclarationOptions) => Promise<string>;
|
|
169
|
+
/**
|
|
170
|
+
* Get un-imported usages from code
|
|
171
|
+
*/
|
|
172
|
+
detectImports: (code: string | MagicString) => Promise<DetectImportResult>;
|
|
173
|
+
/**
|
|
174
|
+
* Insert missing imports statements to code
|
|
175
|
+
*/
|
|
176
|
+
injectImports: (code: string | MagicString, id?: string, options?: InjectImportsOptions) => Promise<ImportInjectionResult>;
|
|
177
|
+
scanImportsFromDir: (dir?: (string | ScanDir)[], options?: ScanDirExportsOptions) => Promise<Import[]>;
|
|
178
|
+
scanImportsFromFile: (file: string, includeTypes?: boolean) => Promise<Import[]>;
|
|
179
|
+
/**
|
|
180
|
+
* @deprecated
|
|
181
|
+
*/
|
|
182
|
+
toExports: (filepath?: string, includeTypes?: boolean) => Promise<string>;
|
|
183
|
+
}
|
|
184
|
+
interface InjectionUsageRecord {
|
|
185
|
+
import: Import;
|
|
186
|
+
count: number;
|
|
187
|
+
moduleIds: string[];
|
|
188
|
+
}
|
|
189
|
+
interface UnimportMeta {
|
|
190
|
+
injectionUsage: Record<string, InjectionUsageRecord>;
|
|
191
|
+
}
|
|
192
|
+
interface AddonsOptions {
|
|
193
|
+
addons?: Addon[];
|
|
194
|
+
/**
|
|
195
|
+
* Enable auto import inside for Vue's <template>
|
|
196
|
+
*
|
|
197
|
+
* @default false
|
|
198
|
+
*/
|
|
199
|
+
vueTemplate?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Enable auto import directives for Vue's SFC.
|
|
202
|
+
*
|
|
203
|
+
* Library authors should include `meta.vueDirective: true` in the import metadata.
|
|
204
|
+
*
|
|
205
|
+
* When using a local directives folder, provide the `isDirective`
|
|
206
|
+
* callback to check if the import is a Vue directive.
|
|
207
|
+
*/
|
|
208
|
+
vueDirectives?: true | AddonVueDirectivesOptions;
|
|
209
|
+
}
|
|
210
|
+
interface AddonVueDirectivesOptions {
|
|
211
|
+
/**
|
|
212
|
+
* Checks if the import is a Vue directive.
|
|
213
|
+
*
|
|
214
|
+
* **NOTES**:
|
|
215
|
+
* - imports from a library should include `meta.vueDirective: true`.
|
|
216
|
+
* - this callback is only invoked for local directives (only when meta.vueDirective is not set).
|
|
217
|
+
*
|
|
218
|
+
* @param from The path of the import normalized.
|
|
219
|
+
* @param importEntry The import entry.
|
|
220
|
+
*/
|
|
221
|
+
isDirective?: (from: string, importEntry: Import) => boolean;
|
|
222
|
+
}
|
|
223
|
+
interface UnimportOptions extends Pick<InjectImportsOptions, 'injectAtEnd' | 'mergeExisting' | 'parser'> {
|
|
224
|
+
/**
|
|
225
|
+
* Auto import items
|
|
226
|
+
*/
|
|
227
|
+
imports: Import[];
|
|
228
|
+
/**
|
|
229
|
+
* Auto import preset
|
|
230
|
+
*/
|
|
231
|
+
presets: (Preset | BuiltinPresetName)[];
|
|
232
|
+
/**
|
|
233
|
+
* Custom warning function
|
|
234
|
+
* @default console.warn
|
|
235
|
+
*/
|
|
236
|
+
warn: (msg: string) => void;
|
|
237
|
+
/**
|
|
238
|
+
* Custom debug log function
|
|
239
|
+
* @default console.log
|
|
240
|
+
*/
|
|
241
|
+
debugLog: (msg: string) => void;
|
|
242
|
+
/**
|
|
243
|
+
* Unimport Addons.
|
|
244
|
+
* To use built-in addons, use:
|
|
245
|
+
* ```js
|
|
246
|
+
* addons: {
|
|
247
|
+
* addons: [<custom-addons-here>] // if you want to use also custom addons
|
|
248
|
+
* vueTemplate: true,
|
|
249
|
+
* vueDirectives: [<the-directives-here>]
|
|
250
|
+
* }
|
|
251
|
+
* ```
|
|
252
|
+
*
|
|
253
|
+
* Built-in addons:
|
|
254
|
+
* - vueDirectives: enable auto import directives for Vue's SFC
|
|
255
|
+
* - vueTemplate: enable auto import inside for Vue's <template>
|
|
256
|
+
*
|
|
257
|
+
* @default {}
|
|
258
|
+
*/
|
|
259
|
+
addons: AddonsOptions | Addon[];
|
|
260
|
+
/**
|
|
261
|
+
* Name of virtual modules that exposed all the registed auto-imports
|
|
262
|
+
* @default []
|
|
263
|
+
*/
|
|
264
|
+
virtualImports: string[];
|
|
265
|
+
/**
|
|
266
|
+
* Directories to scan for auto import
|
|
267
|
+
* @default []
|
|
268
|
+
*/
|
|
269
|
+
dirs?: (string | ScanDir)[];
|
|
270
|
+
/**
|
|
271
|
+
* Options for scanning directories for auto import
|
|
272
|
+
*/
|
|
273
|
+
dirsScanOptions?: ScanDirExportsOptions;
|
|
274
|
+
/**
|
|
275
|
+
* Custom resolver to auto import id
|
|
276
|
+
*/
|
|
277
|
+
resolveId?: (id: string, importee?: string) => Thenable<string | void>;
|
|
278
|
+
/**
|
|
279
|
+
* Custom magic comments to be opt-out for auto import, per file/module
|
|
280
|
+
*
|
|
281
|
+
* @default ['@unimport-disable', '@imports-disable']
|
|
282
|
+
*/
|
|
283
|
+
commentsDisable?: string[];
|
|
284
|
+
/**
|
|
285
|
+
* Custom magic comments to debug auto import, printed to console
|
|
286
|
+
*
|
|
287
|
+
* @default ['@unimport-debug', '@imports-debug']
|
|
288
|
+
*/
|
|
289
|
+
commentsDebug?: string[];
|
|
290
|
+
/**
|
|
291
|
+
* Collect meta data for each auto import. Accessible via `ctx.meta`
|
|
292
|
+
*/
|
|
293
|
+
collectMeta?: boolean;
|
|
294
|
+
}
|
|
295
|
+
type PathFromResolver = (_import: Import) => string | undefined;
|
|
296
|
+
interface ScanDirExportsOptions {
|
|
297
|
+
/**
|
|
298
|
+
* Glob patterns for matching files
|
|
299
|
+
*
|
|
300
|
+
* @default ['*.{ts,js,mjs,cjs,mts,cts,tsx,jsx}']
|
|
301
|
+
*/
|
|
302
|
+
filePatterns?: string[];
|
|
303
|
+
/**
|
|
304
|
+
* Custom function to filter scanned files
|
|
305
|
+
*/
|
|
306
|
+
fileFilter?: (file: string) => boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Register type exports
|
|
309
|
+
*
|
|
310
|
+
* @default true
|
|
311
|
+
*/
|
|
312
|
+
types?: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Current working directory
|
|
315
|
+
*
|
|
316
|
+
* @default process.cwd()
|
|
317
|
+
*/
|
|
318
|
+
cwd?: string;
|
|
319
|
+
}
|
|
320
|
+
interface ScanDir {
|
|
321
|
+
/**
|
|
322
|
+
* Path pattern of the directory
|
|
323
|
+
*/
|
|
324
|
+
glob: string;
|
|
325
|
+
/**
|
|
326
|
+
* Register type exports
|
|
327
|
+
*
|
|
328
|
+
* @default true
|
|
329
|
+
*/
|
|
330
|
+
types?: boolean;
|
|
331
|
+
}
|
|
332
|
+
interface TypeDeclarationOptions {
|
|
333
|
+
/**
|
|
334
|
+
* Custom resolver for path of the import
|
|
335
|
+
*/
|
|
336
|
+
resolvePath?: PathFromResolver;
|
|
337
|
+
/**
|
|
338
|
+
* Append `export {}` to the end of the file
|
|
339
|
+
*
|
|
340
|
+
* @default true
|
|
341
|
+
*/
|
|
342
|
+
exportHelper?: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Auto-import for type exports
|
|
345
|
+
*
|
|
346
|
+
* @default true
|
|
347
|
+
*/
|
|
348
|
+
typeReExports?: boolean;
|
|
349
|
+
}
|
|
350
|
+
interface InjectImportsOptions {
|
|
351
|
+
/**
|
|
352
|
+
* Merge the existing imports
|
|
353
|
+
*
|
|
354
|
+
* @default false
|
|
355
|
+
*/
|
|
356
|
+
mergeExisting?: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* If the module should be auto imported
|
|
359
|
+
*
|
|
360
|
+
* @default true
|
|
361
|
+
*/
|
|
362
|
+
autoImport?: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* If the module should be transformed for virtual modules.
|
|
365
|
+
* Only available when `virtualImports` is set.
|
|
366
|
+
*
|
|
367
|
+
* @default true
|
|
368
|
+
*/
|
|
369
|
+
transformVirtualImports?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Parser to use for parsing the code
|
|
372
|
+
*
|
|
373
|
+
* Note that `acorn` only takes valid JS Code, should usually only be used after transformationa and transpilation
|
|
374
|
+
*
|
|
375
|
+
* @default 'regex'
|
|
376
|
+
*/
|
|
377
|
+
parser?: 'acorn' | 'regex';
|
|
378
|
+
/**
|
|
379
|
+
* Inject the imports at the end of other imports
|
|
380
|
+
*
|
|
381
|
+
* @default false
|
|
382
|
+
*/
|
|
383
|
+
injectAtEnd?: boolean;
|
|
384
|
+
}
|
|
385
|
+
type Thenable<T> = Promise<T> | T;
|
|
386
|
+
interface Addon {
|
|
387
|
+
name?: string;
|
|
388
|
+
transform?: (this: UnimportContext, code: MagicString, id: string | undefined) => Thenable<MagicString>;
|
|
389
|
+
declaration?: (this: UnimportContext, dts: string, options: TypeDeclarationOptions) => Thenable<string>;
|
|
390
|
+
matchImports?: (this: UnimportContext, identifiers: Set<string>, matched: Import[]) => Thenable<Import[] | void>;
|
|
391
|
+
/**
|
|
392
|
+
* Extend or modify the imports list before injecting
|
|
393
|
+
*/
|
|
394
|
+
extendImports?: (this: UnimportContext, imports: Import[]) => Import[] | void;
|
|
395
|
+
/**
|
|
396
|
+
* Resolve imports before injecting
|
|
397
|
+
*/
|
|
398
|
+
injectImportsResolved?: (this: UnimportContext, imports: Import[], code: MagicString, id?: string) => Import[] | void;
|
|
399
|
+
/**
|
|
400
|
+
* Modify the injection code before injecting
|
|
401
|
+
*/
|
|
402
|
+
injectImportsStringified?: (this: UnimportContext, injection: string, imports: Import[], code: MagicString, id?: string) => string | void;
|
|
403
|
+
}
|
|
404
|
+
interface MagicStringResult {
|
|
405
|
+
s: MagicString;
|
|
406
|
+
code: string;
|
|
407
|
+
}
|
|
408
|
+
interface ImportInjectionResult extends MagicStringResult {
|
|
409
|
+
imports: Import[];
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region node_modules/.pnpm/unimport@5.6.0/node_modules/unimport/dist/unplugin.d.mts
|
|
413
|
+
interface UnimportPluginOptions extends UnimportOptions {
|
|
414
|
+
include: FilterPattern;
|
|
415
|
+
exclude: FilterPattern;
|
|
416
|
+
dts: boolean | string;
|
|
417
|
+
/**
|
|
418
|
+
* Enable implicit auto import.
|
|
419
|
+
* Generate global TypeScript definitions.
|
|
420
|
+
*
|
|
421
|
+
* @default true
|
|
422
|
+
*/
|
|
423
|
+
autoImport?: boolean;
|
|
424
|
+
}
|
|
425
|
+
//#endregion
|
|
426
|
+
export { type Unimport as n, type UnimportPluginOptions as t };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Plugin } from "rollup";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/unwasm@0.5.3/node_modules/unwasm/dist/plugin/index.d.mts
|
|
4
|
+
//#region src/plugin/shared.d.ts
|
|
5
|
+
interface UnwasmPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Directly import the `.wasm` files instead of bundling as base64 string.
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
esmImport?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Avoid using top level await and always use a proxy.
|
|
14
|
+
*
|
|
15
|
+
* Useful for compatibility with environments that don't support top level await.
|
|
16
|
+
*
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
lazy?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Suppress all warnings from the plugin.
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
silent?: boolean;
|
|
26
|
+
} //#endregion
|
|
27
|
+
//#region src/plugin/index.d.ts
|
|
28
|
+
//#endregion
|
|
29
|
+
export { UnwasmPluginOptions as t };
|