@rollup/plugin-commonjs 21.0.0 → 21.0.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @rollup/plugin-commonjs ChangeLog
2
2
 
3
+ ## v21.0.3
4
+
5
+ _2022-03-27_
6
+
7
+ ### Updates
8
+
9
+ - docs: sync required rollup version (#1118)
10
+
11
+ ## v21.0.2
12
+
13
+ _2022-02-23_
14
+
15
+ ### Updates
16
+
17
+ - chore: transpile dynamic helper to ES5 (#1082)
18
+
19
+ ## v21.0.1
20
+
21
+ _2021-10-19_
22
+
23
+ ### Bugfixes
24
+
25
+ - fix: pass on isEntry and custom resolve options (#1018)
26
+
3
27
  ## v21.0.0
4
28
 
5
29
  _2021-10-01_
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 (v8.0.0+) and Rollup v1.20.0+.
16
+ This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+) and Rollup v2.38.3+.
17
17
 
18
18
  ## Install
19
19
 
package/dist/index.es.js CHANGED
@@ -152,7 +152,7 @@ export function commonjsRegister (path, loader) {
152
152
  }
153
153
 
154
154
  export function commonjsRegisterOrShort (path, to) {
155
- const resolvedPath = commonjsResolveImpl(path, null, true);
155
+ var resolvedPath = commonjsResolveImpl(path, null, true);
156
156
  if (resolvedPath !== null && DYNAMIC_REQUIRE_CACHE[resolvedPath]) {
157
157
  DYNAMIC_REQUIRE_CACHE[path] = DYNAMIC_REQUIRE_CACHE[resolvedPath];
158
158
  } else {
@@ -160,24 +160,24 @@ export function commonjsRegisterOrShort (path, to) {
160
160
  }
161
161
  }
162
162
 
163
- const DYNAMIC_REQUIRE_LOADERS = Object.create(null);
164
- const DYNAMIC_REQUIRE_CACHE = Object.create(null);
165
- const DYNAMIC_REQUIRE_SHORTS = Object.create(null);
166
- const DEFAULT_PARENT_MODULE = {
163
+ var DYNAMIC_REQUIRE_LOADERS = Object.create(null);
164
+ var DYNAMIC_REQUIRE_CACHE = Object.create(null);
165
+ var DYNAMIC_REQUIRE_SHORTS = Object.create(null);
166
+ var DEFAULT_PARENT_MODULE = {
167
167
  id: '<' + 'rollup>', exports: {}, parent: undefined, filename: null, loaded: false, children: [], paths: []
168
168
  };
169
- const CHECKED_EXTENSIONS = ['', '.js', '.json'];
169
+ var CHECKED_EXTENSIONS = ['', '.js', '.json'];
170
170
 
171
171
  function normalize (path) {
172
172
  path = path.replace(/\\\\/g, '/');
173
- const parts = path.split('/');
174
- const slashed = parts[0] === '';
175
- for (let i = 1; i < parts.length; i++) {
173
+ var parts = path.split('/');
174
+ var slashed = parts[0] === '';
175
+ for (var i = 1; i < parts.length; i++) {
176
176
  if (parts[i] === '.' || parts[i] === '') {
177
177
  parts.splice(i--, 1);
178
178
  }
179
179
  }
180
- for (let i = 1; i < parts.length; i++) {
180
+ for (var i = 1; i < parts.length; i++) {
181
181
  if (parts[i] !== '..') continue;
182
182
  if (i > 0 && parts[i - 1] !== '..' && parts[i - 1] !== '.') {
183
183
  parts.splice(--i, 2);
@@ -195,9 +195,9 @@ function normalize (path) {
195
195
  function join () {
196
196
  if (arguments.length === 0)
197
197
  return '.';
198
- let joined;
199
- for (let i = 0; i < arguments.length; ++i) {
200
- let arg = arguments[i];
198
+ var joined;
199
+ for (var i = 0; i < arguments.length; ++i) {
200
+ var arg = arguments[i];
201
201
  if (arg.length > 0) {
202
202
  if (joined === undefined)
203
203
  joined = arg;
@@ -212,9 +212,9 @@ function join () {
212
212
  }
213
213
 
214
214
  function isPossibleNodeModulesPath (modulePath) {
215
- let c0 = modulePath[0];
215
+ var c0 = modulePath[0];
216
216
  if (c0 === '/' || c0 === '\\\\') return false;
217
- let c1 = modulePath[1], c2 = modulePath[2];
217
+ var c1 = modulePath[1], c2 = modulePath[2];
218
218
  if ((c0 === '.' && (!c1 || c1 === '/' || c1 === '\\\\')) ||
219
219
  (c0 === '.' && c1 === '.' && (!c2 || c2 === '/' || c2 === '\\\\'))) return false;
220
220
  if (c1 === ':' && (c2 === '/' || c2 === '\\\\'))
@@ -226,9 +226,9 @@ function dirname (path) {
226
226
  if (path.length === 0)
227
227
  return '.';
228
228
 
229
- let i = path.length - 1;
229
+ var i = path.length - 1;
230
230
  while (i > 0) {
231
- const c = path.charCodeAt(i);
231
+ var c = path.charCodeAt(i);
232
232
  if ((c === 47 || c === 92) && i !== path.length - 1)
233
233
  break;
234
234
  i--;
@@ -244,9 +244,9 @@ function dirname (path) {
244
244
  }
245
245
 
246
246
  export function commonjsResolveImpl (path, originalModuleDir, testCache) {
247
- const shouldTryNodeModules = isPossibleNodeModulesPath(path);
247
+ var shouldTryNodeModules = isPossibleNodeModulesPath(path);
248
248
  path = normalize(path);
249
- let relPath;
249
+ var relPath;
250
250
  if (path[0] === '/') {
251
251
  originalModuleDir = '/';
252
252
  }
@@ -263,8 +263,8 @@ export function commonjsResolveImpl (path, originalModuleDir, testCache) {
263
263
  break; // Travelled too far up, avoid infinite loop
264
264
  }
265
265
 
266
- for (let extensionIndex = 0; extensionIndex < CHECKED_EXTENSIONS.length; extensionIndex++) {
267
- const resolvedPath = relPath + CHECKED_EXTENSIONS[extensionIndex];
266
+ for (var extensionIndex = 0; extensionIndex < CHECKED_EXTENSIONS.length; extensionIndex++) {
267
+ var resolvedPath = relPath + CHECKED_EXTENSIONS[extensionIndex];
268
268
  if (DYNAMIC_REQUIRE_CACHE[resolvedPath]) {
269
269
  return resolvedPath;
270
270
  }
@@ -276,7 +276,7 @@ export function commonjsResolveImpl (path, originalModuleDir, testCache) {
276
276
  }
277
277
  }
278
278
  if (!shouldTryNodeModules) break;
279
- const nextDir = normalize(originalModuleDir + '/..');
279
+ var nextDir = normalize(originalModuleDir + '/..');
280
280
  if (nextDir === originalModuleDir) break;
281
281
  originalModuleDir = nextDir;
282
282
  }
@@ -284,7 +284,7 @@ export function commonjsResolveImpl (path, originalModuleDir, testCache) {
284
284
  }
285
285
 
286
286
  export function commonjsResolve (path, originalModuleDir) {
287
- const resolvedPath = commonjsResolveImpl(path, originalModuleDir);
287
+ var resolvedPath = commonjsResolveImpl(path, originalModuleDir);
288
288
  if (resolvedPath !== null) {
289
289
  return resolvedPath;
290
290
  }
@@ -292,18 +292,18 @@ export function commonjsResolve (path, originalModuleDir) {
292
292
  }
293
293
 
294
294
  export function commonjsRequire (path, originalModuleDir) {
295
- let resolvedPath = commonjsResolveImpl(path, originalModuleDir, true);
295
+ var resolvedPath = commonjsResolveImpl(path, originalModuleDir, true);
296
296
  if (resolvedPath !== null) {
297
- let cachedModule = DYNAMIC_REQUIRE_CACHE[resolvedPath];
297
+ var cachedModule = DYNAMIC_REQUIRE_CACHE[resolvedPath];
298
298
  if (cachedModule) return cachedModule.exports;
299
- let shortTo = DYNAMIC_REQUIRE_SHORTS[resolvedPath];
299
+ var shortTo = DYNAMIC_REQUIRE_SHORTS[resolvedPath];
300
300
  if (shortTo) {
301
301
  cachedModule = DYNAMIC_REQUIRE_CACHE[shortTo];
302
302
  if (cachedModule)
303
303
  return cachedModule.exports;
304
304
  resolvedPath = commonjsResolveImpl(shortTo, null, true);
305
305
  }
306
- const loader = DYNAMIC_REQUIRE_LOADERS[resolvedPath];
306
+ var loader = DYNAMIC_REQUIRE_LOADERS[resolvedPath];
307
307
  if (loader) {
308
308
  DYNAMIC_REQUIRE_CACHE[resolvedPath] = cachedModule = {
309
309
  id: resolvedPath,
@@ -586,7 +586,7 @@ function getResolveId(extensions) {
586
586
  return undefined;
587
587
  }
588
588
 
589
- return function resolveId(importee, rawImporter) {
589
+ return function resolveId(importee, rawImporter, resolveOptions) {
590
590
  if (isWrappedId(importee, MODULE_SUFFIX) || isWrappedId(importee, EXPORTS_SUFFIX)) {
591
591
  return importee;
592
592
  }
@@ -629,10 +629,16 @@ function getResolveId(extensions) {
629
629
  return null;
630
630
  }
631
631
 
632
- return this.resolve(importee, importer, {
633
- skipSelf: true,
634
- custom: { 'node-resolve': { isRequire: isProxyModule || isRequiredModule } }
635
- }).then((resolved) => {
632
+ return this.resolve(
633
+ importee,
634
+ importer,
635
+ Object.assign({}, resolveOptions, {
636
+ skipSelf: true,
637
+ custom: Object.assign({}, resolveOptions.custom, {
638
+ 'node-resolve': { isRequire: isProxyModule || isRequiredModule }
639
+ })
640
+ })
641
+ ).then((resolved) => {
636
642
  if (!resolved) {
637
643
  resolved = resolveExtensions(importee, importer);
638
644
  }
@@ -1900,5 +1906,5 @@ function commonjs(options = {}) {
1900
1906
  };
1901
1907
  }
1902
1908
 
1903
- export default commonjs;
1909
+ export { commonjs as default };
1904
1910
  //# sourceMappingURL=index.es.js.map