@module-federation/dts-plugin 2.3.0 → 2.3.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/{Broker-BGm-heAJ.js → Broker-DRFgFvXI.js} +3 -4
- package/dist/CHANGELOG.md +19 -0
- package/dist/{consumeTypes-ClKC4akt.js → consumeTypes-DMGONsAA.js} +1 -1
- package/dist/core.js +3 -3
- package/dist/esm/{Broker-CtU3X_nw.mjs → Broker-z82OgzMe.mjs} +2 -3
- package/dist/esm/{consumeTypes-DnucwjbD.mjs → consumeTypes-BCpXQKno.mjs} +1 -1
- package/dist/esm/core.mjs +3 -3
- package/dist/esm/{expose-rpc-Pg59hZO8.mjs → expose-rpc--EENEdVk.mjs} +94 -37
- package/dist/esm/fork-dev-worker.mjs +3 -3
- package/dist/esm/fork-generate-dts.mjs +2 -2
- package/dist/esm/index.mjs +12 -11
- package/dist/esm/start-broker.mjs +1 -1
- package/dist/{expose-rpc-xfJEPIyY.js → expose-rpc-BPeKtqLv.js} +97 -44
- package/dist/fork-dev-worker.js +3 -3
- package/dist/fork-generate-dts.js +2 -2
- package/dist/index.js +13 -12
- package/dist/start-broker.js +1 -1
- package/package.json +10 -14
- package/dist/package.json +0 -112
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
const require_Action = require('./Action-CzhPMw2i.js');
|
|
2
|
-
let path = require("path");
|
|
3
|
-
path = require_Action.__toESM(path);
|
|
4
2
|
let fs = require("fs");
|
|
5
3
|
fs = require_Action.__toESM(fs);
|
|
6
|
-
let
|
|
4
|
+
let path = require("path");
|
|
5
|
+
path = require_Action.__toESM(path);
|
|
7
6
|
let _module_federation_sdk = require("@module-federation/sdk");
|
|
8
7
|
let net = require("net");
|
|
9
8
|
net = require_Action.__toESM(net);
|
|
10
|
-
require("chalk");
|
|
11
9
|
let os = require("os");
|
|
12
10
|
os = require_Action.__toESM(os);
|
|
13
11
|
let isomorphic_ws = require("isomorphic-ws");
|
|
14
12
|
isomorphic_ws = require_Action.__toESM(isomorphic_ws);
|
|
13
|
+
let http = require("http");
|
|
15
14
|
let node_schedule = require("node-schedule");
|
|
16
15
|
node_schedule = require_Action.__toESM(node_schedule);
|
|
17
16
|
let url = require("url");
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
+
## 2.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1c02710: chore: lock deps
|
|
8
|
+
- @module-federation/sdk@2.3.2
|
|
9
|
+
- @module-federation/managers@2.3.2
|
|
10
|
+
- @module-federation/third-party-dts-extractor@2.3.2
|
|
11
|
+
- @module-federation/error-codes@2.3.2
|
|
12
|
+
|
|
13
|
+
## 2.3.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- @module-federation/sdk@2.3.1
|
|
18
|
+
- @module-federation/managers@2.3.1
|
|
19
|
+
- @module-federation/third-party-dts-extractor@2.3.1
|
|
20
|
+
- @module-federation/error-codes@2.3.1
|
|
21
|
+
|
|
3
22
|
## 2.3.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -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-BPeKtqLv.js');
|
|
3
3
|
let path = require("path");
|
|
4
4
|
path = require_Action.__toESM(path);
|
|
5
5
|
let crypto = require("crypto");
|
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-DRFgFvXI.js');
|
|
3
|
+
const require_expose_rpc = require('./expose-rpc-BPeKtqLv.js');
|
|
4
|
+
const require_consumeTypes = require('./consumeTypes-DMGONsAA.js');
|
|
5
5
|
|
|
6
6
|
exports.DTSManager = require_expose_rpc.DTSManager;
|
|
7
7
|
exports.DtsWorker = require_consumeTypes.DtsWorker;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { a as MF_SERVER_IDENTIFIER, c as WEB_SOCKET_CONNECT_MAGIC_ID, i as DEFAULT_WEB_SOCKET_PORT, l as Message, n as ActionKind, o as UpdateMode } from "./Action-DNNg2YDh.mjs";
|
|
2
|
-
import * as path$1 from "path";
|
|
3
2
|
import * as fs$1 from "fs";
|
|
4
|
-
import
|
|
3
|
+
import * as path$1 from "path";
|
|
5
4
|
import { SEPARATOR, createLogger } from "@module-federation/sdk";
|
|
6
5
|
import net from "net";
|
|
7
|
-
import "chalk";
|
|
8
6
|
import os from "os";
|
|
9
7
|
import WebSocket from "isomorphic-ws";
|
|
8
|
+
import { createServer } from "http";
|
|
10
9
|
import schedule from "node-schedule";
|
|
11
10
|
import { parse } from "url";
|
|
12
11
|
|
|
@@ -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--EENEdVk.mjs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { randomUUID } from "crypto";
|
|
4
4
|
import * as child_process from "child_process";
|
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--EENEdVk.mjs";
|
|
2
|
+
import "./Broker-z82OgzMe.mjs";
|
|
3
|
+
import { i as rpc_exports, n as generateTypesInChildProcess, r as DtsWorker, t as consumeTypes } from "./consumeTypes-BCpXQKno.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 };
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { a as MF_SERVER_IDENTIFIER, n as ActionKind, o as UpdateMode, r as DEFAULT_TAR_NAME, t as Action } from "./Action-DNNg2YDh.mjs";
|
|
2
|
-
import { a as getIdentifier, c as logger$1, i as getFreePort, l as LogKind, n as UpdateKind, o as getIPV4, r as fib, s as fileLog, t as Broker, u as APIKind } from "./Broker-
|
|
2
|
+
import { a as getIdentifier, c as logger$1, i as getFreePort, l as LogKind, n as UpdateKind, o as getIPV4, r as fib, s as fileLog, t as Broker, u as APIKind } from "./Broker-z82OgzMe.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
-
import
|
|
4
|
+
import fs, { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
5
5
|
import path, { dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "path";
|
|
6
|
-
import
|
|
6
|
+
import { cp, mkdir, readFile, readdir, rm, stat, writeFile } from "fs/promises";
|
|
7
7
|
import { utils } from "@module-federation/managers";
|
|
8
8
|
import typescript from "typescript";
|
|
9
|
-
import axios from "axios";
|
|
10
|
-
import http from "http";
|
|
11
|
-
import https from "https";
|
|
12
9
|
import { ENCODE_NAME_PREFIX, MANIFEST_EXT, TEMP_DIR, decodeName, getProcessEnv, inferAutoPublicPath, parseEntry } from "@module-federation/sdk";
|
|
13
10
|
import ansiColors from "ansi-colors";
|
|
14
|
-
import {
|
|
11
|
+
import { Agent } from "undici";
|
|
15
12
|
import { ThirdPartyExtractor } from "@module-federation/third-party-dts-extractor";
|
|
16
13
|
import AdmZip from "adm-zip";
|
|
17
14
|
import crypto from "crypto";
|
|
@@ -20,7 +17,7 @@ import { logAndReport } from "@module-federation/error-codes/node";
|
|
|
20
17
|
import { execFile, fork } from "child_process";
|
|
21
18
|
import util from "util";
|
|
22
19
|
import WebSocket from "isomorphic-ws";
|
|
23
|
-
import
|
|
20
|
+
import http from "http";
|
|
24
21
|
import process$1 from "process";
|
|
25
22
|
|
|
26
23
|
//#region \0rolldown/runtime.js
|
|
@@ -417,7 +414,7 @@ async function createHttpServer(options) {
|
|
|
417
414
|
res.end();
|
|
418
415
|
return;
|
|
419
416
|
}
|
|
420
|
-
const stream =
|
|
417
|
+
const stream = fs.createReadStream(typeTarPath);
|
|
421
418
|
stream.on("error", () => {
|
|
422
419
|
if (!res.headersSent) res.statusCode = 500;
|
|
423
420
|
res.end();
|
|
@@ -440,7 +437,6 @@ async function createHttpServer(options) {
|
|
|
440
437
|
|
|
441
438
|
//#endregion
|
|
442
439
|
//#region src/core/lib/typeScriptCompiler.ts
|
|
443
|
-
const { ensureDirSync, writeFileSync, existsSync: existsSync$1 } = fse;
|
|
444
440
|
const STARTS_WITH_SLASH = /^\//;
|
|
445
441
|
const DEFINITION_FILE_EXTENSION = ".d.ts";
|
|
446
442
|
const retrieveMfTypesPath = (tsConfig, remoteOptions) => normalize(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, ""));
|
|
@@ -452,7 +448,7 @@ function writeTempTsConfig(tsConfig, context, name, cwd) {
|
|
|
452
448
|
};
|
|
453
449
|
const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`);
|
|
454
450
|
const tempTsConfigJsonPath = resolve(cwd ?? context, "node_modules", TEMP_DIR, `tsconfig.${hash}.json`);
|
|
455
|
-
|
|
451
|
+
mkdirSync(dirname(tempTsConfigJsonPath), { recursive: true });
|
|
456
452
|
writeFileSync(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
|
|
457
453
|
return tempTsConfigJsonPath;
|
|
458
454
|
}
|
|
@@ -469,7 +465,7 @@ function getExposeKey(options) {
|
|
|
469
465
|
}
|
|
470
466
|
const processTypesFile = async (options) => {
|
|
471
467
|
const { outDir, filePath, rootDir, cb, mapExposeToEntry, mfTypePath } = options;
|
|
472
|
-
if (!existsSync
|
|
468
|
+
if (!existsSync(filePath)) return;
|
|
473
469
|
if ((await stat(filePath)).isDirectory()) {
|
|
474
470
|
const files = await readdir(filePath);
|
|
475
471
|
await Promise.all(files.map((file) => processTypesFile({
|
|
@@ -487,7 +483,7 @@ const processTypesFile = async (options) => {
|
|
|
487
483
|
const mfeTypeEntry = join(mfTypePath, `${exposeKey === "." ? "index" : exposeKey}${DEFINITION_FILE_EXTENSION}`);
|
|
488
484
|
const mfeTypeEntryDirectory = dirname(mfeTypeEntry);
|
|
489
485
|
const relativePathToOutput = relative(mfeTypeEntryDirectory, filePath).replace(DEFINITION_FILE_EXTENSION, "").replace(STARTS_WITH_SLASH, "").split(sep).join("/");
|
|
490
|
-
|
|
486
|
+
mkdirSync(mfeTypeEntryDirectory, { recursive: true });
|
|
491
487
|
await writeFile(mfeTypeEntry, `export * from './${relativePathToOutput}';\nexport { default } from './${relativePathToOutput}';`);
|
|
492
488
|
}
|
|
493
489
|
cb(await readFile(filePath, "utf8"));
|
|
@@ -628,7 +624,7 @@ const downloadTypesArchive = (hostOptions) => {
|
|
|
628
624
|
const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
|
|
629
625
|
while (retries++ < hostOptions.maxRetries) try {
|
|
630
626
|
const url = new URL(fileToDownload).href;
|
|
631
|
-
const response = await
|
|
627
|
+
const response = await nativeFetch(url, {
|
|
632
628
|
responseType: "arraybuffer",
|
|
633
629
|
timeout: hostOptions.timeout,
|
|
634
630
|
family: hostOptions.family
|
|
@@ -807,8 +803,11 @@ var DTSManager = class {
|
|
|
807
803
|
const targetDir = path.join(mfTypesPath, "node_modules");
|
|
808
804
|
if (fs.existsSync(remoteTypesFolder)) {
|
|
809
805
|
const targetFolder = path.resolve(remoteOptions.context, targetDir);
|
|
810
|
-
await
|
|
811
|
-
await
|
|
806
|
+
await mkdir(targetFolder, { recursive: true });
|
|
807
|
+
await cp(remoteTypesFolder, targetFolder, {
|
|
808
|
+
recursive: true,
|
|
809
|
+
force: true
|
|
810
|
+
});
|
|
812
811
|
}
|
|
813
812
|
} catch (err) {
|
|
814
813
|
if (this.options.host?.abortOnError === false) fileLog(`Unable to copy remote types, ${err}`, "extractRemoteTypes", "error");
|
|
@@ -863,7 +862,7 @@ var DTSManager = class {
|
|
|
863
862
|
if (!remoteInfo.url.includes(MANIFEST_EXT)) return remoteInfo;
|
|
864
863
|
if (remoteInfo.zipUrl) return remoteInfo;
|
|
865
864
|
const url = remoteInfo.url;
|
|
866
|
-
const manifestJson = (await
|
|
865
|
+
const manifestJson = (await nativeFetch(url, {
|
|
867
866
|
timeout: hostOptions.timeout,
|
|
868
867
|
family: hostOptions.family
|
|
869
868
|
})).data;
|
|
@@ -901,7 +900,7 @@ var DTSManager = class {
|
|
|
901
900
|
const { apiTypeUrl } = remoteInfo;
|
|
902
901
|
if (!apiTypeUrl) return;
|
|
903
902
|
try {
|
|
904
|
-
let apiTypeFile = (await
|
|
903
|
+
let apiTypeFile = (await nativeFetch(apiTypeUrl, {
|
|
905
904
|
timeout: hostOptions.timeout,
|
|
906
905
|
family: hostOptions.family
|
|
907
906
|
})).data;
|
|
@@ -1053,6 +1052,7 @@ var DTSManager = class {
|
|
|
1053
1052
|
|
|
1054
1053
|
//#endregion
|
|
1055
1054
|
//#region src/core/lib/utils.ts
|
|
1055
|
+
const dispatcherCache = /* @__PURE__ */ new Map();
|
|
1056
1056
|
function getDTSManagerConstructor(implementation) {
|
|
1057
1057
|
if (implementation) {
|
|
1058
1058
|
const NewConstructor = __require(implementation);
|
|
@@ -1108,29 +1108,86 @@ const isTSProject = (dtsOptions, context = process.cwd()) => {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
};
|
|
1110
1110
|
function cloneDeepOptions(options) {
|
|
1111
|
-
const excludeKeys = ["manifest", "async"];
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
if (typeof
|
|
1115
|
-
if (key === "extractThirdParty" && Array.isArray(
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1111
|
+
const excludeKeys = new Set(["manifest", "async"]);
|
|
1112
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
1113
|
+
function sanitize(val, key) {
|
|
1114
|
+
if (key !== void 0 && excludeKeys.has(key) || typeof val === "function") return false;
|
|
1115
|
+
if (key === "extractThirdParty" && Array.isArray(val)) return val.map(String);
|
|
1116
|
+
if (Array.isArray(val)) {
|
|
1117
|
+
if (cache.has(val)) return cache.get(val);
|
|
1118
|
+
const out = [];
|
|
1119
|
+
cache.set(val, out);
|
|
1120
|
+
val.forEach((v, i) => out.push(sanitize(v, String(i))));
|
|
1121
|
+
return out;
|
|
1122
|
+
}
|
|
1123
|
+
if (val !== null && typeof val === "object" && Object.getPrototypeOf(val) === Object.prototype) {
|
|
1124
|
+
const obj = val;
|
|
1125
|
+
if (cache.has(obj)) return cache.get(obj);
|
|
1126
|
+
const out = {};
|
|
1127
|
+
cache.set(obj, out);
|
|
1128
|
+
for (const [k, v] of Object.entries(obj)) out[k] = sanitize(v, k);
|
|
1129
|
+
return out;
|
|
1130
|
+
}
|
|
1131
|
+
return val;
|
|
1132
|
+
}
|
|
1133
|
+
return structuredClone(sanitize(options));
|
|
1119
1134
|
}
|
|
1120
1135
|
const getEnvHeaders = () => {
|
|
1121
|
-
const headersStr = getProcessEnv()["MF_ENV_HEADERS"]
|
|
1122
|
-
|
|
1136
|
+
const headersStr = getProcessEnv()["MF_ENV_HEADERS"];
|
|
1137
|
+
if (!headersStr || headersStr === "undefined") return {};
|
|
1138
|
+
try {
|
|
1139
|
+
return { ...JSON.parse(headersStr) };
|
|
1140
|
+
} catch {
|
|
1141
|
+
return {};
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
const createDispatcherFromFamily = (family) => {
|
|
1145
|
+
if (!family) return void 0;
|
|
1146
|
+
if (dispatcherCache.has(family)) return dispatcherCache.get(family);
|
|
1147
|
+
try {
|
|
1148
|
+
const dispatcher = new Agent({ connect: { family } });
|
|
1149
|
+
dispatcherCache.set(family, dispatcher);
|
|
1150
|
+
return dispatcher;
|
|
1151
|
+
} catch {}
|
|
1123
1152
|
};
|
|
1124
|
-
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
httpAgent,
|
|
1129
|
-
httpsAgent,
|
|
1130
|
-
headers: getEnvHeaders(),
|
|
1131
|
-
...config,
|
|
1132
|
-
timeout: config?.timeout || 6e4
|
|
1153
|
+
const toHeaderRecord = (headers) => {
|
|
1154
|
+
const out = {};
|
|
1155
|
+
headers.forEach((value, key) => {
|
|
1156
|
+
out[key.toLowerCase()] = value;
|
|
1133
1157
|
});
|
|
1158
|
+
return out;
|
|
1159
|
+
};
|
|
1160
|
+
async function nativeFetch(url, config) {
|
|
1161
|
+
const controller = new AbortController();
|
|
1162
|
+
const timeoutMs = config?.timeout ?? 6e4;
|
|
1163
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
1164
|
+
const headers = {
|
|
1165
|
+
...getEnvHeaders(),
|
|
1166
|
+
...config?.headers ?? {}
|
|
1167
|
+
};
|
|
1168
|
+
const dispatcher = config?.dispatcher ?? createDispatcherFromFamily(config?.family);
|
|
1169
|
+
try {
|
|
1170
|
+
const resp = await fetch(url, {
|
|
1171
|
+
headers,
|
|
1172
|
+
signal: controller.signal,
|
|
1173
|
+
...dispatcher ? { dispatcher } : {},
|
|
1174
|
+
...config?.agent ? { agent: config.agent } : {}
|
|
1175
|
+
});
|
|
1176
|
+
const headerRecord = toHeaderRecord(resp.headers);
|
|
1177
|
+
if (!resp.ok) throw new Error(`Request failed with status ${resp.status}`);
|
|
1178
|
+
if (config?.responseType === "arraybuffer") return {
|
|
1179
|
+
data: await resp.arrayBuffer(),
|
|
1180
|
+
headers: headerRecord,
|
|
1181
|
+
status: resp.status
|
|
1182
|
+
};
|
|
1183
|
+
return {
|
|
1184
|
+
data: (resp.headers.get("content-type") || "").includes("application/json") || url.endsWith(".json") ? await resp.json() : await resp.text(),
|
|
1185
|
+
headers: headerRecord,
|
|
1186
|
+
status: resp.status
|
|
1187
|
+
};
|
|
1188
|
+
} finally {
|
|
1189
|
+
clearTimeout(timeoutId);
|
|
1190
|
+
}
|
|
1134
1191
|
}
|
|
1135
1192
|
|
|
1136
1193
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as retrieveMfTypesPath, b as ModuleFederationDevServer, g as retrieveTypesZipPath, h as retrieveHostConfig, i as retrieveRemoteConfig, n as RpcGMCallTypes, o as getDTSManagerConstructor, t as exposeRpc, y as createHttpServer } from "./expose-rpc
|
|
1
|
+
import { _ as retrieveMfTypesPath, b as ModuleFederationDevServer, g as retrieveTypesZipPath, h as retrieveHostConfig, i as retrieveRemoteConfig, n as RpcGMCallTypes, o as getDTSManagerConstructor, t as exposeRpc, y as createHttpServer } from "./expose-rpc--EENEdVk.mjs";
|
|
2
2
|
import { o as UpdateMode, r as DEFAULT_TAR_NAME } from "./Action-DNNg2YDh.mjs";
|
|
3
|
-
import { n as UpdateKind, o as getIPV4, s as fileLog } from "./Broker-
|
|
4
|
-
import "./consumeTypes-
|
|
3
|
+
import { n as UpdateKind, o as getIPV4, s as fileLog } from "./Broker-z82OgzMe.mjs";
|
|
4
|
+
import "./consumeTypes-BCpXQKno.mjs";
|
|
5
5
|
import "./core.mjs";
|
|
6
6
|
import { t as getIpFromEntry } from "./utils-CkPvDGOy.mjs";
|
|
7
7
|
import { decodeName } from "@module-federation/sdk";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as RpcGMCallTypes, r as generateTypes, t as exposeRpc } from "./expose-rpc
|
|
2
|
-
import "./Broker-
|
|
1
|
+
import { n as RpcGMCallTypes, r as generateTypes, t as exposeRpc } from "./expose-rpc--EENEdVk.mjs";
|
|
2
|
+
import "./Broker-z82OgzMe.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/core/lib/forkGenerateDts.ts
|
|
5
5
|
async function forkGenerateDts(options) {
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { a as cloneDeepOptions, c as isTSProject, l as retrieveTypesAssetsInfo, n as RpcGMCallTypes, r as generateTypes, u as validateOptions } from "./expose-rpc
|
|
1
|
+
import { a as cloneDeepOptions, c as isTSProject, l as retrieveTypesAssetsInfo, n as RpcGMCallTypes, r as generateTypes, u as validateOptions } from "./expose-rpc--EENEdVk.mjs";
|
|
2
2
|
import { s as WEB_CLIENT_OPTIONS_IDENTIFIER } from "./Action-DNNg2YDh.mjs";
|
|
3
|
-
import { c as logger$1, o as getIPV4 } from "./Broker-
|
|
4
|
-
import { a as createRpcWorker, n as generateTypesInChildProcess, t as consumeTypes } from "./consumeTypes-
|
|
3
|
+
import { c as logger$1, o as getIPV4 } from "./Broker-z82OgzMe.mjs";
|
|
4
|
+
import { a as createRpcWorker, n as generateTypesInChildProcess, t as consumeTypes } from "./consumeTypes-BCpXQKno.mjs";
|
|
5
5
|
import "./core.mjs";
|
|
6
|
-
import
|
|
7
|
-
import fse from "fs-extra";
|
|
6
|
+
import fs from "fs";
|
|
8
7
|
import * as path$1 from "path";
|
|
9
8
|
import path from "path";
|
|
10
|
-
import
|
|
9
|
+
import { rm } from "fs/promises";
|
|
11
10
|
import { TEMP_DIR, infrastructureLogger, logger, normalizeOptions } from "@module-federation/sdk";
|
|
12
11
|
|
|
13
12
|
//#region src/dev-worker/DevWorker.ts
|
|
@@ -41,8 +40,10 @@ var DevWorker = class {
|
|
|
41
40
|
//#region src/dev-worker/createDevWorker.ts
|
|
42
41
|
async function removeLogFile() {
|
|
43
42
|
try {
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
await rm(path$1.resolve(process.cwd(), ".mf/typesGenerate.log"), {
|
|
44
|
+
force: true,
|
|
45
|
+
recursive: true
|
|
46
|
+
});
|
|
46
47
|
} catch (err) {
|
|
47
48
|
console.error("removeLogFile error", "forkDevWorker", err);
|
|
48
49
|
}
|
|
@@ -78,7 +79,7 @@ var PROCESS_EXIT_CODE = /* @__PURE__ */ function(PROCESS_EXIT_CODE) {
|
|
|
78
79
|
function ensureTempDir(filePath) {
|
|
79
80
|
try {
|
|
80
81
|
const dir = path.dirname(filePath);
|
|
81
|
-
|
|
82
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
82
83
|
} catch (_err) {}
|
|
83
84
|
}
|
|
84
85
|
var DevPlugin = class DevPlugin {
|
|
@@ -91,8 +92,8 @@ var DevPlugin = class DevPlugin {
|
|
|
91
92
|
}
|
|
92
93
|
static ensureLiveReloadEntry(options, filePath) {
|
|
93
94
|
ensureTempDir(filePath);
|
|
94
|
-
const liveReloadEntryWithOptions =
|
|
95
|
-
|
|
95
|
+
const liveReloadEntryWithOptions = fs.readFileSync(path.join(__dirname, "./iife/launch-web-client.iife.js")).toString("utf-8").replace(WEB_CLIENT_OPTIONS_IDENTIFIER, JSON.stringify(options));
|
|
96
|
+
fs.writeFileSync(filePath, liveReloadEntryWithOptions);
|
|
96
97
|
}
|
|
97
98
|
_stopWhenSIGTERMOrSIGINT() {
|
|
98
99
|
process.on("SIGTERM", () => {
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
const require_Action = require('./Action-CzhPMw2i.js');
|
|
2
|
-
const require_Broker = require('./Broker-
|
|
3
|
-
let fs_extra = require("fs-extra");
|
|
4
|
-
fs_extra = require_Action.__toESM(fs_extra);
|
|
5
|
-
let path = require("path");
|
|
6
|
-
path = require_Action.__toESM(path);
|
|
2
|
+
const require_Broker = require('./Broker-DRFgFvXI.js');
|
|
7
3
|
let fs = require("fs");
|
|
8
4
|
fs = require_Action.__toESM(fs);
|
|
5
|
+
let path = require("path");
|
|
6
|
+
path = require_Action.__toESM(path);
|
|
7
|
+
let fs_promises = require("fs/promises");
|
|
9
8
|
let _module_federation_managers = require("@module-federation/managers");
|
|
10
9
|
let typescript = require("typescript");
|
|
11
10
|
typescript = require_Action.__toESM(typescript);
|
|
12
|
-
let axios = require("axios");
|
|
13
|
-
axios = require_Action.__toESM(axios);
|
|
14
|
-
let http = require("http");
|
|
15
|
-
http = require_Action.__toESM(http);
|
|
16
|
-
let https = require("https");
|
|
17
|
-
https = require_Action.__toESM(https);
|
|
18
11
|
let _module_federation_sdk = require("@module-federation/sdk");
|
|
19
12
|
let ansi_colors = require("ansi-colors");
|
|
20
13
|
ansi_colors = require_Action.__toESM(ansi_colors);
|
|
21
|
-
let
|
|
14
|
+
let undici = require("undici");
|
|
22
15
|
let _module_federation_third_party_dts_extractor = require("@module-federation/third-party-dts-extractor");
|
|
23
16
|
let adm_zip = require("adm-zip");
|
|
24
17
|
adm_zip = require_Action.__toESM(adm_zip);
|
|
@@ -31,8 +24,8 @@ let util = require("util");
|
|
|
31
24
|
util = require_Action.__toESM(util);
|
|
32
25
|
let isomorphic_ws = require("isomorphic-ws");
|
|
33
26
|
isomorphic_ws = require_Action.__toESM(isomorphic_ws);
|
|
34
|
-
let
|
|
35
|
-
|
|
27
|
+
let http = require("http");
|
|
28
|
+
http = require_Action.__toESM(http);
|
|
36
29
|
let process$1 = require("process");
|
|
37
30
|
process$1 = require_Action.__toESM(process$1);
|
|
38
31
|
|
|
@@ -412,7 +405,7 @@ async function createHttpServer(options) {
|
|
|
412
405
|
res.end();
|
|
413
406
|
return;
|
|
414
407
|
}
|
|
415
|
-
const stream =
|
|
408
|
+
const stream = fs.default.createReadStream(typeTarPath);
|
|
416
409
|
stream.on("error", () => {
|
|
417
410
|
if (!res.headersSent) res.statusCode = 500;
|
|
418
411
|
res.end();
|
|
@@ -435,7 +428,6 @@ async function createHttpServer(options) {
|
|
|
435
428
|
|
|
436
429
|
//#endregion
|
|
437
430
|
//#region src/core/lib/typeScriptCompiler.ts
|
|
438
|
-
const { ensureDirSync, writeFileSync, existsSync: existsSync$1 } = fs_extra.default;
|
|
439
431
|
const STARTS_WITH_SLASH = /^\//;
|
|
440
432
|
const DEFINITION_FILE_EXTENSION = ".d.ts";
|
|
441
433
|
const retrieveMfTypesPath = (tsConfig, remoteOptions) => (0, path.normalize)(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, ""));
|
|
@@ -447,8 +439,8 @@ function writeTempTsConfig(tsConfig, context, name, cwd) {
|
|
|
447
439
|
};
|
|
448
440
|
const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`);
|
|
449
441
|
const tempTsConfigJsonPath = (0, path.resolve)(cwd ?? context, "node_modules", _module_federation_sdk.TEMP_DIR, `tsconfig.${hash}.json`);
|
|
450
|
-
|
|
451
|
-
writeFileSync(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
|
|
442
|
+
(0, fs.mkdirSync)((0, path.dirname)(tempTsConfigJsonPath), { recursive: true });
|
|
443
|
+
(0, fs.writeFileSync)(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
|
|
452
444
|
return tempTsConfigJsonPath;
|
|
453
445
|
}
|
|
454
446
|
const removeExt = (f) => {
|
|
@@ -464,7 +456,7 @@ function getExposeKey(options) {
|
|
|
464
456
|
}
|
|
465
457
|
const processTypesFile = async (options) => {
|
|
466
458
|
const { outDir, filePath, rootDir, cb, mapExposeToEntry, mfTypePath } = options;
|
|
467
|
-
if (!existsSync
|
|
459
|
+
if (!(0, fs.existsSync)(filePath)) return;
|
|
468
460
|
if ((await (0, fs_promises.stat)(filePath)).isDirectory()) {
|
|
469
461
|
const files = await (0, fs_promises.readdir)(filePath);
|
|
470
462
|
await Promise.all(files.map((file) => processTypesFile({
|
|
@@ -482,7 +474,7 @@ const processTypesFile = async (options) => {
|
|
|
482
474
|
const mfeTypeEntry = (0, path.join)(mfTypePath, `${exposeKey === "." ? "index" : exposeKey}${DEFINITION_FILE_EXTENSION}`);
|
|
483
475
|
const mfeTypeEntryDirectory = (0, path.dirname)(mfeTypeEntry);
|
|
484
476
|
const relativePathToOutput = (0, path.relative)(mfeTypeEntryDirectory, filePath).replace(DEFINITION_FILE_EXTENSION, "").replace(STARTS_WITH_SLASH, "").split(path.sep).join("/");
|
|
485
|
-
|
|
477
|
+
(0, fs.mkdirSync)(mfeTypeEntryDirectory, { recursive: true });
|
|
486
478
|
await (0, fs_promises.writeFile)(mfeTypeEntry, `export * from './${relativePathToOutput}';\nexport { default } from './${relativePathToOutput}';`);
|
|
487
479
|
}
|
|
488
480
|
cb(await (0, fs_promises.readFile)(filePath, "utf8"));
|
|
@@ -623,7 +615,7 @@ const downloadTypesArchive = (hostOptions) => {
|
|
|
623
615
|
const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
|
|
624
616
|
while (retries++ < hostOptions.maxRetries) try {
|
|
625
617
|
const url = new URL(fileToDownload).href;
|
|
626
|
-
const response = await
|
|
618
|
+
const response = await nativeFetch(url, {
|
|
627
619
|
responseType: "arraybuffer",
|
|
628
620
|
timeout: hostOptions.timeout,
|
|
629
621
|
family: hostOptions.family
|
|
@@ -802,8 +794,11 @@ var DTSManager = class {
|
|
|
802
794
|
const targetDir = path.default.join(mfTypesPath, "node_modules");
|
|
803
795
|
if (fs.default.existsSync(remoteTypesFolder)) {
|
|
804
796
|
const targetFolder = path.default.resolve(remoteOptions.context, targetDir);
|
|
805
|
-
await
|
|
806
|
-
await
|
|
797
|
+
await (0, fs_promises.mkdir)(targetFolder, { recursive: true });
|
|
798
|
+
await (0, fs_promises.cp)(remoteTypesFolder, targetFolder, {
|
|
799
|
+
recursive: true,
|
|
800
|
+
force: true
|
|
801
|
+
});
|
|
807
802
|
}
|
|
808
803
|
} catch (err) {
|
|
809
804
|
if (this.options.host?.abortOnError === false) require_Broker.fileLog(`Unable to copy remote types, ${err}`, "extractRemoteTypes", "error");
|
|
@@ -858,7 +853,7 @@ var DTSManager = class {
|
|
|
858
853
|
if (!remoteInfo.url.includes(_module_federation_sdk.MANIFEST_EXT)) return remoteInfo;
|
|
859
854
|
if (remoteInfo.zipUrl) return remoteInfo;
|
|
860
855
|
const url = remoteInfo.url;
|
|
861
|
-
const manifestJson = (await
|
|
856
|
+
const manifestJson = (await nativeFetch(url, {
|
|
862
857
|
timeout: hostOptions.timeout,
|
|
863
858
|
family: hostOptions.family
|
|
864
859
|
})).data;
|
|
@@ -896,7 +891,7 @@ var DTSManager = class {
|
|
|
896
891
|
const { apiTypeUrl } = remoteInfo;
|
|
897
892
|
if (!apiTypeUrl) return;
|
|
898
893
|
try {
|
|
899
|
-
let apiTypeFile = (await
|
|
894
|
+
let apiTypeFile = (await nativeFetch(apiTypeUrl, {
|
|
900
895
|
timeout: hostOptions.timeout,
|
|
901
896
|
family: hostOptions.family
|
|
902
897
|
})).data;
|
|
@@ -1048,6 +1043,7 @@ var DTSManager = class {
|
|
|
1048
1043
|
|
|
1049
1044
|
//#endregion
|
|
1050
1045
|
//#region src/core/lib/utils.ts
|
|
1046
|
+
const dispatcherCache = /* @__PURE__ */ new Map();
|
|
1051
1047
|
function getDTSManagerConstructor(implementation) {
|
|
1052
1048
|
if (implementation) {
|
|
1053
1049
|
const NewConstructor = require(implementation);
|
|
@@ -1103,29 +1099,86 @@ const isTSProject = (dtsOptions, context = process.cwd()) => {
|
|
|
1103
1099
|
}
|
|
1104
1100
|
};
|
|
1105
1101
|
function cloneDeepOptions(options) {
|
|
1106
|
-
const excludeKeys = ["manifest", "async"];
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
if (typeof
|
|
1110
|
-
if (key === "extractThirdParty" && Array.isArray(
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1102
|
+
const excludeKeys = new Set(["manifest", "async"]);
|
|
1103
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
1104
|
+
function sanitize(val, key) {
|
|
1105
|
+
if (key !== void 0 && excludeKeys.has(key) || typeof val === "function") return false;
|
|
1106
|
+
if (key === "extractThirdParty" && Array.isArray(val)) return val.map(String);
|
|
1107
|
+
if (Array.isArray(val)) {
|
|
1108
|
+
if (cache.has(val)) return cache.get(val);
|
|
1109
|
+
const out = [];
|
|
1110
|
+
cache.set(val, out);
|
|
1111
|
+
val.forEach((v, i) => out.push(sanitize(v, String(i))));
|
|
1112
|
+
return out;
|
|
1113
|
+
}
|
|
1114
|
+
if (val !== null && typeof val === "object" && Object.getPrototypeOf(val) === Object.prototype) {
|
|
1115
|
+
const obj = val;
|
|
1116
|
+
if (cache.has(obj)) return cache.get(obj);
|
|
1117
|
+
const out = {};
|
|
1118
|
+
cache.set(obj, out);
|
|
1119
|
+
for (const [k, v] of Object.entries(obj)) out[k] = sanitize(v, k);
|
|
1120
|
+
return out;
|
|
1121
|
+
}
|
|
1122
|
+
return val;
|
|
1123
|
+
}
|
|
1124
|
+
return structuredClone(sanitize(options));
|
|
1114
1125
|
}
|
|
1115
1126
|
const getEnvHeaders = () => {
|
|
1116
|
-
const headersStr = (0, _module_federation_sdk.getProcessEnv)()["MF_ENV_HEADERS"]
|
|
1117
|
-
|
|
1127
|
+
const headersStr = (0, _module_federation_sdk.getProcessEnv)()["MF_ENV_HEADERS"];
|
|
1128
|
+
if (!headersStr || headersStr === "undefined") return {};
|
|
1129
|
+
try {
|
|
1130
|
+
return { ...JSON.parse(headersStr) };
|
|
1131
|
+
} catch {
|
|
1132
|
+
return {};
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
const createDispatcherFromFamily = (family) => {
|
|
1136
|
+
if (!family) return void 0;
|
|
1137
|
+
if (dispatcherCache.has(family)) return dispatcherCache.get(family);
|
|
1138
|
+
try {
|
|
1139
|
+
const dispatcher = new undici.Agent({ connect: { family } });
|
|
1140
|
+
dispatcherCache.set(family, dispatcher);
|
|
1141
|
+
return dispatcher;
|
|
1142
|
+
} catch {}
|
|
1118
1143
|
};
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
httpAgent,
|
|
1124
|
-
httpsAgent,
|
|
1125
|
-
headers: getEnvHeaders(),
|
|
1126
|
-
...config,
|
|
1127
|
-
timeout: config?.timeout || 6e4
|
|
1144
|
+
const toHeaderRecord = (headers) => {
|
|
1145
|
+
const out = {};
|
|
1146
|
+
headers.forEach((value, key) => {
|
|
1147
|
+
out[key.toLowerCase()] = value;
|
|
1128
1148
|
});
|
|
1149
|
+
return out;
|
|
1150
|
+
};
|
|
1151
|
+
async function nativeFetch(url, config) {
|
|
1152
|
+
const controller = new AbortController();
|
|
1153
|
+
const timeoutMs = config?.timeout ?? 6e4;
|
|
1154
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
1155
|
+
const headers = {
|
|
1156
|
+
...getEnvHeaders(),
|
|
1157
|
+
...config?.headers ?? {}
|
|
1158
|
+
};
|
|
1159
|
+
const dispatcher = config?.dispatcher ?? createDispatcherFromFamily(config?.family);
|
|
1160
|
+
try {
|
|
1161
|
+
const resp = await fetch(url, {
|
|
1162
|
+
headers,
|
|
1163
|
+
signal: controller.signal,
|
|
1164
|
+
...dispatcher ? { dispatcher } : {},
|
|
1165
|
+
...config?.agent ? { agent: config.agent } : {}
|
|
1166
|
+
});
|
|
1167
|
+
const headerRecord = toHeaderRecord(resp.headers);
|
|
1168
|
+
if (!resp.ok) throw new Error(`Request failed with status ${resp.status}`);
|
|
1169
|
+
if (config?.responseType === "arraybuffer") return {
|
|
1170
|
+
data: await resp.arrayBuffer(),
|
|
1171
|
+
headers: headerRecord,
|
|
1172
|
+
status: resp.status
|
|
1173
|
+
};
|
|
1174
|
+
return {
|
|
1175
|
+
data: (resp.headers.get("content-type") || "").includes("application/json") || url.endsWith(".json") ? await resp.json() : await resp.text(),
|
|
1176
|
+
headers: headerRecord,
|
|
1177
|
+
status: resp.status
|
|
1178
|
+
};
|
|
1179
|
+
} finally {
|
|
1180
|
+
clearTimeout(timeoutId);
|
|
1181
|
+
}
|
|
1129
1182
|
}
|
|
1130
1183
|
|
|
1131
1184
|
//#endregion
|
package/dist/fork-dev-worker.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_Action = require('./Action-CzhPMw2i.js');
|
|
3
|
-
const require_Broker = require('./Broker-
|
|
4
|
-
const require_expose_rpc = require('./expose-rpc-
|
|
5
|
-
require('./consumeTypes-
|
|
3
|
+
const require_Broker = require('./Broker-DRFgFvXI.js');
|
|
4
|
+
const require_expose_rpc = require('./expose-rpc-BPeKtqLv.js');
|
|
5
|
+
require('./consumeTypes-DMGONsAA.js');
|
|
6
6
|
require('./core.js');
|
|
7
7
|
const require_utils = require('./utils-7KqCZHbb.js');
|
|
8
8
|
let _module_federation_sdk = require("@module-federation/sdk");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
require('./Broker-
|
|
3
|
-
const require_expose_rpc = require('./expose-rpc-
|
|
2
|
+
require('./Broker-DRFgFvXI.js');
|
|
3
|
+
const require_expose_rpc = require('./expose-rpc-BPeKtqLv.js');
|
|
4
4
|
|
|
5
5
|
//#region src/core/lib/forkGenerateDts.ts
|
|
6
6
|
async function forkGenerateDts(options) {
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_Action = require('./Action-CzhPMw2i.js');
|
|
3
|
-
const require_Broker = require('./Broker-
|
|
4
|
-
const require_expose_rpc = require('./expose-rpc-
|
|
5
|
-
const require_consumeTypes = require('./consumeTypes-
|
|
3
|
+
const require_Broker = require('./Broker-DRFgFvXI.js');
|
|
4
|
+
const require_expose_rpc = require('./expose-rpc-BPeKtqLv.js');
|
|
5
|
+
const require_consumeTypes = require('./consumeTypes-DMGONsAA.js');
|
|
6
6
|
require('./core.js');
|
|
7
|
-
let fs_extra = require("fs-extra");
|
|
8
|
-
fs_extra = require_Action.__toESM(fs_extra);
|
|
9
|
-
let path = require("path");
|
|
10
|
-
path = require_Action.__toESM(path);
|
|
11
7
|
let fs = require("fs");
|
|
12
8
|
fs = require_Action.__toESM(fs);
|
|
9
|
+
let path = require("path");
|
|
10
|
+
path = require_Action.__toESM(path);
|
|
11
|
+
let fs_promises = require("fs/promises");
|
|
13
12
|
let _module_federation_sdk = require("@module-federation/sdk");
|
|
14
13
|
|
|
15
14
|
//#region src/dev-worker/DevWorker.ts
|
|
@@ -43,8 +42,10 @@ var DevWorker = class {
|
|
|
43
42
|
//#region src/dev-worker/createDevWorker.ts
|
|
44
43
|
async function removeLogFile() {
|
|
45
44
|
try {
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
await (0, fs_promises.rm)(path.resolve(process.cwd(), ".mf/typesGenerate.log"), {
|
|
46
|
+
force: true,
|
|
47
|
+
recursive: true
|
|
48
|
+
});
|
|
48
49
|
} catch (err) {
|
|
49
50
|
console.error("removeLogFile error", "forkDevWorker", err);
|
|
50
51
|
}
|
|
@@ -80,7 +81,7 @@ var PROCESS_EXIT_CODE = /* @__PURE__ */ function(PROCESS_EXIT_CODE) {
|
|
|
80
81
|
function ensureTempDir(filePath) {
|
|
81
82
|
try {
|
|
82
83
|
const dir = path.default.dirname(filePath);
|
|
83
|
-
|
|
84
|
+
fs.default.mkdirSync(dir, { recursive: true });
|
|
84
85
|
} catch (_err) {}
|
|
85
86
|
}
|
|
86
87
|
var DevPlugin = class DevPlugin {
|
|
@@ -93,8 +94,8 @@ var DevPlugin = class DevPlugin {
|
|
|
93
94
|
}
|
|
94
95
|
static ensureLiveReloadEntry(options, filePath) {
|
|
95
96
|
ensureTempDir(filePath);
|
|
96
|
-
const liveReloadEntryWithOptions =
|
|
97
|
-
|
|
97
|
+
const liveReloadEntryWithOptions = fs.default.readFileSync(path.default.join(__dirname, "./iife/launch-web-client.iife.js")).toString("utf-8").replace(require_Action.WEB_CLIENT_OPTIONS_IDENTIFIER, JSON.stringify(options));
|
|
98
|
+
fs.default.writeFileSync(filePath, liveReloadEntryWithOptions);
|
|
98
99
|
}
|
|
99
100
|
_stopWhenSIGTERMOrSIGINT() {
|
|
100
101
|
process.on("SIGTERM", () => {
|
package/dist/start-broker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/dts-plugin",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -65,20 +65,16 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"adm-zip": "
|
|
69
|
-
"ansi-colors": "
|
|
70
|
-
"axios": "^1.13.5",
|
|
71
|
-
"chalk": "3.0.0",
|
|
72
|
-
"fs-extra": "9.1.0",
|
|
68
|
+
"adm-zip": "0.5.10",
|
|
69
|
+
"ansi-colors": "4.1.3",
|
|
73
70
|
"isomorphic-ws": "5.0.0",
|
|
74
|
-
"
|
|
71
|
+
"undici": "7.24.7",
|
|
75
72
|
"node-schedule": "2.1.1",
|
|
76
|
-
"rambda": "^9.1.0",
|
|
77
73
|
"ws": "8.18.0",
|
|
78
|
-
"@module-federation/
|
|
79
|
-
"@module-federation/
|
|
80
|
-
"@module-federation/sdk": "2.3.
|
|
81
|
-
"@module-federation/third-party-dts-extractor": "2.3.
|
|
74
|
+
"@module-federation/managers": "2.3.2",
|
|
75
|
+
"@module-federation/error-codes": "2.3.2",
|
|
76
|
+
"@module-federation/sdk": "2.3.2",
|
|
77
|
+
"@module-federation/third-party-dts-extractor": "2.3.2"
|
|
82
78
|
},
|
|
83
79
|
"devDependencies": {
|
|
84
80
|
"@types/node-schedule": "2.1.7",
|
|
@@ -90,7 +86,7 @@
|
|
|
90
86
|
"directory-tree": "3.5.2",
|
|
91
87
|
"vitest": "1.6.0",
|
|
92
88
|
"webpack": "^5.104.1",
|
|
93
|
-
"@module-federation/runtime": "2.3.
|
|
89
|
+
"@module-federation/runtime": "2.3.2"
|
|
94
90
|
},
|
|
95
91
|
"peerDependencies": {
|
|
96
92
|
"typescript": "^4.9.0 || ^5.0.0",
|
|
@@ -102,7 +98,7 @@
|
|
|
102
98
|
}
|
|
103
99
|
},
|
|
104
100
|
"scripts": {
|
|
105
|
-
"build": "tsdown --config ./tsdown.config.ts && sleep 1 && cp
|
|
101
|
+
"build": "tsdown --config ./tsdown.config.ts && sleep 1 && cp *.md ./dist",
|
|
106
102
|
"test": "node -e \"require('fs').rmSync('dist-test',{recursive:true,force:true,maxRetries:20,retryDelay:50})\" && pnpm run test-impl",
|
|
107
103
|
"test-impl": "pnpm exec vitest run --passWithNoTests --config vite.config.mts",
|
|
108
104
|
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
|
package/dist/package.json
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@module-federation/dts-plugin",
|
|
3
|
-
"version": "2.3.0",
|
|
4
|
-
"author": "hanric <hanric.zhang@gmail.com>",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"module": "./dist/esm/index.mjs",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/module-federation/core.git",
|
|
12
|
-
"directory": "packages/dts-plugin"
|
|
13
|
-
},
|
|
14
|
-
"publishConfig": {
|
|
15
|
-
"access": "public"
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist/",
|
|
19
|
-
"README.md"
|
|
20
|
-
],
|
|
21
|
-
"exports": {
|
|
22
|
-
".": {
|
|
23
|
-
"import": {
|
|
24
|
-
"types": "./dist/index.d.ts",
|
|
25
|
-
"default": "./dist/esm/index.mjs"
|
|
26
|
-
},
|
|
27
|
-
"require": {
|
|
28
|
-
"types": "./dist/index.d.ts",
|
|
29
|
-
"default": "./dist/index.js"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"./core": {
|
|
33
|
-
"import": {
|
|
34
|
-
"types": "./dist/core.d.ts",
|
|
35
|
-
"default": "./dist/esm/core.mjs"
|
|
36
|
-
},
|
|
37
|
-
"require": {
|
|
38
|
-
"types": "./dist/core.d.ts",
|
|
39
|
-
"default": "./dist/core.js"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"./dynamic-remote-type-hints-plugin": {
|
|
43
|
-
"import": {
|
|
44
|
-
"types": "./dist/dynamic-remote-type-hints-plugin.d.ts",
|
|
45
|
-
"default": "./dist/esm/dynamic-remote-type-hints-plugin.mjs"
|
|
46
|
-
},
|
|
47
|
-
"require": {
|
|
48
|
-
"types": "./dist/dynamic-remote-type-hints-plugin.d.ts",
|
|
49
|
-
"default": "./dist/dynamic-remote-type-hints-plugin.js"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"./*": "./*"
|
|
53
|
-
},
|
|
54
|
-
"typesVersions": {
|
|
55
|
-
"*": {
|
|
56
|
-
".": [
|
|
57
|
-
"./dist/index.d.ts"
|
|
58
|
-
],
|
|
59
|
-
"core": [
|
|
60
|
-
"./dist/core.d.ts"
|
|
61
|
-
],
|
|
62
|
-
"dynamic-remote-type-hints-plugin": [
|
|
63
|
-
"./dist/dynamic-remote-type-hints-plugin.d.ts"
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"dependencies": {
|
|
68
|
-
"@module-federation/error-codes": "workspace:*",
|
|
69
|
-
"@module-federation/managers": "workspace:*",
|
|
70
|
-
"@module-federation/sdk": "workspace:*",
|
|
71
|
-
"@module-federation/third-party-dts-extractor": "workspace:*",
|
|
72
|
-
"adm-zip": "^0.5.10",
|
|
73
|
-
"ansi-colors": "^4.1.3",
|
|
74
|
-
"axios": "^1.13.5",
|
|
75
|
-
"chalk": "3.0.0",
|
|
76
|
-
"fs-extra": "9.1.0",
|
|
77
|
-
"isomorphic-ws": "5.0.0",
|
|
78
|
-
"lodash.clonedeepwith": "4.5.0",
|
|
79
|
-
"node-schedule": "2.1.1",
|
|
80
|
-
"rambda": "^9.1.0",
|
|
81
|
-
"ws": "8.18.0"
|
|
82
|
-
},
|
|
83
|
-
"devDependencies": {
|
|
84
|
-
"@module-federation/runtime": "workspace:*",
|
|
85
|
-
"@types/node-schedule": "2.1.7",
|
|
86
|
-
"@types/ws": "8.5.12",
|
|
87
|
-
"@vue/tsconfig": "^0.7.0",
|
|
88
|
-
"rimraf": "~6.0.1",
|
|
89
|
-
"vue": "^3.5.13",
|
|
90
|
-
"vue-tsc": "^2.2.10",
|
|
91
|
-
"directory-tree": "3.5.2",
|
|
92
|
-
"vitest": "1.6.0",
|
|
93
|
-
"webpack": "^5.104.1"
|
|
94
|
-
},
|
|
95
|
-
"peerDependencies": {
|
|
96
|
-
"typescript": "^4.9.0 || ^5.0.0",
|
|
97
|
-
"vue-tsc": ">=1.0.24"
|
|
98
|
-
},
|
|
99
|
-
"peerDependenciesMeta": {
|
|
100
|
-
"vue-tsc": {
|
|
101
|
-
"optional": true
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"scripts": {
|
|
105
|
-
"build": "tsdown --config ./tsdown.config.ts && sleep 1 && cp package.json ./dist && cp *.md ./dist",
|
|
106
|
-
"test": "node -e \"require('fs').rmSync('dist-test',{recursive:true,force:true,maxRetries:20,retryDelay:50})\" && pnpm run test-impl",
|
|
107
|
-
"test-impl": "pnpm exec vitest run --passWithNoTests --config vite.config.mts",
|
|
108
|
-
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
|
|
109
|
-
"build-debug": "FEDERATION_DEBUG=true pnpm run build",
|
|
110
|
-
"pre-release": "pnpm run test && pnpm run build"
|
|
111
|
-
}
|
|
112
|
-
}
|