@akanjs/devkit 2.3.3-rc.0 → 2.3.3-rc.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "2.3.3-rc.
|
|
3
|
+
"version": "2.3.3-rc.1",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@langchain/openai": "^1.4.6",
|
|
33
33
|
"@tailwindcss/node": "^4.3.0",
|
|
34
34
|
"@trapezedev/project": "^7.1.4",
|
|
35
|
-
"akanjs": "2.3.3-rc.
|
|
35
|
+
"akanjs": "2.3.3-rc.1",
|
|
36
36
|
"chalk": "^5.6.2",
|
|
37
37
|
"commander": "^14.0.3",
|
|
38
38
|
"daisyui": "^5.5.20",
|
|
@@ -71,6 +71,65 @@ describe("createExternalizeFrameworkPlugin", () => {
|
|
|
71
71
|
expect(output).toContain("react/jsx-runtime");
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
+
test("externalizes optional backend dependencies reached through bundled akanjs/server sources", async () => {
|
|
75
|
+
const root = await makeTempRoot();
|
|
76
|
+
const entry = path.join(root, "entry.ts");
|
|
77
|
+
const outdir = path.join(root, "out");
|
|
78
|
+
await write(
|
|
79
|
+
entry,
|
|
80
|
+
[
|
|
81
|
+
'import { optionMarker, redisLoader } from "akanjs/server";',
|
|
82
|
+
"export const marker = optionMarker;",
|
|
83
|
+
"export const loader = redisLoader;",
|
|
84
|
+
"",
|
|
85
|
+
].join("\n"),
|
|
86
|
+
);
|
|
87
|
+
await write(
|
|
88
|
+
path.join(root, "pkgs/akanjs/server/index.ts"),
|
|
89
|
+
[
|
|
90
|
+
'import { loadRedis } from "akanjs/service";',
|
|
91
|
+
'export const optionMarker = "akan-option";',
|
|
92
|
+
"export const redisLoader = loadRedis;",
|
|
93
|
+
"",
|
|
94
|
+
].join("\n"),
|
|
95
|
+
);
|
|
96
|
+
await write(path.join(root, "pkgs/akanjs/service/index.ts"), 'export * from "./predefinedAdaptor";\n');
|
|
97
|
+
await write(
|
|
98
|
+
path.join(root, "pkgs/akanjs/service/predefinedAdaptor/index.ts"),
|
|
99
|
+
'export const loadRedis = async () => import("ioredis");\n',
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const plugin = await createExternalizeFrameworkPlugin({
|
|
103
|
+
app: {
|
|
104
|
+
workspace: { workspaceRoot: root },
|
|
105
|
+
getTsConfig: async () => ({
|
|
106
|
+
compilerOptions: {
|
|
107
|
+
paths: {
|
|
108
|
+
"akanjs": ["./pkgs/akanjs/index.ts"],
|
|
109
|
+
"akanjs/*": ["./pkgs/akanjs/*"],
|
|
110
|
+
"akanjs/server": ["./pkgs/akanjs/server/index.ts"],
|
|
111
|
+
"akanjs/server/*": ["./pkgs/akanjs/server/*"],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
} as never,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const result = await Bun.build({
|
|
119
|
+
entrypoints: [entry],
|
|
120
|
+
outdir,
|
|
121
|
+
target: "bun",
|
|
122
|
+
format: "esm",
|
|
123
|
+
plugins: [plugin],
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
expect(result.success).toBe(true);
|
|
127
|
+
const output = await result.outputs.find((artifact) => artifact.kind === "entry-point")?.text();
|
|
128
|
+
expect(output).toContain("akan-option");
|
|
129
|
+
expect(output).toContain("ioredis");
|
|
130
|
+
expect(output).not.toMatch(/from\s+["']akanjs\/(?:server|service)["']/);
|
|
131
|
+
});
|
|
132
|
+
|
|
74
133
|
test("lets published akanjs package exports resolve when workspace paths are absent", async () => {
|
|
75
134
|
const root = await makeTempRoot();
|
|
76
135
|
const entry = path.join(root, "entry.ts");
|
|
@@ -59,9 +59,17 @@ const DEFAULT_INCLUDE = ["akanjs/", "@apps/", "@libs/"];
|
|
|
59
59
|
// Packages that must stay external even when a broad allowlist would
|
|
60
60
|
// otherwise bundle them. These are runtime hosts or shared singleton
|
|
61
61
|
// framework packages; ordinary npm dependencies intentionally fall through
|
|
62
|
-
// to Bun's resolver and get bundled.
|
|
62
|
+
// to Bun's resolver and get bundled.
|
|
63
63
|
const DEFAULT_EXCLUDE_EXACT = new Set<string>(["akanjs/webkit", "@akanjs/cli", "@akanjs/devkit"]);
|
|
64
64
|
const DEFAULT_EXCLUDE_PREFIX = ["@akanjs/cli/", "@akanjs/devkit/"];
|
|
65
|
+
const OPTIONAL_BACKEND_EXTERNAL_EXACT = new Set<string>([
|
|
66
|
+
"@libsql/client",
|
|
67
|
+
"bullmq",
|
|
68
|
+
"croner",
|
|
69
|
+
"ioredis",
|
|
70
|
+
"postgres",
|
|
71
|
+
"protobufjs",
|
|
72
|
+
]);
|
|
65
73
|
const RUNTIME_EXTERNAL_EXACT = new Set<string>([
|
|
66
74
|
"react",
|
|
67
75
|
"react-dom",
|
|
@@ -141,6 +149,7 @@ export async function createExternalizeFrameworkPlugin(options: ExternalizeFrame
|
|
|
141
149
|
for (const prefix of DEFAULT_EXCLUDE_PREFIX) {
|
|
142
150
|
if (spec.startsWith(prefix)) return { path: spec, external: true };
|
|
143
151
|
}
|
|
152
|
+
if (OPTIONAL_BACKEND_EXTERNAL_EXACT.has(spec)) return { path: spec, external: true };
|
|
144
153
|
if (RUNTIME_EXTERNAL_EXACT.has(spec)) return { path: spec, external: true };
|
|
145
154
|
for (const prefix of RUNTIME_EXTERNAL_PREFIX) {
|
|
146
155
|
if (spec.startsWith(prefix)) return { path: spec, external: true };
|