@module-federation/dts-plugin 0.0.0-fix-4748-shared-fallback-versions-20260604072020 → 0.0.0-fix-runtime-core-set-shared-lib-20260819111025
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.
- package/dist/{Broker-CaenCqdn.js → Broker-C-uWF8l5.js} +42 -23
- package/dist/CHANGELOG.md +75 -5
- package/dist/{DtsWorker-Dtem3-FM.d.ts → DtsWorker-SBLpkK-D.d.ts} +21 -9
- package/dist/{constant-BwEkyidO.d.ts → constant-C0QI9ddQ.d.ts} +1 -1
- package/dist/{consumeTypes-FbF0o6AJ.js → consumeTypes-DhrUgkUW.js} +1 -1
- package/dist/core.d.ts +2 -2
- package/dist/core.js +3 -3
- package/dist/dynamic-remote-type-hints-plugin.d.ts +7 -0
- package/dist/esm/{Broker-Cmbh_XVO.mjs → Broker-BfFUcTHm.mjs} +42 -22
- package/dist/esm/{consumeTypes-COIltElB.mjs → consumeTypes-WKYNaS9i.mjs} +1 -1
- package/dist/esm/core.mjs +3 -3
- package/dist/esm/{expose-rpc-ZWQxpg0y.mjs → expose-rpc-B0rqtOKP.mjs} +249 -33
- package/dist/esm/fork-dev-worker.mjs +3 -3
- package/dist/esm/fork-generate-dts.mjs +2 -2
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/start-broker.mjs +1 -1
- package/dist/{expose-rpc-XLxmAXIW.js → expose-rpc-jaGpsAVL.js} +249 -35
- package/dist/fork-dev-worker.d.ts +1 -1
- package/dist/fork-dev-worker.js +3 -3
- package/dist/fork-generate-dts.d.ts +1 -1
- package/dist/fork-generate-dts.js +2 -2
- package/dist/index.d.ts +9 -24
- package/dist/index.js +3 -3
- package/dist/start-broker.js +1 -1
- package/package.json +14 -15
|
@@ -12,8 +12,6 @@ os = require_Action.__toESM(os);
|
|
|
12
12
|
let isomorphic_ws = require("isomorphic-ws");
|
|
13
13
|
isomorphic_ws = require_Action.__toESM(isomorphic_ws);
|
|
14
14
|
let http = require("http");
|
|
15
|
-
let node_schedule = require("node-schedule");
|
|
16
|
-
node_schedule = require_Action.__toESM(node_schedule);
|
|
17
15
|
|
|
18
16
|
//#region src/server/message/API/API.ts
|
|
19
17
|
let APIKind = /* @__PURE__ */ function(APIKind) {
|
|
@@ -256,6 +254,46 @@ let UpdateKind = /* @__PURE__ */ function(UpdateKind) {
|
|
|
256
254
|
|
|
257
255
|
//#endregion
|
|
258
256
|
//#region src/server/broker/Broker.ts
|
|
257
|
+
const CLEANUP_HOURS = [
|
|
258
|
+
0,
|
|
259
|
+
3,
|
|
260
|
+
6,
|
|
261
|
+
9,
|
|
262
|
+
12,
|
|
263
|
+
15,
|
|
264
|
+
18
|
|
265
|
+
];
|
|
266
|
+
function getNextCleanupDelay(now = /* @__PURE__ */ new Date()) {
|
|
267
|
+
for (const hour of CLEANUP_HOURS) {
|
|
268
|
+
const candidate = new Date(now);
|
|
269
|
+
candidate.setHours(hour, 0, 0, 0);
|
|
270
|
+
if (candidate.getTime() > now.getTime()) return candidate.getTime() - now.getTime();
|
|
271
|
+
}
|
|
272
|
+
const nextDay = new Date(now);
|
|
273
|
+
nextDay.setDate(nextDay.getDate() + 1);
|
|
274
|
+
nextDay.setHours(CLEANUP_HOURS[0], 0, 0, 0);
|
|
275
|
+
return nextDay.getTime() - now.getTime();
|
|
276
|
+
}
|
|
277
|
+
function scheduleCleanup(callback, testIntervalMs = 0) {
|
|
278
|
+
let timeout;
|
|
279
|
+
let cancelled = false;
|
|
280
|
+
const scheduleNext = () => {
|
|
281
|
+
const delay = testIntervalMs > 0 ? testIntervalMs : getNextCleanupDelay();
|
|
282
|
+
timeout = setTimeout(() => {
|
|
283
|
+
if (cancelled) return;
|
|
284
|
+
callback();
|
|
285
|
+
scheduleNext();
|
|
286
|
+
}, delay);
|
|
287
|
+
};
|
|
288
|
+
scheduleNext();
|
|
289
|
+
return { cancel() {
|
|
290
|
+
cancelled = true;
|
|
291
|
+
if (timeout) {
|
|
292
|
+
clearTimeout(timeout);
|
|
293
|
+
timeout = void 0;
|
|
294
|
+
}
|
|
295
|
+
} };
|
|
296
|
+
}
|
|
259
297
|
var Broker = class Broker {
|
|
260
298
|
static {
|
|
261
299
|
this.WEB_SOCKET_CONNECT_MAGIC_ID = require_Action.WEB_SOCKET_CONNECT_MAGIC_ID;
|
|
@@ -646,32 +684,13 @@ var Broker = class Broker {
|
|
|
646
684
|
});
|
|
647
685
|
}
|
|
648
686
|
_setSchedule() {
|
|
649
|
-
const rule = new node_schedule.default.RecurrenceRule();
|
|
650
|
-
if (Number(process.env["FEDERATION_SERVER_TEST"])) {
|
|
651
|
-
const interval = Number(process.env["FEDERATION_SERVER_TEST"]) / 1e3;
|
|
652
|
-
const second = [];
|
|
653
|
-
for (let i = 0; i < 60; i = i + interval) second.push(i);
|
|
654
|
-
rule.second = second;
|
|
655
|
-
} else {
|
|
656
|
-
rule.second = 0;
|
|
657
|
-
rule.hour = [
|
|
658
|
-
0,
|
|
659
|
-
3,
|
|
660
|
-
6,
|
|
661
|
-
9,
|
|
662
|
-
12,
|
|
663
|
-
15,
|
|
664
|
-
18
|
|
665
|
-
];
|
|
666
|
-
rule.minute = 0;
|
|
667
|
-
}
|
|
668
687
|
const serverTest = Number(process.env["FEDERATION_SERVER_TEST"]);
|
|
669
|
-
this._scheduleJob =
|
|
688
|
+
this._scheduleJob = scheduleCleanup(() => {
|
|
670
689
|
this._tmpSubscriberShelter.forEach((tmpSubscriber, identifier) => {
|
|
671
690
|
fileLog(` _clearTmpSubScriberRelation ${identifier}, ${Date.now() - tmpSubscriber.timestamp >= (process.env["GARFISH_MODULE_SERVER_TEST"] ? serverTest : Broker.DEFAULT_WAITING_TIME)}`, "Broker", "info");
|
|
672
691
|
if (Date.now() - tmpSubscriber.timestamp >= (process.env["FEDERATION_SERVER_TEST"] ? serverTest : Broker.DEFAULT_WAITING_TIME)) this._clearTmpSubScriberRelation(identifier);
|
|
673
692
|
});
|
|
674
|
-
});
|
|
693
|
+
}, serverTest);
|
|
675
694
|
}
|
|
676
695
|
_clearSchedule() {
|
|
677
696
|
if (!this._scheduleJob) return;
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-runtime-core-set-shared-lib-20260819111025
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @module-federation/sdk@0.0.0-fix-runtime-core-set-shared-lib-20260819111025
|
|
8
|
+
- @module-federation/managers@0.0.0-fix-runtime-core-set-shared-lib-20260819111025
|
|
9
|
+
- @module-federation/third-party-dts-extractor@0.0.0-fix-runtime-core-set-shared-lib-20260819111025
|
|
10
|
+
- @module-federation/error-codes@0.0.0-fix-runtime-core-set-shared-lib-20260819111025
|
|
11
|
+
|
|
12
|
+
## 2.8.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- @module-federation/sdk@2.8.2
|
|
17
|
+
- @module-federation/managers@2.8.2
|
|
18
|
+
- @module-federation/third-party-dts-extractor@2.8.2
|
|
19
|
+
- @module-federation/error-codes@2.8.2
|
|
20
|
+
|
|
21
|
+
## 2.8.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 641a0b6: chore(dts-plugin): upgrade adm-zip to 0.6.0 to prevent crafted remote type archives from exhausting process memory during extraction.
|
|
26
|
+
- Updated dependencies [d901e2c]
|
|
27
|
+
- @module-federation/sdk@2.8.1
|
|
28
|
+
- @module-federation/managers@2.8.1
|
|
29
|
+
- @module-federation/third-party-dts-extractor@2.8.1
|
|
30
|
+
- @module-federation/error-codes@2.8.1
|
|
31
|
+
|
|
32
|
+
## 2.8.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- 681e5d2: feat(dts-plugin): support ts 7 for federated type generation while keeping existing ts versions supported
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- 6ee67dc: Reduce installed and bundled size by replacing general-purpose cache, path, version, package lookup, scheduling, fetch, and error fallback dependencies with focused built-in utilities.
|
|
41
|
+
- Updated dependencies [ea490ae]
|
|
42
|
+
- Updated dependencies [6ee67dc]
|
|
43
|
+
- @module-federation/sdk@2.8.0
|
|
44
|
+
- @module-federation/managers@2.8.0
|
|
45
|
+
- @module-federation/third-party-dts-extractor@2.8.0
|
|
46
|
+
- @module-federation/error-codes@2.8.0
|
|
47
|
+
|
|
48
|
+
## 2.7.0
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- a7351f3: chore(dts-plugin): drop `ansi-colors` dependency in favor of inline ANSI escape for the single red error message.
|
|
53
|
+
- Updated dependencies [dcc640b]
|
|
54
|
+
- Updated dependencies [2add9ef]
|
|
55
|
+
- Updated dependencies [9958086]
|
|
56
|
+
- Updated dependencies [a5f123a]
|
|
57
|
+
- Updated dependencies [8ec950c]
|
|
58
|
+
- @module-federation/sdk@2.7.0
|
|
59
|
+
- @module-federation/third-party-dts-extractor@2.7.0
|
|
60
|
+
- @module-federation/managers@2.7.0
|
|
61
|
+
- @module-federation/error-codes@2.7.0
|
|
62
|
+
|
|
63
|
+
## 2.6.0
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- 2a7f724: Fix dts-plugin expose resolution for extensionless multi-dot paths like `foo.generated` so they correctly infer supported source files such as `.ts`, `.tsx`, `.vue`, `.js`, and `.jsx`, while preserving explicit extensions and directory `index` fallback behavior.
|
|
68
|
+
- @module-federation/sdk@2.6.0
|
|
69
|
+
- @module-federation/managers@2.6.0
|
|
70
|
+
- @module-federation/third-party-dts-extractor@2.6.0
|
|
71
|
+
- @module-federation/error-codes@2.6.0
|
|
72
|
+
|
|
73
|
+
## 2.5.1
|
|
4
74
|
|
|
5
75
|
### Patch Changes
|
|
6
76
|
|
|
@@ -8,10 +78,10 @@
|
|
|
8
78
|
- b553153: Fix `__dirname is not defined` ReferenceError when `@module-federation/dts-plugin` is consumed as ESM. `DevWorker`, `DevPlugin`, and `createBroker` now derive `__dirname` from `import.meta.url` (matching the existing `DtsWorker` shim) so the ESM build no longer emits bare `__dirname`.
|
|
9
79
|
- b9b3b8c: Fix Windows manifest type URL resolution in dts-plugin consumeTypes and allow the default IP family option to auto-select with `0`.
|
|
10
80
|
- Updated dependencies [b9b3b8c]
|
|
11
|
-
- @module-federation/sdk@
|
|
12
|
-
- @module-federation/managers@
|
|
13
|
-
- @module-federation/third-party-dts-extractor@
|
|
14
|
-
- @module-federation/error-codes@
|
|
81
|
+
- @module-federation/sdk@2.5.1
|
|
82
|
+
- @module-federation/managers@2.5.1
|
|
83
|
+
- @module-federation/third-party-dts-extractor@2.5.1
|
|
84
|
+
- @module-federation/error-codes@2.5.1
|
|
15
85
|
|
|
16
86
|
## 2.5.0
|
|
17
87
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { moduleFederationPlugin } from "@module-federation/sdk";
|
|
2
|
-
import ts from "typescript";
|
|
3
2
|
import { ChildProcess } from "child_process";
|
|
4
3
|
|
|
5
4
|
//#region \0rolldown/runtime.js
|
|
@@ -14,18 +13,31 @@ interface RemoteOptions extends moduleFederationPlugin.DtsRemoteOptions {
|
|
|
14
13
|
}
|
|
15
14
|
//#endregion
|
|
16
15
|
//#region src/core/interfaces/TsConfigJson.d.ts
|
|
16
|
+
type TsConfigCompilerOptions = Record<string, any> & {
|
|
17
|
+
rootDir?: string;
|
|
18
|
+
outDir?: string;
|
|
19
|
+
declarationDir?: string;
|
|
20
|
+
tsBuildInfoFile?: string;
|
|
21
|
+
incremental?: boolean;
|
|
22
|
+
paths?: Record<string, string[]>;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
};
|
|
17
25
|
interface TsConfigJson {
|
|
18
26
|
extends?: string;
|
|
19
|
-
compilerOptions?:
|
|
27
|
+
compilerOptions?: TsConfigCompilerOptions;
|
|
20
28
|
exclude?: string[];
|
|
21
29
|
include?: string[];
|
|
22
30
|
files?: string[];
|
|
31
|
+
references?: Array<{
|
|
32
|
+
path: string;
|
|
33
|
+
}>;
|
|
34
|
+
[key: string]: any;
|
|
23
35
|
}
|
|
24
36
|
//#endregion
|
|
25
37
|
//#region src/core/configurations/remotePlugin.d.ts
|
|
26
38
|
declare const retrieveRemoteConfig: (options: RemoteOptions) => {
|
|
27
39
|
tsConfig: TsConfigJson;
|
|
28
|
-
mapComponentsToExpose:
|
|
40
|
+
mapComponentsToExpose: any;
|
|
29
41
|
remoteOptions: Required<RemoteOptions>;
|
|
30
42
|
};
|
|
31
43
|
//#endregion
|
|
@@ -78,12 +90,12 @@ declare class DTSManager {
|
|
|
78
90
|
extractRemoteTypes(options: ReturnType<typeof retrieveRemoteConfig>): Promise<void>;
|
|
79
91
|
generateTypes(): Promise<void>;
|
|
80
92
|
requestRemoteManifest(remoteInfo: RemoteInfo, hostOptions: Required<HostOptions>): Promise<Required<RemoteInfo>>;
|
|
81
|
-
consumeTargetRemotes(hostOptions: Required<HostOptions>, remoteInfo: Required<RemoteInfo>): Promise<[string, string]>;
|
|
82
|
-
downloadAPITypes(remoteInfo: Required<RemoteInfo>, destinationPath: string, hostOptions: Required<HostOptions>): Promise<boolean>;
|
|
93
|
+
consumeTargetRemotes(hostOptions: Required<HostOptions>, remoteInfo: Required<RemoteInfo>): Promise<[string, string] | undefined>;
|
|
94
|
+
downloadAPITypes(remoteInfo: Required<RemoteInfo>, destinationPath: string, hostOptions: Required<HostOptions>): Promise<boolean | undefined>;
|
|
83
95
|
consumeAPITypes(hostOptions: Required<HostOptions>): void;
|
|
84
96
|
consumeArchiveTypes(options: HostOptions): Promise<{
|
|
85
97
|
hostOptions: Required<HostOptions>;
|
|
86
|
-
downloadPromisesResult: PromiseSettledResult<[string, string]>[];
|
|
98
|
+
downloadPromisesResult: PromiseSettledResult<[string, string] | undefined>[];
|
|
87
99
|
}>;
|
|
88
100
|
consumeTypes(): Promise<void>;
|
|
89
101
|
updateTypes(options: UpdateTypesOptions): Promise<void>;
|
|
@@ -143,9 +155,9 @@ declare function getRpcWorkerData(): unknown;
|
|
|
143
155
|
//#endregion
|
|
144
156
|
//#region src/core/rpc/rpc-error.d.ts
|
|
145
157
|
declare class RpcExitError extends Error {
|
|
146
|
-
readonly code?: string | number | null;
|
|
147
|
-
readonly signal?: string | null;
|
|
148
|
-
constructor(message: string, code?: string | number | null, signal?: string | null);
|
|
158
|
+
readonly code?: string | number | null | undefined;
|
|
159
|
+
readonly signal?: string | null | undefined;
|
|
160
|
+
constructor(message: string, code?: string | number | null | undefined, signal?: string | null | undefined);
|
|
149
161
|
}
|
|
150
162
|
declare namespace index_d_exports {
|
|
151
163
|
export { RpcCallMessage, RpcExitError, RpcGMCallTypes, RpcMessage, RpcMethod, RpcRejectMessage, RpcRemoteMethod, RpcResolveMessage, RpcWorker, createRpcWorker, exposeRpc, getRpcWorkerData, wrapRpc };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DTSManagerOptions, i as DTSManager, l as TsConfigJson, o as HostOptions, s as RemoteInfo, u as RemoteOptions } from "./DtsWorker-
|
|
1
|
+
import { a as DTSManagerOptions, i as DTSManager, l as TsConfigJson, o as HostOptions, s as RemoteInfo, u as RemoteOptions } from "./DtsWorker-SBLpkK-D.js";
|
|
2
2
|
import { moduleFederationPlugin } from "@module-federation/sdk";
|
|
3
3
|
|
|
4
4
|
//#region src/core/configurations/hostPlugin.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_Action = require('./Action-CzhPMw2i.js');
|
|
2
|
-
const require_expose_rpc = require('./expose-rpc-
|
|
2
|
+
const require_expose_rpc = require('./expose-rpc-jaGpsAVL.js');
|
|
3
3
|
let url = require("url");
|
|
4
4
|
let path = require("path");
|
|
5
5
|
path = require_Action.__toESM(path);
|
package/dist/core.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as DTSManagerOptions, c as retrieveRemoteConfig, i as DTSManager, o as HostOptions, r as index_d_exports, t as DtsWorker, u as RemoteOptions } from "./DtsWorker-
|
|
2
|
-
import { a as generateTypesInChildProcess, c as retrieveMfTypesPath, d as isTSProject, f as retrieveTypesAssetsInfo, i as consumeTypes, l as retrieveOriginalOutDir, m as retrieveHostConfig, n as REMOTE_ALIAS_IDENTIFIER, o as generateTypes, p as validateOptions, r as REMOTE_API_TYPES_FILE_NAME, s as retrieveTypesZipPath, t as HOST_API_TYPES_FILE_NAME, u as getDTSManagerConstructor } from "./constant-
|
|
1
|
+
import { a as DTSManagerOptions, c as retrieveRemoteConfig, i as DTSManager, o as HostOptions, r as index_d_exports, t as DtsWorker, u as RemoteOptions } from "./DtsWorker-SBLpkK-D.js";
|
|
2
|
+
import { a as generateTypesInChildProcess, c as retrieveMfTypesPath, d as isTSProject, f as retrieveTypesAssetsInfo, i as consumeTypes, l as retrieveOriginalOutDir, m as retrieveHostConfig, n as REMOTE_ALIAS_IDENTIFIER, o as generateTypes, p as validateOptions, r as REMOTE_API_TYPES_FILE_NAME, s as retrieveTypesZipPath, t as HOST_API_TYPES_FILE_NAME, u as getDTSManagerConstructor } from "./constant-C0QI9ddQ.js";
|
|
3
3
|
export { DTSManager, type DTSManagerOptions, DtsWorker, HOST_API_TYPES_FILE_NAME, type HostOptions, REMOTE_ALIAS_IDENTIFIER, REMOTE_API_TYPES_FILE_NAME, type RemoteOptions, consumeTypes, generateTypes, generateTypesInChildProcess, getDTSManagerConstructor, isTSProject, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveRemoteConfig, retrieveTypesAssetsInfo, retrieveTypesZipPath, index_d_exports as rpc, validateOptions };
|
package/dist/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
require('./Broker-
|
|
3
|
-
const require_expose_rpc = require('./expose-rpc-
|
|
4
|
-
const require_consumeTypes = require('./consumeTypes-
|
|
2
|
+
require('./Broker-C-uWF8l5.js');
|
|
3
|
+
const require_expose_rpc = require('./expose-rpc-jaGpsAVL.js');
|
|
4
|
+
const require_consumeTypes = require('./consumeTypes-DhrUgkUW.js');
|
|
5
5
|
|
|
6
6
|
exports.DTSManager = require_expose_rpc.DTSManager;
|
|
7
7
|
exports.DtsWorker = require_consumeTypes.DtsWorker;
|
|
@@ -177,6 +177,11 @@ interface PreloadRemoteArgs {
|
|
|
177
177
|
share?: boolean;
|
|
178
178
|
depsRemote?: boolean | Array<depsPreloadArg>;
|
|
179
179
|
filter?: (assetUrl: string) => boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Record preloaded JS and CSS URLs to skip duplicate resource loading.
|
|
182
|
+
* @default true
|
|
183
|
+
*/
|
|
184
|
+
recordPreloadedAssets?: boolean;
|
|
180
185
|
}
|
|
181
186
|
type PreloadConfig = PreloadRemoteArgs;
|
|
182
187
|
type PreloadOptions = Array<{
|
|
@@ -338,6 +343,7 @@ declare class RemoteHandler {
|
|
|
338
343
|
registerRemotes(remotes: Remote[], options?: {
|
|
339
344
|
force?: boolean;
|
|
340
345
|
}): void;
|
|
346
|
+
initRawContainer(name: string, url: string, container: RemoteEntryExports): Module$1;
|
|
341
347
|
getRemoteModuleAndOptions(options: {
|
|
342
348
|
id: string;
|
|
343
349
|
}): Promise<{
|
|
@@ -476,6 +482,7 @@ interface Federation {
|
|
|
476
482
|
__SHARE__: GlobalShareScopeMap;
|
|
477
483
|
__MANIFEST_LOADING__: Record<string, Promise<ModuleInfo>>;
|
|
478
484
|
__PRELOADED_MAP__: Map<string, boolean>;
|
|
485
|
+
__PRELOADED_ASSETS__: Set<string>;
|
|
479
486
|
}
|
|
480
487
|
declare global {
|
|
481
488
|
var __FEDERATION__: Federation, __VMOK__: Federation, __GLOBAL_LOADING_REMOTE_ENTRY__: Record<string, undefined | Promise<RemoteEntryExports | void>>;
|
|
@@ -7,7 +7,6 @@ import net from "net";
|
|
|
7
7
|
import os from "os";
|
|
8
8
|
import WebSocket from "isomorphic-ws";
|
|
9
9
|
import { createServer } from "http";
|
|
10
|
-
import schedule from "node-schedule";
|
|
11
10
|
|
|
12
11
|
//#region src/server/message/API/API.ts
|
|
13
12
|
let APIKind = /* @__PURE__ */ function(APIKind) {
|
|
@@ -250,6 +249,46 @@ let UpdateKind = /* @__PURE__ */ function(UpdateKind) {
|
|
|
250
249
|
|
|
251
250
|
//#endregion
|
|
252
251
|
//#region src/server/broker/Broker.ts
|
|
252
|
+
const CLEANUP_HOURS = [
|
|
253
|
+
0,
|
|
254
|
+
3,
|
|
255
|
+
6,
|
|
256
|
+
9,
|
|
257
|
+
12,
|
|
258
|
+
15,
|
|
259
|
+
18
|
|
260
|
+
];
|
|
261
|
+
function getNextCleanupDelay(now = /* @__PURE__ */ new Date()) {
|
|
262
|
+
for (const hour of CLEANUP_HOURS) {
|
|
263
|
+
const candidate = new Date(now);
|
|
264
|
+
candidate.setHours(hour, 0, 0, 0);
|
|
265
|
+
if (candidate.getTime() > now.getTime()) return candidate.getTime() - now.getTime();
|
|
266
|
+
}
|
|
267
|
+
const nextDay = new Date(now);
|
|
268
|
+
nextDay.setDate(nextDay.getDate() + 1);
|
|
269
|
+
nextDay.setHours(CLEANUP_HOURS[0], 0, 0, 0);
|
|
270
|
+
return nextDay.getTime() - now.getTime();
|
|
271
|
+
}
|
|
272
|
+
function scheduleCleanup(callback, testIntervalMs = 0) {
|
|
273
|
+
let timeout;
|
|
274
|
+
let cancelled = false;
|
|
275
|
+
const scheduleNext = () => {
|
|
276
|
+
const delay = testIntervalMs > 0 ? testIntervalMs : getNextCleanupDelay();
|
|
277
|
+
timeout = setTimeout(() => {
|
|
278
|
+
if (cancelled) return;
|
|
279
|
+
callback();
|
|
280
|
+
scheduleNext();
|
|
281
|
+
}, delay);
|
|
282
|
+
};
|
|
283
|
+
scheduleNext();
|
|
284
|
+
return { cancel() {
|
|
285
|
+
cancelled = true;
|
|
286
|
+
if (timeout) {
|
|
287
|
+
clearTimeout(timeout);
|
|
288
|
+
timeout = void 0;
|
|
289
|
+
}
|
|
290
|
+
} };
|
|
291
|
+
}
|
|
253
292
|
var Broker = class Broker {
|
|
254
293
|
static {
|
|
255
294
|
this.WEB_SOCKET_CONNECT_MAGIC_ID = WEB_SOCKET_CONNECT_MAGIC_ID;
|
|
@@ -640,32 +679,13 @@ var Broker = class Broker {
|
|
|
640
679
|
});
|
|
641
680
|
}
|
|
642
681
|
_setSchedule() {
|
|
643
|
-
const rule = new schedule.RecurrenceRule();
|
|
644
|
-
if (Number(process.env["FEDERATION_SERVER_TEST"])) {
|
|
645
|
-
const interval = Number(process.env["FEDERATION_SERVER_TEST"]) / 1e3;
|
|
646
|
-
const second = [];
|
|
647
|
-
for (let i = 0; i < 60; i = i + interval) second.push(i);
|
|
648
|
-
rule.second = second;
|
|
649
|
-
} else {
|
|
650
|
-
rule.second = 0;
|
|
651
|
-
rule.hour = [
|
|
652
|
-
0,
|
|
653
|
-
3,
|
|
654
|
-
6,
|
|
655
|
-
9,
|
|
656
|
-
12,
|
|
657
|
-
15,
|
|
658
|
-
18
|
|
659
|
-
];
|
|
660
|
-
rule.minute = 0;
|
|
661
|
-
}
|
|
662
682
|
const serverTest = Number(process.env["FEDERATION_SERVER_TEST"]);
|
|
663
|
-
this._scheduleJob =
|
|
683
|
+
this._scheduleJob = scheduleCleanup(() => {
|
|
664
684
|
this._tmpSubscriberShelter.forEach((tmpSubscriber, identifier) => {
|
|
665
685
|
fileLog(` _clearTmpSubScriberRelation ${identifier}, ${Date.now() - tmpSubscriber.timestamp >= (process.env["GARFISH_MODULE_SERVER_TEST"] ? serverTest : Broker.DEFAULT_WAITING_TIME)}`, "Broker", "info");
|
|
666
686
|
if (Date.now() - tmpSubscriber.timestamp >= (process.env["FEDERATION_SERVER_TEST"] ? serverTest : Broker.DEFAULT_WAITING_TIME)) this._clearTmpSubScriberRelation(identifier);
|
|
667
687
|
});
|
|
668
|
-
});
|
|
688
|
+
}, serverTest);
|
|
669
689
|
}
|
|
670
690
|
_clearSchedule() {
|
|
671
691
|
if (!this._scheduleJob) return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as cloneDeepOptions, n as RpcGMCallTypes, o as getDTSManagerConstructor, s as isDebugMode, t as exposeRpc, x as __exportAll } from "./expose-rpc-
|
|
1
|
+
import { a as cloneDeepOptions, n as RpcGMCallTypes, o as getDTSManagerConstructor, s as isDebugMode, t as exposeRpc, x as __exportAll } from "./expose-rpc-B0rqtOKP.mjs";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { randomUUID } from "crypto";
|
package/dist/esm/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as retrieveMfTypesPath, c as isTSProject, d as DTSManager, f as HOST_API_TYPES_FILE_NAME, g as retrieveTypesZipPath, h as retrieveHostConfig, i as retrieveRemoteConfig, l as retrieveTypesAssetsInfo, m as REMOTE_API_TYPES_FILE_NAME, o as getDTSManagerConstructor, p as REMOTE_ALIAS_IDENTIFIER, r as generateTypes, u as validateOptions, v as retrieveOriginalOutDir } from "./expose-rpc-
|
|
2
|
-
import "./Broker-
|
|
3
|
-
import { i as rpc_exports, n as generateTypesInChildProcess, r as DtsWorker, t as consumeTypes } from "./consumeTypes-
|
|
1
|
+
import { _ as retrieveMfTypesPath, c as isTSProject, d as DTSManager, f as HOST_API_TYPES_FILE_NAME, g as retrieveTypesZipPath, h as retrieveHostConfig, i as retrieveRemoteConfig, l as retrieveTypesAssetsInfo, m as REMOTE_API_TYPES_FILE_NAME, o as getDTSManagerConstructor, p as REMOTE_ALIAS_IDENTIFIER, r as generateTypes, u as validateOptions, v as retrieveOriginalOutDir } from "./expose-rpc-B0rqtOKP.mjs";
|
|
2
|
+
import "./Broker-BfFUcTHm.mjs";
|
|
3
|
+
import { i as rpc_exports, n as generateTypesInChildProcess, r as DtsWorker, t as consumeTypes } from "./consumeTypes-WKYNaS9i.mjs";
|
|
4
4
|
|
|
5
5
|
export { DTSManager, DtsWorker, HOST_API_TYPES_FILE_NAME, REMOTE_ALIAS_IDENTIFIER, REMOTE_API_TYPES_FILE_NAME, consumeTypes, generateTypes, generateTypesInChildProcess, getDTSManagerConstructor, isTSProject, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveRemoteConfig, retrieveTypesAssetsInfo, retrieveTypesZipPath, rpc_exports as rpc, validateOptions };
|