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

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-BntP6Bjl.js +5063 -0
  29. package/dist/shared/bindingify-input-options-CObJx_Uj.mjs +2236 -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-C-sO_cLw.d.mts +3679 -0
  34. package/dist/shared/define-config-Dlptvz3X.mjs +7 -0
  35. package/dist/shared/{load-config-D7UduHRZ.mjs → load-config-hx3WBhLe.mjs} +23 -33
  36. package/dist/shared/logging-RB67zQ4N.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-BQpfNG1v.mjs +98 -0
  40. package/dist/shared/{prompt-CxjDC0Gn.cjs → prompt-CYPmuhh-.mjs} +301 -308
  41. package/dist/shared/rolldown-D2E0YTeB.mjs +42 -0
  42. package/dist/shared/rolldown-build-Do6WlRGM.mjs +2371 -0
  43. package/dist/shared/types-CIhJMr1h.d.mts +1300 -0
  44. package/dist/shared/utils-CqMTwlsR.d.mts +22 -0
  45. package/dist/shared/watch-BsneBCNP.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-CtKjQ8Mn.cjs +0 -125
  69. package/dist/shared/prompt-GFYxfPw7.mjs +0 -854
  70. package/dist/shared/src-D0nc44MQ.mjs +0 -4691
  71. package/dist/shared/src-s89s870G.cjs +0 -4647
  72. package/dist/src-CeWghjQt.js +0 -4329
  73. /package/dist/{cli.d.cts → cli-setup.d.mts} +0 -0
