@modern-js/module-tools 2.42.0 → 2.42.1
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/builder/dts/tsc.js +28 -12
- package/package.json +14 -14
package/dist/builder/dts/tsc.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var tsc_exports = {};
|
|
20
30
|
__export(tsc_exports, {
|
|
@@ -22,6 +32,7 @@ __export(tsc_exports, {
|
|
|
22
32
|
runTsc: () => runTsc
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(tsc_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
25
36
|
var import_utils = require("@modern-js/utils");
|
|
26
37
|
var import_utils2 = require("../../utils");
|
|
27
38
|
var import_dts = require("../../constants/dts");
|
|
@@ -46,30 +57,35 @@ const resolveLog = async (childProgress, options) => {
|
|
|
46
57
|
});
|
|
47
58
|
};
|
|
48
59
|
const runTscBin = async (api, config) => {
|
|
49
|
-
const { appDirectory, watch = false, abortOnError = true } = config;
|
|
60
|
+
const { appDirectory, watch = false, abortOnError = true, tsconfigPath, userTsconfig, distPath } = config;
|
|
50
61
|
const tscBinFile = await (0, import_utils2.getTscBinPath)(appDirectory);
|
|
51
|
-
const { tsconfigPath, userTsconfig, distPath } = config;
|
|
52
62
|
const params = [];
|
|
63
|
+
if (userTsconfig.references) {
|
|
64
|
+
var _userTsconfig;
|
|
65
|
+
params.push("-b", tsconfigPath);
|
|
66
|
+
var _compilerOptions;
|
|
67
|
+
(_compilerOptions = (_userTsconfig = userTsconfig).compilerOptions) !== null && _compilerOptions !== void 0 ? _compilerOptions : _userTsconfig.compilerOptions = {};
|
|
68
|
+
const { baseUrl = ".", outDir = "dist" } = userTsconfig.compilerOptions;
|
|
69
|
+
const abosultBaseUrl = import_path.default.isAbsolute(baseUrl) ? baseUrl : import_path.default.join(import_path.default.dirname(tsconfigPath), baseUrl);
|
|
70
|
+
if (import_path.default.resolve(abosultBaseUrl, outDir) !== distPath) {
|
|
71
|
+
userTsconfig.compilerOptions.outDir = import_path.default.relative(abosultBaseUrl, distPath);
|
|
72
|
+
import_utils.fs.writeFileSync(tsconfigPath, JSON.stringify(userTsconfig, null, 2));
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
params.push("-p", tsconfigPath, "--outDir", distPath);
|
|
76
|
+
}
|
|
53
77
|
if (watch) {
|
|
54
78
|
params.push("-w");
|
|
55
79
|
}
|
|
56
|
-
if (userTsconfig.references) {
|
|
57
|
-
params.push("-b");
|
|
58
|
-
}
|
|
59
80
|
const childProgress = (0, import_utils.execa)(tscBinFile, [
|
|
60
|
-
|
|
61
|
-
tsconfigPath,
|
|
81
|
+
...params,
|
|
62
82
|
/* Required parameter, use it stdout have color */
|
|
63
83
|
"--pretty",
|
|
64
84
|
// https://github.com/microsoft/TypeScript/issues/21824
|
|
65
85
|
"--preserveWatchOutput",
|
|
66
86
|
// Only emit d.ts files
|
|
67
87
|
"--declaration",
|
|
68
|
-
"--emitDeclarationOnly"
|
|
69
|
-
// write d.ts files to distPath that defined in buildConfig.dts
|
|
70
|
-
"--outDir",
|
|
71
|
-
distPath,
|
|
72
|
-
...params
|
|
88
|
+
"--emitDeclarationOnly"
|
|
73
89
|
], {
|
|
74
90
|
stdio: "pipe",
|
|
75
91
|
cwd: appDirectory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/module-tools",
|
|
3
|
-
"version": "2.42.
|
|
3
|
+
"version": "2.42.1",
|
|
4
4
|
"description": "Simple, powerful, high-performance modern npm package development solution.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modern",
|
|
@@ -67,24 +67,24 @@
|
|
|
67
67
|
"tapable": "2.2.1",
|
|
68
68
|
"terser": "5.19.2",
|
|
69
69
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
70
|
-
"@modern-js/core": "2.42.
|
|
71
|
-
"@modern-js/
|
|
72
|
-
"@modern-js/plugin": "2.42.
|
|
73
|
-
"@modern-js/plugin-i18n": "2.42.
|
|
74
|
-
"@modern-js/
|
|
75
|
-
"@modern-js/
|
|
76
|
-
"@modern-js/upgrade": "2.42.
|
|
77
|
-
"@modern-js/utils": "2.42.
|
|
78
|
-
"@modern-js/
|
|
70
|
+
"@modern-js/core": "2.42.1",
|
|
71
|
+
"@modern-js/new-action": "2.42.1",
|
|
72
|
+
"@modern-js/plugin": "2.42.1",
|
|
73
|
+
"@modern-js/plugin-i18n": "2.42.1",
|
|
74
|
+
"@modern-js/plugin-changeset": "2.42.1",
|
|
75
|
+
"@modern-js/types": "2.42.1",
|
|
76
|
+
"@modern-js/upgrade": "2.42.1",
|
|
77
|
+
"@modern-js/utils": "2.42.1",
|
|
78
|
+
"@modern-js/plugin-lint": "2.42.1"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@types/convert-source-map": "1.5.2",
|
|
82
82
|
"@types/node": "^14",
|
|
83
83
|
"typescript": "^5",
|
|
84
|
-
"@modern-js/
|
|
85
|
-
"@modern-js/
|
|
86
|
-
"@scripts/build": "2.42.
|
|
87
|
-
"@scripts/vitest-config": "2.42.
|
|
84
|
+
"@modern-js/self": "npm:@modern-js/module-tools@2.42.1",
|
|
85
|
+
"@modern-js/builder-webpack-provider": "2.42.1",
|
|
86
|
+
"@scripts/build": "2.42.1",
|
|
87
|
+
"@scripts/vitest-config": "2.42.1"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"typescript": "^4 || ^5"
|