@d1g1tal/tsbuild 1.3.0 → 1.3.2

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
@@ -1,11 +1,11 @@
1
1
  # tsbuild
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/%40d1g1tal/tsbuild?color=blue)](https://www.npmjs.com/package/@d1g1tal/tsbuild)
4
- [![npm downloads](https://img.shields.io/npm/dm/%40d1g1tal/tsbuild)](https://www.npmjs.com/package/@d1g1tal/tsbuild)
3
+ [![npm version](https://img.shields.io/npm/v/@d1g1tal/tsbuild?color=blue)](https://www.npmjs.com/package/@d1g1tal/tsbuild)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@d1g1tal/tsbuild)](https://www.npmjs.com/package/@d1g1tal/tsbuild)
5
5
  [![CI](https://github.com/D1g1talEntr0py/tsbuild/actions/workflows/ci.yml/badge.svg)](https://github.com/D1g1talEntr0py/tsbuild/actions/workflows/ci.yml)
6
6
  [![codecov](https://codecov.io/gh/D1g1talEntr0py/tsbuild/graph/badge.svg)](https://codecov.io/gh/D1g1talEntr0py/tsbuild)
7
7
  [![License: MIT](https://img.shields.io/github/license/D1g1talEntr0py/tsbuild)](https://github.com/D1g1talEntr0py/tsbuild/blob/main/LICENSE)
8
- [![Node.js](https://img.shields.io/node/v/%40d1g1tal/tsbuild)](https://nodejs.org)
8
+ [![Node.js](https://img.shields.io/node/v/@d1g1tal/tsbuild)](https://nodejs.org)
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
10
10
 
11
11
  A TypeScript build tool that combines three tools into one workflow: **TypeScript's type system** for correctness, **esbuild** for speed, and **SWC** for legacy decorator metadata (optional, not installed by default). Built for modern ESM-only projects on Node.js 20.16.0+.
@@ -478,17 +478,19 @@ The TypeScript declaration bundling system was originally inspired by rollup-plu
478
478
 
479
479
  ## Comparison with Other Tools
480
480
 
481
- | Feature | tsbuild | tsup | tsc |
482
- |---------|---------|------|-----|
483
- | Type Checking | ✅ Full | ✅ Full | ✅ Full |
484
- | Bundling | ✅ esbuild | ✅ esbuild | ❌ N/A |
485
- | Declaration Bundling | ✅ Custom Bundler | ✅ rollup-plugin-dts | ❌ N/A |
486
- | TC39 Decorators | ✅ Native | ✅ Native | ✅ Native |
487
- | Legacy Decorator Metadata | ✅ SWC (manual install) | ✅ SWC | ✅ Native |
488
- | CommonJS Support | ❌ None | ✅ Yes | ✅ Yes |
489
- | Watch Mode | ✅ Yes | ✅ Yes | ✅ Yes |
490
- | Incremental Builds | ✅ Yes | ⚠️ Limited | ✅ Yes |
491
- | Production Ready | ⚠️ Experimental | ✅ Yes | ✅ Yes |
481
+ | Feature | tsbuild | tsup | tsdown | tsc |
482
+ |---------|---------|------|--------|-----|
483
+ | Type Checking | ✅ Full | ✅ Full | ⚠️ Via DTS only | ✅ Full |
484
+ | Bundling | ✅ esbuild | ✅ esbuild | ✅ Rolldown | ❌ N/A |
485
+ | Declaration Bundling | ✅ Custom Bundler | ✅ rollup-plugin-dts¹ | ✅ rolldown-plugin-dts | ❌ N/A |
486
+ | TC39 Decorators | ✅ Native | ✅ Native | ✅ Native | ✅ Native |
487
+ | Legacy Decorator Metadata | ✅ SWC (manual install) | ✅ SWC | ✅ SWC | ✅ Native |
488
+ | CommonJS Support | ❌ None | ✅ Yes | ✅ Yes | ✅ Yes |
489
+ | Watch Mode | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
490
+ | Incremental Builds | ✅ Yes | ⚠️ Limited | ⚠️ Limited | ✅ Yes |
491
+ | Production Ready | ⚠️ Experimental | ✅ Yes | ✅ Yes | ✅ Yes |
492
+
493
+ > ¹ tsup uses **esbuild** for JS bundling and **rollup-plugin-dts** (a Rollup plugin) for declaration bundling. `--experimental-dts` uses `@microsoft/api-extractor` instead. An optional `--treeshake` flag also delegates tree-shaking to Rollup.
492
494
 
493
495
  ## Development
494
496
 
@@ -1943,7 +1943,7 @@ var IncrementalBuildCache = class {
1943
1943
  };
1944
1944
 
1945
1945
  // src/entry-points.ts
1946
- var importConditions = ["import", "default"];
1946
+ var importConditions = ["import", "node", "module", "default"];
1947
1947
  function stemOf(filePath) {
1948
1948
  const base = filePath.split("/").at(-1) ?? "";
1949
1949
  const dot = base.indexOf(".");
@@ -1979,8 +1979,12 @@ function resolveConditionalExport(exportValue) {
1979
1979
  }
1980
1980
  for (const condition of importConditions) {
1981
1981
  const value = exportValue[condition];
1982
- if (typeof value === "string") {
1983
- return value;
1982
+ if (value === void 0) {
1983
+ continue;
1984
+ }
1985
+ const resolved = resolveConditionalExport(value);
1986
+ if (resolved !== void 0) {
1987
+ return resolved;
1984
1988
  }
1985
1989
  }
1986
1990
  return void 0;
@@ -2087,7 +2091,7 @@ var _TypeScriptProject = class _TypeScriptProject {
2087
2091
  return Files.empty(this.buildConfiguration.outDir);
2088
2092
  }
2089
2093
  async build() {
2090
- Logger.header(`\u{1F680} tsbuild v${"1.3.0"}${this.configuration.compilerOptions.incremental ? " [incremental]" : ""}`);
2094
+ Logger.header(`\u{1F680} tsbuild v${"1.3.2"}${this.configuration.compilerOptions.incremental ? " [incremental]" : ""}`);
2091
2095
  try {
2092
2096
  const processes = [];
2093
2097
  const filesWereEmitted = await this.typeCheck();
@@ -2318,7 +2322,11 @@ var _TypeScriptProject = class _TypeScriptProject {
2318
2322
  try {
2319
2323
  const pkgJson = JSON.parse(packageJsonContent);
2320
2324
  const outDir = typeScriptOptions.compilerOptions?.outDir ?? configResult.config.compilerOptions?.outDir ?? defaultOutDirectory;
2325
+ const hasExportFields = pkgJson.exports !== void 0 || pkgJson.bin !== void 0 || pkgJson.main !== void 0 || pkgJson.module !== void 0;
2321
2326
  inferredEntryPoints = inferEntryPoints(pkgJson, outDir);
2327
+ if (hasExportFields && inferredEntryPoints === void 0) {
2328
+ Logger.warn(`Could not infer entry points from package.json exports (output paths do not match outDir "${outDir}"). Add explicit entryPoints to your tsconfig.json tsbuild configuration.`);
2329
+ }
2322
2330
  } catch {
2323
2331
  }
2324
2332
  }
@@ -2385,7 +2393,7 @@ var _TypeScriptProject = class _TypeScriptProject {
2385
2393
  } else if (await Paths.isFile(resolvedPath)) {
2386
2394
  expandedEntryPoints[name] = resolvedPath;
2387
2395
  } else {
2388
- throw new ConfigurationError(`Entry point does not exist: ${entryPoint}`);
2396
+ throw new ConfigurationError(`Entry point does not exist: ${entryPoint}. Add explicit entryPoints to your tsconfig.json tsbuild configuration.`);
2389
2397
  }
2390
2398
  }
2391
2399
  return expandedEntryPoints;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TypeScriptProject
3
- } from "./3HKDLNVH.js";
3
+ } from "./QG4L36TP.js";
4
4
  import "./7FPDHUPW.js";
5
5
  export {
6
6
  TypeScriptProject
package/dist/tsbuild.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BuildError,
4
4
  TypeScriptProject
5
- } from "./3HKDLNVH.js";
5
+ } from "./QG4L36TP.js";
6
6
  import "./7FPDHUPW.js";
7
7
 
8
8
  // src/tsbuild.ts
@@ -30,7 +30,7 @@ if (help) {
30
30
  process.exit(0);
31
31
  }
32
32
  if (version) {
33
- console.log("1.3.0");
33
+ console.log("1.3.2");
34
34
  process.exit(0);
35
35
  }
36
36
  var typeScriptOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d1g1tal/tsbuild",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "packageManager": "pnpm@10.30.3",
5
5
  "description": "A fast, ESM-only TypeScript build tool combining the TypeScript API for type checking and declaration generation, esbuild for bundling, and SWC for decorator metadata.",
6
6
  "type": "module",