@kirana-style/rolldown 0.2.2 → 0.2.4

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,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.4](https://github.com/kirana-style/kirana/compare/v0.2.3...v0.2.4) (2026-10-19)
4
+
5
+
6
+ ### Performance
7
+
8
+ * compile each module once in a one-shot build ([#59](https://github.com/kirana-style/kirana/issues/59)) ([df6d014](https://github.com/kirana-style/kirana/commit/df6d014fae6cd5c85a032056b1322db09427aed3))
9
+ * compile modules in parallel in vite and rolldown builds ([#60](https://github.com/kirana-style/kirana/issues/60)) ([e2eb29a](https://github.com/kirana-style/kirana/commit/e2eb29a667bd563cee2e2cf20f51a5e1d46f8c0d))
10
+
11
+
12
+ ### Documentation
13
+
14
+ * take the benchmarks of kirana 0.2.3 from kirana-lab ([#57](https://github.com/kirana-style/kirana/issues/57)) ([ab95357](https://github.com/kirana-style/kirana/commit/ab95357157fda97aad33007277c542118c89f5a9))
15
+
16
+ ## [0.2.3](https://github.com/kirana-style/kirana/compare/v0.2.2...v0.2.3) (2026-10-19)
17
+
18
+
19
+ ### Features
20
+
21
+ * opt-in dense class names for production builds ([#56](https://github.com/kirana-style/kirana/issues/56)) ([8de7aa1](https://github.com/kirana-style/kirana/commit/8de7aa1860a3e2d090d46dd8ef7fd5ba74a03c83))
22
+ * **site:** show the lab's scale curve on the benchmarks page ([#53](https://github.com/kirana-style/kirana/issues/53)) ([006313d](https://github.com/kirana-style/kirana/commit/006313d61bc0331059b30cfcf2ea6a31c0772ea2))
23
+ * **site:** the large-dom table, a homepage chart and visual habits ([#52](https://github.com/kirana-style/kirana/issues/52)) ([7af6734](https://github.com/kirana-style/kirana/commit/7af6734384f71add75ba12fb506aee11a24aa4d3))
24
+
25
+
26
+ ### Bug fixes
27
+
28
+ * **compiler:** let bundlers drop recipe tables resolved at build time ([#55](https://github.com/kirana-style/kirana/issues/55)) ([1a2eb9b](https://github.com/kirana-style/kirana/commit/1a2eb9bd50c549165cd69fc911b15f3a37f40fc7))
29
+ * **release:** publish a package only once npm serves what it depends on ([#50](https://github.com/kirana-style/kirana/issues/50)) ([f52fc50](https://github.com/kirana-style/kirana/commit/f52fc50b5043826efbf87a867b2ef0d1aa9b2cae))
30
+
31
+
32
+ ### Performance
33
+
34
+ * **core:** merge each combination of handles once at runtime ([#54](https://github.com/kirana-style/kirana/issues/54)) ([633486f](https://github.com/kirana-style/kirana/commit/633486f3d212ce2a132ccaac046fecf92516c518))
35
+
3
36
  ## [0.2.2](https://github.com/kirana-style/kirana/compare/v0.2.1...v0.2.2) (2026-10-16)
4
37
 
5
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirana-style/rolldown",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
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.2",
29
- "@kirana-style/core": "0.2.2"
28
+ "@kirana-style/compiler": "0.2.4",
29
+ "@kirana-style/core": "0.2.4"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "rolldown": "^1.2.12"
package/src/index.d.ts CHANGED
@@ -16,6 +16,14 @@ export type KiranaRolldownOptions = {
16
16
  * bundles CSS, the stylesheet follows Vite's asset naming instead.
17
17
  */
18
18
  fileName?: string;
19
+ /**
20
+ * `"dense"` gives a production build short class names (D-084): the condition and value hashes
21
+ * in every chunk and in the stylesheet become codes of one or two characters, assigned from the
22
+ * whole build, and everything the runtime merge reads stays. A development server keeps the
23
+ * hashed names. Not available with a class map (`classes`), whose server-side helpers read hashed
24
+ * names. Default `"hashed"`.
25
+ */
26
+ names?: "hashed" | "dense";
19
27
  /** Injected Driver options (tests). */
20
28
  driver?: Pick<DriverOptions, "native" | "importModule">;
21
29
  };
@@ -41,7 +49,17 @@ export type Host = {
41
49
  export declare function createKirana(options?: KiranaRolldownOptions, host?: Host): {
42
50
  plugin: {
43
51
  name: string;
44
- buildStart(): Promise<void>;
52
+ buildStart(this: {
53
+ meta: {
54
+ watchMode: boolean;
55
+ };
56
+ }): Promise<void>;
57
+ renderChunk(code: string, chunk: {
58
+ fileName: string;
59
+ }): Promise<{
60
+ code: string;
61
+ map: import("magic-string").SourceMap;
62
+ } | null>;
45
63
  load: {
46
64
  filter: {
47
65
  id: RegExp[];
package/src/index.js CHANGED
@@ -31,6 +31,7 @@ function createKirana(options = {}, host = {}) {
31
31
  const filled = /* @__PURE__ */ new Set();
32
32
  const development = () => host.development?.() ?? false;
33
33
  const fileName = options.fileName ?? "kirana.css";
34
+ const dense = () => options.names === "dense" && !development();
34
35
  const session = () => {
35
36
  driver ??= Driver.create({
36
37
  root: state.root,
@@ -43,7 +44,16 @@ function createKirana(options = {}, host = {}) {
43
44
  const plugin = {
44
45
  name: "kirana",
45
46
  async buildStart() {
46
- await session();
47
+ const compiler = await session();
48
+ if (!development() && !this.meta.watchMode) compiler.reuseTransforms();
49
+ if (dense()) {
50
+ if (compiler.classModules.length > 0) throw new Error("kirana: `names: \"dense\"` cannot be used with a class map (`classes`): server templates read hashed names");
51
+ compiler.markDense();
52
+ }
53
+ },
54
+ async renderChunk(code, chunk) {
55
+ if (!dense()) return null;
56
+ return (await session()).dense(code, chunk.fileName) ?? null;
47
57
  },
48
58
  load: {
49
59
  filter: { id: [/stylesheet\.css/, COMPONENT] },
@@ -82,7 +92,7 @@ function createKirana(options = {}, host = {}) {
82
92
  const file = cleanId(id);
83
93
  const compiler = await session();
84
94
  if (!compiler.compiles(file)) return null;
85
- const result = compiler.transform(file, code);
95
+ const result = development() ? compiler.transform(file, code) : await compiler.transformAsync(file, code);
86
96
  for (const dependency of result.dependencies) this.addWatchFile(dependency);
87
97
  reporter.module(this, file, code, result.diagnostics);
88
98
  if (result.cssChanged) host.cssChanged?.();
@@ -104,7 +114,7 @@ function createKirana(options = {}, host = {}) {
104
114
  order: "pre",
105
115
  async handler(_output, bundle) {
106
116
  if (!host.bundlesCss) {
107
- const css = (await session()).stylesheet(true);
117
+ const css = (await session()).stylesheet(true, dense());
108
118
  this.emitFile({
109
119
  type: "asset",
110
120
  fileName,
@@ -123,7 +133,7 @@ function createKirana(options = {}, host = {}) {
123
133
  * plugin added after the first pass (Qwik's).
124
134
  */
125
135
  const fill = async (bundle, emitFile) => {
126
- const css = (await session()).stylesheet(true);
136
+ const css = (await session()).stylesheet(true, dense());
127
137
  for (const [key, asset] of Object.entries(bundle)) {
128
138
  if (asset.type !== "asset") continue;
129
139
  const source = fillStylesheet(String(asset.source), css);