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

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 (105) hide show
  1. package/.build-stamp +2 -2
  2. package/CodeAgent-0r05qa30.js +11 -0
  3. package/{CodeTui-zee8atsr.js → CodeTui-brryts78.js} +4 -4
  4. package/TunnelShare-dcx5j51j.js +16 -0
  5. package/{agent.command-x65f2ags.js → agent.command-xn4maemk.js} +20 -22
  6. package/akanCode.js +5 -5
  7. package/appExecutor-qt1nm242.js +11 -0
  8. package/{application.command-azbd1pb2.js → application.command-rv2n5bw8.js} +17 -19
  9. package/{applicationBuildRunner-trfxv3pd.js → applicationBuildRunner-ggkd5qgy.js} +16 -13
  10. package/buildBatch.proc.js +19 -18
  11. package/{cloud.command-gapp4634.js → cloud.command-hgnbps4n.js} +19 -24
  12. package/cloud.script-rzsnzjsg.js +30 -0
  13. package/{code.command-5smx61yf.js → code.command-9gfph3t3.js} +13 -13
  14. package/{context.command-ym5jbkny.js → context.command-dwhz1fwq.js} +20 -22
  15. package/context.runner-gh9rr71p.js +32 -0
  16. package/csrArtifactBuilder-zawt8knq.js +9 -0
  17. package/{index-2ny1e95c.js → dependencyScanner-93g8tk0r.js} +6 -5
  18. package/{fileSys-q22646yc.js → fileSys-e5mwt73x.js} +1 -1
  19. package/frameworkGraph-aneq2nwy.js +8 -0
  20. package/{guideline.command-zwypaqsh.js → guideline.command-v2daz21k.js} +8 -8
  21. package/guidelines/akanApi/akanApi.instruction.md +7 -2
  22. package/guidelines/conventions/core.md +6 -11
  23. package/guidelines/conventions/rules/app.md +1 -2
  24. package/guidelines/conventions/rules/auth.md +18 -27
  25. package/guidelines/conventions/rules/config.md +14 -46
  26. package/guidelines/conventions/rules/page.md +19 -34
  27. package/guidelines/conventions/rules/server.md +1 -4
  28. package/guidelines/conventions/rules/ssr.md +3 -4
  29. package/guidelines/conventions/rules/ts.md +2 -1
  30. package/guidelines/cssRule/cssRule.instruction.md +1 -0
  31. package/guidelines/pageRule/pageRule.instruction.md +6 -53
  32. package/incrementalBuilder.proc.js +24 -18
  33. package/{index-j6jjmn2r.js → index-0k64a38w.js} +62 -21
  34. package/{index-78y75t0a.js → index-0vtpxfx6.js} +6 -7
  35. package/{index-4ss4gkv3.js → index-0vv0a5h8.js} +2 -2
  36. package/{index-j0wr4e32.js → index-1v5eghaa.js} +9 -9
  37. package/{index-kfvjzk8r.js → index-2ktpwjgf.js} +3 -3
  38. package/{index-w1zexzpx.js → index-2t7jnfg5.js} +1 -1
  39. package/{index-p7beqww9.js → index-3fmzz9sf.js} +18 -18
  40. package/{index-8jtqfye2.js → index-58ck1gsm.js} +6 -6
  41. package/{index-0s7w2085.js → index-5cpjkfhk.js} +4 -4
  42. package/{index-71y6176j.js → index-609zbjve.js} +8 -8
  43. package/{index-9wh04mqy.js → index-66b1hrxh.js} +2 -2
  44. package/{index-gt8phqpt.js → index-6yefp97x.js} +4 -4
  45. package/{index-0dm25wvf.js → index-7ssr7wq4.js} +1 -1
  46. package/{index-612fdtbk.js → index-8fg1hvj5.js} +1 -1
  47. package/{index-41a03gkj.js → index-91bcfjej.js} +19 -19
  48. package/{index-275a4r3n.js → index-999e5kp4.js} +11 -15
  49. package/{index-s885g0jj.js → index-arcdcexp.js} +3 -3
  50. package/{index-jek2re5k.js → index-b3kjr19v.js} +4 -4
  51. package/{index-3txdtztz.js → index-bjg9thz8.js} +1 -1
  52. package/{index-baccvws5.js → index-bsew0a12.js} +1 -1
  53. package/{index-zfnz878d.js → index-c67vjafa.js} +1 -1
  54. package/{index-z92zm3wd.js → index-cfzqdsam.js} +29 -11
  55. package/{index-dadwp2aw.js → index-dy5reyet.js} +271 -39
  56. package/{index-67sd09ag.js → index-fqhr7j56.js} +8 -8
  57. package/{index-zmd9xxgd.js → index-g7hm77j6.js} +3 -3
  58. package/{index-h901f24n.js → index-ghs8gtvp.js} +5 -5
  59. package/{index-v7ajmsh3.js → index-h1k3zyyb.js} +1 -1
  60. package/{index-knpm8sdm.js → index-j3fqs8rc.js} +1 -1
  61. package/{index-6dzjer7p.js → index-jzwdwse0.js} +6 -6
  62. package/{index-2jmvfa62.js → index-m4s4tzjr.js} +3 -3
  63. package/{index-xwwex8rf.js → index-ndfxse05.js} +5 -5
  64. package/{index-z96ks033.js → index-rd669r6x.js} +153 -45
  65. package/{index-k6vwww45.js → index-rnhbh45p.js} +7 -7
  66. package/{index-ybcb9wc8.js → index-rwhdcnr8.js} +9 -9
  67. package/{index-a860mx0m.js → index-sn5cka91.js} +24 -24
  68. package/{index-ebn9kgea.js → index-v0gt5ryd.js} +18 -15
  69. package/{index-2yn3r67f.js → index-vznyyaf8.js} +6 -6
  70. package/{index-dmcpetwe.js → index-w18qdjyf.js} +98 -23
  71. package/{index-p5zh7pmc.js → index-xv3pvdw4.js} +1 -1
  72. package/{index-nc3br31y.js → index-yejf6fth.js} +2 -2
  73. package/{index-7wf8snar.js → index-zfmc4380.js} +1 -1
  74. package/{index-j592zfqc.js → index-zx3bv21b.js} +1 -1
  75. package/{index-by2tvsq6.js → index-zyjztrvc.js} +1 -1
  76. package/index.js +30 -28
  77. package/{libExecutor-jc6f8hm6.js → libExecutor-p21kkayq.js} +3 -3
  78. package/{library.command-nxvesvhb.js → library.command-m4gw18qq.js} +8 -8
  79. package/{localRegistry.command-xz62e4ng.js → localRegistry.command-3yq90wgp.js} +18 -23
  80. package/{module.command-aaws9byg.js → module.command-9vfdxapr.js} +10 -10
  81. package/{package.command-j7hv26p0.js → package.command-rt4y8xaf.js} +9 -12
  82. package/package.json +3 -2
  83. package/{page.command-7yffs7n9.js → page.command-4zc20rnv.js} +8 -8
  84. package/{pipeline.command-7yk0zcng.js → pipeline.command-4ekd9xgb.js} +7 -7
  85. package/{pkgExecutor-arxmvx4t.js → pkgExecutor-mh903rz9.js} +3 -3
  86. package/{primitive.command-7a1pt715.js → primitive.command-5g3xe4mf.js} +11 -11
  87. package/{projectTypecheck-f4qhbecd.js → projectTypecheck-bz6smek9.js} +1 -1
  88. package/{prompter-qyggfhqd.js → prompter-d33wmdpa.js} +2 -2
  89. package/{quality.command-c6mvrjh1.js → quality.command-zf8dyc9w.js} +9 -9
  90. package/{repair.command-093adzt9.js → repair.command-sx0eyq4w.js} +10 -10
  91. package/{scalar.command-2ex84spb.js → scalar.command-4bvzmbbh.js} +9 -9
  92. package/skills/akan-page/SKILL.md +18 -13
  93. package/skills/akan-runtime/SKILL.md +21 -16
  94. package/skills/akan-service/SKILL.md +2 -2
  95. package/{subspace.command-4n4n4jpv.js → subspace.command-cxyej1an.js} +11 -13
  96. package/{tunnel.command-f7ep1qfa.js → tunnel.command-gvnv36yf.js} +10 -12
  97. package/{verify.command-zrkxnvct.js → verify.command-yj2mngs0.js} +15 -17
  98. package/{workflow.command-ks16jegk.js → workflow.command-42p9g0w8.js} +15 -15
  99. package/{workspace.command-ahhfpaag.js → workspace.command-91wx03de.js} +34 -38
  100. package/CodeAgent-fx6088tv.js +0 -11
  101. package/TunnelShare-9ry4vh0y.js +0 -18
  102. package/appExecutor-79azsb2w.js +0 -11
  103. package/cloud.script-3b401efv.js +0 -35
  104. package/context.runner-kctbfsde.js +0 -34
  105. 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-cfzqdsam.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-b3kjr19v.js";
