@kirana-style/rolldown 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.0](https://github.com/kirana-style/kirana/compare/v0.2.4...v0.3.0) (2026-10-21)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * declare a variable token only where something uses it ([#62](https://github.com/kirana-style/kirana/issues/62))
9
+
10
+ ### Features
11
+
12
+ * component states as condition keys, and values checked by grammar ([#82](https://github.com/kirana-style/kirana/issues/82)) ([2c034e7](https://github.com/kirana-style/kirana/commit/2c034e7b3c1e51f35a120c5af02934e3f3fa5b4e))
13
+ * declare a variable token only where something uses it ([#62](https://github.com/kirana-style/kirana/issues/62)) ([811fbdd](https://github.com/kirana-style/kirana/commit/811fbdd5d1276738306eb1e22cca6b5b3a77c92a))
14
+ * remix 3, with sx in compiled jsx ([#80](https://github.com/kirana-style/kirana/issues/80)) ([b6e9d12](https://github.com/kirana-style/kirana/commit/b6e9d1284d23e89e70ca7b82ef5eab2ca2378a74))
15
+ * **site:** a partners page, the theme in the footer, a new quick start ([#70](https://github.com/kirana-style/kirana/issues/70)) ([9f5552c](https://github.com/kirana-style/kirana/commit/9f5552c91801350ffe641f7482b1807096fed409))
16
+ * **site:** quick start pills, full chart comparisons, updated skills ([#72](https://github.com/kirana-style/kirana/issues/72)) ([abc2363](https://github.com/kirana-style/kirana/commit/abc23638a3e47a2daf8b3af89705bb67544dc879))
17
+ * **site:** what ci runs on, and a lighter quick start ([#79](https://github.com/kirana-style/kirana/issues/79)) ([5ef3c51](https://github.com/kirana-style/kirana/commit/5ef3c515b880c40fc4735954105b07ed7f4b3439))
18
+ * solidstart, vike, waku, vitepress, docusaurus and storybook ([#78](https://github.com/kirana-style/kirana/issues/78)) ([de928d2](https://github.com/kirana-style/kirana/commit/de928d2bb9438e5a02b529ed5aacc69456b32401))
19
+ * **ui:** charts on tanstack charts, with the benchmark and scale-curve charts ([#69](https://github.com/kirana-style/kirana/issues/69)) ([e33de7e](https://github.com/kirana-style/kirana/commit/e33de7e3fcb2d0ebe18c54cc2804a011782d47a1))
20
+
21
+
22
+ ### Performance
23
+
24
+ * keep the stylesheet and project diagnostics until something changes ([#65](https://github.com/kirana-style/kirana/issues/65)) ([91b67fa](https://github.com/kirana-style/kirana/commit/91b67fa77f99e714a2485752291139c54900cfd0))
25
+ * order atoms within a conflict key so adjacent keys share rules ([#63](https://github.com/kirana-style/kirana/issues/63)) ([42be523](https://github.com/kirana-style/kirana/commit/42be5231df063e5f9cece88a705808515bc13076))
26
+ * **site:** load the homepage's chapters below the hero on their own ([#68](https://github.com/kirana-style/kirana/issues/68)) ([5ccf916](https://github.com/kirana-style/kirana/commit/5ccf916d00cb253616650e7146d5d75d8ffefb3b))
27
+ * **site:** no software webgl, repository numbers through the worker ([#67](https://github.com/kirana-style/kirana/issues/67)) ([db11850](https://github.com/kirana-style/kirana/commit/db1185057b9048cb7296082318768f5307a9ed2d))
28
+ * **site:** prerender pages, split shared chunks, two new scenes ([#66](https://github.com/kirana-style/kirana/issues/66)) ([8e5160e](https://github.com/kirana-style/kirana/commit/8e5160e271970859dddb844e0290005d3cdd797c))
29
+
30
+
31
+ ### Dependencies
32
+
33
+ * bump the minor-and-patch group across 1 directory with 2 updates ([#75](https://github.com/kirana-style/kirana/issues/75)) ([bccbb0c](https://github.com/kirana-style/kirana/commit/bccbb0c42e50915943e53b8c0dc3fc623ad9d5fa))
34
+ * bump the minor-and-patch group with 16 updates ([#76](https://github.com/kirana-style/kirana/issues/76)) ([9f4df94](https://github.com/kirana-style/kirana/commit/9f4df947dda37e45e80231fd36203cc08399e903))
35
+ * bump the oxc group in /packages/kirana with 7 updates ([#74](https://github.com/kirana-style/kirana/issues/74)) ([7718a1c](https://github.com/kirana-style/kirana/commit/7718a1cc0acb57d6816146ded78b02853b16c928))
36
+ * vite-plus 1.3.0, and a licence check for javascript dependencies ([#77](https://github.com/kirana-style/kirana/issues/77)) ([1ab86c3](https://github.com/kirana-style/kirana/commit/1ab86c33205b58ce714a5e605d7f9f0a3c63a4aa))
37
+
3
38
  ## [0.2.4](https://github.com/kirana-style/kirana/compare/v0.2.3...v0.2.4) (2026-10-19)
4
39
 
5
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirana-style/rolldown",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "description": "Kirana for Rolldown: compiles modules and emits the stylesheet.",
5
5
  "license": "MIT",
6
6
  "author": "The Kirana authors",
@@ -25,8 +25,8 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@kirana-style/compiler": "0.2.4",
29
- "@kirana-style/core": "0.2.4"
28
+ "@kirana-style/compiler": "0.3.0",
29
+ "@kirana-style/core": "0.3.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "rolldown": "^1.2.12"
package/src/index.d.ts CHANGED
@@ -54,7 +54,9 @@ export declare function createKirana(options?: KiranaRolldownOptions, host?: Hos
54
54
  watchMode: boolean;
55
55
  };
56
56
  }): Promise<void>;
57
- renderChunk(code: string, chunk: {
57
+ renderChunk(this: {
58
+ error: (message: string) => never;
59
+ }, code: string, chunk: {
58
60
  fileName: string;
59
61
  }): Promise<{
60
62
  code: string;
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { COMPONENT, Driver } from "@kirana-style/compiler";
2
- import { ASSET_QUERY, PLACEHOLDER, SCRIPT, STYLE_BEARING, cleanId, createReporter, fillStylesheet, renameAsset, stylesheetPath } from "@kirana-style/compiler/host";
2
+ import { ASSET_QUERY, PLACEHOLDER, SCRIPT, STYLE_BEARING, VIRTUAL, cleanId, createReporter, fillStylesheet, renameAsset, stylesheetPath, tokenNames } from "@kirana-style/compiler/host";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  //#region src/index.ts
@@ -32,6 +32,13 @@ function createKirana(options = {}, host = {}) {
32
32
  const development = () => host.development?.() ?? false;
33
33
  const fileName = options.fileName ?? "kirana.css";
34
34
  const dense = () => options.names === "dense" && !development();
35
+ /**
36
+ * Every variable token the bundle's chunks and other files name, across environments, and the
37
+ * ones the last stylesheet left out by identity (D-086): a token only code names is written when
38
+ * the finished bundle still names it, and a chunk rendered later must not name one left out.
39
+ */
40
+ const named = /* @__PURE__ */ new Set();
41
+ let pruned = /* @__PURE__ */ new Map();
35
42
  const session = () => {
36
43
  driver ??= Driver.create({
37
44
  root: state.root,
@@ -52,8 +59,17 @@ function createKirana(options = {}, host = {}) {
52
59
  }
53
60
  },
54
61
  async renderChunk(code, chunk) {
62
+ if (development()) return null;
63
+ const compiler = await session();
64
+ const names = tokenNames(code, compiler.prefix);
65
+ const late = names.filter((name) => pruned.has(name));
66
+ if (late.length > 0) {
67
+ const list = late.map((name) => `${pruned.get(name)} (${name})`).join(", ");
68
+ this.error(`kirana: ${chunk.fileName} reads tokens the stylesheet left out: ${list}. Nothing the stylesheet's own build bundled named them at runtime. Declare each one \`runtime: true\` in defineTokens (D-086).`);
69
+ }
70
+ for (const name of names) named.add(name);
55
71
  if (!dense()) return null;
56
- return (await session()).dense(code, chunk.fileName) ?? null;
72
+ return compiler.dense(code, chunk.fileName) ?? null;
57
73
  },
58
74
  load: {
59
75
  filter: { id: [/stylesheet\.css/, COMPONENT] },
@@ -84,7 +100,11 @@ function createKirana(options = {}, host = {}) {
84
100
  filter: {
85
101
  id: {
86
102
  include: SCRIPT,
87
- exclude: [ASSET_QUERY, COMPONENT_PART]
103
+ exclude: [
104
+ ASSET_QUERY,
105
+ COMPONENT_PART,
106
+ VIRTUAL
107
+ ]
88
108
  },
89
109
  code: STYLE_BEARING
90
110
  },
@@ -114,7 +134,7 @@ function createKirana(options = {}, host = {}) {
114
134
  order: "pre",
115
135
  async handler(_output, bundle) {
116
136
  if (!host.bundlesCss) {
117
- const css = (await session()).stylesheet(true, dense());
137
+ const css = await finished(bundle);
118
138
  this.emitFile({
119
139
  type: "asset",
120
140
  fileName,
@@ -127,13 +147,24 @@ function createKirana(options = {}, host = {}) {
127
147
  }
128
148
  };
129
149
  /**
150
+ * The stylesheet for this bundle (D-086): the token names its other files hold join the chunks',
151
+ * and the tokens left out are kept for the chunks rendered after it.
152
+ */
153
+ const finished = async (bundle) => {
154
+ const compiler = await session();
155
+ for (const file of Object.values(bundle)) if (file.type === "asset" && typeof file.source === "string") for (const name of tokenNames(file.source, compiler.prefix)) named.add(name);
156
+ const result = compiler.finishedStylesheet(named, dense());
157
+ pruned = new Map(result.pruned.map((token) => [token.variable, token.identity]));
158
+ return result.css;
159
+ };
160
+ /**
130
161
  * Fills every stylesheet asset still holding the placeholder, renaming it by content unless the
131
162
  * host keeps names, and points the chunks and assets that named it at the new name. A second pass
132
163
  * finds nothing to do, so a host may run it again later in `generateBundle` for assets another
133
164
  * plugin added after the first pass (Qwik's).
134
165
  */
135
166
  const fill = async (bundle, emitFile) => {
136
- const css = (await session()).stylesheet(true, dense());
167
+ const css = await finished(bundle);
137
168
  for (const [key, asset] of Object.entries(bundle)) {
138
169
  if (asset.type !== "asset") continue;
139
170
  const source = fillStylesheet(String(asset.source), css);