rolldown 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 -1081
- 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.cjs +7 -31
- package/dist/experimental-index.d.cts +2 -2
- package/dist/experimental-index.d.mts +2 -2
- package/dist/experimental-index.mjs +4 -22
- 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.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 +3 -4
- package/dist/parallel-plugin-worker.mjs +27 -34
- 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/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-De_1kjGz.d.mts → define-config-Cm86JHb7.d.mts} +73 -12
- package/dist/shared/{define-config-BE-fkZNW.d.cts → define-config-POPyhxOq.d.cts} +73 -12
- package/dist/shared/{load-config-Bq6nGoUg.cjs → load-config-B4zzmrcW.cjs} +1 -1
- package/dist/shared/{load-config-BOcke1T-.mjs → load-config-BlOqMlge.mjs} +14 -19
- package/dist/shared/{misc-DGAe2XOW.mjs → misc-BN0nse6C.mjs} +1 -4
- package/dist/shared/parse-ast-index-BpqxVgDm.mjs +616 -0
- package/dist/shared/parse-ast-index-XFcW-g8N.cjs +738 -0
- package/dist/shared/prompt-C5jz26Zn.mjs +852 -0
- package/dist/shared/{prompt-8EeOGx1_.cjs → prompt-QNI93ne7.cjs} +2 -2
- package/dist/shared/{src-aJubL6dq.cjs → src-C98Q0NLX.cjs} +63 -55
- package/dist/shared/{src-DBOqhEP1.mjs → src-CuIbdNSi.mjs} +1146 -1391
- package/package.json +22 -22
- package/dist/shared/chunk--iN_1bjD.mjs +0 -33
- package/dist/shared/parse-ast-index-BAuPesgO.mjs +0 -658
- package/dist/shared/parse-ast-index-C53MhHqY.cjs +0 -700
- package/dist/shared/prompt-Dc0i9ubg.mjs +0 -854
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { arraify, init_misc, isNullish, noop, unimplemented, unreachable, unsupported } from "./misc-DGAe2XOW.mjs";
|
|
1
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, ParallelJsPluginRegistry, augmentCodeLocation, error, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, shutdownAsyncRuntime, startAsyncRuntime } from "./parse-ast-index-BpqxVgDm.mjs";
|
|
2
|
+
import { arraify, isNullish, noop, unimplemented, unreachable, unsupported } from "./misc-BN0nse6C.mjs";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
6
5
|
import colors from "ansis";
|
|
@@ -9,13 +8,13 @@ import os from "node:os";
|
|
|
9
8
|
import { Worker } from "node:worker_threads";
|
|
10
9
|
|
|
11
10
|
//#region package.json
|
|
12
|
-
var version = "1.0.0-beta.
|
|
11
|
+
var version = "1.0.0-beta.17";
|
|
13
12
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
14
13
|
|
|
15
14
|
//#endregion
|
|
16
15
|
//#region src/builtin-plugin/utils.ts
|
|
17
16
|
function makeBuiltinPluginCallable(plugin) {
|
|
18
|
-
let callablePlugin = new
|
|
17
|
+
let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
19
18
|
const wrappedPlugin = plugin;
|
|
20
19
|
for (const key in callablePlugin) wrappedPlugin[key] = function(...args$1) {
|
|
21
20
|
return callablePlugin[key](...args$1);
|
|
@@ -28,13 +27,15 @@ function bindingifyBuiltInPlugin(plugin) {
|
|
|
28
27
|
options: plugin._options
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
|
-
var import_binding$6;
|
|
32
|
-
var init_utils = __esm({ "src/builtin-plugin/utils.ts"() {
|
|
33
|
-
import_binding$6 = __toESM(require_binding());
|
|
34
|
-
} });
|
|
35
30
|
|
|
36
31
|
//#endregion
|
|
37
32
|
//#region src/builtin-plugin/constructors.ts
|
|
33
|
+
var BuiltinPlugin = class {
|
|
34
|
+
constructor(name, _options) {
|
|
35
|
+
this.name = name;
|
|
36
|
+
this._options = _options;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
38
39
|
function modulePreloadPolyfillPlugin(config) {
|
|
39
40
|
return new BuiltinPlugin("builtin:module-preload-polyfill", config);
|
|
40
41
|
}
|
|
@@ -104,36 +105,24 @@ function webWorkerPostPlugin() {
|
|
|
104
105
|
function oxcRuntimePlugin(config) {
|
|
105
106
|
return new BuiltinPlugin("builtin:oxc-runtime", config);
|
|
106
107
|
}
|
|
107
|
-
var BuiltinPlugin;
|
|
108
|
-
var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
|
|
109
|
-
init_utils();
|
|
110
|
-
BuiltinPlugin = class {
|
|
111
|
-
constructor(name, _options) {
|
|
112
|
-
this.name = name;
|
|
113
|
-
this._options = _options;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
} });
|
|
117
108
|
|
|
118
109
|
//#endregion
|
|
119
110
|
//#region src/log/logging.ts
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
LOG_LEVEL_DEBUG
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
[LOG_LEVEL_SILENT]: 3
|
|
132
|
-
};
|
|
133
|
-
} });
|
|
111
|
+
const LOG_LEVEL_SILENT = "silent";
|
|
112
|
+
const LOG_LEVEL_ERROR = "error";
|
|
113
|
+
const LOG_LEVEL_WARN = "warn";
|
|
114
|
+
const LOG_LEVEL_INFO = "info";
|
|
115
|
+
const LOG_LEVEL_DEBUG = "debug";
|
|
116
|
+
const logLevelPriority = {
|
|
117
|
+
[LOG_LEVEL_DEBUG]: 0,
|
|
118
|
+
[LOG_LEVEL_INFO]: 1,
|
|
119
|
+
[LOG_LEVEL_WARN]: 2,
|
|
120
|
+
[LOG_LEVEL_SILENT]: 3
|
|
121
|
+
};
|
|
134
122
|
|
|
135
123
|
//#endregion
|
|
136
124
|
//#region src/log/log-handler.ts
|
|
125
|
+
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
137
126
|
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
138
127
|
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
139
128
|
return (log, pos) => {
|
|
@@ -145,13 +134,6 @@ function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
|
145
134
|
logger(level, log);
|
|
146
135
|
};
|
|
147
136
|
}
|
|
148
|
-
var normalizeLog;
|
|
149
|
-
var init_log_handler = __esm({ "src/log/log-handler.ts"() {
|
|
150
|
-
init_misc();
|
|
151
|
-
init_logging();
|
|
152
|
-
init_logs();
|
|
153
|
-
normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
154
|
-
} });
|
|
155
137
|
|
|
156
138
|
//#endregion
|
|
157
139
|
//#region src/log/logger.ts
|
|
@@ -187,55 +169,47 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
|
187
169
|
};
|
|
188
170
|
return logger;
|
|
189
171
|
}
|
|
172
|
+
const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
|
|
173
|
+
const { onwarn, onLog } = config;
|
|
174
|
+
const defaultOnLog = getDefaultOnLog(printLog, onwarn);
|
|
175
|
+
if (onLog) {
|
|
176
|
+
const minimalPriority = logLevelPriority[logLevel];
|
|
177
|
+
return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
|
|
178
|
+
if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
|
|
179
|
+
if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return defaultOnLog;
|
|
183
|
+
};
|
|
184
|
+
const getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
|
|
185
|
+
if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
|
|
186
|
+
else printLog(level, log);
|
|
187
|
+
} : printLog;
|
|
188
|
+
const addLogToString = (log) => {
|
|
189
|
+
Object.defineProperty(log, "toString", {
|
|
190
|
+
value: () => getExtendedLogMessage(log),
|
|
191
|
+
writable: true
|
|
192
|
+
});
|
|
193
|
+
return log;
|
|
194
|
+
};
|
|
195
|
+
const defaultPrintLog = (level, log) => {
|
|
196
|
+
const message = getExtendedLogMessage(log);
|
|
197
|
+
switch (level) {
|
|
198
|
+
case LOG_LEVEL_WARN: return console.warn(message);
|
|
199
|
+
case LOG_LEVEL_DEBUG: return console.debug(message);
|
|
200
|
+
default: return console.info(message);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
const getExtendedLogMessage = (log) => {
|
|
204
|
+
let prefix = "";
|
|
205
|
+
if (log.plugin) prefix += `(${log.plugin} plugin) `;
|
|
206
|
+
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
207
|
+
return prefix + log.message;
|
|
208
|
+
};
|
|
190
209
|
function relativeId(id) {
|
|
191
210
|
if (!path.isAbsolute(id)) return id;
|
|
192
211
|
return path.relative(path.resolve(), id);
|
|
193
212
|
}
|
|
194
|
-
var getOnLog, getDefaultOnLog, addLogToString, defaultPrintLog, getExtendedLogMessage;
|
|
195
|
-
var init_logger = __esm({ "src/log/logger.ts"() {
|
|
196
|
-
init_src();
|
|
197
|
-
init_plugin_driver();
|
|
198
|
-
init_log_handler();
|
|
199
|
-
init_logging();
|
|
200
|
-
init_logs();
|
|
201
|
-
getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
|
|
202
|
-
const { onwarn, onLog } = config;
|
|
203
|
-
const defaultOnLog = getDefaultOnLog(printLog, onwarn);
|
|
204
|
-
if (onLog) {
|
|
205
|
-
const minimalPriority = logLevelPriority[logLevel];
|
|
206
|
-
return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
|
|
207
|
-
if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
|
|
208
|
-
if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
return defaultOnLog;
|
|
212
|
-
};
|
|
213
|
-
getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
|
|
214
|
-
if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
|
|
215
|
-
else printLog(level, log);
|
|
216
|
-
} : printLog;
|
|
217
|
-
addLogToString = (log) => {
|
|
218
|
-
Object.defineProperty(log, "toString", {
|
|
219
|
-
value: () => getExtendedLogMessage(log),
|
|
220
|
-
writable: true
|
|
221
|
-
});
|
|
222
|
-
return log;
|
|
223
|
-
};
|
|
224
|
-
defaultPrintLog = (level, log) => {
|
|
225
|
-
const message = getExtendedLogMessage(log);
|
|
226
|
-
switch (level) {
|
|
227
|
-
case LOG_LEVEL_WARN: return console.warn(message);
|
|
228
|
-
case LOG_LEVEL_DEBUG: return console.debug(message);
|
|
229
|
-
default: return console.info(message);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
getExtendedLogMessage = (log) => {
|
|
233
|
-
let prefix = "";
|
|
234
|
-
if (log.plugin) prefix += `(${log.plugin} plugin) `;
|
|
235
|
-
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
236
|
-
return prefix + log.message;
|
|
237
|
-
};
|
|
238
|
-
} });
|
|
239
213
|
|
|
240
214
|
//#endregion
|
|
241
215
|
//#region src/utils/normalize-hook.ts
|
|
@@ -255,71 +229,75 @@ function normalizeHook(hook) {
|
|
|
255
229
|
}
|
|
256
230
|
unreachable("Invalid hook type");
|
|
257
231
|
}
|
|
258
|
-
var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
|
|
259
|
-
init_misc();
|
|
260
|
-
} });
|
|
261
232
|
|
|
262
233
|
//#endregion
|
|
263
234
|
//#region src/constants/plugin.ts
|
|
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
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
235
|
+
const ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
236
|
+
"options",
|
|
237
|
+
"buildStart",
|
|
238
|
+
"resolveId",
|
|
239
|
+
"load",
|
|
240
|
+
"transform",
|
|
241
|
+
"moduleParsed",
|
|
242
|
+
"buildEnd",
|
|
243
|
+
"onLog",
|
|
244
|
+
"resolveDynamicImport",
|
|
245
|
+
"closeBundle",
|
|
246
|
+
"closeWatcher",
|
|
247
|
+
"watchChange"
|
|
248
|
+
];
|
|
249
|
+
const ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
|
|
250
|
+
"augmentChunkHash",
|
|
251
|
+
"outputOptions",
|
|
252
|
+
"renderChunk",
|
|
253
|
+
"renderStart",
|
|
254
|
+
"renderError",
|
|
255
|
+
"writeBundle",
|
|
256
|
+
"generateBundle"
|
|
257
|
+
];
|
|
258
|
+
const ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
259
|
+
...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
|
|
260
|
+
...ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES,
|
|
261
|
+
"footer",
|
|
262
|
+
"banner",
|
|
263
|
+
"intro",
|
|
264
|
+
"outro"
|
|
265
|
+
];
|
|
266
|
+
/**
|
|
267
|
+
* Names of all defined hooks. It's like
|
|
268
|
+
* ```js
|
|
269
|
+
* const DEFINED_HOOK_NAMES ={
|
|
270
|
+
* options: 'options',
|
|
271
|
+
* buildStart: 'buildStart',
|
|
272
|
+
* ...
|
|
273
|
+
* }
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
const DEFINED_HOOK_NAMES = {
|
|
277
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
|
|
278
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
|
|
279
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[2]]: ENUMERATED_PLUGIN_HOOK_NAMES[2],
|
|
280
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[3]]: ENUMERATED_PLUGIN_HOOK_NAMES[3],
|
|
281
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[4]]: ENUMERATED_PLUGIN_HOOK_NAMES[4],
|
|
282
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[5]]: ENUMERATED_PLUGIN_HOOK_NAMES[5],
|
|
283
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[6]]: ENUMERATED_PLUGIN_HOOK_NAMES[6],
|
|
284
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[7]]: ENUMERATED_PLUGIN_HOOK_NAMES[7],
|
|
285
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[8]]: ENUMERATED_PLUGIN_HOOK_NAMES[8],
|
|
286
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[9]]: ENUMERATED_PLUGIN_HOOK_NAMES[9],
|
|
287
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[10]]: ENUMERATED_PLUGIN_HOOK_NAMES[10],
|
|
288
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[11]]: ENUMERATED_PLUGIN_HOOK_NAMES[11],
|
|
289
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[12]]: ENUMERATED_PLUGIN_HOOK_NAMES[12],
|
|
290
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[13]]: ENUMERATED_PLUGIN_HOOK_NAMES[13],
|
|
291
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[14]]: ENUMERATED_PLUGIN_HOOK_NAMES[14],
|
|
292
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[15]]: ENUMERATED_PLUGIN_HOOK_NAMES[15],
|
|
293
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[16]]: ENUMERATED_PLUGIN_HOOK_NAMES[16],
|
|
294
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[17]]: ENUMERATED_PLUGIN_HOOK_NAMES[17],
|
|
295
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[18]]: ENUMERATED_PLUGIN_HOOK_NAMES[18],
|
|
296
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[19]]: ENUMERATED_PLUGIN_HOOK_NAMES[19],
|
|
297
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[20]]: ENUMERATED_PLUGIN_HOOK_NAMES[20],
|
|
298
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[21]]: ENUMERATED_PLUGIN_HOOK_NAMES[21],
|
|
299
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[22]]: ENUMERATED_PLUGIN_HOOK_NAMES[22]
|
|
300
|
+
};
|
|
323
301
|
|
|
324
302
|
//#endregion
|
|
325
303
|
//#region src/utils/async-flatten.ts
|
|
@@ -329,10 +307,10 @@ async function asyncFlatten(array$1) {
|
|
|
329
307
|
while (array$1.some((v) => v?.then));
|
|
330
308
|
return array$1;
|
|
331
309
|
}
|
|
332
|
-
var init_async_flatten = __esm({ "src/utils/async-flatten.ts"() {} });
|
|
333
310
|
|
|
334
311
|
//#endregion
|
|
335
312
|
//#region src/utils/normalize-plugin-option.ts
|
|
313
|
+
const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
336
314
|
function checkOutputPluginOption(plugins, onLog) {
|
|
337
315
|
for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
|
|
338
316
|
delete plugin[hook];
|
|
@@ -348,52 +326,66 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
348
326
|
}
|
|
349
327
|
return plugins;
|
|
350
328
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
init_plugin$1();
|
|
355
|
-
init_logging();
|
|
356
|
-
init_logs();
|
|
357
|
-
init_async_flatten();
|
|
358
|
-
normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
359
|
-
ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
360
|
-
ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
361
|
-
BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
|
|
362
|
-
} });
|
|
329
|
+
const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
330
|
+
const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
331
|
+
const BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
|
|
363
332
|
|
|
364
333
|
//#endregion
|
|
365
334
|
//#region src/plugin/minimal-plugin-context.ts
|
|
366
|
-
var MinimalPluginContextImpl
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
error(e) {
|
|
390
|
-
return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
} });
|
|
335
|
+
var MinimalPluginContextImpl = class {
|
|
336
|
+
info;
|
|
337
|
+
warn;
|
|
338
|
+
debug;
|
|
339
|
+
meta;
|
|
340
|
+
constructor(onLog, logLevel, pluginName, watchMode, hookName) {
|
|
341
|
+
this.pluginName = pluginName;
|
|
342
|
+
this.hookName = hookName;
|
|
343
|
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
344
|
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
345
|
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
346
|
+
this.meta = {
|
|
347
|
+
rollupVersion: "4.23.0",
|
|
348
|
+
rolldownVersion: VERSION,
|
|
349
|
+
watchMode
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
error(e) {
|
|
353
|
+
return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
|
|
354
|
+
}
|
|
355
|
+
};
|
|
394
356
|
|
|
395
357
|
//#endregion
|
|
396
358
|
//#region src/plugin/plugin-driver.ts
|
|
359
|
+
var PluginDriver = class {
|
|
360
|
+
static async callOptionsHook(inputOptions, watchMode = false) {
|
|
361
|
+
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
362
|
+
const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
|
|
363
|
+
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
364
|
+
for (const plugin of plugins) {
|
|
365
|
+
const name = plugin.name || "unknown";
|
|
366
|
+
const options = plugin.options;
|
|
367
|
+
if (options) {
|
|
368
|
+
const { handler } = normalizeHook(options);
|
|
369
|
+
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
370
|
+
if (result) inputOptions = result;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return inputOptions;
|
|
374
|
+
}
|
|
375
|
+
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
376
|
+
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
377
|
+
for (const plugin of sortedPlugins) {
|
|
378
|
+
const name = plugin.name || "unknown";
|
|
379
|
+
const options = plugin.outputOptions;
|
|
380
|
+
if (options) {
|
|
381
|
+
const { handler } = normalizeHook(options);
|
|
382
|
+
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
383
|
+
if (result) outputOptions = result;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return outputOptions;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
397
389
|
function getObjectPlugins(plugins) {
|
|
398
390
|
return plugins.filter((plugin) => {
|
|
399
391
|
if (!plugin) return void 0;
|
|
@@ -428,48 +420,10 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
428
420
|
...post
|
|
429
421
|
];
|
|
430
422
|
}
|
|
431
|
-
var PluginDriver;
|
|
432
|
-
var init_plugin_driver = __esm({ "src/plugin/plugin-driver.ts"() {
|
|
433
|
-
init_constructors();
|
|
434
|
-
init_logger();
|
|
435
|
-
init_logging();
|
|
436
|
-
init_normalize_hook();
|
|
437
|
-
init_normalize_plugin_option();
|
|
438
|
-
init_minimal_plugin_context();
|
|
439
|
-
PluginDriver = class {
|
|
440
|
-
static async callOptionsHook(inputOptions, watchMode = false) {
|
|
441
|
-
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
442
|
-
const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
|
|
443
|
-
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
444
|
-
for (const plugin of plugins) {
|
|
445
|
-
const name = plugin.name || "unknown";
|
|
446
|
-
const options = plugin.options;
|
|
447
|
-
if (options) {
|
|
448
|
-
const { handler } = normalizeHook(options);
|
|
449
|
-
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
450
|
-
if (result) inputOptions = result;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
return inputOptions;
|
|
454
|
-
}
|
|
455
|
-
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
456
|
-
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
457
|
-
for (const plugin of sortedPlugins) {
|
|
458
|
-
const name = plugin.name || "unknown";
|
|
459
|
-
const options = plugin.outputOptions;
|
|
460
|
-
if (options) {
|
|
461
|
-
const { handler } = normalizeHook(options);
|
|
462
|
-
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
463
|
-
if (result) outputOptions = result;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
return outputOptions;
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
} });
|
|
470
423
|
|
|
471
424
|
//#endregion
|
|
472
425
|
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js
|
|
426
|
+
var store$1;
|
|
473
427
|
/* @__NO_SIDE_EFFECTS__ */
|
|
474
428
|
function getGlobalConfig(config2) {
|
|
475
429
|
return {
|
|
@@ -479,14 +433,17 @@ function getGlobalConfig(config2) {
|
|
|
479
433
|
abortPipeEarly: config2?.abortPipeEarly ?? store$1?.abortPipeEarly
|
|
480
434
|
};
|
|
481
435
|
}
|
|
436
|
+
var store2;
|
|
482
437
|
/* @__NO_SIDE_EFFECTS__ */
|
|
483
438
|
function getGlobalMessage(lang) {
|
|
484
439
|
return store2?.get(lang);
|
|
485
440
|
}
|
|
441
|
+
var store3;
|
|
486
442
|
/* @__NO_SIDE_EFFECTS__ */
|
|
487
443
|
function getSchemaMessage(lang) {
|
|
488
444
|
return store3?.get(lang);
|
|
489
445
|
}
|
|
446
|
+
var store4;
|
|
490
447
|
/* @__NO_SIDE_EFFECTS__ */
|
|
491
448
|
function getSpecificMessage(reference, lang) {
|
|
492
449
|
return store4?.get(reference)?.get(lang);
|
|
@@ -544,6 +501,18 @@ function _joinExpects(values2, separator) {
|
|
|
544
501
|
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
545
502
|
return list[0] ?? "never";
|
|
546
503
|
}
|
|
504
|
+
var ValiError = class extends Error {
|
|
505
|
+
/**
|
|
506
|
+
* Creates a Valibot error with useful information.
|
|
507
|
+
*
|
|
508
|
+
* @param issues The error issues.
|
|
509
|
+
*/
|
|
510
|
+
constructor(issues) {
|
|
511
|
+
super(issues[0].message);
|
|
512
|
+
this.name = "ValiError";
|
|
513
|
+
this.issues = issues;
|
|
514
|
+
}
|
|
515
|
+
};
|
|
547
516
|
/* @__NO_SIDE_EFFECTS__ */
|
|
548
517
|
function args(schema) {
|
|
549
518
|
return {
|
|
@@ -1440,21 +1409,6 @@ function safeParse(schema, input, config2) {
|
|
|
1440
1409
|
issues: dataset.issues
|
|
1441
1410
|
};
|
|
1442
1411
|
}
|
|
1443
|
-
var store$1, store2, store3, store4, ValiError;
|
|
1444
|
-
var init_dist$2 = __esm({ "../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js"() {
|
|
1445
|
-
ValiError = class extends Error {
|
|
1446
|
-
/**
|
|
1447
|
-
* Creates a Valibot error with useful information.
|
|
1448
|
-
*
|
|
1449
|
-
* @param issues The error issues.
|
|
1450
|
-
*/
|
|
1451
|
-
constructor(issues) {
|
|
1452
|
-
super(issues[0].message);
|
|
1453
|
-
this.name = "ValiError";
|
|
1454
|
-
this.issues = issues;
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
} });
|
|
1458
1412
|
|
|
1459
1413
|
//#endregion
|
|
1460
1414
|
//#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
|
|
@@ -1672,6 +1626,7 @@ function convertAction(jsonSchema, valibotAction, config) {
|
|
|
1672
1626
|
function flattenPipe(pipe$1) {
|
|
1673
1627
|
return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
|
|
1674
1628
|
}
|
|
1629
|
+
let refCount = 0;
|
|
1675
1630
|
/**
|
|
1676
1631
|
* Converts any supported Valibot schema to the JSON Schema format.
|
|
1677
1632
|
*
|
|
@@ -1855,6 +1810,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
|
|
|
1855
1810
|
if (errors) for (const message of errors) handleError(message, config);
|
|
1856
1811
|
return jsonSchema;
|
|
1857
1812
|
}
|
|
1813
|
+
let store;
|
|
1858
1814
|
/**
|
|
1859
1815
|
* Returns the current global schema definitions.
|
|
1860
1816
|
*
|
|
@@ -1888,14 +1844,373 @@ function toJsonSchema(schema, config) {
|
|
|
1888
1844
|
if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
|
|
1889
1845
|
return jsonSchema;
|
|
1890
1846
|
}
|
|
1891
|
-
var refCount, store;
|
|
1892
|
-
var init_dist$1 = __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"() {
|
|
1893
|
-
init_dist$2();
|
|
1894
|
-
refCount = 0;
|
|
1895
|
-
} });
|
|
1896
1847
|
|
|
1897
1848
|
//#endregion
|
|
1898
1849
|
//#region src/utils/validator.ts
|
|
1850
|
+
const StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
1851
|
+
const LogLevelSchema = union([
|
|
1852
|
+
literal("debug"),
|
|
1853
|
+
literal("info"),
|
|
1854
|
+
literal("warn")
|
|
1855
|
+
]);
|
|
1856
|
+
const LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
|
|
1857
|
+
const LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
|
|
1858
|
+
const RollupLogSchema = any();
|
|
1859
|
+
const RollupLogWithStringSchema = union([RollupLogSchema, string()]);
|
|
1860
|
+
const InputOptionSchema = union([
|
|
1861
|
+
string(),
|
|
1862
|
+
array(string()),
|
|
1863
|
+
record(string(), string())
|
|
1864
|
+
]);
|
|
1865
|
+
const ExternalSchema = union([
|
|
1866
|
+
StringOrRegExpSchema,
|
|
1867
|
+
array(StringOrRegExpSchema),
|
|
1868
|
+
pipe(function_(), args(tuple([
|
|
1869
|
+
string(),
|
|
1870
|
+
optional(string()),
|
|
1871
|
+
boolean()
|
|
1872
|
+
])), returns(nullish(boolean())))
|
|
1873
|
+
]);
|
|
1874
|
+
const ModuleTypesSchema = record(string(), union([
|
|
1875
|
+
literal("asset"),
|
|
1876
|
+
literal("base64"),
|
|
1877
|
+
literal("binary"),
|
|
1878
|
+
literal("css"),
|
|
1879
|
+
literal("dataurl"),
|
|
1880
|
+
literal("empty"),
|
|
1881
|
+
literal("js"),
|
|
1882
|
+
literal("json"),
|
|
1883
|
+
literal("jsx"),
|
|
1884
|
+
literal("text"),
|
|
1885
|
+
literal("ts"),
|
|
1886
|
+
literal("tsx")
|
|
1887
|
+
]));
|
|
1888
|
+
const JsxOptionsSchema = strictObject({
|
|
1889
|
+
runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
|
|
1890
|
+
development: pipe(optional(boolean()), description("Development specific information")),
|
|
1891
|
+
throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
1892
|
+
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
1893
|
+
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
1894
|
+
pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
1895
|
+
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
1896
|
+
});
|
|
1897
|
+
const RollupJsxOptionsSchema = strictObject({
|
|
1898
|
+
mode: optional(union([
|
|
1899
|
+
literal("classic"),
|
|
1900
|
+
literal("automatic"),
|
|
1901
|
+
literal("preserve")
|
|
1902
|
+
])),
|
|
1903
|
+
factory: optional(string()),
|
|
1904
|
+
fragment: optional(string()),
|
|
1905
|
+
importSource: optional(string()),
|
|
1906
|
+
jsxImportSource: optional(string())
|
|
1907
|
+
});
|
|
1908
|
+
const HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
1909
|
+
const DecoratorOptionSchema = object({
|
|
1910
|
+
legacy: optional(boolean()),
|
|
1911
|
+
emitDecoratorMetadata: optional(boolean())
|
|
1912
|
+
});
|
|
1913
|
+
const HelpersSchema = object({ mode: optional(HelperModeSchema) });
|
|
1914
|
+
const RewriteImportExtensionsSchema = union([
|
|
1915
|
+
literal("rewrite"),
|
|
1916
|
+
literal("remove"),
|
|
1917
|
+
boolean()
|
|
1918
|
+
]);
|
|
1919
|
+
const TypescriptSchema = object({
|
|
1920
|
+
jsxPragma: optional(string()),
|
|
1921
|
+
jsxPragmaFrag: optional(string()),
|
|
1922
|
+
onlyRemoveTypeImports: optional(boolean()),
|
|
1923
|
+
allowNamespaces: optional(boolean()),
|
|
1924
|
+
allowDeclareFields: optional(boolean()),
|
|
1925
|
+
declaration: optional(object({
|
|
1926
|
+
stripInternal: optional(boolean()),
|
|
1927
|
+
sourcemap: optional(boolean())
|
|
1928
|
+
})),
|
|
1929
|
+
rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
|
|
1930
|
+
});
|
|
1931
|
+
const AssumptionsSchema = object({
|
|
1932
|
+
ignoreFunctionLength: optional(boolean()),
|
|
1933
|
+
noDocumentAll: optional(boolean()),
|
|
1934
|
+
objectRestNoSymbols: optional(boolean()),
|
|
1935
|
+
pureGetters: optional(boolean()),
|
|
1936
|
+
setPublicClassFields: optional(boolean())
|
|
1937
|
+
});
|
|
1938
|
+
const TransformOptionsSchema = object({
|
|
1939
|
+
assumptions: optional(AssumptionsSchema),
|
|
1940
|
+
typescript: optional(TypescriptSchema),
|
|
1941
|
+
helpers: optional(HelpersSchema),
|
|
1942
|
+
decorators: optional(DecoratorOptionSchema),
|
|
1943
|
+
jsx: optional(JsxOptionsSchema),
|
|
1944
|
+
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
1945
|
+
});
|
|
1946
|
+
const WatchOptionsSchema = strictObject({
|
|
1947
|
+
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
1948
|
+
exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
1949
|
+
include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
1950
|
+
notify: pipe(optional(strictObject({
|
|
1951
|
+
compareContents: optional(boolean()),
|
|
1952
|
+
pollInterval: optional(number())
|
|
1953
|
+
})), description("Notify options")),
|
|
1954
|
+
skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
|
|
1955
|
+
buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
|
|
1956
|
+
});
|
|
1957
|
+
const ChecksOptionsSchema = strictObject({
|
|
1958
|
+
circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
|
|
1959
|
+
eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
|
|
1960
|
+
missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
|
|
1961
|
+
missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
|
|
1962
|
+
mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
|
|
1963
|
+
unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
|
|
1964
|
+
unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
|
|
1965
|
+
filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
|
|
1966
|
+
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
1967
|
+
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
1968
|
+
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
1969
|
+
});
|
|
1970
|
+
const MinifyOptionsSchema = strictObject({
|
|
1971
|
+
mangle: optional(boolean()),
|
|
1972
|
+
compress: optional(boolean()),
|
|
1973
|
+
removeWhitespace: optional(boolean())
|
|
1974
|
+
});
|
|
1975
|
+
const ResolveOptionsSchema = strictObject({
|
|
1976
|
+
alias: optional(record(string(), union([string(), array(string())]))),
|
|
1977
|
+
aliasFields: optional(array(array(string()))),
|
|
1978
|
+
conditionNames: optional(array(string())),
|
|
1979
|
+
extensionAlias: optional(record(string(), array(string()))),
|
|
1980
|
+
exportsFields: optional(array(array(string()))),
|
|
1981
|
+
extensions: optional(array(string())),
|
|
1982
|
+
mainFields: optional(array(string())),
|
|
1983
|
+
mainFiles: optional(array(string())),
|
|
1984
|
+
modules: optional(array(string())),
|
|
1985
|
+
symlinks: optional(boolean()),
|
|
1986
|
+
tsconfigFilename: optional(string())
|
|
1987
|
+
});
|
|
1988
|
+
const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
1989
|
+
annotations: optional(boolean()),
|
|
1990
|
+
manualPureFunctions: optional(array(string())),
|
|
1991
|
+
unknownGlobalSideEffects: optional(boolean())
|
|
1992
|
+
})]);
|
|
1993
|
+
const OnLogSchema = pipe(function_(), args(tuple([
|
|
1994
|
+
LogLevelSchema,
|
|
1995
|
+
RollupLogSchema,
|
|
1996
|
+
pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
1997
|
+
])));
|
|
1998
|
+
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
1999
|
+
const HmrSchema = union([boolean(), strictObject({
|
|
2000
|
+
port: optional(number()),
|
|
2001
|
+
host: optional(string()),
|
|
2002
|
+
implement: optional(string())
|
|
2003
|
+
})]);
|
|
2004
|
+
const InputOptionsSchema = strictObject({
|
|
2005
|
+
input: optional(InputOptionSchema),
|
|
2006
|
+
plugins: optional(custom(() => true)),
|
|
2007
|
+
external: optional(ExternalSchema),
|
|
2008
|
+
makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
|
|
2009
|
+
resolve: optional(ResolveOptionsSchema),
|
|
2010
|
+
cwd: pipe(optional(string()), description("Current working directory")),
|
|
2011
|
+
platform: pipe(optional(union([
|
|
2012
|
+
literal("browser"),
|
|
2013
|
+
literal("neutral"),
|
|
2014
|
+
literal("node")
|
|
2015
|
+
])), description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
|
|
2016
|
+
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2017
|
+
treeshake: optional(TreeshakingOptionsSchema),
|
|
2018
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
|
|
2019
|
+
onLog: optional(OnLogSchema),
|
|
2020
|
+
onwarn: optional(OnwarnSchema),
|
|
2021
|
+
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
2022
|
+
experimental: optional(strictObject({
|
|
2023
|
+
disableLiveBindings: optional(boolean()),
|
|
2024
|
+
enableComposingJsPlugins: optional(boolean()),
|
|
2025
|
+
resolveNewUrlToAsset: optional(boolean()),
|
|
2026
|
+
strictExecutionOrder: optional(boolean()),
|
|
2027
|
+
hmr: optional(HmrSchema),
|
|
2028
|
+
attachDebugInfo: optional(union([
|
|
2029
|
+
literal("none"),
|
|
2030
|
+
literal("simple"),
|
|
2031
|
+
literal("full")
|
|
2032
|
+
]))
|
|
2033
|
+
})),
|
|
2034
|
+
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2035
|
+
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2036
|
+
profilerNames: optional(boolean()),
|
|
2037
|
+
jsx: optional(union([
|
|
2038
|
+
literal(false),
|
|
2039
|
+
literal("react"),
|
|
2040
|
+
literal("react-jsx"),
|
|
2041
|
+
literal("preserve"),
|
|
2042
|
+
RollupJsxOptionsSchema
|
|
2043
|
+
])),
|
|
2044
|
+
transform: optional(TransformOptionsSchema),
|
|
2045
|
+
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2046
|
+
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
2047
|
+
checks: optional(ChecksOptionsSchema),
|
|
2048
|
+
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
2049
|
+
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.")),
|
|
2050
|
+
preserveEntrySignatures: pipe(optional(union([
|
|
2051
|
+
literal("strict"),
|
|
2052
|
+
literal("allow-extension"),
|
|
2053
|
+
literal("exports-only"),
|
|
2054
|
+
literal(false)
|
|
2055
|
+
])))
|
|
2056
|
+
});
|
|
2057
|
+
const InputCliOverrideSchema = strictObject({
|
|
2058
|
+
input: pipe(optional(array(string())), description("Entry file")),
|
|
2059
|
+
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2060
|
+
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2061
|
+
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2062
|
+
makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
|
|
2063
|
+
jsx: pipe(optional(union([
|
|
2064
|
+
literal(false),
|
|
2065
|
+
literal("react"),
|
|
2066
|
+
literal("react-jsx"),
|
|
2067
|
+
literal("preserve")
|
|
2068
|
+
])), description("Jsx options preset")),
|
|
2069
|
+
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
|
|
2070
|
+
});
|
|
2071
|
+
const InputCliOptionsSchema = omit(strictObject({
|
|
2072
|
+
...InputOptionsSchema.entries,
|
|
2073
|
+
...InputCliOverrideSchema.entries
|
|
2074
|
+
}), [
|
|
2075
|
+
"plugins",
|
|
2076
|
+
"onwarn",
|
|
2077
|
+
"onLog",
|
|
2078
|
+
"resolve",
|
|
2079
|
+
"experimental",
|
|
2080
|
+
"profilerNames",
|
|
2081
|
+
"watch"
|
|
2082
|
+
]);
|
|
2083
|
+
const ModuleFormatSchema = union([
|
|
2084
|
+
literal("es"),
|
|
2085
|
+
literal("cjs"),
|
|
2086
|
+
literal("esm"),
|
|
2087
|
+
literal("module"),
|
|
2088
|
+
literal("commonjs"),
|
|
2089
|
+
literal("iife"),
|
|
2090
|
+
literal("umd")
|
|
2091
|
+
]);
|
|
2092
|
+
const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
2093
|
+
const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2094
|
+
const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2095
|
+
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2096
|
+
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2097
|
+
const AdvancedChunksSchema = strictObject({
|
|
2098
|
+
minSize: optional(number()),
|
|
2099
|
+
maxSize: optional(number()),
|
|
2100
|
+
minModuleSize: optional(number()),
|
|
2101
|
+
maxModuleSize: optional(number()),
|
|
2102
|
+
minShareCount: optional(number()),
|
|
2103
|
+
groups: optional(array(strictObject({
|
|
2104
|
+
name: string(),
|
|
2105
|
+
test: optional(union([
|
|
2106
|
+
string(),
|
|
2107
|
+
instance(RegExp),
|
|
2108
|
+
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
2109
|
+
])),
|
|
2110
|
+
priority: optional(number()),
|
|
2111
|
+
minSize: optional(number()),
|
|
2112
|
+
minShareCount: optional(number()),
|
|
2113
|
+
maxSize: optional(number()),
|
|
2114
|
+
minModuleSize: optional(number()),
|
|
2115
|
+
maxModuleSize: optional(number())
|
|
2116
|
+
})))
|
|
2117
|
+
});
|
|
2118
|
+
const OutputOptionsSchema = strictObject({
|
|
2119
|
+
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2120
|
+
file: pipe(optional(string()), description("Single output file")),
|
|
2121
|
+
exports: pipe(optional(union([
|
|
2122
|
+
literal("auto"),
|
|
2123
|
+
literal("named"),
|
|
2124
|
+
literal("default"),
|
|
2125
|
+
literal("none")
|
|
2126
|
+
])), description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
|
|
2127
|
+
hashCharacters: pipe(optional(union([
|
|
2128
|
+
literal("base64"),
|
|
2129
|
+
literal("base36"),
|
|
2130
|
+
literal("hex")
|
|
2131
|
+
])), description("Use the specified character set for file hashes")),
|
|
2132
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
|
|
2133
|
+
sourcemap: pipe(optional(union([
|
|
2134
|
+
boolean(),
|
|
2135
|
+
literal("inline"),
|
|
2136
|
+
literal("hidden")
|
|
2137
|
+
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2138
|
+
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2139
|
+
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
2140
|
+
sourcemapPathTransform: optional(custom(() => true)),
|
|
2141
|
+
banner: optional(union([string(), AddonFunctionSchema])),
|
|
2142
|
+
footer: optional(union([string(), AddonFunctionSchema])),
|
|
2143
|
+
intro: optional(union([string(), AddonFunctionSchema])),
|
|
2144
|
+
outro: optional(union([string(), AddonFunctionSchema])),
|
|
2145
|
+
extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2146
|
+
esModule: optional(union([boolean(), literal("if-default-prop")])),
|
|
2147
|
+
assetFileNames: optional(AssetFileNamesSchema),
|
|
2148
|
+
entryFileNames: optional(ChunkFileNamesSchema),
|
|
2149
|
+
chunkFileNames: optional(ChunkFileNamesSchema),
|
|
2150
|
+
cssEntryFileNames: optional(ChunkFileNamesSchema),
|
|
2151
|
+
cssChunkFileNames: optional(ChunkFileNamesSchema),
|
|
2152
|
+
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2153
|
+
minify: pipe(optional(union([
|
|
2154
|
+
boolean(),
|
|
2155
|
+
string("dce-only"),
|
|
2156
|
+
MinifyOptionsSchema
|
|
2157
|
+
])), description("Minify the bundled file")),
|
|
2158
|
+
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2159
|
+
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2160
|
+
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2161
|
+
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2162
|
+
manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
|
|
2163
|
+
advancedChunks: optional(AdvancedChunksSchema),
|
|
2164
|
+
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2165
|
+
plugins: optional(custom(() => true)),
|
|
2166
|
+
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2167
|
+
hoistTransitiveImports: optional(custom((input) => {
|
|
2168
|
+
if (input) return false;
|
|
2169
|
+
return true;
|
|
2170
|
+
}, () => `The 'true' value is not supported`)),
|
|
2171
|
+
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2172
|
+
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2173
|
+
virtualDirname: optional(string())
|
|
2174
|
+
});
|
|
2175
|
+
const getAddonDescription = (placement, wrapper) => {
|
|
2176
|
+
return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
|
|
2177
|
+
};
|
|
2178
|
+
const OutputCliOverrideSchema = strictObject({
|
|
2179
|
+
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
2180
|
+
entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
|
|
2181
|
+
chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
|
|
2182
|
+
cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
|
|
2183
|
+
cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
|
|
2184
|
+
sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
|
|
2185
|
+
banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
|
|
2186
|
+
footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
|
|
2187
|
+
intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
|
|
2188
|
+
outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
|
|
2189
|
+
esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2190
|
+
globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2191
|
+
advancedChunks: pipe(optional(strictObject({
|
|
2192
|
+
minSize: pipe(optional(number()), description("Minimum size of the chunk")),
|
|
2193
|
+
minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
|
|
2194
|
+
})), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2195
|
+
minify: pipe(optional(boolean()), description("Minify the bundled file"))
|
|
2196
|
+
});
|
|
2197
|
+
const OutputCliOptionsSchema = omit(strictObject({
|
|
2198
|
+
...OutputOptionsSchema.entries,
|
|
2199
|
+
...OutputCliOverrideSchema.entries
|
|
2200
|
+
}), [
|
|
2201
|
+
"sourcemapIgnoreList",
|
|
2202
|
+
"sourcemapPathTransform",
|
|
2203
|
+
"plugins",
|
|
2204
|
+
"hoistTransitiveImports"
|
|
2205
|
+
]);
|
|
2206
|
+
const CliOptionsSchema = strictObject({
|
|
2207
|
+
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2208
|
+
help: pipe(optional(boolean()), description("Show help")),
|
|
2209
|
+
version: pipe(optional(boolean()), description("Show version number")),
|
|
2210
|
+
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2211
|
+
...InputCliOptionsSchema.entries,
|
|
2212
|
+
...OutputCliOptionsSchema.entries
|
|
2213
|
+
});
|
|
1899
2214
|
function validateCliOptions(options) {
|
|
1900
2215
|
let parsed = safeParse(CliOptionsSchema, options);
|
|
1901
2216
|
return [parsed.output, parsed.issues?.map((issue) => {
|
|
@@ -1903,6 +2218,8 @@ function validateCliOptions(options) {
|
|
|
1903
2218
|
return `Invalid value for option ${option}: ${issue.message}`;
|
|
1904
2219
|
})];
|
|
1905
2220
|
}
|
|
2221
|
+
const inputHelperMsgRecord = { output: { ignored: true } };
|
|
2222
|
+
const outputHelperMsgRecord = {};
|
|
1906
2223
|
function validateOption(key, options) {
|
|
1907
2224
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
1908
2225
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
@@ -1934,405 +2251,38 @@ function getOutputCliKeys() {
|
|
|
1934
2251
|
function getJsonSchema() {
|
|
1935
2252
|
return toJsonSchema(CliOptionsSchema, { errorMode: "ignore" });
|
|
1936
2253
|
}
|
|
1937
|
-
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;
|
|
1938
|
-
var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
1939
|
-
init_dist$1();
|
|
1940
|
-
init_dist$2();
|
|
1941
|
-
StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
1942
|
-
LogLevelSchema = union([
|
|
1943
|
-
literal("debug"),
|
|
1944
|
-
literal("info"),
|
|
1945
|
-
literal("warn")
|
|
1946
|
-
]);
|
|
1947
|
-
LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
|
|
1948
|
-
LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
|
|
1949
|
-
RollupLogSchema = any();
|
|
1950
|
-
RollupLogWithStringSchema = union([RollupLogSchema, string()]);
|
|
1951
|
-
InputOptionSchema = union([
|
|
1952
|
-
string(),
|
|
1953
|
-
array(string()),
|
|
1954
|
-
record(string(), string())
|
|
1955
|
-
]);
|
|
1956
|
-
ExternalSchema = union([
|
|
1957
|
-
StringOrRegExpSchema,
|
|
1958
|
-
array(StringOrRegExpSchema),
|
|
1959
|
-
pipe(function_(), args(tuple([
|
|
1960
|
-
string(),
|
|
1961
|
-
optional(string()),
|
|
1962
|
-
boolean()
|
|
1963
|
-
])), returns(nullish(boolean())))
|
|
1964
|
-
]);
|
|
1965
|
-
ModuleTypesSchema = record(string(), union([
|
|
1966
|
-
literal("asset"),
|
|
1967
|
-
literal("base64"),
|
|
1968
|
-
literal("binary"),
|
|
1969
|
-
literal("css"),
|
|
1970
|
-
literal("dataurl"),
|
|
1971
|
-
literal("empty"),
|
|
1972
|
-
literal("js"),
|
|
1973
|
-
literal("json"),
|
|
1974
|
-
literal("jsx"),
|
|
1975
|
-
literal("text"),
|
|
1976
|
-
literal("ts"),
|
|
1977
|
-
literal("tsx")
|
|
1978
|
-
]));
|
|
1979
|
-
JsxOptionsSchema = strictObject({
|
|
1980
|
-
runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
|
|
1981
|
-
development: pipe(optional(boolean()), description("Development specific information")),
|
|
1982
|
-
throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
1983
|
-
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
1984
|
-
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
1985
|
-
pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
1986
|
-
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
1987
|
-
});
|
|
1988
|
-
RollupJsxOptionsSchema = strictObject({
|
|
1989
|
-
mode: optional(union([
|
|
1990
|
-
literal("classic"),
|
|
1991
|
-
literal("automatic"),
|
|
1992
|
-
literal("preserve")
|
|
1993
|
-
])),
|
|
1994
|
-
factory: optional(string()),
|
|
1995
|
-
fragment: optional(string()),
|
|
1996
|
-
importSource: optional(string()),
|
|
1997
|
-
jsxImportSource: optional(string())
|
|
1998
|
-
});
|
|
1999
|
-
HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
2000
|
-
DecoratorOptionSchema = object({
|
|
2001
|
-
legacy: optional(boolean()),
|
|
2002
|
-
emitDecoratorMetadata: optional(boolean())
|
|
2003
|
-
});
|
|
2004
|
-
HelpersSchema = object({ mode: optional(HelperModeSchema) });
|
|
2005
|
-
RewriteImportExtensionsSchema = union([
|
|
2006
|
-
literal("rewrite"),
|
|
2007
|
-
literal("remove"),
|
|
2008
|
-
boolean()
|
|
2009
|
-
]);
|
|
2010
|
-
TypescriptSchema = object({
|
|
2011
|
-
jsxPragma: optional(string()),
|
|
2012
|
-
jsxPragmaFrag: optional(string()),
|
|
2013
|
-
onlyRemoveTypeImports: optional(boolean()),
|
|
2014
|
-
allowNamespaces: optional(boolean()),
|
|
2015
|
-
allowDeclareFields: optional(boolean()),
|
|
2016
|
-
declaration: optional(object({
|
|
2017
|
-
stripInternal: optional(boolean()),
|
|
2018
|
-
sourcemap: optional(boolean())
|
|
2019
|
-
})),
|
|
2020
|
-
rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
|
|
2021
|
-
});
|
|
2022
|
-
AssumptionsSchema = object({
|
|
2023
|
-
ignoreFunctionLength: optional(boolean()),
|
|
2024
|
-
noDocumentAll: optional(boolean()),
|
|
2025
|
-
objectRestNoSymbols: optional(boolean()),
|
|
2026
|
-
pureGetters: optional(boolean()),
|
|
2027
|
-
setPublicClassFields: optional(boolean())
|
|
2028
|
-
});
|
|
2029
|
-
TransformOptionsSchema = object({
|
|
2030
|
-
assumptions: optional(AssumptionsSchema),
|
|
2031
|
-
typescript: optional(TypescriptSchema),
|
|
2032
|
-
helpers: optional(HelpersSchema),
|
|
2033
|
-
decorators: optional(DecoratorOptionSchema),
|
|
2034
|
-
jsx: optional(JsxOptionsSchema),
|
|
2035
|
-
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2036
|
-
});
|
|
2037
|
-
WatchOptionsSchema = strictObject({
|
|
2038
|
-
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
2039
|
-
exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2040
|
-
include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2041
|
-
notify: pipe(optional(strictObject({
|
|
2042
|
-
compareContents: optional(boolean()),
|
|
2043
|
-
pollInterval: optional(number())
|
|
2044
|
-
})), description("Notify options")),
|
|
2045
|
-
skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
|
|
2046
|
-
buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
|
|
2047
|
-
});
|
|
2048
|
-
ChecksOptionsSchema = strictObject({
|
|
2049
|
-
circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
|
|
2050
|
-
eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
|
|
2051
|
-
missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
|
|
2052
|
-
missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
|
|
2053
|
-
mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
|
|
2054
|
-
unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
|
|
2055
|
-
unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
|
|
2056
|
-
filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
|
|
2057
|
-
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2058
|
-
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2059
|
-
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2060
|
-
});
|
|
2061
|
-
MinifyOptionsSchema = strictObject({
|
|
2062
|
-
mangle: optional(boolean()),
|
|
2063
|
-
compress: optional(boolean()),
|
|
2064
|
-
removeWhitespace: optional(boolean())
|
|
2065
|
-
});
|
|
2066
|
-
ResolveOptionsSchema = strictObject({
|
|
2067
|
-
alias: optional(record(string(), union([string(), array(string())]))),
|
|
2068
|
-
aliasFields: optional(array(array(string()))),
|
|
2069
|
-
conditionNames: optional(array(string())),
|
|
2070
|
-
extensionAlias: optional(record(string(), array(string()))),
|
|
2071
|
-
exportsFields: optional(array(array(string()))),
|
|
2072
|
-
extensions: optional(array(string())),
|
|
2073
|
-
mainFields: optional(array(string())),
|
|
2074
|
-
mainFiles: optional(array(string())),
|
|
2075
|
-
modules: optional(array(string())),
|
|
2076
|
-
symlinks: optional(boolean()),
|
|
2077
|
-
tsconfigFilename: optional(string())
|
|
2078
|
-
});
|
|
2079
|
-
TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2080
|
-
annotations: optional(boolean()),
|
|
2081
|
-
manualPureFunctions: optional(array(string())),
|
|
2082
|
-
unknownGlobalSideEffects: optional(boolean())
|
|
2083
|
-
})]);
|
|
2084
|
-
OnLogSchema = pipe(function_(), args(tuple([
|
|
2085
|
-
LogLevelSchema,
|
|
2086
|
-
RollupLogSchema,
|
|
2087
|
-
pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
2088
|
-
])));
|
|
2089
|
-
OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2090
|
-
HmrSchema = union([boolean(), strictObject({
|
|
2091
|
-
port: optional(number()),
|
|
2092
|
-
host: optional(string()),
|
|
2093
|
-
implement: optional(string())
|
|
2094
|
-
})]);
|
|
2095
|
-
InputOptionsSchema = strictObject({
|
|
2096
|
-
input: optional(InputOptionSchema),
|
|
2097
|
-
plugins: optional(custom(() => true)),
|
|
2098
|
-
external: optional(ExternalSchema),
|
|
2099
|
-
makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
|
|
2100
|
-
resolve: optional(ResolveOptionsSchema),
|
|
2101
|
-
cwd: pipe(optional(string()), description("Current working directory")),
|
|
2102
|
-
platform: pipe(optional(union([
|
|
2103
|
-
literal("browser"),
|
|
2104
|
-
literal("neutral"),
|
|
2105
|
-
literal("node")
|
|
2106
|
-
])), description(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`)),
|
|
2107
|
-
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2108
|
-
treeshake: optional(TreeshakingOptionsSchema),
|
|
2109
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`)),
|
|
2110
|
-
onLog: optional(OnLogSchema),
|
|
2111
|
-
onwarn: optional(OnwarnSchema),
|
|
2112
|
-
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
2113
|
-
experimental: optional(strictObject({
|
|
2114
|
-
disableLiveBindings: optional(boolean()),
|
|
2115
|
-
enableComposingJsPlugins: optional(boolean()),
|
|
2116
|
-
resolveNewUrlToAsset: optional(boolean()),
|
|
2117
|
-
strictExecutionOrder: optional(boolean()),
|
|
2118
|
-
hmr: optional(HmrSchema),
|
|
2119
|
-
attachDebugInfo: optional(boolean())
|
|
2120
|
-
})),
|
|
2121
|
-
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2122
|
-
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2123
|
-
profilerNames: optional(boolean()),
|
|
2124
|
-
jsx: optional(union([
|
|
2125
|
-
literal(false),
|
|
2126
|
-
literal("react"),
|
|
2127
|
-
literal("react-jsx"),
|
|
2128
|
-
literal("preserve"),
|
|
2129
|
-
RollupJsxOptionsSchema
|
|
2130
|
-
])),
|
|
2131
|
-
transform: optional(TransformOptionsSchema),
|
|
2132
|
-
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2133
|
-
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
2134
|
-
checks: optional(ChecksOptionsSchema),
|
|
2135
|
-
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
2136
|
-
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.")),
|
|
2137
|
-
preserveEntrySignatures: pipe(optional(union([
|
|
2138
|
-
literal("strict"),
|
|
2139
|
-
literal("allow-extension"),
|
|
2140
|
-
literal("exports-only"),
|
|
2141
|
-
literal(false)
|
|
2142
|
-
])))
|
|
2143
|
-
});
|
|
2144
|
-
InputCliOverrideSchema = strictObject({
|
|
2145
|
-
input: pipe(optional(array(string())), description("Entry file")),
|
|
2146
|
-
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2147
|
-
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2148
|
-
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2149
|
-
makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
|
|
2150
|
-
jsx: pipe(optional(union([
|
|
2151
|
-
literal(false),
|
|
2152
|
-
literal("react"),
|
|
2153
|
-
literal("react-jsx"),
|
|
2154
|
-
literal("preserve")
|
|
2155
|
-
])), description("Jsx options preset")),
|
|
2156
|
-
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
|
|
2157
|
-
});
|
|
2158
|
-
InputCliOptionsSchema = omit(strictObject({
|
|
2159
|
-
...InputOptionsSchema.entries,
|
|
2160
|
-
...InputCliOverrideSchema.entries
|
|
2161
|
-
}), [
|
|
2162
|
-
"plugins",
|
|
2163
|
-
"onwarn",
|
|
2164
|
-
"onLog",
|
|
2165
|
-
"resolve",
|
|
2166
|
-
"experimental",
|
|
2167
|
-
"profilerNames",
|
|
2168
|
-
"watch"
|
|
2169
|
-
]);
|
|
2170
|
-
ModuleFormatSchema = union([
|
|
2171
|
-
literal("es"),
|
|
2172
|
-
literal("cjs"),
|
|
2173
|
-
literal("esm"),
|
|
2174
|
-
literal("module"),
|
|
2175
|
-
literal("commonjs"),
|
|
2176
|
-
literal("iife"),
|
|
2177
|
-
literal("umd")
|
|
2178
|
-
]);
|
|
2179
|
-
AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
2180
|
-
ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2181
|
-
AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2182
|
-
SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2183
|
-
GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2184
|
-
AdvancedChunksSchema = strictObject({
|
|
2185
|
-
minSize: optional(number()),
|
|
2186
|
-
maxSize: optional(number()),
|
|
2187
|
-
minModuleSize: optional(number()),
|
|
2188
|
-
maxModuleSize: optional(number()),
|
|
2189
|
-
minShareCount: optional(number()),
|
|
2190
|
-
groups: optional(array(strictObject({
|
|
2191
|
-
name: string(),
|
|
2192
|
-
test: optional(union([
|
|
2193
|
-
string(),
|
|
2194
|
-
instance(RegExp),
|
|
2195
|
-
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
2196
|
-
])),
|
|
2197
|
-
priority: optional(number()),
|
|
2198
|
-
minSize: optional(number()),
|
|
2199
|
-
minShareCount: optional(number()),
|
|
2200
|
-
maxSize: optional(number()),
|
|
2201
|
-
minModuleSize: optional(number()),
|
|
2202
|
-
maxModuleSize: optional(number())
|
|
2203
|
-
})))
|
|
2204
|
-
});
|
|
2205
|
-
OutputOptionsSchema = strictObject({
|
|
2206
|
-
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2207
|
-
file: pipe(optional(string()), description("Single output file")),
|
|
2208
|
-
exports: pipe(optional(union([
|
|
2209
|
-
literal("auto"),
|
|
2210
|
-
literal("named"),
|
|
2211
|
-
literal("default"),
|
|
2212
|
-
literal("none")
|
|
2213
|
-
])), description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
|
|
2214
|
-
hashCharacters: pipe(optional(union([
|
|
2215
|
-
literal("base64"),
|
|
2216
|
-
literal("base36"),
|
|
2217
|
-
literal("hex")
|
|
2218
|
-
])), description("Use the specified character set for file hashes")),
|
|
2219
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
|
|
2220
|
-
sourcemap: pipe(optional(union([
|
|
2221
|
-
boolean(),
|
|
2222
|
-
literal("inline"),
|
|
2223
|
-
literal("hidden")
|
|
2224
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2225
|
-
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2226
|
-
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
2227
|
-
sourcemapPathTransform: optional(custom(() => true)),
|
|
2228
|
-
banner: optional(union([string(), AddonFunctionSchema])),
|
|
2229
|
-
footer: optional(union([string(), AddonFunctionSchema])),
|
|
2230
|
-
intro: optional(union([string(), AddonFunctionSchema])),
|
|
2231
|
-
outro: optional(union([string(), AddonFunctionSchema])),
|
|
2232
|
-
extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2233
|
-
esModule: optional(union([boolean(), literal("if-default-prop")])),
|
|
2234
|
-
assetFileNames: optional(AssetFileNamesSchema),
|
|
2235
|
-
entryFileNames: optional(ChunkFileNamesSchema),
|
|
2236
|
-
chunkFileNames: optional(ChunkFileNamesSchema),
|
|
2237
|
-
cssEntryFileNames: optional(ChunkFileNamesSchema),
|
|
2238
|
-
cssChunkFileNames: optional(ChunkFileNamesSchema),
|
|
2239
|
-
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2240
|
-
minify: pipe(optional(union([
|
|
2241
|
-
boolean(),
|
|
2242
|
-
string("dce-only"),
|
|
2243
|
-
MinifyOptionsSchema
|
|
2244
|
-
])), description("Minify the bundled file")),
|
|
2245
|
-
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2246
|
-
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2247
|
-
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2248
|
-
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2249
|
-
manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
|
|
2250
|
-
advancedChunks: optional(AdvancedChunksSchema),
|
|
2251
|
-
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2252
|
-
plugins: optional(custom(() => true)),
|
|
2253
|
-
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2254
|
-
hoistTransitiveImports: optional(custom((input) => {
|
|
2255
|
-
if (input) return false;
|
|
2256
|
-
return true;
|
|
2257
|
-
}, () => `The 'true' value is not supported`)),
|
|
2258
|
-
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2259
|
-
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2260
|
-
virtualDirname: optional(string())
|
|
2261
|
-
});
|
|
2262
|
-
getAddonDescription = (placement, wrapper) => {
|
|
2263
|
-
return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
|
|
2264
|
-
};
|
|
2265
|
-
OutputCliOverrideSchema = strictObject({
|
|
2266
|
-
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
2267
|
-
entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
|
|
2268
|
-
chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
|
|
2269
|
-
cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
|
|
2270
|
-
cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
|
|
2271
|
-
sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
|
|
2272
|
-
banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
|
|
2273
|
-
footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
|
|
2274
|
-
intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
|
|
2275
|
-
outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
|
|
2276
|
-
esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2277
|
-
globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2278
|
-
advancedChunks: pipe(optional(strictObject({
|
|
2279
|
-
minSize: pipe(optional(number()), description("Minimum size of the chunk")),
|
|
2280
|
-
minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
|
|
2281
|
-
})), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2282
|
-
minify: pipe(optional(boolean()), description("Minify the bundled file"))
|
|
2283
|
-
});
|
|
2284
|
-
OutputCliOptionsSchema = omit(strictObject({
|
|
2285
|
-
...OutputOptionsSchema.entries,
|
|
2286
|
-
...OutputCliOverrideSchema.entries
|
|
2287
|
-
}), [
|
|
2288
|
-
"sourcemapIgnoreList",
|
|
2289
|
-
"sourcemapPathTransform",
|
|
2290
|
-
"plugins",
|
|
2291
|
-
"hoistTransitiveImports"
|
|
2292
|
-
]);
|
|
2293
|
-
CliOptionsSchema = strictObject({
|
|
2294
|
-
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2295
|
-
help: pipe(optional(boolean()), description("Show help")),
|
|
2296
|
-
version: pipe(optional(boolean()), description("Show version number")),
|
|
2297
|
-
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2298
|
-
...InputCliOptionsSchema.entries,
|
|
2299
|
-
...OutputCliOptionsSchema.entries
|
|
2300
|
-
});
|
|
2301
|
-
inputHelperMsgRecord = { output: { ignored: true } };
|
|
2302
|
-
outputHelperMsgRecord = {};
|
|
2303
|
-
} });
|
|
2304
2254
|
|
|
2305
2255
|
//#endregion
|
|
2306
2256
|
//#region src/constants/plugin-context.ts
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2257
|
+
/**
|
|
2258
|
+
* If Composed plugins call `this.resolve` with `skipSelf: true`, the composed plugins will be skipped as a whole.
|
|
2259
|
+
* To prevent that, we use this symbol to store the actual caller of `this.resolve` with `skipSelf: true`. And we
|
|
2260
|
+
* will modify the skipSelf option to `false` and use this symbol to skip the caller itself in the composed plugins
|
|
2261
|
+
* internally.
|
|
2262
|
+
*/
|
|
2263
|
+
const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
2311
2264
|
|
|
2312
2265
|
//#endregion
|
|
2313
2266
|
//#region src/options/normalized-input-options.ts
|
|
2314
|
-
var NormalizedInputOptionsImpl
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
}
|
|
2334
|
-
};
|
|
2335
|
-
} });
|
|
2267
|
+
var NormalizedInputOptionsImpl = class {
|
|
2268
|
+
inner;
|
|
2269
|
+
constructor(inner, onLog) {
|
|
2270
|
+
this.onLog = onLog;
|
|
2271
|
+
this.inner = inner;
|
|
2272
|
+
}
|
|
2273
|
+
get shimMissingExports() {
|
|
2274
|
+
return this.inner.shimMissingExports;
|
|
2275
|
+
}
|
|
2276
|
+
get input() {
|
|
2277
|
+
return this.inner.input;
|
|
2278
|
+
}
|
|
2279
|
+
get cwd() {
|
|
2280
|
+
return this.inner.cwd ?? void 0;
|
|
2281
|
+
}
|
|
2282
|
+
get platform() {
|
|
2283
|
+
return this.inner.platform;
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2336
2286
|
|
|
2337
2287
|
//#endregion
|
|
2338
2288
|
//#region src/types/sourcemap.ts
|
|
@@ -2349,12 +2299,11 @@ function bindingifySourcemap(map) {
|
|
|
2349
2299
|
debugId: "debugId" in map ? map.debugId : void 0
|
|
2350
2300
|
} };
|
|
2351
2301
|
}
|
|
2352
|
-
var init_sourcemap = __esm({ "src/types/sourcemap.ts"() {} });
|
|
2353
2302
|
|
|
2354
2303
|
//#endregion
|
|
2355
2304
|
//#region src/utils/error.ts
|
|
2356
2305
|
function normalizeErrors(rawErrors) {
|
|
2357
|
-
const errors = rawErrors.map((e) => e instanceof Error ? e : Object.assign(new Error(), {
|
|
2306
|
+
const errors = rawErrors.map((e) => e instanceof Error ? e : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2358
2307
|
kind: e.kind,
|
|
2359
2308
|
message: e.message,
|
|
2360
2309
|
stack: void 0
|
|
@@ -2400,7 +2349,6 @@ function getErrorMessage(e) {
|
|
|
2400
2349
|
function joinNewLine(s1, s2) {
|
|
2401
2350
|
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
2402
2351
|
}
|
|
2403
|
-
var init_error = __esm({ "src/utils/error.ts"() {} });
|
|
2404
2352
|
|
|
2405
2353
|
//#endregion
|
|
2406
2354
|
//#region src/utils/transform-module-info.ts
|
|
@@ -2422,26 +2370,19 @@ function transformModuleInfo(info, option) {
|
|
|
2422
2370
|
...option
|
|
2423
2371
|
};
|
|
2424
2372
|
}
|
|
2425
|
-
var init_transform_module_info = __esm({ "src/utils/transform-module-info.ts"() {
|
|
2426
|
-
init_misc();
|
|
2427
|
-
} });
|
|
2428
2373
|
|
|
2429
2374
|
//#endregion
|
|
2430
2375
|
//#region src/utils/transform-side-effects.ts
|
|
2431
2376
|
function bindingifySideEffects(sideEffects) {
|
|
2432
2377
|
switch (sideEffects) {
|
|
2433
|
-
case true: return
|
|
2434
|
-
case false: return
|
|
2435
|
-
case "no-treeshake": return
|
|
2378
|
+
case true: return BindingHookSideEffects.True;
|
|
2379
|
+
case false: return BindingHookSideEffects.False;
|
|
2380
|
+
case "no-treeshake": return BindingHookSideEffects.NoTreeshake;
|
|
2436
2381
|
case null:
|
|
2437
2382
|
case void 0: return void 0;
|
|
2438
2383
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
2439
2384
|
}
|
|
2440
2385
|
}
|
|
2441
|
-
var import_binding$5;
|
|
2442
|
-
var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"() {
|
|
2443
|
-
import_binding$5 = __toESM(require_binding());
|
|
2444
|
-
} });
|
|
2445
2386
|
|
|
2446
2387
|
//#endregion
|
|
2447
2388
|
//#region src/utils/transform-sourcemap.ts
|
|
@@ -2457,10 +2398,9 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
|
|
2457
2398
|
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
|
|
2458
2399
|
return map;
|
|
2459
2400
|
}
|
|
2460
|
-
var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
|
|
2461
2401
|
|
|
2462
2402
|
//#endregion
|
|
2463
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2403
|
+
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2464
2404
|
function u$1(o, n, a) {
|
|
2465
2405
|
let t$1 = (r) => o(r, ...n);
|
|
2466
2406
|
return a === void 0 ? t$1 : Object.assign(t$1, {
|
|
@@ -2468,50 +2408,32 @@ function u$1(o, n, a) {
|
|
|
2468
2408
|
lazyArgs: n
|
|
2469
2409
|
});
|
|
2470
2410
|
}
|
|
2471
|
-
var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
|
|
2472
2411
|
|
|
2473
2412
|
//#endregion
|
|
2474
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2413
|
+
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
2475
2414
|
function u(r, n, o) {
|
|
2476
2415
|
let a = r.length - n.length;
|
|
2477
2416
|
if (a === 0) return r(...n);
|
|
2478
2417
|
if (a === 1) return u$1(r, n, o);
|
|
2479
2418
|
throw new Error("Wrong number of arguments");
|
|
2480
2419
|
}
|
|
2481
|
-
var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
|
|
2482
|
-
init_chunk_D6FCK2GA();
|
|
2483
|
-
} });
|
|
2484
2420
|
|
|
2485
2421
|
//#endregion
|
|
2486
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2422
|
+
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
|
|
2487
2423
|
function d(...r) {
|
|
2488
2424
|
return u(i, r);
|
|
2489
2425
|
}
|
|
2490
|
-
var i
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
for (let [o, e] of r.entries()) t$1(e, o, r) ? a[0].push(e) : a[1].push(e);
|
|
2496
|
-
return a;
|
|
2497
|
-
};
|
|
2498
|
-
} });
|
|
2426
|
+
var i = (r, t$1) => {
|
|
2427
|
+
let a = [[], []];
|
|
2428
|
+
for (let [o, e] of r.entries()) t$1(e, o, r) ? a[0].push(e) : a[1].push(e);
|
|
2429
|
+
return a;
|
|
2430
|
+
};
|
|
2499
2431
|
|
|
2500
2432
|
//#endregion
|
|
2501
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2433
|
+
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2502
2434
|
function t(...n) {
|
|
2503
2435
|
return u(Object.keys, n);
|
|
2504
2436
|
}
|
|
2505
|
-
var init_chunk_5NQBDF4H = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js"() {
|
|
2506
|
-
init_chunk_WIMGWYZL();
|
|
2507
|
-
} });
|
|
2508
|
-
|
|
2509
|
-
//#endregion
|
|
2510
|
-
//#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/index.js
|
|
2511
|
-
var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/index.js"() {
|
|
2512
|
-
init_chunk_3IFJP4R5();
|
|
2513
|
-
init_chunk_5NQBDF4H();
|
|
2514
|
-
} });
|
|
2515
2437
|
|
|
2516
2438
|
//#endregion
|
|
2517
2439
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
@@ -2653,10 +2575,6 @@ function bindingifyRenderChunkFilter(filterOption) {
|
|
|
2653
2575
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2654
2576
|
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2655
2577
|
}
|
|
2656
|
-
var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
|
|
2657
|
-
init_dist();
|
|
2658
|
-
init_misc();
|
|
2659
|
-
} });
|
|
2660
2578
|
|
|
2661
2579
|
//#endregion
|
|
2662
2580
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
@@ -2665,17 +2583,13 @@ function bindingifyPluginHookMeta(options) {
|
|
|
2665
2583
|
}
|
|
2666
2584
|
function bindingPluginOrder(order) {
|
|
2667
2585
|
switch (order) {
|
|
2668
|
-
case "post": return
|
|
2669
|
-
case "pre": return
|
|
2586
|
+
case "post": return BindingPluginOrder.Post;
|
|
2587
|
+
case "pre": return BindingPluginOrder.Pre;
|
|
2670
2588
|
case null:
|
|
2671
2589
|
case void 0: return void 0;
|
|
2672
2590
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
2673
2591
|
}
|
|
2674
2592
|
}
|
|
2675
|
-
var import_binding$4;
|
|
2676
|
-
var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {
|
|
2677
|
-
import_binding$4 = __toESM(require_binding());
|
|
2678
|
-
} });
|
|
2679
2593
|
|
|
2680
2594
|
//#endregion
|
|
2681
2595
|
//#region src/utils/asset-source.ts
|
|
@@ -2685,150 +2599,132 @@ function transformAssetSource(bindingAssetSource$1) {
|
|
|
2685
2599
|
function bindingAssetSource(source) {
|
|
2686
2600
|
return { inner: source };
|
|
2687
2601
|
}
|
|
2688
|
-
var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
|
|
2689
2602
|
|
|
2690
2603
|
//#endregion
|
|
2691
2604
|
//#region src/plugin/plugin-context.ts
|
|
2692
|
-
var PluginContextImpl
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
}
|
|
2713
|
-
async load(options) {
|
|
2714
|
-
const id = options.id;
|
|
2715
|
-
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
2716
|
-
const moduleInfo = this.data.getModuleInfo(id, this.context);
|
|
2717
|
-
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
2718
|
-
const rawOptions = {
|
|
2719
|
-
meta: options.meta || {},
|
|
2720
|
-
moduleSideEffects: options.moduleSideEffects || null,
|
|
2721
|
-
invalidate: false
|
|
2722
|
-
};
|
|
2723
|
-
this.data.updateModuleOption(id, rawOptions);
|
|
2724
|
-
async function createLoadModulePromise(context, data) {
|
|
2725
|
-
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
2726
|
-
if (loadPromise) return loadPromise;
|
|
2727
|
-
const promise$1 = new Promise((resolve, _) => {
|
|
2728
|
-
data.loadModulePromiseResolveFnMap.set(id, resolve);
|
|
2729
|
-
});
|
|
2730
|
-
data.loadModulePromiseMap.set(id, promise$1);
|
|
2731
|
-
try {
|
|
2732
|
-
await context.load(id, bindingifySideEffects(options.moduleSideEffects));
|
|
2733
|
-
} catch (e) {
|
|
2734
|
-
data.loadModulePromiseMap.delete(id);
|
|
2735
|
-
data.loadModulePromiseResolveFnMap.delete(id);
|
|
2736
|
-
throw e;
|
|
2737
|
-
}
|
|
2738
|
-
return promise$1;
|
|
2739
|
-
}
|
|
2740
|
-
await createLoadModulePromise(this.context, this.data);
|
|
2741
|
-
return this.data.getModuleInfo(id, this.context);
|
|
2742
|
-
}
|
|
2743
|
-
async resolve(source, importer, options) {
|
|
2744
|
-
let receipt = void 0;
|
|
2745
|
-
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
2746
|
-
const res = await this.context.resolve(source, importer, {
|
|
2747
|
-
custom: receipt,
|
|
2748
|
-
skipSelf: options?.skipSelf
|
|
2749
|
-
});
|
|
2750
|
-
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
2751
|
-
if (res == null) return null;
|
|
2752
|
-
const info = this.data.getModuleOption(res.id) || {};
|
|
2753
|
-
return {
|
|
2754
|
-
...res,
|
|
2755
|
-
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2756
|
-
...info
|
|
2757
|
-
};
|
|
2758
|
-
}
|
|
2759
|
-
emitFile = (file) => {
|
|
2760
|
-
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
2761
|
-
if (file.type === "chunk") return this.context.emitChunk({
|
|
2762
|
-
preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
|
|
2763
|
-
...file
|
|
2764
|
-
});
|
|
2765
|
-
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
2766
|
-
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
2767
|
-
return this.context.emitFile({
|
|
2768
|
-
...file,
|
|
2769
|
-
originalFileName: file.originalFileName || void 0,
|
|
2770
|
-
source: bindingAssetSource(file.source)
|
|
2771
|
-
}, filename, fnSanitizedFileName);
|
|
2605
|
+
var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
2606
|
+
getModuleInfo;
|
|
2607
|
+
constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
|
|
2608
|
+
super(onLog, logLevel, plugin.name, watchMode);
|
|
2609
|
+
this.outputOptions = outputOptions;
|
|
2610
|
+
this.context = context;
|
|
2611
|
+
this.data = data;
|
|
2612
|
+
this.onLog = onLog;
|
|
2613
|
+
this.currentLoadingModule = currentLoadingModule;
|
|
2614
|
+
this.getModuleInfo = (id) => this.data.getModuleInfo(id, context);
|
|
2615
|
+
}
|
|
2616
|
+
async load(options) {
|
|
2617
|
+
const id = options.id;
|
|
2618
|
+
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
2619
|
+
const moduleInfo = this.data.getModuleInfo(id, this.context);
|
|
2620
|
+
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
2621
|
+
const rawOptions = {
|
|
2622
|
+
meta: options.meta || {},
|
|
2623
|
+
moduleSideEffects: options.moduleSideEffects || null,
|
|
2624
|
+
invalidate: false
|
|
2772
2625
|
};
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2626
|
+
this.data.updateModuleOption(id, rawOptions);
|
|
2627
|
+
async function createLoadModulePromise(context, data) {
|
|
2628
|
+
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
2629
|
+
if (loadPromise) return loadPromise;
|
|
2630
|
+
const promise$1 = new Promise((resolve, _) => {
|
|
2631
|
+
data.loadModulePromiseResolveFnMap.set(id, resolve);
|
|
2779
2632
|
});
|
|
2633
|
+
data.loadModulePromiseMap.set(id, promise$1);
|
|
2634
|
+
try {
|
|
2635
|
+
await context.load(id, bindingifySideEffects(options.moduleSideEffects));
|
|
2636
|
+
} catch (e) {
|
|
2637
|
+
data.loadModulePromiseMap.delete(id);
|
|
2638
|
+
data.loadModulePromiseResolveFnMap.delete(id);
|
|
2639
|
+
throw e;
|
|
2640
|
+
}
|
|
2641
|
+
return promise$1;
|
|
2780
2642
|
}
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2643
|
+
await createLoadModulePromise(this.context, this.data);
|
|
2644
|
+
return this.data.getModuleInfo(id, this.context);
|
|
2645
|
+
}
|
|
2646
|
+
async resolve(source, importer, options) {
|
|
2647
|
+
let receipt = void 0;
|
|
2648
|
+
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
2649
|
+
const res = await this.context.resolve(source, importer, {
|
|
2650
|
+
custom: receipt,
|
|
2651
|
+
skipSelf: options?.skipSelf
|
|
2652
|
+
});
|
|
2653
|
+
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
2654
|
+
if (res == null) return null;
|
|
2655
|
+
const info = this.data.getModuleOption(res.id) || {};
|
|
2656
|
+
return {
|
|
2657
|
+
...res,
|
|
2658
|
+
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2659
|
+
...info
|
|
2660
|
+
};
|
|
2661
|
+
}
|
|
2662
|
+
emitFile = (file) => {
|
|
2663
|
+
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
2664
|
+
if (file.type === "chunk") return this.context.emitChunk({
|
|
2665
|
+
preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
|
|
2666
|
+
...file
|
|
2667
|
+
});
|
|
2668
|
+
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
2669
|
+
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
2670
|
+
return this.context.emitFile({
|
|
2671
|
+
...file,
|
|
2672
|
+
originalFileName: file.originalFileName || void 0,
|
|
2673
|
+
source: bindingAssetSource(file.source)
|
|
2674
|
+
}, filename, fnSanitizedFileName);
|
|
2793
2675
|
};
|
|
2794
|
-
|
|
2676
|
+
getAssetFileNames(file) {
|
|
2677
|
+
if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
|
|
2678
|
+
names: file.name ? [file.name] : [],
|
|
2679
|
+
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
|
2680
|
+
source: file.source,
|
|
2681
|
+
type: "asset"
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
getFileName(referenceId) {
|
|
2685
|
+
return this.context.getFileName(referenceId);
|
|
2686
|
+
}
|
|
2687
|
+
getModuleIds() {
|
|
2688
|
+
return this.data.getModuleIds(this.context);
|
|
2689
|
+
}
|
|
2690
|
+
addWatchFile(id) {
|
|
2691
|
+
this.context.addWatchFile(id);
|
|
2692
|
+
}
|
|
2693
|
+
parse(input, options) {
|
|
2694
|
+
return parseAst(input, options);
|
|
2695
|
+
}
|
|
2696
|
+
};
|
|
2795
2697
|
|
|
2796
2698
|
//#endregion
|
|
2797
2699
|
//#region src/plugin/transform-plugin-context.ts
|
|
2798
|
-
var TransformPluginContextImpl
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
error(e,
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
}
|
|
2827
|
-
getCombinedSourcemap() {
|
|
2828
|
-
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
2829
|
-
}
|
|
2830
|
-
};
|
|
2831
|
-
} });
|
|
2700
|
+
var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
2701
|
+
constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
|
|
2702
|
+
super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
|
|
2703
|
+
this.inner = inner;
|
|
2704
|
+
this.moduleId = moduleId;
|
|
2705
|
+
this.moduleSource = moduleSource;
|
|
2706
|
+
const getLogHandler$1 = (handler) => (log, pos) => {
|
|
2707
|
+
log = normalizeLog(log);
|
|
2708
|
+
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
2709
|
+
log.id = moduleId;
|
|
2710
|
+
log.hook = "transform";
|
|
2711
|
+
handler(log);
|
|
2712
|
+
};
|
|
2713
|
+
this.debug = getLogHandler$1(this.debug);
|
|
2714
|
+
this.warn = getLogHandler$1(this.warn);
|
|
2715
|
+
this.info = getLogHandler$1(this.info);
|
|
2716
|
+
}
|
|
2717
|
+
error(e, pos) {
|
|
2718
|
+
if (typeof e === "string") e = { message: e };
|
|
2719
|
+
if (pos) augmentCodeLocation(e, pos, this.moduleSource, this.moduleId);
|
|
2720
|
+
e.id = this.moduleId;
|
|
2721
|
+
e.hook = "transform";
|
|
2722
|
+
return error(logPluginError(normalizeLog(e), this.pluginName));
|
|
2723
|
+
}
|
|
2724
|
+
getCombinedSourcemap() {
|
|
2725
|
+
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
2726
|
+
}
|
|
2727
|
+
};
|
|
2832
2728
|
|
|
2833
2729
|
//#endregion
|
|
2834
2730
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
@@ -2993,20 +2889,6 @@ function bindingifyModuleParsed(args$1) {
|
|
|
2993
2889
|
meta: bindingifyPluginHookMeta(meta)
|
|
2994
2890
|
};
|
|
2995
2891
|
}
|
|
2996
|
-
var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
|
|
2997
|
-
init_normalize_hook();
|
|
2998
|
-
init_plugin_context$1();
|
|
2999
|
-
init_normalized_input_options();
|
|
3000
|
-
init_sourcemap();
|
|
3001
|
-
init_error();
|
|
3002
|
-
init_transform_module_info();
|
|
3003
|
-
init_transform_side_effects();
|
|
3004
|
-
init_transform_sourcemap();
|
|
3005
|
-
init_bindingify_hook_filter();
|
|
3006
|
-
init_bindingify_plugin_hook_meta();
|
|
3007
|
-
init_plugin_context();
|
|
3008
|
-
init_transform_plugin_context();
|
|
3009
|
-
} });
|
|
3010
2892
|
|
|
3011
2893
|
//#endregion
|
|
3012
2894
|
//#region src/utils/transform-rendered-module.ts
|
|
@@ -3023,7 +2905,6 @@ function transformToRenderedModule(bindingRenderedModule) {
|
|
|
3023
2905
|
}
|
|
3024
2906
|
};
|
|
3025
2907
|
}
|
|
3026
|
-
var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
|
|
3027
2908
|
|
|
3028
2909
|
//#endregion
|
|
3029
2910
|
//#region src/utils/transform-rendered-chunk.ts
|
|
@@ -3073,9 +2954,6 @@ function transformChunkModules(modules) {
|
|
|
3073
2954
|
}
|
|
3074
2955
|
return result;
|
|
3075
2956
|
}
|
|
3076
|
-
var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
|
|
3077
|
-
init_transform_rendered_module();
|
|
3078
|
-
} });
|
|
3079
2957
|
|
|
3080
2958
|
//#endregion
|
|
3081
2959
|
//#region src/utils/bindingify-output-options.ts
|
|
@@ -3160,125 +3038,116 @@ function bindingifyAssetFilenames(assetFileNames) {
|
|
|
3160
3038
|
};
|
|
3161
3039
|
return assetFileNames;
|
|
3162
3040
|
}
|
|
3163
|
-
var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
|
|
3164
|
-
init_asset_source();
|
|
3165
|
-
init_misc();
|
|
3166
|
-
init_transform_rendered_chunk();
|
|
3167
|
-
} });
|
|
3168
3041
|
|
|
3169
3042
|
//#endregion
|
|
3170
3043
|
//#region src/options/normalized-output-options.ts
|
|
3044
|
+
var NormalizedOutputOptionsImpl = class {
|
|
3045
|
+
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3046
|
+
this.inner = inner;
|
|
3047
|
+
this.outputOptions = outputOptions;
|
|
3048
|
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3049
|
+
}
|
|
3050
|
+
get dir() {
|
|
3051
|
+
return this.inner.dir ?? void 0;
|
|
3052
|
+
}
|
|
3053
|
+
get entryFileNames() {
|
|
3054
|
+
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3055
|
+
}
|
|
3056
|
+
get chunkFileNames() {
|
|
3057
|
+
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3058
|
+
}
|
|
3059
|
+
get assetFileNames() {
|
|
3060
|
+
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3061
|
+
}
|
|
3062
|
+
get format() {
|
|
3063
|
+
return this.inner.format;
|
|
3064
|
+
}
|
|
3065
|
+
get exports() {
|
|
3066
|
+
return this.inner.exports;
|
|
3067
|
+
}
|
|
3068
|
+
get sourcemap() {
|
|
3069
|
+
return this.inner.sourcemap;
|
|
3070
|
+
}
|
|
3071
|
+
get cssEntryFileNames() {
|
|
3072
|
+
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3073
|
+
}
|
|
3074
|
+
get cssChunkFileNames() {
|
|
3075
|
+
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3076
|
+
}
|
|
3077
|
+
get shimMissingExports() {
|
|
3078
|
+
return this.inner.shimMissingExports;
|
|
3079
|
+
}
|
|
3080
|
+
get name() {
|
|
3081
|
+
return this.inner.name ?? void 0;
|
|
3082
|
+
}
|
|
3083
|
+
get file() {
|
|
3084
|
+
return this.inner.file ?? void 0;
|
|
3085
|
+
}
|
|
3086
|
+
get inlineDynamicImports() {
|
|
3087
|
+
return this.inner.inlineDynamicImports;
|
|
3088
|
+
}
|
|
3089
|
+
get externalLiveBindings() {
|
|
3090
|
+
return this.inner.externalLiveBindings;
|
|
3091
|
+
}
|
|
3092
|
+
get banner() {
|
|
3093
|
+
return normalizeAddon(this.outputOptions.banner);
|
|
3094
|
+
}
|
|
3095
|
+
get footer() {
|
|
3096
|
+
return normalizeAddon(this.outputOptions.footer);
|
|
3097
|
+
}
|
|
3098
|
+
get intro() {
|
|
3099
|
+
return normalizeAddon(this.outputOptions.intro);
|
|
3100
|
+
}
|
|
3101
|
+
get outro() {
|
|
3102
|
+
return normalizeAddon(this.outputOptions.outro);
|
|
3103
|
+
}
|
|
3104
|
+
get esModule() {
|
|
3105
|
+
return this.inner.esModule;
|
|
3106
|
+
}
|
|
3107
|
+
get extend() {
|
|
3108
|
+
return this.inner.extend;
|
|
3109
|
+
}
|
|
3110
|
+
get globals() {
|
|
3111
|
+
return this.inner.globals || this.outputOptions.globals;
|
|
3112
|
+
}
|
|
3113
|
+
get hashCharacters() {
|
|
3114
|
+
return this.inner.hashCharacters;
|
|
3115
|
+
}
|
|
3116
|
+
get sourcemapDebugIds() {
|
|
3117
|
+
return this.inner.sourcemapDebugIds;
|
|
3118
|
+
}
|
|
3119
|
+
get sourcemapIgnoreList() {
|
|
3120
|
+
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
3121
|
+
}
|
|
3122
|
+
get sourcemapPathTransform() {
|
|
3123
|
+
return this.outputOptions.sourcemapPathTransform;
|
|
3124
|
+
}
|
|
3125
|
+
get minify() {
|
|
3126
|
+
return this.inner.minify;
|
|
3127
|
+
}
|
|
3128
|
+
get legalComments() {
|
|
3129
|
+
return this.inner.legalComments;
|
|
3130
|
+
}
|
|
3131
|
+
get polyfillRequire() {
|
|
3132
|
+
return this.inner.polyfillRequire;
|
|
3133
|
+
}
|
|
3134
|
+
get plugins() {
|
|
3135
|
+
return this.normalizedOutputPlugins;
|
|
3136
|
+
}
|
|
3137
|
+
get preserveModules() {
|
|
3138
|
+
return this.inner.preserveModules;
|
|
3139
|
+
}
|
|
3140
|
+
get preserveModulesRoot() {
|
|
3141
|
+
return this.inner.preserveModulesRoot;
|
|
3142
|
+
}
|
|
3143
|
+
get virtualDirname() {
|
|
3144
|
+
return this.inner.virtualDirname;
|
|
3145
|
+
}
|
|
3146
|
+
};
|
|
3171
3147
|
function normalizeAddon(value) {
|
|
3172
3148
|
if (typeof value === "function") return value;
|
|
3173
3149
|
return () => value || "";
|
|
3174
3150
|
}
|
|
3175
|
-
var NormalizedOutputOptionsImpl;
|
|
3176
|
-
var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
|
|
3177
|
-
init_bindingify_output_options();
|
|
3178
|
-
NormalizedOutputOptionsImpl = class {
|
|
3179
|
-
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3180
|
-
this.inner = inner;
|
|
3181
|
-
this.outputOptions = outputOptions;
|
|
3182
|
-
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3183
|
-
}
|
|
3184
|
-
get dir() {
|
|
3185
|
-
return this.inner.dir ?? void 0;
|
|
3186
|
-
}
|
|
3187
|
-
get entryFileNames() {
|
|
3188
|
-
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3189
|
-
}
|
|
3190
|
-
get chunkFileNames() {
|
|
3191
|
-
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3192
|
-
}
|
|
3193
|
-
get assetFileNames() {
|
|
3194
|
-
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3195
|
-
}
|
|
3196
|
-
get format() {
|
|
3197
|
-
return this.inner.format;
|
|
3198
|
-
}
|
|
3199
|
-
get exports() {
|
|
3200
|
-
return this.inner.exports;
|
|
3201
|
-
}
|
|
3202
|
-
get sourcemap() {
|
|
3203
|
-
return this.inner.sourcemap;
|
|
3204
|
-
}
|
|
3205
|
-
get cssEntryFileNames() {
|
|
3206
|
-
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3207
|
-
}
|
|
3208
|
-
get cssChunkFileNames() {
|
|
3209
|
-
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3210
|
-
}
|
|
3211
|
-
get shimMissingExports() {
|
|
3212
|
-
return this.inner.shimMissingExports;
|
|
3213
|
-
}
|
|
3214
|
-
get name() {
|
|
3215
|
-
return this.inner.name ?? void 0;
|
|
3216
|
-
}
|
|
3217
|
-
get file() {
|
|
3218
|
-
return this.inner.file ?? void 0;
|
|
3219
|
-
}
|
|
3220
|
-
get inlineDynamicImports() {
|
|
3221
|
-
return this.inner.inlineDynamicImports;
|
|
3222
|
-
}
|
|
3223
|
-
get externalLiveBindings() {
|
|
3224
|
-
return this.inner.externalLiveBindings;
|
|
3225
|
-
}
|
|
3226
|
-
get banner() {
|
|
3227
|
-
return normalizeAddon(this.outputOptions.banner);
|
|
3228
|
-
}
|
|
3229
|
-
get footer() {
|
|
3230
|
-
return normalizeAddon(this.outputOptions.footer);
|
|
3231
|
-
}
|
|
3232
|
-
get intro() {
|
|
3233
|
-
return normalizeAddon(this.outputOptions.intro);
|
|
3234
|
-
}
|
|
3235
|
-
get outro() {
|
|
3236
|
-
return normalizeAddon(this.outputOptions.outro);
|
|
3237
|
-
}
|
|
3238
|
-
get esModule() {
|
|
3239
|
-
return this.inner.esModule;
|
|
3240
|
-
}
|
|
3241
|
-
get extend() {
|
|
3242
|
-
return this.inner.extend;
|
|
3243
|
-
}
|
|
3244
|
-
get globals() {
|
|
3245
|
-
return this.inner.globals || this.outputOptions.globals;
|
|
3246
|
-
}
|
|
3247
|
-
get hashCharacters() {
|
|
3248
|
-
return this.inner.hashCharacters;
|
|
3249
|
-
}
|
|
3250
|
-
get sourcemapDebugIds() {
|
|
3251
|
-
return this.inner.sourcemapDebugIds;
|
|
3252
|
-
}
|
|
3253
|
-
get sourcemapIgnoreList() {
|
|
3254
|
-
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
3255
|
-
}
|
|
3256
|
-
get sourcemapPathTransform() {
|
|
3257
|
-
return this.outputOptions.sourcemapPathTransform;
|
|
3258
|
-
}
|
|
3259
|
-
get minify() {
|
|
3260
|
-
return this.inner.minify;
|
|
3261
|
-
}
|
|
3262
|
-
get legalComments() {
|
|
3263
|
-
return this.inner.legalComments;
|
|
3264
|
-
}
|
|
3265
|
-
get polyfillRequire() {
|
|
3266
|
-
return this.inner.polyfillRequire;
|
|
3267
|
-
}
|
|
3268
|
-
get plugins() {
|
|
3269
|
-
return this.normalizedOutputPlugins;
|
|
3270
|
-
}
|
|
3271
|
-
get preserveModules() {
|
|
3272
|
-
return this.outputOptions.preserveModules || false;
|
|
3273
|
-
}
|
|
3274
|
-
get preserveModulesRoot() {
|
|
3275
|
-
return this.outputOptions.preserveModulesRoot;
|
|
3276
|
-
}
|
|
3277
|
-
get virtualDirname() {
|
|
3278
|
-
return this.outputOptions.virtualDirname || "_virtual";
|
|
3279
|
-
}
|
|
3280
|
-
};
|
|
3281
|
-
} });
|
|
3282
3151
|
|
|
3283
3152
|
//#endregion
|
|
3284
3153
|
//#region src/utils/transform-to-rollup-output.ts
|
|
@@ -3436,12 +3305,6 @@ function collectChangedBundle(changed, bundle) {
|
|
|
3436
3305
|
deleted: Array.from(changed.deleted)
|
|
3437
3306
|
};
|
|
3438
3307
|
}
|
|
3439
|
-
var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
|
|
3440
|
-
init_sourcemap();
|
|
3441
|
-
init_asset_source();
|
|
3442
|
-
init_error();
|
|
3443
|
-
init_transform_rendered_chunk();
|
|
3444
|
-
} });
|
|
3445
3308
|
|
|
3446
3309
|
//#endregion
|
|
3447
3310
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
@@ -3593,18 +3456,6 @@ function bindingifyOutro(args$1) {
|
|
|
3593
3456
|
meta: bindingifyPluginHookMeta(meta)
|
|
3594
3457
|
};
|
|
3595
3458
|
}
|
|
3596
|
-
var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
|
|
3597
|
-
init_normalized_input_options();
|
|
3598
|
-
init_normalized_output_options();
|
|
3599
|
-
init_sourcemap();
|
|
3600
|
-
init_error();
|
|
3601
|
-
init_normalize_hook();
|
|
3602
|
-
init_transform_rendered_chunk();
|
|
3603
|
-
init_transform_to_rollup_output();
|
|
3604
|
-
init_bindingify_hook_filter();
|
|
3605
|
-
init_bindingify_plugin_hook_meta();
|
|
3606
|
-
init_plugin_context();
|
|
3607
|
-
} });
|
|
3608
3459
|
|
|
3609
3460
|
//#endregion
|
|
3610
3461
|
//#region src/plugin/bindingify-watch-hooks.ts
|
|
@@ -3630,14 +3481,43 @@ function bindingifyCloseWatcher(args$1) {
|
|
|
3630
3481
|
meta: bindingifyPluginHookMeta(meta)
|
|
3631
3482
|
};
|
|
3632
3483
|
}
|
|
3633
|
-
var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
|
|
3634
|
-
init_normalize_hook();
|
|
3635
|
-
init_bindingify_plugin_hook_meta();
|
|
3636
|
-
init_plugin_context();
|
|
3637
|
-
} });
|
|
3638
3484
|
|
|
3639
3485
|
//#endregion
|
|
3640
3486
|
//#region src/plugin/generated/hook-usage.ts
|
|
3487
|
+
let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
3488
|
+
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
3489
|
+
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
3490
|
+
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
3491
|
+
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
3492
|
+
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
3493
|
+
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
3494
|
+
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
3495
|
+
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
3496
|
+
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
3497
|
+
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
3498
|
+
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
3499
|
+
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
3500
|
+
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
3501
|
+
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
3502
|
+
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
3503
|
+
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
3504
|
+
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
3505
|
+
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
3506
|
+
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
3507
|
+
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
3508
|
+
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
3509
|
+
return HookUsageKind$1;
|
|
3510
|
+
}({});
|
|
3511
|
+
var HookUsage = class {
|
|
3512
|
+
bitflag = BigInt(0);
|
|
3513
|
+
constructor() {}
|
|
3514
|
+
union(kind) {
|
|
3515
|
+
this.bitflag |= BigInt(kind);
|
|
3516
|
+
}
|
|
3517
|
+
inner() {
|
|
3518
|
+
return Number(this.bitflag);
|
|
3519
|
+
}
|
|
3520
|
+
};
|
|
3641
3521
|
function extractHookUsage(plugin) {
|
|
3642
3522
|
let hookUsage = new HookUsage();
|
|
3643
3523
|
if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
|
|
@@ -3662,43 +3542,6 @@ function extractHookUsage(plugin) {
|
|
|
3662
3542
|
if (plugin.outro) hookUsage.union(HookUsageKind.outro);
|
|
3663
3543
|
return hookUsage;
|
|
3664
3544
|
}
|
|
3665
|
-
var HookUsageKind, HookUsage;
|
|
3666
|
-
var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
|
|
3667
|
-
HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
3668
|
-
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
3669
|
-
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
3670
|
-
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
3671
|
-
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
3672
|
-
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
3673
|
-
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
3674
|
-
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
3675
|
-
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
3676
|
-
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
3677
|
-
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
3678
|
-
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
3679
|
-
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
3680
|
-
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
3681
|
-
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
3682
|
-
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
3683
|
-
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
3684
|
-
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
3685
|
-
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
3686
|
-
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
3687
|
-
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
3688
|
-
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
3689
|
-
return HookUsageKind$1;
|
|
3690
|
-
}({});
|
|
3691
|
-
HookUsage = class {
|
|
3692
|
-
bitflag = BigInt(0);
|
|
3693
|
-
constructor() {}
|
|
3694
|
-
union(kind) {
|
|
3695
|
-
this.bitflag |= BigInt(kind);
|
|
3696
|
-
}
|
|
3697
|
-
inner() {
|
|
3698
|
-
return Number(this.bitflag);
|
|
3699
|
-
}
|
|
3700
|
-
};
|
|
3701
|
-
} });
|
|
3702
3545
|
|
|
3703
3546
|
//#endregion
|
|
3704
3547
|
//#region src/plugin/bindingify-plugin.ts
|
|
@@ -3821,106 +3664,95 @@ function wrapHandlers(plugin) {
|
|
|
3821
3664
|
}
|
|
3822
3665
|
return plugin;
|
|
3823
3666
|
}
|
|
3824
|
-
var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
|
|
3825
|
-
init_bindingify_build_hooks();
|
|
3826
|
-
init_bindingify_output_hooks();
|
|
3827
|
-
init_logs();
|
|
3828
|
-
init_bindingify_watch_hooks();
|
|
3829
|
-
init_hook_usage();
|
|
3830
|
-
} });
|
|
3831
3667
|
|
|
3832
3668
|
//#endregion
|
|
3833
3669
|
//#region src/plugin/plugin-context-data.ts
|
|
3834
|
-
var PluginContextData
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
if (
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
3849
|
-
} else {
|
|
3850
|
-
this.moduleOptionMap.set(id, option);
|
|
3851
|
-
return option;
|
|
3852
|
-
}
|
|
3853
|
-
return existing;
|
|
3854
|
-
}
|
|
3855
|
-
getModuleOption(id) {
|
|
3856
|
-
const option = this.moduleOptionMap.get(id);
|
|
3857
|
-
if (!option) {
|
|
3858
|
-
const raw = {
|
|
3859
|
-
moduleSideEffects: null,
|
|
3860
|
-
meta: {}
|
|
3861
|
-
};
|
|
3862
|
-
this.moduleOptionMap.set(id, raw);
|
|
3863
|
-
return raw;
|
|
3864
|
-
}
|
|
3670
|
+
var PluginContextData = class {
|
|
3671
|
+
moduleOptionMap = /* @__PURE__ */ new Map();
|
|
3672
|
+
resolveOptionsMap = /* @__PURE__ */ new Map();
|
|
3673
|
+
loadModulePromiseMap = /* @__PURE__ */ new Map();
|
|
3674
|
+
loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
|
|
3675
|
+
renderedChunkMeta = null;
|
|
3676
|
+
updateModuleOption(id, option) {
|
|
3677
|
+
const existing = this.moduleOptionMap.get(id);
|
|
3678
|
+
if (existing) {
|
|
3679
|
+
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
3680
|
+
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
3681
|
+
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
3682
|
+
} else {
|
|
3683
|
+
this.moduleOptionMap.set(id, option);
|
|
3865
3684
|
return option;
|
|
3866
3685
|
}
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
get() {
|
|
3879
|
-
return moduleSideEffects;
|
|
3880
|
-
},
|
|
3881
|
-
set: (v) => {
|
|
3882
|
-
this.updateModuleOption(id, {
|
|
3883
|
-
moduleSideEffects: v,
|
|
3884
|
-
meta: info.meta,
|
|
3885
|
-
invalidate: true
|
|
3886
|
-
});
|
|
3887
|
-
moduleSideEffects = v;
|
|
3888
|
-
}
|
|
3889
|
-
});
|
|
3890
|
-
return info;
|
|
3891
|
-
}
|
|
3892
|
-
getModuleIds(context) {
|
|
3893
|
-
const moduleIds = context.getModuleIds();
|
|
3894
|
-
return moduleIds.values();
|
|
3895
|
-
}
|
|
3896
|
-
saveResolveOptions(options) {
|
|
3897
|
-
const index = this.resolveOptionsMap.size;
|
|
3898
|
-
this.resolveOptionsMap.set(index, options);
|
|
3899
|
-
return index;
|
|
3900
|
-
}
|
|
3901
|
-
getSavedResolveOptions(receipt) {
|
|
3902
|
-
return this.resolveOptionsMap.get(receipt);
|
|
3903
|
-
}
|
|
3904
|
-
removeSavedResolveOptions(receipt) {
|
|
3905
|
-
this.resolveOptionsMap.delete(receipt);
|
|
3906
|
-
}
|
|
3907
|
-
setRenderChunkMeta(meta) {
|
|
3908
|
-
this.renderedChunkMeta = meta;
|
|
3909
|
-
}
|
|
3910
|
-
getRenderChunkMeta() {
|
|
3911
|
-
return this.renderedChunkMeta;
|
|
3912
|
-
}
|
|
3913
|
-
markModuleLoaded(id, _success) {
|
|
3914
|
-
const resolve = this.loadModulePromiseResolveFnMap.get(id);
|
|
3915
|
-
if (resolve) resolve();
|
|
3686
|
+
return existing;
|
|
3687
|
+
}
|
|
3688
|
+
getModuleOption(id) {
|
|
3689
|
+
const option = this.moduleOptionMap.get(id);
|
|
3690
|
+
if (!option) {
|
|
3691
|
+
const raw = {
|
|
3692
|
+
moduleSideEffects: null,
|
|
3693
|
+
meta: {}
|
|
3694
|
+
};
|
|
3695
|
+
this.moduleOptionMap.set(id, raw);
|
|
3696
|
+
return raw;
|
|
3916
3697
|
}
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3698
|
+
return option;
|
|
3699
|
+
}
|
|
3700
|
+
getModuleInfo(id, context) {
|
|
3701
|
+
const bindingInfo = context.getModuleInfo(id);
|
|
3702
|
+
if (bindingInfo) {
|
|
3703
|
+
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id));
|
|
3704
|
+
return this.proxyModuleInfo(id, info);
|
|
3921
3705
|
}
|
|
3922
|
-
|
|
3923
|
-
}
|
|
3706
|
+
return null;
|
|
3707
|
+
}
|
|
3708
|
+
proxyModuleInfo(id, info) {
|
|
3709
|
+
let moduleSideEffects = info.moduleSideEffects;
|
|
3710
|
+
Object.defineProperty(info, "moduleSideEffects", {
|
|
3711
|
+
get() {
|
|
3712
|
+
return moduleSideEffects;
|
|
3713
|
+
},
|
|
3714
|
+
set: (v) => {
|
|
3715
|
+
this.updateModuleOption(id, {
|
|
3716
|
+
moduleSideEffects: v,
|
|
3717
|
+
meta: info.meta,
|
|
3718
|
+
invalidate: true
|
|
3719
|
+
});
|
|
3720
|
+
moduleSideEffects = v;
|
|
3721
|
+
}
|
|
3722
|
+
});
|
|
3723
|
+
return info;
|
|
3724
|
+
}
|
|
3725
|
+
getModuleIds(context) {
|
|
3726
|
+
const moduleIds = context.getModuleIds();
|
|
3727
|
+
return moduleIds.values();
|
|
3728
|
+
}
|
|
3729
|
+
saveResolveOptions(options) {
|
|
3730
|
+
const index = this.resolveOptionsMap.size;
|
|
3731
|
+
this.resolveOptionsMap.set(index, options);
|
|
3732
|
+
return index;
|
|
3733
|
+
}
|
|
3734
|
+
getSavedResolveOptions(receipt) {
|
|
3735
|
+
return this.resolveOptionsMap.get(receipt);
|
|
3736
|
+
}
|
|
3737
|
+
removeSavedResolveOptions(receipt) {
|
|
3738
|
+
this.resolveOptionsMap.delete(receipt);
|
|
3739
|
+
}
|
|
3740
|
+
setRenderChunkMeta(meta) {
|
|
3741
|
+
this.renderedChunkMeta = meta;
|
|
3742
|
+
}
|
|
3743
|
+
getRenderChunkMeta() {
|
|
3744
|
+
return this.renderedChunkMeta;
|
|
3745
|
+
}
|
|
3746
|
+
markModuleLoaded(id, _success) {
|
|
3747
|
+
const resolve = this.loadModulePromiseResolveFnMap.get(id);
|
|
3748
|
+
if (resolve) resolve();
|
|
3749
|
+
}
|
|
3750
|
+
clear() {
|
|
3751
|
+
this.renderedChunkMeta = null;
|
|
3752
|
+
this.loadModulePromiseMap.clear();
|
|
3753
|
+
this.loadModulePromiseResolveFnMap.clear();
|
|
3754
|
+
}
|
|
3755
|
+
};
|
|
3924
3756
|
|
|
3925
3757
|
//#endregion
|
|
3926
3758
|
//#region src/utils/normalize-string-or-regex.ts
|
|
@@ -3932,7 +3764,6 @@ function normalizedStringOrRegex(pattern) {
|
|
|
3932
3764
|
function isReadonlyArray(input) {
|
|
3933
3765
|
return Array.isArray(input);
|
|
3934
3766
|
}
|
|
3935
|
-
var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
|
|
3936
3767
|
|
|
3937
3768
|
//#endregion
|
|
3938
3769
|
//#region src/utils/bindingify-input-options.ts
|
|
@@ -3965,7 +3796,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3965
3796
|
viteMode: inputOptions.experimental?.viteMode,
|
|
3966
3797
|
resolveNewUrlToAsset: inputOptions.experimental?.resolveNewUrlToAsset,
|
|
3967
3798
|
hmr: bindingifyHmr(inputOptions.experimental?.hmr),
|
|
3968
|
-
attachDebugInfo: inputOptions.experimental?.attachDebugInfo
|
|
3799
|
+
attachDebugInfo: bindingifyAttachDebugInfo(inputOptions.experimental?.attachDebugInfo)
|
|
3969
3800
|
},
|
|
3970
3801
|
profilerNames: inputOptions?.profilerNames,
|
|
3971
3802
|
jsx,
|
|
@@ -3997,6 +3828,14 @@ function bindingifyHmr(hmr) {
|
|
|
3997
3828
|
return hmr;
|
|
3998
3829
|
}
|
|
3999
3830
|
}
|
|
3831
|
+
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
3832
|
+
switch (attachDebugInfo) {
|
|
3833
|
+
case void 0: return void 0;
|
|
3834
|
+
case "full": return BindingAttachDebugInfo.Full;
|
|
3835
|
+
case "simple": return BindingAttachDebugInfo.Simple;
|
|
3836
|
+
case "none": return BindingAttachDebugInfo.None;
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
4000
3839
|
function bindingifyExternal(external) {
|
|
4001
3840
|
if (external) {
|
|
4002
3841
|
if (typeof external === "function") return (id, importer, isResolved) => {
|
|
@@ -4052,10 +3891,10 @@ function bindingifyInject(inject) {
|
|
|
4052
3891
|
}
|
|
4053
3892
|
function bindingifyLogLevel(logLevel) {
|
|
4054
3893
|
switch (logLevel) {
|
|
4055
|
-
case "silent": return
|
|
4056
|
-
case "debug": return
|
|
4057
|
-
case "warn": return
|
|
4058
|
-
case "info": return
|
|
3894
|
+
case "silent": return BindingLogLevel.Silent;
|
|
3895
|
+
case "debug": return BindingLogLevel.Debug;
|
|
3896
|
+
case "warn": return BindingLogLevel.Warn;
|
|
3897
|
+
case "info": return BindingLogLevel.Info;
|
|
4059
3898
|
default: throw new Error(`Unexpected log level: ${logLevel}`);
|
|
4060
3899
|
}
|
|
4061
3900
|
}
|
|
@@ -4072,7 +3911,7 @@ function bindingifyInput(input) {
|
|
|
4072
3911
|
}
|
|
4073
3912
|
function bindingifyJsx(input) {
|
|
4074
3913
|
if (typeof input === "object") {
|
|
4075
|
-
if (input.mode === "preserve") return { jsx:
|
|
3914
|
+
if (input.mode === "preserve") return { jsx: BindingJsx.Preserve };
|
|
4076
3915
|
const mode = input.mode ?? "automatic";
|
|
4077
3916
|
return { jsxTransform: { jsx: {
|
|
4078
3917
|
runtime: mode,
|
|
@@ -4082,10 +3921,10 @@ function bindingifyJsx(input) {
|
|
|
4082
3921
|
} } };
|
|
4083
3922
|
}
|
|
4084
3923
|
switch (input) {
|
|
4085
|
-
case false: return { jsx:
|
|
4086
|
-
case "react": return { jsx:
|
|
4087
|
-
case "react-jsx": return { jsx:
|
|
4088
|
-
case "preserve": return { jsx:
|
|
3924
|
+
case false: return { jsx: BindingJsx.Disable };
|
|
3925
|
+
case "react": return { jsx: BindingJsx.React };
|
|
3926
|
+
case "react-jsx": return { jsx: BindingJsx.ReactJsx };
|
|
3927
|
+
case "preserve": return { jsx: BindingJsx.Preserve };
|
|
4089
3928
|
default: return { jsx: void 0 };
|
|
4090
3929
|
}
|
|
4091
3930
|
}
|
|
@@ -4135,33 +3974,31 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
|
4135
3974
|
field0: preserveEntrySignatures
|
|
4136
3975
|
};
|
|
4137
3976
|
}
|
|
4138
|
-
var import_binding$3;
|
|
4139
|
-
var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
|
|
4140
|
-
import_binding$3 = __toESM(require_binding());
|
|
4141
|
-
init_constructors();
|
|
4142
|
-
init_utils();
|
|
4143
|
-
init_bindingify_plugin();
|
|
4144
|
-
init_plugin_context_data();
|
|
4145
|
-
init_misc();
|
|
4146
|
-
init_normalize_string_or_regex();
|
|
4147
|
-
init_transform_side_effects();
|
|
4148
|
-
} });
|
|
4149
3977
|
|
|
4150
3978
|
//#endregion
|
|
4151
3979
|
//#region src/utils/plugin/index.ts
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
return PLUGIN_HOOK_NAMES_SET.has(hookName);
|
|
4159
|
-
};
|
|
4160
|
-
}();
|
|
4161
|
-
} });
|
|
3980
|
+
const isPluginHookName = function() {
|
|
3981
|
+
const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
|
|
3982
|
+
return function isPluginHookName$1(hookName) {
|
|
3983
|
+
return PLUGIN_HOOK_NAMES_SET.has(hookName);
|
|
3984
|
+
};
|
|
3985
|
+
}();
|
|
4162
3986
|
|
|
4163
3987
|
//#endregion
|
|
4164
3988
|
//#region src/utils/compose-js-plugins.ts
|
|
3989
|
+
const unsupportedHookName = [
|
|
3990
|
+
"augmentChunkHash",
|
|
3991
|
+
"generateBundle",
|
|
3992
|
+
"moduleParsed",
|
|
3993
|
+
"onLog",
|
|
3994
|
+
"options",
|
|
3995
|
+
"outputOptions",
|
|
3996
|
+
"renderError",
|
|
3997
|
+
"renderStart",
|
|
3998
|
+
"resolveDynamicImport",
|
|
3999
|
+
"writeBundle"
|
|
4000
|
+
];
|
|
4001
|
+
const unsupportedHooks = new Set(unsupportedHookName);
|
|
4165
4002
|
function isUnsupportedHooks(hookName) {
|
|
4166
4003
|
return unsupportedHooks.has(hookName);
|
|
4167
4004
|
}
|
|
@@ -4454,28 +4291,6 @@ function composeJsPlugins(plugins) {
|
|
|
4454
4291
|
}
|
|
4455
4292
|
return newPlugins;
|
|
4456
4293
|
}
|
|
4457
|
-
var unsupportedHookName, unsupportedHooks;
|
|
4458
|
-
var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
|
|
4459
|
-
init_dist();
|
|
4460
|
-
init_constructors();
|
|
4461
|
-
init_plugin_context$1();
|
|
4462
|
-
init_misc();
|
|
4463
|
-
init_normalize_hook();
|
|
4464
|
-
init_plugin();
|
|
4465
|
-
unsupportedHookName = [
|
|
4466
|
-
"augmentChunkHash",
|
|
4467
|
-
"generateBundle",
|
|
4468
|
-
"moduleParsed",
|
|
4469
|
-
"onLog",
|
|
4470
|
-
"options",
|
|
4471
|
-
"outputOptions",
|
|
4472
|
-
"renderError",
|
|
4473
|
-
"renderStart",
|
|
4474
|
-
"resolveDynamicImport",
|
|
4475
|
-
"writeBundle"
|
|
4476
|
-
];
|
|
4477
|
-
unsupportedHooks = new Set(unsupportedHookName);
|
|
4478
|
-
} });
|
|
4479
4294
|
|
|
4480
4295
|
//#endregion
|
|
4481
4296
|
//#region src/utils/initialize-parallel-plugins.ts
|
|
@@ -4491,7 +4306,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4491
4306
|
}
|
|
4492
4307
|
if (pluginInfos.length <= 0) return void 0;
|
|
4493
4308
|
const count = availableParallelism();
|
|
4494
|
-
const parallelJsPluginRegistry = new
|
|
4309
|
+
const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
|
|
4495
4310
|
const registryId = parallelJsPluginRegistry.id;
|
|
4496
4311
|
const workers = await initializeWorkers(registryId, count, pluginInfos);
|
|
4497
4312
|
const stopWorkers = async () => {
|
|
@@ -4528,20 +4343,16 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
4528
4343
|
throw e;
|
|
4529
4344
|
}
|
|
4530
4345
|
}
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
}
|
|
4542
|
-
return Math.min(availableParallelism$1, 8);
|
|
4543
|
-
};
|
|
4544
|
-
} });
|
|
4346
|
+
const availableParallelism = () => {
|
|
4347
|
+
let availableParallelism$1 = 1;
|
|
4348
|
+
try {
|
|
4349
|
+
availableParallelism$1 = os.availableParallelism();
|
|
4350
|
+
} catch {
|
|
4351
|
+
const cpus = os.cpus();
|
|
4352
|
+
if (Array.isArray(cpus) && cpus.length > 0) availableParallelism$1 = cpus.length;
|
|
4353
|
+
}
|
|
4354
|
+
return Math.min(availableParallelism$1, 8);
|
|
4355
|
+
};
|
|
4545
4356
|
|
|
4546
4357
|
//#endregion
|
|
4547
4358
|
//#region src/utils/create-bundler-option.ts
|
|
@@ -4577,28 +4388,19 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4577
4388
|
throw e;
|
|
4578
4389
|
}
|
|
4579
4390
|
}
|
|
4580
|
-
var init_create_bundler_option = __esm({ "src/utils/create-bundler-option.ts"() {
|
|
4581
|
-
init_logger();
|
|
4582
|
-
init_logging();
|
|
4583
|
-
init_plugin_driver();
|
|
4584
|
-
init_bindingify_input_options();
|
|
4585
|
-
init_bindingify_output_options();
|
|
4586
|
-
init_compose_js_plugins();
|
|
4587
|
-
init_initialize_parallel_plugins();
|
|
4588
|
-
init_normalize_plugin_option();
|
|
4589
|
-
} });
|
|
4590
4391
|
|
|
4591
4392
|
//#endregion
|
|
4592
4393
|
//#region src/utils/create-bundler.ts
|
|
4593
|
-
|
|
4394
|
+
let asyncRuntimeShutdown = false;
|
|
4395
|
+
async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
|
|
4594
4396
|
const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
|
|
4595
|
-
if (asyncRuntimeShutdown)
|
|
4397
|
+
if (asyncRuntimeShutdown) startAsyncRuntime();
|
|
4596
4398
|
try {
|
|
4597
4399
|
return {
|
|
4598
|
-
|
|
4400
|
+
impl: bundler.createImpl(option.bundlerOptions),
|
|
4599
4401
|
stopWorkers: option.stopWorkers,
|
|
4600
4402
|
shutdown: () => {
|
|
4601
|
-
|
|
4403
|
+
shutdownAsyncRuntime();
|
|
4602
4404
|
asyncRuntimeShutdown = true;
|
|
4603
4405
|
}
|
|
4604
4406
|
};
|
|
@@ -4607,12 +4409,6 @@ async function createBundler(inputOptions, outputOptions, isClose) {
|
|
|
4607
4409
|
throw e;
|
|
4608
4410
|
}
|
|
4609
4411
|
}
|
|
4610
|
-
var import_binding$1, asyncRuntimeShutdown;
|
|
4611
|
-
var init_create_bundler = __esm({ "src/utils/create-bundler.ts"() {
|
|
4612
|
-
import_binding$1 = __toESM(require_binding());
|
|
4613
|
-
init_create_bundler_option();
|
|
4614
|
-
asyncRuntimeShutdown = false;
|
|
4615
|
-
} });
|
|
4616
4412
|
|
|
4617
4413
|
//#endregion
|
|
4618
4414
|
//#region src/utils/transform-hmr-patch-output.ts
|
|
@@ -4625,79 +4421,66 @@ function handleHmrPatchOutputErrors(output) {
|
|
|
4625
4421
|
const rawErrors = output.errors;
|
|
4626
4422
|
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
4627
4423
|
}
|
|
4628
|
-
var init_transform_hmr_patch_output = __esm({ "src/utils/transform-hmr-patch-output.ts"() {
|
|
4629
|
-
init_error();
|
|
4630
|
-
} });
|
|
4631
4424
|
|
|
4632
4425
|
//#endregion
|
|
4633
4426
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4634
|
-
|
|
4635
|
-
var
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
|
|
4684
|
-
}
|
|
4685
|
-
};
|
|
4686
|
-
} });
|
|
4427
|
+
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
4428
|
+
var RolldownBuild = class {
|
|
4429
|
+
#inputOptions;
|
|
4430
|
+
#bundler;
|
|
4431
|
+
#bundlerImpl;
|
|
4432
|
+
constructor(inputOptions) {
|
|
4433
|
+
this.#inputOptions = inputOptions;
|
|
4434
|
+
this.#bundler = new BindingBundler();
|
|
4435
|
+
}
|
|
4436
|
+
get closed() {
|
|
4437
|
+
return this.#bundlerImpl?.impl.closed ?? false;
|
|
4438
|
+
}
|
|
4439
|
+
async #getBundlerWithStopWorker(outputOptions, isClose) {
|
|
4440
|
+
if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
|
|
4441
|
+
return this.#bundlerImpl = await createBundlerImpl(this.#bundler, this.#inputOptions, outputOptions, isClose);
|
|
4442
|
+
}
|
|
4443
|
+
async generate(outputOptions = {}) {
|
|
4444
|
+
validateOption("output", outputOptions);
|
|
4445
|
+
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4446
|
+
const output = await impl.generate();
|
|
4447
|
+
return transformToRollupOutput(output);
|
|
4448
|
+
}
|
|
4449
|
+
async write(outputOptions = {}) {
|
|
4450
|
+
validateOption("output", outputOptions);
|
|
4451
|
+
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4452
|
+
const output = await impl.write();
|
|
4453
|
+
return transformToRollupOutput(output);
|
|
4454
|
+
}
|
|
4455
|
+
async close() {
|
|
4456
|
+
const { impl, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
|
|
4457
|
+
await stopWorkers?.();
|
|
4458
|
+
await impl.close();
|
|
4459
|
+
shutdown();
|
|
4460
|
+
}
|
|
4461
|
+
async [Symbol.asyncDispose]() {
|
|
4462
|
+
await this.close();
|
|
4463
|
+
}
|
|
4464
|
+
async generateHmrPatch(changedFiles) {
|
|
4465
|
+
const output = await this.#bundlerImpl.impl.generateHmrPatch(changedFiles);
|
|
4466
|
+
return transformHmrPatchOutput(output);
|
|
4467
|
+
}
|
|
4468
|
+
async hmrInvalidate(file, firstInvalidatedBy) {
|
|
4469
|
+
const output = await this.#bundlerImpl.impl.hmrInvalidate(file, firstInvalidatedBy);
|
|
4470
|
+
return transformHmrPatchOutput(output);
|
|
4471
|
+
}
|
|
4472
|
+
get watchFiles() {
|
|
4473
|
+
return this.#bundlerImpl?.impl.getWatchFiles() ?? Promise.resolve([]);
|
|
4474
|
+
}
|
|
4475
|
+
};
|
|
4687
4476
|
|
|
4688
4477
|
//#endregion
|
|
4689
4478
|
//#region src/api/rolldown/index.ts
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
rolldown = async (input) => {
|
|
4696
|
-
validateOption("input", input);
|
|
4697
|
-
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
4698
|
-
return new RolldownBuild(inputOptions);
|
|
4699
|
-
};
|
|
4700
|
-
} });
|
|
4479
|
+
const rolldown = async (input) => {
|
|
4480
|
+
validateOption("input", input);
|
|
4481
|
+
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
4482
|
+
return new RolldownBuild(inputOptions);
|
|
4483
|
+
};
|
|
4701
4484
|
|
|
4702
4485
|
//#endregion
|
|
4703
4486
|
//#region src/api/build.ts
|
|
@@ -4714,86 +4497,106 @@ async function build(options) {
|
|
|
4714
4497
|
}
|
|
4715
4498
|
}
|
|
4716
4499
|
}
|
|
4717
|
-
var init_build = __esm({ "src/api/build.ts"() {
|
|
4718
|
-
init_rolldown();
|
|
4719
|
-
} });
|
|
4720
4500
|
|
|
4721
4501
|
//#endregion
|
|
4722
4502
|
//#region src/api/watch/watch-emitter.ts
|
|
4723
|
-
var WatcherEmitter
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
if (listeners) {
|
|
4741
|
-
const index = listeners.indexOf(listener);
|
|
4742
|
-
if (index !== -1) listeners.splice(index, 1);
|
|
4743
|
-
}
|
|
4744
|
-
return this;
|
|
4503
|
+
var WatcherEmitter = class {
|
|
4504
|
+
listeners = /* @__PURE__ */ new Map();
|
|
4505
|
+
timer;
|
|
4506
|
+
constructor() {
|
|
4507
|
+
this.timer = setInterval(() => {}, 1e9);
|
|
4508
|
+
}
|
|
4509
|
+
on(event, listener) {
|
|
4510
|
+
const listeners = this.listeners.get(event);
|
|
4511
|
+
if (listeners) listeners.push(listener);
|
|
4512
|
+
else this.listeners.set(event, [listener]);
|
|
4513
|
+
return this;
|
|
4514
|
+
}
|
|
4515
|
+
off(event, listener) {
|
|
4516
|
+
const listeners = this.listeners.get(event);
|
|
4517
|
+
if (listeners) {
|
|
4518
|
+
const index = listeners.indexOf(listener);
|
|
4519
|
+
if (index !== -1) listeners.splice(index, 1);
|
|
4745
4520
|
}
|
|
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
|
-
break;
|
|
4780
|
-
case "change":
|
|
4781
|
-
for (const listener of listeners) {
|
|
4782
|
-
const { path: path$1, kind } = event.watchChangeData();
|
|
4783
|
-
await listener(path$1, { event: kind });
|
|
4521
|
+
return this;
|
|
4522
|
+
}
|
|
4523
|
+
async onEvent(event) {
|
|
4524
|
+
const listeners = this.listeners.get(event.eventKind());
|
|
4525
|
+
if (listeners) switch (event.eventKind()) {
|
|
4526
|
+
case "close":
|
|
4527
|
+
case "restart":
|
|
4528
|
+
for (const listener of listeners) await listener();
|
|
4529
|
+
break;
|
|
4530
|
+
case "event":
|
|
4531
|
+
for (const listener of listeners) {
|
|
4532
|
+
const code = event.bundleEventKind();
|
|
4533
|
+
switch (code) {
|
|
4534
|
+
case "BUNDLE_END":
|
|
4535
|
+
const { duration, output, result } = event.bundleEndData();
|
|
4536
|
+
await listener({
|
|
4537
|
+
code: "BUNDLE_END",
|
|
4538
|
+
duration,
|
|
4539
|
+
output: [output],
|
|
4540
|
+
result
|
|
4541
|
+
});
|
|
4542
|
+
break;
|
|
4543
|
+
case "ERROR":
|
|
4544
|
+
const data = event.bundleErrorData();
|
|
4545
|
+
await listener({
|
|
4546
|
+
code: "ERROR",
|
|
4547
|
+
error: normalizeErrors(data.error),
|
|
4548
|
+
result: data.result
|
|
4549
|
+
});
|
|
4550
|
+
break;
|
|
4551
|
+
default:
|
|
4552
|
+
await listener({ code });
|
|
4553
|
+
break;
|
|
4784
4554
|
}
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4555
|
+
}
|
|
4556
|
+
break;
|
|
4557
|
+
case "change":
|
|
4558
|
+
for (const listener of listeners) {
|
|
4559
|
+
const { path: path$1, kind } = event.watchChangeData();
|
|
4560
|
+
await listener(path$1, { event: kind });
|
|
4561
|
+
}
|
|
4562
|
+
break;
|
|
4563
|
+
default: throw new Error(`Unknown event: ${event}`);
|
|
4791
4564
|
}
|
|
4792
|
-
}
|
|
4793
|
-
|
|
4565
|
+
}
|
|
4566
|
+
async close() {
|
|
4567
|
+
clearInterval(this.timer);
|
|
4568
|
+
}
|
|
4569
|
+
};
|
|
4794
4570
|
|
|
4795
4571
|
//#endregion
|
|
4796
4572
|
//#region src/api/watch/watcher.ts
|
|
4573
|
+
var Watcher = class {
|
|
4574
|
+
closed;
|
|
4575
|
+
inner;
|
|
4576
|
+
emitter;
|
|
4577
|
+
stopWorkers;
|
|
4578
|
+
constructor(emitter, inner, stopWorkers) {
|
|
4579
|
+
this.closed = false;
|
|
4580
|
+
this.inner = inner;
|
|
4581
|
+
this.emitter = emitter;
|
|
4582
|
+
const originClose = emitter.close.bind(emitter);
|
|
4583
|
+
emitter.close = async () => {
|
|
4584
|
+
await this.close();
|
|
4585
|
+
originClose();
|
|
4586
|
+
};
|
|
4587
|
+
this.stopWorkers = stopWorkers;
|
|
4588
|
+
}
|
|
4589
|
+
async close() {
|
|
4590
|
+
if (this.closed) return;
|
|
4591
|
+
this.closed = true;
|
|
4592
|
+
for (const stop of this.stopWorkers) await stop?.();
|
|
4593
|
+
await this.inner.close();
|
|
4594
|
+
shutdownAsyncRuntime();
|
|
4595
|
+
}
|
|
4596
|
+
start() {
|
|
4597
|
+
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
4598
|
+
}
|
|
4599
|
+
};
|
|
4797
4600
|
async function createWatcher(emitter, input) {
|
|
4798
4601
|
const options = arraify(input);
|
|
4799
4602
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
@@ -4801,7 +4604,7 @@ async function createWatcher(emitter, input) {
|
|
|
4801
4604
|
return createBundlerOptions(inputOptions, output, true);
|
|
4802
4605
|
})).flat());
|
|
4803
4606
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4804
|
-
const bindingWatcher = new
|
|
4607
|
+
const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
|
|
4805
4608
|
const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
|
|
4806
4609
|
watcher.start();
|
|
4807
4610
|
}
|
|
@@ -4815,72 +4618,24 @@ function getValidNotifyOption(bundlerOptions) {
|
|
|
4815
4618
|
} else result = notifyOption;
|
|
4816
4619
|
}
|
|
4817
4620
|
}
|
|
4818
|
-
var import_binding, Watcher;
|
|
4819
|
-
var init_watcher = __esm({ "src/api/watch/watcher.ts"() {
|
|
4820
|
-
import_binding = __toESM(require_binding());
|
|
4821
|
-
init_logging();
|
|
4822
|
-
init_logs();
|
|
4823
|
-
init_plugin_driver();
|
|
4824
|
-
init_create_bundler_option();
|
|
4825
|
-
init_misc();
|
|
4826
|
-
Watcher = class {
|
|
4827
|
-
closed;
|
|
4828
|
-
inner;
|
|
4829
|
-
emitter;
|
|
4830
|
-
stopWorkers;
|
|
4831
|
-
constructor(emitter, inner, stopWorkers) {
|
|
4832
|
-
this.closed = false;
|
|
4833
|
-
this.inner = inner;
|
|
4834
|
-
this.emitter = emitter;
|
|
4835
|
-
const originClose = emitter.close.bind(emitter);
|
|
4836
|
-
emitter.close = async () => {
|
|
4837
|
-
await this.close();
|
|
4838
|
-
originClose();
|
|
4839
|
-
};
|
|
4840
|
-
this.stopWorkers = stopWorkers;
|
|
4841
|
-
}
|
|
4842
|
-
async close() {
|
|
4843
|
-
if (this.closed) return;
|
|
4844
|
-
this.closed = true;
|
|
4845
|
-
for (const stop of this.stopWorkers) await stop?.();
|
|
4846
|
-
await this.inner.close();
|
|
4847
|
-
(0, import_binding.shutdownAsyncRuntime)();
|
|
4848
|
-
}
|
|
4849
|
-
start() {
|
|
4850
|
-
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
4851
|
-
}
|
|
4852
|
-
};
|
|
4853
|
-
} });
|
|
4854
4621
|
|
|
4855
4622
|
//#endregion
|
|
4856
4623
|
//#region src/api/watch/index.ts
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
const emitter = new WatcherEmitter();
|
|
4863
|
-
createWatcher(emitter, input);
|
|
4864
|
-
return emitter;
|
|
4865
|
-
};
|
|
4866
|
-
} });
|
|
4624
|
+
const watch = (input) => {
|
|
4625
|
+
const emitter = new WatcherEmitter();
|
|
4626
|
+
createWatcher(emitter, input);
|
|
4627
|
+
return emitter;
|
|
4628
|
+
};
|
|
4867
4629
|
|
|
4868
4630
|
//#endregion
|
|
4869
4631
|
//#region src/utils/define-config.ts
|
|
4870
4632
|
function defineConfig(config) {
|
|
4871
4633
|
return config;
|
|
4872
4634
|
}
|
|
4873
|
-
var init_define_config = __esm({ "src/utils/define-config.ts"() {} });
|
|
4874
4635
|
|
|
4875
4636
|
//#endregion
|
|
4876
4637
|
//#region src/index.ts
|
|
4877
|
-
|
|
4878
|
-
var init_src = __esm({ "src/index.ts"() {
|
|
4879
|
-
init_build();
|
|
4880
|
-
init_rolldown();
|
|
4881
|
-
init_watch();
|
|
4882
|
-
VERSION = version;
|
|
4883
|
-
} });
|
|
4638
|
+
const VERSION = version;
|
|
4884
4639
|
|
|
4885
4640
|
//#endregion
|
|
4886
|
-
export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins,
|
|
4641
|
+
export { BuiltinPlugin, PluginContextData, PluginDriver, VERSION, 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 };
|