@halospv3/hce.shared-config 2.6.4 → 3.0.0-develop.10

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 (310) hide show
  1. package/CHANGELOG.md +452 -101
  2. package/README.md +100 -87
  3. package/dotnet/.github/workflows/_unit_test.yml +3 -3
  4. package/dotnet/.github/workflows/ci.yml +2 -2
  5. package/dotnet/.github/workflows/dotnet-release.yml +28 -28
  6. package/dotnet/.github/workflows/sample-dotnet-build.yml +13 -11
  7. package/dotnet/ExecNupkgDeterministicator.README.md +20 -0
  8. package/dotnet/ExecNupkgDeterministicator.targets +173 -0
  9. package/dotnet/GitVersion.yml +3 -1
  10. package/dotnet/GitVersion6.0.yml +3 -1
  11. package/dotnet/HCE.Shared.sln +34 -0
  12. package/dotnet/HCE.Shared.targets +1 -0
  13. package/dotnet/PublishAll.targets +2 -0
  14. package/dotnet/SignAfterPack.targets +104 -0
  15. package/dotnet/samples/HCE.Shared.DeterministicNupkg/Dummy.cs +6 -0
  16. package/dotnet/samples/HCE.Shared.DeterministicNupkg/HCE.Shared.DeterministicNupkg.csproj +21 -0
  17. package/dotnet/samples/HCE.Shared.SignAfterPack/Class1.cs +6 -0
  18. package/dotnet/samples/HCE.Shared.SignAfterPack/HCE.Shared.SignAfterPack.csproj +21 -0
  19. package/dotnet/samples/HCE.Shared.SignAfterPack/sampleCert.samplepfx +0 -0
  20. package/dotnet/samples/README.md +7 -0
  21. package/mjs/CaseInsensitiveMap.d.ts +12 -0
  22. package/mjs/CaseInsensitiveMap.d.ts.map +1 -0
  23. package/mjs/CaseInsensitiveMap.mjs +33 -0
  24. package/mjs/CaseInsensitiveMap.mjs.map +1 -0
  25. package/mjs/commitlintConfig.d.ts +12 -0
  26. package/mjs/commitlintConfig.d.ts.map +1 -0
  27. package/{cjs/commitlintConfig.cjs → mjs/commitlintConfig.mjs} +3 -4
  28. package/mjs/commitlintConfig.mjs.map +1 -0
  29. package/mjs/debug.d.ts +4 -0
  30. package/{cjs → mjs}/debug.d.ts.map +1 -1
  31. package/mjs/debug.mjs +7 -0
  32. package/mjs/debug.mjs.map +1 -0
  33. package/mjs/dotnet/GithubNugetRegistryInfo.d.ts +38 -0
  34. package/mjs/dotnet/GithubNugetRegistryInfo.d.ts.map +1 -0
  35. package/mjs/dotnet/GithubNugetRegistryInfo.mjs +43 -0
  36. package/mjs/dotnet/GithubNugetRegistryInfo.mjs.map +1 -0
  37. package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts +62 -0
  38. package/mjs/dotnet/GitlabNugetRegistryInfo.d.ts.map +1 -0
  39. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs +99 -0
  40. package/mjs/dotnet/GitlabNugetRegistryInfo.mjs.map +1 -0
  41. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts +2 -0
  42. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.d.ts.map +1 -0
  43. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs +26 -0
  44. package/mjs/dotnet/IsNextVersionAlreadyPublished.cli.mjs.map +1 -0
  45. package/mjs/dotnet/MSBuildProject.d.ts +256 -0
  46. package/mjs/dotnet/MSBuildProject.d.ts.map +1 -0
  47. package/mjs/dotnet/MSBuildProject.mjs +447 -0
  48. package/mjs/dotnet/MSBuildProject.mjs.map +1 -0
  49. package/mjs/dotnet/MSBuildProjectProperties.d.ts +170 -0
  50. package/mjs/dotnet/MSBuildProjectProperties.d.ts.map +1 -0
  51. package/mjs/dotnet/MSBuildProjectProperties.mjs +260 -0
  52. package/mjs/dotnet/MSBuildProjectProperties.mjs.map +1 -0
  53. package/mjs/dotnet/NugetProjectProperties.d.ts +379 -0
  54. package/mjs/dotnet/NugetProjectProperties.d.ts.map +1 -0
  55. package/mjs/dotnet/NugetProjectProperties.mjs +577 -0
  56. package/mjs/dotnet/NugetProjectProperties.mjs.map +1 -0
  57. package/mjs/dotnet/NugetRegistryInfo.d.ts +384 -0
  58. package/mjs/dotnet/NugetRegistryInfo.d.ts.map +1 -0
  59. package/mjs/dotnet/NugetRegistryInfo.mjs +752 -0
  60. package/mjs/dotnet/NugetRegistryInfo.mjs.map +1 -0
  61. package/mjs/dotnet/helpers.d.ts +63 -0
  62. package/mjs/dotnet/helpers.d.ts.map +1 -0
  63. package/mjs/dotnet/helpers.mjs +354 -0
  64. package/mjs/dotnet/helpers.mjs.map +1 -0
  65. package/mjs/dotnet/index.d.ts +17 -0
  66. package/mjs/dotnet/index.d.ts.map +1 -0
  67. package/mjs/dotnet/index.mjs +9 -0
  68. package/mjs/dotnet/index.mjs.map +1 -0
  69. package/mjs/dotnet.d.ts +3 -0
  70. package/mjs/dotnet.d.ts.map +1 -0
  71. package/mjs/dotnet.mjs +9 -0
  72. package/mjs/dotnet.mjs.map +1 -0
  73. package/mjs/eslintConfig.d.ts +4 -0
  74. package/mjs/eslintConfig.d.ts.map +1 -0
  75. package/mjs/eslintConfig.mjs +98 -0
  76. package/mjs/eslintConfig.mjs.map +1 -0
  77. package/mjs/index.d.ts +3 -0
  78. package/mjs/index.d.ts.map +1 -0
  79. package/mjs/index.mjs +4 -0
  80. package/mjs/index.mjs.map +1 -0
  81. package/mjs/insertPlugins.d.ts +18 -0
  82. package/mjs/insertPlugins.d.ts.map +1 -0
  83. package/mjs/insertPlugins.mjs +73 -0
  84. package/mjs/insertPlugins.mjs.map +1 -0
  85. package/mjs/semantic-release__commit-analyzer.d.mjs +2 -0
  86. package/mjs/semantic-release__commit-analyzer.d.mjs.map +1 -0
  87. package/mjs/semantic-release__exec.d.mjs +2 -0
  88. package/mjs/semantic-release__exec.d.mjs.map +1 -0
  89. package/mjs/semantic-release__git.d.mjs +2 -0
  90. package/mjs/semantic-release__git.d.mjs.map +1 -0
  91. package/mjs/semantic-release__github.d.mjs +2 -0
  92. package/mjs/semantic-release__github.d.mjs.map +1 -0
  93. package/mjs/semanticReleaseConfig.d.ts +97 -0
  94. package/mjs/semanticReleaseConfig.d.ts.map +1 -0
  95. package/mjs/semanticReleaseConfig.mjs +63 -0
  96. package/mjs/semanticReleaseConfig.mjs.map +1 -0
  97. package/mjs/semanticReleaseConfigDotnet.d.ts +109 -0
  98. package/mjs/semanticReleaseConfigDotnet.d.ts.map +1 -0
  99. package/mjs/semanticReleaseConfigDotnet.mjs +267 -0
  100. package/mjs/semanticReleaseConfigDotnet.mjs.map +1 -0
  101. package/mjs/setupGitPluginSpec.d.ts +22 -0
  102. package/mjs/setupGitPluginSpec.d.ts.map +1 -0
  103. package/mjs/setupGitPluginSpec.mjs +144 -0
  104. package/mjs/setupGitPluginSpec.mjs.map +1 -0
  105. package/mjs/utils/Exact.d.ts +20 -0
  106. package/mjs/utils/Exact.d.ts.map +1 -0
  107. package/mjs/utils/Exact.mjs +75 -0
  108. package/mjs/utils/Exact.mjs.map +1 -0
  109. package/mjs/utils/GracefulRecursion.d.mjs +2 -0
  110. package/mjs/utils/GracefulRecursion.d.mjs.map +1 -0
  111. package/mjs/utils/env.d.ts +24 -0
  112. package/mjs/utils/env.d.ts.map +1 -0
  113. package/mjs/utils/env.mjs +39 -0
  114. package/mjs/utils/env.mjs.map +1 -0
  115. package/mjs/utils/execAsync.d.ts +37 -0
  116. package/mjs/utils/execAsync.d.ts.map +1 -0
  117. package/mjs/utils/execAsync.mjs +59 -0
  118. package/mjs/utils/execAsync.mjs.map +1 -0
  119. package/mjs/utils/miscTypes.d.ts +13 -0
  120. package/mjs/utils/miscTypes.d.ts.map +1 -0
  121. package/mjs/utils/miscTypes.mjs +10 -0
  122. package/mjs/utils/miscTypes.mjs.map +1 -0
  123. package/mjs/utils/reflection/FunctionLike.d.mjs +2 -0
  124. package/mjs/utils/reflection/FunctionLike.d.mjs.map +1 -0
  125. package/mjs/utils/reflection/GetterDescriptor.d.mjs +2 -0
  126. package/mjs/utils/reflection/GetterDescriptor.d.mjs.map +1 -0
  127. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs +2 -0
  128. package/mjs/utils/reflection/InstancePropertyDescriptorMap.d.mjs.map +1 -0
  129. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs +2 -0
  130. package/mjs/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.mjs.map +1 -0
  131. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs +2 -0
  132. package/mjs/utils/reflection/OwnGetterDescriptorMap.d.mjs.map +1 -0
  133. package/mjs/utils/reflection/OwnKeyOf.d.mjs +2 -0
  134. package/mjs/utils/reflection/OwnKeyOf.d.mjs.map +1 -0
  135. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs +2 -0
  136. package/mjs/utils/reflection/OwnPropertyDescriptorMap.d.mjs.map +1 -0
  137. package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs +2 -0
  138. package/mjs/utils/reflection/PropertyDescriptorMap.d.mjs.map +1 -0
  139. package/mjs/utils/reflection/filterForGetters.d.ts +7 -0
  140. package/mjs/utils/reflection/filterForGetters.d.ts.map +1 -0
  141. package/mjs/utils/reflection/filterForGetters.mjs +27 -0
  142. package/mjs/utils/reflection/filterForGetters.mjs.map +1 -0
  143. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts +22 -0
  144. package/mjs/utils/reflection/getOwnPropertyDescriptors.d.ts.map +1 -0
  145. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs +34 -0
  146. package/mjs/utils/reflection/getOwnPropertyDescriptors.mjs.map +1 -0
  147. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts +56 -0
  148. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.d.ts.map +1 -0
  149. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs +72 -0
  150. package/mjs/utils/reflection/getOwnPropertyDescriptorsRecursively.mjs.map +1 -0
  151. package/mjs/utils/reflection/getPrototypeChainOf.d.ts +16 -0
  152. package/mjs/utils/reflection/getPrototypeChainOf.d.ts.map +1 -0
  153. package/mjs/utils/reflection/getPrototypeChainOf.mjs +55 -0
  154. package/mjs/utils/reflection/getPrototypeChainOf.mjs.map +1 -0
  155. package/mjs/utils/reflection/getPrototypeOf.d.ts +8 -0
  156. package/mjs/utils/reflection/getPrototypeOf.d.ts.map +1 -0
  157. package/mjs/utils/reflection/getPrototypeOf.mjs +10 -0
  158. package/mjs/utils/reflection/getPrototypeOf.mjs.map +1 -0
  159. package/mjs/utils/reflection/inheritance.d.ts +180 -0
  160. package/mjs/utils/reflection/inheritance.d.ts.map +1 -0
  161. package/mjs/utils/reflection/inheritance.mjs +148 -0
  162. package/mjs/utils/reflection/inheritance.mjs.map +1 -0
  163. package/mjs/utils/reflection/isConstructor.d.ts +17 -0
  164. package/mjs/utils/reflection/isConstructor.d.ts.map +1 -0
  165. package/mjs/utils/reflection/isConstructor.mjs +63 -0
  166. package/mjs/utils/reflection/isConstructor.mjs.map +1 -0
  167. package/mjs/utils/reflection/isGetterDescriptor.d.ts +9 -0
  168. package/mjs/utils/reflection/isGetterDescriptor.d.ts.map +1 -0
  169. package/mjs/utils/reflection/isGetterDescriptor.mjs +12 -0
  170. package/mjs/utils/reflection/isGetterDescriptor.mjs.map +1 -0
  171. package/mjs/utils/reflection/listOwnGetters.d.ts +26 -0
  172. package/mjs/utils/reflection/listOwnGetters.d.ts.map +1 -0
  173. package/mjs/utils/reflection/listOwnGetters.mjs +39 -0
  174. package/mjs/utils/reflection/listOwnGetters.mjs.map +1 -0
  175. package/mjs/utils/reflection.d.ts +18 -0
  176. package/mjs/utils/reflection.d.ts.map +1 -0
  177. package/mjs/utils/reflection.mjs +10 -0
  178. package/mjs/utils/reflection.mjs.map +1 -0
  179. package/package.json +77 -78
  180. package/src/CaseInsensitiveMap.ts +34 -0
  181. package/src/commitlintConfig.ts +17 -9
  182. package/src/debug.ts +4 -4
  183. package/src/dotnet/GithubNugetRegistryInfo.ts +68 -0
  184. package/src/dotnet/GitlabNugetRegistryInfo.ts +126 -0
  185. package/src/dotnet/IsNextVersionAlreadyPublished.cli.ts +44 -0
  186. package/src/dotnet/MSBuildProject.ts +702 -76
  187. package/src/dotnet/MSBuildProjectProperties.ts +281 -15
  188. package/src/dotnet/NugetProjectProperties.ts +609 -0
  189. package/src/dotnet/NugetRegistryInfo.ts +1025 -0
  190. package/src/dotnet/helpers.ts +479 -0
  191. package/src/dotnet/index.ts +17 -0
  192. package/src/dotnet.ts +2 -6
  193. package/src/eslintConfig.ts +174 -71
  194. package/src/index.ts +1 -3
  195. package/src/insertPlugins.ts +116 -0
  196. package/src/semantic-release__commit-analyzer.d.ts +44 -38
  197. package/src/semantic-release__exec.d.ts +15 -0
  198. package/src/semantic-release__git.d.ts +85 -88
  199. package/src/semantic-release__github.d.ts +139 -139
  200. package/src/semanticReleaseConfig.ts +111 -47
  201. package/src/semanticReleaseConfigDotnet.ts +397 -104
  202. package/src/setupGitPluginSpec.ts +153 -58
  203. package/src/tsconfig.json +8 -8
  204. package/src/utils/Exact.ts +49 -0
  205. package/src/utils/GracefulRecursion.d.ts +12 -0
  206. package/src/utils/env.ts +44 -0
  207. package/src/utils/execAsync.ts +89 -0
  208. package/src/utils/miscTypes.ts +18 -0
  209. package/src/utils/reflection/FunctionLike.d.ts +17 -0
  210. package/src/utils/reflection/GetterDescriptor.d.ts +8 -0
  211. package/src/utils/reflection/InstancePropertyDescriptorMap.d.ts +32 -0
  212. package/src/utils/reflection/InstanceTypeOrSelfPropertyDescriptorMap.d.ts +20 -0
  213. package/src/utils/reflection/OwnGetterDescriptorMap.d.ts +17 -0
  214. package/src/utils/reflection/OwnKeyOf.d.ts +20 -0
  215. package/src/utils/reflection/OwnPropertyDescriptorMap.d.ts +82 -0
  216. package/src/utils/reflection/PropertyDescriptorMap.d.ts +15 -0
  217. package/src/utils/reflection/filterForGetters.ts +59 -0
  218. package/src/utils/reflection/getOwnPropertyDescriptors.ts +52 -0
  219. package/src/utils/reflection/getOwnPropertyDescriptorsRecursively.ts +127 -0
  220. package/src/utils/reflection/getPrototypeChainOf.ts +85 -0
  221. package/src/utils/reflection/getPrototypeOf.ts +12 -0
  222. package/src/utils/reflection/inheritance.ts +262 -0
  223. package/src/utils/reflection/isConstructor.ts +74 -0
  224. package/src/utils/reflection/isGetterDescriptor.ts +11 -0
  225. package/src/utils/reflection/listOwnGetters.ts +80 -0
  226. package/src/utils/reflection.ts +18 -0
  227. package/cjs/commitlintConfig-wrapper.mjs +0 -6
  228. package/cjs/commitlintConfig.cjs.map +0 -1
  229. package/cjs/commitlintConfig.d.ts +0 -4
  230. package/cjs/commitlintConfig.d.ts.map +0 -1
  231. package/cjs/debug.cjs +0 -13
  232. package/cjs/debug.cjs.map +0 -1
  233. package/cjs/debug.d.ts +0 -4
  234. package/cjs/dotnet/MSBuildProject.cjs +0 -84
  235. package/cjs/dotnet/MSBuildProject.cjs.map +0 -1
  236. package/cjs/dotnet/MSBuildProject.d.ts +0 -42
  237. package/cjs/dotnet/MSBuildProject.d.ts.map +0 -1
  238. package/cjs/dotnet/MSBuildProjectProperties.cjs +0 -22
  239. package/cjs/dotnet/MSBuildProjectProperties.cjs.map +0 -1
  240. package/cjs/dotnet/MSBuildProjectProperties.d.ts +0 -13
  241. package/cjs/dotnet/MSBuildProjectProperties.d.ts.map +0 -1
  242. package/cjs/dotnet/createDummyNupkg.cjs +0 -26
  243. package/cjs/dotnet/createDummyNupkg.cjs.map +0 -1
  244. package/cjs/dotnet/createDummyNupkg.d.ts +0 -2
  245. package/cjs/dotnet/createDummyNupkg.d.ts.map +0 -1
  246. package/cjs/dotnet/dotnetGHPR.cjs +0 -173
  247. package/cjs/dotnet/dotnetGHPR.cjs.map +0 -1
  248. package/cjs/dotnet/dotnetGHPR.d.ts +0 -37
  249. package/cjs/dotnet/dotnetGHPR.d.ts.map +0 -1
  250. package/cjs/dotnet/dotnetGLPR.cjs +0 -41
  251. package/cjs/dotnet/dotnetGLPR.cjs.map +0 -1
  252. package/cjs/dotnet/dotnetGLPR.d.ts +0 -13
  253. package/cjs/dotnet/dotnetGLPR.d.ts.map +0 -1
  254. package/cjs/dotnet/dotnetHelpers.cjs +0 -141
  255. package/cjs/dotnet/dotnetHelpers.cjs.map +0 -1
  256. package/cjs/dotnet/dotnetHelpers.d.ts +0 -26
  257. package/cjs/dotnet/dotnetHelpers.d.ts.map +0 -1
  258. package/cjs/dotnet-wrapper.mjs +0 -6
  259. package/cjs/dotnet.cjs +0 -15
  260. package/cjs/dotnet.cjs.map +0 -1
  261. package/cjs/dotnet.d.ts +0 -7
  262. package/cjs/dotnet.d.ts.map +0 -1
  263. package/cjs/envUtils-wrapper.mjs +0 -6
  264. package/cjs/envUtils.cjs +0 -37
  265. package/cjs/envUtils.cjs.map +0 -1
  266. package/cjs/envUtils.d.ts +0 -15
  267. package/cjs/envUtils.d.ts.map +0 -1
  268. package/cjs/eslintConfig-wrapper.mjs +0 -6
  269. package/cjs/eslintConfig.cjs +0 -52
  270. package/cjs/eslintConfig.cjs.map +0 -1
  271. package/cjs/eslintConfig.d.ts +0 -3
  272. package/cjs/eslintConfig.d.ts.map +0 -1
  273. package/cjs/findStaticConfig-wrapper.mjs +0 -6
  274. package/cjs/findStaticConfig.cjs +0 -34
  275. package/cjs/findStaticConfig.cjs.map +0 -1
  276. package/cjs/findStaticConfig.d.ts +0 -2
  277. package/cjs/findStaticConfig.d.ts.map +0 -1
  278. package/cjs/index-wrapper.mjs +0 -6
  279. package/cjs/index.cjs +0 -10
  280. package/cjs/index.cjs.map +0 -1
  281. package/cjs/index.d.ts +0 -5
  282. package/cjs/index.d.ts.map +0 -1
  283. package/cjs/semantic-release__commit-analyzer.d.cjs +0 -2
  284. package/cjs/semantic-release__commit-analyzer.d.cjs.map +0 -1
  285. package/cjs/semantic-release__git.d.cjs +0 -2
  286. package/cjs/semantic-release__git.d.cjs.map +0 -1
  287. package/cjs/semantic-release__github.d.cjs +0 -2
  288. package/cjs/semantic-release__github.d.cjs.map +0 -1
  289. package/cjs/semanticReleaseConfig-wrapper.mjs +0 -6
  290. package/cjs/semanticReleaseConfig.cjs +0 -33
  291. package/cjs/semanticReleaseConfig.cjs.map +0 -1
  292. package/cjs/semanticReleaseConfig.d.ts +0 -4
  293. package/cjs/semanticReleaseConfig.d.ts.map +0 -1
  294. package/cjs/semanticReleaseConfigDotnet-wrapper.mjs +0 -7
  295. package/cjs/semanticReleaseConfigDotnet.cjs +0 -112
  296. package/cjs/semanticReleaseConfigDotnet.cjs.map +0 -1
  297. package/cjs/semanticReleaseConfigDotnet.d.ts +0 -51
  298. package/cjs/semanticReleaseConfigDotnet.d.ts.map +0 -1
  299. package/cjs/setupGitPluginSpec-wrapper.mjs +0 -6
  300. package/cjs/setupGitPluginSpec.cjs +0 -67
  301. package/cjs/setupGitPluginSpec.cjs.map +0 -1
  302. package/cjs/setupGitPluginSpec.d.ts +0 -19
  303. package/cjs/setupGitPluginSpec.d.ts.map +0 -1
  304. package/src/dotnet/createDummyNupkg.ts +0 -30
  305. package/src/dotnet/dotnetGHPR.ts +0 -232
  306. package/src/dotnet/dotnetGLPR.ts +0 -46
  307. package/src/dotnet/dotnetHelpers.ts +0 -184
  308. package/src/envUtils.ts +0 -36
  309. package/src/findStaticConfig.ts +0 -31
  310. package/static/.releaserc.yml +0 -35
