@module-federation/dts-plugin 0.2.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +23 -0
- package/dist/{DTSManagerOptions-c0728719.d.ts → DTSManagerOptions-7109e8ac.d.ts} +1 -0
- package/dist/{DtsWorker-90454949.d.ts → DtsWorker-17de6ba4.d.ts} +2 -5
- package/dist/core.d.mts +8 -4
- package/dist/core.d.ts +8 -4
- package/dist/core.js +78 -41
- package/dist/dynamic-remote-type-hints-plugin.js +5 -7
- package/dist/esm/{chunk-MQRIERJP.js → chunk-6DND574L.js} +7 -15
- package/dist/esm/chunk-DEW2PNCR.js +283 -0
- package/dist/esm/chunk-HKRTV6ZH.js +900 -0
- package/dist/esm/{chunk-ZLQBXHXA.js → chunk-SFEGBRA3.js} +331 -1426
- package/dist/esm/{chunk-G7ONFBMA.js → chunk-XKCIYRDL.js} +1 -1
- package/dist/esm/core.js +11 -11
- package/dist/esm/dynamic-remote-type-hints-plugin.js +2 -2
- package/dist/esm/fork-dev-worker.js +11 -7
- package/dist/esm/fork-generate-dts.js +3 -2
- package/dist/esm/index.js +21 -18
- package/dist/esm/start-broker.js +2 -2
- package/dist/fork-dev-worker.d.mts +1 -1
- package/dist/fork-dev-worker.d.ts +1 -1
- package/dist/fork-dev-worker.js +74 -39
- package/dist/fork-generate-dts.d.mts +2 -2
- package/dist/fork-generate-dts.d.ts +2 -2
- package/dist/fork-generate-dts.js +146 -290
- package/dist/iife/launch-web-client.js +5 -7
- package/dist/index.js +89 -52
- package/dist/package.json +1 -1
- package/dist/start-broker.js +28 -344
- package/package.json +5 -5
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fa37cc4: feat: support modern.js ssr [#2348](https://github.com/module-federation/core/issues/2348)
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 7c4d99b: fix(dts-plugin): temp tsconfig path should extends original tsconfig
|
|
12
|
+
- Updated dependencies [fa37cc4]
|
|
13
|
+
- @module-federation/sdk@0.3.0
|
|
14
|
+
- @module-federation/managers@0.3.0
|
|
15
|
+
- @module-federation/third-party-dts-extractor@0.3.0
|
|
16
|
+
|
|
17
|
+
## 0.2.8
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- f3d13c2: fix(dts-plugin): ensure dts file path if it has deep path
|
|
22
|
+
- @module-federation/sdk@0.2.8
|
|
23
|
+
- @module-federation/managers@0.2.8
|
|
24
|
+
- @module-federation/third-party-dts-extractor@0.2.8
|
|
25
|
+
|
|
3
26
|
## 0.2.7
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ interface HostOptions extends moduleFederationPlugin.DtsHostOptions {
|
|
|
11
11
|
moduleFederationConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
12
12
|
context?: string;
|
|
13
13
|
implementation?: string;
|
|
14
|
+
runtimePkgs?: string[];
|
|
14
15
|
}
|
|
15
16
|
interface RemoteInfo {
|
|
16
17
|
name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChildProcess } from 'child_process';
|
|
2
|
-
import { a as RemoteOptions, D as DTSManagerOptions, R as RemoteInfo, H as HostOptions } from './DTSManagerOptions-
|
|
2
|
+
import { a as RemoteOptions, D as DTSManagerOptions, R as RemoteInfo, H as HostOptions } from './DTSManagerOptions-7109e8ac.js';
|
|
3
3
|
import ts from 'typescript';
|
|
4
4
|
|
|
5
5
|
interface TsConfigJson {
|
|
@@ -16,9 +16,6 @@ declare const retrieveRemoteConfig: (options: RemoteOptions) => {
|
|
|
16
16
|
remoteOptions: Required<RemoteOptions>;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
declare const REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
20
|
-
declare const REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
21
|
-
declare const HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
22
19
|
declare const enum UpdateMode {
|
|
23
20
|
POSITIVE = "POSITIVE",
|
|
24
21
|
PASSIVE = "PASSIVE"
|
|
@@ -105,4 +102,4 @@ declare class DtsWorker {
|
|
|
105
102
|
exit(): void;
|
|
106
103
|
}
|
|
107
104
|
|
|
108
|
-
export { DTSManager as D,
|
|
105
|
+
export { DTSManager as D, RpcRemoteMethod as R, TsConfigJson as T, RpcCallMessage as a, RpcGMCallTypes as b, RpcMessage as c, RpcMethod as d, RpcRejectMessage as e, RpcResolveMessage as f, RpcWorker as g, createRpcWorker as h, getRpcWorkerData as i, DtsWorker as j, DtsWorkerOptions as k, retrieveRemoteConfig as r };
|
package/dist/core.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DTSManager, T as TsConfigJson, R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-
|
|
2
|
-
export { j as DtsWorker,
|
|
3
|
-
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-
|
|
1
|
+
import { D as DTSManager, T as TsConfigJson, R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-17de6ba4.js';
|
|
2
|
+
export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-17de6ba4.js';
|
|
3
|
+
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-7109e8ac.js';
|
|
4
4
|
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
5
5
|
import { ChildProcess } from 'child_process';
|
|
6
6
|
import 'typescript';
|
|
@@ -82,4 +82,8 @@ declare namespace index {
|
|
|
82
82
|
|
|
83
83
|
declare function consumeTypes(options: DTSManagerOptions): Promise<void>;
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
declare const REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
86
|
+
declare const REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
87
|
+
declare const HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
88
|
+
|
|
89
|
+
export { DTSManager, DTSManagerOptions, HOST_API_TYPES_FILE_NAME, HostOptions, REMOTE_ALIAS_IDENTIFIER, REMOTE_API_TYPES_FILE_NAME, RemoteOptions, consumeTypes, generateTypes, generateTypesInChildProcess, getDTSManagerConstructor, isTSProject, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveTypesAssetsInfo, retrieveTypesZipPath, index as rpc, validateOptions };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as DTSManager, T as TsConfigJson, R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-
|
|
2
|
-
export { j as DtsWorker,
|
|
3
|
-
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-
|
|
1
|
+
import { D as DTSManager, T as TsConfigJson, R as RpcRemoteMethod, a as RpcCallMessage, b as RpcGMCallTypes, c as RpcMessage, d as RpcMethod, e as RpcRejectMessage, f as RpcResolveMessage, g as RpcWorker, h as createRpcWorker, i as getRpcWorkerData } from './DtsWorker-17de6ba4.js';
|
|
2
|
+
export { j as DtsWorker, r as retrieveRemoteConfig } from './DtsWorker-17de6ba4.js';
|
|
3
|
+
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-7109e8ac.js';
|
|
4
4
|
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
5
5
|
import { ChildProcess } from 'child_process';
|
|
6
6
|
import 'typescript';
|
|
@@ -82,4 +82,8 @@ declare namespace index {
|
|
|
82
82
|
|
|
83
83
|
declare function consumeTypes(options: DTSManagerOptions): Promise<void>;
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
declare const REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
86
|
+
declare const REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
87
|
+
declare const HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
88
|
+
|
|
89
|
+
export { DTSManager, DTSManagerOptions, HOST_API_TYPES_FILE_NAME, HostOptions, REMOTE_ALIAS_IDENTIFIER, REMOTE_API_TYPES_FILE_NAME, RemoteOptions, consumeTypes, generateTypes, generateTypesInChildProcess, getDTSManagerConstructor, isTSProject, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveTypesAssetsInfo, retrieveTypesZipPath, index as rpc, validateOptions };
|
package/dist/core.js
CHANGED
|
@@ -76,7 +76,6 @@ __export(core_exports, {
|
|
|
76
76
|
HOST_API_TYPES_FILE_NAME: () => HOST_API_TYPES_FILE_NAME,
|
|
77
77
|
REMOTE_ALIAS_IDENTIFIER: () => REMOTE_ALIAS_IDENTIFIER,
|
|
78
78
|
REMOTE_API_TYPES_FILE_NAME: () => REMOTE_API_TYPES_FILE_NAME,
|
|
79
|
-
UpdateMode: () => UpdateMode,
|
|
80
79
|
consumeTypes: () => consumeTypes,
|
|
81
80
|
generateTypes: () => generateTypes,
|
|
82
81
|
generateTypesInChildProcess: () => generateTypesInChildProcess,
|
|
@@ -113,7 +112,6 @@ var import_path3 = __toESM(require("path"));
|
|
|
113
112
|
var import_promises3 = require("fs/promises");
|
|
114
113
|
var import_fs = __toESM(require("fs"));
|
|
115
114
|
var import_sdk5 = require("@module-federation/sdk");
|
|
116
|
-
var import_lodash = __toESM(require("lodash.clonedeepwith"));
|
|
117
115
|
var import_third_party_dts_extractor2 = require("@module-federation/third-party-dts-extractor");
|
|
118
116
|
|
|
119
117
|
// packages/dts-plugin/src/core/lib/archiveHandler.ts
|
|
@@ -123,8 +121,8 @@ var import_promises2 = require("fs/promises");
|
|
|
123
121
|
|
|
124
122
|
// packages/dts-plugin/src/core/lib/typeScriptCompiler.ts
|
|
125
123
|
var import_fs_extra = require("fs-extra");
|
|
124
|
+
var import_crypto = __toESM(require("crypto"));
|
|
126
125
|
var import_promises = require("fs/promises");
|
|
127
|
-
var import_crypto = require("crypto");
|
|
128
126
|
var import_path = require("path");
|
|
129
127
|
var import_third_party_dts_extractor = require("@module-federation/third-party-dts-extractor");
|
|
130
128
|
var import_child_process = require("child_process");
|
|
@@ -135,8 +133,12 @@ var DEFINITION_FILE_EXTENSION = ".d.ts";
|
|
|
135
133
|
var retrieveMfTypesPath = /* @__PURE__ */ __name((tsConfig, remoteOptions) => (0, import_path.normalize)(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, "")), "retrieveMfTypesPath");
|
|
136
134
|
var retrieveOriginalOutDir = /* @__PURE__ */ __name((tsConfig, remoteOptions) => (0, import_path.normalize)(tsConfig.compilerOptions.outDir.replace(remoteOptions.compiledTypesFolder, "").replace(remoteOptions.typesFolder, "")), "retrieveOriginalOutDir");
|
|
137
135
|
var retrieveMfAPITypesPath = /* @__PURE__ */ __name((tsConfig, remoteOptions) => (0, import_path.join)(retrieveOriginalOutDir(tsConfig, remoteOptions), `${remoteOptions.typesFolder}.d.ts`), "retrieveMfAPITypesPath");
|
|
138
|
-
function writeTempTsConfig(tsConfig, context) {
|
|
139
|
-
const
|
|
136
|
+
function writeTempTsConfig(tsConfig, context, name) {
|
|
137
|
+
const createHash = /* @__PURE__ */ __name((contents) => {
|
|
138
|
+
return import_crypto.default.createHash("md5").update(contents).digest("hex");
|
|
139
|
+
}, "createHash");
|
|
140
|
+
const hash = createHash(`${JSON.stringify(tsConfig)}${name}`);
|
|
141
|
+
const tempTsConfigJsonPath = (0, import_path.resolve)(context, "node_modules", import_sdk.TEMP_DIR, `tsconfig.${hash}.json`);
|
|
140
142
|
(0, import_fs_extra.ensureDirSync)((0, import_path.dirname)(tempTsConfigJsonPath));
|
|
141
143
|
(0, import_fs_extra.writeFileSync)(tempTsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
|
|
142
144
|
return tempTsConfigJsonPath;
|
|
@@ -176,6 +178,7 @@ var processTypesFile = /* @__PURE__ */ __name((options) => __async(void 0, null,
|
|
|
176
178
|
const mfeTypeEntry = (0, import_path.join)(mfTypePath, `${sourceEntry}${DEFINITION_FILE_EXTENSION}`);
|
|
177
179
|
const mfeTypeEntryDirectory = (0, import_path.dirname)(mfeTypeEntry);
|
|
178
180
|
const relativePathToOutput = (0, import_path.relative)(mfeTypeEntryDirectory, filePath).replace(DEFINITION_FILE_EXTENSION, "").replace(STARTS_WITH_SLASH, "").split(import_path.sep).join("/");
|
|
181
|
+
(0, import_fs_extra.ensureDirSync)(mfeTypeEntryDirectory);
|
|
179
182
|
yield (0, import_promises.writeFile)(mfeTypeEntry, `export * from './${relativePathToOutput}';
|
|
180
183
|
export { default } from './${relativePathToOutput}';`);
|
|
181
184
|
}
|
|
@@ -188,7 +191,7 @@ var compileTs = /* @__PURE__ */ __name((mapComponentsToExpose, tsConfig, remoteO
|
|
|
188
191
|
return;
|
|
189
192
|
}
|
|
190
193
|
const { compilerOptions } = tsConfig;
|
|
191
|
-
const tempTsConfigJsonPath = writeTempTsConfig(tsConfig, remoteOptions.context);
|
|
194
|
+
const tempTsConfigJsonPath = writeTempTsConfig(tsConfig, remoteOptions.context, remoteOptions.moduleFederationConfig.name || "mf");
|
|
192
195
|
try {
|
|
193
196
|
const mfTypePath = retrieveMfTypesPath(tsConfig, remoteOptions);
|
|
194
197
|
const thirdPartyExtractor = new import_third_party_dts_extractor.ThirdPartyExtractor((0, import_path.resolve)(mfTypePath, "node_modules"), remoteOptions.context);
|
|
@@ -226,6 +229,9 @@ var compileTs = /* @__PURE__ */ __name((mapComponentsToExpose, tsConfig, remoteO
|
|
|
226
229
|
}
|
|
227
230
|
yield (0, import_promises.rm)(tempTsConfigJsonPath);
|
|
228
231
|
} catch (err) {
|
|
232
|
+
if (isDebugMode()) {
|
|
233
|
+
console.log("tsconfig: ", JSON.stringify(tsConfig, null, 2));
|
|
234
|
+
}
|
|
229
235
|
throw err;
|
|
230
236
|
}
|
|
231
237
|
}), "compileTs");
|
|
@@ -347,6 +353,11 @@ var import_chalk2 = __toESM(require("chalk"));
|
|
|
347
353
|
// packages/dts-plugin/src/server/constant.ts
|
|
348
354
|
var DEFAULT_WEB_SOCKET_PORT = 16322;
|
|
349
355
|
var WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
|
|
356
|
+
var UpdateMode;
|
|
357
|
+
(function(UpdateMode2) {
|
|
358
|
+
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
359
|
+
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
360
|
+
})(UpdateMode || (UpdateMode = {}));
|
|
350
361
|
|
|
351
362
|
// packages/dts-plugin/src/server/utils/log.ts
|
|
352
363
|
function fileLog(msg, module2, level) {
|
|
@@ -520,16 +531,6 @@ var UpdateKind;
|
|
|
520
531
|
UpdateKind2["RELOAD_PAGE"] = "RELOAD_PAGE";
|
|
521
532
|
})(UpdateKind || (UpdateKind = {}));
|
|
522
533
|
|
|
523
|
-
// packages/dts-plugin/src/core/constant.ts
|
|
524
|
-
var REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
525
|
-
var REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
526
|
-
var HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
527
|
-
var UpdateMode;
|
|
528
|
-
(function(UpdateMode2) {
|
|
529
|
-
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
530
|
-
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
531
|
-
})(UpdateMode || (UpdateMode = {}));
|
|
532
|
-
|
|
533
534
|
// packages/dts-plugin/src/server/broker/Broker.ts
|
|
534
535
|
var _Broker = class _Broker {
|
|
535
536
|
constructor() {
|
|
@@ -1176,7 +1177,8 @@ var defaultOptions = {
|
|
|
1176
1177
|
implementation: "",
|
|
1177
1178
|
context: process.cwd(),
|
|
1178
1179
|
abortOnError: true,
|
|
1179
|
-
consumeAPITypes: false
|
|
1180
|
+
consumeAPITypes: false,
|
|
1181
|
+
runtimePkgs: []
|
|
1180
1182
|
};
|
|
1181
1183
|
var buildZipUrl = /* @__PURE__ */ __name((hostOptions, url) => {
|
|
1182
1184
|
const remoteUrl = new URL(url, "file:");
|
|
@@ -1235,6 +1237,11 @@ var retrieveHostConfig = /* @__PURE__ */ __name((options) => {
|
|
|
1235
1237
|
};
|
|
1236
1238
|
}, "retrieveHostConfig");
|
|
1237
1239
|
|
|
1240
|
+
// packages/dts-plugin/src/core/constant.ts
|
|
1241
|
+
var REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
1242
|
+
var REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
1243
|
+
var HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
1244
|
+
|
|
1238
1245
|
// packages/dts-plugin/src/core/lib/DTSManager.ts
|
|
1239
1246
|
var _a;
|
|
1240
1247
|
var DTSManager = (_a = class {
|
|
@@ -1245,11 +1252,7 @@ var DTSManager = (_a = class {
|
|
|
1245
1252
|
__publicField(this, "loadedRemoteAPIAlias");
|
|
1246
1253
|
__publicField(this, "extraOptions");
|
|
1247
1254
|
__publicField(this, "updatedRemoteInfos");
|
|
1248
|
-
this.options = (
|
|
1249
|
-
if (key === "manifest") {
|
|
1250
|
-
return false;
|
|
1251
|
-
}
|
|
1252
|
-
});
|
|
1255
|
+
this.options = cloneDeepOptions(options);
|
|
1253
1256
|
this.runtimePkgs = [
|
|
1254
1257
|
"@module-federation/runtime",
|
|
1255
1258
|
"@module-federation/enhanced/runtime",
|
|
@@ -1318,7 +1321,7 @@ var DTSManager = (_a = class {
|
|
|
1318
1321
|
if (!Object.keys(mapComponentsToExpose).length) {
|
|
1319
1322
|
return;
|
|
1320
1323
|
}
|
|
1321
|
-
this.extractRemoteTypes({
|
|
1324
|
+
yield this.extractRemoteTypes({
|
|
1322
1325
|
remoteOptions,
|
|
1323
1326
|
tsConfig,
|
|
1324
1327
|
mapComponentsToExpose
|
|
@@ -1460,7 +1463,16 @@ var DTSManager = (_a = class {
|
|
|
1460
1463
|
...packageTypes,
|
|
1461
1464
|
"Y"
|
|
1462
1465
|
].join(" :\n")} ;`;
|
|
1463
|
-
const
|
|
1466
|
+
const runtimePkgs = /* @__PURE__ */ new Set();
|
|
1467
|
+
[
|
|
1468
|
+
...this.runtimePkgs,
|
|
1469
|
+
...hostOptions.runtimePkgs
|
|
1470
|
+
].forEach((pkg) => {
|
|
1471
|
+
runtimePkgs.add(pkg);
|
|
1472
|
+
});
|
|
1473
|
+
const pkgsDeclareStr = [
|
|
1474
|
+
...runtimePkgs
|
|
1475
|
+
].map((pkg) => {
|
|
1464
1476
|
return `declare module "${pkg}" {
|
|
1465
1477
|
${remoteKeysStr}
|
|
1466
1478
|
${packageTypesStr}
|
|
@@ -1593,6 +1605,7 @@ var DTSManager = (_a = class {
|
|
|
1593
1605
|
}, __name(_a, "DTSManager"), _a);
|
|
1594
1606
|
|
|
1595
1607
|
// packages/dts-plugin/src/core/lib/utils.ts
|
|
1608
|
+
var import_lodash = __toESM(require("lodash.clonedeepwith"));
|
|
1596
1609
|
function getDTSManagerConstructor(implementation) {
|
|
1597
1610
|
if (implementation) {
|
|
1598
1611
|
const NewConstructor = require(implementation);
|
|
@@ -1664,6 +1677,18 @@ var isTSProject = /* @__PURE__ */ __name((dtsOptions, context = process.cwd()) =
|
|
|
1664
1677
|
return false;
|
|
1665
1678
|
}
|
|
1666
1679
|
}, "isTSProject");
|
|
1680
|
+
function cloneDeepOptions(options) {
|
|
1681
|
+
const excludeKeys = [
|
|
1682
|
+
"manifest",
|
|
1683
|
+
"async"
|
|
1684
|
+
];
|
|
1685
|
+
return (0, import_lodash.default)(options, (_value, key) => {
|
|
1686
|
+
if (typeof key === "string" && excludeKeys.includes(key)) {
|
|
1687
|
+
return false;
|
|
1688
|
+
}
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
__name(cloneDeepOptions, "cloneDeepOptions");
|
|
1667
1692
|
function axiosGet(url, config) {
|
|
1668
1693
|
return __async(this, null, function* () {
|
|
1669
1694
|
const httpAgent = new import_http2.default.Agent({
|
|
@@ -1716,6 +1741,7 @@ function getEffectiveRootDir(parsedCommandLine) {
|
|
|
1716
1741
|
}
|
|
1717
1742
|
__name(getEffectiveRootDir, "getEffectiveRootDir");
|
|
1718
1743
|
var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiledTypesFolder, context, additionalFilesToCompile }, mapComponentsToExpose) => {
|
|
1744
|
+
var _a3;
|
|
1719
1745
|
const resolvedTsConfigPath = (0, import_path5.resolve)(context, tsConfigPath);
|
|
1720
1746
|
const readResult = import_typescript.default.readConfigFile(resolvedTsConfigPath, import_typescript.default.sys.readFile);
|
|
1721
1747
|
if (readResult.error) {
|
|
@@ -1734,6 +1760,7 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
|
|
|
1734
1760
|
};
|
|
1735
1761
|
rawTsConfigJson.compilerOptions = rawTsConfigJson.compilerOptions || {};
|
|
1736
1762
|
rawTsConfigJson.compilerOptions = __spreadValues(__spreadValues({}, rawTsConfigJson.compilerOptions), defaultCompilerOptions);
|
|
1763
|
+
(_a3 = rawTsConfigJson.compilerOptions) == null ? true : delete _a3.paths;
|
|
1737
1764
|
const filesToCompile = [
|
|
1738
1765
|
...Object.values(mapComponentsToExpose),
|
|
1739
1766
|
...additionalFilesToCompile
|
|
@@ -1742,10 +1769,7 @@ var readTsConfig = /* @__PURE__ */ __name(({ tsConfigPath, typesFolder, compiled
|
|
|
1742
1769
|
rawTsConfigJson.files = filesToCompile;
|
|
1743
1770
|
rawTsConfigJson.exclude = [];
|
|
1744
1771
|
"references" in rawTsConfigJson && delete rawTsConfigJson.references;
|
|
1745
|
-
|
|
1746
|
-
if (extendsPath && extendsPath.startsWith(".")) {
|
|
1747
|
-
rawTsConfigJson.extends = (0, import_path5.resolve)(context, extendsPath);
|
|
1748
|
-
}
|
|
1772
|
+
rawTsConfigJson.extends = resolvedTsConfigPath;
|
|
1749
1773
|
return rawTsConfigJson;
|
|
1750
1774
|
}, "readTsConfig");
|
|
1751
1775
|
var TS_EXTENSIONS = [
|
|
@@ -1805,7 +1829,6 @@ __name(generateTypes, "generateTypes");
|
|
|
1805
1829
|
|
|
1806
1830
|
// packages/dts-plugin/src/core/lib/DtsWorker.ts
|
|
1807
1831
|
var import_path6 = __toESM(require("path"));
|
|
1808
|
-
var import_lodash2 = __toESM(require("lodash.clonedeepwith"));
|
|
1809
1832
|
|
|
1810
1833
|
// packages/dts-plugin/src/core/rpc/index.ts
|
|
1811
1834
|
var rpc_exports = {};
|
|
@@ -2015,11 +2038,24 @@ function createRpcWorker(modulePath, data, memoryLimit, once) {
|
|
|
2015
2038
|
return remoteMethod(...args);
|
|
2016
2039
|
},
|
|
2017
2040
|
terminate() {
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2041
|
+
try {
|
|
2042
|
+
if (childProcess.connected) {
|
|
2043
|
+
childProcess.send({
|
|
2044
|
+
type: RpcGMCallTypes.EXIT,
|
|
2045
|
+
id
|
|
2046
|
+
}, (err) => {
|
|
2047
|
+
if (err) {
|
|
2048
|
+
console.error("Error sending message:", err);
|
|
2049
|
+
}
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
} catch (error2) {
|
|
2053
|
+
if (error2.code === "EPIPE") {
|
|
2054
|
+
console.error("Pipe closed before message could be sent:", error2);
|
|
2055
|
+
} else {
|
|
2056
|
+
console.error("Unexpected error:", error2);
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2023
2059
|
childProcess = void 0;
|
|
2024
2060
|
remoteMethod = void 0;
|
|
2025
2061
|
},
|
|
@@ -2047,11 +2083,7 @@ var _DtsWorker = class _DtsWorker {
|
|
|
2047
2083
|
__publicField(this, "rpcWorker");
|
|
2048
2084
|
__publicField(this, "_options");
|
|
2049
2085
|
__publicField(this, "_res");
|
|
2050
|
-
this._options = (
|
|
2051
|
-
if (key === "manifest") {
|
|
2052
|
-
return false;
|
|
2053
|
-
}
|
|
2054
|
-
});
|
|
2086
|
+
this._options = cloneDeepOptions(options);
|
|
2055
2087
|
this.removeUnSerializationOptions();
|
|
2056
2088
|
this.rpcWorker = createRpcWorker(import_path6.default.resolve(__dirname, "./fork-generate-dts.js"), {}, void 0, true);
|
|
2057
2089
|
this._res = this.rpcWorker.connect(this._options);
|
|
@@ -2092,7 +2124,13 @@ var _DtsWorker = class _DtsWorker {
|
|
|
2092
2124
|
}
|
|
2093
2125
|
exit() {
|
|
2094
2126
|
var _a3;
|
|
2095
|
-
|
|
2127
|
+
try {
|
|
2128
|
+
(_a3 = this.rpcWorker) == null ? void 0 : _a3.terminate();
|
|
2129
|
+
} catch (err) {
|
|
2130
|
+
if (isDebugMode()) {
|
|
2131
|
+
console.error(err);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2096
2134
|
}
|
|
2097
2135
|
};
|
|
2098
2136
|
__name(_DtsWorker, "DtsWorker");
|
|
@@ -2124,7 +2162,6 @@ __name(consumeTypes, "consumeTypes");
|
|
|
2124
2162
|
HOST_API_TYPES_FILE_NAME,
|
|
2125
2163
|
REMOTE_ALIAS_IDENTIFIER,
|
|
2126
2164
|
REMOTE_API_TYPES_FILE_NAME,
|
|
2127
|
-
UpdateMode,
|
|
2128
2165
|
consumeTypes,
|
|
2129
2166
|
generateTypes,
|
|
2130
2167
|
generateTypesInChildProcess,
|
|
@@ -45,6 +45,11 @@ var import_isomorphic_ws = __toESM(require("isomorphic-ws"));
|
|
|
45
45
|
// packages/dts-plugin/src/server/constant.ts
|
|
46
46
|
var DEFAULT_WEB_SOCKET_PORT = 16322;
|
|
47
47
|
var WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
|
|
48
|
+
var UpdateMode;
|
|
49
|
+
(function(UpdateMode2) {
|
|
50
|
+
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
51
|
+
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
52
|
+
})(UpdateMode || (UpdateMode = {}));
|
|
48
53
|
|
|
49
54
|
// packages/dts-plugin/src/server/createWebsocket.ts
|
|
50
55
|
function createWebsocket() {
|
|
@@ -120,13 +125,6 @@ var _AddDynamicRemoteAction = class _AddDynamicRemoteAction extends Action {
|
|
|
120
125
|
__name(_AddDynamicRemoteAction, "AddDynamicRemoteAction");
|
|
121
126
|
var AddDynamicRemoteAction = _AddDynamicRemoteAction;
|
|
122
127
|
|
|
123
|
-
// packages/dts-plugin/src/core/constant.ts
|
|
124
|
-
var UpdateMode;
|
|
125
|
-
(function(UpdateMode2) {
|
|
126
|
-
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
127
|
-
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
128
|
-
})(UpdateMode || (UpdateMode = {}));
|
|
129
|
-
|
|
130
128
|
// packages/dts-plugin/src/dev-worker/utils.ts
|
|
131
129
|
var DEFAULT_LOCAL_IPS = [
|
|
132
130
|
"localhost",
|
|
@@ -60,6 +60,11 @@ var WEB_SOCKET_CONNECT_MAGIC_ID = "1hpzW-zo2z-o8io-gfmV1-2cb1d82";
|
|
|
60
60
|
var MF_SERVER_IDENTIFIER = "Module Federation Dev Server";
|
|
61
61
|
var WEB_CLIENT_OPTIONS_IDENTIFIER = "__WEB_CLIENT_OPTIONS__";
|
|
62
62
|
var DEFAULT_TAR_NAME = "@mf-types.zip";
|
|
63
|
+
var UpdateMode;
|
|
64
|
+
(function(UpdateMode2) {
|
|
65
|
+
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
66
|
+
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
67
|
+
})(UpdateMode || (UpdateMode = {}));
|
|
63
68
|
|
|
64
69
|
// packages/dts-plugin/src/server/message/Action/Update.ts
|
|
65
70
|
var UpdateKind;
|
|
@@ -129,16 +134,6 @@ var _AddDynamicRemoteAction = class _AddDynamicRemoteAction extends Action {
|
|
|
129
134
|
__name(_AddDynamicRemoteAction, "AddDynamicRemoteAction");
|
|
130
135
|
var AddDynamicRemoteAction = _AddDynamicRemoteAction;
|
|
131
136
|
|
|
132
|
-
// packages/dts-plugin/src/core/constant.ts
|
|
133
|
-
var REMOTE_ALIAS_IDENTIFIER = "REMOTE_ALIAS_IDENTIFIER";
|
|
134
|
-
var REMOTE_API_TYPES_FILE_NAME = "apis.d.ts";
|
|
135
|
-
var HOST_API_TYPES_FILE_NAME = "index.d.ts";
|
|
136
|
-
var UpdateMode;
|
|
137
|
-
(function(UpdateMode2) {
|
|
138
|
-
UpdateMode2["POSITIVE"] = "POSITIVE";
|
|
139
|
-
UpdateMode2["PASSIVE"] = "PASSIVE";
|
|
140
|
-
})(UpdateMode || (UpdateMode = {}));
|
|
141
|
-
|
|
142
137
|
// packages/dts-plugin/src/server/message/Action/AddPublisher.ts
|
|
143
138
|
var _AddPublisherAction = class _AddPublisherAction extends Action {
|
|
144
139
|
constructor(payload) {
|
|
@@ -219,6 +214,7 @@ export {
|
|
|
219
214
|
MF_SERVER_IDENTIFIER,
|
|
220
215
|
WEB_CLIENT_OPTIONS_IDENTIFIER,
|
|
221
216
|
DEFAULT_TAR_NAME,
|
|
217
|
+
UpdateMode,
|
|
222
218
|
ActionKind,
|
|
223
219
|
UpdateKind,
|
|
224
220
|
AddPublisherAction,
|
|
@@ -228,9 +224,5 @@ export {
|
|
|
228
224
|
NotifyWebClientAction,
|
|
229
225
|
UpdatePublisherAction,
|
|
230
226
|
FetchTypesAction,
|
|
231
|
-
AddDynamicRemoteAction
|
|
232
|
-
REMOTE_ALIAS_IDENTIFIER,
|
|
233
|
-
REMOTE_API_TYPES_FILE_NAME,
|
|
234
|
-
HOST_API_TYPES_FILE_NAME,
|
|
235
|
-
UpdateMode
|
|
227
|
+
AddDynamicRemoteAction
|
|
236
228
|
};
|