@akanjs/cli 2.4.2-rc.2 → 2.4.2-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.
- package/.build-stamp +1 -1
- package/abstractCompactor-bjd2h5pq.js +103 -0
- package/{agent.command-ej4g9pbb.js → agent.command-dwxr73jr.js} +8 -7
- package/{application.command-smn51a28.js → application.command-8k6xs7q0.js} +16 -5
- package/{applicationBuildRunner-554a2vnk.js → applicationBuildRunner-hn86q106.js} +5 -4
- package/{applicationReleasePackager-pjbxc793.js → applicationReleasePackager-b1zh40kd.js} +1 -1
- package/buildBatch.proc.js +4 -3
- package/{capacitorApp-yg9b4ajz.js → capacitorApp-sqr41tck.js} +27 -26
- package/{cloud.command-2v7ga38h.js → cloud.command-5wh9krwx.js} +9 -8
- package/commandManifest.json +1 -1
- package/{context.command-hhjyjtp7.js → context.command-rydtf2vy.js} +15 -14
- package/{dependencyScanner-f6grrep3.js → dependencyScanner-rbs2407b.js} +1 -1
- package/{guideline.command-vj956kfr.js → guideline.command-dtkrftpc.js} +5 -4
- package/incrementalBuilder.proc.js +3 -2
- package/{index-pfnh87f9.js → index-0476y8pz.js} +1 -1
- package/index-0wae5ebk.js +65 -0
- package/{index-40w1kqp1.js → index-2f6mjanp.js} +4 -3
- package/{index-xftstr5s.js → index-3f3bjcwc.js} +1 -1
- package/{index-xwfg9bam.js → index-3g17wsqr.js} +10 -5
- package/{index-7ppn9v4n.js → index-3hyw3026.js} +3 -3
- package/{index-s9s0n5fz.js → index-4fh6v6qr.js} +2 -2
- package/{index-y1e79mz3.js → index-4j0qw1hz.js} +11 -11
- package/{index-z36qzgzp.js → index-6a9008sh.js} +2 -2
- package/{index-h971erkm.js → index-90a0z8xq.js} +3 -3
- package/{index-04as43rp.js → index-dscrzdk0.js} +7 -6
- package/{index-7k9sj7j5.js → index-f2s5z0p7.js} +91 -341
- package/index-f39512t6.js +255 -0
- package/{index-d0h48d2f.js → index-g10wmymm.js} +2 -2
- package/{index-panyahn4.js → index-hr3n31n0.js} +24 -10
- package/{index-dgeaqwmw.js → index-jf5k3bt8.js} +1 -1
- package/{index-majzj044.js → index-med3vqnc.js} +7 -7
- package/{index-zfp1gz9f.js → index-ms3vpys1.js} +1 -1
- package/{index-v9jqrdd1.js → index-n3drhjgc.js} +2 -2
- package/{index-z5v766nx.js → index-pw9qhve8.js} +3 -3
- package/{index-acwxfncv.js → index-r8drwwr8.js} +4 -4
- package/{index-j3j3qc9j.js → index-z1eqzrj9.js} +3 -3
- package/index.js +20 -19
- package/{library.command-68ah07a3.js → library.command-w11wnq7q.js} +5 -4
- package/{localRegistry.command-nmyc5vwv.js → localRegistry.command-fkq49j84.js} +10 -9
- package/{module.command-t68xhamx.js → module.command-wyjgbg0d.js} +8 -7
- package/{package.command-00ncttab.js → package.command-5ann132q.js} +5 -4
- package/package.json +2 -2
- package/{page.command-1096s18n.js → page.command-e75nxwrw.js} +5 -4
- package/{primitive.command-02eqpx6t.js → primitive.command-gy7nwn5w.js} +9 -8
- package/{quality.command-vap6xegb.js → quality.command-41tw1g5g.js} +32 -6
- package/{repair.command-7dynpnf1.js → repair.command-xr4664h4.js} +7 -6
- package/{routeSourceValidator-cncd92fv.js → routeSourceValidator-rk64s1g4.js} +2 -1
- package/{scalar.command-3kxy3fkh.js → scalar.command-agc839az.js} +7 -6
- package/templates/module/__Model__.Template.tsx +2 -1
- package/templates/module/__Model__.Unit.tsx +2 -1
- package/templates/module/__Model__.Util.tsx +2 -1
- package/templates/module/__Model__.View.tsx +2 -1
- package/templates/module/__Model__.Zone.tsx +2 -1
- package/{typeChecker-kravn7ns.js → typeChecker-g6bh0xfv.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/{workflow.command-yy0d9gk3.js → workflow.command-jf09cq6k.js} +12 -11
- package/{workspace.command-hq1x5605.js → workspace.command-a57b7ybw.js} +23 -22
- /package/{index-r24hmh0q.js → index-yb2wsc7f.js} +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/artifact/implicitRootLayout.ts
|
|
3
|
+
import { mkdir } from "fs/promises";
|
|
4
|
+
import path from "path";
|
|
5
|
+
var LAYOUT_KEY_RE = /^\.\/(.+\/)?_layout\.(tsx|ts|jsx|js)$/;
|
|
6
|
+
async function appHasStModule(appCwdPath) {
|
|
7
|
+
return Bun.file(path.join(appCwdPath, "lib", "st.ts")).exists();
|
|
8
|
+
}
|
|
9
|
+
var IMPLICIT_LAYOUT_DIR = path.join(".akan", "generated", "root-layouts");
|
|
10
|
+
var IMPLICIT_DICT_DIR = path.join(".akan", "generated", "dict");
|
|
11
|
+
var IMPLICIT_OVERRIDES_DIR = path.join(".akan", "generated", "overrides");
|
|
12
|
+
var OVERRIDES_KEY_RE = /^\.\/(.+\/)?_overrides\.(tsx|ts|jsx|js)$/;
|
|
13
|
+
async function writeGeneratedOverridesLayoutFile(opts) {
|
|
14
|
+
const filename = `${opts.key.replace(/^\.\//, "").replace(/[^a-zA-Z0-9]+/g, "_")}.tsx`;
|
|
15
|
+
const absPath = path.join(path.resolve(opts.appCwdPath), IMPLICIT_OVERRIDES_DIR, filename);
|
|
16
|
+
const userRel = path.relative(path.dirname(absPath), opts.userAbsPath).split(path.sep).join("/");
|
|
17
|
+
const userSpecifier = userRel.startsWith(".") ? userRel : `./${userRel}`;
|
|
18
|
+
const source = `"use client";
|
|
19
|
+
import { UiOverrideProvider } from "akanjs/ui";
|
|
20
|
+
import { createElement, type ReactNode } from "react";
|
|
21
|
+
import value from ${JSON.stringify(userSpecifier)};
|
|
22
|
+
|
|
23
|
+
export default function AkanUiOverridesLayout({ children }: { children?: ReactNode }) {
|
|
24
|
+
return createElement(UiOverrideProvider, { value }, children);
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
await Bun.write(absPath, source);
|
|
28
|
+
return absPath;
|
|
29
|
+
}
|
|
30
|
+
function getRootBoundarySegments(key) {
|
|
31
|
+
const match = LAYOUT_KEY_RE.exec(key);
|
|
32
|
+
if (!match)
|
|
33
|
+
return null;
|
|
34
|
+
const prefix = match[1]?.replace(/\/$/, "");
|
|
35
|
+
if (!prefix)
|
|
36
|
+
return [];
|
|
37
|
+
return prefix.split("/").filter(Boolean);
|
|
38
|
+
}
|
|
39
|
+
function implicitRootLayoutKey(segments) {
|
|
40
|
+
return `./${[...segments, "__root_layout"].join("/")}.tsx`;
|
|
41
|
+
}
|
|
42
|
+
function implicitRootLayoutAbsPath(appCwdPath, segments) {
|
|
43
|
+
const filename = segments.length ? `${segments.join("__")}__root_layout.tsx` : "__root_layout.tsx";
|
|
44
|
+
return path.join(path.resolve(appCwdPath), IMPLICIT_LAYOUT_DIR, filename);
|
|
45
|
+
}
|
|
46
|
+
function implicitDictionaryMacroAbsPath(appCwdPath) {
|
|
47
|
+
return path.join(path.resolve(appCwdPath), IMPLICIT_DICT_DIR, "useDict.ts");
|
|
48
|
+
}
|
|
49
|
+
function isRootBoundarySegments(segments, basePaths) {
|
|
50
|
+
const firstVisibleIndex = segments.findIndex((segment) => !/^\(.+\)$/.test(segment));
|
|
51
|
+
if (firstVisibleIndex === -1)
|
|
52
|
+
return segments.length <= 1;
|
|
53
|
+
if (segments.slice(firstVisibleIndex + 1).some((segment) => /^\(.+\)$/.test(segment)))
|
|
54
|
+
return false;
|
|
55
|
+
const visible = segments.slice(firstVisibleIndex);
|
|
56
|
+
const allowedBasePaths = new Set([...basePaths].map((basePath) => basePath.trim()).filter(Boolean));
|
|
57
|
+
return visible.length === 1 && (firstVisibleIndex > 0 || allowedBasePaths.has(visible[0] ?? ""));
|
|
58
|
+
}
|
|
59
|
+
function findRootBoundaries(pageKeys, appCwdPath, basePaths) {
|
|
60
|
+
const boundaries = new Map;
|
|
61
|
+
for (const key of pageKeys) {
|
|
62
|
+
const segments = getRootBoundarySegments(key);
|
|
63
|
+
if (!segments)
|
|
64
|
+
continue;
|
|
65
|
+
if (!isRootBoundarySegments(segments, basePaths))
|
|
66
|
+
continue;
|
|
67
|
+
const id = segments.join("/");
|
|
68
|
+
boundaries.set(id, {
|
|
69
|
+
sourceKey: key,
|
|
70
|
+
sourceAbsPath: path.resolve(appCwdPath, "page", key.replace(/^\.\//, "")),
|
|
71
|
+
segments
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const hasExplicitRootBoundary = [...boundaries.values()].some((boundary) => boundary.segments.length === 0);
|
|
75
|
+
if (!hasExplicitRootBoundary && boundaries.size === 0) {
|
|
76
|
+
boundaries.set("", { sourceKey: null, sourceAbsPath: null, segments: [] });
|
|
77
|
+
}
|
|
78
|
+
return [...boundaries.values()].sort((a, b) => a.segments.join("/").localeCompare(b.segments.join("/")));
|
|
79
|
+
}
|
|
80
|
+
function hasAncestorRootBoundary(boundary, boundaries) {
|
|
81
|
+
return boundaries.some((candidate) => candidate !== boundary && candidate.segments.length < boundary.segments.length && candidate.segments.every((segment, index) => boundary.segments[index] === segment));
|
|
82
|
+
}
|
|
83
|
+
function findExplicitRootLayoutAbsPath(pageKeys, appCwdPath) {
|
|
84
|
+
const rootLayoutKey = pageKeys.find((key) => {
|
|
85
|
+
const segments = getRootBoundarySegments(key);
|
|
86
|
+
return segments !== null && segments.length === 0;
|
|
87
|
+
});
|
|
88
|
+
return rootLayoutKey ? path.resolve(appCwdPath, "page", rootLayoutKey.replace(/^\.\//, "")) : null;
|
|
89
|
+
}
|
|
90
|
+
function routePrefixForSegments(segments) {
|
|
91
|
+
const visible = segments.filter((segment) => !/^\(.+\)$/.test(segment));
|
|
92
|
+
return visible[0] ?? null;
|
|
93
|
+
}
|
|
94
|
+
async function assertEnvClientConvention(appCwdPath, appName) {
|
|
95
|
+
const envPath = path.join(appCwdPath, "env", "env.client.ts");
|
|
96
|
+
if (!await Bun.file(envPath).exists()) {
|
|
97
|
+
throw new Error(`[route-convention] app "${appName}" must provide env/env.client.ts exporting "env" for generated System.Provider`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function writeGeneratedDictionaryMacroFile(appCwdPath, appName) {
|
|
101
|
+
const absPath = implicitDictionaryMacroAbsPath(appCwdPath);
|
|
102
|
+
await mkdir(path.dirname(absPath), { recursive: true });
|
|
103
|
+
await Bun.write(absPath, `import { getAllDictionary } from "@apps/${appName}/lib/dict" with { type: "macro" };
|
|
104
|
+
|
|
105
|
+
export const allDictionary = getAllDictionary();
|
|
106
|
+
`);
|
|
107
|
+
return absPath;
|
|
108
|
+
}
|
|
109
|
+
async function writeGeneratedRootLayoutFile(opts) {
|
|
110
|
+
await assertEnvClientConvention(opts.appCwdPath, opts.appName);
|
|
111
|
+
const dictMacroAbsPath = opts.includeSystemProvider ? await writeGeneratedDictionaryMacroFile(opts.appCwdPath, opts.appName) : null;
|
|
112
|
+
const absPath = implicitRootLayoutAbsPath(opts.appCwdPath, opts.boundary.segments);
|
|
113
|
+
await mkdir(path.dirname(absPath), { recursive: true });
|
|
114
|
+
const dictMacroRel = dictMacroAbsPath ? path.relative(path.dirname(absPath), dictMacroAbsPath).split(path.sep).join("/") : null;
|
|
115
|
+
const dictMacroSpecifier = dictMacroRel ? dictMacroRel.startsWith(".") ? dictMacroRel : `./${dictMacroRel}` : null;
|
|
116
|
+
const sourceRel = opts.boundary.sourceAbsPath ? path.relative(path.dirname(absPath), opts.boundary.sourceAbsPath).split(path.sep).join("/") : null;
|
|
117
|
+
const sourceSpecifier = sourceRel ? sourceRel.startsWith(".") ? sourceRel : `./${sourceRel}` : null;
|
|
118
|
+
const inheritedSourceAbsPath = opts.rootSourceAbsPath && opts.rootSourceAbsPath !== opts.boundary.sourceAbsPath ? opts.rootSourceAbsPath : null;
|
|
119
|
+
const inheritedSourceRel = inheritedSourceAbsPath ? path.relative(path.dirname(absPath), inheritedSourceAbsPath).split(path.sep).join("/") : null;
|
|
120
|
+
const inheritedSourceSpecifier = inheritedSourceRel ? inheritedSourceRel.startsWith(".") ? inheritedSourceRel : `./${inheritedSourceRel}` : null;
|
|
121
|
+
const clientImport = opts.includeStInit ? `import { st } from "@apps/${opts.appName}/client";
|
|
122
|
+
void st;
|
|
123
|
+
` : `import "@apps/${opts.appName}/client";
|
|
124
|
+
`;
|
|
125
|
+
const inheritedImport = inheritedSourceSpecifier ? `import * as inheritedLayout from ${JSON.stringify(inheritedSourceSpecifier)};
|
|
126
|
+
` : `const inheritedLayout = {};
|
|
127
|
+
`;
|
|
128
|
+
const prefix = routePrefixForSegments(opts.boundary.segments);
|
|
129
|
+
const userImport = sourceSpecifier ? `import UserLayout, * as userLayout from ${JSON.stringify(sourceSpecifier)};
|
|
130
|
+
` : `const UserLayout = ({ children }) => children;
|
|
131
|
+
const userLayout = {};
|
|
132
|
+
`;
|
|
133
|
+
const source = opts.includeSystemProvider ? `import type { LayoutProps, PageProps } from "akanjs/client";
|
|
134
|
+
import { loadFonts } from "akanjs/client";
|
|
135
|
+
import { System } from "akanjs/ui";
|
|
136
|
+
import { env } from "@apps/${opts.appName}/env/env.client";
|
|
137
|
+
import { allDictionary } from ${JSON.stringify(dictMacroSpecifier)};
|
|
138
|
+
${clientImport}${inheritedImport}${userImport}
|
|
139
|
+
const userFonts = userLayout.fonts ?? inheritedLayout.fonts ?? [];
|
|
140
|
+
const defaultFonts = userFonts.filter((font) => font.default);
|
|
141
|
+
if (defaultFonts.length > 1) throw new Error("[route-convention] only one default font is allowed per root layout");
|
|
142
|
+
const defaultFont = defaultFonts[0];
|
|
143
|
+
const defaultFontClassName = defaultFont ? (defaultFont.className ?? \`font-\${defaultFont.name}\`) : undefined;
|
|
144
|
+
|
|
145
|
+
export async function generateHead(props: PageProps) {
|
|
146
|
+
if (userLayout.generateHead) return userLayout.generateHead(props);
|
|
147
|
+
if (userLayout.head !== undefined) return userLayout.head;
|
|
148
|
+
if (inheritedLayout.generateHead) return inheritedLayout.generateHead(props);
|
|
149
|
+
return inheritedLayout.head;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export async function generateMetadata(props: PageProps) {
|
|
153
|
+
if (userLayout.generateMetadata) return userLayout.generateMetadata(props);
|
|
154
|
+
if (userLayout.metadata !== undefined) return userLayout.metadata;
|
|
155
|
+
if (inheritedLayout.generateMetadata) return inheritedLayout.generateMetadata(props);
|
|
156
|
+
return inheritedLayout.metadata;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;
|
|
160
|
+
export const Error = userLayout.Error ?? inheritedLayout.Error;
|
|
161
|
+
export const pageConfig = userLayout.pageConfig ?? inheritedLayout.pageConfig;
|
|
162
|
+
|
|
163
|
+
export default function GeneratedLayout({ children, params, searchParams }: LayoutProps) {
|
|
164
|
+
return (
|
|
165
|
+
<System.Provider
|
|
166
|
+
of={GeneratedLayout as never}
|
|
167
|
+
appName=${JSON.stringify(opts.appName)}
|
|
168
|
+
${prefix ? `prefix=${JSON.stringify(prefix)}
|
|
169
|
+
` : ""}params={params}
|
|
170
|
+
manifest={userLayout.manifest ?? inheritedLayout.manifest}
|
|
171
|
+
env={env}
|
|
172
|
+
theme={userLayout.theme ?? inheritedLayout.theme}
|
|
173
|
+
fonts={loadFonts(userFonts)}
|
|
174
|
+
className={defaultFontClassName}
|
|
175
|
+
gaTrackingId={userLayout.gaTrackingId ?? inheritedLayout.gaTrackingId}
|
|
176
|
+
layoutStyle={userLayout.layoutStyle ?? inheritedLayout.layoutStyle}
|
|
177
|
+
reconnect={userLayout.reconnect ?? inheritedLayout.reconnect ?? false}
|
|
178
|
+
wsConnect={userLayout.wsConnect ?? inheritedLayout.wsConnect ?? true}
|
|
179
|
+
allDictionary={process.env.AKAN_PUBLIC_RENDER_ENV === "ssr" ? allDictionary : undefined}
|
|
180
|
+
>
|
|
181
|
+
<UserLayout params={params} searchParams={searchParams}>{children}</UserLayout>
|
|
182
|
+
</System.Provider>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
` : `import type { LayoutProps, PageProps } from "akanjs/client";
|
|
186
|
+
${inheritedImport}${userImport}
|
|
187
|
+
export async function generateHead(props: PageProps) {
|
|
188
|
+
if (userLayout.generateHead) return userLayout.generateHead(props);
|
|
189
|
+
if (userLayout.head !== undefined) return userLayout.head;
|
|
190
|
+
if (inheritedLayout.generateHead) return inheritedLayout.generateHead(props);
|
|
191
|
+
return inheritedLayout.head;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export async function generateMetadata(props: PageProps) {
|
|
195
|
+
if (userLayout.generateMetadata) return userLayout.generateMetadata(props);
|
|
196
|
+
if (userLayout.metadata !== undefined) return userLayout.metadata;
|
|
197
|
+
if (inheritedLayout.generateMetadata) return inheritedLayout.generateMetadata(props);
|
|
198
|
+
return inheritedLayout.metadata;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const NotFound = userLayout.NotFound ?? inheritedLayout.NotFound;
|
|
202
|
+
export const Error = userLayout.Error ?? inheritedLayout.Error;
|
|
203
|
+
export const pageConfig = userLayout.pageConfig ?? inheritedLayout.pageConfig;
|
|
204
|
+
|
|
205
|
+
export default function GeneratedLayout({ children, params, searchParams }: LayoutProps) {
|
|
206
|
+
return <UserLayout params={params} searchParams={searchParams}>{children}</UserLayout>;
|
|
207
|
+
}
|
|
208
|
+
`;
|
|
209
|
+
await Bun.write(absPath, source);
|
|
210
|
+
return absPath;
|
|
211
|
+
}
|
|
212
|
+
async function resolveSsrPageEntries(opts) {
|
|
213
|
+
const absPageDir = path.resolve(opts.appCwdPath, "page");
|
|
214
|
+
const hasSt = await appHasStModule(opts.appCwdPath);
|
|
215
|
+
const basePaths = opts.basePaths ?? [];
|
|
216
|
+
const rootSourceAbsPath = findExplicitRootLayoutAbsPath(opts.pageKeys, opts.appCwdPath);
|
|
217
|
+
const rootBoundaries = findRootBoundaries(opts.pageKeys, opts.appCwdPath, basePaths);
|
|
218
|
+
const rootLayoutKeys = new Set(opts.pageKeys.filter((key) => {
|
|
219
|
+
const segments = getRootBoundarySegments(key);
|
|
220
|
+
return segments !== null && isRootBoundarySegments(segments, basePaths);
|
|
221
|
+
}));
|
|
222
|
+
const base = await Promise.all(opts.pageKeys.filter((key) => !rootLayoutKeys.has(key)).map(async (key) => {
|
|
223
|
+
const userAbsPath = path.resolve(absPageDir, key);
|
|
224
|
+
if (OVERRIDES_KEY_RE.test(key)) {
|
|
225
|
+
const moduleAbsPath = await writeGeneratedOverridesLayoutFile({
|
|
226
|
+
appCwdPath: opts.appCwdPath,
|
|
227
|
+
key,
|
|
228
|
+
userAbsPath
|
|
229
|
+
});
|
|
230
|
+
return { key, moduleAbsPath, seedAbsPaths: [userAbsPath] };
|
|
231
|
+
}
|
|
232
|
+
return { key, moduleAbsPath: userAbsPath };
|
|
233
|
+
}));
|
|
234
|
+
const generated = await Promise.all(rootBoundaries.map(async (boundary) => ({
|
|
235
|
+
key: implicitRootLayoutKey(boundary.segments),
|
|
236
|
+
moduleAbsPath: await writeGeneratedRootLayoutFile({
|
|
237
|
+
appCwdPath: opts.appCwdPath,
|
|
238
|
+
appName: opts.appName,
|
|
239
|
+
boundary,
|
|
240
|
+
rootSourceAbsPath,
|
|
241
|
+
includeStInit: hasSt && boundary.segments.length === 0,
|
|
242
|
+
includeSystemProvider: !hasAncestorRootBoundary(boundary, rootBoundaries)
|
|
243
|
+
}),
|
|
244
|
+
seedAbsPaths: [...new Set([boundary.sourceAbsPath, rootSourceAbsPath].filter((absPath) => absPath !== null))]
|
|
245
|
+
})));
|
|
246
|
+
const entries = [...base, ...generated];
|
|
247
|
+
entries.sort((a, b) => a.key.localeCompare(b.key));
|
|
248
|
+
return entries;
|
|
249
|
+
}
|
|
250
|
+
async function resolveSsrPageEntriesForApp(app, pageKeys) {
|
|
251
|
+
const config = await app.getConfig();
|
|
252
|
+
return resolveSsrPageEntries({ appCwdPath: app.cwdPath, appName: app.name, pageKeys, basePaths: config.basePaths });
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export { getRootBoundarySegments, isRootBoundarySegments, resolveSsrPageEntriesForApp };
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
PkgExecutor,
|
|
8
8
|
WorkspaceExecutor,
|
|
9
9
|
getDirname
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-3g17wsqr.js";
|
|
11
11
|
import {
|
|
12
12
|
FileSys
|
|
13
13
|
} from "./index-67546d0j.js";
|
|
14
14
|
import {
|
|
15
15
|
__require
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-yb2wsc7f.js";
|
|
17
17
|
|
|
18
18
|
// pkgs/@akanjs/devkit/commandDecorators/targetMeta.ts
|
|
19
19
|
var COMMAND_META = Symbol("akan.command.meta");
|
|
@@ -4,24 +4,24 @@ import {
|
|
|
4
4
|
} from "./index-76rn3g2c.js";
|
|
5
5
|
import {
|
|
6
6
|
LibraryScript
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-4fh6v6qr.js";
|
|
8
8
|
import {
|
|
9
9
|
runner,
|
|
10
10
|
script
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-g10wmymm.js";
|
|
12
12
|
import {
|
|
13
13
|
AppExecutor,
|
|
14
14
|
LibExecutor,
|
|
15
15
|
PkgExecutor,
|
|
16
16
|
WorkspaceExecutor
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-3g17wsqr.js";
|
|
18
18
|
import {
|
|
19
19
|
HmrWatcher,
|
|
20
20
|
WatchRootResolver
|
|
21
21
|
} from "./index-bjpxzr6s.js";
|
|
22
22
|
import {
|
|
23
23
|
__require
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-yb2wsc7f.js";
|
|
25
25
|
|
|
26
26
|
// pkgs/@akanjs/devkit/applicationBuildReporter.ts
|
|
27
27
|
import { Logger } from "akanjs/common";
|
|
@@ -1898,9 +1898,10 @@ function openBrowser(url) {
|
|
|
1898
1898
|
}
|
|
1899
1899
|
|
|
1900
1900
|
// pkgs/@akanjs/cli/application/application.runner.ts
|
|
1901
|
-
var loadBuildRunner = async () => (await import("./applicationBuildRunner-
|
|
1902
|
-
var loadReleasePackager = async () => (await import("./applicationReleasePackager-
|
|
1903
|
-
var loadCapacitorApp = async () => (await import("./capacitorApp-
|
|
1901
|
+
var loadBuildRunner = async () => (await import("./applicationBuildRunner-hn86q106.js")).ApplicationBuildRunner;
|
|
1902
|
+
var loadReleasePackager = async () => (await import("./applicationReleasePackager-b1zh40kd.js")).ApplicationReleasePackager;
|
|
1903
|
+
var loadCapacitorApp = async () => (await import("./capacitorApp-sqr41tck.js")).CapacitorApp;
|
|
1904
|
+
var loadAbstractCompactor = async () => (await import("./abstractCompactor-bjd2h5pq.js")).AbstractCompactor;
|
|
1904
1905
|
var loadPrompts = async () => await import("@inquirer/prompts");
|
|
1905
1906
|
|
|
1906
1907
|
class ApplicationRunner extends runner("application") {
|
|
@@ -1978,6 +1979,10 @@ try {
|
|
|
1978
1979
|
async typecheck(app, options = {}) {
|
|
1979
1980
|
await new (await loadBuildRunner())(app).typecheck(options);
|
|
1980
1981
|
}
|
|
1982
|
+
async compact(sys, { module, minLines, interactive } = {}) {
|
|
1983
|
+
const compactor = new (await loadAbstractCompactor())(sys, { minLines, interactive });
|
|
1984
|
+
return await compactor.compactAll({ module });
|
|
1985
|
+
}
|
|
1981
1986
|
async test(exec) {
|
|
1982
1987
|
const isSignalTarget = exec instanceof AppExecutor || exec instanceof LibExecutor;
|
|
1983
1988
|
const preloadPath = isSignalTarget ? await resolveSignalTestPreloadPath(exec) : null;
|
|
@@ -2231,9 +2236,7 @@ ${detail}`
|
|
|
2231
2236
|
const chain = RunnableSequence.from([mainPrompt, chatModel, new StringOutputParser]);
|
|
2232
2237
|
await chain.invoke({ projectName, projectDesc });
|
|
2233
2238
|
spinner.succeed("Loading complete!");
|
|
2234
|
-
//! add path in tsconfig.json
|
|
2235
2239
|
}
|
|
2236
|
-
async testApplication(app) {}
|
|
2237
2240
|
}
|
|
2238
2241
|
|
|
2239
2242
|
// pkgs/@akanjs/cli/application/application.script.ts
|
|
@@ -2331,6 +2334,17 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
2331
2334
|
else
|
|
2332
2335
|
await this.libraryScript.syncLibrary(sys);
|
|
2333
2336
|
}
|
|
2337
|
+
async compact(sys, { module = null, minLines, interactive = false } = {}) {
|
|
2338
|
+
const { scanned, reports } = await this.applicationRunner.compact(sys, { module, minLines, interactive });
|
|
2339
|
+
if (!reports.length) {
|
|
2340
|
+
Logger5.rawLog(`No abstract file long enough to compact in ${sys.name} (${scanned} scanned)`);
|
|
2341
|
+
return;
|
|
2342
|
+
}
|
|
2343
|
+
for (const report of reports)
|
|
2344
|
+
Logger5.rawLog(`${report.status}: ${report.path} (${report.beforeLines} -> ${report.afterLines} lines)`);
|
|
2345
|
+
const compactedNum = reports.filter((report) => report.status === "compacted").length;
|
|
2346
|
+
Logger5.rawLog(`Compacted ${compactedNum}/${reports.length} abstract files in ${sys.name}`);
|
|
2347
|
+
}
|
|
2334
2348
|
async script(app, filename) {
|
|
2335
2349
|
const scriptFilename = filename ?? await this.applicationRunner.getScriptFilename(app);
|
|
2336
2350
|
await app.scanSync();
|
|
@@ -2515,7 +2529,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
2515
2529
|
}
|
|
2516
2530
|
async testApplication(app) {
|
|
2517
2531
|
const spinner = app.spinning("Testing application...");
|
|
2518
|
-
await this.applicationRunner.
|
|
2532
|
+
await this.applicationRunner.test(app);
|
|
2519
2533
|
spinner.succeed(`Application ${app.name} (apps/${app.name}) test is successful`);
|
|
2520
2534
|
}
|
|
2521
2535
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
CloudRunner
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-z1eqzrj9.js";
|
|
5
|
+
import {
|
|
6
|
+
PackageScript
|
|
7
|
+
} from "./index-6a9008sh.js";
|
|
5
8
|
import {
|
|
6
9
|
AiSession,
|
|
7
10
|
CloudApi,
|
|
@@ -9,16 +12,13 @@ import {
|
|
|
9
12
|
} from "./index-nsj2ftxj.js";
|
|
10
13
|
import {
|
|
11
14
|
ApplicationScript
|
|
12
|
-
} from "./index-
|
|
13
|
-
import {
|
|
14
|
-
PackageScript
|
|
15
|
-
} from "./index-z36qzgzp.js";
|
|
15
|
+
} from "./index-hr3n31n0.js";
|
|
16
16
|
import {
|
|
17
17
|
script
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-g10wmymm.js";
|
|
19
19
|
import {
|
|
20
20
|
PkgExecutor
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-3g17wsqr.js";
|
|
22
22
|
|
|
23
23
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
24
24
|
import { Logger } from "akanjs/common";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
workflowRunArtifactPath,
|
|
4
4
|
workflowSyncDir
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-0476y8pz.js";
|
|
6
6
|
import {
|
|
7
7
|
AppExecutor,
|
|
8
8
|
LibExecutor
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-3g17wsqr.js";
|
|
10
10
|
import {
|
|
11
11
|
FileSys
|
|
12
12
|
} from "./index-67546d0j.js";
|
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
createPassedPrimitiveReport,
|
|
7
7
|
generatedFilesForSync,
|
|
8
8
|
scalarChangedFiles
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-0476y8pz.js";
|
|
10
10
|
import {
|
|
11
11
|
Prompter
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-3f3bjcwc.js";
|
|
13
13
|
import {
|
|
14
14
|
AiSession
|
|
15
15
|
} from "./index-nsj2ftxj.js";
|
|
16
16
|
import {
|
|
17
17
|
runner,
|
|
18
18
|
script
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-g10wmymm.js";
|
|
20
20
|
|
|
21
21
|
// pkgs/@akanjs/cli/scalar/scalar.prompt.ts
|
|
22
22
|
import { input } from "@inquirer/prompts";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ModuleScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-dscrzdk0.js";
|
|
5
5
|
import {
|
|
6
6
|
addFieldUiPolicyForType,
|
|
7
7
|
coerceFieldDefault,
|
|
@@ -34,15 +34,15 @@ import {
|
|
|
34
34
|
sourceFile,
|
|
35
35
|
validationCommandsForTarget,
|
|
36
36
|
viaBuilderParameterName
|
|
37
|
-
} from "./index-
|
|
37
|
+
} from "./index-0476y8pz.js";
|
|
38
38
|
import {
|
|
39
39
|
script
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-g10wmymm.js";
|
|
41
41
|
import {
|
|
42
42
|
AppExecutor,
|
|
43
43
|
LibExecutor,
|
|
44
44
|
ModuleExecutor
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-3g17wsqr.js";
|
|
46
46
|
|
|
47
47
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
48
48
|
import { capitalize } from "akanjs/common";
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
} from "./index-nsj2ftxj.js";
|
|
8
8
|
import {
|
|
9
9
|
openBrowser
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-hr3n31n0.js";
|
|
11
11
|
import {
|
|
12
12
|
runner
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-g10wmymm.js";
|
|
14
14
|
import {
|
|
15
15
|
AppExecutor,
|
|
16
16
|
WorkspaceExecutor
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-3g17wsqr.js";
|
|
18
18
|
|
|
19
19
|
// pkgs/@akanjs/cli/cloud/cloud.runner.ts
|
|
20
20
|
import path from "path";
|
package/index.js
CHANGED
|
@@ -4,35 +4,36 @@ import {
|
|
|
4
4
|
getTargetCommandNames,
|
|
5
5
|
getTargetMetas,
|
|
6
6
|
runCommands
|
|
7
|
-
} from "./index-
|
|
8
|
-
import"./index-
|
|
7
|
+
} from "./index-g10wmymm.js";
|
|
8
|
+
import"./index-3g17wsqr.js";
|
|
9
9
|
import"./index-67546d0j.js";
|
|
10
|
+
import"./index-f39512t6.js";
|
|
10
11
|
import"./index-6pz1j0zj.js";
|
|
11
12
|
import {
|
|
12
13
|
__require
|
|
13
|
-
} from "./index-
|
|
14
|
+
} from "./index-yb2wsc7f.js";
|
|
14
15
|
|
|
15
16
|
// pkgs/@akanjs/cli/commandManifest.ts
|
|
16
17
|
import path from "path";
|
|
17
18
|
|
|
18
19
|
// pkgs/@akanjs/cli/commandModules.ts
|
|
19
20
|
var commandModules = {
|
|
20
|
-
workspace: async () => (await import("./workspace.command-
|
|
21
|
-
agent: async () => (await import("./agent.command-
|
|
22
|
-
application: async () => (await import("./application.command-
|
|
23
|
-
library: async () => (await import("./library.command-
|
|
24
|
-
localRegistry: async () => (await import("./localRegistry.command-
|
|
25
|
-
package: async () => (await import("./package.command-
|
|
26
|
-
module: async () => (await import("./module.command-
|
|
27
|
-
page: async () => (await import("./page.command-
|
|
28
|
-
context: async () => (await import("./context.command-
|
|
29
|
-
cloud: async () => (await import("./cloud.command-
|
|
30
|
-
guideline: async () => (await import("./guideline.command-
|
|
31
|
-
scalar: async () => (await import("./scalar.command-
|
|
32
|
-
primitive: async () => (await import("./primitive.command-
|
|
33
|
-
quality: async () => (await import("./quality.command-
|
|
34
|
-
repair: async () => (await import("./repair.command-
|
|
35
|
-
workflow: async () => (await import("./workflow.command-
|
|
21
|
+
workspace: async () => (await import("./workspace.command-a57b7ybw.js")).WorkspaceCommand,
|
|
22
|
+
agent: async () => (await import("./agent.command-dwxr73jr.js")).AgentCommand,
|
|
23
|
+
application: async () => (await import("./application.command-8k6xs7q0.js")).ApplicationCommand,
|
|
24
|
+
library: async () => (await import("./library.command-w11wnq7q.js")).LibraryCommand,
|
|
25
|
+
localRegistry: async () => (await import("./localRegistry.command-fkq49j84.js")).LocalRegistryCommand,
|
|
26
|
+
package: async () => (await import("./package.command-5ann132q.js")).PackageCommand,
|
|
27
|
+
module: async () => (await import("./module.command-wyjgbg0d.js")).ModuleCommand,
|
|
28
|
+
page: async () => (await import("./page.command-e75nxwrw.js")).PageCommand,
|
|
29
|
+
context: async () => (await import("./context.command-rydtf2vy.js")).ContextCommand,
|
|
30
|
+
cloud: async () => (await import("./cloud.command-5wh9krwx.js")).CloudCommand,
|
|
31
|
+
guideline: async () => (await import("./guideline.command-dtkrftpc.js")).GuidelineCommand,
|
|
32
|
+
scalar: async () => (await import("./scalar.command-agc839az.js")).ScalarCommand,
|
|
33
|
+
primitive: async () => (await import("./primitive.command-gy7nwn5w.js")).PrimitiveCommand,
|
|
34
|
+
quality: async () => (await import("./quality.command-41tw1g5g.js")).QualityCommand,
|
|
35
|
+
repair: async () => (await import("./repair.command-xr4664h4.js")).RepairCommand,
|
|
36
|
+
workflow: async () => (await import("./workflow.command-jf09cq6k.js")).WorkflowCommand
|
|
36
37
|
};
|
|
37
38
|
var commandModuleIds = Object.keys(commandModules);
|
|
38
39
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
LibraryScript
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-4fh6v6qr.js";
|
|
5
5
|
import {
|
|
6
6
|
Lib,
|
|
7
7
|
Workspace,
|
|
8
8
|
command
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
} from "./index-g10wmymm.js";
|
|
10
|
+
import"./index-3g17wsqr.js";
|
|
11
11
|
import"./index-67546d0j.js";
|
|
12
|
+
import"./index-f39512t6.js";
|
|
12
13
|
import"./index-6pz1j0zj.js";
|
|
13
|
-
import"./index-
|
|
14
|
+
import"./index-yb2wsc7f.js";
|
|
14
15
|
|
|
15
16
|
// pkgs/@akanjs/cli/library/library.command.ts
|
|
16
17
|
class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({
|
|
@@ -2,31 +2,32 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CloudRunner,
|
|
4
4
|
getNpmRegistryUrl
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-z1eqzrj9.js";
|
|
6
|
+
import {
|
|
7
|
+
PackageScript
|
|
8
|
+
} from "./index-6a9008sh.js";
|
|
6
9
|
import"./index-nsj2ftxj.js";
|
|
7
10
|
import {
|
|
8
11
|
ApplicationScript
|
|
9
|
-
} from "./index-
|
|
12
|
+
} from "./index-hr3n31n0.js";
|
|
10
13
|
import"./index-76rn3g2c.js";
|
|
11
|
-
import"./index-
|
|
12
|
-
import {
|
|
13
|
-
PackageScript
|
|
14
|
-
} from "./index-z36qzgzp.js";
|
|
14
|
+
import"./index-4fh6v6qr.js";
|
|
15
15
|
import {
|
|
16
16
|
Workspace,
|
|
17
17
|
command,
|
|
18
18
|
runner,
|
|
19
19
|
script
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-g10wmymm.js";
|
|
21
21
|
import"./index-fgc8r6dj.js";
|
|
22
22
|
import {
|
|
23
23
|
PkgExecutor
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-3g17wsqr.js";
|
|
25
25
|
import"./index-46tjzh6s.js";
|
|
26
26
|
import"./index-67546d0j.js";
|
|
27
27
|
import"./index-bjpxzr6s.js";
|
|
28
|
+
import"./index-f39512t6.js";
|
|
28
29
|
import"./index-6pz1j0zj.js";
|
|
29
|
-
import"./index-
|
|
30
|
+
import"./index-yb2wsc7f.js";
|
|
30
31
|
|
|
31
32
|
// pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
|
|
32
33
|
import { mkdir, rm } from "fs/promises";
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ModuleScript
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-dscrzdk0.js";
|
|
5
|
+
import"./index-jf5k3bt8.js";
|
|
6
6
|
import"./index-ss469dec.js";
|
|
7
7
|
import {
|
|
8
8
|
renderPrimitiveReport
|
|
9
|
-
} from "./index-
|
|
10
|
-
import"./index-
|
|
9
|
+
} from "./index-0476y8pz.js";
|
|
10
|
+
import"./index-3f3bjcwc.js";
|
|
11
11
|
import"./index-nsj2ftxj.js";
|
|
12
12
|
import {
|
|
13
13
|
Module,
|
|
14
14
|
Sys,
|
|
15
15
|
command
|
|
16
|
-
} from "./index-
|
|
17
|
-
import"./index-
|
|
16
|
+
} from "./index-g10wmymm.js";
|
|
17
|
+
import"./index-3g17wsqr.js";
|
|
18
18
|
import"./index-67546d0j.js";
|
|
19
|
+
import"./index-f39512t6.js";
|
|
19
20
|
import"./index-6pz1j0zj.js";
|
|
20
|
-
import"./index-
|
|
21
|
+
import"./index-yb2wsc7f.js";
|
|
21
22
|
|
|
22
23
|
// pkgs/@akanjs/cli/module/module.command.ts
|
|
23
24
|
import { Logger, lowerlize } from "akanjs/common";
|