Skip to content

feat: pass the source file name to the preload filter for fonts#16443

Open
Nic-Polumeyv wants to merge 9 commits into
sveltejs:version-3from
Nic-Polumeyv:feat-preload-font-name
Open

feat: pass the source file name to the preload filter for fonts#16443
Nic-Polumeyv wants to merge 9 commits into
sveltejs:version-3from
Nic-Polumeyv:feat-preload-font-name

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Implements the name property from #16424 (comment).

name is looked up from the Vite client manifest where the fonts arrays are built, so the filter receives the exact source file name. Deriving it from the emitted path was wrong two ways, the bundler sanitizes characters (inter+bold.woff2 is emitted as inter_bold.<hash>.woff2) and content-identical assets are emitted once under a single name. The union includes name for font only, kit never calls preload with type asset.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 20, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 0f6fcc8:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/0f6fcc8892a19d7384438ce2eb30b94d7cd8e06e

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16443

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0f6fcc8

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Minor

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

@Nic-Polumeyv
Nic-Polumeyv force-pushed the feat-preload-font-name branch 3 times, most recently from a27e18b to 274fa31 Compare July 20, 2026 19:40
Assets are emitted as `[name].[hash][extname]`, so the source file name can
be recovered from the output path without a manifest lookup.

The font and modulepreload paths each branched on `link_header_preload`
themselves; a Link header value is the `<link>` attribute list joined with
`; ` plus `nopush`, so one helper now covers both.
@Nic-Polumeyv
Nic-Polumeyv force-pushed the feat-preload-font-name branch from 274fa31 to be0eacd Compare July 20, 2026 19:47
@Nic-Polumeyv
Nic-Polumeyv marked this pull request as ready for review July 20, 2026 19:47
elliott-with-the-longest-name-on-github pushed a commit that referenced this pull request Jul 20, 2026
extracts the drive-by improvements in #16443 to reduce the size of that
diff (am weighing a slightly different approach, but this change
unambiguously makes sense)

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
…ont-name

# Conflicts:
#	packages/kit/src/runtime/server/page/render.js
@Nic-Polumeyv

Copy link
Copy Markdown
Contributor Author

Merged #16445 back in, the diff is feature-only now.

@Nic-Polumeyv Nic-Polumeyv changed the title feat: pass name to the preload filter for fonts and assets feat: pass the source file name to the preload filter for fonts Jul 21, 2026
@Nic-Polumeyv

Copy link
Copy Markdown
Contributor Author

Reworked, name is now looked up from the Vite manifest instead of derived from the emitted path, so the filter receives the exact source name and the sanitization caveat is gone. Also narrowed name to font only, kit never calls preload with type asset.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant