rollup 2.65.0 → 2.66.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.
package/dist/rollup.d.ts CHANGED
@@ -162,6 +162,7 @@ interface ModuleInfo {
162
162
  dynamicImporters: readonly string[];
163
163
  dynamicallyImportedIdResolutions: readonly ResolvedId[];
164
164
  dynamicallyImportedIds: readonly string[];
165
+ hasDefaultExport: boolean | null;
165
166
  hasModuleSideEffects: boolean | 'no-treeshake';
166
167
  id: string;
167
168
  implicitlyLoadedAfterOneOf: readonly string[];
@@ -201,7 +202,9 @@ export interface PluginContext extends MinimalPluginContext {
201
202
  getWatchFiles: () => string[];
202
203
  /** @deprecated Use `this.resolve` instead */
203
204
  isExternal: IsExternal;
204
- load: (options: { id: string } & Partial<PartialNull<ModuleOptions>>) => Promise<ModuleInfo>;
205
+ load: (
206
+ options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
207
+ ) => Promise<ModuleInfo>;
205
208
  /** @deprecated Use `this.getModuleIds` instead */
206
209
  moduleIds: IterableIterator<string>;
207
210
  parse: (input: string, options?: any) => AcornNode;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.65.0
4
- Fri, 21 Jan 2022 07:42:35 GMT - commit bebc50ddb613d240a03988d51787fd71b1a3914f
3
+ Rollup.js v2.66.0
4
+ Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.65.0
4
- Fri, 21 Jan 2022 07:42:35 GMT - commit bebc50ddb613d240a03988d51787fd71b1a3914f
3
+ Rollup.js v2.66.0
4
+ Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.65.0
4
- Fri, 21 Jan 2022 07:42:35 GMT - commit bebc50ddb613d240a03988d51787fd71b1a3914f
3
+ Rollup.js v2.66.0
4
+ Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.65.0
4
- Fri, 21 Jan 2022 07:42:35 GMT - commit bebc50ddb613d240a03988d51787fd71b1a3914f
3
+ Rollup.js v2.66.0
4
+ Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.65.0
4
- Fri, 21 Jan 2022 07:42:35 GMT - commit bebc50ddb613d240a03988d51787fd71b1a3914f
3
+ Rollup.js v2.66.0
4
+ Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -28,7 +28,7 @@ function _interopNamespaceDefault(e) {
28
28
  return n;
29
29
  }
30
30
 
31
- var version$1 = "2.65.0";
31
+ var version$1 = "2.66.0";
32
32
 
33
33
  function ensureArray$1(items) {
34
34
  if (Array.isArray(items)) {
@@ -2349,6 +2349,7 @@ class ExternalModule {
2349
2349
  get dynamicImporters() {
2350
2350
  return dynamicImporters.sort();
2351
2351
  },
2352
+ hasDefaultExport: null,
2352
2353
  hasModuleSideEffects,
2353
2354
  id,
2354
2355
  implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
@@ -12379,6 +12380,13 @@ class Module {
12379
12380
  get dynamicImporters() {
12380
12381
  return module.dynamicImporters.sort();
12381
12382
  },
12383
+ get hasDefaultExport() {
12384
+ // This information is only valid after parsing
12385
+ if (!module.ast) {
12386
+ return null;
12387
+ }
12388
+ return 'default' in module.exports || 'default' in module.reexportDescriptions;
12389
+ },
12382
12390
  hasModuleSideEffects,
12383
12391
  id,
12384
12392
  get implicitlyLoadedAfterOneOf() {
@@ -22084,6 +22092,7 @@ async function transform(source, module, pluginDriver, warn) {
22084
22092
  };
22085
22093
  }
22086
22094
 
22095
+ const RESOLVE_DEPENDENCIES = 'resolveDependencies';
22087
22096
  class ModuleLoader {
22088
22097
  constructor(graph, modulesById, options, pluginDriver) {
22089
22098
  this.graph = graph;
@@ -22097,7 +22106,7 @@ class ModuleLoader {
22097
22106
  this.modulesWithLoadedDependencies = new Set();
22098
22107
  this.nextEntryModuleIndex = 0;
22099
22108
  this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
22100
- return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
22109
+ return this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
22101
22110
  ? false
22102
22111
  : await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions, typeof isEntry === 'boolean' ? isEntry : !importer), importer, source));
22103
22112
  };
@@ -22156,23 +22165,9 @@ class ModuleLoader {
22156
22165
  return module;
22157
22166
  }
22158
22167
  async preloadModule(resolvedId) {
22159
- const module = await this.fetchModule(this.addDefaultsToResolvedId(resolvedId), undefined, false, true);
22168
+ const module = await this.fetchModule(this.getResolvedIdWithDefaults(resolvedId), undefined, false, resolvedId.resolveDependencies ? RESOLVE_DEPENDENCIES : true);
22160
22169
  return module.info;
22161
22170
  }
22162
- addDefaultsToResolvedId(resolvedId) {
22163
- var _a, _b;
22164
- if (!resolvedId) {
22165
- return null;
22166
- }
22167
- const external = resolvedId.external || false;
22168
- return {
22169
- external,
22170
- id: resolvedId.id,
22171
- meta: resolvedId.meta || {},
22172
- moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
22173
- syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
22174
- };
22175
- }
22176
22171
  addEntryWithImplicitDependants(unresolvedModule, implicitlyLoadedAfter) {
22177
22172
  return this.extendLoadModulesPromise(this.loadEntryModule(unresolvedModule.id, false, unresolvedModule.importer, null).then(async (entryModule) => {
22178
22173
  addChunkNamesToModule(entryModule, unresolvedModule, false);
@@ -22286,9 +22281,7 @@ class ModuleLoader {
22286
22281
  this.getResolveDynamicImportPromises(module),
22287
22282
  loadAndResolveDependenciesPromise
22288
22283
  ]);
22289
- const loadAndResolveDependenciesPromise = loadPromise
22290
- .then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
22291
- .then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info]));
22284
+ const loadAndResolveDependenciesPromise = waitForDependencyResolution(loadPromise).then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info]));
22292
22285
  loadAndResolveDependenciesPromise.catch(() => {
22293
22286
  /* avoid unhandled promise rejections */
22294
22287
  });
@@ -22297,6 +22290,9 @@ class ModuleLoader {
22297
22290
  if (!isPreload) {
22298
22291
  await this.fetchModuleDependencies(module, ...resolveDependencyPromises);
22299
22292
  }
22293
+ else if (isPreload === RESOLVE_DEPENDENCIES) {
22294
+ await loadAndResolveDependenciesPromise;
22295
+ }
22300
22296
  return module;
22301
22297
  }
22302
22298
  async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises, loadAndResolveDependenciesPromise) {
@@ -22396,10 +22392,26 @@ class ModuleLoader {
22396
22392
  this.handleResolveId(await this.resolveId(source, module.id, EMPTY_OBJECT, false), source, module.id))
22397
22393
  ]);
22398
22394
  }
22395
+ getResolvedIdWithDefaults(resolvedId) {
22396
+ var _a, _b;
22397
+ if (!resolvedId) {
22398
+ return null;
22399
+ }
22400
+ const external = resolvedId.external || false;
22401
+ return {
22402
+ external,
22403
+ id: resolvedId.id,
22404
+ meta: resolvedId.meta || {},
22405
+ moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
22406
+ syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
22407
+ };
22408
+ }
22399
22409
  async handleExistingModule(module, isEntry, isPreload) {
22400
22410
  const loadPromise = this.moduleLoadPromises.get(module);
22401
22411
  if (isPreload) {
22402
- return loadPromise;
22412
+ return isPreload === RESOLVE_DEPENDENCIES
22413
+ ? waitForDependencyResolution(loadPromise)
22414
+ : loadPromise;
22403
22415
  }
22404
22416
  if (isEntry) {
22405
22417
  module.info.isEntry = true;
@@ -22445,7 +22457,7 @@ class ModuleLoader {
22445
22457
  ? errEntryCannotBeExternal(unresolvedId)
22446
22458
  : errImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore));
22447
22459
  }
22448
- return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object'
22460
+ return this.fetchModule(this.getResolvedIdWithDefaults(typeof resolveIdResult === 'object'
22449
22461
  ? resolveIdResult
22450
22462
  : { id: resolveIdResult }), undefined, isEntry, false);
22451
22463
  }
@@ -22472,7 +22484,7 @@ class ModuleLoader {
22472
22484
  module.resolvedIds[specifier] ||
22473
22485
  this.handleResolveId(await this.resolveId(specifier, module.id, EMPTY_OBJECT, false), specifier, module.id));
22474
22486
  }
22475
- return this.handleResolveId(this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier)), specifier, importer);
22487
+ return this.handleResolveId(this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier)), specifier, importer);
22476
22488
  }
22477
22489
  }
22478
22490
  function normalizeRelativeExternalId(source, importer) {
@@ -22500,6 +22512,10 @@ function isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) {
22500
22512
  (makeAbsoluteExternalsRelative === 'ifRelativeSource' && isRelative(source)) ||
22501
22513
  !isAbsolute(id));
22502
22514
  }
22515
+ async function waitForDependencyResolution(loadPromise) {
22516
+ const [resolveStaticDependencyPromises, resolveDynamicImportPromises] = await loadPromise;
22517
+ return Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]);
22518
+ }
22503
22519
 
22504
22520
  class GlobalScope extends Scope$1 {
22505
22521
  constructor() {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.65.0
4
- Fri, 21 Jan 2022 07:42:35 GMT - commit bebc50ddb613d240a03988d51787fd71b1a3914f
3
+ Rollup.js v2.66.0
4
+ Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.65.0
4
- Fri, 21 Jan 2022 07:42:35 GMT - commit bebc50ddb613d240a03988d51787fd71b1a3914f
3
+ Rollup.js v2.66.0
4
+ Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.65.0",
3
+ "version": "2.66.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -64,7 +64,7 @@
64
64
  "@rollup/plugin-json": "^4.1.0",
65
65
  "@rollup/plugin-node-resolve": "^13.1.3",
66
66
  "@rollup/plugin-replace": "^3.0.1",
67
- "@rollup/plugin-typescript": "^8.2.5",
67
+ "@rollup/plugin-typescript": "^8.3.0",
68
68
  "@rollup/pluginutils": "^4.1.2",
69
69
  "@types/node": "^10.17.60",
70
70
  "@types/signal-exit": "^3.0.1",
@@ -100,7 +100,7 @@
100
100
  "pretty-bytes": "^5.6.0",
101
101
  "pretty-ms": "^7.0.1",
102
102
  "requirejs": "^2.3.6",
103
- "rollup": "^2.64.0",
103
+ "rollup": "^2.65.0",
104
104
  "rollup-plugin-license": "^2.6.1",
105
105
  "rollup-plugin-string": "^3.0.0",
106
106
  "rollup-plugin-terser": "^7.0.2",
@@ -111,7 +111,7 @@
111
111
  "source-map": "^0.7.3",
112
112
  "source-map-support": "^0.5.21",
113
113
  "sourcemap-codec": "^1.4.8",
114
- "systemjs": "^6.11.0",
114
+ "systemjs": "^6.12.1",
115
115
  "terser": "^5.10.0",
116
116
  "tslib": "^2.3.1",
117
117
  "typescript": "^4.5.5",