Skip to content

ESM bootstrap: load node modules and single boot entrypoint#18

Open
criskb wants to merge 1 commit intomainfrom
codex/refactor-node-definitions-to-modules
Open

ESM bootstrap: load node modules and single boot entrypoint#18
criskb wants to merge 1 commit intomainfrom
codex/refactor-node-definitions-to-modules

Conversation

@criskb
Copy link
Copy Markdown
Owner

@criskb criskb commented Jan 2, 2026

Motivation

  • Replace the legacy/fallback node loading (API/manifest/fallback list) with a deterministic ESM-based loader using the node modules under public/nodes/.
  • Make the app script an ESM module so it can import node modules directly from the browser.
  • Ensure there is exactly one boot entrypoint that runs only after node definitions are loaded.
  • Surface a blocking error if no node definitions are available so the app doesn't continue in a broken state.

Description

  • Converted the app script to module mode by changing the index include to <script type="module" src="/src/app.js"></script> in public/index.html.
  • Simplified loadNodes() in public/src/app.js to import the hardcoded NODE_MODULES list and register each module with the existing registerNodeModule() function, removing the fetch/manifest/fallback logic.
  • Added a startApp() async bootstrap that await loadNodes() and then calls boot(), guaranteeing a single boot entrypoint and preventing boot() from running before nodes are loaded.
  • Added a blocking toast and a thrown error when zero nodes are loaded to prevent startup and inform the user (toast("No nodes were loaded. Cannot start the app.", 600000) and throw new Error("Node loader returned zero nodes.")).

Testing

  • No automated tests were run against these changes.

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant