@d1g1tal/tsbuild 1.7.1 → 1.7.3

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 CHANGED
@@ -1,3 +1,50 @@
1
+ ## [1.7.3](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.7.2...v1.7.3) (2026-04-04)
2
+
3
+ ### Bug Fixes
4
+
5
+ * update esbuild and remaining dependencies (d9fd8e31d2598cc8efc657eb594cb7c8985767d8)
6
+ - update esbuild from ^0.27.4 to ^0.28.0
7
+ - update @types/node from ^25.5.0 to ^25.5.2
8
+ - update eslint from ^10.1.0 to ^10.2.0
9
+ - update pnpm-lock.yaml to reflect new dependency versions
10
+ - add stableTypeOrdering: true to tsconfig.json
11
+ - change moduleResolution: Bundler to module: preserve in tsconfig.json
12
+ - add clarifying comment about global regex usage in src/type-script-project.ts
13
+
14
+
15
+ ### Miscellaneous Chores
16
+
17
+ * **docs:** remove AI generate document unrelated to the project (3f31ad1ce93deff047a859961514e3978633fc6a)
18
+
19
+ ## [1.7.2](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.7.1...v1.7.2) (2026-04-01)
20
+
21
+ ### Bug Fixes
22
+
23
+ * resolve regex state, circular dependencies, and path handling (321769cd3bf64bb3d40e06ae3b437d121dbe3fda)
24
+ - Remove global flags from regex constants to prevent stateful matching bugs
25
+ - Update regex usage in tests and environment variable expansion to avoid index issues
26
+ - Track visited paths in declaration-bundler to prevent infinite dependency loops
27
+ - Fix file watcher ignore logic to properly match specific directories
28
+ - Fix source maps generated by decorator metadata plugin to use relative paths
29
+
30
+
31
+ ### Code Refactoring
32
+
33
+ * improve type definitions and utility names (dc21288c723217b678630371b6aacead82fef47c)
34
+ - Rename Function type to Fn to prevent conflicts with global Function type
35
+ - Rename PrettyModify type utility to Modify for concise naming
36
+ - Change typeReferences and fileReferences to ReadonlySet for better immutability guarantees
37
+ - Update DtsCompilerOptions paths array type from RelativePath to string
38
+
39
+
40
+ ### Miscellaneous Chores
41
+
42
+ * **deps:** updated dev dependencies (4137a8cc6f79110297347a02a9b9fef32e35d865)
43
+ * update dependencies and release configuration (3f19d52c7f199ddbf4afcd91a1b52d79d6c25bd3)
44
+ - Add major release trigger for breaking changes in semantic-release config
45
+ - Update eslint-plugin-jsdoc to version 62.9.0
46
+ - Update transitive dependencies in lockfile
47
+
1
48
  ## [1.7.1](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.7.0...v1.7.1) (2026-03-29)
2
49
 
3
50
  ### Code Refactoring
@@ -28,7 +28,7 @@ import {
28
28
  toEsTarget,
29
29
  toJsxRenderingMode,
30
30
  typeMatcher
31
- } from "./YC2FB45E.js";
31
+ } from "./JKGYA2AW.js";
32
32
 
33
33
  // src/files.ts
34
34
  import { dirname } from "node:path";
@@ -387,6 +387,7 @@ var BuildError = class extends Error {
387
387
  this.name = "BuildError";
388
388
  Error.captureStackTrace(this, this.constructor);
389
389
  }
390
+ code;
390
391
  };
