rsbuild-plugin-dts 0.1.0 → 0.1.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/apiExtractor.js +1 -1
- package/dist/dts.js +8 -14
- package/dist/index.d.ts +4 -2
- package/dist/index.js +35 -10
- package/dist/tsc.d.ts +2 -0
- package/dist/tsc.js +4 -5
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +45 -3
- package/package.json +5 -5
package/dist/apiExtractor.js
CHANGED
|
@@ -20,7 +20,7 @@ async function bundleDts(options) {
|
|
|
20
20
|
untrimmedFilePath
|
|
21
21
|
},
|
|
22
22
|
compiler: {
|
|
23
|
-
tsconfigFilePath: tsconfigPath
|
|
23
|
+
tsconfigFilePath: tsconfigPath
|
|
24
24
|
},
|
|
25
25
|
projectFolder: cwd
|
|
26
26
|
};
|
package/dist/dts.js
CHANGED
|
@@ -2,7 +2,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_fs__ from "node:fs";
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
|
|
5
|
-
import * as __WEBPACK_EXTERNAL_MODULE_typescript__ from "typescript";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE__tsc_js__ from "./tsc.js";
|
|
7
6
|
import * as __WEBPACK_EXTERNAL_MODULE__utils_js__ from "./utils.js";
|
|
8
7
|
const isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj);
|
|
@@ -56,30 +55,24 @@ const calcBundledPackages = (options)=>{
|
|
|
56
55
|
return Array.from(new Set(bundledPackages));
|
|
57
56
|
};
|
|
58
57
|
async function generateDts(data) {
|
|
59
|
-
const { bundle,
|
|
58
|
+
const { bundle, dtsEmitPath, dtsEntry, tsconfigPath, tsConfigResult, name, cwd, build, isWatch, dtsExtension = '.d.ts', autoExternal = true, userExternals, banner, footer } = data;
|
|
60
59
|
__WEBPACK_EXTERNAL_MODULE__rsbuild_core__.logger.start(`Generating DTS... ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].gray(`(${name})`)}`);
|
|
61
|
-
const
|
|
62
|
-
if (!configPath) {
|
|
63
|
-
__WEBPACK_EXTERNAL_MODULE__rsbuild_core__.logger.error(`tsconfig.json not found in ${cwd}`);
|
|
64
|
-
throw new Error();
|
|
65
|
-
}
|
|
66
|
-
const { options: rawCompilerOptions, fileNames } = (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.loadTsconfig)(configPath);
|
|
60
|
+
const { options: rawCompilerOptions, fileNames } = tsConfigResult;
|
|
67
61
|
// The longest common path of all non-declaration input files.
|
|
68
62
|
// If composite is set, the default is instead the directory containing the tsconfig.json file.
|
|
69
63
|
// see https://www.typescriptlang.org/tsconfig/#rootDir
|
|
70
|
-
const rootDir = rawCompilerOptions.rootDir ?? (rawCompilerOptions.composite ? (0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(
|
|
71
|
-
const
|
|
72
|
-
const resolvedDtsEmitPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.normalize)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.resolve)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(configPath), dtsEmitPath));
|
|
64
|
+
const rootDir = rawCompilerOptions.rootDir ?? (rawCompilerOptions.composite ? (0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(tsconfigPath) : await (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.calcLongestCommonPath)(fileNames.filter((fileName)=>!/\.d\.(ts|mts|cts)$/.test(fileName)))) ?? (0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(tsconfigPath);
|
|
65
|
+
const resolvedDtsEmitPath = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.normalize)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.resolve)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(tsconfigPath), dtsEmitPath));
|
|
73
66
|
if (build) {
|
|
74
67
|
// do not allow to use bundle DTS when 'build: true' since temp declarationDir should be set by user in tsconfig
|
|
75
68
|
if (bundle) throw Error('Can not set "dts.bundle: true" when "dts.build: true"');
|
|
76
69
|
// can not set '--declarationDir' or '--outDir' when 'build: true'.
|
|
77
70
|
if ((!rawCompilerOptions.outDir || (0, __WEBPACK_EXTERNAL_MODULE_node_path__.normalize)(rawCompilerOptions.outDir) !== resolvedDtsEmitPath) && (!rawCompilerOptions.declarationDir || (0, __WEBPACK_EXTERNAL_MODULE_node_path__.normalize)(rawCompilerOptions.declarationDir) !== resolvedDtsEmitPath)) {
|
|
78
71
|
const info = rawCompilerOptions.outDir && !rawCompilerOptions.declarationDir ? 'outDir' : 'declarationDir';
|
|
79
|
-
throw Error(`Please set ${info}: "${dtsEmitPath}" in ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].underline(
|
|
72
|
+
throw Error(`Please set ${info}: "${dtsEmitPath}" in ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].underline(tsconfigPath)} to keep it same as "dts.distPath" or "output.distPath.root" field in lib config.`);
|
|
80
73
|
}
|
|
81
74
|
}
|
|
82
|
-
const declarationDir = bundle ? (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.ensureTempDeclarationDir)(cwd) : dtsEmitPath;
|
|
75
|
+
const declarationDir = bundle ? (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.ensureTempDeclarationDir)(cwd, name) : dtsEmitPath;
|
|
83
76
|
const { name: entryName, path: entryPath } = dtsEntry;
|
|
84
77
|
let entry = '';
|
|
85
78
|
if (true === bundle && entryPath) {
|
|
@@ -117,7 +110,8 @@ async function generateDts(data) {
|
|
|
117
110
|
await (0, __WEBPACK_EXTERNAL_MODULE__tsc_js__.emitDts)({
|
|
118
111
|
name,
|
|
119
112
|
cwd,
|
|
120
|
-
configPath,
|
|
113
|
+
configPath: tsconfigPath,
|
|
114
|
+
tsConfigResult,
|
|
121
115
|
declarationDir,
|
|
122
116
|
dtsExtension,
|
|
123
117
|
banner,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RsbuildConfig, type RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import ts from 'typescript';
|
|
2
3
|
export type PluginDtsOptions = {
|
|
3
4
|
bundle?: boolean;
|
|
4
5
|
distPath?: string;
|
|
@@ -22,9 +23,10 @@ export type DtsGenOptions = PluginDtsOptions & {
|
|
|
22
23
|
cwd: string;
|
|
23
24
|
isWatch: boolean;
|
|
24
25
|
dtsEntry: DtsEntry;
|
|
25
|
-
|
|
26
|
+
dtsEmitPath: string;
|
|
26
27
|
build?: boolean;
|
|
27
|
-
tsconfigPath
|
|
28
|
+
tsconfigPath: string;
|
|
29
|
+
tsConfigResult: ts.ParsedCommandLine;
|
|
28
30
|
userExternals?: NonNullable<RsbuildConfig['output']>['externals'];
|
|
29
31
|
};
|
|
30
32
|
export declare const PLUGIN_DTS_NAME = "rsbuild:dts";
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,10 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_child_process__ from "node:child_proc
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url__ from "node:url";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core__ from "@rsbuild/core";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_typescript__ from "typescript";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE__utils_js__ from "./utils.js";
|
|
6
|
-
const
|
|
7
|
-
const
|
|
7
|
+
const src_rslib_entry_filename = (0, __WEBPACK_EXTERNAL_MODULE_node_url__.fileURLToPath)(import.meta.url);
|
|
8
|
+
const src_rslib_entry_dirname = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(src_rslib_entry_filename);
|
|
8
9
|
const PLUGIN_DTS_NAME = 'rsbuild:dts';
|
|
9
10
|
// use ts compiler API to generate bundleless dts
|
|
10
11
|
// use ts compiler API and api-extractor to generate dts bundle
|
|
@@ -17,24 +18,42 @@ const pluginDts = (options = {})=>({
|
|
|
17
18
|
options.build = options.build ?? false;
|
|
18
19
|
const dtsPromises = [];
|
|
19
20
|
let promisesResult = [];
|
|
20
|
-
|
|
21
|
+
let childProcesses = [];
|
|
22
|
+
api.onBeforeEnvironmentCompile(async ({ isWatch, isFirstCompile, environment })=>{
|
|
21
23
|
if (!isFirstCompile) return;
|
|
22
24
|
const { config } = environment;
|
|
23
|
-
const jsExtension = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.extname)(src_filename);
|
|
24
|
-
const childProcess = (0, __WEBPACK_EXTERNAL_MODULE_node_child_process__.fork)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(src_dirname, `./dts${jsExtension}`), [], {
|
|
25
|
-
stdio: 'inherit'
|
|
26
|
-
});
|
|
27
25
|
// TODO: @microsoft/api-extractor only support single entry to bundle DTS
|
|
28
26
|
// use first element of Record<string, string> type entry config
|
|
29
27
|
const dtsEntry = (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.processSourceEntry)(options.bundle, config.source?.entry);
|
|
28
|
+
const cwd = api.context.rootPath;
|
|
29
|
+
const tsconfigPath = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].findConfigFile(cwd, __WEBPACK_EXTERNAL_MODULE_typescript__["default"].sys.fileExists, config.source.tsconfigPath);
|
|
30
|
+
if (!tsconfigPath) {
|
|
31
|
+
__WEBPACK_EXTERNAL_MODULE__rsbuild_core__.logger.error(`tsconfig.json not found in ${cwd}`);
|
|
32
|
+
throw new Error();
|
|
33
|
+
}
|
|
34
|
+
const tsConfigResult = (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.loadTsconfig)(tsconfigPath);
|
|
35
|
+
const dtsEmitPath = options.distPath ?? tsConfigResult.options.declarationDir ?? config.output?.distPath?.root;
|
|
36
|
+
const jsExtension = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.extname)(src_rslib_entry_filename);
|
|
37
|
+
const childProcess = (0, __WEBPACK_EXTERNAL_MODULE_node_child_process__.fork)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(src_rslib_entry_dirname, `./dts${jsExtension}`), [], {
|
|
38
|
+
stdio: 'inherit'
|
|
39
|
+
});
|
|
40
|
+
childProcesses.push(childProcess);
|
|
41
|
+
const { cleanDistPath } = config.output;
|
|
42
|
+
// clean dts files
|
|
43
|
+
if (false !== cleanDistPath) await (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.cleanDtsFiles)(dtsEmitPath);
|
|
44
|
+
// clean .rslib temp folder
|
|
45
|
+
if (options.bundle) await (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.clearTempDeclarationDir)(cwd);
|
|
46
|
+
// clean tsbuildinfo file
|
|
47
|
+
await (0, __WEBPACK_EXTERNAL_MODULE__utils_js__.cleanTsBuildInfoFile)(tsconfigPath, tsConfigResult);
|
|
30
48
|
const dtsGenOptions = {
|
|
31
49
|
...options,
|
|
32
50
|
dtsEntry,
|
|
51
|
+
dtsEmitPath,
|
|
33
52
|
userExternals: config.output.externals,
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
tsconfigPath,
|
|
54
|
+
tsConfigResult,
|
|
36
55
|
name: environment.name,
|
|
37
|
-
cwd
|
|
56
|
+
cwd,
|
|
38
57
|
isWatch
|
|
39
58
|
};
|
|
40
59
|
childProcess.send(dtsGenOptions);
|
|
@@ -65,6 +84,12 @@ const pluginDts = (options = {})=>({
|
|
|
65
84
|
},
|
|
66
85
|
order: 'post'
|
|
67
86
|
});
|
|
87
|
+
const killProcesses = ()=>{
|
|
88
|
+
for (const childProcess of childProcesses)if (!childProcess.killed) childProcess.kill();
|
|
89
|
+
childProcesses = [];
|
|
90
|
+
};
|
|
91
|
+
api.onCloseBuild(killProcesses);
|
|
92
|
+
api.onCloseDevServer(killProcesses);
|
|
68
93
|
}
|
|
69
94
|
});
|
|
70
95
|
export { PLUGIN_DTS_NAME, pluginDts };
|
package/dist/tsc.d.ts
CHANGED
package/dist/tsc.js
CHANGED
|
@@ -18,9 +18,8 @@ async function handleDiagnosticsAndProcessFiles(diagnostics, configPath, host, b
|
|
|
18
18
|
}
|
|
19
19
|
async function emitDts(options, onComplete, bundle = false, isWatch = false, build = false) {
|
|
20
20
|
const start = Date.now();
|
|
21
|
-
const { configPath, declarationDir, name, dtsExtension, banner, footer } = options;
|
|
22
|
-
const
|
|
23
|
-
const { options: rawCompilerOptions, fileNames, projectReferences } = configFileParseResult;
|
|
21
|
+
const { configPath, tsConfigResult, declarationDir, name, dtsExtension, banner, footer } = options;
|
|
22
|
+
const { options: rawCompilerOptions, fileNames, projectReferences } = tsConfigResult;
|
|
24
23
|
const compilerOptions = {
|
|
25
24
|
...rawCompilerOptions,
|
|
26
25
|
configFilePath: configPath,
|
|
@@ -87,7 +86,7 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false, bui
|
|
|
87
86
|
const program = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].createIncrementalProgram({
|
|
88
87
|
rootNames: fileNames,
|
|
89
88
|
options: compilerOptions,
|
|
90
|
-
configFileParsingDiagnostics: __WEBPACK_EXTERNAL_MODULE_typescript__["default"].getConfigFileParsingDiagnostics(
|
|
89
|
+
configFileParsingDiagnostics: __WEBPACK_EXTERNAL_MODULE_typescript__["default"].getConfigFileParsingDiagnostics(tsConfigResult),
|
|
91
90
|
projectReferences,
|
|
92
91
|
host,
|
|
93
92
|
createProgram
|
|
@@ -120,7 +119,7 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false, bui
|
|
|
120
119
|
options: compilerOptions,
|
|
121
120
|
projectReferences,
|
|
122
121
|
host,
|
|
123
|
-
configFileParsingDiagnostics: __WEBPACK_EXTERNAL_MODULE_typescript__["default"].getConfigFileParsingDiagnostics(
|
|
122
|
+
configFileParsingDiagnostics: __WEBPACK_EXTERNAL_MODULE_typescript__["default"].getConfigFileParsingDiagnostics(tsConfigResult)
|
|
124
123
|
});
|
|
125
124
|
const emitResult = program.emit();
|
|
126
125
|
const allDiagnostics = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
package/dist/utils.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ import type { DtsEntry } from './index';
|
|
|
4
4
|
export declare function loadTsconfig(tsconfigPath: string): ts.ParsedCommandLine;
|
|
5
5
|
export declare const TEMP_FOLDER = ".rslib";
|
|
6
6
|
export declare const TEMP_DTS_DIR: string;
|
|
7
|
-
export declare function ensureTempDeclarationDir(cwd: string): string;
|
|
7
|
+
export declare function ensureTempDeclarationDir(cwd: string, name: string): string;
|
|
8
|
+
export declare function pathExists(path: string): Promise<boolean>;
|
|
9
|
+
export declare function emptyDir(dir: string): Promise<void>;
|
|
10
|
+
export declare function clearTempDeclarationDir(cwd: string): Promise<void>;
|
|
8
11
|
export declare function getFileLoc(diagnostic: ts.Diagnostic, configPath: string): string;
|
|
9
12
|
export declare const prettyTime: (seconds: number) => string;
|
|
10
13
|
export declare function getTimeCost(start: number): string;
|
|
@@ -12,3 +15,5 @@ export declare function addBannerAndFooter(file: string, banner?: string, footer
|
|
|
12
15
|
export declare function processDtsFiles(bundle: boolean, dir: string, dtsExtension: string, banner?: string, footer?: string): Promise<void>;
|
|
13
16
|
export declare function processSourceEntry(bundle: boolean, entryConfig: NonNullable<RsbuildConfig['source']>['entry']): DtsEntry;
|
|
14
17
|
export declare function calcLongestCommonPath(absPaths: string[]): Promise<string | null>;
|
|
18
|
+
export declare function cleanDtsFiles(dir: string): Promise<void>;
|
|
19
|
+
export declare function cleanTsBuildInfoFile(tsconfigPath: string, tsConfigResult: ts.ParsedCommandLine): Promise<void>;
|
package/dist/utils.js
CHANGED
|
@@ -14,8 +14,8 @@ function loadTsconfig(tsconfigPath) {
|
|
|
14
14
|
}
|
|
15
15
|
const TEMP_FOLDER = '.rslib';
|
|
16
16
|
const TEMP_DTS_DIR = `${TEMP_FOLDER}/declarations`;
|
|
17
|
-
function ensureTempDeclarationDir(cwd) {
|
|
18
|
-
const dirPath = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].join(cwd, TEMP_DTS_DIR);
|
|
17
|
+
function ensureTempDeclarationDir(cwd, name) {
|
|
18
|
+
const dirPath = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].join(cwd, TEMP_DTS_DIR, name);
|
|
19
19
|
if (__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].existsSync(dirPath)) return dirPath;
|
|
20
20
|
__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].mkdirSync(dirPath, {
|
|
21
21
|
recursive: true
|
|
@@ -24,6 +24,25 @@ function ensureTempDeclarationDir(cwd) {
|
|
|
24
24
|
__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].writeFileSync(gitIgnorePath, '**/*\n');
|
|
25
25
|
return dirPath;
|
|
26
26
|
}
|
|
27
|
+
async function pathExists(path) {
|
|
28
|
+
return __WEBPACK_EXTERNAL_MODULE_node_fs__["default"].promises.access(path).then(()=>true).catch(()=>false);
|
|
29
|
+
}
|
|
30
|
+
async function emptyDir(dir) {
|
|
31
|
+
if (!await pathExists(dir)) return;
|
|
32
|
+
try {
|
|
33
|
+
for (const file of (await __WEBPACK_EXTERNAL_MODULE_node_fs__["default"].promises.readdir(dir)))await __WEBPACK_EXTERNAL_MODULE_node_fs__["default"].promises.rm(__WEBPACK_EXTERNAL_MODULE_node_path__["default"].resolve(dir, file), {
|
|
34
|
+
recursive: true,
|
|
35
|
+
force: true
|
|
36
|
+
});
|
|
37
|
+
} catch (err) {
|
|
38
|
+
__WEBPACK_EXTERNAL_MODULE__rsbuild_core__.logger.debug(`Failed to empty dir: ${dir}`);
|
|
39
|
+
__WEBPACK_EXTERNAL_MODULE__rsbuild_core__.logger.debug(err);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function clearTempDeclarationDir(cwd) {
|
|
43
|
+
const dirPath = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].join(cwd, TEMP_DTS_DIR);
|
|
44
|
+
await emptyDir(dirPath);
|
|
45
|
+
}
|
|
27
46
|
function getFileLoc(diagnostic, configPath) {
|
|
28
47
|
if (diagnostic.file) {
|
|
29
48
|
const { line, character } = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
@@ -104,4 +123,27 @@ async function calcLongestCommonPath(absPaths) {
|
|
|
104
123
|
if (stats?.isFile()) lca = __WEBPACK_EXTERNAL_MODULE_node_path__["default"].dirname(lca);
|
|
105
124
|
return lca;
|
|
106
125
|
}
|
|
107
|
-
|
|
126
|
+
async function cleanDtsFiles(dir) {
|
|
127
|
+
const patterns = [
|
|
128
|
+
'/**/*.d.ts',
|
|
129
|
+
'/**/*.d.cts',
|
|
130
|
+
'/**/*.d.mts'
|
|
131
|
+
];
|
|
132
|
+
const files = await Promise.all(patterns.map((pattern)=>(0, __WEBPACK_EXTERNAL_MODULE_tinyglobby__.glob)(convertPath((0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(dir, pattern)), {
|
|
133
|
+
absolute: true
|
|
134
|
+
})));
|
|
135
|
+
const allFiles = files.flat();
|
|
136
|
+
await Promise.all(allFiles.map((file)=>__WEBPACK_EXTERNAL_MODULE_node_fs_promises__["default"].rm(file, {
|
|
137
|
+
force: true
|
|
138
|
+
})));
|
|
139
|
+
}
|
|
140
|
+
async function cleanTsBuildInfoFile(tsconfigPath, tsConfigResult) {
|
|
141
|
+
const tsconfigDir = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(tsconfigPath);
|
|
142
|
+
const { outDir, rootDir, tsBuildInfoFile } = tsConfigResult.options;
|
|
143
|
+
let tsbuildInfoFilePath = `${(0, __WEBPACK_EXTERNAL_MODULE_node_path__.basename)(tsconfigPath, '.json')}${tsBuildInfoFile ?? '.tsbuildinfo'}`;
|
|
144
|
+
if (outDir) tsbuildInfoFilePath = rootDir ? (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(outDir, (0, __WEBPACK_EXTERNAL_MODULE_node_path__.relative)((0, __WEBPACK_EXTERNAL_MODULE_node_path__.resolve)(tsconfigDir, rootDir), tsconfigDir), tsbuildInfoFilePath) : (0, __WEBPACK_EXTERNAL_MODULE_node_path__.join)(outDir, tsbuildInfoFilePath);
|
|
145
|
+
await __WEBPACK_EXTERNAL_MODULE_node_fs_promises__["default"].rm(tsbuildInfoFilePath, {
|
|
146
|
+
force: true
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export { TEMP_DTS_DIR, TEMP_FOLDER, addBannerAndFooter, calcLongestCommonPath, cleanDtsFiles, cleanTsBuildInfoFile, clearTempDeclarationDir, emptyDir, ensureTempDeclarationDir, getFileLoc, getTimeCost, loadTsconfig, pathExists, prettyTime, processDtsFiles, processSourceEntry };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rsbuild-plugin-dts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Rsbuild plugin that supports emitting declaration files for TypeScript.",
|
|
5
5
|
"homepage": "https://lib.rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"magic-string": "^0.30.
|
|
28
|
+
"magic-string": "^0.30.14",
|
|
29
29
|
"picocolors": "1.1.1",
|
|
30
30
|
"tinyglobby": "^0.2.10"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@microsoft/api-extractor": "^7.
|
|
34
|
-
"@rsbuild/core": "~1.1.
|
|
35
|
-
"rslib": "npm:@rslib/core@0.0
|
|
33
|
+
"@microsoft/api-extractor": "^7.48.0",
|
|
34
|
+
"@rsbuild/core": "~1.1.6",
|
|
35
|
+
"rslib": "npm:@rslib/core@0.1.0",
|
|
36
36
|
"typescript": "^5.6.3",
|
|
37
37
|
"@rslib/tsconfig": "0.0.1"
|
|
38
38
|
},
|