{"name":"native-url","version":"0.3.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","unpkg":"dist/index.umd.js","jsdelivr":"dist/index.umd.js","scripts":{"build":"microbundle","test:browser":"karmatic","test:node":"jest","pretest":"yarn run build","test":"jest && karmatic","release":"release-it"},"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":"^4.2.3","jest":"^25.2.6","karmatic":"^1.4.0","lint-staged":"^10.1.1","microbundle":"^0.11.0","prettier":"^2.0.2","release-it":"^13.5.1","webpack":"^4.41.2"},"lint-staged":{"{src,tests}/**/*.js":["prettier --write","git add"]},"husky":{"hooks":{"pre-commit":"yarn run test && lint-staged"}},"gitHead":"0c5aec20a765bc6a396b6066abf6951dbb5d000d","_id":"native-url@0.3.4","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-6iM8R99ze45ivyH8vybJ7X0yekIcPf5GgLV5K0ENCbmRcaRIDoj37BC8iLEmaaBfqqb8enuZ5p0uhY+lVAbAcA==","shasum":"29c943172aed86c63cee62c8c04db7f5756661f8","tarball":"http://registry-npm.ywwl.com/native-url/download/native-url-0.3.4.tgz","fileCount":10,"unpackedSize":94702,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe+kVJCRA9TVsSAnZWagAAC9EP+gIWi2S+rJPFZTfPl+Id\nHylq11ZafBD6Hun83jARKzUMt5mk/mY2+hehJUxaLae+87kBcwvah+/kDvUU\nVxyriqQTVGhu39Y2ttthKlBakIKL6WmRarnhGCQwYf/4vwv4qX6Lr2/d7Vfo\nxOQ5RU+2UG9h7lcTF6MIBxF8pAuQsRqTQB2rSBuwCtahyT8yxJnRQJBFS1Wb\nOLKg3EJoHQKUlZ9YzEmGKaKu4zY+nitEin114Qbdt351MGzgS5iL/h6vKrM7\nQErrZHP++ENwT4Flc+IsrVilwezW37sFC6d1SXY+KnpDNhZVdf7RdmbbRirq\nntKryItJn3pbdrOrqaMVcBs48E7ph2GfA1HgKgTCfD0346tUo6b9/Ygd1FbS\nqqtY7GVEq8G2Wl89TLVPRDBJZLc6aA9RLr8sggVAvmpr4JGXTWoNDW3H8wMN\nN8IU/SaYtWVQhNnVJMbd5aLPTxMPI7YH9lGix8l8/SnKeUFe1a0iAKu83zZm\ns0PrTjrtgJwNhZs1zq/c/tJvyOlEE99d5M/0m0SlIfPUuvb6974ye3dhg3VA\n2uwCvD4ozLKNf672q6bMBpiXsBHbKhVebLuX6rCUXp6Iy3YH9bVdwmGEvIN7\nGmbc5gfMJ3l3bTZgZc+JK/D/d/X1dT609ESRT3xF8S8PAX58NBSWftA2kbmN\nN1To\r\n=jeOs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDidJgwSXWX2yRy/iXfcEvtjMDbOVq/wESGznT9DwfdSQIhAOVnNCXjYBUhwj9Mv8IpCFginfT/YE/3T4sT37IenPJH"}],"size":18935,"noattachment":false,"key":"/native-url/-/native-url-0.3.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.3.4_1593460041321_0.18984982589570842"},"_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":1593460041524,"_cnpm_publish_time":1593460041524,"dist-tags":{"latest":"0.3.4"}}