@akanjs/cli 2.3.2-rc.6 → 2.3.2-rc.7
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/incrementalBuilder.proc.js +29 -0
- package/index.js +29 -0
- package/package.json +2 -2
|
@@ -7932,6 +7932,7 @@ class PagesBundleBuilder {
|
|
|
7932
7932
|
plugins: [
|
|
7933
7933
|
PagesBundleBuilder.createPagesEntryPlugin(entrySource),
|
|
7934
7934
|
PagesBundleBuilder.createServerCssStubPlugin(),
|
|
7935
|
+
PagesBundleBuilder.createServerUseClientFetchPlugin(),
|
|
7935
7936
|
await createExternalizeFrameworkPlugin({ app: this.#app, extra: akanConfig2.externalLibs }),
|
|
7936
7937
|
akanConfig2.barrelImports.length > 0 ? await createBarrelImportsPlugin(this.#app, {
|
|
7937
7938
|
pipeAfter: (source, args) => transformUseClient(source, {
|
|
@@ -8001,6 +8002,34 @@ class PagesBundleBuilder {
|
|
|
8001
8002
|
}
|
|
8002
8003
|
};
|
|
8003
8004
|
}
|
|
8005
|
+
static createServerUseClientFetchPlugin() {
|
|
8006
|
+
return {
|
|
8007
|
+
name: "akan-server-use-client-fetch",
|
|
8008
|
+
setup(build) {
|
|
8009
|
+
build.onLoad({ filter: /[/\\]lib[/\\]useClient\.(ts|tsx|js|jsx)$/ }, async (args) => {
|
|
8010
|
+
const source = await Bun.file(args.path).text();
|
|
8011
|
+
const transformed = PagesBundleBuilder.transformServerUseClientFetchSource(source);
|
|
8012
|
+
if (transformed === source)
|
|
8013
|
+
return;
|
|
8014
|
+
return { contents: transformed, loader: loaderFor4(args.path) };
|
|
8015
|
+
});
|
|
8016
|
+
}
|
|
8017
|
+
};
|
|
8018
|
+
}
|
|
8019
|
+
static transformServerUseClientFetchSource(source) {
|
|
8020
|
+
if (!source.includes(`with { type: "macro" }`) || !source.includes("FetchClient.build"))
|
|
8021
|
+
return source;
|
|
8022
|
+
return source.replace(/import\s+\{\s*getSerializedSignal\s*\}\s+from\s+["']\.\/sig["']\s+with\s+\{\s*type\s*:\s*["']macro["']\s*\};/, `import { fetch as serverFetch } from "./sig";`).replace(/const\s+fetchProto\s*=\s*FetchClient\.build<[^;]+;/, "const fetchProto = { fetch: serverFetch, sig: {} };");
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
function loaderFor4(absPath) {
|
|
8026
|
+
if (absPath.endsWith(".tsx"))
|
|
8027
|
+
return "tsx";
|
|
8028
|
+
if (absPath.endsWith(".jsx"))
|
|
8029
|
+
return "jsx";
|
|
8030
|
+
if (absPath.endsWith(".ts"))
|
|
8031
|
+
return "ts";
|
|
8032
|
+
return "js";
|
|
8004
8033
|
}
|
|
8005
8034
|
// pkgs/@akanjs/devkit/frontendBuild/precompressArtifacts.ts
|
|
8006
8035
|
import fs5 from "fs";
|
package/index.js
CHANGED
|
@@ -7930,6 +7930,7 @@ class PagesBundleBuilder {
|
|
|
7930
7930
|
plugins: [
|
|
7931
7931
|
PagesBundleBuilder.createPagesEntryPlugin(entrySource),
|
|
7932
7932
|
PagesBundleBuilder.createServerCssStubPlugin(),
|
|
7933
|
+
PagesBundleBuilder.createServerUseClientFetchPlugin(),
|
|
7933
7934
|
await createExternalizeFrameworkPlugin({ app: this.#app, extra: akanConfig2.externalLibs }),
|
|
7934
7935
|
akanConfig2.barrelImports.length > 0 ? await createBarrelImportsPlugin(this.#app, {
|
|
7935
7936
|
pipeAfter: (source, args) => transformUseClient(source, {
|
|
@@ -7999,6 +8000,34 @@ class PagesBundleBuilder {
|
|
|
7999
8000
|
}
|
|
8000
8001
|
};
|
|
8001
8002
|
}
|
|
8003
|
+
static createServerUseClientFetchPlugin() {
|
|
8004
|
+
return {
|
|
8005
|
+
name: "akan-server-use-client-fetch",
|
|
8006
|
+
setup(build) {
|
|
8007
|
+
build.onLoad({ filter: /[/\\]lib[/\\]useClient\.(ts|tsx|js|jsx)$/ }, async (args) => {
|
|
8008
|
+
const source = await Bun.file(args.path).text();
|
|
8009
|
+
const transformed = PagesBundleBuilder.transformServerUseClientFetchSource(source);
|
|
8010
|
+
if (transformed === source)
|
|
8011
|
+
return;
|
|
8012
|
+
return { contents: transformed, loader: loaderFor4(args.path) };
|
|
8013
|
+
});
|
|
8014
|
+
}
|
|
8015
|
+
};
|
|
8016
|
+
}
|
|
8017
|
+
static transformServerUseClientFetchSource(source) {
|
|
8018
|
+
if (!source.includes(`with { type: "macro" }`) || !source.includes("FetchClient.build"))
|
|
8019
|
+
return source;
|
|
8020
|
+
return source.replace(/import\s+\{\s*getSerializedSignal\s*\}\s+from\s+["']\.\/sig["']\s+with\s+\{\s*type\s*:\s*["']macro["']\s*\};/, `import { fetch as serverFetch } from "./sig";`).replace(/const\s+fetchProto\s*=\s*FetchClient\.build<[^;]+;/, "const fetchProto = { fetch: serverFetch, sig: {} };");
|
|
8021
|
+
}
|
|
8022
|
+
}
|
|
8023
|
+
function loaderFor4(absPath) {
|
|
8024
|
+
if (absPath.endsWith(".tsx"))
|
|
8025
|
+
return "tsx";
|
|
8026
|
+
if (absPath.endsWith(".jsx"))
|
|
8027
|
+
return "jsx";
|
|
8028
|
+
if (absPath.endsWith(".ts"))
|
|
8029
|
+
return "ts";
|
|
8030
|
+
return "js";
|
|
8002
8031
|
}
|
|
8003
8032
|
// pkgs/@akanjs/devkit/frontendBuild/precompressArtifacts.ts
|
|
8004
8033
|
import fs5 from "fs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "2.3.2-rc.
|
|
3
|
+
"version": "2.3.2-rc.7",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@langchain/openai": "^1.4.6",
|
|
36
36
|
"@tailwindcss/node": "^4.3.0",
|
|
37
37
|
"@trapezedev/project": "^7.1.4",
|
|
38
|
-
"akanjs": "2.3.2-rc.
|
|
38
|
+
"akanjs": "2.3.2-rc.7",
|
|
39
39
|
"chalk": "^5.6.2",
|
|
40
40
|
"commander": "^14.0.3",
|
|
41
41
|
"daisyui": "^5.5.20",
|