rollup 2.63.0 → 2.64.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 v2.63.0
4
- Tue, 04 Jan 2022 07:30:25 GMT - commit ae674c9edde5efb8ce6d8ef845598a805938178c
3
+ Rollup.js v2.64.0
4
+ Fri, 14 Jan 2022 14:02:32 GMT - commit 82a3e2634a9d51b5040752e4fb2fd264651d504e
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -10,10 +10,12 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
- const path$2 = require('path');
13
+ const require$$0 = require('path');
14
+ const process$1 = require('process');
15
+ const perf_hooks = require('perf_hooks');
14
16
  const crypto = require('crypto');
15
17
  const fs = require('fs');
16
- const require$$0 = require('events');
18
+ const require$$0$1 = require('events');
17
19
 
18
20
  function _interopNamespaceDefault(e) {
19
21
  const n = Object.create(null);
@@ -26,7 +28,7 @@ function _interopNamespaceDefault(e) {
26
28
  return n;
27
29
  }
28
30
 
29
- var version$1 = "2.63.0";
31
+ var version$1 = "2.64.0";
30
32
 
31
33
  function ensureArray$1(items) {
32
34
  if (Array.isArray(items)) {
@@ -140,13 +142,13 @@ function normalize(path) {
140
142
  }
141
143
 
142
144
  function getAliasName(id) {
143
- const base = path$2.basename(id);
144
- return base.substr(0, base.length - path$2.extname(id).length);
145
+ const base = require$$0.basename(id);
146
+ return base.substr(0, base.length - require$$0.extname(id).length);
145
147
  }
146
148
  function relativeId(id) {
147
149
  if (!isAbsolute(id))
148
150
  return id;
149
- return path$2.relative(path$2.resolve(), id);
151
+ return require$$0.relative(require$$0.resolve(), id);
150
152
  }
151
153
  function isPathFragment(name) {
152
154
  // starting with "/", "./", "../", "C:/"
@@ -2375,7 +2377,7 @@ class ExternalModule {
2375
2377
  typeof options.paths === 'function' ? options.paths(this.id) : options.paths[this.id];
2376
2378
  if (!this.renderPath) {
2377
2379
  this.renderPath = this.renormalizeRenderPath
2378
- ? normalize(path$2.relative(inputBase, this.id))
2380
+ ? normalize(require$$0.relative(inputBase, this.id))
2379
2381
  : this.id;
2380
2382
  }
2381
2383
  return this.renderPath;
@@ -2418,7 +2420,7 @@ class ExternalModule {
2418
2420
 
2419
2421
  var utils$3 = {};
2420
2422
 
2421
- const path$1 = path$2;
2423
+ const path$1 = require$$0;
2422
2424
  const WIN_SLASH = '\\\\/';
2423
2425
  const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
2424
2426
 
@@ -2598,7 +2600,7 @@ var constants$2 = {
2598
2600
 
2599
2601
  (function (exports) {
2600
2602
 
2601
- const path = path$2;
2603
+ const path = require$$0;
2602
2604
  const win32 = process.platform === 'win32';
2603
2605
  const {
2604
2606
  REGEX_BACKSLASH,
@@ -4128,7 +4130,7 @@ parse$1.fastpaths = (input, options) => {
4128
4130
 
4129
4131
  var parse_1 = parse$1;
4130
4132
 
4131
- const path = path$2;
4133
+ const path = require$$0;
4132
4134
  const scan = scan_1;
4133
4135
  const parse = parse_1;
4134
4136
  const utils = utils$3;
@@ -4521,22 +4523,22 @@ function ensureArray(thing) {
4521
4523
  }
4522
4524
 
4523
4525
  const normalizePath = function normalizePath(filename) {
4524
- return filename.split(path$2.win32.sep).join(path$2.posix.sep);
4526
+ return filename.split(require$$0.win32.sep).join(require$$0.posix.sep);
4525
4527
  };
4526
4528
 
4527
4529
  function getMatcherString(id, resolutionBase) {
4528
- if (resolutionBase === false || path$2.isAbsolute(id) || id.startsWith('*')) {
4530
+ if (resolutionBase === false || require$$0.isAbsolute(id) || id.startsWith('*')) {
4529
4531
  return id;
4530
4532
  }
4531
4533
  // resolve('') is valid and will default to process.cwd()
4532
- const basePath = normalizePath(path$2.resolve(resolutionBase || ''))
4534
+ const basePath = normalizePath(require$$0.resolve(resolutionBase || ''))
4533
4535
  // escape all possible (posix + win) path characters that might interfere with regex
4534
4536
  .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
4535
4537
  // Note that we use posix.join because:
4536
4538
  // 1. the basePath has been normalized to use /
4537
4539
  // 2. the incoming glob (id) matcher, also uses /
4538
4540
  // otherwise Node will force backslash (\) on windows
4539
- return path$2.posix.join(basePath, id);
4541
+ return require$$0.posix.join(basePath, id);
4540
4542
  }
4541
4543
  const createFilter = function createFilter(include, exclude, options) {
4542
4544
  const resolutionBase = options && options.resolve;
@@ -10901,7 +10903,7 @@ class MetaProperty extends NodeBase {
10901
10903
  chunkReferenceId = metaProperty.substr(CHUNK_PREFIX.length);
10902
10904
  fileName = outputPluginDriver.getFileName(chunkReferenceId);
10903
10905
  }
10904
- const relativePath = normalize(path$2.relative(path$2.dirname(chunkId), fileName));
10906
+ const relativePath = normalize(require$$0.relative(require$$0.dirname(chunkId), fileName));
10905
10907
  let replacement;
10906
10908
  if (assetReferenceId !== null) {
10907
10909
  replacement = outputPluginDriver.hookFirstSync('resolveAssetUrl', [
@@ -12143,24 +12145,7 @@ function getOriginalLocation(sourcemapChain, location) {
12143
12145
  }
12144
12146
 
12145
12147
  const NOOP = () => { };
12146
- let getStartTime = () => [0, 0];
12147
- let getElapsedTime = () => 0;
12148
- let getMemory = () => 0;
12149
- let timers = {};
12150
- const normalizeHrTime = (time) => time[0] * 1e3 + time[1] / 1e6;
12151
- function setTimeHelpers() {
12152
- if (typeof process !== 'undefined' && typeof process.hrtime === 'function') {
12153
- getStartTime = process.hrtime.bind(process);
12154
- getElapsedTime = previous => normalizeHrTime(process.hrtime(previous));
12155
- }
12156
- else if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
12157
- getStartTime = () => [performance.now(), 0];
12158
- getElapsedTime = previous => performance.now() - previous[0];
12159
- }
12160
- if (typeof process !== 'undefined' && typeof process.memoryUsage === 'function') {
12161
- getMemory = () => process.memoryUsage().heapUsed;
12162
- }
12163
- }
12148
+ let timers = new Map();
12164
12149
  function getPersistedLabel(label, level) {
12165
12150
  switch (level) {
12166
12151
  case 1:
@@ -12175,46 +12160,47 @@ function getPersistedLabel(label, level) {
12175
12160
  }
12176
12161
  function timeStartImpl(label, level = 3) {
12177
12162
  label = getPersistedLabel(label, level);
12178
- if (!timers.hasOwnProperty(label)) {
12179
- timers[label] = {
12163
+ const startMemory = process$1.memoryUsage().heapUsed;
12164
+ const startTime = perf_hooks.performance.now();
12165
+ const timer = timers.get(label);
12166
+ if (timer === undefined) {
12167
+ timers.set(label, {
12180
12168
  memory: 0,
12181
- startMemory: undefined,
12182
- startTime: undefined,
12169
+ startMemory,
12170
+ startTime,
12183
12171
  time: 0,
12184
12172
  totalMemory: 0
12185
- };
12173
+ });
12174
+ }
12175
+ else {
12176
+ timer.startMemory = startMemory;
12177
+ timer.startTime = startTime;
12186
12178
  }
12187
- const currentMemory = getMemory();
12188
- timers[label].startTime = getStartTime();
12189
- timers[label].startMemory = currentMemory;
12190
12179
  }
12191
12180
  function timeEndImpl(label, level = 3) {
12192
12181
  label = getPersistedLabel(label, level);
12193
- if (timers.hasOwnProperty(label)) {
12194
- const currentMemory = getMemory();
12195
- timers[label].time += getElapsedTime(timers[label].startTime);
12196
- timers[label].totalMemory = Math.max(timers[label].totalMemory, currentMemory);
12197
- timers[label].memory += currentMemory - timers[label].startMemory;
12182
+ const timer = timers.get(label);
12183
+ if (timer !== undefined) {
12184
+ const currentMemory = process$1.memoryUsage().heapUsed;
12185
+ timer.memory += currentMemory - timer.startMemory;
12186
+ timer.time += perf_hooks.performance.now() - timer.startTime;
12187
+ timer.totalMemory = Math.max(timer.totalMemory, currentMemory);
12198
12188
  }
12199
12189
  }
12200
12190
  function getTimings() {
12201
12191
  const newTimings = {};
12202
- for (const [label, { time, memory, totalMemory }] of Object.entries(timers)) {
12192
+ for (const [label, { memory, time, totalMemory }] of timers) {
12203
12193
  newTimings[label] = [time, memory, totalMemory];
12204
12194
  }
12205
12195
  return newTimings;
12206
12196
  }
12207
- let timeStart = NOOP, timeEnd = NOOP;
12208
- const TIMED_PLUGIN_HOOKS = {
12209
- load: true,
12210
- resolveDynamicImport: true,
12211
- resolveId: true,
12212
- transform: true
12213
- };
12197
+ let timeStart = NOOP;
12198
+ let timeEnd = NOOP;
12199
+ const TIMED_PLUGIN_HOOKS = ['load', 'resolveDynamicImport', 'resolveId', 'transform'];
12214
12200
  function getPluginWithTimers(plugin, index) {
12215
12201
  const timedPlugin = {};
12216
- for (const hook of Object.keys(plugin)) {
12217
- if (TIMED_PLUGIN_HOOKS[hook] === true) {
12202
+ for (const hook of TIMED_PLUGIN_HOOKS) {
12203
+ if (hook in plugin) {
12218
12204
  let timerLabel = `plugin ${index}`;
12219
12205
  if (plugin.name) {
12220
12206
  timerLabel += ` (${plugin.name})`;
@@ -12222,11 +12208,11 @@ function getPluginWithTimers(plugin, index) {
12222
12208
  timerLabel += ` - ${hook}`;
12223
12209
  timedPlugin[hook] = function (...args) {
12224
12210
  timeStart(timerLabel, 4);
12225
- let result = plugin[hook].apply(this === timedPlugin ? plugin : this, args);
12211
+ const result = plugin[hook](...args);
12226
12212
  timeEnd(timerLabel, 4);
12227
12213
  if (result && typeof result.then === 'function') {
12228
12214
  timeStart(`${timerLabel} (async)`, 4);
12229
- result = result.then((hookResult) => {
12215
+ return result.then((hookResult) => {
12230
12216
  timeEnd(`${timerLabel} (async)`, 4);
12231
12217
  return hookResult;
12232
12218
  });
@@ -12234,16 +12220,15 @@ function getPluginWithTimers(plugin, index) {
12234
12220
  return result;
12235
12221
  };
12236
12222
  }
12237
- else {
12238
- timedPlugin[hook] = plugin[hook];
12239
- }
12240
12223
  }
12241
- return timedPlugin;
12224
+ return {
12225
+ ...plugin,
12226
+ ...timedPlugin
12227
+ };
12242
12228
  }
12243
12229
  function initialiseTimers(inputOptions) {
12244
12230
  if (inputOptions.perf) {
12245
- timers = {};
12246
- setTimeHelpers();
12231
+ timers = new Map();
12247
12232
  timeStart = timeStartImpl;
12248
12233
  timeEnd = timeEndImpl;
12249
12234
  inputOptions.plugins = inputOptions.plugins.map(getPluginWithTimers);
@@ -12406,13 +12391,13 @@ class Module {
12406
12391
  }
12407
12392
  return module.isIncluded();
12408
12393
  },
12409
- meta,
12394
+ meta: { ...meta },
12410
12395
  syntheticNamedExports
12411
12396
  };
12412
12397
  }
12413
12398
  basename() {
12414
- const base = path$2.basename(this.id);
12415
- const ext = path$2.extname(this.id);
12399
+ const base = require$$0.basename(this.id);
12400
+ const ext = require$$0.extname(this.id);
12416
12401
  return makeLegal(ext ? base.slice(0, -ext.length) : base);
12417
12402
  }
12418
12403
  bindReferences() {
@@ -12427,7 +12412,7 @@ class Module {
12427
12412
  return this.allExportNames;
12428
12413
  }
12429
12414
  const allExportNames = (this.allExportNames = new Set());
12430
- for (const name of Object.keys(this.exports)) {
12415
+ for (const name of this.getExports()) {
12431
12416
  allExportNames.add(name);
12432
12417
  }
12433
12418
  for (const name of Object.keys(this.reexportDescriptions)) {
@@ -12451,12 +12436,11 @@ class Module {
12451
12436
  const relevantDependencies = new Set();
12452
12437
  const necessaryDependencies = new Set();
12453
12438
  const alwaysCheckedDependencies = new Set();
12454
- let dependencyVariables = this.imports.keys();
12439
+ const dependencyVariables = new Set(this.imports);
12455
12440
  if (this.info.isEntry ||
12456
12441
  this.includedDynamicImporters.length > 0 ||
12457
12442
  this.namespace.included ||
12458
12443
  this.implicitlyLoadedAfter.size > 0) {
12459
- dependencyVariables = new Set(dependencyVariables);
12460
12444
  for (const exportName of [...this.getReexports(), ...this.getExports()]) {
12461
12445
  const exportedVariable = this.getVariableForExportName(exportName);
12462
12446
  if (exportedVariable) {
@@ -12929,11 +12913,7 @@ class Module {
12929
12913
  for (const specifier of node.specifiers) {
12930
12914
  const isDefault = specifier.type === ImportDefaultSpecifier$1;
12931
12915
  const isNamespace = specifier.type === ImportNamespaceSpecifier$1;
12932
- const name = isDefault
12933
- ? 'default'
12934
- : isNamespace
12935
- ? '*'
12936
- : specifier.imported.name;
12916
+ const name = isDefault ? 'default' : isNamespace ? '*' : specifier.imported.name;
12937
12917
  this.importDescriptions[specifier.local.name] = {
12938
12918
  module: null,
12939
12919
  name,
@@ -13080,7 +13060,7 @@ class Module {
13080
13060
  variable.include();
13081
13061
  this.graph.needsTreeshakingPass = true;
13082
13062
  const variableModule = variable.module;
13083
- if (variableModule && variableModule instanceof Module) {
13063
+ if (variableModule instanceof Module) {
13084
13064
  if (!variableModule.isExecuted) {
13085
13065
  markModuleAndImpureDependenciesAsExecuted(variableModule);
13086
13066
  }
@@ -14030,9 +14010,9 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
14030
14010
  else {
14031
14011
  const sources = originalSourcemap.sources;
14032
14012
  const sourcesContent = originalSourcemap.sourcesContent || [];
14033
- const directory = path$2.dirname(id) || '.';
14013
+ const directory = require$$0.dirname(id) || '.';
14034
14014
  const sourceRoot = originalSourcemap.sourceRoot || '.';
14035
- const baseSources = sources.map((source, i) => new Source(path$2.resolve(directory, sourceRoot, source), sourcesContent[i]));
14015
+ const baseSources = sources.map((source, i) => new Source(require$$0.resolve(directory, sourceRoot, source), sourcesContent[i]));
14036
14016
  source = new Link(originalSourcemap, baseSources);
14037
14017
  }
14038
14018
  return sourcemapChain.reduce(linkMap, source);
@@ -14048,9 +14028,9 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
14048
14028
  source = bundleSourcemapChain.reduce(linkMap, source);
14049
14029
  let { sources, sourcesContent, names, mappings } = source.traceMappings();
14050
14030
  if (file) {
14051
- const directory = path$2.dirname(file);
14052
- sources = sources.map((source) => path$2.relative(directory, source));
14053
- file = path$2.basename(file);
14031
+ const directory = require$$0.dirname(file);
14032
+ sources = sources.map((source) => require$$0.relative(directory, source));
14033
+ file = require$$0.basename(file);
14054
14034
  }
14055
14035
  sourcesContent = (excludeContent ? null : sourcesContent);
14056
14036
  return new SourceMap({ file, mappings, names, sources, sourcesContent });
@@ -14382,7 +14362,7 @@ function makeUnique(name, existingNames) {
14382
14362
  const existingNamesLowercase = new Set(Object.keys(existingNames).map(key => key.toLowerCase()));
14383
14363
  if (!existingNamesLowercase.has(name.toLocaleLowerCase()))
14384
14364
  return name;
14385
- const ext = path$2.extname(name);
14365
+ const ext = require$$0.extname(name);
14386
14366
  name = name.substr(0, name.length - ext.length);
14387
14367
  let uniqueName, uniqueIndex = 1;
14388
14368
  while (existingNamesLowercase.has((uniqueName = name + ++uniqueIndex + ext).toLowerCase()))
@@ -14438,6 +14418,7 @@ class Chunk {
14438
14418
  this.implicitlyLoadedBefore = new Set();
14439
14419
  this.imports = new Set();
14440
14420
  this.indentString = undefined;
14421
+ // This may only be updated in the constructor
14441
14422
  this.isEmpty = true;
14442
14423
  this.name = null;
14443
14424
  this.renderedDependencies = null;
@@ -14623,7 +14604,7 @@ class Chunk {
14623
14604
  }), existingNames);
14624
14605
  }
14625
14606
  generateIdPreserveModules(preserveModulesRelativeDir, options, existingNames, unsetOptions) {
14626
- const id = this.orderedModules[0].id;
14607
+ const [{ id }] = this.orderedModules;
14627
14608
  const sanitizedId = this.outputOptions.sanitizeFileName(id);
14628
14609
  let path;
14629
14610
  const patternOpt = unsetOptions.has('entryFileNames')
@@ -14631,8 +14612,8 @@ class Chunk {
14631
14612
  : options.entryFileNames;
14632
14613
  const pattern = typeof patternOpt === 'function' ? patternOpt(this.getChunkInfo()) : patternOpt;
14633
14614
  if (isAbsolute(id)) {
14634
- const currentDir = path$2.dirname(sanitizedId);
14635
- const extension = path$2.extname(id);
14615
+ const currentDir = require$$0.dirname(sanitizedId);
14616
+ const extension = require$$0.extname(id);
14636
14617
  const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
14637
14618
  assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
14638
14619
  ext: () => extension.substr(1),
@@ -14650,7 +14631,7 @@ class Chunk {
14650
14631
  }
14651
14632
  }
14652
14633
  else {
14653
- const extension = path$2.extname(sanitizedId);
14634
+ const extension = require$$0.extname(sanitizedId);
14654
14635
  const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
14655
14636
  assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension),
14656
14637
  ext: () => extension.substr(1),
@@ -14903,11 +14884,11 @@ class Chunk {
14903
14884
  timeStart('sourcemap', 2);
14904
14885
  let file;
14905
14886
  if (options.file)
14906
- file = path$2.resolve(options.sourcemapFile || options.file);
14887
+ file = require$$0.resolve(options.sourcemapFile || options.file);
14907
14888
  else if (options.dir)
14908
- file = path$2.resolve(options.dir, this.id);
14889
+ file = require$$0.resolve(options.dir, this.id);
14909
14890
  else
14910
- file = path$2.resolve(this.id);
14891
+ file = require$$0.resolve(this.id);
14911
14892
  const decodedMap = magicString.generateDecodedMap({});
14912
14893
  map = collapseSourcemaps(file, decodedMap, this.usedModules, chunkSourcemapChain, options.sourcemapExcludeSources, this.inputOptions.onwarn);
14913
14894
  map.sources = map.sources
@@ -15272,14 +15253,14 @@ class Chunk {
15272
15253
  return referencedFiles;
15273
15254
  }
15274
15255
  getRelativePath(targetPath, stripJsExtension) {
15275
- let relativePath = normalize(relative(path$2.dirname(this.id), targetPath));
15256
+ let relativePath = normalize(relative(require$$0.dirname(this.id), targetPath));
15276
15257
  if (stripJsExtension && relativePath.endsWith('.js')) {
15277
15258
  relativePath = relativePath.slice(0, -3);
15278
15259
  }
15279
15260
  if (relativePath === '..')
15280
- return '../../' + path$2.basename(targetPath);
15261
+ return '../../' + require$$0.basename(targetPath);
15281
15262
  if (relativePath === '')
15282
- return '../' + path$2.basename(targetPath);
15263
+ return '../' + require$$0.basename(targetPath);
15283
15264
  return relativePath.startsWith('../') ? relativePath : './' + relativePath;
15284
15265
  }
15285
15266
  inlineChunkDependencies(chunk) {
@@ -15428,8 +15409,8 @@ function generateAssetFileName(name, source, outputOptions, bundle) {
15428
15409
  return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
15429
15410
  ? outputOptions.assetFileNames({ name, source, type: 'asset' })
15430
15411
  : outputOptions.assetFileNames, 'output.assetFileNames', {
15431
- ext: () => path$2.extname(emittedName).substr(1),
15432
- extname: () => path$2.extname(emittedName),
15412
+ ext: () => require$$0.extname(emittedName).substr(1),
15413
+ extname: () => require$$0.extname(emittedName),
15433
15414
  hash() {
15434
15415
  const hash = createHash();
15435
15416
  hash.update(emittedName);
@@ -15437,7 +15418,7 @@ function generateAssetFileName(name, source, outputOptions, bundle) {
15437
15418
  hash.update(source);
15438
15419
  return hash.digest('hex').substr(0, 8);
15439
15420
  },
15440
- name: () => emittedName.substr(0, emittedName.length - path$2.extname(emittedName).length)
15421
+ name: () => emittedName.substr(0, emittedName.length - require$$0.extname(emittedName).length)
15441
15422
  }), bundle);
15442
15423
  }
15443
15424
  function reserveFileNameInBundle(fileName, bundle, warn) {
@@ -15829,7 +15810,7 @@ function commondir(files) {
15829
15810
  if (files.length === 0)
15830
15811
  return '/';
15831
15812
  if (files.length === 1)
15832
- return path$2.dirname(files[0]);
15813
+ return require$$0.dirname(files[0]);
15833
15814
  const commonSegments = files.slice(1).reduce((commonSegments, file) => {
15834
15815
  const pathSegements = file.split(/\/+|\\+/);
15835
15816
  let i;
@@ -16049,7 +16030,7 @@ class Bundle {
16049
16030
  const chunksForNaming = entryChunks.concat(otherChunks);
16050
16031
  for (const chunk of chunksForNaming) {
16051
16032
  if (this.outputOptions.file) {
16052
- chunk.id = path$2.basename(this.outputOptions.file);
16033
+ chunk.id = require$$0.basename(this.outputOptions.file);
16053
16034
  }
16054
16035
  else if (this.outputOptions.preserveModules) {
16055
16036
  chunk.id = chunk.generateIdPreserveModules(inputBase, this.outputOptions, bundle, this.unsetOptions);
@@ -21702,7 +21683,7 @@ Parser.acorn = {
21702
21683
 
21703
21684
  const readFile = (file) => new Promise((fulfil, reject) => fs.readFile(file, 'utf-8', (err, contents) => (err ? reject(err) : fulfil(contents))));
21704
21685
  function mkdirpath(path) {
21705
- const dir = path$2.dirname(path);
21686
+ const dir = require$$0.dirname(path);
21706
21687
  fs.mkdirSync(dir, { recursive: true });
21707
21688
  }
21708
21689
  function writeFile(dest, data) {
@@ -21720,9 +21701,9 @@ function writeFile(dest, data) {
21720
21701
  }
21721
21702
 
21722
21703
  class Queue {
21723
- constructor(maxParallel = 1) {
21704
+ constructor(maxParallel) {
21724
21705
  this.maxParallel = maxParallel;
21725
- this.queue = new Array();
21706
+ this.queue = [];
21726
21707
  this.workerCount = 0;
21727
21708
  }
21728
21709
  run(task) {
@@ -21782,7 +21763,7 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
21782
21763
  // absolute path is created. Absolute importees therefore shortcircuit the
21783
21764
  // resolve call and require no special handing on our part.
21784
21765
  // See https://nodejs.org/api/path.html#path_path_resolve_paths
21785
- return addJsExtensionIfNecessary(importer ? path$2.resolve(path$2.dirname(importer), source) : path$2.resolve(source), preserveSymlinks);
21766
+ return addJsExtensionIfNecessary(importer ? require$$0.resolve(require$$0.dirname(importer), source) : require$$0.resolve(source), preserveSymlinks);
21786
21767
  }
21787
21768
  function addJsExtensionIfNecessary(file, preserveSymlinks) {
21788
21769
  let found = findFile(file, preserveSymlinks);
@@ -21801,8 +21782,8 @@ function findFile(file, preserveSymlinks) {
21801
21782
  return findFile(fs.realpathSync(file), preserveSymlinks);
21802
21783
  if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
21803
21784
  // check case
21804
- const name = path$2.basename(file);
21805
- const files = fs.readdirSync(path$2.dirname(file));
21785
+ const name = require$$0.basename(file);
21786
+ const files = fs.readdirSync(require$$0.dirname(file));
21806
21787
  if (files.indexOf(name) !== -1)
21807
21788
  return file;
21808
21789
  }
@@ -22053,7 +22034,6 @@ async function transform(source, module, pluginDriver, warn) {
22053
22034
  ast,
22054
22035
  code,
22055
22036
  customTransformCache,
22056
- meta: module.info.meta,
22057
22037
  originalCode,
22058
22038
  originalSourcemap,
22059
22039
  sourcemapChain,
@@ -22073,7 +22053,6 @@ class ModuleLoader {
22073
22053
  this.moduleLoadPromises = new Map();
22074
22054
  this.modulesWithLoadedDependencies = new Set();
22075
22055
  this.nextEntryModuleIndex = 0;
22076
- this.readQueue = new Queue();
22077
22056
  this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
22078
22057
  return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
22079
22058
  ? false
@@ -22082,7 +22061,7 @@ class ModuleLoader {
22082
22061
  this.hasModuleSideEffects = options.treeshake
22083
22062
  ? options.treeshake.moduleSideEffects
22084
22063
  : () => true;
22085
- this.readQueue.maxParallel = options.maxParallelFileReads;
22064
+ this.readQueue = new Queue(options.maxParallelFileReads);
22086
22065
  }
22087
22066
  async addAdditionalModules(unresolvedModules) {
22088
22067
  const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
@@ -22133,8 +22112,9 @@ class ModuleLoader {
22133
22112
  }
22134
22113
  return module;
22135
22114
  }
22136
- preloadModule(resolvedId) {
22137
- return this.fetchModule(this.addDefaultsToResolvedId(resolvedId), undefined, false, true).then(module => module.info);
22115
+ async preloadModule(resolvedId) {
22116
+ const module = await this.fetchModule(this.addDefaultsToResolvedId(resolvedId), undefined, false, true);
22117
+ return module.info;
22138
22118
  }
22139
22119
  addDefaultsToResolvedId(resolvedId) {
22140
22120
  var _a, _b;
@@ -22184,13 +22164,23 @@ class ModuleLoader {
22184
22164
  timeEnd('load modules', 3);
22185
22165
  const sourceDescription = typeof source === 'string'
22186
22166
  ? { code: source }
22187
- : typeof source === 'object' && typeof source.code === 'string'
22167
+ : source != null && typeof source === 'object' && typeof source.code === 'string'
22188
22168
  ? source
22189
22169
  : error(errBadLoader(id));
22190
22170
  const cachedModule = this.graph.cachedModules.get(id);
22191
22171
  if (cachedModule &&
22192
22172
  !cachedModule.customTransformCache &&
22193
- cachedModule.originalCode === sourceDescription.code) {
22173
+ cachedModule.originalCode === sourceDescription.code &&
22174
+ !(await this.pluginDriver.hookFirst('shouldTransformCachedModule', [
22175
+ {
22176
+ ast: cachedModule.ast,
22177
+ code: cachedModule.code,
22178
+ id: cachedModule.id,
22179
+ meta: cachedModule.meta,
22180
+ moduleSideEffects: cachedModule.moduleSideEffects,
22181
+ syntheticNamedExports: cachedModule.syntheticNamedExports
22182
+ }
22183
+ ]))) {
22194
22184
  if (cachedModule.transformFiles) {
22195
22185
  for (const emittedFile of cachedModule.transformFiles)
22196
22186
  this.pluginDriver.emitFile(emittedFile);
@@ -22445,8 +22435,8 @@ class ModuleLoader {
22445
22435
  function normalizeRelativeExternalId(source, importer) {
22446
22436
  return isRelative(source)
22447
22437
  ? importer
22448
- ? path$2.resolve(importer, '..', source)
22449
- : path$2.resolve(source)
22438
+ ? require$$0.resolve(importer, '..', source)
22439
+ : require$$0.resolve(source)
22450
22440
  : source;
22451
22441
  }
22452
22442
  function addChunkNamesToModule(module, { fileName, name }, isUserDefined) {
@@ -22626,6 +22616,7 @@ const inputHookNames = {
22626
22616
  options: 1,
22627
22617
  resolveDynamicImport: 1,
22628
22618
  resolveId: 1,
22619
+ shouldTransformCachedModule: 1,
22629
22620
  transform: 1,
22630
22621
  watchChange: 1
22631
22622
  };
@@ -23170,7 +23161,7 @@ const getModuleContext = (config, context) => {
23170
23161
  if (configModuleContext) {
23171
23162
  const contextByModuleId = Object.create(null);
23172
23163
  for (const [key, moduleContext] of Object.entries(configModuleContext)) {
23173
- contextByModuleId[path$2.resolve(key)] = moduleContext;
23164
+ contextByModuleId[require$$0.resolve(key)] = moduleContext;
23174
23165
  }
23175
23166
  return id => contextByModuleId[id] || context;
23176
23167
  }
@@ -23376,7 +23367,7 @@ const getPreserveModulesRoot = (config) => {
23376
23367
  if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
23377
23368
  return undefined;
23378
23369
  }
23379
- return path$2.resolve(preserveModulesRoot);
23370
+ return require$$0.resolve(preserveModulesRoot);
23380
23371
  };
23381
23372
  const getAmd = (config) => {
23382
23373
  const mergedOption = {
@@ -23648,7 +23639,7 @@ function getSortingFileType(file) {
23648
23639
  return SortingFileType.SECONDARY_CHUNK;
23649
23640
  }
23650
23641
  function writeOutputFile(outputFile, outputOptions) {
23651
- const fileName = path$2.resolve(outputOptions.dir || path$2.dirname(outputOptions.file), outputFile.fileName);
23642
+ const fileName = require$$0.resolve(outputOptions.dir || require$$0.dirname(outputOptions.file), outputFile.fileName);
23652
23643
  let writeSourceMapPromise;
23653
23644
  let source;
23654
23645
  if (outputFile.type === 'asset') {
@@ -23662,7 +23653,7 @@ function writeOutputFile(outputFile, outputOptions) {
23662
23653
  url = outputFile.map.toUrl();
23663
23654
  }
23664
23655
  else {
23665
- url = `${path$2.basename(outputFile.fileName)}.map`;
23656
+ url = `${require$$0.basename(outputFile.fileName)}.map`;
23666
23657
  writeSourceMapPromise = writeFile(`${fileName}.map`, outputFile.map.toString());
23667
23658
  }
23668
23659
  if (outputOptions.sourcemap !== 'hidden') {
@@ -23681,7 +23672,7 @@ function defineConfig(options) {
23681
23672
  return options;
23682
23673
  }
23683
23674
 
23684
- class WatchEmitter extends require$$0.EventEmitter {
23675
+ class WatchEmitter extends require$$0$1.EventEmitter {
23685
23676
  constructor() {
23686
23677
  super();
23687
23678
  // Allows more than 10 bundles to be watched without