15
15
  import {
16
16
  SOURCE_EXTS,
17
+ buildCacheStamp,
18
+ isBuildCacheStamp,
17
19
  FontOptimizer
18
- } from "./index-dmcpetwe.js";
20
+ } from "./index-w18qdjyf.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-66b1hrxh.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();
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  CommandContainer,
4
4
  runner
5
- } from "./index-2yn3r67f.js";
5
+ } from "./index-vznyyaf8.js";
6
6
  import {
7
7
  WorkspaceExecutor
8
- } from "./index-71y6176j.js";
8
+ } from "./index-609zbjve.js";
9
9
  import {
10
10
  jsonText,
11
11
  workflowPlanApproval,
@@ -31,23 +31,23 @@ import {
31
31
  renderWorkflowApply,
32
32
  renderWorkflowValidation,
33
33
  renderWorkflowRunArtifact
34
- } from "./index-zmd9xxgd.js";
34
+ } from "./index-g7hm77j6.js";
35
35
  import {
36
36
  AkanContextAnalyzer
37
- } from "./index-h901f24n.js";
37
+ } from "./index-ghs8gtvp.js";
38
38
  import {
39
39
  ModuleScript
40
- } from "./index-gt8phqpt.js";
40
+ } from "./index-6yefp97x.js";
41
41
  import {
42
42
  PrimitiveScript
43
- } from "./index-6dzjer7p.js";
43
+ } from "./index-jzwdwse0.js";
44
44
  import {
45
45
  spawnAkan,
46
46
  isWorkspaceTarget
47
- } from "./index-kfvjzk8r.js";
47
+ } from "./index-2ktpwjgf.js";
48
48
  import {
49
49
  ScalarScript
50
- } from "./index-4ss4gkv3.js";
50
+ } from "./index-0vv0a5h8.js";
51
51
  import {
52
52
  workflowSpecs
53
53
  } from "./index-t4d0ckde.js";
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  AppExecutor2
4
- } from "./index-z92zm3wd.js";
4
+ } from "./index-cfzqdsam.js";
5
5
  import {
6
6
  LibExecutor2
7
- } from "./index-zfnz878d.js";
7
+ } from "./index-c67vjafa.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-vznyyaf8.js";
19
19
 
