readmeio / rdme

ReadMe's official command-line interface (CLI) and GitHub Action 🌊
https://docs.readme.com/main/docs/rdme
MIT License
103 stars 42 forks source link

fix: use newest import attributes syntax #993

Closed kanadgupta closed 4 months ago

kanadgupta commented 4 months ago

🧰 Changes

TC39 updated their import assertions to be import attributes and it's a bit of a mess now that we're running tests against Node v22.

Here's what importing JSON in ESM used to look like:

import { x } from "./mod" assert { type: "json" }

now it looks like this:

import { x } from "./mod" with { type: "json" };

Support for this new with keyword was added in Node v18.20.0 and Node v20.10.0 (and is supported on all v21 and v22 channels), but importantly the older assert keyword is not supported in Node v22, so unfortunately our package.json#engines.node field is going to look a little ridiculous for the time being.

Details: https://github.com/tc39/proposal-import-attributes?tab=readme-ov-file#history

🧬 QA & Testing

Do tests pass?