@d1g1tal/tsbuild 1.7.1 → 1.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [1.7.2](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.7.1...v1.7.2) (2026-04-01)
2
+
3
+ ### Bug Fixes
4
+
5
+ * resolve regex state, circular dependencies, and path handling (321769cd3bf64bb3d40e06ae3b437d121dbe3fda)
6
+ - Remove global flags from regex constants to prevent stateful matching bugs
7
+ - Update regex usage in tests and environment variable expansion to avoid index issues
8
+ - Track visited paths in declaration-bundler to prevent infinite dependency loops
9
+ - Fix file watcher ignore logic to properly match specific directories
10
+ - Fix source maps generated by decorator metadata plugin to use relative paths
11
+
12
+
13
+ ### Code Refactoring
14
+
15
+ * improve type definitions and utility names (dc21288c723217b678630371b6aacead82fef47c)
16
+ - Rename Function type to Fn to prevent conflicts with global Function type
17
+ - Rename PrettyModify type utility to Modify for concise naming
18
+ - Change typeReferences and fileReferences to ReadonlySet for better immutability guarantees
19
+ - Update DtsCompilerOptions paths array type from RelativePath to string
20
+
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * **deps:** updated dev dependencies (4137a8cc6f79110297347a02a9b9fef32e35d865)
25
+ * update dependencies and release configuration (3f19d52c7f199ddbf4afcd91a1b52d79d6c25bd3)
26
+ - Add major release trigger for breaking changes in semantic-release config
27
+ - Update eslint-plugin-jsdoc to version 62.9.0
28
+ - Update transitive dependencies in lockfile
29
+
1
30
  ## [1.7.1](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.7.0...v1.7.1) (2026-03-29)
2
31
 
3
32
  ### Code Refactoring
@@ -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";
@@ -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";
@@ -1043,6 +1043,7 @@ var DeclarationBundler = class {
1043
1043
  if (visiting.has(path)) {
1044
1044
  const cyclePath = [...visitStack.slice(visitStack.indexOf(path)), path].map((p) => Paths.relative(this.options.currentDirectory, p)).join(" -> ");
1045
1045
  Logger.warn(`Circular dependency detected: ${cyclePath}`);
1046
+ visited.add(path);
1046
1047
  return;
1047
1048
  }
1048
1049
  visiting.add(path);
@@ -2134,7 +2135,7 @@ var _TypeScriptProject = class _TypeScriptProject {
2134
2135
  return Files.empty(this.buildConfiguration.outDir);
2135
2136
  }
2136
2137
  async build() {
2137
- Logger.header(`${tsLogo} tsbuild v${"1.7.1"}${this.configuration.compilerOptions.incremental && this.configuration.buildCache?.isValid() ? " [incremental]" : ""}`);
2138
+ Logger.header(`${tsLogo} tsbuild v${"1.7.2"}${this.configuration.compilerOptions.incremental && this.configuration.buildCache?.isValid() ? " [incremental]" : ""}`);
2138
2139
  try {
2139
2140
  const processes = [];
2140
2141
  const filesWereEmitted = await this.typeCheck();
@@ -2193,7 +2194,7 @@ var _TypeScriptProject = class _TypeScriptProject {
2193
2194
  }
2194
2195
  if (this.configuration.compilerOptions.emitDecoratorMetadata) {
2195
2196
  try {
2196
- const { swcDecoratorMetadataPlugin } = await import("./GNBUFD72.js");
2197
+ const { swcDecoratorMetadataPlugin } = await import("./ZEGDBXXN.js");
2197
2198
  plugins.push(swcDecoratorMetadataPlugin);
2198
2199
  } catch {
2199
2200
  throw new ConfigurationError("emitDecoratorMetadata is enabled but @swc/core is not installed. Install it with: pnpm add -D @swc/core");
@@ -2204,9 +2205,9 @@ var _TypeScriptProject = class _TypeScriptProject {
2204
2205
  }
2205
2206
  const define = {};
2206
2207
  if (this.buildConfiguration.env !== void 0) {
2208
+ const envExpansion = new RegExp(processEnvExpansionPattern, "g");
2207
2209
  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] ?? ""));
2210
+ define[`import.meta.env.${key}`] = Json.serialize(value.replace(envExpansion, (_, envVar) => process.env[envVar] ?? ""));
2210
2211
  }
2211
2212
  }
2212
2213
  try {
@@ -2286,7 +2287,7 @@ var _TypeScriptProject = class _TypeScriptProject {
2286
2287
  }
2287
2288
  };
2288
2289
  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);
2290
+ this.fileWatcher = new Watchr(targets, { ...this.buildConfiguration.watch, ignore: (path) => pathsToIgnore.some((p) => path.includes(`/${p}/`) || path.endsWith(`/${p}`)) }, rebuild);
2290
2291
  Logger.info(`Watching for changes in: ${targets.join(", ")}`);
2291
2292
  }
2292
2293
  /** Closes the project and cleans up resources. */
@@ -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 "./NLBQBJSZ.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.2");
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 "./NLBQBJSZ.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.2",
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,16 +51,16 @@
51
51
  "devDependencies": {
52
52
  "@eslint/js": "^10.0.1",
53
53
  "@types/node": "^25.5.0",
54
- "@typescript-eslint/eslint-plugin": "^8.57.2",
55
- "@typescript-eslint/parser": "^8.57.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
57
  "eslint": "^10.1.0",
58
- "eslint-plugin-jsdoc": "^62.8.1",
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": {