@akanjs/cli 3.1.2-rc.4 → 3.2.0-rc.1

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 (120) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-z34p8m91.js → CodeAgent-vmd9k4ak.js} +3 -3
  3. package/{CodeTui-nvd9fk3g.js → CodeTui-zka44v52.js} +1 -1
  4. package/README.ko.md +9 -0
  5. package/README.md +9 -0
  6. package/TunnelShare-k3ja4w9x.js +14 -0
  7. package/{agent.command-962mp3kg.js → agent.command-2f657613.js} +19 -17
  8. package/akanCode.js +6 -6
  9. package/{application.command-1nr0bqq1.js → application.command-q6skd3am.js} +36 -22
  10. package/{applicationBuildRunner-xy7hnfzq.js → applicationBuildRunner-sctcmkyx.js} +55 -16
  11. package/buildBatch.proc.js +7 -7
  12. package/{cloud.command-cj7b3m6y.js → cloud.command-7642pks6.js} +36 -19
  13. package/cloud.script-1sfseznn.js +30 -0
  14. package/{code.command-asq7xrr6.js → code.command-7s4ndq2k.js} +6 -6
  15. package/commandManifest.json +1 -1
  16. package/{context.command-fw4g2pw1.js → context.command-569z0rqf.js} +20 -19
  17. package/context.runner-ms8v1rxy.js +29 -0
  18. package/{devTui-evr3b35y.js → devTui-w38ch13a.js} +1 -1
  19. package/{guideline.command-43gfjsjv.js → guideline.command-gnv3e8p8.js} +2 -2
  20. package/guidelines/akanApi/akanApi.instruction.md +317 -0
  21. package/guidelines/conventions/rules/app.md +5 -5
  22. package/guidelines/conventions/rules/config.md +1 -1
  23. package/guidelines/conventions/rules/gates.md +10 -5
  24. package/incrementalBuilder.proc.js +69 -39
  25. package/{index-0tkj05cz.js → index-0fb3cpbt.js} +3 -3
  26. package/{index-6t7fkx73.js → index-1q1cjn8s.js} +21 -11
  27. package/{index-tenw3mah.js → index-23860fej.js} +16 -6
  28. package/{index-6zgt7zmx.js → index-48d5qsj3.js} +4 -4
  29. package/{index-z47rw9ez.js → index-5w9my9qe.js} +8 -8
  30. package/{index-qwe079ww.js → index-6wpaq392.js} +61 -15
  31. package/{index-kc871vpc.js → index-7xdpww43.js} +69 -12
  32. package/index-7y5yghjg.js +2969 -0
  33. package/{index-38patcx6.js → index-8g7tdsk4.js} +249 -696
  34. package/{index-90q0w90q.js → index-8kczhnmv.js} +1 -1
  35. package/{index-kdswbvys.js → index-8pb9yvp8.js} +63 -21
  36. package/{index-hmj94es2.js → index-8ts9774g.js} +4 -4
  37. package/{index-r0q2ka2b.js → index-93ewzmp6.js} +43 -14
  38. package/{index-y0y0pnx8.js → index-9tbgb4d8.js} +1 -1
  39. package/{index-jzpeny42.js → index-a8a9ede9.js} +7 -7
  40. package/index-abgh0jve.js +126 -0
  41. package/{index-t0hk1kxq.js → index-aj3ehkcx.js} +1 -1
  42. package/{index-demt944k.js → index-d4n1wmrz.js} +37 -4
  43. package/{index-sra1a5f8.js → index-drz9e84d.js} +22 -8
  44. package/{index-gfh90r3t.js → index-e3vmjtph.js} +2 -2
  45. package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
  46. package/{index-g0yds382.js → index-ed6ea0qp.js} +1 -1
  47. package/{index-ap6ac70m.js → index-fjr4d6yd.js} +444 -368
  48. package/index-hqrkqxx2.js +176 -0
  49. package/{index-ampz4vgv.js → index-kpdv34rq.js} +4 -4
  50. package/{index-kc6ffq0s.js → index-ktb3wcqz.js} +73 -34
  51. package/{index-dcm66hss.js → index-mmym5xmb.js} +4 -2
  52. package/{index-8d9r465x.js → index-mqntfzv5.js} +2 -2
  53. package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
  54. package/index-p6hjwt2d.js +1668 -0
  55. package/{index-53h0053j.js → index-rc5fvqj2.js} +12 -14
  56. package/{index-jzz6ye8x.js → index-s2grpzef.js} +40 -8
  57. package/{index-38by07nw.js → index-sr5da35e.js} +32 -9
  58. package/{index-qev8p5wp.js → index-sy481q2x.js} +1 -1
  59. package/{index-ck64kxrn.js → index-thckcabc.js} +2 -2
  60. package/{index-2yan1ajk.js → index-v4p1zye8.js} +18 -9
  61. package/{index-wymcdsas.js → index-vkzfk7qt.js} +25 -23
  62. package/{index-r8t5sq7z.js → index-vr68mxj5.js} +68 -21
  63. package/{index-vkpqe29t.js → index-w639tvkd.js} +24 -125
  64. package/index-ygdbn9jn.js +122 -0
  65. package/{index-w60zxxye.js → index-zpv14wpy.js} +3 -3
  66. package/index.js +24 -23
  67. package/{library.command-zh29tjdd.js → library.command-1gp5qe3r.js} +3 -3
  68. package/{localRegistry.command-k9pn9ahj.js → localRegistry.command-x7jptkd3.js} +26 -17
  69. package/{module.command-dgpqs9fz.js → module.command-4xz9he6h.js} +6 -6
  70. package/{package.command-1je4hsca.js → package.command-s7qpnn1g.js} +12 -3
  71. package/package.json +2 -2
  72. package/{page.command-cgsasanh.js → page.command-fan34c49.js} +3 -3
  73. package/{pipeline.command-tb46sa8v.js → pipeline.command-ph4fnn9w.js} +2 -2
  74. package/{primitive.command-bzsy23x5.js → primitive.command-3fqh8emf.js} +7 -7
  75. package/{projectTypecheck-h8rgaczy.js → projectTypecheck-vkb40hjc.js} +1 -1
  76. package/{quality.command-120m9h6v.js → quality.command-ecj6exsh.js} +15 -10
  77. package/{repair.command-6m4wd0qv.js → repair.command-fe9jw719.js} +6 -6
  78. package/{scalar.command-3dn5hsc6.js → scalar.command-cnvfhk0n.js} +5 -5
  79. package/skills/akan-debug/SKILL.md +2 -1
  80. package/skills/akan-page/SKILL.md +16 -7
  81. package/skills/akan-service/SKILL.md +48 -19
  82. package/{subspace.command-s8nyfqbn.js → subspace.command-qw5ddd6y.js} +8 -8
  83. package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
  84. package/templates/app/page/_index.tsx +4 -284
  85. package/templates/app/page/_layout.tsx +1 -26
  86. package/templates/app/page/styles.css.template +58 -318
  87. package/templates/appSample/page/_index.tsx +281 -0
  88. package/templates/appSample/page/_layout.tsx +55 -0
  89. package/templates/appSample/page/styles.css.template +327 -0
  90. package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
  91. package/templates/workspaceRoot/package.json.template +1 -12
  92. package/{tunnel.command-8mwrqkr3.js → tunnel.command-ggj38mqf.js} +7 -7
  93. package/{verify.command-2pspfy7k.js → verify.command-w9ttxkdz.js} +16 -14
  94. package/{workflow.command-7sy5vnsj.js → workflow.command-ss8devj0.js} +12 -12
  95. package/{workspace.command-x518tdv4.js → workspace.command-6z2rh8ze.js} +51 -39
  96. package/TunnelShare-jwbb50kz.js +0 -14
  97. package/cloud.script-8kr7qgfa.js +0 -27
  98. package/context.runner-p6m5cxk3.js +0 -28
  99. package/index-d894868w.js +0 -842
  100. package/index-re2kfscb.js +0 -1363
  101. /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
  102. /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
  103. /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
  104. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
  105. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
  106. /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
  107. /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
  108. /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
  109. /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
  110. /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
  111. /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
  112. /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
  113. /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
  114. /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
  115. /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
  116. /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
  117. /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
  118. /package/templates/{app → appSample}/public/logo.png +0 -0
  119. /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
  120. /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
