@rolldown/browser 1.0.0-beta.10-commit.885ee53 → 1.0.0-beta.10-commit.174c548
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 +6 -8
- package/dist/cli.mjs +1077 -1036
- package/dist/config.cjs +3 -3
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +5 -4
- package/dist/experimental-index.browser.mjs +1 -1
- package/dist/experimental-index.cjs +2 -2
- package/dist/experimental-index.d.mts +2 -2
- package/dist/experimental-index.mjs +14 -3
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +2 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -3
- package/dist/parallel-plugin-worker.cjs +2 -2
- package/dist/parallel-plugin-worker.mjs +33 -27
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +2 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/chunk-DSsiIF1Z.mjs +30 -0
- package/dist/shared/{define-config-cqCLLLZ-.d.mts → define-config-BIXBk1MV.d.mts} +1 -1
- package/dist/shared/dist-DeDsdiza.mjs +153 -0
- package/dist/shared/{load-config-0bnuUeT5.cjs → load-config-Bh4s7mv7.cjs} +1 -1
- package/dist/shared/{load-config-F7nMcxMb.mjs → load-config-NxVyTTYe.mjs} +19 -14
- package/dist/shared/{parse-ast-index-C31FpvkE.mjs → parse-ast-index-B3Tue26H.mjs} +28 -10
- package/dist/shared/{parse-ast-index-BuelS_NF.cjs → parse-ast-index-DL8_b_QU.cjs} +1 -1
- package/dist/shared/prompt-jPdbaKAj.mjs +854 -0
- package/dist/shared/{src-B3FAi7gC.cjs → src-C1WG6B4S.cjs} +86 -16
- package/dist/shared/{src-6t_bV_L5.mjs → src-zY8hlbF2.mjs} +1422 -1132
- package/dist/{src-1eaUHc8G.js → src-DLpA6Cgv.js} +6 -6
- package/package.json +2 -2
- package/dist/shared/dist-BoWaIc-K.mjs +0 -147
- package/dist/shared/prompt-C3zHEaSG.mjs +0 -852
- /package/dist/shared/{binding-Dod8fhx9.d.mts → binding-CHPrEDXp.d.mts} +0 -0
|
@@ -1,39 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __commonJS, __esm, __toESM } from "./chunk-DSsiIF1Z.mjs";
|
|
2
|
+
import { and, arraify, code, exclude, id, include, init_dist, init_misc, isNullish, moduleType, noop, or, unimplemented, unreachable, unsupported } from "./dist-DeDsdiza.mjs";
|
|
3
|
+
import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-B3Tue26H.mjs";
|
|
3
4
|
import { BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import os from "node:os";
|
|
7
8
|
import { Worker } from "node:worker_threads";
|
|
8
9
|
|
|
9
|
-
//#region rolldown:runtime
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __commonJS = (cb, mod) => function() {
|
|
17
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i$2 = 0, n$1 = keys.length, key; i$2 < n$1; i$2++) {
|
|
21
|
-
key = keys[i$2];
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
-
get: ((k) => from[k]).bind(null, key),
|
|
24
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
-
value: mod,
|
|
31
|
-
enumerable: true
|
|
32
|
-
}) : target, mod));
|
|
33
|
-
|
|
34
|
-
//#endregion
|
|
35
10
|
//#region package.json
|
|
36
|
-
var version = "1.0.0-beta.10-commit.
|
|
11
|
+
var version = "1.0.0-beta.10-commit.174c548";
|
|
37
12
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
38
13
|
|
|
39
14
|
//#endregion
|
|
@@ -52,15 +27,10 @@ function bindingifyBuiltInPlugin(plugin) {
|
|
|
52
27
|
options: plugin._options
|
|
53
28
|
};
|
|
54
29
|
}
|
|
30
|
+
var init_utils = __esm({ "src/builtin-plugin/utils.ts"() {} });
|
|
55
31
|
|
|
56
32
|
//#endregion
|
|
57
33
|
//#region src/builtin-plugin/constructors.ts
|
|
58
|
-
var BuiltinPlugin = class {
|
|
59
|
-
constructor(name, _options) {
|
|
60
|
-
this.name = name;
|
|
61
|
-
this._options = _options;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
34
|
function modulePreloadPolyfillPlugin() {
|
|
65
35
|
return new BuiltinPlugin("builtin:module-preload-polyfill");
|
|
66
36
|
}
|
|
@@ -128,24 +98,36 @@ function webWorkerPostPlugin() {
|
|
|
128
98
|
function oxcRuntimePlugin(config) {
|
|
129
99
|
return new BuiltinPlugin("builtin:oxc-runtime", config);
|
|
130
100
|
}
|
|
101
|
+
var BuiltinPlugin;
|
|
102
|
+
var init_constructors = __esm({ "src/builtin-plugin/constructors.ts"() {
|
|
103
|
+
init_utils();
|
|
104
|
+
BuiltinPlugin = class {
|
|
105
|
+
constructor(name, _options) {
|
|
106
|
+
this.name = name;
|
|
107
|
+
this._options = _options;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
} });
|
|
131
111
|
|
|
132
112
|
//#endregion
|
|
133
113
|
//#region src/log/logging.ts
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
114
|
+
var LOG_LEVEL_SILENT, LOG_LEVEL_ERROR, LOG_LEVEL_WARN, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, logLevelPriority;
|
|
115
|
+
var init_logging = __esm({ "src/log/logging.ts"() {
|
|
116
|
+
LOG_LEVEL_SILENT = "silent";
|
|
117
|
+
LOG_LEVEL_ERROR = "error";
|
|
118
|
+
LOG_LEVEL_WARN = "warn";
|
|
119
|
+
LOG_LEVEL_INFO = "info";
|
|
120
|
+
LOG_LEVEL_DEBUG = "debug";
|
|
121
|
+
logLevelPriority = {
|
|
122
|
+
[LOG_LEVEL_DEBUG]: 0,
|
|
123
|
+
[LOG_LEVEL_INFO]: 1,
|
|
124
|
+
[LOG_LEVEL_WARN]: 2,
|
|
125
|
+
[LOG_LEVEL_SILENT]: 3
|
|
126
|
+
};
|
|
127
|
+
} });
|
|
145
128
|
|
|
146
129
|
//#endregion
|
|
147
130
|
//#region src/log/log-handler.ts
|
|
148
|
-
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
149
131
|
function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
150
132
|
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
151
133
|
return (log, pos) => {
|
|
@@ -157,6 +139,13 @@ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
|
157
139
|
logger(level, log);
|
|
158
140
|
};
|
|
159
141
|
}
|
|
142
|
+
var normalizeLog;
|
|
143
|
+
var init_log_handler = __esm({ "src/log/log-handler.ts"() {
|
|
144
|
+
init_misc();
|
|
145
|
+
init_logging();
|
|
146
|
+
init_logs();
|
|
147
|
+
normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
148
|
+
} });
|
|
160
149
|
|
|
161
150
|
//#endregion
|
|
162
151
|
//#region src/log/logger.ts
|
|
@@ -192,47 +181,55 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
|
192
181
|
};
|
|
193
182
|
return logger;
|
|
194
183
|
}
|
|
195
|
-
const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
|
|
196
|
-
const { onwarn, onLog } = config;
|
|
197
|
-
const defaultOnLog = getDefaultOnLog(printLog, onwarn);
|
|
198
|
-
if (onLog) {
|
|
199
|
-
const minimalPriority = logLevelPriority[logLevel];
|
|
200
|
-
return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
|
|
201
|
-
if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
|
|
202
|
-
if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
return defaultOnLog;
|
|
206
|
-
};
|
|
207
|
-
const getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
|
|
208
|
-
if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
|
|
209
|
-
else printLog(level, log);
|
|
210
|
-
} : printLog;
|
|
211
|
-
const addLogToString = (log) => {
|
|
212
|
-
Object.defineProperty(log, "toString", {
|
|
213
|
-
value: () => getExtendedLogMessage(log),
|
|
214
|
-
writable: true
|
|
215
|
-
});
|
|
216
|
-
return log;
|
|
217
|
-
};
|
|
218
|
-
const defaultPrintLog = (level, log) => {
|
|
219
|
-
const message = getExtendedLogMessage(log);
|
|
220
|
-
switch (level) {
|
|
221
|
-
case LOG_LEVEL_WARN: return console.warn(message);
|
|
222
|
-
case LOG_LEVEL_DEBUG: return console.debug(message);
|
|
223
|
-
default: return console.info(message);
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
const getExtendedLogMessage = (log) => {
|
|
227
|
-
let prefix = "";
|
|
228
|
-
if (log.plugin) prefix += `(${log.plugin} plugin) `;
|
|
229
|
-
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
230
|
-
return prefix + log.message;
|
|
231
|
-
};
|
|
232
184
|
function relativeId(id$1) {
|
|
233
185
|
if (!path.isAbsolute(id$1)) return id$1;
|
|
234
186
|
return path.relative(path.resolve(), id$1);
|
|
235
187
|
}
|
|
188
|
+
var getOnLog, getDefaultOnLog, addLogToString, defaultPrintLog, getExtendedLogMessage;
|
|
189
|
+
var init_logger = __esm({ "src/log/logger.ts"() {
|
|
190
|
+
init_src();
|
|
191
|
+
init_plugin_driver();
|
|
192
|
+
init_log_handler();
|
|
193
|
+
init_logging();
|
|
194
|
+
init_logs();
|
|
195
|
+
getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
|
|
196
|
+
const { onwarn, onLog } = config;
|
|
197
|
+
const defaultOnLog = getDefaultOnLog(printLog, onwarn);
|
|
198
|
+
if (onLog) {
|
|
199
|
+
const minimalPriority = logLevelPriority[logLevel];
|
|
200
|
+
return (level, log) => onLog(level, addLogToString(log), (level$1, handledLog) => {
|
|
201
|
+
if (level$1 === LOG_LEVEL_ERROR) return error(normalizeLog(handledLog));
|
|
202
|
+
if (logLevelPriority[level$1] >= minimalPriority) defaultOnLog(level$1, normalizeLog(handledLog));
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return defaultOnLog;
|
|
206
|
+
};
|
|
207
|
+
getDefaultOnLog = (printLog, onwarn) => onwarn ? (level, log) => {
|
|
208
|
+
if (level === LOG_LEVEL_WARN) onwarn(addLogToString(log), (warning) => printLog(LOG_LEVEL_WARN, normalizeLog(warning)));
|
|
209
|
+
else printLog(level, log);
|
|
210
|
+
} : printLog;
|
|
211
|
+
addLogToString = (log) => {
|
|
212
|
+
Object.defineProperty(log, "toString", {
|
|
213
|
+
value: () => getExtendedLogMessage(log),
|
|
214
|
+
writable: true
|
|
215
|
+
});
|
|
216
|
+
return log;
|
|
217
|
+
};
|
|
218
|
+
defaultPrintLog = (level, log) => {
|
|
219
|
+
const message = getExtendedLogMessage(log);
|
|
220
|
+
switch (level) {
|
|
221
|
+
case LOG_LEVEL_WARN: return console.warn(message);
|
|
222
|
+
case LOG_LEVEL_DEBUG: return console.debug(message);
|
|
223
|
+
default: return console.info(message);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
getExtendedLogMessage = (log) => {
|
|
227
|
+
let prefix = "";
|
|
228
|
+
if (log.plugin) prefix += `(${log.plugin} plugin) `;
|
|
229
|
+
if (log.loc) prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
230
|
+
return prefix + log.message;
|
|
231
|
+
};
|
|
232
|
+
} });
|
|
236
233
|
|
|
237
234
|
//#endregion
|
|
238
235
|
//#region src/utils/normalize-hook.ts
|
|
@@ -252,75 +249,71 @@ function normalizeHook(hook) {
|
|
|
252
249
|
}
|
|
253
250
|
unreachable("Invalid hook type");
|
|
254
251
|
}
|
|
252
|
+
var init_normalize_hook = __esm({ "src/utils/normalize-hook.ts"() {
|
|
253
|
+
init_misc();
|
|
254
|
+
} });
|
|
255
255
|
|
|
256
256
|
//#endregion
|
|
257
257
|
//#region src/constants/plugin.ts
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
[ENUMERATED_PLUGIN_HOOK_NAMES[17]]: ENUMERATED_PLUGIN_HOOK_NAMES[17],
|
|
318
|
-
[ENUMERATED_PLUGIN_HOOK_NAMES[18]]: ENUMERATED_PLUGIN_HOOK_NAMES[18],
|
|
319
|
-
[ENUMERATED_PLUGIN_HOOK_NAMES[19]]: ENUMERATED_PLUGIN_HOOK_NAMES[19],
|
|
320
|
-
[ENUMERATED_PLUGIN_HOOK_NAMES[20]]: ENUMERATED_PLUGIN_HOOK_NAMES[20],
|
|
321
|
-
[ENUMERATED_PLUGIN_HOOK_NAMES[21]]: ENUMERATED_PLUGIN_HOOK_NAMES[21],
|
|
322
|
-
[ENUMERATED_PLUGIN_HOOK_NAMES[22]]: ENUMERATED_PLUGIN_HOOK_NAMES[22]
|
|
323
|
-
};
|
|
258
|
+
var ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES, ENUMERATED_PLUGIN_HOOK_NAMES, DEFINED_HOOK_NAMES;
|
|
259
|
+
var init_plugin$1 = __esm({ "src/constants/plugin.ts"() {
|
|
260
|
+
ENUMERATED_INPUT_PLUGIN_HOOK_NAMES = [
|
|
261
|
+
"options",
|
|
262
|
+
"buildStart",
|
|
263
|
+
"resolveId",
|
|
264
|
+
"load",
|
|
265
|
+
"transform",
|
|
266
|
+
"moduleParsed",
|
|
267
|
+
"buildEnd",
|
|
268
|
+
"onLog",
|
|
269
|
+
"resolveDynamicImport",
|
|
270
|
+
"closeBundle",
|
|
271
|
+
"closeWatcher",
|
|
272
|
+
"watchChange"
|
|
273
|
+
];
|
|
274
|
+
ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
|
|
275
|
+
"augmentChunkHash",
|
|
276
|
+
"outputOptions",
|
|
277
|
+
"renderChunk",
|
|
278
|
+
"renderStart",
|
|
279
|
+
"renderError",
|
|
280
|
+
"writeBundle",
|
|
281
|
+
"generateBundle"
|
|
282
|
+
];
|
|
283
|
+
ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
284
|
+
...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
|
|
285
|
+
...ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES,
|
|
286
|
+
"footer",
|
|
287
|
+
"banner",
|
|
288
|
+
"intro",
|
|
289
|
+
"outro"
|
|
290
|
+
];
|
|
291
|
+
DEFINED_HOOK_NAMES = {
|
|
292
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
|
|
293
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
|
|
294
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[2]]: ENUMERATED_PLUGIN_HOOK_NAMES[2],
|
|
295
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[3]]: ENUMERATED_PLUGIN_HOOK_NAMES[3],
|
|
296
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[4]]: ENUMERATED_PLUGIN_HOOK_NAMES[4],
|
|
297
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[5]]: ENUMERATED_PLUGIN_HOOK_NAMES[5],
|
|
298
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[6]]: ENUMERATED_PLUGIN_HOOK_NAMES[6],
|
|
299
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[7]]: ENUMERATED_PLUGIN_HOOK_NAMES[7],
|
|
300
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[8]]: ENUMERATED_PLUGIN_HOOK_NAMES[8],
|
|
301
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[9]]: ENUMERATED_PLUGIN_HOOK_NAMES[9],
|
|
302
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[10]]: ENUMERATED_PLUGIN_HOOK_NAMES[10],
|
|
303
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[11]]: ENUMERATED_PLUGIN_HOOK_NAMES[11],
|
|
304
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[12]]: ENUMERATED_PLUGIN_HOOK_NAMES[12],
|
|
305
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[13]]: ENUMERATED_PLUGIN_HOOK_NAMES[13],
|
|
306
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[14]]: ENUMERATED_PLUGIN_HOOK_NAMES[14],
|
|
307
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[15]]: ENUMERATED_PLUGIN_HOOK_NAMES[15],
|
|
308
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[16]]: ENUMERATED_PLUGIN_HOOK_NAMES[16],
|
|
309
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[17]]: ENUMERATED_PLUGIN_HOOK_NAMES[17],
|
|
310
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[18]]: ENUMERATED_PLUGIN_HOOK_NAMES[18],
|
|
311
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[19]]: ENUMERATED_PLUGIN_HOOK_NAMES[19],
|
|
312
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[20]]: ENUMERATED_PLUGIN_HOOK_NAMES[20],
|
|
313
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[21]]: ENUMERATED_PLUGIN_HOOK_NAMES[21],
|
|
314
|
+
[ENUMERATED_PLUGIN_HOOK_NAMES[22]]: ENUMERATED_PLUGIN_HOOK_NAMES[22]
|
|
315
|
+
};
|
|
316
|
+
} });
|
|
324
317
|
|
|
325
318
|
//#endregion
|
|
326
319
|
//#region src/utils/async-flatten.ts
|
|
@@ -330,10 +323,10 @@ async function asyncFlatten(array$1) {
|
|
|
330
323
|
while (array$1.some((v) => v?.then));
|
|
331
324
|
return array$1;
|
|
332
325
|
}
|
|
326
|
+
var init_async_flatten = __esm({ "src/utils/async-flatten.ts"() {} });
|
|
333
327
|
|
|
334
328
|
//#endregion
|
|
335
329
|
//#region src/utils/normalize-plugin-option.ts
|
|
336
|
-
const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
337
330
|
function checkOutputPluginOption(plugins, onLog) {
|
|
338
331
|
for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
|
|
339
332
|
delete plugin[hook];
|
|
@@ -349,66 +342,52 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
349
342
|
}
|
|
350
343
|
return plugins;
|
|
351
344
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
345
|
+
var normalizePluginOption, ANONYMOUS_PLUGIN_PREFIX, ANONYMOUS_OUTPUT_PLUGIN_PREFIX, BUILTIN_PLUGINS;
|
|
346
|
+
var init_normalize_plugin_option = __esm({ "src/utils/normalize-plugin-option.ts"() {
|
|
347
|
+
init_constructors();
|
|
348
|
+
init_plugin$1();
|
|
349
|
+
init_logging();
|
|
350
|
+
init_logs();
|
|
351
|
+
init_async_flatten();
|
|
352
|
+
normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
353
|
+
ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
354
|
+
ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
355
|
+
BUILTIN_PLUGINS = [oxcRuntimePlugin({ resolveBase: fileURLToPath(import.meta.url) })];
|
|
356
|
+
} });
|
|
355
357
|
|
|
356
358
|
//#endregion
|
|
357
359
|
//#region src/plugin/minimal-plugin-context.ts
|
|
358
|
-
var MinimalPluginContextImpl
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
360
|
+
var MinimalPluginContextImpl;
|
|
361
|
+
var init_minimal_plugin_context = __esm({ "src/plugin/minimal-plugin-context.ts"() {
|
|
362
|
+
init_src();
|
|
363
|
+
init_log_handler();
|
|
364
|
+
init_logging();
|
|
365
|
+
init_logs();
|
|
366
|
+
MinimalPluginContextImpl = class {
|
|
367
|
+
info;
|
|
368
|
+
warn;
|
|
369
|
+
debug;
|
|
370
|
+
meta;
|
|
371
|
+
constructor(onLog, logLevel, pluginName, watchMode, hookName) {
|
|
372
|
+
this.pluginName = pluginName;
|
|
373
|
+
this.hookName = hookName;
|
|
374
|
+
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
375
|
+
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
376
|
+
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
377
|
+
this.meta = {
|
|
378
|
+
rollupVersion: "4.23.0",
|
|
379
|
+
rolldownVersion: VERSION,
|
|
380
|
+
watchMode
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
error(e$1) {
|
|
384
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
} });
|
|
379
388
|
|
|
380
389
|
//#endregion
|
|
381
390
|
//#region src/plugin/plugin-driver.ts
|
|
382
|
-
var PluginDriver = class {
|
|
383
|
-
static async callOptionsHook(inputOptions, watchMode = false) {
|
|
384
|
-
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
385
|
-
const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
|
|
386
|
-
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
387
|
-
for (const plugin of plugins) {
|
|
388
|
-
const name = plugin.name || "unknown";
|
|
389
|
-
const options = plugin.options;
|
|
390
|
-
if (options) {
|
|
391
|
-
const { handler } = normalizeHook(options);
|
|
392
|
-
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
393
|
-
if (result) inputOptions = result;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
return inputOptions;
|
|
397
|
-
}
|
|
398
|
-
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
399
|
-
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
400
|
-
for (const plugin of sortedPlugins) {
|
|
401
|
-
const name = plugin.name || "unknown";
|
|
402
|
-
const options = plugin.outputOptions;
|
|
403
|
-
if (options) {
|
|
404
|
-
const { handler } = normalizeHook(options);
|
|
405
|
-
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
406
|
-
if (result) outputOptions = result;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
return outputOptions;
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
391
|
function getObjectPlugins(plugins) {
|
|
413
392
|
return plugins.filter((plugin) => {
|
|
414
393
|
if (!plugin) return void 0;
|
|
@@ -443,10 +422,48 @@ function getSortedPlugins(hookName, plugins) {
|
|
|
443
422
|
...post
|
|
444
423
|
];
|
|
445
424
|
}
|
|
425
|
+
var PluginDriver;
|
|
426
|
+
var init_plugin_driver = __esm({ "src/plugin/plugin-driver.ts"() {
|
|
427
|
+
init_constructors();
|
|
428
|
+
init_logger();
|
|
429
|
+
init_logging();
|
|
430
|
+
init_normalize_hook();
|
|
431
|
+
init_normalize_plugin_option();
|
|
432
|
+
init_minimal_plugin_context();
|
|
433
|
+
PluginDriver = class {
|
|
434
|
+
static async callOptionsHook(inputOptions, watchMode = false) {
|
|
435
|
+
const logLevel = inputOptions.logLevel || LOG_LEVEL_INFO;
|
|
436
|
+
const plugins = getSortedPlugins("options", getObjectPlugins(await normalizePluginOption(inputOptions.plugins)));
|
|
437
|
+
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), logLevel, watchMode);
|
|
438
|
+
for (const plugin of plugins) {
|
|
439
|
+
const name = plugin.name || "unknown";
|
|
440
|
+
const options = plugin.options;
|
|
441
|
+
if (options) {
|
|
442
|
+
const { handler } = normalizeHook(options);
|
|
443
|
+
const result = await handler.call(new MinimalPluginContextImpl(logger, logLevel, name, watchMode, "onLog"), inputOptions);
|
|
444
|
+
if (result) inputOptions = result;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return inputOptions;
|
|
448
|
+
}
|
|
449
|
+
static callOutputOptionsHook(rawPlugins, outputOptions, onLog, logLevel, watchMode) {
|
|
450
|
+
const sortedPlugins = getSortedPlugins("outputOptions", getObjectPlugins(rawPlugins));
|
|
451
|
+
for (const plugin of sortedPlugins) {
|
|
452
|
+
const name = plugin.name || "unknown";
|
|
453
|
+
const options = plugin.outputOptions;
|
|
454
|
+
if (options) {
|
|
455
|
+
const { handler } = normalizeHook(options);
|
|
456
|
+
const result = handler.call(new MinimalPluginContextImpl(onLog, logLevel, name, watchMode), outputOptions);
|
|
457
|
+
if (result) outputOptions = result;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return outputOptions;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
} });
|
|
446
464
|
|
|
447
465
|
//#endregion
|
|
448
466
|
//#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js
|
|
449
|
-
var store$1;
|
|
450
467
|
/* @__NO_SIDE_EFFECTS__ */
|
|
451
468
|
function getGlobalConfig(config2) {
|
|
452
469
|
return {
|
|
@@ -456,17 +473,14 @@ function getGlobalConfig(config2) {
|
|
|
456
473
|
abortPipeEarly: config2?.abortPipeEarly ?? store$1?.abortPipeEarly
|
|
457
474
|
};
|
|
458
475
|
}
|
|
459
|
-
var store2;
|
|
460
476
|
/* @__NO_SIDE_EFFECTS__ */
|
|
461
477
|
function getGlobalMessage(lang) {
|
|
462
478
|
return store2?.get(lang);
|
|
463
479
|
}
|
|
464
|
-
var store3;
|
|
465
480
|
/* @__NO_SIDE_EFFECTS__ */
|
|
466
481
|
function getSchemaMessage(lang) {
|
|
467
482
|
return store3?.get(lang);
|
|
468
483
|
}
|
|
469
|
-
var store4;
|
|
470
484
|
/* @__NO_SIDE_EFFECTS__ */
|
|
471
485
|
function getSpecificMessage(reference, lang) {
|
|
472
486
|
return store4?.get(reference)?.get(lang);
|
|
@@ -524,18 +538,6 @@ function _joinExpects(values2, separator) {
|
|
|
524
538
|
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
525
539
|
return list[0] ?? "never";
|
|
526
540
|
}
|
|
527
|
-
var ValiError = class extends Error {
|
|
528
|
-
/**
|
|
529
|
-
* Creates a Valibot error with useful information.
|
|
530
|
-
*
|
|
531
|
-
* @param issues The error issues.
|
|
532
|
-
*/
|
|
533
|
-
constructor(issues) {
|
|
534
|
-
super(issues[0].message);
|
|
535
|
-
this.name = "ValiError";
|
|
536
|
-
this.issues = issues;
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
541
|
/* @__NO_SIDE_EFFECTS__ */
|
|
540
542
|
function args(schema) {
|
|
541
543
|
return {
|
|
@@ -1432,13 +1434,32 @@ function safeParse(schema, input, config2) {
|
|
|
1432
1434
|
issues: dataset.issues
|
|
1433
1435
|
};
|
|
1434
1436
|
}
|
|
1437
|
+
var store$1, store2, store3, store4, ValiError;
|
|
1438
|
+
var init_dist$3 = __esm({ "../../node_modules/.pnpm/valibot@1.1.0_typescript@5.8.3/node_modules/valibot/dist/index.js"() {
|
|
1439
|
+
ValiError = class extends Error {
|
|
1440
|
+
/**
|
|
1441
|
+
* Creates a Valibot error with useful information.
|
|
1442
|
+
*
|
|
1443
|
+
* @param issues The error issues.
|
|
1444
|
+
*/
|
|
1445
|
+
constructor(issues) {
|
|
1446
|
+
super(issues[0].message);
|
|
1447
|
+
this.name = "ValiError";
|
|
1448
|
+
this.issues = issues;
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
} });
|
|
1435
1452
|
|
|
1436
1453
|
//#endregion
|
|
1437
|
-
//#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1454
|
+
//#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
|
|
1455
|
+
/**
|
|
1456
|
+
* Adds an error message to the errors array.
|
|
1457
|
+
*
|
|
1458
|
+
* @param errors The array of error messages.
|
|
1459
|
+
* @param message The error message to add.
|
|
1460
|
+
*
|
|
1461
|
+
* @returns The new errors.
|
|
1462
|
+
*/
|
|
1442
1463
|
function addError(errors, message) {
|
|
1443
1464
|
if (errors) {
|
|
1444
1465
|
errors.push(message);
|
|
@@ -1446,6 +1467,12 @@ function addError(errors, message) {
|
|
|
1446
1467
|
}
|
|
1447
1468
|
return [message];
|
|
1448
1469
|
}
|
|
1470
|
+
/**
|
|
1471
|
+
* Throws an error or logs a warning based on the configuration.
|
|
1472
|
+
*
|
|
1473
|
+
* @param message The message to throw or log.
|
|
1474
|
+
* @param config The conversion configuration.
|
|
1475
|
+
*/
|
|
1449
1476
|
function handleError(message, config) {
|
|
1450
1477
|
switch (config?.errorMode) {
|
|
1451
1478
|
case "ignore": break;
|
|
@@ -1456,7 +1483,17 @@ function handleError(message, config) {
|
|
|
1456
1483
|
default: throw new Error(message);
|
|
1457
1484
|
}
|
|
1458
1485
|
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Converts any supported Valibot action to the JSON Schema format.
|
|
1488
|
+
*
|
|
1489
|
+
* @param jsonSchema The JSON Schema object.
|
|
1490
|
+
* @param valibotAction The Valibot action object.
|
|
1491
|
+
* @param config The conversion configuration.
|
|
1492
|
+
*
|
|
1493
|
+
* @returns The converted JSON Schema.
|
|
1494
|
+
*/
|
|
1459
1495
|
function convertAction(jsonSchema, valibotAction, config) {
|
|
1496
|
+
if (config?.ignoreActions?.includes(valibotAction.type)) return jsonSchema;
|
|
1460
1497
|
let errors;
|
|
1461
1498
|
switch (valibotAction.type) {
|
|
1462
1499
|
case "base64": {
|
|
@@ -1619,7 +1656,27 @@ function convertAction(jsonSchema, valibotAction, config) {
|
|
|
1619
1656
|
if (errors) for (const message of errors) handleError(message, config);
|
|
1620
1657
|
return jsonSchema;
|
|
1621
1658
|
}
|
|
1622
|
-
|
|
1659
|
+
/**
|
|
1660
|
+
* Flattens a Valibot pipe by recursively expanding nested pipes.
|
|
1661
|
+
*
|
|
1662
|
+
* @param pipe The pipeline to flatten.
|
|
1663
|
+
*
|
|
1664
|
+
* @returns A flat pipeline.
|
|
1665
|
+
*/
|
|
1666
|
+
function flattenPipe(pipe$1) {
|
|
1667
|
+
return pipe$1.flatMap((item) => "pipe" in item ? flattenPipe(item.pipe) : item);
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Converts any supported Valibot schema to the JSON Schema format.
|
|
1671
|
+
*
|
|
1672
|
+
* @param jsonSchema The JSON Schema object.
|
|
1673
|
+
* @param valibotSchema The Valibot schema object.
|
|
1674
|
+
* @param config The conversion configuration.
|
|
1675
|
+
* @param context The conversion context.
|
|
1676
|
+
* @param skipRef Whether to skip using a reference.
|
|
1677
|
+
*
|
|
1678
|
+
* @returns The converted JSON Schema.
|
|
1679
|
+
*/
|
|
1623
1680
|
function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = false) {
|
|
1624
1681
|
if (!skipRef) {
|
|
1625
1682
|
const referenceId = context.referenceMap.get(valibotSchema);
|
|
@@ -1638,10 +1695,20 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
|
|
|
1638
1695
|
}
|
|
1639
1696
|
}
|
|
1640
1697
|
if ("pipe" in valibotSchema) {
|
|
1641
|
-
|
|
1642
|
-
|
|
1698
|
+
const flatPipe = flattenPipe(valibotSchema.pipe);
|
|
1699
|
+
let startIndex = 0;
|
|
1700
|
+
let stopIndex = flatPipe.length - 1;
|
|
1701
|
+
if (config?.typeMode === "input") {
|
|
1702
|
+
const inputStopIndex = flatPipe.slice(1).findIndex((item) => item.kind === "schema" || item.kind === "transformation" && (item.type === "find_item" || item.type === "parse_json" || item.type === "raw_transform" || item.type === "reduce_items" || item.type === "stringify_json" || item.type === "transform"));
|
|
1703
|
+
if (inputStopIndex !== -1) stopIndex = inputStopIndex;
|
|
1704
|
+
} else if (config?.typeMode === "output") {
|
|
1705
|
+
const outputStartIndex = flatPipe.findLastIndex((item) => item.kind === "schema");
|
|
1706
|
+
if (outputStartIndex !== -1) startIndex = outputStartIndex;
|
|
1707
|
+
}
|
|
1708
|
+
for (let index = startIndex; index <= stopIndex; index++) {
|
|
1709
|
+
const valibotPipeItem = flatPipe[index];
|
|
1643
1710
|
if (valibotPipeItem.kind === "schema") {
|
|
1644
|
-
if (index >
|
|
1711
|
+
if (index > startIndex) handleError("Set the \"typeMode\" config to \"input\" or \"output\" to convert pipelines with multiple schemas.", config);
|
|
1645
1712
|
jsonSchema = convertSchema(jsonSchema, valibotPipeItem, config, context, true);
|
|
1646
1713
|
} else jsonSchema = convertAction(jsonSchema, valibotPipeItem, config);
|
|
1647
1714
|
}
|
|
@@ -1760,7 +1827,7 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
|
|
|
1760
1827
|
const refOverride = config.overrideRef({
|
|
1761
1828
|
...context,
|
|
1762
1829
|
referenceId,
|
|
1763
|
-
valibotSchema,
|
|
1830
|
+
valibotSchema: wrappedValibotSchema,
|
|
1764
1831
|
jsonSchema
|
|
1765
1832
|
});
|
|
1766
1833
|
if (refOverride) jsonSchema.$ref = refOverride;
|
|
@@ -1782,6 +1849,24 @@ function convertSchema(jsonSchema, valibotSchema, config, context, skipRef = fal
|
|
|
1782
1849
|
if (errors) for (const message of errors) handleError(message, config);
|
|
1783
1850
|
return jsonSchema;
|
|
1784
1851
|
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Returns the current global schema definitions.
|
|
1854
|
+
*
|
|
1855
|
+
* @returns The schema definitions.
|
|
1856
|
+
*
|
|
1857
|
+
* @beta
|
|
1858
|
+
*/
|
|
1859
|
+
function getGlobalDefs() {
|
|
1860
|
+
return store;
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Converts a Valibot schema to the JSON Schema format.
|
|
1864
|
+
*
|
|
1865
|
+
* @param schema The Valibot schema object.
|
|
1866
|
+
* @param config The JSON Schema configuration.
|
|
1867
|
+
*
|
|
1868
|
+
* @returns The converted JSON Schema.
|
|
1869
|
+
*/
|
|
1785
1870
|
function toJsonSchema(schema, config) {
|
|
1786
1871
|
const context = {
|
|
1787
1872
|
definitions: {},
|
|
@@ -1797,6 +1882,11 @@ function toJsonSchema(schema, config) {
|
|
|
1797
1882
|
if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
|
|
1798
1883
|
return jsonSchema;
|
|
1799
1884
|
}
|
|
1885
|
+
var refCount, store;
|
|
1886
|
+
var init_dist$2 = __esm({ "../../node_modules/.pnpm/@valibot+to-json-schema@1.3.0_valibot@1.1.0_typescript@5.8.3_/node_modules/@valibot/to-json-schema/dist/index.js"() {
|
|
1887
|
+
init_dist$3();
|
|
1888
|
+
refCount = 0;
|
|
1889
|
+
} });
|
|
1800
1890
|
|
|
1801
1891
|
//#endregion
|
|
1802
1892
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.cjs
|
|
@@ -1905,363 +1995,15 @@ var require_ansis = __commonJS({ "../../node_modules/.pnpm/ansis@4.1.0/node_modu
|
|
|
1905
1995
|
|
|
1906
1996
|
//#endregion
|
|
1907
1997
|
//#region ../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs
|
|
1908
|
-
var import_ansis
|
|
1909
|
-
var
|
|
1910
|
-
|
|
1998
|
+
var import_ansis, ansis_default, Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright;
|
|
1999
|
+
var init_ansis = __esm({ "../../node_modules/.pnpm/ansis@4.1.0/node_modules/ansis/index.mjs"() {
|
|
2000
|
+
import_ansis = __toESM(require_ansis(), 1);
|
|
2001
|
+
ansis_default = import_ansis.default;
|
|
2002
|
+
({Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright} = import_ansis.default);
|
|
2003
|
+
} });
|
|
1911
2004
|
|
|
1912
2005
|
//#endregion
|
|
1913
2006
|
//#region src/utils/validator.ts
|
|
1914
|
-
const StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
1915
|
-
const LogLevelSchema = union([
|
|
1916
|
-
literal("debug"),
|
|
1917
|
-
literal("info"),
|
|
1918
|
-
literal("warn")
|
|
1919
|
-
]);
|
|
1920
|
-
const LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
|
|
1921
|
-
const LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
|
|
1922
|
-
const RollupLogSchema = any();
|
|
1923
|
-
const RollupLogWithStringSchema = union([RollupLogSchema, string()]);
|
|
1924
|
-
const InputOptionSchema = union([
|
|
1925
|
-
string(),
|
|
1926
|
-
array(string()),
|
|
1927
|
-
record(string(), string())
|
|
1928
|
-
]);
|
|
1929
|
-
const ExternalSchema = union([
|
|
1930
|
-
StringOrRegExpSchema,
|
|
1931
|
-
array(StringOrRegExpSchema),
|
|
1932
|
-
pipe(function_(), args(tuple([
|
|
1933
|
-
string(),
|
|
1934
|
-
optional(string()),
|
|
1935
|
-
boolean()
|
|
1936
|
-
])), returns(nullish(boolean())))
|
|
1937
|
-
]);
|
|
1938
|
-
const ModuleTypesSchema = record(string(), union([
|
|
1939
|
-
literal("asset"),
|
|
1940
|
-
literal("base64"),
|
|
1941
|
-
literal("binary"),
|
|
1942
|
-
literal("css"),
|
|
1943
|
-
literal("dataurl"),
|
|
1944
|
-
literal("empty"),
|
|
1945
|
-
literal("js"),
|
|
1946
|
-
literal("json"),
|
|
1947
|
-
literal("jsx"),
|
|
1948
|
-
literal("text"),
|
|
1949
|
-
literal("ts"),
|
|
1950
|
-
literal("tsx")
|
|
1951
|
-
]));
|
|
1952
|
-
const JsxOptionsSchema = strictObject({
|
|
1953
|
-
runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
|
|
1954
|
-
development: pipe(optional(boolean()), description("Development specific information")),
|
|
1955
|
-
throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
1956
|
-
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
1957
|
-
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
1958
|
-
pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
1959
|
-
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
1960
|
-
});
|
|
1961
|
-
const RollupJsxOptionsSchema = strictObject({
|
|
1962
|
-
mode: optional(union([
|
|
1963
|
-
literal("classic"),
|
|
1964
|
-
literal("automatic"),
|
|
1965
|
-
literal("preserve")
|
|
1966
|
-
])),
|
|
1967
|
-
factory: optional(string()),
|
|
1968
|
-
fragment: optional(string()),
|
|
1969
|
-
importSource: optional(string()),
|
|
1970
|
-
jsxImportSource: optional(string())
|
|
1971
|
-
});
|
|
1972
|
-
const HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
1973
|
-
const DecoratorOptionSchema = object({
|
|
1974
|
-
legacy: optional(boolean()),
|
|
1975
|
-
emitDecoratorMetadata: optional(boolean())
|
|
1976
|
-
});
|
|
1977
|
-
const HelpersSchema = object({ mode: optional(HelperModeSchema) });
|
|
1978
|
-
const RewriteImportExtensionsSchema = union([
|
|
1979
|
-
literal("rewrite"),
|
|
1980
|
-
literal("remove"),
|
|
1981
|
-
boolean()
|
|
1982
|
-
]);
|
|
1983
|
-
const TypescriptSchema = object({
|
|
1984
|
-
jsxPragma: optional(string()),
|
|
1985
|
-
jsxPragmaFrag: optional(string()),
|
|
1986
|
-
onlyRemoveTypeImports: optional(boolean()),
|
|
1987
|
-
allowNamespaces: optional(boolean()),
|
|
1988
|
-
allowDeclareFields: optional(boolean()),
|
|
1989
|
-
declaration: optional(object({
|
|
1990
|
-
stripInternal: optional(boolean()),
|
|
1991
|
-
sourcemap: optional(boolean())
|
|
1992
|
-
})),
|
|
1993
|
-
rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
|
|
1994
|
-
});
|
|
1995
|
-
const AssumptionsSchema = object({
|
|
1996
|
-
ignoreFunctionLength: optional(boolean()),
|
|
1997
|
-
noDocumentAll: optional(boolean()),
|
|
1998
|
-
objectRestNoSymbols: optional(boolean()),
|
|
1999
|
-
pureGetters: optional(boolean()),
|
|
2000
|
-
setPublicClassFields: optional(boolean())
|
|
2001
|
-
});
|
|
2002
|
-
const TransformOptionsSchema = object({
|
|
2003
|
-
assumptions: optional(AssumptionsSchema),
|
|
2004
|
-
typescript: optional(TypescriptSchema),
|
|
2005
|
-
helpers: optional(HelpersSchema),
|
|
2006
|
-
decorators: optional(DecoratorOptionSchema),
|
|
2007
|
-
jsx: optional(JsxOptionsSchema),
|
|
2008
|
-
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2009
|
-
});
|
|
2010
|
-
const WatchOptionsSchema = strictObject({
|
|
2011
|
-
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
2012
|
-
exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2013
|
-
include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2014
|
-
notify: pipe(optional(strictObject({
|
|
2015
|
-
compareContents: optional(boolean()),
|
|
2016
|
-
pollInterval: optional(number())
|
|
2017
|
-
})), description("Notify options")),
|
|
2018
|
-
skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
|
|
2019
|
-
buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
|
|
2020
|
-
});
|
|
2021
|
-
const ChecksOptionsSchema = strictObject({
|
|
2022
|
-
circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
|
|
2023
|
-
eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
|
|
2024
|
-
missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
|
|
2025
|
-
missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
|
|
2026
|
-
mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
|
|
2027
|
-
unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
|
|
2028
|
-
unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
|
|
2029
|
-
filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
|
|
2030
|
-
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2031
|
-
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2032
|
-
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2033
|
-
});
|
|
2034
|
-
const MinifyOptionsSchema = strictObject({
|
|
2035
|
-
mangle: optional(boolean()),
|
|
2036
|
-
compress: optional(boolean()),
|
|
2037
|
-
removeWhitespace: optional(boolean())
|
|
2038
|
-
});
|
|
2039
|
-
const ResolveOptionsSchema = strictObject({
|
|
2040
|
-
alias: optional(record(string(), union([string(), array(string())]))),
|
|
2041
|
-
aliasFields: optional(array(array(string()))),
|
|
2042
|
-
conditionNames: optional(array(string())),
|
|
2043
|
-
extensionAlias: optional(record(string(), array(string()))),
|
|
2044
|
-
exportsFields: optional(array(array(string()))),
|
|
2045
|
-
extensions: optional(array(string())),
|
|
2046
|
-
mainFields: optional(array(string())),
|
|
2047
|
-
mainFiles: optional(array(string())),
|
|
2048
|
-
modules: optional(array(string())),
|
|
2049
|
-
symlinks: optional(boolean()),
|
|
2050
|
-
tsconfigFilename: optional(string())
|
|
2051
|
-
});
|
|
2052
|
-
const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2053
|
-
annotations: optional(boolean()),
|
|
2054
|
-
manualPureFunctions: optional(array(string())),
|
|
2055
|
-
unknownGlobalSideEffects: optional(boolean())
|
|
2056
|
-
})]);
|
|
2057
|
-
const OnLogSchema = pipe(function_(), args(tuple([
|
|
2058
|
-
LogLevelSchema,
|
|
2059
|
-
RollupLogSchema,
|
|
2060
|
-
pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
2061
|
-
])));
|
|
2062
|
-
const OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2063
|
-
const HmrSchema = union([boolean(), strictObject({
|
|
2064
|
-
port: optional(number()),
|
|
2065
|
-
host: optional(string()),
|
|
2066
|
-
implement: optional(string())
|
|
2067
|
-
})]);
|
|
2068
|
-
const InputOptionsSchema = strictObject({
|
|
2069
|
-
input: optional(InputOptionSchema),
|
|
2070
|
-
plugins: optional(custom(() => true)),
|
|
2071
|
-
external: optional(ExternalSchema),
|
|
2072
|
-
resolve: optional(ResolveOptionsSchema),
|
|
2073
|
-
cwd: pipe(optional(string()), description("Current working directory")),
|
|
2074
|
-
platform: pipe(optional(union([
|
|
2075
|
-
literal("browser"),
|
|
2076
|
-
literal("neutral"),
|
|
2077
|
-
literal("node")
|
|
2078
|
-
])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
|
|
2079
|
-
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2080
|
-
treeshake: optional(TreeshakingOptionsSchema),
|
|
2081
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
|
|
2082
|
-
onLog: optional(OnLogSchema),
|
|
2083
|
-
onwarn: optional(OnwarnSchema),
|
|
2084
|
-
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
2085
|
-
experimental: optional(strictObject({
|
|
2086
|
-
disableLiveBindings: optional(boolean()),
|
|
2087
|
-
enableComposingJsPlugins: optional(boolean()),
|
|
2088
|
-
resolveNewUrlToAsset: optional(boolean()),
|
|
2089
|
-
strictExecutionOrder: optional(boolean()),
|
|
2090
|
-
hmr: optional(HmrSchema),
|
|
2091
|
-
attachDebugInfo: optional(boolean())
|
|
2092
|
-
})),
|
|
2093
|
-
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2094
|
-
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2095
|
-
profilerNames: optional(boolean()),
|
|
2096
|
-
jsx: optional(union([
|
|
2097
|
-
literal(false),
|
|
2098
|
-
literal("react"),
|
|
2099
|
-
literal("react-jsx"),
|
|
2100
|
-
literal("preserve"),
|
|
2101
|
-
RollupJsxOptionsSchema
|
|
2102
|
-
])),
|
|
2103
|
-
transform: optional(TransformOptionsSchema),
|
|
2104
|
-
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2105
|
-
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
2106
|
-
checks: optional(ChecksOptionsSchema),
|
|
2107
|
-
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
2108
|
-
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."))
|
|
2109
|
-
});
|
|
2110
|
-
const InputCliOverrideSchema = strictObject({
|
|
2111
|
-
input: pipe(optional(array(string())), description("Entry file")),
|
|
2112
|
-
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2113
|
-
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2114
|
-
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2115
|
-
jsx: pipe(optional(union([
|
|
2116
|
-
literal(false),
|
|
2117
|
-
literal("react"),
|
|
2118
|
-
literal("react-jsx"),
|
|
2119
|
-
literal("preserve")
|
|
2120
|
-
])), description("Jsx options preset"))
|
|
2121
|
-
});
|
|
2122
|
-
const InputCliOptionsSchema = omit(strictObject({
|
|
2123
|
-
...InputOptionsSchema.entries,
|
|
2124
|
-
...InputCliOverrideSchema.entries
|
|
2125
|
-
}), [
|
|
2126
|
-
"plugins",
|
|
2127
|
-
"onwarn",
|
|
2128
|
-
"onLog",
|
|
2129
|
-
"resolve",
|
|
2130
|
-
"experimental",
|
|
2131
|
-
"profilerNames",
|
|
2132
|
-
"watch"
|
|
2133
|
-
]);
|
|
2134
|
-
const ModuleFormatSchema = union([
|
|
2135
|
-
literal("es"),
|
|
2136
|
-
literal("cjs"),
|
|
2137
|
-
literal("esm"),
|
|
2138
|
-
literal("module"),
|
|
2139
|
-
literal("commonjs"),
|
|
2140
|
-
literal("iife"),
|
|
2141
|
-
literal("umd")
|
|
2142
|
-
]);
|
|
2143
|
-
const AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
2144
|
-
const ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2145
|
-
const AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2146
|
-
const SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2147
|
-
const GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2148
|
-
const AdvancedChunksSchema = strictObject({
|
|
2149
|
-
minSize: optional(number()),
|
|
2150
|
-
maxSize: optional(number()),
|
|
2151
|
-
minModuleSize: optional(number()),
|
|
2152
|
-
maxModuleSize: optional(number()),
|
|
2153
|
-
minShareCount: optional(number()),
|
|
2154
|
-
groups: optional(array(strictObject({
|
|
2155
|
-
name: string(),
|
|
2156
|
-
test: optional(union([
|
|
2157
|
-
string(),
|
|
2158
|
-
instance(RegExp),
|
|
2159
|
-
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
2160
|
-
])),
|
|
2161
|
-
priority: optional(number()),
|
|
2162
|
-
minSize: optional(number()),
|
|
2163
|
-
minShareCount: optional(number()),
|
|
2164
|
-
maxSize: optional(number()),
|
|
2165
|
-
minModuleSize: optional(number()),
|
|
2166
|
-
maxModuleSize: optional(number())
|
|
2167
|
-
})))
|
|
2168
|
-
});
|
|
2169
|
-
const OutputOptionsSchema = strictObject({
|
|
2170
|
-
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2171
|
-
file: pipe(optional(string()), description("Single output file")),
|
|
2172
|
-
exports: pipe(optional(union([
|
|
2173
|
-
literal("auto"),
|
|
2174
|
-
literal("named"),
|
|
2175
|
-
literal("default"),
|
|
2176
|
-
literal("none")
|
|
2177
|
-
])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
|
|
2178
|
-
hashCharacters: pipe(optional(union([
|
|
2179
|
-
literal("base64"),
|
|
2180
|
-
literal("base36"),
|
|
2181
|
-
literal("hex")
|
|
2182
|
-
])), description("Use the specified character set for file hashes")),
|
|
2183
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
|
|
2184
|
-
sourcemap: pipe(optional(union([
|
|
2185
|
-
boolean(),
|
|
2186
|
-
literal("inline"),
|
|
2187
|
-
literal("hidden")
|
|
2188
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2189
|
-
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2190
|
-
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
2191
|
-
sourcemapPathTransform: optional(custom(() => true)),
|
|
2192
|
-
banner: optional(union([string(), AddonFunctionSchema])),
|
|
2193
|
-
footer: optional(union([string(), AddonFunctionSchema])),
|
|
2194
|
-
intro: optional(union([string(), AddonFunctionSchema])),
|
|
2195
|
-
outro: optional(union([string(), AddonFunctionSchema])),
|
|
2196
|
-
extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2197
|
-
esModule: optional(union([boolean(), literal("if-default-prop")])),
|
|
2198
|
-
assetFileNames: optional(AssetFileNamesSchema),
|
|
2199
|
-
entryFileNames: optional(ChunkFileNamesSchema),
|
|
2200
|
-
chunkFileNames: optional(ChunkFileNamesSchema),
|
|
2201
|
-
cssEntryFileNames: optional(ChunkFileNamesSchema),
|
|
2202
|
-
cssChunkFileNames: optional(ChunkFileNamesSchema),
|
|
2203
|
-
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2204
|
-
minify: pipe(optional(union([
|
|
2205
|
-
boolean(),
|
|
2206
|
-
string("dce-only"),
|
|
2207
|
-
MinifyOptionsSchema
|
|
2208
|
-
])), description("Minify the bundled file")),
|
|
2209
|
-
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2210
|
-
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2211
|
-
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2212
|
-
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2213
|
-
manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
|
|
2214
|
-
advancedChunks: optional(AdvancedChunksSchema),
|
|
2215
|
-
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2216
|
-
plugins: optional(custom(() => true)),
|
|
2217
|
-
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2218
|
-
hoistTransitiveImports: optional(custom((input) => {
|
|
2219
|
-
if (input) return false;
|
|
2220
|
-
return true;
|
|
2221
|
-
}, () => `The 'true' value is not supported`)),
|
|
2222
|
-
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2223
|
-
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2224
|
-
virtualDirname: optional(string())
|
|
2225
|
-
});
|
|
2226
|
-
const getAddonDescription = (placement, wrapper) => {
|
|
2227
|
-
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
2228
|
-
};
|
|
2229
|
-
const OutputCliOverrideSchema = strictObject({
|
|
2230
|
-
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
2231
|
-
entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
|
|
2232
|
-
chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
|
|
2233
|
-
cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
|
|
2234
|
-
cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
|
|
2235
|
-
sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
|
|
2236
|
-
banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
|
|
2237
|
-
footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
|
|
2238
|
-
intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
|
|
2239
|
-
outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
|
|
2240
|
-
esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2241
|
-
globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2242
|
-
advancedChunks: pipe(optional(strictObject({
|
|
2243
|
-
minSize: pipe(optional(number()), description("Minimum size of the chunk")),
|
|
2244
|
-
minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
|
|
2245
|
-
})), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2246
|
-
minify: pipe(optional(boolean()), description("Minify the bundled file"))
|
|
2247
|
-
});
|
|
2248
|
-
const OutputCliOptionsSchema = omit(strictObject({
|
|
2249
|
-
...OutputOptionsSchema.entries,
|
|
2250
|
-
...OutputCliOverrideSchema.entries
|
|
2251
|
-
}), [
|
|
2252
|
-
"sourcemapIgnoreList",
|
|
2253
|
-
"sourcemapPathTransform",
|
|
2254
|
-
"plugins",
|
|
2255
|
-
"hoistTransitiveImports"
|
|
2256
|
-
]);
|
|
2257
|
-
const CliOptionsSchema = strictObject({
|
|
2258
|
-
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2259
|
-
help: pipe(optional(boolean()), description("Show help")),
|
|
2260
|
-
version: pipe(optional(boolean()), description("Show version number")),
|
|
2261
|
-
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2262
|
-
...InputCliOptionsSchema.entries,
|
|
2263
|
-
...OutputCliOptionsSchema.entries
|
|
2264
|
-
});
|
|
2265
2007
|
function validateCliOptions(options) {
|
|
2266
2008
|
let parsed = safeParse(CliOptionsSchema, options);
|
|
2267
2009
|
return [parsed.output, parsed.issues?.map((issue) => {
|
|
@@ -2269,8 +2011,6 @@ function validateCliOptions(options) {
|
|
|
2269
2011
|
return `Invalid value for option ${option}: ${issue.message}`;
|
|
2270
2012
|
})];
|
|
2271
2013
|
}
|
|
2272
|
-
const inputHelperMsgRecord = { output: { ignored: true } };
|
|
2273
|
-
const outputHelperMsgRecord = {};
|
|
2274
2014
|
function validateOption(key, options) {
|
|
2275
2015
|
if (globalThis.process?.env?.ROLLUP_TEST) return;
|
|
2276
2016
|
let parsed = safeParse(key === "input" ? InputOptionsSchema : OutputOptionsSchema, options);
|
|
@@ -2302,38 +2042,397 @@ function getOutputCliKeys() {
|
|
|
2302
2042
|
function getJsonSchema() {
|
|
2303
2043
|
return toJsonSchema(CliOptionsSchema, { errorMode: "ignore" });
|
|
2304
2044
|
}
|
|
2045
|
+
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;
|
|
2046
|
+
var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
2047
|
+
init_dist$2();
|
|
2048
|
+
init_ansis();
|
|
2049
|
+
init_dist$3();
|
|
2050
|
+
StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
2051
|
+
LogLevelSchema = union([
|
|
2052
|
+
literal("debug"),
|
|
2053
|
+
literal("info"),
|
|
2054
|
+
literal("warn")
|
|
2055
|
+
]);
|
|
2056
|
+
LogLevelOptionSchema = union([LogLevelSchema, literal("silent")]);
|
|
2057
|
+
LogLevelWithErrorSchema = union([LogLevelSchema, literal("error")]);
|
|
2058
|
+
RollupLogSchema = any();
|
|
2059
|
+
RollupLogWithStringSchema = union([RollupLogSchema, string()]);
|
|
2060
|
+
InputOptionSchema = union([
|
|
2061
|
+
string(),
|
|
2062
|
+
array(string()),
|
|
2063
|
+
record(string(), string())
|
|
2064
|
+
]);
|
|
2065
|
+
ExternalSchema = union([
|
|
2066
|
+
StringOrRegExpSchema,
|
|
2067
|
+
array(StringOrRegExpSchema),
|
|
2068
|
+
pipe(function_(), args(tuple([
|
|
2069
|
+
string(),
|
|
2070
|
+
optional(string()),
|
|
2071
|
+
boolean()
|
|
2072
|
+
])), returns(nullish(boolean())))
|
|
2073
|
+
]);
|
|
2074
|
+
ModuleTypesSchema = record(string(), union([
|
|
2075
|
+
literal("asset"),
|
|
2076
|
+
literal("base64"),
|
|
2077
|
+
literal("binary"),
|
|
2078
|
+
literal("css"),
|
|
2079
|
+
literal("dataurl"),
|
|
2080
|
+
literal("empty"),
|
|
2081
|
+
literal("js"),
|
|
2082
|
+
literal("json"),
|
|
2083
|
+
literal("jsx"),
|
|
2084
|
+
literal("text"),
|
|
2085
|
+
literal("ts"),
|
|
2086
|
+
literal("tsx")
|
|
2087
|
+
]));
|
|
2088
|
+
JsxOptionsSchema = strictObject({
|
|
2089
|
+
runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
|
|
2090
|
+
development: pipe(optional(boolean()), description("Development specific information")),
|
|
2091
|
+
throwIfNamespace: pipe(optional(string()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
2092
|
+
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
2093
|
+
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
2094
|
+
pragmaFlag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
2095
|
+
refresh: pipe(optional(boolean()), description("Enable react fast refresh"))
|
|
2096
|
+
});
|
|
2097
|
+
RollupJsxOptionsSchema = strictObject({
|
|
2098
|
+
mode: optional(union([
|
|
2099
|
+
literal("classic"),
|
|
2100
|
+
literal("automatic"),
|
|
2101
|
+
literal("preserve")
|
|
2102
|
+
])),
|
|
2103
|
+
factory: optional(string()),
|
|
2104
|
+
fragment: optional(string()),
|
|
2105
|
+
importSource: optional(string()),
|
|
2106
|
+
jsxImportSource: optional(string())
|
|
2107
|
+
});
|
|
2108
|
+
HelperModeSchema = union([literal("Runtime"), literal("External")]);
|
|
2109
|
+
DecoratorOptionSchema = object({
|
|
2110
|
+
legacy: optional(boolean()),
|
|
2111
|
+
emitDecoratorMetadata: optional(boolean())
|
|
2112
|
+
});
|
|
2113
|
+
HelpersSchema = object({ mode: optional(HelperModeSchema) });
|
|
2114
|
+
RewriteImportExtensionsSchema = union([
|
|
2115
|
+
literal("rewrite"),
|
|
2116
|
+
literal("remove"),
|
|
2117
|
+
boolean()
|
|
2118
|
+
]);
|
|
2119
|
+
TypescriptSchema = object({
|
|
2120
|
+
jsxPragma: optional(string()),
|
|
2121
|
+
jsxPragmaFrag: optional(string()),
|
|
2122
|
+
onlyRemoveTypeImports: optional(boolean()),
|
|
2123
|
+
allowNamespaces: optional(boolean()),
|
|
2124
|
+
allowDeclareFields: optional(boolean()),
|
|
2125
|
+
declaration: optional(object({
|
|
2126
|
+
stripInternal: optional(boolean()),
|
|
2127
|
+
sourcemap: optional(boolean())
|
|
2128
|
+
})),
|
|
2129
|
+
rewriteImportExtensions: optional(RewriteImportExtensionsSchema)
|
|
2130
|
+
});
|
|
2131
|
+
AssumptionsSchema = object({
|
|
2132
|
+
ignoreFunctionLength: optional(boolean()),
|
|
2133
|
+
noDocumentAll: optional(boolean()),
|
|
2134
|
+
objectRestNoSymbols: optional(boolean()),
|
|
2135
|
+
pureGetters: optional(boolean()),
|
|
2136
|
+
setPublicClassFields: optional(boolean())
|
|
2137
|
+
});
|
|
2138
|
+
TransformOptionsSchema = object({
|
|
2139
|
+
assumptions: optional(AssumptionsSchema),
|
|
2140
|
+
typescript: optional(TypescriptSchema),
|
|
2141
|
+
helpers: optional(HelpersSchema),
|
|
2142
|
+
decorators: optional(DecoratorOptionSchema),
|
|
2143
|
+
jsx: optional(JsxOptionsSchema),
|
|
2144
|
+
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment"))
|
|
2145
|
+
});
|
|
2146
|
+
WatchOptionsSchema = strictObject({
|
|
2147
|
+
chokidar: optional(never(`The "watch.chokidar" option is deprecated, please use "watch.notify" instead of it`)),
|
|
2148
|
+
exclude: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2149
|
+
include: optional(union([StringOrRegExpSchema, array(StringOrRegExpSchema)])),
|
|
2150
|
+
notify: pipe(optional(strictObject({
|
|
2151
|
+
compareContents: optional(boolean()),
|
|
2152
|
+
pollInterval: optional(number())
|
|
2153
|
+
})), description("Notify options")),
|
|
2154
|
+
skipWrite: pipe(optional(boolean()), description("Skip the bundle.write() step")),
|
|
2155
|
+
buildDelay: pipe(optional(number()), description("Throttle watch rebuilds"))
|
|
2156
|
+
});
|
|
2157
|
+
ChecksOptionsSchema = strictObject({
|
|
2158
|
+
circularDependency: pipe(optional(boolean()), description("Whether to emit warning when detecting circular dependency")),
|
|
2159
|
+
eval: pipe(optional(boolean()), description("Whether to emit warning when detecting eval")),
|
|
2160
|
+
missingGlobalName: pipe(optional(boolean()), description("Whether to emit warning when detecting missing global name")),
|
|
2161
|
+
missingNameOptionForIifeExport: pipe(optional(boolean()), description("Whether to emit warning when detecting missing name option for iife export")),
|
|
2162
|
+
mixedExport: pipe(optional(boolean()), description("Whether to emit warning when detecting mixed export")),
|
|
2163
|
+
unresolvedEntry: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved entry")),
|
|
2164
|
+
unresolvedImport: pipe(optional(boolean()), description("Whether to emit warning when detecting unresolved import")),
|
|
2165
|
+
filenameConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting filename conflict")),
|
|
2166
|
+
commonJsVariableInEsm: pipe(optional(boolean()), description("Whether to emit warning when detecting common js variable in esm")),
|
|
2167
|
+
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
2168
|
+
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict"))
|
|
2169
|
+
});
|
|
2170
|
+
MinifyOptionsSchema = strictObject({
|
|
2171
|
+
mangle: optional(boolean()),
|
|
2172
|
+
compress: optional(boolean()),
|
|
2173
|
+
removeWhitespace: optional(boolean())
|
|
2174
|
+
});
|
|
2175
|
+
ResolveOptionsSchema = strictObject({
|
|
2176
|
+
alias: optional(record(string(), union([string(), array(string())]))),
|
|
2177
|
+
aliasFields: optional(array(array(string()))),
|
|
2178
|
+
conditionNames: optional(array(string())),
|
|
2179
|
+
extensionAlias: optional(record(string(), array(string()))),
|
|
2180
|
+
exportsFields: optional(array(array(string()))),
|
|
2181
|
+
extensions: optional(array(string())),
|
|
2182
|
+
mainFields: optional(array(string())),
|
|
2183
|
+
mainFiles: optional(array(string())),
|
|
2184
|
+
modules: optional(array(string())),
|
|
2185
|
+
symlinks: optional(boolean()),
|
|
2186
|
+
tsconfigFilename: optional(string())
|
|
2187
|
+
});
|
|
2188
|
+
TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
2189
|
+
annotations: optional(boolean()),
|
|
2190
|
+
manualPureFunctions: optional(array(string())),
|
|
2191
|
+
unknownGlobalSideEffects: optional(boolean())
|
|
2192
|
+
})]);
|
|
2193
|
+
OnLogSchema = pipe(function_(), args(tuple([
|
|
2194
|
+
LogLevelSchema,
|
|
2195
|
+
RollupLogSchema,
|
|
2196
|
+
pipe(function_(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])))
|
|
2197
|
+
])));
|
|
2198
|
+
OnwarnSchema = pipe(function_(), args(tuple([RollupLogSchema, pipe(function_(), args(tuple([union([RollupLogWithStringSchema, pipe(function_(), returns(RollupLogWithStringSchema))])])))])));
|
|
2199
|
+
HmrSchema = union([boolean(), strictObject({
|
|
2200
|
+
port: optional(number()),
|
|
2201
|
+
host: optional(string()),
|
|
2202
|
+
implement: optional(string())
|
|
2203
|
+
})]);
|
|
2204
|
+
InputOptionsSchema = strictObject({
|
|
2205
|
+
input: optional(InputOptionSchema),
|
|
2206
|
+
plugins: optional(custom(() => true)),
|
|
2207
|
+
external: optional(ExternalSchema),
|
|
2208
|
+
resolve: optional(ResolveOptionsSchema),
|
|
2209
|
+
cwd: pipe(optional(string()), description("Current working directory")),
|
|
2210
|
+
platform: pipe(optional(union([
|
|
2211
|
+
literal("browser"),
|
|
2212
|
+
literal("neutral"),
|
|
2213
|
+
literal("node")
|
|
2214
|
+
])), description(`Platform for which the code should be generated (node, ${ansis_default.underline("browser")}, neutral)`)),
|
|
2215
|
+
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
2216
|
+
treeshake: optional(TreeshakingOptionsSchema),
|
|
2217
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${ansis_default.dim("silent")}, ${ansis_default.underline(ansis_default.gray("info"))}, debug, ${ansis_default.yellow("warn")})`)),
|
|
2218
|
+
onLog: optional(OnLogSchema),
|
|
2219
|
+
onwarn: optional(OnwarnSchema),
|
|
2220
|
+
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
2221
|
+
experimental: optional(strictObject({
|
|
2222
|
+
disableLiveBindings: optional(boolean()),
|
|
2223
|
+
enableComposingJsPlugins: optional(boolean()),
|
|
2224
|
+
resolveNewUrlToAsset: optional(boolean()),
|
|
2225
|
+
strictExecutionOrder: optional(boolean()),
|
|
2226
|
+
hmr: optional(HmrSchema),
|
|
2227
|
+
attachDebugInfo: optional(boolean())
|
|
2228
|
+
})),
|
|
2229
|
+
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
2230
|
+
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
2231
|
+
profilerNames: optional(boolean()),
|
|
2232
|
+
jsx: optional(union([
|
|
2233
|
+
literal(false),
|
|
2234
|
+
literal("react"),
|
|
2235
|
+
literal("react-jsx"),
|
|
2236
|
+
literal("preserve"),
|
|
2237
|
+
RollupJsxOptionsSchema
|
|
2238
|
+
])),
|
|
2239
|
+
transform: optional(TransformOptionsSchema),
|
|
2240
|
+
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
2241
|
+
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
2242
|
+
checks: optional(ChecksOptionsSchema),
|
|
2243
|
+
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
2244
|
+
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."))
|
|
2245
|
+
});
|
|
2246
|
+
InputCliOverrideSchema = strictObject({
|
|
2247
|
+
input: pipe(optional(array(string())), description("Entry file")),
|
|
2248
|
+
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
2249
|
+
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
2250
|
+
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
2251
|
+
jsx: pipe(optional(union([
|
|
2252
|
+
literal(false),
|
|
2253
|
+
literal("react"),
|
|
2254
|
+
literal("react-jsx"),
|
|
2255
|
+
literal("preserve")
|
|
2256
|
+
])), description("Jsx options preset"))
|
|
2257
|
+
});
|
|
2258
|
+
InputCliOptionsSchema = omit(strictObject({
|
|
2259
|
+
...InputOptionsSchema.entries,
|
|
2260
|
+
...InputCliOverrideSchema.entries
|
|
2261
|
+
}), [
|
|
2262
|
+
"plugins",
|
|
2263
|
+
"onwarn",
|
|
2264
|
+
"onLog",
|
|
2265
|
+
"resolve",
|
|
2266
|
+
"experimental",
|
|
2267
|
+
"profilerNames",
|
|
2268
|
+
"watch"
|
|
2269
|
+
]);
|
|
2270
|
+
ModuleFormatSchema = union([
|
|
2271
|
+
literal("es"),
|
|
2272
|
+
literal("cjs"),
|
|
2273
|
+
literal("esm"),
|
|
2274
|
+
literal("module"),
|
|
2275
|
+
literal("commonjs"),
|
|
2276
|
+
literal("iife"),
|
|
2277
|
+
literal("umd")
|
|
2278
|
+
]);
|
|
2279
|
+
AddonFunctionSchema = pipe(function_(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
2280
|
+
ChunkFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2281
|
+
AssetFileNamesSchema = union([string(), pipe(function_(), args(tuple([custom(() => true)])), returns(string()))]);
|
|
2282
|
+
SanitizeFileNameSchema = union([boolean(), pipe(function_(), args(tuple([string()])), returns(string()))]);
|
|
2283
|
+
GlobalsFunctionSchema = pipe(function_(), args(tuple([string()])), returns(string()));
|
|
2284
|
+
AdvancedChunksSchema = strictObject({
|
|
2285
|
+
minSize: optional(number()),
|
|
2286
|
+
maxSize: optional(number()),
|
|
2287
|
+
minModuleSize: optional(number()),
|
|
2288
|
+
maxModuleSize: optional(number()),
|
|
2289
|
+
minShareCount: optional(number()),
|
|
2290
|
+
groups: optional(array(strictObject({
|
|
2291
|
+
name: string(),
|
|
2292
|
+
test: optional(union([
|
|
2293
|
+
string(),
|
|
2294
|
+
instance(RegExp),
|
|
2295
|
+
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
2296
|
+
])),
|
|
2297
|
+
priority: optional(number()),
|
|
2298
|
+
minSize: optional(number()),
|
|
2299
|
+
minShareCount: optional(number()),
|
|
2300
|
+
maxSize: optional(number()),
|
|
2301
|
+
minModuleSize: optional(number()),
|
|
2302
|
+
maxModuleSize: optional(number())
|
|
2303
|
+
})))
|
|
2304
|
+
});
|
|
2305
|
+
OutputOptionsSchema = strictObject({
|
|
2306
|
+
dir: pipe(optional(string()), description("Output directory, defaults to `dist` if `file` is not set")),
|
|
2307
|
+
file: pipe(optional(string()), description("Single output file")),
|
|
2308
|
+
exports: pipe(optional(union([
|
|
2309
|
+
literal("auto"),
|
|
2310
|
+
literal("named"),
|
|
2311
|
+
literal("default"),
|
|
2312
|
+
literal("none")
|
|
2313
|
+
])), description(`Specify a export mode (${ansis_default.underline("auto")}, named, default, none)`)),
|
|
2314
|
+
hashCharacters: pipe(optional(union([
|
|
2315
|
+
literal("base64"),
|
|
2316
|
+
literal("base36"),
|
|
2317
|
+
literal("hex")
|
|
2318
|
+
])), description("Use the specified character set for file hashes")),
|
|
2319
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${ansis_default.underline("esm")}, cjs, and iife)`)),
|
|
2320
|
+
sourcemap: pipe(optional(union([
|
|
2321
|
+
boolean(),
|
|
2322
|
+
literal("inline"),
|
|
2323
|
+
literal("hidden")
|
|
2324
|
+
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${ansis_default.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2325
|
+
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2326
|
+
sourcemapIgnoreList: optional(union([boolean(), custom(() => true)])),
|
|
2327
|
+
sourcemapPathTransform: optional(custom(() => true)),
|
|
2328
|
+
banner: optional(union([string(), AddonFunctionSchema])),
|
|
2329
|
+
footer: optional(union([string(), AddonFunctionSchema])),
|
|
2330
|
+
intro: optional(union([string(), AddonFunctionSchema])),
|
|
2331
|
+
outro: optional(union([string(), AddonFunctionSchema])),
|
|
2332
|
+
extend: pipe(optional(boolean()), description("Extend global variable defined by name in IIFE / UMD formats")),
|
|
2333
|
+
esModule: optional(union([boolean(), literal("if-default-prop")])),
|
|
2334
|
+
assetFileNames: optional(AssetFileNamesSchema),
|
|
2335
|
+
entryFileNames: optional(ChunkFileNamesSchema),
|
|
2336
|
+
chunkFileNames: optional(ChunkFileNamesSchema),
|
|
2337
|
+
cssEntryFileNames: optional(ChunkFileNamesSchema),
|
|
2338
|
+
cssChunkFileNames: optional(ChunkFileNamesSchema),
|
|
2339
|
+
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
2340
|
+
minify: pipe(optional(union([
|
|
2341
|
+
boolean(),
|
|
2342
|
+
string("dce-only"),
|
|
2343
|
+
MinifyOptionsSchema
|
|
2344
|
+
])), description("Minify the bundled file")),
|
|
2345
|
+
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
2346
|
+
globals: pipe(optional(union([record(string(), string()), GlobalsFunctionSchema])), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2347
|
+
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2348
|
+
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2349
|
+
manualChunks: optional(never("manualChunks is not supported. Please use advancedChunks instead")),
|
|
2350
|
+
advancedChunks: optional(AdvancedChunksSchema),
|
|
2351
|
+
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2352
|
+
plugins: optional(custom(() => true)),
|
|
2353
|
+
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2354
|
+
hoistTransitiveImports: optional(custom((input) => {
|
|
2355
|
+
if (input) return false;
|
|
2356
|
+
return true;
|
|
2357
|
+
}, () => `The 'true' value is not supported`)),
|
|
2358
|
+
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2359
|
+
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2360
|
+
virtualDirname: optional(string())
|
|
2361
|
+
});
|
|
2362
|
+
getAddonDescription = (placement, wrapper) => {
|
|
2363
|
+
return `Code to insert the ${ansis_default.bold(placement)} of the bundled file (${ansis_default.bold(wrapper)} the wrapper function)`;
|
|
2364
|
+
};
|
|
2365
|
+
OutputCliOverrideSchema = strictObject({
|
|
2366
|
+
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
2367
|
+
entryFileNames: pipe(optional(string()), description("Name pattern for emitted entry chunks")),
|
|
2368
|
+
chunkFileNames: pipe(optional(string()), description("Name pattern for emitted secondary chunks")),
|
|
2369
|
+
cssEntryFileNames: pipe(optional(string()), description("Name pattern for emitted css entry chunks")),
|
|
2370
|
+
cssChunkFileNames: pipe(optional(string()), description("Name pattern for emitted css secondary chunks")),
|
|
2371
|
+
sanitizeFileName: pipe(optional(boolean()), description("Sanitize file name")),
|
|
2372
|
+
banner: pipe(optional(string()), description(getAddonDescription("top", "outside"))),
|
|
2373
|
+
footer: pipe(optional(string()), description(getAddonDescription("bottom", "outside"))),
|
|
2374
|
+
intro: pipe(optional(string()), description(getAddonDescription("top", "inside"))),
|
|
2375
|
+
outro: pipe(optional(string()), description(getAddonDescription("bottom", "inside"))),
|
|
2376
|
+
esModule: pipe(optional(boolean()), description("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)")),
|
|
2377
|
+
globals: pipe(optional(record(string(), string())), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2378
|
+
advancedChunks: pipe(optional(strictObject({
|
|
2379
|
+
minSize: pipe(optional(number()), description("Minimum size of the chunk")),
|
|
2380
|
+
minShareCount: pipe(optional(number()), description("Minimum share count of the chunk"))
|
|
2381
|
+
})), description("Global variable of UMD / IIFE dependencies (syntax: `key=value`)")),
|
|
2382
|
+
minify: pipe(optional(boolean()), description("Minify the bundled file"))
|
|
2383
|
+
});
|
|
2384
|
+
OutputCliOptionsSchema = omit(strictObject({
|
|
2385
|
+
...OutputOptionsSchema.entries,
|
|
2386
|
+
...OutputCliOverrideSchema.entries
|
|
2387
|
+
}), [
|
|
2388
|
+
"sourcemapIgnoreList",
|
|
2389
|
+
"sourcemapPathTransform",
|
|
2390
|
+
"plugins",
|
|
2391
|
+
"hoistTransitiveImports"
|
|
2392
|
+
]);
|
|
2393
|
+
CliOptionsSchema = strictObject({
|
|
2394
|
+
config: pipe(optional(union([string(), boolean()])), description("Path to the config file (default: `rolldown.config.js`)")),
|
|
2395
|
+
help: pipe(optional(boolean()), description("Show help")),
|
|
2396
|
+
version: pipe(optional(boolean()), description("Show version number")),
|
|
2397
|
+
watch: pipe(optional(boolean()), description("Watch files in bundle and rebuild on changes")),
|
|
2398
|
+
...InputCliOptionsSchema.entries,
|
|
2399
|
+
...OutputCliOptionsSchema.entries
|
|
2400
|
+
});
|
|
2401
|
+
inputHelperMsgRecord = { output: { ignored: true } };
|
|
2402
|
+
outputHelperMsgRecord = {};
|
|
2403
|
+
} });
|
|
2305
2404
|
|
|
2306
2405
|
//#endregion
|
|
2307
2406
|
//#region src/constants/plugin-context.ts
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
* internally.
|
|
2313
|
-
*/
|
|
2314
|
-
const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
2407
|
+
var SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF;
|
|
2408
|
+
var init_plugin_context$1 = __esm({ "src/constants/plugin-context.ts"() {
|
|
2409
|
+
SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
2410
|
+
} });
|
|
2315
2411
|
|
|
2316
2412
|
//#endregion
|
|
2317
2413
|
//#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
|
-
|
|
2414
|
+
var NormalizedInputOptionsImpl;
|
|
2415
|
+
var init_normalized_input_options = __esm({ "src/options/normalized-input-options.ts"() {
|
|
2416
|
+
NormalizedInputOptionsImpl = class {
|
|
2417
|
+
inner;
|
|
2418
|
+
constructor(inner, onLog) {
|
|
2419
|
+
this.onLog = onLog;
|
|
2420
|
+
this.inner = inner;
|
|
2421
|
+
}
|
|
2422
|
+
get shimMissingExports() {
|
|
2423
|
+
return this.inner.shimMissingExports;
|
|
2424
|
+
}
|
|
2425
|
+
get input() {
|
|
2426
|
+
return this.inner.input;
|
|
2427
|
+
}
|
|
2428
|
+
get cwd() {
|
|
2429
|
+
return this.inner.cwd ?? void 0;
|
|
2430
|
+
}
|
|
2431
|
+
get platform() {
|
|
2432
|
+
return this.inner.platform;
|
|
2433
|
+
}
|
|
2434
|
+
};
|
|
2435
|
+
} });
|
|
2337
2436
|
|
|
2338
2437
|
//#endregion
|
|
2339
2438
|
//#region src/types/sourcemap.ts
|
|
@@ -2350,6 +2449,7 @@ function bindingifySourcemap(map) {
|
|
|
2350
2449
|
debugId: "debugId" in map ? map.debugId : void 0
|
|
2351
2450
|
} };
|
|
2352
2451
|
}
|
|
2452
|
+
var init_sourcemap = __esm({ "src/types/sourcemap.ts"() {} });
|
|
2353
2453
|
|
|
2354
2454
|
//#endregion
|
|
2355
2455
|
//#region src/utils/error.ts
|
|
@@ -2400,6 +2500,7 @@ function getErrorMessage(e$1) {
|
|
|
2400
2500
|
function joinNewLine(s1, s2) {
|
|
2401
2501
|
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
2402
2502
|
}
|
|
2503
|
+
var init_error = __esm({ "src/utils/error.ts"() {} });
|
|
2403
2504
|
|
|
2404
2505
|
//#endregion
|
|
2405
2506
|
//#region src/utils/transform-module-info.ts
|
|
@@ -2421,6 +2522,9 @@ function transformModuleInfo(info, option) {
|
|
|
2421
2522
|
...option
|
|
2422
2523
|
};
|
|
2423
2524
|
}
|
|
2525
|
+
var init_transform_module_info = __esm({ "src/utils/transform-module-info.ts"() {
|
|
2526
|
+
init_misc();
|
|
2527
|
+
} });
|
|
2424
2528
|
|
|
2425
2529
|
//#endregion
|
|
2426
2530
|
//#region src/utils/transform-side-effects.ts
|
|
@@ -2434,6 +2538,7 @@ function bindingifySideEffects(sideEffects) {
|
|
|
2434
2538
|
default: throw new Error(`Unexpected side effects: ${sideEffects}`);
|
|
2435
2539
|
}
|
|
2436
2540
|
}
|
|
2541
|
+
var init_transform_side_effects = __esm({ "src/utils/transform-side-effects.ts"() {} });
|
|
2437
2542
|
|
|
2438
2543
|
//#endregion
|
|
2439
2544
|
//#region src/utils/transform-sourcemap.ts
|
|
@@ -2449,9 +2554,10 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
|
2449
2554
|
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
|
|
2450
2555
|
return map;
|
|
2451
2556
|
}
|
|
2557
|
+
var init_transform_sourcemap = __esm({ "src/utils/transform-sourcemap.ts"() {} });
|
|
2452
2558
|
|
|
2453
2559
|
//#endregion
|
|
2454
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2560
|
+
//#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js
|
|
2455
2561
|
function u$1(o$1, n$1, a$2) {
|
|
2456
2562
|
let t$2 = (r$1) => o$1(r$1, ...n$1);
|
|
2457
2563
|
return a$2 === void 0 ? t$2 : Object.assign(t$2, {
|
|
@@ -2459,32 +2565,50 @@ function u$1(o$1, n$1, a$2) {
|
|
|
2459
2565
|
lazyArgs: n$1
|
|
2460
2566
|
});
|
|
2461
2567
|
}
|
|
2568
|
+
var init_chunk_D6FCK2GA = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-D6FCK2GA.js"() {} });
|
|
2462
2569
|
|
|
2463
2570
|
//#endregion
|
|
2464
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2571
|
+
//#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js
|
|
2465
2572
|
function u(r$1, n$1, o$1) {
|
|
2466
2573
|
let a$2 = r$1.length - n$1.length;
|
|
2467
2574
|
if (a$2 === 0) return r$1(...n$1);
|
|
2468
2575
|
if (a$2 === 1) return u$1(r$1, n$1, o$1);
|
|
2469
2576
|
throw new Error("Wrong number of arguments");
|
|
2470
2577
|
}
|
|
2578
|
+
var init_chunk_WIMGWYZL = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-WIMGWYZL.js"() {
|
|
2579
|
+
init_chunk_D6FCK2GA();
|
|
2580
|
+
} });
|
|
2471
2581
|
|
|
2472
2582
|
//#endregion
|
|
2473
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2583
|
+
//#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js
|
|
2474
2584
|
function d(...r$1) {
|
|
2475
2585
|
return u(i, r$1);
|
|
2476
2586
|
}
|
|
2477
|
-
var i
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2587
|
+
var i;
|
|
2588
|
+
var init_chunk_3IFJP4R5 = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-3IFJP4R5.js"() {
|
|
2589
|
+
init_chunk_WIMGWYZL();
|
|
2590
|
+
i = (r$1, t$2) => {
|
|
2591
|
+
let a$2 = [[], []];
|
|
2592
|
+
for (let [o$1, e$1] of r$1.entries()) t$2(e$1, o$1, r$1) ? a$2[0].push(e$1) : a$2[1].push(e$1);
|
|
2593
|
+
return a$2;
|
|
2594
|
+
};
|
|
2595
|
+
} });
|
|
2482
2596
|
|
|
2483
2597
|
//#endregion
|
|
2484
|
-
//#region ../../node_modules/.pnpm/remeda@2.
|
|
2598
|
+
//#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js
|
|
2485
2599
|
function t(...n$1) {
|
|
2486
2600
|
return u(Object.keys, n$1);
|
|
2487
2601
|
}
|
|
2602
|
+
var init_chunk_5NQBDF4H = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/chunk-5NQBDF4H.js"() {
|
|
2603
|
+
init_chunk_WIMGWYZL();
|
|
2604
|
+
} });
|
|
2605
|
+
|
|
2606
|
+
//#endregion
|
|
2607
|
+
//#region ../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/index.js
|
|
2608
|
+
var init_dist$1 = __esm({ "../../node_modules/.pnpm/remeda@2.22.5/node_modules/remeda/dist/index.js"() {
|
|
2609
|
+
init_chunk_3IFJP4R5();
|
|
2610
|
+
init_chunk_5NQBDF4H();
|
|
2611
|
+
} });
|
|
2488
2612
|
|
|
2489
2613
|
//#endregion
|
|
2490
2614
|
//#region src/plugin/bindingify-hook-filter.ts
|
|
@@ -2626,6 +2750,11 @@ function bindingifyRenderChunkFilter(filterOption) {
|
|
|
2626
2750
|
if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
|
|
2627
2751
|
return filterOption.code ? bindingifyGeneralHookFilter("code", filterOption.code) : void 0;
|
|
2628
2752
|
}
|
|
2753
|
+
var init_bindingify_hook_filter = __esm({ "src/plugin/bindingify-hook-filter.ts"() {
|
|
2754
|
+
init_dist();
|
|
2755
|
+
init_dist$1();
|
|
2756
|
+
init_misc();
|
|
2757
|
+
} });
|
|
2629
2758
|
|
|
2630
2759
|
//#endregion
|
|
2631
2760
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
@@ -2641,6 +2770,7 @@ function bindingPluginOrder(order) {
|
|
|
2641
2770
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
2642
2771
|
}
|
|
2643
2772
|
}
|
|
2773
|
+
var init_bindingify_plugin_hook_meta = __esm({ "src/plugin/bindingify-plugin-hook-meta.ts"() {} });
|
|
2644
2774
|
|
|
2645
2775
|
//#endregion
|
|
2646
2776
|
//#region src/utils/asset-source.ts
|
|
@@ -2650,129 +2780,146 @@ function transformAssetSource(bindingAssetSource$1) {
|
|
|
2650
2780
|
function bindingAssetSource(source) {
|
|
2651
2781
|
return { inner: source };
|
|
2652
2782
|
}
|
|
2783
|
+
var init_asset_source = __esm({ "src/utils/asset-source.ts"() {} });
|
|
2653
2784
|
|
|
2654
2785
|
//#endregion
|
|
2655
2786
|
//#region src/plugin/plugin-context.ts
|
|
2656
|
-
var PluginContextImpl
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
const
|
|
2680
|
-
if (
|
|
2681
|
-
const
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
data.loadModulePromiseMap.
|
|
2689
|
-
|
|
2690
|
-
|
|
2787
|
+
var PluginContextImpl;
|
|
2788
|
+
var init_plugin_context = __esm({ "src/plugin/plugin-context.ts"() {
|
|
2789
|
+
init_logging();
|
|
2790
|
+
init_logs();
|
|
2791
|
+
init_parse_ast_index();
|
|
2792
|
+
init_minimal_plugin_context();
|
|
2793
|
+
init_asset_source();
|
|
2794
|
+
init_misc();
|
|
2795
|
+
init_transform_side_effects();
|
|
2796
|
+
PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
2797
|
+
getModuleInfo;
|
|
2798
|
+
constructor(outputOptions, context, plugin, data, onLog, logLevel, watchMode, currentLoadingModule) {
|
|
2799
|
+
super(onLog, logLevel, plugin.name, watchMode);
|
|
2800
|
+
this.outputOptions = outputOptions;
|
|
2801
|
+
this.context = context;
|
|
2802
|
+
this.data = data;
|
|
2803
|
+
this.onLog = onLog;
|
|
2804
|
+
this.currentLoadingModule = currentLoadingModule;
|
|
2805
|
+
this.getModuleInfo = (id$1) => this.data.getModuleInfo(id$1, context);
|
|
2806
|
+
}
|
|
2807
|
+
async load(options) {
|
|
2808
|
+
const id$1 = options.id;
|
|
2809
|
+
if (id$1 === this.currentLoadingModule) this.onLog(LOG_LEVEL_WARN, logCycleLoading(this.pluginName, this.currentLoadingModule));
|
|
2810
|
+
const moduleInfo = this.data.getModuleInfo(id$1, this.context);
|
|
2811
|
+
if (moduleInfo && moduleInfo.code !== null) return moduleInfo;
|
|
2812
|
+
const rawOptions = {
|
|
2813
|
+
meta: options.meta || {},
|
|
2814
|
+
moduleSideEffects: options.moduleSideEffects || null,
|
|
2815
|
+
invalidate: false
|
|
2816
|
+
};
|
|
2817
|
+
this.data.updateModuleOption(id$1, rawOptions);
|
|
2818
|
+
async function createLoadModulePromise(context, data) {
|
|
2819
|
+
const loadPromise = data.loadModulePromiseMap.get(id$1);
|
|
2820
|
+
if (loadPromise) return loadPromise;
|
|
2821
|
+
const promise$1 = new Promise((resolve, _) => {
|
|
2822
|
+
data.loadModulePromiseResolveFnMap.set(id$1, resolve);
|
|
2823
|
+
});
|
|
2824
|
+
data.loadModulePromiseMap.set(id$1, promise$1);
|
|
2825
|
+
try {
|
|
2826
|
+
await context.load(id$1, bindingifySideEffects(options.moduleSideEffects));
|
|
2827
|
+
} catch (e$1) {
|
|
2828
|
+
data.loadModulePromiseMap.delete(id$1);
|
|
2829
|
+
data.loadModulePromiseResolveFnMap.delete(id$1);
|
|
2830
|
+
throw e$1;
|
|
2831
|
+
}
|
|
2832
|
+
return promise$1;
|
|
2691
2833
|
}
|
|
2692
|
-
|
|
2834
|
+
await createLoadModulePromise(this.context, this.data);
|
|
2835
|
+
return this.data.getModuleInfo(id$1, this.context);
|
|
2693
2836
|
}
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2837
|
+
async resolve(source, importer, options) {
|
|
2838
|
+
let receipt = void 0;
|
|
2839
|
+
if (options != null) receipt = this.data.saveResolveOptions(options);
|
|
2840
|
+
const res = await this.context.resolve(source, importer, {
|
|
2841
|
+
custom: receipt,
|
|
2842
|
+
skipSelf: options?.skipSelf
|
|
2843
|
+
});
|
|
2844
|
+
if (receipt != null) this.data.removeSavedResolveOptions(receipt);
|
|
2845
|
+
if (res == null) return null;
|
|
2846
|
+
const info = this.data.getModuleOption(res.id) || {};
|
|
2847
|
+
return {
|
|
2848
|
+
...res,
|
|
2849
|
+
external: res.external === "relative" ? unreachable(`The PluginContext resolve result external couldn't be 'relative'`) : res.external,
|
|
2850
|
+
...info
|
|
2851
|
+
};
|
|
2852
|
+
}
|
|
2853
|
+
emitFile = (file) => {
|
|
2854
|
+
if (file.type === "prebuilt-chunk") return unimplemented("PluginContext.emitFile with type prebuilt-chunk");
|
|
2855
|
+
if (file.type === "chunk") return this.context.emitChunk(file);
|
|
2856
|
+
const fnSanitizedFileName = file.fileName || typeof this.outputOptions.sanitizeFileName !== "function" ? void 0 : this.outputOptions.sanitizeFileName(file.name || "asset");
|
|
2857
|
+
const filename = file.fileName ? void 0 : this.getAssetFileNames(file);
|
|
2858
|
+
return this.context.emitFile({
|
|
2859
|
+
...file,
|
|
2860
|
+
originalFileName: file.originalFileName || void 0,
|
|
2861
|
+
source: bindingAssetSource(file.source)
|
|
2862
|
+
}, filename, fnSanitizedFileName);
|
|
2711
2863
|
};
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
}
|
|
2864
|
+
getAssetFileNames(file) {
|
|
2865
|
+
if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
|
|
2866
|
+
names: file.name ? [file.name] : [],
|
|
2867
|
+
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
|
2868
|
+
source: file.source,
|
|
2869
|
+
type: "asset"
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
getFileName(referenceId) {
|
|
2873
|
+
return this.context.getFileName(referenceId);
|
|
2874
|
+
}
|
|
2875
|
+
getModuleIds() {
|
|
2876
|
+
return this.data.getModuleIds(this.context);
|
|
2877
|
+
}
|
|
2878
|
+
addWatchFile(id$1) {
|
|
2879
|
+
this.context.addWatchFile(id$1);
|
|
2880
|
+
}
|
|
2881
|
+
parse(input, options) {
|
|
2882
|
+
return parseAst(input, options);
|
|
2883
|
+
}
|
|
2723
2884
|
};
|
|
2724
|
-
|
|
2725
|
-
if (typeof this.outputOptions.assetFileNames === "function") return this.outputOptions.assetFileNames({
|
|
2726
|
-
names: file.name ? [file.name] : [],
|
|
2727
|
-
originalFileNames: file.originalFileName ? [file.originalFileName] : [],
|
|
2728
|
-
source: file.source,
|
|
2729
|
-
type: "asset"
|
|
2730
|
-
});
|
|
2731
|
-
}
|
|
2732
|
-
getFileName(referenceId) {
|
|
2733
|
-
return this.context.getFileName(referenceId);
|
|
2734
|
-
}
|
|
2735
|
-
getModuleIds() {
|
|
2736
|
-
return this.data.getModuleIds(this.context);
|
|
2737
|
-
}
|
|
2738
|
-
addWatchFile(id$1) {
|
|
2739
|
-
this.context.addWatchFile(id$1);
|
|
2740
|
-
}
|
|
2741
|
-
parse(input, options) {
|
|
2742
|
-
return parseAst(input, options);
|
|
2743
|
-
}
|
|
2744
|
-
};
|
|
2885
|
+
} });
|
|
2745
2886
|
|
|
2746
2887
|
//#endregion
|
|
2747
2888
|
//#region src/plugin/transform-plugin-context.ts
|
|
2748
|
-
var TransformPluginContextImpl
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
handler(log)
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2889
|
+
var TransformPluginContextImpl;
|
|
2890
|
+
var init_transform_plugin_context = __esm({ "src/plugin/transform-plugin-context.ts"() {
|
|
2891
|
+
init_log_handler();
|
|
2892
|
+
init_logs();
|
|
2893
|
+
init_plugin_context();
|
|
2894
|
+
TransformPluginContextImpl = class extends PluginContextImpl {
|
|
2895
|
+
constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption, watchMode) {
|
|
2896
|
+
super(outputOptions, context, plugin, data, onLog, LogLevelOption, watchMode, moduleId);
|
|
2897
|
+
this.inner = inner;
|
|
2898
|
+
this.moduleId = moduleId;
|
|
2899
|
+
this.moduleSource = moduleSource;
|
|
2900
|
+
const getLogHandler$1 = (handler) => (log, pos) => {
|
|
2901
|
+
log = normalizeLog(log);
|
|
2902
|
+
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
2903
|
+
log.id = moduleId;
|
|
2904
|
+
log.hook = "transform";
|
|
2905
|
+
handler(log);
|
|
2906
|
+
};
|
|
2907
|
+
this.debug = getLogHandler$1(this.debug);
|
|
2908
|
+
this.warn = getLogHandler$1(this.warn);
|
|
2909
|
+
this.info = getLogHandler$1(this.info);
|
|
2910
|
+
}
|
|
2911
|
+
error(e$1, pos) {
|
|
2912
|
+
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
2913
|
+
if (pos) augmentCodeLocation(e$1, pos, this.moduleSource, this.moduleId);
|
|
2914
|
+
e$1.id = this.moduleId;
|
|
2915
|
+
e$1.hook = "transform";
|
|
2916
|
+
return error(logPluginError(normalizeLog(e$1), this.pluginName));
|
|
2917
|
+
}
|
|
2918
|
+
getCombinedSourcemap() {
|
|
2919
|
+
return JSON.parse(this.inner.getCombinedSourcemap());
|
|
2920
|
+
}
|
|
2921
|
+
};
|
|
2922
|
+
} });
|
|
2776
2923
|
|
|
2777
2924
|
//#endregion
|
|
2778
2925
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
@@ -2937,6 +3084,20 @@ function bindingifyModuleParsed(args$1) {
|
|
|
2937
3084
|
meta: bindingifyPluginHookMeta(meta)
|
|
2938
3085
|
};
|
|
2939
3086
|
}
|
|
3087
|
+
var init_bindingify_build_hooks = __esm({ "src/plugin/bindingify-build-hooks.ts"() {
|
|
3088
|
+
init_normalize_hook();
|
|
3089
|
+
init_plugin_context$1();
|
|
3090
|
+
init_normalized_input_options();
|
|
3091
|
+
init_sourcemap();
|
|
3092
|
+
init_error();
|
|
3093
|
+
init_transform_module_info();
|
|
3094
|
+
init_transform_side_effects();
|
|
3095
|
+
init_transform_sourcemap();
|
|
3096
|
+
init_bindingify_hook_filter();
|
|
3097
|
+
init_bindingify_plugin_hook_meta();
|
|
3098
|
+
init_plugin_context();
|
|
3099
|
+
init_transform_plugin_context();
|
|
3100
|
+
} });
|
|
2940
3101
|
|
|
2941
3102
|
//#endregion
|
|
2942
3103
|
//#region src/utils/transform-rendered-module.ts
|
|
@@ -2953,6 +3114,7 @@ function transformToRenderedModule(bindingRenderedModule) {
|
|
|
2953
3114
|
}
|
|
2954
3115
|
};
|
|
2955
3116
|
}
|
|
3117
|
+
var init_transform_rendered_module = __esm({ "src/utils/transform-rendered-module.ts"() {} });
|
|
2956
3118
|
|
|
2957
3119
|
//#endregion
|
|
2958
3120
|
//#region src/utils/transform-rendered-chunk.ts
|
|
@@ -3002,6 +3164,9 @@ function transformChunkModules(modules) {
|
|
|
3002
3164
|
}
|
|
3003
3165
|
return result;
|
|
3004
3166
|
}
|
|
3167
|
+
var init_transform_rendered_chunk = __esm({ "src/utils/transform-rendered-chunk.ts"() {
|
|
3168
|
+
init_transform_rendered_module();
|
|
3169
|
+
} });
|
|
3005
3170
|
|
|
3006
3171
|
//#endregion
|
|
3007
3172
|
//#region src/utils/bindingify-output-options.ts
|
|
@@ -3087,116 +3252,125 @@ function bindingifyAssetFilenames(assetFileNames) {
|
|
|
3087
3252
|
};
|
|
3088
3253
|
return assetFileNames;
|
|
3089
3254
|
}
|
|
3255
|
+
var init_bindingify_output_options = __esm({ "src/utils/bindingify-output-options.ts"() {
|
|
3256
|
+
init_asset_source();
|
|
3257
|
+
init_misc();
|
|
3258
|
+
init_transform_rendered_chunk();
|
|
3259
|
+
} });
|
|
3090
3260
|
|
|
3091
3261
|
//#endregion
|
|
3092
3262
|
//#region src/options/normalized-output-options.ts
|
|
3093
|
-
var NormalizedOutputOptionsImpl = class {
|
|
3094
|
-
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3095
|
-
this.inner = inner;
|
|
3096
|
-
this.outputOptions = outputOptions;
|
|
3097
|
-
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3098
|
-
}
|
|
3099
|
-
get dir() {
|
|
3100
|
-
return this.inner.dir ?? void 0;
|
|
3101
|
-
}
|
|
3102
|
-
get entryFileNames() {
|
|
3103
|
-
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3104
|
-
}
|
|
3105
|
-
get chunkFileNames() {
|
|
3106
|
-
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3107
|
-
}
|
|
3108
|
-
get assetFileNames() {
|
|
3109
|
-
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3110
|
-
}
|
|
3111
|
-
get format() {
|
|
3112
|
-
return this.inner.format;
|
|
3113
|
-
}
|
|
3114
|
-
get exports() {
|
|
3115
|
-
return this.inner.exports;
|
|
3116
|
-
}
|
|
3117
|
-
get sourcemap() {
|
|
3118
|
-
return this.inner.sourcemap;
|
|
3119
|
-
}
|
|
3120
|
-
get cssEntryFileNames() {
|
|
3121
|
-
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3122
|
-
}
|
|
3123
|
-
get cssChunkFileNames() {
|
|
3124
|
-
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3125
|
-
}
|
|
3126
|
-
get shimMissingExports() {
|
|
3127
|
-
return this.inner.shimMissingExports;
|
|
3128
|
-
}
|
|
3129
|
-
get name() {
|
|
3130
|
-
return this.inner.name ?? void 0;
|
|
3131
|
-
}
|
|
3132
|
-
get file() {
|
|
3133
|
-
return this.inner.file ?? void 0;
|
|
3134
|
-
}
|
|
3135
|
-
get inlineDynamicImports() {
|
|
3136
|
-
return this.inner.inlineDynamicImports;
|
|
3137
|
-
}
|
|
3138
|
-
get externalLiveBindings() {
|
|
3139
|
-
return this.inner.externalLiveBindings;
|
|
3140
|
-
}
|
|
3141
|
-
get banner() {
|
|
3142
|
-
return normalizeAddon(this.outputOptions.banner);
|
|
3143
|
-
}
|
|
3144
|
-
get footer() {
|
|
3145
|
-
return normalizeAddon(this.outputOptions.footer);
|
|
3146
|
-
}
|
|
3147
|
-
get intro() {
|
|
3148
|
-
return normalizeAddon(this.outputOptions.intro);
|
|
3149
|
-
}
|
|
3150
|
-
get outro() {
|
|
3151
|
-
return normalizeAddon(this.outputOptions.outro);
|
|
3152
|
-
}
|
|
3153
|
-
get esModule() {
|
|
3154
|
-
return this.inner.esModule;
|
|
3155
|
-
}
|
|
3156
|
-
get extend() {
|
|
3157
|
-
return this.inner.extend;
|
|
3158
|
-
}
|
|
3159
|
-
get globals() {
|
|
3160
|
-
return this.inner.globals || this.outputOptions.globals;
|
|
3161
|
-
}
|
|
3162
|
-
get hashCharacters() {
|
|
3163
|
-
return this.inner.hashCharacters;
|
|
3164
|
-
}
|
|
3165
|
-
get sourcemapDebugIds() {
|
|
3166
|
-
return this.inner.sourcemapDebugIds;
|
|
3167
|
-
}
|
|
3168
|
-
get sourcemapIgnoreList() {
|
|
3169
|
-
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
3170
|
-
}
|
|
3171
|
-
get sourcemapPathTransform() {
|
|
3172
|
-
return this.outputOptions.sourcemapPathTransform;
|
|
3173
|
-
}
|
|
3174
|
-
get minify() {
|
|
3175
|
-
return this.inner.minify;
|
|
3176
|
-
}
|
|
3177
|
-
get legalComments() {
|
|
3178
|
-
return this.inner.legalComments;
|
|
3179
|
-
}
|
|
3180
|
-
get polyfillRequire() {
|
|
3181
|
-
return this.inner.polyfillRequire;
|
|
3182
|
-
}
|
|
3183
|
-
get plugins() {
|
|
3184
|
-
return this.normalizedOutputPlugins;
|
|
3185
|
-
}
|
|
3186
|
-
get preserveModules() {
|
|
3187
|
-
return this.preserveModules;
|
|
3188
|
-
}
|
|
3189
|
-
get preserveModulesRoot() {
|
|
3190
|
-
return this.preserveModulesRoot;
|
|
3191
|
-
}
|
|
3192
|
-
get virtualDirname() {
|
|
3193
|
-
return this.virtualDirname;
|
|
3194
|
-
}
|
|
3195
|
-
};
|
|
3196
3263
|
function normalizeAddon(value) {
|
|
3197
3264
|
if (typeof value === "function") return value;
|
|
3198
3265
|
return () => value || "";
|
|
3199
3266
|
}
|
|
3267
|
+
var NormalizedOutputOptionsImpl;
|
|
3268
|
+
var init_normalized_output_options = __esm({ "src/options/normalized-output-options.ts"() {
|
|
3269
|
+
init_bindingify_output_options();
|
|
3270
|
+
NormalizedOutputOptionsImpl = class {
|
|
3271
|
+
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3272
|
+
this.inner = inner;
|
|
3273
|
+
this.outputOptions = outputOptions;
|
|
3274
|
+
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
3275
|
+
}
|
|
3276
|
+
get dir() {
|
|
3277
|
+
return this.inner.dir ?? void 0;
|
|
3278
|
+
}
|
|
3279
|
+
get entryFileNames() {
|
|
3280
|
+
return this.inner.entryFilenames || this.outputOptions.entryFileNames;
|
|
3281
|
+
}
|
|
3282
|
+
get chunkFileNames() {
|
|
3283
|
+
return this.inner.chunkFilenames || this.outputOptions.chunkFileNames;
|
|
3284
|
+
}
|
|
3285
|
+
get assetFileNames() {
|
|
3286
|
+
return this.inner.assetFilenames || this.outputOptions.assetFileNames;
|
|
3287
|
+
}
|
|
3288
|
+
get format() {
|
|
3289
|
+
return this.inner.format;
|
|
3290
|
+
}
|
|
3291
|
+
get exports() {
|
|
3292
|
+
return this.inner.exports;
|
|
3293
|
+
}
|
|
3294
|
+
get sourcemap() {
|
|
3295
|
+
return this.inner.sourcemap;
|
|
3296
|
+
}
|
|
3297
|
+
get cssEntryFileNames() {
|
|
3298
|
+
return this.inner.cssEntryFilenames || this.outputOptions.cssEntryFileNames;
|
|
3299
|
+
}
|
|
3300
|
+
get cssChunkFileNames() {
|
|
3301
|
+
return this.inner.cssChunkFilenames || this.outputOptions.cssChunkFileNames;
|
|
3302
|
+
}
|
|
3303
|
+
get shimMissingExports() {
|
|
3304
|
+
return this.inner.shimMissingExports;
|
|
3305
|
+
}
|
|
3306
|
+
get name() {
|
|
3307
|
+
return this.inner.name ?? void 0;
|
|
3308
|
+
}
|
|
3309
|
+
get file() {
|
|
3310
|
+
return this.inner.file ?? void 0;
|
|
3311
|
+
}
|
|
3312
|
+
get inlineDynamicImports() {
|
|
3313
|
+
return this.inner.inlineDynamicImports;
|
|
3314
|
+
}
|
|
3315
|
+
get externalLiveBindings() {
|
|
3316
|
+
return this.inner.externalLiveBindings;
|
|
3317
|
+
}
|
|
3318
|
+
get banner() {
|
|
3319
|
+
return normalizeAddon(this.outputOptions.banner);
|
|
3320
|
+
}
|
|
3321
|
+
get footer() {
|
|
3322
|
+
return normalizeAddon(this.outputOptions.footer);
|
|
3323
|
+
}
|
|
3324
|
+
get intro() {
|
|
3325
|
+
return normalizeAddon(this.outputOptions.intro);
|
|
3326
|
+
}
|
|
3327
|
+
get outro() {
|
|
3328
|
+
return normalizeAddon(this.outputOptions.outro);
|
|
3329
|
+
}
|
|
3330
|
+
get esModule() {
|
|
3331
|
+
return this.inner.esModule;
|
|
3332
|
+
}
|
|
3333
|
+
get extend() {
|
|
3334
|
+
return this.inner.extend;
|
|
3335
|
+
}
|
|
3336
|
+
get globals() {
|
|
3337
|
+
return this.inner.globals || this.outputOptions.globals;
|
|
3338
|
+
}
|
|
3339
|
+
get hashCharacters() {
|
|
3340
|
+
return this.inner.hashCharacters;
|
|
3341
|
+
}
|
|
3342
|
+
get sourcemapDebugIds() {
|
|
3343
|
+
return this.inner.sourcemapDebugIds;
|
|
3344
|
+
}
|
|
3345
|
+
get sourcemapIgnoreList() {
|
|
3346
|
+
return bindingifySourcemapIgnoreList(this.outputOptions.sourcemapIgnoreList);
|
|
3347
|
+
}
|
|
3348
|
+
get sourcemapPathTransform() {
|
|
3349
|
+
return this.outputOptions.sourcemapPathTransform;
|
|
3350
|
+
}
|
|
3351
|
+
get minify() {
|
|
3352
|
+
return this.inner.minify;
|
|
3353
|
+
}
|
|
3354
|
+
get legalComments() {
|
|
3355
|
+
return this.inner.legalComments;
|
|
3356
|
+
}
|
|
3357
|
+
get polyfillRequire() {
|
|
3358
|
+
return this.inner.polyfillRequire;
|
|
3359
|
+
}
|
|
3360
|
+
get plugins() {
|
|
3361
|
+
return this.normalizedOutputPlugins;
|
|
3362
|
+
}
|
|
3363
|
+
get preserveModules() {
|
|
3364
|
+
return this.preserveModules;
|
|
3365
|
+
}
|
|
3366
|
+
get preserveModulesRoot() {
|
|
3367
|
+
return this.preserveModulesRoot;
|
|
3368
|
+
}
|
|
3369
|
+
get virtualDirname() {
|
|
3370
|
+
return this.virtualDirname;
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
} });
|
|
3200
3374
|
|
|
3201
3375
|
//#endregion
|
|
3202
3376
|
//#region src/utils/transform-to-rollup-output.ts
|
|
@@ -3340,6 +3514,12 @@ function collectChangedBundle(changed, bundle) {
|
|
|
3340
3514
|
deleted: Array.from(changed.deleted)
|
|
3341
3515
|
};
|
|
3342
3516
|
}
|
|
3517
|
+
var init_transform_to_rollup_output = __esm({ "src/utils/transform-to-rollup-output.ts"() {
|
|
3518
|
+
init_sourcemap();
|
|
3519
|
+
init_asset_source();
|
|
3520
|
+
init_error();
|
|
3521
|
+
init_transform_rendered_chunk();
|
|
3522
|
+
} });
|
|
3343
3523
|
|
|
3344
3524
|
//#endregion
|
|
3345
3525
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
@@ -3489,6 +3669,18 @@ function bindingifyOutro(args$1) {
|
|
|
3489
3669
|
meta: bindingifyPluginHookMeta(meta)
|
|
3490
3670
|
};
|
|
3491
3671
|
}
|
|
3672
|
+
var init_bindingify_output_hooks = __esm({ "src/plugin/bindingify-output-hooks.ts"() {
|
|
3673
|
+
init_normalized_input_options();
|
|
3674
|
+
init_normalized_output_options();
|
|
3675
|
+
init_sourcemap();
|
|
3676
|
+
init_error();
|
|
3677
|
+
init_normalize_hook();
|
|
3678
|
+
init_transform_rendered_chunk();
|
|
3679
|
+
init_transform_to_rollup_output();
|
|
3680
|
+
init_bindingify_hook_filter();
|
|
3681
|
+
init_bindingify_plugin_hook_meta();
|
|
3682
|
+
init_plugin_context();
|
|
3683
|
+
} });
|
|
3492
3684
|
|
|
3493
3685
|
//#endregion
|
|
3494
3686
|
//#region src/plugin/bindingify-watch-hooks.ts
|
|
@@ -3514,43 +3706,14 @@ function bindingifyCloseWatcher(args$1) {
|
|
|
3514
3706
|
meta: bindingifyPluginHookMeta(meta)
|
|
3515
3707
|
};
|
|
3516
3708
|
}
|
|
3709
|
+
var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"() {
|
|
3710
|
+
init_normalize_hook();
|
|
3711
|
+
init_bindingify_plugin_hook_meta();
|
|
3712
|
+
init_plugin_context();
|
|
3713
|
+
} });
|
|
3517
3714
|
|
|
3518
3715
|
//#endregion
|
|
3519
3716
|
//#region src/plugin/generated/hook-usage.ts
|
|
3520
|
-
let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
3521
|
-
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
3522
|
-
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
3523
|
-
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
3524
|
-
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
3525
|
-
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
3526
|
-
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
3527
|
-
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
3528
|
-
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
3529
|
-
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
3530
|
-
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
3531
|
-
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
3532
|
-
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
3533
|
-
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
3534
|
-
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
3535
|
-
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
3536
|
-
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
3537
|
-
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
3538
|
-
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
3539
|
-
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
3540
|
-
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
3541
|
-
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
3542
|
-
return HookUsageKind$1;
|
|
3543
|
-
}({});
|
|
3544
|
-
var HookUsage = class {
|
|
3545
|
-
bitflag = BigInt(0);
|
|
3546
|
-
constructor() {}
|
|
3547
|
-
union(kind) {
|
|
3548
|
-
this.bitflag |= BigInt(kind);
|
|
3549
|
-
}
|
|
3550
|
-
inner() {
|
|
3551
|
-
return Number(this.bitflag);
|
|
3552
|
-
}
|
|
3553
|
-
};
|
|
3554
3717
|
function extractHookUsage(plugin) {
|
|
3555
3718
|
let hookUsage = new HookUsage();
|
|
3556
3719
|
if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
|
|
@@ -3575,6 +3738,43 @@ function extractHookUsage(plugin) {
|
|
|
3575
3738
|
if (plugin.outro) hookUsage.union(HookUsageKind.outro);
|
|
3576
3739
|
return hookUsage;
|
|
3577
3740
|
}
|
|
3741
|
+
var HookUsageKind, HookUsage;
|
|
3742
|
+
var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
|
|
3743
|
+
HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
3744
|
+
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
3745
|
+
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
3746
|
+
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
3747
|
+
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
3748
|
+
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
3749
|
+
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
3750
|
+
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
3751
|
+
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
3752
|
+
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
3753
|
+
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
3754
|
+
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
3755
|
+
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
3756
|
+
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
3757
|
+
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
3758
|
+
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
3759
|
+
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
3760
|
+
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
3761
|
+
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
3762
|
+
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
3763
|
+
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
3764
|
+
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
3765
|
+
return HookUsageKind$1;
|
|
3766
|
+
}({});
|
|
3767
|
+
HookUsage = class {
|
|
3768
|
+
bitflag = BigInt(0);
|
|
3769
|
+
constructor() {}
|
|
3770
|
+
union(kind) {
|
|
3771
|
+
this.bitflag |= BigInt(kind);
|
|
3772
|
+
}
|
|
3773
|
+
inner() {
|
|
3774
|
+
return Number(this.bitflag);
|
|
3775
|
+
}
|
|
3776
|
+
};
|
|
3777
|
+
} });
|
|
3578
3778
|
|
|
3579
3779
|
//#endregion
|
|
3580
3780
|
//#region src/plugin/bindingify-plugin.ts
|
|
@@ -3697,95 +3897,106 @@ function wrapHandlers(plugin) {
|
|
|
3697
3897
|
}
|
|
3698
3898
|
return plugin;
|
|
3699
3899
|
}
|
|
3900
|
+
var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
|
|
3901
|
+
init_bindingify_build_hooks();
|
|
3902
|
+
init_bindingify_output_hooks();
|
|
3903
|
+
init_logs();
|
|
3904
|
+
init_bindingify_watch_hooks();
|
|
3905
|
+
init_hook_usage();
|
|
3906
|
+
} });
|
|
3700
3907
|
|
|
3701
3908
|
//#endregion
|
|
3702
3909
|
//#region src/plugin/plugin-context-data.ts
|
|
3703
|
-
var PluginContextData
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
if (
|
|
3715
|
-
|
|
3716
|
-
|
|
3910
|
+
var PluginContextData;
|
|
3911
|
+
var init_plugin_context_data = __esm({ "src/plugin/plugin-context-data.ts"() {
|
|
3912
|
+
init_transform_module_info();
|
|
3913
|
+
PluginContextData = class {
|
|
3914
|
+
moduleOptionMap = /* @__PURE__ */ new Map();
|
|
3915
|
+
resolveOptionsMap = /* @__PURE__ */ new Map();
|
|
3916
|
+
loadModulePromiseMap = /* @__PURE__ */ new Map();
|
|
3917
|
+
loadModulePromiseResolveFnMap = /* @__PURE__ */ new Map();
|
|
3918
|
+
renderedChunkMeta = null;
|
|
3919
|
+
updateModuleOption(id$1, option) {
|
|
3920
|
+
const existing = this.moduleOptionMap.get(id$1);
|
|
3921
|
+
if (existing) {
|
|
3922
|
+
if (option.moduleSideEffects != null) existing.moduleSideEffects = option.moduleSideEffects;
|
|
3923
|
+
if (option.meta != null) Object.assign(existing.meta, option.meta);
|
|
3924
|
+
if (option.invalidate != null) existing.invalidate = option.invalidate;
|
|
3925
|
+
} else {
|
|
3926
|
+
this.moduleOptionMap.set(id$1, option);
|
|
3927
|
+
return option;
|
|
3928
|
+
}
|
|
3929
|
+
return existing;
|
|
3930
|
+
}
|
|
3931
|
+
getModuleOption(id$1) {
|
|
3932
|
+
const option = this.moduleOptionMap.get(id$1);
|
|
3933
|
+
if (!option) {
|
|
3934
|
+
const raw = {
|
|
3935
|
+
moduleSideEffects: null,
|
|
3936
|
+
meta: {}
|
|
3937
|
+
};
|
|
3938
|
+
this.moduleOptionMap.set(id$1, raw);
|
|
3939
|
+
return raw;
|
|
3940
|
+
}
|
|
3717
3941
|
return option;
|
|
3718
3942
|
}
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
meta: {}
|
|
3727
|
-
};
|
|
3728
|
-
this.moduleOptionMap.set(id$1, raw);
|
|
3729
|
-
return raw;
|
|
3943
|
+
getModuleInfo(id$1, context) {
|
|
3944
|
+
const bindingInfo = context.getModuleInfo(id$1);
|
|
3945
|
+
if (bindingInfo) {
|
|
3946
|
+
const info = transformModuleInfo(bindingInfo, this.getModuleOption(id$1));
|
|
3947
|
+
return this.proxyModuleInfo(id$1, info);
|
|
3948
|
+
}
|
|
3949
|
+
return null;
|
|
3730
3950
|
}
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3951
|
+
proxyModuleInfo(id$1, info) {
|
|
3952
|
+
let moduleSideEffects = info.moduleSideEffects;
|
|
3953
|
+
Object.defineProperty(info, "moduleSideEffects", {
|
|
3954
|
+
get() {
|
|
3955
|
+
return moduleSideEffects;
|
|
3956
|
+
},
|
|
3957
|
+
set: (v) => {
|
|
3958
|
+
this.updateModuleOption(id$1, {
|
|
3959
|
+
moduleSideEffects: v,
|
|
3960
|
+
meta: info.meta,
|
|
3961
|
+
invalidate: true
|
|
3962
|
+
});
|
|
3963
|
+
moduleSideEffects = v;
|
|
3964
|
+
}
|
|
3965
|
+
});
|
|
3966
|
+
return info;
|
|
3738
3967
|
}
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
}
|
|
3770
|
-
|
|
3771
|
-
this.resolveOptionsMap.delete(receipt);
|
|
3772
|
-
}
|
|
3773
|
-
setRenderChunkMeta(meta) {
|
|
3774
|
-
this.renderedChunkMeta = meta;
|
|
3775
|
-
}
|
|
3776
|
-
getRenderChunkMeta() {
|
|
3777
|
-
return this.renderedChunkMeta;
|
|
3778
|
-
}
|
|
3779
|
-
markModuleLoaded(id$1, _success) {
|
|
3780
|
-
const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
3781
|
-
if (resolve) resolve();
|
|
3782
|
-
}
|
|
3783
|
-
clear() {
|
|
3784
|
-
this.renderedChunkMeta = null;
|
|
3785
|
-
this.loadModulePromiseMap.clear();
|
|
3786
|
-
this.loadModulePromiseResolveFnMap.clear();
|
|
3787
|
-
}
|
|
3788
|
-
};
|
|
3968
|
+
getModuleIds(context) {
|
|
3969
|
+
const moduleIds = context.getModuleIds();
|
|
3970
|
+
return moduleIds.values();
|
|
3971
|
+
}
|
|
3972
|
+
saveResolveOptions(options) {
|
|
3973
|
+
const index = this.resolveOptionsMap.size;
|
|
3974
|
+
this.resolveOptionsMap.set(index, options);
|
|
3975
|
+
return index;
|
|
3976
|
+
}
|
|
3977
|
+
getSavedResolveOptions(receipt) {
|
|
3978
|
+
return this.resolveOptionsMap.get(receipt);
|
|
3979
|
+
}
|
|
3980
|
+
removeSavedResolveOptions(receipt) {
|
|
3981
|
+
this.resolveOptionsMap.delete(receipt);
|
|
3982
|
+
}
|
|
3983
|
+
setRenderChunkMeta(meta) {
|
|
3984
|
+
this.renderedChunkMeta = meta;
|
|
3985
|
+
}
|
|
3986
|
+
getRenderChunkMeta() {
|
|
3987
|
+
return this.renderedChunkMeta;
|
|
3988
|
+
}
|
|
3989
|
+
markModuleLoaded(id$1, _success) {
|
|
3990
|
+
const resolve = this.loadModulePromiseResolveFnMap.get(id$1);
|
|
3991
|
+
if (resolve) resolve();
|
|
3992
|
+
}
|
|
3993
|
+
clear() {
|
|
3994
|
+
this.renderedChunkMeta = null;
|
|
3995
|
+
this.loadModulePromiseMap.clear();
|
|
3996
|
+
this.loadModulePromiseResolveFnMap.clear();
|
|
3997
|
+
}
|
|
3998
|
+
};
|
|
3999
|
+
} });
|
|
3789
4000
|
|
|
3790
4001
|
//#endregion
|
|
3791
4002
|
//#region src/utils/normalize-string-or-regex.ts
|
|
@@ -3797,6 +4008,7 @@ function normalizedStringOrRegex(pattern) {
|
|
|
3797
4008
|
function isReadonlyArray(input) {
|
|
3798
4009
|
return Array.isArray(input);
|
|
3799
4010
|
}
|
|
4011
|
+
var init_normalize_string_or_regex = __esm({ "src/utils/normalize-string-or-regex.ts"() {} });
|
|
3800
4012
|
|
|
3801
4013
|
//#endregion
|
|
3802
4014
|
//#region src/utils/bindingify-input-options.ts
|
|
@@ -3987,31 +4199,31 @@ function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative)
|
|
|
3987
4199
|
field0: makeAbsoluteExternalsRelative
|
|
3988
4200
|
};
|
|
3989
4201
|
}
|
|
4202
|
+
var init_bindingify_input_options = __esm({ "src/utils/bindingify-input-options.ts"() {
|
|
4203
|
+
init_constructors();
|
|
4204
|
+
init_utils();
|
|
4205
|
+
init_bindingify_plugin();
|
|
4206
|
+
init_plugin_context_data();
|
|
4207
|
+
init_misc();
|
|
4208
|
+
init_normalize_string_or_regex();
|
|
4209
|
+
init_transform_side_effects();
|
|
4210
|
+
} });
|
|
3990
4211
|
|
|
3991
4212
|
//#endregion
|
|
3992
4213
|
//#region src/utils/plugin/index.ts
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4214
|
+
var isPluginHookName;
|
|
4215
|
+
var init_plugin = __esm({ "src/utils/plugin/index.ts"() {
|
|
4216
|
+
init_plugin$1();
|
|
4217
|
+
isPluginHookName = function() {
|
|
4218
|
+
const PLUGIN_HOOK_NAMES_SET = new Set(ENUMERATED_PLUGIN_HOOK_NAMES);
|
|
4219
|
+
return function isPluginHookName$1(hookName) {
|
|
4220
|
+
return PLUGIN_HOOK_NAMES_SET.has(hookName);
|
|
4221
|
+
};
|
|
4222
|
+
}();
|
|
4223
|
+
} });
|
|
3999
4224
|
|
|
4000
4225
|
//#endregion
|
|
4001
4226
|
//#region src/utils/compose-js-plugins.ts
|
|
4002
|
-
const unsupportedHookName = [
|
|
4003
|
-
"augmentChunkHash",
|
|
4004
|
-
"generateBundle",
|
|
4005
|
-
"moduleParsed",
|
|
4006
|
-
"onLog",
|
|
4007
|
-
"options",
|
|
4008
|
-
"outputOptions",
|
|
4009
|
-
"renderError",
|
|
4010
|
-
"renderStart",
|
|
4011
|
-
"resolveDynamicImport",
|
|
4012
|
-
"writeBundle"
|
|
4013
|
-
];
|
|
4014
|
-
const unsupportedHooks = new Set(unsupportedHookName);
|
|
4015
4227
|
function isUnsupportedHooks(hookName) {
|
|
4016
4228
|
return unsupportedHooks.has(hookName);
|
|
4017
4229
|
}
|
|
@@ -4304,6 +4516,28 @@ function composeJsPlugins(plugins) {
|
|
|
4304
4516
|
}
|
|
4305
4517
|
return newPlugins;
|
|
4306
4518
|
}
|
|
4519
|
+
var unsupportedHookName, unsupportedHooks;
|
|
4520
|
+
var init_compose_js_plugins = __esm({ "src/utils/compose-js-plugins.ts"() {
|
|
4521
|
+
init_dist$1();
|
|
4522
|
+
init_constructors();
|
|
4523
|
+
init_plugin_context$1();
|
|
4524
|
+
init_misc();
|
|
4525
|
+
init_normalize_hook();
|
|
4526
|
+
init_plugin();
|
|
4527
|
+
unsupportedHookName = [
|
|
4528
|
+
"augmentChunkHash",
|
|
4529
|
+
"generateBundle",
|
|
4530
|
+
"moduleParsed",
|
|
4531
|
+
"onLog",
|
|
4532
|
+
"options",
|
|
4533
|
+
"outputOptions",
|
|
4534
|
+
"renderError",
|
|
4535
|
+
"renderStart",
|
|
4536
|
+
"resolveDynamicImport",
|
|
4537
|
+
"writeBundle"
|
|
4538
|
+
];
|
|
4539
|
+
unsupportedHooks = new Set(unsupportedHookName);
|
|
4540
|
+
} });
|
|
4307
4541
|
|
|
4308
4542
|
//#endregion
|
|
4309
4543
|
//#region src/utils/initialize-parallel-plugins.ts
|
|
@@ -4356,16 +4590,19 @@ async function initializeWorker(registryId, pluginInfos, threadNumber) {
|
|
|
4356
4590
|
throw e$1;
|
|
4357
4591
|
}
|
|
4358
4592
|
}
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
availableParallelism$1 =
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
}
|
|
4593
|
+
var availableParallelism;
|
|
4594
|
+
var init_initialize_parallel_plugins = __esm({ "src/utils/initialize-parallel-plugins.ts"() {
|
|
4595
|
+
availableParallelism = () => {
|
|
4596
|
+
let availableParallelism$1 = 1;
|
|
4597
|
+
try {
|
|
4598
|
+
availableParallelism$1 = os.availableParallelism();
|
|
4599
|
+
} catch {
|
|
4600
|
+
const cpus = os.cpus();
|
|
4601
|
+
if (Array.isArray(cpus) && cpus.length > 0) availableParallelism$1 = cpus.length;
|
|
4602
|
+
}
|
|
4603
|
+
return Math.min(availableParallelism$1, 8);
|
|
4604
|
+
};
|
|
4605
|
+
} });
|
|
4369
4606
|
|
|
4370
4607
|
//#endregion
|
|
4371
4608
|
//#region src/utils/create-bundler-option.ts
|
|
@@ -4401,10 +4638,19 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode, isCl
|
|
|
4401
4638
|
throw e$1;
|
|
4402
4639
|
}
|
|
4403
4640
|
}
|
|
4641
|
+
var init_create_bundler_option = __esm({ "src/utils/create-bundler-option.ts"() {
|
|
4642
|
+
init_logger();
|
|
4643
|
+
init_logging();
|
|
4644
|
+
init_plugin_driver();
|
|
4645
|
+
init_bindingify_input_options();
|
|
4646
|
+
init_bindingify_output_options();
|
|
4647
|
+
init_compose_js_plugins();
|
|
4648
|
+
init_initialize_parallel_plugins();
|
|
4649
|
+
init_normalize_plugin_option();
|
|
4650
|
+
} });
|
|
4404
4651
|
|
|
4405
4652
|
//#endregion
|
|
4406
4653
|
//#region src/utils/create-bundler.ts
|
|
4407
|
-
let asyncRuntimeShutdown = false;
|
|
4408
4654
|
async function createBundler(inputOptions, outputOptions, isClose) {
|
|
4409
4655
|
const option = await createBundlerOptions(inputOptions, outputOptions, false, isClose);
|
|
4410
4656
|
if (asyncRuntimeShutdown) startAsyncRuntime();
|
|
@@ -4422,62 +4668,79 @@ async function createBundler(inputOptions, outputOptions, isClose) {
|
|
|
4422
4668
|
throw e$1;
|
|
4423
4669
|
}
|
|
4424
4670
|
}
|
|
4671
|
+
var asyncRuntimeShutdown;
|
|
4672
|
+
var init_create_bundler = __esm({ "src/utils/create-bundler.ts"() {
|
|
4673
|
+
init_create_bundler_option();
|
|
4674
|
+
asyncRuntimeShutdown = false;
|
|
4675
|
+
} });
|
|
4425
4676
|
|
|
4426
4677
|
//#endregion
|
|
4427
4678
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4428
|
-
|
|
4429
|
-
var
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4679
|
+
var RolldownBuild;
|
|
4680
|
+
var init_rolldown_build = __esm({ "src/api/rolldown/rolldown-build.ts"() {
|
|
4681
|
+
init_create_bundler();
|
|
4682
|
+
init_transform_to_rollup_output();
|
|
4683
|
+
init_validator();
|
|
4684
|
+
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
4685
|
+
RolldownBuild = class {
|
|
4686
|
+
#inputOptions;
|
|
4687
|
+
#bundler;
|
|
4688
|
+
constructor(inputOptions) {
|
|
4689
|
+
this.#inputOptions = inputOptions;
|
|
4690
|
+
}
|
|
4691
|
+
get closed() {
|
|
4692
|
+
return this.#bundler?.bundler.closed ?? false;
|
|
4693
|
+
}
|
|
4694
|
+
async #getBundlerWithStopWorker(outputOptions, isClose) {
|
|
4695
|
+
if (this.#bundler) await this.#bundler.stopWorkers?.();
|
|
4696
|
+
return this.#bundler = await createBundler(this.#inputOptions, outputOptions, isClose);
|
|
4697
|
+
}
|
|
4698
|
+
async generate(outputOptions = {}) {
|
|
4699
|
+
validateOption("output", outputOptions);
|
|
4700
|
+
const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4701
|
+
const output = await bundler.generate();
|
|
4702
|
+
return transformToRollupOutput(output);
|
|
4703
|
+
}
|
|
4704
|
+
async write(outputOptions = {}) {
|
|
4705
|
+
validateOption("output", outputOptions);
|
|
4706
|
+
const { bundler } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4707
|
+
const output = await bundler.write();
|
|
4708
|
+
return transformToRollupOutput(output);
|
|
4709
|
+
}
|
|
4710
|
+
async close() {
|
|
4711
|
+
const { bundler, stopWorkers, shutdown } = await this.#getBundlerWithStopWorker({}, true);
|
|
4712
|
+
await stopWorkers?.();
|
|
4713
|
+
await bundler.close();
|
|
4714
|
+
shutdown();
|
|
4715
|
+
}
|
|
4716
|
+
async [Symbol.asyncDispose]() {
|
|
4717
|
+
await this.close();
|
|
4718
|
+
}
|
|
4719
|
+
async generateHmrPatch(changedFiles) {
|
|
4720
|
+
return this.#bundler?.bundler.generateHmrPatch(changedFiles);
|
|
4721
|
+
}
|
|
4722
|
+
async hmrInvalidate(file, firstInvalidatedBy) {
|
|
4723
|
+
return this.#bundler?.bundler.hmrInvalidate(file, firstInvalidatedBy);
|
|
4724
|
+
}
|
|
4725
|
+
get watchFiles() {
|
|
4726
|
+
return this.#bundler?.bundler.getWatchFiles() ?? Promise.resolve([]);
|
|
4727
|
+
}
|
|
4728
|
+
};
|
|
4729
|
+
} });
|
|
4473
4730
|
|
|
4474
4731
|
//#endregion
|
|
4475
4732
|
//#region src/api/rolldown/index.ts
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4733
|
+
var rolldown;
|
|
4734
|
+
var init_rolldown = __esm({ "src/api/rolldown/index.ts"() {
|
|
4735
|
+
init_plugin_driver();
|
|
4736
|
+
init_validator();
|
|
4737
|
+
init_rolldown_build();
|
|
4738
|
+
rolldown = async (input) => {
|
|
4739
|
+
validateOption("input", input);
|
|
4740
|
+
const inputOptions = await PluginDriver.callOptionsHook(input);
|
|
4741
|
+
return new RolldownBuild(inputOptions);
|
|
4742
|
+
};
|
|
4743
|
+
} });
|
|
4481
4744
|
|
|
4482
4745
|
//#endregion
|
|
4483
4746
|
//#region src/api/build.ts
|
|
@@ -4494,106 +4757,86 @@ async function build(options) {
|
|
|
4494
4757
|
}
|
|
4495
4758
|
}
|
|
4496
4759
|
}
|
|
4760
|
+
var init_build = __esm({ "src/api/build.ts"() {
|
|
4761
|
+
init_rolldown();
|
|
4762
|
+
} });
|
|
4497
4763
|
|
|
4498
4764
|
//#endregion
|
|
4499
4765
|
//#region src/api/watch/watch-emitter.ts
|
|
4500
|
-
var WatcherEmitter
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
if (listeners) listeners.push(listener);
|
|
4509
|
-
else this.listeners.set(event, [listener]);
|
|
4510
|
-
return this;
|
|
4511
|
-
}
|
|
4512
|
-
off(event, listener) {
|
|
4513
|
-
const listeners = this.listeners.get(event);
|
|
4514
|
-
if (listeners) {
|
|
4515
|
-
const index = listeners.indexOf(listener);
|
|
4516
|
-
if (index !== -1) listeners.splice(index, 1);
|
|
4766
|
+
var WatcherEmitter;
|
|
4767
|
+
var init_watch_emitter = __esm({ "src/api/watch/watch-emitter.ts"() {
|
|
4768
|
+
init_error();
|
|
4769
|
+
WatcherEmitter = class {
|
|
4770
|
+
listeners = /* @__PURE__ */ new Map();
|
|
4771
|
+
timer;
|
|
4772
|
+
constructor() {
|
|
4773
|
+
this.timer = setInterval(() => {}, 1e9);
|
|
4517
4774
|
}
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4775
|
+
on(event, listener) {
|
|
4776
|
+
const listeners = this.listeners.get(event);
|
|
4777
|
+
if (listeners) listeners.push(listener);
|
|
4778
|
+
else this.listeners.set(event, [listener]);
|
|
4779
|
+
return this;
|
|
4780
|
+
}
|
|
4781
|
+
off(event, listener) {
|
|
4782
|
+
const listeners = this.listeners.get(event);
|
|
4783
|
+
if (listeners) {
|
|
4784
|
+
const index = listeners.indexOf(listener);
|
|
4785
|
+
if (index !== -1) listeners.splice(index, 1);
|
|
4786
|
+
}
|
|
4787
|
+
return this;
|
|
4788
|
+
}
|
|
4789
|
+
async onEvent(event) {
|
|
4790
|
+
const listeners = this.listeners.get(event.eventKind());
|
|
4791
|
+
if (listeners) switch (event.eventKind()) {
|
|
4792
|
+
case "close":
|
|
4793
|
+
case "restart":
|
|
4794
|
+
for (const listener of listeners) await listener();
|
|
4795
|
+
break;
|
|
4796
|
+
case "event":
|
|
4797
|
+
for (const listener of listeners) {
|
|
4798
|
+
const code$1 = event.bundleEventKind();
|
|
4799
|
+
switch (code$1) {
|
|
4800
|
+
case "BUNDLE_END":
|
|
4801
|
+
const { duration, output, result } = event.bundleEndData();
|
|
4802
|
+
await listener({
|
|
4803
|
+
code: "BUNDLE_END",
|
|
4804
|
+
duration,
|
|
4805
|
+
output: [output],
|
|
4806
|
+
result
|
|
4807
|
+
});
|
|
4808
|
+
break;
|
|
4809
|
+
case "ERROR":
|
|
4810
|
+
const data = event.bundleErrorData();
|
|
4811
|
+
await listener({
|
|
4812
|
+
code: "ERROR",
|
|
4813
|
+
error: normalizeErrors(data.error),
|
|
4814
|
+
result: data.result
|
|
4815
|
+
});
|
|
4816
|
+
break;
|
|
4817
|
+
default:
|
|
4818
|
+
await listener({ code: code$1 });
|
|
4819
|
+
break;
|
|
4820
|
+
}
|
|
4551
4821
|
}
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4822
|
+
break;
|
|
4823
|
+
case "change":
|
|
4824
|
+
for (const listener of listeners) {
|
|
4825
|
+
const { path: path$1, kind } = event.watchChangeData();
|
|
4826
|
+
await listener(path$1, { event: kind });
|
|
4827
|
+
}
|
|
4828
|
+
break;
|
|
4829
|
+
default: throw new Error(`Unknown event: ${event}`);
|
|
4830
|
+
}
|
|
4561
4831
|
}
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
}
|
|
4566
|
-
};
|
|
4832
|
+
async close() {
|
|
4833
|
+
clearInterval(this.timer);
|
|
4834
|
+
}
|
|
4835
|
+
};
|
|
4836
|
+
} });
|
|
4567
4837
|
|
|
4568
4838
|
//#endregion
|
|
4569
4839
|
//#region src/api/watch/watcher.ts
|
|
4570
|
-
var Watcher = class {
|
|
4571
|
-
closed;
|
|
4572
|
-
inner;
|
|
4573
|
-
emitter;
|
|
4574
|
-
stopWorkers;
|
|
4575
|
-
constructor(emitter, inner, stopWorkers) {
|
|
4576
|
-
this.closed = false;
|
|
4577
|
-
this.inner = inner;
|
|
4578
|
-
this.emitter = emitter;
|
|
4579
|
-
const originClose = emitter.close.bind(emitter);
|
|
4580
|
-
emitter.close = async () => {
|
|
4581
|
-
await this.close();
|
|
4582
|
-
originClose();
|
|
4583
|
-
};
|
|
4584
|
-
this.stopWorkers = stopWorkers;
|
|
4585
|
-
}
|
|
4586
|
-
async close() {
|
|
4587
|
-
if (this.closed) return;
|
|
4588
|
-
this.closed = true;
|
|
4589
|
-
for (const stop of this.stopWorkers) await stop?.();
|
|
4590
|
-
await this.inner.close();
|
|
4591
|
-
shutdownAsyncRuntime();
|
|
4592
|
-
}
|
|
4593
|
-
start() {
|
|
4594
|
-
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
4595
|
-
}
|
|
4596
|
-
};
|
|
4597
4840
|
async function createWatcher(emitter, input) {
|
|
4598
4841
|
const options = arraify(input);
|
|
4599
4842
|
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
@@ -4615,24 +4858,71 @@ function getValidNotifyOption(bundlerOptions) {
|
|
|
4615
4858
|
} else result = notifyOption;
|
|
4616
4859
|
}
|
|
4617
4860
|
}
|
|
4861
|
+
var Watcher;
|
|
4862
|
+
var init_watcher = __esm({ "src/api/watch/watcher.ts"() {
|
|
4863
|
+
init_logging();
|
|
4864
|
+
init_logs();
|
|
4865
|
+
init_plugin_driver();
|
|
4866
|
+
init_create_bundler_option();
|
|
4867
|
+
init_misc();
|
|
4868
|
+
Watcher = class {
|
|
4869
|
+
closed;
|
|
4870
|
+
inner;
|
|
4871
|
+
emitter;
|
|
4872
|
+
stopWorkers;
|
|
4873
|
+
constructor(emitter, inner, stopWorkers) {
|
|
4874
|
+
this.closed = false;
|
|
4875
|
+
this.inner = inner;
|
|
4876
|
+
this.emitter = emitter;
|
|
4877
|
+
const originClose = emitter.close.bind(emitter);
|
|
4878
|
+
emitter.close = async () => {
|
|
4879
|
+
await this.close();
|
|
4880
|
+
originClose();
|
|
4881
|
+
};
|
|
4882
|
+
this.stopWorkers = stopWorkers;
|
|
4883
|
+
}
|
|
4884
|
+
async close() {
|
|
4885
|
+
if (this.closed) return;
|
|
4886
|
+
this.closed = true;
|
|
4887
|
+
for (const stop of this.stopWorkers) await stop?.();
|
|
4888
|
+
await this.inner.close();
|
|
4889
|
+
shutdownAsyncRuntime();
|
|
4890
|
+
}
|
|
4891
|
+
start() {
|
|
4892
|
+
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
4893
|
+
}
|
|
4894
|
+
};
|
|
4895
|
+
} });
|
|
4618
4896
|
|
|
4619
4897
|
//#endregion
|
|
4620
4898
|
//#region src/api/watch/index.ts
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4899
|
+
var watch;
|
|
4900
|
+
var init_watch = __esm({ "src/api/watch/index.ts"() {
|
|
4901
|
+
init_watch_emitter();
|
|
4902
|
+
init_watcher();
|
|
4903
|
+
watch = (input) => {
|
|
4904
|
+
const emitter = new WatcherEmitter();
|
|
4905
|
+
createWatcher(emitter, input);
|
|
4906
|
+
return emitter;
|
|
4907
|
+
};
|
|
4908
|
+
} });
|
|
4626
4909
|
|
|
4627
4910
|
//#endregion
|
|
4628
4911
|
//#region src/utils/define-config.ts
|
|
4629
4912
|
function defineConfig(config) {
|
|
4630
4913
|
return config;
|
|
4631
4914
|
}
|
|
4915
|
+
var init_define_config = __esm({ "src/utils/define-config.ts"() {} });
|
|
4632
4916
|
|
|
4633
4917
|
//#endregion
|
|
4634
4918
|
//#region src/index.ts
|
|
4635
|
-
|
|
4919
|
+
var VERSION;
|
|
4920
|
+
var init_src = __esm({ "src/index.ts"() {
|
|
4921
|
+
init_build();
|
|
4922
|
+
init_rolldown();
|
|
4923
|
+
init_watch();
|
|
4924
|
+
VERSION = version;
|
|
4925
|
+
} });
|
|
4636
4926
|
|
|
4637
4927
|
//#endregion
|
|
4638
|
-
export { BuiltinPlugin, PluginContextData, VERSION,
|
|
4928
|
+
export { BuiltinPlugin, PluginContextData, VERSION, ansis_default, assetPlugin, bindingifyPlugin, build, buildImportAnalysisPlugin, composeJsPlugins, createBundler, defineConfig, description$1 as description, dynamicImportVarsPlugin, getInputCliKeys, getJsonSchema, getOutputCliKeys, handleOutputErrors, importGlobPlugin, init_ansis, init_bindingify_plugin, init_compose_js_plugins, init_constructors, init_create_bundler, init_normalize_string_or_regex, init_plugin_context_data, init_rolldown, init_src, init_transform_to_rollup_output, init_validator, init_watch, isolatedDeclarationPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, reporterPlugin, rolldown, validateCliOptions, version, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin, watch, webWorkerPostPlugin };
|