rollup 4.0.0-9 → 4.0.0

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.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-9
4
- Sun, 20 Aug 2023 14:28:23 GMT - commit e4d55671a81334ddc59fdbcd81ceabdb77d96974
3
+ Rollup.js v4.0.0
4
+ Thu, 05 Oct 2023 15:13:44 GMT - commit 2f261358c62b4f9e62cb86bf99de8d4ff3668994
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -17,9 +17,9 @@ import require$$1 from 'stream';
17
17
  import require$$0$2 from 'path';
18
18
  import require$$2$1 from 'os';
19
19
  import require$$0$3 from 'events';
20
+ import './parseAst.js';
21
+ import '../../native.js';
20
22
  import 'node:perf_hooks';
21
- import 'node:crypto';
22
- import './native.cjs';
23
23
  import 'node:fs/promises';
24
24
  import 'tty';
25
25
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-9
4
- Sun, 20 Aug 2023 14:28:23 GMT - commit e4d55671a81334ddc59fdbcd81ceabdb77d96974
3
+ Rollup.js v4.0.0
4
+ Thu, 05 Oct 2023 15:13:44 GMT - commit 2f261358c62b4f9e62cb86bf99de8d4ff3668994
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-9
4
- Sun, 20 Aug 2023 14:28:23 GMT - commit e4d55671a81334ddc59fdbcd81ceabdb77d96974
3
+ Rollup.js v4.0.0
4
+ Thu, 05 Oct 2023 15:13:44 GMT - commit 2f261358c62b4f9e62cb86bf99de8d4ff3668994
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,12 +16,12 @@ require('node:path');
16
16
  require('node:process');
17
17
  require('node:url');
18
18
  require('./shared/rollup.js');
19
+ require('./shared/parseAst.js');
19
20
  const loadConfigFile_js = require('./shared/loadConfigFile.js');
20
21
  require('tty');
21
22
  require('path');
22
23
  require('node:perf_hooks');
23
- require('node:crypto');
24
- require('./native.cjs');
24
+ require('./native.js');
25
25
  require('./getLogFilter.js');
26
26
 
27
27
 
@@ -252,6 +252,7 @@ if (!nativeBinding) {
252
252
  throw new Error(`Failed to load native binding`)
253
253
  }
254
254
 
255
- const { parse } = nativeBinding
255
+ const { parse, xxhashBase64Url } = nativeBinding
256
256
 
257
257
  module.exports.parse = parse
