@moonsjs/vite 0.1.3 → 0.1.5
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/api.d.ts +8 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/{index-1sm9pvvd.js → index-1fnt137k.js} +106 -18
- package/dist/index-1fnt137k.js.map +14 -0
- package/dist/{index-3ec9vpek.js → index-e7qz0epf.js} +232 -24
- package/dist/index-e7qz0epf.js.map +11 -0
- package/dist/index.js +220 -19
- package/dist/index.js.map +5 -4
- package/dist/manifest.d.ts +6 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/payload-scan.d.ts +18 -0
- package/dist/payload-scan.d.ts.map +1 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/server/dev.d.ts +4 -0
- package/dist/server/dev.d.ts.map +1 -1
- package/dist/server/handler.d.ts +21 -1
- package/dist/server/handler.d.ts.map +1 -1
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +584 -28
- package/dist/server/index.js.map +10 -7
- package/dist/server/node-server.d.ts +4 -1
- package/dist/server/node-server.d.ts.map +1 -1
- package/dist/server/node.d.ts.map +1 -1
- package/dist/server/plugins.d.ts +26 -0
- package/dist/server/plugins.d.ts.map +1 -0
- package/dist/server/prerender.d.ts +28 -0
- package/dist/server/prerender.d.ts.map +1 -0
- package/dist/server/shell.d.ts +3 -3
- package/dist/server/shell.d.ts.map +1 -1
- package/dist/server/shutdown.d.ts +6 -0
- package/dist/server/shutdown.d.ts.map +1 -1
- package/dist/server/test-server.d.ts.map +1 -1
- package/dist/server-only.d.ts +57 -0
- package/dist/server-only.d.ts.map +1 -0
- package/dist/transform.d.ts +9 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js +1 -1
- package/dist/virtual-modules.d.ts +1 -0
- package/dist/virtual-modules.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +124 -0
- package/src/manifest.ts +42 -1
- package/src/payload-scan.ts +53 -0
- package/src/plugin.ts +137 -10
- package/src/server/dev.ts +48 -12
- package/src/server/handler.ts +373 -14
- package/src/server/index.ts +6 -0
- package/src/server/node-server.ts +70 -16
- package/src/server/node.ts +17 -0
- package/src/server/plugins.ts +85 -0
- package/src/server/prerender.ts +230 -0
- package/src/server/shell.ts +62 -8
- package/src/server/shutdown.ts +19 -2
- package/src/server/test-server.ts +2 -1
- package/src/server-only.ts +220 -0
- package/src/transform.ts +138 -8
- package/src/virtual-modules.ts +1 -0
- package/dist/index-1sm9pvvd.js.map +0 -14
- package/dist/index-3ec9vpek.js.map +0 -10
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
renderApiModule,
|
|
2
3
|
renderRoutesModule,
|
|
3
4
|
rootSpecifier,
|
|
4
5
|
VIRTUAL_MODULES,
|
|
5
6
|
fromNullPrefixed,
|
|
6
7
|
installDevMiddleware2
|
|
7
|
-
} from "./index-
|
|
8
|
+
} from "./index-1fnt137k.js";
|
|
8
9
|
import {
|
|
9
10
|
isServerFilePath2,
|
|
10
11
|
isNonContractServerFile2,
|
|
@@ -17,21 +18,118 @@ import {
|
|
|
17
18
|
checkClientModuleImports2,
|
|
18
19
|
checkRouteModuleExports2,
|
|
19
20
|
scanServerFiles2
|
|
20
|
-
} from "./index-
|
|
21
|
+
} from "./index-e7qz0epf.js";
|
|
21
22
|
|
|
22
23
|
// src/plugin.ts
|
|
23
24
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
24
25
|
import { createHash } from "node:crypto";
|
|
25
26
|
import { resolve as resolvePath } from "node:path";
|
|
26
27
|
import {
|
|
27
|
-
MoonsError,
|
|
28
|
+
MoonsError as MoonsError2,
|
|
28
29
|
fnRegistryKey,
|
|
29
30
|
generateTypes,
|
|
31
|
+
scanApiMiddlewares,
|
|
32
|
+
scanApiRoutes,
|
|
30
33
|
scanRoutes,
|
|
31
34
|
validateConfig
|
|
32
35
|
} from "@moonsjs/core";
|
|
33
36
|
import { loadConfigFromFile } from "vite";
|
|
34
37
|
|
|
38
|
+
// src/api.ts
|
|
39
|
+
import { parse } from "@babel/parser";
|
|
40
|
+
import { API_METHODS, MoonsError } from "@moonsjs/core";
|
|
41
|
+
function assertApiModuleExports(code, file) {
|
|
42
|
+
let ast;
|
|
43
|
+
try {
|
|
44
|
+
ast = parse(code, {
|
|
45
|
+
sourceType: "module",
|
|
46
|
+
plugins: file.endsWith(".tsx") ? ["typescript", "jsx"] : ["typescript"]
|
|
47
|
+
});
|
|
48
|
+
} catch {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
const program = ast.program;
|
|
52
|
+
const body = program?.body ?? [];
|
|
53
|
+
const methods = [];
|
|
54
|
+
for (const statement of body) {
|
|
55
|
+
if (statement["type"] === "ExportDefaultDeclaration") {
|
|
56
|
+
throw apiError(file, "export `default` tidak didukung di modul API", "Modul `src/api` hanya mengekspor handler method bernama (PRD Addendum D.1).", ["Ganti menjadi `export const GET = (args) => …`", "Hapus export default"]);
|
|
57
|
+
}
|
|
58
|
+
if (statement["type"] !== "ExportNamedDeclaration") {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (statement["source"] !== undefined) {}
|
|
62
|
+
const declaration = statement["declaration"];
|
|
63
|
+
if (declaration !== undefined) {
|
|
64
|
+
if (declaration["type"] === "VariableDeclaration") {
|
|
65
|
+
for (const declarator of declaration["declarations"] ?? []) {
|
|
66
|
+
const id = declarator["id"];
|
|
67
|
+
if (id?.["type"] === "Identifier") {
|
|
68
|
+
methods.push(id["name"]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} else if (declaration["type"] === "FunctionDeclaration") {
|
|
72
|
+
const id = declaration["id"];
|
|
73
|
+
if (id?.["type"] === "Identifier") {
|
|
74
|
+
methods.push(id["name"]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
for (const specifier of statement["specifiers"] ?? []) {
|
|
80
|
+
const exported = specifier["exported"];
|
|
81
|
+
if (exported?.["type"] === "Identifier") {
|
|
82
|
+
methods.push(exported["name"]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const illegal = methods.filter((name) => !API_METHODS.includes(name));
|
|
87
|
+
if (illegal.length > 0) {
|
|
88
|
+
throw apiError(file, `export \`${illegal[0]}\` bukan handler method yang dikenal`, `Handler yang legal: ${API_METHODS.join(", ")} (PRD Addendum D.1).`, [
|
|
89
|
+
"Ganti nama export menjadi salah satu method HTTP",
|
|
90
|
+
"Pindahkan helper ke modul lain (mis. `src/server/…`)"
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
if (methods.length === 0) {
|
|
94
|
+
throw apiError(file, "modul API tanpa handler method", `Wajib ada minimal satu dari ${API_METHODS.join(", ")} (PRD Addendum D.1).`, [`Tambahkan \`export const GET = (args) => new Response(…)\``]);
|
|
95
|
+
}
|
|
96
|
+
return methods;
|
|
97
|
+
}
|
|
98
|
+
function assertMiddlewareExports(code, file) {
|
|
99
|
+
let ast;
|
|
100
|
+
try {
|
|
101
|
+
ast = parse(code, {
|
|
102
|
+
sourceType: "module",
|
|
103
|
+
plugins: file.endsWith(".tsx") ? ["typescript", "jsx"] : ["typescript"]
|
|
104
|
+
});
|
|
105
|
+
} catch {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const program = ast.program;
|
|
109
|
+
const hasDefault = (program?.body ?? []).some((statement) => statement["type"] === "ExportDefaultDeclaration");
|
|
110
|
+
if (!hasDefault) {
|
|
111
|
+
throw new MoonsError({
|
|
112
|
+
code: "E_MIDDLEWARE_INVALID",
|
|
113
|
+
file,
|
|
114
|
+
message: "`_middleware.ts` tanpa `export default`",
|
|
115
|
+
details: "Middleware direktori mengikuti bentuk `Middleware`: `(args) => Promise<Response>` (PRD Addendum D.3).",
|
|
116
|
+
suggestions: [
|
|
117
|
+
"Tambahkan `export default async ({ req, ctx, next }) => await next()`",
|
|
118
|
+
"Hapus file bila tidak dipakai"
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function apiError(file, message, details, suggestions) {
|
|
124
|
+
return new MoonsError({
|
|
125
|
+
code: "E_API_HANDLER_INVALID",
|
|
126
|
+
file,
|
|
127
|
+
message,
|
|
128
|
+
details,
|
|
129
|
+
suggestions
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
35
133
|
// src/leak-check.ts
|
|
36
134
|
function findLeak(outputs, canary, decode = defaultDecode) {
|
|
37
135
|
for (const output of outputs) {
|
|
@@ -61,6 +159,11 @@ function moons(options = {}) {
|
|
|
61
159
|
let isSsrBuild = false;
|
|
62
160
|
let configFilePath = "";
|
|
63
161
|
let routesDir = "";
|
|
162
|
+
let serverOnlyPackages = [];
|
|
163
|
+
let apiDir = "";
|
|
164
|
+
let apiRoutes = [];
|
|
165
|
+
let apiMiddlewares = [];
|
|
166
|
+
const packageCache = new Map;
|
|
64
167
|
let routes = [];
|
|
65
168
|
let analysisCache = new Map;
|
|
66
169
|
const stubTransformed = new Set;
|
|
@@ -120,7 +223,7 @@ function moons(options = {}) {
|
|
|
120
223
|
}
|
|
121
224
|
const analysis = analyzeFile(id);
|
|
122
225
|
if (analysis === null) {
|
|
123
|
-
throw new
|
|
226
|
+
throw new MoonsError2({
|
|
124
227
|
code: "E_INTERNAL",
|
|
125
228
|
file: id,
|
|
126
229
|
message: "gagal membaca file server untuk transform",
|
|
@@ -153,8 +256,17 @@ function moons(options = {}) {
|
|
|
153
256
|
build: {
|
|
154
257
|
outDir: "dist/server",
|
|
155
258
|
emptyOutDir: true,
|
|
156
|
-
ssr:
|
|
157
|
-
rollupOptions: {
|
|
259
|
+
ssr: true,
|
|
260
|
+
rollupOptions: {
|
|
261
|
+
input: {
|
|
262
|
+
index: ".moons/server-entry.ts",
|
|
263
|
+
prerender: ".moons/prerender-entry.ts"
|
|
264
|
+
},
|
|
265
|
+
output: {
|
|
266
|
+
entryFileNames: "[name].js",
|
|
267
|
+
chunkFileNames: "chunks/[name]-[hash].js"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
158
270
|
},
|
|
159
271
|
ssr: { noExternal: true, target: "node" }
|
|
160
272
|
};
|
|
@@ -169,7 +281,7 @@ function moons(options = {}) {
|
|
|
169
281
|
root = options.projectRoot ?? resolved.root;
|
|
170
282
|
configFilePath = resolvePath(root, options.configPath ?? "moons.config.ts");
|
|
171
283
|
if (!existsSync(configFilePath)) {
|
|
172
|
-
throw new
|
|
284
|
+
throw new MoonsError2({
|
|
173
285
|
code: "E_CONFIG_INVALID",
|
|
174
286
|
file: configFilePath,
|
|
175
287
|
message: "`moons.config.ts` tidak ditemukan",
|
|
@@ -184,10 +296,10 @@ function moons(options = {}) {
|
|
|
184
296
|
const loaded = await loadConfigFromFile({ command: resolved.command, mode: resolved.mode }, configFilePath, root);
|
|
185
297
|
raw = loaded?.config;
|
|
186
298
|
} catch (error) {
|
|
187
|
-
if (error instanceof
|
|
299
|
+
if (error instanceof MoonsError2) {
|
|
188
300
|
throw error;
|
|
189
301
|
}
|
|
190
|
-
throw new
|
|
302
|
+
throw new MoonsError2({
|
|
191
303
|
code: "E_CONFIG_INVALID",
|
|
192
304
|
file: configFilePath,
|
|
193
305
|
message: "gagal memuat `moons.config.ts`",
|
|
@@ -197,9 +309,27 @@ function moons(options = {}) {
|
|
|
197
309
|
}
|
|
198
310
|
const config = validateConfig(raw, { file: configFilePath, projectRoot: root });
|
|
199
311
|
routesDir = resolvePath(root, config.routesDir);
|
|
312
|
+
serverOnlyPackages = config.security?.serverOnlyPackages ?? [];
|
|
313
|
+
apiDir = resolvePath(root, config.apiDir ?? "src/api");
|
|
314
|
+
if (existsSync(apiDir)) {
|
|
315
|
+
apiRoutes = scanApiRoutes(apiDir);
|
|
316
|
+
for (const route of apiRoutes) {
|
|
317
|
+
assertApiModuleExports(readFileSync(route.file, "utf8"), route.file);
|
|
318
|
+
}
|
|
319
|
+
apiMiddlewares = scanApiMiddlewares(apiDir);
|
|
320
|
+
for (const middleware of apiMiddlewares) {
|
|
321
|
+
assertMiddlewareExports(readFileSync(middleware.file, "utf8"), middleware.file);
|
|
322
|
+
}
|
|
323
|
+
} else {
|
|
324
|
+
apiRoutes = [];
|
|
325
|
+
apiMiddlewares = [];
|
|
326
|
+
}
|
|
200
327
|
},
|
|
201
328
|
async buildStart() {
|
|
202
329
|
routes = scanRoutes(routesDir);
|
|
330
|
+
for (const middleware of routes.filter((route) => route.kind === "middleware")) {
|
|
331
|
+
assertMiddlewareExports(readFileSync(middleware.file, "utf8"), middleware.file);
|
|
332
|
+
}
|
|
203
333
|
await generateTypes({
|
|
204
334
|
routesDir,
|
|
205
335
|
configPath: configFilePath,
|
|
@@ -208,6 +338,7 @@ function moons(options = {}) {
|
|
|
208
338
|
refreshServerFns();
|
|
209
339
|
if (isSsrBuild) {
|
|
210
340
|
writeFileSync(resolvePath(root, ".moons/server-entry.ts"), renderServerEntryBuild(routesDir, serverFnFileSpecifiers()), "utf8");
|
|
341
|
+
writeFileSync(resolvePath(root, ".moons/prerender-entry.ts"), renderPrerenderEntry(routesDir, root, options.leakTest?.canary), "utf8");
|
|
211
342
|
}
|
|
212
343
|
},
|
|
213
344
|
resolveId(id) {
|
|
@@ -225,6 +356,8 @@ function moons(options = {}) {
|
|
|
225
356
|
switch (name) {
|
|
226
357
|
case VIRTUAL_MODULES.routes:
|
|
227
358
|
return renderRoutesModule(routes, routesDir, root);
|
|
359
|
+
case VIRTUAL_MODULES.api:
|
|
360
|
+
return renderApiModule(apiRoutes, apiMiddlewares, root);
|
|
228
361
|
case VIRTUAL_MODULES.clientEntry:
|
|
229
362
|
return `// Generated by @moons. Jangan diubah manual.
|
|
230
363
|
export { clientManifest, loadRoute } from "virtual:moons/routes";
|
|
@@ -275,7 +408,10 @@ export { clientManifest, loadRoute } from "virtual:moons/routes";
|
|
|
275
408
|
return null;
|
|
276
409
|
}
|
|
277
410
|
},
|
|
278
|
-
analyze: (absoluteFile) => analysisCache.get(absoluteFile) ?? analyzeFile(absoluteFile)
|
|
411
|
+
analyze: (absoluteFile) => analysisCache.get(absoluteFile) ?? analyzeFile(absoluteFile),
|
|
412
|
+
apiDir,
|
|
413
|
+
serverOnlyPackages,
|
|
414
|
+
packageCache
|
|
279
415
|
});
|
|
280
416
|
}
|
|
281
417
|
return;
|
|
@@ -288,7 +424,7 @@ export { clientManifest, loadRoute } from "virtual:moons/routes";
|
|
|
288
424
|
if (canary !== undefined && canary.length > 0) {
|
|
289
425
|
const leak = findLeak(Object.values(bundle), canary);
|
|
290
426
|
if (leak !== null) {
|
|
291
|
-
throw new
|
|
427
|
+
throw new MoonsError2({
|
|
292
428
|
code: "E_INTERNAL",
|
|
293
429
|
message: `canary \`${canary}\` ditemukan di bundle client (${leak.fileName})`,
|
|
294
430
|
details: "Verifikasi kebocoran §2/§9.2.8 gagal: kode server bocor ke output client. Build dihentikan.",
|
|
@@ -308,7 +444,7 @@ export { clientManifest, loadRoute } from "virtual:moons/routes";
|
|
|
308
444
|
if (!isServerFilePath2(cleanId) || stubTransformed.has(cleanId)) {
|
|
309
445
|
continue;
|
|
310
446
|
}
|
|
311
|
-
throw new
|
|
447
|
+
throw new MoonsError2({
|
|
312
448
|
code: "E_FORBIDDEN_SERVER_IMPORT",
|
|
313
449
|
file: cleanId,
|
|
314
450
|
message: "modul server ikut ter-bundle di client tanpa melewati transform",
|
|
@@ -322,7 +458,14 @@ export { clientManifest, loadRoute } from "virtual:moons/routes";
|
|
|
322
458
|
}
|
|
323
459
|
},
|
|
324
460
|
configureServer(server) {
|
|
325
|
-
installDevMiddleware2(server, {
|
|
461
|
+
installDevMiddleware2(server, {
|
|
462
|
+
templatePath: resolvePath(root, "index.html"),
|
|
463
|
+
payloadScan: {
|
|
464
|
+
...options.leakTest?.canary === undefined ? {} : { canary: options.leakTest.canary },
|
|
465
|
+
env: process.env
|
|
466
|
+
},
|
|
467
|
+
...apiRoutes.length === 0 ? {} : { apiPrefix: `/${apiDir.split(/[\\/]/).filter((part) => part.length > 0).pop() ?? "api"}` }
|
|
468
|
+
});
|
|
326
469
|
},
|
|
327
470
|
async handleHotUpdate(context) {
|
|
328
471
|
if (isServerFilePath2(context.file)) {
|
|
@@ -330,11 +473,32 @@ export { clientManifest, loadRoute } from "virtual:moons/routes";
|
|
|
330
473
|
context.server.ws.send({ type: "full-reload" });
|
|
331
474
|
return;
|
|
332
475
|
}
|
|
476
|
+
if (context.file.startsWith(apiDir) && existsSync(apiDir)) {
|
|
477
|
+
try {
|
|
478
|
+
apiRoutes = scanApiRoutes(apiDir);
|
|
479
|
+
for (const route of apiRoutes) {
|
|
480
|
+
assertApiModuleExports(readFileSync(route.file, "utf8"), route.file);
|
|
481
|
+
}
|
|
482
|
+
apiMiddlewares = scanApiMiddlewares(apiDir);
|
|
483
|
+
for (const middleware of apiMiddlewares) {
|
|
484
|
+
assertMiddlewareExports(readFileSync(middleware.file, "utf8"), middleware.file);
|
|
485
|
+
}
|
|
486
|
+
} catch (error) {
|
|
487
|
+
context.server.config.logger.error(String(error));
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
invalidateVirtualModules(context.server);
|
|
491
|
+
context.server.ws.send({ type: "full-reload" });
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
333
494
|
if (!context.file.startsWith(routesDir)) {
|
|
334
495
|
return;
|
|
335
496
|
}
|
|
336
497
|
try {
|
|
337
498
|
routes = scanRoutes(routesDir);
|
|
499
|
+
for (const middleware of routes.filter((route) => route.kind === "middleware")) {
|
|
500
|
+
assertMiddlewareExports(readFileSync(middleware.file, "utf8"), middleware.file);
|
|
501
|
+
}
|
|
338
502
|
await generateTypes({
|
|
339
503
|
routesDir,
|
|
340
504
|
configPath: configFilePath,
|
|
@@ -362,13 +526,16 @@ function renderConfigModule(root, configFilePath) {
|
|
|
362
526
|
function renderServerEntryDev(routesDir, eagerImports) {
|
|
363
527
|
return [
|
|
364
528
|
"// Generated by @moons. Jangan diubah manual.",
|
|
365
|
-
'import { createRequestHandler } from "@moonsjs/vite/server";',
|
|
529
|
+
'import { createPluginRuntime, createRequestHandler } from "@moonsjs/vite/server";',
|
|
366
530
|
'import config from "virtual:moons/config";',
|
|
367
531
|
'import { routes, loadRoute } from "virtual:moons/routes";',
|
|
532
|
+
'import { apiRoutes, apiMiddlewares, loadApi, loadApiMiddleware } from "virtual:moons/api";',
|
|
368
533
|
...eagerImports.map((specifier) => `import ${JSON.stringify(specifier)};`),
|
|
369
534
|
"",
|
|
370
|
-
"export function
|
|
371
|
-
|
|
535
|
+
"export function createDevApp(shell, payloadScan) {",
|
|
536
|
+
" const plugins = createPluginRuntime({ config, routes, middlewares: config.middleware ?? [] });",
|
|
537
|
+
` const handler = createRequestHandler({ routes, apiRoutes, apiMiddlewares, loadApi, loadApiMiddleware, config, routesDir: ${JSON.stringify(routesDir)}, loadRoute, shell, onContext: (ctx) => plugins.applyExtensions(ctx), ...(payloadScan === undefined ? {} : { payloadScan }) });`,
|
|
538
|
+
" return { handler, plugins };",
|
|
372
539
|
"}",
|
|
373
540
|
""
|
|
374
541
|
].join(`
|
|
@@ -377,11 +544,38 @@ function renderServerEntryDev(routesDir, eagerImports) {
|
|
|
377
544
|
function renderServerEntryBuild(routesDir, eagerImports) {
|
|
378
545
|
return [
|
|
379
546
|
"// Generated by @moons. Jangan diubah manual.",
|
|
380
|
-
'import { createFileShell, createRequestHandler, startNodeServer } from "@moonsjs/vite/server";',
|
|
547
|
+
'import { createFileShell, createPluginRuntime, createRequestHandler, startNodeServer } from "@moonsjs/vite/server";',
|
|
381
548
|
'import config from "virtual:moons/config";',
|
|
382
549
|
'import { routes, loadRoute } from "virtual:moons/routes";',
|
|
550
|
+
'import { apiRoutes, apiMiddlewares, loadApi, loadApiMiddleware } from "virtual:moons/api";',
|
|
383
551
|
...eagerImports.map((specifier) => `import ${JSON.stringify(specifier)};`),
|
|
384
552
|
"",
|
|
553
|
+
"const plugins = createPluginRuntime({ config, routes, middlewares: config.middleware ?? [] });",
|
|
554
|
+
"const handler = createRequestHandler({",
|
|
555
|
+
" routes,",
|
|
556
|
+
" apiRoutes,",
|
|
557
|
+
" apiMiddlewares,",
|
|
558
|
+
" loadApi,",
|
|
559
|
+
" loadApiMiddleware,",
|
|
560
|
+
" config,",
|
|
561
|
+
` routesDir: ${JSON.stringify(routesDir)},`,
|
|
562
|
+
" loadRoute,",
|
|
563
|
+
" shell: createFileShell(),",
|
|
564
|
+
" onContext: (ctx) => plugins.applyExtensions(ctx),",
|
|
565
|
+
"});",
|
|
566
|
+
"",
|
|
567
|
+
"startNodeServer(handler, { plugins });",
|
|
568
|
+
""
|
|
569
|
+
].join(`
|
|
570
|
+
`);
|
|
571
|
+
}
|
|
572
|
+
function renderPrerenderEntry(routesDir, projectRoot, canary) {
|
|
573
|
+
return [
|
|
574
|
+
"// Generated by @moons. Jangan diubah manual.",
|
|
575
|
+
'import { createFileShell, createRequestHandler, runPrerender } from "@moonsjs/vite/server";',
|
|
576
|
+
'import config from "virtual:moons/config";',
|
|
577
|
+
'import { routes, loadRoute } from "virtual:moons/routes";',
|
|
578
|
+
"",
|
|
385
579
|
"const handler = createRequestHandler({",
|
|
386
580
|
" routes,",
|
|
387
581
|
" config,",
|
|
@@ -390,7 +584,14 @@ function renderServerEntryBuild(routesDir, eagerImports) {
|
|
|
390
584
|
" shell: createFileShell(),",
|
|
391
585
|
"});",
|
|
392
586
|
"",
|
|
393
|
-
"
|
|
587
|
+
"await runPrerender({",
|
|
588
|
+
" routes,",
|
|
589
|
+
` routesDir: ${JSON.stringify(routesDir)},`,
|
|
590
|
+
" loadRoute,",
|
|
591
|
+
" handler,",
|
|
592
|
+
` clientDir: ${JSON.stringify(resolvePath(projectRoot, "dist/client"))},`,
|
|
593
|
+
...canary === undefined ? [] : [` canary: ${JSON.stringify(canary)},`],
|
|
594
|
+
"});",
|
|
394
595
|
""
|
|
395
596
|
].join(`
|
|
396
597
|
`);
|
|
@@ -421,4 +622,4 @@ export {
|
|
|
421
622
|
moons as default
|
|
422
623
|
};
|
|
423
624
|
|
|
424
|
-
//# debugId=
|
|
625
|
+
//# debugId=A95BB7BDEDB4BA9A64756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/plugin.ts", "../src/leak-check.ts"],
|
|
3
|
+
"sources": ["../src/plugin.ts", "../src/api.ts", "../src/leak-check.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { createHash } from \"node:crypto\";\nimport { resolve as resolvePath } from \"node:path\";\nimport {\n MoonsError,\n fnRegistryKey,\n generateTypes,\n scanRoutes,\n validateConfig,\n type RouteDefinition,\n} from \"@moonsjs/core\";\nimport { loadConfigFromFile, type Plugin, type ViteDevServer } from \"vite\";\nimport { findLeak } from \"./leak-check\";\nimport { renderRoutesModule, rootSpecifier } from \"./manifest\";\nimport { installDevMiddleware } from \"./server/dev\";\nimport {\n analyzeServerFile,\n checkClientModuleImports,\n checkRouteModuleExports,\n injectServerFnMeta,\n isNonContractServerFile,\n isServerFilePath,\n nonContractServerFileError,\n renderServerFnStub,\n resolveServerSpecifierSync,\n scanServerFiles,\n stripQuery,\n type ServerFileAnalysis,\n} from \"./transform\";\nimport { fromNullPrefixed, VIRTUAL_MODULES } from \"./virtual-modules\";\n\nexport interface MoonsVitePluginOptions {\n /** Default: \"moons.config.ts\". */\n configPath?: string;\n /** Hanya dipakai di CI (M2 §21). */\n leakTest?: { canary?: string };\n /** Default: root Vite. */\n projectRoot?: string;\n}\n\n/**\n * Plugin `@moonsjs/vite` (PRD §9): scan route, typegen, virtual module,\n * dev SSR middleware, build client + server.\n */\nconst CODE_FILE_PATTERN = /\\.(ts|tsx|js|jsx|mjs|cjs|mts|cts)$/;\n\nexport default function moons(options: MoonsVitePluginOptions = {}): Plugin {\n let root = options.projectRoot ?? process.cwd();\n let isSsrBuild = false;\n let configFilePath = \"\";\n let routesDir = \"\";\n let routes: RouteDefinition[] = [];\n let analysisCache = new Map<string, ServerFileAnalysis>();\n const stubTransformed = new Set<string>();\n\n function analyzeFile(absoluteFile: string): ServerFileAnalysis | null {\n const cached = analysisCache.get(absoluteFile);\n if (cached !== undefined) {\n return cached;\n }\n let source: string;\n try {\n source = readFileSync(absoluteFile, \"utf8\");\n } catch {\n return null;\n }\n const analysis = analyzeServerFile(source, absoluteFile, root);\n analysisCache.set(absoluteFile, analysis);\n return analysis;\n }\n\n function refreshServerFns(): void {\n const next = new Map<string, ServerFileAnalysis>();\n const registry: Record<string, string> = {};\n\n for (const file of scanServerFiles(root)) {\n let source: string;\n try {\n source = readFileSync(file, \"utf8\");\n } catch {\n continue;\n }\n const analysis = analyzeServerFile(source, file, root);\n next.set(file, analysis);\n for (const fn of analysis.serverFns) {\n registry[fnRegistryKey(root, file, fn.name)] = fn.hash;\n }\n }\n\n analysisCache = next;\n const outDir = resolvePath(root, \".moons\");\n mkdirSync(outDir, { recursive: true });\n writeFileSync(\n resolvePath(outDir, \"fn-registry.json\"),\n `${JSON.stringify(registry, null, 2)}\\n`,\n \"utf8\",\n );\n }\n\n /** Semua specifier file `.server.ts` yang punya serverFn (untuk eager import di entry server). */\n function serverFnFileSpecifiers(): string[] {\n const specifiers: string[] = [];\n for (const [file, analysis] of analysisCache) {\n if (analysis.serverFns.length > 0) {\n specifiers.push(rootSpecifier(root, file));\n }\n }\n return specifiers.sort();\n }\n\n /** Stub client §12.2 + cache §12.2.5. */\n function transformServerFileClient(code: string, id: string): string {\n const relativePath = id.startsWith(root)\n ? id.slice(root.length).split(\"\\\\\").join(\"/\")\n : id;\n const cacheKey = createHash(\"sha256\").update(`${relativePath}\\0${code}`).digest(\"hex\");\n const cacheFile = resolvePath(root, \".moons/cache\", `${cacheKey}.js`);\n\n if (existsSync(cacheFile)) {\n stubTransformed.add(id);\n return readFileSync(cacheFile, \"utf8\");\n }\n\n const analysis = analyzeFile(id);\n if (analysis === null) {\n throw new MoonsError({\n code: \"E_INTERNAL\",\n file: id,\n message: \"gagal membaca file server untuk transform\",\n details: \"File `.server.ts` harus bisa dibaca saat transform (PRD §12.2).\",\n suggestions: [\"Periksa path dan izin file\"],\n });\n }\n\n const stub = renderServerFnStub(code, id, analysis, {\n analyzeSpecifier: (sourceFile, specifier) => {\n const resolved = resolveServerSpecifierSync(sourceFile, specifier);\n return resolved === null ? null : analyzeFile(resolved);\n },\n });\n\n mkdirSync(resolvePath(root, \".moons/cache\"), { recursive: true });\n writeFileSync(cacheFile, stub.code, \"utf8\");\n stubTransformed.add(id);\n return stub.code;\n }\n\n return {\n name: \"moons\",\n enforce: \"pre\",\n\n config(_config, env) {\n isSsrBuild = env.isSsrBuild === true;\n const common = {\n appType: \"custom\" as const,\n };\n\n if (isSsrBuild) {\n return {\n ...common,\n build: {\n outDir: \"dist/server\",\n emptyOutDir: true,\n // Entry nyata yang di-generate saat buildStart (Rolldown butuh file,\n // entry virtual tidak di-resolve lewat plugin container).\n ssr: \".moons/server-entry.ts\",\n rollupOptions: { output: { entryFileNames: \"index.js\", codeSplitting: false } },\n },\n ssr: { noExternal: true, target: \"node\" as const },\n };\n }\n\n return {\n ...common,\n build: { outDir: \"dist/client\", emptyOutDir: true },\n // Dev SSR: paket framework WAJIB di-inline ke pipeline Vite. Sejak\n // dipublikasikan, `@moonsjs/*` adalah package node_modules biasa (bukan\n // workspace-link) sehingga default Vite mengeksternalnya; import runtime\n // (bun) menyelesaikannya lewat kondisi `bun` → `src`, sedangkan modul\n // route diselesaikan Vite → `dist` — dua instans React context →\n // \"useLoaderData dipanggil di luar render route\" (temuan eval T4;\n // docs/decisions/0015). Inline → semua konsisten lewat Vite.\n ssr: { noExternal: [/^@moonsjs\\//] },\n };\n },\n\n async configResolved(resolved) {\n root = options.projectRoot ?? resolved.root;\n configFilePath = resolvePath(root, options.configPath ?? \"moons.config.ts\");\n\n if (!existsSync(configFilePath)) {\n throw new MoonsError({\n code: \"E_CONFIG_INVALID\",\n file: configFilePath,\n message: \"`moons.config.ts` tidak ditemukan\",\n details: \"Framework membutuhkan file config di root project (PRD §14.3).\",\n suggestions: [\n \"Buat `moons.config.ts` dengan `export default defineConfig({ context: async (req) => ({}) })`\",\n ],\n });\n }\n\n let raw: unknown;\n try {\n const loaded = await loadConfigFromFile(\n { command: resolved.command, mode: resolved.mode },\n configFilePath,\n root,\n );\n raw = loaded?.config;\n } catch (error) {\n if (error instanceof MoonsError) {\n throw error;\n }\n throw new MoonsError({\n code: \"E_CONFIG_INVALID\",\n file: configFilePath,\n message: \"gagal memuat `moons.config.ts`\",\n details: error instanceof Error ? error.message : String(error),\n suggestions: [\"Periksa sintaks dan import di `moons.config.ts`\"],\n });\n }\n\n const config = validateConfig(raw, { file: configFilePath, projectRoot: root });\n routesDir = resolvePath(root, config.routesDir);\n },\n\n async buildStart() {\n routes = scanRoutes(routesDir);\n await generateTypes({\n routesDir,\n configPath: configFilePath,\n outDir: resolvePath(root, \".moons\"),\n });\n refreshServerFns();\n if (isSsrBuild) {\n writeFileSync(\n resolvePath(root, \".moons/server-entry.ts\"),\n renderServerEntryBuild(routesDir, serverFnFileSpecifiers()),\n \"utf8\",\n );\n }\n },\n\n resolveId(id) {\n const clean = id.startsWith(\"\\0\") ? id.slice(1) : id;\n if ((Object.values(VIRTUAL_MODULES) as string[]).includes(clean)) {\n return `\\0${clean}`;\n }\n return undefined;\n },\n\n load(id) {\n const name = fromNullPrefixed(id);\n if (name === null) {\n return undefined;\n }\n switch (name) {\n case VIRTUAL_MODULES.routes:\n return renderRoutesModule(routes, routesDir, root);\n case VIRTUAL_MODULES.clientEntry:\n return '// Generated by @moons. Jangan diubah manual.\\nexport { clientManifest, loadRoute } from \"virtual:moons/routes\";\\n';\n case VIRTUAL_MODULES.config:\n return renderConfigModule(root, configFilePath);\n case VIRTUAL_MODULES.serverEntry:\n // Hanya dipakai dev (ssrLoadModule); build memakai .moons/server-entry.ts.\n return renderServerEntryDev(routesDir, serverFnFileSpecifiers());\n }\n },\n\n async transform(code, id) {\n const cleanId = stripQuery(id);\n if (cleanId.startsWith(\"\\0\") || cleanId.includes(\"/node_modules/\")) {\n return undefined;\n }\n\n const environment = environmentName(this);\n\n if (isServerFilePath(cleanId)) {\n if (environment === \"ssr\") {\n const analysis = analysisCache.get(cleanId) ?? analyzeFile(cleanId);\n if (analysis === null || analysis.serverFns.length === 0) {\n return undefined;\n }\n return injectServerFnMeta(code, analysis, root);\n }\n return transformServerFileClient(code, cleanId);\n }\n\n // Audit ronde 2: file server di luar kontrak §12 tidak bisa di-stub —\n // jangan pernah biarkan masuk graph client.\n if (environment !== \"ssr\" && isNonContractServerFile(cleanId)) {\n throw nonContractServerFileError(cleanId, root);\n }\n\n if (environment !== \"ssr\" && CODE_FILE_PATTERN.test(cleanId)) {\n if (cleanId.startsWith(routesDir) && cleanId.endsWith(\".tsx\")) {\n checkRouteModuleExports({\n file: cleanId,\n code,\n routesDir,\n projectRoot: root,\n });\n }\n await checkClientModuleImports({\n file: cleanId,\n code,\n projectRoot: root,\n // Resolusi penuh (alias Vite, tsconfig paths, symlink) — audit ronde 2.\n resolve: async (specifier, importer) => {\n try {\n const resolved = await this.resolve(specifier, importer);\n return resolved === null ? null : stripQuery(resolved.id);\n } catch {\n return null;\n }\n },\n analyze: (absoluteFile) => analysisCache.get(absoluteFile) ?? analyzeFile(absoluteFile),\n });\n }\n\n return undefined;\n },\n\n generateBundle(_options, bundle) {\n if (environmentName(this) === \"ssr\") {\n return;\n }\n\n const canary = options.leakTest?.canary;\n if (canary !== undefined && canary.length > 0) {\n const leak = findLeak(Object.values(bundle), canary);\n if (leak !== null) {\n throw new MoonsError({\n code: \"E_INTERNAL\",\n message: `canary \\`${canary}\\` ditemukan di bundle client (${leak.fileName})`,\n details:\n \"Verifikasi kebocoran §2/§9.2.8 gagal: kode server bocor ke output client. Build dihentikan.\",\n suggestions: [\n \"Periksa transform `*.server.ts` (§12)\",\n \"Jalankan `./scripts/m2/test-leak.sh` untuk audit\",\n ],\n });\n }\n }\n\n for (const output of Object.values(bundle)) {\n if (output.type !== \"chunk\") {\n continue;\n }\n for (const moduleId of Object.keys(output.modules)) {\n const cleanId = stripQuery(moduleId);\n if (!isServerFilePath(cleanId) || stubTransformed.has(cleanId)) {\n continue;\n }\n throw new MoonsError({\n code: \"E_FORBIDDEN_SERVER_IMPORT\",\n file: cleanId,\n message: \"modul server ikut ter-bundle di client tanpa melewati transform\",\n details:\n \"Verifikasi build §9.2: setiap `*.server.ts` di bundle client wajib berupa stub RPC hasil transform.\",\n suggestions: [\n \"Pastikan transform zero-trust (§12) berjalan untuk modul ini\",\n \"Laporkan ini sebagai bug framework jika berulang\",\n ],\n });\n }\n }\n },\n\n configureServer(server) {\n installDevMiddleware(server, { templatePath: resolvePath(root, \"index.html\") });\n },\n\n async handleHotUpdate(context) {\n if (isServerFilePath(context.file)) {\n refreshServerFns();\n context.server.ws.send({ type: \"full-reload\" });\n return;\n }\n\n if (!context.file.startsWith(routesDir)) {\n return;\n }\n\n try {\n routes = scanRoutes(routesDir);\n await generateTypes({\n routesDir,\n configPath: configFilePath,\n outDir: resolvePath(root, \".moons\"),\n });\n } catch (error) {\n context.server.config.logger.error(String(error));\n return;\n }\n\n invalidateVirtualModules(context.server);\n context.server.ws.send({ type: \"full-reload\" });\n },\n };\n}\n\nfunction renderConfigModule(root: string, configFilePath: string): string {\n return [\n \"// Generated by @moons. Jangan diubah manual.\",\n `import raw from ${JSON.stringify(rootSpecifier(root, configFilePath))};`,\n 'import { validateConfig } from \"@moonsjs/core\";',\n `export default validateConfig(raw, { file: ${JSON.stringify(configFilePath)} });`,\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderServerEntryDev(routesDir: string, eagerImports: string[]): string {\n return [\n \"// Generated by @moons. Jangan diubah manual.\",\n 'import { createRequestHandler } from \"@moonsjs/vite/server\";',\n 'import config from \"virtual:moons/config\";',\n 'import { routes, loadRoute } from \"virtual:moons/routes\";',\n ...eagerImports.map((specifier) => `import ${JSON.stringify(specifier)};`),\n \"\",\n \"export function createDevHandler(shell) {\",\n ` return createRequestHandler({ routes, config, routesDir: ${JSON.stringify(routesDir)}, loadRoute, shell });`,\n \"}\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderServerEntryBuild(routesDir: string, eagerImports: string[]): string {\n return [\n \"// Generated by @moons. Jangan diubah manual.\",\n 'import { createFileShell, createRequestHandler, startNodeServer } from \"@moonsjs/vite/server\";',\n 'import config from \"virtual:moons/config\";',\n 'import { routes, loadRoute } from \"virtual:moons/routes\";',\n ...eagerImports.map((specifier) => `import ${JSON.stringify(specifier)};`),\n \"\",\n \"const handler = createRequestHandler({\",\n \" routes,\",\n \" config,\",\n ` routesDir: ${JSON.stringify(routesDir)},`,\n \" loadRoute,\",\n \" shell: createFileShell(),\",\n \"});\",\n \"\",\n \"startNodeServer(handler);\",\n \"\",\n ].join(\"\\n\");\n}\n\ninterface ModuleGraphLike {\n getModulesByFile(file: string): Iterable<{ id?: string | null }> | undefined;\n invalidateModule(module: unknown): void;\n}\n\nfunction environmentName(context: unknown): string {\n const environment = (context as { environment?: { name?: string } } | undefined)?.environment;\n return environment?.name ?? \"client\";\n}\n\nfunction invalidateVirtualModules(server: ViteDevServer): void {\n const graphs: ModuleGraphLike[] = [server.moduleGraph as unknown as ModuleGraphLike];\n const environments = (server as unknown as { environments?: Record<string, { moduleGraph?: unknown }> })\n .environments;\n if (environments !== undefined) {\n for (const environment of Object.values(environments)) {\n if (environment.moduleGraph !== undefined) {\n graphs.push(environment.moduleGraph as ModuleGraphLike);\n }\n }\n }\n\n for (const graph of graphs) {\n for (const name of Object.values(VIRTUAL_MODULES)) {\n for (const module of graph.getModulesByFile(`\\0${name}`) ?? []) {\n graph.invalidateModule(module);\n }\n }\n }\n}\n",
|
|
5
|
+
"import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { createHash } from \"node:crypto\";\nimport { resolve as resolvePath } from \"node:path\";\nimport {\n MoonsError,\n fnRegistryKey,\n generateTypes,\n scanApiMiddlewares,\n scanApiRoutes,\n scanRoutes,\n validateConfig,\n type ApiMiddlewareDefinition,\n type ApiRouteDefinition,\n type RouteDefinition,\n} from \"@moonsjs/core\";\nimport { loadConfigFromFile, type Plugin, type ViteDevServer } from \"vite\";\nimport { assertApiModuleExports, assertMiddlewareExports } from \"./api\";\nimport { findLeak } from \"./leak-check\";\nimport type { PackageJsonInfo } from \"./server-only\";\nimport { renderApiModule, renderRoutesModule, rootSpecifier } from \"./manifest\";\nimport { installDevMiddleware } from \"./server/dev\";\nimport {\n analyzeServerFile,\n checkClientModuleImports,\n checkRouteModuleExports,\n injectServerFnMeta,\n isNonContractServerFile,\n isServerFilePath,\n nonContractServerFileError,\n renderServerFnStub,\n resolveServerSpecifierSync,\n scanServerFiles,\n stripQuery,\n type ServerFileAnalysis,\n} from \"./transform\";\nimport { fromNullPrefixed, VIRTUAL_MODULES } from \"./virtual-modules\";\n\nexport interface MoonsVitePluginOptions {\n /** Default: \"moons.config.ts\". */\n configPath?: string;\n /** Hanya dipakai di CI (M2 §21). */\n leakTest?: { canary?: string };\n /** Default: root Vite. */\n projectRoot?: string;\n}\n\n/**\n * Plugin `@moonsjs/vite` (PRD §9): scan route, typegen, virtual module,\n * dev SSR middleware, build client + server.\n */\nconst CODE_FILE_PATTERN = /\\.(ts|tsx|js|jsx|mjs|cjs|mts|cts)$/;\n\nexport default function moons(options: MoonsVitePluginOptions = {}): Plugin {\n let root = options.projectRoot ?? process.cwd();\n let isSsrBuild = false;\n let configFilePath = \"\";\n let routesDir = \"\";\n let serverOnlyPackages: ReadonlyArray<string> = [];\n let apiDir = \"\";\n let apiRoutes: ApiRouteDefinition[] = [];\n let apiMiddlewares: ApiMiddlewareDefinition[] = [];\n /** Cache package.json untuk gate Addendum C (dibagi lintas modul). */\n const packageCache = new Map<string, PackageJsonInfo | null>(); let routes: RouteDefinition[] = [];\n let analysisCache = new Map<string, ServerFileAnalysis>();\n const stubTransformed = new Set<string>();\n\n function analyzeFile(absoluteFile: string): ServerFileAnalysis | null {\n const cached = analysisCache.get(absoluteFile);\n if (cached !== undefined) {\n return cached;\n }\n let source: string;\n try {\n source = readFileSync(absoluteFile, \"utf8\");\n } catch {\n return null;\n }\n const analysis = analyzeServerFile(source, absoluteFile, root);\n analysisCache.set(absoluteFile, analysis);\n return analysis;\n }\n\n function refreshServerFns(): void {\n const next = new Map<string, ServerFileAnalysis>();\n const registry: Record<string, string> = {};\n\n for (const file of scanServerFiles(root)) {\n let source: string;\n try {\n source = readFileSync(file, \"utf8\");\n } catch {\n continue;\n }\n const analysis = analyzeServerFile(source, file, root);\n next.set(file, analysis);\n for (const fn of analysis.serverFns) {\n registry[fnRegistryKey(root, file, fn.name)] = fn.hash;\n }\n }\n\n analysisCache = next;\n const outDir = resolvePath(root, \".moons\");\n mkdirSync(outDir, { recursive: true });\n writeFileSync(\n resolvePath(outDir, \"fn-registry.json\"),\n `${JSON.stringify(registry, null, 2)}\\n`,\n \"utf8\",\n );\n }\n\n /** Semua specifier file `.server.ts` yang punya serverFn (untuk eager import di entry server). */\n function serverFnFileSpecifiers(): string[] {\n const specifiers: string[] = [];\n for (const [file, analysis] of analysisCache) {\n if (analysis.serverFns.length > 0) {\n specifiers.push(rootSpecifier(root, file));\n }\n }\n return specifiers.sort();\n }\n\n /** Stub client §12.2 + cache §12.2.5. */\n function transformServerFileClient(code: string, id: string): string {\n const relativePath = id.startsWith(root)\n ? id.slice(root.length).split(\"\\\\\").join(\"/\")\n : id;\n const cacheKey = createHash(\"sha256\").update(`${relativePath}\\0${code}`).digest(\"hex\");\n const cacheFile = resolvePath(root, \".moons/cache\", `${cacheKey}.js`);\n\n if (existsSync(cacheFile)) {\n stubTransformed.add(id);\n return readFileSync(cacheFile, \"utf8\");\n }\n\n const analysis = analyzeFile(id);\n if (analysis === null) {\n throw new MoonsError({\n code: \"E_INTERNAL\",\n file: id,\n message: \"gagal membaca file server untuk transform\",\n details: \"File `.server.ts` harus bisa dibaca saat transform (PRD §12.2).\",\n suggestions: [\"Periksa path dan izin file\"],\n });\n }\n\n const stub = renderServerFnStub(code, id, analysis, {\n analyzeSpecifier: (sourceFile, specifier) => {\n const resolved = resolveServerSpecifierSync(sourceFile, specifier);\n return resolved === null ? null : analyzeFile(resolved);\n },\n });\n\n mkdirSync(resolvePath(root, \".moons/cache\"), { recursive: true });\n writeFileSync(cacheFile, stub.code, \"utf8\");\n stubTransformed.add(id);\n return stub.code;\n }\n\n return {\n name: \"moons\",\n enforce: \"pre\",\n\n config(_config, env) {\n isSsrBuild = env.isSsrBuild === true;\n const common = {\n appType: \"custom\" as const,\n };\n\n if (isSsrBuild) {\n return {\n ...common,\n build: {\n outDir: \"dist/server\",\n emptyOutDir: true,\n // Entry nyata yang di-generate saat buildStart (Rolldown butuh file,\n // entry virtual tidak di-resolve lewat plugin container).\n // D.5: dua entry — server (index) + prerender runner.\n ssr: true,\n rollupOptions: {\n input: {\n index: \".moons/server-entry.ts\",\n prerender: \".moons/prerender-entry.ts\",\n },\n output: {\n entryFileNames: \"[name].js\",\n chunkFileNames: \"chunks/[name]-[hash].js\",\n },\n },\n },\n ssr: { noExternal: true, target: \"node\" as const },\n };\n }\n\n return {\n ...common,\n build: { outDir: \"dist/client\", emptyOutDir: true },\n // Dev SSR: paket framework WAJIB di-inline ke pipeline Vite. Sejak\n // dipublikasikan, `@moonsjs/*` adalah package node_modules biasa (bukan\n // workspace-link) sehingga default Vite mengeksternalnya; import runtime\n // (bun) menyelesaikannya lewat kondisi `bun` → `src`, sedangkan modul\n // route diselesaikan Vite → `dist` — dua instans React context →\n // \"useLoaderData dipanggil di luar render route\" (temuan eval T4;\n // docs/decisions/0015). Inline → semua konsisten lewat Vite.\n ssr: { noExternal: [/^@moonsjs\\//] },\n };\n },\n\n async configResolved(resolved) {\n root = options.projectRoot ?? resolved.root;\n configFilePath = resolvePath(root, options.configPath ?? \"moons.config.ts\");\n\n if (!existsSync(configFilePath)) {\n throw new MoonsError({\n code: \"E_CONFIG_INVALID\",\n file: configFilePath,\n message: \"`moons.config.ts` tidak ditemukan\",\n details: \"Framework membutuhkan file config di root project (PRD §14.3).\",\n suggestions: [\n \"Buat `moons.config.ts` dengan `export default defineConfig({ context: async (req) => ({}) })`\",\n ],\n });\n }\n\n let raw: unknown;\n try {\n const loaded = await loadConfigFromFile(\n { command: resolved.command, mode: resolved.mode },\n configFilePath,\n root,\n );\n raw = loaded?.config;\n } catch (error) {\n if (error instanceof MoonsError) {\n throw error;\n }\n throw new MoonsError({\n code: \"E_CONFIG_INVALID\",\n file: configFilePath,\n message: \"gagal memuat `moons.config.ts`\",\n details: error instanceof Error ? error.message : String(error),\n suggestions: [\"Periksa sintaks dan import di `moons.config.ts`\"],\n });\n }\n\n const config = validateConfig(raw, { file: configFilePath, projectRoot: root });\n routesDir = resolvePath(root, config.routesDir);\n serverOnlyPackages = config.security?.serverOnlyPackages ?? [];\n\n // Addendum D.1: scan + validasi statis modul `src/api`.\n apiDir = resolvePath(root, config.apiDir ?? \"src/api\");\n if (existsSync(apiDir)) {\n apiRoutes = scanApiRoutes(apiDir);\n for (const route of apiRoutes) {\n assertApiModuleExports(readFileSync(route.file, \"utf8\"), route.file);\n }\n apiMiddlewares = scanApiMiddlewares(apiDir);\n for (const middleware of apiMiddlewares) {\n assertMiddlewareExports(readFileSync(middleware.file, \"utf8\"), middleware.file);\n }\n } else {\n apiRoutes = [];\n apiMiddlewares = [];\n }\n },\n\n async buildStart() {\n routes = scanRoutes(routesDir);\n // D.3: validasi statis `_middleware.ts` pohon routes.\n for (const middleware of routes.filter((route) => route.kind === \"middleware\")) {\n assertMiddlewareExports(readFileSync(middleware.file, \"utf8\"), middleware.file);\n }\n await generateTypes({\n routesDir,\n configPath: configFilePath,\n outDir: resolvePath(root, \".moons\"),\n });\n refreshServerFns();\n if (isSsrBuild) {\n writeFileSync(\n resolvePath(root, \".moons/server-entry.ts\"),\n renderServerEntryBuild(routesDir, serverFnFileSpecifiers()),\n \"utf8\",\n );\n writeFileSync(\n resolvePath(root, \".moons/prerender-entry.ts\"),\n renderPrerenderEntry(routesDir, root, options.leakTest?.canary),\n \"utf8\",\n );\n }\n },\n\n resolveId(id) {\n const clean = id.startsWith(\"\\0\") ? id.slice(1) : id;\n if ((Object.values(VIRTUAL_MODULES) as string[]).includes(clean)) {\n return `\\0${clean}`;\n }\n return undefined;\n },\n\n load(id) {\n const name = fromNullPrefixed(id);\n if (name === null) {\n return undefined;\n }\n switch (name) {\n case VIRTUAL_MODULES.routes:\n return renderRoutesModule(routes, routesDir, root);\n case VIRTUAL_MODULES.api:\n return renderApiModule(apiRoutes, apiMiddlewares, root);\n case VIRTUAL_MODULES.clientEntry:\n return '// Generated by @moons. Jangan diubah manual.\\nexport { clientManifest, loadRoute } from \"virtual:moons/routes\";\\n';\n case VIRTUAL_MODULES.config:\n return renderConfigModule(root, configFilePath);\n case VIRTUAL_MODULES.serverEntry:\n // Hanya dipakai dev (ssrLoadModule); build memakai .moons/server-entry.ts.\n return renderServerEntryDev(routesDir, serverFnFileSpecifiers());\n }\n },\n\n async transform(code, id) {\n const cleanId = stripQuery(id);\n if (cleanId.startsWith(\"\\0\") || cleanId.includes(\"/node_modules/\")) {\n return undefined;\n }\n\n const environment = environmentName(this);\n\n if (isServerFilePath(cleanId)) {\n if (environment === \"ssr\") {\n const analysis = analysisCache.get(cleanId) ?? analyzeFile(cleanId);\n if (analysis === null || analysis.serverFns.length === 0) {\n return undefined;\n }\n return injectServerFnMeta(code, analysis, root);\n }\n return transformServerFileClient(code, cleanId);\n }\n\n // Audit ronde 2: file server di luar kontrak §12 tidak bisa di-stub —\n // jangan pernah biarkan masuk graph client.\n if (environment !== \"ssr\" && isNonContractServerFile(cleanId)) {\n throw nonContractServerFileError(cleanId, root);\n }\n\n if (environment !== \"ssr\" && CODE_FILE_PATTERN.test(cleanId)) {\n if (cleanId.startsWith(routesDir) && cleanId.endsWith(\".tsx\")) {\n checkRouteModuleExports({\n file: cleanId,\n code,\n routesDir,\n projectRoot: root,\n });\n }\n await checkClientModuleImports({\n file: cleanId,\n code,\n projectRoot: root,\n // Resolusi penuh (alias Vite, tsconfig paths, symlink) — audit ronde 2.\n resolve: async (specifier, importer) => {\n try {\n const resolved = await this.resolve(specifier, importer);\n return resolved === null ? null : stripQuery(resolved.id);\n } catch {\n return null;\n }\n },\n analyze: (absoluteFile) => analysisCache.get(absoluteFile) ?? analyzeFile(absoluteFile),\n apiDir,\n serverOnlyPackages,\n packageCache,\n });\n }\n\n return undefined;\n },\n\n generateBundle(_options, bundle) {\n if (environmentName(this) === \"ssr\") {\n return;\n }\n\n const canary = options.leakTest?.canary;\n if (canary !== undefined && canary.length > 0) {\n const leak = findLeak(Object.values(bundle), canary);\n if (leak !== null) {\n throw new MoonsError({\n code: \"E_INTERNAL\",\n message: `canary \\`${canary}\\` ditemukan di bundle client (${leak.fileName})`,\n details:\n \"Verifikasi kebocoran §2/§9.2.8 gagal: kode server bocor ke output client. Build dihentikan.\",\n suggestions: [\n \"Periksa transform `*.server.ts` (§12)\",\n \"Jalankan `./scripts/m2/test-leak.sh` untuk audit\",\n ],\n });\n }\n }\n\n for (const output of Object.values(bundle)) {\n if (output.type !== \"chunk\") {\n continue;\n }\n for (const moduleId of Object.keys(output.modules)) {\n const cleanId = stripQuery(moduleId);\n if (!isServerFilePath(cleanId) || stubTransformed.has(cleanId)) {\n continue;\n }\n throw new MoonsError({\n code: \"E_FORBIDDEN_SERVER_IMPORT\",\n file: cleanId,\n message: \"modul server ikut ter-bundle di client tanpa melewati transform\",\n details:\n \"Verifikasi build §9.2: setiap `*.server.ts` di bundle client wajib berupa stub RPC hasil transform.\",\n suggestions: [\n \"Pastikan transform zero-trust (§12) berjalan untuk modul ini\",\n \"Laporkan ini sebagai bug framework jika berulang\",\n ],\n });\n }\n }\n },\n\n configureServer(server) {\n installDevMiddleware(server, {\n templatePath: resolvePath(root, \"index.html\"),\n // A1: pemindaian payload SSR hanya di dev (warning), tanpa biaya di production.\n payloadScan: {\n ...(options.leakTest?.canary === undefined ? {} : { canary: options.leakTest.canary }),\n env: process.env,\n },\n // D.1: request ke prefix API (semua method) dirutekan ke runtime.\n ...(apiRoutes.length === 0\n ? {}\n : { apiPrefix: `/${apiDir.split(/[\\\\/]/).filter((part) => part.length > 0).pop() ?? \"api\"}` }),\n });\n },\n\n async handleHotUpdate(context) {\n if (isServerFilePath(context.file)) {\n refreshServerFns();\n context.server.ws.send({ type: \"full-reload\" });\n return;\n }\n\n if (context.file.startsWith(apiDir) && existsSync(apiDir)) {\n try {\n apiRoutes = scanApiRoutes(apiDir);\n for (const route of apiRoutes) {\n assertApiModuleExports(readFileSync(route.file, \"utf8\"), route.file);\n }\n apiMiddlewares = scanApiMiddlewares(apiDir);\n for (const middleware of apiMiddlewares) {\n assertMiddlewareExports(readFileSync(middleware.file, \"utf8\"), middleware.file);\n }\n } catch (error) {\n context.server.config.logger.error(String(error));\n return;\n }\n invalidateVirtualModules(context.server);\n context.server.ws.send({ type: \"full-reload\" });\n return;\n }\n\n if (!context.file.startsWith(routesDir)) {\n return;\n }\n\n try {\n routes = scanRoutes(routesDir);\n for (const middleware of routes.filter((route) => route.kind === \"middleware\")) {\n assertMiddlewareExports(readFileSync(middleware.file, \"utf8\"), middleware.file);\n }\n await generateTypes({\n routesDir,\n configPath: configFilePath,\n outDir: resolvePath(root, \".moons\"),\n });\n } catch (error) {\n context.server.config.logger.error(String(error));\n return;\n }\n\n invalidateVirtualModules(context.server);\n context.server.ws.send({ type: \"full-reload\" });\n },\n };\n}\n\nfunction renderConfigModule(root: string, configFilePath: string): string {\n return [\n \"// Generated by @moons. Jangan diubah manual.\",\n `import raw from ${JSON.stringify(rootSpecifier(root, configFilePath))};`,\n 'import { validateConfig } from \"@moonsjs/core\";',\n `export default validateConfig(raw, { file: ${JSON.stringify(configFilePath)} });`,\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderServerEntryDev(routesDir: string, eagerImports: string[]): string {\n return [\n \"// Generated by @moons. Jangan diubah manual.\",\n 'import { createPluginRuntime, createRequestHandler } from \"@moonsjs/vite/server\";',\n 'import config from \"virtual:moons/config\";',\n 'import { routes, loadRoute } from \"virtual:moons/routes\";',\n 'import { apiRoutes, apiMiddlewares, loadApi, loadApiMiddleware } from \"virtual:moons/api\";',\n ...eagerImports.map((specifier) => `import ${JSON.stringify(specifier)};`),\n \"\",\n \"export function createDevApp(shell, payloadScan) {\",\n \" const plugins = createPluginRuntime({ config, routes, middlewares: config.middleware ?? [] });\",\n ` const handler = createRequestHandler({ routes, apiRoutes, apiMiddlewares, loadApi, loadApiMiddleware, config, routesDir: ${JSON.stringify(routesDir)}, loadRoute, shell, onContext: (ctx) => plugins.applyExtensions(ctx), ...(payloadScan === undefined ? {} : { payloadScan }) });`,\n \" return { handler, plugins };\",\n \"}\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction renderServerEntryBuild(routesDir: string, eagerImports: string[]): string {\n return [\n \"// Generated by @moons. Jangan diubah manual.\",\n 'import { createFileShell, createPluginRuntime, createRequestHandler, startNodeServer } from \"@moonsjs/vite/server\";',\n 'import config from \"virtual:moons/config\";',\n 'import { routes, loadRoute } from \"virtual:moons/routes\";',\n 'import { apiRoutes, apiMiddlewares, loadApi, loadApiMiddleware } from \"virtual:moons/api\";',\n ...eagerImports.map((specifier) => `import ${JSON.stringify(specifier)};`),\n \"\",\n \"const plugins = createPluginRuntime({ config, routes, middlewares: config.middleware ?? [] });\",\n \"const handler = createRequestHandler({\",\n \" routes,\",\n \" apiRoutes,\",\n \" apiMiddlewares,\",\n \" loadApi,\",\n \" loadApiMiddleware,\",\n \" config,\",\n ` routesDir: ${JSON.stringify(routesDir)},`,\n \" loadRoute,\",\n \" shell: createFileShell(),\",\n \" onContext: (ctx) => plugins.applyExtensions(ctx),\",\n \"});\",\n \"\",\n \"startNodeServer(handler, { plugins });\",\n \"\",\n ].join(\"\\n\");\n}\n\ninterface ModuleGraphLike {\n getModulesByFile(file: string): Iterable<{ id?: string | null }> | undefined;\n invalidateModule(module: unknown): void;\n}\n\n/** Entry D.5: runner prerender (dijalankan CLI setelah build server). */\nfunction renderPrerenderEntry(\n routesDir: string,\n projectRoot: string,\n canary: string | undefined,\n): string {\n return [\n \"// Generated by @moons. Jangan diubah manual.\",\n 'import { createFileShell, createRequestHandler, runPrerender } from \"@moonsjs/vite/server\";',\n 'import config from \"virtual:moons/config\";',\n 'import { routes, loadRoute } from \"virtual:moons/routes\";',\n \"\",\n \"const handler = createRequestHandler({\",\n \" routes,\",\n \" config,\",\n ` routesDir: ${JSON.stringify(routesDir)},`,\n \" loadRoute,\",\n \" shell: createFileShell(),\",\n \"});\",\n \"\",\n \"await runPrerender({\",\n \" routes,\",\n ` routesDir: ${JSON.stringify(routesDir)},`,\n \" loadRoute,\",\n \" handler,\",\n ` clientDir: ${JSON.stringify(resolvePath(projectRoot, \"dist/client\"))},`,\n ...(canary === undefined ? [] : [` canary: ${JSON.stringify(canary)},`]),\n \"});\",\n \"\",\n ].join(\"\\n\");\n}\n\nfunction environmentName(context: unknown): string {\n const environment = (context as { environment?: { name?: string } } | undefined)?.environment;\n return environment?.name ?? \"client\";\n}\n\nfunction invalidateVirtualModules(server: ViteDevServer): void {\n const graphs: ModuleGraphLike[] = [server.moduleGraph as unknown as ModuleGraphLike];\n const environments = (server as unknown as { environments?: Record<string, { moduleGraph?: unknown }> })\n .environments;\n if (environments !== undefined) {\n for (const environment of Object.values(environments)) {\n if (environment.moduleGraph !== undefined) {\n graphs.push(environment.moduleGraph as ModuleGraphLike);\n }\n }\n }\n\n for (const graph of graphs) {\n for (const name of Object.values(VIRTUAL_MODULES)) {\n for (const module of graph.getModulesByFile(`\\0${name}`) ?? []) {\n graph.invalidateModule(module);\n }\n }\n }\n}\n",
|
|
6
|
+
"import { parse } from \"@babel/parser\";\nimport { API_METHODS, MoonsError } from \"@moonsjs/core\";\n\n/**\n * Validasi statis export modul `src/api` (PRD Addendum D.1):\n * hanya handler method `GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS` sebagai fungsi;\n * `default`/export lain ditolak → `E_API_HANDLER_INVALID`.\n */\nexport function assertApiModuleExports(code: string, file: string): string[] {\n let ast: unknown;\n try {\n ast = parse(code, {\n sourceType: \"module\",\n plugins: file.endsWith(\".tsx\") ? [\"typescript\", \"jsx\"] : [\"typescript\"],\n });\n } catch {\n return []; // biarkan bundler melaporkan syntax error\n }\n\n const program = (ast as { program?: { body?: Array<Record<string, unknown>> } }).program;\n const body = program?.body ?? [];\n const methods: string[] = [];\n\n for (const statement of body) {\n if (statement[\"type\"] === \"ExportDefaultDeclaration\") {\n throw apiError(\n file,\n \"export `default` tidak didukung di modul API\",\n \"Modul `src/api` hanya mengekspor handler method bernama (PRD Addendum D.1).\",\n [\"Ganti menjadi `export const GET = (args) => …`\", \"Hapus export default\"],\n );\n }\n if (statement[\"type\"] !== \"ExportNamedDeclaration\") {\n continue;\n }\n if (statement[\"source\"] !== undefined) {\n // re-export `export { X } from \"...\"` — nama tetap dicek di bawah.\n }\n const declaration = statement[\"declaration\"] as Record<string, unknown> | undefined;\n if (declaration !== undefined) {\n if (declaration[\"type\"] === \"VariableDeclaration\") {\n for (const declarator of (declaration[\"declarations\"] ?? []) as Array<Record<string, unknown>>) {\n const id = declarator[\"id\"] as Record<string, unknown> | undefined;\n if (id?.[\"type\"] === \"Identifier\") {\n methods.push(id[\"name\"] as string);\n }\n }\n } else if (declaration[\"type\"] === \"FunctionDeclaration\") {\n const id = declaration[\"id\"] as Record<string, unknown> | undefined;\n if (id?.[\"type\"] === \"Identifier\") {\n methods.push(id[\"name\"] as string);\n }\n }\n continue;\n }\n for (const specifier of (statement[\"specifiers\"] ?? []) as Array<Record<string, unknown>>) {\n const exported = specifier[\"exported\"] as Record<string, unknown> | undefined;\n if (exported?.[\"type\"] === \"Identifier\") {\n methods.push(exported[\"name\"] as string);\n }\n }\n }\n\n const illegal = methods.filter((name) => !API_METHODS.includes(name as never));\n if (illegal.length > 0) {\n throw apiError(\n file,\n `export \\`${illegal[0]}\\` bukan handler method yang dikenal`,\n `Handler yang legal: ${API_METHODS.join(\", \")} (PRD Addendum D.1).`,\n [\n \"Ganti nama export menjadi salah satu method HTTP\",\n \"Pindahkan helper ke modul lain (mis. `src/server/…`)\",\n ],\n );\n }\n if (methods.length === 0) {\n throw apiError(\n file,\n \"modul API tanpa handler method\",\n `Wajib ada minimal satu dari ${API_METHODS.join(\", \")} (PRD Addendum D.1).`,\n [`Tambahkan \\`export const GET = (args) => new Response(…)\\``],\n );\n }\n\n return methods;\n}\n\nexport function assertMiddlewareExports(code: string, file: string): void {\n let ast: unknown;\n try {\n ast = parse(code, {\n sourceType: \"module\",\n plugins: file.endsWith(\".tsx\") ? [\"typescript\", \"jsx\"] : [\"typescript\"],\n });\n } catch {\n return;\n }\n const program = (ast as { program?: { body?: Array<Record<string, unknown>> } }).program;\n const hasDefault = (program?.body ?? []).some(\n (statement) => statement[\"type\"] === \"ExportDefaultDeclaration\",\n );\n if (!hasDefault) {\n throw new MoonsError({\n code: \"E_MIDDLEWARE_INVALID\",\n file,\n message: \"`_middleware.ts` tanpa `export default`\",\n details: \"Middleware direktori mengikuti bentuk `Middleware`: `(args) => Promise<Response>` (PRD Addendum D.3).\",\n suggestions: [\n \"Tambahkan `export default async ({ req, ctx, next }) => await next()`\",\n \"Hapus file bila tidak dipakai\",\n ],\n });\n }\n}\n\nfunction apiError(file: string, message: string, details: string, suggestions: string[]): MoonsError {\n return new MoonsError({\n code: \"E_API_HANDLER_INVALID\",\n file,\n message,\n details,\n suggestions,\n });\n}\n",
|
|
6
7
|
"export interface BundleOutputLike {\n type: string;\n fileName?: string;\n code?: string;\n source?: string | Uint8Array;\n}\n\n/**\n * §9.1 (`leakTest.canary`) / §10.4: cari canary pada output bundle client.\n * Dipakai `generateBundle` plugin — build gagal bila canary ditemukan.\n */\nexport function findLeak(\n outputs: Iterable<BundleOutputLike>,\n canary: string,\n decode: (source: Uint8Array) => string = defaultDecode,\n): { fileName: string } | null {\n for (const output of outputs) {\n const fileName = output.fileName ?? \"(unknown)\";\n let text = \"\";\n if (typeof output.code === \"string\") {\n text = output.code;\n } else if (typeof output.source === \"string\") {\n text = output.source;\n } else if (output.source instanceof Uint8Array) {\n text = decode(output.source);\n }\n if (text.includes(canary)) {\n return { fileName };\n }\n }\n return null;\n}\n\nfunction defaultDecode(bytes: Uint8Array): string {\n return new TextDecoder().decode(bytes);\n}\n"
|
|
7
8
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA,oBAAS;AACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;;;ACAO,SAAS,QAAQ,CACtB,SACA,QACA,SAAyC,eACZ;AAAA,EAC7B,WAAW,UAAU,SAAS;AAAA,IAC5B,MAAM,WAAW,OAAO,YAAY;AAAA,IACpC,IAAI,OAAO;AAAA,IACX,IAAI,OAAO,OAAO,SAAS,UAAU;AAAA,MACnC,OAAO,OAAO;AAAA,IAChB,EAAO,SAAI,OAAO,OAAO,WAAW,UAAU;AAAA,MAC5C,OAAO,OAAO;AAAA,IAChB,EAAO,SAAI,OAAO,kBAAkB,YAAY;AAAA,MAC9C,OAAO,OAAO,OAAO,MAAM;AAAA,IAC7B;AAAA,IACA,IAAI,KAAK,SAAS,MAAM,GAAG;AAAA,MACzB,OAAO,EAAE,SAAS;AAAA,IACpB;AAAA,EACF;AAAA,EACA,OAAO;AAAA;AAGT,SAAS,aAAa,CAAC,OAA2B;AAAA,EAChD,OAAO,IAAI,YAAY,EAAE,OAAO,KAAK;AAAA;;;ADUvC,IAAM,oBAAoB;AAE1B,SAAwB,KAAK,CAAC,UAAkC,CAAC,GAAW;AAAA,EAC1E,IAAI,OAAO,QAAQ,eAAe,QAAQ,IAAI;AAAA,EAC9C,IAAI,aAAa;AAAA,EACjB,IAAI,iBAAiB;AAAA,EACrB,IAAI,YAAY;AAAA,EAChB,I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MAAM;AAAA,MAC/B;AAAA,IACF;AAAA,EACF;AAAA;",
|
|
10
|
+
"debugId": "A95BB7BDEDB4BA9A64756E2164756E21",
|
|
10
11
|
"names": []
|
|
11
12
|
}
|
package/dist/manifest.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RouteDefinition } from "@moonsjs/core";
|
|
1
|
+
import { type ApiRouteDefinition, type RouteDefinition } from "@moonsjs/core";
|
|
2
2
|
export interface ClientManifestEntry {
|
|
3
3
|
page: string;
|
|
4
4
|
layouts: string[];
|
|
@@ -11,6 +11,11 @@ export declare const ERROR_ROUTE_KEY = "__moons/error";
|
|
|
11
11
|
* (routeKeyFromFile), nilai = page + layout chain dari root ke leaf.
|
|
12
12
|
*/
|
|
13
13
|
export declare function buildClientManifest(routes: RouteDefinition[], routesDir: string): Record<string, ClientManifestEntry>;
|
|
14
|
+
/** `virtual:moons/api` (Addendum D.1 + D.3): tabel API + middleware + peta import(). */
|
|
15
|
+
export declare function renderApiModule(apiRoutes: ApiRouteDefinition[], apiMiddlewares: ReadonlyArray<{
|
|
16
|
+
file: string;
|
|
17
|
+
dir: string;
|
|
18
|
+
}>, projectRoot: string): string;
|
|
14
19
|
/**
|
|
15
20
|
* Isi `virtual:moons/routes`: daftar RouteDefinition, manifest client, dan
|
|
16
21
|
* peta import() dinamis per file route (specifier root-relative).
|
package/dist/manifest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAG7G,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AACjD,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,EAAE,EACzB,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAgCrC;AAED,wFAAwF;AACxF,wBAAgB,eAAe,CAC7B,SAAS,EAAE,kBAAkB,EAAE,EAC/B,cAAc,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,EAC5D,WAAW,EAAE,MAAM,GAClB,MAAM,CAyBR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,eAAe,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,MAAM,CAmBR;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAIvE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pemindaian payload SSR (nilai A1 / PRD §2): HANYA dipakai di dev sebagai
|
|
3
|
+
* peringatan — tidak ada biaya runtime di production (production tidak pernah
|
|
4
|
+
* memanggil fungsi ini; lihat `RequestHandlerOptions.payloadScan`).
|
|
5
|
+
*/
|
|
6
|
+
export interface PayloadScanOptions {
|
|
7
|
+
/** Canary `leakTest.canary` (bila dikonfigurasi). */
|
|
8
|
+
canary?: string;
|
|
9
|
+
/** Lingkungan server (biasanya `process.env`). */
|
|
10
|
+
env?: Record<string, string | undefined>;
|
|
11
|
+
}
|
|
12
|
+
export interface PayloadScanFinding {
|
|
13
|
+
kind: "canary" | "env";
|
|
14
|
+
/** Label untuk pesan: `canary` atau nama env var. */
|
|
15
|
+
label: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function scanPayloadForSecrets(payload: string, options?: PayloadScanOptions): PayloadScanFinding[];
|
|
18
|
+
//# sourceMappingURL=payload-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-scan.d.ts","sourceRoot":"","sources":["../src/payload-scan.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,QAAQ,GAAG,KAAK,CAAC;IACvB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAWD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,kBAAuB,GAC/B,kBAAkB,EAAE,CAqBtB"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAeA,OAAO,EAAsB,KAAK,MAAM,EAAsB,MAAM,MAAM,CAAC;AAsB3E,MAAM,WAAW,sBAAsB;IACrC,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAQD,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAkb1E"}
|
package/dist/server/dev.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { ViteDevServer } from "vite";
|
|
2
|
+
import type { PayloadScanOptions } from "../payload-scan";
|
|
2
3
|
/**
|
|
3
4
|
* Middleware SSR dev: dipasang sebelum middleware internal Vite, menangani
|
|
4
5
|
* request HTML dan RPC serverFn (`/_moons/fn/*`) — modul/aset tetap Vite.
|
|
6
|
+
* Handler + lifecycle plugin (Addendum B.4) diinisialisasi sekali.
|
|
5
7
|
*/
|
|
6
8
|
export declare function installDevMiddleware(server: ViteDevServer, options: {
|
|
7
9
|
templatePath: string;
|
|
10
|
+
payloadScan?: PayloadScanOptions;
|
|
11
|
+
apiPrefix?: string;
|
|
8
12
|
}): void;
|
|
9
13
|
//# sourceMappingURL=dev.d.ts.map
|
package/dist/server/dev.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/server/dev.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/server/dev.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAkB1D;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACtF,IAAI,CA6BN"}
|