repluggable-core 1.302.66 → 1.302.67

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 (303) hide show
  1. package/__tests__/spec-setup.js +3 -0
  2. package/dist/es/{API.d.ts → src/API.d.ts} +46 -8
  3. package/dist/es/src/API.d.ts.map +1 -0
  4. package/dist/es/src/API.js +3 -0
  5. package/dist/es/src/API.js.map +1 -0
  6. package/dist/es/src/IterableWeakMap.d.ts +20 -0
  7. package/dist/es/src/IterableWeakMap.d.ts.map +1 -0
  8. package/dist/es/src/IterableWeakMap.js +92 -0
  9. package/dist/es/src/IterableWeakMap.js.map +1 -0
  10. package/dist/es/src/__internal.d.ts.map +1 -0
  11. package/dist/es/src/__internal.js +5 -0
  12. package/dist/es/src/__internal.js.map +1 -0
  13. package/dist/es/src/appHost.d.ts +7 -0
  14. package/dist/es/src/appHost.d.ts.map +1 -0
  15. package/dist/es/src/appHost.js +898 -0
  16. package/dist/es/src/appHost.js.map +1 -0
  17. package/dist/es/src/appHostServices.d.ts +12 -0
  18. package/dist/es/src/appHostServices.d.ts.map +1 -0
  19. package/dist/es/src/appHostServices.js +25 -0
  20. package/dist/es/src/appHostServices.js.map +1 -0
  21. package/dist/es/src/appHostUtils.d.ts +4 -0
  22. package/dist/es/src/appHostUtils.d.ts.map +1 -0
  23. package/dist/es/src/appHostUtils.js +8 -0
  24. package/dist/es/src/appHostUtils.js.map +1 -0
  25. package/dist/es/src/extensionSlot.d.ts +8 -0
  26. package/dist/es/src/extensionSlot.d.ts.map +1 -0
  27. package/dist/es/src/extensionSlot.js +59 -0
  28. package/dist/es/src/extensionSlot.js.map +1 -0
  29. package/dist/es/src/hot.d.ts +14 -0
  30. package/dist/es/src/hot.d.ts.map +1 -0
  31. package/dist/es/src/hot.js +52 -0
  32. package/dist/es/src/hot.js.map +1 -0
  33. package/dist/es/src/index.d.ts +11 -0
  34. package/dist/es/src/index.d.ts.map +1 -0
  35. package/dist/es/src/index.js +10 -0
  36. package/dist/es/src/index.js.map +1 -0
  37. package/dist/es/src/installedShellsState.d.ts +19 -0
  38. package/dist/es/src/installedShellsState.d.ts.map +1 -0
  39. package/dist/es/src/installedShellsState.js +30 -0
  40. package/dist/es/src/installedShellsState.js.map +1 -0
  41. package/dist/es/src/interceptAnyObject.d.ts +7 -0
  42. package/dist/es/src/interceptAnyObject.d.ts.map +1 -0
  43. package/dist/es/src/interceptAnyObject.js +21 -0
  44. package/dist/es/src/interceptAnyObject.js.map +1 -0
  45. package/dist/es/src/invokeSlotCallbacks.d.ts +3 -0
  46. package/dist/es/src/invokeSlotCallbacks.d.ts.map +1 -0
  47. package/dist/es/src/invokeSlotCallbacks.js +20 -0
  48. package/dist/es/src/invokeSlotCallbacks.js.map +1 -0
  49. package/dist/es/src/loggers.d.ts +4 -0
  50. package/dist/es/src/loggers.d.ts.map +1 -0
  51. package/dist/es/src/loggers.js +100 -0
  52. package/dist/es/src/loggers.js.map +1 -0
  53. package/dist/es/src/monitorAPI.d.ts +3 -0
  54. package/dist/es/src/monitorAPI.d.ts.map +1 -0
  55. package/dist/es/src/monitorAPI.js +53 -0
  56. package/dist/es/src/monitorAPI.js.map +1 -0
  57. package/dist/es/src/repluggableAppDebug/index.d.ts +2 -0
  58. package/dist/es/src/repluggableAppDebug/index.d.ts.map +1 -0
  59. package/dist/es/src/repluggableAppDebug/index.js +2 -0
  60. package/dist/es/src/repluggableAppDebug/index.js.map +1 -0
  61. package/dist/es/src/repluggableAppDebug/performanceDebugInfo.d.ts +15 -0
  62. package/dist/es/src/repluggableAppDebug/performanceDebugInfo.d.ts.map +1 -0
  63. package/dist/es/src/repluggableAppDebug/performanceDebugInfo.js +94 -0
  64. package/dist/es/src/repluggableAppDebug/performanceDebugInfo.js.map +1 -0
  65. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.d.ts +24 -0
  66. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.d.ts.map +1 -0
  67. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.js +132 -0
  68. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.js.map +1 -0
  69. package/dist/es/src/tarjanGraph.d.ts +27 -0
  70. package/dist/es/src/tarjanGraph.d.ts.map +1 -0
  71. package/dist/es/src/tarjanGraph.js +94 -0
  72. package/dist/es/src/tarjanGraph.js.map +1 -0
  73. package/dist/es/src/throttledStore.d.ts +32 -0
  74. package/dist/es/src/throttledStore.d.ts.map +1 -0
  75. package/dist/es/src/throttledStore.js +240 -0
  76. package/dist/es/src/throttledStore.js.map +1 -0
  77. package/dist/es/test/IterableWeakMap.spec.d.ts +2 -0
  78. package/dist/es/test/IterableWeakMap.spec.d.ts.map +1 -0
  79. package/dist/es/test/IterableWeakMap.spec.js +218 -0
  80. package/dist/es/test/IterableWeakMap.spec.js.map +1 -0
  81. package/dist/es/test/appHost.mock.d.ts +4 -0
  82. package/dist/es/test/appHost.mock.d.ts.map +1 -0
  83. package/dist/es/test/appHost.mock.js +54 -0
  84. package/dist/es/test/appHost.mock.js.map +1 -0
  85. package/dist/es/test/appHost.spec.d.ts +2 -0
  86. package/dist/es/test/appHost.spec.d.ts.map +1 -0
  87. package/dist/es/test/appHost.spec.js +1451 -0
  88. package/dist/es/test/appHost.spec.js.map +1 -0
  89. package/dist/es/test/installedShellsState.spec.d.ts +2 -0
  90. package/dist/es/test/installedShellsState.spec.d.ts.map +1 -0
  91. package/dist/es/test/installedShellsState.spec.js +28 -0
  92. package/dist/es/test/installedShellsState.spec.js.map +1 -0
  93. package/dist/es/test/interceptAnyObject.spec.d.ts +2 -0
  94. package/dist/es/test/interceptAnyObject.spec.d.ts.map +1 -0
  95. package/dist/es/test/interceptAnyObject.spec.js +166 -0
  96. package/dist/es/test/interceptAnyObject.spec.js.map +1 -0
  97. package/dist/es/test/loggers.spec.d.ts +2 -0
  98. package/dist/es/test/loggers.spec.d.ts.map +1 -0
  99. package/dist/es/test/loggers.spec.js +218 -0
  100. package/dist/es/test/loggers.spec.js.map +1 -0
  101. package/dist/es/test/repluggableAppDebug.spec.d.ts +2 -0
  102. package/dist/es/test/repluggableAppDebug.spec.d.ts.map +1 -0
  103. package/dist/es/test/repluggableAppDebug.spec.js +107 -0
  104. package/dist/es/test/repluggableAppDebug.spec.js.map +1 -0
  105. package/dist/es/test/testKit.spec.d.ts +2 -0
  106. package/dist/es/test/testKit.spec.d.ts.map +1 -0
  107. package/dist/es/test/testKit.spec.js +129 -0
  108. package/dist/es/test/testKit.spec.js.map +1 -0
  109. package/dist/es/testKit/emptyLoggerOptions.d.ts +3 -0
  110. package/dist/es/testKit/emptyLoggerOptions.d.ts.map +1 -0
  111. package/dist/es/testKit/emptyLoggerOptions.js +15 -0
  112. package/dist/es/testKit/emptyLoggerOptions.js.map +1 -0
  113. package/dist/es/testKit/index.d.ts +27 -0
  114. package/dist/es/testKit/index.d.ts.map +1 -0
  115. package/dist/es/testKit/index.js +132 -0
  116. package/dist/es/testKit/index.js.map +1 -0
  117. package/dist/es/testKit/mockPackage.d.ts +23 -0
  118. package/dist/es/testKit/mockPackage.d.ts.map +1 -0
  119. package/dist/es/testKit/mockPackage.js +95 -0
  120. package/dist/es/testKit/mockPackage.js.map +1 -0
  121. package/dist/es/testKit/withConsoleErrors.d.ts +2 -0
  122. package/dist/es/testKit/withConsoleErrors.d.ts.map +1 -0
  123. package/dist/es/testKit/withConsoleErrors.js +12 -0
  124. package/dist/es/testKit/withConsoleErrors.js.map +1 -0
  125. package/dist/es/testKit/withThrowOnError.d.ts +3 -0
  126. package/dist/es/testKit/withThrowOnError.d.ts.map +1 -0
  127. package/dist/es/testKit/withThrowOnError.js +27 -0
  128. package/dist/es/testKit/withThrowOnError.js.map +1 -0
  129. package/dist/src/API.d.ts +46 -8
  130. package/dist/src/API.d.ts.map +1 -1
  131. package/dist/src/API.js +4 -0
  132. package/dist/src/API.js.map +1 -1
  133. package/dist/src/IterableWeakMap.d.ts +20 -0
  134. package/dist/src/IterableWeakMap.d.ts.map +1 -0
  135. package/dist/src/IterableWeakMap.js +96 -0
  136. package/dist/src/IterableWeakMap.js.map +1 -0
  137. package/dist/src/__internal.d.ts.map +1 -1
  138. package/dist/src/__internal.js +1 -1
  139. package/dist/src/__internal.js.map +1 -1
  140. package/dist/src/appHost.d.ts +7 -0
  141. package/dist/src/appHost.d.ts.map +1 -0
  142. package/dist/src/appHost.js +906 -0
  143. package/dist/src/appHost.js.map +1 -0
  144. package/dist/src/appHostServices.d.ts +12 -0
  145. package/dist/src/appHostServices.d.ts.map +1 -0
  146. package/dist/src/appHostServices.js +29 -0
  147. package/dist/src/appHostServices.js.map +1 -0
  148. package/dist/src/appHostUtils.d.ts +4 -0
  149. package/dist/src/appHostUtils.d.ts.map +1 -0
  150. package/dist/src/appHostUtils.js +16 -0
  151. package/dist/src/appHostUtils.js.map +1 -0
  152. package/dist/src/extensionSlot.d.ts +8 -0
  153. package/dist/src/extensionSlot.d.ts.map +1 -0
  154. package/dist/src/extensionSlot.js +67 -0
  155. package/dist/src/extensionSlot.js.map +1 -0
  156. package/dist/src/hot.d.ts +14 -0
  157. package/dist/src/hot.d.ts.map +1 -0
  158. package/dist/src/hot.js +56 -0
  159. package/dist/src/hot.js.map +1 -0
  160. package/dist/src/index.d.ts +10 -2
  161. package/dist/src/index.d.ts.map +1 -1
  162. package/dist/src/index.js +22 -15
  163. package/dist/src/index.js.map +1 -1
  164. package/dist/src/installedShellsState.d.ts +19 -0
  165. package/dist/src/installedShellsState.d.ts.map +1 -0
  166. package/dist/src/installedShellsState.js +38 -0
  167. package/dist/src/installedShellsState.js.map +1 -0
  168. package/dist/src/interceptAnyObject.d.ts +7 -0
  169. package/dist/src/interceptAnyObject.d.ts.map +1 -0
  170. package/dist/src/interceptAnyObject.js +28 -0
  171. package/dist/src/interceptAnyObject.js.map +1 -0
  172. package/dist/src/invokeSlotCallbacks.d.ts +3 -0
  173. package/dist/src/invokeSlotCallbacks.d.ts.map +1 -0
  174. package/dist/src/invokeSlotCallbacks.js +24 -0
  175. package/dist/src/invokeSlotCallbacks.js.map +1 -0
  176. package/dist/src/loggers.d.ts +4 -0
  177. package/dist/src/loggers.d.ts.map +1 -0
  178. package/dist/src/loggers.js +104 -0
  179. package/dist/src/loggers.js.map +1 -0
  180. package/dist/src/monitorAPI.d.ts +3 -0
  181. package/dist/src/monitorAPI.d.ts.map +1 -0
  182. package/dist/src/monitorAPI.js +57 -0
  183. package/dist/src/monitorAPI.js.map +1 -0
  184. package/dist/src/repluggableAppDebug/index.d.ts +2 -0
  185. package/dist/src/repluggableAppDebug/index.d.ts.map +1 -0
  186. package/dist/src/repluggableAppDebug/index.js +6 -0
  187. package/dist/src/repluggableAppDebug/index.js.map +1 -0
  188. package/dist/src/repluggableAppDebug/performanceDebugInfo.d.ts +15 -0
  189. package/dist/src/repluggableAppDebug/performanceDebugInfo.d.ts.map +1 -0
  190. package/dist/src/repluggableAppDebug/performanceDebugInfo.js +101 -0
  191. package/dist/src/repluggableAppDebug/performanceDebugInfo.js.map +1 -0
  192. package/dist/src/repluggableAppDebug/repluggableAppDebug.d.ts +24 -0
  193. package/dist/src/repluggableAppDebug/repluggableAppDebug.d.ts.map +1 -0
  194. package/dist/src/repluggableAppDebug/repluggableAppDebug.js +139 -0
  195. package/dist/src/repluggableAppDebug/repluggableAppDebug.js.map +1 -0
  196. package/dist/src/tarjanGraph.d.ts +27 -0
  197. package/dist/src/tarjanGraph.d.ts.map +1 -0
  198. package/dist/src/tarjanGraph.js +100 -0
  199. package/dist/src/tarjanGraph.js.map +1 -0
  200. package/dist/src/throttledStore.d.ts +32 -0
  201. package/dist/src/throttledStore.d.ts.map +1 -0
  202. package/dist/src/throttledStore.js +249 -0
  203. package/dist/src/throttledStore.js.map +1 -0
  204. package/dist/test/IterableWeakMap.spec.d.ts +2 -0
  205. package/dist/test/IterableWeakMap.spec.d.ts.map +1 -0
  206. package/dist/test/IterableWeakMap.spec.js +220 -0
  207. package/dist/test/IterableWeakMap.spec.js.map +1 -0
  208. package/dist/test/appHost.mock.d.ts +4 -0
  209. package/dist/test/appHost.mock.d.ts.map +1 -0
  210. package/dist/test/appHost.mock.js +59 -0
  211. package/dist/test/appHost.mock.js.map +1 -0
  212. package/dist/test/appHost.spec.d.ts +2 -0
  213. package/dist/test/appHost.spec.d.ts.map +1 -0
  214. package/dist/test/appHost.spec.js +1456 -0
  215. package/dist/test/appHost.spec.js.map +1 -0
  216. package/dist/test/installedShellsState.spec.d.ts +2 -0
  217. package/dist/test/installedShellsState.spec.d.ts.map +1 -0
  218. package/dist/test/installedShellsState.spec.js +30 -0
  219. package/dist/test/installedShellsState.spec.js.map +1 -0
  220. package/dist/test/interceptAnyObject.spec.d.ts +2 -0
  221. package/dist/test/interceptAnyObject.spec.d.ts.map +1 -0
  222. package/dist/test/interceptAnyObject.spec.js +171 -0
  223. package/dist/test/interceptAnyObject.spec.js.map +1 -0
  224. package/dist/test/loggers.spec.d.ts +2 -0
  225. package/dist/test/loggers.spec.d.ts.map +1 -0
  226. package/dist/test/loggers.spec.js +220 -0
  227. package/dist/test/loggers.spec.js.map +1 -0
  228. package/dist/test/repluggableAppDebug.spec.d.ts +2 -0
  229. package/dist/test/repluggableAppDebug.spec.d.ts.map +1 -0
  230. package/dist/test/repluggableAppDebug.spec.js +109 -0
  231. package/dist/test/repluggableAppDebug.spec.js.map +1 -0
  232. package/dist/test/testKit.spec.d.ts +2 -0
  233. package/dist/test/testKit.spec.d.ts.map +1 -0
  234. package/dist/test/testKit.spec.js +134 -0
  235. package/dist/test/testKit.spec.js.map +1 -0
  236. package/dist/testKit/emptyLoggerOptions.d.ts +3 -0
  237. package/dist/testKit/emptyLoggerOptions.d.ts.map +1 -0
  238. package/dist/testKit/emptyLoggerOptions.js +18 -0
  239. package/dist/testKit/emptyLoggerOptions.js.map +1 -0
  240. package/dist/testKit/index.d.ts +27 -0
  241. package/dist/testKit/index.d.ts.map +1 -0
  242. package/dist/testKit/index.js +160 -0
  243. package/dist/testKit/index.js.map +1 -0
  244. package/dist/testKit/mockPackage.d.ts +23 -0
  245. package/dist/testKit/mockPackage.d.ts.map +1 -0
  246. package/dist/testKit/mockPackage.js +101 -0
  247. package/dist/testKit/mockPackage.js.map +1 -0
  248. package/dist/testKit/withConsoleErrors.d.ts +2 -0
  249. package/dist/testKit/withConsoleErrors.d.ts.map +1 -0
  250. package/dist/testKit/withConsoleErrors.js +16 -0
  251. package/dist/testKit/withConsoleErrors.js.map +1 -0
  252. package/dist/testKit/withThrowOnError.d.ts +3 -0
  253. package/dist/testKit/withThrowOnError.d.ts.map +1 -0
  254. package/dist/testKit/withThrowOnError.js +31 -0
  255. package/dist/testKit/withThrowOnError.js.map +1 -0
  256. package/jest.config.js +16 -0
  257. package/package.json +21 -3
  258. package/src/API.ts +47 -9
  259. package/src/IterableWeakMap.ts +123 -0
  260. package/src/__internal.ts +1 -1
  261. package/src/appHost.ts +1222 -0
  262. package/src/appHostServices.ts +42 -0
  263. package/src/appHostUtils.ts +11 -0
  264. package/src/extensionSlot.ts +96 -0
  265. package/src/hot.ts +53 -0
  266. package/src/index.ts +42 -2
  267. package/src/installedShellsState.ts +54 -0
  268. package/src/interceptAnyObject.ts +39 -0
  269. package/src/invokeSlotCallbacks.ts +20 -0
  270. package/src/loggers.ts +112 -0
  271. package/src/monitorAPI.ts +71 -0
  272. package/src/repluggableAppDebug/debug.d.ts +37 -0
  273. package/src/repluggableAppDebug/index.ts +1 -0
  274. package/src/repluggableAppDebug/performanceDebugInfo.ts +96 -0
  275. package/src/repluggableAppDebug/repluggableAppDebug.ts +192 -0
  276. package/src/tarjanGraph.ts +96 -0
  277. package/src/throttledStore.ts +355 -0
  278. package/test/IterableWeakMap.spec.ts +280 -0
  279. package/test/appHost.mock.ts +58 -0
  280. package/test/appHost.spec.ts +1765 -0
  281. package/test/installedShellsState.spec.ts +39 -0
  282. package/test/interceptAnyObject.spec.ts +217 -0
  283. package/test/loggers.spec.ts +288 -0
  284. package/test/repluggableAppDebug.spec.ts +118 -0
  285. package/test/testKit.spec.tsx +153 -0
  286. package/testKit/emptyLoggerOptions.ts +16 -0
  287. package/testKit/index.ts +170 -0
  288. package/testKit/mockPackage.ts +110 -0
  289. package/testKit/package.json +3 -0
  290. package/testKit/withConsoleErrors.ts +12 -0
  291. package/testKit/withThrowOnError.ts +34 -0
  292. package/tsconfig.json +9 -2
  293. package/dist/es/API.d.ts.map +0 -1
  294. package/dist/es/API.js +0 -2
  295. package/dist/es/API.js.map +0 -1
  296. package/dist/es/__internal.d.ts.map +0 -1
  297. package/dist/es/__internal.js +0 -5
  298. package/dist/es/__internal.js.map +0 -1
  299. package/dist/es/index.d.ts +0 -3
  300. package/dist/es/index.d.ts.map +0 -1
  301. package/dist/es/index.js +0 -2
  302. package/dist/es/index.js.map +0 -1
  303. /package/dist/es/{__internal.d.ts → src/__internal.d.ts} +0 -0
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withConsoleErrors = void 0;
4
+ const noopConsoleError = () => { };
5
+ function withConsoleErrors(action, mock) {
6
+ const savedConsoleError = console.error;
7
+ console.error = mock || noopConsoleError;
8
+ try {
9
+ return action();
10
+ }
11
+ finally {
12
+ console.error = savedConsoleError;
13
+ }
14
+ }
15
+ exports.withConsoleErrors = withConsoleErrors;
16
+ //# sourceMappingURL=withConsoleErrors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withConsoleErrors.js","sourceRoot":"","sources":["../../testKit/withConsoleErrors.ts"],"names":[],"mappings":";;;AAAA,MAAM,gBAAgB,GAAqB,GAAG,EAAE,GAAE,CAAC,CAAA;AAEnD,SAAgB,iBAAiB,CAAI,MAAe,EAAE,IAAuB;IACzE,MAAM,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAA;IACvC,OAAO,CAAC,KAAK,GAAG,IAAI,IAAI,gBAAgB,CAAA;IAExC,IAAI,CAAC;QACD,OAAO,MAAM,EAAE,CAAA;IACnB,CAAC;YAAS,CAAC;QACP,OAAO,CAAC,KAAK,GAAG,iBAAiB,CAAA;IACrC,CAAC;AACL,CAAC;AATD,8CASC"}
@@ -0,0 +1,3 @@
1
+ import { AppHostOptions } from '../src/API';
2
+ export declare function withThrowOnError(options?: AppHostOptions): AppHostOptions;
3
+ //# sourceMappingURL=withThrowOnError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withThrowOnError.d.ts","sourceRoot":"","sources":["../../testKit/withThrowOnError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA4C,MAAM,YAAY,CAAA;AAErF,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,cAAmC,GAAG,cAAc,CA+B7F"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withThrowOnError = void 0;
4
+ function withThrowOnError(options = { monitoring: {} }) {
5
+ const throwError = (error, keyValuePairs) => {
6
+ throw new Error(`${error} ${keyValuePairs ? JSON.stringify(keyValuePairs) : ''}`);
7
+ };
8
+ const span = {
9
+ end(success, error, keyValuePairs) {
10
+ if (error) {
11
+ throwError(error, keyValuePairs);
12
+ }
13
+ }
14
+ };
15
+ const logger = {
16
+ spanRoot(messageId, error, keyValuePairs) {
17
+ return span;
18
+ },
19
+ spanChild(messageId, error, keyValuePairs) {
20
+ return span;
21
+ },
22
+ log(severity, id, error, keyValuePairs) {
23
+ if (severity === 'error' || severity === 'critical') {
24
+ throwError(error || new Error('Unknown error'), keyValuePairs);
25
+ }
26
+ }
27
+ };
28
+ return Object.assign(Object.assign({}, options), { logger });
29
+ }
30
+ exports.withThrowOnError = withThrowOnError;
31
+ //# sourceMappingURL=withThrowOnError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withThrowOnError.js","sourceRoot":"","sources":["../../testKit/withThrowOnError.ts"],"names":[],"mappings":";;;AAEA,SAAgB,gBAAgB,CAAC,UAA0B,EAAE,UAAU,EAAE,EAAE,EAAE;IACzE,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,aAAsB,EAAE,EAAE;QACxD,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACrF,CAAC,CAAA;IAED,MAAM,IAAI,GAAoB;QAC1B,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa;YAC7B,IAAI,KAAK,EAAE,CAAC;gBACR,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,CAAA;YACpC,CAAC;QACL,CAAC;KACJ,CAAA;IAED,MAAM,MAAM,GAAe;QACvB,QAAQ,CAAC,SAAiB,EAAE,KAAa,EAAE,aAAsB;YAC7D,OAAO,IAAI,CAAA;QACf,CAAC;QACD,SAAS,CAAC,SAAiB,EAAE,KAAa,EAAE,aAAsB;YAC9D,OAAO,IAAI,CAAA;QACf,CAAC;QACD,GAAG,CAAC,QAAqB,EAAE,EAAU,EAAE,KAAa,EAAE,aAAsB;YACxE,IAAI,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;gBAClD,UAAU,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,eAAe,CAAC,EAAE,aAAa,CAAC,CAAA;YAClE,CAAC;QACL,CAAC;KACJ,CAAA;IAED,uCACO,OAAO,KACV,MAAM,IACT;AACL,CAAC;AA/BD,4CA+BC"}
package/jest.config.js ADDED
@@ -0,0 +1,16 @@
1
+ const config = {
2
+ testMatch: ['<rootDir>/**/*.spec.ts?(x)'],
3
+ setupFilesAfterEnv: ['<rootDir>/__tests__/spec-setup.js'],
4
+ transform: {
5
+ '\\.tsx?$': 'ts-jest',
6
+ },
7
+ };
8
+
9
+ const inTeamCity = () =>
10
+ !!(process.env.BUILD_NUMBER || process.env.TEAMCITY_VERSION);
11
+
12
+ if (inTeamCity()) {
13
+ config.testResultsProcessor = require.resolve('jest-teamcity-reporter');
14
+ }
15
+
16
+ module.exports = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repluggable-core",
3
- "version": "1.302.66",
3
+ "version": "1.302.67",
4
4
  "license": "MIT",
