@mobile-reality/mdma-cli 0.1.0 → 0.1.2
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/LICENSE +21 -0
- package/dist/prompts/serialize-config.js +2 -2
- package/dist/server/dev-server.d.ts.map +1 -1
- package/dist/server/dev-server.js +49 -11
- package/dist/server/dev-server.js.map +1 -1
- package/package.json +30 -21
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Marcin Sadowski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -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,56 @@
|
|
|
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
|
+
}
|
|
14
49
|
});
|
|
15
|
-
|
|
16
|
-
|
|
50
|
+
server.listen(port, () => {
|
|
51
|
+
open(`http://localhost:${port}`);
|
|
52
|
+
});
|
|
53
|
+
// Keep the process alive
|
|
54
|
+
await new Promise(() => { });
|
|
17
55
|
}
|
|
18
56
|
//# 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,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.js"
|
|
@@ -17,24 +17,16 @@
|
|
|
17
17
|
"default": "./dist/prompts/master-prompt.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc -p tsconfig.json",
|
|
22
|
-
"build:app": "vite build --config app/vite.config.ts",
|
|
23
|
-
"dev": "node dist/bin/mdma.js",
|
|
24
|
-
"test": "vitest run",
|
|
25
|
-
"lint": "biome lint src/",
|
|
26
|
-
"typecheck": "tsc --noEmit"
|
|
27
|
-
},
|
|
28
20
|
"dependencies": {
|
|
29
|
-
"@mobile-reality/mdma-prompt-pack": "workspace:*",
|
|
30
|
-
"@mobile-reality/mdma-validator": "workspace:*",
|
|
31
|
-
"@mobile-reality/mdma-spec": "workspace:*",
|
|
32
21
|
"commander": "^12.0.0",
|
|
33
22
|
"chalk": "^5.3.0",
|
|
34
23
|
"globby": "^14.0.0",
|
|
35
24
|
"open": "^10.0.0",
|
|
36
25
|
"get-port": "^7.0.0",
|
|
37
|
-
"yaml": "^2.6.0"
|
|
26
|
+
"yaml": "^2.6.0",
|
|
27
|
+
"@mobile-reality/mdma-prompt-pack": "0.1.0",
|
|
28
|
+
"@mobile-reality/mdma-spec": "0.1.0",
|
|
29
|
+
"@mobile-reality/mdma-validator": "0.1.0"
|
|
38
30
|
},
|
|
39
31
|
"devDependencies": {
|
|
40
32
|
"typescript": "^5.7.0",
|
|
@@ -45,13 +37,30 @@
|
|
|
45
37
|
"react-dom": "^19.0.0",
|
|
46
38
|
"@types/react": "^19.0.0",
|
|
47
39
|
"@types/react-dom": "^19.0.0",
|
|
48
|
-
"@mobile-reality/mdma-renderer-react": "workspace:*",
|
|
49
|
-
"@mobile-reality/mdma-parser": "workspace:*",
|
|
50
|
-
"@mobile-reality/mdma-runtime": "workspace:*",
|
|
51
40
|
"unified": "^11.0.0",
|
|
52
|
-
"remark-parse": "^11.0.0"
|
|
41
|
+
"remark-parse": "^11.0.0",
|
|
42
|
+
"@mobile-reality/mdma-renderer-react": "0.1.0",
|
|
43
|
+
"@mobile-reality/mdma-parser": "0.1.0",
|
|
44
|
+
"@mobile-reality/mdma-runtime": "0.1.0"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"app-dist"
|
|
49
|
+
],
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
53
52
|
},
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/MobileReality/mdma.git",
|
|
56
|
+
"directory": "packages/cli"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsc -p tsconfig.json",
|
|
60
|
+
"build:app": "vite build --config app/vite.config.ts",
|
|
61
|
+
"dev": "node dist/bin/mdma.js",
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"lint": "biome lint src/",
|
|
64
|
+
"typecheck": "tsc --noEmit"
|
|
65
|
+
}
|
|
66
|
+
}
|