Skip to content

Commit

Permalink
Update swc (#30790)
Browse files Browse the repository at this point in the history
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`



This PR applies

 - swc-project/swc#2610

This increases the pass limit (which is required to prevent hanging) from 30 to 100.
Fixes #30636.

 - swc-project/swc#2625

This marks assignment with operators as `usage`+ `assign`. Previously it was only `assisgn`. This is to preserve assignments to variables used like `(a += '').split('.'))`.

Fixes #30414.

---

I expect this to fix some more issues on next.js repository, but I didn't list them because it's not tested.
  • Loading branch information
kdy1 committed Nov 2, 2021
1 parent 7cd9ffc commit e79f788
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 45 deletions.
81 changes: 40 additions & 41 deletions packages/next/build/swc/Cargo.lock

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

8 changes: 4 additions & 4 deletions packages/next/build/swc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ path-clean = "0.1"
regex = "1.5"
serde = "1"
serde_json = "1"
swc = "0.80.0"
swc = "0.81.1"
swc_atoms = "0.2.7"
swc_common = { version = "0.14.2", features = ["concurrent", "sourcemap"] }
swc_css = "0.20.0"
swc_ecmascript = { version = "0.83.0", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_ecma_preset_env = "0.62.0"
swc_ecmascript = { version = "0.84.1", features = ["codegen", "minifier", "optimization", "parser", "react", "transforms", "typescript", "utils", "visit"] }
swc_ecma_preset_env = "0.63.1"
swc_node_base = "0.5.1"
swc_stylis = "0.17.0"
fxhash = "0.2.1"
Expand All @@ -36,7 +36,7 @@ tracing = { version = "0.1.28", features = ["release_max_level_off"] }
napi-build = "1"

[dev-dependencies]
swc_ecma_transforms_testing = "0.42.1"
swc_ecma_transforms_testing = "0.43.1"
testing = "0.15.1"
walkdir = "2.3.2"

Expand Down
9 changes: 9 additions & 0 deletions packages/next/build/swc/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,12 @@ fn test_deser() {

println!("{:#?}", tr);
}

#[test]
fn test_deserialize_transform_regenerator() {
const JSON_STR: &str = r#"{"jsc":{"parser":{"syntax":"ecmascript","dynamicImport":true,"jsx":true},"transform":{ "regenerator": { "importPath": "foo" }, "react":{"runtime":"automatic","pragma":"React.createElement","pragmaFrag":"React.Fragment","throwIfNamespace":true,"development":false,"useBuiltins":true}},"target":"es5"},"filename":"/Users/timneutkens/projects/next.js/packages/next/dist/client/next.js","sourceMaps":false,"sourceFileName":"/Users/timneutkens/projects/next.js/packages/next/dist/client/next.js"}"#;

let tr: TransformOptions = serde_json::from_str(&JSON_STR).unwrap();

println!("{:#?}", tr);
}

0 comments on commit e79f788

Please sign in to comment.