-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port target request to Rust #9809
Conversation
f8adb80
to
921ab6f
Compare
|
||
fn load_package_json(&self) -> Result<(PathBuf, PackageJson), anyhow::Error> { | ||
// TODO Invalidations | ||
let (package_path, mut package_json) = self.config.load_package_json_config::<PackageJson>()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO anything that does any reading should be coming either as an input to the request or it should be done through that context parameter.
That is because we will be able to implement read-tracking through the context parameter to not have to track invalidations manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I agree in premise, I think we should do a bit of sparring on this before proceeding and apply it to all requests. TargetRequest also does some processing on the pacakge.json file that is specific to this code, so that should be factored in.
921ab6f
to
2e49b4e
Compare
2dfc6db
to
6e6f26d
Compare
6e6f26d
to
0269bfb
Compare
↪️ Pull Request
These changes add the bulk of the target request implementation, but do not yet handle invalidations; initial options like serve mode; browserslist config file; etc. Most of the logic is the same, with notable changes being:
PluginConfig
has been renamed toConfigLoader
so that the target request can read and parse thepackage.json
file in a consistent manner. Theload_package_json_config
function has been modified so that the file is deserialized with serde given the generic parameter. This is more flexible, and if the previous API is needed for JavaScript plugins at a later point in time it can be added then.🚨 Test instructions
yarn build-native && cargo test