rolldown 0.14.0-snapshot-d42ea8a-20241202003632 → 0.15.0-commit.ac58858

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 (53) hide show
  1. package/dist/cjs/cli.cjs +189 -175
  2. package/dist/cjs/experimental-index.cjs +12 -3
  3. package/dist/cjs/index.cjs +2 -1
  4. package/dist/cjs/parallel-plugin-worker.cjs +2 -2
  5. package/dist/esm/cli.mjs +282 -268
  6. package/dist/esm/experimental-index.mjs +10 -1
  7. package/dist/esm/index.mjs +2 -2
  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-CfQyqNSn.cjs → src-Bs7g4_us.cjs} +227 -121
  15. package/dist/shared/{src-DhHfkqAC.mjs → src-C-NQjnqV.mjs} +226 -136
  16. package/dist/tsconfig.dts.tsbuildinfo +1 -0
  17. package/dist/types/api/build.d.ts +16 -0
  18. package/dist/types/api/experimental.d.ts +7 -0
  19. package/dist/types/api/rolldown/index.d.ts +3 -0
  20. package/dist/types/{rolldown-build.d.ts → api/rolldown/rolldown-build.d.ts} +3 -3
  21. package/dist/types/api/watch/index.d.ts +3 -0
  22. package/dist/types/{watcher.d.ts → api/watch/watch-emitter.d.ts} +15 -17
  23. package/dist/types/api/watch/watcher.d.ts +13 -0
  24. package/dist/types/binding.d.ts +108 -15
  25. package/dist/types/builtin-plugin/constructors.d.ts +1 -5
  26. package/dist/types/cli/arguments/index.d.ts +5 -3
  27. package/dist/types/cli/arguments/schema.d.ts +10 -397
  28. package/dist/types/cli/colors.d.ts +11 -1
  29. package/dist/types/cli/utils.d.ts +2 -1
  30. package/dist/types/constants/plugin.d.ts +8 -1
  31. package/dist/types/experimental-index.d.ts +1 -1
  32. package/dist/types/index.d.ts +8 -6
  33. package/dist/types/log/logging.d.ts +6 -6
  34. package/dist/types/log/logs.d.ts +1 -0
  35. package/dist/types/options/input-options-schema.d.ts +3 -595
  36. package/dist/types/options/input-options.d.ts +16 -1
  37. package/dist/types/options/normalized-input-options.d.ts +1 -1
  38. package/dist/types/options/normalized-output-options.d.ts +20 -17
  39. package/dist/types/options/output-options-schema.d.ts +2 -146
  40. package/dist/types/options/output-options.d.ts +1 -0
  41. package/dist/types/plugin/plugin-context-data.d.ts +2 -1
  42. package/dist/types/rollup.d.ts +4 -0
  43. package/dist/types/treeshake/module-side-effects.d.ts +14 -115
  44. package/dist/types/types/rolldown-output.d.ts +6 -0
  45. package/dist/types/utils/bindingify-input-options.d.ts +1 -1
  46. package/dist/types/utils/create-bundler-option.d.ts +11 -0
  47. package/dist/types/utils/error.d.ts +2 -1
  48. package/dist/types/utils/misc.d.ts +1 -0
  49. package/dist/types/utils/transform-sourcemap.d.ts +1 -1
  50. package/dist/types/utils/zod-ext.d.ts +6 -5
  51. package/package.json +15 -15
  52. package/dist/types/log/locate-character/index.d.ts +0 -13
  53. package/dist/types/rolldown.d.ts +0 -12
@@ -15,6 +15,11 @@ export declare class BindingCallableBuiltinPlugin {
15
15
  watchChange(path: string, event: BindingJsWatchChangeEvent): Promise<void>
16
16
  }
17
17
 
18
+ export declare class BindingError {
19
+ kind: string
20
+ message: string
21
+ }
22
+
18
23
  export declare class BindingLog {
19
24
  code: string
20
25
  message: string
@@ -58,14 +63,17 @@ export declare class BindingNormalizedOptions {
58
63
  get hashCharacters(): 'base64' | 'base36' | 'hex'
59
64
  get sourcemapDebugIds(): boolean
60
65
  get minify(): boolean
66
+ get polyfillRequire(): boolean
61
67
  get comments(): 'none' | 'preserve-legal'
62
68
  }
63
69
 
64
70
  export declare class BindingOutputAsset {
65
71
  get fileName(): string
66
72
  get originalFileName(): string | null
73
+ get originalFileNames(): Array<string>
67
74
  get source(): BindingAssetSource
68
75
  get name(): string | null
76
+ get names(): Array<string>
69
77
  }
70
78
 
71
79
  export declare class BindingOutputChunk {
@@ -88,7 +96,7 @@ export declare class BindingOutputChunk {
88
96
  export declare class BindingOutputs {
89
97
  get chunks(): Array<BindingOutputChunk>
90
98
  get assets(): Array<BindingOutputAsset>
91
- get errors(): Array<unknown>
99
+ get errors(): Array<Error | BindingError>
92
100
  }
93
101
 
94
102
  export declare class BindingPluginContext {
@@ -111,6 +119,7 @@ export declare class BindingTransformPluginContext {
111
119
  }
112
120
 
113
121
  export declare class BindingWatcher {
122
+ constructor(options: Array<BindingBundlerOptions>, notifyOption?: BindingNotifyOption | undefined | null)
114
123
  close(): Promise<void>
115
124
  start(listener: (data: BindingWatcherEvent) => void): Promise<void>
116
125
  }
@@ -125,16 +134,15 @@ export declare class BindingWatcherEvent {
125
134
  watchChangeData(): BindingWatcherChangeData
126
135
  bundleEndData(): BindingBundleEndEventData
127
136
  bundleEventKind(): string
128
- errors(): Array<unknown>
137
+ errors(): Array<Error | BindingError>
129
138
  }
130
139
 
131
140
  export declare class Bundler {
132
- constructor(inputOptions: BindingInputOptions, outputOptions: BindingOutputOptions, parallelPluginsRegistry?: ParallelJsPluginRegistry | undefined | null)
141
+ constructor(option: BindingBundlerOptions)
133
142
  write(): Promise<BindingOutputs>
134
143
  generate(): Promise<BindingOutputs>
135
144
  scan(): Promise<BindingOutputs>
136
145
  close(): Promise<void>
137
- watch(): Promise<BindingWatcher>
138
146
  get closed(): boolean
139
147
  }
140
148
 
@@ -207,6 +215,16 @@ export type BindingBuiltinPluginName = 'builtin:wasm-helper'|
207
215
  'builtin:replace'|
208
216
  'builtin:vite-resolve';
209
217
 
218
+ export interface BindingBundlerOptions {
219
+ inputOptions: BindingInputOptions
220
+ outputOptions: BindingOutputOptions
221
+ parallelPluginsRegistry?: ParallelJsPluginRegistry
222
+ }
223
+
224
+ export interface BindingChecksOptions {
225
+ circularDependency?: boolean
226
+ }
227
+
210
228
  export interface BindingEmittedAsset {
211
229
  name?: string
212
230
  fileName?: string
@@ -321,13 +339,19 @@ export interface BindingInputOptions {
321
339
  profilerNames?: boolean
322
340
  jsx?: JsxOptions
323
341
  watch?: BindingWatchOption
342
+ keepNames?: boolean
343
+ checks?: BindingChecksOptions
324
344
  }
325
345
 
326
346
  export interface BindingJsonPluginConfig {
327
- stringify?: boolean
347
+ stringify?: BindingJsonPluginStringify
328
348
  isBuild?: boolean
349
+ namedExports?: boolean
329
350
  }
330
351
 
352
+ export type BindingJsonPluginStringify =
353
+ boolean | string
354
+
331
355
  export interface BindingJsonSourcemap {
332
356
  file?: string
333
357
  mappings?: string
@@ -405,6 +429,7 @@ export interface BindingOutputOptions {
405
429
  minify?: boolean
406
430
  advancedChunks?: BindingAdvancedChunksOptions
407
431
  comments?: 'none' | 'preserve-legal'
432
+ polyfillRequire?: boolean
408
433
  }
409
434
 
410
435
  export interface BindingPluginContextResolvedId {
@@ -439,7 +464,7 @@ export interface BindingPluginOptions {
439
464
  transformFilter?: BindingTransformHookFilter
440
465
  moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
441
466
  moduleParsedMeta?: BindingPluginHookMeta
442
- buildEnd?: (ctx: BindingPluginContext, error: Nullable<string>) => MaybePromise<VoidNullable>
467
+ buildEnd?: (ctx: BindingPluginContext, error?: (Error | BindingError)[]) => MaybePromise<VoidNullable>
443
468
  buildEndMeta?: BindingPluginHookMeta
444
469
  renderChunk?: (ctx: BindingPluginContext, code: string, chunk: RenderedChunk, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
445
470
  renderChunkMeta?: BindingPluginHookMeta
@@ -447,7 +472,7 @@ export interface BindingPluginOptions {
447
472
  augmentChunkHashMeta?: BindingPluginHookMeta
448
473
  renderStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => void
449
474
  renderStartMeta?: BindingPluginHookMeta
450
- renderError?: (ctx: BindingPluginContext, error: string) => void
475
+ renderError?: (ctx: BindingPluginContext, error: (Error | BindingError)[]) => void
451
476
  renderErrorMeta?: BindingPluginHookMeta
452
477
  generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
453
478
  generateBundleMeta?: BindingPluginHookMeta
@@ -520,11 +545,12 @@ export interface BindingTransformPluginConfig {
520
545
  exclude?: Array<BindingStringOrRegex>
521
546
  jsxInject?: string
522
547
  reactRefresh?: boolean
523
- targets?: string
548
+ target?: string
549
+ browserslist?: string
524
550
  }
525
551
 
526
552
  export interface BindingTreeshake {
527
- moduleSideEffects: boolean | BindingModuleSideEffectsRule[]
553
+ moduleSideEffects: boolean | BindingModuleSideEffectsRule[] | ((id: string, is_external: boolean) => boolean | undefined)
528
554
  annotations?: boolean
529
555
  }
530
556
 
@@ -533,7 +559,8 @@ export interface BindingViteResolvePluginConfig {
533
559
  environmentConsumer: string
534
560
  environmentName: string
535
561
  external: true | string[]
536
- noExternal: true | string[]
562
+ noExternal: true | Array<string | RegExp>
563
+ dedupe: Array<string>
537
564
  finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
538
565
  finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
539
566
  runtime: string
@@ -558,11 +585,24 @@ export interface BindingViteResolvePluginResolveOptions {
558
585
 
559
586
  export interface BindingWatchOption {
560
587
  skipWrite?: boolean
561
- notify?: BindingNotifyOption
562
588
  include?: Array<BindingStringOrRegex>
563
589
  exclude?: Array<BindingStringOrRegex>
564
590
  }
565
591
 
592
+ export interface CompilerAssumptions {
593
+ ignoreFunctionLength?: boolean
594
+ noDocumentAll?: boolean
595
+ objectRestNoSymbols?: boolean
596
+ pureGetters?: boolean
597
+ setPublicClassFields?: boolean
598
+ }
599
+
600
+ export interface ErrorLabel {
601
+ message?: string
602
+ start: number
603
+ end: number
604
+ }
605
+
566
606
  export interface Es2015Options {
567
607
  /** Transform arrow functions into function expressions. */
568
608
  arrowFunction?: ArrowFunctionsOptions
@@ -573,6 +613,32 @@ export interface ExtensionAliasItem {
573
613
  replacements: Array<string>
574
614
  }
575
615
 
616
+ export type HelperMode = /**
617
+ * Runtime mode (default): Helper functions are imported from a runtime package.
618
+ *
619
+ * Example:
620
+ *
621
+ * ```js
622
+ * import helperName from "@babel/runtime/helpers/helperName";
623
+ * helperName(...arguments);
624
+ * ```
625
+ */
626
+ 'Runtime'|
627
+ /**
628
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
629
+ *
630
+ * Example:
631
+ *
632
+ * ```js
633
+ * babelHelpers.helperName(...arguments);
634
+ * ```
635
+ */
636
+ 'External';
637
+
638
+ export interface Helpers {
639
+ mode?: HelperMode
640
+ }
641
+
576
642
  /** TypeScript Isolated Declarations for Standalone DTS Emit */
577
643
  export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
578
644
 
@@ -592,7 +658,7 @@ export interface IsolatedDeclarationsOptions {
592
658
  export interface IsolatedDeclarationsResult {
593
659
  code: string
594
660
  map?: SourceMap
595
- errors: Array<string>
661
+ errors: Array<OxcError>
596
662
  }
597
663
 
598
664
  export interface JsChangedOutputs {
@@ -602,8 +668,8 @@ export interface JsChangedOutputs {
602
668
  }
603
669
 
604
670
  export interface JsOutputAsset {
605
- name?: string
606
- originalFileName?: string
671
+ names: Array<string>
672
+ originalFileNames: Array<string>
607
673
  filename: string
608
674
  source: BindingAssetSource
609
675
  }
@@ -720,6 +786,13 @@ export interface JsxOptions {
720
786
  refresh?: boolean | ReactRefreshOptions
721
787
  }
722
788
 
789
+ export interface OxcError {
790
+ severity: Severity
791
+ message: string
792
+ labels: Array<ErrorLabel>
793
+ helpMessage?: string
794
+ }
795
+
723
796
  export interface PreRenderedChunk {
724
797
  name: string
725
798
  isEntry: boolean
@@ -760,6 +833,10 @@ export interface RenderedChunk {
760
833
  dynamicImports: Array<string>
761
834
  }
762
835
 
836
+ export type Severity = 'Error'|
837
+ 'Warning'|
838
+ 'Advice';
839
+
763
840
  export interface SourceMap {
764
841
  file?: string
765
842
  mappings: string
@@ -809,6 +886,8 @@ export interface TransformOptions {
809
886
  * @see {@link SourceMap}
810
887
  */
811
888
  sourcemap?: boolean
889
+ /** Set assumptions in order to produce smaller output. */
890
+ assumptions?: CompilerAssumptions
812
891
  /** Configure how TypeScript is transformed. */
813
892
  typescript?: TypeScriptOptions
814
893
  /** Configure how TSX and JSX are transformed. */
@@ -828,6 +907,8 @@ export interface TransformOptions {
828
907
  * @see [esbuild#target](https://esbuild.github.io/api/#target)
829
908
  */
830
909
  target?: string | Array<string>
910
+ /** Behaviour for runtime helpers. */
911
+ helpers?: Helpers
831
912
  /** Define Plugin */
832
913
  define?: Record<string, string>
833
914
  /** Inject Plugin */
@@ -864,6 +945,18 @@ export interface TransformResult {
864
945
  * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
865
946
  */
866
947
  declarationMap?: SourceMap
948
+ /**
949
+ * Helpers used.
950
+ *
951
+ * @internal
952
+ *
953
+ * Example:
954
+ *
955
+ * ```text
956
+ * { "_objectSpread": "@babel/runtime/helpers/objectSpread2" }
957
+ * ```
958
+ */
959
+ helpersUsed: Record<string, string>
867
960
  /**
868
961
  * Parse and transformation errors.
869
962
  *
@@ -871,7 +964,7 @@ export interface TransformResult {
871
964
  * transformed code may still be available even if there are errors in this
872
965
  * list.
873
966
  */
874
- errors: Array<string>
967
+ errors: Array<OxcError>
875
968
  }
876
969
 
877
970
  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;