rsbuild-plugin-dts 0.12.2 → 0.12.3
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/apiExtractor.js +3 -3
- package/dist/dts.js +1 -1
- package/dist/tsc.js +5 -5
- package/dist/utils.js +6 -4
- package/package.json +5 -5
package/dist/apiExtractor.js
CHANGED
|
@@ -42,12 +42,12 @@ async function bundleDts(options) {
|
|
|
42
42
|
if ('console-compiler-version-notice' === message.messageId || 'console-preamble' === message.messageId) message.logLevel = ExtractorLogLevel.None;
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
if (!extractorResult.succeeded) throw new Error(`API Extractor error. ${picocolors.
|
|
45
|
+
if (!extractorResult.succeeded) throw new Error(`API Extractor error. ${picocolors.dim(`(${name})`)}`);
|
|
46
46
|
await addBannerAndFooter(untrimmedFilePath, banner, footer);
|
|
47
|
-
logger.ready(`declaration files bundled successfully: ${picocolors.cyan(relative(cwd, untrimmedFilePath))} in ${getTimeCost(start)} ${picocolors.
|
|
47
|
+
logger.ready(`declaration files bundled successfully: ${picocolors.cyan(relative(cwd, untrimmedFilePath))} in ${getTimeCost(start)} ${picocolors.dim(`(${name})`)}`);
|
|
48
48
|
}));
|
|
49
49
|
} catch (e) {
|
|
50
|
-
const error = new Error(`${logPrefixApiExtractor} ${e} ${picocolors.
|
|
50
|
+
const error = new Error(`${logPrefixApiExtractor} ${e} ${picocolors.dim(`(${name})`)}`);
|
|
51
51
|
error.stack = '';
|
|
52
52
|
throw error;
|
|
53
53
|
}
|
package/dist/dts.js
CHANGED
|
@@ -57,7 +57,7 @@ async function generateDts(data) {
|
|
|
57
57
|
path: true,
|
|
58
58
|
extension: false
|
|
59
59
|
} } = data;
|
|
60
|
-
if (!isWatch) logger.start(`generating declaration files... ${picocolors.
|
|
60
|
+
if (!isWatch) logger.start(`generating declaration files... ${picocolors.dim(`(${name})`)}`);
|
|
61
61
|
const paths = mergeAliasWithTsConfigPaths(tsConfigResult.options.paths, alias);
|
|
62
62
|
if (Object.keys(paths).length > 0) tsConfigResult.options.paths = paths;
|
|
63
63
|
const { options: rawCompilerOptions, fileNames } = tsConfigResult;
|
package/dist/tsc.js
CHANGED
|
@@ -19,7 +19,7 @@ async function handleDiagnosticsAndProcessFiles(diagnostics, configPath, bundle,
|
|
|
19
19
|
await processDtsFiles(bundle, declarationDir, dtsExtension, redirect, configPath, rootDir, paths, banner, footer);
|
|
20
20
|
if (diagnosticMessages.length) {
|
|
21
21
|
for (const message of diagnosticMessages)logger.error(logPrefixTsc, message);
|
|
22
|
-
const error = new Error(`Failed to generate declaration files. ${picocolors.
|
|
22
|
+
const error = new Error(`Failed to generate declaration files. ${picocolors.dim(`(${name})`)}`);
|
|
23
23
|
error.stack = '';
|
|
24
24
|
throw error;
|
|
25
25
|
}
|
|
@@ -43,7 +43,7 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false, bui
|
|
|
43
43
|
], formatHost));
|
|
44
44
|
};
|
|
45
45
|
const reportWatchStatusChanged = async (diagnostic, _newLine, _options, errorCount)=>{
|
|
46
|
-
const message = `${typescript.flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine())} ${picocolors.
|
|
46
|
+
const message = `${typescript.flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine())} ${picocolors.dim(`(${name})`)}`;
|
|
47
47
|
if (6031 === diagnostic.code || 6032 === diagnostic.code) logger.info(logPrefixTsc, message);
|
|
48
48
|
if (6194 === diagnostic.code) {
|
|
49
49
|
if (0 !== errorCount && errorCount) logger.error(logPrefixTsc, message);
|
|
@@ -126,7 +126,7 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false, bui
|
|
|
126
126
|
solutionBuilder.build();
|
|
127
127
|
await processDtsFiles(bundle, declarationDir, dtsExtension, redirect, configPath, rootDir, paths, banner, footer);
|
|
128
128
|
if (errorNumber > 0) {
|
|
129
|
-
const error = new Error(`Failed to generate declaration files. ${picocolors.
|
|
129
|
+
const error = new Error(`Failed to generate declaration files. ${picocolors.dim(`(${name})`)}`);
|
|
130
130
|
error.stack = '';
|
|
131
131
|
throw error;
|
|
132
132
|
}
|
|
@@ -154,8 +154,8 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false, bui
|
|
|
154
154
|
const sortAndDeduplicateDiagnostics = typescript.sortAndDeduplicateDiagnostics(allDiagnostics);
|
|
155
155
|
await handleDiagnosticsAndProcessFiles(sortAndDeduplicateDiagnostics, configPath, bundle, declarationDir, dtsExtension, redirect, rootDir, paths, banner, footer, name);
|
|
156
156
|
}
|
|
157
|
-
if (bundle) logger.info(`declaration files prepared in ${getTimeCost(start)} ${picocolors.
|
|
158
|
-
else logger.ready(`declaration files generated in ${getTimeCost(start)} ${picocolors.
|
|
157
|
+
if (bundle) logger.info(`declaration files prepared in ${getTimeCost(start)} ${picocolors.dim(`(${name})`)}`);
|
|
158
|
+
else logger.ready(`declaration files generated in ${getTimeCost(start)} ${picocolors.dim(`(${name})`)}`);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
export { emitDts };
|
package/dist/utils.js
CHANGED
|
@@ -227,11 +227,13 @@ async function redirectDtsImports(dtsFile, dtsExtension, redirect, matchPath, ou
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
const ext = extname(redirectImportPath);
|
|
230
|
-
if (ext) {
|
|
231
|
-
if (
|
|
232
|
-
if (redirect.extension) redirectImportPath = redirectImportPath.replace(/\.[^.]+$/, extension);
|
|
233
|
-
}
|
|
230
|
+
if (ext) if (JS_EXTENSIONS_PATTERN.test(redirectImportPath)) {
|
|
231
|
+
if (redirect.extension) redirectImportPath = redirectImportPath.replace(/\.[^.]+$/, extension);
|
|
234
232
|
} else {
|
|
233
|
+
const candidatePath = await addExtension(redirect, dtsFile, redirectImportPath, extension);
|
|
234
|
+
if (await pathExists(node_path.join(dirname(dtsFile), candidatePath.replace(/\.[^.]+$/, dtsExtension)))) redirectImportPath = candidatePath;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
235
237
|
if (absoluteImportPath && normalize(absoluteImportPath).startsWith(normalize(rootDir))) redirectImportPath = await addExtension(redirect, dtsFile, redirectImportPath, extension);
|
|
236
238
|
if (!absoluteImportPath && importPath.startsWith('.')) redirectImportPath = await addExtension(redirect, dtsFile, redirectImportPath, extension);
|
|
237
239
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsbuild-plugin-dts",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"description": "Rsbuild plugin that supports emitting declaration files for TypeScript.",
|
|
5
5
|
"homepage": "https://rslib.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@ast-grep/napi": "0.37.0",
|
|
29
|
-
"magic-string": "^0.30.
|
|
29
|
+
"magic-string": "^0.30.18",
|
|
30
30
|
"picocolors": "1.1.1",
|
|
31
31
|
"tinyglobby": "^0.2.14",
|
|
32
32
|
"tsconfig-paths": "^4.2.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@microsoft/api-extractor": "^7.52.
|
|
36
|
-
"@rsbuild/core": "1.5.0
|
|
35
|
+
"@microsoft/api-extractor": "^7.52.11",
|
|
36
|
+
"@rsbuild/core": "~1.5.0",
|
|
37
37
|
"rsbuild-plugin-publint": "^0.3.3",
|
|
38
|
-
"rslib": "npm:@rslib/core@0.12.
|
|
38
|
+
"rslib": "npm:@rslib/core@0.12.2",
|
|
39
39
|
"typescript": "^5.9.2",
|
|
40
40
|
"@rslib/tsconfig": "0.0.1"
|
|
41
41
|
},
|