@sveltejs/kit 1.0.0-next.34 → 1.0.0-next.342

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +12 -9
  2. package/assets/app/env.js +16 -0
  3. package/assets/app/navigation.js +24 -0
  4. package/assets/app/paths.js +1 -0
  5. package/assets/app/stores.js +97 -0
  6. package/assets/client/singletons.js +13 -0
  7. package/assets/client/start.js +1782 -0
  8. package/assets/components/error.svelte +18 -2
  9. package/assets/env.js +8 -0
  10. package/assets/paths.js +13 -0
  11. package/assets/server/index.js +3367 -0
  12. package/dist/chunks/cert.js +28154 -0
  13. package/dist/chunks/constants.js +663 -0
  14. package/dist/chunks/filesystem.js +110 -0
  15. package/dist/chunks/index.js +549 -0
  16. package/dist/chunks/index2.js +1385 -0
  17. package/dist/chunks/index3.js +118 -0
  18. package/dist/chunks/index4.js +183 -0
  19. package/dist/chunks/index5.js +253 -0
  20. package/dist/chunks/index6.js +15749 -0
  21. package/dist/chunks/misc.js +78 -0
  22. package/dist/chunks/multipart-parser.js +450 -0
  23. package/dist/chunks/object.js +83 -0
  24. package/dist/chunks/sync.js +858 -0
  25. package/dist/chunks/write_tsconfig.js +160 -0
  26. package/dist/cli.js +1097 -64
  27. package/dist/hooks.js +28 -0
  28. package/dist/node/polyfills.js +6514 -0
  29. package/dist/node.js +301 -0
  30. package/package.json +80 -62
  31. package/svelte-kit.js +0 -1
  32. package/types/ambient.d.ts +307 -0
  33. package/types/index.d.ts +292 -0
  34. package/types/internal.d.ts +321 -0
  35. package/types/private.d.ts +235 -0
  36. package/CHANGELOG.md +0 -362
  37. package/assets/runtime/app/navigation.js +0 -23
  38. package/assets/runtime/app/navigation.js.map +0 -1
  39. package/assets/runtime/app/paths.js +0 -2
  40. package/assets/runtime/app/paths.js.map +0 -1
  41. package/assets/runtime/app/stores.js +0 -78
  42. package/assets/runtime/app/stores.js.map +0 -1
  43. package/assets/runtime/internal/singletons.js +0 -15
  44. package/assets/runtime/internal/singletons.js.map +0 -1
  45. package/assets/runtime/internal/start.js +0 -591
  46. package/assets/runtime/internal/start.js.map +0 -1
  47. package/assets/runtime/utils-85ebcc60.js +0 -18
  48. package/assets/runtime/utils-85ebcc60.js.map +0 -1
  49. package/dist/api.js +0 -32
  50. package/dist/api.js.map +0 -1
  51. package/dist/cli.js.map +0 -1
  52. package/dist/create_app.js +0 -577
  53. package/dist/create_app.js.map +0 -1
  54. package/dist/index.js +0 -329
  55. package/dist/index.js.map +0 -1
  56. package/dist/index2.js +0 -14368
  57. package/dist/index2.js.map +0 -1
  58. package/dist/index3.js +0 -545
  59. package/dist/index3.js.map +0 -1
  60. package/dist/index4.js +0 -71
  61. package/dist/index4.js.map +0 -1
  62. package/dist/index5.js +0 -465
  63. package/dist/index5.js.map +0 -1
  64. package/dist/index6.js +0 -729
  65. package/dist/index6.js.map +0 -1
  66. package/dist/renderer.js +0 -2413
  67. package/dist/renderer.js.map +0 -1
  68. package/dist/standard.js +0 -100
  69. package/dist/standard.js.map +0 -1
  70. package/dist/utils.js +0 -57
  71. package/dist/utils.js.map +0 -1
  72. package/dist/vite.js +0 -317
  73. package/dist/vite.js.map +0 -1
package/README.md CHANGED
@@ -1,15 +1,18 @@
1
- # @sveltejs/kit
1
+ # The fastest way to build Svelte apps
2
2
 
3
- Here be dragons, etc etc.
3
+ This is the [SvelteKit](https://kit.svelte.dev) framework and CLI.
4
4
 
5
- This project aims to replicate Sapper's functionality in its entirety, minus building for deployment (which can be handled by 'adapters' that do various opinionated things with the output of `snowpack build`).
5
+ The quickest way to get started is via the [create-svelte](https://github.com/sveltejs/kit/tree/master/packages/create-svelte) package:
6
6
 
7
- It's currently missing a ton of stuff but I figured I'd throw it up on GitHub anyway partly for the sake of 'working in the open' but mostly because I need an issue tracker to organise my thoughts.
7
+ ```bash
8
+ npm init svelte my-app
9
+ cd my-app
10
+ npm install
11
+ npm run dev
12
+ ```
8
13
 
9
- There are no tests yet or anything like that. Some of the code has just been straight copied over from the existing Sapper repo, but a pleasing amount of it can safely be left behind.
14
+ See the [documentation](https://kit.svelte.dev/docs) to learn more.
10
15
 
11
- ## Trying it out
16
+ ## Changelog
12
17
 
13
- Clone this repo, `npm install`, and `npm link`. That will create a global link to the `svelte` bin. You can then either `npm run build` or `npm run dev`, if you intend to make changes and see them immediately reflected.
14
-
15
- Then, clone the corresponding [svelte-app-demo](https://github.com/sveltejs/svelte-app-demo) repo and follow the instructions therein.
18
+ [The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/kit/CHANGELOG.md).
@@ -0,0 +1,16 @@
1
+ export { prerendering } from '../env.js';
2
+
3
+ /**
4
+ * @type {import('$app/env').browser}
5
+ */
6
+ const browser = !import.meta.env.SSR;
7
+ /**
8
+ * @type {import('$app/env').dev}
9
+ */
10
+ const dev = !!import.meta.env.DEV;
11
+ /**
12
+ * @type {import('$app/env').mode}
13
+ */
14
+ const mode = import.meta.env.MODE;
15
+
16
+ export { browser, dev, mode };
@@ -0,0 +1,24 @@
1
+ import { client } from '../client/singletons.js';
2
+
3
+ /**
4
+ * @param {string} name
5
+ */
6
+ function guard(name) {
7
+ return () => {
8
+ throw new Error(`Cannot call ${name}(...) on the server`);
9
+ };
10
+ }
11
+
12
+ const ssr = import.meta.env.SSR;
13
+
14
+ const disableScrollHandling = ssr
15
+ ? guard('disableScrollHandling')
16
+ : client.disable_scroll_handling;
17
+ const goto = ssr ? guard('goto') : client.goto;
18
+ const invalidate = ssr ? guard('invalidate') : client.invalidate;
19
+ const prefetch = ssr ? guard('prefetch') : client.prefetch;
20
+ const prefetchRoutes = ssr ? guard('prefetchRoutes') : client.prefetch_routes;
21
+ const beforeNavigate = ssr ? () => {} : client.before_navigate;
22
+ const afterNavigate = ssr ? () => {} : client.after_navigate;
23
+
24
+ export { afterNavigate, beforeNavigate, disableScrollHandling, goto, invalidate, prefetch, prefetchRoutes };
@@ -0,0 +1 @@
1
+ export { assets, base } from '../paths.js';
@@ -0,0 +1,97 @@
1
+ import { getContext } from 'svelte';
2
+ import { browser } from './env.js';
3
+ import '../env.js';
4
+
5
+ // TODO remove this (for 1.0? after 1.0?)
6
+ let warned = false;
7
+ function stores() {
8
+ if (!warned) {
9
+ console.error('stores() is deprecated; use getStores() instead');
10
+ warned = true;
11
+ }
12
+ return getStores();
13
+ }
14
+
15
+ /**
16
+ * @type {import('$app/stores').getStores}
17
+ */
18
+ const getStores = () => {
19
+ const stores = getContext('__svelte__');
20
+
21
+ return {
22
+ page: {
23
+ subscribe: stores.page.subscribe
24
+ },
25
+ navigating: {
26
+ subscribe: stores.navigating.subscribe
27
+ },
28
+ // TODO remove this (for 1.0? after 1.0?)
29
+ // @ts-expect-error - deprecated, not part of type definitions, but still callable
30
+ get preloading() {
31
+ console.error('stores.preloading is deprecated; use stores.navigating instead');
32
+ return {
33
+ subscribe: stores.navigating.subscribe
34
+ };
35
+ },
36
+ session: stores.session,
37
+ updated: stores.updated
38
+ };
39
+ };
40
+
41
+ /** @type {typeof import('$app/stores').page} */
42
+ const page = {
43
+ /** @param {(value: any) => void} fn */
44
+ subscribe(fn) {
45
+ const store = getStores().page;
46
+ return store.subscribe(fn);
47
+ }
48
+ };
49
+
50
+ /** @type {typeof import('$app/stores').navigating} */
51
+ const navigating = {
52
+ subscribe(fn) {
53
+ const store = getStores().navigating;
54
+ return store.subscribe(fn);
55
+ }
56
+ };
57
+
58
+ /** @param {string} verb */
59
+ const throw_error = (verb) => {
60
+ throw new Error(
61
+ browser
62
+ ? `Cannot ${verb} session store before subscribing`
63
+ : `Can only ${verb} session store in browser`
64
+ );
65
+ };
66
+
67
+ /** @type {typeof import('$app/stores').session} */
68
+ const session = {
69
+ subscribe(fn) {
70
+ const store = getStores().session;
71
+
72
+ if (browser) {
73
+ session.set = store.set;
74
+ session.update = store.update;
75
+ }
76
+
77
+ return store.subscribe(fn);
78
+ },
79
+ set: () => throw_error('set'),
80
+ update: () => throw_error('update')
81
+ };
82
+
83
+ /** @type {typeof import('$app/stores').updated} */
84
+ const updated = {
85
+ subscribe(fn) {
86
+ const store = getStores().updated;
87
+
88
+ if (browser) {
89
+ updated.check = store.check;
90
+ }
91
+
92
+ return store.subscribe(fn);
93
+ },
94
+ check: () => throw_error('check')
95
+ };
96
+
97
+ export { getStores, navigating, page, session, stores, updated };
@@ -0,0 +1,13 @@
1
+ /** @type {import('./types').Client} */
2
+ let client;
3
+
4
+ /**
5
+ * @param {{
6
+ * client: import('./types').Client;
7
+ * }} opts
8
+ */
9
+ function init(opts) {
10
+ client = opts.client;
11
+ }
12
+
13
+ export { client, init };