@akanjs/cli 3.0.0-beta.26 → 3.0.0-beta.28

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 (61) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-p65jja35.js → CodeAgent-7acv4ah8.js} +2 -2
  3. package/{CodeTui-5xr8kxx4.js → CodeTui-9tkh34mj.js} +1 -1
  4. package/{agent.command-rp505zxa.js → agent.command-q9bmqrag.js} +5 -5
  5. package/akanCode.js +2 -2
  6. package/{application.command-afajz1m5.js → application.command-xpnkyx4z.js} +70 -8
  7. package/{applicationBuildRunner-412y0345.js → applicationBuildRunner-w4917tje.js} +67 -22
  8. package/buildBatch.proc.js +3 -3
  9. package/{cloud.command-yz0h8a2e.js → cloud.command-7yd624qd.js} +9 -9
  10. package/cloud.script-25vzkz7b.js +20 -0
  11. package/{code.command-jhrjttm1.js → code.command-fpx4gzmy.js} +6 -6
  12. package/commandManifest.json +1 -1
  13. package/{context.command-xncdvv7n.js → context.command-snn1k5q3.js} +13 -13
  14. package/context.runner-nzaf8c98.js +21 -0
  15. package/{guideline.command-d5qmxx29.js → guideline.command-ene55fkr.js} +2 -2
  16. package/guidelines/conventions/conventions.instruction.md +27 -7
  17. package/guidelines/runtimeRule/runtimeRule.instruction.md +107 -1
  18. package/incrementalBuilder.proc.js +2 -2
  19. package/{index-cfj73ck1.js → index-0ej0sr6m.js} +225 -47
  20. package/{index-hzy4pe24.js → index-0pqzrbpr.js} +2 -2
  21. package/{index-6dt6zft6.js → index-20r2g1t3.js} +4 -4
  22. package/{index-xfgdmm5d.js → index-2ctqegdm.js} +2 -2
  23. package/{index-d65fzxvd.js → index-2s2e5qnd.js} +1 -1
  24. package/{index-t02g6dpn.js → index-2z30v4k5.js} +3 -3
  25. package/{index-tpdn30ya.js → index-52n8xr63.js} +1 -1
  26. package/{index-mq74nzf8.js → index-9j0kykc6.js} +5 -5
  27. package/{index-58cyna2s.js → index-b68zfsvz.js} +1 -1
  28. package/{index-qm4fppfk.js → index-ewbek95g.js} +3 -3
  29. package/{index-wvebzf0y.js → index-fy42hyb9.js} +7 -3
  30. package/{index-zazvn45w.js → index-genegfnt.js} +4 -4
  31. package/{index-da72pfdv.js → index-h9ed99ax.js} +7 -7
  32. package/{index-per2kqy9.js → index-k7809wmg.js} +2 -2
  33. package/{index-50rq2qms.js → index-n9704w6y.js} +4 -4
  34. package/{index-860zjnr1.js → index-nbg9bfnr.js} +1 -1
  35. package/{index-5mm3g24t.js → index-qtz88kh0.js} +2 -2
  36. package/{index-0n9q1f23.js → index-r8gp8zk3.js} +231 -98
  37. package/{index-ggfhz9ab.js → index-rbeahw6j.js} +3 -3
  38. package/{index-56xwsgyn.js → index-rrt9pnb4.js} +2 -2
  39. package/{index-v4hnkqz9.js → index-ss828r32.js} +1 -1
  40. package/index-tfe3711h.js +947 -0
  41. package/{index-cd9qt2t6.js → index-ttn00pr3.js} +223 -33
  42. package/{index-7yxndzea.js → index-vt64c067.js} +11 -9
  43. package/index.js +21 -21
  44. package/{library.command-sv6g1h2g.js → library.command-tz7vnwea.js} +3 -3
  45. package/{localRegistry.command-fm41vdtw.js → localRegistry.command-f39yk7be.js} +8 -8
  46. package/{module.command-ccdeder9.js → module.command-qhc9ns0s.js} +5 -5
  47. package/{package.command-xmw605b1.js → package.command-z3epnvas.js} +3 -3
  48. package/package.json +2 -2
  49. package/{page.command-ky7vafsn.js → page.command-exd2vakz.js} +3 -3
  50. package/{primitive.command-bh6j8nfs.js → primitive.command-0w6cha4j.js} +6 -6
  51. package/{quality.command-rqqrpe98.js → quality.command-je4kc9yv.js} +2 -2
  52. package/{repair.command-n9nsm9qe.js → repair.command-knvwfgtg.js} +5 -5
  53. package/{scalar.command-t09gmck8.js → scalar.command-60nxfchc.js} +4 -4
  54. package/{subspace.command-y1p56wyv.js → subspace.command-0e53tvxk.js} +4 -4
  55. package/templates/server.ts +1 -1
  56. package/{tunnel.command-4g95vhsn.js → tunnel.command-7m2kxtat.js} +2 -2
  57. package/{workflow.command-b91ph8sx.js → workflow.command-j5tk13ds.js} +10 -10
  58. package/{workspace.command-d8he10tv.js → workspace.command-wypqk2zb.js} +20 -20
  59. package/cloud.script-zez2b8am.js +0 -20
  60. package/context.runner-pjy89k2s.js +0 -21
  61. package/index-ys6f0bvh.js +0 -471
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  AsyncDefaultExportDetector,
11
11
  resolveSsrPageEntriesForApp
