@@ -2,33 +2,72 @@ load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")
22load ("@aspect_rules_js//npm:defs.bzl" , "npm_link_package" , "npm_package" )
33load ("@aspect_rules_ts//ts:defs.bzl" , "ts_project" )
44load ("@bazel_skylib//rules:write_file.bzl" , "write_file" )
5+ load ("@gazelle//:def.bzl" , "gazelle" , "gazelle_binary" )
56load ("@npm//:@arethetypeswrong/cli/package_json.bzl" , attw_bin = "bin" )
7+ load ("@npm//:defs.bzl" , "npm_link_all_packages" )
68load ("@npm//:mocha/package_json.bzl" , mocha_bin = "bin" )
79load ("@npm//:publint/package_json.bzl" , publint_bin = "bin" )
810load ("@npm//:typescript/package_json.bzl" , typescript_bin = "bin" )
9- load ("@npm//:defs.bzl" , "npm_link_all_packages" )
1011load ("//:tsconfig.bzl" , "BASE_COMPILER_OPTIONS" , "TSCONFIG" )
1112
1213package (default_visibility = ["//visibility:public" ])
1314
15+ # gazelle:exclude bazel-*
16+ # gazelle:exclude dist
17+ # gazelle:exclude node_modules
18+ # gazelle:exclude target
19+ # gazelle:exclude test-dist
20+ # gazelle:exclude tests
21+ # gazelle:map_kind ts_library ts_library //:ts.bzl
22+ # gazelle:map_kind ts_test ts_test //:ts.bzl
23+ # gazelle:ts_npm_link_pattern //:node_modules/{pkg}
24+
1425exports_files (["package.json" ])
1526
1627npm_link_all_packages ()
1728
29+ gazelle_binary (
30+ name = "gazelle_bin" ,
31+ languages = ["@gazelle_ts//ts" ],
32+ )
33+
34+ gazelle (
35+ name = "gazelle" ,
36+ gazelle = ":gazelle_bin" ,
37+ )
38+
1839typescript_bin .tsc_binary (name = "tsc" )
1940
2041write_file (
2142 name = "tsconfig_json" ,
2243 out = "_tsconfig.json" ,
23- content = [json .encode_indent (TSCONFIG , indent = " " ) + "\n " ],
44+ content = [json .encode_indent (
45+ TSCONFIG ,
46+ indent = " " ,
47+ ) + "\n " ],
2448)
2549
2650write_source_files (
2751 name = "tsconfig" ,
2852 files = {"tsconfig.json" : ":tsconfig_json" },
2953)
3054
31- TS_SOURCES = glob (["src/**/*.ts" ])
55+ TS_SOURCES = [
56+ "//src" ,
57+ "//src/core" ,
58+ "//src/generated" ,
59+ "//src/internal" ,
60+ "//src/internal/decoders" ,
61+ "//src/internal/utils" ,
62+ "//src/lib" ,
63+ "//src/resources" ,
64+ "//src/resources/async" ,
65+ "//src/resources/async/chat" ,
66+ "//src/resources/browser" ,
67+ "//src/resources/chat" ,
68+ "//src/resources/responses" ,
69+ ]
70+
3271TEST_SOURCES = glob (["tests/**/*.ts" ])
3372
3473ts_project (
@@ -82,10 +121,10 @@ npm_link_package(
82121
83122ts_project (
84123 name = "test_js" ,
124+ testonly = True ,
85125 srcs = TEST_SOURCES ,
86126 out_dir = "test-dist" ,
87127 root_dir = "tests" ,
88- testonly = True ,
89128 transpiler = "tsc" ,
90129 tsc = ":tsc" ,
91130 tsconfig = {
@@ -117,9 +156,9 @@ mocha_bin.mocha_test(
117156 "test-dist/**/*.test.js" ,
118157 ],
119158 data = [
159+ "tests/uploads.test.ts" ,
120160 ":node_modules/@perplexity-ai/perplexity_ai" ,
121161 ":test_js" ,
122- "tests/uploads.test.ts" ,
123162 ],
124163)
125164
0 commit comments