@module-federation/dts-plugin 0.2.7 → 0.3.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.
- package/dist/CHANGELOG.md +23 -0
- package/dist/{DTSManagerOptions-c0728719.d.ts → DTSManagerOptions-7109e8ac.d.ts} +1 -0
- package/dist/{DtsWorker-90454949.d.ts → DtsWorker-17de6ba4.d.ts} +2 -5
- package/dist/core.d.mts +8 -4
- package/dist/core.d.ts +8 -4
- package/dist/core.js +78 -41
- package/dist/dynamic-remote-type-hints-plugin.js +5 -7
- package/dist/esm/{chunk-MQRIERJP.js → chunk-6DND574L.js} +7 -15
- package/dist/esm/chunk-DEW2PNCR.js +283 -0
- package/dist/esm/chunk-HKRTV6ZH.js +900 -0
- package/dist/esm/{chunk-ZLQBXHXA.js → chunk-SFEGBRA3.js} +331 -1426
- package/dist/esm/{chunk-G7ONFBMA.js → chunk-XKCIYRDL.js} +1 -1
- package/dist/esm/core.js +11 -11
- package/dist/esm/dynamic-remote-type-hints-plugin.js +2 -2
- package/dist/esm/fork-dev-worker.js +11 -7
- package/dist/esm/fork-generate-dts.js +3 -2
- package/dist/esm/index.js +21 -18
- package/dist/esm/start-broker.js +2 -2
- package/dist/fork-dev-worker.d.mts +1 -1
- package/dist/fork-dev-worker.d.ts +1 -1
- package/dist/fork-dev-worker.js +74 -39
- package/dist/fork-generate-dts.d.mts +2 -2
- package/dist/fork-generate-dts.d.ts +2 -2
- package/dist/fork-generate-dts.js +146 -290
- package/dist/iife/launch-web-client.js +5 -7
- package/dist/index.js +89 -52
- package/dist/package.json +1 -1
- package/dist/start-broker.js +28 -344
- package/package.json +5 -5
package/dist/esm/core.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DTSManager,
|
|
3
2
|
DtsWorker,
|
|
4
3
|
consumeTypes,
|
|
5
|
-
generateTypes,
|
|
6
4
|
generateTypesInChildProcess,
|
|
5
|
+
rpc_exports
|
|
6
|
+
} from "./chunk-DEW2PNCR.js";
|
|
7
|
+
import {
|
|
8
|
+
DTSManager,
|
|
9
|
+
HOST_API_TYPES_FILE_NAME,
|
|
10
|
+
REMOTE_ALIAS_IDENTIFIER,
|
|
11
|
+
REMOTE_API_TYPES_FILE_NAME,
|
|
12
|
+
generateTypes,
|
|
7
13
|
getDTSManagerConstructor,
|
|
8
14
|
isTSProject,
|
|
9
15
|
retrieveHostConfig,
|
|
@@ -12,22 +18,16 @@ import {
|
|
|
12
18
|
retrieveRemoteConfig,
|
|
13
19
|
retrieveTypesAssetsInfo,
|
|
14
20
|
retrieveTypesZipPath,
|
|
15
|
-
rpc_exports,
|
|
16
21
|
validateOptions
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
REMOTE_ALIAS_IDENTIFIER,
|
|
21
|
-
REMOTE_API_TYPES_FILE_NAME,
|
|
22
|
-
UpdateMode
|
|
23
|
-
} from "./chunk-MQRIERJP.js";
|
|
22
|
+
} from "./chunk-SFEGBRA3.js";
|
|
23
|
+
import "./chunk-HKRTV6ZH.js";
|
|
24
|
+
import "./chunk-6DND574L.js";
|
|
24
25
|
export {
|
|
25
26
|
DTSManager,
|
|
26
27
|
DtsWorker,
|
|
27
28
|
HOST_API_TYPES_FILE_NAME,
|
|
28
29
|
REMOTE_ALIAS_IDENTIFIER,
|
|
29
30
|
REMOTE_API_TYPES_FILE_NAME,
|
|
30
|
-
UpdateMode,
|
|
31
31
|
consumeTypes,
|
|
32
32
|
generateTypes,
|
|
33
33
|
generateTypesInChildProcess,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getIpFromEntry
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XKCIYRDL.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-6DND574L.js";
|
|
11
11
|
|
|
12
12
|
// packages/dts-plugin/src/server/createWebsocket.ts
|
|
13
13
|
import WebSocket from "isomorphic-ws";
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rpc_exports
|
|
3
|
+
} from "./chunk-DEW2PNCR.js";
|
|
1
4
|
import {
|
|
2
5
|
ModuleFederationDevServer,
|
|
3
6
|
createKoaServer,
|
|
4
|
-
fileLog,
|
|
5
7
|
getDTSManagerConstructor,
|
|
6
|
-
getIPV4,
|
|
7
8
|
retrieveHostConfig,
|
|
8
9
|
retrieveMfTypesPath,
|
|
9
10
|
retrieveRemoteConfig,
|
|
10
|
-
retrieveTypesZipPath
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
retrieveTypesZipPath
|
|
12
|
+
} from "./chunk-SFEGBRA3.js";
|
|
13
|
+
import {
|
|
14
|
+
fileLog,
|
|
15
|
+
getIPV4
|
|
16
|
+
} from "./chunk-HKRTV6ZH.js";
|
|
13
17
|
import {
|
|
14
18
|
getIpFromEntry
|
|
15
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XKCIYRDL.js";
|
|
16
20
|
import {
|
|
17
21
|
DEFAULT_TAR_NAME,
|
|
18
22
|
UpdateKind,
|
|
19
23
|
UpdateMode,
|
|
20
24
|
__async,
|
|
21
25
|
__name
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-6DND574L.js";
|
|
23
27
|
|
|
24
28
|
// packages/dts-plugin/src/dev-worker/forkDevWorker.ts
|
|
25
29
|
import { decodeName } from "@module-federation/sdk";
|
|
@@ -2,11 +2,12 @@ import {
|
|
|
2
2
|
RpcGMCallTypes,
|
|
3
3
|
exposeRpc,
|
|
4
4
|
generateTypes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SFEGBRA3.js";
|
|
6
|
+
import "./chunk-HKRTV6ZH.js";
|
|
6
7
|
import {
|
|
7
8
|
__async,
|
|
8
9
|
__name
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6DND574L.js";
|
|
10
11
|
|
|
11
12
|
// packages/dts-plugin/src/core/lib/forkGenerateDts.ts
|
|
12
13
|
function forkGenerateDts(options) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
consumeTypes,
|
|
3
|
-
generateTypes,
|
|
4
3
|
generateTypesInChildProcess,
|
|
5
|
-
|
|
4
|
+
rpc_exports
|
|
5
|
+
} from "./chunk-DEW2PNCR.js";
|
|
6
|
+
import {
|
|
7
|
+
cloneDeepOptions,
|
|
8
|
+
generateTypes,
|
|
6
9
|
isTSProject,
|
|
7
10
|
retrieveTypesAssetsInfo,
|
|
8
|
-
rpc_exports,
|
|
9
11
|
validateOptions
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SFEGBRA3.js";
|
|
13
|
+
import {
|
|
14
|
+
getIPV4
|
|
15
|
+
} from "./chunk-HKRTV6ZH.js";
|
|
11
16
|
import {
|
|
12
17
|
WEB_CLIENT_OPTIONS_IDENTIFIER,
|
|
13
18
|
__async,
|
|
@@ -15,7 +20,7 @@ import {
|
|
|
15
20
|
__publicField,
|
|
16
21
|
__spreadProps,
|
|
17
22
|
__spreadValues
|
|
18
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-6DND574L.js";
|
|
19
24
|
|
|
20
25
|
// packages/dts-plugin/src/plugins/DevPlugin.ts
|
|
21
26
|
import fs from "fs-extra";
|
|
@@ -27,17 +32,12 @@ import * as fse from "fs-extra";
|
|
|
27
32
|
|
|
28
33
|
// packages/dts-plugin/src/dev-worker/DevWorker.ts
|
|
29
34
|
import path from "path";
|
|
30
|
-
import cloneDeepWith from "lodash.clonedeepwith";
|
|
31
35
|
var _DevWorker = class _DevWorker {
|
|
32
36
|
constructor(options) {
|
|
33
37
|
__publicField(this, "_rpcWorker");
|
|
34
38
|
__publicField(this, "_options");
|
|
35
39
|
__publicField(this, "_res");
|
|
36
|
-
this._options =
|
|
37
|
-
if (key === "manifest") {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
40
|
+
this._options = cloneDeepOptions(options);
|
|
41
41
|
this.removeUnSerializationOptions();
|
|
42
42
|
this._rpcWorker = rpc_exports.createRpcWorker(path.resolve(__dirname, "./fork-dev-worker.js"), {}, void 0, false);
|
|
43
43
|
this._res = this._rpcWorker.connect(this._options);
|
|
@@ -184,14 +184,17 @@ var _DevPlugin = class _DevPlugin {
|
|
|
184
184
|
if (!normalizedDev.disableLiveReload) {
|
|
185
185
|
const TEMP_DIR = path3.join(`${process.cwd()}/node_modules`, BasicTempDir);
|
|
186
186
|
const filepath = path3.join(TEMP_DIR, `live-reload.js`);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}, filepath);
|
|
190
|
-
compiler.hooks.afterPlugins.tap("MFDevPlugin", () => {
|
|
191
|
-
new compiler.webpack.EntryPlugin(compiler.context, filepath, {
|
|
187
|
+
if (typeof compiler.options.entry === "object") {
|
|
188
|
+
_DevPlugin.ensureLiveReloadEntry({
|
|
192
189
|
name
|
|
193
|
-
})
|
|
194
|
-
|
|
190
|
+
}, filepath);
|
|
191
|
+
Object.keys(compiler.options.entry).forEach((entry) => {
|
|
192
|
+
const normalizedEntry = compiler.options.entry[entry];
|
|
193
|
+
if (typeof normalizedEntry === "object" && Array.isArray(normalizedEntry.import)) {
|
|
194
|
+
normalizedEntry.import.unshift(filepath);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
195
198
|
}
|
|
196
199
|
const defaultGenerateTypes = {
|
|
197
200
|
compileInChildProcess: true
|
package/dist/esm/start-broker.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Broker,
|
|
3
3
|
fileLog
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HKRTV6ZH.js";
|
|
5
5
|
import {
|
|
6
6
|
__async,
|
|
7
7
|
__name
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6DND574L.js";
|
|
9
9
|
|
|
10
10
|
// packages/dts-plugin/src/server/broker/startBroker.ts
|
|
11
11
|
var broker;
|
package/dist/fork-dev-worker.js
CHANGED
|
@@ -93,7 +93,6 @@ var import_path4 = __toESM(require("path"));
|
|
|
93
93
|
var import_promises3 = require("fs/promises");
|
|
94
94
|
var import_fs = __toESM(require("fs"));
|
|
95
95
|
var import_sdk5 = require("@module-federation/sdk");
|
|
96
|
-
var import_lodash = __toESM(require("lodash.clonedeepwith"));
|
|
97
96
|
var import_third_party_dts_extractor2 = require("@module-federation/third-party-dts-extractor");
|
|
98
97
|
|
|
99
98
|
// packages/dts-plugin/src/core/lib/archiveHandler.ts
|
|
@@ -103,8 +102,8 @@ var import_promises2 = require("fs/promises");
|
|
|
103
102
|
|
|
104
103
|
// packages/dts-plugin/src/core/lib/typeScriptCompiler.ts
|
|
105
104
|
var import_fs_extra = require("fs-extra");
|
|
105
|
+
var import_crypto = __toESM(require("crypto"));
|
|
106
106
|
var import_promises = require("fs/promises");
|
|
107
|
-
var import_crypto = require("crypto");
|
|
108
107
|
var import_path = require("path");
|
|
109
108
|
var import_third_party_dts_extractor = require("@module-federation/third-party-dts-extractor");
|
|
110
109
|
var import_child_process = require("child_process");
|
|
@@ -115,8 +114,12 @@ var DEFINITION_FILE_EXTENSION = ".d.ts";
|
|
|
115
114
|
var retrieveMfTypesPath = /* @__PURE__ */ __name((tsConfig, remoteOptions) => (0, import_path.normalize)(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, "")), "retrieveMfTypesPath");
|
|
116
115
|
var retrieveOriginalOutDir = /* @__PURE__ */ __name((tsConfig, remoteOptions) => (0, import_path.normalize)(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, "").replace(remoteOptions.typesFolder, "")), "retrieveOriginalOutDir");
|
|
117
116
|
var retrieveMfAPITypesPath = /* @__PURE__ */ __name((tsConfig, remoteOptions) => (0, import_path.join)(retrieveOriginalOutDir(tsConfig, remoteOptions), `${remoteOptions.typesFolder}.d.ts`), "retrieveMfAPITypesPath");
|
|
118
|
-
function writeTempTsConfig(tsConfig, context) {
|
|
119
|
-
const
|
|
117
|
+
function writeTempTsConfig(tsConfig, context, name) {
|
|
118
|
+
const createHash = /* @__PURE__ */ __name((contents) => {
|
|
119
|
+
return import_crypto.default.createHash("md5").update(contents).digest("hex");
|
|
120
|
+
}, "createHash");
|
|
121
|
+
const hash = createHash(`${JSON.stringify(tsConfig)}${name}`);
|
|
122
|
+
const tempTsConfigJsonPath = (0, import_path.resolve)(context, "node_modules", import_sdk.TEMP_DIR, `tsconfig.${hash}.json`);
|
|
120
123
|
(0, import_fs_extra.ensureDirSync)((0, import_path.dirname)(tempTsConfigJsonPath));
|
|
121
124
|
(0, import_fs_extra.writeFileSync)(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
|
|
122
125
|
return tempTsConfigJsonPath;
|
|
@@ -156,6 +159,7 @@ var processTypesFile = /* @__PURE__ */ __name((options) => __async(void 0, null,
|
|
|
156
159
|
const mfeTypeEntry = (0, import_path.join)(mfTypePath, `${sourceEntry}${DEFINITION_FILE_EXTENSION}`);
|
|
157
160
|
const mfeTypeEntryDirectory = (0, import_path.dirname)(mfeTypeEntry);
|
|
158
161
|
const relativePathToOutput = (0, import_path.relative)(mfeTypeEntryDirectory, filePath).replace(DEFINITION_FILE_EXTENSION, "").replace(STARTS_WITH_SLASH, "").split(import_path.sep).join("/");
|
|
162
|
+
(0, import_fs_extra.ensureDirSync)(mfeTypeEntryDirectory);
|
|
159
163
|
yield (0, import_promises.writeFile)(mfeTypeEntry, `export * from './${relativePathToOutput}';
|
|
160
164
|
export { default } from './${relativePathToOutput}';`);
|
|
161
165
|
}
|
|
@@ -168,7 +172,7 @@ var compileTs = /* @__PURE__ */ __name((mapComponentsToExpose, tsConfig, remoteO
|
|
|
168
172
|
return;
|
|
169
173
|
}
|
|
170
174
|
const { compilerOptions } = tsConfig;
|
|
171
|
-
const tempTsConfigJsonPath = writeTempTsConfig(tsConfig, remoteOptions.context);
|
|
175
|
+
const tempTsConfigJsonPath = writeTempTsConfig(tsConfig, remoteOptions.context, remoteOptions.moduleFederationConfig.name || "mf");
|
|
172
176
|
try {
|
|
173
177
|
const mfTypePath = retrieveMfTypesPath(tsConfig, remoteOptions);
|
|
174
178
|
const thirdPartyExtractor = new import_third_party_dts_extractor.ThirdPartyExtractor((0, import_path.resolve)(mfTypePath, "node_modules"), remoteOptions.context);
|
|
@@ -206,6 +210,9 @@ var compileTs = /* @__PURE__ */ __name((mapComponentsToExpose, tsConfig, remoteO
|
|
|
206
210
|
}
|
|
207
211
|
yield (0, import_promises.rm)(tempTsConfigJsonPath);
|
|
208
212
|
} catch (err) {
|
|
213
|
+
if (isDebugMode()) {
|
|
214
|
+
console.log("tsconfig: ", JSON.stringify(tsConfig, null, 2));
|
|
215
|
+
}
|
|
209
216
|
throw err;
|
|
210
217
|
}
|
|
211
218
|
}), "compileTs");
|
|
@@ -330,6 +337,11 @@ var DEFAULT_WEB_SOCKET_PORT = 16322;
|
|
|
330
337
|
var WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
|
|
331
338
|
var MF_SERVER_IDENTIFIER = "Module Federation Dev Server";
|
|
332
339
|
var DEFAULT_TAR_NAME = "@mf-types.zip";
|
|
340
|
+
var UpdateMode;
|
|
341
|
+
(function(UpdateMode2) {
|
|
342
|
+
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
343
|
+
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
344
|
+
})(UpdateMode || (UpdateMode = {}));
|
|
333
345
|
|
|
334
346
|
// packages/dts-plugin/src/server/utils/log.ts
|
|
335
347
|
function fileLog(msg, module2, level) {
|
|
@@ -635,16 +647,6 @@ var _UpdatePublisherAction = class _UpdatePublisherAction extends Action {
|
|
|
635
647
|
__name(_UpdatePublisherAction, "UpdatePublisherAction");
|
|
636
648
|
var UpdatePublisherAction = _UpdatePublisherAction;
|
|
637
649
|
|
|
638
|
-
// packages/dts-plugin/src/core/constant.ts
|
|
639
|
-
var REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
640
|
-
var REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
641
|
-
var HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
642
|
-
var UpdateMode;
|
|
643
|
-
(function(UpdateMode2) {
|
|
644
|
-
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
645
|
-
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
646
|
-
})(UpdateMode || (UpdateMode = {}));
|
|
647
|
-
|
|
648
650
|
// packages/dts-plugin/src/server/broker/Broker.ts
|
|
649
651
|
var _Broker = class _Broker {
|
|
650
652
|
constructor() {
|
|
@@ -1271,12 +1273,12 @@ var _ModuleFederationDevServer = class _ModuleFederationDevServer {
|
|
|
1271
1273
|
var _a3;
|
|
1272
1274
|
fileLog(`Current pid: ${process.pid}, publisher:${this._name} connected to ws://${this._ip}:${Broker.DEFAULT_WEB_SOCKET_PORT}, starting service...`, MF_SERVER_IDENTIFIER, "info");
|
|
1273
1275
|
this._isConnected = true;
|
|
1274
|
-
const
|
|
1276
|
+
const addPublisherAction = new AddPublisherAction({
|
|
1275
1277
|
name: this._name,
|
|
1276
1278
|
ip: this._ip,
|
|
1277
1279
|
remoteTypeTarPath: this._remoteTypeTarPath
|
|
1278
1280
|
});
|
|
1279
|
-
(_a3 = this._publishWebSocket) == null ? void 0 : _a3.send(JSON.stringify(
|
|
1281
|
+
(_a3 = this._publishWebSocket) == null ? void 0 : _a3.send(JSON.stringify(addPublisherAction));
|
|
1280
1282
|
this._connectSubscribers();
|
|
1281
1283
|
});
|
|
1282
1284
|
this._publishWebSocket.on("message", (message) => __async(this, null, function* () {
|
|
@@ -1539,11 +1541,11 @@ var _ModuleFederationDevServer = class _ModuleFederationDevServer {
|
|
|
1539
1541
|
if (!this._publishWebSocket || !this._isConnected) {
|
|
1540
1542
|
return;
|
|
1541
1543
|
}
|
|
1542
|
-
const { updateKind, updateMode, updateSourcePaths } = options;
|
|
1544
|
+
const { updateKind, updateMode, updateSourcePaths, clientName } = options;
|
|
1543
1545
|
fileLog(`update run, ${this._name} module update, updateKind: ${updateKind}, updateMode: ${updateMode}, updateSourcePaths: ${updateSourcePaths}`, MF_SERVER_IDENTIFIER, "info");
|
|
1544
1546
|
if (updateKind === UpdateKind.RELOAD_PAGE) {
|
|
1545
1547
|
const notifyWebClient = new NotifyWebClientAction({
|
|
1546
|
-
name: this._name,
|
|
1548
|
+
name: clientName || this._name,
|
|
1547
1549
|
updateMode
|
|
1548
1550
|
});
|
|
1549
1551
|
this._publishWebSocket.send(JSON.stringify(notifyWebClient));
|
|
@@ -1685,7 +1687,8 @@ var defaultOptions = {
|
|
|
1685
1687
|
implementation: "",
|
|
1686
1688
|
context: process.cwd(),
|
|
1687
1689
|
abortOnError: true,
|
|
1688
|
-
consumeAPITypes: false
|
|
1690
|
+
consumeAPITypes: false,
|
|
1691
|
+
runtimePkgs: []
|
|
1689
1692
|
};
|
|
1690
1693
|
var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
|
|
1691
1694
|
const remoteUrl = new URL(url, "file:");
|
|
@@ -1744,6 +1747,11 @@ var retrieveHostConfig = /* @__PURE__ */ __name((options) => {
|
|
|
1744
1747
|
};
|
|
1745
1748
|
}, "retrieveHostConfig");
|
|
1746
1749
|
|
|
1750
|
+
// packages/dts-plugin/src/core/constant.ts
|
|
1751
|
+
var REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
1752
|
+
var REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
1753
|
+
var HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
1754
|
+
|
|
1747
1755
|
// packages/dts-plugin/src/core/lib/DTSManager.ts
|
|
1748
1756
|
var _a;
|
|
1749
1757
|
var DTSManager = (_a = class {
|
|
@@ -1754,11 +1762,7 @@ var DTSManager = (_a = class {
|
|
|
1754
1762
|
__publicField(this, "loadedRemoteAPIAlias");
|
|
1755
1763
|
__publicField(this, "extraOptions");
|
|
1756
1764
|
__publicField(this, "updatedRemoteInfos");
|
|
1757
|
-
this.options = (
|
|
1758
|
-
if (key === "manifest") {
|
|
1759
|
-
return false;
|
|
1760
|
-
}
|
|
1761
|
-
});
|
|
1765
|
+
this.options = cloneDeepOptions(options);
|
|
1762
1766
|
this.runtimePkgs = [
|
|
1763
1767
|
"@module-federation/runtime",
|
|
1764
1768
|
"@module-federation/enhanced/runtime",
|
|
@@ -1827,7 +1831,7 @@ var DTSManager = (_a = class {
|
|
|
1827
1831
|
if (!Object.keys(mapComponentsToExpose).length) {
|
|
1828
1832
|
return;
|
|
1829
1833
|
}
|
|
1830
|
-
this.extractRemoteTypes({
|
|
1834
|
+
yield this.extractRemoteTypes({
|
|
1831
1835
|
remoteOptions,
|
|
1832
1836
|
tsConfig,
|
|
1833
1837
|
mapComponentsToExpose
|
|
@@ -1969,7 +1973,16 @@ var DTSManager = (_a = class {
|
|
|
1969
1973
|
...packageTypes,
|
|
1970
1974
|
"Y"
|
|
1971
1975
|
].join(" :\n")} ;`;
|
|
1972
|
-
const
|
|
1976
|
+
const runtimePkgs = /* @__PURE__ */ new Set();
|
|
1977
|
+
[
|
|
1978
|
+
...this.runtimePkgs,
|
|
1979
|
+
...hostOptions.runtimePkgs
|
|
1980
|
+
].forEach((pkg) => {
|
|
1981
|
+
runtimePkgs.add(pkg);
|
|
1982
|
+
});
|
|
1983
|
+
const pkgsDeclareStr = [
|
|
1984
|
+
...runtimePkgs
|
|
1985
|
+
].map((pkg) => {
|
|
1973
1986
|
return `declare module "${pkg}" {
|
|
1974
1987
|
${remoteKeysStr}
|
|
1975
1988
|
${packageTypesStr}
|
|
@@ -2102,6 +2115,7 @@ var DTSManager = (_a = class {
|
|
|
2102
2115
|
}, __name(_a, "DTSManager"), _a);
|
|
2103
2116
|
|
|
2104
2117
|
// packages/dts-plugin/src/core/lib/utils.ts
|
|
2118
|
+
var import_lodash = __toESM(require("lodash.clonedeepwith"));
|
|
2105
2119
|
function getDTSManagerConstructor(implementation) {
|
|
2106
2120
|
if (implementation) {
|
|
2107
2121
|
const NewConstructor = require(implementation);
|
|
@@ -2119,6 +2133,18 @@ function isDebugMode() {
|
|
|
2119
2133
|
return Boolean(process.env["FEDERATION_DEBUG"]) || process.env["NODE_ENV"] === "test";
|
|
2120
2134
|
}
|
|
2121
2135
|
__name(isDebugMode, "isDebugMode");
|
|
2136
|
+
function cloneDeepOptions(options) {
|
|
2137
|
+
const excludeKeys = [
|
|
2138
|
+
"manifest",
|
|
2139
|
+
"async"
|
|
2140
|
+
];
|
|
2141
|
+
return (0, import_lodash.default)(options, (_value, key) => {
|
|
2142
|
+
if (typeof key === "string" && excludeKeys.includes(key)) {
|
|
2143
|
+
return false;
|
|
2144
|
+
}
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
__name(cloneDeepOptions, "cloneDeepOptions");
|
|
2122
2148
|
function axiosGet(url, config) {
|
|
2123
2149
|
return __async(this, null, function* () {
|
|
2124
2150
|
const httpAgent = new import_http2.default.Agent({
|
|
@@ -2171,6 +2197,7 @@ function getEffectiveRootDir(parsedCommandLine) {
|
|
|
2171
2197
|
}
|
|
2172
2198
|
__name(getEffectiveRootDir, "getEffectiveRootDir");
|
|
2173
2199
|
var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiledTypesFolder, context, additionalFilesToCompile }, mapComponentsToExpose) => {
|
|
2200
|
+
var _a3;
|
|
2174
2201
|
const resolvedTsConfigPath = (0, import_path5.resolve)(context, tsConfigPath);
|
|
2175
2202
|
const readResult = import_typescript.default.readConfigFile(resolvedTsConfigPath, import_typescript.default.sys.readFile);
|
|
2176
2203
|
if (readResult.error) {
|
|
@@ -2189,6 +2216,7 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
|
|
|
2189
2216
|
};
|
|
2190
2217
|
rawTsConfigJson.compilerOptions = rawTsConfigJson.compilerOptions || {};
|
|
2191
2218
|
rawTsConfigJson.compilerOptions = __spreadValues(__spreadValues({}, rawTsConfigJson.compilerOptions), defaultCompilerOptions);
|
|
2219
|
+
(_a3 = rawTsConfigJson.compilerOptions) == null ? true : delete _a3.paths;
|
|
2192
2220
|
const filesToCompile = [
|
|
2193
2221
|
...Object.values(mapComponentsToExpose),
|
|
2194
2222
|
...additionalFilesToCompile
|
|
@@ -2197,10 +2225,7 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
|
|
|
2197
2225
|
rawTsConfigJson.files = filesToCompile;
|
|
2198
2226
|
rawTsConfigJson.exclude = [];
|
|
2199
2227
|
"references" in rawTsConfigJson && delete rawTsConfigJson.references;
|
|
2200
|
-
|
|
2201
|
-
if (extendsPath && extendsPath.startsWith(".")) {
|
|
2202
|
-
rawTsConfigJson.extends = (0, import_path5.resolve)(context, extendsPath);
|
|
2203
|
-
}
|
|
2228
|
+
rawTsConfigJson.extends = resolvedTsConfigPath;
|
|
2204
2229
|
return rawTsConfigJson;
|
|
2205
2230
|
}, "readTsConfig");
|
|
2206
2231
|
var TS_EXTENSIONS = [
|
|
@@ -2247,9 +2272,6 @@ var retrieveRemoteConfig = /* @__PURE__ */ __name((options) => {
|
|
|
2247
2272
|
};
|
|
2248
2273
|
}, "retrieveRemoteConfig");
|
|
2249
2274
|
|
|
2250
|
-
// packages/dts-plugin/src/core/lib/DtsWorker.ts
|
|
2251
|
-
var import_lodash2 = __toESM(require("lodash.clonedeepwith"));
|
|
2252
|
-
|
|
2253
2275
|
// packages/dts-plugin/src/core/rpc/index.ts
|
|
2254
2276
|
var rpc_exports = {};
|
|
2255
2277
|
__export(rpc_exports, {
|
|
@@ -2458,11 +2480,24 @@ function createRpcWorker(modulePath, data, memoryLimit, once) {
|
|
|
2458
2480
|
return remoteMethod(...args);
|
|
2459
2481
|
},
|
|
2460
2482
|
terminate() {
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2483
|
+
try {
|
|
2484
|
+
if (childProcess.connected) {
|
|
2485
|
+
childProcess.send({
|
|
2486
|
+
type: RpcGMCallTypes.EXIT,
|
|
2487
|
+
id
|
|
2488
|
+
}, (err) => {
|
|
2489
|
+
if (err) {
|
|
2490
|
+
console.error("Error sending message:", err);
|
|
2491
|
+
}
|
|
2492
|
+
});
|
|
2493
|
+
}
|
|
2494
|
+
} catch (error2) {
|
|
2495
|
+
if (error2.code === "EPIPE") {
|
|
2496
|
+
console.error("Pipe closed before message could be sent:", error2);
|
|
2497
|
+
} else {
|
|
2498
|
+
console.error("Unexpected error:", error2);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2466
2501
|
childProcess = void 0;
|
|
2467
2502
|
remoteMethod = void 0;
|
|
2468
2503
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as DtsWorkerOptions } from './DtsWorker-17de6ba4.js';
|
|
2
2
|
import 'child_process';
|
|
3
|
-
import './DTSManagerOptions-
|
|
3
|
+
import './DTSManagerOptions-7109e8ac.js';
|
|
4
4
|
import '@module-federation/sdk';
|
|
5
5
|
import 'typescript';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as DtsWorkerOptions } from './DtsWorker-17de6ba4.js';
|
|
2
2
|
import 'child_process';
|
|
3
|
-
import './DTSManagerOptions-
|
|
3
|
+
import './DTSManagerOptions-7109e8ac.js';
|
|
4
4
|
import '@module-federation/sdk';
|
|
5
5
|
import 'typescript';
|
|
6
6
|
|