20
20
  // pkgs/@akanjs/devkit/workflow/artifacts.ts
21
21
  import { capitalize as capitalize2 } from "akanjs/common";
@@ -8,21 +8,21 @@ import {
8
8
  isScannedRootEntry,
9
9
  extractBlockVersion,
10
10
  readDevkitVersion
11
- } from "./index-71y6176j.js";
11
+ } from "./index-609zbjve.js";
12
12
  import {
13
13
  FileSys2
14
- } from "./index-by2tvsq6.js";
14
+ } from "./index-zyjztrvc.js";
15
15
  import {
16
16
  AppExecutor2
17
- } from "./index-z92zm3wd.js";
17
+ } from "./index-cfzqdsam.js";
18
18
  import {
19
19
  LibExecutor2
20
- } from "./index-zfnz878d.js";
20
+ } from "./index-c67vjafa.js";
21
21
  import {
22
22
  workflowPathsForPlan,
23
23
  workflowRunArtifactPath,
24
24
  workflowSyncDir
25
- } from "./index-zmd9xxgd.js";
25
+ } from "./index-g7hm77j6.js";
26
26
  import {
27
27
  collectRecipeSources2,
28
28
  scanRecipes2,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-s885g0jj.js";
5
+ } from "./index-arcdcexp.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/tunnel/TunnelShare.ts
8
8
  import { TunnelAgent } from "akanjs/server/tunnel";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  getDirname2
