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

[FEATURE] Make deprecations throw when the until for ember-source has passed #20669

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

kategengler
Copy link
Member

@kategengler kategengler commented Mar 26, 2024

  • Add a new deprecateUntil that checks whether a deprecation has been removed and throws if it has. This explicitly uses throw and not assert so that it will remain in production builds. This function should be used internally in ember-source in place of deprecate.
  • Add utilities testIf and testUnless to guard tests based on whether a deprecation has been removed. Uses this for the existing deprecation on @ember/routing
  • Add a query param to tests overridedeprecationversion that takes a version to be the current version for removing deprecation purposes
  • Add a CI build to use the above to test with deprecations broken

For https://rfcs.emberjs.com/id/0830-evolving-embers-major-version-process

- Add a new `deprecateUntil` that checks whether a deprecation has been
  removed and throws if it has. This explicitly uses `throw` and not
assert so that it will remain in production builds. This function should
be used internally in ember-source in place of `deprecate`.
- Add utilities `testIf` and `testUnless` to guard tests based on
  whether a deprecation has been removed. Uses this for the existing
deprecation on @ember/routing
- Add a query param to tests `overridedeprecationversion` that takes a
  version to be the current version for removing deprecation purposes
- Add a CI build to use the above to test with deprecations broken
@kategengler kategengler changed the title Make deprecations throw when the until for ember-source has passed [FEATURE] Make deprecations throw when the until for ember-source has passed Mar 26, 2024
@kategengler kategengler merged commit aaee9e9 into main Mar 26, 2024
22 checks passed
@kategengler kategengler deleted the kg-break-deprecations-at-until-2 branch March 26, 2024 20:46
@chancancode
Copy link
Member

@kategengler @ef4 I have a question: does this still get stripped correctly in prod build? looking at just the code here, it's not obvious it would – but maybe the code that handles that is out-of-tree somewhere else?

@kategengler
Copy link
Member Author

@chancancode No, it does not ... the deprecate within deprecateUntil should be stripped but the throw should remain because we want to actually break the APIs at the until

@shama
Copy link
Contributor

shama commented Jun 17, 2024

After upgrading to ember-source@5.9.0 I now see hundreds of deprecation messages in the terminal when running ember build/serve. Is this expected? Is there a way to silence or figure out where these deprecations are originating from?

DEPRECATION: The parts property on path nodes is deprecated, use head and tail instead
DEPRECATION: The 'Program' visitor node is deprecated. Use 'Template' or 'Block' instead (node was 'Block') 
DEPRECATION: The parts property on path nodes is deprecated, use head and tail instead
DEPRECATION: The parts property on path nodes is deprecated, use head and tail instead
DEPRECATION: The this property on path nodes is deprecated, use head.type instead
DEPRECATION: The parts property on path nodes is deprecated, use head and tail instead

@kategengler
Copy link
Member Author

@shama This is not related to this PR -- this PR makes deprecations throw when the until is passed, so when ember-source 6.0 is released, deprecations with an until of 6.0 will throw immediately so that we can take our time garbage collecting the old code.

The deprecations you are referencing are not from ember-source (they print on the command line). These deprecations came from @embroider/macros and were handed in this PR embroider-build/embroider#1967 and released in v1.16.3 of that package.

@shama
Copy link
Contributor

shama commented Jun 17, 2024

@kategengler My bad, thank you for pointing me to that embroider issue!

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