258
+ module.exports.xxhashBase64Url = xxhashBase64Url
@@ -0,0 +1,3 @@
1
+ import type { ParseAst } from './rollup';
2
+
3
+ export const parseAst: ParseAst;
@@ -0,0 +1,21 @@
1
+ /*
2
+ @license
3
+ Rollup.js v4.0.0
4
+ Thu, 05 Oct 2023 15:13:44 GMT - commit 2f261358c62b4f9e62cb86bf99de8d4ff3668994
5
+
6
+ https://github.com/rollup/rollup
7
+
8
+ Released under the MIT License.
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13
+
14
+ require('./native.js');
15
+ const parseAst_js = require('./shared/parseAst.js');
16
+ require('node:path');
17
+
18
+
19
+
20
+ exports.parseAst = parseAst_js.parseAst;
21
+ //# sourceMappingURL=parseAst.js.map
package/dist/rollup.d.ts CHANGED
@@ -15,8 +15,6 @@ export interface RollupError extends RollupLog {
15
15
  watchFiles?: string[];
16
16
  }
17
17
 
18
- export type RollupWarning = RollupLog;
19
-
20
18
  export interface RollupLog {
21
19
  binding?: string;
22
20
  cause?: unknown;
@@ -93,20 +91,20 @@ export interface SourceMap {
93
91
  export type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
94
92
 
95
93
  interface ModuleOptions {
96
- assertions: Record<string, string>;
94
+ attributes: Record<string, string>;
97
95
  meta: CustomPluginOptions;
98
96
  moduleSideEffects: boolean | 'no-treeshake';
99
97
  syntheticNamedExports: boolean | string;
100
98
  }
101
99
 
102
100
  export interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
103
- ast?: AcornNode;
101
+ ast?: AstNode;
104
102
  code: string;
105
103
  map?: SourceMapInput;
106
104
  }
107
105
 
108
106
  export interface TransformModuleJSON {
109
- ast?: AcornNode;
107
+ ast?: AstNode;
110
108
  code: string;
111
109
  // note if plugins use new this.cache to opt-out auto transform cache
112
110
  customTransformCache: boolean;
@@ -117,7 +115,7 @@ export interface TransformModuleJSON {
117
115
  }
118
116
 
119
117
  export interface ModuleJSON extends TransformModuleJSON, ModuleOptions {
120
- ast: AcornNode;
118
+ ast: AstNode;
121
119
  dependencies: string[];
122
120
  id: string;
123
121
  resolvedIds: ResolvedIdMap;
@@ -164,6 +162,7 @@ export interface EmittedPrebuiltChunk {
164
162
  exports?: string[];
165
163
  fileName: string;
166
164
  map?: SourceMap;
165
+ sourcemapFileName?: string;
167
166
  type: 'prebuilt-chunk';
168
167
  }
169
168
 
@@ -172,7 +171,7 @@ export type EmittedFile = EmittedAsset | EmittedChunk | EmittedPrebuiltChunk;
172
171
  export type EmitFile = (emittedFile: EmittedFile) => string;
173
172
 
174
173
  interface ModuleInfo extends ModuleOptions {
175
- ast: AcornNode | null;
174
+ ast: AstNode | null;
176
175
  code: string | null;
177
176
  dynamicImporters: readonly string[];
178
177
  dynamicallyImportedIdResolutions: readonly ResolvedId[];
@@ -180,8 +179,6 @@ interface ModuleInfo extends ModuleOptions {
180
179
  exportedBindings: Record<string, string[]> | null;
181
180
  exports: string[] | null;
182
181
  hasDefaultExport: boolean | null;
183
- /** @deprecated Use `moduleSideEffects` instead */
184
- hasModuleSideEffects: boolean | 'no-treeshake';
185
182
  id: string;
186
183
  implicitlyLoadedAfterOneOf: readonly string[];
187
184
  implicitlyLoadedBefore: readonly string[];
@@ -204,6 +201,11 @@ type LoggingFunctionWithPosition = (
204
201
  pos?: number | { column: number; line: number }
205
202
  ) => void;
206
203
 
