@nativescript/vite 0.0.1-alpha.7 → 0.0.2

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 (265) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +44 -0
  3. package/{dist/configuration → configuration}/angular.d.ts +1 -1
  4. package/configuration/angular.js +480 -0
  5. package/configuration/angular.js.map +1 -0
  6. package/configuration/base.d.ts +5 -0
  7. package/configuration/base.js +494 -0
  8. package/configuration/base.js.map +1 -0
  9. package/configuration/javascript.d.ts +4 -0
  10. package/configuration/javascript.js +151 -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 +175 -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-linker.d.ts +13 -0
  25. package/helpers/angular-linker.js +181 -0
  26. package/helpers/angular-linker.js.map +1 -0
  27. package/helpers/cli-flags.d.ts +1 -0
  28. package/helpers/cli-flags.js +15 -0
  29. package/helpers/cli-flags.js.map +1 -0
  30. package/{dist/helpers → helpers}/commonjs-plugins.js +14 -13
  31. package/helpers/commonjs-plugins.js.map +1 -0
  32. package/{dist/helpers → helpers}/config-as-json.d.ts +1 -1
  33. package/{dist/helpers → helpers}/config-as-json.js +7 -6
  34. package/helpers/config-as-json.js.map +1 -0
  35. package/helpers/css-platform-plugin.d.ts +10 -0
  36. package/helpers/css-platform-plugin.js +76 -0
  37. package/helpers/css-platform-plugin.js.map +1 -0
  38. package/helpers/css-tree.js +22 -0
  39. package/helpers/css-tree.js.map +1 -0
  40. package/{dist/helpers → helpers}/dynamic-import-plugin.js +8 -7
  41. package/helpers/dynamic-import-plugin.js.map +1 -0
  42. package/helpers/esbuild-platform-resolver.d.ts +14 -0
  43. package/helpers/esbuild-platform-resolver.js +93 -0
  44. package/helpers/esbuild-platform-resolver.js.map +1 -0
  45. package/{dist/helpers → helpers}/external-configs.js +2 -1
  46. package/helpers/external-configs.js.map +1 -0
  47. package/{dist/helpers → helpers}/flavor.d.ts +1 -0
  48. package/helpers/flavor.js +51 -0
  49. package/helpers/flavor.js.map +1 -0
  50. package/{dist/helpers → helpers}/global-defines.d.ts +11 -3
  51. package/helpers/global-defines.js +24 -0
  52. package/helpers/global-defines.js.map +1 -0
  53. package/helpers/logging.d.ts +13 -0
  54. package/helpers/logging.js +111 -0
  55. package/helpers/logging.js.map +1 -0
  56. package/helpers/main-entry.d.ts +10 -0
  57. package/helpers/main-entry.js +215 -0
  58. package/helpers/main-entry.js.map +1 -0
  59. package/{dist/helpers → helpers}/module-resolution.js +4 -3
  60. package/helpers/module-resolution.js.map +1 -0
  61. package/{dist/helpers → helpers}/module-runner-patch.d.ts +1 -1
  62. package/{dist/helpers → helpers}/module-runner-patch.js +10 -12
  63. package/helpers/module-runner-patch.js.map +1 -0
  64. package/helpers/nativeclass-transform.d.ts +7 -0
  65. package/helpers/nativeclass-transform.js +158 -0
  66. package/helpers/nativeclass-transform.js.map +1 -0
  67. package/helpers/nativeclass-transformer-plugin.d.ts +5 -0
  68. package/helpers/nativeclass-transformer-plugin.js +23 -0
  69. package/helpers/nativeclass-transformer-plugin.js.map +1 -0
  70. package/{dist/helpers → helpers}/nativescript-package-resolver.js +18 -17
  71. package/helpers/nativescript-package-resolver.js.map +1 -0
  72. package/{dist/helpers → helpers}/ns-cli-plugins.d.ts +6 -1
  73. package/{dist/helpers → helpers}/ns-cli-plugins.js +31 -51
  74. package/helpers/ns-cli-plugins.js.map +1 -0
  75. package/helpers/package-platform-aliases.d.ts +10 -0
  76. package/{dist/helpers → helpers}/package-platform-aliases.js +18 -22
  77. package/helpers/package-platform-aliases.js.map +1 -0
  78. package/helpers/postcss-platform-config.d.ts +13 -0
  79. package/helpers/postcss-platform-config.js +97 -0
  80. package/helpers/postcss-platform-config.js.map +1 -0
  81. package/helpers/prelink-angular.d.ts +2 -0
  82. package/helpers/prelink-angular.js +117 -0
  83. package/helpers/prelink-angular.js.map +1 -0
  84. package/helpers/preserve-imports.js +38 -0
  85. package/helpers/preserve-imports.js.map +1 -0
  86. package/{dist/helpers → helpers}/project.js +2 -4
  87. package/helpers/project.js.map +1 -0
  88. package/helpers/resolver.d.ts +4 -0
  89. package/{dist/helpers → helpers}/resolver.js +7 -6
  90. package/helpers/resolver.js.map +1 -0
  91. package/helpers/theme-core-plugins.d.ts +14 -0
  92. package/helpers/theme-core-plugins.js +121 -0
  93. package/helpers/theme-core-plugins.js.map +1 -0
  94. package/helpers/ts-config-paths.d.ts +10 -0
  95. package/{dist/helpers → helpers}/ts-config-paths.js +70 -71
  96. package/helpers/ts-config-paths.js.map +1 -0
  97. package/{dist/helpers → helpers}/utils.js +14 -27
  98. package/helpers/utils.js.map +1 -0
  99. package/{dist/helpers → helpers}/workers.js +15 -16
  100. package/helpers/workers.js.map +1 -0
  101. package/{dist/hmr → hmr/client}/css-handler.js +18 -17
  102. package/hmr/client/css-handler.js.map +1 -0
  103. package/hmr/client/index.d.ts +13 -0
  104. package/hmr/client/index.js +1550 -0
  105. package/hmr/client/index.js.map +1 -0
  106. package/hmr/client/utils.d.ts +38 -0
  107. package/hmr/client/utils.js +426 -0
  108. package/hmr/client/utils.js.map +1 -0
  109. package/hmr/entry-runtime.d.ts +8 -0
  110. package/hmr/entry-runtime.js +135 -0
  111. package/hmr/entry-runtime.js.map +1 -0
  112. package/hmr/frameworks/angular/server/strategy.d.ts +2 -0
  113. package/hmr/frameworks/angular/server/strategy.js +101 -0
  114. package/hmr/frameworks/angular/server/strategy.js.map +1 -0
  115. package/hmr/frameworks/vue/client/index.d.ts +22 -0
  116. package/hmr/frameworks/vue/client/index.js +1537 -0
  117. package/hmr/frameworks/vue/client/index.js.map +1 -0
  118. package/hmr/frameworks/vue/server/compiler.d.ts +11 -0
  119. package/hmr/frameworks/vue/server/compiler.js +26 -0
  120. package/hmr/frameworks/vue/server/compiler.js.map +1 -0
  121. package/hmr/frameworks/vue/server/sfc-transforms.d.ts +14 -0
  122. package/hmr/frameworks/vue/server/sfc-transforms.js +282 -0
  123. package/hmr/frameworks/vue/server/sfc-transforms.js.map +1 -0
  124. package/hmr/frameworks/vue/server/strategy.d.ts +2 -0
  125. package/hmr/frameworks/vue/server/strategy.js +273 -0
  126. package/hmr/frameworks/vue/server/strategy.js.map +1 -0
  127. package/hmr/helpers/ast-extract.d.ts +6 -0
  128. package/hmr/helpers/ast-extract.js +72 -0
  129. package/hmr/helpers/ast-extract.js.map +1 -0
  130. package/hmr/helpers/ast-normalizer.d.ts +7 -0
  131. package/hmr/helpers/ast-normalizer.js +772 -0
  132. package/hmr/helpers/ast-normalizer.js.map +1 -0
  133. package/hmr/helpers/babel.d.ts +3 -0
  134. package/hmr/helpers/babel.js +17 -0
  135. package/hmr/helpers/babel.js.map +1 -0
  136. package/hmr/helpers/sanitize.d.ts +6 -0
  137. package/hmr/helpers/sanitize.js +55 -0
  138. package/hmr/helpers/sanitize.js.map +1 -0
  139. package/hmr/helpers/vendor-rewrite.d.ts +1 -0
  140. package/hmr/helpers/vendor-rewrite.js +35 -0
  141. package/hmr/helpers/vendor-rewrite.js.map +1 -0
  142. package/hmr/server/compiler.d.ts +2 -0
  143. package/hmr/server/compiler.js +75 -0
  144. package/hmr/server/compiler.js.map +1 -0
  145. package/hmr/server/constants.d.ts +14 -0
  146. package/hmr/server/constants.js +23 -0
  147. package/hmr/server/constants.js.map +1 -0
  148. package/hmr/server/core-sanitize.d.ts +32 -0
  149. package/hmr/server/core-sanitize.js +134 -0
  150. package/hmr/server/core-sanitize.js.map +1 -0
  151. package/hmr/server/framework-strategy.d.ts +68 -0
  152. package/hmr/server/framework-strategy.js +2 -0
  153. package/hmr/server/framework-strategy.js.map +1 -0
  154. package/hmr/server/index.d.ts +5 -0
  155. package/hmr/server/index.js +19 -0
  156. package/hmr/server/index.js.map +1 -0
  157. package/hmr/server/vite-plugin.d.ts +5 -0
  158. package/{dist/hmr/plugins/plugin-vue.js → hmr/server/vite-plugin.js} +13 -15
  159. package/hmr/server/vite-plugin.js.map +1 -0
  160. package/hmr/server/websocket.d.ts +15 -0
  161. package/hmr/server/websocket.js +5528 -0
  162. package/hmr/server/websocket.js.map +1 -0
  163. package/hmr/shared/runtime/http-only-boot.d.ts +1 -0
  164. package/hmr/shared/runtime/http-only-boot.js +107 -0
  165. package/hmr/shared/runtime/http-only-boot.js.map +1 -0
  166. package/hmr/shared/runtime/root-placeholder.d.ts +1 -0
  167. package/hmr/shared/runtime/root-placeholder.js +142 -0
  168. package/hmr/shared/runtime/root-placeholder.js.map +1 -0
  169. package/hmr/shared/runtime/vendor-bootstrap.d.ts +1 -0
  170. package/hmr/shared/runtime/vendor-bootstrap.js +134 -0
  171. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -0
  172. package/hmr/shared/vendor/manifest-loader.d.ts +9 -0
  173. package/hmr/shared/vendor/manifest-loader.js +38 -0
  174. package/hmr/shared/vendor/manifest-loader.js.map +1 -0
  175. package/hmr/shared/vendor/manifest.d.ts +34 -0
  176. package/hmr/shared/vendor/manifest.js +787 -0
  177. package/hmr/shared/vendor/manifest.js.map +1 -0
  178. package/hmr/shared/vendor/registry.d.ts +9 -0
  179. package/hmr/shared/vendor/registry.js +62 -0
  180. package/hmr/shared/vendor/registry.js.map +1 -0
  181. package/hmr/vendor-bootstrap.d.ts +3 -0
  182. package/hmr/vendor-bootstrap.js +32 -0
  183. package/hmr/vendor-bootstrap.js.map +1 -0
  184. package/{dist/index.d.ts → index.d.ts} +2 -0
  185. package/{dist/index.js → index.js} +3 -0
  186. package/index.js.map +1 -0
  187. package/package.json +39 -31
  188. package/{dist/polyfills → polyfills}/mdn-data-at-rules.js +1 -0
  189. package/polyfills/mdn-data-at-rules.js.map +1 -0
  190. package/{dist/polyfills → polyfills}/mdn-data-properties.js +1 -0
  191. package/polyfills/mdn-data-properties.js.map +1 -0
  192. package/{dist/polyfills → polyfills}/mdn-data-syntaxes.js +1 -0
  193. package/polyfills/mdn-data-syntaxes.js.map +1 -0
  194. package/{dist/polyfills → polyfills}/module.js +1 -0
  195. package/polyfills/module.js.map +1 -0
  196. package/runtime/core-aliases-early.d.ts +1 -0
  197. package/runtime/core-aliases-early.js +334 -0
  198. package/runtime/core-aliases-early.js.map +1 -0
  199. package/shims/angular-animations-stub.d.ts +8 -0
  200. package/shims/angular-animations-stub.js +14 -0
  201. package/shims/angular-animations-stub.js.map +1 -0
  202. package/{dist/shims → shims}/node-module.js +3 -2
  203. package/shims/node-module.js.map +1 -0
  204. package/{dist/shims → shims}/react-reconciler-constants.js +2 -1
  205. package/shims/react-reconciler-constants.js.map +1 -0
  206. package/{dist/shims → shims}/react-reconciler.js +1 -0
  207. package/shims/react-reconciler.js.map +1 -0
  208. package/{dist/shims → shims}/set-value.js +5 -1
  209. package/shims/set-value.js.map +1 -0
  210. package/transformers/NativeClass/index.d.ts +2 -0
  211. package/transformers/NativeClass/index.js +222 -0
  212. package/transformers/NativeClass/index.js.map +1 -0
  213. package/dist/configuration/angular.js +0 -30
  214. package/dist/configuration/base.d.ts +0 -4
  215. package/dist/configuration/base.js +0 -386
  216. package/dist/configuration/vue.js +0 -45
  217. package/dist/helpers/css-tree.js +0 -21
  218. package/dist/helpers/flavor.js +0 -40
  219. package/dist/helpers/global-defines.js +0 -20
  220. package/dist/helpers/main-entry-hmr-includes.d.ts +0 -1
  221. package/dist/helpers/main-entry-hmr-includes.js +0 -18
  222. package/dist/helpers/main-entry.d.ts +0 -5
  223. package/dist/helpers/main-entry.js +0 -82
  224. package/dist/helpers/package-platform-aliases.d.ts +0 -4
  225. package/dist/helpers/preserve-imports.js +0 -19
  226. package/dist/helpers/resolver.d.ts +0 -4
  227. package/dist/helpers/ts-config-paths.d.ts +0 -4
  228. package/dist/hmr/client-vue.d.ts +0 -6
  229. package/dist/hmr/client-vue.js +0 -585
  230. package/dist/hmr/component-tracker.d.ts +0 -23
  231. package/dist/hmr/component-tracker.js +0 -193
  232. package/dist/hmr/message-handler.d.ts +0 -1
  233. package/dist/hmr/message-handler.js +0 -590
  234. package/dist/hmr/nsv-hooks.d.ts +0 -2
  235. package/dist/hmr/nsv-hooks.js +0 -481
  236. package/dist/hmr/plugins/index.d.ts +0 -1
  237. package/dist/hmr/plugins/index.js +0 -16
  238. package/dist/hmr/plugins/plugin-vue.d.ts +0 -2
  239. package/dist/hmr/plugins/websocket-vue.d.ts +0 -2
  240. package/dist/hmr/plugins/websocket-vue.js +0 -911
  241. package/dist/hmr/runtime-vue.d.ts +0 -13
  242. package/dist/hmr/runtime-vue.js +0 -2306
  243. package/dist/hmr/types.d.ts +0 -24
  244. package/dist/hmr/types.js +0 -2
  245. package/dist/transformers/NativeClass/index.d.ts +0 -5
  246. package/dist/transformers/NativeClass/index.js +0 -46
  247. /package/{dist/helpers → helpers}/commonjs-plugins.d.ts +0 -0
  248. /package/{dist/helpers → helpers}/css-tree.d.ts +0 -0
  249. /package/{dist/helpers → helpers}/dynamic-import-plugin.d.ts +0 -0
  250. /package/{dist/helpers → helpers}/external-configs.d.ts +0 -0
  251. /package/{dist/helpers → helpers}/module-resolution.d.ts +0 -0
  252. /package/{dist/helpers → helpers}/nativescript-package-resolver.d.ts +0 -0
  253. /package/{dist/helpers → helpers}/preserve-imports.d.ts +0 -0
  254. /package/{dist/helpers → helpers}/project.d.ts +0 -0
  255. /package/{dist/helpers → helpers}/utils.d.ts +0 -0
  256. /package/{dist/helpers → helpers}/workers.d.ts +0 -0
  257. /package/{dist/hmr → hmr/client}/css-handler.d.ts +0 -0
  258. /package/{dist/polyfills → polyfills}/mdn-data-at-rules.d.ts +0 -0
  259. /package/{dist/polyfills → polyfills}/mdn-data-properties.d.ts +0 -0
  260. /package/{dist/polyfills → polyfills}/mdn-data-syntaxes.d.ts +0 -0
  261. /package/{dist/polyfills → polyfills}/module.d.ts +0 -0
  262. /package/{dist/shims → shims}/node-module.d.ts +0 -0
  263. /package/{dist/shims → shims}/react-reconciler-constants.d.ts +0 -0
  264. /package/{dist/shims → shims}/react-reconciler.d.ts +0 -0
  265. /package/{dist/shims → shims}/set-value.d.ts +0 -0
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from 'vite';
2
+ export default function NativeScriptPlugin(options: {
3
+ platform: 'ios' | 'android' | 'visionos';
4
+ }): Plugin;
@@ -1,15 +1,15 @@
1
- import path from "path";
2
- import { resolveNativeScriptPlatformFile } from "./utils.js";
1
+ import path from 'path';
2
+ import { resolveNativeScriptPlatformFile } from './utils.js';
3
3
  export default function NativeScriptPlugin(options) {
4
4
  return {
5
- name: "vite:nativescript",
5
+ name: 'vite:nativescript',
6
6
  resolveId(source, importer) {
7
7
  const platform = options.platform;
8
- if (!platform || !importer || source.startsWith(".") === false) {
8
+ if (!platform || !importer || source.startsWith('.') === false) {
9
9
  return null;
10
10
  }
11
11
  const resolved = path.resolve(path.dirname(importer), source);
12
- const extVariants = [".ts", ".js", ".vue"];
12
+ const extVariants = ['.ts', '.js'];
13
13
  for (const ext of extVariants) {
14
14
  const file = resolveNativeScriptPlatformFile(resolved + ext, platform);
15
15
  if (file) {
@@ -19,7 +19,7 @@ export default function NativeScriptPlugin(options) {
19
19
  return null;
20
20
  },
21
21
  transform(code, id) {
22
- if (id.endsWith(".xml") || id.endsWith(".vue")) {
22
+ if (id.endsWith('.xml')) {
23
23
  // Example: simple pass-through or custom transform for NativeScript view files
24
24
  return {
25
25
  code,
@@ -29,3 +29,4 @@ export default function NativeScriptPlugin(options) {
29
29
  },
30
30
  };
31
31
  }
32
+ //# sourceMappingURL=resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/resolver.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,OAAqD;IAC/F,OAAO;QACN,IAAI,EAAE,mBAAmB;QAEzB,SAAS,CAAC,MAAM,EAAE,QAAQ;YACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;YAClC,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;gBAChE,OAAO,IAAI,CAAC;YACb,CAAC;YAED,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;YAC9D,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAEnC,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;gBAC/B,MAAM,IAAI,GAAG,+BAA+B,CAAC,QAAQ,GAAG,GAAG,EAAE,QAAQ,CAAC,CAAC;gBACvE,IAAI,IAAI,EAAE,CAAC;oBACV,OAAO,IAAI,CAAC;gBACb,CAAC;YACF,CAAC;YAED,OAAO,IAAI,CAAC;QACb,CAAC;QAED,SAAS,CAAC,IAAI,EAAE,EAAE;YACjB,IAAI,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzB,+EAA+E;gBAC/E,OAAO;oBACN,IAAI;oBACJ,GAAG,EAAE,IAAI;iBACT,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Return theme core generic CSS alias list converting imports like
4
+ * nativescript-theme-core/css/core.light.css -> platform specific variant when available.
5
+ */
6
+ export declare function getThemeCoreGenericAliases(themeCoreRoot: string | undefined, platform: string): any[];
7
+ /**
8
+ * Ensures hoisted theme-core is linked into app local node_modules and creates generic -> platform symlinks.
9
+ */
10
+ export declare function createEnsureHoistedThemeLinkPlugin(themeCoreRoot: string | undefined, projectRoot: string, platform: string): Plugin | undefined;
11
+ /**
12
+ * Fallback loader for theme-core CSS when app-local node_modules copy is missing.
13
+ */
14
+ export declare function createThemeCoreCssFallbackPlugin(themeCoreRoot: string | undefined, projectRoot: string, platform: string): Plugin | undefined;
@@ -0,0 +1,121 @@
1
+ import path from 'path';
2
+ import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, symlinkSync } from 'fs';
3
+ import { findPackageInNodeModules } from './module-resolution.js';
4
+ /**
5
+ * Return theme core generic CSS alias list converting imports like
6
+ * nativescript-theme-core/css/core.light.css -> platform specific variant when available.
7
+ */
8
+ export function getThemeCoreGenericAliases(themeCoreRoot, platform) {
9
+ if (!themeCoreRoot)
10
+ return [];
11
+ const cssDir = path.join(themeCoreRoot, 'css');
12
+ if (!existsSync(cssDir))
13
+ return [];
14
+ const entries = readdirSync(cssDir);
15
+ const bases = new Set();
16
+ for (const file of entries) {
17
+ const m = file.match(/^(.*)\.(android|ios)\.css$/);
18
+ if (m)
19
+ bases.add(m[1]);
20
+ }
21
+ const platformSuffix = platform === 'android' ? '.android.css' : '.ios.css';
22
+ return Array.from(bases).map((base) => {
23
+ const replacement = path.join(cssDir, base + platformSuffix);
24
+ return {
25
+ find: new RegExp(`^nativescript-theme-core\/css\/${base}\.css$`),
26
+ replacement,
27
+ };
28
+ });
29
+ }
30
+ /**
31
+ * Ensures hoisted theme-core is linked into app local node_modules and creates generic -> platform symlinks.
32
+ */
33
+ export function createEnsureHoistedThemeLinkPlugin(themeCoreRoot, projectRoot, platform) {
34
+ if (!themeCoreRoot)
35
+ return undefined;
36
+ return {
37
+ name: 'ns-ensure-hoisted-theme-link',
38
+ enforce: 'pre',
39
+ buildStart() {
40
+ try {
41
+ const appNodeModules = path.join(projectRoot, 'node_modules');
42
+ if (!existsSync(appNodeModules)) {
43
+ mkdirSync(appNodeModules, { recursive: true });
44
+ }
45
+ const linkPath = path.join(appNodeModules, 'nativescript-theme-core');
46
+ const needsLink = !existsSync(linkPath) || !lstatSync(linkPath).isSymbolicLink();
47
+ if (needsLink) {
48
+ try {
49
+ symlinkSync(themeCoreRoot, linkPath, 'dir');
50
+ }
51
+ catch { }
52
+ }
53
+ // Create generic css symlinks (core.light.css -> core.light.<platform>.css) if missing
54
+ const cssDir = path.join(linkPath, 'css');
55
+ if (existsSync(cssDir)) {
56
+ const files = readdirSync(cssDir);
57
+ const platformSuffix = platform === 'android' ? '.android.css' : '.ios.css';
58
+ for (const f of files) {
59
+ const m = f.match(/^(.*)\.(android|ios)\.css$/);
60
+ if (!m)
61
+ continue;
62
+ const base = m[1];
63
+ const generic = path.join(cssDir, base + '.css');
64
+ if (!existsSync(generic)) {
65
+ const platformFile = path.join(cssDir, base + platformSuffix);
66
+ if (existsSync(platformFile)) {
67
+ try {
68
+ symlinkSync(platformFile, generic);
69
+ }
70
+ catch { }
71
+ }
72
+ }
73
+ }
74
+ }
75
+ }
76
+ catch { }
77
+ },
78
+ };
79
+ }
80
+ /**
81
+ * Fallback loader for theme-core CSS when app-local node_modules copy is missing.
82
+ */
83
+ export function createThemeCoreCssFallbackPlugin(themeCoreRoot, projectRoot, platform) {
84
+ // Keep behavior: only active when a hoisted root exists
85
+ if (!themeCoreRoot)
86
+ return undefined;
87
+ return {
88
+ name: 'ns-theme-core-css-fallback',
89
+ enforce: 'pre',
90
+ load(id) {
91
+ if (!id.includes('nativescript-theme-core'))
92
+ return null;
93
+ if (existsSync(id))
94
+ return null; // let default loader
95
+ const pkgRoot = themeCoreRoot || findPackageInNodeModules('nativescript-theme-core', projectRoot);
96
+ if (!pkgRoot)
97
+ return null;
98
+ const idx = id.lastIndexOf('nativescript-theme-core/');
99
+ if (idx === -1)
100
+ return null;
101
+ const rel = id.substring(idx + 'nativescript-theme-core/'.length);
102
+ let target = path.join(pkgRoot, rel);
103
+ try {
104
+ if (existsSync(target)) {
105
+ return readFileSync(target, 'utf-8');
106
+ }
107
+ if (/\.css$/.test(target)) {
108
+ const platformExt = platform === 'android' ? '.android.css' : '.ios.css';
109
+ const base = target.replace(/\.css$/, '');
110
+ const alt = base + platformExt;
111
+ if (existsSync(alt)) {
112
+ return readFileSync(alt, 'utf-8');
113
+ }
114
+ }
115
+ }
116
+ catch { }
117
+ return null;
118
+ },
119
+ };
120
+ }
121
+ //# sourceMappingURL=theme-core-plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-core-plugins.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/theme-core-plugins.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,aAAiC,EAAE,QAAgB;IAC7F,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACnD,IAAI,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;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;QACb,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ type TsConfigOptions = {
2
+ platform: string;
3
+ verbose?: boolean;
4
+ };
5
+ export declare const getTsConfigData: (options: TsConfigOptions) => {
6
+ paths: Record<string, string[]>;
7
+ baseUrl: string;
8
+ aliases: any[];
9
+ };
10
+ export {};
@@ -1,13 +1,13 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { getProjectFilePath, getProjectRootPath } from "./project.js";
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { getProjectFilePath, getProjectRootPath } from './project.js';
4
4
  let tsConfigPath;
5
5
  const projectRoot = getProjectRootPath();
6
6
  // Read TypeScript path mappings
7
7
  function getTsConfigPaths(debugViteLogs = false) {
8
8
  try {
9
9
  if (debugViteLogs)
10
- console.log("📁 Parsing tsconfig at:", tsConfigPath);
10
+ console.log('📁 Parsing tsconfig at:', tsConfigPath);
11
11
  // The configDir should be the directory of the starting tsconfig file
12
12
  const startingConfigDir = path.dirname(tsConfigPath);
13
13
  // Recursive function to resolve tsconfig extends chain
@@ -15,11 +15,11 @@ function getTsConfigPaths(debugViteLogs = false) {
15
15
  // Prevent infinite loops
16
16
  if (visitedPaths.has(configPath)) {
17
17
  if (debugViteLogs)
18
- console.log("📁 Warning: Circular tsconfig extends detected, skipping:", configPath);
19
- return { paths: {}, baseUrl: "." };
18
+ console.log('📁 Warning: Circular tsconfig extends detected, skipping:', configPath);
19
+ return { paths: {}, baseUrl: '.' };
20
20
  }
21
21
  visitedPaths.add(configPath);
22
- const tsConfigContent = fs.readFileSync(configPath, "utf8");
22
+ const tsConfigContent = fs.readFileSync(configPath, 'utf8');
23
23
  // Parse JSON (handle JSONC)
24
24
  let tsConfig;
25
25
  try {
@@ -28,16 +28,16 @@ function getTsConfigPaths(debugViteLogs = false) {
28
28
  catch (parseError) {
29
29
  // Clean up JSONC
30
30
  if (debugViteLogs)
31
- console.log("📁 Cleaning JSONC for:", configPath);
31
+ console.log('📁 Cleaning JSONC for:', configPath);
32
32
  let cleanContent = tsConfigContent
33
- .replace(/\/\/.*$/gm, "")
34
- .replace(/\/\*[\s\S]*?\*\//g, "")
35
- .replace(/,(\s*[}\]])/g, "$1");
33
+ .replace(/\/\/.*$/gm, '')
34
+ .replace(/\/\*[\s\S]*?\*\//g, '')
35
+ .replace(/,(\s*[}\]])/g, '$1');
36
36
  tsConfig = JSON.parse(cleanContent);
37
37
  }
38
38
  // Start with current config's options
39
39
  let currentPaths = { ...(tsConfig.compilerOptions?.paths || {}) };
40
- let mergedBaseUrl = tsConfig.compilerOptions?.baseUrl || ".";
40
+ let mergedBaseUrl = tsConfig.compilerOptions?.baseUrl || '.';
41
41
  const currentConfigDir = path.dirname(configPath);
42
42
  // Handle path resolution for this config file
43
43
  if (currentPaths) {
@@ -46,7 +46,7 @@ function getTsConfigPaths(debugViteLogs = false) {
46
46
  if (Array.isArray(values)) {
47
47
  resolvedPaths[key] = values.map((value) => {
48
48
  // Handle ${configDir} substitution - use the STARTING config directory
49
- if (value.includes("${configDir}")) {
49
+ if (value.includes('${configDir}')) {
50
50
  return value.replace(/\$\{configDir\}/g, startingConfigDir);
51
51
  }
52
52
  // For other paths, resolve relative to THIS config file's directory
@@ -66,7 +66,7 @@ function getTsConfigPaths(debugViteLogs = false) {
66
66
  if (tsConfig.extends) {
67
67
  const baseConfigPath = path.resolve(path.dirname(configPath), tsConfig.extends);
68
68
  if (debugViteLogs)
69
- console.log("📁 Following extends to:", baseConfigPath);
69
+ console.log('📁 Following extends to:', baseConfigPath);
70
70
  if (fs.existsSync(baseConfigPath)) {
71
71
  try {
72
72
  const baseResult = resolveTsConfigChain(baseConfigPath, visitedPaths);
@@ -80,21 +80,21 @@ function getTsConfigPaths(debugViteLogs = false) {
80
80
  }
81
81
  catch (e) {
82
82
  if (debugViteLogs)
83
- console.log("📁 Warning: Could not load extended config:", baseConfigPath, e.message);
83
+ console.log('📁 Warning: Could not load extended config:', baseConfigPath, e.message);
84
84
  }
85
85
  }
86
86
  else {
87
87
  if (debugViteLogs)
88
- console.log("📁 Warning: Extended config not found:", baseConfigPath);
88
+ console.log('📁 Warning: Extended config not found:', baseConfigPath);
89
89
  }
90
90
  }
91
91
  return { paths: currentPaths, baseUrl: mergedBaseUrl };
92
92
  }
93
93
  const result = resolveTsConfigChain(tsConfigPath);
94
94
  if (debugViteLogs) {
95
- console.log("📁 Found paths in tsconfig:", Object.keys(result.paths));
96
- console.log("📁 Base URL:", result.baseUrl);
97
- console.log("📁 Starting configDir:", startingConfigDir);
95
+ console.log('📁 Found paths in tsconfig:', Object.keys(result.paths));
96
+ console.log('📁 Base URL:', result.baseUrl);
97
+ console.log('📁 Starting configDir:', startingConfigDir);
98
98
  // Show first few resolved paths for debugging
99
99
  Object.entries(result.paths)
100
100
  .slice(0, 3)
@@ -105,18 +105,18 @@ function getTsConfigPaths(debugViteLogs = false) {
105
105
  return result;
106
106
  }
107
107
  catch (e) {
108
- console.warn("Failed to parse tsconfig paths:", e.message);
109
- return { paths: {}, baseUrl: "." };
108
+ console.warn('Failed to parse tsconfig paths:', e.message);
109
+ return { paths: {}, baseUrl: '.' };
110
110
  }
111
111
  }
112
112
  // Function to create TypeScript aliases with platform support
113
- function createTsConfigAliases(paths, baseUrl, platform, debugViteLogs) {
113
+ function createTsConfigAliases(opts) {
114
114
  const aliases = [];
115
115
  // Process patterns in order: wildcards first, then exact matches
116
- const sortedPatterns = Object.entries(paths).sort(([a], [b]) => {
116
+ const sortedPatterns = Object.entries(opts.paths).sort(([a], [b]) => {
117
117
  // Wildcards (with *) come first
118
- const aHasWildcard = a.includes("*");
119
- const bHasWildcard = b.includes("*");
118
+ const aHasWildcard = a.includes('*');
119
+ const bHasWildcard = b.includes('*');
120
120
  if (aHasWildcard && !bHasWildcard)
121
121
  return -1;
122
122
  if (!aHasWildcard && bHasWildcard)
@@ -126,50 +126,41 @@ function createTsConfigAliases(paths, baseUrl, platform, debugViteLogs) {
126
126
  });
127
127
  for (const [pattern, destinations] of sortedPatterns) {
128
128
  if (Array.isArray(destinations) && destinations.length > 0) {
129
- if (pattern.includes("*")) {
129
+ if (pattern.includes('*')) {
130
130
  // Handle wildcard patterns (like "@scope/plugins/*")
131
- const aliasKey = pattern.replace(/\/\*$/, "");
132
- const destination = destinations[0].replace(/\/\*$/, "");
131
+ const aliasKey = pattern.replace(/\/\*$/, '');
132
+ const destination = destinations[0].replace(/\/\*$/, '');
133
133
  // Check if destination is already absolute (resolved by tsconfig chain)
134
- const resolvedDestination = path.isAbsolute(destination)
135
- ? destination
136
- : path.resolve(projectRoot, baseUrl, destination);
134
+ const resolvedDestination = path.isAbsolute(destination) ? destination : path.resolve(projectRoot, opts.baseUrl, destination);
137
135
  // console.log(
138
136
  // `📁 Creating wildcard alias: ${aliasKey} -> ${resolvedDestination}`,
139
137
  // );
140
138
  aliases.push({
141
- find: new RegExp(`^${aliasKey.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?:/(.*))?$`),
139
+ find: new RegExp(`^${aliasKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?:/(.*))?$`),
142
140
  replacement: (match, subpath) => {
143
- const fullPath = subpath
144
- ? path.join(resolvedDestination, subpath)
145
- : resolvedDestination;
146
- if (debugViteLogs) {
141
+ const fullPath = subpath ? path.join(resolvedDestination, subpath) : resolvedDestination;
142
+ if (opts.verbose) {
147
143
  console.log(`📁 TypeScript wildcard alias: ${match} -> ${fullPath}`);
148
144
  }
149
145
  // Check if this resolves to a directory, and if so, try to find index files
150
- if (fs.existsSync(fullPath) &&
151
- fs.statSync(fullPath).isDirectory()) {
146
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isDirectory()) {
152
147
  // Try platform-specific index files first
153
- const platformIndexPatterns = [
154
- `index.${platform}.ts`,
155
- `index.${platform}.js`,
156
- `index.${platform}.mjs`,
157
- ];
148
+ const platformIndexPatterns = [`index.${opts.platform}.ts`, `index.${opts.platform}.js`, `index.${opts.platform}.mjs`];
158
149
  for (const indexFile of platformIndexPatterns) {
159
150
  const indexPath = path.join(fullPath, indexFile);
160
151
  if (fs.existsSync(indexPath)) {
161
- if (debugViteLogs) {
152
+ if (opts.verbose) {
162
153
  console.log(`📁 Found platform-specific directory index: ${indexPath}`);
163
154
  }
164
155
  return indexPath;
165
156
  }
166
157
  }
167
158
  // Try standard index files
168
- const indexPatterns = ["index.ts", "index.js", "index.mjs"];
159
+ const indexPatterns = ['index.ts', 'index.js', 'index.mjs'];
169
160
  for (const indexFile of indexPatterns) {
170
161
  const indexPath = path.join(fullPath, indexFile);
171
162
  if (fs.existsSync(indexPath)) {
172
- if (debugViteLogs) {
163
+ if (opts.verbose) {
173
164
  console.log(`📁 Found directory index: ${indexPath}`);
174
165
  }
175
166
  return indexPath;
@@ -177,20 +168,20 @@ function createTsConfigAliases(paths, baseUrl, platform, debugViteLogs) {
177
168
  }
178
169
  }
179
170
  // If not a directory or no index found, try platform-specific resolution
180
- const extensions = [".ts", ".js", ".mjs"];
171
+ const extensions = ['.ts', '.js', '.mjs'];
181
172
  for (const ext of extensions) {
182
173
  const basePath = fullPath + ext;
183
174
  // Try platform-specific file first
184
- const platformPath = fullPath + `.${platform}` + ext;
175
+ const platformPath = fullPath + `.${opts.platform}` + ext;
185
176
  if (fs.existsSync(platformPath)) {
186
- if (debugViteLogs) {
177
+ if (opts.verbose) {
187
178
  console.log(`📁 Found platform-specific file: ${platformPath}`);
188
179
  }
189
180
  return platformPath;
190
181
  }
191
182
  // Try base file
192
183
  if (fs.existsSync(basePath)) {
193
- if (debugViteLogs) {
184
+ if (opts.verbose) {
194
185
  console.log(`📁 Found base file: ${basePath}`);
195
186
  }
196
187
  return basePath;
@@ -204,14 +195,12 @@ function createTsConfigAliases(paths, baseUrl, platform, debugViteLogs) {
204
195
  // Handle exact matches (like "@scope/anything/anywhere")
205
196
  // Use regex to ensure exact match only
206
197
  // Check if destination is already absolute (resolved by tsconfig chain)
207
- const resolvedDestination = path.isAbsolute(destinations[0])
208
- ? destinations[0]
209
- : path.resolve(projectRoot, baseUrl, destinations[0]);
210
- if (debugViteLogs) {
198
+ const resolvedDestination = path.isAbsolute(destinations[0]) ? destinations[0] : path.resolve(projectRoot, opts.baseUrl, destinations[0]);
199
+ if (opts.verbose) {
211
200
  console.log(`📁 Creating exact alias: ${pattern} -> ${resolvedDestination}`);
212
201
  }
213
202
  aliases.push({
214
- find: new RegExp(`^${pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`),
203
+ find: new RegExp(`^${pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`),
215
204
  replacement: resolvedDestination,
216
205
  });
217
206
  }
@@ -219,25 +208,35 @@ function createTsConfigAliases(paths, baseUrl, platform, debugViteLogs) {
219
208
  }
220
209
  return aliases;
221
210
  }
222
- // Get TypeScript path configuration
223
- let tsConfigData;
224
- export const getTsConfigData = (verboseLogs, platform) => {
225
- tsConfigPath = getProjectFilePath("tsconfig.app.json");
226
- if (!fs.existsSync(tsConfigPath)) {
227
- tsConfigPath = getProjectFilePath("tsconfig.json");
211
+ let cachedConfig = null;
212
+ let cachedPath = null;
213
+ export const getTsConfigData = (options) => {
214
+ const verbose = !!options.verbose;
215
+ let candidatePath = getProjectFilePath('tsconfig.app.json');
216
+ if (!fs.existsSync(candidatePath)) {
217
+ candidatePath = getProjectFilePath('tsconfig.json');
228
218
  }
229
- if (!tsConfigData) {
230
- tsConfigData = getTsConfigPaths();
231
- }
232
- if (verboseLogs) {
233
- console.log("📁 Loaded TypeScript path configuration");
219
+ tsConfigPath = candidatePath;
220
+ if (!cachedConfig || cachedPath !== candidatePath) {
221
+ cachedConfig = getTsConfigPaths(verbose);
222
+ cachedPath = candidatePath;
223
+ if (verbose) {
224
+ console.log('📁 Loaded TypeScript path configuration');
225
+ }
234
226
  }
235
- const aliases = createTsConfigAliases(tsConfigData.paths, tsConfigData.baseUrl, platform);
236
- if (aliases.length > 0 && verboseLogs) {
237
- console.log("📁 Created TypeScript path aliases:", aliases.length);
227
+ const aliases = createTsConfigAliases({
228
+ paths: cachedConfig.paths,
229
+ baseUrl: cachedConfig.baseUrl,
230
+ platform: options.platform,
231
+ verbose,
232
+ });
233
+ if (aliases.length > 0 && verbose) {
234
+ console.log('📁 Created TypeScript path aliases:', aliases.length);
238
235
  }
239
236
  return {
240
- data: tsConfigData,
241
- aliases
237
+ paths: cachedConfig.paths,
238
+ baseUrl: cachedConfig.baseUrl,
239
+ aliases,
242
240
  };
243
241
  };
242
+ //# sourceMappingURL=ts-config-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-config-paths.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/ts-config-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEtE,IAAI,YAAoB,CAAC;AAEzB,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;AAEzC,gCAAgC;AAChC,SAAS,gBAAgB,CAAC,gBAAyB,KAAK;IACvD,IAAI,CAAC;QACJ,IAAI,aAAa;YAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;QACxE,sEAAsE;QACtE,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACrD,uDAAuD;QACvD,SAAS,oBAAoB,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,GAAG,EAAE;YACjE,yBAAyB;YACzB,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAClC,IAAI,aAAa;oBAAE,OAAO,CAAC,GAAG,CAAC,2DAA2D,EAAE,UAAU,CAAC,CAAC;gBACxG,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;YACpC,CAAC;YACD,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC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,OAAO,CAAC,CAAC;QACzC,UAAU,GAAG,aAAa,CAAC;QAC3B,IAAI,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IAED,MAAM,OAAO,GAAG,qBAAqB,CAAC;QACrC,KAAK,EAAE,YAAY,CAAC,KAAK;QACzB,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO;KACP,CAAC,CAAC;IAEH,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACpE,CAAC;IAED,OAAO;QACN,KAAK,EAAE,YAAY,CAAC,KAAK;QACzB,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,OAAO;KACP,CAAC;AACH,CAAC,CAAC"}
@@ -1,32 +1,30 @@
1
- import path from "path";
2
- import fs from "fs";
3
- import { transformSync } from "esbuild";
4
- import { satisfies } from "semver";
1
+ import path from 'path';
2
+ import fs from 'fs';
3
+ import { transformSync } from 'esbuild';
5
4
  import { createRequire } from 'node:module';
5
+ import { getPackageJson, getProjectFilePath, getProjectRootPath } from './project.js';
6
6
  const require = createRequire(import.meta.url);
7
- import { getPackageJson, getProjectFilePath, getProjectRootPath } from "./project.js";
8
7
  // get the name from the package for the output
9
8
  const packageJson = getPackageJson();
10
9
  export function nsConfigToJson() {
11
10
  let configObject;
12
- ;
13
- const tsPath = getProjectFilePath("nativescript.config.ts");
14
- const tsCode = fs.readFileSync(tsPath, "utf-8");
11
+ const tsPath = getProjectFilePath('nativescript.config.ts');
12
+ const tsCode = fs.readFileSync(tsPath, 'utf-8');
15
13
  // a) Transpile your TS config to CommonJS so we can require() it
16
14
  const { code: cjsCode } = transformSync(tsCode, {
17
- loader: "ts",
18
- format: "cjs",
19
- target: "esnext",
15
+ loader: 'ts',
16
+ format: 'cjs',
17
+ target: 'esnext',
20
18
  });
21
19
  // b) Evaluate it in a VM-style sandbox to pull out the default export
22
20
  const module = { exports: {} };
23
21
  const requireFunc = (id) => require(id);
24
- new Function("exports", "require", "module", "__filename", "__dirname", cjsCode)(module.exports, requireFunc, module, tsPath, path.dirname(tsPath));
22
+ new Function('exports', 'require', 'module', '__filename', '__dirname', cjsCode)(module.exports, requireFunc, module, tsPath, path.dirname(tsPath));
25
23
  configObject = module.exports.default ?? module.exports;
26
24
  // ensure the config has a name
27
25
  configObject.name = packageJson.name;
28
26
  // ensure the main entry is set to "bundle"
29
- configObject.main = "bundle";
27
+ configObject.main = 'bundle';
30
28
  return configObject;
31
29
  }
32
30
  /**
@@ -57,10 +55,7 @@ export function resolveNativeScriptPlatformFile(id, platform) {
57
55
  * @returns string[] dependencies
58
56
  */
59
57
  export function getAllDependencies() {
60
- return [
61
- ...Object.keys(packageJson.dependencies ?? {}),
62
- ...Object.keys(packageJson.devDependencies ?? {}),
63
- ];
58
+ return [...Object.keys(packageJson.dependencies ?? {}), ...Object.keys(packageJson.devDependencies ?? {})];
64
59
  }
65
60
  /**
66
61
  * Check if a dependency is present in package.json
@@ -88,14 +83,6 @@ export function getDependencyPath(dependencyName) {
88
83
  * Get the version of a dependency from package.json
89
84
  */
90
85
  export function getDependencyVersion(packageName) {
91
- try {
92
- const packageJsonPath = path.resolve(process.cwd(), "package.json");
93
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
94
- return (packageJson.dependencies?.[packageName] ||
95
- packageJson.devDependencies?.[packageName] ||
96
- packageJson.peerDependencies?.[packageName]);
97
- }
98
- catch {
99
- return undefined;
100
- }
86
+ return packageJson.dependencies?.[packageName] ?? packageJson.devDependencies?.[packageName] ?? packageJson.peerDependencies?.[packageName];
101
87
  }
88
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../packages/vite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