From f1910d13172011decb08b4ca97ae4614bbb90bcf Mon Sep 17 00:00:00 2001 From: KCM Date: Tue, 23 Dec 2025 19:32:46 -0600 Subject: [PATCH] docs: odd prime numbers rule. --- README.md | 243 +++------------------------- package-lock.json | 269 +------------------------------ packages/css/README.md | 247 ++++++++++++++++++++++++++++ packages/css/package.json | 5 +- packages/playwright/package.json | 2 +- 5 files changed, 277 insertions(+), 489 deletions(-) create mode 100644 packages/css/README.md diff --git a/README.md b/README.md index 02a28e9..3f51f87 100644 --- a/README.md +++ b/README.md @@ -1,246 +1,53 @@ -# [`@knighted/css`](https://github.com/knightedcodemonkey/css) +# [`@knighted/css`](https://www.npmjs.com/package/@knighted/css) ![CI](https://github.com/knightedcodemonkey/css/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/knightedcodemonkey/css/graph/badge.svg?token=q93Qqwvq6l)](https://codecov.io/gh/knightedcodemonkey/css) [![NPM version](https://img.shields.io/npm/v/@knighted/css.svg)](https://www.npmjs.com/package/@knighted/css) -`@knighted/css` walks your JavaScript/TypeScript module graph, compiles every CSS-like dependency (plain CSS, Sass/SCSS, Less, vanilla-extract), and ships both the concatenated stylesheet string and optional `.knighted-css.*` imports that keep selectors typed. Use it when you need fully materialized styles ahead of runtime—Shadow DOM surfaces, server-rendered routes, static site builds, or any entry point that should inline CSS without spinning up a full bundler. +`@knighted/css` is a zero-bundler CSS pipeline for JavaScript and TypeScript projects. Point it at an entry module and it walks the graph, compiles every CSS-like dependency (CSS, Sass/SCSS, Less, vanilla-extract), and hands back both a concatenated stylesheet string and optional `.knighted-css.*` selector manifests for type-safe loaders. -## Why +## What it does (at a glance) -I needed a single source of truth for UI components that could drop into both light DOM pages and Shadow DOM hosts, without losing encapsulated styling in the latter. +- **Graph walking**: Follows `import` trees the same way Node does (tsconfig `paths`, package `exports`/`imports`, hash specifiers, etc.) using [`oxc-resolver`](https://github.com/oxc-project/oxc-resolver). +- **Multi-dialect compilation**: Runs Sass, Less, Lightning CSS, or vanilla-extract integrations on demand so every dependency ends up as plain CSS. +- **Loader + CLI**: Ship CSS at runtime via `?knighted-css` loader queries or ahead of time via the `css()` API and the `knighted-css-generate-types` command. +- **Shadow DOM + SSR ready**: Inline styles in server renders, ship them alongside web components, or keep classic DOM apps in sync—all without wiring a full bundler. -## Quick Links +See the [docs/](./docs) directory for deep dives on loaders, type generation, specificity boosts, Sass aliases, and the combined import queries. -- [Features](#features) -- [Requirements](#requirements) -- [Installation](#installation) -- [Quick Start](#quick-start) -- [API](#api) -- [Entry points (`import`)](#entry-points-at-a-glance) -- [Examples](#examples) -- [Demo](#demo) +## Workspaces in this repo -## Features +| Workspace | NPM Name | What it contains | +| --------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `packages/css` | [`@knighted/css`](https://www.npmjs.com/package/@knighted/css) | The production library: graph walker, compilation pipeline, loader helpers, CLI, and docs. Published to npm and meant for real builds. | +| `packages/playwright` | `@knighted/css-playwright-fixture` | The end-to-end demo + regression suite. Playwright drives Lit + React examples, hash-import workspace scenarios, and SSR checks to ensure the core package keeps working across bundlers. | -- Traverses module graphs with a built-in walker to find transitive style imports (no bundler required). -- Resolution parity via [`oxc-resolver`](https://github.com/oxc-project/oxc-resolver): tsconfig `paths`, package `exports` + `imports`, and extension aliasing (e.g., `.css.js` → `.css.ts`) are honored without wiring up a bundler. -- Compiles `*.css`, `*.scss`, `*.sass`, `*.less`, and `*.css.ts` (vanilla-extract) files out of the box. -- Optional post-processing via [`lightningcss`](https://github.com/parcel-bundler/lightningcss) for minification, prefixing, media query optimizations, or specificity boosts. -- Pluggable resolver/filter hooks for custom module resolution (e.g., Rspack/Vite/webpack aliases) or selective inclusion. -- First-class loader (`@knighted/css/loader`) so bundlers can import compiled CSS alongside their modules via `?knighted-css`. -- Built-in type generation CLI (`knighted-css-generate-types`) that emits `.knighted-css.*` selector manifests so TypeScript gets literal tokens in lockstep with the loader exports. +Each workspace is a standalone npm project. Run commands from the repo root with `npm run