@nativescript/vite 8.0.0-alpha.2 → 8.0.0-alpha.21

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 (209) hide show
  1. package/configuration/angular.d.ts +34 -1
  2. package/configuration/angular.js +380 -34
  3. package/configuration/angular.js.map +1 -1
  4. package/configuration/base.js +171 -7
  5. package/configuration/base.js.map +1 -1
  6. package/configuration/solid.js +27 -1
  7. package/configuration/solid.js.map +1 -1
  8. package/configuration/typescript.js +1 -1
  9. package/configuration/typescript.js.map +1 -1
  10. package/helpers/angular/angular-linker.js +3 -12
  11. package/helpers/angular/angular-linker.js.map +1 -1
  12. package/helpers/angular/inject-component-hmr-registration.d.ts +112 -0
  13. package/helpers/angular/inject-component-hmr-registration.js +359 -0
  14. package/helpers/angular/inject-component-hmr-registration.js.map +1 -0
  15. package/helpers/angular/inject-hmr-vite-ignore.d.ts +75 -0
  16. package/helpers/angular/inject-hmr-vite-ignore.js +288 -0
  17. package/helpers/angular/inject-hmr-vite-ignore.js.map +1 -0
  18. package/helpers/angular/util.d.ts +1 -0
  19. package/helpers/angular/util.js +88 -0
  20. package/helpers/angular/util.js.map +1 -1
  21. package/helpers/commonjs-plugins.d.ts +5 -2
  22. package/helpers/commonjs-plugins.js +126 -0
  23. package/helpers/commonjs-plugins.js.map +1 -1
  24. package/helpers/config-as-json.js +10 -0
  25. package/helpers/config-as-json.js.map +1 -1
  26. package/helpers/dev-host.d.ts +274 -0
  27. package/helpers/dev-host.js +491 -0
  28. package/helpers/dev-host.js.map +1 -0
  29. package/helpers/global-defines.d.ts +51 -0
  30. package/helpers/global-defines.js +77 -0
  31. package/helpers/global-defines.js.map +1 -1
  32. package/helpers/logging.d.ts +1 -0
  33. package/helpers/logging.js +63 -3
  34. package/helpers/logging.js.map +1 -1
  35. package/helpers/main-entry.d.ts +3 -1
  36. package/helpers/main-entry.js +450 -125
  37. package/helpers/main-entry.js.map +1 -1
  38. package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
  39. package/helpers/nativeclass-transformer-plugin.js +157 -14
  40. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  41. package/helpers/ns-core-url.d.ts +88 -0
  42. package/helpers/ns-core-url.js +191 -0
  43. package/helpers/ns-core-url.js.map +1 -0
  44. package/helpers/prelink-angular.js +1 -4
  45. package/helpers/prelink-angular.js.map +1 -1
  46. package/helpers/project.d.ts +35 -0
  47. package/helpers/project.js +120 -2
  48. package/helpers/project.js.map +1 -1
  49. package/helpers/resolver.js +9 -1
  50. package/helpers/resolver.js.map +1 -1
  51. package/helpers/solid-jsx-deps.d.ts +15 -0
  52. package/helpers/solid-jsx-deps.js +178 -0
  53. package/helpers/solid-jsx-deps.js.map +1 -0
  54. package/helpers/ts-config-paths.js +50 -2
  55. package/helpers/ts-config-paths.js.map +1 -1
  56. package/helpers/workers.d.ts +20 -19
  57. package/helpers/workers.js +620 -3
  58. package/helpers/workers.js.map +1 -1
  59. package/hmr/client/css-handler.d.ts +1 -0
  60. package/hmr/client/css-handler.js +34 -5
  61. package/hmr/client/css-handler.js.map +1 -1
  62. package/hmr/client/css-update-overlay.d.ts +18 -0
  63. package/hmr/client/css-update-overlay.js +27 -0
  64. package/hmr/client/css-update-overlay.js.map +1 -0
  65. package/hmr/client/hmr-pending-overlay.d.ts +27 -0
  66. package/hmr/client/hmr-pending-overlay.js +50 -0
  67. package/hmr/client/hmr-pending-overlay.js.map +1 -0
  68. package/hmr/client/index.js +491 -34
  69. package/hmr/client/index.js.map +1 -1
  70. package/hmr/client/utils.d.ts +5 -0
  71. package/hmr/client/utils.js +283 -12
  72. package/hmr/client/utils.js.map +1 -1
  73. package/hmr/client/vue-sfc-update-overlay.d.ts +82 -0
  74. package/hmr/client/vue-sfc-update-overlay.js +133 -0
  75. package/hmr/client/vue-sfc-update-overlay.js.map +1 -0
  76. package/hmr/entry-runtime.d.ts +2 -1
  77. package/hmr/entry-runtime.js +253 -66
  78. package/hmr/entry-runtime.js.map +1 -1
  79. package/hmr/frameworks/angular/client/index.d.ts +3 -1
  80. package/hmr/frameworks/angular/client/index.js +802 -10
  81. package/hmr/frameworks/angular/client/index.js.map +1 -1
  82. package/hmr/frameworks/angular/server/linker.js +1 -4
  83. package/hmr/frameworks/angular/server/linker.js.map +1 -1
  84. package/hmr/frameworks/angular/server/strategy.js +30 -6
  85. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  86. package/hmr/frameworks/typescript/server/strategy.js +8 -2
  87. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  88. package/hmr/frameworks/vue/client/index.js +30 -45
  89. package/hmr/frameworks/vue/client/index.js.map +1 -1
  90. package/hmr/helpers/ast-normalizer.js +52 -5
  91. package/hmr/helpers/ast-normalizer.js.map +1 -1
  92. package/hmr/helpers/cjs-named-exports.d.ts +23 -0
  93. package/hmr/helpers/cjs-named-exports.js +152 -0
  94. package/hmr/helpers/cjs-named-exports.js.map +1 -0
  95. package/hmr/helpers/package-exports.d.ts +16 -0
  96. package/hmr/helpers/package-exports.js +396 -0
  97. package/hmr/helpers/package-exports.js.map +1 -0
  98. package/hmr/server/constants.js +13 -4
  99. package/hmr/server/constants.js.map +1 -1
  100. package/hmr/server/core-sanitize.d.ts +93 -8
  101. package/hmr/server/core-sanitize.js +222 -49
  102. package/hmr/server/core-sanitize.js.map +1 -1
  103. package/hmr/server/import-map.js +80 -22
  104. package/hmr/server/import-map.js.map +1 -1
  105. package/hmr/server/index.d.ts +2 -1
  106. package/hmr/server/index.js.map +1 -1
  107. package/hmr/server/ns-core-cjs-shape.d.ts +204 -0
  108. package/hmr/server/ns-core-cjs-shape.js +271 -0
  109. package/hmr/server/ns-core-cjs-shape.js.map +1 -0
  110. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  111. package/hmr/server/ns-rt-bridge.js +131 -0
  112. package/hmr/server/ns-rt-bridge.js.map +1 -0
  113. package/hmr/server/perf-instrumentation.d.ts +114 -0
  114. package/hmr/server/perf-instrumentation.js +195 -0
  115. package/hmr/server/perf-instrumentation.js.map +1 -0
  116. package/hmr/server/runtime-graph-filter.d.ts +5 -0
  117. package/hmr/server/runtime-graph-filter.js +21 -0
  118. package/hmr/server/runtime-graph-filter.js.map +1 -0
  119. package/hmr/server/shared-transform-request.d.ts +12 -0
  120. package/hmr/server/shared-transform-request.js +144 -0
  121. package/hmr/server/shared-transform-request.js.map +1 -0
  122. package/hmr/server/vite-plugin.d.ts +21 -1
  123. package/hmr/server/vite-plugin.js +497 -58
  124. package/hmr/server/vite-plugin.js.map +1 -1
  125. package/hmr/server/websocket-angular-entry.d.ts +2 -0
  126. package/hmr/server/websocket-angular-entry.js +68 -0
  127. package/hmr/server/websocket-angular-entry.js.map +1 -0
  128. package/hmr/server/websocket-angular-hot-update.d.ts +78 -0
  129. package/hmr/server/websocket-angular-hot-update.js +413 -0
  130. package/hmr/server/websocket-angular-hot-update.js.map +1 -0
  131. package/hmr/server/websocket-core-bridge.d.ts +58 -0
  132. package/hmr/server/websocket-core-bridge.js +368 -0
  133. package/hmr/server/websocket-core-bridge.js.map +1 -0
  134. package/hmr/server/websocket-css-hot-update.d.ts +33 -0
  135. package/hmr/server/websocket-css-hot-update.js +65 -0
  136. package/hmr/server/websocket-css-hot-update.js.map +1 -0
  137. package/hmr/server/websocket-graph-upsert.d.ts +21 -0
  138. package/hmr/server/websocket-graph-upsert.js +33 -0
  139. package/hmr/server/websocket-graph-upsert.js.map +1 -0
  140. package/hmr/server/websocket-hmr-pending.d.ts +43 -0
  141. package/hmr/server/websocket-hmr-pending.js +55 -0
  142. package/hmr/server/websocket-hmr-pending.js.map +1 -0
  143. package/hmr/server/websocket-module-bindings.d.ts +6 -0
  144. package/hmr/server/websocket-module-bindings.js +471 -0
  145. package/hmr/server/websocket-module-bindings.js.map +1 -0
  146. package/hmr/server/websocket-module-specifiers.d.ts +101 -0
  147. package/hmr/server/websocket-module-specifiers.js +820 -0
  148. package/hmr/server/websocket-module-specifiers.js.map +1 -0
  149. package/hmr/server/websocket-ns-m-finalize.d.ts +22 -0
  150. package/hmr/server/websocket-ns-m-finalize.js +88 -0
  151. package/hmr/server/websocket-ns-m-finalize.js.map +1 -0
  152. package/hmr/server/websocket-ns-m-paths.d.ts +3 -0
  153. package/hmr/server/websocket-ns-m-paths.js +92 -0
  154. package/hmr/server/websocket-ns-m-paths.js.map +1 -0
  155. package/hmr/server/websocket-ns-m-request.d.ts +45 -0
  156. package/hmr/server/websocket-ns-m-request.js +196 -0
  157. package/hmr/server/websocket-ns-m-request.js.map +1 -0
  158. package/hmr/server/websocket-served-module-helpers.d.ts +36 -0
  159. package/hmr/server/websocket-served-module-helpers.js +644 -0
  160. package/hmr/server/websocket-served-module-helpers.js.map +1 -0
  161. package/hmr/server/websocket-txn.d.ts +6 -0
  162. package/hmr/server/websocket-txn.js +45 -0
  163. package/hmr/server/websocket-txn.js.map +1 -0
  164. package/hmr/server/websocket-vendor-unifier.d.ts +10 -0
  165. package/hmr/server/websocket-vendor-unifier.js +51 -0
  166. package/hmr/server/websocket-vendor-unifier.js.map +1 -0
  167. package/hmr/server/websocket-vue-sfc.d.ts +26 -0
  168. package/hmr/server/websocket-vue-sfc.js +1053 -0
  169. package/hmr/server/websocket-vue-sfc.js.map +1 -0
  170. package/hmr/server/websocket.d.ts +58 -75
  171. package/hmr/server/websocket.js +2232 -1802
  172. package/hmr/server/websocket.js.map +1 -1
  173. package/hmr/shared/package-classifier.d.ts +9 -0
  174. package/hmr/shared/package-classifier.js +58 -0
  175. package/hmr/shared/package-classifier.js.map +1 -0
  176. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  177. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  178. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  179. package/hmr/shared/runtime/boot-progress.d.ts +40 -0
  180. package/hmr/shared/runtime/boot-progress.js +128 -0
  181. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  182. package/hmr/shared/runtime/boot-timeline.d.ts +18 -0
  183. package/hmr/shared/runtime/boot-timeline.js +52 -0
  184. package/hmr/shared/runtime/boot-timeline.js.map +1 -0
  185. package/hmr/shared/runtime/browser-runtime-contract.d.ts +64 -0
  186. package/hmr/shared/runtime/browser-runtime-contract.js +54 -0
  187. package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -0
  188. package/hmr/shared/runtime/dev-overlay.d.ts +78 -3
  189. package/hmr/shared/runtime/dev-overlay.js +1094 -26
  190. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  191. package/hmr/shared/runtime/module-provenance.js +1 -4
  192. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  193. package/hmr/shared/runtime/root-placeholder.d.ts +1 -0
  194. package/hmr/shared/runtime/root-placeholder.js +1019 -151
  195. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  196. package/hmr/shared/runtime/session-bootstrap.d.ts +1 -0
  197. package/hmr/shared/runtime/session-bootstrap.js +309 -0
  198. package/hmr/shared/runtime/session-bootstrap.js.map +1 -0
  199. package/hmr/shared/runtime/vendor-bootstrap.js +1 -9
  200. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  201. package/hmr/shared/vendor/manifest.d.ts +32 -0
  202. package/hmr/shared/vendor/manifest.js +411 -46
  203. package/hmr/shared/vendor/manifest.js.map +1 -1
  204. package/index.d.ts +1 -0
  205. package/index.js +5 -0
  206. package/index.js.map +1 -1
  207. package/package.json +9 -1
  208. package/runtime/core-aliases-early.js +94 -67
  209. package/runtime/core-aliases-early.js.map +1 -1
