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