204
+ export type ParseAst = (
205
+ input: string,
206
+ options?: { allowReturnOutsideFunction?: boolean }
207
+ ) => AstNode;
208
+
207
209
  export interface PluginContext extends MinimalPluginContext {
208
210
  addWatchFile: (id: string) => void;
209
211
  cache: PluginCache;
@@ -218,15 +220,12 @@ export interface PluginContext extends MinimalPluginContext {
218
220
  load: (
219
221
  options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
220
222
  ) => Promise<ModuleInfo>;
221
- /** @deprecated Use `this.getModuleIds` instead */
222
- moduleIds: IterableIterator<string>;
223
- // TODO SWC remove acorn options from this.parse
224
- parse: (input: string, options?: any) => AcornNode;
223
+ parse: ParseAst;
225
224
  resolve: (
226
225
  source: string,
227
226
  importer?: string,
228
227
  options?: {
229
- assertions?: Record<string, string>;
228
+ attributes?: Record<string, string>;
230
229
  custom?: CustomPluginOptions;
231
230
  isEntry?: boolean;
232
231
  skipSelf?: boolean;
@@ -265,13 +264,13 @@ export type ResolveIdHook = (
265
264
  this: PluginContext,
266
265
  source: string,
267
266
  importer: string | undefined,
268
- options: { assertions: Record<string, string>; custom?: CustomPluginOptions; isEntry: boolean }
267
+ options: { attributes: Record<string, string>; custom?: CustomPluginOptions; isEntry: boolean }
269
268
  ) => ResolveIdResult;
270
269
 
271
270
  export type ShouldTransformCachedModuleHook = (
272
271
  this: PluginContext,
273
272
  options: {
274
- ast: AcornNode;
273
+ ast: AstNode;
275
274
  code: string;
276
275
  id: string;
277
276
  meta: CustomPluginOptions;
@@ -287,8 +286,6 @@ export type IsExternal = (
287
286
  isResolved: boolean
288
287
  ) => boolean;
289
288
 
290
- export type IsPureModule = (id: string) => boolean | NullValue;
291
-
292
289
  export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
293
290
 
294
291
  export type LoadResult = SourceDescription | string | NullValue;
@@ -323,9 +320,9 @@ export type RenderChunkHook = (
323
320
 
324
321
  export type ResolveDynamicImportHook = (
325
322
  this: PluginContext,
326
- specifier: string | AcornNode,
323
+ specifier: string | AstNode,
327
324
  importer: string,
328
- options: { assertions: Record<string, string> }
325
+ options: { attributes: Record<string, string> }
329
326
  ) => ResolveIdResult;
330
327
 
331
328
  export type ResolveImportMetaHook = (
@@ -370,7 +367,7 @@ export type WatchChangeHook = (
370
367
  * ```
371
368
  */
372
369
  // eslint-disable-next-line @typescript-eslint/ban-types
373
- export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
370
+ export type PluginImpl<O extends object = object, A = any> = (options?: O) => Plugin<A>;
374
371
 
375
372
  export interface OutputBundle {
376
373
  [fileName: string]: OutputAsset | OutputChunk;
@@ -498,12 +495,12 @@ export interface OutputPlugin
498
495
  version?: string;
499
496
  }
500
497
 
501
- export interface Plugin extends OutputPlugin, Partial<PluginHooks> {
498
+ export interface Plugin<A = any> extends OutputPlugin, Partial<PluginHooks> {
502
499
  // for inter-plugin communication
503
- api?: any;
500
+ api?: A;
504
501
  }
505
502
 
506
- type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
503
+ export type TreeshakingPreset = 'smallest' | 'safest' | 'recommended';
507
504
 
508
505
  export interface NormalizedTreeshakingOptions {
509
506
  annotations: boolean;
@@ -566,31 +563,21 @@ export type SourcemapIgnoreListOption = (
566
563
  export type InputPluginOption = MaybePromise<Plugin | NullValue | false | InputPluginOption[]>;
567
564
 
568
565
  export interface InputOptions {
569
- acorn?: Record<string, unknown>;
570
- acornInjectPlugins?: ((...arguments_: any[]) => unknown)[] | ((...arguments_: any[]) => unknown);
571
566
  cache?: boolean | RollupCache;
572
567
  context?: string;
573
568
  experimentalCacheExpiry?: number;
574
569
  experimentalLogSideEffects?: boolean;
575
570
  external?: ExternalOption;
576
- /** @deprecated Use the "inlineDynamicImports" output option instead. */
577
- inlineDynamicImports?: boolean;
578
571
  input?: InputOption;
579
572
  logLevel?: LogLevelOption;
580
573
  makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
581
- /** @deprecated Use the "manualChunks" output option instead. */
582
- manualChunks?: ManualChunksOption;
583
574
  maxParallelFileOps?: number;
584
- /** @deprecated Use the "maxParallelFileOps" option instead. */
585
- maxParallelFileReads?: number;
586
575
  moduleContext?: ((id: string) => string | NullValue) | { [id: string]: string };
587
576
  onLog?: LogHandlerWithDefault;
588
577
  onwarn?: WarningHandlerWithDefault;
589
578
  perf?: boolean;
590
579
  plugins?: InputPluginOption;
591
580
  preserveEntrySignatures?: PreserveEntrySignaturesOption;
592
- /** @deprecated Use the "preserveModules" output option instead. */
593
- preserveModules?: boolean;
594
581
  preserveSymlinks?: boolean;
595
582
  shimMissingExports?: boolean;
596
583
  strictDeprecations?: boolean;
@@ -603,31 +590,20 @@ export interface InputOptionsWithPlugins extends InputOptions {
603
590
  }
604
591
 
605
592
  export interface NormalizedInputOptions {
606
- acorn: Record<string, unknown>;
607
- acornInjectPlugins: (() => unknown)[];
608
593
  cache: false | undefined | RollupCache;
609
594
  context: string;
610
595
  experimentalCacheExpiry: number;
611
596
  experimentalLogSideEffects: boolean;
612
597
  external: IsExternal;
613
- /** @deprecated Use the "inlineDynamicImports" output option instead. */
614
- inlineDynamicImports: boolean | undefined;
615
598
  input: string[] | { [entryAlias: string]: string };
616
599
  logLevel: LogLevelOption;
617
600
  makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
618
- /** @deprecated Use the "manualChunks" output option instead. */
619
- manualChunks: ManualChunksOption | undefined;
620
601
  maxParallelFileOps: number;
621
- /** @deprecated Use the "maxParallelFileOps" option instead. */
622
- maxParallelFileReads: number;
623
602
  moduleContext: (id: string) => string;
624
603
  onLog: LogHandler;
625
- onwarn: (warning: RollupLog) => void;
626
604
  perf: boolean;
627
605
  plugins: Plugin[];
628
606
  preserveEntrySignatures: PreserveEntrySignaturesOption;
629
- /** @deprecated Use the "preserveModules" output option instead. */
630
- preserveModules: boolean | undefined;
631
607
  preserveSymlinks: boolean;
632
608
  shimMissingExports: boolean;
633
609
  strictDeprecations: boolean;
@@ -703,17 +679,15 @@ export interface OutputOptions {
703
679
  compact?: boolean;
704
680
  // only required for bundle.write
705
681
  dir?: string;
706
- /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
707
- dynamicImportFunction?: string;
708
682
  dynamicImportInCjs?: boolean;
709
683
  entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
710
684
  esModule?: boolean | 'if-default-prop';
711
- /** @deprecated This option is no longer needed and ignored. */
712
- experimentalDeepDynamicChunkOptimization?: boolean;
713
685
  experimentalMinChunkSize?: number;
714
686
  exports?: 'default' | 'named' | 'none' | 'auto';
715
687
  extend?: boolean;
688
+ /** @deprecated Use "externalImportAttributes" instead. */
716
689
  externalImportAssertions?: boolean;
690
+ externalImportAttributes?: boolean;
717
691
  externalLiveBindings?: boolean;
718
692
  // only required for bundle.write
719
693
  file?: string;
@@ -730,14 +704,10 @@ export interface OutputOptions {
730
704
  manualChunks?: ManualChunksOption;
731
705
  minifyInternalExports?: boolean;
732
706
  name?: string;
733
- /** @deprecated Use "generatedCode.symbols" instead. */
734
- namespaceToStringTag?: boolean;
735
707
  noConflict?: boolean;
736
708
  outro?: string | AddonFunction;
737
709
  paths?: OptionsPaths;
738
710
  plugins?: OutputPluginOption;
739
- /** @deprecated Use "generatedCode.constBindings" instead. */
740
- preferConst?: boolean;
741
711
  preserveModules?: boolean;
742
712
  preserveModulesRoot?: string;
743
713
  sanitizeFileName?: boolean | ((fileName: string) => string);
@@ -745,6 +715,7 @@ export interface OutputOptions {
745
715
  sourcemapBaseUrl?: string;
746
716
  sourcemapExcludeSources?: boolean;
747
717
  sourcemapFile?: string;
718
+ sourcemapFileNames?: string | ((chunkInfo: PreRenderedChunk) => string);
748
719
  sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption;
749
720
  sourcemapPathTransform?: SourcemapPathTransformOption;
750
721
  strict?: boolean;
@@ -759,17 +730,15 @@ export interface NormalizedOutputOptions {
759
730
  chunkFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
760
731
  compact: boolean;
761
732
  dir: string | undefined;
762
- /** @deprecated Use the "renderDynamicImport" plugin hook instead. */
763
- dynamicImportFunction: string | undefined;
764
733
  dynamicImportInCjs: boolean;
765
734
  entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string);
766
735
  esModule: boolean | 'if-default-prop';
767
- /** @deprecated This option is no longer needed and ignored. */
768
- experimentalDeepDynamicChunkOptimization: boolean;
769
736
  experimentalMinChunkSize: number;
770
737
  exports: 'default' | 'named' | 'none' | 'auto';
771
738
  extend: boolean;
739
+ /** @deprecated Use "externalImportAttributes" instead. */
772
740
  externalImportAssertions: boolean;
741
+ externalImportAttributes: boolean;
773
742
  externalLiveBindings: boolean;
774
743
  file: string | undefined;
775
744
  footer: AddonFunction;
@@ -785,14 +754,10 @@ export interface NormalizedOutputOptions {
785
754
  manualChunks: ManualChunksOption;
786
755
  minifyInternalExports: boolean;
787
756
  name: string | undefined;
788
- /** @deprecated Use "generatedCode.symbols" instead. */
789
- namespaceToStringTag: boolean;
790
757
  noConflict: boolean;
791
758
  outro: AddonFunction;
792
759
  paths: OptionsPaths;
793
760
  plugins: OutputPlugin[];
794
- /** @deprecated Use "generatedCode.constBindings" instead. */
795
- preferConst: boolean;
796
761
  preserveModules: boolean;
797
762
  preserveModulesRoot: string | undefined;
798
763
  sanitizeFileName: (fileName: string) => string;
@@ -800,6 +765,7 @@ export interface NormalizedOutputOptions {
800
765
  sourcemapBaseUrl: string | undefined;
801
766
  sourcemapExcludeSources: boolean;
802
767
  sourcemapFile: string | undefined;
768
+ sourcemapFileNames: string | ((chunkInfo: PreRenderedChunk) => string) | undefined;
803
769
  sourcemapIgnoreList: SourcemapIgnoreListOption;
804
770
  sourcemapPathTransform: SourcemapPathTransformOption | undefined;
805
771
  strict: boolean;
@@ -863,6 +829,7 @@ export interface RenderedChunk extends PreRenderedChunk {
863
829
  export interface OutputChunk extends RenderedChunk {
864
830
  code: string;
865
831
  map: SourceMap | null;
832
+ sourcemapFileName: string | null;
866
833
  preliminaryFileName: string;
867
834
  }
868
835
 
@@ -994,7 +961,7 @@ export type RollupWatcher = AwaitingEventEmitter<{
994
961
 
995
962
  export function watch(config: RollupWatchOptions | RollupWatchOptions[]): RollupWatcher;
996
963
 
997
- interface AcornNode {
964
+ interface AstNode {
998
965
  end: number;
999
966
  start: number;
1000
967
  type: string;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-9
4
- Sun, 20 Aug 2023 14:28:23 GMT - commit e4d55671a81334ddc59fdbcd81ceabdb77d96974
3
+ Rollup.js v4.0.0
4
+ Thu, 05 Oct 2023 15:13:44 GMT - commit 2f261358c62b4f9e62cb86bf99de8d4ff3668994
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -13,13 +13,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13
13
 
14
14
  const rollup = require('./shared/rollup.js');
15
15
  const watchProxy = require('./shared/watch-proxy.js');
16
+ require('./shared/parseAst.js');
17
+ require('./native.js');
18
+ require('node:path');
16
19
  require('node:process');
17
20
  require('tty');
18
- require('node:path');
19
21
  require('path');
20
22
  require('node:perf_hooks');
21
- require('node:crypto');
22
- require('./native.cjs');
23
23
  require('node:fs/promises');
24
24
  require('./shared/fsevents-importer.js');
25
25
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-9
4
- Sun, 20 Aug 2023 14:28:23 GMT - commit e4d55671a81334ddc59fdbcd81ceabdb77d96974
3
+ Rollup.js v4.0.0
4
+ Thu, 05 Oct 2023 15:13:44 GMT - commit 2f261358c62b4f9e62cb86bf99de8d4ff3668994
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.0.0-9
4
- Sun, 20 Aug 2023 14:28:23 GMT - commit e4d55671a81334ddc59fdbcd81ceabdb77d96974
3
+ Rollup.js v4.0.0
4
+ Thu, 05 Oct 2023 15:13:44 GMT - commit 2f261358c62b4f9e62cb86bf99de8d4ff3668994
5
5
 
6
6
  https://github.com/rollup/rollup
7
7