Skip to content

Embeddable in-process start (no spawn) so jspod can wrap JSS on mobile/single-process runtimes #58

@melvincarvalho

Description

@melvincarvalho

Problem

jspod is the friendly wrapper on JSS — defaults, banner, seedPodFiles() (welcome/signin/account/docs pages), and bundle install. But start() boots JSS by spawning the jss binary:

// lib/start.js:263
const jss = spawn('jss', jssArgs, { ... });

and bootstrap shells out to the CLI too:

// lib/start.js:300
const installChild = spawn(process.execPath, [CLI_SCRIPT, 'install', '--pod', podUrl, '--bundle', 'default'], ...);

Single-process runtimes can't fork a CLI binary — most importantly nodejs-mobile (the embedded Node in the Android app, js-pod/android). So that app had to bypass jspod entirely and call javascript-solid-server's createServer() directly. The cost: it loses all of jspod's onboarding/bundling and drifts off jspod's JSS version (the app is pinned to JSS 0.0.196 while jspod is on 0.0.201).

Ask

Add an in-process mode so jspod can run JSS without spawning, letting mobile/Electron/tests use the same wrapper:

  1. In-process start — when spawn isn't viable (opt-in flag, or auto-detect), map the existing jssArgs to createServer(options).listen({ port, host }) from javascript-solid-server instead of spawn('jss'). The option set is already computed; this is "call the library instead of the binary."
  2. Callable install — extract the bundle-install logic out of the CLI path (spawn(process.execPath, [CLI_SCRIPT, 'install', …])) into an exported function jspod can invoke in-process.
  3. seedPodFiles() is already a function and the package ships the html + apps/, so onboarding + an offline-first default bundle seed without network.

Payoff

  • The Android app (and any embedder) drops its raw-createServer path + hand-rolled bundle fetch and just calls jspod → inherits onboarding, bundling, and jspod's JSS pin (fixes the version drift).
  • jspod stays the single wrapper for every surface: desktop, Termux, mobile, Electron, tests.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions