Skip to content

chore: add Node-agnostic utils#15846

Merged
teemingc merged 3 commits into
version-3from
chore-node-free
May 18, 2026
Merged

chore: add Node-agnostic utils#15846
teemingc merged 3 commits into
version-3from
chore-node-free

Conversation

@teemingc
Copy link
Copy Markdown
Member

@teemingc teemingc commented May 15, 2026

splitting out changes from #15574

This PR creates and moves some utils to be Node-agnostic so that we can use them to resolve paths in the dev environment


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.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

⚠️ No Changeset found

Latest commit: 03781ef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@teemingc teemingc changed the title chore: move these to their own modules chore: node-free runtime May 15, 2026
@teemingc teemingc changed the title chore: node-free runtime chore: Node-agnostic runtime May 15, 2026
@svelte-docs-bot
Copy link
Copy Markdown

@teemingc teemingc marked this pull request as draft May 15, 2026 07:37
@teemingc
Copy link
Copy Markdown
Member Author

teemingc commented May 15, 2026

Making this a draft because after re-examining why we need this, we could instead make it so that we resolve the paths outside the environment then communicate them back to the environment.

EDIT: might not be worth doing that just for some path resolving actually. We also still need path.relative to resolve paths synchronously at https://github.com/sveltejs/kit/pull/15574/changes#diff-d2344aa425f99c605f40fdf8ea76be2f063c21cafc0402e044b1a9a254f60e7dR210 . Marking this as ready

@teemingc teemingc marked this pull request as ready for review May 15, 2026 12:00
@teemingc teemingc changed the title chore: Node-agnostic runtime chore: add Node-agnostic utils May 15, 2026
try {
const path = await import('node:path');

relative = (file) => path.relative('.', file);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was always supposed to use the Vite root setting rather than '.' which is the same as process.cwd(). I just couldn't figure out how to pass the root setting here until now

@teemingc teemingc requested a review from Rich-Harris May 15, 2026 13:23
@teemingc teemingc merged commit 2f740c3 into version-3 May 18, 2026
19 of 20 checks passed
@teemingc teemingc deleted the chore-node-free branch May 18, 2026 19:25
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.

2 participants