stylelint icon indicating copy to clipboard operation
stylelint copied to clipboard

Replace `@dual-bundle/import-meta-resolve` with `import-meta-resolve`

Open ybiquitous opened this issue 1 year ago • 5 comments

In PR #7532, we introduced the @dual-bundle/import-meta-resolve package to support both ESM and CJS, which is a fork of import-meta-resolve that is pure ESM.

When we switch to pure ESM (maybe in the next major version), we can replace @dual-bundle/import-meta-resolve with import-meta-resolve.

See also the code below:

https://github.com/stylelint/stylelint/blob/a211d8bb2bd2d4c5319852ef4fb35c83f1a82bc3/lib/utils/resolveSilent.mjs#L6-L7

[!NOTE] Node.js has provided the import.meta.resolve() API, and we would like to use the API instead of import-meta-resolve, but it is still experimental. In addition, the --experimental-import-meta-resolve flag is necessary to use the second argument parent (at the point of Node.js 21.7.1). So it may be difficult to switch import.meta.resolve() in the next major version.

ybiquitous avatar Mar 11 '24 13:03 ybiquitous

Upgrading to Node.js 22.0.0 and running Stylelint leads to (node:202332) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.. It comes from @dual-bundle/import-meta-resolve/lib/resolve.js:139:12. So replacing this package is important to also fix this (if the other one has already resolved that deprecation).

boris-petrov avatar Apr 28 '24 04:04 boris-petrov

@boris-petrov I believe you're describing https://github.com/wooorm/import-meta-resolve/issues/27, right?

JounQin avatar Apr 28 '24 06:04 JounQin

@JounQin yes. It's good there is an issue so hopefully it will be fixed at some point. :)

boris-petrov avatar Apr 28 '24 15:04 boris-petrov

https://github.com/wooorm/import-meta-resolve/releases/tag/4.1.0 now resolved the deprecation warning.

@JounQin Could you merge the upstream change into @dual-bundle/import-meta-resolve, please?

ybiquitous avatar Apr 30 '24 13:04 ybiquitous

@dual-bundle/[email protected] has been released.

cc @boris-petrov

JounQin avatar May 09 '24 05:05 JounQin