unjs / mlly

🤝 Common ECMAScript module utils
MIT License
456 stars 34 forks source link

Node 22: `fs.Stats` constructor is deprecated #246

Closed RobinTail closed 5 months ago

RobinTail commented 5 months ago

For your information, this warning appears when running vitest in Node 22 environment:

(node:2057) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.

I managed to figure out that it comes from mlly being the dependency of vitest:

=> Found "mlly@1.6.1"
info Reasons this module exists
   - "vitest#local-pkg" depends on it
   - Hoisted from "vitest#local-pkg#mlly"
   - Hoisted from "vitest#local-pkg#pkg-types#mlly"

The exact statement causing the issue is not present in the source code of mlly, but is generated in its build/distribution by rollup:

image

Consider upgrading rollup and its relatives, or adjust the line of code that may lead to that statement in production.

There is also a duplication of rollup in your lock file:

https://github.com/unjs/mlly/blob/c282adb509cdb6a96343095504d6feeffd65217b/pnpm-lock.yaml#L2171-L2176

srbarba commented 5 months ago

Same problem nuxt:

https://github.com/nuxt/cli/issues/405

danielroe commented 5 months ago

This was an upstream issue (https://github.com/wooorm/import-meta-resolve/issues/27) which is resolved in v4.1.0 of import-meta-resolve, but because mlly inline import-meta-resolve, it may take a little while for the fix to percolate downward.

pi0 commented 5 months ago

Fix already merged via https://github.com/unjs/mlly/pull/249

pi0 commented 5 months ago

https://github.com/unjs/mlly/releases/tag/v1.7.0


For nuxt users, you need a new nuxi release please followup via https://github.com/nuxt/cli/issues/405