{"_id":"@brad-jones/dynamic-polyfill-sync","_rev":"5-428fb8bbe4b758b49e763a3d806581cc","name":"@brad-jones/dynamic-polyfill-sync","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@brad-jones/dynamic-polyfill-sync","version":"0.1.0","author":{"name":"Brad Jones","email":"brad@bjc.id.au"},"license":"MIT","_id":"@brad-jones/dynamic-polyfill-sync@0.1.0","maintainers":[{"name":"gears","email":"brad@bjc.id.au"}],"homepage":"https://github.com/brad-jones/dynamic-polyfill-sync#readme","bugs":{"url":"https://github.com/brad-jones/dynamic-polyfill-sync/issues"},"dist":{"shasum":"f756ca936e948d41703c516a1c146e2ec58f14f1","tarball":"https://registry.npmjs.org/@brad-jones/dynamic-polyfill-sync/-/dynamic-polyfill-sync-0.1.0.tgz","integrity":"sha512-WBEzUdTnEmorfHzdHBUIjGh/mtvkDCFJTHupA/tJkLYTVZFS7XFUlIQBZKLAHGdUuT3ZeJ1cmMXecT8o3+aYKA==","signatures":[{"sig":"MEQCIFBYGZJAybZMTHppv4mbC4XK+moXKo1oqhd9JC33oubqAiA5KzcJouo6Js44qyWTeNocrSpE/hn7ssjzzfC9Q4jrDA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./dist/index.js","types":"./dist/index.d.ts","gitHead":"f4034dd23133763e49c684b34d86f7edb5dd8d89","scripts":{"test":"ts-node -P ./tests/tsconfig.json ./tests/sl-runner.ts","build":"rollup --config rollup.config.js","clean":"shx rm -rf ./dist","commit":"commit","rebuild":"yarn clean; yarn build;","unleash":"unleash --type=`yarn run -s conventional-recommended-bump --preset angular`","commitmsg":"commitlint -e"},"_npmUser":{"name":"gears","email":"brad@bjc.id.au"},"repository":{"url":"git+https://github.com/brad-jones/dynamic-polyfill-sync.git","type":"git"},"_npmVersion":"5.4.2","description":"A synchronous version of dynamic-polyfill.","_nodeVersion":"8.8.1","publishConfig":{"access":"public"},"devDependencies":{"ora":"^1.3.0","shx":"^0.2.2","uuid":"^3.1.0","axios":"^0.17.0","chalk":"^2.3.0","husky":"^0.14.3","listr":"^0.13.0","rollup":"^0.50.0","ts-node":"^3.3.0","unleash":"^2.0.0-beta.6","typescript":"^2.5.3","@types/node":"^8.0.47","@types/uuid":"^3.4.3","@commitlint/cli":"^4.2.1","git-last-commit":"^0.3.0","local-web-server":"^2.2.4","browserstack-local":"^1.3.0","rollup-plugin-uglify":"^2.0.1","@commitlint/prompt-cli":"^4.2.1","sauce-connect-launcher":"^1.2.2","rollup-plugin-typescript2":"^0.7.0","@commitlint/config-angular":"^4.2.1","conventional-recommended-bump":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/dynamic-polyfill-sync-0.1.0.tgz_1509339491621_0.3892256247345358","host":"s3://npm-registry-packages"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.1.1":{"name":"@brad-jones/dynamic-polyfill-sync","version":"0.1.1","author":{"name":"Brad Jones","email":"brad@bjc.id.au"},"license":"MIT","_id":"@brad-jones/dynamic-polyfill-sync@0.1.1","maintainers":[{"name":"gears","email":"brad@bjc.id.au"}],"homepage":"https://github.com/brad-jones/dynamic-polyfill-sync#readme","bugs":{"url":"https://github.com/brad-jones/dynamic-polyfill-sync/issues"},"dist":{"shasum":"83e4644c90a58a34a8b41db437f85e102b478697","tarball":"https://registry.npmjs.org/@brad-jones/dynamic-polyfill-sync/-/dynamic-polyfill-sync-0.1.1.tgz","integrity":"sha512-+k/PjXVAs5p4YtSg6td/fb/aa7ocHzfoTqaic+f1NUi7a19AwxNvDGCby95SvPezkcYn+jzQE2tbi4D3oFclnw==","signatures":[{"sig":"MEQCIDIR0xbLPEa24Pn9TveInSGJQVwaxID69qcR8WS2Dv9IAiBRmB3vZIhAUjUx5VmEIdlRXlS7VhvaB7OSo3YbkeKaKQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./dist/index.js","types":"./dist/index.d.ts","gitHead":"53ad1a5c0e2ebaa5c809039fe4d5853b28b77e81","scripts":{"test":"ts-node -P ./tests/tsconfig.json ./tests/sl-runner.ts","build":"rollup --config rollup.config.js","clean":"shx rm -rf ./dist","commit":"commit","rebuild":"yarn clean; yarn build;","unleash":"unleash --type=`yarn run -s conventional-recommended-bump --preset angular`","commitmsg":"commitlint -e"},"_npmUser":{"name":"gears","email":"brad@bjc.id.au"},"repository":{"url":"git+https://github.com/brad-jones/dynamic-polyfill-sync.git","type":"git"},"_npmVersion":"5.4.2","description":"A synchronous version of dynamic-polyfill.","_nodeVersion":"8.8.1","publishConfig":{"access":"public"},"devDependencies":{"ora":"^1.3.0","shx":"^0.2.2","uuid":"^3.1.0","axios":"^0.17.0","chalk":"^2.3.0","husky":"^0.14.3","listr":"^0.13.0","rollup":"^0.50.0","ts-node":"^3.3.0","unleash":"^2.0.0-beta.6","typescript":"^2.5.3","@types/node":"^8.0.47","@types/uuid":"^3.4.3","@commitlint/cli":"^4.2.1","git-last-commit":"^0.3.0","local-web-server":"^2.2.4","browserstack-local":"^1.3.0","rollup-plugin-uglify":"^2.0.1","@commitlint/prompt-cli":"^4.2.1","sauce-connect-launcher":"^1.2.2","rollup-plugin-typescript2":"^0.7.0","@commitlint/config-angular":"^4.2.1","conventional-recommended-bump":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/dynamic-polyfill-sync-0.1.1.tgz_1509339649164_0.4087074897252023","host":"s3://npm-registry-packages"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.2.0":{"name":"@brad-jones/dynamic-polyfill-sync","version":"0.2.0","author":{"name":"Brad Jones","email":"brad@bjc.id.au"},"license":"MIT","_id":"@brad-jones/dynamic-polyfill-sync@0.2.0","maintainers":[{"name":"gears","email":"brad@bjc.id.au"}],"homepage":"https://github.com/brad-jones/dynamic-polyfill-sync#readme","bugs":{"url":"https://github.com/brad-jones/dynamic-polyfill-sync/issues"},"dist":{"shasum":"876da709086e2ef8e740a720e559a48d1fa3977c","tarball":"https://registry.npmjs.org/@brad-jones/dynamic-polyfill-sync/-/dynamic-polyfill-sync-0.2.0.tgz","integrity":"sha512-xeYRJ9cqU79huV7gERrT9gaiIxUayXU5aOuP8rUNmk9LguzIQkzQ5obzvrqo3R8lyaIQFAl1oYekOq5JjrMxiQ==","signatures":[{"sig":"MEUCIQCkkDbchz1spqAm6GKUXF/Z+fhtx0VRDKXDtaWC0LBp9gIgPpN41ilaZwhkkWL1sznkmbIPmiePnAR8jG1XvnYCoM0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./dist-cjs/index.js","types":"./typings/index.d.ts","module":"./dist-esm/index.js","browser":"./dist-browser/index.js","gitHead":"a72319b063c40f195949ef5402df50ef9d6850d1","scripts":{"test":"ts-node -P ./tests/tsconfig.json ./tests/sl-runner.ts","build":"yarn build-cjs; yarn build-esm; yarn build-browser;","clean":"shx rm -rf ./dist*; shx rm -rf ./typings; shx rm -rf ./.rpt2_cache","commit":"commit","rebuild":"yarn clean; yarn build;","unleash":"unleash --type=`yarn run -s conventional-recommended-bump --preset angular`","build-cjs":"tsc -P ./src/tsconfig.json --outDir ./dist-cjs -m commonjs -d --declarationDir ./typings","build-esm":"tsc -P ./src/tsconfig.json --outDir ./dist-esm","commitmsg":"commitlint -e","build-browser":"rollup --config rollup.config.js"},"_npmUser":{"name":"gears","email":"brad@bjc.id.au"},"repository":{"url":"git+https://github.com/brad-jones/dynamic-polyfill-sync.git","type":"git"},"_npmVersion":"5.4.2","description":"A synchronous version of dynamic-polyfill.","jsnext:main":"./dist-esm/index.js","_nodeVersion":"8.8.1","publishConfig":{"access":"public"},"devDependencies":{"ora":"^1.3.0","shx":"^0.2.2","uuid":"^3.1.0","axios":"^0.17.0","chalk":"^2.3.0","husky":"^0.14.3","listr":"^0.13.0","rollup":"^0.50.0","ts-node":"^3.3.0","unleash":"^2.0.0-beta.6","typescript":"^2.5.3","@types/node":"^8.0.47","@types/uuid":"^3.4.3","@commitlint/cli":"^4.2.1","git-last-commit":"^0.3.0","local-web-server":"^2.2.4","browserstack-local":"^1.3.0","rollup-plugin-uglify":"^2.0.1","@commitlint/prompt-cli":"^4.2.1","sauce-connect-launcher":"^1.2.2","rollup-plugin-typescript2":"^0.7.0","@commitlint/config-angular":"^4.2.1","conventional-recommended-bump":"^1.0.2"},"_npmOperationalInternal":{"tmp":"tmp/dynamic-polyfill-sync-0.2.0.tgz_1509357447992_0.9129543809685856","host":"s3://npm-registry-packages"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.3.0":{"name":"@brad-jones/dynamic-polyfill-sync","version":"0.3.0","author":{"name":"Brad Jones","email":"brad@bjc.id.au"},"license":"MIT","_id":"@brad-jones/dynamic-polyfill-sync@0.3.0","maintainers":[{"name":"gears","email":"brad@bjc.id.au"}],"homepage":"https://github.com/brad-jones/dynamic-polyfill-sync#readme","bugs":{"url":"https://github.com/brad-jones/dynamic-polyfill-sync/issues"},"dist":{"shasum":"1b8d5765ddb747c399202039941fe1e4ad17009e","tarball":"https://registry.npmjs.org/@brad-jones/dynamic-polyfill-sync/-/dynamic-polyfill-sync-0.3.0.tgz","integrity":"sha512-RLrIWUCTrheC9KEMOPd21V9QCMeKqur+3BLi+lE7F69ZjxA7Os6bzAneCB+OZcmEpf7LQJ6eUloxAcvBjhpRmA==","signatures":[{"sig":"MEUCIQC0RBC7kKCui9kzybo13z5eIjxQ6jqFP3LJhilVBP6zeAIgAzFQ3LVg7PK691z2r+x4hedJK+HQraVmAnmaKcdoSdM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./dist-cjs/index.js","types":"./typings/index.d.ts","module":"./dist-esm/index.js","browser":"./dist-browser/index.js","gitHead":"b1eca5900715fe7b639a782c41c525f5ad194f99","release":{"verifyConditions":"condition-circle"},"scripts":{"test":"ts-node -P ./tests/tsconfig.json ./tests/sl-runner.ts","build":"yarn build-cjs; yarn build-esm; yarn build-browser;","clean":"shx rm -rf ./dist*; shx rm -rf ./typings; shx rm -rf ./.rpt2_cache","commit":"commit","rebuild":"yarn clean; yarn build;","build-cjs":"tsc -P ./src/tsconfig.json --outDir ./dist-cjs -m commonjs -d --declarationDir ./typings","build-esm":"tsc -P ./src/tsconfig.json --outDir ./dist-esm","commitmsg":"commitlint -e","build-browser":"rollup --config rollup.config.js","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"_npmUser":{"name":"gears","email":"brad@bjc.id.au"},"repository":{"url":"git+https://github.com/brad-jones/dynamic-polyfill-sync.git","type":"git"},"_npmVersion":"5.5.1","description":"A synchronous version of dynamic-polyfill.","jsnext:main":"./dist-esm/index.js","_nodeVersion":"8.9.0","publishConfig":{"access":"public"},"devDependencies":{"ora":"^1.3.0","shx":"^0.2.2","uuid":"^3.1.0","axios":"^0.17.0","chalk":"^2.3.0","husky":"^0.14.3","listr":"^0.13.0","rollup":"^0.50.0","ts-node":"^3.3.0","typescript":"^2.5.3","@types/node":"^8.0.47","@types/uuid":"^3.4.3","@commitlint/cli":"^4.2.1","git-last-commit":"^0.3.0","condition-circle":"^1.5.0","local-web-server":"^2.2.4","semantic-release":"^8.2.0","browserstack-local":"^1.3.0","rollup-plugin-uglify":"^2.0.1","semantic-release-cli":"^3.2.4","@commitlint/prompt-cli":"^4.2.1","sauce-connect-launcher":"^1.2.2","rollup-plugin-typescript2":"^0.7.0","@commitlint/config-angular":"^4.2.1"},"_npmOperationalInternal":{"tmp":"tmp/dynamic-polyfill-sync-0.3.0.tgz_1510035499967_0.5277144582942128","host":"s3://npm-registry-packages"},"directories":{},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2017-10-30T04:58:12.675Z","modified":"2025-01-22T07:46:59.009Z","0.1.0":"2017-10-30T04:58:12.675Z","0.1.1":"2017-10-30T05:00:50.233Z","0.2.0":"2017-10-30T09:57:29.070Z","0.3.0":"2017-11-07T06:18:21.067Z"},"bugs":{"url":"https://github.com/brad-jones/dynamic-polyfill-sync/issues"},"author":{"name":"Brad Jones","email":"brad@bjc.id.au"},"license":"MIT","homepage":"https://github.com/brad-jones/dynamic-polyfill-sync#readme","repository":{"url":"git+https://github.com/brad-jones/dynamic-polyfill-sync.git","type":"git"},"description":"A synchronous version of dynamic-polyfill.","maintainers":[{"name":"gears","email":"brad@bjc.id.au"}],"readme":"# dynamic-polyfill-sync\n[![CircleCI](https://circleci.com/gh/brad-jones/dynamic-polyfill-sync.svg?style=svg)](https://circleci.com/gh/brad-jones/dynamic-polyfill-sync)\n[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-blue.svg)](https://www.typescriptlang.org/)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)  \n[![Build Status](https://saucelabs.com/browser-matrix/dynamic-polyfill-sync.svg)](https://saucelabs.com/u/dynamic-polyfill-sync)\n\n__TLDR:__ A synchronous version of [dynamic-polyfill](https://github.com/PascalAOMS/dynamic-polyfill).\n\nThis package provides an IE8+ solution that will run feature detection across\nrequired polyfills, in the event the browser does actully require a polyfill\nonly then will this use a _\"synchronous\"_ `XMLHttpRequest` to the\nhttps://polyfill.io service.\n\n## Usage\nDownload and install with Npm/Yarn:\n\n```\nnpm install @brad-jones/dynamic-polyfill-sync --save\n```\n\nOR\n\n```\nyarn add @brad-jones/dynamic-polyfill-sync\n```\n\nThen in your library entry point _(usually index.js)_:\n\n```js\nimport polyfill from '@brad-jones/dynamic-polyfill-sync';\npolyfill(['Promise', 'Symbol', 'Object.assign', 'etc...']);\n\nexport * from './FooModule';\nexport * from './BarModule';\n```\n\n### Providing a custom polyfill.io url\n```js\npolyfill(['fills...'], 'https://cdn.custom-polyfill-service.com/v2');\n```\n\n## Why?\nAs a library developer, I want to develop using modern JavaScript standards\nbut I also want my library to be as compatible as it can be, so like we all do\nthese days I use a transpiler, usually [TypeScript](https://www.typescriptlang.org/).\n\nHowever thats only half the story my library also needs to have polyfills\ninstalled when running in older javascript engines. In the past I would have\nincluded these polyfills with my build.\n\nThe problem with this is that firstly a modern browser that doesn't require the\npolyfills pays the performance hit of having to load them. And secondly if I\nhave multiple library packages that I want to use they will all duplicate some\nof the polyfills.\n\nRead more:\n\n- http://anzorb.com/we-dont-need-your-polyfills/\n- https://philipwalton.com/articles/loading-polyfills-only-when-needed/\n\n## Yeah and so...\nWell I then came across this project: [dynamic-polyfill](https://github.com/PascalAOMS/dynamic-polyfill).\nAnd I thought it had solved all my problems. And yes if I was building an\n__\"APP\"__ it would solve all my polyfilling needs. But I am building a __\"Library\"__.\n\nI played around with wrapping my code in a _dynamic-polyfill_ callback, which\nworked for sure but it created issues around bundling and just didn't feel nice\nto use in a project that was consuming the library.\n\nNow I could tell my library users that they are responsibile for providing the\npolyfills but then my package doesn't have a _\"just works\"_ option, which I\nbelieve is vitally important for intially learning and evaluating a new library.\n\n## Synchronous... really this doen't sound great\nYeah ok I get it Synchronous XHR requests are not best practise due to blocking\nthe main UI thread of the browser or even the entire browser in some cases.\n\nI believe asking the browser to load it's polyfills synchronously is one of\nthose acceptable edge cases. The javascript isn't going to work without the\npolyfills anyway.\n\nDue to the fact that we perform feature detection, a modern broswer will never\nperform the blocking synchronous request.\n\nAnd so now my library code will _\"just work\"_.\n\n## Multiple libraries\nIf you loaded multiple scripts that used this package to load their polyfills,\nthe first library might load most of the polyfills and the second might only\nneed to load a few extra ones, again because we are doing feature detection.\nSo yes multiple requests might end up being made to https://polyfill.io but\nnot for the same content.\n\n## Know Issues\nActually after heaps of testing (via SauceLabs / BrowserStack), it appears that IE8 & 9 will load a CORS resource so long as it is over HTTPS, using the normal old `XMLHttpRequest`.\n\nI actually had it all working in IE8 with `XDomainRequest` but it would not work in IE9. I then dropped the use of `XDomainRequest` altogether and it worked in both IE8 & 9.\n\nHonestly I still don't get it as it appears to contradict all the documnetation. Until someone comes along and says it doesn't work I am not going to look at it any further.\n\n~~IE8 & 9 do not offer a standards compliant CORS implementation of `XMLHttpRequest`.\nInstead we use `XDomainRequest` which works but there are a few restrictions.~~\n\n> 7. ~~Requests must be targeted to the same scheme as the hosting page.\n     This restriction means that if your AJAX page is at http://example.com,\n     then your target URL must also begin with HTTP. Similarly, if your\n     AJAX page is at https://example.com, then your target URL must also\n     begin with HTTPS.~~\n\n~~Read more: https://goo.gl/GPY87s~~\n","readmeFilename":"README.md"}