@mobile-reality/mdma-cli 0.1.1 → 0.1.3
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export function serializeConfig(domain, components) {
|
|
2
2
|
const enabled = components.filter((c) => c.enabled);
|
|
3
3
|
const lines = [
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
'## User Configuration',
|
|
5
|
+
'',
|
|
6
6
|
`**Flow Name:** ${domain.name || '(not set)'}`,
|
|
7
7
|
`**Domain:** ${domain.domain || '(not set)'}`,
|
|
8
8
|
`**Description:** ${domain.description || '(not set)'}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/server/dev-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/server/dev-server.ts"],"names":[],"mappings":"AAoBA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwChE"}
|
|
@@ -1,18 +1,57 @@
|
|
|
1
|
-
import { createServer } from '
|
|
1
|
+
import { createServer as createHttpServer } from 'node:http';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
3
4
|
import path from 'node:path';
|
|
5
|
+
import open from 'open';
|
|
4
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const MIME_TYPES = {
|
|
8
|
+
'.html': 'text/html',
|
|
9
|
+
'.js': 'application/javascript',
|
|
10
|
+
'.css': 'text/css',
|
|
11
|
+
'.json': 'application/json',
|
|
12
|
+
'.png': 'image/png',
|
|
13
|
+
'.svg': 'image/svg+xml',
|
|
14
|
+
'.ico': 'image/x-icon',
|
|
15
|
+
'.woff': 'font/woff',
|
|
16
|
+
'.woff2': 'font/woff2',
|
|
17
|
+
};
|
|
5
18
|
export async function startDevServer(port) {
|
|
6
|
-
const appRoot = path.resolve(__dirname, '../../app');
|
|
7
|
-
const server =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
const appRoot = path.resolve(__dirname, '../../app-dist');
|
|
20
|
+
const server = createHttpServer(async (req, res) => {
|
|
21
|
+
let urlPath = req.url?.split('?')[0] ?? '/';
|
|
22
|
+
if (urlPath === '/')
|
|
23
|
+
urlPath = '/index.html';
|
|
24
|
+
const filePath = path.join(appRoot, urlPath);
|
|
25
|
+
// Prevent path traversal
|
|
26
|
+
if (!filePath.startsWith(appRoot)) {
|
|
27
|
+
res.writeHead(403);
|
|
28
|
+
res.end('Forbidden');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const data = await readFile(filePath);
|
|
33
|
+
const ext = path.extname(filePath);
|
|
34
|
+
res.writeHead(200, { 'Content-Type': MIME_TYPES[ext] || 'application/octet-stream' });
|
|
35
|
+
res.end(data);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// SPA fallback — serve index.html for unknown routes
|
|
39
|
+
try {
|
|
40
|
+
const index = await readFile(path.join(appRoot, 'index.html'));
|
|
41
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
42
|
+
res.end(index);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
res.writeHead(404);
|
|
46
|
+
res.end('Not found');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
await new Promise((resolve) => {
|
|
51
|
+
server.listen(port, () => {
|
|
52
|
+
open(`http://localhost:${port}`);
|
|
53
|
+
resolve();
|
|
54
|
+
});
|
|
14
55
|
});
|
|
15
|
-
await server.listen();
|
|
16
|
-
server.printUrls();
|
|
17
56
|
}
|
|
18
57
|
//# sourceMappingURL=dev-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/server/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/server/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,UAAU,GAA2B;IACzC,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,wBAAwB;IAC/B,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,kBAAkB;IAC3B,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,YAAY;CACvB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACjD,IAAI,OAAO,GAAG,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;QAC5C,IAAI,OAAO,KAAK,GAAG;YAAE,OAAO,GAAG,aAAa,CAAC;QAE7C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,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C,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobile-reality/mdma-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mdma": "./dist/bin/mdma.js"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"get-port": "^7.0.0",
|
|
26
26
|
"yaml": "^2.6.0",
|
|
27
27
|
"@mobile-reality/mdma-prompt-pack": "0.1.0",
|
|
28
|
-
"@mobile-reality/mdma-
|
|
29
|
-
"@mobile-reality/mdma-
|
|
28
|
+
"@mobile-reality/mdma-spec": "0.1.0",
|
|
29
|
+
"@mobile-reality/mdma-validator": "0.1.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"typescript": "^5.7.0",
|