@module-federation/dts-plugin 0.8.7 → 0.8.9
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 +26 -0
- package/dist/{DTSManagerOptions-92108ee8.d.ts → DTSManagerOptions-c74c59ed.d.ts} +1 -0
- package/dist/{DtsWorker-1bad6327.d.ts → DtsWorker-484d9f4a.d.ts} +1 -1
- package/dist/core.d.mts +3 -3
- package/dist/core.d.ts +3 -3
- package/dist/core.js +35 -9
- package/dist/esm/{chunk-PZ7TR7QG.js → chunk-2B3WPOMZ.js} +1 -1
- package/dist/esm/{chunk-M7Q7FIFW.js → chunk-7XB7PFWZ.js} +35 -9
- package/dist/esm/core.js +2 -2
- package/dist/esm/fork-dev-worker.js +2 -2
- package/dist/esm/fork-generate-dts.js +1 -1
- package/dist/esm/index.js +106 -121
- package/dist/fork-dev-worker.d.mts +1 -1
- package/dist/fork-dev-worker.d.ts +1 -1
- package/dist/fork-dev-worker.js +37 -11
- package/dist/fork-generate-dts.d.mts +2 -2
- package/dist/fork-generate-dts.d.ts +2 -2
- package/dist/fork-generate-dts.js +35 -9
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +179 -168
- package/dist/package.json +1 -1
- package/package.json +6 -6
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
+
## 0.8.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6e3afc6: feat(dts-plugin): support pass headers when request types url
|
|
8
|
+
- 1be9d62: feat(dts-plugin): add dts.displayErrorInTerminal to help control display error
|
|
9
|
+
- 6e3afc6: fix(dts-plugin): set outputDir default value
|
|
10
|
+
- 6e3afc6: fix(dts-plugin): use remoteTarPath first to fetch hot types
|
|
11
|
+
- 6e3afc6: fix(dts-plugin): only consume types in dev
|
|
12
|
+
- 6e3afc6: fix(dts-plugin): throw error while downloading types archive hit historyApiFallback
|
|
13
|
+
- 6e3afc6: fix(dts-plugin): generateTypes should after consumeTypes finished
|
|
14
|
+
- 6e3afc6: fix(dts-plugin): dev plugin should apply after fetchPromise resolved
|
|
15
|
+
- @module-federation/sdk@0.8.9
|
|
16
|
+
- @module-federation/managers@0.8.9
|
|
17
|
+
- @module-federation/third-party-dts-extractor@0.8.9
|
|
18
|
+
- @module-federation/error-codes@0.8.9
|
|
19
|
+
|
|
20
|
+
## 0.8.8
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- @module-federation/sdk@0.8.8
|
|
25
|
+
- @module-federation/managers@0.8.8
|
|
26
|
+
- @module-federation/third-party-dts-extractor@0.8.8
|
|
27
|
+
- @module-federation/error-codes@0.8.8
|
|
28
|
+
|
|
3
29
|
## 0.8.7
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -26,6 +26,7 @@ interface DTSManagerOptions {
|
|
|
26
26
|
remote?: RemoteOptions;
|
|
27
27
|
host?: HostOptions;
|
|
28
28
|
extraOptions?: Record<string, any>;
|
|
29
|
+
displayErrorInTerminal?: moduleFederationPlugin.PluginDtsOptions['displayErrorInTerminal'];
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export { DTSManagerOptions as D, HostOptions as H, RemoteInfo as R, RemoteOptions as a };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChildProcess } from 'child_process';
|
|
2
|
-
import { a as RemoteOptions, D as DTSManagerOptions, R as RemoteInfo, H as HostOptions } from './DTSManagerOptions-
|
|
2
|
+
import { a as RemoteOptions, D as DTSManagerOptions, R as RemoteInfo, H as HostOptions } from './DTSManagerOptions-c74c59ed.js';
|
|
3
3
|
import ts from 'typescript';
|
|
4
4
|
|
|
5
5
|
interface TsConfigJson {
|
package/dist/core.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DTSManager, T as TsConfigJson, 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-
|
|
2
|
-
export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-
|
|
3
|
-
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-
|
|
1
|
+
import { D as DTSManager, T as TsConfigJson, 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-484d9f4a.js';
|
|
2
|
+
export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-484d9f4a.js';
|
|
3
|
+
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-c74c59ed.js';
|
|
4
4
|
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
5
5
|
import { ChildProcess } from 'child_process';
|
|
6
6
|
import 'typescript';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DTSManager, T as TsConfigJson, 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-
|
|
2
|
-
export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-
|
|
3
|
-
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-
|
|
1
|
+
import { D as DTSManager, T as TsConfigJson, 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-484d9f4a.js';
|
|
2
|
+
export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-484d9f4a.js';
|
|
3
|
+
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-c74c59ed.js';
|
|
4
4
|
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
5
5
|
import { ChildProcess } from 'child_process';
|
|
6
6
|
import 'typescript';
|
package/dist/core.js
CHANGED
|
@@ -116,6 +116,7 @@ var import_path4 = __toESM(require("path"));
|
|
|
116
116
|
var import_axios = __toESM(require("axios"));
|
|
117
117
|
var import_http2 = __toESM(require("http"));
|
|
118
118
|
var import_https = __toESM(require("https"));
|
|
119
|
+
var import_sdk6 = require("@module-federation/sdk");
|
|
119
120
|
var import_ansi_colors = __toESM(require("ansi-colors"));
|
|
120
121
|
|
|
121
122
|
// packages/dts-plugin/src/core/lib/DTSManager.ts
|
|
@@ -149,7 +150,7 @@ function writeTempTsConfig(tsConfig, context, name) {
|
|
|
149
150
|
const createHash = /* @__PURE__ */ __name((contents) => {
|
|
150
151
|
return import_crypto.default.createHash("md5").update(contents).digest("hex");
|
|
151
152
|
}, "createHash");
|
|
152
|
-
const hash = createHash(`${JSON.stringify(tsConfig)}${name}`);
|
|
153
|
+
const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`);
|
|
153
154
|
const tempTsConfigJsonPath = (0, import_path.resolve)(context, "node_modules", import_sdk.TEMP_DIR, `tsconfig.${hash}.json`);
|
|
154
155
|
(0, import_fs_extra.ensureDirSync)((0, import_path.dirname)(tempTsConfigJsonPath));
|
|
155
156
|
(0, import_fs_extra.writeFileSync)(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
|
|
@@ -1149,6 +1150,7 @@ var retrieveTypesArchiveDestinationPath = /* @__PURE__ */ __name((hostOptions, d
|
|
|
1149
1150
|
var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
|
|
1150
1151
|
let retries = 0;
|
|
1151
1152
|
return (_0) => __async(void 0, [_0], function* ([destinationFolder, fileToDownload]) {
|
|
1153
|
+
var _a3;
|
|
1152
1154
|
const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
|
|
1153
1155
|
while (retries++ < hostOptions.maxRetries) {
|
|
1154
1156
|
try {
|
|
@@ -1156,6 +1158,9 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
|
|
|
1156
1158
|
const response = yield axiosGet(url, {
|
|
1157
1159
|
responseType: "arraybuffer"
|
|
1158
1160
|
}).catch(downloadErrorLogger(destinationFolder, url));
|
|
1161
|
+
if (typeof ((_a3 = response.headers) == null ? void 0 : _a3["content-type"]) === "string" && response.headers["content-type"].includes("text/html")) {
|
|
1162
|
+
throw new Error(`${url} receives invalid content-type: ${response.headers["content-type"]}`);
|
|
1163
|
+
}
|
|
1159
1164
|
try {
|
|
1160
1165
|
if (hostOptions.deleteTypesFolder) {
|
|
1161
1166
|
yield (0, import_promises2.rm)(destinationPath, {
|
|
@@ -1168,6 +1173,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
|
|
|
1168
1173
|
}
|
|
1169
1174
|
const zip = new import_adm_zip.default(Buffer.from(response.data));
|
|
1170
1175
|
zip.extractAllTo(destinationPath, true);
|
|
1176
|
+
fileLog(`zip.extractAllTo success destinationPath: ${destinationPath}; url: ${url}`, "downloadTypesArchive", "info");
|
|
1171
1177
|
return [
|
|
1172
1178
|
destinationFolder,
|
|
1173
1179
|
destinationPath
|
|
@@ -1368,7 +1374,9 @@ var DTSManager = (_a = class {
|
|
|
1368
1374
|
logger.success("Federated types created correctly");
|
|
1369
1375
|
} catch (error2) {
|
|
1370
1376
|
if (((_a3 = this.options.remote) == null ? void 0 : _a3.abortOnError) === false) {
|
|
1371
|
-
|
|
1377
|
+
if (this.options.displayErrorInTerminal) {
|
|
1378
|
+
logger.error(`Unable to compile federated types${error2}`);
|
|
1379
|
+
}
|
|
1372
1380
|
} else {
|
|
1373
1381
|
throw error2;
|
|
1374
1382
|
}
|
|
@@ -1447,8 +1455,9 @@ var DTSManager = (_a = class {
|
|
|
1447
1455
|
const filePath = import_path3.default.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
|
|
1448
1456
|
import_fs.default.writeFileSync(filePath, apiTypeFile);
|
|
1449
1457
|
this.loadedRemoteAPIAlias.add(remoteInfo.alias);
|
|
1458
|
+
fileLog(`success`, "downloadAPITypes", "info");
|
|
1450
1459
|
} catch (err) {
|
|
1451
|
-
fileLog(`Unable to download "${remoteInfo.name}" api types, ${err}`, "
|
|
1460
|
+
fileLog(`Unable to download "${remoteInfo.name}" api types, ${err}`, "downloadAPITypes", "error");
|
|
1452
1461
|
}
|
|
1453
1462
|
});
|
|
1454
1463
|
}
|
|
@@ -1563,9 +1572,10 @@ var DTSManager = (_a = class {
|
|
|
1563
1572
|
return __async(this, null, function* () {
|
|
1564
1573
|
var _a3, _b, _c;
|
|
1565
1574
|
try {
|
|
1566
|
-
const { remoteName, updateMode, remoteInfo: updatedRemoteInfo, once } = options;
|
|
1575
|
+
const { remoteName, updateMode, remoteTarPath, remoteInfo: updatedRemoteInfo, once } = options;
|
|
1567
1576
|
const hostName = (_c = (_b = (_a3 = this.options) == null ? void 0 : _a3.host) == null ? void 0 : _b.moduleFederationConfig) == null ? void 0 : _c.name;
|
|
1568
|
-
fileLog(`
|
|
1577
|
+
fileLog(`options: ${JSON.stringify(options, null, 2)};
|
|
1578
|
+
hostName: ${hostName}`, "updateTypes", "info");
|
|
1569
1579
|
if (updateMode === UpdateMode.POSITIVE && remoteName === hostName) {
|
|
1570
1580
|
if (!this.options.remote) {
|
|
1571
1581
|
return;
|
|
@@ -1579,13 +1589,23 @@ var DTSManager = (_a = class {
|
|
|
1579
1589
|
const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
|
|
1580
1590
|
const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
|
|
1581
1591
|
const consumeTypes2 = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
|
|
1582
|
-
|
|
1592
|
+
fileLog(`consumeTypes start`, "updateTypes", "info");
|
|
1593
|
+
if (!requiredRemoteInfo.zipUrl) {
|
|
1594
|
+
throw new Error(`Can not get ${requiredRemoteInfo.name}'s types archive url!`);
|
|
1595
|
+
}
|
|
1596
|
+
const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, __spreadProps(__spreadValues({}, requiredRemoteInfo), {
|
|
1597
|
+
// use remoteTarPath first
|
|
1598
|
+
zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl
|
|
1599
|
+
}));
|
|
1583
1600
|
yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
|
|
1601
|
+
fileLog(`consumeTypes end`, "updateTypes", "info");
|
|
1584
1602
|
}), "consumeTypes");
|
|
1603
|
+
fileLog(`loadedRemoteInfo: ${JSON.stringify(loadedRemoteInfo, null, 2)}`, "updateTypes", "info");
|
|
1585
1604
|
if (!loadedRemoteInfo) {
|
|
1586
1605
|
const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
|
|
1587
1606
|
return item.name === remoteName;
|
|
1588
1607
|
});
|
|
1608
|
+
fileLog(`remoteInfo: ${JSON.stringify(remoteInfo, null, 2)}`, "updateTypes", "info");
|
|
1589
1609
|
if (remoteInfo) {
|
|
1590
1610
|
if (!this.remoteAliasMap[remoteInfo.alias]) {
|
|
1591
1611
|
const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
|
|
@@ -1605,7 +1625,7 @@ var DTSManager = (_a = class {
|
|
|
1605
1625
|
});
|
|
1606
1626
|
fileLog(`start request manifest`, "consumeTypes", "info");
|
|
1607
1627
|
this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo);
|
|
1608
|
-
fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "
|
|
1628
|
+
fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "updateTypes", "info");
|
|
1609
1629
|
yield consumeDynamicRemoteTypes();
|
|
1610
1630
|
}
|
|
1611
1631
|
if (!once && this.updatedRemoteInfos[updatedRemoteInfo.name]) {
|
|
@@ -1720,6 +1740,10 @@ function cloneDeepOptions(options) {
|
|
|
1720
1740
|
});
|
|
1721
1741
|
}
|
|
1722
1742
|
__name(cloneDeepOptions, "cloneDeepOptions");
|
|
1743
|
+
var getEnvHeaders = /* @__PURE__ */ __name(() => {
|
|
1744
|
+
const headersStr = (0, import_sdk6.getProcessEnv)()["MF_ENV_HEADERS"] || "{}";
|
|
1745
|
+
return __spreadValues({}, JSON.parse(headersStr));
|
|
1746
|
+
}, "getEnvHeaders");
|
|
1723
1747
|
function axiosGet(url, config) {
|
|
1724
1748
|
return __async(this, null, function* () {
|
|
1725
1749
|
const httpAgent = new import_http2.default.Agent({
|
|
@@ -1728,10 +1752,12 @@ function axiosGet(url, config) {
|
|
|
1728
1752
|
const httpsAgent = new import_https.default.Agent({
|
|
1729
1753
|
family: 4
|
|
1730
1754
|
});
|
|
1731
|
-
return import_axios.default.get(url, __spreadValues({
|
|
1755
|
+
return import_axios.default.get(url, __spreadValues(__spreadValues({
|
|
1732
1756
|
httpAgent,
|
|
1733
1757
|
httpsAgent
|
|
1734
|
-
},
|
|
1758
|
+
}, {
|
|
1759
|
+
headers: getEnvHeaders()
|
|
1760
|
+
}), config));
|
|
1735
1761
|
});
|
|
1736
1762
|
}
|
|
1737
1763
|
__name(axiosGet, "axiosGet");
|
|
@@ -48,7 +48,7 @@ function writeTempTsConfig(tsConfig, context, name) {
|
|
|
48
48
|
const createHash = /* @__PURE__ */ __name((contents) => {
|
|
49
49
|
return crypto.createHash("md5").update(contents).digest("hex");
|
|
50
50
|
}, "createHash");
|
|
51
|
-
const hash = createHash(`${JSON.stringify(tsConfig)}${name}`);
|
|
51
|
+
const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`);
|
|
52
52
|
const tempTsConfigJsonPath = resolve(context, "node_modules", TEMP_DIR, `tsconfig.${hash}.json`);
|
|
53
53
|
ensureDirSync(dirname(tempTsConfigJsonPath));
|
|
54
54
|
writeFileSync(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
|
|
@@ -576,6 +576,7 @@ import path3 from "path";
|
|
|
576
576
|
import axios from "axios";
|
|
577
577
|
import http from "http";
|
|
578
578
|
import https from "https";
|
|
579
|
+
import { getProcessEnv } from "@module-federation/sdk";
|
|
579
580
|
import ansiColors from "ansi-colors";
|
|
580
581
|
|
|
581
582
|
// packages/dts-plugin/src/core/configurations/remotePlugin.ts
|
|
@@ -885,7 +886,9 @@ var DTSManager = (_a = class {
|
|
|
885
886
|
logger.success("Federated types created correctly");
|
|
886
887
|
} catch (error) {
|
|
887
888
|
if (((_a2 = this.options.remote) == null ? void 0 : _a2.abortOnError) === false) {
|
|
888
|
-
|
|
889
|
+
if (this.options.displayErrorInTerminal) {
|
|
890
|
+
logger.error(`Unable to compile federated types${error}`);
|
|
891
|
+
}
|
|
889
892
|
} else {
|
|
890
893
|
throw error;
|
|
891
894
|
}
|
|
@@ -964,8 +967,9 @@ var DTSManager = (_a = class {
|
|
|
964
967
|
const filePath = path2.join(destinationPath, REMOTE_API_TYPES_FILE_NAME);
|
|
965
968
|
fs2.writeFileSync(filePath, apiTypeFile);
|
|
966
969
|
this.loadedRemoteAPIAlias.add(remoteInfo.alias);
|
|
970
|
+
fileLog(`success`, "downloadAPITypes", "info");
|
|
967
971
|
} catch (err) {
|
|
968
|
-
fileLog(`Unable to download "${remoteInfo.name}" api types, ${err}`, "
|
|
972
|
+
fileLog(`Unable to download "${remoteInfo.name}" api types, ${err}`, "downloadAPITypes", "error");
|
|
969
973
|
}
|
|
970
974
|
});
|
|
971
975
|
}
|
|
@@ -1080,9 +1084,10 @@ var DTSManager = (_a = class {
|
|
|
1080
1084
|
return __async(this, null, function* () {
|
|
1081
1085
|
var _a2, _b, _c;
|
|
1082
1086
|
try {
|
|
1083
|
-
const { remoteName, updateMode, remoteInfo: updatedRemoteInfo, once } = options;
|
|
1087
|
+
const { remoteName, updateMode, remoteTarPath, remoteInfo: updatedRemoteInfo, once } = options;
|
|
1084
1088
|
const hostName = (_c = (_b = (_a2 = this.options) == null ? void 0 : _a2.host) == null ? void 0 : _b.moduleFederationConfig) == null ? void 0 : _c.name;
|
|
1085
|
-
fileLog(`
|
|
1089
|
+
fileLog(`options: ${JSON.stringify(options, null, 2)};
|
|
1090
|
+
hostName: ${hostName}`, "updateTypes", "info");
|
|
1086
1091
|
if (updateMode === UpdateMode.POSITIVE && remoteName === hostName) {
|
|
1087
1092
|
if (!this.options.remote) {
|
|
1088
1093
|
return;
|
|
@@ -1096,13 +1101,23 @@ var DTSManager = (_a = class {
|
|
|
1096
1101
|
const { hostOptions, mapRemotesToDownload } = retrieveHostConfig(this.options.host);
|
|
1097
1102
|
const loadedRemoteInfo = Object.values(remoteAliasMap).find((i) => i.name === remoteName);
|
|
1098
1103
|
const consumeTypes = /* @__PURE__ */ __name((requiredRemoteInfo) => __async(this, null, function* () {
|
|
1099
|
-
|
|
1104
|
+
fileLog(`consumeTypes start`, "updateTypes", "info");
|
|
1105
|
+
if (!requiredRemoteInfo.zipUrl) {
|
|
1106
|
+
throw new Error(`Can not get ${requiredRemoteInfo.name}'s types archive url!`);
|
|
1107
|
+
}
|
|
1108
|
+
const [_alias, destinationPath] = yield this.consumeTargetRemotes(hostOptions, __spreadProps(__spreadValues({}, requiredRemoteInfo), {
|
|
1109
|
+
// use remoteTarPath first
|
|
1110
|
+
zipUrl: remoteTarPath || requiredRemoteInfo.zipUrl
|
|
1111
|
+
}));
|
|
1100
1112
|
yield this.downloadAPITypes(requiredRemoteInfo, destinationPath);
|
|
1113
|
+
fileLog(`consumeTypes end`, "updateTypes", "info");
|
|
1101
1114
|
}), "consumeTypes");
|
|
1115
|
+
fileLog(`loadedRemoteInfo: ${JSON.stringify(loadedRemoteInfo, null, 2)}`, "updateTypes", "info");
|
|
1102
1116
|
if (!loadedRemoteInfo) {
|
|
1103
1117
|
const remoteInfo = Object.values(mapRemotesToDownload).find((item) => {
|
|
1104
1118
|
return item.name === remoteName;
|
|
1105
1119
|
});
|
|
1120
|
+
fileLog(`remoteInfo: ${JSON.stringify(remoteInfo, null, 2)}`, "updateTypes", "info");
|
|
1106
1121
|
if (remoteInfo) {
|
|
1107
1122
|
if (!this.remoteAliasMap[remoteInfo.alias]) {
|
|
1108
1123
|
const requiredRemoteInfo = yield this.requestRemoteManifest(remoteInfo);
|
|
@@ -1122,7 +1137,7 @@ var DTSManager = (_a = class {
|
|
|
1122
1137
|
});
|
|
1123
1138
|
fileLog(`start request manifest`, "consumeTypes", "info");
|
|
1124
1139
|
this.updatedRemoteInfos[updatedRemoteInfo.name] = yield this.requestRemoteManifest(parsedRemoteInfo);
|
|
1125
|
-
fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "
|
|
1140
|
+
fileLog(`end request manifest, this.updatedRemoteInfos[updatedRemoteInfo.name]: ${JSON.stringify(this.updatedRemoteInfos[updatedRemoteInfo.name], null, 2)}`, "updateTypes", "info");
|
|
1126
1141
|
yield consumeDynamicRemoteTypes();
|
|
1127
1142
|
}
|
|
1128
1143
|
if (!once && this.updatedRemoteInfos[updatedRemoteInfo.name]) {
|
|
@@ -1237,6 +1252,10 @@ function cloneDeepOptions(options) {
|
|
|
1237
1252
|
});
|
|
1238
1253
|
}
|
|
1239
1254
|
__name(cloneDeepOptions, "cloneDeepOptions");
|
|
1255
|
+
var getEnvHeaders = /* @__PURE__ */ __name(() => {
|
|
1256
|
+
const headersStr = getProcessEnv()["MF_ENV_HEADERS"] || "{}";
|
|
1257
|
+
return __spreadValues({}, JSON.parse(headersStr));
|
|
1258
|
+
}, "getEnvHeaders");
|
|
1240
1259
|
function axiosGet(url, config) {
|
|
1241
1260
|
return __async(this, null, function* () {
|
|
1242
1261
|
const httpAgent = new http.Agent({
|
|
@@ -1245,10 +1264,12 @@ function axiosGet(url, config) {
|
|
|
1245
1264
|
const httpsAgent = new https.Agent({
|
|
1246
1265
|
family: 4
|
|
1247
1266
|
});
|
|
1248
|
-
return axios.get(url, __spreadValues({
|
|
1267
|
+
return axios.get(url, __spreadValues(__spreadValues({
|
|
1249
1268
|
httpAgent,
|
|
1250
1269
|
httpsAgent
|
|
1251
|
-
},
|
|
1270
|
+
}, {
|
|
1271
|
+
headers: getEnvHeaders()
|
|
1272
|
+
}), config));
|
|
1252
1273
|
});
|
|
1253
1274
|
}
|
|
1254
1275
|
__name(axiosGet, "axiosGet");
|
|
@@ -1272,6 +1293,7 @@ var retrieveTypesArchiveDestinationPath = /* @__PURE__ */ __name((hostOptions, d
|
|
|
1272
1293
|
var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
|
|
1273
1294
|
let retries = 0;
|
|
1274
1295
|
return (_0) => __async(void 0, [_0], function* ([destinationFolder, fileToDownload]) {
|
|
1296
|
+
var _a2;
|
|
1275
1297
|
const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
|
|
1276
1298
|
while (retries++ < hostOptions.maxRetries) {
|
|
1277
1299
|
try {
|
|
@@ -1279,6 +1301,9 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
|
|
|
1279
1301
|
const response = yield axiosGet(url, {
|
|
1280
1302
|
responseType: "arraybuffer"
|
|
1281
1303
|
}).catch(downloadErrorLogger(destinationFolder, url));
|
|
1304
|
+
if (typeof ((_a2 = response.headers) == null ? void 0 : _a2["content-type"]) === "string" && response.headers["content-type"].includes("text/html")) {
|
|
1305
|
+
throw new Error(`${url} receives invalid content-type: ${response.headers["content-type"]}`);
|
|
1306
|
+
}
|
|
1282
1307
|
try {
|
|
1283
1308
|
if (hostOptions.deleteTypesFolder) {
|
|
1284
1309
|
yield rm3(destinationPath, {
|
|
@@ -1291,6 +1316,7 @@ var downloadTypesArchive = /* @__PURE__ */ __name((hostOptions) => {
|
|
|
1291
1316
|
}
|
|
1292
1317
|
const zip = new AdmZip(Buffer.from(response.data));
|
|
1293
1318
|
zip.extractAllTo(destinationPath, true);
|
|
1319
|
+
fileLog(`zip.extractAllTo success destinationPath: ${destinationPath}; url: ${url}`, "downloadTypesArchive", "info");
|
|
1294
1320
|
return [
|
|
1295
1321
|
destinationFolder,
|
|
1296
1322
|
destinationPath
|
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-2B3WPOMZ.js";
|
|
7
7
|
import {
|
|
8
8
|
DTSManager,
|
|
9
9
|
HOST_API_TYPES_FILE_NAME,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
retrieveTypesAssetsInfo,
|
|
20
20
|
retrieveTypesZipPath,
|
|
21
21
|
validateOptions
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-7XB7PFWZ.js";
|
|
23
23
|
import "./chunk-KCWHOFI6.js";
|
|
24
24
|
import "./chunk-4CSLH7II.js";
|
|
25
25
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
rpc_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2B3WPOMZ.js";
|
|
4
4
|
import {
|
|
5
5
|
ModuleFederationDevServer,
|
|
6
6
|
createKoaServer,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
retrieveMfTypesPath,
|
|
10
10
|
retrieveRemoteConfig,
|
|
11
11
|
retrieveTypesZipPath
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7XB7PFWZ.js";
|
|
13
13
|
import {
|
|
14
14
|
fileLog,
|
|
15
15
|
getIPV4
|