First release
This commit is contained in:
commit
fa6c85266e
2339 changed files with 761050 additions and 0 deletions
22
node_modules/route-manifest/dist/rmanifest.js
generated
vendored
Normal file
22
node_modules/route-manifest/dist/rmanifest.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
var toRegExp = require('regexparam');
|
||||
|
||||
module.exports = function (manifest, uri, wCommon) {
|
||||
var k,
|
||||
tmp = wCommon && manifest['*'] || [],
|
||||
headers = tmp.headers || [],
|
||||
files = tmp.files || tmp;
|
||||
|
||||
for (k in manifest) {
|
||||
if (k != '*' && toRegExp(k).pattern.test(uri)) {
|
||||
tmp = manifest[k];
|
||||
files = files.concat(tmp.files || tmp);
|
||||
headers = headers.concat(tmp.headers || []);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
files: files,
|
||||
headers: headers,
|
||||
};
|
||||
}
|
1
node_modules/route-manifest/dist/rmanifest.min.js
generated
vendored
Normal file
1
node_modules/route-manifest/dist/rmanifest.min.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.rmanifest=t()}(this,function(){function e(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,s,i,f=[],a="",u=e.split("/");for(u[0]||u.shift();s=u.shift();)"*"===(n=s[0])?(f.push("wild"),a+="/(.*)"):":"===n?(r=s.indexOf("?",1),i=s.indexOf(".",1),f.push(s.substring(1,~r?r:~i?i:s.length)),a+=~r&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(a+=(~r?"?":"")+"\\"+s.substring(i))):a+="/"+s;return{keys:f,pattern:new RegExp("^"+a+(t?"(?=$|/)":"/?$"),"i")}}return function(t,n,r){var s,i=r&&t["*"]||[],f=i.headers||[],a=i.files||i;for(s in t)if("*"!=s&&e(s).pattern.test(n)){i=t[s],a=a.concat(i.files||i),f=f.concat(i.headers||[]);break}return{files:a,headers:f}};});
|
22
node_modules/route-manifest/dist/rmanifest.mjs
generated
vendored
Normal file
22
node_modules/route-manifest/dist/rmanifest.mjs
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
import toRegExp from 'regexparam';
|
||||
|
||||
export default function (manifest, uri, wCommon) {
|
||||
var k,
|
||||
tmp = wCommon && manifest['*'] || [],
|
||||
headers = tmp.headers || [],
|
||||
files = tmp.files || tmp;
|
||||
|
||||
for (k in manifest) {
|
||||
if (k != '*' && toRegExp(k).pattern.test(uri)) {
|
||||
tmp = manifest[k];
|
||||
files = files.concat(tmp.files || tmp);
|
||||
headers = headers.concat(tmp.headers || []);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
files: files,
|
||||
headers: headers,
|
||||
};
|
||||
}
|
21
node_modules/route-manifest/license
generated
vendored
Normal file
21
node_modules/route-manifest/license
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
82
node_modules/route-manifest/package.json
generated
vendored
Normal file
82
node_modules/route-manifest/package.json
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"_args": [
|
||||
[
|
||||
"route-manifest@1.0.0",
|
||||
"F:\\Documents\\websites\\BMM"
|
||||
]
|
||||
],
|
||||
"_from": "route-manifest@1.0.0",
|
||||
"_id": "route-manifest@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-qn0xJr4nnF4caj0erOLLAHYiNyzqhzpUbgDQcEHrmBoG4sWCDLnIXLH7VccNSxe9cWgbP2Kw/OjME+eH3CeRSA==",
|
||||
"_location": "/route-manifest",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "route-manifest@1.0.0",
|
||||
"name": "route-manifest",
|
||||
"escapedName": "route-manifest",
|
||||
"rawSpec": "1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/quicklink"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/route-manifest/-/route-manifest-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "F:\\Documents\\websites\\BMM",
|
||||
"author": {
|
||||
"name": "Luke Edwards",
|
||||
"email": "luke.edwards05@gmail.com",
|
||||
"url": "https://lukeed.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lukeed/route-manifest/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"regexparam": "^1.3.0"
|
||||
},
|
||||
"description": "A tiny (412B) runtime to retrieve the correct entry from a Route Manifest file",
|
||||
"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"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"files": [
|
||||
"*.d.ts",
|
||||
"dist"
|
||||
],
|
||||
"homepage": "https://github.com/lukeed/route-manifest#readme",
|
||||
"keywords": [
|
||||
"route",
|
||||
"runtime",
|
||||
"manifest",
|
||||
"parser"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "dist/rmanifest.js",
|
||||
"module": "dist/rmanifest.mjs",
|
||||
"name": "route-manifest",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lukeed/route-manifest.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node bin",
|
||||
"pretest": "npm run build",
|
||||
"test": "tape -r esm test/*.js | tap-spec"
|
||||
},
|
||||
"types": "rmanifest.d.ts",
|
||||
"umd:name": "rmanifest",
|
||||
"unpkg": "dist/rmanifest.min.js",
|
||||
"version": "1.0.0"
|
||||
}
|
102
node_modules/route-manifest/readme.md
generated
vendored
Normal file
102
node_modules/route-manifest/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
# route-manifest [](https://codecov.io/gh/lukeed/route-manifest)
|
||||
|
||||
> A tiny (412B) runtime to retrieve the correct entry from a Route Manifest file.
|
||||
|
||||
This is the runtime/client-side component for [`webpack-route-manifest`](https://github.com/lukeed/webpack-route-manifest).<br>
|
||||
It 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.
|
||||
|
||||
> **Important:** This `route-manifest` _does not_ fetch files or apply headers on your behalf!
|
||||
|
||||
The module is available in three formats:
|
||||
|
||||
* **ES Module**: `dist/rmanifest.mjs`
|
||||
* **CommonJS**: `dist/rmanifest.js`
|
||||
* **UMD**: `dist/rmanifest.min.js`
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save route-manifest
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import { preload } from 'quicklink';
|
||||
import rmanifest from 'route-manifest';
|
||||
|
||||
// Manually fetch Manifest file contents
|
||||
fetch('/manifest.json').then(r => r.json()).then(data => {
|
||||
/*
|
||||
Assume Manifest (`data`) is:
|
||||
{
|
||||
[pattern]: {
|
||||
files: { href: string, type: string }
|
||||
headers: [...skip...]
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
const files = new Set();
|
||||
|
||||
// We want to preload these pages' assets
|
||||
['/blog', '/about', '/features'].forEach(str => {
|
||||
let entry = rmanifest(data, str);
|
||||
entry.files.forEach(x => files.add(x.href));
|
||||
});
|
||||
|
||||
// Note:
|
||||
// The `quicklink` module will do the actual prefetching!
|
||||
// We just have have to give it a file path, or an array
|
||||
// of file paths in this case~!
|
||||
return preload([...files]);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### rmanifest(contents, uri, withCommons)
|
||||
Returns: `{ files: Array, headers: Array }`
|
||||
|
||||
Returns 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.
|
||||
|
||||
|
||||
#### contents
|
||||
Type: `Object`
|
||||
|
||||
The Manifest file's contents.<br>
|
||||
Any format returned by [`webpack-route-manifest`](https://github.com/lukeed/webpack-route-manifest) is valid.
|
||||
|
||||
> **Important:** The route pattern keys [must be sorted](https://github.com/lukeed/webpack-route-manifest#optionssort) for matching correctness.
|
||||
|
||||
#### uri
|
||||
Type: `String`
|
||||
|
||||
The URL for which you want to find files or headers.
|
||||
|
||||
> **Note:** _Only_ include the `pathname` segment of a URL, unless a pattern is explicitly looking for other segments.
|
||||
|
||||
#### withCommons
|
||||
Type: `Boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Whether or not the base/root-wildcard entry should be included.
|
||||
|
||||
When `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.
|
||||
|
||||
When `false`, this module will _only_ return the entry _specific to_ the requested `uri` pathname.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
* [webpack-route-manifest](https://github.com/lukeed/webpack-route-manifest) – generate a Route Manifest file for your webpack build
|
||||
* [quicklink](https://github.com/GoogleChromeLabs/quicklink) – preloading utility that reacts to connection speed and browser support
|
||||
* [route-sort](https://github.com/lukeed/route-sort) – the route pattern sorter required for safe sequential matching
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Luke Edwards](https://lukeed.com)
|
18
node_modules/route-manifest/rmanifest.d.ts
generated
vendored
Normal file
18
node_modules/route-manifest/rmanifest.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
export type Pattern = string;
|
||||
|
||||
export interface Asset {
|
||||
type: string;
|
||||
href: string;
|
||||
}
|
||||
|
||||
export interface Entry<T> {
|
||||
files: T[];
|
||||
headers: any[];
|
||||
}
|
||||
|
||||
export type FileMap<T = Asset> = Record<Pattern, T[]>;
|
||||
export type Manifest<T = Asset> = Record<Pattern, Entry<T>>;
|
||||
|
||||
declare function rmanifest<T = Asset>(contents: FileMap<T> | Manifest<T>, uri: string, withCommons?: boolean): Entry<T>;
|
||||
|
||||
export default rmanifest;
|
Loading…
Add table
Add a link
Reference in a new issue