@rolldown/browser 1.0.0-beta.15 → 1.0.0-beta.17
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/cli.cjs +8 -8
- package/dist/cli.mjs +1042 -1083
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -5
- package/dist/experimental-index.browser.mjs +3 -3
- package/dist/experimental-index.cjs +3 -3
- package/dist/experimental-index.d.cts +2 -2
- package/dist/experimental-index.d.mts +2 -2
- package/dist/experimental-index.mjs +5 -17
- package/dist/experimental-runtime-types.d.ts +52 -0
- package/dist/filter-index.d.cts +2 -2
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -2
- package/dist/index.browser.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -4
- package/dist/parallel-plugin-worker.cjs +2 -2
- package/dist/parallel-plugin-worker.mjs +27 -33
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -2
- package/dist/rolldown-binding.wasi-browser.js +4 -2
- package/dist/rolldown-binding.wasi.cjs +3 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-CZdobbZA.d.cts → binding-CWvDTpOw.d.mts} +23 -15
- package/dist/shared/{binding-Dze8QVpf.d.mts → binding-um3VI33z.d.cts} +23 -15
- package/dist/shared/{define-config-CnVvtpOm.d.mts → define-config-DETTMcOl.d.mts} +73 -12
- package/dist/shared/{define-config-BE-fkZNW.d.cts → define-config-POPyhxOq.d.cts} +73 -12
- package/dist/shared/dist-BoWaIc-K.mjs +147 -0
- package/dist/shared/{load-config-CmZwBnZf.mjs → load-config-C0FU-xTD.mjs} +14 -19
- package/dist/shared/{load-config-DlY_Bz-0.cjs → load-config-Cp5Lu-qW.cjs} +1 -1
- package/dist/shared/{parse-ast-index-IepkD-LB.mjs → parse-ast-index-B5AmHtd5.mjs} +10 -28
- package/dist/shared/{parse-ast-index-5MuKtufe.cjs → parse-ast-index-X4pECV1E.cjs} +1 -1
- package/dist/shared/prompt-C5jz26Zn.mjs +852 -0
- package/dist/shared/{prompt-8EeOGx1_.cjs → prompt-QNI93ne7.cjs} +2 -2
- package/dist/shared/{src-Do34b1Pc.mjs → src-CsIMaM6C.mjs} +1157 -1367
- package/dist/shared/{src-CYvvndv2.cjs → src-D8KQ1KMN.cjs} +43 -28
- package/dist/{src-B1yRSHcw.js → src-Bv_xHi2_.js} +43 -28
- package/package.json +3 -2
- package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
- package/dist/shared/dist-DeDsdiza.mjs +0 -153
- package/dist/shared/prompt-jPdbaKAj.mjs +0 -854
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
1
|
+
import { and, arraify, code, exclude, id, include, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-BoWaIc-K.mjs";
|
|
2
|
+
import { augmentCodeLocation, error, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-B5AmHtd5.mjs";
|
|
3
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
import { fileURLToPath } from "node:url";
|
|
7
6
|
import os from "node:os";
|
|
8
7
|
import { Worker } from "node:worker_threads";
|
|
9
8
|
|
|
9
|
+
//#region rolldown:runtime
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __commonJS = (cb, mod) => function() {
|
|
17
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i$2 = 0, n$1 = keys.length, key; i$2 < n$1; i$2++) {
|
|
21
|
+
key = keys[i$2];
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
+
get: ((k) => from[k]).bind(null, key),
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
10
35
|
//#region package.json
|
|
11
|
-
var version = "1.0.0-beta.
|
|
36
|
+
var version = "1.0.0-beta.17";
|
|
12
37
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
13
38
|
|
|
14
39
|
//#endregion
|
|
@@ -27,10 +52,15 @@ function bindingifyBuiltInPlugin(plugin) {
|
|
|
27
52
|
options: plugin._options
|
|
28
53
|
};
|
|
29
54
|
}
|
|
30
|
-
var init_utils = __esm({ "src/builtin-plugin/utils.ts"() {} });
|
|
31
55
|
|
|
32
56
|
//#endregion
|
|
33
57
|
//#region src/builtin-plugin/constructors.ts
|
|
58
|
+
var BuiltinPlugin = class {
|
|
59
|
+
constructor(name, _options) {
|
|
60
|
+
this.name = name;
|
|
61
|
+
this._options = _options;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
34
64
|
function modulePreloadPolyfillPlugin(config) {
|
|
35
65
|
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
36
66
|
}
|
|
@@ -100,36 +130,24 @@ function webWorkerPostPlugin() {
|
|
|
100
130
|
function oxcRuntimePlugin(config) {
|
|
101
131
|
return new BuiltinPlugin("builtin:oxc-runtime", config);
|
|
102
132
|
}
|
|
103
|
-
var BuiltinPlugin;
|
|
104
|
-
var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
|
|
105
|
-
init_utils();
|
|
106
|
-
BuiltinPlugin = class {
|
|
107
|
-
constructor(name, _options) {
|
|
108
|
-
this.name = name;
|
|
109
|
-
this._options = _options;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
} });
|
|
113
133
|
|
|
114
134
|
//#endregion
|
|
115
135
|
//#region src/log/logging.ts
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
LOG_LEVEL_DEBUG
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
[LOG_LEVEL_SILENT]: 3
|
|
128
|
-
};
|
|
129
|
-
} });
|
|
136
|
+
const LOG_LEVEL_SILENT = "silent";
|
|
137
|
+
const LOG_LEVEL_ERROR = "error";
|
|
138
|
+
const LOG_LEVEL_WARN = "warn";
|
|
139
|
+
const LOG_LEVEL_INFO = "info";
|
|
140
|
+
const LOG_LEVEL_DEBUG = "debug";
|
|
141
|
+
const logLevelPriority = {
|
|
142
|
+
[LOG_LEVEL_DEBUG]: 0,
|
|
143
|
+
[LOG_LEVEL_INFO]: 1,
|
|
144
|
+
[LOG_LEVEL_WARN]: 2,
|
|
145
|
+
[LOG_LEVEL_SILENT]: 3
|
|
146
|
+
};
|
|
130
147
|
|
|
131
148
|
//#endregion
|
|
132
149
|
//#region src/log/log-handler.ts
|
|
150
|
+
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
133
151
|
function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
134
152
|
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
135
153
|
return (log, pos) => {
|
|
@@ -141,13 +159,6 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
|
141
159
|
logger(level, log);
|
|
142
160
|
};
|
|
143
161
|
}
|
|
144
|
-
var normalizeLog;
|
|
145
|
-
var init_log_handler = __esm({ "src/log/log-handler.ts"() {
|
|
146
|
-
init_misc();
|
|
147
|
-
init_logging();
|
|
148
|
-
init_logs();
|
|
149
|
-
normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
150
|
-
} });
|
|
151
162
|
|
|
152
163
|
//#endregion
|
|
153
164
|
//#region src/log/logger.ts
|
|
@@ -183,55 +194,47 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
|
183
194
|
};
|
|
184
195
|
return logger;
|
|
185
196
|
}
|
|
197
|
+
const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
|
|
198
|
+
const { onwarn, onLog } = config;
|
|
199
|
+
const defaultOnLog = getDefaultOnLog(printLog, onwarn);
|
|
200
|
+
if (onLog) {
|
|
201
|
+
const minimalPriority = logLevelPriority[logLevel];
|
|
202
|
+
return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
|
|
203
|
+
if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
|
|
204
|
+
if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return defaultOnLog;
|
|
208
|
+
};
|
|
209
|
+
const getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
|
|
210
|
+
if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
|
|
211
|
+
else printLog(level, log);
|
|
212
|
+
} : printLog;
|
|
213
|
+
const addLogToString = (log) => {
|
|
214
|
+
Object.defineProperty(log, "toString", {
|
|
215
|
+
value: () => getExtendedLogMessage(log),
|
|
216
|
+
writable: true
|
|
217
|
+
});
|
|
218
|
+
return log;
|
|
219
|
+
};
|
|
220
|
+
const defaultPrintLog = (level, log) => {
|
|
221
|
+
const message = getExtendedLogMessage(log);
|
|
222
|
+
switch (level) {
|
|
223
|
+
case LOG_LEVEL_WARN: return console.warn(message);
|
|
224
|
+
case LOG_LEVEL_DEBUG: return console.debug(message);
|
|
225
|
+
default: return console.info(message);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const getExtendedLogMessage = (log) => {
|
|
229
|
+
let prefix = "";
|
|
230
|
+
if (log.plugin) prefix += `(${log.plugin} plugin) `;
|
|
231
|
+
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
232
|
+
return prefix + log.message;
|
|
233
|
+
};
|
|
186
234
|
function relativeId(id$1) {
|
|
187
235
|
if (!path.isAbsolute(id$1)) return id$1;
|
|
188
236
|
return path.relative(path.resolve(), id$1);
|
|
189
237
|
}
|
|
190
|
-
var getOnLog, getDefaultOnLog, addLogToString, defaultPrintLog, getExtendedLogMessage;
|
|
191
|
-
var init_logger = __esm({ "src/log/logger.ts"() {
|
|
192
|
-
init_src();
|
|
193
|
-
init_plugin_driver();
|
|
194
|
-
init_log_handler();
|
|
195
|
-
init_logging();
|
|
196
|
-
init_logs();
|
|
197
|
-
getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
|
|
198
|
-
const { onwarn, onLog } = config;
|
|
199
|
-
const defaultOnLog = getDefaultOnLog(printLog, onwarn);
|
|
200
|
-
if (onLog) {
|
|
201
|
-
const minimalPriority = logLevelPriority[logLevel];
|
|
202
|
-
return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
|
|
203
|
-
if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
|
|
204
|
-
if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
return defaultOnLog;
|
|
208
|
-
};
|
|
209
|
-
getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
|
|
210
|
-
if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
|
|
211
|
-
else printLog(level, log);
|
|
212
|
-
} : printLog;
|
|
213
|
-
addLogToString = (log) => {
|
|
214
|
-
Object.defineProperty(log, "toString", {
|
|
215
|
-
value: () => getExtendedLogMessage(log),
|
|
216
|
-
writable: true
|
|
217
|
-
});
|
|
218
|
-
return log;
|
|
219
|
-
};
|
|
220
|
-
defaultPrintLog = (level, log) => {
|
|
221
|
-
const message = getExtendedLogMessage(log);
|
|
222
|
-
switch (level) {
|
|
223
|
-
case LOG_LEVEL_WARN: return console.warn(message);
|
|
224
|
-
case LOG_LEVEL_DEBUG: return console.debug(message);
|
|
225
|
-
default: return console.info(message);
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
getExtendedLogMessage = (log) => {
|
|
229
|
-
let prefix = "";
|
|
230
|
-
if (log.plugin) prefix += `(${log.plugin} plugin) `;
|
|
231
|
-
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
232
|
-
return prefix + log.message;
|
|
233
|
-
};
|
|
234
|
-
} });
|
|
235
238
|
|
|
236
239
|
//#endregion
|
|
237
240
|
//#region src/utils/normalize-hook.ts
|
|
@@ -251,71 +254,75 @@ function normalizeHook(hook) {
|
|
|
251
254
|
}
|
|
252
255
|
unreachable("Invalid hook type");
|
|
253
256
|
}
|
|
254
|
-
var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
|
|
255
|
-
init_misc();
|
|
256
|
-
} });
|
|
257
257
|
|
|
258
258
|
//#endregion
|
|
259
259
|
//#region src/constants/plugin.ts
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
260
|
+
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
261
|
+
"options",
|
|
262
|
+
"buildStart",
|
|
263
|
+
"resolveId",
|
|
264
|
+
"load",
|
|
265
|
+
"transform",
|
|
266
|
+
"moduleParsed",
|
|
267
|
+
"buildEnd",
|
|
268
|
+
"onLog",
|
|
269
|
+
"resolveDynamicImport",
|
|
270
|
+
"closeBundle",
|
|
271
|
+
"closeWatcher",
|
|
272
|
+
"watchChange"
|
|
273
|
+
];
|
|
274
|
+
const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
|
|
275
|
+
"augmentChunkHash",
|
|
276
|
+
"outputOptions",
|
|
277
|
+
"renderChunk",
|
|
278
|
+
"renderStart",
|
|
279
|
+
"renderError",
|
|
280
|
+
"writeBundle",
|
|
281
|
+
"generateBundle"
|
|
282
|
+
];
|
|
283
|
+
const ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
284
|
+
...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
|
|
285
|
+
...ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES,
|
|
286
|
+
"footer",
|
|
287
|
+
"banner",
|
|
288
|
+
"intro",
|
|
289
|
+
"outro"
|
|
290
|
+
];
|
|
291
|
+
/**
|
|
292
|
+
* Names of all defined hooks. It's like
|
|
293
|
+
* ```js
|
|
294
|
+
* const DEFINED_HOOK_NAMES ={
|
|
295
|
+
* options: 'options',
|
|
296
|
+
* buildStart: 'buildStart',
|
|
297
|
+
* ...
|
|
298
|
+
* }
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
const DEFINED_HOOK_NAMES = {
|
|
302
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
|
|
303
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
|
|
304
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[2]]: ENUMERATED_PLUGIN_HOOK_NAMES[2],
|
|
305
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[3]]: ENUMERATED_PLUGIN_HOOK_NAMES[3],
|
|
306
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[4]]: ENUMERATED_PLUGIN_HOOK_NAMES[4],
|
|
307
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[5]]: ENUMERATED_PLUGIN_HOOK_NAMES[5],
|
|
308
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[6]]: ENUMERATED_PLUGIN_HOOK_NAMES[6],
|
|
309
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[7]]: ENUMERATED_PLUGIN_HOOK_NAMES[7],
|
|
310
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[8]]: ENUMERATED_PLUGIN_HOOK_NAMES[8],
|
|
311
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[9]]: ENUMERATED_PLUGIN_HOOK_NAMES[9],
|
|
312
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[10]]: ENUMERATED_PLUGIN_HOOK_NAMES[10],
|
|
313
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[11]]: ENUMERATED_PLUGIN_HOOK_NAMES[11],
|
|
314
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[12]]: ENUMERATED_PLUGIN_HOOK_NAMES[12],
|
|
315
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[13]]: ENUMERATED_PLUGIN_HOOK_NAMES[13],
|
|
316
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[14]]: ENUMERATED_PLUGIN_HOOK_NAMES[14],
|
|
317
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[15]]: ENUMERATED_PLUGIN_HOOK_NAMES[15],
|
|
318
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[16]]: ENUMERATED_PLUGIN_HOOK_NAMES[16],
|
|
319
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[17]]: ENUMERATED_PLUGIN_HOOK_NAMES[17],
|
|
320
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[18]]: ENUMERATED_PLUGIN_HOOK_NAMES[18],
|
|
321
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[19]]: ENUMERATED_PLUGIN_HOOK_NAMES[19],
|
|
322
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[20]]: ENUMERATED_PLUGIN_HOOK_NAMES[20],
|
|
323
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[21]]: ENUMERATED_PLUGIN_HOOK_NAMES[21],
|
|
324
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[22]]: ENUMERATED_PLUGIN_HOOK_NAMES[22]
|
|
325
|
+
};
|
|
319
326
|
|
|
320
327
|
//#endregion
|
|
321
328
|
//#region src/utils/async-flatten.ts
|
|
@@ -325,10 +332,10 @@ async function asyncFlatten(array$1) {
|
|
|
325
332
|
while (array$1.some((v) => v?.then));
|
|
326
333
|
return array$1;
|
|
327
334
|
}
|
|
328
|
-
var init_async_flatten = __esm({ "src/utils/async-flatten.ts"() {} });
|
|
329
335
|
|
|
330
336
|
//#endregion
|
|
331
337
|
//#region src/utils/normalize-plugin-option.ts
|
|
338
|
+
const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
332
339
|
function checkOutputPluginOption(plugins, onLog) {
|
|
333
340
|
for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
|
|
334
341
|
delete plugin[hook];
|
|
@@ -344,52 +351,66 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
344
351
|
}
|
|
345
352
|
return plugins;
|
|
346
353
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
init_plugin$1();
|
|
351
|
-
init_logging();
|
|
352
|
-
init_logs();
|
|
353
|
-
init_async_flatten();
|
|
354
|
-
normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
355
|
-
ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
356
|
-
ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
357
|
-
BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
|
|
358
|
-
} });
|
|
354
|
+
const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
355
|
+
const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
356
|
+
const BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
|
|
359
357
|
|
|
360
358
|
//#endregion
|
|
361
359
|
//#region src/plugin/minimal-plugin-context.ts
|
|
362
|
-
var MinimalPluginContextImpl
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
error(e$1) {
|
|
386
|
-
return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
} });
|
|
360
|
+
var MinimalPluginContextImpl = class {
|
|
361
|
+
info;
|
|
362
|
+
warn;
|
|
363
|
+
debug;
|
|
364
|
+
meta;
|
|
365
|
+
constructor(onLog, logLevel, pluginName, watchMode, hookName) {
|
|
366
|
+
this.pluginName = pluginName;
|
|
367
|
+
this.hookName = hookName;
|
|
368
|
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
369
|
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
370
|
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
371
|
+
this.meta = {
|
|
372
|
+
rollupVersion: "4.23.0",
|
|
373
|
+
rolldownVersion: VERSION,
|
|
374
|
+
watchMode
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
error(e$1) {
|
|
378
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
|
|
379
|
+
}
|
|
380
|
+
};
|
|
390
381
|
|
|
391
382
|
//#endregion
|
|
392
383
|
//#region src/plugin/plugin-driver.ts
|
|
384
|
+
var PluginDriver = class {
|
|
385
|
+
static async callOptionsHook(inputOptions, watchMode = false) {
|
|
386
|
+
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
387
|
+
const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
|
|
388
|
+
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
389
|
+
for (const plugin of plugins) {
|
|
390
|
+
const name = plugin.name || "unknown";
|
|
391
|
+
const options = plugin.options;
|
|
392
|
+
if (options) {
|
|
393
|
+
const { handler } = normalizeHook(options);
|
|
394
|
+
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
395
|
+
if (result) inputOptions = result;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return inputOptions;
|
|
399
|
+
}
|
|
400
|
+
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
401
|
+
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
402
|
+
for (const plugin of sortedPlugins) {
|
|
403
|
+
const name = plugin.name || "unknown";
|
|
404
|
+
const options = plugin.outputOptions;
|
|
405
|
+
if (options) {
|
|
406
|
+
const { handler } = normalizeHook(options);
|
|
407
|
+
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
408
|
+
if (result) outputOptions = result;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return outputOptions;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
393
414
|
function getObjectPlugins(plugins) {
|
|
394
415
|
return plugins.filter((plugin) => {
|
|
395
416
|
if (!plugin) return void 0;
|
|
@@ -424,48 +445,10 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
424
445
|
...post
|
|
425
446
|
];
|
|
426
447
|
}
|
|
427
|
-
var PluginDriver;
|
|
428
|
-
var init_plugin_driver = __esm({ "src/plugin/plugin-driver.ts"() {
|
|
429
|
-
init_constructors();
|
|
430
|
-
init_logger();
|
|
431
|
-
init_logging();
|
|
432
|
-
init_normalize_hook();
|
|
433
|
-
init_normalize_plugin_option();
|
|
434
|
-
init_minimal_plugin_context();
|
|
435
|
-
PluginDriver = class {
|
|
436
|
-
static async callOptionsHook(inputOptions, watchMode = false) {
|
|
437
|
-
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
438
|
-
const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
|
|
439
|
-
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
440
|
-
for (const plugin of plugins) {
|
|
441
|
-
const name = plugin.name || "unknown";
|
|
442
|
-
const options = plugin.options;
|
|
443
|
-
if (options) {
|
|
444
|
-
const { handler } = normalizeHook(options);
|
|
445
|
-
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
446
|
-
if (result) inputOptions = result;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
return inputOptions;
|
|
450
|
-
}
|
|
451
|
-
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
452
|
-
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
453
|
-
for (const plugin of sortedPlugins) {
|
|
454
|
-
const name = plugin.name || "unknown";
|
|
455
|
-
const options = plugin.outputOptions;
|
|
456
|
-
if (options) {
|
|
457
|
-
const { handler } = normalizeHook(options);
|
|
458
|
-
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
459
|
-
if (result) outputOptions = result;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
return outputOptions;
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
} });
|
|
466
448
|
|
|
467
449
|
//#endregion
|
|
468
450
|
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js
|
|
451
|
+
var store$1;
|
|
469
452
|
/* @__NO_SIDE_EFFECTS__ */
|
|
470
453
|
function getGlobalConfig(config2) {
|
|
471
454
|
return {
|
|
@@ -475,14 +458,17 @@ function getGlobalConfig(config2) {
|
|
|
475
458
|
abortPipeEarly: config2?.abortPipeEarly ?? store$1?.abortPipeEarly
|
|
476
459
|
};
|
|
477
460
|
}
|
|
461
|
+
var store2;
|
|
478
462
|
/* @__NO_SIDE_EFFECTS__ */
|
|
479
463
|
function getGlobalMessage(lang) {
|
|
480
464
|
return store2?.get(lang);
|
|
481
465
|
}
|
|
466
|
+
var store3;
|
|
482
467
|
/* @__NO_SIDE_EFFECTS__ */
|
|
483
468
|
function getSchemaMessage(lang) {
|
|
484
469
|
return store3?.get(lang);
|
|
485
470
|
}
|
|
471
|
+
var store4;
|
|
486
472
|
/* @__NO_SIDE_EFFECTS__ */
|
|
487
473
|
function getSpecificMessage(reference, lang) {
|
|
488
474
|
return store4?.get(reference)?.get(lang);
|
|
@@ -540,6 +526,18 @@ function _joinExpects(values2, separator) {
|
|
|
540
526
|
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
541
527
|
return list[0] ?? "never";
|
|
542
528
|
}
|
|
529
|
+
var ValiError = class extends Error {
|
|
530
|
+
/**
|
|
531
|
+
* Creates a Valibot error with useful information.
|
|
532
|
+
*
|
|
533
|
+
* @param issues The error issues.
|
|
534
|
+
*/
|
|
535
|
+
constructor(issues) {
|
|
536
|
+
super(issues[0].message);
|
|
537
|
+
this.name = "ValiError";
|
|
538
|
+
this.issues = issues;
|
|
539
|
+
}
|
|
540
|
+
};
|
|
543
541
|
/* @__NO_SIDE_EFFECTS__ */
|
|
544
542
|
function args(schema) {
|
|
545
543
|
return {
|
|
@@ -1436,21 +1434,6 @@ function safeParse(schema, input, config2) {
|
|
|
1436
1434
|
issues: dataset.issues
|
|
1437
1435
|
};
|
|
1438
1436
|
}
|
|
1439
|
-
var store$1, store2, store3, store4, ValiError;
|
|
1440
|
-
var init_dist$3 = __esm({ "../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js"() {
|
|
1441
|
-
ValiError = class extends Error {
|
|
1442
|
-
/**
|
|
1443
|
-
* Creates a Valibot error with useful information.
|
|
1444
|
-
*
|
|
1445
|
-
* @param issues The error issues.
|
|
1446
|
-
*/
|
|
1447
|
-
constructor(issues) {
|
|
1448
|
-
super(issues[0].message);
|
|
1449
|
-
this.name = "ValiError";
|
|
1450
|
-
this.issues = issues;
|
|
1451
|
-
}
|
|
1452
|
-
};
|
|
1453
|
-
} });
|
|
1454
1437
|
|
|
1455
1438
|
//#endregion
|
|
1456
1439
|
//#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.3.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js
|
|
@@ -1668,6 +1651,7 @@ function convertAction(jsonSchema, valibotAction, config) {
|
|
|
1668
1651
|
function flattenPipe(pipe$1) {
|
|
1669
1652
|
return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
|
|
1670
1653
|
}
|
|
1654
|
+
let refCount = 0;
|
|
1671
1655
|
/**
|
|
1672
1656
|
* Converts any supported Valibot schema to the JSON Schema format.
|
|
1673
1657
|
*
|
|
@@ -1851,6 +1835,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
|
|
|
1851
1835
|
if (errors) for (const message of errors) handleError(message, config);
|
|
1852
1836
|
return jsonSchema;
|
|
1853
1837
|
}
|
|
1838
|
+
let store;
|
|
1854
1839
|
/**
|
|
1855
1840
|
* Returns the current global schema definitions.
|
|
1856
1841
|
*
|
|
@@ -1884,11 +1869,6 @@ function toJsonSchema(schema, config) {
|
|
|
1884
1869
|
if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
|
|
1885
1870
|
return jsonSchema;
|
|
1886
1871
|
}
|
|
1887
|
-
var refCount, store;
|
|
1888
|
-
var init_dist$2 = __esm({ "../../node_modules/.pnpm/@valibot+to-json-schema@1.3.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js"() {
|
|
1889
|
-
init_dist$3();
|
|
1890
|
-
refCount = 0;
|
|
1891
|
-
} });
|
|
1892
1872
|
|
|
1893
1873
|
//#endregion
|
|
1894
1874
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
|
|
@@ -1997,15 +1977,376 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
|
|
|
1997
1977
|
|
|
1998
1978
|
//#endregion
|
|
1999
1979
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
|
|
2000
|
-
var import_ansis
|
|
2001
|
-
var
|
|
2002
|
-
|
|
2003
|
-
ansis_default = import_ansis.default;
|
|
2004
|
-
({Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright} = import_ansis.default);
|
|
2005
|
-
} });
|
|
1980
|
+
var import_ansis = __toESM(require_ansis(), 1);
|
|
1981
|
+
var ansis_default = import_ansis.default;
|
|
1982
|
+
const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
|
|
2006
1983
|
|
|
2007
1984
|
//#endregion
|
|
2008
1985
|
//#region src/utils/validator.ts
|
|
1986
|
+
const StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
1987
|
+
const LogLevelSchema = union([
|
|
1988
|
+
literal("debug"),
|
|
1989
|
+
literal("info"),
|
|
1990
|
+
literal("warn")
|
|
1991
|
+
]);
|
|
1992
|
+
const LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
|
|
1993
|
+
const LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
|
|
1994
|
+
const RollupLogSchema = any();
|
|
1995
|
+
const RollupLogWithStringSchema = union([RollupLogSchema, string()]);
|
|
1996
|
+
const InputOptionSchema = union([
|
|
1997
|
+
string(),
|
|
1998
|
+
array(string()),
|
|
1999
|
+
record(string(), string())
|
|
2000
|
+
]);
|
|
2001
|
+
const ExternalSchema = union([
|
|
2002
|
+
StringOrRegExpSchema,
|
|
2003
|
+
array(StringOrRegExpSchema),
|
|
2004
|
+
pipe(function_(), args(tuple([
|
|
2005
|
+
string(),
|
|
2006
|
+
optional(string()),
|
|
2007
|
+
boolean()
|
|
2008
|
+
])), returns(nullish(boolean())))
|
|
2009
|
+
]);
|
|
2010
|
+
const ModuleTypesSchema = record(string(), union([
|
|
2011
|
+
literal("asset"),
|
|
2012
|
+
literal("base64"),
|
|
2013
|
+
literal("binary"),
|
|
2014
|
+
literal("css"),
|
|
2015
|
+
literal("dataurl"),
|
|
2016
|
+
literal("empty"),
|
|
2017
|
+
literal("js"),
|
|
2018
|
+
literal("json"),
|
|
2019
|
+
literal("jsx"),
|
|
2020
|
+
literal("text"),
|
|
2021
|
+
literal("ts"),
|
|
2022
|
+
literal("tsx")
|
|
2023
|
+
]));
|
|
2024
|
+
const JsxOptionsSchema = strictObject({
|
|
2025
|
+
runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
|
|
2026
|
+
development: pipe(optional(boolean()), description("Development specific information")),
|
|
2027
|
+
throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
2028
|
+
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
2029
|
+
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
2030
|
+
pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
2031
|
+
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
2032
|
+
});
|
|
2033
|
+
const RollupJsxOptionsSchema = strictObject({
|
|
2034
|
+
mode: optional(union([
|
|
2035
|
+
literal("classic"),
|
|
2036
|
+
literal("automatic"),
|
|
2037
|
+
literal("preserve")
|
|
2038
|
+
])),
|
|
2039
|
+
factory: optional(string()),
|
|
2040
|
+
fragment: optional(string()),
|
|
2041
|
+
importSource: optional(string()),
|
|
2042
|
+
jsxImportSource: optional(string())
|
|
2043
|
+
});
|
|
2044
|
+
const HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
2045
|
+
const DecoratorOptionSchema = object({
|
|
2046
|
+
legacy: optional(boolean()),
|
|
2047
|
+
emitDecoratorMetadata: optional(boolean())
|
|
2048
|
+
});
|
|
2049
|
+
const HelpersSchema = object({ mode: optional(HelperModeSchema) });
|
|
2050
|
+
const RewriteImportExtensionsSchema = union([
|
|
2051
|
+
literal("rewrite"),
|
|
2052
|
+
literal("remove"),
|
|
2053
|
+
boolean()
|
|
2054
|
+
]);
|
|
2055
|
+
const TypescriptSchema = object({
|
|
2056
|
+
jsxPragma: optional(string()),
|
|
2057
|
+
jsxPragmaFrag: optional(string()),
|
|
2058
|
+
onlyRemoveTypeImports: optional(boolean()),
|
|
2059
|
+
allowNamespaces: optional(boolean()),
|
|
2060
|
+
allowDeclareFields: optional(boolean()),
|
|
2061
|
+
declaration: optional(object({
|
|
2062
|
+
stripInternal: optional(boolean()),
|
|
2063
|
+
sourcemap: optional(boolean())
|
|
2064
|
+
})),
|
|
2065
|
+
rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
|
|
2066
|
+
});
|
|
2067
|
+
const AssumptionsSchema = object({
|
|
2068
|
+
ignoreFunctionLength: optional(boolean()),
|
|
2069
|
+
noDocumentAll: optional(boolean()),
|
|
2070
|
+
objectRestNoSymbols: optional(boolean()),
|
|
2071
|
+
pureGetters: optional(boolean()),
|
|
2072
|
+
setPublicClassFields: optional(boolean())
|
|
2073
|
+
});
|
|
2074
|
+
const TransformOptionsSchema = object({
|
|
2075
|
+
assumptions: optional(AssumptionsSchema),
|
|
2076
|
+
typescript: optional(TypescriptSchema),
|
|
2077
|
+
helpers: optional(HelpersSchema),
|
|
2078
|
+
decorators: optional(DecoratorOptionSchema),
|
|
2079
|
+
jsx: optional(JsxOptionsSchema),
|
|
2080
|
+
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2081
|
+
});
|
|
2082
|
+
const WatchOptionsSchema = strictObject({
|
|
2083
|
+
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
2084
|
+
exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2085
|
+
include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2086
|
+
notify: pipe(optional(strictObject({
|
|
2087
|
+
compareContents: optional(boolean()),
|
|
2088
|
+
pollInterval: optional(number())
|
|
2089
|
+
})), description("Notify options")),
|
|
2090
|
+
skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
|
|
2091
|
+
buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
|
|
2092
|
+
});
|
|
2093
|
+
const ChecksOptionsSchema = strictObject({
|
|
2094
|
+
circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
|
|
2095
|
+
eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
|
|
2096
|
+
missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
|
|
2097
|
+
missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
|
|
2098
|
+
mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
|
|
2099
|
+
unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
|
|
2100
|
+
unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
|
|
2101
|
+
filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
|
|
2102
|
+
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2103
|
+
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2104
|
+
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2105
|
+
});
|
|
2106
|
+
const MinifyOptionsSchema = strictObject({
|
|
2107
|
+
mangle: optional(boolean()),
|
|
2108
|
+
compress: optional(boolean()),
|
|
2109
|
+
removeWhitespace: optional(boolean())
|
|
2110
|
+
});
|
|
2111
|
+
const ResolveOptionsSchema = strictObject({
|
|
2112
|
+
alias: optional(record(string(), union([string(), array(string())]))),
|
|
2113
|
+
aliasFields: optional(array(array(string()))),
|
|
2114
|
+
conditionNames: optional(array(string())),
|
|
2115
|
+
extensionAlias: optional(record(string(), array(string()))),
|
|
2116
|
+
exportsFields: optional(array(array(string()))),
|
|
2117
|
+
extensions: optional(array(string())),
|
|
2118
|
+
mainFields: optional(array(string())),
|
|
2119
|
+
mainFiles: optional(array(string())),
|
|
2120
|
+
modules: optional(array(string())),
|
|
2121
|
+
symlinks: optional(boolean()),
|
|
2122
|
+
tsconfigFilename: optional(string())
|
|
2123
|
+
});
|
|
2124
|
+
const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2125
|
+
annotations: optional(boolean()),
|
|
2126
|
+
manualPureFunctions: optional(array(string())),
|
|
2127
|
+
unknownGlobalSideEffects: optional(boolean())
|
|
2128
|
+
})]);
|
|
2129
|
+
const OnLogSchema = pipe(function_(), args(tuple([
|
|
2130
|
+
LogLevelSchema,
|
|
2131
|
+
RollupLogSchema,
|
|
2132
|
+
pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
2133
|
+
])));
|
|
2134
|
+
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2135
|
+
const HmrSchema = union([boolean(), strictObject({
|
|
2136
|
+
port: optional(number()),
|
|
2137
|
+
host: optional(string()),
|
|
2138
|
+
implement: optional(string())
|
|
2139
|
+
})]);
|
|
2140
|
+
const InputOptionsSchema = strictObject({
|
|
2141
|
+
input: optional(InputOptionSchema),
|
|
2142
|
+
plugins: optional(custom(() => true)),
|
|
2143
|
+
external: optional(ExternalSchema),
|
|
2144
|
+
makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
|
|
2145
|
+
resolve: optional(ResolveOptionsSchema),
|
|
2146
|
+
cwd: pipe(optional(string()), description("Current working directory")),
|
|
2147
|
+
platform: pipe(optional(union([
|
|
2148
|
+
literal("browser"),
|
|
2149
|
+
literal("neutral"),
|
|
2150
|
+
literal("node")
|
|
2151
|
+
])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
|
|
2152
|
+
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2153
|
+
treeshake: optional(TreeshakingOptionsSchema),
|
|
2154
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
|
|
2155
|
+
onLog: optional(OnLogSchema),
|
|
2156
|
+
onwarn: optional(OnwarnSchema),
|
|
2157
|
+
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
2158
|
+
experimental: optional(strictObject({
|
|
2159
|
+
disableLiveBindings: optional(boolean()),
|
|
2160
|
+
enableComposingJsPlugins: optional(boolean()),
|
|
2161
|
+
resolveNewUrlToAsset: optional(boolean()),
|
|
2162
|
+
strictExecutionOrder: optional(boolean()),
|
|
2163
|
+
hmr: optional(HmrSchema),
|
|
2164
|
+
attachDebugInfo: optional(union([
|
|
2165
|
+
literal("none"),
|
|
2166
|
+
literal("simple"),
|
|
2167
|
+
literal("full")
|
|
2168
|
+
]))
|
|
2169
|
+
})),
|
|
2170
|
+
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2171
|
+
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2172
|
+
profilerNames: optional(boolean()),
|
|
2173
|
+
jsx: optional(union([
|
|
2174
|
+
literal(false),
|
|
2175
|
+
literal("react"),
|
|
2176
|
+
literal("react-jsx"),
|
|
2177
|
+
literal("preserve"),
|
|
2178
|
+
RollupJsxOptionsSchema
|
|
2179
|
+
])),
|
|
2180
|
+
transform: optional(TransformOptionsSchema),
|
|
2181
|
+
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2182
|
+
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
2183
|
+
checks: optional(ChecksOptionsSchema),
|
|
2184
|
+
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
2185
|
+
debug: pipe(optional(object({ sessionId: pipe(optional(string()), description("Used to name the build.")) })), description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.")),
|
|
2186
|
+
preserveEntrySignatures: pipe(optional(union([
|
|
2187
|
+
literal("strict"),
|
|
2188
|
+
literal("allow-extension"),
|
|
2189
|
+
literal("exports-only"),
|
|
2190
|
+
literal(false)
|
|
2191
|
+
])))
|
|
2192
|
+
});
|
|
2193
|
+
const InputCliOverrideSchema = strictObject({
|
|
2194
|
+
input: pipe(optional(array(string())), description("Entry file")),
|
|
2195
|
+
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2196
|
+
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2197
|
+
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2198
|
+
makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
|
|
2199
|
+
jsx: pipe(optional(union([
|
|
2200
|
+
literal(false),
|
|
2201
|
+
literal("react"),
|
|
2202
|
+
literal("react-jsx"),
|
|
2203
|
+
literal("preserve")
|
|
2204
|
+
])), description("Jsx options preset")),
|
|
2205
|
+
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
|
|
2206
|
+
});
|
|
2207
|
+
const InputCliOptionsSchema = omit(strictObject({
|
|
2208
|
+
...InputOptionsSchema.entries,
|
|
2209
|
+
...InputCliOverrideSchema.entries
|
|
2210
|
+
}), [
|
|
2211
|
+
"plugins",
|
|
2212
|
+
"onwarn",
|
|
2213
|
+
"onLog",
|
|
2214
|
+
"resolve",
|
|
2215
|
+
"experimental",
|
|
2216
|
+
"profilerNames",
|
|
2217
|
+
"watch"
|
|
2218
|
+
]);
|
|
2219
|
+
const ModuleFormatSchema = union([
|
|
2220
|
+
literal("es"),
|
|
2221
|
+
literal("cjs"),
|
|
2222
|
+
literal("esm"),
|
|
2223
|
+
literal("module"),
|
|
2224
|
+
literal("commonjs"),
|
|
2225
|
+
literal("iife"),
|
|
2226
|
+
literal("umd")
|
|
2227
|
+
]);
|
|
2228
|
+
const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
2229
|
+
const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2230
|
+
const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2231
|
+
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2232
|
+
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2233
|
+
const AdvancedChunksSchema = strictObject({
|
|
2234
|
+
minSize: optional(number()),
|
|
2235
|
+
maxSize: optional(number()),
|
|
2236
|
+
minModuleSize: optional(number()),
|
|
2237
|
+
maxModuleSize: optional(number()),
|
|
2238
|
+
minShareCount: optional(number()),
|
|
2239
|
+
groups: optional(array(strictObject({
|
|
2240
|
+
name: string(),
|
|
2241
|
+
test: optional(union([
|
|
2242
|
+
string(),
|
|
2243
|
+
instance(RegExp),
|
|
2244
|
+
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
2245
|
+
])),
|
|
2246
|
+
priority: optional(number()),
|
|
2247
|
+
minSize: optional(number()),
|
|
2248
|
+
minShareCount: optional(number()),
|
|
2249
|
+
maxSize: optional(number()),
|
|
2250
|
+
minModuleSize: optional(number()),
|
|
2251
|
+
maxModuleSize: optional(number())
|
|
2252
|
+
})))
|
|
2253
|
+
});
|
|
2254
|
+
const OutputOptionsSchema = strictObject({
|
|
2255
|
+
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2256
|
+
file: pipe(optional(string()), description("Single output file")),
|
|
2257
|
+
exports: pipe(optional(union([
|
|
2258
|
+
literal("auto"),
|
|
2259
|
+
literal("named"),
|
|
2260
|
+
literal("default"),
|
|
2261
|
+
literal("none")
|
|
2262
|
+
])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
|
|
2263
|
+
hashCharacters: pipe(optional(union([
|
|
2264
|
+
literal("base64"),
|
|
2265
|
+
literal("base36"),
|
|
2266
|
+
literal("hex")
|
|
2267
|
+
])), description("Use the specified character set for file hashes")),
|
|
2268
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
|
|
2269
|
+
sourcemap: pipe(optional(union([
|
|
2270
|
+
boolean(),
|
|
2271
|
+
literal("inline"),
|
|
2272
|
+
literal("hidden")
|
|
2273
|
+
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2274
|
+
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2275
|
+
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
2276
|
+
sourcemapPathTransform: optional(custom(() => true)),
|
|
2277
|
+
banner: optional(union([string(), AddonFunctionSchema])),
|
|
2278
|
+
footer: optional(union([string(), AddonFunctionSchema])),
|
|
2279
|
+
intro: optional(union([string(), AddonFunctionSchema])),
|
|
2280
|
+
outro: optional(union([string(), AddonFunctionSchema])),
|
|
2281
|
+
extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2282
|
+
esModule: optional(union([boolean(), literal("if-default-prop")])),
|
|
2283
|
+
assetFileNames: optional(AssetFileNamesSchema),
|
|
2284
|
+
entryFileNames: optional(ChunkFileNamesSchema),
|
|
2285
|
+
chunkFileNames: optional(ChunkFileNamesSchema),
|
|
2286
|
+
cssEntryFileNames: optional(ChunkFileNamesSchema),
|
|
2287
|
+
cssChunkFileNames: optional(ChunkFileNamesSchema),
|
|
2288
|
+
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2289
|
+
minify: pipe(optional(union([
|
|
2290
|
+
boolean(),
|
|
2291
|
+
string("dce-only"),
|
|
2292
|
+
MinifyOptionsSchema
|
|
2293
|
+
])), description("Minify the bundled file")),
|
|
2294
|
+
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2295
|
+
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2296
|
+
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2297
|
+
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2298
|
+
manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
|
|
2299
|
+
advancedChunks: optional(AdvancedChunksSchema),
|
|
2300
|
+
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2301
|
+
plugins: optional(custom(() => true)),
|
|
2302
|
+
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2303
|
+
hoistTransitiveImports: optional(custom((input) => {
|
|
2304
|
+
if (input) return false;
|
|
2305
|
+
return true;
|
|
2306
|
+
}, () => `The 'true' value is not supported`)),
|
|
2307
|
+
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2308
|
+
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2309
|
+
virtualDirname: optional(string())
|
|
2310
|
+
});
|
|
2311
|
+
const getAddonDescription = (placement, wrapper) => {
|
|
2312
|
+
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
2313
|
+
};
|
|
2314
|
+
const OutputCliOverrideSchema = strictObject({
|
|
2315
|
+
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
2316
|
+
entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
|
|
2317
|
+
chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
|
|
2318
|
+
cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
|
|
2319
|
+
cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
|
|
2320
|
+
sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
|
|
2321
|
+
banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
|
|
2322
|
+
footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
|
|
2323
|
+
intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
|
|
2324
|
+
outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
|
|
2325
|
+
esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2326
|
+
globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2327
|
+
advancedChunks: pipe(optional(strictObject({
|
|
2328
|
+
minSize: pipe(optional(number()), description("Minimum size of the chunk")),
|
|
2329
|
+
minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
|
|
2330
|
+
})), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2331
|
+
minify: pipe(optional(boolean()), description("Minify the bundled file"))
|
|
2332
|
+
});
|
|
2333
|
+
const OutputCliOptionsSchema = omit(strictObject({
|
|
2334
|
+
...OutputOptionsSchema.entries,
|
|
2335
|
+
...OutputCliOverrideSchema.entries
|
|
2336
|
+
}), [
|
|
2337
|
+
"sourcemapIgnoreList",
|
|
2338
|
+
"sourcemapPathTransform",
|
|
2339
|
+
"plugins",
|
|
2340
|
+
"hoistTransitiveImports"
|
|
2341
|
+
]);
|
|
2342
|
+
const CliOptionsSchema = strictObject({
|
|
2343
|
+
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2344
|
+
help: pipe(optional(boolean()), description("Show help")),
|
|
2345
|
+
version: pipe(optional(boolean()), description("Show version number")),
|
|
2346
|
+
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2347
|
+
...InputCliOptionsSchema.entries,
|
|
2348
|
+
...OutputCliOptionsSchema.entries
|
|
2349
|
+
});
|
|
2009
2350
|
function validateCliOptions(options) {
|
|
2010
2351
|
let parsed = safeParse(CliOptionsSchema, options);
|
|
2011
2352
|
return [parsed.output, parsed.issues?.map((issue) => {
|
|
@@ -2013,6 +2354,8 @@ function validateCliOptions(options) {
|
|
|
2013
2354
|
return `Invalid value for option ${option}: ${issue.message}`;
|
|
2014
2355
|
})];
|
|
2015
2356
|
}
|
|
2357
|
+
const inputHelperMsgRecord = { output: { ignored: true } };
|
|
2358
|
+
const outputHelperMsgRecord = {};
|
|
2016
2359
|
function validateOption(key, options) {
|
|
2017
2360
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2018
2361
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
@@ -2044,406 +2387,38 @@ function getOutputCliKeys() {
|
|
|
2044
2387
|
function getJsonSchema() {
|
|
2045
2388
|
return toJsonSchema(CliOptionsSchema, { errorMode: "ignore" });
|
|
2046
2389
|
}
|
|
2047
|
-
var StringOrRegExpSchema, LogLevelSchema, LogLevelOptionSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, InputOptionSchema, ExternalSchema, ModuleTypesSchema, JsxOptionsSchema, RollupJsxOptionsSchema, HelperModeSchema, DecoratorOptionSchema, HelpersSchema, RewriteImportExtensionsSchema, TypescriptSchema, AssumptionsSchema, TransformOptionsSchema, WatchOptionsSchema, ChecksOptionsSchema, MinifyOptionsSchema, ResolveOptionsSchema, TreeshakingOptionsSchema, OnLogSchema, OnwarnSchema, HmrSchema, InputOptionsSchema, InputCliOverrideSchema, InputCliOptionsSchema, ModuleFormatSchema, AddonFunctionSchema, ChunkFileNamesSchema, AssetFileNamesSchema, SanitizeFileNameSchema, GlobalsFunctionSchema, AdvancedChunksSchema, OutputOptionsSchema, getAddonDescription, OutputCliOverrideSchema, OutputCliOptionsSchema, CliOptionsSchema, inputHelperMsgRecord, outputHelperMsgRecord;
|
|
2048
|
-
var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
2049
|
-
init_dist$2();
|
|
2050
|
-
init_ansis();
|
|
2051
|
-
init_dist$3();
|
|
2052
|
-
StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
2053
|
-
LogLevelSchema = union([
|
|
2054
|
-
literal("debug"),
|
|
2055
|
-
literal("info"),
|
|
2056
|
-
literal("warn")
|
|
2057
|
-
]);
|
|
2058
|
-
LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
|
|
2059
|
-
LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
|
|
2060
|
-
RollupLogSchema = any();
|
|
2061
|
-
RollupLogWithStringSchema = union([RollupLogSchema, string()]);
|
|
2062
|
-
InputOptionSchema = union([
|
|
2063
|
-
string(),
|
|
2064
|
-
array(string()),
|
|
2065
|
-
record(string(), string())
|
|
2066
|
-
]);
|
|
2067
|
-
ExternalSchema = union([
|
|
2068
|
-
StringOrRegExpSchema,
|
|
2069
|
-
array(StringOrRegExpSchema),
|
|
2070
|
-
pipe(function_(), args(tuple([
|
|
2071
|
-
string(),
|
|
2072
|
-
optional(string()),
|
|
2073
|
-
boolean()
|
|
2074
|
-
])), returns(nullish(boolean())))
|
|
2075
|
-
]);
|
|
2076
|
-
ModuleTypesSchema = record(string(), union([
|
|
2077
|
-
literal("asset"),
|
|
2078
|
-
literal("base64"),
|
|
2079
|
-
literal("binary"),
|
|
2080
|
-
literal("css"),
|
|
2081
|
-
literal("dataurl"),
|
|
2082
|
-
literal("empty"),
|
|
2083
|
-
literal("js"),
|
|
2084
|
-
literal("json"),
|
|
2085
|
-
literal("jsx"),
|
|
2086
|
-
literal("text"),
|
|
2087
|
-
literal("ts"),
|
|
2088
|
-
literal("tsx")
|
|
2089
|
-
]));
|
|
2090
|
-
JsxOptionsSchema = strictObject({
|
|
2091
|
-
runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
|
|
2092
|
-
development: pipe(optional(boolean()), description("Development specific information")),
|
|
2093
|
-
throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
2094
|
-
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
2095
|
-
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
2096
|
-
pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
2097
|
-
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
2098
|
-
});
|
|
2099
|
-
RollupJsxOptionsSchema = strictObject({
|
|
2100
|
-
mode: optional(union([
|
|
2101
|
-
literal("classic"),
|
|
2102
|
-
literal("automatic"),
|
|
2103
|
-
literal("preserve")
|
|
2104
|
-
])),
|
|
2105
|
-
factory: optional(string()),
|
|
2106
|
-
fragment: optional(string()),
|
|
2107
|
-
importSource: optional(string()),
|
|
2108
|
-
jsxImportSource: optional(string())
|
|
2109
|
-
});
|
|
2110
|
-
HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
2111
|
-
DecoratorOptionSchema = object({
|
|
2112
|
-
legacy: optional(boolean()),
|
|
2113
|
-
emitDecoratorMetadata: optional(boolean())
|
|
2114
|
-
});
|
|
2115
|
-
HelpersSchema = object({ mode: optional(HelperModeSchema) });
|
|
2116
|
-
RewriteImportExtensionsSchema = union([
|
|
2117
|
-
literal("rewrite"),
|
|
2118
|
-
literal("remove"),
|
|
2119
|
-
boolean()
|
|
2120
|
-
]);
|
|
2121
|
-
TypescriptSchema = object({
|
|
2122
|
-
jsxPragma: optional(string()),
|
|
2123
|
-
jsxPragmaFrag: optional(string()),
|
|
2124
|
-
onlyRemoveTypeImports: optional(boolean()),
|
|
2125
|
-
allowNamespaces: optional(boolean()),
|
|
2126
|
-
allowDeclareFields: optional(boolean()),
|
|
2127
|
-
declaration: optional(object({
|
|
2128
|
-
stripInternal: optional(boolean()),
|
|
2129
|
-
sourcemap: optional(boolean())
|
|
2130
|
-
})),
|
|
2131
|
-
rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
|
|
2132
|
-
});
|
|
2133
|
-
AssumptionsSchema = object({
|
|
2134
|
-
ignoreFunctionLength: optional(boolean()),
|
|
2135
|
-
noDocumentAll: optional(boolean()),
|
|
2136
|
-
objectRestNoSymbols: optional(boolean()),
|
|
2137
|
-
pureGetters: optional(boolean()),
|
|
2138
|
-
setPublicClassFields: optional(boolean())
|
|
2139
|
-
});
|
|
2140
|
-
TransformOptionsSchema = object({
|
|
2141
|
-
assumptions: optional(AssumptionsSchema),
|
|
2142
|
-
typescript: optional(TypescriptSchema),
|
|
2143
|
-
helpers: optional(HelpersSchema),
|
|
2144
|
-
decorators: optional(DecoratorOptionSchema),
|
|
2145
|
-
jsx: optional(JsxOptionsSchema),
|
|
2146
|
-
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2147
|
-
});
|
|
2148
|
-
WatchOptionsSchema = strictObject({
|
|
2149
|
-
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
2150
|
-
exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2151
|
-
include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2152
|
-
notify: pipe(optional(strictObject({
|
|
2153
|
-
compareContents: optional(boolean()),
|
|
2154
|
-
pollInterval: optional(number())
|
|
2155
|
-
})), description("Notify options")),
|
|
2156
|
-
skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
|
|
2157
|
-
buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
|
|
2158
|
-
});
|
|
2159
|
-
ChecksOptionsSchema = strictObject({
|
|
2160
|
-
circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
|
|
2161
|
-
eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
|
|
2162
|
-
missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
|
|
2163
|
-
missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
|
|
2164
|
-
mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
|
|
2165
|
-
unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
|
|
2166
|
-
unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
|
|
2167
|
-
filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
|
|
2168
|
-
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2169
|
-
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2170
|
-
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2171
|
-
});
|
|
2172
|
-
MinifyOptionsSchema = strictObject({
|
|
2173
|
-
mangle: optional(boolean()),
|
|
2174
|
-
compress: optional(boolean()),
|
|
2175
|
-
removeWhitespace: optional(boolean())
|
|
2176
|
-
});
|
|
2177
|
-
ResolveOptionsSchema = strictObject({
|
|
2178
|
-
alias: optional(record(string(), union([string(), array(string())]))),
|
|
2179
|
-
aliasFields: optional(array(array(string()))),
|
|
2180
|
-
conditionNames: optional(array(string())),
|
|
2181
|
-
extensionAlias: optional(record(string(), array(string()))),
|
|
2182
|
-
exportsFields: optional(array(array(string()))),
|
|
2183
|
-
extensions: optional(array(string())),
|
|
2184
|
-
mainFields: optional(array(string())),
|
|
2185
|
-
mainFiles: optional(array(string())),
|
|
2186
|
-
modules: optional(array(string())),
|
|
2187
|
-
symlinks: optional(boolean()),
|
|
2188
|
-
tsconfigFilename: optional(string())
|
|
2189
|
-
});
|
|
2190
|
-
TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2191
|
-
annotations: optional(boolean()),
|
|
2192
|
-
manualPureFunctions: optional(array(string())),
|
|
2193
|
-
unknownGlobalSideEffects: optional(boolean())
|
|
2194
|
-
})]);
|
|
2195
|
-
OnLogSchema = pipe(function_(), args(tuple([
|
|
2196
|
-
LogLevelSchema,
|
|
2197
|
-
RollupLogSchema,
|
|
2198
|
-
pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
2199
|
-
])));
|
|
2200
|
-
OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2201
|
-
HmrSchema = union([boolean(), strictObject({
|
|
2202
|
-
port: optional(number()),
|
|
2203
|
-
host: optional(string()),
|
|
2204
|
-
implement: optional(string())
|
|
2205
|
-
})]);
|
|
2206
|
-
InputOptionsSchema = strictObject({
|
|
2207
|
-
input: optional(InputOptionSchema),
|
|
2208
|
-
plugins: optional(custom(() => true)),
|
|
2209
|
-
external: optional(ExternalSchema),
|
|
2210
|
-
makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
|
|
2211
|
-
resolve: optional(ResolveOptionsSchema),
|
|
2212
|
-
cwd: pipe(optional(string()), description("Current working directory")),
|
|
2213
|
-
platform: pipe(optional(union([
|
|
2214
|
-
literal("browser"),
|
|
2215
|
-
literal("neutral"),
|
|
2216
|
-
literal("node")
|
|
2217
|
-
])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
|
|
2218
|
-
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2219
|
-
treeshake: optional(TreeshakingOptionsSchema),
|
|
2220
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
|
|
2221
|
-
onLog: optional(OnLogSchema),
|
|
2222
|
-
onwarn: optional(OnwarnSchema),
|
|
2223
|
-
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
2224
|
-
experimental: optional(strictObject({
|
|
2225
|
-
disableLiveBindings: optional(boolean()),
|
|
2226
|
-
enableComposingJsPlugins: optional(boolean()),
|
|
2227
|
-
resolveNewUrlToAsset: optional(boolean()),
|
|
2228
|
-
strictExecutionOrder: optional(boolean()),
|
|
2229
|
-
hmr: optional(HmrSchema),
|
|
2230
|
-
attachDebugInfo: optional(boolean())
|
|
2231
|
-
})),
|
|
2232
|
-
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2233
|
-
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2234
|
-
profilerNames: optional(boolean()),
|
|
2235
|
-
jsx: optional(union([
|
|
2236
|
-
literal(false),
|
|
2237
|
-
literal("react"),
|
|
2238
|
-
literal("react-jsx"),
|
|
2239
|
-
literal("preserve"),
|
|
2240
|
-
RollupJsxOptionsSchema
|
|
2241
|
-
])),
|
|
2242
|
-
transform: optional(TransformOptionsSchema),
|
|
2243
|
-
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2244
|
-
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
2245
|
-
checks: optional(ChecksOptionsSchema),
|
|
2246
|
-
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
2247
|
-
debug: pipe(optional(object({ sessionId: pipe(optional(string()), description("Used to name the build.")) })), description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly.")),
|
|
2248
|
-
preserveEntrySignatures: pipe(optional(union([
|
|
2249
|
-
literal("strict"),
|
|
2250
|
-
literal("allow-extension"),
|
|
2251
|
-
literal("exports-only"),
|
|
2252
|
-
literal(false)
|
|
2253
|
-
])))
|
|
2254
|
-
});
|
|
2255
|
-
InputCliOverrideSchema = strictObject({
|
|
2256
|
-
input: pipe(optional(array(string())), description("Entry file")),
|
|
2257
|
-
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2258
|
-
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2259
|
-
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2260
|
-
makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
|
|
2261
|
-
jsx: pipe(optional(union([
|
|
2262
|
-
literal(false),
|
|
2263
|
-
literal("react"),
|
|
2264
|
-
literal("react-jsx"),
|
|
2265
|
-
literal("preserve")
|
|
2266
|
-
])), description("Jsx options preset")),
|
|
2267
|
-
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
|
|
2268
|
-
});
|
|
2269
|
-
InputCliOptionsSchema = omit(strictObject({
|
|
2270
|
-
...InputOptionsSchema.entries,
|
|
2271
|
-
...InputCliOverrideSchema.entries
|
|
2272
|
-
}), [
|
|
2273
|
-
"plugins",
|
|
2274
|
-
"onwarn",
|
|
2275
|
-
"onLog",
|
|
2276
|
-
"resolve",
|
|
2277
|
-
"experimental",
|
|
2278
|
-
"profilerNames",
|
|
2279
|
-
"watch"
|
|
2280
|
-
]);
|
|
2281
|
-
ModuleFormatSchema = union([
|
|
2282
|
-
literal("es"),
|
|
2283
|
-
literal("cjs"),
|
|
2284
|
-
literal("esm"),
|
|
2285
|
-
literal("module"),
|
|
2286
|
-
literal("commonjs"),
|
|
2287
|
-
literal("iife"),
|
|
2288
|
-
literal("umd")
|
|
2289
|
-
]);
|
|
2290
|
-
AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
2291
|
-
ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2292
|
-
AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2293
|
-
SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2294
|
-
GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2295
|
-
AdvancedChunksSchema = strictObject({
|
|
2296
|
-
minSize: optional(number()),
|
|
2297
|
-
maxSize: optional(number()),
|
|
2298
|
-
minModuleSize: optional(number()),
|
|
2299
|
-
maxModuleSize: optional(number()),
|
|
2300
|
-
minShareCount: optional(number()),
|
|
2301
|
-
groups: optional(array(strictObject({
|
|
2302
|
-
name: string(),
|
|
2303
|
-
test: optional(union([
|
|
2304
|
-
string(),
|
|
2305
|
-
instance(RegExp),
|
|
2306
|
-
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
2307
|
-
])),
|
|
2308
|
-
priority: optional(number()),
|
|
2309
|
-
minSize: optional(number()),
|
|
2310
|
-
minShareCount: optional(number()),
|
|
2311
|
-
maxSize: optional(number()),
|
|
2312
|
-
minModuleSize: optional(number()),
|
|
2313
|
-
maxModuleSize: optional(number())
|
|
2314
|
-
})))
|
|
2315
|
-
});
|
|
2316
|
-
OutputOptionsSchema = strictObject({
|
|
2317
|
-
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2318
|
-
file: pipe(optional(string()), description("Single output file")),
|
|
2319
|
-
exports: pipe(optional(union([
|
|
2320
|
-
literal("auto"),
|
|
2321
|
-
literal("named"),
|
|
2322
|
-
literal("default"),
|
|
2323
|
-
literal("none")
|
|
2324
|
-
])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
|
|
2325
|
-
hashCharacters: pipe(optional(union([
|
|
2326
|
-
literal("base64"),
|
|
2327
|
-
literal("base36"),
|
|
2328
|
-
literal("hex")
|
|
2329
|
-
])), description("Use the specified character set for file hashes")),
|
|
2330
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
|
|
2331
|
-
sourcemap: pipe(optional(union([
|
|
2332
|
-
boolean(),
|
|
2333
|
-
literal("inline"),
|
|
2334
|
-
literal("hidden")
|
|
2335
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2336
|
-
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2337
|
-
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
2338
|
-
sourcemapPathTransform: optional(custom(() => true)),
|
|
2339
|
-
banner: optional(union([string(), AddonFunctionSchema])),
|
|
2340
|
-
footer: optional(union([string(), AddonFunctionSchema])),
|
|
2341
|
-
intro: optional(union([string(), AddonFunctionSchema])),
|
|
2342
|
-
outro: optional(union([string(), AddonFunctionSchema])),
|
|
2343
|
-
extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2344
|
-
esModule: optional(union([boolean(), literal("if-default-prop")])),
|
|
2345
|
-
assetFileNames: optional(AssetFileNamesSchema),
|
|
2346
|
-
entryFileNames: optional(ChunkFileNamesSchema),
|
|
2347
|
-
chunkFileNames: optional(ChunkFileNamesSchema),
|
|
2348
|
-
cssEntryFileNames: optional(ChunkFileNamesSchema),
|
|
2349
|
-
cssChunkFileNames: optional(ChunkFileNamesSchema),
|
|
2350
|
-
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2351
|
-
minify: pipe(optional(union([
|
|
2352
|
-
boolean(),
|
|
2353
|
-
string("dce-only"),
|
|
2354
|
-
MinifyOptionsSchema
|
|
2355
|
-
])), description("Minify the bundled file")),
|
|
2356
|
-
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2357
|
-
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2358
|
-
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2359
|
-
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2360
|
-
manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
|
|
2361
|
-
advancedChunks: optional(AdvancedChunksSchema),
|
|
2362
|
-
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2363
|
-
plugins: optional(custom(() => true)),
|
|
2364
|
-
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2365
|
-
hoistTransitiveImports: optional(custom((input) => {
|
|
2366
|
-
if (input) return false;
|
|
2367
|
-
return true;
|
|
2368
|
-
}, () => `The 'true' value is not supported`)),
|
|
2369
|
-
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2370
|
-
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2371
|
-
virtualDirname: optional(string())
|
|
2372
|
-
});
|
|
2373
|
-
getAddonDescription = (placement, wrapper) => {
|
|
2374
|
-
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
2375
|
-
};
|
|
2376
|
-
OutputCliOverrideSchema = strictObject({
|
|
2377
|
-
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
2378
|
-
entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
|
|
2379
|
-
chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
|
|
2380
|
-
cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
|
|
2381
|
-
cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
|
|
2382
|
-
sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
|
|
2383
|
-
banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
|
|
2384
|
-
footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
|
|
2385
|
-
intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
|
|
2386
|
-
outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
|
|
2387
|
-
esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2388
|
-
globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2389
|
-
advancedChunks: pipe(optional(strictObject({
|
|
2390
|
-
minSize: pipe(optional(number()), description("Minimum size of the chunk")),
|
|
2391
|
-
minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
|
|
2392
|
-
})), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2393
|
-
minify: pipe(optional(boolean()), description("Minify the bundled file"))
|
|
2394
|
-
});
|
|
2395
|
-
OutputCliOptionsSchema = omit(strictObject({
|
|
2396
|
-
...OutputOptionsSchema.entries,
|
|
2397
|
-
...OutputCliOverrideSchema.entries
|
|
2398
|
-
}), [
|
|
2399
|
-
"sourcemapIgnoreList",
|
|
2400
|
-
"sourcemapPathTransform",
|
|
2401
|
-
"plugins",
|
|
2402
|
-
"hoistTransitiveImports"
|
|
2403
|
-
]);
|
|
2404
|
-
CliOptionsSchema = strictObject({
|
|
2405
|
-
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2406
|
-
help: pipe(optional(boolean()), description("Show help")),
|
|
2407
|
-
version: pipe(optional(boolean()), description("Show version number")),
|
|
2408
|
-
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2409
|
-
...InputCliOptionsSchema.entries,
|
|
2410
|
-
...OutputCliOptionsSchema.entries
|
|
2411
|
-
});
|
|
2412
|
-
inputHelperMsgRecord = { output: { ignored: true } };
|
|
2413
|
-
outputHelperMsgRecord = {};
|
|
2414
|
-
} });
|
|
2415
2390
|
|
|
2416
2391
|
//#endregion
|
|
2417
2392
|
//#region src/constants/plugin-context.ts
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2393
|
+
/**
|
|
2394
|
+
* If Composed plugins call `this.resolve` with `skipSelf: true`, the composed plugins will be skipped as a whole.
|
|
2395
|
+
* To prevent that, we use this symbol to store the actual caller of `this.resolve` with `skipSelf: true`. And we
|
|
2396
|
+
* will modify the skipSelf option to `false` and use this symbol to skip the caller itself in the composed plugins
|
|
2397
|
+
* internally.
|
|
2398
|
+
*/
|
|
2399
|
+
const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
2422
2400
|
|
|
2423
2401
|
//#endregion
|
|
2424
2402
|
//#region src/options/normalized-input-options.ts
|
|
2425
|
-
var NormalizedInputOptionsImpl
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
}
|
|
2445
|
-
};
|
|
2446
|
-
} });
|
|
2403
|
+
var NormalizedInputOptionsImpl = class {
|
|
2404
|
+
inner;
|
|
2405
|
+
constructor(inner, onLog) {
|
|
2406
|
+
this.onLog = onLog;
|
|
2407
|
+
this.inner = inner;
|
|
2408
|
+
}
|
|
2409
|
+
get shimMissingExports() {
|
|
2410
|
+
return this.inner.shimMissingExports;
|
|
2411
|
+
}
|
|
2412
|
+
get input() {
|
|
2413
|
+
return this.inner.input;
|
|
2414
|
+
}
|
|
2415
|
+
get cwd() {
|
|
2416
|
+
return this.inner.cwd ?? void 0;
|
|
2417
|
+
}
|
|
2418
|
+
get platform() {
|
|
2419
|
+
return this.inner.platform;
|
|
2420
|
+
}
|
|
2421
|
+
};
|
|
2447
2422
|
|
|
2448
2423
|
//#endregion
|
|
2449
2424
|
//#region src/types/sourcemap.ts
|
|
@@ -2460,12 +2435,11 @@ function bindingifySourcemap(map) {
|
|
|
2460
2435
|
debugId: "debugId" in map ? map.debugId : void 0
|
|
2461
2436
|
} };
|
|
2462
2437
|
}
|
|
2463
|
-
var init_sourcemap = __esm({ "src/types/sourcemap.ts"() {} });
|
|
2464
2438
|
|
|
2465
2439
|
//#endregion
|
|
2466
2440
|
//#region src/utils/error.ts
|
|
2467
2441
|
function normalizeErrors(rawErrors) {
|
|
2468
|
-
const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(new Error(), {
|
|
2442
|
+
const errors = rawErrors.map((e$1) => e$1 instanceof Error ? e$1 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2469
2443
|
kind: e$1.kind,
|
|
2470
2444
|
message: e$1.message,
|
|
2471
2445
|
stack: void 0
|
|
@@ -2511,7 +2485,6 @@ function getErrorMessage(e$1) {
|
|
|
2511
2485
|
function joinNewLine(s1, s2) {
|
|
2512
2486
|
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
2513
2487
|
}
|
|
2514
|
-
var init_error = __esm({ "src/utils/error.ts"() {} });
|
|
2515
2488
|
|
|
2516
2489
|
//#endregion
|
|
2517
2490
|
//#region src/utils/transform-module-info.ts
|
|
@@ -2533,9 +2506,6 @@ function transformModuleInfo(info, option) {
|
|
|
2533
2506
|
...option
|
|
2534
2507
|
};
|
|
2535
2508
|
}
|
|
2536
|
-
var init_transform_module_info = __esm({ "src/utils/transform-module-info.ts"() {
|
|
2537
|
-
init_misc();
|
|
2538
|
-
} });
|
|
2539
2509
|
|
|
2540
2510
|
//#endregion
|
|
2541
2511
|
//#region src/utils/transform-side-effects.ts
|
|
@@ -2549,7 +2519,6 @@ function bindingifySideEffects(sideEffects) {
|
|
|
2549
2519
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
2550
2520
|
}
|
|
2551
2521
|
}
|
|
2552
|
-
var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"() {} });
|
|
2553
2522
|
|
|
2554
2523
|
//#endregion
|
|
2555
2524
|
//#region src/utils/transform-sourcemap.ts
|
|
@@ -2565,10 +2534,9 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
|
2565
2534
|
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
|
|
2566
2535
|
return map;
|
|
2567
2536
|
}
|
|
2568
|
-
var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
|
|
2569
2537
|
|
|
2570
2538
|
//#endregion
|
|
2571
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2539
|
+
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2572
2540
|
function u$1(o$1, n$1, a$2) {
|
|
2573
2541
|
let t$2 = (r$1) => o$1(r$1, ...n$1);
|
|
2574
2542
|
return a$2 === void 0 ? t$2 : Object.assign(t$2, {
|
|
@@ -2576,50 +2544,32 @@ function u$1(o$1, n$1, a$2) {
|
|
|
2576
2544
|
lazyArgs: n$1
|
|
2577
2545
|
});
|
|
2578
2546
|
}
|
|
2579
|
-
var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
|
|
2580
2547
|
|
|
2581
2548
|
//#endregion
|
|
2582
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2549
|
+
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
2583
2550
|
function u(r$1, n$1, o$1) {
|
|
2584
2551
|
let a$2 = r$1.length - n$1.length;
|
|
2585
2552
|
if (a$2 === 0) return r$1(...n$1);
|
|
2586
2553
|
if (a$2 === 1) return u$1(r$1, n$1, o$1);
|
|
2587
2554
|
throw new Error("Wrong number of arguments");
|
|
2588
2555
|
}
|
|
2589
|
-
var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
|
|
2590
|
-
init_chunk_D6FCK2GA();
|
|
2591
|
-
} });
|
|
2592
2556
|
|
|
2593
2557
|
//#endregion
|
|
2594
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2558
|
+
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
|
|
2595
2559
|
function d(...r$1) {
|
|
2596
2560
|
return u(i, r$1);
|
|
2597
2561
|
}
|
|
2598
|
-
var i
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
for (let [o$1, e$1] of r$1.entries()) t$2(e$1, o$1, r$1) ? a$2[0].push(e$1) : a$2[1].push(e$1);
|
|
2604
|
-
return a$2;
|
|
2605
|
-
};
|
|
2606
|
-
} });
|
|
2562
|
+
var i = (r$1, t$2) => {
|
|
2563
|
+
let a$2 = [[], []];
|
|
2564
|
+
for (let [o$1, e$1] of r$1.entries()) t$2(e$1, o$1, r$1) ? a$2[0].push(e$1) : a$2[1].push(e$1);
|
|
2565
|
+
return a$2;
|
|
2566
|
+
};
|
|
2607
2567
|
|
|
2608
2568
|
//#endregion
|
|
2609
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2569
|
+
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2610
2570
|
function t(...n$1) {
|
|
2611
2571
|
return u(Object.keys, n$1);
|
|
2612
2572
|
}
|
|
2613
|
-
var init_chunk_5NQBDF4H = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js"() {
|
|
2614
|
-
init_chunk_WIMGWYZL();
|
|
2615
|
-
} });
|
|
2616
|
-
|
|
2617
|
-
//#endregion
|
|
2618
|
-
//#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/index.js
|
|
2619
|
-
var init_dist$1 = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/index.js"() {
|
|
2620
|
-
init_chunk_3IFJP4R5();
|
|
2621
|
-
init_chunk_5NQBDF4H();
|
|
2622
|
-
} });
|
|
2623
2573
|
|
|
2624
2574
|
//#endregion
|
|
2625
2575
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
@@ -2761,11 +2711,6 @@ function bindingifyRenderChunkFilter(filterOption) {
|
|
|
2761
2711
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2762
2712
|
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2763
2713
|
}
|
|
2764
|
-
var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
|
|
2765
|
-
init_dist();
|
|
2766
|
-
init_dist$1();
|
|
2767
|
-
init_misc();
|
|
2768
|
-
} });
|
|
2769
2714
|
|
|
2770
2715
|
//#endregion
|
|
2771
2716
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
@@ -2781,7 +2726,6 @@ function bindingPluginOrder(order) {
|
|
|
2781
2726
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
2782
2727
|
}
|
|
2783
2728
|
}
|
|
2784
|
-
var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {} });
|
|
2785
2729
|
|
|
2786
2730
|
//#endregion
|
|
2787
2731
|
//#region src/utils/asset-source.ts
|
|
@@ -2791,150 +2735,132 @@ function transformAssetSource(bindingAssetSource$1) {
|
|
|
2791
2735
|
function bindingAssetSource(source) {
|
|
2792
2736
|
return { inner: source };
|
|
2793
2737
|
}
|
|
2794
|
-
var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
|
|
2795
2738
|
|
|
2796
2739
|
//#endregion
|
|
2797
2740
|
//#region src/plugin/plugin-context.ts
|
|
2798
|
-
var PluginContextImpl
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
}
|
|
2819
|
-
async load(options) {
|
|
2820
|
-
const id$1 = options.id;
|
|
2821
|
-
if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
2822
|
-
const moduleInfo = this.data.getModuleInfo(id$1, this.context);
|
|
2823
|
-
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
2824
|
-
const rawOptions = {
|
|
2825
|
-
meta: options.meta || {},
|
|
2826
|
-
moduleSideEffects: options.moduleSideEffects || null,
|
|
2827
|
-
invalidate: false
|
|
2828
|
-
};
|
|
2829
|
-
this.data.updateModuleOption(id$1, rawOptions);
|
|
2830
|
-
async function createLoadModulePromise(context, data) {
|
|
2831
|
-
const loadPromise = data.loadModulePromiseMap.get(id$1);
|
|
2832
|
-
if (loadPromise) return loadPromise;
|
|
2833
|
-
const promise$1 = new Promise((resolve, _) => {
|
|
2834
|
-
data.loadModulePromiseResolveFnMap.set(id$1, resolve);
|
|
2835
|
-
});
|
|
2836
|
-
data.loadModulePromiseMap.set(id$1, promise$1);
|
|
2837
|
-
try {
|
|
2838
|
-
await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
|
|
2839
|
-
} catch (e$1) {
|
|
2840
|
-
data.loadModulePromiseMap.delete(id$1);
|
|
2841
|
-
data.loadModulePromiseResolveFnMap.delete(id$1);
|
|
2842
|
-
throw e$1;
|
|
2843
|
-
}
|
|
2844
|
-
return promise$1;
|
|
2845
|
-
}
|
|
2846
|
-
await createLoadModulePromise(this.context, this.data);
|
|
2847
|
-
return this.data.getModuleInfo(id$1, this.context);
|
|
2848
|
-
}
|
|
2849
|
-
async resolve(source, importer, options) {
|
|
2850
|
-
let receipt = void 0;
|
|
2851
|
-
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
2852
|
-
const res = await this.context.resolve(source, importer, {
|
|
2853
|
-
custom: receipt,
|
|
2854
|
-
skipSelf: options?.skipSelf
|
|
2855
|
-
});
|
|
2856
|
-
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
2857
|
-
if (res == null) return null;
|
|
2858
|
-
const info = this.data.getModuleOption(res.id) || {};
|
|
2859
|
-
return {
|
|
2860
|
-
...res,
|
|
2861
|
-
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2862
|
-
...info
|
|
2863
|
-
};
|
|
2864
|
-
}
|
|
2865
|
-
emitFile = (file) => {
|
|
2866
|
-
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
2867
|
-
if (file.type === "chunk") return this.context.emitChunk({
|
|
2868
|
-
preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
|
|
2869
|
-
...file
|
|
2870
|
-
});
|
|
2871
|
-
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
2872
|
-
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
2873
|
-
return this.context.emitFile({
|
|
2874
|
-
...file,
|
|
2875
|
-
originalFileName: file.originalFileName || void 0,
|
|
2876
|
-
source: bindingAssetSource(file.source)
|
|
2877
|
-
}, filename, fnSanitizedFileName);
|
|
2741
|
+
var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
2742
|
+
getModuleInfo;
|
|
2743
|
+
constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
|
|
2744
|
+
super(onLog, logLevel, plugin.name, watchMode);
|
|
2745
|
+
this.outputOptions = outputOptions;
|
|
2746
|
+
this.context = context;
|
|
2747
|
+
this.data = data;
|
|
2748
|
+
this.onLog = onLog;
|
|
2749
|
+
this.currentLoadingModule = currentLoadingModule;
|
|
2750
|
+
this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
|
|
2751
|
+
}
|
|
2752
|
+
async load(options) {
|
|
2753
|
+
const id$1 = options.id;
|
|
2754
|
+
if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
2755
|
+
const moduleInfo = this.data.getModuleInfo(id$1, this.context);
|
|
2756
|
+
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
2757
|
+
const rawOptions = {
|
|
2758
|
+
meta: options.meta || {},
|
|
2759
|
+
moduleSideEffects: options.moduleSideEffects || null,
|
|
2760
|
+
invalidate: false
|
|
2878
2761
|
};
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2762
|
+
this.data.updateModuleOption(id$1, rawOptions);
|
|
2763
|
+
async function createLoadModulePromise(context, data) {
|
|
2764
|
+
const loadPromise = data.loadModulePromiseMap.get(id$1);
|
|
2765
|
+
if (loadPromise) return loadPromise;
|
|
2766
|
+
const promise$1 = new Promise((resolve, _) => {
|
|
2767
|
+
data.loadModulePromiseResolveFnMap.set(id$1, resolve);
|
|
2885
2768
|
});
|
|
2769
|
+
data.loadModulePromiseMap.set(id$1, promise$1);
|
|
2770
|
+
try {
|
|
2771
|
+
await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
|
|
2772
|
+
} catch (e$1) {
|
|
2773
|
+
data.loadModulePromiseMap.delete(id$1);
|
|
2774
|
+
data.loadModulePromiseResolveFnMap.delete(id$1);
|
|
2775
|
+
throw e$1;
|
|
2776
|
+
}
|
|
2777
|
+
return promise$1;
|
|
2886
2778
|
}
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2779
|
+
await createLoadModulePromise(this.context, this.data);
|
|
2780
|
+
return this.data.getModuleInfo(id$1, this.context);
|
|
2781
|
+
}
|
|
2782
|
+
async resolve(source, importer, options) {
|
|
2783
|
+
let receipt = void 0;
|
|
2784
|
+
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
2785
|
+
const res = await this.context.resolve(source, importer, {
|
|
2786
|
+
custom: receipt,
|
|
2787
|
+
skipSelf: options?.skipSelf
|
|
2788
|
+
});
|
|
2789
|
+
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
2790
|
+
if (res == null) return null;
|
|
2791
|
+
const info = this.data.getModuleOption(res.id) || {};
|
|
2792
|
+
return {
|
|
2793
|
+
...res,
|
|
2794
|
+
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2795
|
+
...info
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
emitFile = (file) => {
|
|
2799
|
+
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
2800
|
+
if (file.type === "chunk") return this.context.emitChunk({
|
|
2801
|
+
preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
|
|
2802
|
+
...file
|
|
2803
|
+
});
|
|
2804
|
+
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
2805
|
+
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
2806
|
+
return this.context.emitFile({
|
|
2807
|
+
...file,
|
|
2808
|
+
originalFileName: file.originalFileName || void 0,
|
|
2809
|
+
source: bindingAssetSource(file.source)
|
|
2810
|
+
}, filename, fnSanitizedFileName);
|
|
2899
2811
|
};
|
|
2900
|
-
|
|
2812
|
+
getAssetFileNames(file) {
|
|
2813
|
+
if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
|
|
2814
|
+
names: file.name ? [file.name] : [],
|
|
2815
|
+
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
|
2816
|
+
source: file.source,
|
|
2817
|
+
type: "asset"
|
|
2818
|
+
});
|
|
2819
|
+
}
|
|
2820
|
+
getFileName(referenceId) {
|
|
2821
|
+
return this.context.getFileName(referenceId);
|
|
2822
|
+
}
|
|
2823
|
+
getModuleIds() {
|
|
2824
|
+
return this.data.getModuleIds(this.context);
|
|
2825
|
+
}
|
|
2826
|
+
addWatchFile(id$1) {
|
|
2827
|
+
this.context.addWatchFile(id$1);
|
|
2828
|
+
}
|
|
2829
|
+
parse(input, options) {
|
|
2830
|
+
return parseAst(input, options);
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2901
2833
|
|
|
2902
2834
|
//#endregion
|
|
2903
2835
|
//#region src/plugin/transform-plugin-context.ts
|
|
2904
|
-
var TransformPluginContextImpl
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
error(e$1,
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
}
|
|
2933
|
-
getCombinedSourcemap() {
|
|
2934
|
-
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
2935
|
-
}
|
|
2936
|
-
};
|
|
2937
|
-
} });
|
|
2836
|
+
var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
2837
|
+
constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
|
|
2838
|
+
super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
|
|
2839
|
+
this.inner = inner;
|
|
2840
|
+
this.moduleId = moduleId;
|
|
2841
|
+
this.moduleSource = moduleSource;
|
|
2842
|
+
const getLogHandler$1 = (handler) => (log, pos) => {
|
|
2843
|
+
log = normalizeLog(log);
|
|
2844
|
+
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
2845
|
+
log.id = moduleId;
|
|
2846
|
+
log.hook = "transform";
|
|
2847
|
+
handler(log);
|
|
2848
|
+
};
|
|
2849
|
+
this.debug = getLogHandler$1(this.debug);
|
|
2850
|
+
this.warn = getLogHandler$1(this.warn);
|
|
2851
|
+
this.info = getLogHandler$1(this.info);
|
|
2852
|
+
}
|
|
2853
|
+
error(e$1, pos) {
|
|
2854
|
+
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
2855
|
+
if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
|
|
2856
|
+
e$1.id = this.moduleId;
|
|
2857
|
+
e$1.hook = "transform";
|
|
2858
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName));
|
|
2859
|
+
}
|
|
2860
|
+
getCombinedSourcemap() {
|
|
2861
|
+
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
2862
|
+
}
|
|
2863
|
+
};
|
|
2938
2864
|
|
|
2939
2865
|
//#endregion
|
|
2940
2866
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
@@ -3099,20 +3025,6 @@ function bindingifyModuleParsed(args$1) {
|
|
|
3099
3025
|
meta: bindingifyPluginHookMeta(meta)
|
|
3100
3026
|
};
|
|
3101
3027
|
}
|
|
3102
|
-
var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
|
|
3103
|
-
init_normalize_hook();
|
|
3104
|
-
init_plugin_context$1();
|
|
3105
|
-
init_normalized_input_options();
|
|
3106
|
-
init_sourcemap();
|
|
3107
|
-
init_error();
|
|
3108
|
-
init_transform_module_info();
|
|
3109
|
-
init_transform_side_effects();
|
|
3110
|
-
init_transform_sourcemap();
|
|
3111
|
-
init_bindingify_hook_filter();
|
|
3112
|
-
init_bindingify_plugin_hook_meta();
|
|
3113
|
-
init_plugin_context();
|
|
3114
|
-
init_transform_plugin_context();
|
|
3115
|
-
} });
|
|
3116
3028
|
|
|
3117
3029
|
//#endregion
|
|
3118
3030
|
//#region src/utils/transform-rendered-module.ts
|
|
@@ -3129,7 +3041,6 @@ function transformToRenderedModule(bindingRenderedModule) {
|
|
|
3129
3041
|
}
|
|
3130
3042
|
};
|
|
3131
3043
|
}
|
|
3132
|
-
var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
|
|
3133
3044
|
|
|
3134
3045
|
//#endregion
|
|
3135
3046
|
//#region src/utils/transform-rendered-chunk.ts
|
|
@@ -3179,9 +3090,6 @@ function transformChunkModules(modules) {
|
|
|
3179
3090
|
}
|
|
3180
3091
|
return result;
|
|
3181
3092
|
}
|
|
3182
|
-
var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
|
|
3183
|
-
init_transform_rendered_module();
|
|
3184
|
-
} });
|
|
3185
3093
|
|
|
3186
3094
|
//#endregion
|
|
3187
3095
|
//#region src/utils/bindingify-output-options.ts
|
|
@@ -3266,125 +3174,116 @@ function bindingifyAssetFilenames(assetFileNames) {
|
|
|
3266
3174
|
};
|
|
3267
3175
|
return assetFileNames;
|
|
3268
3176
|
}
|
|
3269
|
-
var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
|
|
3270
|
-
init_asset_source();
|
|
3271
|
-
init_misc();
|
|
3272
|
-
init_transform_rendered_chunk();
|
|
3273
|
-
} });
|
|
3274
3177
|
|
|
3275
3178
|
//#endregion
|
|
3276
3179
|
//#region src/options/normalized-output-options.ts
|
|
3180
|
+
var NormalizedOutputOptionsImpl = class {
|
|
3181
|
+
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3182
|
+
this.inner = inner;
|
|
3183
|
+
this.outputOptions = outputOptions;
|
|
3184
|
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3185
|
+
}
|
|
3186
|
+
get dir() {
|
|
3187
|
+
return this.inner.dir ?? void 0;
|
|
3188
|
+
}
|
|
3189
|
+
get entryFileNames() {
|
|
3190
|
+
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3191
|
+
}
|
|
3192
|
+
get chunkFileNames() {
|
|
3193
|
+
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3194
|
+
}
|
|
3195
|
+
get assetFileNames() {
|
|
3196
|
+
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3197
|
+
}
|
|
3198
|
+
get format() {
|
|
3199
|
+
return this.inner.format;
|
|
3200
|
+
}
|
|
3201
|
+
get exports() {
|
|
3202
|
+
return this.inner.exports;
|
|
3203
|
+
}
|
|
3204
|
+
get sourcemap() {
|
|
3205
|
+
return this.inner.sourcemap;
|
|
3206
|
+
}
|
|
3207
|
+
get cssEntryFileNames() {
|
|
3208
|
+
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3209
|
+
}
|
|
3210
|
+
get cssChunkFileNames() {
|
|
3211
|
+
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3212
|
+
}
|
|
3213
|
+
get shimMissingExports() {
|
|
3214
|
+
return this.inner.shimMissingExports;
|
|
3215
|
+
}
|
|
3216
|
+
get name() {
|
|
3217
|
+
return this.inner.name ?? void 0;
|
|
3218
|
+
}
|
|
3219
|
+
get file() {
|
|
3220
|
+
return this.inner.file ?? void 0;
|
|
3221
|
+
}
|
|
3222
|
+
get inlineDynamicImports() {
|
|
3223
|
+
return this.inner.inlineDynamicImports;
|
|
3224
|
+
}
|
|
3225
|
+
get externalLiveBindings() {
|
|
3226
|
+
return this.inner.externalLiveBindings;
|
|
3227
|
+
}
|
|
3228
|
+
get banner() {
|
|
3229
|
+
return normalizeAddon(this.outputOptions.banner);
|
|
3230
|
+
}
|
|
3231
|
+
get footer() {
|
|
3232
|
+
return normalizeAddon(this.outputOptions.footer);
|
|
3233
|
+
}
|
|
3234
|
+
get intro() {
|
|
3235
|
+
return normalizeAddon(this.outputOptions.intro);
|
|
3236
|
+
}
|
|
3237
|
+
get outro() {
|
|
3238
|
+
return normalizeAddon(this.outputOptions.outro);
|
|
3239
|
+
}
|
|
3240
|
+
get esModule() {
|
|
3241
|
+
return this.inner.esModule;
|
|
3242
|
+
}
|
|
3243
|
+
get extend() {
|
|
3244
|
+
return this.inner.extend;
|
|
3245
|
+
}
|
|
3246
|
+
get globals() {
|
|
3247
|
+
return this.inner.globals || this.outputOptions.globals;
|
|
3248
|
+
}
|
|
3249
|
+
get hashCharacters() {
|
|
3250
|
+
return this.inner.hashCharacters;
|
|
3251
|
+
}
|
|
3252
|
+
get sourcemapDebugIds() {
|
|
3253
|
+
return this.inner.sourcemapDebugIds;
|
|
3254
|
+
}
|
|
3255
|
+
get sourcemapIgnoreList() {
|
|
3256
|
+
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
3257
|
+
}
|
|
3258
|
+
get sourcemapPathTransform() {
|
|
3259
|
+
return this.outputOptions.sourcemapPathTransform;
|
|
3260
|
+
}
|
|
3261
|
+
get minify() {
|
|
3262
|
+
return this.inner.minify;
|
|
3263
|
+
}
|
|
3264
|
+
get legalComments() {
|
|
3265
|
+
return this.inner.legalComments;
|
|
3266
|
+
}
|
|
3267
|
+
get polyfillRequire() {
|
|
3268
|
+
return this.inner.polyfillRequire;
|
|
3269
|
+
}
|
|
3270
|
+
get plugins() {
|
|
3271
|
+
return this.normalizedOutputPlugins;
|
|
3272
|
+
}
|
|
3273
|
+
get preserveModules() {
|
|
3274
|
+
return this.inner.preserveModules;
|
|
3275
|
+
}
|
|
3276
|
+
get preserveModulesRoot() {
|
|
3277
|
+
return this.inner.preserveModulesRoot;
|
|
3278
|
+
}
|
|
3279
|
+
get virtualDirname() {
|
|
3280
|
+
return this.inner.virtualDirname;
|
|
3281
|
+
}
|
|
3282
|
+
};
|
|
3277
3283
|
function normalizeAddon(value) {
|
|
3278
3284
|
if (typeof value === "function") return value;
|
|
3279
3285
|
return () => value || "";
|
|
3280
3286
|
}
|
|
3281
|
-
var NormalizedOutputOptionsImpl;
|
|
3282
|
-
var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
|
|
3283
|
-
init_bindingify_output_options();
|
|
3284
|
-
NormalizedOutputOptionsImpl = class {
|
|
3285
|
-
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3286
|
-
this.inner = inner;
|
|
3287
|
-
this.outputOptions = outputOptions;
|
|
3288
|
-
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3289
|
-
}
|
|
3290
|
-
get dir() {
|
|
3291
|
-
return this.inner.dir ?? void 0;
|
|
3292
|
-
}
|
|
3293
|
-
get entryFileNames() {
|
|
3294
|
-
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3295
|
-
}
|
|
3296
|
-
get chunkFileNames() {
|
|
3297
|
-
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3298
|
-
}
|
|
3299
|
-
get assetFileNames() {
|
|
3300
|
-
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3301
|
-
}
|
|
3302
|
-
get format() {
|
|
3303
|
-
return this.inner.format;
|
|
3304
|
-
}
|
|
3305
|
-
get exports() {
|
|
3306
|
-
return this.inner.exports;
|
|
3307
|
-
}
|
|
3308
|
-
get sourcemap() {
|
|
3309
|
-
return this.inner.sourcemap;
|
|
3310
|
-
}
|
|
3311
|
-
get cssEntryFileNames() {
|
|
3312
|
-
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3313
|
-
}
|
|
3314
|
-
get cssChunkFileNames() {
|
|
3315
|
-
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3316
|
-
}
|
|
3317
|
-
get shimMissingExports() {
|
|
3318
|
-
return this.inner.shimMissingExports;
|
|
3319
|
-
}
|
|
3320
|
-
get name() {
|
|
3321
|
-
return this.inner.name ?? void 0;
|
|
3322
|
-
}
|
|
3323
|
-
get file() {
|
|
3324
|
-
return this.inner.file ?? void 0;
|
|
3325
|
-
}
|
|
3326
|
-
get inlineDynamicImports() {
|
|
3327
|
-
return this.inner.inlineDynamicImports;
|
|
3328
|
-
}
|
|
3329
|
-
get externalLiveBindings() {
|
|
3330
|
-
return this.inner.externalLiveBindings;
|
|
3331
|
-
}
|
|
3332
|
-
get banner() {
|
|
3333
|
-
return normalizeAddon(this.outputOptions.banner);
|
|
3334
|
-
}
|
|
3335
|
-
get footer() {
|
|
3336
|
-
return normalizeAddon(this.outputOptions.footer);
|
|
3337
|
-
}
|
|
3338
|
-
get intro() {
|
|
3339
|
-
return normalizeAddon(this.outputOptions.intro);
|
|
3340
|
-
}
|
|
3341
|
-
get outro() {
|
|
3342
|
-
return normalizeAddon(this.outputOptions.outro);
|
|
3343
|
-
}
|
|
3344
|
-
get esModule() {
|
|
3345
|
-
return this.inner.esModule;
|
|
3346
|
-
}
|
|
3347
|
-
get extend() {
|
|
3348
|
-
return this.inner.extend;
|
|
3349
|
-
}
|
|
3350
|
-
get globals() {
|
|
3351
|
-
return this.inner.globals || this.outputOptions.globals;
|
|
3352
|
-
}
|
|
3353
|
-
get hashCharacters() {
|
|
3354
|
-
return this.inner.hashCharacters;
|
|
3355
|
-
}
|
|
3356
|
-
get sourcemapDebugIds() {
|
|
3357
|
-
return this.inner.sourcemapDebugIds;
|
|
3358
|
-
}
|
|
3359
|
-
get sourcemapIgnoreList() {
|
|
3360
|
-
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
3361
|
-
}
|
|
3362
|
-
get sourcemapPathTransform() {
|
|
3363
|
-
return this.outputOptions.sourcemapPathTransform;
|
|
3364
|
-
}
|
|
3365
|
-
get minify() {
|
|
3366
|
-
return this.inner.minify;
|
|
3367
|
-
}
|
|
3368
|
-
get legalComments() {
|
|
3369
|
-
return this.inner.legalComments;
|
|
3370
|
-
}
|
|
3371
|
-
get polyfillRequire() {
|
|
3372
|
-
return this.inner.polyfillRequire;
|
|
3373
|
-
}
|
|
3374
|
-
get plugins() {
|
|
3375
|
-
return this.normalizedOutputPlugins;
|
|
3376
|
-
}
|
|
3377
|
-
get preserveModules() {
|
|
3378
|
-
return this.outputOptions.preserveModules || false;
|
|
3379
|
-
}
|
|
3380
|
-
get preserveModulesRoot() {
|
|
3381
|
-
return this.outputOptions.preserveModulesRoot;
|
|
3382
|
-
}
|
|
3383
|
-
get virtualDirname() {
|
|
3384
|
-
return this.outputOptions.virtualDirname || "_virtual";
|
|
3385
|
-
}
|
|
3386
|
-
};
|
|
3387
|
-
} });
|
|
3388
3287
|
|
|
3389
3288
|
//#endregion
|
|
3390
3289
|
//#region src/utils/transform-to-rollup-output.ts
|
|
@@ -3542,12 +3441,6 @@ function collectChangedBundle(changed, bundle) {
|
|
|
3542
3441
|
deleted: Array.from(changed.deleted)
|
|
3543
3442
|
};
|
|
3544
3443
|
}
|
|
3545
|
-
var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
|
|
3546
|
-
init_sourcemap();
|
|
3547
|
-
init_asset_source();
|
|
3548
|
-
init_error();
|
|
3549
|
-
init_transform_rendered_chunk();
|
|
3550
|
-
} });
|
|
3551
3444
|
|
|
3552
3445
|
//#endregion
|
|
3553
3446
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
@@ -3699,18 +3592,6 @@ function bindingifyOutro(args$1) {
|
|
|
3699
3592
|
meta: bindingifyPluginHookMeta(meta)
|
|
3700
3593
|
};
|
|
3701
3594
|
}
|
|
3702
|
-
var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
|
|
3703
|
-
init_normalized_input_options();
|
|
3704
|
-
init_normalized_output_options();
|
|
3705
|
-
init_sourcemap();
|
|
3706
|
-
init_error();
|
|
3707
|
-
init_normalize_hook();
|
|
3708
|
-
init_transform_rendered_chunk();
|
|
3709
|
-
init_transform_to_rollup_output();
|
|
3710
|
-
init_bindingify_hook_filter();
|
|
3711
|
-
init_bindingify_plugin_hook_meta();
|
|
3712
|
-
init_plugin_context();
|
|
3713
|
-
} });
|
|
3714
3595
|
|
|
3715
3596
|
//#endregion
|
|
3716
3597
|
//#region src/plugin/bindingify-watch-hooks.ts
|
|
@@ -3736,14 +3617,43 @@ function bindingifyCloseWatcher(args$1) {
|
|
|
3736
3617
|
meta: bindingifyPluginHookMeta(meta)
|
|
3737
3618
|
};
|
|
3738
3619
|
}
|
|
3739
|
-
var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
|
|
3740
|
-
init_normalize_hook();
|
|
3741
|
-
init_bindingify_plugin_hook_meta();
|
|
3742
|
-
init_plugin_context();
|
|
3743
|
-
} });
|
|
3744
3620
|
|
|
3745
3621
|
//#endregion
|
|
3746
3622
|
//#region src/plugin/generated/hook-usage.ts
|
|
3623
|
+
let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
3624
|
+
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
3625
|
+
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
3626
|
+
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
3627
|
+
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
3628
|
+
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
3629
|
+
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
3630
|
+
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
3631
|
+
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
3632
|
+
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
3633
|
+
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
3634
|
+
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
3635
|
+
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
3636
|
+
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
3637
|
+
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
3638
|
+
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
3639
|
+
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
3640
|
+
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
3641
|
+
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
3642
|
+
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
3643
|
+
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
3644
|
+
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
3645
|
+
return HookUsageKind$1;
|
|
3646
|
+
}({});
|
|
3647
|
+
var HookUsage = class {
|
|
3648
|
+
bitflag = BigInt(0);
|
|
3649
|
+
constructor() {}
|
|
3650
|
+
union(kind) {
|
|
3651
|
+
this.bitflag |= BigInt(kind);
|
|
3652
|
+
}
|
|
3653
|
+
inner() {
|
|
3654
|
+
return Number(this.bitflag);
|
|
3655
|
+
}
|
|
3656
|
+
};
|
|
3747
3657
|
function extractHookUsage(plugin) {
|
|
3748
3658
|
let hookUsage = new HookUsage();
|
|
3749
3659
|
if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
|
|
@@ -3768,43 +3678,6 @@ function extractHookUsage(plugin) {
|
|
|
3768
3678
|
if (plugin.outro) hookUsage.union(HookUsageKind.outro);
|
|
3769
3679
|
return hookUsage;
|
|
3770
3680
|
}
|
|
3771
|
-
var HookUsageKind, HookUsage;
|
|
3772
|
-
var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
|
|
3773
|
-
HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
3774
|
-
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
3775
|
-
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
3776
|
-
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
3777
|
-
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
3778
|
-
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
3779
|
-
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
3780
|
-
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
3781
|
-
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
3782
|
-
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
3783
|
-
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
3784
|
-
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
3785
|
-
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
3786
|
-
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
3787
|
-
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
3788
|
-
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
3789
|
-
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
3790
|
-
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
3791
|
-
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
3792
|
-
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
3793
|
-
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
3794
|
-
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
3795
|
-
return HookUsageKind$1;
|
|
3796
|
-
}({});
|
|
3797
|
-
HookUsage = class {
|
|
3798
|
-
bitflag = BigInt(0);
|
|
3799
|
-
constructor() {}
|
|
3800
|
-
union(kind) {
|
|
3801
|
-
this.bitflag |= BigInt(kind);
|
|
3802
|
-
}
|
|
3803
|
-
inner() {
|
|
3804
|
-
return Number(this.bitflag);
|
|
3805
|
-
}
|
|
3806
|
-
};
|
|
3807
|
-
} });
|
|
3808
3681
|
|
|
3809
3682
|
//#endregion
|
|
3810
3683
|
//#region src/plugin/bindingify-plugin.ts
|
|
@@ -3927,106 +3800,95 @@ function wrapHandlers(plugin) {
|
|
|
3927
3800
|
}
|
|
3928
3801
|
return plugin;
|
|
3929
3802
|
}
|
|
3930
|
-
var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
|
|
3931
|
-
init_bindingify_build_hooks();
|
|
3932
|
-
init_bindingify_output_hooks();
|
|
3933
|
-
init_logs();
|
|
3934
|
-
init_bindingify_watch_hooks();
|
|
3935
|
-
init_hook_usage();
|
|
3936
|
-
} });
|
|
3937
3803
|
|
|
3938
3804
|
//#endregion
|
|
3939
3805
|
//#region src/plugin/plugin-context-data.ts
|
|
3940
|
-
var PluginContextData
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
if (
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
3955
|
-
} else {
|
|
3956
|
-
this.moduleOptionMap.set(id$1, option);
|
|
3957
|
-
return option;
|
|
3958
|
-
}
|
|
3959
|
-
return existing;
|
|
3960
|
-
}
|
|
3961
|
-
getModuleOption(id$1) {
|
|
3962
|
-
const option = this.moduleOptionMap.get(id$1);
|
|
3963
|
-
if (!option) {
|
|
3964
|
-
const raw = {
|
|
3965
|
-
moduleSideEffects: null,
|
|
3966
|
-
meta: {}
|
|
3967
|
-
};
|
|
3968
|
-
this.moduleOptionMap.set(id$1, raw);
|
|
3969
|
-
return raw;
|
|
3970
|
-
}
|
|
3806
|
+
var PluginContextData = class {
|
|
3807
|
+
moduleOptionMap = /* @__PURE__ */ new Map();
|
|
3808
|
+
resolveOptionsMap = /* @__PURE__ */ new Map();
|
|
3809
|
+
loadModulePromiseMap = /* @__PURE__ */ new Map();
|
|
3810
|
+
loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
|
|
3811
|
+
renderedChunkMeta = null;
|
|
3812
|
+
updateModuleOption(id$1, option) {
|
|
3813
|
+
const existing = this.moduleOptionMap.get(id$1);
|
|
3814
|
+
if (existing) {
|
|
3815
|
+
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
3816
|
+
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
3817
|
+
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
3818
|
+
} else {
|
|
3819
|
+
this.moduleOptionMap.set(id$1, option);
|
|
3971
3820
|
return option;
|
|
3972
3821
|
}
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
get() {
|
|
3985
|
-
return moduleSideEffects;
|
|
3986
|
-
},
|
|
3987
|
-
set: (v) => {
|
|
3988
|
-
this.updateModuleOption(id$1, {
|
|
3989
|
-
moduleSideEffects: v,
|
|
3990
|
-
meta: info.meta,
|
|
3991
|
-
invalidate: true
|
|
3992
|
-
});
|
|
3993
|
-
moduleSideEffects = v;
|
|
3994
|
-
}
|
|
3995
|
-
});
|
|
3996
|
-
return info;
|
|
3997
|
-
}
|
|
3998
|
-
getModuleIds(context) {
|
|
3999
|
-
const moduleIds = context.getModuleIds();
|
|
4000
|
-
return moduleIds.values();
|
|
4001
|
-
}
|
|
4002
|
-
saveResolveOptions(options) {
|
|
4003
|
-
const index = this.resolveOptionsMap.size;
|
|
4004
|
-
this.resolveOptionsMap.set(index, options);
|
|
4005
|
-
return index;
|
|
4006
|
-
}
|
|
4007
|
-
getSavedResolveOptions(receipt) {
|
|
4008
|
-
return this.resolveOptionsMap.get(receipt);
|
|
4009
|
-
}
|
|
4010
|
-
removeSavedResolveOptions(receipt) {
|
|
4011
|
-
this.resolveOptionsMap.delete(receipt);
|
|
4012
|
-
}
|
|
4013
|
-
setRenderChunkMeta(meta) {
|
|
4014
|
-
this.renderedChunkMeta = meta;
|
|
4015
|
-
}
|
|
4016
|
-
getRenderChunkMeta() {
|
|
4017
|
-
return this.renderedChunkMeta;
|
|
4018
|
-
}
|
|
4019
|
-
markModuleLoaded(id$1, _success) {
|
|
4020
|
-
const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
4021
|
-
if (resolve) resolve();
|
|
3822
|
+
return existing;
|
|
3823
|
+
}
|
|
3824
|
+
getModuleOption(id$1) {
|
|
3825
|
+
const option = this.moduleOptionMap.get(id$1);
|
|
3826
|
+
if (!option) {
|
|
3827
|
+
const raw = {
|
|
3828
|
+
moduleSideEffects: null,
|
|
3829
|
+
meta: {}
|
|
3830
|
+
};
|
|
3831
|
+
this.moduleOptionMap.set(id$1, raw);
|
|
3832
|
+
return raw;
|
|
4022
3833
|
}
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
3834
|
+
return option;
|
|
3835
|
+
}
|
|
3836
|
+
getModuleInfo(id$1, context) {
|
|
3837
|
+
const bindingInfo = context.getModuleInfo(id$1);
|
|
3838
|
+
if (bindingInfo) {
|
|
3839
|
+
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
|
|
3840
|
+
return this.proxyModuleInfo(id$1, info);
|
|
4027
3841
|
}
|
|
4028
|
-
|
|
4029
|
-
}
|
|
3842
|
+
return null;
|
|
3843
|
+
}
|
|
3844
|
+
proxyModuleInfo(id$1, info) {
|
|
3845
|
+
let moduleSideEffects = info.moduleSideEffects;
|
|
3846
|
+
Object.defineProperty(info, "moduleSideEffects", {
|
|
3847
|
+
get() {
|
|
3848
|
+
return moduleSideEffects;
|
|
3849
|
+
},
|
|
3850
|
+
set: (v) => {
|
|
3851
|
+
this.updateModuleOption(id$1, {
|
|
3852
|
+
moduleSideEffects: v,
|
|
3853
|
+
meta: info.meta,
|
|
3854
|
+
invalidate: true
|
|
3855
|
+
});
|
|
3856
|
+
moduleSideEffects = v;
|
|
3857
|
+
}
|
|
3858
|
+
});
|
|
3859
|
+
return info;
|
|
3860
|
+
}
|
|
3861
|
+
getModuleIds(context) {
|
|
3862
|
+
const moduleIds = context.getModuleIds();
|
|
3863
|
+
return moduleIds.values();
|
|
3864
|
+
}
|
|
3865
|
+
saveResolveOptions(options) {
|
|
3866
|
+
const index = this.resolveOptionsMap.size;
|
|
3867
|
+
this.resolveOptionsMap.set(index, options);
|
|
3868
|
+
return index;
|
|
3869
|
+
}
|
|
3870
|
+
getSavedResolveOptions(receipt) {
|
|
3871
|
+
return this.resolveOptionsMap.get(receipt);
|
|
3872
|
+
}
|
|
3873
|
+
removeSavedResolveOptions(receipt) {
|
|
3874
|
+
this.resolveOptionsMap.delete(receipt);
|
|
3875
|
+
}
|
|
3876
|
+
setRenderChunkMeta(meta) {
|
|
3877
|
+
this.renderedChunkMeta = meta;
|
|
3878
|
+
}
|
|
3879
|
+
getRenderChunkMeta() {
|
|
3880
|
+
return this.renderedChunkMeta;
|
|
3881
|
+
}
|
|
3882
|
+
markModuleLoaded(id$1, _success) {
|
|
3883
|
+
const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
3884
|
+
if (resolve) resolve();
|
|
3885
|
+
}
|
|
3886
|
+
clear() {
|
|
3887
|
+
this.renderedChunkMeta = null;
|
|
3888
|
+
this.loadModulePromiseMap.clear();
|
|
3889
|
+
this.loadModulePromiseResolveFnMap.clear();
|
|
3890
|
+
}
|
|
3891
|
+
};
|
|
4030
3892
|
|
|
4031
3893
|
//#endregion
|
|
4032
3894
|
//#region src/utils/normalize-string-or-regex.ts
|
|
@@ -4038,7 +3900,6 @@ function normalizedStringOrRegex(pattern) {
|
|
|
4038
3900
|
function isReadonlyArray(input) {
|
|
4039
3901
|
return Array.isArray(input);
|
|
4040
3902
|
}
|
|
4041
|
-
var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
|
|
4042
3903
|
|
|
4043
3904
|
//#endregion
|
|
4044
3905
|
//#region src/utils/bindingify-input-options.ts
|
|
@@ -4071,7 +3932,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4071
3932
|
viteMode: inputOptions.experimental?.viteMode,
|
|
4072
3933
|
resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
|
|
4073
3934
|
hmr: bindingifyHmr(inputOptions.experimental?.hmr),
|
|
4074
|
-
attachDebugInfo: inputOptions.experimental?.attachDebugInfo
|
|
3935
|
+
attachDebugInfo: bindingifyAttachDebugInfo(inputOptions.experimental?.attachDebugInfo)
|
|
4075
3936
|
},
|
|
4076
3937
|
profilerNames: inputOptions?.profilerNames,
|
|
4077
3938
|
jsx,
|
|
@@ -4103,6 +3964,14 @@ function bindingifyHmr(hmr) {
|
|
|
4103
3964
|
return hmr;
|
|
4104
3965
|
}
|
|
4105
3966
|
}
|
|
3967
|
+
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
3968
|
+
switch (attachDebugInfo) {
|
|
3969
|
+
case void 0: return void 0;
|
|
3970
|
+
case "full": return BindingAttachDebugInfo.Full;
|
|
3971
|
+
case "simple": return BindingAttachDebugInfo.Simple;
|
|
3972
|
+
case "none": return BindingAttachDebugInfo.None;
|
|
3973
|
+
}
|
|
3974
|
+
}
|
|
4106
3975
|
function bindingifyExternal(external) {
|
|
4107
3976
|
if (external) {
|
|
4108
3977
|
if (typeof external === "function") return (id$1, importer, isResolved) => {
|
|
@@ -4241,31 +4110,31 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
|
4241
4110
|
field0: preserveEntrySignatures
|
|
4242
4111
|
};
|
|
4243
4112
|
}
|
|
4244
|
-
var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
|
|
4245
|
-
init_constructors();
|
|
4246
|
-
init_utils();
|
|
4247
|
-
init_bindingify_plugin();
|
|
4248
|
-
init_plugin_context_data();
|
|
4249
|
-
init_misc();
|
|
4250
|
-
init_normalize_string_or_regex();
|
|
4251
|
-
init_transform_side_effects();
|
|
4252
|
-
} });
|
|
4253
4113
|
|
|
4254
4114
|
//#endregion
|
|
4255
4115
|
//#region src/utils/plugin/index.ts
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
return PLUGIN_HOOK_NAMES_SET.has(hookName);
|
|
4263
|
-
};
|
|
4264
|
-
}();
|
|
4265
|
-
} });
|
|
4116
|
+
const isPluginHookName = function() {
|
|
4117
|
+
const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
|
|
4118
|
+
return function isPluginHookName$1(hookName) {
|
|
4119
|
+
return PLUGIN_HOOK_NAMES_SET.has(hookName);
|
|
4120
|
+
};
|
|
4121
|
+
}();
|
|
4266
4122
|
|
|
4267
4123
|
//#endregion
|
|
4268
4124
|
//#region src/utils/compose-js-plugins.ts
|
|
4125
|
+
const unsupportedHookName = [
|
|
4126
|
+
"augmentChunkHash",
|
|
4127
|
+
"generateBundle",
|
|
4128
|
+
"moduleParsed",
|
|
4129
|
+
"onLog",
|
|
4130
|
+
"options",
|
|
4131
|
+
"outputOptions",
|
|
4132
|
+
"renderError",
|
|
4133
|
+
"renderStart",
|
|
4134
|
+
"resolveDynamicImport",
|
|
4135
|
+
"writeBundle"
|
|
4136
|
+
];
|
|
4137
|
+
const unsupportedHooks = new Set(unsupportedHookName);
|
|
4269
4138
|
function isUnsupportedHooks(hookName) {
|
|
4270
4139
|
return unsupportedHooks.has(hookName);
|
|
4271
4140
|
}
|
|
@@ -4558,28 +4427,6 @@ function composeJsPlugins(plugins) {
|
|
|
4558
4427
|
}
|
|
4559
4428
|
return newPlugins;
|
|
4560
4429
|
}
|
|
4561
|
-
var unsupportedHookName, unsupportedHooks;
|
|
4562
|
-
var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
|
|
4563
|
-
init_dist$1();
|
|
4564
|
-
init_constructors();
|
|
4565
|
-
init_plugin_context$1();
|
|
4566
|
-
init_misc();
|
|
4567
|
-
init_normalize_hook();
|
|
4568
|
-
init_plugin();
|
|
4569
|
-
unsupportedHookName = [
|
|
4570
|
-
"augmentChunkHash",
|
|
4571
|
-
"generateBundle",
|
|
4572
|
-
"moduleParsed",
|
|
4573
|
-
"onLog",
|
|
4574
|
-
"options",
|
|
4575
|
-
"outputOptions",
|
|
4576
|
-
"renderError",
|
|
4577
|
-
"renderStart",
|
|
4578
|
-
"resolveDynamicImport",
|
|
4579
|
-
"writeBundle"
|
|
4580
|
-
];
|
|
4581
|
-
unsupportedHooks = new Set(unsupportedHookName);
|
|
4582
|
-
} });
|
|
4583
4430
|
|
|
4584
4431
|
//#endregion
|
|
4585
4432
|
//#region src/utils/initialize-parallel-plugins.ts
|
|
@@ -4632,19 +4479,16 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
4632
4479
|
throw e$1;
|
|
4633
4480
|
}
|
|
4634
4481
|
}
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
return Math.min(availableParallelism$1, 8);
|
|
4646
|
-
};
|
|
4647
|
-
} });
|
|
4482
|
+
const availableParallelism = () => {
|
|
4483
|
+
let availableParallelism$1 = 1;
|
|
4484
|
+
try {
|
|
4485
|
+
availableParallelism$1 = os.availableParallelism();
|
|
4486
|
+
} catch {
|
|
4487
|
+
const cpus = os.cpus();
|
|
4488
|
+
if (Array.isArray(cpus) && cpus.length > 0) availableParallelism$1 = cpus.length;
|
|
4489
|
+
}
|
|
4490
|
+
return Math.min(availableParallelism$1, 8);
|
|
4491
|
+
};
|
|
4648
4492
|
|
|
4649
4493
|
//#endregion
|
|
4650
4494
|
//#region src/utils/create-bundler-option.ts
|
|
@@ -4680,25 +4524,16 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4680
4524
|
throw e$1;
|
|
4681
4525
|
}
|
|
4682
4526
|
}
|
|
4683
|
-
var init_create_bundler_option = __esm({ "src/utils/create-bundler-option.ts"() {
|
|
4684
|
-
init_logger();
|
|
4685
|
-
init_logging();
|
|
4686
|
-
init_plugin_driver();
|
|
4687
|
-
init_bindingify_input_options();
|
|
4688
|
-
init_bindingify_output_options();
|
|
4689
|
-
init_compose_js_plugins();
|
|
4690
|
-
init_initialize_parallel_plugins();
|
|
4691
|
-
init_normalize_plugin_option();
|
|
4692
|
-
} });
|
|
4693
4527
|
|
|
4694
4528
|
//#endregion
|
|
4695
4529
|
//#region src/utils/create-bundler.ts
|
|
4696
|
-
|
|
4530
|
+
let asyncRuntimeShutdown = false;
|
|
4531
|
+
async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
|
|
4697
4532
|
const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
|
|
4698
4533
|
if (asyncRuntimeShutdown) startAsyncRuntime();
|
|
4699
4534
|
try {
|
|
4700
4535
|
return {
|
|
4701
|
-
|
|
4536
|
+
impl: bundler.createImpl(option.bundlerOptions),
|
|
4702
4537
|
stopWorkers: option.stopWorkers,
|
|
4703
4538
|
shutdown: () => {
|
|
4704
4539
|
shutdownAsyncRuntime();
|
|
@@ -4710,11 +4545,6 @@ async function createBundler(inputOptions, outputOptions, isClose) {
|
|
|
4710
4545
|
throw e$1;
|
|
4711
4546
|
}
|
|
4712
4547
|
}
|
|
4713
|
-
var asyncRuntimeShutdown;
|
|
4714
|
-
var init_create_bundler = __esm({ "src/utils/create-bundler.ts"() {
|
|
4715
|
-
init_create_bundler_option();
|
|
4716
|
-
asyncRuntimeShutdown = false;
|
|
4717
|
-
} });
|
|
4718
4548
|
|
|
4719
4549
|
//#endregion
|
|
4720
4550
|
//#region src/utils/transform-hmr-patch-output.ts
|
|
@@ -4727,79 +4557,66 @@ function handleHmrPatchOutputErrors(output) {
|
|
|
4727
4557
|
const rawErrors = output.errors;
|
|
4728
4558
|
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
4729
4559
|
}
|
|
4730
|
-
var init_transform_hmr_patch_output = __esm({ "src/utils/transform-hmr-patch-output.ts"() {
|
|
4731
|
-
init_error();
|
|
4732
|
-
} });
|
|
4733
4560
|
|
|
4734
4561
|
//#endregion
|
|
4735
4562
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4736
|
-
|
|
4737
|
-
var
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
|
|
4786
|
-
}
|
|
4787
|
-
};
|
|
4788
|
-
} });
|
|
4563
|
+
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
4564
|
+
var RolldownBuild = class {
|
|
4565
|
+
#inputOptions;
|
|
4566
|
+
#bundler;
|
|
4567
|
+
#bundlerImpl;
|
|
4568
|
+
constructor(inputOptions) {
|
|
4569
|
+
this.#inputOptions = inputOptions;
|
|
4570
|
+
this.#bundler = new BindingBundler();
|
|
4571
|
+
}
|
|
4572
|
+
get closed() {
|
|
4573
|
+
return this.#bundlerImpl?.impl.closed ?? false;
|
|
4574
|
+
}
|
|
4575
|
+
async #getBundlerWithStopWorker(outputOptions, isClose) {
|
|
4576
|
+
if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
|
|
4577
|
+
return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions, isClose);
|
|
4578
|
+
}
|
|
4579
|
+
async generate(outputOptions = {}) {
|
|
4580
|
+
validateOption("output", outputOptions);
|
|
4581
|
+
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4582
|
+
const output = await impl.generate();
|
|
4583
|
+
return transformToRollupOutput(output);
|
|
4584
|
+
}
|
|
4585
|
+
async write(outputOptions = {}) {
|
|
4586
|
+
validateOption("output", outputOptions);
|
|
4587
|
+
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4588
|
+
const output = await impl.write();
|
|
4589
|
+
return transformToRollupOutput(output);
|
|
4590
|
+
}
|
|
4591
|
+
async close() {
|
|
4592
|
+
const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
|
|
4593
|
+
await stopWorkers?.();
|
|
4594
|
+
await impl.close();
|
|
4595
|
+
shutdown();
|
|
4596
|
+
}
|
|
4597
|
+
async [Symbol.asyncDispose]() {
|
|
4598
|
+
await this.close();
|
|
4599
|
+
}
|
|
4600
|
+
async generateHmrPatch(changedFiles) {
|
|
4601
|
+
const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
|
|
4602
|
+
return transformHmrPatchOutput(output);
|
|
4603
|
+
}
|
|
4604
|
+
async hmrInvalidate(file, firstInvalidatedBy) {
|
|
4605
|
+
const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
|
|
4606
|
+
return transformHmrPatchOutput(output);
|
|
4607
|
+
}
|
|
4608
|
+
get watchFiles() {
|
|
4609
|
+
return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
|
|
4610
|
+
}
|
|
4611
|
+
};
|
|
4789
4612
|
|
|
4790
4613
|
//#endregion
|
|
4791
4614
|
//#region src/api/rolldown/index.ts
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
rolldown = async (input) => {
|
|
4798
|
-
validateOption("input", input);
|
|
4799
|
-
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
4800
|
-
return new RolldownBuild(inputOptions);
|
|
4801
|
-
};
|
|
4802
|
-
} });
|
|
4615
|
+
const rolldown = async (input) => {
|
|
4616
|
+
validateOption("input", input);
|
|
4617
|
+
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
4618
|
+
return new RolldownBuild(inputOptions);
|
|
4619
|
+
};
|
|
4803
4620
|
|
|
4804
4621
|
//#endregion
|
|
4805
4622
|
//#region src/api/build.ts
|
|
@@ -4816,86 +4633,106 @@ async function build(options) {
|
|
|
4816
4633
|
}
|
|
4817
4634
|
}
|
|
4818
4635
|
}
|
|
4819
|
-
var init_build = __esm({ "src/api/build.ts"() {
|
|
4820
|
-
init_rolldown();
|
|
4821
|
-
} });
|
|
4822
4636
|
|
|
4823
4637
|
//#endregion
|
|
4824
4638
|
//#region src/api/watch/watch-emitter.ts
|
|
4825
|
-
var WatcherEmitter
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
if (listeners) {
|
|
4843
|
-
const index = listeners.indexOf(listener);
|
|
4844
|
-
if (index !== -1) listeners.splice(index, 1);
|
|
4845
|
-
}
|
|
4846
|
-
return this;
|
|
4639
|
+
var WatcherEmitter = class {
|
|
4640
|
+
listeners = /* @__PURE__ */ new Map();
|
|
4641
|
+
timer;
|
|
4642
|
+
constructor() {
|
|
4643
|
+
this.timer = setInterval(() => {}, 1e9);
|
|
4644
|
+
}
|
|
4645
|
+
on(event, listener) {
|
|
4646
|
+
const listeners = this.listeners.get(event);
|
|
4647
|
+
if (listeners) listeners.push(listener);
|
|
4648
|
+
else this.listeners.set(event, [listener]);
|
|
4649
|
+
return this;
|
|
4650
|
+
}
|
|
4651
|
+
off(event, listener) {
|
|
4652
|
+
const listeners = this.listeners.get(event);
|
|
4653
|
+
if (listeners) {
|
|
4654
|
+
const index = listeners.indexOf(listener);
|
|
4655
|
+
if (index !== -1) listeners.splice(index, 1);
|
|
4847
4656
|
}
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
break;
|
|
4882
|
-
case "change":
|
|
4883
|
-
for (const listener of listeners) {
|
|
4884
|
-
const { path: path$1, kind } = event.watchChangeData();
|
|
4885
|
-
await listener(path$1, { event: kind });
|
|
4657
|
+
return this;
|
|
4658
|
+
}
|
|
4659
|
+
async onEvent(event) {
|
|
4660
|
+
const listeners = this.listeners.get(event.eventKind());
|
|
4661
|
+
if (listeners) switch (event.eventKind()) {
|
|
4662
|
+
case "close":
|
|
4663
|
+
case "restart":
|
|
4664
|
+
for (const listener of listeners) await listener();
|
|
4665
|
+
break;
|
|
4666
|
+
case "event":
|
|
4667
|
+
for (const listener of listeners) {
|
|
4668
|
+
const code$1 = event.bundleEventKind();
|
|
4669
|
+
switch (code$1) {
|
|
4670
|
+
case "BUNDLE_END":
|
|
4671
|
+
const { duration, output, result } = event.bundleEndData();
|
|
4672
|
+
await listener({
|
|
4673
|
+
code: "BUNDLE_END",
|
|
4674
|
+
duration,
|
|
4675
|
+
output: [output],
|
|
4676
|
+
result
|
|
4677
|
+
});
|
|
4678
|
+
break;
|
|
4679
|
+
case "ERROR":
|
|
4680
|
+
const data = event.bundleErrorData();
|
|
4681
|
+
await listener({
|
|
4682
|
+
code: "ERROR",
|
|
4683
|
+
error: normalizeErrors(data.error),
|
|
4684
|
+
result: data.result
|
|
4685
|
+
});
|
|
4686
|
+
break;
|
|
4687
|
+
default:
|
|
4688
|
+
await listener({ code: code$1 });
|
|
4689
|
+
break;
|
|
4886
4690
|
}
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4691
|
+
}
|
|
4692
|
+
break;
|
|
4693
|
+
case "change":
|
|
4694
|
+
for (const listener of listeners) {
|
|
4695
|
+
const { path: path$1, kind } = event.watchChangeData();
|
|
4696
|
+
await listener(path$1, { event: kind });
|
|
4697
|
+
}
|
|
4698
|
+
break;
|
|
4699
|
+
default: throw new Error(`Unknown event: ${event}`);
|
|
4893
4700
|
}
|
|
4894
|
-
}
|
|
4895
|
-
|
|
4701
|
+
}
|
|
4702
|
+
async close() {
|
|
4703
|
+
clearInterval(this.timer);
|
|
4704
|
+
}
|
|
4705
|
+
};
|
|
4896
4706
|
|
|
4897
4707
|
//#endregion
|
|
4898
4708
|
//#region src/api/watch/watcher.ts
|
|
4709
|
+
var Watcher = class {
|
|
4710
|
+
closed;
|
|
4711
|
+
inner;
|
|
4712
|
+
emitter;
|
|
4713
|
+
stopWorkers;
|
|
4714
|
+
constructor(emitter, inner, stopWorkers) {
|
|
4715
|
+
this.closed = false;
|
|
4716
|
+
this.inner = inner;
|
|
4717
|
+
this.emitter = emitter;
|
|
4718
|
+
const originClose = emitter.close.bind(emitter);
|
|
4719
|
+
emitter.close = async () => {
|
|
4720
|
+
await this.close();
|
|
4721
|
+
originClose();
|
|
4722
|
+
};
|
|
4723
|
+
this.stopWorkers = stopWorkers;
|
|
4724
|
+
}
|
|
4725
|
+
async close() {
|
|
4726
|
+
if (this.closed) return;
|
|
4727
|
+
this.closed = true;
|
|
4728
|
+
for (const stop of this.stopWorkers) await stop?.();
|
|
4729
|
+
await this.inner.close();
|
|
4730
|
+
shutdownAsyncRuntime();
|
|
4731
|
+
}
|
|
4732
|
+
start() {
|
|
4733
|
+
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
4734
|
+
}
|
|
4735
|
+
};
|
|
4899
4736
|
async function createWatcher(emitter, input) {
|
|
4900
4737
|
const options = arraify(input);
|
|
4901
4738
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
@@ -4917,71 +4754,24 @@ function getValidNotifyOption(bundlerOptions) {
|
|
|
4917
4754
|
} else result = notifyOption;
|
|
4918
4755
|
}
|
|
4919
4756
|
}
|
|
4920
|
-
var Watcher;
|
|
4921
|
-
var init_watcher = __esm({ "src/api/watch/watcher.ts"() {
|
|
4922
|
-
init_logging();
|
|
4923
|
-
init_logs();
|
|
4924
|
-
init_plugin_driver();
|
|
4925
|
-
init_create_bundler_option();
|
|
4926
|
-
init_misc();
|
|
4927
|
-
Watcher = class {
|
|
4928
|
-
closed;
|
|
4929
|
-
inner;
|
|
4930
|
-
emitter;
|
|
4931
|
-
stopWorkers;
|
|
4932
|
-
constructor(emitter, inner, stopWorkers) {
|
|
4933
|
-
this.closed = false;
|
|
4934
|
-
this.inner = inner;
|
|
4935
|
-
this.emitter = emitter;
|
|
4936
|
-
const originClose = emitter.close.bind(emitter);
|
|
4937
|
-
emitter.close = async () => {
|
|
4938
|
-
await this.close();
|
|
4939
|
-
originClose();
|
|
4940
|
-
};
|
|
4941
|
-
this.stopWorkers = stopWorkers;
|
|
4942
|
-
}
|
|
4943
|
-
async close() {
|
|
4944
|
-
if (this.closed) return;
|
|
4945
|
-
this.closed = true;
|
|
4946
|
-
for (const stop of this.stopWorkers) await stop?.();
|
|
4947
|
-
await this.inner.close();
|
|
4948
|
-
shutdownAsyncRuntime();
|
|
4949
|
-
}
|
|
4950
|
-
start() {
|
|
4951
|
-
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
4952
|
-
}
|
|
4953
|
-
};
|
|
4954
|
-
} });
|
|
4955
4757
|
|
|
4956
4758
|
//#endregion
|
|
4957
4759
|
//#region src/api/watch/index.ts
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
const emitter = new WatcherEmitter();
|
|
4964
|
-
createWatcher(emitter, input);
|
|
4965
|
-
return emitter;
|
|
4966
|
-
};
|
|
4967
|
-
} });
|
|
4760
|
+
const watch = (input) => {
|
|
4761
|
+
const emitter = new WatcherEmitter();
|
|
4762
|
+
createWatcher(emitter, input);
|
|
4763
|
+
return emitter;
|
|
4764
|
+
};
|
|
4968
4765
|
|
|
4969
4766
|
//#endregion
|
|
4970
4767
|
//#region src/utils/define-config.ts
|
|
4971
4768
|
function defineConfig(config) {
|
|
4972
4769
|
return config;
|
|
4973
4770
|
}
|
|
4974
|
-
var init_define_config = __esm({ "src/utils/define-config.ts"() {} });
|
|
4975
4771
|
|
|
4976
4772
|
//#endregion
|
|
4977
4773
|
//#region src/index.ts
|
|
4978
|
-
|
|
4979
|
-
var init_src = __esm({ "src/index.ts"() {
|
|
4980
|
-
init_build();
|
|
4981
|
-
init_rolldown();
|
|
4982
|
-
init_watch();
|
|
4983
|
-
VERSION = version;
|
|
4984
|
-
} });
|
|
4774
|
+
const VERSION = version;
|
|
4985
4775
|
|
|
4986
4776
|
//#endregion
|
|
4987
|
-
export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins,
|
|
4777
|
+
export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, __commonJS, __toESM, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundlerImpl, defineConfig, description$1 as description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
|