* Forbid async arrow functions after binary operator.
This commit makes Babel throw an error when parsing
code like "3 + async() => 2".
* Make atPossibleAsync more accurate
* Change atPossibleAsync to atPossibleAsyncArrow
Add an extra test to atPossibleAsync and refactor it to
atPossibleAsyncArrow. This also fixes a bug in the Typescript plugin,
so a new test has been added.
* Add test for async arrow after unary operator
* fix: parse value imports named type as values
* Address feedback
* Add plugin tests
* Add isContextual() check
* Remove importKind: value from extraneous nodes
* Ensure importKind is correct for more nodes
* Add additional test
* Address feedback
* Revert formatting
* Fix tests
* Memoize in loose mode when callee is a CallExpression
* Handle more complex OptionalCallExpressions where memoization is needed
* Convert calls to Function#call when member needs memoization
* Only update call context for member expressions
* Inject `__source` and `__self` in JSX elements earlier
This fixes an issue where `this` was not correct inside arrow functions, similar to
906f8be24d
* Add test
* Remove try-catch
* Update error
* Update fixtures
* Update windows fixtures
* Mark transpiled JSX elements as pure
* Avoid duble annotation
* Add "pure" option to the React preset
* Fix generator indentation
* Update tests
* Add tests for the "pure" option
* Update windows fixtures
* Allow rest/spread on polyfilled or builtin iterables when `Symbol` unsupported
Currently, when `Symbol` is not supported, we allow using rest/spread with:
- arrays
- strings
- arguments
With this PR, it will be also possible to use it with
- maps
- sets
- binary arrays
While in old browsers es6 builtins would still need to be polyfilled, it's way
easier to polyfill them because `Symbol` cannot be reliably polyfilled.
I didn't use `instanceof` becase:
- it doesn't work with polyfills not attatched to the global scope
- when using Babel to load polyfills, it would force the inclusion of `Map` and `Set` polyfills even if they are not used
Downside: the current approach of relying on `toString || construcor.name` doesn't work with subclasses.
* Don't use Array.from for array-like objects
* Add stricter Optional Chain node validation
Optional chains cannot start with `optional: false`. Somewhere in the `object`/`callee` tree, there must be an optional with `optional: true`.
* Print current node's type when finding an error.
* Extract for-of iterator handling to a helper
Dis greatly recudes the code size when for-of is used multiple times across the
codebase. Also, makes it easier to read what's happening in a compiled loop.
* Unify spec and loose code
* Legacy implementation fallback
* Update tmp var name
* Updates from review and after rebase
* Prepare preset-env and compat-data for preset-modules
* Add transform-edge-default-parameters from preset-modules
* AUtomatically generate data from compat-table
* Add compat data for other plugins
* Updates after rebase
* Add more bugfixes to preset-env
* Update tests
* Add bugfix/transform-safari-for-shadowing
* Fix build script
* bugfix/transform-safari-block-shadowing
* Fix flow
* Include changes from 7127330f02b423d9cb0555b3d2a24dbccbc149b5
* Fix check-compat-data
* Added support for record and tuple syntax.
This commit adds support for both the hash #{} and bar {||}
syntaxes to babel-parser, as well as adds the supporting
babel-plugin-syntax-record-and-tuple plugin to enable support
for the syntax. Does not include any transform for records and
tuples.
* typo
* added check to ensure recordAndTuple in babel-parser
* switched to syntaxType option instead of explicit entries for each record and tuple type
* switched to using recordAndTupleSyntaxType for generator options instead of adding to node
* added tests for generator option recordAndTupleSyntaxType
* added test for record and tuple bar syntax with flow typings
* added tests for invalid/missing recordAndTuple syntaxType parser option
* fixed flowcheck errors
* fix merge with class privates in tokenizer
* Update packages/babel-parser/src/types.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* improved recordAndTuple generator error message, added tests for invalid,missing options
* updated error messages for invalid parser syntaxType option
* updated error message
* added better error messages for when the recordAndTuple syntaxType is doesn't match the syntax used
* updated record and tuple support to use new error message templates
* added recordAndTuple to missing plugin helpers
* Fix linting
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* add plugins
* add plugin description
* run build-data
* set shipped proposals true
* update test fixtures
* corejs.proposals should not imply shipped proposals
* fix eslint errors
Please enter the commit message for your changes. Lines starting
* create new object in packages/babel-compat-data/scripts/data/plugin-features.js
* Add parser support for Flow declare fields
* Add generator test
* Add "allowDeclareFields" option to flow-strip-types
* Add test
* Update error messages
* More tests
* feat: add cloneDeepWithoutLoc
* fix: sort functions alphabetically
* doc: add documentation for the withoutLoc parameter
* test: add a test for shallow cloneWithoutLoc
* test: add loc object to node and fix test
* fix: set loc object on deeper node
* test: check loc on deeper node is null
* doc: adjust withoutLoc documentation
* fix: add withoutLoc param to deep clones
* fix: apply cloneIfNodeOrArray for leadingComments, innerComments and trailingComments
* test: add test for leadingComments, innerComments and trailingComments
* Cleanup PR
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* Added jsescOptions to Numeric Literals
* Added tests and hexadecimal opts to NumericLiterals
* Fixed the bug of every numeric literal being coverted to hex
* Added conditions when jsesc should be applied
* Removed numbers and lowercaseHex from format object
* Added newline to test of jsonEscape (to exclude the change)
* Modified conditions to apply jsesc
* Made the required changes.
* Using node.value instead of value
* feat(react-jsx-source): add column property
This will be useful to tools that consume the injected `__source` prop, allowing precise source locations to be displayed.
* Rename column -> columnNumber, make 1-based
* Add support for type only imports in TS (#11053)
* Implement "export type {}" (#11122)
* Add "exportKind: type" when needed with TS (#11157)
* Add `onlyRemoveTypeImports` option to `transform-typescript` (#11173)
* Add onlyRemoveTypeImports to preset-typescript (#11179)
Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Raja Sekar <rajasekarm.dev@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Henry Zhu <smiley.we@gmail.com>
Co-authored-by: Siddhant N Trivedi <sidntrivedi012@gmail.com>