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
This commit is contained in:
Nicolò Ribaudo
2020-12-22 11:53:14 +01:00
committed by GitHub
parent e08f68bf61
commit 17d62c3743
10 changed files with 729 additions and 1007 deletions

View File

@@ -54,15 +54,14 @@ module.exports = function () {
);
}
const matches = importee.match(/^@babel\/([^/]+)$/);
const matches = importee.match(
/^@babel\/(?<pkg>[^/]+)(?:\/lib\/(?<internal>.*?))?$/
);
if (!matches) return null;
const { pkg, internal } = matches.groups;
// resolve babel package names to their src index file
const packageFolder = path.join(
dirname,
"packages",
`babel-${matches[1]}`
);
const packageFolder = path.join(dirname, "packages", `babel-${pkg}`);
let packageJsonSource;
try {
@@ -76,10 +75,11 @@ module.exports = function () {
const packageJson = JSON.parse(packageJsonSource);
const filename =
typeof packageJson["browser"] === "string"
? packageJson["browser"]
: packageJson["main"];
const filename = internal
? `src/${internal}`
: typeof packageJson["browser"] === "string"
? packageJson["browser"]
: packageJson["main"];
const asJS = path.normalize(
path.join(