| load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | |
| load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary") | |
| # BEGIN-INTERNAL | |
| # avoid leaking a ts dependency | |
| load("//packages/typescript:checked_in_ts_project.bzl", "checked_in_ts_project") | |
| # Using checked in ts library like the linker | |
| # To update index.js run: | |
| # bazel run //internal/npm_install:compile_generate_build_file_check_compiled.update | |
| checked_in_ts_project( | |
| name = "compile_generate_build_file", | |
| src = "generate_build_file.ts", | |
| checked_in_js = "index.js", | |
| tsconfig = "tsconfig.json", | |
| visibility = ["//internal/npm_install:__subpackages__"], | |
| deps = ["@npm//@types/node"], | |
| ) | |
| # END-INTERNAL | |
| bzl_library( | |
| name = "bzl", | |
| srcs = glob(["*.bzl"]), | |
| visibility = ["//visibility:public"], | |
| ) | |
| # Exported to be consumed for generating stardoc. | |
| exports_files(["npm_install.bzl"]) | |
| filegroup( | |
| name = "generate_build_file", | |
| srcs = [ | |
| "index.js", | |
| ], | |
| visibility = ["//internal:__subpackages__"], | |
| ) | |
| filegroup( | |
| name = "package_contents", | |
| srcs = glob( | |
| include = ["*"], | |
| exclude = ["test"], | |
| ), | |
| visibility = ["//:__pkg__"], | |
| ) | |
| nodejs_binary( | |
| name = "browserify-wrapped", | |
| data = [ | |
| "//third_party/npm/node_modules/@babel/core", | |
| "//third_party/npm/node_modules/@babel/plugin-transform-modules-commonjs", | |
| "//third_party/npm/node_modules/babelify", | |
| "//third_party/npm/node_modules/base64-js", | |
| "//third_party/npm/node_modules/browserify", | |
| "//third_party/npm/node_modules/ieee754", | |
| "//third_party/npm/node_modules/named-amd", | |
| ], | |
| entry_point = ":browserify-wrapped.js", | |
| # TODO: figure out why browserify isn't resolved properly | |
| templated_args = ["--bazel_patch_module_resolver"], | |
| visibility = ["//visibility:public"], | |
| ) |