@nativescript/vite 8.0.0-alpha.3 → 8.0.0-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/README.md +51 -11
  2. package/configuration/angular.d.ts +34 -1
  3. package/configuration/angular.js +369 -159
  4. package/configuration/angular.js.map +1 -1
  5. package/configuration/base.js +184 -14
  6. package/configuration/base.js.map +1 -1
  7. package/configuration/javascript.js +5 -72
  8. package/configuration/javascript.js.map +1 -1
  9. package/configuration/solid.js +27 -1
  10. package/configuration/solid.js.map +1 -1
  11. package/configuration/typescript.js +5 -75
  12. package/configuration/typescript.js.map +1 -1
  13. package/helpers/angular/angular-linker.d.ts +5 -6
  14. package/helpers/angular/angular-linker.js +36 -121
  15. package/helpers/angular/angular-linker.js.map +1 -1
  16. package/helpers/angular/inject-component-hmr-registration.d.ts +112 -0
  17. package/helpers/angular/inject-component-hmr-registration.js +291 -0
  18. package/helpers/angular/inject-component-hmr-registration.js.map +1 -0
  19. package/helpers/angular/inject-hmr-vite-ignore.d.ts +75 -0
  20. package/helpers/angular/inject-hmr-vite-ignore.js +221 -0
  21. package/helpers/angular/inject-hmr-vite-ignore.js.map +1 -0
  22. package/helpers/angular/inline-decorator-component-templates.js +1 -170
  23. package/helpers/angular/inline-decorator-component-templates.js.map +1 -1
  24. package/helpers/angular/js-lexer.d.ts +4 -0
  25. package/helpers/angular/js-lexer.js +182 -0
  26. package/helpers/angular/js-lexer.js.map +1 -0
  27. package/helpers/angular/shared-linker.d.ts +31 -3
  28. package/helpers/angular/shared-linker.js +67 -14
  29. package/helpers/angular/shared-linker.js.map +1 -1
  30. package/helpers/angular/synthesize-decorator-ctor-parameters.js +2 -170
  31. package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +1 -1
  32. package/helpers/angular/synthesize-injectable-factories.js +1 -174
  33. package/helpers/angular/synthesize-injectable-factories.js.map +1 -1
  34. package/helpers/angular/util.d.ts +1 -0
  35. package/helpers/angular/util.js +88 -0
  36. package/helpers/angular/util.js.map +1 -1
  37. package/helpers/app-components.d.ts +2 -1
  38. package/helpers/app-components.js.map +1 -1
  39. package/helpers/app-css-state.d.ts +8 -0
  40. package/helpers/app-css-state.js +8 -0
  41. package/helpers/app-css-state.js.map +1 -0
  42. package/helpers/bundler-context.d.ts +11 -0
  43. package/helpers/bundler-context.js +71 -0
  44. package/helpers/bundler-context.js.map +1 -0
  45. package/helpers/config-as-json.js +10 -0
  46. package/helpers/config-as-json.js.map +1 -1
  47. package/helpers/dev-host.d.ts +341 -0
  48. package/helpers/dev-host.js +617 -0
  49. package/helpers/dev-host.js.map +1 -0
  50. package/helpers/esbuild-platform-resolver.js +4 -1
  51. package/helpers/esbuild-platform-resolver.js.map +1 -1
  52. package/helpers/global-defines.d.ts +51 -0
  53. package/helpers/global-defines.js +77 -0
  54. package/helpers/global-defines.js.map +1 -1
  55. package/helpers/hmr-scope.d.ts +26 -0
  56. package/helpers/hmr-scope.js +67 -0
  57. package/helpers/hmr-scope.js.map +1 -0
  58. package/helpers/init.js +0 -18
  59. package/helpers/init.js.map +1 -1
  60. package/helpers/logging.d.ts +1 -0
  61. package/helpers/logging.js +63 -3
  62. package/helpers/logging.js.map +1 -1
  63. package/helpers/main-entry.d.ts +2 -1
  64. package/helpers/main-entry.js +430 -47
  65. package/helpers/main-entry.js.map +1 -1
  66. package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
  67. package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
  68. package/helpers/nativeclass-transform.js.map +1 -1
  69. package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
  70. package/helpers/nativeclass-transformer-plugin.js +157 -14
  71. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  72. package/helpers/nativescript-package-resolver.js +8 -3
  73. package/helpers/nativescript-package-resolver.js.map +1 -1
  74. package/helpers/normalize-id.d.ts +42 -0
  75. package/helpers/normalize-id.js +60 -0
  76. package/helpers/normalize-id.js.map +1 -0
  77. package/helpers/ns-core-url.d.ts +88 -0
  78. package/helpers/ns-core-url.js +191 -0
  79. package/helpers/ns-core-url.js.map +1 -0
  80. package/helpers/package-platform-aliases.js +4 -3
  81. package/helpers/package-platform-aliases.js.map +1 -1
  82. package/helpers/platform-types.d.ts +2 -0
  83. package/helpers/platform-types.js +2 -0
  84. package/helpers/platform-types.js.map +1 -0
  85. package/helpers/prelink-angular.js +12 -33
  86. package/helpers/prelink-angular.js.map +1 -1
  87. package/helpers/project.d.ts +35 -0
  88. package/helpers/project.js +120 -2
  89. package/helpers/project.js.map +1 -1
  90. package/helpers/resolver.js +17 -2
  91. package/helpers/resolver.js.map +1 -1
  92. package/helpers/solid-jsx-deps.d.ts +15 -0
  93. package/helpers/solid-jsx-deps.js +178 -0
  94. package/helpers/solid-jsx-deps.js.map +1 -0
  95. package/helpers/ts-config-paths.d.ts +14 -0
  96. package/helpers/ts-config-paths.js +89 -8
  97. package/helpers/ts-config-paths.js.map +1 -1
  98. package/helpers/typescript-check.d.ts +2 -1
  99. package/helpers/typescript-check.js.map +1 -1
  100. package/helpers/workers.d.ts +20 -19
  101. package/helpers/workers.js +624 -4
  102. package/helpers/workers.js.map +1 -1
  103. package/hmr/client/css-handler.d.ts +1 -0
  104. package/hmr/client/css-handler.js +33 -20
  105. package/hmr/client/css-handler.js.map +1 -1
  106. package/hmr/client/css-update-overlay.d.ts +18 -0
  107. package/hmr/client/css-update-overlay.js +27 -0
  108. package/hmr/client/css-update-overlay.js.map +1 -0
  109. package/hmr/client/hmr-pending-overlay.d.ts +27 -0
  110. package/hmr/client/hmr-pending-overlay.js +50 -0
  111. package/hmr/client/hmr-pending-overlay.js.map +1 -0
  112. package/hmr/client/index.js +419 -15
  113. package/hmr/client/index.js.map +1 -1
  114. package/hmr/client/utils.d.ts +6 -1
  115. package/hmr/client/utils.js +184 -8
  116. package/hmr/client/utils.js.map +1 -1
  117. package/hmr/client/vue-sfc-update-overlay.d.ts +82 -0
  118. package/hmr/client/vue-sfc-update-overlay.js +133 -0
  119. package/hmr/client/vue-sfc-update-overlay.js.map +1 -0
  120. package/hmr/entry-runtime.d.ts +2 -1
  121. package/hmr/entry-runtime.js +252 -65
  122. package/hmr/entry-runtime.js.map +1 -1
  123. package/hmr/frameworks/angular/client/index.d.ts +1 -0
  124. package/hmr/frameworks/angular/client/index.js +778 -20
  125. package/hmr/frameworks/angular/client/index.js.map +1 -1
  126. package/hmr/frameworks/angular/server/linker.js +1 -4
  127. package/hmr/frameworks/angular/server/linker.js.map +1 -1
  128. package/hmr/frameworks/angular/server/strategy.js +13 -15
  129. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  130. package/hmr/frameworks/solid/server/strategy.js +3 -18
  131. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  132. package/hmr/frameworks/typescript/server/strategy.js +2 -15
  133. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  134. package/hmr/frameworks/vue/client/index.js +30 -199
  135. package/hmr/frameworks/vue/client/index.js.map +1 -1
  136. package/hmr/helpers/ast-normalizer.js +52 -5
  137. package/hmr/helpers/ast-normalizer.js.map +1 -1
  138. package/hmr/helpers/cjs-named-exports.d.ts +23 -0
  139. package/hmr/helpers/cjs-named-exports.js +152 -0
  140. package/hmr/helpers/cjs-named-exports.js.map +1 -0
  141. package/hmr/helpers/package-exports.d.ts +16 -0
  142. package/hmr/helpers/package-exports.js +396 -0
  143. package/hmr/helpers/package-exports.js.map +1 -0
  144. package/hmr/server/angular-root-component.d.ts +79 -0
  145. package/hmr/server/angular-root-component.js +149 -0
  146. package/hmr/server/angular-root-component.js.map +1 -0
  147. package/hmr/server/constants.js +13 -4
  148. package/hmr/server/constants.js.map +1 -1
  149. package/hmr/server/core-sanitize.d.ts +90 -7
  150. package/hmr/server/core-sanitize.js +211 -56
  151. package/hmr/server/core-sanitize.js.map +1 -1
  152. package/hmr/server/framework-strategy.d.ts +9 -19
  153. package/hmr/server/hmr-module-graph.d.ts +37 -0
  154. package/hmr/server/hmr-module-graph.js +214 -0
  155. package/hmr/server/hmr-module-graph.js.map +1 -0
  156. package/hmr/server/import-map.js +60 -8
  157. package/hmr/server/import-map.js.map +1 -1
  158. package/hmr/server/index.js +1 -0
  159. package/hmr/server/index.js.map +1 -1
  160. package/hmr/server/ns-core-cjs-shape.d.ts +204 -0
  161. package/hmr/server/ns-core-cjs-shape.js +271 -0
  162. package/hmr/server/ns-core-cjs-shape.js.map +1 -0
  163. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  164. package/hmr/server/ns-rt-bridge.js +131 -0
  165. package/hmr/server/ns-rt-bridge.js.map +1 -0
  166. package/hmr/server/ns-rt-route.d.ts +5 -0
  167. package/hmr/server/ns-rt-route.js +35 -0
  168. package/hmr/server/ns-rt-route.js.map +1 -0
  169. package/hmr/server/perf-instrumentation.d.ts +114 -0
  170. package/hmr/server/perf-instrumentation.js +195 -0
  171. package/hmr/server/perf-instrumentation.js.map +1 -0
  172. package/hmr/server/require-guard.d.ts +1 -0
  173. package/hmr/server/require-guard.js +12 -0
  174. package/hmr/server/require-guard.js.map +1 -0
  175. package/hmr/server/route-helpers.d.ts +7 -0
  176. package/hmr/server/route-helpers.js +13 -0
  177. package/hmr/server/route-helpers.js.map +1 -0
  178. package/hmr/server/server-origin.d.ts +12 -0
  179. package/hmr/server/server-origin.js +66 -0
  180. package/hmr/server/server-origin.js.map +1 -0
  181. package/hmr/server/shared-transform-request.js +12 -5
  182. package/hmr/server/shared-transform-request.js.map +1 -1
  183. package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
  184. package/hmr/server/vendor-bare-module-shims.js +80 -0
  185. package/hmr/server/vendor-bare-module-shims.js.map +1 -0
  186. package/hmr/server/vite-plugin.js +60 -42
  187. package/hmr/server/vite-plugin.js.map +1 -1
  188. package/hmr/server/websocket-angular-entry.js +1 -1
  189. package/hmr/server/websocket-angular-entry.js.map +1 -1
  190. package/hmr/server/websocket-angular-hot-update.d.ts +17 -0
  191. package/hmr/server/websocket-angular-hot-update.js +176 -2
  192. package/hmr/server/websocket-angular-hot-update.js.map +1 -1
  193. package/hmr/server/websocket-core-bridge.d.ts +41 -6
  194. package/hmr/server/websocket-core-bridge.js +72 -75
  195. package/hmr/server/websocket-core-bridge.js.map +1 -1
  196. package/hmr/server/websocket-css-hot-update.d.ts +33 -0
  197. package/hmr/server/websocket-css-hot-update.js +65 -0
  198. package/hmr/server/websocket-css-hot-update.js.map +1 -0
  199. package/hmr/server/websocket-device-transform.d.ts +21 -0
  200. package/hmr/server/websocket-device-transform.js +1570 -0
  201. package/hmr/server/websocket-device-transform.js.map +1 -0
  202. package/hmr/server/websocket-graph-upsert.d.ts +15 -0
  203. package/hmr/server/websocket-graph-upsert.js +20 -0
  204. package/hmr/server/websocket-graph-upsert.js.map +1 -1
  205. package/hmr/server/websocket-hmr-pending.d.ts +43 -0
  206. package/hmr/server/websocket-hmr-pending.js +55 -0
  207. package/hmr/server/websocket-hmr-pending.js.map +1 -0
  208. package/hmr/server/websocket-hot-update.d.ts +51 -0
  209. package/hmr/server/websocket-hot-update.js +1160 -0
  210. package/hmr/server/websocket-hot-update.js.map +1 -0
  211. package/hmr/server/websocket-import-map-route.d.ts +15 -0
  212. package/hmr/server/websocket-import-map-route.js +44 -0
  213. package/hmr/server/websocket-import-map-route.js.map +1 -0
  214. package/hmr/server/websocket-module-bindings.js +3 -3
  215. package/hmr/server/websocket-module-bindings.js.map +1 -1
  216. package/hmr/server/websocket-module-specifiers.d.ts +66 -2
  217. package/hmr/server/websocket-module-specifiers.js +202 -19
  218. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  219. package/hmr/server/websocket-ns-core.d.ts +21 -0
  220. package/hmr/server/websocket-ns-core.js +305 -0
  221. package/hmr/server/websocket-ns-core.js.map +1 -0
  222. package/hmr/server/websocket-ns-entry.d.ts +22 -0
  223. package/hmr/server/websocket-ns-entry.js +150 -0
  224. package/hmr/server/websocket-ns-entry.js.map +1 -0
  225. package/hmr/server/websocket-ns-m-paths.d.ts +3 -0
  226. package/hmr/server/websocket-ns-m-paths.js +92 -0
  227. package/hmr/server/websocket-ns-m-paths.js.map +1 -0
  228. package/hmr/server/websocket-ns-m-request.d.ts +45 -0
  229. package/hmr/server/websocket-ns-m-request.js +196 -0
  230. package/hmr/server/websocket-ns-m-request.js.map +1 -0
  231. package/hmr/server/websocket-ns-m.d.ts +34 -0
  232. package/hmr/server/websocket-ns-m.js +853 -0
  233. package/hmr/server/websocket-ns-m.js.map +1 -0
  234. package/hmr/server/websocket-served-module-helpers.d.ts +39 -0
  235. package/hmr/server/websocket-served-module-helpers.js +654 -0
  236. package/hmr/server/websocket-served-module-helpers.js.map +1 -0
  237. package/hmr/server/websocket-sfc.d.ts +24 -0
  238. package/hmr/server/websocket-sfc.js +1223 -0
  239. package/hmr/server/websocket-sfc.js.map +1 -0
  240. package/hmr/server/websocket-txn.d.ts +6 -0
  241. package/hmr/server/websocket-txn.js +39 -0
  242. package/hmr/server/websocket-txn.js.map +1 -0
  243. package/hmr/server/websocket-vendor-unifier.d.ts +10 -0
  244. package/hmr/server/websocket-vendor-unifier.js +45 -0
  245. package/hmr/server/websocket-vendor-unifier.js.map +1 -0
  246. package/hmr/server/websocket.d.ts +0 -30
  247. package/hmr/server/websocket.js +599 -6038
  248. package/hmr/server/websocket.js.map +1 -1
  249. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  250. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  251. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  252. package/hmr/shared/runtime/boot-progress.d.ts +40 -0
  253. package/hmr/shared/runtime/boot-progress.js +128 -0
  254. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  255. package/hmr/shared/runtime/boot-timeline.d.ts +18 -0
  256. package/hmr/shared/runtime/boot-timeline.js +52 -0
  257. package/hmr/shared/runtime/boot-timeline.js.map +1 -0
  258. package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
  259. package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
  260. package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
  261. package/hmr/shared/runtime/dev-overlay.d.ts +75 -26
  262. package/hmr/shared/runtime/dev-overlay.js +990 -260
  263. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  264. package/hmr/shared/runtime/module-provenance.js +1 -4
  265. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  266. package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
  267. package/hmr/shared/runtime/root-placeholder-view.js +310 -0
  268. package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
  269. package/hmr/shared/runtime/root-placeholder.js +352 -194
  270. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  271. package/hmr/shared/runtime/session-bootstrap.js +164 -1
  272. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  273. package/hmr/shared/runtime/vendor-bootstrap.js +1 -9
  274. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  275. package/hmr/shared/vendor/manifest-collect.d.ts +32 -0
  276. package/hmr/shared/vendor/manifest-collect.js +512 -0
  277. package/hmr/shared/vendor/manifest-collect.js.map +1 -0
  278. package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
  279. package/hmr/shared/vendor/manifest-loader.js +3 -2
  280. package/hmr/shared/vendor/manifest-loader.js.map +1 -1
  281. package/hmr/shared/vendor/manifest.d.ts +1 -5
  282. package/hmr/shared/vendor/manifest.js +102 -739
  283. package/hmr/shared/vendor/manifest.js.map +1 -1
  284. package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
  285. package/hmr/shared/vendor/vendor-device-shim.js +208 -0
  286. package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
  287. package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +16 -0
  288. package/hmr/shared/vendor/vendor-esbuild-plugins.js +203 -0
  289. package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
  290. package/index.d.ts +1 -0
  291. package/index.js +5 -0
  292. package/index.js.map +1 -1
  293. package/package.json +55 -11
  294. package/runtime/core-aliases-early.js +17 -41
  295. package/runtime/core-aliases-early.js.map +1 -1