@@ -0,0 +1,82 @@
1
+ import type {
2
+ BaseClass,
3
+ ClassLike,
4
+ ClassLike_Unknown,
5
+ ProtoOrSuperClass,
6
+ WithProto,
7
+ } from './inheritance.ts';
8
+
9
+ // todo: Omit [P in keyof T] where T['__proto__'][P] === T[P].
10
+ // todo: NEVER omit overridden class members! Does TypeScript expose that override in accessible metadata?
11
+
12
+ /**
13
+ * A typed {@link PropertyDescriptorMap} without any keys found in its `[[Prototype]]` chain.
14
+ * This may mean overridden class properties are wrongly omitted.
15
+ * @template T Any type with its `[[Prototype]]` attached via a type-only `__proto__` property. The type of `__proto__` must extends {@link ProtoOrSuperClass}.
16
+ * @since 3.0.0
17
+ */
18
+ export type OwnPropertyDescriptorMap<T extends WithProto<ProtoOrSuperClass>>
19
+ = T['__proto__'] extends null
20
+ ? { [P0 in keyof T]: TypedPropertyDescriptor<T[P0]>; }
21
+ : Omit<
22
+ { [P0 in keyof T]: TypedPropertyDescriptor<T[P0]>; },
23
+ Exclude<
24
+ keyof { [P1 in keyof T['__proto__']]: TypedPropertyDescriptor<T['__proto__'][P1]> },
25
+ keyof ClassLike<BaseClass<ClassLike_Unknown>>
26
+ >
27
+ >;
28
+
29
+ // // todo: use SharedKeys to only keys where SharedKeys<T> in keyof T
30
+ // // eslint-disable-next-line @typescript-eslint/no-unused-vars
31
+ // type SharedKeys<T extends WithProto<ProtoOrSuperClass>> = Extract<keyof T, keyof T['__proto__']>;
32
+
33
+ // // todo: make this useful. The ReturnType is incorrect
34
+ // // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ // declare function removeMatchingPropertyDescriptors<T0, T1>(
36
+ // a: { [P0 in keyof T0]: TypedPropertyDescriptor<T0[P0]> },
37
+ // b: { [P1 in keyof T1]: TypedPropertyDescriptor<T1[P1]> }
38
+ // ): Omit<typeof a, keyof (T0 & T1)>;
39
+
40
+ // /**
41
+ // * @see https://stackoverflow.com/a/56874389/1489478
42
+ // * @example
43
+ // * ```ts
44
+ // * interface MyInterface {
45
+ // * a: number;
46
+ // * b: string;
47
+ // * c: number;
48
+ // * }
49
+ // * type MyType = KeysMatching<MyInterface, number>;
50
+ // * type MyType = "a" | "c";
51
+ // * @todo KeysMatching
52
+ // */
53
+ // // eslint-disable-next-line @typescript-eslint/no-unused-vars
54
+ // type KeysMatching<T extends object, V> = {
55
+ // [K in keyof T]-?: T[K] extends V ? K : never
56
+ // }[keyof T];
57
+
58
+ // /**
59
+ // * @todo KeysNotMatching
60
+ // */
61
+ // // eslint-disable-next-line @typescript-eslint/no-unused-vars
62
+ // type KeysNotMatching<T extends object, V> = {
63
+ // [K in keyof T]-?: T[K] extends V ? never : K
64
+ // }[keyof T];
65
+
66
+ // // type _ = KeysMatching<Class_NPP,Class_MSBPP[keyof Class_MSBPP]>
67
+ // /**
68
+ // * @see https://stackoverflow.com/a/56874389/14894786
69
+ // * @example
70
+ // * interface AnotherInterface {
71
+ // * narrower: 1;
72
+ // * exact: number;
73
+ // * wider: string | number;
74
+ // * }
75
+ // * type AnotherTypeWrite = KeysMatchingWrite<AnotherInterface, number>;
76
+ // * type AnotherTypeWrite = 'exact' | 'wider';
77
+ // * @todo KeysMatchingWrite
78
+ // */
79
+ // // eslint-disable-next-line @typescript-eslint/no-unused-vars
80
+ // type KeysMatchingWrite<T extends object, V> = {
81
+ // [K in keyof T]-?: [V] extends [T[K]] ? K : never
82
+ // }[keyof T];
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A variant of TypeScript's ES5 PropertyDescriptorMap with an extra generic
3
+ * parameter for omitting inherited keys.
4
+ * @template T The type described by the {@link PropertyDescriptorMap}.
5
+ * @template [__proto__=null]
6
+ * The `null` or the `object`-like `[[Prototype]]` of {@link T}.
7
+ * @since 3.0.0
8
+ */
9
+ export type PropertyDescriptorMap<T, __proto__ extends object | null = null>
10
+ = __proto__ extends null
11
+ ? { [P0 in keyof T]: TypedPropertyDescriptor<T[P0]>; }
12
+ : Omit<
13
+ { [P0 in keyof T]: TypedPropertyDescriptor<T[P0]>; },
14
+ keyof { [P1 in keyof __proto__]: TypedPropertyDescriptor<__proto__[P1]> }
15
+ >;
@@ -0,0 +1,59 @@
1
+ import type {
2
+ BaseClassProto,
3
+ baseClassProto,
4
+ ClassLike,
5
+ ConstructorConstraint,
6
+ InstanceTypeOrSelf,
7
+ SuperClassLike,
8
+ WithProto,
9
+ } from './inheritance.js';
10
+ import type { InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.js';
11
+ import type { OwnGetterDescriptorMap } from './OwnGetterDescriptorMap.js';
12
+ import type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.js';
13
+ import type { PropertyDescriptorMap } from './PropertyDescriptorMap.js';
14
+
15
+ export function filterForGetters<
16
+ Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | typeof baseClassProto>>,
17
+ >(
18
+ descriptorMap: InstancePropertyDescriptorMap<Class>,
19
+ ): Partial<OwnGetterDescriptorMap<
20
+ InstanceType<Class>,
21
+ Class['__proto__'] extends BaseClassProto ? null : InstanceTypeOrSelf<Class['__proto__']>
22
+ >>;
23
+ export function filterForGetters<
24
+ Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,
25
+ >(
26
+ descriptorMap: OwnPropertyDescriptorMap<Class>,
27
+ ): Partial<OwnGetterDescriptorMap<Class, Class['__proto__']>>;
28
+ /**
29
+ * Iterates through the descriptors object, checking for property descriptors whose `get` is a function.
30
+ * Returns an {@link OwnGetterDescriptorMap} of the getters.
31
+ * If you want only own, non-inherited getters, you must filter sanitize the
32
+ * type the `descriptors` parameter yourself e.g. `Omit<Class, keyof
33
+ * SuperClass>`.
34
+ * @param descriptorMap An object like the return value of Object.getOwnPropertyDescriptors
35
+ * @template Class Any ClassLike type
36
+ * @template T Any `object`-like type.
37
+ * @template [__proto__=null] If {@link Class} is not {@link ClassLike}, the `__proto__` of {@link T}.
38
+ * @returns An {@link OwnGetterDescriptorMap}.
39
+ * @since 3.0.0
40
+ */
41
+ export function filterForGetters<
42
+ T extends object,
43
+ __proto__ extends object | null = null,
44
+ >(
45
+ descriptorMap: PropertyDescriptorMap<T, __proto__> | PropertyDescriptorMap<T>,
46
+ ): Partial<OwnGetterDescriptorMap<T, __proto__>> {
47
+ let getterDescriptorMap: Partial<OwnGetterDescriptorMap<T, __proto__>> = {};
48
+ for (const key in descriptorMap) {
49
+ const element = descriptorMap[key as keyof typeof descriptorMap];
50
+ if (typeof element.get === 'function') {
51
+ getterDescriptorMap = Object.assign(
52
+ getterDescriptorMap,
53
+ { [key]: element },
54
+ );
55
+ }
56
+ }
57
+
58
+ return getterDescriptorMap;
59
+ }
@@ -0,0 +1,52 @@
1
+ import type { InstanceOrStatic } from '../miscTypes.js';
2
+ import type { BaseClassProto, ClassLike, ConstructorConstraint, SuperClassLike, WithProto } from './inheritance.js';
3
+ import type { InstancePropertyDescriptorMap } from './InstancePropertyDescriptorMap.js';
4
+ import type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.js';
5
+
6
+ /**
7
+ * Get the property descriptors of the class or constructor similar to {@link Object.getOwnPropertyDescriptors}, but with more options--including recursion.
8
+ * @template {InstanceOrStatic} _InstanceOrStatic 'Instance' or 'Static'. Determines the return type.
9
+ * @param classDefinition A class or constructor, cast to {@link ClassLike}.
10
+ * @param instanceOrStatic 'Instance' or 'Static'. Determines the return type.
11
+ * @template {ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>} Class
12
+ * The typeof {@link classDefinition}.
13
+ * {@link WithProto}<{@link SuperClassLike}> is necessary for walking the
14
+ * prototype chain for both Instance and Static properties.
15
+ * If unspecified, the return type may be incorrect.
16
+ * @returns ({@link instanceOrStatic} === 'Instance') ? {@link InstancePropertyDescriptorMap<Class>}\
17
+ * : ({@link instanceOrStatic} === 'Static') ? {@link OwnPropertyDescriptorMap<Class>}\
18
+ * : never
19
+ * @throws {TypeError}
20
+ * @since 3.0.0
21
+ */
22
+ export function getOwnPropertyDescriptors<
23
+ Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,
24
+ _InstanceOrStatic extends InstanceOrStatic,
25
+ >(
26
+ classDefinition: Class,
27
+ instanceOrStatic: _InstanceOrStatic,
28
+ ): [_InstanceOrStatic] extends ['Instance']
29
+ ? InstancePropertyDescriptorMap<Class>
30
+ : [_InstanceOrStatic] extends ['Static']
31
+ ? OwnPropertyDescriptorMap<Class>
32
+ : never {
33
+ switch (instanceOrStatic) {
34
+ case 'Instance': {
35
+ return Object.getOwnPropertyDescriptors(classDefinition.prototype) as [Extract<typeof instanceOrStatic, 'Instance'>] extends ['Instance']
36
+ ? InstancePropertyDescriptorMap<Class>
37
+ : [_InstanceOrStatic] extends ['Static']
38
+ ? OwnPropertyDescriptorMap<Class>
39
+ : never;
40
+ }
41
+ case 'Static': {
42
+ return Object.getOwnPropertyDescriptors(classDefinition) as [Extract<typeof instanceOrStatic, 'Static'>] extends ['Instance']
43
+ ? InstancePropertyDescriptorMap<Class>
44
+ : [_InstanceOrStatic] extends ['Static']
45
+ ? OwnPropertyDescriptorMap<Class>
46
+ : never;
47
+ }
48
+ default: {
49
+ throw new TypeError('Argument `instanceOrStatic` must be "Instance" or "Static".');
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,127 @@
1
+ import type { Increment } from '../GracefulRecursion.js';
2
+ import type { InstanceOrStatic, Integer } from '../miscTypes.js';
3
+ import { getOwnPropertyDescriptors } from './getOwnPropertyDescriptors.js';
4
+ import { getPrototypesChainOf } from './getPrototypeChainOf.js';
5
+ import type {
6
+ BaseClass,
7
+ BaseClassProto,
8
+ ClassLike,
9
+ ConstructorConstraint,
10
+ ConstructorLike,
11
+ ProtoChainOfClass,
12
+ SuperClassLike,
13
+ WithProto,
14
+ } from './inheritance.js';
15
+ import type { InstanceTypeOrSelfPropertyDescriptorMap } from './InstanceTypeOrSelfPropertyDescriptorMap.js';
16
+ import type { OwnPropertyDescriptorMap } from './OwnPropertyDescriptorMap.js';
17
+ /* eslint-disable jsdoc/check-tag-names */
18
+ /**
19
+ * JSDoc type imports
20
+ * @typedef {import('./getPrototypeOf.js').getPrototypeOf} getPrototypeOf
21
+ * @typedef {import('./listOwnGetters.js').listOwnGetters} listOwnGetters
22
+ * @typedef {import('./InstancePropertyDescriptorMap.js').InstancePropertyDescriptorMap} InstancePropertyDescriptorMap
23
+ */
24
+ /* eslint-enable jsdoc/check-tag-names */
25
+
26
+ /**
27
+ * A conditional wrapper for {@link InstanceTypeOrSelfPropertyDescriptorMap} and
28
+ * {@link OwnPropertyDescriptorMap}.
29
+ *
30
+ * If {@link _InstanceOrStatic} is 'Instance', {@link InstanceTypeOrSelfPropertyDescriptorMap}.\
31
+ * Else if {@link _InstanceOrStatic} is 'Static',
32
+ * {@link OwnPropertyDescriptorMap }.\
33
+ * Else, `never`.
34
+ * @template {ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>} Class
35
+ * A class definition cast to {@link ClassLike}.
36
+ * @template {InstanceOrStatic} _InstanceOrStatic
37
+ * 'Instance' or 'Static'. Determines the return type.
38
+ * @since 3.0.0
39
+ */
40
+ export type RecursedPropertyDescriptorMap<
41
+ Class extends ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>,
42
+ _InstanceOrStatic extends InstanceOrStatic,
43
+ > = [_InstanceOrStatic] extends ['Instance'] ? InstanceTypeOrSelfPropertyDescriptorMap<Class, Class['__proto__']>
44
+ : [_InstanceOrStatic] extends ['Static'] ? OwnPropertyDescriptorMap<Class>
45
+ : never;
46
+
47
+ /**
48
+ * An
49
+ * ordered array of {@link OwnPropertyDescriptorMap} or
50
+ * {@link InstancePropertyDescriptorMap} starting with {@link classDefinition}
51
+ * and ending with a {@link BaseClass}.
52
+ * @template {ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>} Class
53
+ * @template {'Instance' | 'Static'} InstanceOrStatic
54
+ * @template {Integer<number>} [Limit=16]
55
+ * @template {Integer<number>} [CurrentLevel=0]
56
+ */
57
+ export type RecursedPropertyDescriptorMapArray<
58
+ Class extends ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>,
59
+ InstanceOrStatic extends 'Instance' | 'Static',
60
+ Limit extends Integer<number> = 16,
61
+ CurrentLevel extends Integer<number> = 0,
62
+ > = Class['__proto__'] extends BaseClassProto['__proto__'] | BaseClassProto['__proto__']['__proto__'] ? never
63
+ : Class['__proto__'] extends BaseClassProto ? [RecursedPropertyDescriptorMap<BaseClass<Class>, InstanceOrStatic>]
64
+ : Class['__proto__'] extends ConstructorLike<Class['__proto__']>
65
+ ? [
66
+ RecursedPropertyDescriptorMap<Class, InstanceOrStatic>,
67
+ ...RecursedPropertyDescriptorMapArray<
68
+ ClassLike<Exclude<Class['__proto__'], BaseClassProto> & WithProto<SuperClassLike | BaseClassProto>>,
69
+ InstanceOrStatic,
70
+ Limit,
71
+ Increment<CurrentLevel>
72
+ >,
73
+ ]
74
+ : never;
75
+ /**
76
+ * Walks the class inheritance chain to get a PropertyDescriptorMap of each class.
77
+ *
78
+ * While you _can_ use this to get an array of getter names/keys, you should use {@link getPrototypeOf} and {@link listOwnGetters}, instead!
79
+ * @template Class Any class definition type-cast to {@link ClassLike}
80
+ * @template _InstanceOrStatic
81
+ * @param classDefinition Any class definition type-cast to {@link ClassLike}
82
+ * @param instanceOrStatic 'Instance' or 'Static'. Determines the return type.
83
+ * @returns An
84
+ * ordered array of {@link OwnPropertyDescriptorMap} or
85
+ * {@link InstancePropertyDescriptorMap} starting with {@link classDefinition}
86
+ * and ending with a {@link BaseClass}.
87
+ * @since 3.0.0
88
+ */
89
+ export function getOwnPropertyDescriptorsRecursively<
90
+ // Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,
91
+ Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,
92
+ _InstanceOrStatic extends InstanceOrStatic,
93
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters
94
+ Limit extends Integer<number> = 16,
95
+ >(
96
+ classDefinition: Class,
97
+ instanceOrStatic: _InstanceOrStatic,
98
+ ): RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic> {
99
+ const staticProtoChain: ProtoChainOfClass<Class> = getPrototypesChainOf(classDefinition, 'classes');
100
+ if (isSingleTuple(staticProtoChain)) {
101
+ return [
102
+ getOwnPropertyDescriptors(
103
+ staticProtoChain[0],
104
+ instanceOrStatic,
105
+ ) as RecursedPropertyDescriptorMap<Class, _InstanceOrStatic>,
106
+ ] as unknown as RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic, Limit>;
107
+ }
108
+
109
+ const recursedPropertyDescriptorMapArray = staticProtoChain.map(classDefinition =>
110
+ getOwnPropertyDescriptors(
111
+ classDefinition,
112
+ instanceOrStatic,
113
+ ),
114
+ );
115
+
116
+ return recursedPropertyDescriptorMapArray as RecursedPropertyDescriptorMapArray<Class, _InstanceOrStatic>;
117
+ }
118
+
119
+ /**
120
+ * Simple utility for single-tuple type assertion
121
+ * @template {T} T T in T[]
122
+ * @param array an array
123
+ * @returns array is [T]
124
+ */
125
+ function isSingleTuple<T>(array: T[]): array is [T] {
126
+ return Array.isArray(array) && array.length === 1;
127
+ }
@@ -0,0 +1,85 @@
1
+ /* eslint-disable jsdoc/no-defaults */
2
+ import type { TupleIndices } from '../miscTypes.js';
3
+ import { getPrototypeOf } from './getPrototypeOf.js';
4
+ import {
5
+ baseClassProto,
6
+ type BaseClassProto,
7
+ type ClassLike,
8
+ type ConstructorConstraint,
9
+ type ProtoChainOfClass,
10
+ type ProtoChainOfClassInstance,
11
+ type SuperClassLike,
12
+ type WithProto,
13
+ } from './inheritance.js';
14
+ import { isConstructor } from './isConstructor.js';
15
+
16
+ type ProtoChain<
17
+ Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,
18
+ ClassesOrInstances extends 'classes' | 'classInstances',
19
+ > = [ClassesOrInstances] extends ['classInstances'] ? ProtoChainOfClassInstance<Class>
20
+ : [ClassesOrInstances] extends ['classes'] ? ProtoChainOfClass<Class>
21
+ : never;
22
+
23
+ /**
24
+ * Iterate through the class and its base/super classes until an anonymous function is reached. This is the default superclass all classes extend.
25
+ * @template Class Any {@link ClassLike} type.
26
+ * @template ClassesOrInstances 'classes' or 'classInstances'
27
+ * @param classDefinition Any class type satisfying {@link Class}. This class (or its instance type) is included in the return value.
28
+ * @param [returnType='classes'] Determines return type. If 'classInstances', the return type is an array of the classes' `.prototype`. Else, the classes themselves are returned.
29
+ * @since 3.0.0
30
+ * @returns
31
+ * `returnType extends 'classInstances' ? ClassLike<T>[] : ClassLike<T>[].map(c => c.prototype)`
32
+ * Excludes default superclasses e.g. anonymous functions, native code.
33
+ */
34
+ export function getPrototypesChainOf<
35
+ Class extends ClassLike<ConstructorConstraint<Class> & WithProto<SuperClassLike | BaseClassProto>>,
36
+ ClassesOrInstances extends 'classes' | 'classInstances',
37
+ >(
38
+ classDefinition: Class,
39
+ returnType: ClassesOrInstances,
40
+ ): ProtoChain<Class, ClassesOrInstances> {
41
+ // class definitions or their respective .prototype; exclude default superclasses.
42
+ let current: ProtoChainOfClass<Class>[TupleIndices<ProtoChainOfClass<Class>>] = classDefinition as ProtoChainOfClass<Class>[0 extends TupleIndices<ProtoChainOfClass<Class>> ? 0 : never];
43
+ let parent: typeof current & WithProto<SuperClassLike | BaseClassProto> | object;
44
+ const returnValue = [] as unknown as
45
+ ProtoChain<Class, ClassesOrInstances>;
46
+ let index: TupleIndices<typeof returnValue> = 0 as TupleIndices<typeof returnValue>;
47
+
48
+ while (baseClassProto !== current) {
49
+ parent = getPrototypeOf<typeof current>(current);
50
+ // current is a Class symbol/constructor. Object.getOwnPropertyDescriptors on current will include static properties.
51
+ if (!isConstructor(current))
52
+ break;
53
+ if (returnType === 'classInstances') {
54
+ const instanceOfCurrent = current.prototype as InstanceType<typeof current>;
55
+
56
+ returnValue[index] = instanceOfCurrent as typeof returnValue[typeof index];
57
+ }
58
+ else {
59
+ returnValue[index] = current as typeof returnValue[typeof index];
60
+ }
61
+
62
+ /**
63
+ * Assign the super class to current.
64
+ * If the argument is a class, Reflect.getPrototypeOf method returns the
65
+ * superclass.
66
+ */
67
+ if (
68
+ isConstructor(parent)
69
+ && 'name' in parent
70
+ && typeof parent.name === 'string'
71
+ && '' !== parent.name // it's possible for a Function/Constructor to be anonymous...
72
+ ) {
73
+ current = parent as ProtoChainOfClass<Class>[TupleIndices<ProtoChainOfClass<Class>>];
74
+ }
75
+ else {
76
+ break;
77
+ }
78
+ index++;
79
+ }
80
+ return returnValue;
81
+ /*
82
+ assuming current is NugetProjectProperties...
83
+ Reflect.getPrototypeOf(current).name is 'MSBuildProjectProperties'
84
+ */
85
+ }
@@ -0,0 +1,12 @@
1
+ import type { ProtoOrSuperClass, WithProto } from './inheritance.js';
2
+
3
+ /**
4
+ * A nearly useless wrapper for {@link Reflect.getPrototypeOf}
5
+ * @param object An object with the internal `__proto__` property present in its type.
6
+ * @returns The `__proto__` of the `object` param.
7
+ */
8
+ export function getPrototypeOf<
9
+ T extends WithProto<ProtoOrSuperClass>,
10
+ >(object: T): T['__proto__'] {
11
+ return Reflect.getPrototypeOf(object) as T['__proto__'];
12
+ }