391
392
  var TypeCheckError = class extends BuildError {
392
393
  /**
@@ -399,6 +400,7 @@ var TypeCheckError = class extends BuildError {
399
400
  this.diagnostics = diagnostics;
400
401
  this.name = "TypeCheckError";
401
402
  }
403
+ diagnostics;
402
404
  };
403
405
  var BundleError = class extends BuildError {
404
406
  /**
@@ -1043,6 +1045,7 @@ var DeclarationBundler = class {
1043
1045
  if (visiting.has(path)) {
1044
1046
  const cyclePath = [...visitStack.slice(visitStack.indexOf(path)), path].map((p) => Paths.relative(this.options.currentDirectory, p)).join(" -> ");
1045
1047
  Logger.warn(`Circular dependency detected: ${cyclePath}`);
1048
+ visited.add(path);
1046
1049
  return;
1047
1050
  }
1048
1051
  visiting.add(path);
@@ -2134,7 +2137,7 @@ var _TypeScriptProject = class _TypeScriptProject {
2134
2137
  return Files.empty(this.buildConfiguration.outDir);
2135
2138
  }
2136
2139
  async build() {
2137
- Logger.header(`${tsLogo} tsbuild v${"1.7.1"}${this.configuration.compilerOptions.incremental && this.configuration.buildCache?.isValid() ? " [incremental]" : ""}`);
2140
+ Logger.header(`${tsLogo} tsbuild v${"1.7.3"}${this.configuration.compilerOptions.incremental && this.configuration.buildCache?.isValid() ? " [incremental]" : ""}`);
2138
2141
  try {
2139
2142
  const processes = [];
2140
2143
  const filesWereEmitted = await this.typeCheck();
@@ -2193,7 +2196,7 @@ var _TypeScriptProject = class _TypeScriptProject {
2193
2196
  }
2194
2197
  if (this.configuration.compilerOptions.emitDecoratorMetadata) {
2195
2198
  try {
2196
- const { swcDecoratorMetadataPlugin } = await import("./GNBUFD72.js");
2199
+ const { swcDecoratorMetadataPlugin } = await import("./ZEGDBXXN.js");
2197
2200
  plugins.push(swcDecoratorMetadataPlugin);
2198
2201
  } catch {
2199
2202
  throw new ConfigurationError("emitDecoratorMetadata is enabled but @swc/core is not installed. Install it with: pnpm add -D @swc/core");
@@ -2204,9 +2207,9 @@ var _TypeScriptProject = class _TypeScriptProject {
2204
2207
  }
2205
2208
  const define = {};
2206
2209
  if (this.buildConfiguration.env !== void 0) {
2210
+ const envExpansion = new RegExp(processEnvExpansionPattern, "g");
2207
2211
  for (const [key, value] of Object.entries(this.buildConfiguration.env)) {
2208
- processEnvExpansionPattern.lastIndex = 0;
2209
- define[`import.meta.env.${key}`] = Json.serialize(value.replace(processEnvExpansionPattern, (_, envVar) => process.env[envVar] ?? ""));
2212
+ define[`import.meta.env.${key}`] = Json.serialize(value.replace(envExpansion, (_, envVar) => process.env[envVar] ?? ""));
2210
2213
  }
2211
2214
  }
2212
2215
  try {
@@ -2286,7 +2289,7 @@ var _TypeScriptProject = class _TypeScriptProject {
2286
2289
  }
2287
2290
  };
2288
2291
  const pathsToIgnore = [...this.configuration.exclude ?? [], ...this.buildConfiguration.watch.ignore ?? []];
2289
- this.fileWatcher = new Watchr(targets, { ...this.buildConfiguration.watch, ignore: (path) => pathsToIgnore.some((p) => path.lastIndexOf(p) > -1) }, rebuild);
2292
+ this.fileWatcher = new Watchr(targets, { ...this.buildConfiguration.watch, ignore: (path) => pathsToIgnore.some((p) => path.includes(`/${p}/`) || path.endsWith(`/${p}`)) }, rebuild);
2290
2293
  Logger.info(`Watching for changes in: ${targets.join(", ")}`);
2291
2294
  }
2292
2295
  /** Closes the project and cleans up resources. */
@@ -119,7 +119,7 @@ var newLine = "\n";
119
119
  var typeMatcher = /\btype\b/;
120
120
  var sourceScriptExtensionExpression = /(?<!\.d)\.[jt]sx?$/;
121
121
  var typeScriptExtensionExpression = /(\.tsx?)$/;
122
- var processEnvExpansionPattern = /\$\{process\.env\.([^}]+)\}/g;
122
+ var processEnvExpansionPattern = /\$\{process\.env\.([^}]+)\}/;
123
123
 
124
124
  // src/paths.ts
125
125
  import { lstat } from "node:fs/promises";
@@ -3,7 +3,7 @@ import {
3
3
  Json,
4
4
  Paths,
5
5
  typeScriptExtensionExpression
6
- } from "./YC2FB45E.js";
6
+ } from "./JKGYA2AW.js";
7
7
 
8
8
  // src/plugins/decorator-metadata.ts
9
9
  import { dirname } from "node:path";
@@ -33,11 +33,13 @@ var swcDecoratorMetadataPlugin = {
33
33
  swcTransformFile ??= (await import("@swc/core")).transformFile;
34
34
  const result = await swcTransformFile(path, swcOptions);
35
35
  if (result.map) {
36
+ const map = Json.parse(result.map);
36
37
  const sources = [];
37
- for (const source of Json.parse(result.map).sources) {
38
+ for (const source of map.sources) {
38
39
  sources.push(Paths.relative(dirname(path), source));
39
40
  }
40
- result.code += `//# sourceMappingURL=data:application/json;base64,${Buffer.from(Json.serialize({ sources })).toString(Encoding.base64)}`;
41
+ map.sources = sources;
42
+ result.code += `//# sourceMappingURL=data:application/json;base64,${Buffer.from(Json.serialize(map)).toString(Encoding.base64)}`;
41
43
  }
42
44
  return { contents: result.code };
43
45
  });
