json-server 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.babelrc CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "presets": [
3
3
  [
4
- "env", {
4
+ "@babel/preset-env",
5
+ {
5
6
  "targets": {
6
7
  "node": "6"
7
8
  }
package/.eslintrc.js CHANGED
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- extends: ['standard', 'standard-preact', 'prettier'],
2
+ extends: ['standard', 'prettier'],
3
3
  plugins: ['prettier'],
4
4
  rules: {
5
5
  'prettier/prettier': [
@@ -10,5 +10,5 @@ module.exports = {
10
10
  },
11
11
  ]
12
12
  },
13
- env: { mocha: true }
13
+ env: { jest: true }
14
14
  }
package/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: node_js
2
2
  node_js:
3
3
  - "node"
4
- - "6"
4
+ - "8"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.15.0 - 2019-05-21
4
+
5
+ * __Breaking__ Require Node 8
6
+ * Upgrade dependencies
7
+ * Reduce package size
8
+
9
+ ## 0.14.2 - 2018-12-26
10
+
11
+ * Fix `db.getState is not a function`
12
+
13
+ ## 0.14.1 - 2018-12-25
14
+
15
+ * Show error message if port is already used
16
+ * Upgrade to [lowdb](https://github.com/typicode/lowdb) `1.0`
17
+
18
+ ## 0.14.0 - 2018-06-09
19
+
20
+ * Listen to `localhost` by default, instead of `0.0.0.0`
21
+
3
22
  ## 0.13.0 - 2018-05-30
4
23
 
5
24
  * Bundle all index page assets so that you access it without network connection
package/README.md CHANGED
@@ -5,23 +5,56 @@ Get a full fake REST API with __zero coding__ in __less than 30 seconds__ (serio
5
5
  Created with <3 for front-end developers who need a quick back-end for prototyping and mocking.
6
6
 
7
7
  * [Egghead.io free video tutorial - Creating demo APIs with json-server](https://egghead.io/lessons/nodejs-creating-demo-apis-with-json-server)
8
- * [JSONPlaceholder - Live running version](http://jsonplaceholder.typicode.com)
8
+ * [JSONPlaceholder - Live running version](https://jsonplaceholder.typicode.com)
9
+ * [__My JSON Server__ - no installation required, use your own data](https://my-json-server.typicode.com)
9
10
 
10
11
  See also:
11
12
  * :dog: [husky - Git hooks made easy](https://github.com/typicode/husky)
12
13
  * :hotel: [hotel - developer tool with local .localhost domain and https out of the box](https://github.com/typicode/hotel)
13
- * :atom_symbol: [react-fake-props - generate fake props for your React tests (Jest, Enzyme, ...)](https://github.com/typicode/react-fake-props)
14
- * :heartpulse: [Patreon page - if you want to support JSON Server or my other projects](https://www.patreon.com/typicode)
15
14
 
16
- ## Table of contents
15
+ <a href="https://www.patreon.com/typicode">
16
+ <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
17
+ </a>
18
+
19
+ <h2 align="center">Sponsors</h2>
20
+
21
+ <h3 align="center">Gold</h3>
22
+
23
+ <p align="center">
24
+ <a href="https://tryretool.com/?utm_source=sponsor&utm_campaign=typicode" target="_blank">
25
+ <img src="https://i.imgur.com/IBItATn.png" height="60px">
26
+ </a>
27
+ </p>
28
+
29
+ <p align="center">
30
+ <a href="https://www.kickstarter.com/projects/leotrieu/build-your-on-demand-startup-for-jobs-and-freelanc?utm_source=typicode&utm_medium=github" target="_blank">
31
+ <img src="https://i.imgur.com/tBU7RZj.png" height="60px">
32
+ </a>
33
+ </p>
34
+
35
+ ---
36
+
37
+ <h3 align="center">Bronze</h3>
38
+
39
+ <p align="center">
40
+ <a href="https://www.zinggrid.com/hello/json-server?utm_source=jsonserver&utm_medium=github&utm_campaign=sponsorship" target="_blank">
41
+ <img src="https://i.imgur.com/3mJGTAQ.png" height="30px">
42
+ </a>
43
+ </p>
44
+
45
+ ---
46
+
47
+ <p>&nbsp;</p>
17
48
 
18
- <details>
49
+ <p align="center">
50
+ <a href="https://patreon.com/typicode">Become a sponsor and have your company logo here</a>
51
+ </p>
52
+
53
+ ## Table of contents
19
54
 
20
55
  <!-- toc -->
21
56
 
22
- - [Sponsorship](#sponsorship)
23
- - [Example](#example)
24
- - [Install](#install)
57
+ - [Getting started](#getting-started)
25
58
  - [Routes](#routes)
26
59
  * [Plural routes](#plural-routes)
27
60
  * [Singular routes](#singular-routes)
@@ -61,11 +94,15 @@ See also:
61
94
 
62
95
  <!-- tocstop -->
63
96
 
64
- </details>
97
+ ## Getting started
98
+
99
+ Install JSON Server
65
100
 
66
- ## Example
101
+ ```
102
+ npm install -g json-server
103
+ ```
67
104
 
68
- Create a `db.json` file
105
+ Create a `db.json` file with some data
69
106
 
70
107
  ```json
71
108
  {
@@ -82,7 +119,7 @@ Create a `db.json` file
82
119
  Start JSON Server
83
120
 
84
121
  ```bash
85
- $ json-server --watch db.json
122
+ json-server --watch db.json
86
123
  ```
87
124
 
88
125
  Now if you go to [http://localhost:3000/posts/1](http://localhost:3000/posts/1), you'll get
@@ -95,15 +132,9 @@ Also when doing requests, it's good to know that:
95
132
 
96
133
  - If you make POST, PUT, PATCH or DELETE requests, changes will be automatically and safely saved to `db.json` using [lowdb](https://github.com/typicode/lowdb).
97
134
  - Your request body JSON should be object enclosed, just like the GET output. (for example `{"name": "Foobar"}`)
98
- - Id values are not mutable. Any `id` value in the body of your PUT or PATCH request wil be ignored. Only a value set in a POST request wil be respected, but only if not already taken.
135
+ - Id values are not mutable. Any `id` value in the body of your PUT or PATCH request will be ignored. Only a value set in a POST request will be respected, but only if not already taken.
99
136
  - A POST, PUT or PATCH request should include a `Content-Type: application/json` header to use the JSON in the request body. Otherwise it will result in a 200 OK but without changes being made to the data.
100
137
 
101
- ## Install
102
-
103
- ```bash
104
- $ npm install -g json-server
105
- ```
106
-
107
138
  ## Routes
108
139
 
109
140
  Based on the previous `db.json` file, here are all the default routes. You can also add [other routes](#add-custom-routes) using `--routes`.
@@ -306,7 +337,7 @@ __Tip__ use modules like [Faker](https://github.com/Marak/faker.js), [Casual](ht
306
337
 
307
338
  ### HTTPS
308
339
 
309
- There's many way to set up SSL in development. One simple way though is to use [hotel](https://github.com/typicode/hotel).
340
+ There are many ways to set up SSL in development. One simple way is to use [hotel](https://github.com/typicode/hotel).
310
341
 
311
342
  ### Add custom routes
312
343
 
@@ -362,7 +393,7 @@ json-server [options] <source>
362
393
  Options:
363
394
  --config, -c Path to config file [default: "json-server.json"]
364
395
  --port, -p Set port [default: 3000]
365
- --host, -H Set host [default: "0.0.0.0"]
396
+ --host, -H Set host [default: "localhost"]
366
397
  --watch, -w Watch file(s) [boolean]
367
398
  --routes, -r Path to routes file
368
399
  --middlewares, -m Paths to middleware files [array]
@@ -572,9 +603,10 @@ You can deploy JSON Server. For example, [JSONPlaceholder](http://jsonplaceholde
572
603
  * [Node Module Of The Week - json-server](http://nmotw.in/json-server/)
573
604
  * [Mock up your REST API with JSON Server](http://www.betterpixels.co.uk/projects/2015/05/09/mock-up-your-rest-api-with-json-server/)
574
605
  * [ng-admin: Add an AngularJS admin GUI to any RESTful API](http://marmelab.com/blog/2014/09/15/easy-backend-for-your-restful-api.html)
575
- * [Fast prototyping using Restangular and Json-server](http://glebbahmutov.com/blog/fast-prototyping-using-restangular-and-json-server/)
606
+ * [Fast prototyping using Restangular and Json-server](https://glebbahmutov.com/blog/fast-prototyping-restangular-and-json-server/)
576
607
  * [Create a Mock REST API in Seconds for Prototyping your Frontend](https://coligo.io/create-mock-rest-api-with-json-server/)
577
608
  * [No API? No Problem! Rapid Development via Mock APIs](https://medium.com/@housecor/rapid-development-via-mock-apis-e559087be066#.93d7w8oro)
609
+ * [Zero Code REST With json-server](https://dzone.com/articles/zero-code-rest-with-json-server)
578
610
 
579
611
  ### Third-party tools
580
612
 
@@ -586,4 +618,6 @@ You can deploy JSON Server. For example, [JSONPlaceholder](http://jsonplaceholde
586
618
 
587
619
  ## License
588
620
 
589
- MIT - [Typicode](https://github.com/typicode) - [Patreon](https://www.patreon.com/typicode)
621
+ MIT
622
+
623
+ [Patreon](https://www.patreon.com/typicode) - [Supporters](https://thanks.typicode.com) ✨
package/dist/index.html CHANGED
@@ -1,53 +1,82 @@
1
1
  <html>
2
+ <head>
3
+ <link
4
+ rel="stylesheet"
5
+ href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"
6
+ integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay"
7
+ crossorigin="anonymous"
8
+ />
9
+ <title>JSON Server</title>
10
+ <link rel="shortcut icon" href="favicon.ico"><link href="main.css" rel="stylesheet"></head>
2
11
 
3
- <head>
4
- <title>JSON Server</title>
5
- <link rel="shortcut icon" href="favicon.ico"><link href="main.css" rel="stylesheet"></head>
12
+ <body>
13
+ <header>
14
+ <div class="container">
15
+ <nav>
16
+ <ul>
17
+ <li class="title">
18
+ JSON Server
19
+ </li>
20
+ <li>
21
+ <a href="https://www.patreon.com/typicode">
22
+ <i class="fab fa-patreon"></i>Patreon
23
+ </a>
24
+ </li>
25
+ <li>
26
+ <a href="https://my-json-server.typicode.com">
27
+ <i class="fas fa-burn"></i>My JSON Server
28
+ </a>
29
+ </li>
30
+ <li>
31
+ <a href="https://thanks.typicode.com">
32
+ <i class="far fa-laugh"></i>Supporters
33
+ </a>
34
+ </li>
35
+ </ul>
36
+ </nav>
37
+ </div>
38
+ </header>
39
+ <main>
40
+ <div class="container">
41
+ <h1>Congrats!</h1>
42
+ <p>
43
+ You're successfully running JSON Server
44
+ <br />
45
+ ✧*。٩(ˊᗜˋ*)و✧*。
46
+ </p>
6
47
 
7
- <body>
8
- <header>
9
- <div class="container">
10
- <h3>JSON Server</h3>
11
- </div>
12
- </header>
13
- <main>
14
- <div class="container">
15
- <h4>Congrats!</h4>
16
- <p>
17
- You're successfully running JSON Server
18
- <br> ✧*。٩(ˊᗜˋ*)و✧*。
19
- </p>
48
+ <div id="resources"></div>
20
49
 
21
- <div id="resources"></div>
50
+ <p>
51
+ To access and modify resources, you can use any HTTP method:
52
+ </p>
53
+ <p>
54
+ <code>GET</code>
55
+ <code>POST</code>
56
+ <code>PUT</code>
57
+ <code>PATCH</code>
58
+ <code>DELETE</code>
59
+ <code>OPTIONS</code>
60
+ </p>
22
61
 
23
- <p>
24
- To access and modify resources, you can use any HTTP method
25
- <br>
26
- <code>GET</code>
27
- <code>POST</code>
28
- <code>PUT</code>
29
- <code>PATCH</code>
30
- <code>DELETE</code>
31
- <code>OPTIONS</code>
32
- </p>
62
+ <div id="custom-routes"></div>
33
63
 
34
- <div id="custom-routes"></div>
64
+ <h1>Documentation</h1>
65
+ <p>
66
+ <a href="https://github.com/typicode/json-server">
67
+ README
68
+ </a>
69
+ </p>
70
+ </div>
71
+ </main>
35
72
 
36
- <h4>Documentation</h4>
37
- <p>
38
- View
39
- <a href="https://github.com/typicode/json-server">README</a>
40
- </p>
41
- </div>
42
- </main>
43
-
44
- <footer>
45
- <div class="container">
46
- <p>
47
- To replace this page, create a
48
- <code>./public/index.html</code> file.
49
- </p>
50
- </div>
51
- </footer>
52
- <script type="text/javascript" src="main.js"></script></body>
73
+ <footer>
74
+ <div class="container">
75
+ <p>
76
+ To replace this page, create a
77
+ <code>./public/index.html</code> file.
78
+ </p>
79
+ </div>
80
+ </footer>
81
+ <script type="text/javascript" src="main.js"></script></body>
53
82
  </html>
package/dist/main.css CHANGED
@@ -1,8 +1,110 @@
1
- /*!
2
- * Milligram v1.3.0
3
- * https://milligram.github.io
4
- *
5
- * Copyright (c) 2017 CJ Patoilo
6
- * Licensed under the MIT license
7
- */*,:after,:before{box-sizing:inherit}html{box-sizing:border-box;font-size:62.5%}body{color:#606c76;font-family:Roboto,Helvetica Neue,Helvetica,Arial,sans-serif;font-size:1.6em;font-weight:300;letter-spacing:.01em;line-height:1.6}blockquote{border-left:.3rem solid #d1d1d1;margin-left:0;margin-right:0;padding:1rem 1.5rem}blockquote :last-child{margin-bottom:0}.button,button,input[type=button],input[type=reset],input[type=submit]{background-color:#9b4dca;border:.1rem solid #9b4dca;border-radius:.4rem;color:#fff;cursor:pointer;display:inline-block;font-size:1.1rem;font-weight:700;height:3.8rem;letter-spacing:.1rem;line-height:3.8rem;padding:0 3rem;text-align:center;text-decoration:none;text-transform:uppercase;white-space:nowrap}.button:focus,.button:hover,button:focus,button:hover,input[type=button]:focus,input[type=button]:hover,input[type=reset]:focus,input[type=reset]:hover,input[type=submit]:focus,input[type=submit]:hover{background-color:#606c76;border-color:#606c76;color:#fff;outline:0}.button[disabled],button[disabled],input[type=button][disabled],input[type=reset][disabled],input[type=submit][disabled]{cursor:default;opacity:.5}.button[disabled]:focus,.button[disabled]:hover,button[disabled]:focus,button[disabled]:hover,input[type=button][disabled]:focus,input[type=button][disabled]:hover,input[type=reset][disabled]:focus,input[type=reset][disabled]:hover,input[type=submit][disabled]:focus,input[type=submit][disabled]:hover{background-color:#9b4dca;border-color:#9b4dca}.button.button-outline,button.button-outline,input[type=button].button-outline,input[type=reset].button-outline,input[type=submit].button-outline{background-color:transparent;color:#9b4dca}.button.button-outline:focus,.button.button-outline:hover,button.button-outline:focus,button.button-outline:hover,input[type=button].button-outline:focus,input[type=button].button-outline:hover,input[type=reset].button-outline:focus,input[type=reset].button-outline:hover,input[type=submit].button-outline:focus,input[type=submit].button-outline:hover{background-color:transparent;border-color:#606c76;color:#606c76}.button.button-outline[disabled]:focus,.button.button-outline[disabled]:hover,button.button-outline[disabled]:focus,button.button-outline[disabled]:hover,input[type=button].button-outline[disabled]:focus,input[type=button].button-outline[disabled]:hover,input[type=reset].button-outline[disabled]:focus,input[type=reset].button-outline[disabled]:hover,input[type=submit].button-outline[disabled]:focus,input[type=submit].button-outline[disabled]:hover{border-color:inherit;color:#9b4dca}.button.button-clear,button.button-clear,input[type=button].button-clear,input[type=reset].button-clear,input[type=submit].button-clear{background-color:transparent;border-color:transparent;color:#9b4dca}.button.button-clear:focus,.button.button-clear:hover,button.button-clear:focus,button.button-clear:hover,input[type=button].button-clear:focus,input[type=button].button-clear:hover,input[type=reset].button-clear:focus,input[type=reset].button-clear:hover,input[type=submit].button-clear:focus,input[type=submit].button-clear:hover{background-color:transparent;border-color:transparent;color:#606c76}.button.button-clear[disabled]:focus,.button.button-clear[disabled]:hover,button.button-clear[disabled]:focus,button.button-clear[disabled]:hover,input[type=button].button-clear[disabled]:focus,input[type=button].button-clear[disabled]:hover,input[type=reset].button-clear[disabled]:focus,input[type=reset].button-clear[disabled]:hover,input[type=submit].button-clear[disabled]:focus,input[type=submit].button-clear[disabled]:hover{color:#9b4dca}code{border-radius:.4rem;font-size:86%;margin:0 .2rem;padding:.2rem .5rem;white-space:nowrap}code,pre{background:#f4f5f6}pre{border-left:.3rem solid #9b4dca;overflow-y:hidden}pre>code{border-radius:0;display:block;padding:1rem 1.5rem;white-space:pre}hr{border:0;border-top:.1rem solid #f4f5f6;margin:3rem 0}input[type=email],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=url],select,textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:.1rem solid #d1d1d1;border-radius:.4rem;box-shadow:none;box-sizing:inherit;height:3.8rem;padding:.6rem 1rem;width:100%}input[type=email]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=url]:focus,select:focus,textarea:focus{border-color:#9b4dca;outline:0}select{background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="14" viewBox="0 0 29 14" width="29"><path fill="#d1d1d1" d="M9.37727 3.625l5.08154 6.93523L19.54036 3.625"/></svg>') 100% no-repeat;padding-right:3rem}select:focus{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="14" viewBox="0 0 29 14" width="29"><path fill="#9b4dca" d="M9.37727 3.625l5.08154 6.93523L19.54036 3.625"/></svg>')}textarea{min-height:6.5rem}label,legend{display:block;font-size:1.6rem;font-weight:700;margin-bottom:.5rem}fieldset{border-width:0;padding:0}input[type=checkbox],input[type=radio]{display:inline}.label-inline{display:inline-block;font-weight:400;margin-left:.5rem}.container{margin:0 auto;max-width:112rem;padding:0 2rem;position:relative;width:100%}.row{display:flex;flex-direction:column;width:100%}.row,.row.row-no-padding,.row.row-no-padding>.column{padding:0}.row.row-wrap{flex-wrap:wrap}.row.row-top{align-items:flex-start}.row.row-bottom{align-items:flex-end}.row.row-center{align-items:center}.row.row-stretch{align-items:stretch}.row.row-baseline{align-items:baseline}.row .column{display:block;flex:1 1 auto;margin-left:0;max-width:100%;width:100%}.row .column.column-offset-10{margin-left:10%}.row .column.column-offset-20{margin-left:20%}.row .column.column-offset-25{margin-left:25%}.row .column.column-offset-33,.row .column.column-offset-34{margin-left:33.3333%}.row .column.column-offset-50{margin-left:50%}.row .column.column-offset-66,.row .column.column-offset-67{margin-left:66.6666%}.row .column.column-offset-75{margin-left:75%}.row .column.column-offset-80{margin-left:80%}.row .column.column-offset-90{margin-left:90%}.row .column.column-10{flex:0 0 10%;max-width:10%}.row .column.column-20{flex:0 0 20%;max-width:20%}.row .column.column-25{flex:0 0 25%;max-width:25%}.row .column.column-33,.row .column.column-34{flex:0 0 33.3333%;max-width:33.3333%}.row .column.column-40{flex:0 0 40%;max-width:40%}.row .column.column-50{flex:0 0 50%;max-width:50%}.row .column.column-60{flex:0 0 60%;max-width:60%}.row .column.column-66,.row .column.column-67{flex:0 0 66.6666%;max-width:66.6666%}.row .column.column-75{flex:0 0 75%;max-width:75%}.row .column.column-80{flex:0 0 80%;max-width:80%}.row .column.column-90{flex:0 0 90%;max-width:90%}.row .column .column-top{align-self:flex-start}.row .column .column-bottom{align-self:flex-end}.row .column .column-center{-ms-grid-row-align:center;align-self:center}@media (min-width:40rem){.row{flex-direction:row;margin-left:-1rem;width:calc(100% + 2rem)}.row .column{margin-bottom:inherit;padding:0 1rem}}a{color:#9b4dca;text-decoration:none}a:focus,a:hover{color:#606c76}dl,ol,ul{list-style:none;margin-top:0;padding-left:0}dl dl,dl ol,dl ul,ol dl,ol ol,ol ul,ul dl,ul ol,ul ul{font-size:90%;margin:1.5rem 0 1.5rem 3rem}ol{list-style:decimal inside}ul{list-style:circle inside}.button,button,dd,dt,li{margin-bottom:1rem}fieldset,input,select,textarea{margin-bottom:1.5rem}blockquote,dl,figure,form,ol,p,pre,table,ul{margin-bottom:2.5rem}table{border-spacing:0;width:100%}td,th{border-bottom:.1rem solid #e1e1e1;padding:1.2rem 1.5rem;text-align:left}td:first-child,th:first-child{padding-left:0}td:last-child,th:last-child{padding-right:0}b,strong{font-weight:700}p{margin-top:0}h1,h2,h3,h4,h5,h6{font-weight:300;letter-spacing:-.1rem;margin-bottom:2rem;margin-top:0}h1{font-size:4.6rem;line-height:1.2}h2{font-size:3.6rem;line-height:1.25}h3{font-size:2.8rem;line-height:1.3}h4{font-size:2.2rem;letter-spacing:-.08rem;line-height:1.35}h5{font-size:1.8rem;letter-spacing:-.05rem;line-height:1.5}h6{font-size:1.6rem;letter-spacing:0;line-height:1.4}img{max-width:100%}.clearfix:after{clear:both;content:" ";display:table}.float-left{float:left}.float-right{float:right}
8
- html{font-size:70%}body{display:flex;min-height:100vh;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;flex-direction:column;padding:0;margin:0;color:#333;letter-spacing:0}header{padding-top:2rem;border-bottom:1px solid #eee}header a,header a:hover{text-decoration:none}main{flex:1}footer{padding-top:2.5rem;border-top:1px solid #eee}h4{margin-top:4rem}a{color:#0275d8}a:hover{color:#014c8c;text-decoration:underline}table{margin-left:0}td{border:0;padding:0 1em .5em 0;color:#014c8c}td:first-child{width:1%;white-space:nowrap}ul{list-style-position:inside;padding-left:0}li{list-style-type:none;margin-bottom:.2rem}code{border-radius:0}
1
+ body {
2
+ display: flex;
3
+ min-height: 100vh;
4
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
5
+ Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
6
+ flex-direction: column;
7
+ padding: 0;
8
+ margin: 0;
9
+ color: #3b4252;
10
+ letter-spacing: 0;
11
+ }
12
+
13
+ .container {
14
+ max-width: 960px;
15
+ margin: auto;
16
+ padding: 1rem;
17
+ }
18
+
19
+ header {
20
+ border-bottom: 1px solid #eee;
21
+ }
22
+
23
+ header a {
24
+ color: inherit;
25
+ text-decoration: none;
26
+ }
27
+
28
+ header a:hover {
29
+ text-decoration: underline;
30
+ }
31
+
32
+ nav ul {
33
+ display: flex;
34
+ flex-wrap: nowrap;
35
+ justify-content: space-between;
36
+ }
37
+
38
+ nav li.title {
39
+ flex-grow: 5;
40
+ text-align: left;
41
+ font-weight: bold;
42
+ font-size: 1.4rem;
43
+ color: #3b4252;
44
+ }
45
+
46
+ nav li {
47
+ flex-grow: 1;
48
+ align-self: center;
49
+ text-align: right;
50
+ color: #4c566a;
51
+ }
52
+
53
+ main {
54
+ flex: 1;
55
+ }
56
+
57
+ footer {
58
+ margin-top: 4rem;
59
+ border-top: 1px solid #eee;
60
+ }
61
+
62
+ h1 {
63
+ margin-top: 4rem;
64
+ font-weight: normal;
65
+ }
66
+
67
+ i {
68
+ margin-right: 0.5rem;
69
+ }
70
+
71
+ a {
72
+ color: #5e81ac;
73
+ }
74
+
75
+ a:hover {
76
+ color: #81a1c1;
77
+ text-decoration: underline;
78
+ }
79
+
80
+ table {
81
+ margin-left: 0;
82
+ }
83
+
84
+ td {
85
+ border: 0;
86
+ padding: 0 1em 0.5em 0;
87
+ }
88
+
89
+ td:first-child {
90
+ width: 1%;
91
+ white-space: nowrap;
92
+ }
93
+
94
+ ul {
95
+ list-style-position: inside;
96
+ padding-left: 0;
97
+ }
98
+
99
+ li {
100
+ list-style-type: none;
101
+ margin-bottom: 0.2rem;
102
+ }
103
+
104
+ code {
105
+ padding: 0.2rem;
106
+ margin: 0rem 0.2rem;
107
+ border-radius: 0.2rem;
108
+ background: #e5e9f0;
109
+ }
110
+
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}([function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";(function(e){var n=setTimeout;function r(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(e,this)}function i(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,o._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void s(t.promise,e)}a(t.promise,r)}else(1===e._state?a:s)(t.promise,e._value)})):e._deferreds.push(t)}function a(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void u(e);if("function"==typeof n)return void l((r=n,i=t,function(){r.apply(i,arguments)}),e)}e._state=1,e._value=t,u(e)}catch(t){s(e,t)}var r,i}function s(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)i(e,e._deferreds[t]);e._deferreds=null}function l(e,t){var n=!1;try{e(function(e){n||(n=!0,a(t,e))},function(e){n||(n=!0,s(t,e))})}catch(e){if(n)return;n=!0,s(t,e)}}o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var n=new this.constructor(r);return i(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,n)),n},o.prototype.finally=function(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})},o.all=function(e){return new o(function(t,n){if(!e||void 0===e.length)throw new TypeError("Promise.all accepts an array");var r=Array.prototype.slice.call(e);if(0===r.length)return t([]);var o=r.length;function i(e,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(t){i(e,t)},n)}r[e]=a,0==--o&&t(r)}catch(e){n(e)}}for(var a=0;a<r.length;a++)i(a,r[a])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(t){t(e)})},o.reject=function(e){return new o(function(t,n){n(e)})},o.race=function(e){return new o(function(t,n){for(var r=0,o=e.length;r<o;r++)e[r].then(t,n)})},o._immediateFn="function"==typeof e&&function(t){e(t)}||function(e){n(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},t.a=o}).call(this,n(10).setImmediate)},,function(e,t,n){},,function(e,t,n){},function(e,t,n){"use strict";n.r(t),n.d(t,"h",function(){return a}),n.d(t,"createElement",function(){return a}),n.d(t,"cloneElement",function(){return l}),n.d(t,"Component",function(){return N}),n.d(t,"render",function(){return O}),n.d(t,"rerender",function(){return p}),n.d(t,"options",function(){return r});var r={},o=[],i=[];function a(e,t){var n,a,s,u,l=i;for(u=arguments.length;u-- >2;)o.push(arguments[u]);for(t&&null!=t.children&&(o.length||o.push(t.children),delete t.children);o.length;)if((a=o.pop())&&void 0!==a.pop)for(u=a.length;u--;)o.push(a[u]);else"boolean"==typeof a&&(a=null),(s="function"!=typeof e)&&(null==a?a="":"number"==typeof a?a=String(a):"string"!=typeof a&&(s=!1)),s&&n?l[l.length-1]+=a:l===i?l=[a]:l.push(a),n=s;var c=new function(){};return c.nodeName=e,c.children=l,c.attributes=null==t?void 0:t,c.key=null==t?void 0:t.key,void 0!==r.vnode&&r.vnode(c),c}function s(e,t){for(var n in t)e[n]=t[n];return e}var u="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;function l(e,t){return a(e.nodeName,s(s({},e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}var c=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,f=[];function d(e){!e._dirty&&(e._dirty=!0)&&1==f.push(e)&&(r.debounceRendering||u)(p)}function p(){var e,t=f;for(f=[];e=t.pop();)e._dirty&&S(e)}function h(e,t){return e.normalizedNodeName===t||e.nodeName.toLowerCase()===t.toLowerCase()}function y(e){var t=s({},e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(void 0!==n)for(var r in n)void 0===t[r]&&(t[r]=n[r]);return t}function m(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n,r,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),r&&r(e);else if("class"!==t||o)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var i in n)i in r||(e.style[i]="");for(var i in r)e.style[i]="number"==typeof r[i]&&!1===c.test(i)?r[i]+"px":r[i]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var a=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,b,a):e.removeEventListener(t,b,a),(e._listeners||(e._listeners={}))[t]=r}else if("list"!==t&&"type"!==t&&!o&&t in e)!function(e,t,n){try{e[t]=n}catch(e){}}(e,t,null==r?"":r),null!=r&&!1!==r||e.removeAttribute(t);else{var s=o&&t!==(t=t.replace(/^xlink:?/,""));null==r||!1===r?s?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof r&&(s?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function b(e){return this._listeners[e.type](r.event&&r.event(e)||e)}var _=[],w=0,g=!1,T=!1;function x(){for(var e;e=_.pop();)r.afterMount&&r.afterMount(e),e.componentDidMount&&e.componentDidMount()}function C(e,t,n,r,o,i){w++||(g=null!=o&&void 0!==o.ownerSVGElement,T=null!=e&&!("__preactattr_"in e));var a=E(e,t,n,r,i);return o&&a.parentNode!==o&&o.appendChild(a),--w||(T=!1,i||x()),a}function E(e,t,n,r,o){var i=e,a=g;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),P(e,!0))),i.__preactattr_=!0,i;var s,u,l=t.nodeName;if("function"==typeof l)return function(e,t,n,r){var o=e&&e._component,i=o,a=e,s=o&&e._componentConstructor===t.nodeName,u=s,l=y(t);for(;o&&!u&&(o=o._parentComponent);)u=o.constructor===t.nodeName;o&&u&&(!r||o._component)?(k(o,l,3,n,r),e=o.base):(i&&!s&&(U(i),e=a=null),o=j(t.nodeName,l,n),e&&!o.nextBase&&(o.nextBase=e,a=null),k(o,l,1,n,r),e=o.base,a&&e!==a&&(a._component=null,P(a,!1)));return e}(e,t,n,r);if(g="svg"===l||"foreignObject"!==l&&g,l=String(l),(!e||!h(e,l))&&(s=l,(u=g?document.createElementNS("http://www.w3.org/2000/svg",s):document.createElement(s)).normalizedNodeName=s,i=u,e)){for(;e.firstChild;)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),P(e,!0)}var c=i.firstChild,f=i.__preactattr_,d=t.children;if(null==f){f=i.__preactattr_={};for(var p=i.attributes,b=p.length;b--;)f[p[b].name]=p[b].value}return!T&&d&&1===d.length&&"string"==typeof d[0]&&null!=c&&void 0!==c.splitText&&null==c.nextSibling?c.nodeValue!=d[0]&&(c.nodeValue=d[0]):(d&&d.length||null!=c)&&function(e,t,n,r,o){var i,a,s,u,l,c=e.childNodes,f=[],d={},p=0,y=0,v=c.length,b=0,_=t?t.length:0;if(0!==v)for(var w=0;w<v;w++){var g=c[w],T=g.__preactattr_,x=_&&T?g._component?g._component.__key:T.key:null;null!=x?(p++,d[x]=g):(T||(void 0!==g.splitText?!o||g.nodeValue.trim():o))&&(f[b++]=g)}if(0!==_)for(var w=0;w<_;w++){u=t[w],l=null;var x=u.key;if(null!=x)p&&void 0!==d[x]&&(l=d[x],d[x]=void 0,p--);else if(!l&&y<b)for(i=y;i<b;i++)if(void 0!==f[i]&&(C=a=f[i],B=o,"string"==typeof(A=u)||"number"==typeof A?void 0!==C.splitText:"string"==typeof A.nodeName?!C._componentConstructor&&h(C,A.nodeName):B||C._componentConstructor===A.nodeName)){l=a,f[i]=void 0,i===b-1&&b--,i===y&&y++;break}l=E(l,u,n,r),s=c[w],l&&l!==e&&l!==s&&(null==s?e.appendChild(l):l===s.nextSibling?m(s):e.insertBefore(l,s))}var C,A,B;if(p)for(var w in d)void 0!==d[w]&&P(d[w],!1);for(;y<=b;)void 0!==(l=f[b--])&&P(l,!1)}(i,d,n,r,T||null!=f.dangerouslySetInnerHTML),function(e,t,n){var r;for(r in n)t&&null!=t[r]||null==n[r]||v(e,r,n[r],n[r]=void 0,g);for(r in t)"children"===r||"innerHTML"===r||r in n&&t[r]===("value"===r||"checked"===r?e[r]:n[r])||v(e,r,n[r],n[r]=t[r],g)}(i,t.attributes,f),g=a,i}function P(e,t){var n=e._component;n?U(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||m(e),A(e))}function A(e){for(e=e.lastChild;e;){var t=e.previousSibling;P(e,!0),e=t}}var B={};function j(e,t,n){var r,o=B[e.name];if(e.prototype&&e.prototype.render?(r=new e(t,n),N.call(r,t,n)):((r=new N(t,n)).constructor=e,r.render=I),o)for(var i=o.length;i--;)if(o[i].constructor===e){r.nextBase=o[i].nextBase,o.splice(i,1);break}return r}function I(e,t,n){return this.constructor(e,n)}function k(e,t,n,o,i){e._disable||(e._disable=!0,(e.__ref=t.ref)&&delete t.ref,(e.__key=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=o),e.prevProps||(e.prevProps=e.props),e.props=t,e._disable=!1,0!==n&&(1!==n&&!1===r.syncComponentUpdates&&e.base?d(e):S(e,1,i)),e.__ref&&e.__ref(e))}function S(e,t,n,o){if(!e._disable){var i,a,u,l=e.props,c=e.state,f=e.context,d=e.prevProps||l,p=e.prevState||c,h=e.prevContext||f,m=e.base,v=e.nextBase,b=m||v,g=e._component,T=!1;if(m&&(e.props=d,e.state=p,e.context=h,2!==t&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(l,c,f)?T=!0:e.componentWillUpdate&&e.componentWillUpdate(l,c,f),e.props=l,e.state=c,e.context=f),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!T){i=e.render(l,c,f),e.getChildContext&&(f=s(s({},f),e.getChildContext()));var E,A,B=i&&i.nodeName;if("function"==typeof B){var I=y(i);(a=g)&&a.constructor===B&&I.key==a.__key?k(a,I,1,f,!1):(E=a,e._component=a=j(B,I,f),a.nextBase=a.nextBase||v,a._parentComponent=e,k(a,I,0,f,!1),S(a,1,n,!0)),A=a.base}else u=b,(E=g)&&(u=e._component=null),(b||1===t)&&(u&&(u._component=null),A=C(u,i,f,n||!m,b&&b.parentNode,!0));if(b&&A!==b&&a!==g){var N=b.parentNode;N&&A!==N&&(N.replaceChild(A,b),E||(b._component=null,P(b,!1)))}if(E&&U(E),e.base=A,A&&!o){for(var O=e,R=e;R=R._parentComponent;)(O=R).base=A;A._component=O,A._componentConstructor=O.constructor}}if(!m||n?_.unshift(e):T||(e.componentDidUpdate&&e.componentDidUpdate(d,p,h),r.afterUpdate&&r.afterUpdate(e)),null!=e._renderCallbacks)for(;e._renderCallbacks.length;)e._renderCallbacks.pop().call(e);w||o||x()}}function U(e){r.beforeUnmount&&r.beforeUnmount(e);var t=e.base;e._disable=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?U(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.nextBase=t,m(t),function(e){var t=e.constructor.name;(B[t]||(B[t]=[])).push(e)}(e),A(t)),e.__ref&&e.__ref(null)}function N(e,t){this._dirty=!0,this.context=t,this.props=e,this.state=this.state||{}}function O(e,t,n){return C(n,e,{},!1,t,!1)}s(N.prototype,{setState:function(e,t){var n=this.state;this.prevState||(this.prevState=s({},n)),s(n,"function"==typeof e?e(n,this.props):e),t&&(this._renderCallbacks=this._renderCallbacks||[]).push(t),d(this)},forceUpdate:function(e){e&&(this._renderCallbacks=this._renderCallbacks||[]).push(e),S(this,2)},render:function(){}});var R={h:a,createElement:a,cloneElement:l,Component:N,render:O,rerender:p,options:r};t.default=R},function(e,t){!function(e){"use strict";if(!e.fetch){var t={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(t.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=function(e){return e&&DataView.prototype.isPrototypeOf(e)},o=ArrayBuffer.isView||function(e){return e&&n.indexOf(Object.prototype.toString.call(e))>-1};c.prototype.append=function(e,t){e=s(e),t=u(t);var n=this.map[e];this.map[e]=n?n+","+t:t},c.prototype.delete=function(e){delete this.map[s(e)]},c.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},c.prototype.set=function(e,t){this.map[s(e)]=u(t)},c.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},c.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),l(e)},c.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),l(e)},c.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),l(e)},t.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},b.error=function(){var e=new b(null,{status:0,statusText:""});return e.type="error",e};var a=[301,302,303,307,308];b.redirect=function(e,t){if(-1===a.indexOf(t))throw new RangeError("Invalid status code");return new b(null,{status:t,headers:{location:e}})},e.Headers=c,e.Request=m,e.Response=b,e.fetch=function(e,n){return new Promise(function(r,o){var i=new m(e,n),a=new XMLHttpRequest;a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new c,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}}),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;r(new b(o,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials?a.withCredentials=!0:"omit"===i.credentials&&(a.withCredentials=!1),"responseType"in a&&t.blob&&(a.responseType="blob"),i.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),a.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function c(e){this.map={},e instanceof c?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function d(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function p(e){var t=new FileReader,n=d(t);return t.readAsArrayBuffer(e),n}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&r(e))this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!o(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var e,t,n,r=f(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=d(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},t.formData&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}function m(e,t){var n,r,o=(t=t||{}).body;if(e instanceof m){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new c(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),i.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function v(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}}),t}function b(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var u,l=[],c=!1,f=-1;function d(){c&&u&&(c=!1,u.length?l=u.concat(l):f=-1,l.length&&p())}function p(){if(!c){var e=s(d);c=!0;for(var t=l.length;t;){for(u=l,l=[];++f<t;)u&&u[f].run();f=-1,t=l.length}u=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function y(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),1!==l.length||c||s(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,a,s,u=1,l={},c=!1,f=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){h(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){h(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(h,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&h(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var o={callback:e,args:t};return l[u]=o,r(u),u++},d.clearImmediate=p}function p(e){delete l[e]}function h(e){if(c)setTimeout(h,0,e);else{var t=l[e];if(t){c=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{p(e),c=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(0),n(8))},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(9),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(0))},function(e,t,n){"use strict";n.r(t),function(e){var t=n(1),r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;throw new Error("unable to locate global object")}();r.Promise||(r.Promise=t.a)}.call(this,n(0))},function(e,t,n){"use strict";n(11),n(7);var r=n(6);function o(e){var t=e.name,n=e.length;return(0,r.h)("li",null,(0,r.h)("a",{href:t},"/",t)," ",(0,r.h)("sup",null,n?n+"x":"object"))}function i(e){var t=e.db;return(0,r.h)("ul",null,Object.keys(t).map(function(e){return(0,r.h)(o,{name:e,length:Array.isArray(t[e])&&t[e].length})}))}function a(){return(0,r.h)("p",null,"No resources found")}function s(e){var t=e.db;return(0,r.h)("div",null,(0,r.h)("h4",null,"Resources"),Object.keys(t).length?(0,r.h)(i,{db:t}):(0,r.h)(a,null))}function u(e){var t=e.customRoutes,n=Object.keys(t);if(n.length)return(0,r.h)("div",null,(0,r.h)("h4",null,"Custom Routes"),(0,r.h)("table",null,n.map(function(e){return(0,r.h)("tr",null,(0,r.h)("td",null,e),(0,r.h)("td",null,"⇢ ",t[e]))})))}n(5),n(3),window.fetch("db").then(function(e){return e.json()}).then(function(e){return(0,r.render)((0,r.h)(s,{db:e}),document.getElementById("resources"))}),window.fetch("__rules").then(function(e){return e.json()}).then(function(e){(0,r.render)((0,r.h)(u,{customRoutes:e}),document.getElementById("custom-routes"))})}]);
1
+ !function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){"use strict";e.a=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){return e.reject(n)})})}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";(function(t){var r=n(0),o=setTimeout;function i(){}function s(t){if(!(this instanceof s))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],d(t,this)}function a(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,s._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void c(e.promise,t)}u(e.promise,r)}else(1===t._state?u:c)(e.promise,t._value)})):t._deferreds.push(e)}function u(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof s)return t._state=3,t._value=e,void f(t);if("function"==typeof n)return void d((r=n,o=e,function(){r.apply(o,arguments)}),t)}t._state=1,t._value=e,f(t)}catch(e){c(t,e)}var r,o}function c(t,e){t._state=2,t._value=e,f(t)}function f(t){2===t._state&&0===t._deferreds.length&&s._immediateFn(function(){t._handled||s._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function d(t,e){var n=!1;try{t(function(t){n||(n=!0,u(e,t))},function(t){n||(n=!0,c(e,t))})}catch(t){if(n)return;n=!0,c(e,t)}}s.prototype.catch=function(t){return this.then(null,t)},s.prototype.then=function(t,e){var n=new this.constructor(i);return a(this,new l(t,e,n)),n},s.prototype.finally=r.a,s.all=function(t){return new s(function(e,n){if(!t||void 0===t.length)throw new TypeError("Promise.all accepts an array");var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var o=r.length;function i(t,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(e){i(t,e)},n)}r[t]=s,0==--o&&e(r)}catch(t){n(t)}}for(var s=0;s<r.length;s++)i(s,r[s])})},s.resolve=function(t){return t&&"object"==typeof t&&t.constructor===s?t:new s(function(e){e(t)})},s.reject=function(t){return new s(function(e,n){n(t)})},s.race=function(t){return new s(function(e,n){for(var r=0,o=t.length;r<o;r++)t[r].then(e,n)})},s._immediateFn="function"==typeof t&&function(e){t(e)}||function(t){o(t,0)},s._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},e.a=s}).call(this,n(4).setImmediate)},function(t,e,n){"use strict";(function(t){var e=n(2),r=n(0),o=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t)return t;throw new Error("unable to locate global object")}();"Promise"in o?o.Promise.prototype.finally||(o.Promise.prototype.finally=r.a):o.Promise=e.a}).call(this,n(1))},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(5),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(1))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,o,i,s,a,u=1,c={},f=!1,l=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){p(t)})}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){p(t.data)},r=function(t){i.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(o=l.documentElement,r=function(t){var e=l.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):r=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),r=function(e){t.postMessage(s+e,"*")}),d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var o={callback:t,args:e};return c[u]=o,r(u),u++},d.clearImmediate=h}function h(t){delete c[t]}function p(t){if(f)setTimeout(p,0,t);else{var e=c[t];if(e){f=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{h(t),f=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(1),n(6))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],f=!1,l=-1;function d(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&h())}function h(){if(!f){var t=a(d);f=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||f||a(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){},function(t,e,n){"use strict";n.r(e);n(3);var r={searchParams:"URLSearchParams"in self,iterable:"Symbol"in self&&"iterator"in Symbol,blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self};if(r.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&o.indexOf(Object.prototype.toString.call(t))>-1};function s(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function u(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r.iterable&&(e[Symbol.iterator]=function(){return e}),e}function c(t){this.map={},t instanceof c?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function d(t){var e=new FileReader,n=l(e);return e.readAsArrayBuffer(t),n}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function p(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r.arrayBuffer&&r.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=h(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var t,e,n,r=f(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=l(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,e){t=s(t),e=a(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},c.prototype.delete=function(t){delete this.map[s(t)]},c.prototype.get=function(t){return t=s(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(s(t))},c.prototype.set=function(t,e){this.map[s(t)]=a(e)},c.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},c.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),u(t)},c.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),u(t)},c.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),u(t)},r.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function m(t,e){var n,r,o=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new c(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),y.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function b(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(o))}}),e}function v(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new c(e.headers),this.url=e.url||"",this._initBody(t)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},p.call(m.prototype),p.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},v.error=function(){var t=new v(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];v.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new v(null,{status:e,headers:{location:t}})};var g=self.DOMException;try{new g}catch(t){(g=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack}).prototype=Object.create(Error.prototype),g.prototype.constructor=g}function _(t,e){return new Promise(function(n,o){var i=new m(t,e);if(i.signal&&i.signal.aborted)return o(new g("Aborted","AbortError"));var s=new XMLHttpRequest;function a(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var n=t.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();e.append(r,o)}}),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;n(new v(o,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new g("Aborted","AbortError"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&r.blob&&(s.responseType="blob"),i.headers.forEach(function(t,e){s.setRequestHeader(e,t)}),i.signal&&(i.signal.addEventListener("abort",a),s.onreadystatechange=function(){4===s.readyState&&i.signal.removeEventListener("abort",a)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})}_.polyfill=!0,self.fetch||(self.fetch=_,self.Headers=c,self.Request=m,self.Response=v);n(7);function T({db:t}){return`\n <div>\n <h1>Resources</h1>\n ${Object.keys(t).length?function({db:t}){return`\n <ul>\n ${Object.keys(t).map(e=>(function({name:t,length:e}){return`\n <li>\n <a href="${t}">/${t}</a>\n <sup>${e?`${e}x`:"object"}</sup>\n </li>\n `})({name:e,length:Array.isArray(t[e])&&t[e].length})).join("")}\n </ul>\n `}({db:t}):"<p>No resources found</p>"}\n </div>\n `}window.fetch("db").then(t=>t.json()).then(t=>document.getElementById("resources").innerHTML=T({db:t})),window.fetch("__rules").then(t=>t.json()).then(t=>document.getElementById("custom-routes").innerHTML=function({customRoutes:t}){const e=Object.keys(t);if(e.length)return`\n <div>\n <h1>Custom Routes</h1>\n <table>\n ${e.map(e=>`<tr>\n <td>${e}</td>\n <td><code>⇢</code> ${t[e]}</td>\n </tr>`).join("")}\n </table>\n </div>\n `}({customRoutes:t}))}]);
package/lib/cli/bin.js CHANGED
@@ -1,3 +1,6 @@
1
- 'use strict';
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ require('please-upgrade-node')(require('../../package.json'));
2
5
 
3
6
  require('./')();
package/lib/cli/index.js CHANGED
@@ -1,12 +1,17 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  const updateNotifier = require('update-notifier');
4
+
4
5
  const yargs = require('yargs');
6
+
5
7
  const run = require('./run');
8
+
6
9
  const pkg = require('../../package.json');
7
10
 
8
11
  module.exports = function () {
9
- updateNotifier({ pkg }).notify();
12
+ updateNotifier({
13
+ pkg
14
+ }).notify();
10
15
 
11
16
  const argv = yargs.config('config').usage('$0 [options] <source>').options({
12
17
  port: {
@@ -17,7 +22,7 @@ module.exports = function () {
17
22
  host: {
18
23
  alias: 'H',
19
24
  description: 'Set host',
20
- default: '0.0.0.0'
25
+ default: 'localhost'
21
26
  },
22
27
  watch: {
23
28
  alias: 'w',