@rolldown/browser 1.0.0-beta.8-commit.1fd551c → 1.0.0-beta.8-commit.852c603

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 (35) hide show
  1. package/dist/browser.mjs +324 -162
  2. package/dist/cli.cjs +6 -5
  3. package/dist/cli.mjs +6 -5
  4. package/dist/experimental-index.cjs +3 -2
  5. package/dist/experimental-index.d.cts +1 -1
  6. package/dist/experimental-index.d.mts +1 -1
  7. package/dist/experimental-index.mjs +3 -2
  8. package/dist/filter-expression-index.cjs +11 -0
  9. package/dist/filter-expression-index.d.cts +3 -0
  10. package/dist/filter-expression-index.d.mts +3 -0
  11. package/dist/filter-expression-index.mjs +4 -0
  12. package/dist/index.cjs +3 -2
  13. package/dist/index.d.cts +2 -2
  14. package/dist/index.d.mts +2 -2
  15. package/dist/index.mjs +3 -2
  16. package/dist/parallel-plugin-worker.cjs +3 -2
  17. package/dist/parallel-plugin-worker.mjs +3 -2
  18. package/dist/parallel-plugin.d.cts +1 -1
  19. package/dist/parallel-plugin.d.mts +1 -1
  20. package/dist/parse-ast-index.cjs +1 -1
  21. package/dist/parse-ast-index.mjs +1 -1
  22. package/dist/rolldown-binding.wasi-browser.js +1 -0
  23. package/dist/rolldown-binding.wasi.cjs +1 -0
  24. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  25. package/dist/shared/filter-expression-index-CIS7Rrin.mjs +69 -0
  26. package/dist/shared/filter-expression-index-CRtoeipP.cjs +119 -0
  27. package/dist/shared/{input-options.d-P0YdGzip.d.cts → input-options.d-C0G2toUx.d.cts} +83 -21
  28. package/dist/shared/{input-options.d-CMFIv0CX.d.mts → input-options.d-D_2wMOSn.d.mts} +83 -21
  29. package/dist/shared/{parse-ast-index-DAk8Z2V8.cjs → parse-ast-index-B9pj8J1q.cjs} +14 -13
  30. package/dist/shared/{parse-ast-index-Cprsj_YY.mjs → parse-ast-index-DWHg_E7J.mjs} +15 -14
  31. package/dist/shared/{src-BLbX9IKh.cjs → src-DbbYa-_8.cjs} +248 -133
  32. package/dist/shared/{src-BkpdHXjc.mjs → src-RM00Zc4c.mjs} +1781 -1665
  33. package/package.json +3 -3
  34. /package/dist/shared/{prompt-_yrURmmm.cjs → prompt-At99RuKY.cjs} +0 -0
  35. /package/dist/shared/{prompt-B7SnYdwU.mjs → prompt-BqVpALUY.mjs} +0 -0
@@ -5,12 +5,6 @@ import { Program } from "@oxc-project/types";
5
5
  type LogLevel = "info" | "debug" | "warn";
6
6
  type LogLevelOption = LogLevel | "silent";
7
7
  type LogLevelWithError = LogLevel | "error";
8
- type RollupLog$1 = any;
9
- type RollupLogWithString = RollupLog$1 | string;
10
- type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
11
-
12
- //#endregion
13
- //#region src/types/misc.d.ts
14
8
  interface RollupLog {
15
9
  binding?: string;
16
10
  cause?: unknown;
@@ -35,19 +29,18 @@ interface RollupLog {
35
29
  stack?: string;
36
30
  url?: string;
37
31
  }
32
+ type RollupLogWithString = RollupLog | string;
38
33
  interface RollupError extends RollupLog {
39
34
  name?: string;
40
35
  stack?: string;
41
36
  watchFiles?: string[];
42
37
  }
43
- type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
44
- type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
45
- column: number
46
- line: number
47
- }) => void;
38
+ type LogOrStringHandler = (level: LogLevelWithError, log: RollupLogWithString) => void;
39
+
40
+ //#endregion
41
+ //#region src/types/misc.d.ts
48
42
  type SourcemapPathTransformOption = (relativeSourcePath: string, sourcemapPath: string) => string;
49
43
  type SourcemapIgnoreListOption = (relativeSourcePath: string, sourcemapPath: string) => boolean;
50
- type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
51
44
 
52
45
  //#endregion
53
46
  //#region src/utils/asset-source.d.ts
@@ -372,6 +365,15 @@ type RolldownWatcher = WatcherEmitter;
372
365
  //#region src/api/watch/index.d.ts
373
366
  declare const watch: (input: WatchOptions$1 | WatchOptions$1[]) => RolldownWatcher;
374
367
 
368
+ //#endregion
369
+ //#region src/log/log-handler.d.ts
370
+ type LoggingFunction = (log: RollupLog | string | (() => RollupLog | string)) => void;
371
+ type LoggingFunctionWithPosition = (log: RollupLog | string | (() => RollupLog | string), pos?: number | {
372
+ column: number
373
+ line: number
374
+ }) => void;
375
+ type WarningHandlerWithDefault = (warning: RollupLog, defaultHandler: LoggingFunction) => void;
376
+
375
377
  //#endregion
376
378
  //#region src/options/normalized-input-options.d.ts
377
379
  interface NormalizedInputOptions {
@@ -415,11 +417,68 @@ interface NormalizedOutputOptions {
415
417
  plugins: RolldownPlugin[];
416
418
  }
417
419
 
420
+ //#endregion
421
+ //#region src/filter-expression-index.d.ts
422
+ type FilterExpressionKind = FilterExpression["kind"];
423
+ type FilterExpression = And | Or | Not | Id | ModuleType$1 | Code | Include | Exclude$1;
424
+ type TopLevelFilterExpression = Include | Exclude$1;
425
+ declare class And {
426
+ kind: "and";
427
+ left: FilterExpression;
428
+ right: FilterExpression;
429
+ constructor(left: FilterExpression, right: FilterExpression);
430
+ }
431
+ declare class Or {
432
+ kind: "or";
433
+ left: FilterExpression;
434
+ right: FilterExpression;
435
+ constructor(left: FilterExpression, right: FilterExpression);
436
+ }
437
+ declare class Not {
438
+ kind: "not";
439
+ expr: FilterExpression;
440
+ constructor(expr: FilterExpression);
441
+ }
442
+ declare class Id {
443
+ kind: "id";
444
+ pattern: StringOrRegExp;
445
+ constructor(pattern: StringOrRegExp);
446
+ }
447
+ declare class ModuleType$1 {
448
+ kind: "moduleType";
449
+ pattern: ModuleType;
450
+ constructor(pattern: ModuleType);
451
+ }
452
+ declare class Code {
453
+ kind: "code";
454
+ pattern: StringOrRegExp;
455
+ constructor(expr: StringOrRegExp);
456
+ }
457
+ declare class Include {
458
+ kind: "include";
459
+ expr: FilterExpression;
460
+ constructor(expr: FilterExpression);
461
+ }
462
+ declare class Exclude$1 {
463
+ kind: "exclude";
464
+ expr: FilterExpression;
465
+ constructor(expr: FilterExpression);
466
+ }
467
+ declare function and(left: FilterExpression, right: FilterExpression): And;
468
+ declare function or(left: FilterExpression, right: FilterExpression): Or;
469
+ declare function not(expr: FilterExpression): Not;
470
+ declare function id(pattern: StringOrRegExp): Id;
471
+ declare function moduleType(pattern: ModuleType): ModuleType$1;
472
+ declare function code(pattern: StringOrRegExp): Code;
473
+ declare function include(expr: FilterExpression): Include;
474
+ declare function exclude(expr: FilterExpression): Exclude$1;
475
+
418
476
  //#endregion
419
477
  //#region src/plugin/hook-filter.d.ts
420
- type StringFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
478
+ type GeneralHookFilter<Value = StringOrRegExp> = MaybeArray<Value> | {
421
479
  include?: MaybeArray<Value>
422
480
  exclude?: MaybeArray<Value>
481
+ custom?: TopLevelFilterExpression[]
423
482
  };
424
483
  interface FormalModuleTypeFilter {
425
484
  include?: ModuleType[];
@@ -458,9 +517,10 @@ interface HookFilter {
458
517
  * }}
459
518
  * ```
460
519
  */
461
- id?: StringFilter;
520
+ id?: GeneralHookFilter;
462
521
  moduleType?: ModuleTypeFilter;
463
- code?: StringFilter;
522
+ code?: GeneralHookFilter;
523
+ custom?: TopLevelFilterExpression[];
464
524
  }
465
525
 
466
526
  //#endregion
@@ -802,11 +862,13 @@ type ParallelPluginHooks = Exclude<keyof FunctionPluginHooks | AddonHooks, First
802
862
  type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends "transform" ? {
803
863
  filter?: HookFilter
804
864
  } : K extends "load" ? {
805
- filter?: Pick<HookFilter, "id">
865
+ filter?: Pick<HookFilter, "id" | "custom">
806
866
  } : K extends "resolveId" ? {
807
867
  filter?: {
808
- id?: StringFilter<RegExp>
809
- }
868
+ id?: GeneralHookFilter<RegExp>
869
+ } & Pick<HookFilter, "custom">
870
+ } : K extends "renderChunk" ? {
871
+ filter?: Pick<HookFilter, "code">
810
872
  } : {};
811
873
  type PluginHooks = { [K in keyof FunctionPluginHooks] : ObjectHook<K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K], HookFilterExtension<K> & (K extends ParallelPluginHooks ? {
812
874
  /**
@@ -961,8 +1023,8 @@ interface InputOptions {
961
1023
  shimMissingExports?: boolean;
962
1024
  treeshake?: boolean | TreeshakingOptions;
963
1025
  logLevel?: LogLevelOption;
964
- onLog?: (level: LogLevel, log: RollupLog$1, defaultHandler: LogOrStringHandler) => void;
965
- onwarn?: (warning: RollupLog$1, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
1026
+ onLog?: (level: LogLevel, log: RollupLog, defaultHandler: LogOrStringHandler) => void;
1027
+ onwarn?: (warning: RollupLog, defaultHandler: (warning: RollupLogWithString | (() => RollupLogWithString)) => void) => void;
966
1028
  moduleTypes?: ModuleTypes;
967
1029
  experimental?: {
968
1030
  enableComposingJsPlugins?: boolean
@@ -1065,4 +1127,4 @@ interface InputOptions {
1065
1127
  }
1066
1128
 
1067
1129
  //#endregion
1068
- export { AddonFunction, AsyncPluginHooks, BuildOptions, BuiltinPlugin as BuiltinPlugin$1, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FunctionPluginHooks, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MaybePromise, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk$1 as PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog$1 as RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, StringFilter, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION as VERSION$1, WarningHandlerWithDefault, WatchOptions$1 as WatchOptions, build as build$1, buildImportAnalysisPlugin as buildImportAnalysisPlugin$1, defineConfig as defineConfig$1, defineParallelPlugin, dynamicImportVarsPlugin as dynamicImportVarsPlugin$1, importGlobPlugin as importGlobPlugin$1, isolatedDeclarationPlugin as isolatedDeclarationPlugin$1, jsonPlugin as jsonPlugin$1, loadFallbackPlugin as loadFallbackPlugin$1, manifestPlugin as manifestPlugin$1, moduleFederationPlugin as moduleFederationPlugin$1, modulePreloadPolyfillPlugin as modulePreloadPolyfillPlugin$1, reportPlugin as reportPlugin$1, rolldown as rolldown$1, viteResolvePlugin as viteResolvePlugin$1, wasmFallbackPlugin as wasmFallbackPlugin$1, wasmHelperPlugin as wasmHelperPlugin$1, watch as watch$1, withFilter as withFilter$1 };
1130
+ export { AddonFunction, And as And$1, AsyncPluginHooks, BuildOptions, BuiltinPlugin as BuiltinPlugin$1, ChunkFileNamesFunction, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedFile, ExistingRawSourceMap, ExternalOption, FilterExpression, FilterExpressionKind, FunctionPluginHooks, GeneralHookFilter, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, JsxOptions, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MaybePromise, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PreRenderedAsset, PreRenderedChunk$1 as PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RollupError, RollupLog, RollupLogWithString, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TopLevelFilterExpression, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION as VERSION$1, WarningHandlerWithDefault, WatchOptions$1 as WatchOptions, and as and$1, build as build$1, buildImportAnalysisPlugin as buildImportAnalysisPlugin$1, code as code$1, defineConfig as defineConfig$1, defineParallelPlugin, dynamicImportVarsPlugin as dynamicImportVarsPlugin$1, exclude as exclude$1, id as id$1, importGlobPlugin as importGlobPlugin$1, include as include$1, isolatedDeclarationPlugin as isolatedDeclarationPlugin$1, jsonPlugin as jsonPlugin$1, loadFallbackPlugin as loadFallbackPlugin$1, manifestPlugin as manifestPlugin$1, moduleFederationPlugin as moduleFederationPlugin$1, modulePreloadPolyfillPlugin as modulePreloadPolyfillPlugin$1, moduleType as moduleType$1, not as not$1, or as or$1, reportPlugin as reportPlugin$1, rolldown as rolldown$1, viteResolvePlugin as viteResolvePlugin$1, wasmFallbackPlugin as wasmFallbackPlugin$1, wasmHelperPlugin as wasmHelperPlugin$1, watch as watch$1, withFilter as withFilter$1 };
@@ -182,7 +182,7 @@ function augmentCodeLocation(properties, pos, source, id) {
182
182
  }
183
183
 
184
184
  //#endregion
185
- //#region ../../node_modules/.pnpm/oxc-parser@0.66.0/node_modules/oxc-parser/wrap.mjs
185
+ //#region ../../node_modules/.pnpm/oxc-parser@0.67.0/node_modules/oxc-parser/wrap.mjs
186
186
  function wrap$1(result) {
187
187
  let program, module$1, comments, errors;
188
188
  return {
@@ -204,19 +204,20 @@ function wrap$1(result) {
204
204
  }
205
205
  };
206
206
  }
207
- function jsonParseAst(ast) {
208
- return JSON.parse(ast, function(key, value) {
209
- if (value === null && key === "value" && Object.hasOwn(this, "type") && this.type === "Literal") {
210
- if (Object.hasOwn(this, "bigint")) return BigInt(this.bigint);
211
- if (Object.hasOwn(this, "regex")) {
212
- const { regex } = this;
213
- try {
214
- return RegExp(regex.pattern, regex.flags);
215
- } catch (_err) {}
216
- }
207
+ function jsonParseAst(program) {
208
+ return JSON.parse(program, transform);
209
+ }
210
+ function transform(key, value) {
211
+ if (value === null && key === "value" && Object.hasOwn(this, "type") && this.type === "Literal") {
212
+ if (Object.hasOwn(this, "bigint")) return BigInt(this.bigint);
213
+ if (Object.hasOwn(this, "regex")) {
214
+ const { regex } = this;
215
+ try {
216
+ return RegExp(regex.pattern, regex.flags);
217
+ } catch (_err) {}
217
218
  }
218
- return value;
219
- });
219
+ }
220
+ return value;
220
221
  }
221
222
 
222
223
  //#endregion
@@ -190,7 +190,7 @@ var init_logs = __esm({ "src/log/logs.ts"() {
190
190
  } });
191
191
 
192
192
  //#endregion
193
- //#region ../../node_modules/.pnpm/oxc-parser@0.66.0/node_modules/oxc-parser/wrap.mjs
193
+ //#region ../../node_modules/.pnpm/oxc-parser@0.67.0/node_modules/oxc-parser/wrap.mjs
194
194
  function wrap$1(result) {
195
195
  let program, module, comments, errors;
196
196
  return {
@@ -212,21 +212,22 @@ function wrap$1(result) {
212
212
  }
213
213
  };
214
214
  }
215
- function jsonParseAst(ast) {
216
- return JSON.parse(ast, function(key, value) {
217
- if (value === null && key === "value" && Object.hasOwn(this, "type") && this.type === "Literal") {
218
- if (Object.hasOwn(this, "bigint")) return BigInt(this.bigint);
219
- if (Object.hasOwn(this, "regex")) {
220
- const { regex } = this;
221
- try {
222
- return RegExp(regex.pattern, regex.flags);
223
- } catch (_err) {}
224
- }
215
+ function jsonParseAst(program) {
216
+ return JSON.parse(program, transform);
217
+ }
218
+ function transform(key, value) {
219
+ if (value === null && key === "value" && Object.hasOwn(this, "type") && this.type === "Literal") {
220
+ if (Object.hasOwn(this, "bigint")) return BigInt(this.bigint);
221
+ if (Object.hasOwn(this, "regex")) {
222
+ const { regex } = this;
223
+ try {
224
+ return RegExp(regex.pattern, regex.flags);
225
+ } catch (_err) {}
225
226
  }
226
- return value;
227
- });
227
+ }
228
+ return value;
228
229
  }
229
- var init_wrap = __esm({ "../../node_modules/.pnpm/oxc-parser@0.66.0/node_modules/oxc-parser/wrap.mjs"() {} });
230
+ var init_wrap = __esm({ "../../node_modules/.pnpm/oxc-parser@0.67.0/node_modules/oxc-parser/wrap.mjs"() {} });
230
231
 
231
232
  //#endregion
232
233
  //#region src/parse-ast-index.ts