-
Notifications
You must be signed in to change notification settings - Fork 136
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
Issue on dependencies resolution #125
Comments
@JSteunou Thanks for the issue. The chain didn't include Could you list which polyfills cannot be gated please? I will look into ensuring we can gate them all. |
Is there a particular reason What I find odd though, is the header statement, telling us that |
A simple walking tree script checking presence of |
@JakeChampion I still think there is a dependency issue independent to gated. Let me explain better. I'm Chrome 61, requesting polyfill for
none Yes, nothing because So why is the service providing I think it is included only because of the |
Did a quick digging, when filtering by UA
To be continued... |
Ok find why and where. Let's keep our example with Chrome 61 and features All start here https://github.com/Financial-Times/polyfill-service/blob/master/lib/index.js#L111
Step by step analyse1. resolving aliasesIt will just return a feature list like this one, generated from the aliases.json [ 'Array.from',
'Array.of',
'Array.prototype.@@iterator',
'Array.prototype.entries',
'Array.prototype.fill',
'Array.prototype.find',
'Array.prototype.findIndex',
'Array.prototype.keys',
'Array.prototype.values',
'Function.name',
'Map',
'Math.acosh',
'Math.asinh',
'Math.atanh',
'Math.cbrt',
'Math.clz32',
'Math.cosh',
'Math.expm1',
'Math.hypot',
'Math.imul',
'Math.log10',
'Math.log1p',
'Math.log2',
'Math.sign',
'Math.sinh',
'Math.tanh',
'Math.trunc',
'Number.MAX_SAFE_INTEGER',
'Number.MIN_SAFE_INTEGER',
'Number.isFinite',
'Number.isInteger',
'Number.isNaN',
'Number.parseFloat',
'Number.parseInt',
'Object.assign',
'Object.is',
'Object.setPrototypeOf',
'Promise',
'Set',
'String.prototype.@@iterator',
'String.prototype.endsWith',
'String.prototype.includes',
'String.prototype.repeat',
'String.prototype.startsWith',
'Symbol.hasInstance',
'Symbol.isConcatSpreadable',
'Symbol.iterator',
'Symbol.match',
'Symbol.replace',
'Symbol.search',
'Symbol.species',
'Symbol.split',
'Symbol.toPrimitive',
'Symbol.toStringTag',
'Symbol.unscopables',
'Symbol',
'WeakMap',
'WeakSet',
'Array.prototype.includes',
'String.prototype.padEnd',
'String.prototype.padStart' ] no issue there 2. Filtering by UAWe are using Chrome 61 it keeps 3. Getting all dependenciesOur case is easier to debug because we have just one method to polyfill. It finds this list of dependencies, each one having metadata
Notice that 4. Filtering by UAAnd this is where the issue happens. All features supported by Chrome 61 are filter out, but utilities like
How to solve this?I propose to add another step of resolving, instead of
it should be
But you might have to
|
A less consuming way to solve this would be to filter by UA while recursively adding all dependencies so unneeded dependencies aren't not added and so never utilities when not needed.
|
@JakeChampion any bandwith to take a look? |
Any progress of this? I think it is really complicated issue, because some dependencies are not striped properly. For example this: It returns for Chrome:
for Firefox:
What are issues?
Possible solutions? (In global, not just my short issue)
What next? |
Array.prototype.values is now support by most browsers. Need just change version checking opened by this pull request: polyfillpolyfill/polyfill-service#1736 |
I think there is an issue on the dependencies resolution, enlighten in last Chrome, around Iterator.
See this https://polyfill.io/v2/polyfill.js?features=default,es6,es7 in Chrome 61 for example.
If we look at
Array.prototype.values
it actually should be polyfilled in Chrome 61, the statement is correct. It depends onArray.prototype.@@iterator
andSymbol.iterator
which depends on_ArrayIterator
Looking back at the polyfill generated, the header tells us that
_Iterator
and_ArrayIterator
are included because ofArray.prototype.values
which is a falsy statement.The entire chain is
Array.prototype.values
-->Array.prototype.@@iterator
-->_ArrayIterator
-->_Iterator
and this chain should be broke atArray.prototype.@@iterator
with Chrome 61 because it supports it.This make polyfill-service include more useless stuff, and some cannot be gated.
The text was updated successfully, but these errors were encountered: