From 81c7b061a84fb39037cba28fc0e9b38aacebc046 Mon Sep 17 00:00:00 2001 From: cnc Date: Thu, 4 Jun 2026 05:27:46 +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=E7=BB=93=E8=AE=BA=E4=B8=BA?= =?UTF-8?q?=20native=20=E5=AE=88=E4=BD=8F=20OPFS=20=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E4=B8=8D=E9=80=8F=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test-native.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test-native.sh b/test-native.sh index 1a43677..8f040a1 100755 --- a/test-native.sh +++ b/test-native.sh @@ -209,7 +209,21 @@ grep -F 'fiveaxisKinematicsType: options.fiveaxisKinematicsType' web/src/wasm-co grep -F 'fiveaxis_kinematics_type: options.fiveaxis_kinematics_type' web/src/wasm-core.js >/dev/null grep -F 'xyzbcTrt: options.xyzbcTrt' web/src/wasm-core.js >/dev/null grep -F 'globalThis.createCncSimModule' web/src/wasm-core.js >/dev/null -grep -F 'createModule(moduleOptions)' web/src/wasm-core.js >/dev/null +grep -F 'const hasOpfsOptions = Object.prototype.hasOwnProperty.call(moduleOptions, "opfs");' web/src/wasm-core.js >/dev/null +grep -F 'const emscriptenModuleOptions = hasOpfsOptions' web/src/wasm-core.js >/dev/null +grep -F '? (({ opfs: _opfs, ...rest }) => rest)(moduleOptions)' web/src/wasm-core.js >/dev/null +grep -F 'const module = hasOpfsOptions ? await createModule(emscriptenModuleOptions) : await createModule(moduleOptions);' web/src/wasm-core.js >/dev/null +grep -F 'const opfs = installOpfsWorkspace(module, moduleOptions);' web/src/wasm-core.js >/dev/null +if ! awk ' + index($0, "const hasOpfsOptions = Object.prototype.hasOwnProperty.call(moduleOptions, \"opfs\");") { has_line = NR } + index($0, "const emscriptenModuleOptions = hasOpfsOptions") { stripped_line = NR } + index($0, "await createModule(emscriptenModuleOptions)") { create_line = NR } + index($0, "const opfs = installOpfsWorkspace(module, moduleOptions);") { opfs_line = NR } + END { exit !(has_line && stripped_line && create_line && opfs_line && has_line < stripped_line && stripped_line < create_line && create_line < opfs_line) } +' web/src/wasm-core.js; then + echo "wasm-core must strip OPFS options before creating the Emscripten module and install OPFS from the original options" >&2 + exit 1 +fi grep -F 'async parseFile(path, dialect = "linuxcnc", options = {})' web/src/wasm-core.js >/dev/null grep -F 'async parseWithParameterFile(program, parameterPath, dialect = "linuxcnc", options = {})' web/src/wasm-core.js >/dev/null grep -F 'async parseFileWithParameterFile(path, parameterPath, dialect = "linuxcnc", options = {})' web/src/wasm-core.js >/dev/null