@mokup/cli 0.3.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -7
- package/dist/index.mjs +6 -5
- package/package.json +4 -5
package/dist/index.cjs
CHANGED
|
@@ -9,8 +9,8 @@ const node_url = require('node:url');
|
|
|
9
9
|
const esbuild = require('@mokup/shared/esbuild');
|
|
10
10
|
const runtime = require('@mokup/runtime');
|
|
11
11
|
const jsoncParser = require('@mokup/shared/jsonc-parser');
|
|
12
|
-
const nodeServer = require('@hono/node-server');
|
|
13
12
|
const server = require('@mokup/server');
|
|
13
|
+
const node = require('@mokup/server/node');
|
|
14
14
|
const commander = require('commander');
|
|
15
15
|
|
|
16
16
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
@@ -43,12 +43,12 @@ async function writeBundle(outDir, hasHandlers) {
|
|
|
43
43
|
lines.push("", "export default mokupBundle", "export { mokupBundle }", "");
|
|
44
44
|
const dts = [
|
|
45
45
|
"import type { Manifest, ModuleMap } from '@mokup/runtime'",
|
|
46
|
-
"export interface
|
|
46
|
+
"export interface WorkerBundle {",
|
|
47
47
|
" manifest: Manifest",
|
|
48
48
|
" moduleMap?: ModuleMap",
|
|
49
49
|
" moduleBase?: string | URL",
|
|
50
50
|
"}",
|
|
51
|
-
"declare const mokupBundle:
|
|
51
|
+
"declare const mokupBundle: WorkerBundle",
|
|
52
52
|
"export default mokupBundle",
|
|
53
53
|
"export { mokupBundle }",
|
|
54
54
|
""
|
|
@@ -316,8 +316,8 @@ async function writeHandlerIndex(handlerModuleMap, handlersDir, outDir) {
|
|
|
316
316
|
];
|
|
317
317
|
await node_fs.promises.writeFile(pathe.join(handlersDir, "index.mjs"), lines.join("\n"), "utf8");
|
|
318
318
|
const dts = [
|
|
319
|
-
"export type
|
|
320
|
-
"export declare const mokupModuleMap:
|
|
319
|
+
"export type ModuleMap = Record<string, Record<string, unknown>>",
|
|
320
|
+
"export declare const mokupModuleMap: ModuleMap",
|
|
321
321
|
""
|
|
322
322
|
];
|
|
323
323
|
await node_fs.promises.writeFile(pathe.join(handlersDir, "index.d.ts"), dts.join("\n"), "utf8");
|
|
@@ -809,7 +809,7 @@ function createCli() {
|
|
|
809
809
|
const playgroundEnabled = serveOptions.playground !== false;
|
|
810
810
|
const playgroundPath = "/_mokup";
|
|
811
811
|
const server$1 = await server.createFetchServer(serveOptions);
|
|
812
|
-
const nodeServer
|
|
812
|
+
const nodeServer = node.serve(
|
|
813
813
|
{
|
|
814
814
|
fetch: server$1.fetch,
|
|
815
815
|
hostname: host,
|
|
@@ -824,13 +824,14 @@ function createCli() {
|
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
);
|
|
827
|
+
server$1.injectWebSocket?.(nodeServer);
|
|
827
828
|
const shutdown = async () => {
|
|
828
829
|
try {
|
|
829
830
|
if (server$1.close) {
|
|
830
831
|
await server$1.close();
|
|
831
832
|
}
|
|
832
833
|
await new Promise((resolve, reject) => {
|
|
833
|
-
nodeServer
|
|
834
|
+
nodeServer.close((error) => {
|
|
834
835
|
if (error) {
|
|
835
836
|
reject(error);
|
|
836
837
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { pathToFileURL } from 'node:url';
|
|
|
7
7
|
import { build } from '@mokup/shared/esbuild';
|
|
8
8
|
import { parseRouteTemplate, compareRouteScore } from '@mokup/runtime';
|
|
9
9
|
import { parse } from '@mokup/shared/jsonc-parser';
|
|
10
|
-
import { serve } from '@hono/node-server';
|
|
11
10
|
import { createFetchServer } from '@mokup/server';
|
|
11
|
+
import { serve } from '@mokup/server/node';
|
|
12
12
|
import { Command } from 'commander';
|
|
13
13
|
|
|
14
14
|
async function writeBundle(outDir, hasHandlers) {
|
|
@@ -36,12 +36,12 @@ async function writeBundle(outDir, hasHandlers) {
|
|
|
36
36
|
lines.push("", "export default mokupBundle", "export { mokupBundle }", "");
|
|
37
37
|
const dts = [
|
|
38
38
|
"import type { Manifest, ModuleMap } from '@mokup/runtime'",
|
|
39
|
-
"export interface
|
|
39
|
+
"export interface WorkerBundle {",
|
|
40
40
|
" manifest: Manifest",
|
|
41
41
|
" moduleMap?: ModuleMap",
|
|
42
42
|
" moduleBase?: string | URL",
|
|
43
43
|
"}",
|
|
44
|
-
"declare const mokupBundle:
|
|
44
|
+
"declare const mokupBundle: WorkerBundle",
|
|
45
45
|
"export default mokupBundle",
|
|
46
46
|
"export { mokupBundle }",
|
|
47
47
|
""
|
|
@@ -309,8 +309,8 @@ async function writeHandlerIndex(handlerModuleMap, handlersDir, outDir) {
|
|
|
309
309
|
];
|
|
310
310
|
await promises.writeFile(join(handlersDir, "index.mjs"), lines.join("\n"), "utf8");
|
|
311
311
|
const dts = [
|
|
312
|
-
"export type
|
|
313
|
-
"export declare const mokupModuleMap:
|
|
312
|
+
"export type ModuleMap = Record<string, Record<string, unknown>>",
|
|
313
|
+
"export declare const mokupModuleMap: ModuleMap",
|
|
314
314
|
""
|
|
315
315
|
];
|
|
316
316
|
await promises.writeFile(join(handlersDir, "index.d.ts"), dts.join("\n"), "utf8");
|
|
@@ -817,6 +817,7 @@ function createCli() {
|
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
);
|
|
820
|
+
server.injectWebSocket?.(nodeServer);
|
|
820
821
|
const shutdown = async () => {
|
|
821
822
|
try {
|
|
822
823
|
if (server.close) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mokup/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "CLI for building mokup manifests and handlers.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://mokup.icebreaker.top",
|
|
@@ -27,11 +27,10 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@hono/node-server": "^1.19.9",
|
|
31
30
|
"commander": "^14.0.0",
|
|
32
|
-
"@mokup/runtime": "0.
|
|
33
|
-
"@mokup/
|
|
34
|
-
"@mokup/
|
|
31
|
+
"@mokup/runtime": "1.0.0",
|
|
32
|
+
"@mokup/server": "1.0.3",
|
|
33
|
+
"@mokup/shared": "1.0.0"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
37
36
|
"@types/node": "^25.0.9",
|