@module-federation/dts-plugin 2.3.1 → 2.3.3
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-eLXU1Wnf.js → Broker-DRFgFvXI.js} +3 -3
- package/dist/CHANGELOG.md +20 -0
- package/dist/{consumeTypes-K9bTh9DW.js → consumeTypes-DxGMNavh.js} +1 -1
- package/dist/core.js +3 -3
- package/dist/dynamic-remote-type-hints-plugin.d.ts +13 -1
- package/dist/esm/{Broker-CAfV_Mk2.mjs → Broker-z82OgzMe.mjs} +2 -2
- package/dist/esm/{consumeTypes-mqBQo-ww.mjs → consumeTypes-DYgYpZMQ.mjs} +1 -1
- package/dist/esm/core.mjs +3 -3
- package/dist/esm/{expose-rpc-DJAoDLdo.mjs → expose-rpc-B-zm7DmJ.mjs} +74 -30
- 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-C93yOgOB.js → expose-rpc-CQq6zYK-.js} +77 -36
- 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 -11
- package/dist/package.json +0 -109
|
@@ -1,9 +1,8 @@
|
|
|
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);
|
|
@@ -11,6 +10,7 @@ let os = require("os");
|
|
|
11
10
|
os = require_Action.__toESM(os);
|
|
12
11
|
let isomorphic_ws = require("isomorphic-ws");
|
|
13
12
|
isomorphic_ws = require_Action.__toESM(isomorphic_ws);
|
|
13
|
+
let http = require("http");
|
|
14
14
|
let node_schedule = require("node-schedule");
|
|
15
15
|
node_schedule = require_Action.__toESM(node_schedule);
|
|
16
16
|
let url = require("url");
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
+
## 2.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6d33275: fix: override inherited declarationDir in tsconfig and add test for declarationDir handling
|
|
8
|
+
- @module-federation/sdk@2.3.3
|
|
9
|
+
- @module-federation/managers@2.3.3
|
|
10
|
+
- @module-federation/third-party-dts-extractor@2.3.3
|
|
11
|
+
- @module-federation/error-codes@2.3.3
|
|
12
|
+
|
|
13
|
+
## 2.3.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 1c02710: chore: lock deps
|
|
18
|
+
- @module-federation/sdk@2.3.2
|
|
19
|
+
- @module-federation/managers@2.3.2
|
|
20
|
+
- @module-federation/third-party-dts-extractor@2.3.2
|
|
21
|
+
- @module-federation/error-codes@2.3.2
|
|
22
|
+
|
|
3
23
|
## 2.3.1
|
|
4
24
|
|
|
5
25
|
### Patch 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-CQq6zYK-.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-CQq6zYK-.js');
|
|
4
|
+
const require_consumeTypes = require('./consumeTypes-DxGMNavh.js');
|
|
5
5
|
|
|
6
6
|
exports.DTSManager = require_expose_rpc.DTSManager;
|
|
7
7
|
exports.DtsWorker = require_consumeTypes.DtsWorker;
|
|
@@ -533,12 +533,24 @@ declare class ModuleFederation {
|
|
|
533
533
|
createScript: SyncHook<[{
|
|
534
534
|
url: string;
|
|
535
535
|
attrs?: Record<string, any>;
|
|
536
|
+
/**
|
|
537
|
+
* The producer(remote) info bound to this resource.
|
|
538
|
+
* Only present when the loader is invoked in a remote-related context
|
|
539
|
+
* (e.g. preloadRemote / loading remoteEntry).
|
|
540
|
+
*/
|
|
541
|
+
remoteInfo?: RemoteInfo;
|
|
536
542
|
}], CreateScriptHookReturn>;
|
|
537
543
|
createLink: SyncHook<[{
|
|
538
544
|
url: string;
|
|
539
545
|
attrs?: Record<string, any>;
|
|
546
|
+
/**
|
|
547
|
+
* The producer(remote) info bound to this resource.
|
|
548
|
+
* Only present when the loader is invoked in a remote-related context
|
|
549
|
+
* (e.g. preloadRemote / loading remoteEntry).
|
|
550
|
+
*/
|
|
551
|
+
remoteInfo?: RemoteInfo;
|
|
540
552
|
}], void | HTMLLinkElement>;
|
|
541
|
-
fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
553
|
+
fetch: AsyncHook<[string, RequestInit, (RemoteInfo | undefined)?], false | void | Promise<Response>>;
|
|
542
554
|
loadEntryError: AsyncHook<[{
|
|
543
555
|
getRemoteEntry: typeof getRemoteEntry;
|
|
544
556
|
origin: ModuleFederation;
|
|
@@ -1,11 +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
6
|
import os from "os";
|
|
8
7
|
import WebSocket from "isomorphic-ws";
|
|
8
|
+
import { createServer } from "http";
|
|
9
9
|
import schedule from "node-schedule";
|
|
10
10
|
import { parse } from "url";
|
|
11
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-B-zm7DmJ.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-B-zm7DmJ.mjs";
|
|
2
|
+
import "./Broker-z82OgzMe.mjs";
|
|
3
|
+
import { i as rpc_exports, n as generateTypesInChildProcess, r as DtsWorker, t as consumeTypes } from "./consumeTypes-DYgYpZMQ.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,6 +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";
|
|
20
|
+
import http from "http";
|
|
23
21
|
import process$1 from "process";
|
|
24
22
|
|
|
25
23
|
//#region \0rolldown/runtime.js
|
|
@@ -416,7 +414,7 @@ async function createHttpServer(options) {
|
|
|
416
414
|
res.end();
|
|
417
415
|
return;
|
|
418
416
|
}
|
|
419
|
-
const stream =
|
|
417
|
+
const stream = fs.createReadStream(typeTarPath);
|
|
420
418
|
stream.on("error", () => {
|
|
421
419
|
if (!res.headersSent) res.statusCode = 500;
|
|
422
420
|
res.end();
|
|
@@ -439,7 +437,6 @@ async function createHttpServer(options) {
|
|
|
439
437
|
|
|
440
438
|
//#endregion
|
|
441
439
|
//#region src/core/lib/typeScriptCompiler.ts
|
|
442
|
-
const { ensureDirSync, writeFileSync, existsSync: existsSync$1 } = fse;
|
|
443
440
|
const STARTS_WITH_SLASH = /^\//;
|
|
444
441
|
const DEFINITION_FILE_EXTENSION = ".d.ts";
|
|
445
442
|
const retrieveMfTypesPath = (tsConfig, remoteOptions) => normalize(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, ""));
|
|
@@ -451,7 +448,7 @@ function writeTempTsConfig(tsConfig, context, name, cwd) {
|
|
|
451
448
|
};
|
|
452
449
|
const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`);
|
|
453
450
|
const tempTsConfigJsonPath = resolve(cwd ?? context, "node_modules", TEMP_DIR, `tsconfig.${hash}.json`);
|
|
454
|
-
|
|
451
|
+
mkdirSync(dirname(tempTsConfigJsonPath), { recursive: true });
|
|
455
452
|
writeFileSync(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
|
|
456
453
|
return tempTsConfigJsonPath;
|
|
457
454
|
}
|
|
@@ -468,7 +465,7 @@ function getExposeKey(options) {
|
|
|
468
465
|
}
|
|
469
466
|
const processTypesFile = async (options) => {
|
|
470
467
|
const { outDir, filePath, rootDir, cb, mapExposeToEntry, mfTypePath } = options;
|
|
471
|
-
if (!existsSync
|
|
468
|
+
if (!existsSync(filePath)) return;
|
|
472
469
|
if ((await stat(filePath)).isDirectory()) {
|
|
473
470
|
const files = await readdir(filePath);
|
|
474
471
|
await Promise.all(files.map((file) => processTypesFile({
|
|
@@ -486,7 +483,7 @@ const processTypesFile = async (options) => {
|
|
|
486
483
|
const mfeTypeEntry = join(mfTypePath, `${exposeKey === "." ? "index" : exposeKey}${DEFINITION_FILE_EXTENSION}`);
|
|
487
484
|
const mfeTypeEntryDirectory = dirname(mfeTypeEntry);
|
|
488
485
|
const relativePathToOutput = relative(mfeTypeEntryDirectory, filePath).replace(DEFINITION_FILE_EXTENSION, "").replace(STARTS_WITH_SLASH, "").split(sep).join("/");
|
|
489
|
-
|
|
486
|
+
mkdirSync(mfeTypeEntryDirectory, { recursive: true });
|
|
490
487
|
await writeFile(mfeTypeEntry, `export * from './${relativePathToOutput}';\nexport { default } from './${relativePathToOutput}';`);
|
|
491
488
|
}
|
|
492
489
|
cb(await readFile(filePath, "utf8"));
|
|
@@ -627,7 +624,7 @@ const downloadTypesArchive = (hostOptions) => {
|
|
|
627
624
|
const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
|
|
628
625
|
while (retries++ < hostOptions.maxRetries) try {
|
|
629
626
|
const url = new URL(fileToDownload).href;
|
|
630
|
-
const response = await
|
|
627
|
+
const response = await nativeFetch(url, {
|
|
631
628
|
responseType: "arraybuffer",
|
|
632
629
|
timeout: hostOptions.timeout,
|
|
633
630
|
family: hostOptions.family
|
|
@@ -806,8 +803,11 @@ var DTSManager = class {
|
|
|
806
803
|
const targetDir = path.join(mfTypesPath, "node_modules");
|
|
807
804
|
if (fs.existsSync(remoteTypesFolder)) {
|
|
808
805
|
const targetFolder = path.resolve(remoteOptions.context, targetDir);
|
|
809
|
-
await
|
|
810
|
-
await
|
|
806
|
+
await mkdir(targetFolder, { recursive: true });
|
|
807
|
+
await cp(remoteTypesFolder, targetFolder, {
|
|
808
|
+
recursive: true,
|
|
809
|
+
force: true
|
|
810
|
+
});
|
|
811
811
|
}
|
|
812
812
|
} catch (err) {
|
|
813
813
|
if (this.options.host?.abortOnError === false) fileLog(`Unable to copy remote types, ${err}`, "extractRemoteTypes", "error");
|
|
@@ -862,7 +862,7 @@ var DTSManager = class {
|
|
|
862
862
|
if (!remoteInfo.url.includes(MANIFEST_EXT)) return remoteInfo;
|
|
863
863
|
if (remoteInfo.zipUrl) return remoteInfo;
|
|
864
864
|
const url = remoteInfo.url;
|
|
865
|
-
const manifestJson = (await
|
|
865
|
+
const manifestJson = (await nativeFetch(url, {
|
|
866
866
|
timeout: hostOptions.timeout,
|
|
867
867
|
family: hostOptions.family
|
|
868
868
|
})).data;
|
|
@@ -900,7 +900,7 @@ var DTSManager = class {
|
|
|
900
900
|
const { apiTypeUrl } = remoteInfo;
|
|
901
901
|
if (!apiTypeUrl) return;
|
|
902
902
|
try {
|
|
903
|
-
let apiTypeFile = (await
|
|
903
|
+
let apiTypeFile = (await nativeFetch(apiTypeUrl, {
|
|
904
904
|
timeout: hostOptions.timeout,
|
|
905
905
|
family: hostOptions.family
|
|
906
906
|
})).data;
|
|
@@ -1052,6 +1052,7 @@ var DTSManager = class {
|
|
|
1052
1052
|
|
|
1053
1053
|
//#endregion
|
|
1054
1054
|
//#region src/core/lib/utils.ts
|
|
1055
|
+
const dispatcherCache = /* @__PURE__ */ new Map();
|
|
1055
1056
|
function getDTSManagerConstructor(implementation) {
|
|
1056
1057
|
if (implementation) {
|
|
1057
1058
|
const NewConstructor = __require(implementation);
|
|
@@ -1132,19 +1133,61 @@ function cloneDeepOptions(options) {
|
|
|
1132
1133
|
return structuredClone(sanitize(options));
|
|
1133
1134
|
}
|
|
1134
1135
|
const getEnvHeaders = () => {
|
|
1135
|
-
const headersStr = getProcessEnv()["MF_ENV_HEADERS"]
|
|
1136
|
-
|
|
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 {}
|
|
1137
1152
|
};
|
|
1138
|
-
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
httpAgent,
|
|
1143
|
-
httpsAgent,
|
|
1144
|
-
headers: getEnvHeaders(),
|
|
1145
|
-
...config,
|
|
1146
|
-
timeout: config?.timeout || 6e4
|
|
1153
|
+
const toHeaderRecord = (headers) => {
|
|
1154
|
+
const out = {};
|
|
1155
|
+
headers.forEach((value, key) => {
|
|
1156
|
+
out[key.toLowerCase()] = value;
|
|
1147
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
|
+
}
|
|
1148
1191
|
}
|
|
1149
1192
|
|
|
1150
1193
|
//#endregion
|
|
@@ -1196,12 +1239,13 @@ const readTsConfig = ({ tsConfigPath, typesFolder, compiledTypesFolder, context,
|
|
|
1196
1239
|
const rawTsConfigJson = readResult.config;
|
|
1197
1240
|
const configContent = typescript.parseJsonConfigFileContent(rawTsConfigJson, typescript.sys, dirname(resolvedTsConfigPath));
|
|
1198
1241
|
const rootDir = getEffectiveRootDir(configContent);
|
|
1242
|
+
const outDir = resolve(context, outputDir || configContent.options.outDir || "dist", typesFolder, compiledTypesFolder);
|
|
1199
1243
|
const defaultCompilerOptions = {
|
|
1200
1244
|
rootDir,
|
|
1201
1245
|
emitDeclarationOnly: true,
|
|
1202
1246
|
noEmit: false,
|
|
1203
1247
|
declaration: true,
|
|
1204
|
-
outDir
|
|
1248
|
+
outDir
|
|
1205
1249
|
};
|
|
1206
1250
|
rawTsConfigJson.compilerOptions = rawTsConfigJson.compilerOptions || {};
|
|
1207
1251
|
rawTsConfigJson.compilerOptions = {
|
|
@@ -1220,7 +1264,7 @@ const readTsConfig = ({ tsConfigPath, typesFolder, compiledTypesFolder, context,
|
|
|
1220
1264
|
rawTsConfigJson.exclude = [];
|
|
1221
1265
|
"references" in rawTsConfigJson && delete rawTsConfigJson.references;
|
|
1222
1266
|
rawTsConfigJson.extends = resolvedTsConfigPath;
|
|
1223
|
-
|
|
1267
|
+
rawTsConfigJson.compilerOptions.declarationDir = outDir;
|
|
1224
1268
|
return rawTsConfigJson;
|
|
1225
1269
|
};
|
|
1226
1270
|
const TS_EXTENSIONS = [
|
|
@@ -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-B-zm7DmJ.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-DYgYpZMQ.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-B-zm7DmJ.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-B-zm7DmJ.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-DYgYpZMQ.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,6 +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);
|
|
27
|
+
let http = require("http");
|
|
28
|
+
http = require_Action.__toESM(http);
|
|
34
29
|
let process$1 = require("process");
|
|
35
30
|
process$1 = require_Action.__toESM(process$1);
|
|
36
31
|
|
|
@@ -410,7 +405,7 @@ async function createHttpServer(options) {
|
|
|
410
405
|
res.end();
|
|
411
406
|
return;
|
|
412
407
|
}
|
|
413
|
-
const stream =
|
|
408
|
+
const stream = fs.default.createReadStream(typeTarPath);
|
|
414
409
|
stream.on("error", () => {
|
|
415
410
|
if (!res.headersSent) res.statusCode = 500;
|
|
416
411
|
res.end();
|
|
@@ -433,7 +428,6 @@ async function createHttpServer(options) {
|
|
|
433
428
|
|
|
434
429
|
//#endregion
|
|
435
430
|
//#region src/core/lib/typeScriptCompiler.ts
|
|
436
|
-
const { ensureDirSync, writeFileSync, existsSync: existsSync$1 } = fs_extra.default;
|
|
437
431
|
const STARTS_WITH_SLASH = /^\//;
|
|
438
432
|
const DEFINITION_FILE_EXTENSION = ".d.ts";
|
|
439
433
|
const retrieveMfTypesPath = (tsConfig, remoteOptions) => (0, path.normalize)(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, ""));
|
|
@@ -445,8 +439,8 @@ function writeTempTsConfig(tsConfig, context, name, cwd) {
|
|
|
445
439
|
};
|
|
446
440
|
const hash = createHash(`${JSON.stringify(tsConfig)}${name}${Date.now()}`);
|
|
447
441
|
const tempTsConfigJsonPath = (0, path.resolve)(cwd ?? context, "node_modules", _module_federation_sdk.TEMP_DIR, `tsconfig.${hash}.json`);
|
|
448
|
-
|
|
449
|
-
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));
|
|
450
444
|
return tempTsConfigJsonPath;
|
|
451
445
|
}
|
|
452
446
|
const removeExt = (f) => {
|
|
@@ -462,7 +456,7 @@ function getExposeKey(options) {
|
|
|
462
456
|
}
|
|
463
457
|
const processTypesFile = async (options) => {
|
|
464
458
|
const { outDir, filePath, rootDir, cb, mapExposeToEntry, mfTypePath } = options;
|
|
465
|
-
if (!existsSync
|
|
459
|
+
if (!(0, fs.existsSync)(filePath)) return;
|
|
466
460
|
if ((await (0, fs_promises.stat)(filePath)).isDirectory()) {
|
|
467
461
|
const files = await (0, fs_promises.readdir)(filePath);
|
|
468
462
|
await Promise.all(files.map((file) => processTypesFile({
|
|
@@ -480,7 +474,7 @@ const processTypesFile = async (options) => {
|
|
|
480
474
|
const mfeTypeEntry = (0, path.join)(mfTypePath, `${exposeKey === "." ? "index" : exposeKey}${DEFINITION_FILE_EXTENSION}`);
|
|
481
475
|
const mfeTypeEntryDirectory = (0, path.dirname)(mfeTypeEntry);
|
|
482
476
|
const relativePathToOutput = (0, path.relative)(mfeTypeEntryDirectory, filePath).replace(DEFINITION_FILE_EXTENSION, "").replace(STARTS_WITH_SLASH, "").split(path.sep).join("/");
|
|
483
|
-
|
|
477
|
+
(0, fs.mkdirSync)(mfeTypeEntryDirectory, { recursive: true });
|
|
484
478
|
await (0, fs_promises.writeFile)(mfeTypeEntry, `export * from './${relativePathToOutput}';\nexport { default } from './${relativePathToOutput}';`);
|
|
485
479
|
}
|
|
486
480
|
cb(await (0, fs_promises.readFile)(filePath, "utf8"));
|
|
@@ -621,7 +615,7 @@ const downloadTypesArchive = (hostOptions) => {
|
|
|
621
615
|
const destinationPath = retrieveTypesArchiveDestinationPath(hostOptions, destinationFolder);
|
|
622
616
|
while (retries++ < hostOptions.maxRetries) try {
|
|
623
617
|
const url = new URL(fileToDownload).href;
|
|
624
|
-
const response = await
|
|
618
|
+
const response = await nativeFetch(url, {
|
|
625
619
|
responseType: "arraybuffer",
|
|
626
620
|
timeout: hostOptions.timeout,
|
|
627
621
|
family: hostOptions.family
|
|
@@ -800,8 +794,11 @@ var DTSManager = class {
|
|
|
800
794
|
const targetDir = path.default.join(mfTypesPath, "node_modules");
|
|
801
795
|
if (fs.default.existsSync(remoteTypesFolder)) {
|
|
802
796
|
const targetFolder = path.default.resolve(remoteOptions.context, targetDir);
|
|
803
|
-
await
|
|
804
|
-
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
|
+
});
|
|
805
802
|
}
|
|
806
803
|
} catch (err) {
|
|
807
804
|
if (this.options.host?.abortOnError === false) require_Broker.fileLog(`Unable to copy remote types, ${err}`, "extractRemoteTypes", "error");
|
|
@@ -856,7 +853,7 @@ var DTSManager = class {
|
|
|
856
853
|
if (!remoteInfo.url.includes(_module_federation_sdk.MANIFEST_EXT)) return remoteInfo;
|
|
857
854
|
if (remoteInfo.zipUrl) return remoteInfo;
|
|
858
855
|
const url = remoteInfo.url;
|
|
859
|
-
const manifestJson = (await
|
|
856
|
+
const manifestJson = (await nativeFetch(url, {
|
|
860
857
|
timeout: hostOptions.timeout,
|
|
861
858
|
family: hostOptions.family
|
|
862
859
|
})).data;
|
|
@@ -894,7 +891,7 @@ var DTSManager = class {
|
|
|
894
891
|
const { apiTypeUrl } = remoteInfo;
|
|
895
892
|
if (!apiTypeUrl) return;
|
|
896
893
|
try {
|
|
897
|
-
let apiTypeFile = (await
|
|
894
|
+
let apiTypeFile = (await nativeFetch(apiTypeUrl, {
|
|
898
895
|
timeout: hostOptions.timeout,
|
|
899
896
|
family: hostOptions.family
|
|
900
897
|
})).data;
|
|
@@ -1046,6 +1043,7 @@ var DTSManager = class {
|
|
|
1046
1043
|
|
|
1047
1044
|
//#endregion
|
|
1048
1045
|
//#region src/core/lib/utils.ts
|
|
1046
|
+
const dispatcherCache = /* @__PURE__ */ new Map();
|
|
1049
1047
|
function getDTSManagerConstructor(implementation) {
|
|
1050
1048
|
if (implementation) {
|
|
1051
1049
|
const NewConstructor = require(implementation);
|
|
@@ -1126,19 +1124,61 @@ function cloneDeepOptions(options) {
|
|
|
1126
1124
|
return structuredClone(sanitize(options));
|
|
1127
1125
|
}
|
|
1128
1126
|
const getEnvHeaders = () => {
|
|
1129
|
-
const headersStr = (0, _module_federation_sdk.getProcessEnv)()["MF_ENV_HEADERS"]
|
|
1130
|
-
|
|
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 {}
|
|
1131
1143
|
};
|
|
1132
|
-
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
httpAgent,
|
|
1137
|
-
httpsAgent,
|
|
1138
|
-
headers: getEnvHeaders(),
|
|
1139
|
-
...config,
|
|
1140
|
-
timeout: config?.timeout || 6e4
|
|
1144
|
+
const toHeaderRecord = (headers) => {
|
|
1145
|
+
const out = {};
|
|
1146
|
+
headers.forEach((value, key) => {
|
|
1147
|
+
out[key.toLowerCase()] = value;
|
|
1141
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
|
+
}
|
|
1142
1182
|
}
|
|
1143
1183
|
|
|
1144
1184
|
//#endregion
|
|
@@ -1190,12 +1230,13 @@ const readTsConfig = ({ tsConfigPath, typesFolder, compiledTypesFolder, context,
|
|
|
1190
1230
|
const rawTsConfigJson = readResult.config;
|
|
1191
1231
|
const configContent = typescript.default.parseJsonConfigFileContent(rawTsConfigJson, typescript.default.sys, (0, path.dirname)(resolvedTsConfigPath));
|
|
1192
1232
|
const rootDir = getEffectiveRootDir(configContent);
|
|
1233
|
+
const outDir = (0, path.resolve)(context, outputDir || configContent.options.outDir || "dist", typesFolder, compiledTypesFolder);
|
|
1193
1234
|
const defaultCompilerOptions = {
|
|
1194
1235
|
rootDir,
|
|
1195
1236
|
emitDeclarationOnly: true,
|
|
1196
1237
|
noEmit: false,
|
|
1197
1238
|
declaration: true,
|
|
1198
|
-
outDir
|
|
1239
|
+
outDir
|
|
1199
1240
|
};
|
|
1200
1241
|
rawTsConfigJson.compilerOptions = rawTsConfigJson.compilerOptions || {};
|
|
1201
1242
|
rawTsConfigJson.compilerOptions = {
|
|
@@ -1214,7 +1255,7 @@ const readTsConfig = ({ tsConfigPath, typesFolder, compiledTypesFolder, context,
|
|
|
1214
1255
|
rawTsConfigJson.exclude = [];
|
|
1215
1256
|
"references" in rawTsConfigJson && delete rawTsConfigJson.references;
|
|
1216
1257
|
rawTsConfigJson.extends = resolvedTsConfigPath;
|
|
1217
|
-
|
|
1258
|
+
rawTsConfigJson.compilerOptions.declarationDir = outDir;
|
|
1218
1259
|
return rawTsConfigJson;
|
|
1219
1260
|
};
|
|
1220
1261
|
const TS_EXTENSIONS = [
|
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-CQq6zYK-.js');
|
|
5
|
+
require('./consumeTypes-DxGMNavh.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-CQq6zYK-.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-CQq6zYK-.js');
|
|
5
|
+
const require_consumeTypes = require('./consumeTypes-DxGMNavh.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.3",
|
|
4
4
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -65,17 +65,16 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"adm-zip": "
|
|
69
|
-
"ansi-colors": "
|
|
70
|
-
"axios": "1.13.5",
|
|
71
|
-
"fs-extra": "9.1.0",
|
|
68
|
+
"adm-zip": "0.5.10",
|
|
69
|
+
"ansi-colors": "4.1.3",
|
|
72
70
|
"isomorphic-ws": "5.0.0",
|
|
71
|
+
"undici": "7.24.7",
|
|
73
72
|
"node-schedule": "2.1.1",
|
|
74
73
|
"ws": "8.18.0",
|
|
75
|
-
"@module-federation/
|
|
76
|
-
"@module-federation/
|
|
77
|
-
"@module-federation/
|
|
78
|
-
"@module-federation/
|
|
74
|
+
"@module-federation/error-codes": "2.3.3",
|
|
75
|
+
"@module-federation/sdk": "2.3.3",
|
|
76
|
+
"@module-federation/third-party-dts-extractor": "2.3.3",
|
|
77
|
+
"@module-federation/managers": "2.3.3"
|
|
79
78
|
},
|
|
80
79
|
"devDependencies": {
|
|
81
80
|
"@types/node-schedule": "2.1.7",
|
|
@@ -87,7 +86,7 @@
|
|
|
87
86
|
"directory-tree": "3.5.2",
|
|
88
87
|
"vitest": "1.6.0",
|
|
89
88
|
"webpack": "^5.104.1",
|
|
90
|
-
"@module-federation/runtime": "2.3.
|
|
89
|
+
"@module-federation/runtime": "2.3.3"
|
|
91
90
|
},
|
|
92
91
|
"peerDependencies": {
|
|
93
92
|
"typescript": "^4.9.0 || ^5.0.0",
|
|
@@ -99,7 +98,7 @@
|
|
|
99
98
|
}
|
|
100
99
|
},
|
|
101
100
|
"scripts": {
|
|
102
|
-
"build": "tsdown --config ./tsdown.config.ts && sleep 1 && cp
|
|
101
|
+
"build": "tsdown --config ./tsdown.config.ts && sleep 1 && cp *.md ./dist",
|
|
103
102
|
"test": "node -e \"require('fs').rmSync('dist-test',{recursive:true,force:true,maxRetries:20,retryDelay:50})\" && pnpm run test-impl",
|
|
104
103
|
"test-impl": "pnpm exec vitest run --passWithNoTests --config vite.config.mts",
|
|
105
104
|
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
|
package/dist/package.json
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@module-federation/dts-plugin",
|
|
3
|
-
"version": "2.3.1",
|
|
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
|
-
"fs-extra": "9.1.0",
|
|
76
|
-
"isomorphic-ws": "5.0.0",
|
|
77
|
-
"node-schedule": "2.1.1",
|
|
78
|
-
"ws": "8.18.0"
|
|
79
|
-
},
|
|
80
|
-
"devDependencies": {
|
|
81
|
-
"@module-federation/runtime": "workspace:*",
|
|
82
|
-
"@types/node-schedule": "2.1.7",
|
|
83
|
-
"@types/ws": "8.5.12",
|
|
84
|
-
"@vue/tsconfig": "^0.7.0",
|
|
85
|
-
"rimraf": "~6.0.1",
|
|
86
|
-
"vue": "^3.5.13",
|
|
87
|
-
"vue-tsc": "^2.2.10",
|
|
88
|
-
"directory-tree": "3.5.2",
|
|
89
|
-
"vitest": "1.6.0",
|
|
90
|
-
"webpack": "^5.104.1"
|
|
91
|
-
},
|
|
92
|
-
"peerDependencies": {
|
|
93
|
-
"typescript": "^4.9.0 || ^5.0.0",
|
|
94
|
-
"vue-tsc": ">=1.0.24"
|
|
95
|
-
},
|
|
96
|
-
"peerDependenciesMeta": {
|
|
97
|
-
"vue-tsc": {
|
|
98
|
-
"optional": true
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"scripts": {
|
|
102
|
-
"build": "tsdown --config ./tsdown.config.ts && sleep 1 && cp package.json ./dist && cp *.md ./dist",
|
|
103
|
-
"test": "node -e \"require('fs').rmSync('dist-test',{recursive:true,force:true,maxRetries:20,retryDelay:50})\" && pnpm run test-impl",
|
|
104
|
-
"test-impl": "pnpm exec vitest run --passWithNoTests --config vite.config.mts",
|
|
105
|
-
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
|
|
106
|
-
"build-debug": "FEDERATION_DEBUG=true pnpm run build",
|
|
107
|
-
"pre-release": "pnpm run test && pnpm run build"
|
|
108
|
-
}
|
|
109
|
-
}
|