rsbuild-plugin-dts 0.15.0 → 0.16.0

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/README.md CHANGED
@@ -89,7 +89,7 @@ The output directory of declaration files. The default value follows the priorit
89
89
 
90
90
  1. The `distPath` value of the plugin options.
91
91
  2. The `declarationDir` value in the `tsconfig.json` file.
92
- 3. The [output.distPath.root](https://rsbuild.rs/config/output/dist-path) value of Rsbuild configuration.
92
+ 3. The [output.distPath](https://rsbuild.rs/config/output/dist-path) or [output.distPath.root](https://rsbuild.rs/config/output/dist-path) value of Rsbuild configuration.
93
93
 
94
94
  ```js
95
95
  pluginDts({
package/dist/dts.js CHANGED
@@ -65,7 +65,7 @@ async function generateDts(data) {
65
65
  const resolvedDtsEmitPath = normalize(resolve(dirname(tsconfigPath), dtsEmitPath));
66
66
  if (build) {
67
67
  if (bundle) throw Error('Can not set "dts.bundle: true" when "dts.build: true"');
68
- if ((!rawCompilerOptions.outDir || normalize(rawCompilerOptions.outDir) !== resolvedDtsEmitPath) && (!rawCompilerOptions.declarationDir || normalize(rawCompilerOptions.declarationDir) !== resolvedDtsEmitPath)) throw Error(`Please set "declarationDir": "${dtsEmitPath}" in ${picocolors.underline(tsconfigPath)} to keep it same as "dts.distPath" or "output.distPath.root" field in lib config.`);
68
+ if ((!rawCompilerOptions.outDir || normalize(rawCompilerOptions.outDir) !== resolvedDtsEmitPath) && (!rawCompilerOptions.declarationDir || normalize(rawCompilerOptions.declarationDir) !== resolvedDtsEmitPath)) throw Error(`Please set "declarationDir": "${dtsEmitPath}" in ${picocolors.underline(tsconfigPath)} to keep it same as "dts.distPath" or "output.distPath" field in lib config.`);
69
69
  }
70
70
  const declarationDir = bundle ? ensureTempDeclarationDir(cwd, name) : dtsEmitPath;
71
71
  let dtsEntries = [];
package/dist/index.js CHANGED
@@ -41,7 +41,8 @@ const pluginDts = (options = {})=>({
41
41
  const tsConfigResult = loadTsconfig(tsconfigPath);
42
42
  const { options: rawCompilerOptions } = tsConfigResult;
43
43
  const { declarationDir, outDir, composite, incremental } = rawCompilerOptions;
44
- const dtsEmitPath = getDtsEmitPath(options.distPath, declarationDir, config.output?.distPath?.root);
44
+ const distPathRoot = 'string' == typeof config.output?.distPath ? config.output?.distPath : config.output?.distPath.root;
45
+ const dtsEmitPath = getDtsEmitPath(options.distPath, declarationDir, distPathRoot);
45
46
  warnIfOutside(cwd, declarationDir, 'declarationDir');
46
47
  warnIfOutside(cwd, outDir, 'outDir');
47
48
  if (false !== config.output.cleanDistPath) await cleanDtsFiles(dtsEmitPath);
package/dist/utils.d.ts CHANGED
@@ -30,7 +30,7 @@ export declare function calcLongestCommonPath(absPaths: string[]): Promise<strin
30
30
  export declare const globDtsFiles: (dir: string, patterns: string[]) => Promise<string[]>;
31
31
  export declare function cleanDtsFiles(dir: string): Promise<void>;
32
32
  export declare function cleanTsBuildInfoFile(tsconfigPath: string, compilerOptions: CompilerOptions): Promise<void>;
33
- export declare function getDtsEmitPath(pathFromPlugin: string | undefined, declarationDir: string | undefined, distPath: string): string;
33
+ export declare function getDtsEmitPath(pathFromPlugin: string | undefined, declarationDir: string | undefined, distPathRoot: string): string;
34
34
  export declare function warnIfOutside(cwd: string, dir: string | undefined, label: string): void;
35
35
  /**
36
36
  * Rename .d.ts and .d.ts.map files with corresponding extension
package/dist/utils.js CHANGED
@@ -339,8 +339,8 @@ async function cleanTsBuildInfoFile(tsconfigPath, compilerOptions) {
339
339
  force: true
340
340
  });
341
341
  }
342
- function getDtsEmitPath(pathFromPlugin, declarationDir, distPath) {
343
- return pathFromPlugin ?? declarationDir ?? distPath;
342
+ function getDtsEmitPath(pathFromPlugin, declarationDir, distPathRoot) {
343
+ return pathFromPlugin ?? declarationDir ?? distPathRoot;
344
344
  }
345
345
  function warnIfOutside(cwd, dir, label) {
346
346
  if (dir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsbuild-plugin-dts",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Rsbuild plugin that supports emitting declaration files for TypeScript.",
5
5
  "homepage": "https://rslib.rs",
6
6
  "bugs": {
@@ -29,17 +29,17 @@
29
29
  "@ast-grep/napi": "0.37.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@microsoft/api-extractor": "^7.52.13",
33
- "@rsbuild/core": "~1.5.13",
34
- "@typescript/native-preview": "7.0.0-dev.20250928.1",
32
+ "@microsoft/api-extractor": "^7.53.1",
33
+ "@rsbuild/core": "1.6.0-beta.0",
34
+ "@typescript/native-preview": "7.0.0-dev.20251019.1",
35
35
  "magic-string": "^0.30.19",
36
36
  "picocolors": "1.1.1",
37
37
  "prebundle": "1.4.2",
38
38
  "rsbuild-plugin-publint": "^0.3.3",
39
- "rslib": "npm:@rslib/core@0.14.0",
39
+ "rslib": "npm:@rslib/core@0.15.1",
40
40
  "tinyglobby": "0.2.14",
41
41
  "tsconfig-paths": "^4.2.0",
42
- "typescript": "^5.9.2",
42
+ "typescript": "^5.9.3",
43
43
  "@rslib/tsconfig": "0.0.1"
44
44
  },
45
45
  "peerDependencies": {