Skip to content

Normalize dirent entry path across node versions when generating SRI manifest #13591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

pawelblaszczyk5
Copy link
Contributor

@pawelblaszczyk5 pawelblaszczyk5 commented May 12, 2025

Fixes #13590

entry.path on Dirent is deprecated since a few versions and removed as of Node version 24 nodejs/node#55548

image

https://nodejs.org/docs/latest-v23.x/api/fs.html#direntpath

Since RR declares engines as working with any minor/patch version above 20.x.x - I can’t just directly use the parentPath which is recommended now. I normalize it so it works also in few minors that have dirent.path but don't have dirent.parentPath. Also a bit of gymnastics for TS is needed because installed version of types for node doesn’t include the parentPath

Copy link

changeset-bot bot commented May 12, 2025

🦋 Changeset detected

Latest commit: 2613db5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@react-router/dev Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch
react-router Patch
react-router-dom Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented May 12, 2025

Hi @pawelblaszczyk5,

Welcome, and thank you for contributing to React Router!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@pawelblaszczyk5 pawelblaszczyk5 force-pushed the normalize-dirent-entry-path-across-node-versions branch from 4f597b9 to 779a1d1 Compare May 12, 2025 10:56
@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented May 12, 2025

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@brophdawg11
Copy link
Contributor

What version doesn't parentPath work in? It looks like it's there in 20 - https://nodejs.org/docs/latest-v20.x/api/fs.html#class-fsdirent. Was it a lower 20.x version that it got introduced?

@pawelblaszczyk5
Copy link
Contributor Author

What version doesn't parentPath work in? It looks like it's there in 20 - https://nodejs.org/docs/latest-v20.x/api/fs.html#class-fsdirent. Was it a lower 20.x version that it got introduced?

image

Here's the exact versions that introduced it from node fs docs

@brophdawg11
Copy link
Contributor

Thanks! I'll get this merged once CI runs

@brophdawg11 brophdawg11 merged commit 728dc96 into remix-run:dev May 12, 2025
7 of 8 checks passed
Copy link
Contributor

🤖 Hello there,

We just published version 7.6.1 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants