@rolldown/browser 1.0.0-beta.44 → 1.0.0-beta.45
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 +4 -4
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/experimental-index.browser.mjs +2 -2
- package/dist/experimental-index.d.mts +3 -3
- package/dist/experimental-index.mjs +3 -3
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -1
- package/dist/index.browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.mjs +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.d.mts +3 -3
- package/dist/rolldown-binding.wasi-browser.js +0 -1
- package/dist/rolldown-binding.wasi.cjs +0 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding-0m41EAn-.d.mts → binding-DRegrFdE.d.mts} +11 -10
- package/dist/shared/{dist-DNFKY37q.mjs → composable-filters-D_PY7Qa7.mjs} +1 -1
- package/dist/shared/{define-config-BbwLmCDX.d.mts → define-config-C6-goOPh.d.mts} +25 -13
- package/dist/shared/{load-config-B3FsKQ_6.mjs → load-config-Z2MWPLZO.mjs} +3 -3
- package/dist/shared/{src-BnIhK3nA.mjs → src-B4ZmdjD5.mjs} +497 -389
- package/dist/{src-CIeG_TGR.js → src-CLWy1Uip.js} +395 -287
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as logCycleLoading, c as logDeprecatedInject, d as logInputHookInOutputPlugin, f as logInvalidLogPosition, h as styleText, i as error, l as logDeprecatedKeepNames, m as logPluginError, o as logDeprecatedDefine, p as logMultiplyNotifyOption, r as augmentCodeLocation, s as logDeprecatedDropLabels, t as parseAst, u as logDeprecatedProfilerNames } from "./parse-ast-index-Ck5SwMSC.mjs";
|
|
2
|
-
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 "./
|
|
2
|
+
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-D_PY7Qa7.mjs";
|
|
3
3
|
import { Worker, isMainThread } from "node:worker_threads";
|
|
4
4
|
import { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingMagicString as BindingMagicString$1, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, initTraceSubscriber, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -217,7 +217,7 @@ if (isMainThread) {
|
|
|
217
217
|
|
|
218
218
|
//#endregion
|
|
219
219
|
//#region package.json
|
|
220
|
-
var version = "1.0.0-beta.
|
|
220
|
+
var version = "1.0.0-beta.45";
|
|
221
221
|
var description$1 = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
222
222
|
|
|
223
223
|
//#endregion
|
|
@@ -1381,6 +1381,25 @@ function tuple(items, message2) {
|
|
|
1381
1381
|
};
|
|
1382
1382
|
}
|
|
1383
1383
|
/* @__NO_SIDE_EFFECTS__ */
|
|
1384
|
+
function undefined_(message2) {
|
|
1385
|
+
return {
|
|
1386
|
+
kind: "schema",
|
|
1387
|
+
type: "undefined",
|
|
1388
|
+
reference: undefined_,
|
|
1389
|
+
expects: "undefined",
|
|
1390
|
+
async: false,
|
|
1391
|
+
message: message2,
|
|
1392
|
+
get "~standard"() {
|
|
1393
|
+
return /* @__PURE__ */ _getStandardProps(this);
|
|
1394
|
+
},
|
|
1395
|
+
"~run"(dataset, config2) {
|
|
1396
|
+
if (dataset.value === void 0) dataset.typed = true;
|
|
1397
|
+
else _addIssue(this, "type", dataset, config2);
|
|
1398
|
+
return dataset;
|
|
1399
|
+
}
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1384
1403
|
function _subIssues(datasets) {
|
|
1385
1404
|
let issues;
|
|
1386
1405
|
if (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);
|
|
@@ -1632,6 +1651,9 @@ function flattenValibotSchema(schema, result = {}, prefix = "") {
|
|
|
1632
1651
|
//#endregion
|
|
1633
1652
|
//#region src/utils/validator.ts
|
|
1634
1653
|
const StringOrRegExpSchema = union([string(), instance(RegExp)]);
|
|
1654
|
+
function vFunction() {
|
|
1655
|
+
return function_();
|
|
1656
|
+
}
|
|
1635
1657
|
const LogLevelSchema = union([
|
|
1636
1658
|
literal("debug"),
|
|
1637
1659
|
literal("info"),
|
|
@@ -1646,14 +1668,15 @@ const InputOptionSchema = union([
|
|
|
1646
1668
|
array(string()),
|
|
1647
1669
|
record(string(), string())
|
|
1648
1670
|
]);
|
|
1649
|
-
const
|
|
1671
|
+
const ExternalOptionFunctionSchema = pipe(vFunction(), args(tuple([
|
|
1672
|
+
string(),
|
|
1673
|
+
optional(string()),
|
|
1674
|
+
boolean()
|
|
1675
|
+
])), returns(nullish(boolean())));
|
|
1676
|
+
const ExternalOptionSchema = union([
|
|
1650
1677
|
StringOrRegExpSchema,
|
|
1651
1678
|
array(StringOrRegExpSchema),
|
|
1652
|
-
|
|
1653
|
-
string(),
|
|
1654
|
-
optional(string()),
|
|
1655
|
-
boolean()
|
|
1656
|
-
])), returns(nullish(boolean())))
|
|
1679
|
+
ExternalOptionFunctionSchema
|
|
1657
1680
|
]);
|
|
1658
1681
|
const ModuleTypesSchema = record(string(), union([
|
|
1659
1682
|
literal("asset"),
|
|
@@ -1672,7 +1695,7 @@ const ModuleTypesSchema = record(string(), union([
|
|
|
1672
1695
|
const JsxOptionsSchema = strictObject({
|
|
1673
1696
|
runtime: pipe(optional(union([literal("classic"), literal("automatic")])), description("Which runtime to use")),
|
|
1674
1697
|
development: pipe(optional(boolean()), description("Development specific information")),
|
|
1675
|
-
throwIfNamespace: pipe(optional(
|
|
1698
|
+
throwIfNamespace: pipe(optional(boolean()), description("Toggles whether to throw an error when a tag name uses an XML namespace")),
|
|
1676
1699
|
importSource: pipe(optional(string()), description("Import the factory of element and fragment if mode is classic")),
|
|
1677
1700
|
pragma: pipe(optional(string()), description("Jsx element transformation")),
|
|
1678
1701
|
pragmaFrag: pipe(optional(string()), description("Jsx fragment transformation")),
|
|
@@ -1713,7 +1736,13 @@ const TransformOptionsSchema = object({
|
|
|
1713
1736
|
typescript: optional(TypescriptSchema),
|
|
1714
1737
|
helpers: optional(HelpersSchema),
|
|
1715
1738
|
decorators: optional(DecoratorOptionSchema),
|
|
1716
|
-
jsx: optional(union([
|
|
1739
|
+
jsx: optional(union([
|
|
1740
|
+
literal(false),
|
|
1741
|
+
literal("preserve"),
|
|
1742
|
+
literal("react"),
|
|
1743
|
+
literal("react-jsx"),
|
|
1744
|
+
JsxOptionsSchema
|
|
1745
|
+
])),
|
|
1717
1746
|
target: pipe(optional(union([string(), array(string())])), description("The JavaScript target environment")),
|
|
1718
1747
|
define: optional(record(string(), string())),
|
|
1719
1748
|
inject: optional(record(string(), union([string(), tuple([string(), string()])]))),
|
|
@@ -1748,8 +1777,8 @@ const ChecksOptionsSchema = strictObject({
|
|
|
1748
1777
|
preferBuiltinFeature: pipe(optional(boolean()), description("Whether to emit warning when detecting prefer builtin feature"))
|
|
1749
1778
|
});
|
|
1750
1779
|
const CompressOptionsKeepNamesSchema = strictObject({
|
|
1751
|
-
function:
|
|
1752
|
-
class:
|
|
1780
|
+
function: boolean(),
|
|
1781
|
+
class: boolean()
|
|
1753
1782
|
});
|
|
1754
1783
|
const CompressOptionsSchema = strictObject({
|
|
1755
1784
|
target: optional(union([
|
|
@@ -1771,8 +1800,8 @@ const CompressOptionsSchema = strictObject({
|
|
|
1771
1800
|
unused: optional(union([boolean(), literal("keep_assign")]))
|
|
1772
1801
|
});
|
|
1773
1802
|
const MangleOptionsKeepNamesSchema = strictObject({
|
|
1774
|
-
function:
|
|
1775
|
-
class:
|
|
1803
|
+
function: boolean(),
|
|
1804
|
+
class: boolean()
|
|
1776
1805
|
});
|
|
1777
1806
|
const MangleOptionsSchema = strictObject({
|
|
1778
1807
|
toplevel: optional(boolean()),
|
|
@@ -1811,22 +1840,19 @@ const TreeshakingOptionsSchema = union([boolean(), looseObject({
|
|
|
1811
1840
|
propertyWriteSideEffects: optional(union([literal(false), literal("always")]))
|
|
1812
1841
|
})]);
|
|
1813
1842
|
const OptimizationOptionsSchema = strictObject({
|
|
1814
|
-
inlineConst: pipe(optional(union([
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
mode: optional(union([literal("all"), literal("smart")])),
|
|
1819
|
-
pass: optional(number())
|
|
1820
|
-
})
|
|
1821
|
-
])), description("Enable crossmodule constant inlining")),
|
|
1843
|
+
inlineConst: pipe(optional(union([boolean(), strictObject({
|
|
1844
|
+
mode: optional(union([literal("all"), literal("smart")])),
|
|
1845
|
+
pass: optional(number())
|
|
1846
|
+
})])), description("Enable crossmodule constant inlining")),
|
|
1822
1847
|
pifeForModuleWrappers: pipe(optional(boolean()), description("Use PIFE pattern for module wrappers"))
|
|
1823
1848
|
});
|
|
1824
|
-
const
|
|
1849
|
+
const LogOrStringHandlerSchema = pipe(vFunction(), args(tuple([LogLevelWithErrorSchema, RollupLogWithStringSchema])));
|
|
1850
|
+
const OnLogSchema = pipe(vFunction(), args(tuple([
|
|
1825
1851
|
LogLevelSchema,
|
|
1826
1852
|
RollupLogSchema,
|
|
1827
|
-
|
|
1853
|
+
LogOrStringHandlerSchema
|
|
1828
1854
|
])));
|
|
1829
|
-
const OnwarnSchema = pipe(
|
|
1855
|
+
const OnwarnSchema = pipe(vFunction(), args(tuple([RollupLogSchema, pipe(vFunction(), args(tuple([union([RollupLogWithStringSchema, pipe(vFunction(), returns(RollupLogWithStringSchema))])])))])));
|
|
1830
1856
|
const HmrSchema = union([boolean(), strictObject({
|
|
1831
1857
|
new: optional(boolean()),
|
|
1832
1858
|
port: optional(number()),
|
|
@@ -1836,7 +1862,7 @@ const HmrSchema = union([boolean(), strictObject({
|
|
|
1836
1862
|
const InputOptionsSchema = strictObject({
|
|
1837
1863
|
input: optional(InputOptionSchema),
|
|
1838
1864
|
plugins: optional(custom(() => true)),
|
|
1839
|
-
external: optional(
|
|
1865
|
+
external: optional(ExternalOptionSchema),
|
|
1840
1866
|
makeAbsoluteExternalsRelative: optional(union([boolean(), literal("ifRelativeSource")])),
|
|
1841
1867
|
resolve: optional(ResolveOptionsSchema),
|
|
1842
1868
|
cwd: pipe(optional(string()), description("Current working directory")),
|
|
@@ -1920,12 +1946,22 @@ const ModuleFormatSchema = union([
|
|
|
1920
1946
|
literal("iife"),
|
|
1921
1947
|
literal("umd")
|
|
1922
1948
|
]);
|
|
1923
|
-
const AddonFunctionSchema = pipe(
|
|
1924
|
-
const
|
|
1925
|
-
const
|
|
1926
|
-
const
|
|
1927
|
-
const
|
|
1928
|
-
const
|
|
1949
|
+
const AddonFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returnsAsync(unionAsync([string(), pipeAsync(promise(), awaitAsync(), string())])));
|
|
1950
|
+
const ChunkFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
|
|
1951
|
+
const ChunkFileNamesSchema = union([string(), ChunkFileNamesFunctionSchema]);
|
|
1952
|
+
const AssetFileNamesFunctionSchema = pipe(vFunction(), args(tuple([custom(() => true)])), returns(string()));
|
|
1953
|
+
const AssetFileNamesSchema = union([string(), AssetFileNamesFunctionSchema]);
|
|
1954
|
+
const SanitizeFileNameFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
|
|
1955
|
+
const SanitizeFileNameSchema = union([boolean(), SanitizeFileNameFunctionSchema]);
|
|
1956
|
+
const GlobalsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
|
|
1957
|
+
const PathsFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(string()));
|
|
1958
|
+
const ManualChunksFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
|
|
1959
|
+
const AdvancedChunksNameFunctionSchema = pipe(vFunction(), args(tuple([string(), object({})])), returns(nullish(string())));
|
|
1960
|
+
const AdvancedChunksTestFunctionSchema = pipe(vFunction(), args(tuple([string()])), returns(union([
|
|
1961
|
+
boolean(),
|
|
1962
|
+
void_(),
|
|
1963
|
+
undefined_()
|
|
1964
|
+
])));
|
|
1929
1965
|
const AdvancedChunksSchema = strictObject({
|
|
1930
1966
|
includeDependenciesRecursively: optional(boolean()),
|
|
1931
1967
|
minSize: optional(number()),
|
|
@@ -1934,12 +1970,8 @@ const AdvancedChunksSchema = strictObject({
|
|
|
1934
1970
|
maxModuleSize: optional(number()),
|
|
1935
1971
|
minShareCount: optional(number()),
|
|
1936
1972
|
groups: optional(array(strictObject({
|
|
1937
|
-
name: union([string(),
|
|
1938
|
-
test: optional(union([
|
|
1939
|
-
string(),
|
|
1940
|
-
instance(RegExp),
|
|
1941
|
-
pipe(function_(), args(tuple([string()])), returns(union([nullish(boolean()), void_()])))
|
|
1942
|
-
])),
|
|
1973
|
+
name: union([string(), AdvancedChunksNameFunctionSchema]),
|
|
1974
|
+
test: optional(union([StringOrRegExpSchema, AdvancedChunksTestFunctionSchema])),
|
|
1943
1975
|
priority: optional(number()),
|
|
1944
1976
|
minSize: optional(number()),
|
|
1945
1977
|
minShareCount: optional(number()),
|
|
@@ -1996,7 +2028,7 @@ const OutputOptionsSchema = strictObject({
|
|
|
1996
2028
|
sanitizeFileName: optional(SanitizeFileNameSchema),
|
|
1997
2029
|
minify: pipe(optional(union([
|
|
1998
2030
|
boolean(),
|
|
1999
|
-
|
|
2031
|
+
literal("dce-only"),
|
|
2000
2032
|
MinifyOptionsSchema
|
|
2001
2033
|
])), description("Minify the bundled file")),
|
|
2002
2034
|
name: pipe(optional(string()), description("Name for UMD / IIFE format outputs")),
|
|
@@ -2005,15 +2037,12 @@ const OutputOptionsSchema = strictObject({
|
|
|
2005
2037
|
generatedCode: pipe(optional(partial(GeneratedCodeOptionsSchema)), description("Generated code options")),
|
|
2006
2038
|
externalLiveBindings: pipe(optional(boolean()), description("external live bindings")),
|
|
2007
2039
|
inlineDynamicImports: pipe(optional(boolean()), description("Inline dynamic imports")),
|
|
2008
|
-
manualChunks: optional(
|
|
2040
|
+
manualChunks: optional(ManualChunksFunctionSchema),
|
|
2009
2041
|
advancedChunks: optional(AdvancedChunksSchema),
|
|
2010
2042
|
legalComments: pipe(optional(union([literal("none"), literal("inline")])), description("Control comments in the output")),
|
|
2011
2043
|
plugins: optional(custom(() => true)),
|
|
2012
2044
|
polyfillRequire: pipe(optional(boolean()), description("Disable require polyfill injection")),
|
|
2013
|
-
hoistTransitiveImports: optional(
|
|
2014
|
-
if (input) return false;
|
|
2015
|
-
return true;
|
|
2016
|
-
}, () => `The 'true' value is not supported`)),
|
|
2045
|
+
hoistTransitiveImports: optional(literal(false)),
|
|
2017
2046
|
preserveModules: pipe(optional(boolean()), description("Preserve module structure")),
|
|
2018
2047
|
preserveModulesRoot: pipe(optional(string()), description("Put preserved modules under this path at root level")),
|
|
2019
2048
|
virtualDirname: optional(string()),
|
|
@@ -2123,141 +2152,443 @@ function bindingifySourcemap$1(map) {
|
|
|
2123
2152
|
}
|
|
2124
2153
|
|
|
2125
2154
|
//#endregion
|
|
2126
|
-
//#region src/utils/
|
|
2127
|
-
function
|
|
2128
|
-
|
|
2129
|
-
return container;
|
|
2130
|
-
}
|
|
2131
|
-
function normalizeBindingResult(container) {
|
|
2132
|
-
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
2133
|
-
return container;
|
|
2134
|
-
}
|
|
2135
|
-
function normalizeBindingError(e$1) {
|
|
2136
|
-
return e$1.type === "JsError" ? e$1.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2137
|
-
kind: e$1.field0.kind,
|
|
2138
|
-
message: e$1.field0.message,
|
|
2139
|
-
stack: void 0
|
|
2140
|
-
});
|
|
2141
|
-
}
|
|
2142
|
-
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2143
|
-
const errors = rawErrors.map(normalizeBindingError);
|
|
2144
|
-
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2145
|
-
for (let i = 0; i < errors.length; i++) {
|
|
2146
|
-
summary += "\n";
|
|
2147
|
-
if (i >= 5) {
|
|
2148
|
-
summary += "...";
|
|
2149
|
-
break;
|
|
2150
|
-
}
|
|
2151
|
-
summary += getErrorMessage(errors[i]);
|
|
2152
|
-
}
|
|
2153
|
-
const wrapper = new Error(summary);
|
|
2154
|
-
Object.defineProperty(wrapper, "errors", {
|
|
2155
|
-
configurable: true,
|
|
2156
|
-
enumerable: true,
|
|
2157
|
-
get: () => errors,
|
|
2158
|
-
set: (value) => Object.defineProperty(wrapper, "errors", {
|
|
2159
|
-
configurable: true,
|
|
2160
|
-
enumerable: true,
|
|
2161
|
-
value
|
|
2162
|
-
})
|
|
2163
|
-
});
|
|
2164
|
-
return wrapper;
|
|
2165
|
-
}
|
|
2166
|
-
function getErrorMessage(e$1) {
|
|
2167
|
-
if (Object.hasOwn(e$1, "kind")) return e$1.message;
|
|
2168
|
-
let s = "";
|
|
2169
|
-
if (e$1.plugin) s += `[plugin ${e$1.plugin}]`;
|
|
2170
|
-
const id$1 = e$1.id ?? e$1.loc?.file;
|
|
2171
|
-
if (id$1) {
|
|
2172
|
-
s += " " + id$1;
|
|
2173
|
-
if (e$1.loc) s += `:${e$1.loc.line}:${e$1.loc.column}`;
|
|
2174
|
-
}
|
|
2175
|
-
if (s) s += "\n";
|
|
2176
|
-
const message = `${e$1.name ?? "Error"}: ${e$1.message}`;
|
|
2177
|
-
s += message;
|
|
2178
|
-
if (e$1.frame) s = joinNewLine(s, e$1.frame);
|
|
2179
|
-
if (e$1.stack) s = joinNewLine(s, e$1.stack.replace(message, ""));
|
|
2180
|
-
if (e$1.cause) {
|
|
2181
|
-
s = joinNewLine(s, "Caused by:");
|
|
2182
|
-
s = joinNewLine(s, getErrorMessage(e$1.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2183
|
-
}
|
|
2184
|
-
return s;
|
|
2155
|
+
//#region src/utils/asset-source.ts
|
|
2156
|
+
function transformAssetSource(bindingAssetSource$1) {
|
|
2157
|
+
return bindingAssetSource$1.inner;
|
|
2185
2158
|
}
|
|
2186
|
-
function
|
|
2187
|
-
return
|
|
2159
|
+
function bindingAssetSource(source) {
|
|
2160
|
+
return { inner: source };
|
|
2188
2161
|
}
|
|
2189
2162
|
|
|
2190
2163
|
//#endregion
|
|
2191
|
-
//#region src/utils/transform-module
|
|
2192
|
-
function
|
|
2164
|
+
//#region src/utils/transform-rendered-module.ts
|
|
2165
|
+
function transformToRenderedModule(bindingRenderedModule) {
|
|
2193
2166
|
return {
|
|
2194
|
-
get ast() {
|
|
2195
|
-
return unsupported("ModuleInfo#ast");
|
|
2196
|
-
},
|
|
2197
2167
|
get code() {
|
|
2198
|
-
return
|
|
2168
|
+
return bindingRenderedModule.code;
|
|
2199
2169
|
},
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
isEntry: info.isEntry,
|
|
2207
|
-
...option
|
|
2170
|
+
get renderedLength() {
|
|
2171
|
+
return bindingRenderedModule.code?.length || 0;
|
|
2172
|
+
},
|
|
2173
|
+
get renderedExports() {
|
|
2174
|
+
return bindingRenderedModule.renderedExports;
|
|
2175
|
+
}
|
|
2208
2176
|
};
|
|
2209
2177
|
}
|
|
2210
2178
|
|
|
2211
2179
|
//#endregion
|
|
2212
|
-
//#region src/utils/transform-
|
|
2213
|
-
function
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2180
|
+
//#region src/utils/transform-rendered-chunk.ts
|
|
2181
|
+
function transformRenderedChunk(chunk) {
|
|
2182
|
+
let modules = null;
|
|
2183
|
+
return {
|
|
2184
|
+
type: "chunk",
|
|
2185
|
+
get name() {
|
|
2186
|
+
return chunk.name;
|
|
2187
|
+
},
|
|
2188
|
+
get isEntry() {
|
|
2189
|
+
return chunk.isEntry;
|
|
2190
|
+
},
|
|
2191
|
+
get isDynamicEntry() {
|
|
2192
|
+
return chunk.isDynamicEntry;
|
|
2193
|
+
},
|
|
2194
|
+
get facadeModuleId() {
|
|
2195
|
+
return chunk.facadeModuleId;
|
|
2196
|
+
},
|
|
2197
|
+
get moduleIds() {
|
|
2198
|
+
return chunk.moduleIds;
|
|
2199
|
+
},
|
|
2200
|
+
get exports() {
|
|
2201
|
+
return chunk.exports;
|
|
2202
|
+
},
|
|
2203
|
+
get fileName() {
|
|
2204
|
+
return chunk.fileName;
|
|
2205
|
+
},
|
|
2206
|
+
get imports() {
|
|
2207
|
+
return chunk.imports;
|
|
2208
|
+
},
|
|
2209
|
+
get dynamicImports() {
|
|
2210
|
+
return chunk.dynamicImports;
|
|
2211
|
+
},
|
|
2212
|
+
get modules() {
|
|
2213
|
+
if (!modules) modules = transformChunkModules(chunk.modules);
|
|
2214
|
+
return modules;
|
|
2215
|
+
}
|
|
2216
|
+
};
|
|
2224
2217
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
});
|
|
2218
|
+
function transformChunkModules(modules) {
|
|
2219
|
+
const result = {};
|
|
2220
|
+
for (let i = 0; i < modules.values.length; i++) {
|
|
2221
|
+
let key = modules.keys[i];
|
|
2222
|
+
const mod = modules.values[i];
|
|
2223
|
+
result[key] = transformToRenderedModule(mod);
|
|
2224
|
+
}
|
|
2225
|
+
return result;
|
|
2234
2226
|
}
|
|
2235
2227
|
|
|
2236
2228
|
//#endregion
|
|
2237
|
-
//#region
|
|
2238
|
-
function
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2229
|
+
//#region src/utils/transform-to-rollup-output.ts
|
|
2230
|
+
function transformToRollupSourceMap(map) {
|
|
2231
|
+
const obj = {
|
|
2232
|
+
...JSON.parse(map),
|
|
2233
|
+
toString() {
|
|
2234
|
+
return JSON.stringify(obj);
|
|
2235
|
+
},
|
|
2236
|
+
toUrl() {
|
|
2237
|
+
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
return obj;
|
|
2243
2241
|
}
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2242
|
+
function transformToRollupOutputChunk(bindingChunk) {
|
|
2243
|
+
const chunk = {
|
|
2244
|
+
type: "chunk",
|
|
2245
|
+
get code() {
|
|
2246
|
+
return bindingChunk.code;
|
|
2247
|
+
},
|
|
2248
|
+
fileName: bindingChunk.fileName,
|
|
2249
|
+
name: bindingChunk.name,
|
|
2250
|
+
get modules() {
|
|
2251
|
+
return transformChunkModules(bindingChunk.modules);
|
|
2252
|
+
},
|
|
2253
|
+
get imports() {
|
|
2254
|
+
return bindingChunk.imports;
|
|
2255
|
+
},
|
|
2256
|
+
get dynamicImports() {
|
|
2257
|
+
return bindingChunk.dynamicImports;
|
|
2258
|
+
},
|
|
2259
|
+
exports: bindingChunk.exports,
|
|
2260
|
+
isEntry: bindingChunk.isEntry,
|
|
2261
|
+
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
2262
|
+
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
2263
|
+
get moduleIds() {
|
|
2264
|
+
return bindingChunk.moduleIds;
|
|
2265
|
+
},
|
|
2266
|
+
get map() {
|
|
2267
|
+
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
2268
|
+
},
|
|
2269
|
+
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
2270
|
+
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
2271
|
+
};
|
|
2272
|
+
const cache = {};
|
|
2273
|
+
return new Proxy(chunk, {
|
|
2274
|
+
get(target, p) {
|
|
2275
|
+
if (p in cache) return cache[p];
|
|
2276
|
+
const value = target[p];
|
|
2277
|
+
cache[p] = value;
|
|
2278
|
+
return value;
|
|
2279
|
+
},
|
|
2280
|
+
has(target, p) {
|
|
2281
|
+
if (p in cache) return true;
|
|
2282
|
+
return p in target;
|
|
2283
|
+
}
|
|
2284
|
+
});
|
|
2249
2285
|
}
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2286
|
+
function transformToMutableRollupOutputChunk(bindingChunk, changed) {
|
|
2287
|
+
const chunk = {
|
|
2288
|
+
type: "chunk",
|
|
2289
|
+
get code() {
|
|
2290
|
+
return bindingChunk.code;
|
|
2291
|
+
},
|
|
2292
|
+
fileName: bindingChunk.fileName,
|
|
2293
|
+
name: bindingChunk.name,
|
|
2294
|
+
get modules() {
|
|
2295
|
+
return transformChunkModules(bindingChunk.modules);
|
|
2296
|
+
},
|
|
2297
|
+
get imports() {
|
|
2298
|
+
return bindingChunk.imports;
|
|
2299
|
+
},
|
|
2300
|
+
get dynamicImports() {
|
|
2301
|
+
return bindingChunk.dynamicImports;
|
|
2302
|
+
},
|
|
2303
|
+
exports: bindingChunk.exports,
|
|
2304
|
+
isEntry: bindingChunk.isEntry,
|
|
2305
|
+
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
2306
|
+
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
2307
|
+
get moduleIds() {
|
|
2308
|
+
return bindingChunk.moduleIds;
|
|
2309
|
+
},
|
|
2310
|
+
get map() {
|
|
2311
|
+
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
2312
|
+
},
|
|
2313
|
+
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
2314
|
+
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
2315
|
+
};
|
|
2316
|
+
const cache = {};
|
|
2317
|
+
return new Proxy(chunk, {
|
|
2318
|
+
get(target, p) {
|
|
2319
|
+
if (p in cache) return cache[p];
|
|
2320
|
+
const value = target[p];
|
|
2321
|
+
cache[p] = value;
|
|
2322
|
+
return value;
|
|
2323
|
+
},
|
|
2324
|
+
set(_target, p, newValue) {
|
|
2325
|
+
cache[p] = newValue;
|
|
2326
|
+
changed.updated.add(bindingChunk.fileName);
|
|
2327
|
+
return true;
|
|
2328
|
+
},
|
|
2329
|
+
has(target, p) {
|
|
2330
|
+
if (p in cache) return true;
|
|
2331
|
+
return p in target;
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
function transformToRollupOutputAsset(bindingAsset) {
|
|
2336
|
+
const asset = {
|
|
2337
|
+
type: "asset",
|
|
2338
|
+
fileName: bindingAsset.fileName,
|
|
2339
|
+
originalFileName: bindingAsset.originalFileName || null,
|
|
2340
|
+
originalFileNames: bindingAsset.originalFileNames,
|
|
2341
|
+
get source() {
|
|
2342
|
+
return transformAssetSource(bindingAsset.source);
|
|
2343
|
+
},
|
|
2344
|
+
name: bindingAsset.name ?? void 0,
|
|
2345
|
+
names: bindingAsset.names
|
|
2346
|
+
};
|
|
2347
|
+
const cache = {};
|
|
2348
|
+
return new Proxy(asset, { get(target, p) {
|
|
2349
|
+
if (p in cache) return cache[p];
|
|
2350
|
+
const value = target[p];
|
|
2351
|
+
cache[p] = value;
|
|
2352
|
+
return value;
|
|
2353
|
+
} });
|
|
2354
|
+
}
|
|
2355
|
+
function transformToMutableRollupOutputAsset(bindingAsset, changed) {
|
|
2356
|
+
const asset = {
|
|
2357
|
+
type: "asset",
|
|
2358
|
+
fileName: bindingAsset.fileName,
|
|
2359
|
+
originalFileName: bindingAsset.originalFileName || null,
|
|
2360
|
+
originalFileNames: bindingAsset.originalFileNames,
|
|
2361
|
+
get source() {
|
|
2362
|
+
return transformAssetSource(bindingAsset.source);
|
|
2363
|
+
},
|
|
2364
|
+
name: bindingAsset.name ?? void 0,
|
|
2365
|
+
names: bindingAsset.names
|
|
2366
|
+
};
|
|
2367
|
+
const cache = {};
|
|
2368
|
+
return new Proxy(asset, {
|
|
2369
|
+
get(target, p) {
|
|
2370
|
+
if (p in cache) return cache[p];
|
|
2371
|
+
const value = target[p];
|
|
2372
|
+
cache[p] = value;
|
|
2373
|
+
return value;
|
|
2374
|
+
},
|
|
2375
|
+
set(_target, p, newValue) {
|
|
2376
|
+
cache[p] = newValue;
|
|
2377
|
+
changed.updated.add(bindingAsset.fileName);
|
|
2378
|
+
return true;
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
function transformToRollupOutput(output) {
|
|
2383
|
+
const { chunks, assets } = output;
|
|
2384
|
+
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
|
|
2385
|
+
}
|
|
2386
|
+
function transformToMutableRollupOutput(output, changed) {
|
|
2387
|
+
const { chunks, assets } = output;
|
|
2388
|
+
return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
|
|
2389
|
+
}
|
|
2390
|
+
function transformToOutputBundle(context, output, changed) {
|
|
2391
|
+
const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
2392
|
+
return new Proxy(bundle, {
|
|
2393
|
+
set(_target, _p, _newValue, _receiver) {
|
|
2394
|
+
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
2395
|
+
Error.stackTraceLimit = 2;
|
|
2396
|
+
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.";
|
|
2397
|
+
const stack = new Error(message).stack ?? message;
|
|
2398
|
+
Error.stackTraceLimit = originalStackTraceLimit;
|
|
2399
|
+
context.warn({
|
|
2400
|
+
message: stack,
|
|
2401
|
+
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
2402
|
+
});
|
|
2403
|
+
return true;
|
|
2404
|
+
},
|
|
2405
|
+
deleteProperty(target, property) {
|
|
2406
|
+
if (typeof property === "string") changed.deleted.add(property);
|
|
2407
|
+
return true;
|
|
2408
|
+
}
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
function collectChangedBundle(changed, bundle) {
|
|
2412
|
+
const changes = {};
|
|
2413
|
+
for (const key in bundle) {
|
|
2414
|
+
if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
|
|
2415
|
+
const item = bundle[key];
|
|
2416
|
+
if (item.type === "asset") changes[key] = {
|
|
2417
|
+
filename: item.fileName,
|
|
2418
|
+
originalFileNames: item.originalFileNames,
|
|
2419
|
+
source: bindingAssetSource(item.source),
|
|
2420
|
+
names: item.names
|
|
2421
|
+
};
|
|
2422
|
+
else changes[key] = {
|
|
2423
|
+
code: item.code,
|
|
2424
|
+
filename: item.fileName,
|
|
2425
|
+
name: item.name,
|
|
2426
|
+
isEntry: item.isEntry,
|
|
2427
|
+
exports: item.exports,
|
|
2428
|
+
modules: {},
|
|
2429
|
+
imports: item.imports,
|
|
2430
|
+
dynamicImports: item.dynamicImports,
|
|
2431
|
+
facadeModuleId: item.facadeModuleId || void 0,
|
|
2432
|
+
isDynamicEntry: item.isDynamicEntry,
|
|
2433
|
+
moduleIds: item.moduleIds,
|
|
2434
|
+
map: bindingifySourcemap$1(item.map),
|
|
2435
|
+
sourcemapFilename: item.sourcemapFileName || void 0,
|
|
2436
|
+
preliminaryFilename: item.preliminaryFileName
|
|
2437
|
+
};
|
|
2438
|
+
}
|
|
2439
|
+
return {
|
|
2440
|
+
changes,
|
|
2441
|
+
deleted: changed.deleted
|
|
2442
|
+
};
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
//#endregion
|
|
2446
|
+
//#region src/types/rolldown-output-impl.ts
|
|
2447
|
+
var RolldownOutputImpl = class {
|
|
2448
|
+
constructor(bindingOutputs) {
|
|
2449
|
+
this.bindingOutputs = bindingOutputs;
|
|
2450
|
+
}
|
|
2451
|
+
get output() {
|
|
2452
|
+
return transformToRollupOutput(this.bindingOutputs).output;
|
|
2453
|
+
}
|
|
2454
|
+
};
|
|
2455
|
+
|
|
2456
|
+
//#endregion
|
|
2457
|
+
//#region src/utils/error.ts
|
|
2458
|
+
function unwrapBindingResult(container) {
|
|
2459
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
|
|
2460
|
+
return container;
|
|
2461
|
+
}
|
|
2462
|
+
function normalizeBindingResult(container) {
|
|
2463
|
+
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
|
|
2464
|
+
return container;
|
|
2465
|
+
}
|
|
2466
|
+
function normalizeBindingError(e$1) {
|
|
2467
|
+
return e$1.type === "JsError" ? e$1.field0 : Object.assign(/* @__PURE__ */ new Error(), {
|
|
2468
|
+
kind: e$1.field0.kind,
|
|
2469
|
+
message: e$1.field0.message,
|
|
2470
|
+
stack: void 0
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
function aggregateBindingErrorsIntoJsError(rawErrors) {
|
|
2474
|
+
const errors = rawErrors.map(normalizeBindingError);
|
|
2475
|
+
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
|
|
2476
|
+
for (let i = 0; i < errors.length; i++) {
|
|
2477
|
+
summary += "\n";
|
|
2478
|
+
if (i >= 5) {
|
|
2479
|
+
summary += "...";
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2482
|
+
summary += getErrorMessage(errors[i]);
|
|
2483
|
+
}
|
|
2484
|
+
const wrapper = new Error(summary);
|
|
2485
|
+
Object.defineProperty(wrapper, "errors", {
|
|
2486
|
+
configurable: true,
|
|
2487
|
+
enumerable: true,
|
|
2488
|
+
get: () => errors,
|
|
2489
|
+
set: (value) => Object.defineProperty(wrapper, "errors", {
|
|
2490
|
+
configurable: true,
|
|
2491
|
+
enumerable: true,
|
|
2492
|
+
value
|
|
2493
|
+
})
|
|
2494
|
+
});
|
|
2495
|
+
return wrapper;
|
|
2496
|
+
}
|
|
2497
|
+
function getErrorMessage(e$1) {
|
|
2498
|
+
if (Object.hasOwn(e$1, "kind")) return e$1.message;
|
|
2499
|
+
let s = "";
|
|
2500
|
+
if (e$1.plugin) s += `[plugin ${e$1.plugin}]`;
|
|
2501
|
+
const id$1 = e$1.id ?? e$1.loc?.file;
|
|
2502
|
+
if (id$1) {
|
|
2503
|
+
s += " " + id$1;
|
|
2504
|
+
if (e$1.loc) s += `:${e$1.loc.line}:${e$1.loc.column}`;
|
|
2505
|
+
}
|
|
2506
|
+
if (s) s += "\n";
|
|
2507
|
+
const message = `${e$1.name ?? "Error"}: ${e$1.message}`;
|
|
2508
|
+
s += message;
|
|
2509
|
+
if (e$1.frame) s = joinNewLine(s, e$1.frame);
|
|
2510
|
+
if (e$1.stack) s = joinNewLine(s, e$1.stack.replace(message, ""));
|
|
2511
|
+
if (e$1.cause) {
|
|
2512
|
+
s = joinNewLine(s, "Caused by:");
|
|
2513
|
+
s = joinNewLine(s, getErrorMessage(e$1.cause).split("\n").map((line) => " " + line).join("\n"));
|
|
2514
|
+
}
|
|
2515
|
+
return s;
|
|
2516
|
+
}
|
|
2517
|
+
function joinNewLine(s1, s2) {
|
|
2518
|
+
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
//#endregion
|
|
2522
|
+
//#region src/utils/transform-module-info.ts
|
|
2523
|
+
function transformModuleInfo(info, option) {
|
|
2524
|
+
return {
|
|
2525
|
+
get ast() {
|
|
2526
|
+
return unsupported("ModuleInfo#ast");
|
|
2527
|
+
},
|
|
2528
|
+
get code() {
|
|
2529
|
+
return info.code;
|
|
2530
|
+
},
|
|
2531
|
+
id: info.id,
|
|
2532
|
+
importers: info.importers,
|
|
2533
|
+
dynamicImporters: info.dynamicImporters,
|
|
2534
|
+
importedIds: info.importedIds,
|
|
2535
|
+
dynamicallyImportedIds: info.dynamicallyImportedIds,
|
|
2536
|
+
exports: info.exports,
|
|
2537
|
+
isEntry: info.isEntry,
|
|
2538
|
+
...option
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
//#endregion
|
|
2543
|
+
//#region src/utils/transform-sourcemap.ts
|
|
2544
|
+
function isEmptySourcemapFiled(array$1) {
|
|
2545
|
+
if (!array$1) return true;
|
|
2546
|
+
if (array$1.length === 0 || !array$1[0]) return true;
|
|
2547
|
+
return false;
|
|
2548
|
+
}
|
|
2549
|
+
function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
|
|
2550
|
+
if (!rawMap) return;
|
|
2551
|
+
let map = typeof rawMap === "object" ? rawMap : JSON.parse(rawMap);
|
|
2552
|
+
if (isEmptySourcemapFiled(map.sourcesContent)) map.sourcesContent = [originalCode];
|
|
2553
|
+
if (isEmptySourcemapFiled(map.sources) || map.sources && map.sources.length === 1 && map.sources[0] !== id$1) map.sources = [id$1];
|
|
2554
|
+
return map;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
//#endregion
|
|
2558
|
+
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
|
|
2559
|
+
function e(e$1, t$2, n$1) {
|
|
2560
|
+
let r = (n$2) => e$1(n$2, ...t$2);
|
|
2561
|
+
return n$1 === void 0 ? r : Object.assign(r, {
|
|
2562
|
+
lazy: n$1,
|
|
2563
|
+
lazyArgs: t$2
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
//#endregion
|
|
2568
|
+
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js
|
|
2569
|
+
function t(t$2, n$1, r) {
|
|
2570
|
+
let i = t$2.length - n$1.length;
|
|
2571
|
+
if (i === 0) return t$2(...n$1);
|
|
2572
|
+
if (i === 1) return e(t$2, n$1, r);
|
|
2573
|
+
throw Error(`Wrong number of arguments`);
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
//#endregion
|
|
2577
|
+
//#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/partition-DAu403JQ.js
|
|
2578
|
+
function t$1(...t$2) {
|
|
2579
|
+
return t(n, t$2);
|
|
2580
|
+
}
|
|
2581
|
+
const n = (e$1, t$2) => {
|
|
2582
|
+
let n$1 = [[], []];
|
|
2583
|
+
for (let [r, i] of e$1.entries()) t$2(i, r, e$1) ? n$1[0].push(i) : n$1[1].push(i);
|
|
2584
|
+
return n$1;
|
|
2585
|
+
};
|
|
2586
|
+
|
|
2587
|
+
//#endregion
|
|
2588
|
+
//#region src/plugin/bindingify-hook-filter.ts
|
|
2589
|
+
function generalHookFilterMatcherToFilterExprs(matcher, stringKind) {
|
|
2590
|
+
if (typeof matcher === "string" || matcher instanceof RegExp) return [include(generateAtomMatcher(stringKind, matcher))];
|
|
2591
|
+
if (Array.isArray(matcher)) return matcher.map((m) => include(generateAtomMatcher(stringKind, m)));
|
|
2261
2592
|
let ret = [];
|
|
2262
2593
|
if (matcher.exclude) ret.push(...arraify(matcher.exclude).map((m) => exclude(generateAtomMatcher(stringKind, m))));
|
|
2263
2594
|
if (matcher.include) ret.push(...arraify(matcher.include).map((m) => include(generateAtomMatcher(stringKind, m))));
|
|
@@ -2402,15 +2733,6 @@ function bindingPluginOrder(order) {
|
|
|
2402
2733
|
}
|
|
2403
2734
|
}
|
|
2404
2735
|
|
|
2405
|
-
//#endregion
|
|
2406
|
-
//#region src/utils/asset-source.ts
|
|
2407
|
-
function transformAssetSource(bindingAssetSource$1) {
|
|
2408
|
-
return bindingAssetSource$1.inner;
|
|
2409
|
-
}
|
|
2410
|
-
function bindingAssetSource(source) {
|
|
2411
|
-
return { inner: source };
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
2736
|
//#endregion
|
|
2415
2737
|
//#region src/plugin/fs.ts
|
|
2416
2738
|
const fsModule = {
|
|
@@ -2758,220 +3080,6 @@ function bindingifyModuleParsed(args$1) {
|
|
|
2758
3080
|
};
|
|
2759
3081
|
}
|
|
2760
3082
|
|
|
2761
|
-
//#endregion
|
|
2762
|
-
//#region src/utils/transform-rendered-module.ts
|
|
2763
|
-
function transformToRenderedModule(bindingRenderedModule) {
|
|
2764
|
-
return {
|
|
2765
|
-
get code() {
|
|
2766
|
-
return bindingRenderedModule.code;
|
|
2767
|
-
},
|
|
2768
|
-
get renderedLength() {
|
|
2769
|
-
return bindingRenderedModule.code?.length || 0;
|
|
2770
|
-
},
|
|
2771
|
-
get renderedExports() {
|
|
2772
|
-
return bindingRenderedModule.renderedExports;
|
|
2773
|
-
}
|
|
2774
|
-
};
|
|
2775
|
-
}
|
|
2776
|
-
|
|
2777
|
-
//#endregion
|
|
2778
|
-
//#region src/utils/transform-rendered-chunk.ts
|
|
2779
|
-
function transformRenderedChunk(chunk) {
|
|
2780
|
-
let modules = null;
|
|
2781
|
-
return {
|
|
2782
|
-
type: "chunk",
|
|
2783
|
-
get name() {
|
|
2784
|
-
return chunk.name;
|
|
2785
|
-
},
|
|
2786
|
-
get isEntry() {
|
|
2787
|
-
return chunk.isEntry;
|
|
2788
|
-
},
|
|
2789
|
-
get isDynamicEntry() {
|
|
2790
|
-
return chunk.isDynamicEntry;
|
|
2791
|
-
},
|
|
2792
|
-
get facadeModuleId() {
|
|
2793
|
-
return chunk.facadeModuleId;
|
|
2794
|
-
},
|
|
2795
|
-
get moduleIds() {
|
|
2796
|
-
return chunk.moduleIds;
|
|
2797
|
-
},
|
|
2798
|
-
get exports() {
|
|
2799
|
-
return chunk.exports;
|
|
2800
|
-
},
|
|
2801
|
-
get fileName() {
|
|
2802
|
-
return chunk.fileName;
|
|
2803
|
-
},
|
|
2804
|
-
get imports() {
|
|
2805
|
-
return chunk.imports;
|
|
2806
|
-
},
|
|
2807
|
-
get dynamicImports() {
|
|
2808
|
-
return chunk.dynamicImports;
|
|
2809
|
-
},
|
|
2810
|
-
get modules() {
|
|
2811
|
-
if (!modules) modules = transformChunkModules(chunk.modules);
|
|
2812
|
-
return modules;
|
|
2813
|
-
}
|
|
2814
|
-
};
|
|
2815
|
-
}
|
|
2816
|
-
function transformChunkModules(modules) {
|
|
2817
|
-
const result = {};
|
|
2818
|
-
for (let i = 0; i < modules.values.length; i++) {
|
|
2819
|
-
let key = modules.keys[i];
|
|
2820
|
-
const mod = modules.values[i];
|
|
2821
|
-
result[key] = transformToRenderedModule(mod);
|
|
2822
|
-
}
|
|
2823
|
-
return result;
|
|
2824
|
-
}
|
|
2825
|
-
|
|
2826
|
-
//#endregion
|
|
2827
|
-
//#region src/utils/transform-to-rollup-output.ts
|
|
2828
|
-
function transformToRollupSourceMap(map) {
|
|
2829
|
-
const obj = {
|
|
2830
|
-
...JSON.parse(map),
|
|
2831
|
-
toString() {
|
|
2832
|
-
return JSON.stringify(obj);
|
|
2833
|
-
},
|
|
2834
|
-
toUrl() {
|
|
2835
|
-
return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
|
|
2836
|
-
}
|
|
2837
|
-
};
|
|
2838
|
-
return obj;
|
|
2839
|
-
}
|
|
2840
|
-
function transformToRollupOutputChunk(bindingChunk, changed) {
|
|
2841
|
-
const chunk = {
|
|
2842
|
-
type: "chunk",
|
|
2843
|
-
get code() {
|
|
2844
|
-
return bindingChunk.code;
|
|
2845
|
-
},
|
|
2846
|
-
fileName: bindingChunk.fileName,
|
|
2847
|
-
name: bindingChunk.name,
|
|
2848
|
-
get modules() {
|
|
2849
|
-
return transformChunkModules(bindingChunk.modules);
|
|
2850
|
-
},
|
|
2851
|
-
get imports() {
|
|
2852
|
-
return bindingChunk.imports;
|
|
2853
|
-
},
|
|
2854
|
-
get dynamicImports() {
|
|
2855
|
-
return bindingChunk.dynamicImports;
|
|
2856
|
-
},
|
|
2857
|
-
exports: bindingChunk.exports,
|
|
2858
|
-
isEntry: bindingChunk.isEntry,
|
|
2859
|
-
facadeModuleId: bindingChunk.facadeModuleId || null,
|
|
2860
|
-
isDynamicEntry: bindingChunk.isDynamicEntry,
|
|
2861
|
-
get moduleIds() {
|
|
2862
|
-
return bindingChunk.moduleIds;
|
|
2863
|
-
},
|
|
2864
|
-
get map() {
|
|
2865
|
-
return bindingChunk.map ? transformToRollupSourceMap(bindingChunk.map) : null;
|
|
2866
|
-
},
|
|
2867
|
-
sourcemapFileName: bindingChunk.sourcemapFileName || null,
|
|
2868
|
-
preliminaryFileName: bindingChunk.preliminaryFileName
|
|
2869
|
-
};
|
|
2870
|
-
const cache = {};
|
|
2871
|
-
return new Proxy(chunk, {
|
|
2872
|
-
get(target, p) {
|
|
2873
|
-
if (p in cache) return cache[p];
|
|
2874
|
-
const value = target[p];
|
|
2875
|
-
cache[p] = value;
|
|
2876
|
-
return value;
|
|
2877
|
-
},
|
|
2878
|
-
set(_target, p, newValue) {
|
|
2879
|
-
cache[p] = newValue;
|
|
2880
|
-
changed?.updated.add(bindingChunk.fileName);
|
|
2881
|
-
return true;
|
|
2882
|
-
},
|
|
2883
|
-
has(target, p) {
|
|
2884
|
-
if (p in cache) return true;
|
|
2885
|
-
return p in target;
|
|
2886
|
-
}
|
|
2887
|
-
});
|
|
2888
|
-
}
|
|
2889
|
-
function transformToRollupOutputAsset(bindingAsset, changed) {
|
|
2890
|
-
const asset = {
|
|
2891
|
-
type: "asset",
|
|
2892
|
-
fileName: bindingAsset.fileName,
|
|
2893
|
-
originalFileName: bindingAsset.originalFileName || null,
|
|
2894
|
-
originalFileNames: bindingAsset.originalFileNames,
|
|
2895
|
-
get source() {
|
|
2896
|
-
return transformAssetSource(bindingAsset.source);
|
|
2897
|
-
},
|
|
2898
|
-
name: bindingAsset.name ?? void 0,
|
|
2899
|
-
names: bindingAsset.names
|
|
2900
|
-
};
|
|
2901
|
-
const cache = {};
|
|
2902
|
-
return new Proxy(asset, {
|
|
2903
|
-
get(target, p) {
|
|
2904
|
-
if (p in cache) return cache[p];
|
|
2905
|
-
const value = target[p];
|
|
2906
|
-
cache[p] = value;
|
|
2907
|
-
return value;
|
|
2908
|
-
},
|
|
2909
|
-
set(_target, p, newValue) {
|
|
2910
|
-
cache[p] = newValue;
|
|
2911
|
-
changed?.updated.add(bindingAsset.fileName);
|
|
2912
|
-
return true;
|
|
2913
|
-
}
|
|
2914
|
-
});
|
|
2915
|
-
}
|
|
2916
|
-
function transformToRollupOutput(output, changed) {
|
|
2917
|
-
const { chunks, assets } = output;
|
|
2918
|
-
return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToRollupOutputAsset(asset, changed))] };
|
|
2919
|
-
}
|
|
2920
|
-
function transformToOutputBundle(context, output, changed) {
|
|
2921
|
-
const bundle = Object.fromEntries(transformToRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
|
|
2922
|
-
return new Proxy(bundle, {
|
|
2923
|
-
set(_target, _p, _newValue, _receiver) {
|
|
2924
|
-
const originalStackTraceLimit = Error.stackTraceLimit;
|
|
2925
|
-
Error.stackTraceLimit = 2;
|
|
2926
|
-
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.";
|
|
2927
|
-
const stack = new Error(message).stack ?? message;
|
|
2928
|
-
Error.stackTraceLimit = originalStackTraceLimit;
|
|
2929
|
-
context.warn({
|
|
2930
|
-
message: stack,
|
|
2931
|
-
code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
|
|
2932
|
-
});
|
|
2933
|
-
return true;
|
|
2934
|
-
},
|
|
2935
|
-
deleteProperty(target, property) {
|
|
2936
|
-
if (typeof property === "string") changed.deleted.add(property);
|
|
2937
|
-
return true;
|
|
2938
|
-
}
|
|
2939
|
-
});
|
|
2940
|
-
}
|
|
2941
|
-
function collectChangedBundle(changed, bundle) {
|
|
2942
|
-
const changes = {};
|
|
2943
|
-
for (const key in bundle) {
|
|
2944
|
-
if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
|
|
2945
|
-
const item = bundle[key];
|
|
2946
|
-
if (item.type === "asset") changes[key] = {
|
|
2947
|
-
filename: item.fileName,
|
|
2948
|
-
originalFileNames: item.originalFileNames,
|
|
2949
|
-
source: bindingAssetSource(item.source),
|
|
2950
|
-
names: item.names
|
|
2951
|
-
};
|
|
2952
|
-
else changes[key] = {
|
|
2953
|
-
code: item.code,
|
|
2954
|
-
filename: item.fileName,
|
|
2955
|
-
name: item.name,
|
|
2956
|
-
isEntry: item.isEntry,
|
|
2957
|
-
exports: item.exports,
|
|
2958
|
-
modules: {},
|
|
2959
|
-
imports: item.imports,
|
|
2960
|
-
dynamicImports: item.dynamicImports,
|
|
2961
|
-
facadeModuleId: item.facadeModuleId || void 0,
|
|
2962
|
-
isDynamicEntry: item.isDynamicEntry,
|
|
2963
|
-
moduleIds: item.moduleIds,
|
|
2964
|
-
map: bindingifySourcemap$1(item.map),
|
|
2965
|
-
sourcemapFilename: item.sourcemapFileName || void 0,
|
|
2966
|
-
preliminaryFilename: item.preliminaryFileName
|
|
2967
|
-
};
|
|
2968
|
-
}
|
|
2969
|
-
return {
|
|
2970
|
-
changes,
|
|
2971
|
-
deleted: changed.deleted
|
|
2972
|
-
};
|
|
2973
|
-
}
|
|
2974
|
-
|
|
2975
3083
|
//#endregion
|
|
2976
3084
|
//#region src/plugin/bindingify-output-hooks.ts
|
|
2977
3085
|
function bindingifyRenderStart(args$1) {
|
|
@@ -3011,7 +3119,7 @@ function bindingifyAugmentChunkHash(args$1) {
|
|
|
3011
3119
|
const { handler, meta } = normalizeHook(hook);
|
|
3012
3120
|
return {
|
|
3013
3121
|
plugin: async (ctx, chunk) => {
|
|
3014
|
-
return
|
|
3122
|
+
return handler.call(new PluginContextImpl(args$1.outputOptions, ctx, args$1.plugin, args$1.pluginContextData, args$1.onLog, args$1.logLevel, args$1.watchMode), transformRenderedChunk(chunk));
|
|
3015
3123
|
},
|
|
3016
3124
|
meta: bindingifyPluginHookMeta(meta)
|
|
3017
3125
|
};
|
|
@@ -4125,12 +4233,12 @@ var RolldownBuild = class RolldownBuild {
|
|
|
4125
4233
|
async generate(outputOptions = {}) {
|
|
4126
4234
|
validateOption("output", outputOptions);
|
|
4127
4235
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4128
|
-
return
|
|
4236
|
+
return new RolldownOutputImpl(unwrapBindingResult(await impl.generate()));
|
|
4129
4237
|
}
|
|
4130
4238
|
async write(outputOptions = {}) {
|
|
4131
4239
|
validateOption("output", outputOptions);
|
|
4132
4240
|
const { impl } = await this.#getBundlerWithStopWorker(outputOptions);
|
|
4133
|
-
return
|
|
4241
|
+
return new RolldownOutputImpl(unwrapBindingResult(await impl.write()));
|
|
4134
4242
|
}
|
|
4135
4243
|
async close() {
|
|
4136
4244
|
if (this.#bundlerImpl) {
|
|
@@ -4311,4 +4419,4 @@ function defineConfig(config) {
|
|
|
4311
4419
|
const VERSION = version;
|
|
4312
4420
|
|
|
4313
4421
|
//#endregion
|
|
4314
|
-
export { version as C, description$1 as S, getOutputCliKeys as _, build as a, BuiltinPlugin as b, createBundlerOptions as c, bindingifyPlugin as d,
|
|
4422
|
+
export { version as C, description$1 as S, getOutputCliKeys as _, build as a, BuiltinPlugin as b, createBundlerOptions as c, bindingifyPlugin as d, normalizeBindingResult as f, getInputCliKeys as g, getCliSchemaInfo as h, watch as i, normalizedStringOrRegex 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, PluginContextData as u, validateCliOptions as v, onExit as w, makeBuiltinPluginCallable as x, PluginDriver as y };
|