From 9c52e426f779716f41df31c48b1c54437a8f82aa Mon Sep 17 00:00:00 2001 From: cnc Date: Fri, 5 Jun 2026 06:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E8=80=83=E6=89=80=E6=9C=89=E5=88=86?= =?UTF-8?q?=E7=BB=84=EF=BC=8C=E5=AE=8C=E6=88=90=E5=B0=BD=E9=87=8F=E5=A4=9A?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9=EF=BC=9A=E9=97=AD=E7=8E=AFOPFS?= =?UTF-8?q?=E7=B1=BB=E5=9E=8Bsource-map=E5=AE=88=E5=8D=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check-linuxcnc-opfs-source-map.sh | 11 +++++++++++ docs/linuxcnc-opfs-source-map.md | 1 + 2 files changed, 12 insertions(+) diff --git a/check-linuxcnc-opfs-source-map.sh b/check-linuxcnc-opfs-source-map.sh index 859cec5..1f07c69 100755 --- a/check-linuxcnc-opfs-source-map.sh +++ b/check-linuxcnc-opfs-source-map.sh @@ -44,6 +44,7 @@ grep -F 'must not add independent filesystem behavior or expand the temporary sm grep -F 'parseFileWithParameterFile()' docs/linuxcnc-opfs-source-map.md >/dev/null grep -F 'OPFS Coverage' docs/linuxcnc-opfs-source-map.md >/dev/null grep -F '| `web/src/wasm-core.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null +grep -F '| `web/src/wasm-core.d.ts` |' docs/linuxcnc-opfs-source-map.md >/dev/null grep -F '| `web/src/app.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null grep -F '| `web/test-browser-wasm-smoke-opfs-basic-sections.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null grep -F '| `web/test-browser-wasm-smoke-opfs-parameter-sections.js` |' docs/linuxcnc-opfs-source-map.md >/dev/null @@ -65,6 +66,14 @@ grep -F 'OPFS path must stay inside the CNC workspace' web/src/wasm-core.js >/de grep -F 'OPFS mount point must stay inside the Emscripten filesystem' web/src/wasm-core.js >/dev/null grep -F 'async persistDirectory(path)' web/src/wasm-core.js >/dev/null grep -F 'async readDirectory(path)' web/src/wasm-core.js >/dev/null +grep -F 'export type WasmOpfsWorkspace = {' web/src/wasm-core.d.ts >/dev/null +grep -F 'readDirectory(path: string): Promise;' web/src/wasm-core.d.ts >/dev/null +grep -F 'persistDirectory(path: string): Promise;' web/src/wasm-core.d.ts >/dev/null +grep -F 'loadParameterFile(path: string): Promise;' web/src/wasm-core.d.ts >/dev/null +grep -F 'persistParameterFile(path: string): Promise;' web/src/wasm-core.d.ts >/dev/null +grep -F 'opfs?: false | {' web/src/wasm-core.d.ts >/dev/null +grep -F 'mountPoint?: string;' web/src/wasm-core.d.ts >/dev/null +grep -F 'workspacePath?: string;' web/src/wasm-core.d.ts >/dev/null grep -F 'const events = await simulator.parseFileWithParameterFile(programPath, parameterPath, "linuxcnc", parseOptions);' \ web/src/app.js >/dev/null grep -F 'OPFS workspace is required for browser program parsing' web/src/app.js >/dev/null @@ -100,6 +109,7 @@ from pathlib import Path source_map = Path("docs/linuxcnc-opfs-source-map.md").read_text(encoding="utf-8") coverage_entries = [ "web/src/wasm-core.js", + "web/src/wasm-core.d.ts", "web/src/app.js", "web/test-browser-wasm-smoke-opfs-basic-sections.js", "web/test-browser-wasm-smoke-opfs-parameter-sections.js", @@ -122,6 +132,7 @@ required_phrases = [ "OPFS/WASM mirror persistence", "OPFS directory persistence and WASM mirror refresh", "OPFS workspace and mount policy", + "OPFS-backed workspace, directory, parameter-file, and mount/workspace option types", "app-level OPFS program, parameter, backup, and reload behavior", ] for phrase in required_phrases: diff --git a/docs/linuxcnc-opfs-source-map.md b/docs/linuxcnc-opfs-source-map.md index 6ed5f89..db1d858 100644 --- a/docs/linuxcnc-opfs-source-map.md +++ b/docs/linuxcnc-opfs-source-map.md @@ -23,6 +23,7 @@ persistence. It is a policy and bridge map only; it must not add independent fil | Entry | Boundary | | --- | --- | | `web/src/wasm-core.js` | Keeps LinuxCNC parameter restore/save bridge files under the OPFS workspace and cleans WASM scratch files. | +| `web/src/wasm-core.d.ts` | Exposes only the OPFS-backed workspace, directory, parameter-file, and mount/workspace option types used by the bridge. | | `web/src/app.js` | Persists browser programs at `programs/current.ngc` and LinuxCNC parameters at `parameters/rs274ngc.var`. | | `web/test-browser-wasm-smoke-opfs-basic-sections.js` | Verifies OPFS program file reads through LinuxCNC `read_text()` and rejects unsafe paths. | | `web/test-browser-wasm-smoke-opfs-parameter-sections.js` | Verifies OPFS parameter restore, save, `.new`, `.bak`, failure, and stale-state semantics. |