4
- } from "./index-by2tvsq6.js";
4
+ } from "./index-zyjztrvc.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/guideline/conventionSet.ts
7
7
  import fsPromise from "fs/promises";
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  script
4
- } from "./index-2yn3r67f.js";
4
+ } from "./index-vznyyaf8.js";
5
5
  import {
6
6
  AppExecutor2
7
- } from "./index-z92zm3wd.js";
7
+ } from "./index-cfzqdsam.js";
8
8
  import {
9
9
  LibExecutor2
10
- } from "./index-zfnz878d.js";
10
+ } from "./index-c67vjafa.js";
11
11
  import {
12
12
  InteractionScaffold,
13
13
  workflowStatus,
@@ -46,16 +46,16 @@ import {
46
46
  nextActionsForTarget,
47
47
  createPrimitiveWriteReport,
48
48
  insertTemplateField
49
- } from "./index-zmd9xxgd.js";
49
+ } from "./index-g7hm77j6.js";
50
50
  import {
51
51
  ModuleScript
52
- } from "./index-gt8phqpt.js";
52
+ } from "./index-6yefp97x.js";
53
53
  import {
54
54
  plainNameProblem
55
55
  } from "./index-va90m8nd.js";
56
56
  import {
57
57
  ModuleExecutor
58
- } from "./index-7wf8snar.js";
58
+ } from "./index-zfmc4380.js";
59
59
 
60
60
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
61
61
  import { capitalize, lowerlize } from "akanjs/common";
@@ -2,15 +2,15 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-2yn3r67f.js";
5
+ } from "./index-vznyyaf8.js";
6
6
  import {
7
7
  CommandExecutionError,
8
8
  LibSource,
9
9
  formatLibStatuses
10
- } from "./index-71y6176j.js";
10
+ } from "./index-609zbjve.js";
11
11
  import {
12
12
  LibExecutor2
13
- } from "./index-zfnz878d.js";
13
+ } from "./index-c67vjafa.js";
14
14
  import {
15
15
  assertPlainName
16
16
  } from "./index-va90m8nd.js";
@@ -6,23 +6,23 @@ import {
6
6
  CloudApi,
7
7
  CloudUpdates,
8
8
  PipelineSecrets
9
- } from "./index-s885g0jj.js";
9
+ } from "./index-arcdcexp.js";
10
10
  import {
11
11
  resolveMobileTargets
12
12
  } from "./index-m9jj544v.js";
13
13
  import {
14
14
  WorkspaceExecutor
15
- } from "./index-71y6176j.js";
15
+ } from "./index-609zbjve.js";
16
16
  import {
17
17
  AppExecutor2
18
- } from "./index-z92zm3wd.js";
18
+ } from "./index-cfzqdsam.js";
19
19
  import {
20
20
  NativeApp
21
- } from "./index-ebn9kgea.js";
21
+ } from "./index-v0gt5ryd.js";
22
22
  import {
23
23
  runner,
24
24
  assertPromptable
25
- } from "./index-2yn3r67f.js";
25
+ } from "./index-vznyyaf8.js";
26
26
  import {
27
27
  getNpmRegistryUrl,
28
28
  getPublishedVersions,