@akanjs/cli 3.1.2-rc.4 → 3.2.0-rc.0
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/{CodeAgent-z34p8m91.js → CodeAgent-h6g8dg3a.js} +2 -2
- package/{CodeTui-nvd9fk3g.js → CodeTui-n9gacepn.js} +1 -1
- package/README.ko.md +9 -0
- package/README.md +9 -0
- package/TunnelShare-k3ja4w9x.js +14 -0
- package/{agent.command-962mp3kg.js → agent.command-2f657613.js} +19 -17
- package/akanCode.js +2 -2
- package/{application.command-1nr0bqq1.js → application.command-yb8v177e.js} +35 -21
- package/{applicationBuildRunner-xy7hnfzq.js → applicationBuildRunner-sctcmkyx.js} +55 -16
- package/buildBatch.proc.js +7 -7
- package/{cloud.command-cj7b3m6y.js → cloud.command-et06ja22.js} +35 -18
- package/cloud.script-s6rbrwer.js +30 -0
- package/{code.command-asq7xrr6.js → code.command-7m67c7zc.js} +6 -6
- package/commandManifest.json +1 -1
- package/{context.command-fw4g2pw1.js → context.command-569z0rqf.js} +20 -19
- package/context.runner-ms8v1rxy.js +29 -0
- package/{guideline.command-43gfjsjv.js → guideline.command-gnv3e8p8.js} +2 -2
- package/guidelines/akanApi/akanApi.instruction.md +317 -0
- package/guidelines/conventions/rules/app.md +5 -5
- package/guidelines/conventions/rules/config.md +1 -1
- package/guidelines/conventions/rules/gates.md +10 -5
- package/incrementalBuilder.proc.js +69 -39
- package/{index-0tkj05cz.js → index-0fb3cpbt.js} +3 -3
- package/{index-6t7fkx73.js → index-1q1cjn8s.js} +21 -11
- package/{index-90q0w90q.js → index-3wjbhj2n.js} +1 -1
- package/{index-6zgt7zmx.js → index-48d5qsj3.js} +4 -4
- package/{index-z47rw9ez.js → index-5w9my9qe.js} +8 -8
- package/{index-qwe079ww.js → index-6wpaq392.js} +61 -15
- package/{index-kc871vpc.js → index-7xdpww43.js} +69 -12
- package/index-7y5yghjg.js +2969 -0
- package/{index-38patcx6.js → index-8g7tdsk4.js} +249 -696
- package/{index-kdswbvys.js → index-8pb9yvp8.js} +63 -21
- package/{index-hmj94es2.js → index-8ts9774g.js} +4 -4
- package/{index-r0q2ka2b.js → index-93ewzmp6.js} +43 -14
- package/{index-y0y0pnx8.js → index-9tbgb4d8.js} +1 -1
- package/index-abgh0jve.js +126 -0
- package/{index-t0hk1kxq.js → index-aj3ehkcx.js} +1 -1
- package/{index-demt944k.js → index-d4n1wmrz.js} +37 -4
- package/{index-sra1a5f8.js → index-drz9e84d.js} +22 -8
- package/{index-gfh90r3t.js → index-e3vmjtph.js} +2 -2
- package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
- package/{index-g0yds382.js → index-ed6ea0qp.js} +1 -1
- package/{index-ap6ac70m.js → index-fjr4d6yd.js} +444 -368
- package/index-hqrkqxx2.js +176 -0
- package/{index-jzpeny42.js → index-jdamtr7e.js} +3 -3
- package/{index-ampz4vgv.js → index-kpdv34rq.js} +4 -4
- package/{index-kc6ffq0s.js → index-ktb3wcqz.js} +73 -34
- package/{index-dcm66hss.js → index-mmym5xmb.js} +4 -2
- package/{index-8d9r465x.js → index-mqntfzv5.js} +2 -2
- package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
- package/index-p6hjwt2d.js +1668 -0
- package/{index-53h0053j.js → index-rc5fvqj2.js} +12 -14
- package/{index-r8t5sq7z.js → index-ryrm5z2c.js} +66 -19
- package/{index-jzz6ye8x.js → index-s2grpzef.js} +40 -8
- package/{index-38by07nw.js → index-sr5da35e.js} +32 -9
- package/{index-qev8p5wp.js → index-sy481q2x.js} +1 -1
- package/{index-ck64kxrn.js → index-thckcabc.js} +2 -2
- package/{index-wymcdsas.js → index-vkzfk7qt.js} +25 -23
- package/{index-vkpqe29t.js → index-w639tvkd.js} +24 -125
- package/index-ygdbn9jn.js +122 -0
- package/{index-w60zxxye.js → index-zpv14wpy.js} +3 -3
- package/{index-2yan1ajk.js → index-zxsygkda.js} +18 -9
- package/index.js +24 -23
- package/{library.command-zh29tjdd.js → library.command-1gp5qe3r.js} +3 -3
- package/{localRegistry.command-k9pn9ahj.js → localRegistry.command-v3g21rex.js} +25 -16
- package/{module.command-dgpqs9fz.js → module.command-4xz9he6h.js} +6 -6
- package/{package.command-1je4hsca.js → package.command-s7qpnn1g.js} +12 -3
- package/package.json +2 -2
- package/{page.command-cgsasanh.js → page.command-fan34c49.js} +3 -3
- package/{pipeline.command-tb46sa8v.js → pipeline.command-ph4fnn9w.js} +2 -2
- package/{primitive.command-bzsy23x5.js → primitive.command-3fqh8emf.js} +7 -7
- package/{projectTypecheck-h8rgaczy.js → projectTypecheck-vkb40hjc.js} +1 -1
- package/{quality.command-120m9h6v.js → quality.command-ecj6exsh.js} +15 -10
- package/{repair.command-6m4wd0qv.js → repair.command-fe9jw719.js} +6 -6
- package/{scalar.command-3dn5hsc6.js → scalar.command-cnvfhk0n.js} +5 -5
- package/skills/akan-debug/SKILL.md +2 -1
- package/skills/akan-page/SKILL.md +16 -7
- package/skills/akan-service/SKILL.md +48 -19
- package/{subspace.command-s8nyfqbn.js → subspace.command-yxtt3v3e.js} +8 -8
- package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
- package/templates/app/page/_index.tsx +4 -284
- package/templates/app/page/_layout.tsx +1 -26
- package/templates/app/page/styles.css.template +58 -318
- package/templates/appSample/page/_index.tsx +281 -0
- package/templates/appSample/page/_layout.tsx +55 -0
- package/templates/appSample/page/styles.css.template +327 -0
- package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
- package/templates/workspaceRoot/package.json.template +1 -12
- package/{tunnel.command-8mwrqkr3.js → tunnel.command-ggj38mqf.js} +7 -7
- package/{verify.command-2pspfy7k.js → verify.command-w9ttxkdz.js} +16 -14
- package/{workflow.command-7sy5vnsj.js → workflow.command-ss8devj0.js} +12 -12
- package/{workspace.command-x518tdv4.js → workspace.command-rw1p0xeq.js} +50 -38
- package/TunnelShare-jwbb50kz.js +0 -14
- package/cloud.script-8kr7qgfa.js +0 -27
- package/context.runner-p6m5cxk3.js +0 -28
- package/index-d894868w.js +0 -842
- package/index-re2kfscb.js +0 -1363
- /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
- /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
- /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
- /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
- /package/templates/{app → appSample}/public/logo.png +0 -0
- /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
- /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
AsyncDefaultExportDetector,
|
|
4
|
+
StoreBootstrap,
|
|
4
5
|
resolveSsrPageEntriesForApp
|
|
5
|
-
} from "./index-
|
|
6
|
+
} from "./index-sr5da35e.js";
|
|
6
7
|
import {
|
|
7
8
|
FileSys2
|
|
8
9
|
} from "./index-bns3wcpc.js";
|
|
@@ -110,10 +111,15 @@ class BarrelAnalyzer {
|
|
|
110
111
|
if (!isRelative(spec))
|
|
111
112
|
continue;
|
|
112
113
|
if (star) {
|
|
113
|
-
if (nsAs)
|
|
114
|
-
authoritative.delete(nsAs);
|
|
115
|
-
else
|
|
114
|
+
if (!nsAs)
|
|
116
115
|
starSpecs.push(spec);
|
|
116
|
+
else if (authoritative.has(nsAs)) {
|
|
117
|
+
attributed.add(nsAs);
|
|
118
|
+
const targetAbs = await this.#resolveRel(absFile, spec);
|
|
119
|
+
const targetSubpath = targetAbs ? this.#subpathFor(pkg, targetAbs) : null;
|
|
120
|
+
if (targetSubpath && !map.has(nsAs))
|
|
121
|
+
map.set(nsAs, { subpath: targetSubpath, originalName: nsAs, namespace: true });
|
|
122
|
+
}
|
|
117
123
|
continue;
|
|
118
124
|
}
|
|
119
125
|
if (namedList !== undefined) {
|
|
@@ -263,7 +269,7 @@ var createTsconfigPackageResolver = async (app) => {
|
|
|
263
269
|
continue;
|
|
264
270
|
const replPath = repl.endsWith("/*") ? repl.slice(0, -1) : repl;
|
|
265
271
|
const candidate = path2.resolve(app.workspace.workspaceRoot, replPath + suffix);
|
|
266
|
-
for (const ext of CANDIDATE_EXTS2) {
|
|
272
|
+
for (const ext of CANDIDATE_EXTS2.includes(path2.extname(candidate)) ? ["", ...CANDIDATE_EXTS2] : CANDIDATE_EXTS2) {
|
|
267
273
|
const file = `${candidate}${ext}`;
|
|
268
274
|
if (await Bun.file(file).exists()) {
|
|
269
275
|
const lastSlash = pkgName.lastIndexOf("/");
|
|
@@ -479,6 +485,7 @@ var rewriteSingleStatement = (stmt, map) => {
|
|
|
479
485
|
return null;
|
|
480
486
|
const remaining = [];
|
|
481
487
|
const rewrites = new Map;
|
|
488
|
+
const namespaceLines = [];
|
|
482
489
|
for (const item of clause.named) {
|
|
483
490
|
if (item.isType) {
|
|
484
491
|
remaining.push(item);
|
|
@@ -489,15 +496,17 @@ var rewriteSingleStatement = (stmt, map) => {
|
|
|
489
496
|
remaining.push(item);
|
|
490
497
|
continue;
|
|
491
498
|
}
|
|
499
|
+
if (target.namespace) {
|
|
500
|
+
namespaceLines.push(`import * as ${item.local} from "${target.subpath}";`);
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
492
503
|
const list = rewrites.get(target.subpath) ?? [];
|
|
493
504
|
list.push({ imported: target.originalName, local: item.local, isType: false });
|
|
494
505
|
rewrites.set(target.subpath, list);
|
|
495
506
|
}
|
|
496
|
-
if (rewrites.size === 0)
|
|
507
|
+
if (rewrites.size === 0 && namespaceLines.length === 0)
|
|
497
508
|
return null;
|
|
498
|
-
const lines = [];
|
|
499
|
-
if (shouldPreserveBarrelSideEffects(stmt.specifier))
|
|
500
|
-
lines.push(`import "${stmt.specifier}";`);
|
|
509
|
+
const lines = [...StoreBootstrap.ofClientBarrel(stmt.specifier, map) ?? []];
|
|
501
510
|
if (clause.defaultImport || remaining.length > 0) {
|
|
502
511
|
const parts = [];
|
|
503
512
|
if (clause.defaultImport)
|
|
@@ -509,10 +518,10 @@ var rewriteSingleStatement = (stmt, map) => {
|
|
|
509
518
|
for (const [subpath, items] of rewrites) {
|
|
510
519
|
lines.push(`import { ${items.map(serializeNamedItem).join(", ")} } from "${subpath}";`);
|
|
511
520
|
}
|
|
521
|
+
lines.push(...namespaceLines);
|
|
512
522
|
return lines.join(`
|
|
513
523
|
`);
|
|
514
524
|
};
|
|
515
|
-
var shouldPreserveBarrelSideEffects = (specifier) => /^@(apps|libs)\/[^/]+\/client$/.test(specifier);
|
|
516
525
|
var serializeNamedItem = (item) => {
|
|
517
526
|
const prefix = item.isType ? "type " : "";
|
|
518
527
|
if (item.imported === item.local)
|
|
@@ -521,6 +530,7 @@ var serializeNamedItem = (item) => {
|
|
|
521
530
|
};
|
|
522
531
|
|
|
523
532
|
// pkgs/@akanjs/devkit/frontendBuild/bundleDefine.ts
|
|
533
|
+
var bundleConditions = (command) => command === "build" ? ["production"] : [];
|
|
524
534
|
var bundleDefine = (app, command, renderEnv) => {
|
|
525
535
|
const nodeEnv = command === "build" ? "production" : "development";
|
|
526
536
|
return {
|
|
@@ -1172,4 +1182,4 @@ class PagesBundleBuilder {
|
|
|
1172
1182
|
}
|
|
1173
1183
|
}
|
|
1174
1184
|
|
|
1175
|
-
export { loaderFor, BarrelAnalyzer, createBarrelImportsPlugin, createTsconfigPackageResolver, rewriteBarrelImports, bundleDefine, CsrEntryFiles, toClientReferencePath, scanUseClientExports, CsrDevPaths, PagesEntrySourceGenerator, ServerGraphFile, PagesBundleBuilder };
|
|
1185
|
+
export { loaderFor, BarrelAnalyzer, createBarrelImportsPlugin, createTsconfigPackageResolver, rewriteBarrelImports, bundleConditions, bundleDefine, CsrEntryFiles, toClientReferencePath, scanUseClientExports, CsrDevPaths, PagesEntrySourceGenerator, ServerGraphFile, PagesBundleBuilder };
|
|
@@ -157,7 +157,7 @@ class SubagentPool2 {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
async#run(id, kind, prompt, signal) {
|
|
160
|
-
const { CodeAgent } = await import("./CodeAgent-
|
|
160
|
+
const { CodeAgent } = await import("./CodeAgent-h6g8dg3a.js");
|
|
161
161
|
const budget = this.#options.parent.tools.subagent;
|
|
162
162
|
const child = SubagentPool2.childOf(this.#options.parent, kind);
|
|
163
163
|
const model = this.#options.model?.();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
script
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-93ewzmp6.js";
|
|
5
5
|
import {
|
|
6
6
|
AppExecutor,
|
|
7
7
|
LibExecutor,
|
|
8
8
|
ModuleExecutor
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-sr5da35e.js";
|
|
10
10
|
import {
|
|
11
11
|
InteractionScaffold,
|
|
12
12
|
workflowStatus,
|
|
@@ -45,10 +45,10 @@ import {
|
|
|
45
45
|
addFieldUiPolicyForType,
|
|
46
46
|
KeyRename,
|
|
47
47
|
MutationScaffold
|
|
48
|
-
} from "./index-
|
|
48
|
+
} from "./index-8pb9yvp8.js";
|
|
49
49
|
import {
|
|
50
50
|
ModuleScript
|
|
51
|
-
} from "./index-
|
|
51
|
+
} from "./index-8ts9774g.js";
|
|
52
52
|
|
|
53
53
|
// pkgs/@akanjs/cli/primitive/primitive.script.ts
|
|
54
54
|
import { capitalize, lowerlize } from "akanjs/common";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
script,
|
|
5
5
|
ExitCodeError,
|
|
6
6
|
markCliErrorPrinted
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-93ewzmp6.js";
|
|
8
8
|
import {
|
|
9
9
|
AGENT_BLOCK_START,
|
|
10
10
|
AGENT_BLOCK_END,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
CLAUDE_COMMENT_RULE,
|
|
16
16
|
AppExecutor,
|
|
17
17
|
LibExecutor
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-sr5da35e.js";
|
|
19
19
|
import {
|
|
20
20
|
akanCodePaths2
|
|
21
21
|
} from "./index-35j83zkd.js";
|
|
@@ -29,19 +29,19 @@ import {
|
|
|
29
29
|
} from "./index-hj6w4ka1.js";
|
|
30
30
|
import {
|
|
31
31
|
AkanContextAnalyzer
|
|
32
|
-
} from "./index-
|
|
32
|
+
} from "./index-thckcabc.js";
|
|
33
33
|
import {
|
|
34
34
|
ApplicationRunner,
|
|
35
35
|
VerifyScope
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-ktb3wcqz.js";
|
|
37
37
|
import {
|
|
38
38
|
WorkspaceRunner
|
|
39
|
-
} from "./index-
|
|
39
|
+
} from "./index-fjr4d6yd.js";
|
|
40
40
|
import {
|
|
41
41
|
VerifyComments,
|
|
42
42
|
VerifyPipeline,
|
|
43
43
|
VerifyReport
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-s2grpzef.js";
|
|
45
45
|
|
|
46
46
|
// pkgs/@akanjs/cli/agent/agent.script.ts
|
|
47
47
|
import { Logger as Logger3 } from "akanjs/common";
|
|
@@ -65,7 +65,7 @@ class AgentAssets {
|
|
|
65
65
|
"akan-scaffold": ["workspaceRecipes"],
|
|
66
66
|
"akan-module": ["moduleOverview", "modelConstant", "modelDictionary", "fieldRule"],
|
|
67
67
|
"akan-scalar": ["scalarModule", "scalarConstant", "scalarDictionary"],
|
|
68
|
-
"akan-service": ["modelService", "modelSignal", "modelDocument"],
|
|
68
|
+
"akan-service": ["modelService", "modelSignal", "modelDocument", "akanApi"],
|
|
69
69
|
"akan-store": ["modelStore"],
|
|
70
70
|
"akan-ui": [
|
|
71
71
|
"ssrRule",
|
|
@@ -82,7 +82,7 @@ class AgentAssets {
|
|
|
82
82
|
"akan-err": [],
|
|
83
83
|
"akan-deps": [],
|
|
84
84
|
"akan-debug": [],
|
|
85
|
-
"akan-page": ["pageRule"],
|
|
85
|
+
"akan-page": ["pageRule", "akanApi"],
|
|
86
86
|
"akan-query": ["queryRule"],
|
|
87
87
|
"akan-transport": ["transportRule"],
|
|
88
88
|
"akan-runtime": ["runtimeRule"],
|
|
@@ -6,25 +6,26 @@ import {
|
|
|
6
6
|
CloudApi,
|
|
7
7
|
CloudUpdates,
|
|
8
8
|
PipelineSecrets
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-drz9e84d.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveMobileTargets
|
|
12
12
|
} from "./index-m9jj544v.js";
|
|
13
13
|
import {
|
|
14
14
|
WorkspaceExecutor,
|
|
15
15
|
AppExecutor
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-sr5da35e.js";
|
|
17
17
|
import {
|
|
18
18
|
NativeApp
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-zpv14wpy.js";
|
|
20
20
|
import {
|
|
21
21
|
runner,
|
|
22
22
|
assertPromptable
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-93ewzmp6.js";
|
|
24
24
|
import {
|
|
25
25
|
getNpmRegistryUrl,
|
|
26
|
+
getPublishedVersions,
|
|
26
27
|
getLatestPackageVersion
|
|
27
|
-
} from "./index-
|
|
28
|
+
} from "./index-ny2k80mv.js";
|
|
28
29
|
import {
|
|
29
30
|
SubspaceConfig
|
|
30
31
|
} from "./index-h7hehkw6.js";
|
|
@@ -993,7 +994,7 @@ class CloudRunner extends runner("cloud") {
|
|
|
993
994
|
}
|
|
994
995
|
async login(host, workspace) {
|
|
995
996
|
const cloudApi = await CloudApi.fromHost(workspace, host);
|
|
996
|
-
const signedIn = await cloudApi.getRemoteSelf().catch(() => null);
|
|
997
|
+
const signedIn = cloudApi.needsSignIn ? null : await cloudApi.getRemoteSelf().catch(() => null);
|
|
997
998
|
if (signedIn) {
|
|
998
999
|
Logger3.rawLog(chalk3.green(`
|
|
999
1000
|
\u2713 Already logged in akan cloud as ${signedIn.nickname}
|
|
@@ -1109,18 +1110,28 @@ ${run.format(results)}
|
|
|
1109
1110
|
const isPrivate = await Promise.all(pkgs.map(async (pkg) => (await workspace.readJson(`pkgs/${pkg}/package.json`)).private));
|
|
1110
1111
|
return pkgs.filter((_, idx) => isPrivate[idx] !== true);
|
|
1111
1112
|
}
|
|
1112
|
-
async deployAkan(workspace, akanPkgs, { registryUrl, confirmPublish = true, tag: distTag } = {}) {
|
|
1113
|
+
async deployAkan(workspace, akanPkgs, { registryUrl, confirmPublish = true, npmLogin = true, tag: distTag, prerelease, packTo } = {}) {
|
|
1114
|
+
if (prerelease != null && (prerelease === "latest" || !/^[a-z][a-z0-9-]*$/.test(prerelease)))
|
|
1115
|
+
throw new Error(`--prerelease takes a lowercase identifier other than latest, such as rc, not "${prerelease}"`);
|
|
1113
1116
|
const registry = registryUrl ? getNpmRegistryUrl(registryUrl) : undefined;
|
|
1114
1117
|
const akanPackageJson = await workspace.readJson("pkgs/akanjs/package.json");
|
|
1115
1118
|
const [majorVersion, minorVersion, patchVersion, devPatchVersion] = akanPackageJson.version.split(".");
|
|
1116
|
-
const
|
|
1117
|
-
const
|
|
1118
|
-
const
|
|
1119
|
-
const
|
|
1120
|
-
const
|
|
1119
|
+
const releaseVersion = `${majorVersion}.${minorVersion}.${patchVersion.split("-")[0]}`;
|
|
1120
|
+
const isOfficialRelease = !devPatchVersion && !prerelease;
|
|
1121
|
+
const prereleasePrefix = prerelease ? `${releaseVersion}-${prerelease}` : `${majorVersion}.${minorVersion}.${patchVersion}`;
|
|
1122
|
+
const targetVersionPrefix = isOfficialRelease ? `${majorVersion}.${minorVersion}` : prereleasePrefix;
|
|
1123
|
+
const tag = distTag ?? (isOfficialRelease ? "latest" : prerelease ?? patchVersion.split("-").at(1) ?? "dev");
|
|
1124
|
+
const published = await Promise.all(akanPkgs.map((library) => getPublishedVersions(library, registry)));
|
|
1125
|
+
if (prerelease) {
|
|
1126
|
+
const released = published.flatMap((entry) => entry?.tags.latest ?? []).sort(Bun.semver.order).at(-1);
|
|
1127
|
+
if (released && Bun.semver.order(releaseVersion, released) <= 0)
|
|
1128
|
+
throw new Error(`akanjs ${released} is already released, so ${targetVersionPrefix}.N would sort below it; run \`changeset version\` first so the packages carry the next release`);
|
|
1129
|
+
}
|
|
1130
|
+
const latestPatch = Math.max(-1, ...published.flatMap((entry) => entry ? [...entry.versions, ...Object.values(entry.tags)] : []).filter((version) => version.startsWith(`${targetVersionPrefix}.`)).map((version) => version.slice(targetVersionPrefix.length + 1)).filter((patch) => /^\d+$/.test(patch)).map(Number));
|
|
1121
1131
|
const nextVersion = `${targetVersionPrefix}.${latestPatch + 1}`;
|
|
1122
|
-
Logger3.info(`
|
|
1132
|
+
Logger3.info(`Highest published ${targetVersionPrefix}.N: ${latestPatch < 0 ? "none" : latestPatch}`);
|
|
1123
1133
|
Logger3.info(`Next version of akanjs: ${nextVersion}`);
|
|
1134
|
+
const internalDependencies = new Map;
|
|
1124
1135
|
for (const library of akanPkgs) {
|
|
1125
1136
|
const packageJson = await workspace.readJson(`pkgs/${library}/package.json`);
|
|
1126
1137
|
const newPackageJson = this.#normalizeAkanPackageJson(packageJson, library, nextVersion);
|
|
@@ -1128,6 +1139,12 @@ ${run.format(results)}
|
|
|
1128
1139
|
const distPackageJson = await workspace.readJson(`dist/pkgs/${library}/package.json`);
|
|
1129
1140
|
const newDistPackageJson = this.#normalizeAkanPackageJson(distPackageJson, library, nextVersion);
|
|
1130
1141
|
await workspace.writeJson(`dist/pkgs/${library}/package.json`, newDistPackageJson);
|
|
1142
|
+
internalDependencies.set(library, Object.keys({ ...newDistPackageJson.dependencies, ...newDistPackageJson.peerDependencies }).filter((dep) => dep !== library && akanPkgs.includes(dep)));
|
|
1143
|
+
}
|
|
1144
|
+
const publishOrder = this.#dependenciesFirst(akanPkgs, internalDependencies);
|
|
1145
|
+
if (packTo) {
|
|
1146
|
+
await this.#packForPublish(workspace, publishOrder, { packTo, tag, version: nextVersion });
|
|
1147
|
+
return;
|
|
1131
1148
|
}
|
|
1132
1149
|
if (confirmPublish)
|
|
1133
1150
|
assertPromptable(`Publishing ${akanPkgs.join(", ")}@${nextVersion} asks for a confirmation`, {
|
|
@@ -1137,12 +1154,12 @@ ${run.format(results)}
|
|
|
1137
1154
|
Logger3.error("Deployment cancelled");
|
|
1138
1155
|
return;
|
|
1139
1156
|
}
|
|
1140
|
-
if (!registry) {
|
|
1157
|
+
if (!registry && npmLogin) {
|
|
1141
1158
|
Logger3.info("Logging in to npm...");
|
|
1142
1159
|
await workspace.spawn("npm", ["login"], { stdio: "inherit" });
|
|
1143
1160
|
Logger3.info("Logged in to npm");
|
|
1144
1161
|
}
|
|
1145
|
-
for (const library of
|
|
1162
|
+
for (const library of publishOrder) {
|
|
1146
1163
|
Logger3.info(`Publishing ${library}@${nextVersion} to ${registry ?? "npm"}...`);
|
|
1147
1164
|
await workspace.spawn("npm", ["publish", "--tag", tag, ...this.#getRegistryArgs(registry), ...this.#getLocalRegistryAuthArgs(registry)], {
|
|
1148
1165
|
cwd: path8.join(workspace.workspaceRoot, "dist/pkgs", library),
|
|
@@ -1153,6 +1170,35 @@ ${run.format(results)}
|
|
|
1153
1170
|
}
|
|
1154
1171
|
Logger3.info(`All libraries are published to ${registry ?? "npm"}`);
|
|
1155
1172
|
}
|
|
1173
|
+
#dependenciesFirst(libraries, dependencies) {
|
|
1174
|
+
const ordered = [];
|
|
1175
|
+
const visiting = new Set;
|
|
1176
|
+
const visit = (library) => {
|
|
1177
|
+
if (ordered.includes(library) || visiting.has(library))
|
|
1178
|
+
return;
|
|
1179
|
+
visiting.add(library);
|
|
1180
|
+
for (const dependency of dependencies.get(library) ?? [])
|
|
1181
|
+
visit(dependency);
|
|
1182
|
+
ordered.push(library);
|
|
1183
|
+
};
|
|
1184
|
+
for (const library of libraries)
|
|
1185
|
+
visit(library);
|
|
1186
|
+
return ordered;
|
|
1187
|
+
}
|
|
1188
|
+
async#packForPublish(workspace, libraries, { packTo, tag, version }) {
|
|
1189
|
+
const packDir = path8.resolve(workspace.workspaceRoot, packTo);
|
|
1190
|
+
await workspace.mkdir(packDir);
|
|
1191
|
+
const tarballs = [];
|
|
1192
|
+
for (const library of libraries) {
|
|
1193
|
+
const output = await workspace.spawn("npm", ["pack", "--json", "--pack-destination", packDir], {
|
|
1194
|
+
cwd: path8.join(workspace.workspaceRoot, "dist/pkgs", library)
|
|
1195
|
+
});
|
|
1196
|
+
const [{ filename }] = JSON.parse(output);
|
|
1197
|
+
tarballs.push(filename);
|
|
1198
|
+
}
|
|
1199
|
+
await workspace.writeJson(path8.join(packDir, "publish.json"), { version, tag, tarballs });
|
|
1200
|
+
Logger3.info(`Packed ${libraries.join(", ")}@${version} for \`npm publish --tag ${tag}\` into ${packDir}`);
|
|
1201
|
+
}
|
|
1156
1202
|
async update(workspace, tag = "latest", { registryUrl } = {}) {
|
|
1157
1203
|
const registry = registryUrl ? getNpmRegistryUrl(registryUrl) : undefined;
|
|
1158
1204
|
const registryArgs = this.#getRegistryArgs(registry);
|
|
@@ -5,13 +5,14 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
SOURCE_EXTS,
|
|
7
7
|
WatchRootResolver
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-p6hjwt2d.js";
|
|
9
9
|
import {
|
|
10
10
|
loaderFor,
|
|
11
11
|
BarrelAnalyzer,
|
|
12
12
|
createBarrelImportsPlugin,
|
|
13
13
|
createTsconfigPackageResolver,
|
|
14
14
|
rewriteBarrelImports,
|
|
15
|
+
bundleConditions,
|
|
15
16
|
bundleDefine,
|
|
16
17
|
CsrEntryFiles,
|
|
17
18
|
toClientReferencePath,
|
|
@@ -19,11 +20,12 @@ import {
|
|
|
19
20
|
CsrDevPaths,
|
|
20
21
|
PagesEntrySourceGenerator,
|
|
21
22
|
PagesBundleBuilder
|
|
22
|
-
} from "./index-
|
|
23
|
+
} from "./index-1q1cjn8s.js";
|
|
23
24
|
import {
|
|
24
25
|
AsyncDefaultExportDetector,
|
|
26
|
+
StoreBootstrap,
|
|
25
27
|
resolveSsrPageEntriesForApp
|
|
26
|
-
} from "./index-
|
|
28
|
+
} from "./index-sr5da35e.js";
|
|
27
29
|
|
|
28
30
|
// pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
|
|
29
31
|
import { readdir, readFile, stat } from "fs/promises";
|
|
@@ -1329,6 +1331,7 @@ class ClientEntriesBundler {
|
|
|
1329
1331
|
#external;
|
|
1330
1332
|
#externalSubpaths;
|
|
1331
1333
|
#externalAliases;
|
|
1334
|
+
#entryExports;
|
|
1332
1335
|
#command;
|
|
1333
1336
|
#target;
|
|
1334
1337
|
#outputSubdir;
|
|
@@ -1340,9 +1343,11 @@ class ClientEntriesBundler {
|
|
|
1340
1343
|
#entryUrlsByAbsPath = new Map;
|
|
1341
1344
|
#entryOutputAbsByAbsPath = new Map;
|
|
1342
1345
|
#entryDepsByAbsPath = new Map;
|
|
1346
|
+
#entryChunkUrlsByAbsPath = new Map;
|
|
1343
1347
|
#clientReferenceIdByAbsPath = new Map;
|
|
1344
1348
|
#opaqueEntries = null;
|
|
1345
1349
|
#metafileOutputsByAbs = new Map;
|
|
1350
|
+
#metafileInputs = {};
|
|
1346
1351
|
constructor(options) {
|
|
1347
1352
|
this.#app = options.app;
|
|
1348
1353
|
this.#entries = options.entries;
|
|
@@ -1350,6 +1355,7 @@ class ClientEntriesBundler {
|
|
|
1350
1355
|
this.#external = options.external ?? [];
|
|
1351
1356
|
this.#externalSubpaths = options.externalSubpaths ?? [];
|
|
1352
1357
|
this.#externalAliases = options.externalAliases ?? {};
|
|
1358
|
+
this.#entryExports = options.entryExports ?? {};
|
|
1353
1359
|
this.#command = options.command ?? "start";
|
|
1354
1360
|
this.#target = options.target ?? "browser";
|
|
1355
1361
|
this.#outputSubdir = options.outputSubdir ?? "client";
|
|
@@ -1370,6 +1376,7 @@ class ClientEntriesBundler {
|
|
|
1370
1376
|
naming: CLIENT_BUNDLE_NAMING,
|
|
1371
1377
|
metafile: true,
|
|
1372
1378
|
define: bundleDefine(this.#app, this.#command, "ssr"),
|
|
1379
|
+
conditions: bundleConditions(this.#command),
|
|
1373
1380
|
minify: this.#command === "build",
|
|
1374
1381
|
optimizeImports: akanConfig.optimizeImports,
|
|
1375
1382
|
reactFastRefresh: this.#command === "start" && this.#outputSubdir === "client" && this.#reactFastRefresh,
|
|
@@ -1382,14 +1389,18 @@ class ClientEntriesBundler {
|
|
|
1382
1389
|
if (!metafile)
|
|
1383
1390
|
throw new Error("[ClientEntriesBundler] metafile is missing");
|
|
1384
1391
|
this.#metafileOutputsByAbs = new Map(Object.entries(metafile.outputs).map(([k, v]) => [this.#absFromOutdir(k), v]));
|
|
1392
|
+
this.#metafileInputs = metafile.inputs;
|
|
1385
1393
|
for (const artifact of result.outputs.filter((a) => a.kind === "entry-point"))
|
|
1386
1394
|
this.#addEntryArtifact(artifact.path);
|
|
1395
|
+
this.#assertNarrowedExports();
|
|
1387
1396
|
return {
|
|
1388
1397
|
manifest: this.#manifest,
|
|
1389
1398
|
ssrManifest: this.#ssrManifest,
|
|
1390
1399
|
entryUrlsByAbsPath: this.#entryUrlsByAbsPath,
|
|
1391
1400
|
entryOutputAbsByAbsPath: this.#entryOutputAbsByAbsPath,
|
|
1392
1401
|
entryDepsByAbsPath: this.#entryDepsByAbsPath,
|
|
1402
|
+
entryChunkUrlsByAbsPath: this.#entryChunkUrlsByAbsPath,
|
|
1403
|
+
externalsByChunkUrl: this.#collectExternalsByChunkUrl(),
|
|
1393
1404
|
clientReferenceIdByAbsPath: this.#clientReferenceIdByAbsPath
|
|
1394
1405
|
};
|
|
1395
1406
|
}
|
|
@@ -1399,11 +1410,13 @@ class ClientEntriesBundler {
|
|
|
1399
1410
|
const originalByAlias = new Map;
|
|
1400
1411
|
const aliasedEntries = await Promise.all(this.#entries.map(async (entry) => {
|
|
1401
1412
|
const absEntry = path5.resolve(entry);
|
|
1402
|
-
const
|
|
1413
|
+
const narrowed = this.#entryExports[absEntry];
|
|
1414
|
+
const key = `${this.#app.name}
|
|
1403
1415
|
${this.#outputSubdir}
|
|
1404
|
-
${absEntry}`
|
|
1405
|
-
|
|
1406
|
-
|
|
1416
|
+
${absEntry}${narrowed ? `
|
|
1417
|
+
narrowed` : ""}`;
|
|
1418
|
+
const aliasPath = path5.join(aliasDir, `${Bun.hash(key).toString(36)}.tsx`);
|
|
1419
|
+
await Bun.write(aliasPath, narrowed ? ClientEntriesBundler.narrowedAliasSource(absEntry, narrowed) : this.#createOpaqueEntryAliasSource(absEntry, await this.#scanEntryExportNames(absEntry)));
|
|
1407
1420
|
originalByAlias.set(path5.resolve(aliasPath), absEntry);
|
|
1408
1421
|
return aliasPath;
|
|
1409
1422
|
}));
|
|
@@ -1422,6 +1435,23 @@ ${absEntry}`).toString(36);
|
|
|
1422
1435
|
`)}
|
|
1423
1436
|
`;
|
|
1424
1437
|
}
|
|
1438
|
+
static narrowedAliasSource(absEntry, names) {
|
|
1439
|
+
const list = names.length > 0 ? `{ ${names.join(", ")} }` : "{}";
|
|
1440
|
+
return `export ${list} from ${JSON.stringify(path5.resolve(absEntry))};
|
|
1441
|
+
`;
|
|
1442
|
+
}
|
|
1443
|
+
#assertNarrowedExports() {
|
|
1444
|
+
const missing = Object.entries(this.#entryExports).flatMap(([absEntry, names = []]) => {
|
|
1445
|
+
const absOut = this.#entryOutputAbsByAbsPath.get(absEntry);
|
|
1446
|
+
if (!absOut)
|
|
1447
|
+
return [`${path5.basename(absEntry)}: no output`];
|
|
1448
|
+
const exported = new Set(this.#metafileOutputsByAbs.get(absOut)?.exports);
|
|
1449
|
+
const absent = names.filter((name) => !exported.has(name));
|
|
1450
|
+
return absent.length > 0 ? [`${path5.basename(absEntry)}: ${absent.join(", ")}`] : [];
|
|
1451
|
+
});
|
|
1452
|
+
if (missing.length > 0)
|
|
1453
|
+
throw new Error(`[ClientEntriesBundler] client code imports names its vendor does not export (${missing.join("; ")})`);
|
|
1454
|
+
}
|
|
1425
1455
|
async#scanEntryExportNames(absEntry) {
|
|
1426
1456
|
return scanUseClientExports(await Bun.file(absEntry).text(), absEntry, this.#app.workspace.workspaceRoot);
|
|
1427
1457
|
}
|
|
@@ -1509,6 +1539,22 @@ ${absEntry}`).toString(36);
|
|
|
1509
1539
|
}
|
|
1510
1540
|
return urls;
|
|
1511
1541
|
}
|
|
1542
|
+
#collectExternalsByChunkUrl() {
|
|
1543
|
+
const externalsByChunkUrl = new Map;
|
|
1544
|
+
if (this.#command !== "build" || this.#target !== "browser")
|
|
1545
|
+
return externalsByChunkUrl;
|
|
1546
|
+
for (const [absOut, info] of this.#metafileOutputsByAbs) {
|
|
1547
|
+
if (!absOut.endsWith(".js"))
|
|
1548
|
+
continue;
|
|
1549
|
+
const externals = new Set;
|
|
1550
|
+
for (const input of Object.keys(info.inputs ?? {}))
|
|
1551
|
+
for (const imp of this.#metafileInputs[input]?.imports ?? [])
|
|
1552
|
+
if (imp.external && imp.kind !== "dynamic-import" && !/^[./]/.test(imp.path))
|
|
1553
|
+
externals.add(imp.path);
|
|
1554
|
+
externalsByChunkUrl.set(this.#toServeUrl(absOut), [...externals].sort());
|
|
1555
|
+
}
|
|
1556
|
+
return externalsByChunkUrl;
|
|
1557
|
+
}
|
|
1512
1558
|
#collectClientDeps(absOutPath, visited = new Set) {
|
|
1513
1559
|
if (visited.has(absOutPath))
|
|
1514
1560
|
return new Set;
|
|
@@ -1548,6 +1594,7 @@ ${absEntry}`).toString(36);
|
|
|
1548
1594
|
this.#entryUrlsByAbsPath.set(entryPointAbs, entryUrl);
|
|
1549
1595
|
this.#entryOutputAbsByAbsPath.set(entryPointAbs, absOut);
|
|
1550
1596
|
this.#entryDepsByAbsPath.set(entryPointAbs, [...this.#collectClientDeps(absOut)].sort());
|
|
1597
|
+
this.#entryChunkUrlsByAbsPath.set(entryPointAbs, chunkUrls);
|
|
1551
1598
|
const clientReferenceId = toClientReferencePath(entryPointAbs, this.#app.workspace.workspaceRoot);
|
|
1552
1599
|
this.#clientReferenceIdByAbsPath.set(entryPointAbs, clientReferenceId);
|
|
1553
1600
|
const flatChunks = [];
|
|
@@ -1575,6 +1622,16 @@ var VENDOR_SPECIFIERS = [
|
|
|
1575
1622
|
"scheduler",
|
|
1576
1623
|
"react-server-dom-webpack/client.browser",
|
|
1577
1624
|
"akanjs/store",
|
|
1625
|
+
"akanjs/store/agent",
|
|
1626
|
+
"akanjs/base",
|
|
1627
|
+
"akanjs/common",
|
|
1628
|
+
"akanjs/constant",
|
|
1629
|
+
"akanjs/fetch",
|
|
1630
|
+
"tailwind-merge"
|
|
1631
|
+
];
|
|
1632
|
+
var NARROWABLE_VENDOR_SPECIFIERS = [
|
|
1633
|
+
"akanjs/store",
|
|
1634
|
+
"akanjs/store/agent",
|
|
1578
1635
|
"akanjs/base",
|
|
1579
1636
|
"akanjs/common",
|
|
1580
1637
|
"akanjs/constant",
|
|
@@ -1662,7 +1719,8 @@ class RouteClientBuilder {
|
|
|
1662
1719
|
discoveredEntries: discovered,
|
|
1663
1720
|
clientDeps: [...clientDeps].sort(),
|
|
1664
1721
|
clientDepsByEntry,
|
|
1665
|
-
...registry ? { registryEntries: [...acceptedEntries].sort() } : {}
|
|
1722
|
+
...registry ? { registryEntries: [...acceptedEntries].sort() } : {},
|
|
1723
|
+
...browserBundle ? { externalsByChunkUrl: Object.fromEntries(browserBundle.externalsByChunkUrl) } : {}
|
|
1666
1724
|
};
|
|
1667
1725
|
}
|
|
1668
1726
|
static #registryRow(paths, entry, row) {
|
|
@@ -1813,7 +1871,7 @@ ${declared.map(({ name }) => `export default ${name};`).join(`
|
|
|
1813
1871
|
const originalEntry = JSON.stringify(path6.resolve(args.originalEntry));
|
|
1814
1872
|
const namedExports = args.exportNames.filter((name) => name !== "default");
|
|
1815
1873
|
const lines = [
|
|
1816
|
-
|
|
1874
|
+
...StoreBootstrap.importLines(args.appName),
|
|
1817
1875
|
...namedExports.length > 0 ? [`export { ${namedExports.join(", ")} } from ${originalEntry};`] : []
|
|
1818
1876
|
];
|
|
1819
1877
|
if (args.exportNames.includes("default"))
|
|
@@ -3191,8 +3249,7 @@ class SsrDevBundler extends DevRegistryBundler {
|
|
|
3191
3249
|
await mkdir5(this.entryDir, { recursive: true });
|
|
3192
3250
|
const file = path15.join(this.entryDir, "bootstrap.ts");
|
|
3193
3251
|
const hasStore = await Bun.file(path15.join(this.app.cwdPath, "lib", "st.ts")).exists();
|
|
3194
|
-
const source = hasStore ?
|
|
3195
|
-
` : `export {};
|
|
3252
|
+
const source = hasStore ? StoreBootstrap.source(this.app.name) : `export {};
|
|
3196
3253
|
`;
|
|
3197
3254
|
const unchanged = await Bun.file(file).exists() && await Bun.file(file).text() === source;
|
|
3198
3255
|
if (!unchanged)
|
|
@@ -3216,4 +3273,4 @@ class SsrDevBundler extends DevRegistryBundler {
|
|
|
3216
3273
|
}
|
|
3217
3274
|
}
|
|
3218
3275
|
|
|
3219
|
-
export { computeRouteSeedIndex, saveRouteSeedIndex, GraphClientEntryDiscovery, ClientEntriesBundler, VENDOR_SPECIFIERS, RouteClientBuilder, AutoImportSync, CsrDevPatcher, CsrDevBundler, DevChangePlanner, DevGeneratedIndexSync, SsrDevBundler };
|
|
3276
|
+
export { computeRouteSeedIndex, saveRouteSeedIndex, GraphClientEntryDiscovery, ClientEntriesBundler, VENDOR_SPECIFIERS, NARROWABLE_VENDOR_SPECIFIERS, RouteClientBuilder, AutoImportSync, CsrDevPatcher, CsrDevBundler, DevChangePlanner, DevGeneratedIndexSync, SsrDevBundler };
|