mirror of
https://github.com/swc-project/swc.git
synced 2024-11-22 15:25:01 +03:00
refactor: Flatten ecmascript
(#2708)
This commit is contained in:
parent
a90fae5696
commit
2b2f6955f2
2
.github/workflows/cargo.yml
vendored
2
.github/workflows/cargo.yml
vendored
@ -211,7 +211,7 @@ jobs:
|
||||
# This does not have any effect on windows.
|
||||
npm config set prefix $HOME/npm
|
||||
yarn
|
||||
(cd ecmascript/transforms && yarn)
|
||||
(cd crates/swc_ecma_transforms && yarn)
|
||||
npm i -g jest
|
||||
echo $HOME
|
||||
echo $HOME/npm/bin >> $GITHUB_PATH
|
||||
|
12
.github/workflows/compilation.yml
vendored
12
.github/workflows/compilation.yml
vendored
@ -46,27 +46,27 @@ jobs:
|
||||
|
||||
- name: Check swc_ecma_ast
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
run: |
|
||||
|
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,4 +1,4 @@
|
||||
[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
|
||||
shallow = true
|
||||
|
@ -2,7 +2,7 @@
|
||||
members = [
|
||||
"css",
|
||||
"css/stylis",
|
||||
"ecmascript",
|
||||
"crates/swc_ecmascript",
|
||||
"crates/swc_ecma_plugin_ast",
|
||||
"crates/swc_babel_compat",
|
||||
"crates/jsdoc",
|
||||
|
@ -18,7 +18,7 @@ swc_common = {version = "0.14.0", path = "../swc_common"}
|
||||
[dev-dependencies]
|
||||
anyhow = "1"
|
||||
dashmap = "4.0.2"
|
||||
swc_ecma_ast = {version = "0.57.0", path = "../../ecmascript/ast"}
|
||||
swc_ecma_parser = {version = "0.77.0", path = "../../ecmascript/parser"}
|
||||
swc_ecma_ast = {version = "0.57.0", path = "../swc_ecma_ast"}
|
||||
swc_ecma_parser = {version = "0.77.0", path = "../swc_ecma_parser"}
|
||||
testing = {version = "0.15.0", path = "../testing"}
|
||||
walkdir = "2"
|
||||
|
@ -26,9 +26,9 @@ swc = {path = "../swc", features = ["concurrent", "wrong-target"]}
|
||||
swc_atoms = {version = "0.2.4", path = "../swc_atoms"}
|
||||
swc_bundler = {path = "../swc_bundler"}
|
||||
swc_common = {path = "../swc_common", features = ["sourcemap"]}
|
||||
swc_ecma_ast = {path = "../../ecmascript/ast"}
|
||||
swc_ecma_loader = {path = "../../ecmascript/loader"}
|
||||
swc_ecma_parser = {path = "../../ecmascript/parser"}
|
||||
swc_ecma_ast = {path = "../swc_ecma_ast"}
|
||||
swc_ecma_loader = {path = "../swc_ecma_loader"}
|
||||
swc_ecma_parser = {path = "../swc_ecma_parser"}
|
||||
swc_node_base = {path = "../swc_node_base"}
|
||||
swc_node_bundler = {path = "../swc_node_bundler"}
|
||||
tracing = {version = "0.1.28", features = ["release_max_level_off"]}
|
||||
|
@ -49,14 +49,14 @@ serde_json = "1"
|
||||
sourcemap = "6"
|
||||
swc_atoms = {version = "0.2", path = "../swc_atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../swc_common", features = ["sourcemap", "concurrent"]}
|
||||
swc_ecma_ast = {version = "0.57.0", path = "../../ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.79.0", path = "../../ecmascript/codegen"}
|
||||
swc_ecma_ext_transforms = {version = "0.37.0", path = "../../ecmascript/ext-transforms"}
|
||||
swc_ecma_loader = {version = "0.24.0", path = "../../ecmascript/loader", features = ["lru", "node", "tsc"]}
|
||||
swc_ecma_minifier = {version = "0.49.0", path = "../../ecmascript/minifier"}
|
||||
swc_ecma_parser = {version = "0.77.0", path = "../../ecmascript/parser"}
|
||||
swc_ecma_preset_env = {version = "0.64.0", path = "../../ecmascript/preset-env"}
|
||||
swc_ecma_transforms = {version = "0.93.0", path = "../../ecmascript/transforms", features = [
|
||||
swc_ecma_ast = {version = "0.57.0", path = "../swc_ecma_ast"}
|
||||
swc_ecma_codegen = {version = "0.79.0", path = "../swc_ecma_codegen"}
|
||||
swc_ecma_ext_transforms = {version = "0.37.0", path = "../swc_ecma_ext_transforms"}
|
||||
swc_ecma_loader = {version = "0.24.0", path = "../swc_ecma_loader", features = ["lru", "node", "tsc"]}
|
||||
swc_ecma_minifier = {version = "0.49.0", path = "../swc_ecma_minifier"}
|
||||
swc_ecma_parser = {version = "0.77.0", path = "../swc_ecma_parser"}
|
||||
swc_ecma_preset_env = {version = "0.64.0", path = "../swc_ecma_preset_env"}
|
||||
swc_ecma_transforms = {version = "0.93.0", path = "../swc_ecma_transforms", features = [
|
||||
"compat",
|
||||
"module",
|
||||
"optimization",
|
||||
@ -64,12 +64,12 @@ swc_ecma_transforms = {version = "0.93.0", path = "../../ecmascript/transforms",
|
||||
"react",
|
||||
"typescript",
|
||||
]}
|
||||
swc_ecma_transforms_base = {version = "0.43.0", path = "../../ecmascript/transforms/base"}
|
||||
swc_ecma_transforms_compat = {version = "0.50.0", path = "../../ecmascript/transforms/compat"}
|
||||
swc_ecma_transforms_optimization = {version = "0.63.0", path = "../../ecmascript/transforms/optimization"}
|
||||
swc_ecma_utils = {version = "0.51.0", path = "../../ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.43.0", path = "../../ecmascript/visit"}
|
||||
swc_ecmascript = {version = "0.85.0", path = "../../ecmascript"}
|
||||
swc_ecma_transforms_base = {version = "0.43.0", path = "../swc_ecma_transforms_base"}
|
||||
swc_ecma_transforms_compat = {version = "0.50.0", path = "../swc_ecma_transforms_compat"}
|
||||
swc_ecma_transforms_optimization = {version = "0.63.0", path = "../swc_ecma_transforms_optimization"}
|
||||
swc_ecma_utils = {version = "0.51.0", path = "../swc_ecma_utils"}
|
||||
swc_ecma_visit = {version = "0.43.0", path = "../swc_ecma_visit"}
|
||||
swc_ecmascript = {version = "0.85.0", path = "../swc_ecmascript"}
|
||||
swc_visit = {version = "0.2.3", path = "../swc_visit"}
|
||||
tracing = "0.1.28"
|
||||
|
||||
|
@ -14,7 +14,7 @@ use swc_ecma_parser::{Syntax, TsConfig};
|
||||
use testing::{NormalizedOutput, Tester};
|
||||
|
||||
#[testing::fixture(
|
||||
"../../ecmascript/parser/tests/typescript/tsc/**/input.ts",
|
||||
"../swc_ecma_parser/tests/typescript/tsc/**/input.ts",
|
||||
exclude(
|
||||
"privateNameFieldDestructuredBinding/input.ts",
|
||||
"restPropertyWithBindingPattern/input.ts",
|
||||
@ -24,16 +24,14 @@ use testing::{NormalizedOutput, Tester};
|
||||
"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) {
|
||||
if input.to_string_lossy().contains("jsdoc") {
|
||||
return;
|
||||
}
|
||||
|
||||
let base = Path::new("..")
|
||||
.join("..")
|
||||
.join("ecmascript")
|
||||
.join("parser")
|
||||
.join("swc_ecma_parser")
|
||||
.join("tests")
|
||||
.join("typescript")
|
||||
.join("tsc")
|
||||
|
@ -23,13 +23,13 @@ swc_atoms = {path = "../swc_atoms"}
|
||||
swc_babel_ast = {path = "../swc_babel_ast"}
|
||||
swc_babel_visit = {path = "../swc_babel_visit"}
|
||||
swc_common = {path = "../swc_common", features = ["sourcemap", "tty-emitter"]}
|
||||
swc_ecma_ast = {path = "../../ecmascript/ast"}
|
||||
swc_ecma_parser = {path = "../../ecmascript/parser"}
|
||||
swc_ecma_utils = {path = "../../ecmascript/utils"}
|
||||
swc_ecma_visit = {path = "../../ecmascript/visit"}
|
||||
swc_ecma_ast = {path = "../swc_ecma_ast"}
|
||||
swc_ecma_parser = {path = "../swc_ecma_parser"}
|
||||
swc_ecma_utils = {path = "../swc_ecma_utils"}
|
||||
swc_ecma_visit = {path = "../swc_ecma_visit"}
|
||||
swc_node_base = {path = "../swc_node_base"}
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "0.7.1"
|
||||
swc_ecma_transforms = {path = "../../ecmascript/transforms/"}
|
||||
swc_ecma_transforms = {path = "../swc_ecma_transforms/"}
|
||||
walkdir = "2"
|
||||
|
@ -101,35 +101,35 @@ macro_rules! src_to_babel_ast {
|
||||
|
||||
src_to_babel_ast!(
|
||||
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!(
|
||||
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!(
|
||||
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!(
|
||||
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!(
|
||||
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!(
|
||||
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!(
|
||||
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")
|
||||
);
|
||||
|
@ -38,14 +38,14 @@ relative-path = "1.2"
|
||||
retain_mut = "0.1.2"
|
||||
swc_atoms = {version = "0.2.4", path = "../swc_atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../swc_common"}
|
||||
swc_ecma_ast = {version = "0.57.0", path = "../../ecmascript/ast"}
|
||||
swc_ecma_codegen = {version = "0.79.0", path = "../../ecmascript/codegen"}
|
||||
swc_ecma_loader = {version = "0.24.0", path = "../../ecmascript/loader"}
|
||||
swc_ecma_parser = {version = "0.77.0", path = "../../ecmascript/parser"}
|
||||
swc_ecma_transforms_base = {version = "0.43.0", path = "../../ecmascript/transforms/base"}
|
||||
swc_ecma_transforms_optimization = {version = "0.63.0", path = "../../ecmascript/transforms/optimization"}
|
||||
swc_ecma_utils = {version = "0.51.0", path = "../../ecmascript/utils"}
|
||||
swc_ecma_visit = {version = "0.43.0", path = "../../ecmascript/visit"}
|
||||
swc_ecma_ast = {version = "0.57.0", path = "../swc_ecma_ast"}
|
||||
swc_ecma_codegen = {version = "0.79.0", path = "../swc_ecma_codegen"}
|
||||
swc_ecma_loader = {version = "0.24.0", path = "../swc_ecma_loader"}
|
||||
swc_ecma_parser = {version = "0.77.0", path = "../swc_ecma_parser"}
|
||||
swc_ecma_transforms_base = {version = "0.43.0", path = "../swc_ecma_transforms_base"}
|
||||
swc_ecma_transforms_optimization = {version = "0.63.0", path = "../swc_ecma_transforms_optimization"}
|
||||
swc_ecma_utils = {version = "0.51.0", path = "../swc_ecma_utils"}
|
||||
swc_ecma_visit = {version = "0.43.0", path = "../swc_ecma_visit"}
|
||||
tracing = "0.1.28"
|
||||
|
||||
[dev-dependencies]
|
||||
@ -54,10 +54,10 @@ ntest = "0.7.2"
|
||||
path-clean = "=0.1.0"
|
||||
reqwest = {version = "0.11.4", features = ["blocking"]}
|
||||
sha-1 = "0.9"
|
||||
swc_ecma_loader = {version = "0.24.0", path = "../../ecmascript/loader", features = ["node", "lru"]}
|
||||
swc_ecma_minifier = {version = "0.49.0", path = "../../ecmascript/minifier"}
|
||||
swc_ecma_transforms_react = {version = "0.58.0", path = "../../ecmascript/transforms/react"}
|
||||
swc_ecma_transforms_typescript = {version = "0.59.0", path = "../../ecmascript/transforms/typescript"}
|
||||
swc_ecma_loader = {version = "0.24.0", path = "../swc_ecma_loader", features = ["node", "lru"]}
|
||||
swc_ecma_minifier = {version = "0.49.0", path = "../swc_ecma_minifier"}
|
||||
swc_ecma_transforms_react = {version = "0.58.0", path = "../swc_ecma_transforms_react"}
|
||||
swc_ecma_transforms_typescript = {version = "0.59.0", path = "../swc_ecma_transforms_typescript"}
|
||||
swc_node_base = {version = "0.5.0", path = "../swc_node_base"}
|
||||
tempfile = "3.1.0"
|
||||
testing = {version = "0.15.0", path = "../testing"}
|
||||
|
@ -17,9 +17,9 @@ arbitrary = {version = "1", optional = true, features = ["derive"]}
|
||||
is-macro = "0.1"
|
||||
num-bigint = {version = "0.2", features = ["serde"]}
|
||||
serde = {version = "1.0.88", features = ["derive"]}
|
||||
string_enum = {version = "0.3.1", path = "../../crates/string_enum"}
|
||||
swc_atoms = {version = "0.2", path = "../../crates/swc_atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../../crates/swc_common"}
|
||||
string_enum = {version = "0.3.1", path = "../string_enum"}
|
||||
swc_atoms = {version = "0.2", path = "../swc_atoms"}
|
||||
swc_common = {version = "0.14.0", path = "../swc_common"}
|
||||
|
||||
[dev-dependencies]
|
||||
serde_json = "1"
|
28
crates/swc_ecma_codegen/Cargo.toml
Normal file
28
crates/swc_ecma_codegen/Cargo.toml
Normal 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
Loading…
Reference in New Issue
Block a user