Skip to content

[LLV] Refactor JS distribution#635

Open
FranekKubis wants to merge 3 commits into
mainfrom
fk/llv-js-import
Open

[LLV] Refactor JS distribution#635
FranekKubis wants to merge 3 commits into
mainfrom
fk/llv-js-import

Conversation

@FranekKubis

Copy link
Copy Markdown
Contributor

Summary

Refactor JS distribution: ship local_live_view.js pre-bundled inside the hex package instead of building it user-side via npm. End users now import via package name (import "local_live_view") instead of relative vendor path, and mix llv.build drops the npm/node steps entirely.

Changes

Library side:

  • New local-live-view/package.json with main: "priv/static/local_live_view.js" for esbuild's NODE_PATH resolution (NODE_PATH points to "deps" directory).
  • priv/static/{local_live_view.js, iframe.mjs, AtomVM.mjs, AtomVM.wasm} committed (pre-bundled at release time via assets/bundle.mjs).
  • mix llv.build simplified: copies runtime files from deps/local_live_view/priv/static/ to user's priv/static/assets/js/, then builds WASM. No npm, no node.
  • llv.install template injects import { LLVEngine } from "local_live_view" (was from "../vendor/local_live_view.js").

Examples (local-lv-{compare,forms,thermostat,pong,burrito}):

  • Migrated to standard Phoenix esbuild pipeline (away from custom build.mjs + node watcher).
  • (!) Each assets/package.json declares "local_live_view": "workspace:*" so pnpm symlinks LLV into node_modules/ (path deps don't get deps/<name>/ from Mix — workspace fills the gap in monorepo).
  • bundlePaths fixed to match out_dir (/assets/js/wasm/bundle.avm).
  • pnpm-workspace.yaml includes local-live-view and missing example entries.

@FranekKubis FranekKubis marked this pull request as ready for review June 9, 2026 12:14
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.

1 participant