Compare commits

...

94 Commits

Author SHA1 Message Date
Henry Zhu
663c96db04 v7.0.0-beta.52 2018-07-05 20:59:03 -04:00
Rubén Norte
85b7154f91 Add visitor key for Flow typeArguments in call expressions (#8273)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | Fixes #8272 <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix?          | Yes
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

The visitor for `typeArguments` in function calls wasn't set in the definition, so type annotations added there weren't visited.

This is required to fix https://github.com/babel/babel-eslint/issues/644
2018-07-05 14:58:15 -05:00
Henry Zhu
f70d7c8dfe update template [skip ci]
link to babel/website
2018-07-05 14:19:15 -04:00
Justin Ridgewell
e229ebbb8a Optimize async to generator (#8267)
* Optimize async to generator

We can reuse the step function, avoiding a closure on every invocation.

* Rename step
2018-07-05 10:51:16 -04:00
dnalborczyk
db1385fb82 upgrades eslint v5 (major), babel-eslint, eslint-plugin-flowtype, eslint-plugin-prettier (#8259)
* upgrade eslint v5 (major), babel-eslint (minor), eslint-plugin-flowtype (minor), eslint-plugin-prettier (patch)

* fix makefile: remove (default) .js file extension, remove non-existing glob pattern

* fix linting errors

* add '*.js' glob back to include babel.config.js for linting
2018-07-05 09:17:01 -05:00
Logan Smyth
b6eba87daa Rename some test fixtures so they run properly. (#8265) 2018-07-04 18:33:26 -07:00
Logan Smyth
2cf2fd544b Ensure that we don't get unexpected output files for tests that throw. (#8208) 2018-07-04 16:06:58 -07:00
Logan Smyth
9bd4b46fd6 Merge pull request #8198 from loganfsmyth/sourcemap-loading
Prefer explicit object maps, and properly load relative maps.
2018-07-04 15:39:42 -07:00
Pierre-Marie Dartus
4d125c391a Typescript: Avoid stripping class properties when a decorator is set (#8238)
The `babel-plugin-transform-typescript` removes class properties without value regardless if decorators are assigned to it or not.
2018-07-04 07:44:33 -04:00
dnalborczyk
afa1207224 upgrade flow to v0.75.0 (#8256) 2018-07-03 11:23:32 -05:00
Rodolfo Rodriguez
c6a4108e57 Update READMEs for yarn (#8215) [skip ci]
Closes https://github.com/babel/babel/pull/8255
2018-07-03 09:03:18 -04:00
John Buffington
236bd9309c remove emojis from cli output (#8243) (#8250) 2018-07-02 09:34:55 +02:00
James DiGioia
eac4c5bc17 Add proposal flag to pipeline plugin (#8196)
This is going to be required so we can add support for other proposals,
as well as later set the accepted proposal as the default.

Update stage-0 and stage-1 presets with `pipelineProposal` to thread down to
the plugin.
2018-06-28 01:19:40 +02:00
Mateusz Burzyński
e1662759ed Remove regenerator hacks in checkDuplicatedNodes (#8220) 2018-06-24 15:40:47 +02:00
Ben Newman
12c75cc08c Update regenerator-{runtime,transform} to latest versions. (#8219)
https://github.com/facebook/regenerator/pull/347
https://github.com/facebook/regenerator/pull/349
https://github.com/facebook/regenerator/pull/350
2018-06-24 10:19:21 +02:00
Sven Sauleau
9283efaeb7 Merge pull request #8197 from loganfsmyth/babel-plugin-allowed
Allow @foo/babel-plugin as an unexpanded plugin name, and @foo as a shorthand for it.
2018-06-20 16:36:03 +02:00
Logan Smyth
532c25c8db Ensure that file-path sourcemaps load relative to the file containing the comment. 2018-06-18 22:06:08 -07:00
Logan Smyth
3c90baaf6c Prefer object sourcemaps over file-inlined sourcemaps. 2018-06-18 21:49:23 -07:00
Logan Smyth
add5f8d0fe Allow @foo/babel-plugin as an unexpanded plugin name, and @foo as a shorthand for it. 2018-06-18 21:36:02 -07:00
Soumya Himanish Mohapatra
cb79473499 remove regression to support output of full directory hierarchy with --out-dir (#8189)
* remove regression to support output of full directory hierarchy with --out-dir

* add mkdirp to package.json
2018-06-18 21:19:46 -07:00
Brian Ng
d383659ca6 Compile against beta 51 (#8158) 2018-06-15 10:28:15 -04:00
Ger Hobbelt
e86d1e0d6a babel/parser: test helpers: write expected throw message to options.json ~ complete jest -u functionality (#8178) [skip ci]
* babel/parser: test helpers: when test fails with an exception and both reference output file and options.json file do not exist, write a simple options.json with the error message to expect when such a file doesn't exist yet. This completes the `jest -u` capability for new tests which are expected to *fail*.
2018-06-15 10:27:19 -04:00
Ger Hobbelt
a2cd264211 jest binary is a bash shell script, not a nodeJS file. (#8179) [skip ci] 2018-06-15 10:18:14 -04:00
Sven Sauleau
8f8b4e8e82 Switch new website in READMEs (#8181) [skip ci] 2018-06-15 10:13:20 -04:00
Ger Hobbelt
07c88e6f0b Use charCodes at more places in the parser (#8176) 2018-06-15 13:21:32 +02:00
Ger Hobbelt
ba98cf782a Removed constant condition in parser (#8177) 2018-06-15 13:14:14 +02:00
kenju
bc64e02bf8 fix issue number of link for #3508 in CHANGELOG (#8175) [skip ci] 2018-06-15 12:12:21 +02:00
dnalborczyk
814fce946d bump flow to v0.74.0 (#8162) 2018-06-13 15:00:09 -04:00
dnalborczyk
6894465df8 fix flow typeof refinement (#8161) [skip ci] 2018-06-13 14:59:57 -04:00
Ben Newman
60c4f30c71 Update regenerator-transform to latest version (0.13.0). (#8154)
| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | None
| Patch: Bug Fix?          | No
| Major: Breaking Change?  | No
| Minor: New Feature?      | No
| Tests Added + Pass?      | Existing tests pass
| Documentation PR         | No
| Any Dependency Changes?  | `regenerator-transform` in `@babel/plugin-transform-regenerator`
| License                  | MIT

I recently updated `regenerator`, `regenerator-transform`, and `regenerator-preset` to fix a number of vulnerabilities surfaced by `npm audit`. There was no need to update `regenerator-runtime`, as it does not have any dependencies of its own. I'm happy to report the latest versions of these packages have zero vulnerability warnings according to `npm audit`.

While I was at it, I also updated all dependencies of these packages to their Babel 7 equivalents, so there should hopefully be fewer legacy package dependencies installed because of Regenerator.
2018-06-13 09:36:27 -05:00
Henry Zhu
c313b267f7 v7.0.0-beta.51 2018-06-12 17:18:28 -04:00
Henry Zhu
eb54adb755 use a semver range for core peerDep [skip ci] 2018-06-12 17:10:15 -04:00
Henry Zhu
e0ef50c00f Use older semver range since lerna update does not change peerDeps on publish [skip ci] (#8152) 2018-06-12 16:45:10 -04:00
Henry Zhu
3af623678f v7.0.0-beta.50 2018-06-12 15:46:05 -04:00
Henry Zhu
96528d36df keep lerna version 2018-06-12 15:22:34 -04:00
Henry Zhu
5de12c26f6 update to latest 2.x lerna 2018-06-12 15:02:56 -04:00
Henry Zhu
4b5a55d937 fix merge issue again 2018-06-12 13:59:43 -04:00
Guy Bedford
036c429ce1 system hoisting and export refinements (#8104) 2018-06-12 13:45:53 -04:00
Nicolò Ribaudo
3c46e75b8f Don't split an exported class when renaming an inner binding (#8051) 2018-06-12 13:45:21 -04:00
晏兵兵
106907e605 fix: import Parser as type (#8146) [skip ci] 2018-06-12 13:42:10 -04:00
Nicolò Ribaudo
387cda8fbb isConstantExpression should return true for immuable bindings (#8122)
* isConstantExpression should return true for immuable bindings

* New test

* Don't return undefined
2018-06-12 13:40:52 -04:00
Henry Zhu
86c10ff4f3 fix merge issue 2018-06-12 13:33:07 -04:00
Miguel Albernaz
6d5392554f Adds JSXFragment to plugin-transform-typescript check for the presence of jsx (#7996) 2018-06-12 13:17:25 -04:00
Alexey Zaslavsky
0b25e3327c Fix 'Missing class properties transform' error when parsing class properties with Typescript syntax (#8007) 2018-06-12 13:13:30 -04:00
Brian Ng
b6455c611b Allow ts modifier names to be used as function argument names (#8030) 2018-06-12 08:38:38 -05:00
Yuri Karadzhov
313960e601 Remove preset-env outdated test (#8149) 2018-06-12 08:51:11 -04:00
Yuri Karadzhov
9e4c56f990 Fix Safari TP and regular versions comparison (#8132) 2018-06-11 14:36:45 -04:00
Nicolò Ribaudo
119db23ee3 Don't regenerate babel-types docs in the readme (#8142) 2018-06-11 14:35:21 -04:00
Vincent Chan
3432792568 add jsesc options support (#8143) 2018-06-11 14:34:41 -04:00
Brian Ng
cc4ee350e4 Ensure regex-dot-all runs before unicode-regex in preset-env (#8138)
<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | --
| Patch: Bug Fix?          |
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

Good ol' plugin ordering 🙃

Ref: https://github.com/babel/babel/pull/7065#issuecomment-395959112
2018-06-11 08:09:44 -05:00
Sven Sauleau
5bd79c70a5 Merge pull request #8144 from BeniCheni/add-labels-to-readmes
Add Labels to READMEs Generator & Update README's w. Links To Open Issues (for some pkg's)
2018-06-11 07:32:34 +02:00
BeniCheni
01f6f4c66d Revert babel-types README to "master" 2018-06-11 01:19:18 -04:00
BeniCheni
000fa83b9e For selective packages, update READMES w. links for open issues
babel-generator; babel-node; babel-standalone; babel-template
2018-06-11 00:16:48 -04:00
BeniCheni
efb34aa7dc For selective packages, add items for labels mapping of pkg => labels & update READMES w. links for open issues
babel-generator; babel-node; babel-standalone; babel-template
2018-06-10 23:41:55 -04:00
Brian Ng
ab928713af Bump test262-stream and update test262 tests (#8139) 2018-06-10 10:55:40 +02:00
Serhii Nanovskyi
3de053cc6c Validate @babel/preset-env options (#8031) 2018-06-09 18:38:14 -05:00
Sven Sauleau
110779e9f3 Merge pull request #8133 from alexzherdev/8131-open-issues-link
Link to open issues in READMEs [skip ci]
2018-06-09 15:03:49 +02:00
Alex Zherdev
8070a2204d Link to open issues in READMEs [skip ci] 2018-06-08 20:54:44 -07:00
Nicolò Ribaudo
9f4e2f81d8 [class-properties] Remove unnecessary return and temp variable (#8123)
* Remove unnecessary temp variable

* Update tests
2018-06-08 07:02:36 +02:00
Mathias Bynens
415d79bdfe Update plugin-proposal-unicode-property-regex for Unicode v11 (#8127)
Ref. https://github.com/tc39/ecma262/pulls/1218.
Ref. https://github.com/tc39/ecma262/issues/1219.
2018-06-07 21:54:44 +02:00
Mathias Bynens
62eb32677c ECMAScript follows the latest version of the Unicode Standard. Earlier this week, Unicode v11 was officially released. This patch updates babel-parser to support the new identifier characters. (#8125)
Ref. https://github.com/tc39/ecma262/issues/1219.
2018-06-07 21:54:12 +02:00
Guy Bedford
7da7e760a6 support import.meta in system transform 2018-06-07 13:24:19 -05:00
hassanAli321
bd44902024 update fixture 2018-06-07 13:22:45 -05:00
hassanAli321
6480ae4a9f fix flow-double-nullable-type-cant-be-parsed 2018-06-07 13:22:45 -05:00
Marco Massarotto
80b3362fcc update micromatch to ^3.1.10 (#8038) 2018-06-06 12:44:02 +02:00
Sven SAULEAU
8bc0182489 Merge pull request #8119 from palashmon/fix-package-readmes
fix(typo): in readmes package label
2018-06-05 19:24:25 +02:00
Palash Mondal
e9d861537f [skip ci] updated babel-register readme 2018-06-05 22:43:46 +05:30
Palash Mondal
153ad4c6f3 fix(typo): in readmes package label
"babel-regiser" to "babel-register" and "pkg: regiser" to "pkg: register"
2018-06-05 21:19:51 +05:30
Sven SAULEAU
218d69007e Merge pull request #8112 from babel/feat-add-issues-link-in-readmes
Feat add issues link in readmes
2018-06-05 07:39:41 +02:00
Nicolò Ribaudo
f838a7e9f1 Test on node 10 (#7908)
* Use node 10 on circle an node 9 on travis

* Update v8flag
2018-06-04 22:22:30 +02:00
Nicolò Ribaudo
6349118bed Change decoratorsBeforeExport default to false (#8113) 2018-06-04 21:12:01 +02:00
Sven SAULEAU
8bbb10c021 chore: [skip ci] regen READMEs 2018-06-04 17:33:21 +02:00
Sven SAULEAU
f614809002 feat: [skip ci] add link to issues in READMEs 2018-06-04 17:33:16 +02:00
Sven SAULEAU
b445b79734 Refactor move docs (#8108)
* feat: [skip] generate readme script

* docs: [skip ci] update READMEs

* docs: [skip ci] fix code block type

* chore: [skip ci] move generator script
2018-06-04 10:32:39 -04:00
Sven SAULEAU
b6eaaa2496 Merge pull request #8107 from babel/xtuc-patch-3
docs: [skip ci] update polyfill README
2018-06-04 08:46:51 +02:00
Sven SAULEAU
e2471337f4 docs: [skip ci] update polyfill README 2018-06-04 08:46:08 +02:00
Sven SAULEAU
826edd0bd5 Merge pull request #8106 from babel/xtuc-patch-3
update runtime README
2018-06-04 08:43:15 +02:00
Sven SAULEAU
f434a50829 docs: update runtime README 2018-06-04 08:42:48 +02:00
Brian Ng
5895277b32 Bump prettier to v1.13.2 2018-06-03 07:54:39 -05:00
Brian Ng
62114b807b Remove unneeded prettier call in make fix 2018-06-03 07:54:39 -05:00
chocolateboy
2abd7839e1 Fix ReferenceError in the wrapNativeSuper helper (#8100)
Fix a ReferenceError caused by a typo (`_construct` instead of
`construct`) in the external `wrapNativeSuper` helper. (The typo
doesn't usually cause an error in inline helpers because `_construct`
happens to be the default name given to the `construct` helper
function.)
2018-06-02 18:00:02 +02:00
Nicolò Ribaudo
b8dcd6f593 Remove parser support for decorators optional parentheses (#8037)
* Remove parser support for decorators optional parentheses

* Update fixtures
2018-06-02 13:07:15 +02:00
dnalborczyk
fe556c502d fix folder name (#8074) 2018-06-01 17:58:37 +02:00
Peter Leonov
ab62a94399 make isReferenced() recognise ObjectTypeProperty (#8060)
fixes #8057
2018-05-31 00:07:56 +02:00
Nicolò Ribaudo
d83d141e00 Move tests from babylon/ to babel-parserr/ 2018-05-30 22:12:33 +02:00
Nicolò Ribaudo
cb17f07ac9 Update syntax-decorators options (#7938)
* Add decoratorsBeforeExport to the syntax plugin
* Require legacy: true, like in the transform plugin
2018-05-30 22:00:18 +02:00
Logan Smyth
21b9b2e42d Avoid a race condition in CLI directory creation. (#8082) 2018-05-30 10:35:08 -07:00
Erik Arvidsson
2a8ebbe7ae Remove parenthesizedArgument (#7981)
The extra field parenthesizedArgument was never set to true. It was
always set to false and the code that read this was incorrectly
checking if extra was present.

Fixes #7957
2018-05-29 13:58:21 -07:00
Brian Ng
9add6d88f5 Update regenerator version and test retain lines fixture (#8072) 2018-05-29 10:46:05 -07:00
ilya
2d2f37fa6c Update core-js to v2.5.7 (#8064) 2018-05-29 09:47:15 -05:00
Erik Arvidsson
7846eaebaa Do not quote JSX attribute keys for IdentifierName (#8045)
Given the following

```js
a = <F new/>
```

We used to generate:

```js
a = React.createElement(F, {"new": true})
```

but now we generate

```js
a = React.createElement(F, {new: true})
```

If you need to quote these (ie for ES3 you can use
transform-property-literals)
2018-05-27 12:48:18 -04:00
Nicolò Ribaudo
d45ee5e025 Add "decoratorsBeforeExport" option to @babel/generator (#7948)
* Add "decoratorsBeforeExport" option to @babel/generator

* Docs
2018-05-27 08:50:26 +02:00
Brian Ng
f699f1bbbf flow@0.73.0 (#8032) 2018-05-25 16:53:23 -05:00
Sam Goldman
f0283572a5 Support Flow's proto modifier syntax for declared classes (#7978)
<!--
Before making a PR please make sure to read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix?          |
| Major: Breaking Change?  | No
| Minor: New Feature?      | Yes
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

See eb815be907 for more information about this feature.
    
The proto modifier indicates that a property declared using `x: T` syntax is actually present on the prototype object of the class, rather than an own property.
    
The proto and static modifiers are mutually exclusive, as class declarations don't simultaneously define the static prototype object, as they do the instance prototype.
    
This syntax is only supported on declared classes, not object types, interfaces, or runtime class declarations, and as such should only appear in library definitions.
2018-05-25 15:40:56 -05:00
729 changed files with 6298 additions and 14510 deletions

View File

@@ -34,7 +34,7 @@ jobs:
build:
working_directory: ~/babel
docker:
- image: circleci/node:9
- image: circleci/node:10
steps:
- checkout
- restore-cache: *restore-yarn-cache

View File

@@ -1,8 +1,10 @@
<!--
Before making a PR please make sure to read our contributing guidelines
Before making a PR, please read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)
If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
-->
| Q                       | A <!--(Can use an emoji 👍) -->
@@ -12,7 +14,7 @@ For issue references: Add a comma-separated list of a [closing word](https://hel
| Major: Breaking Change? |
| Minor: New Feature? |
| Tests Added + Pass? | Yes
| Documentation PR | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Documentation PR Link | <!-- If only readme change, add `[skip ci]` to your commits -->
| Any Dependency Changes? |
| License | MIT

View File

@@ -8,6 +8,7 @@ cache:
- node_modules
node_js:
# We test the latest version on circleci
- '9'
- '8'
- '6'

View File

@@ -2452,7 +2452,7 @@ Also, thanks to [@mucsi96](https://github.com/mucsi96) for catching the extraneo
#### Bug Fix
* `babel-core`
* [#3508](https://github.com/babel/babel/pull/3510) Assign `_this` to `this` when there is no `Superclass` in a `Class` when using class properties. Fixes T7364. ([@ehjay](https://github.com/ehjay))
* [#3508](https://github.com/babel/babel/pull/3508) Assign `_this` to `this` when there is no `Superclass` in a `Class` when using class properties. Fixes T7364. ([@ehjay](https://github.com/ehjay))
The fix correctly set this: `var _this;` -> `var _this = this;`

View File

@@ -1,6 +1,6 @@
MAKEFLAGS = -j1
FLOW_COMMIT = 395e045c18d537fcbbc552a96ef2cdcd70b4ab52
TEST262_COMMIT = 40883f4c6ae17e073dfd03e34f73a6bf8c855595
TEST262_COMMIT = f90a52b39609a620c0854e0bd0b3a906c930fd17
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
export FORCE_COLOR = true
@@ -17,8 +17,6 @@ build: clean clean-lib
# generate flow and typescript typings
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
node scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts
# generate docs
node scripts/generators/docs.js > ./packages/babel-types/README.md
ifneq ("$(BABEL_COVERAGE)", "true")
make build-standalone
make build-preset-env-standalone
@@ -49,12 +47,10 @@ flow:
./node_modules/.bin/flow check --strip-root
lint:
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' '**/.*.js' --format=codeframe --rulesdir="./scripts/eslint_rules"
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --rulesdir="./scripts/eslint_rules"
fix:
# The config is hardcoded because otherwise prettier searches for it and also picks up some broken package.json files from tests
./node_modules/.bin/prettier --config .prettierrc --write --ignore-path .eslintignore '**/*.json'
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' '**/.*.js' --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
clean: test-clean
rm -rf packages/babel-polyfill/browser*

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/plugin-codemod-object-assign-to-object-spread",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Transforms Object.assign into object spread syntax",
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-object-assign-to-object-spread",
"license": "MIT",
@@ -10,14 +10,14 @@
"@babel/plugin"
],
"dependencies": {
"@babel/plugin-syntax-object-rest-spread": "7.0.0-beta.49"
"@babel/plugin-syntax-object-rest-spread": "7.0.0-beta.52"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.49"
"@babel/core": ">=7.0.0-beta.50 <7.0.0-rc.0"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.49",
"@babel/helper-plugin-test-runner": "7.0.0-beta.49"
"@babel/core": "7.0.0-beta.52",
"@babel/helper-plugin-test-runner": "7.0.0-beta.52"
},
"publishConfig": {
"access": "public"

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/plugin-codemod-optional-catch-binding",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Remove unused catch bindings",
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-remove-unused-catch-binding",
"license": "MIT",
@@ -10,13 +10,13 @@
"@babel/plugin"
],
"dependencies": {
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.49"
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.52"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.49"
"@babel/core": ">=7.0.0-beta.50 <7.0.0-rc.0"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.49",
"@babel/helper-plugin-test-runner": "7.0.0-beta.49"
"@babel/core": "7.0.0-beta.52",
"@babel/helper-plugin-test-runner": "7.0.0-beta.52"
}
}

View File

@@ -1,6 +1,6 @@
{
"lerna": "2.0.0-rc.4",
"version": "7.0.0-beta.49",
"lerna": "2.11.0",
"version": "7.0.0-beta.52",
"changelog": {
"repo": "babel/babel",
"cacheDir": ".changelog",

View File

@@ -160,9 +160,15 @@ declare module "convert-source-map" {
fromComment(str: string): Converter,
fromMapFileComment(str: string): Converter,
fromSource(str: string): Converter,
fromMapFileSource(str: string): Converter,
fromMapFileSource(str: string, dir: string): Converter,
removeComments(str: string): string,
removeMapFileComments(str: string): string,
generateMapFileComment(path: string, options?: ?{ multiline: boolean }): string,
};
}
declare module "js-levenshtein" {
declare module.exports: {
(string, string): number,
};
}

View File

@@ -10,15 +10,15 @@
"test": "make test"
},
"devDependencies": {
"@babel/cli": "7.0.0-beta.48",
"@babel/core": "7.0.0-beta.48",
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.48",
"@babel/preset-env": "7.0.0-beta.48",
"@babel/preset-flow": "7.0.0-beta.48",
"@babel/preset-stage-0": "7.0.0-beta.48",
"@babel/register": "7.0.0-beta.48",
"@babel/cli": "7.0.0-beta.51",
"@babel/core": "7.0.0-beta.51",
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.51",
"@babel/preset-env": "7.0.0-beta.51",
"@babel/preset-flow": "7.0.0-beta.51",
"@babel/preset-stage-0": "7.0.0-beta.51",
"@babel/register": "7.0.0-beta.51",
"babel-core": "^7.0.0-0",
"babel-eslint": "^8.0.1",
"babel-eslint": "^8.2.5",
"babel-jest": "^22.4.1",
"babel-loader": "8.0.0-beta.0",
"babel-plugin-transform-charcodes": "^0.1.0",
@@ -28,11 +28,11 @@
"charcodes": "^0.1.0",
"derequire": "^2.0.2",
"enhanced-resolve": "^3.0.0",
"eslint": "^4.18.2",
"eslint": "^5.0.1",
"eslint-config-babel": "^7.0.2",
"eslint-plugin-flowtype": "^2.20.0",
"eslint-plugin-prettier": "^2.5.0",
"flow-bin": "^0.66.0",
"eslint-plugin-flowtype": "^2.49.3",
"eslint-plugin-prettier": "^2.6.1",
"flow-bin": "^0.75.0",
"graceful-fs": "^4.1.11",
"gulp": "^4.0.0",
"gulp-babel": "^8.0.0-beta.2",
@@ -45,19 +45,19 @@
"gulp-watch": "^5.0.0",
"husky": "^0.14.3",
"jest": "^22.4.2",
"lerna": "2.0.0",
"lerna": "^2.11.0",
"lerna-changelog": "^0.5.0",
"lint-staged": "^6.0.1",
"lodash": "^4.17.5",
"merge-stream": "^1.0.1",
"output-file-sync": "^2.0.0",
"prettier": "1.11.1",
"prettier": "1.13.2",
"pump": "^1.0.2",
"rimraf": "^2.4.3",
"rollup-plugin-babel": "^4.0.0-beta.0",
"rollup-plugin-node-resolve": "^3.0.2",
"rollup-stream": "^1.24.1",
"test262-stream": "^1.1.0",
"test262-stream": "^1.2.0",
"through2": "^2.0.0",
"uglify-js": "^2.4.16",
"vinyl-buffer": "^1.0.1",

View File

@@ -2,20 +2,18 @@
> Babel command line.
In addition, various entry point scripts live in the top-level package at `@babel/cli/bin`.
There is a shell-executable utility script, `babel-external-helpers.js`, and the main Babel cli script, `babel.js`.
See our website [@babel/cli](https://babeljs.io/docs/en/next/babel-cli.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen) associated with this package.
## Install
```sh
npm install --save-dev @babel/core @babel/cli
```
## Usage
Using npm:
```sh
babel script.js
npm install --save-dev @babel/cli
```
For more in depth documentation see: http://babeljs.io/docs/usage/cli/
or using yarn:
```sh
yarn add @babel/cli --dev
```

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/cli",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Babel command line.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
@@ -21,6 +21,7 @@
"fs-readdir-recursive": "^1.0.0",
"glob": "^7.0.0",
"lodash": "^4.17.5",
"mkdirp": "^0.5.1",
"output-file-sync": "^2.0.0",
"slash": "^1.0.0",
"source-map": "^0.5.0"
@@ -29,11 +30,11 @@
"chokidar": "^2.0.3"
},
"peerDependencies": {
"@babel/core": "7.0.0-beta.49"
"@babel/core": ">=7.0.0-beta.50 <7.0.0-rc.0"
},
"devDependencies": {
"@babel/core": "7.0.0-beta.49",
"@babel/helper-fixtures": "7.0.0-beta.49"
"@babel/core": "7.0.0-beta.52",
"@babel/helper-fixtures": "7.0.0-beta.52"
},
"bin": {
"babel": "./bin/babel.js",

View File

@@ -1,5 +1,6 @@
import defaults from "lodash/defaults";
import outputFileSync from "output-file-sync";
import { sync as mkdirpSync } from "mkdirp";
import slash from "slash";
import path from "path";
import fs from "fs";
@@ -71,13 +72,6 @@ export default async function({ cliOptions, babelOptions }) {
return path.join(cliOptions.outDir, filename);
}
function outputDestFolder(outDir) {
const outDirPath = path.resolve(outDir);
if (!fs.existsSync(outDirPath)) {
fs.mkdirSync(outDirPath);
}
}
async function handleFile(src, base) {
const written = await write(src, base);
@@ -122,7 +116,7 @@ export default async function({ cliOptions, babelOptions }) {
util.deleteDir(cliOptions.outDir);
}
outputDestFolder(cliOptions.outDir);
mkdirpSync(cliOptions.outDir);
let compiledFiles = 0;
for (const filename of cliOptions.filenames) {
@@ -130,7 +124,7 @@ export default async function({ cliOptions, babelOptions }) {
}
console.log(
`🎉 Successfully compiled ${compiledFiles} ${
`Successfully compiled ${compiledFiles} ${
compiledFiles !== 1 ? "files" : "file"
} with Babel.`,
);

View File

@@ -1,2 +1,2 @@
src/index.js -> lib/index.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,3 +1,3 @@
src/foo/.foo.js -> lib/foo/.foo.js
src/foo/bar.js -> lib/foo/bar.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1,4 +1,4 @@
src/.foo.js -> lib/.foo.js
src/bar/index.js -> lib/bar/index.js
src/foo/foo.js -> lib/foo/foo.js
🎉 Successfully compiled 3 files with Babel.
Successfully compiled 3 files with Babel.

View File

@@ -1,2 +1,2 @@
src/index.js -> lib/index.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,2 +1,2 @@
src/foo/bar.js -> lib/foo/bar.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,3 +1,3 @@
src/bar/index.js -> lib/bar/index.js
src/foo/foo.js -> lib/foo/foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1,2 +1,2 @@
src/foobar/foo.js -> lib/foobar/foo.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -2,4 +2,4 @@ src/a.js -> lib/a.js
src/b.js -> lib/b.js
src/baz/c.js -> lib/baz/c.js
src/foo.js -> lib/foo.js
🎉 Successfully compiled 4 files with Babel.
Successfully compiled 4 files with Babel.

View File

@@ -1,2 +1,2 @@
src/bar/index.js -> lib/bar/index.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,3 +1,3 @@
src/a.foo.js -> lib/a.foo.js
src/baz/b.foo.js -> lib/baz/b.foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1,2 +1,2 @@
src/bar/index.js -> lib/bar/index.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,2 +1,2 @@
src/foo.js -> lib/foo.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,3 +1,3 @@
src/bar.mjs -> lib/bar.mjs
src/foo.js -> lib/foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -2,4 +2,4 @@ package1/src/bar/bar1.js -> package1/lib/bar/bar1.js
package1/src/foo1.js -> package1/lib/foo1.js
package2/src/bar/bar2.js -> package2/lib/bar/bar2.js
package2/src/foo2.js -> package2/lib/foo2.js
🎉 Successfully compiled 4 files with Babel.
Successfully compiled 4 files with Babel.

View File

@@ -1,3 +1,3 @@
src/bar/bar.js -> lib/bar/bar.js
src/foo.js -> lib/foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1,3 +1,3 @@
src/bar/bar.js -> lib/bar/bar.js
src/foo.js -> lib/foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1,3 +1,3 @@
src/bar/bar.js -> lib/bar/bar.js
src/foo.js -> lib/foo.js
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1 +1 @@
🎉 Successfully compiled 2 files with Babel.
Successfully compiled 2 files with Babel.

View File

@@ -1 +1 @@
🎉 Successfully compiled 0 files with Babel.
Successfully compiled 0 files with Babel.

View File

@@ -1,2 +1,2 @@
src/foo.js -> lib/foo.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -1,2 +1,2 @@
src/foo.js -> lib/foo.js
🎉 Successfully compiled 1 file with Babel.
Successfully compiled 1 file with Babel.

View File

@@ -2,141 +2,18 @@
> Generate errors that contain a code frame that point to source locations.
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/code-frame
```
## Usage
or using yarn:
```js
import { codeFrameColumns } from '@babel/code-frame';
const rawLines = `class Foo {
constructor()
}`;
const location = { start: { line: 2, column: 16 } };
const result = codeFrameColumns(rawLines, location, { /* options */ });
console.log(result);
```
```
1 | class Foo {
> 2 | constructor()
| ^
3 | }
```
If the column number is not known, you may omit it.
You can also pass an `end` hash in `location`.
```js
import { codeFrameColumns } from '@babel/code-frame';
const rawLines = `class Foo {
constructor() {
console.log("hello");
}
}`;
const location = { start: { line: 2, column: 17 }, end: { line: 4, column: 3 } };
const result = codeFrameColumns(rawLines, location, { /* options */ });
console.log(result);
```
```
1 | class Foo {
> 2 | constructor() {
| ^
> 3 | console.log("hello");
| ^^^^^^^^^^^^^^^^^^^^^^^^^
> 4 | }
| ^^^
5 | };
```
## Options
### `highlightCode`
`boolean`, defaults to `false`.
Toggles syntax highlighting the code as JavaScript for terminals.
### `linesAbove`
`number`, defaults to `2`.
Adjust the number of lines to show above the error.
### `linesBelow`
`number`, defaults to `3`.
Adjust the number of lines to show below the error.
### `forceColor`
`boolean`, defaults to `false`.
Enable this to forcibly syntax highlight the code as JavaScript (for non-terminals); overrides `highlightCode`.
### `message`
`string`, otherwise nothing
Pass in a string to be displayed inline (if possible) next to the highlighted
location in the code. If it can't be positioned inline, it will be placed above
the code frame.
```
1 | class Foo {
> 2 | constructor()
| ^ Missing {
3 | };
```
## Upgrading from prior versions
Prior to version 7, the only API exposed by this module was for a single line and optional column pointer. The old API will now log a deprecation warning.
The new API takes a `location` object, similar to what is available in an AST.
This is an example of the deprecated (but still available) API:
```js
import codeFrame from '@babel/code-frame';
const rawLines = `class Foo {
constructor()
}`;
const lineNumber = 2;
const colNumber = 16;
const result = codeFrame(rawLines, lineNumber, colNumber, { /* options */ });
console.log(result);
```
To get the same highlighting using the new API:
```js
import { codeFrameColumns } from '@babel/code-frame';
const rawLines = `class Foo {
constructor() {
console.log("hello");
}
}`;
const location = { start: { line: 2, column: 16 } };
const result = codeFrameColumns(rawLines, location, { /* options */ });
console.log(result);
```sh
yarn add @babel/code-frame --dev
```

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/code-frame",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Generate errors that contain a code frame that point to source locations.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
@@ -8,7 +8,7 @@
"repository": "https://github.com/babel/babel/tree/master/packages/babel-code-frame",
"main": "lib/index.js",
"dependencies": {
"@babel/highlight": "7.0.0-beta.49"
"@babel/highlight": "7.0.0-beta.52"
},
"devDependencies": {
"chalk": "^2.0.0",

View File

@@ -2,249 +2,18 @@
> Babel compiler core.
See our website [@babel/core](https://babeljs.io/docs/en/next/babel-core.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
```javascript
var babel = require("@babel/core");
import { transform } from "@babel/core";
import * as babel from "@babel/core";
## Install
Using npm:
```sh
npm install --save-dev @babel/core
```
All transformations will use your local configuration files (`.babelrc` or in `package.json`). See [options](#options) to disable it.
or using yarn:
## babel.transform(code: string, [options?](#options): Object, callback: Function)
Transforms the passed in `code`. Calling a callback with an object with the generated code,
source map, and AST.
```js
babel.transform(code, options, function(err, result) {
result; // => { code, map, ast }
});
```sh
yarn add @babel/core --dev
```
**Example**
```js
babel.transform("code();", options, function(err, result) {
result.code;
result.map;
result.ast;
});
```
### Compat Note:
In Babel 6, this method was synchronous and `transformSync` did not exist. For backward-compatibility,
this function will behave synchronously if no callback is given. If you're starting with Babel 7
and need synchronous behavior, please use `transformSync` since this backward-compat may be dropped in
future major versions of Babel.
## babel.transformSync(code: string, [options?](#options): Object)
Transforms the passed in `code`. Returning an object with the generated code,
source map, and AST.
```js
babel.transformSync(code, options) // => { code, map, ast }
```
**Example**
```js
var result = babel.transformSync("code();", options);
result.code;
result.map;
result.ast;
```
## babel.transformFile(filename: string, [options?](#options): Object, callback: Function)
Asynchronously transforms the entire contents of a file.
```js
babel.transformFile(filename, options, callback)
```
**Example**
```js
babel.transformFile("filename.js", options, function (err, result) {
result; // => { code, map, ast }
});
```
## babel.transformFileSync(filename: string, [options?](#options): Object)
Synchronous version of `babel.transformFile`. Returns the transformed contents of
the `filename`.
```js
babel.transformFileSync(filename, options) // => { code, map, ast }
```
**Example**
```js
babel.transformFileSync("filename.js", options).code;
```
## babel.transformFromAst(ast: Object, code?: string, [options?](#options): Object, callback: Function): FileNode | null
Given an [AST](https://astexplorer.net/), transform it.
```js
const sourceCode = "if (true) return;";
const parsedAst = babel.parse(sourceCode, { allowReturnOutsideFunction: true });
babel.transformFromAst(parsedAst, sourceCode, options, function(err, result) {
const { code, map, ast } = result;
});
```
### Compat Note:
In Babel 6, this method was synchronous and `transformFromAstSync` did not exist. For backward-compatibility,
this function will behave synchronously if no callback is given. If you're starting with Babel 7
and need synchronous behavior, please use `transformFromAstSync` since this backward-compat may be dropped in
future major versions of Babel.
## babel.transformFromAstSync(ast: Object, code?: string, [options?](#options): Object)
Given an [AST](https://astexplorer.net/), transform it.
```js
const sourceCode = "if (true) return;";
const parsedAst = babel.parse(sourceCode, { allowReturnOutsideFunction: true });
const { code, map, ast } = babel.transformFromAstSync(parsedAst, sourceCode, options);
```
## babel.parse(code: string, [options?](#options): Object)
Given some code, parse it using Babel's standard behavior. Referenced presets and
plugins will be loaded such that optional syntax plugins are automatically
enabled.
## Advanced APIs
Many systems that wrap Babel like to automatically inject plugins and presets,
or override options. To accomplish this goal, Babel exposes several functions
that aid in loading the configuration part-way without transforming.
### babel.loadOptions([options?](#options): Object)
Resolve Babel's options fully, resulting in an options object where:
* `opts.plugins` is a full list of `Plugin` instances.
* `opts.presets` is empty and all presets are flattened into `opts`.
* It can be safely passed back to Babel. Fields like `babelrc` have been set to
false so that later calls to Babel will not make a second attempt to load
config files.
`Plugin` instances aren't meant to be manipulated directly, but often
callers will serialize this `opts` to JSON to use it as a cache key representing
the options Babel has received. Caching on this isn't 100% guaranteed to
invalidate properly, but it is the best we have at the moment.
### babel.loadPartialConfig([options?](#options): Object): PartialConfig
To allow systems to easily manipulate and validate a user's config, this function
resolves the plugins and presets and proceeds no further. The expectation is
that callers will take the config's `.options`, manipulate it as then see fit
and pass it back to Babel again.
* `babelrc: string | void` - The path of the `.babelrc` file, if there was one.
* `babelignore: string | void` - The path of the `.babelignore` file, if there was one.
* `options: ValidatedOptions` - The partially resolved options, which can be manipulated and passed back to Babel again.
* `plugins: Array<ConfigItem>` - See below.
* `presets: Array<ConfigItem>` - See below.
* It can be safely passed back to Babel. Fields like `babelrc` have been set
to false so that later calls to Babel will not make a second attempt to
load config files.
* `hasFilesystemConfig(): boolean` - Check if the resolved config loaded any settings from the filesystem.
[`ConfigItem`](#configitem-type) instances expose properties to introspect the values, but each
item should be treated as immutable. If changes are desired, the item should be
removed from the list and replaced with either a normal Babel config value, or
with a replacement item created by `babel.createConfigItem`. See that
function for information about `ConfigItem` fields.
### babel.createConfigItem(value: string | {} | Function | [string | {} | Function, {} | void], { dirname?: string, type?: "preset" | "plugin" }): ConfigItem
Allows build tooling to create and cache config items up front. If this function
is called multiple times for a given plugin, Babel will call the plugin's function itself
multiple times. If you have a clear set of expected plugins and presets to
inject, pre-constructing the config items would be recommended.
### `ConfigItem` type
Each `ConfigItem` exposes all of the information Babel knows. The fields are:
* `value: {} | Function` - The resolved value of the plugin.
* `options: {} | void` - The options object passed to the plugin.
* `dirname: string` - The path that the options are relative to.
* `name: string | void` - The name that the user gave the plugin instance, e.g. `plugins: [ ['env', {}, 'my-env'] ]`
* `file: Object | void` - Information about the plugin's file, if Babel knows it.
* `request: string` - The file that the user requested, e.g. `"@babel/env"`
* `resolved: string` - The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"`
## Options
<blockquote class="babel-callout babel-callout-info">
<h4>Babel CLI</h4>
<p>
You can pass these options from the Babel CLI like so:
</p>
<p>
<code>babel --option-name<span class="o">=</span>value</code>
</p>
</blockquote>
Following is a table of the options you can use:
| Option | Default | Description |
| ------------------------ | -------------------- | ------------------------------- |
| `ast` | `false` | Include the AST in the returned object |
| `auxiliaryCommentAfter` | `null` | Attach a comment after all non-user injected code |
| `auxiliaryCommentBefore` | `null` | Attach a comment before all non-user injected code |
| `root` | `"."` | Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow `.babelrc` files inside of.|
| `configFile` | `undefined` | The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files.|
| `babelrc` | `true` | Specify whether or not to use .babelrc and .babelignore files. Not available when using the CLI, [use `--no-babelrc` instead](https://babeljs.io/docs/usage/cli/#babel-ignoring-babelrc) |
| `babelrcRoots` | `(root)` | Specify which packages should be search for .babelrc files when they are being compiled. `true` to _always_ search, or a path string or an array of paths to packages to search inside of. Defaults to only searching the "root" package. |
| `envName` | env vars | Defaults to environment variable `BABEL_ENV` if set, or else `NODE_ENV` if set, or else it defaults to `"development"` |
| `code` | `true` | Enable code generation |
| `comments` | `true` | Output comments in generated output |
| `compact` | `"auto"` | Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB |
| `env` | `{}` | This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { /* specific options */ } } }` which will use those options when the `envName` is `production` |
| `extends` | `null` | A path to a `.babelrc` file to extend |
| `filename` | `"unknown"` | Filename for use in errors etc |
| `filenameRelative` | `(filename)` | Filename relative to `sourceRoot` |
| `generatorOpts` | `{}` | An object containing the options to be passed down to the babel code generator, @babel/generator |
| `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used |
| `highlightCode` | `true` | ANSI highlight syntax error code frames |
| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified |
| `inputSourceMap` | `null` | A source map object that the output source map will be based on |
| `minified` | `false` | Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) |
| `moduleId` | `null` | Specify a custom name for module ids |
| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) |
| `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions |
| `only` | `null` | A [glob](https://github.com/isaacs/minimatch), regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim |
| `parserOpts` | `{}` | An object containing the options to be passed down to the babel parser, @babel/parser |
| `plugins` | `[]` | List of [plugins](https://babeljs.io/docs/plugins/) to load and use |
| `presets` | `[]` | List of [presets](https://babeljs.io/docs/plugins/#presets) (a set of plugins) to load and use |
| `retainLines` | `false` | Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE:** This will not retain the columns) |
| `shouldPrintComment` | `null` | An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE:** This overrides the `comment` option when used |
| `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map |
| `sourceMaps` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** To have sourcemaps emitted using the CLI, you must pass it the `--source-maps` option |
| `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative |
| `sourceType` | `"module"` | Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to _guess_, based on the presence of ES6 `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`. |
| `wrapPluginVisitorMethod`| `null` | An optional callback that can be used to wrap visitor methods. **NOTE:** This is useful for things like introspection, and not really needed for implementing anything. Called as `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`.

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/core",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Babel compiler core.",
"main": "lib/index.js",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
@@ -30,24 +30,24 @@
"./lib/transform-file.js": "./lib/transform-file-browser.js"
},
"dependencies": {
"@babel/code-frame": "7.0.0-beta.49",
"@babel/generator": "7.0.0-beta.49",
"@babel/helpers": "7.0.0-beta.49",
"@babel/parser": "7.0.0-beta.49",
"@babel/template": "7.0.0-beta.49",
"@babel/traverse": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.49",
"@babel/code-frame": "7.0.0-beta.52",
"@babel/generator": "7.0.0-beta.52",
"@babel/helpers": "7.0.0-beta.52",
"@babel/parser": "7.0.0-beta.52",
"@babel/template": "7.0.0-beta.52",
"@babel/traverse": "7.0.0-beta.52",
"@babel/types": "7.0.0-beta.52",
"convert-source-map": "^1.1.0",
"debug": "^3.1.0",
"json5": "^0.5.0",
"lodash": "^4.17.5",
"micromatch": "^2.3.11",
"micromatch": "^3.1.10",
"resolve": "^1.3.2",
"semver": "^5.4.1",
"source-map": "^0.5.0"
},
"devDependencies": {
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.49",
"@babel/register": "7.0.0-beta.49"
"@babel/helper-transform-fixture-test-runner": "7.0.0-beta.52",
"@babel/register": "7.0.0-beta.52"
}
}

View File

@@ -236,11 +236,13 @@ function babelrcLoadEnabled(
return micromatch(pkgData.directories, babelrcPatterns).length > 0;
}
const validateConfigFile = makeWeakCache((file: ConfigFile): ValidatedFile => ({
filepath: file.filepath,
dirname: file.dirname,
options: validate("configfile", file.options),
}));
const validateConfigFile = makeWeakCache(
(file: ConfigFile): ValidatedFile => ({
filepath: file.filepath,
dirname: file.dirname,
options: validate("configfile", file.options),
}),
);
const validateBabelrcFile = makeWeakCache(
(file: ConfigFile): ValidatedFile => ({
@@ -250,11 +252,13 @@ const validateBabelrcFile = makeWeakCache(
}),
);
const validateExtendFile = makeWeakCache((file: ConfigFile): ValidatedFile => ({
filepath: file.filepath,
dirname: file.dirname,
options: validate("extendsfile", file.options),
}));
const validateExtendFile = makeWeakCache(
(file: ConfigFile): ValidatedFile => ({
filepath: file.filepath,
dirname: file.dirname,
options: validate("extendsfile", file.options),
}),
);
/**
* Build a config chain for just the programmatic options passed into Babel.

View File

@@ -198,8 +198,9 @@ const readConfigJS = makeStrongCache(
const packageToBabelConfig = makeWeakCache(
(file: ConfigFile): ConfigFile | null => {
if (typeof file.options.babel === "undefined") return null;
const babel = file.options.babel;
const babel = file.options[("babel": string)];
if (typeof babel === "undefined") return null;
if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {
throw new Error(`${file.filepath}: .babel property must be an object`);

View File

@@ -19,14 +19,14 @@ export function findPackageData(filepath: string): FilePackageData {
}
export function findRelativeConfig(
pkgData: FilePackageData,
pkgData: FilePackageData, // eslint-disable-line no-unused-vars
envName: string, // eslint-disable-line no-unused-vars
): RelativeConfig {
return { pkg: null, config: null, ignore: null };
}
export function findRootConfig(
dirname: string,
dirname: string, // eslint-disable-line no-unused-vars
envName: string, // eslint-disable-line no-unused-vars
): ConfigFile | null {
return null;

View File

@@ -15,8 +15,9 @@ const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
const BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-plugin-|[^/]+\/)/;
const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-preset-|[^/]+\/)/;
const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-plugin(?:-|\/|$)|[^/]+\/)/;
const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?!babel-preset(?:-|\/|$)|[^/]+\/)/;
const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;
export function resolvePlugin(name: string, dirname: string): string | null {
return resolveStandardizedName("plugin", name, dirname);
@@ -80,6 +81,8 @@ function standardizeName(type: "plugin" | "preset", name: string) {
isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE,
`$1babel-${type}-`,
)
// @foo -> @foo/babel-preset
.replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`)
// module:mypreset -> mypreset
.replace(EXACT_RE, "")
);

View File

@@ -1,5 +1,6 @@
// @flow
import path from "path";
import buildDebug from "debug";
import * as t from "@babel/types";
import type { PluginPasses } from "../config";
@@ -27,32 +28,44 @@ export default function normalizeFile(
let inputMap = null;
if (options.inputSourceMap !== false) {
try {
inputMap = convertSourceMap.fromSource(code);
if (inputMap) {
code = convertSourceMap.removeComments(code);
}
} catch (err) {
debug("discarding unknown inline input sourcemap", err);
code = convertSourceMap.removeComments(code);
// If an explicit object is passed in, it overrides the processing of
// source maps that may be in the file itself.
if (typeof options.inputSourceMap === "object") {
inputMap = convertSourceMap.fromObject(options.inputSourceMap);
}
if (!inputMap) {
try {
inputMap = convertSourceMap.fromMapFileSource(code);
inputMap = convertSourceMap.fromSource(code);
if (inputMap) {
code = convertSourceMap.removeMapFileComments(code);
code = convertSourceMap.removeComments(code);
}
} catch (err) {
debug("discarding unknown file input sourcemap", err);
code = convertSourceMap.removeMapFileComments(code);
debug("discarding unknown inline input sourcemap", err);
code = convertSourceMap.removeComments(code);
}
}
if (!inputMap && typeof options.inputSourceMap === "object") {
inputMap = convertSourceMap.fromObject(options.inputSourceMap);
if (!inputMap) {
if (typeof options.filename === "string") {
try {
inputMap = convertSourceMap.fromMapFileSource(
code,
path.dirname(options.filename),
);
if (inputMap) {
code = convertSourceMap.removeMapFileComments(code);
}
} catch (err) {
debug("discarding unknown file input sourcemap", err);
code = convertSourceMap.removeMapFileComments(code);
}
} else {
debug("discarding un-loadable file input sourcemap");
code = convertSourceMap.removeMapFileComments(code);
}
}
}

View File

@@ -12,6 +12,11 @@ Object.defineProperty(exports, "__esModule", {
exports.default = function () {
return {
plugins: [require('../../../../../babel-plugin-syntax-decorators')]
plugins: [
[
require('../../../../../babel-plugin-syntax-decorators'),
{ legacy: true }
],
]
};
};

View File

@@ -9,6 +9,11 @@
exports.__esModule = true;
module.exports = function() {
return {
plugins: [require('../../../../../babel-plugin-syntax-decorators')]
plugins: [
[
require('../../../../../babel-plugin-syntax-decorators'),
{ legacy: true }
],
]
};
};

View File

@@ -1,7 +1,10 @@
module.exports = function () {
return {
plugins: [
require('../../../../../babel-plugin-syntax-decorators'),
[
require('../../../../../babel-plugin-syntax-decorators'),
{ legacy: true }
],
]
};
};

View File

@@ -1,7 +1,10 @@
module.exports = function() {
return {
plugins: [
require('../../../../../babel-plugin-syntax-decorators'),
[
require('../../../../../babel-plugin-syntax-decorators'),
{ legacy: true }
],
]
};
};

View File

@@ -58,7 +58,7 @@
"column": 11
}
},
"callee": {
"expression": {
"type": "Identifier",
"start": 1,
"end": 11,

View File

@@ -0,0 +1,3 @@
module.exports = function() {
return {};
};

View File

@@ -0,0 +1,3 @@
module.exports = function() {
return {};
};

View File

@@ -7,7 +7,9 @@ exports.default = void 0;
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _next(value) { step("next", value); } function _throw(err) { step("throw", err); } _next(); }); }; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

View File

@@ -154,6 +154,66 @@ describe("addon resolution", function() {
});
});
it("should find @foo/babel-plugin when specified", function() {
process.chdir("foo-org-paths");
babel.transform("", {
filename: "filename.js",
babelrc: false,
plugins: ["@foo/babel-plugin"],
});
});
it("should find @foo/babel-preset when specified", function() {
process.chdir("foo-org-paths");
babel.transform("", {
filename: "filename.js",
babelrc: false,
presets: ["@foo/babel-preset"],
});
});
it("should find @foo/babel-plugin/index when specified", function() {
process.chdir("foo-org-paths");
babel.transform("", {
filename: "filename.js",
babelrc: false,
plugins: ["@foo/babel-plugin/index"],
});
});
it("should find @foo/babel-preset/index when specified", function() {
process.chdir("foo-org-paths");
babel.transform("", {
filename: "filename.js",
babelrc: false,
presets: ["@foo/babel-preset/index"],
});
});
it("should find @foo/babel-plugin when just scope given", function() {
process.chdir("foo-org-paths");
babel.transform("", {
filename: "filename.js",
babelrc: false,
plugins: ["@foo"],
});
});
it("should find @foo/babel-preset when just scope given", function() {
process.chdir("foo-org-paths");
babel.transform("", {
filename: "filename.js",
babelrc: false,
presets: ["@foo"],
});
});
it("should find relative path presets", function() {
process.chdir("relative-paths");

View File

@@ -1,78 +1,19 @@
# @babel/generator
> Turns the [babel AST](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md) into code.
> Turns an AST into code.
See our website [@babel/generator](https://babeljs.io/docs/en/next/babel-generator.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20generator%22+is%3Aopen) associated with this package.
## Install
Using npm:
```sh
npm install --save-dev @babel/generator
```
## Usage
or using yarn:
```js
import {parse} from '@babel/parser';
import generate from '@babel/generator';
const code = 'class Example {}';
const ast = parse(code);
const output = generate(ast, { /* options */ }, code);
```
## Options
Options for formatting output:
name | type | default | description
-----------------------|----------|-----------------|--------------------------------------------------------------------------
auxiliaryCommentBefore | string | | Optional string to add as a block comment at the start of the output file
auxiliaryCommentAfter | string | | Optional string to add as a block comment at the end of the output file
shouldPrintComment | function | `opts.comments` | Function that takes a comment (as a string) and returns `true` if the comment should be included in the output. By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment contains `@preserve` or `@license`
retainLines | boolean | `false` | Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces)
retainFunctionParens | boolean | `false` | Retain parens around function expressions (could be used to change engine parsing behavior)
comments | boolean | `true` | Should comments be included in output
compact | boolean or `'auto'` | `opts.minified` | Set to `true` to avoid adding whitespace for formatting
minified | boolean | `false` | Should the output be minified
concise | boolean | `false` | Set to `true` to reduce whitespace (but not as much as `opts.compact`)
filename | string | | Used in warning messages
jsonCompatibleStrings | boolean | `false` | Set to true to run `jsesc` with "json": true to print "\u00A9" vs. "©";
Options for source maps:
name | type | default | description
-----------------------|----------|-----------------|--------------------------------------------------------------------------
sourceMaps | boolean | `false` | Enable generating source maps
sourceRoot | string | | A root for all relative URLs in the source map
sourceFileName | string | | The filename for the source code (i.e. the code in the `code` argument). This will only be used if `code` is a string.
## AST from Multiple Sources
In most cases, Babel does a 1:1 transformation of input-file to output-file. However,
you may be dealing with AST constructed from multiple sources - JS files, templates, etc.
If this is the case, and you want the sourcemaps to reflect the correct sources, you'll need
to pass an object to `generate` as the `code` parameter. Keys
should be the source filenames, and values should be the source content.
Here's an example of what that might look like:
```js
import {parse} from '@babel/parser';
import generate from '@babel/generator';
const a = 'var a = 1;';
const b = 'var b = 2;';
const astA = parse(a, { sourceFilename: 'a.js' });
const astB = parse(b, { sourceFilename: 'b.js' });
const ast = {
type: 'Program',
body: [].concat(astA.program.body, astB.program.body)
};
const { code, map } = generate(ast, { sourceMaps: true }, {
'a.js': a,
'b.js': b
});
// Sourcemap will point to both a.js and b.js where appropriate.
```sh
yarn add @babel/generator --dev
```

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/generator",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Turns an AST into code.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
@@ -11,14 +11,14 @@
"lib"
],
"dependencies": {
"@babel/types": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.52",
"jsesc": "^2.5.1",
"lodash": "^4.17.5",
"source-map": "^0.5.0",
"trim-right": "^1.0.1"
},
"devDependencies": {
"@babel/helper-fixtures": "7.0.0-beta.49",
"@babel/parser": "7.0.0-beta.49"
"@babel/helper-fixtures": "7.0.0-beta.52",
"@babel/parser": "7.0.0-beta.52"
}
}

View File

@@ -2,8 +2,9 @@ import * as t from "@babel/types";
export function ClassDeclaration(node: Object, parent: Object) {
if (
!t.isExportDefaultDeclaration(parent) &&
!t.isExportNamedDeclaration(parent)
!this.format.decoratorsBeforeExport ||
(!t.isExportDefaultDeclaration(parent) &&
!t.isExportNamedDeclaration(parent))
) {
this.printJoin(node.decorators, node);
}

View File

@@ -92,7 +92,7 @@ export function Super() {
export function Decorator(node: Object) {
this.token("@");
this.print(node.callee, node);
this.print(node.expression, node);
this.newline();
}

View File

@@ -472,6 +472,10 @@ export function ObjectTypeIndexer(node: Object) {
}
export function ObjectTypeProperty(node: Object) {
if (node.proto) {
this.word("proto");
this.space();
}
if (node.static) {
this.word("static");
this.space();

View File

@@ -57,7 +57,10 @@ export function ExportAllDeclaration(node: Object) {
}
export function ExportNamedDeclaration(node: Object) {
if (t.isClassDeclaration(node.declaration)) {
if (
this.format.decoratorsBeforeExport &&
t.isClassDeclaration(node.declaration)
) {
this.printJoin(node.declaration.decorators, node);
}
@@ -67,7 +70,10 @@ export function ExportNamedDeclaration(node: Object) {
}
export function ExportDefaultDeclaration(node: Object) {
if (t.isClassDeclaration(node.declaration)) {
if (
this.format.decoratorsBeforeExport &&
t.isClassDeclaration(node.declaration)
) {
this.printJoin(node.declaration.decorators, node);
}

View File

@@ -132,10 +132,7 @@ export function StringLiteral(node: Object) {
}
// ensure the output is ASCII-safe
const opts = {
quotes: "double",
wrap: true,
};
const opts = this.format.jsescOption;
if (this.format.jsonCompatibleStrings) {
opts.json = true;
}

View File

@@ -52,6 +52,12 @@ function normalizeOptions(code, opts): Format {
style: " ",
base: 0,
},
decoratorsBeforeExport: !!opts.decoratorsBeforeExport,
jsescOption: {
quotes: "double",
wrap: true,
...opts.jsescOption,
},
};
if (format.minified) {

View File

@@ -25,6 +25,7 @@ export type Format = {
style: string,
base: number,
},
decoratorsBeforeExport: boolean,
};
export default class Printer {

View File

@@ -0,0 +1,3 @@
export default @dec class Foo {}
export @dec class Bar {}

View File

@@ -0,0 +1,6 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": false }]
],
"decoratorsBeforeExport": false
}

View File

@@ -0,0 +1,4 @@
export default @dec
class Foo {}
export @dec
class Bar {}

View File

@@ -0,0 +1,3 @@
export default @dec class Foo {}
export @dec class Bar {}

View File

@@ -0,0 +1,6 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": false }]
],
"decoratorsBeforeExport": true
}

View File

@@ -0,0 +1,4 @@
@dec
export default class Foo {}
@dec
export class Bar {}

View File

@@ -0,0 +1,5 @@
@dec
export default class Foo {}
@dec
export class Bar {}

View File

@@ -0,0 +1,6 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": true }]
],
"decoratorsBeforeExport": false
}

View File

@@ -0,0 +1,4 @@
export default @dec
class Foo {}
export @dec
class Bar {}

View File

@@ -0,0 +1,5 @@
@dec
export default class Foo {}
@dec
export class Bar {}

View File

@@ -0,0 +1,6 @@
{
"plugins": [
["decorators", { "decoratorsBeforeExport": true }]
],
"decoratorsBeforeExport": true
}

View File

@@ -0,0 +1,4 @@
@dec
export default class Foo {}
@dec
export class Bar {}

View File

@@ -32,15 +32,15 @@ class Foo {
}
@foo
export default class Foo {
export default @foo
class Foo {
bar() {
class Baz {}
}
}
@foo
export class Foo {
export @foo
class Foo {
bar() {
class Baz {}
}

View File

@@ -1,40 +1,19 @@
# @babel/helper-annotate-as-pure
## API
> Helper function to annotate paths and nodes with #__PURE__ comment
```js
declare export default annotateAsPure(nodeOrPath: Node | NodePath);
See our website [@babel/helper-annotate-as-pure](https://babeljs.io/docs/en/next/babel-helper-annotate-as-pure.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-annotate-as-pure
```
## Usage
or using yarn:
```js
import traverse from "@babel/traverse";
import annotateAsPure from "@babel/helper-annotate-as-pure";
// ...
traverse(file, {
CallExpression(path) {
annotateAsPure(path);
},
});
```
## Caveat with UglifyJS pre v3.1.0
`@babel/helper-annotate-as-pure` will append any existing leading comments to the `#__PURE__` annotation. Versions of UglifyJS prior to v3.1.0 will **ignore** these annotations, as they only check the _last_ leading comment for the annotation.
For example, using the `Usage` snippet above:
**In**
```js
const four = /* foo */ add(2, 2);
```
**Out**
```js
const four = /* #__PURE__ */ /* foo */ add(2, 2);
```sh
yarn add @babel/helper-annotate-as-pure --dev
```

View File

@@ -1,11 +1,11 @@
{
"name": "@babel/helper-annotate-as-pure",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to annotate paths and nodes with #__PURE__ comment",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/types": "7.0.0-beta.49"
"@babel/types": "7.0.0-beta.52"
}
}

View File

@@ -1,9 +1,19 @@
# @babel/helper-bindify-decorators
## API
```javascript
declare export default bindifyDecorators(decorators: Array<NodePath>);
```
## Usage
> Helper function to bindify decorators
TODO
See our website [@babel/helper-bindify-decorators](https://babeljs.io/docs/en/next/babel-helper-bindify-decorators.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-bindify-decorators
```
or using yarn:
```sh
yarn add @babel/helper-bindify-decorators --dev
```

View File

@@ -1,12 +1,12 @@
{
"name": "@babel/helper-bindify-decorators",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to bindify decorators",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-bindify-decorators",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/traverse": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.49"
"@babel/traverse": "7.0.0-beta.52",
"@babel/types": "7.0.0-beta.52"
}
}

View File

@@ -1,5 +1,19 @@
# @babel/helper-builder-binary-assignment-operator-visitor
## Usage
> Helper function to build binary assignment operator visitors
TODO
See our website [@babel/helper-builder-binary-assignment-operator-visitor](https://babeljs.io/docs/en/next/babel-helper-builder-binary-assignment-operator-visitor.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-builder-binary-assignment-operator-visitor
```
or using yarn:
```sh
yarn add @babel/helper-builder-binary-assignment-operator-visitor --dev
```

View File

@@ -1,12 +1,12 @@
{
"name": "@babel/helper-builder-binary-assignment-operator-visitor",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to build binary assignment operator visitors",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-binary-assignment-operator-visitor",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/helper-explode-assignable-expression": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.49"
"@babel/helper-explode-assignable-expression": "7.0.0-beta.52",
"@babel/types": "7.0.0-beta.52"
}
}

View File

@@ -1,28 +1,19 @@
# @babel/helper-builder-react-jsx
## Usage
> Helper function to build react jsx
```javascript
type ElementState = {
tagExpr: Object; // tag node
tagName: string; // raw string tag name
args: Array<Object>; // array of call arguments
call?: Object; // optional call property that can be set to override the call expression returned
};
See our website [@babel/helper-builder-react-jsx](https://babeljs.io/docs/en/next/babel-helper-builder-react-jsx.html) for more information.
require("@babel/helper-builder-react-jsx")({
filter: function (element: JSXElement) {
// if returns false, the element isn't transformed
},
## Install
pre: function (state: ElementState) {
// function called with (state: ElementState) before building attribs
},
Using npm:
post: function (state: ElementState) {
// function called with (state: ElementState) after building attribs
},
compat?: boolean // true if React is in compat mode
});
```sh
npm install --save-dev @babel/helper-builder-react-jsx
```
or using yarn:
```sh
yarn add @babel/helper-builder-react-jsx --dev
```

View File

@@ -1,12 +1,12 @@
{
"name": "@babel/helper-builder-react-jsx",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to build react jsx",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-builder-react-jsx",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/types": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.52",
"esutils": "^2.0.0"
}
}

View File

@@ -89,14 +89,14 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`,
}
}
if (t.isValidIdentifier(node.name.name)) {
if (t.isJSXNamespacedName(node.name)) {
node.name = t.stringLiteral(
node.name.namespace.name + ":" + node.name.name.name,
);
} else if (esutils.keyword.isIdentifierNameES6(node.name.name)) {
node.name.type = "Identifier";
} else {
node.name = t.stringLiteral(
t.isJSXNamespacedName(node.name)
? node.name.namespace.name + ":" + node.name.name.name
: node.name.name,
);
node.name = t.stringLiteral(node.name.name);
}
return t.inherits(t.objectProperty(node.name, value), node);

View File

@@ -1,5 +1,19 @@
# @babel/helper-call-delegate
## Usage
> Helper function to call delegate
TODO
See our website [@babel/helper-call-delegate](https://babeljs.io/docs/en/next/babel-helper-call-delegate.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-call-delegate
```
or using yarn:
```sh
yarn add @babel/helper-call-delegate --dev
```

View File

@@ -1,13 +1,13 @@
{
"name": "@babel/helper-call-delegate",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to call delegate",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-call-delegate",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/helper-hoist-variables": "7.0.0-beta.49",
"@babel/traverse": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.49"
"@babel/helper-hoist-variables": "7.0.0-beta.52",
"@babel/traverse": "7.0.0-beta.52",
"@babel/types": "7.0.0-beta.52"
}
}

View File

@@ -1,5 +1,19 @@
# @babel/helper-define-map
## Usage
> Helper function to define a map
TODO
See our website [@babel/helper-define-map](https://babeljs.io/docs/en/next/babel-helper-define-map.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-define-map
```
or using yarn:
```sh
yarn add @babel/helper-define-map --dev
```

View File

@@ -1,13 +1,13 @@
{
"name": "@babel/helper-define-map",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to define a map",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/helper-function-name": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.49",
"@babel/helper-function-name": "7.0.0-beta.52",
"@babel/types": "7.0.0-beta.52",
"lodash": "^4.17.5"
}
}

View File

@@ -1,5 +1,19 @@
# @babel/helper-explode-assignable-expression
## Usage
> Helper function to explode an assignable expression
TODO
See our website [@babel/helper-explode-assignable-expression](https://babeljs.io/docs/en/next/babel-helper-explode-assignable-expression.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-explode-assignable-expression
```
or using yarn:
```sh
yarn add @babel/helper-explode-assignable-expression --dev
```

View File

@@ -1,12 +1,12 @@
{
"name": "@babel/helper-explode-assignable-expression",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to explode an assignable expression",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-assignable-expression",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/traverse": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.49"
"@babel/traverse": "7.0.0-beta.52",
"@babel/types": "7.0.0-beta.52"
}
}

View File

@@ -1,5 +1,19 @@
# @babel/helper-explode-class
## Usage
> Helper function to explode class
TODO
See our website [@babel/helper-explode-class](https://babeljs.io/docs/en/next/babel-helper-explode-class.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-explode-class
```
or using yarn:
```sh
yarn add @babel/helper-explode-class --dev
```

View File

@@ -1,13 +1,13 @@
{
"name": "@babel/helper-explode-class",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to explode class",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-explode-class",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/helper-bindify-decorators": "7.0.0-beta.49",
"@babel/traverse": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.49"
"@babel/helper-bindify-decorators": "7.0.0-beta.52",
"@babel/traverse": "7.0.0-beta.52",
"@babel/types": "7.0.0-beta.52"
}
}

View File

@@ -1,33 +1,19 @@
# @babel/helper-fixtures
**NOTE:** This is an internal Babel module and may not work outside. Use at your own risk.
> Helper function to support fixtures
## Usage
See our website [@babel/helper-fixtures](https://babeljs.io/docs/en/next/babel-helper-fixtures.html) for more information.
```javascript
import getFixtures from "@babel/helper-fixtures";
## Install
type TestFile = {
loc: string;
code: string;
filename: string;
};
Using npm:
type Test = {
title: string;
disabled: boolean;
options: Object;
exec: TestFile;
actual: TestFile;
expected: TestFile;
};
type Suite = {
options: Object;
tests: Array<Test>;
title: string;
filename: string;
};
let fixtures: Array<Suite> = getFixtures("/User/sebmck/Projects/babel-something/test/fixtures");
```sh
npm install --save-dev @babel/helper-fixtures
```
or using yarn:
```sh
yarn add @babel/helper-fixtures --dev
```

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/helper-fixtures",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to support fixtures",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"license": "MIT",

View File

@@ -189,6 +189,25 @@ export default function get(entryLoc): Array<Suite> {
if (fs.existsSync(inputMapLoc)) {
test.inputSourceMap = JSON.parse(readFile(inputMapLoc));
}
if (taskOpts.throws) {
if (test.expect.code) {
throw new Error(
"Test cannot throw and also return output code: " + expectLoc,
);
}
if (test.sourceMappings) {
throw new Error(
"Test cannot throw and also return sourcemappings: " +
sourceMappingsLoc,
);
}
if (test.sourceMap) {
throw new Error(
"Test cannot throw and also return sourcemaps: " + sourceMapLoc,
);
}
}
}
}

View File

@@ -1,5 +1,19 @@
# @babel/helper-function-name
## Usage
> Helper function to change the property 'name' of every function
TODO
See our website [@babel/helper-function-name](https://babeljs.io/docs/en/next/babel-helper-function-name.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-function-name
```
or using yarn:
```sh
yarn add @babel/helper-function-name --dev
```

View File

@@ -1,13 +1,13 @@
{
"name": "@babel/helper-function-name",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to change the property 'name' of every function",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/helper-get-function-arity": "7.0.0-beta.49",
"@babel/template": "7.0.0-beta.49",
"@babel/types": "7.0.0-beta.49"
"@babel/helper-get-function-arity": "7.0.0-beta.52",
"@babel/template": "7.0.0-beta.52",
"@babel/types": "7.0.0-beta.52"
}
}

View File

@@ -1,21 +1,19 @@
# @babel/helper-get-function-arity
Function that returns the number of arguments that a function takes.
* Examples of what is considered an argument can be found at [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/length)
> Helper function to get function arity
## Usage
See our website [@babel/helper-get-function-arity](https://babeljs.io/docs/en/next/babel-helper-get-function-arity.html) for more information.
```javascript
import getFunctionArity from "@babel/helper-get-function-arity";
## Install
function wrap(state, method, id, scope) {
// ...
if (!t.isFunction(method)) {
return false;
}
Using npm:
const argumentsLength = getFunctionArity(method);
// ...
}
```sh
npm install --save-dev @babel/helper-get-function-arity
```
or using yarn:
```sh
yarn add @babel/helper-get-function-arity --dev
```

View File

@@ -1,11 +1,11 @@
{
"name": "@babel/helper-get-function-arity",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to get function arity",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/types": "7.0.0-beta.49"
"@babel/types": "7.0.0-beta.52"
}
}

View File

@@ -1,17 +1,19 @@
# @babel/helper-hoist-variables
## Installation
> Helper function to hoist variables
See our website [@babel/helper-hoist-variables](https://babeljs.io/docs/en/next/babel-helper-hoist-variables.html) for more information.
## Install
Using npm:
```sh
npm install @babel/helper-hoist-variables --save
npm install --save-dev @babel/helper-hoist-variables
```
## API
or using yarn:
```javascript
declare export default hoistVariables(path: NodePath, emit: Function, kind: "var" | "let" = "var");
```sh
yarn add @babel/helper-hoist-variables --dev
```
## Usage
TODO

View File

@@ -1,11 +1,11 @@
{
"name": "@babel/helper-hoist-variables",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.52",
"description": "Helper function to hoist variables",
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-hoist-variables",
"license": "MIT",
"main": "lib/index.js",
"dependencies": {
"@babel/types": "7.0.0-beta.49"
"@babel/types": "7.0.0-beta.52"
}
}

Some files were not shown because too many files have changed in this diff Show More