@d1g1tal/tsbuild 1.8.5 → 1.8.7

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.
@@ -113,7 +113,8 @@ var defaultEntryFile = "src/index.ts";
113
113
  var cacheDirectory = ".tsbuild";
114
114
  var buildInfoFile = "tsconfig.tsbuildinfo";
115
115
  var dtsCacheFile = "dts_cache.v8.br";
116
- var dtsCacheVersion = 2;
116
+ var outputManifestFile = "outputs.manifest.json";
117
+ var dtsCacheVersion = 4;
117
118
  var format = "esm";
118
119
  var newLine = "\n";
119
120
  var typeMatcher = /\btype\b/;
@@ -272,6 +273,7 @@ export {
272
273
  cacheDirectory,
273
274
  buildInfoFile,
274
275
  dtsCacheFile,
276
+ outputManifestFile,
275
277
  dtsCacheVersion,
276
278
  format,
277
279
  newLine,
package/dist/tsbuild.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  BuildError,
4
4
  TypeScriptProject
5
- } from "./WCBM4DJB.js";
6
- import "./JKGYA2AW.js";
5
+ } from "./GYI2SMUW.js";
6
+ import "./QL4XMDMJ.js";
7
7
 
8
8
  // src/tsbuild.ts
9
9
  import { sys } from "typescript";
@@ -30,7 +30,7 @@ if (help) {
30
30
  process.exit(0);
31
31
  }
32
32
  if (version) {
33
- console.log("1.8.5");
33
+ console.log("1.8.7");
34
34
  process.exit(0);
35
35
  }
