-
Notifications
You must be signed in to change notification settings - Fork 134
RFC: support f(browser) => array-of-missing-features #1115
Comments
Hi @cdaringe, Thank you for the issue! Some quick notes on the version info in Ranges can define a minimum version required.
This exception is documented in the notes here : https://github.com/Financial-Times/polyfill-library/blob/master/polyfills/HTMLInputElement/prototype/valueAsDate/config.toml#L21
It is also not immediately clear to me what the end goal of Might be interesting : https://github.com/mrhenry/core-web/blob/main/packages/core-web/index.ts#L37-L70 We use : The goal on our end is to bundle polyfills from both core-js and polyfill-library without having conflicting duplicates. (multiple bundles are created for progressively older browsers) It is a public function, so you can run this : const { required } = require("@mrhenry/core-web");
console.log(required({
browsers: { "safari": "12"}
}));
That list however is not useful to us on its own and it is very long. |
Hey @romainmenke Thanks for the feedback. I've taken the opportunity to simplify my original problem statement at the top of the issue. I'm going to answer your questions, but out of order :)
My ultimate objective is to support building an intelligent, targeted polyfill, programatically. Implementing Practically speaking, I need to solve the below equation for var Features_to_polyfill =
Features_used_by_app - // known (user-space)
Features_supported_by_compiler - // known (user-space)
Features_not_in_browser // **getMissingFeatures(browser, version)**
Does that make sense? I prevent some features from being used in my application, generally via things like lint rules. My compiler (babel) down-levels some language features, which I also know about. So, if those two sets of features are known, I want to be able say "hey, what leftover features that I am using need to be polyfilled?". As you noted, the list can be enormous! This is a positive trait--I want to consider each and every one of these entities, and either A) forbid the feature in my application, or B) include it in my polyfill set! Perhaps, This helps me protect my users by not using unsupported features, or, helps by polyfilling only where needed. Without On your range notes, i'll defer conversation there. Thanks for that. I need to get a bit more free time and dwell on those |
I didn't see references to core-web in this project. Can you help clarify the relation between these two? Ultimately I was hoping that |
We (mrhenry) used to request polyfills from polyfill.io but had similar issues.
So polyfill-library has no relation to core-web. But core-web uses polyfill-library and we try to give back as much as possible.
We did not submit a patch to include something like the Maintaining it on our end just made more sense for us. We know exactly how we will use the output and our implementation is written exactly for that. Including it here would need more thought so that it solves the right issue for the most people. That does not mean that it or something similar couldn't be included here.
Your example could be rewritten as such :
The first item (making features not allowed) is not something we (mrhenry) do automatically. This is handled through review as an automatic tool can't detect progressive enhancement. The second one is pretty much https://github.com/mrhenry/core-web Issues we encountered and solved :
1, 2, 3 and 4 were solved as one by generating a single file with all config formatted and filtered for our use case. So not having something like This is starting to sound like an ad for core-web and I definitely do not want to push you into using it. Just sounds like you are trying to do something similar and will encounter the same issues. So wanted to share a bit of what we did. |
@cdaringe going over a few older issues Is this still an open issue on your end? Given the limited bandwidth we currently have for |
I’ll reopen if I find compelling new ideas :) |
What
I need to build a targeted polyfill for browser X, but I do not know the polyfill-abe features that browser X needs.
f
, wheref(safari, 12) => ["ResizeObserver", "INTL.XYZ", ..., other-missing-features]
This is highly desirable functionality, because:
f(safari, 12).filter(feature => !DONT_POLYFILL_THESE_HANDLED_FEATURES.some(rgx => rgx.test(feature))
A & B & C
may work with multilple browsers, so rather than going directly frombrowser => polyfill-bundle
, instead, i can go frombrowser => features => polyfill-bundle
and recycle my polyfill bundle between a few browsers. it is certainly useful to polyfill by features, not by browser target.There is a related issue that says use polyfill-service-url-builder, but that library is more or less a function of
src-js => polyfill-js
, which is fundamentally disjoint with this issue. This isbrowser-identifier => list-of-features
.Details
I have a few applications to manage. Each one has different browser support requirements, but I do not know the exact features I need to polyfill. I could, however, with just a tiny bit of extra information already contained in polyfill-library.
polyfill-library has all of this great data, it just does not expose it conveniently. it can be easily supported by this library, using existing APIs. However,
meta.browsers
schema, which I didn't see clearly documented. this is a risk in maintaining such functionality in user space.meta.browsers
schema may be challenging. hopefully contributors can articulate where the browsers TOML/meta schema convention is maintained? it would be awesome to unify that schema.Here is an implementation. FWIW, in writing this, I believe I uncovered a few small bugs in the current library.
In executing the above script, I believe I have discovered a few small bugs in polyfill-library:
meta.json
at all for this file!The text was updated successfully, but these errors were encountered: