Skip to content

chore: standardize configuration, environment, and tsconfig diagnostics - #17251

Merged
Rich-Harris merged 5 commits into
version-3from
message-box/config-sync
Oct 1, 2026
Merged

Rich-Harris merged 5 commits into
version-3from
message-box/config-sync

Conversation

@elliott-with-the-longest-name-on-github

Copy link
Copy Markdown
Contributor

Moves config validation, src/env, and tsconfig diagnostics to the @sveltejs/message-box-generated catalog, creating:

  • A build-warnings category
  • An options argument on build-errors, allowing cause, stackless, and location to be provided
  • A helper that all errors can share, which decreases generated code size significantly. Part of the reason this compaction is possible is because these errors can't ever show up in non-dev/build environments, so we don't need to do any esm-env trickery to remove the longer messages in some environments

Small bonus, core/config/options.js became a whole lot shorter because the prose is now in markdown.


Stack created with GitHub Stacks CLI • Give Feedback 💬

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from e6e9fae:

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

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

@changeset-bot

changeset-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e6e9fae

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 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

@elliott-with-the-longest-name-on-github
elliott-with-the-longest-name-on-github added this pull request to stack #17254 September 28, 2026 22:17
@svelte-docs-bot

Copy link
Copy Markdown

Base automatically changed from message-box/integration to version-3 September 30, 2026 14:15
Comment thread packages/kit/src/messages/build-errors.js Outdated
vercel Bot and others added 2 commits September 30, 2026 17:27
…ild-warnings.js` are out of sync with their `.md` sources after the "backticks" commits, and the unit tests still assert the pre-backtick strings.

This commit fixes the issue reported at packages/kit/src/messages/build-errors.js:53

## The bug

The message catalog is authored in `packages/kit/messages/**/*.md` and compiled into `packages/kit/src/messages/{build-errors,build-warnings}.js` by `scripts/process-messages/index.js` (run via `pnpm generate:messages`, part of the required `prepublishOnly`). The generated files carry a `Do not edit!` banner and are committed.

Commits `0191cfb` and `c1f1c51` ("backticks") wrapped interpolated values in backticks in the `> ...` blockquote lines of the `.md` sources (e.g. `messages/build-errors/config.md` now has `` > `%keypath%` cannot start or end with `'/'` ``), but the generated `.js` files were **not** regenerated. So they still emitted the old strings, e.g.:

```js
// build-errors.js (stale)
throw_error('config_app_dir_slash', `${_values.keypath} cannot start or end with '/'`, ...)
```

### How this manifests

Running the repo's own required `pnpm -F @sveltejs/kit generate:messages` (invoked by `prepublishOnly`) regenerates the modules **with** backticks, producing a diff against the committed files. I reproduced this exactly: after installing `@sveltejs/message-box@1.1.3` and running the script, `git diff` showed 128 changed lines in `build-errors.js` and 12 in `build-warnings.js` — confirming the committed output was stale.

Worse, the unit tests assert the **pre-backtick** strings. Once the generated code is corrected, these tests fail. Confirmed failure sites include:

- `src/core/config/index.spec.js` — ~20 assertions such as `/^config.appDir cannot start or end with '/'$/`, `/^config.appDir should be a string, if specified$/`, prerender-entries, origin, csp, tracing, etc.
- `src/core/sync/write_tsconfig/index.spec.js:50,104` — `tsconfig.json should extend ...` / `Found issues while validating tsconfig.json:` (no backticks).

## The fix

1. **Regenerated** `build-errors.js` and `build-warnings.js` by actually running `node scripts/process-messages/index.js` (with `@sveltejs/message-box` installed), so the generated output now matches the `.md` sources byte-for-byte instead of being hand-edited.
2. **Updated the affected spec assertions** in `config/index.spec.js` and `write_tsconfig/index.spec.js` to include the new backticks, following each message's exact backtick placement from the `.md` diff (e.g. keypath is backticked in `config_expected_one_of` but the `%options%` list is not; in `config_extension_missing_dot` the keypath is *not* backticked but the `'.'`/extension are).

### Verification

- `npx vitest run src/core/config/index.spec.js` → **49/49 pass** (previously these assertions would break against regenerated code).
- `write_tsconfig/index.spec.js` has 3 failing tests, but these are **pre-existing environmental failures** (`warn` is called 0 times because TypeScript-based validation is skipped in this sandbox) that fail identically before and after this change — unrelated to the backtick sync.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: elliott-with-the-longest-name-on-github <hello+github@ell.iott.dev>
@Rich-Harris
Rich-Harris merged commit 6c79b46 into version-3 Oct 1, 2026
41 checks passed
@Rich-Harris
Rich-Harris deleted the message-box/config-sync branch October 1, 2026 12:38
Rich-Harris pushed a commit that referenced this pull request Oct 1, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to version-3, this PR
will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-3` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `version-3`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @sveltejs/kit@3.0.0-next.32

### Patch Changes

- fix: prevent non-redirect enhanced form results from navigating to
another origin
([`91aae35`](91aae35))

- fix: escape cache-control headers in prerendered HTML
([`d9d55b5`](d9d55b5))

- fix: revert route metadata caching to regenerate missing root-route
types during sync ([#17281](#17281))

- fix: print `builder.log.warn` messages to stderr, as documented
([#17253](#17253))

- fix: prevent path traversal when previewing prerendered pages and data
on Windows
([`538edbf`](538edbf))

- chore: standardize remote-function and shared form diagnostics
([#17277](#17277))

- fix: prevent server-side self-fetch fallbacks from following redirects
([`b11bb87`](b11bb87))

- chore: standardize app template diagnostics
([#17250](#17250))

- chore: standardize Vite plugin, build, prerender and adapter
diagnostics ([#17253](#17253))

- chore: standardize client navigation, preload, snapshot and
enhancement diagnostics
([#17276](#17276))

- chore: standardize configuration, environment and tsconfig diagnostics
([#17251](#17251))

- chore: standardize public API, `$app/*` and deprecated module
diagnostics ([#17265](#17265))

- chore: standardize route discovery, parameter and route export
diagnostics ([#17252](#17252))

- chore: standardize server request, hook and page diagnostics
([#17275](#17275))

- fix: report tsconfig parse errors on Windows
([#17251](#17251))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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