12
- } from "./index-0n9q1f23.js";
12
+ } from "./index-r8gp8zk3.js";
13
13
 
14
14
  // pkgs/@akanjs/devkit/artifact/routeSeedIndex.ts
15
15
  import path from "path";
@@ -1110,6 +1110,7 @@ import path7 from "path";
1110
1110
  class CsrDevPaths {
1111
1111
  static modulePrefix = "akan-module:";
1112
1112
  static stubPrefix = "stub:";
1113
+ static emptyStubPrefix = "stub:empty:";
1113
1114
  static vendorPrefix = "vendor:";
1114
1115
  root;
1115
1116
  constructor(workspaceRoot) {
@@ -2457,6 +2458,7 @@ class CsrDevResolver {
2457
2458
  #fallbacks = new Set;
2458
2459
  #runtimeResolved = new Map;
2459
2460
  #browserMaps = new Map;
2461
+ #loaded = new Set;
2460
2462
  #startedAt;
2461
2463
  #prepassDone = false;
2462
2464
  constructor({
@@ -2496,9 +2498,45 @@ class CsrDevResolver {
2496
2498
  optimizeImports: this.#context.optimizeImports,
2497
2499
  plugins: [PagesBundleBuilder.createCssStubPlugin()]
2498
2500
  });
2499
- const { inputs } = result.metafile;
2501
+ this.#record(result.metafile.inputs);
2502
+ this.#prepassDone = true;
2503
+ }
2504
+ async cover(files) {
2505
+ if (!this.#prepassDone)
2506
+ return;
2507
+ const pending = files.filter((file) => CsrDevPaths.isScript(file) && !this.#loaded.has(file));
2508
+ if (pending.length === 0)
2509
+ return;
2510
+ for (const file of pending)
2511
+ this.#loaded.add(file);
2512
+ const entries = new Set(pending);
2513
+ const result = await Bun.build({
2514
+ entrypoints: pending,
2515
+ target: "browser",
2516
+ metafile: true,
2517
+ throw: false,
2518
+ external: [...this.#context.externals ?? []],
2519
+ env: "AKAN_PUBLIC_*",
2520
+ define: this.#context.define,
2521
+ plugins: [
2522
+ {
2523
+ name: "akan-csr-cover",
2524
+ setup: (build) => {
2525
+ build.onLoad({ filter: /.*/ }, (args) => entries.has(CsrDevPaths.realpath(args.path)) ? undefined : { contents: "module.exports = {};", loader: "js" });
2526
+ }
2527
+ }
2528
+ ]
2529
+ });
2530
+ if (result.metafile)
2531
+ this.#record(result.metafile.inputs, entries);
2532
+ }
2533
+ #record(inputs, only) {
2500
2534
  for (const [input, { imports }] of Object.entries(inputs)) {
2501
2535
  const importer = CsrDevPaths.realpath(path14.resolve(input));
2536
+ if (only && !only.has(importer))
2537
+ continue;
2538
+ if (imports.every((record) => record.original))
2539
+ this.#loaded.add(importer);
2502
2540
  for (const record of imports) {
2503
2541
  if (!record.original)
2504
2542
  continue;
@@ -2514,11 +2552,13 @@ class CsrDevResolver {
2514
2552
  this.#runtimeResolved.get(importer)?.delete(record.original);
2515
2553
  }
2516
2554
  }
2517
- this.#prepassDone = true;
2518
2555
  }
2519
2556
  resolve(importer, specifier, kind = "import") {
2520
2557
  if (this.#isInlineSpecifier(specifier))
2521
2558
  return CsrDevResolver.inline;
2559
+ const disabled = this.#disabledInBrowser(importer, specifier, kind);
2560
+ if (disabled)
2561
+ return disabled;
2522
2562
  const known = this.#resolution.get(importer)?.get(specifier);
2523
2563
  const usable = known && this.#stillAnswers(importer, specifier, known, kind) ? known : null;
2524
2564
  const target = usable ?? this.#resolveUnknown(importer, specifier, kind);
@@ -2553,24 +2593,41 @@ class CsrDevResolver {
2553
2593
  return base === packageName || base.startsWith(`${packageName}/`);
2554
2594
  });
2555
2595
  }
2596
+ #disabledInBrowser(importer, specifier, kind) {
2597
+ const map = this.#browserMapOf(path14.dirname(importer));
2598
+ if (!map || map.offFiles.size === 0 && map.offNames.size === 0)
2599
+ return null;
2600
+ if (!specifier.startsWith(".") && !path14.isAbsolute(specifier))
2601
+ return map.offNames.has(specifier) ? `${CsrDevPaths.emptyStubPrefix}${specifier}` : null;
2602
+ const target = CsrDevPaths.resolveRelative(path14.dirname(importer), specifier, kind);
2603
+ return target && map.offFiles.has(CsrDevPaths.realpath(target)) ? `${CsrDevPaths.emptyStubPrefix}${this.#paths.idOf(target)}` : null;
2604
+ }
2556
2605
  #hasBrowserMap(dir) {
2606
+ return this.#browserMapOf(dir) !== null;
2607
+ }
2608
+ #browserMapOf(dir) {
2557
2609
  const cached = this.#browserMaps.get(dir);
2558
2610
  if (cached !== undefined)
2559
2611
  return cached;
2560
2612
  const pkgFile = path14.join(dir, "package.json");
2561
2613
  const parent = path14.dirname(dir);
2562
- let mapped;
2614
+ let map = null;
2563
2615
  if (fs6.existsSync(pkgFile)) {
2564
2616
  try {
2565
2617
  const browser = JSON.parse(fs6.readFileSync(pkgFile, "utf8")).browser;
2566
- mapped = typeof browser === "object" && browser !== null;
2567
- } catch {
2568
- mapped = false;
2569
- }
2570
- } else
2571
- mapped = parent !== dir && this.#hasBrowserMap(parent);
2572
- this.#browserMaps.set(dir, mapped);
2573
- return mapped;
2618
+ if (typeof browser === "object" && browser !== null) {
2619
+ const off = Object.entries(browser).filter(([, target]) => target === false).map(([key]) => key);
2620
+ const files = off.filter((key) => key.startsWith(".")).map((key) => CsrDevPaths.resolveRelative(dir, key)).filter((file) => !!file);
2621
+ map = {
2622
+ offFiles: new Set(files.map((file) => CsrDevPaths.realpath(file))),
2623
+ offNames: new Set(off.filter((key) => !key.startsWith(".")))
2624
+ };
2625
+ }
2626
+ } catch {}
2627
+ } else if (parent !== dir)
2628
+ map = this.#browserMapOf(parent);
2629
+ this.#browserMaps.set(dir, map);
2630
+ return map;
2574
2631
  }
2575
2632
  forget(importer) {
2576
2633
  this.#resolution.delete(importer);
@@ -3161,6 +3218,11 @@ class CsrDevArtifactWriter {
3161
3218
  const stubs = new Set(Object.values(graph.modules).flatMap((module) => module.deps.filter(CsrDevPaths.isStub)));
3162
3219
  const lines = [await this.#helperDefinitions(graph, ids), ...await this.#defineLines(ids)];
3163
3220
  for (const stub of [...stubs].sort()) {
3221
+ if (stub.startsWith(CsrDevPaths.emptyStubPrefix)) {
3222
+ lines.push(`__akan.define(${JSON.stringify(stub)}, function () {});
3223
+ `);
3224
+ continue;
3225
+ }
3164
3226
  const message = `[akan-csr] ${stub.slice(CsrDevPaths.stubPrefix.length)} is a Node built-in the browser does not have`;
3165
3227
  lines.push(`__akan.define(${JSON.stringify(stub)}, function () {
3166
3228
  throw new Error(${JSON.stringify(message)});
@@ -3293,8 +3355,48 @@ class CsrDevArtifactWriter {
3293
3355
 
3294
3356
  // pkgs/@akanjs/devkit/frontendBuild/csrDevModuleCompiler.ts
3295
3357
  import path18 from "path";
3358
+
3359
+ // pkgs/@akanjs/devkit/frontendBuild/csrDevFactoryCheck.ts
3360
+ class CsrDevFactoryCheck {
3361
+ static #parsed = new Set;
3362
+ static problemOf(factory, helperDefinition = "") {
3363
+ const key = Bun.hash(`${helperDefinition}\x00${factory}`);
3364
+ if (CsrDevFactoryCheck.#parsed.has(key))
3365
+ return null;
3366
+ const problem = CsrDevFactoryCheck.#syntaxError(`${helperDefinition}return (${factory});`);
3367
+ if (problem === null) {
3368
+ CsrDevFactoryCheck.#parsed.add(key);
3369
+ return null;
3370
+ }
3371
+ if (problem.includes("import.meta")) {
3372
+ const line = factory.split(`
3373
+ `).findIndex((text) => /(?<![\w$.])import\.meta\b/.test(text));
3374
+ return `import.meta is left in it${line > 0 ? ` (compiled line ${line})` : ""}, which a classic script cannot hold: ${problem}`;
3375
+ }
3376
+ if (CsrDevFactoryCheck.#syntaxError(`${helperDefinition}return (async ${factory});`) === null)
3377
+ return `a top-level await is left in it, which a CommonJS factory cannot wait on: ${problem}`;
3378
+ return problem;
3379
+ }
3380
+ static thrower(id, problem) {
3381
+ const message = `[akan-csr] ${id} was left out of the dev registry: ${problem}`;
3382
+ return `function () {
3383
+ throw new Error(${JSON.stringify(message)});
3384
+ }`;
3385
+ }
3386
+ static #syntaxError(source) {
3387
+ try {
3388
+ new Function(source);
3389
+ return null;
3390
+ } catch (error) {
3391
+ return error instanceof Error ? error.message : String(error);
3392
+ }
3393
+ }
3394
+ }
3395
+
3396
+ // pkgs/@akanjs/devkit/frontendBuild/csrDevModuleCompiler.ts
3296
3397
  class CsrDevModuleCompiler {
3297
3398
  static #storeRoot = /(?:^|\/)lib\/st\.ts$/;
3399
+ static #macroImport = /\b(?:with|assert)\s*\{\s*type\s*:\s*["']macro["']/;
3298
3400
  static #factoryArgument = /(?<![\w$.])(?:require|module|exports|__akanImport|\$RefreshReg\$|\$RefreshSig\$)(?![\w$]|\s*:)/;
3299
3401
  static #helperPatches = [
3300
3402
  ["__toESM", "(mod, isNodeMode, target)", "toESM"],
@@ -3326,6 +3428,7 @@ class CsrDevModuleCompiler {
3326
3428
  const refusedVendors = refuseNewVendor ? frontier.filter((file) => CsrDevPaths.isVendorFile(file)) : [];
3327
3429
  if (refusedVendors.length > 0)
3328
3430
  return { modules: [...compiled.values()], refusedVendors, unresolved: [] };
3431
+ await this.#resolver.cover(frontier);
3329
3432
  const round = await this.#compileRound(frontier);
3330
3433
  if (round.misses.length > 0 && !this.#resolver.prepassDone && refusePrepass)
3331
3434
  return { modules: [...compiled.values()], refusedVendors: [], unresolved: round.misses };
@@ -3373,21 +3476,29 @@ class CsrDevModuleCompiler {
3373
3476
  const mtimes = new Map(files.map((file) => [CsrDevPaths.realpath(file), CsrDevPaths.mtimeOf(file)]));
3374
3477
  const hashes = new Map(await Promise.all(files.map(async (file) => [CsrDevPaths.realpath(file), vendor ? "" : await CsrDevPaths.hashOf(file)])));
3375
3478
  const misses = [];
3376
- const result = await Bun.build({
3377
- entrypoints: files,
3378
- root: this.#paths.root,
3379
- target: "browser",
3380
- format: "cjs",
3381
- reactFastRefresh: !vendor,
3382
- sourcemap: vendor ? "none" : "external",
3383
- naming: { entry: "[dir]/[name].[ext]", asset: "assets/[name]-[hash].[ext]" },
3384
- publicPath: this.#routePrefix,
3385
- metafile: true,
3386
- env: "AKAN_PUBLIC_*",
3387
- define: this.#context.define,
3388
- optimizeImports: this.#context.optimizeImports,
3389
- plugins: [this.#registryPlugin(vendor, misses)]
3390
- });
3479
+ const macroOutputs = vendor ? new Map : await this.#evaluateMacros(files);
3480
+ let result;
3481
+ try {
3482
+ result = await Bun.build({
3483
+ entrypoints: files,
3484
+ root: this.#paths.root,
3485
+ target: "browser",
3486
+ format: "cjs",
3487
+ reactFastRefresh: !vendor,
3488
+ sourcemap: vendor ? "none" : "external",
3489
+ naming: { entry: "[dir]/[name].[ext]", asset: "assets/[name]-[hash].[ext]" },
3490
+ publicPath: this.#routePrefix,
3491
+ metafile: true,
3492
+ env: "AKAN_PUBLIC_*",
3493
+ define: { ...this.#context.define, "import.meta": "__akanMeta" },
3494
+ optimizeImports: this.#context.optimizeImports,
3495
+ plugins: [this.#registryPlugin(vendor, misses, macroOutputs)]
3496
+ });
3497
+ } catch (error) {
3498
+ if (vendor && error instanceof AggregateError)
3499
+ return await this.#withoutFailed(files, error);
3500
+ throw error;
3501
+ }
3391
3502
  const { outputs } = result.metafile;
3392
3503
  const sourceMaps = new Map(result.outputs.filter((artifact) => artifact.kind === "sourcemap").map((artifact) => [artifact.path, artifact]));
3393
3504
  const modules = [];
@@ -3412,12 +3523,20 @@ class CsrDevModuleCompiler {
3412
3523
  }
3413
3524
  const code = await artifact.text();
3414
3525
  const id = this.#paths.idOf(file);
3526
+ const built = CsrDevModuleCompiler.#factory(id, code);
3527
+ const problem = CsrDevFactoryCheck.problemOf(built.factory, built.helpers?.definition);
3528
+ if (problem && !vendor)
3529
+ throw new Error(`[csr-dev] ${id}: its factory does not parse as a classic script: ${problem}`);
3530
+ if (problem) {
3531
+ modules.push(this.#leftOut(file, problem));
3532
+ continue;
3533
+ }
3415
3534
  const sourceMap = sourceMaps.get(`${artifact.path}.map`);
3416
3535
  modules.push({
3417
3536
  id,
3418
3537
  file,
3419
3538
  vendor,
3420
- ...CsrDevModuleCompiler.#factory(id, code),
3539
+ ...built,
3421
3540
  sourceMap: sourceMap ? this.#rebaseSourceMap(await sourceMap.text()) : undefined,
3422
3541
  deps: this.#emittedDeps(code),
3423
3542
  mtimeMs: mtimes.get(file) ?? CsrDevPaths.mtimeOf(file),
@@ -3426,11 +3545,81 @@ class CsrDevModuleCompiler {
3426
3545
  }
3427
3546
  return { modules, misses, tangled };
3428
3547
  }
3429
- #registryPlugin(vendor, misses) {
3548
+ async#withoutFailed(files, error) {
3549
+ const reasons = new Map;
3550
+ for (const message of error.errors) {
3551
+ const file = message.position?.file;
3552
+ if (typeof file !== "string" || !path18.isAbsolute(file))
3553
+ continue;
3554
+ const real = CsrDevPaths.realpath(file);
3555
+ const at = message.position?.line ? `:${message.position.line}` : "";
3556
+ reasons.set(real, [...reasons.get(real) ?? [], `${String(message.message)} (${this.#paths.idOf(real)}${at})`]);
3557
+ }
3558
+ const failed = new Set(files.filter((file) => reasons.has(CsrDevPaths.realpath(file))));
3559
+ if (failed.size === 0)
3560
+ throw error;
3561
+ const rest = files.filter((file) => !failed.has(file));
3562
+ const round = rest.length > 0 ? await this.#bunBuild(rest, true) : { modules: [], misses: [], tangled: [] };
3563
+ for (const file of failed) {
3564
+ const text = (reasons.get(CsrDevPaths.realpath(file)) ?? []).join("; ");
3565
+ const awaits = text.includes('"await" can only be used');
3566
+ round.modules.push(this.#leftOut(file, awaits ? `a top-level await, which a CommonJS factory cannot wait on: ${text}` : text));
3567
+ }
3568
+ return round;
3569
+ }
3570
+ #leftOut(file, problem) {
3571
+ const real = CsrDevPaths.realpath(file);
3572
+ const id = this.#paths.idOf(real);
3573
+ this.#app.logger.error(`[csr-dev] ${id} is left out of the dev registry: ${problem}`);
3574
+ return {
3575
+ id,
3576
+ file: real,
3577
+ vendor: true,
3578
+ factory: CsrDevFactoryCheck.thrower(id, problem),
3579
+ helpers: null,
3580
+ deps: [],
3581
+ mtimeMs: CsrDevPaths.mtimeOf(real),
3582
+ hash: ""
3583
+ };
3584
+ }
3585
+ async#evaluateMacros(files) {
3586
+ const sources = await Promise.all(files.map(async (file) => [file, await Bun.file(file).text()]));
3587
+ const importers = sources.filter(([, source]) => CsrDevModuleCompiler.#macroImport.test(source));
3588
+ const outputs = await Promise.all(importers.map(async ([file]) => {
3589
+ const result = await Bun.build({
3590
+ entrypoints: [file],
3591
+ target: "browser",
3592
+ format: "esm",
3593
+ plugins: [
3594
+ {
3595
+ name: "akan-csr-macro-pass",
3596
+ setup: (build) => void build.onResolve({ filter: /.*/ }, (args) => args.importer ? { path: args.path, external: true } : undefined)
3597
+ }
3598
+ ]
3599
+ });
3600
+ const [output] = result.outputs;
3601
+ if (!output)
3602
+ throw new Error(`[csr-dev] ${this.#paths.idOf(file)}: its macro pass wrote no output`);
3603
+ const text = await output.text();
3604
+ return [
3605
+ [file, text],
3606
+ [CsrDevPaths.realpath(file), text]
3607
+ ];
3608
+ }));
3609
+ return new Map(outputs.flat());
3610
+ }
3611
+ #registryPlugin(vendor, misses, macroOutputs) {
3430
3612
  return {
3431
3613
  name: "akan-csr-registry",
3432
3614
  setup: (build) => {
3433
3615
  build.onLoad({ filter: /\.css$/ }, () => ({ contents: "", loader: "js" }));
3616
+ if (macroOutputs.size > 0) {
3617
+ const exact = [...macroOutputs.keys()].map((file) => file.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
3618
+ build.onLoad({ filter: new RegExp(`^(?:${exact.join("|")})$`) }, (args) => {
3619
+ const contents = macroOutputs.get(args.path);
3620
+ return contents === undefined ? undefined : { contents, loader: "js" };
3621
+ });
3622
+ }
3434
3623
  if (!vendor)
3435
3624
  build.onLoad({ filter: /\.tsx$/ }, async (args) => {
3436
3625
  if (CsrDevPaths.isVendorFile(args.path))
@@ -3476,7 +3665,7 @@ class CsrDevModuleCompiler {
3476
3665
  }
3477
3666
  static #factory(id, code) {
3478
3667
  const prefix = CsrDevPaths.modulePrefix;
3479
- let patched = code.replaceAll(`import("${prefix}`, `__akanImport("${prefix}`).replace(/^\/\/# debugId=.*$/m, "");
3668
+ let patched = code.replace(/^#!/, "//").replaceAll(`import("${prefix}`, `__akanImport("${prefix}`).replace(/^\/\/# debugId=.*$/m, "");
3480
3669
  const marker = patched.search(/^\/\/ /m);
3481
3670
  const body = marker < 0 ? "" : patched.slice(marker);
3482
3671
  for (const [name, params, method] of CsrDevModuleCompiler.#helperPatches) {
@@ -3490,8 +3679,9 @@ class CsrDevModuleCompiler {
3490
3679
  patched += `
3491
3680
  module.hot.accept();`;
3492
3681
  const shared = CsrDevModuleCompiler.#shareHelpers(patched);
3682
+ const meta = /(?<![\w$.])__akanMeta(?![\w$])/.test(patched) ? ` var __akanMeta = { url: new URL(${JSON.stringify(id.startsWith("/") ? id : `/${id}`)}, self.location.href).href };` : "";
3493
3683
  return {
3494
- factory: `function (require, module, exports, $RefreshReg$, $RefreshSig$, __akanImport) {
3684
+ factory: `function (require, module, exports, $RefreshReg$, $RefreshSig$, __akanImport) {${meta}
3495
3685
  ${shared?.code ?? patched}
3496
3686
  }`,
3497
3687
  helpers: shared?.helpers ?? null
@@ -3666,7 +3856,7 @@ class DevRegistryBundler {
3666
3856
 
3667
3857
  // pkgs/@akanjs/devkit/frontendBuild/csrDevBundler.ts
3668
3858
  class CsrDevBundler extends DevRegistryBundler {
3669
- static #formatVersion = 3;
3859
+ static #formatVersion = 4;
3670
3860
  reloadsOnEntryChange = true;
3671
3861
  #asyncDefaults = new Map;
3672
3862
  constructor(app) {
@@ -4050,7 +4240,7 @@ import { mkdir as mkdir5 } from "fs/promises";
4050
4240
  import path24 from "path";
4051
4241
  import { SSR_DEV_DIRNAME, SSR_DEV_ROUTE_PREFIX } from "akanjs/server/hmr/csrDevManifest";
4052
4242
  class SsrDevBundler extends DevRegistryBundler {
4053
- static #formatVersion = 1;
4243
+ static #formatVersion = 2;
4054
4244
  static bootstrapKey = "";
4055
4245
  reloadsOnEntryChange = false;
4056
4246
  #discovery = null;
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  AppExecutor
4
- } from "./index-0n9q1f23.js";
4
+ } from "./index-r8gp8zk3.js";
5
5
  import {
6
6
  jsonText,
7
7
  createWorkflowBaselineSummary,
8
8
  buildAkanModuleContextIndex,
9
9
  toolingRolloutGate
10
- } from "./index-d65fzxvd.js";
10
+ } from "./index-2s2e5qnd.js";
11
11
  import {
12
12
  buildResourceList,
13
13
  codexMcpConfigPath,
@@ -17,24 +17,25 @@ import {
17
17
  upsertCodexMcpServerBlock,
18
18
  renderDoctorText,
19
19
  AkanContextAnalyzer
20
- } from "./index-hzy4pe24.js";
20
+ } from "./index-0pqzrbpr.js";
21
21
  import {
22
22
  runner
23
- } from "./index-58cyna2s.js";
23
+ } from "./index-b68zfsvz.js";
24
24
  import {
25
25
  getMobileTargets,
26
+ appIdsOf,
26
27
  NativeApp,
27
28
  isPlaceholderAppId
28
- } from "./index-ys6f0bvh.js";
29
+ } from "./index-tfe3711h.js";
29
30
  import {
30
31
  Prompter2
31
32
  } from "./index-zzvvc845.js";
32
33
  import {
33
34
  RepairRunner
34
- } from "./index-t02g6dpn.js";
35
+ } from "./index-2z30v4k5.js";
35
36
  import {
36
37
  WorkflowRunner
37
- } from "./index-da72pfdv.js";
38
+ } from "./index-h9ed99ax.js";
38
39
 
39
40
  // pkgs/@akanjs/devkit/akanMcpContract.ts
40
41
  import path from "path";
@@ -606,13 +607,14 @@ class ContextRunner2 extends runner("context") {
606
607
  });
607
608
  }
608
609
  for (const { name, config: target } of await getMobileTargets(app)) {
609
- if (!isPlaceholderAppId(target.appId))
610
+ const placeholder = appIdsOf(target.appId).find(isPlaceholderAppId);
611
+ if (!placeholder)
610
612
  continue;
611
613
  diagnostics.push({
612
614
  severity: "warning",
613
615
  code: "mobile-appid-placeholder",
614
616
  path: `apps/${appName}/akan.config.ts`,
615
- message: `Mobile target '${name}' uses placeholder bundle id '${target.appId}'. Apple's developer portal almost always already claims it, so signing to a physical device fails with "cannot be registered to your development team". Set a unique mobile.appId (reverse-DNS of your org).`
617
+ message: `Mobile target '${name}' uses placeholder bundle id '${placeholder}'. Apple's developer portal almost always already claims it, so signing to a physical device fails with "cannot be registered to your development team". Set a unique mobile.appId (reverse-DNS of your org).`
616
618
  });
617
619
  }
618
620
  }
package/index.js CHANGED
@@ -4,34 +4,34 @@ import {
4
4
  getTargetMetas,
5
5
  getTargetCommandNames,
6
6
  runCommands
7
- } from "./index-58cyna2s.js";
7
+ } from "./index-b68zfsvz.js";
8
8
  import"./index-52w0fvh8.js";
9
- import"./index-0n9q1f23.js";
9
+ import"./index-r8gp8zk3.js";
10
10
 
11
11
  // pkgs/@akanjs/cli/commandManifest.ts
12
12
  import path from "path";
13
13
 
14
14
  // pkgs/@akanjs/cli/commandModules.ts
15
15
  var commandModules = {
16
- workspace: async () => (await import("./workspace.command-d8he10tv.js")).WorkspaceCommand,
17
- agent: async () => (await import("./agent.command-rp505zxa.js")).AgentCommand,
18
- code: async () => (await import("./code.command-jhrjttm1.js")).CodeCommand,
19
- application: async () => (await import("./application.command-afajz1m5.js")).ApplicationCommand,
20
- library: async () => (await import("./library.command-sv6g1h2g.js")).LibraryCommand,
21
- localRegistry: async () => (await import("./localRegistry.command-fm41vdtw.js")).LocalRegistryCommand,
22
- package: async () => (await import("./package.command-xmw605b1.js")).PackageCommand,
23
- module: async () => (await import("./module.command-ccdeder9.js")).ModuleCommand,
24
- page: async () => (await import("./page.command-ky7vafsn.js")).PageCommand,
25
- context: async () => (await import("./context.command-xncdvv7n.js")).ContextCommand,
26
- cloud: async () => (await import("./cloud.command-yz0h8a2e.js")).CloudCommand,
27
- subspace: async () => (await import("./subspace.command-y1p56wyv.js")).SubspaceCommand,
28
- guideline: async () => (await import("./guideline.command-d5qmxx29.js")).GuidelineCommand,
29
- scalar: async () => (await import("./scalar.command-t09gmck8.js")).ScalarCommand,
30
- primitive: async () => (await import("./primitive.command-bh6j8nfs.js")).PrimitiveCommand,
31
- quality: async () => (await import("./quality.command-rqqrpe98.js")).QualityCommand,
32
- repair: async () => (await import("./repair.command-n9nsm9qe.js")).RepairCommand,
33
- workflow: async () => (await import("./workflow.command-b91ph8sx.js")).WorkflowCommand,
34
- tunnel: async () => (await import("./tunnel.command-4g95vhsn.js")).TunnelCommand
16
+ workspace: async () => (await import("./workspace.command-wypqk2zb.js")).WorkspaceCommand,
17
+ agent: async () => (await import("./agent.command-q9bmqrag.js")).AgentCommand,
18
+ code: async () => (await import("./code.command-fpx4gzmy.js")).CodeCommand,
19
+ application: async () => (await import("./application.command-xpnkyx4z.js")).ApplicationCommand,
20
+ library: async () => (await import("./library.command-tz7vnwea.js")).LibraryCommand,
21
+ localRegistry: async () => (await import("./localRegistry.command-f39yk7be.js")).LocalRegistryCommand,
22
+ package: async () => (await import("./package.command-z3epnvas.js")).PackageCommand,
23
+ module: async () => (await import("./module.command-qhc9ns0s.js")).ModuleCommand,
24
+ page: async () => (await import("./page.command-exd2vakz.js")).PageCommand,
25
+ context: async () => (await import("./context.command-snn1k5q3.js")).ContextCommand,
26
+ cloud: async () => (await import("./cloud.command-7yd624qd.js")).CloudCommand,
27
+ subspace: async () => (await import("./subspace.command-0e53tvxk.js")).SubspaceCommand,
28
+ guideline: async () => (await import("./guideline.command-ene55fkr.js")).GuidelineCommand,
29
+ scalar: async () => (await import("./scalar.command-60nxfchc.js")).ScalarCommand,
30
+ primitive: async () => (await import("./primitive.command-0w6cha4j.js")).PrimitiveCommand,
31
+ quality: async () => (await import("./quality.command-je4kc9yv.js")).QualityCommand,
32
+ repair: async () => (await import("./repair.command-knvwfgtg.js")).RepairCommand,
33
+ workflow: async () => (await import("./workflow.command-j5tk13ds.js")).WorkflowCommand,
34
+ tunnel: async () => (await import("./tunnel.command-7m2kxtat.js")).TunnelCommand
35
35
  };
36
36
  var commandModuleIds = Object.keys(commandModules);
37
37
 
@@ -3,12 +3,12 @@ import {
3
3
  Lib,
4
4
  Workspace,
5
5
  command
6
- } from "./index-58cyna2s.js";
6
+ } from "./index-b68zfsvz.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-0n9q1f23.js";
8
+ import"./index-r8gp8zk3.js";
9
9
  import {
10
10
  LibraryScript
11
- } from "./index-5mm3g24t.js";
11
+ } from "./index-qtz88kh0.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.command.ts
14
14
  class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({
@@ -4,28 +4,28 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-58cyna2s.js";
7
+ } from "./index-b68zfsvz.js";
8
8
  import"./index-52w0fvh8.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-0n9q1f23.js";
11
+ } from "./index-r8gp8zk3.js";
12
12
  import"./index-48k96p55.js";
13
- import"./index-5mm3g24t.js";
13
+ import"./index-qtz88kh0.js";
14
14
  import {
15
15
  ApplicationScript
16
- } from "./index-cfj73ck1.js";
17
- import"./index-ys6f0bvh.js";
16
+ } from "./index-0ej0sr6m.js";
17
+ import"./index-tfe3711h.js";
18
18
  import"./index-7md2g9vw.js";
19
19
  import"./index-94s080qm.js";
20
20
  import {
21
21
  getNpmRegistryUrl,
22
22
  CloudRunner
23
- } from "./index-56xwsgyn.js";
23
+ } from "./index-rrt9pnb4.js";
24
24
  import"./index-2ahj896a.js";
25
25
  import {
26
26
  PackageScript
27
- } from "./index-per2kqy9.js";
28
- import"./index-860zjnr1.js";
27
+ } from "./index-k7809wmg.js";
28
+ import"./index-nbg9bfnr.js";
29
29
 
30
30
  // pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
31
31
  import { mkdir, rm } from "fs/promises";
@@ -3,16 +3,16 @@ import {
3
3
  Sys,
4
4
  Module,
5
5
  command
6
- } from "./index-58cyna2s.js";
6
+ } from "./index-b68zfsvz.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-0n9q1f23.js";
8
+ import"./index-r8gp8zk3.js";
9
9
  import {
10
10
  renderPrimitiveReport
11
- } from "./index-d65fzxvd.js";
12
- import"./index-v4hnkqz9.js";
11
+ } from "./index-2s2e5qnd.js";
12
+ import"./index-ss828r32.js";
13
13
  import {
14
14
  ModuleScript
15
- } from "./index-zazvn45w.js";
15
+ } from "./index-genegfnt.js";
16
16
 
17
17
  // pkgs/@akanjs/cli/module/module.command.ts
18
18
  import { Logger, lowerlize } from "akanjs/common";
@@ -3,13 +3,13 @@ import {
3
3
  Pkg,
4
4
  Workspace,
5
5
  command
6
- } from "./index-58cyna2s.js";
6
+ } from "./index-b68zfsvz.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-0n9q1f23.js";
8
+ import"./index-r8gp8zk3.js";
9
9
  import"./index-2ahj896a.js";
10
10
  import {
11
11
  PackageScript
12
- } from "./index-per2kqy9.js";
12
+ } from "./index-k7809wmg.js";
13
13
 
14
14
  // pkgs/@akanjs/cli/package/package.command.ts
15
15
  class PackageCommand extends command("package", [PackageScript], ({ public: target }) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "3.0.0-beta.26",
3
+ "version": "3.0.0-beta.28",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -39,7 +39,7 @@
39
39
  "@earendil-works/pi-tui": "0.86.1",
40
40
  "@inquirer/prompts": "^8.4.3",
41
41
  "@tailwindcss/node": "^4.3.0",
42
- "akanjs": "3.0.0-beta.26",
42
+ "akanjs": "3.0.0-beta.28",
43
43
  "chalk": "^5.6.2",
44
44
  "commander": "^14.0.3",
45
45
  "dayjs": "^1.11.20",
@@ -3,12 +3,12 @@ import {
3
3
  App,
4
4
  Module,
5
5
  command
6
- } from "./index-58cyna2s.js";
6
+ } from "./index-b68zfsvz.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-0n9q1f23.js";
8
+ import"./index-r8gp8zk3.js";
9
9
  import {
10
10
  PageScript
11
- } from "./index-v4hnkqz9.js";
11
+ } from "./index-ss828r32.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/page/page.command.ts
14
14
  class PageCommand extends command("page", [PageScript], ({ public: target }) => ({
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-58cyna2s.js";
5
+ } from "./index-b68zfsvz.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-0n9q1f23.js";
7
+ import"./index-r8gp8zk3.js";
8
8
  import {
9
9
  renderPrimitiveReport
10
- } from "./index-d65fzxvd.js";
11
- import"./index-v4hnkqz9.js";
12
- import"./index-zazvn45w.js";
10
+ } from "./index-2s2e5qnd.js";
11
+ import"./index-ss828r32.js";
12
+ import"./index-genegfnt.js";
13
13
  import {
14
14
  PrimitiveScript
15
- } from "./index-6dt6zft6.js";
15
+ } from "./index-20r2g1t3.js";
16
16
 
17
17
  // pkgs/@akanjs/cli/primitive/primitive.command.ts
18
18
  import { Logger } from "akanjs/common";