-
-
Notifications
You must be signed in to change notification settings - Fork 83
postcss-preset-env: filter features by implementation status #211
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
postcss-preset-env: filter features by implementation status #211
Conversation
…c344' into postcss-preset-env-filter-by-implementation-status--amiable-hippopotamus-d560d56350
Antonio-Laguna
left a comment
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.
Wow! This is really great!
Thanks for cleaning this up and making this much more manageable and sustainable in the future.
Only question I have is if you want to clarify more around the vendorImplementations as in explaining what stability usually means?
Antonio-Laguna
left a comment
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.
❤️
* 7.3 * add `postcss-is-pseudo-class` to `postcss-preset-env` and `cli` (#159) * add postcss-is-pseudo-class to preset-env and cli * add test * cli : emit warnings (#164) * cli : emit warnings * update change log * Adding debug option (#163) * Updating dependencies * Simplifying Object usaging * Clearer stage * Adding debug * Adding documentation * Useful on issues too * eslint enforce radix in parseInt * Naive approach to using result.warn * Clamping * Switching for better clarity * Update plugin-packs/postcss-preset-env/src/index.js Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Update plugin-packs/postcss-preset-env/src/index.js Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * 7.3 * add `postcss-is-pseudo-class` to `postcss-preset-env` and `cli` (#159) * add postcss-is-pseudo-class to preset-env and cli * add test * Updating CHANGELOG * Fixing link * Fixing changelog Co-authored-by: romainmenke <romainmenke@gmail.com> Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Disable javascript features (#167) * Updating dependencies * Simplifying Object usaging * Clearer stage * Adding debug * Adding documentation * Useful on issues too * eslint enforce radix in parseInt * Naive approach to using result.warn * Clamping * Switching for better clarity * Update plugin-packs/postcss-preset-env/src/index.js Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Update plugin-packs/postcss-preset-env/src/index.js Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * 7.3 * add `postcss-is-pseudo-class` to `postcss-preset-env` and `cli` (#159) * add postcss-is-pseudo-class to preset-env and cli * add test * Updating CHANGELOG * Fixing link * Fixing changelog * Moving to separate file * Adding option that disables client side polyfills * Adding useful logging to debug mode * Consistency * Adding meaningful tests * Updating README * Update plugin-packs/postcss-preset-env/README.md Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Adding missing library Co-authored-by: romainmenke <romainmenke@gmail.com> Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * apply new test suite to more plugins and sourcemap fixes * Revert "apply new test suite to more plugins and sourcemap fixes" This reverts commit b94037e. * apply new test suite to more plugins and sourcemap fixes (#182) * apply new test suite to more plugins and sourcemap fixes * cleanup dev dependencies * Removing Can I Use Lite (#185) * Getting things up to date * Creating a query for browsers from given browser support * Updating tests * Moving to cssdb feature * Using the new logic with logs too * Allowing `.` for float versions * Updating package * flip disableClientSidePolyfills (#189) * :any-link fixes (#183) * :any-link fixes * update tests * update tests * make it work without :is * postcss-hwb-function in preset-env / cli (#190) * postcss-hwb-function in preset-env / cli * add a test for hwb in preset-env * merge * add a shortcut to rewrite expect files and log warnings (#193) * add a shortcut to rewrite expect files * emit warnings if they don't match * Adding Opacity Percent Feature (#196) * Updating badges (#197) * Replacing all chat badges * Adding package phobia #165 * Adding PostCSS clamp (#198) * Adding postcss-clamp * Updating CHANGELOG * New test for preserve: true with every feature enabled * postcss-is-pseudo-class : better warnings and skip (#199) * wip * wip * wip * wip * wip * finish * Getting ready-er * Integrate font & display plugins (#205) * Adding two new plugins * Adding missing plugins to the CLI * postcss-is-pseudo-class : browser tests and transform in 2 stages (#212) * postcss-is-pseudo-class : browser tests * postcss-is-pseudo-class: 2 stage transform * cleanup * postcss-preset-env: filter features by implementation status (#211) * postcss-preset-env: filter by implementation status * tweak * fix insertBefore/insertAfter * fix * few more tests and simplify postcss-tape expect/result option * fix * update docs * postcss-preset-env: pin some features to stage: 1 (#213) * Adding more to the README (#207) * Adding more to the README #202 * Updating docs * Update plugin-packs/postcss-preset-env/README.md Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Update plugin-packs/postcss-preset-env/README.md Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Update plugin-packs/postcss-preset-env/README.md Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Update plugin-packs/postcss-preset-env/README.md Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Update plugin-packs/postcss-preset-env/README.md Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> Co-authored-by: Romain Menke <11521496+romainmenke@users.noreply.github.com> * Updating CSSDB to latest version * Tests fixing * Test after building * Upgrading all deps * Updating packages Co-authored-by: Antonio Laguna <sombragriselros@gmail.com>
Note on the size of this change :
I did not dare adding more logic to preset-env without having more granular unit tests.
This required splitting everything up into separate functions and files.
My aim was to make the entire code base more clear and easier to update with this in mind.
Some newer JS features like
SymbolandMapare used to make everything a bit more predictable.Symbolmakes it safer to combine data from multiple source (plugin options, cssdb) while still knowing which keys were set bypostcss-preset-env.Mapprevents unexpected behaviour when users set options that overlap with build-ins liketoString.This does not yet have full test coverage with unit tests alone but the combo of the new unit tests and
postcss-tapeshould still be a step in the right direction.After this initial refactor it became trivial to add the
minimumVendorImplementationsoption.There is no overloading of this option or hidden logic around it.
minimumVendorImplementationsis always converted to a number between0and3.0is equivalent to not setting the option.There is still one bit of undefined logic that I haven't tracked down and added tests for.
When using
insertAfterorinsertBeforeit is unclear if those plugins become dynamic based on the browser lists of the feature they are attached to.I need to check this on
mainfirst.Update :
Notable fix :
see :
postcss-plugins/plugin-packs/postcss-preset-env/test/basic.nesting.true.expect.css
Lines 39 to 41 in e83f355
We added
getOptionsForBrowsersByFeaturesome time ago and this had a bug.When manually enabling a feature like
postcss-nestingbut without adding anysharedOptsthe flags set bygetOptionsForBrowsersByFeaturewould be erased. Asoptionswas set toundefinedin this case.This has been fixed.