{"name":"native-url","version":"0.2.2","description":"Brings the node url api layer to whatwg-url class","source":"src/index.js","main":"dist/index.js","module":"dist/index.mjs","typings":"index.d.ts","scripts":{"build":"microbundle","test:browser":"karmatic","test:node":"jest","pretest":"yarn run build","test":"jest && karmatic"},"author":{"name":"Janicklas Ralph"},"license":"Apache-2.0","dependencies":{"querystring":"^0.2.0"},"peerDependencies":{"@types/node":">=8.0.0"},"repository":{"type":"git","url":"git+https://github.com/GoogleChromeLabs/native-url.git"},"bugs":{"url":"https://github.com/GoogleChromeLabs/native-url/issues"},"homepage":"https://github.com/GoogleChromeLabs/native-url#readme","keywords":["url","uri","normalization","normalisation","query","querystring","whatwg-url","parse","format","resolve","resolveObject"],"devDependencies":{"husky":"^3.0.5","jest":"^24.9.0","karmatic":"^1.4.0","lint-staged":"^9.2.5","microbundle":"^0.11.0","prettier":"^1.18.2","webpack":"^4.41.2"},"lint-staged":{"{src,tests}/**/*.js":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"yarn run test && lint-staged"}},"gitHead":"262cc5bbd3839ed2c3f51bbd61f2c407400231cf","_id":"native-url@0.2.2","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-X4a7YwNjY0ZxWIibqUuILfg7EaV2alawCgRZeczemcyTwOMYz5/zjR6l3nnDLARHl2sLlNbqk2A7ysb0atoYjA==","shasum":"a0e1ece7753a17d155068214872e81d7d322b410","tarball":"http://registry-npm.ywwl.com/native-url/download/native-url-0.2.2.tgz","fileCount":21,"unpackedSize":142303,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd3XRKCRA9TVsSAnZWagAADvcQAIKMhbywGia1+PNHO/mm\n70kqZkGCfix3rjAF2EXbnrrDYcS+9cLWeef/rUi46z5gxXrkHNqK0+b+o5Bd\n9gcs6EZqvH+FbzK9xlIYx96nDs6KFyYjJf40YnnYK+4igWltGdM9i5CshRNN\npn451EGKGPrIg9kHmKajY1V+wY+nm594SqjemuOwkPX08Rhcr+QJK1Na6UsX\njfJpWHCfP48Xnia59COu+pSaZochzcIzLfnWnOHbZRla2LJ++nQNNaSqE519\nu2vUBGhktUjzTag1AwqnZKX2fEyq5KgscDp21wUHKucktRDPvbMK93Qa8IYb\nBgdpA/az32bEsNCCdRBWEN5m3LpTD/pv/e7rb4dyW6c2BO+KRaBzW+4/A6Zs\nLZgvhciUfkSLgOd8dckG3avX91jMbsmuVjFfEqAFkTfq7AaXAbZDtOF2Hexk\nGcZi+Z93tXKlBrZwiVm3L4vruVUh4YS6VNyLjQI8AOgflF9Nh/G8b4AR8ZOn\n4Zd+Lp219+Hy6/9/Wza9hiWPu/BYfSQy5rfyExqxJRNHX58XpMFhV6sSCey+\nzMUH8TNpLo6koeFHdJXzhiFcSQ1KWb82bUWNperLxW6au61j5VLsJRpgI1IV\n43eWB+XvxAaAWp8qGXxHf+O1ZvOT1I5LUR8VkalaU6X+sCuH4jXuxb1Q2AtW\nnetH\r\n=FeSv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH1DModL6c6ClDiABhISXewhWN+vD62amhe3dFM320X1AiBXALZ8iiuuPD8GVBEd+axkDoLwoxcil0GqLwUWjN1AzQ=="}],"size":26297,"noattachment":false,"key":"/native-url/-/native-url-0.2.2.tgz"},"maintainers":[{"email":"janicklasralph036@gmail.com","name":"janicklas-ralph"}],"_npmUser":{"name":"janicklas-ralph","email":"janicklasralph036@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/native-url_0.2.2_1574794313894_0.8915497388327389"},"_hasShrinkwrap":false,"readme":"# native-url [![npm package version](https://badgen.net/npm/v/native-url)](https://npm.im/native-url) [![bundle size](https://badgen.net/bundlephobia/minzip/native-url)](https://bundlephobia.com/result?p=native-url) [![github license](https://badgen.net/github/license/GoogleChromeLabs/native-url)](https://github.com/GoogleChromeLabs/native-url/blob/master/LICENSE)\n\nA lightweight implementation of Node's [url](http://nodejs.org/api/url.html) interface atop the [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL). Use it instead of the `url` module to reduce your bundle size by around 7.5 kB.\n\nWeighs **1.6 kB gzipped**, works in Node.js 7+ and [all modern browsers](https://caniuse.com/#feat=mdn-api_url):\n\n![Chrome 32, Firefox 19, Safari 7, Edge 12, Opera 19](https://badges.herokuapp.com/browsers?googlechrome=32&firefox=19&safari=7&microsoftedge=12&opera=19)\n\nOlder browsers can be [easily polyfilled](#polyfill-for-older-browsers) without new browsers loading the code.\n\n## Installation\n\n```sh\nnpm i native-url\n```\n\n## Usage\n\n```js\nconst url = require('native-url');\n\nurl.parse('https://example.com').host; // example.com\nurl.parse('/?a=b', true).query; // { a: 'b' }\n```\n\n### Usage with Webpack\n\nWhen you use the `url` module, webpack bundles [`node-url`](https://github.com/defunctzombie/node-url) for the browser. You can alias webpack to use `native-url` instead, saving around 7.5kB:\n\n```js\n// webpack.config.js\nmodule.exports = {\n  // ...\n  resolve: {\n    alias: {\n      url: 'native-url',\n    },\n  },\n};\n```\n\nThe result is **functionally equivalent** in Node 7+ and all modern browsers.\n\n### Usage with Rollup\n\nRollup does not bundle shims for Node.js modules like `url` by default, but we can add `url` support via `native-url` using aliases:\n\n```js\n// rollup.config.js\nimport resolve from 'rollup-plugin-node-resolve';\nimport alias from '@rollup/plugin-alias';\n\nmodule.exports = {\n  // ...\n  plugins: [\n    resolve(),\n    alias({\n      entries: {\n        url: 'native-url',\n      },\n    }),\n  ],\n};\n```\n\nWith this in place, `import url from 'url'` will use `native-url` and keep your bundle small.\n\n## API\n\nRefer Node's [legacy url documentation](https://nodejs.org/api/url.html#url_legacy_url_api) for detailed API documentation.\n\n### `url.parse(urlStr, [parseQueryString], [slashesDenoteHost])`\n\nParses a URL string and returns a URL object representation:\n\n```js\nurl.parse('https://example.com');\n// {\n//   href: 'http://example.com/',\n//   protocol: 'http:',\n//   slashes: true,\n//   host: 'example.com',\n//   hostname: 'example.com',\n//   query: {},\n//   search: null,\n//   pathname: '/',\n//   path: '/'\n// }\n\nurl.parse('/foo?a=b', true).query.a; // \"b\"\n```\n\n### `url.format(urlObj)`\n\nGiven a parsed URL object, returns its corresponding URL string representation:\n\n```js\nurl.format({ protocol: 'https', host: 'example.com' });\n// \"https://example.com\"\n```\n\n### `url.resolve(from, to)`\n\nResolves a target URL based on the provided base URL:\n\n```js\nurl.resolve('/a/b', 'c');\n// \"/a/b/c\"\nurl.resolve('/a/b', '/c#d');\n// \"/c#d\"\n```\n\n## Polyfill for Older Browsers\n\n`native-url` relies on the DOM [URL API](https://developer.mozilla.org/en-US/docs/Web/API/URL) to work. For older browsers that don't support the `URL` API, a [polyfill](https://www.npmjs.com/package/url-polyfill) is available.\n\nConveniently, a polyfill is never needed for [browsers that support ES Modules](https://caniuse.com/#feat=es6-module), so we can use `<script nomodule>` to conditionally load it for older browsers:\n\n```html\n<script nomodule src=\"/path/to/url-polyfill.js\"></script>\n```\n","publish_time":1574794314087,"_cnpm_publish_time":1574794314087,"dist-tags":{"latest":"0.3.4"}}