package/dist/tsbuild.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  BuildError,
4
4
  TypeScriptProject
5
- } from "./DT4U2QPA.js";
6
- import "./YC2FB45E.js";
5
+ } from "./FK6GUMLW.js";
6
+ import "./JKGYA2AW.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.7.1");
33
+ console.log("1.7.3");
34
34
  process.exit(0);
35
35
  }
36
36
  var typeScriptOptions = {
@@ -23,11 +23,12 @@ type RemoveIndex<T> = {
23
23
  [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
24
24
  };
25
25
  type PrettyModify<T, R extends Partial<Record<keyof T, unknown>>> = Prettify<Omit<T, keyof R> & R>;
26
+ type Modify<T, R extends Partial<Record<keyof T, unknown>>> = Omit<T, keyof R> & R;
26
27
  type Optional<T> = T | undefined | void;
27
28
  type OptionalReturn<T extends (...args: any[]) => any> = Optional<ReturnType<T>>;
28
- type Function<P = any, R = any> = (...args: P[]) => R;
29
+ type Fn<P = any, R = any> = (...args: P[]) => R;
29
30
  type TypedFunction<T extends (...args: any[]) => any> = (...args: Parameters<T>) => ReturnType<T>;
30
- type InferredFunction<T = Function> = T extends (...args: infer P) => infer R ? (...args: P) => R : never;
31
+ type InferredFunction<T = Fn> = T extends (...args: infer P) => infer R ? (...args: P) => R : never;
31
32
  /**
32
33
  * Type representing a method function signature with typed this, arguments, and return type.
33
34
  * Used to avoid inlining the method signature type repeatedly in decorator code.
@@ -37,7 +38,7 @@ type InferredFunction<T = Function> = T extends (...args: infer P) => infer R ?
37
38
  * @template R - The return type of the method
38
39
  */
39
40
  type MethodFunction<T = any, A extends any[] = any[], R = any> = (this: T, ...args: A) => R;
40
- type Callable = Function<never, void>;
41
+ type Callable = Fn<never, void>;
41
42
  type Constructor<P extends unknown[] = unknown[], R = unknown> = new (...args: P) => R;
42
43
  interface Closable {
43
44
  close: Callable;
@@ -53,12 +54,12 @@ type PerformanceEntryDetail<T = unknown[]> = {
53
54
  result?: T;
54
55
  steps?: PerformanceSubStep[];
55
56
  };
56
- type DetailedPerformanceMeasureOptions<R> = PrettyModify<PerformanceMeasureOptions, {
57
+ type DetailedPerformanceMeasureOptions<R> = Modify<PerformanceMeasureOptions, {
57
58
  detail: PerformanceEntryDetail<R>;
58
59
  }>;
59
- type DetailedPerformanceEntry<D> = Prettify<PerformanceEntry & {
60
+ type DetailedPerformanceEntry<D> = PerformanceEntry & {
60
61
  detail: PerformanceEntryDetail<D>;
61
- }>;
62
+ };
62
63
  type Pattern = string | RegExp;
63
64
  declare const ES_VERSIONS: readonly [6, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025];
64
65
  type EsVersion = typeof ES_VERSIONS[number];
@@ -165,13 +166,13 @@ type BuildConfiguration = PrettyModify<MarkRequired<BuildOptions, 'entryPoints'
165
166
  type EntryPoints<out T extends Path> = Record<string, T>;
166
167
  type AsyncEntryPoints = Promise<EntryPoints<AbsolutePath>>;
167
168
  /** Project build options used internally (includes values from both tsbuild config and compiler options) */
168
- type ProjectBuildConfiguration = Readonly<PrettyModify<BuildConfiguration, {
169
+ type ProjectBuildConfiguration = Readonly<Modify<BuildConfiguration, {
169
170
  entryPoints: AsyncEntryPoints;
170
171
  target: EsTarget;
171
172
  outDir: string;
172
173
  sourceMap: boolean | 'inline' | 'external' | 'both';
173
174
  }>>;
174
- type TypeScriptCompilerOptions = PrettyModify<Pick<CompilerOptions, KnownKeys<CompilerOptions>>, {
175
+ type TypeScriptCompilerOptions = Modify<Pick<CompilerOptions, KnownKeys<CompilerOptions>>, {
175
176
  target?: ScriptTarget;
176
177
  }>;
177
178
  type TypeScriptCompilerConfiguration = MarkRequired<TypeScriptCompilerOptions, 'target' | 'outDir' | 'noEmit' | 'sourceMap' | 'lib' | 'incremental' | 'tsBuildInfoFile'>;
@@ -185,9 +186,9 @@ type CachedDeclaration = {
185
186
  /** Pre-processed declaration code */
186
187
  code: string;
187
188
  /** Triple-slash type reference directives extracted during pre-processing */
188
- typeReferences: Set<string>;
189
+ typeReferences: ReadonlySet<string>;
189
190
  /** Triple-slash file reference directives extracted during pre-processing */
190
- fileReferences: Set<string>;
191
+ fileReferences: ReadonlySet<string>;
191
192
  };
192
193
  /** Interface for build cache operations */
193
194
  interface BuildCache {
@@ -202,7 +203,7 @@ interface BuildCache {
202
203
  /** Checks if a file path is the TypeScript build info file */
203
204
  isBuildInfoFile(filePath: AbsolutePath): boolean;
204
205
  }
205
- type TypeScriptConfiguration = Readonly<PrettyModify<TypeScriptOptions, {
206
+ type TypeScriptConfiguration = Readonly<Modify<TypeScriptOptions, {
206
207
  clean: boolean;
207
208
  compilerOptions: TypeScriptCompilerConfiguration;
208
209
  tsbuild: BuildConfiguration;
@@ -251,7 +252,7 @@ type CompilerOptionOverrides = Readonly<{
251
252
  }>;
252
253
  type SourceMap = {
253
254
  version: number;
254
- sources: AbsolutePath[];
255
+ sources: string[];
255
256
  names: string[];
256
257
  mappings: string;
257
258
  file?: string;
@@ -360,4 +361,4 @@ declare class TypeScriptProject implements Closable {
360
361
  }
361
362
 
362
363
  export { TypeScriptProject };
363
- export type { AbsolutePath, AsyncEntryPoints, Brand, BuildCache, BuildConfiguration, CachedDeclaration, Closable, ClosableConstructor, CompilerOptionOverrides, ConditionalPath, DetailedPerformanceEntry, DetailedPerformanceMeasureOptions, EntryPoints, EsTarget, FormatSupplier, Function, InferredFunction, JsonString, JsxRenderingMode, LogEntryType, MethodFunction, OptionalReturn, Path, Pattern, PendingFileChange, PerformanceSubStep, ProjectBuildConfiguration, ProjectDependencies, ReadConfigResult, RelativePath, SourceMap, TypeScriptConfiguration, TypeScriptOptions, TypedFunction, WrittenFile };
364
+ export type { AbsolutePath, AsyncEntryPoints, Brand, BuildCache, BuildConfiguration, CachedDeclaration, Closable, ClosableConstructor, CompilerOptionOverrides, ConditionalPath, DetailedPerformanceEntry, DetailedPerformanceMeasureOptions, EntryPoints, EsTarget, Fn, FormatSupplier, InferredFunction, JsonString, JsxRenderingMode, LogEntryType, MethodFunction, OptionalReturn, Path, Pattern, PendingFileChange, PerformanceSubStep, ProjectBuildConfiguration, ProjectDependencies, ReadConfigResult, RelativePath, SourceMap, TypeScriptConfiguration, TypeScriptOptions, TypedFunction, WrittenFile };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TypeScriptProject
3
- } from "./DT4U2QPA.js";
4
- import "./YC2FB45E.js";
3
+ } from "./FK6GUMLW.js";
4
+ import "./JKGYA2AW.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.7.1",
4
+ "version": "1.7.3",
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",
@@ -45,22 +45,22 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@d1g1tal/watchr": "^1.0.5",
48
- "esbuild": "^0.27.4",
48
+ "esbuild": "^0.28.0",
49
49
  "magic-string": "^0.30.21"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@eslint/js": "^10.0.1",
53
- "@types/node": "^25.5.0",
54
- "@typescript-eslint/eslint-plugin": "^8.57.2",
55
- "@typescript-eslint/parser": "^8.57.2",
53
+ "@types/node": "^25.5.2",
54
+ "@typescript-eslint/eslint-plugin": "^8.58.0",
55
+ "@typescript-eslint/parser": "^8.58.0",
56
56
  "@vitest/coverage-v8": "^4.1.2",
57
- "eslint": "^10.1.0",
58
- "eslint-plugin-jsdoc": "^62.8.1",
57
+ "eslint": "^10.2.0",
58
+ "eslint-plugin-jsdoc": "^62.9.0",
59
59
  "fs-monkey": "^1.1.0",
60
60
  "memfs": "^4.57.1",
61
61
  "tsx": "^4.21.0",
62
62
  "typescript": "^6.0.2",
63
- "typescript-eslint": "^8.57.2",
63
+ "typescript-eslint": "^8.58.0",
64
64
  "vitest": "^4.1.2"
65
65
  },
66
66
  "peerDependencies": {