@d1g1tal/tsbuild 1.8.9 → 1.8.10
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/CHANGELOG.md +43 -0
- package/dist/{QXXMXCRU.js → 4JXWHUXF.js} +55 -12
- package/dist/tsbuild.js +2 -2
- package/dist/type-script-project.d.ts +18 -4
- package/dist/type-script-project.js +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
## [1.8.10](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.8.9...v1.8.10) (2026-05-23)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **cache:** fix minify state caching and rename manager interfaces (a66c98ec190b7398b2a9a81d9b02bbf36617c8e4)
|
|
6
|
+
- Added `latestFiles` field to prevent `saveMinifyState()` from overwriting concurrent build declarations
|
|
7
|
+
- Updated `save()` signature to accept and persist `minify: boolean` correctly
|
|
8
|
+
- Fixed `saveMinifyState()` to empty its Map when invalidated, avoiding stale cache writes
|
|
9
|
+
- Updated rebuild forcing logic to trigger when minify mode differs in either direction
|
|
10
|
+
- Renamed `shouldForceForMinify` to `requiresRebuild`
|
|
11
|
+
- Renamed cache types to `BuildCache` and `BuildCacheManager` for clearer API boundaries
|
|
12
|
+
- Propagated minify configuration arguments into `FileManager` and `TypeScriptProject`
|
|
13
|
+
- Added thorough regression tests for incremental cache behaviors and minify configurations
|
|
14
|
+
|
|
15
|
+
* **iife:** forward minify option to secondary esbuild call (bec434d1ab86ef2de1b3defdc2922fda9cb62890)
|
|
16
|
+
- Captured the minify option from build.initialOptions in iifePlugin
|
|
17
|
+
- Passed the minify parameter down through buildIife() hook
|
|
18
|
+
- Enabled minify inside secondary esbuild configurations when requested
|
|
19
|
+
- Added plugin tests to ensure minify toggles are correctly respected for true and false
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Miscellaneous Chores
|
|
23
|
+
|
|
24
|
+
* **ci:** Update GitHub Actions to latest version (68c227fadab5d71d40afb6c965eeb91139294261)
|
|
25
|
+
|
|
26
|
+
### Tests
|
|
27
|
+
|
|
28
|
+
* **core:** improve watch mode and fix diverse testing warnings (b30822589036113be622c655e9a8f995a0f78992)
|
|
29
|
+
- Replaced private method watch() calls with project.build() in integration tests alongside setImmediate flush
|
|
30
|
+
- Added `@d1g1tal/watchr` vi.mock stub to enable integration testing isolation
|
|
31
|
+
- Removed leftover `process.exit()` spies
|
|
32
|
+
- Improved object indexing semantics (dot vs bracket notation) safely ignoring TypeScript index issues in tsbuild.test.ts and benchmark.ts
|
|
33
|
+
- Added assertions via `.toBeDefined()` and updated mock object casting mechanisms
|
|
34
|
+
- Updated `tsconfig.json` to properly traverse and handle local `src/@types` directory
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Build System
|
|
38
|
+
|
|
39
|
+
* **deps:** update dependencies to latest (c7fc745a1f61ad92c3e9328e6e187fdbb8d29348)
|
|
40
|
+
- Updated @types/node, @typescript-eslint plugins, @vitest tools, and eslint-plugin-jsdoc to latest versions in package.json
|
|
41
|
+
- Updated object-deep-merge, postcss, and semver to their latest versions
|
|
42
|
+
- Refreshed pnpm-lock.yaml to lock all dependency updates
|
|
43
|
+
|
|
1
44
|
## [1.8.9](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.8.8...v1.8.9) (2026-05-18)
|
|
2
45
|
|
|
3
46
|
### Bug Fixes
|
|
@@ -1676,12 +1676,13 @@ function iifePlugin(options) {
|
|
|
1676
1676
|
}
|
|
1677
1677
|
build.initialOptions.write = false;
|
|
1678
1678
|
const sourcemap = build.initialOptions.sourcemap;
|
|
1679
|
+
const minify = build.initialOptions.minify;
|
|
1679
1680
|
const entryPointNames = extractEntryNames(build.initialOptions.entryPoints);
|
|
1680
1681
|
build.onEnd(async ({ outputFiles }) => {
|
|
1681
1682
|
if (!outputFiles || outputFiles.length === 0 || entryPointNames.length === 0) {
|
|
1682
1683
|
return;
|
|
1683
1684
|
}
|
|
1684
|
-
files.push(...await buildIife(outputFiles, entryPointNames, outdir, options?.globalName, sourcemap));
|
|
1685
|
+
files.push(...await buildIife(outputFiles, entryPointNames, outdir, options?.globalName, sourcemap, minify));
|
|
1685
1686
|
});
|
|
1686
1687
|
}
|
|
1687
1688
|
}
|
|
@@ -1746,7 +1747,7 @@ ${text.slice(0, exportStart)}
|
|
|
1746
1747
|
${assignment}
|
|
1747
1748
|
})();${text.slice(exportEnd)}`;
|
|
1748
1749
|
}
|
|
1749
|
-
async function buildIife(primaryOutputs, entryPointNames, outdir, globalName, sourcemap) {
|
|
1750
|
+
async function buildIife(primaryOutputs, entryPointNames, outdir, globalName, sourcemap, minify) {
|
|
1750
1751
|
const { build: esbuild } = await import("esbuild");
|
|
1751
1752
|
const fileContents = /* @__PURE__ */ new Map();
|
|
1752
1753
|
const primaryWrites = [];
|
|
@@ -1787,6 +1788,7 @@ async function buildIife(primaryOutputs, entryPointNames, outdir, globalName, so
|
|
|
1787
1788
|
splitting: false,
|
|
1788
1789
|
outdir: iifeOutdir,
|
|
1789
1790
|
sourcemap: sourcemapValue,
|
|
1791
|
+
minify,
|
|
1790
1792
|
write: false,
|
|
1791
1793
|
logLevel: "warning",
|
|
1792
1794
|
plugins
|
|
@@ -2143,17 +2145,17 @@ var FileManager = class {
|
|
|
2143
2145
|
/**
|
|
2144
2146
|
* Persists the .tsbuildinfo file and the dts cache to disk in the background. Call this
|
|
2145
2147
|
* AFTER the build's parallel phases (transpile + dts bundling) have completed so the writes
|
|
2146
|
-
* (and Brotli compression for the dts cache) don't compete with esbuild for libuv threadpool
|
|
2147
|
-
*
|
|
2148
|
+
* (and Brotli compression for the dts cache) don't compete with esbuild for libuv threadpool slots.
|
|
2149
|
+
* @param minify Whether the current build is minified, for future cache compatibility checks
|
|
2148
2150
|
*/
|
|
2149
|
-
persistCache() {
|
|
2151
|
+
persistCache(minify) {
|
|
2150
2152
|
const tasks = [];
|
|
2151
2153
|
if (this.pendingBuildInfo) {
|
|
2152
2154
|
tasks.push(Files.write(this.pendingBuildInfo.path, this.pendingBuildInfo.text));
|
|
2153
2155
|
this.pendingBuildInfo = void 0;
|
|
2154
2156
|
}
|
|
2155
2157
|
if (this.cache !== void 0 && this.hasEmittedFiles) {
|
|
2156
|
-
tasks.push(this.cache.save(this.declarationFiles));
|
|
2158
|
+
tasks.push(this.cache.save(this.declarationFiles, minify));
|
|
2157
2159
|
}
|
|
2158
2160
|
if (tasks.length === 0) {
|
|
2159
2161
|
return;
|
|
@@ -2309,8 +2311,12 @@ var IncrementalBuildCache = class _IncrementalBuildCache {
|
|
|
2309
2311
|
* subsequent in-process reads are race-free.
|
|
2310
2312
|
*/
|
|
2311
2313
|
outputsSnapshot;
|
|
2314
|
+
/** Snapshot of whether previous successful transpile output used minification. */
|
|
2315
|
+
minifySnapshot;
|
|
2312
2316
|
/** Set to true when invalidate() is called to prevent stale cache from being restored */
|
|
2313
2317
|
invalidated = false;
|
|
2318
|
+
/** Tracks the most recently saved declaration files so saveMinifyState() doesn't revert them */
|
|
2319
|
+
latestFiles;
|
|
2314
2320
|
/**
|
|
2315
2321
|
* Creates a new build cache instance and begins pre-loading the cache asynchronously.
|
|
2316
2322
|
* @param projectRoot - Root directory of the project
|
|
@@ -2323,6 +2329,7 @@ var IncrementalBuildCache = class _IncrementalBuildCache {
|
|
|
2323
2329
|
this.outputsManifestPath = Paths.join(this.cacheDirectoryPath, outputManifestFile);
|
|
2324
2330
|
this.cacheLoaded = this.loadCache();
|
|
2325
2331
|
this.outputsSnapshot = _IncrementalBuildCache.loadOutputsSync(this.outputsManifestPath);
|
|
2332
|
+
this.minifySnapshot = void 0;
|
|
2326
2333
|
}
|
|
2327
2334
|
/**
|
|
2328
2335
|
* Loads the cache file asynchronously using V8 deserialization.
|
|
@@ -2331,7 +2338,11 @@ var IncrementalBuildCache = class _IncrementalBuildCache {
|
|
|
2331
2338
|
async loadCache() {
|
|
2332
2339
|
try {
|
|
2333
2340
|
const cache = await Files.readCompressed(this.cacheFilePath);
|
|
2334
|
-
|
|
2341
|
+
if (cache.version !== dtsCacheVersion) {
|
|
2342
|
+
return void 0;
|
|
2343
|
+
}
|
|
2344
|
+
this.minifySnapshot = cache.minify;
|
|
2345
|
+
return cache;
|
|
2335
2346
|
} catch {
|
|
2336
2347
|
return void 0;
|
|
2337
2348
|
}
|
|
@@ -2359,9 +2370,13 @@ var IncrementalBuildCache = class _IncrementalBuildCache {
|
|
|
2359
2370
|
* Saves declaration files to the compressed cache file with version information.
|
|
2360
2371
|
* Uses V8 serialization for faster read performance on subsequent builds.
|
|
2361
2372
|
* @param source - The declaration files to cache
|
|
2373
|
+
* @param minify - Whether the current build is minified, for future compatibility checks
|
|
2374
|
+
* @remarks This should be called after the build completes successfully, so the cache always reflects a valid state on disk. If the build fails, the in-memory cache is still updated to reflect the latest state, but the on-disk cache remains unchanged to preserve compatibility with future builds. The next successful build will overwrite the cache with the correct state.
|
|
2362
2375
|
*/
|
|
2363
|
-
async save(source) {
|
|
2364
|
-
|
|
2376
|
+
async save(source, minify) {
|
|
2377
|
+
this.latestFiles = source;
|
|
2378
|
+
this.minifySnapshot = minify;
|
|
2379
|
+
await Files.writeCompressed(this.cacheFilePath, { version: dtsCacheVersion, files: source, minify });
|
|
2365
2380
|
}
|
|
2366
2381
|
/**
|
|
2367
2382
|
* Loads the previous build's output manifest synchronously.
|
|
@@ -2395,6 +2410,31 @@ var IncrementalBuildCache = class _IncrementalBuildCache {
|
|
|
2395
2410
|
await mkdir4(this.cacheDirectoryPath, defaultDirOptions);
|
|
2396
2411
|
await writeFile4(this.outputsManifestPath, JSON.stringify(this.outputsSnapshot), "utf8");
|
|
2397
2412
|
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Checks whether the current minify mode requires forcing a rebuild.
|
|
2415
|
+
* Forces when the minify setting differs from the previously persisted state in either direction.
|
|
2416
|
+
* Unknown previous state is treated as not-minified (safe default for pre-minify-awareness builds).
|
|
2417
|
+
* @param minify - Current build minify mode
|
|
2418
|
+
* @returns True when a full rebuild should be forced.
|
|
2419
|
+
*/
|
|
2420
|
+
async requiresRebuild(minify) {
|
|
2421
|
+
if (!this.hasPersistedState()) {
|
|
2422
|
+
return false;
|
|
2423
|
+
}
|
|
2424
|
+
return minify !== (this.minifySnapshot ?? (await this.cacheLoaded)?.minify ?? false);
|
|
2425
|
+
}
|
|
2426
|
+
/**
|
|
2427
|
+
* Persists minify mode metadata for future incremental-build compatibility checks.
|
|
2428
|
+
* @param minify - Current build minify mode
|
|
2429
|
+
*/
|
|
2430
|
+
async saveMinifyState(minify) {
|
|
2431
|
+
this.minifySnapshot = minify;
|
|
2432
|
+
if (this.latestFiles !== void 0) {
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
const files = this.invalidated ? /* @__PURE__ */ new Map() : (await this.cacheLoaded)?.files ?? /* @__PURE__ */ new Map();
|
|
2436
|
+
await Files.writeCompressed(this.cacheFilePath, { version: dtsCacheVersion, files, minify });
|
|
2437
|
+
}
|
|
2398
2438
|
/** Invalidates the build cache by removing the cache directory. */
|
|
2399
2439
|
invalidate() {
|
|
2400
2440
|
this.invalidated = true;
|
|
@@ -2650,11 +2690,12 @@ var _TypeScriptProject = class _TypeScriptProject {
|
|
|
2650
2690
|
await this.pendingStaleOutputsCleanup;
|
|
2651
2691
|
}
|
|
2652
2692
|
async build() {
|
|
2653
|
-
Logger.header(`${tsLogo} tsbuild v${"1.8.
|
|
2693
|
+
Logger.header(`${tsLogo} tsbuild v${"1.8.10"}${this.configuration.compilerOptions.incremental && this.configuration.buildCache?.isValid() ? " [incremental]" : ""}`);
|
|
2654
2694
|
try {
|
|
2655
2695
|
const processes = [];
|
|
2656
2696
|
const buildCache = this.configuration.buildCache;
|
|
2657
|
-
const
|
|
2697
|
+
const forcedForMinify = await (buildCache?.requiresRebuild(this.buildConfiguration.minify) ?? Promise.resolve(false));
|
|
2698
|
+
const force = this.configuration.tsbuild.force || forcedForMinify;
|
|
2658
2699
|
const cleanEnabled = this.configuration.clean && !this.configuration.compilerOptions.noEmit;
|
|
2659
2700
|
const useManifest = cleanEnabled && buildCache !== void 0 && buildCache.hasPersistedManifest();
|
|
2660
2701
|
const previousOutputs = useManifest ? buildCache.getPreviousOutputs() : void 0;
|
|
@@ -2687,11 +2728,13 @@ var _TypeScriptProject = class _TypeScriptProject {
|
|
|
2687
2728
|
newOutputs.push(path);
|
|
2688
2729
|
}
|
|
2689
2730
|
}
|
|
2690
|
-
this.fileManager.persistCache();
|
|
2731
|
+
this.fileManager.persistCache(this.buildConfiguration.minify);
|
|
2691
2732
|
if (buildCache !== void 0 && newOutputs.length > 0) {
|
|
2692
2733
|
if (previousOutputs !== void 0) {
|
|
2693
2734
|
this.cleanupStaleOutputs(previousOutputs, newOutputs);
|
|
2694
2735
|
}
|
|
2736
|
+
void buildCache.saveMinifyState(this.buildConfiguration.minify).catch(() => {
|
|
2737
|
+
});
|
|
2695
2738
|
void buildCache.saveOutputs(newOutputs).catch(() => {
|
|
2696
2739
|
});
|
|
2697
2740
|
}
|
package/dist/tsbuild.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BuildError,
|
|
4
4
|
TypeScriptProject
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./4JXWHUXF.js";
|
|
6
6
|
import "./QL4XMDMJ.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.8.
|
|
33
|
+
console.log("1.8.10");
|
|
34
34
|
process.exit(0);
|
|
35
35
|
}
|
|
36
36
|
var typeScriptOptions = {
|
|
@@ -53,6 +53,7 @@ type PerformanceEntryDetail<T = unknown[]> = {
|
|
|
53
53
|
message: string;
|
|
54
54
|
result?: T;
|
|
55
55
|
steps?: PerformanceSubStep[];
|
|
56
|
+
notes?: string[];
|
|
56
57
|
};
|
|
57
58
|
type DetailedPerformanceMeasureOptions<R> = Modify<PerformanceMeasureOptions, {
|
|
58
59
|
detail: PerformanceEntryDetail<R>;
|
|
@@ -202,14 +203,23 @@ type CachedDeclaration = {
|
|
|
202
203
|
/** Triple-slash file reference directives extracted during pre-processing */
|
|
203
204
|
fileReferences: ReadonlySet<string>;
|
|
204
205
|
};
|
|
206
|
+
/** Persistent cache payload stored in .tsbuild/dts_cache.v8.br */
|
|
207
|
+
type BuildCache = {
|
|
208
|
+
/** Cache format version for compatibility checking */
|
|
209
|
+
version: number;
|
|
210
|
+
/** Cached declaration files: path -> pre-processed code with extracted references */
|
|
211
|
+
files: Map<string, CachedDeclaration>;
|
|
212
|
+
/** Minify mode of the last successful JS output generation */
|
|
213
|
+
minify?: boolean;
|
|
214
|
+
};
|
|
205
215
|
/** Interface for build cache operations */
|
|
206
|
-
interface
|
|
216
|
+
interface BuildCacheManager {
|
|
207
217
|
/** Invalidates the build cache */
|
|
208
218
|
invalidate(): void;
|
|
209
219
|
/** Restores cached declaration files into the provided map */
|
|
210
220
|
restore(target: Map<string, CachedDeclaration>): Promise<void>;
|
|
211
221
|
/** Saves declaration files to the cache */
|
|
212
|
-
save(source: ReadonlyMap<string, CachedDeclaration
|
|
222
|
+
save(source: ReadonlyMap<string, CachedDeclaration>, minify: boolean): Promise<void>;
|
|
213
223
|
/** Checks if the cache is valid */
|
|
214
224
|
isValid(): boolean;
|
|
215
225
|
/** Checks if a file path is the TypeScript build info file */
|
|
@@ -222,6 +232,10 @@ interface BuildCache {
|
|
|
222
232
|
getPreviousOutputs(): readonly string[] | undefined;
|
|
223
233
|
/** Persists the project-relative output paths produced by the current build. Fire-and-forget. */
|
|
224
234
|
saveOutputs(outputs: readonly string[]): Promise<void>;
|
|
235
|
+
/** Checks whether current minify mode requires forcing a rebuild. */
|
|
236
|
+
requiresRebuild(minify: boolean): Promise<boolean>;
|
|
237
|
+
/** Persists minify mode metadata for future incremental-build compatibility checks. */
|
|
238
|
+
saveMinifyState(minify: boolean): Promise<void>;
|
|
225
239
|
}
|
|
226
240
|
type TypeScriptConfiguration = Readonly<Modify<TypeScriptOptions, {
|
|
227
241
|
clean: boolean;
|
|
@@ -234,7 +248,7 @@ type TypeScriptConfiguration = Readonly<Modify<TypeScriptOptions, {
|
|
|
234
248
|
/** Diagnostics encountered while parsing the config file */
|
|
235
249
|
configFileParsingDiagnostics: Diagnostic[];
|
|
236
250
|
/** Build cache instance for incremental builds */
|
|
237
|
-
buildCache:
|
|
251
|
+
buildCache: BuildCacheManager | undefined;
|
|
238
252
|
/** Module Specifiers in 'include', 'exclude', & 'files' */
|
|
239
253
|
include?: string[];
|
|
240
254
|
exclude?: string[];
|
|
@@ -392,4 +406,4 @@ declare class TypeScriptProject implements Closable {
|
|
|
392
406
|
}
|
|
393
407
|
|
|
394
408
|
export { Plugin, TypeScriptProject };
|
|
395
|
-
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 };
|
|
409
|
+
export type { AbsolutePath, AsyncEntryPoints, Brand, BuildCache, BuildCacheManager, 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 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d1g1tal/tsbuild",
|
|
3
3
|
"author": "D1g1talEntr0py",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.10",
|
|
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",
|
|
@@ -50,18 +50,18 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@eslint/js": "^10.0.1",
|
|
53
|
-
"@types/node": "^25.
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^8.59.
|
|
55
|
-
"@typescript-eslint/parser": "^8.59.
|
|
56
|
-
"@vitest/coverage-v8": "^4.1.
|
|
53
|
+
"@types/node": "^25.9.1",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
55
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
56
|
+
"@vitest/coverage-v8": "^4.1.7",
|
|
57
57
|
"eslint": "^10.4.0",
|
|
58
|
-
"eslint-plugin-jsdoc": "^
|
|
58
|
+
"eslint-plugin-jsdoc": "^63.0.0",
|
|
59
59
|
"fs-monkey": "^1.1.0",
|
|
60
60
|
"memfs": "^4.57.2",
|
|
61
61
|
"mitata": "^1.0.34",
|
|
62
62
|
"typescript": "^6.0.3",
|
|
63
|
-
"typescript-eslint": "^8.59.
|
|
64
|
-
"vitest": "^4.1.
|
|
63
|
+
"typescript-eslint": "^8.59.4",
|
|
64
|
+
"vitest": "^4.1.7"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"typescript": ">=5.6.3"
|