Skip to content
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

Merged
merged 1 commit into from
Jun 21, 2024
Merged

Conversation

MonicaOlejniczak
Copy link
Contributor

↪️ 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 to ConfigLoader so that the target request can read and parse the package.json file in a consistent manner. The load_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.
  • Context is not inferred for builtin targets when consumers do not provide one, for simplicity and to better align with official standards for the fields

🚨 Test instructions

yarn build-native && cargo test

crates/parcel/src/requests/target_request.rs Outdated Show resolved Hide resolved

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>()?;
Copy link
Contributor

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

Copy link
Contributor Author

@MonicaOlejniczak MonicaOlejniczak Jun 20, 2024

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.

@MonicaOlejniczak MonicaOlejniczak enabled auto-merge (squash) June 21, 2024 04:42
@MonicaOlejniczak MonicaOlejniczak merged commit 43bcef9 into v2 Jun 21, 2024
16 of 17 checks passed
@MonicaOlejniczak MonicaOlejniczak deleted the molejniczak/target-request branch June 21, 2024 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants