@moonsjs/vite 0.1.17 → 0.2.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/dist/{index-v5sbd3az.js → index-0agjty3z.js} +21 -18
- package/dist/index-0agjty3z.js.map +15 -0
- package/dist/index-f8w073cm.js +30 -0
- package/dist/index-f8w073cm.js.map +10 -0
- package/dist/{index-snbxks72.js → index-tbph0859.js} +80 -80
- package/dist/{index-snbxks72.js.map → index-tbph0859.js.map} +4 -4
- package/dist/index.js +33 -33
- package/dist/index.js.map +4 -4
- package/dist/server/handler.d.ts.map +1 -1
- package/dist/server/index.js +104 -93
- package/dist/server/index.js.map +10 -10
- package/dist/server/test-server.d.ts +6 -0
- package/dist/server/test-server.d.ts.map +1 -1
- package/dist/testing-preload.d.ts +2 -0
- package/dist/testing-preload.d.ts.map +1 -0
- package/dist/testing-preload.js +10 -0
- package/dist/testing-preload.js.map +10 -0
- package/dist/testing.d.ts +11 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +13 -0
- package/dist/testing.js.map +9 -0
- package/dist/transform.js +1 -1
- package/package.json +15 -5
- package/src/api.ts +14 -14
- package/src/devtools.ts +5 -5
- package/src/manifest.ts +2 -2
- package/src/plugin.ts +21 -21
- package/src/server/dev.ts +6 -1
- package/src/server/handler.ts +69 -47
- package/src/server/isr.ts +5 -5
- package/src/server/node-server.ts +6 -6
- package/src/server/node.ts +2 -2
- package/src/server/plugins.ts +1 -1
- package/src/server/prerender.ts +29 -29
- package/src/server/shell.ts +8 -8
- package/src/server/shutdown.ts +5 -5
- package/src/server/storage.ts +1 -1
- package/src/server/test-server.ts +12 -1
- package/src/server-only.ts +7 -7
- package/src/testing-preload.ts +5 -0
- package/src/testing.ts +34 -0
- package/src/transform.ts +76 -76
- package/dist/index-v5sbd3az.js.map +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-server.d.ts","sourceRoot":"","sources":["../../src/server/test-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"test-server.d.ts","sourceRoot":"","sources":["../../src/server/test-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAwB,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAiC,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IACtD,wDAAwD;IACxD,SAAS,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAC3C,cAAc,CAAC,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IACzD,iBAAiB,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;IAC/D,qEAAqE;IACrE,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjD,0EAA0E;IAC1E,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC7D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,SAAqB,GAC3B,UAAU,CAwBZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing-preload.d.ts","sourceRoot":"","sources":["../src/testing-preload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/testing-preload.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { registerMoonsTestPlugin } from \"./testing\";\n\n// Marker so fixture tests can skip cleanly under a plain `bun test` run.\n(globalThis as { __moonsTestPreload?: boolean }).__moonsTestPreload = true;\nregisterMoonsTestPlugin();\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;AAGC,WAAgD,qBAAqB;AACtE,yBAAwB;",
|
|
8
|
+
"debugId": "E15BF50941F69D2364756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BunPlugin } from "bun";
|
|
2
|
+
/**
|
|
3
|
+
* Annotate a `*.server.ts` module with the transform-generated serverFn meta
|
|
4
|
+
* (`__hash`, `__file`, `__line`, `__exportName`) — the same injection the
|
|
5
|
+
* build performs. Used by `moons test` so tests can import server modules.
|
|
6
|
+
*/
|
|
7
|
+
export declare function transformServerModuleForTest(file: string, projectRoot?: string): string;
|
|
8
|
+
/** Bun runtime plugin that applies the serverFn meta before tests load code. */
|
|
9
|
+
export declare function moonsTestPlugin(projectRoot?: string): BunPlugin;
|
|
10
|
+
export declare function registerMoonsTestPlugin(projectRoot?: string): void;
|
|
11
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGrC;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,MAAM,EACZ,WAAW,SAAgB,GAC1B,MAAM,CAIR;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,WAAW,SAAgB,GAAG,SAAS,CAUtE;AAED,wBAAgB,uBAAuB,CAAC,WAAW,SAAgB,GAAG,IAAI,CAEzE"}
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
transformServerModuleForTest2,
|
|
3
|
+
moonsTestPlugin2,
|
|
4
|
+
registerMoonsTestPlugin2
|
|
5
|
+
} from "./index-f8w073cm.js";
|
|
6
|
+
import"./index-tbph0859.js";
|
|
7
|
+
export {
|
|
8
|
+
moonsTestPlugin2 as moonsTestPlugin,
|
|
9
|
+
registerMoonsTestPlugin2 as registerMoonsTestPlugin,
|
|
10
|
+
transformServerModuleForTest2 as transformServerModuleForTest
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//# debugId=96CDD9D0FF077EEB64756E2164756E21
|
package/dist/transform.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonsjs/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,18 +31,28 @@
|
|
|
31
31
|
"types": "./src/transform.ts",
|
|
32
32
|
"bun": "./src/transform.ts",
|
|
33
33
|
"default": "./dist/transform.js"
|
|
34
|
+
},
|
|
35
|
+
"./testing": {
|
|
36
|
+
"types": "./src/testing.ts",
|
|
37
|
+
"bun": "./src/testing.ts",
|
|
38
|
+
"default": "./dist/testing.js"
|
|
39
|
+
},
|
|
40
|
+
"./testing/preload": {
|
|
41
|
+
"types": "./src/testing-preload.ts",
|
|
42
|
+
"bun": "./src/testing-preload.ts",
|
|
43
|
+
"default": "./dist/testing-preload.js"
|
|
34
44
|
}
|
|
35
45
|
},
|
|
36
46
|
"scripts": {
|
|
37
47
|
"prepack": "bun run build",
|
|
38
|
-
"build": "rm -rf dist && tsc -p tsconfig.json --emitDeclarationOnly && bun build src/index.ts src/server/index.ts src/transform.ts --outdir dist --target node --format esm --splitting --sourcemap=external --external @moonsjs/core --external '@moonsjs/core/*' --external @moonsjs/react --external '@moonsjs/react/*' --external @moonsjs/server --external '@moonsjs/server/*' --external @babel/parser --external vite",
|
|
48
|
+
"build": "rm -rf dist && tsc -p tsconfig.json --emitDeclarationOnly && bun build src/index.ts src/server/index.ts src/transform.ts src/testing.ts src/testing-preload.ts --outdir dist --target node --format esm --splitting --sourcemap=external --external @moonsjs/core --external '@moonsjs/core/*' --external @moonsjs/react --external '@moonsjs/react/*' --external @moonsjs/server --external '@moonsjs/server/*' --external @babel/parser --external vite",
|
|
39
49
|
"test": "bun test"
|
|
40
50
|
},
|
|
41
51
|
"dependencies": {
|
|
42
52
|
"@babel/parser": "^8.0.7",
|
|
43
|
-
"@moonsjs/core": "^0.
|
|
44
|
-
"@moonsjs/react": "^0.
|
|
45
|
-
"@moonsjs/server": "^0.
|
|
53
|
+
"@moonsjs/core": "^0.2.0",
|
|
54
|
+
"@moonsjs/react": "^0.2.0",
|
|
55
|
+
"@moonsjs/server": "^0.2.0"
|
|
46
56
|
},
|
|
47
57
|
"peerDependencies": {
|
|
48
58
|
"vite": "^8.3.4"
|
package/src/api.ts
CHANGED
|
@@ -25,9 +25,9 @@ export function assertApiModuleExports(code: string, file: string): string[] {
|
|
|
25
25
|
if (statement["type"] === "ExportDefaultDeclaration") {
|
|
26
26
|
throw apiError(
|
|
27
27
|
file,
|
|
28
|
-
"export `default`
|
|
29
|
-
"
|
|
30
|
-
["
|
|
28
|
+
"export `default` is not supported in API modules",
|
|
29
|
+
"`src/api` modules only export named method handlers.",
|
|
30
|
+
["Replace it with `export const GET = (args) => …`", "Remove the default export"],
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
if (statement["type"] !== "ExportNamedDeclaration") {
|
|
@@ -65,20 +65,20 @@ export function assertApiModuleExports(code: string, file: string): string[] {
|
|
|
65
65
|
if (illegal.length > 0) {
|
|
66
66
|
throw apiError(
|
|
67
67
|
file,
|
|
68
|
-
`export \`${illegal[0]}\`
|
|
69
|
-
`
|
|
68
|
+
`export \`${illegal[0]}\` is not a recognized method handler`,
|
|
69
|
+
`Legal handlers: ${API_METHODS.join(", ")}.`,
|
|
70
70
|
[
|
|
71
|
-
"
|
|
72
|
-
"
|
|
71
|
+
"Rename the export to one of the HTTP methods",
|
|
72
|
+
"Move helpers to another module (e.g. `src/server/…`)",
|
|
73
73
|
],
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
if (methods.length === 0) {
|
|
77
77
|
throw apiError(
|
|
78
78
|
file,
|
|
79
|
-
"
|
|
80
|
-
`
|
|
81
|
-
[`
|
|
79
|
+
"API module has no method handler",
|
|
80
|
+
`At least one of ${API_METHODS.join(", ")} is required.`,
|
|
81
|
+
["Add `export const GET = (args) => new Response(…)`"],
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -103,11 +103,11 @@ export function assertMiddlewareExports(code: string, file: string): void {
|
|
|
103
103
|
throw new MoonsError({
|
|
104
104
|
code: "E_MIDDLEWARE_INVALID",
|
|
105
105
|
file,
|
|
106
|
-
message: "`_middleware.ts`
|
|
107
|
-
details: "
|
|
106
|
+
message: "`_middleware.ts` without `export default`",
|
|
107
|
+
details: "Directory middleware follows the `Middleware` shape: `(args) => Promise<Response>`.",
|
|
108
108
|
suggestions: [
|
|
109
|
-
"
|
|
110
|
-
"
|
|
109
|
+
"Add `export default async ({ req, ctx, next }) => await next()`",
|
|
110
|
+
"Delete the file if unused",
|
|
111
111
|
],
|
|
112
112
|
});
|
|
113
113
|
}
|
package/src/devtools.ts
CHANGED
|
@@ -36,7 +36,7 @@ export function emptyDevtoolsData(): DevtoolsData {
|
|
|
36
36
|
export function renderDevtoolsHtml(data: DevtoolsData): string {
|
|
37
37
|
const rows = (items: DevtoolsRoute[]): string =>
|
|
38
38
|
items.length === 0
|
|
39
|
-
? '<tr><td colspan="3" class="muted">(
|
|
39
|
+
? '<tr><td colspan="3" class="muted">(empty)</td></tr>'
|
|
40
40
|
: items
|
|
41
41
|
.map(
|
|
42
42
|
(item) =>
|
|
@@ -46,7 +46,7 @@ export function renderDevtoolsHtml(data: DevtoolsData): string {
|
|
|
46
46
|
|
|
47
47
|
const fnRows =
|
|
48
48
|
data.serverFns.length === 0
|
|
49
|
-
? '<tr><td colspan="3" class="muted">(
|
|
49
|
+
? '<tr><td colspan="3" class="muted">(no serverFn)</td></tr>'
|
|
50
50
|
: data.serverFns
|
|
51
51
|
.map(
|
|
52
52
|
(fn) =>
|
|
@@ -55,11 +55,11 @@ export function renderDevtoolsHtml(data: DevtoolsData): string {
|
|
|
55
55
|
.join("\n");
|
|
56
56
|
|
|
57
57
|
const canary = data.canary
|
|
58
|
-
? '<span class="ok">
|
|
59
|
-
: '<span class="muted">
|
|
58
|
+
? '<span class="ok">enabled</span> (canary installed)'
|
|
59
|
+
: '<span class="muted">disabled</span> (no canary)';
|
|
60
60
|
|
|
61
61
|
return `<!doctype html>
|
|
62
|
-
<html lang="
|
|
62
|
+
<html lang="en">
|
|
63
63
|
<head>
|
|
64
64
|
<meta charset="utf-8">
|
|
65
65
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
package/src/manifest.ts
CHANGED
|
@@ -70,7 +70,7 @@ export function renderApiModule(
|
|
|
70
70
|
)
|
|
71
71
|
.join("\n");
|
|
72
72
|
return [
|
|
73
|
-
"// Generated by @moons.
|
|
73
|
+
"// Generated by @moons. Do not edit manually.",
|
|
74
74
|
`export const apiRoutes = ${JSON.stringify(apiRoutes, null, 2)};`,
|
|
75
75
|
`export const apiMiddlewares = ${JSON.stringify(apiMiddlewares, null, 2)};`,
|
|
76
76
|
"export const loadApi = {",
|
|
@@ -100,7 +100,7 @@ export function renderRoutesModule(
|
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
return [
|
|
103
|
-
"// Generated by @moons.
|
|
103
|
+
"// Generated by @moons. Do not edit manually.",
|
|
104
104
|
`export const routes = ${JSON.stringify(routes, null, 2)};`,
|
|
105
105
|
"",
|
|
106
106
|
`export const clientManifest = ${JSON.stringify(manifest, null, 2)};`,
|
package/src/plugin.ts
CHANGED
|
@@ -141,9 +141,9 @@ export default function moons(options: MoonsVitePluginOptions = {}): Plugin {
|
|
|
141
141
|
throw new MoonsError({
|
|
142
142
|
code: "E_INTERNAL",
|
|
143
143
|
file: id,
|
|
144
|
-
message: "
|
|
145
|
-
details: "
|
|
146
|
-
suggestions: ["
|
|
144
|
+
message: "failed to read the server file for transform",
|
|
145
|
+
details: "The `.server.ts` file must be readable during transform.",
|
|
146
|
+
suggestions: ["Check the path and file permissions"],
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -217,10 +217,10 @@ export default function moons(options: MoonsVitePluginOptions = {}): Plugin {
|
|
|
217
217
|
throw new MoonsError({
|
|
218
218
|
code: "E_CONFIG_INVALID",
|
|
219
219
|
file: configFilePath,
|
|
220
|
-
message: "`moons.config.ts`
|
|
221
|
-
details: "
|
|
220
|
+
message: "`moons.config.ts` not found",
|
|
221
|
+
details: "The framework requires a config file at the project root.",
|
|
222
222
|
suggestions: [
|
|
223
|
-
"
|
|
223
|
+
"Create `moons.config.ts` with `export default defineConfig({ context: async (req) => ({}) })`",
|
|
224
224
|
],
|
|
225
225
|
});
|
|
226
226
|
}
|
|
@@ -240,9 +240,9 @@ export default function moons(options: MoonsVitePluginOptions = {}): Plugin {
|
|
|
240
240
|
throw new MoonsError({
|
|
241
241
|
code: "E_CONFIG_INVALID",
|
|
242
242
|
file: configFilePath,
|
|
243
|
-
message: "
|
|
243
|
+
message: "failed to load `moons.config.ts`",
|
|
244
244
|
details: error instanceof Error ? error.message : String(error),
|
|
245
|
-
suggestions: ["
|
|
245
|
+
suggestions: ["Check the syntax and imports in `moons.config.ts`"],
|
|
246
246
|
});
|
|
247
247
|
}
|
|
248
248
|
|
|
@@ -314,7 +314,7 @@ export default function moons(options: MoonsVitePluginOptions = {}): Plugin {
|
|
|
314
314
|
case VIRTUAL_MODULES.api:
|
|
315
315
|
return renderApiModule(apiRoutes, apiMiddlewares, root);
|
|
316
316
|
case VIRTUAL_MODULES.clientEntry:
|
|
317
|
-
return '// Generated by @moons.
|
|
317
|
+
return '// Generated by @moons. Do not edit manually.\nexport { clientManifest, loadRoute } from "virtual:moons/routes";\n';
|
|
318
318
|
case VIRTUAL_MODULES.config:
|
|
319
319
|
return renderConfigModule(root, configFilePath);
|
|
320
320
|
case VIRTUAL_MODULES.serverEntry:
|
|
@@ -393,12 +393,12 @@ export default function moons(options: MoonsVitePluginOptions = {}): Plugin {
|
|
|
393
393
|
if (leak !== null) {
|
|
394
394
|
throw new MoonsError({
|
|
395
395
|
code: "E_INTERNAL",
|
|
396
|
-
message: `canary \`${canary}\`
|
|
396
|
+
message: `canary \`${canary}\` found in the client bundle (${leak.fileName})`,
|
|
397
397
|
details:
|
|
398
|
-
"
|
|
398
|
+
"Leak verification failed: server code leaked into the client output. Build stopped.",
|
|
399
399
|
suggestions: [
|
|
400
|
-
"
|
|
401
|
-
"
|
|
400
|
+
"Check the `*.server.ts` transform",
|
|
401
|
+
"Run `./scripts/m2/test-leak.sh` to audit",
|
|
402
402
|
],
|
|
403
403
|
});
|
|
404
404
|
}
|
|
@@ -416,12 +416,12 @@ export default function moons(options: MoonsVitePluginOptions = {}): Plugin {
|
|
|
416
416
|
throw new MoonsError({
|
|
417
417
|
code: "E_FORBIDDEN_SERVER_IMPORT",
|
|
418
418
|
file: cleanId,
|
|
419
|
-
message: "
|
|
419
|
+
message: "server module got bundled into the client without passing through the transform",
|
|
420
420
|
details:
|
|
421
|
-
"
|
|
421
|
+
"Build verification: every `*.server.ts` in the client bundle must be an RPC stub produced by the transform.",
|
|
422
422
|
suggestions: [
|
|
423
|
-
"
|
|
424
|
-
"
|
|
423
|
+
"Make sure the zero-trust transform runs for this module",
|
|
424
|
+
"If this repeats, report it as a framework bug",
|
|
425
425
|
],
|
|
426
426
|
});
|
|
427
427
|
}
|
|
@@ -523,7 +523,7 @@ export default function moons(options: MoonsVitePluginOptions = {}): Plugin {
|
|
|
523
523
|
|
|
524
524
|
function renderConfigModule(root: string, configFilePath: string): string {
|
|
525
525
|
return [
|
|
526
|
-
"// Generated by @moons.
|
|
526
|
+
"// Generated by @moons. Do not edit manually.",
|
|
527
527
|
`import raw from ${JSON.stringify(rootSpecifier(root, configFilePath))};`,
|
|
528
528
|
'import { validateConfig } from "@moonsjs/core";',
|
|
529
529
|
`export default validateConfig(raw, { file: ${JSON.stringify(configFilePath)} });`,
|
|
@@ -533,7 +533,7 @@ function renderConfigModule(root: string, configFilePath: string): string {
|
|
|
533
533
|
|
|
534
534
|
function renderServerEntryDev(routesDir: string, eagerImports: string[]): string {
|
|
535
535
|
return [
|
|
536
|
-
"// Generated by @moons.
|
|
536
|
+
"// Generated by @moons. Do not edit manually.",
|
|
537
537
|
'import { createPluginRuntime, createRequestHandler } from "@moonsjs/vite/server";',
|
|
538
538
|
'import config from "virtual:moons/config";',
|
|
539
539
|
'import { routes, loadRoute } from "virtual:moons/routes";',
|
|
@@ -555,7 +555,7 @@ function renderServerEntryBuild(
|
|
|
555
555
|
canary: string | undefined,
|
|
556
556
|
): string {
|
|
557
557
|
return [
|
|
558
|
-
"// Generated by @moons.
|
|
558
|
+
"// Generated by @moons. Do not edit manually.",
|
|
559
559
|
'import { createFileShell, createPluginRuntime, createRequestHandler, startNodeServer } from "@moonsjs/vite/server";',
|
|
560
560
|
'import config from "virtual:moons/config";',
|
|
561
561
|
'import { routes, loadRoute } from "virtual:moons/routes";',
|
|
@@ -593,7 +593,7 @@ function renderPrerenderEntry(
|
|
|
593
593
|
canary: string | undefined,
|
|
594
594
|
): string {
|
|
595
595
|
return [
|
|
596
|
-
"// Generated by @moons.
|
|
596
|
+
"// Generated by @moons. Do not edit manually.",
|
|
597
597
|
'import { createFileShell, createRequestHandler, runPrerender } from "@moonsjs/vite/server";',
|
|
598
598
|
'import config from "virtual:moons/config";',
|
|
599
599
|
'import { routes, loadRoute } from "virtual:moons/routes";',
|
package/src/server/dev.ts
CHANGED
|
@@ -78,7 +78,7 @@ export function installDevMiddleware(
|
|
|
78
78
|
} catch (error) {
|
|
79
79
|
res.statusCode = 500;
|
|
80
80
|
res.setHeader("content-type", "text/plain; charset=utf-8");
|
|
81
|
-
res.end(`[moons] devtools
|
|
81
|
+
res.end(`[moons] devtools failed to render: ${String(error)}`);
|
|
82
82
|
}
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
@@ -133,6 +133,11 @@ function shouldHandle(req: IncomingMessage, apiPrefix: string | undefined): bool
|
|
|
133
133
|
return true;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
// Addendum O: health check (semua method) — paritas 405 dengan produksi.
|
|
137
|
+
if (path === "/_moons/health") {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
|
|
136
141
|
// Addendum D.1: endpoint `src/api` (semua method) dirutekan ke runtime.
|
|
137
142
|
if (apiPrefix !== undefined && (path === apiPrefix || path.startsWith(`${apiPrefix}/`))) {
|
|
138
143
|
return true;
|