nitrogen 0.2.23 → 0.29.4

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 (333) hide show
  1. package/README.md +15 -109
  2. package/lib/Logger.d.ts +10 -0
  3. package/lib/Logger.js +56 -0
  4. package/lib/autolinking/Autolinking.d.ts +8 -0
  5. package/lib/autolinking/Autolinking.js +1 -0
  6. package/lib/autolinking/android/createCMakeExtension.d.ts +6 -0
  7. package/lib/autolinking/android/createCMakeExtension.js +106 -0
  8. package/lib/autolinking/android/createGradleExtension.d.ts +5 -0
  9. package/lib/autolinking/android/createGradleExtension.js +36 -0
  10. package/lib/autolinking/android/createHybridObjectInitializer.d.ts +2 -0
  11. package/lib/autolinking/android/createHybridObjectInitializer.js +159 -0
  12. package/lib/autolinking/createAndroidAutolinking.d.ts +11 -0
  13. package/lib/autolinking/createAndroidAutolinking.js +13 -0
  14. package/lib/autolinking/createIOSAutolinking.d.ts +5 -0
  15. package/lib/autolinking/createIOSAutolinking.js +19 -0
  16. package/lib/autolinking/ios/createHybridObjectInitializer.d.ts +9 -0
  17. package/lib/autolinking/ios/createHybridObjectInitializer.js +97 -0
  18. package/lib/autolinking/ios/createPodspecRubyExtension.d.ts +5 -0
  19. package/lib/autolinking/ios/createPodspecRubyExtension.js +69 -0
  20. package/lib/autolinking/ios/createSwiftCxxBridge.d.ts +2 -0
  21. package/lib/autolinking/ios/createSwiftCxxBridge.js +117 -0
  22. package/lib/autolinking/ios/createSwiftUmbrellaHeader.d.ts +3 -0
  23. package/lib/autolinking/ios/createSwiftUmbrellaHeader.js +74 -0
  24. package/lib/config/NitroConfig.d.ts +52 -0
  25. package/lib/config/NitroConfig.js +112 -0
  26. package/lib/config/NitroUserConfig.d.ts +22 -0
  27. package/lib/config/NitroUserConfig.js +88 -0
  28. package/lib/config/getConfig.d.ts +2 -0
  29. package/lib/config/getConfig.js +84 -0
  30. package/lib/createGitAttributes.d.ts +1 -0
  31. package/lib/createGitAttributes.js +11 -0
  32. package/lib/createPlatformSpec.d.ts +4 -0
  33. package/lib/createPlatformSpec.js +127 -0
  34. package/lib/getFiles.d.ts +1 -0
  35. package/lib/getFiles.js +28 -0
  36. package/lib/getPlatformSpecs.d.ts +17 -0
  37. package/lib/getPlatformSpecs.js +153 -0
  38. package/lib/index.d.ts +2 -0
  39. package/lib/index.js +113 -10
  40. package/lib/init.d.ts +1 -0
  41. package/lib/init.js +123 -0
  42. package/lib/nitrogen.d.ts +11 -0
  43. package/lib/nitrogen.js +165 -0
  44. package/lib/prettifyDirectory.d.ts +1 -0
  45. package/lib/prettifyDirectory.js +27 -0
  46. package/lib/syntax/BridgedType.d.ts +41 -0
  47. package/lib/syntax/BridgedType.js +1 -0
  48. package/lib/syntax/CodeNode.d.ts +23 -0
  49. package/lib/syntax/CodeNode.js +1 -0
  50. package/lib/syntax/HybridObjectSpec.d.ts +13 -0
  51. package/lib/syntax/HybridObjectSpec.js +1 -0
  52. package/lib/syntax/Method.d.ts +41 -0
  53. package/lib/syntax/Method.js +108 -0
  54. package/lib/syntax/Parameter.d.ts +15 -0
  55. package/lib/syntax/Parameter.js +65 -0
  56. package/lib/syntax/Property.d.ts +50 -0
  57. package/lib/syntax/Property.js +147 -0
  58. package/lib/syntax/SourceFile.d.ts +70 -0
  59. package/lib/syntax/SourceFile.js +7 -0
  60. package/lib/syntax/c++/CppEnum.d.ts +6 -0
  61. package/lib/syntax/c++/CppEnum.js +110 -0
  62. package/lib/syntax/c++/CppHybridObject.d.ts +3 -0
  63. package/lib/syntax/c++/CppHybridObject.js +146 -0
  64. package/lib/syntax/c++/CppHybridObjectRegistration.d.ts +17 -0
  65. package/lib/syntax/c++/CppHybridObjectRegistration.js +18 -0
  66. package/lib/syntax/c++/CppStruct.d.ts +3 -0
  67. package/lib/syntax/c++/CppStruct.js +108 -0
  68. package/lib/syntax/c++/CppUnion.d.ts +6 -0
  69. package/lib/syntax/c++/CppUnion.js +88 -0
  70. package/lib/syntax/c++/getForwardDeclaration.d.ts +3 -0
  71. package/lib/syntax/c++/getForwardDeclaration.js +14 -0
  72. package/lib/syntax/c++/includeNitroHeader.d.ts +7 -0
  73. package/lib/syntax/c++/includeNitroHeader.js +34 -0
  74. package/lib/syntax/createType.d.ts +15 -0
  75. package/lib/syntax/createType.js +303 -0
  76. package/lib/syntax/getAllTypes.d.ts +3 -0
  77. package/lib/syntax/getAllTypes.js +11 -0
  78. package/lib/syntax/getCustomTypeConfig.d.ts +8 -0
  79. package/lib/syntax/getCustomTypeConfig.js +53 -0
  80. package/lib/syntax/getHybridObjectName.d.ts +36 -0
  81. package/lib/syntax/getHybridObjectName.js +10 -0
  82. package/lib/syntax/getInterfaceProperties.d.ts +4 -0
  83. package/lib/syntax/getInterfaceProperties.js +9 -0
  84. package/lib/syntax/getReferencedTypes.d.ts +2 -0
  85. package/lib/syntax/getReferencedTypes.js +47 -0
  86. package/lib/syntax/helpers.d.ts +13 -0
  87. package/lib/syntax/helpers.js +53 -0
  88. package/lib/syntax/isCoreType.d.ts +9 -0
  89. package/lib/syntax/isCoreType.js +47 -0
  90. package/lib/syntax/kotlin/FbjniHybridObject.d.ts +3 -0
  91. package/lib/syntax/kotlin/FbjniHybridObject.js +261 -0
  92. package/lib/syntax/kotlin/JNINativeRegistrations.d.ts +8 -0
  93. package/lib/syntax/kotlin/JNINativeRegistrations.js +7 -0
  94. package/lib/syntax/kotlin/KotlinBoxedPrimitive.d.ts +7 -0
  95. package/lib/syntax/kotlin/KotlinBoxedPrimitive.js +17 -0
  96. package/lib/syntax/kotlin/KotlinCxxBridgedType.d.ts +19 -0
  97. package/lib/syntax/kotlin/KotlinCxxBridgedType.js +893 -0
  98. package/lib/syntax/kotlin/KotlinEnum.d.ts +3 -0
  99. package/lib/syntax/kotlin/KotlinEnum.js +113 -0
  100. package/lib/syntax/kotlin/KotlinFunction.d.ts +3 -0
  101. package/lib/syntax/kotlin/KotlinFunction.js +256 -0
  102. package/lib/syntax/kotlin/KotlinHybridObject.d.ts +3 -0
  103. package/lib/syntax/kotlin/KotlinHybridObject.js +177 -0
  104. package/lib/syntax/kotlin/KotlinHybridObjectRegistration.d.ts +17 -0
  105. package/lib/syntax/kotlin/KotlinHybridObjectRegistration.js +26 -0
  106. package/lib/syntax/kotlin/KotlinStruct.d.ts +3 -0
  107. package/lib/syntax/kotlin/KotlinStruct.js +172 -0
  108. package/lib/syntax/kotlin/KotlinVariant.d.ts +3 -0
  109. package/lib/syntax/kotlin/KotlinVariant.js +191 -0
  110. package/lib/syntax/swift/SwiftCxxBridgedType.d.ts +21 -0
  111. package/lib/syntax/swift/SwiftCxxBridgedType.js +819 -0
  112. package/lib/syntax/swift/SwiftCxxTypeHelper.d.ts +17 -0
  113. package/lib/syntax/swift/SwiftCxxTypeHelper.js +613 -0
  114. package/lib/syntax/swift/SwiftEnum.d.ts +3 -0
  115. package/lib/syntax/swift/SwiftEnum.js +52 -0
  116. package/lib/syntax/swift/SwiftFunction.d.ts +3 -0
  117. package/lib/syntax/swift/SwiftFunction.js +83 -0
  118. package/lib/syntax/swift/SwiftHybridObject.d.ts +3 -0
  119. package/lib/syntax/swift/SwiftHybridObject.js +103 -0
  120. package/lib/syntax/swift/SwiftHybridObjectBridge.d.ts +11 -0
  121. package/lib/syntax/swift/SwiftHybridObjectBridge.js +451 -0
  122. package/lib/syntax/swift/SwiftHybridObjectRegistration.d.ts +19 -0
  123. package/lib/syntax/swift/SwiftHybridObjectRegistration.js +42 -0
  124. package/lib/syntax/swift/SwiftStruct.d.ts +3 -0
  125. package/lib/syntax/swift/SwiftStruct.js +75 -0
  126. package/lib/syntax/swift/SwiftVariant.d.ts +3 -0
  127. package/lib/syntax/swift/SwiftVariant.js +58 -0
  128. package/lib/syntax/types/ArrayBufferType.d.ts +10 -0
  129. package/lib/syntax/types/ArrayBufferType.js +37 -0
  130. package/lib/syntax/types/ArrayType.d.ts +12 -0
  131. package/lib/syntax/types/ArrayType.js +52 -0
  132. package/lib/syntax/types/BigIntType.d.ts +10 -0
  133. package/lib/syntax/types/BigIntType.js +27 -0
  134. package/lib/syntax/types/BooleanType.d.ts +10 -0
  135. package/lib/syntax/types/BooleanType.js +27 -0
  136. package/lib/syntax/types/CustomType.d.ts +14 -0
  137. package/lib/syntax/types/CustomType.js +36 -0
  138. package/lib/syntax/types/DateType.d.ts +10 -0
  139. package/lib/syntax/types/DateType.js +35 -0
  140. package/lib/syntax/types/EnumType.d.ts +23 -0
  141. package/lib/syntax/types/EnumType.js +101 -0
  142. package/lib/syntax/types/ErrorType.d.ts +11 -0
  143. package/lib/syntax/types/ErrorType.js +37 -0
  144. package/lib/syntax/types/FunctionType.d.ts +29 -0
  145. package/lib/syntax/types/FunctionType.js +147 -0
  146. package/lib/syntax/types/HybridObjectBaseType.d.ts +11 -0
  147. package/lib/syntax/types/HybridObjectBaseType.js +38 -0
  148. package/lib/syntax/types/HybridObjectType.d.ts +23 -0
  149. package/lib/syntax/types/HybridObjectType.js +131 -0
  150. package/lib/syntax/types/MapType.d.ts +10 -0
  151. package/lib/syntax/types/MapType.js +37 -0
  152. package/lib/syntax/types/NamedWrappingType.d.ts +14 -0
  153. package/lib/syntax/types/NamedWrappingType.js +27 -0
  154. package/lib/syntax/types/NullType.d.ts +10 -0
  155. package/lib/syntax/types/NullType.js +23 -0
  156. package/lib/syntax/types/NumberType.d.ts +10 -0
  157. package/lib/syntax/types/NumberType.js +27 -0
  158. package/lib/syntax/types/OptionalType.d.ts +13 -0
  159. package/lib/syntax/types/OptionalType.js +59 -0
  160. package/lib/syntax/types/PromiseType.d.ts +16 -0
  161. package/lib/syntax/types/PromiseType.js +62 -0
  162. package/lib/syntax/types/RecordType.d.ts +13 -0
  163. package/lib/syntax/types/RecordType.js +47 -0
  164. package/lib/syntax/types/ResultWrappingType.d.ts +13 -0
  165. package/lib/syntax/types/ResultWrappingType.js +44 -0
  166. package/lib/syntax/types/StringType.d.ts +10 -0
  167. package/lib/syntax/types/StringType.js +35 -0
  168. package/lib/syntax/types/StructType.d.ts +14 -0
  169. package/lib/syntax/types/StructType.js +61 -0
  170. package/lib/syntax/types/TupleType.d.ts +12 -0
  171. package/lib/syntax/types/TupleType.js +39 -0
  172. package/lib/syntax/types/Type.d.ts +55 -0
  173. package/lib/syntax/types/Type.js +1 -0
  174. package/lib/syntax/types/VariantType.d.ts +19 -0
  175. package/lib/syntax/types/VariantType.js +75 -0
  176. package/lib/syntax/types/VoidType.d.ts +10 -0
  177. package/lib/syntax/types/VoidType.js +27 -0
  178. package/lib/syntax/types/getTypeAs.d.ts +2 -0
  179. package/lib/syntax/types/getTypeAs.js +12 -0
  180. package/lib/utils.d.ts +22 -0
  181. package/lib/utils.js +126 -0
  182. package/lib/views/CppHybridViewComponent.d.ts +14 -0
  183. package/lib/views/CppHybridViewComponent.js +254 -0
  184. package/lib/views/createHostComponentJs.d.ts +3 -0
  185. package/lib/views/createHostComponentJs.js +27 -0
  186. package/lib/views/kotlin/KotlinHybridViewManager.d.ts +3 -0
  187. package/lib/views/kotlin/KotlinHybridViewManager.js +229 -0
  188. package/lib/views/swift/SwiftHybridViewManager.d.ts +3 -0
  189. package/lib/views/swift/SwiftHybridViewManager.js +131 -0
  190. package/lib/writeFile.d.ts +5 -0
  191. package/lib/writeFile.js +19 -0
  192. package/package.json +58 -29
  193. package/src/Logger.ts +63 -0
  194. package/src/autolinking/Autolinking.ts +9 -0
  195. package/src/autolinking/android/createCMakeExtension.ts +123 -0
  196. package/src/autolinking/android/createGradleExtension.ts +43 -0
  197. package/src/autolinking/android/createHybridObjectInitializer.ts +174 -0
  198. package/src/autolinking/createAndroidAutolinking.ts +28 -0
  199. package/src/autolinking/createIOSAutolinking.ts +24 -0
  200. package/src/autolinking/ios/createHybridObjectInitializer.ts +112 -0
  201. package/src/autolinking/ios/createPodspecRubyExtension.ts +76 -0
  202. package/src/autolinking/ios/createSwiftCxxBridge.ts +137 -0
  203. package/src/autolinking/ios/createSwiftUmbrellaHeader.ts +90 -0
  204. package/src/config/NitroConfig.ts +139 -0
  205. package/src/config/NitroUserConfig.ts +105 -0
  206. package/src/config/getConfig.ts +91 -0
  207. package/src/createGitAttributes.ts +15 -0
  208. package/src/createPlatformSpec.ts +176 -0
  209. package/src/getFiles.ts +31 -0
  210. package/src/getPlatformSpecs.ts +202 -0
  211. package/src/index.ts +146 -0
  212. package/src/init.ts +186 -0
  213. package/src/nitrogen.ts +246 -0
  214. package/src/prettifyDirectory.ts +32 -0
  215. package/src/syntax/BridgedType.ts +59 -0
  216. package/src/syntax/CodeNode.ts +24 -0
  217. package/src/syntax/HybridObjectSpec.ts +14 -0
  218. package/src/syntax/Method.ts +154 -0
  219. package/src/syntax/Parameter.ts +81 -0
  220. package/src/syntax/Property.ts +203 -0
  221. package/src/syntax/SourceFile.ts +80 -0
  222. package/src/syntax/c++/CppEnum.ts +128 -0
  223. package/src/syntax/c++/CppHybridObject.ts +165 -0
  224. package/src/syntax/c++/CppHybridObjectRegistration.ts +39 -0
  225. package/src/syntax/c++/CppStruct.ts +129 -0
  226. package/src/syntax/c++/CppUnion.ts +105 -0
  227. package/src/syntax/c++/getForwardDeclaration.ts +19 -0
  228. package/src/syntax/c++/includeNitroHeader.ts +40 -0
  229. package/src/syntax/createType.ts +365 -0
  230. package/src/syntax/getAllTypes.ts +18 -0
  231. package/src/syntax/getCustomTypeConfig.ts +71 -0
  232. package/src/syntax/getHybridObjectName.ts +48 -0
  233. package/src/syntax/getInterfaceProperties.ts +21 -0
  234. package/src/syntax/getReferencedTypes.ts +57 -0
  235. package/src/syntax/helpers.ts +79 -0
  236. package/src/syntax/isCoreType.ts +60 -0
  237. package/src/syntax/kotlin/FbjniHybridObject.ts +313 -0
  238. package/src/syntax/kotlin/JNINativeRegistrations.ts +19 -0
  239. package/src/syntax/kotlin/KotlinBoxedPrimitive.ts +19 -0
  240. package/src/syntax/kotlin/KotlinCxxBridgedType.ts +942 -0
  241. package/src/syntax/kotlin/KotlinEnum.ts +130 -0
  242. package/src/syntax/kotlin/KotlinFunction.ts +277 -0
  243. package/src/syntax/kotlin/KotlinHybridObject.ts +205 -0
  244. package/src/syntax/kotlin/KotlinHybridObjectRegistration.ts +51 -0
  245. package/src/syntax/kotlin/KotlinStruct.ts +198 -0
  246. package/src/syntax/kotlin/KotlinVariant.ts +212 -0
  247. package/src/syntax/swift/SwiftCxxBridgedType.ts +874 -0
  248. package/src/syntax/swift/SwiftCxxTypeHelper.ts +674 -0
  249. package/src/syntax/swift/SwiftEnum.ts +65 -0
  250. package/src/syntax/swift/SwiftFunction.ts +91 -0
  251. package/src/syntax/swift/SwiftHybridObject.ts +121 -0
  252. package/src/syntax/swift/SwiftHybridObjectBridge.ts +522 -0
  253. package/src/syntax/swift/SwiftHybridObjectRegistration.ts +75 -0
  254. package/src/syntax/swift/SwiftStruct.ts +85 -0
  255. package/src/syntax/swift/SwiftVariant.ts +67 -0
  256. package/src/syntax/types/ArrayBufferType.ts +49 -0
  257. package/src/syntax/types/ArrayType.ts +62 -0
  258. package/src/syntax/types/BigIntType.ts +35 -0
  259. package/src/syntax/types/BooleanType.ts +35 -0
  260. package/src/syntax/types/CustomType.ts +47 -0
  261. package/src/syntax/types/DateType.ts +43 -0
  262. package/src/syntax/types/EnumType.ts +130 -0
  263. package/src/syntax/types/ErrorType.ts +44 -0
  264. package/src/syntax/types/FunctionType.ts +167 -0
  265. package/src/syntax/types/HybridObjectBaseType.ts +54 -0
  266. package/src/syntax/types/HybridObjectType.ts +198 -0
  267. package/src/syntax/types/MapType.ts +49 -0
  268. package/src/syntax/types/NamedWrappingType.ts +33 -0
  269. package/src/syntax/types/NullType.ts +30 -0
  270. package/src/syntax/types/NumberType.ts +34 -0
  271. package/src/syntax/types/OptionalType.ts +66 -0
  272. package/src/syntax/types/PromiseType.ts +72 -0
  273. package/src/syntax/types/RecordType.ts +56 -0
  274. package/src/syntax/types/ResultWrappingType.ts +53 -0
  275. package/src/syntax/types/StringType.ts +44 -0
  276. package/src/syntax/types/StructType.ts +83 -0
  277. package/src/syntax/types/TupleType.ts +53 -0
  278. package/src/syntax/types/Type.ts +82 -0
  279. package/src/syntax/types/VariantType.ts +92 -0
  280. package/src/syntax/types/VoidType.ts +34 -0
  281. package/src/syntax/types/getTypeAs.ts +15 -0
  282. package/src/utils.ts +162 -0
  283. package/src/views/CppHybridViewComponent.ts +301 -0
  284. package/src/views/createHostComponentJs.ts +34 -0
  285. package/src/views/kotlin/KotlinHybridViewManager.ts +258 -0
  286. package/src/views/swift/SwiftHybridViewManager.ts +153 -0
  287. package/src/writeFile.ts +27 -0
  288. package/.jshintignore +0 -6
  289. package/.jshintrc +0 -3
  290. package/.npmignore +0 -3
  291. package/.travis.yml +0 -13
  292. package/LICENSE +0 -13
  293. package/browser/nitrogen-min.js +0 -3
  294. package/browser/nitrogen.js +0 -6369
  295. package/lib/apiKey.js +0 -67
  296. package/lib/blob.js +0 -57
  297. package/lib/commandManager.js +0 -350
  298. package/lib/device.js +0 -19
  299. package/lib/memoryStore.js +0 -24
  300. package/lib/message.js +0 -298
  301. package/lib/permission.js +0 -121
  302. package/lib/principal.js +0 -330
  303. package/lib/service.js +0 -349
  304. package/lib/session.js +0 -494
  305. package/lib/user.js +0 -20
  306. package/publish +0 -2
  307. package/scripts/build-documentation +0 -4
  308. package/scripts/build-module +0 -27
  309. package/scripts/module.js +0 -12
  310. package/scripts/postamble.js +0 -1
  311. package/scripts/preamble.js +0 -2
  312. package/scripts/run-test-server +0 -9
  313. package/test/config.js +0 -12
  314. package/test/fixtures/images/image.jpg +0 -0
  315. package/test/fixtures/images/motion0.jpg +0 -0
  316. package/test/fixtures/images/motion1.jpg +0 -0
  317. package/test/fixtures/images/motion2.jpg +0 -0
  318. package/test/fixtures/index.js +0 -76
  319. package/test/main.js +0 -5
  320. package/test/memoryStore.js +0 -22
  321. package/test/mocha.opts +0 -3
  322. package/test/units/apiKey.js +0 -46
  323. package/test/units/blob.js +0 -35
  324. package/test/units/commandManager.js +0 -67
  325. package/test/units/device.js +0 -26
  326. package/test/units/heartbeat.js +0 -28
  327. package/test/units/message.js +0 -79
  328. package/test/units/permissions.js +0 -43
  329. package/test/units/principal.js +0 -116
  330. package/test/units/service.js +0 -92
  331. package/test/units/session.js +0 -97
  332. package/test/units/user.js +0 -48
  333. package/yuidoc.json +0 -8
