Financial-Times/polyfill-service — pull request #49 by samgiles (2014-07-21 16:16:01+00:00)
Title: Alias refactor

Adds tests for the alias resolution logic which revealed some flaws:

- Now only a single AliasResolver module can be used effectively. There isn't much point in being able to create more than one in any context
- If duplicate polyfills are encountered following name resolution, all applicable flags are applied and each separate alias is recorded
- Polyfills included via multiple aliases record each alias that caused its inclusion
- Correctly removes duplicate polyfill entries (expanding aliases and flags as above)

This keeps much of the same logic:

1. For each resolver function..
3. Apply the resolver function to each Polyfill - (polyfill -> [polyfills])
4. Flatten the result
5. Remove duplicates and expand aliases and flags
6. Repeat until all resolver functions have run (in order).