npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@financial-times/n-polyfill-io

v1.0.14

Published

Config and monitoring for next's use of polyfill.io

Downloads

47

Readme

n-polyfill-io

Config and monitoring for next's use of polyfill.io

API

  • callbackName - the name of the callback function used by next's client side code to respond to the polyfill bundle's arrival
  • getQueryString(opts) - get a query string for a polyfill service request. Options are all booleans
    • enhanced - whether or not this polyfill url is used to serve the enhanced experience. This turns on a lot of features e.g. includes callback=blah in the url
    • withRum - collects RUM data for the polyfill service
    • excludeSymbol - excludes Symbol and related polyfills from the bundle
  • getAllQueryStrings() - returns a map of all polyfill query strings this component is capable of building

Fallback

This component also deploys fallback bundles that ft.com can load in the eventuality that the polyfill service's app goes down, as follows:

When creating a tagged release of this component

  1. For each combination of variants (as detailed in getQueryString() above) an equivalent polyfill bundle is created by building a query string from those options but appending &ua=next-fallback. This ua, unrecognised by polyfill.io, will trigger the &unknown=polyfill option in the qs to take effect, i.e. a bundle containing all polyfills requested will be built.
  2. These bundles are sent to the ft-next-n-ui-prod bucket on s3 (replicated at ft-next-n-ui-prod-us too). The paths reflect the variants combination e.g. {enhanced: true, withRUM: true} will create a bundle which is saved to /polyfill/fallback/enhanced:withRUM.js. The first line of this bundle will contain a timestamp of when it was created

When the component is consumed by our apps

Each polyfill url output in the page will have e.g. &next-variant=enhanced appended to the url, to indicate which variant was used to generate that url. The template consumes data generated by n-express, which gets the data relating to polyfill urls from n-polyfill-io.

When the polyfill app is unhealthy

In next-geebee's vcl, https://github.com/Financial-Times/next-geebee/pull/19/files, if the polyfill service is unhealthy the backend is pointed at one or other of the n-ui s3 buckets, depending on region, and the url is rewritten by reading the next-variant query parameter and using that to generate a url such as /polyfill/fallback/enhanced:withRUM.js. This retrieves the file from s3 and serves it to the browser with a relatively short cache time so that when the service is healthy again the more efficient bundles it generates are used as soon as possible.

TODO

  • A lambda function should carry out the deploy task described above on a daily basis to make sure our fallback bundles reflect any bugfixes and new features released in the polyfill service.
  • Versioning of the bundle in s3