Skip to content

Commit 6304cdf

Browse files
committed
cp: migrate action.js to TS
1 parent ae325d7 commit 6304cdf

8 files changed

Lines changed: 1575 additions & 1379 deletions

File tree

javascript/atoms/BUILD.bazel

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ filegroup(
2323

2424
closure_js_library(
2525
name = "action",
26-
srcs = ["action.js"],
26+
srcs = [":generate_action_shim"],
2727
suppress = [
2828
"JSC_IMPLICITLY_NULLABLE_JSDOC",
2929
"JSC_INEXISTENT_PROPERTY",
@@ -182,7 +182,7 @@ closure_js_library(
182182

183183
closure_js_library(
184184
name = "frame",
185-
srcs = ["frame.js"],
185+
srcs = [":generate_frame_shim"],
186186
suppress = [
187187
"JSC_IMPLICITLY_NULLABLE_JSDOC",
188188
"JSC_UNKNOWN_EXPR_TYPE",
@@ -307,18 +307,21 @@ closure_js_library(
307307
closure_js_library(
308308
name = "window",
309309
srcs = [
310-
"frame.js",
311-
"window.js",
310+
":generate_frame_shim",
311+
":generate_window_shim",
312312
],
313313
suppress = [
314+
"JSC_UNKNOWN_EXPR_TYPE",
314315
"JSC_USE_OF_GOOG_PROVIDE",
315316
],
316317
deps = [
317318
":bot",
319+
":dom",
318320
":errors",
319321
":events",
320322
":json",
321323
":locators",
324+
":useragent",
322325
],
323326
)
324327

@@ -409,13 +412,15 @@ js_binary(
409412
ts_project(
410413
name = "errors_ts",
411414
srcs = [
415+
"action.ts",
412416
"bot.ts",
413417
"color.ts",
414418
"device.ts",
415419
"dom.ts",
416420
"domcore.ts",
417421
"error.ts",
418422
"events.ts",
423+
"frame.ts",
419424
"inject.ts",
420425
"json.ts",
421426
"keyboard.ts",
@@ -432,6 +437,7 @@ ts_project(
432437
"response.ts",
433438
"touchscreen.ts",
434439
"userAgent.ts",
440+
"window.ts",
435441
],
436442
declaration = True,
437443
declaration_map = True,
@@ -700,6 +706,63 @@ js_run_binary(
700706
tool = ":shim_generator",
701707
)
702708

709+
# ----------------------------------------------------------------------------
710+
# frame.ts - Frame utilities shim generation
711+
# Note: frame.ts is compiled as part of errors_ts
712+
# ----------------------------------------------------------------------------
713+
js_run_binary(
714+
name = "generate_frame_shim",
715+
srcs = [
716+
"dist/frame.js",
717+
"frame.ts",
718+
],
719+
args = [
720+
"$(location frame.ts)",
721+
"bot.frame",
722+
"$(location dist/frame.js)",
723+
],
724+
stdout = "frame.js",
725+
tool = ":shim_generator",
726+
)
727+
728+
# ----------------------------------------------------------------------------
729+
# window.ts - Window utilities shim generation
730+
# Note: window.ts is compiled as part of errors_ts
731+
# ----------------------------------------------------------------------------
732+
js_run_binary(
733+
name = "generate_window_shim",
734+
srcs = [
735+
"dist/window.js",
736+
"window.ts",
737+
],
738+
args = [
739+
"$(location window.ts)",
740+
"bot.window",
741+
"$(location dist/window.js)",
742+
],
743+
stdout = "window.js",
744+
tool = ":shim_generator",
745+
)
746+
747+
# ----------------------------------------------------------------------------
748+
# action.ts - Action utilities shim generation
749+
# Note: action.ts is compiled as part of errors_ts
750+
# ----------------------------------------------------------------------------
751+
js_run_binary(
752+
name = "generate_action_shim",
753+
srcs = [
754+
"action.ts",
755+
"dist/action.js",
756+
],
757+
args = [
758+
"$(location action.ts)",
759+
"bot.action",
760+
"$(location dist/action.js)",
761+
],
762+
stdout = "action.js",
763+
tool = ":shim_generator",
764+
)
765+
703766
# ----------------------------------------------------------------------------
704767
# Locator modules - TypeScript to Closure shim generation
705768
# ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)