@rolldown/browser 1.0.0-beta.50 → 1.0.0-beta.52
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.mjs +11 -7
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +9 -5
- package/dist/constructors-DW3R_Jog.js +68 -0
- package/dist/experimental-index.browser.mjs +19 -13
- package/dist/experimental-index.d.mts +63 -16
- package/dist/experimental-index.mjs +23 -15
- package/dist/filter-index.d.mts +3 -3
- package/dist/filter-index.mjs +2 -1
- package/dist/index.browser.mjs +161 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +36 -4
- package/dist/normalize-string-or-regex-BcbPUrYo.js +830 -0
- package/dist/parallel-plugin-worker.mjs +5 -4
- package/dist/parallel-plugin.d.mts +3 -3
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/plugins-index.browser.mjs +2 -2
- package/dist/plugins-index.d.mts +3 -3
- package/dist/plugins-index.mjs +3 -2
- package/dist/rolldown-binding.wasi-browser.js +5 -2
- package/dist/rolldown-binding.wasi.cjs +5 -2
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/{src-dUoCuQap.js → rolldown-build-CUYnBV3u.js} +44 -754
- package/dist/shared/{binding-BTup3pHG.d.mts → binding-BKL2JHoJ.d.mts} +173 -94
- package/dist/shared/bindingify-input-options-D4i1DYzt.mjs +1568 -0
- package/dist/shared/{composable-filters-CBpK2Fbc.mjs → composable-filters-DZ5ToxRJ.mjs} +1 -22
- package/dist/shared/constructors-BvaMwihu.d.mts +32 -0
- package/dist/shared/constructors-XFp0WhK3.mjs +68 -0
- package/dist/shared/{define-config-DiSv-kgF.d.mts → define-config-Buedmg9e.d.mts} +31 -57
- package/dist/shared/define-config-DfeZGBEt.mjs +7 -0
- package/dist/shared/{load-config-BqnLKlUM.mjs → load-config-C9CjEv2m.mjs} +1 -1
- package/dist/shared/misc-5GYLGQ20.mjs +22 -0
- package/dist/shared/normalize-string-or-regex-D1mB67Iy.mjs +629 -0
- package/dist/shared/{parse-ast-index-DtI4JSVR.mjs → parse-ast-index-BSDTTjWT.mjs} +20 -6
- package/dist/shared/rolldown-0ID0Q4xL.mjs +10 -0
- package/dist/shared/rolldown-build-BWJGpMD0.mjs +2121 -0
- package/dist/shared/utils-DKydZ4iH.d.mts +62 -0
- package/dist/shared/watch-CwnSQOS4.mjs +338 -0
- package/package.json +5 -1
- package/dist/constructors-EhfoQfqh.js +0 -68
- package/dist/normalize-string-or-regex-d47jXr3r.js +0 -231
- package/dist/shared/constructors-B7IHT8j4.d.mts +0 -32
- package/dist/shared/constructors-DcEzB0nc.mjs +0 -68
- package/dist/shared/normalize-string-or-regex-CbDij6KB.mjs +0 -46
- package/dist/shared/src-D0x2a_iO.mjs +0 -4597
- package/dist/shared/utils-BKVJO2vQ.d.mts +0 -18
- /package/dist/shared/{prompt-CjFmA1DF.mjs → prompt-pmGBC3ws.mjs} +0 -0
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BindingAttachDebugInfo, BindingBundler, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString,
|
|
1
|
+
import { A as logCycleLoading, C as logLevelPriority, D as unsupported, E as unreachable, F as logPluginError, I as locate, L as getCodeFrame, N as logNoFileSystemInBrowser, O as augmentCodeLocation, P as logParseError, S as LOG_LEVEL_WARN, T as unimplemented, _ as VERSION, b as LOG_LEVEL_ERROR, c as transformToRollupOutput, d as __decorate, f as bindingAssetSource, g as MinimalPluginContextImpl, h as PlainObjectLike, i as bindingifyViteHtmlPlugin, j as logInputHookInOutputPlugin, k as error, l as bindingifySourcemap$1, m as lazyProp, n as BuiltinPlugin, o as collectChangedBundle, p as transformAssetSource, r as bindingifyBuiltInPlugin, s as transformToOutputBundle, t as normalizedStringOrRegex, u as transformRenderedChunk, v as normalizeLog, w as arraify, x as LOG_LEVEL_INFO, y as LOG_LEVEL_DEBUG } from "./normalize-string-or-regex-BcbPUrYo.js";
|
|
2
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, parse, parseSync, shutdownAsyncRuntime, startAsyncRuntime } from "./rolldown-binding.wasi-browser.js";
|
|
3
3
|
|
|
4
|
-
//#region package.json
|
|
5
|
-
var version = "1.0.0-beta.50";
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
4
|
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
9
5
|
let _lazyMatch = () => {
|
|
10
6
|
var __lib__ = (() => {
|
|
@@ -402,7 +398,7 @@ const basename = function(p, extension) {
|
|
|
402
398
|
}
|
|
403
399
|
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
404
400
|
};
|
|
405
|
-
const parse = function(p) {
|
|
401
|
+
const parse$2 = function(p) {
|
|
406
402
|
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
407
403
|
const base = basename(p);
|
|
408
404
|
const extension = extname(base);
|
|
@@ -428,7 +424,7 @@ const _path = {
|
|
|
428
424
|
matchesGlob,
|
|
429
425
|
normalize,
|
|
430
426
|
normalizeString,
|
|
431
|
-
parse,
|
|
427
|
+
parse: parse$2,
|
|
432
428
|
relative,
|
|
433
429
|
resolve,
|
|
434
430
|
sep,
|
|
@@ -453,53 +449,6 @@ const mix = (del = delimiter) => {
|
|
|
453
449
|
const posix = /* @__PURE__ */ mix(":");
|
|
454
450
|
const win32 = /* @__PURE__ */ mix(";");
|
|
455
451
|
|
|
456
|
-
//#endregion
|
|
457
|
-
//#region src/utils/misc.ts
|
|
458
|
-
function arraify(value) {
|
|
459
|
-
return Array.isArray(value) ? value : [value];
|
|
460
|
-
}
|
|
461
|
-
function unimplemented(info) {
|
|
462
|
-
if (info) throw new Error(`unimplemented: ${info}`);
|
|
463
|
-
throw new Error("unimplemented");
|
|
464
|
-
}
|
|
465
|
-
function unreachable(info) {
|
|
466
|
-
if (info) throw new Error(`unreachable: ${info}`);
|
|
467
|
-
throw new Error("unreachable");
|
|
468
|
-
}
|
|
469
|
-
function unsupported(info) {
|
|
470
|
-
throw new Error(`UNSUPPORTED: ${info}`);
|
|
471
|
-
}
|
|
472
|
-
function noop(..._args) {}
|
|
473
|
-
|
|
474
|
-
//#endregion
|
|
475
|
-
//#region src/log/logging.ts
|
|
476
|
-
const LOG_LEVEL_SILENT = "silent";
|
|
477
|
-
const LOG_LEVEL_ERROR = "error";
|
|
478
|
-
const LOG_LEVEL_WARN = "warn";
|
|
479
|
-
const LOG_LEVEL_INFO = "info";
|
|
480
|
-
const LOG_LEVEL_DEBUG = "debug";
|
|
481
|
-
const logLevelPriority = {
|
|
482
|
-
[LOG_LEVEL_DEBUG]: 0,
|
|
483
|
-
[LOG_LEVEL_INFO]: 1,
|
|
484
|
-
[LOG_LEVEL_WARN]: 2,
|
|
485
|
-
[LOG_LEVEL_SILENT]: 3
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
//#endregion
|
|
489
|
-
//#region src/log/log-handler.ts
|
|
490
|
-
const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
|
|
491
|
-
function getLogHandler(level, code$1, logger, pluginName, logLevel) {
|
|
492
|
-
if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
|
|
493
|
-
return (log, pos) => {
|
|
494
|
-
if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
|
|
495
|
-
log = normalizeLog(log);
|
|
496
|
-
if (log.code && !log.pluginCode) log.pluginCode = log.code;
|
|
497
|
-
log.code = code$1;
|
|
498
|
-
log.plugin = pluginName;
|
|
499
|
-
logger(level, log);
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
|
|
503
452
|
//#endregion
|
|
504
453
|
//#region src/log/logger.ts
|
|
505
454
|
function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
@@ -510,20 +459,20 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
|
510
459
|
if (skipped.has(plugin)) continue;
|
|
511
460
|
const { onLog: pluginOnLog } = plugin;
|
|
512
461
|
if (pluginOnLog) {
|
|
513
|
-
const getLogHandler
|
|
462
|
+
const getLogHandler = (level$1) => {
|
|
514
463
|
if (logLevelPriority[level$1] < minimalPriority) return () => {};
|
|
515
464
|
return (log$1) => logger(level$1, normalizeLog(log$1), new Set(skipped).add(plugin));
|
|
516
465
|
};
|
|
517
466
|
if (("handler" in pluginOnLog ? pluginOnLog.handler : pluginOnLog).call({
|
|
518
|
-
debug: getLogHandler
|
|
467
|
+
debug: getLogHandler(LOG_LEVEL_DEBUG),
|
|
519
468
|
error: (log$1) => error(normalizeLog(log$1)),
|
|
520
|
-
info: getLogHandler
|
|
469
|
+
info: getLogHandler(LOG_LEVEL_INFO),
|
|
521
470
|
meta: {
|
|
522
471
|
rollupVersion: "4.23.0",
|
|
523
472
|
rolldownVersion: VERSION,
|
|
524
473
|
watchMode
|
|
525
474
|
},
|
|
526
|
-
warn: getLogHandler
|
|
475
|
+
warn: getLogHandler(LOG_LEVEL_WARN),
|
|
527
476
|
pluginName: plugin.name || "unknown"
|
|
528
477
|
}, level, log) === false) return;
|
|
529
478
|
}
|
|
@@ -692,30 +641,6 @@ function normalizePlugins(plugins, anonymousPrefix) {
|
|
|
692
641
|
const ANONYMOUS_PLUGIN_PREFIX = "at position ";
|
|
693
642
|
const ANONYMOUS_OUTPUT_PLUGIN_PREFIX = "at output position ";
|
|
694
643
|
|
|
695
|
-
//#endregion
|
|
696
|
-
//#region src/plugin/minimal-plugin-context.ts
|
|
697
|
-
var MinimalPluginContextImpl = class {
|
|
698
|
-
info;
|
|
699
|
-
warn;
|
|
700
|
-
debug;
|
|
701
|
-
meta;
|
|
702
|
-
constructor(onLog, logLevel, pluginName, watchMode, hookName) {
|
|
703
|
-
this.pluginName = pluginName;
|
|
704
|
-
this.hookName = hookName;
|
|
705
|
-
this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
706
|
-
this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
|
|
707
|
-
this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
|
|
708
|
-
this.meta = {
|
|
709
|
-
rollupVersion: "4.23.0",
|
|
710
|
-
rolldownVersion: VERSION,
|
|
711
|
-
watchMode
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
error(e$1) {
|
|
715
|
-
return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
|
|
716
|
-
}
|
|
717
|
-
};
|
|
718
|
-
|
|
719
644
|
//#endregion
|
|
720
645
|
//#region src/plugin/plugin-driver.ts
|
|
721
646
|
var PluginDriver = class {
|
|
@@ -1911,7 +1836,8 @@ const ChecksOptionsSchema = strictObject({
|
|
|
1911
1836
|
importIsUndefined: pipe(optional(boolean()), description("Whether to emit warning when detecting import is undefined")),
|
|
1912
1837
|
emptyImportMeta: pipe(optional(boolean()), description("Whether to emit warning when detecting empty import meta")),
|
|
1913
1838
|
configurationFieldConflict: pipe(optional(boolean()), description("Whether to emit warning when detecting configuration field conflict")),
|
|
1914
|
-
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
1839
|
+
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature")),
|
|
1840
|
+
couldNotCleanDirectory: pipe(optional(boolean()), description("Whether to emit warning when detecting could not clean directory"))
|
|
1915
1841
|
});
|
|
1916
1842
|
const CompressOptionsKeepNamesSchema = strictObject({
|
|
1917
1843
|
function: boolean(),
|
|
@@ -2046,7 +1972,7 @@ const InputOptionsSchema = strictObject({
|
|
|
2046
1972
|
literal("exports-only"),
|
|
2047
1973
|
literal(false)
|
|
2048
1974
|
]))),
|
|
2049
|
-
tsconfig: pipe(optional(string()), description("Path to the tsconfig.json file."))
|
|
1975
|
+
tsconfig: pipe(optional(union([literal(true), string()])), description("Path to the tsconfig.json file."))
|
|
2050
1976
|
});
|
|
2051
1977
|
const InputCliOverrideSchema = strictObject({
|
|
2052
1978
|
input: pipe(optional(array(string())), description("Entry file")),
|
|
@@ -2250,497 +2176,6 @@ function validateOption(key, options) {
|
|
|
2250
2176
|
}
|
|
2251
2177
|
}
|
|
2252
2178
|
|
|
2253
|
-
//#endregion
|
|
2254
|
-
//#region src/types/plain-object-like.ts
|
|
2255
|
-
const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
|
|
2256
|
-
/**
|
|
2257
|
-
* Base class for classes that use `@lazyProp` decorated properties.
|
|
2258
|
-
*
|
|
2259
|
-
* **Design Pattern in Rolldown:**
|
|
2260
|
-
* This is a common pattern in Rolldown due to its three-layer architecture:
|
|
2261
|
-
* TypeScript API → NAPI Bindings → Rust Core
|
|
2262
|
-
*
|
|
2263
|
-
* **Why we use getters:**
|
|
2264
|
-
* For performance - to lazily fetch data from Rust bindings only when needed,
|
|
2265
|
-
* rather than eagerly fetching all data during object construction.
|
|
2266
|
-
*
|
|
2267
|
-
* **The problem:**
|
|
2268
|
-
* Getters defined on class prototypes are non-enumerable by default, which breaks:
|
|
2269
|
-
* - Object spread operators ({...obj})
|
|
2270
|
-
* - Object.keys() and similar methods
|
|
2271
|
-
* - Standard JavaScript object semantics
|
|
2272
|
-
*
|
|
2273
|
-
* **The solution:**
|
|
2274
|
-
* This base class automatically converts `@lazyProp` decorated getters into
|
|
2275
|
-
* own enumerable getters on each instance during construction.
|
|
2276
|
-
*
|
|
2277
|
-
* **Result:**
|
|
2278
|
-
* Objects get both lazy-loading performance benefits AND plain JavaScript object behavior.
|
|
2279
|
-
*
|
|
2280
|
-
* @example
|
|
2281
|
-
* ```typescript
|
|
2282
|
-
* class MyClass extends PlainObjectLike {
|
|
2283
|
-
* @lazyProp
|
|
2284
|
-
* get myProp() {
|
|
2285
|
-
* return fetchFromRustBinding();
|
|
2286
|
-
* }
|
|
2287
|
-
* }
|
|
2288
|
-
* ```
|
|
2289
|
-
*/
|
|
2290
|
-
var PlainObjectLike = class {
|
|
2291
|
-
constructor() {
|
|
2292
|
-
setupLazyProperties(this);
|
|
2293
|
-
}
|
|
2294
|
-
};
|
|
2295
|
-
/**
|
|
2296
|
-
* Set up lazy properties as own getters on an instance.
|
|
2297
|
-
* This is called automatically by the `PlainObjectLike` base class constructor.
|
|
2298
|
-
*
|
|
2299
|
-
* @param instance - The instance to set up lazy properties on
|
|
2300
|
-
* @internal
|
|
2301
|
-
*/
|
|
2302
|
-
function setupLazyProperties(instance$1) {
|
|
2303
|
-
const lazyFields = instance$1.constructor[LAZY_FIELDS_KEY];
|
|
2304
|
-
if (!lazyFields) return;
|
|
2305
|
-
for (const [propertyKey, originalGetter] of lazyFields.entries()) {
|
|
2306
|
-
let cachedValue;
|
|
2307
|
-
let hasValue = false;
|
|
2308
|
-
Object.defineProperty(instance$1, propertyKey, {
|
|
2309
|
-
get() {
|
|
2310
|
-
if (!hasValue) {
|
|
2311
|
-
cachedValue = originalGetter.call(this);
|
|
2312
|
-
hasValue = true;
|
|
2313
|
-
}
|
|
2314
|
-
return cachedValue;
|
|
2315
|
-
},
|
|
2316
|
-
enumerable: true,
|
|
2317
|
-
configurable: true
|
|
2318
|
-
});
|
|
2319
|
-
}
|
|
2320
|
-
}
|
|
2321
|
-
/**
|
|
2322
|
-
* Get all lazy field names from a class instance.
|
|
2323
|
-
*
|
|
2324
|
-
* @param instance - Instance to inspect
|
|
2325
|
-
* @returns Set of lazy property names
|
|
2326
|
-
*/
|
|
2327
|
-
function getLazyFields(instance$1) {
|
|
2328
|
-
const lazyFields = instance$1.constructor[LAZY_FIELDS_KEY];
|
|
2329
|
-
return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
|
-
//#endregion
|
|
2333
|
-
//#region src/decorators/lazy.ts
|
|
2334
|
-
/**
|
|
2335
|
-
* Decorator that marks a getter as lazy-evaluated and cached.
|
|
2336
|
-
*
|
|
2337
|
-
* **What "lazy" means here:**
|
|
2338
|
-
* 1. Data is lazily fetched from Rust bindings only when the property is accessed (not eagerly on construction)
|
|
2339
|
-
* 2. Once fetched, the data is cached for subsequent accesses (performance optimization)
|
|
2340
|
-
* 3. Despite being a getter, it behaves like a plain object property (enumerable, appears in Object.keys())
|
|
2341
|
-
*
|
|
2342
|
-
* **Important**: Properties decorated with `@lazyProp` are defined as own enumerable
|
|
2343
|
-
* properties on each instance (not on the prototype). This ensures they:
|
|
2344
|
-
* - Appear in Object.keys() and Object.getOwnPropertyNames()
|
|
2345
|
-
* - Are included in object spreads ({...obj})
|
|
2346
|
-
* - Are enumerable in for...in loops
|
|
2347
|
-
*
|
|
2348
|
-
* Classes using this decorator must extend `PlainObjectLike` base class.
|
|
2349
|
-
*
|
|
2350
|
-
* @example
|
|
2351
|
-
* ```typescript
|
|
2352
|
-
* class MyClass extends PlainObjectLike {
|
|
2353
|
-
* @lazyProp
|
|
2354
|
-
* get expensiveValue() {
|
|
2355
|
-
* return someExpensiveComputation();
|
|
2356
|
-
* }
|
|
2357
|
-
* }
|
|
2358
|
-
* ```
|
|
2359
|
-
*/
|
|
2360
|
-
function lazyProp(target, propertyKey, descriptor) {
|
|
2361
|
-
if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Map();
|
|
2362
|
-
const originalGetter = descriptor.get;
|
|
2363
|
-
target.constructor[LAZY_FIELDS_KEY].set(propertyKey, originalGetter);
|
|
2364
|
-
return {
|
|
2365
|
-
enumerable: false,
|
|
2366
|
-
configurable: true
|
|
2367
|
-
};
|
|
2368
|
-
}
|
|
2369
|
-
|
|
2370
|
-
//#endregion
|
|
2371
|
-
//#region src/utils/asset-source.ts
|
|
2372
|
-
function transformAssetSource(bindingAssetSource$1) {
|
|
2373
|
-
return bindingAssetSource$1.inner;
|
|
2374
|
-
}
|
|
2375
|
-
function bindingAssetSource(source) {
|
|
2376
|
-
return { inner: source };
|
|
2377
|
-
}
|
|
2378
|
-
|
|
2379
|
-
//#endregion
|
|
2380
|
-
//#region \0@oxc-project+runtime@0.97.0/helpers/decorate.js
|
|
2381
|
-
function __decorate(decorators, target, key, desc) {
|
|
2382
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2383
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2384
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2385
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
//#endregion
|
|
2389
|
-
//#region src/types/output-asset-impl.ts
|
|
2390
|
-
var OutputAssetImpl = class extends PlainObjectLike {
|
|
2391
|
-
type = "asset";
|
|
2392
|
-
constructor(bindingAsset) {
|
|
2393
|
-
super();
|
|
2394
|
-
this.bindingAsset = bindingAsset;
|
|
2395
|
-
}
|
|
2396
|
-
get fileName() {
|
|
2397
|
-
return this.bindingAsset.getFileName();
|
|
2398
|
-
}
|
|
2399
|
-
get originalFileName() {
|
|
2400
|
-
return this.bindingAsset.getOriginalFileName() || null;
|
|
2401
|
-
}
|
|
2402
|
-
get originalFileNames() {
|
|
2403
|
-
return this.bindingAsset.getOriginalFileNames();
|
|
2404
|
-
}
|
|
2405
|
-
get name() {
|
|
2406
|
-
return this.bindingAsset.getName() ?? void 0;
|
|
2407
|
-
}
|
|
2408
|
-
get names() {
|
|
2409
|
-
return this.bindingAsset.getNames();
|
|
2410
|
-
}
|
|
2411
|
-
get source() {
|
|
2412
|
-
return transformAssetSource(this.bindingAsset.getSource());
|
|
2413
|
-
}
|
|
2414
|
-
__rolldown_external_memory_handle__(keepDataAlive) {
|
|
2415
|
-
if (keepDataAlive) this.#evaluateAllLazyFields();
|
|
2416
|
-
return this.bindingAsset.dropInner();
|
|
2417
|
-
}
|
|
2418
|
-
#evaluateAllLazyFields() {
|
|
2419
|
-
for (const field of getLazyFields(this)) this[field];
|
|
2420
|
-
}
|
|
2421
|
-
};
|
|
2422
|
-
__decorate([lazyProp], OutputAssetImpl.prototype, "fileName", null);
|
|
2423
|
-
__decorate([lazyProp], OutputAssetImpl.prototype, "originalFileName", null);
|
|
2424
|
-
__decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
|
|
2425
|
-
__decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
|
|
2426
|
-
__decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
|
|
2427
|
-
__decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
|
|
2428
|
-
|
|
2429
|
-
//#endregion
|
|
2430
|
-
//#region src/utils/transform-rendered-module.ts
|
|
2431
|
-
function transformToRenderedModule(bindingRenderedModule) {
|
|
2432
|
-
return {
|
|
2433
|
-
get code() {
|
|
2434
|
-
return bindingRenderedModule.code;
|
|
2435
|
-
},
|
|
2436
|
-
get renderedLength() {
|
|
2437
|
-
return bindingRenderedModule.code?.length || 0;
|
|
2438
|
-
},
|
|
2439
|
-
get renderedExports() {
|
|
2440
|
-
return bindingRenderedModule.renderedExports;
|
|
2441
|
-
}
|
|
2442
|
-
};
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
//#endregion
|
|
2446
|
-
//#region src/utils/transform-rendered-chunk.ts
|
|
2447
|
-
function transformRenderedChunk(chunk) {
|
|
2448
|
-
let modules = null;
|
|
2449
|
-
return {
|
|
2450
|
-
type: "chunk",
|
|
2451
|
-
get name() {
|
|
2452
|
-
return chunk.name;
|
|
2453
|
-
},
|
|
2454
|
-
get isEntry() {
|
|
2455
|
-
return chunk.isEntry;
|
|
2456
|
-
},
|
|
2457
|
-
get isDynamicEntry() {
|
|
2458
|
-
return chunk.isDynamicEntry;
|
|
2459
|
-
},
|
|
2460
|
-
get facadeModuleId() {
|
|
2461
|
-
return chunk.facadeModuleId;
|
|
2462
|
-
},
|
|
2463
|
-
get moduleIds() {
|
|
2464
|
-
return chunk.moduleIds;
|
|
2465
|
-
},
|
|
2466
|
-
get exports() {
|
|
2467
|
-
return chunk.exports;
|
|
2468
|
-
},
|
|
2469
|
-
get fileName() {
|
|
2470
|
-
return chunk.fileName;
|
|
2471
|
-
},
|
|
2472
|
-
get imports() {
|
|
2473
|
-
return chunk.imports;
|
|
2474
|
-
},
|
|
2475
|
-
get dynamicImports() {
|
|
2476
|
-
return chunk.dynamicImports;
|
|
2477
|
-
},
|
|
2478
|
-
get modules() {
|
|
2479
|
-
if (!modules) modules = transformChunkModules(chunk.modules);
|
|
2480
|
-
return modules;
|
|
2481
|
-
}
|
|
2482
|
-
};
|
|
2483
|
-
}
|
|
2484
|
-
function transformChunkModules(modules) {
|
|
2485
|
-
const result = {};
|
|
2486
|
-
for (let i = 0; i < modules.values.length; i++) {
|
|
2487
|
-
let key = modules.keys[i];
|
|
2488
|
-
const mod = modules.values[i];
|
|
2489
|
-
result[key] = transformToRenderedModule(mod);
|
|
2490
|
-
}
|
|
2491
|
-
return result;
|
|
2492
|
-
}
|
|
2493
|
-
|
|
2494
|
-
//#endregion
|
|
2495
|
-
//#region src/types/output-chunk-impl.ts
|
|
2496
|
-
var OutputChunkImpl = class extends PlainObjectLike {
|
|
2497
|
-
type = "chunk";
|
|
2498
|
-
constructor(bindingChunk) {
|
|
2499
|
-
super();
|
|
2500
|
-
this.bindingChunk = bindingChunk;
|
|
2501
|
-
}
|
|
2502
|
-
get fileName() {
|
|
2503
|
-
return this.bindingChunk.getFileName();
|
|
2504
|
-
}
|
|
2505
|
-
get name() {
|
|
2506
|
-
return this.bindingChunk.getName();
|
|
2507
|
-
}
|
|
2508
|
-
get exports() {
|
|
2509
|
-
return this.bindingChunk.getExports();
|
|
2510
|
-
}
|
|
2511
|
-
get isEntry() {
|
|
2512
|
-
return this.bindingChunk.getIsEntry();
|
|
2513
|
-
}
|
|
2514
|
-
get facadeModuleId() {
|
|
2515
|
-
return this.bindingChunk.getFacadeModuleId() || null;
|
|
2516
|
-
}
|
|
2517
|
-
get isDynamicEntry() {
|
|
2518
|
-
return this.bindingChunk.getIsDynamicEntry();
|
|
2519
|
-
}
|
|
2520
|
-
get sourcemapFileName() {
|
|
2521
|
-
return this.bindingChunk.getSourcemapFileName() || null;
|
|
2522
|
-
}
|
|
2523
|
-
get preliminaryFileName() {
|
|
2524
|
-
return this.bindingChunk.getPreliminaryFileName();
|
|
2525
|
-
}
|
|
2526
|
-
get code() {
|
|
2527
|
-
return this.bindingChunk.getCode();
|
|
2528
|
-
}
|
|
2529
|
-
get modules() {
|
|
2530
|
-
return transformChunkModules(this.bindingChunk.getModules());
|
|
2531
|
-
}
|
|
2532
|
-
get imports() {
|
|
2533
|
-
return this.bindingChunk.getImports();
|
|
2534
|
-
}
|
|
2535
|
-
get dynamicImports() {
|
|
2536
|
-
return this.bindingChunk.getDynamicImports();
|
|
2537
|
-
}
|
|
2538
|
-
get moduleIds() {
|
|
2539
|
-
return this.bindingChunk.getModuleIds();
|
|
2540
|
-
}
|
|
2541
|
-
get map() {
|
|
2542
|
-
const mapString = this.bindingChunk.getMap();
|
|
2543
|
-
return mapString ? transformToRollupSourceMap(mapString) : null;
|
|
2544
|
-
}
|
|
2545
|
-
__rolldown_external_memory_handle__(keepDataAlive) {
|
|
2546
|
-
if (keepDataAlive) this.#evaluateAllLazyFields();
|
|
2547
|
-
return this.bindingChunk.dropInner();
|
|
2548
|
-
}
|
|
2549
|
-
#evaluateAllLazyFields() {
|
|
2550
|
-
for (const field of getLazyFields(this)) this[field];
|
|
2551
|
-
}
|
|
2552
|
-
};
|
|
2553
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "fileName", null);
|
|
2554
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "name", null);
|
|
2555
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "exports", null);
|
|
2556
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "isEntry", null);
|
|
2557
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "facadeModuleId", null);
|
|
2558
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "isDynamicEntry", null);
|
|
2559
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "sourcemapFileName", null);
|
|
2560
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "preliminaryFileName", null);
|
|
2561
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "code", null);
|
|
2562
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "modules", null);
|
|
2563
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
|
|
2564
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
|
|
2565
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
|
|
2566
|
-
__decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
|
|
2567
|
-
|
|
2568
|
-
//#endregion
|
|
2569
|
-
//#region src/types/sourcemap.ts
|
|
2570
|
-
function bindingifySourcemap$1(map) {
|
|
2571
|
-
if (map == null) return;
|
|
2572
|
-
return { inner: typeof map === "string" ? map : {
|
|
2573
|
-
file: map.file ?? void 0,
|
|
2574
|
-
mappings: map.mappings,
|
|
2575
|
-
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
|
|
2576
|
-
sources: map.sources?.map((s) => s ?? void 0),
|
|
2577
|
-
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
|
|
2578
|
-
names: map.names,
|
|
2579
|
-
x_google_ignoreList: map.x_google_ignoreList,
|
|
2580
|
-
debugId: "debugId" in map ? map.debugId : void 0
|
|
2581
|
-
} };
|
|
2582
|
-
}
|
|
2583
|
-
|
|
2584
|
-
//#endregion
|
|
2585
|
-
//#region src/utils/transform-to-rollup-output.ts
|
|
2586
|
-
function transformToRollupSourceMap(map) {
|
|
2587
|
-
const obj = {
|
|
2588
|
-
...JSON.parse(map),
|
|
2589
|
-
toString() {
|
|
2590
|
-
return JSON.stringify(obj);
|
|
2591
|
-
},
|
|
2592
|
-
toUrl() {
|
|
2593
|
-
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
2594
|
-
}
|
|
2595
|
-
};
|
|
2596
|
-
return obj;
|
|
2597
|
-
}
|
|
2598
|
-
function transformToRollupOutputChunk(bindingChunk) {
|
|
2599
|
-
return new OutputChunkImpl(bindingChunk);
|
|
2600
|
-
}
|
|
2601
|
-
function transformToMutableRollupOutputChunk(bindingChunk, changed) {
|
|
2602
|
-
const chunk = {
|
|
2603
|
-
type: "chunk",
|
|
2604
|
-
get code() {
|
|
2605
|
-
return bindingChunk.getCode();
|
|
2606
|
-
},
|
|
2607
|
-
fileName: bindingChunk.getFileName(),
|
|
2608
|
-
name: bindingChunk.getName(),
|
|
2609
|
-
get modules() {
|
|
2610
|
-
return transformChunkModules(bindingChunk.getModules());
|
|
2611
|
-
},
|
|
2612
|
-
get imports() {
|
|
2613
|
-
return bindingChunk.getImports();
|
|
2614
|
-
},
|
|
2615
|
-
get dynamicImports() {
|
|
2616
|
-
return bindingChunk.getDynamicImports();
|
|
2617
|
-
},
|
|
2618
|
-
exports: bindingChunk.getExports(),
|
|
2619
|
-
isEntry: bindingChunk.getIsEntry(),
|
|
2620
|
-
facadeModuleId: bindingChunk.getFacadeModuleId() || null,
|
|
2621
|
-
isDynamicEntry: bindingChunk.getIsDynamicEntry(),
|
|
2622
|
-
get moduleIds() {
|
|
2623
|
-
return bindingChunk.getModuleIds();
|
|
2624
|
-
},
|
|
2625
|
-
get map() {
|
|
2626
|
-
const map = bindingChunk.getMap();
|
|
2627
|
-
return map ? transformToRollupSourceMap(map) : null;
|
|
2628
|
-
},
|
|
2629
|
-
sourcemapFileName: bindingChunk.getSourcemapFileName() || null,
|
|
2630
|
-
preliminaryFileName: bindingChunk.getPreliminaryFileName()
|
|
2631
|
-
};
|
|
2632
|
-
const cache = {};
|
|
2633
|
-
return new Proxy(chunk, {
|
|
2634
|
-
get(target, p) {
|
|
2635
|
-
if (p in cache) return cache[p];
|
|
2636
|
-
const value = target[p];
|
|
2637
|
-
cache[p] = value;
|
|
2638
|
-
return value;
|
|
2639
|
-
},
|
|
2640
|
-
set(_target, p, newValue) {
|
|
2641
|
-
cache[p] = newValue;
|
|
2642
|
-
changed.updated.add(bindingChunk.getFileName());
|
|
2643
|
-
return true;
|
|
2644
|
-
},
|
|
2645
|
-
has(target, p) {
|
|
2646
|
-
if (p in cache) return true;
|
|
2647
|
-
return p in target;
|
|
2648
|
-
}
|
|
2649
|
-
});
|
|
2650
|
-
}
|
|
2651
|
-
function transformToRollupOutputAsset(bindingAsset) {
|
|
2652
|
-
return new OutputAssetImpl(bindingAsset);
|
|
2653
|
-
}
|
|
2654
|
-
function transformToMutableRollupOutputAsset(bindingAsset, changed) {
|
|
2655
|
-
const asset = {
|
|
2656
|
-
type: "asset",
|
|
2657
|
-
fileName: bindingAsset.getFileName(),
|
|
2658
|
-
originalFileName: bindingAsset.getOriginalFileName() || null,
|
|
2659
|
-
originalFileNames: bindingAsset.getOriginalFileNames(),
|
|
2660
|
-
get source() {
|
|
2661
|
-
return transformAssetSource(bindingAsset.getSource());
|
|
2662
|
-
},
|
|
2663
|
-
name: bindingAsset.getName() ?? void 0,
|
|
2664
|
-
names: bindingAsset.getNames()
|
|
2665
|
-
};
|
|
2666
|
-
const cache = {};
|
|
2667
|
-
return new Proxy(asset, {
|
|
2668
|
-
get(target, p) {
|
|
2669
|
-
if (p in cache) return cache[p];
|
|
2670
|
-
const value = target[p];
|
|
2671
|
-
cache[p] = value;
|
|
2672
|
-
return value;
|
|
2673
|
-
},
|
|
2674
|
-
set(_target, p, newValue) {
|
|
2675
|
-
cache[p] = newValue;
|
|
2676
|
-
changed.updated.add(bindingAsset.getFileName());
|
|
2677
|
-
return true;
|
|
2678
|
-
}
|
|
2679
|
-
});
|
|
2680
|
-
}
|
|
2681
|
-
function transformToRollupOutput(output) {
|
|
2682
|
-
const { chunks, assets } = output;
|
|
2683
|
-
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
|
|
2684
|
-
}
|
|
2685
|
-
function transformToMutableRollupOutput(output, changed) {
|
|
2686
|
-
const { chunks, assets } = output;
|
|
2687
|
-
return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
|
|
2688
|
-
}
|
|
2689
|
-
function transformToOutputBundle(context, output, changed) {
|
|
2690
|
-
const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
2691
|
-
return new Proxy(bundle, {
|
|
2692
|
-
set(_target, _p, _newValue, _receiver) {
|
|
2693
|
-
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
2694
|
-
Error.stackTraceLimit = 2;
|
|
2695
|
-
const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
|
|
2696
|
-
const stack = new Error(message).stack ?? message;
|
|
2697
|
-
Error.stackTraceLimit = originalStackTraceLimit;
|
|
2698
|
-
context.warn({
|
|
2699
|
-
message: stack,
|
|
2700
|
-
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
2701
|
-
});
|
|
2702
|
-
return true;
|
|
2703
|
-
},
|
|
2704
|
-
deleteProperty(target, property) {
|
|
2705
|
-
if (typeof property === "string") changed.deleted.add(property);
|
|
2706
|
-
return true;
|
|
2707
|
-
}
|
|
2708
|
-
});
|
|
2709
|
-
}
|
|
2710
|
-
function collectChangedBundle(changed, bundle) {
|
|
2711
|
-
const changes = {};
|
|
2712
|
-
for (const key in bundle) {
|
|
2713
|
-
if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
|
|
2714
|
-
const item = bundle[key];
|
|
2715
|
-
if (item.type === "asset") changes[key] = {
|
|
2716
|
-
filename: item.fileName,
|
|
2717
|
-
originalFileNames: item.originalFileNames,
|
|
2718
|
-
source: bindingAssetSource(item.source),
|
|
2719
|
-
names: item.names
|
|
2720
|
-
};
|
|
2721
|
-
else changes[key] = {
|
|
2722
|
-
code: item.code,
|
|
2723
|
-
filename: item.fileName,
|
|
2724
|
-
name: item.name,
|
|
2725
|
-
isEntry: item.isEntry,
|
|
2726
|
-
exports: item.exports,
|
|
2727
|
-
modules: {},
|
|
2728
|
-
imports: item.imports,
|
|
2729
|
-
dynamicImports: item.dynamicImports,
|
|
2730
|
-
facadeModuleId: item.facadeModuleId || void 0,
|
|
2731
|
-
isDynamicEntry: item.isDynamicEntry,
|
|
2732
|
-
moduleIds: item.moduleIds,
|
|
2733
|
-
map: bindingifySourcemap$1(item.map),
|
|
2734
|
-
sourcemapFilename: item.sourcemapFileName || void 0,
|
|
2735
|
-
preliminaryFilename: item.preliminaryFileName
|
|
2736
|
-
};
|
|
2737
|
-
}
|
|
2738
|
-
return {
|
|
2739
|
-
changes,
|
|
2740
|
-
deleted: changed.deleted
|
|
2741
|
-
};
|
|
2742
|
-
}
|
|
2743
|
-
|
|
2744
2179
|
//#endregion
|
|
2745
2180
|
//#region src/types/rolldown-output-impl.ts
|
|
2746
2181
|
var RolldownOutputImpl = class extends PlainObjectLike {
|
|
@@ -2766,7 +2201,7 @@ var RolldownOutputImpl = class extends PlainObjectLike {
|
|
|
2766
2201
|
__decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
|
|
2767
2202
|
|
|
2768
2203
|
//#endregion
|
|
2769
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.
|
|
2204
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.99.0/node_modules/oxc-parser/src-js/wrap.js
|
|
2770
2205
|
function wrap$1(result) {
|
|
2771
2206
|
let program, module, comments, errors;
|
|
2772
2207
|
return {
|
|
@@ -2802,10 +2237,24 @@ function applyFix(program, fixPath) {
|
|
|
2802
2237
|
} catch {}
|
|
2803
2238
|
}
|
|
2804
2239
|
|
|
2240
|
+
//#endregion
|
|
2241
|
+
//#region src/utils/parse.ts
|
|
2242
|
+
/**
|
|
2243
|
+
* Parse asynchronously.
|
|
2244
|
+
*
|
|
2245
|
+
* Note: This function can be slower than `parseSync` due to the overhead of spawning a thread.
|
|
2246
|
+
*/
|
|
2247
|
+
async function parse$1(filename, sourceText, options) {
|
|
2248
|
+
return wrap$1(await parse(filename, sourceText, options));
|
|
2249
|
+
}
|
|
2250
|
+
/** Parse synchronously. */
|
|
2251
|
+
function parseSync$1(filename, sourceText, options) {
|
|
2252
|
+
return wrap$1(parseSync(filename, sourceText, options));
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2805
2255
|
//#endregion
|
|
2806
2256
|
//#region src/parse-ast-index.ts
|
|
2807
2257
|
function wrap(result, sourceText) {
|
|
2808
|
-
result = wrap$1(result);
|
|
2809
2258
|
if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
|
|
2810
2259
|
return result.program;
|
|
2811
2260
|
}
|
|
@@ -2830,7 +2279,7 @@ const defaultParserOptions = {
|
|
|
2830
2279
|
preserveParens: false
|
|
2831
2280
|
};
|
|
2832
2281
|
function parseAst(sourceText, options, filename) {
|
|
2833
|
-
return wrap(parseSync(filename ?? "file.js", sourceText, {
|
|
2282
|
+
return wrap(parseSync$1(filename ?? "file.js", sourceText, {
|
|
2834
2283
|
...defaultParserOptions,
|
|
2835
2284
|
...options
|
|
2836
2285
|
}), sourceText);
|
|
@@ -3328,16 +2777,16 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
3328
2777
|
this.inner = inner;
|
|
3329
2778
|
this.moduleId = moduleId;
|
|
3330
2779
|
this.moduleSource = moduleSource;
|
|
3331
|
-
const getLogHandler
|
|
2780
|
+
const getLogHandler = (handler) => (log, pos) => {
|
|
3332
2781
|
log = normalizeLog(log);
|
|
3333
2782
|
if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
|
|
3334
2783
|
log.id = moduleId;
|
|
3335
2784
|
log.hook = "transform";
|
|
3336
2785
|
handler(log);
|
|
3337
2786
|
};
|
|
3338
|
-
this.debug = getLogHandler
|
|
3339
|
-
this.warn = getLogHandler
|
|
3340
|
-
this.info = getLogHandler
|
|
2787
|
+
this.debug = getLogHandler(this.debug);
|
|
2788
|
+
this.warn = getLogHandler(this.warn);
|
|
2789
|
+
this.info = getLogHandler(this.info);
|
|
3341
2790
|
}
|
|
3342
2791
|
error(e$1, pos) {
|
|
3343
2792
|
if (typeof e$1 === "string") e$1 = { message: e$1 };
|
|
@@ -4242,7 +3691,10 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
4242
3691
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
4243
3692
|
const plugins = rawPlugins.map((plugin) => {
|
|
4244
3693
|
if ("_parallel" in plugin) return;
|
|
4245
|
-
if (plugin instanceof BuiltinPlugin)
|
|
3694
|
+
if (plugin instanceof BuiltinPlugin) {
|
|
3695
|
+
if (plugin.name === "builtin:vite-html") return bindingifyViteHtmlPlugin(plugin, onLog, logLevel, watchMode);
|
|
3696
|
+
return bindingifyBuiltInPlugin(plugin);
|
|
3697
|
+
}
|
|
4246
3698
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
4247
3699
|
});
|
|
4248
3700
|
const normalizedTransform = normalizeTransformOptions(inputOptions);
|
|
@@ -4394,13 +3846,13 @@ function bindingifyInput(input) {
|
|
|
4394
3846
|
};
|
|
4395
3847
|
});
|
|
4396
3848
|
}
|
|
4397
|
-
function bindingifyWatch(watch
|
|
4398
|
-
if (watch
|
|
4399
|
-
buildDelay: watch
|
|
4400
|
-
skipWrite: watch
|
|
4401
|
-
include: normalizedStringOrRegex(watch
|
|
4402
|
-
exclude: normalizedStringOrRegex(watch
|
|
4403
|
-
onInvalidate: (...args$1) => watch
|
|
3849
|
+
function bindingifyWatch(watch) {
|
|
3850
|
+
if (watch) return {
|
|
3851
|
+
buildDelay: watch.buildDelay,
|
|
3852
|
+
skipWrite: watch.skipWrite,
|
|
3853
|
+
include: normalizedStringOrRegex(watch.include),
|
|
3854
|
+
exclude: normalizedStringOrRegex(watch.exclude),
|
|
3855
|
+
onInvalidate: (...args$1) => watch.onInvalidate?.(...args$1)
|
|
4404
3856
|
};
|
|
4405
3857
|
}
|
|
4406
3858
|
function bindingifyTreeshakeOptions(config) {
|
|
@@ -4669,166 +4121,4 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4669
4121
|
};
|
|
4670
4122
|
|
|
4671
4123
|
//#endregion
|
|
4672
|
-
|
|
4673
|
-
const rolldown = async (input) => {
|
|
4674
|
-
validateOption("input", input);
|
|
4675
|
-
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
|
|
4676
|
-
};
|
|
4677
|
-
|
|
4678
|
-
//#endregion
|
|
4679
|
-
//#region src/api/build.ts
|
|
4680
|
-
async function build(options) {
|
|
4681
|
-
if (Array.isArray(options)) return Promise.all(options.map((opts) => build(opts)));
|
|
4682
|
-
else {
|
|
4683
|
-
const { output, write = true, ...inputOptions } = options;
|
|
4684
|
-
const build$1 = await rolldown(inputOptions);
|
|
4685
|
-
try {
|
|
4686
|
-
if (write) return await build$1.write(output);
|
|
4687
|
-
else return await build$1.generate(output);
|
|
4688
|
-
} finally {
|
|
4689
|
-
await build$1.close();
|
|
4690
|
-
}
|
|
4691
|
-
}
|
|
4692
|
-
}
|
|
4693
|
-
|
|
4694
|
-
//#endregion
|
|
4695
|
-
//#region src/api/watch/watch-emitter.ts
|
|
4696
|
-
var WatcherEmitter = class {
|
|
4697
|
-
listeners = /* @__PURE__ */ new Map();
|
|
4698
|
-
timer;
|
|
4699
|
-
constructor() {
|
|
4700
|
-
this.timer = setInterval(() => {}, 1e9);
|
|
4701
|
-
}
|
|
4702
|
-
on(event, listener) {
|
|
4703
|
-
const listeners = this.listeners.get(event);
|
|
4704
|
-
if (listeners) listeners.push(listener);
|
|
4705
|
-
else this.listeners.set(event, [listener]);
|
|
4706
|
-
return this;
|
|
4707
|
-
}
|
|
4708
|
-
off(event, listener) {
|
|
4709
|
-
const listeners = this.listeners.get(event);
|
|
4710
|
-
if (listeners) {
|
|
4711
|
-
const index = listeners.indexOf(listener);
|
|
4712
|
-
if (index !== -1) listeners.splice(index, 1);
|
|
4713
|
-
}
|
|
4714
|
-
return this;
|
|
4715
|
-
}
|
|
4716
|
-
clear(event) {
|
|
4717
|
-
if (this.listeners.has(event)) this.listeners.delete(event);
|
|
4718
|
-
}
|
|
4719
|
-
async onEvent(event) {
|
|
4720
|
-
const listeners = this.listeners.get(event.eventKind());
|
|
4721
|
-
if (listeners) switch (event.eventKind()) {
|
|
4722
|
-
case "close":
|
|
4723
|
-
case "restart":
|
|
4724
|
-
for (const listener of listeners) await listener();
|
|
4725
|
-
break;
|
|
4726
|
-
case "event":
|
|
4727
|
-
for (const listener of listeners) {
|
|
4728
|
-
const code$1 = event.bundleEventKind();
|
|
4729
|
-
switch (code$1) {
|
|
4730
|
-
case "BUNDLE_END":
|
|
4731
|
-
const { duration, output, result } = event.bundleEndData();
|
|
4732
|
-
await listener({
|
|
4733
|
-
code: "BUNDLE_END",
|
|
4734
|
-
duration,
|
|
4735
|
-
output: [output],
|
|
4736
|
-
result
|
|
4737
|
-
});
|
|
4738
|
-
break;
|
|
4739
|
-
case "ERROR":
|
|
4740
|
-
const data = event.bundleErrorData();
|
|
4741
|
-
await listener({
|
|
4742
|
-
code: "ERROR",
|
|
4743
|
-
error: aggregateBindingErrorsIntoJsError(data.error),
|
|
4744
|
-
result: data.result
|
|
4745
|
-
});
|
|
4746
|
-
break;
|
|
4747
|
-
default:
|
|
4748
|
-
await listener({ code: code$1 });
|
|
4749
|
-
break;
|
|
4750
|
-
}
|
|
4751
|
-
}
|
|
4752
|
-
break;
|
|
4753
|
-
case "change":
|
|
4754
|
-
for (const listener of listeners) {
|
|
4755
|
-
const { path, kind } = event.watchChangeData();
|
|
4756
|
-
await listener(path, { event: kind });
|
|
4757
|
-
}
|
|
4758
|
-
break;
|
|
4759
|
-
default: throw new Error(`Unknown event: ${event}`);
|
|
4760
|
-
}
|
|
4761
|
-
}
|
|
4762
|
-
async close() {
|
|
4763
|
-
clearInterval(this.timer);
|
|
4764
|
-
}
|
|
4765
|
-
};
|
|
4766
|
-
|
|
4767
|
-
//#endregion
|
|
4768
|
-
//#region src/api/watch/watcher.ts
|
|
4769
|
-
var Watcher = class {
|
|
4770
|
-
closed;
|
|
4771
|
-
inner;
|
|
4772
|
-
emitter;
|
|
4773
|
-
stopWorkers;
|
|
4774
|
-
constructor(emitter, inner, stopWorkers) {
|
|
4775
|
-
this.closed = false;
|
|
4776
|
-
this.inner = inner;
|
|
4777
|
-
this.emitter = emitter;
|
|
4778
|
-
const originClose = emitter.close.bind(emitter);
|
|
4779
|
-
emitter.close = async () => {
|
|
4780
|
-
await this.close();
|
|
4781
|
-
originClose();
|
|
4782
|
-
};
|
|
4783
|
-
this.stopWorkers = stopWorkers;
|
|
4784
|
-
}
|
|
4785
|
-
async close() {
|
|
4786
|
-
if (this.closed) return;
|
|
4787
|
-
this.closed = true;
|
|
4788
|
-
for (const stop of this.stopWorkers) await stop?.();
|
|
4789
|
-
await this.inner.close();
|
|
4790
|
-
shutdownAsyncRuntime();
|
|
4791
|
-
}
|
|
4792
|
-
start() {
|
|
4793
|
-
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
4794
|
-
}
|
|
4795
|
-
};
|
|
4796
|
-
async function createWatcher(emitter, input) {
|
|
4797
|
-
const options = arraify(input);
|
|
4798
|
-
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
|
|
4799
|
-
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
4800
|
-
})).flat());
|
|
4801
|
-
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4802
|
-
new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4803
|
-
}
|
|
4804
|
-
function getValidNotifyOption(bundlerOptions) {
|
|
4805
|
-
let result;
|
|
4806
|
-
for (const option of bundlerOptions) if (option.inputOptions.watch) {
|
|
4807
|
-
const notifyOption = option.inputOptions.watch.notify;
|
|
4808
|
-
if (notifyOption) if (result) {
|
|
4809
|
-
option.onLog(LOG_LEVEL_WARN, logMultiplyNotifyOption());
|
|
4810
|
-
return result;
|
|
4811
|
-
} else result = notifyOption;
|
|
4812
|
-
}
|
|
4813
|
-
}
|
|
4814
|
-
|
|
4815
|
-
//#endregion
|
|
4816
|
-
//#region src/api/watch/index.ts
|
|
4817
|
-
const watch = (input) => {
|
|
4818
|
-
const emitter = new WatcherEmitter();
|
|
4819
|
-
createWatcher(emitter, input);
|
|
4820
|
-
return emitter;
|
|
4821
|
-
};
|
|
4822
|
-
|
|
4823
|
-
//#endregion
|
|
4824
|
-
//#region src/utils/define-config.ts
|
|
4825
|
-
function defineConfig(config) {
|
|
4826
|
-
return config;
|
|
4827
|
-
}
|
|
4828
|
-
|
|
4829
|
-
//#endregion
|
|
4830
|
-
//#region src/index.ts
|
|
4831
|
-
const VERSION = version;
|
|
4832
|
-
|
|
4833
|
-
//#endregion
|
|
4834
|
-
export { build as a, createBundlerOptions as c, transformToRollupOutput as d, bindingifySourcemap$1 as f, watch as i, normalizeBindingResult as l, PluginDriver as m, VERSION as n, rolldown as o, validateOption as p, defineConfig as r, RolldownBuild as s, BindingMagicString$1 as t, unwrapBindingResult as u };
|
|
4124
|
+
export { unwrapBindingResult as a, validateOption as c, normalizeBindingResult as i, PluginDriver as l, createBundlerOptions as n, parse$1 as o, aggregateBindingErrorsIntoJsError as r, parseSync$1 as s, RolldownBuild as t };
|