ericcornelissen/webmangler

Use `node:` protocol when importing builtin modules

Opened this issue · 1 comments

Refactor

Description

Update all the code to use node: imports for all builtin modules (e.g. fs to node:fs or path node:path). For a motivation, see the (linked) documentation.

Considering the version history of node: imports (taken from the (linked) documentation):

Version Changes
v14.18.0, v16.0.0 Added node: import support to require(...)
v14.13.1, v12.20.0 Added in: v14.13.1, v12.20.0

Partial support (i.e. only with import x from "y") for node: imports was added in later v12 (12.20.0 and up) and v14 (14.13.1 and up) releases and full support is only present since later v14 (14.18.0 and up) releases and all releases since v16 (16.0.0 and up). This means package code should only adopt node: imports once their engines.node value (in packages/[package]/package.json) is such that consumers can be "guaranteed" to support it.

Progress

  • packages/benchmarking, BLOCKED
    • >=12.16.0
    • The core and all language packages (core, language-css, language-html, language-js)
  • packages/cli (#416)
  • packages/core (#418)
  • packages/language-css >=12.16.0)
  • packages/language-html (>=12.16.0)
  • packages/language-js (>=12.16.0)
  • packages/language-utils, BLOCKED
    • >=12.16.0
    • All language packages (language-css, language-html, language-js)
  • packages/mangler-css-classes (>=12.16.0)
  • packages/mangler-css-variables (>=12.16.0)
  • packages/mangler-html-attributes (>=12.16.0)
  • packages/mangler-html-ids (>=12.16.0)
  • packages/mangler-utils (>=12.16.0)
  • packages/mangler-testing (>=12.16.0)
  • packages/mangler-types (>=12.16.0)
  • scripts/ (#303)
  • ./ (#303)

Related

Upon evaluating all packages I found that only the following packages currently (01f4005) depend on builtin modules: