repluggable-core 1.302.79 → 1.302.80

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 (40) hide show
  1. package/dist/debug/src/API.d.ts +2 -8
  2. package/dist/es/src/API.d.ts +2 -8
  3. package/dist/es/src/API.d.ts.map +1 -1
  4. package/dist/es/src/appHost.d.ts +1 -2
  5. package/dist/es/src/appHost.d.ts.map +1 -1
  6. package/dist/es/src/appHost.js +2 -24
  7. package/dist/es/src/appHost.js.map +1 -1
  8. package/dist/es/src/index.d.ts +1 -1
  9. package/dist/es/src/index.d.ts.map +1 -1
  10. package/dist/es/src/index.js +1 -1
  11. package/dist/es/src/index.js.map +1 -1
  12. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.d.ts +2 -3
  13. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.d.ts.map +1 -1
  14. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.js +1 -2
  15. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.js.map +1 -1
  16. package/dist/es/test/appHost.spec.js +1 -6
  17. package/dist/es/test/appHost.spec.js.map +1 -1
  18. package/dist/src/API.d.ts +2 -8
  19. package/dist/src/API.d.ts.map +1 -1
  20. package/dist/src/appHost.d.ts +1 -2
  21. package/dist/src/appHost.d.ts.map +1 -1
  22. package/dist/src/appHost.js +3 -26
  23. package/dist/src/appHost.js.map +1 -1
  24. package/dist/src/index.d.ts +1 -1
  25. package/dist/src/index.d.ts.map +1 -1
  26. package/dist/src/index.js +1 -2
  27. package/dist/src/index.js.map +1 -1
  28. package/dist/src/repluggableAppDebug/repluggableAppDebug.d.ts +2 -3
  29. package/dist/src/repluggableAppDebug/repluggableAppDebug.d.ts.map +1 -1
  30. package/dist/src/repluggableAppDebug/repluggableAppDebug.js +1 -2
  31. package/dist/src/repluggableAppDebug/repluggableAppDebug.js.map +1 -1
  32. package/dist/test/appHost.spec.js +0 -5
  33. package/dist/test/appHost.spec.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/API.ts +2 -10
  36. package/src/appHost.ts +2 -34
  37. package/src/index.ts +1 -1
  38. package/src/repluggableAppDebug/debug.d.ts +1 -2
  39. package/src/repluggableAppDebug/repluggableAppDebug.ts +1 -4
  40. package/test/appHost.spec.ts +1 -7
package/src/API.ts CHANGED
@@ -50,17 +50,11 @@ export type ContributionPredicate = () => boolean
50
50
  export interface EntryPointTags {
51
51
  [name: string]: string
52
52
  }
53
- export type LazyEntryPointFactory = () => Promise<EntryPoint> //TODO: get rid of these
54
53
  export type ShellsChangedCallback = (shellNames: string[]) => void
55
54
  export type DeclarationsChangedCallback = () => void
56
55
  export type UnsubscribeFromDeclarationsChanged = () => void
57
56
  export type ShellBoundaryAspect = React.FunctionComponent<React.PropsWithChildren<unknown>>
58
57
 
59
- export interface LazyEntryPointDescriptor {
60
- readonly name: string
61
- readonly factory: LazyEntryPointFactory
62
- }
63
-
64
58
  /**
65
59
  * Application part that will receive a {Shell} when loaded into the {AppHost}
66
60
  * @export
@@ -106,7 +100,7 @@ export interface EntryPoint {
106
100
  detach?(shell: Shell): void
107
101
  }
108
102
 
109
- export type AnyEntryPoint = EntryPoint | LazyEntryPointDescriptor
103
+ export type AnyEntryPoint = EntryPoint
110
104
  export type EntryPointOrPackage = AnyEntryPoint | AnyEntryPoint[]
111
105
  export interface EntryPointOrPackagesMap {
112
106
  [name: string]: EntryPointOrPackage
@@ -270,8 +264,6 @@ export interface AppHost {
270
264
  * @return {boolean}
271
265
  */
272
266
  hasShell(name: string): boolean