@@ -0,0 +1,9 @@
1
+ export interface PackageRuntimeInfo {
2
+ rootPackageName: string;
3
+ hasPackageJson: boolean;
4
+ hasExports: boolean;
5
+ mainEntries: Set<string>;
6
+ hasNativeScriptMetadata: boolean;
7
+ }
8
+ export declare function extractRootPackageName(spec: string): string;
9
+ export declare function getPackageRuntimeInfo(spec: string, projectRoot: string): PackageRuntimeInfo;
@@ -0,0 +1,58 @@
1
+ import { readFileSync } from 'fs';
2
+ import path from 'path';
3
+ import { createRequire } from 'node:module';
4
+ const packageRuntimeInfoCache = new Map();
5
+ export function extractRootPackageName(spec) {
6
+ if (!spec)
7
+ return '';
8
+ if (spec.startsWith('@')) {
9
+ const parts = spec.split('/');
10
+ return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : spec;
11
+ }
12
+ return spec.split('/')[0];
13
+ }
14
+ export function getPackageRuntimeInfo(spec, projectRoot) {
15
+ const rootPackageName = extractRootPackageName(String(spec || ''));
16
+ if (!rootPackageName) {
17
+ return {
18
+ rootPackageName: '',
19
+ hasPackageJson: false,
20
+ hasExports: false,
21
+ mainEntries: new Set(),
22
+ hasNativeScriptMetadata: false,
23
+ };
24
+ }
25
+ const resolvedProjectRoot = path.resolve(projectRoot || process.cwd());
26
+ const cacheKey = `${resolvedProjectRoot}::${rootPackageName}`;
27
+ const cached = packageRuntimeInfoCache.get(cacheKey);
28
+ if (cached) {
29
+ return cached;
30
+ }
31
+ const info = {
32
+ rootPackageName,
33
+ hasPackageJson: false,
34
+ hasExports: false,
35
+ mainEntries: new Set(),
36
+ hasNativeScriptMetadata: false,
37
+ };
38
+ try {
39
+ const projectRequire = createRequire(path.join(resolvedProjectRoot, 'package.json'));
40
+ const packageJsonPath = projectRequire.resolve(`${rootPackageName}/package.json`);
41
+ const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
42
+ info.hasPackageJson = true;
43
+ info.hasExports = !!pkg.exports && typeof pkg.exports === 'object';
44
+ for (const field of ['module', 'main']) {
45
+ const value = pkg[field];
46
+ if (value && typeof value === 'string') {
47
+ info.mainEntries.add(value.replace(/^\.\//, ''));
48
+ }
49
+ }
50
+ info.hasNativeScriptMetadata = (typeof pkg.nativescript === 'object' && pkg.nativescript !== null) || typeof pkg.peerDependencies?.['@nativescript/core'] === 'string' || typeof pkg.dependencies?.['@nativescript/core'] === 'string';
51
+ }
52
+ catch {
53
+ // Package metadata unavailable — leave defaults and let callers fall back to heuristics.
54
+ }
55
+ packageRuntimeInfoCache.set(cacheKey, info);
56
+ return info;
57
+ }
58
+ //# sourceMappingURL=package-classifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-classifier.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/shared/package-classifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAU5C,MAAM,uBAAuB,GAAG,IAAI,GAAG,EAA8B,CAAC;AAEtE,MAAM,UAAU,sBAAsB,CAAC,IAAY;IAClD,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7D,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,WAAmB;IACtE,MAAM,eAAe,GAAG,sBAAsB,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC;IACnE,IAAI,CAAC,eAAe,EAAE,CAAC;QACtB,OAAO;YACN,eAAe,EAAE,EAAE;YACnB,cAAc,EAAE,KAAK;YACrB,UAAU,EAAE,KAAK;YACjB,WAAW,EAAE,IAAI,GAAG,EAAU;YAC9B,uBAAuB,EAAE,KAAK;SAC9B,CAAC;IACH,CAAC;IAED,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,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AAG,CAAC,YAAY,KAAK,IAAI,CAAC,IAAI,OAAO,GAAG,CAAC,gBAAgB,EAAE,CAAC,oBAAoB,CAAC,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,YAAY,EAAE,CAAC,oBAAoB,CAAC,KAAK,QAAQ,CAAC;IACxO,CAAC;IAAC,MAAM,CAAC;QACR,yFAAyF;IAC1F,CAAC;IAED,uBAAuB,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -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,EA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AAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACpH,OAAO,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,GAAG,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,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,kCAA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9B,6BAA6B;QAC7B,+BAA+B;QAC/B,kCAAkC;QAClC,mCAAmC;QACnC,8DAA8D;QAC9D,oEAAoE;QACpE,oEAAoE;QACpE,6BAA6B;QAC7B,+BAA+B;KAC/B,EAAE,CAAC;QACH,IAAI,CAAC;YACJ,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,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;AAC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,CAAC;IAE7B,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtE,OAAO,aAAa,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,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,64 @@
1
+ export type NsDevPlatform = 'ios' | 'android' | 'visionos';
2
+ export type NsHostModuleId = `ns-host://${string}`;
3
+ export declare const NS_HOST_RUNTIME_MODULE_ID: "ns-host://runtime";
4
+ export declare const NS_HOST_STYLE_ADAPTER_MODULE_ID: "ns-host://style-adapter";
5
+ export declare const NS_DEFAULT_HOST_MODULES: readonly ["ns-host://runtime", "ns-host://style-adapter"];
6
+ export declare const NS_DEV_SESSION_REQUIRED_FIELDS: readonly ["sessionId", "origin", "entryUrl", "clientUrl", "wsUrl", "platform"];
7
+ export interface NsDevFeatureFlags {
8
+ fullReload?: boolean;
9
+ cssHmr?: boolean;
10
+ errorOverlay?: boolean;
11
+ styleScopeHmr?: boolean;
12
+ }
13
+ export declare const NS_DEFAULT_DEV_FEATURE_FLAGS: Readonly<Required<Pick<NsDevFeatureFlags, 'fullReload' | 'cssHmr'>>>;
14
+ export interface NsDevSessionDescriptor {
15
+ sessionId: string;
16
+ origin: string;
17
+ entryUrl: string;
18
+ clientUrl: string;
19
+ wsUrl: string;
20
+ platform: NsDevPlatform;
21
+ runtimeConfigUrl?: string;
22
+ hostModules?: NsHostModuleId[];
23
+ features?: NsDevFeatureFlags;
24
+ }
25
+ export interface NsRuntimeDevSessionConfig extends NsDevSessionDescriptor {
26
+ }
27
+ export interface NsStyleUpdatePayload {
28
+ url: string;
29
+ cssText: string;
30
+ }
31
+ export interface NsHotUpdateInvalidatePayload {
32
+ urls: string[];
33
+ updatedAt?: number;
34
+ }
35
+ export interface NsRuntimeImportMap {
36
+ imports: Record<string, string>;
37
+ }
38
+ export interface NsRuntimeConfigurePayload {
39
+ importMap: NsRuntimeImportMap;
40
+ volatilePatterns?: string[];
41
+ }
42
+ export interface NsRuntimeDevHostApi {
43
+ configureRuntime?: (config: NsRuntimeConfigurePayload) => void;
44
+ supportsRuntimeConfigUrl: boolean;
45
+ startDevSession: (config: NsRuntimeDevSessionConfig) => Promise<void>;
46
+ invalidateModules?: (urls: string[]) => void;
47
+ reloadDevApp?: () => Promise<void>;
48
+ applyStyleUpdate?: (payload: NsStyleUpdatePayload) => void;
49
+ getLoadedModuleUrls?: () => string[];
50
+ }
51
+ export declare function isNsDevPlatform(value: unknown): value is NsDevPlatform;
52
+ export declare function assertNsDevSessionDescriptor(session: unknown): asserts session is NsDevSessionDescriptor;
53
+ export declare function readNsRuntimeDevHostApi(target?: Partial<typeof globalThis>): NsRuntimeDevHostApi;
54
+ declare global {
55
+ var __nsConfigureDevRuntime: ((config: NsRuntimeConfigurePayload) => void) | undefined;
56
+ var __nsConfigureRuntime: ((config: NsRuntimeConfigurePayload) => void) | undefined;
57
+ var __nsSupportsRuntimeConfigUrl: boolean | undefined;
58
+ var __nsStartDevSession: ((config: NsRuntimeDevSessionConfig) => Promise<void>) | undefined;
59
+ var __nsInvalidateModules: ((urls: string[]) => void) | undefined;
60
+ var __nsReloadDevApp: (() => Promise<void>) | undefined;
61
+ var __nsApplyStyleUpdate: ((payload: NsStyleUpdatePayload) => void) | undefined;
62
+ var __nsGetLoadedModuleUrls: (() => string[]) | undefined;
63
+ }
64
+ export {};
@@ -0,0 +1,54 @@
1
+ export const NS_HOST_RUNTIME_MODULE_ID = 'ns-host://runtime';
2
+ export const NS_HOST_STYLE_ADAPTER_MODULE_ID = 'ns-host://style-adapter';
3
+ export const NS_DEFAULT_HOST_MODULES = [NS_HOST_RUNTIME_MODULE_ID, NS_HOST_STYLE_ADAPTER_MODULE_ID];
4
+ export const NS_DEV_SESSION_REQUIRED_FIELDS = ['sessionId', 'origin', 'entryUrl', 'clientUrl', 'wsUrl', 'platform'];
5
+ export const NS_DEFAULT_DEV_FEATURE_FLAGS = {
6
+ fullReload: true,
7
+ cssHmr: true,
8
+ };
9
+ function isNonEmptyString(value) {
10
+ return typeof value === 'string' && value.length > 0;
11
+ }
12
+ export function isNsDevPlatform(value) {
13
+ return value === 'ios' || value === 'android' || value === 'visionos';
14
+ }
15
+ export function assertNsDevSessionDescriptor(session) {
16
+ if (!session || typeof session !== 'object') {
17
+ throw new Error('Invalid NativeScript dev session descriptor');
18
+ }
19
+ const candidate = session;
20
+ for (const key of NS_DEV_SESSION_REQUIRED_FIELDS) {
21
+ if (!isNonEmptyString(candidate[key])) {
22
+ throw new Error(`Missing dev session field: ${key}`);
23
+ }
24
+ }
25
+ if (!isNsDevPlatform(candidate.platform)) {
26
+ throw new Error(`Invalid dev session platform: ${String(candidate.platform)}`);
27
+ }
28
+ if (candidate.hostModules != null) {
29
+ if (!Array.isArray(candidate.hostModules) || candidate.hostModules.some((value) => !isNonEmptyString(value) || !String(value).startsWith('ns-host://'))) {
30
+ throw new Error('Invalid dev session hostModules');
31
+ }
32
+ }
33
+ if (candidate.runtimeConfigUrl != null && !isNonEmptyString(candidate.runtimeConfigUrl)) {
34
+ throw new Error('Invalid dev session runtimeConfigUrl');
35
+ }
36
+ if (candidate.features != null) {
37
+ if (typeof candidate.features !== 'object') {
38
+ throw new Error('Invalid dev session features');
39
+ }
40
+ }
41
+ }
42
+ export function readNsRuntimeDevHostApi(target = globalThis) {
43
+ return {
44
+ configureRuntime: target.__nsConfigureDevRuntime ?? target.__nsConfigureRuntime,
45
+ supportsRuntimeConfigUrl: target.__nsSupportsRuntimeConfigUrl === true,
46
+ startDevSession: target.__nsStartDevSession,
47
+ invalidateModules: target.__nsInvalidateModules,
48
+ reloadDevApp: target.__nsReloadDevApp,
49
+ applyStyleUpdate: target.__nsApplyStyleUpdate,
50
+ getLoadedModuleUrls: target.__nsGetLoadedModuleUrls,
51
+ };
52
+ }
53
+ export {};
54
+ //# sourceMappingURL=browser-runtime-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-runtime-contract.js","sourceRoot":"","sources":["../../../../../../packages/vite/hmr/shared/runtime/browser-runtime-contract.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,yBAAyB,GAAG,mBAA4B,CAAC;AACtE,MAAM,CAAC,MAAM,+BAA+B,GAAG,yBAAkC,CAAC;AAClF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,yBAAyB,EAAE,+BAA+B,CAA8C,CAAC;AAEjJ,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAS7H,MAAM,CAAC,MAAM,4BAA4B,GAAyE;IACjH,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;CACZ,CAAC;AA6CF,SAAS,gBAAgB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAc;IAC7C,OAAO,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,UAAU,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,OAAgB;IAC5D,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,6CAA6C,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