ratchetdesigns / ts-bindgen

Generates wasm-bindgen rust code for typescript declarations
Other
42 stars 2 forks source link

Old version of swc dependency broken by upstream patch #27

Open eggyal opened 1 year ago

eggyal commented 1 year ago

Prior to swc-project/swc#3606 (released in swc v1.2.142), swc_common relied upon a public API of v1.0.0 of the scoped-tls crate that has since been broken in a patch release (see alexcrichton/scoped-tls#22). Since ts-bindgen-gen depends upon swc crates prior to this, it fails to compile if Cargo is permitted to follow semver updates (can be overridden e.g. with cargo update -p scoped_tls:1.0.1 --precise 1.0.0).

Absent the issue being fixed upstream, perhaps ts-bindgen can update to a newer version of swc that does not rely on the broken API?

d4h0 commented 1 year ago

For context, the installation currently fails with:

$ cargo install ts-bindgen
   [...]
   Compiling swc_common v0.14.7
error[E0308]: mismatched types
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_common-0.14.7/src/syntax_pos.rs:92:9
   |
92 |         &FOO
   |         ^^^^ expected `*const ()`, found `usize`
   |
   = note: expected reference `&'static LocalKey<Cell<*const ()>>`
              found reference `&LocalKey<Cell<usize>>`
abrgr commented 1 year ago

Thanks! I will work on getting thsi fixed soon. I really appreciate the detailed report.

eggyal commented 1 year ago

Just an FYI that this won't be fixed upstream as swc had been using an unstable/internal public API of the scoped-tls crate who do not consider their update to be a breaking change.

abrgr commented 1 year ago

Thanks. Definitely something we'll need to update on the ts-bindgen side.

sezna commented 1 year ago

Hey abrgr, great tool -- just wondering if there are any plans to fix this, as it seems impossible to install ts-bindgen currently. Alternatively, are there any known workarounds?

eggyal commented 1 year ago

@sezna there's a workaround mentioned in the opening post: cargo update -p scoped_tls:1.0.1 --precise 1.0.0.

abrgr commented 1 year ago

Sorry for the long delay. Main branch is now updated to use the latest swc (and some other dep upgrades. Trying to fix an issue with using rustfmt in wasm (for the demo) before releasing but will aim to get a cargo version out next week.

On Thu, Nov 2, 2023, 12:29 PM eggyal @.***> wrote:

@sezna https://github.com/sezna there's a workaround mentioned in the opening post: cargo update -p scoped_tls:1.0.1 --precise 1.0.0.

— Reply to this email directly, view it on GitHub https://github.com/ratchetdesigns/ts-bindgen/issues/27#issuecomment-1791069882, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOBOZTRJVFYE3SQVESG673YCPC6FAVCNFSM6AAAAAATKKGZSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJRGA3DSOBYGI . You are receiving this because you commented.Message ID: @.***>