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,23 @@
|
|
|
1
|
+
import { CompilerOptions, TypeAcquisition } from "typescript";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.d.mts
|
|
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 };
|
|
5
|
+
interface TSConfig {
|
|
6
|
+
compilerOptions?: StripEnums<CompilerOptions>;
|
|
7
|
+
exclude?: string[];
|
|
8
|
+
compileOnSave?: boolean;
|
|
9
|
+
extends?: string | string[];
|
|
10
|
+
files?: string[];
|
|
11
|
+
include?: string[];
|
|
12
|
+
typeAcquisition?: TypeAcquisition;
|
|
13
|
+
references?: {
|
|
14
|
+
path: string;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Defines a TSConfig structure.
|
|
19
|
+
* @param tsconfig - The contents of `tsconfig.json` as an object. See {@link TSConfig}.
|
|
20
|
+
* @returns the same `tsconfig.json` object.
|
|
21
|
+
*/
|
|
22
|
+
//#endregion
|
|
23
|
+
export { TSConfig as t };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { n as __exportAll } from "../_common.mjs";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
|
|
3
|
-
//#region node_modules/.pnpm/@rollup+plugin-alias@6.0.0_rollup@4.
|
|
4
|
+
//#region node_modules/.pnpm/@rollup+plugin-alias@6.0.0_rollup@4.55.3/node_modules/@rollup/plugin-alias/dist/index.js
|
|
5
|
+
var dist_exports = /* @__PURE__ */ __exportAll({ default: () => alias });
|
|
4
6
|
function matches(pattern, importee) {
|
|
5
7
|
if (pattern instanceof RegExp) return pattern.test(importee);
|
|
6
8
|
if (importee.length < pattern.length) return false;
|
|
@@ -61,4 +63,4 @@ function alias(options = {}) {
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
//#endregion
|
|
64
|
-
export { alias as t };
|
|
66
|
+
export { dist_exports as n, alias as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as makeLegalIdentifier, n as attachScopes, r as createFilter } from "./plugin-commonjs.mjs";
|
|
1
|
+
import { n as __exportAll } from "../_common.mjs";
|
|
2
|
+
import { S as MagicString, c as walk, i as createFilter, r as attachScopes, s as makeLegalIdentifier } from "../_build/common.mjs";
|
|
4
3
|
import { sep } from "path";
|
|
5
4
|
|
|
6
|
-
//#region node_modules/.pnpm/@rollup+plugin-inject@5.0.5_rollup@4.
|
|
5
|
+
//#region node_modules/.pnpm/@rollup+plugin-inject@5.0.5_rollup@4.55.3/node_modules/@rollup/plugin-inject/dist/es/index.js
|
|
6
|
+
var es_exports = /* @__PURE__ */ __exportAll({ default: () => inject });
|
|
7
7
|
var escape = function(str) {
|
|
8
8
|
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
9
9
|
};
|
|
@@ -132,4 +132,4 @@ function inject(options) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
//#endregion
|
|
135
|
-
export { inject as t };
|
|
135
|
+
export { inject as n, es_exports as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as dataToEsm, i as createFilter } from "../_build/common.mjs";
|
|
2
2
|
|
|
3
|
-
//#region node_modules/.pnpm/@rollup+plugin-json@6.1.0_rollup@4.
|
|
3
|
+
//#region node_modules/.pnpm/@rollup+plugin-json@6.1.0_rollup@4.55.3/node_modules/@rollup/plugin-json/dist/es/index.js
|
|
4
4
|
function json(options) {
|
|
5
5
|
if (options === void 0) options = {};
|
|
6
6
|
var filter = createFilter(options.include, options.exclude);
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Plugin } from "rollup";
|
|
2
|
+
|
|
3
|
+
//#region node_modules/.pnpm/@rollup+pluginutils@5.3.0_rollup@4.55.3/node_modules/@rollup/pluginutils/types/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A valid `picomatch` glob pattern, or array of patterns.
|
|
6
|
+
*/
|
|
7
|
+
type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region node_modules/.pnpm/@rollup+plugin-commonjs@29.0.0_rollup@4.55.3/node_modules/@rollup/plugin-commonjs/types/index.d.ts
|
|
10
|
+
type RequireReturnsDefaultOption = boolean | 'auto' | 'preferred' | 'namespace';
|
|
11
|
+
type DefaultIsModuleExportsOption = boolean | 'auto';
|
|
12
|
+
interface RollupCommonJSOptions {
|
|
13
|
+
/**
|
|
14
|
+
* A picomatch pattern, or array of patterns, which specifies the files in
|
|
15
|
+
* the build the plugin should operate on. By default, all files with
|
|
16
|
+
* extension `".cjs"` or those in `extensions` are included, but you can
|
|
17
|
+
* narrow this list by only including specific files. These files will be
|
|
18
|
+
* analyzed and transpiled if either the analysis does not find ES module
|
|
19
|
+
* specific statements or `transformMixedEsModules` is `true`.
|
|
20
|
+
* @default undefined
|
|
21
|
+
*/
|
|
22
|
+
include?: FilterPattern;
|
|
23
|
+
/**
|
|
24
|
+
* A picomatch pattern, or array of patterns, which specifies the files in
|
|
25
|
+
* the build the plugin should _ignore_. By default, all files with
|
|
26
|
+
* extensions other than those in `extensions` or `".cjs"` are ignored, but you
|
|
27
|
+
* can exclude additional files. See also the `include` option.
|
|
28
|
+
* @default undefined
|
|
29
|
+
*/
|
|
30
|
+
exclude?: FilterPattern;
|
|
31
|
+
/**
|
|
32
|
+
* For extensionless imports, search for extensions other than .js in the
|
|
33
|
+
* order specified. Note that you need to make sure that non-JavaScript files
|
|
34
|
+
* are transpiled by another plugin first.
|
|
35
|
+
* @default [ '.js' ]
|
|
36
|
+
*/
|
|
37
|
+
extensions?: ReadonlyArray<string>;
|
|
38
|
+
/**
|
|
39
|
+
* If true then uses of `global` won't be dealt with by this plugin
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
ignoreGlobal?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If false, skips source map generation for CommonJS modules. This will
|
|
45
|
+
* improve performance.
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
sourceMap?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Some `require` calls cannot be resolved statically to be translated to
|
|
51
|
+
* imports.
|
|
52
|
+
* When this option is set to `false`, the generated code will either
|
|
53
|
+
* directly throw an error when such a call is encountered or, when
|
|
54
|
+
* `dynamicRequireTargets` is used, when such a call cannot be resolved with a
|
|
55
|
+
* configured dynamic require target.
|
|
56
|
+
* Setting this option to `true` will instead leave the `require` call in the
|
|
57
|
+
* code or use it as a fallback for `dynamicRequireTargets`.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
ignoreDynamicRequires?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Instructs the plugin whether to enable mixed module transformations. This
|
|
63
|
+
* is useful in scenarios with modules that contain a mix of ES `import`
|
|
64
|
+
* statements and CommonJS `require` expressions. Set to `true` if `require`
|
|
65
|
+
* calls should be transformed to imports in mixed modules, or `false` if the
|
|
66
|
+
* `require` expressions should survive the transformation. The latter can be
|
|
67
|
+
* important if the code contains environment detection, or you are coding
|
|
68
|
+
* for an environment with special treatment for `require` calls such as
|
|
69
|
+
* ElectronJS. See also the `ignore` option.
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
transformMixedEsModules?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* By default, this plugin will try to hoist `require` statements as imports
|
|
75
|
+
* to the top of each file. While this works well for many code bases and
|
|
76
|
+
* allows for very efficient ESM output, it does not perfectly capture
|
|
77
|
+
* CommonJS semantics as the order of side effects like log statements may
|
|
78
|
+
* change. But it is especially problematic when there are circular `require`
|
|
79
|
+
* calls between CommonJS modules as those often rely on the lazy execution of
|
|
80
|
+
* nested `require` calls.
|
|
81
|
+
*
|
|
82
|
+
* Setting this option to `true` will wrap all CommonJS files in functions
|
|
83
|
+
* which are executed when they are required for the first time, preserving
|
|
84
|
+
* NodeJS semantics. Note that this can have an impact on the size and
|
|
85
|
+
* performance of the generated code.
|
|
86
|
+
*
|
|
87
|
+
* The default value of `"auto"` will only wrap CommonJS files when they are
|
|
88
|
+
* part of a CommonJS dependency cycle, e.g. an index file that is required by
|
|
89
|
+
* many of its dependencies. All other CommonJS files are hoisted. This is the
|
|
90
|
+
* recommended setting for most code bases.
|
|
91
|
+
*
|
|
92
|
+
* `false` will entirely prevent wrapping and hoist all files. This may still
|
|
93
|
+
* work depending on the nature of cyclic dependencies but will often cause
|
|
94
|
+
* problems.
|
|
95
|
+
*
|
|
96
|
+
* You can also provide a picomatch pattern, or array of patterns, to only
|
|
97
|
+
* specify a subset of files which should be wrapped in functions for proper
|
|
98
|
+
* `require` semantics.
|
|
99
|
+
*
|
|
100
|
+
* `"debug"` works like `"auto"` but after bundling, it will display a warning
|
|
101
|
+
* containing a list of ids that have been wrapped which can be used as
|
|
102
|
+
* picomatch pattern for fine-tuning.
|
|
103
|
+
* @default "auto"
|
|
104
|
+
*/
|
|
105
|
+
strictRequires?: boolean | FilterPattern;
|
|
106
|
+
/**
|
|
107
|
+
* Sometimes you have to leave require statements unconverted. Pass an array
|
|
108
|
+
* containing the IDs or a `id => boolean` function.
|
|
109
|
+
* @default []
|
|
110
|
+
*/
|
|
111
|
+
ignore?: ReadonlyArray<string> | ((id: string) => boolean);
|
|
112
|
+
/**
|
|
113
|
+
* In most cases, where `require` calls are inside a `try-catch` clause,
|
|
114
|
+
* they should be left unconverted as it requires an optional dependency
|
|
115
|
+
* that may or may not be installed beside the rolled up package.
|
|
116
|
+
* Due to the conversion of `require` to a static `import` - the call is
|
|
117
|
+
* hoisted to the top of the file, outside the `try-catch` clause.
|
|
118
|
+
*
|
|
119
|
+
* - `true`: Default. All `require` calls inside a `try` will be left unconverted.
|
|
120
|
+
* - `false`: All `require` calls inside a `try` will be converted as if the
|
|
121
|
+
* `try-catch` clause is not there.
|
|
122
|
+
* - `remove`: Remove all `require` calls from inside any `try` block.
|
|
123
|
+
* - `string[]`: Pass an array containing the IDs to left unconverted.
|
|
124
|
+
* - `((id: string) => boolean|'remove')`: Pass a function that controls
|
|
125
|
+
* individual IDs.
|
|
126
|
+
*
|
|
127
|
+
* @default true
|
|
128
|
+
*/
|
|
129
|
+
ignoreTryCatch?: boolean | 'remove' | ReadonlyArray<string> | ((id: string) => boolean | 'remove');
|
|
130
|
+
/**
|
|
131
|
+
* Controls how to render imports from external dependencies. By default,
|
|
132
|
+
* this plugin assumes that all external dependencies are CommonJS. This
|
|
133
|
+
* means they are rendered as default imports to be compatible with e.g.
|
|
134
|
+
* NodeJS where ES modules can only import a default export from a CommonJS
|
|
135
|
+
* dependency.
|
|
136
|
+
*
|
|
137
|
+
* If you set `esmExternals` to `true`, this plugin assumes that all
|
|
138
|
+
* external dependencies are ES modules and respect the
|
|
139
|
+
* `requireReturnsDefault` option. If that option is not set, they will be
|
|
140
|
+
* rendered as namespace imports.
|
|
141
|
+
*
|
|
142
|
+
* You can also supply an array of ids to be treated as ES modules, or a
|
|
143
|
+
* function that will be passed each external id to determine whether it is
|
|
144
|
+
* an ES module.
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
esmExternals?: boolean | ReadonlyArray<string> | ((id: string) => boolean);
|
|
148
|
+
/**
|
|
149
|
+
* Controls what is returned when requiring an ES module from a CommonJS file.
|
|
150
|
+
* When using the `esmExternals` option, this will also apply to external
|
|
151
|
+
* modules. By default, this plugin will render those imports as namespace
|
|
152
|
+
* imports i.e.
|
|
153
|
+
*
|
|
154
|
+
* ```js
|
|
155
|
+
* // input
|
|
156
|
+
* const foo = require('foo');
|
|
157
|
+
*
|
|
158
|
+
* // output
|
|
159
|
+
* import * as foo from 'foo';
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* However, there are some situations where this may not be desired.
|
|
163
|
+
* For these situations, you can change Rollup's behaviour either globally or
|
|
164
|
+
* per module. To change it globally, set the `requireReturnsDefault` option
|
|
165
|
+
* to one of the following values:
|
|
166
|
+
*
|
|
167
|
+
* - `false`: This is the default, requiring an ES module returns its
|
|
168
|
+
* namespace. This is the only option that will also add a marker
|
|
169
|
+
* `__esModule: true` to the namespace to support interop patterns in
|
|
170
|
+
* CommonJS modules that are transpiled ES modules.
|
|
171
|
+
* - `"namespace"`: Like `false`, requiring an ES module returns its
|
|
172
|
+
* namespace, but the plugin does not add the `__esModule` marker and thus
|
|
173
|
+
* creates more efficient code. For external dependencies when using
|
|
174
|
+
* `esmExternals: true`, no additional interop code is generated.
|
|
175
|
+
* - `"auto"`: This is complementary to how `output.exports: "auto"` works in
|
|
176
|
+
* Rollup: If a module has a default export and no named exports, requiring
|
|
177
|
+
* that module returns the default export. In all other cases, the namespace
|
|
178
|
+
* is returned. For external dependencies when using `esmExternals: true`, a
|
|
179
|
+
* corresponding interop helper is added.
|
|
180
|
+
* - `"preferred"`: If a module has a default export, requiring that module
|
|
181
|
+
* always returns the default export, no matter whether additional named
|
|
182
|
+
* exports exist. This is similar to how previous versions of this plugin
|
|
183
|
+
* worked. Again for external dependencies when using `esmExternals: true`,
|
|
184
|
+
* an interop helper is added.
|
|
185
|
+
* - `true`: This will always try to return the default export on require
|
|
186
|
+
* without checking if it actually exists. This can throw at build time if
|
|
187
|
+
* there is no default export. This is how external dependencies are handled
|
|
188
|
+
* when `esmExternals` is not used. The advantage over the other options is
|
|
189
|
+
* that, like `false`, this does not add an interop helper for external
|
|
190
|
+
* dependencies, keeping the code lean.
|
|
191
|
+
*
|
|
192
|
+
* To change this for individual modules, you can supply a function for
|
|
193
|
+
* `requireReturnsDefault` instead. This function will then be called once for
|
|
194
|
+
* each required ES module or external dependency with the corresponding id
|
|
195
|
+
* and allows you to return different values for different modules.
|
|
196
|
+
* @default false
|
|
197
|
+
*/
|
|
198
|
+
requireReturnsDefault?: RequireReturnsDefaultOption | ((id: string) => RequireReturnsDefaultOption);
|
|
199
|
+
/**
|
|
200
|
+
* @default "auto"
|
|
201
|
+
*/
|
|
202
|
+
defaultIsModuleExports?: DefaultIsModuleExportsOption | ((id: string) => DefaultIsModuleExportsOption);
|
|
203
|
+
/**
|
|
204
|
+
* Some modules contain dynamic `require` calls, or require modules that
|
|
205
|
+
* contain circular dependencies, which are not handled well by static
|
|
206
|
+
* imports. Including those modules as `dynamicRequireTargets` will simulate a
|
|
207
|
+
* CommonJS (NodeJS-like) environment for them with support for dynamic
|
|
208
|
+
* dependencies. It also enables `strictRequires` for those modules.
|
|
209
|
+
*
|
|
210
|
+
* Note: In extreme cases, this feature may result in some paths being
|
|
211
|
+
* rendered as absolute in the final bundle. The plugin tries to avoid
|
|
212
|
+
* exposing paths from the local machine, but if you are `dynamicRequirePaths`
|
|
213
|
+
* with paths that are far away from your project's folder, that may require
|
|
214
|
+
* replacing strings like `"/Users/John/Desktop/foo-project/"` -> `"/"`.
|
|
215
|
+
*/
|
|
216
|
+
dynamicRequireTargets?: string | ReadonlyArray<string>;
|
|
217
|
+
/**
|
|
218
|
+
* To avoid long paths when using the `dynamicRequireTargets` option, you can use this option to specify a directory
|
|
219
|
+
* that is a common parent for all files that use dynamic require statements. Using a directory higher up such as `/`
|
|
220
|
+
* may lead to unnecessarily long paths in the generated code and may expose directory names on your machine like your
|
|
221
|
+
* home directory name. By default, it uses the current working directory.
|
|
222
|
+
*/
|
|
223
|
+
dynamicRequireRoot?: string;
|
|
224
|
+
/**
|
|
225
|
+
* When enabled, external Node built-ins (e.g., `node:fs`) required from wrapped CommonJS modules
|
|
226
|
+
* will use `createRequire(import.meta.url)` instead of being hoisted as ESM imports. This prevents
|
|
227
|
+
* eager loading of Node built-ins at module initialization time.
|
|
228
|
+
*
|
|
229
|
+
* Note: This option adds a dependency on `node:module` in the output, which may not be available
|
|
230
|
+
* in some environments like edge runtimes (Cloudflare Workers, Vercel Edge Runtime).
|
|
231
|
+
*
|
|
232
|
+
* @default false
|
|
233
|
+
*/
|
|
234
|
+
requireNodeBuiltins?: boolean;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Convert CommonJS modules to ES6, so they can be included in a Rollup bundle
|
|
238
|
+
*/
|
|
239
|
+
declare function commonjs(options?: RollupCommonJSOptions): Plugin;
|
|
240
|
+
//#endregion
|
|
241
|
+
export { commonjs as t };
|