Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-polyfill-service-url

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-polyfill-service-url

Analyse your JavaScript file and generate a polyfill.io URL based on all the features that are being used from within the JavaScript file.

  • 2.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Polyfill.io URL Builder

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 MIT licensed

> npx create-polyfill-service-url analyse --file bundle.js

Table Of Contents

Usage

CLI

This project requires Node.js 10.x and npm. You can run it with:

> npx create-polyfill-service-url analyse --file bundle.js [--cwd "/custom/pwd" --omit "Array.prototype.includes" --hostname "polyfill.io"]

You can pass multiple files as argument if you split your bundle files:

npx create-polyfill-service-url analyse --file app.js vendor.js
OptionDescriptionDefault
--fileThe path to the JavaScript file(s) to analyse
--cwdThe current working directoryprocess.cwd()
--omitA list of features to omit. Example: Array.prototype.map
--hostnameThe hostname of the polyfill service to use.polyfill.io
--use-compute-at-edge-backendDefines the compute-at-edge-backend usage policy: yes or no. If empty the server will decide.
--flagsConfiguration settings for every polyfill being requested. Possible values are always and gated or both
--unknownDefines the policy for unsupported browsers: polyfill or ignorepolyfill

JS API

const analyze = require('create-polyfill-service-url');

const result = await analyze({
  file: ['bundle.js'],
  cwd: '/foo/bar',                    // Defaults to process.cwd()
  omit: ['Array.prototype.includes'], // Defaults to []
  hostname: 'example.com',            // Defaults to 'polyfill.io'
  unknown: 'polyfill',                // Defaults to null. Accepts 'polyfill' or 'ignore'
  useComputeAtEdgeBackend: 'yes',     // Defaults to null. Accepts 'yes' or 'no'
  flags: 'gated',                     // Defaults to null. Accepts 'always', 'gated' or both ['always', 'gated']
});

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:

npm test    # verify JavaScript code with ESLint and run the tests

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Publishing

New versions of the module are published automatically by CI for every commit which lands on the master branch.

Authors

See also the list of contributors who participated in this project.

Contact

If you have any questions or comments about this module, or need help using it, please raise an issue.

Licence

This project is licensed under the MIT License - see the LICENSE.md file for details

FAQs

Package last updated on 01 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc