@nativescript/vite 0.0.1 → 1.0.0

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 (281) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +81 -0
  3. package/{dist/configuration → configuration}/angular.d.ts +1 -1
  4. package/configuration/angular.js +371 -0
  5. package/configuration/angular.js.map +1 -0
  6. package/configuration/base.d.ts +5 -0
  7. package/configuration/base.js +491 -0
  8. package/configuration/base.js.map +1 -0
  9. package/configuration/javascript.d.ts +4 -0
  10. package/configuration/javascript.js +152 -0
  11. package/configuration/javascript.js.map +1 -0
  12. package/{dist/configuration → configuration}/react.d.ts +1 -1
  13. package/{dist/configuration → configuration}/react.js +18 -17
  14. package/configuration/react.js.map +1 -0
  15. package/{dist/configuration → configuration}/solid.d.ts +1 -1
  16. package/{dist/configuration → configuration}/solid.js +17 -16
  17. package/configuration/solid.js.map +1 -0
  18. package/configuration/typescript.d.ts +4 -0
  19. package/configuration/typescript.js +176 -0
  20. package/configuration/typescript.js.map +1 -0
  21. package/{dist/configuration → configuration}/vue.d.ts +1 -1
  22. package/configuration/vue.js +163 -0
  23. package/configuration/vue.js.map +1 -0
  24. package/helpers/angular/angular-linker.d.ts +13 -0
  25. package/helpers/angular/angular-linker.js +189 -0
  26. package/helpers/angular/angular-linker.js.map +1 -0
  27. package/helpers/angular/shared-linker.d.ts +4 -0
  28. package/helpers/angular/shared-linker.js +39 -0
  29. package/helpers/angular/shared-linker.js.map +1 -0
  30. package/helpers/angular/util.d.ts +1 -0
  31. package/helpers/angular/util.js +67 -0
  32. package/helpers/angular/util.js.map +1 -0
  33. package/helpers/cli-flags.d.ts +1 -0
  34. package/helpers/cli-flags.js +15 -0
  35. package/helpers/cli-flags.js.map +1 -0
  36. package/{dist/helpers → helpers}/commonjs-plugins.js +14 -13
  37. package/helpers/commonjs-plugins.js.map +1 -0
  38. package/{dist/helpers → helpers}/config-as-json.d.ts +1 -1
  39. package/{dist/helpers → helpers}/config-as-json.js +7 -6
  40. package/helpers/config-as-json.js.map +1 -0
  41. package/helpers/css-platform-plugin.d.ts +10 -0
  42. package/helpers/css-platform-plugin.js +76 -0
  43. package/helpers/css-platform-plugin.js.map +1 -0
  44. package/helpers/css-tree.js +22 -0
  45. package/helpers/css-tree.js.map +1 -0
  46. package/{dist/helpers → helpers}/dynamic-import-plugin.js +8 -7
  47. package/helpers/dynamic-import-plugin.js.map +1 -0
  48. package/helpers/esbuild-platform-resolver.d.ts +14 -0
  49. package/helpers/esbuild-platform-resolver.js +93 -0
  50. package/helpers/esbuild-platform-resolver.js.map +1 -0
  51. package/helpers/external-configs.d.ts +6 -0
  52. package/helpers/external-configs.js +34 -0
  53. package/helpers/external-configs.js.map +1 -0
  54. package/{dist/helpers → helpers}/flavor.d.ts +1 -0
  55. package/helpers/flavor.js +51 -0
  56. package/helpers/flavor.js.map +1 -0
  57. package/helpers/global-defines.d.ts +25 -0
  58. package/helpers/global-defines.js +29 -0
  59. package/helpers/global-defines.js.map +1 -0
  60. package/helpers/init.d.ts +1 -0
  61. package/helpers/init.js +119 -0
  62. package/helpers/init.js.map +1 -0
  63. package/helpers/logging.d.ts +13 -0
  64. package/helpers/logging.js +115 -0
  65. package/helpers/logging.js.map +1 -0
  66. package/helpers/main-entry.d.ts +10 -0
  67. package/helpers/main-entry.js +223 -0
  68. package/helpers/main-entry.js.map +1 -0
  69. package/{dist/helpers → helpers}/module-resolution.js +4 -3
  70. package/helpers/module-resolution.js.map +1 -0
  71. package/helpers/module-runner-patch.d.ts +3 -0
  72. package/helpers/module-runner-patch.js +63 -0
  73. package/helpers/module-runner-patch.js.map +1 -0
  74. package/helpers/nativeclass-transform.d.ts +7 -0
  75. package/helpers/nativeclass-transform.js +158 -0
  76. package/helpers/nativeclass-transform.js.map +1 -0
  77. package/helpers/nativeclass-transformer-plugin.d.ts +5 -0
  78. package/helpers/nativeclass-transformer-plugin.js +23 -0
  79. package/helpers/nativeclass-transformer-plugin.js.map +1 -0
  80. package/{dist/helpers → helpers}/nativescript-package-resolver.js +18 -17
  81. package/helpers/nativescript-package-resolver.js.map +1 -0
  82. package/helpers/ns-cli-plugins.d.ts +14 -0
  83. package/helpers/ns-cli-plugins.js +165 -0
  84. package/helpers/ns-cli-plugins.js.map +1 -0
  85. package/helpers/package-platform-aliases.d.ts +10 -0
  86. package/{dist/helpers → helpers}/package-platform-aliases.js +19 -23
  87. package/helpers/package-platform-aliases.js.map +1 -0
  88. package/helpers/postcss-platform-config.d.ts +13 -0
  89. package/helpers/postcss-platform-config.js +97 -0
  90. package/helpers/postcss-platform-config.js.map +1 -0
  91. package/helpers/prelink-angular.d.ts +2 -0
  92. package/helpers/prelink-angular.js +117 -0
  93. package/helpers/prelink-angular.js.map +1 -0
  94. package/helpers/preserve-imports.d.ts +2 -0
  95. package/helpers/preserve-imports.js +38 -0
  96. package/helpers/preserve-imports.js.map +1 -0
  97. package/{dist/helpers → helpers}/project.js +2 -4
  98. package/helpers/project.js.map +1 -0
  99. package/helpers/resolver.d.ts +4 -0
  100. package/{dist/helpers → helpers}/resolver.js +7 -6
  101. package/helpers/resolver.js.map +1 -0
  102. package/helpers/theme-core-plugins.d.ts +14 -0
  103. package/helpers/theme-core-plugins.js +121 -0
  104. package/helpers/theme-core-plugins.js.map +1 -0
  105. package/helpers/ts-config-paths.d.ts +10 -0
  106. package/{dist/helpers → helpers}/ts-config-paths.js +73 -72
  107. package/helpers/ts-config-paths.js.map +1 -0
  108. package/{dist/helpers → helpers}/utils.d.ts +10 -0
  109. package/helpers/utils.js +143 -0
  110. package/helpers/utils.js.map +1 -0
  111. package/{dist/helpers → helpers}/workers.js +15 -16
  112. package/helpers/workers.js.map +1 -0
  113. package/hmr/client/css-handler.d.ts +4 -0
  114. package/hmr/client/css-handler.js +78 -0
  115. package/hmr/client/css-handler.js.map +1 -0
  116. package/hmr/client/index.d.ts +13 -0
  117. package/hmr/client/index.js +1723 -0
  118. package/hmr/client/index.js.map +1 -0
  119. package/hmr/client/utils.d.ts +38 -0
  120. package/hmr/client/utils.js +426 -0
  121. package/hmr/client/utils.js.map +1 -0
  122. package/hmr/entry-runtime.d.ts +8 -0
  123. package/hmr/entry-runtime.js +135 -0
  124. package/hmr/entry-runtime.js.map +1 -0
  125. package/hmr/frameworks/angular/client/index.d.ts +8 -0
  126. package/hmr/frameworks/angular/client/index.js +59 -0
  127. package/hmr/frameworks/angular/client/index.js.map +1 -0
  128. package/hmr/frameworks/angular/server/linker.d.ts +1 -0
  129. package/hmr/frameworks/angular/server/linker.js +101 -0
  130. package/hmr/frameworks/angular/server/linker.js.map +1 -0
  131. package/hmr/frameworks/angular/server/strategy.d.ts +2 -0
  132. package/hmr/frameworks/angular/server/strategy.js +187 -0
  133. package/hmr/frameworks/angular/server/strategy.js.map +1 -0
  134. package/hmr/frameworks/solid/server/strategy.d.ts +2 -0
  135. package/hmr/frameworks/solid/server/strategy.js +56 -0
  136. package/hmr/frameworks/solid/server/strategy.js.map +1 -0
  137. package/hmr/frameworks/typescript/server/strategy.d.ts +2 -0
  138. package/hmr/frameworks/typescript/server/strategy.js +125 -0
  139. package/hmr/frameworks/typescript/server/strategy.js.map +1 -0
  140. package/hmr/frameworks/vue/client/index.d.ts +22 -0
  141. package/hmr/frameworks/vue/client/index.js +1541 -0
  142. package/hmr/frameworks/vue/client/index.js.map +1 -0
  143. package/hmr/frameworks/vue/server/compiler.d.ts +11 -0
  144. package/hmr/frameworks/vue/server/compiler.js +26 -0
  145. package/hmr/frameworks/vue/server/compiler.js.map +1 -0
  146. package/hmr/frameworks/vue/server/sfc-transforms.d.ts +14 -0
  147. package/hmr/frameworks/vue/server/sfc-transforms.js +282 -0
  148. package/hmr/frameworks/vue/server/sfc-transforms.js.map +1 -0
  149. package/hmr/frameworks/vue/server/strategy.d.ts +2 -0
  150. package/hmr/frameworks/vue/server/strategy.js +272 -0
  151. package/hmr/frameworks/vue/server/strategy.js.map +1 -0
  152. package/hmr/helpers/ast-extract.d.ts +6 -0
  153. package/hmr/helpers/ast-extract.js +72 -0
  154. package/hmr/helpers/ast-extract.js.map +1 -0
  155. package/hmr/helpers/ast-normalizer.d.ts +7 -0
  156. package/hmr/helpers/ast-normalizer.js +772 -0
  157. package/hmr/helpers/ast-normalizer.js.map +1 -0
  158. package/hmr/helpers/babel.d.ts +3 -0
  159. package/hmr/helpers/babel.js +17 -0
  160. package/hmr/helpers/babel.js.map +1 -0
  161. package/hmr/helpers/sanitize.d.ts +6 -0
  162. package/hmr/helpers/sanitize.js +55 -0
  163. package/hmr/helpers/sanitize.js.map +1 -0
  164. package/hmr/helpers/vendor-rewrite.d.ts +1 -0
  165. package/hmr/helpers/vendor-rewrite.js +35 -0
  166. package/hmr/helpers/vendor-rewrite.js.map +1 -0
  167. package/hmr/server/compiler.d.ts +2 -0
  168. package/hmr/server/compiler.js +75 -0
  169. package/hmr/server/compiler.js.map +1 -0
  170. package/hmr/server/constants.d.ts +14 -0
  171. package/hmr/server/constants.js +23 -0
  172. package/hmr/server/constants.js.map +1 -0
  173. package/hmr/server/core-sanitize.d.ts +32 -0
  174. package/hmr/server/core-sanitize.js +134 -0
  175. package/hmr/server/core-sanitize.js.map +1 -0
  176. package/hmr/server/framework-strategy.d.ts +68 -0
  177. package/hmr/server/framework-strategy.js +2 -0
  178. package/hmr/server/framework-strategy.js.map +1 -0
  179. package/hmr/server/index.d.ts +5 -0
  180. package/hmr/server/index.js +23 -0
  181. package/hmr/server/index.js.map +1 -0
  182. package/hmr/server/vite-plugin.d.ts +5 -0
  183. package/hmr/server/vite-plugin.js +44 -0
  184. package/hmr/server/vite-plugin.js.map +1 -0
  185. package/hmr/server/websocket.d.ts +21 -0
  186. package/hmr/server/websocket.js +5619 -0
  187. package/hmr/server/websocket.js.map +1 -0
  188. package/hmr/shared/runtime/http-only-boot.d.ts +1 -0
  189. package/hmr/shared/runtime/http-only-boot.js +107 -0
  190. package/hmr/shared/runtime/http-only-boot.js.map +1 -0
  191. package/hmr/shared/runtime/root-placeholder.d.ts +1 -0
  192. package/hmr/shared/runtime/root-placeholder.js +142 -0
  193. package/hmr/shared/runtime/root-placeholder.js.map +1 -0
  194. package/hmr/shared/runtime/vendor-bootstrap.d.ts +1 -0
  195. package/hmr/shared/runtime/vendor-bootstrap.js +134 -0
  196. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -0
  197. package/hmr/shared/vendor/manifest-loader.d.ts +9 -0
  198. package/hmr/shared/vendor/manifest-loader.js +38 -0
  199. package/hmr/shared/vendor/manifest-loader.js.map +1 -0
  200. package/hmr/shared/vendor/manifest.d.ts +35 -0
  201. package/hmr/shared/vendor/manifest.js +811 -0
  202. package/hmr/shared/vendor/manifest.js.map +1 -0
  203. package/hmr/shared/vendor/registry.d.ts +9 -0
  204. package/hmr/shared/vendor/registry.js +62 -0
  205. package/hmr/shared/vendor/registry.js.map +1 -0
  206. package/hmr/vendor-bootstrap.d.ts +3 -0
  207. package/hmr/vendor-bootstrap.js +32 -0
  208. package/hmr/vendor-bootstrap.js.map +1 -0
  209. package/{dist/index.d.ts → index.d.ts} +2 -0
  210. package/index.js +19 -0
  211. package/index.js.map +1 -0
  212. package/package.json +42 -30
  213. package/{dist/polyfills → polyfills}/mdn-data-at-rules.js +1 -0
  214. package/polyfills/mdn-data-at-rules.js.map +1 -0
  215. package/{dist/polyfills → polyfills}/mdn-data-properties.js +1 -0
  216. package/polyfills/mdn-data-properties.js.map +1 -0
  217. package/{dist/polyfills → polyfills}/mdn-data-syntaxes.js +1 -0
  218. package/polyfills/mdn-data-syntaxes.js.map +1 -0
  219. package/{dist/polyfills → polyfills}/module.js +1 -0
  220. package/polyfills/module.js.map +1 -0
  221. package/runtime/core-aliases-early.d.ts +1 -0
  222. package/runtime/core-aliases-early.js +334 -0
  223. package/runtime/core-aliases-early.js.map +1 -0
  224. package/shims/angular-animations-stub.d.ts +68 -0
  225. package/shims/angular-animations-stub.js +140 -0
  226. package/shims/angular-animations-stub.js.map +1 -0
  227. package/shims/node-module.d.ts +5 -0
  228. package/shims/node-module.js +13 -0
  229. package/shims/node-module.js.map +1 -0
  230. package/{dist/shims → shims}/react-reconciler-constants.js +2 -1
  231. package/shims/react-reconciler-constants.js.map +1 -0
  232. package/{dist/shims → shims}/react-reconciler.js +1 -0
  233. package/shims/react-reconciler.js.map +1 -0
  234. package/{dist/shims → shims}/set-value.js +5 -1
  235. package/shims/set-value.js.map +1 -0
  236. package/transformers/NativeClass/index.d.ts +2 -0
  237. package/transformers/NativeClass/index.js +222 -0
  238. package/transformers/NativeClass/index.js.map +1 -0
  239. package/dist/configuration/angular.js +0 -30
  240. package/dist/configuration/base.d.ts +0 -13
  241. package/dist/configuration/base.js +0 -228
  242. package/dist/configuration/old-without-merge-base.d.ts +0 -13
  243. package/dist/configuration/old-without-merge-base.js +0 -249
  244. package/dist/configuration/vue.js +0 -45
  245. package/dist/helpers/css-tree.js +0 -21
  246. package/dist/helpers/flavor.js +0 -40
  247. package/dist/helpers/global-defines.d.ts +0 -14
  248. package/dist/helpers/global-defines.js +0 -18
  249. package/dist/helpers/main-entry.d.ts +0 -5
  250. package/dist/helpers/main-entry.js +0 -75
  251. package/dist/helpers/ns-cli-plugins.d.ts +0 -17
  252. package/dist/helpers/ns-cli-plugins.js +0 -128
  253. package/dist/helpers/package-platform-aliases.d.ts +0 -4
  254. package/dist/helpers/resolver.d.ts +0 -4
  255. package/dist/helpers/ts-config-paths.d.ts +0 -4
  256. package/dist/helpers/utils.js +0 -94
  257. package/dist/hmr/hmr-angular.d.ts +0 -1
  258. package/dist/hmr/hmr-angular.js +0 -34
  259. package/dist/hmr/hmr-bridge.d.ts +0 -18
  260. package/dist/hmr/hmr-bridge.js +0 -154
  261. package/dist/hmr/hmr-client.d.ts +0 -5
  262. package/dist/hmr/hmr-client.js +0 -93
  263. package/dist/hmr/hmr-server.d.ts +0 -20
  264. package/dist/hmr/hmr-server.js +0 -179
  265. package/dist/index.js +0 -5
  266. package/dist/transformers/NativeClass/index.d.ts +0 -5
  267. package/dist/transformers/NativeClass/index.js +0 -46
  268. /package/{dist/helpers → helpers}/commonjs-plugins.d.ts +0 -0
  269. /package/{dist/helpers → helpers}/css-tree.d.ts +0 -0
  270. /package/{dist/helpers → helpers}/dynamic-import-plugin.d.ts +0 -0
  271. /package/{dist/helpers → helpers}/module-resolution.d.ts +0 -0
  272. /package/{dist/helpers → helpers}/nativescript-package-resolver.d.ts +0 -0
  273. /package/{dist/helpers → helpers}/project.d.ts +0 -0
  274. /package/{dist/helpers → helpers}/workers.d.ts +0 -0
  275. /package/{dist/polyfills → polyfills}/mdn-data-at-rules.d.ts +0 -0
  276. /package/{dist/polyfills → polyfills}/mdn-data-properties.d.ts +0 -0
  277. /package/{dist/polyfills → polyfills}/mdn-data-syntaxes.d.ts +0 -0
  278. /package/{dist/polyfills → polyfills}/module.d.ts +0 -0
  279. /package/{dist/shims → shims}/react-reconciler-constants.d.ts +0 -0
  280. /package/{dist/shims → shims}/react-reconciler.d.ts +0 -0
  281. /package/{dist/shims → shims}/set-value.d.ts +0 -0
@@ -0,0 +1,13 @@
1
+ import { type Logger } from 'vite';
2
+ type Primitive = string | number | boolean | undefined | null;
3
+ type ResolveOptions = {
4
+ env?: Record<string, Primitive>;
5
+ cliFlags?: Record<string, Primitive> | null;
6
+ defaultValue?: boolean;
7
+ cache?: boolean;
8
+ useGlobalFlag?: boolean;
9
+ };
10
+ export declare function resolveVerboseFlag(options?: ResolveOptions): boolean;
11
+ export declare function clearVerboseCache(): void;
12
+ export declare function createFilteredViteLogger(): Logger;
13
+ export {};
@@ -0,0 +1,115 @@
1
+ import { createLogger } from 'vite';
2
+ const GLOBAL_VERBOSE_FLAG = '__NS_ENV_VERBOSE__';
3
+ const ENV_VERBOSE_KEYS = ['NS_VITE_VERBOSE', 'NS_ENV_VERBOSE', 'NS_VERBOSE', 'VERBOSE', 'VITE_DEBUG_LOGS', 'DEBUG'];
4
+ let cachedVerbose;
5
+ function coerceBoolean(value) {
6
+ if (value === undefined || value === null)
7
+ return undefined;
8
+ if (typeof value === 'boolean')
9
+ return value;
10
+ if (typeof value === 'number')
11
+ return value !== 0;
12
+ if (typeof value === 'string') {
13
+ const normalized = value.trim().toLowerCase();
14
+ if (!normalized)
15
+ return undefined;
16
+ if (['1', 'true', 'yes', 'y', 'on', 'debug'].includes(normalized)) {
17
+ return true;
18
+ }
19
+ if (['0', 'false', 'no', 'n', 'off'].includes(normalized)) {
20
+ return false;
21
+ }
22
+ return true;
23
+ }
24
+ return undefined;
25
+ }
26
+ export function resolveVerboseFlag(options = {}) {
27
+ if (options.cache !== false && typeof cachedVerbose === 'boolean') {
28
+ return cachedVerbose;
29
+ }
30
+ const { env = typeof process !== 'undefined' ? process.env : undefined, cliFlags } = options;
31
+ let resolved;
32
+ if (cliFlags && typeof cliFlags === 'object') {
33
+ const cliVerbose = coerceBoolean(cliFlags.verbose ?? cliFlags.VERBOSE);
34
+ if (typeof cliVerbose === 'boolean') {
35
+ resolved = cliVerbose;
36
+ }
37
+ }
38
+ if (resolved === undefined && options.useGlobalFlag !== false) {
39
+ try {
40
+ const globalVerbose = globalThis?.[GLOBAL_VERBOSE_FLAG];
41
+ const coerced = coerceBoolean(globalVerbose);
42
+ if (typeof coerced === 'boolean') {
43
+ resolved = coerced;
44
+ }
45
+ }
46
+ catch { }
47
+ }
48
+ if (resolved === undefined && env) {
49
+ for (const key of ENV_VERBOSE_KEYS) {
50
+ if (Object.prototype.hasOwnProperty.call(env, key)) {
51
+ const envVerbose = coerceBoolean(env[key]);
52
+ if (typeof envVerbose === 'boolean') {
53
+ resolved = envVerbose;
54
+ break;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ if (resolved === undefined) {
60
+ resolved = options.defaultValue ?? false;
61
+ }
62
+ if (options.cache !== false) {
63
+ cachedVerbose = resolved;
64
+ }
65
+ return resolved;
66
+ }
67
+ export function clearVerboseCache() {
68
+ cachedVerbose = undefined;
69
+ }
70
+ // Vite/Rollup warning filter helper
71
+ // Centralizes suppression of noisy build warnings that are either benign or
72
+ // expected given NativeScript's virtual vendor bundling strategy.
73
+ // Currently filters:
74
+ // - Sourcemap missing source files (common in published packages)
75
+ // - Eval usage attributed to the virtual "@nativescript/vendor" module
76
+ // - License/annotation position warnings for the vendor bundle
77
+ // Extend this list cautiously; prefer documenting each suppression reason.
78
+ export function createFilteredViteLogger() {
79
+ const baseLogger = createLogger(undefined, { allowClearScreen: true });
80
+ return {
81
+ ...baseLogger,
82
+ warn(message, options) {
83
+ const msg = String(message || '');
84
+ if (shouldSuppressViteWarning(msg))
85
+ return;
86
+ return baseLogger.warn(message, options);
87
+ },
88
+ warnOnce(message) {
89
+ const msg = String(message || '');
90
+ if (shouldSuppressViteWarning(msg))
91
+ return;
92
+ return baseLogger.warnOnce(message);
93
+ },
94
+ };
95
+ }
96
+ function shouldSuppressViteWarning(msg) {
97
+ // Missing sourcemap original sources
98
+ if (msg.startsWith('Sourcemap for ') && msg.includes('missing source files')) {
99
+ return true;
100
+ }
101
+ // Vendor eval usage (third-party libs aggregated); benign
102
+ if (msg.includes('Use of eval') && (msg.includes('@nativescript/vendor') || msg.includes('"@nativescript/vendor"'))) {
103
+ return true;
104
+ }
105
+ // Annotation/license position warning for vendor bundle
106
+ if ((msg.includes('contains an annotation that Rollup cannot interpret') || msg.includes('position of the comment')) && (msg.includes('@nativescript/vendor') || msg.includes('"@nativescript/vendor"'))) {
107
+ return true;
108
+ }
109
+ // Analog Angular optimizer/router plugins do not emit sourcemaps; Vite floods logs with warnings.
110
+ if (msg.includes('Sourcemap is likely to be incorrect') && (msg.includes('analogjs-router-optimization') || msg.includes('@analogjs/vite-plugin-angular-optimizer'))) {
111
+ return true;
112
+ }
113
+ return false;
114
+ }
115
+ //# sourceMappingURL=logging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,MAAM,CAAC;AAEjD,MAAM,mBAAmB,GAAG,oBAAoB,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AAI,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC;QACrH,OAAO,IAAI,CAAC;IACb,CAAC;IACD,wDAAwD;IACxD,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,qDAAqD,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC;QAC1M,OAAO,IAAI,CAAC;IACb,CAAC;IACD,kGAAkG;IAClG,IAAI,GAAG,CAAC,QAAQ,CAAC,qCAAqC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,8BAA8B,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC,EAAE,CAAC;QACtK,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function mainEntryPlugin(opts: {
2
+ platform: 'ios' | 'android' | 'visionos';
3
+ isDevMode: boolean;
4
+ verbose: boolean;
5
+ hmrActive: boolean;
6
+ }): {
7
+ name: string;
8
+ resolveId(id: string): string;
9
+ load(id: string): string;
10
+ };
@@ -0,0 +1,223 @@
1
+ import { getPackageJson, getProjectFilePath, getProjectRootPath } from './project.js';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { getProjectFlavor } from './flavor.js';
5
+ import { getProjectAppPath, getProjectAppRelativePath, getProjectAppVirtualPath } from './utils.js';
6
+ // Switched to runtime modules to avoid fragile string injection and enable TS checks
7
+ const projectRoot = getProjectRootPath();
8
+ const appRootDir = getProjectAppPath();
9
+ // main entry (always included regardless of HMR)
10
+ const packageJson = getPackageJson();
11
+ const mainEntry = getProjectFilePath(packageJson.main);
12
+ // Normalize to a project-relative posix path (e.g., "/src/app.ts") for HTTP ESM boot
13
+ const mainEntryRelPosix = (() => {
14
+ try {
15
+ const rel = path.relative(projectRoot, mainEntry).replace(/\\/g, '/');
16
+ return ('/' + rel).replace(/\/+/g, '/');
17
+ }
18
+ catch {
19
+ return getProjectAppVirtualPath('app.ts');
20
+ }
21
+ })();
22
+ const flavor = getProjectFlavor();
23
+ // Optional polyfills support (non-HMR specific but dev friendly)
24
+ const polyfillsPath = getProjectFilePath(getProjectAppRelativePath('polyfills.ts'));
25
+ const polyfillsExists = fs.existsSync(polyfillsPath);
26
+ const VIRTUAL_ID = 'virtual:entry-with-polyfills';
27
+ const RESOLVED = '\0' + VIRTUAL_ID;
28
+ export function mainEntryPlugin(opts) {
29
+ return {
30
+ name: 'main-entry',
31
+ resolveId(id) {
32
+ if (id === VIRTUAL_ID)
33
+ return RESOLVED;
34
+ return null;
35
+ },
36
+ load(id) {
37
+ if (id !== RESOLVED)
38
+ return null;
39
+ // consistent verbose flag to easily reference below
40
+ let imports = "const __nsVerboseLog = typeof __NS_ENV_VERBOSE__ !== 'undefined' && __NS_ENV_VERBOSE__;\n";
41
+ // Ensure any CommonJS-style tooling requires (e.g. from Babel or other
42
+ // build-time libraries that may be accidentally bundled) do not attempt
43
+ // to resolve Node built-ins like 'fs' or 'path' on device. These modules
44
+ // are not used at runtime for NativeScript apps, so we safely return an
45
+ // empty object from a global require shim when present.
46
+ imports += "try { if (typeof globalThis !== 'undefined') { globalThis.require = function () { return {}; }; } } catch {}\n";
47
+ // Banner diagnostics for visibility at runtime
48
+ if (opts.verbose) {
49
+ imports += `console.info('[ns-entry] begin', { platform: ${JSON.stringify(opts.platform)}, dev: ${JSON.stringify(opts.isDevMode)}, hmr: ${JSON.stringify(opts.hmrActive)}, verbose: ${JSON.stringify(opts.verbose)}, mainEntry: ${JSON.stringify(mainEntry)}, mainRel: ${JSON.stringify(mainEntryRelPosix)}, time: new Date().toISOString() });\n`;
50
+ }
51
+ if (opts.hmrActive) {
52
+ // ---- Vendor manifest bootstrap ----
53
+ // Use single self-contained vendor module to avoid extra imports affecting chunking
54
+ imports += "import vendorManifest, { __nsVendorModuleMap } from '@nativescript/vendor';\n";
55
+ imports += "import { installVendorBootstrap } from '@nativescript/vite/hmr/shared/runtime/vendor-bootstrap.js';\n";
56
+ if (opts.verbose) {
57
+ imports += `console.info('[ns-entry] vendor manifest imported', { keys: Object.keys(vendorManifest||{}).length, hasMap: typeof __nsVendorModuleMap === 'object' });\n`;
58
+ }
59
+ imports += 'installVendorBootstrap(vendorManifest, __nsVendorModuleMap, __nsVerboseLog);\n';
60
+ if (opts.verbose) {
61
+ imports += `console.info('[ns-entry] vendor bootstrap installed');\n`;
62
+ }
63
+ }
64
+ // ---- Core runtime globals (always-needed) ----
65
+ // Load globals early
66
+ imports += "import '@nativescript/core/globals/index';\n";
67
+ if (opts.verbose) {
68
+ imports += `console.info('[ns-entry] core globals loaded');\n`;
69
+ }
70
+ /**
71
+ * Ensure the canonical @nativescript/core classes are available on globalThis
72
+ * before any other framework modules execute (like bundle-entry-points) to avoid duplicate realms
73
+ * and lifecycle registration using an uninitialized Application instance.
74
+ * We do this for both HMR and non-HMR builds to guarantee stable bootstrap.
75
+ */
76
+ imports += "import { installCoreAliasesEarly } from '@nativescript/vite/runtime/core-aliases-early.js';\n";
77
+ imports += 'installCoreAliasesEarly(__nsVerboseLog);\n';
78
+ if (opts.hmrActive) {
79
+ // Placeholder root for HMR to show prior to http loaded es modules take over
80
+ if (opts.verbose) {
81
+ imports += `console.info('[ns-entry] installing placeholder...');\n`;
82
+ }
83
+ imports += "import { installRootPlaceholder } from '@nativescript/vite/hmr/shared/runtime/root-placeholder.js';\n";
84
+ imports += 'installRootPlaceholder(__nsVerboseLog);\n';
85
+ if (opts.verbose) {
86
+ imports += `console.info('[ns-entry] placeholder installed');\n`;
87
+ }
88
+ }
89
+ // Load NS bundle entry points after early hook
90
+ imports += "import '@nativescript/core/bundle-entry-points';\n";
91
+ if (opts.verbose) {
92
+ imports += `console.info('[ns-entry] bundle-entry-points loaded');\n`;
93
+ }
94
+ if (flavor === 'typescript') {
95
+ // Statically import bundler context synchronously before app code
96
+ imports += "import 'virtual:ns-bundler-context';\n";
97
+ }
98
+ // ---- Platform-specific always-needed modules ----
99
+ if (opts.platform === 'android') {
100
+ if (opts.hmrActive) {
101
+ /**
102
+ * Ensure the Java Activity class exists by executing the vendor-packed
103
+ * activity registration module via the vendor registry (not ESM import).
104
+ * This avoids any on-disk vendor.mjs export mismatches and guarantees the
105
+ * class is registered before Android tries to instantiate it.
106
+ */
107
+ imports += `
108
+ (function __nsEnsureAndroidActivityForHMR(){
109
+ try {
110
+ const g = globalThis;
111
+ const req = (g.__nsVendorRequire || g.__nsRequire);
112
+ if (!req) {
113
+ ${opts.verbose ? "console.warn('[ns-entry] vendor require not available yet; activity registration may be deferred');" : ''}
114
+ return;
115
+ }
116
+ const candidates = [
117
+ '@nativescript/core/ui/frame/activity.android',
118
+ '@nativescript/core/ui/frame/activity.android.js'
119
+ ];
120
+ for (const id of candidates) {
121
+ try {
122
+ req(id);
123
+ ${opts.verbose ? "console.info('[ns-entry] android activity registered via vendor', id);" : ''}
124
+ break;
125
+ } catch {}
126
+ }
127
+ } catch (e) {
128
+ try { console.error('[ns-entry] failed to require android activity from vendor', e); } catch {}
129
+ }
130
+ })();\n`;
131
+ }
132
+ else {
133
+ /**
134
+ * Non-HMR: Defer activity lifecycle wiring until native Application is ready
135
+ * to avoid "application is null" errors at production boot.
136
+ */
137
+ imports += `
138
+ (function __nsDeferAndroidActivityImport(){
139
+ const load = () => { try { import('@nativescript/core/ui/frame/activity.android.js?ns-keep'); } catch (e) { console.error('[ns-entry] failed to import android activity module', e); } };
140
+ try {
141
+ import('@nativescript/core').then(({ Application: __NS_Application }) => {
142
+ try {
143
+ const hasApp = !!(__NS_Application && __NS_Application.android && __NS_Application.android.nativeApp);
144
+ if (hasApp) {
145
+ ${opts.verbose ? "console.info('[ns-entry] android activity import: nativeApp present, loading now');" : ''}
146
+ load();
147
+ } else {
148
+ ${opts.verbose ? "console.info('[ns-entry] android activity import: deferring until launch/nativeApp');" : ''}
149
+ try { __NS_Application.on && __NS_Application.on(__NS_Application.launchEvent, load); } catch {}
150
+ try { setTimeout(load, 0); } catch {}
151
+ }
152
+ } catch { try { setTimeout(load, 0); } catch {} }
153
+ }).catch(() => { try { setTimeout(load, 0); } catch {} });
154
+ } catch { try { setTimeout(load, 0); } catch {} }
155
+ })();\n`;
156
+ }
157
+ }
158
+ // ---- Optional polyfills ----
159
+ if (polyfillsExists) {
160
+ imports += `import '${polyfillsPath}';\n`;
161
+ if (opts.verbose) {
162
+ imports += `console.info('[ns-entry] polyfills imported from', ${JSON.stringify(polyfillsPath)});\n`;
163
+ }
164
+ }
165
+ else if (opts.verbose) {
166
+ imports += "console.info('[ns-entry] no polyfills file found');\n";
167
+ }
168
+ // ---- HMR bootstrap prerequisites ----
169
+ if (opts.hmrActive) {
170
+ // WebSocket polyfill needed for dev hot reload messaging
171
+ imports += "import '@valor/nativescript-websockets';\n";
172
+ if (opts.verbose) {
173
+ imports += "console.info('[ns-entry] websockets polyfill imported');\n";
174
+ }
175
+ // Load HMR client for WebSocket connection to Vite dev server before HTTP-only boot attempts.
176
+ imports += "import 'virtual:ns-hmr-client';\n";
177
+ imports += "console.info('@nativescript/vite HMR client loaded.');\n";
178
+ }
179
+ // ---- Global CSS injection (always-needed if file exists) ----
180
+ const appCssPath = path.resolve(projectRoot, getProjectAppRelativePath('app.css'));
181
+ if (fs.existsSync(appCssPath)) {
182
+ imports += `// Import and apply global CSS before app bootstrap\n`;
183
+ imports += `import appCssContent from './${appRootDir}/app.css?inline';\n`;
184
+ imports += `import { Application } from '@nativescript/core';\n`;
185
+ imports += `if (appCssContent) { try { Application.addCss(appCssContent); } catch (error) { console.error('Error applying CSS:', error); } }\n`;
186
+ if (opts.verbose) {
187
+ imports += `console.info('[ns-entry] app.css applied');\n`;
188
+ }
189
+ }
190
+ // ---- Application main entry ----
191
+ if (opts.hmrActive) {
192
+ // HTTP-only dev boot: try to import the entire app over HTTP; if not reachable, keep retrying.
193
+ if (opts.verbose) {
194
+ imports += `console.info('[ns-entry] including HTTP-only boot', { platform: ${JSON.stringify(opts.platform)}, mainRel: ${JSON.stringify(mainEntryRelPosix)} });\n`;
195
+ }
196
+ const defaultHost = opts.platform === 'android' ? '10.0.2.2' : 'localhost';
197
+ imports += "import { startHttpOnlyBoot } from '@nativescript/vite/hmr/shared/runtime/http-only-boot.js';\n";
198
+ imports += `startHttpOnlyBoot(${JSON.stringify(opts.platform)}, ${JSON.stringify(mainEntryRelPosix)}, ${JSON.stringify((process.env.NS_HMR_HOST || '')) || JSON.stringify('')} || ${JSON.stringify(defaultHost)}, __nsVerboseLog);\n`;
199
+ if (opts.verbose) {
200
+ imports += `console.info('[ns-entry] HTTP-only boot code appended');\n`;
201
+ }
202
+ }
203
+ else {
204
+ if (opts.verbose) {
205
+ imports += `console.info('[ns-entry] Importing main entry', '${mainEntry}');\n`;
206
+ }
207
+ imports += `import '${mainEntry}';\n`;
208
+ }
209
+ if (opts.isDevMode) {
210
+ // debug tools support
211
+ imports += "import '@nativescript/core/inspector_modules';\n";
212
+ if (opts.verbose) {
213
+ imports += "console.info('[ns-entry] inspector modules imported');\n";
214
+ }
215
+ }
216
+ if (opts.verbose) {
217
+ imports += `console.info('[ns-entry] end', { time: new Date().toISOString() });\n`;
218
+ }
219
+ return imports;
220
+ },
221
+ };
222
+ }
223
+ //# sourceMappingURL=main-entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main-entry.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/main-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,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AAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;gBAC3E,OAAO,IAAI,gGAAgG,CAAC;gBAC5G,OAAO,IAAI,qBAAqB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAW,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,sBAAsB,CAAC;gBAChP,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBAClB,OAAO,IAAI,4DAA4D,CAAC;gBACzE,CAAC;YACF,CAAC;iBAAM,CAAC;gBACP,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBAClB,OAAO,IAAI,oDAAoD,SAAS,OAAO,CAAC;gBACjF,CAAC;gBACD,OAAO,IAAI,WAAW,SAAS,MAAM,CAAC;YACvC,CAAC;YAED,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpB,sBAAsB;gBACtB,OAAO,IAAI,kDAAkD,CAAC;gBAC9D,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBAClB,OAAO,IAAI,0DAA0D,CAAC;gBACvE,CAAC;YACF,CAAC;YAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,OAAO,IAAI,uEAAuE,CAAC;YACpF,CAAC;YAED,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1,11 +1,11 @@
1
- import path from "path";
2
- import fs from "fs";
1
+ import path from 'path';
2
+ import fs from 'fs';
3
3
  // Node.js-style module resolution: walk up directory tree looking for node_modules
4
4
  export function findPackageInNodeModules(packageName, startDir) {
5
5
  let currentDir = startDir;
6
6
  while (currentDir !== path.dirname(currentDir)) {
7
7
  // Stop at filesystem root
8
- const nodeModulesDir = path.join(currentDir, "node_modules");
8
+ const nodeModulesDir = path.join(currentDir, 'node_modules');
9
9
  const packagePath = path.join(nodeModulesDir, packageName);
10
10
  if (fs.existsSync(packagePath)) {
11
11
  return packagePath;
@@ -15,3 +15,4 @@ export function findPackageInNodeModules(packageName, startDir) {
15
15
  }
16
16
  return null;
17
17
  }
18
+ //# sourceMappingURL=module-resolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-resolution.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/module-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,mFAAmF;AACnF,MAAM,UAAU,wBAAwB,CAAC,WAAmB,EAAE,QAAgB;IAC7E,IAAI,UAAU,GAAG,QAAQ,CAAC;IAC1B,OAAO,UAAU,KAAK,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAChD,0BAA0B;QAC1B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC7D,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QAE3D,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAChC,OAAO,WAAW,CAAC;QACpB,CAAC;QAED,wBAAwB;QACxB,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from 'vite';
2
+ export declare function moduleRunnerPatchPlugin(): Plugin;
3
+ export default moduleRunnerPatchPlugin;
@@ -0,0 +1,63 @@
1
+ // Build-time patch: ensure vendor.mjs's bundled ModuleRunner.getModuleInformation
2
+ // always receives a valid options object with a cache to prevent
3
+ // "Cannot use 'in' operator to search for 'cache' in undefined".
4
+ export function moduleRunnerPatchPlugin() {
5
+ return {
6
+ name: 'ns-module-runner-patch',
7
+ apply: 'build',
8
+ enforce: 'post',
9
+ generateBundle(_opts, bundle) {
10
+ for (const [fileName, chunk] of Object.entries(bundle)) {
11
+ if (fileName !== 'vendor.mjs')
12
+ continue;
13
+ if (chunk.type !== 'chunk' || typeof chunk.code !== 'string')
14
+ continue;
15
+ let code = chunk.code;
16
+ // Try to locate the function definition (non-minified dev build keeps names)
17
+ // Handle both forms: function getModuleInformation(id, options) { ... }
18
+ // and class method or object method: getModuleInformation(id, options) { ... }
19
+ const patterns = [/function\s+getModuleInformation\s*\(([^)]*)\)\s*\{/, /getModuleInformation\s*\(([^)]*)\)\s*\{/];
20
+ let replaced = false;
21
+ for (const re of patterns) {
22
+ const m = re.exec(code);
23
+ if (!m)
24
+ continue;
25
+ const rawParams = (m[1] || '')
26
+ .split(',')
27
+ .map((s) => s.trim())
28
+ .filter(Boolean);
29
+ const idParam = rawParams[0];
30
+ const second = rawParams[1];
31
+ const third = rawParams[2];
32
+ let guard = '\n';
33
+ if (third && second) {
34
+ // Signature: (id, importer, options)
35
+ guard += `if (typeof ${second} !== 'string') ${second} = undefined;\n`;
36
+ guard += `${third} = ${third} && typeof ${third}==='object' ? ${third} : {};\n`;
37
+ guard += `if (!('cache' in ${third})) ${third}.cache = new Map();\n`;
38
+ }
39
+ else if (second) {
40
+ // Signature: (id, options)
41
+ guard += `${second} = ${second} && typeof ${second}==='object' ? ${second} : {};\n`;
42
+ guard += `if (!('cache' in ${second})) ${second}.cache = new Map();\n`;
43
+ }
44
+ else {
45
+ // Unknown/minified: use arguments[] positions
46
+ guard += `(function(){ try{ var __imp = arguments[1]; if (typeof __imp !== 'string') arguments[1] = undefined; } catch(_){} })();\n`;
47
+ guard += `(function(){ try{ var __o = arguments[2] ?? arguments[1]; if (!__o || typeof __o!=='object') { __o = {}; if (arguments.length>2) arguments[2]=__o; else arguments[1]=__o; } if (!('cache' in __o)) __o.cache = new Map(); } catch(_){} })();\n`;
48
+ }
49
+ // Inject guard right after the opening brace of the function
50
+ const start = m.index + m[0].length;
51
+ code = code.slice(0, start) + guard + code.slice(start);
52
+ replaced = true;
53
+ break;
54
+ }
55
+ if (replaced) {
56
+ chunk.code = code;
57
+ }
58
+ }
59
+ },
60
+ };
61
+ }
62
+ export default moduleRunnerPatchPlugin;
63
+ //# sourceMappingURL=module-runner-patch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-runner-patch.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/module-runner-patch.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,iEAAiE;AACjE,iEAAiE;AACjE,MAAM,UAAU,uBAAuB;IACtC,OAAO;QACN,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,MAAM;QACf,cAAc,CAAC,KAAK,EAAE,MAAM;YAC3B,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBACxD,IAAI,QAAQ,KAAK,YAAY;oBAAE,SAAS;gBACxC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;oBAAE,SAAS;gBACvE,IAAI,IAAI,GAAG,KAAK,CAAC,IAAc,CAAC;gBAEhC,6EAA6E;gBAC7E,wEAAwE;gBACxE,+EAA+E;gBAC/E,MAAM,QAAQ,GAAa,CAAC,oDAAoD,EAAE,yCAAyC,CAAC,CAAC;gBAE7H,IAAI,QAAQ,GAAG,KAAK,CAAC;gBACrB,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;oBAC3B,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACxB,IAAI,CAAC,CAAC;wBAAE,SAAS;oBACjB,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,C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P,CAAC;gBAED,IAAI,QAAQ,EAAE,CAAC;oBACb,KAAa,CAAC,IAAI,GAAG,IAAI,CAAC;gBAC5B,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC;AAED,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Apply the NativeClass transformer to a source string. Returns null if no change performed.
3
+ */
4
+ export declare function transformNativeClassSource(code: string, fileName: string): {
5
+ code: string;
6
+ map: any;
7
+ };