| load("@acorn__8.4.0__links//:defs.bzl", npm_link_acorn = "npm_link_imported_package") |
| load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary") |
| load("@npm//:defs.bzl", "npm_link_all_packages") |
| load("@pnpm__links//:defs.bzl", npm_link_pnpm = "npm_link_imported_package") |
| load("//npm:defs.bzl", "npm_link_package") |
| |
| # Link all packages from the /WORKSPACE npm_translate_lock(name = "npm") and also packages from |
| # manual /WORKSPACE npm_import rules to bazel-bin/node_modules as well as the virtual store |
| # bazel-bin/node_modules/.aspect_rules_js since /pnpm-lock.yaml is the root of the pnpm workspace |
| npm_link_all_packages( |
| name = "node_modules", |
| imported_links = [ |
| npm_link_acorn, |
| npm_link_pnpm, |
| ], |
| ) |
| |
| # Example of manually linking a first-party dependency. Its transitive npm dependencies |
| # are picked up automatically via 'npm_package_store_deps' in the js_library targets that |
| # the `npm_package` target depends on. |
| npm_link_package( |
| name = "node_modules/@mycorp/pkg-b", |
| src = "//examples/npm_package/packages/pkg_b", |
| ) |
| |
| gazelle_binary( |
| name = "gazelle_bin", |
| languages = ["@bazel_skylib//gazelle/bzl"], |
| ) |
| |
| gazelle( |
| name = "gazelle", |
| gazelle = "gazelle_bin", |
| ) |