@@ -0,0 +1,365 @@
1
+ import { ts, Type as TSMorphType, type Signature } from 'ts-morph'
2
+ import type { Type } from './types/Type.js'
3
+ import { NullType } from './types/NullType.js'
4
+ import { BooleanType } from './types/BooleanType.js'
5
+ import { NumberType } from './types/NumberType.js'
6
+ import { StringType } from './types/StringType.js'
7
+ import { BigIntType } from './types/BigIntType.js'
8
+ import { VoidType } from './types/VoidType.js'
9
+ import { ArrayType } from './types/ArrayType.js'
10
+ import { FunctionType } from './types/FunctionType.js'
11
+ import { PromiseType } from './types/PromiseType.js'
12
+ import { RecordType } from './types/RecordType.js'
13
+ import { ArrayBufferType } from './types/ArrayBufferType.js'
14
+ import { EnumType } from './types/EnumType.js'
15
+ import { HybridObjectType } from './types/HybridObjectType.js'
16
+ import { StructType } from './types/StructType.js'
17
+ import { OptionalType } from './types/OptionalType.js'
18
+ import { NamedWrappingType } from './types/NamedWrappingType.js'
19
+ import { getInterfaceProperties } from './getInterfaceProperties.js'
20
+ import { VariantType } from './types/VariantType.js'
21
+ import { MapType } from './types/MapType.js'
22
+ import { TupleType } from './types/TupleType.js'
23
+ import {
24
+ isAnyHybridSubclass,
25
+ isDirectlyHybridObject,
26
+ isHybridView,
27
+ type Language,
28
+ } from '../getPlatformSpecs.js'
29
+ import { HybridObjectBaseType } from './types/HybridObjectBaseType.js'
30
+ import { ErrorType } from './types/ErrorType.js'
31
+ import { getBaseTypes, getHybridObjectNitroModuleConfig } from '../utils.js'
32
+ import { DateType } from './types/DateType.js'
33
+ import { NitroConfig } from '../config/NitroConfig.js'
34
+ import { CustomType } from './types/CustomType.js'
35
+ import {
36
+ isSyncFunction,
37
+ isArrayBuffer,
38
+ isCustomType,
39
+ isDate,
40
+ isError,
41
+ isMap,
42
+ isPromise,
43
+ isRecord,
44
+ } from './isCoreType.js'
45
+ import { getCustomTypeConfig } from './getCustomTypeConfig.js'
46
+
47
+ function getHybridObjectName(type: TSMorphType): string {
48
+ const symbol = isHybridView(type) ? type.getAliasSymbol() : type.getSymbol()
49
+ if (symbol == null) {
50
+ throw new Error(
51
+ `Cannot get name of \`${type.getText()}\` - symbol not found!`
52
+ )
53
+ }
54
+ return symbol.getEscapedName()
55
+ }
56
+
57
+ function getFunctionCallSignature(func: TSMorphType): Signature {
58
+ const callSignatures = func.getCallSignatures()
59
+ const callSignature = callSignatures[0]
60
+ if (callSignatures.length !== 1 || callSignature == null) {
61
+ throw new Error(
62
+ `Function overloads are not supported in Nitrogen! (in ${func.getText()})`
63
+ )
64
+ }
65
+ return callSignature
66
+ }
67
+
68
+ function removeDuplicates(types: Type[]): Type[] {
69
+ return types.filter((t1, index, array) => {
70
+ const firstIndexOfType = array.findIndex(
71
+ (t2) => t1.getCode('c++') === t2.getCode('c++')
72
+ )
73
+ return firstIndexOfType === index
74
+ })
75
+ }
76
+
77
+ type Tuple<
78
+ T,
79
+ N extends number,
80
+ R extends unknown[] = [],
81
+ > = R['length'] extends N ? R : Tuple<T, N, [T, ...R]>
82
+ function getArguments<N extends number>(
83
+ type: TSMorphType,
84
+ typename: string,
85
+ count: N
86
+ ): Tuple<TSMorphType<ts.Type>, N> {
87
+ const typeArguments = type.getTypeArguments()
88
+ if (typeArguments.length === count) {
89
+ return typeArguments as Tuple<TSMorphType<ts.Type>, N>
90
+ }
91
+
92
+ const aliasTypeArguments = type.getAliasTypeArguments()
93
+ if (aliasTypeArguments.length === count) {
94
+ return aliasTypeArguments as Tuple<TSMorphType<ts.Type>, N>
95
+ }
96
+
97
+ throw new Error(
98
+ `Type ${type.getText()} looks like a ${typename}, but has ${typeArguments.length} or ${aliasTypeArguments.length} type arguments instead of ${count}!`
99
+ )
100
+ }
101
+
102
+ export function createNamedType(
103
+ language: Language,
104
+ name: string,
105
+ type: TSMorphType,
106
+ isOptional: boolean
107
+ ) {
108
+ if (name.startsWith('__')) {
109
+ throw new Error(
110
+ `Name cannot start with two underscores (__) as this is reserved syntax for Nitrogen! (In ${type.getText()})`
111
+ )
112
+ }
113
+ return new NamedWrappingType(name, createType(language, type, isOptional))
114
+ }
115
+
116
+ export function createVoidType(): Type {
117
+ return new VoidType()
118
+ }
119
+
120
+ // Caches complex types (types that have a symbol)
121
+ type TypeId = string
122
+ const knownTypes: Record<Language, Map<TypeId, Type>> = {
123
+ 'c++': new Map<TypeId, Type>(),
124
+ 'swift': new Map<TypeId, Type>(),
125
+ 'kotlin': new Map<TypeId, Type>(),
126
+ }
127
+
128
+ /**
129
+ * Get a list of all currently known complex types.
130
+ */
131
+ export function getAllKnownTypes(language?: Language): Type[] {
132
+ if (language != null) {
133
+ // Get types for the given language
134
+ return Array.from(knownTypes[language].values())
135
+ } else {
136
+ // Get types for all languages alltogether
137
+ const allMaps = Object.values(knownTypes)
138
+ return allMaps.flatMap((m) => Array.from(m.values()))
139
+ }
140
+ }
141
+
142
+ function getTypeId(type: TSMorphType, isOptional: boolean): string {
143
+ const symbol = type.getSymbol()
144
+ let key = type.getText()
145
+ if (symbol != null) {
146
+ key += '_' + symbol.getFullyQualifiedName()
147
+ }
148
+ if (isOptional) key += '?'
149
+ return key
150
+ }
151
+
152
+ export function addKnownType(
153
+ key: string,
154
+ type: Type,
155
+ language: Language
156
+ ): void {
157
+ if (knownTypes[language].has(key)) {
158
+ // type is already known
159
+ return
160
+ }
161
+ knownTypes[language].set(key, type)
162
+ }
163
+
164
+ /**
165
+ * Create a new type (or return it from cache if it is already known)
166
+ */
167
+ export function createType(
168
+ language: Language,
169
+ type: TSMorphType,
170
+ isOptional: boolean
171
+ ): Type {
172
+ const key = getTypeId(type, isOptional)
173
+ if (key != null && knownTypes[language].has(key)) {
174
+ const known = knownTypes[language].get(key)!
175
+ if (isOptional === known instanceof OptionalType) {
176
+ return known
177
+ }
178
+ }
179
+
180
+ const get = () => {
181
+ if (isOptional) {
182
+ const wrapping = createType(language, type, false)
183
+ return new OptionalType(wrapping)
184
+ }
185
+
186
+ if (type.isNull() || type.isUndefined()) {
187
+ return new NullType()
188
+ } else if (type.isBoolean() || type.isBooleanLiteral()) {
189
+ return new BooleanType()
190
+ } else if (type.isNumber() || type.isNumberLiteral()) {
191
+ if (type.isEnumLiteral()) {
192
+ // enum literals are technically just numbers - but we treat them differently in C++.
193
+ return createType(language, type.getBaseTypeOfLiteralType(), isOptional)
194
+ }
195
+ return new NumberType()
196
+ } else if (type.isString()) {
197
+ return new StringType()
198
+ } else if (type.isBigInt() || type.isBigIntLiteral()) {
199
+ return new BigIntType()
200
+ } else if (type.isVoid()) {
201
+ return new VoidType()
202
+ } else if (type.isArray()) {
203
+ const arrayElementType = type.getArrayElementTypeOrThrow()
204
+ const elementType = createType(language, arrayElementType, false)
205
+ return new ArrayType(elementType)
206
+ } else if (type.isTuple()) {
207
+ const itemTypes = type
208
+ .getTupleElements()
209
+ .map((t) => createType(language, t, t.isNullable()))
210
+ return new TupleType(itemTypes)
211
+ } else if (type.getCallSignatures().length > 0) {
212
+ // It's a function!
213
+ const callSignature = getFunctionCallSignature(type)
214
+ const funcReturnType = callSignature.getReturnType()
215
+ const returnType = createType(
216
+ language,
217
+ funcReturnType,
218
+ funcReturnType.isNullable()
219
+ )
220
+ const parameters = callSignature.getParameters().map((p) => {
221
+ const declaration = p.getValueDeclarationOrThrow()
222
+ const parameterType = p.getTypeAtLocation(declaration)
223
+ const isNullable = parameterType.isNullable() || p.isOptional()
224
+ return createNamedType(language, p.getName(), parameterType, isNullable)
225
+ })
226
+ const isSync = isSyncFunction(type)
227
+ return new FunctionType(returnType, parameters, isSync)
228
+ } else if (isPromise(type)) {
229
+ // It's a Promise!
230
+ const [promiseResolvingType] = getArguments(type, 'Promise', 1)
231
+ const resolvingType = createType(
232
+ language,
233
+ promiseResolvingType,
234
+ promiseResolvingType.isNullable()
235
+ )
236
+ return new PromiseType(resolvingType)
237
+ } else if (isRecord(type)) {
238
+ // Record<K, V> -> unordered_map<K, V>
239
+ const [keyTypeT, valueTypeT] = getArguments(type, 'Record', 2)
240
+ const keyType = createType(language, keyTypeT, false)
241
+ const valueType = createType(language, valueTypeT, false)
242
+ return new RecordType(keyType, valueType)
243
+ } else if (isArrayBuffer(type)) {
244
+ // ArrayBuffer
245
+ return new ArrayBufferType()
246
+ } else if (isMap(type)) {
247
+ // Map
248
+ return new MapType()
249
+ } else if (isDate(type)) {
250
+ // Date
251
+ return new DateType()
252
+ } else if (isError(type)) {
253
+ // Error
254
+ return new ErrorType()
255
+ } else if (isCustomType(type)) {
256
+ // Custom C++ type (manually written)
257
+ const { name, config } = getCustomTypeConfig(type)
258
+ return new CustomType(name, config)
259
+ } else if (type.isEnum()) {
260
+ // It is an enum. We need to generate a C++ declaration for the enum
261
+ const typename = type.getSymbolOrThrow().getEscapedName()
262
+ const declaration = type.getSymbolOrThrow().getValueDeclarationOrThrow()
263
+ const enumDeclaration = declaration.asKindOrThrow(
264
+ ts.SyntaxKind.EnumDeclaration
265
+ )
266
+ return new EnumType(typename, enumDeclaration)
267
+ } else if (type.isUnion()) {
268
+ // It is some kind of union;
269
+ // - of string literals (then it's an enum)
270
+ // - of type `T | undefined` (then it's just optional `T`)
271
+ // - of different types (then it's a variant `A | B | C`)
272
+ const types = type.getUnionTypes()
273
+ const nonNullTypes = types.filter(
274
+ (t) => !t.isNull() && !t.isUndefined() && !t.isVoid()
275
+ )
276
+ const isEnumUnion = nonNullTypes.every((t) => t.isStringLiteral())
277
+ if (isEnumUnion) {
278
+ // It consists only of string literaly - that means it's describing an enum!
279
+ const symbol = type.getNonNullableType().getAliasSymbol()
280
+ if (symbol == null) {
281
+ // If there is no alias, it is an inline union instead of a separate type declaration!
282
+ throw new Error(
283
+ `Inline union types ("${type.getText()}") are not supported by Nitrogen!\n` +
284
+ `Extract the union to a separate type, and re-run nitrogen!`
285
+ )
286
+ }
287
+ const typename = symbol.getEscapedName()
288
+ return new EnumType(typename, type)
289
+ } else {
290
+ // It consists of different types - that means it's a variant!
291
+ let variants = type
292
+ .getUnionTypes()
293
+ // Filter out any nulls or undefineds, as those are already treated as `isOptional`.
294
+ .filter((t) => !t.isNull() && !t.isUndefined() && !t.isVoid())
295
+ .map((t) => createType(language, t, false))
296
+ variants = removeDuplicates(variants)
297
+
298
+ if (variants.length === 1) {
299
+ // It's just one type with undefined/null variant(s) - so we treat it like a simple optional.
300
+ return variants[0]!
301
+ }
302
+
303
+ const name = type.getAliasSymbol()?.getName()
304
+ return new VariantType(variants, name)
305
+ }
306
+ } else if (isAnyHybridSubclass(type)) {
307
+ // It is another HybridObject being referenced!
308
+ const typename = getHybridObjectName(type)
309
+ const baseTypes = getBaseTypes(type)
310
+ .filter((t) => isAnyHybridSubclass(t))
311
+ .map((b) => createType(language, b, false))
312
+ const baseHybrids = baseTypes.filter((b) => b instanceof HybridObjectType)
313
+ const sourceConfig =
314
+ getHybridObjectNitroModuleConfig(type) ?? NitroConfig.current
315
+ return new HybridObjectType(typename, language, baseHybrids, sourceConfig)
316
+ } else if (isDirectlyHybridObject(type)) {
317
+ // It is a HybridObject directly/literally. Base type
318
+ return new HybridObjectBaseType()
319
+ } else if (type.isInterface()) {
320
+ // It is an `interface T { ... }`, which is a `struct`
321
+ const typename = type.getSymbolOrThrow().getName()
322
+ const properties = getInterfaceProperties(language, type)
323
+ return new StructType(typename, properties)
324
+ } else if (type.isObject()) {
325
+ // It is an object. If it has a symbol/name, it is a `type T = ...` declaration, so a `struct`.
326
+ // Otherwise, it is an anonymous/inline object, which cannot be represented in native.
327
+ const symbol = type.getAliasSymbol()
328
+ if (symbol != null) {
329
+ // it has a `type T = ...` declaration
330
+ const typename = symbol.getName()
331
+ const properties = getInterfaceProperties(language, type)
332
+ return new StructType(typename, properties)
333
+ } else {
334
+ // It's an anonymous object (`{ ... }`)
335
+ throw new Error(
336
+ `Anonymous objects cannot be represented in C++! Extract "${type.getText()}" to a separate interface/type declaration.`
337
+ )
338
+ }
339
+ } else if (type.isStringLiteral()) {
340
+ throw new Error(
341
+ `String literal ${type.getText()} cannot be represented in C++ because it is ambiguous between a string and a discriminating union enum.`
342
+ )
343
+ } else {
344
+ if (type.getSymbol() == null) {
345
+ // There is no declaration for it!
346
+ // Could be an invalid import, e.g. an alias
347
+ throw new Error(
348
+ `The TypeScript type "${type.getText()}" cannot be resolved - is it imported properly? ` +
349
+ `Make sure to import it properly using fully specified relative or absolute imports, no aliases.`
350
+ )
351
+ } else {
352
+ // A different error
353
+ throw new Error(
354
+ `The TypeScript type "${type.getText()}" cannot be represented in C++!`
355
+ )
356
+ }
357
+ }
358
+ }
359
+
360
+ const result = get()
361
+ if (key != null) {
362
+ knownTypes[language].set(key, result)
363
+ }
364
+ return result
365
+ }
@@ -0,0 +1,18 @@
1
+ import type { HybridObjectSpec } from './HybridObjectSpec.js'
2
+ import type { Type } from './types/Type.js'
3
+
4
+ // TODO: Structs or other HybridObjects may reference other types recursively - we need to add a `referencedTypes` prop to each `Type` to be able to resolve that.
5
+ export function getAllTypes(spec: HybridObjectSpec): Type[] {
6
+ const types: Type[] = []
7
+
8
+ // 1. Properties
9
+ types.push(...spec.properties.map((p) => p.type))
10
+
11
+ // 2. Method return types
12
+ types.push(...spec.methods.map((m) => m.returnType))
13
+
14
+ // 3. Method parameters
15
+ types.push(...spec.methods.flatMap((m) => m.parameters.map((p) => p.type)))
16
+
17
+ return types
18
+ }
@@ -0,0 +1,71 @@
1
+ import type { CustomTypeConfig } from 'react-native-nitro-modules'
2
+ import type { Type as TSMorphType } from 'ts-morph'
3
+
4
+ interface Result {
5
+ name: string
6
+ config: CustomTypeConfig
7
+ }
8
+
9
+ export function getCustomTypeConfig(type: TSMorphType): Result {
10
+ const parts = type.getIntersectionTypes()
11
+ for (const part of parts) {
12
+ const typeNameProperty = part.getProperty('__customTypeName')
13
+ if (typeNameProperty == null) continue
14
+ const typeConfigProperty = part.getProperty('__customTypeConfig')
15
+ if (typeConfigProperty == null) continue
16
+
17
+ const declaration = type.getAliasSymbolOrThrow().getDeclarations()[0]
18
+ if (declaration == null)
19
+ throw new Error(`Type has no declaration! ${type.getText()}`)
20
+
21
+ const typeNameTypeOrUndefined =
22
+ typeNameProperty.getTypeAtLocation(declaration)
23
+ const typeConfigTypeOrUndefined =
24
+ typeConfigProperty.getTypeAtLocation(declaration)
25
+
26
+ const typeNameType = typeNameTypeOrUndefined
27
+ .getUnionTypes()
28
+ .find((t) => t.isLiteral())
29
+ if (typeNameType == null) continue
30
+ const typeConfigType = typeConfigTypeOrUndefined
31
+ .getUnionTypes()
32
+ .find((t) => t.isObject())
33
+ if (typeConfigType == null) continue
34
+
35
+ const typeName = typeNameType.getLiteralValue()
36
+ if (typeof typeName !== 'string') {
37
+ throw new Error(
38
+ `CustomType's second argument (TypeName) needs to be a string! Instead, it is a ${typeof typeName} (${typeName})`
39
+ )
40
+ }
41
+ const includeType = typeConfigType
42
+ .getPropertyOrThrow('include')
43
+ .getTypeAtLocation(declaration)
44
+ const include = includeType.getLiteralValue()
45
+ if (typeof include !== 'string')
46
+ throw new Error(
47
+ `CustomType's third argument (Config) needs to contain { include }, which should be a string! (It is ${includeType.getText()} instead)`
48
+ )
49
+ const canBePassedByReferenceType = typeConfigType
50
+ .getProperty('canBePassedByReference')
51
+ ?.getTypeAtLocation(declaration)
52
+ .getUnionTypes()
53
+ .find((u) => u.isBooleanLiteral())
54
+ ?.getLiteralValue()
55
+ const canBePassedByReference =
56
+ typeof canBePassedByReferenceType === 'boolean'
57
+ ? canBePassedByReferenceType
58
+ : false
59
+
60
+ return {
61
+ name: typeName,
62
+ config: {
63
+ include: include,
64
+ canBePassedByReference: canBePassedByReference,
65
+ },
66
+ }
67
+ }
68
+ throw new Error(
69
+ `Type looks like a CustomType<...>, but doesn't have generic arguments! ${type.getText()}`
70
+ )
71
+ }
@@ -0,0 +1,48 @@
1
+ export interface HybridObjectName {
2
+ /**
3
+ * The raw name of the Hybrid Object (same as the TS interface name).
4
+ * @example "Image"
5
+ */
6
+ T: string
7
+ /**
8
+ * The debug-only description name of the Hybrid Object as it can be described in natively.
9
+ * @example "HybridImage"
10
+ */
11
+ HybridT: string
12
+ /**
13
+ * The name of the C++ class, Kotlin interface or Swift protocol that represents the
14
+ * specification (all of it's virtual properties and methods) of the Hybrid Object.
15
+ * @example "HybridImageSpec"
16
+ */
17
+ HybridTSpec: string
18
+ /**
19
+ * The name of the Swift class that bridges any types from
20
+ * {@linkcode HybridTSpec} over to C++.
21
+ * This includes a few type conversions or result/exception wrapping.
22
+ * @example "HybridImage_cxx"
23
+ */
24
+ HybridTSpecCxx: string
25
+ /**
26
+ * The name of the C++ class that actually bridges to the Java Hybrid Object.
27
+ * @example "JHybridImage"
28
+ */
29
+ JHybridTSpec: string
30
+ /**
31
+ * The name of the C++ class that extends the Hybrid Object and bridges over to the Swift C++ wrapper class.
32
+ * @example "HybridImageSwift"
33
+ */
34
+ HybridTSpecSwift: string
35
+ }
36
+
37
+ export function getHybridObjectName(
38
+ hybridObjectName: string
39
+ ): HybridObjectName {
40
+ return {
41
+ T: hybridObjectName,
42
+ HybridT: `Hybrid${hybridObjectName}`,
43
+ HybridTSpec: `Hybrid${hybridObjectName}Spec`,
44
+ HybridTSpecCxx: `Hybrid${hybridObjectName}Spec_cxx`,
45
+ JHybridTSpec: `JHybrid${hybridObjectName}Spec`,
46
+ HybridTSpecSwift: `Hybrid${hybridObjectName}SpecSwift`,
47
+ }
48
+ }
@@ -0,0 +1,21 @@
1
+ import type { ts, Type } from 'ts-morph'
2
+ import type { NamedType } from './types/Type.js'
3
+ import { createNamedType } from './createType.js'
4
+ import type { Language } from '../getPlatformSpecs.js'
5
+
6
+ export function getInterfaceProperties(
7
+ language: Language,
8
+ interfaceType: Type<ts.ObjectType>
9
+ ): NamedType[] {
10
+ return interfaceType.getProperties().map((prop) => {
11
+ const declaration = prop.getValueDeclarationOrThrow()
12
+ const propType = prop.getTypeAtLocation(declaration)
13
+ const refType = createNamedType(
14
+ language,
15
+ prop.getName(),
16
+ propType,
17
+ prop.isOptional() || propType.isNullable()
18
+ )
19
+ return refType
20
+ })
21
+ }
@@ -0,0 +1,57 @@
1
+ import { ArrayType } from './types/ArrayType.js'
2
+ import { FunctionType } from './types/FunctionType.js'
3
+ import { getTypeAs } from './types/getTypeAs.js'
4
+ import { OptionalType } from './types/OptionalType.js'
5
+ import { PromiseType } from './types/PromiseType.js'
6
+ import { RecordType } from './types/RecordType.js'
7
+ import { StructType } from './types/StructType.js'
8
+ import { TupleType } from './types/TupleType.js'
9
+ import type { Type } from './types/Type.js'
10
+ import { VariantType } from './types/VariantType.js'
11
+
12
+ export function getReferencedTypes(type: Type): Type[] {
13
+ switch (type.kind) {
14
+ case 'array':
15
+ const array = getTypeAs(type, ArrayType)
16
+ return [type, ...getReferencedTypes(array.itemType)]
17
+
18
+ case 'function':
19
+ const func = getTypeAs(type, FunctionType)
20
+ return [
21
+ type,
22
+ ...getReferencedTypes(func.returnType),
23
+ ...func.parameters.flatMap((t) => getReferencedTypes(t)),
24
+ ]
25
+
26
+ case 'optional':
27
+ const optional = getTypeAs(type, OptionalType)
28
+ return [type, ...getReferencedTypes(optional.wrappingType)]
29
+
30
+ case 'promise':
31
+ const promise = getTypeAs(type, PromiseType)
32
+ return [type, ...getReferencedTypes(promise.resultingType)]
33
+
34
+ case 'record':
35
+ const record = getTypeAs(type, RecordType)
36
+ return [
37
+ type,
38
+ ...getReferencedTypes(record.keyType),
39
+ ...getReferencedTypes(record.valueType),
40
+ ]
41
+
42
+ case 'struct':
43
+ const struct = getTypeAs(type, StructType)
44
+ return [type, ...struct.properties.flatMap((p) => getReferencedTypes(p))]
45
+
46
+ case 'tuple':
47
+ const tuple = getTypeAs(type, TupleType)
48
+ return [type, ...tuple.itemTypes.flatMap((t) => getReferencedTypes(t))]
49
+
50
+ case 'variant':
51
+ const variant = getTypeAs(type, VariantType)
52
+ return [type, ...variant.variants.flatMap((t) => getReferencedTypes(t))]
53
+
54
+ default:
55
+ return [type]
56
+ }
57
+ }
@@ -0,0 +1,79 @@
1
+ import path from 'path'
2
+ import type { SourceFile } from './SourceFile.js'
3
+ import type { Type } from './types/Type.js'
4
+ import { getTypeAs } from './types/getTypeAs.js'
5
+ import { OptionalType } from './types/OptionalType.js'
6
+
7
+ type Comment = '///' | '#'
8
+
9
+ export function createFileMetadataString(
10
+ filename: string,
11
+ comment: Comment = '///'
12
+ ): string {
13
+ const now = new Date()
14
+ return `
15
+ ${comment}
16
+ ${comment} ${filename}
17
+ ${comment} This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
18
+ ${comment} https://github.com/mrousavy/nitro
19
+ ${comment} Copyright © ${now.getFullYear()} Marc Rousavy @ Margelo
20
+ ${comment}
21
+ `.trim()
22
+ }
23
+
24
+ export function isFunction(type: Type): boolean {
25
+ switch (type.kind) {
26
+ case 'function':
27
+ return true
28
+ case 'optional': {
29
+ const optional = getTypeAs(type, OptionalType)
30
+ return isFunction(optional.wrappingType)
31
+ }
32
+ default:
33
+ return false
34
+ }
35
+ }
36
+
37
+ export function toReferenceType(type: string): `const ${typeof type}&` {
38
+ return `const ${type}&`
39
+ }
40
+
41
+ export function escapeCppName(string: string): string {
42
+ // Replace non-alphanumeric characters with underscores
43
+ let escapedStr = string.replace(/[^a-zA-Z0-9_]/g, '_')
44
+
45
+ // Ensure the first character is a letter or underscore
46
+ if (!/^[a-zA-Z_]/.test(escapedStr)) {
47
+ escapedStr = '_' + escapedStr
48
+ }
49
+
50
+ return escapedStr
51
+ }
52
+
53
+ export function isBooleanPropertyPrefix(name: string): boolean {
54
+ return name.startsWith('is') || name.startsWith('has')
55
+ }
56
+
57
+ export function isNotDuplicate<T>(item: T, index: number, array: T[]): boolean {
58
+ return array.indexOf(item) === index
59
+ }
60
+
61
+ export function isCppFile(file: SourceFile): boolean {
62
+ return file.name.endsWith('cpp') || file.name.endsWith('c')
63
+ }
64
+
65
+ export function getRelativeDirectory(file: SourceFile): string {
66
+ return path.join(
67
+ '..',
68
+ 'nitrogen',
69
+ 'generated',
70
+ file.platform,
71
+ file.language,
72
+ ...file.subdirectory,
73
+ file.name
74
+ )
75
+ }
76
+
77
+ export function getRelativeDirectoryGenerated(...subpath: string[]): string {
78
+ return path.join('..', 'nitrogen', 'generated', ...subpath)
79
+ }