@rollup/plugin-commonjs 18.0.0 → 19.0.2
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 +36 -0
- package/README.md +46 -1
- package/dist/index.es.js +443 -323
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +443 -323
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @rollup/plugin-commonjs ChangeLog
|
|
2
2
|
|
|
3
|
+
## v19.0.2
|
|
4
|
+
|
|
5
|
+
_2021-07-26_
|
|
6
|
+
|
|
7
|
+
### Bugfixes
|
|
8
|
+
|
|
9
|
+
- fix convert module.exports with `__esModule` property(#939) (#942)
|
|
10
|
+
|
|
11
|
+
## v19.0.1
|
|
12
|
+
|
|
13
|
+
_2021-07-15_
|
|
14
|
+
|
|
15
|
+
### Bugfixes
|
|
16
|
+
|
|
17
|
+
- fix: short-circuit to actual module entry point when using circular ref through a different entry (#888)
|
|
18
|
+
|
|
19
|
+
## v19.0.0
|
|
20
|
+
|
|
21
|
+
_2021-05-07_
|
|
22
|
+
|
|
23
|
+
### Breaking Changes
|
|
24
|
+
|
|
25
|
+
- feat!: Add support for circular dependencies (#658)
|
|
26
|
+
|
|
27
|
+
## v18.1.0
|
|
28
|
+
|
|
29
|
+
_2021-05-04_
|
|
30
|
+
|
|
31
|
+
### Bugfixes
|
|
32
|
+
|
|
33
|
+
- fix: idempotence issue (#871)
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
- feat: Add `defaultIsModuleExports` option to match Node.js behavior (#838)
|
|
38
|
+
|
|
3
39
|
## v18.0.0
|
|
4
40
|
|
|
5
41
|
_2021-03-26_
|
package/README.md
CHANGED
|
@@ -174,6 +174,49 @@ If you set `esmExternals` to `true`, this plugins assumes that all external depe
|
|
|
174
174
|
|
|
175
175
|
You can also supply an array of ids to be treated as ES modules, or a function that will be passed each external id to determine if it is an ES module.
|
|
176
176
|
|
|
177
|
+
### `defaultIsModuleExports`
|
|
178
|
+
|
|
179
|
+
Type: `boolean | "auto"`<br>
|
|
180
|
+
Default: `"auto"`
|
|
181
|
+
|
|
182
|
+
Controls what is the default export when importing a CommonJS file from an ES module.
|
|
183
|
+
|
|
184
|
+
- `true`: The value of the default export is `module.exports`. This currently matches the behavior of Node.js when importing a CommonJS file.
|
|
185
|
+
```js
|
|
186
|
+
// mod.cjs
|
|
187
|
+
exports.default = 3;
|
|
188
|
+
```
|
|
189
|
+
```js
|
|
190
|
+
import foo from './mod.cjs';
|
|
191
|
+
console.log(foo); // { default: 3 }
|
|
192
|
+
```
|
|
193
|
+
- `false`: The value of the default export is `exports.default`.
|
|
194
|
+
```js
|
|
195
|
+
// mod.cjs
|
|
196
|
+
exports.default = 3;
|
|
197
|
+
```
|
|
198
|
+
```js
|
|
199
|
+
import foo from './mod.cjs';
|
|
200
|
+
console.log(foo); // 3
|
|
201
|
+
```
|
|
202
|
+
- `"auto"`: The value of the default export is `exports.default` if the CommonJS file has an `exports.__esModule === true` property; otherwise it's `module.exports`. This makes it possible to import
|
|
203
|
+
the default export of ES modules compiled to CommonJS as if they were not compiled.
|
|
204
|
+
```js
|
|
205
|
+
// mod.cjs
|
|
206
|
+
exports.default = 3;
|
|
207
|
+
```
|
|
208
|
+
```js
|
|
209
|
+
// mod-compiled.cjs
|
|
210
|
+
exports.__esModule = true;
|
|
211
|
+
exports.default = 3;
|
|
212
|
+
```
|
|
213
|
+
```js
|
|
214
|
+
import foo from './mod.cjs';
|
|
215
|
+
import bar from './mod-compiled.cjs';
|
|
216
|
+
console.log(foo); // { default: 3 }
|
|
217
|
+
console.log(bar); // 3
|
|
218
|
+
```
|
|
219
|
+
|
|
177
220
|
### `requireReturnsDefault`
|
|
178
221
|
|
|
179
222
|
Type: `boolean | "namespace" | "auto" | "preferred" | ((id: string) => boolean | "auto" | "preferred")`<br>
|
|
@@ -266,7 +309,9 @@ For these situations, you can change Rollup's behaviour either globally or per m
|
|
|
266
309
|
import * as dep$1 from 'dep';
|
|
267
310
|
|
|
268
311
|
function getDefaultExportFromNamespaceIfNotNamed(n) {
|
|
269
|
-
return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1
|
|
312
|
+
return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1
|
|
313
|
+
? n['default']
|
|
314
|
+
: n;
|
|
270
315
|
}
|
|
271
316
|
|
|
272
317
|
var dep = getDefaultExportFromNamespaceIfNotNamed(dep$1);
|