rolldown 1.0.0-beta.16 → 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 +4 -4
- package/dist/cli.mjs +1040 -1079
- 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 -6
- 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/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--Y47JZSL.d.cts → binding-CWvDTpOw.d.mts} +14 -14
- package/dist/shared/{binding-C_9au5Eg.d.mts → binding-um3VI33z.d.cts} +14 -14
- package/dist/shared/{define-config-DMWHsgSt.d.mts → define-config-Cm86JHb7.d.mts} +69 -9
- package/dist/shared/{define-config-CAyC9-af.d.cts → define-config-POPyhxOq.d.cts} +69 -9
- package/dist/shared/{load-config-BniS-jT_.cjs → load-config-B4zzmrcW.cjs} +1 -1
- package/dist/shared/{load-config-BT5Ts430.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/{src-1lPDqeuR.cjs → src-C98Q0NLX.cjs} +43 -48
- package/dist/shared/{src-Cv4_zurW.mjs → src-CuIbdNSi.mjs} +1135 -1394
- package/package.json +18 -18
- package/dist/shared/chunk--iN_1bjD.mjs +0 -33
- package/dist/shared/parse-ast-index-BHkdbivO.mjs +0 -659
- package/dist/shared/parse-ast-index-hgMnddyI.cjs +0 -701
- package/dist/shared/prompt-CodO769G.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,409 +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(union([
|
|
2120
|
-
literal("none"),
|
|
2121
|
-
literal("simple"),
|
|
2122
|
-
literal("full")
|
|
2123
|
-
]))
|
|
2124
|
-
})),
|
|
2125
|
-
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2126
|
-
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2127
|
-
profilerNames: optional(boolean()),
|
|
2128
|
-
jsx: optional(union([
|
|
2129
|
-
literal(false),
|
|
2130
|
-
literal("react"),
|
|
2131
|
-
literal("react-jsx"),
|
|
2132
|
-
literal("preserve"),
|
|
2133
|
-
RollupJsxOptionsSchema
|
|
2134
|
-
])),
|
|
2135
|
-
transform: optional(TransformOptionsSchema),
|
|
2136
|
-
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2137
|
-
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
2138
|
-
checks: optional(ChecksOptionsSchema),
|
|
2139
|
-
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
2140
|
-
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.")),
|
|
2141
|
-
preserveEntrySignatures: pipe(optional(union([
|
|
2142
|
-
literal("strict"),
|
|
2143
|
-
literal("allow-extension"),
|
|
2144
|
-
literal("exports-only"),
|
|
2145
|
-
literal(false)
|
|
2146
|
-
])))
|
|
2147
|
-
});
|
|
2148
|
-
InputCliOverrideSchema = strictObject({
|
|
2149
|
-
input: pipe(optional(array(string())), description("Entry file")),
|
|
2150
|
-
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2151
|
-
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2152
|
-
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2153
|
-
makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
|
|
2154
|
-
jsx: pipe(optional(union([
|
|
2155
|
-
literal(false),
|
|
2156
|
-
literal("react"),
|
|
2157
|
-
literal("react-jsx"),
|
|
2158
|
-
literal("preserve")
|
|
2159
|
-
])), description("Jsx options preset")),
|
|
2160
|
-
preserveEntrySignatures: pipe(optional(union([literal(false)])), description("Avoid facade chunks for entry points"))
|
|
2161
|
-
});
|
|
2162
|
-
InputCliOptionsSchema = omit(strictObject({
|
|
2163
|
-
...InputOptionsSchema.entries,
|
|
2164
|
-
...InputCliOverrideSchema.entries
|
|
2165
|
-
}), [
|
|
2166
|
-
"plugins",
|
|
2167
|
-
"onwarn",
|
|
2168
|
-
"onLog",
|
|
2169
|
-
"resolve",
|
|
2170
|
-
"experimental",
|
|
2171
|
-
"profilerNames",
|
|
2172
|
-
"watch"
|
|
2173
|
-
]);
|
|
2174
|
-
ModuleFormatSchema = union([
|
|
2175
|
-
literal("es"),
|
|
2176
|
-
literal("cjs"),
|
|
2177
|
-
literal("esm"),
|
|
2178
|
-
literal("module"),
|
|
2179
|
-
literal("commonjs"),
|
|
2180
|
-
literal("iife"),
|
|
2181
|
-
literal("umd")
|
|
2182
|
-
]);
|
|
2183
|
-
AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
2184
|
-
ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2185
|
-
AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2186
|
-
SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2187
|
-
GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2188
|
-
AdvancedChunksSchema = strictObject({
|
|
2189
|
-
minSize: optional(number()),
|
|
2190
|
-
maxSize: optional(number()),
|
|
2191
|
-
minModuleSize: optional(number()),
|
|
2192
|
-
maxModuleSize: optional(number()),
|
|
2193
|
-
minShareCount: optional(number()),
|
|
2194
|
-
groups: optional(array(strictObject({
|
|
2195
|
-
name: string(),
|
|
2196
|
-
test: optional(union([
|
|
2197
|
-
string(),
|
|
2198
|
-
instance(RegExp),
|
|
2199
|
-
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
2200
|
-
])),
|
|
2201
|
-
priority: optional(number()),
|
|
2202
|
-
minSize: optional(number()),
|
|
2203
|
-
minShareCount: optional(number()),
|
|
2204
|
-
maxSize: optional(number()),
|
|
2205
|
-
minModuleSize: optional(number()),
|
|
2206
|
-
maxModuleSize: optional(number())
|
|
2207
|
-
})))
|
|
2208
|
-
});
|
|
2209
|
-
OutputOptionsSchema = strictObject({
|
|
2210
|
-
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2211
|
-
file: pipe(optional(string()), description("Single output file")),
|
|
2212
|
-
exports: pipe(optional(union([
|
|
2213
|
-
literal("auto"),
|
|
2214
|
-
literal("named"),
|
|
2215
|
-
literal("default"),
|
|
2216
|
-
literal("none")
|
|
2217
|
-
])), description(`Specify a export mode (${colors.underline("auto")}, named, default, none)`)),
|
|
2218
|
-
hashCharacters: pipe(optional(union([
|
|
2219
|
-
literal("base64"),
|
|
2220
|
-
literal("base36"),
|
|
2221
|
-
literal("hex")
|
|
2222
|
-
])), description("Use the specified character set for file hashes")),
|
|
2223
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`)),
|
|
2224
|
-
sourcemap: pipe(optional(union([
|
|
2225
|
-
boolean(),
|
|
2226
|
-
literal("inline"),
|
|
2227
|
-
literal("hidden")
|
|
2228
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2229
|
-
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2230
|
-
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
2231
|
-
sourcemapPathTransform: optional(custom(() => true)),
|
|
2232
|
-
banner: optional(union([string(), AddonFunctionSchema])),
|
|
2233
|
-
footer: optional(union([string(), AddonFunctionSchema])),
|
|
2234
|
-
intro: optional(union([string(), AddonFunctionSchema])),
|
|
2235
|
-
outro: optional(union([string(), AddonFunctionSchema])),
|
|
2236
|
-
extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2237
|
-
esModule: optional(union([boolean(), literal("if-default-prop")])),
|
|
2238
|
-
assetFileNames: optional(AssetFileNamesSchema),
|
|
2239
|
-
entryFileNames: optional(ChunkFileNamesSchema),
|
|
2240
|
-
chunkFileNames: optional(ChunkFileNamesSchema),
|
|
2241
|
-
cssEntryFileNames: optional(ChunkFileNamesSchema),
|
|
2242
|
-
cssChunkFileNames: optional(ChunkFileNamesSchema),
|
|
2243
|
-
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2244
|
-
minify: pipe(optional(union([
|
|
2245
|
-
boolean(),
|
|
2246
|
-
string("dce-only"),
|
|
2247
|
-
MinifyOptionsSchema
|
|
2248
|
-
])), description("Minify the bundled file")),
|
|
2249
|
-
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2250
|
-
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2251
|
-
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2252
|
-
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2253
|
-
manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
|
|
2254
|
-
advancedChunks: optional(AdvancedChunksSchema),
|
|
2255
|
-
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2256
|
-
plugins: optional(custom(() => true)),
|
|
2257
|
-
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2258
|
-
hoistTransitiveImports: optional(custom((input) => {
|
|
2259
|
-
if (input) return false;
|
|
2260
|
-
return true;
|
|
2261
|
-
}, () => `The 'true' value is not supported`)),
|
|
2262
|
-
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2263
|
-
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2264
|
-
virtualDirname: optional(string())
|
|
2265
|
-
});
|
|
2266
|
-
getAddonDescription = (placement, wrapper) => {
|
|
2267
|
-
return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
|
|
2268
|
-
};
|
|
2269
|
-
OutputCliOverrideSchema = strictObject({
|
|
2270
|
-
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
2271
|
-
entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
|
|
2272
|
-
chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
|
|
2273
|
-
cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
|
|
2274
|
-
cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
|
|
2275
|
-
sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
|
|
2276
|
-
banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
|
|
2277
|
-
footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
|
|
2278
|
-
intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
|
|
2279
|
-
outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
|
|
2280
|
-
esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2281
|
-
globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2282
|
-
advancedChunks: pipe(optional(strictObject({
|
|
2283
|
-
minSize: pipe(optional(number()), description("Minimum size of the chunk")),
|
|
2284
|
-
minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
|
|
2285
|
-
})), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2286
|
-
minify: pipe(optional(boolean()), description("Minify the bundled file"))
|
|
2287
|
-
});
|
|
2288
|
-
OutputCliOptionsSchema = omit(strictObject({
|
|
2289
|
-
...OutputOptionsSchema.entries,
|
|
2290
|
-
...OutputCliOverrideSchema.entries
|
|
2291
|
-
}), [
|
|
2292
|
-
"sourcemapIgnoreList",
|
|
2293
|
-
"sourcemapPathTransform",
|
|
2294
|
-
"plugins",
|
|
2295
|
-
"hoistTransitiveImports"
|
|
2296
|
-
]);
|
|
2297
|
-
CliOptionsSchema = strictObject({
|
|
2298
|
-
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2299
|
-
help: pipe(optional(boolean()), description("Show help")),
|
|
2300
|
-
version: pipe(optional(boolean()), description("Show version number")),
|
|
2301
|
-
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2302
|
-
...InputCliOptionsSchema.entries,
|
|
2303
|
-
...OutputCliOptionsSchema.entries
|
|
2304
|
-
});
|
|
2305
|
-
inputHelperMsgRecord = { output: { ignored: true } };
|
|
2306
|
-
outputHelperMsgRecord = {};
|
|
2307
|
-
} });
|
|
2308
2254
|
|
|
2309
2255
|
//#endregion
|
|
2310
2256
|
//#region src/constants/plugin-context.ts
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
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");
|
|
2315
2264
|
|
|
2316
2265
|
//#endregion
|
|
2317
2266
|
//#region src/options/normalized-input-options.ts
|
|
2318
|
-
var NormalizedInputOptionsImpl
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
}
|
|
2338
|
-
};
|
|
2339
|
-
} });
|
|
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
|
+
};
|
|
2340
2286
|
|
|
2341
2287
|
//#endregion
|
|
2342
2288
|
//#region src/types/sourcemap.ts
|
|
@@ -2353,7 +2299,6 @@ function bindingifySourcemap(map) {
|
|
|
2353
2299
|
debugId: "debugId" in map ? map.debugId : void 0
|
|
2354
2300
|
} };
|
|
2355
2301
|
}
|
|
2356
|
-
var init_sourcemap = __esm({ "src/types/sourcemap.ts"() {} });
|
|
2357
2302
|
|
|
2358
2303
|
//#endregion
|
|
2359
2304
|
//#region src/utils/error.ts
|
|
@@ -2404,7 +2349,6 @@ function getErrorMessage(e) {
|
|
|
2404
2349
|
function joinNewLine(s1, s2) {
|
|
2405
2350
|
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
2406
2351
|
}
|
|
2407
|
-
var init_error = __esm({ "src/utils/error.ts"() {} });
|
|
2408
2352
|
|
|
2409
2353
|
//#endregion
|
|
2410
2354
|
//#region src/utils/transform-module-info.ts
|
|
@@ -2426,26 +2370,19 @@ function transformModuleInfo(info, option) {
|
|
|
2426
2370
|
...option
|
|
2427
2371
|
};
|
|
2428
2372
|
}
|
|
2429
|
-
var init_transform_module_info = __esm({ "src/utils/transform-module-info.ts"() {
|
|
2430
|
-
init_misc();
|
|
2431
|
-
} });
|
|
2432
2373
|
|
|
2433
2374
|
//#endregion
|
|
2434
2375
|
//#region src/utils/transform-side-effects.ts
|
|
2435
2376
|
function bindingifySideEffects(sideEffects) {
|
|
2436
2377
|
switch (sideEffects) {
|
|
2437
|
-
case true: return
|
|
2438
|
-
case false: return
|
|
2439
|
-
case "no-treeshake": return
|
|
2378
|
+
case true: return BindingHookSideEffects.True;
|
|
2379
|
+
case false: return BindingHookSideEffects.False;
|
|
2380
|
+
case "no-treeshake": return BindingHookSideEffects.NoTreeshake;
|
|
2440
2381
|
case null:
|
|
2441
2382
|
case void 0: return void 0;
|
|
2442
2383
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
2443
2384
|
}
|
|
2444
2385
|
}
|
|
2445
|
-
var import_binding$5;
|
|
2446
|
-
var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"() {
|
|
2447
|
-
import_binding$5 = __toESM(require_binding());
|
|
2448
|
-
} });
|
|
2449
2386
|
|
|
2450
2387
|
//#endregion
|
|
2451
2388
|
//#region src/utils/transform-sourcemap.ts
|
|
@@ -2461,7 +2398,6 @@ function normalizeTransformHookSourcemap(id, originalCode, rawMap) {
|
|
|
2461
2398
|
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id) map.sources = [id];
|
|
2462
2399
|
return map;
|
|
2463
2400
|
}
|
|
2464
|
-
var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
|
|
2465
2401
|
|
|
2466
2402
|
//#endregion
|
|
2467
2403
|
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
@@ -2472,7 +2408,6 @@ function u$1(o, n, a) {
|
|
|
2472
2408
|
lazyArgs: n
|
|
2473
2409
|
});
|
|
2474
2410
|
}
|
|
2475
|
-
var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
|
|
2476
2411
|
|
|
2477
2412
|
//#endregion
|
|
2478
2413
|
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
@@ -2482,40 +2417,23 @@ function u(r, n, o) {
|
|
|
2482
2417
|
if (a === 1) return u$1(r, n, o);
|
|
2483
2418
|
throw new Error("Wrong number of arguments");
|
|
2484
2419
|
}
|
|
2485
|
-
var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
|
|
2486
|
-
init_chunk_D6FCK2GA();
|
|
2487
|
-
} });
|
|
2488
2420
|
|
|
2489
2421
|
//#endregion
|
|
2490
2422
|
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-3IFJP4R5.js
|
|
2491
2423
|
function d(...r) {
|
|
2492
2424
|
return u(i, r);
|
|
2493
2425
|
}
|
|
2494
|
-
var i
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
for (let [o, e] of r.entries()) t$1(e, o, r) ? a[0].push(e) : a[1].push(e);
|
|
2500
|
-
return a;
|
|
2501
|
-
};
|
|
2502
|
-
} });
|
|
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
|
+
};
|
|
2503
2431
|
|
|
2504
2432
|
//#endregion
|
|
2505
2433
|
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2506
2434
|
function t(...n) {
|
|
2507
2435
|
return u(Object.keys, n);
|
|
2508
2436
|
}
|
|
2509
|
-
var init_chunk_5NQBDF4H = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/chunk-5NQBDF4H.js"() {
|
|
2510
|
-
init_chunk_WIMGWYZL();
|
|
2511
|
-
} });
|
|
2512
|
-
|
|
2513
|
-
//#endregion
|
|
2514
|
-
//#region ../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/index.js
|
|
2515
|
-
var init_dist = __esm({ "../../node_modules/.pnpm/remeda@2.23.0/node_modules/remeda/dist/index.js"() {
|
|
2516
|
-
init_chunk_3IFJP4R5();
|
|
2517
|
-
init_chunk_5NQBDF4H();
|
|
2518
|
-
} });
|
|
2519
2437
|
|
|
2520
2438
|
//#endregion
|
|
2521
2439
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
@@ -2657,10 +2575,6 @@ function bindingifyRenderChunkFilter(filterOption) {
|
|
|
2657
2575
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2658
2576
|
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2659
2577
|
}
|
|
2660
|
-
var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
|
|
2661
|
-
init_dist();
|
|
2662
|
-
init_misc();
|
|
2663
|
-
} });
|
|
2664
2578
|
|
|
2665
2579
|
//#endregion
|
|
2666
2580
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
@@ -2669,17 +2583,13 @@ function bindingifyPluginHookMeta(options) {
|
|
|
2669
2583
|
}
|
|
2670
2584
|
function bindingPluginOrder(order) {
|
|
2671
2585
|
switch (order) {
|
|
2672
|
-
case "post": return
|
|
2673
|
-
case "pre": return
|
|
2586
|
+
case "post": return BindingPluginOrder.Post;
|
|
2587
|
+
case "pre": return BindingPluginOrder.Pre;
|
|
2674
2588
|
case null:
|
|
2675
2589
|
case void 0: return void 0;
|
|
2676
2590
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
2677
2591
|
}
|
|
2678
2592
|
}
|
|
2679
|
-
var import_binding$4;
|
|
2680
|
-
var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {
|
|
2681
|
-
import_binding$4 = __toESM(require_binding());
|
|
2682
|
-
} });
|
|
2683
2593
|
|
|
2684
2594
|
//#endregion
|
|
2685
2595
|
//#region src/utils/asset-source.ts
|
|
@@ -2689,150 +2599,132 @@ function transformAssetSource(bindingAssetSource$1) {
|
|
|
2689
2599
|
function bindingAssetSource(source) {
|
|
2690
2600
|
return { inner: source };
|
|
2691
2601
|
}
|
|
2692
|
-
var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
|
|
2693
2602
|
|
|
2694
2603
|
//#endregion
|
|
2695
2604
|
//#region src/plugin/plugin-context.ts
|
|
2696
|
-
var PluginContextImpl
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
}
|
|
2717
|
-
async load(options) {
|
|
2718
|
-
const id = options.id;
|
|
2719
|
-
if (id === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
2720
|
-
const moduleInfo = this.data.getModuleInfo(id, this.context);
|
|
2721
|
-
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
2722
|
-
const rawOptions = {
|
|
2723
|
-
meta: options.meta || {},
|
|
2724
|
-
moduleSideEffects: options.moduleSideEffects || null,
|
|
2725
|
-
invalidate: false
|
|
2726
|
-
};
|
|
2727
|
-
this.data.updateModuleOption(id, rawOptions);
|
|
2728
|
-
async function createLoadModulePromise(context, data) {
|
|
2729
|
-
const loadPromise = data.loadModulePromiseMap.get(id);
|
|
2730
|
-
if (loadPromise) return loadPromise;
|
|
2731
|
-
const promise$1 = new Promise((resolve, _) => {
|
|
2732
|
-
data.loadModulePromiseResolveFnMap.set(id, resolve);
|
|
2733
|
-
});
|
|
2734
|
-
data.loadModulePromiseMap.set(id, promise$1);
|
|
2735
|
-
try {
|
|
2736
|
-
await context.load(id, bindingifySideEffects(options.moduleSideEffects));
|
|
2737
|
-
} catch (e) {
|
|
2738
|
-
data.loadModulePromiseMap.delete(id);
|
|
2739
|
-
data.loadModulePromiseResolveFnMap.delete(id);
|
|
2740
|
-
throw e;
|
|
2741
|
-
}
|
|
2742
|
-
return promise$1;
|
|
2743
|
-
}
|
|
2744
|
-
await createLoadModulePromise(this.context, this.data);
|
|
2745
|
-
return this.data.getModuleInfo(id, this.context);
|
|
2746
|
-
}
|
|
2747
|
-
async resolve(source, importer, options) {
|
|
2748
|
-
let receipt = void 0;
|
|
2749
|
-
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
2750
|
-
const res = await this.context.resolve(source, importer, {
|
|
2751
|
-
custom: receipt,
|
|
2752
|
-
skipSelf: options?.skipSelf
|
|
2753
|
-
});
|
|
2754
|
-
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
2755
|
-
if (res == null) return null;
|
|
2756
|
-
const info = this.data.getModuleOption(res.id) || {};
|
|
2757
|
-
return {
|
|
2758
|
-
...res,
|
|
2759
|
-
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2760
|
-
...info
|
|
2761
|
-
};
|
|
2762
|
-
}
|
|
2763
|
-
emitFile = (file) => {
|
|
2764
|
-
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
2765
|
-
if (file.type === "chunk") return this.context.emitChunk({
|
|
2766
|
-
preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
|
|
2767
|
-
...file
|
|
2768
|
-
});
|
|
2769
|
-
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
2770
|
-
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
2771
|
-
return this.context.emitFile({
|
|
2772
|
-
...file,
|
|
2773
|
-
originalFileName: file.originalFileName || void 0,
|
|
2774
|
-
source: bindingAssetSource(file.source)
|
|
2775
|
-
}, 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
|
|
2776
2625
|
};
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
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);
|
|
2783
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;
|
|
2784
2642
|
}
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
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);
|
|
2797
2675
|
};
|
|
2798
|
-
|
|
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
|
+
};
|
|
2799
2697
|
|
|
2800
2698
|
//#endregion
|
|
2801
2699
|
//#region src/plugin/transform-plugin-context.ts
|
|
2802
|
-
var TransformPluginContextImpl
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
error(e,
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
}
|
|
2831
|
-
getCombinedSourcemap() {
|
|
2832
|
-
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
2833
|
-
}
|
|
2834
|
-
};
|
|
2835
|
-
} });
|
|
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
|
+
};
|
|
2836
2728
|
|
|
2837
2729
|
//#endregion
|
|
2838
2730
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
@@ -2997,20 +2889,6 @@ function bindingifyModuleParsed(args$1) {
|
|
|
2997
2889
|
meta: bindingifyPluginHookMeta(meta)
|
|
2998
2890
|
};
|
|
2999
2891
|
}
|
|
3000
|
-
var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
|
|
3001
|
-
init_normalize_hook();
|
|
3002
|
-
init_plugin_context$1();
|
|
3003
|
-
init_normalized_input_options();
|
|
3004
|
-
init_sourcemap();
|
|
3005
|
-
init_error();
|
|
3006
|
-
init_transform_module_info();
|
|
3007
|
-
init_transform_side_effects();
|
|
3008
|
-
init_transform_sourcemap();
|
|
3009
|
-
init_bindingify_hook_filter();
|
|
3010
|
-
init_bindingify_plugin_hook_meta();
|
|
3011
|
-
init_plugin_context();
|
|
3012
|
-
init_transform_plugin_context();
|
|
3013
|
-
} });
|
|
3014
2892
|
|
|
3015
2893
|
//#endregion
|
|
3016
2894
|
//#region src/utils/transform-rendered-module.ts
|
|
@@ -3027,7 +2905,6 @@ function transformToRenderedModule(bindingRenderedModule) {
|
|
|
3027
2905
|
}
|
|
3028
2906
|
};
|
|
3029
2907
|
}
|
|
3030
|
-
var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
|
|
3031
2908
|
|
|
3032
2909
|
//#endregion
|
|
3033
2910
|
//#region src/utils/transform-rendered-chunk.ts
|
|
@@ -3077,9 +2954,6 @@ function transformChunkModules(modules) {
|
|
|
3077
2954
|
}
|
|
3078
2955
|
return result;
|
|
3079
2956
|
}
|
|
3080
|
-
var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
|
|
3081
|
-
init_transform_rendered_module();
|
|
3082
|
-
} });
|
|
3083
2957
|
|
|
3084
2958
|
//#endregion
|
|
3085
2959
|
//#region src/utils/bindingify-output-options.ts
|
|
@@ -3164,125 +3038,116 @@ function bindingifyAssetFilenames(assetFileNames) {
|
|
|
3164
3038
|
};
|
|
3165
3039
|
return assetFileNames;
|
|
3166
3040
|
}
|
|
3167
|
-
var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
|
|
3168
|
-
init_asset_source();
|
|
3169
|
-
init_misc();
|
|
3170
|
-
init_transform_rendered_chunk();
|
|
3171
|
-
} });
|
|
3172
3041
|
|
|
3173
3042
|
//#endregion
|
|
3174
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
|
+
};
|
|
3175
3147
|
function normalizeAddon(value) {
|
|
3176
3148
|
if (typeof value === "function") return value;
|
|
3177
3149
|
return () => value || "";
|
|
3178
3150
|
}
|
|
3179
|
-
var NormalizedOutputOptionsImpl;
|
|
3180
|
-
var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
|
|
3181
|
-
init_bindingify_output_options();
|
|
3182
|
-
NormalizedOutputOptionsImpl = class {
|
|
3183
|
-
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3184
|
-
this.inner = inner;
|
|
3185
|
-
this.outputOptions = outputOptions;
|
|
3186
|
-
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3187
|
-
}
|
|
3188
|
-
get dir() {
|
|
3189
|
-
return this.inner.dir ?? void 0;
|
|
3190
|
-
}
|
|
3191
|
-
get entryFileNames() {
|
|
3192
|
-
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3193
|
-
}
|
|
3194
|
-
get chunkFileNames() {
|
|
3195
|
-
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3196
|
-
}
|
|
3197
|
-
get assetFileNames() {
|
|
3198
|
-
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3199
|
-
}
|
|
3200
|
-
get format() {
|
|
3201
|
-
return this.inner.format;
|
|
3202
|
-
}
|
|
3203
|
-
get exports() {
|
|
3204
|
-
return this.inner.exports;
|
|
3205
|
-
}
|
|
3206
|
-
get sourcemap() {
|
|
3207
|
-
return this.inner.sourcemap;
|
|
3208
|
-
}
|
|
3209
|
-
get cssEntryFileNames() {
|
|
3210
|
-
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3211
|
-
}
|
|
3212
|
-
get cssChunkFileNames() {
|
|
3213
|
-
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3214
|
-
}
|
|
3215
|
-
get shimMissingExports() {
|
|
3216
|
-
return this.inner.shimMissingExports;
|
|
3217
|
-
}
|
|
3218
|
-
get name() {
|
|
3219
|
-
return this.inner.name ?? void 0;
|
|
3220
|
-
}
|
|
3221
|
-
get file() {
|
|
3222
|
-
return this.inner.file ?? void 0;
|
|
3223
|
-
}
|
|
3224
|
-
get inlineDynamicImports() {
|
|
3225
|
-
return this.inner.inlineDynamicImports;
|
|
3226
|
-
}
|
|
3227
|
-
get externalLiveBindings() {
|
|
3228
|
-
return this.inner.externalLiveBindings;
|
|
3229
|
-
}
|
|
3230
|
-
get banner() {
|
|
3231
|
-
return normalizeAddon(this.outputOptions.banner);
|
|
3232
|
-
}
|
|
3233
|
-
get footer() {
|
|
3234
|
-
return normalizeAddon(this.outputOptions.footer);
|
|
3235
|
-
}
|
|
3236
|
-
get intro() {
|
|
3237
|
-
return normalizeAddon(this.outputOptions.intro);
|
|
3238
|
-
}
|
|
3239
|
-
get outro() {
|
|
3240
|
-
return normalizeAddon(this.outputOptions.outro);
|
|
3241
|
-
}
|
|
3242
|
-
get esModule() {
|
|
3243
|
-
return this.inner.esModule;
|
|
3244
|
-
}
|
|
3245
|
-
get extend() {
|
|
3246
|
-
return this.inner.extend;
|
|
3247
|
-
}
|
|
3248
|
-
get globals() {
|
|
3249
|
-
return this.inner.globals || this.outputOptions.globals;
|
|
3250
|
-
}
|
|
3251
|
-
get hashCharacters() {
|
|
3252
|
-
return this.inner.hashCharacters;
|
|
3253
|
-
}
|
|
3254
|
-
get sourcemapDebugIds() {
|
|
3255
|
-
return this.inner.sourcemapDebugIds;
|
|
3256
|
-
}
|
|
3257
|
-
get sourcemapIgnoreList() {
|
|
3258
|
-
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
3259
|
-
}
|
|
3260
|
-
get sourcemapPathTransform() {
|
|
3261
|
-
return this.outputOptions.sourcemapPathTransform;
|
|
3262
|
-
}
|
|
3263
|
-
get minify() {
|
|
3264
|
-
return this.inner.minify;
|
|
3265
|
-
}
|
|
3266
|
-
get legalComments() {
|
|
3267
|
-
return this.inner.legalComments;
|
|
3268
|
-
}
|
|
3269
|
-
get polyfillRequire() {
|
|
3270
|
-
return this.inner.polyfillRequire;
|
|
3271
|
-
}
|
|
3272
|
-
get plugins() {
|
|
3273
|
-
return this.normalizedOutputPlugins;
|
|
3274
|
-
}
|
|
3275
|
-
get preserveModules() {
|
|
3276
|
-
return this.inner.preserveModules;
|
|
3277
|
-
}
|
|
3278
|
-
get preserveModulesRoot() {
|
|
3279
|
-
return this.inner.preserveModulesRoot;
|
|
3280
|
-
}
|
|
3281
|
-
get virtualDirname() {
|
|
3282
|
-
return this.inner.virtualDirname;
|
|
3283
|
-
}
|
|
3284
|
-
};
|
|
3285
|
-
} });
|
|
3286
3151
|
|
|
3287
3152
|
//#endregion
|
|
3288
3153
|
//#region src/utils/transform-to-rollup-output.ts
|
|
@@ -3440,12 +3305,6 @@ function collectChangedBundle(changed, bundle) {
|
|
|
3440
3305
|
deleted: Array.from(changed.deleted)
|
|
3441
3306
|
};
|
|
3442
3307
|
}
|
|
3443
|
-
var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
|
|
3444
|
-
init_sourcemap();
|
|
3445
|
-
init_asset_source();
|
|
3446
|
-
init_error();
|
|
3447
|
-
init_transform_rendered_chunk();
|
|
3448
|
-
} });
|
|
3449
3308
|
|
|
3450
3309
|
//#endregion
|
|
3451
3310
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
@@ -3597,18 +3456,6 @@ function bindingifyOutro(args$1) {
|
|
|
3597
3456
|
meta: bindingifyPluginHookMeta(meta)
|
|
3598
3457
|
};
|
|
3599
3458
|
}
|
|
3600
|
-
var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
|
|
3601
|
-
init_normalized_input_options();
|
|
3602
|
-
init_normalized_output_options();
|
|
3603
|
-
init_sourcemap();
|
|
3604
|
-
init_error();
|
|
3605
|
-
init_normalize_hook();
|
|
3606
|
-
init_transform_rendered_chunk();
|
|
3607
|
-
init_transform_to_rollup_output();
|
|
3608
|
-
init_bindingify_hook_filter();
|
|
3609
|
-
init_bindingify_plugin_hook_meta();
|
|
3610
|
-
init_plugin_context();
|
|
3611
|
-
} });
|
|
3612
3459
|
|
|
3613
3460
|
//#endregion
|
|
3614
3461
|
//#region src/plugin/bindingify-watch-hooks.ts
|
|
@@ -3634,14 +3481,43 @@ function bindingifyCloseWatcher(args$1) {
|
|
|
3634
3481
|
meta: bindingifyPluginHookMeta(meta)
|
|
3635
3482
|
};
|
|
3636
3483
|
}
|
|
3637
|
-
var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
|
|
3638
|
-
init_normalize_hook();
|
|
3639
|
-
init_bindingify_plugin_hook_meta();
|
|
3640
|
-
init_plugin_context();
|
|
3641
|
-
} });
|
|
3642
3484
|
|
|
3643
3485
|
//#endregion
|
|
3644
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
|
+
};
|
|
3645
3521
|
function extractHookUsage(plugin) {
|
|
3646
3522
|
let hookUsage = new HookUsage();
|
|
3647
3523
|
if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
|
|
@@ -3666,43 +3542,6 @@ function extractHookUsage(plugin) {
|
|
|
3666
3542
|
if (plugin.outro) hookUsage.union(HookUsageKind.outro);
|
|
3667
3543
|
return hookUsage;
|
|
3668
3544
|
}
|
|
3669
|
-
var HookUsageKind, HookUsage;
|
|
3670
|
-
var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
|
|
3671
|
-
HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
3672
|
-
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
3673
|
-
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
3674
|
-
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
3675
|
-
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
3676
|
-
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
3677
|
-
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
3678
|
-
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
3679
|
-
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
3680
|
-
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
3681
|
-
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
3682
|
-
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
3683
|
-
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
3684
|
-
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
3685
|
-
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
3686
|
-
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
3687
|
-
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
3688
|
-
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
3689
|
-
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
3690
|
-
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
3691
|
-
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
3692
|
-
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
3693
|
-
return HookUsageKind$1;
|
|
3694
|
-
}({});
|
|
3695
|
-
HookUsage = class {
|
|
3696
|
-
bitflag = BigInt(0);
|
|
3697
|
-
constructor() {}
|
|
3698
|
-
union(kind) {
|
|
3699
|
-
this.bitflag |= BigInt(kind);
|
|
3700
|
-
}
|
|
3701
|
-
inner() {
|
|
3702
|
-
return Number(this.bitflag);
|
|
3703
|
-
}
|
|
3704
|
-
};
|
|
3705
|
-
} });
|
|
3706
3545
|
|
|
3707
3546
|
//#endregion
|
|
3708
3547
|
//#region src/plugin/bindingify-plugin.ts
|
|
@@ -3825,106 +3664,95 @@ function wrapHandlers(plugin) {
|
|
|
3825
3664
|
}
|
|
3826
3665
|
return plugin;
|
|
3827
3666
|
}
|
|
3828
|
-
var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
|
|
3829
|
-
init_bindingify_build_hooks();
|
|
3830
|
-
init_bindingify_output_hooks();
|
|
3831
|
-
init_logs();
|
|
3832
|
-
init_bindingify_watch_hooks();
|
|
3833
|
-
init_hook_usage();
|
|
3834
|
-
} });
|
|
3835
3667
|
|
|
3836
3668
|
//#endregion
|
|
3837
3669
|
//#region src/plugin/plugin-context-data.ts
|
|
3838
|
-
var PluginContextData
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
if (
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
3853
|
-
} else {
|
|
3854
|
-
this.moduleOptionMap.set(id, option);
|
|
3855
|
-
return option;
|
|
3856
|
-
}
|
|
3857
|
-
return existing;
|
|
3858
|
-
}
|
|
3859
|
-
getModuleOption(id) {
|
|
3860
|
-
const option = this.moduleOptionMap.get(id);
|
|
3861
|
-
if (!option) {
|
|
3862
|
-
const raw = {
|
|
3863
|
-
moduleSideEffects: null,
|
|
3864
|
-
meta: {}
|
|
3865
|
-
};
|
|
3866
|
-
this.moduleOptionMap.set(id, raw);
|
|
3867
|
-
return raw;
|
|
3868
|
-
}
|
|
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);
|
|
3869
3684
|
return option;
|
|
3870
3685
|
}
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
get() {
|
|
3883
|
-
return moduleSideEffects;
|
|
3884
|
-
},
|
|
3885
|
-
set: (v) => {
|
|
3886
|
-
this.updateModuleOption(id, {
|
|
3887
|
-
moduleSideEffects: v,
|
|
3888
|
-
meta: info.meta,
|
|
3889
|
-
invalidate: true
|
|
3890
|
-
});
|
|
3891
|
-
moduleSideEffects = v;
|
|
3892
|
-
}
|
|
3893
|
-
});
|
|
3894
|
-
return info;
|
|
3895
|
-
}
|
|
3896
|
-
getModuleIds(context) {
|
|
3897
|
-
const moduleIds = context.getModuleIds();
|
|
3898
|
-
return moduleIds.values();
|
|
3899
|
-
}
|
|
3900
|
-
saveResolveOptions(options) {
|
|
3901
|
-
const index = this.resolveOptionsMap.size;
|
|
3902
|
-
this.resolveOptionsMap.set(index, options);
|
|
3903
|
-
return index;
|
|
3904
|
-
}
|
|
3905
|
-
getSavedResolveOptions(receipt) {
|
|
3906
|
-
return this.resolveOptionsMap.get(receipt);
|
|
3907
|
-
}
|
|
3908
|
-
removeSavedResolveOptions(receipt) {
|
|
3909
|
-
this.resolveOptionsMap.delete(receipt);
|
|
3910
|
-
}
|
|
3911
|
-
setRenderChunkMeta(meta) {
|
|
3912
|
-
this.renderedChunkMeta = meta;
|
|
3913
|
-
}
|
|
3914
|
-
getRenderChunkMeta() {
|
|
3915
|
-
return this.renderedChunkMeta;
|
|
3916
|
-
}
|
|
3917
|
-
markModuleLoaded(id, _success) {
|
|
3918
|
-
const resolve = this.loadModulePromiseResolveFnMap.get(id);
|
|
3919
|
-
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;
|
|
3920
3697
|
}
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
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);
|
|
3925
3705
|
}
|
|
3926
|
-
|
|
3927
|
-
}
|
|
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
|
+
};
|
|
3928
3756
|
|
|
3929
3757
|
//#endregion
|
|
3930
3758
|
//#region src/utils/normalize-string-or-regex.ts
|
|
@@ -3936,7 +3764,6 @@ function normalizedStringOrRegex(pattern) {
|
|
|
3936
3764
|
function isReadonlyArray(input) {
|
|
3937
3765
|
return Array.isArray(input);
|
|
3938
3766
|
}
|
|
3939
|
-
var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
|
|
3940
3767
|
|
|
3941
3768
|
//#endregion
|
|
3942
3769
|
//#region src/utils/bindingify-input-options.ts
|
|
@@ -4004,9 +3831,9 @@ function bindingifyHmr(hmr) {
|
|
|
4004
3831
|
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
4005
3832
|
switch (attachDebugInfo) {
|
|
4006
3833
|
case void 0: return void 0;
|
|
4007
|
-
case "full": return
|
|
4008
|
-
case "simple": return
|
|
4009
|
-
case "none": return
|
|
3834
|
+
case "full": return BindingAttachDebugInfo.Full;
|
|
3835
|
+
case "simple": return BindingAttachDebugInfo.Simple;
|
|
3836
|
+
case "none": return BindingAttachDebugInfo.None;
|
|
4010
3837
|
}
|
|
4011
3838
|
}
|
|
4012
3839
|
function bindingifyExternal(external) {
|
|
@@ -4064,10 +3891,10 @@ function bindingifyInject(inject) {
|
|
|
4064
3891
|
}
|
|
4065
3892
|
function bindingifyLogLevel(logLevel) {
|
|
4066
3893
|
switch (logLevel) {
|
|
4067
|
-
case "silent": return
|
|
4068
|
-
case "debug": return
|
|
4069
|
-
case "warn": return
|
|
4070
|
-
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;
|
|
4071
3898
|
default: throw new Error(`Unexpected log level: ${logLevel}`);
|
|
4072
3899
|
}
|
|
4073
3900
|
}
|
|
@@ -4084,7 +3911,7 @@ function bindingifyInput(input) {
|
|
|
4084
3911
|
}
|
|
4085
3912
|
function bindingifyJsx(input) {
|
|
4086
3913
|
if (typeof input === "object") {
|
|
4087
|
-
if (input.mode === "preserve") return { jsx:
|
|
3914
|
+
if (input.mode === "preserve") return { jsx: BindingJsx.Preserve };
|
|
4088
3915
|
const mode = input.mode ?? "automatic";
|
|
4089
3916
|
return { jsxTransform: { jsx: {
|
|
4090
3917
|
runtime: mode,
|
|
@@ -4094,10 +3921,10 @@ function bindingifyJsx(input) {
|
|
|
4094
3921
|
} } };
|
|
4095
3922
|
}
|
|
4096
3923
|
switch (input) {
|
|
4097
|
-
case false: return { jsx:
|
|
4098
|
-
case "react": return { jsx:
|
|
4099
|
-
case "react-jsx": return { jsx:
|
|
4100
|
-
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 };
|
|
4101
3928
|
default: return { jsx: void 0 };
|
|
4102
3929
|
}
|
|
4103
3930
|
}
|
|
@@ -4147,33 +3974,31 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
|
4147
3974
|
field0: preserveEntrySignatures
|
|
4148
3975
|
};
|
|
4149
3976
|
}
|
|
4150
|
-
var import_binding$3;
|
|
4151
|
-
var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
|
|
4152
|
-
import_binding$3 = __toESM(require_binding());
|
|
4153
|
-
init_constructors();
|
|
4154
|
-
init_utils();
|
|
4155
|
-
init_bindingify_plugin();
|
|
4156
|
-
init_plugin_context_data();
|
|
4157
|
-
init_misc();
|
|
4158
|
-
init_normalize_string_or_regex();
|
|
4159
|
-
init_transform_side_effects();
|
|
4160
|
-
} });
|
|
4161
3977
|
|
|
4162
3978
|
//#endregion
|
|
4163
3979
|
//#region src/utils/plugin/index.ts
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
return PLUGIN_HOOK_NAMES_SET.has(hookName);
|
|
4171
|
-
};
|
|
4172
|
-
}();
|
|
4173
|
-
} });
|
|
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
|
+
}();
|
|
4174
3986
|
|
|
4175
3987
|
//#endregion
|
|
4176
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);
|
|
4177
4002
|
function isUnsupportedHooks(hookName) {
|
|
4178
4003
|
return unsupportedHooks.has(hookName);
|
|
4179
4004
|
}
|
|
@@ -4466,28 +4291,6 @@ function composeJsPlugins(plugins) {
|
|
|
4466
4291
|
}
|
|
4467
4292
|
return newPlugins;
|
|
4468
4293
|
}
|
|
4469
|
-
var unsupportedHookName, unsupportedHooks;
|
|
4470
|
-
var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
|
|
4471
|
-
init_dist();
|
|
4472
|
-
init_constructors();
|
|
4473
|
-
init_plugin_context$1();
|
|
4474
|
-
init_misc();
|
|
4475
|
-
init_normalize_hook();
|
|
4476
|
-
init_plugin();
|
|
4477
|
-
unsupportedHookName = [
|
|
4478
|
-
"augmentChunkHash",
|
|
4479
|
-
"generateBundle",
|
|
4480
|
-
"moduleParsed",
|
|
4481
|
-
"onLog",
|
|
4482
|
-
"options",
|
|
4483
|
-
"outputOptions",
|
|
4484
|
-
"renderError",
|
|
4485
|
-
"renderStart",
|
|
4486
|
-
"resolveDynamicImport",
|
|
4487
|
-
"writeBundle"
|
|
4488
|
-
];
|
|
4489
|
-
unsupportedHooks = new Set(unsupportedHookName);
|
|
4490
|
-
} });
|
|
4491
4294
|
|
|
4492
4295
|
//#endregion
|
|
4493
4296
|
//#region src/utils/initialize-parallel-plugins.ts
|
|
@@ -4503,7 +4306,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4503
4306
|
}
|
|
4504
4307
|
if (pluginInfos.length <= 0) return void 0;
|
|
4505
4308
|
const count = availableParallelism();
|
|
4506
|
-
const parallelJsPluginRegistry = new
|
|
4309
|
+
const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
|
|
4507
4310
|
const registryId = parallelJsPluginRegistry.id;
|
|
4508
4311
|
const workers = await initializeWorkers(registryId, count, pluginInfos);
|
|
4509
4312
|
const stopWorkers = async () => {
|
|
@@ -4540,20 +4343,16 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
4540
4343
|
throw e;
|
|
4541
4344
|
}
|
|
4542
4345
|
}
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
}
|
|
4554
|
-
return Math.min(availableParallelism$1, 8);
|
|
4555
|
-
};
|
|
4556
|
-
} });
|
|
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
|
+
};
|
|
4557
4356
|
|
|
4558
4357
|
//#endregion
|
|
4559
4358
|
//#region src/utils/create-bundler-option.ts
|
|
@@ -4589,28 +4388,19 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4589
4388
|
throw e;
|
|
4590
4389
|
}
|
|
4591
4390
|
}
|
|
4592
|
-
var init_create_bundler_option = __esm({ "src/utils/create-bundler-option.ts"() {
|
|
4593
|
-
init_logger();
|
|
4594
|
-
init_logging();
|
|
4595
|
-
init_plugin_driver();
|
|
4596
|
-
init_bindingify_input_options();
|
|
4597
|
-
init_bindingify_output_options();
|
|
4598
|
-
init_compose_js_plugins();
|
|
4599
|
-
init_initialize_parallel_plugins();
|
|
4600
|
-
init_normalize_plugin_option();
|
|
4601
|
-
} });
|
|
4602
4391
|
|
|
4603
4392
|
//#endregion
|
|
4604
4393
|
//#region src/utils/create-bundler.ts
|
|
4605
|
-
|
|
4394
|
+
let asyncRuntimeShutdown = false;
|
|
4395
|
+
async function createBundlerImpl(bundler, inputOptions, outputOptions, isClose) {
|
|
4606
4396
|
const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
|
|
4607
|
-
if (asyncRuntimeShutdown)
|
|
4397
|
+
if (asyncRuntimeShutdown) startAsyncRuntime();
|
|
4608
4398
|
try {
|
|
4609
4399
|
return {
|
|
4610
|
-
|
|
4400
|
+
impl: bundler.createImpl(option.bundlerOptions),
|
|
4611
4401
|
stopWorkers: option.stopWorkers,
|
|
4612
4402
|
shutdown: () => {
|
|
4613
|
-
|
|
4403
|
+
shutdownAsyncRuntime();
|
|
4614
4404
|
asyncRuntimeShutdown = true;
|
|
4615
4405
|
}
|
|
4616
4406
|
};
|
|
@@ -4619,12 +4409,6 @@ async function createBundler(inputOptions, outputOptions, isClose) {
|
|
|
4619
4409
|
throw e;
|
|
4620
4410
|
}
|
|
4621
4411
|
}
|
|
4622
|
-
var import_binding$1, asyncRuntimeShutdown;
|
|
4623
|
-
var init_create_bundler = __esm({ "src/utils/create-bundler.ts"() {
|
|
4624
|
-
import_binding$1 = __toESM(require_binding());
|
|
4625
|
-
init_create_bundler_option();
|
|
4626
|
-
asyncRuntimeShutdown = false;
|
|
4627
|
-
} });
|
|
4628
4412
|
|
|
4629
4413
|
//#endregion
|
|
4630
4414
|
//#region src/utils/transform-hmr-patch-output.ts
|
|
@@ -4637,80 +4421,66 @@ function handleHmrPatchOutputErrors(output) {
|
|
|
4637
4421
|
const rawErrors = output.errors;
|
|
4638
4422
|
if (rawErrors.length > 0) throw normalizeErrors(rawErrors);
|
|
4639
4423
|
}
|
|
4640
|
-
var init_transform_hmr_patch_output = __esm({ "src/utils/transform-hmr-patch-output.ts"() {
|
|
4641
|
-
init_error();
|
|
4642
|
-
} });
|
|
4643
4424
|
|
|
4644
4425
|
//#endregion
|
|
4645
4426
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4646
|
-
|
|
4647
|
-
var
|
|
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
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
get watchFiles() {
|
|
4696
|
-
return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
|
|
4697
|
-
}
|
|
4698
|
-
};
|
|
4699
|
-
} });
|
|
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
|
+
};
|
|
4700
4476
|
|
|
4701
4477
|
//#endregion
|
|
4702
4478
|
//#region src/api/rolldown/index.ts
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
rolldown = async (input) => {
|
|
4709
|
-
validateOption("input", input);
|
|
4710
|
-
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
4711
|
-
return new RolldownBuild(inputOptions);
|
|
4712
|
-
};
|
|
4713
|
-
} });
|
|
4479
|
+
const rolldown = async (input) => {
|
|
4480
|
+
validateOption("input", input);
|
|
4481
|
+
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
4482
|
+
return new RolldownBuild(inputOptions);
|
|
4483
|
+
};
|
|
4714
4484
|
|
|
4715
4485
|
//#endregion
|
|
4716
4486
|
//#region src/api/build.ts
|
|
@@ -4727,86 +4497,106 @@ async function build(options) {
|
|
|
4727
4497
|
}
|
|
4728
4498
|
}
|
|
4729
4499
|
}
|
|
4730
|
-
var init_build = __esm({ "src/api/build.ts"() {
|
|
4731
|
-
init_rolldown();
|
|
4732
|
-
} });
|
|
4733
4500
|
|
|
4734
4501
|
//#endregion
|
|
4735
4502
|
//#region src/api/watch/watch-emitter.ts
|
|
4736
|
-
var WatcherEmitter
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
if (listeners) {
|
|
4754
|
-
const index = listeners.indexOf(listener);
|
|
4755
|
-
if (index !== -1) listeners.splice(index, 1);
|
|
4756
|
-
}
|
|
4757
|
-
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);
|
|
4758
4520
|
}
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
break;
|
|
4793
|
-
case "change":
|
|
4794
|
-
for (const listener of listeners) {
|
|
4795
|
-
const { path: path$1, kind } = event.watchChangeData();
|
|
4796
|
-
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;
|
|
4797
4554
|
}
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
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}`);
|
|
4804
4564
|
}
|
|
4805
|
-
}
|
|
4806
|
-
|
|
4565
|
+
}
|
|
4566
|
+
async close() {
|
|
4567
|
+
clearInterval(this.timer);
|
|
4568
|
+
}
|
|
4569
|
+
};
|
|
4807
4570
|
|
|
4808
4571
|
//#endregion
|
|
4809
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
|
+
};
|
|
4810
4600
|
async function createWatcher(emitter, input) {
|
|
4811
4601
|
const options = arraify(input);
|
|
4812
4602
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
@@ -4814,7 +4604,7 @@ async function createWatcher(emitter, input) {
|
|
|
4814
4604
|
return createBundlerOptions(inputOptions, output, true);
|
|
4815
4605
|
})).flat());
|
|
4816
4606
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4817
|
-
const bindingWatcher = new
|
|
4607
|
+
const bindingWatcher = new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
|
|
4818
4608
|
const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
|
|
4819
4609
|
watcher.start();
|
|
4820
4610
|
}
|
|
@@ -4828,73 +4618,24 @@ function getValidNotifyOption(bundlerOptions) {
|
|
|
4828
4618
|
} else result = notifyOption;
|
|
4829
4619
|
}
|
|
4830
4620
|
}
|
|
4831
|
-
var import_binding, Watcher;
|
|
4832
|
-
var init_watcher = __esm({ "src/api/watch/watcher.ts"() {
|
|
4833
|
-
import_binding = __toESM(require_binding());
|
|
4834
|
-
init_logging();
|
|
4835
|
-
init_logs();
|
|
4836
|
-
init_plugin_driver();
|
|
4837
|
-
init_create_bundler_option();
|
|
4838
|
-
init_misc();
|
|
4839
|
-
Watcher = class {
|
|
4840
|
-
closed;
|
|
4841
|
-
inner;
|
|
4842
|
-
emitter;
|
|
4843
|
-
stopWorkers;
|
|
4844
|
-
constructor(emitter, inner, stopWorkers) {
|
|
4845
|
-
this.closed = false;
|
|
4846
|
-
this.inner = inner;
|
|
4847
|
-
this.emitter = emitter;
|
|
4848
|
-
const originClose = emitter.close.bind(emitter);
|
|
4849
|
-
emitter.close = async () => {
|
|
4850
|
-
await this.close();
|
|
4851
|
-
originClose();
|
|
4852
|
-
};
|
|
4853
|
-
this.stopWorkers = stopWorkers;
|
|
4854
|
-
}
|
|
4855
|
-
async close() {
|
|
4856
|
-
if (this.closed) return;
|
|
4857
|
-
this.closed = true;
|
|
4858
|
-
for (const stop of this.stopWorkers) await stop?.();
|
|
4859
|
-
await this.inner.close();
|
|
4860
|
-
(0, import_binding.shutdownAsyncRuntime)();
|
|
4861
|
-
}
|
|
4862
|
-
start() {
|
|
4863
|
-
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
4864
|
-
}
|
|
4865
|
-
};
|
|
4866
|
-
} });
|
|
4867
4621
|
|
|
4868
4622
|
//#endregion
|
|
4869
4623
|
//#region src/api/watch/index.ts
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
const emitter = new WatcherEmitter();
|
|
4876
|
-
createWatcher(emitter, input);
|
|
4877
|
-
return emitter;
|
|
4878
|
-
};
|
|
4879
|
-
} });
|
|
4624
|
+
const watch = (input) => {
|
|
4625
|
+
const emitter = new WatcherEmitter();
|
|
4626
|
+
createWatcher(emitter, input);
|
|
4627
|
+
return emitter;
|
|
4628
|
+
};
|
|
4880
4629
|
|
|
4881
4630
|
//#endregion
|
|
4882
4631
|
//#region src/utils/define-config.ts
|
|
4883
4632
|
function defineConfig(config) {
|
|
4884
4633
|
return config;
|
|
4885
4634
|
}
|
|
4886
|
-
var init_define_config = __esm({ "src/utils/define-config.ts"() {} });
|
|
4887
4635
|
|
|
4888
4636
|
//#endregion
|
|
4889
4637
|
//#region src/index.ts
|
|
4890
|
-
|
|
4891
|
-
var init_src = __esm({ "src/index.ts"() {
|
|
4892
|
-
init_build();
|
|
4893
|
-
init_rolldown();
|
|
4894
|
-
init_watch();
|
|
4895
|
-
init_define_config();
|
|
4896
|
-
VERSION = version;
|
|
4897
|
-
} });
|
|
4638
|
+
const VERSION = version;
|
|
4898
4639
|
|
|
4899
4640
|
//#endregion
|
|
4900
|
-
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 };
|