rsbuild-plugin-dts 0.3.2 → 0.4.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.
Files changed (2) hide show
  1. package/dist/index.js +13 -12
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:c
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
5
+ import * as __WEBPACK_EXTERNAL_MODULE_picocolors__ from "picocolors";
5
6
  import * as __WEBPACK_EXTERNAL_MODULE_typescript__ from "typescript";
6
7
  import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
7
8
  const src_rslib_entry_filename = (0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.fileURLToPath)(import.meta.url);
@@ -23,7 +24,7 @@ const pluginDts = (options = {})=>({
23
24
  const cwd = api.context.rootPath;
24
25
  const tsconfigPath = __WEBPACK_EXTERNAL_MODULE_typescript__["default"].findConfigFile(cwd, __WEBPACK_EXTERNAL_MODULE_typescript__["default"].sys.fileExists, config.source.tsconfigPath);
25
26
  if (!tsconfigPath) {
26
- __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.error(`tsconfig.json not found in ${cwd}`);
27
+ __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.error(`Failed to resolve tsconfig file ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].cyan(`"${config.source.tsconfigPath}"`)} from ${__WEBPACK_EXTERNAL_MODULE_picocolors__["default"].cyan(cwd)}. Please ensure that the file exists.`);
27
28
  throw new Error();
28
29
  }
29
30
  const tsConfigResult = (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.loadTsconfig)(tsconfigPath);
@@ -57,20 +58,20 @@ const pluginDts = (options = {})=>({
57
58
  });
58
59
  }));
59
60
  });
60
- api.onAfterBuild(async ({ isFirstCompile })=>{
61
- if (!isFirstCompile) return;
62
- promisesResult = await Promise.all(dtsPromises);
63
- });
64
61
  api.onAfterBuild({
65
- handler: ({ isFirstCompile })=>{
62
+ handler: async ({ isFirstCompile })=>{
66
63
  if (!isFirstCompile) return;
67
- for (const result of promisesResult)if ('error' === result.status) {
68
- if (options.abortOnError) throw new Error(result.errorMessage);
69
- result.errorMessage && __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.error(result.errorMessage);
70
- __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.warn('With the `abortOnError` configuration currently turned off, type errors do not cause build failures, but they do not guarantee proper type file output.');
71
- }
64
+ promisesResult = await Promise.all(dtsPromises);
72
65
  },
73
- order: 'post'
66
+ order: 'pre'
67
+ });
68
+ api.onAfterBuild(({ isFirstCompile })=>{
69
+ if (!isFirstCompile) return;
70
+ for (const result of promisesResult)if ('error' === result.status) {
71
+ if (options.abortOnError) throw new Error(result.errorMessage);
72
+ result.errorMessage && __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.error(result.errorMessage);
73
+ __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.logger.warn('With the `abortOnError` configuration currently turned off, type errors do not cause build failures, but they do not guarantee proper type file output.');
74
+ }
74
75
  });
75
76
  const killProcesses = ()=>{
76
77
  for (const childProcess of childProcesses)if (!childProcess.killed) try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsbuild-plugin-dts",
3
- "version": "0.3.2",
3
+ "version": "0.4.1",
4
4
  "description": "Rsbuild plugin that supports emitting declaration files for TypeScript.",
5
5
  "homepage": "https://lib.rsbuild.dev",
6
6
  "bugs": {
@@ -30,10 +30,10 @@
30
30
  "tinyglobby": "^0.2.10"
31
31
  },
32
32
  "devDependencies": {
33
- "@microsoft/api-extractor": "^7.49.1",
34
- "@rsbuild/core": "1.2.0-beta.1",
35
- "rsbuild-plugin-publint": "^0.2.1",
36
- "rslib": "npm:@rslib/core@0.3.1",
33
+ "@microsoft/api-extractor": "^7.49.2",
34
+ "@rsbuild/core": "~1.2.4",
35
+ "rsbuild-plugin-publint": "^0.3.0",
36
+ "rslib": "npm:@rslib/core@0.4.0",
37
37
  "typescript": "^5.7.3",
38
38
  "@rslib/tsconfig": "0.0.1"
39
39
  },