refactor: Flatten ecmascript (#2708)

This commit is contained in:
Donny/강동윤 2021-11-10 19:00:54 +09:00 committed by GitHub
parent a90fae5696
commit 2b2f6955f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25612 changed files with 513 additions and 492 deletions

View File

@ -211,7 +211,7 @@ jobs:
# This does not have any effect on windows. # This does not have any effect on windows.
npm config set prefix $HOME/npm npm config set prefix $HOME/npm
yarn yarn
(cd ecmascript/transforms && yarn) (cd crates/swc_ecma_transforms && yarn)
npm i -g jest npm i -g jest
echo $HOME echo $HOME
echo $HOME/npm/bin >> $GITHUB_PATH echo $HOME/npm/bin >> $GITHUB_PATH

View File

@ -46,27 +46,27 @@ jobs:
- name: Check swc_ecma_ast - name: Check swc_ecma_ast
run: | run: |
(cd ecmascript/ast && cargo hack check --feature-powerset --no-dev-deps) (cd crates/swc_ecma_ast && cargo hack check --feature-powerset --no-dev-deps)
- name: Check swc_ecma_transforms - name: Check swc_ecma_transforms
run: | run: |
(cd ecmascript/transforms && cargo hack check --feature-powerset --no-dev-deps) (cd crates/swc_ecma_transforms && cargo hack check --feature-powerset --no-dev-deps)
- name: Check swc_ecma_transforms_base - name: Check swc_ecma_transforms_base
run: | run: |
(cd ecmascript/transforms/base && cargo hack check --feature-powerset --no-dev-deps) (cd crates/swc_ecma_transforms_base && cargo hack check --feature-powerset --no-dev-deps)
- name: Check swc_ecma_transforms_compat - name: Check swc_ecma_transforms_compat
run: | run: |
(cd ecmascript/transforms/compat && cargo hack check --feature-powerset --no-dev-deps) (cd crates/swc_ecma_transforms_compat && cargo hack check --feature-powerset --no-dev-deps)
- name: Check swc_ecma_transforms_optimization - name: Check swc_ecma_transforms_optimization
run: | run: |
(cd ecmascript/transforms/optimization && cargo hack check --feature-powerset --no-dev-deps) (cd crates/swc_ecma_transforms_optimization && cargo hack check --feature-powerset --no-dev-deps)
- name: Check swc_ecma_utils - name: Check swc_ecma_utils
run: | run: |
(cd ecmascript/utils && cargo hack check --feature-powerset --no-dev-deps) (cd crates/swc_ecma_utils && cargo hack check --feature-powerset --no-dev-deps)
- name: Check swc_bundler - name: Check swc_bundler
run: | run: |

2
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "ecmascript/test262-parser-tests"] [submodule "ecmascript/test262-parser-tests"]
path = ecmascript/parser/tests/test262-parser path = crates/swc_ecma_parser/tests/test262-parser
url = https://github.com/tc39/test262-parser-tests.git url = https://github.com/tc39/test262-parser-tests.git
shallow = true shallow = true

View File

