Skip to content

Commit 7157ab9

Browse files
committed
feat(ts_library): bump default target to es2015
Closes bazel-contrib#217 PiperOrigin-RevId: 226071736
1 parent de0a479 commit 7157ab9

File tree

6 files changed

+23
-34
lines changed

6 files changed

+23
-34
lines changed

third_party/github.com/bazelbuild/rules_typescript/examples/devmode_consumer/BUILD.bazel

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
load(":es5_consumer.bzl", "es5_consumer")
2+
3+
es5_consumer(
4+
name = "es5_output",
5+
deps = ["//examples:bar_ts_library"],
6+
)
7+
8+
sh_test(
9+
name = "es5_output_test",
10+
srcs = ["es5_output_test.sh"],
11+
data = [
12+
":es5_output",
13+
"@bazel_tools//tools/bash/runfiles",
14+
],
15+
)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
"""Example of a rule that requires es2015 (devmode) inputs.
15+
"""Example of a rule that requires ES5 (devmode) inputs.
1616
"""
1717

1818
load("@build_bazel_rules_nodejs//internal:node.bzl", "sources_aspect")
1919

20-
def _devmode_consumer(ctx):
20+
def _es5_consumer(ctx):
2121
files = depset()
2222

2323
# Since we apply the sources_aspect to our deps below, we can iterate through
@@ -32,8 +32,8 @@ def _devmode_consumer(ctx):
3232
runfiles = ctx.runfiles(files.to_list()),
3333
)]
3434

35-
devmode_consumer = rule(
36-
implementation = _devmode_consumer,
35+
es5_consumer = rule(
36+
implementation = _es5_consumer,
3737
attrs = {
3838
"deps": attr.label_list(aspects = [sources_aspect]),
3939
},
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,3 @@ if [[ "$FOO_JS" != *"define(\"build_bazel_rules_typescript/examples/foo\""* ]];
7979
echo "$FOO_JS"
8080
exit 1
8181
fi
82-
83-
# should produce es2015 classes
84-
if [[ "$FOO_JS" != *"class Greeter"* ]]; then
85-
echo "Expected foo.js produce a es2015, but was"
86-
echo "$FOO_JS"
87-
exit 1
88-
fi

third_party/github.com/bazelbuild/rules_typescript/examples/googmodule/BUILD.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ ts_library(
66
tsconfig = "tsconfig.json",
77
)
88

9-
load("//examples/devmode_consumer:devmode_consumer.bzl", "devmode_consumer")
9+
load("//examples/es5_output:es5_consumer.bzl", "es5_consumer")
1010

11-
devmode_consumer(
12-
name = "devmode_output",
11+
es5_consumer(
12+
name = "es5_output",
1313
deps = [":googmodule"],
1414
)
1515

@@ -19,7 +19,7 @@ jasmine_node_test(
1919
name = "googmodule_output_test",
2020
srcs = ["googmodule_output_test.js"],
2121
data = [
22-
":devmode_output",
22+
":es5_output",
2323
"@npm//jasmine",
2424
],
2525
)

third_party/github.com/bazelbuild/rules_typescript/internal/build_defs.bzl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,6 @@ def tsc_wrapped_tsconfig(
187187
)
188188
config["bazelOptions"]["nodeModulesPrefix"] = node_modules_root
189189

190-
# Override the target so we use es2015 for devmode
191-
# Since g3 isn't ready to do this yet
192-
config["compilerOptions"]["target"] = "es2015"
193-
194190
# If the user gives a tsconfig attribute, the generated file should extend
195191
# from the user's tsconfig.
196192
# See https://github.com/Microsoft/TypeScript/issues/9876

0 commit comments

Comments
 (0)