@akanjs/cli 3.3.0-rc.1 → 3.3.0-rc.11

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.
Files changed (115) hide show
  1. package/.build-stamp +2 -2
  2. package/CodeAgent-cqbf9gsv.js +11 -0
  3. package/{CodeAgentRpcHost-6dzfkvsc.js → CodeAgentRpcHost-pwps2d67.js} +1 -1
  4. package/{CodeTui-zee8atsr.js → CodeTui-ehdr4hgw.js} +46 -6
  5. package/TunnelShare-0p4dy89e.js +16 -0
  6. package/{agent.command-x65f2ags.js → agent.command-x55ncdjm.js} +20 -22
  7. package/akanCode.js +7 -7
  8. package/appExecutor-1ctzymwa.js +11 -0
  9. package/{application.command-azbd1pb2.js → application.command-xpntxnh8.js} +18 -20
  10. package/{applicationBuildRunner-trfxv3pd.js → applicationBuildRunner-19c76791.js} +16 -13
  11. package/buildBatch.proc.js +19 -19
  12. package/{cloud.command-gapp4634.js → cloud.command-p3ybjes7.js} +19 -24
  13. package/cloud.script-0dsyd10v.js +30 -0
  14. package/{code.command-5smx61yf.js → code.command-m6skj1kj.js} +34 -19
  15. package/{context.command-ym5jbkny.js → context.command-3c3nv0d6.js} +20 -22
  16. package/context.runner-yyp7a112.js +32 -0
  17. package/csrArtifactBuilder-mdh9ykn2.js +9 -0
  18. package/{index-2ny1e95c.js → dependencyScanner-93g8tk0r.js} +6 -5
  19. package/{fileSys-q22646yc.js → fileSys-e5mwt73x.js} +1 -1
  20. package/frameworkGraph-aneq2nwy.js +8 -0
  21. package/{guideline.command-zwypaqsh.js → guideline.command-725fq5p0.js} +8 -8
  22. package/guidelines/agentRule/agentRule.instruction.md +46 -7
  23. package/guidelines/akanApi/akanApi.instruction.md +7 -2
  24. package/guidelines/conventions/core.md +6 -11
  25. package/guidelines/conventions/rules/app.md +1 -2
  26. package/guidelines/conventions/rules/auth.md +18 -27
  27. package/guidelines/conventions/rules/config.md +15 -46
  28. package/guidelines/conventions/rules/page.md +19 -34
  29. package/guidelines/conventions/rules/server.md +1 -4
  30. package/guidelines/conventions/rules/ssr.md +3 -4
  31. package/guidelines/conventions/rules/ts.md +2 -1
  32. package/guidelines/cssRule/cssRule.instruction.md +3 -0
  33. package/guidelines/errorCodes/errorCodes.instruction.md +4 -0
  34. package/guidelines/mcpRule/mcpRule.instruction.md +11 -4
  35. package/guidelines/pageRule/pageRule.instruction.md +6 -53
  36. package/guidelines/runtimeRule/runtimeRule.instruction.md +68 -4
  37. package/incrementalBuilder.proc.js +24 -18
  38. package/{index-nc3br31y.js → index-22bwg8hy.js} +2 -2
  39. package/{index-9f3reh2y.js → index-2v38x3ad.js} +12 -1
  40. package/{index-67sd09ag.js → index-3a3vy2xy.js} +8 -8
  41. package/{index-p7beqww9.js → index-3fmzz9sf.js} +18 -18
  42. package/{index-9wh04mqy.js → index-3mj5trqc.js} +65 -11
  43. package/{index-7wf8snar.js → index-3r1crbct.js} +1 -1
  44. package/{index-41a03gkj.js → index-3zkhg65e.js} +19 -19
  45. package/{index-2jmvfa62.js → index-4r8dgm4x.js} +3 -3
  46. package/{index-jek2re5k.js → index-4yvtqcme.js} +8 -8
  47. package/{index-j0wr4e32.js → index-5ahe641t.js} +9 -9
  48. package/{index-0dm25wvf.js → index-7ssr7wq4.js} +1 -1
  49. package/{index-dmcpetwe.js → index-8bta5pnr.js} +98 -23
  50. package/{index-z92zm3wd.js → index-9a9t77hz.js} +29 -11
  51. package/{index-3txdtztz.js → index-9gjcbp2g.js} +1 -1
  52. package/{index-8jtqfye2.js → index-a4gcdffy.js} +488 -53
  53. package/{index-xwwex8rf.js → index-cbm9gzgx.js} +5 -5
  54. package/{index-j6jjmn2r.js → index-ckcc9ab3.js} +62 -21
  55. package/{index-w1zexzpx.js → index-crd99zqs.js} +1 -1
  56. package/{index-612fdtbk.js → index-f4jydw2x.js} +1 -1
  57. package/{index-4ss4gkv3.js → index-fagjtk6m.js} +2 -2
  58. package/{index-ebn9kgea.js → index-fjqapyex.js} +45 -16
  59. package/{index-h901f24n.js → index-h8w1n11r.js} +5 -5
  60. package/{index-275a4r3n.js → index-hxg6ctk2.js} +12 -16
  61. package/{index-78y75t0a.js → index-j2wq064m.js} +6 -7
  62. package/{index-knpm8sdm.js → index-j3fqs8rc.js} +1 -1
  63. package/{index-kfvjzk8r.js → index-kbnvyhy4.js} +3 -3
  64. package/{index-6dzjer7p.js → index-m303nhv6.js} +6 -6
  65. package/{index-dadwp2aw.js → index-nmdmkjt2.js} +271 -39
  66. package/{index-2yn3r67f.js → index-nnmw56fz.js} +6 -6
  67. package/{index-a860mx0m.js → index-pr9nypg7.js} +24 -24
  68. package/{index-s885g0jj.js → index-pyjkbg8e.js} +3 -3
  69. package/{index-zmd9xxgd.js → index-q63nbpv7.js} +3 -3
  70. package/{index-v7ajmsh3.js → index-qecrqpt6.js} +4 -21
  71. package/{index-gt8phqpt.js → index-rdcgz02t.js} +4 -4
  72. package/{index-j592zfqc.js → index-rt7q20sj.js} +1 -1
  73. package/{index-baccvws5.js → index-se7n78fh.js} +1 -1
  74. package/{index-s4nvxpzm.js → index-sxbsrndq.js} +1 -1
  75. package/{index-k6vwww45.js → index-t23dgyaf.js} +7 -7
  76. package/{index-71y6176j.js → index-v16gj2as.js} +86 -66
  77. package/{index-0s7w2085.js → index-vnk1qwgr.js} +4 -4
  78. package/{index-z96ks033.js → index-wkwe91sn.js} +169 -51
  79. package/{index-ybcb9wc8.js → index-wxqp1amd.js} +9 -9
  80. package/{index-p5zh7pmc.js → index-xv3pvdw4.js} +1 -1
  81. package/{index-zfnz878d.js → index-yey1envc.js} +1 -1
  82. package/{index-by2tvsq6.js → index-zyjztrvc.js} +1 -1
  83. package/index.js +30 -28
  84. package/{libExecutor-jc6f8hm6.js → libExecutor-n8hpm8s7.js} +3 -3
  85. package/{library.command-nxvesvhb.js → library.command-8abb26pg.js} +8 -8
  86. package/{localRegistry.command-xz62e4ng.js → localRegistry.command-sa211m1z.js} +18 -23
  87. package/{module.command-aaws9byg.js → module.command-z3cwjf0p.js} +10 -10
  88. package/{package.command-j7hv26p0.js → package.command-akynhtee.js} +9 -12
  89. package/package.json +3 -2
  90. package/{page.command-7yffs7n9.js → page.command-3fpdavk9.js} +8 -8
  91. package/{pipeline.command-7yk0zcng.js → pipeline.command-ca95n8rd.js} +7 -7
  92. package/{pkgExecutor-arxmvx4t.js → pkgExecutor-a73q41vx.js} +3 -3
  93. package/{primitive.command-7a1pt715.js → primitive.command-xwe9ggnf.js} +11 -11
  94. package/{projectTypecheck-f4qhbecd.js → projectTypecheck-7g542ymk.js} +1 -1
  95. package/{prompter-qyggfhqd.js → prompter-d33wmdpa.js} +2 -2
  96. package/{quality.command-c6mvrjh1.js → quality.command-7wz7y8z1.js} +9 -9
  97. package/{repair.command-093adzt9.js → repair.command-dej1qtfq.js} +10 -10
  98. package/{scalar.command-2ex84spb.js → scalar.command-z9qfxnvm.js} +9 -9
  99. package/skills/akan-agent/SKILL.md +8 -1
  100. package/skills/akan-code/SKILL.md +38 -3
  101. package/skills/akan-page/SKILL.md +18 -13
  102. package/skills/akan-runtime/SKILL.md +21 -16
  103. package/skills/akan-service/SKILL.md +2 -2
  104. package/{subspace.command-4n4n4jpv.js → subspace.command-9wekm4gn.js} +11 -13
  105. package/templates/localDev/docker-compose.yaml.template +2 -2
  106. package/{tunnel.command-f7ep1qfa.js → tunnel.command-cxc4h3j8.js} +10 -12
  107. package/{verify.command-zrkxnvct.js → verify.command-j0w9dr5c.js} +15 -17
  108. package/{workflow.command-ks16jegk.js → workflow.command-yt4sz04b.js} +15 -15
  109. package/{workspace.command-ahhfpaag.js → workspace.command-8mp4mcp2.js} +34 -38
  110. package/CodeAgent-fx6088tv.js +0 -11
  111. package/TunnelShare-9ry4vh0y.js +0 -18
  112. package/appExecutor-79azsb2w.js +0 -11
  113. package/cloud.script-3b401efv.js +0 -35
  114. package/context.runner-kctbfsde.js +0 -34
  115. package/dependencyScanner-ge10gb52.js +0 -8
@@ -3,7 +3,7 @@ import {
3
3
  ROOT_LAYOUT_SYSTEM,
4
4
  isImplicitRootLayoutKey,
5
5
  resolveSsrPageEntriesForApp
6
- } from "./index-z92zm3wd.js";
6
+ } from "./index-9a9t77hz.js";
7
7
  import {
8
8
  computeRouteSeedIndex,
9
9
  saveRouteSeedIndex,
@@ -11,11 +11,13 @@ import {
11
11
  ClientEntriesBundler,
12
12
  VENDOR_SPECIFIERS,
13
13
  RouteClientBuilder
14
- } from "./index-jek2re5k.js";
14
+ } from "./index-4yvtqcme.js";
15
15
  import {
16
16
  SOURCE_EXTS,
17
+ buildCacheStamp,
18
+ isBuildCacheStamp,
17
19
  FontOptimizer
18
- } from "./index-dmcpetwe.js";
20
+ } from "./index-8bta5pnr.js";
19
21
  import {
20
22
  BarrelAnalyzer,
21
23
  createTsconfigPackageResolver,
@@ -23,7 +25,10 @@ import {
23
25
  CsrEntryFiles,
24
26
  toClientReferencePath,
25
27
  PagesBundleBuilder
26
- } from "./index-9wh04mqy.js";
28
+ } from "./index-3mj5trqc.js";
29
+ import {
30
+ FileSys2
31
+ } from "./index-zyjztrvc.js";
27
32
  import {
28
33
  CssBlockParser
29
34
  } from "./index-62md4dwy.js";
