rolldown 0.15.0 → 0.15.1

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 (54) 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-DEPa5yhI.mjs → src-BQ98i9JJ.mjs} +312 -225
  15. package/dist/shared/{src-COU7qQBJ.cjs → src-CkH9jtTi.cjs} +301 -208
  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 +107 -17
  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 +3 -3
  30. package/dist/types/log/logging.d.ts +6 -6
  31. package/dist/types/log/logs.d.ts +1 -0
  32. package/dist/types/options/input-options-schema.d.ts +3 -595
  33. package/dist/types/options/input-options.d.ts +16 -1
  34. package/dist/types/options/normalized-input-options.d.ts +1 -1
  35. package/dist/types/options/normalized-output-options.d.ts +21 -17
  36. package/dist/types/options/output-options-schema.d.ts +2 -146
  37. package/dist/types/options/output-options.d.ts +1 -0
  38. package/dist/types/plugin/minimal-plugin-context.d.ts +3 -3
  39. package/dist/types/plugin/plugin-context-data.d.ts +2 -1
  40. package/dist/types/plugin/plugin-context.d.ts +14 -10
  41. package/dist/types/plugin/transform-plugin-context.d.ts +7 -4
  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/module-info.d.ts +1 -0
  45. package/dist/types/types/rolldown-output.d.ts +6 -0
  46. package/dist/types/utils/bindingify-input-options.d.ts +1 -1
  47. package/dist/types/utils/create-bundler-option.d.ts +11 -0
  48. package/dist/types/utils/error.d.ts +2 -1
  49. package/dist/types/utils/misc.d.ts +1 -1
  50. package/dist/types/utils/transform-sourcemap.d.ts +1 -1
  51. package/dist/types/utils/zod-ext.d.ts +6 -5
  52. package/package.json +16 -16
  53. package/dist/types/cli/utils.d.ts +0 -6
  54. package/dist/types/log/locate-character/index.d.ts +0 -13
