@rolldown/browser 1.0.0-beta.16 → 1.0.0-beta.18
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.cjs +6 -6
- package/dist/cli.mjs +1042 -1083
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +4 -6
- package/dist/experimental-index.browser.mjs +3 -3
- package/dist/experimental-index.cjs +3 -3
- package/dist/experimental-index.d.cts +2 -2
- package/dist/experimental-index.d.mts +2 -2
- package/dist/experimental-index.mjs +5 -17
- package/dist/filter-index.d.cts +2 -2
- package/dist/filter-index.d.mts +2 -2
- package/dist/filter-index.mjs +1 -6
- package/dist/index.browser.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -4
- package/dist/parallel-plugin-worker.cjs +2 -2
- package/dist/parallel-plugin-worker.mjs +27 -33
- package/dist/parallel-plugin.d.cts +2 -2
- package/dist/parallel-plugin.d.mts +2 -2
- package/dist/parse-ast-index.cjs +1 -1
- package/dist/parse-ast-index.d.cts +1 -1
- package/dist/parse-ast-index.d.mts +1 -1
- package/dist/parse-ast-index.mjs +1 -2
- package/dist/rolldown-binding.wasi-browser.js +3 -2
- package/dist/rolldown-binding.wasi.cjs +2 -1
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/shared/{binding--Y47JZSL.d.cts → binding-D__94uwg.d.cts} +13 -462
- package/dist/shared/{binding-C_9au5Eg.d.mts → binding-DwMf_OTa.d.mts} +13 -462
- package/dist/shared/{define-config-CFPAmfEQ.d.mts → define-config-CXjwrGWr.d.cts} +69 -9
- package/dist/shared/{define-config-CAyC9-af.d.cts → define-config-DaQ-joKc.d.mts} +69 -9
- package/dist/shared/dist-BoWaIc-K.mjs +147 -0
- package/dist/shared/{load-config-CHic6lPj.mjs → load-config-BwSSRqdO.mjs} +14 -19
- package/dist/shared/{load-config-CKPqlbjH.cjs → load-config-CbF4BrKX.cjs} +1 -1
- package/dist/shared/{parse-ast-index-BjSB6ZTb.mjs → parse-ast-index-BHw-MFh6.mjs} +10 -28
- package/dist/shared/{parse-ast-index-X4pECV1E.cjs → parse-ast-index-DQhRVBEm.cjs} +1 -1
- package/dist/shared/prompt-C5jz26Zn.mjs +852 -0
- package/dist/shared/{src-Cw7MpyXh.cjs → src-BP3CtG4Q.cjs} +21 -18
- package/dist/shared/{src-C_ps7iS5.mjs → src-D1ozKBtx.mjs} +1144 -1367
- package/dist/{src-UXJBOke0.js → src-CEdhd_Z1.js} +21 -18
- package/package.json +3 -2
- package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
- package/dist/shared/dist-DeDsdiza.mjs +0 -153
- package/dist/shared/prompt-C14hEutp.mjs +0 -854
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingDynamicImportVarsPluginConfig, BindingHmrOutputPatch, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWatcherEvent,
|
|
1
|
+
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingDynamicImportVarsPluginConfig, BindingHmrOutputPatch, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWatcherEvent, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-D__94uwg.cjs";
|
|
2
2
|
import { Program } from "@oxc-project/types";
|
|
3
3
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
4
4
|
|
|
@@ -170,7 +170,7 @@ interface OutputOptions {
|
|
|
170
170
|
externalLiveBindings?: boolean;
|
|
171
171
|
inlineDynamicImports?: boolean;
|
|
172
172
|
/**
|
|
173
|
-
* Allows you to do
|
|
173
|
+
* Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/guide/in-depth/advanced-chunks).
|
|
174
174
|
*/
|
|
175
175
|
advancedChunks?: {
|
|
176
176
|
/**
|
|
@@ -211,6 +211,24 @@ interface OutputOptions {
|
|
|
211
211
|
* - Type: `string`
|
|
212
212
|
*
|
|
213
213
|
* Name of the group. It will be also used as the name of the chunk and replaced the `[name]` placeholder in the `chunkFileNames` option.
|
|
214
|
+
*
|
|
215
|
+
* For example,
|
|
216
|
+
*
|
|
217
|
+
* ```js
|
|
218
|
+
* import { defineConfig } from 'rolldown';
|
|
219
|
+
*
|
|
220
|
+
* export default defineConfig({
|
|
221
|
+
* advancedChunks: {
|
|
222
|
+
* groups: [
|
|
223
|
+
* {
|
|
224
|
+
* name: 'libs',
|
|
225
|
+
* test: /node_modules/,
|
|
226
|
+
* },
|
|
227
|
+
* ],
|
|
228
|
+
* },
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
231
|
+
* will create a chunk named `libs-[hash].js` in the end.
|
|
214
232
|
*/
|
|
215
233
|
name: string;
|
|
216
234
|
/**
|
|
@@ -218,25 +236,50 @@ interface OutputOptions {
|
|
|
218
236
|
*
|
|
219
237
|
* Controls which modules are captured in this group.
|
|
220
238
|
*
|
|
221
|
-
* If `test` is a string, the module whose id contains the string will be captured.
|
|
222
|
-
* If `test` is a regular expression, the module whose id matches the regular expression will be captured.
|
|
223
|
-
* If `test` is a function, modules for which `test(id)` returns `true` will be captured.
|
|
224
|
-
*
|
|
239
|
+
* - If `test` is a string, the module whose id contains the string will be captured.
|
|
240
|
+
* - If `test` is a regular expression, the module whose id matches the regular expression will be captured.
|
|
241
|
+
* - If `test` is a function, modules for which `test(id)` returns `true` will be captured.
|
|
242
|
+
* - If `test` is empty, any module will be considered as matched.
|
|
225
243
|
*/
|
|
226
244
|
test?: StringOrRegExp | ((id: string) => boolean | undefined | void);
|
|
227
245
|
/**
|
|
228
246
|
* - Type: `number`
|
|
247
|
+
* - Default: `0`
|
|
229
248
|
*
|
|
230
249
|
* Priority of the group. Group with higher priority will be chosen first to match modules and create chunks. When converting the group to a chunk, modules of that group will be removed from other groups.
|
|
231
250
|
*
|
|
232
251
|
* If two groups have the same priority, the group whose index is smaller will be chosen.
|
|
252
|
+
*
|
|
253
|
+
* For example,
|
|
254
|
+
*
|
|
255
|
+
* ```js
|
|
256
|
+
* import { defineConfig } from 'rolldown';
|
|
257
|
+
*
|
|
258
|
+
* export default defineConfig({
|
|
259
|
+
* advancedChunks: {
|
|
260
|
+
* groups: [
|
|
261
|
+
* {
|
|
262
|
+
* name: 'react',
|
|
263
|
+
* test: /node_modules\/react/,
|
|
264
|
+
* priority: 1,
|
|
265
|
+
* },
|
|
266
|
+
* {
|
|
267
|
+
* name: 'other-libs',
|
|
268
|
+
* test: /node_modules/,
|
|
269
|
+
* priority: 2,
|
|
270
|
+
* },
|
|
271
|
+
* ],
|
|
272
|
+
* });
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* This is a clearly __incorrect__ example. Though `react` group is defined before `other-libs`, it has a lower priority, so the modules in `react` group will be captured in `other-libs` group.
|
|
233
276
|
*/
|
|
234
277
|
priority?: number;
|
|
235
278
|
/**
|
|
236
279
|
* - Type: `number`
|
|
237
280
|
* - Default: `0`
|
|
238
281
|
*
|
|
239
|
-
* Minimum size of the desired chunk. If accumulated size of captured modules is smaller than this value, this group will
|
|
282
|
+
* Minimum size of the desired chunk. If the accumulated size of the captured modules by this group is smaller than this value, it will be ignored. Modules in this group will fall back to the `automatic chunking` if they are not captured by any other group.
|
|
240
283
|
*/
|
|
241
284
|
minSize?: number;
|
|
242
285
|
/**
|
|
@@ -250,7 +293,7 @@ interface OutputOptions {
|
|
|
250
293
|
* - Type: `number`
|
|
251
294
|
* - Default: `Infinity`
|
|
252
295
|
*
|
|
253
|
-
* If
|
|
296
|
+
* If the accumulated size of the captured modules by this group is larger than this value, this group will be split into multiple groups that each has size close to this value.
|
|
254
297
|
*/
|
|
255
298
|
maxSize?: number;
|
|
256
299
|
/**
|
|
@@ -330,7 +373,7 @@ interface WatchOptions extends InputOptions {
|
|
|
330
373
|
type WatcherEvent = "close" | "event" | "restart" | "change";
|
|
331
374
|
type ChangeEvent$1 = "create" | "update" | "delete";
|
|
332
375
|
// TODO: find a way use `RolldownBuild` instead of `Bundler`.
|
|
333
|
-
type RolldownWatchBuild =
|
|
376
|
+
type RolldownWatchBuild = BindingBundlerImpl;
|
|
334
377
|
type RolldownWatcherEvent = {
|
|
335
378
|
code: "START";
|
|
336
379
|
} | {
|
|
@@ -1020,6 +1063,23 @@ interface InputOptions {
|
|
|
1020
1063
|
* @default runtime = "automatic"
|
|
1021
1064
|
*/
|
|
1022
1065
|
jsx?: false | "react" | "react-jsx" | "preserve" | RollupJsxOptions;
|
|
1066
|
+
/**
|
|
1067
|
+
* Configure how the code is transformed. This process happens after the `transform` hook.
|
|
1068
|
+
*
|
|
1069
|
+
* To transpile [legacy decorators](https://github.com/tc39/proposal-decorators/tree/4ac0f4cd31bd0f2e8170cb4c5136e51671e46c8d), you could use
|
|
1070
|
+
*
|
|
1071
|
+
* ```js
|
|
1072
|
+
* export default defineConfig({
|
|
1073
|
+
* transform: {
|
|
1074
|
+
* decorator: {
|
|
1075
|
+
* legacy: true,
|
|
1076
|
+
* },
|
|
1077
|
+
* },
|
|
1078
|
+
* })
|
|
1079
|
+
* ```
|
|
1080
|
+
*
|
|
1081
|
+
* For latest decorators proposal, rolldown is able to bundle them but doesn't support transpiling them yet.
|
|
1082
|
+
*/
|
|
1023
1083
|
transform?: OxcTransformOption;
|
|
1024
1084
|
watch?: WatcherOptions | false;
|
|
1025
1085
|
dropLabels?: string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingDynamicImportVarsPluginConfig, BindingHmrOutputPatch, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWatcherEvent,
|
|
1
|
+
import { BindingAssetPluginConfig, BindingBuildImportAnalysisPluginConfig, BindingBuiltinPluginName, BindingBundlerImpl, BindingDynamicImportVarsPluginConfig, BindingHmrOutputPatch, BindingHookResolveIdExtraArgs, BindingImportGlobPluginConfig, BindingIsolatedDeclarationPluginConfig, BindingJsonPluginConfig, BindingManifestPluginConfig, BindingMfManifest, BindingMinifyOptions, BindingModuleFederationPluginOption, BindingModulePreloadPolyfillPluginConfig, BindingRemote, BindingRenderedChunk, BindingReporterPluginConfig, BindingTransformHookExtraArgs, BindingViteResolvePluginConfig, BindingWatcherEvent, ParserOptions, PreRenderedChunk, TransformOptions } from "./binding-DwMf_OTa.mjs";
|
|
2
2
|
import { Program } from "@oxc-project/types";
|
|
3
3
|
import { TopLevelFilterExpression } from "@rolldown/pluginutils";
|
|
4
4
|
|
|
@@ -170,7 +170,7 @@ interface OutputOptions {
|
|
|
170
170
|
externalLiveBindings?: boolean;
|
|
171
171
|
inlineDynamicImports?: boolean;
|
|
172
172
|
/**
|
|
173
|
-
* Allows you to do
|
|
173
|
+
* Allows you to do manual chunking. For deeper understanding, please refer to the in-depth [documentation](https://rolldown.rs/guide/in-depth/advanced-chunks).
|
|
174
174
|
*/
|
|
175
175
|
advancedChunks?: {
|
|
176
176
|
/**
|
|
@@ -211,6 +211,24 @@ interface OutputOptions {
|
|
|
211
211
|
* - Type: `string`
|
|
212
212
|
*
|
|
213
213
|
* Name of the group. It will be also used as the name of the chunk and replaced the `[name]` placeholder in the `chunkFileNames` option.
|
|
214
|
+
*
|
|
215
|
+
* For example,
|
|
216
|
+
*
|
|
217
|
+
* ```js
|
|
218
|
+
* import { defineConfig } from 'rolldown';
|
|
219
|
+
*
|
|
220
|
+
* export default defineConfig({
|
|
221
|
+
* advancedChunks: {
|
|
222
|
+
* groups: [
|
|
223
|
+
* {
|
|
224
|
+
* name: 'libs',
|
|
225
|
+
* test: /node_modules/,
|
|
226
|
+
* },
|
|
227
|
+
* ],
|
|
228
|
+
* },
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
231
|
+
* will create a chunk named `libs-[hash].js` in the end.
|
|
214
232
|
*/
|
|
215
233
|
name: string;
|
|
216
234
|
/**
|
|
@@ -218,25 +236,50 @@ interface OutputOptions {
|
|
|
218
236
|
*
|
|
219
237
|
* Controls which modules are captured in this group.
|
|
220
238
|
*
|
|
221
|
-
* If `test` is a string, the module whose id contains the string will be captured.
|
|
222
|
-
* If `test` is a regular expression, the module whose id matches the regular expression will be captured.
|
|
223
|
-
* If `test` is a function, modules for which `test(id)` returns `true` will be captured.
|
|
224
|
-
*
|
|
239
|
+
* - If `test` is a string, the module whose id contains the string will be captured.
|
|
240
|
+
* - If `test` is a regular expression, the module whose id matches the regular expression will be captured.
|
|
241
|
+
* - If `test` is a function, modules for which `test(id)` returns `true` will be captured.
|
|
242
|
+
* - If `test` is empty, any module will be considered as matched.
|
|
225
243
|
*/
|
|
226
244
|
test?: StringOrRegExp | ((id: string) => boolean | undefined | void);
|
|
227
245
|
/**
|
|
228
246
|
* - Type: `number`
|
|
247
|
+
* - Default: `0`
|
|
229
248
|
*
|
|
230
249
|
* Priority of the group. Group with higher priority will be chosen first to match modules and create chunks. When converting the group to a chunk, modules of that group will be removed from other groups.
|
|
231
250
|
*
|
|
232
251
|
* If two groups have the same priority, the group whose index is smaller will be chosen.
|
|
252
|
+
*
|
|
253
|
+
* For example,
|
|
254
|
+
*
|
|
255
|
+
* ```js
|
|
256
|
+
* import { defineConfig } from 'rolldown';
|
|
257
|
+
*
|
|
258
|
+
* export default defineConfig({
|
|
259
|
+
* advancedChunks: {
|
|
260
|
+
* groups: [
|
|
261
|
+
* {
|
|
262
|
+
* name: 'react',
|
|
263
|
+
* test: /node_modules\/react/,
|
|
264
|
+
* priority: 1,
|
|
265
|
+
* },
|
|
266
|
+
* {
|
|
267
|
+
* name: 'other-libs',
|
|
268
|
+
* test: /node_modules/,
|
|
269
|
+
* priority: 2,
|
|
270
|
+
* },
|
|
271
|
+
* ],
|
|
272
|
+
* });
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* This is a clearly __incorrect__ example. Though `react` group is defined before `other-libs`, it has a lower priority, so the modules in `react` group will be captured in `other-libs` group.
|
|
233
276
|
*/
|
|
234
277
|
priority?: number;
|
|
235
278
|
/**
|
|
236
279
|
* - Type: `number`
|
|
237
280
|
* - Default: `0`
|
|
238
281
|
*
|
|
239
|
-
* Minimum size of the desired chunk. If accumulated size of captured modules is smaller than this value, this group will
|
|
282
|
+
* Minimum size of the desired chunk. If the accumulated size of the captured modules by this group is smaller than this value, it will be ignored. Modules in this group will fall back to the `automatic chunking` if they are not captured by any other group.
|
|
240
283
|
*/
|
|
241
284
|
minSize?: number;
|
|
242
285
|
/**
|
|
@@ -250,7 +293,7 @@ interface OutputOptions {
|
|
|
250
293
|
* - Type: `number`
|
|
251
294
|
* - Default: `Infinity`
|
|
252
295
|
*
|
|
253
|
-
* If
|
|
296
|
+
* If the accumulated size of the captured modules by this group is larger than this value, this group will be split into multiple groups that each has size close to this value.
|
|
254
297
|
*/
|
|
255
298
|
maxSize?: number;
|
|
256
299
|
/**
|
|
@@ -330,7 +373,7 @@ interface WatchOptions extends InputOptions {
|
|
|
330
373
|
type WatcherEvent = "close" | "event" | "restart" | "change";
|
|
331
374
|
type ChangeEvent$1 = "create" | "update" | "delete";
|
|
332
375
|
// TODO: find a way use `RolldownBuild` instead of `Bundler`.
|
|
333
|
-
type RolldownWatchBuild =
|
|
376
|
+
type RolldownWatchBuild = BindingBundlerImpl;
|
|
334
377
|
type RolldownWatcherEvent = {
|
|
335
378
|
code: "START";
|
|
336
379
|
} | {
|
|
@@ -1020,6 +1063,23 @@ interface InputOptions {
|
|
|
1020
1063
|
* @default runtime = "automatic"
|
|
1021
1064
|
*/
|
|
1022
1065
|
jsx?: false | "react" | "react-jsx" | "preserve" | RollupJsxOptions;
|
|
1066
|
+
/**
|
|
1067
|
+
* Configure how the code is transformed. This process happens after the `transform` hook.
|
|
1068
|
+
*
|
|
1069
|
+
* To transpile [legacy decorators](https://github.com/tc39/proposal-decorators/tree/4ac0f4cd31bd0f2e8170cb4c5136e51671e46c8d), you could use
|
|
1070
|
+
*
|
|
1071
|
+
* ```js
|
|
1072
|
+
* export default defineConfig({
|
|
1073
|
+
* transform: {
|
|
1074
|
+
* decorator: {
|
|
1075
|
+
* legacy: true,
|
|
1076
|
+
* },
|
|
1077
|
+
* },
|
|
1078
|
+
* })
|
|
1079
|
+
* ```
|
|
1080
|
+
*
|
|
1081
|
+
* For latest decorators proposal, rolldown is able to bundle them but doesn't support transpiling them yet.
|
|
1082
|
+
*/
|
|
1023
1083
|
transform?: OxcTransformOption;
|
|
1024
1084
|
watch?: WatcherOptions | false;
|
|
1025
1085
|
dropLabels?: string[];
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
//#region src/utils/misc.ts
|
|
2
|
+
function arraify(value) {
|
|
3
|
+
return Array.isArray(value) ? value : [value];
|
|
4
|
+
}
|
|
5
|
+
function isNullish(value) {
|
|
6
|
+
return value === null || value === void 0;
|
|
7
|
+
}
|
|
8
|
+
function isPromiseLike(value) {
|
|
9
|
+
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
10
|
+
}
|
|
11
|
+
function unimplemented(info) {
|
|
12
|
+
if (info) throw new Error(`unimplemented: ${info}`);
|
|
13
|
+
throw new Error("unimplemented");
|
|
14
|
+
}
|
|
15
|
+
function unreachable(info) {
|
|
16
|
+
if (info) throw new Error(`unreachable: ${info}`);
|
|
17
|
+
throw new Error("unreachable");
|
|
18
|
+
}
|
|
19
|
+
function unsupported(info) {
|
|
20
|
+
throw new Error(`UNSUPPORTED: ${info}`);
|
|
21
|
+
}
|
|
22
|
+
function noop(..._args) {}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../pluginutils/dist/index.js
|
|
26
|
+
var And = class {
|
|
27
|
+
kind;
|
|
28
|
+
args;
|
|
29
|
+
constructor(...args) {
|
|
30
|
+
if (args.length === 0) throw new Error("`And` expects at least one operand");
|
|
31
|
+
this.args = args;
|
|
32
|
+
this.kind = "and";
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var Or = class {
|
|
36
|
+
kind;
|
|
37
|
+
args;
|
|
38
|
+
constructor(...args) {
|
|
39
|
+
if (args.length === 0) throw new Error("`Or` expects at least one operand");
|
|
40
|
+
this.args = args;
|
|
41
|
+
this.kind = "or";
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var Not = class {
|
|
45
|
+
kind;
|
|
46
|
+
expr;
|
|
47
|
+
constructor(expr) {
|
|
48
|
+
this.expr = expr;
|
|
49
|
+
this.kind = "not";
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var Id = class {
|
|
53
|
+
kind;
|
|
54
|
+
pattern;
|
|
55
|
+
params;
|
|
56
|
+
constructor(pattern, params) {
|
|
57
|
+
this.pattern = pattern;
|
|
58
|
+
this.kind = "id";
|
|
59
|
+
this.params = params ?? { cleanUrl: false };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var ModuleType = class {
|
|
63
|
+
kind;
|
|
64
|
+
pattern;
|
|
65
|
+
constructor(pattern) {
|
|
66
|
+
this.pattern = pattern;
|
|
67
|
+
this.kind = "moduleType";
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var Code = class {
|
|
71
|
+
kind;
|
|
72
|
+
pattern;
|
|
73
|
+
constructor(expr) {
|
|
74
|
+
this.pattern = expr;
|
|
75
|
+
this.kind = "code";
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var Query = class {
|
|
79
|
+
kind;
|
|
80
|
+
key;
|
|
81
|
+
pattern;
|
|
82
|
+
constructor(key, pattern) {
|
|
83
|
+
this.pattern = pattern;
|
|
84
|
+
this.key = key;
|
|
85
|
+
this.kind = "query";
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var Include = class {
|
|
89
|
+
kind;
|
|
90
|
+
expr;
|
|
91
|
+
constructor(expr) {
|
|
92
|
+
this.expr = expr;
|
|
93
|
+
this.kind = "include";
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var Exclude = class {
|
|
97
|
+
kind;
|
|
98
|
+
expr;
|
|
99
|
+
constructor(expr) {
|
|
100
|
+
this.expr = expr;
|
|
101
|
+
this.kind = "exclude";
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function and(...args) {
|
|
105
|
+
return new And(...args);
|
|
106
|
+
}
|
|
107
|
+
function or(...args) {
|
|
108
|
+
return new Or(...args);
|
|
109
|
+
}
|
|
110
|
+
function not(expr) {
|
|
111
|
+
return new Not(expr);
|
|
112
|
+
}
|
|
113
|
+
function id(pattern, params) {
|
|
114
|
+
return new Id(pattern, params);
|
|
115
|
+
}
|
|
116
|
+
function moduleType(pattern) {
|
|
117
|
+
return new ModuleType(pattern);
|
|
118
|
+
}
|
|
119
|
+
function code(pattern) {
|
|
120
|
+
return new Code(pattern);
|
|
121
|
+
}
|
|
122
|
+
function query(key, pattern) {
|
|
123
|
+
return new Query(key, pattern);
|
|
124
|
+
}
|
|
125
|
+
function include(expr) {
|
|
126
|
+
return new Include(expr);
|
|
127
|
+
}
|
|
128
|
+
function exclude(expr) {
|
|
129
|
+
return new Exclude(expr);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* convert a queryObject to FilterExpression like
|
|
133
|
+
* ```js
|
|
134
|
+
* and(query(k1, v1), query(k2, v2))
|
|
135
|
+
* ```
|
|
136
|
+
* @param queryFilterObject The query filter object needs to be matched.
|
|
137
|
+
* @returns a `And` FilterExpression
|
|
138
|
+
*/
|
|
139
|
+
function queries(queryFilter) {
|
|
140
|
+
let arr = Object.entries(queryFilter).map(([key, value]) => {
|
|
141
|
+
return new Query(key, value);
|
|
142
|
+
});
|
|
143
|
+
return and(...arr);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
//#endregion
|
|
147
|
+
export { and, arraify, code, exclude, id, include, isNullish, isPromiseLike, moduleType, noop, not, or, queries, query, unimplemented, unreachable, unsupported };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { init_rolldown, rolldown } from "./src-C_ps7iS5.mjs";
|
|
1
|
+
import { rolldown } from "./src-D1ozKBtx.mjs";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { pathToFileURL } from "node:url";
|
|
5
4
|
import { cwd } from "node:process";
|
|
@@ -48,6 +47,18 @@ async function bundleTsConfig(configFile, isEsm) {
|
|
|
48
47
|
const fileName = result.output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
|
|
49
48
|
return path.join(outputDir, fileName);
|
|
50
49
|
}
|
|
50
|
+
const SUPPORTED_JS_CONFIG_FORMATS = [
|
|
51
|
+
".js",
|
|
52
|
+
".mjs",
|
|
53
|
+
".cjs"
|
|
54
|
+
];
|
|
55
|
+
const SUPPORTED_TS_CONFIG_FORMATS = [
|
|
56
|
+
".ts",
|
|
57
|
+
".mts",
|
|
58
|
+
".cts"
|
|
59
|
+
];
|
|
60
|
+
const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
|
|
61
|
+
const DEFAULT_CONFIG_BASE = "rolldown.config";
|
|
51
62
|
async function findConfigFileNameInCwd() {
|
|
52
63
|
const filesInWorkingDirectory = new Set(await readdir(cwd()));
|
|
53
64
|
for (const extension of SUPPORTED_CONFIG_FORMATS) {
|
|
@@ -103,22 +114,6 @@ async function loadConfig(configPath) {
|
|
|
103
114
|
throw new Error("Error happened while loading config.", { cause: err });
|
|
104
115
|
}
|
|
105
116
|
}
|
|
106
|
-
var SUPPORTED_JS_CONFIG_FORMATS, SUPPORTED_TS_CONFIG_FORMATS, SUPPORTED_CONFIG_FORMATS, DEFAULT_CONFIG_BASE;
|
|
107
|
-
var init_load_config = __esm({ "src/utils/load-config.ts"() {
|
|
108
|
-
init_rolldown();
|
|
109
|
-
SUPPORTED_JS_CONFIG_FORMATS = [
|
|
110
|
-
".js",
|
|
111
|
-
".mjs",
|
|
112
|
-
".cjs"
|
|
113
|
-
];
|
|
114
|
-
SUPPORTED_TS_CONFIG_FORMATS = [
|
|
115
|
-
".ts",
|
|
116
|
-
".mts",
|
|
117
|
-
".cts"
|
|
118
|
-
];
|
|
119
|
-
SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
|
|
120
|
-
DEFAULT_CONFIG_BASE = "rolldown.config";
|
|
121
|
-
} });
|
|
122
117
|
|
|
123
118
|
//#endregion
|
|
124
|
-
export {
|
|
119
|
+
export { loadConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-DDkG_k5U.cjs');
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-BP3CtG4Q.cjs');
|
|
3
3
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
4
4
|
const node_url = require_chunk.__toESM(require("node:url"));
|
|
5
5
|
const node_process = require_chunk.__toESM(require("node:process"));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __esm } from "./chunk-DSsiIF1Z.mjs";
|
|
2
1
|
import { parseAsync, parseSync } from "../rolldown-binding.wasi.cjs";
|
|
3
2
|
|
|
4
3
|
//#region src/utils/code-frame.ts
|
|
@@ -10,6 +9,9 @@ function spaces(index) {
|
|
|
10
9
|
function tabsToSpaces(value) {
|
|
11
10
|
return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
|
|
12
11
|
}
|
|
12
|
+
const LINE_TRUNCATE_LENGTH = 120;
|
|
13
|
+
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
|
|
14
|
+
const ELLIPSIS = "...";
|
|
13
15
|
function getCodeFrame(source, line, column) {
|
|
14
16
|
let lines = source.split("\n");
|
|
15
17
|
if (line > lines.length) return "";
|
|
@@ -35,12 +37,6 @@ function getCodeFrame(source, line, column) {
|
|
|
35
37
|
return `${lineNumber}: ${displayedLine}`;
|
|
36
38
|
}).join("\n");
|
|
37
39
|
}
|
|
38
|
-
var LINE_TRUNCATE_LENGTH, MIN_CHARACTERS_SHOWN_AFTER_LOCATION, ELLIPSIS;
|
|
39
|
-
var init_code_frame = __esm({ "src/utils/code-frame.ts"() {
|
|
40
|
-
LINE_TRUNCATE_LENGTH = 120;
|
|
41
|
-
MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
|
|
42
|
-
ELLIPSIS = "...";
|
|
43
|
-
} });
|
|
44
40
|
|
|
45
41
|
//#endregion
|
|
46
42
|
//#region src/log/locate-character/index.js
|
|
@@ -102,10 +98,10 @@ function getLocator(source, options = {}) {
|
|
|
102
98
|
function locate(source, search, options) {
|
|
103
99
|
return getLocator(source, options)(search, options && options.startIndex);
|
|
104
100
|
}
|
|
105
|
-
var init_locate_character = __esm({ "src/log/locate-character/index.js"() {} });
|
|
106
101
|
|
|
107
102
|
//#endregion
|
|
108
103
|
//#region src/log/logs.ts
|
|
104
|
+
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR";
|
|
109
105
|
function logParseError(message) {
|
|
110
106
|
return {
|
|
111
107
|
code: PARSE_ERROR,
|
|
@@ -182,15 +178,9 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
182
178
|
properties.frame = getCodeFrame(source, line, column);
|
|
183
179
|
}
|
|
184
180
|
}
|
|
185
|
-
var INVALID_LOG_POSITION, PLUGIN_ERROR, INPUT_HOOK_IN_OUTPUT_PLUGIN, CYCLE_LOADING, MULTIPLY_NOTIFY_OPTION, PARSE_ERROR;
|
|
186
|
-
var init_logs = __esm({ "src/log/logs.ts"() {
|
|
187
|
-
init_code_frame();
|
|
188
|
-
init_locate_character();
|
|
189
|
-
INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR";
|
|
190
|
-
} });
|
|
191
181
|
|
|
192
182
|
//#endregion
|
|
193
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.73.
|
|
183
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.73.2/node_modules/oxc-parser/wrap.mjs
|
|
194
184
|
function wrap$1(result) {
|
|
195
185
|
let program, module, comments, errors;
|
|
196
186
|
return {
|
|
@@ -225,7 +215,6 @@ function applyFix(program, fixPath) {
|
|
|
225
215
|
node.value = RegExp(node.regex.pattern, node.regex.flags);
|
|
226
216
|
} catch (_err) {}
|
|
227
217
|
}
|
|
228
|
-
var init_wrap = __esm({ "../../node_modules/.pnpm/oxc-parser@0.73.0/node_modules/oxc-parser/wrap.mjs"() {} });
|
|
229
218
|
|
|
230
219
|
//#endregion
|
|
231
220
|
//#region src/parse-ast-index.ts
|
|
@@ -250,6 +239,10 @@ function normalizeParseError(sourceText, errors) {
|
|
|
250
239
|
}
|
|
251
240
|
return error(logParseError(message));
|
|
252
241
|
}
|
|
242
|
+
const defaultParserOptions = {
|
|
243
|
+
lang: "js",
|
|
244
|
+
preserveParens: false
|
|
245
|
+
};
|
|
253
246
|
function parseAst(sourceText, options, filename) {
|
|
254
247
|
return wrap(parseSync(filename ?? "file.js", sourceText, {
|
|
255
248
|
...defaultParserOptions,
|
|
@@ -262,17 +255,6 @@ async function parseAstAsync(sourceText, options, filename) {
|
|
|
262
255
|
...options
|
|
263
256
|
}), sourceText);
|
|
264
257
|
}
|
|
265
|
-
var defaultParserOptions;
|
|
266
|
-
var init_parse_ast_index = __esm({ "src/parse-ast-index.ts"() {
|
|
267
|
-
init_locate_character();
|
|
268
|
-
init_logs();
|
|
269
|
-
init_code_frame();
|
|
270
|
-
init_wrap();
|
|
271
|
-
defaultParserOptions = {
|
|
272
|
-
lang: "js",
|
|
273
|
-
preserveParens: false
|
|
274
|
-
};
|
|
275
|
-
} });
|
|
276
258
|
|
|
277
259
|
//#endregion
|
|
278
|
-
export { augmentCodeLocation, error,
|
|
260
|
+
export { augmentCodeLocation, error, logCycleLoading, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, parseAst, parseAstAsync };
|
|
@@ -181,7 +181,7 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
//#endregion
|
|
184
|
-
//#region ../../node_modules/.pnpm/oxc-parser@0.73.
|
|
184
|
+
//#region ../../node_modules/.pnpm/oxc-parser@0.73.2/node_modules/oxc-parser/wrap.mjs
|
|
185
185
|
function wrap$1(result) {
|
|
186
186
|
let program, module$1, comments, errors;
|
|
187
187
|
return {
|