Skip to content

Commit 7a2e6a2

Browse files
authored
Revert "refactor: only pass --outDir flag when needed (#720)"
This reverts commit 28ea057.
1 parent a058043 commit 7a2e6a2

File tree

35 files changed

+113
-48
lines changed

35 files changed

+113
-48
lines changed

e2e/external_dep/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"composite": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

e2e/worker/composite/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"composite": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

e2e/worker/feature/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
"module": "ES2020",
55
"moduleResolution": "node",
66
"lib": ["ES2015"]
7-
}
7+
},
8+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
9+
"exclude": []
810
}

e2e/worker/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
"module": "ES2020",
44
"moduleResolution": "node",
55
"lib": ["ES2015", "DOM"]
6-
}
6+
},
7+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
8+
"exclude": []
79
}

examples/connect_node/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
"module": "ES2020",
66
// TODO: enable lib check here: repair broken type-check
77
"skipLibCheck": true
8-
}
8+
},
9+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
10+
"exclude": []
911
}

examples/custom_compiler/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55
"lib": ["ES2015", "DOM"],
66
"composite": false,
77
"experimentalDecorators": true
8-
}
8+
},
9+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
10+
"exclude": []
911
}

examples/deps_pkg/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

examples/dts_pkg/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

examples/emit_declaration_only/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"compilerOptions": {
33
"declaration": true,
44
"emitDeclarationOnly": true
5-
}
5+
},
6+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
7+
"exclude": []
68
}

examples/extends_chain/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"noImplicitAny": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

examples/isolated_declarations/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"compilerOptions": {
33
"isolatedDeclarations": true,
44
"declaration": true
5-
}
5+
},
6+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
7+
"exclude": []
68
}

examples/isolated_typecheck/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"compilerOptions": {
33
"isolatedDeclarations": true,
44
"declaration": true
5-
}
5+
},
6+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
7+
"exclude": []
68
}

examples/lib_nocompile/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

examples/linked_empty_node_modules/tsconfig.json

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/linked_lib/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

examples/linked_pkg/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"//": "the hacky path below is required because while @lib/tsconfig/tsconfig.json _will_ resolve, tsc won't follow the symlink into the virtual store so the transitive npm dep of @lib/tsconfig on @tsconfig/node18/tsconfig.json won't be resolvable",
3-
"extends": "../node_modules/.aspect_rules_js/@[email protected]/node_modules/@lib/tsconfig/tsconfig.json"
3+
"extends": "../node_modules/.aspect_rules_js/@[email protected]/node_modules/@lib/tsconfig/tsconfig.json",
4+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
5+
"exclude": []
46
}

examples/no_emit/tsconfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
3+
"exclude": [],
24
"compilerOptions": {
35
"noEmit": true
46
}

examples/output_group/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

examples/path_mappings/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
"paths": {
77
"@myorg/*": ["../*"]
88
}
9-
}
9+
},
10+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
11+
"exclude": []
1012
}

examples/project_references/lib_a/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"extends": "./tsconfig-extended.json",
33
"compilerOptions": {
44
"sourceMap": true
5-
}
5+
},
6+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
7+
"exclude": []
68
}

examples/project_references/tsconfig-base.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
"module": "commonjs",
77
"target": "ES2015",
88
"composite": true
9-
}
9+
},
10+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
11+
"exclude": []
1012
}

examples/proto_grpc/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
"module": "ES2022",
44
"moduleResolution": "node",
55
"lib": ["ES2022", "dom"]
6-
}
6+
},
7+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
8+
"exclude": []
79
}

examples/resolve_json_module/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"compilerOptions": {
33
"esModuleInterop": true,
44
"resolveJsonModule": true
5-
}
5+
},
6+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
7+
"exclude": []
68
}

examples/resolve_json_module_esm/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
"module": "esnext",
55
"moduleResolution": "node",
66
"resolveJsonModule": true
7-
}
7+
},
8+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
9+
"exclude": []
810
}

examples/root_dir/tsconfig.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
{}
1+
{
2+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
3+
"exclude": []
4+
}

examples/simple/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
"@myorg/*": ["../*"]
1010
},
1111
"types": ["node"]
12-
}
12+
},
13+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
14+
"exclude": []
1315
}
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"declaration": true
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}
+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
{}
1+
{
2+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
3+
"exclude": []
4+
}

examples/tsbuildinfo/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"compilerOptions": {
33
"composite": true,
44
"tsBuildInfoFile": "my.tsbuildinfo"
5-
}
5+
},
6+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
7+
"exclude": []
68
}
+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"extends": "@tsconfig/strictest/tsconfig.json"
2+
"extends": "@tsconfig/strictest/tsconfig.json",
3+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
4+
"exclude": []
35
}

examples/tsconfig_types/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
33
"types": ["node", "./types/typings"]
4-
}
4+
},
5+
// Workaround https://github.com/microsoft/TypeScript/issues/59036
6+
"exclude": []
57
}

ts/private/ts_project.bzl

+10-15
Original file line numberDiff line numberDiff line change
@@ -125,29 +125,24 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details.
125125
# Add user specified arguments *before* rule supplied arguments
126126
common_args.extend(ctx.attr.args)
127127

128-
if (ctx.attr.out_dir and ctx.attr.out_dir != ".") or ctx.attr.root_dir:
129-
# TODO: add validation that excludes is non-empty in this case, as passing the --outDir or --declarationDir flag
130-
# to TypeScript causes it to set a default for excludes such that it won't find our sources that were copied-to-bin.
131-
# See https://github.com/microsoft/TypeScript/issues/59036 and https://github.com/aspect-build/rules_ts/issues/644
132-
common_args.extend([
133-
"--outDir",
134-
_lib.join(ctx.label.workspace_root, ctx.label.package, ctx.attr.out_dir),
135-
])
136-
137-
if len(typings_outs) > 0:
138-
common_args.extend([
139-
"--declarationDir",
140-
_lib.join(ctx.label.workspace_root, ctx.label.package, typings_out_dir),
141-
])
142-
128+
outdir = _lib.join(
129+
ctx.label.workspace_root,
130+
_lib.join(ctx.label.package, ctx.attr.out_dir) if ctx.attr.out_dir else ctx.label.package,
131+
)
143132
tsconfig_path = to_output_relative_path(tsconfig)
144133
common_args.extend([
145134
"--project",
146135
tsconfig_path,
136+
"--outDir",
137+
outdir,
147138
"--rootDir",
148139
_lib.calculate_root_dir(ctx),
149140
])
150141

142+
if len(typings_outs) > 0:
143+
declaration_dir = _lib.join(ctx.label.workspace_root, ctx.label.package, typings_out_dir)
144+
common_args.extend(["--declarationDir", declaration_dir])
145+
151146
inputs = srcs_inputs + tsconfig_inputs
152147

153148
transitive_inputs = []

0 commit comments

Comments
 (0)