diff --git a/site/config.js b/site/config.js new file mode 100644 index 0000000..db59814 --- /dev/null +++ b/site/config.js @@ -0,0 +1,3 @@ +export const SLUG_PRESERVE_UNICODE = false; +export const SLUG_SEPARATOR = '_'; +export const SLUG_LANG = 'en'; \ No newline at end of file diff --git a/site/content/guide/00-introduction.md b/site/content/docs/00-introduction.md similarity index 100% rename from site/content/guide/00-introduction.md rename to site/content/docs/00-introduction.md diff --git a/site/content/guide/01-structure.md b/site/content/docs/01-structure.md similarity index 100% rename from site/content/guide/01-structure.md rename to site/content/docs/01-structure.md diff --git a/site/content/guide/02-routing.md b/site/content/docs/02-routing.md similarity index 100% rename from site/content/guide/02-routing.md rename to site/content/docs/02-routing.md diff --git a/site/content/guide/03-client-api.md b/site/content/docs/03-client-api.md similarity index 100% rename from site/content/guide/03-client-api.md rename to site/content/docs/03-client-api.md diff --git a/site/content/guide/04-preloading.md b/site/content/docs/04-preloading.md similarity index 100% rename from site/content/guide/04-preloading.md rename to site/content/docs/04-preloading.md diff --git a/site/content/guide/05-layouts.md b/site/content/docs/05-layouts.md similarity index 99% rename from site/content/guide/05-layouts.md rename to site/content/docs/05-layouts.md index 11a7165..f349a2d 100644 --- a/site/content/guide/05-layouts.md +++ b/site/content/docs/05-layouts.md @@ -82,7 +82,7 @@ In addition to `child.component` and `child.props`, there is a `child.segment` p ``` -### Preloading +### Preloading in layouts Like page components, layout components can use `preload`: diff --git a/site/content/guide/06-server-side-rendering.md b/site/content/docs/06-server-side-rendering.md similarity index 100% rename from site/content/guide/06-server-side-rendering.md rename to site/content/docs/06-server-side-rendering.md diff --git a/site/content/guide/07-state-management.md b/site/content/docs/07-state-management.md similarity index 100% rename from site/content/guide/07-state-management.md rename to site/content/docs/07-state-management.md diff --git a/site/content/guide/08-prefetching.md b/site/content/docs/08-prefetching.md similarity index 100% rename from site/content/guide/08-prefetching.md rename to site/content/docs/08-prefetching.md diff --git a/site/content/guide/09-building.md b/site/content/docs/09-building.md similarity index 100% rename from site/content/guide/09-building.md rename to site/content/docs/09-building.md diff --git a/site/content/guide/10-exporting.md b/site/content/docs/10-exporting.md similarity index 100% rename from site/content/guide/10-exporting.md rename to site/content/docs/10-exporting.md diff --git a/site/content/guide/11-deploying.md b/site/content/docs/11-deploying.md similarity index 100% rename from site/content/guide/11-deploying.md rename to site/content/docs/11-deploying.md diff --git a/site/content/guide/12-security.md b/site/content/docs/12-security.md similarity index 100% rename from site/content/guide/12-security.md rename to site/content/docs/12-security.md diff --git a/site/content/guide/13-base-urls.md b/site/content/docs/13-base-urls.md similarity index 100% rename from site/content/guide/13-base-urls.md rename to site/content/docs/13-base-urls.md diff --git a/site/content/guide/14-testing.md b/site/content/docs/14-testing.md similarity index 100% rename from site/content/guide/14-testing.md rename to site/content/docs/14-testing.md diff --git a/site/content/guide/15-debugging.md b/site/content/docs/15-debugging.md similarity index 100% rename from site/content/guide/15-debugging.md rename to site/content/docs/15-debugging.md diff --git a/site/content/guide/16-migrating.md b/site/content/docs/16-migrating.md similarity index 98% rename from site/content/guide/16-migrating.md rename to site/content/docs/16-migrating.md index 485d5b1..ce1d221 100644 --- a/site/content/guide/16-migrating.md +++ b/site/content/docs/16-migrating.md @@ -10,11 +10,11 @@ Until we reach version 1.0, there may be occasional changes to the project struc Consult [sapper-template](https://github.com/sveltejs/sapper-template) for full examples of all the below points. -#### package.json +##### package.json To start a dev server, use `sapper dev` rather than `node server.js`. In all likelihood, your package.json will have an `npm run dev` script that will need to be updated. -#### Entry points +##### Entry points As of version 0.7, Sapper expects to find your entry points — for client, server and service worker — in an `app` folder. Instead of using magically-injected `__variables__`, each entry point imports from its corresponding file in the `app/manifests` folder. These are automatically generated by Sapper. @@ -50,7 +50,7 @@ import { assets, shell, timestamp, routes } from './manifest/service-worker.js'; ``` -#### Templates and error pages +##### Templates and error pages In previous versions, we had `templates/2xx.html`, `templates/4xx.html` and `templates/5xx.html`. Now, we have a single template, `app/template.html`, which should look like your old `templates/2xx.html`. @@ -61,7 +61,7 @@ This page is just like any other, except that it will get rendered whenever an e Note that you can now use `this.error(statusCode, error)` inside your `preload` functions. -#### Webpack configs +##### Webpack configs Your webpack configs now live in a `webpack` directory: @@ -73,12 +73,12 @@ If you have a service worker, you should also have a `webpack/service-worker.con ### <0.9 to 0.10 -#### app/template.html +##### app/template.html * Your `
` element must contain `%sapper.base%` (see ([base URLs](guide#base-urls)) * Remove references to your service worker; this is now handled by `%sapper.scripts%` -#### Pages +##### Pages * Your `preload` functions should now use `this.fetch` instead of `fetch`. `this.fetch` allows you to make credentialled requests on the server, and means that you no longer need to create a `global.fetch` object in `app/server.js`. diff --git a/site/package-lock.json b/site/package-lock.json index e8f513e..819344e 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -825,6 +825,11 @@ "to-fast-properties": "^2.0.0" } }, + "@polka/send": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@polka/send/-/send-0.4.0.tgz", + "integrity": "sha1-4nccVnHTYXWDJTSriGqIT3XzHm8=" + }, "@polka/url": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@polka/url/-/url-0.5.0.tgz", @@ -1194,6 +1199,17 @@ } } }, + "clipboard": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.4.tgz", + "integrity": "sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ==", + "optional": true, + "requires": { + "good-listener": "^1.2.2", + "select": "^1.1.2", + "tiny-emitter": "^2.0.0" + } + }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", @@ -1389,6 +1405,12 @@ } } }, + "delegate": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", + "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==", + "optional": true + }, "electron-to-chromium": { "version": "1.3.127", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.127.tgz", @@ -2193,6 +2215,15 @@ "integrity": "sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw==", "dev": true }, + "good-listener": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", + "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=", + "optional": true, + "requires": { + "delegate": "^3.1.2" + } + }, "graceful-fs": { "version": "4.1.15", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", @@ -2969,6 +3000,14 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, + "prismjs": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.16.0.tgz", + "integrity": "sha512-OA4MKxjFZHSvZcisLGe14THYsug/nF6O1f0pAJc0KN0wTyAcLqmsbE+lTGKSpyh+9pEW57+k6pg2AfYR+coyHA==", + "requires": { + "clipboard": "^2.0.0" + } + }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", @@ -3267,6 +3306,12 @@ "string-hash": "^1.1.3" } }, + "select": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", + "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=", + "optional": true + }, "semver": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", @@ -3628,6 +3673,12 @@ } } }, + "tiny-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", + "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", + "optional": true + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", diff --git a/site/package.json b/site/package.json index 7a2776f..23763ff 100644 --- a/site/package.json +++ b/site/package.json @@ -12,10 +12,12 @@ "test": "run-p --race dev cy:run" }, "dependencies": { + "@polka/send": "^0.4.0", "compression": "^1.7.1", "highlight.js": "^9.15.6", "marked": "^0.6.2", - "polka": "^0.5.0", + "polka": "^0.5.2", + "prismjs": "^1.16.0", "sirv": "^0.2.0" }, "devDependencies": { diff --git a/site/src/components/Nav.svelte b/site/src/components/Nav.svelte deleted file mode 100644 index d7f8da1..0000000 --- a/site/src/components/Nav.svelte +++ /dev/null @@ -1,60 +0,0 @@ - - - - - \ No newline at end of file diff --git a/site/src/routes/_error.svelte b/site/src/routes/_error.svelte index 320e587..0071e3c 100644 --- a/site/src/routes/_error.svelte +++ b/site/src/routes/_error.svelte @@ -1,40 +1,71 @@{error.message}
+ {#if error.message} +{status}: {error.message}
+ {:else} +Encountered a {status} error
+ {/if} -{#if dev && error.stack} -{error.stack}
-{/if}
+ {#if dev && error.stack}
+ {error.stack}
+ {:else}
+ {#if status >= 500}
+ Please try reloading the page.
+ {/if} + +If the error persists, please drop by Discord chatroom and let us know, or raise an issue on GitHub. Thanks!
+ {/if} + {:else} +Reload the page once you've found the internet.
+ {/if} +${highlighted}@@(\d+)<\/p>/g, (match, id) => { - return `
${highlighted[id]}`;
- })
- .replace(/^\t+/gm, match => match.split('\t').join(' '));
-
- const subsections = [];
- const pattern = /