5
5
  "description": "Allows composition of a React-with-Redux application entirely from a list of pluggable packages",
6
6
  "main": "dist/src/index.js",
@@ -12,14 +12,32 @@
12
12
  },
13
13
  "scripts": {
14
14
  "build": "rm -rf dist && yarn build-cjs && yarn build-es",
15
- "build-cjs": "tsc --outDir dist/src --module commonjs",
15
+ "build-cjs": "tsc --outDir dist --module commonjs",
16
16
  "build-es": "tsc --outDir dist/es --module esNext",
17
- "test": ":"
17
+ "test": "jest --coverage",
18
+ "posttest": "tslint --project ."
18
19
  },
19
20
  "dependencies": {
20
21
  "redux": "^4.0.5"
21
22
  },
22
23
  "devDependencies": {
24
+ "@types/jest": "^26.0.15",
25
+ "@types/lodash": "^4.14.162",
26
+ "jest": "^26.6.0",
27
+ "jest-teamcity-reporter": "^0.9.0",
28
+ "lodash": "^4.17.20",
29
+ "prettier": "^2.1.2",
30
+ "ts-jest": "^26.4.1",
31
+ "ts-loader": "^8.0.6",
32
+ "tslint": "^6.1.3",
33
+ "tslint-config-prettier": "^1.18.0",
34
+ "tslint-consistent-codestyle": "^1.16.0",
35
+ "tslint-eslint-rules": "^5.4.0",
36
+ "tslint-microsoft-contrib": "^6.2.0",
37
+ "tslint-no-unused-expression-chai": "^0.1.4",
38
+ "tslint-plugin-prettier": "^2.3.0",
39
+ "tslint-react": "^5.0.0",
40
+ "tslint-react-hooks": "^2.2.2",
23
41
  "typescript": "^5.4.2"
24
42
  },
25
43
  "repository": {
package/src/API.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import * as Redux from 'redux'
2
+ import { ThrottledStore } from './throttledStore'
3
+ import { INTERNAL_DONT_USE_SHELL_GET_APP_HOST } from './__internal'
4
+
2
5
 
3
6
  export interface AnySlotKey {
4
7
  readonly name: string
@@ -32,6 +35,12 @@ export interface SlotKey<T> extends AnySlotKey {
32
35
  readonly version?: number // TODO: Move to new interface - APIKey
33
36
  }
34
37
 
38
+ export { AppHostAPI } from './appHostServices'
39
+
40
+ export type ScopedStore<S> = Pick<
41
+ ThrottledStore<S>,
42
+ 'dispatch' | 'getState' | 'subscribe' | 'flush' | 'hasPendingSubscribers' | 'deferSubscriberNotifications'
43
+ >
35
44
  export type ReactComponentContributor<TProps = {}> = (props?: TProps) => React.ReactNode
36
45
  export type ReducersMapObjectContributor<TState = {}, TAction extends Redux.AnyAction = Redux.AnyAction> = () => Redux.ReducersMapObject<
37
46
  TState,
@@ -52,8 +61,6 @@ export interface LazyEntryPointDescriptor {
52
61
  readonly factory: LazyEntryPointFactory
53
62
  }
54
63
 
55
-
56
-
57
64
  /**
58
65
  * Application part that will receive a {Shell} when loaded into the {AppHost}
59
66
  * @export
@@ -199,10 +206,6 @@ export interface ExtensionItem<T> {
199
206
  readonly uniqueId: string
200
207
  }
201
208
 
202
- // addEntryPoints(entryPoints: EntryPoint[])
203
- // addPackages(packages: EntryPointOrPackage[])
204
- //
205
-
206
209
  /**
207
210
  * An application content container that will accept {EntryPoint} and provide registry for contracts
208
211
  *
@@ -210,6 +213,12 @@ export interface ExtensionItem<T> {
210
213
  * @interface AppHost
211
214
  */
212
215
  export interface AppHost {
216
+ /**
217
+ * Get the root store of the application
218
+ *
219
+ * @return {ThrottledStore}
220
+ */
221
+ getStore(): ThrottledStore
213
222
  /**
214
223
  * Get an implementation of API previously contributed to the {AppHost}
215
224
  *
@@ -218,6 +227,14 @@ export interface AppHost {
218
227
  * @return {*} {TAPI}
219
228
  */
220
229
  getAPI<TAPI>(key: SlotKey<TAPI>): TAPI
230
+ /**
231
+ * Check if an API implementation has been contributed to the {AppHost}
232
+ *
233
+ * @template TAPI
234
+ * @param {SlotKey<TAPI>} key API Key
235
+ * @return {*} {boolean}
236
+ */
237
+ hasAPI<TAPI>(key: SlotKey<TAPI>): boolean
221
238
  /**
222
239
  * Get an extension slot defined on the host
223
240
  *
@@ -226,6 +243,14 @@ export interface AppHost {
226
243
  * @return {ExtensionSlot<TItem>}
227
244
  */
228
245
  getSlot<TItem>(key: SlotKey<TItem>): ExtensionSlot<TItem>
246
+ /**
247
+ * Check if an extension slot has been contributed to the {AppHost}
248
+ *
249
+ * @template TItem
250
+ * @param {SlotKey<TItem>} key
251
+ * @return {boolean}
252
+ */
253
+ hasSlot<TItem>(key: SlotKey<TItem>): boolean
229
254
  /**
230
255
  * Get all the extension slots defined on the host
231
256
  *
@@ -261,7 +286,7 @@ export interface AppHost {
261
286
  * @return {Promise<void>}
262
287
  */
263
288
  removeShells(names: string[]): Promise<void>
264
- /**
289
+ /**
265
290
  * Subscribe to changes in host declarations. This includes:
266
291
  * - API additions and removals
267
292
  * - Extension slot additions and removals
@@ -355,6 +380,18 @@ export interface Lazy<T> {
355
380
  * @extends {(Pick<AppHost, Exclude<keyof AppHost, 'getStore' | 'log' | 'options'>>)}
356
381
  */
357
382
  export interface Shell extends Pick<AppHost, Exclude<keyof AppHost, 'getStore' | 'log' | 'options'>> {
383
+ /**
384
+ * Unique name of the matching {EntryPoint}
385
+ */
386
+ readonly name: string
387
+ readonly log: ShellLogger
388
+ /**
389
+ * Get store that is scoped for this {Shell}
390
+ *
391
+ * @template TState
392
+ * @return {ScopedStore<TState>} Scoped store for this {Shell}
393
+ */
394
+ getStore<TState>(): ScopedStore<TState>
358
395
  /**
359
396
  * Are APIs ready to be requested
360
397
  *
@@ -482,8 +519,9 @@ export interface PrivateShell extends Shell {
482
519
  setDependencyAPIs(APIs: AnySlotKey[]): void
483
520
  setLifecycleState(enableStore: boolean, enableAPIs: boolean, initCompleted: boolean): void
484
521
  getBoundaryAspects(): ShellBoundaryAspect[]
485
- getHostOptions(): AppHostOptions
486
- wrapWithShellRenderer(component: JSX.Element): JSX.Element
522
+ getHostOptions(): AppHostOptions,
523
+ readonly [INTERNAL_DONT_USE_SHELL_GET_APP_HOST]: () => AppHost
524
+
487
525
  }
488
526
 
489
527
  export interface EntryPointsInfo {
@@ -0,0 +1,123 @@
1
+ interface WeakMapValue<K extends object, V> {
2
+ value: V
3
+ ref: WeakRefOrPlain<K>
4
+ }
5
+
6
+ type WeakRefOrPlain<T extends object> = WeakRef<T> | T
7
+
8
+ const isWeakRef = (val: unknown): val is WeakRef<any> => {
9
+ return typeof val === 'object' && val !== null && 'deref' in val
10
+ }
11
+
12
+ const createWeakMapOrPlain = <T extends object>(val: T): WeakRef<T> | T => {
13
+ return typeof WeakRef !== 'undefined' ? new WeakRef(val) : val
14
+ }
15
+
16
+ export class IterableWeakMap<K extends object = object, V = any> implements Map<K, V> {
17
+ private readonly weakMap = new WeakMap<K, WeakMapValue<K, V>>()
18
+ private readonly refSet: Set<WeakRefOrPlain<K>> = new Set()
19
+ private readonly finalizationGroup =
20
+ typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry(IterableWeakMap.cleanup) : null
21
+
22
+ private static cleanup({ set, ref }: { set: Set<WeakRefOrPlain<any>>; ref: WeakRefOrPlain<any> }) {
23
+ set.delete(ref)
24
+ }
25
+
26
+ constructor(iterable?: [K, V][]) {
27
+ if (iterable) {
28
+ for (const [key, value] of iterable) {
29
+ this.set(key, value)
30
+ }
31
+ }
32
+ }
33
+
34
+ set(key: K, value: V) {
35
+ const ref = createWeakMapOrPlain(key)
36
+
37
+ this.weakMap.set(key, { value, ref })
38
+ this.refSet.add(ref)
39
+ this.finalizationGroup?.register(
40
+ key,
41
+ {
42
+ set: this.refSet,
43
+ ref
44
+ },
45
+ ref
46
+ )
47
+
48
+ return this
49
+ }
50
+
51
+ get(key: K): V | undefined {
52
+ const entry = this.weakMap.get(key)
53
+ return entry && entry.value
54
+ }
55
+
56
+ delete(key: any) {
57
+ const entry = this.weakMap.get(key)
58
+ if (!entry) {
59
+ return false
60
+ }
61
+
62
+ this.weakMap.delete(key)
63
+ this.refSet.delete(entry.ref)
64
+ this.finalizationGroup?.unregister(entry.ref)
65
+ return true
66
+ }
67
+
68
+ get size() {
69
+ return this.refSet.size
70
+ }
71
+
72
+ has(key: K): boolean {
73
+ return this.weakMap.has(key)
74
+ }
75
+
76
+ clear() {
77
+ for (const [key] of this) {
78
+ this.delete(key)
79
+ }
80
+ }
81
+
82
+ forEach(callbackfn: (value: V, key: K, map: this) => void, thisArg?: any): void {
83
+ for (const [key, value] of this) {
84
+ callbackfn(value, key, this )
85
+ }
86
+ }
87
+
88
+ get [Symbol.toStringTag]() {
89
+ return '[object IterableWeakMap]'
90
+ }
91
+
92
+ *[Symbol.iterator](): any {
93
+ for (const ref of this.refSet) {
94
+ const key = isWeakRef(ref) ? ref.deref() : ref
95
+
96
+ if (!key) {
97
+ continue
98
+ }
99
+ const value = this.weakMap.get(key)
100
+ if (value) {
101
+ yield [key, value.value] as [K, V]
102
+ }
103
+ }
104
+ }
105
+
106
+ entries(): ReturnType<Map<K, V>['entries']> {
107
+ return this[Symbol.iterator]() as unknown as ReturnType<Map<K, V>['entries']>
108
+ }
109
+
110
+ *keys(): ReturnType<Map<K, V>['keys']> {
111
+ for (const [key] of this) {
112
+ yield key
113
+ }
114
+ }
115
+
116
+ *values(): ReturnType<Map<K, V>['values']> {
117
+ for (const [_, value] of this) {
118
+ yield value
119
+ }
120
+ }
121
+ }
122
+
123
+
package/src/__internal.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * This symbol is only for internal use of repluggable mono-repo.
3
3
  */
4
- export const INTERNAL_DONT_USE_SHELL_GET_APP_HOST: unique symbol = Symbol('SHELL_GET_APP_HOST')
4
+ export const INTERNAL_DONT_USE_SHELL_GET_APP_HOST: unique symbol = Symbol.for('SHELL_GET_APP_HOST')