Skip to content

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

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#1965
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 Android.

  • import.meta.hot: data, accept, dispose, prune, decline, invalidate, on/off/send event surface.
  • Dev-session globals (__nsStartDevSession, __nsReloadDevApp, __nsInvalidateModules, __nsRunHmrDispose, __nsRunHmrPrune, __nsHasDeclinedModule, __nsKickstartHmrPrefetch, __nsGetLoadedModuleUrls, __nsApplyStyleUpdate, __nsConfigureDevRuntime/__nsConfigureRuntime, __nsTerminateAllWorkers).
  • Speculative HTTP module prefetch (opt-in) 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.cpp 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.
  • Android runtime-dex support for .extend() classes created during HMR that the static binding generator can't see at build time: runtime DEX generation with $/_ inner-class normalization (DexFactory), dev/HMR class-resolution fallback (ClassResolver), and dev-flag / logScriptLoading plumbing (AppConfig, DevFlags).

Matches features in NativeScript/ios#383

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

* `import.meta.hot`: `data`, `accept`, `dispose`, `prune`, `decline`,
  `invalidate`, `on`/`off`/`send` event surface.
* Dev-session globals (`__nsStartDevSession`, `__nsReloadDevApp`,
  `__nsInvalidateModules`, `__nsRunHmrDispose`, `__nsRunHmrPrune`,
  `__nsHasDeclinedModule`, `__nsKickstartHmrPrefetch`,
  `__nsGetLoadedModuleUrls`, `__nsApplyStyleUpdate`,
  `__nsConfigureDevRuntime`/`__nsConfigureRuntime`,
  `__nsTerminateAllWorkers`).
* Speculative HTTP module prefetch (opt-in) 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.cpp` 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.
* Android runtime-dex support for `.extend()` classes created during HMR
  that the static binding generator can't see at build time: runtime DEX
  generation with `$`/`_` inner-class normalization (`DexFactory`),
  dev/HMR class-resolution fallback (`ClassResolver`), and dev-flag /
  `logScriptLoading` plumbing (`AppConfig`, `DevFlags`).
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 8, 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: ff671525-856c-42c1-a42d-db0157fbb5dc

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