This package builds the demo surface Playwright hits in CI. It now covers three scenarios:
- Lit + React wrapper (bundled via Rspack/Webpack): exercises vanilla CSS, Sass/Less, vanilla-extract, combined loader queries, and the attribute-import card that uses
with { type: "css" }in a bundled flow. - Hash-imports workspace demo: minimal npm workspace under
src/hash-imports-workspace/proving@knighted/css/loaderandcss()respect hash-prefixedpackage.json#imports(#workspace/*). - Native CSS import attributes (no bundler): plain ESM page at
/src/native-attr/index.htmlthat imports./native-attr.csswith{ type: 'css' }and applies the stylesheet at runtime. - Mode fixture (declaration/module variants):
/src/modeshowcases single-specifier declaration imports, hashed selectors, and strict sidecar behavior under the resolver plugin.
- Full matrix (default):
npm test(runs chromium plus webpack + SSR builds). - Hash-imports only:
npm run test -- --project=chromium hash-imports.spec.ts. - Local preview server:
npm run preview -w @knighted/css-playwright-fixture(serves at http://localhost:4174 after building Rspack/webpack/SSR outputs).
The mode demo (/mode.html) is built via rspack.mode.config.js. It depends on declaration sidecars generated by knighted-css-generate-types and a strict manifest used by the resolver plugin.
Key pieces:
npm run types:modegenerates declaration sidecars for the mode fixtures, including a strict-only path forstrict-ok-card.tsx.npm run types:modealso writes the merged strict manifest to.knighted-css-mode/knighted-manifest.jsonviascripts/generate-mode-types.ts.- The manifest is produced by passing a manifest path to
knighted-css-generate-types(declaration mode only) and then merging the per-mode outputs. - The resolver plugin is configured with
strictSidecar: trueandmanifestPathso single-specifier imports like./declaration-card.jsrewrite to?knighted-cssat build time without warnings.
If you are debugging the mode fixture, use KNIGHTED_CSS_DEBUG_MODE=1 npm run build:mode to see rewrite decisions in the terminal.
- Bundled path (Lit/React attribute card): after
npm run preview -w @knighted/css-playwright-fixture, open http://localhost:4174/ and locate the card with test iddialect-attr-import(rendered bylit-react.spec.ts). - Native path (no bundler): open http://localhost:4174/src/native-attr/index.html. Chrome 123+ supports CSS module scripts; the page adopts the imported stylesheet so you should see the chip styling without the "Waiting for styles…" placeholder.