@ -2,7 +2,7 @@
members = [ members = [
"css", "css",
"css/stylis", "css/stylis",
"ecmascript", "crates/swc_ecmascript",
"crates/swc_ecma_plugin_ast", "crates/swc_ecma_plugin_ast",
"crates/swc_babel_compat", "crates/swc_babel_compat",
"crates/jsdoc", "crates/jsdoc",

View File

@ -18,7 +18,7 @@ swc_common = {version = "0.14.0", path = "../swc_common"}
[dev-dependencies] [dev-dependencies]
anyhow = "1" anyhow = "1"
dashmap = "4.0.2" dashmap = "4.0.2"
swc_ecma_ast = {version = "0.57.0", path = "../../ecmascript/ast"} swc_ecma_ast = {version = "0.57.0", path = "../swc_ecma_ast"}
swc_ecma_parser = {version = "0.77.0", path = "../../ecmascript/parser"} swc_ecma_parser = {version = "0.77.0", path = "../swc_ecma_parser"}
testing = {version = "0.15.0", path = "../testing"} testing = {version = "0.15.0", path = "../testing"}
walkdir = "2" walkdir = "2"

View File

@ -26,9 +26,9 @@ swc = {path = "../swc", features = ["concurrent", "wrong-target"]}
swc_atoms = {version = "0.2.4", path = "../swc_atoms"} swc_atoms = {version = "0.2.4", path = "../swc_atoms"}
swc_bundler = {path = "../swc_bundler"} swc_bundler = {path = "../swc_bundler"}
swc_common = {path = "../swc_common", features = ["sourcemap"]} swc_common = {path = "../swc_common", features = ["sourcemap"]}
swc_ecma_ast = {path = "../../ecmascript/ast"} swc_ecma_ast = {path = "../swc_ecma_ast"}
swc_ecma_loader = {path = "../../ecmascript/loader"} swc_ecma_loader = {path = "../swc_ecma_loader"}
swc_ecma_parser = {path = "../../ecmascript/parser"} swc_ecma_parser = {path = "../swc_ecma_parser"}
swc_node_base = {path = "../swc_node_base"} swc_node_base = {path = "../swc_node_base"}
swc_node_bundler = {path = "../swc_node_bundler"} swc_node_bundler = {path = "../swc_node_bundler"}
tracing = {version = "0.1.28", features = ["release_max_level_off"]} tracing = {version = "0.1.28", features = ["release_max_level_off"]}

View File

@ -49,14 +49,14 @@ serde_json = "1"
sourcemap = "6" sourcemap = "6"
swc_atoms = {version = "0.2", path = "../swc_atoms"} swc_atoms = {version = "0.2", path = "../swc_atoms"}
swc_common = {version = "0.14.0", path = "../swc_common", features = ["sourcemap", "concurrent"]} swc_common = {version = "0.14.0", path = "../swc_common", features = ["sourcemap", "concurrent"]}
swc_ecma_ast = {version = "0.57.0", path = "../../ecmascript/ast"} swc_ecma_ast = {version = "0.57.0", path = "../swc_ecma_ast"}
swc_ecma_codegen = {version = "0.79.0", path = "../../ecmascript/codegen"} swc_ecma_codegen = {version = "0.79.0", path = "../swc_ecma_codegen"}
swc_ecma_ext_transforms = {version = "0.37.0", path = "../../ecmascript/ext-transforms"} swc_ecma_ext_transforms = {version = "0.37.0", path = "../swc_ecma_ext_transforms"}
swc_ecma_loader = {version = "0.24.0", path = "../../ecmascript/loader", features = ["lru", "node", "tsc"]} swc_ecma_loader = {version = "0.24.0", path = "../swc_ecma_loader", features = ["lru", "node", "tsc"]}
swc_ecma_minifier = {version = "0.49.0", path = "../../ecmascript/minifier"} swc_ecma_minifier = {version = "0.49.0", path = "../swc_ecma_minifier"}
swc_ecma_parser = {version = "0.77.0", path = "../../ecmascript/parser"} swc_ecma_parser = {version = "0.77.0", path = "../swc_ecma_parser"}
swc_ecma_preset_env = {version = "0.64.0", path = "../../ecmascript/preset-env"} swc_ecma_preset_env = {version = "0.64.0", path = "../swc_ecma_preset_env"}
swc_ecma_transforms = {version = "0.93.0", path = "../../ecmascript/transforms", features = [ swc_ecma_transforms = {version = "0.93.0", path = "../swc_ecma_transforms", features = [
"compat", "compat",
"module", "module",
"optimization", "optimization",
@ -64,12 +64,12 @@ swc_ecma_transforms = {version = "0.93.0", path = "../../ecmascript/transforms",
"react", "react",
"typescript", "typescript",
]} ]}
swc_ecma_transforms_base = {version = "0.43.0", path = "../../ecmascript/transforms/base"} swc_ecma_transforms_base = {version = "0.43.0", path = "../swc_ecma_transforms_base"}
swc_ecma_transforms_compat = {version = "0.50.0", path = "../../ecmascript/transforms/compat"} swc_ecma_transforms_compat = {version = "0.50.0", path = "../swc_ecma_transforms_compat"}
swc_ecma_transforms_optimization = {version = "0.63.0", path = "../../ecmascript/transforms/optimization"} swc_ecma_transforms_optimization = {version = "0.63.0", path = "../swc_ecma_transforms_optimization"}
swc_ecma_utils = {version = "0.51.0", path = "../../ecmascript/utils"} swc_ecma_utils = {version = "0.51.0", path = "../swc_ecma_utils"}
swc_ecma_visit = {version = "0.43.0", path = "../../ecmascript/visit"} swc_ecma_visit = {version = "0.43.0", path = "../swc_ecma_visit"}
swc_ecmascript = {version = "0.85.0", path = "../../ecmascript"} swc_ecmascript = {version = "0.85.0", path = "../swc_ecmascript"}
swc_visit = {version = "0.2.3", path = "../swc_visit"} swc_visit = {version = "0.2.3", path = "../swc_visit"}
tracing = "0.1.28" tracing = "0.1.28"

View File

@ -14,7 +14,7 @@ use swc_ecma_parser::{Syntax, TsConfig};
use testing::{NormalizedOutput, Tester}; use testing::{NormalizedOutput, Tester};
#[testing::fixture( #[testing::fixture(
"../../ecmascript/parser/tests/typescript/tsc/**/input.ts", "../swc_ecma_parser/tests/typescript/tsc/**/input.ts",
exclude( exclude(
"privateNameFieldDestructuredBinding/input.ts", "privateNameFieldDestructuredBinding/input.ts",
"restPropertyWithBindingPattern/input.ts", "restPropertyWithBindingPattern/input.ts",
@ -24,16 +24,14 @@ use testing::{NormalizedOutput, Tester};
"objectRestPropertyMustBeLast/input.ts", "objectRestPropertyMustBeLast/input.ts",
) )
)] )]
#[testing::fixture("../../ecmascript/parser/tests/typescript/tsc/**/input.tsx")] #[testing::fixture("../swc_ecma_parser/tests/typescript/tsc/**/input.tsx")]
fn fixture(input: PathBuf) { fn fixture(input: PathBuf) {
if input.to_string_lossy().contains("jsdoc") { if input.to_string_lossy().contains("jsdoc") {
return; return;
} }
let base = Path::new("..") let base = Path::new("..")
.join("..") .join("swc_ecma_parser")
.join("ecmascript")
.join("parser")
.join("tests") .join("tests")
.join("typescript") .join("typescript")
.join("tsc") .join("tsc")

View File

@ -23,13 +23,13 @@ swc_atoms = {path = "../swc_atoms"}
swc_babel_ast = {path = "../swc_babel_ast"} swc_babel_ast = {path = "../swc_babel_ast"}
swc_babel_visit = {path = "../swc_babel_visit"} swc_babel_visit = {path = "../swc_babel_visit"}
swc_common = {path = "../swc_common", features = ["sourcemap", "tty-emitter"]} swc_common = {path = "../swc_common", features = ["sourcemap", "tty-emitter"]}
swc_ecma_ast = {path = "../../ecmascript/ast"} swc_ecma_ast = {path = "../swc_ecma_ast"}
swc_ecma_parser = {path = "../../ecmascript/parser"} swc_ecma_parser = {path = "../swc_ecma_parser"}
swc_ecma_utils = {path = "../../ecmascript/utils"} swc_ecma_utils = {path = "../swc_ecma_utils"}
swc_ecma_visit = {path = "../../ecmascript/visit"} swc_ecma_visit = {path = "../swc_ecma_visit"}
swc_node_base = {path = "../swc_node_base"} swc_node_base = {path = "../swc_node_base"}
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.7.1" pretty_assertions = "0.7.1"
swc_ecma_transforms = {path = "../../ecmascript/transforms/"} swc_ecma_transforms = {path = "../swc_ecma_transforms/"}
walkdir = "2" walkdir = "2"

View File

@ -101,35 +101,35 @@ macro_rules! src_to_babel_ast {
src_to_babel_ast!( src_to_babel_ast!(
parse_and_babelify_angular, parse_and_babelify_angular,
include_str!("../../../ecmascript/parser/benches/files/angular-1.2.5.js") include_str!("../../swc_ecma_parser/benches/files/angular-1.2.5.js")
); );
src_to_babel_ast!( src_to_babel_ast!(
parse_and_babelify_backbone, parse_and_babelify_backbone,
include_str!("../../../ecmascript/parser/benches/files/backbone-1.1.0.js") include_str!("../../swc_ecma_parser/benches/files/backbone-1.1.0.js")
); );
src_to_babel_ast!( src_to_babel_ast!(
parse_and_babelify_jquery, parse_and_babelify_jquery,
include_str!("../../../ecmascript/parser/benches/files/jquery-1.9.1.js") include_str!("../../swc_ecma_parser/benches/files/jquery-1.9.1.js")
); );
src_to_babel_ast!( src_to_babel_ast!(
parse_and_babelify_jquery_mobile, parse_and_babelify_jquery_mobile,
include_str!("../../../ecmascript/parser/benches/files/jquery.mobile-1.4.2.js") include_str!("../../swc_ecma_parser/benches/files/jquery.mobile-1.4.2.js")
); );
src_to_babel_ast!( src_to_babel_ast!(
parse_and_babelify_mootools, parse_and_babelify_mootools,
include_str!("../../../ecmascript/parser/benches/files/mootools-1.4.5.js") include_str!("../../swc_ecma_parser/benches/files/mootools-1.4.5.js")
); );
src_to_babel_ast!( src_to_babel_ast!(
parse_and_babelify_underscore, parse_and_babelify_underscore,
include_str!("../../../ecmascript/parser/benches/files/underscore-1.5.2.js") include_str!("../../swc_ecma_parser/benches/files/underscore-1.5.2.js")
); );
src_to_babel_ast!( src_to_babel_ast!(
parse_and_babelify_yui, parse_and_babelify_yui,
include_str!("../../../ecmascript/parser/benches/files/yui-3.12.0.js") include_str!("../../swc_ecma_parser/benches/files/yui-3.12.0.js")
); );

View File

@ -38,14 +38,14 @@ relative-path = "1.2"
retain_mut = "0.1.2" retain_mut = "0.1.2"
swc_atoms = {version = "0.2.4", path = "../swc_atoms"} swc_atoms = {version = "0.2.4", path = "../swc_atoms"}
swc_common = {version = "0.14.0", path = "../swc_common"} swc_common = {version = "0.14.0", path = "../swc_common"}
swc_ecma_ast = {version = "0.57.0", path = "../../ecmascript/ast"} swc_ecma_ast = {version = "0.57.0", path = "../swc_ecma_ast"}
swc_ecma_codegen = {version = "0.79.0", path = "../../ecmascript/codegen"} swc_ecma_codegen = {version = "0.79.0", path = "../swc_ecma_codegen"}
swc_ecma_loader = {version = "0.24.0", path = "../../ecmascript/loader"} swc_ecma_loader = {version = "0.24.0", path = "../swc_ecma_loader"}
swc_ecma_parser = {version = "0.77.0", path = "../../ecmascript/parser"} swc_ecma_parser = {version = "0.77.0", path = "../swc_ecma_parser"}
swc_ecma_transforms_base = {version = "0.43.0", path = "../../ecmascript/transforms/base"} swc_ecma_transforms_base = {version = "0.43.0", path = "../swc_ecma_transforms_base"}
swc_ecma_transforms_optimization = {version = "0.63.0", path = "../../ecmascript/transforms/optimization"} swc_ecma_transforms_optimization = {version = "0.63.0", path = "../swc_ecma_transforms_optimization"}
swc_ecma_utils = {version = "0.51.0", path = "../../ecmascript/utils"} swc_ecma_utils = {version = "0.51.0", path = "../swc_ecma_utils"}
swc_ecma_visit = {version = "0.43.0", path = "../../ecmascript/visit"} swc_ecma_visit = {version = "0.43.0", path = "../swc_ecma_visit"}
tracing = "0.1.28" tracing = "0.1.28"
[dev-dependencies] [dev-dependencies]
@ -54,10 +54,10 @@ ntest = "0.7.2"
path-clean = "=0.1.0" path-clean = "=0.1.0"
reqwest = {version = "0.11.4", features = ["blocking"]} reqwest = {version = "0.11.4", features = ["blocking"]}
sha-1 = "0.9" sha-1 = "0.9"
swc_ecma_loader = {version = "0.24.0", path = "../../ecmascript/loader", features = ["node", "lru"]} swc_ecma_loader = {version = "0.24.0", path = "../swc_ecma_loader", features = ["node", "lru"]}
swc_ecma_minifier = {version = "0.49.0", path = "../../ecmascript/minifier"} swc_ecma_minifier = {version = "0.49.0", path = "../swc_ecma_minifier"}
swc_ecma_transforms_react = {version = "0.58.0", path = "../../ecmascript/transforms/react"} swc_ecma_transforms_react = {version = "0.58.0", path = "../swc_ecma_transforms_react"}
swc_ecma_transforms_typescript = {version = "0.59.0", path = "../../ecmascript/transforms/typescript"} swc_ecma_transforms_typescript = {version = "0.59.0", path = "../swc_ecma_transforms_typescript"}
swc_node_base = {version = "0.5.0", path = "../swc_node_base"} swc_node_base = {version = "0.5.0", path = "../swc_node_base"}
tempfile = "3.1.0" tempfile = "3.1.0"
testing = {version = "0.15.0", path = "../testing"} testing = {version = "0.15.0", path = "../testing"}

View File

@ -17,9 +17,9 @@ arbitrary = {version = "1", optional = true, features = ["derive"]}
is-macro = "0.1" is-macro = "0.1"
num-bigint = {version = "0.2", features = ["serde"]} num-bigint = {version = "0.2", features = ["serde"]}
serde = {version = "1.0.88", features = ["derive"]} serde = {version = "1.0.88", features = ["derive"]}
string_enum = {version = "0.3.1", path = "../../crates/string_enum"} string_enum = {version = "0.3.1", path = "../string_enum"}
swc_atoms = {version = "0.2", path = "../../crates/swc_atoms"} swc_atoms = {version = "0.2", path = "../swc_atoms"}
swc_common = {version = "0.14.0", path = "../../crates/swc_common"} swc_common = {version = "0.14.0", path = "../swc_common"}
[dev-dependencies] [dev-dependencies]
serde_json = "1" serde_json = "1"

View File

@ -0,0 +1,28 @@
[package]
authors = ["강동윤 <kdy1997.dev@gmail.com>"]
description = "Ecmascript code generator for the swc project."
documentation = "https://rustdoc.swc.rs/swc_ecma_codegen/"
edition = "2018"
include = ["Cargo.toml", "src/**/*.rs"]
license = "Apache-2.0/MIT"
name = "swc_ecma_codegen"
repository = "https://github.com/swc-project/swc.git"
version = "0.79.0"
[dependencies]
bitflags = "1"
memchr = "2.4.1"
num-bigint = {version = "0.2", features = ["serde"]}
once_cell = "1.8.0"
sourcemap = "6"
swc_atoms = {version = "0.2", path = "../swc_atoms"}
swc_common = {version = "0.14.0", path = "../swc_common"}
swc_ecma_ast = {version = "0.57.0", path = "../swc_ecma_ast"}
swc_ecma_codegen_macros = {version = "0.6.0", path = "../swc_ecma_codegen_macros"}
swc_ecma_parser = {version = "0.77.0", path = "../swc_ecma_parser"}
tracing = "0.1"
[dev-dependencies]
swc_common = {version = "0.14.0", path = "../swc_common", features = ["sourcemap"]}
swc_node_base = {version = "0.5.0", path = "../swc_node_base"}
testing = {version = "0.15.0", path = "../testing"}

Some files were not shown because too many files have changed in this diff Show More