Skip to content

Commit

Permalink
test: add case for jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn authored and alexeagle committed Jul 11, 2022
1 parent cfeefbb commit 353ddd2
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
43 changes: 43 additions & 0 deletions examples/jsx/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
load("@aspect_bazel_lib//lib:params_file.bzl", "params_file")

ts_project(
name = "jsx",
srcs = [
"a.tsx",
"b.jsx",
],
allow_js = True,
declaration = True,
declaration_map = True,
out_dir = "out",
preserve_jsx = True,
source_map = True,
)

filegroup(
name = "types",
srcs = [":jsx"],
output_group = "types",
)

params_file(
name = "params",
data = [
":jsx",
":types",
],
args = [
"$(rootpaths :types)",
"$(rootpaths :jsx)",
],
out = "outputs.txt"
)

write_source_files(
name = "write_params",
files = {
"expected_outputs.txt": "outputs.txt",
},
)
2 changes: 2 additions & 0 deletions examples/jsx/a.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export const A = <div>a</div>
3 changes: 3 additions & 0 deletions examples/jsx/b.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


export const B = <div>b</div>
7 changes: 7 additions & 0 deletions examples/jsx/expected_outputs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
examples/jsx/out/a.d.ts
examples/jsx/out/a.d.ts.map
examples/jsx/out/b.d.ts
examples/jsx/out/b.d.ts.map
examples/jsx/out/a.jsx
examples/jsx/out/a.jsx.map
examples/jsx/out/b.jsx
9 changes: 9 additions & 0 deletions examples/jsx/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"allowJs": true,
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"jsx": "preserve"
}
}

0 comments on commit 353ddd2

Please sign in to comment.