@rollup/plugin-commonjs 22.0.1 → 23.0.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/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  ## Requirements
15
15
 
16
- This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v12.0.0+) and Rollup v2.68.0+. If you are using [`@rollup/plugin-node-resolve`](https://github.com/rollup/plugins/tree/master/packages/node-resolve), it should be v13.0.6+.
16
+ This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v2.68.0+. If you are using [`@rollup/plugin-node-resolve`](https://github.com/rollup/plugins/tree/master/packages/node-resolve), it should be v13.0.6+.
17
17
 
18
18
  ## Install
19
19
 
@@ -59,9 +59,9 @@ The default value of `"auto"` will only wrap CommonJS files when they are part o
59
59
 
60
60
  `false` will entirely prevent wrapping and hoist all files. This may still work depending on the nature of cyclic dependencies but will often cause problems.
61
61
 
62
- You can also provide a [minimatch pattern](https://github.com/isaacs/minimatch), or array of patterns, to only specify a subset of files which should be wrapped in functions for proper `require` semantics.
62
+ You can also provide a [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, to only specify a subset of files which should be wrapped in functions for proper `require` semantics.
63
63
 
64
- `"debug"` works like `"auto"` but after bundling, it will display a warning containing a list of ids that have been wrapped which can be used as minimatch pattern for fine-tuning or to avoid the potential race conditions mentioned for `"auto"`.
64
+ `"debug"` works like `"auto"` but after bundling, it will display a warning containing a list of ids that have been wrapped which can be used as picomatch pattern for fine-tuning or to avoid the potential race conditions mentioned for `"auto"`.
65
65
 
66
66
  ### `dynamicRequireTargets`
67
67
 
@@ -104,14 +104,14 @@ To avoid long paths when using the `dynamicRequireTargets` option, you can use t
104
104
  Type: `string | string[]`<br>
105
105
  Default: `null`
106
106
 
107
- A [minimatch pattern](https://github.com/isaacs/minimatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. By default, all files with extensions other than those in `extensions` or `".cjs"` are ignored, but you can exclude additional files. See also the `include` option.
107
+ A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. By default, all files with extensions other than those in `extensions` or `".cjs"` are ignored, but you can exclude additional files. See also the `include` option.
108
108
 
109
109
  ### `include`
110
110
 
111
111
  Type: `string | string[]`<br>
112
112
  Default: `null`
113
113
 
114
- A [minimatch pattern](https://github.com/isaacs/minimatch), or array of patterns, which specifies the files in the build the plugin should operate on. By default, all files with extension `".cjs"` or those in `extensions` are included, but you can narrow this list by only including specific files. These files will be analyzed and transpiled if either the analysis does not find ES module specific statements or `transformMixedEsModules` is `true`.
114
+ A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should operate on. By default, all files with extension `".cjs"` or those in `extensions` are included, but you can narrow this list by only including specific files. These files will be analyzed and transpiled if either the analysis does not find ES module specific statements or `transformMixedEsModules` is `true`.
115
115
 
116
116
  ### `extensions`
117
117
 
package/dist/cjs/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  var path = require('path');
4
6
  var pluginutils = require('@rollup/pluginutils');
5
7
  var fs = require('fs');
@@ -9,16 +11,9 @@ var estreeWalker = require('estree-walker');
9
11
  var MagicString = require('magic-string');
10
12
  var isReference = require('is-reference');
11
13
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
-
14
- var getCommonDir__default = /*#__PURE__*/_interopDefaultLegacy(getCommonDir);
15
- var glob__default = /*#__PURE__*/_interopDefaultLegacy(glob);
16
- var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
17
- var isReference__default = /*#__PURE__*/_interopDefaultLegacy(isReference);
18
-
19
- var version = "22.0.1";
14
+ var version = "23.0.0";
20
15
  var peerDependencies = {
21
- rollup: "^2.68.0"
16
+ rollup: "^2.68.0||^3.0.0"
22
17
  };
23
18
 
24
19
  function tryParse(parse, code, id) {
@@ -181,7 +176,7 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
181
176
  isNegated
182
177
  ? dynamicRequireModules.delete(targetPath)
183
178
  : dynamicRequireModules.set(targetPath, resolvedPath);
184
- for (const path$1 of glob__default["default"].sync(isNegated ? pattern.substr(1) : pattern)) {
179
+ for (const path$1 of glob.sync(isNegated ? pattern.substr(1) : pattern)) {
185
180
  const resolvedPath = path.resolve(path$1);
186
181
  const requirePath = normalizePathSlashes(resolvedPath);
187
182
  if (isDirectory(resolvedPath)) {
@@ -196,7 +191,7 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
196
191
  }
197
192
  }
198
193
  return {
199
- commonDir: dirNames.size ? getCommonDir__default["default"]([...dirNames, dynamicRequireRoot]) : null,
194
+ commonDir: dirNames.size ? getCommonDir([...dirNames, dynamicRequireRoot]) : null,
200
195
  dynamicRequireModules
201
196
  };
202
197
  }
@@ -748,7 +743,9 @@ function getRequireResolver(extensions, detectCyclesAndConditional, currentlyRes
748
743
  if (isWrappedId(resolved.id, ES_IMPORT_SUFFIX)) {
749
744
  return (
750
745
  (await getTypeForImportedModule(
751
- (await this.load({ id: resolved.id })).meta.commonjs.resolved,
746
+ (
747
+ await this.load({ id: resolved.id })
748
+ ).meta.commonjs.resolved,
752
749
  this.load
753
750
  )) !== IS_WRAPPED_COMMONJS
754
751
  );
@@ -759,61 +756,56 @@ function getRequireResolver(extensions, detectCyclesAndConditional, currentlyRes
759
756
  ).some((shouldTransform) => shouldTransform);
760
757
  },
761
758
  /* eslint-disable no-param-reassign */
762
- resolveRequireSourcesAndUpdateMeta: (rollupContext) => async (
763
- parentId,
764
- isParentCommonJS,
765
- parentMeta,
766
- sources
767
- ) => {
768
- parentMeta.initialCommonJSType = isParentCommonJS;
769
- parentMeta.requires = [];
770
- parentMeta.isRequiredCommonJS = Object.create(null);
771
- setInitialParentType(parentId, isParentCommonJS);
772
- const currentlyResolvingForParent = currentlyResolving.get(parentId) || new Set();
773
- currentlyResolving.set(parentId, currentlyResolvingForParent);
774
- const requireTargets = await Promise.all(
775
- sources.map(async ({ source, isConditional }) => {
776
- // Never analyze or proxy internal modules
777
- if (source.startsWith('\0')) {
778
- return { id: source, allowProxy: false };
779
- }
780
- currentlyResolvingForParent.add(source);
781
- const resolved =
782
- (await rollupContext.resolve(source, parentId, {
783
- custom: { 'node-resolve': { isRequire: true } }
784
- })) || resolveExtensions(source, parentId, extensions);
785
- currentlyResolvingForParent.delete(source);
786
- if (!resolved) {
787
- return { id: wrapId(source, EXTERNAL_SUFFIX), allowProxy: false };
788
- }
789
- const childId = resolved.id;
790
- if (resolved.external) {
791
- return { id: wrapId(childId, EXTERNAL_SUFFIX), allowProxy: false };
792
- }
793
- parentMeta.requires.push({ resolved, isConditional });
794
- await analyzeRequiredModule(parentId, resolved, isConditional, rollupContext.load);
795
- return { id: childId, allowProxy: true };
796
- })
797
- );
798
- parentMeta.isCommonJS = getTypeForFullyAnalyzedModule(parentId);
799
- fullyAnalyzedModules[parentId] = true;
800
- return requireTargets.map(({ id: dependencyId, allowProxy }, index) => {
801
- // eslint-disable-next-line no-multi-assign
802
- const isCommonJS = (parentMeta.isRequiredCommonJS[
803
- dependencyId
804
- ] = getTypeForFullyAnalyzedModule(dependencyId));
805
- fullyAnalyzedModules[dependencyId] = true;
806
- return {
807
- source: sources[index].source,
808
- id: allowProxy
809
- ? isCommonJS === IS_WRAPPED_COMMONJS
810
- ? wrapId(dependencyId, WRAPPED_SUFFIX)
811
- : wrapId(dependencyId, PROXY_SUFFIX)
812
- : dependencyId,
813
- isCommonJS
814
- };
815
- });
816
- },
759
+ resolveRequireSourcesAndUpdateMeta:
760
+ (rollupContext) => async (parentId, isParentCommonJS, parentMeta, sources) => {
761
+ parentMeta.initialCommonJSType = isParentCommonJS;
762
+ parentMeta.requires = [];
763
+ parentMeta.isRequiredCommonJS = Object.create(null);
764
+ setInitialParentType(parentId, isParentCommonJS);
765
+ const currentlyResolvingForParent = currentlyResolving.get(parentId) || new Set();
766
+ currentlyResolving.set(parentId, currentlyResolvingForParent);
767
+ const requireTargets = await Promise.all(
768
+ sources.map(async ({ source, isConditional }) => {
769
+ // Never analyze or proxy internal modules
770
+ if (source.startsWith('\0')) {
771
+ return { id: source, allowProxy: false };
772
+ }
773
+ currentlyResolvingForParent.add(source);
774
+ const resolved =
775
+ (await rollupContext.resolve(source, parentId, {
776
+ custom: { 'node-resolve': { isRequire: true } }
777
+ })) || resolveExtensions(source, parentId, extensions);
778
+ currentlyResolvingForParent.delete(source);
779
+ if (!resolved) {
780
+ return { id: wrapId(source, EXTERNAL_SUFFIX), allowProxy: false };
781
+ }
782
+ const childId = resolved.id;
783
+ if (resolved.external) {
784
+ return { id: wrapId(childId, EXTERNAL_SUFFIX), allowProxy: false };
785
+ }
786
+ parentMeta.requires.push({ resolved, isConditional });
787
+ await analyzeRequiredModule(parentId, resolved, isConditional, rollupContext.load);
788
+ return { id: childId, allowProxy: true };
789
+ })
790
+ );
791
+ parentMeta.isCommonJS = getTypeForFullyAnalyzedModule(parentId);
792
+ fullyAnalyzedModules[parentId] = true;
793
+ return requireTargets.map(({ id: dependencyId, allowProxy }, index) => {
794
+ // eslint-disable-next-line no-multi-assign
795
+ const isCommonJS = (parentMeta.isRequiredCommonJS[dependencyId] =
796
+ getTypeForFullyAnalyzedModule(dependencyId));
797
+ fullyAnalyzedModules[dependencyId] = true;
798
+ return {
799
+ source: sources[index].source,
800
+ id: allowProxy
801
+ ? isCommonJS === IS_WRAPPED_COMMONJS
802
+ ? wrapId(dependencyId, WRAPPED_SUFFIX)
803
+ : wrapId(dependencyId, PROXY_SUFFIX)
804
+ : dependencyId,
805
+ isCommonJS
806
+ };
807
+ });
808
+ },
817
809
  isCurrentlyResolving(source, parentId) {
818
810
  const currentlyResolvingForParent = currentlyResolving.get(parentId);
819
811
  return currentlyResolvingForParent && currentlyResolvingForParent.has(source);
@@ -974,7 +966,7 @@ function hasDefineEsmProperty(node) {
974
966
  });
975
967
  }
976
968
 
977
- function wrapCode(magicString, uses, moduleName, exportsName) {
969
+ function wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges) {
978
970
  const args = [];
979
971
  const passedArgs = [];
980
972
  if (uses.module) {
@@ -987,7 +979,7 @@ function wrapCode(magicString, uses, moduleName, exportsName) {
987
979
  }
988
980
  magicString
989
981
  .trim()
990
- .indent('\t')
982
+ .indent('\t', { exclude: indentExclusionRanges })
991
983
  .prepend(`(function (${args.join(', ')}) {\n`)
992
984
  .append(`\n} (${passedArgs.join(', ')}));`);
993
985
  }
@@ -1445,7 +1437,7 @@ async function transformCommonjs(
1445
1437
  commonjsMeta
1446
1438
  ) {
1447
1439
  const ast = astCache || tryParse(parse, code, id);
1448
- const magicString = new MagicString__default["default"](code);
1440
+ const magicString = new MagicString(code);
1449
1441
  const uses = {
1450
1442
  module: false,
1451
1443
  exports: false,
@@ -1485,6 +1477,7 @@ async function transformCommonjs(
1485
1477
  const replacedGlobal = [];
1486
1478
  const replacedDynamicRequires = [];
1487
1479
  const importedVariables = new Set();
1480
+ const indentExclusionRanges = [];
1488
1481
 
1489
1482
  estreeWalker.walk(ast, {
1490
1483
  enter(node, parent) {
@@ -1677,7 +1670,7 @@ async function transformCommonjs(
1677
1670
  return;
1678
1671
  case 'Identifier': {
1679
1672
  const { name } = node;
1680
- if (!isReference__default["default"](node, parent) || scope.contains(name)) return;
1673
+ if (!isReference(node, parent) || scope.contains(name)) return;
1681
1674
  switch (name) {
1682
1675
  case 'require':
1683
1676
  uses.require = true;
@@ -1783,6 +1776,11 @@ async function transformCommonjs(
1783
1776
  if (!scope.parent) {
1784
1777
  topLevelDeclarations.push(node);
1785
1778
  }
1779
+ return;
1780
+ case 'TemplateElement':
1781
+ if (node.value.raw.includes('\n')) {
1782
+ indentExclusionRanges.push([node.start, node.end]);
1783
+ }
1786
1784
  }
1787
1785
  },
1788
1786
 
@@ -1915,11 +1913,13 @@ async function transformCommonjs(
1915
1913
  );
1916
1914
 
1917
1915
  if (shouldWrap) {
1918
- wrapCode(magicString, uses, moduleName, exportsName);
1916
+ wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges);
1919
1917
  }
1920
1918
 
1921
1919
  if (usesRequireWrapper) {
1922
- magicString.trim().indent('\t');
1920
+ magicString.trim().indent('\t', {
1921
+ exclude: indentExclusionRanges
1922
+ });
1923
1923
  magicString.prepend(
1924
1924
  `var ${isRequiredName};
1925
1925
 
@@ -2226,5 +2226,6 @@ function commonjs(options = {}) {
2226
2226
  };
2227
2227
  }
2228
2228
 
2229
- module.exports = commonjs;
2229
+ exports.default = commonjs;
2230
+ module.exports = Object.assign(exports.default, exports);
2230
2231
  //# sourceMappingURL=index.js.map
package/dist/es/index.js CHANGED
@@ -7,9 +7,9 @@ import { walk } from 'estree-walker';
7
7
  import MagicString from 'magic-string';
8
8
  import isReference from 'is-reference';
9
9
 
10
- var version = "22.0.1";
10
+ var version = "23.0.0";
11
11
  var peerDependencies = {
12
- rollup: "^2.68.0"
12
+ rollup: "^2.68.0||^3.0.0"
13
13
  };
14
14
 
15
15
  function tryParse(parse, code, id) {
@@ -739,7 +739,9 @@ function getRequireResolver(extensions, detectCyclesAndConditional, currentlyRes
739
739
  if (isWrappedId(resolved.id, ES_IMPORT_SUFFIX)) {
740
740
  return (
741
741
  (await getTypeForImportedModule(
742
- (await this.load({ id: resolved.id })).meta.commonjs.resolved,
742
+ (
743
+ await this.load({ id: resolved.id })
744
+ ).meta.commonjs.resolved,
743
745
  this.load
744
746
  )) !== IS_WRAPPED_COMMONJS
745
747
  );
@@ -750,61 +752,56 @@ function getRequireResolver(extensions, detectCyclesAndConditional, currentlyRes
750
752
  ).some((shouldTransform) => shouldTransform);
751
753
  },
752
754
  /* eslint-disable no-param-reassign */
753
- resolveRequireSourcesAndUpdateMeta: (rollupContext) => async (
754
- parentId,
755
- isParentCommonJS,
756
- parentMeta,
757
- sources
758
- ) => {
759
- parentMeta.initialCommonJSType = isParentCommonJS;
760
- parentMeta.requires = [];
761
- parentMeta.isRequiredCommonJS = Object.create(null);
762
- setInitialParentType(parentId, isParentCommonJS);
763
- const currentlyResolvingForParent = currentlyResolving.get(parentId) || new Set();
764
- currentlyResolving.set(parentId, currentlyResolvingForParent);
765
- const requireTargets = await Promise.all(
766
- sources.map(async ({ source, isConditional }) => {
767
- // Never analyze or proxy internal modules
768
- if (source.startsWith('\0')) {
769
- return { id: source, allowProxy: false };
770
- }
771
- currentlyResolvingForParent.add(source);
772
- const resolved =
773
- (await rollupContext.resolve(source, parentId, {
774
- custom: { 'node-resolve': { isRequire: true } }
775
- })) || resolveExtensions(source, parentId, extensions);
776
- currentlyResolvingForParent.delete(source);
777
- if (!resolved) {
778
- return { id: wrapId(source, EXTERNAL_SUFFIX), allowProxy: false };
779
- }
780
- const childId = resolved.id;
781
- if (resolved.external) {
782
- return { id: wrapId(childId, EXTERNAL_SUFFIX), allowProxy: false };
783
- }
784
- parentMeta.requires.push({ resolved, isConditional });
785
- await analyzeRequiredModule(parentId, resolved, isConditional, rollupContext.load);
786
- return { id: childId, allowProxy: true };
787
- })
788
- );
789
- parentMeta.isCommonJS = getTypeForFullyAnalyzedModule(parentId);
790
- fullyAnalyzedModules[parentId] = true;
791
- return requireTargets.map(({ id: dependencyId, allowProxy }, index) => {
792
- // eslint-disable-next-line no-multi-assign
793
- const isCommonJS = (parentMeta.isRequiredCommonJS[
794
- dependencyId
795
- ] = getTypeForFullyAnalyzedModule(dependencyId));
796
- fullyAnalyzedModules[dependencyId] = true;
797
- return {
798
- source: sources[index].source,
799
- id: allowProxy
800
- ? isCommonJS === IS_WRAPPED_COMMONJS
801
- ? wrapId(dependencyId, WRAPPED_SUFFIX)
802
- : wrapId(dependencyId, PROXY_SUFFIX)
803
- : dependencyId,
804
- isCommonJS
805
- };
806
- });
807
- },
755
+ resolveRequireSourcesAndUpdateMeta:
756
+ (rollupContext) => async (parentId, isParentCommonJS, parentMeta, sources) => {
757
+ parentMeta.initialCommonJSType = isParentCommonJS;
758
+ parentMeta.requires = [];
759
+ parentMeta.isRequiredCommonJS = Object.create(null);
760
+ setInitialParentType(parentId, isParentCommonJS);
761
+ const currentlyResolvingForParent = currentlyResolving.get(parentId) || new Set();
762
+ currentlyResolving.set(parentId, currentlyResolvingForParent);
763
+ const requireTargets = await Promise.all(
764
+ sources.map(async ({ source, isConditional }) => {
765
+ // Never analyze or proxy internal modules
766
+ if (source.startsWith('\0')) {
767
+ return { id: source, allowProxy: false };
768
+ }
769
+ currentlyResolvingForParent.add(source);
770
+ const resolved =
771
+ (await rollupContext.resolve(source, parentId, {
772
+ custom: { 'node-resolve': { isRequire: true } }
773
+ })) || resolveExtensions(source, parentId, extensions);
774
+ currentlyResolvingForParent.delete(source);
775
+ if (!resolved) {
776
+ return { id: wrapId(source, EXTERNAL_SUFFIX), allowProxy: false };
777
+ }
778
+ const childId = resolved.id;
779
+ if (resolved.external) {
780
+ return { id: wrapId(childId, EXTERNAL_SUFFIX), allowProxy: false };
781
+ }
782
+ parentMeta.requires.push({ resolved, isConditional });
783
+ await analyzeRequiredModule(parentId, resolved, isConditional, rollupContext.load);
784
+ return { id: childId, allowProxy: true };
785
+ })
786
+ );
787
+ parentMeta.isCommonJS = getTypeForFullyAnalyzedModule(parentId);
788
+ fullyAnalyzedModules[parentId] = true;
789
+ return requireTargets.map(({ id: dependencyId, allowProxy }, index) => {
790
+ // eslint-disable-next-line no-multi-assign
791
+ const isCommonJS = (parentMeta.isRequiredCommonJS[dependencyId] =
792
+ getTypeForFullyAnalyzedModule(dependencyId));
793
+ fullyAnalyzedModules[dependencyId] = true;
794
+ return {
795
+ source: sources[index].source,
796
+ id: allowProxy
797
+ ? isCommonJS === IS_WRAPPED_COMMONJS
798
+ ? wrapId(dependencyId, WRAPPED_SUFFIX)
799
+ : wrapId(dependencyId, PROXY_SUFFIX)
800
+ : dependencyId,
801
+ isCommonJS
802
+ };
803
+ });
804
+ },
808
805
  isCurrentlyResolving(source, parentId) {
809
806
  const currentlyResolvingForParent = currentlyResolving.get(parentId);
810
807
  return currentlyResolvingForParent && currentlyResolvingForParent.has(source);
@@ -965,7 +962,7 @@ function hasDefineEsmProperty(node) {
965
962
  });
966
963
  }
967
964
 
968
- function wrapCode(magicString, uses, moduleName, exportsName) {
965
+ function wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges) {
969
966
  const args = [];
970
967
  const passedArgs = [];
971
968
  if (uses.module) {
@@ -978,7 +975,7 @@ function wrapCode(magicString, uses, moduleName, exportsName) {
978
975
  }
979
976
  magicString
980
977
  .trim()
981
- .indent('\t')
978
+ .indent('\t', { exclude: indentExclusionRanges })
982
979
  .prepend(`(function (${args.join(', ')}) {\n`)
983
980
  .append(`\n} (${passedArgs.join(', ')}));`);
984
981
  }
@@ -1476,6 +1473,7 @@ async function transformCommonjs(
1476
1473
  const replacedGlobal = [];
1477
1474
  const replacedDynamicRequires = [];
1478
1475
  const importedVariables = new Set();
1476
+ const indentExclusionRanges = [];
1479
1477
 
1480
1478
  walk(ast, {
1481
1479
  enter(node, parent) {
@@ -1774,6 +1772,11 @@ async function transformCommonjs(
1774
1772
  if (!scope.parent) {
1775
1773
  topLevelDeclarations.push(node);
1776
1774
  }
1775
+ return;
1776
+ case 'TemplateElement':
1777
+ if (node.value.raw.includes('\n')) {
1778
+ indentExclusionRanges.push([node.start, node.end]);
1779
+ }
1777
1780
  }
1778
1781
  },
1779
1782
 
@@ -1906,11 +1909,13 @@ async function transformCommonjs(
1906
1909
  );
1907
1910
 
1908
1911
  if (shouldWrap) {
1909
- wrapCode(magicString, uses, moduleName, exportsName);
1912
+ wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges);
1910
1913
  }
1911
1914
 
1912
1915
  if (usesRequireWrapper) {
1913
- magicString.trim().indent('\t');
1916
+ magicString.trim().indent('\t', {
1917
+ exclude: indentExclusionRanges
1918
+ });
1914
1919
  magicString.prepend(
1915
1920
  `var ${isRequiredName};
1916
1921
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollup/plugin-commonjs",
3
- "version": "22.0.1",
3
+ "version": "23.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -16,11 +16,12 @@
16
16
  "main": "./dist/cjs/index.js",
17
17
  "module": "./dist/es/index.js",
18
18
  "exports": {
19
- "require": "./dist/cjs/index.js",
20
- "import": "./dist/es/index.js"
19
+ "import": "./dist/es/index.js",
20
+ "types": "./types/index.d.ts",
21
+ "default": "./dist/cjs/index.js"
21
22
  },
22
23
  "engines": {
23
- "node": ">= 12.0.0"
24
+ "node": ">=14.0.0"
24
25
  },
25
26
  "scripts": {
26
27
  "build": "rollup -c",
@@ -33,12 +34,13 @@
33
34
  "prepublishOnly": "pnpm build",
34
35
  "prerelease": "pnpm build",
35
36
  "pretest": "pnpm build",
36
- "release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",
37
+ "release": "pnpm --workspace-root plugin:release --pkg $npm_package_name",
37
38
  "test": "ava",
38
39
  "test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
39
40
  },
40
41
  "files": [
41
42
  "dist",
43
+ "!dist/**/*.map",
42
44
  "types",
43
45
  "README.md",
44
46
  "LICENSE"
@@ -52,33 +54,35 @@
52
54
  "require"
53
55
  ],
54
56
  "peerDependencies": {
55
- "rollup": "^2.68.0"
57
+ "rollup": "^2.68.0||^3.0.0"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "rollup": {
61
+ "optional": true
62
+ }
56
63
  },
57
64
  "dependencies": {
58
- "@rollup/pluginutils": "^3.1.0",
65
+ "@rollup/pluginutils": "^4.2.1",
59
66
  "commondir": "^1.0.1",
60
- "estree-walker": "^2.0.1",
61
- "glob": "^7.1.6",
62
- "is-reference": "^1.2.1",
63
- "magic-string": "^0.25.7",
64
- "resolve": "^1.17.0"
67
+ "estree-walker": "^2.0.2",
68
+ "glob": "^8.0.3",
69
+ "is-reference": "1.2.1",
70
+ "magic-string": "^0.26.4"
65
71
  },
66
72
  "devDependencies": {
67
73
  "@rollup/plugin-json": "^4.1.0",
68
- "@rollup/plugin-node-resolve": "^13.1.0",
74
+ "@rollup/plugin-node-resolve": "^14.1.0",
69
75
  "locate-character": "^2.0.5",
70
76
  "require-relative": "^0.8.7",
71
- "rollup": "^2.68.0",
72
- "shx": "^0.3.2",
73
- "source-map": "^0.7.3",
74
- "source-map-support": "^0.5.19",
75
- "typescript": "^3.9.7"
77
+ "rollup": "3.0.0-7",
78
+ "shx": "^0.3.4",
79
+ "source-map": "^0.7.4",
80
+ "source-map-support": "^0.5.21",
81
+ "typescript": "^4.8.3"
76
82
  },
77
- "types": "types/index.d.ts",
83
+ "types": "./types/index.d.ts",
78
84
  "ava": {
79
- "babel": {
80
- "compileEnhancements": false
81
- },
85
+ "workerThreads": false,
82
86
  "files": [
83
87
  "!**/fixtures/**",
84
88
  "!**/helpers/**",
package/types/index.d.ts CHANGED
@@ -6,7 +6,7 @@ type DefaultIsModuleExportsOption = boolean | 'auto';
6
6
 
7
7
  interface RollupCommonJSOptions {
8
8
  /**
9
- * A minimatch pattern, or array of patterns, which specifies the files in
9
+ * A picomatch pattern, or array of patterns, which specifies the files in
10
10
  * the build the plugin should operate on. By default, all files with
11
11
  * extension `".cjs"` or those in `extensions` are included, but you can
12
12
  * narrow this list by only including specific files. These files will be
@@ -16,7 +16,7 @@ interface RollupCommonJSOptions {
16
16
  */
17
17
  include?: FilterPattern;
18
18
  /**
19
- * A minimatch pattern, or array of patterns, which specifies the files in
19
+ * A picomatch pattern, or array of patterns, which specifies the files in
20
20
  * the build the plugin should _ignore_. By default, all files with
21
21
  * extensions other than those in `extensions` or `".cjs"` are ignored, but you
22
22
  * can exclude additional files. See also the `include` option.
@@ -88,13 +88,13 @@ interface RollupCommonJSOptions {
88
88
  * work depending on the nature of cyclic dependencies but will often cause
89
89
  * problems.
90
90
  *
91
- * You can also provide a minimatch pattern, or array of patterns, to only
91
+ * You can also provide a picomatch pattern, or array of patterns, to only
92
92
  * specify a subset of files which should be wrapped in functions for proper
93
93
  * `require` semantics.
94
94
  *
95
95
  * `"debug"` works like `"auto"` but after bundling, it will display a warning
96
96
  * containing a list of ids that have been wrapped which can be used as
97
- * minimatch pattern for fine-tuning.
97
+ * picomatch pattern for fine-tuning.
98
98
  * @default "auto"
99
99
  */
100
100
  strictRequires?: boolean | FilterPattern;