You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR supports using custom binding with environment variable RSPACK_BINDING. Path-to-binding is a path to the root of the binding package.
RSPACK_BINDING=path-to-binding
This is achieved by our already used ast-grep package to scan and replace the original content of module @rspack/binding and @rspack/binding/package.json.
In order to either use or test the new binding package (which contains support for custom plugin), this PR also adds support for exposing experiments.createNativePlugin which is an alias to the original plugin create and would throw error if there's any naming collision with the internal builtin plugins. createNativePlugin is used to create wrappers around native plugins:
Tests are now containing two parts, the original binding and the builder testing binding. The latter part is to test if rspck-binding-builder successfully extended all the exposed symbols and functionalities provided by crates/node_binding. In order to cover that part, tests are written in a mixed style with the original rspack tests. With test.filter.js, these tests are only enabled when running test:base-builder script in rspack-test-tools. I talked to @stormslowly about these changes to the workflows. Due to the complexity, I would separate the workflow change to a separate PR.
Related links
Checklist
Tests updated (or not required). Required, but to heavy to implement in the same PR.
A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳! Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.
We are currently forking rspack to attempt customized feature development, and then releasing our own binding. In our internal framework, we forward requests to @rspack/binding to @shined/spack-binding by hijacking require.resolve.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR supports using custom binding with environment variable
RSPACK_BINDING.Path-to-binding is a path to the root of the binding package.
This is achieved by our already used
ast-greppackage to scan and replace the original content of module@rspack/bindingand@rspack/binding/package.json.In order to either use or test the new binding package (which contains support for custom plugin), this PR also adds support for exposing
experiments.createNativePluginwhich is an alias to the original plugincreateand would throw error if there's any naming collision with the internal builtin plugins.createNativePluginis used to create wrappers around native plugins:Tests are now containing two parts, the original binding and the builder testing binding. The latter part is to test if
rspck-binding-buildersuccessfully extended all the exposed symbols and functionalities provided bycrates/node_binding. In order to cover that part, tests are written in a mixed style with the original rspack tests. Withtest.filter.js, these tests are only enabled when runningtest:base-builderscript inrspack-test-tools. I talked to @stormslowly about these changes to the workflows. Due to the complexity, I would separate the workflow change to a separate PR.Related links
Checklist