Comments (1)
Doing some design thinking on this:
We can rely on update_source_file pointing to an action that just produces the .bzl content as a regular output, rather than having a standalone program the user invokes with bazel run
. Unlike rules_go it means you have testing that the deps.bzl stays up-to-date.
The current implementation is pure starlark, because repository_ctx gives us file read/write. However as an action we need to spawn a process to read the file, so reusing the code is tricky. Options:
- fetch and run a standalone starlark interpreter and run the library code in it
- rely on a python toolchain, and load the starlark helper functions as if they were python code, which works so long as we stub out the starlark builtins
- repository rule is no longer pure starlark, instead calling some helper program which can also be run as an action. Downside is the toolchain isn't available during repository rule execution so it makes that more complex for all users, even if they didn't want to check in the resulting .bzl file
- maintain a port of the same logic in another language like JS that can run in the action
The translate_package_lock
rule doesn't just produce the deps.bzl file. It also creates a bunch of aliases in BUILD files in the generated repo, so you can dep on @npm_deps//acorn
rather than @npm__acorn-8.5.7//:pkg
. The aliases are both shorter, and guarantee you only import your direct dependencies. We'd lose that feature in this usecase.
from rules_js.
Related Issues (20)
- [Bug]: enable_runfiles should no longer be required HOT 2
- [Bug]: js_run_devserver fails on Windows HOT 1
- [Bug]: rule macros do not work when invoked from another workspace
- [FR]: Support Node 20 HOT 2
- Fix commented out stardoc targets
- Add e2es that explicitly test bazel-lib 2.x compatibilty
- [Bug]: npm_translate_lock error message uses incorrect repo refence symbol when using bzlmod HOT 1
- [Bug]: `public_hoist_packages` does not fail repository setup if requested hash does not exist HOT 1
- [Bug]: `npm_translate_lock`'s `update_pnpm_lock` attribute + bzlmod errors on first build when used with external repositories (eg. `rules_ts`) HOT 2
- [Bug]: jq: error (at packages/api/account/package.json:28): Cannot index array with string "STABLE_SCM_TAG" HOT 1
- [Bug]: `js_image_layer` doesn't copy symlinks of a directory provided as `data`
- [Bug]: test and document --experimental_use_hermetic_linux_sandbox
- [Bug]: optionalDependencies improperly linked when using custom registry
- [feat] rules_js: js_run_devserver 1p npm deps optimization for watch mode
- [Bug]: Providers from aspect_bazel_lib does not work with Bazel 7 HOT 2
- [Bug]: pkg is a directory; dependency checking of directories is unsound HOT 16
- [Bug]: Flaky build failure: npm package directory copy fails with "No such file or directory" HOT 24
- [Bug]: `public_hoist_packages` does not hoist dependencies in `bazel-bin/node_modules`
- [Bug]: Unable to use js_binary in other workspaces in bazel 7
- [Bug]: Error from npm_translate_lock when using pnpm.patchedDependencies HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_js.