From 790a262c074909128e2db9ca0240ebce6b75f88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 24 Nov 2021 05:34:41 +0900 Subject: [PATCH] refactor(es/estree): Rename: `babel` => `estree` (#2846) swc_babel_ast: - Rename as `swc_estree_ast`. swc_babel_compat: - Rename as `swc_estree_compat`. swc_babel_visit: - Rename as `swc_estree_visit`. --- .github/workflows/cargo.yml | 9 +- Cargo.lock | 102 +++++++++--------- Cargo.toml | 2 +- crates/swc_babel_visit/Cargo.toml | 18 ---- .../Cargo.toml | 16 ++- .../README.md | 0 .../src/class.rs | 0 .../src/comment.rs | 0 .../src/common.rs | 0 .../src/decl.rs | 0 .../src/expr.rs | 0 .../src/flow.rs | 0 .../src/jsx.rs | 0 .../src/lib.rs | 29 +++-- .../src/lit.rs | 0 .../src/module.rs | 0 .../src/object.rs | 0 .../src/pat.rs | 0 .../src/stmt.rs | 0 .../src/typescript.rs | 0 .../Cargo.toml | 26 +++-- .../README.md | 0 .../benches/assets/AjaxObservable.ts | 0 .../benches/babelify.rs | 2 +- .../scripts/update.sh | 0 .../src/babelify/class.rs | 10 +- .../src/babelify/decl.rs | 2 +- .../src/babelify/expr.rs | 16 +-- .../src/babelify/function.rs | 4 +- .../src/babelify/ident.rs | 2 +- .../src/babelify/jsx.rs | 16 +-- .../src/babelify/lit.rs | 2 +- .../src/babelify/mod.rs | 2 +- .../src/babelify/module.rs | 8 +- .../src/babelify/module_decl.rs | 14 +-- .../src/babelify/normalize/mod.rs | 4 +- .../src/babelify/operators.rs | 2 +- .../src/babelify/pat.rs | 10 +- .../src/babelify/prop.rs | 8 +- .../src/babelify/stmt.rs | 12 +-- .../src/babelify/typescript.rs | 2 +- .../src/lib.rs | 0 .../src/swcify/class.rs | 14 +-- .../src/swcify/ctx.rs | 2 +- .../src/swcify/expr.rs | 78 +++++++------- .../src/swcify/jsx.rs | 4 +- .../src/swcify/lit.rs | 6 +- .../src/swcify/mod.rs | 0 .../src/swcify/pat.rs | 38 +++---- .../src/swcify/program.rs | 0 .../src/swcify/stmt.rs | 54 +++++----- .../src/swcify/typescript.rs | 10 +- .../tests/README.md | 0 .../tests/babelgen.js | 0 .../tests/compare.sh | 0 .../tests/convert.rs | 6 +- .../fixtures/array-destructuring/input.js | 0 .../fixtures/array-destructuring/output.json | 0 .../tests/fixtures/array-simple/input.js | 0 .../tests/fixtures/array-simple/output.json | 0 .../tests/fixtures/class-extends/input.js | 0 .../tests/fixtures/class-extends/output.json | 0 .../fixtures/class-getter-setter/input.js | 0 .../fixtures/class-getter-setter/output.json | 0 .../fixtures/class-method-no-body/input.js | 0 .../fixtures/class-method-no-body/output.json | 0 .../fixtures/class-public-fields/input.js | 0 .../fixtures/class-public-fields/output.json | 0 .../tests/fixtures/class-simple/input.js | 0 .../tests/fixtures/class-simple/output.json | 0 .../tests/fixtures/class-static/input.js | 0 .../tests/fixtures/class-static/output.json | 0 .../tests/fixtures/class-unnamed/input.js | 0 .../tests/fixtures/class-unnamed/output.json | 0 .../comments-block-first-line/input.js | 0 .../comments-block-first-line/output.json | 0 .../tests/fixtures/comments-block/input.js | 0 .../tests/fixtures/comments-block/output.json | 0 .../fixtures/comments-first-line/input.js | 0 .../fixtures/comments-first-line/output.json | 0 .../tests/fixtures/comments-line/input.js | 0 .../tests/fixtures/comments-line/output.json | 0 .../tests/fixtures/delete-operator/input.js | 0 .../fixtures/delete-operator/output.json | 0 .../fixtures/exponentiation-operator/input.js | 0 .../exponentiation-operator/output.json | 0 .../fixtures/function-anonymous/input.js | 0 .../fixtures/function-anonymous/output.json | 0 .../tests/fixtures/function-arrow/input.js | 0 .../tests/fixtures/function-arrow/output.json | 0 .../function-default-parameters/input.js | 0 .../function-default-parameters/output.json | 0 .../function-rest-parameters/input.js | 0 .../function-rest-parameters/output.json | 0 .../tests/fixtures/function-simple/input.js | 0 .../fixtures/function-simple/output.json | 0 .../tests/fixtures/jsx-and-expr/input.jsx | 0 .../tests/fixtures/jsx-and-expr/output.json | 0 .../tests/fixtures/jsx-children/input.jsx | 0 .../tests/fixtures/jsx-children/output.json | 0 .../tests/fixtures/jsx-map/input.jsx | 0 .../tests/fixtures/jsx-map/output.json | 0 .../tests/fixtures/jsx-props-spread/input.jsx | 0 .../fixtures/jsx-props-spread/output.json | 0 .../tests/fixtures/jsx-props/input.jsx | 0 .../tests/fixtures/jsx-props/output.json | 0 .../tests/fixtures/jsx-self-closing/input.jsx | 0 .../fixtures/jsx-self-closing/output.json | 0 .../tests/fixtures/jsx-simple/input.jsx | 0 .../tests/fixtures/jsx-simple/output.json | 0 .../tests/fixtures/jsx-ternary-expr/input.jsx | 0 .../fixtures/jsx-ternary-expr/output.json | 0 .../tests/fixtures/module-commonjs/input.js | 0 .../fixtures/module-commonjs/output.json | 0 .../fixtures/module-export-default/input.mjs | 0 .../module-export-default/output.json | 0 .../module-export-individual-items/input.mjs | 0 .../output.json | 0 .../fixtures/module-export-named/input.mjs | 0 .../fixtures/module-export-named/output.json | 0 .../fixtures/module-export-renamed/input.mjs | 0 .../module-export-renamed/output.json | 0 .../fixtures/module-import-default/input.mjs | 0 .../module-import-default/output.json | 0 .../fixtures/module-import-multiple/input.mjs | 0 .../module-import-multiple/output.json | 0 .../fixtures/module-import-named/input.mjs | 0 .../fixtures/module-import-named/output.json | 0 .../fixtures/module-import-renamed/input.mjs | 0 .../module-import-renamed/output.json | 0 .../module-import-star-renamed/input.mjs | 0 .../module-import-star-renamed/output.json | 0 .../fixtures/object-destructuring/input.js | 0 .../fixtures/object-destructuring/output.json | 0 .../tests/fixtures/object-simple/input.js | 0 .../tests/fixtures/object-simple/output.json | 0 .../tests/fixtures/object-spread/input.js | 0 .../tests/fixtures/object-spread/output.json | 0 .../tests/fixtures/regex-flags/input.js | 0 .../tests/fixtures/regex-flags/output.json | 0 .../tests/fixtures/regex-simple/input.js | 0 .../tests/fixtures/regex-simple/output.json | 0 .../tests/fixtures/shebang/input.js | 0 .../tests/fixtures/shebang/output.json | 0 .../tests/fixtures/simple-two-lines/input.js | 0 .../fixtures/simple-two-lines/output.json | 0 .../tests/fixtures/simple/input.js | 0 .../tests/fixtures/simple/output.json | 0 .../tests/fixtures/static-blocks/input.js | 0 .../tests/fixtures/static-blocks/output.json | 0 .../tests/fixtures/template-literal/input.js | 0 .../fixtures/template-literal/output.json | 0 .../tests/fixtures/ts-function/input.ts | 0 .../tests/package.json | 0 .../tests/swcgen.js | 0 crates/swc_estree_macros/Cargo.toml | 14 +++ crates/swc_estree_macros/src/lib.rs | 1 + crates/swc_estree_visit/Cargo.toml | 24 +++++ .../README.md | 0 .../src/lib.rs | 2 +- cspell.json | 1 + 161 files changed, 310 insertions(+), 262 deletions(-) delete mode 100644 crates/swc_babel_visit/Cargo.toml rename crates/{swc_babel_ast => swc_estree_ast}/Cargo.toml (58%) rename crates/{swc_babel_ast => swc_estree_ast}/README.md (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/class.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/comment.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/common.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/decl.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/expr.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/flow.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/jsx.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/lib.rs (82%) rename crates/{swc_babel_ast => swc_estree_ast}/src/lit.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/module.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/object.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/pat.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/stmt.rs (100%) rename crates/{swc_babel_ast => swc_estree_ast}/src/typescript.rs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/Cargo.toml (62%) rename crates/{swc_babel_compat => swc_estree_compat}/README.md (100%) rename crates/{swc_babel_compat => swc_estree_compat}/benches/assets/AjaxObservable.ts (100%) rename crates/{swc_babel_compat => swc_estree_compat}/benches/babelify.rs (98%) rename crates/{swc_babel_compat => swc_estree_compat}/scripts/update.sh (100%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/class.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/decl.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/expr.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/function.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/ident.rs (94%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/jsx.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/lit.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/mod.rs (98%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/module.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/module_decl.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/normalize/mod.rs (98%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/operators.rs (98%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/pat.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/prop.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/stmt.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/babelify/typescript.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/lib.rs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/class.rs (96%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/ctx.rs (97%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/expr.rs (95%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/jsx.rs (84%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/lit.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/mod.rs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/pat.rs (83%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/program.rs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/stmt.rs (96%) rename crates/{swc_babel_compat => swc_estree_compat}/src/swcify/typescript.rs (99%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/README.md (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/babelgen.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/compare.sh (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/convert.rs (97%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/array-destructuring/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/array-destructuring/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/array-simple/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/array-simple/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-extends/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-extends/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-getter-setter/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-getter-setter/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-method-no-body/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-method-no-body/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-public-fields/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-public-fields/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-simple/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-simple/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-static/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-static/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-unnamed/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/class-unnamed/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/comments-block-first-line/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/comments-block-first-line/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/comments-block/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/comments-block/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/comments-first-line/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/comments-first-line/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/comments-line/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/comments-line/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/delete-operator/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/delete-operator/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/exponentiation-operator/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/exponentiation-operator/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-anonymous/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-anonymous/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-arrow/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-arrow/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-default-parameters/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-default-parameters/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-rest-parameters/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-rest-parameters/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-simple/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/function-simple/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-and-expr/input.jsx (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-and-expr/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-children/input.jsx (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-children/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-map/input.jsx (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-map/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-props-spread/input.jsx (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-props-spread/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-props/input.jsx (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-props/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-self-closing/input.jsx (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-self-closing/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-simple/input.jsx (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-simple/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-ternary-expr/input.jsx (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/jsx-ternary-expr/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-commonjs/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-commonjs/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-export-default/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-export-default/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-export-individual-items/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-export-individual-items/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-export-named/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-export-named/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-export-renamed/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-export-renamed/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-default/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-default/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-multiple/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-multiple/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-named/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-named/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-renamed/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-renamed/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-star-renamed/input.mjs (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/module-import-star-renamed/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/object-destructuring/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/object-destructuring/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/object-simple/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/object-simple/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/object-spread/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/object-spread/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/regex-flags/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/regex-flags/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/regex-simple/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/regex-simple/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/shebang/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/shebang/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/simple-two-lines/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/simple-two-lines/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/simple/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/simple/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/static-blocks/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/static-blocks/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/template-literal/input.js (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/template-literal/output.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/fixtures/ts-function/input.ts (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/package.json (100%) rename crates/{swc_babel_compat => swc_estree_compat}/tests/swcgen.js (100%) create mode 100644 crates/swc_estree_macros/Cargo.toml create mode 100644 crates/swc_estree_macros/src/lib.rs create mode 100644 crates/swc_estree_visit/Cargo.toml rename crates/{swc_babel_visit => swc_estree_visit}/README.md (100%) rename crates/{swc_babel_visit => swc_estree_visit}/src/lib.rs (99%) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 80a860c3fa9..b10d9af59df 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -117,9 +117,6 @@ jobs: - string_enum - swc - swc_atoms - - swc_babel_ast - - swc_babel_compat - - swc_babel_visit - swc_bundler - swc_common - swc_css @@ -154,16 +151,22 @@ jobs: - swc_ecma_visit - swc_ecmascript - swc_eq_ignore_macros + - swc_estree_ast + - swc_estree_compat + - swc_estree_macros + - swc_estree_visit - swc_fast_graph - swc_graph_analyzer - swc_macros_common - swc_node_base - swc_node_bundler + - swc_node_comments - swc_plugin - swc_plugin_api - swc_plugin_runner - swc_plugin_testing - swc_stylis + - swc_timer - swc_visit - swc_visit_macros - testing diff --git a/Cargo.lock b/Cargo.lock index 6792e1b6417..b75b2ead7d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2491,54 +2491,6 @@ dependencies = [ "string_cache_codegen", ] -[[package]] -name = "swc_babel_ast" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", - "swc_atoms 0.2.9", - "swc_common", - "swc_node_base", -] - -[[package]] -name = "swc_babel_compat" -version = "0.2.0" -dependencies = [ - "ahash", - "anyhow", - "copyless", - "pretty_assertions 0.7.2", - "rayon", - "serde", - "serde_json", - "swc", - "swc_atoms 0.2.9", - "swc_babel_ast", - "swc_babel_visit", - "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_transforms", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_node_base", - "swc_node_comments", - "walkdir", -] - -[[package]] -name = "swc_babel_visit" -version = "0.1.0" -dependencies = [ - "serde", - "serde_json", - "swc_atoms 0.2.9", - "swc_babel_ast", - "swc_visit", -] - [[package]] name = "swc_bundler" version = "0.82.1" @@ -3189,6 +3141,60 @@ dependencies = [ "syn", ] +[[package]] +name = "swc_estree_ast" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "swc_atoms 0.2.9", + "swc_common", + "swc_estree_macros", +] + +[[package]] +name = "swc_estree_compat" +version = "0.2.0" +dependencies = [ + "ahash", + "anyhow", + "copyless", + "pretty_assertions 0.7.2", + "rayon", + "serde", + "serde_json", + "swc", + "swc_atoms 0.2.9", + "swc_common", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_ecma_transforms", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_estree_ast", + "swc_estree_macros", + "swc_estree_visit", + "swc_node_base", + "swc_node_comments", + "walkdir", +] + +[[package]] +name = "swc_estree_macros" +version = "0.1.0" + +[[package]] +name = "swc_estree_visit" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "swc_atoms 0.2.9", + "swc_estree_ast", + "swc_estree_macros", + "swc_visit", +] + [[package]] name = "swc_fast_graph" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 1a0a46ddf44..312b906a617 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,10 +2,10 @@ members = [ "crates/jsdoc", "crates/node", - "crates/swc_babel_compat", "crates/swc_css", "crates/swc_ecmascript", "crates/swc_ecma_plugin_ast", + "crates/swc_estree_compat", "crates/swc_plugin", "crates/swc_plugin_runner", "crates/swc_plugin_testing", diff --git a/crates/swc_babel_visit/Cargo.toml b/crates/swc_babel_visit/Cargo.toml deleted file mode 100644 index 6b337d146c9..00000000000 --- a/crates/swc_babel_visit/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -authors = ["강동윤 ", "Daniel Woznicki "] -description = "Visitor implementation for babel nodes" -documentation = "https://rustdoc.swc.rs/swc_babel_visit/" -edition = "2018" -license = "Apache-2.0/MIT" -name = "swc_babel_visit" -repository = "https://github.com/swc-project/swc.git" -version = "0.1.0" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -serde = {version = "1", features = ["derive"]} -serde_json = "1.0.62" -swc_atoms = {version = "0.2", path = "../swc_atoms"} -swc_babel_ast = {version = "0.1", path = "../swc_babel_ast"} -swc_visit = {version = "0.2", path = "../swc_visit"} diff --git a/crates/swc_babel_ast/Cargo.toml b/crates/swc_estree_ast/Cargo.toml similarity index 58% rename from crates/swc_babel_ast/Cargo.toml rename to crates/swc_estree_ast/Cargo.toml index 17a5858a559..08134f4603a 100644 --- a/crates/swc_babel_ast/Cargo.toml +++ b/crates/swc_estree_ast/Cargo.toml @@ -1,17 +1,23 @@ [package] authors = ["강동윤 ", "Daniel Woznicki "] -description = "Babel AST node definitions" -documentation = "https://rustdoc.swc.rs/swc_babel_ast/" +description = "ESTree AST node definitions" +documentation = "https://rustdoc.swc.rs/swc_estree_ast/" edition = "2018" license = "Apache-2.0/MIT" -name = "swc_babel_ast" +name = "swc_estree_ast" repository = "https://github.com/swc-project/swc.git" version = "0.1.0" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[package.metadata.docs.rs] +all-features = true + +[features] +flavor-acorn = [] +flavor-babel = [] [dependencies] serde = {version = "1", features = ["derive"]} serde_json = "1.0.62" swc_atoms = {version = "0.2", path = "../swc_atoms"} swc_common = {version = "0.14", path = "../swc_common"} -swc_node_base = {version = "0.5", path = "../swc_node_base"} +swc_estree_macros = {version = "0.1", path = "../swc_estree_macros/"} diff --git a/crates/swc_babel_ast/README.md b/crates/swc_estree_ast/README.md similarity index 100% rename from crates/swc_babel_ast/README.md rename to crates/swc_estree_ast/README.md diff --git a/crates/swc_babel_ast/src/class.rs b/crates/swc_estree_ast/src/class.rs similarity index 100% rename from crates/swc_babel_ast/src/class.rs rename to crates/swc_estree_ast/src/class.rs diff --git a/crates/swc_babel_ast/src/comment.rs b/crates/swc_estree_ast/src/comment.rs similarity index 100% rename from crates/swc_babel_ast/src/comment.rs rename to crates/swc_estree_ast/src/comment.rs diff --git a/crates/swc_babel_ast/src/common.rs b/crates/swc_estree_ast/src/common.rs similarity index 100% rename from crates/swc_babel_ast/src/common.rs rename to crates/swc_estree_ast/src/common.rs diff --git a/crates/swc_babel_ast/src/decl.rs b/crates/swc_estree_ast/src/decl.rs similarity index 100% rename from crates/swc_babel_ast/src/decl.rs rename to crates/swc_estree_ast/src/decl.rs diff --git a/crates/swc_babel_ast/src/expr.rs b/crates/swc_estree_ast/src/expr.rs similarity index 100% rename from crates/swc_babel_ast/src/expr.rs rename to crates/swc_estree_ast/src/expr.rs diff --git a/crates/swc_babel_ast/src/flow.rs b/crates/swc_estree_ast/src/flow.rs similarity index 100% rename from crates/swc_babel_ast/src/flow.rs rename to crates/swc_estree_ast/src/flow.rs diff --git a/crates/swc_babel_ast/src/jsx.rs b/crates/swc_estree_ast/src/jsx.rs similarity index 100% rename from crates/swc_babel_ast/src/jsx.rs rename to crates/swc_estree_ast/src/jsx.rs diff --git a/crates/swc_babel_ast/src/lib.rs b/crates/swc_estree_ast/src/lib.rs similarity index 82% rename from crates/swc_babel_ast/src/lib.rs rename to crates/swc_estree_ast/src/lib.rs index 321f2a4bb8b..315358aba52 100644 --- a/crates/swc_babel_ast/src/lib.rs +++ b/crates/swc_estree_ast/src/lib.rs @@ -1,5 +1,16 @@ -/// Explicit extern crate to use global allocator. -extern crate swc_node_base; +pub use class::*; +pub use comment::*; +pub use common::*; +pub use decl::*; +pub use expr::*; +pub use flow::*; +pub use jsx::*; +pub use lit::*; +pub use module::*; +pub use object::*; +pub use pat::*; +pub use stmt::*; +pub use typescript::*; mod class; mod comment; @@ -14,17 +25,3 @@ mod object; mod pat; mod stmt; mod typescript; - -pub use class::*; -pub use comment::*; -pub use common::*; -pub use decl::*; -pub use expr::*; -pub use flow::*; -pub use jsx::*; -pub use lit::*; -pub use module::*; -pub use object::*; -pub use pat::*; -pub use stmt::*; -pub use typescript::*; diff --git a/crates/swc_babel_ast/src/lit.rs b/crates/swc_estree_ast/src/lit.rs similarity index 100% rename from crates/swc_babel_ast/src/lit.rs rename to crates/swc_estree_ast/src/lit.rs diff --git a/crates/swc_babel_ast/src/module.rs b/crates/swc_estree_ast/src/module.rs similarity index 100% rename from crates/swc_babel_ast/src/module.rs rename to crates/swc_estree_ast/src/module.rs diff --git a/crates/swc_babel_ast/src/object.rs b/crates/swc_estree_ast/src/object.rs similarity index 100% rename from crates/swc_babel_ast/src/object.rs rename to crates/swc_estree_ast/src/object.rs diff --git a/crates/swc_babel_ast/src/pat.rs b/crates/swc_estree_ast/src/pat.rs similarity index 100% rename from crates/swc_babel_ast/src/pat.rs rename to crates/swc_estree_ast/src/pat.rs diff --git a/crates/swc_babel_ast/src/stmt.rs b/crates/swc_estree_ast/src/stmt.rs similarity index 100% rename from crates/swc_babel_ast/src/stmt.rs rename to crates/swc_estree_ast/src/stmt.rs diff --git a/crates/swc_babel_ast/src/typescript.rs b/crates/swc_estree_ast/src/typescript.rs similarity index 100% rename from crates/swc_babel_ast/src/typescript.rs rename to crates/swc_estree_ast/src/typescript.rs diff --git a/crates/swc_babel_compat/Cargo.toml b/crates/swc_estree_compat/Cargo.toml similarity index 62% rename from crates/swc_babel_compat/Cargo.toml rename to crates/swc_estree_compat/Cargo.toml index af4de6d0c4f..46672ea11f0 100644 --- a/crates/swc_babel_compat/Cargo.toml +++ b/crates/swc_estree_compat/Cargo.toml @@ -1,14 +1,25 @@ [package] authors = ["강동윤 "] -description = "Compatibility layer between babel and swc" -documentation = "https://rustdoc.swc.rs/swc_babel_compat/" +description = "Compatibility layer between estree and swc" +documentation = "https://rustdoc.swc.rs/swc_estree_compat/" edition = "2018" license = "Apache-2.0/MIT" -name = "swc_babel_compat" +name = "swc_estree_compat" repository = "https://github.com/swc-project/swc.git" version = "0.2.0" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[package.metadata.docs.rs] +all-features = true + +[features] +flavor-acorn = [ + "swc_estree_ast/flavor-acorn", + "swc_estree_visit/flavor-acorn", +] +flavor-babel = [ + "swc_estree_ast/flavor-babel", + "swc_estree_visit/flavor-babel", +] [dependencies] ahash = {version = "0.7.0", features = ["compile-time-rng"]} @@ -18,13 +29,14 @@ rayon = "1.5.0" serde = {version = "1", features = ["derive"]} serde_json = "1.0.62" swc_atoms = {version = "0.2", path = "../swc_atoms"} -swc_babel_ast = {version = "0.1", path = "../swc_babel_ast"} -swc_babel_visit = {version = "0.1", path = "../swc_babel_visit"} -swc_common = {version = "0.14", path = "../swc_common", features = ["sourcemap", "tty-emitter"]} +swc_common = {version = "0.14", path = "../swc_common", features = ["concurrent", "sourcemap", "tty-emitter"]} swc_ecma_ast = {version = "0.58", path = "../swc_ecma_ast"} swc_ecma_parser = {version = "0.78", path = "../swc_ecma_parser"} swc_ecma_utils = {version = "0.52.2", path = "../swc_ecma_utils"} swc_ecma_visit = {version = "0.44", path = "../swc_ecma_visit"} +swc_estree_ast = {version = "0.1", path = "../swc_estree_ast"} +swc_estree_macros = {version = "0.1", path = "../swc_estree_macros/"} +swc_estree_visit = {version = "0.1", path = "../swc_estree_visit"} swc_node_comments = {version = "0.1", path = "../swc_node_comments/"} [dev-dependencies] diff --git a/crates/swc_babel_compat/README.md b/crates/swc_estree_compat/README.md similarity index 100% rename from crates/swc_babel_compat/README.md rename to crates/swc_estree_compat/README.md diff --git a/crates/swc_babel_compat/benches/assets/AjaxObservable.ts b/crates/swc_estree_compat/benches/assets/AjaxObservable.ts similarity index 100% rename from crates/swc_babel_compat/benches/assets/AjaxObservable.ts rename to crates/swc_estree_compat/benches/assets/AjaxObservable.ts diff --git a/crates/swc_babel_compat/benches/babelify.rs b/crates/swc_estree_compat/benches/babelify.rs similarity index 98% rename from crates/swc_babel_compat/benches/babelify.rs rename to crates/swc_estree_compat/benches/babelify.rs index 8a1384dd28e..9e1527cf08a 100644 --- a/crates/swc_babel_compat/benches/babelify.rs +++ b/crates/swc_estree_compat/benches/babelify.rs @@ -5,12 +5,12 @@ extern crate test; use std::{hint::black_box, io::stderr, sync::Arc}; use swc::config::IsModule; -use swc_babel_compat::babelify::{Babelify, Context}; use swc_common::{errors::Handler, FileName, FilePathMapping, SourceFile, SourceMap}; use swc_ecma_ast::{EsVersion, Program}; use swc_ecma_parser::Syntax; use swc_ecma_transforms::{compat::es2020, typescript}; use swc_ecma_visit::FoldWith; +use swc_estree_compat::babelify::{Babelify, Context}; use test::Bencher; static SOURCE: &str = include_str!("assets/AjaxObservable.ts"); diff --git a/crates/swc_babel_compat/scripts/update.sh b/crates/swc_estree_compat/scripts/update.sh similarity index 100% rename from crates/swc_babel_compat/scripts/update.sh rename to crates/swc_estree_compat/scripts/update.sh diff --git a/crates/swc_babel_compat/src/babelify/class.rs b/crates/swc_estree_compat/src/babelify/class.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/class.rs rename to crates/swc_estree_compat/src/babelify/class.rs index 5b8f239a255..6186dc6466a 100644 --- a/crates/swc_babel_compat/src/babelify/class.rs +++ b/crates/swc_estree_compat/src/babelify/class.rs @@ -1,15 +1,15 @@ use crate::babelify::{extract_class_body_span, Babelify, Context}; use copyless::BoxHelper; use serde_json::value::Value; -use swc_babel_ast::{ - ClassBody, ClassBodyEl, ClassExpression, ClassMethod as BabelClassMethod, ClassMethodKind, - ClassPrivateMethod, ClassPrivateProperty, ClassProperty, Decorator as BabelDecorator, - StaticBlock as BabelStaticBlock, -}; use swc_ecma_ast::{ Class, ClassMember, ClassMethod, ClassProp, Constructor, Decorator, MethodKind, PrivateMethod, PrivateProp, StaticBlock, }; +use swc_estree_ast::{ + ClassBody, ClassBodyEl, ClassExpression, ClassMethod as BabelClassMethod, ClassMethodKind, + ClassPrivateMethod, ClassPrivateProperty, ClassProperty, Decorator as BabelDecorator, + StaticBlock as BabelStaticBlock, +}; impl Babelify for Class { type Output = ClassExpression; diff --git a/crates/swc_babel_compat/src/babelify/decl.rs b/crates/swc_estree_compat/src/babelify/decl.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/decl.rs rename to crates/swc_estree_compat/src/babelify/decl.rs index a2c8c28f0e0..c4663646c31 100644 --- a/crates/swc_babel_compat/src/babelify/decl.rs +++ b/crates/swc_estree_compat/src/babelify/decl.rs @@ -1,6 +1,6 @@ use crate::babelify::{extract_class_body_span, Babelify, Context}; use copyless::BoxHelper; -use swc_babel_ast::{ +use swc_estree_ast::{ ClassBody, ClassDeclaration, Declaration, FunctionDeclaration, VariableDeclaration, VariableDeclarationKind, VariableDeclarator, }; diff --git a/crates/swc_babel_compat/src/babelify/expr.rs b/crates/swc_estree_compat/src/babelify/expr.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/expr.rs rename to crates/swc_estree_compat/src/babelify/expr.rs index 4dc157587ad..ec30da1a3bb 100644 --- a/crates/swc_babel_compat/src/babelify/expr.rs +++ b/crates/swc_estree_compat/src/babelify/expr.rs @@ -1,7 +1,14 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; use serde::{Deserialize, Serialize}; -use swc_babel_ast::{ +use swc_common::Spanned; +use swc_ecma_ast::{ + ArrayLit, ArrowExpr, AssignExpr, AwaitExpr, BinExpr, BinaryOp, BlockStmtOrExpr, CallExpr, + ClassExpr, CondExpr, Expr, ExprOrSpread, ExprOrSuper, FnExpr, Lit, MemberExpr, MetaPropExpr, + NewExpr, ObjectLit, ParenExpr, PatOrExpr, PropOrSpread, SeqExpr, SpreadElement, Super, + TaggedTpl, ThisExpr, Tpl, TplElement, UnaryExpr, UpdateExpr, YieldExpr, +}; +use swc_estree_ast::{ ArrayExprEl, ArrayExpression, ArrowFuncExprBody, ArrowFunctionExpression, AssignmentExpression, AwaitExpression, BinaryExprLeft, BinaryExpression, CallExpression, Callee, ClassExpression, ConditionalExpression, Expression, FunctionExpression, LVal, LogicalExpression, MemberExprProp, @@ -11,13 +18,6 @@ use swc_babel_ast::{ TaggedTemplateExpression, TemplateElVal, TemplateElement, TemplateLiteral, TemplateLiteralExpr, ThisExpression, UnaryExpression, UpdateExpression, YieldExpression, }; -use swc_common::Spanned; -use swc_ecma_ast::{ - ArrayLit, ArrowExpr, AssignExpr, AwaitExpr, BinExpr, BinaryOp, BlockStmtOrExpr, CallExpr, - ClassExpr, CondExpr, Expr, ExprOrSpread, ExprOrSuper, FnExpr, Lit, MemberExpr, MetaPropExpr, - NewExpr, ObjectLit, ParenExpr, PatOrExpr, PropOrSpread, SeqExpr, SpreadElement, Super, - TaggedTpl, ThisExpr, Tpl, TplElement, UnaryExpr, UpdateExpr, YieldExpr, -}; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum ExprOutput { diff --git a/crates/swc_babel_compat/src/babelify/function.rs b/crates/swc_estree_compat/src/babelify/function.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/function.rs rename to crates/swc_estree_compat/src/babelify/function.rs index 557e7119723..67187bd3ac4 100644 --- a/crates/swc_babel_compat/src/babelify/function.rs +++ b/crates/swc_estree_compat/src/babelify/function.rs @@ -1,10 +1,10 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; -use swc_babel_ast::{ +use swc_ecma_ast::{Function, Param, ParamOrTsParamProp, Pat}; +use swc_estree_ast::{ ArrayPattern, AssignmentPattern, FunctionExpression, Identifier, ObjectPattern, Param as BabelParam, Pattern, RestElement, }; -use swc_ecma_ast::{Function, Param, ParamOrTsParamProp, Pat}; impl Babelify for Function { type Output = FunctionExpression; diff --git a/crates/swc_babel_compat/src/babelify/ident.rs b/crates/swc_estree_compat/src/babelify/ident.rs similarity index 94% rename from crates/swc_babel_compat/src/babelify/ident.rs rename to crates/swc_estree_compat/src/babelify/ident.rs index 7c9326bd046..bf042fb3c1b 100644 --- a/crates/swc_babel_compat/src/babelify/ident.rs +++ b/crates/swc_estree_compat/src/babelify/ident.rs @@ -1,7 +1,7 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; -use swc_babel_ast::{Identifier, PrivateName as BabelPrivateName}; use swc_ecma_ast::{BindingIdent, Ident, PrivateName}; +use swc_estree_ast::{Identifier, PrivateName as BabelPrivateName}; impl Babelify for BindingIdent { type Output = Identifier; diff --git a/crates/swc_babel_compat/src/babelify/jsx.rs b/crates/swc_estree_compat/src/babelify/jsx.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/jsx.rs rename to crates/swc_estree_compat/src/babelify/jsx.rs index a79ef9c12bd..a214759bf37 100644 --- a/crates/swc_babel_compat/src/babelify/jsx.rs +++ b/crates/swc_estree_compat/src/babelify/jsx.rs @@ -1,6 +1,13 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; -use swc_babel_ast::{ +use swc_common::{BytePos, Span, Spanned}; +use swc_ecma_ast::{ + JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment, + JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpr, JSXExpr, JSXExprContainer, + JSXFragment, JSXMemberExpr, JSXNamespacedName, JSXObject, JSXOpeningElement, + JSXOpeningFragment, JSXSpreadChild, JSXText, Lit, +}; +use swc_estree_ast::{ JSXAttrName as BabelJSXAttrName, JSXAttrVal, JSXAttribute, JSXClosingElement as BabelJSXClosingElement, JSXClosingFragment as BabelJSXClosingFragment, JSXElement as BabelJSXElement, JSXElementChild as BabelJSXElementChild, @@ -10,13 +17,6 @@ use swc_babel_ast::{ JSXOpeningElement as BabelJSXOpeningElement, JSXOpeningFragment as BabelJSXOpeningFragment, JSXSpreadAttribute, JSXSpreadChild as BabelJSXSpreadChild, JSXText as BabelJSXText, }; -use swc_common::{BytePos, Span, Spanned}; -use swc_ecma_ast::{ - JSXAttr, JSXAttrName, JSXAttrOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment, - JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpr, JSXExpr, JSXExprContainer, - JSXFragment, JSXMemberExpr, JSXNamespacedName, JSXObject, JSXOpeningElement, - JSXOpeningFragment, JSXSpreadChild, JSXText, Lit, -}; impl Babelify for JSXObject { type Output = JSXMemberExprObject; diff --git a/crates/swc_babel_compat/src/babelify/lit.rs b/crates/swc_estree_compat/src/babelify/lit.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/lit.rs rename to crates/swc_estree_compat/src/babelify/lit.rs index c8d095758f6..82320569ee7 100644 --- a/crates/swc_babel_compat/src/babelify/lit.rs +++ b/crates/swc_estree_compat/src/babelify/lit.rs @@ -1,5 +1,5 @@ use crate::babelify::{Babelify, Context}; -use swc_babel_ast::{ +use swc_estree_ast::{ BigIntLiteral, BooleanLiteral, JSXText as BabelJSXText, Literal, NullLiteral, NumericLiteral, RegExpLiteral, StringLiteral, }; diff --git a/crates/swc_babel_compat/src/babelify/mod.rs b/crates/swc_estree_compat/src/babelify/mod.rs similarity index 98% rename from crates/swc_babel_compat/src/babelify/mod.rs rename to crates/swc_estree_compat/src/babelify/mod.rs index d659ee4c36f..f193e9743ce 100644 --- a/crates/swc_babel_compat/src/babelify/mod.rs +++ b/crates/swc_estree_compat/src/babelify/mod.rs @@ -1,13 +1,13 @@ use rayon::prelude::*; use serde::{de::DeserializeOwned, Serialize}; use std::sync::Arc; -use swc_babel_ast::{BaseComment, BaseNode, Comment, LineCol, Loc}; use swc_common::{ comments::{CommentKind, Comments}, sync::Lrc, BytePos, SourceFile, SourceMap, Span, }; use swc_ecma_ast::Class; +use swc_estree_ast::{BaseComment, BaseNode, Comment, LineCol, Loc}; use swc_node_comments::SwcComments; mod class; diff --git a/crates/swc_babel_compat/src/babelify/module.rs b/crates/swc_estree_compat/src/babelify/module.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/module.rs rename to crates/swc_estree_compat/src/babelify/module.rs index 21131056aa4..e8176e4ed90 100644 --- a/crates/swc_babel_compat/src/babelify/module.rs +++ b/crates/swc_estree_compat/src/babelify/module.rs @@ -1,12 +1,12 @@ use crate::babelify::{Babelify, Context}; use serde::{Deserialize, Serialize}; -use swc_babel_ast::{ - BaseNode, File, InterpreterDirective, LineCol, Loc, ModuleDeclaration, Program as BabelProgram, - SrcType, Statement, -}; use swc_common::{comments::Comment, Span}; use swc_ecma_ast::{Invalid, Module, ModuleItem, Program, Script}; use swc_ecma_visit::{Node, Visit, VisitWith}; +use swc_estree_ast::{ + BaseNode, File, InterpreterDirective, LineCol, Loc, ModuleDeclaration, Program as BabelProgram, + SrcType, Statement, +}; use swc_node_comments::SwcComments; impl Babelify for Program { diff --git a/crates/swc_babel_compat/src/babelify/module_decl.rs b/crates/swc_estree_compat/src/babelify/module_decl.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/module_decl.rs rename to crates/swc_estree_compat/src/babelify/module_decl.rs index 22b0f5372c9..3f2c36a1be1 100644 --- a/crates/swc_babel_compat/src/babelify/module_decl.rs +++ b/crates/swc_estree_compat/src/babelify/module_decl.rs @@ -1,7 +1,13 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; use serde::{Deserialize, Serialize}; -use swc_babel_ast::{ +use swc_ecma_ast::{ + DefaultDecl, ExportAll, ExportDecl, ExportDefaultDecl, ExportDefaultExpr, + ExportDefaultSpecifier, ExportNamedSpecifier, ExportNamespaceSpecifier, ExportSpecifier, Expr, + ImportDecl, ImportDefaultSpecifier, ImportNamedSpecifier, ImportSpecifier, + ImportStarAsSpecifier, Lit, ModuleDecl, NamedExport, ObjectLit, Prop, PropName, PropOrSpread, +}; +use swc_estree_ast::{ ExportAllDeclaration, ExportDefaultDeclType, ExportDefaultDeclaration, ExportDefaultSpecifier as BabelExportDefaultSpecifier, ExportKind, ExportNamedDeclaration, ExportNamespaceSpecifier as BabelExportNamespaceSpecifier, @@ -10,12 +16,6 @@ use swc_babel_ast::{ ImportNamespaceSpecifier, ImportSpecifier as BabelImportSpecifier, ImportSpecifierType, ModuleDeclaration, TSExportAssignment, TSImportEqualsDeclaration, TSNamespaceExportDeclaration, }; -use swc_ecma_ast::{ - DefaultDecl, ExportAll, ExportDecl, ExportDefaultDecl, ExportDefaultExpr, - ExportDefaultSpecifier, ExportNamedSpecifier, ExportNamespaceSpecifier, ExportSpecifier, Expr, - ImportDecl, ImportDefaultSpecifier, ImportNamedSpecifier, ImportSpecifier, - ImportStarAsSpecifier, Lit, ModuleDecl, NamedExport, ObjectLit, Prop, PropName, PropOrSpread, -}; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum ModuleDeclOutput { diff --git a/crates/swc_babel_compat/src/babelify/normalize/mod.rs b/crates/swc_estree_compat/src/babelify/normalize/mod.rs similarity index 98% rename from crates/swc_babel_compat/src/babelify/normalize/mod.rs rename to crates/swc_estree_compat/src/babelify/normalize/mod.rs index 448f24c21b8..c343b39acc9 100644 --- a/crates/swc_babel_compat/src/babelify/normalize/mod.rs +++ b/crates/swc_estree_compat/src/babelify/normalize/mod.rs @@ -1,6 +1,6 @@ use swc_atoms::js_word; -use swc_babel_ast::*; -use swc_babel_visit::{VisitMut, VisitMutWith}; +use swc_estree_ast::*; +use swc_estree_visit::{VisitMut, VisitMutWith}; struct Normalizer; diff --git a/crates/swc_babel_compat/src/babelify/operators.rs b/crates/swc_estree_compat/src/babelify/operators.rs similarity index 98% rename from crates/swc_babel_compat/src/babelify/operators.rs rename to crates/swc_estree_compat/src/babelify/operators.rs index 5d714083a12..928396fda91 100644 --- a/crates/swc_babel_compat/src/babelify/operators.rs +++ b/crates/swc_estree_compat/src/babelify/operators.rs @@ -1,5 +1,5 @@ use crate::babelify::{Babelify, Context}; -use swc_babel_ast::{BinaryExprOp, LogicalExprOp, UnaryExprOp, UpdateExprOp}; +use swc_estree_ast::{BinaryExprOp, LogicalExprOp, UnaryExprOp, UpdateExprOp}; use serde::{Deserialize, Serialize}; use swc_ecma_ast::{AssignOp, BinaryOp, UnaryOp, UpdateOp}; diff --git a/crates/swc_babel_compat/src/babelify/pat.rs b/crates/swc_estree_compat/src/babelify/pat.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/pat.rs rename to crates/swc_estree_compat/src/babelify/pat.rs index 67b01d91ba4..43408713f8c 100644 --- a/crates/swc_babel_compat/src/babelify/pat.rs +++ b/crates/swc_estree_compat/src/babelify/pat.rs @@ -1,15 +1,15 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; use serde::{Deserialize, Serialize}; -use swc_babel_ast::{ - ArrayPattern, AssignmentPattern, AssignmentPatternLeft, CatchClauseParam, Expression, - Identifier, LVal, ObjectKey, ObjectPattern, ObjectPatternProp, ObjectPropVal, ObjectProperty, - Param, Pattern, PatternLike, RestElement, -}; use swc_common::Spanned; use swc_ecma_ast::{ ArrayPat, AssignPat, AssignPatProp, KeyValuePatProp, ObjectPat, ObjectPatProp, Pat, RestPat, }; +use swc_estree_ast::{ + ArrayPattern, AssignmentPattern, AssignmentPatternLeft, CatchClauseParam, Expression, + Identifier, LVal, ObjectKey, ObjectPattern, ObjectPatternProp, ObjectPropVal, ObjectProperty, + Param, Pattern, PatternLike, RestElement, +}; #[derive(Debug, Clone, Serialize, Deserialize)] pub enum PatOutput { diff --git a/crates/swc_babel_compat/src/babelify/prop.rs b/crates/swc_estree_compat/src/babelify/prop.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/prop.rs rename to crates/swc_estree_compat/src/babelify/prop.rs index 98f2bdddaf5..485de1c06f9 100644 --- a/crates/swc_babel_compat/src/babelify/prop.rs +++ b/crates/swc_estree_compat/src/babelify/prop.rs @@ -1,13 +1,13 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; -use swc_babel_ast::{ - AssignmentPattern, AssignmentPatternLeft, Expression, FunctionExpression, ObjectKey, - ObjectMember, ObjectMethod, ObjectMethodKind, ObjectPropVal, ObjectProperty, -}; use swc_common::Spanned; use swc_ecma_ast::{ AssignProp, ComputedPropName, GetterProp, KeyValueProp, MethodProp, Prop, PropName, SetterProp, }; +use swc_estree_ast::{ + AssignmentPattern, AssignmentPatternLeft, Expression, FunctionExpression, ObjectKey, + ObjectMember, ObjectMethod, ObjectMethodKind, ObjectPropVal, ObjectProperty, +}; impl Babelify for Prop { type Output = ObjectMember; diff --git a/crates/swc_babel_compat/src/babelify/stmt.rs b/crates/swc_estree_compat/src/babelify/stmt.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/stmt.rs rename to crates/swc_estree_compat/src/babelify/stmt.rs index 87bc4340dde..6423ce1558a 100644 --- a/crates/swc_babel_compat/src/babelify/stmt.rs +++ b/crates/swc_estree_compat/src/babelify/stmt.rs @@ -1,17 +1,17 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; -use swc_babel_ast::{ +use swc_ecma_ast::{ + BlockStmt, BreakStmt, CatchClause, ContinueStmt, DebuggerStmt, Decl, DoWhileStmt, EmptyStmt, + ExprStmt, ForInStmt, ForOfStmt, ForStmt, IfStmt, LabeledStmt, ReturnStmt, Stmt, SwitchCase, + SwitchStmt, ThrowStmt, TryStmt, VarDeclOrExpr, VarDeclOrPat, WhileStmt, WithStmt, +}; +use swc_estree_ast::{ BlockStatement, BreakStatement, CatchClause as BabelCatchClause, ContinueStatement, DebuggerStatement, DoWhileStatement, EmptyStatement, ExpressionStatement, ForInStatement, ForOfStatement, ForStatement, ForStmtInit, ForStmtLeft, IfStatement, LabeledStatement, ReturnStatement, Statement, SwitchCase as BabelSwitchCase, SwitchStatement, ThrowStatement, TryStatement, WhileStatement, WithStatement, }; -use swc_ecma_ast::{ - BlockStmt, BreakStmt, CatchClause, ContinueStmt, DebuggerStmt, Decl, DoWhileStmt, EmptyStmt, - ExprStmt, ForInStmt, ForOfStmt, ForStmt, IfStmt, LabeledStmt, ReturnStmt, Stmt, SwitchCase, - SwitchStmt, ThrowStmt, TryStmt, VarDeclOrExpr, VarDeclOrPat, WhileStmt, WithStmt, -}; impl Babelify for BlockStmt { type Output = BlockStatement; diff --git a/crates/swc_babel_compat/src/babelify/typescript.rs b/crates/swc_estree_compat/src/babelify/typescript.rs similarity index 99% rename from crates/swc_babel_compat/src/babelify/typescript.rs rename to crates/swc_estree_compat/src/babelify/typescript.rs index 0de044a9f01..00b6016195f 100644 --- a/crates/swc_babel_compat/src/babelify/typescript.rs +++ b/crates/swc_estree_compat/src/babelify/typescript.rs @@ -1,7 +1,7 @@ use crate::babelify::{Babelify, Context}; use copyless::BoxHelper; use swc_atoms::{js_word, JsWord}; -use swc_babel_ast::{ +use swc_estree_ast::{ Access, ArrayPattern, IdOrRest, IdOrString, Identifier, ObjectPattern, RestElement, TSAnyKeyword, TSArrayType, TSAsExpression, TSBigIntKeyword, TSBooleanKeyword, TSCallSignatureDeclaration, TSConditionalType, TSConstructSignatureDeclaration, diff --git a/crates/swc_babel_compat/src/lib.rs b/crates/swc_estree_compat/src/lib.rs similarity index 100% rename from crates/swc_babel_compat/src/lib.rs rename to crates/swc_estree_compat/src/lib.rs diff --git a/crates/swc_babel_compat/src/swcify/class.rs b/crates/swc_estree_compat/src/swcify/class.rs similarity index 96% rename from crates/swc_babel_compat/src/swcify/class.rs rename to crates/swc_estree_compat/src/swcify/class.rs index 61e77809f8b..7c1fddcac0f 100644 --- a/crates/swc_babel_compat/src/swcify/class.rs +++ b/crates/swc_estree_compat/src/swcify/class.rs @@ -1,10 +1,10 @@ use super::Context; use crate::swcify::Swcify; -use swc_babel_ast::{ - ClassBody, ClassBodyEl, ClassImpl, ClassMethodKind, TSExpressionWithTypeArguments, -}; use swc_ecma_ast::{ClassMember, Function, MethodKind, ParamOrTsParamProp, TsExprWithTypeArgs}; use swc_ecma_utils::prop_name_to_expr; +use swc_estree_ast::{ + ClassBody, ClassBodyEl, ClassImpl, ClassMethodKind, TSExpressionWithTypeArguments, +}; impl Swcify for ClassBody { type Output = Vec; @@ -30,7 +30,7 @@ impl Swcify for ClassBodyEl { } } -impl Swcify for swc_babel_ast::ClassMethod { +impl Swcify for swc_estree_ast::ClassMethod { type Output = swc_ecma_ast::ClassMember; fn swcify(self, ctx: &Context) -> Self::Output { @@ -86,7 +86,7 @@ impl Swcify for swc_babel_ast::ClassMethod { } } -impl Swcify for swc_babel_ast::ClassPrivateMethod { +impl Swcify for swc_estree_ast::ClassPrivateMethod { type Output = swc_ecma_ast::PrivateMethod; fn swcify(self, ctx: &Context) -> Self::Output { @@ -120,7 +120,7 @@ impl Swcify for swc_babel_ast::ClassPrivateMethod { } } -impl Swcify for swc_babel_ast::ClassProperty { +impl Swcify for swc_estree_ast::ClassProperty { type Output = swc_ecma_ast::ClassProp; fn swcify(self, ctx: &Context) -> Self::Output { @@ -146,7 +146,7 @@ impl Swcify for swc_babel_ast::ClassProperty { } } -impl Swcify for swc_babel_ast::ClassPrivateProperty { +impl Swcify for swc_estree_ast::ClassPrivateProperty { type Output = swc_ecma_ast::PrivateProp; fn swcify(self, ctx: &Context) -> Self::Output { diff --git a/crates/swc_babel_compat/src/swcify/ctx.rs b/crates/swc_estree_compat/src/swcify/ctx.rs similarity index 97% rename from crates/swc_babel_compat/src/swcify/ctx.rs rename to crates/swc_estree_compat/src/swcify/ctx.rs index a5469d41300..cd8f6353013 100644 --- a/crates/swc_babel_compat/src/swcify/ctx.rs +++ b/crates/swc_estree_compat/src/swcify/ctx.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use swc_babel_ast::{BaseNode, LineCol, Loc}; use swc_common::{BytePos, FileName, SourceFile, SourceMap, Span, SyntaxContext, DUMMY_SP}; +use swc_estree_ast::{BaseNode, LineCol, Loc}; use swc_node_comments::SwcComments; pub struct Context { diff --git a/crates/swc_babel_compat/src/swcify/expr.rs b/crates/swc_estree_compat/src/swcify/expr.rs similarity index 95% rename from crates/swc_babel_compat/src/swcify/expr.rs rename to crates/swc_estree_compat/src/swcify/expr.rs index 96d0cb112e4..065556f4ac5 100644 --- a/crates/swc_babel_compat/src/swcify/expr.rs +++ b/crates/swc_estree_compat/src/swcify/expr.rs @@ -1,6 +1,16 @@ use crate::swcify::Swcify; use swc_atoms::js_word; -use swc_babel_ast::{ +use swc_common::{Spanned, DUMMY_SP}; +use swc_ecma_ast::{ + op, ArrayLit, ArrowExpr, AssignExpr, AwaitExpr, BinExpr, BinaryOp, BindingIdent, + BlockStmtOrExpr, CallExpr, ClassExpr, ComputedPropName, CondExpr, Expr, ExprOrSpread, + ExprOrSuper, FnExpr, Function, Ident, JSXAttr, JSXAttrOrSpread, JSXAttrValue, JSXEmptyExpr, + JSXExpr, JSXExprContainer, JSXMemberExpr, JSXObject, KeyValueProp, Lit, MemberExpr, + MetaPropExpr, MethodProp, NewExpr, ObjectLit, OptChainExpr, ParenExpr, PatOrExpr, Prop, + PropName, PropOrSpread, SeqExpr, SpreadElement, TaggedTpl, ThisExpr, TsAsExpr, TsNonNullExpr, + TsTypeAssertion, TsTypeParamInstantiation, UnaryExpr, UnaryOp, UpdateExpr, YieldExpr, +}; +use swc_estree_ast::{ Arg, ArrayExprEl, ArrayExpression, ArrowFuncExprBody, ArrowFunctionExpression, AssignmentExpression, AwaitExpression, BinaryExprLeft, BinaryExprOp, BinaryExpression, BindExpression, CallExpression, Callee, ClassExpression, ConditionalExpression, DoExpression, @@ -16,16 +26,6 @@ use swc_babel_ast::{ TypeCastExpression, UnaryExprOp, UnaryExpression, UpdateExprOp, UpdateExpression, YieldExpression, }; -use swc_common::{Spanned, DUMMY_SP}; -use swc_ecma_ast::{ - op, ArrayLit, ArrowExpr, AssignExpr, AwaitExpr, BinExpr, BinaryOp, BindingIdent, - BlockStmtOrExpr, CallExpr, ClassExpr, ComputedPropName, CondExpr, Expr, ExprOrSpread, - ExprOrSuper, FnExpr, Function, Ident, JSXAttr, JSXAttrOrSpread, JSXAttrValue, JSXEmptyExpr, - JSXExpr, JSXExprContainer, JSXMemberExpr, JSXObject, KeyValueProp, Lit, MemberExpr, - MetaPropExpr, MethodProp, NewExpr, ObjectLit, OptChainExpr, ParenExpr, PatOrExpr, Prop, - PropName, PropOrSpread, SeqExpr, SpreadElement, TaggedTpl, ThisExpr, TsAsExpr, TsNonNullExpr, - TsTypeAssertion, TsTypeParamInstantiation, UnaryExpr, UnaryOp, UpdateExpr, YieldExpr, -}; use super::Context; @@ -122,7 +122,7 @@ impl Swcify for BinaryExpression { } } -impl Swcify for swc_babel_ast::PrivateName { +impl Swcify for swc_estree_ast::PrivateName { type Output = swc_ecma_ast::PrivateName; fn swcify(self, ctx: &Context) -> Self::Output { @@ -398,7 +398,7 @@ impl Swcify for NewExpression { self.arguments .swcify(ctx) .into_iter() - .map(|v| v.expect("failed to swcify arguemnts")) + .map(|v| v.expect("failed to swcify arguments")) .collect(), ), type_args: self.type_parameters.swcify(ctx), @@ -453,7 +453,7 @@ impl Swcify for ObjectMethod { } } -impl Swcify for swc_babel_ast::Decorator { +impl Swcify for swc_estree_ast::Decorator { type Output = swc_ecma_ast::Decorator; fn swcify(self, ctx: &Context) -> Self::Output { @@ -657,7 +657,7 @@ impl Swcify for MetaProperty { } } -impl Swcify for swc_babel_ast::Super { +impl Swcify for swc_estree_ast::Super { type Output = swc_ecma_ast::Super; fn swcify(self, ctx: &Context) -> Self::Output { @@ -783,7 +783,7 @@ impl Swcify for TypeCastExpression { } } -impl Swcify for swc_babel_ast::JSXElement { +impl Swcify for swc_estree_ast::JSXElement { type Output = swc_ecma_ast::JSXElement; fn swcify(self, ctx: &Context) -> Self::Output { @@ -796,7 +796,7 @@ impl Swcify for swc_babel_ast::JSXElement { } } -impl Swcify for swc_babel_ast::JSXOpeningElement { +impl Swcify for swc_estree_ast::JSXOpeningElement { type Output = swc_ecma_ast::JSXOpeningElement; fn swcify(self, ctx: &Context) -> Self::Output { @@ -810,18 +810,18 @@ impl Swcify for swc_babel_ast::JSXOpeningElement { } } -impl Swcify for swc_babel_ast::JSXElementName { +impl Swcify for swc_estree_ast::JSXElementName { type Output = swc_ecma_ast::JSXElementName; fn swcify(self, ctx: &Context) -> Self::Output { match self { - swc_babel_ast::JSXElementName::Id(v) => { + swc_estree_ast::JSXElementName::Id(v) => { swc_ecma_ast::JSXElementName::Ident(v.swcify(ctx)) } - swc_babel_ast::JSXElementName::Expr(v) => { + swc_estree_ast::JSXElementName::Expr(v) => { swc_ecma_ast::JSXElementName::JSXMemberExpr(v.swcify(ctx)) } - swc_babel_ast::JSXElementName::Name(v) => { + swc_estree_ast::JSXElementName::Name(v) => { swc_ecma_ast::JSXElementName::JSXNamespacedName(v.swcify(ctx)) } } @@ -850,13 +850,13 @@ impl Swcify for JSXMemberExprObject { } } -impl Swcify for swc_babel_ast::JSXOpeningElAttr { +impl Swcify for swc_estree_ast::JSXOpeningElAttr { type Output = JSXAttrOrSpread; fn swcify(self, ctx: &Context) -> Self::Output { match self { - swc_babel_ast::JSXOpeningElAttr::Attr(v) => JSXAttrOrSpread::JSXAttr(v.swcify(ctx)), - swc_babel_ast::JSXOpeningElAttr::Spread(v) => { + swc_estree_ast::JSXOpeningElAttr::Attr(v) => JSXAttrOrSpread::JSXAttr(v.swcify(ctx)), + swc_estree_ast::JSXOpeningElAttr::Spread(v) => { JSXAttrOrSpread::SpreadElement(v.swcify(ctx)) } } @@ -875,13 +875,13 @@ impl Swcify for JSXAttribute { } } -impl Swcify for swc_babel_ast::JSXAttrName { +impl Swcify for swc_estree_ast::JSXAttrName { type Output = swc_ecma_ast::JSXAttrName; fn swcify(self, ctx: &Context) -> Self::Output { match self { - swc_babel_ast::JSXAttrName::Id(v) => swc_ecma_ast::JSXAttrName::Ident(v.swcify(ctx)), - swc_babel_ast::JSXAttrName::Name(v) => { + swc_estree_ast::JSXAttrName::Id(v) => swc_ecma_ast::JSXAttrName::Ident(v.swcify(ctx)), + swc_estree_ast::JSXAttrName::Name(v) => { swc_ecma_ast::JSXAttrName::JSXNamespacedName(v.swcify(ctx)) } } @@ -944,31 +944,31 @@ impl Swcify for JSXSpreadAttribute { } } -impl Swcify for swc_babel_ast::JSXElementChild { +impl Swcify for swc_estree_ast::JSXElementChild { type Output = swc_ecma_ast::JSXElementChild; fn swcify(self, ctx: &Context) -> Self::Output { match self { - swc_babel_ast::JSXElementChild::Text(v) => { + swc_estree_ast::JSXElementChild::Text(v) => { swc_ecma_ast::JSXElementChild::JSXText(v.swcify(ctx)) } - swc_babel_ast::JSXElementChild::Expr(v) => { + swc_estree_ast::JSXElementChild::Expr(v) => { swc_ecma_ast::JSXElementChild::from(v.swcify(ctx)) } - swc_babel_ast::JSXElementChild::Spread(v) => { + swc_estree_ast::JSXElementChild::Spread(v) => { swc_ecma_ast::JSXElementChild::from(v.swcify(ctx)) } - swc_babel_ast::JSXElementChild::Element(v) => { + swc_estree_ast::JSXElementChild::Element(v) => { swc_ecma_ast::JSXElementChild::from(Box::new(v.swcify(ctx))) } - swc_babel_ast::JSXElementChild::Fragment(v) => { + swc_estree_ast::JSXElementChild::Fragment(v) => { swc_ecma_ast::JSXElementChild::from(v.swcify(ctx)) } } } } -impl Swcify for swc_babel_ast::JSXText { +impl Swcify for swc_estree_ast::JSXText { type Output = swc_ecma_ast::JSXText; fn swcify(self, ctx: &Context) -> Self::Output { @@ -980,7 +980,7 @@ impl Swcify for swc_babel_ast::JSXText { } } -impl Swcify for swc_babel_ast::JSXSpreadChild { +impl Swcify for swc_estree_ast::JSXSpreadChild { type Output = swc_ecma_ast::JSXSpreadChild; fn swcify(self, ctx: &Context) -> Self::Output { @@ -991,7 +991,7 @@ impl Swcify for swc_babel_ast::JSXSpreadChild { } } -impl Swcify for swc_babel_ast::JSXClosingElement { +impl Swcify for swc_estree_ast::JSXClosingElement { type Output = swc_ecma_ast::JSXClosingElement; fn swcify(self, ctx: &Context) -> Self::Output { @@ -1002,7 +1002,7 @@ impl Swcify for swc_babel_ast::JSXClosingElement { } } -impl Swcify for swc_babel_ast::JSXFragment { +impl Swcify for swc_estree_ast::JSXFragment { type Output = swc_ecma_ast::JSXFragment; fn swcify(self, ctx: &Context) -> Self::Output { @@ -1015,7 +1015,7 @@ impl Swcify for swc_babel_ast::JSXFragment { } } -impl Swcify for swc_babel_ast::JSXOpeningFragment { +impl Swcify for swc_estree_ast::JSXOpeningFragment { type Output = swc_ecma_ast::JSXOpeningFragment; fn swcify(self, ctx: &Context) -> Self::Output { @@ -1025,7 +1025,7 @@ impl Swcify for swc_babel_ast::JSXOpeningFragment { } } -impl Swcify for swc_babel_ast::JSXClosingFragment { +impl Swcify for swc_estree_ast::JSXClosingFragment { type Output = swc_ecma_ast::JSXClosingFragment; fn swcify(self, ctx: &Context) -> Self::Output { diff --git a/crates/swc_babel_compat/src/swcify/jsx.rs b/crates/swc_estree_compat/src/swcify/jsx.rs similarity index 84% rename from crates/swc_babel_compat/src/swcify/jsx.rs rename to crates/swc_estree_compat/src/swcify/jsx.rs index f89bdab87db..28ebac9904e 100644 --- a/crates/swc_babel_compat/src/swcify/jsx.rs +++ b/crates/swc_estree_compat/src/swcify/jsx.rs @@ -1,7 +1,7 @@ use crate::swcify::{Context, Swcify}; use swc_ecma_ast::Ident; -impl Swcify for swc_babel_ast::JSXNamespacedName { +impl Swcify for swc_estree_ast::JSXNamespacedName { type Output = swc_ecma_ast::JSXNamespacedName; fn swcify(self, ctx: &Context) -> Self::Output { @@ -12,7 +12,7 @@ impl Swcify for swc_babel_ast::JSXNamespacedName { } } -impl Swcify for swc_babel_ast::JSXIdentifier { +impl Swcify for swc_estree_ast::JSXIdentifier { type Output = Ident; fn swcify(self, ctx: &Context) -> Self::Output { diff --git a/crates/swc_babel_compat/src/swcify/lit.rs b/crates/swc_estree_compat/src/swcify/lit.rs similarity index 99% rename from crates/swc_babel_compat/src/swcify/lit.rs rename to crates/swc_estree_compat/src/swcify/lit.rs index 1ed590af488..eb68365322a 100644 --- a/crates/swc_babel_compat/src/swcify/lit.rs +++ b/crates/swc_estree_compat/src/swcify/lit.rs @@ -1,12 +1,12 @@ use super::Context; use crate::swcify::Swcify; -use swc_babel_ast::{ +use swc_common::DUMMY_SP; +use swc_ecma_ast::{BigInt, Bool, Expr, Lit, Null, Number, Regex, Str, Tpl, TplElement}; +use swc_estree_ast::{ BigIntLiteral, BooleanLiteral, DecimalLiteral, Literal, NullLiteral, NumberLiteral, NumericLiteral, RegExpLiteral, StringLiteral, TemplateElement, TemplateLiteral, TemplateLiteralExpr, }; -use swc_common::DUMMY_SP; -use swc_ecma_ast::{BigInt, Bool, Expr, Lit, Null, Number, Regex, Str, Tpl, TplElement}; impl Swcify for Literal { type Output = Lit; diff --git a/crates/swc_babel_compat/src/swcify/mod.rs b/crates/swc_estree_compat/src/swcify/mod.rs similarity index 100% rename from crates/swc_babel_compat/src/swcify/mod.rs rename to crates/swc_estree_compat/src/swcify/mod.rs diff --git a/crates/swc_babel_compat/src/swcify/pat.rs b/crates/swc_estree_compat/src/swcify/pat.rs similarity index 83% rename from crates/swc_babel_compat/src/swcify/pat.rs rename to crates/swc_estree_compat/src/swcify/pat.rs index a8e541829d7..cc713c42f9d 100644 --- a/crates/swc_babel_compat/src/swcify/pat.rs +++ b/crates/swc_estree_compat/src/swcify/pat.rs @@ -1,10 +1,10 @@ use crate::swcify::{Context, Swcify}; -use swc_babel_ast::{ +use swc_common::Spanned; +use swc_ecma_ast::*; +use swc_estree_ast::{ ArrayPattern, AssignmentPattern, AssignmentPatternLeft, LVal, ObjectPattern, ObjectPatternProp, PatternLike, RestElement, }; -use swc_common::Spanned; -use swc_ecma_ast::*; impl Swcify for LVal { type Output = Pat; @@ -119,41 +119,43 @@ impl Swcify for ObjectPatternProp { } match prop.value { - swc_babel_ast::ObjectPropVal::Pattern(v) => { + swc_estree_ast::ObjectPropVal::Pattern(v) => { ObjectPatProp::KeyValue(KeyValuePatProp { key: prop.key.swcify(ctx), value: Box::new(v.swcify(ctx)), }) } - swc_babel_ast::ObjectPropVal::Expr(v) => ObjectPatProp::Assign(AssignPatProp { - span: ctx.span(&prop.base), - key: prop.key.swcify(ctx).expect_ident(), - value: Some(v.swcify(ctx)), - }), + swc_estree_ast::ObjectPropVal::Expr(v) => { + ObjectPatProp::Assign(AssignPatProp { + span: ctx.span(&prop.base), + key: prop.key.swcify(ctx).expect_ident(), + value: Some(v.swcify(ctx)), + }) + } } } } } } -impl Swcify for swc_babel_ast::Pattern { +impl Swcify for swc_estree_ast::Pattern { type Output = Pat; fn swcify(self, ctx: &Context) -> Self::Output { match self { - swc_babel_ast::Pattern::Assignment(v) => Pat::from(v.swcify(ctx)), - swc_babel_ast::Pattern::Array(v) => Pat::from(v.swcify(ctx)), - swc_babel_ast::Pattern::Object(v) => Pat::from(v.swcify(ctx)), + swc_estree_ast::Pattern::Assignment(v) => Pat::from(v.swcify(ctx)), + swc_estree_ast::Pattern::Array(v) => Pat::from(v.swcify(ctx)), + swc_estree_ast::Pattern::Object(v) => Pat::from(v.swcify(ctx)), } } } -impl Swcify for swc_babel_ast::Param { +impl Swcify for swc_estree_ast::Param { type Output = swc_ecma_ast::Param; fn swcify(self, ctx: &Context) -> Self::Output { match self { - swc_babel_ast::Param::Id(v) => { + swc_estree_ast::Param::Id(v) => { let pat = v.swcify(ctx); swc_ecma_ast::Param { @@ -162,7 +164,7 @@ impl Swcify for swc_babel_ast::Param { pat: pat.into(), } } - swc_babel_ast::Param::Pat(v) => { + swc_estree_ast::Param::Pat(v) => { let pat = v.swcify(ctx); swc_ecma_ast::Param { @@ -171,12 +173,12 @@ impl Swcify for swc_babel_ast::Param { pat, } } - swc_babel_ast::Param::Rest(v) => swc_ecma_ast::Param { + swc_estree_ast::Param::Rest(v) => swc_ecma_ast::Param { span: ctx.span(&v.base), decorators: v.decorators.swcify(ctx).unwrap_or_default(), pat: Pat::from(v.argument.swcify(ctx)), }, - swc_babel_ast::Param::TSProp(..) => todo!(), + swc_estree_ast::Param::TSProp(..) => todo!(), } } } diff --git a/crates/swc_babel_compat/src/swcify/program.rs b/crates/swc_estree_compat/src/swcify/program.rs similarity index 100% rename from crates/swc_babel_compat/src/swcify/program.rs rename to crates/swc_estree_compat/src/swcify/program.rs diff --git a/crates/swc_babel_compat/src/swcify/stmt.rs b/crates/swc_estree_compat/src/swcify/stmt.rs similarity index 96% rename from crates/swc_babel_compat/src/swcify/stmt.rs rename to crates/swc_estree_compat/src/swcify/stmt.rs index 24ec8e4550f..ed307ddb058 100644 --- a/crates/swc_babel_compat/src/swcify/stmt.rs +++ b/crates/swc_estree_compat/src/swcify/stmt.rs @@ -1,17 +1,5 @@ use super::Context; use crate::swcify::Swcify; -use swc_babel_ast::{ - BlockStatement, BreakStatement, ClassDeclaration, ContinueStatement, DebuggerStatement, - DeclareClass, DeclareExportAllDeclaration, DeclareExportDeclaration, DeclareFunction, - DeclareInterface, DeclareModule, DeclareModuleExports, DeclareTypeAlias, DeclareVariable, - DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclType, - ExportDefaultDeclaration, ExportKind, ExportNamedDeclaration, ExpressionStatement, - ForInStatement, ForOfStatement, ForStatement, ForStmtInit, ForStmtLeft, FunctionDeclaration, - IdOrString, IfStatement, ImportAttribute, ImportDeclaration, ImportKind, - ImportNamespaceSpecifier, ImportSpecifierType, LabeledStatement, ReturnStatement, Statement, - SwitchStatement, ThrowStatement, TryStatement, VariableDeclaration, VariableDeclarationKind, - VariableDeclarator, WhileStatement, WithStatement, -}; use swc_common::DUMMY_SP; use swc_ecma_ast::{ BlockStmt, BreakStmt, ClassDecl, ClassExpr, ContinueStmt, DebuggerStmt, Decl, DefaultDecl, @@ -23,6 +11,18 @@ use swc_ecma_ast::{ TsInterfaceDecl, TsModuleDecl, TsTypeAliasDecl, VarDecl, VarDeclKind, VarDeclOrExpr, VarDeclOrPat, VarDeclarator, WhileStmt, WithStmt, }; +use swc_estree_ast::{ + BlockStatement, BreakStatement, ClassDeclaration, ContinueStatement, DebuggerStatement, + DeclareClass, DeclareExportAllDeclaration, DeclareExportDeclaration, DeclareFunction, + DeclareInterface, DeclareModule, DeclareModuleExports, DeclareTypeAlias, DeclareVariable, + DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDefaultDeclType, + ExportDefaultDeclaration, ExportKind, ExportNamedDeclaration, ExpressionStatement, + ForInStatement, ForOfStatement, ForStatement, ForStmtInit, ForStmtLeft, FunctionDeclaration, + IdOrString, IfStatement, ImportAttribute, ImportDeclaration, ImportKind, + ImportNamespaceSpecifier, ImportSpecifierType, LabeledStatement, ReturnStatement, Statement, + SwitchStatement, ThrowStatement, TryStatement, VariableDeclaration, VariableDeclarationKind, + VariableDeclarator, WhileStatement, WithStatement, +}; impl Swcify for BlockStatement { type Output = BlockStmt; @@ -287,7 +287,7 @@ impl Swcify for SwitchStatement { } } -impl Swcify for swc_babel_ast::SwitchCase { +impl Swcify for swc_estree_ast::SwitchCase { type Output = swc_ecma_ast::SwitchCase; fn swcify(self, ctx: &Context) -> Self::Output { @@ -328,7 +328,7 @@ impl Swcify for TryStatement { } } -impl Swcify for swc_babel_ast::CatchClause { +impl Swcify for swc_estree_ast::CatchClause { type Output = swc_ecma_ast::CatchClause; fn swcify(self, ctx: &Context) -> Self::Output { @@ -340,14 +340,14 @@ impl Swcify for swc_babel_ast::CatchClause { } } -impl Swcify for swc_babel_ast::CatchClauseParam { +impl Swcify for swc_estree_ast::CatchClauseParam { type Output = Pat; fn swcify(self, ctx: &Context) -> Self::Output { match self { - swc_babel_ast::CatchClauseParam::Id(v) => Pat::from(v.swcify(ctx)), - swc_babel_ast::CatchClauseParam::Array(v) => Pat::from(v.swcify(ctx)), - swc_babel_ast::CatchClauseParam::Object(v) => Pat::from(v.swcify(ctx)), + swc_estree_ast::CatchClauseParam::Id(v) => Pat::from(v.swcify(ctx)), + swc_estree_ast::CatchClauseParam::Array(v) => Pat::from(v.swcify(ctx)), + swc_estree_ast::CatchClauseParam::Object(v) => Pat::from(v.swcify(ctx)), } } } @@ -542,25 +542,25 @@ impl Swcify for ExportNamedDeclaration { } } -impl Swcify for swc_babel_ast::ExportSpecifierType { +impl Swcify for swc_estree_ast::ExportSpecifierType { type Output = swc_ecma_ast::ExportSpecifier; fn swcify(self, ctx: &Context) -> Self::Output { match self { - swc_babel_ast::ExportSpecifierType::Export(v) => { + swc_estree_ast::ExportSpecifierType::Export(v) => { swc_ecma_ast::ExportSpecifier::from(v.swcify(ctx)) } - swc_babel_ast::ExportSpecifierType::Default(v) => { + swc_estree_ast::ExportSpecifierType::Default(v) => { swc_ecma_ast::ExportSpecifier::from(v.swcify(ctx)) } - swc_babel_ast::ExportSpecifierType::Namespace(v) => { + swc_estree_ast::ExportSpecifierType::Namespace(v) => { swc_ecma_ast::ExportSpecifier::from(v.swcify(ctx)) } } } } -impl Swcify for swc_babel_ast::ExportSpecifier { +impl Swcify for swc_estree_ast::ExportSpecifier { type Output = ExportNamedSpecifier; fn swcify(self, ctx: &Context) -> Self::Output { @@ -573,7 +573,7 @@ impl Swcify for swc_babel_ast::ExportSpecifier { } } -impl Swcify for swc_babel_ast::ExportDefaultSpecifier { +impl Swcify for swc_estree_ast::ExportDefaultSpecifier { type Output = swc_ecma_ast::ExportDefaultSpecifier; fn swcify(self, ctx: &Context) -> Self::Output { @@ -583,7 +583,7 @@ impl Swcify for swc_babel_ast::ExportDefaultSpecifier { } } -impl Swcify for swc_babel_ast::ExportNamespaceSpecifier { +impl Swcify for swc_estree_ast::ExportNamespaceSpecifier { type Output = swc_ecma_ast::ExportNamespaceSpecifier; fn swcify(self, ctx: &Context) -> Self::Output { @@ -648,7 +648,7 @@ impl Swcify for ImportSpecifierType { } } -impl Swcify for swc_babel_ast::ImportSpecifier { +impl Swcify for swc_estree_ast::ImportSpecifier { type Output = ImportNamedSpecifier; fn swcify(self, ctx: &Context) -> Self::Output { @@ -661,7 +661,7 @@ impl Swcify for swc_babel_ast::ImportSpecifier { } } -impl Swcify for swc_babel_ast::ImportDefaultSpecifier { +impl Swcify for swc_estree_ast::ImportDefaultSpecifier { type Output = swc_ecma_ast::ImportDefaultSpecifier; fn swcify(self, ctx: &Context) -> Self::Output { diff --git a/crates/swc_babel_compat/src/swcify/typescript.rs b/crates/swc_estree_compat/src/swcify/typescript.rs similarity index 99% rename from crates/swc_babel_compat/src/swcify/typescript.rs rename to crates/swc_estree_compat/src/swcify/typescript.rs index 4fd819b6f48..aa65ea0c3ea 100644 --- a/crates/swc_babel_compat/src/swcify/typescript.rs +++ b/crates/swc_estree_compat/src/swcify/typescript.rs @@ -1,14 +1,14 @@ use super::Context; use crate::swcify::Swcify; -use swc_babel_ast::{ - Access, FlowType, SuperTypeParams, TSEntityName, TSQualifiedName, TSType, TSTypeAnnotation, - TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TypeAnnotOrNoop, - TypeParamDeclOrNoop, -}; use swc_ecma_ast::{ Accessibility, Ident, TsEntityName, TsQualifiedName, TsType, TsTypeAnn, TsTypeParam, TsTypeParamDecl, TsTypeParamInstantiation, }; +use swc_estree_ast::{ + Access, FlowType, SuperTypeParams, TSEntityName, TSQualifiedName, TSType, TSTypeAnnotation, + TSTypeParameter, TSTypeParameterDeclaration, TSTypeParameterInstantiation, TypeAnnotOrNoop, + TypeParamDeclOrNoop, +}; impl Swcify for TSTypeParameterInstantiation { type Output = TsTypeParamInstantiation; diff --git a/crates/swc_babel_compat/tests/README.md b/crates/swc_estree_compat/tests/README.md similarity index 100% rename from crates/swc_babel_compat/tests/README.md rename to crates/swc_estree_compat/tests/README.md diff --git a/crates/swc_babel_compat/tests/babelgen.js b/crates/swc_estree_compat/tests/babelgen.js similarity index 100% rename from crates/swc_babel_compat/tests/babelgen.js rename to crates/swc_estree_compat/tests/babelgen.js diff --git a/crates/swc_babel_compat/tests/compare.sh b/crates/swc_estree_compat/tests/compare.sh similarity index 100% rename from crates/swc_babel_compat/tests/compare.sh rename to crates/swc_estree_compat/tests/compare.sh diff --git a/crates/swc_babel_compat/tests/convert.rs b/crates/swc_estree_compat/tests/convert.rs similarity index 97% rename from crates/swc_babel_compat/tests/convert.rs rename to crates/swc_estree_compat/tests/convert.rs index 101a43a5f01..305edc95b5d 100644 --- a/crates/swc_babel_compat/tests/convert.rs +++ b/crates/swc_estree_compat/tests/convert.rs @@ -10,13 +10,13 @@ use std::{ sync::Arc, }; use swc::{config::IsModule, Compiler}; -use swc_babel_ast::File; -use swc_babel_compat::babelify::{normalize::normalize, Babelify, Context}; use swc_common::{ errors::{ColorConfig, Handler}, FileName, FilePathMapping, SourceMap, }; use swc_ecma_parser::{EsConfig, Syntax}; +use swc_estree_ast::File; +use swc_estree_compat::babelify::{normalize::normalize, Babelify, Context}; use test::{test_main, DynTestFn, ShouldPanic, TestDesc, TestDescAndFn, TestName, TestType}; use walkdir::WalkDir; @@ -148,7 +148,7 @@ fn run_test(src: String, expected: String, syntax: Syntax, is_module: bool) { }; let mut ast = swc_ast.babelify(&ctx); normalize(&mut ast); - println!("Actaul: {:?}", ast); + println!("Actual: {:?}", ast); let mut expected_ast: File = serde_json::from_str(&expected).unwrap(); normalize(&mut expected_ast); diff --git a/crates/swc_babel_compat/tests/fixtures/array-destructuring/input.js b/crates/swc_estree_compat/tests/fixtures/array-destructuring/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/array-destructuring/input.js rename to crates/swc_estree_compat/tests/fixtures/array-destructuring/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/array-destructuring/output.json b/crates/swc_estree_compat/tests/fixtures/array-destructuring/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/array-destructuring/output.json rename to crates/swc_estree_compat/tests/fixtures/array-destructuring/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/array-simple/input.js b/crates/swc_estree_compat/tests/fixtures/array-simple/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/array-simple/input.js rename to crates/swc_estree_compat/tests/fixtures/array-simple/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/array-simple/output.json b/crates/swc_estree_compat/tests/fixtures/array-simple/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/array-simple/output.json rename to crates/swc_estree_compat/tests/fixtures/array-simple/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/class-extends/input.js b/crates/swc_estree_compat/tests/fixtures/class-extends/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-extends/input.js rename to crates/swc_estree_compat/tests/fixtures/class-extends/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/class-extends/output.json b/crates/swc_estree_compat/tests/fixtures/class-extends/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-extends/output.json rename to crates/swc_estree_compat/tests/fixtures/class-extends/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/class-getter-setter/input.js b/crates/swc_estree_compat/tests/fixtures/class-getter-setter/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-getter-setter/input.js rename to crates/swc_estree_compat/tests/fixtures/class-getter-setter/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/class-getter-setter/output.json b/crates/swc_estree_compat/tests/fixtures/class-getter-setter/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-getter-setter/output.json rename to crates/swc_estree_compat/tests/fixtures/class-getter-setter/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/class-method-no-body/input.js b/crates/swc_estree_compat/tests/fixtures/class-method-no-body/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-method-no-body/input.js rename to crates/swc_estree_compat/tests/fixtures/class-method-no-body/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/class-method-no-body/output.json b/crates/swc_estree_compat/tests/fixtures/class-method-no-body/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-method-no-body/output.json rename to crates/swc_estree_compat/tests/fixtures/class-method-no-body/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/class-public-fields/input.js b/crates/swc_estree_compat/tests/fixtures/class-public-fields/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-public-fields/input.js rename to crates/swc_estree_compat/tests/fixtures/class-public-fields/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/class-public-fields/output.json b/crates/swc_estree_compat/tests/fixtures/class-public-fields/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-public-fields/output.json rename to crates/swc_estree_compat/tests/fixtures/class-public-fields/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/class-simple/input.js b/crates/swc_estree_compat/tests/fixtures/class-simple/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-simple/input.js rename to crates/swc_estree_compat/tests/fixtures/class-simple/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/class-simple/output.json b/crates/swc_estree_compat/tests/fixtures/class-simple/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-simple/output.json rename to crates/swc_estree_compat/tests/fixtures/class-simple/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/class-static/input.js b/crates/swc_estree_compat/tests/fixtures/class-static/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-static/input.js rename to crates/swc_estree_compat/tests/fixtures/class-static/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/class-static/output.json b/crates/swc_estree_compat/tests/fixtures/class-static/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-static/output.json rename to crates/swc_estree_compat/tests/fixtures/class-static/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/class-unnamed/input.js b/crates/swc_estree_compat/tests/fixtures/class-unnamed/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-unnamed/input.js rename to crates/swc_estree_compat/tests/fixtures/class-unnamed/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/class-unnamed/output.json b/crates/swc_estree_compat/tests/fixtures/class-unnamed/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/class-unnamed/output.json rename to crates/swc_estree_compat/tests/fixtures/class-unnamed/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/comments-block-first-line/input.js b/crates/swc_estree_compat/tests/fixtures/comments-block-first-line/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/comments-block-first-line/input.js rename to crates/swc_estree_compat/tests/fixtures/comments-block-first-line/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/comments-block-first-line/output.json b/crates/swc_estree_compat/tests/fixtures/comments-block-first-line/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/comments-block-first-line/output.json rename to crates/swc_estree_compat/tests/fixtures/comments-block-first-line/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/comments-block/input.js b/crates/swc_estree_compat/tests/fixtures/comments-block/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/comments-block/input.js rename to crates/swc_estree_compat/tests/fixtures/comments-block/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/comments-block/output.json b/crates/swc_estree_compat/tests/fixtures/comments-block/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/comments-block/output.json rename to crates/swc_estree_compat/tests/fixtures/comments-block/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/comments-first-line/input.js b/crates/swc_estree_compat/tests/fixtures/comments-first-line/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/comments-first-line/input.js rename to crates/swc_estree_compat/tests/fixtures/comments-first-line/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/comments-first-line/output.json b/crates/swc_estree_compat/tests/fixtures/comments-first-line/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/comments-first-line/output.json rename to crates/swc_estree_compat/tests/fixtures/comments-first-line/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/comments-line/input.js b/crates/swc_estree_compat/tests/fixtures/comments-line/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/comments-line/input.js rename to crates/swc_estree_compat/tests/fixtures/comments-line/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/comments-line/output.json b/crates/swc_estree_compat/tests/fixtures/comments-line/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/comments-line/output.json rename to crates/swc_estree_compat/tests/fixtures/comments-line/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/delete-operator/input.js b/crates/swc_estree_compat/tests/fixtures/delete-operator/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/delete-operator/input.js rename to crates/swc_estree_compat/tests/fixtures/delete-operator/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/delete-operator/output.json b/crates/swc_estree_compat/tests/fixtures/delete-operator/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/delete-operator/output.json rename to crates/swc_estree_compat/tests/fixtures/delete-operator/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/exponentiation-operator/input.js b/crates/swc_estree_compat/tests/fixtures/exponentiation-operator/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/exponentiation-operator/input.js rename to crates/swc_estree_compat/tests/fixtures/exponentiation-operator/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/exponentiation-operator/output.json b/crates/swc_estree_compat/tests/fixtures/exponentiation-operator/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/exponentiation-operator/output.json rename to crates/swc_estree_compat/tests/fixtures/exponentiation-operator/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/function-anonymous/input.js b/crates/swc_estree_compat/tests/fixtures/function-anonymous/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-anonymous/input.js rename to crates/swc_estree_compat/tests/fixtures/function-anonymous/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/function-anonymous/output.json b/crates/swc_estree_compat/tests/fixtures/function-anonymous/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-anonymous/output.json rename to crates/swc_estree_compat/tests/fixtures/function-anonymous/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/function-arrow/input.js b/crates/swc_estree_compat/tests/fixtures/function-arrow/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-arrow/input.js rename to crates/swc_estree_compat/tests/fixtures/function-arrow/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/function-arrow/output.json b/crates/swc_estree_compat/tests/fixtures/function-arrow/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-arrow/output.json rename to crates/swc_estree_compat/tests/fixtures/function-arrow/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/function-default-parameters/input.js b/crates/swc_estree_compat/tests/fixtures/function-default-parameters/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-default-parameters/input.js rename to crates/swc_estree_compat/tests/fixtures/function-default-parameters/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/function-default-parameters/output.json b/crates/swc_estree_compat/tests/fixtures/function-default-parameters/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-default-parameters/output.json rename to crates/swc_estree_compat/tests/fixtures/function-default-parameters/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/function-rest-parameters/input.js b/crates/swc_estree_compat/tests/fixtures/function-rest-parameters/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-rest-parameters/input.js rename to crates/swc_estree_compat/tests/fixtures/function-rest-parameters/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/function-rest-parameters/output.json b/crates/swc_estree_compat/tests/fixtures/function-rest-parameters/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-rest-parameters/output.json rename to crates/swc_estree_compat/tests/fixtures/function-rest-parameters/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/function-simple/input.js b/crates/swc_estree_compat/tests/fixtures/function-simple/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-simple/input.js rename to crates/swc_estree_compat/tests/fixtures/function-simple/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/function-simple/output.json b/crates/swc_estree_compat/tests/fixtures/function-simple/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/function-simple/output.json rename to crates/swc_estree_compat/tests/fixtures/function-simple/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-and-expr/input.jsx b/crates/swc_estree_compat/tests/fixtures/jsx-and-expr/input.jsx similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-and-expr/input.jsx rename to crates/swc_estree_compat/tests/fixtures/jsx-and-expr/input.jsx diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-and-expr/output.json b/crates/swc_estree_compat/tests/fixtures/jsx-and-expr/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-and-expr/output.json rename to crates/swc_estree_compat/tests/fixtures/jsx-and-expr/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-children/input.jsx b/crates/swc_estree_compat/tests/fixtures/jsx-children/input.jsx similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-children/input.jsx rename to crates/swc_estree_compat/tests/fixtures/jsx-children/input.jsx diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-children/output.json b/crates/swc_estree_compat/tests/fixtures/jsx-children/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-children/output.json rename to crates/swc_estree_compat/tests/fixtures/jsx-children/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-map/input.jsx b/crates/swc_estree_compat/tests/fixtures/jsx-map/input.jsx similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-map/input.jsx rename to crates/swc_estree_compat/tests/fixtures/jsx-map/input.jsx diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-map/output.json b/crates/swc_estree_compat/tests/fixtures/jsx-map/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-map/output.json rename to crates/swc_estree_compat/tests/fixtures/jsx-map/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-props-spread/input.jsx b/crates/swc_estree_compat/tests/fixtures/jsx-props-spread/input.jsx similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-props-spread/input.jsx rename to crates/swc_estree_compat/tests/fixtures/jsx-props-spread/input.jsx diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-props-spread/output.json b/crates/swc_estree_compat/tests/fixtures/jsx-props-spread/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-props-spread/output.json rename to crates/swc_estree_compat/tests/fixtures/jsx-props-spread/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-props/input.jsx b/crates/swc_estree_compat/tests/fixtures/jsx-props/input.jsx similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-props/input.jsx rename to crates/swc_estree_compat/tests/fixtures/jsx-props/input.jsx diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-props/output.json b/crates/swc_estree_compat/tests/fixtures/jsx-props/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-props/output.json rename to crates/swc_estree_compat/tests/fixtures/jsx-props/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-self-closing/input.jsx b/crates/swc_estree_compat/tests/fixtures/jsx-self-closing/input.jsx similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-self-closing/input.jsx rename to crates/swc_estree_compat/tests/fixtures/jsx-self-closing/input.jsx diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-self-closing/output.json b/crates/swc_estree_compat/tests/fixtures/jsx-self-closing/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-self-closing/output.json rename to crates/swc_estree_compat/tests/fixtures/jsx-self-closing/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-simple/input.jsx b/crates/swc_estree_compat/tests/fixtures/jsx-simple/input.jsx similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-simple/input.jsx rename to crates/swc_estree_compat/tests/fixtures/jsx-simple/input.jsx diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-simple/output.json b/crates/swc_estree_compat/tests/fixtures/jsx-simple/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-simple/output.json rename to crates/swc_estree_compat/tests/fixtures/jsx-simple/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-ternary-expr/input.jsx b/crates/swc_estree_compat/tests/fixtures/jsx-ternary-expr/input.jsx similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-ternary-expr/input.jsx rename to crates/swc_estree_compat/tests/fixtures/jsx-ternary-expr/input.jsx diff --git a/crates/swc_babel_compat/tests/fixtures/jsx-ternary-expr/output.json b/crates/swc_estree_compat/tests/fixtures/jsx-ternary-expr/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/jsx-ternary-expr/output.json rename to crates/swc_estree_compat/tests/fixtures/jsx-ternary-expr/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-commonjs/input.js b/crates/swc_estree_compat/tests/fixtures/module-commonjs/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-commonjs/input.js rename to crates/swc_estree_compat/tests/fixtures/module-commonjs/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/module-commonjs/output.json b/crates/swc_estree_compat/tests/fixtures/module-commonjs/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-commonjs/output.json rename to crates/swc_estree_compat/tests/fixtures/module-commonjs/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-export-default/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-export-default/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-export-default/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-export-default/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-export-default/output.json b/crates/swc_estree_compat/tests/fixtures/module-export-default/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-export-default/output.json rename to crates/swc_estree_compat/tests/fixtures/module-export-default/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-export-individual-items/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-export-individual-items/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-export-individual-items/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-export-individual-items/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-export-individual-items/output.json b/crates/swc_estree_compat/tests/fixtures/module-export-individual-items/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-export-individual-items/output.json rename to crates/swc_estree_compat/tests/fixtures/module-export-individual-items/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-export-named/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-export-named/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-export-named/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-export-named/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-export-named/output.json b/crates/swc_estree_compat/tests/fixtures/module-export-named/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-export-named/output.json rename to crates/swc_estree_compat/tests/fixtures/module-export-named/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-export-renamed/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-export-renamed/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-export-renamed/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-export-renamed/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-export-renamed/output.json b/crates/swc_estree_compat/tests/fixtures/module-export-renamed/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-export-renamed/output.json rename to crates/swc_estree_compat/tests/fixtures/module-export-renamed/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-default/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-import-default/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-default/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-import-default/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-default/output.json b/crates/swc_estree_compat/tests/fixtures/module-import-default/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-default/output.json rename to crates/swc_estree_compat/tests/fixtures/module-import-default/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-multiple/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-import-multiple/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-multiple/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-import-multiple/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-multiple/output.json b/crates/swc_estree_compat/tests/fixtures/module-import-multiple/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-multiple/output.json rename to crates/swc_estree_compat/tests/fixtures/module-import-multiple/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-named/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-import-named/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-named/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-import-named/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-named/output.json b/crates/swc_estree_compat/tests/fixtures/module-import-named/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-named/output.json rename to crates/swc_estree_compat/tests/fixtures/module-import-named/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-renamed/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-import-renamed/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-renamed/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-import-renamed/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-renamed/output.json b/crates/swc_estree_compat/tests/fixtures/module-import-renamed/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-renamed/output.json rename to crates/swc_estree_compat/tests/fixtures/module-import-renamed/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-star-renamed/input.mjs b/crates/swc_estree_compat/tests/fixtures/module-import-star-renamed/input.mjs similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-star-renamed/input.mjs rename to crates/swc_estree_compat/tests/fixtures/module-import-star-renamed/input.mjs diff --git a/crates/swc_babel_compat/tests/fixtures/module-import-star-renamed/output.json b/crates/swc_estree_compat/tests/fixtures/module-import-star-renamed/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/module-import-star-renamed/output.json rename to crates/swc_estree_compat/tests/fixtures/module-import-star-renamed/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/object-destructuring/input.js b/crates/swc_estree_compat/tests/fixtures/object-destructuring/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/object-destructuring/input.js rename to crates/swc_estree_compat/tests/fixtures/object-destructuring/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/object-destructuring/output.json b/crates/swc_estree_compat/tests/fixtures/object-destructuring/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/object-destructuring/output.json rename to crates/swc_estree_compat/tests/fixtures/object-destructuring/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/object-simple/input.js b/crates/swc_estree_compat/tests/fixtures/object-simple/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/object-simple/input.js rename to crates/swc_estree_compat/tests/fixtures/object-simple/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/object-simple/output.json b/crates/swc_estree_compat/tests/fixtures/object-simple/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/object-simple/output.json rename to crates/swc_estree_compat/tests/fixtures/object-simple/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/object-spread/input.js b/crates/swc_estree_compat/tests/fixtures/object-spread/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/object-spread/input.js rename to crates/swc_estree_compat/tests/fixtures/object-spread/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/object-spread/output.json b/crates/swc_estree_compat/tests/fixtures/object-spread/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/object-spread/output.json rename to crates/swc_estree_compat/tests/fixtures/object-spread/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/regex-flags/input.js b/crates/swc_estree_compat/tests/fixtures/regex-flags/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/regex-flags/input.js rename to crates/swc_estree_compat/tests/fixtures/regex-flags/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/regex-flags/output.json b/crates/swc_estree_compat/tests/fixtures/regex-flags/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/regex-flags/output.json rename to crates/swc_estree_compat/tests/fixtures/regex-flags/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/regex-simple/input.js b/crates/swc_estree_compat/tests/fixtures/regex-simple/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/regex-simple/input.js rename to crates/swc_estree_compat/tests/fixtures/regex-simple/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/regex-simple/output.json b/crates/swc_estree_compat/tests/fixtures/regex-simple/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/regex-simple/output.json rename to crates/swc_estree_compat/tests/fixtures/regex-simple/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/shebang/input.js b/crates/swc_estree_compat/tests/fixtures/shebang/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/shebang/input.js rename to crates/swc_estree_compat/tests/fixtures/shebang/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/shebang/output.json b/crates/swc_estree_compat/tests/fixtures/shebang/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/shebang/output.json rename to crates/swc_estree_compat/tests/fixtures/shebang/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/simple-two-lines/input.js b/crates/swc_estree_compat/tests/fixtures/simple-two-lines/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/simple-two-lines/input.js rename to crates/swc_estree_compat/tests/fixtures/simple-two-lines/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/simple-two-lines/output.json b/crates/swc_estree_compat/tests/fixtures/simple-two-lines/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/simple-two-lines/output.json rename to crates/swc_estree_compat/tests/fixtures/simple-two-lines/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/simple/input.js b/crates/swc_estree_compat/tests/fixtures/simple/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/simple/input.js rename to crates/swc_estree_compat/tests/fixtures/simple/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/simple/output.json b/crates/swc_estree_compat/tests/fixtures/simple/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/simple/output.json rename to crates/swc_estree_compat/tests/fixtures/simple/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/static-blocks/input.js b/crates/swc_estree_compat/tests/fixtures/static-blocks/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/static-blocks/input.js rename to crates/swc_estree_compat/tests/fixtures/static-blocks/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/static-blocks/output.json b/crates/swc_estree_compat/tests/fixtures/static-blocks/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/static-blocks/output.json rename to crates/swc_estree_compat/tests/fixtures/static-blocks/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/template-literal/input.js b/crates/swc_estree_compat/tests/fixtures/template-literal/input.js similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/template-literal/input.js rename to crates/swc_estree_compat/tests/fixtures/template-literal/input.js diff --git a/crates/swc_babel_compat/tests/fixtures/template-literal/output.json b/crates/swc_estree_compat/tests/fixtures/template-literal/output.json similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/template-literal/output.json rename to crates/swc_estree_compat/tests/fixtures/template-literal/output.json diff --git a/crates/swc_babel_compat/tests/fixtures/ts-function/input.ts b/crates/swc_estree_compat/tests/fixtures/ts-function/input.ts similarity index 100% rename from crates/swc_babel_compat/tests/fixtures/ts-function/input.ts rename to crates/swc_estree_compat/tests/fixtures/ts-function/input.ts diff --git a/crates/swc_babel_compat/tests/package.json b/crates/swc_estree_compat/tests/package.json similarity index 100% rename from crates/swc_babel_compat/tests/package.json rename to crates/swc_estree_compat/tests/package.json diff --git a/crates/swc_babel_compat/tests/swcgen.js b/crates/swc_estree_compat/tests/swcgen.js similarity index 100% rename from crates/swc_babel_compat/tests/swcgen.js rename to crates/swc_estree_compat/tests/swcgen.js diff --git a/crates/swc_estree_macros/Cargo.toml b/crates/swc_estree_macros/Cargo.toml new file mode 100644 index 00000000000..c81f049ae7d --- /dev/null +++ b/crates/swc_estree_macros/Cargo.toml @@ -0,0 +1,14 @@ +[package] +authors = ["강동윤 "] +description = "Utility for AST converters" +documentation = "https://rustdoc.swc.rs/swc_estree_macros/" +edition = "2018" +license = "Apache-2.0/MIT" +name = "swc_estree_macros" +repository = "https://github.com/swc-project/swc.git" +version = "0.1.0" + +[lib] +proc-macro = true + +[dependencies] diff --git a/crates/swc_estree_macros/src/lib.rs b/crates/swc_estree_macros/src/lib.rs new file mode 100644 index 00000000000..b8d7be179e8 --- /dev/null +++ b/crates/swc_estree_macros/src/lib.rs @@ -0,0 +1 @@ +extern crate proc_macro; diff --git a/crates/swc_estree_visit/Cargo.toml b/crates/swc_estree_visit/Cargo.toml new file mode 100644 index 00000000000..b29ec964aeb --- /dev/null +++ b/crates/swc_estree_visit/Cargo.toml @@ -0,0 +1,24 @@ +[package] +authors = ["강동윤 ", "Daniel Woznicki "] +description = "Visitor implementation for estree nodes" +documentation = "https://rustdoc.swc.rs/swc_estree_visit/" +edition = "2018" +license = "Apache-2.0/MIT" +name = "swc_estree_visit" +repository = "https://github.com/swc-project/swc.git" +version = "0.1.0" + +[package.metadata.docs.rs] +all-features = true + +[features] +flavor-acorn = ["swc_estree_ast/flavor-acorn"] +flavor-babel = ["swc_estree_ast/flavor-babel"] + +[dependencies] +serde = {version = "1", features = ["derive"]} +serde_json = "1.0.62" +swc_atoms = {version = "0.2", path = "../swc_atoms"} +swc_estree_ast = {version = "0.1", path = "../swc_estree_ast"} +swc_estree_macros = {version = "0.1", path = "../swc_estree_macros/"} +swc_visit = {version = "0.2", path = "../swc_visit"} diff --git a/crates/swc_babel_visit/README.md b/crates/swc_estree_visit/README.md similarity index 100% rename from crates/swc_babel_visit/README.md rename to crates/swc_estree_visit/README.md diff --git a/crates/swc_babel_visit/src/lib.rs b/crates/swc_estree_visit/src/lib.rs similarity index 99% rename from crates/swc_babel_visit/src/lib.rs rename to crates/swc_estree_visit/src/lib.rs index 3c5e169655b..7e3da54b077 100644 --- a/crates/swc_babel_visit/src/lib.rs +++ b/crates/swc_estree_visit/src/lib.rs @@ -1,7 +1,7 @@ use serde_json::Value; use std::any::Any; use swc_atoms::JsWord; -use swc_babel_ast::*; +use swc_estree_ast::*; use swc_visit::define; pub trait Node: Any {} diff --git a/cspell.json b/cspell.json index 1cdfcb18cdb..414b01ee1ce 100644 --- a/cspell.json +++ b/cspell.json @@ -49,6 +49,7 @@ "elems", "esbuild", "esms", + "estree", "eval", "Eval", "exponentation",