@rolldown/browser 1.0.0-beta.46 → 1.0.0-beta.48
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-setup.mjs +3 -4
- package/dist/cli.mjs +22 -10
- package/dist/config.d.mts +3 -2
- package/dist/config.mjs +6 -5
- package/dist/constructors-EhfoQfqh.js +68 -0
- package/dist/experimental-index.browser.mjs +38 -117
- package/dist/experimental-index.d.mts +18 -58
- package/dist/experimental-index.mjs +41 -120
- package/dist/filter-index.d.mts +3 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +2 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +5 -5
- package/dist/{shared/parse-ast-index-DMI5m8Lk.mjs → normalize-string-or-regex-d47jXr3r.js} +38 -110
- package/dist/parallel-plugin-worker.mjs +7 -6
- package/dist/parallel-plugin.d.mts +3 -2
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +2 -2
- package/dist/plugins-index.browser.mjs +39 -0
- package/dist/plugins-index.d.mts +31 -0
- package/dist/plugins-index.mjs +40 -0
- package/dist/rolldown-binding.wasi-browser.js +1 -1
- package/dist/rolldown-binding.wasi.cjs +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-CCMrV5an.d.mts → binding-B4uTNiw2.d.mts} +49 -58
- package/dist/shared/constructors-CaN9lKj2.d.mts +32 -0
- package/dist/shared/constructors-DcEzB0nc.mjs +68 -0
- package/dist/shared/{define-config-Bj-neIhz.d.mts → define-config-Dv3i4cxM.d.mts} +4 -62
- package/dist/shared/{load-config-DnUAKl9P.mjs → load-config-B-QIvCpC.mjs} +2 -2
- package/dist/shared/logs-CPsamAuj.mjs +181 -0
- package/dist/shared/normalize-string-or-regex-CbDij6KB.mjs +46 -0
- package/dist/shared/parse-ast-index-D9jH_38U.mjs +81 -0
- package/dist/shared/{prompt-YGfbLmz5.mjs → prompt-Ckjl2FdJ.mjs} +1 -1
- package/dist/shared/{src-B8saaB3b.mjs → src-CvsuRKGv.mjs} +247 -224
- package/dist/shared/utils-CduIqa7h.d.mts +18 -0
- package/dist/{src-B-7Hrt6w.js → src-DLQqj5Wo.js} +234 -994
- package/package.json +1 -1
- package/dist/shared/binding-BeWSOIj5.mjs +0 -578
- /package/dist/shared/{composable-filters-CgRsnfr3.mjs → composable-filters-CBpK2Fbc.mjs} +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import { a as include, c as or, d as arraify, g as unsupported, h as unreachable, i as id, m as unimplemented, n as code, o as moduleType, p as noop, r as exclude, t as and } from "./composable-filters-
|
|
1
|
+
import { a as logInvalidLogPosition, c as logPluginError, i as logInputHookInOutputPlugin, n as error, o as logMultiplyNotifyOption, r as logCycleLoading, t as augmentCodeLocation } from "./logs-CPsamAuj.mjs";
|
|
2
|
+
import { n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CbDij6KB.mjs";
|
|
3
|
+
import { a as include, c as or, d as arraify, g as unsupported, h as unreachable, i as id, m as unimplemented, n as code, o as moduleType, p as noop, r as exclude, t as and } from "./composable-filters-CBpK2Fbc.mjs";
|
|
4
|
+
import { t as parseAst } from "./parse-ast-index-D9jH_38U.mjs";
|
|
4
5
|
import { Worker, isMainThread } from "node:worker_threads";
|
|
6
|
+
import { BindingAttachDebugInfo, BindingBundler, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingMagicString as BindingMagicString$1, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
5
7
|
import path from "node:path";
|
|
8
|
+
import { styleText } from "node:util";
|
|
6
9
|
import fsp from "node:fs/promises";
|
|
7
10
|
import os from "node:os";
|
|
8
11
|
|
|
@@ -208,9 +211,8 @@ const { onExit, load, unload } = signalExitWrap(processOk(process$1) ? new Signa
|
|
|
208
211
|
|
|
209
212
|
//#endregion
|
|
210
213
|
//#region src/setup.ts
|
|
211
|
-
var import_binding$8 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
212
214
|
if (isMainThread) {
|
|
213
|
-
const subscriberGuard =
|
|
215
|
+
const subscriberGuard = initTraceSubscriber();
|
|
214
216
|
onExit(() => {
|
|
215
217
|
subscriberGuard?.close();
|
|
216
218
|
});
|
|
@@ -218,41 +220,9 @@ if (isMainThread) {
|
|
|
218
220
|
|
|
219
221
|
//#endregion
|
|
220
222
|
//#region package.json
|
|
221
|
-
var version = "1.0.0-beta.
|
|
223
|
+
var version = "1.0.0-beta.48";
|
|
222
224
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
223
225
|
|
|
224
|
-
//#endregion
|
|
225
|
-
//#region src/builtin-plugin/utils.ts
|
|
226
|
-
var import_binding$7 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
227
|
-
var BuiltinPlugin = class {
|
|
228
|
-
constructor(name, _options) {
|
|
229
|
-
this.name = name;
|
|
230
|
-
this._options = _options;
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
function makeBuiltinPluginCallable(plugin) {
|
|
234
|
-
let callablePlugin = new import_binding$7.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
|
|
235
|
-
const wrappedPlugin = plugin;
|
|
236
|
-
for (const key in callablePlugin) wrappedPlugin[key] = async function(...args$1) {
|
|
237
|
-
try {
|
|
238
|
-
return await callablePlugin[key](...args$1);
|
|
239
|
-
} catch (e$1) {
|
|
240
|
-
if (e$1 instanceof Error && !e$1.stack?.includes("at ")) Error.captureStackTrace(e$1, wrappedPlugin[key]);
|
|
241
|
-
return error(logPluginError(e$1, plugin.name, {
|
|
242
|
-
hook: key,
|
|
243
|
-
id: key === "transform" ? args$1[2] : void 0
|
|
244
|
-
}));
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
return wrappedPlugin;
|
|
248
|
-
}
|
|
249
|
-
function bindingifyBuiltInPlugin(plugin) {
|
|
250
|
-
return {
|
|
251
|
-
__name: plugin.name,
|
|
252
|
-
options: plugin._options
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
|
|
256
226
|
//#endregion
|
|
257
227
|
//#region src/log/logging.ts
|
|
258
228
|
const LOG_LEVEL_SILENT = "silent";
|
|
@@ -1650,6 +1620,17 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
|
|
|
1650
1620
|
return result;
|
|
1651
1621
|
}
|
|
1652
1622
|
|
|
1623
|
+
//#endregion
|
|
1624
|
+
//#region src/utils/style-text.ts
|
|
1625
|
+
/**
|
|
1626
|
+
* Cross-platform styleText utility that works in both Node.js and browser environments
|
|
1627
|
+
* In Node.js, it uses the native `styleText` from `node:util`
|
|
1628
|
+
* In browser, it provides empty styling functions for compatibility
|
|
1629
|
+
*/
|
|
1630
|
+
function styleText$1(...args$1) {
|
|
1631
|
+
return styleText(...args$1);
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1653
1634
|
//#endregion
|
|
1654
1635
|
//#region src/utils/validator.ts
|
|
1655
1636
|
const StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
@@ -1746,8 +1727,8 @@ const TransformOptionsSchema = object({
|
|
|
1746
1727
|
JsxOptionsSchema
|
|
1747
1728
|
])),
|
|
1748
1729
|
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment")),
|
|
1749
|
-
define: optional(record(string(), string())),
|
|
1750
|
-
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
1730
|
+
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
1731
|
+
inject: pipe(optional(record(string(), union([string(), tuple([string(), string()])]))), description("Inject import statements on demand")),
|
|
1751
1732
|
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names"))
|
|
1752
1733
|
});
|
|
1753
1734
|
const WatchOptionsSchema = strictObject({
|
|
@@ -1872,11 +1853,11 @@ const InputOptionsSchema = strictObject({
|
|
|
1872
1853
|
literal("browser"),
|
|
1873
1854
|
literal("neutral"),
|
|
1874
1855
|
literal("node")
|
|
1875
|
-
])), description(`Platform for which the code should be generated (node, ${styleText("underline", "browser")}, neutral)`)),
|
|
1856
|
+
])), description(`Platform for which the code should be generated (node, ${styleText$1("underline", "browser")}, neutral)`)),
|
|
1876
1857
|
shimMissingExports: pipe(optional(boolean()), description("Create shim variables for missing exports")),
|
|
1877
1858
|
treeshake: optional(TreeshakingOptionsSchema),
|
|
1878
1859
|
optimization: optional(OptimizationOptionsSchema),
|
|
1879
|
-
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${styleText("dim", "silent")}, ${styleText(["underline", "gray"], "info")}, debug, ${styleText("yellow", "warn")})`)),
|
|
1860
|
+
logLevel: pipe(optional(LogLevelOptionSchema), description(`Log level (${styleText$1("dim", "silent")}, ${styleText$1(["underline", "gray"], "info")}, debug, ${styleText$1("yellow", "warn")})`)),
|
|
1880
1861
|
onLog: optional(OnLogSchema),
|
|
1881
1862
|
onwarn: optional(OnwarnSchema),
|
|
1882
1863
|
moduleTypes: pipe(optional(ModuleTypesSchema), description("Module types for customized extensions")),
|
|
@@ -1901,14 +1882,9 @@ const InputOptionsSchema = strictObject({
|
|
|
1901
1882
|
})])),
|
|
1902
1883
|
nativeMagicString: optional(boolean())
|
|
1903
1884
|
})),
|
|
1904
|
-
define: pipe(optional(record(string(), string())), description("Define global variables")),
|
|
1905
|
-
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
1906
|
-
profilerNames: optional(boolean()),
|
|
1907
1885
|
transform: optional(TransformOptionsSchema),
|
|
1908
1886
|
watch: optional(union([WatchOptionsSchema, literal(false)])),
|
|
1909
|
-
dropLabels: pipe(optional(array(string())), description("Remove labeled statements with these label names")),
|
|
1910
1887
|
checks: optional(ChecksOptionsSchema),
|
|
1911
|
-
keepNames: pipe(optional(boolean()), description("Keep function/class name")),
|
|
1912
1888
|
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.")),
|
|
1913
1889
|
preserveEntrySignatures: pipe(optional(union([
|
|
1914
1890
|
literal("strict"),
|
|
@@ -1921,7 +1897,6 @@ const InputOptionsSchema = strictObject({
|
|
|
1921
1897
|
const InputCliOverrideSchema = strictObject({
|
|
1922
1898
|
input: pipe(optional(array(string())), description("Entry file")),
|
|
1923
1899
|
external: pipe(optional(array(string())), description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
1924
|
-
inject: pipe(optional(record(string(), string())), description("Inject import statements on demand")),
|
|
1925
1900
|
treeshake: pipe(optional(boolean()), description("enable treeshaking")),
|
|
1926
1901
|
makeAbsoluteExternalsRelative: pipe(optional(boolean()), description("Prevent normalization of external imports")),
|
|
1927
1902
|
preserveEntrySignatures: pipe(optional(literal(false)), description("Avoid facade chunks for entry points")),
|
|
@@ -1936,7 +1911,6 @@ const InputCliOptionsSchema = omit(strictObject({
|
|
|
1936
1911
|
"onLog",
|
|
1937
1912
|
"resolve",
|
|
1938
1913
|
"experimental",
|
|
1939
|
-
"profilerNames",
|
|
1940
1914
|
"watch"
|
|
1941
1915
|
]);
|
|
1942
1916
|
const ModuleFormatSchema = union([
|
|
@@ -1996,18 +1970,18 @@ const OutputOptionsSchema = strictObject({
|
|
|
1996
1970
|
literal("named"),
|
|
1997
1971
|
literal("default"),
|
|
1998
1972
|
literal("none")
|
|
1999
|
-
])), description(`Specify a export mode (${styleText("underline", "auto")}, named, default, none)`)),
|
|
1973
|
+
])), description(`Specify a export mode (${styleText$1("underline", "auto")}, named, default, none)`)),
|
|
2000
1974
|
hashCharacters: pipe(optional(union([
|
|
2001
1975
|
literal("base64"),
|
|
2002
1976
|
literal("base36"),
|
|
2003
1977
|
literal("hex")
|
|
2004
1978
|
])), description("Use the specified character set for file hashes")),
|
|
2005
|
-
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${styleText("underline", "esm")}, cjs, and iife)`)),
|
|
1979
|
+
format: pipe(optional(ModuleFormatSchema), description(`Output format of the generated bundle (supports ${styleText$1("underline", "esm")}, cjs, and iife)`)),
|
|
2006
1980
|
sourcemap: pipe(optional(union([
|
|
2007
1981
|
boolean(),
|
|
2008
1982
|
literal("inline"),
|
|
2009
1983
|
literal("hidden")
|
|
2010
|
-
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${styleText("bold", "pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
1984
|
+
])), description(`Generate sourcemap (\`-s inline\` for inline, or ${styleText$1("bold", "pass the `-s` on the last argument if you want to generate `.map` file")})`)),
|
|
2011
1985
|
sourcemapBaseUrl: pipe(optional(string()), description("Base URL used to prefix sourcemap paths")),
|
|
2012
1986
|
sourcemapDebugIds: pipe(optional(boolean()), description("Inject sourcemap debug IDs")),
|
|
2013
1987
|
sourcemapIgnoreList: optional(union([
|
|
@@ -2054,7 +2028,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
2054
2028
|
keepNames: pipe(optional(boolean()), description("Keep function and class names after bundling"))
|
|
2055
2029
|
});
|
|
2056
2030
|
const getAddonDescription = (placement, wrapper) => {
|
|
2057
|
-
return `Code to insert the ${styleText("bold", placement)} of the bundled file (${styleText("bold", wrapper)} the wrapper function)`;
|
|
2031
|
+
return `Code to insert the ${styleText$1("bold", placement)} of the bundled file (${styleText$1("bold", wrapper)} the wrapper function)`;
|
|
2058
2032
|
};
|
|
2059
2033
|
const OutputCliOverrideSchema = strictObject({
|
|
2060
2034
|
assetFileNames: pipe(optional(string()), description("Name pattern for asset files")),
|
|
@@ -2138,33 +2112,72 @@ function getCliSchemaInfo() {
|
|
|
2138
2112
|
}
|
|
2139
2113
|
|
|
2140
2114
|
//#endregion
|
|
2141
|
-
//#region src/
|
|
2115
|
+
//#region src/types/plain-object-like.ts
|
|
2142
2116
|
const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
|
|
2143
|
-
const LAZY_CACHE_PREFIX = "__cached_";
|
|
2144
2117
|
/**
|
|
2145
|
-
*
|
|
2146
|
-
*
|
|
2118
|
+
* Base class for classes that use `@lazyProp` decorated properties.
|
|
2119
|
+
*
|
|
2120
|
+
* **Design Pattern in Rolldown:**
|
|
2121
|
+
* This is a common pattern in Rolldown due to its three-layer architecture:
|
|
2122
|
+
* TypeScript API → NAPI Bindings → Rust Core
|
|
2123
|
+
*
|
|
2124
|
+
* **Why we use getters:**
|
|
2125
|
+
* For performance - to lazily fetch data from Rust bindings only when needed,
|
|
2126
|
+
* rather than eagerly fetching all data during object construction.
|
|
2127
|
+
*
|
|
2128
|
+
* **The problem:**
|
|
2129
|
+
* Getters defined on class prototypes are non-enumerable by default, which breaks:
|
|
2130
|
+
* - Object spread operators ({...obj})
|
|
2131
|
+
* - Object.keys() and similar methods
|
|
2132
|
+
* - Standard JavaScript object semantics
|
|
2133
|
+
*
|
|
2134
|
+
* **The solution:**
|
|
2135
|
+
* This base class automatically converts `@lazyProp` decorated getters into
|
|
2136
|
+
* own enumerable getters on each instance during construction.
|
|
2137
|
+
*
|
|
2138
|
+
* **Result:**
|
|
2139
|
+
* Objects get both lazy-loading performance benefits AND plain JavaScript object behavior.
|
|
2147
2140
|
*
|
|
2148
2141
|
* @example
|
|
2149
2142
|
* ```typescript
|
|
2150
|
-
* class MyClass {
|
|
2151
|
-
* @
|
|
2152
|
-
* get
|
|
2153
|
-
* return
|
|
2143
|
+
* class MyClass extends PlainObjectLike {
|
|
2144
|
+
* @lazyProp
|
|
2145
|
+
* get myProp() {
|
|
2146
|
+
* return fetchFromRustBinding();
|
|
2154
2147
|
* }
|
|
2155
2148
|
* }
|
|
2156
2149
|
* ```
|
|
2157
2150
|
*/
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2151
|
+
var PlainObjectLike = class {
|
|
2152
|
+
constructor() {
|
|
2153
|
+
setupLazyProperties(this);
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
/**
|
|
2157
|
+
* Set up lazy properties as own getters on an instance.
|
|
2158
|
+
* This is called automatically by the `PlainObjectLike` base class constructor.
|
|
2159
|
+
*
|
|
2160
|
+
* @param instance - The instance to set up lazy properties on
|
|
2161
|
+
* @internal
|
|
2162
|
+
*/
|
|
2163
|
+
function setupLazyProperties(instance$1) {
|
|
2164
|
+
const lazyFields = instance$1.constructor[LAZY_FIELDS_KEY];
|
|
2165
|
+
if (!lazyFields) return;
|
|
2166
|
+
for (const [propertyKey, originalGetter] of lazyFields.entries()) {
|
|
2167
|
+
let cachedValue;
|
|
2168
|
+
let hasValue = false;
|
|
2169
|
+
Object.defineProperty(instance$1, propertyKey, {
|
|
2170
|
+
get() {
|
|
2171
|
+
if (!hasValue) {
|
|
2172
|
+
cachedValue = originalGetter.call(this);
|
|
2173
|
+
hasValue = true;
|
|
2174
|
+
}
|
|
2175
|
+
return cachedValue;
|
|
2176
|
+
},
|
|
2177
|
+
enumerable: true,
|
|
2178
|
+
configurable: true
|
|
2179
|
+
});
|
|
2180
|
+
}
|
|
2168
2181
|
}
|
|
2169
2182
|
/**
|
|
2170
2183
|
* Get all lazy field names from a class instance.
|
|
@@ -2173,28 +2186,46 @@ function lazy(target, propertyKey, descriptor) {
|
|
|
2173
2186
|
* @returns Set of lazy property names
|
|
2174
2187
|
*/
|
|
2175
2188
|
function getLazyFields(instance$1) {
|
|
2176
|
-
|
|
2189
|
+
const lazyFields = instance$1.constructor[LAZY_FIELDS_KEY];
|
|
2190
|
+
return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
|
|
2177
2191
|
}
|
|
2178
2192
|
|
|
2179
2193
|
//#endregion
|
|
2180
|
-
//#region src/decorators/
|
|
2194
|
+
//#region src/decorators/lazy.ts
|
|
2181
2195
|
/**
|
|
2182
|
-
* Decorator that
|
|
2183
|
-
*
|
|
2196
|
+
* Decorator that marks a getter as lazy-evaluated and cached.
|
|
2197
|
+
*
|
|
2198
|
+
* **What "lazy" means here:**
|
|
2199
|
+
* 1. Data is lazily fetched from Rust bindings only when the property is accessed (not eagerly on construction)
|
|
2200
|
+
* 2. Once fetched, the data is cached for subsequent accesses (performance optimization)
|
|
2201
|
+
* 3. Despite being a getter, it behaves like a plain object property (enumerable, appears in Object.keys())
|
|
2202
|
+
*
|
|
2203
|
+
* **Important**: Properties decorated with `@lazyProp` are defined as own enumerable
|
|
2204
|
+
* properties on each instance (not on the prototype). This ensures they:
|
|
2205
|
+
* - Appear in Object.keys() and Object.getOwnPropertyNames()
|
|
2206
|
+
* - Are included in object spreads ({...obj})
|
|
2207
|
+
* - Are enumerable in for...in loops
|
|
2208
|
+
*
|
|
2209
|
+
* Classes using this decorator must extend `PlainObjectLike` base class.
|
|
2184
2210
|
*
|
|
2185
2211
|
* @example
|
|
2186
2212
|
* ```typescript
|
|
2187
|
-
* class MyClass {
|
|
2188
|
-
* @
|
|
2189
|
-
*
|
|
2190
|
-
* return
|
|
2213
|
+
* class MyClass extends PlainObjectLike {
|
|
2214
|
+
* @lazyProp
|
|
2215
|
+
* get expensiveValue() {
|
|
2216
|
+
* return someExpensiveComputation();
|
|
2191
2217
|
* }
|
|
2192
2218
|
* }
|
|
2193
2219
|
* ```
|
|
2194
2220
|
*/
|
|
2195
|
-
function
|
|
2196
|
-
|
|
2197
|
-
|
|
2221
|
+
function lazyProp(target, propertyKey, descriptor) {
|
|
2222
|
+
if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Map();
|
|
2223
|
+
const originalGetter = descriptor.get;
|
|
2224
|
+
target.constructor[LAZY_FIELDS_KEY].set(propertyKey, originalGetter);
|
|
2225
|
+
return {
|
|
2226
|
+
enumerable: false,
|
|
2227
|
+
configurable: true
|
|
2228
|
+
};
|
|
2198
2229
|
}
|
|
2199
2230
|
|
|
2200
2231
|
//#endregion
|
|
@@ -2217,9 +2248,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
2217
2248
|
|
|
2218
2249
|
//#endregion
|
|
2219
2250
|
//#region src/types/output-asset-impl.ts
|
|
2220
|
-
var OutputAssetImpl = class {
|
|
2251
|
+
var OutputAssetImpl = class extends PlainObjectLike {
|
|
2221
2252
|
type = "asset";
|
|
2222
2253
|
constructor(bindingAsset) {
|
|
2254
|
+
super();
|
|
2223
2255
|
this.bindingAsset = bindingAsset;
|
|
2224
2256
|
}
|
|
2225
2257
|
get fileName() {
|
|
@@ -2248,13 +2280,12 @@ var OutputAssetImpl = class {
|
|
|
2248
2280
|
for (const field of getLazyFields(this)) this[field];
|
|
2249
2281
|
}
|
|
2250
2282
|
};
|
|
2251
|
-
__decorate([
|
|
2252
|
-
__decorate([
|
|
2253
|
-
__decorate([
|
|
2254
|
-
__decorate([
|
|
2255
|
-
__decorate([
|
|
2256
|
-
__decorate([
|
|
2257
|
-
__decorate([nonEnumerable], OutputAssetImpl.prototype, "__rolldown_external_memory_handle__", null);
|
|
2283
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "fileName", null);
|
|
2284
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "originalFileName", null);
|
|
2285
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
|
|
2286
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
|
|
2287
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
|
|
2288
|
+
__decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
|
|
2258
2289
|
|
|
2259
2290
|
//#endregion
|
|
2260
2291
|
//#region src/utils/transform-rendered-module.ts
|
|
@@ -2323,9 +2354,10 @@ function transformChunkModules(modules) {
|
|
|
2323
2354
|
|
|
2324
2355
|
//#endregion
|
|
2325
2356
|
//#region src/types/output-chunk-impl.ts
|
|
2326
|
-
var OutputChunkImpl = class {
|
|
2357
|
+
var OutputChunkImpl = class extends PlainObjectLike {
|
|
2327
2358
|
type = "chunk";
|
|
2328
2359
|
constructor(bindingChunk) {
|
|
2360
|
+
super();
|
|
2329
2361
|
this.bindingChunk = bindingChunk;
|
|
2330
2362
|
}
|
|
2331
2363
|
get fileName() {
|
|
@@ -2379,21 +2411,20 @@ var OutputChunkImpl = class {
|
|
|
2379
2411
|
for (const field of getLazyFields(this)) this[field];
|
|
2380
2412
|
}
|
|
2381
2413
|
};
|
|
2382
|
-
__decorate([
|
|
2383
|
-
__decorate([
|
|
2384
|
-
__decorate([
|
|
2385
|
-
__decorate([
|
|
2386
|
-
__decorate([
|
|
2387
|
-
__decorate([
|
|
2388
|
-
__decorate([
|
|
2389
|
-
__decorate([
|
|
2390
|
-
__decorate([
|
|
2391
|
-
__decorate([
|
|
2392
|
-
__decorate([
|
|
2393
|
-
__decorate([
|
|
2394
|
-
__decorate([
|
|
2395
|
-
__decorate([
|
|
2396
|
-
__decorate([nonEnumerable], OutputChunkImpl.prototype, "__rolldown_external_memory_handle__", null);
|
|
2414
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "fileName", null);
|
|
2415
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "name", null);
|
|
2416
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "exports", null);
|
|
2417
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "isEntry", null);
|
|
2418
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "facadeModuleId", null);
|
|
2419
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "isDynamicEntry", null);
|
|
2420
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "sourcemapFileName", null);
|
|
2421
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "preliminaryFileName", null);
|
|
2422
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "code", null);
|
|
2423
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "modules", null);
|
|
2424
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
|
|
2425
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
|
|
2426
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
|
|
2427
|
+
__decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
|
|
2397
2428
|
|
|
2398
2429
|
//#endregion
|
|
2399
2430
|
//#region src/types/sourcemap.ts
|
|
@@ -2573,8 +2604,9 @@ function collectChangedBundle(changed, bundle) {
|
|
|
2573
2604
|
|
|
2574
2605
|
//#endregion
|
|
2575
2606
|
//#region src/types/rolldown-output-impl.ts
|
|
2576
|
-
var RolldownOutputImpl = class {
|
|
2607
|
+
var RolldownOutputImpl = class extends PlainObjectLike {
|
|
2577
2608
|
constructor(bindingOutputs) {
|
|
2609
|
+
super();
|
|
2578
2610
|
this.bindingOutputs = bindingOutputs;
|
|
2579
2611
|
}
|
|
2580
2612
|
get output() {
|
|
@@ -2592,8 +2624,7 @@ var RolldownOutputImpl = class {
|
|
|
2592
2624
|
return { freed: true };
|
|
2593
2625
|
}
|
|
2594
2626
|
};
|
|
2595
|
-
__decorate([
|
|
2596
|
-
__decorate([nonEnumerable], RolldownOutputImpl.prototype, "__rolldown_external_memory_handle__", null);
|
|
2627
|
+
__decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
|
|
2597
2628
|
|
|
2598
2629
|
//#endregion
|
|
2599
2630
|
//#region src/utils/error.ts
|
|
@@ -2862,14 +2893,13 @@ function bindingifyRenderChunkFilter(filterOption) {
|
|
|
2862
2893
|
|
|
2863
2894
|
//#endregion
|
|
2864
2895
|
//#region src/plugin/bindingify-plugin-hook-meta.ts
|
|
2865
|
-
var import_binding$6 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
2866
2896
|
function bindingifyPluginHookMeta(options) {
|
|
2867
2897
|
return { order: bindingPluginOrder(options.order) };
|
|
2868
2898
|
}
|
|
2869
2899
|
function bindingPluginOrder(order) {
|
|
2870
2900
|
switch (order) {
|
|
2871
|
-
case "post": return
|
|
2872
|
-
case "pre": return
|
|
2901
|
+
case "post": return BindingPluginOrder.Post;
|
|
2902
|
+
case "pre": return BindingPluginOrder.Pre;
|
|
2873
2903
|
case null:
|
|
2874
2904
|
case void 0: return;
|
|
2875
2905
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
@@ -3030,7 +3060,6 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
3030
3060
|
|
|
3031
3061
|
//#endregion
|
|
3032
3062
|
//#region src/plugin/bindingify-build-hooks.ts
|
|
3033
|
-
var import_binding$5 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
3034
3063
|
function bindingifyBuildStart(args$1) {
|
|
3035
3064
|
const hook = args$1.plugin.buildStart;
|
|
3036
3065
|
if (!hook) return {};
|
|
@@ -3126,11 +3155,15 @@ function bindingifyTransform(args$1) {
|
|
|
3126
3155
|
const { handler, meta, options } = normalizeHook(hook);
|
|
3127
3156
|
return {
|
|
3128
3157
|
plugin: async (ctx, code$1, id$1, meta$1) => {
|
|
3158
|
+
let magicStringInstance, astInstance;
|
|
3129
3159
|
Object.defineProperties(meta$1, {
|
|
3130
3160
|
magicString: { get() {
|
|
3131
|
-
|
|
3161
|
+
if (magicStringInstance) return magicStringInstance;
|
|
3162
|
+
magicStringInstance = new BindingMagicString(code$1);
|
|
3163
|
+
return magicStringInstance;
|
|
3132
3164
|
} },
|
|
3133
3165
|
ast: { get() {
|
|
3166
|
+
if (astInstance) return astInstance;
|
|
3134
3167
|
let lang = "js";
|
|
3135
3168
|
switch (meta$1.moduleType) {
|
|
3136
3169
|
case "js":
|
|
@@ -3141,10 +3174,11 @@ function bindingifyTransform(args$1) {
|
|
|
3141
3174
|
break;
|
|
3142
3175
|
default: break;
|
|
3143
3176
|
}
|
|
3144
|
-
|
|
3177
|
+
astInstance = parseAst(code$1, {
|
|
3145
3178
|
astType: meta$1.moduleType.includes("ts") ? "ts" : "js",
|
|
3146
3179
|
lang
|
|
3147
3180
|
});
|
|
3181
|
+
return astInstance;
|
|
3148
3182
|
} }
|
|
3149
3183
|
});
|
|
3150
3184
|
const transformCtx = new TransformPluginContextImpl(args$1.outputOptions, ctx.inner(), args$1.plugin, args$1.pluginContextData, ctx, id$1, code$1, args$1.onLog, args$1.logLevel, args$1.watchMode);
|
|
@@ -3159,7 +3193,7 @@ function bindingifyTransform(args$1) {
|
|
|
3159
3193
|
let normalizedCode = void 0;
|
|
3160
3194
|
let map = ret.map;
|
|
3161
3195
|
if (typeof ret.code === "string") normalizedCode = ret.code;
|
|
3162
|
-
else if (ret.code instanceof
|
|
3196
|
+
else if (ret.code instanceof BindingMagicString) {
|
|
3163
3197
|
let magicString = ret.code;
|
|
3164
3198
|
normalizedCode = magicString.toString();
|
|
3165
3199
|
let fallbackSourcemap = ctx.sendMagicString(magicString);
|
|
@@ -3584,9 +3618,10 @@ function wrapHandlers(plugin) {
|
|
|
3584
3618
|
|
|
3585
3619
|
//#endregion
|
|
3586
3620
|
//#region src/options/normalized-input-options.ts
|
|
3587
|
-
var NormalizedInputOptionsImpl = class {
|
|
3621
|
+
var NormalizedInputOptionsImpl = class extends PlainObjectLike {
|
|
3588
3622
|
inner;
|
|
3589
3623
|
constructor(inner, onLog) {
|
|
3624
|
+
super();
|
|
3590
3625
|
this.onLog = onLog;
|
|
3591
3626
|
this.inner = inner;
|
|
3592
3627
|
}
|
|
@@ -3606,11 +3641,17 @@ var NormalizedInputOptionsImpl = class {
|
|
|
3606
3641
|
return this.inner.context;
|
|
3607
3642
|
}
|
|
3608
3643
|
};
|
|
3644
|
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "shimMissingExports", null);
|
|
3645
|
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "input", null);
|
|
3646
|
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "cwd", null);
|
|
3647
|
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "platform", null);
|
|
3648
|
+
__decorate([lazyProp], NormalizedInputOptionsImpl.prototype, "context", null);
|
|
3609
3649
|
|
|
3610
3650
|
//#endregion
|
|
3611
3651
|
//#region src/options/normalized-output-options.ts
|
|
3612
|
-
var NormalizedOutputOptionsImpl = class {
|
|
3652
|
+
var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
|
|
3613
3653
|
constructor(inner, outputOptions, normalizedOutputPlugins) {
|
|
3654
|
+
super();
|
|
3614
3655
|
this.inner = inner;
|
|
3615
3656
|
this.outputOptions = outputOptions;
|
|
3616
3657
|
this.normalizedOutputPlugins = normalizedOutputPlugins;
|
|
@@ -3730,6 +3771,42 @@ var NormalizedOutputOptionsImpl = class {
|
|
|
3730
3771
|
return this.inner.minifyInternalExports ?? false;
|
|
3731
3772
|
}
|
|
3732
3773
|
};
|
|
3774
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "dir", null);
|
|
3775
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "entryFileNames", null);
|
|
3776
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "chunkFileNames", null);
|
|
3777
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "assetFileNames", null);
|
|
3778
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
|
|
3779
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
|
|
3780
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
|
|
3781
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
|
|
3782
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssEntryFileNames", null);
|
|
3783
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "cssChunkFileNames", null);
|
|
3784
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
|
|
3785
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
|
|
3786
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "file", null);
|
|
3787
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "inlineDynamicImports", null);
|
|
3788
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "externalLiveBindings", null);
|
|
3789
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "banner", null);
|
|
3790
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "footer", null);
|
|
3791
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "intro", null);
|
|
3792
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "outro", null);
|
|
3793
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "esModule", null);
|
|
3794
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "extend", null);
|
|
3795
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "globals", null);
|
|
3796
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "paths", null);
|
|
3797
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "hashCharacters", null);
|
|
3798
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapDebugIds", null);
|
|
3799
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapIgnoreList", null);
|
|
3800
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapPathTransform", null);
|
|
3801
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minify", null);
|
|
3802
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "legalComments", null);
|
|
3803
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "polyfillRequire", null);
|
|
3804
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "plugins", null);
|
|
3805
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModules", null);
|
|
3806
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "preserveModulesRoot", null);
|
|
3807
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "virtualDirname", null);
|
|
3808
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "topLevelVar", null);
|
|
3809
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "minifyInternalExports", null);
|
|
3733
3810
|
function normalizeAddon(value) {
|
|
3734
3811
|
if (typeof value === "function") return value;
|
|
3735
3812
|
return () => value || "";
|
|
@@ -3832,17 +3909,6 @@ var PluginContextData = class {
|
|
|
3832
3909
|
}
|
|
3833
3910
|
};
|
|
3834
3911
|
|
|
3835
|
-
//#endregion
|
|
3836
|
-
//#region src/utils/normalize-string-or-regex.ts
|
|
3837
|
-
function normalizedStringOrRegex(pattern) {
|
|
3838
|
-
if (!pattern) return;
|
|
3839
|
-
if (!isReadonlyArray(pattern)) return [pattern];
|
|
3840
|
-
return pattern;
|
|
3841
|
-
}
|
|
3842
|
-
function isReadonlyArray(input) {
|
|
3843
|
-
return Array.isArray(input);
|
|
3844
|
-
}
|
|
3845
|
-
|
|
3846
3912
|
//#endregion
|
|
3847
3913
|
//#region src/utils/normalize-transform-options.ts
|
|
3848
3914
|
/**
|
|
@@ -3850,26 +3916,11 @@ function isReadonlyArray(input) {
|
|
|
3850
3916
|
*
|
|
3851
3917
|
* Prioritizes values from `transform.define`, `transform.inject`, and `transform.dropLabels` over deprecated top-level options.
|
|
3852
3918
|
*/
|
|
3853
|
-
function normalizeTransformOptions(inputOptions
|
|
3919
|
+
function normalizeTransformOptions(inputOptions) {
|
|
3854
3920
|
const transform = inputOptions.transform;
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
onLog(LOG_LEVEL_WARN, logDeprecatedDefine());
|
|
3859
|
-
define = Object.entries(inputOptions.define);
|
|
3860
|
-
}
|
|
3861
|
-
let inject;
|
|
3862
|
-
if (transform?.inject) inject = transform.inject;
|
|
3863
|
-
else if (inputOptions.inject) {
|
|
3864
|
-
onLog(LOG_LEVEL_WARN, logDeprecatedInject());
|
|
3865
|
-
inject = inputOptions.inject;
|
|
3866
|
-
}
|
|
3867
|
-
let dropLabels;
|
|
3868
|
-
if (transform?.dropLabels) dropLabels = transform.dropLabels;
|
|
3869
|
-
else if (inputOptions.dropLabels) {
|
|
3870
|
-
onLog(LOG_LEVEL_WARN, logDeprecatedDropLabels());
|
|
3871
|
-
dropLabels = inputOptions.dropLabels;
|
|
3872
|
-
}
|
|
3921
|
+
const define = transform?.define ? Object.entries(transform.define) : void 0;
|
|
3922
|
+
const inject = transform?.inject;
|
|
3923
|
+
const dropLabels = transform?.dropLabels;
|
|
3873
3924
|
let oxcTransformOptions;
|
|
3874
3925
|
if (transform) {
|
|
3875
3926
|
const { define: _define, inject: _inject, dropLabels: _dropLabels,...rest } = transform;
|
|
@@ -3888,7 +3939,6 @@ function normalizeTransformOptions(inputOptions, onLog) {
|
|
|
3888
3939
|
|
|
3889
3940
|
//#endregion
|
|
3890
3941
|
//#region src/utils/bindingify-input-options.ts
|
|
3891
|
-
var import_binding$4 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
3892
3942
|
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
3893
3943
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedOutputPlugins);
|
|
3894
3944
|
const plugins = rawPlugins.map((plugin) => {
|
|
@@ -3896,19 +3946,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3896
3946
|
if (plugin instanceof BuiltinPlugin) return bindingifyBuiltInPlugin(plugin);
|
|
3897
3947
|
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3898
3948
|
});
|
|
3899
|
-
const normalizedTransform = normalizeTransformOptions(inputOptions
|
|
3900
|
-
let profilerNames;
|
|
3901
|
-
if (outputOptions.generatedCode?.profilerNames !== void 0) profilerNames = outputOptions.generatedCode.profilerNames;
|
|
3902
|
-
else if (inputOptions.profilerNames !== void 0) {
|
|
3903
|
-
onLog(LOG_LEVEL_WARN, logDeprecatedProfilerNames());
|
|
3904
|
-
profilerNames = inputOptions.profilerNames;
|
|
3905
|
-
}
|
|
3906
|
-
let keepNames;
|
|
3907
|
-
if (outputOptions.keepNames !== void 0) keepNames = outputOptions.keepNames;
|
|
3908
|
-
else if (inputOptions.keepNames !== void 0) {
|
|
3909
|
-
onLog(LOG_LEVEL_WARN, logDeprecatedKeepNames());
|
|
3910
|
-
keepNames = inputOptions.keepNames;
|
|
3911
|
-
}
|
|
3949
|
+
const normalizedTransform = normalizeTransformOptions(inputOptions);
|
|
3912
3950
|
return {
|
|
3913
3951
|
input: bindingifyInput(inputOptions.input),
|
|
3914
3952
|
plugins,
|
|
@@ -3924,11 +3962,11 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
|
|
|
3924
3962
|
define: normalizedTransform.define,
|
|
3925
3963
|
inject: bindingifyInject(normalizedTransform.inject),
|
|
3926
3964
|
experimental: bindingifyExperimental(inputOptions.experimental),
|
|
3927
|
-
profilerNames,
|
|
3965
|
+
profilerNames: outputOptions.generatedCode?.profilerNames,
|
|
3928
3966
|
transform: normalizedTransform.oxcTransformOptions,
|
|
3929
3967
|
watch: bindingifyWatch(inputOptions.watch),
|
|
3930
3968
|
dropLabels: normalizedTransform.dropLabels,
|
|
3931
|
-
keepNames,
|
|
3969
|
+
keepNames: outputOptions.keepNames,
|
|
3932
3970
|
checks: inputOptions.checks,
|
|
3933
3971
|
deferSyncScanData: () => {
|
|
3934
3972
|
let ret = [];
|
|
@@ -3958,9 +3996,9 @@ function bindingifyHmr(hmr) {
|
|
|
3958
3996
|
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
3959
3997
|
switch (attachDebugInfo) {
|
|
3960
3998
|
case void 0: return;
|
|
3961
|
-
case "full": return
|
|
3962
|
-
case "simple": return
|
|
3963
|
-
case "none": return
|
|
3999
|
+
case "full": return BindingAttachDebugInfo.Full;
|
|
4000
|
+
case "simple": return BindingAttachDebugInfo.Simple;
|
|
4001
|
+
case "none": return BindingAttachDebugInfo.None;
|
|
3964
4002
|
}
|
|
3965
4003
|
}
|
|
3966
4004
|
function bindingifyExternal(external) {
|
|
@@ -3973,13 +4011,13 @@ function bindingifyExternal(external) {
|
|
|
3973
4011
|
}
|
|
3974
4012
|
}
|
|
3975
4013
|
function bindingifyExperimental(experimental) {
|
|
3976
|
-
let chunkModulesOrder =
|
|
4014
|
+
let chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
|
|
3977
4015
|
if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
|
|
3978
4016
|
case "exec-order":
|
|
3979
|
-
chunkModulesOrder =
|
|
4017
|
+
chunkModulesOrder = BindingChunkModuleOrderBy.ExecOrder;
|
|
3980
4018
|
break;
|
|
3981
4019
|
case "module-id":
|
|
3982
|
-
chunkModulesOrder =
|
|
4020
|
+
chunkModulesOrder = BindingChunkModuleOrderBy.ModuleId;
|
|
3983
4021
|
break;
|
|
3984
4022
|
default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
|
|
3985
4023
|
}
|
|
@@ -4039,10 +4077,10 @@ function bindingifyInject(inject) {
|
|
|
4039
4077
|
}
|
|
4040
4078
|
function bindingifyLogLevel(logLevel) {
|
|
4041
4079
|
switch (logLevel) {
|
|
4042
|
-
case "silent": return
|
|
4043
|
-
case "debug": return
|
|
4044
|
-
case "warn": return
|
|
4045
|
-
case "info": return
|
|
4080
|
+
case "silent": return BindingLogLevel.Silent;
|
|
4081
|
+
case "debug": return BindingLogLevel.Debug;
|
|
4082
|
+
case "warn": return BindingLogLevel.Warn;
|
|
4083
|
+
case "info": return BindingLogLevel.Info;
|
|
4046
4084
|
default: throw new Error(`Unexpected log level: ${logLevel}`);
|
|
4047
4085
|
}
|
|
4048
4086
|
}
|
|
@@ -4078,19 +4116,19 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
4078
4116
|
};
|
|
4079
4117
|
switch (config.propertyReadSideEffects) {
|
|
4080
4118
|
case "always":
|
|
4081
|
-
normalizedConfig.propertyReadSideEffects =
|
|
4119
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.Always;
|
|
4082
4120
|
break;
|
|
4083
4121
|
case false:
|
|
4084
|
-
normalizedConfig.propertyReadSideEffects =
|
|
4122
|
+
normalizedConfig.propertyReadSideEffects = BindingPropertyReadSideEffects.False;
|
|
4085
4123
|
break;
|
|
4086
4124
|
default:
|
|
4087
4125
|
}
|
|
4088
4126
|
switch (config.propertyWriteSideEffects) {
|
|
4089
4127
|
case "always":
|
|
4090
|
-
normalizedConfig.propertyWriteSideEffects =
|
|
4128
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.Always;
|
|
4091
4129
|
break;
|
|
4092
4130
|
case false:
|
|
4093
|
-
normalizedConfig.propertyWriteSideEffects =
|
|
4131
|
+
normalizedConfig.propertyWriteSideEffects = BindingPropertyWriteSideEffects.False;
|
|
4094
4132
|
break;
|
|
4095
4133
|
default:
|
|
4096
4134
|
}
|
|
@@ -4250,7 +4288,6 @@ function bindingifyAdvancedChunks(advancedChunks, manualChunks) {
|
|
|
4250
4288
|
|
|
4251
4289
|
//#endregion
|
|
4252
4290
|
//#region src/utils/initialize-parallel-plugins.ts
|
|
4253
|
-
var import_binding$3 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
4254
4291
|
async function initializeParallelPlugins(plugins) {
|
|
4255
4292
|
const pluginInfos = [];
|
|
4256
4293
|
for (const [index, plugin] of plugins.entries()) if ("_parallel" in plugin) {
|
|
@@ -4263,7 +4300,7 @@ async function initializeParallelPlugins(plugins) {
|
|
|
4263
4300
|
}
|
|
4264
4301
|
if (pluginInfos.length <= 0) return;
|
|
4265
4302
|
const count = availableParallelism();
|
|
4266
|
-
const parallelJsPluginRegistry = new
|
|
4303
|
+
const parallelJsPluginRegistry = new ParallelJsPluginRegistry(count);
|
|
4267
4304
|
const registryId = parallelJsPluginRegistry.id;
|
|
4268
4305
|
const workers = await initializeWorkers(registryId, count, pluginInfos);
|
|
4269
4306
|
const stopWorkers = async () => {
|
|
@@ -4341,68 +4378,56 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
4341
4378
|
|
|
4342
4379
|
//#endregion
|
|
4343
4380
|
//#region src/api/rolldown/rolldown-build.ts
|
|
4344
|
-
var import_binding$2 = /* @__PURE__ */ __toESM(require_binding());
|
|
4345
4381
|
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
4346
4382
|
var RolldownBuild = class RolldownBuild {
|
|
4347
4383
|
#inputOptions;
|
|
4348
4384
|
#bundler;
|
|
4349
|
-
#
|
|
4385
|
+
#stopWorkers;
|
|
4350
4386
|
static asyncRuntimeShutdown = false;
|
|
4351
4387
|
constructor(inputOptions) {
|
|
4352
4388
|
this.#inputOptions = inputOptions;
|
|
4353
|
-
this.#bundler = new
|
|
4389
|
+
this.#bundler = new BindingBundler();
|
|
4354
4390
|
}
|
|
4355
4391
|
get closed() {
|
|
4356
|
-
return this.#
|
|
4357
|
-
}
|
|
4358
|
-
async #getBundlerWithStopWorker(outputOptions) {
|
|
4359
|
-
if (this.#bundlerImpl) await this.#bundlerImpl.stopWorkers?.();
|
|
4360
|
-
const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
|
|
4361
|
-
if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding$2.startAsyncRuntime)();
|
|
4362
|
-
try {
|
|
4363
|
-
return this.#bundlerImpl = {
|
|
4364
|
-
impl: this.#bundler.createImpl(option.bundlerOptions),
|
|
4365
|
-
stopWorkers: option.stopWorkers,
|
|
4366
|
-
shutdown: () => {
|
|
4367
|
-
(0, import_binding$2.shutdownAsyncRuntime)();
|
|
4368
|
-
RolldownBuild.asyncRuntimeShutdown = true;
|
|
4369
|
-
}
|
|
4370
|
-
};
|
|
4371
|
-
} catch (e$1) {
|
|
4372
|
-
await option.stopWorkers?.();
|
|
4373
|
-
throw e$1;
|
|
4374
|
-
}
|
|
4375
|
-
}
|
|
4376
|
-
async scan() {
|
|
4377
|
-
const { impl } = await this.#getBundlerWithStopWorker({});
|
|
4378
|
-
unwrapBindingResult(await impl.scan());
|
|
4392
|
+
return this.#bundler.closed;
|
|
4379
4393
|
}
|
|
4380
4394
|
async generate(outputOptions = {}) {
|
|
4381
|
-
|
|
4382
|
-
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4383
|
-
return new RolldownOutputImpl(unwrapBindingResult(await impl.generate()));
|
|
4395
|
+
return this.#build(false, outputOptions);
|
|
4384
4396
|
}
|
|
4385
4397
|
async write(outputOptions = {}) {
|
|
4386
|
-
|
|
4387
|
-
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4388
|
-
return new RolldownOutputImpl(unwrapBindingResult(await impl.write()));
|
|
4398
|
+
return this.#build(true, outputOptions);
|
|
4389
4399
|
}
|
|
4390
4400
|
/**
|
|
4391
4401
|
* Close the build and free resources.
|
|
4392
4402
|
*/
|
|
4393
4403
|
async close() {
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
}
|
|
4404
|
+
await this.#stopWorkers?.();
|
|
4405
|
+
await this.#bundler.close();
|
|
4406
|
+
shutdownAsyncRuntime();
|
|
4407
|
+
RolldownBuild.asyncRuntimeShutdown = true;
|
|
4408
|
+
this.#stopWorkers = void 0;
|
|
4400
4409
|
}
|
|
4401
4410
|
async [Symbol.asyncDispose]() {
|
|
4402
4411
|
await this.close();
|
|
4403
4412
|
}
|
|
4404
4413
|
get watchFiles() {
|
|
4405
|
-
return this.#
|
|
4414
|
+
return Promise.resolve(this.#bundler.getWatchFiles());
|
|
4415
|
+
}
|
|
4416
|
+
async #build(isWrite, outputOptions) {
|
|
4417
|
+
validateOption("output", outputOptions);
|
|
4418
|
+
await this.#stopWorkers?.();
|
|
4419
|
+
const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
|
|
4420
|
+
if (RolldownBuild.asyncRuntimeShutdown) startAsyncRuntime();
|
|
4421
|
+
try {
|
|
4422
|
+
this.#stopWorkers = option.stopWorkers;
|
|
4423
|
+
let output;
|
|
4424
|
+
if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
|
|
4425
|
+
else output = await this.#bundler.generate(option.bundlerOptions);
|
|
4426
|
+
return new RolldownOutputImpl(unwrapBindingResult(output));
|
|
4427
|
+
} catch (e$1) {
|
|
4428
|
+
await option.stopWorkers?.();
|
|
4429
|
+
throw e$1;
|
|
4430
|
+
}
|
|
4406
4431
|
}
|
|
4407
4432
|
};
|
|
4408
4433
|
|
|
@@ -4504,7 +4529,6 @@ var WatcherEmitter = class {
|
|
|
4504
4529
|
|
|
4505
4530
|
//#endregion
|
|
4506
4531
|
//#region src/api/watch/watcher.ts
|
|
4507
|
-
var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
4508
4532
|
var Watcher = class {
|
|
4509
4533
|
closed;
|
|
4510
4534
|
inner;
|
|
@@ -4526,7 +4550,7 @@ var Watcher = class {
|
|
|
4526
4550
|
this.closed = true;
|
|
4527
4551
|
for (const stop of this.stopWorkers) await stop?.();
|
|
4528
4552
|
await this.inner.close();
|
|
4529
|
-
|
|
4553
|
+
shutdownAsyncRuntime();
|
|
4530
4554
|
}
|
|
4531
4555
|
start() {
|
|
4532
4556
|
process.nextTick(() => this.inner.start(this.emitter.onEvent.bind(this.emitter)));
|
|
@@ -4538,7 +4562,7 @@ async function createWatcher(emitter, input) {
|
|
|
4538
4562
|
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
|
|
4539
4563
|
})).flat());
|
|
4540
4564
|
const notifyOptions = getValidNotifyOption(bundlerOptions);
|
|
4541
|
-
new Watcher(emitter, new
|
|
4565
|
+
new Watcher(emitter, new BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions), bundlerOptions.map((option) => option.stopWorkers)).start();
|
|
4542
4566
|
}
|
|
4543
4567
|
function getValidNotifyOption(bundlerOptions) {
|
|
4544
4568
|
let result;
|
|
@@ -4567,8 +4591,7 @@ function defineConfig(config) {
|
|
|
4567
4591
|
|
|
4568
4592
|
//#endregion
|
|
4569
4593
|
//#region src/index.ts
|
|
4570
|
-
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
4571
4594
|
const VERSION = version;
|
|
4572
4595
|
|
|
4573
4596
|
//#endregion
|
|
4574
|
-
export { version as C, description$1 as S, getOutputCliKeys as _, build as a,
|
|
4597
|
+
export { version as C, description$1 as S, getOutputCliKeys as _, build as a, styleText$1 as b, createBundlerOptions as c, normalizeBindingResult as d, unwrapBindingResult as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, PluginContextData as l, bindingifySourcemap$1 as m, VERSION as n, rolldown as o, transformToRollupOutput as p, defineConfig as r, RolldownBuild as s, BindingMagicString$1 as t, bindingifyPlugin as u, validateCliOptions as v, onExit as w, PluginDriver as x, validateOption as y };
|