@akanjs/devkit 2.3.10-rc.1 → 2.3.10
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/CHANGELOG.md
CHANGED
package/executors.ts
CHANGED
|
@@ -437,9 +437,6 @@ export class Executor {
|
|
|
437
437
|
getPath(filePath: string) {
|
|
438
438
|
if (path.isAbsolute(filePath)) return filePath;
|
|
439
439
|
if (filePath.startsWith(".")) return path.join(this.cwdPath, filePath);
|
|
440
|
-
// Split on both separators so a Windows/mixed cwdPath (e.g. "C:\repo/apps/name") is parsed
|
|
441
|
-
// correctly, then rebuild with path.join so the result stays OS-native instead of the
|
|
442
|
-
// invalid "/C:\repo/..." the previous forward-slash-only reconstruction produced.
|
|
443
440
|
const baseParts = this.cwdPath.split(/[\\/]/).filter(Boolean);
|
|
444
441
|
const targetParts = filePath.split(/[\\/]/).filter(Boolean);
|
|
445
442
|
|
|
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, test } from "bun:test";
|
|
|
2
2
|
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import { fileURLToPath
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
6
|
import type { RoutesManifest } from "akanjs/server";
|
|
7
7
|
import { CsrArtifactBuilder } from "./csrArtifactBuilder";
|
|
8
8
|
import { CssCompiler, isIgnoredNodeModuleSource } from "./cssCompiler";
|
|
@@ -33,7 +33,9 @@ afterEach(async () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
describe("PagesEntrySourceGenerator", () => {
|
|
36
|
-
|
|
36
|
+
const toSpecifier = (absPath: string) => path.resolve(absPath).split(path.sep).join("/");
|
|
37
|
+
|
|
38
|
+
test("generates dynamic import source using forward-slash module paths", () => {
|
|
37
39
|
const indexAbs = path.resolve("/repo/apps/demo/page/_index.tsx");
|
|
38
40
|
const adminAbs = path.resolve("/repo/apps/demo/page/admin.tsx");
|
|
39
41
|
const source = PagesEntrySourceGenerator.generate([
|
|
@@ -44,8 +46,8 @@ describe("PagesEntrySourceGenerator", () => {
|
|
|
44
46
|
expect(source).toBe(
|
|
45
47
|
[
|
|
46
48
|
"export const pages = {",
|
|
47
|
-
` "./_index.tsx": () => import(${JSON.stringify(
|
|
48
|
-
` "./admin.tsx": () => import(${JSON.stringify(
|
|
49
|
+
` "./_index.tsx": () => import(${JSON.stringify(toSpecifier(indexAbs))}),`,
|
|
50
|
+
` "./admin.tsx": () => import(${JSON.stringify(toSpecifier(adminAbs))}),`,
|
|
49
51
|
"};",
|
|
50
52
|
"",
|
|
51
53
|
].join("\n"),
|
|
@@ -62,8 +64,8 @@ describe("PagesEntrySourceGenerator", () => {
|
|
|
62
64
|
|
|
63
65
|
expect(source).toBe(
|
|
64
66
|
[
|
|
65
|
-
`import * as page0 from ${JSON.stringify(
|
|
66
|
-
`import * as page1 from ${JSON.stringify(
|
|
67
|
+
`import * as page0 from ${JSON.stringify(toSpecifier(indexAbs))};`,
|
|
68
|
+
`import * as page1 from ${JSON.stringify(toSpecifier(adminAbs))};`,
|
|
67
69
|
"export const pages = {",
|
|
68
70
|
' "./_index.tsx": { loader: async () => page0, isAsyncDefault: false },',
|
|
69
71
|
' "./admin.tsx": { loader: async () => page1, isAsyncDefault: false },',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
3
|
import ts from "typescript";
|
|
5
4
|
import type { PageEntry } from "../artifact/implicitRootLayout";
|
|
6
5
|
|
|
@@ -17,7 +16,7 @@ export class PagesEntrySourceGenerator {
|
|
|
17
16
|
|
|
18
17
|
generate(): string {
|
|
19
18
|
const lines = this.#pageEntries.map(({ key, moduleAbsPath }) => {
|
|
20
|
-
const specifier =
|
|
19
|
+
const specifier = PagesEntrySourceGenerator.#toImportSpecifier(moduleAbsPath);
|
|
21
20
|
return ` ${JSON.stringify(key)}: () => import(${JSON.stringify(specifier)}),`;
|
|
22
21
|
});
|
|
23
22
|
return `export const pages = {\n${lines.join("\n")}\n};\n`;
|
|
@@ -29,9 +28,7 @@ export class PagesEntrySourceGenerator {
|
|
|
29
28
|
|
|
30
29
|
generateStatic(): string {
|
|
31
30
|
const imports = this.#pageEntries.map(({ moduleAbsPath }, index) => {
|
|
32
|
-
|
|
33
|
-
// (backslashes, or mixed with forward slashes) is a fragile ESM import specifier.
|
|
34
|
-
const specifier = pathToFileURL(path.resolve(moduleAbsPath)).href;
|
|
31
|
+
const specifier = PagesEntrySourceGenerator.#toImportSpecifier(moduleAbsPath);
|
|
35
32
|
return `import * as page${index} from ${JSON.stringify(specifier)};`;
|
|
36
33
|
});
|
|
37
34
|
const entries = this.#pageEntries.map(({ key, moduleAbsPath }, index) => {
|
|
@@ -40,6 +37,9 @@ export class PagesEntrySourceGenerator {
|
|
|
40
37
|
});
|
|
41
38
|
return `${imports.join("\n")}\nexport const pages = {\n${entries.join("\n")}\n};\n`;
|
|
42
39
|
}
|
|
40
|
+
static #toImportSpecifier(moduleAbsPath: string): string {
|
|
41
|
+
return path.resolve(moduleAbsPath).split(path.sep).join("/");
|
|
42
|
+
}
|
|
43
43
|
|
|
44
44
|
static #hasAsyncDefaultExport(moduleAbsPath: string): boolean {
|
|
45
45
|
try {
|
|
@@ -99,10 +99,6 @@ export class SsrBaseArtifactBuilder {
|
|
|
99
99
|
}
|
|
100
100
|
> {
|
|
101
101
|
const akanServerPath = await this.#resolveAkanServerPath();
|
|
102
|
-
// Normalize entry paths with path.resolve so they match the resolved map keys the bundler
|
|
103
|
-
// stores (see ClientEntriesBundler#createOpaqueEntryAliases). Raw string concatenation keeps
|
|
104
|
-
// forward slashes, which on Windows fail to match the `\`-separated resolved keys and silently
|
|
105
|
-
// yield empty import-map URLs, breaking hydration.
|
|
106
102
|
const rscClientEntry = path.resolve(akanServerPath, "rscClient.tsx");
|
|
107
103
|
const rscSegmentOutletEntry = path.resolve(akanServerPath, "rscSegmentOutlet.tsx");
|
|
108
104
|
const vendorEntries = VENDOR_SPECIFIERS.map((specifier) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "2.3.10
|
|
3
|
+
"version": "2.3.10",
|
|
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.10
|
|
35
|
+
"akanjs": "2.3.10",
|
|
36
36
|
"chalk": "^5.6.2",
|
|
37
37
|
"commander": "^14.0.3",
|
|
38
38
|
"daisyui": "5.5.23",
|