Skip to content

globals: legacy escape()/unescape() throw ReferenceError; bare Node global unresolved #4511

Description

@proggeramlug

Summary

The legacy global functions escape() / unescape() (ECMAScript Annex B,
still standard and present in Node) are not defined — calling them throws
ReferenceError at runtime.

Minimal repro

console.log(escape("a b+c"), unescape("a%20b"));
$ perry run t_escape.ts
ReferenceError: identifier is not defined
    at <anonymous>

Expected

a%20b%2Bc a b

Notes

  • Used in the wild by qs (qs/lib/utils.js) for %uXXXX decoding, so any
    app pulling in qs (e.g. via stripe) hits this.
  • Closely related: the Node global object is likewise unresolved — (global as any).x emits Warning: unknown identifier 'global' — assuming global ....
    Both are missing global bindings. (globalThis works.)

Environment

perry 0.5.1122 · macOS arm64 · native host target.

Activity

  1. andrewtdiz commented on Jun 5, 2026

    @andrewtdiz
    Contributor

    I am taking this issue.

    Planned PR cut: add the missing Node-compatible global bindings for bare escape / unescape and global, then cover them with focused globals parity fixtures. Non-goals: broader URL/querystring behavior changes, global object descriptor rewrites outside these bindings, and unrelated globals inventory work.

  2. andrewtdiz commented on Jun 5, 2026

    @andrewtdiz
    Contributor

    Opened PR: #4545

    This adds Node's global alias plus legacy Annex B escape/unescape globals, including descriptor/name/length behavior, rebound calls, %uXXXX handling, and Symbol TypeErrors.

    Validation on the final rebased branch:

    • cargo fmt --all -- --check
    • git diff --check origin/main..HEAD
    • ./scripts/check_file_size.sh
    • jq empty test-parity/known_failures.json
    • env RUSTC_WRAPPER= TMPDIR=$PWD/target/tmp CARGO_BUILD_JOBS=1 cargo check -q -p perry-runtime -p perry-hir -p perry-codegen
    • node-suite/globals/legacy-escape-global: 1 pass / 0 parity fail / 0 compile fail (parity_report_20260605_075255.json)
    • node-suite/globals/global-functions: 1 pass / 0 parity fail / 0 compile fail (parity_report_20260605_075512.json)
    • full node-suite/globals: 86 pass / 0 parity fail / 0 compile fail / 0 skipped (parity_report_20260605_075659.json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions