@rolldown/browser 1.0.0-beta.9-commit.ca4e9dd → 1.0.0-rc.1

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 (73) hide show
  1. package/dist/cli-setup.mjs +16 -0
  2. package/dist/cli.mjs +1084 -1281
  3. package/dist/config.d.mts +1 -3
  4. package/dist/config.mjs +7 -5
  5. package/dist/constructors-B8gqcrFr.js +61 -0
  6. package/dist/experimental-index.browser.mjs +225 -50
  7. package/dist/experimental-index.d.mts +164 -76
  8. package/dist/experimental-index.mjs +220 -60
  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 +123 -3
  12. package/dist/get-log-filter.d.mts +7 -0
  13. package/dist/get-log-filter.mjs +48 -0
  14. package/dist/index.browser.mjs +242 -2
  15. package/dist/index.d.mts +4 -3
  16. package/dist/index.mjs +54 -5
  17. package/dist/{shared/parse-ast-index-BHaE0ECV.cjs → normalize-string-or-regex-CL-PJZI7.js} +70 -137
  18. package/dist/parallel-plugin-worker.mjs +26 -33
  19. package/dist/parallel-plugin.d.mts +7 -7
  20. package/dist/parse-ast-index.d.mts +5 -6
  21. package/dist/parse-ast-index.mjs +1 -2
  22. package/dist/plugins-index.browser.mjs +39 -0
  23. package/dist/plugins-index.d.mts +30 -0
  24. package/dist/plugins-index.mjs +39 -0
  25. package/dist/rolldown-binding.wasi-browser.js +41 -24
  26. package/dist/rolldown-binding.wasi.cjs +62 -24
  27. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  28. package/dist/rolldown-build-C4tDS_XC.js +5055 -0
  29. package/dist/shared/bindingify-input-options-Bp2kpiI8.mjs +2231 -0
  30. package/dist/shared/composable-filters-CIxSuZSM.mjs +227 -0
  31. package/dist/shared/constructors-5bt5oBhE.d.mts +28 -0
  32. package/dist/shared/constructors-BTW-c3jX.mjs +61 -0
  33. package/dist/shared/define-config-CDlEOpr1.d.mts +3531 -0
  34. package/dist/shared/define-config-Dlptvz3X.mjs +7 -0
  35. package/dist/shared/{load-config-vRugYmJ3.mjs → load-config-BBZgIUGN.mjs} +23 -33
  36. package/dist/shared/logging-Nvu645a7.d.mts +50 -0
  37. package/dist/shared/{parse-ast-index-vu376yZ1.mjs → logs-B2CASPcx.mjs} +21 -116
  38. package/dist/shared/normalize-string-or-regex-DIwprzLy.mjs +60 -0
  39. package/dist/shared/parse-ast-index-2ahkCVK6.mjs +98 -0
  40. package/dist/shared/{prompt-CxjDC0Gn.cjs → prompt-B6NrDD1-.mjs} +301 -308
  41. package/dist/shared/rolldown-C0_W0QdY.mjs +42 -0
  42. package/dist/shared/rolldown-build-DLuUhuNw.mjs +2368 -0
  43. package/dist/shared/types-CIYK49jr.d.mts +1300 -0
  44. package/dist/shared/utils-CqMTwlsR.d.mts +22 -0
  45. package/dist/shared/watch-eIop0yN6.mjs +378 -0
  46. package/package.json +33 -38
  47. package/dist/cli.cjs +0 -1748
  48. package/dist/config.cjs +0 -12
  49. package/dist/config.d.cts +0 -11
  50. package/dist/experimental-index.cjs +0 -129
  51. package/dist/experimental-index.d.cts +0 -96
  52. package/dist/filter-index.cjs +0 -53
  53. package/dist/filter-index.d.cts +0 -3
  54. package/dist/index.cjs +0 -9
  55. package/dist/index.d.cts +0 -3
  56. package/dist/parallel-plugin-worker.cjs +0 -33
  57. package/dist/parallel-plugin-worker.d.cts +0 -1
  58. package/dist/parallel-plugin.cjs +0 -8
  59. package/dist/parallel-plugin.d.cts +0 -14
  60. package/dist/parse-ast-index.cjs +0 -4
  61. package/dist/parse-ast-index.d.cts +0 -9
  62. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  63. package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
  64. package/dist/shared/define-config.d-D4lKXE9V.d.cts +0 -1165
  65. package/dist/shared/define-config.d-Dm9iNdt9.d.mts +0 -1165
  66. package/dist/shared/dist-BMVjvV-v.cjs +0 -249
  67. package/dist/shared/dist-CAn6dxW6.mjs +0 -153
  68. package/dist/shared/load-config-42uI5RSv.cjs +0 -125
  69. package/dist/shared/prompt-GFYxfPw7.mjs +0 -854
  70. package/dist/shared/src-Cu4_wKhx.mjs +0 -4691
  71. package/dist/shared/src-CzdOBfDC.cjs +0 -4647
  72. package/dist/src-DQ33eKZS.js +0 -4333
  73. /package/dist/{cli.d.cts → cli-setup.d.mts} +0 -0
