@tramvai/module-child-app 5.53.80 → 6.62.0

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.
@@ -0,0 +1,39 @@
1
+ /// <reference types="node" />
2
+ import { Cache } from '@tramvai/tokens-common';
3
+ export declare const cache: (import("@tramvai/core").Provider<{
4
+ cacheCleanupConfig: {
5
+ token: {
6
+ cleanupIntervalMs?: number | undefined;
7
+ } & {
8
+ __type?: "base token" | undefined;
9
+ };
10
+ optional: true;
11
+ };
12
+ childAppLoaderCache: Cache<any> & {
13
+ __type?: "base token" | undefined;
14
+ };
15
+ }, import("@tramvai/core").Command & {
16
+ __type?: "multi token" | undefined;
17
+ }> | import("@tramvai/core").Provider<{
18
+ asyncLocalStorage: {
19
+ token: import("async_hooks").AsyncLocalStorage<import("@tramvai/tokens-common").AsyncLocalStorageState> & {
20
+ __type?: "base token" | undefined;
21
+ };
22
+ optional: true;
23
+ };
24
+ cacheOptions: {
25
+ token: {
26
+ max?: number | undefined;
27
+ ttl?: number | undefined;
28
+ } & {
29
+ __type?: "base token" | undefined;
30
+ };
31
+ optional: true;
32
+ };
33
+ createCache: import("@tramvai/tokens-common").CacheFactory & {
34
+ __type?: "base token" | undefined;
35
+ };
36
+ }, Cache<any> & {
37
+ __type?: "base token" | undefined;
38
+ }>)[];
39
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1,76 @@
1
+ import { provide, commandLineListTokens } from '@tramvai/core';
2
+ import { optional, Scope } from '@tinkoff/dippy';
3
+ import { CHILD_APP_LOADER_CACHE_CLEANUP_CONFIG_TOKEN, CHILD_APP_LOADER_CACHE_TOKEN, CHILD_APP_LOADER_CACHE_OPTIONS_TOKEN } from '@tramvai/tokens-child-app';
4
+ import { ASYNC_LOCAL_STORAGE_TOKEN, CREATE_CACHE_TOKEN } from '@tramvai/tokens-common';
5
+ import { setCacheCleanupInterval } from './cacheCleanup.es.js';
6
+
7
+ const cache = [
8
+ provide({
9
+ provide: commandLineListTokens.listen,
10
+ useFactory: ({ childAppLoaderCache, cacheCleanupConfig }) => {
11
+ return () => {
12
+ setCacheCleanupInterval(childAppLoaderCache, cacheCleanupConfig?.cleanupIntervalMs);
13
+ };
14
+ },
15
+ deps: {
16
+ cacheCleanupConfig: optional(CHILD_APP_LOADER_CACHE_CLEANUP_CONFIG_TOKEN),
17
+ childAppLoaderCache: CHILD_APP_LOADER_CACHE_TOKEN,
18
+ },
19
+ }),
20
+ provide({
21
+ provide: CHILD_APP_LOADER_CACHE_TOKEN,
22
+ scope: Scope.SINGLETON,
23
+ useFactory: ({ createCache, cacheOptions, asyncLocalStorage }) => {
24
+ const inMemoryCache = createCache('memory', {
25
+ name: 'child-app-loader',
26
+ // When Child App script is evicted from server loader cache, we get a small memory leak,
27
+ // because providers in singleton child DI, page components / actions, will store a reference to removed script,
28
+ // and server loader cache will contain a new instance of the same script.
29
+ //
30
+ // So, it is better to have bigger cache size to prevent evicting from cache,
31
+ // also for one Child App we need to save 3 elements - server JS, stats JSON and loadable stats JSON.
32
+ max: 100,
33
+ ttl: 1000 * 60 * 60 * 24 * 5,
34
+ ...cacheOptions,
35
+ });
36
+ let childAppLoaderCache = inMemoryCache;
37
+ // Cache is not compatible with HMR (Hot Module Replacement) because after HMR and page reload,
38
+ // we get the page from the cache. To solve this, we use Async Local Storage to ensure the
39
+ // cache is only valid within the context of a single request.
40
+ if (process.env.NODE_ENV === 'development' && !!asyncLocalStorage) {
41
+ childAppLoaderCache = {
42
+ get(key) {
43
+ if (key?.startsWith('__DEBUG__')) {
44
+ const store = asyncLocalStorage.getStore();
45
+ if (store) {
46
+ return store[key];
47
+ }
48
+ }
49
+ else {
50
+ return inMemoryCache.get(key);
51
+ }
52
+ },
53
+ set(key, module) {
54
+ if (key?.startsWith('__DEBUG__')) {
55
+ const store = asyncLocalStorage.getStore();
56
+ if (store) {
57
+ store[key] = module;
58
+ }
59
+ }
60
+ else {
61
+ inMemoryCache.set(key, module);
62
+ }
63
+ },
64
+ };
65
+ }
66
+ return childAppLoaderCache;
67
+ },
68
+ deps: {
69
+ asyncLocalStorage: optional(ASYNC_LOCAL_STORAGE_TOKEN),
70
+ cacheOptions: optional(CHILD_APP_LOADER_CACHE_OPTIONS_TOKEN),
71
+ createCache: CREATE_CACHE_TOKEN,
72
+ },
73
+ }),
74
+ ];
75
+
76
+ export { cache };
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@tramvai/core');
6
+ var dippy = require('@tinkoff/dippy');
7
+ var tokensChildApp = require('@tramvai/tokens-child-app');
8
+ var tokensCommon = require('@tramvai/tokens-common');
9
+ var cacheCleanup = require('./cacheCleanup.js');
10
+
11
+ const cache = [
12
+ core.provide({
13
+ provide: core.commandLineListTokens.listen,
14
+ useFactory: ({ childAppLoaderCache, cacheCleanupConfig }) => {
15
+ return () => {
16
+ cacheCleanup.setCacheCleanupInterval(childAppLoaderCache, cacheCleanupConfig?.cleanupIntervalMs);
17
+ };
18
+ },
19
+ deps: {
20
+ cacheCleanupConfig: dippy.optional(tokensChildApp.CHILD_APP_LOADER_CACHE_CLEANUP_CONFIG_TOKEN),
21
+ childAppLoaderCache: tokensChildApp.CHILD_APP_LOADER_CACHE_TOKEN,
22
+ },
23
+ }),
24
+ core.provide({
25
+ provide: tokensChildApp.CHILD_APP_LOADER_CACHE_TOKEN,
26
+ scope: dippy.Scope.SINGLETON,
27
+ useFactory: ({ createCache, cacheOptions, asyncLocalStorage }) => {
28
+ const inMemoryCache = createCache('memory', {
29
+ name: 'child-app-loader',
30
+ // When Child App script is evicted from server loader cache, we get a small memory leak,
31
+ // because providers in singleton child DI, page components / actions, will store a reference to removed script,
32
+ // and server loader cache will contain a new instance of the same script.
33
+ //
34
+ // So, it is better to have bigger cache size to prevent evicting from cache,
35
+ // also for one Child App we need to save 3 elements - server JS, stats JSON and loadable stats JSON.
36
+ max: 100,
37
+ ttl: 1000 * 60 * 60 * 24 * 5,
38
+ ...cacheOptions,
39
+ });
40
+ let childAppLoaderCache = inMemoryCache;
41
+ // Cache is not compatible with HMR (Hot Module Replacement) because after HMR and page reload,
42
+ // we get the page from the cache. To solve this, we use Async Local Storage to ensure the
43
+ // cache is only valid within the context of a single request.
44
+ if (process.env.NODE_ENV === 'development' && !!asyncLocalStorage) {
45
+ childAppLoaderCache = {
46
+ get(key) {
47
+ if (key?.startsWith('__DEBUG__')) {
48
+ const store = asyncLocalStorage.getStore();
49
+ if (store) {
50
+ return store[key];
51
+ }
52
+ }
53
+ else {
54
+ return inMemoryCache.get(key);
55
+ }
56
+ },
57
+ set(key, module) {
58
+ if (key?.startsWith('__DEBUG__')) {
59
+ const store = asyncLocalStorage.getStore();
60
+ if (store) {
61
+ store[key] = module;
62
+ }
63
+ }
64
+ else {
65
+ inMemoryCache.set(key, module);
66
+ }
67
+ },
68
+ };
69
+ }
70
+ return childAppLoaderCache;
71
+ },
72
+ deps: {
73
+ asyncLocalStorage: dippy.optional(tokensCommon.ASYNC_LOCAL_STORAGE_TOKEN),
74
+ cacheOptions: dippy.optional(tokensChildApp.CHILD_APP_LOADER_CACHE_OPTIONS_TOKEN),
75
+ createCache: tokensCommon.CREATE_CACHE_TOKEN,
76
+ },
77
+ }),
78
+ ];
79
+
80
+ exports.cache = cache;
@@ -0,0 +1,4 @@
1
+ import { Cache } from '@tramvai/tokens-common';
2
+ export declare function cleanupStaleElementsInCache<T>(cache: Cache<T>): void;
3
+ export declare function setCacheCleanupInterval<T>(cache: Cache<T>, intervalMs?: number): void;
4
+ //# sourceMappingURL=cacheCleanup.d.ts.map
@@ -0,0 +1,16 @@
1
+ function cleanupStaleElementsInCache(cache) {
2
+ const entries = cache.dump();
3
+ const now = Date.now();
4
+ for (const [key, value] of entries) {
5
+ if (value.start + value.ttl < now) {
6
+ cache.delete(key);
7
+ }
8
+ }
9
+ }
10
+ function setCacheCleanupInterval(cache, intervalMs = 1000 * 60 * 60 * 24) {
11
+ setInterval(() => {
12
+ cleanupStaleElementsInCache(cache);
13
+ }, intervalMs);
14
+ }
15
+
16
+ export { cleanupStaleElementsInCache, setCacheCleanupInterval };
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function cleanupStaleElementsInCache(cache) {
6
+ const entries = cache.dump();
7
+ const now = Date.now();
8
+ for (const [key, value] of entries) {
9
+ if (value.start + value.ttl < now) {
10
+ cache.delete(key);
11
+ }
12
+ }
13
+ }
14
+ function setCacheCleanupInterval(cache, intervalMs = 1000 * 60 * 60 * 24) {
15
+ setInterval(() => {
16
+ cleanupStaleElementsInCache(cache);
17
+ }, intervalMs);
18
+ }
19
+
20
+ exports.cleanupStaleElementsInCache = cleanupStaleElementsInCache;
21
+ exports.setCacheCleanupInterval = setCacheCleanupInterval;
@@ -1,6 +1,6 @@
1
1
  import type { CHILD_APP_LOADER_PLUGIN, ChildApp } from '@tramvai/child-app-core';
