Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "refactor: only pass --outDir flag when needed" #722

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion e2e/external_dep/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"composite": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion e2e/worker/composite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"composite": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion e2e/worker/feature/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"module": "ES2020",
"moduleResolution": "node",
"lib": ["ES2015"]
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion e2e/worker/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"module": "ES2020",
"moduleResolution": "node",
"lib": ["ES2015", "DOM"]
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/connect_node/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"module": "ES2020",
// TODO: enable lib check here: repair broken type-check
"skipLibCheck": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/custom_compiler/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"lib": ["ES2015", "DOM"],
"composite": false,
"experimentalDecorators": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/deps_pkg/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/deps_pkg_transpiler/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/dts_pkg/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/emit_declaration_only/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/extends_chain/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"noImplicitAny": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/isolated_declarations/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"compilerOptions": {
"isolatedDeclarations": true,
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/isolated_typecheck/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"compilerOptions": {
"isolatedDeclarations": true,
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/lib_nocompile/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/lib_nocompile_linked/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/linked_empty_node_modules/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion examples/linked_lib/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/linked_pkg/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/linked_tsconfig_consumer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"//": "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",
"extends": "../node_modules/.aspect_rules_js/@lib+tsconfig@0.0.0/node_modules/@lib/tsconfig/tsconfig.json"
"extends": "../node_modules/.aspect_rules_js/@lib+tsconfig@0.0.0/node_modules/@lib/tsconfig/tsconfig.json",
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
2 changes: 2 additions & 0 deletions examples/no_emit/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": [],
"compilerOptions": {
"noEmit": true
}
Expand Down
4 changes: 3 additions & 1 deletion examples/output_group/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/path_mappings/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
"paths": {
"@myorg/*": ["../*"]
}
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/project_references/lib_a/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"extends": "./tsconfig-extended.json",
"compilerOptions": {
"sourceMap": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/project_references/tsconfig-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
"module": "commonjs",
"target": "ES2015",
"composite": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/proto_grpc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"module": "ES2022",
"moduleResolution": "node",
"lib": ["ES2022", "dom"]
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/resolve_json_module/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"compilerOptions": {
"esModuleInterop": true,
"resolveJsonModule": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/resolve_json_module_esm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
5 changes: 4 additions & 1 deletion examples/root_dir/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/simple/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
"@myorg/*": ["../*"]
},
"types": ["node"]
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/ts_project_dep/a/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"declaration": true
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
5 changes: 4 additions & 1 deletion examples/ts_project_dep/b/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
{}
{
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/tsbuildinfo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "my.tsbuildinfo"
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/tsconfig_external/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"extends": "@tsconfig/strictest/tsconfig.json"
"extends": "@tsconfig/strictest/tsconfig.json",
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
4 changes: 3 additions & 1 deletion examples/tsconfig_types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"types": ["node", "./types/typings"]
}
},
// Workaround https://github.com/microsoft/TypeScript/issues/59036
"exclude": []
}
25 changes: 10 additions & 15 deletions ts/private/ts_project.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,24 @@ See https://github.com/aspect-build/rules_ts/issues/361 for more details.
# Add user specified arguments *before* rule supplied arguments
common_args.extend(ctx.attr.args)

if (ctx.attr.out_dir and ctx.attr.out_dir != ".") or ctx.attr.root_dir:
# TODO: add validation that excludes is non-empty in this case, as passing the --outDir or --declarationDir flag
# to TypeScript causes it to set a default for excludes such that it won't find our sources that were copied-to-bin.
# See https://github.com/microsoft/TypeScript/issues/59036 and https://github.com/aspect-build/rules_ts/issues/644
common_args.extend([
"--outDir",
_lib.join(ctx.label.workspace_root, ctx.label.package, ctx.attr.out_dir),
])

if len(typings_outs) > 0:
common_args.extend([
"--declarationDir",
_lib.join(ctx.label.workspace_root, ctx.label.package, typings_out_dir),
])

outdir = _lib.join(
ctx.label.workspace_root,
_lib.join(ctx.label.package, ctx.attr.out_dir) if ctx.attr.out_dir else ctx.label.package,
)
tsconfig_path = to_output_relative_path(tsconfig)
common_args.extend([
"--project",
tsconfig_path,
"--outDir",
outdir,
"--rootDir",
_lib.calculate_root_dir(ctx),
])

if len(typings_outs) > 0:
declaration_dir = _lib.join(ctx.label.workspace_root, ctx.label.package, typings_out_dir)
common_args.extend(["--declarationDir", declaration_dir])

inputs = srcs_inputs + tsconfig_inputs

transitive_inputs = []
Expand Down
Loading