36
36
  var typeScriptOptions = {
@@ -214,6 +214,14 @@ interface BuildCache {
214
214
  isValid(): boolean;
215
215
  /** Checks if a file path is the TypeScript build info file */
216
216
  isBuildInfoFile(filePath: AbsolutePath): boolean;
217
+ /** Synchronously checks whether persisted incremental state exists on disk (i.e. .tsbuildinfo). */
218
+ hasPersistedState(): boolean;
219
+ /** Synchronously checks whether a manifest snapshot from a prior build is available. */
220
+ hasPersistedManifest(): boolean;
221
+ /** Returns the project-relative output paths recorded by the previous build, or undefined if none. */
222
+ getPreviousOutputs(): readonly string[] | undefined;
223
+ /** Persists the project-relative output paths produced by the current build. Fire-and-forget. */
224
+ saveOutputs(outputs: readonly string[]): Promise<void>;
217
225
  }
218
226
  type TypeScriptConfiguration = Readonly<Modify<TypeScriptOptions, {
219
227
  clean: boolean;
@@ -284,6 +292,9 @@ declare class TypeScriptProject implements Closable {
284
292
  private readonly buildConfiguration;
285
293
  private readonly pendingChanges;
286
294
  private readonly buildDependencies;
295
+ private pendingStaleOutputsCleanup?;
296
+ /** Identity of the Program that populated buildDependencies — skip re-walking when unchanged */
297
+ private buildDependenciesProgram;
287
298
  private dependencyPaths?;
288
299
  /**
289
300
  * Creates a TypeScript project and prepares it for building/bundling.
@@ -296,6 +307,19 @@ declare class TypeScriptProject implements Closable {
296
307
  * @returns A promise that resolves when the cleaning is complete.
297
308
  */
298
309
  clean(): Promise<void>;
310
+ /**
311
+ * Removes outputs that the previous build wrote but the current build did not — e.g. renamed
312
+ * entry points or content-hashed chunks whose hash changed. Restricted to files under outDir
313
+ * for safety. Fire-and-forget: scheduled after build completion so it never inflates timings.
314
+ * @param previous - Project-relative paths recorded by the previous build (or undefined)
315
+ * @param current - Project-relative paths produced by the current build
316
+ */
317
+ private cleanupStaleOutputs;
318
+ /**
319
+ * Waits for fire-and-forget stale-output cleanup to settle.
320
+ * Useful for deterministic tests that need to assert post-cleanup filesystem state.
321
+ */
322
+ flushBackgroundCleanup(): Promise<void>;
299
323
  /**
300
324
  * Builds the project
301
325
  * @returns A promise that resolves when the build is complete.
@@ -346,8 +370,8 @@ declare class TypeScriptProject implements Closable {
346
370
  */
347
371
  private getEntryPoints;
348
372
  /**
349
- * Gets the project dependency paths, cached after first call.
350
- * Reads package.json and caches it for reuse.
373
+ * Gets the project dependency paths.
374
+ * The promise is started in the constructor so it overlaps with TS Program creation.
351
375
  * @returns A promise that resolves to an array of project dependency paths.
352
376
  */
353
377
  private getProjectDependencyPaths;
@@ -373,5 +397,5 @@ declare class TypeScriptProject implements Closable {
373
397
  private static elapsed;
374
398
  }
375
399
 
376
- export { TypeScriptProject };
400
+ export { Plugin, TypeScriptProject };
377
401
  export type { AbsolutePath, AsyncEntryPoints, Brand, BuildCache, BuildConfiguration, CachedDeclaration, Closable, ClosableConstructor, CompilerOptionOverrides, ConditionalPath, DetailedPerformanceEntry, DetailedPerformanceMeasureOptions, EntryPoints, EsTarget, Fn, FormatSupplier, IifeOptions, InferredFunction, JsonString, JsxRenderingMode, LogEntryType, MethodFunction, OptionalReturn, Path, Pattern, PendingFileChange, PerformanceSubStep, PluginReference, ProjectBuildConfiguration, ProjectDependencies, ReadConfigResult, RelativePath, SourceMap, TypeScriptConfiguration, TypeScriptOptions, TypedFunction, WrittenFile };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TypeScriptProject
3
- } from "./WCBM4DJB.js";
4
- import "./JKGYA2AW.js";
3
+ } from "./GYI2SMUW.js";
4
+ import "./QL4XMDMJ.js";
5
5
  export {
6
6
  TypeScriptProject
7
7
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d1g1tal/tsbuild",
3
3
  "author": "D1g1talEntr0py",
4
- "version": "1.8.5",
4
+ "version": "1.8.7",
5
5
  "license": "MIT",
6
6
  "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.",
7
7
  "homepage": "https://github.com/D1g1talEntr0py/tsbuild#readme",
@@ -51,17 +51,17 @@
51
51
  "devDependencies": {
52
52
  "@eslint/js": "^10.0.1",
53
53
  "@types/node": "^25.6.0",
54
- "@typescript-eslint/eslint-plugin": "^8.58.2",
55
- "@typescript-eslint/parser": "^8.58.2",
56
- "@vitest/coverage-v8": "^4.1.4",
57
- "eslint": "^10.2.0",
54
+ "@typescript-eslint/eslint-plugin": "^8.59.2",
55
+ "@typescript-eslint/parser": "^8.59.2",
56
+ "@vitest/coverage-v8": "^4.1.5",
57
+ "eslint": "^10.3.0",
58
58
  "eslint-plugin-jsdoc": "^62.9.0",
59
59
  "fs-monkey": "^1.1.0",
60
- "memfs": "^4.57.1",
61
- "tsx": "^4.21.0",
62
- "typescript": "^6.0.2",
63
- "typescript-eslint": "^8.58.2",
64
- "vitest": "^4.1.4"
60
+ "memfs": "^4.57.2",
61
+ "tinybench": "^6.0.1",
62
+ "typescript": "^6.0.3",
63
+ "typescript-eslint": "^8.59.2",
64
+ "vitest": "^4.1.5"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "typescript": ">=5.6.3"
@@ -79,14 +79,14 @@
79
79
  "esm"
80
80
  ],
81
81
  "scripts": {
82
- "build": "tsx ./src/tsbuild.ts",
83
- "build:watch": "tsx ./src/tsbuild.ts --watch",
84
- "bench": "tsx ./scripts/benchmark.ts",
85
- "type-check": "tsx ./src/tsbuild.ts --noEmit",
82
+ "build": "node --experimental-strip-types ./scripts/loader.ts ./src/tsbuild.ts",
83
+ "build:watch": "node --experimental-strip-types ./scripts/loader.ts ./src/tsbuild.ts --watch",
84
+ "bench": "node --experimental-strip-types ./scripts/loader.ts ./tests/scripts/benchmark.ts",
85
+ "type-check": "node --experimental-strip-types ./scripts/loader.ts ./src/tsbuild.ts --noEmit",
86
86
  "lint": "eslint ./src",
87
87
  "test": "vitest run",
88
88
  "test:coverage": "vitest run --coverage",
89
89
  "test:watch": "vitest",
90
- "test:compat": "tsx tests/scripts/test-ts-compat.ts --versions 5"
90
+ "test:compat": "node --experimental-strip-types ./scripts/loader.ts tests/scripts/test-ts-compat.ts --versions 5"
91
91
  }
92
92
  }