mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-15 20:34:44 +00:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83c8d7f855 | ||
|
|
fdfe282130 | ||
|
|
b5fbc7e0e8 | ||
|
|
64eb3f856a | ||
|
|
18d8e61ecb | ||
|
|
2a635f92a9 | ||
|
|
44bcbeb7d6 | ||
|
|
4023831b18 | ||
|
|
969169ae20 | ||
|
|
79fa15da3d | ||
|
|
ddc08d94cc | ||
|
|
92206742d4 | ||
|
|
e2193a6080 | ||
|
|
f66c7dcb0d | ||
|
|
06f1a0e6c0 | ||
|
|
7726325b4b | ||
|
|
b6bc90cea9 | ||
|
|
cfba9b2168 | ||
|
|
f97400caaa | ||
|
|
03af9b1a16 | ||
|
|
02cef046aa | ||
|
|
c2aeac34b6 | ||
|
|
abd2f7fd39 | ||
|
|
e7cf9bf1b6 | ||
|
|
1fdd0e3ad2 | ||
|
|
af0a7e04f9 | ||
|
|
ed19a19fed | ||
|
|
8ebfcc9a54 | ||
|
|
af2a792508 | ||
|
|
14e809af6e | ||
|
|
03c5f5b446 | ||
|
|
6655b1b49d | ||
|
|
eebf076f23 | ||
|
|
198be28f4b | ||
|
|
4f720446b2 | ||
|
|
e69cb3639a | ||
|
|
1b1a86764f | ||
|
|
f50f83c4a4 | ||
|
|
eadefd996b | ||
|
|
ab52aabd1d | ||
|
|
c5a80543b3 | ||
|
|
cfd95ac024 | ||
|
|
73ff95c677 | ||
|
|
382fe6b7b9 | ||
|
|
3b714c0de3 | ||
|
|
28186227a9 | ||
|
|
2ac0f2bf3d | ||
|
|
4991f3b359 | ||
|
|
65128118c7 | ||
|
|
3eced6fa4d | ||
|
|
c4aee66c32 | ||
|
|
410c52df41 | ||
|
|
3fe7b55955 | ||
|
|
464924ed67 | ||
|
|
8108642845 | ||
|
|
18e6f29de7 | ||
|
|
d0c6b9cdca |
36
CHANGELOG.md
36
CHANGELOG.md
@@ -1,5 +1,41 @@
|
|||||||
# sapper changelog
|
# sapper changelog
|
||||||
|
|
||||||
|
## 0.25.0
|
||||||
|
|
||||||
|
* Force refresh on `goto(current_url)` ([#484](https://github.com/sveltejs/sapper/pull/484))
|
||||||
|
* Fix preloading navigation bug ([#532](https://github.com/sveltejs/sapper/issues/532))
|
||||||
|
* Don't mutate opts.headers ([#528](https://github.com/sveltejs/sapper/issues/528))
|
||||||
|
* Don't crawl hundreds of pages simultaneously ([#369](https://github.com/sveltejs/sapper/pull/369))
|
||||||
|
|
||||||
|
## 0.24.3
|
||||||
|
|
||||||
|
* Add service-worker-index.html shell file for offline support ([#422](https://github.com/sveltejs/sapper/issues/422))
|
||||||
|
* Don't cache .map files ([#534](https://github.com/sveltejs/sapper/issues/534))
|
||||||
|
|
||||||
|
## 0.24.2
|
||||||
|
|
||||||
|
* Support Rollup 1.0 ([#541](https://github.com/sveltejs/sapper/pull/541))
|
||||||
|
|
||||||
|
## 0.24.1
|
||||||
|
|
||||||
|
* Include CSS chunks in webpack build info to avoid duplication ([#529](https://github.com/sveltejs/sapper/pull/529))
|
||||||
|
* Fix preload `as` for styles ([#530](https://github.com/sveltejs/sapper/pull/530))
|
||||||
|
|
||||||
|
## 0.24.0
|
||||||
|
|
||||||
|
* Handle external URLs in `this.redirect` ([#490](https://github.com/sveltejs/sapper/issues/490))
|
||||||
|
* Strip leading `/` from basepath ([#495](https://github.com/sveltejs/sapper/issues/495))
|
||||||
|
* Treat duplicate query string parameters as arrays ([#497](https://github.com/sveltejs/sapper/issues/497))
|
||||||
|
* Don't buffer `stdout` and `stderr` ([#305](https://github.com/sveltejs/sapper/issues/305))
|
||||||
|
* Posixify `build_dir` ([#498](https://github.com/sveltejs/sapper/pull/498))
|
||||||
|
* Use `page[XY]Offset` instead of `scroll[XY]` ([#480](https://github.com/sveltejs/sapper/issues/480))
|
||||||
|
|
||||||
|
## 0.23.5
|
||||||
|
|
||||||
|
* Include lazily-imported CSS in main CSS chunk ([#492](https://github.com/sveltejs/sapper/pull/492))
|
||||||
|
* Make search param decoding spec-compliant ([#493](https://github.com/sveltejs/sapper/pull/493))
|
||||||
|
* Handle async route errors ([#488](https://github.com/sveltejs/sapper/pull/488))
|
||||||
|
|
||||||
## 0.23.4
|
## 0.23.4
|
||||||
|
|
||||||
* Ignore empty anchors when exporting ([#491](https://github.com/sveltejs/sapper/pull/491))
|
* Ignore empty anchors when exporting ([#491](https://github.com/sveltejs/sapper/pull/491))
|
||||||
|
|||||||
303
package-lock.json
generated
303
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sapper",
|
"name": "sapper",
|
||||||
"version": "0.23.1",
|
"version": "0.24.3",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1702,12 +1702,6 @@
|
|||||||
"integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==",
|
"integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"duplexer": {
|
|
||||||
"version": "0.1.1",
|
|
||||||
"resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
|
|
||||||
"integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"duplexify": {
|
"duplexify": {
|
||||||
"version": "3.6.1",
|
"version": "3.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz",
|
||||||
@@ -2043,22 +2037,6 @@
|
|||||||
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"event-stream": {
|
|
||||||
"version": "3.3.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.6.tgz",
|
|
||||||
"integrity": "sha512-dGXNg4F/FgVzlApjzItL+7naHutA3fDqbV/zAZqDDlXTjiMnQmZKu+prImWKszeBM5UQeGvAl3u1wBiKeDh61g==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"duplexer": "^0.1.1",
|
|
||||||
"flatmap-stream": "^0.1.0",
|
|
||||||
"from": "^0.1.7",
|
|
||||||
"map-stream": "0.0.7",
|
|
||||||
"pause-stream": "^0.0.11",
|
|
||||||
"split": "^1.0.1",
|
|
||||||
"stream-combiner": "^0.2.2",
|
|
||||||
"through": "^2.3.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"events": {
|
"events": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz",
|
"resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz",
|
||||||
@@ -2281,12 +2259,6 @@
|
|||||||
"write": "^0.2.1"
|
"write": "^0.2.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flatmap-stream": {
|
|
||||||
"version": "0.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/flatmap-stream/-/flatmap-stream-0.1.1.tgz",
|
|
||||||
"integrity": "sha512-lAq4tLbm3sidmdCN8G3ExaxH7cUCtP5mgDvrYowsx84dcYkJJ4I28N7gkxA6+YlSXzaGLJYIDEi9WGfXzMiXdw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"flush-write-stream": {
|
"flush-write-stream": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz",
|
||||||
@@ -2321,12 +2293,6 @@
|
|||||||
"map-cache": "^0.2.2"
|
"map-cache": "^0.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"from": {
|
|
||||||
"version": "0.1.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz",
|
|
||||||
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"from2": {
|
"from2": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
|
||||||
@@ -2368,24 +2334,28 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"abbrev": {
|
"abbrev": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"aproba": {
|
"aproba": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"are-we-there-yet": {
|
"are-we-there-yet": {
|
||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2395,12 +2365,14 @@
|
|||||||
},
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
@@ -2409,34 +2381,40 @@
|
|||||||
},
|
},
|
||||||
"chownr": {
|
"chownr": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
"version": "2.6.9",
|
"version": "2.6.9",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2445,25 +2423,29 @@
|
|||||||
},
|
},
|
||||||
"deep-extend": {
|
"deep-extend": {
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-N8vBdOa+DF7zkRrDCsaOXoCs/E2fJfx9B9MrKnnSiHNh4ws7eSys6YQE4KvT1cecKmOASYQBhbKjeuDD9lT81w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"delegates": {
|
"delegates": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"detect-libc": {
|
"detect-libc": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"fs-minipass": {
|
"fs-minipass": {
|
||||||
"version": "1.2.5",
|
"version": "1.2.5",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2472,13 +2454,15 @@
|
|||||||
},
|
},
|
||||||
"fs.realpath": {
|
"fs.realpath": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"gauge": {
|
"gauge": {
|
||||||
"version": "2.7.4",
|
"version": "2.7.4",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2494,7 +2478,8 @@
|
|||||||
},
|
},
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "7.1.2",
|
"version": "7.1.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2508,13 +2493,15 @@
|
|||||||
},
|
},
|
||||||
"has-unicode": {
|
"has-unicode": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"iconv-lite": {
|
"iconv-lite": {
|
||||||
"version": "0.4.21",
|
"version": "0.4.21",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2523,7 +2510,8 @@
|
|||||||
},
|
},
|
||||||
"ignore-walk": {
|
"ignore-walk": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2532,7 +2520,8 @@
|
|||||||
},
|
},
|
||||||
"inflight": {
|
"inflight": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2542,18 +2531,21 @@
|
|||||||
},
|
},
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"is-fullwidth-code-point": {
|
"is-fullwidth-code-point": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"number-is-nan": "^1.0.0"
|
"number-is-nan": "^1.0.0"
|
||||||
@@ -2561,13 +2553,15 @@
|
|||||||
},
|
},
|
||||||
"isarray": {
|
"isarray": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"minimatch": {
|
"minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
@@ -2575,12 +2569,14 @@
|
|||||||
},
|
},
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.2.4",
|
"version": "2.2.4",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-hzXIWWet/BzWhYs2b+u7dRHlruXhwdgvlTMDKC6Cb1U7ps6Ac6yQlR39xsbjWJE377YTCtKwIXIpJ5oP+j5y8g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "^5.1.1",
|
"safe-buffer": "^5.1.1",
|
||||||
@@ -2589,7 +2585,8 @@
|
|||||||
},
|
},
|
||||||
"minizlib": {
|
"minizlib": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2598,7 +2595,8 @@
|
|||||||
},
|
},
|
||||||
"mkdirp": {
|
"mkdirp": {
|
||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
@@ -2606,13 +2604,15 @@
|
|||||||
},
|
},
|
||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"needle": {
|
"needle": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-eFagy6c+TYayorXw/qtAdSvaUpEbBsDwDyxYFgLZ0lTojfH7K+OdBqAF7TAFwDokJaGpubpSGG0wO3iC0XPi8w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2623,7 +2623,8 @@
|
|||||||
},
|
},
|
||||||
"node-pre-gyp": {
|
"node-pre-gyp": {
|
||||||
"version": "0.10.0",
|
"version": "0.10.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-G7kEonQLRbcA/mOoFoxvlMrw6Q6dPf92+t/l0DFSMuSlDoWaI9JWIyPwK0jyE1bph//CUEL65/Fz1m2vJbmjQQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2641,7 +2642,8 @@
|
|||||||
},
|
},
|
||||||
"nopt": {
|
"nopt": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2651,13 +2653,15 @@
|
|||||||
},
|
},
|
||||||
"npm-bundled": {
|
"npm-bundled": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"npm-packlist": {
|
"npm-packlist": {
|
||||||
"version": "1.1.10",
|
"version": "1.1.10",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-AQC0Dyhzn4EiYEfIUjCdMl0JJ61I2ER9ukf/sLxJUcZHfo+VyEfz2rMJgLZSS1v30OxPQe1cN0LZA1xbcaVfWA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2667,7 +2671,8 @@
|
|||||||
},
|
},
|
||||||
"npmlog": {
|
"npmlog": {
|
||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2679,18 +2684,21 @@
|
|||||||
},
|
},
|
||||||
"number-is-nan": {
|
"number-is-nan": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"object-assign": {
|
"object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"once": {
|
"once": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
@@ -2698,19 +2706,22 @@
|
|||||||
},
|
},
|
||||||
"os-homedir": {
|
"os-homedir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"os-tmpdir": {
|
"os-tmpdir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"osenv": {
|
"osenv": {
|
||||||
"version": "0.1.5",
|
"version": "0.1.5",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2720,19 +2731,22 @@
|
|||||||
},
|
},
|
||||||
"path-is-absolute": {
|
"path-is-absolute": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"process-nextick-args": {
|
"process-nextick-args": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"rc": {
|
"rc": {
|
||||||
"version": "1.2.7",
|
"version": "1.2.7",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-LdLD8xD4zzLsAT5xyushXDNscEjB7+2ulnl8+r1pnESlYtlJtVSoCMBGr30eDRJ3+2Gq89jK9P9e4tCEH1+ywA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2744,7 +2758,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
}
|
}
|
||||||
@@ -2752,7 +2767,8 @@
|
|||||||
},
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "2.3.6",
|
"version": "2.3.6",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2767,7 +2783,8 @@
|
|||||||
},
|
},
|
||||||
"rimraf": {
|
"rimraf": {
|
||||||
"version": "2.6.2",
|
"version": "2.6.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2776,42 +2793,49 @@
|
|||||||
},
|
},
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"sax": {
|
"sax": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"semver": {
|
"semver": {
|
||||||
"version": "5.5.0",
|
"version": "5.5.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"set-blocking": {
|
"set-blocking": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"signal-exit": {
|
"signal-exit": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"string-width": {
|
"string-width": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"code-point-at": "^1.0.0",
|
||||||
@@ -2821,7 +2845,8 @@
|
|||||||
},
|
},
|
||||||
"string_decoder": {
|
"string_decoder": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2830,7 +2855,8 @@
|
|||||||
},
|
},
|
||||||
"strip-ansi": {
|
"strip-ansi": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
@@ -2838,13 +2864,15 @@
|
|||||||
},
|
},
|
||||||
"strip-json-comments": {
|
"strip-json-comments": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"tar": {
|
"tar": {
|
||||||
"version": "4.4.1",
|
"version": "4.4.1",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-O+v1r9yN4tOsvl90p5HAP4AEqbYhx4036AGMm075fH9F8Qwi3oJ+v4u50FkT/KkvywNGtwkk0zRI+8eYm1X/xg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2859,13 +2887,15 @@
|
|||||||
},
|
},
|
||||||
"util-deprecate": {
|
"util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
"wide-align": {
|
"wide-align": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -2874,12 +2904,14 @@
|
|||||||
},
|
},
|
||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"bundled": true,
|
"resolved": false,
|
||||||
|
"integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k=",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3648,12 +3680,6 @@
|
|||||||
"integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
|
"integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"map-stream": {
|
|
||||||
"version": "0.0.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.0.7.tgz",
|
|
||||||
"integrity": "sha1-ih8HiW2CsQkmvTdEokIACfiJdKg=",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"map-visit": {
|
"map-visit": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
|
||||||
@@ -4059,17 +4085,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npm-run-all": {
|
"npm-run-all": {
|
||||||
"version": "4.1.3",
|
"version": "4.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz",
|
||||||
"integrity": "sha512-aOG0N3Eo/WW+q6sUIdzcV2COS8VnTZCmdji0VQIAZF3b+a3YWb0AD0vFIyjKec18A7beLGbaQ5jFTNI2bPt9Cg==",
|
"integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-styles": "^3.2.0",
|
"ansi-styles": "^3.2.1",
|
||||||
"chalk": "^2.1.0",
|
"chalk": "^2.4.1",
|
||||||
"cross-spawn": "^6.0.4",
|
"cross-spawn": "^6.0.5",
|
||||||
"memorystream": "^0.3.1",
|
"memorystream": "^0.3.1",
|
||||||
"minimatch": "^3.0.4",
|
"minimatch": "^3.0.4",
|
||||||
"ps-tree": "^1.1.0",
|
"pidtree": "^0.3.0",
|
||||||
"read-pkg": "^3.0.0",
|
"read-pkg": "^3.0.0",
|
||||||
"shell-quote": "^1.6.1",
|
"shell-quote": "^1.6.1",
|
||||||
"string.prototype.padend": "^3.0.0"
|
"string.prototype.padend": "^3.0.0"
|
||||||
@@ -4399,15 +4425,6 @@
|
|||||||
"pify": "^2.0.0"
|
"pify": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pause-stream": {
|
|
||||||
"version": "0.0.11",
|
|
||||||
"resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz",
|
|
||||||
"integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"through": "~2.3"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pbkdf2": {
|
"pbkdf2": {
|
||||||
"version": "3.0.17",
|
"version": "3.0.17",
|
||||||
"resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz",
|
"resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz",
|
||||||
@@ -4427,6 +4444,12 @@
|
|||||||
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
|
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"pidtree": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-9CT4NFlDcosssyg8KVFltgokyKZIFjoBxw8CTGy+5F38Y1eQWrt8tRayiUOXE+zVKQnYu5BR8JjCtvK3BcnBhg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"pify": {
|
"pify": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
||||||
@@ -4539,15 +4562,6 @@
|
|||||||
"integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
|
"integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ps-tree": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.1.0.tgz",
|
|
||||||
"integrity": "sha1-tCGyQUDWID8e08dplrRCewjowBQ=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"event-stream": "~3.3.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pseudomap": {
|
"pseudomap": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||||
@@ -5665,15 +5679,6 @@
|
|||||||
"integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==",
|
"integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"split": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"through": "2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"split-string": {
|
"split-string": {
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
|
||||||
@@ -5729,16 +5734,6 @@
|
|||||||
"readable-stream": "^2.0.2"
|
"readable-stream": "^2.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"stream-combiner": {
|
|
||||||
"version": "0.2.2",
|
|
||||||
"resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz",
|
|
||||||
"integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"duplexer": "~0.1.1",
|
|
||||||
"through": "~2.3.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"stream-each": {
|
"stream-each": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz",
|
||||||
@@ -6696,6 +6691,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
|
||||||
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",
|
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"yootils": {
|
||||||
|
"version": "0.0.14",
|
||||||
|
"resolved": "https://registry.npmjs.org/yootils/-/yootils-0.0.14.tgz",
|
||||||
|
"integrity": "sha512-yWoA/a/4aVUp5nqfqdjbTdyXcR8d0OAbRQ8Ktu3ZsfQnArwLpS81oqZl3adIszX3p8NEhT0aNHARPsaTwBH/Qw==",
|
||||||
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sapper",
|
"name": "sapper",
|
||||||
"version": "0.23.4",
|
"version": "0.25.0",
|
||||||
"description": "Military-grade apps, engineered by Svelte",
|
"description": "Military-grade apps, engineered by Svelte",
|
||||||
"bin": {
|
"bin": {
|
||||||
"sapper": "./sapper"
|
"sapper": "./sapper"
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"node-fetch": "^2.2.0",
|
"node-fetch": "^2.2.0",
|
||||||
"npm-run-all": "^4.1.3",
|
"npm-run-all": "^4.1.5",
|
||||||
"polka": "^0.5.1",
|
"polka": "^0.5.1",
|
||||||
"port-authority": "^1.0.5",
|
"port-authority": "^1.0.5",
|
||||||
"pretty-bytes": "^5.1.0",
|
"pretty-bytes": "^5.1.0",
|
||||||
@@ -63,7 +63,8 @@
|
|||||||
"ts-node": "^7.0.1",
|
"ts-node": "^7.0.1",
|
||||||
"typescript": "^3.1.3",
|
"typescript": "^3.1.3",
|
||||||
"webpack": "^4.20.2",
|
"webpack": "^4.20.2",
|
||||||
"webpack-format-messages": "^2.0.3"
|
"webpack-format-messages": "^2.0.3",
|
||||||
|
"yootils": "0.0.14"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --opts mocha.opts",
|
"test": "mocha --opts mocha.opts",
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export async function build({
|
|||||||
routes = path.resolve(cwd, routes);
|
routes = path.resolve(cwd, routes);
|
||||||
output = path.resolve(cwd, output);
|
output = path.resolve(cwd, output);
|
||||||
static_files = path.resolve(cwd, static_files);
|
static_files = path.resolve(cwd, static_files);
|
||||||
dest = path.resolve(cwd, dest);
|
|
||||||
|
|
||||||
if (legacy && bundler === 'webpack') {
|
if (legacy && bundler === 'webpack') {
|
||||||
throw new Error(`Legacy builds are not supported for projects using webpack`);
|
throw new Error(`Legacy builds are not supported for projects using webpack`);
|
||||||
@@ -116,10 +115,15 @@ export async function build({
|
|||||||
let serviceworker_stats;
|
let serviceworker_stats;
|
||||||
|
|
||||||
if (serviceworker) {
|
if (serviceworker) {
|
||||||
|
|
||||||
|
const client_files = client_result.chunks
|
||||||
|
.filter(chunk => !chunk.file.endsWith('.map')) // SW does not need to cache sourcemap files
|
||||||
|
.map(chunk => `client/${chunk.file}`);
|
||||||
|
|
||||||
create_serviceworker_manifest({
|
create_serviceworker_manifest({
|
||||||
manifest_data,
|
manifest_data,
|
||||||
output,
|
output,
|
||||||
client_files: client_result.chunks.map(chunk => `client/${chunk.file}`),
|
client_files,
|
||||||
static_files
|
static_files
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -214,12 +214,9 @@ class Watcher extends EventEmitter {
|
|||||||
// TODO watch the configs themselves?
|
// TODO watch the configs themselves?
|
||||||
const compilers: Compilers = await create_compilers(this.bundler, cwd, src, dest, false);
|
const compilers: Compilers = await create_compilers(this.bundler, cwd, src, dest, false);
|
||||||
|
|
||||||
let log = '';
|
|
||||||
|
|
||||||
const emitFatal = () => {
|
const emitFatal = () => {
|
||||||
this.emit('fatal', <FatalEvent>{
|
this.emit('fatal', <FatalEvent>{
|
||||||
message: `Server crashed`,
|
message: `Server crashed`
|
||||||
log
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.crashed = true;
|
this.crashed = true;
|
||||||
@@ -236,7 +233,6 @@ class Watcher extends EventEmitter {
|
|||||||
handle_result: (result: CompileResult) => {
|
handle_result: (result: CompileResult) => {
|
||||||
deferred.promise.then(() => {
|
deferred.promise.then(() => {
|
||||||
const restart = () => {
|
const restart = () => {
|
||||||
log = '';
|
|
||||||
this.crashed = false;
|
this.crashed = false;
|
||||||
|
|
||||||
ports.wait(this.port)
|
ports.wait(this.port)
|
||||||
@@ -260,8 +256,7 @@ class Watcher extends EventEmitter {
|
|||||||
if (this.crashed) return;
|
if (this.crashed) return;
|
||||||
|
|
||||||
this.emit('fatal', <FatalEvent>{
|
this.emit('fatal', <FatalEvent>{
|
||||||
message: `Server is not listening on port ${this.port}`,
|
message: `Server is not listening on port ${this.port}`
|
||||||
log
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -292,12 +287,10 @@ class Watcher extends EventEmitter {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.proc.stdout.on('data', chunk => {
|
this.proc.stdout.on('data', chunk => {
|
||||||
log += chunk;
|
|
||||||
this.emit('stdout', chunk);
|
this.emit('stdout', chunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.proc.stderr.on('data', chunk => {
|
this.proc.stderr.on('data', chunk => {
|
||||||
log += chunk;
|
|
||||||
this.emit('stderr', chunk);
|
this.emit('stderr', chunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import * as path from 'path';
|
|||||||
import * as sander from 'sander';
|
import * as sander from 'sander';
|
||||||
import * as url from 'url';
|
import * as url from 'url';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
|
import * as yootils from 'yootils';
|
||||||
import * as ports from 'port-authority';
|
import * as ports from 'port-authority';
|
||||||
import clean_html from './utils/clean_html';
|
import clean_html from './utils/clean_html';
|
||||||
import minify_html from './utils/minify_html';
|
import minify_html from './utils/minify_html';
|
||||||
@@ -38,6 +39,8 @@ async function _export({
|
|||||||
oninfo = noop,
|
oninfo = noop,
|
||||||
onfile = noop
|
onfile = noop
|
||||||
}: Opts = {}) {
|
}: Opts = {}) {
|
||||||
|
basepath = basepath.replace(/^\//, '')
|
||||||
|
|
||||||
cwd = path.resolve(cwd);
|
cwd = path.resolve(cwd);
|
||||||
static_files = path.resolve(cwd, static_files);
|
static_files = path.resolve(cwd, static_files);
|
||||||
build_dir = path.resolve(cwd, build_dir);
|
build_dir = path.resolve(cwd, build_dir);
|
||||||
@@ -92,7 +95,9 @@ async function _export({
|
|||||||
const is_html = type === 'text/html';
|
const is_html = type === 'text/html';
|
||||||
|
|
||||||
if (is_html) {
|
if (is_html) {
|
||||||
file = file === '' ? 'index.html' : `${file}/index.html`;
|
if (pathname !== '/service-worker-index.html') {
|
||||||
|
file = file === '' ? 'index.html' : `${file}/index.html`;
|
||||||
|
}
|
||||||
body = minify_html(body);
|
body = minify_html(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +116,10 @@ async function _export({
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function handle(url: URL) {
|
async function handle(url: URL) {
|
||||||
const pathname = (url.pathname.replace(root.pathname, '') || '/');
|
let pathname = url.pathname;
|
||||||
|
if (pathname !== '/service-worker-index.html') {
|
||||||
|
pathname = pathname.replace(root.pathname, '') || '/'
|
||||||
|
}
|
||||||
|
|
||||||
if (seen.has(pathname)) return;
|
if (seen.has(pathname)) return;
|
||||||
seen.add(pathname);
|
seen.add(pathname);
|
||||||
@@ -136,11 +144,12 @@ async function _export({
|
|||||||
const range = ~~(r.status / 100);
|
const range = ~~(r.status / 100);
|
||||||
|
|
||||||
if (range === 2) {
|
if (range === 2) {
|
||||||
if (type === 'text/html') {
|
if (type === 'text/html' && pathname !== '/service-worker-index.html') {
|
||||||
const urls: URL[] = [];
|
|
||||||
|
|
||||||
const cleaned = clean_html(body);
|
const cleaned = clean_html(body);
|
||||||
|
|
||||||
|
const q = yootils.queue(8);
|
||||||
|
let promise;
|
||||||
|
|
||||||
const base_match = /<base ([\s\S]+?)>/m.exec(cleaned);
|
const base_match = /<base ([\s\S]+?)>/m.exec(cleaned);
|
||||||
const base_href = base_match && get_href(base_match[1]);
|
const base_href = base_match && get_href(base_match[1]);
|
||||||
const base = resolve(url.href, base_href);
|
const base = resolve(url.href, base_href);
|
||||||
@@ -156,12 +165,12 @@ async function _export({
|
|||||||
const url = resolve(base.href, href);
|
const url = resolve(base.href, href);
|
||||||
|
|
||||||
if (url.protocol === protocol && url.host === host) {
|
if (url.protocol === protocol && url.host === host) {
|
||||||
urls.push(url);
|
promise = q.add(() => handle(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(urls.map(handle));
|
await promise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,6 +188,7 @@ async function _export({
|
|||||||
|
|
||||||
return ports.wait(port)
|
return ports.wait(port)
|
||||||
.then(() => handle(root))
|
.then(() => handle(root))
|
||||||
|
.then(() => handle(resolve(root.href, 'service-worker-index.html')))
|
||||||
.then(() => proc.kill())
|
.then(() => proc.kill())
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
proc.kill();
|
proc.kill();
|
||||||
|
|||||||
18
src/cli.ts
18
src/cli.ts
@@ -64,6 +64,14 @@ prog.command('dev')
|
|||||||
|
|
||||||
let first = true;
|
let first = true;
|
||||||
|
|
||||||
|
watcher.on('stdout', data => {
|
||||||
|
process.stdout.write(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
watcher.on('stderr', data => {
|
||||||
|
process.stderr.write(data);
|
||||||
|
});
|
||||||
|
|
||||||
watcher.on('ready', async (event: ReadyEvent) => {
|
watcher.on('ready', async (event: ReadyEvent) => {
|
||||||
if (first) {
|
if (first) {
|
||||||
console.log(colors.bold.cyan(`> Listening on http://localhost:${event.port}`));
|
console.log(colors.bold.cyan(`> Listening on http://localhost:${event.port}`));
|
||||||
@@ -73,16 +81,6 @@ prog.command('dev')
|
|||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO clear screen?
|
|
||||||
|
|
||||||
event.process.stdout.on('data', data => {
|
|
||||||
process.stdout.write(data);
|
|
||||||
});
|
|
||||||
|
|
||||||
event.process.stderr.on('data', data => {
|
|
||||||
process.stderr.write(data);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
watcher.on('invalid', (event: InvalidEvent) => {
|
watcher.on('invalid', (event: InvalidEvent) => {
|
||||||
|
|||||||
@@ -142,12 +142,14 @@ export default class RollupCompiler {
|
|||||||
|
|
||||||
const bundle = await rollup.rollup({
|
const bundle = await rollup.rollup({
|
||||||
input,
|
input,
|
||||||
|
inlineDynamicImports: true,
|
||||||
external: (id: string) => {
|
external: (id: string) => {
|
||||||
return (id[0] !== '.' && !path.isAbsolute(id)) || id.slice(-5, id.length) === '.json';
|
return (id[0] !== '.' && !path.isAbsolute(id)) || id.slice(-5, id.length) === '.json';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { code } = await bundle.generate({ format: 'cjs' });
|
const resp = await bundle.generate({ format: 'cjs' });
|
||||||
|
const { code } = resp.output ? resp.output[0] : resp;
|
||||||
|
|
||||||
// temporarily override require
|
// temporarily override require
|
||||||
const defaultLoader = require.extensions['.js'];
|
const defaultLoader = require.extensions['.js'];
|
||||||
|
|||||||
@@ -55,14 +55,25 @@ export default class WebpackResult implements CompileResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
to_json(manifest_data: ManifestData, dirs: Dirs): BuildInfo {
|
to_json(manifest_data: ManifestData, dirs: Dirs): BuildInfo {
|
||||||
|
const extract_css = (assets: string[] | string) => {
|
||||||
|
assets = Array.isArray(assets) ? assets : [assets];
|
||||||
|
return assets.find(asset => /\.css$/.test(asset));
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
bundler: 'webpack',
|
bundler: 'webpack',
|
||||||
shimport: null, // webpack has its own loader
|
shimport: null, // webpack has its own loader
|
||||||
assets: this.assets,
|
assets: this.assets,
|
||||||
css: {
|
css: {
|
||||||
// TODO
|
main: extract_css(this.assets.main),
|
||||||
main: null,
|
chunks: Object
|
||||||
chunks: {}
|
.keys(this.assets)
|
||||||
|
.filter(chunkName => chunkName !== 'main')
|
||||||
|
.reduce((chunks: { [key: string]: string }, chukName) => {
|
||||||
|
const assets = this.assets[chukName];
|
||||||
|
chunks[chukName] = extract_css(assets);
|
||||||
|
return chunks;
|
||||||
|
}, {})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ export default function extract_css(client_result: CompileResult, components: Pa
|
|||||||
});
|
});
|
||||||
|
|
||||||
unclaimed.forEach(file => {
|
unclaimed.forEach(file => {
|
||||||
entry_css_modules.push(css_map.get(file));
|
entry_css_modules.push(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
const leftover = get_css_from_modules(entry_css_modules, css_map, dirs);
|
const leftover = get_css_from_modules(entry_css_modules, css_map, dirs);
|
||||||
|
|||||||
@@ -45,17 +45,15 @@ export function create_serviceworker_manifest({ manifest_data, output, client_fi
|
|||||||
client_files: string[];
|
client_files: string[];
|
||||||
static_files: string;
|
static_files: string;
|
||||||
}) {
|
}) {
|
||||||
let files: string[];
|
let files: string[] = ['/service-worker-index.html'];
|
||||||
|
|
||||||
if (fs.existsSync(static_files)) {
|
if (fs.existsSync(static_files)) {
|
||||||
files = walk(static_files);
|
files = files.concat(walk(static_files));
|
||||||
} else {
|
} else {
|
||||||
// TODO remove in a future version
|
// TODO remove in a future version
|
||||||
if (fs.existsSync('assets')) {
|
if (fs.existsSync('assets')) {
|
||||||
throw new Error(`As of Sapper 0.21, the assets/ directory should become static/`);
|
throw new Error(`As of Sapper 0.21, the assets/ directory should become static/`);
|
||||||
}
|
}
|
||||||
|
|
||||||
files = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let code = `
|
let code = `
|
||||||
@@ -226,8 +224,8 @@ function generate_server(
|
|||||||
error
|
error
|
||||||
};`.replace(/^\t\t/gm, '').trim();
|
};`.replace(/^\t\t/gm, '').trim();
|
||||||
|
|
||||||
const build_dir = path.relative(cwd, dest);
|
const build_dir = posixify(path.relative(cwd, dest));
|
||||||
const src_dir = path.relative(cwd, src);
|
const src_dir = posixify(path.relative(cwd, src));
|
||||||
|
|
||||||
return `// This file is generated by Sapper — do not edit it!\n` + template
|
return `// This file is generated by Sapper — do not edit it!\n` + template
|
||||||
.replace('__BUILD__DIR__', JSON.stringify(build_dir))
|
.replace('__BUILD__DIR__', JSON.stringify(build_dir))
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ export type ErrorEvent = {
|
|||||||
|
|
||||||
export type FatalEvent = {
|
export type FatalEvent = {
|
||||||
message: string;
|
message: string;
|
||||||
log?: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type InvalidEvent = {
|
export type InvalidEvent = {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const root_props: RootProps = {
|
|||||||
|
|
||||||
export let prefetching: {
|
export let prefetching: {
|
||||||
href: string;
|
href: string;
|
||||||
promise: Promise<{ redirect?: Redirect, data?: any, nullable_depth?: number }>;
|
promise: Promise<{ redirect?: Redirect, data?: any, nullable_depth?: number, new_segments?: any }>;
|
||||||
} = null;
|
} = null;
|
||||||
export function set_prefetching(href, promise) {
|
export function set_prefetching(href, promise) {
|
||||||
prefetching = { href, promise };
|
prefetching = { href, promise };
|
||||||
@@ -87,11 +87,14 @@ export function select_route(url: URL): Target {
|
|||||||
|
|
||||||
const match = page.pattern.exec(path);
|
const match = page.pattern.exec(path);
|
||||||
if (match) {
|
if (match) {
|
||||||
const query: Record<string, string | true> = {};
|
const query: Record<string, string | string[]> = Object.create(null);
|
||||||
if (url.search.length > 0) {
|
if (url.search.length > 0) {
|
||||||
url.search.slice(1).split('&').forEach(searchParam => {
|
url.search.slice(1).split('&').forEach(searchParam => {
|
||||||
const [, key, value] = /([^=]+)(?:=(.*))?/.exec(searchParam);
|
let [, key, value] = /([^=]*)(?:=(.*))?/.exec(decodeURIComponent(searchParam));
|
||||||
query[key] = decodeURIComponent((value || '').replace(/\+/g, ' '));
|
value = (value || '').replace(/\+/g, ' ');
|
||||||
|
if (typeof query[key] === 'string') query[key] = [<string>query[key]];
|
||||||
|
if (typeof query[key] === 'object') query[key].push(value);
|
||||||
|
else query[key] = value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return { url, path, page, match, query };
|
return { url, path, page, match, query };
|
||||||
@@ -101,8 +104,8 @@ export function select_route(url: URL): Target {
|
|||||||
|
|
||||||
export function scroll_state() {
|
export function scroll_state() {
|
||||||
return {
|
return {
|
||||||
x: scrollX,
|
x: pageXOffset,
|
||||||
y: scrollY
|
y: pageYOffset
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,10 +137,13 @@ export function navigate(target: Target, id: number, noscroll?: boolean, hash?:
|
|||||||
|
|
||||||
const token = current_token = {};
|
const token = current_token = {};
|
||||||
|
|
||||||
return loaded.then(({ redirect, data, nullable_depth }) => {
|
return loaded.then(({ redirect, data, nullable_depth, new_segments }) => {
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
return goto(redirect.location, { replaceState: true });
|
return goto(redirect.location, { replaceState: true });
|
||||||
}
|
}
|
||||||
|
if (new_segments) {
|
||||||
|
segments = new_segments;
|
||||||
|
}
|
||||||
render(data, nullable_depth, scroll_history[id], noscroll, hash, token);
|
render(data, nullable_depth, scroll_history[id], noscroll, hash, token);
|
||||||
if (document.activeElement) document.activeElement.blur();
|
if (document.activeElement) document.activeElement.blur();
|
||||||
});
|
});
|
||||||
@@ -217,6 +223,10 @@ export function prepare_page(target: Target): Promise<{
|
|||||||
segments[changed_from] === new_segments[changed_from]
|
segments[changed_from] === new_segments[changed_from]
|
||||||
) changed_from += 1;
|
) changed_from += 1;
|
||||||
|
|
||||||
|
if (changed_from === new_segments.length) {
|
||||||
|
changed_from -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
let redirect: Redirect = null;
|
let redirect: Redirect = null;
|
||||||
let error: { statusCode: number, message: Error | string } = null;
|
let error: { statusCode: number, message: Error | string } = null;
|
||||||
|
|
||||||
@@ -282,11 +292,9 @@ export function prepare_page(target: Target): Promise<{
|
|||||||
}
|
}
|
||||||
}).then(results => {
|
}).then(results => {
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
return { redirect };
|
return { redirect, new_segments };
|
||||||
}
|
}
|
||||||
|
|
||||||
segments = new_segments;
|
|
||||||
|
|
||||||
const get_params = page.parts[page.parts.length - 1].params || (() => ({}));
|
const get_params = page.parts[page.parts.length - 1].params || (() => ({}));
|
||||||
const params = get_params(target.match);
|
const params = get_params(target.match);
|
||||||
|
|
||||||
@@ -300,6 +308,7 @@ export function prepare_page(target: Target): Promise<{
|
|||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
new_segments,
|
||||||
data: Object.assign({}, props, {
|
data: Object.assign({}, props, {
|
||||||
preloading: false,
|
preloading: false,
|
||||||
child: {
|
child: {
|
||||||
@@ -315,7 +324,7 @@ export function prepare_page(target: Target): Promise<{
|
|||||||
path,
|
path,
|
||||||
preloading: false,
|
preloading: false,
|
||||||
child: Object.assign({}, root_props.child, {
|
child: Object.assign({}, root_props.child, {
|
||||||
segment: segments[0]
|
segment: new_segments[0]
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
if (changed(query, root_props.query)) data.query = query;
|
if (changed(query, root_props.query)) data.query = query;
|
||||||
@@ -346,10 +355,10 @@ export function prepare_page(target: Target): Promise<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
level = level.props.child;
|
level = level.props.child;
|
||||||
level.segment = segments[i + 1];
|
level.segment = new_segments[i + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return { data, nullable_depth };
|
return { data, nullable_depth, new_segments };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export type Target = {
|
|||||||
path: string;
|
path: string;
|
||||||
page: Page;
|
page: Page;
|
||||||
match: RegExpExecArray;
|
match: RegExpExecArray;
|
||||||
query: Record<string, string | true>;
|
query: Record<string, string | string[]>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Redirect = {
|
export type Redirect = {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import * as path from 'path';
|
|||||||
import cookie from 'cookie';
|
import cookie from 'cookie';
|
||||||
import devalue from 'devalue';
|
import devalue from 'devalue';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { URL } from 'url';
|
import { URL, resolve } from 'url';
|
||||||
import { build_dir, dev, src_dir, IGNORE } from '../placeholders';
|
import { build_dir, dev, src_dir, IGNORE } from '../placeholders';
|
||||||
import { Manifest, Page, Props, Req, Res, Store } from './types';
|
import { Manifest, Page, Props, Req, Res, Store } from './types';
|
||||||
|
|
||||||
@@ -34,6 +34,7 @@ export function get_page_handler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handle_page(page: Page, req: Req, res: Res, status = 200, error: Error | string = null) {
|
async function handle_page(page: Page, req: Req, res: Res, status = 200, error: Error | string = null) {
|
||||||
|
const isSWIndexHtml = req.path === '/service-worker-index.html';
|
||||||
const build_info: {
|
const build_info: {
|
||||||
bundler: 'rollup' | 'webpack',
|
bundler: 'rollup' | 'webpack',
|
||||||
shimport: string | null,
|
shimport: string | null,
|
||||||
@@ -47,7 +48,7 @@ export function get_page_handler(
|
|||||||
// preload main.js and current route
|
// preload main.js and current route
|
||||||
// TODO detect other stuff we can preload? images, CSS, fonts?
|
// TODO detect other stuff we can preload? images, CSS, fonts?
|
||||||
let preloaded_chunks = Array.isArray(build_info.assets.main) ? build_info.assets.main : [build_info.assets.main];
|
let preloaded_chunks = Array.isArray(build_info.assets.main) ? build_info.assets.main : [build_info.assets.main];
|
||||||
if (!error) {
|
if (!error && !isSWIndexHtml) {
|
||||||
page.parts.forEach(part => {
|
page.parts.forEach(part => {
|
||||||
if (!part) return;
|
if (!part) return;
|
||||||
|
|
||||||
@@ -67,7 +68,10 @@ export function get_page_handler(
|
|||||||
} else {
|
} else {
|
||||||
const link = preloaded_chunks
|
const link = preloaded_chunks
|
||||||
.filter(file => file && !file.match(/\.map$/))
|
.filter(file => file && !file.match(/\.map$/))
|
||||||
.map(file => `<${req.baseUrl}/client/${file}>;rel="preload";as="script"`)
|
.map((file) => {
|
||||||
|
const as = /\.css$/.test(file) ? 'style' : 'script';
|
||||||
|
return `<${req.baseUrl}/client/${file}>;rel="preload";as="${as}"`;
|
||||||
|
})
|
||||||
.join(', ');
|
.join(', ');
|
||||||
|
|
||||||
res.setHeader('Link', link);
|
res.setHeader('Link', link);
|
||||||
@@ -101,7 +105,7 @@ export function get_page_handler(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (include_cookies) {
|
if (include_cookies) {
|
||||||
if (!opts.headers) opts.headers = {};
|
opts.headers = Object.assign({}, opts.headers);
|
||||||
|
|
||||||
const cookies = Object.assign(
|
const cookies = Object.assign(
|
||||||
{},
|
{},
|
||||||
@@ -142,17 +146,22 @@ export function get_page_handler(
|
|||||||
|
|
||||||
match = error ? null : page.pattern.exec(req.path);
|
match = error ? null : page.pattern.exec(req.path);
|
||||||
|
|
||||||
preloaded = await Promise.all([root_preloaded].concat(page.parts.map(part => {
|
let toPreload = [root_preloaded];
|
||||||
if (!part) return null;
|
if (!isSWIndexHtml) {
|
||||||
|
toPreload = toPreload.concat(page.parts.map(part => {
|
||||||
|
if (!part) return null;
|
||||||
|
|
||||||
return part.component.preload
|
return part.component.preload
|
||||||
? part.component.preload.call(preload_context, {
|
? part.component.preload.call(preload_context, {
|
||||||
path: req.path,
|
path: req.path,
|
||||||
query: req.query,
|
query: req.query,
|
||||||
params: part.params ? part.params(match) : {}
|
params: part.params ? part.params(match) : {}
|
||||||
})
|
})
|
||||||
: {};
|
: {};
|
||||||
})));
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
preloaded = await Promise.all(toPreload);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
preload_error = { statusCode: 500, message: err };
|
preload_error = { statusCode: 500, message: err };
|
||||||
preloaded = []; // appease TypeScript
|
preloaded = []; // appease TypeScript
|
||||||
@@ -160,7 +169,7 @@ export function get_page_handler(
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
const location = `${req.baseUrl}/${redirect.location}`;
|
const location = resolve(req.baseUrl || '/', redirect.location);
|
||||||
|
|
||||||
res.statusCode = redirect.statusCode;
|
res.statusCode = redirect.statusCode;
|
||||||
res.setHeader('Location', location);
|
res.setHeader('Location', location);
|
||||||
@@ -201,23 +210,29 @@ export function get_page_handler(
|
|||||||
});
|
});
|
||||||
|
|
||||||
let level = data.child;
|
let level = data.child;
|
||||||
for (let i = 0; i < page.parts.length; i += 1) {
|
if (isSWIndexHtml) {
|
||||||
const part = page.parts[i];
|
level.props = Object.assign({}, props, {
|
||||||
if (!part) continue;
|
params: {}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < page.parts.length; i += 1) {
|
||||||
|
const part = page.parts[i];
|
||||||
|
if (!part) continue;
|
||||||
|
|
||||||
const get_params = part.params || (() => ({}));
|
const get_params = part.params || (() => ({}));
|
||||||
|
|
||||||
Object.assign(level, {
|
Object.assign(level, {
|
||||||
component: part.component,
|
component: part.component,
|
||||||
props: Object.assign({}, props, {
|
props: Object.assign({}, props, {
|
||||||
params: get_params(match)
|
params: get_params(match)
|
||||||
}, preloaded[i + 1])
|
}, preloaded[i + 1])
|
||||||
});
|
});
|
||||||
|
|
||||||
level.props.child = <Props["child"]>{
|
level.props.child = <Props["child"]>{
|
||||||
segment: segments[i + 1]
|
segment: segments[i + 1]
|
||||||
};
|
};
|
||||||
level = level.props.child;
|
level = level.props.child;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { html, head, css } = manifest.root.render(data, {
|
const { html, head, css } = manifest.root.render(data, {
|
||||||
@@ -300,6 +315,12 @@ export function get_page_handler(
|
|||||||
return function find_route(req: Req, res: Res, next: () => void) {
|
return function find_route(req: Req, res: Res, next: () => void) {
|
||||||
if (req[IGNORE]) return next();
|
if (req[IGNORE]) return next();
|
||||||
|
|
||||||
|
if (req.path === '/service-worker-index.html') {
|
||||||
|
const homePage = pages.find(page => page.pattern.test('/'));
|
||||||
|
handle_page(homePage, req, res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!server_routes.some(route => route.pattern.test(req.path))) {
|
if (!server_routes.some(route => route.pattern.test(req.path))) {
|
||||||
for (const page of pages) {
|
for (const page of pages) {
|
||||||
if (page.pattern.test(req.path)) {
|
if (page.pattern.test(req.path)) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { IGNORE } from '../placeholders';
|
|||||||
import { Req, Res, ServerRoute } from './types';
|
import { Req, Res, ServerRoute } from './types';
|
||||||
|
|
||||||
export function get_server_route_handler(routes: ServerRoute[]) {
|
export function get_server_route_handler(routes: ServerRoute[]) {
|
||||||
function handle_route(route: ServerRoute, req: Req, res: Res, next: () => void) {
|
async function handle_route(route: ServerRoute, req: Req, res: Res, next: () => void) {
|
||||||
req.params = route.params(route.pattern.exec(req.path));
|
req.params = route.params(route.pattern.exec(req.path));
|
||||||
|
|
||||||
const method = req.method.toLowerCase();
|
const method = req.method.toLowerCase();
|
||||||
@@ -53,7 +53,7 @@ export function get_server_route_handler(routes: ServerRoute[]) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
handle_method(req, res, handle_next);
|
await handle_method(req, res, handle_next);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
handle_next(err);
|
handle_next(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ declare const prefetchRoutes: () => Promise<void>;
|
|||||||
declare const prefetch: (href: string) => Promise<void>;
|
declare const prefetch: (href: string) => Promise<void>;
|
||||||
declare const goto: (href: string) => Promise<void>;
|
declare const goto: (href: string) => Promise<void>;
|
||||||
|
|
||||||
|
type StartOpts = {
|
||||||
|
requestInterceptor?: (interceptedRequst: puppeteer.Request) => any
|
||||||
|
};
|
||||||
|
|
||||||
export class AppRunner {
|
export class AppRunner {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
entry: string;
|
entry: string;
|
||||||
@@ -24,7 +28,7 @@ export class AppRunner {
|
|||||||
this.messages = [];
|
this.messages = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
async start({ requestInterceptor }: StartOpts = {}) {
|
||||||
this.port = await ports.find(3000);
|
this.port = await ports.find(3000);
|
||||||
|
|
||||||
this.proc = fork(this.entry, [], {
|
this.proc = fork(this.entry, [], {
|
||||||
@@ -50,6 +54,11 @@ export class AppRunner {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (requestInterceptor) {
|
||||||
|
await this.page.setRequestInterception(true);
|
||||||
|
this.page.on('request', requestInterceptor);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
page: this.page,
|
page: this.page,
|
||||||
base: `http://localhost:${this.port}`,
|
base: `http://localhost:${this.port}`,
|
||||||
|
|||||||
@@ -1,9 +1 @@
|
|||||||
<h1>message: "{message}"</h1>
|
<h1>{JSON.stringify(query)}</h1>
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
preload({ query }) {
|
|
||||||
return query;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
@@ -3,5 +3,6 @@
|
|||||||
<a href="a">a</a>
|
<a href="a">a</a>
|
||||||
<a href="ambiguous/ok.json">ok</a>
|
<a href="ambiguous/ok.json">ok</a>
|
||||||
<a href="echo-query?message">ok</a>
|
<a href="echo-query?message">ok</a>
|
||||||
|
<a href="echo-query?p=one&p=two">ok</a>
|
||||||
|
|
||||||
<div class='hydrate-test'></div>
|
<div class='hydrate-test'></div>
|
||||||
@@ -204,7 +204,7 @@ describe('basics', function() {
|
|||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await title(),
|
await title(),
|
||||||
'message: ""'
|
'{"message":""}'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -217,7 +217,29 @@ describe('basics', function() {
|
|||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await title(),
|
await title(),
|
||||||
'message: ""'
|
'{"message":""}'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('accepts duplicated query string parameter on server', async () => {
|
||||||
|
await page.goto(`${base}/echo-query?p=one&p=two`);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await title(),
|
||||||
|
'{"p":["one","two"]}'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('accepts duplicated query string parameter on client', async () => {
|
||||||
|
await page.goto(base);
|
||||||
|
await start();
|
||||||
|
await prefetchRoutes();
|
||||||
|
|
||||||
|
await page.click('a[href="echo-query?p=one&p=two"]')
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await title(),
|
||||||
|
'{"p":["one","two"]}'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
64
test/apps/css/rollup.config.js
Normal file
64
test/apps/css/rollup.config.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import resolve from 'rollup-plugin-node-resolve';
|
||||||
|
import replace from 'rollup-plugin-replace';
|
||||||
|
import svelte from 'rollup-plugin-svelte';
|
||||||
|
|
||||||
|
const mode = process.env.NODE_ENV;
|
||||||
|
const dev = mode === 'development';
|
||||||
|
|
||||||
|
const config = require('../../../config/rollup.js');
|
||||||
|
|
||||||
|
export default {
|
||||||
|
client: {
|
||||||
|
input: config.client.input(),
|
||||||
|
output: config.client.output(),
|
||||||
|
plugins: [
|
||||||
|
replace({
|
||||||
|
'process.browser': true,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
}),
|
||||||
|
svelte({
|
||||||
|
dev,
|
||||||
|
hydratable: true,
|
||||||
|
emitCss: true
|
||||||
|
}),
|
||||||
|
resolve()
|
||||||
|
],
|
||||||
|
|
||||||
|
// temporary, pending Rollup 1.0
|
||||||
|
experimentalCodeSplitting: true
|
||||||
|
},
|
||||||
|
|
||||||
|
server: {
|
||||||
|
input: config.server.input(),
|
||||||
|
output: config.server.output(),
|
||||||
|
plugins: [
|
||||||
|
replace({
|
||||||
|
'process.browser': false,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
}),
|
||||||
|
svelte({
|
||||||
|
generate: 'ssr',
|
||||||
|
dev
|
||||||
|
}),
|
||||||
|
resolve({
|
||||||
|
preferBuiltins: true
|
||||||
|
})
|
||||||
|
],
|
||||||
|
external: ['sirv', 'polka'],
|
||||||
|
|
||||||
|
// temporary, pending Rollup 1.0
|
||||||
|
experimentalCodeSplitting: true
|
||||||
|
},
|
||||||
|
|
||||||
|
serviceworker: {
|
||||||
|
input: config.serviceworker.input(),
|
||||||
|
output: config.serviceworker.output(),
|
||||||
|
plugins: [
|
||||||
|
resolve(),
|
||||||
|
replace({
|
||||||
|
'process.browser': true,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
9
test/apps/css/src/client.js
Normal file
9
test/apps/css/src/client.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import * as sapper from '../__sapper__/client.js';
|
||||||
|
|
||||||
|
window.start = () => sapper.start({
|
||||||
|
target: document.querySelector('#sapper')
|
||||||
|
});
|
||||||
|
|
||||||
|
window.prefetchRoutes = () => sapper.prefetchRoutes();
|
||||||
|
window.prefetch = href => sapper.prefetch(href);
|
||||||
|
window.goto = href => sapper.goto(href);
|
||||||
7
test/apps/css/src/routes/_components/Title.html
Normal file
7
test/apps/css/src/routes/_components/Title.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<h1>Title</h1>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
h1 {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
3
test/apps/css/src/routes/_error.html
Normal file
3
test/apps/css/src/routes/_error.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<h1>{status}</h1>
|
||||||
|
|
||||||
|
<p>{error.message}</p>
|
||||||
11
test/apps/css/src/routes/bar.html
Normal file
11
test/apps/css/src/routes/bar.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<svelte:component this={Title}/>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
oncreate() {
|
||||||
|
import('./_components/Title.html').then(({ default: Title }) => {
|
||||||
|
this.set({ Title });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
7
test/apps/css/src/routes/foo.html
Normal file
7
test/apps/css/src/routes/foo.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<h1>Foo</h1>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
h1 {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
10
test/apps/css/src/routes/index.html
Normal file
10
test/apps/css/src/routes/index.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<h1>Great success!</h1>
|
||||||
|
|
||||||
|
<a href="foo">foo</a>
|
||||||
|
<a href="bar">bar</a>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
h1 {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
8
test/apps/css/src/server.js
Normal file
8
test/apps/css/src/server.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import polka from 'polka';
|
||||||
|
import * as sapper from '../__sapper__/server.js';
|
||||||
|
|
||||||
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
polka()
|
||||||
|
.use(sapper.middleware())
|
||||||
|
.listen(PORT);
|
||||||
82
test/apps/css/src/service-worker.js
Normal file
82
test/apps/css/src/service-worker.js
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
||||||
|
|
||||||
|
const ASSETS = `cache${timestamp}`;
|
||||||
|
|
||||||
|
// `shell` is an array of all the files generated by webpack,
|
||||||
|
// `files` is an array of everything in the `static` directory
|
||||||
|
const to_cache = shell.concat(ASSETS);
|
||||||
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
|
self.addEventListener('install', event => {
|
||||||
|
event.waitUntil(
|
||||||
|
caches
|
||||||
|
.open(ASSETS)
|
||||||
|
.then(cache => cache.addAll(to_cache))
|
||||||
|
.then(() => {
|
||||||
|
self.skipWaiting();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('activate', event => {
|
||||||
|
event.waitUntil(
|
||||||
|
caches.keys().then(async keys => {
|
||||||
|
// delete old caches
|
||||||
|
for (const key of keys) {
|
||||||
|
if (key !== ASSETS) await caches.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.clients.claim();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', event => {
|
||||||
|
if (event.request.method !== 'GET') return;
|
||||||
|
|
||||||
|
const url = new URL(event.request.url);
|
||||||
|
|
||||||
|
// don't try to handle e.g. data: URIs
|
||||||
|
if (!url.protocol.startsWith('http')) return;
|
||||||
|
|
||||||
|
// ignore dev server requests
|
||||||
|
if (url.hostname === self.location.hostname && url.port !== self.location.port) return;
|
||||||
|
|
||||||
|
// always serve assets and webpack-generated files from cache
|
||||||
|
if (url.host === self.location.host && cached.has(url.pathname)) {
|
||||||
|
event.respondWith(caches.match(event.request));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for pages, you might want to serve a shell `index.html` file,
|
||||||
|
// which Sapper has generated for you. It's not right for every
|
||||||
|
// app, but if it's right for yours then uncomment this section
|
||||||
|
/*
|
||||||
|
if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
|
||||||
|
event.respondWith(caches.match('/index.html'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (event.request.cache === 'only-if-cached') return;
|
||||||
|
|
||||||
|
// for everything else, try the network first, falling back to
|
||||||
|
// cache if the user is offline. (If the pages never change, you
|
||||||
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
|
event.respondWith(
|
||||||
|
caches
|
||||||
|
.open(`offline${timestamp}`)
|
||||||
|
.then(async cache => {
|
||||||
|
try {
|
||||||
|
const response = await fetch(event.request);
|
||||||
|
cache.put(event.request, response.clone());
|
||||||
|
return response;
|
||||||
|
} catch(err) {
|
||||||
|
const response = await cache.match(event.request);
|
||||||
|
if (response) return response;
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
14
test/apps/css/src/template.html
Normal file
14
test/apps/css/src/template.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
|
||||||
|
%sapper.base%
|
||||||
|
%sapper.styles%
|
||||||
|
%sapper.head%
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id='sapper'>%sapper.html%</div>
|
||||||
|
%sapper.scripts%
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
78
test/apps/css/test.ts
Normal file
78
test/apps/css/test.ts
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
import * as assert from 'assert';
|
||||||
|
import * as puppeteer from 'puppeteer';
|
||||||
|
import { build } from '../../../api';
|
||||||
|
import { AppRunner } from '../AppRunner';
|
||||||
|
import { wait } from '../../utils';
|
||||||
|
|
||||||
|
describe('css', function() {
|
||||||
|
this.timeout(10000);
|
||||||
|
|
||||||
|
let runner: AppRunner;
|
||||||
|
let page: puppeteer.Page;
|
||||||
|
let base: string;
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
let start: () => Promise<void>;
|
||||||
|
let prefetchRoutes: () => Promise<void>;
|
||||||
|
let prefetch: (href: string) => Promise<void>;
|
||||||
|
let goto: (href: string) => Promise<void>;
|
||||||
|
let title: () => Promise<string>;
|
||||||
|
|
||||||
|
// hooks
|
||||||
|
before(async () => {
|
||||||
|
await build({ cwd: __dirname });
|
||||||
|
|
||||||
|
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
||||||
|
({ base, page, start, prefetchRoutes, prefetch, goto, title } = await runner.start());
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => runner.end());
|
||||||
|
|
||||||
|
it('includes critical CSS with server render', async () => {
|
||||||
|
await page.goto(base);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await page.evaluate(() => {
|
||||||
|
const h1 = document.querySelector('h1');
|
||||||
|
return getComputedStyle(h1).color;
|
||||||
|
}),
|
||||||
|
'rgb(255, 0, 0)'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads CSS when navigating client-side', async () => {
|
||||||
|
await page.goto(base);
|
||||||
|
|
||||||
|
await start();
|
||||||
|
await prefetchRoutes();
|
||||||
|
|
||||||
|
await page.click(`[href="foo"]`);
|
||||||
|
await wait(50);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await page.evaluate(() => {
|
||||||
|
const h1 = document.querySelector('h1');
|
||||||
|
return getComputedStyle(h1).color;
|
||||||
|
}),
|
||||||
|
'rgb(0, 0, 255)'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('loads CSS for a lazily-rendered component', async () => {
|
||||||
|
await page.goto(base);
|
||||||
|
|
||||||
|
await start();
|
||||||
|
await prefetchRoutes();
|
||||||
|
|
||||||
|
await page.click(`[href="bar"]`);
|
||||||
|
await wait(50);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await page.evaluate(() => {
|
||||||
|
const h1 = document.querySelector('h1');
|
||||||
|
return getComputedStyle(h1).color;
|
||||||
|
}),
|
||||||
|
'rgb(0, 128, 0)'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
<h1>{slug} ({message})</h1>
|
<h1>{slug} {JSON.stringify(query)}</h1>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
preload({ params, query }) {
|
preload({ params }) {
|
||||||
return {
|
return {
|
||||||
slug: params.slug,
|
slug: params.slug
|
||||||
message: query.message
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<h1>Great success!</h1>
|
<h1>Great success!</h1>
|
||||||
|
|
||||||
<a href="echo/page/encöded?message=hëllö+wörld">link</a>
|
<a href="echo/page/encöded?message=hëllö+wörld&föo=bar&=baz">link</a>
|
||||||
@@ -35,11 +35,11 @@ describe('encoding', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('encodes req.params and req.query for server-rendered pages', async () => {
|
it('encodes req.params and req.query for server-rendered pages', async () => {
|
||||||
await page.goto(`${base}/echo/page/encöded?message=hëllö+wörld`);
|
await page.goto(`${base}/echo/page/encöded?message=hëllö+wörld&föo=bar&=baz`);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await page.$eval('h1', node => node.textContent),
|
await page.$eval('h1', node => node.textContent),
|
||||||
'encöded (hëllö wörld)'
|
'encöded {"message":"hëllö wörld","föo":"bar","":"baz"}'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -48,12 +48,12 @@ describe('encoding', function() {
|
|||||||
await start();
|
await start();
|
||||||
await prefetchRoutes();
|
await prefetchRoutes();
|
||||||
|
|
||||||
await page.click('a[href="echo/page/encöded?message=hëllö+wörld"]');
|
await page.click('a[href="echo/page/encöded?message=hëllö+wörld&föo=bar&=baz"]');
|
||||||
await wait(50);
|
await wait(50);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await page.$eval('h1', node => node.textContent),
|
await page.$eval('h1', node => node.textContent),
|
||||||
'encöded (hëllö wörld)'
|
'encöded {"message":"hëllö wörld","föo":"bar","":"baz"}'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
3
test/apps/errors/src/routes/async-throw.json.js
Normal file
3
test/apps/errors/src/routes/async-throw.json.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export function get(req, res) {
|
||||||
|
return Promise.reject(new Error('oops'));
|
||||||
|
}
|
||||||
@@ -112,15 +112,26 @@ describe('errors', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('does not serve error page for async non-page error', async () => {
|
||||||
|
await page.goto(`${base}/async-throw.json`);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await page.evaluate(() => document.body.textContent),
|
||||||
|
'oops'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('clears props.error on successful render', async () => {
|
it('clears props.error on successful render', async () => {
|
||||||
await page.goto(`${base}/no-error`);
|
await page.goto(`${base}/no-error`);
|
||||||
await start();
|
await start();
|
||||||
await prefetchRoutes();
|
await prefetchRoutes();
|
||||||
|
|
||||||
await page.click('[href="enhance-your-calm"]');
|
await page.click('[href="enhance-your-calm"]');
|
||||||
|
await wait(50);
|
||||||
assert.equal(await title(), '420');
|
assert.equal(await title(), '420');
|
||||||
|
|
||||||
await page.goBack();
|
await page.goBack();
|
||||||
|
await wait(50);
|
||||||
assert.equal(await title(), 'No error here');
|
assert.equal(await title(), 'No error here');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -30,6 +30,7 @@ describe('export', function() {
|
|||||||
'blog/index.html',
|
'blog/index.html',
|
||||||
'global.css',
|
'global.css',
|
||||||
'index.html',
|
'index.html',
|
||||||
|
'service-worker-index.html',
|
||||||
'service-worker.js'
|
'service-worker.js'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,3 +2,5 @@
|
|||||||
|
|
||||||
<a href="slow-preload">slow preload</a>
|
<a href="slow-preload">slow preload</a>
|
||||||
<a href="foo">foo</a>
|
<a href="foo">foo</a>
|
||||||
|
<a href="prefetch/qwe" rel=prefetch>prefetch qwe</a>
|
||||||
|
<a href="prefetch/xyz" rel=prefetch>prefetch xyz</a>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<h1>{params.slug}</h1>
|
||||||
1
test/apps/preloading/src/routes/prefetch/_layout.html
Normal file
1
test/apps/preloading/src/routes/prefetch/_layout.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svelte:component this={child.component} {...child.props}/>
|
||||||
1
test/apps/preloading/src/routes/prefetch/index.html
Normal file
1
test/apps/preloading/src/routes/prefetch/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>prefetch</h1>
|
||||||
@@ -83,4 +83,31 @@ describe('preloading', function() {
|
|||||||
assert.equal(page.url(), `${base}/foo`);
|
assert.equal(page.url(), `${base}/foo`);
|
||||||
assert.equal(await title(), 'foo');
|
assert.equal(await title(), 'foo');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('navigates to prefetched urls', async () => {
|
||||||
|
await page.goto(base);
|
||||||
|
await start();
|
||||||
|
await prefetchRoutes();
|
||||||
|
|
||||||
|
await page.hover('a[href="prefetch/qwe"]');
|
||||||
|
await wait(100);
|
||||||
|
await page.hover('a[href="prefetch/xyz"]');
|
||||||
|
await wait(100);
|
||||||
|
|
||||||
|
await page.click('a[href="prefetch/qwe"]');
|
||||||
|
await wait(50);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await title(),
|
||||||
|
'qwe'
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.goto(`${base}/prefetch`);
|
||||||
|
await wait(50);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await title(),
|
||||||
|
'prefetch'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
<a href="redirect-from">redirect from</a>
|
<a href="redirect-from">redirect from</a>
|
||||||
<a href="redirect-to-root">redirect to root</a>
|
<a href="redirect-to-root">redirect to root</a>
|
||||||
|
<a href="redirect-to-external">redirect to external</a>
|
||||||
9
test/apps/redirects/src/routes/redirect-to-external.html
Normal file
9
test/apps/redirects/src/routes/redirect-to-external.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<h1>unredirected</h1>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
preload() {
|
||||||
|
this.redirect(301, 'https://example.com');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -14,13 +14,26 @@ describe('redirects', function() {
|
|||||||
// helpers
|
// helpers
|
||||||
let start: () => Promise<void>;
|
let start: () => Promise<void>;
|
||||||
let prefetchRoutes: () => Promise<void>;
|
let prefetchRoutes: () => Promise<void>;
|
||||||
|
let title: () => Promise<string>;
|
||||||
|
|
||||||
// hooks
|
// hooks
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await build({ cwd: __dirname });
|
await build({ cwd: __dirname });
|
||||||
|
|
||||||
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
||||||
({ base, page, start, prefetchRoutes } = await runner.start());
|
({ base, page, start, prefetchRoutes, title } = await runner.start({
|
||||||
|
requestInterceptor: (interceptedRequest) => {
|
||||||
|
if (/example\.com/.test(interceptedRequest.url())) {
|
||||||
|
interceptedRequest.respond({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'text/html',
|
||||||
|
body: `<h1>external</h1>`
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
interceptedRequest.continue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
after(() => runner.end());
|
after(() => runner.end());
|
||||||
@@ -34,7 +47,7 @@ describe('redirects', function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await page.$eval('h1', node => node.textContent),
|
await title(),
|
||||||
'redirected'
|
'redirected'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -53,7 +66,7 @@ describe('redirects', function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await page.$eval('h1', node => node.textContent),
|
await title(),
|
||||||
'redirected'
|
'redirected'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -67,7 +80,7 @@ describe('redirects', function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await page.$eval('h1', node => node.textContent),
|
await title(),
|
||||||
'root'
|
'root'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -86,8 +99,41 @@ describe('redirects', function() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await page.$eval('h1', node => node.textContent),
|
await title(),
|
||||||
'root'
|
'root'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('redirects to external URL on server', async () => {
|
||||||
|
await page.goto(`${base}/redirect-to-external`);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
page.url(),
|
||||||
|
`https://example.com/`
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await title(),
|
||||||
|
'external'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('redirects to external URL in client', async () => {
|
||||||
|
await page.goto(base);
|
||||||
|
await start();
|
||||||
|
await prefetchRoutes();
|
||||||
|
|
||||||
|
await page.click('[href="redirect-to-external"]');
|
||||||
|
await wait(50);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
page.url(),
|
||||||
|
`https://example.com/`
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
await title(),
|
||||||
|
'external'
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -17,7 +17,7 @@ describe('with-basepath', function() {
|
|||||||
|
|
||||||
await api.export({
|
await api.export({
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
basepath: 'custom-basepath'
|
basepath: '/custom-basepath'
|
||||||
});
|
});
|
||||||
|
|
||||||
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
||||||
@@ -56,6 +56,7 @@ describe('with-basepath', function() {
|
|||||||
assert.deepEqual(non_client_assets, [
|
assert.deepEqual(non_client_assets, [
|
||||||
'custom-basepath/global.css',
|
'custom-basepath/global.css',
|
||||||
'custom-basepath/index.html',
|
'custom-basepath/index.html',
|
||||||
|
'custom-basepath/service-worker-index.html',
|
||||||
'custom-basepath/service-worker.js'
|
'custom-basepath/service-worker.js'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
9
test/apps/with-sourcemaps-webpack/src/client.js
Normal file
9
test/apps/with-sourcemaps-webpack/src/client.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import * as sapper from '../__sapper__/client.js';
|
||||||
|
|
||||||
|
window.start = () => sapper.start({
|
||||||
|
target: document.querySelector('#sapper')
|
||||||
|
});
|
||||||
|
|
||||||
|
window.prefetchRoutes = () => sapper.prefetchRoutes();
|
||||||
|
window.prefetch = href => sapper.prefetch(href);
|
||||||
|
window.goto = href => sapper.goto(href);
|
||||||
3
test/apps/with-sourcemaps-webpack/src/routes/_error.html
Normal file
3
test/apps/with-sourcemaps-webpack/src/routes/_error.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<h1>{status}</h1>
|
||||||
|
|
||||||
|
<p>{error.message}</p>
|
||||||
3
test/apps/with-sourcemaps-webpack/src/routes/index.html
Normal file
3
test/apps/with-sourcemaps-webpack/src/routes/index.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<h1>Great success!</h1>
|
||||||
|
|
||||||
|
<p>Woot!</p>
|
||||||
8
test/apps/with-sourcemaps-webpack/src/server.js
Normal file
8
test/apps/with-sourcemaps-webpack/src/server.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import polka from 'polka';
|
||||||
|
import * as sapper from '../__sapper__/server.js';
|
||||||
|
|
||||||
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
polka()
|
||||||
|
.use(sapper.middleware())
|
||||||
|
.listen(PORT);
|
||||||
82
test/apps/with-sourcemaps-webpack/src/service-worker.js
Normal file
82
test/apps/with-sourcemaps-webpack/src/service-worker.js
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
||||||
|
|
||||||
|
const ASSETS = `cache${timestamp}`;
|
||||||
|
|
||||||
|
// `shell` is an array of all the files generated by webpack,
|
||||||
|
// `files` is an array of everything in the `static` directory
|
||||||
|
const to_cache = shell.concat(ASSETS);
|
||||||
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
|
self.addEventListener('install', event => {
|
||||||
|
event.waitUntil(
|
||||||
|
caches
|
||||||
|
.open(ASSETS)
|
||||||
|
.then(cache => cache.addAll(to_cache))
|
||||||
|
.then(() => {
|
||||||
|
self.skipWaiting();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('activate', event => {
|
||||||
|
event.waitUntil(
|
||||||
|
caches.keys().then(async keys => {
|
||||||
|
// delete old caches
|
||||||
|
for (const key of keys) {
|
||||||
|
if (key !== ASSETS) await caches.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.clients.claim();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', event => {
|
||||||
|
if (event.request.method !== 'GET') return;
|
||||||
|
|
||||||
|
const url = new URL(event.request.url);
|
||||||
|
|
||||||
|
// don't try to handle e.g. data: URIs
|
||||||
|
if (!url.protocol.startsWith('http')) return;
|
||||||
|
|
||||||
|
// ignore dev server requests
|
||||||
|
if (url.hostname === self.location.hostname && url.port !== self.location.port) return;
|
||||||
|
|
||||||
|
// always serve assets and webpack-generated files from cache
|
||||||
|
if (url.host === self.location.host && cached.has(url.pathname)) {
|
||||||
|
event.respondWith(caches.match(event.request));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for pages, you might want to serve a shell `index.html` file,
|
||||||
|
// which Sapper has generated for you. It's not right for every
|
||||||
|
// app, but if it's right for yours then uncomment this section
|
||||||
|
/*
|
||||||
|
if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
|
||||||
|
event.respondWith(caches.match('/index.html'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (event.request.cache === 'only-if-cached') return;
|
||||||
|
|
||||||
|
// for everything else, try the network first, falling back to
|
||||||
|
// cache if the user is offline. (If the pages never change, you
|
||||||
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
|
event.respondWith(
|
||||||
|
caches
|
||||||
|
.open(`offline${timestamp}`)
|
||||||
|
.then(async cache => {
|
||||||
|
try {
|
||||||
|
const response = await fetch(event.request);
|
||||||
|
cache.put(event.request, response.clone());
|
||||||
|
return response;
|
||||||
|
} catch(err) {
|
||||||
|
const response = await cache.match(event.request);
|
||||||
|
if (response) return response;
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
14
test/apps/with-sourcemaps-webpack/src/template.html
Normal file
14
test/apps/with-sourcemaps-webpack/src/template.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
|
||||||
|
%sapper.base%
|
||||||
|
%sapper.styles%
|
||||||
|
%sapper.head%
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id='sapper'>%sapper.html%</div>
|
||||||
|
%sapper.scripts%
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
43
test/apps/with-sourcemaps-webpack/test.ts
Normal file
43
test/apps/with-sourcemaps-webpack/test.ts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import * as puppeteer from 'puppeteer';
|
||||||
|
import { build } from '../../../api';
|
||||||
|
import * as assert from "assert";
|
||||||
|
import { AppRunner } from '../AppRunner';
|
||||||
|
import * as fs from "fs";
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
|
describe('with-sourcemaps-webpack', function() {
|
||||||
|
this.timeout(10000);
|
||||||
|
|
||||||
|
let runner: AppRunner;
|
||||||
|
let page: puppeteer.Page;
|
||||||
|
let base: string;
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
let start: () => Promise<void>;
|
||||||
|
let prefetchRoutes: () => Promise<void>;
|
||||||
|
let prefetch: (href: string) => Promise<void>;
|
||||||
|
let goto: (href: string) => Promise<void>;
|
||||||
|
|
||||||
|
// hooks
|
||||||
|
before(async () => {
|
||||||
|
await build({ cwd: __dirname, bundler: 'webpack' });
|
||||||
|
|
||||||
|
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
||||||
|
({ base, page, start, prefetchRoutes, prefetch, goto } = await runner.start());
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not put sourcemap files in service worker shell', async () => {
|
||||||
|
const serviceWorker = await import(`${__dirname}/__sapper__/service-worker.js`);
|
||||||
|
const shell: string[] = serviceWorker.shell;
|
||||||
|
|
||||||
|
assert.equal(shell.filter(_ => _.endsWith('.map')).length, 0,
|
||||||
|
'sourcemap files are not cached in SW');
|
||||||
|
|
||||||
|
const clientShellDir = path.resolve(`${__dirname}/__sapper__/build`, path.dirname(shell[0]));
|
||||||
|
const sourcemapFiles = fs.readdirSync(clientShellDir).filter(_ => _.endsWith('.map'));
|
||||||
|
assert.ok(sourcemapFiles.length > 0, 'sourcemap files exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => runner.end());
|
||||||
|
|
||||||
|
});
|
||||||
73
test/apps/with-sourcemaps-webpack/webpack.config.js
Normal file
73
test/apps/with-sourcemaps-webpack/webpack.config.js
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
const webpack = require('webpack');
|
||||||
|
const config = require('../../../config/webpack.js');
|
||||||
|
|
||||||
|
const mode = process.env.NODE_ENV;
|
||||||
|
const dev = mode === 'development';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
client: {
|
||||||
|
entry: config.client.entry(),
|
||||||
|
output: config.client.output(),
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.json', '.html'],
|
||||||
|
mainFields: ['svelte', 'module', 'browser', 'main']
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.html$/,
|
||||||
|
use: {
|
||||||
|
loader: 'svelte-loader',
|
||||||
|
options: {
|
||||||
|
dev,
|
||||||
|
hydratable: true,
|
||||||
|
hotReload: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
mode,
|
||||||
|
plugins: [
|
||||||
|
dev && new webpack.HotModuleReplacementPlugin(),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.browser': true,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
}),
|
||||||
|
].filter(Boolean),
|
||||||
|
devtool: dev ? 'inline-source-map' : 'source-map'
|
||||||
|
},
|
||||||
|
|
||||||
|
server: {
|
||||||
|
entry: config.server.entry(),
|
||||||
|
output: config.server.output(),
|
||||||
|
target: 'node',
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.json', '.html'],
|
||||||
|
mainFields: ['svelte', 'module', 'browser', 'main']
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.html$/,
|
||||||
|
use: {
|
||||||
|
loader: 'svelte-loader',
|
||||||
|
options: {
|
||||||
|
css: false,
|
||||||
|
generate: 'ssr',
|
||||||
|
dev
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
mode: process.env.NODE_ENV
|
||||||
|
},
|
||||||
|
|
||||||
|
serviceworker: {
|
||||||
|
entry: config.serviceworker.entry(),
|
||||||
|
output: config.serviceworker.output(),
|
||||||
|
mode: process.env.NODE_ENV,
|
||||||
|
devtool: 'sourcemap'
|
||||||
|
}
|
||||||
|
};
|
||||||
64
test/apps/with-sourcemaps/rollup.config.js
Normal file
64
test/apps/with-sourcemaps/rollup.config.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import resolve from 'rollup-plugin-node-resolve';
|
||||||
|
import replace from 'rollup-plugin-replace';
|
||||||
|
import svelte from 'rollup-plugin-svelte';
|
||||||
|
|
||||||
|
const mode = process.env.NODE_ENV;
|
||||||
|
const dev = mode === 'development';
|
||||||
|
|
||||||
|
const config = require('../../../config/rollup.js');
|
||||||
|
|
||||||
|
export default {
|
||||||
|
client: {
|
||||||
|
input: config.client.input(),
|
||||||
|
output: Object.assign({}, config.client.output(), { sourcemap: true }),
|
||||||
|
plugins: [
|
||||||
|
replace({
|
||||||
|
'process.browser': true,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
}),
|
||||||
|
svelte({
|
||||||
|
dev,
|
||||||
|
hydratable: true,
|
||||||
|
emitCss: true
|
||||||
|
}),
|
||||||
|
resolve()
|
||||||
|
],
|
||||||
|
|
||||||
|
// temporary, pending Rollup 1.0
|
||||||
|
experimentalCodeSplitting: true
|
||||||
|
},
|
||||||
|
|
||||||
|
server: {
|
||||||
|
input: config.server.input(),
|
||||||
|
output: config.server.output(),
|
||||||
|
plugins: [
|
||||||
|
replace({
|
||||||
|
'process.browser': false,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
}),
|
||||||
|
svelte({
|
||||||
|
generate: 'ssr',
|
||||||
|
dev
|
||||||
|
}),
|
||||||
|
resolve({
|
||||||
|
preferBuiltins: true
|
||||||
|
})
|
||||||
|
],
|
||||||
|
external: ['sirv', 'polka'],
|
||||||
|
|
||||||
|
// temporary, pending Rollup 1.0
|
||||||
|
experimentalCodeSplitting: true
|
||||||
|
},
|
||||||
|
|
||||||
|
serviceworker: {
|
||||||
|
input: config.serviceworker.input(),
|
||||||
|
output: config.serviceworker.output(),
|
||||||
|
plugins: [
|
||||||
|
resolve(),
|
||||||
|
replace({
|
||||||
|
'process.browser': true,
|
||||||
|
'process.env.NODE_ENV': JSON.stringify(mode)
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
9
test/apps/with-sourcemaps/src/client.js
Normal file
9
test/apps/with-sourcemaps/src/client.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import * as sapper from '../__sapper__/client.js';
|
||||||
|
|
||||||
|
window.start = () => sapper.start({
|
||||||
|
target: document.querySelector('#sapper')
|
||||||
|
});
|
||||||
|
|
||||||
|
window.prefetchRoutes = () => sapper.prefetchRoutes();
|
||||||
|
window.prefetch = href => sapper.prefetch(href);
|
||||||
|
window.goto = href => sapper.goto(href);
|
||||||
3
test/apps/with-sourcemaps/src/routes/_error.html
Normal file
3
test/apps/with-sourcemaps/src/routes/_error.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<h1>{status}</h1>
|
||||||
|
|
||||||
|
<p>{error.message}</p>
|
||||||
3
test/apps/with-sourcemaps/src/routes/index.html
Normal file
3
test/apps/with-sourcemaps/src/routes/index.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<h1>Great success!</h1>
|
||||||
|
|
||||||
|
<p>Woot!</p>
|
||||||
8
test/apps/with-sourcemaps/src/server.js
Normal file
8
test/apps/with-sourcemaps/src/server.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import polka from 'polka';
|
||||||
|
import * as sapper from '../__sapper__/server.js';
|
||||||
|
|
||||||
|
const { PORT } = process.env;
|
||||||
|
|
||||||
|
polka()
|
||||||
|
.use(sapper.middleware())
|
||||||
|
.listen(PORT);
|
||||||
82
test/apps/with-sourcemaps/src/service-worker.js
Normal file
82
test/apps/with-sourcemaps/src/service-worker.js
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
|
||||||
|
|
||||||
|
const ASSETS = `cache${timestamp}`;
|
||||||
|
|
||||||
|
// `shell` is an array of all the files generated by webpack,
|
||||||
|
// `files` is an array of everything in the `static` directory
|
||||||
|
const to_cache = shell.concat(ASSETS);
|
||||||
|
const cached = new Set(to_cache);
|
||||||
|
|
||||||
|
self.addEventListener('install', event => {
|
||||||
|
event.waitUntil(
|
||||||
|
caches
|
||||||
|
.open(ASSETS)
|
||||||
|
.then(cache => cache.addAll(to_cache))
|
||||||
|
.then(() => {
|
||||||
|
self.skipWaiting();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('activate', event => {
|
||||||
|
event.waitUntil(
|
||||||
|
caches.keys().then(async keys => {
|
||||||
|
// delete old caches
|
||||||
|
for (const key of keys) {
|
||||||
|
if (key !== ASSETS) await caches.delete(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.clients.claim();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', event => {
|
||||||
|
if (event.request.method !== 'GET') return;
|
||||||
|
|
||||||
|
const url = new URL(event.request.url);
|
||||||
|
|
||||||
|
// don't try to handle e.g. data: URIs
|
||||||
|
if (!url.protocol.startsWith('http')) return;
|
||||||
|
|
||||||
|
// ignore dev server requests
|
||||||
|
if (url.hostname === self.location.hostname && url.port !== self.location.port) return;
|
||||||
|
|
||||||
|
// always serve assets and webpack-generated files from cache
|
||||||
|
if (url.host === self.location.host && cached.has(url.pathname)) {
|
||||||
|
event.respondWith(caches.match(event.request));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// for pages, you might want to serve a shell `index.html` file,
|
||||||
|
// which Sapper has generated for you. It's not right for every
|
||||||
|
// app, but if it's right for yours then uncomment this section
|
||||||
|
/*
|
||||||
|
if (url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
|
||||||
|
event.respondWith(caches.match('/index.html'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (event.request.cache === 'only-if-cached') return;
|
||||||
|
|
||||||
|
// for everything else, try the network first, falling back to
|
||||||
|
// cache if the user is offline. (If the pages never change, you
|
||||||
|
// might prefer a cache-first approach to a network-first one.)
|
||||||
|
event.respondWith(
|
||||||
|
caches
|
||||||
|
.open(`offline${timestamp}`)
|
||||||
|
.then(async cache => {
|
||||||
|
try {
|
||||||
|
const response = await fetch(event.request);
|
||||||
|
cache.put(event.request, response.clone());
|
||||||
|
return response;
|
||||||
|
} catch(err) {
|
||||||
|
const response = await cache.match(event.request);
|
||||||
|
if (response) return response;
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
14
test/apps/with-sourcemaps/src/template.html
Normal file
14
test/apps/with-sourcemaps/src/template.html
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset='utf-8'>
|
||||||
|
|
||||||
|
%sapper.base%
|
||||||
|
%sapper.styles%
|
||||||
|
%sapper.head%
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id='sapper'>%sapper.html%</div>
|
||||||
|
%sapper.scripts%
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
43
test/apps/with-sourcemaps/test.ts
Normal file
43
test/apps/with-sourcemaps/test.ts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import * as puppeteer from 'puppeteer';
|
||||||
|
import { build } from '../../../api';
|
||||||
|
import * as assert from "assert";
|
||||||
|
import { AppRunner } from '../AppRunner';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
|
describe('with-sourcemaps', function() {
|
||||||
|
this.timeout(10000);
|
||||||
|
|
||||||
|
let runner: AppRunner;
|
||||||
|
let page: puppeteer.Page;
|
||||||
|
let base: string;
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
let start: () => Promise<void>;
|
||||||
|
let prefetchRoutes: () => Promise<void>;
|
||||||
|
let prefetch: (href: string) => Promise<void>;
|
||||||
|
let goto: (href: string) => Promise<void>;
|
||||||
|
|
||||||
|
// hooks
|
||||||
|
before(async () => {
|
||||||
|
await build({ cwd: __dirname });
|
||||||
|
|
||||||
|
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
||||||
|
({ base, page, start, prefetchRoutes, prefetch, goto } = await runner.start());
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not put sourcemap files in service worker shell', async () => {
|
||||||
|
const serviceWorker = await import(`${__dirname}/__sapper__/service-worker.js`);
|
||||||
|
const shell: string[] = serviceWorker.shell;
|
||||||
|
|
||||||
|
assert.equal(shell.filter(_ => _.endsWith('.map')).length, 0,
|
||||||
|
'sourcemap files are not cached in SW');
|
||||||
|
|
||||||
|
const clientShellDir = path.resolve(`${__dirname}/__sapper__/build`, path.dirname(shell[0]));
|
||||||
|
const sourcemapFiles = fs.readdirSync(clientShellDir).filter(_ => _.endsWith('.map'));
|
||||||
|
assert.ok(sourcemapFiles.length > 0, 'sourcemap files exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
after(() => runner.end());
|
||||||
|
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user