@@ -5,13 +5,14 @@ import {
5
5
  import {
6
6
  SOURCE_EXTS,
7
7
  WatchRootResolver
8
- } from "./index-d894868w.js";
8
+ } from "./index-p6hjwt2d.js";
9
9
  import {
10
10
  loaderFor,
11
11
  BarrelAnalyzer,
12
12
  createBarrelImportsPlugin,
13
13
  createTsconfigPackageResolver,
14
14
  rewriteBarrelImports,
15
+ bundleConditions,
15
16
  bundleDefine,
16
17
  CsrEntryFiles,
17
18
  toClientReferencePath,
@@ -19,11 +20,12 @@ import {
19
20
  CsrDevPaths,
20
21
  PagesEntrySourceGenerator,
21
22
  PagesBundleBuilder
22
- } from "./index-6t7fkx73.js";
23
+ } from "./index-1q1cjn8s.js";
23
24
  import {
24
25
  AsyncDefaultExportDetector,
26
+ StoreBootstrap,
25
27
  resolveSsrPageEntriesForApp
26
- } from "./index-38by07nw.js";
28
+ } from "./index-sr5da35e.js";
27
29
 
28
30
  // pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
29
31
  import { readdir, readFile, stat } from "fs/promises";
@@ -1329,6 +1331,7 @@ class ClientEntriesBundler {
1329
1331
  #external;
1330
1332
  #externalSubpaths;
1331
1333
  #externalAliases;
1334
+ #entryExports;
1332
1335
  #command;
1333
1336
  #target;
1334
1337
  #outputSubdir;
@@ -1340,9 +1343,11 @@ class ClientEntriesBundler {
1340
1343
  #entryUrlsByAbsPath = new Map;
1341
1344
  #entryOutputAbsByAbsPath = new Map;
1342
1345
  #entryDepsByAbsPath = new Map;
1346
+ #entryChunkUrlsByAbsPath = new Map;
1343
1347
  #clientReferenceIdByAbsPath = new Map;
1344
1348
  #opaqueEntries = null;
1345
1349
  #metafileOutputsByAbs = new Map;
1350
+ #metafileInputs = {};
1346
1351
  constructor(options) {
1347
1352
  this.#app = options.app;
1348
1353
  this.#entries = options.entries;
@@ -1350,6 +1355,7 @@ class ClientEntriesBundler {
1350
1355
  this.#external = options.external ?? [];
1351
1356
  this.#externalSubpaths = options.externalSubpaths ?? [];
1352
1357
  this.#externalAliases = options.externalAliases ?? {};
1358
+ this.#entryExports = options.entryExports ?? {};
1353
1359
  this.#command = options.command ?? "start";
1354
1360
  this.#target = options.target ?? "browser";
1355
1361
  this.#outputSubdir = options.outputSubdir ?? "client";
@@ -1370,6 +1376,7 @@ class ClientEntriesBundler {
1370
1376
  naming: CLIENT_BUNDLE_NAMING,
1371
1377
  metafile: true,
1372
1378
  define: bundleDefine(this.#app, this.#command, "ssr"),
1379
+ conditions: bundleConditions(this.#command),
1373
1380
  minify: this.#command === "build",
1374
1381
  optimizeImports: akanConfig.optimizeImports,
1375
1382
  reactFastRefresh: this.#command === "start" && this.#outputSubdir === "client" && this.#reactFastRefresh,
@@ -1382,14 +1389,18 @@ class ClientEntriesBundler {
1382
1389
  if (!metafile)
1383
1390
  throw new Error("[ClientEntriesBundler] metafile is missing");
1384
1391
  this.#metafileOutputsByAbs = new Map(Object.entries(metafile.outputs).map(([k, v]) => [this.#absFromOutdir(k), v]));
1392
+ this.#metafileInputs = metafile.inputs;
1385
1393
  for (const artifact of result.outputs.filter((a) => a.kind === "entry-point"))
1386
1394
  this.#addEntryArtifact(artifact.path);
1395
+ this.#assertNarrowedExports();
1387
1396
  return {
1388
1397
  manifest: this.#manifest,
1389
1398
  ssrManifest: this.#ssrManifest,
1390
1399
  entryUrlsByAbsPath: this.#entryUrlsByAbsPath,
1391
1400
  entryOutputAbsByAbsPath: this.#entryOutputAbsByAbsPath,
1392
1401
  entryDepsByAbsPath: this.#entryDepsByAbsPath,
1402
+ entryChunkUrlsByAbsPath: this.#entryChunkUrlsByAbsPath,
1403
+ externalsByChunkUrl: this.#collectExternalsByChunkUrl(),
1393
1404
  clientReferenceIdByAbsPath: this.#clientReferenceIdByAbsPath
1394
1405
  };
1395
1406
  }
@@ -1399,11 +1410,13 @@ class ClientEntriesBundler {
1399
1410
  const originalByAlias = new Map;
1400
1411
  const aliasedEntries = await Promise.all(this.#entries.map(async (entry) => {
1401
1412
  const absEntry = path5.resolve(entry);
1402
- const hash = Bun.hash(`${this.#app.name}
1413
+ const narrowed = this.#entryExports[absEntry];
1414
+ const key = `${this.#app.name}
1403
1415
  ${this.#outputSubdir}
1404
- ${absEntry}`).toString(36);
1405
- const aliasPath = path5.join(aliasDir, `${hash}.tsx`);
1406
- await Bun.write(aliasPath, this.#createOpaqueEntryAliasSource(absEntry, await this.#scanEntryExportNames(absEntry)));
1416
+ ${absEntry}${narrowed ? `
1417
+ narrowed` : ""}`;
1418
+ const aliasPath = path5.join(aliasDir, `${Bun.hash(key).toString(36)}.tsx`);
1419
+ await Bun.write(aliasPath, narrowed ? ClientEntriesBundler.narrowedAliasSource(absEntry, narrowed) : this.#createOpaqueEntryAliasSource(absEntry, await this.#scanEntryExportNames(absEntry)));
1407
1420
  originalByAlias.set(path5.resolve(aliasPath), absEntry);
1408
1421
  return aliasPath;
1409
1422
  }));
@@ -1422,6 +1435,23 @@ ${absEntry}`).toString(36);
1422
1435
  `)}
1423
1436
  `;
1424
1437
  }
1438
+ static narrowedAliasSource(absEntry, names) {
1439
+ const list = names.length > 0 ? `{ ${names.join(", ")} }` : "{}";
1440
+ return `export ${list} from ${JSON.stringify(path5.resolve(absEntry))};
1441
+ `;
1442
+ }
1443
+ #assertNarrowedExports() {
1444
+ const missing = Object.entries(this.#entryExports).flatMap(([absEntry, names = []]) => {
1445
+ const absOut = this.#entryOutputAbsByAbsPath.get(absEntry);
1446
+ if (!absOut)
1447
+ return [`${path5.basename(absEntry)}: no output`];
1448
+ const exported = new Set(this.#metafileOutputsByAbs.get(absOut)?.exports);
1449
+ const absent = names.filter((name) => !exported.has(name));
1450
+ return absent.length > 0 ? [`${path5.basename(absEntry)}: ${absent.join(", ")}`] : [];
1451
+ });
1452
+ if (missing.length > 0)
1453
+ throw new Error(`[ClientEntriesBundler] client code imports names its vendor does not export (${missing.join("; ")})`);
1454
+ }
1425
1455
  async#scanEntryExportNames(absEntry) {
1426
1456
  return scanUseClientExports(await Bun.file(absEntry).text(), absEntry, this.#app.workspace.workspaceRoot);
1427
1457
  }
@@ -1509,6 +1539,22 @@ ${absEntry}`).toString(36);
1509
1539
  }
1510
1540
  return urls;
1511
1541
  }
1542
+ #collectExternalsByChunkUrl() {
1543
+ const externalsByChunkUrl = new Map;
1544
+ if (this.#command !== "build" || this.#target !== "browser")
1545
+ return externalsByChunkUrl;
1546
+ for (const [absOut, info] of this.#metafileOutputsByAbs) {
1547
+ if (!absOut.endsWith(".js"))
1548
+ continue;
1549
+ const externals = new Set;
1550
+ for (const input of Object.keys(info.inputs ?? {}))
1551
+ for (const imp of this.#metafileInputs[input]?.imports ?? [])
1552
+ if (imp.external && imp.kind !== "dynamic-import" && !/^[./]/.test(imp.path))
1553
+ externals.add(imp.path);
1554
+ externalsByChunkUrl.set(this.#toServeUrl(absOut), [...externals].sort());
1555
+ }
1556
+ return externalsByChunkUrl;
1557
+ }
1512
1558
  #collectClientDeps(absOutPath, visited = new Set) {
1513
1559
  if (visited.has(absOutPath))
1514
1560
  return new Set;
@@ -1548,6 +1594,7 @@ ${absEntry}`).toString(36);
1548
1594
  this.#entryUrlsByAbsPath.set(entryPointAbs, entryUrl);
1549
1595
  this.#entryOutputAbsByAbsPath.set(entryPointAbs, absOut);
1550
1596
  this.#entryDepsByAbsPath.set(entryPointAbs, [...this.#collectClientDeps(absOut)].sort());
1597
+ this.#entryChunkUrlsByAbsPath.set(entryPointAbs, chunkUrls);
1551
1598
  const clientReferenceId = toClientReferencePath(entryPointAbs, this.#app.workspace.workspaceRoot);
1552
1599
  this.#clientReferenceIdByAbsPath.set(entryPointAbs, clientReferenceId);
1553
1600
  const flatChunks = [];
@@ -1575,6 +1622,16 @@ var VENDOR_SPECIFIERS = [
1575
1622
  "scheduler",
1576
1623
  "react-server-dom-webpack/client.browser",
1577
1624
  "akanjs/store",
1625
+ "akanjs/store/agent",
1626
+ "akanjs/base",
1627
+ "akanjs/common",
1628
+ "akanjs/constant",
1629
+ "akanjs/fetch",
1630
+ "tailwind-merge"
1631
+ ];
1632
+ var NARROWABLE_VENDOR_SPECIFIERS = [
1633
+ "akanjs/store",
1634
+ "akanjs/store/agent",
1578
1635
  "akanjs/base",
1579
1636
  "akanjs/common",
1580
1637
  "akanjs/constant",
@@ -1662,7 +1719,8 @@ class RouteClientBuilder {
1662
1719
  discoveredEntries: discovered,
1663
1720
  clientDeps: [...clientDeps].sort(),
1664
1721
  clientDepsByEntry,
1665
- ...registry ? { registryEntries: [...acceptedEntries].sort() } : {}
1722
+ ...registry ? { registryEntries: [...acceptedEntries].sort() } : {},
1723
+ ...browserBundle ? { externalsByChunkUrl: Object.fromEntries(browserBundle.externalsByChunkUrl) } : {}
1666
1724
  };
1667
1725
  }
1668
1726
  static #registryRow(paths, entry, row) {
@@ -1813,7 +1871,7 @@ ${declared.map(({ name }) => `export default ${name};`).join(`
1813
1871
  const originalEntry = JSON.stringify(path6.resolve(args.originalEntry));
1814
1872
  const namedExports = args.exportNames.filter((name) => name !== "default");
1815
1873
  const lines = [
1816
- `import ${JSON.stringify(`@apps/${args.appName}/client`)};`,
1874
+ ...StoreBootstrap.importLines(args.appName),
1817
1875
  ...namedExports.length > 0 ? [`export { ${namedExports.join(", ")} } from ${originalEntry};`] : []
1818
1876
  ];
1819
1877
  if (args.exportNames.includes("default"))
@@ -3191,8 +3249,7 @@ class SsrDevBundler extends DevRegistryBundler {
3191
3249
  await mkdir5(this.entryDir, { recursive: true });
3192
3250
  const file = path15.join(this.entryDir, "bootstrap.ts");
3193
3251
  const hasStore = await Bun.file(path15.join(this.app.cwdPath, "lib", "st.ts")).exists();
3194
- const source = hasStore ? `import ${JSON.stringify(`@apps/${this.app.name}/client`)};
3195
- ` : `export {};
3252
+ const source = hasStore ? StoreBootstrap.source(this.app.name) : `export {};
3196
3253
  `;
3197
3254
  const unchanged = await Bun.file(file).exists() && await Bun.file(file).text() === source;
3198
3255
  if (!unchanged)
@@ -3216,4 +3273,4 @@ class SsrDevBundler extends DevRegistryBundler {
3216
3273
  }
3217
3274
  }
3218
3275
 
3219
- export { computeRouteSeedIndex, saveRouteSeedIndex, GraphClientEntryDiscovery, ClientEntriesBundler, VENDOR_SPECIFIERS, RouteClientBuilder, AutoImportSync, CsrDevPatcher, CsrDevBundler, DevChangePlanner, DevGeneratedIndexSync, SsrDevBundler };
3276
+ export { computeRouteSeedIndex, saveRouteSeedIndex, GraphClientEntryDiscovery, ClientEntriesBundler, VENDOR_SPECIFIERS, NARROWABLE_VENDOR_SPECIFIERS, RouteClientBuilder, AutoImportSync, CsrDevPatcher, CsrDevBundler, DevChangePlanner, DevGeneratedIndexSync, SsrDevBundler };