@d1g1tal/tsbuild 1.7.0 → 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 +49 -0
- package/dist/{YC2FB45E.js → JKGYA2AW.js} +1 -1
- package/dist/{QNWF5BZL.js → NLBQBJSZ.js} +109 -96
- package/dist/{GNBUFD72.js → ZEGDBXXN.js} +5 -3
- package/dist/tsbuild.js +3 -3
- package/dist/{index.d.ts → type-script-project.d.ts} +14 -13
- package/dist/{index.js → type-script-project.js} +2 -2
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
|
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
|
+
|
|
30
|
+
## [1.7.1](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.7.0...v1.7.1) (2026-03-29)
|
|
31
|
+
|
|
32
|
+
### Code Refactoring
|
|
33
|
+
|
|
34
|
+
* **bundler:** remove internal index files and improve declaration bundling (0299420b919a09fab5f3988124296e8105a21c7f)
|
|
35
|
+
- Updates package.json types and exports to point to type-script-project instead of index
|
|
36
|
+
- Removes src/index.ts and src/dts/index.ts files
|
|
37
|
+
- Updates test imports to reference declaration-bundler directly instead of via index
|
|
38
|
+
- Fixes declaration bundler to gracefully handle entry points without declaration files
|
|
39
|
+
- Updates declaration bundler to ensure the output directory exists before writing
|
|
40
|
+
- Refines declaration identifier conflict mapping to use Set for finalTypeExports
|
|
41
|
+
- Updates file-manager to skip processing and writing empty declaration files
|
|
42
|
+
- Removes internal Symbol.toStringTag from FileManager
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Styles
|
|
46
|
+
|
|
47
|
+
* update editorconfig indent size to 2 (e56b2b6dc13e4b53ff064db8a8b950cc1c6b23ae)
|
|
48
|
+
- Changes indent_size from 1 to 2 in .editorconfig
|
|
49
|
+
|
|
1
50
|
## [1.7.0](https://github.com/D1g1talEntr0py/tsbuild/compare/v1.6.5...v1.7.0) (2026-03-27)
|
|
2
51
|
|
|
3
52
|
### Features
|
|
@@ -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\.([^}]+)\}
|
|
122
|
+
var processEnvExpansionPattern = /\$\{process\.env\.([^}]+)\}/;
|
|
123
123
|
|
|
124
124
|
// src/paths.ts
|
|
125
125
|
import { lstat } from "node:fs/promises";
|
|
@@ -28,74 +28,7 @@ import {
|
|
|
28
28
|
toEsTarget,
|
|
29
29
|
toJsxRenderingMode,
|
|
30
30
|
typeMatcher
|
|
31
|
-
} from "./
|
|
32
|
-
|
|
33
|
-
// src/errors.ts
|
|
34
|
-
import { SyntaxKind } from "typescript";
|
|
35
|
-
var BuildError = class extends Error {
|
|
36
|
-
/**
|
|
37
|
-
* Creates a new BuildError
|
|
38
|
-
* @param message - Error message
|
|
39
|
-
* @param code - Exit code (default: 1)
|
|
40
|
-
*/
|
|
41
|
-
constructor(message, code = 1) {
|
|
42
|
-
super(message);
|
|
43
|
-
this.code = code;
|
|
44
|
-
this.name = "BuildError";
|
|
45
|
-
Error.captureStackTrace(this, this.constructor);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var TypeCheckError = class extends BuildError {
|
|
49
|
-
/**
|
|
50
|
-
* Creates a new TypeCheckError
|
|
51
|
-
* @param message - Error message
|
|
52
|
-
* @param diagnostics - Optional TypeScript diagnostics output
|
|
53
|
-
*/
|
|
54
|
-
constructor(message, diagnostics) {
|
|
55
|
-
super(message, 1);
|
|
56
|
-
this.diagnostics = diagnostics;
|
|
57
|
-
this.name = "TypeCheckError";
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var BundleError = class extends BuildError {
|
|
61
|
-
/**
|
|
62
|
-
* Creates a new BundleError
|
|
63
|
-
* @param message - Error message
|
|
64
|
-
*/
|
|
65
|
-
constructor(message) {
|
|
66
|
-
super(message, 2);
|
|
67
|
-
this.name = "BundleError";
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
var ConfigurationError = class extends BuildError {
|
|
71
|
-
/**
|
|
72
|
-
* Creates a new ConfigurationError
|
|
73
|
-
* @param message - Error message
|
|
74
|
-
*/
|
|
75
|
-
constructor(message) {
|
|
76
|
-
super(message, 3);
|
|
77
|
-
this.name = "ConfigurationError";
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
var UnsupportedSyntaxError = class extends BundleError {
|
|
81
|
-
/**
|
|
82
|
-
* Creates an instance of UnsupportedSyntaxError.
|
|
83
|
-
* @param node The node with unsupported syntax
|
|
84
|
-
* @param message The message to display (default: 'Syntax not yet supported')
|
|
85
|
-
*/
|
|
86
|
-
constructor(node, message = "Syntax not yet supported") {
|
|
87
|
-
const syntaxKindName = SyntaxKind[node.kind] ?? `Unknown(${node.kind})`;
|
|
88
|
-
const nodeText = node.getText ? node.getText().slice(0, 100) : "<no text>";
|
|
89
|
-
super(`${message}: ${syntaxKindName} - "${nodeText}"`);
|
|
90
|
-
this.name = "UnsupportedSyntaxError";
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var castError = (exception) => {
|
|
94
|
-
if (exception instanceof Error) {
|
|
95
|
-
return exception;
|
|
96
|
-
}
|
|
97
|
-
return new Error(typeof exception === "string" ? exception : "Unknown error");
|
|
98
|
-
};
|
|
31
|
+
} from "./JKGYA2AW.js";
|
|
99
32
|
|
|
100
33
|
// src/files.ts
|
|
101
34
|
import { dirname } from "node:path";
|
|
@@ -440,6 +373,73 @@ import MagicString2 from "magic-string";
|
|
|
440
373
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
441
374
|
import { basename, posix } from "node:path";
|
|
442
375
|
|
|
376
|
+
// src/errors.ts
|
|
377
|
+
import { SyntaxKind } from "typescript";
|
|
378
|
+
var BuildError = class extends Error {
|
|
379
|
+
/**
|
|
380
|
+
* Creates a new BuildError
|
|
381
|
+
* @param message - Error message
|
|
382
|
+
* @param code - Exit code (default: 1)
|
|
383
|
+
*/
|
|
384
|
+
constructor(message, code = 1) {
|
|
385
|
+
super(message);
|
|
386
|
+
this.code = code;
|
|
387
|
+
this.name = "BuildError";
|
|
388
|
+
Error.captureStackTrace(this, this.constructor);
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
var TypeCheckError = class extends BuildError {
|
|
392
|
+
/**
|
|
393
|
+
* Creates a new TypeCheckError
|
|
394
|
+
* @param message - Error message
|
|
395
|
+
* @param diagnostics - Optional TypeScript diagnostics output
|
|
396
|
+
*/
|
|
397
|
+
constructor(message, diagnostics) {
|
|
398
|
+
super(message, 1);
|
|
399
|
+
this.diagnostics = diagnostics;
|
|
400
|
+
this.name = "TypeCheckError";
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
var BundleError = class extends BuildError {
|
|
404
|
+
/**
|
|
405
|
+
* Creates a new BundleError
|
|
406
|
+
* @param message - Error message
|
|
407
|
+
*/
|
|
408
|
+
constructor(message) {
|
|
409
|
+
super(message, 2);
|
|
410
|
+
this.name = "BundleError";
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
var ConfigurationError = class extends BuildError {
|
|
414
|
+
/**
|
|
415
|
+
* Creates a new ConfigurationError
|
|
416
|
+
* @param message - Error message
|
|
417
|
+
*/
|
|
418
|
+
constructor(message) {
|
|
419
|
+
super(message, 3);
|
|
420
|
+
this.name = "ConfigurationError";
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
var UnsupportedSyntaxError = class extends BundleError {
|
|
424
|
+
/**
|
|
425
|
+
* Creates an instance of UnsupportedSyntaxError.
|
|
426
|
+
* @param node The node with unsupported syntax
|
|
427
|
+
* @param message The message to display (default: 'Syntax not yet supported')
|
|
428
|
+
*/
|
|
429
|
+
constructor(node, message = "Syntax not yet supported") {
|
|
430
|
+
const syntaxKindName = SyntaxKind[node.kind] ?? `Unknown(${node.kind})`;
|
|
431
|
+
const nodeText = node.getText ? node.getText().slice(0, 100) : "<no text>";
|
|
432
|
+
super(`${message}: ${syntaxKindName} - "${nodeText}"`);
|
|
433
|
+
this.name = "UnsupportedSyntaxError";
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
var castError = (exception) => {
|
|
437
|
+
if (exception instanceof Error) {
|
|
438
|
+
return exception;
|
|
439
|
+
}
|
|
440
|
+
return new Error(typeof exception === "string" ? exception : "Unknown error");
|
|
441
|
+
};
|
|
442
|
+
|
|
443
443
|
// src/dts/declaration-processor.ts
|
|
444
444
|
import {
|
|
445
445
|
canHaveModifiers,
|
|
@@ -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);
|
|
@@ -1204,8 +1205,7 @@ var DeclarationBundler = class {
|
|
|
1204
1205
|
forEachChild2(sourceFile, visitQualified);
|
|
1205
1206
|
}
|
|
1206
1207
|
const finalValueExports = [...new Set(valueExports.map(exportsMapper))];
|
|
1207
|
-
const
|
|
1208
|
-
const finalTypeExports = [...new Set(typeExports.map(exportsMapper).filter((t) => !valueExportsSet.has(t)))];
|
|
1208
|
+
const finalTypeExports = [...new Set(typeExports.map(exportsMapper).filter((t) => !new Set(finalValueExports).has(t)))];
|
|
1209
1209
|
return { code: magic.toString(), externalImports, typeExports: finalTypeExports, valueExports: finalValueExports };
|
|
1210
1210
|
}
|
|
1211
1211
|
/**
|
|
@@ -1240,9 +1240,8 @@ var DeclarationBundler = class {
|
|
|
1240
1240
|
}
|
|
1241
1241
|
for (const [name, sourcesSet] of declarationSources) {
|
|
1242
1242
|
if (sourcesSet.size > 1) {
|
|
1243
|
-
const sources = Array.from(sourcesSet);
|
|
1244
1243
|
let suffix = 1;
|
|
1245
|
-
for (const modulePath of
|
|
1244
|
+
for (const modulePath of Array.from(sourcesSet).slice(1)) {
|
|
1246
1245
|
let candidate = `${name}$${suffix}`;
|
|
1247
1246
|
while (declarationSources.has(candidate)) {
|
|
1248
1247
|
candidate = `${name}$${++suffix}`;
|
|
@@ -1313,6 +1312,9 @@ var DeclarationBundler = class {
|
|
|
1313
1312
|
*/
|
|
1314
1313
|
bundle(entryPoint) {
|
|
1315
1314
|
const dtsEntryPoint = this.resolveEntryPoint(entryPoint, this.options.compilerOptions);
|
|
1315
|
+
if (dtsEntryPoint === void 0) {
|
|
1316
|
+
return "";
|
|
1317
|
+
}
|
|
1316
1318
|
const { modules, bundledSpecifiers } = this.buildModuleGraph(dtsEntryPoint);
|
|
1317
1319
|
const { code } = this.combineModules(this.sortModules(modules, dtsEntryPoint), bundledSpecifiers);
|
|
1318
1320
|
return DeclarationProcessor.postProcess(createSourceFile(dtsEntryPoint, code, ScriptTarget.Latest, true));
|
|
@@ -1325,31 +1327,38 @@ var DeclarationBundler = class {
|
|
|
1325
1327
|
*/
|
|
1326
1328
|
resolveEntryPoint(entryPoint, compilerOptions) {
|
|
1327
1329
|
const dtsEntryPoint = sys.resolvePath(entryPoint.endsWith(FileExtension.DTS) ? entryPoint : this.sourceToDeclarationPath(entryPoint));
|
|
1328
|
-
if (
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1330
|
+
if (this.declarationFiles.has(dtsEntryPoint)) {
|
|
1331
|
+
return dtsEntryPoint;
|
|
1332
|
+
}
|
|
1333
|
+
if (!entryPoint.endsWith(FileExtension.DTS)) {
|
|
1334
|
+
return void 0;
|
|
1335
|
+
}
|
|
1336
|
+
const availableFiles = Array.from(this.declarationFiles.keys());
|
|
1337
|
+
const entryPointFilename = basename(entryPoint);
|
|
1338
|
+
const similarFiles = availableFiles.filter((filePath) => filePath.includes(entryPointFilename));
|
|
1339
|
+
throw new BundleError(
|
|
1340
|
+
`Entry point declaration file not found: ${dtsEntryPoint || "unknown"}
|
|
1334
1341
|
Original entry: ${entryPoint}
|
|
1335
1342
|
Compiler options: outDir=${compilerOptions.outDir || "dist"}, rootDir=${compilerOptions.rootDir || "not set"}
|
|
1336
1343
|
Similar files found:
|
|
1337
1344
|
${similarFiles.map((f) => ` - ${f}`).join("\n")}
|
|
1338
1345
|
Total available files: ${availableFiles.length}`
|
|
1339
|
-
|
|
1340
|
-
}
|
|
1341
|
-
return dtsEntryPoint;
|
|
1346
|
+
);
|
|
1342
1347
|
}
|
|
1343
1348
|
};
|
|
1344
1349
|
async function bundleDeclarations(options) {
|
|
1345
|
-
await
|
|
1350
|
+
if (!await Files.exists(options.compilerOptions.outDir)) {
|
|
1351
|
+
await mkdir2(options.compilerOptions.outDir, defaultDirOptions);
|
|
1352
|
+
}
|
|
1346
1353
|
const dtsBundler = new DeclarationBundler(options);
|
|
1347
|
-
const bundleTasks =
|
|
1348
|
-
|
|
1354
|
+
const bundleTasks = [];
|
|
1355
|
+
for (const [entryName, entryPoint] of Object.entries(options.entryPoints)) {
|
|
1349
1356
|
const content = dtsBundler.bundle(entryPoint);
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1357
|
+
if (content.length > 0) {
|
|
1358
|
+
const outPath = Paths.join(options.compilerOptions.outDir, `${entryName}.d.ts`);
|
|
1359
|
+
bundleTasks.push(writeFile2(outPath, content, Encoding.utf8).then(() => ({ path: Paths.relative(options.currentDirectory, outPath), size: content.length })));
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1353
1362
|
const results = await Promise.all(bundleTasks);
|
|
1354
1363
|
dtsBundler.clearExternalFiles();
|
|
1355
1364
|
return results;
|
|
@@ -1785,9 +1794,11 @@ var FileManager = class {
|
|
|
1785
1794
|
}
|
|
1786
1795
|
const writeTasks = [];
|
|
1787
1796
|
for (const [filePath, { code }] of this.declarationFiles) {
|
|
1788
|
-
|
|
1797
|
+
if (code.length > 0) {
|
|
1798
|
+
writeTasks.push(this.writeFile(projectDirectory, filePath, code));
|
|
1799
|
+
}
|
|
1789
1800
|
}
|
|
1790
|
-
return Promise.all(writeTasks);
|
|
1801
|
+
return (await Promise.all(writeTasks)).filter((result) => result !== void 0);
|
|
1791
1802
|
}
|
|
1792
1803
|
/**
|
|
1793
1804
|
* Resolves entry points for declaration bundling.
|
|
@@ -1869,14 +1880,16 @@ var FileManager = class {
|
|
|
1869
1880
|
*/
|
|
1870
1881
|
processEmittedFiles() {
|
|
1871
1882
|
for (const { path, text } of this.pendingFiles) {
|
|
1872
|
-
|
|
1883
|
+
const result = DeclarationProcessor.preProcess(createSourceFile2(path, text, ScriptTarget2.Latest, true));
|
|
1884
|
+
if (result.code.length > 0) {
|
|
1885
|
+
this.declarationFiles.set(path, result);
|
|
1886
|
+
}
|
|
1873
1887
|
}
|
|
1874
1888
|
this.pendingFiles.length = 0;
|
|
1875
1889
|
}
|
|
1876
1890
|
/**
|
|
1877
1891
|
* Custom inspection method for better type representation.
|
|
1878
1892
|
* @returns The string 'FileManager'
|
|
1879
|
-
* @internal
|
|
1880
1893
|
*/
|
|
1881
1894
|
get [Symbol.toStringTag]() {
|
|
1882
1895
|
return "FileManager";
|
|
@@ -2122,7 +2135,7 @@ var _TypeScriptProject = class _TypeScriptProject {
|
|
|
2122
2135
|
return Files.empty(this.buildConfiguration.outDir);
|
|
2123
2136
|
}
|
|
2124
2137
|
async build() {
|
|
2125
|
-
Logger.header(`${tsLogo} tsbuild v${"1.7.
|
|
2138
|
+
Logger.header(`${tsLogo} tsbuild v${"1.7.2"}${this.configuration.compilerOptions.incremental && this.configuration.buildCache?.isValid() ? " [incremental]" : ""}`);
|
|
2126
2139
|
try {
|
|
2127
2140
|
const processes = [];
|
|
2128
2141
|
const filesWereEmitted = await this.typeCheck();
|
|
@@ -2181,7 +2194,7 @@ var _TypeScriptProject = class _TypeScriptProject {
|
|
|
2181
2194
|
}
|
|
2182
2195
|
if (this.configuration.compilerOptions.emitDecoratorMetadata) {
|
|
2183
2196
|
try {
|
|
2184
|
-
const { swcDecoratorMetadataPlugin } = await import("./
|
|
2197
|
+
const { swcDecoratorMetadataPlugin } = await import("./ZEGDBXXN.js");
|
|
2185
2198
|
plugins.push(swcDecoratorMetadataPlugin);
|
|
2186
2199
|
} catch {
|
|
2187
2200
|
throw new ConfigurationError("emitDecoratorMetadata is enabled but @swc/core is not installed. Install it with: pnpm add -D @swc/core");
|
|
@@ -2192,9 +2205,9 @@ var _TypeScriptProject = class _TypeScriptProject {
|
|
|
2192
2205
|
}
|
|
2193
2206
|
const define = {};
|
|
2194
2207
|
if (this.buildConfiguration.env !== void 0) {
|
|
2208
|
+
const envExpansion = new RegExp(processEnvExpansionPattern, "g");
|
|
2195
2209
|
for (const [key, value] of Object.entries(this.buildConfiguration.env)) {
|
|
2196
|
-
|
|
2197
|
-
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] ?? ""));
|
|
2198
2211
|
}
|
|
2199
2212
|
}
|
|
2200
2213
|
try {
|
|
@@ -2274,7 +2287,7 @@ var _TypeScriptProject = class _TypeScriptProject {
|
|
|
2274
2287
|
}
|
|
2275
2288
|
};
|
|
2276
2289
|
const pathsToIgnore = [...this.configuration.exclude ?? [], ...this.buildConfiguration.watch.ignore ?? []];
|
|
2277
|
-
this.fileWatcher = new Watchr(targets, { ...this.buildConfiguration.watch, ignore: (path) => pathsToIgnore.some((p) => path.
|
|
2290
|
+
this.fileWatcher = new Watchr(targets, { ...this.buildConfiguration.watch, ignore: (path) => pathsToIgnore.some((p) => path.includes(`/${p}/`) || path.endsWith(`/${p}`)) }, rebuild);
|
|
2278
2291
|
Logger.info(`Watching for changes in: ${targets.join(", ")}`);
|
|
2279
2292
|
}
|
|
2280
2293
|
/** Closes the project and cleans up resources. */
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Json,
|
|
4
4
|
Paths,
|
|
5
5
|
typeScriptExtensionExpression
|
|
6
|
-
} from "./
|
|
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
|
|
38
|
+
for (const source of map.sources) {
|
|
38
39
|
sources.push(Paths.relative(dirname(path), source));
|
|
39
40
|
}
|
|
40
|
-
|
|
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 "./
|
|
6
|
-
import "./
|
|
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.
|
|
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
|
|
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 =
|
|
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 =
|
|
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> =
|
|
57
|
+
type DetailedPerformanceMeasureOptions<R> = Modify<PerformanceMeasureOptions, {
|
|
57
58
|
detail: PerformanceEntryDetail<R>;
|
|
58
59
|
}>;
|
|
59
|
-
type DetailedPerformanceEntry<D> =
|
|
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<
|
|
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 =
|
|
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:
|
|
189
|
+
typeReferences: ReadonlySet<string>;
|
|
189
190
|
/** Triple-slash file reference directives extracted during pre-processing */
|
|
190
|
-
fileReferences:
|
|
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<
|
|
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:
|
|
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,
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d1g1tal/tsbuild",
|
|
3
3
|
"author": "D1g1talEntr0py",
|
|
4
|
-
"version": "1.7.
|
|
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",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"type": "module",
|
|
29
|
-
"types": "./dist/
|
|
29
|
+
"types": "./dist/type-script-project.d.ts",
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
-
"types": "./dist/
|
|
33
|
-
"import": "./dist/
|
|
32
|
+
"types": "./dist/type-script-project.d.ts",
|
|
33
|
+
"import": "./dist/type-script-project.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
@@ -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.
|
|
55
|
-
"@typescript-eslint/parser": "^8.
|
|
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.
|
|
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.
|
|
63
|
+
"typescript-eslint": "^8.58.0",
|
|
64
64
|
"vitest": "^4.1.2"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|