@@ -1,249 +0,0 @@
1
-
2
- //#region src/utils/misc.ts
3
- function arraify(value) {
4
- return Array.isArray(value) ? value : [value];
5
- }
6
- function isNullish(value) {
7
- return value === null || value === void 0;
8
- }
9
- function isPromiseLike(value) {
10
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
11
- }
12
- function unimplemented(info) {
13
- if (info) throw new Error(`unimplemented: ${info}`);
14
- throw new Error("unimplemented");
15
- }
16
- function unreachable(info) {
17
- if (info) throw new Error(`unreachable: ${info}`);
18
- throw new Error("unreachable");
19
- }
20
- function unsupported(info) {
21
- throw new Error(`UNSUPPORTED: ${info}`);
22
- }
23
- function noop(..._args) {}
24
-
25
- //#endregion
26
- //#region ../pluginutils/dist/index.js
27
- var And = class {
28
- kind;
29
- args;
30
- constructor(...args) {
31
- if (args.length === 0) throw new Error("`And` expects at least one operand");
32
- this.args = args;
33
- this.kind = "and";
34
- }
35
- };
36
- var Or = class {
37
- kind;
38
- args;
39
- constructor(...args) {
40
- if (args.length === 0) throw new Error("`Or` expects at least one operand");
41
- this.args = args;
42
- this.kind = "or";
43
- }
44
- };
45
- var Not = class {
46
- kind;
47
- expr;
48
- constructor(expr) {
49
- this.expr = expr;
50
- this.kind = "not";
51
- }
52
- };
53
- var Id = class {
54
- kind;
55
- pattern;
56
- params;
57
- constructor(pattern, params) {
58
- this.pattern = pattern;
59
- this.kind = "id";
60
- this.params = params ?? { cleanUrl: false };
61
- }
62
- };
63
- var ModuleType = class {
64
- kind;
65
- pattern;
66
- constructor(pattern) {
67
- this.pattern = pattern;
68
- this.kind = "moduleType";
69
- }
70
- };
71
- var Code = class {
72
- kind;
73
- pattern;
74
- constructor(expr) {
75
- this.pattern = expr;
76
- this.kind = "code";
77
- }
78
- };
79
- var Query = class {
80
- kind;
81
- key;
82
- pattern;
83
- constructor(key, pattern) {
84
- this.pattern = pattern;
85
- this.key = key;
86
- this.kind = "query";
87
- }
88
- };
89
- var Include = class {
90
- kind;
91
- expr;
92
- constructor(expr) {
93
- this.expr = expr;
94
- this.kind = "include";
95
- }
96
- };
97
- var Exclude = class {
98
- kind;
99
- expr;
100
- constructor(expr) {
101
- this.expr = expr;
102
- this.kind = "exclude";
103
- }
104
- };
105
- function and(...args) {
106
- return new And(...args);
107
- }
108
- function or(...args) {
109
- return new Or(...args);
110
- }
111
- function not(expr) {
112
- return new Not(expr);
113
- }
114
- function id(pattern, params) {
115
- return new Id(pattern, params);
116
- }
117
- function moduleType(pattern) {
118
- return new ModuleType(pattern);
119
- }
120
- function code(pattern) {
121
- return new Code(pattern);
122
- }
123
- function query(key, pattern) {
124
- return new Query(key, pattern);
125
- }
126
- function include(expr) {
127
- return new Include(expr);
128
- }
129
- function exclude(expr) {
130
- return new Exclude(expr);
131
- }
132
- /**
133
- * convert a queryObject to FilterExpression like
134
- * ```js
135
- * and(query(k1, v1), query(k2, v2))
136
- * ```
137
- * @param queryFilterObject The query filter object needs to be matched.
138
- * @returns a `And` FilterExpression
139
- */
140
- function queries(queryFilter) {
141
- let arr = Object.entries(queryFilter).map(([key, value]) => {
142
- return new Query(key, value);
143
- });
144
- return and(...arr);
145
- }
146
-
147
- //#endregion
148
- Object.defineProperty(exports, 'and', {
149
- enumerable: true,
150
- get: function () {
151
- return and;
152
- }
153
- });
154
- Object.defineProperty(exports, 'arraify', {
155
- enumerable: true,
156
- get: function () {
157
- return arraify;
158
- }
159
- });
160
- Object.defineProperty(exports, 'code', {
161
- enumerable: true,
162
- get: function () {
163
- return code;
164
- }
165
- });
166
- Object.defineProperty(exports, 'exclude', {
167
- enumerable: true,
168
- get: function () {
169
- return exclude;
170
- }
171
- });
172
- Object.defineProperty(exports, 'id', {
173
- enumerable: true,
174
- get: function () {
175
- return id;
176
- }
177
- });
178
- Object.defineProperty(exports, 'include', {
179
- enumerable: true,
180
- get: function () {
181
- return include;
182
- }
183
- });
184
- Object.defineProperty(exports, 'isNullish', {
185
- enumerable: true,
186
- get: function () {
187
- return isNullish;
188
- }
189
- });
190
- Object.defineProperty(exports, 'isPromiseLike', {
191
- enumerable: true,
192
- get: function () {
193
- return isPromiseLike;
194
- }
195
- });
196
- Object.defineProperty(exports, 'moduleType', {
197
- enumerable: true,
198
- get: function () {
199
- return moduleType;
200
- }
201
- });
202
- Object.defineProperty(exports, 'noop', {
203
- enumerable: true,
204
- get: function () {
205
- return noop;
206
- }
207
- });
208
- Object.defineProperty(exports, 'not', {
209
- enumerable: true,
210
- get: function () {
211
- return not;
212
- }
213
- });
214
- Object.defineProperty(exports, 'or', {
215
- enumerable: true,
216
- get: function () {
217
- return or;
218
- }
219
- });
220
- Object.defineProperty(exports, 'queries', {
221
- enumerable: true,
222
- get: function () {
223
- return queries;
224
- }
225
- });
226
- Object.defineProperty(exports, 'query', {
227
- enumerable: true,
228
- get: function () {
229
- return query;
230
- }
231
- });
232
- Object.defineProperty(exports, 'unimplemented', {
233
- enumerable: true,
234
- get: function () {
235
- return unimplemented;
236
- }
237
- });
238
- Object.defineProperty(exports, 'unreachable', {
239
- enumerable: true,
240
- get: function () {
241
- return unreachable;
242
- }
243
- });
244
- Object.defineProperty(exports, 'unsupported', {
245
- enumerable: true,
246
- get: function () {
247
- return unsupported;
248
- }
249
- });
@@ -1,153 +0,0 @@
1
- import { __esm } from "./chunk-DSsiIF1Z.mjs";
2
-
3
- //#region src/utils/misc.ts
4
- function arraify(value) {
5
- return Array.isArray(value) ? value : [value];
6
- }
7
- function isNullish(value) {
8
- return value === null || value === void 0;
9
- }
10
- function isPromiseLike(value) {
11
- return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
12
- }
13
- function unimplemented(info) {
14
- if (info) throw new Error(`unimplemented: ${info}`);
15
- throw new Error("unimplemented");
16
- }
17
- function unreachable(info) {
18
- if (info) throw new Error(`unreachable: ${info}`);
19
- throw new Error("unreachable");
20
- }
21
- function unsupported(info) {
22
- throw new Error(`UNSUPPORTED: ${info}`);
23
- }
24
- function noop(..._args) {}
25
- var init_misc = __esm({ "src/utils/misc.ts"() {} });
26
-
27
- //#endregion
28
- //#region ../pluginutils/dist/index.js
29
- function and(...args) {
30
- return new And(...args);
31
- }
32
- function or(...args) {
33
- return new Or(...args);
34
- }
35
- function not(expr) {
36
- return new Not(expr);
37
- }
38
- function id(pattern, params) {
39
- return new Id(pattern, params);
40
- }
41
- function moduleType(pattern) {
42
- return new ModuleType(pattern);
43
- }
44
- function code(pattern) {
45
- return new Code(pattern);
46
- }
47
- function query(key, pattern) {
48
- return new Query(key, pattern);
49
- }
50
- function include(expr) {
51
- return new Include(expr);
52
- }
53
- function exclude(expr) {
54
- return new Exclude(expr);
55
- }
56
- /**
57
- * convert a queryObject to FilterExpression like
58
- * ```js
59
- * and(query(k1, v1), query(k2, v2))
60
- * ```
61
- * @param queryFilterObject The query filter object needs to be matched.
62
- * @returns a `And` FilterExpression
63
- */
64
- function queries(queryFilter) {
65
- let arr = Object.entries(queryFilter).map(([key, value]) => {
66
- return new Query(key, value);
67
- });
68
- return and(...arr);
69
- }
70
- var And, Or, Not, Id, ModuleType, Code, Query, Include, Exclude;
71
- var init_dist = __esm({ "../pluginutils/dist/index.js"() {
72
- And = class {
73
- kind;
74
- args;
75
- constructor(...args) {
76
- if (args.length === 0) throw new Error("`And` expects at least one operand");
77
- this.args = args;
78
- this.kind = "and";
79
- }
80
- };
81
- Or = class {
82
- kind;
83
- args;
84
- constructor(...args) {
85
- if (args.length === 0) throw new Error("`Or` expects at least one operand");
86
- this.args = args;
87
- this.kind = "or";
88
- }
89
- };
90
- Not = class {
91
- kind;
92
- expr;
93
- constructor(expr) {
94
- this.expr = expr;
95
- this.kind = "not";
96
- }
97
- };
98
- Id = class {
99
- kind;
100
- pattern;
101
- params;
102
- constructor(pattern, params) {
103
- this.pattern = pattern;
104
- this.kind = "id";
105
- this.params = params ?? { cleanUrl: false };
106
- }
107
- };
108
- ModuleType = class {
109
- kind;
110
- pattern;
111
- constructor(pattern) {
112
- this.pattern = pattern;
113
- this.kind = "moduleType";
114
- }
115
- };
116
- Code = class {
117
- kind;
118
- pattern;
119
- constructor(expr) {
120
- this.pattern = expr;
121
- this.kind = "code";
122
- }
123
- };
124
- Query = class {
125
- kind;
126
- key;
127
- pattern;
128
- constructor(key, pattern) {
129
- this.pattern = pattern;
130
- this.key = key;
131
- this.kind = "query";
132
- }
133
- };
134
- Include = class {
135
- kind;
136
- expr;
137
- constructor(expr) {
138
- this.expr = expr;
139
- this.kind = "include";
140
- }
141
- };
142
- Exclude = class {
143
- kind;
144
- expr;
145
- constructor(expr) {
146
- this.expr = expr;
147
- this.kind = "exclude";
148
- }
149
- };
150
- } });
151
-
152
- //#endregion
153
- export { and as and$1, arraify, code as code$1, exclude as exclude$1, id as id$1, include as include$1, init_dist, init_misc, isNullish, isPromiseLike, moduleType as moduleType$1, noop, not as not$1, or as or$1, queries as queries$1, query as query$1, unimplemented, unreachable, unsupported };
@@ -1,125 +0,0 @@
1
- const require_chunk = require('./chunk-DDkG_k5U.cjs');
2
- const require_src = require('./src-s89s870G.cjs');
3
- const node_path = require_chunk.__toESM(require("node:path"));
4
- const node_url = require_chunk.__toESM(require("node:url"));
5
- const node_process = require_chunk.__toESM(require("node:process"));
6
- const node_fs = require_chunk.__toESM(require("node:fs"));
7
- const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
8
-
9
- //#region src/utils/load-config.ts
10
- async function bundleTsConfig(configFile, isEsm) {
11
- const dirnameVarName = "injected_original_dirname";
12
- const filenameVarName = "injected_original_filename";
13
- const importMetaUrlVarName = "injected_original_import_meta_url";
14
- const bundle = await require_src.rolldown({
15
- input: configFile,
16
- platform: "node",
17
- resolve: { mainFields: ["main"] },
18
- define: {
19
- __dirname: dirnameVarName,
20
- __filename: filenameVarName,
21
- "import.meta.url": importMetaUrlVarName,
22
- "import.meta.dirname": dirnameVarName,
23
- "import.meta.filename": filenameVarName
24
- },
25
- treeshake: false,
26
- external: [/^[\w@][^:]/],
27
- plugins: [{
28
- name: "inject-file-scope-variables",
29
- transform: {
30
- filter: { id: /\.[cm]?[jt]s$/ },
31
- async handler(code, id) {
32
- const injectValues = `const ${dirnameVarName} = ${JSON.stringify(node_path.default.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify((0, node_url.pathToFileURL)(id).href)};`;
33
- return {
34
- code: injectValues + code,
35
- map: null
36
- };
37
- }
38
- }
39
- }]
40
- });
41
- const outputDir = node_path.default.dirname(configFile);
42
- const result = await bundle.write({
43
- dir: outputDir,
44
- format: isEsm ? "esm" : "cjs",
45
- sourcemap: "inline",
46
- entryFileNames: `rolldown.config.[hash]${node_path.default.extname(configFile).replace("ts", "js")}`
47
- });
48
- const fileName = result.output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
49
- return node_path.default.join(outputDir, fileName);
50
- }
51
- const SUPPORTED_JS_CONFIG_FORMATS = [
52
- ".js",
53
- ".mjs",
54
- ".cjs"
55
- ];
56
- const SUPPORTED_TS_CONFIG_FORMATS = [
57
- ".ts",
58
- ".mts",
59
- ".cts"
60
- ];
61
- const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
62
- const DEFAULT_CONFIG_BASE = "rolldown.config";
63
- async function findConfigFileNameInCwd() {
64
- const filesInWorkingDirectory = new Set(await (0, node_fs_promises.readdir)((0, node_process.cwd)()));
65
- for (const extension of SUPPORTED_CONFIG_FORMATS) {
66
- const fileName = `${DEFAULT_CONFIG_BASE}${extension}`;
67
- if (filesInWorkingDirectory.has(fileName)) return fileName;
68
- }
69
- throw new Error("No `rolldown.config` configuration file found.");
70
- }
71
- async function loadTsConfig(configFile) {
72
- const isEsm = isFilePathESM(configFile);
73
- const file = await bundleTsConfig(configFile, isEsm);
74
- try {
75
- return (await import((0, node_url.pathToFileURL)(file).href)).default;
76
- } finally {
77
- node_fs.default.unlink(file, () => {});
78
- }
79
- }
80
- function isFilePathESM(filePath) {
81
- if (/\.m[jt]s$/.test(filePath)) return true;
82
- else if (/\.c[jt]s$/.test(filePath)) return false;
83
- else {
84
- const pkg = findNearestPackageData(node_path.default.dirname(filePath));
85
- if (pkg) return pkg.type === "module";
86
- return false;
87
- }
88
- }
89
- function findNearestPackageData(basedir) {
90
- while (basedir) {
91
- const pkgPath = node_path.default.join(basedir, "package.json");
92
- if (tryStatSync(pkgPath)?.isFile()) try {
93
- return JSON.parse(node_fs.default.readFileSync(pkgPath, "utf-8"));
94
- } catch {}
95
- const nextBasedir = node_path.default.dirname(basedir);
96
- if (nextBasedir === basedir) break;
97
- basedir = nextBasedir;
98
- }
99
- return null;
100
- }
101
- function tryStatSync(file) {
102
- try {
103
- return node_fs.default.statSync(file, { throwIfNoEntry: false });
104
- } catch {}
105
- }
106
- async function loadConfig(configPath) {
107
- const ext = node_path.default.extname(configPath = configPath || await findConfigFileNameInCwd());
108
- try {
109
- if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import((0, node_url.pathToFileURL)(configPath).href)).default;
110
- else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) {
111
- const rawConfigPath = node_path.default.resolve(configPath);
112
- return await loadTsConfig(rawConfigPath);
113
- } else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
114
- } catch (err) {
115
- throw new Error("Error happened while loading config.", { cause: err });
116
- }
117
- }
118
-
119
- //#endregion
120
- Object.defineProperty(exports, 'loadConfig', {
121
- enumerable: true,
122
- get: function () {
123
- return loadConfig;
124
- }
125
- });