Skip to content

tracking: use primordials in Node compatibility layer #24236

Open
@iuioiua

Description

@iuioiua

How to do this quickly

  1. Remove the following from the file:
    // TODO(petamoriken): enable prefer-primordials for node polyfills
    // deno-lint-ignore-file prefer-primordials
    
  2. Run tools/lint.js to get the list of symbols that need to be replaced with primordials.
  3. Import primordials and the appropriate symbols. E.g.:
    import { primordials } from "ext:core/mod.js";
    
    const { StringPrototypeSlice, StringPrototypeCharCodeAt, TypeError } = primordials;
  4. Replace the symbols with the primordials. This can be done via VSCode's find and replace. E.g. for String.prototype.charCodeAt, search for while using regex:
    (\w+).charCodeAt\(
    
    Replace it with:
    StringPrototypeCharCodeAt($1, 
    

Use https://github.com/denoland/deno_core/blob/main/core/core.d.ts for list of available primordials.

Remaining files

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions