@rolldown/browser 1.0.0-beta.7-commit.46fbc61 → 1.0.0-beta.7-commit.a684277
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/browser.mjs +92 -3
- package/dist/cli.cjs +125 -18
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +81 -16
- package/dist/experimental-index.cjs +32 -3
- package/dist/experimental-index.d.cts +94 -0
- package/dist/experimental-index.d.mts +94 -0
- package/dist/experimental-index.mjs +31 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +3 -3
- package/dist/parallel-plugin-worker.d.cts +1 -0
- package/dist/parallel-plugin-worker.d.mts +1 -0
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.cts +14 -0
- package/dist/parallel-plugin.d.mts +14 -0
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +9 -0
- package/dist/parse-ast-index.d.mts +9 -0
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/chunk-DSsiIF1Z.mjs +30 -0
- package/dist/shared/{chunk-Dc32QXFI.cjs → chunk-qZFfknuJ.cjs} +9 -0
- package/dist/shared/input-options.d-CJIzCDlR.d.mts +1072 -0
- package/dist/shared/input-options.d-sjdx_aVw.d.cts +1072 -0
- package/dist/shared/{parse-ast-index-Rn-i2y3M.cjs → parse-ast-index-B_-Eqolm.cjs} +11 -1
- package/dist/shared/{parse-ast-index-CaKd8BTZ.mjs → parse-ast-index-jK_Miocm.mjs} +11 -1
- package/dist/shared/{prompt-D713KUcE.mjs → prompt-B7SnYdwU.mjs} +1 -1
- package/dist/shared/{prompt-wpCBKCzA.cjs → prompt-_yrURmmm.cjs} +1 -1
- package/dist/shared/{src-whyHz3p3.mjs → src-DSCy0VBD.mjs} +72 -5
- package/dist/shared/{src-DoypqT02.cjs → src-sUNCnFpJ.cjs} +84 -5
- package/package.json +5 -12
- package/dist/shared/chunk-nENTdJ2K.mjs +0 -11
- package/dist/types/api/build.d.ts +0 -18
- package/dist/types/api/experimental.d.ts +0 -7
- package/dist/types/api/rolldown/index.d.ts +0 -3
- package/dist/types/api/rolldown/rolldown-build.d.ts +0 -15
- package/dist/types/api/watch/index.d.ts +0 -3
- package/dist/types/api/watch/watch-emitter.d.ts +0 -31
- package/dist/types/api/watch/watcher.d.ts +0 -13
- package/dist/types/binding.d.ts +0 -1507
- package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
- package/dist/types/builtin-plugin/constructors.d.ts +0 -23
- package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -27
- package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
- package/dist/types/builtin-plugin/utils.d.ts +0 -8
- package/dist/types/cli/arguments/alias.d.ts +0 -16
- package/dist/types/cli/arguments/index.d.ts +0 -15
- package/dist/types/cli/arguments/normalize.d.ts +0 -16
- package/dist/types/cli/arguments/utils.d.ts +0 -8
- package/dist/types/cli/commands/bundle.d.ts +0 -3
- package/dist/types/cli/commands/help.d.ts +0 -1
- package/dist/types/cli/index.d.ts +0 -1
- package/dist/types/cli/load-config.d.ts +0 -5
- package/dist/types/cli/logger.d.ts +0 -5
- package/dist/types/constants/plugin-context.d.ts +0 -7
- package/dist/types/constants/plugin.d.ts +0 -45
- package/dist/types/experimental-index.d.ts +0 -9
- package/dist/types/index.d.ts +0 -31
- package/dist/types/log/log-handler.d.ts +0 -4
- package/dist/types/log/logger.d.ts +0 -6
- package/dist/types/log/logging.d.ts +0 -12
- package/dist/types/log/logs.d.ts +0 -18
- package/dist/types/options/generated/checks-options.d.ts +0 -57
- package/dist/types/options/input-options.d.ts +0 -185
- package/dist/types/options/normalized-input-options.d.ts +0 -18
- package/dist/types/options/normalized-output-options.d.ts +0 -70
- package/dist/types/options/output-options.d.ts +0 -182
- package/dist/types/options/watch-options.d.ts +0 -5
- package/dist/types/parallel-plugin-worker.d.ts +0 -1
- package/dist/types/parallel-plugin.d.ts +0 -1
- package/dist/types/parse-ast-index.d.ts +0 -5
- package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
- package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
- package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
- package/dist/types/plugin/bindingify-plugin.d.ts +0 -17
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
- package/dist/types/plugin/generated/hook-usage.d.ts +0 -29
- package/dist/types/plugin/hook-filter.d.ts +0 -49
- package/dist/types/plugin/index.d.ts +0 -141
- package/dist/types/plugin/minimal-plugin-context.d.ts +0 -24
- package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
- package/dist/types/plugin/parallel-plugin.d.ts +0 -9
- package/dist/types/plugin/plugin-context-data.d.ts +0 -22
- package/dist/types/plugin/plugin-context.d.ts +0 -67
- package/dist/types/plugin/plugin-driver.d.ts +0 -10
- package/dist/types/plugin/transform-plugin-context.d.ts +0 -28
- package/dist/types/plugin/with-filter.d.ts +0 -10
- package/dist/types/types/assert.d.ts +0 -14
- package/dist/types/types/config-export.d.ts +0 -5
- package/dist/types/types/misc.d.ts +0 -40
- package/dist/types/types/module-info.d.ts +0 -15
- package/dist/types/types/module-side-effects.d.ts +0 -12
- package/dist/types/types/output-bundle.d.ts +0 -4
- package/dist/types/types/rolldown-options.d.ts +0 -5
- package/dist/types/types/rolldown-output.d.ts +0 -66
- package/dist/types/types/schema.d.ts +0 -33
- package/dist/types/types/sourcemap.d.ts +0 -14
- package/dist/types/types/utils.d.ts +0 -13
- package/dist/types/types.d.ts +0 -7
- package/dist/types/utils/asset-source.d.ts +0 -4
- package/dist/types/utils/async-flatten.d.ts +0 -1
- package/dist/types/utils/bindingify-input-options.d.ts +0 -7
- package/dist/types/utils/bindingify-output-options.d.ts +0 -5
- package/dist/types/utils/code-frame.d.ts +0 -1
- package/dist/types/utils/compose-js-plugins.d.ts +0 -2
- package/dist/types/utils/create-bundler-option.d.ts +0 -11
- package/dist/types/utils/create-bundler.d.ts +0 -9
- package/dist/types/utils/define-config.d.ts +0 -5
- package/dist/types/utils/error.d.ts +0 -2
- package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -17
- package/dist/types/utils/misc.d.ts +0 -7
- package/dist/types/utils/normalize-hook.d.ts +0 -7
- package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
- package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
- package/dist/types/utils/plugin/index.d.ts +0 -2
- package/dist/types/utils/resolved-external.d.ts +0 -4
- package/dist/types/utils/transform-module-info.d.ts +0 -4
- package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
- package/dist/types/utils/transform-rendered-module.d.ts +0 -3
- package/dist/types/utils/transform-side-effects.d.ts +0 -3
- package/dist/types/utils/transform-sourcemap.d.ts +0 -3
- package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
- package/dist/types/utils/validator.d.ts +0 -6
package/dist/browser.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import "@valibot/to-json-schema";
|
|
|
5
5
|
import * as v from "valibot";
|
|
6
6
|
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "1.0.0-beta.7-commit.
|
|
8
|
+
var version = "1.0.0-beta.7-commit.a684277";
|
|
9
9
|
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/builtin-plugin/utils.ts
|
|
@@ -112,6 +112,10 @@ function getCodeFrame(source, line, column) {
|
|
|
112
112
|
function rangeContains(range, index) {
|
|
113
113
|
return range.start <= index && index < range.end;
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* @param {string} source
|
|
117
|
+
* @param {import('./types').Options} [options]
|
|
118
|
+
*/
|
|
115
119
|
function getLocator(source, options = {}) {
|
|
116
120
|
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
117
121
|
let start = 0;
|
|
@@ -149,6 +153,12 @@ function getLocator(source, options = {}) {
|
|
|
149
153
|
}
|
|
150
154
|
return locator;
|
|
151
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* @param {string} source
|
|
158
|
+
* @param {string | number} search
|
|
159
|
+
* @param {import('./types').Options} [options]
|
|
160
|
+
* @returns {Location | undefined}
|
|
161
|
+
*/
|
|
152
162
|
function locate(source, search, options) {
|
|
153
163
|
return getLocator(source, options)(search, options && options.startIndex);
|
|
154
164
|
}
|
|
@@ -379,6 +389,16 @@ const ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
|
379
389
|
"intro",
|
|
380
390
|
"outro"
|
|
381
391
|
];
|
|
392
|
+
/**
|
|
393
|
+
* Names of all defined hooks. It's like
|
|
394
|
+
* ```js
|
|
395
|
+
* const DEFINED_HOOK_NAMES ={
|
|
396
|
+
* options: 'options',
|
|
397
|
+
* buildStart: 'buildStart',
|
|
398
|
+
* ...
|
|
399
|
+
* }
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
382
402
|
const DEFINED_HOOK_NAMES = {
|
|
383
403
|
[ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
|
|
384
404
|
[ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
|
|
@@ -715,6 +735,7 @@ const InputOptionsSchema = v.strictObject({
|
|
|
715
735
|
debug: v.pipe(v.optional(v.object({ sessionId: v.pipe(v.optional(v.string()), v.description("Used to name the build.")) })), v.description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly."))
|
|
716
736
|
});
|
|
717
737
|
const InputCliOverrideSchema = v.strictObject({
|
|
738
|
+
input: v.pipe(v.optional(v.array(v.string())), v.description("Entry file")),
|
|
718
739
|
external: v.pipe(v.optional(v.array(v.string())), v.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
719
740
|
inject: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Inject import statements on demand")),
|
|
720
741
|
treeshake: v.pipe(v.optional(v.boolean()), v.description("enable treeshaking")),
|
|
@@ -724,7 +745,6 @@ const InputCliOptionsSchema = v.omit(v.strictObject({
|
|
|
724
745
|
...InputOptionsSchema.entries,
|
|
725
746
|
...InputCliOverrideSchema.entries
|
|
726
747
|
}), [
|
|
727
|
-
"input",
|
|
728
748
|
"plugins",
|
|
729
749
|
"onwarn",
|
|
730
750
|
"onLog",
|
|
@@ -893,6 +913,12 @@ function validateOption(key, options) {
|
|
|
893
913
|
|
|
894
914
|
//#endregion
|
|
895
915
|
//#region src/constants/plugin-context.ts
|
|
916
|
+
/**
|
|
917
|
+
* If Composed plugins call `this.resolve` with `skipSelf: true`, the composed plugins will be skipped as a whole.
|
|
918
|
+
* To prevent that, we use this symbol to store the actual caller of `this.resolve` with `skipSelf: true`. And we
|
|
919
|
+
* will modify the skipSelf option to `false` and use this symbol to skip the caller itself in the composed plugins
|
|
920
|
+
* internally.
|
|
921
|
+
*/
|
|
896
922
|
const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
897
923
|
|
|
898
924
|
//#endregion
|
|
@@ -2027,6 +2053,67 @@ function bindingifyCloseWatcher(args) {
|
|
|
2027
2053
|
};
|
|
2028
2054
|
}
|
|
2029
2055
|
|
|
2056
|
+
//#endregion
|
|
2057
|
+
//#region src/plugin/generated/hook-usage.ts
|
|
2058
|
+
let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
2059
|
+
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
2060
|
+
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
2061
|
+
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
2062
|
+
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
2063
|
+
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
2064
|
+
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
2065
|
+
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
2066
|
+
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
2067
|
+
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
2068
|
+
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
2069
|
+
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
2070
|
+
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
2071
|
+
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
2072
|
+
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
2073
|
+
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
2074
|
+
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
2075
|
+
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
2076
|
+
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
2077
|
+
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
2078
|
+
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
2079
|
+
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
2080
|
+
return HookUsageKind$1;
|
|
2081
|
+
}({});
|
|
2082
|
+
var HookUsage = class {
|
|
2083
|
+
bitflag = BigInt(0);
|
|
2084
|
+
constructor() {}
|
|
2085
|
+
union(kind) {
|
|
2086
|
+
this.bitflag |= BigInt(kind);
|
|
2087
|
+
}
|
|
2088
|
+
inner() {
|
|
2089
|
+
return Number(this.bitflag);
|
|
2090
|
+
}
|
|
2091
|
+
};
|
|
2092
|
+
function extractHookUsage(plugin) {
|
|
2093
|
+
let hookUsage = new HookUsage();
|
|
2094
|
+
if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
|
|
2095
|
+
if (plugin.resolveId) hookUsage.union(HookUsageKind.resolveId);
|
|
2096
|
+
if (plugin.resolveDynamicImport) hookUsage.union(HookUsageKind.resolveDynamicImport);
|
|
2097
|
+
if (plugin.load) hookUsage.union(HookUsageKind.load);
|
|
2098
|
+
if (plugin.transform) hookUsage.union(HookUsageKind.transform);
|
|
2099
|
+
if (plugin.moduleParsed) hookUsage.union(HookUsageKind.moduleParsed);
|
|
2100
|
+
if (plugin.buildEnd) hookUsage.union(HookUsageKind.buildEnd);
|
|
2101
|
+
if (plugin.renderStart) hookUsage.union(HookUsageKind.renderStart);
|
|
2102
|
+
if (plugin.renderError) hookUsage.union(HookUsageKind.renderError);
|
|
2103
|
+
if (plugin.renderChunk) hookUsage.union(HookUsageKind.renderChunk);
|
|
2104
|
+
if (plugin.augmentChunkHash) hookUsage.union(HookUsageKind.augmentChunkHash);
|
|
2105
|
+
if (plugin.generateBundle) hookUsage.union(HookUsageKind.generateBundle);
|
|
2106
|
+
if (plugin.writeBundle) hookUsage.union(HookUsageKind.writeBundle);
|
|
2107
|
+
if (plugin.closeBundle) hookUsage.union(HookUsageKind.closeBundle);
|
|
2108
|
+
if (plugin.watchChange) hookUsage.union(HookUsageKind.watchChange);
|
|
2109
|
+
if (plugin.closeWatcher) hookUsage.union(HookUsageKind.closeWatcher);
|
|
2110
|
+
if (plugin.banner) hookUsage.union(HookUsageKind.banner);
|
|
2111
|
+
if (plugin.footer) hookUsage.union(HookUsageKind.footer);
|
|
2112
|
+
if (plugin.intro) hookUsage.union(HookUsageKind.intro);
|
|
2113
|
+
if (plugin.outro) hookUsage.union(HookUsageKind.outro);
|
|
2114
|
+
return hookUsage;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2030
2117
|
//#endregion
|
|
2031
2118
|
//#region src/plugin/bindingify-plugin.ts
|
|
2032
2119
|
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
@@ -2060,6 +2147,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2060
2147
|
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
|
|
2061
2148
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
|
|
2062
2149
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
|
|
2150
|
+
let hookUsage = extractHookUsage(plugin).inner();
|
|
2063
2151
|
const result = {
|
|
2064
2152
|
name: plugin.name,
|
|
2065
2153
|
buildStart,
|
|
@@ -2104,7 +2192,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2104
2192
|
watchChange,
|
|
2105
2193
|
watchChangeMeta,
|
|
2106
2194
|
closeWatcher,
|
|
2107
|
-
closeWatcherMeta
|
|
2195
|
+
closeWatcherMeta,
|
|
2196
|
+
hookUsage
|
|
2108
2197
|
};
|
|
2109
2198
|
return wrapHandlers(result);
|
|
2110
2199
|
}
|
package/dist/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_chunk = require('./shared/chunk-
|
|
2
|
-
const require_src = require('./shared/src-
|
|
3
|
-
require('./shared/parse-ast-index-
|
|
1
|
+
const require_chunk = require('./shared/chunk-qZFfknuJ.cjs');
|
|
2
|
+
const require_src = require('./shared/src-sUNCnFpJ.cjs');
|
|
3
|
+
require('./shared/parse-ast-index-B_-Eqolm.cjs');
|
|
4
4
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
5
|
const ansis = require_chunk.__toESM(require("ansis"));
|
|
6
6
|
const node_process = require_chunk.__toESM(require("node:process"));
|
|
@@ -957,9 +957,22 @@ function createConsola(options$1 = {}) {
|
|
|
957
957
|
defaults: { level },
|
|
958
958
|
stdout: process.stdout,
|
|
959
959
|
stderr: process.stderr,
|
|
960
|
-
prompt: (...args) => Promise.resolve().then(
|
|
961
|
-
|
|
962
|
-
|
|
960
|
+
prompt: (...args) => Promise.resolve().then(
|
|
961
|
+
// Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
|
|
962
|
+
// Zero-width no-break space
|
|
963
|
+
// Combining diacritical marks
|
|
964
|
+
// Combining diacritical marks extended
|
|
965
|
+
// Combining diacritical marks supplement
|
|
966
|
+
// Combining diacritical marks for symbols
|
|
967
|
+
// Combining half marks
|
|
968
|
+
// Linux console (kernel)
|
|
969
|
+
// Windows Terminal
|
|
970
|
+
// Terminus (<0.2.27)
|
|
971
|
+
// ConEmu and cmder
|
|
972
|
+
function() {
|
|
973
|
+
return require("./shared/prompt-_yrURmmm.cjs");
|
|
974
|
+
}
|
|
975
|
+
).then((m) => m.prompt(...args)),
|
|
963
976
|
reporters: options$1.reporters || [options$1.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
964
977
|
...options$1
|
|
965
978
|
});
|
|
@@ -974,6 +987,9 @@ const consola = createConsola();
|
|
|
974
987
|
|
|
975
988
|
//#endregion
|
|
976
989
|
//#region src/cli/logger.ts
|
|
990
|
+
/**
|
|
991
|
+
* Console logger
|
|
992
|
+
*/
|
|
977
993
|
const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() : createConsola({ formatOptions: { date: false } });
|
|
978
994
|
function createTestingLogger() {
|
|
979
995
|
const types = [
|
|
@@ -1121,7 +1137,8 @@ function normalizeCliOptions(cliOptions, positionals) {
|
|
|
1121
1137
|
process.exit(1);
|
|
1122
1138
|
}
|
|
1123
1139
|
}
|
|
1124
|
-
if (!result.config && positionals.length > 0) result.input.input
|
|
1140
|
+
if (!result.config && positionals.length > 0) if (Array.isArray(result.input.input)) result.input.input.push(...positionals);
|
|
1141
|
+
else result.input.input = positionals;
|
|
1125
1142
|
return result;
|
|
1126
1143
|
}
|
|
1127
1144
|
|
|
@@ -1217,6 +1234,32 @@ function parseCliArguments() {
|
|
|
1217
1234
|
|
|
1218
1235
|
//#endregion
|
|
1219
1236
|
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
1237
|
+
/**
|
|
1238
|
+
* This is not the set of all possible signals.
|
|
1239
|
+
*
|
|
1240
|
+
* It IS, however, the set of all signals that trigger
|
|
1241
|
+
* an exit on either Linux or BSD systems. Linux is a
|
|
1242
|
+
* superset of the signal names supported on BSD, and
|
|
1243
|
+
* the unknown signals just fail to register, so we can
|
|
1244
|
+
* catch that easily enough.
|
|
1245
|
+
*
|
|
1246
|
+
* Windows signals are a different set, since there are
|
|
1247
|
+
* signals that terminate Windows processes, but don't
|
|
1248
|
+
* terminate (or don't even exist) on Posix systems.
|
|
1249
|
+
*
|
|
1250
|
+
* Don't bother with SIGKILL. It's uncatchable, which
|
|
1251
|
+
* means that we can't fire any callbacks anyway.
|
|
1252
|
+
*
|
|
1253
|
+
* If a user does happen to register a handler on a non-
|
|
1254
|
+
* fatal signal like SIGWINCH or something, and then
|
|
1255
|
+
* exit, it'll end up firing `process.emit('exit')`, so
|
|
1256
|
+
* the handler will be fired anyway.
|
|
1257
|
+
*
|
|
1258
|
+
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
1259
|
+
* artificially, inherently leave the process in a
|
|
1260
|
+
* state from which it is not safe to try and enter JS
|
|
1261
|
+
* listeners.
|
|
1262
|
+
*/
|
|
1220
1263
|
const signals = [];
|
|
1221
1264
|
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1222
1265
|
if (process.platform !== "win32") signals.push(
|
|
@@ -1515,6 +1558,67 @@ async function loadConfig(configPath) {
|
|
|
1515
1558
|
}
|
|
1516
1559
|
}
|
|
1517
1560
|
|
|
1561
|
+
//#endregion
|
|
1562
|
+
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.64.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js
|
|
1563
|
+
var require_usingCtx = require_chunk.__commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.64.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(exports, module) {
|
|
1564
|
+
function _usingCtx() {
|
|
1565
|
+
var r$1 = "function" == typeof SuppressedError ? SuppressedError : function(r$2, e$1) {
|
|
1566
|
+
var n$2 = Error();
|
|
1567
|
+
return n$2.name = "SuppressedError", n$2.error = r$2, n$2.suppressed = e$1, n$2;
|
|
1568
|
+
}, e = {}, n$1 = [];
|
|
1569
|
+
function using(r$2, e$1) {
|
|
1570
|
+
if (null != e$1) {
|
|
1571
|
+
if (Object(e$1) !== e$1) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
1572
|
+
if (r$2) var o$1 = e$1[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
|
1573
|
+
if (void 0 === o$1 && (o$1 = e$1[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r$2)) var t$1 = o$1;
|
|
1574
|
+
if ("function" != typeof o$1) throw new TypeError("Object is not disposable.");
|
|
1575
|
+
t$1 && (o$1 = function o$2() {
|
|
1576
|
+
try {
|
|
1577
|
+
t$1.call(e$1);
|
|
1578
|
+
} catch (r$3) {
|
|
1579
|
+
return Promise.reject(r$3);
|
|
1580
|
+
}
|
|
1581
|
+
}), n$1.push({
|
|
1582
|
+
v: e$1,
|
|
1583
|
+
d: o$1,
|
|
1584
|
+
a: r$2
|
|
1585
|
+
});
|
|
1586
|
+
} else r$2 && n$1.push({
|
|
1587
|
+
d: e$1,
|
|
1588
|
+
a: r$2
|
|
1589
|
+
});
|
|
1590
|
+
return e$1;
|
|
1591
|
+
}
|
|
1592
|
+
return {
|
|
1593
|
+
e,
|
|
1594
|
+
u: using.bind(null, !1),
|
|
1595
|
+
a: using.bind(null, !0),
|
|
1596
|
+
d: function d() {
|
|
1597
|
+
var o$1, t$1 = this.e, s$1 = 0;
|
|
1598
|
+
function next() {
|
|
1599
|
+
for (; o$1 = n$1.pop();) try {
|
|
1600
|
+
if (!o$1.a && 1 === s$1) return s$1 = 0, n$1.push(o$1), Promise.resolve().then(next);
|
|
1601
|
+
if (o$1.d) {
|
|
1602
|
+
var r$2 = o$1.d.call(o$1.v);
|
|
1603
|
+
if (o$1.a) return s$1 |= 2, Promise.resolve(r$2).then(next, err);
|
|
1604
|
+
} else s$1 |= 1;
|
|
1605
|
+
} catch (r$3) {
|
|
1606
|
+
return err(r$3);
|
|
1607
|
+
}
|
|
1608
|
+
if (1 === s$1) return t$1 !== e ? Promise.reject(t$1) : Promise.resolve();
|
|
1609
|
+
if (t$1 !== e) throw t$1;
|
|
1610
|
+
}
|
|
1611
|
+
function err(n$2) {
|
|
1612
|
+
return t$1 = t$1 !== e ? new r$1(n$2, t$1) : n$2, next();
|
|
1613
|
+
}
|
|
1614
|
+
return next();
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
1619
|
+
} });
|
|
1620
|
+
var import_usingCtx = require_chunk.__toESM(require_usingCtx());
|
|
1621
|
+
|
|
1518
1622
|
//#endregion
|
|
1519
1623
|
//#region src/cli/commands/bundle.ts
|
|
1520
1624
|
async function bundleWithConfig(configPath, cliOptions) {
|
|
@@ -1527,17 +1631,18 @@ async function bundleWithConfig(configPath, cliOptions) {
|
|
|
1527
1631
|
else await bundleInner(config, cliOptions);
|
|
1528
1632
|
}
|
|
1529
1633
|
async function bundleWithCliOptions(cliOptions) {
|
|
1530
|
-
if (cliOptions.output.dir || cliOptions.output.file) {
|
|
1531
|
-
const operation = cliOptions.watch ? watchInner : bundleInner;
|
|
1532
|
-
await operation({}, cliOptions);
|
|
1533
|
-
return;
|
|
1534
|
-
}
|
|
1535
|
-
if (cliOptions.watch) {
|
|
1536
|
-
logger.error("You must specify `output.dir` to use watch mode");
|
|
1537
|
-
process.exit(1);
|
|
1538
|
-
}
|
|
1539
|
-
const build = await require_src.rolldown(cliOptions.input);
|
|
1540
1634
|
try {
|
|
1635
|
+
var _usingCtx$1 = (0, import_usingCtx.default)();
|
|
1636
|
+
if (cliOptions.output.dir || cliOptions.output.file) {
|
|
1637
|
+
const operation = cliOptions.watch ? watchInner : bundleInner;
|
|
1638
|
+
await operation({}, cliOptions);
|
|
1639
|
+
return;
|
|
1640
|
+
}
|
|
1641
|
+
if (cliOptions.watch) {
|
|
1642
|
+
logger.error("You must specify `output.dir` to use watch mode");
|
|
1643
|
+
process.exit(1);
|
|
1644
|
+
}
|
|
1645
|
+
const build = _usingCtx$1.a(await require_src.rolldown(cliOptions.input));
|
|
1541
1646
|
const { output: outputs } = await build.generate(cliOptions.output);
|
|
1542
1647
|
if (outputs.length === 0) {
|
|
1543
1648
|
logger.error("No output generated");
|
|
@@ -1547,8 +1652,10 @@ async function bundleWithCliOptions(cliOptions) {
|
|
|
1547
1652
|
if (outputs.length > 1) logger.log(`\n${ansis.default.cyan(ansis.default.bold(`|→ ${file.fileName}:`))}\n`);
|
|
1548
1653
|
console.log(file.type === "asset" ? file.source : file.code);
|
|
1549
1654
|
}
|
|
1655
|
+
} catch (_$1) {
|
|
1656
|
+
_usingCtx$1.e = _$1;
|
|
1550
1657
|
} finally {
|
|
1551
|
-
await
|
|
1658
|
+
await _usingCtx$1.d();
|
|
1552
1659
|
}
|
|
1553
1660
|
}
|
|
1554
1661
|
async function watchInner(config, cliOptions) {
|
package/dist/cli.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __commonJS, __esm } from "./shared/chunk-
|
|
2
|
-
import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, init_misc, init_rolldown, init_validator, init_watch, rolldown, validateCliOptions, version, watch } from "./shared/src-
|
|
3
|
-
import "./shared/parse-ast-index-
|
|
1
|
+
import { __commonJS, __esm, __toESM } from "./shared/chunk-DSsiIF1Z.mjs";
|
|
2
|
+
import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, init_misc, init_rolldown, init_validator, init_watch, rolldown, validateCliOptions, version, watch } from "./shared/src-DSCy0VBD.mjs";
|
|
3
|
+
import "./shared/parse-ast-index-jK_Miocm.mjs";
|
|
4
4
|
import path, { sep } from "node:path";
|
|
5
5
|
import colors from "ansis";
|
|
6
6
|
import process$1, { cwd } from "node:process";
|
|
@@ -760,7 +760,7 @@ function createConsola(options$1 = {}) {
|
|
|
760
760
|
defaults: { level },
|
|
761
761
|
stdout: process.stdout,
|
|
762
762
|
stderr: process.stderr,
|
|
763
|
-
prompt: (...args) => import("./shared/prompt-
|
|
763
|
+
prompt: (...args) => import("./shared/prompt-B7SnYdwU.mjs").then((m) => m.prompt(...args)),
|
|
764
764
|
reporters: options$1.reporters || [options$1.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
765
765
|
...options$1
|
|
766
766
|
});
|
|
@@ -1144,7 +1144,8 @@ function normalizeCliOptions(cliOptions, positionals) {
|
|
|
1144
1144
|
process.exit(1);
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
if (!result.config && positionals.length > 0) result.input.input
|
|
1147
|
+
if (!result.config && positionals.length > 0) if (Array.isArray(result.input.input)) result.input.input.push(...positionals);
|
|
1148
|
+
else result.input.input = positionals;
|
|
1148
1149
|
return result;
|
|
1149
1150
|
}
|
|
1150
1151
|
var init_normalize = __esm({ "src/cli/arguments/normalize.ts"() {
|
|
@@ -1562,6 +1563,67 @@ var init_load_config = __esm({ "src/cli/load-config.ts"() {
|
|
|
1562
1563
|
DEFAULT_CONFIG_BASE = "rolldown.config";
|
|
1563
1564
|
} });
|
|
1564
1565
|
|
|
1566
|
+
//#endregion
|
|
1567
|
+
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.64.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js
|
|
1568
|
+
var require_usingCtx = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.64.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(exports, module) {
|
|
1569
|
+
function _usingCtx() {
|
|
1570
|
+
var r$1 = "function" == typeof SuppressedError ? SuppressedError : function(r$2, e$1) {
|
|
1571
|
+
var n$2 = Error();
|
|
1572
|
+
return n$2.name = "SuppressedError", n$2.error = r$2, n$2.suppressed = e$1, n$2;
|
|
1573
|
+
}, e = {}, n$1 = [];
|
|
1574
|
+
function using(r$2, e$1) {
|
|
1575
|
+
if (null != e$1) {
|
|
1576
|
+
if (Object(e$1) !== e$1) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
1577
|
+
if (r$2) var o$1 = e$1[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
|
1578
|
+
if (void 0 === o$1 && (o$1 = e$1[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r$2)) var t$1 = o$1;
|
|
1579
|
+
if ("function" != typeof o$1) throw new TypeError("Object is not disposable.");
|
|
1580
|
+
t$1 && (o$1 = function o$2() {
|
|
1581
|
+
try {
|
|
1582
|
+
t$1.call(e$1);
|
|
1583
|
+
} catch (r$3) {
|
|
1584
|
+
return Promise.reject(r$3);
|
|
1585
|
+
}
|
|
1586
|
+
}), n$1.push({
|
|
1587
|
+
v: e$1,
|
|
1588
|
+
d: o$1,
|
|
1589
|
+
a: r$2
|
|
1590
|
+
});
|
|
1591
|
+
} else r$2 && n$1.push({
|
|
1592
|
+
d: e$1,
|
|
1593
|
+
a: r$2
|
|
1594
|
+
});
|
|
1595
|
+
return e$1;
|
|
1596
|
+
}
|
|
1597
|
+
return {
|
|
1598
|
+
e,
|
|
1599
|
+
u: using.bind(null, !1),
|
|
1600
|
+
a: using.bind(null, !0),
|
|
1601
|
+
d: function d() {
|
|
1602
|
+
var o$1, t$1 = this.e, s$1 = 0;
|
|
1603
|
+
function next() {
|
|
1604
|
+
for (; o$1 = n$1.pop();) try {
|
|
1605
|
+
if (!o$1.a && 1 === s$1) return s$1 = 0, n$1.push(o$1), Promise.resolve().then(next);
|
|
1606
|
+
if (o$1.d) {
|
|
1607
|
+
var r$2 = o$1.d.call(o$1.v);
|
|
1608
|
+
if (o$1.a) return s$1 |= 2, Promise.resolve(r$2).then(next, err);
|
|
1609
|
+
} else s$1 |= 1;
|
|
1610
|
+
} catch (r$3) {
|
|
1611
|
+
return err(r$3);
|
|
1612
|
+
}
|
|
1613
|
+
if (1 === s$1) return t$1 !== e ? Promise.reject(t$1) : Promise.resolve();
|
|
1614
|
+
if (t$1 !== e) throw t$1;
|
|
1615
|
+
}
|
|
1616
|
+
function err(n$2) {
|
|
1617
|
+
return t$1 = t$1 !== e ? new r$1(n$2, t$1) : n$2, next();
|
|
1618
|
+
}
|
|
1619
|
+
return next();
|
|
1620
|
+
}
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
1624
|
+
} });
|
|
1625
|
+
var import_usingCtx = __toESM(require_usingCtx());
|
|
1626
|
+
|
|
1565
1627
|
//#endregion
|
|
1566
1628
|
//#region src/cli/commands/bundle.ts
|
|
1567
1629
|
async function bundleWithConfig(configPath, cliOptions) {
|
|
@@ -1574,17 +1636,18 @@ async function bundleWithConfig(configPath, cliOptions) {
|
|
|
1574
1636
|
else await bundleInner(config, cliOptions);
|
|
1575
1637
|
}
|
|
1576
1638
|
async function bundleWithCliOptions(cliOptions) {
|
|
1577
|
-
if (cliOptions.output.dir || cliOptions.output.file) {
|
|
1578
|
-
const operation = cliOptions.watch ? watchInner : bundleInner;
|
|
1579
|
-
await operation({}, cliOptions);
|
|
1580
|
-
return;
|
|
1581
|
-
}
|
|
1582
|
-
if (cliOptions.watch) {
|
|
1583
|
-
logger.error("You must specify `output.dir` to use watch mode");
|
|
1584
|
-
process.exit(1);
|
|
1585
|
-
}
|
|
1586
|
-
const build = await rolldown(cliOptions.input);
|
|
1587
1639
|
try {
|
|
1640
|
+
var _usingCtx$1 = (0, import_usingCtx.default)();
|
|
1641
|
+
if (cliOptions.output.dir || cliOptions.output.file) {
|
|
1642
|
+
const operation = cliOptions.watch ? watchInner : bundleInner;
|
|
1643
|
+
await operation({}, cliOptions);
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
if (cliOptions.watch) {
|
|
1647
|
+
logger.error("You must specify `output.dir` to use watch mode");
|
|
1648
|
+
process.exit(1);
|
|
1649
|
+
}
|
|
1650
|
+
const build = _usingCtx$1.a(await rolldown(cliOptions.input));
|
|
1588
1651
|
const { output: outputs } = await build.generate(cliOptions.output);
|
|
1589
1652
|
if (outputs.length === 0) {
|
|
1590
1653
|
logger.error("No output generated");
|
|
@@ -1594,8 +1657,10 @@ async function bundleWithCliOptions(cliOptions) {
|
|
|
1594
1657
|
if (outputs.length > 1) logger.log(`\n${colors.cyan(colors.bold(`|→ ${file.fileName}:`))}\n`);
|
|
1595
1658
|
console.log(file.type === "asset" ? file.source : file.code);
|
|
1596
1659
|
}
|
|
1660
|
+
} catch (_$1) {
|
|
1661
|
+
_usingCtx$1.e = _$1;
|
|
1597
1662
|
} finally {
|
|
1598
|
-
await
|
|
1663
|
+
await _usingCtx$1.d();
|
|
1599
1664
|
}
|
|
1600
1665
|
}
|
|
1601
1666
|
async function watchInner(config, cliOptions) {
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_chunk = require('./shared/chunk-
|
|
3
|
-
const require_src = require('./shared/src-
|
|
4
|
-
require('./shared/parse-ast-index-
|
|
2
|
+
const require_chunk = require('./shared/chunk-qZFfknuJ.cjs');
|
|
3
|
+
const require_src = require('./shared/src-sUNCnFpJ.cjs');
|
|
4
|
+
require('./shared/parse-ast-index-B_-Eqolm.cjs');
|
|
5
5
|
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("./rolldown-binding.wasi.cjs"));
|
|
6
6
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
7
7
|
|
|
8
8
|
//#region src/api/experimental.ts
|
|
9
|
+
/**
|
|
10
|
+
* This is an experimental API. It's behavior may change in the future.
|
|
11
|
+
*
|
|
12
|
+
* Calling this API will only execute the scan stage of rolldown.
|
|
13
|
+
*/
|
|
9
14
|
const experimental_scan = async (input) => {
|
|
10
15
|
const { bundler, stopWorkers } = await require_src.createBundler(input, {});
|
|
11
16
|
const output = await bundler.scan();
|
|
@@ -32,6 +37,30 @@ function aliasPlugin(config) {
|
|
|
32
37
|
|
|
33
38
|
//#endregion
|
|
34
39
|
//#region src/builtin-plugin/replace-plugin.ts
|
|
40
|
+
/**
|
|
41
|
+
* Replaces targeted strings in files while bundling.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Basic usage
|
|
45
|
+
* ```js
|
|
46
|
+
* replacePlugin({
|
|
47
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
48
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
49
|
+
* __buildVersion: 15
|
|
50
|
+
* })
|
|
51
|
+
* ```
|
|
52
|
+
* @example
|
|
53
|
+
* // With options
|
|
54
|
+
* ```js
|
|
55
|
+
* replacePlugin({
|
|
56
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
57
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
58
|
+
* __buildVersion: 15
|
|
59
|
+
* }, {
|
|
60
|
+
* preventAssignment: false,
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
35
64
|
function replacePlugin(values = {}, options = {}) {
|
|
36
65
|
return new require_src.BuiltinPlugin("builtin:replace", {
|
|
37
66
|
...options,
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { BuiltinPlugin, InputOptions, RolldownPlugin, buildImportAnalysisPlugin, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, reportPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "./shared/input-options.d-sjdx_aVw.cjs";
|
|
2
|
+
import { BindingReplacePluginConfig, BindingTransformPluginConfig, TransformOptions, TransformResult, moduleRunnerTransform, transform } from "./rolldown-binding.wasi.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/api/experimental.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* This is an experimental API. It's behavior may change in the future.
|
|
7
|
+
*
|
|
8
|
+
* Calling this API will only execute the scan stage of rolldown.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* This is an experimental API. It's behavior may change in the future.
|
|
12
|
+
*
|
|
13
|
+
* Calling this API will only execute the scan stage of rolldown.
|
|
14
|
+
*/
|
|
15
|
+
declare const experimental_scan: (input: InputOptions) => Promise<void>;
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/utils/compose-js-plugins.d.ts
|
|
19
|
+
declare function composeJsPlugins(plugins: RolldownPlugin[]): RolldownPlugin[];
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/builtin-plugin/alias-plugin.d.ts
|
|
23
|
+
type AliasPluginAlias = {
|
|
24
|
+
find: string | RegExp
|
|
25
|
+
replacement: string
|
|
26
|
+
};
|
|
27
|
+
type AliasPluginConfig = {
|
|
28
|
+
entries: AliasPluginAlias[]
|
|
29
|
+
};
|
|
30
|
+
declare function aliasPlugin(config: AliasPluginConfig): BuiltinPlugin;
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/builtin-plugin/replace-plugin.d.ts
|
|
34
|
+
/**
|
|
35
|
+
* Replaces targeted strings in files while bundling.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // Basic usage
|
|
39
|
+
* ```js
|
|
40
|
+
* replacePlugin({
|
|
41
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
42
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
43
|
+
* __buildVersion: 15
|
|
44
|
+
* })
|
|
45
|
+
* ```
|
|
46
|
+
* @example
|
|
47
|
+
* // With options
|
|
48
|
+
* ```js
|
|
49
|
+
* replacePlugin({
|
|
50
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
51
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
52
|
+
* __buildVersion: 15
|
|
53
|
+
* }, {
|
|
54
|
+
* preventAssignment: false,
|
|
55
|
+
* })
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* Replaces targeted strings in files while bundling.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // Basic usage
|
|
63
|
+
* ```js
|
|
64
|
+
* replacePlugin({
|
|
65
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
66
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
67
|
+
* __buildVersion: 15
|
|
68
|
+
* })
|
|
69
|
+
* ```
|
|
70
|
+
* @example
|
|
71
|
+
* // With options
|
|
72
|
+
* ```js
|
|
73
|
+
* replacePlugin({
|
|
74
|
+
* 'process.env.NODE_ENV': JSON.stringify('production'),
|
|
75
|
+
* __buildDate__: () => JSON.stringify(new Date()),
|
|
76
|
+
* __buildVersion: 15
|
|
77
|
+
* }, {
|
|
78
|
+
* preventAssignment: false,
|
|
79
|
+
* })
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/builtin-plugin/transform-plugin.d.ts
|
|
86
|
+
type TransformPattern = string | RegExp | (RegExp | string)[];
|
|
87
|
+
type TransformPluginConfig = Omit<BindingTransformPluginConfig, "include" | "exclude"> & {
|
|
88
|
+
include?: TransformPattern
|
|
89
|
+
exclude?: TransformPattern
|
|
90
|
+
};
|
|
91
|
+
declare function transformPlugin(config?: TransformPluginConfig): BuiltinPlugin;
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
94
|
+
export { TransformOptions, TransformResult, aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, reportPlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
|