fix(compiler): return emitted files from compilation results and align tests with emitted output handling

This commit is contained in:
2026-05-09 12:33:40 +00:00
parent 8c1805229b
commit a1960ba7cc
10 changed files with 2190 additions and 3299 deletions
+1
View File
@@ -4,6 +4,7 @@
coverage/
public/
pages/
test/assets/output/
# installs
node_modules/
+1 -1
View File
@@ -29,6 +29,6 @@
}
},
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license) file.\n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.\n\nUse of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District Court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}
+5 -5
View File
@@ -1,17 +1,17 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"fileMatch": ["/.smartconfig.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"@ship.zone/szci": {
"type": "object",
"description": "settings for npmci"
"description": "settings for szci"
},
"gitzone": {
"@git.zone/cli": {
"type": "object",
"description": "settings for gitzone",
"description": "settings for @git.zone/cli",
"properties": {
"projectType": {
"type": "string",
+8
View File
@@ -1,5 +1,13 @@
# Changelog
## 2026-05-09 - 4.4.1 - fix(compiler)
return emitted files from compilation results and align tests with emitted output handling
- enable TypeScript's emitted file listing during compilation so compile results include emittedFiles
- update tests to assert emitted output from compileFilesOrThrow and compileGlob
- simplify test glob inputs and ignore generated test output directories
- refresh dependency versions and CLI examples in documentation
## 2026-03-24 - 4.4.0 - feat(config)
add smartconfig metadata and update TypeScript build configuration docs
+11 -11
View File
@@ -36,21 +36,21 @@
},
"homepage": "https://code.foss.global/git.zone/tsbuild#README",
"dependencies": {
"@git.zone/tspublish": "^1.11.3",
"@git.zone/tspublish": "^1.11.6",
"@push.rocks/early": "^4.0.4",
"@push.rocks/smartcli": "^4.0.20",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile": "^13.1.2",
"@push.rocks/smartfs": "^1.5.0",
"@push.rocks/smartlog": "^3.2.1",
"@push.rocks/smartcli": "^4.0.21",
"@push.rocks/smartdelay": "^3.1.0",
"@push.rocks/smartfile": "^13.1.3",
"@push.rocks/smartfs": "^1.5.1",
"@push.rocks/smartlog": "^3.2.2",
"@push.rocks/smartpath": "^6.0.0",
"@push.rocks/smartpromise": "^4.2.3",
"typescript": "^6.0.2"
"@push.rocks/smartpromise": "^4.2.4",
"typescript": "^6.0.3"
},
"devDependencies": {
"@git.zone/tsrun": "^2.0.1",
"@git.zone/tstest": "^3.5.1",
"@types/node": "^25.5.0"
"@git.zone/tsrun": "^2.0.3",
"@git.zone/tstest": "^3.6.5",
"@types/node": "^25.6.2"
},
"files": [
"ts/**/*",
+2117 -3240
View File
File diff suppressed because it is too large Load Diff
+33 -33
View File
@@ -9,11 +9,7 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
## Install
```bash
# Using pnpm (recommended)
pnpm install @git.zone/tsbuild --save-dev
# Using npm
npm install @git.zone/tsbuild --save-dev
pnpm add --save-dev @git.zone/tsbuild
```
## Why tsbuild?
@@ -38,13 +34,13 @@ npm install @git.zone/tsbuild --save-dev
**Compile your TypeScript project:**
```bash
npx tsbuild
pnpm exec tsbuild
```
Compiles `./ts/**/*.ts` to `./dist_ts/`
**Custom directories:**
```bash
npx tsbuild custom src utils
pnpm exec tsbuild custom src utils
```
Compiles:
- `./src/**/*.ts` -> `./dist_src/`
@@ -52,7 +48,7 @@ Compiles:
**Auto-discover and compile in dependency order:**
```bash
npx tsbuild tsfolders
pnpm exec tsbuild tsfolders
```
Finds all `ts_*` folders and compiles them respecting dependencies.
@@ -103,7 +99,7 @@ await compiler.compileGlob({
### 1. Default Build
```bash
npx tsbuild [options]
pnpm exec tsbuild [options]
```
Compiles all TypeScript files from `./ts/` to `./dist_ts/`
@@ -121,39 +117,39 @@ Compiles all TypeScript files from `./ts/` to `./dist_ts/`
**Examples:**
```bash
# Standard build
npx tsbuild
pnpm exec tsbuild
# Build with JSON output for CI
npx tsbuild --json --quiet
pnpm exec tsbuild --json --quiet
# CommonJS build
npx tsbuild --commonjs
pnpm exec tsbuild --commonjs
# Strict mode
npx tsbuild --disallowimplicitany
pnpm exec tsbuild --disallowimplicitany
```
### 2. Custom Directories
```bash
npx tsbuild custom <dir1> <dir2> ... [options]
pnpm exec tsbuild custom <dir1> <dir2> ... [options]
```
Compile specific directories to their corresponding `dist_` folders.
```bash
# Compile src and utils
npx tsbuild custom src utils
pnpm exec tsbuild custom src utils
# Creates: ./dist_src/ and ./dist_utils/
# Multiple directories with options
npx tsbuild custom api models services --commonjs
pnpm exec tsbuild custom api models services --commonjs
```
### 3. TSFolders (Dependency-Aware)
```bash
npx tsbuild tsfolders [options]
pnpm exec tsbuild tsfolders [options]
```
Automatically discovers and compiles all `ts_*` folders in dependency order:
@@ -176,17 +172,17 @@ TypeScript Folder Compilation Plan (5 folders)
### 4. Emit Check
```bash
npx tsbuild emitcheck <file_or_pattern> [more...] [options]
pnpm exec tsbuild emitcheck <file_or_pattern> [more...] [options]
```
Validates TypeScript files can be compiled without actually emitting them.
```bash
# Check specific files
npx tsbuild emitcheck src/main.ts src/utils.ts
pnpm exec tsbuild emitcheck src/main.ts src/utils.ts
# Check with glob patterns
npx tsbuild emitcheck "src/**/*.ts" "test/**/*.ts"
pnpm exec tsbuild emitcheck "src/**/*.ts" "test/**/*.ts"
```
**Exit codes:**
@@ -196,15 +192,15 @@ npx tsbuild emitcheck "src/**/*.ts" "test/**/*.ts"
### 5. Type Check
```bash
npx tsbuild check [pattern] [more...] [options]
pnpm exec tsbuild check [pattern] [more...] [options]
```
Performs type checking without emitting files.
**With arguments:** Check specified files/patterns
```bash
npx tsbuild check "ts/**/*.ts"
npx tsbuild check "src/**/*.ts" "test/**/*.ts"
pnpm exec tsbuild check "ts/**/*.ts"
pnpm exec tsbuild check "src/**/*.ts" "test/**/*.ts"
```
**Without arguments:** Two-phase default check
@@ -212,7 +208,7 @@ npx tsbuild check "src/**/*.ts" "test/**/*.ts"
2. Phase 2: Type check `test/**/*` (relaxed, skipLibCheck: true)
```bash
npx tsbuild check
pnpm exec tsbuild check
# Running default type checking sequence...
# Checking ts/**/* files...
# Checking test/**/* files with --skiplibcheck...
@@ -549,14 +545,16 @@ Each `ts_*` folder can contain its own `tspublish.json` to configure compilation
#### tspublish.json Configuration
Create a `tspublish.json` in each `ts_*` folder:
Create a `tspublish.json` in each publishable `ts_*` folder. `@git.zone/tspublish` expects publishing fields, while tsbuild additionally reads `order` and `unpack` for build ordering and output flattening:
```json
{
"name": "@myorg/core",
"order": 3,
"unpack": true,
"dependencies": ["ts_interfaces", "ts_shared"]
"dependencies": ["@myorg/interfaces", "@myorg/shared"],
"registries": ["useBase"],
"bin": []
}
```
@@ -565,14 +563,16 @@ Create a `tspublish.json` in each `ts_*` folder:
| `name` | string | -- | Package name for publishing |
| `order` | number | `Infinity` | Build sequence (lower builds first) |
| `unpack` | boolean | `true` | Flatten nested output directories |
| `dependencies` | string[] | -- | Monorepo dependencies to bundle |
| `dependencies` | string[] | `[]` | Published package dependencies resolved from the monorepo `package.json` |
| `registries` | string[] | -- | Publish registries, for example `useBase` to read `.smartconfig.json` |
| `bin` | string[] | `[]` | CLI binary names generated by `@git.zone/tspublish` |
#### Build Order
The `tsfolders` command respects the `order` property:
```bash
npx tsbuild tsfolders
pnpm exec tsbuild tsfolders
```
**Default ordering (without tspublish.json):**
@@ -680,14 +680,14 @@ jobs:
with:
node-version: '22'
- run: npm install
- run: npx tsbuild
- run: pnpm install
- run: pnpm exec tsbuild
```
### JSON Output
```bash
npx tsbuild --json --quiet
pnpm exec tsbuild --json --quiet
```
```json
@@ -739,14 +739,14 @@ Ensure your tsconfig.json has:
Use `--skiplibcheck` to skip declaration file checking:
```bash
npx tsbuild --skiplibcheck
pnpm exec tsbuild --skiplibcheck
```
Only use this if you trust your dependencies' type definitions.
## License and Legal Information
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./license) file.
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license) file.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
+6 -4
View File
@@ -5,17 +5,19 @@ import { TsCompiler } from '../ts/index.js';
const assetfiles: string[] = ['./test/assets/tocompile.ts', './test/assets/tocompile2.ts'];
const assetfiles2 = {
'./test/assets/**/!(*.d.ts|*.js|output)': './test/assets/output',
'./test/assets/tocompile*.ts': './test/assets/output',
};
tap.test('should compile files from an array', async () => {
const compiler = new TsCompiler();
await compiler.compileFilesOrThrow(assetfiles, { outDir: './test/assets/output' });
const emittedFiles = await compiler.compileFilesOrThrow(assetfiles, { outDir: './test/assets/output' });
expect(emittedFiles.length).toBeGreaterThan(0);
});
tap.test('should compile files from glob pattern object', async () => {
const compiler = new TsCompiler();
await compiler.compileGlob(assetfiles2);
const result = await compiler.compileGlob(assetfiles2);
expect(result.emittedFiles.length).toBeGreaterThan(0);
});
tap.start();
export default tap.start();
+1 -1
View File
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tsbuild',
version: '4.4.0',
version: '4.4.1',
description: 'A tool for compiling TypeScript files using the latest nightly features, offering flexible APIs and a CLI for streamlined development.'
}
+4 -1
View File
@@ -197,7 +197,10 @@ export class TsCompiler {
customOptions: CompilerOptions = {},
taskInfo?: ITaskInfo
): Promise<ICompileResult> {
const options = this.createOptions(customOptions);
const options = {
...this.createOptions(customOptions),
listEmittedFiles: true,
};
if (options.skipLibCheck) {
await this.handleSkipLibCheckWarning();