@rollup/plugin-commonjs 22.0.0-8 → 22.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rollup/plugin-commonjs",
3
- "version": "22.0.0-8",
3
+ "version": "22.0.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -52,7 +52,7 @@
52
52
  "require"
53
53
  ],
54
54
  "peerDependencies": {
55
- "rollup": "^2.66.1"
55
+ "rollup": "^2.68.0"
56
56
  },
57
57
  "dependencies": {
58
58
  "@rollup/pluginutils": "^3.1.0",
@@ -68,7 +68,7 @@
68
68
  "@rollup/plugin-node-resolve": "^13.1.0",
69
69
  "locate-character": "^2.0.5",
70
70
  "require-relative": "^0.8.7",
71
- "rollup": "^2.66.1",
71
+ "rollup": "^2.68.0",
72
72
  "shx": "^0.3.2",
73
73
  "source-map": "^0.7.3",
74
74
  "source-map-support": "^0.5.19",
package/types/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { FilterPattern } from '@rollup/pluginutils';
2
2
  import { Plugin } from 'rollup';
3
3
 
4
4
  type RequireReturnsDefaultOption = boolean | 'auto' | 'preferred' | 'namespace';
5
+ type DefaultIsModuleExportsOption = boolean | 'auto';
5
6
 
6
7
  interface RollupCommonJSOptions {
7
8
  /**
@@ -196,6 +197,13 @@ interface RollupCommonJSOptions {
196
197
  requireReturnsDefault?:
197
198
  | RequireReturnsDefaultOption
198
199
  | ((id: string) => RequireReturnsDefaultOption);
200
+
201
+ /**
202
+ * @default "auto"
203
+ */
204
+ defaultIsModuleExports?:
205
+ | DefaultIsModuleExportsOption
206
+ | ((id: string) => DefaultIsModuleExportsOption);
199
207
  /**
200
208
  * Some modules contain dynamic `require` calls, or require modules that
201
209
  * contain circular dependencies, which are not handled well by static
package/CHANGELOG.md DELETED
@@ -1,590 +0,0 @@
1
- # @rollup/plugin-commonjs ChangeLog
2
-
3
- ## v21.0.1
4
-
5
- _2021-10-19_
6
-
7
- ### Bugfixes
8
-
9
- - fix: pass on isEntry and custom resolve options (#1018)
10
-
11
- ## v21.0.0
12
-
13
- _2021-10-01_
14
-
15
- ### Breaking Changes
16
-
17
- - fix: use safe default value for ignoreTryCatch (#1005)
18
-
19
- ## v20.0.0
20
-
21
- _2021-07-30_
22
-
23
- ### Breaking Changes
24
-
25
- - fix: Correctly infer module name for any separator (#924)
26
-
27
- ## v19.0.2
28
-
29
- _2021-07-26_
30
-
31
- ### Bugfixes
32
-
33
- - fix convert module.exports with `__esModule` property(#939) (#942)
34
-
35
- ## v19.0.1
36
-
37
- _2021-07-15_
38
-
39
- ### Bugfixes
40
-
41
- - fix: short-circuit to actual module entry point when using circular ref through a different entry (#888)
42
-
43
- ## v19.0.0
44
-
45
- _2021-05-07_
46
-
47
- ### Breaking Changes
48
-
49
- - feat!: Add support for circular dependencies (#658)
50
-
51
- ## v18.1.0
52
-
53
- _2021-05-04_
54
-
55
- ### Bugfixes
56
-
57
- - fix: idempotence issue (#871)
58
-
59
- ### Features
60
-
61
- - feat: Add `defaultIsModuleExports` option to match Node.js behavior (#838)
62
-
63
- ## v18.0.0
64
-
65
- _2021-03-26_
66
-
67
- ### Breaking Changes
68
-
69
- - feat!: Add ignore-dynamic-requires option (#819)
70
-
71
- ### Bugfixes
72
-
73
- - fix: `isRestorableCompiledEsm` should also trigger code transform (#816)
74
-
75
- ## v17.1.0
76
-
77
- _2021-01-29_
78
-
79
- ### Bugfixes
80
-
81
- - fix: correctly replace shorthand `require` (#764)
82
-
83
- ### Features
84
-
85
- - feature: load dynamic commonjs modules from es `import` (#766)
86
- - feature: support cache/resolve access inside dynamic modules (#728)
87
- - feature: allow keeping `require` calls inside try-catch (#729)
88
-
89
- ### Updates
90
-
91
- - chore: fix lint error (#719)
92
-
93
- ## v17.0.0
94
-
95
- _2020-11-30_
96
-
97
- ### Breaking Changes
98
-
99
- - feat!: reconstruct real es module from \_\_esModule marker (#537)
100
-
101
- ## v16.0.0
102
-
103
- _2020-10-27_
104
-
105
- ### Breaking Changes
106
-
107
- - feat!: Expose cjs detection and support offline caching (#604)
108
-
109
- ### Bugfixes
110
-
111
- - fix: avoid wrapping `commonjsRegister` call in `createCommonjsModule(...)` (#602)
112
- - fix: register dynamic modules when a different loader (i.e typescript) loads the entry file (#599)
113
- - fix: fixed access to node_modules dynamic module with subfolder (i.e 'logform/json') (#601)
114
-
115
- ### Features
116
-
117
- - feat: pass type of import to node-resolve (#611)
118
-
119
- ## v15.1.0
120
-
121
- _2020-09-21_
122
-
123
- ### Features
124
-
125
- - feat: inject \_\_esModule marker into ES namespaces and add Object prototype (#552)
126
- - feat: add requireReturnsDefault to types (#579)
127
-
128
- ## v15.0.0
129
-
130
- _2020-08-13_
131
-
132
- ### Breaking Changes
133
-
134
- - feat!: return the namespace by default when requiring ESM (#507)
135
- - fix!: fix interop when importing CJS that is transpiled ESM from an actual ESM (#501)
136
-
137
- ### Bugfixes
138
-
139
- - fix: add .cjs to default file extensions. (#524)
140
-
141
- ### Updates
142
-
143
- - chore: update dependencies (fe399e2)
144
-
145
- ## v14.0.0
146
-
147
- _2020-07-13_
148
-
149
- ### Release Notes
150
-
151
- This restores the fixes from v13.0.1, but as a semver compliant major version.
152
-
153
- ## v13.0.2
154
-
155
- _2020-07-13_
156
-
157
- ### Rollback
158
-
159
- Rolls back breaking change in v13.0.1 whereby the exported `unwrapExports` method was removed.
160
-
161
- ## v13.0.1
162
-
163
- _2020-07-12_
164
-
165
- ### Bugfixes
166
-
167
- - fix: prevent rewrite require.resolve (#446)
168
- - fix: Support \_\_esModule packages with a default export (#465)
169
-
170
- ## v13.0.0
171
-
172
- _2020-06-05_
173
-
174
- ### Breaking Changes
175
-
176
- - fix!: remove namedExports from types (#410)
177
- - fix!: do not create fake named exports (#427)
178
-
179
- ### Bugfixes
180
-
181
- - fix: \_\_moduleExports in multi entry + inter dependencies (#415)
182
-
183
- ## v12.0.0
184
-
185
- _2020-05-20_
186
-
187
- ### Breaking Changes
188
-
189
- - feat: add kill-switch for mixed es-cjs modules (#358)
190
- - feat: set syntheticNamedExports for commonjs modules (#149)
191
-
192
- ### Bugfixes
193
-
194
- - fix: expose the virtual `require` function on mock `module`. fixes #307 (#326)
195
- - fix: improved shouldWrap logic. fixes #304 (#355)
196
-
197
- ### Features
198
-
199
- - feat: support for explicit module.require calls. fixes #310 (#325)
200
-
201
- ## v11.1.0
202
-
203
- _2020-04-12_
204
-
205
- ### Bugfixes
206
-
207
- - fix: produce legal variable names from filenames containing hyphens. (#201)
208
-
209
- ### Features
210
-
211
- - feat: support dynamic require (#206)
212
- - feat: export properties defined using Object.defineProperty(exports, ..) (#222)
213
-
214
- ### Updates
215
-
216
- - chore: snapshot mismatch running tests before publish (d6bbfdd)
217
- - test: add snapshots to all "function" tests (#218)
218
-
219
- ## v11.0.2
220
-
221
- _2020-02-01_
222
-
223
- ### Updates
224
-
225
- - docs: fix link for plugin-node-resolve (#170)
226
- - chore: update dependencies (5405eea)
227
- - chore: remove jsnext:main (#152)
228
-
229
- ## v11.0.1
230
-
231
- _2020-01-04_
232
-
233
- ### Bugfixes
234
-
235
- - fix: module.exports object spread (#121)
236
-
237
- ## 11.0.0
238
-
239
- _2019-12-13_
240
-
241
- - **Breaking:** Minimum compatible Rollup version is 1.20.0
242
- - **Breaking:** Minimum supported Node version is 8.0.0
243
- - Published as @rollup/plugin-commonjs
244
-
245
- ## 10.1.0
246
-
247
- _2019-08-27_
248
-
249
- - Normalize ids before looking up in named export map ([#406](https://github.com/rollup/rollup-plugin-commonjs/issues/406))
250
- - Update README.md with note on symlinks ([#405](https://github.com/rollup/rollup-plugin-commonjs/issues/405))
251
-
252
- ## 10.0.2
253
-
254
- _2019-08-03_
255
-
256
- - Support preserveSymlinks: false ([#401](https://github.com/rollup/rollup-plugin-commonjs/issues/401))
257
-
258
- ## 10.0.1
259
-
260
- _2019-06-27_
261
-
262
- - Make tests run with Node 6 again and update dependencies ([#389](https://github.com/rollup/rollup-plugin-commonjs/issues/389))
263
- - Handle builtins appropriately for resolve 1.11.0 ([#395](https://github.com/rollup/rollup-plugin-commonjs/issues/395))
264
-
265
- ## 10.0.0
266
-
267
- _2019-05-15_
268
-
269
- - Use new Rollup@1.12 context functions, fix issue when resolveId returns an object ([#387](https://github.com/rollup/rollup-plugin-commonjs/issues/387))
270
-
271
- ## 9.3.4
272
-
273
- _2019-04-04_
274
-
275
- - Make "extensions" optional ([#384](https://github.com/rollup/rollup-plugin-commonjs/issues/384))
276
- - Use same typing for include and exclude properties ([#385](https://github.com/rollup/rollup-plugin-commonjs/issues/385))
277
-
278
- ## 9.3.3
279
-
280
- _2019-04-04_
281
-
282
- - Remove colon from module prefixes ([#371](https://github.com/rollup/rollup-plugin-commonjs/issues/371))
283
-
284
- ## 9.3.2
285
-
286
- _2019-04-04_
287
-
288
- - Use shared extractAssignedNames, fix destructuring issue ([#303](https://github.com/rollup/rollup-plugin-commonjs/issues/303))
289
-
290
- ## 9.3.1
291
-
292
- _2019-04-04_
293
-
294
- - Include typings in release ([#382](https://github.com/rollup/rollup-plugin-commonjs/issues/382))
295
-
296
- ## 9.3.0
297
-
298
- _2019-04-03_
299
-
300
- - Add TypeScript types ([#363](https://github.com/rollup/rollup-plugin-commonjs/issues/363))
301
-
302
- ## 9.2.3
303
-
304
- _2019-04-02_
305
-
306
- - Improve support for ES3 browsers ([#364](https://github.com/rollup/rollup-plugin-commonjs/issues/364))
307
- - Add note about monorepo usage to readme ([#372](https://github.com/rollup/rollup-plugin-commonjs/issues/372))
308
- - Add .js extension to generated helper file ([#373](https://github.com/rollup/rollup-plugin-commonjs/issues/373))
309
-
310
- ## 9.2.2
311
-
312
- _2019-03-25_
313
-
314
- - Handle array destructuring assignment ([#379](https://github.com/rollup/rollup-plugin-commonjs/issues/379))
315
-
316
- ## 9.2.1
317
-
318
- _2019-02-23_
319
-
320
- - Use correct context when manually resolving ids ([#370](https://github.com/rollup/rollup-plugin-commonjs/issues/370))
321
-
322
- ## 9.2.0
323
-
324
- _2018-10-10_
325
-
326
- - Fix missing default warning, produce better code when importing known ESM default exports ([#349](https://github.com/rollup/rollup-plugin-commonjs/issues/349))
327
- - Refactor code and add prettier ([#346](https://github.com/rollup/rollup-plugin-commonjs/issues/346))
328
-
329
- ## 9.1.8
330
-
331
- _2018-09-18_
332
-
333
- - Ignore virtual modules created by other plugins ([#327](https://github.com/rollup/rollup-plugin-commonjs/issues/327))
334
- - Add "location" and "process" to reserved words ([#330](https://github.com/rollup/rollup-plugin-commonjs/issues/330))
335
-
336
- ## 9.1.6
337
-
338
- _2018-08-24_
339
-
340
- - Keep commonJS detection between instantiations ([#338](https://github.com/rollup/rollup-plugin-commonjs/issues/338))
341
-
342
- ## 9.1.5
343
-
344
- _2018-08-09_
345
-
346
- - Handle object form of input ([#329](https://github.com/rollup/rollup-plugin-commonjs/issues/329))
347
-
348
- ## 9.1.4
349
-
350
- _2018-07-27_
351
-
352
- - Make "from" a reserved word ([#320](https://github.com/rollup/rollup-plugin-commonjs/issues/320))
353
-
354
- ## 9.1.3
355
-
356
- _2018-04-30_
357
-
358
- - Fix a caching issue ([#316](https://github.com/rollup/rollup-plugin-commonjs/issues/316))
359
-
360
- ## 9.1.2
361
-
362
- _2018-04-30_
363
-
364
- - Re-publication of 9.1.0
365
-
366
- ## 9.1.1
367
-
368
- _2018-04-30_
369
-
370
- - Fix ordering of modules when using rollup 0.58 ([#302](https://github.com/rollup/rollup-plugin-commonjs/issues/302))
371
-
372
- ## 9.1.0
373
-
374
- - Do not automatically wrap modules with return statements in top level arrow functions ([#302](https://github.com/rollup/rollup-plugin-commonjs/issues/302))
375
-
376
- ## 9.0.0
377
-
378
- - Make rollup a peer dependency with a version range ([#300](https://github.com/rollup/rollup-plugin-commonjs/issues/300))
379
-
380
- ## 8.4.1
381
-
382
- - Re-release of 8.3.0 as #287 was actually a breaking change
383
-
384
- ## 8.4.0
385
-
386
- - Better handle non-CJS files that contain CJS keywords ([#285](https://github.com/rollup/rollup-plugin-commonjs/issues/285))
387
- - Use rollup's plugin context`parse` function ([#287](https://github.com/rollup/rollup-plugin-commonjs/issues/287))
388
- - Improve error handling ([#288](https://github.com/rollup/rollup-plugin-commonjs/issues/288))
389
-
390
- ## 8.3.0
391
-
392
- - Handle multiple entry points ([#283](https://github.com/rollup/rollup-plugin-commonjs/issues/283))
393
- - Extract named exports from exported object literals ([#272](https://github.com/rollup/rollup-plugin-commonjs/issues/272))
394
- - Fix when `options.external` is modified by other plugins ([#264](https://github.com/rollup/rollup-plugin-commonjs/issues/264))
395
- - Recognize static template strings in require statements ([#271](https://github.com/rollup/rollup-plugin-commonjs/issues/271))
396
-
397
- ## 8.2.4
398
-
399
- - Don't import default from ES modules that don't export default ([#206](https://github.com/rollup/rollup-plugin-commonjs/issues/206))
400
-
401
- ## 8.2.3
402
-
403
- - Prevent duplicate default exports ([#230](https://github.com/rollup/rollup-plugin-commonjs/pull/230))
404
- - Only include default export when it exists ([#226](https://github.com/rollup/rollup-plugin-commonjs/pull/226))
405
- - Deconflict `require` aliases ([#232](https://github.com/rollup/rollup-plugin-commonjs/issues/232))
406
-
407
- ## 8.2.1
408
-
409
- - Fix magic-string deprecation warning
410
-
411
- ## 8.2.0
412
-
413
- - Avoid using `index` as a variable name ([#208](https://github.com/rollup/rollup-plugin-commonjs/pull/208))
414
-
415
- ## 8.1.1
416
-
417
- - Compatibility with 0.48 ([#220](https://github.com/rollup/rollup-plugin-commonjs/issues/220))
418
-
419
- ## 8.1.0
420
-
421
- - Handle `options.external` correctly ([#212](https://github.com/rollup/rollup-plugin-commonjs/pull/212))
422
- - Support top-level return ([#195](https://github.com/rollup/rollup-plugin-commonjs/pull/195))
423
-
424
- ## 8.0.2
425
-
426
- - Fix another `var` rewrite bug ([#181](https://github.com/rollup/rollup-plugin-commonjs/issues/181))
427
-
428
- ## 8.0.1
429
-
430
- - Remove declarators within a var declaration correctly ([#179](https://github.com/rollup/rollup-plugin-commonjs/issues/179))
431
-
432
- ## 8.0.0
433
-
434
- - Prefer the names dependencies are imported by for the common `var foo = require('foo')` pattern ([#176](https://github.com/rollup/rollup-plugin-commonjs/issues/176))
435
-
436
- ## 7.1.0
437
-
438
- - Allow certain `require` statements to pass through unmolested ([#174](https://github.com/rollup/rollup-plugin-commonjs/issues/174))
439
-
440
- ## 7.0.2
441
-
442
- - Handle duplicate default exports ([#158](https://github.com/rollup/rollup-plugin-commonjs/issues/158))
443
-
444
- ## 7.0.1
445
-
446
- - Fix exports with parentheses ([#168](https://github.com/rollup/rollup-plugin-commonjs/issues/168))
447
-
448
- ## 7.0.0
449
-
450
- - Rewrite `typeof module`, `typeof module.exports` and `typeof exports` as `'object'` ([#151](https://github.com/rollup/rollup-plugin-commonjs/issues/151))
451
-
452
- ## 6.0.1
453
-
454
- - Don't overwrite globals ([#127](https://github.com/rollup/rollup-plugin-commonjs/issues/127))
455
-
456
- ## 6.0.0
457
-
458
- - Rewrite top-level `define` as `undefined`, so AMD-first UMD blocks do not cause breakage ([#144](https://github.com/rollup/rollup-plugin-commonjs/issues/144))
459
- - Support ES2017 syntax ([#132](https://github.com/rollup/rollup-plugin-commonjs/issues/132))
460
- - Deconflict exported reserved keywords ([#116](https://github.com/rollup/rollup-plugin-commonjs/issues/116))
461
-
462
- ## 5.0.5
463
-
464
- - Fix parenthesis wrapped exports ([#120](https://github.com/rollup/rollup-plugin-commonjs/issues/120))
465
-
466
- ## 5.0.4
467
-
468
- - Ensure named exports are added to default export in optimised modules ([#112](https://github.com/rollup/rollup-plugin-commonjs/issues/112))
469
-
470
- ## 5.0.3
471
-
472
- - Respect custom `namedExports` in optimised modules ([#35](https://github.com/rollup/rollup-plugin-commonjs/issues/35))
473
-
474
- ## 5.0.2
475
-
476
- - Replace `require` (outside call expressions) with `commonjsRequire` helper ([#77](https://github.com/rollup/rollup-plugin-commonjs/issues/77), [#83](https://github.com/rollup/rollup-plugin-commonjs/issues/83))
477
-
478
- ## 5.0.1
479
-
480
- - Deconflict against globals ([#84](https://github.com/rollup/rollup-plugin-commonjs/issues/84))
481
-
482
- ## 5.0.0
483
-
484
- - Optimise modules that don't need to be wrapped in a function ([#106](https://github.com/rollup/rollup-plugin-commonjs/pull/106))
485
- - Ignore modules containing `import` and `export` statements ([#96](https://github.com/rollup/rollup-plugin-commonjs/pull/96))
486
-
487
- ## 4.1.0
488
-
489
- - Ignore dead branches ([#93](https://github.com/rollup/rollup-plugin-commonjs/issues/93))
490
-
491
- ## 4.0.1
492
-
493
- - Fix `ignoreGlobal` option ([#86](https://github.com/rollup/rollup-plugin-commonjs/pull/86))
494
-
495
- ## 4.0.0
496
-
497
- - Better interop and smaller output ([#92](https://github.com/rollup/rollup-plugin-commonjs/pull/92))
498
-
499
- ## 3.3.1
500
-
501
- - Deconflict export and local module ([rollup/rollup#554](https://github.com/rollup/rollup/issues/554))
502
-
503
- ## 3.3.0
504
-
505
- - Keep the order of execution for require calls ([#43](https://github.com/rollup/rollup-plugin-commonjs/pull/43))
506
- - Use interopDefault as helper ([#42](https://github.com/rollup/rollup-plugin-commonjs/issues/42))
507
-
508
- ## 3.2.0
509
-
510
- - Use named exports as a function when no default export is defined ([#524](https://github.com/rollup/rollup/issues/524))
511
-
512
- ## 3.1.0
513
-
514
- - Replace `typeof require` with `'function'` ([#38](https://github.com/rollup/rollup-plugin-commonjs/issues/38))
515
- - Don't attempt to resolve entry file relative to importer ([#63](https://github.com/rollup/rollup-plugin-commonjs/issues/63))
516
-
517
- ## 3.0.2
518
-
519
- - Handle multiple references to `global`
520
-
521
- ## 3.0.1
522
-
523
- - Return a `name`
524
-
525
- ## 3.0.0
526
-
527
- - Make `transform` stateless ([#71](https://github.com/rollup/rollup-plugin-commonjs/pull/71))
528
- - Support web worker `global` ([#50](https://github.com/rollup/rollup-plugin-commonjs/issues/50))
529
- - Ignore global with `options.ignoreGlobal` ([#48](https://github.com/rollup/rollup-plugin-commonjs/issues/48))
530
-
531
- ## 2.2.1
532
-
533
- - Prevent false positives with `namedExports` ([#36](https://github.com/rollup/rollup-plugin-commonjs/issues/36))
534
-
535
- ## 2.2.0
536
-
537
- - Rewrite top-level `this` expressions to mean the same as `global` ([#31](https://github.com/rollup/rollup-plugin-commonjs/issues/31))
538
-
539
- ## 2.1.0
540
-
541
- - Optimised module wrappers ([#20](https://github.com/rollup/rollup-plugin-commonjs/pull/20))
542
- - Allow control over named exports via `options.namedExports` ([#18](https://github.com/rollup/rollup-plugin-commonjs/issues/18))
543
- - Handle bare imports correctly ([#23](https://github.com/rollup/rollup-plugin-commonjs/issues/23))
544
- - Blacklist all reserved words as export names ([#21](https://github.com/rollup/rollup-plugin-commonjs/issues/21))
545
- - Configure allowed file extensions via `options.extensions` ([#27](https://github.com/rollup/rollup-plugin-commonjs/pull/27))
546
-
547
- ## 2.0.0
548
-
549
- - Support for transpiled modules – `exports.default` is used as the default export in place of `module.exports`, if applicable, and `__esModule` is not exported ([#16](https://github.com/rollup/rollup-plugin-commonjs/pull/16))
550
-
551
- ## 1.4.0
552
-
553
- - Generate sourcemaps by default
554
-
555
- ## 1.3.0
556
-
557
- - Handle references to `global` ([#6](https://github.com/rollup/rollup-plugin-commonjs/issues/6))
558
-
559
- ## 1.2.0
560
-
561
- - Generate named exports where possible ([#5](https://github.com/rollup/rollup-plugin-commonjs/issues/5))
562
- - Handle shadowed `require`/`module`/`exports`
563
-
564
- ## 1.1.0
565
-
566
- - Handle dots in filenames ([#3](https://github.com/rollup/rollup-plugin-commonjs/issues/3))
567
- - Wrap modules in IIFE for more readable output
568
-
569
- ## 1.0.0
570
-
571
- - Stable release, now that Rollup supports plugins
572
-
573
- ## 0.2.1
574
-
575
- - Allow mixed CommonJS/ES6 imports/exports
576
- - Use `var` instead of `let`
577
-
578
- ## 0.2.0
579
-
580
- - Sourcemap support
581
- - Support `options.include` and `options.exclude`
582
- - Bail early if module is obviously not a CommonJS module
583
-
584
- ## 0.1.1
585
-
586
- Add dist files to package (whoops!)
587
-
588
- ## 0.1.0
589
-
590
- - First release