You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updated the @ruvector/edge-full package to provide a unified and modular interface for all RuVector WASM components. The changes improve module initialization, add validation and error handling, clarify core vs. ONNX initialization, and fix issues in the quick-start example. The package now provides cleaner support for Edge, Graph, RVLite, SONA, DAG, and ONNX modules while making the initialization API easier and safer to use.
Thanks for the contribution — but this change can't be merged as-is: it makes the file syntactically invalid.
The patch adds a second export async function initAll() to a file that already declares one at line 91. The new declaration lands at line 113, inside the JSDoc block that documents a different function ("Initialize only specific modules"), so the original initAll is left in place rather than replaced.
Verified against the PR head:
$ grep -n 'export async function initAll' index.js
91:export async function initAll() {
113:export async function initAll() {
$ node --input-type=module --check < index.js
[stdin]:113
export async function initAll() {
^
SyntaxError: Identifier 'initAll' has already been declared
Duplicate top-level bindings are a hard error in ES modules, so nothing that imports this file will load — this isn't a lint nit, the module fails to parse.
It looks like the intent was to replace the existing initAll with a Promise.all-based version that initializes the five wasm modules concurrently. That's a reasonable improvement on its own merits. To land it:
Delete the original initAll at line 91 instead of adding alongside it, and
Re-attach the "Initialize only specific modules" JSDoc at line ~110 to the function it actually documents — right now the new code is wedged between that comment and its function.
Confirm with node --input-type=module --check < examples/edge-full/pkg/index.js before pushing.
One thing worth checking before you invest more in it: examples/edge-full/pkg/ follows the wasm-pack output convention, so if this directory is regenerated by a build step, hand edits here would be overwritten and the change belongs in whatever generates it. A maintainer should confirm which it is — if it is checked-in generated output, the fix needs to go upstream of the generator instead.
The initModules rewrite here is a genuine improvement — the loader table is clearer than the switch, and if (typeof module.default === 'function') is more careful than the original. But the PR as it stands cannot be imported at all.
Blocking: duplicate initAll
The diff adds an export async function initAll() while the existing one is still in the file. On the PR head:
line 91: export async function initAll() {
line 113: export async function initAll() {
line 145: export async function initModules(moduleNames) {
$ node --input-type=module -e "import('./examples/edge-full/pkg/index.js')"
SyntaxError: Identifier 'initAll' has already been declared
This is a parse-time failure, so it takes the whole module down — initModules included, not just initAll. As a control, the same check against main gets past parsing and fails later at module resolution (expected without the built wasm artifacts), which is what a syntactically valid file looks like here.
The fix is to delete one of the two. The added copy and the existing one are the same Promise.all implementation, so removing the added block should be enough — worth a local node --check before pushing.
loaders is an object literal, so loaders['constructor'], loaders['toString'] and friends resolve to inherited functions and are truthy. initModules(['constructor']) therefore skips the guard and calls Object() instead of reporting an unknown module — it won't crash, it just silently returns a bogus entry rather than the error the guard exists to produce.
Object.hasOwn(loaders, name) (or const loaders = Object.create(null)) closes it and keeps the intended behaviour for every real module name.
Happy to see this land once the duplicate is removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated the @ruvector/edge-full package to provide a unified and modular interface for all RuVector WASM components. The changes improve module initialization, add validation and error handling, clarify core vs. ONNX initialization, and fix issues in the quick-start example. The package now provides cleaner support for Edge, Graph, RVLite, SONA, DAG, and ONNX modules while making the initialization API easier and safer to use.