Skip to content

Commit fa63f30

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 e8ce254 commit fa63f30

17 files changed

Lines changed: 484 additions & 3231 deletions

.github/scripts/sample-hung-app.sh

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/npm_release.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -232,22 +232,9 @@ jobs:
232232
# TestRunnerTests.swift) need more than 20m headroom per attempt.
233233
timeout_minutes: 40
234234
max_attempts: 2
235-
command: |
236-
set -o pipefail
237-
# Background native-stack sampler: if the runtime suite deadlocks, the
238-
# test-diagnostics artifact gets per-thread backtraces of the hung app
239-
# (the JS console never reaches os_log, so this is our only window into
240-
# the lock cycle). Killed via trap when xcodebuild returns.
241-
bash .github/scripts/sample-hung-app.sh "$TEST_FOLDER/diagnostics" &
242-
SAMPLER_PID=$!
243-
trap 'kill "$SAMPLER_PID" 2>/dev/null || true' EXIT
244-
xcodebuild -project v8ios.xcodeproj -scheme TestRunner -resultBundlePath $TEST_FOLDER/test_results -destination platform\=iOS\ Simulator,OS\=latest,name\=iPhone\ 16\ Pro build test | xcpretty
235+
command: set -o pipefail && xcodebuild -project v8ios.xcodeproj -scheme TestRunner -resultBundlePath $TEST_FOLDER/test_results -destination platform\=iOS\ Simulator,OS\=latest,name\=iPhone\ 16\ Pro build test | xcpretty
245236
on_retry_command: rm -rf $TEST_FOLDER/test_results* && xcrun simctl shutdown all
246-
new_command_on_retry: |
247-
bash .github/scripts/sample-hung-app.sh "$TEST_FOLDER/diagnostics" &
248-
SAMPLER_PID=$!
249-
trap 'kill "$SAMPLER_PID" 2>/dev/null || true' EXIT
250-
xcodebuild -project v8ios.xcodeproj -scheme TestRunner -resultBundlePath $TEST_FOLDER/test_results -destination platform\=iOS\ Simulator,OS\=latest,name\=iPhone\ 16\ Pro build test
237+
new_command_on_retry: xcodebuild -project v8ios.xcodeproj -scheme TestRunner -resultBundlePath $TEST_FOLDER/test_results -destination platform\=iOS\ Simulator,OS\=latest,name\=iPhone\ 16\ Pro build test
251238
# When the runtime suite fails it is almost always because the in-app
252239
# Jasmine run died before POSTing results (crash or hang). The xcresult is
253240
# black-box and captures nothing from inside the app, so collect the two

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
//

0 commit comments

Comments
 (0)