rolldown 0.15.0 → 0.15.1-commit.09cccaf

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 (64) hide show
  1. package/dist/cjs/cli.cjs +249 -183
  2. package/dist/cjs/experimental-index.cjs +2 -2
  3. package/dist/cjs/index.cjs +1 -1
  4. package/dist/cjs/parallel-plugin-worker.cjs +2 -2
  5. package/dist/esm/cli.mjs +343 -277
  6. package/dist/esm/experimental-index.mjs +1 -1
  7. package/dist/esm/index.mjs +1 -1
  8. package/dist/esm/parallel-plugin-worker.mjs +1 -1
  9. package/dist/shared/{chunk-BK2Ye-xa.cjs → chunk-BFvIen8E.cjs} +0 -11
  10. package/dist/shared/{consola_36c0034f-_8_dG1Nr.cjs → consola_36c0034f-B7L-radJ.cjs} +2 -2
  11. package/dist/shared/{consola_36c0034f-DWsVjwtA.mjs → consola_36c0034f-D9ce-831.mjs} +10 -10
  12. package/dist/shared/{prompt-RFvZMmjc.cjs → prompt-BiXtYIJ2.cjs} +3 -3
  13. package/dist/shared/{prompt-DGW8ZJmn.mjs → prompt-DlQ-08lk.mjs} +2 -2
  14. package/dist/shared/{src-COU7qQBJ.cjs → src-BKghi7SX.cjs} +321 -216
  15. package/dist/shared/{src-DEPa5yhI.mjs → src-BKlslLnW.mjs} +332 -233
  16. package/dist/tsconfig.dts.tsbuildinfo +1 -0
  17. package/dist/types/api/build.d.ts +2 -0
  18. package/dist/types/api/watch/index.d.ts +2 -2
  19. package/dist/types/api/watch/watch-emitter.d.ts +31 -0
  20. package/dist/types/api/watch/watcher.d.ts +7 -27
  21. package/dist/types/binding.d.ts +114 -19
  22. package/dist/types/builtin-plugin/constructors.d.ts +1 -5
  23. package/dist/types/cli/arguments/index.d.ts +5 -3
  24. package/dist/types/cli/arguments/schema.d.ts +10 -397
  25. package/dist/types/cli/colors.d.ts +11 -1
  26. package/dist/types/cli/load-config.d.ts +3 -0
  27. package/dist/types/cli/logger.d.ts +5 -0
  28. package/dist/types/constants/plugin.d.ts +8 -1
  29. package/dist/types/index.d.ts +4 -5
  30. package/dist/types/log/logHandler.d.ts +1 -1
  31. package/dist/types/log/logger.d.ts +1 -1
  32. package/dist/types/log/logging.d.ts +6 -6
  33. package/dist/types/log/logs.d.ts +3 -1
  34. package/dist/types/options/input-options-schema.d.ts +3 -595
  35. package/dist/types/options/input-options.d.ts +26 -3
  36. package/dist/types/options/normalized-input-options.d.ts +2 -2
  37. package/dist/types/options/normalized-output-options.d.ts +22 -18
  38. package/dist/types/options/output-options-schema.d.ts +2 -146
  39. package/dist/types/options/output-options.d.ts +4 -3
  40. package/dist/types/plugin/bindingify-plugin.d.ts +1 -1
  41. package/dist/types/plugin/index.d.ts +6 -6
  42. package/dist/types/plugin/minimal-plugin-context.d.ts +4 -4
  43. package/dist/types/plugin/plugin-context-data.d.ts +2 -1
  44. package/dist/types/plugin/plugin-context.d.ts +15 -11
  45. package/dist/types/plugin/transform-plugin-context.d.ts +8 -5
  46. package/dist/types/treeshake/module-side-effects.d.ts +14 -115
  47. package/dist/types/types/misc.d.ts +40 -0
  48. package/dist/types/types/module-info.d.ts +1 -0
  49. package/dist/types/types/output-bundle.d.ts +2 -2
  50. package/dist/types/types/rolldown-output.d.ts +14 -11
  51. package/dist/types/utils/bindingify-input-options.d.ts +2 -2
  52. package/dist/types/utils/create-bundler-option.d.ts +11 -0
  53. package/dist/types/utils/error.d.ts +2 -1
  54. package/dist/types/utils/misc.d.ts +1 -1
  55. package/dist/types/utils/normalize-plugin-option.d.ts +1 -1
  56. package/dist/types/utils/transform-rendered-chunk.d.ts +4 -4
  57. package/dist/types/utils/transform-rendered-module.d.ts +2 -2
  58. package/dist/types/utils/transform-sourcemap.d.ts +1 -1
  59. package/dist/types/utils/zod-ext.d.ts +6 -5
  60. package/package.json +17 -17
  61. package/dist/types/cli/utils.d.ts +0 -6
  62. package/dist/types/log/locate-character/index.d.ts +0 -13
  63. package/dist/types/rollup-types.d.ts +0 -1
  64. package/dist/types/rollup.d.ts +0 -1114
@@ -15,8 +15,9 @@ export declare class BindingCallableBuiltinPlugin {
15
15
  watchChange(path: string, event: BindingJsWatchChangeEvent): Promise<void>
16
16
  }
17
17
 
18
- export declare class BindingHookError {
19
- get errors(): Array<unknown>
18
+ export declare class BindingError {
19
+ kind: string
20
+ message: string
20
21
  }
21
22
 
22
23
  export declare class BindingLog {
@@ -30,6 +31,7 @@ export declare class BindingModuleInfo {
30
31
  dynamicImporters: Array<string>
31
32
  importedIds: Array<string>
32
33
  dynamicallyImportedIds: Array<string>
34
+ exports: Array<string>
33
35
  isEntry: boolean
34
36
  get code(): string | null
35
37
  }
@@ -62,14 +64,17 @@ export declare class BindingNormalizedOptions {
62
64
  get hashCharacters(): 'base64' | 'base36' | 'hex'
63
65
  get sourcemapDebugIds(): boolean
64
66
  get minify(): boolean
67
+ get polyfillRequire(): boolean
65
68
  get comments(): 'none' | 'preserve-legal'
66
69
  }
67
70
 
68
71
  export declare class BindingOutputAsset {
69
72
  get fileName(): string
70
73
  get originalFileName(): string | null
74
+ get originalFileNames(): Array<string>
71
75
  get source(): BindingAssetSource
72
76
  get name(): string | null
77
+ get names(): Array<string>
73
78
  }
74
79
 
75
80
  export declare class BindingOutputChunk {
@@ -92,7 +97,7 @@ export declare class BindingOutputChunk {
92
97
  export declare class BindingOutputs {
93
98
  get chunks(): Array<BindingOutputChunk>
94
99
  get assets(): Array<BindingOutputAsset>
95
- get errors(): Array<unknown>
100
+ get errors(): Array<Error | BindingError>
96
101
  }
97
102
 
98
103
  export declare class BindingPluginContext {
@@ -115,6 +120,7 @@ export declare class BindingTransformPluginContext {
115
120
  }
116
121
 
117
122
  export declare class BindingWatcher {
123
+ constructor(options: Array<BindingBundlerOptions>, notifyOption?: BindingNotifyOption | undefined | null)
118
124
  close(): Promise<void>
119
125
  start(listener: (data: BindingWatcherEvent) => void): Promise<void>
120
126
  }
@@ -129,16 +135,15 @@ export declare class BindingWatcherEvent {
129
135
  watchChangeData(): BindingWatcherChangeData
130
136
  bundleEndData(): BindingBundleEndEventData
131
137
  bundleEventKind(): string
132
- errors(): Array<unknown>
138
+ errors(): Array<Error | BindingError>
133
139
  }
134
140
 
135
141
  export declare class Bundler {
136
- constructor(inputOptions: BindingInputOptions, outputOptions: BindingOutputOptions, parallelPluginsRegistry?: ParallelJsPluginRegistry | undefined | null)
142
+ constructor(option: BindingBundlerOptions)
137
143
  write(): Promise<BindingOutputs>
138
144
  generate(): Promise<BindingOutputs>
139
145
  scan(): Promise<BindingOutputs>
140
146
  close(): Promise<void>
141
- watch(): Promise<BindingWatcher>
142
147
  get closed(): boolean
143
148
  }
144
149
 
@@ -211,6 +216,16 @@ export type BindingBuiltinPluginName = 'builtin:wasm-helper'|
211
216
  'builtin:replace'|
212
217
  'builtin:vite-resolve';
213
218
 
219
+ export interface BindingBundlerOptions {
220
+ inputOptions: BindingInputOptions
221
+ outputOptions: BindingOutputOptions
222
+ parallelPluginsRegistry?: ParallelJsPluginRegistry
223
+ }
224
+
225
+ export interface BindingChecksOptions {
226
+ circularDependency?: boolean
227
+ }
228
+
214
229
  export interface BindingEmittedAsset {
215
230
  name?: string
216
231
  fileName?: string
@@ -323,15 +338,21 @@ export interface BindingInputOptions {
323
338
  inject?: Array<BindingInjectImportNamed | BindingInjectImportNamespace>
324
339
  experimental?: BindingExperimentalOptions
325
340
  profilerNames?: boolean
326
- jsx?: JsxOptions
341
+ jsx?: BindingJsx
327
342
  watch?: BindingWatchOption
343
+ keepNames?: boolean
344
+ checks?: BindingChecksOptions
328
345
  }
329
346
 
330
347
  export interface BindingJsonPluginConfig {
331
- stringify?: boolean
348
+ stringify?: BindingJsonPluginStringify
332
349
  isBuild?: boolean
350
+ namedExports?: boolean
333
351
  }
334
352
 
353
+ export type BindingJsonPluginStringify =
354
+ boolean | string
355
+
335
356
  export interface BindingJsonSourcemap {
336
357
  file?: string
337
358
  mappings?: string
@@ -345,6 +366,11 @@ export interface BindingJsWatchChangeEvent {
345
366
  event: string
346
367
  }
347
368
 
369
+ export type BindingJsx =
370
+ | { type: 'Disable' }
371
+ | { type: 'Preserve' }
372
+ | { type: 'Enable', field0: JsxOptions }
373
+
348
374
  export declare enum BindingLogLevel {
349
375
  Silent = 0,
350
376
  Warn = 1,
@@ -409,6 +435,7 @@ export interface BindingOutputOptions {
409
435
  minify?: boolean
410
436
  advancedChunks?: BindingAdvancedChunksOptions
411
437
  comments?: 'none' | 'preserve-legal'
438
+ polyfillRequire?: boolean
412
439
  }
413
440
 
414
441
  export interface BindingPluginContextResolvedId {
@@ -443,7 +470,7 @@ export interface BindingPluginOptions {
443
470
  transformFilter?: BindingTransformHookFilter
444
471
  moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
445
472
  moduleParsedMeta?: BindingPluginHookMeta
446
- buildEnd?: (ctx: BindingPluginContext, error?: BindingHookError) => MaybePromise<VoidNullable>
473
+ buildEnd?: (ctx: BindingPluginContext, error?: (Error | BindingError)[]) => MaybePromise<VoidNullable>
447
474
  buildEndMeta?: BindingPluginHookMeta
448
475
  renderChunk?: (ctx: BindingPluginContext, code: string, chunk: RenderedChunk, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
449
476
  renderChunkMeta?: BindingPluginHookMeta
@@ -451,7 +478,7 @@ export interface BindingPluginOptions {
451
478
  augmentChunkHashMeta?: BindingPluginHookMeta
452
479
  renderStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => void
453
480
  renderStartMeta?: BindingPluginHookMeta
454
- renderError?: (ctx: BindingPluginContext, error: string) => void
481
+ renderError?: (ctx: BindingPluginContext, error: (Error | BindingError)[]) => void
455
482
  renderErrorMeta?: BindingPluginHookMeta
456
483
  generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
457
484
  generateBundleMeta?: BindingPluginHookMeta
@@ -524,11 +551,12 @@ export interface BindingTransformPluginConfig {
524
551
  exclude?: Array<BindingStringOrRegex>
525
552
  jsxInject?: string
526
553
  reactRefresh?: boolean
527
- targets?: string
554
+ target?: string
555
+ browserslist?: string
528
556
  }
529
557
 
530
558
  export interface BindingTreeshake {
531
- moduleSideEffects: boolean | BindingModuleSideEffectsRule[]
559
+ moduleSideEffects: boolean | BindingModuleSideEffectsRule[] | ((id: string, is_external: boolean) => boolean | undefined)
532
560
  annotations?: boolean
533
561
  }
534
562
 
@@ -537,7 +565,8 @@ export interface BindingViteResolvePluginConfig {
537
565
  environmentConsumer: string
538
566
  environmentName: string
539
567
  external: true | string[]
540
- noExternal: true | string[]
568
+ noExternal: true | Array<string | RegExp>
569
+ dedupe: Array<string>
541
570
  finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
542
571
  finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
543
572
  runtime: string
@@ -562,11 +591,24 @@ export interface BindingViteResolvePluginResolveOptions {
562
591
 
563
592
  export interface BindingWatchOption {
564
593
  skipWrite?: boolean
565
- notify?: BindingNotifyOption
566
594
  include?: Array<BindingStringOrRegex>
567
595
  exclude?: Array<BindingStringOrRegex>
568
596
  }
569
597
 
598
+ export interface CompilerAssumptions {
599
+ ignoreFunctionLength?: boolean
600
+ noDocumentAll?: boolean
601
+ objectRestNoSymbols?: boolean
602
+ pureGetters?: boolean
603
+ setPublicClassFields?: boolean
604
+ }
605
+
606
+ export interface ErrorLabel {
607
+ message?: string
608
+ start: number
609
+ end: number
610
+ }
611
+
570
612
  export interface Es2015Options {
571
613
  /** Transform arrow functions into function expressions. */
572
614
  arrowFunction?: ArrowFunctionsOptions
@@ -577,6 +619,32 @@ export interface ExtensionAliasItem {
577
619
  replacements: Array<string>
578
620
  }
579
621
 
622
+ export type HelperMode = /**
623
+ * Runtime mode (default): Helper functions are imported from a runtime package.
624
+ *
625
+ * Example:
626
+ *
627
+ * ```js
628
+ * import helperName from "@babel/runtime/helpers/helperName";
629
+ * helperName(...arguments);
630
+ * ```
631
+ */
632
+ 'Runtime'|
633
+ /**
634
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
635
+ *
636
+ * Example:
637
+ *
638
+ * ```js
639
+ * babelHelpers.helperName(...arguments);
640
+ * ```
641
+ */
642
+ 'External';
643
+
644
+ export interface Helpers {
645
+ mode?: HelperMode
646
+ }
647
+
580
648
  /** TypeScript Isolated Declarations for Standalone DTS Emit */
581
649
  export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
582
650
 
@@ -596,7 +664,7 @@ export interface IsolatedDeclarationsOptions {
596
664
  export interface IsolatedDeclarationsResult {
597
665
  code: string
598
666
  map?: SourceMap
599
- errors: Array<string>
667
+ errors: Array<OxcError>
600
668
  }
601
669
 
602
670
  export interface JsChangedOutputs {
@@ -606,8 +674,8 @@ export interface JsChangedOutputs {
606
674
  }
607
675
 
608
676
  export interface JsOutputAsset {
609
- name?: string
610
- originalFileName?: string
677
+ names: Array<string>
678
+ originalFileNames: Array<string>
611
679
  filename: string
612
680
  source: BindingAssetSource
613
681
  }
@@ -724,6 +792,13 @@ export interface JsxOptions {
724
792
  refresh?: boolean | ReactRefreshOptions
725
793
  }
726
794
 
795
+ export interface OxcError {
796
+ severity: Severity
797
+ message: string
798
+ labels: Array<ErrorLabel>
799
+ helpMessage?: string
800
+ }
801
+
727
802
  export interface PreRenderedChunk {
728
803
  name: string
729
804
  isEntry: boolean
@@ -764,6 +839,10 @@ export interface RenderedChunk {
764
839
  dynamicImports: Array<string>
765
840
  }
766
841
 
842
+ export type Severity = 'Error'|
843
+ 'Warning'|
844
+ 'Advice';
845
+
767
846
  export interface SourceMap {
768
847
  file?: string
769
848
  mappings: string
@@ -813,10 +892,12 @@ export interface TransformOptions {
813
892
  * @see {@link SourceMap}
814
893
  */
815
894
  sourcemap?: boolean
895
+ /** Set assumptions in order to produce smaller output. */
896
+ assumptions?: CompilerAssumptions
816
897
  /** Configure how TypeScript is transformed. */
817
898
  typescript?: TypeScriptOptions
818
899
  /** Configure how TSX and JSX are transformed. */
819
- jsx?: JsxOptions
900
+ jsx?: 'preserve' | JsxOptions
820
901
  /**
821
902
  * Sets the target environment for the generated JavaScript.
822
903
  *
@@ -832,6 +913,8 @@ export interface TransformOptions {
832
913
  * @see [esbuild#target](https://esbuild.github.io/api/#target)
833
914
  */
834
915
  target?: string | Array<string>
916
+ /** Behaviour for runtime helpers. */
917
+ helpers?: Helpers
835
918
  /** Define Plugin */
836
919
  define?: Record<string, string>
837
920
  /** Inject Plugin */
@@ -868,6 +951,18 @@ export interface TransformResult {
868
951
  * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
869
952
  */
870
953
  declarationMap?: SourceMap
954
+ /**
955
+ * Helpers used.
956
+ *
957
+ * @internal
958
+ *
959
+ * Example:
960
+ *
961
+ * ```text
962
+ * { "_objectSpread": "@babel/runtime/helpers/objectSpread2" }
963
+ * ```
964
+ */
965
+ helpersUsed: Record<string, string>
871
966
  /**
872
967
  * Parse and transformation errors.
873
968
  *
@@ -875,7 +970,7 @@ export interface TransformResult {
875
970
  * transformed code may still be available even if there are errors in this
876
971
  * list.
877
972
  */
878
- errors: Array<string>
973
+ errors: Array<OxcError>
879
974
  }
880
975
 
881
976
  export interface TypeScriptOptions {
@@ -13,8 +13,4 @@ export declare function wasmFallbackPlugin(): BuiltinPlugin;
13
13
  export declare function loadFallbackPlugin(): BuiltinPlugin;
14
14
  export declare function jsonPlugin(config?: BindingJsonPluginConfig): BuiltinPlugin;
15
15
  export declare function buildImportAnalysisPlugin(config: BindingBuildImportAnalysisPluginConfig): BuiltinPlugin;
16
- export declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, 'runtime'>): BuiltinPlugin & {
17
- resolveId: (id: string, importer?: string | undefined | null, options?: import("../binding").BindingHookJsResolveIdOptions | undefined | null) => Promise<import("../binding").BindingHookJsResolveIdOutput | null>;
18
- load: (id: string) => Promise<import("../binding").BindingHookJsLoadOutput | null>;
19
- watchChange: (path: string, event: import("../binding").BindingJsWatchChangeEvent) => Promise<void>;
20
- };
16
+ export declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, 'runtime'>): BuiltinPlugin;
@@ -1,7 +1,9 @@
1
- export declare const flattenedSchema: Record<string, import("./types").Schema>;
1
+ import { type NormalizedCliOptions } from './normalize';
2
+ import type { Schema } from './types';
3
+ export declare const flattenedSchema: Record<string, Schema>;
2
4
  export declare const options: {
3
5
  [k: string]: {
4
- type: "boolean" | "string";
6
+ type: 'boolean' | 'string';
5
7
  multiple: boolean;
6
8
  short?: string;
7
9
  default?: boolean | string | string[];
@@ -10,4 +12,4 @@ export declare const options: {
10
12
  };
11
13
  };
12
14
  export type ParseArgsOptions = typeof options;
13
- export declare function parseCliArguments(): import("./normalize").NormalizedCliOptions;
15
+ export declare function parseCliArguments(): NormalizedCliOptions;