Compare commits
100 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9cb4af953 | ||
|
|
69d00dc5b0 | ||
|
|
f339d2d034 | ||
|
|
3069747a81 | ||
|
|
962015f7e7 | ||
|
|
b7333ea97a | ||
|
|
46c70ad734 | ||
|
|
3a7b6e1c22 | ||
|
|
9c1ad0a9f7 | ||
|
|
87dc201411 | ||
|
|
0ef4972295 | ||
|
|
cb881e6b3f | ||
|
|
45a484f0a2 | ||
|
|
99f4f6c3b0 | ||
|
|
e4b4831100 | ||
|
|
256fa5aa04 | ||
|
|
0ee2c42b55 | ||
|
|
1b352ca8a1 | ||
|
|
53af9e8b7a | ||
|
|
af04f40ee0 | ||
|
|
98b14843ba | ||
|
|
4395c22f3a | ||
|
|
610d6bdc62 | ||
|
|
8027dca501 | ||
|
|
81831032c3 | ||
|
|
daf25af47c | ||
|
|
6a5cee8f27 | ||
|
|
2096d0cfcb | ||
|
|
a79fbe62e4 | ||
|
|
381b066bd0 | ||
|
|
15b63bc89e | ||
|
|
fc8e14264c | ||
|
|
7e4f48139c | ||
|
|
cbd5a26e57 | ||
|
|
42e5974fd4 | ||
|
|
735abc0ed8 | ||
|
|
aa7678f32a | ||
|
|
b64cb9aaf1 | ||
|
|
8da9d8b4b8 | ||
|
|
3e4889d649 | ||
|
|
da0af5fd99 | ||
|
|
b02e35c19a | ||
|
|
3e8a5c5e28 | ||
|
|
8769903284 | ||
|
|
5c859b1117 | ||
|
|
2e7bea4a6a | ||
|
|
29734b924a | ||
|
|
6813ee02d7 | ||
|
|
fcb77de901 | ||
|
|
d05bd9edc8 | ||
|
|
27ba292774 | ||
|
|
a08e856804 | ||
|
|
c0e3fa0081 | ||
|
|
e5afa57cca | ||
|
|
e7fa566442 | ||
|
|
7c0333e12a | ||
|
|
8a775a32ba | ||
|
|
94e47c30a9 | ||
|
|
1664cce681 | ||
|
|
a2bf68981f | ||
|
|
15aa511b8e | ||
|
|
11ed2e2bf5 | ||
|
|
eb3767d58b | ||
|
|
f0c2364d01 | ||
|
|
ee344c3e4c | ||
|
|
64041e1669 | ||
|
|
469a5a71cd | ||
|
|
75090f10e5 | ||
|
|
22df2ae244 | ||
|
|
051965052c | ||
|
|
ee397ff107 | ||
|
|
15535cf52c | ||
|
|
682d9f9f09 | ||
|
|
a112be2fa0 | ||
|
|
9ec26a7d3e | ||
|
|
ba2c0f7adf | ||
|
|
5fb4d84a33 | ||
|
|
3e4a9d588b | ||
|
|
be2cbde560 | ||
|
|
66727632e8 | ||
|
|
ba28f462bc | ||
|
|
f08062b1de | ||
|
|
4f0840ab88 | ||
|
|
6a9d2538e0 | ||
|
|
f160522ab0 | ||
|
|
4d30379d36 | ||
|
|
4d12c8971b | ||
|
|
4506590557 | ||
|
|
1e7ed5c461 | ||
|
|
fced5cea43 | ||
|
|
9bc9571381 | ||
|
|
fb910e063c | ||
|
|
3b4a86aea4 | ||
|
|
94b678c949 | ||
|
|
c84a4c8bfa | ||
|
|
dfd59c183e | ||
|
|
718017d896 | ||
|
|
a0cb7b1ab1 | ||
|
|
0b886418c8 | ||
|
|
0371979a3e |
10
.github/CHANGELOG-6to5.md
vendored
10
.github/CHANGELOG-6to5.md
vendored
@@ -122,7 +122,7 @@
|
||||
* Restructure transformers so they're only ran if the AST contains nodes that they need to worry about. Improves transpilation speed significantly.
|
||||
* **Bug Fix**
|
||||
* Fix source maps not tracking end of node locations.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Use static super references as the home object is actually done at definition time.
|
||||
* **Polish**
|
||||
* Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is.
|
||||
@@ -479,7 +479,7 @@
|
||||
|
||||
## 2.12.3
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Optional `typeof` transformer checks for `undefined` before passing it to the helper.
|
||||
* Class methods are now named.
|
||||
|
||||
@@ -551,7 +551,7 @@
|
||||
* Add `classesFastSuper` optional transformer that doesn't support parent getters and prototype changing.
|
||||
* Add `forOfFast` transformer that speeds up `for...of` on arrays but produces more code.
|
||||
* Add `--react-compat` to `bin/6to5`.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Disallow setters without a single parameter.
|
||||
* Add `configurable` and `writable` to defined properties.
|
||||
* Use define instead of assignment for class methods.
|
||||
@@ -619,7 +619,7 @@
|
||||
|
||||
## 2.7.0
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Disallow reassignments of imports.
|
||||
* **New Feature**
|
||||
* `reactCompat` option to enable pre-v0.12 react components.
|
||||
@@ -662,7 +662,7 @@
|
||||
* **Polish**
|
||||
* Move `"use strict";` to inside module bodies instead of at the top of the file.
|
||||
* Better handling of dynamic imports.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Class inheritance now has a `function` or `null` type check.
|
||||
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
|
||||
|
||||
|
||||
6
.github/CHANGELOG-v4.md
vendored
6
.github/CHANGELOG-v4.md
vendored
@@ -110,7 +110,7 @@
|
||||
* Throw an error on different `babel` and `babel-runtime` versions.
|
||||
* Replicate module environment for `babel-node` eval.
|
||||
* Clean up classes output.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Make it illegal to use a rest parameter on a setter.
|
||||
|
||||
## 4.6.6
|
||||
@@ -150,8 +150,8 @@
|
||||
|
||||
* **New Feature**
|
||||
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
|
||||
* **Spec Compliancy**
|
||||
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliancy in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
|
||||
* **Spec Compliance**
|
||||
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliance in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
|
||||
* **Polish**
|
||||
* Rest parameters that are only referred to via number properties on member expressions are desugared into a direct `arguments` reference. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
|
||||
* `$ babel` no longer exits on syntax errors.
|
||||
|
||||
8
.github/CHANGELOG-v5.md
vendored
8
.github/CHANGELOG-v5.md
vendored
@@ -12,7 +12,7 @@
|
||||
|
||||
## 5.8.24
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
|
||||
* **Polish**
|
||||
* Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)!
|
||||
@@ -451,7 +451,7 @@ Issues with publish process.
|
||||
|
||||