@@ -0,0 +1,69 @@
1
+ import type { HmrOverlaySnapshot } from './dev-overlay.js';
2
+ /**
3
+ * Calibrated palette for the boot placeholder card. The card is
4
+ * intentionally light so the small accent (brand badge + progress
5
+ * fill) reads as the only "live" element on the screen.
6
+ *
7
+ * Tones map to the snapshot tone enum from `dev-overlay.ts`:
8
+ * - `info` (default) — calm slate + NS blue
9
+ * - `error` — dusty rose-on-white surface
10
+ */
11
+ export type BootPlaceholderTone = 'info' | 'error';
12
+ export interface BootPlaceholderPalette {
13
+ pageBackground: string;
14
+ cardBackground: string;
15
+ cardShadow: string;
16
+ titleText: string;
17
+ phaseText: string;
18
+ detailText: string;
19
+ progressTrack: string;
20
+ progressFill: string;
21
+ activityIndicator: string;
22
+ }
23
+ /**
24
+ * Resolve the palette for a given tone. Unknown tones fall back to
25
+ * the calm `info` palette
26
+ */
27
+ export declare function getBootPlaceholderPalette(tone?: string | null): BootPlaceholderPalette;
28
+ /**
29
+ * Animation contract for the boot placeholder.
30
+ *
31
+ * `entranceDurationMs` covers the one-shot fade + scale that fires
32
+ * when the placeholder card first attaches to the visual tree.
33
+ * `entranceFromScale` is the starting scale before easeOut to 1.
34
+ *
35
+ * `progressDurationMs` is the per-update fade for the progress fill's
36
+ * `scaleX`. Pegged to 220 ms (just under the heartbeat's 250 ms tick)
37
+ * so consecutive ticks chain into continuous motion rather than
38
+ * waiting on the previous animation to settle.
39
+ *
40
+ * `brandPulseDurationMs` is one half-period of the brand badge's
41
+ * opacity pulse. A full cycle is `brandPulseDurationMs * 2`. Keeping
42
+ * it long (~1.2 s) makes the pulse feel ambient rather than nervous.
43
+ */
44
+ export declare const BOOT_PLACEHOLDER_MOTION: {
45
+ readonly entranceDurationMs: 380;
46
+ readonly entranceFromScale: 0.94;
47
+ readonly progressDurationMs: 220;
48
+ readonly brandPulseDurationMs: 1200;
49
+ readonly brandPulseMinOpacity: 0.55;
50
+ };
51
+ /**
52
+ * Convert a 0–100 progress percentage into an `scaleX` factor that
53
+ * the fill view can animate against. Clamps to [`minScale`, 1] so the
54
+ * fill never collapses to an invisible hairline
55
+ *
56
+ * The default `minScale` of 0.01 keeps the bar visible during the
57
+ * earliest moments of boot when progress is 0
58
+ */
59
+ export declare function computeBootProgressFillScale(progress: number | null | undefined, minScale?: number): number;
60
+ /**
61
+ * The "phase + percent" line we show as the primary status text
62
+ * inside the card
63
+ */
64
+ export declare function formatBootPrimaryLine(snapshot: Pick<HmrOverlaySnapshot, 'phase' | 'progress'> | null | undefined): string;
65
+ /**
66
+ * The secondary detail line (e.g. "Loading the module
67
+ * graph (6259ms)").
68
+ */
69
+ export declare function formatBootDetailLine(snapshot: Pick<HmrOverlaySnapshot, 'detail'> | null | undefined): string;
@@ -0,0 +1,101 @@
1
+ // Pure helpers for the cold-boot placeholder's visual treatment.
2
+ //
3
+ // The visible UI is constructed in `root-placeholder.ts` (an NS view
4
+ // tree attached to `Application` via `launchEvent`), and driven by the
5
+ // dev-overlay via `updateBootStatusLabel`. This file owns the bits
6
+ // that don't need a runtime view tree to make sense — colours,
7
+ // animation timings, the formula that turns a 0–100 progress into the
8
+ // fill bar's `scaleX`, and the split between the "phase + percent"
9
+ // primary line and the secondary detail line.
10
+ //
11
+ const INFO_PALETTE = {
12
+ pageBackground: '#F4F7FB',
13
+ cardBackground: '#FFFFFF',
14
+ cardShadow: '#0F172A',
15
+ titleText: '#0F172A',
16
+ phaseText: '#475569',
17
+ detailText: '#94A3B8',
18
+ progressTrack: '#E2E8F0',
19
+ progressFill: '#3B6FE5',
20
+ activityIndicator: '#3B6FE5',
21
+ };
22
+ const ERROR_PALETTE = {
23
+ pageBackground: '#FFF5F5',
24
+ cardBackground: '#FFFFFF',
25
+ cardShadow: '#7F1D1D',
26
+ titleText: '#7F1D1D',
27
+ phaseText: '#B91C1C',
28
+ detailText: '#DC2626',
29
+ progressTrack: '#FCA5A5',
30
+ progressFill: '#B41810',
31
+ activityIndicator: '#B41810',
32
+ };
33
+ /**
34
+ * Resolve the palette for a given tone. Unknown tones fall back to
35
+ * the calm `info` palette
36
+ */
37
+ export function getBootPlaceholderPalette(tone) {
38
+ if (tone === 'error')
39
+ return ERROR_PALETTE;
40
+ return INFO_PALETTE;
41
+ }
42
+ /**
43
+ * Animation contract for the boot placeholder.
44
+ *
45
+ * `entranceDurationMs` covers the one-shot fade + scale that fires
46
+ * when the placeholder card first attaches to the visual tree.
47
+ * `entranceFromScale` is the starting scale before easeOut to 1.
48
+ *
49
+ * `progressDurationMs` is the per-update fade for the progress fill's
50
+ * `scaleX`. Pegged to 220 ms (just under the heartbeat's 250 ms tick)
51
+ * so consecutive ticks chain into continuous motion rather than
52
+ * waiting on the previous animation to settle.
53
+ *
54
+ * `brandPulseDurationMs` is one half-period of the brand badge's
55
+ * opacity pulse. A full cycle is `brandPulseDurationMs * 2`. Keeping
56
+ * it long (~1.2 s) makes the pulse feel ambient rather than nervous.
57
+ */
58
+ export const BOOT_PLACEHOLDER_MOTION = {
59
+ entranceDurationMs: 380,
60
+ entranceFromScale: 0.94,
61
+ progressDurationMs: 220,
62
+ brandPulseDurationMs: 1200,
63
+ brandPulseMinOpacity: 0.55,
64
+ };
65
+ /**
66
+ * Convert a 0–100 progress percentage into an `scaleX` factor that
67
+ * the fill view can animate against. Clamps to [`minScale`, 1] so the
68
+ * fill never collapses to an invisible hairline
69
+ *
70
+ * The default `minScale` of 0.01 keeps the bar visible during the
71
+ * earliest moments of boot when progress is 0
72
+ */
73
+ export function computeBootProgressFillScale(progress, minScale = 0.01) {
74
+ const numeric = typeof progress === 'number' && Number.isFinite(progress) ? progress : 0;
75
+ const normalized = numeric / 100;
76
+ if (!Number.isFinite(normalized))
77
+ return minScale;
78
+ return Math.max(minScale, Math.min(1, normalized));
79
+ }
80
+ /**
81
+ * The "phase + percent" line we show as the primary status text
82
+ * inside the card
83
+ */
84
+ export function formatBootPrimaryLine(snapshot) {
85
+ if (!snapshot)
86
+ return '';
87
+ const progress = snapshot.progress;
88
+ const progressText = typeof progress === 'number' && Number.isFinite(progress) ? ` (${Math.round(progress)}%)` : '';
89
+ return `${snapshot.phase || ''}${progressText}`.trim();
90
+ }
91
+ /**
92
+ * The secondary detail line (e.g. "Loading the module
93
+ * graph (6259ms)").
94
+ */
95
+ export function formatBootDetailLine(snapshot) {
96
+ if (!snapshot)
97
+ return '';
98
+ const detail = snapshot.detail;
99
+ return typeof detail === 'string' ? detail : '';
100
+ }
101
+ //# sourceMappingURL=boot-placeholder-ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boot-placeholder-ui.js","sourceRoot":"","sources":["../../../../../../packages/vite/hmr/shared/runtime/boot-placeholder-ui.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,mEAAmE;AACnE,+DAA+D;AAC/D,sEAAsE;AACtE,mEAAmE;AACnE,8CAA8C;AAC9C,EAAE;AA2BF,MAAM,YAAY,GAA2B;IAC5C,cAAc,EAAE,SAAS;IACzB,cAAc,EAAE,SAAS;IACzB,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE,SAAS;IACxB,YAAY,EAAE,SAAS;IACvB,iBAAiB,EAAE,SAAS;CAC5B,CAAC;AAEF,MAAM,aAAa,GAA2B;IAC7C,cAAc,EAAE,SAAS;IACzB,cAAc,EAAE,SAAS;IACzB,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;IACrB,aAAa,EAAE,SAAS;IACxB,YAAY,EAAE,SAAS;IACvB,iBAAiB,EAAE,SAAS;CAC5B,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAoB;IAC7D,IAAI,IAAI,KAAK,OAAO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AU,oBAAoB,CAAC,QAA+D;IACnG,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC/B,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACjD,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * `'importing-main'` is the long HTTP-module-load phase (5–10s for a
3
+ * real Angular app). The bar uses this range so the user sees ~62
4
+ * percentage points of motion during the phase that actually takes
5
+ * time, sandwiched between the cheap bootstrap stages
6
+ * ('configuring-import-map' = 26) and the post-import wait
7
+ * ('waiting-for-app' = 94 → 'app-root-committed' = 100).
8
+ */
9
+ export declare const BOOT_IMPORT_PROGRESS_MIN = 30;
10
+ export declare const BOOT_IMPORT_PROGRESS_MAX = 92;
11
+ /** Ceiling guards against rounding into `'waiting-for-app'` (94). */
12
+ export declare const BOOT_IMPORT_PROGRESS_CEILING = 94;
13
+ export declare function computeBootImportProgress(input: {
14
+ count?: number;
15
+ elapsedMs?: number;
16
+ }): number;
17
+ /**
18
+ * Render the second-line detail for the placeholder. Surfaces the
19
+ * count + last-loaded module path once the snippet has fired, or a
20
+ * generic "Loading the module graph (Nms)" line during
21
+ * the pre-snippet window.
22
+ */
23
+ export declare function formatBootImportDetail(input: {
24
+ count?: number;
25
+ lastModule?: string;
26
+ elapsedMs?: number;
27
+ }): string;
28
+ /**
29
+ * Ratchet a candidate boot-import progress value against the highest
30
+ * value any consumer has emitted so far (stored on
31
+ * `globalThis.__NS_HMR_BOOT_LAST_PROGRESS__`). Reset by
32
+ * `clearBootProgressState` between sessions.
33
+ */
34
+ export declare function applyMonotonicBootProgress(candidate: number): number;
35
+ /**
36
+ * Reset every boot-progress global so a re-bootstrapped session (e.g.
37
+ * after `__reboot_ng_modules__`) starts a fresh ratchet rather than
38
+ * inheriting the previous cycle's terminal values.
39
+ */
40
+ export declare function clearBootProgressState(): void;
@@ -0,0 +1,128 @@
1
+ // Pure helpers for the cold-boot "Importing the app entry" progress display.
2
+ //
3
+ // Pipeline:
4
+ // * Server-side `buildBootProgressSnippet` is injected at the top of
5
+ // every `__ns_boot__/b1`-tagged module and bumps the count /
6
+ // last-module globals (FULLY SYNCHRONOUS — see the snippet doc for
7
+ // why top-level await must stay out of boot-tagged modules).
8
+ // * `startBrowserRuntimeSession` stamps the time origin
9
+ // (`__NS_HMR_BOOT_IMPORT_STARTED_AT__`) right before
10
+ // `__nsStartDevSession`.
11
+ // * `startBootImportHeartbeat` reads both signals every 250 ms and
12
+ // re-asserts `'importing-main'` so the bar climbs even across long
13
+ // vendor stretches that don't tick the count axis. The iOS runtime's
14
+ // `MaybePumpJSThreadDuringBoot` keeps the JS-thread CFRunLoop ticking
15
+ // between synchronous fetches so the heartbeat's `setInterval` timer
16
+ // can fire during the cold-boot module walk.
17
+ //
18
+ // Monotonic ratchet (`applyMonotonicBootProgress`,
19
+ // `__NS_HMR_BOOT_LAST_PROGRESS__`): each tick can never undercut the
20
+ // previous one, preventing visible stutter when the count axis briefly
21
+ // wins over the time axis.
22
+ /**
23
+ * `'importing-main'` is the long HTTP-module-load phase (5–10s for a
24
+ * real Angular app). The bar uses this range so the user sees ~62
25
+ * percentage points of motion during the phase that actually takes
26
+ * time, sandwiched between the cheap bootstrap stages
27
+ * ('configuring-import-map' = 26) and the post-import wait
28
+ * ('waiting-for-app' = 94 → 'app-root-committed' = 100).
29
+ */
30
+ export const BOOT_IMPORT_PROGRESS_MIN = 30;
31
+ export const BOOT_IMPORT_PROGRESS_MAX = 92;
32
+ /** Ceiling guards against rounding into `'waiting-for-app'` (94). */
33
+ export const BOOT_IMPORT_PROGRESS_CEILING = 94;
34
+ const BOOT_IMPORT_PROGRESS_RANGE = BOOT_IMPORT_PROGRESS_MAX - BOOT_IMPORT_PROGRESS_MIN;
35
+ /**
36
+ * Compute the percentage shown next to "Importing the app entry".
37
+ *
38
+ * Sum of two clamped contributions:
39
+ * * `progressFromCount` — `__NS_HMR_BOOT_MODULE_COUNT__` bumped by the
40
+ * boot snippet (1 unit per 2 modules, cap 40).
41
+ * * `progressFromTime` — elapsed wall-clock since
42
+ * `__NS_HMR_BOOT_IMPORT_STARTED_AT__` (1 unit per 250 ms, cap
43
+ * matches the full 62-point range so time alone can drive the bar
44
+ * 30 → 92 if the count axis is starved).
45
+ *
46
+ * The count axis goes silent in long node_modules stretches and on
47
+ * Vite's rewrite chains where the served import URL skips the
48
+ * `__ns_boot__/b1` prefix; the time axis covers those gaps. Both
49
+ * contributions are summed, clamped to the 62-point range, then
50
+ * ceilinged so they cannot cross into 'waiting-for-app' (94+).
51
+ *
52
+ * Canonical values are pinned by `boot-progress.spec.ts`. The
53
+ * server-side snippet does NOT mirror this math — it only writes the
54
+ * counters; the heartbeat in `session-bootstrap.ts` is the sole caller.
55
+ */
56
+ const BOOT_IMPORT_COUNT_CONTRIBUTION_MAX = 40;
57
+ const BOOT_IMPORT_TIME_CONTRIBUTION_MAX = 62;
58
+ const BOOT_IMPORT_COUNT_DIVISOR = 2;
59
+ const BOOT_IMPORT_TIME_TICK_MS = 250;
60
+ export function computeBootImportProgress(input) {
61
+ // Coerce NaN / ±Infinity / negatives to 0 — `Math.max(0, NaN)` is NaN.
62
+ const rawCount = Number(input?.count ?? 0);
63
+ const rawElapsed = Number(input?.elapsedMs ?? 0);
64
+ const count = Number.isFinite(rawCount) ? Math.max(0, rawCount) : 0;
65
+ const elapsedMs = Number.isFinite(rawElapsed) ? Math.max(0, rawElapsed) : 0;
66
+ const progressFromCount = Math.min(BOOT_IMPORT_COUNT_CONTRIBUTION_MAX, Math.floor(count / BOOT_IMPORT_COUNT_DIVISOR));
67
+ const progressFromTime = Math.min(BOOT_IMPORT_TIME_CONTRIBUTION_MAX, Math.floor(elapsedMs / BOOT_IMPORT_TIME_TICK_MS));
68
+ const combined = BOOT_IMPORT_PROGRESS_MIN + Math.min(BOOT_IMPORT_PROGRESS_RANGE, progressFromCount + progressFromTime);
69
+ return Math.min(BOOT_IMPORT_PROGRESS_CEILING, combined);
70
+ }
71
+ /**
72
+ * Render the second-line detail for the placeholder. Surfaces the
73
+ * count + last-loaded module path once the snippet has fired, or a
74
+ * generic "Loading the module graph (Nms)" line during
75
+ * the pre-snippet window.
76
+ */
77
+ export function formatBootImportDetail(input) {
78
+ const count = Math.max(0, Number(input?.count ?? 0));
79
+ const lastModule = typeof input?.lastModule === 'string' ? input.lastModule : '';
80
+ const elapsedMs = Math.max(0, Number(input?.elapsedMs ?? 0));
81
+ if (count > 0) {
82
+ return lastModule ? `Evaluated ${count} modules\n${lastModule}` : `Evaluated ${count} modules`;
83
+ }
84
+ return `Loading the module graph (${elapsedMs}ms)`;
85
+ }
86
+ /**
87
+ * Ratchet a candidate boot-import progress value against the highest
88
+ * value any consumer has emitted so far (stored on
89
+ * `globalThis.__NS_HMR_BOOT_LAST_PROGRESS__`). Reset by
90
+ * `clearBootProgressState` between sessions.
91
+ */
92
+ export function applyMonotonicBootProgress(candidate) {
93
+ const g = globalThis;
94
+ const previousRaw = g.__NS_HMR_BOOT_LAST_PROGRESS__;
95
+ const previous = typeof previousRaw === 'number' && Number.isFinite(previousRaw) ? previousRaw : 0;
96
+ const next = Math.max(previous, Math.max(0, Number(candidate) || 0));
97
+ try {
98
+ g.__NS_HMR_BOOT_LAST_PROGRESS__ = next;
99
+ }
100
+ catch { }
101
+ return next;
102
+ }
103
+ /**
104
+ * Reset every boot-progress global so a re-bootstrapped session (e.g.
105
+ * after `__reboot_ng_modules__`) starts a fresh ratchet rather than
106
+ * inheriting the previous cycle's terminal values.
107
+ */
108
+ export function clearBootProgressState() {
109
+ const g = globalThis;
110
+ for (const key of [
111
+ '__NS_HMR_BOOT_MODULE_COUNT__',
112
+ '__NS_HMR_BOOT_LAST_MODULE__',
113
+ '__NS_HMR_BOOT_LAST_PROGRESS__',
114
+ '__NS_HMR_BOOT_LAST_PROGRESS_AT__',
115
+ '__NS_HMR_BOOT_IMPORT_STARTED_AT__',
116
+ // Defensive: an earlier snippet shape used this to throttle a
117
+ // top-level await yield. Removed — top-level await in a boot-tagged
118
+ // module trips the iOS 10s async-module deadline. Cleared in case a
119
+ // stale boot left it behind.
120
+ '__NS_HMR_BOOT_LAST_YIELD_AT__',
121
+ ]) {
122
+ try {
123
+ delete g[key];
124
+ }
125
+ catch { }
126
+ }
127
+ }
128
+ //# sourceMappingURL=boot-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boot-progress.js","sourceRoot":"","sources":["../../../../../../packages/vite/hmr/shared/runtime/boot-progress.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,YAAY;AACZ,uEAAuE;AACvE,iEAAiE;AACjE,uEAAuE;AACvE,iEAAiE;AACjE,0DAA0D;AAC1D,yDAAyD;AACzD,6BAA6B;AAC7B,qEAAqE;AACrE,uEAAuE;AACvE,yEAAyE;AACzE,0EAA0E;AAC1E,yEAAyE;AACzE,iDAAiD;AACjD,EAAE;AACF,mDAAmD;AACnD,qEAAqE;AACrE,uEAAuE;AACvE,2BAA2B;AAE3B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAE3C,qEAAqE;AACrE,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C,MAAM,0BAA0B,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,kCAAkC,GAAG,EAAE,CAAC;AAC9C,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAC7C,MAAM,yBAAyB,GAAG,CAAC,CAAC;AACpC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAErC,MAAM,UAAU,yBAAyB,CAAC,KAA6C;IACtF,uEAAuE;IACvE,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,IAA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ACX,CAAC;AACF,CAAC"}
@@ -0,0 +1,18 @@
1
+ export type BootTraceSegment = {
2
+ ok?: boolean;
3
+ ms?: number;
4
+ meta?: Record<string, unknown>;
5
+ };
6
+ export type BootTrace = {
7
+ t0: number;
8
+ t1?: number;
9
+ session?: BootTraceSegment;
10
+ importMap?: BootTraceSegment;
11
+ kickstart?: BootTraceSegment;
12
+ native?: BootTraceSegment;
13
+ error?: {
14
+ message: string;
15
+ };
16
+ };
17
+ export declare function formatBootTimeline(trace: BootTrace): string;
18
+ export declare function publishBootTrace(trace: BootTrace): void;
@@ -0,0 +1,52 @@
1
+ // Boot timeline instrumentation for the NativeScript dev session.
2
+ //
3
+ // `session-bootstrap.ts` is the real boot path on modern runtimes with
4
+ // `__nsStartDevSession`. We record how long each segment takes and turn
5
+ // the result into a single-line, human-readable log that is always on
6
+ // (not behind the verbose flag) so anyone chasing regressions can see
7
+ // the shape of a cold boot without having to flip any switches.
8
+ //
9
+ // The trace is also mirrored onto `globalThis.__NS_BOOT_TRACE__` so a
10
+ // developer can `console.log(globalThis.__NS_BOOT_TRACE__)` from the
11
+ // device or pick it up via `js:evaluate` in test harnesses.
12
+ // Pure formatter so we can unit-test the exact string shape without
13
+ // touching `console.info` or `Date.now()`.
14
+ //
15
+ // Format:
16
+ // [ns-boot] ok total=1234ms session=45ms importMap=67ms native=1100ms
17
+ // [ns-boot] FAILED total=230ms session=45ms ...: <message>
18
+ //
19
+ // Segment entries are only included when a numeric `ms` was recorded —
20
+ // this keeps the log compact when a particular phase was skipped (e.g.
21
+ // `__NS_IMPORT_MAP_CONFIGURED__` dedup) or never reached (early error).
22
+ export function formatBootTimeline(trace) {
23
+ const status = trace.error ? 'FAILED' : 'ok';
24
+ const parts = [];
25
+ const push = (label, seg) => {
26
+ if (seg && typeof seg.ms === 'number' && Number.isFinite(seg.ms)) {
27
+ parts.push(`${label}=${Math.max(0, Math.round(seg.ms))}ms`);
28
+ }
29
+ };
30
+ const total = typeof trace.t0 === 'number' && typeof trace.t1 === 'number' ? trace.t1 - trace.t0 : undefined;
31
+ if (typeof total === 'number' && Number.isFinite(total)) {
32
+ parts.push(`total=${Math.max(0, Math.round(total))}ms`);
33
+ }
34
+ push('session', trace.session);
35
+ push('importMap', trace.importMap);
36
+ push('kickstart', trace.kickstart);
37
+ push('native', trace.native);
38
+ const suffix = trace.error?.message ? `: ${trace.error.message}` : '';
39
+ return `[ns-boot] ${status} ${parts.join(' ')}${suffix}`.replace(/\s+$/, '');
40
+ }
41
+ // Install the trace on `globalThis` so diagnostics can pick it up. We
42
+ // use a distinct key from the legacy entry-runtime trace so existing
43
+ // readers that expect `__NS_ENTRY_TRACE__` keep working. Exported for
44
+ // tests; the runtime path calls this from the session-bootstrap finally
45
+ // block.
46
+ export function publishBootTrace(trace) {
47
+ try {
48
+ globalThis.__NS_BOOT_TRACE__ = trace;
49
+ }
50
+ catch { }
51
+ }
52
+ //# sourceMappingURL=boot-timeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boot-timeline.js","sourceRoot":"","sources":["../../../../../../packages/vite/hmr/shared/runtime/boot-timeline.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,gEAAgE;AAChE,EAAE;AACF,sEAAsE;AACtE,qEAAqE;AACrE,4DAA4D;AAsB5D,oEAAoE;AACpE,2CAA2C;AAC3C,EAAE;AACF,UAAU;AACV,wEAAwE;AACxE,6DAA6D;AAC7D,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,MAAM,UAAU,kBAAkB,CAAC,KAAgB;IAClD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,GAAiC,EAAE,EAAE;QACj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AC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,sEAAsE;AACtE,qEAAqE;AACrE,sEAAsE;AACtE,wEAAwE;AACxE,SAAS;AACT,MAAM,UAAU,gBAAgB,CAAC,KAAgB;IAChD,IAAI,CAAC;QACH,UAAkB,CAAC,iBAAiB,GAAG,KAAK,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;AACX,CAAC"}
@@ -0,0 +1,31 @@
1
+ type HmrOverlayTone = 'info' | 'warn' | 'error' | 'success';
2
+ type HmrOverlayMode = 'hidden' | 'boot' | 'connection' | 'update';
3
+ export type HmrOverlayPosition = 'top' | 'bottom' | 'center';
4
+ export type HmrBootStage = 'placeholder' | 'probing-origin' | 'loading-entry-runtime' | 'configuring-import-map' | 'loading-runtime-bridge' | 'loading-core-bridge' | 'preloading-style-scope' | 'installing-css' | 'importing-main' | 'waiting-for-app' | 'app-root-committed' | 'ready' | 'error';
5
+ export type HmrConnectionStage = 'connecting' | 'reconnecting' | 'synchronizing' | 'offline' | 'healthy';
6
+ export type HmrUpdateStage = 'received' | 'evicting' | 'reimporting' | 'rebooting' | 'complete';
7
+ export type HmrOverlayStageInfo = {
8
+ detail?: string;
9
+ origin?: string;
10
+ progress?: number | null;
11
+ attempt?: number;
12
+ attempts?: number;
13
+ };
14
+ export type HmrOverlaySnapshot = {
15
+ visible: boolean;
16
+ mode: HmrOverlayMode;
17
+ badge: string;
18
+ title: string;
19
+ phase: string;
20
+ detail: string;
21
+ progress: number | null;
22
+ busy: boolean;
23
+ blocking: boolean;
24
+ tone: HmrOverlayTone;
25
+ };
26
+ export declare const BOOT_TITLE = "NativeScript Vite preparing dev session...";
27
+ export declare const DEFAULT_SNAPSHOT: HmrOverlaySnapshot;
28
+ export declare function createBootOverlaySnapshot(stage: HmrBootStage, info?: HmrOverlayStageInfo): HmrOverlaySnapshot;
29
+ export declare function createConnectionOverlaySnapshot(stage: HmrConnectionStage, info?: HmrOverlayStageInfo): HmrOverlaySnapshot;
30
+ export declare function createUpdateOverlaySnapshot(stage: HmrUpdateStage, info?: HmrOverlayStageInfo): HmrOverlaySnapshot;
31
+ export {};