@rolldown/browser 1.0.0-beta.9-commit.0ec9e7d → 1.0.0-rc.10

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.
Files changed (82) hide show
  1. package/dist/cli.mjs +961 -1551
  2. package/dist/config.d.mts +9 -6
  3. package/dist/config.mjs +9 -11
  4. package/dist/constructors-DsfxKD6A.js +68 -0
  5. package/dist/error-BeZaDkS8.js +157 -0
  6. package/dist/experimental-index.browser.mjs +278 -44
  7. package/dist/experimental-index.d.mts +228 -68
  8. package/dist/experimental-index.mjs +274 -55
  9. package/dist/experimental-runtime-types.d.ts +98 -0
  10. package/dist/filter-index.d.mts +104 -2
  11. package/dist/filter-index.mjs +144 -5
  12. package/dist/get-log-filter.d.mts +3 -0
  13. package/dist/get-log-filter.mjs +68 -0
  14. package/dist/index.browser.mjs +238 -3
  15. package/dist/index.d.mts +4 -3
  16. package/dist/index.mjs +53 -6
  17. package/dist/{shared/parse-ast-index-BHaE0ECV.cjs → normalize-string-or-regex-TtAGUp42.js} +74 -147
  18. package/dist/parallel-plugin-worker.mjs +27 -35
  19. package/dist/parallel-plugin.d.mts +7 -7
  20. package/dist/parallel-plugin.mjs +1 -2
  21. package/dist/parse-ast-index.d.mts +28 -5
  22. package/dist/parse-ast-index.mjs +60 -4
  23. package/dist/plugins-index.browser.mjs +40 -0
  24. package/dist/plugins-index.d.mts +33 -0
  25. package/dist/plugins-index.mjs +40 -0
  26. package/dist/resolve-tsconfig-DThkUPSZ.js +112 -0
  27. package/dist/rolldown-binding.wasi-browser.js +46 -24
  28. package/dist/rolldown-binding.wasi.cjs +67 -24
  29. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  30. package/dist/rolldown-build-Chx5S-TB.js +5349 -0
  31. package/dist/shared/bindingify-input-options-Czbczr8Z.mjs +2168 -0
  32. package/dist/shared/composable-filters-B2ByPP8y.mjs +224 -0
  33. package/dist/shared/constructors-BVnf_fH1.d.mts +37 -0
  34. package/dist/shared/constructors-CemeNi29.mjs +68 -0
  35. package/dist/shared/define-config-DJOr6Iwt.mjs +6 -0
  36. package/dist/shared/define-config-i6TWE2hm.d.mts +3855 -0
  37. package/dist/shared/error-CQ6njWsV.mjs +86 -0
  38. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  39. package/dist/shared/{load-config-D7UduHRZ.mjs → load-config-CxvL5JxT.mjs} +32 -36
  40. package/dist/shared/logging-C6h4g8dA.d.mts +50 -0
  41. package/dist/shared/{parse-ast-index-vu376yZ1.mjs → logs-D80CXhvg.mjs} +25 -123
  42. package/dist/shared/normalize-string-or-regex-CF3Uz6aU.mjs +57 -0
  43. package/dist/shared/parse-CRhjbrcT.mjs +73 -0
  44. package/dist/shared/{prompt-CxjDC0Gn.cjs → prompt-BYQIwEjg.mjs} +301 -310
  45. package/dist/shared/resolve-tsconfig-Cwoo4h_o.mjs +112 -0
  46. package/dist/shared/rolldown-C3wFxOwq.mjs +40 -0
  47. package/dist/shared/rolldown-build-ChZOz6BP.mjs +3318 -0
  48. package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
  49. package/dist/shared/types-Cx3HYorz.d.mts +1302 -0
  50. package/dist/shared/utils-6wxe_LMG.d.mts +22 -0
  51. package/dist/shared/watch-C1jC1oFT.mjs +373 -0
  52. package/dist/utils-index.browser.mjs +2414 -0
  53. package/dist/utils-index.d.mts +374 -0
  54. package/dist/utils-index.mjs +2415 -0
  55. package/package.json +33 -38
  56. package/dist/cli.cjs +0 -1748
  57. package/dist/cli.d.cts +0 -1
  58. package/dist/config.cjs +0 -12
  59. package/dist/config.d.cts +0 -11
  60. package/dist/experimental-index.cjs +0 -129
  61. package/dist/experimental-index.d.cts +0 -96
  62. package/dist/filter-index.cjs +0 -53
  63. package/dist/filter-index.d.cts +0 -3
  64. package/dist/index.cjs +0 -9
  65. package/dist/index.d.cts +0 -3
  66. package/dist/parallel-plugin-worker.cjs +0 -33
  67. package/dist/parallel-plugin-worker.d.cts +0 -1
  68. package/dist/parallel-plugin.cjs +0 -8
  69. package/dist/parallel-plugin.d.cts +0 -14
  70. package/dist/parse-ast-index.cjs +0 -4
  71. package/dist/parse-ast-index.d.cts +0 -9
  72. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  73. package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
  74. package/dist/shared/define-config.d-D4lKXE9V.d.cts +0 -1165
  75. package/dist/shared/define-config.d-Dm9iNdt9.d.mts +0 -1165
  76. package/dist/shared/dist-BMVjvV-v.cjs +0 -249
  77. package/dist/shared/dist-CAn6dxW6.mjs +0 -153
  78. package/dist/shared/load-config-CtKjQ8Mn.cjs +0 -125
  79. package/dist/shared/prompt-GFYxfPw7.mjs +0 -854
  80. package/dist/shared/src-D0nc44MQ.mjs +0 -4691
  81. package/dist/shared/src-s89s870G.cjs +0 -4647
  82. package/dist/src-CeWghjQt.js +0 -4329
@@ -0,0 +1,224 @@
1
+ //#region src/utils/misc.ts
2
+ function arraify(value) {
3
+ return Array.isArray(value) ? value : [value];
4
+ }
5
+ function isPromiseLike(value) {
6
+ return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
7
+ }
8
+ function unimplemented(info) {
9
+ if (info) throw new Error(`unimplemented: ${info}`);
10
+ throw new Error("unimplemented");
11
+ }
12
+ function unreachable(info) {
13
+ if (info) throw new Error(`unreachable: ${info}`);
14
+ throw new Error("unreachable");
15
+ }
16
+ function unsupported(info) {
17
+ throw new Error(`UNSUPPORTED: ${info}`);
18
+ }
19
+ function noop(..._args) {}
20
+ //#endregion
21
+ //#region ../pluginutils/dist/utils.js
22
+ const postfixRE = /[?#].*$/;
23
+ function cleanUrl(url) {
24
+ return url.replace(postfixRE, "");
25
+ }
26
+ function extractQueryWithoutFragment(url) {
27
+ const questionMarkIndex = url.indexOf("?");
28
+ if (questionMarkIndex === -1) return "";
29
+ const fragmentIndex = url.indexOf("#", questionMarkIndex);
30
+ if (fragmentIndex === -1) return url.substring(questionMarkIndex);
31
+ else return url.substring(questionMarkIndex, fragmentIndex);
32
+ }
33
+ //#endregion
34
+ //#region ../pluginutils/dist/filter/composable-filters.js
35
+ var And = class {
36
+ kind;
37
+ args;
38
+ constructor(...args) {
39
+ if (args.length === 0) throw new Error("`And` expects at least one operand");
40
+ this.args = args;
41
+ this.kind = "and";
42
+ }
43
+ };
44
+ var Or = class {
45
+ kind;
46
+ args;
47
+ constructor(...args) {
48
+ if (args.length === 0) throw new Error("`Or` expects at least one operand");
49
+ this.args = args;
50
+ this.kind = "or";
51
+ }
52
+ };
53
+ var Not = class {
54
+ kind;
55
+ expr;
56
+ constructor(expr) {
57
+ this.expr = expr;
58
+ this.kind = "not";
59
+ }
60
+ };
61
+ var Id = class {
62
+ kind;
63
+ pattern;
64
+ params;
65
+ constructor(pattern, params) {
66
+ this.pattern = pattern;
67
+ this.kind = "id";
68
+ this.params = params ?? { cleanUrl: false };
69
+ }
70
+ };
71
+ var ImporterId = class {
72
+ kind;
73
+ pattern;
74
+ params;
75
+ constructor(pattern, params) {
76
+ this.pattern = pattern;
77
+ this.kind = "importerId";
78
+ this.params = params ?? { cleanUrl: false };
79
+ }
80
+ };
81
+ var ModuleType = class {
82
+ kind;
83
+ pattern;
84
+ constructor(pattern) {
85
+ this.pattern = pattern;
86
+ this.kind = "moduleType";
87
+ }
88
+ };
89
+ var Code = class {
90
+ kind;
91
+ pattern;
92
+ constructor(expr) {
93
+ this.pattern = expr;
94
+ this.kind = "code";
95
+ }
96
+ };
97
+ var Query = class {
98
+ kind;
99
+ key;
100
+ pattern;
101
+ constructor(key, pattern) {
102
+ this.pattern = pattern;
103
+ this.key = key;
104
+ this.kind = "query";
105
+ }
106
+ };
107
+ var Include = class {
108
+ kind;
109
+ expr;
110
+ constructor(expr) {
111
+ this.expr = expr;
112
+ this.kind = "include";
113
+ }
114
+ };
115
+ var Exclude = class {
116
+ kind;
117
+ expr;
118
+ constructor(expr) {
119
+ this.expr = expr;
120
+ this.kind = "exclude";
121
+ }
122
+ };
123
+ function and(...args) {
124
+ return new And(...args);
125
+ }
126
+ function or(...args) {
127
+ return new Or(...args);
128
+ }
129
+ function not(expr) {
130
+ return new Not(expr);
131
+ }
132
+ function id(pattern, params) {
133
+ return new Id(pattern, params);
134
+ }
135
+ function importerId(pattern, params) {
136
+ return new ImporterId(pattern, params);
137
+ }
138
+ function moduleType(pattern) {
139
+ return new ModuleType(pattern);
140
+ }
141
+ function code(pattern) {
142
+ return new Code(pattern);
143
+ }
144
+ function query(key, pattern) {
145
+ return new Query(key, pattern);
146
+ }
147
+ function include(expr) {
148
+ return new Include(expr);
149
+ }
150
+ function exclude(expr) {
151
+ return new Exclude(expr);
152
+ }
153
+ /**
154
+ * convert a queryObject to FilterExpression like
155
+ * ```js
156
+ * and(query(k1, v1), query(k2, v2))
157
+ * ```
158
+ * @param queryFilterObject The query filter object needs to be matched.
159
+ * @returns a `And` FilterExpression
160
+ */
161
+ function queries(queryFilter) {
162
+ return and(...Object.entries(queryFilter).map(([key, value]) => {
163
+ return new Query(key, value);
164
+ }));
165
+ }
166
+ function interpreter(exprs, code, id, moduleType, importerId) {
167
+ let arr = [];
168
+ if (Array.isArray(exprs)) arr = exprs;
169
+ else arr = [exprs];
170
+ return interpreterImpl(arr, code, id, moduleType, importerId);
171
+ }
172
+ function interpreterImpl(expr, code, id, moduleType, importerId, ctx = {}) {
173
+ let hasInclude = false;
174
+ for (const e of expr) switch (e.kind) {
175
+ case "include":
176
+ hasInclude = true;
177
+ if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return true;
178
+ break;
179
+ case "exclude":
180
+ if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return false;
181
+ break;
182
+ }
183
+ return !hasInclude;
184
+ }
185
+ function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
186
+ switch (expr.kind) {
187
+ case "and": return expr.args.every((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
188
+ case "or": return expr.args.some((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
189
+ case "not": return !exprInterpreter(expr.expr, code, id, moduleType, importerId, ctx);
190
+ case "id": {
191
+ if (id === void 0) throw new Error("`id` is required for `id` expression");
192
+ let idToMatch = id;
193
+ if (expr.params.cleanUrl) idToMatch = cleanUrl(idToMatch);
194
+ return typeof expr.pattern === "string" ? idToMatch === expr.pattern : expr.pattern.test(idToMatch);
195
+ }
196
+ case "importerId": {
197
+ if (importerId === void 0) return false;
198
+ let importerIdToMatch = importerId;
199
+ if (expr.params.cleanUrl) importerIdToMatch = cleanUrl(importerIdToMatch);
200
+ return typeof expr.pattern === "string" ? importerIdToMatch === expr.pattern : expr.pattern.test(importerIdToMatch);
201
+ }
202
+ case "moduleType":
203
+ if (moduleType === void 0) throw new Error("`moduleType` is required for `moduleType` expression");
204
+ return moduleType === expr.pattern;
205
+ case "code":
206
+ if (code === void 0) throw new Error("`code` is required for `code` expression");
207
+ return typeof expr.pattern === "string" ? code.includes(expr.pattern) : expr.pattern.test(code);
208
+ case "query": {
209
+ if (id === void 0) throw new Error("`id` is required for `Query` expression");
210
+ if (!ctx.urlSearchParamsCache) {
211
+ let queryString = extractQueryWithoutFragment(id);
212
+ ctx.urlSearchParamsCache = new URLSearchParams(queryString);
213
+ }
214
+ let urlParams = ctx.urlSearchParamsCache;
215
+ if (typeof expr.pattern === "boolean") if (expr.pattern) return urlParams.has(expr.key);
216
+ else return !urlParams.has(expr.key);
217
+ else if (typeof expr.pattern === "string") return urlParams.get(expr.key) === expr.pattern;
218
+ else return expr.pattern.test(urlParams.get(expr.key) ?? "");
219
+ }
220
+ default: throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
221
+ }
222
+ }
223
+ //#endregion
224
+ export { noop as _, id as a, unsupported as b, interpreter as c, not as d, or as f, isPromiseLike as g, arraify as h, exprInterpreter as i, interpreterImpl as l, query as m, code as n, importerId as o, queries as p, exclude as r, include as s, and as t, moduleType as u, unimplemented as v, unreachable as y };
@@ -0,0 +1,37 @@
1
+ import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-6wxe_LMG.mjs";
2
+ import { BindingEsmExternalRequirePluginConfig, BindingIsolatedDeclarationPluginConfig, BindingViteBuildImportAnalysisPluginConfig, BindingViteDynamicImportVarsPluginConfig, BindingViteImportGlobPluginConfig, BindingViteJsonPluginConfig, BindingViteModulePreloadPolyfillPluginConfig, BindingViteReactRefreshWrapperPluginConfig, BindingViteReporterPluginConfig, BindingViteResolvePluginConfig } from "../binding.cjs";
3
+
4
+ //#region src/builtin-plugin/constructors.d.ts
5
+ declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
6
+ type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConfig, "include" | "exclude"> & {
7
+ include?: StringOrRegExp | StringOrRegExp[];
8
+ exclude?: StringOrRegExp | StringOrRegExp[];
9
+ };
10
+ declare function viteDynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
11
+ declare function viteImportGlobPlugin(config?: BindingViteImportGlobPluginConfig): BuiltinPlugin;
12
+ declare function viteReporterPlugin(config: BindingViteReporterPluginConfig): BuiltinPlugin;
13
+ declare function viteWasmFallbackPlugin(): BuiltinPlugin;
14
+ declare function viteLoadFallbackPlugin(): BuiltinPlugin;
15
+ declare function viteJsonPlugin(config: BindingViteJsonPluginConfig): BuiltinPlugin;
16
+ declare function viteBuildImportAnalysisPlugin(config: BindingViteBuildImportAnalysisPluginConfig): BuiltinPlugin;
17
+ declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, "yarnPnp">): BuiltinPlugin;
18
+ declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
19
+ declare function viteWebWorkerPostPlugin(): BuiltinPlugin;
20
+ /**
21
+ * A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
22
+ *
23
+ * @see https://rolldown.rs/builtin-plugins/esm-external-require
24
+ * @category Builtin Plugins
25
+ */
26
+ declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
27
+ type ViteReactRefreshWrapperPluginConfig = Omit<BindingViteReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
28
+ include?: StringOrRegExp | StringOrRegExp[];
29
+ exclude?: StringOrRegExp | StringOrRegExp[];
30
+ };
31
+ /**
32
+ * This plugin should not be used for Rolldown.
33
+ */
34
+ declare function oxcRuntimePlugin(): BuiltinPlugin;
35
+ declare function viteReactRefreshWrapperPlugin(config: ViteReactRefreshWrapperPluginConfig): BuiltinPlugin;
36
+ //#endregion
37
+ export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
@@ -0,0 +1,68 @@
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CF3Uz6aU.mjs";
2
+ //#region src/builtin-plugin/constructors.ts
3
+ function viteModulePreloadPolyfillPlugin(config) {
4
+ return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
5
+ }
6
+ function viteDynamicImportVarsPlugin(config) {
7
+ if (config) {
8
+ config.include = normalizedStringOrRegex(config.include);
9
+ config.exclude = normalizedStringOrRegex(config.exclude);
10
+ }
11
+ return new BuiltinPlugin("builtin:vite-dynamic-import-vars", config);
12
+ }
13
+ function viteImportGlobPlugin(config) {
14
+ return new BuiltinPlugin("builtin:vite-import-glob", config);
15
+ }
16
+ function viteReporterPlugin(config) {
17
+ return new BuiltinPlugin("builtin:vite-reporter", config);
18
+ }
19
+ function viteWasmFallbackPlugin() {
20
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-wasm-fallback"));
21
+ }
22
+ function viteLoadFallbackPlugin() {
23
+ return new BuiltinPlugin("builtin:vite-load-fallback");
24
+ }
25
+ function viteJsonPlugin(config) {
26
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-json", config));
27
+ }
28
+ function viteBuildImportAnalysisPlugin(config) {
29
+ return new BuiltinPlugin("builtin:vite-build-import-analysis", config);
30
+ }
31
+ function viteResolvePlugin(config) {
32
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", {
33
+ ...config,
34
+ yarnPnp: typeof process === "object" && !!process.versions?.pnp
35
+ }));
36
+ }
37
+ function isolatedDeclarationPlugin(config) {
38
+ return new BuiltinPlugin("builtin:isolated-declaration", config);
39
+ }
40
+ function viteWebWorkerPostPlugin() {
41
+ return new BuiltinPlugin("builtin:vite-web-worker-post");
42
+ }
43
+ /**
44
+ * A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
45
+ *
46
+ * @see https://rolldown.rs/builtin-plugins/esm-external-require
47
+ * @category Builtin Plugins
48
+ */
49
+ function esmExternalRequirePlugin(config) {
50
+ const plugin = new BuiltinPlugin("builtin:esm-external-require", config);
51
+ plugin.enforce = "pre";
52
+ return plugin;
53
+ }
54
+ /**
55
+ * This plugin should not be used for Rolldown.
56
+ */
57
+ function oxcRuntimePlugin() {
58
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:oxc-runtime"));
59
+ }
60
+ function viteReactRefreshWrapperPlugin(config) {
61
+ if (config) {
62
+ config.include = normalizedStringOrRegex(config.include);
63
+ config.exclude = normalizedStringOrRegex(config.exclude);
64
+ }
65
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
66
+ }
67
+ //#endregion
68
+ export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWasmFallbackPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
@@ -0,0 +1,6 @@
1
+ //#region src/utils/define-config.ts
2
+ function defineConfig(config) {
3
+ return config;
4
+ }
5
+ //#endregion
6
+ export { defineConfig as t };