@rolldown/browser 1.0.0-beta.7-commit.46fbc61 → 1.0.0-beta.7-commit.a684277
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/browser.mjs +92 -3
- package/dist/cli.cjs +125 -18
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +81 -16
- package/dist/experimental-index.cjs +32 -3
- package/dist/experimental-index.d.cts +94 -0
- package/dist/experimental-index.d.mts +94 -0
- package/dist/experimental-index.mjs +31 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +2 -2
- package/dist/parallel-plugin-worker.cjs +3 -3
- package/dist/parallel-plugin-worker.d.cts +1 -0
- package/dist/parallel-plugin-worker.d.mts +1 -0
- package/dist/parallel-plugin-worker.mjs +3 -3
- package/dist/parallel-plugin.d.cts +14 -0
- package/dist/parallel-plugin.d.mts +14 -0
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +9 -0
- package/dist/parse-ast-index.d.mts +9 -0
- package/dist/parse-ast-index.mjs +1 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/chunk-DSsiIF1Z.mjs +30 -0
- package/dist/shared/{chunk-Dc32QXFI.cjs → chunk-qZFfknuJ.cjs} +9 -0
- package/dist/shared/input-options.d-CJIzCDlR.d.mts +1072 -0
- package/dist/shared/input-options.d-sjdx_aVw.d.cts +1072 -0
- package/dist/shared/{parse-ast-index-Rn-i2y3M.cjs → parse-ast-index-B_-Eqolm.cjs} +11 -1
- package/dist/shared/{parse-ast-index-CaKd8BTZ.mjs → parse-ast-index-jK_Miocm.mjs} +11 -1
- package/dist/shared/{prompt-D713KUcE.mjs → prompt-B7SnYdwU.mjs} +1 -1
- package/dist/shared/{prompt-wpCBKCzA.cjs → prompt-_yrURmmm.cjs} +1 -1
- package/dist/shared/{src-whyHz3p3.mjs → src-DSCy0VBD.mjs} +72 -5
- package/dist/shared/{src-DoypqT02.cjs → src-sUNCnFpJ.cjs} +84 -5
- package/package.json +5 -12
- package/dist/shared/chunk-nENTdJ2K.mjs +0 -11
- package/dist/types/api/build.d.ts +0 -18
- package/dist/types/api/experimental.d.ts +0 -7
- package/dist/types/api/rolldown/index.d.ts +0 -3
- package/dist/types/api/rolldown/rolldown-build.d.ts +0 -15
- package/dist/types/api/watch/index.d.ts +0 -3
- package/dist/types/api/watch/watch-emitter.d.ts +0 -31
- package/dist/types/api/watch/watcher.d.ts +0 -13
- package/dist/types/binding.d.ts +0 -1507
- package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
- package/dist/types/builtin-plugin/constructors.d.ts +0 -23
- package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -27
- package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
- package/dist/types/builtin-plugin/utils.d.ts +0 -8
- package/dist/types/cli/arguments/alias.d.ts +0 -16
- package/dist/types/cli/arguments/index.d.ts +0 -15
- package/dist/types/cli/arguments/normalize.d.ts +0 -16
- package/dist/types/cli/arguments/utils.d.ts +0 -8
- package/dist/types/cli/commands/bundle.d.ts +0 -3
- package/dist/types/cli/commands/help.d.ts +0 -1
- package/dist/types/cli/index.d.ts +0 -1
- package/dist/types/cli/load-config.d.ts +0 -5
- package/dist/types/cli/logger.d.ts +0 -5
- package/dist/types/constants/plugin-context.d.ts +0 -7
- package/dist/types/constants/plugin.d.ts +0 -45
- package/dist/types/experimental-index.d.ts +0 -9
- package/dist/types/index.d.ts +0 -31
- package/dist/types/log/log-handler.d.ts +0 -4
- package/dist/types/log/logger.d.ts +0 -6
- package/dist/types/log/logging.d.ts +0 -12
- package/dist/types/log/logs.d.ts +0 -18
- package/dist/types/options/generated/checks-options.d.ts +0 -57
- package/dist/types/options/input-options.d.ts +0 -185
- package/dist/types/options/normalized-input-options.d.ts +0 -18
- package/dist/types/options/normalized-output-options.d.ts +0 -70
- package/dist/types/options/output-options.d.ts +0 -182
- package/dist/types/options/watch-options.d.ts +0 -5
- package/dist/types/parallel-plugin-worker.d.ts +0 -1
- package/dist/types/parallel-plugin.d.ts +0 -1
- package/dist/types/parse-ast-index.d.ts +0 -5
- package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
- package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
- package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
- package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
- package/dist/types/plugin/bindingify-plugin.d.ts +0 -17
- package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
- package/dist/types/plugin/generated/hook-usage.d.ts +0 -29
- package/dist/types/plugin/hook-filter.d.ts +0 -49
- package/dist/types/plugin/index.d.ts +0 -141
- package/dist/types/plugin/minimal-plugin-context.d.ts +0 -24
- package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
- package/dist/types/plugin/parallel-plugin.d.ts +0 -9
- package/dist/types/plugin/plugin-context-data.d.ts +0 -22
- package/dist/types/plugin/plugin-context.d.ts +0 -67
- package/dist/types/plugin/plugin-driver.d.ts +0 -10
- package/dist/types/plugin/transform-plugin-context.d.ts +0 -28
- package/dist/types/plugin/with-filter.d.ts +0 -10
- package/dist/types/types/assert.d.ts +0 -14
- package/dist/types/types/config-export.d.ts +0 -5
- package/dist/types/types/misc.d.ts +0 -40
- package/dist/types/types/module-info.d.ts +0 -15
- package/dist/types/types/module-side-effects.d.ts +0 -12
- package/dist/types/types/output-bundle.d.ts +0 -4
- package/dist/types/types/rolldown-options.d.ts +0 -5
- package/dist/types/types/rolldown-output.d.ts +0 -66
- package/dist/types/types/schema.d.ts +0 -33
- package/dist/types/types/sourcemap.d.ts +0 -14
- package/dist/types/types/utils.d.ts +0 -13
- package/dist/types/types.d.ts +0 -7
- package/dist/types/utils/asset-source.d.ts +0 -4
- package/dist/types/utils/async-flatten.d.ts +0 -1
- package/dist/types/utils/bindingify-input-options.d.ts +0 -7
- package/dist/types/utils/bindingify-output-options.d.ts +0 -5
- package/dist/types/utils/code-frame.d.ts +0 -1
- package/dist/types/utils/compose-js-plugins.d.ts +0 -2
- package/dist/types/utils/create-bundler-option.d.ts +0 -11
- package/dist/types/utils/create-bundler.d.ts +0 -9
- package/dist/types/utils/define-config.d.ts +0 -5
- package/dist/types/utils/error.d.ts +0 -2
- package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -17
- package/dist/types/utils/misc.d.ts +0 -7
- package/dist/types/utils/normalize-hook.d.ts +0 -7
- package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
- package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
- package/dist/types/utils/plugin/index.d.ts +0 -2
- package/dist/types/utils/resolved-external.d.ts +0 -4
- package/dist/types/utils/transform-module-info.d.ts +0 -4
- package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
- package/dist/types/utils/transform-rendered-module.d.ts +0 -3
- package/dist/types/utils/transform-side-effects.d.ts +0 -3
- package/dist/types/utils/transform-sourcemap.d.ts +0 -3
- package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
- package/dist/types/utils/validator.d.ts +0 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_chunk = require('./chunk-
|
|
2
|
+
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
3
3
|
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("../rolldown-binding.wasi.cjs"));
|
|
4
4
|
const ansis = require_chunk.__toESM(require("ansis"));
|
|
5
5
|
|
|
@@ -51,6 +51,10 @@ function getCodeFrame(source, line, column) {
|
|
|
51
51
|
function rangeContains(range, index) {
|
|
52
52
|
return range.start <= index && index < range.end;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* @param {string} source
|
|
56
|
+
* @param {import('./types').Options} [options]
|
|
57
|
+
*/
|
|
54
58
|
function getLocator(source, options = {}) {
|
|
55
59
|
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
56
60
|
let start = 0;
|
|
@@ -88,6 +92,12 @@ function getLocator(source, options = {}) {
|
|
|
88
92
|
}
|
|
89
93
|
return locator;
|
|
90
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* @param {string} source
|
|
97
|
+
* @param {string | number} search
|
|
98
|
+
* @param {import('./types').Options} [options]
|
|
99
|
+
* @returns {Location | undefined}
|
|
100
|
+
*/
|
|
91
101
|
function locate(source, search, options) {
|
|
92
102
|
return getLocator(source, options)(search, options && options.startIndex);
|
|
93
103
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __esm } from "./chunk-
|
|
1
|
+
import { __esm } from "./chunk-DSsiIF1Z.mjs";
|
|
2
2
|
import { parseAsync, parseSync } from "../rolldown-binding.wasi.cjs";
|
|
3
3
|
import colors from "ansis";
|
|
4
4
|
|
|
@@ -53,6 +53,10 @@ var init_code_frame = __esm({ "src/utils/code-frame.ts"() {
|
|
|
53
53
|
function rangeContains(range, index) {
|
|
54
54
|
return range.start <= index && index < range.end;
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* @param {string} source
|
|
58
|
+
* @param {import('./types').Options} [options]
|
|
59
|
+
*/
|
|
56
60
|
function getLocator(source, options = {}) {
|
|
57
61
|
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
58
62
|
let start = 0;
|
|
@@ -90,6 +94,12 @@ function getLocator(source, options = {}) {
|
|
|
90
94
|
}
|
|
91
95
|
return locator;
|
|
92
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* @param {string} source
|
|
99
|
+
* @param {string | number} search
|
|
100
|
+
* @param {import('./types').Options} [options]
|
|
101
|
+
* @returns {Location | undefined}
|
|
102
|
+
*/
|
|
93
103
|
function locate(source, search, options) {
|
|
94
104
|
return getLocator(source, options)(search, options && options.startIndex);
|
|
95
105
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_chunk = require('./chunk-
|
|
2
|
+
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
3
3
|
const node_process = require_chunk.__toESM(require("node:process"));
|
|
4
4
|
const node_util = require_chunk.__toESM(require("node:util"));
|
|
5
5
|
const node_tty = require_chunk.__toESM(require("node:tty"));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __esm } from "./chunk-
|
|
2
|
-
import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMinifyWarning, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-
|
|
1
|
+
import { __esm } from "./chunk-DSsiIF1Z.mjs";
|
|
2
|
+
import { augmentCodeLocation, error, init_logs, init_parse_ast_index, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMinifyWarning, logMultiplyNotifyOption, logPluginError, parseAst } from "./parse-ast-index-jK_Miocm.mjs";
|
|
3
3
|
import { BindingCallableBuiltinPlugin, BindingHookSideEffects, BindingLogLevel, BindingPluginOrder, BindingWatcher, Bundler, ParallelJsPluginRegistry, shutdownAsyncRuntime, startAsyncRuntime } from "../rolldown-binding.wasi.cjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import colors from "ansis";
|
|
@@ -9,7 +9,7 @@ import { availableParallelism } from "node:os";
|
|
|
9
9
|
import { Worker } from "node:worker_threads";
|
|
10
10
|
|
|
11
11
|
//#region package.json
|
|
12
|
-
var version = "1.0.0-beta.7-commit.
|
|
12
|
+
var version = "1.0.0-beta.7-commit.a684277";
|
|
13
13
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
@@ -710,6 +710,7 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
|
710
710
|
debug: v.pipe(v.optional(v.object({ sessionId: v.pipe(v.optional(v.string()), v.description("Used to name the build.")) })), v.description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly."))
|
|
711
711
|
});
|
|
712
712
|
InputCliOverrideSchema = v.strictObject({
|
|
713
|
+
input: v.pipe(v.optional(v.array(v.string())), v.description("Entry file")),
|
|
713
714
|
external: v.pipe(v.optional(v.array(v.string())), v.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
714
715
|
inject: v.pipe(v.optional(v.record(v.string(), v.string())), v.description("Inject import statements on demand")),
|
|
715
716
|
treeshake: v.pipe(v.optional(v.boolean()), v.description("enable treeshaking")),
|
|
@@ -719,7 +720,6 @@ var init_validator = __esm({ "src/utils/validator.ts"() {
|
|
|
719
720
|
...InputOptionsSchema.entries,
|
|
720
721
|
...InputCliOverrideSchema.entries
|
|
721
722
|
}), [
|
|
722
|
-
"input",
|
|
723
723
|
"plugins",
|
|
724
724
|
"onwarn",
|
|
725
725
|
"onLog",
|
|
@@ -2017,6 +2017,70 @@ var init_bindingify_watch_hooks = __esm({ "src/plugin/bindingify-watch-hooks.ts"
|
|
|
2017
2017
|
init_plugin_context();
|
|
2018
2018
|
} });
|
|
2019
2019
|
|
|
2020
|
+
//#endregion
|
|
2021
|
+
//#region src/plugin/generated/hook-usage.ts
|
|
2022
|
+
function extractHookUsage(plugin) {
|
|
2023
|
+
let hookUsage = new HookUsage();
|
|
2024
|
+
if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
|
|
2025
|
+
if (plugin.resolveId) hookUsage.union(HookUsageKind.resolveId);
|
|
2026
|
+
if (plugin.resolveDynamicImport) hookUsage.union(HookUsageKind.resolveDynamicImport);
|
|
2027
|
+
if (plugin.load) hookUsage.union(HookUsageKind.load);
|
|
2028
|
+
if (plugin.transform) hookUsage.union(HookUsageKind.transform);
|
|
2029
|
+
if (plugin.moduleParsed) hookUsage.union(HookUsageKind.moduleParsed);
|
|
2030
|
+
if (plugin.buildEnd) hookUsage.union(HookUsageKind.buildEnd);
|
|
2031
|
+
if (plugin.renderStart) hookUsage.union(HookUsageKind.renderStart);
|
|
2032
|
+
if (plugin.renderError) hookUsage.union(HookUsageKind.renderError);
|
|
2033
|
+
if (plugin.renderChunk) hookUsage.union(HookUsageKind.renderChunk);
|
|
2034
|
+
if (plugin.augmentChunkHash) hookUsage.union(HookUsageKind.augmentChunkHash);
|
|
2035
|
+
if (plugin.generateBundle) hookUsage.union(HookUsageKind.generateBundle);
|
|
2036
|
+
if (plugin.writeBundle) hookUsage.union(HookUsageKind.writeBundle);
|
|
2037
|
+
if (plugin.closeBundle) hookUsage.union(HookUsageKind.closeBundle);
|
|
2038
|
+
if (plugin.watchChange) hookUsage.union(HookUsageKind.watchChange);
|
|
2039
|
+
if (plugin.closeWatcher) hookUsage.union(HookUsageKind.closeWatcher);
|
|
2040
|
+
if (plugin.banner) hookUsage.union(HookUsageKind.banner);
|
|
2041
|
+
if (plugin.footer) hookUsage.union(HookUsageKind.footer);
|
|
2042
|
+
if (plugin.intro) hookUsage.union(HookUsageKind.intro);
|
|
2043
|
+
if (plugin.outro) hookUsage.union(HookUsageKind.outro);
|
|
2044
|
+
return hookUsage;
|
|
2045
|
+
}
|
|
2046
|
+
var HookUsageKind, HookUsage;
|
|
2047
|
+
var init_hook_usage = __esm({ "src/plugin/generated/hook-usage.ts"() {
|
|
2048
|
+
HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
2049
|
+
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
2050
|
+
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
2051
|
+
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
2052
|
+
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
2053
|
+
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
2054
|
+
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
2055
|
+
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
2056
|
+
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
2057
|
+
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
2058
|
+
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
2059
|
+
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
2060
|
+
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
2061
|
+
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
2062
|
+
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
2063
|
+
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
2064
|
+
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
2065
|
+
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
2066
|
+
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
2067
|
+
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
2068
|
+
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
2069
|
+
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
2070
|
+
return HookUsageKind$1;
|
|
2071
|
+
}({});
|
|
2072
|
+
HookUsage = class {
|
|
2073
|
+
bitflag = BigInt(0);
|
|
2074
|
+
constructor() {}
|
|
2075
|
+
union(kind) {
|
|
2076
|
+
this.bitflag |= BigInt(kind);
|
|
2077
|
+
}
|
|
2078
|
+
inner() {
|
|
2079
|
+
return Number(this.bitflag);
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
} });
|
|
2083
|
+
|
|
2020
2084
|
//#endregion
|
|
2021
2085
|
//#region src/plugin/bindingify-plugin.ts
|
|
2022
2086
|
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
@@ -2050,6 +2114,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2050
2114
|
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
|
|
2051
2115
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
|
|
2052
2116
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
|
|
2117
|
+
let hookUsage = extractHookUsage(plugin).inner();
|
|
2053
2118
|
const result = {
|
|
2054
2119
|
name: plugin.name,
|
|
2055
2120
|
buildStart,
|
|
@@ -2094,7 +2159,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2094
2159
|
watchChange,
|
|
2095
2160
|
watchChangeMeta,
|
|
2096
2161
|
closeWatcher,
|
|
2097
|
-
closeWatcherMeta
|
|
2162
|
+
closeWatcherMeta,
|
|
2163
|
+
hookUsage
|
|
2098
2164
|
};
|
|
2099
2165
|
return wrapHandlers(result);
|
|
2100
2166
|
}
|
|
@@ -2140,6 +2206,7 @@ var init_bindingify_plugin = __esm({ "src/plugin/bindingify-plugin.ts"() {
|
|
|
2140
2206
|
init_bindingify_output_hooks();
|
|
2141
2207
|
init_logs();
|
|
2142
2208
|
init_bindingify_watch_hooks();
|
|
2209
|
+
init_hook_usage();
|
|
2143
2210
|
} });
|
|
2144
2211
|
|
|
2145
2212
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const require_chunk = require('./chunk-
|
|
3
|
-
const require_parse_ast_index = require('./parse-ast-index-
|
|
2
|
+
const require_chunk = require('./chunk-qZFfknuJ.cjs');
|
|
3
|
+
const require_parse_ast_index = require('./parse-ast-index-B_-Eqolm.cjs');
|
|
4
4
|
const src_rolldown_binding_wasi_cjs = require_chunk.__toESM(require("../rolldown-binding.wasi.cjs"));
|
|
5
5
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
6
6
|
const ansis = require_chunk.__toESM(require("ansis"));
|
|
@@ -10,7 +10,7 @@ const node_os = require_chunk.__toESM(require("node:os"));
|
|
|
10
10
|
const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
|
|
11
11
|
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "1.0.0-beta.7-commit.
|
|
13
|
+
var version = "1.0.0-beta.7-commit.a684277";
|
|
14
14
|
var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
@@ -281,6 +281,16 @@ const ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
|
281
281
|
"intro",
|
|
282
282
|
"outro"
|
|
283
283
|
];
|
|
284
|
+
/**
|
|
285
|
+
* Names of all defined hooks. It's like
|
|
286
|
+
* ```js
|
|
287
|
+
* const DEFINED_HOOK_NAMES ={
|
|
288
|
+
* options: 'options',
|
|
289
|
+
* buildStart: 'buildStart',
|
|
290
|
+
* ...
|
|
291
|
+
* }
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
284
294
|
const DEFINED_HOOK_NAMES = {
|
|
285
295
|
[ENUMERATED_PLUGIN_HOOK_NAMES[0]]: ENUMERATED_PLUGIN_HOOK_NAMES[0],
|
|
286
296
|
[ENUMERATED_PLUGIN_HOOK_NAMES[1]]: ENUMERATED_PLUGIN_HOOK_NAMES[1],
|
|
@@ -617,6 +627,7 @@ const InputOptionsSchema = valibot.strictObject({
|
|
|
617
627
|
debug: valibot.pipe(valibot.optional(valibot.object({ sessionId: valibot.pipe(valibot.optional(valibot.string()), valibot.description("Used to name the build.")) })), valibot.description("Enable debug mode. Emit debug information to disk. This might slow down the build process significantly."))
|
|
618
628
|
});
|
|
619
629
|
const InputCliOverrideSchema = valibot.strictObject({
|
|
630
|
+
input: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Entry file")),
|
|
620
631
|
external: valibot.pipe(valibot.optional(valibot.array(valibot.string())), valibot.description("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")),
|
|
621
632
|
inject: valibot.pipe(valibot.optional(valibot.record(valibot.string(), valibot.string())), valibot.description("Inject import statements on demand")),
|
|
622
633
|
treeshake: valibot.pipe(valibot.optional(valibot.boolean()), valibot.description("enable treeshaking")),
|
|
@@ -626,7 +637,6 @@ const InputCliOptionsSchema = valibot.omit(valibot.strictObject({
|
|
|
626
637
|
...InputOptionsSchema.entries,
|
|
627
638
|
...InputCliOverrideSchema.entries
|
|
628
639
|
}), [
|
|
629
|
-
"input",
|
|
630
640
|
"plugins",
|
|
631
641
|
"onwarn",
|
|
632
642
|
"onLog",
|
|
@@ -811,6 +821,12 @@ function getJsonSchema() {
|
|
|
811
821
|
|
|
812
822
|
//#endregion
|
|
813
823
|
//#region src/constants/plugin-context.ts
|
|
824
|
+
/**
|
|
825
|
+
* If Composed plugins call `this.resolve` with `skipSelf: true`, the composed plugins will be skipped as a whole.
|
|
826
|
+
* To prevent that, we use this symbol to store the actual caller of `this.resolve` with `skipSelf: true`. And we
|
|
827
|
+
* will modify the skipSelf option to `false` and use this symbol to skip the caller itself in the composed plugins
|
|
828
|
+
* internally.
|
|
829
|
+
*/
|
|
814
830
|
const SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF = Symbol("plugin-context-resolve-caller");
|
|
815
831
|
|
|
816
832
|
//#endregion
|
|
@@ -1873,6 +1889,67 @@ function bindingifyCloseWatcher(args) {
|
|
|
1873
1889
|
};
|
|
1874
1890
|
}
|
|
1875
1891
|
|
|
1892
|
+
//#endregion
|
|
1893
|
+
//#region src/plugin/generated/hook-usage.ts
|
|
1894
|
+
let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
|
|
1895
|
+
HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
|
|
1896
|
+
HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
|
|
1897
|
+
HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
|
|
1898
|
+
HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
|
|
1899
|
+
HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
|
|
1900
|
+
HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
|
|
1901
|
+
HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
|
|
1902
|
+
HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
|
|
1903
|
+
HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
|
|
1904
|
+
HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
|
|
1905
|
+
HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
|
|
1906
|
+
HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
|
|
1907
|
+
HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
|
|
1908
|
+
HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
|
|
1909
|
+
HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
|
|
1910
|
+
HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
|
|
1911
|
+
HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
|
|
1912
|
+
HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
|
|
1913
|
+
HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
|
|
1914
|
+
HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
|
|
1915
|
+
HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
|
|
1916
|
+
return HookUsageKind$1;
|
|
1917
|
+
}({});
|
|
1918
|
+
var HookUsage = class {
|
|
1919
|
+
bitflag = BigInt(0);
|
|
1920
|
+
constructor() {}
|
|
1921
|
+
union(kind) {
|
|
1922
|
+
this.bitflag |= BigInt(kind);
|
|
1923
|
+
}
|
|
1924
|
+
inner() {
|
|
1925
|
+
return Number(this.bitflag);
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
function extractHookUsage(plugin) {
|
|
1929
|
+
let hookUsage = new HookUsage();
|
|
1930
|
+
if (plugin.buildStart) hookUsage.union(HookUsageKind.buildStart);
|
|
1931
|
+
if (plugin.resolveId) hookUsage.union(HookUsageKind.resolveId);
|
|
1932
|
+
if (plugin.resolveDynamicImport) hookUsage.union(HookUsageKind.resolveDynamicImport);
|
|
1933
|
+
if (plugin.load) hookUsage.union(HookUsageKind.load);
|
|
1934
|
+
if (plugin.transform) hookUsage.union(HookUsageKind.transform);
|
|
1935
|
+
if (plugin.moduleParsed) hookUsage.union(HookUsageKind.moduleParsed);
|
|
1936
|
+
if (plugin.buildEnd) hookUsage.union(HookUsageKind.buildEnd);
|
|
1937
|
+
if (plugin.renderStart) hookUsage.union(HookUsageKind.renderStart);
|
|
1938
|
+
if (plugin.renderError) hookUsage.union(HookUsageKind.renderError);
|
|
1939
|
+
if (plugin.renderChunk) hookUsage.union(HookUsageKind.renderChunk);
|
|
1940
|
+
if (plugin.augmentChunkHash) hookUsage.union(HookUsageKind.augmentChunkHash);
|
|
1941
|
+
if (plugin.generateBundle) hookUsage.union(HookUsageKind.generateBundle);
|
|
1942
|
+
if (plugin.writeBundle) hookUsage.union(HookUsageKind.writeBundle);
|
|
1943
|
+
if (plugin.closeBundle) hookUsage.union(HookUsageKind.closeBundle);
|
|
1944
|
+
if (plugin.watchChange) hookUsage.union(HookUsageKind.watchChange);
|
|
1945
|
+
if (plugin.closeWatcher) hookUsage.union(HookUsageKind.closeWatcher);
|
|
1946
|
+
if (plugin.banner) hookUsage.union(HookUsageKind.banner);
|
|
1947
|
+
if (plugin.footer) hookUsage.union(HookUsageKind.footer);
|
|
1948
|
+
if (plugin.intro) hookUsage.union(HookUsageKind.intro);
|
|
1949
|
+
if (plugin.outro) hookUsage.union(HookUsageKind.outro);
|
|
1950
|
+
return hookUsage;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1876
1953
|
//#endregion
|
|
1877
1954
|
//#region src/plugin/bindingify-plugin.ts
|
|
1878
1955
|
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
|
|
@@ -1906,6 +1983,7 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
1906
1983
|
const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
|
|
1907
1984
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
|
|
1908
1985
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
|
|
1986
|
+
let hookUsage = extractHookUsage(plugin).inner();
|
|
1909
1987
|
const result = {
|
|
1910
1988
|
name: plugin.name,
|
|
1911
1989
|
buildStart,
|
|
@@ -1950,7 +2028,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
1950
2028
|
watchChange,
|
|
1951
2029
|
watchChangeMeta,
|
|
1952
2030
|
closeWatcher,
|
|
1953
|
-
closeWatcherMeta
|
|
2031
|
+
closeWatcherMeta,
|
|
2032
|
+
hookUsage
|
|
1954
2033
|
};
|
|
1955
2034
|
return wrapHandlers(result);
|
|
1956
2035
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolldown/browser",
|
|
3
|
-
"version": "1.0.0-beta.7-commit.
|
|
3
|
+
"version": "1.0.0-beta.7-commit.a684277",
|
|
4
4
|
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
5
5
|
"homepage": "https://rolldown.rs/",
|
|
6
6
|
"type": "module",
|
|
@@ -28,26 +28,22 @@
|
|
|
28
28
|
},
|
|
29
29
|
"main": "./dist/index.cjs",
|
|
30
30
|
"module": "./dist/index.mjs",
|
|
31
|
-
"types": "./dist/
|
|
31
|
+
"types": "./dist/index.d.cts",
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
|
-
"types": "./dist/types/index.d.ts",
|
|
35
34
|
"browser": "./dist/browser.mjs",
|
|
36
|
-
"
|
|
35
|
+
"require": "./dist/index.cjs",
|
|
37
36
|
"import": "./dist/index.mjs"
|
|
38
37
|
},
|
|
39
38
|
"./experimental": {
|
|
40
|
-
"types": "./dist/types/experimental-index.d.ts",
|
|
41
39
|
"require": "./dist/experimental-index.cjs",
|
|
42
40
|
"import": "./dist/experimental-index.mjs"
|
|
43
41
|
},
|
|
44
42
|
"./parallel-plugin": {
|
|
45
|
-
"types": "./dist/types/parallel-plugin.d.ts",
|
|
46
43
|
"require": "./dist/parallel-plugin.cjs",
|
|
47
44
|
"import": "./dist/parallel-plugin.mjs"
|
|
48
45
|
},
|
|
49
46
|
"./parseAst": {
|
|
50
|
-
"types": "./dist/types/parse-ast-index.d.ts",
|
|
51
47
|
"require": "./dist/parse-ast-index.cjs",
|
|
52
48
|
"import": "./dist/parse-ast-index.mjs"
|
|
53
49
|
},
|
|
@@ -75,11 +71,8 @@
|
|
|
75
71
|
},
|
|
76
72
|
"scripts": {
|
|
77
73
|
"build": "pnpm run build:debug",
|
|
78
|
-
"build
|
|
79
|
-
"build:
|
|
80
|
-
"build:release": "pnpm run --sequential \"/^build-(types|pkg:release)$/\"",
|
|
81
|
-
"build-pkg:debug": "pnpm run --filter rolldown build-browser:debug",
|
|
82
|
-
"build-pkg:release": "pnpm run --filter rolldown build-browser:release",
|
|
74
|
+
"build:debug": "pnpm run --filter rolldown build-browser:debug",
|
|
75
|
+
"build:release": "pnpm run --filter rolldown build-browser:release",
|
|
83
76
|
"build-node": "cross-env BROWSER_PKG=1 pnpm run --filter rolldown build-node",
|
|
84
77
|
"preinstall": "npx only-allow pnpm"
|
|
85
78
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
-
var __esm = (fn, res) => function() {
|
|
4
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
-
};
|
|
6
|
-
var __commonJS = (cb, mod) => function() {
|
|
7
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
export { __commonJS, __esm };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { InputOptions } from '../options/input-options';
|
|
2
|
-
import { OutputOptions } from '../options/output-options';
|
|
3
|
-
import type { RolldownOutput } from '../types/rolldown-output';
|
|
4
|
-
export interface BuildOptions extends InputOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Write the output to the file system
|
|
7
|
-
*
|
|
8
|
-
* @default true
|
|
9
|
-
*/
|
|
10
|
-
write?: boolean;
|
|
11
|
-
output?: OutputOptions;
|
|
12
|
-
}
|
|
13
|
-
declare function build(options: BuildOptions): Promise<RolldownOutput>;
|
|
14
|
-
/**
|
|
15
|
-
* Build multiple outputs __sequentially__.
|
|
16
|
-
*/
|
|
17
|
-
declare function build(options: BuildOptions[]): Promise<RolldownOutput[]>;
|
|
18
|
-
export { build };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { InputOptions } from '../options/input-options';
|
|
2
|
-
/**
|
|
3
|
-
* This is an experimental API. It's behavior may change in the future.
|
|
4
|
-
*
|
|
5
|
-
* Calling this API will only execute the scan stage of rolldown.
|
|
6
|
-
*/
|
|
7
|
-
export declare const experimental_scan: (input: InputOptions) => Promise<void>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BindingHmrOutput } from '../../binding';
|
|
2
|
-
import type { InputOptions } from '../../options/input-options';
|
|
3
|
-
import type { OutputOptions } from '../../options/output-options';
|
|
4
|
-
import type { RolldownOutput } from '../../types/rolldown-output';
|
|
5
|
-
export declare class RolldownBuild {
|
|
6
|
-
#private;
|
|
7
|
-
constructor(inputOptions: InputOptions);
|
|
8
|
-
get closed(): boolean;
|
|
9
|
-
generate(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
10
|
-
write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
|
|
11
|
-
close(): Promise<void>;
|
|
12
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
13
|
-
generateHmrPatch(changedFiles: string[]): Promise<BindingHmrOutput | undefined>;
|
|
14
|
-
get watchFiles(): string[];
|
|
15
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { BindingWatcherEvent } from '../../binding';
|
|
2
|
-
import { MaybePromise } from '../../types/utils';
|
|
3
|
-
export type WatcherEvent = 'close' | 'event' | 'restart' | 'change';
|
|
4
|
-
export type ChangeEvent = 'create' | 'update' | 'delete';
|
|
5
|
-
export type RollupWatcherEvent = {
|
|
6
|
-
code: 'START';
|
|
7
|
-
} | {
|
|
8
|
-
code: 'BUNDLE_START';
|
|
9
|
-
} | {
|
|
10
|
-
code: 'BUNDLE_END';
|
|
11
|
-
duration: number;
|
|
12
|
-
output: readonly string[];
|
|
13
|
-
} | {
|
|
14
|
-
code: 'END';
|
|
15
|
-
} | {
|
|
16
|
-
code: 'ERROR';
|
|
17
|
-
error: Error;
|
|
18
|
-
};
|
|
19
|
-
export declare class WatcherEmitter {
|
|
20
|
-
listeners: Map<WatcherEvent, Array<(...parameters: any[]) => MaybePromise<void>>>;
|
|
21
|
-
timer: any;
|
|
22
|
-
constructor();
|
|
23
|
-
on(event: 'change', listener: (id: string, change: {
|
|
24
|
-
event: ChangeEvent;
|
|
25
|
-
}) => MaybePromise<void>): this;
|
|
26
|
-
on(event: 'event', listener: (data: RollupWatcherEvent) => MaybePromise<void>): this;
|
|
27
|
-
on(event: 'restart' | 'close', listener: () => MaybePromise<void>): this;
|
|
28
|
-
onEvent(event: BindingWatcherEvent): Promise<void>;
|
|
29
|
-
close(): Promise<void>;
|
|
30
|
-
}
|
|
31
|
-
export type RolldownWatcher = WatcherEmitter;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BindingWatcher } from '../../binding';
|
|
2
|
-
import { WatchOptions } from '../../options/watch-options';
|
|
3
|
-
import { WatcherEmitter } from './watch-emitter';
|
|
4
|
-
export declare class Watcher {
|
|
5
|
-
closed: boolean;
|
|
6
|
-
inner: BindingWatcher;
|
|
7
|
-
emitter: WatcherEmitter;
|
|
8
|
-
stopWorkers: ((() => Promise<void>) | undefined)[];
|
|
9
|
-
constructor(emitter: WatcherEmitter, inner: BindingWatcher, stopWorkers: ((() => Promise<void>) | undefined)[]);
|
|
10
|
-
close(): Promise<void>;
|
|
11
|
-
start(): void;
|
|
12
|
-
}
|
|
13
|
-
export declare function createWatcher(emitter: WatcherEmitter, input: WatchOptions | WatchOptions[]): Promise<void>;
|