Skip to content

Commit

Permalink
chore(commonjs): update offending packages
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Jul 27, 2020
1 parent 97c29ff commit 3b10706
Show file tree
Hide file tree
Showing 48 changed files with 1,774 additions and 3,641 deletions.
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,32 @@
"test": "node scripts/run-changed.js test"
},
"dependencies": {
"@ava/babel": "^1.0.1",
"conventional-commits-parser": "^3.1.0",
"semver": "^7.1.1",
"semver": "^7.3.2",
"write-pkg": "^4.0.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.5.0",
"@typescript-eslint/parser": "^3.5.0",
"ava": "^2.4.0",
"@typescript-eslint/eslint-plugin": "^3.7.0",
"@typescript-eslint/parser": "^3.7.0",
"ava": "^3.11.0",
"chalk": "^2.4.2",
"codecov-lite": "^0.3.1",
"del-cli": "^3.0.0",
"del-cli": "^3.0.1",
"eslint-config-rollup": "^0.1.0",
"execa": "^2.1.0",
"globby": "^10.0.1",
"globby": "^10.0.2",
"husky": "^3.1.0",
"lint-staged": "^9.5.0",
"nyc": "^14.1.1",
"pnpm": "^4.13.0",
"pnpm": "^4.14.4",
"prettier": "^1.19.1",
"prettier-plugin-package": "^0.3.1",
"ts-node": "^8.5.4",
"ts-node": "^8.10.2",
"tsconfig-paths": "^3.9.0",
"tslib": "^1.10.0",
"typescript": "^3.7.4",
"yaml": "^1.7.2"
"tslib": "^1.13.0",
"typescript": "^3.9.7",
"yaml": "^1.10.0"
},
"ava": {
"files": [
Expand Down
12 changes: 7 additions & 5 deletions packages/alias/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@
"slash": "^3.0.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^7.0.0",
"@rollup/plugin-typescript": "^3.0.0",
"del-cli": "^3.0.0",
"rollup": "^2.0.0"
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-typescript": "^3.1.1",
"del-cli": "^3.0.1",
"rollup": "^2.23.0"
},
"ava": {
"compileEnhancements": false,
"babel": {
"compileEnhancements": false
},
"extensions": [
"ts"
],
Expand Down
4 changes: 3 additions & 1 deletion packages/auto-install/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
"rollup": "^2.0.0"
},
"ava": {
"compileEnhancements": false,
"babel": {
"compileEnhancements": false
},
"extensions": [
"ts"
],
Expand Down
4 changes: 3 additions & 1 deletion packages/auto-install/test/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ test('invalid manager', (t) => {
},
plugins: [autoInstall({ pkgFile, manager: 'foo' }), resolve()]
}),
RangeError
{
instanceOf: RangeError
}
);
t.snapshot(error.message);
});
Expand Down
23 changes: 13 additions & 10 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,25 @@
"rollup": "^1.20.0||^2.0.0"
},
"dependencies": {
"@babel/helper-module-imports": "^7.7.4",
"@rollup/pluginutils": "^3.0.8"
"@babel/helper-module-imports": "^7.10.4",
"@rollup/pluginutils": "^3.1.0"
},
"devDependencies": {
"@babel/core": "^7.7.4",
"@babel/plugin-external-helpers": "^7.7.4",
"@babel/plugin-proposal-decorators": "^7.7.4",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.4",
"@babel/preset-env": "^7.9.0",
"@rollup/plugin-json": "^4.0.0",
"@babel/core": "^7.10.5",
"@babel/plugin-external-helpers": "^7.10.4",
"@babel/plugin-proposal-decorators": "^7.10.5",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.10.5",
"@babel/preset-env": "^7.10.4",
"@rollup/plugin-json": "^4.1.0",
"@types/babel__core": "^7.1.9",
"rollup": "^2.0.0",
"rollup": "^2.23.0",
"source-map": "^0.6.1"
},
"ava": {
"babel": {
"compileEnhancements": false
},
"files": [
"!**/fixtures/**",
"!**/helpers/**",
Expand Down
1 change: 1 addition & 0 deletions packages/babel/test/as-input-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async function generate(input, babelOptions = {}, generateOptions = {}, rollupOp

return getCode(bundle, {
format: 'cjs',
exports: 'auto',
...generateOptions
});
}
Expand Down
1 change: 1 addition & 0 deletions packages/babel/test/as-output-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async function generate(input, babelOptions = {}, generateOptions = {}, rollupOp

return getCode(bundle, {
format: 'cjs',
exports: 'auto',
plugins: [getBabelOutputPlugin(babelOptions)],
...generateOptions
});
Expand Down
3 changes: 3 additions & 0 deletions packages/beep/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
"strip-ansi": "^5.2.0"
},
"ava": {
"babel": {
"compileEnhancements": false
},
"files": [
"!**/fixtures/**",
"!**/helpers/**",
Expand Down
14 changes: 8 additions & 6 deletions packages/buble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,21 @@
"rollup": "^1.20.0||^2.0.0"
},
"dependencies": {
"@rollup/pluginutils": "^3.0.8",
"@rollup/pluginutils": "^3.1.0",
"@types/buble": "^0.19.2",
"buble": "^0.20.0"
},
"devDependencies": {
"@rollup/plugin-typescript": "^3.0.0",
"del-cli": "^3.0.0",
"rollup": "^2.0.0",
"@rollup/plugin-typescript": "^3.1.1",
"del-cli": "^3.0.1",
"rollup": "^2.23.0",
"source-map": "^0.7.3",
"typescript": "^3.7.4"
"typescript": "^3.9.7"
},
"ava": {
"compileEnhancements": false,
"babel": {
"compileEnhancements": false
},
"extensions": [
"ts"
],
Expand Down
46 changes: 26 additions & 20 deletions packages/commonjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ import * as foo from 'foo';
```

This is in line with how other bundlers handle this situation and is also the most likely behaviour in case Node should ever support this. However there are some situations where this may not be desired:

- There is code in an external dependency that cannot be changed where a `require` statement expects the default export to be returned from an ES module.
- If the imported module is in the same bundle, Rollup will generate a namespace object for the imported module which can increase bundle size unnecessarily:

Expand All @@ -168,15 +168,15 @@ This is in line with how other bundlers handle this situation and is also the mo

// input: dep.js
export default 'foo';

// output
var dep = 'foo';
var dep$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': dep

var dep$1 = /*#__PURE__*/ Object.freeze({
__proto__: null,
default: dep
});

console.log(dep$1.default);
```

Expand All @@ -191,22 +191,26 @@ For these situations, you can change Rollup's behaviour either globally or per m
// output
import * as dep from 'dep';
console.log(dep);
```
- `"auto"`: This is complementary to how [`output.exports`](https://rollupjs.org/guide/en/#outputexports): `"auto"` works in Rollup: If a module has a default export and no named exports, requiring that module returns the default export. In all other cases, the namespace is returned. For external dependencies when using `esmExternals: true`, a corresponding interop helper is added:
```js
// output
import * as dep$1 from 'dep';
function getDefaultExportFromNamespaceIfNotNamed (n) {
return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
function getDefaultExportFromNamespaceIfNotNamed(n) {
return n &&
Object.prototype.hasOwnProperty.call(n, 'default') &&
Object.keys(n).length === 1
? n['default']
: n;
}
var dep = getDefaultExportFromNamespaceIfNotNamed(dep$1);
console.log(dep);
```
Expand All @@ -215,13 +219,15 @@ For these situations, you can change Rollup's behaviour either globally or per m
```js
// output
import * as dep$1 from 'dep';
function getDefaultExportFromNamespaceIfPresent (n) {
return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
function getDefaultExportFromNamespaceIfPresent(n) {
return n && Object.prototype.hasOwnProperty.call(n, 'default')
? n['default']
: n;
}
var dep = getDefaultExportFromNamespaceIfPresent(dep$1);
console.log(dep);
```
Expand All @@ -230,7 +236,7 @@ For these situations, you can change Rollup's behaviour either globally or per m
```js
// output
import dep from 'dep';
console.log(dep);
```
Expand Down
3 changes: 3 additions & 0 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
"typescript": "^3.9.7"
},
"ava": {
"babel": {
"compileEnhancements": false
},
"files": [
"!**/fixtures/**",
"!**/helpers/**",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const externalNamed = require('external-esm-named');
const externalMixed = require('external-esm-mixed');
const externalDefault = require('external-esm-default');

const mixedExports = require('./mixed.js');
const defaultExport = require('./default.js');

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * as default from './other.js';
import * as other from './other.js';

export default other;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import external from 'external-esm-default';

import dep from './dep';

t.is(dep, 'default');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import external, { foo } from 'external-esm-mixed';

import dep, { named } from './dep';

t.is(dep, 'default');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { foo } from 'external-esm-named';

import { named } from './dep';

t.is(named, 'named');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as external from 'external-esm-default';

import * as dep from './dep';

t.deepEqual(dep, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as external from 'external-esm-mixed';

import * as dep from './dep';

t.deepEqual(dep, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as external from 'external-esm-named';

import * as dep from './dep';

t.deepEqual(dep, {
Expand Down
6 changes: 3 additions & 3 deletions packages/commonjs/test/snapshots/function.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The actual snapshot is saved in `function.js.snap`.

Generated by [AVA](https://ava.li).
Generated by [AVA](https://avajs.dev).

## assign-properties-to-default-export

Expand Down Expand Up @@ -3917,13 +3917,13 @@ Generated by [AVA](https://ava.li).
const foo = 'foo';␊
var other = 'bar';␊
var dep = /*#__PURE__*/Object.freeze({␊
var other$1 = /*#__PURE__*/Object.freeze({␊
__proto__: null,␊
foo: foo,␊
'default': other␊
});␊
t.deepEqual(dep, { default: 'bar', foo: 'foo' });␊
t.deepEqual(other$1, { default: 'bar', foo: 'foo' });␊
var main = {␊
Expand Down
Binary file modified packages/commonjs/test/snapshots/function.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/commonjs/test/snapshots/test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The actual snapshot is saved in `test.js.snap`.

Generated by [AVA](https://ava.li).
Generated by [AVA](https://avajs.dev).

## can spread an object into module.exports

Expand Down
4 changes: 3 additions & 1 deletion packages/data-uri/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
"typescript": "^3.7.4"
},
"ava": {
"compileEnhancements": false,
"babel": {
"compileEnhancements": false
},
"extensions": [
"ts"
],
Expand Down
9 changes: 6 additions & 3 deletions packages/dsv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@
"LICENSE"
],
"dependencies": {
"@rollup/pluginutils": "^3.0.4",
"@rollup/pluginutils": "^3.1.0",
"d3-dsv": "1.2.0",
"tosource": "^1.0.0"
},
"devDependencies": {
"del-cli": "^3.0.0",
"rollup": "^2.0.0"
"del-cli": "^3.0.1",
"rollup": "^2.23.0"
},
"ava": {
"babel": {
"compileEnhancements": false
},
"files": [
"!**/fixtures/**",
"!**/helpers/**",
Expand Down
Loading

0 comments on commit 3b10706

Please sign in to comment.