Skip to content

Commit c81143d

Browse files
committed
refactor(runtime): reduce surface to a mechanism-only dev-loader contract
The runtime explicitly does not implement HMR policy. import.meta.hot, the hot-data/accept/dispose/prune registries, and dev-session state move to the JS HMR clients (eg, @nativescript/vite); native keeps only the sync HTTP module fetch, prewarm cache + list-mode kickstart, eviction plumbing, and the dev-boot-complete signal. Dev helpers are consolidated under __NS_DEV__
1 parent ad36928 commit c81143d

15 files changed

Lines changed: 482 additions & 3179 deletions

NativeScript/runtime/DevFlags.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ bool IsScriptLoadingLogEnabled();
1414

1515
// HTTP module loader flags
1616
//
17-
// Returns true when speculative HTTP module prefetching (the dep-graph BFS
18-
// kicked off after each successful HttpFetchText) should be enabled. Default
19-
// OFF so cold-boot behaviour is unchanged for users who have not opted in.
20-
// Controlled by package.json / nativescript.config: "httpModulePrefetch": true|false
21-
bool IsHttpModulePrefetchEnabled();
22-
2317
// Returns true when one log line should be emitted per HTTP fetch URL.
2418
// Default OFF because the volume is high (one line per fetch, hundreds per
2519
// cold boot, hundreds per HMR refresh). Opt in via package.json /

NativeScript/runtime/DevFlags.mm

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,6 @@ bool IsScriptLoadingLogEnabled() {
1616

1717
// HTTP module loader flags
1818

19-
// Reads `httpModulePrefetch` from app config (default: DISABLED).
20-
//
21-
// Apps that want to opt in for testing can set:
22-
//
23-
// // nativescript.config.ts
24-
// export default {
25-
// httpModulePrefetch: true,
26-
// } as NativeScriptConfig;
27-
//
28-
// Returning false here short-circuits both the cache lookup and the prefetch
29-
// wave in HttpFetchText, restoring the pre-prefetcher behavior bit-for-bit.
30-
bool IsHttpModulePrefetchEnabled() {
31-
static std::once_flag s_initFlag;
32-
static bool s_enabled = false;
33-
std::call_once(s_initFlag, []() {
34-
@autoreleasepool {
35-
id value = Runtime::GetAppConfigValue("httpModulePrefetch");
36-
if (value && [value respondsToSelector:@selector(boolValue)]) {
37-
s_enabled = [value boolValue];
38-
}
39-
}
40-
// Startup banner. Gated on the logScriptLoading flag so it stays silent
41-
// by default — flip the flag in nativescript.config.ts when diagnosing
42-
// why prefetch is or isn't engaging.
43-
//
44-
// [http-loader] prefetch=disabled ← expected default
45-
// [http-loader] prefetch=enabled ← only if config opt-in
46-
if (IsScriptLoadingLogEnabled()) {
47-
Log(@"[http-loader] prefetch=%s shared-session=on hmr-kickstart=on",
48-
s_enabled ? "enabled" : "disabled");
49-
}
50-
});
51-
return s_enabled;
52-
}
53-
5419
// Default OFF because the volume is high (one line per fetch, hundreds per
5520
// cold boot, hundreds per HMR refresh). Opt in via `nativescript.config.ts`:
5621
//

NativeScript/runtime/HMRSupport.h

Lines changed: 92 additions & 299 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)