rollup 3.2.1 → 3.2.3

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.
package/dist/bin/rollup CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v3.2.1
6
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
5
+ Rollup.js v3.2.3
6
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,7 +16,7 @@ import { promises } from 'node:fs';
16
16
  import { EventEmitter } from 'node:events';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version$1 = "3.2.1";
19
+ var version$1 = "3.2.3";
20
20
 
21
21
  var charToInteger = {};
22
22
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -10925,6 +10925,7 @@ class LogicalExpression extends NodeBase {
10925
10925
  }
10926
10926
 
10927
10927
  const FILE_PREFIX = 'ROLLUP_FILE_URL_';
10928
+ const IMPORT = 'import';
10928
10929
  class MetaProperty extends NodeBase {
10929
10930
  constructor() {
10930
10931
  super(...arguments);
@@ -10933,8 +10934,8 @@ class MetaProperty extends NodeBase {
10933
10934
  this.referenceId = null;
10934
10935
  }
10935
10936
  getReferencedFileName(outputPluginDriver) {
10936
- const { metaProperty } = this;
10937
- if (metaProperty?.startsWith(FILE_PREFIX)) {
10937
+ const { meta: { name }, metaProperty } = this;
10938
+ if (name === IMPORT && metaProperty?.startsWith(FILE_PREFIX)) {
10938
10939
  return outputPluginDriver.getFileName(metaProperty.slice(FILE_PREFIX.length));
10939
10940
  }
10940
10941
  return null;
@@ -10948,7 +10949,7 @@ class MetaProperty extends NodeBase {
10948
10949
  include() {
10949
10950
  if (!this.included) {
10950
10951
  this.included = true;
10951
- if (this.meta.name === 'import') {
10952
+ if (this.meta.name === IMPORT) {
10952
10953
  this.context.addImportMeta(this);
10953
10954
  const parent = this.parent;
10954
10955
  const metaProperty = (this.metaProperty =
@@ -10962,7 +10963,9 @@ class MetaProperty extends NodeBase {
10962
10963
  }
10963
10964
  }
10964
10965
  render(code, { format, pluginDriver, snippets }) {
10965
- const { context: { module: { id: moduleId } }, metaProperty, parent, preliminaryChunkId, referenceId, start, end } = this;
10966
+ const { context: { module: { id: moduleId } }, meta: { name }, metaProperty, parent, preliminaryChunkId, referenceId, start, end } = this;
10967
+ if (name !== IMPORT)
10968
+ return;
10966
10969
  const chunkId = preliminaryChunkId;
10967
10970
  if (referenceId) {
10968
10971
  const fileName = pluginDriver.getFileName(referenceId);
@@ -11198,8 +11201,13 @@ class Program extends NodeBase {
11198
11201
  }
11199
11202
  }
11200
11203
  render(code, options) {
11204
+ let start = this.start;
11205
+ if (code.original.startsWith('#!')) {
11206
+ start = Math.min(code.original.indexOf('\n') + 1, this.end);
11207
+ code.remove(0, start);
11208
+ }
11201
11209
  if (this.body.length > 0) {
11202
- renderStatementList(this.body, code, this.start, this.end, options);
11210
+ renderStatementList(this.body, code, start, this.end, options);
11203
11211
  }
11204
11212
  else {
11205
11213
  super.render(code, options);
@@ -12297,9 +12305,11 @@ class NamespaceVariable extends Variable {
12297
12305
  this.references.push(identifier);
12298
12306
  this.name = identifier.name;
12299
12307
  }
12300
- getLiteralValueAtPath() {
12301
- // This can only happen for Symbol.toStringTag right now
12302
- return 'Module';
12308
+ getLiteralValueAtPath(path) {
12309
+ if (path[0] === SymbolToStringTag) {
12310
+ return 'Module';
12311
+ }
12312
+ return UnknownValue;
12303
12313
  }
12304
12314
  getMemberVariables() {
12305
12315
  if (this.memberVariables) {
@@ -15024,9 +15034,7 @@ class Chunk {
15024
15034
  const map = module.getExportNamesByVariable();
15025
15035
  for (const exportedVariable of map.keys()) {
15026
15036
  const isSynthetic = exportedVariable instanceof SyntheticNamedExportVariable;
15027
- const importedVariable = isSynthetic
15028
- ? exportedVariable.getBaseVariable()
15029
- : exportedVariable;
15037
+ const importedVariable = isSynthetic ? exportedVariable.getBaseVariable() : exportedVariable;
15030
15038
  if (!(importedVariable instanceof NamespaceVariable && this.outputOptions.preserveModules)) {
15031
15039
  this.checkCircularDependencyImport(importedVariable, module);
15032
15040
  const exportingModule = importedVariable.module;
@@ -24767,9 +24775,7 @@ const getExternal = (config, overrides) => {
24767
24775
  ? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.includes(source)
24768
24776
  : [...ensureArray(configExternal), ...overrides.external];
24769
24777
  };
24770
- const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
24771
- ? warning => config.onwarn(warning, defaultOnWarnHandler)
24772
- : defaultOnWarnHandler;
24778
+ const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn ? warning => config.onwarn(warning, defaultOnWarnHandler) : defaultOnWarnHandler;
24773
24779
  const getObjectOption = (config, overrides, name, objectifyValue = objectifyOption) => {
24774
24780
  const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
24775
24781
  const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.d.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  export const VERSION: string;
2
2
 
3
- type FalsyValue = false | null | undefined;
3
+ // utils
4
+ type NullValue = null | undefined | void;
4
5
  type MaybeArray<T> = T | T[];
5
6
  type MaybePromise<T> = T | Promise<T>;
6
7
 
8
+ type PartialNull<T> = {
9
+ [P in keyof T]: T[P] | null;
10
+ };
11
+
7
12
  export interface RollupError extends RollupLog {
8
13
  name?: string;
9
14
  stack?: string;
@@ -82,10 +87,6 @@ export interface SourceMap {
82
87
 
83
88
  export type SourceMapInput = ExistingRawSourceMap | string | null | { mappings: '' };
84
89
 
85
- type PartialNull<T> = {
86
- [P in keyof T]: T[P] | null;
87
- };
88
-
89
90
  interface ModuleOptions {
90
91
  assertions: Record<string, string>;
91
92
  meta: CustomPluginOptions;
@@ -224,7 +225,7 @@ interface PartialResolvedId extends Partial<PartialNull<ModuleOptions>> {
224
225
  id: string;
225
226
  }
226
227
 
227
- export type ResolveIdResult = string | false | null | void | PartialResolvedId;
228
+ export type ResolveIdResult = string | NullValue | false | PartialResolvedId;
228
229
 
229
230
  export type ResolveIdHook = (
230
231
  this: PluginContext,
@@ -252,11 +253,11 @@ export type IsExternal = (
252
253
  isResolved: boolean
253
254
  ) => boolean;
254
255
 
255
- export type IsPureModule = (id: string) => boolean | null | void;
256
+ export type IsPureModule = (id: string) => boolean | NullValue;
256
257
 
257
258
  export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
258
259
 
259
- export type LoadResult = SourceDescription | string | null | void;
260
+ export type LoadResult = SourceDescription | string | NullValue;
260
261
 
261
262
  export type LoadHook = (this: PluginContext, id: string) => LoadResult;
262
263
 
@@ -264,7 +265,7 @@ export interface TransformPluginContext extends PluginContext {
264
265
  getCombinedSourcemap: () => SourceMap;
265
266
  }
266
267
 
267
- export type TransformResult = string | null | void | Partial<SourceDescription>;
268
+ export type TransformResult = string | NullValue | Partial<SourceDescription>;
268
269
 
269
270
  export type TransformHook = (
270
271
  this: TransformPluginContext,
@@ -280,7 +281,7 @@ export type RenderChunkHook = (
280
281
  chunk: RenderedChunk,
281
282
  options: NormalizedOutputOptions,
282
283
  meta: { chunks: Record<string, RenderedChunk> }
283
- ) => { code: string; map?: SourceMapInput } | string | null | undefined;
284
+ ) => { code: string; map?: SourceMapInput } | string | NullValue;
284
285
 
285
286
  export type ResolveDynamicImportHook = (
286
287
  this: PluginContext,
@@ -293,7 +294,7 @@ export type ResolveImportMetaHook = (
293
294
  this: PluginContext,
294
295
  property: string | null,
295
296
  options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
296
- ) => string | null | void;
297
+ ) => string | NullValue;
297
298
 
298
299
  export type ResolveFileUrlHook = (
299
300
  this: PluginContext,
@@ -305,7 +306,7 @@ export type ResolveFileUrlHook = (
305
306
  referenceId: string;
306
307
  relativePath: string;
307
308
  }
308
- ) => string | null | void;
309
+ ) => string | NullValue;
309
310
 
310
311
  export type AddonHookFunction = (
311
312
  this: PluginContext,
@@ -351,8 +352,8 @@ export interface FunctionPluginHooks {
351
352
  ) => void;
352
353
  load: LoadHook;
353
354
  moduleParsed: ModuleParsedHook;
354
- options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | null | void;
355
- outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | null | void;
355
+ options: (this: MinimalPluginContext, options: InputOptions) => InputOptions | NullValue;
356
+ outputOptions: (this: PluginContext, options: OutputOptions) => OutputOptions | NullValue;
356
357
  renderChunk: RenderChunkHook;
357
358
  renderDynamicImport: (
358
359
  this: PluginContext,
@@ -362,7 +363,7 @@ export interface FunctionPluginHooks {
362
363
  moduleId: string;
363
364
  targetModuleId: string | null;
364
365
  }
365
- ) => { left: string; right: string } | null | void;
366
+ ) => { left: string; right: string } | NullValue;
366
367
  renderError: (this: PluginContext, error?: Error) => void;
367
368
  renderStart: (
368
369
  this: PluginContext,
@@ -481,13 +482,13 @@ interface ManualChunkMeta {
481
482
  getModuleIds: () => IterableIterator<string>;
482
483
  getModuleInfo: GetModuleInfo;
483
484
  }
484
- export type GetManualChunk = (id: string, meta: ManualChunkMeta) => string | null | void;
485
+ export type GetManualChunk = (id: string, meta: ManualChunkMeta) => string | NullValue;
485
486
 
486
487
  export type ExternalOption =
487
488
  | (string | RegExp)[]
488
489
  | string
489
490
  | RegExp
490
- | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | null | void);
491
+ | ((source: string, importer: string | undefined, isResolved: boolean) => boolean | NullValue);
491
492
  export type PureModulesOption = boolean | string[] | IsPureModule;
492
493
  export type GlobalsOption = { [name: string]: string } | ((name: string) => string);
493
494
  export type InputOption = string | string[] | { [entryAlias: string]: string };
@@ -499,7 +500,7 @@ export type SourcemapPathTransformOption = (
499
500
  sourcemapPath: string
500
501
  ) => string;
501
502
 
502
- export type InputPluginOption = MaybePromise<Plugin | FalsyValue | InputPluginOption[]>;
503
+ export type InputPluginOption = MaybePromise<Plugin | NullValue | false | InputPluginOption[]>;
503
504
 
504
505
  export interface InputOptions {
505
506
  acorn?: Record<string, unknown>;
@@ -517,7 +518,7 @@ export interface InputOptions {
517
518
  maxParallelFileOps?: number;
518
519
  /** @deprecated Use the "maxParallelFileOps" option instead. */
519
520
  maxParallelFileReads?: number;
520
- moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
521
+ moduleContext?: ((id: string) => string | NullValue) | { [id: string]: string };
521
522
  onwarn?: WarningHandlerWithDefault;
522
523
  perf?: boolean;
523
524
  plugins?: InputPluginOption;
@@ -623,7 +624,7 @@ export type NormalizedAmdOptions = (
623
624
 
624
625
  type AddonFunction = (chunk: RenderedChunk) => string | Promise<string>;
625
626
 
626
- type OutputPluginOption = MaybePromise<OutputPlugin | FalsyValue | OutputPluginOption[]>;
627
+ type OutputPluginOption = MaybePromise<OutputPlugin | NullValue | false | OutputPluginOption[]>;
627
628
 
628
629
  export interface OutputOptions {
629
630
  amd?: AmdOptions;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
31
31
 
32
32
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
33
33
 
34
- var version$1 = "3.2.1";
34
+ var version$1 = "3.2.3";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -978,9 +978,7 @@ const getExternal = (config, overrides) => {
978
978
  ? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.includes(source)
979
979
  : [...ensureArray$1(configExternal), ...overrides.external];
980
980
  };
981
- const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
982
- ? warning => config.onwarn(warning, defaultOnWarnHandler)
983
- : defaultOnWarnHandler;
981
+ const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn ? warning => config.onwarn(warning, defaultOnWarnHandler) : defaultOnWarnHandler;
984
982
  const getObjectOption = (config, overrides, name, objectifyValue = objectifyOption) => {
985
983
  const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
986
984
  const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
@@ -11438,6 +11436,7 @@ class LogicalExpression extends NodeBase {
11438
11436
  }
11439
11437
 
11440
11438
  const FILE_PREFIX = 'ROLLUP_FILE_URL_';
11439
+ const IMPORT = 'import';
11441
11440
  class MetaProperty extends NodeBase {
11442
11441
  constructor() {
11443
11442
  super(...arguments);
@@ -11446,8 +11445,8 @@ class MetaProperty extends NodeBase {
11446
11445
  this.referenceId = null;
11447
11446
  }
11448
11447
  getReferencedFileName(outputPluginDriver) {
11449
- const { metaProperty } = this;
11450
- if (metaProperty?.startsWith(FILE_PREFIX)) {
11448
+ const { meta: { name }, metaProperty } = this;
11449
+ if (name === IMPORT && metaProperty?.startsWith(FILE_PREFIX)) {
11451
11450
  return outputPluginDriver.getFileName(metaProperty.slice(FILE_PREFIX.length));
11452
11451
  }
11453
11452
  return null;
@@ -11461,7 +11460,7 @@ class MetaProperty extends NodeBase {
11461
11460
  include() {
11462
11461
  if (!this.included) {
11463
11462
  this.included = true;
11464
- if (this.meta.name === 'import') {
11463
+ if (this.meta.name === IMPORT) {
11465
11464
  this.context.addImportMeta(this);
11466
11465
  const parent = this.parent;
11467
11466
  const metaProperty = (this.metaProperty =
@@ -11475,7 +11474,9 @@ class MetaProperty extends NodeBase {
11475
11474
  }
11476
11475
  }
11477
11476
  render(code, { format, pluginDriver, snippets }) {
11478
- const { context: { module: { id: moduleId } }, metaProperty, parent, preliminaryChunkId, referenceId, start, end } = this;
11477
+ const { context: { module: { id: moduleId } }, meta: { name }, metaProperty, parent, preliminaryChunkId, referenceId, start, end } = this;
11478
+ if (name !== IMPORT)
11479
+ return;
11479
11480
  const chunkId = preliminaryChunkId;
11480
11481
  if (referenceId) {
11481
11482
  const fileName = pluginDriver.getFileName(referenceId);
@@ -11711,8 +11712,13 @@ class Program extends NodeBase {
11711
11712
  }
11712
11713
  }
11713
11714
  render(code, options) {
11715
+ let start = this.start;
11716
+ if (code.original.startsWith('#!')) {
11717
+ start = Math.min(code.original.indexOf('\n') + 1, this.end);
11718
+ code.remove(0, start);
11719
+ }
11714
11720
  if (this.body.length > 0) {
11715
- renderStatementList(this.body, code, this.start, this.end, options);
11721
+ renderStatementList(this.body, code, start, this.end, options);
11716
11722
  }
11717
11723
  else {
11718
11724
  super.render(code, options);
@@ -12810,9 +12816,11 @@ class NamespaceVariable extends Variable {
12810
12816
  this.references.push(identifier);
12811
12817
  this.name = identifier.name;
12812
12818
  }
12813
- getLiteralValueAtPath() {
12814
- // This can only happen for Symbol.toStringTag right now
12815
- return 'Module';
12819
+ getLiteralValueAtPath(path) {
12820
+ if (path[0] === SymbolToStringTag) {
12821
+ return 'Module';
12822
+ }
12823
+ return UnknownValue;
12816
12824
  }
12817
12825
  getMemberVariables() {
12818
12826
  if (this.memberVariables) {
@@ -15537,9 +15545,7 @@ class Chunk {
15537
15545
  const map = module.getExportNamesByVariable();
15538
15546
  for (const exportedVariable of map.keys()) {
15539
15547
  const isSynthetic = exportedVariable instanceof SyntheticNamedExportVariable;
15540
- const importedVariable = isSynthetic
15541
- ? exportedVariable.getBaseVariable()
15542
- : exportedVariable;
15548
+ const importedVariable = isSynthetic ? exportedVariable.getBaseVariable() : exportedVariable;
15543
15549
  if (!(importedVariable instanceof NamespaceVariable && this.outputOptions.preserveModules)) {
15544
15550
  this.checkCircularDependencyImport(importedVariable, module);
15545
15551
  const exportingModule = importedVariable.module;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.2.1
4
- Sun, 16 Oct 2022 04:44:52 GMT - commit 46e1eaaaf05e0c2efa0ed395d7a3cfa99ef25fb5
3
+ Rollup.js v3.2.3
4
+ Tue, 18 Oct 2022 05:07:08 GMT - commit 4a89129c8f89436595faddde25704837de174d79
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",