Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deprecate bs-dependencies and bs-dev-dependencies #7658

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

Bushuo
Copy link
Collaborator

@Bushuo Bushuo commented Jul 16, 2025

Fixes a part of #7455

  • Introduces a global deprecation registry that logs a warning the first time a key is inserted.
  • Deprecates bs-dependencies and bs-dev-dependencies
  • Changes to the config struct to track which deprecated fields are used
  • Update the testrepo to use the correct field values
  • Add a test package to emit the deprecation warning

@Bushuo Bushuo force-pushed the rewatch-config-deprecations branch 2 times, most recently from 35d577b to b4fdc3a Compare July 17, 2025 15:24
@Bushuo Bushuo force-pushed the rewatch-config-deprecations branch from d55428c to 1bd6371 Compare July 17, 2025 16:59
Copy link

pkg-pr-new bot commented Jul 17, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7658

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7658

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7658

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7658

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7658

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7658

commit: 1bd6371

@Bushuo Bushuo marked this pull request as ready for review July 17, 2025 17:15
@cknitt
Copy link
Member

cknitt commented Jul 17, 2025

This is great! Thanks a lot for your work!

Could you maybe also include the bsc-flags -> compiler-flags renaming (also proposed in #6475) to get rid of the last remaining "bs"?

@zth
Copy link
Collaborator

zth commented Jul 17, 2025

Reminder that this needs to be updated in other tools that use the config file as well. Editor tooling is one, maybe the only one.

Maybe we could have a look at having rewatch supply the needed build state from these things to whoever needs them, like the editor tooling.

jsx: None,
gentype_config: None,
namespace_entry: None,
config: super::config::tests::create_config(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I love this, going from a named struct to positional args. The struct creation is a bit verbose, but I don't mind it too much since it's explicit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a test method tho. And it does not work otherwise because I introduced private fields

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could pass a wrapper struct around the arguments.

}

#[cfg(test)]
mod tests {
pub mod tests {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this need to be public?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment above

DEPRECATION_REGISTRY.get_or_init(|| Mutex::new(AHashSet::new()))
}

pub fn log_deprecated_field(field_name: &str, replacement_field_name: &str, file_path: &PathBuf) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need global state for this since it's already in the config struct. We can just log them out when we log all warnings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are warnings only logged once? I needed a mechanism to only log once per config file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And can you please show me where we log all warnings?

@@ -1,4 +1,10 @@
Cleaned 0/15
WARN:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't prepend this with WARN:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comes from the macro. Is there another logging mechanism?

Copy link
Contributor

@jfrolich jfrolich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can remove the deprecation_registry and just log after scanning the packages this looks good!

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.

4 participants