Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(es/typescript): Add swc_fast_ts_strip #9143

Merged
merged 63 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
7486ed9
CI
kdy1 Jul 5, 2024
fffa744
commit
kdy1 Jul 5, 2024
0868c9c
tesh.sh
kdy1 Jul 5, 2024
22d922e
test
kdy1 Jul 5, 2024
2c3633a
module/namespace
kdy1 Jul 5, 2024
8f309e0
swap error message
kdy1 Jul 5, 2024
5f9506f
Update jest snapshot
kdy1 Jul 5, 2024
30b6172
Merge branch 'main' into ts-wasm-lint
swc-bot Jul 5, 2024
2218f86
Merge branch 'main' into ts-wasm-lint
kdy1 Jul 5, 2024
05c1076
Update jest snapshot
kdy1 Jul 5, 2024
759f57a
Drop deps
kdy1 Jul 5, 2024
d8f2f78
cargo lockfile
kdy1 Jul 5, 2024
d47a38f
simple codegen
kdy1 Jul 5, 2024
339b698
simplify
kdy1 Jul 5, 2024
19836e4
replace
kdy1 Jul 5, 2024
638a924
test
kdy1 Jul 5, 2024
430011e
test
kdy1 Jul 5, 2024
739e319
Handle no replacement
kdy1 Jul 5, 2024
61dced9
replacement at end
kdy1 Jul 5, 2024
cb427c4
type ann
kdy1 Jul 5, 2024
a6b070f
snapshot
kdy1 Jul 5, 2024
130ed75
Update jest snapshot
kdy1 Jul 5, 2024
acd6dab
strip more
kdy1 Jul 5, 2024
0c643ef
strip more
kdy1 Jul 5, 2024
8fa21f0
Update jest snapshot
kdy1 Jul 5, 2024
aaf51f4
Update test
kdy1 Jul 5, 2024
4f96e71
Add a test
kdy1 Jul 5, 2024
aac52fc
Add a crate
kdy1 Jul 5, 2024
41baf46
cargo lockfile
kdy1 Jul 5, 2024
88e9b82
lib
kdy1 Jul 5, 2024
8493c02
Deps
kdy1 Jul 5, 2024
27c29b2
cargo lockfile
kdy1 Jul 5, 2024
83127f9
Prepare testing
kdy1 Jul 5, 2024
b067b69
cargo lockfiel
kdy1 Jul 5, 2024
04d8439
test
kdy1 Jul 5, 2024
f457375
Rename
kdy1 Jul 5, 2024
d28c82c
Rename
kdy1 Jul 5, 2024
a80e77f
syntax
kdy1 Jul 5, 2024
bb5d434
Update test refs
kdy1 Jul 5, 2024
90670f1
sort
kdy1 Jul 5, 2024
e13685b
UPdate test refs
kdy1 Jul 5, 2024
f4a3653
CI
kdy1 Jul 5, 2024
72565f3
bump
kdy1 Jul 5, 2024
e4e69f8
Depend
kdy1 Jul 5, 2024
b43e19c
cargo lockfile
kdy1 Jul 5, 2024
71c89c5
test
kdy1 Jul 5, 2024
3a2046d
Update jest snapsho
kdy1 Jul 5, 2024
39f24e4
Add tests
kdy1 Jul 5, 2024
364bc54
more syntax
kdy1 Jul 5, 2024
1d86e60
Update test refs
kdy1 Jul 5, 2024
d72e7a6
More syntax
kdy1 Jul 5, 2024
d8620c0
swc_core
kdy1 Jul 5, 2024
0ae794c
cargo lockfile
kdy1 Jul 5, 2024
99805c6
Patch imports
kdy1 Jul 5, 2024
6e3ff48
Patch dep
kdy1 Jul 5, 2024
9fae924
cargo lockfile
kdy1 Jul 5, 2024
fff9efa
lib.rs
kdy1 Jul 5, 2024
60ec5ce
chore: Remove the generic type marker.
magic-akari Jul 5, 2024
f2c5d06
ts this param
magic-akari Jul 5, 2024
4ea8b34
fix blank string
magic-akari Jul 5, 2024
7a1f4f0
cargo lockfile
kdy1 Jul 5, 2024
3a11f8e
Merge branch 'main' into ts-wasm-lint
kdy1 Jul 5, 2024
9fd59b0
make clippy happy
magic-akari Jul 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ jobs:
if: >-
${{ !contains(github.event.head_commit.message, 'chore: ') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pkg:
- binding_core_wasm
- binding_minifier_wasm
- binding_typescript_wasm

steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -200,7 +208,7 @@ jobs:
- name: Test
run: |
(cd bindings/binding_core_wasm && ./scripts/test.sh)
(cd bindings/${{ matrix.pkg }} && ./scripts/test.sh)
cargo-test:
name: Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }}
Expand Down Expand Up @@ -460,6 +468,8 @@ jobs:
runner: ubuntu-latest
- crate: swc_fast_graph
os: ubuntu-latest
- crate: swc_fast_ts_strip
os: ubuntu-latest
runner: ubuntu-latest
- crate: swc_graph_analyzer
os: ubuntu-latest
Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ members = [
"crates/swc_x_optimizer",
"crates/swc_transform_common",
"crates/swc_typescript",
"crates/swc_fast_ts_strip",
]
resolver = "2"

Expand Down
118 changes: 35 additions & 83 deletions bindings/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`minify should work 1`] = `
Object {
"code": "console.log(1);",
}
`;
15 changes: 15 additions & 0 deletions bindings/binding_minifier_wasm/__tests__/simple.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const swc = require("../pkg");

describe("minify", () => {
it("should work", async () => {
const output = await swc.minify(
`{
const a = 1;
console.log(a);
}`,
{}
);

expect(output).toMatchSnapshot();
});
});
6 changes: 6 additions & 0 deletions bindings/binding_minifier_wasm/scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -eu

wasm-pack build --out-name wasm --release --scope=swc --target nodejs
npx jest $@
13 changes: 2 additions & 11 deletions bindings/binding_typescript_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,9 @@ getrandom = { version = "0.2.10", features = ["js"] }
serde = { version = "1", features = ["derive"] }
serde-wasm-bindgen = "0.4.5"
serde_json = "1.0.120"
swc_core = { version = "0.96.3", features = [
"common",
"common_sourcemap",
"ecma_ast",
"ecma_codegen",
"ecma_parser",
"ecma_transforms",
"ecma_transforms_typescript",
"ecma_visit",
] }
swc_ecma_codegen = { version = "0.151.1", features = ["serde-impl"] }
swc_common = "0.34.3"
swc_error_reporters = "0.18.0"
swc_fast_ts_strip = "0.1.1"
tracing = { version = "0.1.37", features = ["max_level_off"] }
wasm-bindgen = { version = "0.2.82", features = ["enable-interning"] }
wasm-bindgen-futures = { version = "0.4.41" }
Loading
Loading