rsbuild-plugin-dts 0.6.0 → 0.6.2
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/dts.js +1 -1
- package/dist/tsc.js +37 -39
- package/dist/utils.js +1 -1
- package/package.json +5 -5
package/dist/dts.js
CHANGED
|
@@ -74,7 +74,7 @@ async function generateDts(data) {
|
|
|
74
74
|
if (!entryPath) return null;
|
|
75
75
|
const entrySourcePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.isAbsolute)(entryPath) ? entryPath : (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(cwd, entryPath);
|
|
76
76
|
const relativePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.relative)(rootDir, (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.dirname)(entrySourcePath));
|
|
77
|
-
const newPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(declarationDir, relativePath, (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.basename)(entrySourcePath)).replace(
|
|
77
|
+
const newPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(declarationDir, relativePath, (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.basename)(entrySourcePath)).replace(/\.(js|mjs|jsx|ts|mts|tsx|cjs|cts|cjsx|ctsx|mjsx|mtsx)$/, '.d.ts');
|
|
78
78
|
return {
|
|
79
79
|
name: entryName,
|
|
80
80
|
path: newPath
|
package/dist/tsc.js
CHANGED
|
@@ -59,48 +59,46 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false, bui
|
|
|
59
59
|
const system = {
|
|
60
60
|
...__WEBPACK_EXTERNAL_MODULE_typescript__["default"].sys
|
|
61
61
|
};
|
|
62
|
-
if (isWatch) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
if (isWatch) if (build) {
|
|
63
|
+
const host = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createSolutionBuilderWithWatchHost(system, createProgram, reportDiagnostic, void 0, reportWatchStatusChanged);
|
|
64
|
+
const solutionBuilder = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createSolutionBuilderWithWatch(host, [
|
|
65
|
+
configPath
|
|
66
|
+
], compilerOptions, {
|
|
67
|
+
watch: true
|
|
68
|
+
});
|
|
69
|
+
solutionBuilder.build();
|
|
70
|
+
} else {
|
|
71
|
+
const host = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createWatchCompilerHost(configPath, compilerOptions, system, createProgram, reportDiagnostic, reportWatchStatusChanged);
|
|
72
|
+
__WEBPACK_EXTERNAL_MODULE_typescript__["default"].createWatchProgram(host);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
if (build || compilerOptions.composite) if (!build && compilerOptions.composite) {
|
|
76
|
+
const host = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createIncrementalCompilerHost(compilerOptions);
|
|
77
|
+
const program = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createIncrementalProgram({
|
|
78
|
+
rootNames: fileNames,
|
|
79
|
+
options: compilerOptions,
|
|
80
|
+
configFileParsingDiagnostics: __WEBPACK_EXTERNAL_MODULE_typescript__["default"].getConfigFileParsingDiagnostics(tsConfigResult),
|
|
81
|
+
projectReferences,
|
|
82
|
+
host,
|
|
83
|
+
createProgram
|
|
69
84
|
});
|
|
70
|
-
|
|
85
|
+
program.emit();
|
|
86
|
+
const allDiagnostics = program.getSemanticDiagnostics().concat(program.getConfigFileParsingDiagnostics());
|
|
87
|
+
await handleDiagnosticsAndProcessFiles(allDiagnostics, configPath, bundle, declarationDir, dtsExtension, redirect, rootDir, banner, footer, name);
|
|
71
88
|
} else {
|
|
72
|
-
|
|
73
|
-
|
|
89
|
+
let errorNumber = 0;
|
|
90
|
+
const reportErrorSummary = (errorCount)=>{
|
|
91
|
+
errorNumber = errorCount;
|
|
92
|
+
};
|
|
93
|
+
const host = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createSolutionBuilderHost(system, createProgram, reportDiagnostic, void 0, reportErrorSummary);
|
|
94
|
+
const solutionBuilder = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createSolutionBuilder(host, [
|
|
95
|
+
configPath
|
|
96
|
+
], compilerOptions);
|
|
97
|
+
solutionBuilder.build();
|
|
98
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.processDtsFiles)(bundle, declarationDir, dtsExtension, redirect, configPath, rootDir, banner, footer);
|
|
99
|
+
if (errorNumber > 0) throw new Error(`Failed to generate declaration files. ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].gray(`(${name})`)}`);
|
|
74
100
|
}
|
|
75
|
-
|
|
76
|
-
if (build || compilerOptions.composite) {
|
|
77
|
-
if (!build && compilerOptions.composite) {
|
|
78
|
-
const host = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createIncrementalCompilerHost(compilerOptions);
|
|
79
|
-
const program = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createIncrementalProgram({
|
|
80
|
-
rootNames: fileNames,
|
|
81
|
-
options: compilerOptions,
|
|
82
|
-
configFileParsingDiagnostics: __WEBPACK_EXTERNAL_MODULE_typescript__["default"].getConfigFileParsingDiagnostics(tsConfigResult),
|
|
83
|
-
projectReferences,
|
|
84
|
-
host,
|
|
85
|
-
createProgram
|
|
86
|
-
});
|
|
87
|
-
program.emit();
|
|
88
|
-
const allDiagnostics = program.getSemanticDiagnostics().concat(program.getConfigFileParsingDiagnostics());
|
|
89
|
-
await handleDiagnosticsAndProcessFiles(allDiagnostics, configPath, bundle, declarationDir, dtsExtension, redirect, rootDir, banner, footer, name);
|
|
90
|
-
} else {
|
|
91
|
-
let errorNumber = 0;
|
|
92
|
-
const reportErrorSummary = (errorCount)=>{
|
|
93
|
-
errorNumber = errorCount;
|
|
94
|
-
};
|
|
95
|
-
const host = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createSolutionBuilderHost(system, createProgram, reportDiagnostic, void 0, reportErrorSummary);
|
|
96
|
-
const solutionBuilder = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createSolutionBuilder(host, [
|
|
97
|
-
configPath
|
|
98
|
-
], compilerOptions);
|
|
99
|
-
solutionBuilder.build();
|
|
100
|
-
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.processDtsFiles)(bundle, declarationDir, dtsExtension, redirect, configPath, rootDir, banner, footer);
|
|
101
|
-
if (errorNumber > 0) throw new Error(`Failed to generate declaration files. ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].gray(`(${name})`)}`);
|
|
102
|
-
}
|
|
103
|
-
} else {
|
|
101
|
+
else {
|
|
104
102
|
const host = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createCompilerHost(compilerOptions);
|
|
105
103
|
const program = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createProgram({
|
|
106
104
|
rootNames: fileNames,
|
package/dist/utils.js
CHANGED
|
@@ -154,7 +154,7 @@ async function redirectDtsImports(dtsFile, dtsExtension, redirect, matchPath, ou
|
|
|
154
154
|
const extension = dtsExtension.replace(/\.d\.ts$/, '.js').replace(/\.d\.cts$/, '.cjs').replace(/\.d\.mts$/, '.mjs');
|
|
155
155
|
for (const imp of matchModule){
|
|
156
156
|
const { n: importPath, s: start, e: end } = imp;
|
|
157
|
-
if (
|
|
157
|
+
if (importPath) try {
|
|
158
158
|
const absoluteImportPath = matchPath(importPath, void 0, void 0, [
|
|
159
159
|
'.jsx',
|
|
160
160
|
'.tsx',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsbuild-plugin-dts",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Rsbuild plugin that supports emitting declaration files for TypeScript.",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"tsconfig-paths": "^4.2.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@microsoft/api-extractor": "^7.52.
|
|
36
|
-
"@rsbuild/core": "1.3.
|
|
35
|
+
"@microsoft/api-extractor": "^7.52.3",
|
|
36
|
+
"@rsbuild/core": "1.3.5",
|
|
37
37
|
"rsbuild-plugin-publint": "^0.3.0",
|
|
38
|
-
"rslib": "npm:@rslib/core@0.
|
|
39
|
-
"typescript": "^5.8.
|
|
38
|
+
"rslib": "npm:@rslib/core@0.6.1",
|
|
39
|
+
"typescript": "^5.8.3",
|
|
40
40
|
"@rslib/tsconfig": "0.0.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|