* Lint against CJS globals in modules
* Use `import.meta.url` instead of `__filename` in `src` files
* Prepare fixtures runner for `import.meta.url`
* Use `import.meta.url` instead of `__filename` in `test/index` files
* Remove `__dirname` from remaining test files
dirname
* Avoid using `module` in `src` files
* Avoid using `require` in `src` files
* Avoid using `require` in `test` files
* Update `@types/node`
* Compile dynamic import in `@babel/node`
* Fix windows
* Use `@babel/plugin-proposal-dynamic-import` from npm
These are now enabled by default:
- objectRestSpread (2018)
- asyncGenerators (2018)
- optionalCatchBInding (2019)
- jsonStrings (2019)
TODO (after this commit):
- [ ] Deprecate the `@babel/plugin-syntax-*` packages.
- [ ] Deprecate the `@babel/plugin-proposal-*` packages.
- [ ] Create the `@babel/plugin-transform-*` packages.
* Fix default sourceFileName.
This deals with a problem mentioned in [babel/babelify#255][0]. I'm not
super sure about the implications, but it seems this may have been a
regression from Babel 6.
In babel@6, the default `sourceFileName` was the basename of the input
file:
```js
require('babel-core').transform('var a = 10', {
filename: __filename,
sourceMaps: true
}).map
// { version: 3,
// sources: [ 'index.js' ],
// names: [ 'a' ],
// mappings: 'AAAA,IAAIA,IAAI,EAAR',
// file: 'index.js',
// sourcesContent: [ 'var a = 10' ] } }
```
Currently however, the full file path is used:
```js
require('@babel/core').transformSync('var a = 10', {
filename: __filename,
sourceMaps: true
}).map
// { version: 3,
// sources: [ '/home/goto-bus-stop/Code/babel/repro-babelify-255/index.js' ],
// names: [ 'a' ],
// mappings: 'AAAA,IAAIA,IAAI,EAAR',
// file: '/home/goto-bus-stop/Code/babel/repro-babelify-255/index.js',
// sourcesContent: [ 'var a = 10' ] } }
```
This patch adds the `path.basename()` call that [Babel 6 used][1] to
@babel/core's default options, so it's the same as back then.
```js
require('../babel/packages/babel-core').transform('var a = 10', {
filename: __filename,
sourceMaps: true
}).map
// { version: 3,
// sources: [ 'index.js' ],
// names: [ 'a' ],
// mappings: 'AAAA,IAAIA,IAAI,EAAR',
// sourcesContent: [ 'var a = 10' ] }
```
This is the desired behaviour for browserify at least, as it expects
relative paths in the source maps and rebases them to a root directory
when generating the final source map.
[0]: https://github.com/babel/babelify/pull/255
[1]: 6689d2d23c/packages/babel-core/src/transformation/file/index.js (L163-L172)
* Use cwd-relative path for sourceFileName.
* Revert sourceMap `file` property change.
* fixup! Revert sourceMap `file` property change.
* Fix whitespace change from merge conflict
* Revert to using basename in source map outputs.
* Handling babylon parsing errors in a better way
* Better error messages + Helpful URLs
* Replaced message from babylon completely
* Add importMeta plugin to the map
* Remove whitespace generation and rely on default printing
Changes to printing:
* Add newline after last empty SwitchCase
* Add newlines around block comments if they are non-flow comments or contain newlines
* Fix a few more fixtures