@akanjs/cli 2.4.1-rc.0 → 2.4.1-rc.2
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.
- package/README.ko.md +72 -0
- package/README.md +85 -0
- package/{application.command-4ctkfdan.js → application.command-47mj9qsy.js} +1 -1
- package/{applicationBuildRunner-esa1kj7v.js → applicationBuildRunner-yz144508.js} +1 -1
- package/{cloud.command-rpztn4fh.js → cloud.command-hxcgsf80.js} +4 -4
- package/incrementalBuilder.proc.js +1 -1
- package/{index-9sp6fsc5.js → index-77crfweb.js} +1 -1
- package/{index-xmc2w32q.js → index-a5rmdgy4.js} +3 -3
- package/{index-b0brjbp3.js → index-mq6ns0f9.js} +3 -3
- package/{index-wq8jwx8z.js → index-n6h3482q.js} +161 -6
- package/{index-w7fyqjrw.js → index-sgmas1fc.js} +1 -1
- package/index.js +5 -5
- package/{localRegistry.command-5tcahs3f.js → localRegistry.command-6z4s13mj.js} +3 -3
- package/{package.command-r8sq5kzp.js → package.command-5x5m0ej1.js} +1 -1
- package/package.json +2 -2
- package/{workspace.command-vrws0rgx.js → workspace.command-875aj35r.js} +4 -4
package/README.ko.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @akanjs/cli
|
|
2
|
+
|
|
3
|
+
[문서](https://akanjs.com/docs) | [npm](https://www.npmjs.com/package/@akanjs/cli) | [런타임](https://www.npmjs.com/package/akanjs)
|
|
4
|
+
|
|
5
|
+
Akan.js 워크스페이스를 위한 command-line tooling입니다.
|
|
6
|
+
|
|
7
|
+
`@akanjs/cli`는 Akan 애플리케이션, 라이브러리, 프레임워크 패키지를 생성, 빌드, 테스트, 린트,
|
|
8
|
+
릴리즈, 유지보수하는 데 사용하는 `akan` 실행 파일을 제공합니다. Bun-first CLI 패키지이며 Akan
|
|
9
|
+
개발 tooling을 내부에 번들링하므로, 애플리케이션 런타임은 더 작은 `akanjs` 패키지에만 의존할 수
|
|
10
|
+
있습니다.
|
|
11
|
+
|
|
12
|
+
## 설치
|
|
13
|
+
|
|
14
|
+
새 워크스페이스를 바로 만들 수 있습니다.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
bunx create-akan-workspace@latest
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
또는 CLI를 전역으로 설치할 수 있습니다.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bun install -g @akanjs/cli@latest
|
|
24
|
+
akan --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 자주 쓰는 명령
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
akan create-workspace <workspace-name>
|
|
31
|
+
akan start <app-name>
|
|
32
|
+
akan build <app-name>
|
|
33
|
+
akan test <app-or-lib-or-pkg>
|
|
34
|
+
akan lint <app-or-lib-or-pkg>
|
|
35
|
+
akan create-application <app-name>
|
|
36
|
+
akan create-library <lib-name>
|
|
37
|
+
akan create-module <module-name>
|
|
38
|
+
akan create-scalar <scalar-name>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
패키지 유지보수 명령도 같은 실행 파일에서 제공합니다.
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
akan build-package akanjs
|
|
45
|
+
akan build-package @akanjs/cli
|
|
46
|
+
akan build-package @akanjs/devkit
|
|
47
|
+
akan build-package create-akan-workspace
|
|
48
|
+
akan verify-akan-publish-packages
|
|
49
|
+
akan smoke-registry --test=true --tag=rc
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Akan framework 패키지는 반드시 `dist/pkgs/*` 산출물 기준으로 publish합니다. `verify-akan-publish-packages`는
|
|
53
|
+
빌드된 패키지에 `npm pack --dry-run --json`을 실행하고, `deploy-akan` 또는 local registry smoke 전에 필요한
|
|
54
|
+
metadata를 검증합니다.
|
|
55
|
+
저장소 릴리즈에서는 root `akan` bootstrap script가 CLI dist를 덮어쓰지 않도록
|
|
56
|
+
`bun run release:build-packages && bun run release:verify-packages`를 우선 사용합니다.
|
|
57
|
+
|
|
58
|
+
## 패키지 경계
|
|
59
|
+
|
|
60
|
+
- 애플리케이션과 런타임 코드는 `akanjs`를 사용합니다.
|
|
61
|
+
- 사용자-facing 실행 패키지는 `@akanjs/cli`입니다.
|
|
62
|
+
- `@akanjs/devkit`은 published CLI 사용을 위해 CLI 안에 번들링됩니다. 일반 CLI 사용자가 별도의
|
|
63
|
+
runtime dependency로 설치할 필요는 없습니다.
|
|
64
|
+
|
|
65
|
+
## 요구사항
|
|
66
|
+
|
|
67
|
+
- [Bun](https://bun.sh) `>=1.3.13`
|
|
68
|
+
- TypeScript 기반 Akan 워크스페이스
|
|
69
|
+
|
|
70
|
+
## 라이선스
|
|
71
|
+
|
|
72
|
+
MIT
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @akanjs/cli
|
|
2
|
+
|
|
3
|
+
[Docs](https://akanjs.com/docs) | [npm](https://www.npmjs.com/package/@akanjs/cli) | [Runtime](https://www.npmjs.com/package/akanjs)
|
|
4
|
+
|
|
5
|
+
Command-line tooling for Akan.js workspaces.
|
|
6
|
+
|
|
7
|
+
`@akanjs/cli` provides the `akan` executable used to create, build, test, lint, release, and maintain Akan
|
|
8
|
+
applications, libraries, and framework packages. It is a Bun-first CLI package and bundles Akan development
|
|
9
|
+
tooling internally so application runtimes can depend on the smaller `akanjs` package.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
Create a new workspace:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bunx create-akan-workspace@latest
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or install the CLI globally:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bun install -g @akanjs/cli@latest
|
|
23
|
+
akan --help
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Common Commands
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
akan create-workspace <workspace-name>
|
|
30
|
+
akan start <app-name>
|
|
31
|
+
akan build <app-name>
|
|
32
|
+
akan test <app-or-lib-or-pkg>
|
|
33
|
+
akan lint <app-or-lib-or-pkg>
|
|
34
|
+
akan create-application <app-name>
|
|
35
|
+
akan create-library <lib-name>
|
|
36
|
+
akan create-module <module-name>
|
|
37
|
+
akan create-scalar <scalar-name>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Agent And MCP Commands
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
akan context --format markdown
|
|
44
|
+
akan context --format json --module <module-name>
|
|
45
|
+
akan doctor --format json
|
|
46
|
+
akan guideline list
|
|
47
|
+
akan guideline show framework
|
|
48
|
+
akan agent install cursor
|
|
49
|
+
akan mcp
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
These commands expose Akan workspace structure, module abstracts, diagnostics, and guideline instructions for
|
|
53
|
+
coding agents. The MCP server is read-only and is intended to provide context rather than edit files directly.
|
|
54
|
+
|
|
55
|
+
Package maintenance commands are also exposed through the same executable:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
akan build-package akanjs
|
|
59
|
+
akan build-package @akanjs/cli
|
|
60
|
+
akan build-package @akanjs/devkit
|
|
61
|
+
akan build-package create-akan-workspace
|
|
62
|
+
akan verify-akan-publish-packages
|
|
63
|
+
akan smoke-registry --test=true --tag=rc
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Publish Akan framework packages from `dist/pkgs/*` only. `verify-akan-publish-packages` runs `npm pack --dry-run --json`
|
|
67
|
+
against the built packages and checks metadata that must be correct before `deploy-akan` or local registry smoke.
|
|
68
|
+
For repository releases, prefer `bun run release:build-packages && bun run release:verify-packages` so the CLI package
|
|
69
|
+
artifact is built last and is not overwritten by the root `akan` bootstrap script.
|
|
70
|
+
|
|
71
|
+
## Package Boundary
|
|
72
|
+
|
|
73
|
+
- Use `akanjs` from application and runtime code.
|
|
74
|
+
- Use `@akanjs/cli` as the user-facing executable package.
|
|
75
|
+
- `@akanjs/devkit` is bundled into the CLI for published CLI usage; it is not required as a separate
|
|
76
|
+
runtime dependency for ordinary CLI users.
|
|
77
|
+
|
|
78
|
+
## Requirements
|
|
79
|
+
|
|
80
|
+
- [Bun](https://bun.sh) `>=1.3.13`
|
|
81
|
+
- A TypeScript Akan workspace
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
CloudScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
4
|
+
} from "./index-mq6ns0f9.js";
|
|
5
|
+
import"./index-sgmas1fc.js";
|
|
6
|
+
import"./index-77crfweb.js";
|
|
7
7
|
import"./index-76rn3g2c.js";
|
|
8
8
|
import"./index-pmm9e2jf.js";
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-n6h3482q.js";
|
|
10
10
|
import {
|
|
11
11
|
GlobalConfig
|
|
12
12
|
} from "./index-5vvwc0cz.js";
|
|
@@ -1259,7 +1259,7 @@ function openBrowser(url) {
|
|
|
1259
1259
|
}
|
|
1260
1260
|
|
|
1261
1261
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
1262
|
-
var loadBuildRunner = async () => (await import("./applicationBuildRunner-
|
|
1262
|
+
var loadBuildRunner = async () => (await import("./applicationBuildRunner-yz144508.js")).ApplicationBuildRunner;
|
|
1263
1263
|
var loadReleasePackager = async () => (await import("./applicationReleasePackager-brvth6rs.js")).ApplicationReleasePackager;
|
|
1264
1264
|
var loadCapacitorApp = async () => (await import("./capacitorApp-y0h6cgft.js")).CapacitorApp;
|
|
1265
1265
|
var loadPrompts = async () => await import("@inquirer/prompts");
|
|
@@ -915,7 +915,7 @@ class ClientEntriesBundler {
|
|
|
915
915
|
};
|
|
916
916
|
}
|
|
917
917
|
#getDefine() {
|
|
918
|
-
const nodeEnv = this.#command === "build" ? "production" : "
|
|
918
|
+
const nodeEnv = this.#command === "build" ? "production" : "development";
|
|
919
919
|
return {
|
|
920
920
|
"process.env.NODE_ENV": JSON.stringify(nodeEnv),
|
|
921
921
|
"process.env.AKAN_PUBLIC_RENDER_ENV": JSON.stringify("ssr"),
|
|
@@ -2477,7 +2477,7 @@ ${logs}` : ""}`);
|
|
|
2477
2477
|
return path13.join(this.#command === "build" ? this.#app.dist.cwdPath : this.#app.cwdPath, this.#command === "build" ? "csr" : ".akan/artifact/csr");
|
|
2478
2478
|
}
|
|
2479
2479
|
#define() {
|
|
2480
|
-
const nodeEnv = this.#command === "build" ? "production" : "
|
|
2480
|
+
const nodeEnv = this.#command === "build" ? "production" : "development";
|
|
2481
2481
|
return {
|
|
2482
2482
|
"process.env.NODE_ENV": JSON.stringify(nodeEnv),
|
|
2483
2483
|
"process.env.AKAN_PUBLIC_RENDER_ENV": JSON.stringify("csr"),
|
|
@@ -3674,7 +3674,7 @@ class PagesBundleBuilder {
|
|
|
3674
3674
|
return process.env.AKAN_SERVER_PAGES_SPLITTING === "1";
|
|
3675
3675
|
}
|
|
3676
3676
|
#define() {
|
|
3677
|
-
const nodeEnv = this.#command === "build" ? "production" : "
|
|
3677
|
+
const nodeEnv = this.#command === "build" ? "production" : "development";
|
|
3678
3678
|
return {
|
|
3679
3679
|
"process.env.NODE_ENV": JSON.stringify(nodeEnv),
|
|
3680
3680
|
"process.env.AKAN_PUBLIC_RENDER_ENV": JSON.stringify("ssr"),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
CloudRunner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-sgmas1fc.js";
|
|
5
5
|
import {
|
|
6
6
|
ApplicationScript
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-77crfweb.js";
|
|
8
8
|
import {
|
|
9
9
|
PackageScript
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-n6h3482q.js";
|
|
11
11
|
import {
|
|
12
12
|
AiSession,
|
|
13
13
|
CloudApi,
|
|
@@ -14,7 +14,93 @@ import {
|
|
|
14
14
|
} from "./index-61keag0s.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/cli/package/package.runner.ts
|
|
17
|
+
import path2 from "path";
|
|
18
|
+
|
|
19
|
+
// pkgs/@akanjs/devkit/packageExportsMap.ts
|
|
20
|
+
import { statSync } from "fs";
|
|
17
21
|
import path from "path";
|
|
22
|
+
|
|
23
|
+
class PackageExportsMap {
|
|
24
|
+
static async from(packageDir) {
|
|
25
|
+
const manifest = await Bun.file(path.join(packageDir, "package.json")).json();
|
|
26
|
+
return new PackageExportsMap(packageDir, manifest.exports);
|
|
27
|
+
}
|
|
28
|
+
static #runtimeTargetOf(value) {
|
|
29
|
+
if (typeof value === "string")
|
|
30
|
+
return value;
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
for (const entry of value) {
|
|
33
|
+
const target = PackageExportsMap.#runtimeTargetOf(entry);
|
|
34
|
+
if (target)
|
|
35
|
+
return target;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
if (!value || typeof value !== "object")
|
|
40
|
+
return null;
|
|
41
|
+
const conditions = value;
|
|
42
|
+
for (const condition of ["bun", "import", "default", "require", "types"]) {
|
|
43
|
+
if (!(condition in conditions))
|
|
44
|
+
continue;
|
|
45
|
+
const target = PackageExportsMap.#runtimeTargetOf(conditions[condition]);
|
|
46
|
+
if (target)
|
|
47
|
+
return target;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
#packageDir;
|
|
52
|
+
#literals = new Map;
|
|
53
|
+
#patterns = [];
|
|
54
|
+
constructor(packageDir, exportsField) {
|
|
55
|
+
this.#packageDir = packageDir;
|
|
56
|
+
if (!exportsField || typeof exportsField !== "object")
|
|
57
|
+
return;
|
|
58
|
+
for (const [key, value] of Object.entries(exportsField)) {
|
|
59
|
+
if (!key.startsWith("."))
|
|
60
|
+
continue;
|
|
61
|
+
const target = PackageExportsMap.#runtimeTargetOf(value);
|
|
62
|
+
if (!target)
|
|
63
|
+
continue;
|
|
64
|
+
const star = key.indexOf("*");
|
|
65
|
+
if (star === -1)
|
|
66
|
+
this.#literals.set(key, target);
|
|
67
|
+
else
|
|
68
|
+
this.#patterns.push({ prefix: key.slice(0, star), suffix: key.slice(star + 1), target });
|
|
69
|
+
}
|
|
70
|
+
this.#patterns.sort((a, b) => b.prefix.length - a.prefix.length || b.suffix.length - a.suffix.length);
|
|
71
|
+
}
|
|
72
|
+
resolve(subpath) {
|
|
73
|
+
const literal = this.#literals.get(subpath);
|
|
74
|
+
if (literal)
|
|
75
|
+
return literal;
|
|
76
|
+
for (const { prefix, suffix, target } of this.#patterns) {
|
|
77
|
+
if (!subpath.startsWith(prefix) || !subpath.endsWith(suffix))
|
|
78
|
+
continue;
|
|
79
|
+
if (subpath.length < prefix.length + suffix.length)
|
|
80
|
+
continue;
|
|
81
|
+
return target.replace("*", subpath.slice(prefix.length, subpath.length - suffix.length));
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
resolveToFile(subpath) {
|
|
86
|
+
const target = this.resolve(subpath);
|
|
87
|
+
if (!target)
|
|
88
|
+
return { target: null, exists: false };
|
|
89
|
+
const stat = statSync(path.join(this.#packageDir, target), { throwIfNoEntry: false });
|
|
90
|
+
return { target, exists: !!stat?.isFile() };
|
|
91
|
+
}
|
|
92
|
+
findUnreachable(subpaths) {
|
|
93
|
+
const unreachable = [];
|
|
94
|
+
for (const subpath of subpaths) {
|
|
95
|
+
const { target, exists } = this.resolveToFile(subpath);
|
|
96
|
+
if (!exists)
|
|
97
|
+
unreachable.push({ subpath, target });
|
|
98
|
+
}
|
|
99
|
+
return unreachable;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// pkgs/@akanjs/cli/package/package.runner.ts
|
|
18
104
|
import { Logger } from "akanjs/common";
|
|
19
105
|
var {$ } = globalThis.Bun;
|
|
20
106
|
|
|
@@ -34,11 +120,11 @@ class PackageRunner extends runner("package") {
|
|
|
34
120
|
}
|
|
35
121
|
async#getInstalledPackageJson() {
|
|
36
122
|
const packageJsonCandidates = [
|
|
37
|
-
`${
|
|
123
|
+
`${path2.dirname(Bun.main)}/package.json`,
|
|
38
124
|
`${process.cwd()}/node_modules/akanjs/package.json`
|
|
39
125
|
];
|
|
40
126
|
try {
|
|
41
|
-
packageJsonCandidates.unshift(Bun.resolveSync("akanjs/package.json",
|
|
127
|
+
packageJsonCandidates.unshift(Bun.resolveSync("akanjs/package.json", path2.dirname(Bun.main)));
|
|
42
128
|
} catch {}
|
|
43
129
|
for (const packageJsonPath of packageJsonCandidates) {
|
|
44
130
|
if (!await Bun.file(packageJsonPath).exists())
|
|
@@ -47,7 +133,7 @@ class PackageRunner extends runner("package") {
|
|
|
47
133
|
if (packageJson.name === "akanjs" || packageJson.name === "@akanjs/cli")
|
|
48
134
|
return packageJson;
|
|
49
135
|
}
|
|
50
|
-
throw new Error(`[package] failed to locate akanjs package.json from ${
|
|
136
|
+
throw new Error(`[package] failed to locate akanjs package.json from ${path2.dirname(Bun.main)}`);
|
|
51
137
|
}
|
|
52
138
|
async createPackage(workspace, pkgName) {
|
|
53
139
|
await workspace.applyTemplate({ basePath: `pkgs/${pkgName}`, template: "pkgRoot", dict: { pkgName } });
|
|
@@ -111,7 +197,68 @@ class PackageRunner extends runner("package") {
|
|
|
111
197
|
}
|
|
112
198
|
await this.#copyPackageReadmes(pkg);
|
|
113
199
|
}
|
|
114
|
-
|
|
200
|
+
static #scannableDistFiles = "**/*.{ts,tsx,js,jsx,mjs,cjs}";
|
|
201
|
+
static #importPosition = /(?:\bfrom\s*|\brequire\s*\(\s*|\bimport\s*\(\s*|\bimport\s+)$/;
|
|
202
|
+
static #splitSpecifier(specifier) {
|
|
203
|
+
const segments = specifier.split("/");
|
|
204
|
+
const name = specifier.startsWith("@") ? segments.slice(0, 2).join("/") : segments[0];
|
|
205
|
+
const subpath = specifier.slice(name.length).replace(/^\//, "");
|
|
206
|
+
return { name, subpath: subpath ? `./${subpath}` : "." };
|
|
207
|
+
}
|
|
208
|
+
async#collectDistAkanImports(distPath, packageNames) {
|
|
209
|
+
const alternatives = [...new Set(packageNames)].map((name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
210
|
+
const specifierPattern = new RegExp(`["'](${alternatives.join("|")})((?:/[^"'\\s]*)?)["']`, "g");
|
|
211
|
+
const glob = new Bun.Glob(PackageRunner.#scannableDistFiles);
|
|
212
|
+
const imports = new Map;
|
|
213
|
+
for await (const relative of glob.scan({ cwd: distPath })) {
|
|
214
|
+
if (relative.includes("node_modules/") || relative.endsWith(".d.ts"))
|
|
215
|
+
continue;
|
|
216
|
+
if (/\.(test|spec)\.[a-z]+$/.test(relative))
|
|
217
|
+
continue;
|
|
218
|
+
const source = await Bun.file(`${distPath}/${relative}`).text();
|
|
219
|
+
for (const line of source.split(`
|
|
220
|
+
`)) {
|
|
221
|
+
const trimmed = line.trimStart();
|
|
222
|
+
if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*"))
|
|
223
|
+
continue;
|
|
224
|
+
for (const match of line.matchAll(specifierPattern)) {
|
|
225
|
+
if (!PackageRunner.#importPosition.test(line.slice(0, match.index)))
|
|
226
|
+
continue;
|
|
227
|
+
const specifier = `${match[1]}${match[2] ?? ""}`;
|
|
228
|
+
const importers = imports.get(specifier) ?? new Set;
|
|
229
|
+
imports.set(specifier, importers.add(relative));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return imports;
|
|
234
|
+
}
|
|
235
|
+
async#verifyDistExportsReachable(pkg, peerExportsMaps) {
|
|
236
|
+
const exportsMaps = new Map(peerExportsMaps).set(pkg.name, await PackageExportsMap.from(pkg.dist.cwdPath));
|
|
237
|
+
const imports = await this.#collectDistAkanImports(pkg.dist.cwdPath, exportsMaps.keys());
|
|
238
|
+
const failures = [];
|
|
239
|
+
for (const [specifier, importers] of imports) {
|
|
240
|
+
const { name, subpath } = PackageRunner.#splitSpecifier(specifier);
|
|
241
|
+
const exportsMap = exportsMaps.get(name);
|
|
242
|
+
if (!exportsMap)
|
|
243
|
+
continue;
|
|
244
|
+
const [unreachable] = exportsMap.findUnreachable([subpath]);
|
|
245
|
+
if (!unreachable)
|
|
246
|
+
continue;
|
|
247
|
+
const reason = unreachable.target ? `its exports map yields ${unreachable.target}, which is not a file` : "no exports entry matches it";
|
|
248
|
+
const files = [...importers].sort();
|
|
249
|
+
const shown = files.slice(0, 3).join(", ") + (files.length > 3 ? ` (+${files.length - 3} more)` : "");
|
|
250
|
+
failures.push(` ${specifier} \u2014 ${reason}; imported by ${shown}`);
|
|
251
|
+
}
|
|
252
|
+
if (!failures.length)
|
|
253
|
+
return;
|
|
254
|
+
throw new Error(`[package] ${pkg.name} dist imports ${failures.length} subpath(s) no consumer can resolve:
|
|
255
|
+
` + `${failures.sort().join(`
|
|
256
|
+
`)}
|
|
257
|
+
` + `Add the missing "exports" entries: a bare file facet needs "./*": "./*.ts", a directory facet ` + `needs its own "./name": "./name/index.ts", and "./*.ts": "./*.ts" keeps an already-suffixed ` + `specifier from gaining a second extension.`);
|
|
258
|
+
}
|
|
259
|
+
async verifyDistPackage(pkg, {
|
|
260
|
+
peerExportsMaps = new Map
|
|
261
|
+
} = {}) {
|
|
115
262
|
const distPackageJsonPath = `${pkg.dist.cwdPath}/package.json`;
|
|
116
263
|
if (!await Bun.file(distPackageJsonPath).exists()) {
|
|
117
264
|
throw new Error(`[package] dist package not found for ${pkg.name}. Run build-package first.`);
|
|
@@ -142,6 +289,7 @@ class PackageRunner extends runner("package") {
|
|
|
142
289
|
throw new Error("[package] akanjs dist exports must point type declarations at ./types");
|
|
143
290
|
}
|
|
144
291
|
}
|
|
292
|
+
await this.#verifyDistExportsReachable(pkg, peerExportsMaps);
|
|
145
293
|
const packOutput = await pkg.workspace.spawn("npm", ["pack", "--dry-run", "--json", pkg.dist.cwdPath], {
|
|
146
294
|
cwd: pkg.workspace.workspaceRoot
|
|
147
295
|
});
|
|
@@ -154,9 +302,16 @@ class PackageRunner extends runner("package") {
|
|
|
154
302
|
};
|
|
155
303
|
}
|
|
156
304
|
async verifyAkanPublishPackages(workspace) {
|
|
305
|
+
const pkgs = PackageRunner.publishableAkanPackages.map((pkgName) => PkgExecutor.from(workspace, pkgName));
|
|
306
|
+
const peerExportsMaps = new Map;
|
|
307
|
+
for (const pkg of pkgs) {
|
|
308
|
+
if (!await Bun.file(`${pkg.dist.cwdPath}/package.json`).exists())
|
|
309
|
+
continue;
|
|
310
|
+
peerExportsMaps.set(pkg.name, await PackageExportsMap.from(pkg.dist.cwdPath));
|
|
311
|
+
}
|
|
157
312
|
const results = [];
|
|
158
|
-
for (const
|
|
159
|
-
results.push(await this.verifyDistPackage(
|
|
313
|
+
for (const pkg of pkgs) {
|
|
314
|
+
results.push(await this.verifyDistPackage(pkg, { peerExportsMaps }));
|
|
160
315
|
}
|
|
161
316
|
return results;
|
|
162
317
|
}
|
package/index.js
CHANGED
|
@@ -17,16 +17,16 @@ import path from "path";
|
|
|
17
17
|
|
|
18
18
|
// pkgs/@akanjs/cli/commandModules.ts
|
|
19
19
|
var commandModules = {
|
|
20
|
-
workspace: async () => (await import("./workspace.command-
|
|
20
|
+
workspace: async () => (await import("./workspace.command-875aj35r.js")).WorkspaceCommand,
|
|
21
21
|
agent: async () => (await import("./agent.command-h4afc69n.js")).AgentCommand,
|
|
22
|
-
application: async () => (await import("./application.command-
|
|
22
|
+
application: async () => (await import("./application.command-47mj9qsy.js")).ApplicationCommand,
|
|
23
23
|
library: async () => (await import("./library.command-r15zdqvp.js")).LibraryCommand,
|
|
24
|
-
localRegistry: async () => (await import("./localRegistry.command-
|
|
25
|
-
package: async () => (await import("./package.command-
|
|
24
|
+
localRegistry: async () => (await import("./localRegistry.command-6z4s13mj.js")).LocalRegistryCommand,
|
|
25
|
+
package: async () => (await import("./package.command-5x5m0ej1.js")).PackageCommand,
|
|
26
26
|
module: async () => (await import("./module.command-qrj3kmyz.js")).ModuleCommand,
|
|
27
27
|
page: async () => (await import("./page.command-c6xdx0xm.js")).PageCommand,
|
|
28
28
|
context: async () => (await import("./context.command-nqbtak4f.js")).ContextCommand,
|
|
29
|
-
cloud: async () => (await import("./cloud.command-
|
|
29
|
+
cloud: async () => (await import("./cloud.command-hxcgsf80.js")).CloudCommand,
|
|
30
30
|
guideline: async () => (await import("./guideline.command-ya0dh44f.js")).GuidelineCommand,
|
|
31
31
|
scalar: async () => (await import("./scalar.command-kabkd6wd.js")).ScalarCommand,
|
|
32
32
|
primitive: async () => (await import("./primitive.command-pv9ssmtf.js")).PrimitiveCommand,
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CloudRunner,
|
|
4
4
|
getNpmRegistryUrl
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-sgmas1fc.js";
|
|
6
6
|
import {
|
|
7
7
|
ApplicationScript
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-77crfweb.js";
|
|
9
9
|
import"./index-76rn3g2c.js";
|
|
10
10
|
import"./index-pmm9e2jf.js";
|
|
11
11
|
import {
|
|
12
12
|
PackageScript
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-n6h3482q.js";
|
|
14
14
|
import"./index-5vvwc0cz.js";
|
|
15
15
|
import {
|
|
16
16
|
Workspace,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "2.4.1-rc.
|
|
3
|
+
"version": "2.4.1-rc.2",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@langchain/openai": "^1.4.6",
|
|
35
35
|
"@tailwindcss/node": "^4.3.0",
|
|
36
36
|
"@trapezedev/project": "^7.1.4",
|
|
37
|
-
"akanjs": "2.4.1-rc.
|
|
37
|
+
"akanjs": "2.4.1-rc.2",
|
|
38
38
|
"chalk": "^5.6.2",
|
|
39
39
|
"commander": "^14.0.3",
|
|
40
40
|
"daisyui": "5.5.23",
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import"./index-45aj5ry0.js";
|
|
6
6
|
import {
|
|
7
7
|
CloudScript
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-mq6ns0f9.js";
|
|
9
9
|
import"./index-y3hdhy4p.js";
|
|
10
10
|
import"./index-73pr2cmy.js";
|
|
11
11
|
import"./index-85msc0wg.js";
|
|
@@ -17,17 +17,17 @@ import"./index-8rc0bm04.js";
|
|
|
17
17
|
import {
|
|
18
18
|
getLatestPackageVersion,
|
|
19
19
|
getNpmRegistryUrl
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-sgmas1fc.js";
|
|
21
21
|
import {
|
|
22
22
|
ApplicationScript
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-77crfweb.js";
|
|
24
24
|
import"./index-76rn3g2c.js";
|
|
25
25
|
import {
|
|
26
26
|
LibraryScript
|
|
27
27
|
} from "./index-pmm9e2jf.js";
|
|
28
28
|
import {
|
|
29
29
|
PackageScript
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-n6h3482q.js";
|
|
31
31
|
import"./index-8pkbzj26.js";
|
|
32
32
|
import"./index-swf4bmbg.js";
|
|
33
33
|
import"./index-ss469dec.js";
|