Skip to content
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

feat: unstable_subResourceIntegrity #13163

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

feat: unstable_subResourceIntegrity #13163

wants to merge 6 commits into from

Conversation

jacob-ebey
Copy link
Member

@jacob-ebey jacob-ebey commented Mar 5, 2025

Introduce unstable_subResourceIntegrity future flag that enables generation of an importmap with integrity for the scripts that will be loaded by the browser.

Available in 0.0.0-experimental-35027c3be

Copy link

changeset-bot bot commented Mar 5, 2025

🦋 Changeset detected

Latest commit: 1f21bdf

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 Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
@react-router/architect Patch
@react-router/cloudflare Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
create-react-router 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

@jacob-ebey jacob-ebey changed the base branch from main to dev March 5, 2025 19:46
…`<Scripts>` and `unstable_subResourceIntegrity` future flag.
@jacob-ebey jacob-ebey changed the title Sri feat: unstable_subResourceIntegrity Mar 5, 2025
@jacob-ebey jacob-ebey marked this pull request as ready for review March 6, 2025 04:20
@jacob-ebey jacob-ebey requested a review from Copilot March 6, 2025 04:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR introduces the "unstable_subResourceIntegrity" future flag to generate an importmap with integrity hashes for browser-loaded scripts. Key changes include generating an SRI manifest in the Vite plugin, updating manifest types and configurations to support the new flag, and modifying tests and playground configurations accordingly.

Reviewed Changes

File Description
packages/react-router-dev/vite/plugin.ts Adds SRI manifest generation and updates file system access.
.changeset/late-falcons-sort.md Updates changeset with the new feature flag message.
playground/framework/react-router.config.ts Enables the unstable flag in the playground configuration.
pnpm-lock.yaml Updates dependency versions related to the changes.
playground/framework/app/root.tsx Minor formatting adjustment.
packages/react-router/lib/dom/ssr/entry.ts Extends FutureConfig to include the new flag.
packages/react-router/lib/dom/ssr/components.tsx Renders SRI attributes in script and preload links.
packages/react-router-dev/manifest.ts Updates the manifest type with an optional sri field.
packages/react-router-dev/config/config.ts Propagates the new flag in configuration resolution.
packages/react-router/lib/dom/ssr/routes-test-stub.tsx Updates test stub to reflect the new flag.

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

packages/react-router-dev/vite/plugin.ts:823

  • The 'recursive' option is not supported in fs.readdirSync. Consider using a dedicated recursive file walker or fs.promises API with recursion to traverse subdirectories.
let entries = fs.readdirSync(clientBuildDirectory, {

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