@@ -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
@@ -325,13 +340,19 @@ export interface BindingInputOptions {
325
340
  profilerNames?: boolean
326
341
  jsx?: JsxOptions
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
@@ -409,6 +430,7 @@ export interface BindingOutputOptions {
409
430
  minify?: boolean
410
431
  advancedChunks?: BindingAdvancedChunksOptions
411
432
  comments?: 'none' | 'preserve-legal'
433
+ polyfillRequire?: boolean
412
434
  }
413
435
 
414
436
  export interface BindingPluginContextResolvedId {
@@ -443,7 +465,7 @@ export interface BindingPluginOptions {
443
465
  transformFilter?: BindingTransformHookFilter
444
466
  moduleParsed?: (ctx: BindingPluginContext, module: BindingModuleInfo) => MaybePromise<VoidNullable>
445
467
  moduleParsedMeta?: BindingPluginHookMeta
446
- buildEnd?: (ctx: BindingPluginContext, error?: BindingHookError) => MaybePromise<VoidNullable>
468
+ buildEnd?: (ctx: BindingPluginContext, error?: (Error | BindingError)[]) => MaybePromise<VoidNullable>
447
469
  buildEndMeta?: BindingPluginHookMeta
448
470
  renderChunk?: (ctx: BindingPluginContext, code: string, chunk: RenderedChunk, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<BindingHookRenderChunkOutput>>
449
471
  renderChunkMeta?: BindingPluginHookMeta
@@ -451,7 +473,7 @@ export interface BindingPluginOptions {
451
473
  augmentChunkHashMeta?: BindingPluginHookMeta
452
474
  renderStart?: (ctx: BindingPluginContext, opts: BindingNormalizedOptions) => void
453
475
  renderStartMeta?: BindingPluginHookMeta
454
- renderError?: (ctx: BindingPluginContext, error: string) => void
476
+ renderError?: (ctx: BindingPluginContext, error: (Error | BindingError)[]) => void
455
477
  renderErrorMeta?: BindingPluginHookMeta
456
478
  generateBundle?: (ctx: BindingPluginContext, bundle: BindingOutputs, isWrite: boolean, opts: BindingNormalizedOptions) => MaybePromise<VoidNullable<JsChangedOutputs>>
457
479
  generateBundleMeta?: BindingPluginHookMeta
@@ -524,11 +546,12 @@ export interface BindingTransformPluginConfig {
524
546
  exclude?: Array<BindingStringOrRegex>
525
547
  jsxInject?: string
526
548
  reactRefresh?: boolean
527
- targets?: string
549
+ target?: string
550
+ browserslist?: string
528
551
  }
529
552
 
530
553
  export interface BindingTreeshake {
531
- moduleSideEffects: boolean | BindingModuleSideEffectsRule[]
554
+ moduleSideEffects: boolean | BindingModuleSideEffectsRule[] | ((id: string, is_external: boolean) => boolean | undefined)
532
555
  annotations?: boolean
533
556
  }
534
557
 
@@ -537,7 +560,8 @@ export interface BindingViteResolvePluginConfig {
537
560
  environmentConsumer: string
538
561
  environmentName: string
539
562
  external: true | string[]
540
- noExternal: true | string[]
563
+ noExternal: true | Array<string | RegExp>
564
+ dedupe: Array<string>
541
565
  finalizeBareSpecifier?: (resolvedId: string, rawId: string, importer: string | null | undefined) => VoidNullable<string>
542
566
  finalizeOtherSpecifiers?: (resolvedId: string, rawId: string) => VoidNullable<string>
543
567
  runtime: string
@@ -562,11 +586,24 @@ export interface BindingViteResolvePluginResolveOptions {
562
586
 
563
587
  export interface BindingWatchOption {
564
588
  skipWrite?: boolean
565
- notify?: BindingNotifyOption
566
589
  include?: Array<BindingStringOrRegex>
567
590
  exclude?: Array<BindingStringOrRegex>
568
591
  }
569
592
 
593
+ export interface CompilerAssumptions {
594
+ ignoreFunctionLength?: boolean
595
+ noDocumentAll?: boolean
596
+ objectRestNoSymbols?: boolean
597
+ pureGetters?: boolean
598
+ setPublicClassFields?: boolean
599
+ }
600
+
601
+ export interface ErrorLabel {
602
+ message?: string
603
+ start: number
604
+ end: number
605
+ }
606
+
570
607
  export interface Es2015Options {
571
608
  /** Transform arrow functions into function expressions. */
572
609
  arrowFunction?: ArrowFunctionsOptions
@@ -577,6 +614,32 @@ export interface ExtensionAliasItem {
577
614
  replacements: Array<string>
578
615
  }
579
616
 
617
+ export type HelperMode = /**
618
+ * Runtime mode (default): Helper functions are imported from a runtime package.
619
+ *
620
+ * Example:
621
+ *
622
+ * ```js
623
+ * import helperName from "@babel/runtime/helpers/helperName";
624
+ * helperName(...arguments);
625
+ * ```
626
+ */
627
+ 'Runtime'|
628
+ /**
629
+ * External mode: Helper functions are accessed from a global `babelHelpers` object.
630
+ *
631
+ * Example:
632
+ *
633
+ * ```js
634
+ * babelHelpers.helperName(...arguments);
635
+ * ```
636
+ */
637
+ 'External';
638
+
639
+ export interface Helpers {
640
+ mode?: HelperMode
641
+ }
642
+
580
643
  /** TypeScript Isolated Declarations for Standalone DTS Emit */
581
644
  export declare function isolatedDeclaration(filename: string, sourceText: string, options?: IsolatedDeclarationsOptions | undefined | null): IsolatedDeclarationsResult
582
645
 
@@ -596,7 +659,7 @@ export interface IsolatedDeclarationsOptions {
596
659
  export interface IsolatedDeclarationsResult {
597
660
  code: string
598
661
  map?: SourceMap
599
- errors: Array<string>
662
+ errors: Array<OxcError>
600
663
  }
601
664
 
602
665
  export interface JsChangedOutputs {
@@ -606,8 +669,8 @@ export interface JsChangedOutputs {
606
669
  }
607
670
 
608
671
  export interface JsOutputAsset {
609
- name?: string
610
- originalFileName?: string
672
+ names: Array<string>
673
+ originalFileNames: Array<string>
611
674
  filename: string
612
675
  source: BindingAssetSource
613
676
  }
@@ -724,6 +787,13 @@ export interface JsxOptions {
724
787
  refresh?: boolean | ReactRefreshOptions
725
788
  }
726
789
 
790
+ export interface OxcError {
791
+ severity: Severity
792
+ message: string
793
+ labels: Array<ErrorLabel>
794
+ helpMessage?: string
795
+ }
796
+
727
797
  export interface PreRenderedChunk {
728
798
  name: string
729
799
  isEntry: boolean
@@ -764,6 +834,10 @@ export interface RenderedChunk {
764
834
  dynamicImports: Array<string>
765
835
  }
766
836
 
837
+ export type Severity = 'Error'|
838
+ 'Warning'|
839
+ 'Advice';
840
+
767
841
  export interface SourceMap {
768
842
  file?: string
769
843
  mappings: string
@@ -813,6 +887,8 @@ export interface TransformOptions {
813
887
  * @see {@link SourceMap}
814
888
  */
815
889
  sourcemap?: boolean
890
+ /** Set assumptions in order to produce smaller output. */
891
+ assumptions?: CompilerAssumptions
816
892
  /** Configure how TypeScript is transformed. */
817
893
  typescript?: TypeScriptOptions
818
894
  /** Configure how TSX and JSX are transformed. */
@@ -832,6 +908,8 @@ export interface TransformOptions {
832
908
  * @see [esbuild#target](https://esbuild.github.io/api/#target)
833
909
  */
834
910
  target?: string | Array<string>
911
+ /** Behaviour for runtime helpers. */
912
+ helpers?: Helpers
835
913
  /** Define Plugin */
836
914
  define?: Record<string, string>
837
915
  /** Inject Plugin */
@@ -868,6 +946,18 @@ export interface TransformResult {
868
946
  * {@link TransformOptions#sourcemap sourcemap} are set to `true`.
869
947
  */
870
948
  declarationMap?: SourceMap
949
+ /**
950
+ * Helpers used.
951
+ *
952
+ * @internal
953
+ *
954
+ * Example:
955
+ *
956
+ * ```text
957
+ * { "_objectSpread": "@babel/runtime/helpers/objectSpread2" }
958
+ * ```
959
+ */
960
+ helpersUsed: Record<string, string>
871
961
  /**
872
962
  * Parse and transformation errors.
873
963
  *
@@ -875,7 +965,7 @@ export interface TransformResult {
875
965
  * transformed code may still be available even if there are errors in this
876
966
  * list.
877
967
  */
878
- errors: Array<string>
968
+ errors: Array<OxcError>
879
969
  }
880
970
 
881
971
  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;