@rollup/browser 4.23.0 → 4.24.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.
@@ -220,7 +220,7 @@ type LoggingFunctionWithPosition = (
220
220
 
221
221
  export type ParseAst = (
222
222
  input: string,
223
- options?: { allowReturnOutsideFunction?: boolean }
223
+ options?: { allowReturnOutsideFunction?: boolean; jsx?: boolean }
224
224
  ) => ProgramNode;
225
225
 
226
226
  // declare AbortSignal here for environments without DOM lib or @types/node
@@ -231,7 +231,7 @@ declare global {
231
231
 
232
232
  export type ParseAstAsync = (
233
233
  input: string,
234
- options?: { allowReturnOutsideFunction?: boolean; signal?: AbortSignal }
234
+ options?: { allowReturnOutsideFunction?: boolean; jsx?: boolean; signal?: AbortSignal }
235
235
  ) => Promise<ProgramNode>;
236
236
 
237
237
  export interface PluginContext extends MinimalPluginContext {
@@ -523,6 +523,38 @@ export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
523
523
  api?: A;
524
524
  }
525
525
 
526
+ export type JsxPreset = 'react' | 'react-jsx' | 'preserve' | 'preserve-react';
527
+
528
+ export type NormalizedJsxOptions =
529
+ | NormalizedJsxPreserveOptions
530
+ | NormalizedJsxClassicOptions
531
+ | NormalizedJsxAutomaticOptions;
532
+
533
+ interface NormalizedJsxPreserveOptions {
534
+ factory: string | null;
535
+ fragment: string | null;
536
+ importSource: string | null;
537
+ mode: 'preserve';
538
+ }
539
+
540
+ interface NormalizedJsxClassicOptions {
541
+ factory: string;
542
+ fragment: string;
543
+ importSource: string | null;
544
+ mode: 'classic';
545
+ }
546
+
547
+ interface NormalizedJsxAutomaticOptions {
548
+ factory: string;
549
+ importSource: string | null;
550
+ jsxImportSource: string;
551
+ mode: 'automatic';
552
+ }
553
+
554
+ export type JsxOptions = Partial<NormalizedJsxOptions> & {
555
+ preset?: JsxPreset;
556
+ };
557
+
526
558
  export type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
527
559
 
528
560
  export interface NormalizedTreeshakingOptions {
@@ -545,6 +577,7 @@ interface ManualChunkMeta {
545
577
  getModuleIds: () => IterableIterator<string>;
546
578
  getModuleInfo: GetModuleInfo;
547
579
  }
580
+
548
581
  export type GetManualChunk = (id: string, meta: ManualChunkMeta) => string | NullValue;
549
582
 
550
583
  export type ExternalOption =
@@ -592,6 +625,7 @@ export interface InputOptions {
592
625
  experimentalLogSideEffects?: boolean;
593
626
  external?: ExternalOption;
594
627
  input?: InputOption;
628
+ jsx?: false | JsxPreset | JsxOptions;
595
629
  logLevel?: LogLevelOption;
596
630
  makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
597
631
  maxParallelFileOps?: number;
@@ -619,6 +653,7 @@ export interface NormalizedInputOptions {
619
653
  experimentalLogSideEffects: boolean;
620
654
  external: IsExternal;
621
655
  input: string[] | Record<string, string>;
656
+ jsx: false | NormalizedJsxOptions;
622
657
  logLevel: LogLevelOption;
623
658
  makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
624
659
  maxParallelFileOps: number;