|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Allow trailing param commas for methods when using the `es7.trailingCommas` transformer.
|
||||
* **Bug Fix**
|
||||
* Fix `es6.blockScoping` transformer not properly ignoring `break` in `SwitchCase`.
|
||||
@@ -481,7 +481,7 @@ Issues with publish process.
|
||||
* Fix correct function scope being passed to `nameMethod.property` when inferring the function name for class methods.
|
||||
* Fix incorrect extensions reference causing weird issues when using the Babel CLI.
|
||||
* Fix destructuring param reference replacements not inheriting from their original param.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Fix order that method decorators are ran in.
|
||||
|
||||
## 5.2.15
|
||||
@@ -616,7 +616,7 @@ Issues with publish process.
|
||||
* Fix `externalHelpers` option being incorrectly listed as type `string`.
|
||||
* **Internal**
|
||||
* Upgrade `core-js` to `0.9.0`.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Fix object decorators not using the `initializer` pattern.
|
||||
* Remove property initializer descriptor reflection.
|
||||
|
||||
|
||||
22
.github/CHANGELOG-v6.md
vendored
22
.github/CHANGELOG-v6.md
vendored
@@ -22,7 +22,7 @@
|
||||
> Backports for some folks (also other's when we accidentally merged PRs from both 6.x/master)
|
||||
> Lesson learned: just use `master` and backport on another branch.
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`, `babel-types`
|
||||
* [#6081](https://github.com/babel/babel/pull/6081) Flow opaque type 6.x backport. ([@jbrown215](https://github.com/jbrown215))
|
||||
|
||||
@@ -1468,7 +1468,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from
|
||||
|
||||
## v6.17.0 (2016-10-01)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-preset-stage-2`, `babel-preset-stage-3`
|
||||
* [#4617](https://github.com/babel/babel/pull/4617) Move async-generators to stage-3. ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
@@ -1476,7 +1476,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from
|
||||
|
||||
Specification repo: https://github.com/tc39/proposal-async-iteration
|
||||
|
||||
Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliancy) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39).
|
||||
Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliance) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39).
|
||||
|
||||
```js
|
||||
// async generator syntax
|
||||
@@ -1569,7 +1569,7 @@ First PR!
|
||||
|
||||
Babel 6.16: Happy 2nd Birthday 🎂!
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
|
||||
* `babel-core`, `babel-generator`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-types`, `babel-preset-stage-2`, ...
|
||||
* [#3473](https://github.com/babel/babel/pull/3473) via [#4576](https://github.com/babel/babel/pull/4576) Implement support for async generator functions and for-await statements. ([@zenparsing](https://github.com/zenparsing))
|
||||
@@ -2036,7 +2036,7 @@ It's also a lot folk's first PR (or first code PR)!
|
||||
* `babel-generator`, `babel-types`
|
||||
* [#3570](https://github.com/babel/babel/pull/3570) Add support for the new declare module.exports of flow. ([@danez](https://github.com/danez))
|
||||
|
||||
#### Spec Compliancy
|
||||
#### Spec Compliance
|
||||
* `babel-plugin-transform-es2015-modules-amd`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-modules-umd`
|
||||
* [#3518](https://github.com/babel/babel/pull/3518) Throw error for multiple exports default. ([@kaicataldo](https://github.com/kaicataldo))
|
||||
|
||||
@@ -2332,7 +2332,7 @@ Length: The number of characters in the output code
|
||||
* `babel-plugin-transform-react-jsx-self`, `babel-preset-react`
|
||||
* [#3540](https://github.com/babel/babel/pull/3540) Added jsx-self babel transform plugin. ([@jimfb](https://github.com/jimfb))
|
||||
|
||||
#### Spec Compliancy
|
||||
#### Spec Compliance
|
||||
* `babel-plugin-transform-es2015-unicode-regex`
|
||||
* [#3338](https://github.com/babel/babel/pull/3338) Update to `regexpu-core@2.0.0` for ES2016 compliance. ([@mathiasbynens](https://github.com/mathiasbynens))
|
||||
|
||||
@@ -3206,7 +3206,7 @@ Changes to note:
|
||||
- Reverting the class properties semicolon parser error.
|
||||
- Fix regression with plugin ordering with `babel-register`.
|
||||
|
||||
#### Spec Compliancy
|
||||
#### Spec Compliance
|
||||
* `babel-plugin-transform-class-properties`, `babylon`
|
||||
* [#3332](https://github.com/babel/babel/pull/3332) Revert to standard ASI behavior for class properties. ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
|
||||
@@ -3628,7 +3628,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
* `babel-plugin-transform-es2015-parameters`: [#3191](https://github.com/babel/babel/pull/3191) Fix the order of arguments initialization (fixes [T6809](http://phabricator.babeljs.io/T6809))
|
||||
* `babel-traverse`: [#3198](https://github.com/babel/babel/pull/3198) In `evaluate()`, it should not mistake lack of confidence for falsy
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* `babylon`, `babel-generator`, `babel-plugin-transform-regenerator`: [#3190](https://github.com/babel/babel/pull/3190): Remove `await *` from `babylon` and raise an error for that syntax since it was removed from the proposal and was causing an issue at runtime but not at compile time (fixes [T6688](http://phabricator.babeljs.io/T6688)).
|
||||
|
||||
* **Internal**
|
||||
@@ -3863,7 +3863,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
* Move `children` prop pushing to after props to ensure correct order in the react inline elements plugin.
|
||||
* Fix `buildExternalHelpers` script ignoring non-underscored helpers.
|
||||
* Fix exported classes with static class properties.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`.
|
||||
* **Polish**
|
||||
* Make interop for plugins with the `__esModule` work for all plugins no matter how they're imported/specified.
|
||||
@@ -3904,7 +3904,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
* **Polish**
|
||||
* Add npm 3 check to `babel-doctor`.
|
||||
* Autoclear the `babel/register` cache when it gets too big to be serialised.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Add support for flow existential type parameters.
|
||||
|
||||
## 6.1.1
|
||||
@@ -3969,7 +3969,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
|
||||
## 6.0.14
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Update exponentiation operator precedence.
|
||||
* Fix parser bug where arrow functions have a higher precedence than they should.
|
||||
* **Bug Fix**
|
||||
|
||||
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,6 +2,8 @@
|
||||
Before making a PR, please read our contributing guidelines
|
||||
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
|
||||
|
||||
Please note that the Babel Team requires two approvals before merging most PRs.
|
||||
|
||||
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
|
||||
@@ -9,7 +11,7 @@ If you are making a change that should have a docs update: submit another PR to
|
||||
|
||||
| Q | A <!--(Can use an emoji 👍) -->
|
||||
| ------------------------ | ---
|
||||
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes to link the issues -->
|
||||
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes and write "Fixes" before the number to link the issues -->
|
||||
| Patch: Bug Fix? |
|
||||
| Major: Breaking Change? |
|
||||
| Minor: New Feature? |
|
||||
|
||||
16
.github/actions/create-release-tag/Dockerfile
vendored
16
.github/actions/create-release-tag/Dockerfile
vendored
@@ -1,16 +0,0 @@
|
||||
FROM debian:stable-slim
|
||||
|
||||
LABEL "name"="create-release-tag"
|
||||
LABEL "version"="0.0.1"
|
||||
|
||||
LABEL "com.github.actions.name"="Create release tag"
|
||||
LABEL "com.github.actions.description"="Creates a release tag equal to the last commit message"
|
||||
LABEL "com.github.actions.icon"="tag"
|
||||
LABEL "com.github.actions.color"="gray-dark"
|
||||
|
||||
ADD entrypoint.sh /action/entrypoint.sh
|
||||
|
||||
RUN chmod +x /action/entrypoint.sh
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends git
|
||||
|
||||
ENTRYPOINT ["/action/entrypoint.sh"]
|
||||
14
.github/actions/create-release-tag/entrypoint.sh
vendored
14
.github/actions/create-release-tag/entrypoint.sh
vendored
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# GitHub doesn't support running actions on new tags yet: we need to run it on the commit.
|
||||
# For this reason, we can't be sure that the tag already exists. We can use the commit
|
||||
# message to create the tag. If the tag already exists locally, they won't conflict because
|
||||
# they have the same name and are on the same commit.
|
||||
|
||||
echo "INFO: Getting release version..."
|
||||
tag_name=$(git log --oneline --format=%B -1 $GITHUB_SHA)
|
||||
|
||||
echo "INFO: Creating new tag..."
|
||||
(git tag $tag_name $GITHUB_SHA) || echo "INFO: Tag already exists"
|
||||
16
.github/actions/filter-commit-message/Dockerfile
vendored
16
.github/actions/filter-commit-message/Dockerfile
vendored
@@ -1,16 +0,0 @@
|
||||
FROM debian:stable-slim
|
||||
|
||||
LABEL "name"="filter"
|
||||
LABEL "version"="1.1.0"
|
||||
|
||||
LABEL "com.github.actions.name"="Filter commit message"
|
||||
LABEL "com.github.actions.description"="Stop a workflow if the message of the current commit doesn't match the pattern"
|
||||
LABEL "com.github.actions.icon"="filter"
|
||||
LABEL "com.github.actions.color"="gray-dark"
|
||||
|
||||
ADD entrypoint.sh /action/entrypoint.sh
|
||||
|
||||
RUN chmod +x /action/entrypoint.sh
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends git
|
||||
|
||||
ENTRYPOINT ["/action/entrypoint.sh"]
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
pattern=$1
|
||||
message=$(git log --oneline --format=%B -1 $GITHUB_SHA)
|
||||
|
||||
if echo "$message" | grep -Pq "$pattern"; then
|
||||
echo "INFO: $message matches $pattern"
|
||||
exit 0
|
||||
else
|
||||
echo "INFO: $message does not match $pattern"
|
||||
# 78 is the "neutral" exit status
|
||||
exit 78
|
||||
fi
|
||||
@@ -1,19 +0,0 @@
|
||||
FROM node:10
|
||||
|
||||
LABEL "name" = "trigger-github-release"
|
||||
LABEL "version" = "0.0.1"
|
||||
|
||||
LABEL "com.github.actions.name" = "Trigger GitHub release"
|
||||
LABEL "com.github.actions.description" = "Trigger a new GitHub release and generate the changelog using lerna-changelog."
|
||||
LABEL "com.github.actions.icon" = "tag"
|
||||
LABEL "com.github.actions.color" = "yellow"
|
||||
|
||||
ADD entrypoint.sh /action/entrypoint.sh
|
||||
ADD package.json /action/package.json
|
||||
ADD package-lock.json /action/package-lock.json
|
||||
ADD release.js /action/release.js
|
||||
ADD update-changelog.js /action/update-changelog.js
|
||||
|
||||
RUN chmod +x /action/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/action/entrypoint.sh"]
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
echo "INFO: Installing action dependencies..."
|
||||
(cd /action; npm ci)
|
||||
|
||||
echo "INFO: Getting release version..."
|
||||
current_tag=$(git describe --abbrev=0 --tags $GITHUB_SHA)
|
||||
|
||||
last_tag=$(git describe --abbrev=0 --tags $current_tag^)
|
||||
echo "INFO: New version is $current_tag; last version is $last_tag."
|
||||
|
||||
echo "INFO: Generating the changelog..."
|
||||
|
||||
# lerna-changelog expects the token to be provided as GITHUB_AUTH,
|
||||
# but GitHub actions don't allow to predefine custom env vars prefixed with
|
||||
# GITHUB_. We need to define it here.
|
||||
changelog=$(
|
||||
GITHUB_AUTH="$GITHUB_TOKEN" \
|
||||
node /action/node_modules/.bin/lerna-changelog --tag-from $last_tag --tag-to $current_tag
|
||||
)
|
||||
|
||||
echo "INFO: Publishing the new GitHub release..."
|
||||
echo "$changelog" | node /action/release $current_tag
|
||||
|
||||
echo "INFO: Updating CHANGELOG.md..."
|
||||
echo "$changelog" | node /action/update-changelog
|
||||
|
||||
echo "INFO: Committing changelog..."
|
||||
git add CHANGELOG.md
|
||||
git -c user.name="$COMMIT_AUTHOR_NAME" -c user.email="$COMMIT_AUTHOR_EMAIL" \
|
||||
commit -m "Add $current_tag to CHANGELOG.md [skip ci]" --no-verify --quiet
|
||||
|
||||
echo "INFO: Pushing updates..."
|
||||
git push "https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" master
|
||||
|
||||
echo "INFO: Done! Don't forget to thank new contributors :)"
|
||||
1415
.github/actions/trigger-github-release/package-lock.json
generated
vendored
1415
.github/actions/trigger-github-release/package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@internal/trigger-github-release",
|
||||
"version": "0.0.1",
|
||||
"author": "Nicolò Ribaudo <nicolo.ribaudo@gmail.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/rest": "^16.3.0",
|
||||
"get-stdin": "^6.0.0",
|
||||
"lerna-changelog": "^0.8.2"
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const [ /* node */, /* file */, tag ] = process.argv;
|
||||
|
||||
const getStdin = require("get-stdin");
|
||||
const octokit = require("@octokit/rest")();
|
||||
|
||||
octokit.authenticate({
|
||||
type: "token",
|
||||
token: process.env.GITHUB_TOKEN
|
||||
});
|
||||
|
||||
const [ repoOwner, repoName ] = process.env.GITHUB_REPOSITORY.split("/");
|
||||
|
||||
getStdin()
|
||||
.then(changelog => octokit.repos.createRelease({
|
||||
owner: repoOwner,
|
||||
repo: repoName,
|
||||
tag_name: tag,
|
||||
body: changelog,
|
||||
draft: true,
|
||||
}))
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const getStdin = require("get-stdin");
|
||||
const fs = require("fs").promises;
|
||||
const path = require("path");
|
||||
|
||||
const { GITHUB_WORKSPACE } = process.env;
|
||||
|
||||
const INSERTION_POINT = "<!-- insert-new-changelog-here -->";
|
||||
const CHANGELOG = path.resolve(GITHUB_WORKSPACE, "CHANGELOG.md");
|
||||
|
||||
main();
|
||||
async function main() {
|
||||
let [stdin, changelog] = await Promise.all([
|
||||
getStdin(),
|
||||
fs.readFile(CHANGELOG, "utf8"),
|
||||
]);
|
||||
|
||||
if (!changelog.includes(INSERTION_POINT)) {
|
||||
throw new Error(`Missing "${INSERTION_POINT}" in CHANGELOG.md`);
|
||||
}
|
||||
|
||||
// Remove committers
|
||||
stdin = stdin.split("\n\n#### Committers")[0];
|
||||
changelog = changelog.replace(
|
||||
INSERTION_POINT,
|
||||
INSERTION_POINT + "\n" + stdin
|
||||
);
|
||||
|
||||
await fs.writeFile(CHANGELOG, changelog);
|
||||
}
|
||||
53
.github/main.workflow
vendored
53
.github/main.workflow
vendored
@@ -1,53 +0,0 @@
|
||||
workflow "Release" {
|
||||
on = "push"
|
||||
resolves = [
|
||||
"Trigger GitHub release",
|
||||
# GitHub actions are too slow for this, it takes more than 15 mins.
|
||||
# Publishing to npm from GH actions is a cool idea, but it's a lot faster to
|
||||
# publish locally.
|
||||
# "Publish to npm",
|
||||
]
|
||||
}
|
||||
|
||||
action "Trigger GitHub release" {
|
||||
uses = "./.github/actions/trigger-github-release/"
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
env = {
|
||||
COMMIT_AUTHOR_NAME = "Babel Bot"
|
||||
COMMIT_AUTHOR_EMAIL = "babel-bot@users.noreply.github.com"
|
||||
}
|
||||
needs = ["Create release tag"]
|
||||
}
|
||||
|
||||
action "Publish to npm" {
|
||||
uses = "docker://node:10"
|
||||
secrets = ["NPM_TOKEN"]
|
||||
runs = "make"
|
||||
args = "publish-ci"
|
||||
env = {
|
||||
CI = "true"
|
||||
}
|
||||
needs = ["Create release tag"]
|
||||
}
|
||||
|
||||
# When GitHub Actions will support the "release" event for public
|
||||
# repositories, we won't need this checks anymore.
|
||||
action "Create release tag" {
|
||||
uses = "./.github/actions/create-release-tag"
|
||||
needs = [
|
||||
"Is version commit",
|
||||
"On master branch",
|
||||
]
|
||||
}
|
||||
|
||||
action "Is version commit" {
|
||||
uses = "./.github/actions/filter-commit-message"
|
||||
# This regex is run using "grep -P".
|
||||
# The (-\\S+) part is for 7.0.0-beta.1 releases.
|
||||
args = "^v(\\d+\\.){2}\\d+(-\\S+)?$"
|
||||
}
|
||||
|
||||
action "On master branch" {
|
||||
uses = "actions/bin/filter@master"
|
||||
args = "branch master"
|
||||
}
|
||||
81
.github/workflows/issue-triage.yml
vendored
Normal file
81
.github/workflows/issue-triage.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: Issue Triage
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, labeled]
|
||||
|
||||
jobs:
|
||||
welcome:
|
||||
name: Welcome comment
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if Babel member
|
||||
id: is_babel_member
|
||||
if: github.event.action == 'opened'
|
||||
uses: babel/actions/is-org-member@v2
|
||||
with:
|
||||
org: babel
|
||||
username: ${{ github.event.issue.user.login }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Create Welcome Comment
|
||||
uses: babel/actions/create-comment@v2
|
||||
if: |
|
||||
github.event.action == 'opened' &&
|
||||
steps.is_babel_member.outputs.result == 0
|
||||
with:
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
issue: ${{ github.event.issue.number }}
|
||||
comment: >
|
||||
Hey @${{ github.event.issue.user.login }}!
|
||||
We really appreciate you taking the time to report an issue. The
|
||||
collaborators on this project attempt to help as many people as
|
||||
possible, but we're a limited number of volunteers, so it's
|
||||
possible this won't be addressed swiftly.
|
||||
|
||||
|
||||
If you need any help, or just have general Babel or JavaScript questions, we have a
|
||||
vibrant [Slack community](https://babeljs.slack.com) that typically always has someone
|
||||
willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite."
|
||||
|
||||
needs_info:
|
||||
name: Needs Info
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create Needs Info Comment
|
||||
uses: babel/actions/create-comment@v2
|
||||
if: |
|
||||
github.event.action == 'labeled' &&
|
||||
github.event.label.name == 'Needs Info'
|
||||
with:
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
issue: ${{ github.event.issue.number }}
|
||||
comment: >
|
||||
Hi @${{ github.event.issue.user.login }}!
|
||||
This issue is missing some important information we'll need
|
||||
to be able to reproduce this issue.
|
||||
|
||||
|
||||
Please understand that we receive a high volume of issues,
|
||||
and there are only a limited number of volunteers that help
|
||||
maintain this project. The easier it is for us to decipher an
|
||||
issue with the info provided, the more likely it is that we'll
|
||||
be able to help.
|
||||
|
||||
|
||||
Please make sure you have the following information documented in
|
||||
this ticket:
|
||||
|
||||
1. Your Babel configuration (typically from `.babelrc` or `babel.config.js`)
|
||||
|
||||
2. The current (incorrect) behavior you're seeing
|
||||
|
||||
3. The behavior you expect
|
||||
|
||||
4. A [short, self-contained example](http://sscce.org/)
|
||||
|
||||
|
||||
Please provide either a link to the problem via the
|
||||
[`repl`](https://babeljs.io/repl/), or if the `repl` is
|
||||
insufficient, a new and minimal repository with instructions on
|
||||
how to build/replicate the issue.
|
||||
|
||||
53
.github/workflows/release.yml
vendored
Normal file
53
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
|
||||
jobs:
|
||||
github_release:
|
||||
name: Trigger GitHub release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the new tag
|
||||
uses: actions/checkout@v1.0.0
|
||||
|
||||
- name: Get tag info
|
||||
id: tags
|
||||
uses: babel/actions/get-release-tags@v2
|
||||
|
||||
- name: Generate the changelog
|
||||
id: changelog
|
||||
uses: babel/actions/generate-lerna-changelog@v2
|
||||
with:
|
||||
from: ${{ steps.tags.outputs.old }}
|
||||
to: ${{ steps.tags.outputs.new }}
|
||||
env:
|
||||
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create a draft GitHub release
|
||||
uses: babel/actions/publish-github-release@v2
|
||||
with:
|
||||
tag: ${{ steps.tags.outputs.new }}
|
||||
changelog: ${{ steps.changelog.outputs.changelog }}
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
|
||||
- name: Check if releasing from master
|
||||
id: is_master
|
||||
uses: babel/actions/ref-matches-branch@v2
|
||||
with:
|
||||
name: master
|
||||
|
||||
- name: Update CHANGELOG.md
|
||||
if: steps.is_master.outputs.result == 1
|
||||
uses: babel/actions/update-changelog@v2
|
||||
with:
|
||||
changelog: ${{ steps.changelog.outputs.changelog }}
|
||||
|
||||
- name: Commit CHANGELOG.md
|
||||
if: steps.is_master.outputs.result == 1
|
||||
run: |
|
||||
git add CHANGELOG.md
|
||||
git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \
|
||||
commit -m "Add ${{ steps.tags.outputs.new }} to CHANGELOG.md [skip ci]" --no-verify --quiet
|
||||
git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" master
|
||||
169
CHANGELOG.md
169
CHANGELOG.md
@@ -2,7 +2,7 @@
|
||||
|
||||
> **Tags:**
|
||||
> - :boom: [Breaking Change]
|
||||
> - :eyeglasses: [Spec Compliancy]
|
||||
> - :eyeglasses: [Spec Compliance]
|
||||
> - :rocket: [New Feature]
|
||||
> - :bug: [Bug Fix]
|
||||
> - :memo: [Documentation]
|
||||
@@ -18,6 +18,129 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0
|
||||
<!-- DO NOT CHANGE THESE COMMENTS - See .github/actions/trigger-github-release/update-changelog.js -->
|
||||
<!-- insert-new-changelog-here -->
|
||||
|
||||
## v7.6.1 (2019-09-06)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-types`
|
||||
* [#10404](https://github.com/babel/babel/pull/10404) fix(types): correct typescript function headers ([@forstermatth](https://github.com/forstermatth))
|
||||
* `babel-node`
|
||||
* [#9758](https://github.com/babel/babel/pull/9758) Remove process.exit(1) from babel-node ([@dword-design](https://github.com/dword-design))
|
||||
|
||||
## v7.6.0 (2019-09-06)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-parser`
|
||||
* [#10269](https://github.com/babel/babel/pull/10269) Fix parenthesis for nullish coalescing ([@vivek12345](https://github.com/vivek12345))
|
||||
* `babel-helpers`, `babel-plugin-transform-block-scoping`, `babel-traverse`
|
||||
* [#9498](https://github.com/babel/babel/pull/9498) Fix tdz checks in transform-block-scoping plugin ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-core`
|
||||
* [#10181](https://github.com/babel/babel/pull/10181) feat(errors): validate preset when filename is absent ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-private-methods`
|
||||
* [#10217](https://github.com/babel/babel/pull/10217) Class Private Static Accessors ([@tim-mc](https://github.com/tim-mc))
|
||||
* `babel-generator`, `babel-parser`, `babel-types`
|
||||
* [#10148](https://github.com/babel/babel/pull/10148) V8intrinsic syntax plugin ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-preset-typescript`
|
||||
* [#10382](https://github.com/babel/babel/pull/10382) Allow setting 'allowNamespaces' in typescript preset ([@dsgkirkby](https://github.com/dsgkirkby))
|
||||
* `babel-parser`
|
||||
* [#10352](https://github.com/babel/babel/pull/10352) Do not register ambient classes to the TS scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-types`
|
||||
* [#10248](https://github.com/babel/babel/pull/10248) Add static to class property builder ([@yuri-karadzhov](https://github.com/yuri-karadzhov))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
|
||||
* [#10396](https://github.com/babel/babel/pull/10396) fix: early return when instance is not iterable ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#10398](https://github.com/babel/babel/pull/10398) Add supports for polyfill computed methods ([@rhyzx](https://github.com/rhyzx))
|
||||
* `babel-preset-env`
|
||||
* [#10397](https://github.com/babel/babel/pull/10397) Don't polyfill when evaluation is not confident ([@rhyzx](https://github.com/rhyzx))
|
||||
* [#10218](https://github.com/babel/babel/pull/10218) [preset-env] Include / exclude module plugins properly ([@AdamRamberg](https://github.com/AdamRamberg))
|
||||
* [#10284](https://github.com/babel/babel/pull/10284) Replace es.string.reverse with es.array.reverse ([@epicfaace](https://github.com/epicfaace))
|
||||
* `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#10395](https://github.com/babel/babel/pull/10395) fix: transform name capturing regex once ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-types`
|
||||
* [#10098](https://github.com/babel/babel/pull/10098) fix typescript for babel-types ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#10319](https://github.com/babel/babel/pull/10319) Add a builder definition including name for tsTypeParameter ([@deificx](https://github.com/deificx))
|
||||
* `babel-parser`
|
||||
* [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga))
|
||||
* [#10369](https://github.com/babel/babel/pull/10369) Retain trailing comments in array expressions ([@banga](https://github.com/banga))
|
||||
* [#10292](https://github.com/babel/babel/pull/10292) fix: assign trailing comment to ObjectProperty only when inside an ObjectExpression ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-parser`, `babel-types`
|
||||
* [#10366](https://github.com/babel/babel/pull/10366) Don't allow JSXNamespacedName to chain ([@jridgewell](https://github.com/jridgewell))
|
||||
* `babel-generator`, `babel-plugin-transform-typescript`, `babel-types`
|
||||
* [#10341](https://github.com/babel/babel/pull/10341) Add TSBigIntKeyword to @babel/types ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-core`, `babel-types`
|
||||
* [#9960](https://github.com/babel/babel/pull/9960) Do not delete "fake" source map comments from strings ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-flow-comments`
|
||||
* [#10329](https://github.com/babel/babel/pull/10329) Fix flow comments plugin issues ([@zaygraveyard](https://github.com/zaygraveyard))
|
||||
* `babel-helpers`, `babel-plugin-transform-react-constant-elements`
|
||||
* [#10307](https://github.com/babel/babel/pull/10307) [fix] jsx helper calls order ([@Sinewyk](https://github.com/Sinewyk))
|
||||
* `babel-plugin-proposal-decorators`
|
||||
* [#10302](https://github.com/babel/babel/pull/10302) fix: register inserted class declaration ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
* `babel-plugin-proposal-do-expressions`, `babel-traverse`
|
||||
* [#10070](https://github.com/babel/babel/pull/10070) Do expressions transform for switch statements ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#10277](https://github.com/babel/babel/pull/10277) remove finally from completion record in try statement ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helpers`, `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#10136](https://github.com/babel/babel/pull/10136) fix capturing group for matchAll ([@tanhauhau](https://github.com/tanhauhau))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-plugin-transform-runtime`, `babel-preset-env`
|
||||
* [#10372](https://github.com/babel/babel/pull/10372) Don't allow instance properties transformation on namespace ([@rhyzx](https://github.com/rhyzx))
|
||||
|
||||
#### :memo: Documentation
|
||||
* [#10313](https://github.com/babel/babel/pull/10313) Adds note about two approval policy to PR template ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-register`
|
||||
* [#9847](https://github.com/babel/babel/pull/9847) Remove core-js dependency from @babel/register ([@coreyfarrell](https://github.com/coreyfarrell))
|
||||
* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-preset-env`
|
||||
* [#10401](https://github.com/babel/babel/pull/10401) Use "validateLogs" for preset-env's debug fixtures ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-parser`
|
||||
* [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga))
|
||||
* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-plugin-proposal-dynamic-import`, `babel-preset-env`
|
||||
* [#10326](https://github.com/babel/babel/pull/10326) Allow testing logs with `@babel/helper-transform-fixture-test-runner` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-runtime-corejs2`, `babel-runtime`, `babel-types`
|
||||
* [#10331](https://github.com/babel/babel/pull/10331) Commit generated code ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-helper-fixtures`, `babel-node`, `babel-parser`, `babel-plugin-proposal-do-expressions`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-standalone`, `babel-template`, `babel-traverse`, `babel-types`
|
||||
* [#10228](https://github.com/babel/babel/pull/10228) Update dev dependencies and fix linting errors ([@danez](https://github.com/danez))
|
||||
* `babel-cli`
|
||||
* [#10244](https://github.com/babel/babel/pull/10244) added flow to babel cli ([@Letladi](https://github.com/Letladi))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
|
||||
* [#10161](https://github.com/babel/babel/pull/10161) Improves the logic to import objects in helpers ([@ifsnow](https://github.com/ifsnow))
|
||||
* `babel-traverse`
|
||||
* [#10243](https://github.com/babel/babel/pull/10243) perf: always return `void 0` as undefined node ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.5.5 (2019-07-17)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-code-frame`
|
||||
* [#10211](https://github.com/babel/babel/pull/10211) fix code-frame marker with highlighting ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-proposal-object-rest-spread`
|
||||
* [#10200](https://github.com/babel/babel/pull/10200) Workaround #10179 in proposal-object-rest-spread ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-types`
|
||||
* [#10198](https://github.com/babel/babel/pull/10198) add assertShape to validate templateElement ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helper-member-expression-to-functions`, `babel-helper-replace-supers`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-object-super`, `babel-types`
|
||||
* [#10017](https://github.com/babel/babel/pull/10017) destructuring private fields with array pattern / object pattern ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-transform-flow-comments`
|
||||
* [#9901](https://github.com/babel/babel/pull/9901) fix transform-flow-comments for import types ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-core`, `babel-helpers`
|
||||
* [#10208](https://github.com/babel/babel/pull/10208) always throw when add missing helpers ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#10207](https://github.com/babel/babel/pull/10207) Closes [#10205](https://github.com/babel/babel/issues/10205) ([@sag1v](https://github.com/sag1v))
|
||||
* `babel-helpers`, `babel-plugin-transform-instanceof`
|
||||
* [#10197](https://github.com/babel/babel/pull/10197) fix: custom instOfHandler result should be cast to boolean ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-parser`, `babel-plugin-transform-typescript`
|
||||
* [#10014](https://github.com/babel/babel/pull/10014) Use correct extension for typescript fixtures ([@danez](https://github.com/danez))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10189](https://github.com/babel/babel/pull/10189) perf: match ownKeys perf to the one of objectSpread ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.5.4 (2019-07-09)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
@@ -361,7 +484,7 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0
|
||||
|
||||
## v7.3.3 (2019-02-15)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`
|
||||
* [#9501](https://github.com/babel/babel/pull/9501) Correctly output escapes in directives ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
@@ -383,11 +506,11 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0
|
||||
* [#9491](https://github.com/babel/babel/pull/9491) Better error output in parser tests ([@danez](https://github.com/danez))
|
||||
## v7.3.2 (2019-02-04)
|
||||
|
||||
Various spec compliancy fixes and better support for smart pipelines and private methods.
|
||||
Various spec compliance fixes and better support for smart pipelines and private methods.
|
||||
|
||||
Thanks @gverni, @naffiq, @spondbob and @dstaley for their first PRs!
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#9403](https://github.com/babel/babel/pull/9403) Fix line continuation with Unicode line terminators. ([@danez](https://github.com/danez))
|
||||
* [#9400](https://github.com/babel/babel/pull/9400) Make yield a contextual keyword. ([@danez](https://github.com/danez))
|
||||
@@ -435,7 +558,7 @@ This release fixes some regressions introduced in v7.3.0
|
||||
|
||||
Thanks to @jamesgeorge007 and @armano2 for their first PR!
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#9314](https://github.com/babel/babel/pull/9314) Disallow async functions as loop body. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9315](https://github.com/babel/babel/pull/9315) Parse class heritage as strict mode code. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
@@ -656,7 +779,7 @@ You can read more about this release at https://babeljs.io/blog/2018/12/03/7.2.0
|
||||
|
||||
## v7.1.5 (2018-11-06)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`, `babylon`
|
||||
* [#7727](https://github.com/babel/babel/pull/7727) Fix await in function name and parameters. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
@@ -1119,7 +1242,7 @@ Fixed a peerDep issue
|
||||
|
||||
Mostly bug fixes and some decorator updates
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-unicode-property-regex`
|
||||
* [#8127](https://github.com/babel/babel/pull/8127) Update plugin-proposal-unicode-property-regex for Unicode v11. ([@mathiasbynens](https://github.com/mathiasbynens))
|
||||
* `babel-parser`
|
||||
@@ -1219,7 +1342,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
- Fix IE10 class regression
|
||||
- Various fixes, many TS fixes
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`, `babel-plugin-proposal-json-strings`, `babel-plugin-syntax-json-strings`, `babel-preset-stage-3`
|
||||
* [#7985](https://github.com/babel/babel/pull/7985) Subsume json. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -1409,7 +1532,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
* `babel-generator`, `babel-helper-define-map`, `babel-plugin-syntax-class-properties`, `babel-plugin-transform-parameters`, `babel-plugin-transform-react-constant-elements`, `babel-traverse`, `babel-types`
|
||||
* [#7666](https://github.com/babel/babel/pull/7666) Private Properties phase 1. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-helper-simple-access`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`
|
||||
* [#7766](https://github.com/babel/babel/pull/7766) Correct update expression Number coercion. ([@jridgewell](https://github.com/jridgewell))
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-proposal-decorators`, `babel-types`, `babylon`
|
||||
@@ -1497,7 +1620,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
|
||||
Various fixes, also lazy-load `@babel/core` dependencies (should make config lookup and other API methods fast for other projects to use).
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-logical-assignment-operators`
|
||||
* [#7604](https://github.com/babel/babel/pull/7604) Logical Assignment: ensure computed key isn't recomputed. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -1596,7 +1719,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2
|
||||
* `babel-register`
|
||||
* [#7416](https://github.com/babel/babel/pull/7416) Replace instead of merging babel-register options, and resolve cwd up front. ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babylon`
|
||||
* [#7503](https://github.com/babel/babel/pull/7503) Update test262 test script and a few keyword escape fixes. ([@existentialism](https://github.com/existentialism))
|
||||
* [#7498](https://github.com/babel/babel/pull/7498) Disallow setters to have RestElement. ([@danez](https://github.com/danez))
|
||||
@@ -1744,7 +1867,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2
|
||||
|
||||
## v7.0.0-beta.39 (2018-01-30)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-optional-chaining`
|
||||
* [#6345](https://github.com/babel/babel/pull/6345) Remove old optional chain features. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -1957,7 +2080,7 @@ Fixes + [overrides](https://github.com/babel/babel/pull/7091) config feature
|
||||
|
||||
Various bug fixes, first version of Babel to use the MIT version of `regenerator`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babylon`
|
||||
* [#6986](https://github.com/babel/babel/pull/6986) Fix destructuring assignment spec violation. ([@ksashikumar](https://github.com/ksashikumar))
|
||||
* `babel-helper-replace-supers`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters`
|
||||
@@ -2010,7 +2133,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
* `babel-preset-stage-1`, `babel-preset-stage-2`
|
||||
* [#6949](https://github.com/babel/babel/pull/6949) Fix stage refs to exportNamespaceFrom and exportDefaultFrom. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-preset-stage-0`, `babel-preset-stage-1`
|
||||
* [#6943](https://github.com/babel/babel/pull/6943) Moving Do expression to stage 1. ([@rajzshkr](https://github.com/rajzshkr))
|
||||
|
||||
@@ -2024,7 +2147,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
|
||||
## v7.0.0-beta.33 (2017-12-01)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-proposal-export-default-from`, `babel-plugin-proposal-export-default`, `babel-plugin-proposal-export-namespace-from`, `babel-plugin-proposal-export-namespace`, `babel-plugin-syntax-export-default-from`, `babel-plugin-syntax-export-extensions`, `babel-plugin-syntax-export-namespace-from`, `babel-standalone`, `babylon`
|
||||
* [#6920](https://github.com/babel/babel/pull/6920) Split exportExtensions into exportDefault and exportNamespace plugins…. ([@existentialism](https://github.com/existentialism))
|
||||
* `babylon`
|
||||
@@ -2209,7 +2332,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
|
||||
> Note: don't use ^ in your dependencies when using a beta. It can still break between (we should try not to do it but it can), so pin all the packages like `"@babel/cli" : "7.0.0-beta.4"`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-transform-optional-chaining`
|
||||
* [#6525](https://github.com/babel/babel/pull/6525) Optional Chaining: Account for document.all. ([@azz](https://github.com/azz))
|
||||
* `babel-preset-env`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`, `babel-plugin-transform-function-sent`
|
||||
@@ -2489,7 +2612,7 @@ let {...{}} = {}; let {...[]} = {};
|
||||
- Add `--config-file` CLI flag to explicitly pass a config location
|
||||
- Move `babel-standalone` into the repo (another form of this used to be `babel-browser`)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-transform-async-to-generator`, `babel-*`
|
||||
* [#6094](https://github.com/babel/babel/pull/6094) Spec compatibility for iteratorClose condition.. ([@yavorsky](https://github.com/yavorsky))
|
||||
* `babel-helpers`, `babel-plugin-transform-es2015-computed-properties`
|
||||
@@ -2625,7 +2748,7 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b
|
||||
|
||||
## v7.0.0-alpha.18 (2017-08-03)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-types`
|
||||
* [#5990](https://github.com/babel/babel/pull/5990) Flow opaque type aliases. ([@jbrown215](https://github.com/jbrown215))
|
||||
* `babel-preset-stage-3`
|
||||
@@ -2674,9 +2797,9 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b
|
||||
- Optional catch binding `try {} catch {}`: `babel-plugin-transform-optional-catch-binding`
|
||||
- es2015-parameters `loose` mode that doesn't use `arguments`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-check-es2015-constants`
|
||||
* [#5930](https://github.com/babel/babel/pull/5930) Spec compliancy of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf))
|
||||
* [#5930](https://github.com/babel/babel/pull/5930) Spec compliance of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf))
|
||||
|
||||
> Instead of throwing a compile time error when const is violated, Babel should insert a throw statement before the violation.
|
||||
|
||||
@@ -2981,7 +3104,7 @@ var A = function A() {
|
||||
|
||||
## v7.0.0-alpha.12 (2017-05-31)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-syntax-numeric-separator`, `babel-plugin-transform-numeric-separator`, `babel-preset-stage-1`, `babel-template`, `babel-traverse`, `babel-types`
|
||||
* [#5793](https://github.com/babel/babel/pull/5793) Support for NumericLiteralSeparator, Stage 1 feature. ([@rwaldron](https://github.com/rwaldron))
|
||||
|
||||
@@ -3022,7 +3145,7 @@ var A = function A() {
|
||||
|
||||
Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, https://github.com/babel/babylon/releases/tag/v7.0.0-beta.10
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-transform-flow-strip-types`, `babel-types`
|
||||
* [#5525](https://github.com/babel/babel/pull/5525) Add support for object type spread. ([@conartist6](https://github.com/conartist6))
|
||||
|
||||
@@ -3096,7 +3219,7 @@ Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, htt
|
||||
|
||||
## v7.0.0-alpha.8 (2017-04-17)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-preset-stage-2`, `babel-preset-stage-3`
|
||||
* [#5610](https://github.com/babel/babel/pull/5610) Move syntax-dynamic-import to stage-3. ([@dkaoster](https://github.com/dkaoster))
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ contributing, please read the
|
||||
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/)
|
||||
for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
|
||||
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
|
||||
- You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to babel on CodeTriage](https://www.codetriage.com/babel/babel). [](https://www.codetriage.com/babel/babel)
|
||||
|
||||
## Chat
|
||||
|
||||
|
||||
9
Makefile
9
Makefile
@@ -1,6 +1,6 @@
|
||||
MAKEFLAGS = -j1
|
||||
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
|
||||
TEST262_COMMIT = de567d3aa5de4eaa11e00131d26b9fe77997dfb0
|
||||
TEST262_COMMIT = ef7fd2bc27e7c10b4a71d2edc632a2934742a13e
|
||||
|
||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||
export FORCE_COLOR = true
|
||||
@@ -54,9 +54,14 @@ watch: clean clean-lib
|
||||
flow:
|
||||
./node_modules/.bin/flow check --strip-root
|
||||
|
||||
lint:
|
||||
lint: lint-js lint-ts
|
||||
|
||||
lint-js:
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe
|
||||
|
||||
lint-ts:
|
||||
./scripts/tests/typescript/lint.sh
|
||||
|
||||
fix: fix-json
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
|
||||
|
||||
|
||||
21
README.md
21
README.md
@@ -80,14 +80,14 @@ Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGD
|
||||
|
||||
Mostly a handful of volunteers, funded by you! Please check out our [team page](https://babeljs.io/team)!
|
||||
|
||||
### Looking for support?
|
||||
|
||||
For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
||||
|
||||
### Is there a Babel song?
|
||||
|
||||
I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings!
|
||||
|
||||
### Looking for support?
|
||||
|
||||
For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
||||
|
||||
### Where are the docs?
|
||||
|
||||
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
|
||||
@@ -98,12 +98,19 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu
|
||||
|
||||
### Want to contribute to Babel?
|
||||
|
||||
Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
|
||||
Check out:
|
||||
|
||||
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
|
||||
- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
|
||||
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))!
|
||||
- Issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle.
|
||||
|
||||
Some resources:
|
||||
|
||||
- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
|
||||
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
||||
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
|
||||
- Our blog which contains release posts and explainations: [/blog](https://babeljs.io/blog)
|
||||
- Our videos page with talks about open source and Babel: [/videos](https://babeljs.io/videos)
|
||||
- Our [podcast](https://podcast.babeljs.io)
|
||||
|
||||
### How is the repo structured?
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.2",
|
||||
"changelog": {
|
||||
"repo": "babel/babel",
|
||||
"cacheDir": ".changelog",
|
||||
|
||||
@@ -165,7 +165,7 @@ declare module "source-map" {
|
||||
}
|
||||
|
||||
declare module "convert-source-map" {
|
||||
import type { SourceMap } from "source-map";
|
||||
import type { SourceMap, SourceMapGenerator } from "source-map";
|
||||
|
||||
declare class Converter {
|
||||
toJSON(): string;
|
||||
@@ -177,11 +177,11 @@ declare module "convert-source-map" {
|
||||
declare module.exports: {
|
||||
SourceMap: SourceMap,
|
||||
Converter: Converter,
|
||||
fromObject(obj: SourceMap): Converter,
|
||||
fromObject(obj: SourceMap | SourceMapGenerator): Converter,
|
||||
fromJSON(str: string): Converter,
|
||||
fromBase64(str: string): Converter,
|
||||
fromComment(str: string): Converter,
|
||||
fromMapFileComment(str: string): Converter,
|
||||
fromMapFileComment(str: string, dir: string): Converter,
|
||||
fromSource(str: string): Converter,
|
||||
fromMapFileSource(str: string, dir: string): Converter,
|
||||
removeComments(str: string): string,
|
||||
|
||||
34
package.json
34
package.json
@@ -9,18 +9,18 @@
|
||||
"test": "make test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.4.4",
|
||||
"@babel/core": "^7.4.5",
|
||||
"@babel/cli": "^7.6.0",
|
||||
"@babel/core": "^7.6.0",
|
||||
"@babel/eslint-plugin-development": "^1.0.1",
|
||||
"@babel/plugin-proposal-class-properties": "^7.4.4",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.5.2",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.4.4",
|
||||
"@babel/plugin-transform-runtime": "^7.4.4",
|
||||
"@babel/preset-env": "^7.4.5",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
|
||||
"@babel/plugin-transform-runtime": "^7.6.0",
|
||||
"@babel/preset-env": "^7.6.0",
|
||||
"@babel/preset-flow": "^7.0.0",
|
||||
"@babel/register": "^7.4.4",
|
||||
"@babel/runtime": "^7.4.5",
|
||||
"@babel/register": "^7.6.0",
|
||||
"@babel/runtime": "^7.6.0",
|
||||
"babel-eslint": "^11.0.0-beta.0",
|
||||
"babel-jest": "^24.8.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
@@ -32,13 +32,13 @@
|
||||
"derequire": "^2.0.2",
|
||||
"duplicate-package-checker-webpack-plugin": "^2.1.0",
|
||||
"enhanced-resolve": "^3.0.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint": "^6.0.1",
|
||||
"eslint-config-babel": "^9.0.0",
|
||||
"eslint-plugin-flowtype": "^3.8.2",
|
||||
"eslint-plugin-import": "^2.17.2",
|
||||
"eslint-plugin-prettier": "^3.1.0",
|
||||
"fancy-log": "^1.3.3",
|
||||
"flow-bin": "^0.94.0",
|
||||
"flow-bin": "^0.102.0",
|
||||
"graceful-fs": "^4.1.15",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-babel": "^8.0.0",
|
||||
@@ -48,11 +48,11 @@
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"gulp-watch": "^5.0.1",
|
||||
"husky": "^2.3.0",
|
||||
"husky": "^3.0.0",
|
||||
"jest": "^24.8.0",
|
||||
"lerna": "^3.14.2",
|
||||
"lerna": "^3.16.0",
|
||||
"lerna-changelog": "^0.5.0",
|
||||
"lint-staged": "^8.1.7",
|
||||
"lint-staged": "^9.2.0",
|
||||
"lodash": "^4.17.13",
|
||||
"merge-stream": "^1.0.1",
|
||||
"output-file-sync": "^2.0.0",
|
||||
@@ -63,8 +63,9 @@
|
||||
"rollup-plugin-babel": "^4.0.0",
|
||||
"rollup-plugin-node-resolve": "^5.0.0",
|
||||
"rollup-plugin-replace": "^2.2.0",
|
||||
"test262-stream": "^1.2.0",
|
||||
"test262-stream": "^1.3.0",
|
||||
"through2": "^2.0.0",
|
||||
"typescript": "^3.6.3",
|
||||
"warnings-to-errors-webpack-plugin": "^2.0.0",
|
||||
"webpack": "^3.4.1",
|
||||
"webpack-dependency-suite": "^2.4.4",
|
||||
@@ -134,6 +135,5 @@
|
||||
"moduleNameMapper": {
|
||||
"^@babel/([a-zA-Z0-9_-]+)$": "<rootDir>/packages/babel-$1/"
|
||||
}
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/cli",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.2",
|
||||
"description": "Babel command line.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -30,14 +30,14 @@
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"chokidar": "^2.0.4"
|
||||
"chokidar": "^2.1.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.5",
|
||||
"@babel/helper-fixtures": "^7.5.5"
|
||||
"@babel/core": "^7.6.2",
|
||||
"@babel/helper-fixtures": "^7.6.2"
|
||||
},
|
||||
"bin": {
|
||||
"babel": "./bin/babel.js",
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// @flow
|
||||
|
||||
import commander from "commander";
|
||||
import { buildExternalHelpers } from "@babel/core";
|
||||
|
||||
function collect(value, previousValue): Array<string> {
|
||||
function collect(
|
||||
value: string | any,
|
||||
previousValue: Array<string>,
|
||||
): Array<string> {
|
||||
// If the user passed the option with no value, like "babel-external-helpers --whitelist", do nothing.
|
||||
if (typeof value !== "string") return previousValue;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @flow
|
||||
|
||||
import defaults from "lodash/defaults";
|
||||
import outputFileSync from "output-file-sync";
|
||||
import { sync as mkdirpSync } from "mkdirp";
|
||||
@@ -6,11 +8,15 @@ import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
import * as util from "./util";
|
||||
import { type CmdOptions } from "./options";
|
||||
|
||||
export default async function({ cliOptions, babelOptions }) {
|
||||
export default async function({
|
||||
cliOptions,
|
||||
babelOptions,
|
||||
}: CmdOptions): Promise<void> {
|
||||
const filenames = cliOptions.filenames;
|
||||
|
||||
async function write(src, base) {
|
||||
async function write(src: string, base: string): Promise<boolean> {
|
||||
let relative = path.relative(base, src);
|
||||
|
||||
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
||||
@@ -65,14 +71,14 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
}
|
||||
}
|
||||
|
||||
function getDest(filename, base) {
|
||||
function getDest(filename: string, base: string): string {
|
||||
if (cliOptions.relative) {
|
||||
return path.join(base, cliOptions.outDir, filename);
|
||||
}
|
||||
return path.join(cliOptions.outDir, filename);
|
||||
}
|
||||
|
||||
async function handleFile(src, base) {
|
||||
async function handleFile(src: string, base: string): Promise<boolean> {
|
||||
const written = await write(src, base);
|
||||
|
||||
if (!written && cliOptions.copyFiles) {
|
||||
@@ -84,7 +90,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
return written;
|
||||
}
|
||||
|
||||
async function handle(filenameOrDir) {
|
||||
async function handle(filenameOrDir: string): Promise<number> {
|
||||
if (!fs.existsSync(filenameOrDir)) return 0;
|
||||
|
||||
const stat = fs.statSync(filenameOrDir);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @flow
|
||||
|
||||
import convertSourceMap from "convert-source-map";
|
||||
import defaults from "lodash/defaults";
|
||||
import sourceMap from "source-map";
|
||||
@@ -6,9 +8,18 @@ import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
import * as util from "./util";
|
||||
import { type CmdOptions } from "./options";
|
||||
|
||||
export default async function({ cliOptions, babelOptions }) {
|
||||
function buildResult(fileResults) {
|
||||
type CompilationOutput = {
|
||||
code: string,
|
||||
map: Object,
|
||||
};
|
||||
|
||||
export default async function({
|
||||
cliOptions,
|
||||
babelOptions,
|
||||
}: CmdOptions): Promise<void> {
|
||||
function buildResult(fileResults: Array<Object>): CompilationOutput {
|
||||
const map = new sourceMap.SourceMapGenerator({
|
||||
file:
|
||||
cliOptions.sourceMapTarget ||
|
||||
@@ -74,7 +85,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
};
|
||||
}
|
||||
|
||||
function output(fileResults) {
|
||||
function output(fileResults: Array<string>): void {
|
||||
const result = buildResult(fileResults);
|
||||
|
||||
if (cliOptions.outFile) {
|
||||
@@ -91,14 +102,15 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
}
|
||||
}
|
||||
|
||||
function readStdin() {
|
||||
return new Promise((resolve, reject) => {
|
||||
function readStdin(): Promise<string> {
|
||||
return new Promise((resolve: Function, reject: Function): void => {
|
||||
let code = "";
|
||||
|
||||
process.stdin.setEncoding("utf8");
|
||||
|
||||
process.stdin.on("readable", function() {
|
||||
const chunk = process.stdin.read();
|
||||
// $FlowIgnore
|
||||
if (chunk !== null) code += chunk;
|
||||
});
|
||||
|
||||
@@ -109,7 +121,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
});
|
||||
}
|
||||
|
||||
async function stdin() {
|
||||
async function stdin(): Promise<void> {
|
||||
const code = await readStdin();
|
||||
|
||||
const res = await util.transform(
|
||||
@@ -126,7 +138,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
output([res]);
|
||||
}
|
||||
|
||||
async function walk(filenames) {
|
||||
async function walk(filenames: Array<string>): Promise<void> {
|
||||
const _filenames = [];
|
||||
|
||||
filenames.forEach(function(filename) {
|
||||
@@ -151,7 +163,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
});
|
||||
|
||||
const results = await Promise.all(
|
||||
_filenames.map(async function(filename) {
|
||||
_filenames.map(async function(filename: string): Promise<Object> {
|
||||
let sourceFilename = filename;
|
||||
if (cliOptions.outFile) {
|
||||
sourceFilename = path.relative(
|
||||
@@ -168,7 +180,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
{
|
||||
sourceFileName: sourceFilename,
|
||||
// Since we're compiling everything to be merged together,
|
||||
// "inline" applies to the final output file, but to the individual
|
||||
// "inline" applies to the final output file, but not to the individual
|
||||
// files being concatenated.
|
||||
sourceMaps:
|
||||
babelOptions.sourceMaps === "inline"
|
||||
@@ -192,7 +204,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
output(results);
|
||||
}
|
||||
|
||||
async function files(filenames) {
|
||||
async function files(filenames: Array<string>): Promise<void> {
|
||||
if (!cliOptions.skipInitialBuild) {
|
||||
await walk(filenames);
|
||||
}
|
||||
@@ -208,7 +220,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
pollInterval: 10,
|
||||
},
|
||||
})
|
||||
.on("all", function(type, filename) {
|
||||
.on("all", function(type: string, filename: string) {
|
||||
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,12 @@ import fileCommand from "./file";
|
||||
|
||||
const opts = parseArgv(process.argv);
|
||||
|
||||
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
|
||||
fn(opts).catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
if (opts) {
|
||||
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
|
||||
fn(opts).catch(err => {
|
||||
console.error(err);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
} else {
|
||||
process.exitCode = 2;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @flow
|
||||
|
||||
import fs from "fs";
|
||||
|
||||
import commander from "commander";
|
||||
@@ -151,7 +153,12 @@ commander.option(
|
||||
commander.version(pkg.version + " (@babel/core " + version + ")");
|
||||
commander.usage("[options] <files ...>");
|
||||
|
||||
export default function parseArgv(args: Array<string>) {
|
||||
export type CmdOptions = {
|
||||
babelOptions: Object,
|
||||
cliOptions: Object,
|
||||
};
|
||||
|
||||
export default function parseArgv(args: Array<string>): CmdOptions | null {
|
||||
//
|
||||
commander.parse(args);
|
||||
|
||||
@@ -216,7 +223,7 @@ export default function parseArgv(args: Array<string>) {
|
||||
errors.forEach(function(e) {
|
||||
console.error(" " + e);
|
||||
});
|
||||
process.exit(2);
|
||||
return null;
|
||||
}
|
||||
|
||||
const opts = commander.opts();
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// @flow
|
||||
|
||||
import readdirRecursive from "fs-readdir-recursive";
|
||||
import * as babel from "@babel/core";
|
||||
import includes from "lodash/includes";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
export function chmod(src, dest) {
|
||||
export function chmod(src: string, dest: string): void {
|
||||
fs.chmodSync(dest, fs.statSync(src).mode);
|
||||
}
|
||||
|
||||
@@ -13,8 +15,8 @@ type ReaddirFilter = (filename: string) => boolean;
|
||||
export function readdir(
|
||||
dirname: string,
|
||||
includeDotfiles: boolean,
|
||||
filter: ReaddirFilter,
|
||||
) {
|
||||
filter?: ReaddirFilter,
|
||||
): Array<string> {
|
||||
return readdirRecursive(dirname, (filename, _index, currentDirectory) => {
|
||||
const stat = fs.statSync(path.join(currentDirectory, filename));
|
||||
|
||||
@@ -30,7 +32,7 @@ export function readdirForCompilable(
|
||||
dirname: string,
|
||||
includeDotfiles: boolean,
|
||||
altExts?: Array<string>,
|
||||
) {
|
||||
): Array<string> {
|
||||
return readdir(dirname, includeDotfiles, function(filename) {
|
||||
return isCompilableExtension(filename, altExts);
|
||||
});
|
||||
@@ -48,7 +50,7 @@ export function isCompilableExtension(
|
||||
return includes(exts, ext);
|
||||
}
|
||||
|
||||
export function addSourceMappingUrl(code, loc) {
|
||||
export function addSourceMappingUrl(code: string, loc: string): string {
|
||||
return code + "\n//# sourceMappingURL=" + path.basename(loc);
|
||||
}
|
||||
|
||||
@@ -56,7 +58,11 @@ const CALLER = {
|
||||
name: "@babel/cli",
|
||||
};
|
||||
|
||||
export function transform(filename, code, opts) {
|
||||
export function transform(
|
||||
filename: string,
|
||||
code: string,
|
||||
opts: Object,
|
||||
): Promise<Object> {
|
||||
opts = {
|
||||
...opts,
|
||||
caller: CALLER,
|
||||
@@ -71,7 +77,10 @@ export function transform(filename, code, opts) {
|
||||
});
|
||||
}
|
||||
|
||||
export function compile(filename, opts) {
|
||||
export function compile(
|
||||
filename: string,
|
||||
opts: Object | Function,
|
||||
): Promise<Object> {
|
||||
opts = {
|
||||
...opts,
|
||||
caller: CALLER,
|
||||
@@ -85,7 +94,7 @@ export function compile(filename, opts) {
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteDir(path) {
|
||||
export function deleteDir(path: string): void {
|
||||
if (fs.existsSync(path)) {
|
||||
fs.readdirSync(path).forEach(function(file) {
|
||||
const curPath = path + "/" + file;
|
||||
@@ -103,10 +112,10 @@ export function deleteDir(path) {
|
||||
|
||||
process.on("uncaughtException", function(err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
export function requireChokidar() {
|
||||
export function requireChokidar(): Object {
|
||||
try {
|
||||
return require("chokidar");
|
||||
} catch (err) {
|
||||
@@ -118,7 +127,10 @@ export function requireChokidar() {
|
||||
}
|
||||
}
|
||||
|
||||
export function adjustRelative(relative, keepFileExtension) {
|
||||
export function adjustRelative(
|
||||
relative: string,
|
||||
keepFileExtension: boolean,
|
||||
): string {
|
||||
if (keepFileExtension) {
|
||||
return relative;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ const assertTest = function(stdout, stderr, opts, cwd) {
|
||||
if (
|
||||
// saveInFiles always creates an empty .babelrc, so lets exclude for now
|
||||
filename !== ".babelrc" &&
|
||||
!opts.inFiles.hasOwnProperty(filename)
|
||||
!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)
|
||||
) {
|
||||
const expected = opts.outFiles[filename];
|
||||
const actual = actualFiles[filename];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/core",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.2",
|
||||
"description": "Babel compiler core.",
|
||||
"main": "lib/index.js",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
@@ -34,12 +34,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/generator": "^7.5.5",
|
||||
"@babel/helpers": "^7.5.5",
|
||||
"@babel/parser": "^7.5.5",
|
||||
"@babel/template": "^7.4.4",
|
||||
"@babel/traverse": "^7.5.5",
|
||||
"@babel/types": "^7.5.5",
|
||||
"@babel/generator": "^7.6.2",
|
||||
"@babel/helpers": "^7.6.2",
|
||||
"@babel/parser": "^7.6.2",
|
||||
"@babel/template": "^7.6.0",
|
||||
"@babel/traverse": "^7.6.2",
|
||||
"@babel/types": "^7.6.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"debug": "^4.1.0",
|
||||
"json5": "^2.1.0",
|
||||
@@ -49,7 +49,6 @@
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.5.5",
|
||||
"@babel/register": "^7.5.5"
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,13 +268,11 @@ function babelrcLoadEnabled(
|
||||
});
|
||||
}
|
||||
|
||||
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 => ({
|
||||
@@ -284,13 +282,11 @@ 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.
|
||||
@@ -549,7 +545,7 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions {
|
||||
|
||||
// "sourceMap" is just aliased to sourceMap, so copy it over as
|
||||
// we merge the options together.
|
||||
if (options.hasOwnProperty("sourceMap")) {
|
||||
if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) {
|
||||
options.sourceMaps = options.sourceMap;
|
||||
delete options.sourceMap;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { validatePluginObject } from "./validation/plugins";
|
||||
import makeAPI from "./helpers/config-api";
|
||||
|
||||
import loadPrivatePartialConfig from "./partial";
|
||||
import type { ValidatedOptions } from "./validation/options";
|
||||
|
||||
type LoadedDescriptor = {
|
||||
value: {},
|
||||
@@ -278,6 +279,42 @@ const instantiatePlugin = makeWeakCache(
|
||||
},
|
||||
);
|
||||
|
||||
const validateIfOptionNeedsFilename = (
|
||||
options: ValidatedOptions,
|
||||
descriptor: UnloadedDescriptor,
|
||||
): void => {
|
||||
if (options.test || options.include || options.exclude) {
|
||||
const formattedPresetName = descriptor.name
|
||||
? `"${descriptor.name}"`
|
||||
: "/* your preset */";
|
||||
throw new Error(
|
||||
[
|
||||
`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`,
|
||||
`\`\`\``,
|
||||
`babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`,
|
||||
`\`\`\``,
|
||||
`See https://babeljs.io/docs/en/options#filename for more information.`,
|
||||
].join("\n"),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const validatePreset = (
|
||||
preset: PresetInstance,
|
||||
context: ConfigContext,
|
||||
descriptor: UnloadedDescriptor,
|
||||
): void => {
|
||||
if (!context.filename) {
|
||||
const { options } = preset;
|
||||
validateIfOptionNeedsFilename(options, descriptor);
|
||||
if (options.overrides) {
|
||||
options.overrides.forEach(overrideOptions =>
|
||||
validateIfOptionNeedsFilename(overrideOptions, descriptor),
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate a config object that will act as the root of a new nested config.
|
||||
*/
|
||||
@@ -285,10 +322,9 @@ const loadPresetDescriptor = (
|
||||
descriptor: UnloadedDescriptor,
|
||||
context: ConfigContext,
|
||||
): ConfigChain | null => {
|
||||
return buildPresetChain(
|
||||
instantiatePreset(loadDescriptor(descriptor, context)),
|
||||
context,
|
||||
);
|
||||
const preset = instantiatePreset(loadDescriptor(descriptor, context));
|
||||
validatePreset(preset, context, descriptor);
|
||||
return buildPresetChain(preset, context);
|
||||
};
|
||||
|
||||
const instantiatePreset = makeWeakCache(
|
||||
|
||||
@@ -278,7 +278,7 @@ export function assertConfigFileSearch(
|
||||
) {
|
||||
throw new Error(
|
||||
`${msg(loc)} must be a undefined, a boolean, a string, ` +
|
||||
`got ${JSON.stringify(value)}`,
|
||||
`got ${JSON.stringify((value: any))}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ export function assertBabelrcSearch(
|
||||
} else if (!checkValidTest(value)) {
|
||||
throw new Error(
|
||||
`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` +
|
||||
`or an array of those, got ${JSON.stringify(value)}`,
|
||||
`or an array of those, got ${JSON.stringify((value: any))}`,
|
||||
);
|
||||
}
|
||||
return (value: any);
|
||||
|
||||
@@ -272,7 +272,8 @@ export type OptionsSource =
|
||||
| "configfile"
|
||||
| "babelrcfile"
|
||||
| "extendsfile"
|
||||
| "preset";
|
||||
| "preset"
|
||||
| "plugin";
|
||||
|
||||
type RootPath = $ReadOnly<{
|
||||
type: "root",
|
||||
|
||||
@@ -84,10 +84,19 @@ export type PluginObject = {
|
||||
};
|
||||
|
||||
export function validatePluginObject(obj: {}): PluginObject {
|
||||
const rootPath: RootPath = {
|
||||
type: "root",
|
||||
source: "plugin",
|
||||
};
|
||||
Object.keys(obj).forEach(key => {
|
||||
const validator = VALIDATORS[key];
|
||||
const optLoc = {
|
||||
type: "option",
|
||||
name: key,
|
||||
parent: rootPath,
|
||||
};
|
||||
|
||||
if (validator) validator(key, obj[key]);
|
||||
if (validator) validator(optLoc, obj[key]);
|
||||
else throw new Error(`.${key} is not a valid Plugin property`);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @flow
|
||||
|
||||
import type { PluginPasses } from "../../config";
|
||||
import convertSourceMap, { type SourceMap } from "convert-source-map";
|
||||
import convertSourceMap, { typeof SourceMap } from "convert-source-map";
|
||||
import generate from "@babel/generator";
|
||||
|
||||
import type File from "./file";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
|
||||
import type { SourceMap } from "convert-source-map";
|
||||
import typeof { SourceMap } from "convert-source-map";
|
||||
import sourceMap from "source-map";
|
||||
|
||||
export default function mergeSourceMap(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
import traverse from "@babel/traverse";
|
||||
import type { SourceMap } from "convert-source-map";
|
||||
import typeof { SourceMap } from "convert-source-map";
|
||||
|
||||
import type { ResolvedConfig, PluginPasses } from "../config";
|
||||
|
||||
|
||||
@@ -27,49 +27,6 @@ export default function normalizeFile(
|
||||
): File {
|
||||
code = `${code || ""}`;
|
||||
|
||||
let inputMap = null;
|
||||
if (options.inputSourceMap !== false) {
|
||||
// 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.fromSource(code);
|
||||
|
||||
if (inputMap) {
|
||||
code = convertSourceMap.removeComments(code);
|
||||
}
|
||||
} catch (err) {
|
||||
debug("discarding unknown inline input sourcemap", err);
|
||||
code = convertSourceMap.removeComments(code);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ast) {
|
||||
if (ast.type === "Program") {
|
||||
ast = t.file(ast, [], []);
|
||||
@@ -84,6 +41,42 @@ export default function normalizeFile(
|
||||
ast = parser(pluginPasses, options, code);
|
||||
}
|
||||
|
||||
let inputMap = null;
|
||||
if (options.inputSourceMap !== false) {
|
||||
// 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) {
|
||||
const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);
|
||||
if (lastComment) {
|
||||
try {
|
||||
inputMap = convertSourceMap.fromComment(lastComment);
|
||||
} catch (err) {
|
||||
debug("discarding unknown inline input sourcemap", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!inputMap) {
|
||||
const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);
|
||||
if (typeof options.filename === "string" && lastComment) {
|
||||
try {
|
||||
inputMap = convertSourceMap.fromMapFileComment(
|
||||
lastComment,
|
||||
path.dirname(options.filename),
|
||||
);
|
||||
} catch (err) {
|
||||
debug("discarding unknown file input sourcemap", err);
|
||||
}
|
||||
} else if (lastComment) {
|
||||
debug("discarding un-loadable file input sourcemap");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new File(options, {
|
||||
code,
|
||||
ast,
|
||||
@@ -156,3 +149,48 @@ function parser(
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// These regexps are copied from the convert-source-map package,
|
||||
// but without // or /* at the beginning of the comment.
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/;
|
||||
const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$/;
|
||||
|
||||
function extractCommentsFromList(regex, comments, lastComment) {
|
||||
if (comments) {
|
||||
comments = comments.filter(({ value }) => {
|
||||
if (regex.test(value)) {
|
||||
lastComment = value;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
return [comments, lastComment];
|
||||
}
|
||||
|
||||
function extractComments(regex, ast) {
|
||||
let lastComment = null;
|
||||
t.traverseFast(ast, node => {
|
||||
// $FlowIgnore destructuring with expressions is not supported
|
||||
[node.leadingComments, lastComment] = extractCommentsFromList(
|
||||
regex,
|
||||
node.leadingComments,
|
||||
lastComment,
|
||||
);
|
||||
// $FlowIgnore destructuring with expressions is not supported
|
||||
[node.innerComments, lastComment] = extractCommentsFromList(
|
||||
regex,
|
||||
node.innerComments,
|
||||
lastComment,
|
||||
);
|
||||
// $FlowIgnore destructuring with expressions is not supported
|
||||
[node.trailingComments, lastComment] = extractCommentsFromList(
|
||||
regex,
|
||||
node.trailingComments,
|
||||
lastComment,
|
||||
);
|
||||
});
|
||||
return lastComment;
|
||||
}
|
||||
|
||||
@@ -1049,5 +1049,27 @@ describe("buildConfigChain", function() {
|
||||
loadOptions({ filename, cwd: path.dirname(filename) }),
|
||||
).toThrow(/Error while parsing JSON - /);
|
||||
});
|
||||
|
||||
it("should throw when `test` presents but `filename` is not passed", () => {
|
||||
expect(() => loadOptions({ test: /\.ts$/, plugins: [] })).toThrow(
|
||||
/Configuration contains string\/RegExp pattern/,
|
||||
);
|
||||
});
|
||||
|
||||
it("should throw when `preset` requires `filename` but it was not passed", () => {
|
||||
expect(() => {
|
||||
loadOptions({
|
||||
presets: [require("./fixtures/config-loading/preset4")],
|
||||
});
|
||||
}).toThrow(/Preset \/\* your preset \*\/ requires a filename/);
|
||||
});
|
||||
|
||||
it("should throw when `preset.overrides` requires `filename` but it was not passed", () => {
|
||||
expect(() => {
|
||||
loadOptions({
|
||||
presets: [require("./fixtures/config-loading/preset5")],
|
||||
});
|
||||
}).toThrow(/Preset \/\* your preset \*\/ requires a filename/);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -322,6 +322,21 @@ describe("@babel/core config loading", () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("should thrown when plugin is not valid", () => {
|
||||
const fooPlugin = {
|
||||
inherits: "inhertis-should-not-be-string",
|
||||
};
|
||||
const opts = {
|
||||
cwd: path.dirname(FILEPATH),
|
||||
filename: FILEPATH,
|
||||
plugins: [fooPlugin],
|
||||
};
|
||||
|
||||
expect(() => loadConfig(opts)).toThrow(
|
||||
/\.inherits must be a function, or undefined/,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("caller metadata", () => {
|
||||
|
||||
6
packages/babel-core/test/fixtures/config-loading/preset4.js
vendored
Normal file
6
packages/babel-core/test/fixtures/config-loading/preset4.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
module.exports = function() {
|
||||
return {
|
||||
test: /\.ts$/,
|
||||
plugins: []
|
||||
}
|
||||
};
|
||||
8
packages/babel-core/test/fixtures/config-loading/preset5.js
vendored
Normal file
8
packages/babel-core/test/fixtures/config-loading/preset5.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = function() {
|
||||
return {
|
||||
overrides: [{
|
||||
test: /\.ts$/,
|
||||
plugins: []
|
||||
}]
|
||||
}
|
||||
};
|
||||
8
packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js
vendored
Normal file
8
packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// https://github.com/babel/babel/issues/9790
|
||||
const comment = `//# sourceMappingURL=${path.basename(
|
||||
sourceMapFilename
|
||||
)}`
|
||||
|
||||
// https://github.com/babel/babel/issues/9956
|
||||
this.shadowRoot.innerHTML = `<style>div{display:block}
|
||||
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmllbGQuaHRtbCIsInNvdXJjZXMiOlsiZmllbGQuaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8c3ZlbHRlOm9wdGlvbnMgdGFnPVwiZGxzLWZpZWxkXCIgLz5cblxuPHN0eWxlPlxuICBkaXYgeyBkaXNwbGF5OiBibG9jazsgfVxuPC9zdHlsZT5cblxuPGRpdiBjbGFzcz1cImZpZWxkXCI+XG4gIDxkaXYgY2xhc3M9XCJfZmllbGRMYWJlbExheW91dFwiPlxuICAgIDxkaXYgY2xhc3M9XCJmaWVsZExhYmVsXCI+XG4gICAgICA8c2xvdCBuYW1lPVwiZmllbGQtbGFiZWxcIj48L3Nsb3Q+XG4gICAgPC9kaXY+XG4gICAgPGRpdiBjbGFzcz1cImZpZWxkT3B0aW9uYWxcIiBjbGFzczpvcHRpb25hbD5cbiAgICAgIE9wdGlvbmFsXG4gICAgPC9kaXY+XG4gIDwvZGl2PlxuICA8ZGl2IGNsYXNzPVwiZmllbGREZXRhaWxcIj5cbiAgICA8c2xvdCBuYW1lPVwiZmllbGQtZGV0YWlsXCI+PC9zbG90PlxuICA8L2Rpdj5cbiAgPGRpdiBjbGFzcz1cImZpZWxkQ29udHJvbFwiPlxuICAgIDxzbG90IG5hbWU9XCJmaWVsZC1jb250cm9sXCI+PC9zbG90PlxuICAgIDxzbG90Pjwvc2xvdD5cbiAgPC9kaXY+XG4gIDxkaXYgY2xhc3M9XCJmaWVsZE1lc3NhZ2VcIj5cbiAgICA8c2xvdCBuYW1lPVwiZmllbGQtbWVzc2FnZVwiPjwvc2xvdD5cbiAgPC9kaXY+XG48L2Rpdj5cblxuPHNjcmlwdD5cbiAgZXhwb3J0IGxldCB0aGVtZSA9ICcnO1xuICBleHBvcnQgbGV0IG9wdGlvbmFsID0gZmFsc2U7XG48L3NjcmlwdD5cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHRSxHQUFHLEFBQUMsQ0FBQyxBQUFDLE9BQU8sQ0FBRSxLQUFLLEFBQUUsQ0FBQyJ9 */</style>`;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"inputSourceMap": true
|
||||
}
|
||||
5
packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js
vendored
Normal file
5
packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// https://github.com/babel/babel/issues/9790
|
||||
const comment = `//# sourceMappingURL=${path.basename(sourceMapFilename)}`; // https://github.com/babel/babel/issues/9956
|
||||
|
||||
this.shadowRoot.innerHTML = `<style>div{display:block}
|
||||
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmllbGQuaHRtbCIsInNvdXJjZXMiOlsiZmllbGQuaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8c3ZlbHRlOm9wdGlvbnMgdGFnPVwiZGxzLWZpZWxkXCIgLz5cblxuPHN0eWxlPlxuICBkaXYgeyBkaXNwbGF5OiBibG9jazsgfVxuPC9zdHlsZT5cblxuPGRpdiBjbGFzcz1cImZpZWxkXCI+XG4gIDxkaXYgY2xhc3M9XCJfZmllbGRMYWJlbExheW91dFwiPlxuICAgIDxkaXYgY2xhc3M9XCJmaWVsZExhYmVsXCI+XG4gICAgICA8c2xvdCBuYW1lPVwiZmllbGQtbGFiZWxcIj48L3Nsb3Q+XG4gICAgPC9kaXY+XG4gICAgPGRpdiBjbGFzcz1cImZpZWxkT3B0aW9uYWxcIiBjbGFzczpvcHRpb25hbD5cbiAgICAgIE9wdGlvbmFsXG4gICAgPC9kaXY+XG4gIDwvZGl2PlxuICA8ZGl2IGNsYXNzPVwiZmllbGREZXRhaWxcIj5cbiAgICA8c2xvdCBuYW1lPVwiZmllbGQtZGV0YWlsXCI+PC9zbG90PlxuICA8L2Rpdj5cbiAgPGRpdiBjbGFzcz1cImZpZWxkQ29udHJvbFwiPlxuICAgIDxzbG90IG5hbWU9XCJmaWVsZC1jb250cm9sXCI+PC9zbG90PlxuICAgIDxzbG90Pjwvc2xvdD5cbiAgPC9kaXY+XG4gIDxkaXYgY2xhc3M9XCJmaWVsZE1lc3NhZ2VcIj5cbiAgICA8c2xvdCBuYW1lPVwiZmllbGQtbWVzc2FnZVwiPjwvc2xvdD5cbiAgPC9kaXY+XG48L2Rpdj5cblxuPHNjcmlwdD5cbiAgZXhwb3J0IGxldCB0aGVtZSA9ICcnO1xuICBleHBvcnQgbGV0IG9wdGlvbmFsID0gZmFsc2U7XG48L3NjcmlwdD5cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHRSxHQUFHLEFBQUMsQ0FBQyxBQUFDLE9BQU8sQ0FBRSxLQUFLLEFBQUUsQ0FBQyJ9 */</style>`;
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/generator",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.2",
|
||||
"description": "Turns an AST into code.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -14,14 +14,13 @@
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.5.5",
|
||||
"@babel/types": "^7.6.0",
|
||||
"jsesc": "^2.5.1",
|
||||
"lodash": "^4.17.13",
|
||||
"source-map": "^0.5.0",
|
||||
"trim-right": "^1.0.1"
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-fixtures": "^7.5.5",
|
||||
"@babel/parser": "^7.5.5"
|
||||
"@babel/helper-fixtures": "^7.6.2",
|
||||
"@babel/parser": "^7.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type SourceMap from "./source-map";
|
||||
import trimRight from "trim-right";
|
||||
|
||||
const SPACES_RE = /^[ \t]+$/;
|
||||
|
||||
@@ -43,7 +42,7 @@ export default class Buffer {
|
||||
const result = {
|
||||
// Whatever trim is used here should not execute a regex against the
|
||||
// source string since it may be arbitrarily large after all transformations
|
||||
code: trimRight(this._buf.join("")),
|
||||
code: this._buf.join("").trimRight(),
|
||||
map: null,
|
||||
rawMappings: map && map.getRawMappings(),
|
||||
};
|
||||
|
||||
@@ -264,3 +264,8 @@ export function PrivateName(node: Object) {
|
||||
this.token("#");
|
||||
this.print(node.id, node);
|
||||
}
|
||||
|
||||
export function V8IntrinsicIdentifier(node: Object) {
|
||||
this.token("%");
|
||||
this.word(node.name);
|
||||
}
|
||||
|
||||
@@ -67,12 +67,14 @@ export function TSQualifiedName(node) {
|
||||
|
||||
export function TSCallSignatureDeclaration(node) {
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
this.token(";");
|
||||
}
|
||||
|
||||
export function TSConstructSignatureDeclaration(node) {
|
||||
this.word("new");
|
||||
this.space();
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
this.token(";");
|
||||
}
|
||||
|
||||
export function TSPropertySignature(node) {
|
||||
@@ -127,6 +129,9 @@ export function TSIndexSignature(node) {
|
||||
export function TSAnyKeyword() {
|
||||
this.word("any");
|
||||
}
|
||||
export function TSBigIntKeyword() {
|
||||
this.word("bigint");
|
||||
}
|
||||
export function TSUnknownKeyword() {
|
||||
this.word("unknown");
|
||||
}
|
||||
|
||||
@@ -97,5 +97,18 @@ export function needsParens(node, parent, printStack) {
|
||||
if (isOrHasCallExpression(node)) return true;
|
||||
}
|
||||
|
||||
/* this check is for NullishCoalescing being used with LogicalOperators like && and ||
|
||||
* For example when someone creates an ast programmaticaly like this
|
||||
* t.logicalExpression(
|
||||
* "??",
|
||||
* t.logicalExpression("||", t.identifier("a"), t.identifier("b")),
|
||||
* t.identifier("c"),
|
||||
* );
|
||||
* In the example above the AST is equivalent to writing a || b ?? c
|
||||
* This is incorrect because NullishCoalescing when used with LogicalExpressions should have parenthesis
|
||||
* The correct syntax is (a || b) ?? c, that is why we need parenthesis in this case
|
||||
*/
|
||||
if (t.isLogicalExpression(node) && parent.operator === "??") return true;
|
||||
|
||||
return find(expandedParens, node, parent, printStack);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"parserOpts": {"createParenthesizedExpressions": true}
|
||||
"parserOpts": { "createParenthesizedExpressions": true }
|
||||
}
|
||||
|
||||
1
packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/input.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%DebugPrint(foo);
|
||||
3
packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/options.json
vendored
Normal file
3
packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["v8intrinsic"]
|
||||
}
|
||||
1
packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/output.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/misc/V8IntrinsicIdentifier/output.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
%DebugPrint(foo);
|
||||
@@ -1,4 +1,5 @@
|
||||
foo ||bar;
|
||||
(x => x)|| bar;
|
||||
(function a(x){return x;})|| 2;
|
||||
0||(function(){return alpha;});
|
||||
0||(function(){return alpha;});
|
||||
a ?? (b || c);
|
||||
|
||||
3
packages/babel-generator/test/fixtures/types/LogicalExpression/options.json
vendored
Normal file
3
packages/babel-generator/test/fixtures/types/LogicalExpression/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["nullishCoalescingOperator"]
|
||||
}
|
||||
@@ -7,4 +7,6 @@ foo || bar;
|
||||
|
||||
0 || function () {
|
||||
return alpha;
|
||||
};
|
||||
};
|
||||
|
||||
a ?? (b || c);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
interface I {
|
||||
(x: number): void;
|
||||
(x: string): void;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
interface I {
|
||||
(x: number): void
|
||||
}
|
||||
(x: number): void;
|
||||
(x: string): void;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
interface I {
|
||||
new (x: number): void;
|
||||
new (x: string): void;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
interface I {
|
||||
new (x: number): void
|
||||
}
|
||||
new (x: number): void;
|
||||
new (x: string): void;
|
||||
}
|
||||
|
||||
@@ -298,6 +298,31 @@ describe("generation", function() {
|
||||
});
|
||||
|
||||
describe("programmatic generation", function() {
|
||||
it("should add parenthesis when NullishCoalescing is used along with ||", function() {
|
||||
// https://github.com/babel/babel/issues/10260
|
||||
const nullishCoalesc = t.logicalExpression(
|
||||
"??",
|
||||
t.logicalExpression("||", t.identifier("a"), t.identifier("b")),
|
||||
t.identifier("c"),
|
||||
);
|
||||
const output = generate(nullishCoalesc).code;
|
||||
expect(output).toBe(`(a || b) ?? c`);
|
||||
});
|
||||
|
||||
it("should add parenthesis when NullishCoalesing is used with &&", function() {
|
||||
const nullishCoalesc = t.logicalExpression(
|
||||
"??",
|
||||
t.identifier("a"),
|
||||
t.logicalExpression(
|
||||
"&&",
|
||||
t.identifier("b"),
|
||||
t.logicalExpression("&&", t.identifier("c"), t.identifier("d")),
|
||||
),
|
||||
);
|
||||
const output = generate(nullishCoalesc).code;
|
||||
expect(output).toBe(`a ?? (b && c && d)`);
|
||||
});
|
||||
|
||||
it("numeric member expression", function() {
|
||||
// Should not generate `0.foo`
|
||||
const mem = t.memberExpression(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-create-class-features-plugin",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.0",
|
||||
"author": "The Babel Team (https://babeljs.io/team)",
|
||||
"license": "MIT",
|
||||
"description": "Compile class public and private fields, private methods and decorators to ES6",
|
||||
@@ -25,7 +25,7 @@
|
||||
"@babel/core": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.5",
|
||||
"@babel/core": "^7.6.0",
|
||||
"@babel/helper-plugin-test-runner": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +66,6 @@ export function verifyUsedFeatures(path, file) {
|
||||
if (!hasFeature(file, FEATURES.privateMethods)) {
|
||||
throw path.buildCodeFrameError("Class private methods are not enabled.");
|
||||
}
|
||||
|
||||
if (path.node.static && path.node.kind !== "method") {
|
||||
throw path.buildCodeFrameError(
|
||||
"@babel/plugin-class-features doesn't support class static private accessors yet.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@@ -44,6 +44,7 @@ export function buildPrivateNamesNodes(privateNamesMap, loose, state) {
|
||||
// because static fields are directly assigned to a variable in the
|
||||
// buildPrivateStaticFieldInitSpec function.
|
||||
const { id, static: isStatic, method: isMethod, getId, setId } = value;
|
||||
const isAccessor = getId || setId;
|
||||
if (loose) {
|
||||
initNodes.push(
|
||||
template.statement.ast`
|
||||
@@ -51,7 +52,7 @@ export function buildPrivateNamesNodes(privateNamesMap, loose, state) {
|
||||
`,
|
||||
);
|
||||
} else if (isMethod && !isStatic) {
|
||||
if (getId || setId) {
|
||||
if (isAccessor) {
|
||||
initNodes.push(template.statement.ast`var ${id} = new WeakMap();`);
|
||||
} else {
|
||||
initNodes.push(template.statement.ast`var ${id} = new WeakSet();`);
|
||||
@@ -140,11 +141,13 @@ const privateNameHandlerSpec = {
|
||||
getId,
|
||||
setId,
|
||||
} = privateNamesMap.get(name);
|
||||
const isAccessor = getId || setId;
|
||||
|
||||
if (isStatic) {
|
||||
const helperName = isMethod
|
||||
? "classStaticPrivateMethodGet"
|
||||
: "classStaticPrivateFieldSpecGet";
|
||||
const helperName =
|
||||
isMethod && !isAccessor
|
||||
? "classStaticPrivateMethodGet"
|
||||
: "classStaticPrivateFieldSpecGet";
|
||||
|
||||
return t.callExpression(file.addHelper(helperName), [
|
||||
this.receiver(member),
|
||||
@@ -154,7 +157,7 @@ const privateNameHandlerSpec = {
|
||||
}
|
||||
|
||||
if (isMethod) {
|
||||
if (getId || setId) {
|
||||
if (isAccessor) {
|
||||
return t.callExpression(file.addHelper("classPrivateFieldGet"), [
|
||||
this.receiver(member),
|
||||
t.cloneNode(id),
|
||||
@@ -180,12 +183,15 @@ const privateNameHandlerSpec = {
|
||||
static: isStatic,
|
||||
method: isMethod,
|
||||
setId,
|
||||
getId,
|
||||
} = privateNamesMap.get(name);
|
||||
const isAccessor = getId || setId;
|
||||
|
||||
if (isStatic) {
|
||||
const helperName = isMethod
|
||||
? "classStaticPrivateMethodSet"
|
||||
: "classStaticPrivateFieldSpecSet";
|
||||
const helperName =
|
||||
isMethod && !isAccessor
|
||||
? "classStaticPrivateMethodSet"
|
||||
: "classStaticPrivateFieldSpecSet";
|
||||
|
||||
return t.callExpression(file.addHelper(helperName), [
|
||||
this.receiver(member),
|
||||
@@ -300,9 +306,30 @@ function buildPrivateInstanceFieldInitSpec(ref, prop, privateNamesMap) {
|
||||
}
|
||||
|
||||
function buildPrivateStaticFieldInitSpec(prop, privateNamesMap) {
|
||||
const { id } = privateNamesMap.get(prop.node.key.id.name);
|
||||
const value = prop.node.value || prop.scope.buildUndefinedNode();
|
||||
const privateName = privateNamesMap.get(prop.node.key.id.name);
|
||||
const { id, getId, setId, initAdded } = privateName;
|
||||
const isAccessor = getId || setId;
|
||||
|
||||
if (!prop.isProperty() && (initAdded || !isAccessor)) return;
|
||||
|
||||
if (isAccessor) {
|
||||
privateNamesMap.set(prop.node.key.id.name, {
|
||||
...privateName,
|
||||
initAdded: true,
|
||||
});
|
||||
|
||||
return template.statement.ast`
|
||||
var ${id.name} = {
|
||||
// configurable is false by default
|
||||
// enumerable is false by default
|
||||
// writable is false by default
|
||||
get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},
|
||||
set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
const value = prop.node.value || prop.scope.buildUndefinedNode();
|
||||
return template.statement.ast`
|
||||
var ${id} = {
|
||||
// configurable is false by default
|
||||
@@ -328,76 +355,44 @@ function buildPrivateMethodInitLoose(ref, prop, privateNamesMap) {
|
||||
});
|
||||
`;
|
||||
}
|
||||
|
||||
if (getId || setId) {
|
||||
const isAccessor = getId || setId;
|
||||
if (isAccessor) {
|
||||
privateNamesMap.set(prop.node.key.id.name, {
|
||||
...privateName,
|
||||
initAdded: true,
|
||||
});
|
||||
|
||||
if (getId && setId) {
|
||||
return template.statement.ast`
|
||||
Object.defineProperty(${ref}, ${id}, {
|
||||
// configurable is false by default
|
||||
// enumerable is false by default
|
||||
// writable is false by default
|
||||
get: ${getId.name},
|
||||
set: ${setId.name}
|
||||
});
|
||||
`;
|
||||
} else if (getId && !setId) {
|
||||
return template.statement.ast`
|
||||
Object.defineProperty(${ref}, ${id}, {
|
||||
// configurable is false by default
|
||||
// enumerable is false by default
|
||||
// writable is false by default
|
||||
get: ${getId.name}
|
||||
});
|
||||
`;
|
||||
} else if (!getId && setId) {
|
||||
return template.statement.ast`
|
||||
Object.defineProperty(${ref}, ${id}, {
|
||||
// configurable is false by default
|
||||
// enumerable is false by default
|
||||
// writable is false by default
|
||||
set: ${setId.name}
|
||||
});
|
||||
`;
|
||||
}
|
||||
return template.statement.ast`
|
||||
Object.defineProperty(${ref}, ${id}, {
|
||||
// configurable is false by default
|
||||
// enumerable is false by default
|
||||
// writable is false by default
|
||||
get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},
|
||||
set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}
|
||||
});
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
function buildPrivateInstanceMethodInitSpec(ref, prop, privateNamesMap) {
|
||||
const privateName = privateNamesMap.get(prop.node.key.id.name);
|
||||
const { id, getId, setId, initAdded } = privateName;
|
||||
|
||||
if (initAdded) return;
|
||||
|
||||
if (getId || setId) {
|
||||
const isAccessor = getId || setId;
|
||||
if (isAccessor) {
|
||||
privateNamesMap.set(prop.node.key.id.name, {
|
||||
...privateName,
|
||||
initAdded: true,
|
||||
});
|
||||
|
||||
if (getId && setId) {
|
||||
return template.statement.ast`
|
||||
${id}.set(${ref}, {
|
||||
get: ${getId.name},
|
||||
set: ${setId.name}
|
||||
});
|
||||
`;
|
||||
} else if (getId && !setId) {
|
||||
return template.statement.ast`
|
||||
${id}.set(${ref}, {
|
||||
get: ${getId.name}
|
||||
});
|
||||
`;
|
||||
} else if (!getId && setId) {
|
||||
return template.statement.ast`
|
||||
${id}.set(${ref}, {
|
||||
set: ${setId.name}
|
||||
});
|
||||
`;
|
||||
}
|
||||
return template.statement.ast`
|
||||
${id}.set(${ref}, {
|
||||
get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},
|
||||
set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}
|
||||
});
|
||||
`;
|
||||
}
|
||||
return template.statement.ast`${id}.add(${ref})`;
|
||||
}
|
||||
@@ -429,7 +424,29 @@ function buildPublicFieldInitSpec(ref, prop, state) {
|
||||
}
|
||||
|
||||
function buildPrivateStaticMethodInitLoose(ref, prop, state, privateNamesMap) {
|
||||
const { id, methodId } = privateNamesMap.get(prop.node.key.id.name);
|
||||
const privateName = privateNamesMap.get(prop.node.key.id.name);
|
||||
const { id, methodId, getId, setId, initAdded } = privateName;
|
||||
|
||||
if (initAdded) return;
|
||||
|
||||
const isAccessor = getId || setId;
|
||||
if (isAccessor) {
|
||||
privateNamesMap.set(prop.node.key.id.name, {
|
||||
...privateName,
|
||||
initAdded: true,
|
||||
});
|
||||
|
||||
return template.statement.ast`
|
||||
Object.defineProperty(${ref}, ${id}, {
|
||||
// configurable is false by default
|
||||
// enumerable is false by default
|
||||
// writable is false by default
|
||||
get: ${getId ? getId.name : prop.scope.buildUndefinedNode()},
|
||||
set: ${setId ? setId.name : prop.scope.buildUndefinedNode()}
|
||||
})
|
||||
`;
|
||||
}
|
||||
|
||||
return template.statement.ast`
|
||||
Object.defineProperty(${ref}, ${id}, {
|
||||
// configurable is false by default
|
||||
@@ -615,14 +632,14 @@ export function buildFieldsInitNodes(
|
||||
case isStatic && isPrivate && isMethod && !loose:
|
||||
needsClassRef = true;
|
||||
staticNodes.push(
|
||||
buildPrivateStaticFieldInitSpec(prop, privateNamesMap),
|
||||
);
|
||||
staticNodes.unshift(
|
||||
buildPrivateMethodDeclaration(prop, privateNamesMap, loose),
|
||||
);
|
||||
break;
|
||||
case isStatic && isPrivate && isMethod && loose:
|
||||
needsClassRef = true;
|
||||
staticNodes.push(
|
||||
buildPrivateMethodDeclaration(prop, privateNamesMap, loose),
|
||||
);
|
||||
staticNodes.push(
|
||||
buildPrivateStaticMethodInitLoose(
|
||||
t.cloneNode(ref),
|
||||
@@ -631,6 +648,9 @@ export function buildFieldsInitNodes(
|
||||
privateNamesMap,
|
||||
),
|
||||
);
|
||||
staticNodes.unshift(
|
||||
buildPrivateMethodDeclaration(prop, privateNamesMap, loose),
|
||||
);
|
||||
break;
|
||||
case isInstance && isPublic && isField && loose:
|
||||
instanceNodes.push(buildPublicFieldInitLoose(t.thisExpression(), prop));
|
||||
@@ -646,7 +666,7 @@ export function buildFieldsInitNodes(
|
||||
}
|
||||
|
||||
return {
|
||||
staticNodes,
|
||||
staticNodes: staticNodes.filter(Boolean),
|
||||
instanceNodes: instanceNodes.filter(Boolean),
|
||||
wrapClass(path) {
|
||||
for (const prop of props) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{
|
||||
"plugins": [
|
||||
["proposal-private-methods", { "loose": false }]
|
||||
]
|
||||
"plugins": [["proposal-private-methods", { "loose": false }]]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{
|
||||
"plugins": [
|
||||
["proposal-private-methods", { "loose": true }]
|
||||
]
|
||||
"plugins": [["proposal-private-methods", { "loose": true }]]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-fixtures",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.2",
|
||||
"description": "Helper function to support fixtures",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"license": "MIT",
|
||||
@@ -11,7 +11,6 @@
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.13",
|
||||
"semver": "^5.3.0",
|
||||
"try-resolve": "^1.0.0"
|
||||
"semver": "^5.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import cloneDeep from "lodash/cloneDeep";
|
||||
import trimEnd from "lodash/trimEnd";
|
||||
import resolve from "try-resolve";
|
||||
import clone from "lodash/clone";
|
||||
import extend from "lodash/extend";
|
||||
import semver from "semver";
|
||||
@@ -36,6 +34,13 @@ type Suite = {
|
||||
filename: string,
|
||||
};
|
||||
|
||||
function tryResolve(module) {
|
||||
try {
|
||||
return require.resolve(module);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function assertDirectory(loc) {
|
||||
if (!fs.statSync(loc).isDirectory()) {
|
||||
throw new Error(`Expected ${loc} to be a directory.`);
|
||||
@@ -77,7 +82,7 @@ export default function get(entryLoc): Array<Suite> {
|
||||
const suites = [];
|
||||
|
||||
let rootOpts = {};
|
||||
const rootOptsLoc = resolve(entryLoc + "/options");
|
||||
const rootOptsLoc = tryResolve(entryLoc + "/options");
|
||||
if (rootOptsLoc) rootOpts = require(rootOptsLoc);
|
||||
|
||||
for (const suiteName of fs.readdirSync(entryLoc)) {
|
||||
@@ -93,7 +98,7 @@ export default function get(entryLoc): Array<Suite> {
|
||||
assertDirectory(suite.filename);
|
||||
suites.push(suite);
|
||||
|
||||
const suiteOptsLoc = resolve(suite.filename + "/options");
|
||||
const suiteOptsLoc = tryResolve(suite.filename + "/options");
|
||||
if (suiteOptsLoc) suite.options = require(suiteOptsLoc);
|
||||
|
||||
for (const taskName of fs.readdirSync(suite.filename)) {
|
||||
@@ -120,6 +125,8 @@ export default function get(entryLoc): Array<Suite> {
|
||||
const expectLoc =
|
||||
findFile(taskDir + "/output", true /* allowJSON */) ||
|
||||
taskDir + "/output.js";
|
||||
const stdoutLoc = taskDir + "/stdout.txt";
|
||||
const stderrLoc = taskDir + "/stderr.txt";
|
||||
|
||||
const actualLocAlias =
|
||||
suiteName + "/" + taskName + "/" + path.basename(actualLoc);
|
||||
@@ -138,7 +145,7 @@ export default function get(entryLoc): Array<Suite> {
|
||||
|
||||
const taskOpts = cloneDeep(suite.options);
|
||||
|
||||
const taskOptsLoc = resolve(taskDir + "/options");
|
||||
const taskOptsLoc = tryResolve(taskDir + "/options");
|
||||
if (taskOptsLoc) extend(taskOpts, require(taskOptsLoc));
|
||||
|
||||
const test = {
|
||||
@@ -146,6 +153,10 @@ export default function get(entryLoc): Array<Suite> {
|
||||
title: humanize(taskName, true),
|
||||
disabled: taskName[0] === ".",
|
||||
options: taskOpts,
|
||||
validateLogs: taskOpts.validateLogs,
|
||||
ignoreOutput: taskOpts.ignoreOutput,
|
||||
stdout: { loc: stdoutLoc, code: readFile(stdoutLoc) },
|
||||
stderr: { loc: stderrLoc, code: readFile(stderrLoc) },
|
||||
exec: {
|
||||
loc: execLoc,
|
||||
code: readFile(execLoc),
|
||||
@@ -169,9 +180,7 @@ export default function get(entryLoc): Array<Suite> {
|
||||
|
||||
if (minimumVersion == null) {
|
||||
throw new Error(
|
||||
`'minNodeVersion' has invalid semver format: ${
|
||||
taskOpts.minNodeVersion
|
||||
}`,
|
||||
`'minNodeVersion' has invalid semver format: ${taskOpts.minNodeVersion}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -224,6 +233,30 @@ export default function get(entryLoc): Array<Suite> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!test.validateLogs && (test.stdout.code || test.stderr.code)) {
|
||||
throw new Error(
|
||||
"stdout.txt and stderr.txt are only allowed when the 'validateLogs' option is enabled: " +
|
||||
(test.stdout.code ? stdoutLoc : stderrLoc),
|
||||
);
|
||||
}
|
||||
if (test.options.ignoreOutput) {
|
||||
if (test.expect.code) {
|
||||
throw new Error(
|
||||
"Test cannot ignore its output and also validate it: " + expectLoc,
|
||||
);
|
||||
}
|
||||
if (!test.validateLogs) {
|
||||
throw new Error(
|
||||
"ignoreOutput can only be used when validateLogs is true: " +
|
||||
taskOptsLoc,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete to avoid option validation error
|
||||
delete test.options.validateLogs;
|
||||
delete test.options.ignoreOutput;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +280,7 @@ export function multiple(entryLoc, ignore?: Array<string>) {
|
||||
|
||||
export function readFile(filename) {
|
||||
if (fs.existsSync(filename)) {
|
||||
let file = trimEnd(fs.readFileSync(filename, "utf8"));
|
||||
let file = fs.readFileSync(filename, "utf8").trimRight();
|
||||
file = file.replace(/\r\n/g, "\n");
|
||||
return file;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-transform-fixture-test-runner",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.0",
|
||||
"description": "Transform test runner for @babel/helper-fixtures module",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -12,9 +12,9 @@
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/core": "^7.5.5",
|
||||
"@babel/helper-fixtures": "^7.5.5",
|
||||
"@babel/polyfill": "^7.4.4",
|
||||
"@babel/core": "^7.6.0",
|
||||
"@babel/helper-fixtures": "^7.6.0",
|
||||
"@babel/polyfill": "^7.6.0",
|
||||
"babel-check-duplicated-nodes": "^1.0.0",
|
||||
"jest": "^24.8.0",
|
||||
"jest-diff": "^24.8.0",
|
||||
|
||||
@@ -131,11 +131,17 @@ function wrapPackagesArray(type, names, optionsDir) {
|
||||
}
|
||||
|
||||
function run(task) {
|
||||
const actual = task.actual;
|
||||
const expected = task.expect;
|
||||
const exec = task.exec;
|
||||
const opts = task.options;
|
||||
const optionsDir = task.optionsDir;
|
||||
const {
|
||||
actual,
|
||||
expect: expected,
|
||||
exec,
|
||||
options: opts,
|
||||
optionsDir,
|
||||
validateLogs,
|
||||
ignoreOutput,
|
||||
stdout,
|
||||
stderr,
|
||||
} = task;
|
||||
|
||||
function getOpts(self) {
|
||||
const newOpts = merge(
|
||||
@@ -191,56 +197,67 @@ function run(task) {
|
||||
}
|
||||
}
|
||||
|
||||
let actualCode = actual.code;
|
||||
const expectCode = expected.code;
|
||||
if (!execCode || actualCode) {
|
||||
result = babel.transform(actualCode, getOpts(actual));
|
||||
const expectedCode = result.code.replace(
|
||||
escapeRegExp(path.resolve(__dirname, "../../../")),
|
||||
"<CWD>",
|
||||
);
|
||||
const inputCode = actual.code;
|
||||
const expectedCode = expected.code;
|
||||
if (!execCode || inputCode) {
|
||||
const actualLogs = { stdout: "", stderr: "" };
|
||||
let restoreSpies = null;
|
||||
if (validateLogs) {
|
||||
const spy1 = jest.spyOn(console, "log").mockImplementation(msg => {
|
||||
actualLogs.stdout += `${msg}\n`;
|
||||
});
|
||||
const spy2 = jest.spyOn(console, "warn").mockImplementation(msg => {
|
||||
actualLogs.stderr += `${msg}\n`;
|
||||
});
|
||||
restoreSpies = () => {
|
||||
spy1.mockRestore();
|
||||
spy2.mockRestore();
|
||||
};
|
||||
}
|
||||
|
||||
result = babel.transform(inputCode, getOpts(actual));
|
||||
|
||||
if (restoreSpies) restoreSpies();
|
||||
|
||||
const outputCode = normalizeOutput(result.code);
|
||||
|
||||
checkDuplicatedNodes(babel, result.ast);
|
||||
if (
|
||||
!expected.code &&
|
||||
expectedCode &&
|
||||
!opts.throws &&
|
||||
fs.statSync(path.dirname(expected.loc)).isDirectory() &&
|
||||
!process.env.CI
|
||||
) {
|
||||
const expectedFile = expected.loc.replace(
|
||||
/\.m?js$/,
|
||||
result.sourceType === "module" ? ".mjs" : ".js",
|
||||
);
|
||||
|
||||
console.log(`New test file created: ${expectedFile}`);
|
||||
fs.writeFileSync(expectedFile, `${expectedCode}\n`);
|
||||
|
||||
if (expected.loc !== expectedFile) {
|
||||
try {
|
||||
fs.unlinkSync(expected.loc);
|
||||
} catch (e) {}
|
||||
}
|
||||
} else {
|
||||
actualCode = expectedCode.trim();
|
||||
try {
|
||||
expect(actualCode).toEqualFile({
|
||||
filename: expected.loc,
|
||||
code: expectCode,
|
||||
});
|
||||
} catch (e) {
|
||||
if (!process.env.OVERWRITE) throw e;
|
||||
|
||||
console.log(`Updated test file: ${expected.loc}`);
|
||||
fs.writeFileSync(expected.loc, `${expectedCode}\n`);
|
||||
}
|
||||
|
||||
if (actualCode) {
|
||||
expect(expected.loc).toMatch(
|
||||
result.sourceType === "module" ? /\.mjs$/ : /\.js$/,
|
||||
if (!ignoreOutput) {
|
||||
if (
|
||||
!expected.code &&
|
||||
outputCode &&
|
||||
!opts.throws &&
|
||||
fs.statSync(path.dirname(expected.loc)).isDirectory() &&
|
||||
!process.env.CI
|
||||
) {
|
||||
const expectedFile = expected.loc.replace(
|
||||
/\.m?js$/,
|
||||
result.sourceType === "module" ? ".mjs" : ".js",
|
||||
);
|
||||
|
||||
console.log(`New test file created: ${expectedFile}`);
|
||||
fs.writeFileSync(expectedFile, `${outputCode}\n`);
|
||||
|
||||
if (expected.loc !== expectedFile) {
|
||||
try {
|
||||
fs.unlinkSync(expected.loc);
|
||||
} catch (e) {}
|
||||
}
|
||||
} else {
|
||||
validateFile(outputCode, expected.loc, expectedCode);
|
||||
|
||||
if (inputCode) {
|
||||
expect(expected.loc).toMatch(
|
||||
result.sourceType === "module" ? /\.mjs$/ : /\.js$/,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validateLogs) {
|
||||
validateFile(normalizeOutput(actualLogs.stdout), stdout.loc, stdout.code);
|
||||
validateFile(normalizeOutput(actualLogs.stderr), stderr.loc, stderr.code);
|
||||
}
|
||||
}
|
||||
|
||||
if (task.sourceMap) {
|
||||
@@ -263,6 +280,29 @@ function run(task) {
|
||||
}
|
||||
}
|
||||
|
||||
function validateFile(actualCode, expectedLoc, expectedCode) {
|
||||
try {
|
||||
expect(actualCode).toEqualFile({
|
||||
filename: expectedLoc,
|
||||
code: expectedCode,
|
||||
});
|
||||
} catch (e) {
|
||||
if (!process.env.OVERWRITE) throw e;
|
||||
|
||||
console.log(`Updated test file: ${expectedLoc}`);
|
||||
fs.writeFileSync(expectedLoc, `${actualCode}\n`);
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeOutput(code) {
|
||||
return code
|
||||
.trim()
|
||||
.replace(
|
||||
new RegExp(escapeRegExp(path.resolve(__dirname, "../../../")), "g"),
|
||||
"<CWD>",
|
||||
);
|
||||
}
|
||||
|
||||
const toEqualFile = () => ({
|
||||
compare: (actual, { filename, code }) => {
|
||||
const pass = actual === code;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helpers",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.2",
|
||||
"description": "Collection of helper functions used by Babel transforms.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -11,9 +11,9 @@
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-helpers",
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.4.4",
|
||||
"@babel/traverse": "^7.5.5",
|
||||
"@babel/types": "^7.5.5"
|
||||
"@babel/template": "^7.6.0",
|
||||
"@babel/traverse": "^7.6.2",
|
||||
"@babel/types": "^7.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-plugin-test-runner": "^7.0.0"
|
||||
|
||||
@@ -47,15 +47,6 @@ helpers.jsx = helper("7.0.0-beta.0")`
|
||||
children: void 0,
|
||||
};
|
||||
}
|
||||
if (props && defaultProps) {
|
||||
for (var propName in defaultProps) {
|
||||
if (props[propName] === void 0) {
|
||||
props[propName] = defaultProps[propName];
|
||||
}
|
||||
}
|
||||
} else if (!props) {
|
||||
props = defaultProps || {};
|
||||
}
|
||||
|
||||
if (childrenLength === 1) {
|
||||
props.children = children;
|
||||
@@ -67,6 +58,16 @@ helpers.jsx = helper("7.0.0-beta.0")`
|
||||
props.children = childArray;
|
||||
}
|
||||
|
||||
if (props && defaultProps) {
|
||||
for (var propName in defaultProps) {
|
||||
if (props[propName] === void 0) {
|
||||
props[propName] = defaultProps[propName];
|
||||
}
|
||||
}
|
||||
} else if (!props) {
|
||||
props = defaultProps || {};
|
||||
}
|
||||
|
||||
return {
|
||||
$$typeof: REACT_ELEMENT_TYPE,
|
||||
type: type,
|
||||
@@ -410,7 +411,7 @@ helpers.objectSpread2 = helper("7.5.0")`
|
||||
import defineProperty from "defineProperty";
|
||||
|
||||
// This function is different to "Reflect.ownKeys". The enumerableOnly
|
||||
// filters on symbol properties only. Returned string properties are always
|
||||
// filters on symbol properties only. Returned string properties are always
|
||||
// enumerable. It is good to use in objectSpread.
|
||||
|
||||
function ownKeys(object, enumerableOnly) {
|
||||
@@ -606,28 +607,45 @@ helpers.interopRequireDefault = helper("7.0.0-beta.0")`
|
||||
`;
|
||||
|
||||
helpers.interopRequireWildcard = helper("7.0.0-beta.0")`
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function () { return cache; };
|
||||
return cache;
|
||||
}
|
||||
|
||||
export default function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {};
|
||||
if (obj != null) {
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: {};
|
||||
if (desc.get || desc.set) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
|
||||
var newObj = {};
|
||||
if (obj != null) {
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -817,18 +835,6 @@ helpers.taggedTemplateLiteralLoose = helper("7.0.0-beta.0")`
|
||||
}
|
||||
`;
|
||||
|
||||
helpers.temporalRef = helper("7.0.0-beta.0")`
|
||||
import undef from "temporalUndefined";
|
||||
|
||||
export default function _temporalRef(val, name) {
|
||||
if (val === undef) {
|
||||
throw new ReferenceError(name + " is not defined - temporal dead zone");
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
helpers.readOnlyError = helper("7.0.0-beta.0")`
|
||||
export default function _readOnlyError(name) {
|
||||
throw new Error("\\"" + name + "\\" is read-only");
|
||||
@@ -842,7 +848,24 @@ helpers.classNameTDZError = helper("7.0.0-beta.0")`
|
||||
`;
|
||||
|
||||
helpers.temporalUndefined = helper("7.0.0-beta.0")`
|
||||
export default {};
|
||||
// This function isn't mean to be called, but to be used as a reference.
|
||||
// We can't use a normal object because it isn't hoisted.
|
||||
export default function _temporalUndefined() {}
|
||||
`;
|
||||
|
||||
helpers.tdz = helper("7.5.5")`
|
||||
export default function _tdzError(name) {
|
||||
throw new ReferenceError(name + " is not defined - temporal dead zone");
|
||||
}
|
||||
`;
|
||||
|
||||
helpers.temporalRef = helper("7.0.0-beta.0")`
|
||||
import undef from "temporalUndefined";
|
||||
import err from "tdz";
|
||||
|
||||
export default function _temporalRef(val, name) {
|
||||
return val === undef ? err(name) : val;
|
||||
}
|
||||
`;
|
||||
|
||||
helpers.slicedToArray = helper("7.0.0-beta.0")`
|
||||
@@ -913,14 +936,16 @@ helpers.iterableToArrayLimit = helper("7.0.0-beta.0")`
|
||||
export default function _iterableToArrayLimit(arr, i) {
|
||||
// this is an expanded form of \`for...of\` that properly supports abrupt completions of
|
||||
// iterators etc. variable names have been minimised to reduce the size of this massive
|
||||
// helper. sometimes spec compliancy is annoying :(
|
||||
// helper. sometimes spec compliance is annoying :(
|
||||
//
|
||||
// _n = _iteratorNormalCompletion
|
||||
// _d = _didIteratorError
|
||||
// _e = _iteratorError
|
||||
// _i = _iterator
|
||||
// _s = _step
|
||||
|
||||
if (!(
|
||||
Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]"
|
||||
)) { return }
|
||||
var _arr = [];
|
||||
var _n = true;
|
||||
var _d = false;
|
||||
@@ -946,6 +971,9 @@ helpers.iterableToArrayLimit = helper("7.0.0-beta.0")`
|
||||
|
||||
helpers.iterableToArrayLimitLoose = helper("7.0.0-beta.0")`
|
||||
export default function _iterableToArrayLimitLoose(arr, i) {
|
||||
if (!(
|
||||
Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]"
|
||||
)) { return }
|
||||
var _arr = [];
|
||||
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
||||
_arr.push(_step.value);
|
||||
@@ -1154,6 +1182,9 @@ helpers.classStaticPrivateFieldSpecGet = helper("7.0.2")`
|
||||
if (receiver !== classConstructor) {
|
||||
throw new TypeError("Private static access of wrong provenance");
|
||||
}
|
||||
if (descriptor.get) {
|
||||
return descriptor.get.call(receiver);
|
||||
}
|
||||
return descriptor.value;
|
||||
}
|
||||
`;
|
||||
@@ -1163,13 +1194,18 @@ helpers.classStaticPrivateFieldSpecSet = helper("7.0.2")`
|
||||
if (receiver !== classConstructor) {
|
||||
throw new TypeError("Private static access of wrong provenance");
|
||||
}
|
||||
if (!descriptor.writable) {
|
||||
// This should only throw in strict mode, but class bodies are
|
||||
// always strict and private fields can only be used inside
|
||||
// class bodies.
|
||||
throw new TypeError("attempted to set read only private field");
|
||||
if (descriptor.set) {
|
||||
descriptor.set.call(receiver, value);
|
||||
} else {
|
||||
if (!descriptor.writable) {
|
||||
// This should only throw in strict mode, but class bodies are
|
||||
// always strict and private fields can only be used inside
|
||||
// class bodies.
|
||||
throw new TypeError("attempted to set read only private field");
|
||||
}
|
||||
descriptor.value = value;
|
||||
}
|
||||
descriptor.value = value;
|
||||
|
||||
return value;
|
||||
}
|
||||
`;
|
||||
@@ -1886,16 +1922,17 @@ helpers.wrapRegExp = helper("7.2.6")`
|
||||
|
||||
export default function _wrapRegExp(re, groups) {
|
||||
_wrapRegExp = function(re, groups) {
|
||||
return new BabelRegExp(re, groups);
|
||||
return new BabelRegExp(re, undefined, groups);
|
||||
};
|
||||
|
||||
var _RegExp = wrapNativeSuper(RegExp);
|
||||
var _super = RegExp.prototype;
|
||||
var _groups = new WeakMap();
|
||||
|
||||
function BabelRegExp(re, groups) {
|
||||
var _this = _RegExp.call(this, re);
|
||||
_groups.set(_this, groups);
|
||||
function BabelRegExp(re, flags, groups) {
|
||||
var _this = _RegExp.call(this, re, flags);
|
||||
// if the regex is recreated with 'g' flag
|
||||
_groups.set(_this, groups || _groups.get(re));
|
||||
return _this;
|
||||
}
|
||||
inherits(BabelRegExp, _RegExp);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/node",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.2",
|
||||
"description": "Babel command line",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -19,19 +19,20 @@
|
||||
"compiler"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.0.0",
|
||||
"@babel/register": "^7.5.5",
|
||||
"@babel/register": "^7.6.2",
|
||||
"commander": "^2.8.1",
|
||||
"core-js": "^3.2.1",
|
||||
"lodash": "^4.17.13",
|
||||
"node-environment-flags": "^1.0.5",
|
||||
"regenerator-runtime": "^0.13.3",
|
||||
"v8flags": "^3.1.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.5",
|
||||
"@babel/helper-fixtures": "^7.5.5",
|
||||
"@babel/core": "^7.6.2",
|
||||
"@babel/helper-fixtures": "^7.6.2",
|
||||
"fs-readdir-recursive": "^1.0.0",
|
||||
"output-file-sync": "^2.0.0"
|
||||
},
|
||||
|
||||
@@ -5,7 +5,8 @@ import path from "path";
|
||||
import repl from "repl";
|
||||
import * as babel from "@babel/core";
|
||||
import vm from "vm";
|
||||
import "@babel/polyfill";
|
||||
import "core-js/stable";
|
||||
import "regenerator-runtime/runtime";
|
||||
import register from "@babel/register";
|
||||
|
||||
import pkg from "../package.json";
|
||||
|
||||
@@ -93,9 +93,6 @@ getV8Flags(function(err, v8Flags) {
|
||||
}
|
||||
});
|
||||
});
|
||||
process.on("SIGINT", () => {
|
||||
proc.kill("SIGINT");
|
||||
process.exit(1);
|
||||
});
|
||||
process.on("SIGINT", () => proc.kill("SIGINT"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@ const assertTest = function(stdout, stderr, opts) {
|
||||
const actualFiles = readDir(path.join(tmpLoc));
|
||||
|
||||
Object.keys(actualFiles).forEach(function(filename) {
|
||||
if (!opts.inFiles.hasOwnProperty(filename)) {
|
||||
if (!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)) {
|
||||
const expected = opts.outFiles[filename];
|
||||
const actual = actualFiles[filename];
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
> **Tags:**
|
||||
> - :boom: [Breaking Change]
|
||||
> - :eyeglasses: [Spec Compliancy]
|
||||
> - :eyeglasses: [Spec Compliance]
|
||||
> - :rocket: [New Feature]
|
||||
> - :bug: [Bug Fix]
|
||||
> - :memo: [Documentation]
|
||||
@@ -56,7 +56,7 @@ See the [Babel Changelog](https://github.com/babel/babel/blob/master/CHANGELOG.m
|
||||
|
||||
## 7.0.0-beta.7 (2017-03-22)
|
||||
|
||||
### Spec Compliancy
|
||||
### Spec Compliance
|
||||
* Remove babylon plugin for template revision since it's stage-4 (#426) (Henry Zhu)
|
||||
|
||||
### Bug Fix
|
||||
@@ -200,7 +200,7 @@ declare module "C" {
|
||||
}
|
||||
```
|
||||
|
||||
### :eyeglasses: Spec Compliancy
|
||||
### :eyeglasses: Spec Compliance
|
||||
|
||||
Forbid semicolons after decorators in classes ([#352](https://github.com/babel/babylon/pull/352)) (Kevin Gibbons)
|
||||
|
||||
@@ -305,7 +305,7 @@ AST spec: fix casing of `RegExpLiteral` ([#318](https://github.com/babel/babylon
|
||||
|
||||
## 6.15.0 (2017-01-10)
|
||||
|
||||
### :eyeglasses: Spec Compliancy
|
||||
### :eyeglasses: Spec Compliance
|
||||
|
||||
Add support for Flow shorthand import type ([#267](https://github.com/babel/babylon/pull/267)) (Jeff Morrison)
|
||||
|
||||
@@ -411,7 +411,7 @@ Will include all parser plugins instead of specifying each one individually. Use
|
||||
|
||||
## 6.14.0 (2016-11-16)
|
||||
|
||||
### :eyeglasses: Spec Compliancy
|
||||
### :eyeglasses: Spec Compliance
|
||||
|
||||
Throw error for reserved words `enum` and `await` ([#195](https://github.com/babel/babylon/pull/195)) (Kai Cataldo)
|
||||
|
||||
@@ -491,7 +491,7 @@ With that test case, there was a ~95ms savings by removing the need for node to
|
||||
|
||||
## v6.13.0 (2016-10-21)
|
||||
|
||||
### :eyeglasses: Spec Compliancy
|
||||
### :eyeglasses: Spec Compliance
|
||||
|
||||
Property variance type annotations for Flow plugin ([#161](https://github.com/babel/babylon/pull/161)) (Sam Goldman)
|
||||
|
||||
@@ -549,7 +549,7 @@ Fixes two tests that are failing after the merge of #172 ([#177](https://github.
|
||||
|
||||
## v6.12.0 (2016-10-14)
|
||||
|
||||
### :eyeglasses: Spec Compliancy
|
||||
### :eyeglasses: Spec Compliance
|
||||
|
||||
Implement import() syntax ([#163](https://github.com/babel/babylon/pull/163)) (Jordan Gensler)
|
||||
|
||||
@@ -643,7 +643,7 @@ export const { foo: [ ,, qux7 ] } = bar;
|
||||
|
||||
## v6.11.5 (2016-10-12)
|
||||
|
||||
### :eyeglasses: Spec Compliancy
|
||||
### :eyeglasses: Spec Compliance
|
||||
|
||||
Fix: Check for duplicate named exports in exported destructuring assignments ([#144](https://github.com/babel/babylon/pull/144)) (Kai Cataldo)
|
||||
|
||||
@@ -689,7 +689,7 @@ Temporary rollback for erroring on trailing comma with spread (#154) (Henry Zhu)
|
||||
|
||||
## v6.11.3 (2016-10-01)
|
||||
|
||||
### :eyeglasses: Spec Compliancy
|
||||
### :eyeglasses: Spec Compliance
|
||||
|
||||
Add static errors for object rest (#149) ([@danez](https://github.com/danez))
|
||||
|
||||
@@ -782,7 +782,7 @@ export toString from './toString';
|
||||
|
||||
## 6.11.0 (2016-09-22)
|
||||
|
||||
### Spec Compliancy (will break CI)
|
||||
### Spec Compliance (will break CI)
|
||||
|
||||
- Disallow duplicate named exports ([#107](https://github.com/babel/babylon/pull/107)) @kaicataldo
|
||||
|
||||
@@ -862,9 +862,9 @@ for (+i in {});
|
||||
|
||||
## 6.10.0 (2016-09-19)
|
||||
|
||||
> We plan to include some spec compliancy bugs in patch versions. An example was the multiple default exports issue.
|
||||
> We plan to include some spec compliance bugs in patch versions. An example was the multiple default exports issue.
|
||||
|
||||
### Spec Compliancy
|
||||
### Spec Compliance
|
||||
|
||||
* Implement ES2016 check for simple parameter list in strict mode ([#106](https://github.com/babel/babylon/pull/106)) (Timothy Gu)
|
||||
|
||||
@@ -1023,7 +1023,7 @@ declare module "foo" {
|
||||
- The existential type `*` is not a valid type parameter.
|
||||
- The existential type `*` is a primary type
|
||||
|
||||
### Spec Compliancy
|
||||
### Spec Compliance
|
||||
- The param list for type parameter declarations now consists of `TypeParameter` nodes
|
||||
- New `TypeParameter` AST Node (replaces using the `Identifier` node before)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/parser",
|
||||
"version": "7.5.5",
|
||||
"version": "7.6.2",
|
||||
"description": "A JavaScript parser",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -29,7 +29,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/helper-fixtures": "^7.5.5",
|
||||
"@babel/helper-fixtures": "^7.6.2",
|
||||
"charcodes": "^0.2.0",
|
||||
"unicode-12.0.0": "^0.7.9"
|
||||
},
|
||||
|
||||
@@ -38,6 +38,65 @@ export default class CommentsParser extends BaseParser {
|
||||
this.state.leadingComments.push(comment);
|
||||
}
|
||||
|
||||
adjustCommentsAfterTrailingComma(
|
||||
node: Node,
|
||||
elements: Node[],
|
||||
// When the current node is followed by a token which hasn't a respective AST node, we
|
||||
// need to take all the trailing comments to prevent them from being attached to an
|
||||
// unrelated node. e.g. in
|
||||
// var { x } /* cmt */ = { y }
|
||||
// we don't want /* cmt */ to be attached to { y }.
|
||||
// On the other hand, in
|
||||
// fn(x) [new line] /* cmt */ [new line] y
|
||||
// /* cmt */ is both a trailing comment of fn(x) and a leading comment of y
|
||||
takeAllComments?: boolean,
|
||||
) {
|
||||
if (this.state.leadingComments.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (elements.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const lastElement = last(elements);
|
||||
|
||||
for (let j = 0; j < this.state.leadingComments.length; j++) {
|
||||
if (
|
||||
this.state.leadingComments[j].end < this.state.commentPreviousNode.end
|
||||
) {
|
||||
this.state.leadingComments.splice(j, 1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
const newTrailingComments = [];
|
||||
for (let i = 0; i < this.state.leadingComments.length; i++) {
|
||||
const leadingComment = this.state.leadingComments[i];
|
||||
if (leadingComment.end < node.end) {
|
||||
newTrailingComments.push(leadingComment);
|
||||
|
||||
// Perf: we don't need to splice if we are going to reset the array anyway
|
||||
if (!takeAllComments) {
|
||||
this.state.leadingComments.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
if (node.trailingComments === undefined) {
|
||||
node.trailingComments = [];
|
||||
}
|
||||
node.trailingComments.push(leadingComment);
|
||||
}
|
||||
}
|
||||
if (takeAllComments) this.state.leadingComments = [];
|
||||
|
||||
if (newTrailingComments.length > 0) {
|
||||
lastElement.trailingComments = newTrailingComments;
|
||||
} else if (lastElement.trailingComments !== undefined) {
|
||||
lastElement.trailingComments = [];
|
||||
}
|
||||
}
|
||||
|
||||
processComment(node: Node): void {
|
||||
if (node.type === "Program" && node.body.length > 0) return;
|
||||
|
||||
@@ -84,60 +143,39 @@ export default class CommentsParser extends BaseParser {
|
||||
|
||||
if (!lastChild && firstChild) lastChild = firstChild;
|
||||
|
||||
// Attach comments that follow a trailing comma on the last
|
||||
// property in an object literal or a trailing comma in function arguments
|
||||
// as trailing comments
|
||||
if (firstChild && this.state.leadingComments.length > 0) {
|
||||
const lastComment = last(this.state.leadingComments);
|
||||
|
||||
if (firstChild.type === "ObjectProperty") {
|
||||
if (lastComment.start >= node.start) {
|
||||
if (this.state.commentPreviousNode) {
|
||||
for (j = 0; j < this.state.leadingComments.length; j++) {
|
||||
if (
|
||||
this.state.leadingComments[j].end <
|
||||
this.state.commentPreviousNode.end
|
||||
) {
|
||||
this.state.leadingComments.splice(j, 1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.leadingComments.length > 0) {
|
||||
firstChild.trailingComments = this.state.leadingComments;
|
||||
this.state.leadingComments = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
node.type === "CallExpression" &&
|
||||
node.arguments &&
|
||||
node.arguments.length
|
||||
) {
|
||||
const lastArg = last(node.arguments);
|
||||
|
||||
if (
|
||||
lastArg &&
|
||||
lastComment.start >= lastArg.start &&
|
||||
lastComment.end <= node.end
|
||||
) {
|
||||
if (this.state.commentPreviousNode) {
|
||||
for (j = 0; j < this.state.leadingComments.length; j++) {
|
||||
if (
|
||||
this.state.leadingComments[j].end <
|
||||
this.state.commentPreviousNode.end
|
||||
) {
|
||||
this.state.leadingComments.splice(j, 1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
if (this.state.leadingComments.length > 0) {
|
||||
lastArg.trailingComments = this.state.leadingComments;
|
||||
this.state.leadingComments = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Adjust comments that follow a trailing comma on the last element in a
|
||||
// comma separated list of nodes to be the trailing comments on the last
|
||||
// element
|
||||
if (firstChild) {
|
||||
switch (node.type) {
|
||||
case "ObjectExpression":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.properties);
|
||||
break;
|
||||
case "ObjectPattern":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.properties, true);
|
||||
break;
|
||||
case "CallExpression":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.arguments);
|
||||
break;
|
||||
case "ArrayExpression":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.elements);
|
||||
break;
|
||||
case "ArrayPattern":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.elements, true);
|
||||
break;
|
||||
}
|
||||
} else if (
|
||||
this.state.commentPreviousNode &&
|
||||
((this.state.commentPreviousNode.type === "ImportSpecifier" &&
|
||||
node.type !== "ImportSpecifier") ||
|
||||
(this.state.commentPreviousNode.type === "ExportSpecifier" &&
|
||||
node.type !== "ExportSpecifier"))
|
||||
) {
|
||||
this.adjustCommentsAfterTrailingComma(
|
||||
node,
|
||||
[this.state.commentPreviousNode],
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
if (lastChild) {
|
||||
|
||||
@@ -380,6 +380,39 @@ export default class ExpressionParser extends LValParser {
|
||||
|
||||
node.right = this.parseExprOpRightExpr(op, prec, noIn);
|
||||
|
||||
/* this check is for all ?? operators
|
||||
* a ?? b && c for this example
|
||||
* b && c => This is considered as a logical expression in the ast tree
|
||||
* a => Identifier
|
||||
* so for ?? operator we need to check in this case the right expression to have parenthesis
|
||||
* second case a && b ?? c
|
||||
* here a && b => This is considered as a logical expression in the ast tree
|
||||
* c => identifer
|
||||
* so now here for ?? operator we need to check the left expression to have parenthesis
|
||||
* if the parenthesis is missing we raise an error and throw it
|
||||
*/
|
||||
if (op === tt.nullishCoalescing) {
|
||||
if (
|
||||
left.type === "LogicalExpression" &&
|
||||
left.operator !== "??" &&
|
||||
!(left.extra && left.extra.parenthesized)
|
||||
) {
|
||||
throw this.raise(
|
||||
left.start,
|
||||
`Nullish coalescing operator(??) requires parens when mixing with logical operators`,
|
||||
);
|
||||
} else if (
|
||||
node.right.type === "LogicalExpression" &&
|
||||
node.right.operator !== "??" &&
|
||||
!(node.right.extra && node.right.extra.parenthesized)
|
||||
) {
|
||||
throw this.raise(
|
||||
node.right.start,
|
||||
`Nullish coalescing operator(??) requires parens when mixing with logical operators`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.finishNode(
|
||||
node,
|
||||
op === tt.logicalOR ||
|
||||
@@ -622,6 +655,12 @@ export default class ExpressionParser extends LValParser {
|
||||
node.object = base;
|
||||
node.property = this.parseMaybePrivateName();
|
||||
node.computed = false;
|
||||
if (
|
||||
node.property.type === "PrivateName" &&
|
||||
node.object.type === "Super"
|
||||
) {
|
||||
this.raise(startPos, "Private fields can't be accessed on super");
|
||||
}
|
||||
if (state.optionalChainMember) {
|
||||
node.optional = false;
|
||||
return this.finishNode(node, "OptionalMemberExpression");
|
||||
@@ -1137,9 +1176,7 @@ export default class ExpressionParser extends LValParser {
|
||||
if (node.property.name !== propertyName || containsEsc) {
|
||||
this.raise(
|
||||
node.property.start,
|
||||
`The only valid meta property for ${meta.name} is ${
|
||||
meta.name
|
||||
}.${propertyName}`,
|
||||
`The only valid meta property for ${meta.name} is ${meta.name}.${propertyName}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2035,6 +2072,11 @@ export default class ExpressionParser extends LValParser {
|
||||
|
||||
if (this.match(tt.name)) {
|
||||
name = this.state.value;
|
||||
|
||||
// An escaped identifier whose value is the same as a keyword
|
||||
if (!liberal && this.state.containsEsc && isKeyword(name)) {
|
||||
this.raise(this.state.pos, `Escape sequence in keyword ${name}`);
|
||||
}
|
||||
} else if (this.state.type.keyword) {
|
||||
name = this.state.type.keyword;
|
||||
|
||||
@@ -2160,7 +2202,7 @@ export default class ExpressionParser extends LValParser {
|
||||
if (
|
||||
this.match(tt.semi) ||
|
||||
(!this.match(tt.star) && !this.state.type.startsExpr) ||
|
||||
this.canInsertSemicolon()
|
||||
this.hasPrecedingLineBreak()
|
||||
) {
|
||||
node.delegate = false;
|
||||
node.argument = null;
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
SCOPE_OTHER,
|
||||
SCOPE_SIMPLE_CATCH,
|
||||
SCOPE_SUPER,
|
||||
type BindingTypes,
|
||||
} from "../util/scopeflags";
|
||||
|
||||
const loopLabel = { kind: "loop" },
|
||||
@@ -1497,13 +1498,18 @@ export default class StatementParser extends ExpressionParser {
|
||||
}
|
||||
|
||||
pushClassProperty(classBody: N.ClassBody, prop: N.ClassProperty) {
|
||||
// This only affects properties, not methods.
|
||||
if (this.isNonstaticConstructor(prop)) {
|
||||
if (
|
||||
!prop.computed &&
|
||||
(prop.key.name === "constructor" || prop.key.value === "constructor")
|
||||
) {
|
||||
// Non-computed field, which is either an identifier named "constructor"
|
||||
// or a string literal named "constructor"
|
||||
this.raise(
|
||||
prop.key.start,
|
||||
"Classes may not have a non-static field named 'constructor'",
|
||||
"Classes may not have a field named 'constructor'",
|
||||
);
|
||||
}
|
||||
|
||||
classBody.body.push(this.parseClassProperty(prop));
|
||||
}
|
||||
|
||||
@@ -1611,11 +1617,12 @@ export default class StatementParser extends ExpressionParser {
|
||||
node: N.Class,
|
||||
isStatement: boolean,
|
||||
optionalId: ?boolean,
|
||||
bindingType: BindingTypes = BIND_CLASS,
|
||||
): void {
|
||||
if (this.match(tt.name)) {
|
||||
node.id = this.parseIdentifier();
|
||||
if (isStatement) {
|
||||
this.checkLVal(node.id, BIND_CLASS, undefined, "class name");
|
||||
this.checkLVal(node.id, bindingType, undefined, "class name");
|
||||
}
|
||||
} else {
|
||||
if (optionalId || !isStatement) {
|
||||
|
||||
@@ -69,6 +69,10 @@ export function validatePlugins(plugins: PluginList) {
|
||||
throw new Error("Cannot combine flow and typescript plugins.");
|
||||
}
|
||||
|
||||
if (hasPlugin(plugins, "placeholders") && hasPlugin(plugins, "v8intrinsic")) {
|
||||
throw new Error("Cannot combine placeholders and v8intrinsic plugins.");
|
||||
}
|
||||
|
||||
if (
|
||||
hasPlugin(plugins, "pipelineOperator") &&
|
||||
!PIPELINE_PROPOSALS.includes(
|
||||
@@ -89,6 +93,7 @@ import flow from "./plugins/flow";
|
||||
import jsx from "./plugins/jsx";
|
||||
import typescript from "./plugins/typescript";
|
||||
import placeholders from "./plugins/placeholders";
|
||||
import v8intrinsic from "./plugins/v8intrinsic";
|
||||
|
||||
// NOTE: order is important. estree must come first; placeholders must come last.
|
||||
export const mixinPlugins: { [name: string]: MixinPlugin } = {
|
||||
@@ -96,6 +101,7 @@ export const mixinPlugins: { [name: string]: MixinPlugin } = {
|
||||
jsx,
|
||||
flow,
|
||||
typescript,
|
||||
v8intrinsic,
|
||||
placeholders,
|
||||
};
|
||||
|
||||
|
||||
@@ -250,10 +250,16 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
// Parses element name in any form - namespaced, member
|
||||
// or single identifier.
|
||||
|
||||
jsxParseElementName(): N.JSXNamespacedName | N.JSXMemberExpression {
|
||||
jsxParseElementName():
|
||||
| N.JSXIdentifier
|
||||
| N.JSXNamespacedName
|
||||
| N.JSXMemberExpression {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
let node = this.jsxParseNamespacedName();
|
||||
if (node.type === "JSXNamespacedName") {
|
||||
return node;
|
||||
}
|
||||
while (this.eat(tt.dot)) {
|
||||
const newNode = this.startNodeAt(startPos, startLoc);
|
||||
newNode.object = node;
|
||||
|
||||
@@ -14,8 +14,9 @@ import {
|
||||
BIND_TS_CONST_ENUM,
|
||||
BIND_TS_TYPE,
|
||||
BIND_TS_INTERFACE,
|
||||
BIND_TS_FN_TYPE,
|
||||
BIND_TS_AMBIENT,
|
||||
BIND_TS_NAMESPACE,
|
||||
BIND_CLASS,
|
||||
} from "../../util/scopeflags";
|
||||
import TypeScriptScopeHandler from "./scope";
|
||||
|
||||
@@ -369,9 +370,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
) {
|
||||
throw this.unexpected(
|
||||
pattern.start,
|
||||
`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${
|
||||
pattern.type
|
||||
}`,
|
||||
"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern," +
|
||||
`instead got ${pattern.type}`,
|
||||
);
|
||||
}
|
||||
return pattern;
|
||||
@@ -1279,6 +1279,9 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
/* declarationPosition */ true,
|
||||
);
|
||||
case tt._class:
|
||||
// While this is also set by tsParseExpressionStatement, we need to set it
|
||||
// before parsing the class declaration to now how to register it in the scope.
|
||||
nany.declare = true;
|
||||
return this.parseClass(
|
||||
nany,
|
||||
/* isStatement */ true,
|
||||
@@ -1553,7 +1556,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
|
||||
checkFunctionStatementId(node: N.Function): void {
|
||||
if (!node.body && node.id) {
|
||||
this.checkLVal(node.id, BIND_TS_FN_TYPE, null, "function name");
|
||||
this.checkLVal(node.id, BIND_TS_AMBIENT, null, "function name");
|
||||
} else {
|
||||
super.checkFunctionStatementId(...arguments);
|
||||
}
|
||||
@@ -1989,7 +1992,12 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
return;
|
||||
}
|
||||
|
||||
super.parseClassId(...arguments);
|
||||
super.parseClassId(
|
||||
node,
|
||||
isStatement,
|
||||
optionalId,
|
||||
(node: any).declare ? BIND_TS_AMBIENT : BIND_CLASS,
|
||||
);
|
||||
const typeParameters = this.tsTryParseTypeParameters();
|
||||
if (typeParameters) node.typeParameters = typeParameters;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class TypeScriptScope extends Scope {
|
||||
// classes (which are also in .lexical) and interface (which are also in .types)
|
||||
classes: string[] = [];
|
||||
|
||||
// namespaces and bodyless-functions are too difficult to track,
|
||||
// namespaces and ambient functions (or classes) are too difficult to track,
|
||||
// especially without type analysis.
|
||||
// We need to track them anyway, to avoid "X is not defined" errors
|
||||
// when exporting them.
|
||||
|
||||
32
packages/babel-parser/src/plugins/v8intrinsic.js
Normal file
32
packages/babel-parser/src/plugins/v8intrinsic.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import type Parser from "../parser";
|
||||
import { types as tt } from "../tokenizer/types";
|
||||
import * as N from "../types";
|
||||
|
||||
export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
class extends superClass {
|
||||
parseV8Intrinsic(): N.Expression {
|
||||
if (this.match(tt.modulo)) {
|
||||
const v8IntrinsicStart = this.state.start;
|
||||
// let the `loc` of Identifier starts from `%`
|
||||
const node = this.startNode();
|
||||
this.eat(tt.modulo);
|
||||
if (this.match(tt.name)) {
|
||||
const name = this.parseIdentifierName(this.state.start);
|
||||
const identifier = this.createIdentifier(node, name);
|
||||
identifier.type = "V8IntrinsicIdentifier";
|
||||
if (this.match(tt.parenL)) {
|
||||
return identifier;
|
||||
}
|
||||
}
|
||||
this.unexpected(v8IntrinsicStart);
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================ *
|
||||
* parser/expression.js *
|
||||
* ============================================================ */
|
||||
|
||||
parseExprAtom(): N.Expression {
|
||||
return this.parseV8Intrinsic() || super.parseExprAtom(...arguments);
|
||||
}
|
||||
};
|
||||
@@ -234,8 +234,8 @@ export default class Tokenizer extends LocationParser {
|
||||
skipBlockComment(): void {
|
||||
const startLoc = this.state.curPosition();
|
||||
const start = this.state.pos;
|
||||
const end = this.input.indexOf("*/", (this.state.pos += 2));
|
||||
if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment");
|
||||
const end = this.input.indexOf("*/", this.state.pos + 2);
|
||||
if (end === -1) this.raise(start, "Unterminated comment");
|
||||
|
||||
this.state.pos = end + 2;
|
||||
lineBreakG.lastIndex = start;
|
||||
@@ -404,8 +404,10 @@ export default class Tokenizer extends LocationParser {
|
||||
return;
|
||||
}
|
||||
|
||||
const next2 = this.input.charCodeAt(this.state.pos + 2);
|
||||
if (next === charCodes.dot && next2 === charCodes.dot) {
|
||||
if (
|
||||
next === charCodes.dot &&
|
||||
this.input.charCodeAt(this.state.pos + 2) === charCodes.dot
|
||||
) {
|
||||
this.state.pos += 3;
|
||||
this.finishToken(tt.ellipsis);
|
||||
} else {
|
||||
@@ -878,7 +880,11 @@ export default class Tokenizer extends LocationParser {
|
||||
// were read, the integer value otherwise. When `len` is given, this
|
||||
// will return `null` unless the integer has exactly `len` digits.
|
||||
|
||||
readInt(radix: number, len?: number): number | null {
|
||||
readInt(
|
||||
radix: number,
|
||||
len?: number,
|
||||
allowNumSeparator: boolean = true,
|
||||
): number | null {
|
||||
const start = this.state.pos;
|
||||
const forbiddenSiblings =
|
||||
radix === 16
|
||||
@@ -900,9 +906,9 @@ export default class Tokenizer extends LocationParser {
|
||||
let val;
|
||||
|
||||
if (this.hasPlugin("numericSeparator")) {
|
||||
const prev = this.input.charCodeAt(this.state.pos - 1);
|
||||
const next = this.input.charCodeAt(this.state.pos + 1);
|
||||
if (code === charCodes.underscore) {
|
||||
const prev = this.input.charCodeAt(this.state.pos - 1);
|
||||
const next = this.input.charCodeAt(this.state.pos + 1);
|
||||
if (allowedSiblings.indexOf(next) === -1) {
|
||||
this.raise(this.state.pos, "Invalid or unexpected token");
|
||||
}
|
||||
@@ -915,6 +921,13 @@ export default class Tokenizer extends LocationParser {
|
||||
this.raise(this.state.pos, "Invalid or unexpected token");
|
||||
}
|
||||
|
||||
if (!allowNumSeparator) {
|
||||
this.raise(
|
||||
this.state.pos,
|
||||
"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences",
|
||||
);
|
||||
}
|
||||
|
||||
// Ignore this _ character
|
||||
++this.state.pos;
|
||||
continue;
|
||||
@@ -980,6 +993,7 @@ export default class Tokenizer extends LocationParser {
|
||||
const start = this.state.pos;
|
||||
let isFloat = false;
|
||||
let isBigInt = false;
|
||||
let isNonOctalDecimalInt = false;
|
||||
|
||||
if (!startsWithDot && this.readInt(10) === null) {
|
||||
this.raise(start, "Invalid number");
|
||||
@@ -996,6 +1010,7 @@ export default class Tokenizer extends LocationParser {
|
||||
}
|
||||
if (/[89]/.test(this.input.slice(start, this.state.pos))) {
|
||||
octal = false;
|
||||
isNonOctalDecimalInt = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1020,10 +1035,26 @@ export default class Tokenizer extends LocationParser {
|
||||
next = this.input.charCodeAt(this.state.pos);
|
||||
}
|
||||
|
||||
// disallow numeric separators in non octal decimals
|
||||
if (this.hasPlugin("numericSeparator") && isNonOctalDecimalInt) {
|
||||
const underscorePos = this.input
|
||||
.slice(start, this.state.pos)
|
||||
.indexOf("_");
|
||||
if (underscorePos > 0) {
|
||||
this.raise(
|
||||
underscorePos + start,
|
||||
"Numeric separator can not be used after leading 0",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasPlugin("bigInt")) {
|
||||
if (next === charCodes.lowercaseN) {
|
||||
// disallow floats and legacy octal syntax, new style octal ("0o") is handled in this.readRadixNumber
|
||||
if (isFloat || octal) this.raise(start, "Invalid BigIntLiteral");
|
||||
// disallow floats, legacy octal syntax and non octal decimals
|
||||
// new style octal ("0o") is handled in this.readRadixNumber
|
||||
if (isFloat || octal || isNonOctalDecimalInt) {
|
||||
this.raise(start, "Invalid BigIntLiteral");
|
||||
}
|
||||
++this.state.pos;
|
||||
isBigInt = true;
|
||||
}
|
||||
@@ -1250,7 +1281,7 @@ export default class Tokenizer extends LocationParser {
|
||||
|
||||
readHexChar(len: number, throwOnInvalid: boolean): number | null {
|
||||
const codePos = this.state.pos;
|
||||
const n = this.readInt(16, len);
|
||||
const n = this.readInt(16, len, false);
|
||||
if (n === null) {
|
||||
if (throwOnInvalid) {
|
||||
this.raise(codePos, "Bad character escape sequence");
|
||||
@@ -1324,11 +1355,7 @@ export default class Tokenizer extends LocationParser {
|
||||
|
||||
readWord(): void {
|
||||
const word = this.readWord1();
|
||||
const type = keywordTypes.get(word) || tt.name;
|
||||
|
||||
if (type.keyword && this.state.containsEsc) {
|
||||
this.raise(this.state.pos, `Escape sequence in keyword ${word}`);
|
||||
}
|
||||
const type = (!this.state.containsEsc && keywordTypes.get(word)) || tt.name;
|
||||
|
||||
// Allow @@iterator and @@asyncIterator as a identifier only inside type
|
||||
if (
|
||||
|
||||
@@ -139,21 +139,22 @@ export const types: { [name: string]: TokenType } = {
|
||||
tilde: new TokenType("~", { beforeExpr, prefix, startsExpr }),
|
||||
pipeline: createBinop("|>", 0),
|
||||
nullishCoalescing: createBinop("??", 1),
|
||||
logicalOR: createBinop("||", 1),
|
||||
logicalAND: createBinop("&&", 2),
|
||||
bitwiseOR: createBinop("|", 3),
|
||||
bitwiseXOR: createBinop("^", 4),
|
||||
bitwiseAND: createBinop("&", 5),
|
||||
equality: createBinop("==/!=/===/!==", 6),
|
||||
relational: createBinop("</>/<=/>=", 7),
|
||||
bitShift: createBinop("<</>>/>>>", 8),
|
||||
plusMin: new TokenType("+/-", { beforeExpr, binop: 9, prefix, startsExpr }),
|
||||
modulo: createBinop("%", 10),
|
||||
star: createBinop("*", 10),
|
||||
slash: createBinop("/", 10),
|
||||
logicalOR: createBinop("||", 2),
|
||||
logicalAND: createBinop("&&", 3),
|
||||
bitwiseOR: createBinop("|", 4),
|
||||
bitwiseXOR: createBinop("^", 5),
|
||||
bitwiseAND: createBinop("&", 6),
|
||||
equality: createBinop("==/!=/===/!==", 7),
|
||||
relational: createBinop("</>/<=/>=", 8),
|
||||
bitShift: createBinop("<</>>/>>>", 9),
|
||||
plusMin: new TokenType("+/-", { beforeExpr, binop: 10, prefix, startsExpr }),
|
||||
// startsExpr: required by v8intrinsic plugin
|
||||
modulo: new TokenType("%", { beforeExpr, binop: 11, startsExpr }),
|
||||
star: createBinop("*", 11),
|
||||
slash: createBinop("/", 11),
|
||||
exponent: new TokenType("**", {
|
||||
beforeExpr,
|
||||
binop: 11,
|
||||
binop: 12,
|
||||
rightAssociative: true,
|
||||
}),
|
||||
|
||||
@@ -188,8 +189,8 @@ export const types: { [name: string]: TokenType } = {
|
||||
_null: createKeyword("null", { startsExpr }),
|
||||
_true: createKeyword("true", { startsExpr }),
|
||||
_false: createKeyword("false", { startsExpr }),
|
||||
_in: createKeyword("in", { beforeExpr, binop: 7 }),
|
||||
_instanceof: createKeyword("instanceof", { beforeExpr, binop: 7 }),
|
||||
_in: createKeyword("in", { beforeExpr, binop: 8 }),
|
||||
_instanceof: createKeyword("instanceof", { beforeExpr, binop: 8 }),
|
||||
_typeof: createKeyword("typeof", { beforeExpr, prefix, startsExpr }),
|
||||
_void: createKeyword("void", { beforeExpr, prefix, startsExpr }),
|
||||
_delete: createKeyword("delete", { beforeExpr, prefix, startsExpr }),
|
||||
|
||||
@@ -62,14 +62,14 @@ export const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_
|
||||
BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS ,
|
||||
BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0 ,
|
||||
BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM,
|
||||
BIND_TS_FN_TYPE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
|
||||
BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
|
||||
// These bindings don't introduce anything in the scope. They are used for assignments and
|
||||
// function expressions IDs.
|
||||
BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE ,
|
||||
BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE ,
|
||||
|
||||
BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM,
|
||||
BIND_TS_NAMESPACE = BIND_TS_FN_TYPE;
|
||||
BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY;
|
||||
|
||||
export type BindingTypes =
|
||||
| typeof BIND_NONE
|
||||
@@ -81,5 +81,5 @@ export type BindingTypes =
|
||||
| typeof BIND_TS_INTERFACE
|
||||
| typeof BIND_TS_TYPE
|
||||
| typeof BIND_TS_ENUM
|
||||
| typeof BIND_TS_FN_TYPE
|
||||
| typeof BIND_TS_AMBIENT
|
||||
| typeof BIND_TS_NAMESPACE;
|
||||
|
||||
18
packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js
vendored
Normal file
18
packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
const nonTrailing = [
|
||||
"One", // One
|
||||
// Two
|
||||
"Two" // Three
|
||||
// Four
|
||||
]
|
||||
|
||||
const trailingAfterComma = [
|
||||
"One", // One
|
||||
// Two
|
||||
"Two", // Three
|
||||
// Four
|
||||
]
|
||||
|
||||
const trailingAfterArray = [
|
||||
"One", // One
|
||||
// Two
|
||||
] // Three
|
||||
702
packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json
vendored
Normal file
702
packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/output.json
vendored
Normal file
@@ -0,0 +1,702 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 229,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 229,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 10
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 76,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 76,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 6,
|
||||
"end": 17,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 17
|
||||
},
|
||||
"identifierName": "nonTrailing"
|
||||
},
|
||||
"name": "nonTrailing"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrayExpression",
|
||||
"start": 20,
|
||||
"end": 76,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 20
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"start": 24,
|
||||
"end": 29,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "One",
|
||||
"raw": "\"One\""
|
||||
},
|
||||
"value": "One"
|
||||
},
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"start": 50,
|
||||
"end": 55,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "Two",
|
||||
"raw": "\"Two\""
|
||||
},
|
||||
"value": "Two",
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " One",
|
||||
"start": 31,
|
||||
"end": 37,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Two",
|
||||
"start": 41,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Three",
|
||||
"start": 56,
|
||||
"end": 64,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 16
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Four",
|
||||
"start": 67,
|
||||
"end": 74,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
},
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 78,
|
||||
"end": 162,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 13,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 84,
|
||||
"end": 162,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 13,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 84,
|
||||
"end": 102,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 24
|
||||
},
|
||||
"identifierName": "trailingAfterComma"
|
||||
},
|
||||
"name": "trailingAfterComma"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrayExpression",
|
||||
"start": 105,
|
||||
"end": 162,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 27
|
||||
},
|
||||
"end": {
|
||||
"line": 13,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"start": 109,
|
||||
"end": 114,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 9,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "One",
|
||||
"raw": "\"One\""
|
||||
},
|
||||
"value": "One"
|
||||
},
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"start": 135,
|
||||
"end": 140,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 11,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "Two",
|
||||
"raw": "\"Two\""
|
||||
},
|
||||
"value": "Two",
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " One",
|
||||
"start": 116,
|
||||
"end": 122,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 9,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 15
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Two",
|
||||
"start": 126,
|
||||
"end": 132,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Three",
|
||||
"start": 142,
|
||||
"end": 150,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 11,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 17
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Four",
|
||||
"start": 153,
|
||||
"end": 160,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
},
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 164,
|
||||
"end": 220,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 15,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 170,
|
||||
"end": 220,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 15,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "Identifier",
|
||||
"start": 170,
|
||||
"end": 188,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 15,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 15,
|
||||
"column": 24
|
||||
},
|
||||
"identifierName": "trailingAfterArray"
|
||||
},
|
||||
"name": "trailingAfterArray"
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrayExpression",
|
||||
"start": 191,
|
||||
"end": 220,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 15,
|
||||
"column": 27
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "StringLiteral",
|
||||
"start": 195,
|
||||
"end": 200,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 7
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"rawValue": "One",
|
||||
"raw": "\"One\""
|
||||
},
|
||||
"value": "One",
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " One",
|
||||
"start": 202,
|
||||
"end": 208,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 15
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Two",
|
||||
"start": 212,
|
||||
"end": 218,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 17,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 17,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const",
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Three",
|
||||
"start": 221,
|
||||
"end": 229,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 18,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " One",
|
||||
"start": 31,
|
||||
"end": 37,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 15
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Two",
|
||||
"start": 41,
|
||||
"end": 47,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Three",
|
||||
"start": 56,
|
||||
"end": 64,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 8
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 16
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Four",
|
||||
"start": 67,
|
||||
"end": 74,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " One",
|
||||
"start": 116,
|
||||
"end": 122,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 9,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 15
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Two",
|
||||
"start": 126,
|
||||
"end": 132,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 10,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 10,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Three",
|
||||
"start": 142,
|
||||
"end": 150,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 11,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 17
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Four",
|
||||
"start": 153,
|
||||
"end": 160,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " One",
|
||||
"start": 202,
|
||||
"end": 208,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 16,
|
||||
"column": 9
|
||||
},
|
||||
"end": {
|
||||
"line": 16,
|
||||
"column": 15
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Two",
|
||||
"start": 212,
|
||||
"end": 218,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 17,
|
||||
"column": 3
|
||||
},
|
||||
"end": {
|
||||
"line": 17,
|
||||
"column": 9
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentLine",
|
||||
"value": " Three",
|
||||
"start": 221,
|
||||
"end": 229,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 18,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 18,
|
||||
"column": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
6
packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/input.js
vendored
Normal file
6
packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/input.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
const [
|
||||
/* One */
|
||||
x
|
||||
/* Two */,
|
||||
/* Three */
|
||||
] /* Four */ = [];
|
||||
254
packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/output.json
vendored
Normal file
254
packages/babel-parser/test/fixtures/comments/basic/array-pattern-trailing-comma/output.json
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
{
|
||||
"type": "File",
|
||||
"start": 0,
|
||||
"end": 69,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"program": {
|
||||
"type": "Program",
|
||||
"start": 0,
|
||||
"end": 69,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"sourceType": "script",
|
||||
"interpreter": null,
|
||||
"body": [
|
||||
{
|
||||
"type": "VariableDeclaration",
|
||||
"start": 0,
|
||||
"end": 69,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 18
|
||||
}
|
||||
},
|
||||
"declarations": [
|
||||
{
|
||||
"type": "VariableDeclarator",
|
||||
"start": 6,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"id": {
|
||||
"type": "ArrayPattern",
|
||||
"start": 6,
|
||||
"end": 52,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 6
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 1
|
||||
}
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"type": "Identifier",
|
||||
"start": 22,
|
||||
"end": 23,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 3,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 3,
|
||||
"column": 3
|
||||
},
|
||||
"identifierName": "x"
|
||||
},
|
||||
"name": "x",
|
||||
"leadingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " One ",
|
||||
"start": 10,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " Two ",
|
||||
"start": 26,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 11
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " Three ",
|
||||
"start": 39,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 13
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"trailingComments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " Four ",
|
||||
"start": 53,
|
||||
"end": 63,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"init": {
|
||||
"type": "ArrayExpression",
|
||||
"start": 66,
|
||||
"end": 68,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 15
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 17
|
||||
}
|
||||
},
|
||||
"elements": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"kind": "const"
|
||||
}
|
||||
],
|
||||
"directives": []
|
||||
},
|
||||
"comments": [
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " One ",
|
||||
"start": 10,
|
||||
"end": 19,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 2,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 2,
|
||||
"column": 11
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " Two ",
|
||||
"start": 26,
|
||||
"end": 35,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 4,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 4,
|
||||
"column": 11
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " Three ",
|
||||
"start": 39,
|
||||
"end": 50,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 13
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CommentBlock",
|
||||
"value": " Four ",
|
||||
"start": 53,
|
||||
"end": 63,
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 2
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 12
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user