@mlightcad/cad-simple-viewer-cli 1.5.11
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/README.md +139 -0
- package/dist/cli.js +55 -0
- package/dist/cli.js.map +1 -0
- package/dist/examplesServer.js +413 -0
- package/dist/examplesServer.js.map +1 -0
- package/dist/runHeadless.js +281 -0
- package/dist/runHeadless.js.map +1 -0
- package/dist-runner/assets/cad-html-plugin-Bu0XYtd-.js +477 -0
- package/dist-runner/assets/cad-pdf-plugin-BK4sGA5p.js +312 -0
- package/dist-runner/assets/cad-svg-plugin-pfRr575l.js +17 -0
- package/dist-runner/assets/index-rDY9i-tf.js +5319 -0
- package/dist-runner/index.html +25 -0
- package/dist-runner/viewer-runtime.iife.js +4653 -0
- package/dist-runner/workers/libredwg-parser-worker.js +7525 -0
- package/dist-runner/workers/mtext-renderer-worker.js +36369 -0
- package/examples/batch-export-html.mjs +105 -0
- package/examples/batch-export-png.mjs +103 -0
- package/examples/create-drawing-dxf.scr +15 -0
- package/examples/create-drawing-png.scr +19 -0
- package/examples/create-shapes-dxf.scr +17 -0
- package/examples/export-dxf.scr +5 -0
- package/examples/export-html.scr +9 -0
- package/examples/export-png.scr +9 -0
- package/examples/freeze-layer-png.scr +15 -0
- package/examples/index.json +87 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mlightcad
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# @mlightcad/cad-simple-viewer-cli
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.npmjs.com/package/@mlightcad/cad-simple-viewer-cli)
|
|
5
|
+
|
|
6
|
+
AcCoreConsole-style **headless** CLI for MLight CAD Viewer. Install from npm, open a DXF/DWG (or start blank), run an AutoCAD-like **`.scr` command script**, and save exports (`pngout`, `-chtml`, `cdxf`, …) to disk.
|
|
7
|
+
|
|
8
|
+
Requires **Node.js 20+**. The CLI uses headless Chromium via Playwright; on first use you must install the browser once.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g @mlightcad/cad-simple-viewer-cli
|
|
14
|
+
npx playwright install chromium
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or as a project dependency:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -D @mlightcad/cad-simple-viewer-cli
|
|
21
|
+
npx playwright install chromium
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Export a drawing to PNG (sample script shipped with the package)
|
|
28
|
+
cad-simple-viewer-cli \
|
|
29
|
+
-i ./drawing.dwg \
|
|
30
|
+
-s node_modules/@mlightcad/cad-simple-viewer-cli/examples/export-png.scr \
|
|
31
|
+
-o ./out
|
|
32
|
+
|
|
33
|
+
# Global install: same, with your own script
|
|
34
|
+
cad-simple-viewer-cli -i ./drawing.dxf -s ./export-png.scr -o ./out
|
|
35
|
+
|
|
36
|
+
# Open from URL
|
|
37
|
+
cad-simple-viewer-cli \
|
|
38
|
+
-i https://cdn.jsdelivr.net/gh/mlightcad/cad-data@main/data/canteen.dwg \
|
|
39
|
+
-s ./export-png.scr \
|
|
40
|
+
-o ./out
|
|
41
|
+
|
|
42
|
+
# No input file: start from a blank ISO drawing (write mode)
|
|
43
|
+
cad-simple-viewer-cli -s ./create-drawing-dxf.scr -o ./out --mode write
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
With a local install, use `npx`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx cad-simple-viewer-cli -i ./drawing.dwg -s ./export-png.scr -o ./out
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Options
|
|
53
|
+
|
|
54
|
+
| Option | Description |
|
|
55
|
+
|--------|-------------|
|
|
56
|
+
| `-i, --input <file-or-url>` | Local `.dxf` / `.dwg` path or `http(s)` URL. Omit to start from a blank ISO template |
|
|
57
|
+
| `-s, --script <file>` | `.scr` command script (**required**) |
|
|
58
|
+
| `-o, --output <dir>` | Directory for downloaded exports (default: input file’s directory, or cwd when no `-i`) |
|
|
59
|
+
| `--mode <read\|write>` | Document open mode (default: `read` with `-i`, `write` without `-i`) |
|
|
60
|
+
| `--locale <code>` | Prompt/keyword locale (`en`, `zh`, …) |
|
|
61
|
+
| `--logfile <path>` | Append start / finish / download log lines |
|
|
62
|
+
|
|
63
|
+
## AcCoreConsole mapping
|
|
64
|
+
|
|
65
|
+
| AcCoreConsole | cad-simple-viewer-cli |
|
|
66
|
+
|---------------|------------------------|
|
|
67
|
+
| `accoreconsole /i drawing.dwg /s script.scr` | `cad-simple-viewer-cli -i drawing.dwg -s script.scr` |
|
|
68
|
+
| `/i` | `-i, --input` (optional path or URL) |
|
|
69
|
+
| `/s` | `-s, --script` |
|
|
70
|
+
| plot / export path | `-o, --output` (download directory) |
|
|
71
|
+
|
|
72
|
+
## Script format
|
|
73
|
+
|
|
74
|
+
1. First non-blank line of each command is the **command name**
|
|
75
|
+
2. Following lines answer prompts (empty line = Enter / default / None)
|
|
76
|
+
3. Full-line `;` comments are ignored
|
|
77
|
+
4. `QUIT` / `EXIT` ends the script
|
|
78
|
+
|
|
79
|
+
Example — zoom extents, then PNG (long side 2048):
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
; export-png.scr
|
|
83
|
+
zoom
|
|
84
|
+
e
|
|
85
|
+
pngout
|
|
86
|
+
|
|
87
|
+
2048
|
|
88
|
+
quit
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Useful commands (non-exhaustive): `zoom`, `pngout`, `cdxf`, `-chtml`, `chtml`, `cpdf`, `csvg`, `-layer`, `qnew`, `line`, `circle`, …
|
|
92
|
+
|
|
93
|
+
Layer edits need `--mode write`. Export commands write files via browser download; the CLI captures them into `-o`.
|
|
94
|
+
|
|
95
|
+
## Sample scripts
|
|
96
|
+
|
|
97
|
+
After install, examples live under `node_modules/@mlightcad/cad-simple-viewer-cli/examples/` (or the global package folder):
|
|
98
|
+
|
|
99
|
+
| Script | Purpose |
|
|
100
|
+
|--------|---------|
|
|
101
|
+
| `export-png.scr` | Zoom extents → PNG |
|
|
102
|
+
| `export-html.scr` | Offline HTML (`-chtml`) |
|
|
103
|
+
| `export-dxf.scr` | DXF download (`cdxf`) |
|
|
104
|
+
| `create-drawing-dxf.scr` | Blank drawing + LINE → DXF (no `-i`) |
|
|
105
|
+
| `create-shapes-dxf.scr` | Blank drawing + LINE + CIRCLE → DXF |
|
|
106
|
+
| `create-drawing-png.scr` | Blank drawing → PNG |
|
|
107
|
+
| `freeze-layer-png.scr` | `-layer` Off then PNG (`--mode write`; edit `LAYER_NAME`) |
|
|
108
|
+
| `batch-export-png.mjs` | Scan a folder of drawings → PNG |
|
|
109
|
+
| `batch-export-html.mjs` | Scan a folder → HTML |
|
|
110
|
+
|
|
111
|
+
Batch helpers (from your project after `npm install -D`):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
node node_modules/@mlightcad/cad-simple-viewer-cli/examples/batch-export-png.mjs ./drawings ./out-png
|
|
115
|
+
node node_modules/@mlightcad/cad-simple-viewer-cli/examples/batch-export-html.mjs ./drawings ./out-html
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Programmatic API
|
|
119
|
+
|
|
120
|
+
```js
|
|
121
|
+
import { runHeadless } from '@mlightcad/cad-simple-viewer-cli'
|
|
122
|
+
|
|
123
|
+
const { outputDir, savedFiles } = await runHeadless({
|
|
124
|
+
inputPath: './drawing.dwg', // optional; omit for blank drawing
|
|
125
|
+
scriptPath: './export-png.scr',
|
|
126
|
+
outputDir: './out',
|
|
127
|
+
mode: 'read', // optional
|
|
128
|
+
locale: 'en', // optional
|
|
129
|
+
logfile: './cli.log' // optional
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
console.log(outputDir, savedFiles)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## How it works
|
|
136
|
+
|
|
137
|
+
1. The published package includes a prebuilt Playwright runner (`dist-runner/`).
|
|
138
|
+
2. The CLI starts headless Chromium, opens the drawing (or a blank template), waits for entity convert / deferred text geometry, then runs `AcApDocManager.runScript()`.
|
|
139
|
+
3. Export commands trigger downloads; the CLI writes captured files under `-o`.
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { runHeadless } from './runHeadless.js';
|
|
5
|
+
const program = new Command();
|
|
6
|
+
function parseMode(value) {
|
|
7
|
+
if (value === 'read' || value === 'write') {
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
throw new Error(`Invalid --mode "${value}". Expected "read" or "write".`);
|
|
11
|
+
}
|
|
12
|
+
program
|
|
13
|
+
.name('cad-simple-viewer-cli')
|
|
14
|
+
.description('AcCoreConsole-style headless CAD CLI: open a DXF/DWG (or blank drawing) and run a .scr command script')
|
|
15
|
+
.option('-i, --input <file-or-url>', 'Input .dxf/.dwg path or http(s) URL (like AcCoreConsole /i). Omit to start from a blank ISO template')
|
|
16
|
+
.requiredOption('-s, --script <file>', 'Command script .scr to execute (like AcCoreConsole /s)')
|
|
17
|
+
.option('-o, --output <dir>', 'Directory for downloaded export files (default: input dir, or cwd when no input)')
|
|
18
|
+
.option('--mode <read|write>', 'Document open mode (default: read with -i, write without -i)')
|
|
19
|
+
.option('--locale <code>', 'UI locale for prompts/keywords (e.g. en, zh)', 'en')
|
|
20
|
+
.option('--logfile <path>', 'Append runtime log lines to this file')
|
|
21
|
+
.action(async (opts) => {
|
|
22
|
+
try {
|
|
23
|
+
const mode = opts.mode ? parseMode(opts.mode) : undefined;
|
|
24
|
+
const result = await runHeadless({
|
|
25
|
+
inputPath: opts.input
|
|
26
|
+
? /^https?:\/\//i.test(opts.input)
|
|
27
|
+
? opts.input
|
|
28
|
+
: path.resolve(opts.input)
|
|
29
|
+
: undefined,
|
|
30
|
+
scriptPath: path.resolve(opts.script),
|
|
31
|
+
outputDir: opts.output ? path.resolve(opts.output) : undefined,
|
|
32
|
+
mode,
|
|
33
|
+
locale: opts.locale,
|
|
34
|
+
logfile: opts.logfile ? path.resolve(opts.logfile) : undefined
|
|
35
|
+
});
|
|
36
|
+
if (result.savedFiles.length === 0) {
|
|
37
|
+
console.log(`Script finished. No downloads were captured (output dir: ${result.outputDir}).`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (const file of result.savedFiles) {
|
|
41
|
+
console.log(`Wrote ${file}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
47
|
+
console.error(`cad-simple-viewer-cli failed: ${message}`);
|
|
48
|
+
if (error instanceof Error && error.stack) {
|
|
49
|
+
console.error(error.stack);
|
|
50
|
+
}
|
|
51
|
+
process.exitCode = 1;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
program.parse();
|
|
55
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAA4B,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAExE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QAC1C,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,gCAAgC,CAAC,CAAA;AAC3E,CAAC;AAED,OAAO;KACJ,IAAI,CAAC,uBAAuB,CAAC;KAC7B,WAAW,CACV,uGAAuG,CACxG;KACA,MAAM,CACL,2BAA2B,EAC3B,sGAAsG,CACvG;KACA,cAAc,CACb,qBAAqB,EACrB,wDAAwD,CACzD;KACA,MAAM,CACL,oBAAoB,EACpB,kFAAkF,CACnF;KACA,MAAM,CACL,qBAAqB,EACrB,8DAA8D,CAC/D;KACA,MAAM,CAAC,iBAAiB,EAAE,8CAA8C,EAAE,IAAI,CAAC;KAC/E,MAAM,CAAC,kBAAkB,EAAE,uCAAu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G,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACtE,OAAO,CAAC,KAAK,CAAC,iCAAiC,OAAO,EAAE,CAAC,CAAA;QACzD,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC1C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAC5B,CAAC;QACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;IACtB,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,OAAO,CAAC,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Local examples gallery: list `.scr` / batch examples and run them via the CLI.
|
|
4
|
+
*
|
|
5
|
+
* pnpm --filter @mlightcad/cad-simple-viewer-cli examples
|
|
6
|
+
* # open http://127.0.0.1:5179
|
|
7
|
+
*/
|
|
8
|
+
import { spawn } from 'node:child_process';
|
|
9
|
+
import { existsSync, statSync } from 'node:fs';
|
|
10
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
11
|
+
import { createServer } from 'node:http';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
16
|
+
const examplesDir = path.join(packageRoot, 'examples');
|
|
17
|
+
const galleryDir = path.join(packageRoot, 'gallery');
|
|
18
|
+
const cliJs = path.join(packageRoot, 'dist', 'cli.js');
|
|
19
|
+
const catalogPath = path.join(examplesDir, 'index.json');
|
|
20
|
+
const defaultPort = Number(process.env.CAD_CLI_EXAMPLES_PORT || 5179);
|
|
21
|
+
function resolveInputKind(example) {
|
|
22
|
+
if (example.inputKind)
|
|
23
|
+
return example.inputKind;
|
|
24
|
+
if (example.kind === 'batch')
|
|
25
|
+
return 'directory';
|
|
26
|
+
if (example.requiresInput)
|
|
27
|
+
return 'file';
|
|
28
|
+
return 'none';
|
|
29
|
+
}
|
|
30
|
+
function sendJson(res, status, body) {
|
|
31
|
+
const json = JSON.stringify(body, null, 2);
|
|
32
|
+
res.writeHead(status, {
|
|
33
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
34
|
+
'Cache-Control': 'no-store'
|
|
35
|
+
});
|
|
36
|
+
res.end(json);
|
|
37
|
+
}
|
|
38
|
+
function contentType(filePath) {
|
|
39
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
40
|
+
const types = {
|
|
41
|
+
'.html': 'text/html; charset=utf-8',
|
|
42
|
+
'.css': 'text/css; charset=utf-8',
|
|
43
|
+
'.js': 'text/javascript; charset=utf-8',
|
|
44
|
+
'.json': 'application/json; charset=utf-8',
|
|
45
|
+
'.scr': 'text/plain; charset=utf-8',
|
|
46
|
+
'.mjs': 'text/plain; charset=utf-8',
|
|
47
|
+
'.svg': 'image/svg+xml'
|
|
48
|
+
};
|
|
49
|
+
return types[ext] ?? 'application/octet-stream';
|
|
50
|
+
}
|
|
51
|
+
async function readCatalog() {
|
|
52
|
+
const raw = await readFile(catalogPath, 'utf8');
|
|
53
|
+
return JSON.parse(raw);
|
|
54
|
+
}
|
|
55
|
+
function isHttpUrl(value) {
|
|
56
|
+
return /^https?:\/\//i.test(value.trim());
|
|
57
|
+
}
|
|
58
|
+
function resolveFixture(catalog) {
|
|
59
|
+
if (!catalog.fixtureDrawing)
|
|
60
|
+
return undefined;
|
|
61
|
+
if (isHttpUrl(catalog.fixtureDrawing)) {
|
|
62
|
+
return catalog.fixtureDrawing.trim();
|
|
63
|
+
}
|
|
64
|
+
return path.resolve(examplesDir, catalog.fixtureDrawing);
|
|
65
|
+
}
|
|
66
|
+
function resolveDefaultOutput(catalog, exampleId) {
|
|
67
|
+
const base = catalog.defaultOutputDir
|
|
68
|
+
? path.resolve(packageRoot, catalog.defaultOutputDir)
|
|
69
|
+
: path.join(packageRoot, 'tmp', 'examples-gallery');
|
|
70
|
+
return path.join(base, exampleId);
|
|
71
|
+
}
|
|
72
|
+
function resolveUserPath(raw) {
|
|
73
|
+
if (!raw || !raw.trim())
|
|
74
|
+
return undefined;
|
|
75
|
+
const trimmed = raw.trim();
|
|
76
|
+
if (isHttpUrl(trimmed)) {
|
|
77
|
+
return trimmed;
|
|
78
|
+
}
|
|
79
|
+
return path.isAbsolute(trimmed)
|
|
80
|
+
? path.normalize(trimmed)
|
|
81
|
+
: path.resolve(packageRoot, trimmed);
|
|
82
|
+
}
|
|
83
|
+
async function readBody(req) {
|
|
84
|
+
const chunks = [];
|
|
85
|
+
for await (const chunk of req) {
|
|
86
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
87
|
+
}
|
|
88
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
89
|
+
}
|
|
90
|
+
function runProcess(command, args) {
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
const child = spawn(command, args, {
|
|
93
|
+
cwd: packageRoot,
|
|
94
|
+
env: process.env
|
|
95
|
+
});
|
|
96
|
+
let stdout = '';
|
|
97
|
+
let stderr = '';
|
|
98
|
+
child.stdout.on('data', d => {
|
|
99
|
+
stdout += String(d);
|
|
100
|
+
});
|
|
101
|
+
child.stderr.on('data', d => {
|
|
102
|
+
stderr += String(d);
|
|
103
|
+
});
|
|
104
|
+
child.on('error', reject);
|
|
105
|
+
child.on('exit', code => {
|
|
106
|
+
resolve({ code: code ?? 1, stdout, stderr });
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function assertPathExists(filePath, label) {
|
|
111
|
+
if (!existsSync(filePath)) {
|
|
112
|
+
throw new Error(`${label} not found: ${filePath}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function assertIsFile(filePath, label) {
|
|
116
|
+
if (isHttpUrl(filePath)) {
|
|
117
|
+
let pathname;
|
|
118
|
+
try {
|
|
119
|
+
pathname = new URL(filePath).pathname;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
throw new Error(`${label} is not a valid URL: ${filePath}`);
|
|
123
|
+
}
|
|
124
|
+
const ext = path.extname(pathname).toLowerCase();
|
|
125
|
+
if (ext !== '.dxf' && ext !== '.dwg') {
|
|
126
|
+
throw new Error(`${label} URL must end with .dxf or .dwg: ${filePath}`);
|
|
127
|
+
}
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
assertPathExists(filePath, label);
|
|
131
|
+
if (!statSync(filePath).isFile()) {
|
|
132
|
+
throw new Error(`${label} must be a file: ${filePath}`);
|
|
133
|
+
}
|
|
134
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
135
|
+
if (ext !== '.dxf' && ext !== '.dwg') {
|
|
136
|
+
throw new Error(`${label} must be a .dxf or .dwg file: ${filePath}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function assertIsDirectory(dirPath, label) {
|
|
140
|
+
assertPathExists(dirPath, label);
|
|
141
|
+
if (!statSync(dirPath).isDirectory()) {
|
|
142
|
+
throw new Error(`${label} must be a directory: ${dirPath}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function handleRun(options) {
|
|
146
|
+
if (!existsSync(cliJs)) {
|
|
147
|
+
throw new Error('CLI not built. Run: pnpm --filter @mlightcad/cad-simple-viewer-cli build');
|
|
148
|
+
}
|
|
149
|
+
const catalog = await readCatalog();
|
|
150
|
+
const example = catalog.examples.find(item => item.id === options.id);
|
|
151
|
+
if (!example) {
|
|
152
|
+
throw new Error(`Unknown example id: ${options.id}`);
|
|
153
|
+
}
|
|
154
|
+
if (example.runnable === false) {
|
|
155
|
+
throw new Error(`Example "${options.id}" is not runnable from the gallery.`);
|
|
156
|
+
}
|
|
157
|
+
const scriptPath = path.join(examplesDir, example.script);
|
|
158
|
+
if (!existsSync(scriptPath)) {
|
|
159
|
+
throw new Error(`Script missing: ${scriptPath}`);
|
|
160
|
+
}
|
|
161
|
+
const inputKind = resolveInputKind(example);
|
|
162
|
+
const outputDir = resolveUserPath(options.output) ??
|
|
163
|
+
resolveDefaultOutput(catalog, example.id);
|
|
164
|
+
await mkdir(outputDir, { recursive: true });
|
|
165
|
+
let inputPath = resolveUserPath(options.input);
|
|
166
|
+
if (inputKind === 'file') {
|
|
167
|
+
inputPath = inputPath ?? resolveFixture(catalog);
|
|
168
|
+
if (!inputPath) {
|
|
169
|
+
throw new Error('This example requires an input .dxf / .dwg path.');
|
|
170
|
+
}
|
|
171
|
+
assertIsFile(inputPath, 'Input drawing');
|
|
172
|
+
}
|
|
173
|
+
else if (inputKind === 'directory') {
|
|
174
|
+
if (!inputPath) {
|
|
175
|
+
throw new Error('This example requires an input directory path.');
|
|
176
|
+
}
|
|
177
|
+
assertIsDirectory(inputPath, 'Input directory');
|
|
178
|
+
}
|
|
179
|
+
let command;
|
|
180
|
+
let result;
|
|
181
|
+
if (example.kind === 'batch' || scriptPath.endsWith('.mjs')) {
|
|
182
|
+
command = [
|
|
183
|
+
'node',
|
|
184
|
+
path.relative(packageRoot, scriptPath),
|
|
185
|
+
inputPath,
|
|
186
|
+
outputDir
|
|
187
|
+
];
|
|
188
|
+
result = await runProcess(process.execPath, [
|
|
189
|
+
scriptPath,
|
|
190
|
+
inputPath,
|
|
191
|
+
outputDir
|
|
192
|
+
]);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
const args = ['-s', scriptPath, '-o', outputDir];
|
|
196
|
+
if (example.mode) {
|
|
197
|
+
args.push('--mode', example.mode);
|
|
198
|
+
}
|
|
199
|
+
if (inputKind === 'file' && inputPath) {
|
|
200
|
+
args.unshift('-i', inputPath);
|
|
201
|
+
}
|
|
202
|
+
command = ['node', 'dist/cli.js', ...args];
|
|
203
|
+
result = await runProcess(process.execPath, [cliJs, ...args]);
|
|
204
|
+
}
|
|
205
|
+
const savedFiles = (result.stdout.match(/^Wrote (.+)$/gm) ?? []).map(line => line.replace(/^Wrote /, ''));
|
|
206
|
+
return {
|
|
207
|
+
ok: result.code === 0,
|
|
208
|
+
exampleId: options.id,
|
|
209
|
+
command,
|
|
210
|
+
outputDir,
|
|
211
|
+
inputPath,
|
|
212
|
+
savedFiles,
|
|
213
|
+
stdout: result.stdout,
|
|
214
|
+
stderr: result.stderr,
|
|
215
|
+
exitCode: result.code
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Writes a temporary `.scr` and runs it through the CLI (custom gallery scripts).
|
|
220
|
+
*/
|
|
221
|
+
async function handleCustomRun(options) {
|
|
222
|
+
if (!existsSync(cliJs)) {
|
|
223
|
+
throw new Error('CLI not built. Run: pnpm --filter @mlightcad/cad-simple-viewer-cli build');
|
|
224
|
+
}
|
|
225
|
+
const scriptText = options.script.replace(/\r\n/g, '\n').trimEnd();
|
|
226
|
+
if (!scriptText.trim()) {
|
|
227
|
+
throw new Error('Script is empty.');
|
|
228
|
+
}
|
|
229
|
+
const customRoot = path.join(packageRoot, 'tmp', 'examples-gallery', 'custom');
|
|
230
|
+
await mkdir(customRoot, { recursive: true });
|
|
231
|
+
const scriptPath = path.join(customRoot, 'custom.scr');
|
|
232
|
+
await writeFile(scriptPath, `${scriptText}\n`, 'utf8');
|
|
233
|
+
const outputDir = resolveUserPath(options.output) ?? path.join(customRoot, 'out');
|
|
234
|
+
await mkdir(outputDir, { recursive: true });
|
|
235
|
+
const inputKind = options.inputKind ??
|
|
236
|
+
(options.input && options.input.trim() ? 'file' : 'none');
|
|
237
|
+
let inputPath = resolveUserPath(options.input);
|
|
238
|
+
if (inputKind === 'file') {
|
|
239
|
+
const catalog = await readCatalog();
|
|
240
|
+
inputPath = inputPath ?? resolveFixture(catalog);
|
|
241
|
+
if (!inputPath) {
|
|
242
|
+
throw new Error('Custom script with input requires a .dxf / .dwg path.');
|
|
243
|
+
}
|
|
244
|
+
assertIsFile(inputPath, 'Input drawing');
|
|
245
|
+
}
|
|
246
|
+
const mode = options.mode ?? (inputKind === 'file' ? 'read' : 'write');
|
|
247
|
+
const args = ['-s', scriptPath, '-o', outputDir, '--mode', mode];
|
|
248
|
+
if (inputKind === 'file' && inputPath) {
|
|
249
|
+
args.unshift('-i', inputPath);
|
|
250
|
+
}
|
|
251
|
+
const command = ['node', 'dist/cli.js', ...args];
|
|
252
|
+
const result = await runProcess(process.execPath, [cliJs, ...args]);
|
|
253
|
+
const savedFiles = (result.stdout.match(/^Wrote (.+)$/gm) ?? []).map(line => line.replace(/^Wrote /, ''));
|
|
254
|
+
return {
|
|
255
|
+
ok: result.code === 0,
|
|
256
|
+
exampleId: 'custom',
|
|
257
|
+
command,
|
|
258
|
+
outputDir,
|
|
259
|
+
inputPath,
|
|
260
|
+
savedFiles,
|
|
261
|
+
stdout: result.stdout,
|
|
262
|
+
stderr: result.stderr,
|
|
263
|
+
exitCode: result.code
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
async function serveStatic(res, filePath) {
|
|
267
|
+
if (!existsSync(filePath)) {
|
|
268
|
+
res.writeHead(404);
|
|
269
|
+
res.end('Not found');
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const body = await readFile(filePath);
|
|
273
|
+
res.writeHead(200, { 'Content-Type': contentType(filePath) });
|
|
274
|
+
res.end(body);
|
|
275
|
+
}
|
|
276
|
+
async function main() {
|
|
277
|
+
if (!existsSync(catalogPath)) {
|
|
278
|
+
throw new Error(`Missing examples catalog: ${catalogPath}`);
|
|
279
|
+
}
|
|
280
|
+
if (!existsSync(path.join(galleryDir, 'index.html'))) {
|
|
281
|
+
throw new Error(`Missing gallery page: ${galleryDir}/index.html`);
|
|
282
|
+
}
|
|
283
|
+
const server = createServer((req, res) => {
|
|
284
|
+
void (async () => {
|
|
285
|
+
try {
|
|
286
|
+
const url = new URL(req.url ?? '/', `http://127.0.0.1:${defaultPort}`);
|
|
287
|
+
const method = req.method ?? 'GET';
|
|
288
|
+
if (method === 'GET' && url.pathname === '/api/examples') {
|
|
289
|
+
const catalog = await readCatalog();
|
|
290
|
+
const fixture = resolveFixture(catalog);
|
|
291
|
+
const examples = catalog.examples.map(example => ({
|
|
292
|
+
...example,
|
|
293
|
+
inputKind: resolveInputKind(example)
|
|
294
|
+
}));
|
|
295
|
+
sendJson(res, 200, {
|
|
296
|
+
...catalog,
|
|
297
|
+
examples,
|
|
298
|
+
fixtureDrawingResolved: fixture,
|
|
299
|
+
fixtureDrawingRelative: fixture
|
|
300
|
+
? isHttpUrl(fixture)
|
|
301
|
+
? fixture
|
|
302
|
+
: path.relative(packageRoot, fixture).split(path.sep).join('/')
|
|
303
|
+
: undefined,
|
|
304
|
+
fixtureExists: !!(fixture && (isHttpUrl(fixture) || existsSync(fixture))),
|
|
305
|
+
defaultOutputDirResolved: path.resolve(packageRoot, catalog.defaultOutputDir ?? 'tmp/examples-gallery'),
|
|
306
|
+
defaultOutputDirRelative: (catalog.defaultOutputDir ?? 'tmp/examples-gallery')
|
|
307
|
+
.split(path.sep)
|
|
308
|
+
.join('/'),
|
|
309
|
+
packageRoot,
|
|
310
|
+
cliBuilt: existsSync(cliJs)
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (method === 'GET' && url.pathname.startsWith('/api/script/')) {
|
|
315
|
+
const id = decodeURIComponent(url.pathname.slice('/api/script/'.length));
|
|
316
|
+
const catalog = await readCatalog();
|
|
317
|
+
const example = catalog.examples.find(item => item.id === id);
|
|
318
|
+
if (!example) {
|
|
319
|
+
sendJson(res, 404, { error: `Unknown example: ${id}` });
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const scriptPath = path.join(examplesDir, example.script);
|
|
323
|
+
const text = await readFile(scriptPath, 'utf8');
|
|
324
|
+
sendJson(res, 200, { id, script: example.script, text });
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (method === 'POST' && url.pathname === '/api/run') {
|
|
328
|
+
const bodyText = await readBody(req);
|
|
329
|
+
const body = bodyText
|
|
330
|
+
? JSON.parse(bodyText)
|
|
331
|
+
: {};
|
|
332
|
+
if (!body.id) {
|
|
333
|
+
sendJson(res, 400, { error: 'Missing example id' });
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
try {
|
|
337
|
+
const result = await handleRun({
|
|
338
|
+
id: body.id,
|
|
339
|
+
input: body.input,
|
|
340
|
+
output: body.output
|
|
341
|
+
});
|
|
342
|
+
sendJson(res, result.ok ? 200 : 500, result);
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
346
|
+
sendJson(res, 400, { error: message });
|
|
347
|
+
}
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (method === 'POST' && url.pathname === '/api/run-custom') {
|
|
351
|
+
const bodyText = await readBody(req);
|
|
352
|
+
const body = bodyText
|
|
353
|
+
? JSON.parse(bodyText)
|
|
354
|
+
: {};
|
|
355
|
+
if (typeof body.script !== 'string') {
|
|
356
|
+
sendJson(res, 400, { error: 'Missing script text' });
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
try {
|
|
360
|
+
const result = await handleCustomRun({
|
|
361
|
+
script: body.script,
|
|
362
|
+
input: body.input,
|
|
363
|
+
output: body.output,
|
|
364
|
+
mode: body.mode,
|
|
365
|
+
inputKind: body.inputKind
|
|
366
|
+
});
|
|
367
|
+
sendJson(res, result.ok ? 200 : 500, result);
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
371
|
+
sendJson(res, 400, { error: message });
|
|
372
|
+
}
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
if (method === 'GET' &&
|
|
376
|
+
(url.pathname === '/' || url.pathname === '/index.html')) {
|
|
377
|
+
await serveStatic(res, path.join(galleryDir, 'index.html'));
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (method === 'GET' && url.pathname.startsWith('/gallery/')) {
|
|
381
|
+
const rel = url.pathname.slice('/gallery/'.length);
|
|
382
|
+
await serveStatic(res, path.join(galleryDir, rel));
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
res.writeHead(404);
|
|
386
|
+
res.end('Not found');
|
|
387
|
+
}
|
|
388
|
+
catch (error) {
|
|
389
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
390
|
+
sendJson(res, 500, { error: message });
|
|
391
|
+
}
|
|
392
|
+
})();
|
|
393
|
+
});
|
|
394
|
+
server.on('error', (error) => {
|
|
395
|
+
if (error.code === 'EADDRINUSE') {
|
|
396
|
+
console.error(`Port ${defaultPort} is already in use (another examples gallery may still be running).`);
|
|
397
|
+
console.error('Stop that process, or pick another port, e.g.:\n' +
|
|
398
|
+
' set CAD_CLI_EXAMPLES_PORT=5180&& pnpm --filter @mlightcad/cad-simple-viewer-cli examples');
|
|
399
|
+
process.exitCode = 1;
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
throw error;
|
|
403
|
+
});
|
|
404
|
+
server.listen(defaultPort, '127.0.0.1', () => {
|
|
405
|
+
console.log(`Examples gallery: http://127.0.0.1:${defaultPort}`);
|
|
406
|
+
console.log(`Catalog: ${catalogPath}`);
|
|
407
|
+
if (!existsSync(cliJs)) {
|
|
408
|
+
console.warn('Warning: dist/cli.js missing — build the package before running examples.');
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
await main();
|
|
413
|
+
//# sourceMappingURL=examplesServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"examplesServer.js","sourceRoot":"","sources":["../src/examplesServer.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,QAAQ,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