273
- // TODO: Deprecate
274
- isLazyEntryPoint(name: string): boolean
275
267
  /**
276
268
  * Dynamically add {Shell}s after the host is created
277
269
  *
@@ -339,7 +331,7 @@ interface AppHostPlugins {
339
331
  }
340
332
  }
341
333
 
342
- export {CustomCreateExtensionSlot}
334
+ export type {CustomCreateExtensionSlot}
343
335
 
344
336
  export interface AppHostOptions {
345
337
  readonly logger?: HostLogger
package/src/appHost.ts CHANGED
@@ -18,8 +18,6 @@ import {
18
18
  ExtensionSlot,
19
19
  FunctionWithSameArgs,
20
20
  Lazy,
21
- LazyEntryPointDescriptor,
22
- LazyEntryPointFactory,
23
21
  MemoizeMissHit,
24
22
  ObservableState,
25
23
  PrivateAppHost,
@@ -62,13 +60,6 @@ function castMultiArray<T>(v: T[] | T[][]): T[][] {
62
60
  return isMultiArray(v) ? v : [v]
63
61
  }
64
62
 
65
- export const makeLazyEntryPoint = (name: string, factory: LazyEntryPointFactory): LazyEntryPointDescriptor => {
66
- return {
67
- name,
68
- factory
69
- }
70
- }
71
-
72
63
  export const mainViewSlotKey: SlotKey<ReactComponentContributor> = {
73
64
  name: 'mainView'
74
65
  }
@@ -182,7 +173,6 @@ export function createAppHost(initialEntryPointsOrPackages: EntryPointOrPackage[
182
173
  const slotKeysByName = new Map<string, AnySlotKey>()
183
174
  const addedShells = new Map<string, PrivateShell>()
184
175
  const shellInstallers = new WeakMap<PrivateShell, string[]>()
185
- const lazyShells = new Map<string, LazyEntryPointFactory>()
186
176
  const shellsChangedCallbacks = new Map<string, ShellsChangedCallback>()
187
177
  const declarationsChangedCallbacks = new Map<string, DeclarationsChangedCallback>()
188
178
  const APILayers = new WeakMap<AnySlotKey, APILayer[] | undefined>()
@@ -204,7 +194,6 @@ export function createAppHost(initialEntryPointsOrPackages: EntryPointOrPackage[
204
194
  getAllSlotKeys,
205
195
  getAllEntryPoints,
206
196
  hasShell,
207
- isLazyEntryPoint,
208
197
  addShells,
209
198
  removeShells,
210
199
  onShellsChanged,
@@ -224,7 +213,6 @@ export function createAppHost(initialEntryPointsOrPackages: EntryPointOrPackage[
224
213
  extensionSlots,
225
214
  addedShells,
226
215
  shellInstallers,
227
- lazyShells,
228
216
 
229
217
  performance: {
230
218
  options,
@@ -300,11 +288,6 @@ export function createAppHost(initialEntryPointsOrPackages: EntryPointOrPackage[
300
288
 
301
289
  return host
302
290
 
303
- //TODO: get rid of LazyEntryPointDescriptor
304
- function isLazyEntryPointDescriptor(value: AnyEntryPoint): value is LazyEntryPointDescriptor {
305
- return typeof (value as LazyEntryPointDescriptor).factory === 'function'
306
- }
307
-
308
291
  function enrichMemoization<T extends _.MemoizedFunction & Partial<MemoizeMissHit>>(memoized: T): T & MemoizeMissHit {
309
292
  const memoizedWithMissHit = _.assign(memoized, {
310
293
  miss: 0,
@@ -404,15 +387,9 @@ miss: ${memoizedWithMissHit.miss}
404
387
  validateUniqueShellNames(entryPoints)
405
388
  !options.disableCheckCircularDependencies && !options.experimentalCyclicMode && validateCircularDependency(allEntryPoints)
406
389
 
407
- const [lazyEntryPointsList, readyEntryPointsList] = _.partition(entryPoints, isLazyEntryPointDescriptor) as [
408
- LazyEntryPointDescriptor[],
409
- EntryPoint[]
410
- ]
390
+ executeInstallShell(entryPoints)
411
391
 
412
- executeInstallShell(readyEntryPointsList)
413
- lazyEntryPointsList.forEach(registerLazyEntryPoint)
414
-
415
- setInstalledShellNames(getInstalledShellNames().concat(_.map(lazyEntryPointsList, 'name')))
392
+ setInstalledShellNames(getInstalledShellNames())
416
393
  return Promise.resolve()
417
394
  }
418
395
 
@@ -662,14 +639,6 @@ miss: ${memoizedWithMissHit.miss}
662
639
  return installedShellsSet[name] === true
663
640
  }
664
641
 
665
- function isLazyEntryPoint(name: string): boolean {
666
- return lazyShells.has(name)
667
- }
668
-
669
- function registerLazyEntryPoint(descriptor: LazyEntryPointDescriptor): void {
670
- lazyShells.set(descriptor.name, descriptor.factory)
671
- }
672
-
673
642
  function getOwnSlotKey<T>(key: SlotKey<T>): SlotKey<T> {
674
643
  if (key.public === true) {
675
644
  const ownKey = slotKeysByName.get(slotKeyToName(key))
@@ -999,7 +968,6 @@ miss: ${memoizedWithMissHit.miss}
999
968
  getAllSlotKeys: host.getAllSlotKeys,
1000
969
  getAllEntryPoints: host.getAllEntryPoints,
1001
970
  hasShell: host.hasShell,
1002
- isLazyEntryPoint: host.isLazyEntryPoint,
1003
971
  onShellsChanged: host.onShellsChanged,
1004
972
  onDeclarationsChanged: host.onDeclarationsChanged,
1005
973
  removeShellsChangedCallback: host.removeShellsChangedCallback,
package/src/index.ts CHANGED
@@ -29,7 +29,7 @@ export {
29
29
 
30
30
  export { ConsoleHostLogger } from './loggers'
31
31
 
32
- export { createAppHost, makeLazyEntryPoint, mainViewSlotKey, stateSlotKey } from './appHost'
32
+ export { createAppHost, mainViewSlotKey, stateSlotKey } from './appHost'
33
33
 
34
34
  export { AppHostServicesProvider } from './appHostServices'
35
35
 
@@ -1,4 +1,4 @@
1
- import { EntryPoint, AppHost, AnySlotKey, LazyEntryPointFactory, PrivateShell, SlotKey } from '../API'
1
+ import { EntryPoint, AppHost, AnySlotKey, PrivateShell, SlotKey } from '../API'
2
2
  import { AnyExtensionSlot } from '../extensionSlot'
3
3
  import { Hot } from '../hot'
4
4
 
@@ -12,7 +12,6 @@ export interface RepluggableAppDebugInfo {
12
12
  uniqueShellNames: Set<string>
13
13
  extensionSlots: Map<AnySlotKey, AnyExtensionSlot>
14
14
  addedShells: Map<string, PrivateShell>
15
- lazyShells: Map<string, LazyEntryPointFactory>
16
15
  readyAPIs: Set<AnySlotKey>
17
16
  shellInstallers: WeakMap<PrivateShell, string[]>
18
17
  utils: RepluggableDebugUtils
@@ -1,5 +1,5 @@
1
1
  import { getPerformanceDebug } from './performanceDebugInfo'
2
- import { AnySlotKey, AppHost, EntryPoint, LazyEntryPointFactory, PrivateShell, SlotKey, StatisticsMemoization, Trace } from '../API'
2
+ import { AnySlotKey, AppHost, EntryPoint, PrivateShell, SlotKey, StatisticsMemoization, Trace } from '../API'
3
3
  import _ from 'lodash'
4
4
  import { hot } from '../hot'
5
5
  import { AppHostServicesProvider } from '../appHostServices'
@@ -18,7 +18,6 @@ interface SetupDebugInfoParams {
18
18
  extensionSlots: Map<AnySlotKey, AnyExtensionSlot>
19
19
  addedShells: Map<string, PrivateShell>
20
20
  shellInstallers: WeakMap<PrivateShell, string[]>
21
- lazyShells: Map<string, LazyEntryPointFactory>
22
21
 
23
22
  performance: PerformanceDebugParams
24
23
 
@@ -133,7 +132,6 @@ export function setupDebugInfo({
133
132
  getUnreadyEntryPoints,
134
133
  extensionSlots,
135
134
  addedShells,
136
- lazyShells,
137
135
  shellInstallers,
138
136
  performance: { options, trace, memoizedArr }
139
137
  }: SetupDebugInfoParams) {
@@ -181,7 +179,6 @@ export function setupDebugInfo({
181
179
  uniqueShellNames,
182
180
  extensionSlots,
183
181
  addedShells,
184
- lazyShells,
185
182
  readyAPIs,
186
183
  shellInstallers,
187
184
  utils,
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash'
2
2
 
3
- import { createAppHost, mainViewSlotKey, makeLazyEntryPoint, stateSlotKey } from '../src/appHost'
3
+ import { createAppHost, mainViewSlotKey, stateSlotKey } from '../src/appHost'
4
4
 
5
5
  import {
6
6
  AnySlotKey,
@@ -207,12 +207,6 @@ describe('App Host', () => {
207
207
  it('should not install multiple shells with the same name', () => {
208
208
  expect(() => createAppHost([mockPackage, _.pick(mockPackage, 'name')], testHostOptions)).toThrow()
209
209
  })
210
-
211
- it('should install lazy shells', () => {
212
- const lazyEntryPoint = makeLazyEntryPoint(mockPackage.name, async () => mockPackage)
213
- const host = createAppHost([lazyEntryPoint], testHostOptions)
214
- expect(host.hasShell(lazyEntryPoint.name)).toBe(true)
215
- })
216
210
  })
217
211
 
218
212
  describe('EntryPoint lifecycle state', () => {