@akanjs/cli 3.2.0-rc.14 → 3.2.0-rc.16
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 +2 -2
- package/CodeAgent-18qg03re.js +11 -0
- package/{CodeTui-h7mksphk.js → CodeTui-zkm51zf3.js} +4 -4
- package/TunnelShare-6t4rwyc0.js +19 -0
- package/{agent.command-hrc2dfas.js → agent.command-5k2zegmj.js} +25 -25
- package/akanCode.js +6 -6
- package/appExecutor-1bgs9a69.js +11 -0
- package/{application.command-b2194cpv.js → application.command-ge27047n.js} +20 -20
- package/{applicationBuildRunner-gg03kydg.js → applicationBuildRunner-7skfg8zn.js} +14 -14
- package/buildBatch.proc.js +11 -11
- package/{cloud.command-d8ps1564.js → cloud.command-d18qj1v2.js} +25 -25
- package/cloud.script-0hbhm3mw.js +35 -0
- package/{code.command-6h6jr0s7.js → code.command-tz4x5zm6.js} +13 -13
- package/{context.command-t8akxhny.js → context.command-x1smtm5q.js} +25 -25
- package/context.runner-vb7jc0k8.js +34 -0
- package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
- package/{devTui-h77zrjv5.js → devTui-rf374y2w.js} +1 -1
- package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
- package/{guideline.command-f41b5nv5.js → guideline.command-rdcwxf8g.js} +8 -8
- package/guidelines/conventions/rules/app.md +1 -1
- package/incrementalBuilder.proc.js +12 -12
- package/{index-e599a0e4.js → index-0c8zj1da.js} +1 -1
- package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
- package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
- package/{index-66jt3m30.js → index-1ts8vfsk.js} +5 -5
- package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
- package/{index-3fn13v8p.js → index-3641r8q0.js} +6 -6
- package/{index-hbc0t3ng.js → index-39byv35b.js} +2 -2
- package/{index-j2me5hm4.js → index-669sg3yp.js} +3 -3
- package/{index-bb7cm060.js → index-6p02be7n.js} +22 -22
- package/{index-j6eeh5d7.js → index-89x8tp7z.js} +4 -4
- package/{index-r0a604h4.js → index-99kjwyma.js} +1 -1
- package/{index-71z3pdsn.js → index-9mx3b3zh.js} +4 -4
- package/{index-c0rnjeqn.js → index-b2sptt87.js} +7 -7
- package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
- package/{index-2z8mxgs7.js → index-bjnebzzc.js} +4 -4
- package/{index-hpe12v1h.js → index-bxqbt5p3.js} +2 -2
- package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
- package/{index-1b1p83vq.js → index-bzdq8wfw.js} +5 -5
- package/{index-nx4q5rey.js → index-d2r762fk.js} +4 -4
- package/{index-3fpv5v0t.js → index-dp7sht3v.js} +17 -17
- package/{index-rx8r0cbe.js → index-dqsc1b5t.js} +1 -1
- package/{index-x2bj2vyz.js → index-dtpeyts6.js} +1 -1
- package/{index-8bkbexcy.js → index-e82xwj3x.js} +1 -1
- package/{index-hg8s6nae.js → index-emf3wzvh.js} +7 -7
- package/{index-5np8zpep.js → index-er2ja34m.js} +13 -13
- package/{index-j33b0n38.js → index-f482h2hj.js} +20 -2
- package/{index-9yfssbgg.js → index-fcrr79gh.js} +75 -41
- package/{index-ny2k80mv.js → index-ffa52fwf.js} +1 -1
- package/{index-crtscw7c.js → index-g56xae1n.js} +183 -182
- package/{index-asfx2dhe.js → index-g7e58wz2.js} +6 -6
- package/{index-3fbmyb2r.js → index-gh4brxzn.js} +2 -2
- package/{index-xb1yh9km.js → index-h7yd92c8.js} +2 -2
- package/{index-k081wv4r.js → index-j2eqe3jk.js} +19 -19
- package/{index-9w51aevd.js → index-jfkh776h.js} +1 -1
- package/{index-1jzdengt.js → index-n8mxyy3f.js} +1 -1
- package/{index-3gmskeq2.js → index-neassptx.js} +10 -10
- package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
- package/{index-37k5vshx.js → index-q4e18ne4.js} +4 -4
- package/{index-g2ebpf0y.js → index-q57rsax4.js} +3 -3
- package/{index-b4qq3rq0.js → index-rwgqba9p.js} +1 -1
- package/{index-grt0e6kk.js → index-s75h0455.js} +1 -1
- package/{index-xgqz3kak.js → index-sp331bww.js} +2 -2
- package/{index-h7hehkw6.js → index-t0g6jgrc.js} +1 -1
- package/{index-6dwk5aej.js → index-t329y8am.js} +12 -12
- package/{index-8rmg8c0y.js → index-t8tysbxv.js} +7 -7
- package/{index-b3h37zk3.js → index-trp7jdr1.js} +4 -4
- package/{index-c4k6e098.js → index-ttfz2sc7.js} +104 -55
- package/{index-xjj0h74q.js → index-vm6pr11y.js} +3 -3
- package/{index-vb8gd135.js → index-xywq95wk.js} +6 -6
- package/{index-vy50ec2q.js → index-yr5jv8yd.js} +3 -3
- package/{index-f5j09jnj.js → index-z7t6neq1.js} +9 -9
- package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
- package/index.js +28 -28
- package/{libExecutor-ex8jqksz.js → libExecutor-hxe5eqfh.js} +3 -3
- package/{library.command-a9p5yg4k.js → library.command-83shs8fw.js} +8 -8
- package/{localRegistry.command-zz64k5vy.js → localRegistry.command-sz713jg3.js} +24 -24
- package/{module.command-1ht6dmxg.js → module.command-jhhm0nmw.js} +10 -10
- package/{package.command-eabq20aq.js → package.command-42syy96v.js} +11 -11
- package/package.json +2 -2
- package/{page.command-xhmzmvjn.js → page.command-jkv29zzs.js} +8 -8
- package/{pipeline.command-wsbg3fpr.js → pipeline.command-6sg9g4hq.js} +9 -9
- package/{pkgExecutor-d16x1xcb.js → pkgExecutor-6p82w5y1.js} +3 -3
- package/{primitive.command-yyxtfhvq.js → primitive.command-tt6aq7m9.js} +11 -11
- package/{projectTypecheck-wcrt7sae.js → projectTypecheck-wfrz0cxr.js} +1 -1
- package/{prompter-qrwx1p17.js → prompter-w58rvzb9.js} +2 -2
- package/{quality.command-n7hmt628.js → quality.command-tqar7ss5.js} +12 -12
- package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
- package/{repair.command-pczdq4mv.js → repair.command-qkcn329t.js} +11 -11
- package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8aph1dsr.js} +1 -1
- package/{scalar.command-cw3d32sv.js → scalar.command-6nvq11ag.js} +9 -9
- package/skills/akan-debug/SKILL.md +8 -5
- package/{subspace.command-d8t8geyv.js → subspace.command-dvwds4cv.js} +20 -20
- package/{tunnel.command-mhm64m9n.js → tunnel.command-h8r69a7v.js} +12 -12
- package/{typeChecker-s640r6c0.js → typeChecker-bfrd1n9n.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/{verify.command-j4he0fbx.js → verify.command-ynec8kt2.js} +20 -20
- package/{workflow.command-k064waza.js → workflow.command-f70fx73a.js} +16 -16
- package/{workspace.command-pkpawft5.js → workspace.command-vagjy1q9.js} +43 -43
- package/CodeAgent-yd1f54yf.js +0 -11
- package/TunnelShare-hrjed2jf.js +0 -19
- package/appExecutor-0ssszyhf.js +0 -11
- package/cloud.script-7j7w4m0w.js +0 -35
- package/context.runner-eawk1n8e.js +0 -34
|
@@ -4,27 +4,27 @@ import {
|
|
|
4
4
|
CloudApi,
|
|
5
5
|
CloudUpdates,
|
|
6
6
|
PipelineSecrets
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-vm6pr11y.js";
|
|
8
8
|
import {
|
|
9
9
|
PkgExecutor2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-dtpeyts6.js";
|
|
11
11
|
import {
|
|
12
12
|
UpdatePackFolder,
|
|
13
13
|
NativePublicEnv,
|
|
14
14
|
NativeApp
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-q57rsax4.js";
|
|
16
16
|
import {
|
|
17
17
|
script
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-neassptx.js";
|
|
19
19
|
import {
|
|
20
20
|
ApplicationScript
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-fcrr79gh.js";
|
|
22
22
|
import {
|
|
23
23
|
PackageScript
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-z7t6neq1.js";
|
|
25
25
|
import {
|
|
26
26
|
CloudRunner
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-b2sptt87.js";
|
|
28
28
|
|
|
29
29
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
30
30
|
import { Logger } from "akanjs/common";
|
|
@@ -8,33 +8,33 @@ import {
|
|
|
8
8
|
isScannedRootEntry,
|
|
9
9
|
extractBlockVersion,
|
|
10
10
|
readDevkitVersion
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-g56xae1n.js";
|
|
12
12
|
import {
|
|
13
13
|
FileSys2
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-by2tvsq6.js";
|
|
15
15
|
import {
|
|
16
16
|
AppExecutor2
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-trp7jdr1.js";
|
|
18
18
|
import {
|
|
19
19
|
LibExecutor2
|
|
20
|
-
} from "./index-
|
|
21
|
-
import {
|
|
22
|
-
collectRecipeSources2,
|
|
23
|
-
scanRecipes2,
|
|
24
|
-
findInlineRecipeDuplicates2
|
|
25
|
-
} from "./index-hj6w4ka1.js";
|
|
20
|
+
} from "./index-n8mxyy3f.js";
|
|
26
21
|
import {
|
|
27
22
|
workflowPathsForPlan,
|
|
28
23
|
workflowRunArtifactPath,
|
|
29
24
|
workflowSyncDir
|
|
30
|
-
} from "./index-
|
|
25
|
+
} from "./index-669sg3yp.js";
|
|
26
|
+
import {
|
|
27
|
+
collectRecipeSources2,
|
|
28
|
+
scanRecipes2,
|
|
29
|
+
findInlineRecipeDuplicates2
|
|
30
|
+
} from "./index-1p81ecbz.js";
|
|
31
31
|
|
|
32
|
-
// pkgs/@akanjs/devkit/akanContext.ts
|
|
32
|
+
// pkgs/@akanjs/devkit/context/akanContext.ts
|
|
33
33
|
import { readdir } from "fs/promises";
|
|
34
34
|
import path from "path";
|
|
35
35
|
import { capitalize, isRecord, parseRouteModuleKey } from "akanjs/common";
|
|
36
36
|
|
|
37
|
-
// pkgs/@akanjs/devkit/moduleFieldNames.ts
|
|
37
|
+
// pkgs/@akanjs/devkit/context/moduleFieldNames.ts
|
|
38
38
|
import ts from "typescript";
|
|
39
39
|
var isFieldCall = (node) => ts.isCallExpression(node) && (ts.isIdentifier(node.expression) ? node.expression.text === "field" : ts.isPropertyAccessExpression(node.expression) && isFieldCall(node.expression.expression));
|
|
40
40
|
var propertyNames = (content, declares) => {
|
|
@@ -53,7 +53,7 @@ var unlabeledFieldNames = (constantContent, dictionaryContent) => {
|
|
|
53
53
|
return constantFieldNames(constantContent).filter((name) => !labels.has(name));
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
// pkgs/@akanjs/devkit/akanContext.ts
|
|
56
|
+
// pkgs/@akanjs/devkit/context/akanContext.ts
|
|
57
57
|
var guidelineResourceUri = (name) => `akan://guidelines/${name}`;
|
|
58
58
|
var staticResourceList = [
|
|
59
59
|
{ uri: "akan://docs/framework", name: "Akan framework guide", mimeType: "text/markdown" },
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
JsonFormatter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-g56xae1n.js";
|
|
5
5
|
|
|
6
|
-
// pkgs/@akanjs/devkit/maintainabilityBaseline.ts
|
|
6
|
+
// pkgs/@akanjs/devkit/quality/maintainabilityBaseline.ts
|
|
7
7
|
class MaintainabilityBaseline {
|
|
8
8
|
sections;
|
|
9
9
|
reasons;
|
|
@@ -146,6 +146,24 @@ class MaintainabilityBaseline {
|
|
|
146
146
|
sections.set(rule, other.sections.get(rule) ?? new Map);
|
|
147
147
|
return new MaintainabilityBaseline(sections, this.reasons);
|
|
148
148
|
}
|
|
149
|
+
movedBy(moves) {
|
|
150
|
+
if (!moves.size)
|
|
151
|
+
return this;
|
|
152
|
+
const movedKey = (key) => {
|
|
153
|
+
const file = key.split("#", 1)[0] ?? key;
|
|
154
|
+
const to = moves.get(file);
|
|
155
|
+
return to === undefined ? key : `${to}${key.slice(file.length)}`;
|
|
156
|
+
};
|
|
157
|
+
const sections = new Map([...this.sections].map(([rule, counts]) => {
|
|
158
|
+
const moved = new Map;
|
|
159
|
+
for (const [key, count] of counts) {
|
|
160
|
+
const to = movedKey(key);
|
|
161
|
+
moved.set(to, Math.max(moved.get(to) ?? 0, count));
|
|
162
|
+
}
|
|
163
|
+
return [rule, moved];
|
|
164
|
+
}));
|
|
165
|
+
return new MaintainabilityBaseline(sections, new Map([...this.reasons].map(([key, reason]) => [movedKey(key), reason])));
|
|
166
|
+
}
|
|
149
167
|
tightenedBy(violations) {
|
|
150
168
|
const current = MaintainabilityBaseline.of(violations);
|
|
151
169
|
const sections = new Map([...this.sections].map(([rule, counts]) => {
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
ApplicationBuildReporter
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-1ts8vfsk.js";
|
|
5
5
|
import {
|
|
6
6
|
script,
|
|
7
7
|
markCliErrorPrinted,
|
|
8
8
|
assertPromptable
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-neassptx.js";
|
|
10
10
|
import {
|
|
11
11
|
CliError
|
|
12
12
|
} from "./index-j4yvgfhr.js";
|
|
13
13
|
import {
|
|
14
14
|
SysExecutor
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-g56xae1n.js";
|
|
16
16
|
import {
|
|
17
17
|
AppExecutor2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-trp7jdr1.js";
|
|
19
19
|
import {
|
|
20
20
|
LibExecutor2
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-n8mxyy3f.js";
|
|
22
22
|
import {
|
|
23
23
|
PkgExecutor2
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-dtpeyts6.js";
|
|
25
25
|
import {
|
|
26
26
|
DesktopServerStage
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-jfkh776h.js";
|
|
28
28
|
import {
|
|
29
29
|
LibraryScript
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-q4e18ne4.js";
|
|
31
31
|
import {
|
|
32
32
|
ApplicationRunner,
|
|
33
33
|
VerifyScope
|
|
34
|
-
} from "./index-
|
|
34
|
+
} from "./index-j2eqe3jk.js";
|
|
35
35
|
import {
|
|
36
36
|
PreviewChrome2,
|
|
37
37
|
PreviewView2,
|
|
38
38
|
stripAnsi
|
|
39
|
-
} from "./index-
|
|
39
|
+
} from "./index-rwgqba9p.js";
|
|
40
40
|
import {
|
|
41
41
|
formatSlicePlan
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-gh4brxzn.js";
|
|
43
43
|
import {
|
|
44
44
|
assertPlainName
|
|
45
45
|
} from "./index-va90m8nd.js";
|
|
@@ -642,11 +642,9 @@ class AppPreview {
|
|
|
642
642
|
if (unavailable)
|
|
643
643
|
throw new Error(unavailable);
|
|
644
644
|
const changed = options.changed ? await AppPreview.#changedPages(app) : { paths: [], skipped: [] };
|
|
645
|
-
if (options.changed && !changed.paths.length && !options.paths?.length)
|
|
646
|
-
throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
|
|
647
|
-
const paths = await AppPreview.pathsOf(app, options.paths ?? [], !!options.csr, changed.paths);
|
|
648
645
|
const port = await app.getDevPort();
|
|
649
646
|
const origin = `http://localhost:${port}`;
|
|
647
|
+
const plan = await AppPreview.planOf(app, options, changed, origin);
|
|
650
648
|
const root = app.workspace.workspaceRoot;
|
|
651
649
|
const previewDir = path2.join(ApplicationRunner.runtimeDirOf(app), "preview");
|
|
652
650
|
const started = await ApplicationRunner.answers(origin, app.name, root) ? null : await AppPreview.#startServer(app, port, previewDir);
|
|
@@ -661,6 +659,7 @@ class AppPreview {
|
|
|
661
659
|
serverLog: started ? path2.relative(root, started.logPath) : null,
|
|
662
660
|
logsRead: false,
|
|
663
661
|
skipped: changed.skipped,
|
|
662
|
+
notes: plan.notes,
|
|
664
663
|
pages: []
|
|
665
664
|
};
|
|
666
665
|
try {
|
|
@@ -670,7 +669,7 @@ class AppPreview {
|
|
|
670
669
|
const tail = await AppPreview.#tail(app, records);
|
|
671
670
|
report.logsRead = !!tail;
|
|
672
671
|
try {
|
|
673
|
-
for (const pagePath of paths) {
|
|
672
|
+
for (const pagePath of plan.paths) {
|
|
674
673
|
const mark = records.length;
|
|
675
674
|
const page = await AppPreview.#probe(origin, pagePath, {
|
|
676
675
|
engine,
|
|
@@ -696,22 +695,41 @@ class AppPreview {
|
|
|
696
695
|
started?.proc.unref();
|
|
697
696
|
}
|
|
698
697
|
}
|
|
699
|
-
static async
|
|
698
|
+
static async planOf(app, options, changed, origin) {
|
|
699
|
+
const typed = options.paths ?? [];
|
|
700
|
+
if (options.changed && !changed.paths.length && !typed.length)
|
|
701
|
+
throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
|
|
700
702
|
const { i18n, api } = await app.getConfig();
|
|
701
|
-
|
|
702
|
-
csr,
|
|
703
|
+
const { paths, asWritten } = AppPreview.#plan(typed, i18n, {
|
|
704
|
+
csr: !!options.csr,
|
|
703
705
|
apiPrefix: api.prefix,
|
|
704
706
|
publicDir: path2.join(app.cwdPath, "public"),
|
|
705
|
-
pages
|
|
707
|
+
pages: changed.paths
|
|
706
708
|
});
|
|
709
|
+
const dev = new URL(origin);
|
|
710
|
+
const isDevServer = (url) => url.protocol === dev.protocol && url.port === dev.port && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
711
|
+
const elsewhere = [...new Set(typed)].filter((raw) => /^https?:\/\//.test(raw) && !isDevServer(new URL(raw)));
|
|
712
|
+
const skipsBoot = [...new Set(asWritten)];
|
|
713
|
+
const notes = [
|
|
714
|
+
...elsewhere.length ? [
|
|
715
|
+
`${elsewhere.join(", ")} ${elsewhere.length === 1 ? "names another server: its path opens" : "name other servers: their paths open"} on ${origin}.`
|
|
716
|
+
] : [],
|
|
717
|
+
...options.csr && skipsBoot.length ? [
|
|
718
|
+
`--csr does not apply to ${skipsBoot.join(", ")}: ${skipsBoot.length === 1 ? "it opens" : "they open"} without the CSR boot.`
|
|
719
|
+
] : []
|
|
720
|
+
];
|
|
721
|
+
return { paths, notes };
|
|
707
722
|
}
|
|
708
|
-
static pagePaths(paths, i18n, {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
pages = []
|
|
713
|
-
}) {
|
|
723
|
+
static pagePaths(paths, i18n, options) {
|
|
724
|
+
return AppPreview.#plan(paths, i18n, options).paths;
|
|
725
|
+
}
|
|
726
|
+
static #plan(paths, i18n, { csr, apiPrefix = "/api", publicDir = null, pages = [] }) {
|
|
714
727
|
const keepsUnprefixed = i18n.localePrefix === "as-needed" && !csr;
|
|
728
|
+
const urlOf = (raw) => {
|
|
729
|
+
const url = /^https?:\/\//.test(raw) ? new URL(raw) : AppPreview.probeUrlOf("http://localhost", raw);
|
|
730
|
+
url.pathname = url.pathname.replace(/^\/{2,}/, "/");
|
|
731
|
+
return url;
|
|
732
|
+
};
|
|
715
733
|
const asPage = (url) => {
|
|
716
734
|
const [first] = url.pathname.split("/").filter(Boolean);
|
|
717
735
|
if (!keepsUnprefixed && (!first || !i18n.locales.includes(first)))
|
|
@@ -722,16 +740,24 @@ class AppPreview {
|
|
|
722
740
|
}
|
|
723
741
|
return `${url.pathname}${url.search}`;
|
|
724
742
|
};
|
|
725
|
-
const
|
|
743
|
+
const asWritten = [];
|
|
726
744
|
const typed = (paths.length || pages.length ? paths : ["/"]).map((raw) => {
|
|
727
|
-
if (/^https?:\/\//.test(raw)) {
|
|
728
|
-
const url = new URL(raw);
|
|
729
|
-
return `${url.pathname}${url.search}`;
|
|
730
|
-
}
|
|
731
745
|
const url = urlOf(raw);
|
|
732
|
-
|
|
746
|
+
if (!/^https?:\/\//.test(raw) && AppPreview.#isPagePath(url.pathname, i18n, { apiPrefix, publicDir }))
|
|
747
|
+
return asPage(url);
|
|
748
|
+
asWritten.push(raw);
|
|
749
|
+
return `${url.pathname}${url.search}`;
|
|
733
750
|
});
|
|
734
|
-
|
|
751
|
+
const opened = new Map;
|
|
752
|
+
for (const pagePath of [...typed, ...pages.map((page) => asPage(urlOf(page)))]) {
|
|
753
|
+
const key = pagePath.replace(/^([^?]*?)\/+(\?|$)/, "$1$2");
|
|
754
|
+
if (!opened.has(key))
|
|
755
|
+
opened.set(key, pagePath);
|
|
756
|
+
}
|
|
757
|
+
return { paths: [...opened.values()], asWritten };
|
|
758
|
+
}
|
|
759
|
+
static probeUrlOf(origin, pagePath) {
|
|
760
|
+
return new URL(`${origin}${pagePath.startsWith("/") ? "" : "/"}${pagePath}`);
|
|
735
761
|
}
|
|
736
762
|
static #serverFiles = new Set([
|
|
737
763
|
"/favicon.ico",
|
|
@@ -805,15 +831,21 @@ class AppPreview {
|
|
|
805
831
|
return { paths, skipped };
|
|
806
832
|
}
|
|
807
833
|
static screenshotName(pagePath) {
|
|
808
|
-
const url =
|
|
834
|
+
const url = AppPreview.probeUrlOf("http://localhost", pagePath);
|
|
809
835
|
const slugOf = (text) => text.replace(/[^\w-]/g, "_");
|
|
810
836
|
const hashOf = (text) => Bun.hash(text).toString(36).slice(0, 6);
|
|
811
|
-
const
|
|
812
|
-
const
|
|
813
|
-
const
|
|
837
|
+
const pathname = url.pathname.replace(/(.)\/+$/, "$1");
|
|
838
|
+
const plain = pathname.split("/").filter(Boolean).join("-");
|
|
839
|
+
const isPlain = /^(\/[a-z0-9]+)*$/.test(pathname) && plain.length <= 80;
|
|
840
|
+
const page = !plain ? "_index" : isPlain ? plain : `${slugOf(plain).slice(0, 80)}_${hashOf(pathname)}`;
|
|
841
|
+
const boot = ["csr=true", `akanMobileTarget=${AppPreview.csrTarget}`];
|
|
842
|
+
const pairs = url.search.slice(1).split("&").filter(Boolean);
|
|
843
|
+
const isBoot = boot.every((pair) => pairs.includes(pair));
|
|
844
|
+
const rest = isBoot ? pairs.filter((pair) => !boot.includes(pair)) : pairs;
|
|
845
|
+
const params = [...new URLSearchParams(rest.join("&"))];
|
|
814
846
|
const readable = slugOf(params.map(([key, value]) => `${key}-${value}`).join("-")).slice(0, 40);
|
|
815
|
-
const query =
|
|
816
|
-
return `${page}${query}${
|
|
847
|
+
const query = rest.length ? `.${readable}-${hashOf(rest.join("&"))}` : "";
|
|
848
|
+
return `${page}${query}${isBoot ? ".csr" : ""}.png`;
|
|
817
849
|
}
|
|
818
850
|
static attribute(page, records) {
|
|
819
851
|
const pathname = new URL(page.finalUrl).pathname;
|
|
@@ -842,6 +874,8 @@ class AppPreview {
|
|
|
842
874
|
lines.push("The app's log socket did not answer, so client and server errors are not shown.");
|
|
843
875
|
for (const reason of report.skipped)
|
|
844
876
|
lines.push(`Not opened: ${reason}.`);
|
|
877
|
+
for (const note of report.notes)
|
|
878
|
+
lines.push(`Note: ${note}`);
|
|
845
879
|
lines.push("");
|
|
846
880
|
for (const page of report.pages) {
|
|
847
881
|
const verdict = page.failed ? "FAIL" : page.domFindings.length || page.consoleWarnings.length ? "warn" : "ok";
|
|
@@ -879,7 +913,7 @@ class AppPreview {
|
|
|
879
913
|
screenshot,
|
|
880
914
|
timeoutMs
|
|
881
915
|
}) {
|
|
882
|
-
const url =
|
|
916
|
+
const url = AppPreview.probeUrlOf(origin, pagePath).toString();
|
|
883
917
|
const at = Date.now();
|
|
884
918
|
const page = {
|
|
885
919
|
path: pagePath,
|
|
@@ -1525,7 +1559,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1525
1559
|
throw new Error("No app selected to start");
|
|
1526
1560
|
const startedDatabase = dbup ? await this.#prepareSharedDatabase(apps) : false;
|
|
1527
1561
|
const supervisor = new DevSupervisor({ apps, mode, concurrency, open, write, shares });
|
|
1528
|
-
const view = mode === "tui" ? new (await import("./devTui-
|
|
1562
|
+
const view = mode === "tui" ? new (await import("./devTui-rf374y2w.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
|
|
1529
1563
|
await supervisor.run(view);
|
|
1530
1564
|
if (startedDatabase)
|
|
1531
1565
|
await this.#stopDatabase(workspace);
|
|
@@ -1689,7 +1723,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
|
|
|
1689
1723
|
await Promise.all(shares.map(async (share) => await share.close()));
|
|
1690
1724
|
}, "Abandoning the tunnel release; the shares expire on their own.");
|
|
1691
1725
|
await Promise.all(apps.map(async (app) => {
|
|
1692
|
-
const { TunnelShare } = await import("./TunnelShare-
|
|
1726
|
+
const { TunnelShare } = await import("./TunnelShare-6t4rwyc0.js");
|
|
1693
1727
|
const share = await TunnelShare.open(app, { workspace: app.workspace });
|
|
1694
1728
|
shares.push(share);
|
|
1695
1729
|
urls.set(app.name, share.url);
|