@d1g1tal/tsbuild 1.1.3 → 1.2.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/README.md CHANGED
@@ -24,6 +24,7 @@ A self-hosting TypeScript build tool that combines the best of three worlds: **T
24
24
  - 🎯 **ESM-Only** - Pure ESM project with no CommonJS support by design
25
25
  - 🧹 **Clean Builds** - Optional output directory cleaning before builds
26
26
  - 📊 **Performance Metrics** - Built-in performance logging with detailed timing information
27
+ - 🔎 **Zero-Config Entry Points** - Auto-infers entry points from `package.json` when none are configured
27
28
 
28
29
  ## Why tsbuild?
29
30
 
@@ -177,6 +178,14 @@ tsbuild supports a comprehensive set of options (full schema available in [`sche
177
178
 
178
179
  If a directory is provided, all files within will be used as entry points.
179
180
 
181
+ When `entryPoints` is omitted entirely, tsbuild automatically infers entry points from `package.json` by reverse-mapping output paths back to their source files. Resolution order:
182
+
183
+ 1. **`exports`** - Subpath export map (wildcard patterns are skipped; `import`/`default` conditions are tried in order)
184
+ 2. **`bin`** - Binary entry points
185
+ 3. **`main`** / **`module`** - Legacy fallback (only used when `exports` and `bin` produce no results)
186
+
187
+ > **Note:** Auto-inference requires that your `package.json` output paths fall inside the `outDir` declared in `tsconfig.json` and that the corresponding source files exist under `src/`.
188
+
180
189
  ### Declaration Bundling
181
190
 
182
191
  ```jsonc
@@ -322,6 +331,8 @@ The declaration bundling system (`src/dts/declaration-bundler.ts`) is a custom i
322
331
 
323
332
  This custom bundler works entirely with in-memory declaration files, avoiding the overhead of duplicate TypeScript Program creation with some other bundlers.
324
333
 
334
+ When a circular dependency is detected between declaration files, tsbuild emits a warning with the full cycle path (e.g., `a.d.ts -> b.d.ts -> a.d.ts`) rather than failing silently or crashing.
335
+
325
336
  ## Performance
326
337
 
327
338
  tsbuild is designed for speed:
@@ -332,9 +343,9 @@ tsbuild is designed for speed:
332
343
  - **Smart caching** - Leverages `.tsbuildinfo` for TypeScript incremental compilation
333
344
 
334
345
  Typical build times for the tsbuild project itself:
335
- - Full build: ~400-600ms
336
- - Incremental rebuild: ~100-200ms
337
- - Type-check only: ~50-100ms
346
+ - Full build: ~450-500ms
347
+ - Incremental rebuild (no changes): ~5ms
348
+ - Type-check only: ~10-15ms
338
349
 
339
350
  ## Acknowledgments
340
351
 
@@ -154,19 +154,35 @@ var Paths = class {
154
154
  }
155
155
  /**
156
156
  * Checks if the given path is a directory.
157
+ * Returns false if the path does not exist.
157
158
  * @param path - The path to check
158
159
  * @returns True if the path is a directory, false otherwise
159
160
  */
160
161
  static async isDirectory(path) {
161
- return (await lstat(path)).isDirectory();
162
+ try {
163
+ return (await lstat(path)).isDirectory();
164
+ } catch (error) {
165
+ if (error.code === "ENOENT") {
166
+ return false;
167
+ }
168
+ throw error;
169
+ }
162
170
  }
163
171
  /**
164
172
  * Checks if the given path is a file.
173
+ * Returns false if the path does not exist.
165
174
  * @param path - The path to check
166
175
  * @returns True if the path is a file, false otherwise
167
176
  */
168
177
  static async isFile(path) {
169
- return (await lstat(path)).isFile();
178
+ try {
179
+ return (await lstat(path)).isFile();
180
+ } catch (error) {
181
+ if (error.code === "ENOENT") {
182
+ return false;
183
+ }
184
+ throw error;
185
+ }
170
186
  }
171
187
  /**
172
188
  * Checks if a module specifier represents a local path (not a bare specifier).
@@ -3,7 +3,7 @@ import {
3
3
  Json,
4
4
  Paths,
5
5
  typeScriptExtensionExpression
6
- } from "./VMWNQL2J.js";
6
+ } from "./7FPDHUPW.js";
7
7
 
8
8
  // src/plugins/decorator-metadata.ts
9
9
  import { dirname } from "node:path";
@@ -258,7 +258,6 @@ declare class TypeScriptProject implements Closable {
258
258
  private readonly pendingChanges;
259
259
  private readonly buildDependencies;
260
260
  private dependencyPaths?;
261
- private packageJson?;
262
261
  /**
263
262
  * Creates a TypeScript project and prepares it for building/bundling.
264
263
  * @param directory - Project root directory (defaults to current working directory)