@module-federation/dts-plugin 0.11.1 → 0.11.2
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/CHANGELOG.md +10 -0
- package/dist/{DtsWorker-bfe21fe7.d.ts → DTSManager-81645796.d.ts} +1 -53
- package/dist/DtsWorker-c39c84fb.d.ts +56 -0
- package/dist/core.d.mts +7 -15
- package/dist/core.d.ts +7 -15
- package/dist/core.js +28 -3
- package/dist/esm/{chunk-KCWHOFI6.js → chunk-56UE3H52.js} +1 -1
- package/dist/esm/{chunk-4XJKD7QF.js → chunk-A4MGPQ34.js} +29 -4
- package/dist/esm/{chunk-UUXLCZNG.js → chunk-GX5A7XT2.js} +2 -2
- package/dist/esm/{chunk-QAUALHAU.js → chunk-L22LIZUP.js} +1 -1
- package/dist/esm/{chunk-4CSLH7II.js → chunk-SPSJLB6F.js} +1 -1
- package/dist/esm/core.js +4 -4
- package/dist/esm/dynamic-remote-type-hints-plugin.js +2 -2
- package/dist/esm/fork-dev-worker.js +5 -5
- package/dist/esm/fork-generate-dts.js +3 -3
- package/dist/esm/index.js +149 -106
- package/dist/esm/start-broker.js +2 -2
- package/dist/fork-dev-worker.js +28 -3
- package/dist/fork-generate-dts.d.mts +2 -1
- package/dist/fork-generate-dts.d.ts +2 -1
- package/dist/fork-generate-dts.js +28 -3
- package/dist/index.d.mts +43 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.js +180 -106
- package/dist/package.json +2 -2
- package/dist/start-broker.js +1 -1
- package/dist/utils-0ec746b7.d.ts +16 -0
- package/package.json +7 -7
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
+
## 0.11.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [047857b]
|
|
8
|
+
- @module-federation/sdk@0.11.2
|
|
9
|
+
- @module-federation/managers@0.11.2
|
|
10
|
+
- @module-federation/third-party-dts-extractor@0.11.2
|
|
11
|
+
- @module-federation/error-codes@0.11.2
|
|
12
|
+
|
|
3
13
|
## 0.11.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChildProcess } from 'child_process';
|
|
2
1
|
import { a as RemoteOptions, D as DTSManagerOptions, R as RemoteInfo, H as HostOptions } from './DTSManagerOptions-c74c59ed.js';
|
|
3
2
|
import ts from 'typescript';
|
|
4
3
|
|
|
@@ -51,55 +50,4 @@ declare class DTSManager {
|
|
|
51
50
|
updateTypes(options: UpdateTypesOptions): Promise<void>;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
CALL = "mf_call",
|
|
56
|
-
RESOLVE = "mf_resolve",
|
|
57
|
-
REJECT = "mf_reject",
|
|
58
|
-
EXIT = "mf_exit"
|
|
59
|
-
}
|
|
60
|
-
interface RpcCallMessage {
|
|
61
|
-
type: RpcGMCallTypes.CALL;
|
|
62
|
-
id: string;
|
|
63
|
-
args: unknown[];
|
|
64
|
-
}
|
|
65
|
-
interface RpcResolveMessage {
|
|
66
|
-
type: RpcGMCallTypes.RESOLVE;
|
|
67
|
-
id: string;
|
|
68
|
-
value: unknown;
|
|
69
|
-
}
|
|
70
|
-
interface RpcRejectMessage {
|
|
71
|
-
type: RpcGMCallTypes.REJECT;
|
|
72
|
-
id: string;
|
|
73
|
-
error: unknown;
|
|
74
|
-
}
|
|
75
|
-
interface RpcExitMessage {
|
|
76
|
-
type: RpcGMCallTypes.EXIT;
|
|
77
|
-
id: string;
|
|
78
|
-
}
|
|
79
|
-
type RpcMessage = RpcCallMessage | RpcResolveMessage | RpcRejectMessage | RpcExitMessage;
|
|
80
|
-
type RpcMethod = (...args: any[]) => any;
|
|
81
|
-
type RpcRemoteMethod<T extends RpcMethod> = T extends (...args: infer A) => infer R ? R extends Promise<any> ? (...args: A) => R : (...args: A) => Promise<R> : (...args: unknown[]) => Promise<unknown>;
|
|
82
|
-
|
|
83
|
-
interface RpcWorkerBase {
|
|
84
|
-
connect(...args: unknown[]): any;
|
|
85
|
-
terminate(): void;
|
|
86
|
-
readonly connected: boolean;
|
|
87
|
-
readonly id: string;
|
|
88
|
-
readonly process: ChildProcess | undefined;
|
|
89
|
-
}
|
|
90
|
-
type RpcWorker<T extends RpcMethod = RpcMethod> = RpcWorkerBase & RpcRemoteMethod<T>;
|
|
91
|
-
declare function createRpcWorker<T extends RpcMethod>(modulePath: string, data: unknown, memoryLimit?: number, once?: boolean): RpcWorker<T>;
|
|
92
|
-
declare function getRpcWorkerData(): unknown;
|
|
93
|
-
|
|
94
|
-
type DtsWorkerOptions = DTSManagerOptions;
|
|
95
|
-
declare class DtsWorker {
|
|
96
|
-
rpcWorker: RpcWorker<RpcMethod>;
|
|
97
|
-
private _options;
|
|
98
|
-
private _res;
|
|
99
|
-
constructor(options: DtsWorkerOptions);
|
|
100
|
-
removeUnSerializationOptions(): void;
|
|
101
|
-
get controlledPromise(): ReturnType<DTSManager['generateTypes']>;
|
|
102
|
-
exit(): void;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export { DTSManager as D, RpcRemoteMethod as R, TsConfigJson as T, RpcCallMessage as a, RpcGMCallTypes as b, RpcMessage as c, RpcMethod as d, RpcRejectMessage as e, RpcResolveMessage as f, RpcWorker as g, createRpcWorker as h, getRpcWorkerData as i, DtsWorker as j, DtsWorkerOptions as k, retrieveRemoteConfig as r };
|
|
53
|
+
export { DTSManager as D, TsConfigJson as T, retrieveRemoteConfig as r };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ChildProcess } from 'child_process';
|
|
2
|
+
import { D as DTSManagerOptions } from './DTSManagerOptions-c74c59ed.js';
|
|
3
|
+
import { D as DTSManager } from './DTSManager-81645796.js';
|
|
4
|
+
|
|
5
|
+
declare enum RpcGMCallTypes {
|
|
6
|
+
CALL = "mf_call",
|
|
7
|
+
RESOLVE = "mf_resolve",
|
|
8
|
+
REJECT = "mf_reject",
|
|
9
|
+
EXIT = "mf_exit"
|
|
10
|
+
}
|
|
11
|
+
interface RpcCallMessage {
|
|
12
|
+
type: RpcGMCallTypes.CALL;
|
|
13
|
+
id: string;
|
|
14
|
+
args: unknown[];
|
|
15
|
+
}
|
|
16
|
+
interface RpcResolveMessage {
|
|
17
|
+
type: RpcGMCallTypes.RESOLVE;
|
|
18
|
+
id: string;
|
|
19
|
+
value: unknown;
|
|
20
|
+
}
|
|
21
|
+
interface RpcRejectMessage {
|
|
22
|
+
type: RpcGMCallTypes.REJECT;
|
|
23
|
+
id: string;
|
|
24
|
+
error: unknown;
|
|
25
|
+
}
|
|
26
|
+
interface RpcExitMessage {
|
|
27
|
+
type: RpcGMCallTypes.EXIT;
|
|
28
|
+
id: string;
|
|
29
|
+
}
|
|
30
|
+
type RpcMessage = RpcCallMessage | RpcResolveMessage | RpcRejectMessage | RpcExitMessage;
|
|
31
|
+
type RpcMethod = (...args: any[]) => any;
|
|
32
|
+
type RpcRemoteMethod<T extends RpcMethod> = T extends (...args: infer A) => infer R ? R extends Promise<any> ? (...args: A) => R : (...args: A) => Promise<R> : (...args: unknown[]) => Promise<unknown>;
|
|
33
|
+
|
|
34
|
+
interface RpcWorkerBase {
|
|
35
|
+
connect(...args: unknown[]): any;
|
|
36
|
+
terminate(): void;
|
|
37
|
+
readonly connected: boolean;
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly process: ChildProcess | undefined;
|
|
40
|
+
}
|
|
41
|
+
type RpcWorker<T extends RpcMethod = RpcMethod> = RpcWorkerBase & RpcRemoteMethod<T>;
|
|
42
|
+
declare function createRpcWorker<T extends RpcMethod>(modulePath: string, data: unknown, memoryLimit?: number, once?: boolean): RpcWorker<T>;
|
|
43
|
+
declare function getRpcWorkerData(): unknown;
|
|
44
|
+
|
|
45
|
+
type DtsWorkerOptions = DTSManagerOptions;
|
|
46
|
+
declare class DtsWorker {
|
|
47
|
+
rpcWorker: RpcWorker<RpcMethod>;
|
|
48
|
+
private _options;
|
|
49
|
+
private _res;
|
|
50
|
+
constructor(options: DtsWorkerOptions);
|
|
51
|
+
removeUnSerializationOptions(): void;
|
|
52
|
+
get controlledPromise(): ReturnType<DTSManager['generateTypes']>;
|
|
53
|
+
exit(): void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { DtsWorker as D, RpcRemoteMethod as R, RpcCallMessage as a, RpcGMCallTypes as b, RpcMessage as c, RpcMethod as d, RpcRejectMessage as e, RpcResolveMessage as f, RpcWorker as g, createRpcWorker as h, getRpcWorkerData as i, DtsWorkerOptions as j };
|
package/dist/core.d.mts
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { T as TsConfigJson } from './DTSManager-81645796.js';
|
|
2
|
+
export { D as DTSManager, r as retrieveRemoteConfig } from './DTSManager-81645796.js';
|
|
3
3
|
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-c74c59ed.js';
|
|
4
|
-
|
|
4
|
+
export { g as getDTSManagerConstructor, i as isTSProject, r as retrieveTypesAssetsInfo, v as validateOptions } from './utils-0ec746b7.js';
|
|
5
|
+
import { R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-c39c84fb.js';
|
|
6
|
+
export { D as DtsWorker } from './DtsWorker-c39c84fb.js';
|
|
5
7
|
import { ChildProcess } from 'child_process';
|
|
6
8
|
import 'typescript';
|
|
9
|
+
import '@module-federation/sdk';
|
|
7
10
|
|
|
8
11
|
declare const retrieveHostConfig: (options: HostOptions) => {
|
|
9
12
|
hostOptions: Required<HostOptions>;
|
|
10
13
|
mapRemotesToDownload: Record<string, RemoteInfo>;
|
|
11
14
|
};
|
|
12
15
|
|
|
13
|
-
declare function getDTSManagerConstructor(implementation?: string): typeof DTSManager;
|
|
14
|
-
declare const validateOptions: (options: HostOptions) => void;
|
|
15
|
-
declare function retrieveTypesAssetsInfo(options: RemoteOptions): {
|
|
16
|
-
zipPrefix: string;
|
|
17
|
-
apiTypesPath: string;
|
|
18
|
-
zipTypesPath: string;
|
|
19
|
-
zipName: string;
|
|
20
|
-
apiFileName: string;
|
|
21
|
-
};
|
|
22
|
-
declare const isTSProject: (dtsOptions: moduleFederationPlugin.ModuleFederationPluginOptions["dts"], context?: string) => boolean;
|
|
23
|
-
|
|
24
16
|
declare const retrieveMfTypesPath: (tsConfig: TsConfigJson, remoteOptions: Required<RemoteOptions>) => string;
|
|
25
17
|
declare const retrieveOriginalOutDir: (tsConfig: TsConfigJson, remoteOptions: Required<RemoteOptions>) => string;
|
|
26
18
|
|
|
@@ -87,4 +79,4 @@ declare const REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
|
87
79
|
declare const REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
88
80
|
declare const HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
89
81
|
|
|
90
|
-
export {
|
|
82
|
+
export { DTSManagerOptions, HOST_API_TYPES_FILE_NAME, HostOptions, REMOTE_ALIAS_IDENTIFIER, REMOTE_API_TYPES_FILE_NAME, RemoteOptions, consumeTypes, generateTypes, generateTypesInChildProcess, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveTypesZipPath, index as rpc };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { T as TsConfigJson } from './DTSManager-81645796.js';
|
|
2
|
+
export { D as DTSManager, r as retrieveRemoteConfig } from './DTSManager-81645796.js';
|
|
3
3
|
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-c74c59ed.js';
|
|
4
|
-
|
|
4
|
+
export { g as getDTSManagerConstructor, i as isTSProject, r as retrieveTypesAssetsInfo, v as validateOptions } from './utils-0ec746b7.js';
|
|
5
|
+
import { R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-c39c84fb.js';
|
|
6
|
+
export { D as DtsWorker } from './DtsWorker-c39c84fb.js';
|
|
5
7
|
import { ChildProcess } from 'child_process';
|
|
6
8
|
import 'typescript';
|
|
9
|
+
import '@module-federation/sdk';
|
|
7
10
|
|
|
8
11
|
declare const retrieveHostConfig: (options: HostOptions) => {
|
|
9
12
|
hostOptions: Required<HostOptions>;
|
|
10
13
|
mapRemotesToDownload: Record<string, RemoteInfo>;
|
|
11
14
|
};
|
|
12
15
|
|
|
13
|
-
declare function getDTSManagerConstructor(implementation?: string): typeof DTSManager;
|
|
14
|
-
declare const validateOptions: (options: HostOptions) => void;
|
|
15
|
-
declare function retrieveTypesAssetsInfo(options: RemoteOptions): {
|
|
16
|
-
zipPrefix: string;
|
|
17
|
-
apiTypesPath: string;
|
|
18
|
-
zipTypesPath: string;
|
|
19
|
-
zipName: string;
|
|
20
|
-
apiFileName: string;
|
|
21
|
-
};
|
|
22
|
-
declare const isTSProject: (dtsOptions: moduleFederationPlugin.ModuleFederationPluginOptions["dts"], context?: string) => boolean;
|
|
23
|
-
|
|
24
16
|
declare const retrieveMfTypesPath: (tsConfig: TsConfigJson, remoteOptions: Required<RemoteOptions>) => string;
|
|
25
17
|
declare const retrieveOriginalOutDir: (tsConfig: TsConfigJson, remoteOptions: Required<RemoteOptions>) => string;
|
|
26
18
|
|
|
@@ -87,4 +79,4 @@ declare const REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
|
87
79
|
declare const REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
88
80
|
declare const HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
89
81
|
|
|
90
|
-
export {
|
|
82
|
+
export { DTSManagerOptions, HOST_API_TYPES_FILE_NAME, HostOptions, REMOTE_ALIAS_IDENTIFIER, REMOTE_API_TYPES_FILE_NAME, RemoteOptions, consumeTypes, generateTypes, generateTypesInChildProcess, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveTypesZipPath, index as rpc };
|
package/dist/core.js
CHANGED
|
@@ -372,7 +372,7 @@ var log4js = __toESM(require("log4js"));
|
|
|
372
372
|
// packages/dts-plugin/src/server/constant.ts
|
|
373
373
|
var DEFAULT_WEB_SOCKET_PORT = 16322;
|
|
374
374
|
var WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
|
|
375
|
-
var MF_SERVER_IDENTIFIER = "Module Federation
|
|
375
|
+
var MF_SERVER_IDENTIFIER = "Module Federation DTS";
|
|
376
376
|
var UpdateMode;
|
|
377
377
|
(function(UpdateMode2) {
|
|
378
378
|
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
@@ -1183,6 +1183,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
|
|
|
1183
1183
|
} catch (error2) {
|
|
1184
1184
|
fileLog(`Error during types archive download: ${(error2 == null ? void 0 : error2.message) || "unknown error"}`, "downloadTypesArchive", "error");
|
|
1185
1185
|
if (retries >= hostOptions.maxRetries) {
|
|
1186
|
+
logger.error(`Failed to download ${fileToDownload}, you can set FEDERATION_DEBUG=true to see detail message.`);
|
|
1186
1187
|
if (hostOptions.abortOnError !== false) {
|
|
1187
1188
|
throw error2;
|
|
1188
1189
|
}
|
|
@@ -1252,6 +1253,7 @@ var retrieveRemoteInfo = /* @__PURE__ */ __name((options) => {
|
|
|
1252
1253
|
};
|
|
1253
1254
|
}, "retrieveRemoteInfo");
|
|
1254
1255
|
var resolveRemotes = /* @__PURE__ */ __name((hostOptions) => {
|
|
1256
|
+
var _a3;
|
|
1255
1257
|
const parsedOptions = import_managers.utils.parseOptions(hostOptions.moduleFederationConfig.remotes || {}, (item, key) => ({
|
|
1256
1258
|
remote: Array.isArray(item) ? item[0] : item,
|
|
1257
1259
|
key
|
|
@@ -1259,15 +1261,38 @@ var resolveRemotes = /* @__PURE__ */ __name((hostOptions) => {
|
|
|
1259
1261
|
remote: Array.isArray(item.external) ? item.external[0] : item.external,
|
|
1260
1262
|
key
|
|
1261
1263
|
}));
|
|
1264
|
+
const remoteTypeUrls = (_a3 = hostOptions.remoteTypeUrls) != null ? _a3 : {};
|
|
1265
|
+
if (typeof remoteTypeUrls !== "object") {
|
|
1266
|
+
throw new Error("remoteTypeUrls must be consumed before resolveRemotes");
|
|
1267
|
+
}
|
|
1268
|
+
const remoteInfos = Object.keys(remoteTypeUrls).reduce((sum, remoteName) => {
|
|
1269
|
+
const { zip, api, alias } = remoteTypeUrls[remoteName];
|
|
1270
|
+
sum[alias] = {
|
|
1271
|
+
name: remoteName,
|
|
1272
|
+
url: "",
|
|
1273
|
+
zipUrl: zip,
|
|
1274
|
+
apiTypeUrl: api,
|
|
1275
|
+
alias: alias || remoteName
|
|
1276
|
+
};
|
|
1277
|
+
return sum;
|
|
1278
|
+
}, {});
|
|
1262
1279
|
return parsedOptions.reduce((accumulator, item) => {
|
|
1263
1280
|
const { key, remote } = item[1];
|
|
1264
|
-
|
|
1281
|
+
const res = retrieveRemoteInfo({
|
|
1265
1282
|
hostOptions,
|
|
1266
1283
|
remoteAlias: key,
|
|
1267
1284
|
remote
|
|
1268
1285
|
});
|
|
1286
|
+
if (accumulator[key]) {
|
|
1287
|
+
accumulator[key] = __spreadProps(__spreadValues({}, accumulator[key]), {
|
|
1288
|
+
url: res.url,
|
|
1289
|
+
apiTypeUrl: accumulator[key].apiTypeUrl || res.apiTypeUrl
|
|
1290
|
+
});
|
|
1291
|
+
return accumulator;
|
|
1292
|
+
}
|
|
1293
|
+
accumulator[key] = res;
|
|
1269
1294
|
return accumulator;
|
|
1270
|
-
},
|
|
1295
|
+
}, remoteInfos);
|
|
1271
1296
|
}, "resolveRemotes");
|
|
1272
1297
|
var retrieveHostConfig = /* @__PURE__ */ __name((options) => {
|
|
1273
1298
|
validateOptions(options);
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getIPV4,
|
|
9
9
|
getIdentifier,
|
|
10
10
|
logger
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-56UE3H52.js";
|
|
12
12
|
import {
|
|
13
13
|
AddPublisherAction,
|
|
14
14
|
AddSubscriberAction,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
__require,
|
|
28
28
|
__spreadProps,
|
|
29
29
|
__spreadValues
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-SPSJLB6F.js";
|
|
31
31
|
|
|
32
32
|
// packages/dts-plugin/src/core/lib/typeScriptCompiler.ts
|
|
33
33
|
import { ensureDirSync, writeFileSync, existsSync } from "fs-extra";
|
|
@@ -769,6 +769,7 @@ var retrieveRemoteInfo = /* @__PURE__ */ __name((options) => {
|
|
|
769
769
|
};
|
|
770
770
|
}, "retrieveRemoteInfo");
|
|
771
771
|
var resolveRemotes = /* @__PURE__ */ __name((hostOptions) => {
|
|
772
|
+
var _a2;
|
|
772
773
|
const parsedOptions = utils2.parseOptions(hostOptions.moduleFederationConfig.remotes || {}, (item, key) => ({
|
|
773
774
|
remote: Array.isArray(item) ? item[0] : item,
|
|
774
775
|
key
|
|
@@ -776,15 +777,38 @@ var resolveRemotes = /* @__PURE__ */ __name((hostOptions) => {
|
|
|
776
777
|
remote: Array.isArray(item.external) ? item.external[0] : item.external,
|
|
777
778
|
key
|
|
778
779
|
}));
|
|
780
|
+
const remoteTypeUrls = (_a2 = hostOptions.remoteTypeUrls) != null ? _a2 : {};
|
|
781
|
+
if (typeof remoteTypeUrls !== "object") {
|
|
782
|
+
throw new Error("remoteTypeUrls must be consumed before resolveRemotes");
|
|
783
|
+
}
|
|
784
|
+
const remoteInfos = Object.keys(remoteTypeUrls).reduce((sum, remoteName) => {
|
|
785
|
+
const { zip, api, alias } = remoteTypeUrls[remoteName];
|
|
786
|
+
sum[alias] = {
|
|
787
|
+
name: remoteName,
|
|
788
|
+
url: "",
|
|
789
|
+
zipUrl: zip,
|
|
790
|
+
apiTypeUrl: api,
|
|
791
|
+
alias: alias || remoteName
|
|
792
|
+
};
|
|
793
|
+
return sum;
|
|
794
|
+
}, {});
|
|
779
795
|
return parsedOptions.reduce((accumulator, item) => {
|
|
780
796
|
const { key, remote } = item[1];
|
|
781
|
-
|
|
797
|
+
const res = retrieveRemoteInfo({
|
|
782
798
|
hostOptions,
|
|
783
799
|
remoteAlias: key,
|
|
784
800
|
remote
|
|
785
801
|
});
|
|
802
|
+
if (accumulator[key]) {
|
|
803
|
+
accumulator[key] = __spreadProps(__spreadValues({}, accumulator[key]), {
|
|
804
|
+
url: res.url,
|
|
805
|
+
apiTypeUrl: accumulator[key].apiTypeUrl || res.apiTypeUrl
|
|
806
|
+
});
|
|
807
|
+
return accumulator;
|
|
808
|
+
}
|
|
809
|
+
accumulator[key] = res;
|
|
786
810
|
return accumulator;
|
|
787
|
-
},
|
|
811
|
+
}, remoteInfos);
|
|
788
812
|
}, "resolveRemotes");
|
|
789
813
|
var retrieveHostConfig = /* @__PURE__ */ __name((options) => {
|
|
790
814
|
validateOptions(options);
|
|
@@ -1385,6 +1409,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
|
|
|
1385
1409
|
} catch (error) {
|
|
1386
1410
|
fileLog(`Error during types archive download: ${(error == null ? void 0 : error.message) || "unknown error"}`, "downloadTypesArchive", "error");
|
|
1387
1411
|
if (retries >= hostOptions.maxRetries) {
|
|
1412
|
+
logger.error(`Failed to download ${fileToDownload}, you can set FEDERATION_DEBUG=true to see detail message.`);
|
|
1388
1413
|
if (hostOptions.abortOnError !== false) {
|
|
1389
1414
|
throw error;
|
|
1390
1415
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
exposeRpc,
|
|
5
5
|
getDTSManagerConstructor,
|
|
6
6
|
isDebugMode
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-A4MGPQ34.js";
|
|
8
8
|
import {
|
|
9
9
|
__async,
|
|
10
10
|
__export,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
__publicField,
|
|
13
13
|
__spreadProps,
|
|
14
14
|
__spreadValues
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SPSJLB6F.js";
|
|
16
16
|
|
|
17
17
|
// packages/dts-plugin/src/core/lib/DtsWorker.ts
|
|
18
18
|
import path from "path";
|
|
@@ -69,7 +69,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
69
69
|
// packages/dts-plugin/src/server/constant.ts
|
|
70
70
|
var DEFAULT_WEB_SOCKET_PORT = 16322;
|
|
71
71
|
var WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
|
|
72
|
-
var MF_SERVER_IDENTIFIER = "Module Federation
|
|
72
|
+
var MF_SERVER_IDENTIFIER = "Module Federation DTS";
|
|
73
73
|
var WEB_CLIENT_OPTIONS_IDENTIFIER = "__WEB_CLIENT_OPTIONS__";
|
|
74
74
|
var DEFAULT_TAR_NAME = "@mf-types.zip";
|
|
75
75
|
var UpdateMode;
|
package/dist/esm/core.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
consumeTypes,
|
|
4
4
|
generateTypesInChildProcess,
|
|
5
5
|
rpc_exports
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GX5A7XT2.js";
|
|
7
7
|
import {
|
|
8
8
|
DTSManager,
|
|
9
9
|
HOST_API_TYPES_FILE_NAME,
|
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
retrieveTypesAssetsInfo,
|
|
20
20
|
retrieveTypesZipPath,
|
|
21
21
|
validateOptions
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-A4MGPQ34.js";
|
|
23
|
+
import "./chunk-56UE3H52.js";
|
|
24
|
+
import "./chunk-SPSJLB6F.js";
|
|
25
25
|
export {
|
|
26
26
|
DTSManager,
|
|
27
27
|
DtsWorker,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getIpFromEntry
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L22LIZUP.js";
|
|
4
4
|
import {
|
|
5
5
|
AddDynamicRemoteAction,
|
|
6
6
|
DEFAULT_WEB_SOCKET_PORT,
|
|
7
7
|
FetchTypesAction,
|
|
8
8
|
WEB_SOCKET_CONNECT_MAGIC_ID,
|
|
9
9
|
__name
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SPSJLB6F.js";
|
|
11
11
|
|
|
12
12
|
// packages/dts-plugin/src/server/createWebsocket.ts
|
|
13
13
|
import WebSocket from "isomorphic-ws";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rpc_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GX5A7XT2.js";
|
|
4
4
|
import {
|
|
5
5
|
ModuleFederationDevServer,
|
|
6
6
|
createKoaServer,
|
|
@@ -9,21 +9,21 @@ import {
|
|
|
9
9
|
retrieveMfTypesPath,
|
|
10
10
|
retrieveRemoteConfig,
|
|
11
11
|
retrieveTypesZipPath
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-A4MGPQ34.js";
|
|
13
13
|
import {
|
|
14
14
|
fileLog,
|
|
15
15
|
getIPV4
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-56UE3H52.js";
|
|
17
17
|
import {
|
|
18
18
|
getIpFromEntry
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-L22LIZUP.js";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_TAR_NAME,
|
|
22
22
|
UpdateKind,
|
|
23
23
|
UpdateMode,
|
|
24
24
|
__async,
|
|
25
25
|
__name
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SPSJLB6F.js";
|
|
27
27
|
|
|
28
28
|
// packages/dts-plugin/src/dev-worker/forkDevWorker.ts
|
|
29
29
|
import { decodeName } from "@module-federation/sdk";
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
RpcGMCallTypes,
|
|
3
3
|
exposeRpc,
|
|
4
4
|
generateTypes
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-A4MGPQ34.js";
|
|
6
|
+
import "./chunk-56UE3H52.js";
|
|
7
7
|
import {
|
|
8
8
|
__async,
|
|
9
9
|
__name
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SPSJLB6F.js";
|
|
11
11
|
|
|
12
12
|
// packages/dts-plugin/src/core/lib/forkGenerateDts.ts
|
|
13
13
|
function forkGenerateDts(options) {
|