40 Commits

Author SHA1 Message Date
Nicolò Ribaudo
2d989a983d
Run tests in a native Node.js ESM environment (#13966) 2021-12-03 15:32:58 +01:00
Nicolò Ribaudo
1bbe1fc3cb
Regenerate monorepo READMEs (#14006)
* Fix script to generate readmes

* Regenerate READMEs
2021-11-29 10:03:23 -05:00
Bogdan Savluk
0058b7fef4
Migrate Babel from Flow to TypeScript (except Babel parser) (#11578)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-11-25 23:09:13 +01:00
Nicolò Ribaudo
45308f3cba v7.16.0 2021-10-30 01:26:04 +02:00
Nicolò Ribaudo
c7ddb1ae93
Use workspace:^ to specify @babel/ dependencies (#13772)
* Enforce `workspace:^` to specify `@babel/` dependencies

* `yarn constraints --fix`

* Update lockfile
2021-10-25 07:22:08 +02:00
Huáng Jùnliàng
c2f747c9b9
Improve transform-react-jsx typings (#13820)
* improve transform-react-jsx typings

* rename test fixtures

* remove unreachable sourceSelf check

* update test fixtures

* Update packages/babel-core/src/index.ts

* Update packages/babel-plugin-transform-react-jsx/src/create-plugin.ts

Co-authored-by: Henry Zhu <hi@henryzoo.com>

* Update packages/babel-plugin-transform-react-jsx/src/create-plugin.ts

Co-authored-by: Henry Zhu <hi@henryzoo.com>
2021-10-07 14:01:50 -04:00
Rin Tepis
224a35c5c6
Don't insert __self: this within constructors of derived classes (#13552)
* Don't insert `__self: this` prior to `super()` calls (#13550)

`__self: this` is inserted for debugging purposes. However, it will cause a runtime error if it is inserted prior to a `super()` call in a constructor. This commit will prevent `__self: this` from inserted when there is a following `super()` call.

* Prevent adding `__self` within a constructor that has `super()` altogether.

* Fix 2 typos in the comments.

* Add an additional test case for constructors that do not have a `super()` call.

* Detect `super()` call by testing whether the class has a superclass.

* Update method name and corresponding comments

* Add an additional test for the case where the derived class do not have a `super()` call.

* Apply the same changes to babel-plugin-transform-react-jsx
2021-07-26 13:32:29 -04:00
Babel Bot
7a2a928398 v7.14.5 2021-06-09 23:03:30 +00:00
Kristoffer K
140ec5aa5c
chore: setup Yarn constraints (#13363) 2021-05-31 18:46:03 +02:00
Nicolò Ribaudo
d04842a700
Avoid using CJS globals in internal source files (#12963)
* Lint against CJS globals in modules

* Use `import.meta.url` instead of `__filename` in `src` files

* Prepare fixtures runner for `import.meta.url`

* Use `import.meta.url` instead of `__filename` in `test/index` files

* Remove `__dirname` from remaining test files

dirname

* Avoid using `module` in `src` files

* Avoid using `require` in `src` files

* Avoid using `require` in `test` files

* Update `@types/node`

* Compile dynamic import in `@babel/node`

* Fix windows

* Use `@babel/plugin-proposal-dynamic-import` from npm
2021-03-05 19:55:36 +01:00
Nicolò Ribaudo
ea6a438315
Enable external-helpers by default in tests (#12911)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-02-26 23:33:26 +01:00
Nicolò Ribaudo
2f755ef052 v7.12.17 2021-02-18 15:58:43 +01:00
Babel Bot
dd5c9f958c v7.12.16 2021-02-11 22:36:24 +00:00
Nicolò Ribaudo
e735266dee
Avoid importing .json files (#12759)
* Avoid importing `.json` files

* Use ESold in babel.config.json

* Use `import/extensions` eslint plugin
2021-02-05 23:34:36 +01:00
Nicolò Ribaudo
4f83a09dd8
Load jsx-runtime after existing imports (#12546)
Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-01-10 16:23:22 +01:00
Nicolò Ribaudo
fce3e7124a
[babel 8] Remove useSpread and useBuiltIns jsx options (#12593)
* [babel 8] Remove `useSpread` and `useBuiltIns` jsx options

backport of 8cc8696851fa4bf02d7f6ae591404626d1ca32a3

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>

* Update fixtures (Windows)

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-01-08 18:16:30 +01:00
Nicolò Ribaudo
d88c60cea9 v7.12.12 2020-12-23 14:55:59 +01:00
Nicolò Ribaudo
17d62c3743
refactor: Move react-jsx-development implementation into react-jsx (#12524)
* Move react-jsx-development implementation into react-jsx

* Move helper-builder-jsx-experimental into transform-react-jsx

* Move JSX validation

* Move Program visitor

* introduce get/set utils

* pre -> getTag

* Dedupe code

* post -> getState

* Simplify logic

* Move final pieces

* Other simplifications

* Update lockfile

* Fix standalone bundling
2020-12-22 11:53:14 +01:00
Nicolò Ribaudo
a1acfba387 v7.12.11 2020-12-16 00:55:11 +01:00
Nicolò Ribaudo
28d2cbcbf3
Lazily inject imports to the JSX runtime (#12493) 2020-12-15 12:55:17 +01:00
Mateusz Burzyński
1ef9e196d3
Allow multiple __self/__source props with classic JSX runtime (#12475) 2020-12-10 18:17:20 +01:00
Mateusz Burzyński
c2fcd69e94
Stop using old JSX transform (#12253) 2020-12-08 22:41:13 +01:00
Nicolò Ribaudo
23226d93d4 v7.12.7 2020-11-20 22:02:43 +01:00
Nicolò Ribaudo
a41da05ce9 v7.12.5 2020-11-03 23:30:17 +01:00
Nicolò Ribaudo
02fc9e835c
Revert "add .js extension to react runtime for JSX transform" (#12213) 2020-10-19 19:50:43 +02:00
Nicolò Ribaudo
ed498a772b
Use workspace:* for devDependencies (again) (#12217)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-10-19 18:32:06 +02:00
Nicolò Ribaudo
7f4b83833f v7.12.1 2020-10-16 00:36:30 +02:00
Huáng Jùnliàng
eec01fe078
chore: use workspace:* for dev deps (#12186) 2020-10-15 14:03:50 -04:00
Luna Ruan
9808d2566e
add js extension to react runtime (#12116) 2020-09-30 08:31:45 +02:00
Huáng Jùnliàng
af64ccb2b0 v7.11.5 2020-08-31 15:54:06 -04:00
Joe Haddad
371e152cd2
fix(jsx): do not throw on generated element in development mode (#12017)
* Fix `jsxDEV` for generated elements

* Throw invariant error

* Add test

* test: revise test layout

* fix: node 6 does not support trailing comma

* Use undefined node

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-08-31 15:16:47 -04:00
Huáng Jùnliàng
3fad7eab9b
Use Yarn 2 (#11962)
* chore: use yarn 2

* chore: remove redundant yarn locks

* chore: remove publishEslintPkg

* chore: remove redundant make bootstrap

* Update .yarnrc.yml

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* chore: use workspace protocol for eslint packages in the root

Co-Authored-By: merceyz <merceyz@users.noreply.github.com>

* chore: pin caniuse-lite versions

Testcases in packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie
depends on specific caniuse-lite versions. We pinned the version here
so we don't have to deal with fixture different in e2e-tests
where all deps will be updated and tested.

* chore: resolve yarn install warnings

* chore: update yarn cache path on circle/travis

* chore: add yarn deduplicate plugin

* chore: deduplicate lock files

* chore: move devDependencies to leaf packages

* chore: remove @yarnpkg/plugin-constraints

* chore: remove unused dedupe options

* test: fix unwanted self reference

* chore: remove output-file-sync dependency

* chore: update browserify to 16.5.2

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
2020-08-25 14:37:30 -04:00
Huáng Jùnliàng
7fd40d86a0 v7.10.4 2020-06-30 09:04:22 -04:00
Nicolò Ribaudo
88f57a7ea6 v7.10.1 2020-05-27 21:56:37 +00:00
Saulo Santiago
242d9e0b20
Use repository.directory field in package.json files (#11625)
Co-authored-by: Nicolas Stepien <567105+nstepien@users.noreply.github.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-05-27 16:32:25 +02:00
Huáng Jùnliàng
469e8ed591
Transform cwd in string literal on win32 (#11297)
* chore: replace win32 cwd in string literal by <CWD>

* chore: update test fixtures
2020-03-20 23:59:02 +01:00
Nicolò Ribaudo
8d5e422be2 v7.9.0 2020-03-20 16:32:55 +01:00
Nicolò Ribaudo
11292a3c74
Use the correct this in __self for JSX elements in arrows (#11288)
* 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
2020-03-19 20:01:17 +01:00
Nicolò Ribaudo
f3912ac08f
Mark transpiled JSX elements as pure (#11126)
* 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
2020-03-19 15:43:54 +01:00
Luna Ruan
748897be07
Add experimental version of the `babel-plugin-transform-react-… (#11154)
* add next option for babel-plugin-transform-react-jsx

* address review comments

* chore: update test fixtures

* Update fixture

* Add "columnNumber" to the new React transform

* Update windows fixtures

* Delete unused output.js

* Update windows tests

* Fix windows again

* fix comments

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Moti Zilberman <motiz88@gmail.com>
2020-03-17 09:16:53 +01:00