Conversation
Major architectural changes: - Implement WASM bindings for core ballistic calculations using Emscripten - Add C++ exception handling with proper JS error type conversion - Integrate py-ballisticcalc C++ engine via WASM Exception handling: - Add C++ exception support via Emscripten (-fexceptions, DISABLE_EXCEPTION_CATCHING=0) - Implement universal wrapExceptions template for automatic C++ to JS error conversion - Add specific converters for OutOfRangeError, ZeroFindingError, InterceptionError - Register exception classes in globalThis for proper instanceof checks - Add comprehensive exception handling tests HitResult API improvements: - Implement getAt() method with WASM interpolation for trajectory queries - Add flag() and _checkFlag() methods for TrajFlag validation - Add toWasmTrajectoryData() converter for TrajectoryData to WASM format - Add props getter (alias for shot) for Python API compatibility - Add error field for storing RangeError Code cleanup and deprecations: - Remove deprecated dangerSpace() method and DangerSpace class - Remove TypeScript atmospheric calculation methods (now in WASM) - Remove unused engines (euler, rk4) and generics - Remove src/helpers.ts - Convert drag_tables.js to TypeScript Unit system improvements: - Add footPound getter to Energy class - Add pound getter to Weight class Build and configuration: - Add Makefile for WASM compilation - Add jest.config.js with ESM support - Update ts-jest config to modern format (remove deprecated globals) - Add .editorconfig, .eslintignore, .prettierignore - Add tsup.config.ts for bundling Bug fixes: - Fix maximumDrop and minimumAltitude to be negative (matches Python behavior) - Fix zero-finding test to use await for async setWeaponZero() - Align incomplete-shot tests with Python test parameters Test results: 376 passed, 6 failed (expected for incomplete-shot edge cases) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request migrates the ballistic trajectory calculations to a WebAssembly-based engine, integrating the bclibc library. Key changes include the introduction of a WasmManager for module handling, refactoring core domain models such as Calculator, Shot, Atmo, and TrajectoryData to utilize WASM bindings, and updating the test suite for asynchronous operations. The PR also establishes project-wide standards with new configuration files, a Makefile for build orchestration, and a formatting guide. Feedback identifies a hardcoded local path in the VSCode settings, identical 'before/after' examples in the formatting documentation, and the use of non-English text in the Makefile and source code comments.
| } No newline at end of file | ||
| "editor.parameterHints.enabled": true, | ||
| "editor.suggest.snippetsPreventQuickSuggestions": false, | ||
| "cmake.sourceDirectory": "/home/murphy/jsproj/js-ballistics/lib/bclibc" |
There was a problem hiding this comment.
The cmake.sourceDirectory is set to a hardcoded absolute path. This path is specific to your local machine and will not work for other contributors. It should be replaced with a workspace-relative path using ${workspaceFolder}.
| "cmake.sourceDirectory": "/home/murphy/jsproj/js-ballistics/lib/bclibc" | |
| "cmake.sourceDirectory": "${workspaceFolder}/lib/bclibc" |
| **Before formatting:** | ||
|
|
||
| ```javascript | ||
| function test(a, b, c) { | ||
| const result = a + b + c; | ||
| return result; | ||
| } | ||
| ``` | ||
|
|
||
| **After formatting:** | ||
|
|
||
| ```javascript | ||
| function test(a, b, c) { | ||
| const result = a + b + c; | ||
| return result; | ||
| } | ||
| ``` |
There was a problem hiding this comment.
The 'Before formatting' and 'After formatting' code examples are identical. Furthermore, the 'After' example is inconsistent with your .prettierrc configuration, which specifies "semi": true. The example should demonstrate a code block being formatted correctly by Prettier.
Here's a suggestion for how it could look:
Before formatting:
function test(a,b,c){
const result=a+b+c
return result
}After formatting:
function test(a, b, c) {
const result = a + b + c;
return result;
}| @echo "" | ||
|
|
||
| update-emsdk: | ||
| @echo "🔄 Оновлення Emscripten SDK..." |
There was a problem hiding this comment.
This message is in Ukrainian, while most other messages in this file and the project are in English. For consistency and to make it accessible to a wider audience, it's recommended to use English for all user-facing output. This also applies to other messages in this file (e.g., lines 124, 126, 146).
@echo "🔄 Updating Emscripten SDK..."
| `Invalid temperature: ${fahrenheit}°F. Adjusted to (${cLowestTempF}°F).`, | ||
| ); | ||
| console.warn(`Invalid temperature: ${fahrenheit}°F. Adjusted to (${cLowestTempF}°F).`); | ||
| fahrenheit = cLowestTempF; // ← ДОДАНО: коригування |
No description provided.