-
Notifications
You must be signed in to change notification settings - Fork 22
[email protected] #219
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
[email protected] #219
Conversation
…fy parsing (#217) # Description <!-- Include a summary of the change made and also list the dependencies that are required if any --> This PR migrates the repo off of Zod schemas toward pure TS with JSDoc annotations that can eventually be used to extract metadata for display in docs. Generally the external behavior should be identical, with obvious exceptions where schema entry points are no longer available etc., so this would constitute a breaking change for consumers relying on those entrypoints or whose inputs may no longer be valid with new type safety around video/image options. I've also updated all the tests to `.ts` so we can be sure the types for the API are working as we expect going forward. Although all the tests are passing, the doc generation issue remains unsolved, causing the repo-wide build to fail, so that will need to be updated to use a JSDoc parsing tool. However, it should be quite straightforward to wire that up in place of the previous Zod-embedded metadata. For now, I'm opening this against the `beta` branch so the required JSDoc parsing logic can be added and other changes can be experimented with before broader consumption. ## Issue Ticket Number N/A <!-- Specify above which issue this fixes by referencing the issue number (`#<ISSUE_NUMBER>`) or issue URL. --> <!-- Example: Fixes https://github.com/colbyfayock/cloudinary-util/issues/<ISSUE_NUMBER> --> ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [X] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Fix or improve the documentation - [X] This change requires a documentation update # Checklist (Still a draft, need to figure out how to work around missing schemas in build) <!-- These must all be followed and checked. --> - [ ] I have followed the contributing guidelines of this project as mentioned in [CONTRIBUTING.md](/CONTRIBUTING.md) - [ ] I have created an [issue](https://github.com/colbyfayock/cloudinary-util/issues) ticket for this PR - [ ] I have checked to ensure there aren't other open [Pull Requests](https://github.com/colbyfayock/cloudinary-util/pulls) for the same update/change? - [ ] I have performed a self-review of my own code - [ ] I have run tests locally to ensure they all pass - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes needed to the documentation BREAKING CHANGES: removes zod schemas, refactors type system
# [@cloudinary-util/util-v5.0.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/util-v4.0.0...@cloudinary-util/util-v5.0.0-beta.1) (2024-10-18) ### Features * migrate Zod to pure TS w/ JSDoc, improve type safety and simplify parsing ([#217](#217)) ([f605f26](f605f26))
# [@cloudinary-util/url-loader-v6.0.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.10.5...@cloudinary-util/url-loader-v6.0.0-beta.1) (2024-10-18) ### Features * migrate Zod to pure TS w/ JSDoc, improve type safety and simplify parsing ([#217](#217)) ([f605f26](f605f26))
# [@cloudinary-util/types-v2.0.0-beta.1](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/types-v1.5.11...@cloudinary-util/types-v2.0.0-beta.1) (2024-10-18) ### Features * migrate Zod to pure TS w/ JSDoc, improve type safety and simplify parsing ([#217](#217)) ([f605f26](f605f26))
# Description This pull request introduces TypeScript types for the Cloudinary Product Gallery Widget. It defines a comprehensive interface for the widget, following the reference documentation for better type safety and improved developer experience. No additional dependencies are required for this change. ## Issue Ticket Number 199 Fixes #199 ## Type of change <!-- Please select all options that are applicable. --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Fix or improve the documentation - [ ] This change requires a documentation update # Checklist <!-- These must all be followed and checked. --> - [x] I have followed the contributing guidelines of this project as mentioned in [CONTRIBUTING.md](/CONTRIBUTING.md) - [x] I have created an [issue](https://github.com/colbyfayock/cloudinary-util/issues) ticket for this PR - [x] I have checked to ensure there aren't other open [Pull Requests](https://github.com/colbyfayock/cloudinary-util/pulls) for the same update/change? - [x] I have performed a self-review of my own code - [x] I have run tests locally to ensure they all pass - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes needed to the documentation
# [@cloudinary-util/types-v2.0.0-beta.2](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/types-v2.0.0-beta.1...@cloudinary-util/types-v2.0.0-beta.2) (2024-10-22) ### Bug Fixes * Add TypeScript Types for Cloudinary Product Gallery Widget ([#218](#218)) ([05cd33e](05cd33e)), closes [#199](#199)
# [@cloudinary-util/url-loader-v6.0.0-beta.2](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v6.0.0-beta.1...@cloudinary-util/url-loader-v6.0.0-beta.2) (2024-10-22) ### Bug Fixes * Add enum for format parameter ([#220](#220)) ([0ecd331](0ecd331)), closes [#142](#142)
# Description Based on a conversation with @colbyfayock, this adds back enumerated props for each plugin. They're collected via two top-level exports, `cloudinaryPluginProps` and `cloudinaryPluginKeys`, so we can expose which props are handled by cloudinary without all the implementation details of each plugin.
# [@cloudinary-util/url-loader-v6.0.0-beta.3](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v6.0.0-beta.2...@cloudinary-util/url-loader-v6.0.0-beta.3) (2024-10-24) ### Features * enumerate plugin props ([#224](#224)) ([731d545](731d545))
|
@ssalbdivad - @ghostdevv noticed an issue where when using only CldImage, because all of the plugins run, she noticed ABR plugin warnings CldImage would not directly set any any ideas what might be causing that? |
|
@colbyfayock What API do you mean specifically by "only CldImage"? I don't think the logic around defaulting |
|
the example given was a page that simply only loaded CldImage, so it appears by using CldImage (asset type image), we get warnings about trying to use video plugins |
|
@colbyfayock Ahh okay I see the issue here. You can fix it by migrating In applyWhen: "streamingProfile",
apply: (asset, opts) => {
asset.addTransformation(`sp_${opts.streamingProfile}`);
return {};
},
Would potentially be worth migrating more of these over in the future as the inverse problem could occur for a video asset where you get a bunch of warnings about image types. I think it should result in the logic for actually handling what the plugin does at that point much clearer though! |
|
@colbyfayock Also looking back on why exactly this change was made, some of the motivation was that we didn't have the explicit Potentially you could remove I think in either case, it would be super helpful for separation of concerns if the logic of "should this plugin do anything based on these options" lived outside each individual plugin, so if we can do that by adding some centralized logic that checks for props overlap similarly to before and then only run |
# [@cloudinary-util/url-loader-v6.0.0-beta.4](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v6.0.0-beta.3...@cloudinary-util/url-loader-v6.0.0-beta.4) (2024-10-25) ### Bug Fixes * adding applyWhen to streaming profile to prevent abr plugin from running ([ef7e57a](ef7e57a)) * adding string and number back to replaceBackground ([672009a](672009a))
# [@cloudinary-util/url-loader-v6.0.0-beta.5](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v6.0.0-beta.4...@cloudinary-util/url-loader-v6.0.0-beta.5) (2024-10-31) ### Bug Fixes * make plugins and cloudinaryPluginProps tree-shakeable ([#227](#227)) ([163cb2f](163cb2f))
…lwaysApply exception (#228) # Description <!-- Include a summary of the change made and also list the dependencies that are required if any --> Simplify applyWhen to just check for presence of props from the new props key as discussed with @colbyfayock, add an alwaysApply key that can be used for exceptions like SanitizePlugin that should always run regardless of the presence of associated keys. This is a rebased version of #226. ## Issue Ticket Number Fixes #<ISSUE_NUMBER> <!-- Specify above which issue this fixes by referencing the issue number (`#<ISSUE_NUMBER>`) or issue URL. --> <!-- Example: Fixes https://github.com/colbyfayock/cloudinary-util/issues/<ISSUE_NUMBER> --> ## Type of change <!-- Please select all options that are applicable. --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Fix or improve the documentation - [ ] This change requires a documentation update # Checklist <!-- These must all be followed and checked. --> - [ ] I have followed the contributing guidelines of this project as mentioned in [CONTRIBUTING.md](/CONTRIBUTING.md) - [ ] I have created an [issue](https://github.com/colbyfayock/cloudinary-util/issues) ticket for this PR - [ ] I have checked to ensure there aren't other open [Pull Requests](https://github.com/colbyfayock/cloudinary-util/pulls) for the same update/change? - [ ] I have performed a self-review of my own code - [ ] I have run tests locally to ensure they all pass - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes needed to the documentation
# [@cloudinary-util/url-loader-v6.0.0-beta.6](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v6.0.0-beta.5...@cloudinary-util/url-loader-v6.0.0-beta.6) (2024-10-31) ### Bug Fixes * remove applyWhen in favor of explicit props overlap check with alwaysApply exception ([#228](#228)) ([90d07c2](90d07c2))
# [@cloudinary-util/types-v2.0.0-beta.3](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/types-v2.0.0-beta.2...@cloudinary-util/types-v2.0.0-beta.3) (2024-10-31) ### Bug Fixes * remove applyWhen in favor of explicit props overlap check with alwaysApply exception ([#228](#228)) ([90d07c2](90d07c2))
# [@cloudinary-util/util-v5.0.0-beta.2](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/util-v5.0.0-beta.1...@cloudinary-util/util-v5.0.0-beta.2) (2024-10-31) ### Bug Fixes * remove applyWhen in favor of explicit props overlap check with alwaysApply exception ([#228](#228)) ([90d07c2](90d07c2))
# [@cloudinary-util/url-loader-v6.0.0-beta.7](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v6.0.0-beta.6...@cloudinary-util/url-loader-v6.0.0-beta.7) (2024-10-31) ### Bug Fixes * make all individual plugin declarations tree-shakeable ([#229](#229)) ([b6a5563](b6a5563))
# [@cloudinary-util/util-v4.1.0](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/util-v4.0.0...@cloudinary-util/util-v4.1.0) (2024-11-01) ### Features * [email protected] ([#219](#219)) ([6740562](6740562))
|
🎉 This PR is included in version @cloudinary-util/util-v4.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [@cloudinary-util/url-loader-v5.11.0](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/url-loader-v5.10.6...@cloudinary-util/url-loader-v5.11.0) (2024-11-01) ### Features * [email protected] ([#219](#219)) ([6740562](6740562))
|
🎉 This PR is included in version @cloudinary-util/url-loader-v5.11.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
# [@cloudinary-util/types-v1.6.0](https://github.com/cloudinary-community/cloudinary-util/compare/@cloudinary-util/types-v1.5.11...@cloudinary-util/types-v1.6.0) (2024-11-01) ### Features * [email protected] ([#219](#219)) ([6740562](6740562))
|
🎉 This PR is included in version @cloudinary-util/types-v1.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |



Description
This PR migrates the repo off of Zod schemas toward pure TS with JSDoc annotations that can eventually be used to extract metadata for display in docs.
Generally the external behavior should be identical, with obvious exceptions where schema entry points are no longer available etc., so this would constitute a breaking change for consumers relying on those entrypoints or whose inputs may no longer be valid with new type safety around video/image options.
I've also updated all the tests to
.tsso we can be sure the types for the API are working as we expect going forward.Although all the tests are passing, the doc generation issue remains unsolved, causing the repo-wide build to fail, so that will need to be updated to use a JSDoc parsing tool. However, it should be quite straightforward to wire that up in place of the previous Zod-embedded metadata.
For now, I'm opening this against the
betabranch so the required JSDoc parsing logic can be added and other changes can be experimented with before broader consumption.Issue Ticket Number
N/A
Type of change
Checklist
(Still a draft, need to figure out how to work around missing schemas in build)
BREAKING CHANGES: removes zod schemas, refactors type system
Description
Issue Ticket Number
Fixes #<ISSUE_NUMBER>
Type of change
Checklist