create-polyfill-service-url
Advanced tools
Comparing version 1.4.2 to 1.5.0
@@ -0,1 +1,8 @@ | ||
# [1.5.0](https://github.com/JakeChampion/polyfill-service-url-builder/compare/v1.4.2...v1.5.0) (2019-07-29) | ||
### Features | ||
* adds the constructor of a feature to the features querystring if the specific feature does not exist from within polyfill-library ([246c342](https://github.com/JakeChampion/polyfill-service-url-builder/commit/246c342)) | ||
## [1.4.2](https://github.com/JakeChampion/polyfill-service-url-builder/compare/v1.4.1...v1.4.2) (2019-07-24) | ||
@@ -2,0 +9,0 @@ |
@@ -8,3 +8,3 @@ module.exports = { | ||
'subject-case': [ | ||
2, | ||
0, | ||
'always', | ||
@@ -11,0 +11,0 @@ [ |
@@ -21,3 +21,3 @@ { | ||
}, | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"dependencies": { | ||
@@ -24,0 +24,0 @@ "@babel/core": "^7.5.5", |
# Polyfill.io URL Builder | ||
Analyse your JavaScript file and generate a polyfill.io URL based on all the features that are being used from within the JavaScript file. | ||
A Node.js command-line application for analysing your JavaScript file and generating a https://polyfill.io URL based on all the features that are being used from within the JavaScript file. | ||
[![NPM version](https://img.shields.io/npm/v/create-polyfill-service-url.svg)](https://www.npmjs.com/package/create-polyfill-service-url) | ||
[![Build status](https://img.shields.io/circleci/build/gh/Financial-Times/polyfill-service-url-builder.svg)](https://circleci.com/gh/Financial-Times/polyfill-service-url-builder) | ||
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) | ||
```bash | ||
> npx create-polyfill-service-url --file bundle.js | ||
``` | ||
## Table Of Contents | ||
- [Usage](#usage) | ||
- [Contributing](#contributing) | ||
- [Versioning](#versioning) | ||
- [Publishing](#publishing) | ||
- [Authors](#authors) | ||
- [Contact](#contact) | ||
- [Licence](#licence) | ||
## Usage | ||
`create-polyfill-service-url analyse --file ./your-file.js` | ||
This project requires [Node.js] 10.x and [npm]. You can install with: | ||
```bash | ||
> npx create-polyfill-service-url --file bundle.js | ||
``` | ||
## Contributing | ||
This module has a full suite of unit tests, and is verified with ESLint. You can use the following commands to check your code before opening a pull request: | ||
```sh | ||
npm test # verify JavaScript code with ESLint and run the tests | ||
``` | ||
## Versioning | ||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/your/project/tags). | ||
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/Financial-Times/polyfill-service-url-builder/tags). | ||
## Publishing | ||
New versions of the module are published automatically by CI for every commit which lands on the `master` branch. | ||
## Authors | ||
@@ -17,6 +54,16 @@ | ||
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. | ||
See also the list of [contributors](https://github.com/Financial-Times/polyfill-service-url-builder/contributors) who participated in this project. | ||
## License | ||
## Contact | ||
If you have any questions or comments about this module, or need help using it, please [raise an issue][issues]. | ||
## Licence | ||
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details | ||
[issues]: https://github.com/Financial-Times/polyfill-service-url-builder/issues | ||
[node.js]: https://nodejs.org/ | ||
[npm]: https://www.npmjs.com/ |
@@ -14,4 +14,11 @@ "use strict"; | ||
featuresInPolyfillLibrary.add(feature); | ||
} else if (feature in aliases){ | ||
featuresInPolyfillLibrary.add(feature); | ||
} else if (feature in aliases) { | ||
featuresInPolyfillLibrary.add(feature); | ||
} else if (feature.includes('.prototype')) { | ||
const featureConstructor = feature.split('.prototype')[0]; | ||
if (polyfills.includes(featureConstructor)) { | ||
featuresInPolyfillLibrary.add(featureConstructor); | ||
} else if (featureConstructor in aliases) { | ||
featuresInPolyfillLibrary.add(featureConstructor); | ||
} | ||
} | ||
@@ -18,0 +25,0 @@ } |
@@ -40,1 +40,9 @@ /* eslint-env jest */ | ||
test('Adds the constructor of a feature to the features querystring if the specific feature does not exist from within polyfill-library', async () => { | ||
const expected = 'https://cdn.polyfill.io/v3/polyfill.min.js?features=DOMTokenList'; | ||
const actual = await generatePolyfillURL([ | ||
"DOMTokenList.prototype.add" | ||
]); | ||
expect(actual).toEqual(expected); | ||
}); | ||
15695
184
69