@typestyles/build-runner
packages/build-runner/CHANGELOG.md
0.10.0
Minor Changes
- #350
3b624adThanks @dbanksdesign! - Extraction now resolves like the host bundler.runTypestylesExtract/runTypestylesBuildacceptconditionsandalias(passed to esbuild), and@typestyles/viteforwards the resolved config's customresolve.conditions(SSR ones first) and string aliases. Hosts without custom resolution behave as before.
Patch Changes
- #351
01d04a4Thanks @dbanksdesign! - The extraction bundle now compiles JSX with the automatic runtime (unless the project'stsconfig.jsonsetsjsx, or the newjsxoption is passed), so module-level JSX such asicon: <Icon />no longer throwsReact is not definedduring extraction.
0.9.0
Minor Changes
- #338
54535afThanks @dbanksdesign! - Add real CSS source maps for extracted CSS. Enable withextract.sourceMap: truein@typestyles/vite. Each extracted rule is mapped back to therecipe()/style()call site via a VLQ source map emitted as a companion.css.mapasset, referenced by a/*# sourceMappingURL=... */comment. The dev server also serves the map so the same mappings are available during development. The shared@typestyles/build-runnerextraction pipeline now captures per-rule source locations and generates the map, andtypestylesexposesgetRegisteredCssForSourceMap()for consumers that need the raw mapping data. This complementsextract.sourceCommentsandtypestyles/inspectwith a standard, tool-friendly source map.
0.8.1
Patch Changes
#316
e861e27Thanks @dbanksdesign! -compile: truekeeps recipe.vars. Client plans now record each recipe's var refs, and thetypestyles/litehandle exposes the same{ name, var }tree, so components that assign recipe vars per instance no longer crash in zero-runtime builds (#315).recipe.vars(and the treec.vars()returns) is now a frozen plain object instead of a Proxy, in both runtimes: reads are plain property lookups, andObject.keys, spread andJSON.stringifysee the nested refs. Dashed paths still read the same ref (vars['track-color']isvars.track.color).#316
e861e27Thanks @dbanksdesign! - Extraction now finds style modules under a dot directory (such as.storybook/styles.ts). A root-relative path starting with.was passed to esbuild without./, so it was resolved as a package name and the build failed.
0.8.0
Minor Changes
#310
ad6fe59Thanks @dbanksdesign! - Add an experimental compile-time transform (compile: true) for zero-runtime client bundles.Extraction now records a small JSON plan per
recipe()— base classes, slots, dimensions and defaults, i.e. everything a call needs — in the same Node run that produces the CSS (runTypestylesExtractreturns{ css, plans };runTypestylesBuildis unchanged). Withcompile: true, the Vite, Rollup, esbuild (and Bun), and webpack (and Rspack) integrations replacerecipe({ name, ... })definitions in client bundles withcreateAttrsRecipeFromPlan(<plan>)from the newtypestyles/liteentry (under 1 KB gzipped), and mark calls of style factories imported fromtypestyles(createTypeStyles,createStyles,createTokens,createGlobal) as pure. The style configs, token tables and CSS machinery they referenced then tree-shake away. Class names,data-*attributes and the emitted CSS are unchanged.Plans cover attribute-mode dimensioned and slot recipes, flat and multi-slot recipes, and the class-name modes (
semantic,bem,template,hashed,compact,atomic) for dimensioned recipes (with compound variants) plus slot recipes insemantic/bem/template. Parity with the real runtime is tested across a grid of selections. Calls that can't be planned (non-literal names, spreads in the recipe config, a name used in more than one scope, themes/tokens whose results are read at runtime, recipes in unsupported shapes) keep the runtime, and the Vite and Rollup integrations warn when a substantial part of it remains.On var-ui's bundle fixtures this removes about 80–105 KB of minified JS (button-only 312.7 → 230.2 KB, form-kit 457.9 → 367.3 KB, date-kit 512.9 → 421.7 KB).
@typestyles/vitereturns two plugins whencompile: true(the transform must run after Vite's own TypeScript transform); otherwise it still returns a single plugin. Rewritten modules keep accurate source maps, still go through duplicate-namespace checks, and are re-transformed in watch mode and with webpack's cache so plans never go stale. Plans are only recorded while extraction runs (getClientPlans()is empty in normal runtime builds), and extraction now returns its result through a temp file, so style modules that log to stdout no longer affect it.@typestyles/build-runnergains the shared transform (transformRecipeCalls,indexPlans, …) andacorn,magic-stringand@jridgewell/remappingdependencies.#307
429d477Thanks @dbanksdesign! - Zero-runtime client builds now ship no CSS insertion runtime — for every typestyles entry point.typestylespublishes its stylesheet module (dist/sheet.js) next to a no-op sibling (dist/sheet-noop.js) that exports the same API but does nothing. Every other module reaches the sheet through that one file, so inmode: 'build'the bundler integrations just redirect it in client bundles. The stylesheet state, CSSOM/DOM plumbing, insertion registry and dev-time collision bookkeeping never enter the module graph, while class names and data attributes are computed identically.- One module graph, one registry:
typestyles,typestyles/css,typestyles/color, … are all covered, with nothing to import differently and no specifier rewriting. @typestyles/vite(and@typestyles/astro) and@typestyles/rollup:resolveIdhook (client builds only for Vite).@typestyles/esbuild:onResolvehook (skipped forplatform: 'node').@typestyles/webpackand@typestyles/next/build: module-factory hook (non-node targets / client bundles only; server bundles keep the real runtime for SSR collection).mode: 'runtime'/'hybrid', development builds, and server/SSR/node builds keep the full runtime.- Vite, Rollup and webpack warn at build time if the real sheet still ends up in a zero-runtime client bundle.
- Development diagnostics (namespace/class-name collision tracking) are gated behind the sheet, so they are absent from zero-runtime bundles.
@typestyles/build-runnerexportstoZeroRuntimeSheetId,isSheetRequest,findRealSheetModules,zeroRuntimeLeakMessageandZeroRuntimeSheetWebpackPluginfor custom integrations.- The package also declares a conservative
sideEffectsallowlist (hmr,server,build,testing).
- One module graph, one registry:
0.7.0
Minor Changes
- #306
6b862abThanks @dbanksdesign! - Add opt-inextract.sourceCommentsto precede each extracted CSS rule with a/* path:line */comment naming therecipe()/style()call that registered it.@typestyles/vitepasses the option through to the extract; paths are relative to the project root. Runtime injection is unchanged becauseinsertRuledrops comments.
Patch Changes
#300
1266ee6Thanks @dbanksdesign! - Emit Vite extracted CSS as a content-hashed asset by default so production deploys cannot pair new JavaScript with a cachedtypestyles.css. Dev still serves the stable/typestyles.cssURL. Setextract.fileNameto a literal path to opt out, or use[hash]placeholders for a custom name.@typestyles/astrokeeps the stabletypestyles.cssname by default, because Astro pages do not pass through Vite's HTML rewrite.
0.6.4
Patch Changes
- #297
c894838Thanks @dbanksdesign! - Failvite buildwhen a local module reachable from the app callsrecipe()and is missing from the extract entry. Setcoverage: falseto extract a subset on purpose.
0.6.3
Patch Changes
- #287
7979a45Thanks @dbanksdesign! - Build with tsdown (via Vite+) instead of tsup. Public exports and types are unchanged; the output no longer includes JSDoc comments, and@typestyles/nextnow shares code between its entry points instead of duplicating it.
0.6.2
Patch Changes
- #282
612537eThanks @dbanksdesign! - Point the repository metadata at the phthalo-dev GitHub organization.
0.6.1
Patch Changes
- #276
31872bcThanks @dbanksdesign! - Breaking:recipe()andoverride()take one object. Positional calls (recipe(name, config),recipe(name, definition, callback), andoverride(component, config, options)) are removed. Declareslots, variant axes, andvarson that object and put option styles instyles, which is checked against those fields. Every call returns{ className, attrs, props }.
0.6.0
Minor Changes
- #251
35afeefThanks @dbanksdesign! - Public API redesign:createTypeStylesreturns a flat{ style, hash, recipe, tokens, global, … }surface; nestedlayers: { order, token, style, global? };global.rule/global.rules; remove rootstyles/tokens/globalsingletons. Migrate codemod emitsstyle/recipeviacreateTypeStyles. Cache-bust extract module imports so Next route CSS re-runs register styles.
0.5.3
Patch Changes
- #226
cf3f66cThanks @dbanksdesign! - Add component registry extract helpers andextract.registeredComponentsModule/include: 'allRegisteredComponents'(#219). The include flag appends a conventionthemeable-refsregistry module to the extract graph when it exists.
0.5.2
Patch Changes
- #128
41155b0Thanks @dbanksdesign! - FixrunTypestylesBuilddropping CSS from a component reached only through a plain bare import (import './some-lib';, no binding at all) of a package marked"sideEffects": false. This is a separate esbuild behavior from the tree-shaking-of-declarations bug fixed previously (treeShaking: false, in the prior patch) — it happens earlier, driven directly by thesideEffects/@__PURE__annotations, and drops the import before the module is ever considered for bundling, regardless of thetreeShakingsetting. A real extraction entry is exactly this shape: several side-effect-only imports, any one of which may point at a (correctly) tree-shakeable component library. The extraction bundle now also setsignoreAnnotations: trueso no import in the extraction graph is dropped based on these annotations.
0.5.1
Patch Changes
- #126
de79e3aThanks @dbanksdesign! - FixrunTypestylesBuilddropping CSS from components reached only through an unread namespace/barrel import. Style registration calls (styles.component,styles.class,createTypeStyles) are side-effect-only — the CSS they register is the point, independent of whether the returned classname function is ever read. esbuild's default tree shaking didn't know that, so a consumer's extraction entry that imports a tree-shakeable component library viaimport * as lib from '...'(never destructuring/reading a named export) could have that library's internal registration calls silently eliminated as "unused," especially for libraries marked"sideEffects": false. The extraction bundle now setstreeShaking: falseso every registration in the graph survives, matching real runtime behavior.
0.5.0
Minor Changes
#97
468375cThanks @dbanksdesign! - Add shared convention entry discovery across Rollup, esbuild, and webpack plugins; ship@typestyles/esbuildand@typestyles/webpack; extend discovery to.jsentry files; add Vue, Svelte, esbuild, and Parcel examples with build verification.#100
f5b9c6dThanks @dbanksdesign! - Per-route critical CSS for Next.js App Router (P2.15):buildTypestylesForNextemits route-scoped stylesheets and manifest v2 with aroutesmap;getRouteCssreads them at request time instead of the fullgetRegisteredCss()buffer.
Patch Changes
- #98
e17b8a0Thanks @dbanksdesign! - Add npm landing-page READMEs for every published package, an examples index with contributor guidance, and doc-to-example cross-links (P2.13).
0.4.0
Minor Changes
#75
8bf64b0Thanks @dbanksdesign! - Add shared convention entry discovery:discoverDefaultExtractModulesandDEFAULT_EXTRACT_MODULE_CANDIDATES(includingstyles/typestyles-entry.tsandstyles/typestyles.tsafter thesrc/…paths).@typestyles/vite re-exports these from
@typestyles/build-runnerand resolves optionalextract.modulesusing the same list.@typestyles/next depends on
@typestyles/build-runner, alignsbuildTypestylesForNextwith that discovery, defaultscssOutFiletoapp/typestyles.cssand manifest output unless overridden, addswithTypestylesfor production config when a convention file exists, and re-exports the discovery helpers.withTypestylesnow passesrootthrough to extraction internals so webpack resolution uses the same project root as convention discovery.Breaking (Next):
BuildTypestylesForNextOptionsno longer requiresmodulesorcssOutFile; pass them explicitly when you need non-default behavior.#92
d8149d6Thanks @dbanksdesign! - AddverifyTypestylesBuild()to@typestyles/build-runnerfor CI checks that extracted CSS and optional manifest exist and contain expected output. Re-export from@typestyles/next/buildand document on the zero-runtime page.
0.3.0
Minor Changes
- #49: Add ESLint configuration across all packages, examples, and docs. Create shared
eslint.base.jsconfig with TypeScript rules and add lint scripts to all package.json files. Update CI workflow to run lint via turbo.
Patch Changes
- #50: Add lint-staged for prettier formatting on pre-commit hook and format entire codebase
0.2.0
Minor Changes
- #25: Updating bundler integrations and adding examples