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