@module-federation/dts-plugin 0.1.11 → 0.1.12
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 +9 -0
- package/dist/core.d.ts +3 -2
- package/dist/core.js +24 -2
- package/dist/index.js +29 -28
- package/dist/package.json +1 -1
- package/package.json +4 -4
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @module-federation/dts-plugin
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2a18c65: fix(dts-plugin): avoid typescript generation exceptions in javascript projects
|
|
8
|
+
- @module-federation/sdk@0.1.12
|
|
9
|
+
- @module-federation/managers@0.1.12
|
|
10
|
+
- @module-federation/third-party-dts-extractor@0.1.12
|
|
11
|
+
|
|
3
12
|
## 0.1.11
|
|
4
13
|
|
|
5
14
|
### 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"));
|
|
@@ -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) {
|
|
@@ -1489,6 +1491,25 @@ function retrieveTypesAssetsInfo(options) {
|
|
|
1489
1491
|
function replaceLocalhost(url) {
|
|
1490
1492
|
return url.replace("localhost", "127.0.0.1");
|
|
1491
1493
|
}
|
|
1494
|
+
var isTSProject = (dtsOptions, context = process.cwd()) => {
|
|
1495
|
+
if (dtsOptions === false) {
|
|
1496
|
+
return false;
|
|
1497
|
+
}
|
|
1498
|
+
try {
|
|
1499
|
+
let filepath = "";
|
|
1500
|
+
if (typeof dtsOptions === "object" && dtsOptions.tsConfigPath) {
|
|
1501
|
+
filepath = dtsOptions.tsConfigPath;
|
|
1502
|
+
} else {
|
|
1503
|
+
filepath = import_path4.default.resolve(context, "./tsconfig.json");
|
|
1504
|
+
}
|
|
1505
|
+
if (!import_path4.default.isAbsolute(filepath)) {
|
|
1506
|
+
filepath = import_path4.default.resolve(context, filepath);
|
|
1507
|
+
}
|
|
1508
|
+
return import_fs2.default.existsSync(filepath);
|
|
1509
|
+
} catch (err) {
|
|
1510
|
+
return false;
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1492
1513
|
|
|
1493
1514
|
// packages/dts-plugin/src/core/configurations/remotePlugin.ts
|
|
1494
1515
|
var defaultOptions2 = {
|
|
@@ -1550,7 +1571,7 @@ var resolveWithExtension = (exposedPath, context) => {
|
|
|
1550
1571
|
context,
|
|
1551
1572
|
`${exposedPath}.${extension}`
|
|
1552
1573
|
);
|
|
1553
|
-
if ((0,
|
|
1574
|
+
if ((0, import_fs3.existsSync)(exposedPathWithExtension)) {
|
|
1554
1575
|
return exposedPathWithExtension;
|
|
1555
1576
|
}
|
|
1556
1577
|
}
|
|
@@ -1913,6 +1934,7 @@ async function consumeTypes(options) {
|
|
|
1913
1934
|
generateTypes,
|
|
1914
1935
|
generateTypesInChildProcess,
|
|
1915
1936
|
getDTSManagerConstructor,
|
|
1937
|
+
isTSProject,
|
|
1916
1938
|
retrieveHostConfig,
|
|
1917
1939
|
retrieveMfTypesPath,
|
|
1918
1940
|
retrieveOriginalOutDir,
|
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"));
|
|
@@ -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) {
|
|
@@ -1480,6 +1481,25 @@ function retrieveTypesAssetsInfo(options) {
|
|
|
1480
1481
|
function replaceLocalhost(url) {
|
|
1481
1482
|
return url.replace("localhost", "127.0.0.1");
|
|
1482
1483
|
}
|
|
1484
|
+
var isTSProject = (dtsOptions, context = process.cwd()) => {
|
|
1485
|
+
if (dtsOptions === false) {
|
|
1486
|
+
return false;
|
|
1487
|
+
}
|
|
1488
|
+
try {
|
|
1489
|
+
let filepath = "";
|
|
1490
|
+
if (typeof dtsOptions === "object" && dtsOptions.tsConfigPath) {
|
|
1491
|
+
filepath = dtsOptions.tsConfigPath;
|
|
1492
|
+
} else {
|
|
1493
|
+
filepath = import_path4.default.resolve(context, "./tsconfig.json");
|
|
1494
|
+
}
|
|
1495
|
+
if (!import_path4.default.isAbsolute(filepath)) {
|
|
1496
|
+
filepath = import_path4.default.resolve(context, filepath);
|
|
1497
|
+
}
|
|
1498
|
+
return import_fs2.default.existsSync(filepath);
|
|
1499
|
+
} catch (err) {
|
|
1500
|
+
return false;
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1483
1503
|
|
|
1484
1504
|
// packages/dts-plugin/src/core/configurations/remotePlugin.ts
|
|
1485
1505
|
var defaultOptions2 = {
|
|
@@ -1541,7 +1561,7 @@ var resolveWithExtension = (exposedPath, context) => {
|
|
|
1541
1561
|
context,
|
|
1542
1562
|
`${exposedPath}.${extension}`
|
|
1543
1563
|
);
|
|
1544
|
-
if ((0,
|
|
1564
|
+
if ((0, import_fs3.existsSync)(exposedPathWithExtension)) {
|
|
1545
1565
|
return exposedPathWithExtension;
|
|
1546
1566
|
}
|
|
1547
1567
|
}
|
|
@@ -1949,22 +1969,9 @@ function createDevWorker(options) {
|
|
|
1949
1969
|
|
|
1950
1970
|
// packages/dts-plugin/src/plugins/DevPlugin.ts
|
|
1951
1971
|
var import_sdk5 = require("@module-federation/sdk");
|
|
1952
|
-
var
|
|
1972
|
+
var import_path8 = __toESM(require("path"));
|
|
1953
1973
|
|
|
1954
1974
|
// 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
1975
|
function isDev() {
|
|
1969
1976
|
return process.env["NODE_ENV"] === "development";
|
|
1970
1977
|
}
|
|
@@ -1972,7 +1979,7 @@ function isDev() {
|
|
|
1972
1979
|
// packages/dts-plugin/src/plugins/DevPlugin.ts
|
|
1973
1980
|
function ensureTempDir(filePath) {
|
|
1974
1981
|
try {
|
|
1975
|
-
const dir =
|
|
1982
|
+
const dir = import_path8.default.dirname(filePath);
|
|
1976
1983
|
import_fs_extra2.default.ensureDirSync(dir);
|
|
1977
1984
|
} catch (_err) {
|
|
1978
1985
|
}
|
|
@@ -1984,7 +1991,7 @@ var DevPlugin = class _DevPlugin {
|
|
|
1984
1991
|
}
|
|
1985
1992
|
static ensureLiveReloadEntry(options, filePath) {
|
|
1986
1993
|
ensureTempDir(filePath);
|
|
1987
|
-
const liveReloadEntry = import_fs_extra2.default.readFileSync(
|
|
1994
|
+
const liveReloadEntry = import_fs_extra2.default.readFileSync(import_path8.default.join(__dirname, "./iife/launch-web-client.js")).toString("utf-8");
|
|
1988
1995
|
const liveReloadEntryWithOptions = liveReloadEntry.replace(
|
|
1989
1996
|
WEB_CLIENT_OPTIONS_IDENTIFIER,
|
|
1990
1997
|
JSON.stringify(options)
|
|
@@ -2052,11 +2059,11 @@ var DevPlugin = class _DevPlugin {
|
|
|
2052
2059
|
throw new Error("name is required if you want to enable dev server!");
|
|
2053
2060
|
}
|
|
2054
2061
|
if (!normalizedDev.disableLiveReload) {
|
|
2055
|
-
const TEMP_DIR =
|
|
2062
|
+
const TEMP_DIR = import_path8.default.join(
|
|
2056
2063
|
`${process.cwd()}/node_modules`,
|
|
2057
2064
|
`.federation`
|
|
2058
2065
|
);
|
|
2059
|
-
const filepath =
|
|
2066
|
+
const filepath = import_path8.default.join(TEMP_DIR, `live-reload.js`);
|
|
2060
2067
|
_DevPlugin.ensureLiveReloadEntry({ name }, filepath);
|
|
2061
2068
|
compiler.hooks.afterPlugins.tap("MFDevPlugin", () => {
|
|
2062
2069
|
new compiler.webpack.EntryPlugin(compiler.context, filepath, {
|
|
@@ -2067,10 +2074,7 @@ var DevPlugin = class _DevPlugin {
|
|
|
2067
2074
|
const defaultGenerateTypes = { compileInChildProcess: true };
|
|
2068
2075
|
const defaultConsumeTypes = { consumeAPITypes: true };
|
|
2069
2076
|
const normalizedDtsOptions = (0, import_sdk5.normalizeOptions)(
|
|
2070
|
-
isTSProject(
|
|
2071
|
-
typeof dts === "object" ? dts.tsConfigPath : void 0,
|
|
2072
|
-
compiler.context
|
|
2073
|
-
),
|
|
2077
|
+
isTSProject(dts, compiler.context),
|
|
2074
2078
|
{
|
|
2075
2079
|
// remote types dist(.dev-server) not be used currently, so no need to set extractThirdParty etc
|
|
2076
2080
|
generateTypes: defaultGenerateTypes,
|
|
@@ -2272,10 +2276,7 @@ var TypesPlugin = class {
|
|
|
2272
2276
|
};
|
|
2273
2277
|
const defaultConsumeTypes = { abortOnError: false, consumeAPITypes: true };
|
|
2274
2278
|
const normalizedDtsOptions = (0, import_sdk8.normalizeOptions)(
|
|
2275
|
-
isTSProject(
|
|
2276
|
-
typeof options.dts === "object" ? options.dts.tsConfigPath : void 0,
|
|
2277
|
-
compiler.context
|
|
2278
|
-
),
|
|
2279
|
+
isTSProject(options.dts, compiler.context),
|
|
2279
2280
|
{
|
|
2280
2281
|
generateTypes: defaultGenerateTypes,
|
|
2281
2282
|
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.12",
|
|
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.12",
|
|
51
|
+
"@module-federation/managers": "0.1.12",
|
|
52
|
+
"@module-federation/third-party-dts-extractor": "0.1.12"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/ws": "8.5.3",
|