@module-federation/dts-plugin 0.0.0-fix-filter-function-20260327073336 → 0.0.0-fix-valid-same-id-20260429034727
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 +36 -5
- package/dist/{consumeTypes-ClKC4akt.js → consumeTypes-DxGMNavh.js} +1 -1
- package/dist/core.js +3 -3
- package/dist/dynamic-remote-type-hints-plugin.d.ts +13 -2
- package/dist/esm/{Broker-CtU3X_nw.mjs → Broker-z82OgzMe.mjs} +2 -3
- package/dist/esm/{consumeTypes-DnucwjbD.mjs → consumeTypes-DYgYpZMQ.mjs} +1 -1
- package/dist/esm/core.mjs +3 -3
- package/dist/esm/{expose-rpc-Pg59hZO8.mjs → expose-rpc-B-zm7DmJ.mjs} +97 -39
- 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-CQq6zYK-.js} +100 -46
- 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,13 +1,44 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-valid-same-id-20260429034727
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
- @module-federation/
|
|
10
|
-
- @module-federation/
|
|
7
|
+
- Updated dependencies [5eba770]
|
|
8
|
+
- Updated dependencies [13b1e84]
|
|
9
|
+
- @module-federation/sdk@0.0.0-fix-valid-same-id-20260429034727
|
|
10
|
+
- @module-federation/managers@0.0.0-fix-valid-same-id-20260429034727
|
|
11
|
+
- @module-federation/third-party-dts-extractor@0.0.0-fix-valid-same-id-20260429034727
|
|
12
|
+
- @module-federation/error-codes@0.0.0-fix-valid-same-id-20260429034727
|
|
13
|
+
|
|
14
|
+
## 2.3.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 6d33275: fix: override inherited declarationDir in tsconfig and add test for declarationDir handling
|
|
19
|
+
- @module-federation/sdk@2.3.3
|
|
20
|
+
- @module-federation/managers@2.3.3
|
|
21
|
+
- @module-federation/third-party-dts-extractor@2.3.3
|
|
22
|
+
- @module-federation/error-codes@2.3.3
|
|
23
|
+
|
|
24
|
+
## 2.3.2
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 1c02710: chore: lock deps
|
|
29
|
+
- @module-federation/sdk@2.3.2
|
|
30
|
+
- @module-federation/managers@2.3.2
|
|
31
|
+
- @module-federation/third-party-dts-extractor@2.3.2
|
|
32
|
+
- @module-federation/error-codes@2.3.2
|
|
33
|
+
|
|
34
|
+
## 2.3.1
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- @module-federation/sdk@2.3.1
|
|
39
|
+
- @module-federation/managers@2.3.1
|
|
40
|
+
- @module-federation/third-party-dts-extractor@2.3.1
|
|
41
|
+
- @module-federation/error-codes@2.3.1
|
|
11
42
|
|
|
12
43
|
## 2.3.0
|
|
13
44
|
|
|
@@ -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;
|
|
@@ -177,7 +177,6 @@ interface PreloadRemoteArgs {
|
|
|
177
177
|
share?: boolean;
|
|
178
178
|
depsRemote?: boolean | Array<depsPreloadArg>;
|
|
179
179
|
filter?: (assetUrl: string) => boolean;
|
|
180
|
-
prefetchInterface?: boolean;
|
|
181
180
|
}
|
|
182
181
|
type PreloadConfig = PreloadRemoteArgs;
|
|
183
182
|
type PreloadOptions = Array<{
|
|
@@ -533,12 +532,24 @@ declare class ModuleFederation {
|
|
|
533
532
|
createScript: SyncHook<[{
|
|
534
533
|
url: string;
|
|
535
534
|
attrs?: Record<string, any>;
|
|
535
|
+
/**
|
|
536
|
+
* The producer(remote) info bound to this resource.
|
|
537
|
+
* Only present when the loader is invoked in a remote-related context
|
|
538
|
+
* (e.g. preloadRemote / loading remoteEntry).
|
|
539
|
+
*/
|
|
540
|
+
remoteInfo?: RemoteInfo;
|
|
536
541
|
}], CreateScriptHookReturn>;
|
|
537
542
|
createLink: SyncHook<[{
|
|
538
543
|
url: string;
|
|
539
544
|
attrs?: Record<string, any>;
|
|
545
|
+
/**
|
|
546
|
+
* The producer(remote) info bound to this resource.
|
|
547
|
+
* Only present when the loader is invoked in a remote-related context
|
|
548
|
+
* (e.g. preloadRemote / loading remoteEntry).
|
|
549
|
+
*/
|
|
550
|
+
remoteInfo?: RemoteInfo;
|
|
540
551
|
}], void | HTMLLinkElement>;
|
|
541
|
-
fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
552
|
+
fetch: AsyncHook<[string, RequestInit, (RemoteInfo | undefined)?], false | void | Promise<Response>>;
|
|
542
553
|
loadEntryError: AsyncHook<[{
|
|
543
554
|
getRemoteEntry: typeof getRemoteEntry;
|
|
544
555
|
origin: ModuleFederation;
|
|
@@ -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-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,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
|
|
@@ -1182,12 +1239,13 @@ const readTsConfig = ({ tsConfigPath, typesFolder, compiledTypesFolder, context,
|
|
|
1182
1239
|
const rawTsConfigJson = readResult.config;
|
|
1183
1240
|
const configContent = typescript.parseJsonConfigFileContent(rawTsConfigJson, typescript.sys, dirname(resolvedTsConfigPath));
|
|
1184
1241
|
const rootDir = getEffectiveRootDir(configContent);
|
|
1242
|
+
const outDir = resolve(context, outputDir || configContent.options.outDir || "dist", typesFolder, compiledTypesFolder);
|
|
1185
1243
|
const defaultCompilerOptions = {
|
|
1186
1244
|
rootDir,
|
|
1187
1245
|
emitDeclarationOnly: true,
|
|
1188
1246
|
noEmit: false,
|
|
1189
1247
|
declaration: true,
|
|
1190
|
-
outDir
|
|
1248
|
+
outDir
|
|
1191
1249
|
};
|
|
1192
1250
|
rawTsConfigJson.compilerOptions = rawTsConfigJson.compilerOptions || {};
|
|
1193
1251
|
rawTsConfigJson.compilerOptions = {
|
|
@@ -1206,7 +1264,7 @@ const readTsConfig = ({ tsConfigPath, typesFolder, compiledTypesFolder, context,
|
|
|
1206
1264
|
rawTsConfigJson.exclude = [];
|
|
1207
1265
|
"references" in rawTsConfigJson && delete rawTsConfigJson.references;
|
|
1208
1266
|
rawTsConfigJson.extends = resolvedTsConfigPath;
|
|
1209
|
-
|
|
1267
|
+
rawTsConfigJson.compilerOptions.declarationDir = outDir;
|
|
1210
1268
|
return rawTsConfigJson;
|
|
1211
1269
|
};
|
|
1212
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,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
|
|
@@ -1177,12 +1230,13 @@ const readTsConfig = ({ tsConfigPath, typesFolder, compiledTypesFolder, context,
|
|
|
1177
1230
|
const rawTsConfigJson = readResult.config;
|
|
1178
1231
|
const configContent = typescript.default.parseJsonConfigFileContent(rawTsConfigJson, typescript.default.sys, (0, path.dirname)(resolvedTsConfigPath));
|
|
1179
1232
|
const rootDir = getEffectiveRootDir(configContent);
|
|
1233
|
+
const outDir = (0, path.resolve)(context, outputDir || configContent.options.outDir || "dist", typesFolder, compiledTypesFolder);
|
|
1180
1234
|
const defaultCompilerOptions = {
|
|
1181
1235
|
rootDir,
|
|
1182
1236
|
emitDeclarationOnly: true,
|
|
1183
1237
|
noEmit: false,
|
|
1184
1238
|
declaration: true,
|
|
1185
|
-
outDir
|
|
1239
|
+
outDir
|
|
1186
1240
|
};
|
|
1187
1241
|
rawTsConfigJson.compilerOptions = rawTsConfigJson.compilerOptions || {};
|
|
1188
1242
|
rawTsConfigJson.compilerOptions = {
|
|
@@ -1201,7 +1255,7 @@ const readTsConfig = ({ tsConfigPath, typesFolder, compiledTypesFolder, context,
|
|
|
1201
1255
|
rawTsConfigJson.exclude = [];
|
|
1202
1256
|
"references" in rawTsConfigJson && delete rawTsConfigJson.references;
|
|
1203
1257
|
rawTsConfigJson.extends = resolvedTsConfigPath;
|
|
1204
|
-
|
|
1258
|
+
rawTsConfigJson.compilerOptions.declarationDir = outDir;
|
|
1205
1259
|
return rawTsConfigJson;
|
|
1206
1260
|
};
|
|
1207
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": "0.0.0-fix-
|
|
3
|
+
"version": "0.0.0-fix-valid-same-id-20260429034727",
|
|
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/error-codes": "0.0.0-fix-
|
|
79
|
-
"@module-federation/
|
|
80
|
-
"@module-federation/
|
|
81
|
-
"@module-federation/third-party-dts-extractor": "0.0.0-fix-
|
|
74
|
+
"@module-federation/error-codes": "0.0.0-fix-valid-same-id-20260429034727",
|
|
75
|
+
"@module-federation/managers": "0.0.0-fix-valid-same-id-20260429034727",
|
|
76
|
+
"@module-federation/sdk": "0.0.0-fix-valid-same-id-20260429034727",
|
|
77
|
+
"@module-federation/third-party-dts-extractor": "0.0.0-fix-valid-same-id-20260429034727"
|
|
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": "0.0.0-fix-
|
|
89
|
+
"@module-federation/runtime": "0.0.0-fix-valid-same-id-20260429034727"
|
|
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": "0.0.0-fix-filter-function-20260327073336",
|
|
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
|
-
}
|