{"_id":"route-manifest","_rev":"3-785eabb862d514d1a0c71bc4cad4678f","name":"route-manifest","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0":{"name":"route-manifest","version":"0.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/route-manifest.git"},"description":"WIP","unpkg":"dist/manifest.min.js","module":"dist/manifest.mjs","main":"dist/manifest.js","umd:name":"manifest","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">= 6"},"scripts":{"build":"node builder","pretest":"npm run build","test":"tape test/*.js | tap-spec"},"keywords":[],"dependencies":{"regexparam":"^1.3.0"},"devDependencies":{"gzip-size":"5.1.1","mk-dirs":"2.0.0","pretty-bytes":"^4.0.2","tap-spec":"5.0.0","tape":"4.11.0","terser":"4.1.4"},"gitHead":"dfae7d5b9bca3eac1d1a6e0ece70e532fba5240b","bugs":{"url":"https://github.com/lukeed/route-manifest/issues"},"homepage":"https://github.com/lukeed/route-manifest#readme","_id":"route-manifest@0.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-MY/ICJMVpH7hI+KNOea5Gm+K/M9VJVC9T8iUInvJ//jHHVHIMkzryc42cfz6E+QiIJcuLD9pVzD5ZPzBZiqydg==","shasum":"a8ffe04920dcadea94217debf7836d0f01b1923e","tarball":"https://registry.npmjs.org/route-manifest/-/route-manifest-0.0.0.tgz","fileCount":5,"unpackedSize":3854,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdWfiGCRA9TVsSAnZWagAAFAQQAIeKSzjjklwx41xK52qu\nQFooKTOd/qFxnSZtmVFbT55b67jeZP1/dVhFhPvyXQ5REbWHxa/Zi048Tr6Q\najySrpqc6ve5N2Ne3pLRQJFV2c6iZXhJDVFviI+PE5oA6AAXWHzRZFaXWV3L\nvchQfbPAWJEquY4DMoLYYIrRONnjk9Yc/tSLI7hHCEFmECPn2/mXjTC5N2zi\nyA9M4gQrLsCqY47PkNK6y7XlcgXQvLtC0z/3/5PXbSbYWtPuxufePjiHQxsa\n9PWQYW62/0oijGLkzu53w1LVKzBwAmkd71ApqcLj5nE0IHhNd31Rt9gTaooo\npLLiZpDfZu8N1bGQBwu9FaCBizwy/ag7bViCnxp/sX8znFOLnQ847f3TBXMU\n0Go09DfavvmP2q5wbT4uknnvrB5W4vNXykrtceQOlaP9DguyfVuyIRRRRZ0p\n1AXVZg+kiNTfn7vZBh+vzJzIHYKTtlG8yzJDiN4gM0wxSlYn+tj+9LtlL25Q\n0LGlufY8v5Mu/RanhpgkpLpHd3En172QseV56roieI05lcSrou6lNU8QkmmO\nrlmyb9lOxKSuc/GY4+ysB4Hgi+nTDott0VuSuHaqGoM3aVIZvLHa+Yt0CYVx\npCweheUptZHtu739zNFbtOVXYw2HXWT5LhWULJOQg4HXm+tyK+yhlzgGcnfK\n9MUh\r\n=wN3b\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEDWdzAfNJPJ3lDaEp8PlJ/cLiT+HlP2sYKr1zUCehZGAiEA9A0IZy0C3XqunroQetEsesrRR1nqzV7V8U1o0H+Ecrc="}]},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/route-manifest_0.0.0_1566177413483_0.9775817802274085"},"_hasShrinkwrap":false},"0.0.1":{"name":"route-manifest","version":"0.0.1","repository":{"type":"git","url":"git+https://github.com/lukeed/route-manifest.git"},"description":"WIP","unpkg":"dist/manifest.min.js","module":"dist/manifest.mjs","main":"dist/manifest.js","umd:name":"manifest","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">= 6"},"scripts":{"build":"node bin","pretest":"npm run build","test":"tape test/*.js | tap-spec"},"keywords":[],"dependencies":{"regexparam":"^1.3.0"},"devDependencies":{"gzip-size":"5.1.1","mk-dirs":"2.0.0","pretty-bytes":"4.0.2","tap-spec":"5.0.0","tape":"4.11.0","terser":"4.1.4"},"gitHead":"0c6638f6631aef4a8002c576aa0ac9003e4c6f04","bugs":{"url":"https://github.com/lukeed/route-manifest/issues"},"homepage":"https://github.com/lukeed/route-manifest#readme","_id":"route-manifest@0.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-5Xtz/kYMrqEWvF9EmD6EaRKEJBoJdwbcvRNLx3gNsJCGKeVMRaU/3p78XfLQ7NvpzibgPYoqp/DxCGYmiC2Gdw==","shasum":"3cbbb59a7cf9c366c34fe1d5a551009f3e8591d5","tarball":"https://registry.npmjs.org/route-manifest/-/route-manifest-0.0.1.tgz","fileCount":5,"unpackedSize":3636,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdX46CCRA9TVsSAnZWagAAo+oP/RmnEOXJhXgr1NT0I7NW\nlHI5r/d/kGjbqIX80TgK5FqamU9ShxORMD4rS7Di65JqsKUA5cQMNeQkg5lg\nwTIs0k4C3qJ4Hz1I2TZXUdYb7FHNVxoEnV3YVtOhTnLMgO1ZL7Zyo3hW7wzQ\nGwC3fZpr0npxaoZHLkjUnqJdkgSnuVB6Ir123TX7Pg70LZ4wypQhZVXnZ5QB\nxvxiWMoEf8/eNZGU6pyhanJOjoH9DWZn45W0lpRgSWFp3Ze2kx6u94C9zDQX\nRKEGmghBIuaJRIsXw9IeUxkUwxaTh/MYm2DR5GBU/dai5Q+GcufQUgt57rcg\ncwhp5RC5qWDd83SHWHSTtyKLeLUoi2qnuSqMAvEgo4NPb2jE/3MDvcd54TEX\nQ/OyCdmT7Ng/d0diFCK2AR67fHH5b3LYHszle7Zv8LxRq3Jvl3XeIukOeVSP\ncPvYIzPd9nThcbhe53k1UAjGpJAsG8OgQ2WFKfut+y+p5zu1mAzxNJYfIAkN\nE2hdTYWWYzLkGiS1m0Hc6j14bSn4FtkKvOO1opyvrEpSfWD5ZBmEJam/6NDz\ndYgmDj7Z9ABDIiAJwUVVjdYFfFFOvC+82RgNOnOTYOPlh0rabCnwNLbA8Zxs\nJcXFZD7rkvaV1b4GFJhqMxBIuRbDXyun4ag5TCzMiW7H/ZxA0C0BU/V/m1rl\nvb+M\r\n=EESN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFO6TDk2hB2V2slJYFTP07RKd3CIpTI5PsvF3MKSwswYAiEAqULl9VRa2zMgAsQ56GrEJGAnSRjslCzweMjXCs6vJ70="}]},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/route-manifest_0.0.1_1566543489961_0.06342700483866381"},"_hasShrinkwrap":false},"1.0.0":{"name":"route-manifest","version":"1.0.0","umd:name":"rmanifest","repository":{"type":"git","url":"git+https://github.com/lukeed/route-manifest.git"},"description":"A tiny (412B) runtime to retrieve the correct entry from a Route Manifest file","unpkg":"dist/rmanifest.min.js","module":"dist/rmanifest.mjs","main":"dist/rmanifest.js","types":"rmanifest.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">= 6"},"scripts":{"build":"node bin","pretest":"npm run build","test":"tape -r esm test/*.js | tap-spec"},"dependencies":{"regexparam":"^1.3.0"},"devDependencies":{"esm":"3.2.25","gzip-size":"5.1.1","mk-dirs":"2.0.0","pretty-bytes":"4.0.2","tap-spec":"5.0.0","tape":"4.11.0","terser":"4.1.4"},"keywords":["route","runtime","manifest","parser"],"gitHead":"c0ac4715bb8e1e21e61174bc561781beab9011a5","bugs":{"url":"https://github.com/lukeed/route-manifest/issues"},"homepage":"https://github.com/lukeed/route-manifest#readme","_id":"route-manifest@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-qn0xJr4nnF4caj0erOLLAHYiNyzqhzpUbgDQcEHrmBoG4sWCDLnIXLH7VccNSxe9cWgbP2Kw/OjME+eH3CeRSA==","shasum":"0155513f3cd158c18827413845ab1a8ec2ad15e1","tarball":"https://registry.npmjs.org/route-manifest/-/route-manifest-1.0.0.tgz","fileCount":7,"unpackedSize":7706,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdZsswCRA9TVsSAnZWagAA7/sQAJO2RlFfmPPV2wUEeqpa\nbPY8kCP/4/tj/lzKyemA3X6R6H5qSnP2Lk3HLUPZlKfYZfdoMK3Gf4xjtrN7\niV5ZBthAmivSTidMoRU/eizEWtmxhcelLdOGTGCXypW9BGfC2cDSbQETq5iH\n3jNJVL1VbZWWsVvkZ3QOCPcxen0/zIowrCwUxcTkw80RU6SQBSExRXJ1sue6\nsM24FCBwoObZUa7vwd7eh5L97jPJgH+2U5zqykp+zikG2ksjFEH9JUiKi6Zq\nIU+fBEfCVZsrtYfAL7yRvFxn/CGZGsHqIIXTVtc91qafy6L6ffd08pwjuDP2\nP8ByKSbkiysf8CEk4Pmg15wWkVT/7cV1pA15R61h53GkF35YweYGayh5wQW3\nD6pZyUhkLwIrC2wGbyYrA5ZpO4wssMz797hqisRCpd948neyneo5y7BzVGMG\nNzkyJNFKgdzar0xaUxFT+NNe/DP0Z47GwuyO2B77zT9vNRHdEf/WgArY7bMA\nVFmm/U+jktPT8P5fZedznOQUOhGsq/jalHCe5NX94s8didjgaojjiJl7lYmG\nSeO+Td959/5ZxUj3InEygfFLT4iFy4KuzZ0obvXdlvM7RW16BGZERrdCoRZz\nH+rBylqFX4+C+ID1uImooSFHfyiwywdDShUU9UednA1M9n6Hc2Aii5WTLHw/\n0lJW\r\n=bwDG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxikc/BfEDABOstkK4K5OvPh1z/c9gyHQ0bp1viCN0RQIgC3JlGrxG+VmeaShzpWCyvYuRFaCPXCAb5Wv/37PpC7w="}]},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/route-manifest_1.0.0_1567017775899_0.20760926429065796"},"_hasShrinkwrap":false}},"time":{"created":"2019-08-19T01:16:53.482Z","0.0.0":"2019-08-19T01:16:53.639Z","modified":"2022-05-16T05:33:40.599Z","0.0.1":"2019-08-23T06:58:10.084Z","1.0.0":"2019-08-28T18:42:56.036Z"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"description":"A tiny (412B) runtime to retrieve the correct entry from a Route Manifest file","homepage":"https://github.com/lukeed/route-manifest#readme","keywords":["route","runtime","manifest","parser"],"repository":{"type":"git","url":"git+https://github.com/lukeed/route-manifest.git"},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"bugs":{"url":"https://github.com/lukeed/route-manifest/issues"},"license":"MIT","readme":"# route-manifest [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/route-manifest)](https://codecov.io/gh/lukeed/route-manifest)\n\n> A tiny (412B) runtime to retrieve the correct entry from a Route Manifest file.\n\nThis is the runtime/client-side component for [`webpack-route-manifest`](https://github.com/lukeed/webpack-route-manifest).<br>\nIt is **required** that your manifest's routes be [sorted by specificity](https://github.com/lukeed/route-sort#specificity), which _is_ the webpack plugin's default setting.\n\n> **Important:** This `route-manifest` _does not_ fetch files or apply headers on your behalf!\n\nThe module is available in three formats:\n\n* **ES Module**: `dist/rmanifest.mjs`\n* **CommonJS**: `dist/rmanifest.js`\n* **UMD**: `dist/rmanifest.min.js`\n\n\n## Install\n\n```\n$ npm install --save route-manifest\n```\n\n\n## Usage\n\n```js\nimport { preload } from 'quicklink';\nimport rmanifest from 'route-manifest';\n\n// Manually fetch Manifest file contents\nfetch('/manifest.json').then(r => r.json()).then(data => {\n  /*\n    Assume Manifest (`data`) is:\n    {\n      [pattern]: {\n        files: { href: string, type: string }\n        headers: [...skip...]\n      }\n    }\n  */\n\n  const files = new Set();\n\n  // We want to preload these pages' assets\n  ['/blog', '/about', '/features'].forEach(str => {\n    let entry = rmanifest(data, str);\n    entry.files.forEach(x => files.add(x.href));\n  });\n\n  // Note:\n  //   The `quicklink` module will do the actual prefetching!\n  //   We just have have to give it a file path, or an array\n  //   of file paths in this case~!\n  return preload([...files]);\n});\n```\n\n\n## API\n\n### rmanifest(contents, uri, withCommons)\nReturns: `{ files: Array, headers: Array }`\n\nReturns an object containing `files` and `headers` keys, both of which will be arrays. The arrays' items are copied from your Manifest file directly, so you will (presumably) already know the shape of your data.\n\n\n#### contents\nType: `Object`\n\nThe Manifest file's contents.<br>\nAny format returned by [`webpack-route-manifest`](https://github.com/lukeed/webpack-route-manifest) is valid.\n\n> **Important:** The route pattern keys [must be sorted](https://github.com/lukeed/webpack-route-manifest#optionssort) for matching correctness.\n\n#### uri\nType: `String`\n\nThe URL for which you want to find files or headers.\n\n> **Note:** _Only_ include the `pathname` segment of a URL, unless a pattern is explicitly looking for other segments.\n\n#### withCommons\nType: `Boolean`<br>\nDefault: `false`\n\nWhether or not the base/root-wildcard entry should be included.\n\nWhen `true` and when a `\"*\"` pattern is defined, this will include the wildcard's entry _in addition to_ the route's own specific entry too, if any. The result is still a single object of `{ files, headers }` shape – the difference is just that the two entries have their keys' items concatenated into a single array.\n\nWhen `false`, this module will _only_ return the entry _specific to_ the requested `uri` pathname.\n\n\n## Related\n\n* [webpack-route-manifest](https://github.com/lukeed/webpack-route-manifest) – generate a Route Manifest file for your webpack build\n* [quicklink](https://github.com/GoogleChromeLabs/quicklink) – preloading utility that reacts to connection speed and browser support\n* [route-sort](https://github.com/lukeed/route-sort) – the route pattern sorter required for safe sequential matching\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","readmeFilename":"readme.md"}