@module-federation/dts-plugin 0.1.11 → 0.1.13
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/core.d.ts +3 -2
- package/dist/core.js +31 -12
- package/dist/forkDevWorker.js +7 -10
- package/dist/forkGenerateDts.js +7 -10
- package/dist/index.js +36 -38
- package/dist/package.json +1 -1
- package/package.json +4 -4
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
+
## 0.1.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2e52e51: Build zip url for json ext as well
|
|
8
|
+
- 677958c: fix: tsup configuration
|
|
9
|
+
- Updated dependencies [2e52e51]
|
|
10
|
+
- Updated dependencies [0113b81]
|
|
11
|
+
- Updated dependencies [677958c]
|
|
12
|
+
- Updated dependencies [2e52e51]
|
|
13
|
+
- @module-federation/managers@0.1.13
|
|
14
|
+
- @module-federation/third-party-dts-extractor@0.1.13
|
|
15
|
+
- @module-federation/sdk@0.1.13
|
|
16
|
+
|
|
17
|
+
## 0.1.12
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 2a18c65: fix(dts-plugin): avoid typescript generation exceptions in javascript projects
|
|
22
|
+
- @module-federation/sdk@0.1.12
|
|
23
|
+
- @module-federation/managers@0.1.12
|
|
24
|
+
- @module-federation/third-party-dts-extractor@0.1.12
|
|
25
|
+
|
|
3
26
|
## 0.1.11
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/core.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { D as DTSManager, 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-d731dc2b.js';
|
|
2
2
|
export { j as DtsWorker, H as HOST_API_TYPES_FILE_NAME, k as REMOTE_ALIAS_IDENTIFIER, l as REMOTE_API_TYPES_FILE_NAME, U as UpdateMode, r as retrieveRemoteConfig } from './DtsWorker-d731dc2b.js';
|
|
3
3
|
import { H as HostOptions, R as RemoteInfo, a as RemoteOptions, D as DTSManagerOptions } from './DTSManagerOptions-c0728719.js';
|
|
4
|
+
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
4
5
|
import typescript from 'typescript';
|
|
5
6
|
import { ChildProcess } from 'child_process';
|
|
6
|
-
import '@module-federation/sdk';
|
|
7
7
|
|
|
8
8
|
declare const retrieveHostConfig: (options: HostOptions) => {
|
|
9
9
|
hostOptions: Required<HostOptions>;
|
|
@@ -18,6 +18,7 @@ declare function retrieveTypesAssetsInfo(options: RemoteOptions): {
|
|
|
18
18
|
zipName: string;
|
|
19
19
|
apiFileName: string;
|
|
20
20
|
};
|
|
21
|
+
declare const isTSProject: (dtsOptions: moduleFederationPlugin.ModuleFederationPluginOptions['dts'], context?: string) => boolean;
|
|
21
22
|
|
|
22
23
|
declare const retrieveMfTypesPath: (tsConfig: typescript.CompilerOptions, remoteOptions: Required<RemoteOptions>) => string;
|
|
23
24
|
declare const retrieveOriginalOutDir: (tsConfig: typescript.CompilerOptions, remoteOptions: Required<RemoteOptions>) => string;
|
|
@@ -81,4 +82,4 @@ declare namespace index {
|
|
|
81
82
|
|
|
82
83
|
declare function consumeTypes(options: DTSManagerOptions): Promise<void>;
|
|
83
84
|
|
|
84
|
-
export { DTSManager, DTSManagerOptions, HostOptions, RemoteOptions, consumeTypes, generateTypes, generateTypesInChildProcess, getDTSManagerConstructor, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveTypesAssetsInfo, retrieveTypesZipPath, index as rpc, validateOptions };
|
|
85
|
+
export { DTSManager, DTSManagerOptions, HostOptions, RemoteOptions, consumeTypes, generateTypes, generateTypesInChildProcess, getDTSManagerConstructor, isTSProject, retrieveHostConfig, retrieveMfTypesPath, retrieveOriginalOutDir, retrieveTypesAssetsInfo, retrieveTypesZipPath, index as rpc, validateOptions };
|
package/dist/core.js
CHANGED
|
@@ -40,6 +40,7 @@ __export(core_exports, {
|
|
|
40
40
|
generateTypes: () => generateTypes,
|
|
41
41
|
generateTypesInChildProcess: () => generateTypesInChildProcess,
|
|
42
42
|
getDTSManagerConstructor: () => getDTSManagerConstructor,
|
|
43
|
+
isTSProject: () => isTSProject,
|
|
43
44
|
retrieveHostConfig: () => retrieveHostConfig,
|
|
44
45
|
retrieveMfTypesPath: () => retrieveMfTypesPath,
|
|
45
46
|
retrieveOriginalOutDir: () => retrieveOriginalOutDir,
|
|
@@ -52,7 +53,7 @@ __export(core_exports, {
|
|
|
52
53
|
module.exports = __toCommonJS(core_exports);
|
|
53
54
|
|
|
54
55
|
// packages/dts-plugin/src/core/configurations/remotePlugin.ts
|
|
55
|
-
var
|
|
56
|
+
var import_fs3 = require("fs");
|
|
56
57
|
var import_path5 = require("path");
|
|
57
58
|
var import_managers2 = require("@module-federation/managers");
|
|
58
59
|
var import_typescript2 = __toESM(require("typescript"));
|
|
@@ -998,7 +999,7 @@ var downloadTypesArchive = (hostOptions) => {
|
|
|
998
999
|
);
|
|
999
1000
|
while (retries++ < hostOptions.maxRetries) {
|
|
1000
1001
|
try {
|
|
1001
|
-
const url =
|
|
1002
|
+
const url = fileToDownload;
|
|
1002
1003
|
const response = await import_axios.default.get(url, { responseType: "arraybuffer" }).catch(downloadErrorLogger(destinationFolder, url));
|
|
1003
1004
|
const zip = new import_adm_zip.default(Buffer.from(response.data));
|
|
1004
1005
|
zip.extractAllTo(destinationPath, true);
|
|
@@ -1035,9 +1036,6 @@ var defaultOptions = {
|
|
|
1035
1036
|
};
|
|
1036
1037
|
var buildZipUrl = (hostOptions, url) => {
|
|
1037
1038
|
const remoteUrl = new URL(url);
|
|
1038
|
-
if (remoteUrl.href.includes(import_sdk3.MANIFEST_EXT)) {
|
|
1039
|
-
return void 0;
|
|
1040
|
-
}
|
|
1041
1039
|
const pathnameWithoutEntry = remoteUrl.pathname.split("/").slice(0, -1).join("/");
|
|
1042
1040
|
remoteUrl.pathname = `${pathnameWithoutEntry}/${hostOptions.remoteTypesFolder}.zip`;
|
|
1043
1041
|
return remoteUrl.href;
|
|
@@ -1217,7 +1215,7 @@ var DTSManager = class {
|
|
|
1217
1215
|
if (!remoteInfo.url.includes(import_sdk4.MANIFEST_EXT)) {
|
|
1218
1216
|
return remoteInfo;
|
|
1219
1217
|
}
|
|
1220
|
-
const url =
|
|
1218
|
+
const url = remoteInfo.url;
|
|
1221
1219
|
const res = await (0, import_axios2.default)({
|
|
1222
1220
|
method: "get",
|
|
1223
1221
|
url
|
|
@@ -1232,7 +1230,10 @@ var DTSManager = class {
|
|
|
1232
1230
|
}
|
|
1233
1231
|
return u;
|
|
1234
1232
|
};
|
|
1235
|
-
|
|
1233
|
+
let publicPath = "publicPath" in manifestJson.metaData ? manifestJson.metaData.publicPath : new Function(manifestJson.metaData.getPublicPath)();
|
|
1234
|
+
if (publicPath === "auto") {
|
|
1235
|
+
publicPath = (0, import_sdk4.inferAutoPublicPath)(remoteInfo.url);
|
|
1236
|
+
}
|
|
1236
1237
|
remoteInfo.zipUrl = new URL(
|
|
1237
1238
|
import_path3.default.join(addProtocol(publicPath), manifestJson.metaData.types.zip)
|
|
1238
1239
|
).href;
|
|
@@ -1267,7 +1268,7 @@ var DTSManager = class {
|
|
|
1267
1268
|
return;
|
|
1268
1269
|
}
|
|
1269
1270
|
try {
|
|
1270
|
-
const url =
|
|
1271
|
+
const url = apiTypeUrl;
|
|
1271
1272
|
const res = await import_axios2.default.get(url);
|
|
1272
1273
|
let apiTypeFile = res.data;
|
|
1273
1274
|
apiTypeFile = apiTypeFile.replaceAll(
|
|
@@ -1439,6 +1440,7 @@ var DTSManager = class {
|
|
|
1439
1440
|
};
|
|
1440
1441
|
|
|
1441
1442
|
// packages/dts-plugin/src/core/lib/utils.ts
|
|
1443
|
+
var import_fs2 = __toESM(require("fs"));
|
|
1442
1444
|
var import_ansi_colors3 = __toESM(require("ansi-colors"));
|
|
1443
1445
|
function getDTSManagerConstructor(implementation) {
|
|
1444
1446
|
if (implementation) {
|
|
@@ -1486,9 +1488,25 @@ function retrieveTypesAssetsInfo(options) {
|
|
|
1486
1488
|
};
|
|
1487
1489
|
}
|
|
1488
1490
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1491
|
+
var isTSProject = (dtsOptions, context = process.cwd()) => {
|
|
1492
|
+
if (dtsOptions === false) {
|
|
1493
|
+
return false;
|
|
1494
|
+
}
|
|
1495
|
+
try {
|
|
1496
|
+
let filepath = "";
|
|
1497
|
+
if (typeof dtsOptions === "object" && dtsOptions.tsConfigPath) {
|
|
1498
|
+
filepath = dtsOptions.tsConfigPath;
|
|
1499
|
+
} else {
|
|
1500
|
+
filepath = import_path4.default.resolve(context, "./tsconfig.json");
|
|
1501
|
+
}
|
|
1502
|
+
if (!import_path4.default.isAbsolute(filepath)) {
|
|
1503
|
+
filepath = import_path4.default.resolve(context, filepath);
|
|
1504
|
+
}
|
|
1505
|
+
return import_fs2.default.existsSync(filepath);
|
|
1506
|
+
} catch (err) {
|
|
1507
|
+
return false;
|
|
1508
|
+
}
|
|
1509
|
+
};
|
|
1492
1510
|
|
|
1493
1511
|
// packages/dts-plugin/src/core/configurations/remotePlugin.ts
|
|
1494
1512
|
var defaultOptions2 = {
|
|
@@ -1550,7 +1568,7 @@ var resolveWithExtension = (exposedPath, context) => {
|
|
|
1550
1568
|
context,
|
|
1551
1569
|
`${exposedPath}.${extension}`
|
|
1552
1570
|
);
|
|
1553
|
-
if ((0,
|
|
1571
|
+
if ((0, import_fs3.existsSync)(exposedPathWithExtension)) {
|
|
1554
1572
|
return exposedPathWithExtension;
|
|
1555
1573
|
}
|
|
1556
1574
|
}
|
|
@@ -1913,6 +1931,7 @@ async function consumeTypes(options) {
|
|
|
1913
1931
|
generateTypes,
|
|
1914
1932
|
generateTypesInChildProcess,
|
|
1915
1933
|
getDTSManagerConstructor,
|
|
1934
|
+
isTSProject,
|
|
1916
1935
|
retrieveHostConfig,
|
|
1917
1936
|
retrieveMfTypesPath,
|
|
1918
1937
|
retrieveOriginalOutDir,
|
package/dist/forkDevWorker.js
CHANGED
|
@@ -1564,7 +1564,7 @@ var downloadTypesArchive = (hostOptions) => {
|
|
|
1564
1564
|
);
|
|
1565
1565
|
while (retries++ < hostOptions.maxRetries) {
|
|
1566
1566
|
try {
|
|
1567
|
-
const url =
|
|
1567
|
+
const url = fileToDownload;
|
|
1568
1568
|
const response = await import_axios.default.get(url, { responseType: "arraybuffer" }).catch(downloadErrorLogger(destinationFolder, url));
|
|
1569
1569
|
const zip = new import_adm_zip.default(Buffer.from(response.data));
|
|
1570
1570
|
zip.extractAllTo(destinationPath, true);
|
|
@@ -1601,9 +1601,6 @@ var defaultOptions = {
|
|
|
1601
1601
|
};
|
|
1602
1602
|
var buildZipUrl = (hostOptions, url) => {
|
|
1603
1603
|
const remoteUrl = new URL(url);
|
|
1604
|
-
if (remoteUrl.href.includes(import_sdk3.MANIFEST_EXT)) {
|
|
1605
|
-
return void 0;
|
|
1606
|
-
}
|
|
1607
1604
|
const pathnameWithoutEntry = remoteUrl.pathname.split("/").slice(0, -1).join("/");
|
|
1608
1605
|
remoteUrl.pathname = `${pathnameWithoutEntry}/${hostOptions.remoteTypesFolder}.zip`;
|
|
1609
1606
|
return remoteUrl.href;
|
|
@@ -1778,7 +1775,7 @@ var DTSManager = class {
|
|
|
1778
1775
|
if (!remoteInfo.url.includes(import_sdk4.MANIFEST_EXT)) {
|
|
1779
1776
|
return remoteInfo;
|
|
1780
1777
|
}
|
|
1781
|
-
const url =
|
|
1778
|
+
const url = remoteInfo.url;
|
|
1782
1779
|
const res = await (0, import_axios2.default)({
|
|
1783
1780
|
method: "get",
|
|
1784
1781
|
url
|
|
@@ -1793,7 +1790,10 @@ var DTSManager = class {
|
|
|
1793
1790
|
}
|
|
1794
1791
|
return u;
|
|
1795
1792
|
};
|
|
1796
|
-
|
|
1793
|
+
let publicPath = "publicPath" in manifestJson.metaData ? manifestJson.metaData.publicPath : new Function(manifestJson.metaData.getPublicPath)();
|
|
1794
|
+
if (publicPath === "auto") {
|
|
1795
|
+
publicPath = (0, import_sdk4.inferAutoPublicPath)(remoteInfo.url);
|
|
1796
|
+
}
|
|
1797
1797
|
remoteInfo.zipUrl = new URL(
|
|
1798
1798
|
import_path4.default.join(addProtocol(publicPath), manifestJson.metaData.types.zip)
|
|
1799
1799
|
).href;
|
|
@@ -1828,7 +1828,7 @@ var DTSManager = class {
|
|
|
1828
1828
|
return;
|
|
1829
1829
|
}
|
|
1830
1830
|
try {
|
|
1831
|
-
const url =
|
|
1831
|
+
const url = apiTypeUrl;
|
|
1832
1832
|
const res = await import_axios2.default.get(url);
|
|
1833
1833
|
let apiTypeFile = res.data;
|
|
1834
1834
|
apiTypeFile = apiTypeFile.replaceAll(
|
|
@@ -2013,9 +2013,6 @@ var validateOptions = (options) => {
|
|
|
2013
2013
|
throw new Error("moduleFederationConfig is required");
|
|
2014
2014
|
}
|
|
2015
2015
|
};
|
|
2016
|
-
function replaceLocalhost(url) {
|
|
2017
|
-
return url.replace("localhost", "127.0.0.1");
|
|
2018
|
-
}
|
|
2019
2016
|
|
|
2020
2017
|
// packages/dts-plugin/src/core/configurations/remotePlugin.ts
|
|
2021
2018
|
var defaultOptions2 = {
|
package/dist/forkGenerateDts.js
CHANGED
|
@@ -549,9 +549,6 @@ var defaultOptions2 = {
|
|
|
549
549
|
};
|
|
550
550
|
var buildZipUrl = (hostOptions, url) => {
|
|
551
551
|
const remoteUrl = new URL(url);
|
|
552
|
-
if (remoteUrl.href.includes(import_sdk3.MANIFEST_EXT)) {
|
|
553
|
-
return void 0;
|
|
554
|
-
}
|
|
555
552
|
const pathnameWithoutEntry = remoteUrl.pathname.split("/").slice(0, -1).join("/");
|
|
556
553
|
remoteUrl.pathname = `${pathnameWithoutEntry}/${hostOptions.remoteTypesFolder}.zip`;
|
|
557
554
|
return remoteUrl.href;
|
|
@@ -1223,7 +1220,7 @@ var downloadTypesArchive = (hostOptions) => {
|
|
|
1223
1220
|
);
|
|
1224
1221
|
while (retries++ < hostOptions.maxRetries) {
|
|
1225
1222
|
try {
|
|
1226
|
-
const url =
|
|
1223
|
+
const url = fileToDownload;
|
|
1227
1224
|
const response = await import_axios.default.get(url, { responseType: "arraybuffer" }).catch(downloadErrorLogger(destinationFolder, url));
|
|
1228
1225
|
const zip = new import_adm_zip.default(Buffer.from(response.data));
|
|
1229
1226
|
zip.extractAllTo(destinationPath, true);
|
|
@@ -1356,7 +1353,7 @@ var DTSManager = class {
|
|
|
1356
1353
|
if (!remoteInfo.url.includes(import_sdk4.MANIFEST_EXT)) {
|
|
1357
1354
|
return remoteInfo;
|
|
1358
1355
|
}
|
|
1359
|
-
const url =
|
|
1356
|
+
const url = remoteInfo.url;
|
|
1360
1357
|
const res = await (0, import_axios2.default)({
|
|
1361
1358
|
method: "get",
|
|
1362
1359
|
url
|
|
@@ -1371,7 +1368,10 @@ var DTSManager = class {
|
|
|
1371
1368
|
}
|
|
1372
1369
|
return u;
|
|
1373
1370
|
};
|
|
1374
|
-
|
|
1371
|
+
let publicPath = "publicPath" in manifestJson.metaData ? manifestJson.metaData.publicPath : new Function(manifestJson.metaData.getPublicPath)();
|
|
1372
|
+
if (publicPath === "auto") {
|
|
1373
|
+
publicPath = (0, import_sdk4.inferAutoPublicPath)(remoteInfo.url);
|
|
1374
|
+
}
|
|
1375
1375
|
remoteInfo.zipUrl = new URL(
|
|
1376
1376
|
import_path4.default.join(addProtocol(publicPath), manifestJson.metaData.types.zip)
|
|
1377
1377
|
).href;
|
|
@@ -1406,7 +1406,7 @@ var DTSManager = class {
|
|
|
1406
1406
|
return;
|
|
1407
1407
|
}
|
|
1408
1408
|
try {
|
|
1409
|
-
const url =
|
|
1409
|
+
const url = apiTypeUrl;
|
|
1410
1410
|
const res = await import_axios2.default.get(url);
|
|
1411
1411
|
let apiTypeFile = res.data;
|
|
1412
1412
|
apiTypeFile = apiTypeFile.replaceAll(
|
|
@@ -1591,9 +1591,6 @@ var validateOptions = (options) => {
|
|
|
1591
1591
|
throw new Error("moduleFederationConfig is required");
|
|
1592
1592
|
}
|
|
1593
1593
|
};
|
|
1594
|
-
function replaceLocalhost(url) {
|
|
1595
|
-
return url.replace("localhost", "127.0.0.1");
|
|
1596
|
-
}
|
|
1597
1594
|
|
|
1598
1595
|
// packages/dts-plugin/src/core/lib/generateTypes.ts
|
|
1599
1596
|
async function generateTypes(options) {
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ var import_path7 = __toESM(require("path"));
|
|
|
47
47
|
var import_lodash3 = __toESM(require("lodash.clonedeepwith"));
|
|
48
48
|
|
|
49
49
|
// packages/dts-plugin/src/core/configurations/remotePlugin.ts
|
|
50
|
-
var
|
|
50
|
+
var import_fs3 = require("fs");
|
|
51
51
|
var import_path5 = require("path");
|
|
52
52
|
var import_managers2 = require("@module-federation/managers");
|
|
53
53
|
var import_typescript2 = __toESM(require("typescript"));
|
|
@@ -994,7 +994,7 @@ var downloadTypesArchive = (hostOptions) => {
|
|
|
994
994
|
);
|
|
995
995
|
while (retries++ < hostOptions.maxRetries) {
|
|
996
996
|
try {
|
|
997
|
-
const url =
|
|
997
|
+
const url = fileToDownload;
|
|
998
998
|
const response = await import_axios.default.get(url, { responseType: "arraybuffer" }).catch(downloadErrorLogger(destinationFolder, url));
|
|
999
999
|
const zip = new import_adm_zip.default(Buffer.from(response.data));
|
|
1000
1000
|
zip.extractAllTo(destinationPath, true);
|
|
@@ -1031,9 +1031,6 @@ var defaultOptions = {
|
|
|
1031
1031
|
};
|
|
1032
1032
|
var buildZipUrl = (hostOptions, url) => {
|
|
1033
1033
|
const remoteUrl = new URL(url);
|
|
1034
|
-
if (remoteUrl.href.includes(import_sdk3.MANIFEST_EXT)) {
|
|
1035
|
-
return void 0;
|
|
1036
|
-
}
|
|
1037
1034
|
const pathnameWithoutEntry = remoteUrl.pathname.split("/").slice(0, -1).join("/");
|
|
1038
1035
|
remoteUrl.pathname = `${pathnameWithoutEntry}/${hostOptions.remoteTypesFolder}.zip`;
|
|
1039
1036
|
return remoteUrl.href;
|
|
@@ -1208,7 +1205,7 @@ var DTSManager = class {
|
|
|
1208
1205
|
if (!remoteInfo.url.includes(import_sdk4.MANIFEST_EXT)) {
|
|
1209
1206
|
return remoteInfo;
|
|
1210
1207
|
}
|
|
1211
|
-
const url =
|
|
1208
|
+
const url = remoteInfo.url;
|
|
1212
1209
|
const res = await (0, import_axios2.default)({
|
|
1213
1210
|
method: "get",
|
|
1214
1211
|
url
|
|
@@ -1223,7 +1220,10 @@ var DTSManager = class {
|
|
|
1223
1220
|
}
|
|
1224
1221
|
return u;
|
|
1225
1222
|
};
|
|
1226
|
-
|
|
1223
|
+
let publicPath = "publicPath" in manifestJson.metaData ? manifestJson.metaData.publicPath : new Function(manifestJson.metaData.getPublicPath)();
|
|
1224
|
+
if (publicPath === "auto") {
|
|
1225
|
+
publicPath = (0, import_sdk4.inferAutoPublicPath)(remoteInfo.url);
|
|
1226
|
+
}
|
|
1227
1227
|
remoteInfo.zipUrl = new URL(
|
|
1228
1228
|
import_path3.default.join(addProtocol(publicPath), manifestJson.metaData.types.zip)
|
|
1229
1229
|
).href;
|
|
@@ -1258,7 +1258,7 @@ var DTSManager = class {
|
|
|
1258
1258
|
return;
|
|
1259
1259
|
}
|
|
1260
1260
|
try {
|
|
1261
|
-
const url =
|
|
1261
|
+
const url = apiTypeUrl;
|
|
1262
1262
|
const res = await import_axios2.default.get(url);
|
|
1263
1263
|
let apiTypeFile = res.data;
|
|
1264
1264
|
apiTypeFile = apiTypeFile.replaceAll(
|
|
@@ -1430,6 +1430,7 @@ var DTSManager = class {
|
|
|
1430
1430
|
};
|
|
1431
1431
|
|
|
1432
1432
|
// packages/dts-plugin/src/core/lib/utils.ts
|
|
1433
|
+
var import_fs2 = __toESM(require("fs"));
|
|
1433
1434
|
var import_ansi_colors3 = __toESM(require("ansi-colors"));
|
|
1434
1435
|
function getDTSManagerConstructor(implementation) {
|
|
1435
1436
|
if (implementation) {
|
|
@@ -1477,9 +1478,25 @@ function retrieveTypesAssetsInfo(options) {
|
|
|
1477
1478
|
};
|
|
1478
1479
|
}
|
|
1479
1480
|
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1481
|
+
var isTSProject = (dtsOptions, context = process.cwd()) => {
|
|
1482
|
+
if (dtsOptions === false) {
|
|
1483
|
+
return false;
|
|
1484
|
+
}
|
|
1485
|
+
try {
|
|
1486
|
+
let filepath = "";
|
|
1487
|
+
if (typeof dtsOptions === "object" && dtsOptions.tsConfigPath) {
|
|
1488
|
+
filepath = dtsOptions.tsConfigPath;
|
|
1489
|
+
} else {
|
|
1490
|
+
filepath = import_path4.default.resolve(context, "./tsconfig.json");
|
|
1491
|
+
}
|
|
1492
|
+
if (!import_path4.default.isAbsolute(filepath)) {
|
|
1493
|
+
filepath = import_path4.default.resolve(context, filepath);
|
|
1494
|
+
}
|
|
1495
|
+
return import_fs2.default.existsSync(filepath);
|
|
1496
|
+
} catch (err) {
|
|
1497
|
+
return false;
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1483
1500
|
|
|
1484
1501
|
// packages/dts-plugin/src/core/configurations/remotePlugin.ts
|
|
1485
1502
|
var defaultOptions2 = {
|
|
@@ -1541,7 +1558,7 @@ var resolveWithExtension = (exposedPath, context) => {
|
|
|
1541
1558
|
context,
|
|
1542
1559
|
`${exposedPath}.${extension}`
|
|
1543
1560
|
);
|
|
1544
|
-
if ((0,
|
|
1561
|
+
if ((0, import_fs3.existsSync)(exposedPathWithExtension)) {
|
|
1545
1562
|
return exposedPathWithExtension;
|
|
1546
1563
|
}
|
|
1547
1564
|
}
|
|
@@ -1949,22 +1966,9 @@ function createDevWorker(options) {
|
|
|
1949
1966
|
|
|
1950
1967
|
// packages/dts-plugin/src/plugins/DevPlugin.ts
|
|
1951
1968
|
var import_sdk5 = require("@module-federation/sdk");
|
|
1952
|
-
var
|
|
1969
|
+
var import_path8 = __toESM(require("path"));
|
|
1953
1970
|
|
|
1954
1971
|
// packages/dts-plugin/src/plugins/utils.ts
|
|
1955
|
-
var import_path8 = __toESM(require("path"));
|
|
1956
|
-
var import_fs3 = __toESM(require("fs"));
|
|
1957
|
-
var isTSProject = (tsConfigPath, context = process.cwd()) => {
|
|
1958
|
-
try {
|
|
1959
|
-
let filepath = tsConfigPath ? tsConfigPath : import_path8.default.resolve(context, "./tsconfig.json");
|
|
1960
|
-
if (!import_path8.default.isAbsolute(filepath)) {
|
|
1961
|
-
filepath = import_path8.default.resolve(context, filepath);
|
|
1962
|
-
}
|
|
1963
|
-
return import_fs3.default.existsSync(filepath);
|
|
1964
|
-
} catch (err) {
|
|
1965
|
-
return false;
|
|
1966
|
-
}
|
|
1967
|
-
};
|
|
1968
1972
|
function isDev() {
|
|
1969
1973
|
return process.env["NODE_ENV"] === "development";
|
|
1970
1974
|
}
|
|
@@ -1972,7 +1976,7 @@ function isDev() {
|
|
|
1972
1976
|
// packages/dts-plugin/src/plugins/DevPlugin.ts
|
|
1973
1977
|
function ensureTempDir(filePath) {
|
|
1974
1978
|
try {
|
|
1975
|
-
const dir =
|
|
1979
|
+
const dir = import_path8.default.dirname(filePath);
|
|
1976
1980
|
import_fs_extra2.default.ensureDirSync(dir);
|
|
1977
1981
|
} catch (_err) {
|
|
1978
1982
|
}
|
|
@@ -1984,7 +1988,7 @@ var DevPlugin = class _DevPlugin {
|
|
|
1984
1988
|
}
|
|
1985
1989
|
static ensureLiveReloadEntry(options, filePath) {
|
|
1986
1990
|
ensureTempDir(filePath);
|
|
1987
|
-
const liveReloadEntry = import_fs_extra2.default.readFileSync(
|
|
1991
|
+
const liveReloadEntry = import_fs_extra2.default.readFileSync(import_path8.default.join(__dirname, "./iife/launch-web-client.js")).toString("utf-8");
|
|
1988
1992
|
const liveReloadEntryWithOptions = liveReloadEntry.replace(
|
|
1989
1993
|
WEB_CLIENT_OPTIONS_IDENTIFIER,
|
|
1990
1994
|
JSON.stringify(options)
|
|
@@ -2052,11 +2056,11 @@ var DevPlugin = class _DevPlugin {
|
|
|
2052
2056
|
throw new Error("name is required if you want to enable dev server!");
|
|
2053
2057
|
}
|
|
2054
2058
|
if (!normalizedDev.disableLiveReload) {
|
|
2055
|
-
const TEMP_DIR =
|
|
2059
|
+
const TEMP_DIR = import_path8.default.join(
|
|
2056
2060
|
`${process.cwd()}/node_modules`,
|
|
2057
2061
|
`.federation`
|
|
2058
2062
|
);
|
|
2059
|
-
const filepath =
|
|
2063
|
+
const filepath = import_path8.default.join(TEMP_DIR, `live-reload.js`);
|
|
2060
2064
|
_DevPlugin.ensureLiveReloadEntry({ name }, filepath);
|
|
2061
2065
|
compiler.hooks.afterPlugins.tap("MFDevPlugin", () => {
|
|
2062
2066
|
new compiler.webpack.EntryPlugin(compiler.context, filepath, {
|
|
@@ -2067,10 +2071,7 @@ var DevPlugin = class _DevPlugin {
|
|
|
2067
2071
|
const defaultGenerateTypes = { compileInChildProcess: true };
|
|
2068
2072
|
const defaultConsumeTypes = { consumeAPITypes: true };
|
|
2069
2073
|
const normalizedDtsOptions = (0, import_sdk5.normalizeOptions)(
|
|
2070
|
-
isTSProject(
|
|
2071
|
-
typeof dts === "object" ? dts.tsConfigPath : void 0,
|
|
2072
|
-
compiler.context
|
|
2073
|
-
),
|
|
2074
|
+
isTSProject(dts, compiler.context),
|
|
2074
2075
|
{
|
|
2075
2076
|
// remote types dist(.dev-server) not be used currently, so no need to set extractThirdParty etc
|
|
2076
2077
|
generateTypes: defaultGenerateTypes,
|
|
@@ -2272,10 +2273,7 @@ var TypesPlugin = class {
|
|
|
2272
2273
|
};
|
|
2273
2274
|
const defaultConsumeTypes = { abortOnError: false, consumeAPITypes: true };
|
|
2274
2275
|
const normalizedDtsOptions = (0, import_sdk8.normalizeOptions)(
|
|
2275
|
-
isTSProject(
|
|
2276
|
-
typeof options.dts === "object" ? options.dts.tsConfigPath : void 0,
|
|
2277
|
-
compiler.context
|
|
2278
|
-
),
|
|
2276
|
+
isTSProject(options.dts, compiler.context),
|
|
2279
2277
|
{
|
|
2280
2278
|
generateTypes: defaultGenerateTypes,
|
|
2281
2279
|
consumeTypes: defaultConsumeTypes,
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/dts-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"log4js": "6.9.1",
|
|
48
48
|
"node-schedule": "2.1.1",
|
|
49
49
|
"ws": "8.5.0",
|
|
50
|
-
"@module-federation/sdk": "0.1.
|
|
51
|
-
"@module-federation/managers": "0.1.
|
|
52
|
-
"@module-federation/third-party-dts-extractor": "0.1.
|
|
50
|
+
"@module-federation/sdk": "0.1.13",
|
|
51
|
+
"@module-federation/managers": "0.1.13",
|
|
52
|
+
"@module-federation/third-party-dts-extractor": "0.1.13"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/ws": "8.5.3",
|