Skip to content

Updated SWC crate for JS Transformer#9104

Merged
devongovett merged 2 commits into
v2from
alsh/bump-swc
Jun 25, 2023
Merged

Updated SWC crate for JS Transformer#9104
devongovett merged 2 commits into
v2from
alsh/bump-swc

Conversation

@alshdavid

@alshdavid alshdavid commented Jun 23, 2023

Copy link
Copy Markdown
Contributor

↪️ Pull Request

Updated version of swc_ecmascript in the JS transformer to correct generics inside jsx elements

const Foo = () => <Component<any>></Component>

SWC playground

🚨 Test instructions

Build Parcel and try to compile something

#!/bin/bash
export NODE_ENV=production 
export PARCEL_BUILD_ENV=production
export PARCEL_SELF_BUILD=true
export PARCEL_WORKER_BACKEND=process

node scripts/build-native.js | tee

rm -rf packages/*/*/lib

npx parcel build \
  packages/core/{fs,codeframe,package-manager,utils} \
  packages/reporters/{cli,dev-server} \
  packages/utils/{parcel-lsp,parcel-lsp-protocol} \
  | tee

npx gulp | tee

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

@mischnic

Copy link
Copy Markdown
Member

The unit tests are failing because apparently now less whitespaces are emitted:

failures:

---- hoist::tests::fold_dynamic_import stdout ----
error: test failed, to rerun pass `-p parcel-js-swc-core --lib`
thread 'hoist::tests::fold_dynamic_import' panicked at 'assertion failed: `(left == right)`
  left: `"import \"abc:other\";\nasync function $abc$var$test() {\n    const { foo: foo } = await $abc$importAsync$70a00e0a8474f72a;\n    console.log(foo);\n}\n"`,
 right: `"import \"abc:other\";\nasync function $abc$var$test() {\n    const { foo: foo  } = await $abc$importAsync$70a00e0a8474f72a;\n    console.log(foo);\n}\n"`', packages/transformers/js/core/src/hoist.rs:2[950](https://github.com/parcel-bundler/parcel/actions/runs/5353680449/jobs/9709816316?pr=9104#step:9:951):5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- hoist::tests::fold_export stdout ----
thread 'hoist::tests::fold_export' panicked at 'assertion failed: `(left == right)`
  left: `"var { x: $abc$export$d141bba7fdc215a3, ...$abc$export$4a5767248b18ef41 } = something;\nvar [$abc$export$ffb5f4729a158638, ...$abc$export$9e5f44173e64f162] = something;\nvar { x: $abc$export$d141bba7fdc215a3 = 3 } = something;\n"`,
 right: `"var { x: $abc$export$d141bba7fdc215a3 , ...$abc$export$4a5767248b18ef41 } = something;\nvar [$abc$export$ffb5f4729a158638, ...$abc$export$9e5f44173e64f162] = something;\nvar { x: $abc$export$d141bba7fdc215a3 = 3  } = something;\n"`', packages/transformers/js/core/src/hoist.rs:2462:5

---- hoist::tests::fold_require_member stdout ----
thread 'hoist::tests::fold_require_member' panicked at 'assertion failed: `(left == right)`
  left: `"import \"abc:other\";\nconst { foo: $abc$var$foo } = $abc$import$70a00e0a8474f72a$6a5cdcad01c973fa;\nconsole.log($abc$var$foo);\n"`,
 right: `"import \"abc:other\";\nconst { foo: $abc$var$foo  } = $abc$import$70a00e0a8474f72a$6a5cdcad01c973fa;\nconsole.log($abc$var$foo);\n"`', packages/transformers/js/core/src/hoist.rs:2072:5

---- hoist::tests::fold_non_static_require stdout ----
thread 'hoist::tests::fold_non_static_require' panicked at 'assertion failed: `(left == right)`
  left: `"import \"abc:other\";\nconst { foo: $abc$var$foo, ...$abc$var$bar } = $abc$import$70a00e0a8474f72a;\nconsole.log($abc$var$foo, $abc$var$bar);\n"`,
 right: `"import \"abc:other\";\nconst { foo: $abc$var$foo , ...$abc$var$bar } = $abc$import$70a00e0a8474f72a;\nconsole.log($abc$var$foo, $abc$var$bar);\n"`', packages/transformers/js/core/src/hoist.rs:1[967](https://github.com/parcel-bundler/parcel/actions/runs/5353680449/jobs/9709816316?pr=9104#step:9:968):5

---- hoist::tests::fold_require_wrapped stdout ----
thread 'hoist::tests::fold_require_wrapped' panicked at 'assertion failed: `(left == right)`
  left: `"import \"abc:other\";\nfunction $abc$var$x() {\n    const { foo: foo } = $abc$import$70a00e0a8474f72a;\n    console.log(foo);\n}\n"`,
 right: `"import \"abc:other\";\nfunction $abc$var$x() {\n    const { foo: foo  } = $abc$import$70a00e0a8474f72a;\n    console.log(foo);\n}\n"`', packages/transformers/js/core/src/hoist.rs:2203:5


failures:
    hoist::tests::fold_dynamic_import
    hoist::tests::fold_export
    hoist::tests::fold_non_static_require
    hoist::tests::fold_require_member
    hoist::tests::fold_require_wrapped

@devongovett devongovett merged commit 34103e2 into v2 Jun 25, 2023
@devongovett devongovett deleted the alsh/bump-swc branch June 25, 2023 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants