rsbuild-plugin-dts 0.0.2 → 0.0.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.
@@ -1,4 +1,4 @@
1
- import type { DtsEntry } from 'src';
1
+ import type { DtsEntry } from './index';
2
2
  export type BundleOptions = {
3
3
  name: string;
4
4
  cwd: string;
package/dist/dts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { DtsGenOptions } from 'src';
1
+ import type { DtsGenOptions } from './index';
2
2
  export declare const calcBundledPackages: (options: {
3
3
  autoExternal: DtsGenOptions["autoExternal"];
4
4
  cwd: string;
package/dist/dts.js CHANGED
@@ -136,7 +136,7 @@ const calcBundledPackages = (options)=>{
136
136
  async function generateDts(data) {
137
137
  const { bundle, distPath, dtsEntry, tsconfigPath, name, cwd, isWatch, dtsExtension = '.d.ts', autoExternal = true, userExternals } = data;
138
138
  core_namespaceObject.logger.start(`Generating DTS... ${external_picocolors_namespaceObject["default"].gray(`(${name})`)}`);
139
- const configPath = external_typescript_namespaceObject.findConfigFile(cwd, external_typescript_namespaceObject.sys.fileExists, tsconfigPath);
139
+ const configPath = external_typescript_namespaceObject["default"].findConfigFile(cwd, external_typescript_namespaceObject["default"].sys.fileExists, tsconfigPath);
140
140
  if (!configPath) {
141
141
  core_namespaceObject.logger.error(`tsconfig.json not found in ${cwd}`);
142
142
  throw new Error();
@@ -154,7 +154,7 @@ async function generateDts(data) {
154
154
  const { name: entryName, path: entryPath } = dtsEntry;
155
155
  let entry = '';
156
156
  if (bundle === true && entryPath) {
157
- const entrySourcePath = (0,external_node_path_namespaceObject.join)(cwd, entryPath);
157
+ const entrySourcePath = (0,external_node_path_namespaceObject.isAbsolute)(entryPath) ? entryPath : (0,external_node_path_namespaceObject.join)(cwd, entryPath);
158
158
  const relativePath = (0,external_node_path_namespaceObject.relative)(rootDir, (0,external_node_path_namespaceObject.dirname)(entrySourcePath));
159
159
  entry = (0,external_node_path_namespaceObject.join)(declarationDir, relativePath, (0,external_node_path_namespaceObject.basename)(entrySourcePath)).replace(/\.(js|mjs|jsx|ts|mts|tsx|cjs|cts|cjsx|ctsx|mjsx|mtsx)$/, '.d.ts');
160
160
  }
package/dist/tsc.js CHANGED
@@ -36,14 +36,14 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false) {
36
36
  emitDeclarationOnly: true
37
37
  };
38
38
  if (!isWatch) {
39
- const host = external_typescript_namespaceObject.createCompilerHost(compilerOptions);
40
- const program = external_typescript_namespaceObject.createProgram(fileNames, compilerOptions, host);
39
+ const host = external_typescript_namespaceObject["default"].createCompilerHost(compilerOptions);
40
+ const program = external_typescript_namespaceObject["default"].createProgram(fileNames, compilerOptions, host);
41
41
  const emitResult = program.emit();
42
- const allDiagnostics = external_typescript_namespaceObject.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
42
+ const allDiagnostics = external_typescript_namespaceObject["default"].getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
43
43
  const diagnosticMessages = [];
44
44
  for (const diagnostic of allDiagnostics){
45
45
  const fileLoc = (0,external_utils_js_namespaceObject.getFileLoc)(diagnostic);
46
- const message = `${fileLoc} - ${external_picocolors_namespaceObject["default"].red('error')} ${external_picocolors_namespaceObject["default"].gray(`TS${diagnostic.code}:`)} ${external_typescript_namespaceObject.flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine())}`;
46
+ const message = `${fileLoc} - ${external_picocolors_namespaceObject["default"].red('error')} ${external_picocolors_namespaceObject["default"].gray(`TS${diagnostic.code}:`)} ${external_typescript_namespaceObject["default"].flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine())}`;
47
47
  diagnosticMessages.push(message);
48
48
  }
49
49
  await (0,external_utils_js_namespaceObject.processDtsFiles)(bundle, declarationDir, dtsExtension);
@@ -56,18 +56,18 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false) {
56
56
  }
57
57
  core_namespaceObject.logger.ready(`DTS generated in ${(0,external_utils_js_namespaceObject.getTimeCost)(start)} ${external_picocolors_namespaceObject["default"].gray(`(${name})`)}`);
58
58
  } else {
59
- const createProgram = external_typescript_namespaceObject.createSemanticDiagnosticsBuilderProgram;
59
+ const createProgram = external_typescript_namespaceObject["default"].createSemanticDiagnosticsBuilderProgram;
60
60
  const formatHost = {
61
61
  getCanonicalFileName: (path)=>path,
62
- getCurrentDirectory: external_typescript_namespaceObject.sys.getCurrentDirectory,
63
- getNewLine: ()=>external_typescript_namespaceObject.sys.newLine
62
+ getCurrentDirectory: external_typescript_namespaceObject["default"].sys.getCurrentDirectory,
63
+ getNewLine: ()=>external_typescript_namespaceObject["default"].sys.newLine
64
64
  };
65
65
  const reportDiagnostic = (diagnostic)=>{
66
66
  const fileLoc = (0,external_utils_js_namespaceObject.getFileLoc)(diagnostic);
67
- core_namespaceObject.logger.error(`${fileLoc} - ${external_picocolors_namespaceObject["default"].red('error')} ${external_picocolors_namespaceObject["default"].gray(`TS${diagnostic.code}:`)}`, external_typescript_namespaceObject.flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine()));
67
+ core_namespaceObject.logger.error(`${fileLoc} - ${external_picocolors_namespaceObject["default"].red('error')} ${external_picocolors_namespaceObject["default"].gray(`TS${diagnostic.code}:`)}`, external_typescript_namespaceObject["default"].flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine()));
68
68
  };
69
69
  const reportWatchStatusChanged = async (diagnostic, _newLine, _options, errorCount)=>{
70
- const message = `${external_typescript_namespaceObject.flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine())} ${external_picocolors_namespaceObject["default"].gray(`(${name})`)}`;
70
+ const message = `${external_typescript_namespaceObject["default"].flattenDiagnosticMessageText(diagnostic.messageText, formatHost.getNewLine())} ${external_picocolors_namespaceObject["default"].gray(`(${name})`)}`;
71
71
  // 6031: File change detected. Starting incremental compilation...
72
72
  // 6032: Starting compilation in watch mode...
73
73
  if (diagnostic.code === 6031 || diagnostic.code === 6032) {
@@ -90,10 +90,10 @@ async function emitDts(options, onComplete, bundle = false, isWatch = false) {
90
90
  }
91
91
  };
92
92
  const system = {
93
- ...external_typescript_namespaceObject.sys
93
+ ...external_typescript_namespaceObject["default"].sys
94
94
  };
95
- const host = external_typescript_namespaceObject.createWatchCompilerHost(configPath, compilerOptions, system, createProgram, reportDiagnostic, reportWatchStatusChanged);
96
- external_typescript_namespaceObject.createWatchProgram(host);
95
+ const host = external_typescript_namespaceObject["default"].createWatchCompilerHost(configPath, compilerOptions, system, createProgram, reportDiagnostic, reportWatchStatusChanged);
96
+ external_typescript_namespaceObject["default"].createWatchProgram(host);
97
97
  }
98
98
  }
99
99
 
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type RsbuildConfig } from '@rsbuild/core';
2
- import type { DtsEntry } from 'src';
3
- import * as ts from 'typescript';
2
+ import ts from 'typescript';
3
+ 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;
package/dist/utils.js CHANGED
@@ -50,8 +50,8 @@ var external_typescript_namespaceObject = __WEBPACK_EXTERNAL_MODULE_typescript__
50
50
 
51
51
  const { convertPathToPattern } = external_fast_glob_namespaceObject["default"];
52
52
  function loadTsconfig(tsconfigPath) {
53
- const configFile = external_typescript_namespaceObject.readConfigFile(tsconfigPath, external_typescript_namespaceObject.sys.readFile);
54
- const configFileContent = external_typescript_namespaceObject.parseJsonConfigFileContent(configFile.config, external_typescript_namespaceObject.sys, external_node_path_namespaceObject["default"].dirname(tsconfigPath));
53
+ const configFile = external_typescript_namespaceObject["default"].readConfigFile(tsconfigPath, external_typescript_namespaceObject["default"].sys.readFile);
54
+ const configFileContent = external_typescript_namespaceObject["default"].parseJsonConfigFileContent(configFile.config, external_typescript_namespaceObject["default"].sys, external_node_path_namespaceObject["default"].dirname(tsconfigPath));
55
55
  return configFileContent;
56
56
  }
57
57
  const TEMP_FOLDER = '.rslib';
@@ -70,7 +70,7 @@ function ensureTempDeclarationDir(cwd) {
70
70
  }
71
71
  function getFileLoc(diagnostic) {
72
72
  if (diagnostic.file) {
73
- const { line, character } = external_typescript_namespaceObject.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
73
+ const { line, character } = external_typescript_namespaceObject["default"].getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
74
74
  return `${external_picocolors_namespaceObject["default"].cyan(diagnostic.file.fileName)}:${external_picocolors_namespaceObject["default"].yellow(line + 1)}:${external_picocolors_namespaceObject["default"].yellow(character + 1)}`;
75
75
  }
76
76
  return '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsbuild-plugin-dts",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Dts plugin for Rsbuild",
5
5
  "homepage": "https://rslib.dev",
6
6
  "bugs": {
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@microsoft/api-extractor": "^7.47.5",
33
- "@rsbuild/core": "1.0.1-beta.11",
34
- "rslib": "npm:@rslib/core@0.0.0",
33
+ "@rsbuild/core": "1.0.1-beta.16",
34
+ "rslib": "npm:@rslib/core@0.0.2",
35
35
  "typescript": "^5.5.4",
36
36
  "@rslib/tsconfig": "0.0.1"
37
37
  },