├── .aspect ├── bazelrc │ ├── .gitignore │ ├── BUILD.bazel │ ├── bazel7.bazelrc │ ├── ci.bazelrc │ ├── convenience.bazelrc │ ├── correctness.bazelrc │ ├── debug.bazelrc │ ├── javascript.bazelrc │ └── performance.bazelrc ├── cli │ └── config.yaml └── workflows │ ├── BUILD.bazel │ ├── bazelrc │ └── config.yaml ├── .bazelignore ├── .bazeliskrc ├── .bazelrc ├── .bazelversion ├── .bcr ├── metadata.template.json ├── presubmit.yml └── source.template.json ├── .gitattributes ├── .github └── workflows │ ├── BUILD.bazel │ ├── bazel6.bazelrc │ ├── bazel7.bazelrc │ ├── buildifier.yaml │ ├── ci.bazelrc │ ├── ci.yaml │ ├── mirror.yml │ ├── publish.yaml │ ├── release.yml │ └── release_prep.sh ├── .gitignore ├── .npmrc ├── .pre-commit-config.yaml ├── .prettierignore ├── .prettierrc ├── .vscode └── launch.json ├── BUILD.bazel ├── CONTRIBUTING.md ├── LICENSE ├── MODULE.bazel ├── README.md ├── WORKSPACE ├── WORKSPACE.bzlmod ├── docs ├── .bazelrc ├── .bazelversion ├── BUILD.bazel ├── MODULE.bazel ├── performance.md ├── proto.md ├── repositories.md ├── rules.md ├── transpiler.md ├── troubleshooting.md └── tsconfig.md ├── e2e ├── bzlmod │ ├── .bazelignore │ ├── .bazelrc │ ├── .bazelversion │ ├── .npmrc │ ├── BUILD │ ├── MODULE.bazel │ ├── WORKSPACE │ ├── foo.proto │ ├── foo.ts │ ├── package.json │ ├── pnpm-lock.yaml │ └── tsconfig.json ├── external_dep │ ├── .bazelignore │ ├── .bazelrc │ ├── .bazelversion │ ├── .npmrc │ ├── BUILD │ ├── MODULE.bazel │ ├── WORKSPACE │ ├── WORKSPACE.bzlmod │ ├── app │ │ ├── .bazelignore │ │ ├── .bazelrc │ │ ├── .bazelversion │ │ ├── .npmrc │ │ ├── BUILD │ │ ├── MODULE.bazel │ │ ├── WORKSPACE │ │ ├── WORKSPACE.bzlmod │ │ ├── package.json │ │ └── pnpm-lock.yaml │ ├── lib.ts │ ├── package.json │ ├── pnpm-lock.yaml │ ├── sub_external │ │ ├── .bazelrc │ │ ├── BUILD.bazel │ │ ├── MODULE.bazel │ │ ├── WORKSPACE │ │ ├── WORKSPACE.bzlmod │ │ ├── asset.json │ │ ├── sub-lib.ts │ │ ├── subdir │ │ │ ├── BUILD.bazel │ │ │ ├── asset.json │ │ │ ├── sub-lib.ts │ │ │ └── tsconfig.json │ │ ├── ts.bzl │ │ └── tsconfig.json │ └── tsconfig.json ├── test │ ├── 3p_deps.bats │ ├── common.bats │ ├── diagnostics.bats │ ├── emit_cache.bats │ ├── invalidation.bats │ ├── isolated_modules.bats │ ├── source_maps.bats │ ├── strategy.bats │ ├── third_party_deps.bats │ ├── tracing_and_performance.bats │ └── validation.bats ├── worker │ ├── .bazelignore │ ├── .bazelrc │ ├── .bazelversion │ ├── .npmrc │ ├── BUILD │ ├── MODULE.bazel │ ├── WORKSPACE │ ├── WORKSPACE.bzlmod │ ├── composite │ │ ├── BUILD.bazel │ │ ├── a │ │ │ ├── BUILD.bazel │ │ │ └── index.ts │ │ ├── b │ │ │ ├── BUILD.bazel │ │ │ └── index.ts │ │ ├── index.ts │ │ └── tsconfig.json │ ├── feature │ │ ├── BUILD │ │ ├── index.ts │ │ ├── sub │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── feature1 │ │ ├── BUILD │ │ └── index.ts │ ├── feature2 │ │ ├── BUILD │ │ └── index.ts │ ├── feature3 │ │ ├── BUILD │ │ └── index.ts │ ├── feature4 │ │ ├── BUILD │ │ ├── helper │ │ │ ├── BUILD │ │ │ ├── helper.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── src │ │ │ ├── logic1.ts │ │ │ ├── logic2.ts │ │ │ └── logic3 │ │ │ │ ├── BUILD │ │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── lib.ts │ ├── main.ts │ ├── package.json │ ├── pnpm-lock.yaml │ ├── pnpm-workspace.yaml │ └── tsconfig.json └── workspace │ ├── .bazelignore │ ├── .bazelrc │ ├── .bazelversion │ ├── .npmrc │ ├── BUILD │ ├── WORKSPACE │ ├── foo.ts │ ├── package.json │ └── tsconfig.json ├── renovate.json ├── tools ├── BUILD.bazel └── noop.sh └── ts ├── BUILD.bazel ├── BUILD.typescript ├── defs.bzl ├── extensions.bzl ├── private ├── BUILD.bazel ├── build_test.bzl ├── mirror_versions.sh ├── npm_repositories.bzl ├── options.bzl ├── ts_config.bzl ├── ts_lib.bzl ├── ts_project.bzl ├── ts_project_options_validator.cjs ├── ts_project_worker.js ├── ts_proto_library.bzl ├── ts_validate_options.bzl └── versions.bzl ├── proto.bzl ├── repositories.bzl └── test ├── BUILD.bazel ├── flags_test.bzl ├── mock_transpiler.bzl ├── transpiler_tests.bzl ├── ts_config_test.bzl ├── ts_project_test.bzl ├── ts_project_worker ├── BUILD.bazel ├── fstree.test.js ├── mock.js └── oom.test.js ├── ts_proto_library ├── BUILD.bazel ├── bar.proto └── foo.proto └── ts_proto_library_test.bzl /.aspect/bazelrc/.gitignore: -------------------------------------------------------------------------------- 1 | user.bazelrc -------------------------------------------------------------------------------- /.aspect/bazelrc/BUILD.bazel: -------------------------------------------------------------------------------- 1 | "Aspect bazelrc presets; see https://docs.aspect.build/guides/bazelrc" 2 | 3 | load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets") 4 | 5 | write_aspect_bazelrc_presets( 6 | name = "update_aspect_bazelrc_presets", 7 | presets = [ 8 | "ci", 9 | "convenience", 10 | "correctness", 11 | "debug", 12 | "javascript", 13 | "performance", 14 | ], 15 | ) 16 | -------------------------------------------------------------------------------- /.aspect/bazelrc/bazel7.bazelrc: -------------------------------------------------------------------------------- 1 | ../../.github/workflows/bazel7.bazelrc -------------------------------------------------------------------------------- /.aspect/bazelrc/ci.bazelrc: -------------------------------------------------------------------------------- 1 | # Set this flag to enable re-tries of failed tests on CI. 2 | # When any test target fails, try one or more times. This applies regardless of whether the "flaky" 3 | # tag appears on the target definition. 4 | # This is a tradeoff: legitimately failing tests will take longer to report, 5 | # but we can paper over flaky tests that pass most of the time. 6 | # The alternative is to mark every flaky test with the `flaky = True` attribute, but this requires 7 | # the buildcop to make frequent code edits. 8 | # Not recommended for local builds so that the flakiness is observed during development and thus 9 | # is more likely to get fixed. 10 | # Note that when passing after the first attempt, Bazel will give a special "FLAKY" status. 11 | # Docs: https://bazel.build/docs/user-manual#flaky-test-attempts 12 | test --flaky_test_attempts=2 13 | 14 | # Announce all announces command options read from the bazelrc file(s) when starting up at the 15 | # beginning of each Bazel invocation. This is very useful on CI to be able to inspect what Bazel rc 16 | # settings are being applied on each run. 17 | # Docs: https://bazel.build/docs/user-manual#announce-rc 18 | build --announce_rc 19 | 20 | # Add a timestamp to each message generated by Bazel specifying the time at which the message was 21 | # displayed. 22 | # Docs: https://bazel.build/docs/user-manual#show-timestamps 23 | build --show_timestamps 24 | 25 | # Only show progress every 60 seconds on CI. 26 | # We want to find a compromise between printing often enough to show that the build isn't stuck, 27 | # but not so often that we produce a long log file that requires a lot of scrolling. 28 | # https://bazel.build/reference/command-line-reference#flag--show_progress_rate_limit 29 | build --show_progress_rate_limit=60 30 | 31 | # Use cursor controls in screen output. 32 | # Docs: https://bazel.build/docs/user-manual#curses 33 | build --curses=yes 34 | 35 | # Use colors to highlight output on the screen. Set to `no` if your CI does not display colors. 36 | # Docs: https://bazel.build/docs/user-manual#color 37 | build --color=yes 38 | 39 | # The terminal width in columns. Configure this to override the default value based on what your CI system renders. 40 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/runtime/UiOptions.java#L151 41 | build --terminal_columns=143 42 | 43 | ###################################### 44 | # Generic remote cache configuration # 45 | ###################################### 46 | 47 | # Only download remote outputs of top level targets to the local machine. 48 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_download_toplevel 49 | build --remote_download_toplevel 50 | 51 | # The maximum amount of time to wait for remote execution and cache calls. 52 | # https://bazel.build/reference/command-line-reference#flag--remote_timeout 53 | build --remote_timeout=3600 54 | 55 | # Upload locally executed action results to the remote cache. 56 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results 57 | build --remote_upload_local_results 58 | 59 | # Fall back to standalone local execution strategy if remote execution fails. If the grpc remote 60 | # cache connection fails, it will fail the build, add this so it falls back to the local cache. 61 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_local_fallback 62 | build --remote_local_fallback 63 | 64 | # Fixes builds hanging on CI that get the TCP connection closed without sending RST packets. 65 | # Docs: https://bazel.build/reference/command-line-reference#flag--grpc_keepalive_time 66 | build --grpc_keepalive_time=30s 67 | -------------------------------------------------------------------------------- /.aspect/bazelrc/convenience.bazelrc: -------------------------------------------------------------------------------- 1 | # Attempt to build & test every target whose prerequisites were successfully built. 2 | # Docs: https://bazel.build/docs/user-manual#keep-going 3 | build --keep_going 4 | 5 | # Output test errors to stderr so users don't have to `cat` or open test failure log files when test 6 | # fail. This makes the log noisier in exchange for reducing the time-to-feedback on test failures for 7 | # users. 8 | # Docs: https://bazel.build/docs/user-manual#test-output 9 | test --test_output=errors 10 | 11 | # Show the output files created by builds that requested more than one target. This helps users 12 | # locate the build outputs in more cases 13 | # Docs: https://bazel.build/docs/user-manual#show-result 14 | build --show_result=20 15 | 16 | # Bazel picks up host-OS-specific config lines from bazelrc files. For example, if the host OS is 17 | # Linux and you run bazel build, Bazel picks up lines starting with build:linux. Supported OS 18 | # identifiers are `linux`, `macos`, `windows`, `freebsd`, and `openbsd`. Enabling this flag is 19 | # equivalent to using `--config=linux` on Linux, `--config=windows` on Windows, etc. 20 | # Docs: https://bazel.build/reference/command-line-reference#flag--enable_platform_specific_config 21 | common --enable_platform_specific_config 22 | 23 | # Output a heap dump if an OOM is thrown during a Bazel invocation 24 | # (including OOMs due to `--experimental_oom_more_eagerly_threshold`). 25 | # The dump will be written to `/.heapdump.hprof`. 26 | # You may need to configure CI to capture this artifact and upload for later use. 27 | # Docs: https://bazel.build/reference/command-line-reference#flag--heap_dump_on_oom 28 | common --heap_dump_on_oom 29 | -------------------------------------------------------------------------------- /.aspect/bazelrc/correctness.bazelrc: -------------------------------------------------------------------------------- 1 | # Do not upload locally executed action results to the remote cache. 2 | # This should be the default for local builds so local builds cannot poison the remote cache. 3 | # It should be flipped to `--remote_upload_local_results` on CI 4 | # by using `--bazelrc=.aspect/bazelrc/ci.bazelrc`. 5 | # Docs: https://bazel.build/reference/command-line-reference#flag--remote_upload_local_results 6 | build --noremote_upload_local_results 7 | 8 | # Don't allow network access for build actions in the sandbox. 9 | # Ensures that you don't accidentally make non-hermetic actions/tests which depend on remote 10 | # services. 11 | # Developers should tag targets with `tags=["requires-network"]` to opt-out of the enforcement. 12 | # Docs: https://bazel.build/reference/command-line-reference#flag--sandbox_default_allow_network 13 | build --sandbox_default_allow_network=false 14 | 15 | # Warn if a test's timeout is significantly longer than the test's actual execution time. 16 | # Bazel's default for test_timeout is medium (5 min), but most tests should instead be short (1 min). 17 | # While a test's timeout should be set such that it is not flaky, a test that has a highly 18 | # over-generous timeout can hide real problems that crop up unexpectedly. 19 | # For instance, a test that normally executes in a minute or two should not have a timeout of 20 | # ETERNAL or LONG as these are much, much too generous. 21 | # Docs: https://bazel.build/docs/user-manual#test-verbose-timeout-warnings 22 | test --test_verbose_timeout_warnings 23 | 24 | # Allow the Bazel server to check directory sources for changes. Ensures that the Bazel server 25 | # notices when a directory changes, if you have a directory listed in the srcs of some target. 26 | # Recommended when using 27 | # [copy_directory](https://github.com/bazel-contrib/bazel-lib/blob/main/docs/copy_directory.md) and 28 | # [rules_js](https://github.com/aspect-build/rules_js) since npm package are source directories 29 | # inputs to copy_directory actions. 30 | # Docs: https://bazel.build/reference/command-line-reference#flag--host_jvm_args 31 | startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1 32 | 33 | # Allow exclusive tests to run in the sandbox. Fixes a bug where Bazel doesn't enable sandboxing for 34 | # tests with `tags=["exclusive"]`. 35 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_exclusive_test_sandboxed 36 | test --incompatible_exclusive_test_sandboxed 37 | 38 | # Use a static value for `PATH` and does not inherit `LD_LIBRARY_PATH`. Doesn't let environment 39 | # variables like `PATH` sneak into the build, which can cause massive cache misses when they change. 40 | # Use `--action_env=ENV_VARIABLE` if you want to inherit specific environment variables from the 41 | # client, but note that doing so can prevent cross-user caching if a shared cache is used. 42 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_strict_action_env 43 | build --incompatible_strict_action_env 44 | 45 | # Propagate tags from a target declaration to the actions' execution requirements. 46 | # Ensures that tags applied in your BUILD file, like `tags=["no-remote"]` 47 | # get propagated to actions created by the rule. 48 | # Without this option, you rely on rules authors to manually check the tags you passed 49 | # and apply relevant ones to the actions they create. 50 | # See https://github.com/bazelbuild/bazel/issues/8830 for details. 51 | # Docs: https://bazel.build/reference/command-line-reference#flag--experimental_allow_tags_propagation 52 | build --experimental_allow_tags_propagation 53 | fetch --experimental_allow_tags_propagation 54 | query --experimental_allow_tags_propagation 55 | 56 | # Do not automatically create `__init__.py` files in the runfiles of Python targets. Fixes the wrong 57 | # default that comes from Google's internal monorepo by using `__init__.py` to delimit a Python 58 | # package. Precisely, when a `py_binary` or `py_test` target has `legacy_create_init` set to `auto (the 59 | # default), it is treated as false if and only if this flag is set. See 60 | # https://github.com/bazelbuild/bazel/issues/10076. 61 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_default_to_explicit_init_py 62 | build --incompatible_default_to_explicit_init_py 63 | 64 | # Set default value of `allow_empty` to `False` in `glob()`. This prevents a common mistake when 65 | # attempting to use `glob()` to match files in a subdirectory that is opaque to the current package 66 | # because it contains a BUILD file. See https://github.com/bazelbuild/bazel/issues/8195. 67 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_disallow_empty_glob 68 | common --incompatible_disallow_empty_glob 69 | 70 | # Always download coverage files for tests from the remote cache. By default, coverage files are not 71 | # downloaded on test result cache hits when --remote_download_minimal is enabled, making it impossible 72 | # to generate a full coverage report. 73 | # Docs: https://bazel.build/reference/command-line-reference#flag--experimental_fetch_all_coverage_outputs 74 | # detching remote cache results 75 | test --experimental_fetch_all_coverage_outputs 76 | -------------------------------------------------------------------------------- /.aspect/bazelrc/debug.bazelrc: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # Use `bazel test --config=debug` to enable these settings # 3 | ############################################################ 4 | 5 | # Stream stdout/stderr output from each test in real-time. 6 | # Docs: https://bazel.build/docs/user-manual#test-output 7 | test:debug --test_output=streamed 8 | 9 | # Run one test at a time. 10 | # Docs: https://bazel.build/reference/command-line-reference#flag--test_strategy 11 | test:debug --test_strategy=exclusive 12 | 13 | # Prevent long running tests from timing out. 14 | # Docs: https://bazel.build/docs/user-manual#test-timeout 15 | test:debug --test_timeout=9999 16 | 17 | # Always run tests even if they have cached results. 18 | # Docs: https://bazel.build/docs/user-manual#cache-test-results 19 | test:debug --nocache_test_results 20 | -------------------------------------------------------------------------------- /.aspect/bazelrc/javascript.bazelrc: -------------------------------------------------------------------------------- 1 | # Aspect recommended Bazel flags when using Aspect's JavaScript rules: https://github.com/aspect-build/rules_js 2 | # Docs for Node.js flags: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options 3 | 4 | # Support for debugging Node.js tests. Use bazel run with `--config=debug` to turn on the NodeJS 5 | # inspector agent. The node process will break before user code starts and wait for the debugger to 6 | # connect. Pass the --inspect-brk option to all tests which enables the node inspector agent. See 7 | # https://nodejs.org/de/docs/guides/debugging-getting-started/#command-line-options for more 8 | # details. 9 | # Docs: https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options 10 | run:debug -- --node_options=--inspect-brk 11 | test:debug --test_env=NODE_OPTIONS=--inspect-brk 12 | -------------------------------------------------------------------------------- /.aspect/bazelrc/performance.bazelrc: -------------------------------------------------------------------------------- 1 | # Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. 2 | # Save time on Sandbox creation and deletion when many of the same kind of action run during the 3 | # build. 4 | # No longer experimental in Bazel 6: https://github.com/bazelbuild/bazel/commit/c1a95501a5611878e5cc43a3cc531f2b9e47835b 5 | # Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories 6 | build --experimental_reuse_sandbox_directories 7 | 8 | # Do not build runfiles symlink forests for external repositories under 9 | # `.runfiles/wsname/external/repo` (in addition to `.runfiles/repo`). This reduces runfiles & 10 | # sandbox creation times & prevents accidentally depending on this feature which may flip to off by 11 | # default in the future. Note, some rules may fail under this flag, please file issues with the rule 12 | # author. 13 | # Docs: https://bazel.build/reference/command-line-reference#flag--legacy_external_runfiles 14 | build --nolegacy_external_runfiles 15 | 16 | # Avoid creating a runfiles tree for binaries or tests until it is needed. 17 | # Docs: https://bazel.build/reference/command-line-reference#flag--build_runfile_links 18 | # See https://github.com/bazelbuild/bazel/issues/6627 19 | # 20 | # This may break local workflows that `build` a binary target, then run the resulting program 21 | # outside of `bazel run`. In those cases, the script will need to call 22 | # `bazel build --build_runfile_links //my/binary:target` and then execute the resulting program. 23 | build --nobuild_runfile_links 24 | 25 | # Needed prior to Bazel 8; see 26 | # https://github.com/bazelbuild/bazel/issues/20577 27 | coverage --build_runfile_links 28 | -------------------------------------------------------------------------------- /.aspect/cli/config.yaml: -------------------------------------------------------------------------------- 1 | configure: 2 | languages: 3 | javascript: false 4 | go: true 5 | kotlin: false 6 | protobuf: false 7 | -------------------------------------------------------------------------------- /.aspect/workflows/BUILD.bazel: -------------------------------------------------------------------------------- 1 | platform( 2 | name = "x86_64_linux_remote", 3 | constraint_values = [ 4 | "@platforms//os:linux", 5 | "@platforms//cpu:x86_64", 6 | ], 7 | exec_properties = { 8 | "OSFamily": "Linux", 9 | "container-image": "docker://public.ecr.aws/docker/library/python@sha256:247105bbbe7f7afc7c12ac893be65b5a32951c1d0276392dc2bf09861ba288a6", 10 | }, 11 | visibility = ["//visibility:public"], 12 | ) 13 | -------------------------------------------------------------------------------- /.aspect/workflows/bazelrc: -------------------------------------------------------------------------------- 1 | # build without the bytes 2 | common --remote_download_outputs=minimal 3 | common --nobuild_runfile_links 4 | 5 | # remote execution 6 | common --extra_execution_platforms=@aspect_rules_ts//.aspect/workflows:x86_64_linux_remote 7 | common --host_platform=@aspect_rules_ts//.aspect/workflows:x86_64_linux_remote 8 | common --remote_executor=unix:///mnt/ephemeral/buildbarn/.cache/bb_clientd/grpc 9 | common --genrule_strategy=remote,local 10 | common --jobs=32 11 | common --remote_timeout=3600 12 | -------------------------------------------------------------------------------- /.aspect/workflows/config.yaml: -------------------------------------------------------------------------------- 1 | # See https://docs.aspect.build/workflows/configuration 2 | tasks: 3 | - format: 4 | queue: aspect-medium 5 | - buildifier: 6 | queue: aspect-medium 7 | - configure: 8 | queue: aspect-medium 9 | - test: 10 | - finalization: 11 | queue: aspect-small 12 | notifications: 13 | github: {} 14 | -------------------------------------------------------------------------------- /.bazelignore: -------------------------------------------------------------------------------- 1 | # Nested modules 2 | docs/ 3 | e2e/ 4 | 5 | # TODO(bazel 8): move to REPO.bazel 6 | examples/connect_node/node_modules 7 | examples/node_modules 8 | examples/proto_grpc/node_modules 9 | examples/linked_pkg/node_modules 10 | examples/linked_lib/node_modules 11 | examples/lib_nocompile_linked/node_modules 12 | examples/linked_consumer/node_modules 13 | examples/linked_empty_node_modules/node_modules 14 | examples/linked_tsconfig/node_modules 15 | examples/linked_tsconfig_consumer/node_modules 16 | examples/resolve_json_module_esm/node_modules 17 | examples/resolve_json_module_transpiler/node_modules 18 | -------------------------------------------------------------------------------- /.bazeliskrc: -------------------------------------------------------------------------------- 1 | BAZELISK_BASE_URL=https://github.com/aspect-build/aspect-cli/releases/download 2 | USE_BAZEL_VERSION=aspect/2025.08.26 3 | -------------------------------------------------------------------------------- /.bazelrc: -------------------------------------------------------------------------------- 1 | # Import Aspect bazelrc presets 2 | try-import %workspace%/.aspect/bazelrc/bazel7.bazelrc 3 | import %workspace%/.aspect/bazelrc/convenience.bazelrc 4 | import %workspace%/.aspect/bazelrc/correctness.bazelrc 5 | import %workspace%/.aspect/bazelrc/debug.bazelrc 6 | import %workspace%/.aspect/bazelrc/javascript.bazelrc 7 | import %workspace%/.aspect/bazelrc/performance.bazelrc 8 | 9 | ### YOUR PROJECT SPECIFIC OPTIONS GO HERE ### 10 | 11 | common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig 12 | common --@aspect_rules_ts//ts:default_to_tsc_transpiler 13 | 14 | # opt-in to flag that is on by default in Bazel 8 15 | common --incompatible_disallow_empty_glob 16 | 17 | # Never Compile protoc Again 18 | common --incompatible_enable_proto_toolchain_resolution 19 | common --per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT 20 | common --host_per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT 21 | 22 | # verbose 23 | common:verbose --@aspect_rules_ts//ts:verbose --worker_verbose 24 | 25 | # Don’t want to push a rules author to update their deps if not needed. 26 | # https://bazel.build/reference/command-line-reference#flag--check_direct_dependencies 27 | # https://bazelbuild.slack.com/archives/C014RARENH0/p1691158021917459?thread_ts=1691156601.420349&cid=C014RARENH0 28 | common --check_direct_dependencies=off 29 | 30 | # Load any settings & overrides specific to the current user from `.aspect/bazelrc/user.bazelrc`. 31 | # This file should appear in `.gitignore` so that settings are not shared with team members. This 32 | # should be last statement in this config so the user configuration is able to overwrite flags from 33 | # this file. See https://bazel.build/configure/best-practices#bazelrc-file. 34 | try-import %workspace%/.aspect/bazelrc/user.bazelrc 35 | -------------------------------------------------------------------------------- /.bazelversion: -------------------------------------------------------------------------------- 1 | 7.4.1 2 | -------------------------------------------------------------------------------- /.bcr/metadata.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "homepage": "https://docs.aspect.build/rules/aspect_rules_ts", 3 | "maintainers": [ 4 | { 5 | "name": "Alex Eagle", 6 | "email": "alex@aspect.build", 7 | "github": "alexeagle" 8 | }, 9 | { 10 | "name": "Greg Magolan", 11 | "email": "greg@aspect.build", 12 | "github": "gregmagolan" 13 | }, 14 | { 15 | "name": "Jason Bedard", 16 | "email": "jason@aspect.build", 17 | "github": "jbedard" 18 | }, 19 | { 20 | "name": "Sahin Yort", 21 | "email": "sahin@aspect.build", 22 | "github": "thesayyn" 23 | }, 24 | { 25 | "name": "Alex Eagle", 26 | "email": "alex@aspect.build", 27 | "github": "alexeagle" 28 | } 29 | ], 30 | "repository": ["github:aspect-build/rules_ts"], 31 | "versions": [], 32 | "yanked_versions": {} 33 | } 34 | -------------------------------------------------------------------------------- /.bcr/presubmit.yml: -------------------------------------------------------------------------------- 1 | bcr_test_module: 2 | module_path: 'e2e/bzlmod' 3 | matrix: 4 | bazel: ['7.x', '6.x'] 5 | platform: ['debian10', 'macos', 'ubuntu2004', 'windows'] 6 | tasks: 7 | run_tests: 8 | name: 'Run test module' 9 | bazel: ${{ bazel }} 10 | platform: ${{ platform }} 11 | test_targets: 12 | - '//...' 13 | -------------------------------------------------------------------------------- /.bcr/source.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "integrity": "**leave this alone**", 3 | "strip_prefix": "{REPO}-{VERSION}", 4 | "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/rules_ts-{TAG}.tar.gz" 5 | } 6 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # In code review, collapse generated files 2 | docs/rules.md linguist-generated 3 | docs/repositories.md linguist-generated 4 | examples/**/*_pb.d.ts linguist-generated 5 | 6 | #################################### 7 | # Configuration for 'git archive' 8 | # see https://git-scm.com/docs/git-archive/2.40.0#ATTRIBUTES 9 | 10 | # Don't include examples in the distribution artifact, to reduce size 11 | # Note, we do need to include e2e/bzlmod since BCR runs our test based on distribution artifact. 12 | examples export-ignore 13 | 14 | # Stamp the release version into this file 15 | ts/private/versions.bzl export-subst 16 | -------------------------------------------------------------------------------- /.github/workflows/BUILD.bazel: -------------------------------------------------------------------------------- 1 | load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets") 2 | 3 | write_aspect_bazelrc_presets( 4 | name = "update_aspect_bazelrc_presets", 5 | presets = [ 6 | # Modified from upstream 7 | # "bazel6", 8 | "bazel7", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /.github/workflows/bazel6.bazelrc: -------------------------------------------------------------------------------- 1 | # Speed up all builds by not checking if external repository files have been modified. 2 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244 3 | build --noexperimental_check_external_repository_files 4 | fetch --noexperimental_check_external_repository_files 5 | query --noexperimental_check_external_repository_files 6 | 7 | # Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. 8 | # Save time on Sandbox creation and deletion when many of the same kind of action run during the 9 | # build. 10 | # Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories 11 | build --reuse_sandbox_directories 12 | 13 | # Avoid this flag being enabled by remote_download_minimal or remote_download_toplevel 14 | # See https://meroton.com/blog/bazel-6-errors-build-without-the-bytes/ 15 | build --noexperimental_action_cache_store_output_metadata 16 | 17 | # Speed up all builds by not checking if output files have been modified. Lets you make changes to 18 | # the output tree without triggering a build for local debugging. For example, you can modify 19 | # [rules_js](https://github.com/aspect-build/rules_js) 3rd party npm packages in the output tree 20 | # when local debugging. 21 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/pkgcache/PackageOptions.java#L185 22 | # NB: This flag is in bazel6.bazelrc as when used in Bazel 7 is has been observed to break 23 | # "build without the bytes" --remote_download_outputs=toplevel. See https://github.com/bazel-contrib/bazel-lib/pull/711 24 | # for more info. 25 | build --noexperimental_check_output_files 26 | fetch --noexperimental_check_output_files 27 | query --noexperimental_check_output_files 28 | 29 | # Don't apply `--noremote_upload_local_results` and `--noremote_accept_cached` to the disk cache. 30 | # If you have both `--noremote_upload_local_results` and `--disk_cache`, then this fixes a bug where 31 | # Bazel doesn't write to the local disk cache as it treats as a remote cache. 32 | # Docs: https://bazel.build/reference/command-line-reference#flag--incompatible_remote_results_ignore_disk 33 | # NB: This flag is in bazel6.bazelrc because it became a no-op in Bazel 7 and has been removed 34 | # in Bazel 8. 35 | build --incompatible_remote_results_ignore_disk 36 | 37 | # Added in 6.4.0, see https://github.com/bazelbuild/bazel/pull/19319 38 | build --incompatible_merge_fixed_and_default_shell_env 39 | -------------------------------------------------------------------------------- /.github/workflows/bazel7.bazelrc: -------------------------------------------------------------------------------- 1 | # Speed up all builds by not checking if external repository files have been modified. 2 | # Docs: https://github.com/bazelbuild/bazel/blob/1af61b21df99edc2fc66939cdf14449c2661f873/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryOptions.java#L244 3 | common --noexperimental_check_external_repository_files 4 | 5 | # Don't report when the root module's lower bound for a dependency happens to be less than the resolved version. 6 | # This is expected and should NOT prompt an engineer to update our lower bound to match. 7 | # WARNING: For repository 'aspect_bazel_lib', the root module requires module version aspect_bazel_lib@1.30.2, 8 | # but got aspect_bazel_lib@1.31.2 in the resolved dependency graph. 9 | common --check_direct_dependencies=off 10 | 11 | # Directories used by sandboxed non-worker execution may be reused to avoid unnecessary setup costs. 12 | # Save time on Sandbox creation and deletion when many of the same kind of action run during the 13 | # build. 14 | # Docs: https://bazel.build/reference/command-line-reference#flag--reuse_sandbox_directories 15 | build --reuse_sandbox_directories 16 | -------------------------------------------------------------------------------- /.github/workflows/buildifier.yaml: -------------------------------------------------------------------------------- 1 | name: Buildifier 2 | 3 | # Controls when the action will run. 4 | on: 5 | # Triggers the workflow on push or pull request events but only for the main branch 6 | push: 7 | branches: [main] 8 | pull_request: 9 | branches: [main] 10 | 11 | # Allows you to run this workflow manually from the Actions tab 12 | workflow_dispatch: 13 | 14 | jobs: 15 | check: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: buildifier 20 | run: bazel run --enable_bzlmod //:buildifier.check 21 | -------------------------------------------------------------------------------- /.github/workflows/ci.bazelrc: -------------------------------------------------------------------------------- 1 | # Directories caches by GitHub actions 2 | common --disk_cache=~/.cache/bazel-disk-cache 3 | common --repository_cache=~/.cache/bazel-repository-cache 4 | 5 | # Debug where options came from 6 | common --announce_rc 7 | 8 | # Allows tests to run bazelisk-in-bazel, since this is the cache folder used 9 | common --test_env=XDG_CACHE_HOME 10 | 11 | # Still required for Windows until we upgrade to a minimum rules_js that no longer requires it 12 | common --enable_runfiles 13 | -------------------------------------------------------------------------------- /.github/workflows/mirror.yml: -------------------------------------------------------------------------------- 1 | name: Mirror Releases 2 | on: 3 | # Trigger manually in the UI 4 | workflow_dispatch: 5 | # Trigger daily at 06:50 UTC 6 | schedule: 7 | - cron: '50 6 * * *' 8 | 9 | jobs: 10 | mirror: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - run: | 15 | ./ts/private/mirror_versions.sh 16 | npx @bazel/buildifier ts/private/versions.bzl 17 | - name: Create Pull Request 18 | uses: peter-evans/create-pull-request@v5 19 | with: 20 | commit-message: 'chore: mirror external releases' 21 | -------------------------------------------------------------------------------- /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | # Publish new releases to Bazel Central Registry. 2 | name: Publish 3 | on: 4 | # Run the publish workflow after a successful release 5 | # Will be triggered from the release.yaml workflow 6 | workflow_call: 7 | inputs: 8 | tag_name: 9 | required: true 10 | type: string 11 | secrets: 12 | publish_token: 13 | required: true 14 | # In case of problems, let release engineers retry by manually dispatching 15 | # the workflow from the GitHub UI 16 | workflow_dispatch: 17 | inputs: 18 | tag_name: 19 | required: true 20 | type: string 21 | jobs: 22 | publish: 23 | uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.0.4 24 | with: 25 | tag_name: ${{ inputs.tag_name }} 26 | # GitHub repository which is a fork of the upstream where the Pull Request will be opened. 27 | registry_fork: aspect-build/bazel-central-registry 28 | permissions: 29 | attestations: write 30 | contents: write 31 | id-token: write 32 | secrets: 33 | # Necessary to push to the BCR fork, and to open a pull request against a registry 34 | publish_token: ${{ secrets.publish_token || secrets.BCR_PUBLISH_TOKEN }} 35 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | # Cut a release whenever a new tag is pushed to the repo. 2 | # You should use an annotated tag, like `git tag -a v1.2.3` 3 | # and put the release notes into the commit message for the tag. 4 | name: Release 5 | 6 | on: 7 | push: 8 | tags: 9 | - 'v*.*.*' 10 | permissions: 11 | id-token: write 12 | attestations: write 13 | contents: write 14 | jobs: 15 | release: 16 | uses: bazel-contrib/.github/.github/workflows/release_ruleset.yaml@v7.2.2 17 | with: 18 | release_files: rules_ts-*.tar.gz 19 | prerelease: false 20 | tag_name: ${{ github.ref_name }} 21 | publish: 22 | needs: release 23 | uses: ./.github/workflows/publish.yaml 24 | with: 25 | tag_name: ${{ github.ref_name }} 26 | secrets: 27 | publish_token: ${{ secrets.BCR_PUBLISH_TOKEN }} 28 | -------------------------------------------------------------------------------- /.github/workflows/release_prep.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit -o nounset -o pipefail 4 | 5 | # Set by GH actions, see 6 | # https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables 7 | TAG=${GITHUB_REF_NAME} 8 | # Strip leading 'v' 9 | PREFIX="rules_ts-${TAG:1}" 10 | ARCHIVE="rules_ts-$TAG.tar.gz" 11 | 12 | # NB: configuration for 'git archive' is in /.gitattributes 13 | git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip >$ARCHIVE 14 | SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}') 15 | 16 | cat <