Skip to content

Dynamic imports for Node packages in browser target#15

Merged
willwade merged 4 commits into
AACTools:mainfrom
sonicbaume:obfvalidator-noderequire
Jan 18, 2026
Merged

Dynamic imports for Node packages in browser target#15
willwade merged 4 commits into
AACTools:mainfrom
sonicbaume:obfvalidator-noderequire

Conversation

@chrisbaume

Copy link
Copy Markdown
Contributor

These changes remove any remaining node-related imports for the browser package:

  • Use getFs and getPath in obfValidator
  • Use getNodeRequire to import adm-zip
  • Add getXml2js function (based on getAdmZip) in gridsetValidator

@willwade

Copy link
Copy Markdown
Collaborator

this looks great - ive been sloppy at doing this (but then again not actively trying it all out in a browser env..) so appreciate this. Let me know when all good and ill check it all through (NB: I have a examples/vite demo called via https://github.com/willwade/AACProcessors-nodejs/blob/main/examples/browser-test-server.js - i dare some bad logic in that. but that was my quick test all was working..

@willwade

Copy link
Copy Markdown
Collaborator

Ps. If you have any good suggestions of supporting the SQLite engines I’m all ears..

@chrisbaume

Copy link
Copy Markdown
Contributor Author

The bundler now lets me import it and it works with the test file I have. 🎉

My instinct would be to use https://github.com/sqlite/sqlite-wasm for browser support of Sqlite formats.

@willwade willwade merged commit 3805fda into AACTools:main Jan 18, 2026
2 checks passed
@willwade

Copy link
Copy Markdown
Collaborator

great. Ill merge this and work on a PR for the sqlite ones. Ill see how performant it is.. im nervous as it sounds messy..but lets see

@willwade

Copy link
Copy Markdown
Collaborator

So published. @chrisbaume im working on this next part at #16 if you get a chance to fix in react let me know. Jszip is far slower than admzip so having to do some things to keep it all as performant in node.

@chrisbaume

Copy link
Copy Markdown
Contributor Author

Thanks, I'll keep an eye on that. I've made a start over here: https://github.com/sonicbaume/FreeAAC - early days though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants