@akanjs/cli 2.4.1-rc.3 → 2.4.1-rc.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.
Files changed (44) hide show
  1. package/.build-stamp +1 -0
  2. package/{agent.command-h4afc69n.js → agent.command-t4346579.js} +6 -6
  3. package/{application.command-jkmbsd1x.js → application.command-zkmeemdt.js} +5 -4
  4. package/{applicationBuildRunner-ny84tjhc.js → applicationBuildRunner-5w8j9yp7.js} +2 -1
  5. package/buildBatch.proc.js +3 -2
  6. package/{capacitorApp-y0h6cgft.js → capacitorApp-wnxzrppx.js} +2 -2
  7. package/{cloud.command-53j76grx.js → cloud.command-5ztqxppm.js} +8 -7
  8. package/{context.command-ds3mka9p.js → context.command-smwxwgwf.js} +13 -13
  9. package/{guideline.command-ya0dh44f.js → guideline.command-1r0esdjs.js} +3 -3
  10. package/incrementalBuilder.proc.js +36 -13
  11. package/index-0fn1r7gg.js +466 -0
  12. package/{index-1fpjvqhs.js → index-0jwvs8vp.js} +11 -11
  13. package/{index-a6sbyy0b.js → index-0t7pwff2.js} +3 -0
  14. package/{index-h6ca6qg0.js → index-2v10yr8g.js} +1 -1
  15. package/{index-m9pca6jv.js → index-2v6a4wd5.js} +4 -4
  16. package/{index-45aj5ry0.js → index-3sd2vape.js} +3 -3
  17. package/{index-gb26e7z0.js → index-ahpcr9ss.js} +3 -3
  18. package/{index-8rc0bm04.js → index-eay4t1te.js} +2 -2
  19. package/{index-qaq13qk3.js → index-eqxmxan6.js} +1 -1
  20. package/{index-pmm9e2jf.js → index-fh990y67.js} +2 -2
  21. package/{index-dynknvzd.js → index-gr4cjv99.js} +3 -3
  22. package/{index-1xdrsbry.js → index-hk58kr1m.js} +1 -1
  23. package/{index-85msc0wg.js → index-jbtn8h1y.js} +3 -3
  24. package/{index-q7zcac6n.js → index-khzzttv1.js} +108 -191
  25. package/{index-rgfxj6qc.js → index-n5y2gbf2.js} +307 -15
  26. package/{index-n6h3482q.js → index-nv7et4t3.js} +2 -2
  27. package/{index-hwzpw9c1.js → index-pya1h7wx.js} +3 -3
  28. package/{index-hdqztm58.js → index-qpz4csbs.js} +1 -1
  29. package/{index-0hjg9qs5.js → index-s9yajzkj.js} +5 -5
  30. package/{index-fmky5k3p.js → index-wh201a76.js} +5 -5
  31. package/{index-swf4bmbg.js → index-y4kg682s.js} +1 -1
  32. package/index.js +18 -18
  33. package/{library.command-r15zdqvp.js → library.command-jrew04m6.js} +3 -3
  34. package/{localRegistry.command-25sv5hmt.js → localRegistry.command-m08dkm1b.js} +7 -6
  35. package/{module.command-tnj2bzst.js → module.command-p98t7522.js} +6 -6
  36. package/{package.command-5x5m0ej1.js → package.command-57dyrfmn.js} +3 -3
  37. package/package.json +2 -2
  38. package/{page.command-c6xdx0xm.js → page.command-tas6f3na.js} +3 -3
  39. package/{primitive.command-q1ycj5vr.js → primitive.command-bjrbsakw.js} +7 -7
  40. package/{quality.command-es67wvdp.js → quality.command-zavaafbw.js} +2 -2
  41. package/{repair.command-677675vw.js → repair.command-je57wx67.js} +5 -5
  42. package/{scalar.command-bmrmp8n4.js → scalar.command-gqqyy1kr.js} +5 -5
  43. package/{workflow.command-64550hka.js → workflow.command-d6mrc47s.js} +10 -10
  44. package/{workspace.command-pmfxxfew.js → workspace.command-bbg96z8k.js} +20 -19
@@ -1,17 +1,17 @@
1
1
  // @bun
2
2
  import {
3
3
  AkanContextAnalyzer
4
- } from "./index-8rc0bm04.js";
4
+ } from "./index-eay4t1te.js";
5
5
  import {
6
6
  createRepairReport,
7
7
  generatedFilePathsForTarget,
8
8
  renderRepairReport,
9
9
  writeGeneratedSyncState,
10
10
  writeWorkflowRunArtifact
11
- } from "./index-h6ca6qg0.js";
11
+ } from "./index-2v10yr8g.js";
12
12
  import {
13
13
  runner
14
- } from "./index-hdqztm58.js";
14
+ } from "./index-qpz4csbs.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/repair/repair.runner.ts
17
17
  var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
@@ -3333,16 +3333,8 @@ var capitalize = (value) => `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
3333
3333
  var formatError2 = (err) => err instanceof Error ? err.message : String(err);
3334
3334
 
3335
3335
  // pkgs/@akanjs/devkit/frontendBuild/fontOptimizer.ts
3336
- import { mkdir as mkdir5 } from "fs/promises";
3336
+ import { mkdir as mkdir5, stat as stat3 } from "fs/promises";
3337
3337
  import path18 from "path";
3338
- import {
3339
- generateFontFace,
3340
- getMetricsForFamily,
3341
- readMetrics,
3342
- resolveCategoryFallbacks
3343
- } from "fontaine";
3344
- import { createFont, woff2 } from "fonteditor-core";
3345
- import subsetFont from "subset-font";
3346
3338
  import ts4 from "typescript";
3347
3339
  var FONT_URL_PREFIX = "/_akan/fonts";
3348
3340
  var DEFAULT_FONT_SUBSETS = ["latin"];
@@ -3355,6 +3347,7 @@ class FontOptimizer {
3355
3347
  #cssParts = [];
3356
3348
  #woff2Ready = null;
3357
3349
  static #ksX1001Text = null;
3350
+ static #cacheVersion = 1;
3358
3351
  constructor(app, command = "start") {
3359
3352
  this.#app = app;
3360
3353
  this.#command = command;
@@ -3362,6 +3355,12 @@ class FontOptimizer {
3362
3355
  }
3363
3356
  async optimize() {
3364
3357
  const fonts = await this.discoverFonts();
3358
+ const cacheKey = await this.#buildCacheKey(fonts);
3359
+ const cached = cacheKey ? await this.#readCache(cacheKey) : null;
3360
+ if (cached) {
3361
+ this.#app.verbose(`[font] reused ${cached.files.length} cached file(s); skipped subsetting`);
3362
+ return { css: cached.css, fonts, files: cached.files };
3363
+ }
3365
3364
  for (const font of fonts) {
3366
3365
  if (!this.#isFontOptimizationEnabled(font))
3367
3366
  continue;
@@ -3370,8 +3369,66 @@ class FontOptimizer {
3370
3369
  const fontUtilityCss = this.#buildFontUtilityRules(fonts);
3371
3370
  if (fontUtilityCss)
3372
3371
  this.#cssParts.push(fontUtilityCss);
3373
- return { css: this.#cssParts.join(`
3372
+ const result = { css: this.#cssParts.join(`
3374
3373
  `), fonts, files: this.#files };
3374
+ if (cacheKey)
3375
+ await this.#writeCache(cacheKey, result);
3376
+ return result;
3377
+ }
3378
+ get #cachePath() {
3379
+ return path18.join(this.#artifactRoot, "fontCache.json");
3380
+ }
3381
+ async#buildCacheKey(fonts) {
3382
+ const sources = [];
3383
+ for (const font of fonts) {
3384
+ if (!this.#isFontOptimizationEnabled(font))
3385
+ continue;
3386
+ for (const face of this.#getFontFaces(font)) {
3387
+ const sourcePath = await this.#resolveFontSourcePath(face.src);
3388
+ const stamp = sourcePath ? await this.#fileStamp(sourcePath) : null;
3389
+ if (!stamp)
3390
+ return null;
3391
+ sources.push({ optimizedSrc: face.optimizedSrc, ...stamp });
3392
+ }
3393
+ for (const filePath of font.subsetFiles ?? []) {
3394
+ const abs = path18.isAbsolute(filePath) ? filePath : path18.join(this.#app.cwdPath, filePath);
3395
+ const stamp = await this.#fileStamp(abs);
3396
+ if (!stamp)
3397
+ return null;
3398
+ sources.push({ subsetFile: filePath, ...stamp });
3399
+ }
3400
+ if (this.#getFontSubsets(font).includes("auto"))
3401
+ sources.push({ autoSubsetText: this.#hashFontConfig(await this.#collectAutoSubsetText()) });
3402
+ }
3403
+ return this.#hashFontConfig({ version: FontOptimizer.#cacheVersion, fonts, sources });
3404
+ }
3405
+ async#fileStamp(filePath) {
3406
+ try {
3407
+ const stats = await stat3(filePath);
3408
+ return { mtimeMs: Math.round(stats.mtimeMs), size: stats.size };
3409
+ } catch {
3410
+ return null;
3411
+ }
3412
+ }
3413
+ async#readCache(key) {
3414
+ const cache = await Bun.file(this.#cachePath).json().catch(() => null);
3415
+ if (cache?.version !== FontOptimizer.#cacheVersion || cache.key !== key)
3416
+ return null;
3417
+ const files = cache.files.map((relativePath) => path18.join(this.#artifactRoot, relativePath));
3418
+ for (const filePath of files) {
3419
+ if (!await Bun.file(filePath).exists())
3420
+ return null;
3421
+ }
3422
+ return { css: cache.css, files };
3423
+ }
3424
+ async#writeCache(key, result) {
3425
+ const cache = {
3426
+ version: FontOptimizer.#cacheVersion,
3427
+ key,
3428
+ css: result.css,
3429
+ files: result.files.map((filePath) => path18.relative(this.#artifactRoot, filePath))
3430
+ };
3431
+ await Bun.write(this.#cachePath, JSON.stringify(cache));
3375
3432
  }
3376
3433
  async discoverFonts() {
3377
3434
  const pageKeys = await this.#app.getPageKeys();
@@ -3381,7 +3438,10 @@ class FontOptimizer {
3381
3438
  const file = Bun.file(filePath);
3382
3439
  if (!await file.exists())
3383
3440
  return;
3384
- fonts.push(...this.#extractFontsExport(await file.text(), filePath));
3441
+ const source = await file.text();
3442
+ if (!source.includes("fonts"))
3443
+ return;
3444
+ fonts.push(...this.#extractFontsExport(source, filePath));
3385
3445
  }));
3386
3446
  return this.#dedupeFonts(fonts);
3387
3447
  }
@@ -3396,7 +3456,7 @@ class FontOptimizer {
3396
3456
  const outputPath = path18.join(this.#artifactRoot, face.optimizedSrc.replace(/^\/_akan\//, ""));
3397
3457
  await mkdir5(path18.dirname(outputPath), { recursive: true });
3398
3458
  const sourceBuffer = Buffer.from(await Bun.file(sourcePath).arrayBuffer());
3399
- const outputBuffer = font.subset === false ? await this.#convertToWoff2(sourceBuffer, sourcePath) : await subsetFont(sourceBuffer, await this.#getSubsetText(font), { targetFormat: "woff2" });
3459
+ const outputBuffer = await this.#buildFontBuffer(font, sourceBuffer, sourcePath);
3400
3460
  await Bun.write(outputPath, outputBuffer);
3401
3461
  this.#files.push(outputPath);
3402
3462
  faceCss.push(this.#buildOptimizedFontFaceRule(font, face));
@@ -3551,13 +3611,20 @@ class FontOptimizer {
3551
3611
  }
3552
3612
  return null;
3553
3613
  }
3614
+ async#buildFontBuffer(font, sourceBuffer, sourcePath) {
3615
+ if (font.subset === false)
3616
+ return this.#convertToWoff2(sourceBuffer, sourcePath);
3617
+ const { default: subsetFont } = await import("subset-font");
3618
+ return subsetFont(sourceBuffer, await this.#getSubsetText(font), { targetFormat: "woff2" });
3619
+ }
3554
3620
  async#convertToWoff2(buffer, sourcePath) {
3621
+ const { createFont } = await import("fonteditor-core");
3555
3622
  await this.#initWoff2();
3556
3623
  const font = createFont(buffer, { type: this.#getFontType(sourcePath, buffer) });
3557
3624
  return font.write({ type: "woff2", toBuffer: true });
3558
3625
  }
3559
3626
  async#initWoff2() {
3560
- this.#woff2Ready ??= woff2.init().then(() => {
3627
+ this.#woff2Ready ??= import("fonteditor-core").then(({ woff2 }) => woff2.init()).then(() => {
3561
3628
  return;
3562
3629
  });
3563
3630
  return this.#woff2Ready;
@@ -3669,6 +3736,7 @@ ${declarations.map(([prop, value]) => ` ${prop}: ${value};`).join(`
3669
3736
  async#buildFontaineFallbackCss(font, face, outputPath) {
3670
3737
  if (font.adjustFontFallback === false)
3671
3738
  return "";
3739
+ const { generateFontFace, getMetricsForFamily, readMetrics, resolveCategoryFallbacks } = await import("fontaine");
3672
3740
  const metrics = await readMetrics(outputPath).catch(() => null);
3673
3741
  if (!metrics)
3674
3742
  return "";
@@ -3722,133 +3790,11 @@ ${declarations.map(([prop, value]) => ` ${prop}: ${value};`).join(`
3722
3790
  }
3723
3791
  }
3724
3792
 
3725
- // pkgs/@akanjs/devkit/frontendBuild/hmrWatcher.ts
3726
- import fs3 from "fs";
3727
- import path20 from "path";
3728
-
3729
- // pkgs/@akanjs/devkit/frontendBuild/hmrChangeClassifier.ts
3730
- import path19 from "path";
3731
- var SOURCE_EXTS4 = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"]);
3732
- var CSS_EXTS = new Set([".css"]);
3733
- var CONFIG_BASENAMES2 = new Set(["akan.config.ts", "bunfig.toml", "tsconfig.json", "package.json"]);
3734
-
3735
- class HmrChangeClassifier {
3736
- classify(abs) {
3737
- if (this.#isUninteresting(abs))
3738
- return "ignore";
3739
- const base = path19.basename(abs);
3740
- if (CONFIG_BASENAMES2.has(base))
3741
- return "config";
3742
- const ext = path19.extname(abs).toLowerCase();
3743
- if (CSS_EXTS.has(ext))
3744
- return "css";
3745
- if (SOURCE_EXTS4.has(ext))
3746
- return "code";
3747
- return "ignore";
3748
- }
3749
- #isUninteresting(abs) {
3750
- const base = path19.basename(abs);
3751
- if (!base)
3752
- return true;
3753
- if (base.startsWith("."))
3754
- return true;
3755
- if (base.endsWith("~") || base.endsWith(".swp") || base.endsWith(".swx") || base.endsWith(".tmp"))
3756
- return true;
3757
- if (abs.includes(`${path19.sep}node_modules${path19.sep}`))
3758
- return true;
3759
- if (abs.includes(`${path19.sep}.akan${path19.sep}`))
3760
- return true;
3761
- return false;
3762
- }
3763
- }
3764
-
3765
- // pkgs/@akanjs/devkit/frontendBuild/hmrWatcher.ts
3766
- class HmrWatcher {
3767
- #roots;
3768
- #debounceMs;
3769
- #onBatch;
3770
- #logger;
3771
- #watchers = [];
3772
- #pending = new Map;
3773
- #classifier = new HmrChangeClassifier;
3774
- #timer = null;
3775
- #stopped = false;
3776
- #flushing = false;
3777
- constructor(opts) {
3778
- this.#roots = [...new Set(opts.roots.map((r) => path20.resolve(r)))];
3779
- this.#debounceMs = opts.debounceMs ?? 80;
3780
- this.#onBatch = opts.onBatch;
3781
- this.#logger = opts.logger;
3782
- }
3783
- start() {
3784
- for (const root of this.#roots) {
3785
- try {
3786
- const w = fs3.watch(root, { recursive: true, persistent: false }, (_event, filename) => {
3787
- if (!filename)
3788
- return;
3789
- const abs = path20.resolve(root, filename.toString());
3790
- this.#queue(abs);
3791
- });
3792
- this.#watchers.push(w);
3793
- this.#logger.verbose(`[hmr] watching ${root}`);
3794
- } catch (err) {
3795
- this.#logger.error(`[hmr] failed to watch ${root}: ${err.message}`);
3796
- }
3797
- }
3798
- }
3799
- stop() {
3800
- this.#stopped = true;
3801
- if (this.#timer)
3802
- clearTimeout(this.#timer);
3803
- for (const w of this.#watchers) {
3804
- try {
3805
- w.close();
3806
- } catch {}
3807
- }
3808
- }
3809
- #queue(abs) {
3810
- const kind = this.#classifier.classify(abs);
3811
- if (kind === "ignore")
3812
- return;
3813
- this.#pending.set(abs, kind);
3814
- if (this.#flushing)
3815
- return;
3816
- if (this.#timer)
3817
- clearTimeout(this.#timer);
3818
- this.#timer = setTimeout(() => this.#flush(), this.#debounceMs);
3819
- }
3820
- #flush() {
3821
- this.#timer = null;
3822
- if (this.#stopped || this.#pending.size === 0 || this.#flushing)
3823
- return;
3824
- this.#drain();
3825
- }
3826
- async#drain() {
3827
- this.#flushing = true;
3828
- try {
3829
- while (!this.#stopped && this.#pending.size > 0) {
3830
- const files = Array.from(this.#pending.keys());
3831
- const kinds = new Set(this.#pending.values());
3832
- this.#pending.clear();
3833
- try {
3834
- await this.#onBatch({ files, kinds });
3835
- } catch (e) {
3836
- this.#logger.error(`[hmr] onBatch error: ${e.message}`);
3837
- }
3838
- }
3839
- } finally {
3840
- this.#flushing = false;
3841
- if (!this.#stopped && this.#pending.size > 0)
3842
- this.#timer = setTimeout(() => this.#flush(), this.#debounceMs);
3843
- }
3844
- }
3845
- }
3846
-
3847
3793
  // pkgs/@akanjs/devkit/frontendBuild/pagesBundleBuilder.ts
3848
- import path22 from "path";
3794
+ import path20 from "path";
3849
3795
 
3850
3796
  // pkgs/@akanjs/devkit/transforms/externalizeFrameworkPlugin.ts
3851
- import path21 from "path";
3797
+ import path19 from "path";
3852
3798
  var DEFAULT_INCLUDE = ["akanjs/", "@apps/", "@libs/"];
3853
3799
  var DEFAULT_EXCLUDE_EXACT = new Set(["akanjs/webkit", "@akanjs/cli", "@akanjs/devkit"]);
3854
3800
  var DEFAULT_EXCLUDE_PREFIX = ["@akanjs/cli/", "@akanjs/devkit/"];
@@ -3891,7 +3837,7 @@ async function createExternalizeFrameworkPlugin(options) {
3891
3837
  const replPath = repl?.endsWith("/*") ? repl.slice(0, -1) : repl ?? "";
3892
3838
  if (!replPath)
3893
3839
  continue;
3894
- const candidate = path21.resolve(workspaceRoot, replPath + suffix);
3840
+ const candidate = path19.resolve(workspaceRoot, replPath + suffix);
3895
3841
  const hit = await firstExisting(candidate);
3896
3842
  if (hit)
3897
3843
  return hit;
@@ -3903,8 +3849,8 @@ async function createExternalizeFrameworkPlugin(options) {
3903
3849
  if (spec === pkg)
3904
3850
  continue;
3905
3851
  const suffix = spec.slice(pkg.length + 1);
3906
- const pkgDir = path21.dirname(path21.resolve(workspaceRoot, entryFile));
3907
- const candidate = path21.join(pkgDir, suffix);
3852
+ const pkgDir = path19.dirname(path19.resolve(workspaceRoot, entryFile));
3853
+ const candidate = path19.join(pkgDir, suffix);
3908
3854
  const hit = await firstExisting(candidate);
3909
3855
  if (hit)
3910
3856
  return hit;
@@ -3954,7 +3900,7 @@ async function firstExisting(basePath) {
3954
3900
  return candidate;
3955
3901
  }
3956
3902
  for (const ext of CANDIDATE_EXTS3) {
3957
- const candidate = path21.join(basePath, `index${ext}`);
3903
+ const candidate = path19.join(basePath, `index${ext}`);
3958
3904
  if (await Bun.file(candidate).exists())
3959
3905
  return candidate;
3960
3906
  }
@@ -4045,11 +3991,11 @@ class PagesBundleBuilder {
4045
3991
  const entryArtifact = result.outputs.find((a) => a.kind === "entry-point");
4046
3992
  if (!entryArtifact)
4047
3993
  throw new Error("[PagesBundleBuilder] Bun.build emitted no entry-point artifact");
4048
- const bundlePath = path22.resolve(entryArtifact.path);
3994
+ const bundlePath = path20.resolve(entryArtifact.path);
4049
3995
  const buildId = Date.now();
4050
3996
  const outputBytes = result.outputs.reduce((sum, output) => sum + output.size, 0);
4051
3997
  const chunkCount = result.outputs.filter((output) => output.kind === "chunk").length;
4052
- this.#app.verbose(`[PagesBundleBuilder] ${path22.basename(bundlePath)} emitted in ${Date.now() - this.#started}ms splitting=${this.#splitting} entry=${entryArtifact.size} bytes outputs=${result.outputs.length} chunks=${chunkCount} total=${outputBytes} bytes`);
3998
+ this.#app.verbose(`[PagesBundleBuilder] ${path20.basename(bundlePath)} emitted in ${Date.now() - this.#started}ms splitting=${this.#splitting} entry=${entryArtifact.size} bytes outputs=${result.outputs.length} chunks=${chunkCount} total=${outputBytes} bytes`);
4053
3999
  return {
4054
4000
  bundlePath,
4055
4001
  buildId,
@@ -4131,12 +4077,12 @@ function loaderFor4(absPath) {
4131
4077
  }
4132
4078
 
4133
4079
  // pkgs/@akanjs/devkit/frontendBuild/precompressArtifacts.ts
4134
- import fs4 from "fs";
4135
- import path23 from "path";
4080
+ import fs3 from "fs";
4081
+ import path21 from "path";
4136
4082
  var COMPRESSIBLE_EXTS = new Set([".css", ".html", ".js", ".json", ".svg"]);
4137
4083
  var MIN_COMPRESS_BYTES = 1024;
4138
4084
  async function precompressArtifacts(app) {
4139
- const roots = [path23.join(app.dist.cwdPath, ".akan/artifact/client")];
4085
+ const roots = [path21.join(app.dist.cwdPath, ".akan/artifact/client")];
4140
4086
  const result = { files: 0, inputBytes: 0, outputBytes: 0 };
4141
4087
  await Promise.all(roots.map((root) => precompressRoot(root, result)));
4142
4088
  if (result.files > 0) {
@@ -4145,7 +4091,7 @@ async function precompressArtifacts(app) {
4145
4091
  return result;
4146
4092
  }
4147
4093
  async function precompressRoot(root, result) {
4148
- if (!fs4.existsSync(root) || !fs4.statSync(root).isDirectory())
4094
+ if (!fs3.existsSync(root) || !fs3.statSync(root).isDirectory())
4149
4095
  return;
4150
4096
  const glob = new Bun.Glob("**/*");
4151
4097
  for await (const filePath of glob.scan({ cwd: root, absolute: true })) {
@@ -4162,7 +4108,7 @@ async function precompressRoot(root, result) {
4162
4108
  async function shouldPrecompress(filePath) {
4163
4109
  if (filePath.endsWith(".gz"))
4164
4110
  return false;
4165
- if (!COMPRESSIBLE_EXTS.has(path23.extname(filePath).toLowerCase()))
4111
+ if (!COMPRESSIBLE_EXTS.has(path21.extname(filePath).toLowerCase()))
4166
4112
  return false;
4167
4113
  const file = Bun.file(filePath);
4168
4114
  if (!await file.exists())
@@ -4181,7 +4127,7 @@ function formatBytes(bytes) {
4181
4127
  }
4182
4128
 
4183
4129
  // pkgs/@akanjs/devkit/frontendBuild/ssrBaseArtifactBuilder.ts
4184
- import path24 from "path";
4130
+ import path22 from "path";
4185
4131
  import { optimize } from "@tailwindcss/node";
4186
4132
  function prepareCssAsset(command, basePath, cssText) {
4187
4133
  return optimize(cssText, { file: `${basePath || "root"}.css`, minify: command === "build" }).code;
@@ -4197,7 +4143,7 @@ class SsrBaseArtifactBuilder {
4197
4143
  this.#app = app;
4198
4144
  this.#command = command;
4199
4145
  this.#artifactDir = `${command === "build" ? app.dist.cwdPath : app.cwdPath}/.akan/artifact`;
4200
- this.#absArtifactDir = path24.resolve(this.#artifactDir);
4146
+ this.#absArtifactDir = path22.resolve(this.#artifactDir);
4201
4147
  }
4202
4148
  async build() {
4203
4149
  const akanConfig = await this.#app.getConfig();
@@ -4219,7 +4165,7 @@ class SsrBaseArtifactBuilder {
4219
4165
  rscRuntimeSsrManifest,
4220
4166
  vendorMap,
4221
4167
  cssAssets,
4222
- pagesBundlePath: this.#command === "build" ? path24.relative(this.#absArtifactDir, pagesBundle.bundlePath) : pagesBundle.bundlePath,
4168
+ pagesBundlePath: this.#command === "build" ? path22.relative(this.#absArtifactDir, pagesBundle.bundlePath) : pagesBundle.bundlePath,
4223
4169
  pagesBundleBuildId: pagesBundle.buildId,
4224
4170
  domains: [...akanConfig.domains],
4225
4171
  subRoutes: Object.fromEntries(Array.from(akanConfig.subRoutes.entries()).map(([basePath, domains]) => [basePath, [...domains]])),
@@ -4235,18 +4181,18 @@ class SsrBaseArtifactBuilder {
4235
4181
  androidSha256CertFingerprints: target.deepLinks?.android?.sha256CertFingerprints
4236
4182
  }))
4237
4183
  };
4238
- await Bun.write(path24.join(this.#absArtifactDir, "base-artifact.json"), `${JSON.stringify(artifact, null, 2)}
4184
+ await Bun.write(path22.join(this.#absArtifactDir, "base-artifact.json"), `${JSON.stringify(artifact, null, 2)}
4239
4185
  `);
4240
4186
  this.#app.verbose(`[base-artifact] complete in ${Date.now() - this.#started}ms`);
4241
4187
  return { artifact, seedIndex, cssCompiler, optimizedFonts };
4242
4188
  }
4243
4189
  async#buildRuntimeClientEntries() {
4244
4190
  const akanServerPath = await this.#resolveAkanServerPath();
4245
- const rscClientEntry = path24.resolve(akanServerPath, "rscClient.tsx");
4246
- const rscSegmentOutletEntry = path24.resolve(akanServerPath, "rscSegmentOutlet.tsx");
4191
+ const rscClientEntry = path22.resolve(akanServerPath, "rscClient.tsx");
4192
+ const rscSegmentOutletEntry = path22.resolve(akanServerPath, "rscSegmentOutlet.tsx");
4247
4193
  const vendorEntries = VENDOR_SPECIFIERS.map((specifier) => ({
4248
4194
  specifier,
4249
- absPath: path24.resolve(akanServerPath, "vendor", `${specifier.replaceAll("/", "-").replaceAll(".", "-")}.ts`)
4195
+ absPath: path22.resolve(akanServerPath, "vendor", `${specifier.replaceAll("/", "-").replaceAll(".", "-")}.ts`)
4250
4196
  }));
4251
4197
  const entries = [rscClientEntry, rscSegmentOutletEntry, ...vendorEntries.map((v) => v.absPath)];
4252
4198
  const clientBundle = await new ClientEntriesBundler({ app: this.#app, entries, command: this.#command }).bundle();
@@ -4283,15 +4229,15 @@ class SsrBaseArtifactBuilder {
4283
4229
  async#resolveAkanServerPath() {
4284
4230
  const candidates = [];
4285
4231
  try {
4286
- candidates.push(path24.dirname(Bun.resolveSync("akanjs/server", this.#app.workspace.workspaceRoot)));
4232
+ candidates.push(path22.dirname(Bun.resolveSync("akanjs/server", this.#app.workspace.workspaceRoot)));
4287
4233
  } catch {}
4288
- candidates.push(path24.join(this.#app.workspace.workspaceRoot, "pkgs/akanjs/server"), path24.join(this.#app.workspace.workspaceRoot, "node_modules/akanjs/server"));
4234
+ candidates.push(path22.join(this.#app.workspace.workspaceRoot, "pkgs/akanjs/server"), path22.join(this.#app.workspace.workspaceRoot, "node_modules/akanjs/server"));
4289
4235
  try {
4290
- candidates.push(path24.dirname(Bun.resolveSync("akanjs/server", path24.dirname(Bun.main))));
4236
+ candidates.push(path22.dirname(Bun.resolveSync("akanjs/server", path22.dirname(Bun.main))));
4291
4237
  } catch {}
4292
- candidates.push(path24.join(path24.dirname(Bun.main), "node_modules/akanjs/server"), path24.join(path24.dirname(Bun.main), "../../akanjs/server"), path24.resolve(import.meta.dir, "../../server"), path24.resolve(import.meta.dir, "../server"));
4238
+ candidates.push(path22.join(path22.dirname(Bun.main), "node_modules/akanjs/server"), path22.join(path22.dirname(Bun.main), "../../akanjs/server"), path22.resolve(import.meta.dir, "../../server"), path22.resolve(import.meta.dir, "../server"));
4293
4239
  for (const candidate of candidates) {
4294
- if (await Bun.file(path24.join(candidate, "rscClient.tsx")).exists())
4240
+ if (await Bun.file(path22.join(candidate, "rscClient.tsx")).exists())
4295
4241
  return candidate;
4296
4242
  }
4297
4243
  throw new Error(`[base-artifact] failed to locate akanjs/server; looked in: ${candidates.join(", ")}`);
@@ -4320,38 +4266,9 @@ ${preparedCssText}`).toString(36);
4320
4266
  `styles/${cssAssetName}-${cssHash}.css`,
4321
4267
  `/_akan/styles/${cssAssetName}-${cssHash}.css`
4322
4268
  ];
4323
- await Bun.write(path24.join(this.#absArtifactDir, cssRelPath), preparedCssText);
4269
+ await Bun.write(path22.join(this.#absArtifactDir, cssRelPath), preparedCssText);
4324
4270
  this.#app.verbose(`[base-artifact] wrote ${preparedCssText.length} bytes of CSS for ${basePath} -> ${cssRelPath}`);
4325
4271
  return [basePath, { cssUrl, cssRelPath }];
4326
4272
  }
4327
4273
  }
4328
-
4329
- // pkgs/@akanjs/devkit/frontendBuild/watchRootResolver.ts
4330
- import fs5 from "fs";
4331
- import path25 from "path";
4332
-
4333
- class WatchRootResolver {
4334
- #app;
4335
- constructor(app) {
4336
- this.#app = app;
4337
- }
4338
- async resolve() {
4339
- const tsconfig = await this.#app.getTsConfig();
4340
- const set = new Set;
4341
- set.add(path25.resolve(`${this.#app.cwdPath}/page`));
4342
- for (const targets of Object.values(tsconfig.compilerOptions.paths ?? {})) {
4343
- for (const target of targets) {
4344
- if (!target)
4345
- continue;
4346
- if (path25.isAbsolute(target))
4347
- continue;
4348
- const cleaned = target.replace(/\/?\*+.*$/, "").replace(/\/[^/]+\.[^/]+$/, "");
4349
- const resolved = path25.resolve(this.#app.workspace.workspaceRoot, cleaned);
4350
- if (fs5.existsSync(resolved))
4351
- set.add(resolved);
4352
- }
4353
- }
4354
- return [...set];
4355
- }
4356
- }
4357
- export { GraphClientEntryDiscovery, RouteClientBuilder, AllRoutesBuilder, AutoImportSync, CsrArtifactBuilder, CssCompiler, DevChangePlanner, DevGeneratedIndexSync, FontOptimizer, HmrWatcher, PagesBundleBuilder, precompressArtifacts, SsrBaseArtifactBuilder, WatchRootResolver };
4274
+ export { GraphClientEntryDiscovery, RouteClientBuilder, AllRoutesBuilder, AutoImportSync, CsrArtifactBuilder, CssCompiler, DevChangePlanner, DevGeneratedIndexSync, FontOptimizer, PagesBundleBuilder, precompressArtifacts, SsrBaseArtifactBuilder };