@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,101 @@
1
+ import type { VendorManifest } from '../shared/vendor/manifest.js';
2
+ export declare function extractVitePrebundleId(spec: string): string | null;
3
+ export declare function getFlattenedManifestMap(manifest: VendorManifest): Map<string, string>;
4
+ export declare function normalizeNativeScriptCoreSpecifier(spec: string): string;
5
+ export declare function normalizeNodeModulesSpecifier(spec: string): string | null;
6
+ export declare function isEsmFrameworkPackageSpecifier(spec: string): boolean;
7
+ export declare function isCoreGlobalsReference(spec: string): boolean;
8
+ export declare function isNativeScriptCoreModule(spec: string): boolean;
9
+ export declare function isNativeScriptPluginModule(spec: string): boolean;
10
+ export declare function getBlockedDeviceNodeModulesReason(spec: string): string | null;
11
+ export declare function isLikelyNativeScriptRuntimePluginSpecifier(spec: string, projectRoot?: string): boolean;
12
+ export declare function isLikelyNativeScriptPluginSpecifier(spec: string, projectRoot?: string): boolean;
13
+ export declare function tryReadRawExplicitJavaScriptModule(spec: string, projectRoot: string): {
14
+ code: string;
15
+ resolvedId: string;
16
+ } | null;
17
+ export declare function stripDecoratedServePrefixes(spec: string): {
18
+ cleanedSpec: string;
19
+ bootTaggedRequest: boolean;
20
+ forcedVer: string | null;
21
+ };
22
+ export declare function resolveVendorFromCandidate(specifier: string | null | undefined): string | null;
23
+ /**
24
+ * Resolve a candidate URL ('/node_modules/...', '/@fs/...', or an
25
+ * absolute fs path) to a real file on disk under one of the allowed
26
+ * roots, returning the absolute fs path or `null`.
27
+ *
28
+ * `workspaceRoot` is consulted ONLY when the candidate cannot be
29
+ * resolved under `projectRoot` — this keeps the existing app-local
30
+ * behaviour identical and adds a fallback for monorepos where
31
+ * `node_modules/` is hoisted above the app dir (Nx, Rush, Turborepo,
32
+ * etc.). Without this fallback, every `/ns/m/node_modules/<hoisted-pkg>`
33
+ * request to the dev server's bridge fails with a "transform miss"
34
+ * 404 even though the file is right there at the workspace root.
35
+ */
36
+ export declare function resolveCandidateFilePath(candidate: string, projectRoot: string, workspaceRoot?: string | null): string | null;
37
+ /**
38
+ * Rewrite a `/@fs/<abs-path>` URL into a `/ns/m/<rel>` URL so the chain
39
+ * stays inside our HMR pipeline.
40
+ *
41
+ * Vite's transform output emits `/@fs/<abs-path>` for any module whose
42
+ * resolved id lives outside the configured `root` — including hoisted
43
+ * `node_modules/<pkg>/...` entries and workspace libraries in monorepos
44
+ * (Nx, Rush, Turborepo, pnpm/yarn/npm workspaces, etc.). If we leave
45
+ * those URLs untouched, the device fetches them through Vite's standard
46
+ * middleware which does NOT apply our CJS/UMD-wrapping pipeline; UMD
47
+ * modules like papaparse then crash because top-level `this` is
48
+ * `undefined` in ESM context (the `(function(root, factory) { ... })(this,
49
+ * function moduleFactory() { ... })` IIFE passes `undefined` as `root`
50
+ * and the third branch tries to do `undefined.Papa = factory()`).
51
+ *
52
+ * The conversion preserves any `?...` / `#...` suffix and tries roots in
53
+ * this order:
54
+ * 1. `projectRoot` — app-local files; mirrors the URL shape we already
55
+ * emit for relative imports under the app's own dir.
56
+ * 2. `workspaceRoot` — hoisted `node_modules` and monorepo workspace
57
+ * libs. The `/ns/m/` handler resolves these via its
58
+ * `buildFsCandidate` fallback that probes both roots.
59
+ *
60
+ * Returns `null` when the absolute path is outside both roots; the
61
+ * caller should then leave the original `/@fs/` URL alone (defensive).
62
+ */
63
+ export declare function rewriteFsAbsoluteToNsM(spec: string, projectRoot: string, workspaceRoot?: string | null): string | null;
64
+ /**
65
+ * Filter `candidates` (variations of `spec` with different extensions /
66
+ * `index.*`) down to those that exist on disk under `projectRoot` or
67
+ * `workspaceRoot`. Workspace-root-only matches are rewritten to their
68
+ * `/@fs/<abs-path>` form so the downstream `transformRequest` call can
69
+ * load them directly without having to go through Vite's bare-specifier
70
+ * resolver — which is gated by the package's `package.json#exports`
71
+ * field and refuses internal sub-paths even when the file is on disk
72
+ * (e.g. `css-tree/lib/syntax/index.js`).
73
+ *
74
+ * Candidates whose real path (after symlink resolution) lives OUTSIDE
75
+ * any `node_modules` directory are also rewritten to `/@fs/<real-path>`.
76
+ * Vite's built-in esbuild transform plugin excludes `node_modules` paths
77
+ * from TS->JS conversion, so a workspace TypeScript package re-exposed
78
+ * via `node_modules/<scope>/<pkg>` (a common monorepo pattern: e.g.
79
+ * `node_modules/@blackout/plugins -> ../../plugins/src`) would otherwise
80
+ * be served as raw TypeScript and fail at the device with `Missing
81
+ * initializer in const declaration` on type annotations like
82
+ * `export const X: string = '...'`. Routing through the realpath makes
83
+ * Vite see a non-`node_modules` path and the TS transform applies.
84
+ *
85
+ * App-local candidates whose real path is also app-local are returned
86
+ * unchanged so existing behaviour is preserved bit-for-bit.
87
+ */
88
+ export declare function filterExistingNodeModulesTransformCandidates(spec: string, candidates: string[], projectRoot: string, workspaceRoot?: string | null): string[];
89
+ export declare function viteDepsPathToBareSpecifier(depPath: string): string | null;
90
+ export declare function resolveNodeModulesPackageBoundary(nodeModulesSpec: string, projectRoot: string): {
91
+ packageName: string;
92
+ subpath: string;
93
+ };
94
+ export declare function resolveInternalRuntimePluginBareSpecifier(spec: string, projectRoot: string): string | null;
95
+ export declare function shouldPreserveBareRuntimePluginSubpathImport(spec: string, projectRoot: string): boolean;
96
+ export declare function resolveVendorRouting(nodeModulesSpec: string, projectRoot: string): {
97
+ route: 'vendor';
98
+ bareSpec: string;
99
+ } | {
100
+ route: 'http';
101
+ } | null;