Skip to content

feat: HMR dev-sessions, ESM resolver hardening, dev-mode runtime globals#383

Draft
NathanWalker wants to merge 1 commit into
mainfrom
feat/hmr-dev-sessions
Draft

feat: HMR dev-sessions, ESM resolver hardening, dev-mode runtime globals#383
NathanWalker wants to merge 1 commit into
mainfrom
feat/hmr-dev-sessions

Conversation

@NathanWalker
Copy link
Copy Markdown
Contributor

Adds robust Hot Module Replacement plus the supporting ESM resolver hardening and dev-session globals that make hot reload viable on iOS.

  • import.meta.hot: data, accept, dispose, prune, decline, invalidate, on/off/send event surface.
  • Dev-session globals (__nsStartDevSession, __nsReloadDevApp, __nsInvalidateModules, __nsRunHmrDispose, __nsRunHmrPrune, __nsKickstartHmrPrefetch, __nsGetLoadedModuleUrls, __nsApplyStyleUpdate, __nsConfigureDevRuntime, __nsTerminateAllWorkers).
  • Speculative HTTP module prefetch with canonical-key normalization so __ns_hmr__/v<N> and __ns_boot__/b<N> tag prefixes share hot.data identity across reload cycles.
  • ESM resolver hardening in ModuleInternalCallbacks.mm to:
    • Handle HTTP/HTTPS module URLs end-to-end (resolution, fetch, canonical-key collapse, dynamic import).
    • Compile .json imports into synthetic ES modules.

Adds the Hot Module Replacement runtime layer plus the supporting ESM resolver hardening and dev-session globals that make hot reload viable on iOS.

* `import.meta.hot`: `data`, `accept`, `dispose`, `prune`,
  `decline`, `invalidate`, `on`/`off`/`send` event surface.
* Dev-session globals (`__nsStartDevSession`, `__nsReloadDevApp`,
  `__nsInvalidateModules`, `__nsRunHmrDispose`, `__nsRunHmrPrune`,
  `__nsKickstartHmrPrefetch`, `__nsGetLoadedModuleUrls`,
  `__nsApplyStyleUpdate`, `__nsConfigureDevRuntime`,
  `__nsTerminateAllWorkers`).
* Speculative HTTP module prefetch with canonical-key normalization so
  `__ns_hmr__/v<N>` and `__ns_boot__/b<N>` tag prefixes share `hot.data`
  identity across reload cycles.
* ESM resolver hardening in `ModuleInternalCallbacks.mm` to:
  - Preserve synthetic-namespace identity (`ns-vendor://`,
    `optional:`, `node:`, `blob:`) — these are NOT filesystem paths.
  - Handle HTTP/HTTPS module URLs end-to-end (resolution, fetch,
    canonical-key collapse, dynamic import).
  - Compile `.json` imports into synthetic ES modules.
* `NodeBuiltinsAndOptionalModulesTests.mjs`, `HttpEsmLoaderTests.js`,
  `hot-data-ext.{js,mjs}` test fixtures, plus integration wiring in
  `TestRunnerTests.swift` and the Jasmine boot harness.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 7, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 12337a1a-0ee1-4732-85e3-7b1e79fd3861

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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