@@ -207,14 +212,16 @@ import { stat } from "fs/promises";
207
212
  var CANDIDATE_RE = /-?(?:[\w@]|\[(?:[^[\]\s]|\[[^[\]\s]+\])+\])[\w:/.-]*(?:(?:\[(?:[^[\]\s]|\[[^[\]\s]+\])+\]|\((?:[a-z-]+:)?--[^)\s]+\))[\w:/.-]*)*/g;
208
213
 
209
214
  class CssCandidateCache {
210
- static #version = 5;
215
+ static #version = 6;
211
216
  #path;
217
+ #stamp;
212
218
  #entries = new Map;
213
219
  #dirty = false;
214
220
  #reused = 0;
215
221
  #rescanned = 0;
216
- constructor(cachePath) {
222
+ constructor(cachePath, stamp = buildCacheStamp([import.meta.path])) {
217
223
  this.#path = cachePath;
224
+ this.#stamp = stamp;
218
225
  }
219
226
  get reused() {
220
227
  return this.#reused;
@@ -224,7 +231,7 @@ class CssCandidateCache {
224
231
  }
225
232
  async load() {
226
233
  const raw = await Bun.file(this.#path).json().catch(() => null);
227
- if (!raw || raw.version !== CssCandidateCache.#version || typeof raw.files !== "object")
234
+ if (raw?.version !== CssCandidateCache.#version || !isBuildCacheStamp(raw, this.#stamp) || !raw.files)
228
235
  return this;
229
236
  for (const [file, entry] of Object.entries(raw.files)) {
230
237
  if (typeof entry?.mtimeMs !== "number" || !Array.isArray(entry.candidates))
@@ -250,19 +257,21 @@ class CssCandidateCache {
250
257
  return candidates;
251
258
  }
252
259
  async save(present) {
253
- for (const file of [...this.#entries.keys()]) {
254
- if (present.has(file))
255
- continue;
260
+ const absent = [...this.#entries.keys()].filter((file) => !present.has(file));
261
+ const exists = await Promise.all(absent.map((file) => Bun.file(file).exists()));
262
+ absent.forEach((file, index) => {
263
+ if (exists[index])
264
+ return;
256
265
  this.#entries.delete(file);
257
266
  this.#dirty = true;
258
- }
267
+ });
259
268
  if (!this.#dirty)
260
269
  return;
261
270
  this.#dirty = false;
262
271
  const files = {};
263
272
  for (const [file, entry] of this.#entries)
264
273
  files[file] = entry;
265
- await Bun.write(this.#path, JSON.stringify({ version: CssCandidateCache.#version, files })).catch(() => {
274
+ await FileSys2.writeTextAtomic(this.#path, JSON.stringify({ version: CssCandidateCache.#version, ...this.#stamp, files })).catch(() => {
266
275
  return;
267
276
  });
268
277
  }
@@ -397,6 +406,200 @@ class CssImportResolver {
397
406
  }
398
407
  }
399
408
 
409
+ // pkgs/@akanjs/devkit/frontendBuild/plainStylesheet.ts
410
+ var TAILWIND_AT_RULES = new Set([
411
+ "@tailwind",
412
+ "@apply",
413
+ "@plugin",
414
+ "@config",
415
+ "@theme",
416
+ "@utility",
417
+ "@variant",
418
+ "@custom-variant",
419
+ "@slot",
420
+ "@source",
421
+ "@reference"
422
+ ]);
423
+ var TAILWIND_FUNCTION_RE = /(?:--alpha|--spacing|theme)\(/;
424
+ var TAILWIND_CONDITION_RE = /\b(?:source|prefix|theme)\(|(?:^|\s)(?:important|reference)(?=\s|$)/i;
425
+ var TAILWIND_PACKAGE_RE = /^tailwindcss(?:\/|$)/;
426
+ var REMOTE_URI_RE = /^(?:data:|https?:\/\/)/i;
427
+ var COMMENT_RE = /\/\*[\s\S]*?\*\//g;
428
+ var AT_KEYWORD_RE = /@[\w-]+/y;
429
+ var QUOTED_IMPORT_RE = /^\s*(["'])((?:\\[\s\S]|(?!\1)[^\\\n])*)\1([\s\S]*)$/;
430
+ var LAYER_RE = /^layer(?:\(\s*([^()]*?)\s*\))?(?![\w(-])/i;
431
+ var MAX_IMPORT_DEPTH = 100;
432
+
433
+ class PlainStylesheet {
434
+ static async bundle(css, base, load, depth = 0) {
435
+ if (depth > MAX_IMPORT_DEPTH)
436
+ return null;
437
+ const imports = PlainStylesheet.scan(css);
438
+ if (!imports)
439
+ return null;
440
+ const parts = [];
441
+ let cursor = 0;
442
+ for (const rule of imports) {
443
+ const loaded = await load(rule.uri, base);
444
+ const inner = await PlainStylesheet.bundle(loaded.content, loaded.base, load, depth + 1);
445
+ if (inner === null)
446
+ return null;
447
+ parts.push(css.slice(cursor, rule.start), PlainStylesheet.#wrap(inner, rule));
448
+ cursor = rule.end;
449
+ }
450
+ parts.push(css.slice(cursor));
451
+ return parts.join("");
452
+ }
453
+ static scan(css) {
454
+ const imports = [];
455
+ const code = [];
456
+ let segmentStart = 0;
457
+ let parenDepth = 0;
458
+ let braceDepth = 0;
459
+ let atRule = null;
460
+ let idx = 0;
461
+ while (idx < css.length) {
462
+ const char = css[idx];
463
+ if (char === "/" && css[idx + 1] === "*") {
464
+ const end = css.indexOf("*/", idx + 2);
465
+ if (end === -1)
466
+ return null;
467
+ code.push(css.slice(segmentStart, idx));
468
+ idx = segmentStart = end + 2;
469
+ continue;
470
+ }
471
+ if (char === "\\") {
472
+ idx += 2;
473
+ continue;
474
+ }
475
+ if (char === '"' || char === "'") {
476
+ code.push(css.slice(segmentStart, idx));
477
+ idx = segmentStart = PlainStylesheet.#skipString(css, idx);
478
+ continue;
479
+ }
480
+ if (char === "@" && !atRule && parenDepth === 0) {
481
+ AT_KEYWORD_RE.lastIndex = idx;
482
+ const keyword = AT_KEYWORD_RE.exec(css);
483
+ if (keyword) {
484
+ const name = keyword[0].toLowerCase();
485
+ if (TAILWIND_AT_RULES.has(name))
486
+ return null;
487
+ atRule = { name, start: idx, preludeStart: idx + keyword[0].length };
488
+ idx += keyword[0].length;
489
+ continue;
490
+ }
491
+ }
492
+ if (char === "(")
493
+ parenDepth += 1;
494
+ else if (char === ")")
495
+ parenDepth = Math.max(0, parenDepth - 1);
496
+ else if (parenDepth === 0 && (char === ";" || char === "{" || char === "}")) {
497
+ if (atRule && !PlainStylesheet.#closeAtRule(css, atRule, idx, char, imports))
498
+ return null;
499
+ atRule = null;
500
+ braceDepth += char === "{" ? 1 : char === "}" ? -1 : 0;
501
+ if (braceDepth < 0)
502
+ return null;
503
+ }
504
+ idx += 1;
505
+ }
506
+ if (atRule && !PlainStylesheet.#closeAtRule(css, atRule, css.length, "", imports))
507
+ return null;
508
+ if (braceDepth !== 0 || parenDepth !== 0)
509
+ return null;
510
+ code.push(css.slice(segmentStart));
511
+ return TAILWIND_FUNCTION_RE.test(code.join(" ")) ? null : imports;
512
+ }
513
+ static #closeAtRule(css, atRule, end, terminator, imports) {
514
+ const prelude = css.slice(atRule.preludeStart, end).replace(COMMENT_RE, " ");
515
+ const verdict = PlainStylesheet.#readAtRule(atRule.name, prelude, terminator === "{");
516
+ if (verdict === "tailwind")
517
+ return false;
518
+ if (verdict !== "plain")
519
+ imports.push({ ...verdict, start: atRule.start, end: terminator === ";" ? end + 1 : end });
520
+ return true;
521
+ }
522
+ static #readAtRule(name, prelude, opensBlock) {
523
+ if (name === "@media")
524
+ return TAILWIND_CONDITION_RE.test(prelude) ? "tailwind" : "plain";
525
+ if (name !== "@import")
526
+ return "plain";
527
+ const match = QUOTED_IMPORT_RE.exec(prelude);
528
+ if (!match)
529
+ return "plain";
530
+ const [, , uri = "", rest = ""] = match;
531
+ if (TAILWIND_PACKAGE_RE.test(uri) || TAILWIND_CONDITION_RE.test(rest) || opensBlock)
532
+ return "tailwind";
533
+ if (REMOTE_URI_RE.test(uri))
534
+ return "plain";
535
+ const conditions = PlainStylesheet.#parseConditions(rest.trim());
536
+ return conditions ? { uri, ...conditions } : "tailwind";
537
+ }
538
+ static #parseConditions(text) {
539
+ let rest = text;
540
+ let layer = null;
541
+ let supports = null;
542
+ const layerMatch = LAYER_RE.exec(rest);
543
+ if (layerMatch) {
544
+ layer = layerMatch[1] ?? "";
545
+ rest = rest.slice(layerMatch[0].length).trim();
546
+ }
547
+ if (/^supports\(/i.test(rest)) {
548
+ const close = PlainStylesheet.#closingParen(rest, "supports".length);
549
+ if (close === -1)
550
+ return null;
551
+ supports = rest.slice("supports(".length, close).trim();
552
+ rest = rest.slice(close + 1).trim();
553
+ }
554
+ if (/["']|\burl\(|\blayer\b|\bsupports\(/i.test(rest))
555
+ return null;
556
+ return { layer, supports, media: rest || null };
557
+ }
558
+ static #closingParen(text, open) {
559
+ let depth = 0;
560
+ for (let idx = open;idx < text.length; idx++) {
561
+ if (text[idx] === "(")
562
+ depth += 1;
563
+ else if (text[idx] === ")" && --depth === 0)
564
+ return idx;
565
+ }
566
+ return -1;
567
+ }
568
+ static #wrap(css, { layer, media, supports }) {
569
+ let wrapped = css;
570
+ if (layer !== null)
571
+ wrapped = `@layer${layer ? ` ${layer}` : ""} {
572
+ ${wrapped}
573
+ }`;
574
+ if (media !== null)
575
+ wrapped = `@media ${media} {
576
+ ${wrapped}
577
+ }`;
578
+ if (supports !== null)
579
+ wrapped = `@supports ${supports.startsWith("(") ? supports : `(${supports})`} {
580
+ ${wrapped}
581
+ }`;
582
+ return wrapped;
583
+ }
584
+ static #skipString(css, start) {
585
+ const quote = css[start];
586
+ let idx = start + 1;
587
+ while (idx < css.length) {
588
+ const char = css[idx];
589
+ if (char === "\\")
590
+ idx += 2;
591
+ else if (char === quote)
592
+ return idx + 1;
593
+ else if (char === `
594
+ `)
595
+ return idx;
596
+ else
597
+ idx += 1;
598
+ }
599
+ return css.length;
600
+ }
601
+ }
602
+
400
603
  // pkgs/@akanjs/devkit/frontendBuild/cssCompiler.ts
401
604
  var NON_SOURCE_EXT_RE = /\.(json|svg|png|jpe?g|webp|gif|avif|ico|woff2?|ttf|otf|mp3|mp4|wav)$/i;
402
605
  var NODE_MODULES_RE = /[\\/]node_modules[\\/]/;
@@ -590,34 +793,27 @@ class CssCompiler {
590
793
  if (cssPaths.length === 0)
591
794
  return { css: "", imported: [] };
592
795
  const compileStarted = Date.now();
593
- const compilers = await Promise.all(cssPaths.map(async (cssPath) => {
594
- const css = await Bun.file(cssPath).text();
595
- const base = path3.dirname(cssPath);
596
- const imported = new Map;
597
- const compiler = await compile(css, {
598
- base,
599
- loadStylesheet: (id, fromBase) => this.#loadStylesheet(id, fromBase, imported),
600
- loadModule: (id, fromBase) => this.#loadModule(id, fromBase)
601
- });
602
- return { cssPath, compiler, imported };
603
- }));
796
+ const compilers = await Promise.all(cssPaths.map((cssPath) => this.#compileStylesheet(cssPath)));
604
797
  const sourceDirs = new Set;
605
798
  for (const entry of compilers) {
606
- for (const s of entry.compiler.sources)
799
+ for (const s of entry.compiler?.sources ?? [])
607
800
  sourceDirs.add(s.base);
608
801
  }
609
- const scanStarted = Date.now();
610
- const candidates = await this.#scanCandidates(sourcePaths, [...sourceDirs]);
611
- this.#logger.verbose(`css candidates scanned count=${candidates.length} sources=${sourcePaths.length} dirs=${sourceDirs.size} in ${Date.now() - scanStarted}ms`);
802
+ let candidates = [];
803
+ if (compilers.some((entry) => entry.compiler)) {
804
+ const scanStarted = Date.now();
805
+ candidates = await this.#scanCandidates(sourcePaths, [...sourceDirs]);
806
+ this.#logger.verbose(`css candidates scanned count=${candidates.length} sources=${sourcePaths.length} dirs=${sourceDirs.size} in ${Date.now() - scanStarted}ms`);
807
+ }
612
808
  const parts = [];
613
809
  const imported = [];
614
810
  for (const entry of compilers) {
615
- const part = entry.compiler.build(candidates);
811
+ const part = entry.compiler ? entry.compiler.build(candidates) : entry.plainCss;
616
812
  parts.push(part);
617
813
  for (const [cssPath, content] of entry.imported) {
618
814
  const declaredNames = declaredCustomProperties(content);
619
815
  imported.push({ cssPath, declaredNames });
620
- if (declaredNames.length === 0 || declaredNames.some((name) => part.includes(`${name}:`)))
816
+ if (!entry.compiler || declaredNames.length === 0 || declaredNames.some((name) => part.includes(`${name}:`)))
621
817
  continue;
622
818
  this.#logger.warn(`css @import ${cssPath} was loaded by ${entry.cssPath} but none of its ${declaredNames.length} declaration(s) reached the compiled CSS`);
623
819
  }
@@ -626,6 +822,24 @@ class CssCompiler {
626
822
  return { css: parts.join(`
627
823
  `), imported };
628
824
  }
825
+ async#compileStylesheet(cssPath) {
826
+ const css = await Bun.file(cssPath).text();
827
+ const base = path3.dirname(cssPath);
828
+ const imported = new Map;
829
+ const loadStylesheet = (id, fromBase) => this.#loadStylesheet(id, fromBase, imported);
830
+ const plainCss = await PlainStylesheet.bundle(css, base, loadStylesheet);
831
+ if (plainCss !== null) {
832
+ this.#logger.verbose(`css ${cssPath} uses no Tailwind; passed through with ${imported.size} import(s) inlined`);
833
+ return { cssPath, compiler: null, plainCss, imported };
834
+ }
835
+ imported.clear();
836
+ const compiler = await compile(css, {
837
+ base,
838
+ loadStylesheet,
839
+ loadModule: (id, fromBase) => this.#loadModule(id, fromBase)
840
+ });
841
+ return { cssPath, compiler, plainCss: "", imported };
842
+ }
629
843
  async#loadStylesheet(id, fromBase, imported) {
630
844
  const p = await this.#resolveCssImport(id, fromBase);
631
845
  this.#discoveredCssPaths.add(p);
@@ -734,6 +948,7 @@ function getPageKeyBasePath(pageKey, basePaths) {
734
948
  return CsrEntryFiles.basePathOfPageKey(pageKey, basePaths);
735
949
  }
736
950
  // pkgs/@akanjs/devkit/frontendBuild/ssrBaseArtifactBuilder.ts
951
+ import { rename } from "fs/promises";
737
952
  import path6 from "path";
738
953
  import { optimize } from "@tailwindcss/node";
739
954
 
@@ -859,13 +1074,24 @@ class SsrBaseArtifactBuilder {
859
1074
  }
860
1075
  async build() {
861
1076
  const akanConfig = await this.#app.getConfig();
862
- const { rscClientUrl, rscRuntimeClientManifest, rscRuntimeSsrManifest, vendorMap, runtimeChunks } = await this.#buildRuntimeClientEntries();
863
- const pageKeys = await this.#app.getPageKeys();
864
- this.#app.verbose(`[base-artifact] discovered ${pageKeys.length} route files under ${this.#app.cwdPath}/page`);
865
- const pageEntries = await resolveSsrPageEntriesForApp(this.#app, pageKeys);
866
- const { cssCompiler, optimizedFonts, cssAssets } = await this.#buildStyleAssets();
867
- const dictAssets = await new DictionaryAssetBuilder(this.#app, this.#absArtifactDir).build(akanConfig.i18n);
868
- const pagesBundle = await new PagesBundleBuilder(this.#app, this.#command, pageEntries, this.#serverEnv).build();
1077
+ const phaseMs = { runtime: 0, routes: 0, styles: 0, dictionary: 0, pages: 0, total: 0 };
1078
+ const timed = async (phase, run) => {
1079
+ const started = performance.now();
1080
+ try {
1081
+ return await run();
1082
+ } finally {
1083
+ phaseMs[phase] = Math.round(performance.now() - started);
1084
+ }
1085
+ };
1086
+ const { rscClientUrl, rscRuntimeClientManifest, rscRuntimeSsrManifest, vendorMap, runtimeChunks } = await timed("runtime", () => this.#buildRuntimeClientEntries());
1087
+ const pageEntries = await timed("routes", async () => {
1088
+ const pageKeys = await this.#app.getPageKeys();
1089
+ this.#app.verbose(`[base-artifact] discovered ${pageKeys.length} route files under ${this.#app.cwdPath}/page`);
1090
+ return await resolveSsrPageEntriesForApp(this.#app, pageKeys);
1091
+ });
1092
+ const { cssCompiler, optimizedFonts, cssAssets } = await timed("styles", () => this.#buildStyleAssets());
1093
+ const dictAssets = await timed("dictionary", () => new DictionaryAssetBuilder(this.#app, this.#absArtifactDir).build(akanConfig.i18n));
1094
+ const pagesBundle = await timed("pages", () => new PagesBundleBuilder(this.#app, this.#command, pageEntries, this.#serverEnv).build());
869
1095
  this.#app.verbose(`[base-artifact] pages bundle -> ${pagesBundle.bundlePath} (buildId=${pagesBundle.buildId}, splitting=${pagesBundle.splitting}, entry=${pagesBundle.entryBytes} bytes, outputs=${pagesBundle.outputCount}, chunks=${pagesBundle.chunkCount}, total=${pagesBundle.outputBytes} bytes)`);
870
1096
  const seedIndex = computeRouteSeedIndex(pageEntries);
871
1097
  const seedIndexPath = await saveRouteSeedIndex(this.#absArtifactDir, seedIndex, {
@@ -897,10 +1123,16 @@ class SsrBaseArtifactBuilder {
897
1123
  androidSha256CertFingerprints: target.android?.sha256CertFingerprints
898
1124
  }))
899
1125
  };
900
- await Bun.write(path6.join(this.#absArtifactDir, "base-artifact.json"), `${JSON.stringify(artifact, null, 2)}
1126
+ await SsrBaseArtifactBuilder.writeArtifact(this.#absArtifactDir, artifact);
1127
+ phaseMs.total = Date.now() - this.#started;
1128
+ this.#app.verbose(`[base-artifact] complete in ${phaseMs.total}ms`);
1129
+ return { artifact, seedIndex, cssCompiler, optimizedFonts, runtimeChunks, phaseMs };
1130
+ }
1131
+ static async writeArtifact(absArtifactDir, artifact) {
1132
+ const artifactPath = path6.join(absArtifactDir, "base-artifact.json");
1133
+ await Bun.write(`${artifactPath}.tmp`, `${JSON.stringify(artifact, null, 2)}
901
1134
  `);
902
- this.#app.verbose(`[base-artifact] complete in ${Date.now() - this.#started}ms`);
903
- return { artifact, seedIndex, cssCompiler, optimizedFonts, runtimeChunks };
1135
+ await rename(`${artifactPath}.tmp`, artifactPath);
904
1136
  }
905
1137
  async#buildRuntimeClientEntries() {
906
1138
  const akanServerPath = await this.#resolveAkanServerPath();
@@ -5,24 +5,24 @@ import {
5
5
  import {
6
6
  Executor,
7
7
  WorkspaceExecutor
8
- } from "./index-71y6176j.js";
8
+ } from "./index-v16gj2as.js";
9
9
  import {
10
10
  getDirname2,
11
11
  FileSys2
12
- } from "./index-by2tvsq6.js";
12
+ } from "./index-zyjztrvc.js";
13
13
  import {
14
14
  AppExecutor2
15
- } from "./index-z92zm3wd.js";
15
+ } from "./index-9a9t77hz.js";
16
16
  import {
17
17
  LibExecutor2
18
- } from "./index-zfnz878d.js";
18
+ } from "./index-yey1envc.js";
19
19
  import {
20
20
  PkgExecutor2
21
- } from "./index-w1zexzpx.js";
21
+ } from "./index-crd99zqs.js";
22
22
  import {
23
23
  ModuleExecutor,
24
24
  ErrorReport
25
- } from "./index-7wf8snar.js";
25
+ } from "./index-3r1crbct.js";
26
26
 
27
27
  // pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
28
28
  var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-z92zm3wd.js";
4
+ } from "./index-9a9t77hz.js";
5
5
  import {
6
6
  createBarrelImportsPlugin,
7
7
  workspaceBarrels,
@@ -10,7 +10,7 @@ import {
10
10
  CsrEntryFiles,
11
11
  PagesEntrySourceGenerator,
12
12
  PagesBundleBuilder
13
- } from "./index-9wh04mqy.js";
13
+ } from "./index-3mj5trqc.js";
14
14
 
15
15
  // pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
16
16
  import { mkdir as mkdir2, rm as rm2, unlink as unlink2 } from "fs/promises";
@@ -236,7 +236,7 @@ class McpAppViewBuilder {
236
236
  ...options,
237
237
  plugins: [
238
238
  ...options.plugins,
239
- await CsrArtifactBuilder.barrelImportsPlugin(this.#app, McpAppPageTrimmer.pipe(pagePaths)),
239
+ await CsrArtifactBuilder2.barrelImportsPlugin(this.#app, McpAppPageTrimmer.pipe(pagePaths)),
240
240
  PureLazyMarker.plugin()
241
241
  ],
242
242
  entrypoints: views.map((view) => path3.join(generatedDir, `${view.name}.html`)),
@@ -365,12 +365,12 @@ ${importsOf(view.rootOverrides, "rootOverride")}${importsOf(view.overrides, "ove
365
365
  if (cssAsset) {
366
366
  const artifactDir = path3.join(this.#command === "build" ? this.#app.dist.cwdPath : this.#app.cwdPath, ".akan", "artifact");
367
367
  const css = await Bun.file(path3.join(artifactDir, cssAsset.cssRelPath)).text();
368
- html = CsrArtifactBuilder.injectBeforeHeadEnd(html, CsrArtifactBuilder.createInlineStyle(css));
368
+ html = CsrArtifactBuilder2.injectBeforeHeadEnd(html, CsrArtifactBuilder2.createInlineStyle(css));
369
369
  } else
370
370
  this.#app.logger.warn(`[mcp-app-build] no compiled stylesheet for ${view.name}; its view ships without CSS`);
371
371
  const scripts = [];
372
- html = await CsrArtifactBuilder.replaceModuleScriptSrc(html, async (src) => {
373
- const jsPath = CsrArtifactBuilder.resolveHtmlAssetPath(htmlPath, src);
372
+ html = await CsrArtifactBuilder2.replaceModuleScriptSrc(html, async (src) => {
373
+ const jsPath = CsrArtifactBuilder2.resolveHtmlAssetPath(htmlPath, src);
374
374
  scripts.push(jsPath);
375
375
  return await Bun.file(jsPath).text();
376
376
  });
@@ -383,7 +383,7 @@ ${importsOf(view.rootOverrides, "rootOverride")}${importsOf(view.overrides, "ove
383
383
  }
384
384
 
385
385
  // pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
386
- class CsrArtifactBuilder {
386
+ class CsrArtifactBuilder2 {
387
387
  #app;
388
388
  #command;
389
389
  #lang;
@@ -409,13 +409,13 @@ class CsrArtifactBuilder {
409
409
  await mkdir2(this.#generatedDir, { recursive: true });
410
410
  const generatedFiles = Object.fromEntries((await Promise.all(htmlBasePaths.map(async (basePath) => [
411
411
  this.#createHtmlFile(basePath),
412
- await this.#createEntryFile(basePath, CsrArtifactBuilder.pageEntriesForBasePath(pageEntries, basePath, basePaths))
412
+ await this.#createEntryFile(basePath, CsrArtifactBuilder2.pageEntriesForBasePath(pageEntries, basePath, basePaths))
413
413
  ]))).flat());
414
- const options = CsrArtifactBuilder.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports);
414
+ const options = CsrArtifactBuilder2.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports);
415
415
  const result = await Bun.build({
416
416
  ...options,
417
- plugins: [...options.plugins, await CsrArtifactBuilder.barrelImportsPlugin(this.#app)],
418
- entrypoints: htmlBasePaths.map((basePath) => this.#generatedPath(CsrArtifactBuilder.htmlFilename(basePath))),
417
+ plugins: [...options.plugins, await CsrArtifactBuilder2.barrelImportsPlugin(this.#app)],
418
+ entrypoints: htmlBasePaths.map((basePath) => this.#generatedPath(CsrArtifactBuilder2.htmlFilename(basePath))),
419
419
  files: generatedFiles,
420
420
  root: this.#generatedDir,
421
421
  outdir: this.#outputDir
@@ -429,7 +429,7 @@ ${logs}` : ""}`);
429
429
  await this.#inlineCsrArtifacts(cssAssets);
430
430
  await this.#buildMcpAppViews(pageEntries, { basePaths, cssAssets, options });
431
431
  if (this.#command === "build")
432
- await CsrArtifactBuilder.writePublicEnv(this.#app, options.define);
432
+ await CsrArtifactBuilder2.writePublicEnv(this.#app, options.define);
433
433
  this.#app.verbose(`[csr-build] output -> ${this.#outputDir}`);
434
434
  return { outputDir: this.#outputDir };
435
435
  }
@@ -442,7 +442,7 @@ ${logs}` : ""}`);
442
442
  return await this.#buildMcpAppViews(pageEntries, {
443
443
  basePaths: [...akanConfig.basePaths],
444
444
  cssAssets: await this.#loadCssAssets(),
445
- options: CsrArtifactBuilder.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports)
445
+ options: CsrArtifactBuilder2.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports)
446
446
  });
447
447
  }
448
448
  async#buildMcpAppViews(pageEntries, option) {
@@ -472,7 +472,7 @@ ${logs}` : ""}`);
472
472
  static async writePublicEnv(app, define) {
473
473
  const prefix = "process.env.";
474
474
  const publicEnv = Object.fromEntries(Object.entries(define).filter(([key]) => key.startsWith(`${prefix}AKAN_PUBLIC_`)).map(([key, value]) => [key.slice(prefix.length), JSON.parse(value)]));
475
- await Bun.write(CsrArtifactBuilder.publicEnvPath(app), `${JSON.stringify(publicEnv, null, 2)}
475
+ await Bun.write(CsrArtifactBuilder2.publicEnvPath(app), `${JSON.stringify(publicEnv, null, 2)}
476
476
  `);
477
477
  }
478
478
  static pageEntriesForBasePath(pageEntries, basePath, basePaths) {
@@ -502,7 +502,7 @@ ${logs}` : ""}`);
502
502
  }
503
503
  async#createEntryFile(basePath, pageEntries) {
504
504
  return [
505
- this.#generatedPath(CsrArtifactBuilder.entryFilename(basePath)),
505
+ this.#generatedPath(CsrArtifactBuilder2.entryFilename(basePath)),
506
506
  `import { bootCsr } from "akanjs/webkit";
507
507
  ${await PagesEntrySourceGenerator.generateStatic(pageEntries)}
508
508
  void bootCsr(pages);
@@ -511,7 +511,7 @@ void bootCsr(pages);
511
511
  }
512
512
  #createHtmlFile(basePath) {
513
513
  return [
514
- this.#generatedPath(CsrArtifactBuilder.htmlFilename(basePath)),
514
+ this.#generatedPath(CsrArtifactBuilder2.htmlFilename(basePath)),
515
515
  `<!doctype html>
516
516
  <html lang="${this.#lang}">
517
517
  <head>
@@ -522,7 +522,7 @@ void bootCsr(pages);
522
522
  </head>
523
523
  <body>
524
524
  <div id="root"></div>
525
- <script type="module" src="./${CsrArtifactBuilder.entryFilename(basePath)}"></script>
525
+ <script type="module" src="./${CsrArtifactBuilder2.entryFilename(basePath)}"></script>
526
526
  </body>
527
527
  </html>
528
528
  `
@@ -543,7 +543,7 @@ void bootCsr(pages);
543
543
  const htmlFile = Bun.file(htmlPath);
544
544
  if (!await htmlFile.exists())
545
545
  continue;
546
- const basePath = CsrArtifactBuilder.basePathOfHtml(htmlPath);
546
+ const basePath = CsrArtifactBuilder2.basePathOfHtml(htmlPath);
547
547
  const cssAsset = cssAssets[basePath];
548
548
  if (!cssAsset) {
549
549
  this.#app.logger.warn(`[csr-build] base-artifact.json has no compiled stylesheet for ${basePath || "root"}; ${path4.basename(htmlPath)} ships without CSS`);
@@ -568,11 +568,11 @@ ${remainingAssets.join(`
568
568
  let next = html;
569
569
  if (cssAsset) {
570
570
  const css = await Bun.file(path4.join(this.#artifactDir, cssAsset.cssRelPath)).text();
571
- next = CsrArtifactBuilder.injectBeforeHeadEnd(next, CsrArtifactBuilder.createInlineStyle(css));
571
+ next = CsrArtifactBuilder2.injectBeforeHeadEnd(next, CsrArtifactBuilder2.createInlineStyle(css));
572
572
  }
573
573
  const jsFiles = [];
574
- next = await CsrArtifactBuilder.replaceModuleScriptSrc(next, async (src) => {
575
- const jsPath = CsrArtifactBuilder.resolveHtmlAssetPath(htmlPath, src);
574
+ next = await CsrArtifactBuilder2.replaceModuleScriptSrc(next, async (src) => {
575
+ const jsPath = CsrArtifactBuilder2.resolveHtmlAssetPath(htmlPath, src);
576
576
  jsFiles.push(jsPath);
577
577
  return await Bun.file(jsPath).text();
578
578
  });
@@ -588,7 +588,7 @@ ${remainingAssets.join(`
588
588
  return files.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
589
589
  }
590
590
  static injectBeforeHeadEnd(html, snippet) {
591
- const scannable = CsrArtifactBuilder.blankEmbeddedContent(html);
591
+ const scannable = CsrArtifactBuilder2.blankEmbeddedContent(html);
592
592
  const headEnd = scannable.search(/<\/head\s*>/i);
593
593
  if (headEnd !== -1)
594
594
  return `${html.slice(0, headEnd)}${snippet}
@@ -621,7 +621,7 @@ ${css.replace(/<\/style/gi, "<\\/style")}
621
621
  matched = true;
622
622
  result += html.slice(lastIndex, match.index);
623
623
  result += `<script type="module">
624
- ${CsrArtifactBuilder.escapeInlineScript(await loadScript(src))}
624
+ ${CsrArtifactBuilder2.escapeInlineScript(await loadScript(src))}
625
625
  </script>`;
626
626
  lastIndex = match.index + full.length;
627
627
  }
@@ -641,4 +641,4 @@ ${CsrArtifactBuilder.escapeInlineScript(await loadScript(src))}
641
641
  }
642
642
  }
643
643
 
644
- export { CsrArtifactBuilder };
644
+ export { CsrArtifactBuilder2 };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  FileSys2
4
- } from "./index-by2tvsq6.js";
4
+ } from "./index-zyjztrvc.js";
5
5
  import {
6
6
  resolveMobileTargets
7
7
  } from "./index-m9jj544v.js";
@@ -9,10 +9,10 @@ import {
9
9
  UpdatePackFolder,
10
10
  NativePublicEnv,
11
11
  NativeApp
12
- } from "./index-ebn9kgea.js";
12
+ } from "./index-fjqapyex.js";
13
13
  import {
14
14
  ExitCodeError
15
- } from "./index-2yn3r67f.js";
15
+ } from "./index-nnmw56fz.js";
16
16
  import {
17
17
  ConfigLock
18
18
  } from "./index-bqbf654f.js";
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  AppExecutor2
4
- } from "./index-z92zm3wd.js";
4
+ } from "./index-9a9t77hz.js";
5
5
  import {
6
6
  LibExecutor2
7
- } from "./index-zfnz878d.js";
7
+ } from "./index-yey1envc.js";
8
8
  import {
9
9
  createAst,
10
10
  AkanIndex
@@ -15,7 +15,7 @@ import {
15
15
  } from "./index-va90m8nd.js";
16
16
  import {
17
17
  camelToKebabCase
18
- } from "./index-2yn3r67f.js";
18
+ } from "./index-nnmw56fz.js";
19
19
 
20
20
  // pkgs/@akanjs/devkit/workflow/artifacts.ts
21
21
  import { capitalize as capitalize2 } from "akanjs/common";