{"name":"native-url","version":"0.1.1","description":"Brings the node url api layer to whatwg-url class","source":"src/index.js","main":"dist/index.js","module":"dist/index.mjs","scripts":{"build":"microbundle","test":"yarn run build && jest"},"author":{"name":"Janicklas Ralph"},"license":"MIT","dependencies":{"querystring":"^0.2.0"},"repository":{"type":"git","url":"git+https://github.com/janicklas-ralph/native-url.git"},"bugs":{"url":"https://github.com/janicklas-ralph/native-url/issues"},"homepage":"https://github.com/janicklas-ralph/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","lint-staged":"^9.2.5","microbundle":"^0.11.0","prettier":"^1.18.2"},"lint-staged":{"linters":{"{src,tests}/**/*.js":["prettier --write","git add"]}},"husky":{"hooks":{"pre-commit":"yarn run test && lint-staged"}},"_id":"native-url@0.1.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-s6SJ1KEYIu8G9lAx5enMoa4z51aZM2AcNSV9tQF69F9LKSNERinOm01B9YlVhSYBsdU5fnhTCP2BvuiWr7gy3w==","shasum":"3ac64d833a4c74beb1c6d81543a288c71666308a","tarball":"http://registry-npm.ywwl.com/native-url/download/native-url-0.1.1.tgz","fileCount":16,"unpackedSize":109049,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdiTxMCRA9TVsSAnZWagAAGTgP/RWgmJQpwEEQ8L3akoZZ\nWfwY4x+u7wa2WT5G+Hz/E2RPy7exFlYLv2d1X5Thjx0oeaIrZ4xAZTSsDfkV\nZVjzD0Br5RtdaPpVLMAWUvNTwM8gKBC370bC0eoNjhxj+fv3AdFCwfpwUG3U\nE8fllQhYdiujKcoZ42RHURG/AUlKEYJVcv7/U+wlh9i19at4Aw1xRQrKF/st\ndet9FUO2ZMv604lF/6DAqVqcmQEGJf0ov5PWCyn7Bsne0HEhgwss8TT88oJU\nVLjwsISToITKWIHLZu4hqJ/aWYWLpQTk2g49uO5DK/Y5geN7YKJs9Hf62ijn\nCYDpAj2jffaLF5eZzuMMCLhM8XiGQZRBd0ZxDwsKzYYowGVxwDKwKGSsXgAn\nyzzCv3SaLlSkEZisLMLzvdwJ+DxCwCOoLWQ0M6Zdoua/eOLFuBr8gJ0d+uos\nMv7VOEOIg0gRttOo7giykZiSS8zdl3yy8B1kEJ5ePM9GPxsZBLRCGH1cSBui\nOKwRCDf30afrJpy2Wakw4Li84UAf6A6bayrh6DDVyYRklfgsCGcUzrg1/KOD\nj5sR++WCzoGsLjI3lNzzhhzHJFJWKSLDg0/mUrJHdWuE80ewa9Vua4SYKVx0\npmCP14Q+ALt+3EDI3XGYoutMvs2/uU9YoISbCOm4grLWl0zomZ/7vcZXtePg\nrhCM\r\n=bcQV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE88tKB2TWGouMoPv8KCbgHNUY+lRULArNSngTIOK3aPAiEAypVkIM7lSCPvp8z6HhZyvexDzZk0vA4yurhv5Lf8TH4="}],"size":18873,"noattachment":false,"key":"/native-url/-/native-url-0.1.1.tgz"},"maintainers":[{"name":"janicklas-ralph","email":"janicklasralph036@gmail.com"}],"_npmUser":{"name":"janicklas-ralph","email":"janicklasralph036@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/native-url_0.1.1_1569274956015_0.165822752146088"},"_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":1569274956143,"_cnpm_publish_time":1569274956143,"dist-tags":{"latest":"0.3.4"}}