2
- import { CHILD_APP_LOADER_CACHE_OPTIONS_TOKEN, type ChildAppFinalConfig } from '@tramvai/tokens-child-app';
3
- import type { CREATE_CACHE_TOKEN, LOGGER_TOKEN, ENV_MANAGER_TOKEN, ASYNC_LOCAL_STORAGE_TOKEN } from '@tramvai/tokens-common';
2
+ import { CHILD_APP_LOADER_CACHE_TOKEN, type ChildAppFinalConfig } from '@tramvai/tokens-child-app';
3
+ import type { LOGGER_TOKEN, ENV_MANAGER_TOKEN } from '@tramvai/tokens-common';
4
4
  import { AsyncTapableHookInstance, TAPABLE_HOOK_FACTORY_TOKEN } from '@tramvai/core';
5
5
  import { Loader } from '../shared/loader';
6
6
  import type { LoadableStats, ModuleFederationStats } from '../shared/webpack/moduleFederation';
@@ -12,13 +12,11 @@ export declare class ServerLoader extends Loader {
12
12
  loadModuleHook: AsyncTapableHookInstance<{
13
13
  config: ChildAppFinalConfig;
14
14
  }, ChildApp | undefined>;
15
- constructor({ logger, createCache, envManager, cacheOptions, asyncLocalStorage, hookFactory, plugins, }: {
15
+ constructor({ logger, envManager, cache, hookFactory, plugins, }: {
16
16
  hookFactory: typeof TAPABLE_HOOK_FACTORY_TOKEN;
17
17
  logger: typeof LOGGER_TOKEN;
18
- createCache: typeof CREATE_CACHE_TOKEN;
19
18
  envManager: typeof ENV_MANAGER_TOKEN;
20
- cacheOptions: typeof CHILD_APP_LOADER_CACHE_OPTIONS_TOKEN | null;
21
- asyncLocalStorage: typeof ASYNC_LOCAL_STORAGE_TOKEN | null;
19
+ cache: typeof CHILD_APP_LOADER_CACHE_TOKEN;
22
20
  plugins: (typeof CHILD_APP_LOADER_PLUGIN)[] | null;
23
21
  });
24
22
  private loadModule;
@@ -9,56 +9,12 @@ class ServerLoader extends Loader {
9
9
  log;
10
10
  hookFactory;
11
11
  loadModuleHook;
12
- constructor({ logger, createCache, envManager, cacheOptions, asyncLocalStorage, hookFactory, plugins, }) {
12
+ constructor({ logger, envManager, cache, hookFactory, plugins, }) {
13
13
  super();
14
14
  this.hookFactory = hookFactory;
15
- const cache = createCache('memory', {
16
- name: 'child-app-loader',
17
- ttl: 1000 * 60 * 60 * 24 * 5,
18
- // When Child App script is evicted from server loader cache, we get a small memory leak,
19
- // because providers in singleton child DI, page components / actions, will store a reference to removed script,
20
- // and server loader cache will contain a new instance of the same script.
21
- //
22
- // So, it is better to have bigger cache size to prevent evicting from cache,
23
- // also for one Child App we need to save 3 elements - server JS, stats JSON and loadable stats JSON.
24
- //
25
- // TODO: cache cleanup for previous versions of Child Apps
26
- max: 100,
27
- ...cacheOptions,
28
- });
29
- let internalLoadCache = cache;
30
- // Cache is not compatible with HMR (Hot Module Replacement) because after HMR and page reload,
31
- // we get the page from the cache. To solve this, we use Async Local Storage to ensure the
32
- // cache is only valid within the context of a single request.
33
- if (process.env.NODE_ENV === 'development' && !!asyncLocalStorage) {
34
- internalLoadCache = {
35
- get(key) {
36
- if (key?.startsWith('__DEBUG__')) {
37
- const store = asyncLocalStorage.getStore();
38
- if (store) {
39
- return store[key];
40
- }
41
- }
42
- else {
43
- return cache.get(key);
44
- }
45
- },
46
- set(key, module) {
47
- if (key?.startsWith('__DEBUG__')) {
48
- const store = asyncLocalStorage.getStore();
49
- if (store) {
50
- store[key] = module;
51
- }
52
- }
53
- else {
54
- cache.set(key, module);
55
- }
56
- },
57
- };
58
- }
59
15
  this.log = logger('child-app:loader');
60
16
  this.loader = new ServerLoader$1({
61
- cache: internalLoadCache,
17
+ cache,
62
18
  log: this.log,
63
19
  requestOptions: {
64
20
  circuitBreakerEnabled: isNil(envManager.get('HTTP_CLIENT_CIRCUIT_BREAKER_DISABLED')),
@@ -78,6 +34,7 @@ class ServerLoader extends Loader {
78
34
  codePrefix: `var ASSETS_PREFIX="${config.client.baseUrl}";`,
79
35
  displayName: config.name,
80
36
  kind: 'child-app',
37
+ debug: config.tag === 'debug',
81
38
  }),
82
39
  this.loader
83
40
  .resolveByUrl(config.client.stats, {
@@ -85,6 +42,7 @@ class ServerLoader extends Loader {
85
42
  kind: 'child-app stats',
86
43
  displayName: config.name,
87
44
  silent: true,
45
+ debug: config.tag === 'debug',
88
46
  })
89
47
  // we can live without stats
90
48
  .catch(() => { }),
@@ -96,6 +54,7 @@ class ServerLoader extends Loader {
96
54
  kind: 'child-app loadable stats',
97
55
  displayName: config.name,
98
56
  silent: true,
57
+ debug: config.tag === 'debug',
99
58
  })
100
59
  // we can live without loadable stats, for backward compatibility is ok
101
60
  // but hydration errors will occur when lazy component will loaded at client-side at demand
@@ -110,7 +69,9 @@ class ServerLoader extends Loader {
110
69
  return childApp;
111
70
  }
112
71
  async init(config) {
113
- const container = this.loader.getByUrl(config.server.entry);
72
+ const container = this.loader.getByUrl(config.server.entry, {
73
+ debug: config.tag === 'debug',
74
+ });
114
75
  if (!container) {
115
76
  return;
116
77
  }
@@ -133,7 +94,9 @@ class ServerLoader extends Loader {
133
94
  }
134
95
  }
135
96
  get(config) {
136
- const container = this.loader.getByUrl(config.server.entry);
97
+ const container = this.loader.getByUrl(config.server.entry, {
98
+ debug: config.tag === 'debug',
99
+ });
137
100
  if (!container) {
138
101
  return undefined;
139
102
  }
@@ -141,7 +104,9 @@ class ServerLoader extends Loader {
141
104
  return entry && this.resolve(entry);
142
105
  }
143
106
  getStats(config) {
144
- return this.loader.getByUrl(config.client.stats);
107
+ return this.loader.getByUrl(config.client.stats, {
108
+ debug: config.tag === 'debug',
109
+ });
145
110
  }
146
111
  getLoadableStats(config) {
147
112
  if (!config.client.statsLoadable) {
@@ -17,56 +17,12 @@ class ServerLoader extends loader.Loader {
17
17
  log;
18
18
  hookFactory;
19
19
  loadModuleHook;
20
- constructor({ logger, createCache, envManager, cacheOptions, asyncLocalStorage, hookFactory, plugins, }) {
20
+ constructor({ logger, envManager, cache, hookFactory, plugins, }) {
21
21
  super();
22
22
  this.hookFactory = hookFactory;
23
- const cache = createCache('memory', {
24
- name: 'child-app-loader',
25
- ttl: 1000 * 60 * 60 * 24 * 5,
26
- // When Child App script is evicted from server loader cache, we get a small memory leak,
27
- // because providers in singleton child DI, page components / actions, will store a reference to removed script,
28
- // and server loader cache will contain a new instance of the same script.
29
- //
30
- // So, it is better to have bigger cache size to prevent evicting from cache,
31
- // also for one Child App we need to save 3 elements - server JS, stats JSON and loadable stats JSON.
32
- //
33
- // TODO: cache cleanup for previous versions of Child Apps
34
- max: 100,
35
- ...cacheOptions,
36
- });
37
- let internalLoadCache = cache;
38
- // Cache is not compatible with HMR (Hot Module Replacement) because after HMR and page reload,
39
- // we get the page from the cache. To solve this, we use Async Local Storage to ensure the
40
- // cache is only valid within the context of a single request.
41
- if (process.env.NODE_ENV === 'development' && !!asyncLocalStorage) {
42
- internalLoadCache = {
43
- get(key) {
44
- if (key?.startsWith('__DEBUG__')) {
45
- const store = asyncLocalStorage.getStore();
46
- if (store) {
47
- return store[key];
48
- }
49
- }
50
- else {
51
- return cache.get(key);
52
- }
53
- },
54
- set(key, module) {
55
- if (key?.startsWith('__DEBUG__')) {
56
- const store = asyncLocalStorage.getStore();
57
- if (store) {
58
- store[key] = module;
59
- }
60
- }
61
- else {
62
- cache.set(key, module);
63
- }
64
- },
65
- };
66
- }
67
23
  this.log = logger('child-app:loader');
68
24
  this.loader = new moduleLoaderServer.ServerLoader({
69
- cache: internalLoadCache,
25
+ cache,
70
26
  log: this.log,
71
27
  requestOptions: {
72
28
  circuitBreakerEnabled: isNil__default["default"](envManager.get('HTTP_CLIENT_CIRCUIT_BREAKER_DISABLED')),
@@ -86,6 +42,7 @@ class ServerLoader extends loader.Loader {
86
42
  codePrefix: `var ASSETS_PREFIX="${config.client.baseUrl}";`,
87
43
  displayName: config.name,
88
44
  kind: 'child-app',
45
+ debug: config.tag === 'debug',
89
46
  }),
90
47
  this.loader
91
48
  .resolveByUrl(config.client.stats, {
@@ -93,6 +50,7 @@ class ServerLoader extends loader.Loader {
93
50
  kind: 'child-app stats',
94
51
  displayName: config.name,
95
52
  silent: true,
53
+ debug: config.tag === 'debug',
96
54
  })
97
55
  // we can live without stats
98
56
  .catch(() => { }),
@@ -104,6 +62,7 @@ class ServerLoader extends loader.Loader {
104
62
  kind: 'child-app loadable stats',
105
63
  displayName: config.name,
106
64
  silent: true,
65
+ debug: config.tag === 'debug',
107
66
  })
108
67
  // we can live without loadable stats, for backward compatibility is ok
109
68
  // but hydration errors will occur when lazy component will loaded at client-side at demand
@@ -118,7 +77,9 @@ class ServerLoader extends loader.Loader {
118
77
  return childApp;
119
78
  }
120
79
  async init(config) {
121
- const container = this.loader.getByUrl(config.server.entry);
80
+ const container = this.loader.getByUrl(config.server.entry, {
81
+ debug: config.tag === 'debug',
82
+ });
122
83
  if (!container) {
123
84
  return;
124
85
  }
@@ -141,7 +102,9 @@ class ServerLoader extends loader.Loader {
141
102
  }
142
103
  }
143
104
  get(config) {
144
- const container = this.loader.getByUrl(config.server.entry);
105
+ const container = this.loader.getByUrl(config.server.entry, {
106
+ debug: config.tag === 'debug',
107
+ });
145
108
  if (!container) {
146
109
  return undefined;
147
110
  }
@@ -149,7 +112,9 @@ class ServerLoader extends loader.Loader {
149
112
  return entry && this.resolve(entry);
150
113
  }
151
114
  getStats(config) {
152
- return this.loader.getByUrl(config.client.stats);
115
+ return this.loader.getByUrl(config.client.stats, {
116
+ debug: config.tag === 'debug',
117
+ });
153
118
  }
154
119
  getLoadableStats(config) {
155
120
  if (!config.client.statsLoadable) {
@@ -1,9 +1,9 @@
1
1
  import { combineValidators, isUrl, endsWith } from '@tinkoff/env-validators';
2
2
  import { Scope, optional, DI_TOKEN } from '@tinkoff/dippy';
3
3
  import { provide, TAPABLE_HOOK_FACTORY_TOKEN, commandLineListTokens } from '@tramvai/core';
4
- import { ENV_USED_TOKEN, LOGGER_TOKEN, CREATE_CACHE_TOKEN, ENV_MANAGER_TOKEN, ASYNC_LOCAL_STORAGE_TOKEN, STORE_TOKEN } from '@tramvai/tokens-common';
4
+ import { ENV_USED_TOKEN, LOGGER_TOKEN, ENV_MANAGER_TOKEN, STORE_TOKEN, ASYNC_LOCAL_STORAGE_TOKEN } from '@tramvai/tokens-common';
5
5
  import { RESOURCES_REGISTRY, RENDER_SLOTS, ResourceType, ResourceSlot, RENDER_FLOW_AFTER_TOKEN, REACT_SERVER_RENDER_MODE, EXTEND_RENDER } from '@tramvai/tokens-render';
6
- import { CHILD_APP_LOADER_TOKEN, CHILD_APP_LOADER_PLUGIN, CHILD_APP_LOADER_CACHE_OPTIONS_TOKEN, CHILD_APP_STATE_MANAGER_TOKEN, CHILD_APP_DI_MANAGER_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN, CHILD_APP_PRELOAD_MANAGER_PLUGIN, CHILD_APP_COMMAND_LINE_RUNNER_TOKEN, CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN, CHILD_APP_RESOLVE_CONFIG_TOKEN, CHILD_APP_RENDER_MANAGER_TOKEN, CHILD_APP_CONTRACT_MANAGER, HOST_PROVIDED_CONTRACTS, HOST_REQUIRED_CONTRACTS } from '@tramvai/tokens-child-app';
6
+ import { CHILD_APP_LOADER_TOKEN, CHILD_APP_LOADER_PLUGIN, CHILD_APP_LOADER_CACHE_TOKEN, CHILD_APP_STATE_MANAGER_TOKEN, CHILD_APP_DI_MANAGER_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN, CHILD_APP_PRELOAD_MANAGER_PLUGIN, CHILD_APP_COMMAND_LINE_RUNNER_TOKEN, CHILD_APP_RESOLUTION_CONFIG_MANAGER_TOKEN, CHILD_APP_RESOLVE_CONFIG_TOKEN, CHILD_APP_RENDER_MANAGER_TOKEN, CHILD_APP_CONTRACT_MANAGER, HOST_PROVIDED_CONTRACTS, HOST_REQUIRED_CONTRACTS } from '@tramvai/tokens-child-app';
7
7
  import { safeStringify } from '@tramvai/safe-strings';
8
8
  import { ServerLoader } from './loader.es.js';
9
9
  import { PreloadManager } from './preload.es.js';
@@ -13,8 +13,10 @@ import { RenderManager } from './render.es.js';
13
13
  import { registerChildAppRenderSlots } from './render-slots.es.js';
14
14
  import { GLOBAL_CHILD_STATE } from '../shared/constants.es.js';
15
15
  import { ChildAppContractManager } from '../contracts/contractManager.server.es.js';
16
+ import { cache } from './cache/cache.es.js';
16
17
 
17
18
  const serverProviders = [
19
+ ...cache,
18
20
  provide({
19
21
  provide: ENV_USED_TOKEN,
20
22
  multi: true,
@@ -37,10 +39,8 @@ const serverProviders = [
37
39
  },
38
40
  hookFactory: TAPABLE_HOOK_FACTORY_TOKEN,
39
41
  logger: LOGGER_TOKEN,
40
- createCache: CREATE_CACHE_TOKEN,
41
- cacheOptions: optional(CHILD_APP_LOADER_CACHE_OPTIONS_TOKEN),
42
+ cache: CHILD_APP_LOADER_CACHE_TOKEN,
42
43
  envManager: ENV_MANAGER_TOKEN,
43
- asyncLocalStorage: optional(ASYNC_LOCAL_STORAGE_TOKEN),
44
44
  },
45
45
  }),
46
46
  provide({
@@ -17,8 +17,10 @@ var render = require('./render.js');
17
17
  var renderSlots = require('./render-slots.js');
18
18
  var constants = require('../shared/constants.js');
19
19
  var contractManager_server = require('../contracts/contractManager.server.js');
20
+ var cache = require('./cache/cache.js');
20
21
 
21
22
  const serverProviders = [
23
+ ...cache.cache,
22
24
  core.provide({
23
25
  provide: tokensCommon.ENV_USED_TOKEN,
24
26
  multi: true,
@@ -41,10 +43,8 @@ const serverProviders = [
41
43
  },
42
44
  hookFactory: core.TAPABLE_HOOK_FACTORY_TOKEN,
43
45
  logger: tokensCommon.LOGGER_TOKEN,
44
- createCache: tokensCommon.CREATE_CACHE_TOKEN,
45
- cacheOptions: dippy.optional(tokensChildApp.CHILD_APP_LOADER_CACHE_OPTIONS_TOKEN),
46
+ cache: tokensChildApp.CHILD_APP_LOADER_CACHE_TOKEN,
46
47
  envManager: tokensCommon.ENV_MANAGER_TOKEN,
47
- asyncLocalStorage: dippy.optional(tokensCommon.ASYNC_LOCAL_STORAGE_TOKEN),
48
48
  },
49
49
  }),
50
50
  core.provide({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-child-app",
3
- "version": "5.53.80",
3
+ "version": "6.62.0",
4
4
  "description": "Module for child apps",
5
5
  "browser": {
6
6
  "./lib/server.es.js": "./lib/browser.js",
@@ -30,26 +30,26 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@loadable/server": "^5.15.0",
33
- "@tinkoff/env-validators": "0.4.3",
34
- "@tinkoff/errors": "0.6.4",
35
- "@tinkoff/module-loader-client": "0.7.6",
36
- "@tinkoff/module-loader-server": "0.8.9",
37
- "@tinkoff/url": "0.11.4",
38
- "@tramvai/child-app-core": "5.53.80",
39
- "@tramvai/module-common": "5.53.80",
40
- "@tramvai/safe-strings": "0.8.5",
41
- "@tramvai/tokens-child-app": "5.53.80"
33
+ "@tinkoff/env-validators": "0.5.0",
34
+ "@tinkoff/errors": "0.7.1",
35
+ "@tinkoff/module-loader-client": "0.8.1",
36
+ "@tinkoff/module-loader-server": "0.9.1",
37
+ "@tinkoff/url": "0.12.1",
38
+ "@tramvai/child-app-core": "6.62.0",
39
+ "@tramvai/module-common": "6.62.0",
40
+ "@tramvai/safe-strings": "0.9.0",
41
+ "@tramvai/tokens-child-app": "6.62.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@tinkoff/dippy": "0.11.6",
45
- "@tinkoff/router": "0.5.204",
44
+ "@tinkoff/dippy": "0.12.3",
45
+ "@tinkoff/router": "0.6.105",
46
46
  "@tinkoff/utils": "^2.1.2",
47
- "@tramvai/core": "5.53.80",
48
- "@tramvai/react": "5.53.80",
49
- "@tramvai/state": "5.53.80",
50
- "@tramvai/tokens-common": "5.53.80",
51
- "@tramvai/tokens-render": "5.53.80",
52
- "@tramvai/tokens-router": "5.53.80",
47
+ "@tramvai/core": "6.62.0",
48
+ "@tramvai/react": "6.62.0",
49
+ "@tramvai/state": "6.62.0",
50
+ "@tramvai/tokens-common": "6.62.0",
51
+ "@tramvai/tokens-render": "6.62.0",
52
+ "@tramvai/tokens-router": "6.62.0",
53
53
  "object-assign": "^4.1.1",
54
54
  "react": ">=16.14.0",
55
55
  "react-dom": ">=16.14.0",