Files
webstudio/fixtures/react-router-vercel/package.json
T
Oleg IsonenandCodex f30bdb7679 fix: Keep malformed styles from blocking publish (#6665)
Malformed saved CSS can stop a site from publishing. This restores
Vite's stylesheet pipeline with Lightning CSS and lets publishing
continue when generated CSS is invalid.

## What changed

- Save validation uses the shared CSS parser for touched declarations
and now rejects malformed style state selectors. The CSS editor already
reports malformed pasted declarations and omits them from saved styles.
- Publish skips older malformed declarations and warns without including
their values.
- Generated CSS is imported by Remix, React Router, and Vike, so Vite
processes the stylesheet and emits its asset.
- Before Vite runs, the CLI checks generated CSS with Lightning CSS and
esbuild. If the stylesheet cannot build, it warns and uses preset and
font CSS; if that also fails, it uses an empty stylesheet.
- The domain publish check parses the current project CSS and shows a
warning without blocking publish. The parser catches the malformed cases
reproduced with Lightning CSS and esbuild; the CLI's compiler check
remains the final guard. It skips malformed declarations just as the CLI
does. The early check reads assets and generates and parses CSS once
more per validation. Content Block styles created during publishing and
static template publishing are covered by the CLI fallback, but not by
this early warning.
- The temporary hashed public stylesheet path and its larger fixture
size allowances are removed. The direct PostCSS dependency remains
removed.

## Checklist

- [x] Restore Vite CSS imports with Lightning CSS in every site
template.
- [x] Keep malformed CSS from failing publish and warn when fallback CSS
is used.
- [x] Test the reported escaped property in React Router and Cloudflare
Remix builds.
- [x] Test malformed CSS recovery in React Router and Vike builds.
- [x] Verify the prerendered Vike page links to the generated CSS asset.
- [x] Regenerate fixtures and review the diff.
- [x] Review documentation impact: the existing publishing guide needs
no change for this warning in the publish flow.
- [x] Run CLI typecheck, lint, formatting, package boundaries, CLI
build, and frozen lockfile check.
- [x] Confirm CSS compiler failure cases with focused tests.
- [x] Validate CSS-affecting inputs at save, including style states that
bypass the editor picker.
- [x] Warn in domain pre-publish validation when current project CSS
fails compiler checks.
- [x] Verify pasted CSS diagnostics and save behavior in the editor.
- [x] Review the new diff and rerun relevant tests, typechecks, and
Builder build.
- [x] Remove the Builder runtime's native Lightning CSS dependency and
test the known compiler failure cases with CSS-tree.
- [x] Verify staging Builder and CLI workflows for the latest commit.
- [ ] Verify a site publish on staging with a project compatible with
this branch. The first attempt used a project with a style source type
this branch cannot read.
- [x] Reject CSS-tree recoverable parse errors in declaration validation
and add a regression test.
- [x] Keep project-build within its existing package entrypoints and
rerun the affected checks.
- [x] Monitor required PR checks to completion.

## Verification

Local: affected tests, four package typechecks, Builder and CLI builds,
root lint, formatting, package boundaries, and frozen lockfile check
passed. The fixture pipeline passed for the earlier commit; this commit
changes no fixture inputs or outputs. The new invalid-declaration
regression test failed when its filter was removed, then passed when
restored. The incomplete `rgb()` parser test failed before the review
fix and passed afterward. Full css-data and project-build test suites
passed. The Builder runtime uses CSS-tree for the early warning because
Vercel omitted Lightning CSS's native binary from the deployed function;
the CLI still runs Lightning CSS and esbuild during publishing. The
replacement staging deployment, fixture checks, both CLI R2 workflows,
main workflow, and all required PR checks passed.

Staging publish attempt: CLI sync stopped at `build.styleSources[520]`
before CSS generation. This branch accepts only `token` and `local`
sources; open PR #6663 adds `tagStyle` and the CSS generation it needs.
The failing record could not be read directly with the available share
token, so the exact saved type remains unconfirmed. Use a project
without Tag styles, or test a combined integration branch after an
explicit scope decision.

Replaces #6662.

---------

Co-authored-by: Codex <codex@users.noreply.github.com>
2026-11-09 18:02:11 +01:00

59 lines
2.2 KiB
JSON

{
"name": "webstudio-react-router-vercel",
"scripts": {
"typecheck": "tsc --noEmit",
"cli": "NODE_OPTIONS='--conditions=webstudio --import=tsx' webstudio",
"cli:local": "node ../../packages/cli/local.js",
"fixtures:link": "pnpm cli:local link --link https://p-d845c167-ea07-4875-b08d-83e97c09dcce-dot-${BUILDER_HOST:-main.development.webstudio.is}'?authToken=e9d1343f-9298-4fd3-a66e-f89a5af2dd93'",
"fixtures:sync": "pnpm cli:local sync --buildId f565d527-32e7-4731-bc71-aca9e9574587 && oxfmt ./.webstudio/",
"fixtures:build": "pnpm cli:local build --template vercel --template .template && oxfmt ./app/ ./package.json ./tsconfig.json",
"build": "node ./node_modules/@react-router/dev/bin.js build",
"dev": "node ./node_modules/@react-router/dev/bin.js dev",
"deploy": "npx vercel deploy",
"start": "node ./node_modules/@react-router/serve/bin.js ./build/server/index.js"
},
"dependencies": {
"@react-router/dev": "^7.5.3",
"@react-router/fs-routes": "^7.5.3",
"@react-router/node": "^7.5.3",
"@vercel/react-router": "^1.1.0",
"@webstudio-is/image": "workspace:*",
"@webstudio-is/react-sdk": "workspace:*",
"@webstudio-is/sdk": "workspace:*",
"@webstudio-is/sdk-components-animation": "workspace:*",
"@webstudio-is/sdk-components-react": "workspace:*",
"@webstudio-is/sdk-components-react-radix": "workspace:*",
"@webstudio-is/sdk-components-react-router": "workspace:*",
"isbot": "^5.1.25",
"react": "18.3.0-canary-14898b6a9-20240318",
"react-dom": "18.3.0-canary-14898b6a9-20240318",
"react-router": "^7.5.3",
"vite": "^6.3.4",
"webstudio": "workspace:*",
"@webstudio-is/wsauth": "workspace:*",
"@react-router/serve": "^7.5.3",
"@shikijs/langs": "4.4.1",
"@shikijs/themes": "4.4.1",
"shiki": "4.4.1",
"lightningcss": "1.31.1"
},
"private": true,
"type": "module",
"sideEffects": false,
"devDependencies": {
"@types/react": "^18.2.70",
"@types/react-dom": "^18.2.25",
"typescript": "7.0.2"
},
"engines": {
"node": ">=22.12.0"
},
"devEngines": {
"runtime": {
"name": "node",
"version": ">=22.12.0",
"onFail": "error"
}
}
}