@@ -0,0 +1,227 @@
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
+
21
+ //#endregion
22
+ //#region ../pluginutils/dist/utils.js
23
+ const postfixRE = /[?#].*$/;
24
+ function cleanUrl(url) {
25
+ return url.replace(postfixRE, "");
26
+ }
27
+ function extractQueryWithoutFragment(url) {
28
+ const questionMarkIndex = url.indexOf("?");
29
+ if (questionMarkIndex === -1) return "";
30
+ const fragmentIndex = url.indexOf("#", questionMarkIndex);
31
+ if (fragmentIndex === -1) return url.substring(questionMarkIndex);
32
+ else return url.substring(questionMarkIndex, fragmentIndex);
33
+ }
34
+
35
+ //#endregion
36
+ //#region ../pluginutils/dist/filter/composable-filters.js
37
+ var And = class {
38
+ kind;
39
+ args;
40
+ constructor(...args) {
41
+ if (args.length === 0) throw new Error("`And` expects at least one operand");
42
+ this.args = args;
43
+ this.kind = "and";
44
+ }
45
+ };
46
+ var Or = class {
47
+ kind;
48
+ args;
49
+ constructor(...args) {
50
+ if (args.length === 0) throw new Error("`Or` expects at least one operand");
51
+ this.args = args;
52
+ this.kind = "or";
53
+ }
54
+ };
55
+ var Not = class {
56
+ kind;
57
+ expr;
58
+ constructor(expr) {
59
+ this.expr = expr;
60
+ this.kind = "not";
61
+ }
62
+ };
63
+ var Id = class {
64
+ kind;
65
+ pattern;
66
+ params;
67
+ constructor(pattern, params) {
68
+ this.pattern = pattern;
69
+ this.kind = "id";
70
+ this.params = params ?? { cleanUrl: false };
71
+ }
72
+ };
73
+ var ImporterId = class {
74
+ kind;
75
+ pattern;
76
+ params;
77
+ constructor(pattern, params) {
78
+ this.pattern = pattern;
79
+ this.kind = "importerId";
80
+ this.params = params ?? { cleanUrl: false };
81
+ }
82
+ };
83
+ var ModuleType = class {
84
+ kind;
85
+ pattern;
86
+ constructor(pattern) {
87
+ this.pattern = pattern;
88
+ this.kind = "moduleType";
89
+ }
90
+ };
91
+ var Code = class {
92
+ kind;
93
+ pattern;
94
+ constructor(expr) {
95
+ this.pattern = expr;
96
+ this.kind = "code";
97
+ }
98
+ };
99
+ var Query = class {
100
+ kind;
101
+ key;
102
+ pattern;
103
+ constructor(key, pattern) {
104
+ this.pattern = pattern;
105
+ this.key = key;
106
+ this.kind = "query";
107
+ }
108
+ };
109
+ var Include = class {
110
+ kind;
111
+ expr;
112
+ constructor(expr) {
113
+ this.expr = expr;
114
+ this.kind = "include";
115
+ }
116
+ };
117
+ var Exclude = class {
118
+ kind;
119
+ expr;
120
+ constructor(expr) {
121
+ this.expr = expr;
122
+ this.kind = "exclude";
123
+ }
124
+ };
125
+ function and(...args) {
126
+ return new And(...args);
127
+ }
128
+ function or(...args) {
129
+ return new Or(...args);
130
+ }
131
+ function not(expr) {
132
+ return new Not(expr);
133
+ }
134
+ function id(pattern, params) {
135
+ return new Id(pattern, params);
136
+ }
137
+ function importerId(pattern, params) {
138
+ return new ImporterId(pattern, params);
139
+ }
140
+ function moduleType(pattern) {
141
+ return new ModuleType(pattern);
142
+ }
143
+ function code(pattern) {
144
+ return new Code(pattern);
145
+ }
146
+ function query(key, pattern) {
147
+ return new Query(key, pattern);
148
+ }
149
+ function include(expr) {
150
+ return new Include(expr);
151
+ }
152
+ function exclude(expr) {
153
+ return new Exclude(expr);
154
+ }
155
+ /**
156
+ * convert a queryObject to FilterExpression like
157
+ * ```js
158
+ * and(query(k1, v1), query(k2, v2))
159
+ * ```
160
+ * @param queryFilterObject The query filter object needs to be matched.
161
+ * @returns a `And` FilterExpression
162
+ */
163
+ function queries(queryFilter) {
164
+ return and(...Object.entries(queryFilter).map(([key, value]) => {
165
+ return new Query(key, value);
166
+ }));
167
+ }
168
+ function interpreter(exprs, code, id, moduleType, importerId) {
169
+ let arr = [];
170
+ if (Array.isArray(exprs)) arr = exprs;
171
+ else arr = [exprs];
172
+ return interpreterImpl(arr, code, id, moduleType, importerId);
173
+ }
174
+ function interpreterImpl(expr, code, id, moduleType, importerId, ctx = {}) {
175
+ let hasInclude = false;
176
+ for (const e of expr) switch (e.kind) {
177
+ case "include":
178
+ hasInclude = true;
179
+ if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return true;
180
+ break;
181
+ case "exclude":
182
+ if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) return false;
183
+ break;
184
+ }
185
+ return !hasInclude;
186
+ }
187
+ function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
188
+ switch (expr.kind) {
189
+ case "and": return expr.args.every((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
190
+ case "or": return expr.args.some((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
191
+ case "not": return !exprInterpreter(expr.expr, code, id, moduleType, importerId, ctx);
192
+ case "id": {
193
+ if (id === void 0) throw new Error("`id` is required for `id` expression");
194
+ let idToMatch = id;
195
+ if (expr.params.cleanUrl) idToMatch = cleanUrl(idToMatch);
196
+ return typeof expr.pattern === "string" ? idToMatch === expr.pattern : expr.pattern.test(idToMatch);
197
+ }
198
+ case "importerId": {
199
+ if (importerId === void 0) return false;
200
+ let importerIdToMatch = importerId;
201
+ if (expr.params.cleanUrl) importerIdToMatch = cleanUrl(importerIdToMatch);
202
+ return typeof expr.pattern === "string" ? importerIdToMatch === expr.pattern : expr.pattern.test(importerIdToMatch);
203
+ }
204
+ case "moduleType":
205
+ if (moduleType === void 0) throw new Error("`moduleType` is required for `moduleType` expression");
206
+ return moduleType === expr.pattern;
207
+ case "code":
208
+ if (code === void 0) throw new Error("`code` is required for `code` expression");
209
+ return typeof expr.pattern === "string" ? code.includes(expr.pattern) : expr.pattern.test(code);
210
+ case "query": {
211
+ if (id === void 0) throw new Error("`id` is required for `Query` expression");
212
+ if (!ctx.urlSearchParamsCache) {
213
+ let queryString = extractQueryWithoutFragment(id);
214
+ ctx.urlSearchParamsCache = new URLSearchParams(queryString);
215
+ }
216
+ let urlParams = ctx.urlSearchParamsCache;
217
+ if (typeof expr.pattern === "boolean") if (expr.pattern) return urlParams.has(expr.key);
218
+ else return !urlParams.has(expr.key);
219
+ else if (typeof expr.pattern === "string") return urlParams.get(expr.key) === expr.pattern;
220
+ else return expr.pattern.test(urlParams.get(expr.key) ?? "");
221
+ }
222
+ default: throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
223
+ }
224
+ }
225
+
226
+ //#endregion
227
+ 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,28 @@
1
+ import { s as StringOrRegExp, t as BuiltinPlugin } from "./utils-CqMTwlsR.mjs";
2
+ import { BindingEsmExternalRequirePluginConfig, BindingIsolatedDeclarationPluginConfig, BindingViteBuildImportAnalysisPluginConfig, BindingViteDynamicImportVarsPluginConfig, BindingViteImportGlobPluginConfig, BindingViteJsonPluginConfig, BindingViteModulePreloadPolyfillPluginConfig, BindingViteReactRefreshWrapperPluginConfig, BindingViteReporterPluginConfig, BindingViteResolvePluginConfig, BindingViteWasmHelperPluginConfig } 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 viteWasmHelperPlugin(config: BindingViteWasmHelperPluginConfig): BuiltinPlugin;
14
+ declare function viteWasmFallbackPlugin(): BuiltinPlugin;
15
+ declare function viteLoadFallbackPlugin(): BuiltinPlugin;
16
+ declare function viteJsonPlugin(config: BindingViteJsonPluginConfig): BuiltinPlugin;
17
+ declare function viteBuildImportAnalysisPlugin(config: BindingViteBuildImportAnalysisPluginConfig): BuiltinPlugin;
18
+ declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, "yarnPnp">): BuiltinPlugin;
19
+ declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
20
+ declare function viteWebWorkerPostPlugin(): BuiltinPlugin;
21
+ declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
22
+ type ViteReactRefreshWrapperPluginConfig = Omit<BindingViteReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
23
+ include?: StringOrRegExp | StringOrRegExp[];
24
+ exclude?: StringOrRegExp | StringOrRegExp[];
25
+ };
26
+ declare function viteReactRefreshWrapperPlugin(config: ViteReactRefreshWrapperPluginConfig): BuiltinPlugin;
27
+ //#endregion
28
+ export { viteImportGlobPlugin as a, viteModulePreloadPolyfillPlugin as c, viteResolvePlugin as d, viteWasmFallbackPlugin as f, viteDynamicImportVarsPlugin as i, viteReactRefreshWrapperPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteJsonPlugin as o, viteWasmHelperPlugin as p, viteBuildImportAnalysisPlugin as r, viteLoadFallbackPlugin as s, esmExternalRequirePlugin as t, viteReporterPlugin as u };
@@ -0,0 +1,61 @@
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-DIwprzLy.mjs";
2
+
3
+ //#region src/builtin-plugin/constructors.ts
4
+ function viteModulePreloadPolyfillPlugin(config) {
5
+ return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
6
+ }
7
+ function viteDynamicImportVarsPlugin(config) {
8
+ if (config) {
9
+ config.include = normalizedStringOrRegex(config.include);
10
+ config.exclude = normalizedStringOrRegex(config.exclude);
11
+ }
12
+ return new BuiltinPlugin("builtin:vite-dynamic-import-vars", config);
13
+ }
14
+ function viteImportGlobPlugin(config) {
15
+ return new BuiltinPlugin("builtin:vite-import-glob", config);
16
+ }
17
+ function viteReporterPlugin(config) {
18
+ return new BuiltinPlugin("builtin:vite-reporter", config);
19
+ }
20
+ function viteWasmHelperPlugin(config) {
21
+ return new BuiltinPlugin("builtin:vite-wasm-helper", config);
22
+ }
23
+ function viteWasmFallbackPlugin() {
24
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-wasm-fallback"));
25
+ }
26
+ function viteLoadFallbackPlugin() {
27
+ return new BuiltinPlugin("builtin:vite-load-fallback");
28
+ }
29
+ function viteJsonPlugin(config) {
30
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-json", config));
31
+ }
32
+ function viteBuildImportAnalysisPlugin(config) {
33
+ return new BuiltinPlugin("builtin:vite-build-import-analysis", config);
34
+ }
35
+ function viteResolvePlugin(config) {
36
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", {
37
+ ...config,
38
+ yarnPnp: typeof process === "object" && !!process.versions?.pnp
39
+ }));
40
+ }
41
+ function isolatedDeclarationPlugin(config) {
42
+ return new BuiltinPlugin("builtin:isolated-declaration", config);
43
+ }
44
+ function viteWebWorkerPostPlugin() {
45
+ return new BuiltinPlugin("builtin:vite-web-worker-post");
46
+ }
47
+ function esmExternalRequirePlugin(config) {
48
+ const plugin = new BuiltinPlugin("builtin:esm-external-require", config);
49
+ plugin.enforce = "pre";
50
+ return plugin;
51
+ }
52
+ function viteReactRefreshWrapperPlugin(config) {
53
+ if (config) {
54
+ config.include = normalizedStringOrRegex(config.include);
55
+ config.exclude = normalizedStringOrRegex(config.exclude);
56
+ }
57
+ return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
58
+ }
59
+
60
+ //#endregion
61
+ export { viteImportGlobPlugin as a, viteModulePreloadPolyfillPlugin as c, viteResolvePlugin as d, viteWasmFallbackPlugin as f, viteDynamicImportVarsPlugin as i, viteReactRefreshWrapperPlugin as l, viteWebWorkerPostPlugin as m, isolatedDeclarationPlugin as n, viteJsonPlugin as o, viteWasmHelperPlugin as p, viteBuildImportAnalysisPlugin as r, viteLoadFallbackPlugin as s, esmExternalRequirePlugin as t, viteReporterPlugin as u };