{"name":"native-url","version":"0.2.4","description":"Brings the node url api layer to whatwg-url class","source":"src/index.js","main":"dist/index.js","module":"dist/index.mjs","typings":"third_party/url.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"},"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":"1870af4dc8e05dde5b7408a2bf3d1ff621dc29cc","_id":"native-url@0.2.4","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-McE+8BrgMw2ANypdYX9s1L+aUkbWDCEtsBGIbs8TfKBfQrFcZ2jMXX9LxGjOIOtoRXkwLTSlz38XHm8J3U6hgQ==","shasum":"37623b3db2c7bb6670e50e379634248ba5ca9d90","tarball":"http://registry-npm.ywwl.com/native-url/download/native-url-0.2.4.tgz","fileCount":21,"unpackedSize":148681,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd9/fnCRA9TVsSAnZWagAArxkP/0AJuFDaREUe9kFH3uWq\no5gzBBj6wH319PGNGUziJqRNQEnjvvy8FrgWj/ML/V4rcJ/zejy/FeDC8Ta4\nIHWTlTXLweUKeRlfzp70Gkk06Rez/FUMME9EjS+EfB5Y/8TjXPgFlEwyFOo+\n79WGNcuvUHXoOmdo7LXN5dfb0iqMQGTvJMa1pbXiQNRkdvzHMil6Ty1JFivN\nRSQ99QS9aFEWhnHicZAV1ptb0Q5PBTh5L2vjGtQtg7FnCFQ+KX9x1DVu+tjm\nXyj+95GTOgWujjZeLSLVUF6cirolTCNHX4qc3c/Nvn06DEDT9mUCGpHGYTx6\nzh2pVVkCYvj5VF3UKnuw3BKHC8srYdTTBklsTIyZkRFVtBCLAMELM9NIl33b\nEIjzU7Z25Mrnov5fx05RABWq9XiJ42FKEnjVUCFvkg7QwOxPsXCR18ze4DgX\nHLAP73PpJxMhXZm5ziV+Qj8e3lOkxy2/5bkJXWf1yGObf/7qo4IROgoZVkdY\n2GkOO9io+CB6mrI1InsQO2AqH1Neyel92MN8DasFMoxOj5sfY65A6N97OSDU\nArcblvbKd1JDPOqJJCyu2IlzrcPZr9wu8yFS/H/OmuIPPrqIGLbWMRv99kbf\nTOk7HeysQMYfk9mzKe6GJMUXFmdtI/uKBUdmkHURulkzicCz2UpSPawBon6S\ntUPM\r\n=N1M6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAyLUm51HKaf8mbsGWvEjvMhPyiTTq13tqevUrtv+pa/AiEAo9EwFQYgkjfxGRChoYXW2pDPesHOIXfZsqFXCccS0yc="}],"size":28707,"noattachment":false,"key":"/native-url/-/native-url-0.2.4.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.4_1576531943037_0.8540914193415832"},"_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":1576531943166,"_cnpm_publish_time":1576531943166,"dist-tags":{"latest":"0.3.4"}}