Skip to content

Can't compile due to bug in dependency deno_ast=0.49.0 #409

@ozaner

Description

@ozaner

Describe the bug

rustyscript v0.12.3 fails to build, giving a serde::__private import error. The issue is caused by a breaking change in serde that found itself upstream to deno_ast v0.49.0 which is the version pinned by rustyscript in its Cargo.toml.

Error:

error[E0432]: unresolved import `serde::__private`
 --> swc_config-3.0.0\src\types\bool_or_data.rs:128:20
  |
128 |         use serde::__private::de;
    |                    ^^^^^^^^^ could not find `__private` in `serde`

To Reproduce

Tested on both Windows and Ubuntu (via WSL2). Steps to reproduce the behavior:

  1. Create a new Rust project: cargo new test-rustyscript && cd test-rustyscript
  2. Add rustyscript: cargo add rustyscript --features fs_import,url_import
  3. Set environment variable to avoid NASM requirement (due to deno using the aws-lc-rs crate, see here):
    • Windows (PowerShell): $env:AWS_LC_SYS_NO_ASM = "1"
    • Linux/macOS (Bash): export AWS_LC_SYS_NO_ASM=1
  4. Build: cargo build
  5. See error (build fails with serde::__private error)

Expected behavior

The project should build successfully without errors.

Root Cause
rustyscript's Cargo.toml (line 176) pins deno_ast = "=0.49.0", which depends on the broken swc_config v3.0.0.

rustyscript v0.12.3
  └─ deno_ast v0.49.0         ← Pinned to exact version
      └─ swc_config v3.0.0    ← Has serde::__private bug

The Fix

Change this line in rustyscript's Cargo.toml (line 176):

- deno_ast = { version = "=0.49.0", features = ["transpiling", "cjs"] }
+ deno_ast = { version = "0.50", features = ["transpiling", "cjs"] }

I tested it, and it compiles fine once deno_ast's version is bumped.

Why this works:

  • deno_ast v0.50+ uses swc_config v3.1.2 (which has the serde fix)
  • deno_ast v0.49.0 uses swc_config v3.0.0 (broken)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions