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/es/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
@@ -15,7 +15,7 @@ import { createHash as createHash$1 } from 'crypto';
15
15
  import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
16
16
  import { EventEmitter } from 'events';
17
17
 
18
- var version$1 = "2.65.0";
18
+ var version$1 = "2.66.0";
19
19
 
20
20
  var charToInteger = {};
21
21
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -1783,6 +1783,7 @@ class ExternalModule {
1783
1783
  get dynamicImporters() {
1784
1784
  return dynamicImporters.sort();
1785
1785
  },
1786
+ hasDefaultExport: null,
1786
1787
  hasModuleSideEffects,
1787
1788
  id,
1788
1789
  implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
@@ -12249,6 +12250,13 @@ class Module {
12249
12250
  get dynamicImporters() {
12250
12251
  return module.dynamicImporters.sort();
12251
12252
  },
12253
+ get hasDefaultExport() {
12254
+ // This information is only valid after parsing
12255
+ if (!module.ast) {
12256
+ return null;
12257
+ }
12258
+ return 'default' in module.exports || 'default' in module.reexportDescriptions;
12259
+ },
12252
12260
  hasModuleSideEffects,
12253
12261
  id,
12254
12262
  get implicitlyLoadedAfterOneOf() {
@@ -21954,6 +21962,7 @@ async function transform(source, module, pluginDriver, warn) {
21954
21962
  };
21955
21963
  }
21956
21964
 
21965
+ const RESOLVE_DEPENDENCIES = 'resolveDependencies';
21957
21966
  class ModuleLoader {
21958
21967
  constructor(graph, modulesById, options, pluginDriver) {
21959
21968
  this.graph = graph;
@@ -21967,7 +21976,7 @@ class ModuleLoader {
21967
21976
  this.modulesWithLoadedDependencies = new Set();
21968
21977
  this.nextEntryModuleIndex = 0;
21969
21978
  this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
21970
- return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
21979
+ return this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
21971
21980
  ? false
21972
21981
  : await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions, typeof isEntry === 'boolean' ? isEntry : !importer), importer, source));
21973
21982
  };
@@ -22026,23 +22035,9 @@ class ModuleLoader {
22026
22035
  return module;
22027
22036
  }
22028
22037
  async preloadModule(resolvedId) {
22029
- const module = await this.fetchModule(this.addDefaultsToResolvedId(resolvedId), undefined, false, true);
22038
+ const module = await this.fetchModule(this.getResolvedIdWithDefaults(resolvedId), undefined, false, resolvedId.resolveDependencies ? RESOLVE_DEPENDENCIES : true);
22030
22039
  return module.info;
22031
22040
  }
22032
- addDefaultsToResolvedId(resolvedId) {
22033
- var _a, _b;
22034
- if (!resolvedId) {
22035
- return null;
22036
- }
22037
- const external = resolvedId.external || false;
22038
- return {
22039
- external,
22040
- id: resolvedId.id,
22041
- meta: resolvedId.meta || {},
22042
- moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
22043
- syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
22044
- };
22045
- }
22046
22041
  addEntryWithImplicitDependants(unresolvedModule, implicitlyLoadedAfter) {
22047
22042
  return this.extendLoadModulesPromise(this.loadEntryModule(unresolvedModule.id, false, unresolvedModule.importer, null).then(async (entryModule) => {
22048
22043
  addChunkNamesToModule(entryModule, unresolvedModule, false);
@@ -22156,9 +22151,7 @@ class ModuleLoader {
22156
22151
  this.getResolveDynamicImportPromises(module),
22157
22152
  loadAndResolveDependenciesPromise
22158
22153
  ]);
22159
- const loadAndResolveDependenciesPromise = loadPromise
22160
- .then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
22161
- .then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info]));
22154
+ const loadAndResolveDependenciesPromise = waitForDependencyResolution(loadPromise).then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info]));
22162
22155
  loadAndResolveDependenciesPromise.catch(() => {
22163
22156
  /* avoid unhandled promise rejections */
22164
22157
  });
@@ -22167,6 +22160,9 @@ class ModuleLoader {
22167
22160
  if (!isPreload) {
22168
22161
  await this.fetchModuleDependencies(module, ...resolveDependencyPromises);
22169
22162
  }
22163
+ else if (isPreload === RESOLVE_DEPENDENCIES) {
22164
+ await loadAndResolveDependenciesPromise;
22165
+ }
22170
22166
  return module;
22171
22167
  }
22172
22168
  async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises, loadAndResolveDependenciesPromise) {
@@ -22266,10 +22262,26 @@ class ModuleLoader {
22266
22262
  this.handleResolveId(await this.resolveId(source, module.id, EMPTY_OBJECT, false), source, module.id))
22267
22263
  ]);
22268
22264
  }
22265
+ getResolvedIdWithDefaults(resolvedId) {
22266
+ var _a, _b;
22267
+ if (!resolvedId) {
22268
+ return null;
22269
+ }
22270
+ const external = resolvedId.external || false;
22271
+ return {
22272
+ external,
22273
+ id: resolvedId.id,
22274
+ meta: resolvedId.meta || {},
22275
+ moduleSideEffects: (_a = resolvedId.moduleSideEffects) !== null && _a !== void 0 ? _a : this.hasModuleSideEffects(resolvedId.id, !!external),
22276
+ syntheticNamedExports: (_b = resolvedId.syntheticNamedExports) !== null && _b !== void 0 ? _b : false
22277
+ };
22278
+ }
22269
22279
  async handleExistingModule(module, isEntry, isPreload) {
22270
22280
  const loadPromise = this.moduleLoadPromises.get(module);
22271
22281
  if (isPreload) {
22272
- return loadPromise;
22282
+ return isPreload === RESOLVE_DEPENDENCIES
22283
+ ? waitForDependencyResolution(loadPromise)
22284
+ : loadPromise;
22273
22285
  }
22274
22286
  if (isEntry) {
22275
22287
  module.info.isEntry = true;
@@ -22315,7 +22327,7 @@ class ModuleLoader {
22315
22327
  ? errEntryCannotBeExternal(unresolvedId)
22316
22328
  : errImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore));
22317
22329
  }
22318
- return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object'
22330
+ return this.fetchModule(this.getResolvedIdWithDefaults(typeof resolveIdResult === 'object'
22319
22331
  ? resolveIdResult
22320
22332
  : { id: resolveIdResult }), undefined, isEntry, false);
22321
22333
  }
@@ -22342,7 +22354,7 @@ class ModuleLoader {
22342
22354
  module.resolvedIds[specifier] ||
22343
22355
  this.handleResolveId(await this.resolveId(specifier, module.id, EMPTY_OBJECT, false), specifier, module.id));
22344
22356
  }
22345
- return this.handleResolveId(this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier)), specifier, importer);
22357
+ return this.handleResolveId(this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier)), specifier, importer);
22346
22358
  }
22347
22359
  }
22348
22360
  function normalizeRelativeExternalId(source, importer) {
@@ -22370,6 +22382,10 @@ function isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) {
22370
22382
  (makeAbsoluteExternalsRelative === 'ifRelativeSource' && isRelative(source)) ||
22371
22383
  !isAbsolute(id));
22372
22384
  }
22385
+ async function waitForDependencyResolution(loadPromise) {
22386
+ const [resolveStaticDependencyPromises, resolveDynamicImportPromises] = await loadPromise;
22387
+ return Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]);
22388
+ }
22373
22389
 
22374
22390
  class GlobalScope extends Scope$1 {
22375
22391
  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