@bunup/dts 0.14.25 → 0.14.27

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/index.d.ts CHANGED
@@ -52,9 +52,13 @@ type GenerateDtsOptions = {
52
52
  */
53
53
  inferTypes?: boolean;
54
54
  /**
55
- * Whether to use TypeScript's native compiler (tsgo), 10x faster than the traditional TypeScript compiler (tsc).
55
+ * Whether to use TypeScript's native compiler ([tsgo](https://devblogs.microsoft.com/typescript/typescript-native-port/)), 10x faster than the traditional TypeScript compiler (tsc).
56
56
  *
57
57
  * This is only applicable if you have the `dts.inferTypes` option enabled. Without this enabled, bunup uses TypeScript's isolated declarations mode by default, so any TypeScript compiler is not relevant in this case.
58
+ *
59
+ * Note: This option is experimental but much stable for declarations generation. Expected to be stable soon.
60
+ *
61
+ * Ensure `@typescript/native-preview` is installed as dev dependency: `bun add --dev @typescript/native-preview`
58
62
  */
59
63
  tsgo?: boolean;
60
64
  };
package/dist/index.js CHANGED
@@ -492,6 +492,20 @@ async function generateDts(entrypoints, options = {}) {
492
492
  const { resolve, preferredTsconfig, naming } = options;
493
493
  const cwd = options.cwd ? path2.resolve(options.cwd) : process.cwd();
494
494
  const tsconfig = await loadTsConfig(cwd, preferredTsconfig);
495
+ if (options.inferTypes && !tsconfig.filepath) {
496
+ throw new Error(`The "inferTypes" option requires a tsconfig.json file. Please create a tsconfig.json file in your project root with at least a basic configuration:
497
+
498
+ ` + `{
499
+ ` + ` "compilerOptions": {
500
+ ` + ` "target": "ESNext",
501
+ ` + ` "module": "ESNext",
502
+ ` + ` "moduleResolution": "bundler",
503
+ ` + ` "declaration": true
504
+ ` + ` }
505
+ ` + `}
506
+
507
+ ` + 'Alternatively, you can specify a custom path using the "preferredTsconfig" option.');
508
+ }
495
509
  const nonAbsoluteEntrypoints = entrypoints.filter((entrypoint) => !path2.isAbsolute(entrypoint));
496
510
  const resolvedEntrypoints = await getFilesFromGlobs(nonAbsoluteEntrypoints, cwd);
497
511
  const absoluteEntrypoints = entrypoints.filter((entrypoint) => path2.isAbsolute(entrypoint));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunup/dts",
3
- "version": "0.14.25",
3
+ "version": "0.14.27",
4
4
  "description": "An extremely fast TypeScript declaration bundler built on Bun's native bundler.",
5
5
  "homepage": "https://github.com/bunup/dts#readme",
6
6
  "bugs": {