@rollup/plugin-commonjs 22.0.0-4 → 22.0.0-8

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.
@@ -16,9 +16,9 @@ var glob__default = /*#__PURE__*/_interopDefaultLegacy(glob);
16
16
  var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
17
17
  var isReference__default = /*#__PURE__*/_interopDefaultLegacy(isReference);
18
18
 
19
- var version = "22.0.0-4";
19
+ var version = "22.0.0-8";
20
20
  var peerDependencies = {
21
- rollup: "^2.61.1"
21
+ rollup: "^2.66.1"
22
22
  };
23
23
 
24
24
  function tryParse(parse, code, id) {
@@ -337,7 +337,8 @@ const WRAPPED_SUFFIX = '?commonjs-wrapped';
337
337
  const EXTERNAL_SUFFIX = '?commonjs-external';
338
338
  const EXPORTS_SUFFIX = '?commonjs-exports';
339
339
  const MODULE_SUFFIX = '?commonjs-module';
340
- const ES_IMPORT_SUFFIX = '?es-import';
340
+ const ENTRY_SUFFIX = '?commonjs-entry';
341
+ const ES_IMPORT_SUFFIX = '?commonjs-es-import';
341
342
 
342
343
  const DYNAMIC_MODULES_ID = '\0commonjs-dynamic-modules';
343
344
  const HELPERS_ID = '\0commonjsHelpers.js';
@@ -405,21 +406,15 @@ function getUnknownRequireProxy(id, requireReturnsDefault) {
405
406
  return `import * as ${name} from ${JSON.stringify(id)}; ${exported}`;
406
407
  }
407
408
 
408
- async function getStaticRequireProxy(
409
- id,
410
- requireReturnsDefault,
411
- esModulesWithDefaultExport,
412
- esModulesWithNamedExports,
413
- loadModule
414
- ) {
409
+ async function getStaticRequireProxy(id, requireReturnsDefault, loadModule) {
415
410
  const name = getName(id);
416
411
  const {
417
412
  meta: { commonjs: commonjsMeta }
418
413
  } = await loadModule({ id });
419
- if (commonjsMeta && commonjsMeta.isCommonJS) {
420
- return `export { __moduleExports as default } from ${JSON.stringify(id)};`;
421
- } else if (!commonjsMeta) {
414
+ if (!commonjsMeta) {
422
415
  return getUnknownRequireProxy(id, requireReturnsDefault);
416
+ } else if (commonjsMeta.isCommonJS) {
417
+ return `export { __moduleExports as default } from ${JSON.stringify(id)};`;
423
418
  } else if (!requireReturnsDefault) {
424
419
  return `import { getAugmentedNamespace } from "${HELPERS_ID}"; import * as ${name} from ${JSON.stringify(
425
420
  id
@@ -427,14 +422,30 @@ async function getStaticRequireProxy(
427
422
  } else if (
428
423
  requireReturnsDefault !== true &&
429
424
  (requireReturnsDefault === 'namespace' ||
430
- !esModulesWithDefaultExport.has(id) ||
431
- (requireReturnsDefault === 'auto' && esModulesWithNamedExports.has(id)))
425
+ !commonjsMeta.hasDefaultExport ||
426
+ (requireReturnsDefault === 'auto' && commonjsMeta.hasNamedExports))
432
427
  ) {
433
428
  return `import * as ${name} from ${JSON.stringify(id)}; export default ${name};`;
434
429
  }
435
430
  return `export { default } from ${JSON.stringify(id)};`;
436
431
  }
437
432
 
433
+ async function getEntryProxy(id, defaultIsModuleExports, loadModule) {
434
+ const {
435
+ meta: { commonjs: commonjsMeta },
436
+ hasDefaultExport
437
+ } = await loadModule({ id, moduleSideEffects: true });
438
+ if (!commonjsMeta || commonjsMeta.isCommonJS !== IS_WRAPPED_COMMONJS) {
439
+ const stringifiedId = JSON.stringify(id);
440
+ let code = `export * from ${stringifiedId};`;
441
+ if (hasDefaultExport) {
442
+ code += `export { default } from ${stringifiedId};`;
443
+ }
444
+ return code;
445
+ }
446
+ return getEsImportProxy(id, defaultIsModuleExports);
447
+ }
448
+
438
449
  function getEsImportProxy(id, defaultIsModuleExports) {
439
450
  const name = getName(id);
440
451
  const exportsName = `${name}Exports`;
@@ -503,6 +514,7 @@ function getResolveId(extensions) {
503
514
  }
504
515
 
505
516
  if (
517
+ importee.endsWith(ENTRY_SUFFIX) ||
506
518
  isWrappedId(importee, MODULE_SUFFIX) ||
507
519
  isWrappedId(importee, EXPORTS_SUFFIX) ||
508
520
  isWrappedId(importee, PROXY_SUFFIX) ||
@@ -519,7 +531,8 @@ function getResolveId(extensions) {
519
531
  importer === DYNAMIC_MODULES_ID ||
520
532
  // Proxies are only importing resolved ids, no need to resolve again
521
533
  isWrappedId(importer, PROXY_SUFFIX) ||
522
- isWrappedId(importer, ES_IMPORT_SUFFIX)
534
+ isWrappedId(importer, ES_IMPORT_SUFFIX) ||
535
+ importer.endsWith(ENTRY_SUFFIX)
523
536
  ) {
524
537
  return importee;
525
538
  }
@@ -549,9 +562,19 @@ function getResolveId(extensions) {
549
562
  const resolved =
550
563
  (await this.resolve(importee, importer, Object.assign({ skipSelf: true }, resolveOptions))) ||
551
564
  resolveExtensions(importee, importer, extensions);
552
- if (!resolved || resolved.external) {
565
+ // Make sure that even if other plugins resolve again, we ignore our own proxies
566
+ if (
567
+ !resolved ||
568
+ resolved.external ||
569
+ resolved.id.endsWith(ENTRY_SUFFIX) ||
570
+ isWrappedId(resolved.id, ES_IMPORT_SUFFIX)
571
+ ) {
553
572
  return resolved;
554
573
  }
574
+ if (resolveOptions.isEntry) {
575
+ // We must not precede entry proxies with a `\0` as that will mess up relative external resolution
576
+ return resolved.id + ENTRY_SUFFIX;
577
+ }
555
578
  const {
556
579
  meta: { commonjs: commonjsMeta }
557
580
  } = await this.load(resolved);
@@ -562,7 +585,7 @@ function getResolveId(extensions) {
562
585
  };
563
586
  }
564
587
 
565
- function getResolveRequireSourcesAndGetMeta(extensions, detectCyclesAndConditional) {
588
+ function getRequireResolver(extensions, detectCyclesAndConditional) {
566
589
  const knownCjsModuleTypes = Object.create(null);
567
590
  const requiredIds = Object.create(null);
568
591
  const unconditionallyRequiredIds = Object.create(null);
@@ -586,11 +609,7 @@ function getResolveRequireSourcesAndGetMeta(extensions, detectCyclesAndCondition
586
609
 
587
610
  const getTypeForFullyAnalyzedModule = (id) => {
588
611
  const knownType = knownCjsModuleTypes[id];
589
- if (
590
- knownType === IS_WRAPPED_COMMONJS ||
591
- !detectCyclesAndConditional ||
592
- fullyAnalyzedModules[id]
593
- ) {
612
+ if (knownType !== true || !detectCyclesAndConditional || fullyAnalyzedModules[id]) {
594
613
  return knownType;
595
614
  }
596
615
  fullyAnalyzedModules[id] = true;
@@ -600,26 +619,80 @@ function getResolveRequireSourcesAndGetMeta(extensions, detectCyclesAndCondition
600
619
  return knownType;
601
620
  };
602
621
 
622
+ const setInitialParentType = (id, initialCommonJSType) => {
623
+ // It is possible a transformed module is already fully analyzed when using
624
+ // the cache and one dependency introduces a new cycle. Then transform is
625
+ // run for a fully analzyed module again. Fully analyzed modules may never
626
+ // change their type as importers already trust their type.
627
+ knownCjsModuleTypes[id] = fullyAnalyzedModules[id]
628
+ ? knownCjsModuleTypes[id]
629
+ : initialCommonJSType;
630
+ if (
631
+ detectCyclesAndConditional &&
632
+ knownCjsModuleTypes[id] === true &&
633
+ requiredIds[id] &&
634
+ !unconditionallyRequiredIds[id]
635
+ ) {
636
+ knownCjsModuleTypes[id] = IS_WRAPPED_COMMONJS;
637
+ }
638
+ };
639
+
640
+ const setTypesForRequiredModules = async (parentId, resolved, isConditional, loadModule) => {
641
+ const childId = resolved.id;
642
+ requiredIds[childId] = true;
643
+ if (!(isConditional || knownCjsModuleTypes[parentId] === IS_WRAPPED_COMMONJS)) {
644
+ unconditionallyRequiredIds[childId] = true;
645
+ }
646
+
647
+ getDependencies(parentId).add(childId);
648
+ if (!isCyclic(childId)) {
649
+ // This makes sure the current transform handler waits for all direct dependencies to be
650
+ // loaded and transformed and therefore for all transitive CommonJS dependencies to be
651
+ // loaded as well so that all cycles have been found and knownCjsModuleTypes is reliable.
652
+ await loadModule(resolved);
653
+ }
654
+ };
655
+
603
656
  return {
604
657
  getWrappedIds: () =>
605
658
  Object.keys(knownCjsModuleTypes).filter(
606
659
  (id) => knownCjsModuleTypes[id] === IS_WRAPPED_COMMONJS
607
660
  ),
608
661
  isRequiredId: (id) => requiredIds[id],
609
- resolveRequireSourcesAndGetMeta: (rollupContext) => async (
662
+ async shouldTransformCachedModule({ id: parentId, meta: { commonjs: parentMeta } }) {
663
+ // Ignore modules that did not pass through the original transformer in a previous build
664
+ if (!(parentMeta && parentMeta.requires)) {
665
+ return false;
666
+ }
667
+ setInitialParentType(parentId, parentMeta.initialCommonJSType);
668
+ await Promise.all(
669
+ parentMeta.requires.map(({ resolved, isConditional }) =>
670
+ setTypesForRequiredModules(parentId, resolved, isConditional, this.load)
671
+ )
672
+ );
673
+ if (getTypeForFullyAnalyzedModule(parentId) !== parentMeta.isCommonJS) {
674
+ return true;
675
+ }
676
+ for (const {
677
+ resolved: { id }
678
+ } of parentMeta.requires) {
679
+ if (getTypeForFullyAnalyzedModule(id) !== parentMeta.isRequiredCommonJS[id]) {
680
+ return true;
681
+ }
682
+ }
683
+ return false;
684
+ },
685
+ /* eslint-disable no-param-reassign */
686
+ resolveRequireSourcesAndUpdateMeta: (rollupContext) => async (
610
687
  parentId,
611
688
  isParentCommonJS,
689
+ parentMeta,
612
690
  sources
613
691
  ) => {
614
- knownCjsModuleTypes[parentId] = isParentCommonJS;
615
- if (
616
- detectCyclesAndConditional &&
617
- knownCjsModuleTypes[parentId] &&
618
- requiredIds[parentId] &&
619
- !unconditionallyRequiredIds[parentId]
620
- ) {
621
- knownCjsModuleTypes[parentId] = IS_WRAPPED_COMMONJS;
622
- }
692
+ parentMeta.initialCommonJSType = isParentCommonJS;
693
+ parentMeta.requires = [];
694
+ parentMeta.isRequiredCommonJS = Object.create(null);
695
+ setInitialParentType(parentId, isParentCommonJS);
623
696
  const requireTargets = await Promise.all(
624
697
  sources.map(async ({ source, isConditional }) => {
625
698
  // Never analyze or proxy internal modules
@@ -637,38 +710,27 @@ function getResolveRequireSourcesAndGetMeta(extensions, detectCyclesAndCondition
637
710
  if (resolved.external) {
638
711
  return { id: wrapId(childId, EXTERNAL_SUFFIX), allowProxy: false };
639
712
  }
640
- requiredIds[childId] = true;
641
- if (!(isConditional || knownCjsModuleTypes[parentId] === IS_WRAPPED_COMMONJS)) {
642
- unconditionallyRequiredIds[childId] = true;
643
- }
644
-
645
- getDependencies(parentId).add(childId);
646
- if (!isCyclic(childId)) {
647
- // This makes sure the current transform handler waits for all direct dependencies to be
648
- // loaded and transformed and therefore for all transitive CommonJS dependencies to be
649
- // loaded as well so that all cycles have been found and knownCjsModuleTypes is reliable.
650
- await rollupContext.load(resolved);
651
- } else if (detectCyclesAndConditional && knownCjsModuleTypes[parentId]) {
652
- knownCjsModuleTypes[parentId] = IS_WRAPPED_COMMONJS;
653
- }
713
+ parentMeta.requires.push({ resolved, isConditional });
714
+ await setTypesForRequiredModules(parentId, resolved, isConditional, rollupContext.load);
654
715
  return { id: childId, allowProxy: true };
655
716
  })
656
717
  );
657
- return {
658
- requireTargets: requireTargets.map(({ id: dependencyId, allowProxy }, index) => {
659
- const isCommonJS = getTypeForFullyAnalyzedModule(dependencyId);
660
- return {
661
- source: sources[index].source,
662
- id: allowProxy
663
- ? isCommonJS === IS_WRAPPED_COMMONJS
664
- ? wrapId(dependencyId, WRAPPED_SUFFIX)
665
- : wrapId(dependencyId, PROXY_SUFFIX)
666
- : dependencyId,
667
- isCommonJS
668
- };
669
- }),
670
- usesRequireWrapper: getTypeForFullyAnalyzedModule(parentId) === IS_WRAPPED_COMMONJS
671
- };
718
+ parentMeta.isCommonJS = getTypeForFullyAnalyzedModule(parentId);
719
+ return requireTargets.map(({ id: dependencyId, allowProxy }, index) => {
720
+ // eslint-disable-next-line no-multi-assign
721
+ const isCommonJS = (parentMeta.isRequiredCommonJS[
722
+ dependencyId
723
+ ] = getTypeForFullyAnalyzedModule(dependencyId));
724
+ return {
725
+ source: sources[index].source,
726
+ id: allowProxy
727
+ ? isCommonJS === IS_WRAPPED_COMMONJS
728
+ ? wrapId(dependencyId, WRAPPED_SUFFIX)
729
+ : wrapId(dependencyId, PROXY_SUFFIX)
730
+ : dependencyId,
731
+ isCommonJS
732
+ };
733
+ });
672
734
  }
673
735
  };
674
736
  }
@@ -1142,11 +1204,12 @@ function getRequireHandlers() {
1142
1204
  exportsName,
1143
1205
  id,
1144
1206
  exportMode,
1145
- resolveRequireSourcesAndGetMeta,
1207
+ resolveRequireSourcesAndUpdateMeta,
1146
1208
  needsRequireWrapper,
1147
1209
  isEsModule,
1148
1210
  isDynamicRequireModulesEnabled,
1149
- getIgnoreTryCatchRequireStatementMode
1211
+ getIgnoreTryCatchRequireStatementMode,
1212
+ commonjsMeta
1150
1213
  ) {
1151
1214
  const imports = [];
1152
1215
  imports.push(`import * as ${helpersName} from "${HELPERS_ID}";`);
@@ -1169,9 +1232,10 @@ function getRequireHandlers() {
1169
1232
  );
1170
1233
  }
1171
1234
  const requiresBySource = collectSources(requireExpressions);
1172
- const { requireTargets, usesRequireWrapper } = await resolveRequireSourcesAndGetMeta(
1235
+ const requireTargets = await resolveRequireSourcesAndUpdateMeta(
1173
1236
  id,
1174
1237
  needsRequireWrapper ? IS_WRAPPED_COMMONJS : !isEsModule,
1238
+ commonjsMeta,
1175
1239
  Object.keys(requiresBySource).map((source) => {
1176
1240
  return {
1177
1241
  source,
@@ -1186,10 +1250,7 @@ function getRequireHandlers() {
1186
1250
  getIgnoreTryCatchRequireStatementMode,
1187
1251
  magicString
1188
1252
  );
1189
- return {
1190
- importBlock: imports.length ? `${imports.join('\n')}\n\n` : '',
1191
- usesRequireWrapper
1192
- };
1253
+ return imports.length ? `${imports.join('\n')}\n\n` : '';
1193
1254
  }
1194
1255
 
1195
1256
  return {
@@ -1292,9 +1353,10 @@ async function transformCommonjs(
1292
1353
  astCache,
1293
1354
  defaultIsModuleExports,
1294
1355
  needsRequireWrapper,
1295
- resolveRequireSourcesAndGetMeta,
1356
+ resolveRequireSourcesAndUpdateMeta,
1296
1357
  isRequired,
1297
- checkDynamicRequire
1358
+ checkDynamicRequire,
1359
+ commonjsMeta
1298
1360
  ) {
1299
1361
  const ast = astCache || tryParse(parse, code, id);
1300
1362
  const magicString = new MagicString__default["default"](code);
@@ -1678,7 +1740,7 @@ async function transformCommonjs(
1678
1740
  ) &&
1679
1741
  (ignoreGlobal || !uses.global)
1680
1742
  ) {
1681
- return { meta: { commonjs: { isCommonJS: false, isMixedModule: false } } };
1743
+ return { meta: { commonjs: { isCommonJS: false } } };
1682
1744
  }
1683
1745
 
1684
1746
  let leadingComment = '';
@@ -1700,7 +1762,7 @@ async function transformCommonjs(
1700
1762
  ? 'exports'
1701
1763
  : 'module';
1702
1764
 
1703
- const { importBlock, usesRequireWrapper } = await rewriteRequireExpressionsAndGetImportBlock(
1765
+ const importBlock = await rewriteRequireExpressionsAndGetImportBlock(
1704
1766
  magicString,
1705
1767
  topLevelDeclarations,
1706
1768
  reassignedNames,
@@ -1710,12 +1772,14 @@ async function transformCommonjs(
1710
1772
  exportsName,
1711
1773
  id,
1712
1774
  exportMode,
1713
- resolveRequireSourcesAndGetMeta,
1775
+ resolveRequireSourcesAndUpdateMeta,
1714
1776
  needsRequireWrapper,
1715
1777
  isEsModule,
1716
1778
  isDynamicRequireModulesEnabled,
1717
- getIgnoreTryCatchRequireStatementMode
1779
+ getIgnoreTryCatchRequireStatementMode,
1780
+ commonjsMeta
1718
1781
  );
1782
+ const usesRequireWrapper = commonjsMeta.isCommonJS === IS_WRAPPED_COMMONJS;
1719
1783
  const exportBlock = isEsModule
1720
1784
  ? ''
1721
1785
  : rewriteExportsAndGetExportsBlock(
@@ -1768,15 +1832,12 @@ function ${requireName} () {
1768
1832
  code: magicString.toString(),
1769
1833
  map: sourceMap ? magicString.generateMap() : null,
1770
1834
  syntheticNamedExports: isEsModule || usesRequireWrapper ? false : '__moduleExports',
1771
- meta: {
1772
- commonjs: {
1773
- isCommonJS: !isEsModule && (usesRequireWrapper ? IS_WRAPPED_COMMONJS : true),
1774
- isMixedModule: isEsModule
1775
- }
1776
- }
1835
+ meta: { commonjs: commonjsMeta }
1777
1836
  };
1778
1837
  }
1779
1838
 
1839
+ const PLUGIN_NAME = 'commonjs';
1840
+
1780
1841
  function commonjs(options = {}) {
1781
1842
  const {
1782
1843
  ignoreGlobal,
@@ -1804,11 +1865,6 @@ function commonjs(options = {}) {
1804
1865
  const defaultIsModuleExports =
1805
1866
  typeof options.defaultIsModuleExports === 'boolean' ? options.defaultIsModuleExports : 'auto';
1806
1867
 
1807
- const {
1808
- resolveRequireSourcesAndGetMeta,
1809
- getWrappedIds,
1810
- isRequiredId
1811
- } = getResolveRequireSourcesAndGetMeta(extensions, detectCyclesAndConditional);
1812
1868
  const dynamicRequireRoot =
1813
1869
  typeof options.dynamicRequireRoot === 'string'
1814
1870
  ? path.resolve(options.dynamicRequireRoot)
@@ -1819,9 +1875,6 @@ function commonjs(options = {}) {
1819
1875
  );
1820
1876
  const isDynamicRequireModulesEnabled = dynamicRequireModules.size > 0;
1821
1877
 
1822
- const esModulesWithDefaultExport = new Set();
1823
- const esModulesWithNamedExports = new Set();
1824
-
1825
1878
  const ignoreRequire =
1826
1879
  typeof options.ignore === 'function'
1827
1880
  ? options.ignore
@@ -1849,25 +1902,31 @@ function commonjs(options = {}) {
1849
1902
 
1850
1903
  const sourceMap = options.sourceMap !== false;
1851
1904
 
1905
+ // Initialized in buildStart
1906
+ let requireResolver;
1907
+
1852
1908
  function transformAndCheckExports(code, id) {
1853
1909
  const { isEsModule, hasDefaultExport, hasNamedExports, ast } = analyzeTopLevelStatements(
1854
1910
  this.parse,
1855
1911
  code,
1856
1912
  id
1857
1913
  );
1914
+
1915
+ const commonjsMeta = this.getModuleInfo(id).meta.commonjs || {};
1858
1916
  if (hasDefaultExport) {
1859
- esModulesWithDefaultExport.add(id);
1917
+ commonjsMeta.hasDefaultExport = true;
1860
1918
  }
1861
1919
  if (hasNamedExports) {
1862
- esModulesWithNamedExports.add(id);
1920
+ commonjsMeta.hasNamedExports = true;
1863
1921
  }
1864
1922
 
1865
1923
  if (
1866
1924
  !dynamicRequireModules.has(normalizePathSlashes(id)) &&
1867
- (!(hasCjsKeywords(code, ignoreGlobal) || isRequiredId(id)) ||
1925
+ (!(hasCjsKeywords(code, ignoreGlobal) || requireResolver.isRequiredId(id)) ||
1868
1926
  (isEsModule && !options.transformMixedEsModules))
1869
1927
  ) {
1870
- return { meta: { commonjs: { isCommonJS: false } } };
1928
+ commonjsMeta.isCommonJS = false;
1929
+ return { meta: { commonjs: commonjsMeta } };
1871
1930
  }
1872
1931
 
1873
1932
  const needsRequireWrapper =
@@ -1906,14 +1965,15 @@ function commonjs(options = {}) {
1906
1965
  ast,
1907
1966
  defaultIsModuleExports,
1908
1967
  needsRequireWrapper,
1909
- resolveRequireSourcesAndGetMeta(this),
1910
- isRequiredId(id),
1911
- checkDynamicRequire
1968
+ requireResolver.resolveRequireSourcesAndUpdateMeta(this),
1969
+ requireResolver.isRequiredId(id),
1970
+ checkDynamicRequire,
1971
+ commonjsMeta
1912
1972
  );
1913
1973
  }
1914
1974
 
1915
1975
  return {
1916
- name: 'commonjs',
1976
+ name: PLUGIN_NAME,
1917
1977
 
1918
1978
  version,
1919
1979
 
@@ -1921,7 +1981,7 @@ function commonjs(options = {}) {
1921
1981
  // We inject the resolver in the beginning so that "catch-all-resolver" like node-resolver
1922
1982
  // do not prevent our plugin from resolving entry points ot proxies.
1923
1983
  const plugins = Array.isArray(rawOptions.plugins)
1924
- ? rawOptions.plugins
1984
+ ? [...rawOptions.plugins]
1925
1985
  : rawOptions.plugins
1926
1986
  ? [rawOptions.plugins]
1927
1987
  : [];
@@ -1943,11 +2003,12 @@ function commonjs(options = {}) {
1943
2003
  'The namedExports option from "@rollup/plugin-commonjs" is deprecated. Named exports are now handled automatically.'
1944
2004
  );
1945
2005
  }
2006
+ requireResolver = getRequireResolver(extensions, detectCyclesAndConditional);
1946
2007
  },
1947
2008
 
1948
2009
  buildEnd() {
1949
2010
  if (options.strictRequires === 'debug') {
1950
- const wrappedIds = getWrappedIds();
2011
+ const wrappedIds = requireResolver.getWrappedIds();
1951
2012
  if (wrappedIds.length) {
1952
2013
  this.warn({
1953
2014
  code: 'WRAPPED_IDS',
@@ -1996,6 +2057,11 @@ function commonjs(options = {}) {
1996
2057
  );
1997
2058
  }
1998
2059
 
2060
+ // entry suffix is just appended to not mess up relative external resolution
2061
+ if (id.endsWith(ENTRY_SUFFIX)) {
2062
+ return getEntryProxy(id.slice(0, -ENTRY_SUFFIX.length), defaultIsModuleExports, this.load);
2063
+ }
2064
+
1999
2065
  if (isWrappedId(id, ES_IMPORT_SUFFIX)) {
2000
2066
  return getEsImportProxy(unwrapId(id, ES_IMPORT_SUFFIX), defaultIsModuleExports);
2001
2067
  }
@@ -2011,18 +2077,16 @@ function commonjs(options = {}) {
2011
2077
 
2012
2078
  if (isWrappedId(id, PROXY_SUFFIX)) {
2013
2079
  const actualId = unwrapId(id, PROXY_SUFFIX);
2014
- return getStaticRequireProxy(
2015
- actualId,
2016
- getRequireReturnsDefault(actualId),
2017
- esModulesWithDefaultExport,
2018
- esModulesWithNamedExports,
2019
- this.load
2020
- );
2080
+ return getStaticRequireProxy(actualId, getRequireReturnsDefault(actualId), this.load);
2021
2081
  }
2022
2082
 
2023
2083
  return null;
2024
2084
  },
2025
2085
 
2086
+ shouldTransformCachedModule(...args) {
2087
+ return requireResolver.shouldTransformCachedModule.call(this, ...args);
2088
+ },
2089
+
2026
2090
  transform(code, id) {
2027
2091
  const extName = path.extname(id);
2028
2092
  if (extName !== '.cjs' && (!filter(id) || !extensions.includes(extName))) {