@sveltejs/kit 1.0.0-next.33 → 1.0.0-next.330

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 (75) hide show
  1. package/README.md +12 -9
  2. package/assets/app/env.js +20 -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 +1689 -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 +3408 -0
  12. package/dist/chunks/amp_hook.js +56 -0
  13. package/dist/chunks/cert.js +28154 -0
  14. package/dist/chunks/constants.js +663 -0
  15. package/dist/chunks/filesystem.js +110 -0
  16. package/dist/chunks/index.js +514 -0
  17. package/dist/chunks/index2.js +1384 -0
  18. package/dist/chunks/index3.js +118 -0
  19. package/dist/chunks/index4.js +182 -0
  20. package/dist/chunks/index5.js +252 -0
  21. package/dist/chunks/index6.js +15741 -0
  22. package/dist/chunks/index7.js +4207 -0
  23. package/dist/chunks/misc.js +78 -0
  24. package/dist/chunks/multipart-parser.js +449 -0
  25. package/dist/chunks/object.js +83 -0
  26. package/dist/chunks/sync.js +848 -0
  27. package/dist/chunks/write_tsconfig.js +150 -0
  28. package/dist/cli.js +1025 -65
  29. package/dist/hooks.js +28 -0
  30. package/dist/install-fetch.js +6518 -0
  31. package/dist/node.js +94 -0
  32. package/package.json +96 -62
  33. package/svelte-kit.js +0 -1
  34. package/types/ambient.d.ts +298 -0
  35. package/types/index.d.ts +279 -0
  36. package/types/internal.d.ts +320 -0
  37. package/types/private.d.ts +246 -0
  38. package/CHANGELOG.md +0 -356
  39. package/assets/runtime/app/navigation.js +0 -23
  40. package/assets/runtime/app/navigation.js.map +0 -1
  41. package/assets/runtime/app/paths.js +0 -2
  42. package/assets/runtime/app/paths.js.map +0 -1
  43. package/assets/runtime/app/stores.js +0 -78
  44. package/assets/runtime/app/stores.js.map +0 -1
  45. package/assets/runtime/internal/singletons.js +0 -15
  46. package/assets/runtime/internal/singletons.js.map +0 -1
  47. package/assets/runtime/internal/start.js +0 -591
  48. package/assets/runtime/internal/start.js.map +0 -1
  49. package/assets/runtime/utils-85ebcc60.js +0 -18
  50. package/assets/runtime/utils-85ebcc60.js.map +0 -1
  51. package/dist/api.js +0 -32
  52. package/dist/api.js.map +0 -1
  53. package/dist/cli.js.map +0 -1
  54. package/dist/create_app.js +0 -577
  55. package/dist/create_app.js.map +0 -1
  56. package/dist/index.js +0 -329
  57. package/dist/index.js.map +0 -1
  58. package/dist/index2.js +0 -14368
  59. package/dist/index2.js.map +0 -1
  60. package/dist/index3.js +0 -544
  61. package/dist/index3.js.map +0 -1
  62. package/dist/index4.js +0 -71
  63. package/dist/index4.js.map +0 -1
  64. package/dist/index5.js +0 -465
  65. package/dist/index5.js.map +0 -1
  66. package/dist/index6.js +0 -727
  67. package/dist/index6.js.map +0 -1
  68. package/dist/renderer.js +0 -2413
  69. package/dist/renderer.js.map +0 -1
  70. package/dist/standard.js +0 -100
  71. package/dist/standard.js.map +0 -1
  72. package/dist/utils.js +0 -57
  73. package/dist/utils.js.map +0 -1
  74. package/dist/vite.js +0 -317
  75. package/dist/vite.js.map +0 -1
@@ -0,0 +1,246 @@
1
+ // This module contains types that are visible in the documentation,
2
+ // but which cannot be imported from `@sveltejs/kit`. Care should
3
+ // be taken to avoid breaking changes when editing this file
4
+
5
+ export interface AdapterEntry {
6
+ /**
7
+ * A string that uniquely identifies an HTTP service (e.g. serverless function) and is used for deduplication.
8
+ * For example, `/foo/a-[b]` and `/foo/[c]` are different routes, but would both
9
+ * be represented in a Netlify _redirects file as `/foo/:param`, so they share an ID
10
+ */
11
+ id: string;
12
+
13
+ /**
14
+ * A function that compares the candidate route with the current route to determine
15
+ * if it should be treated as a fallback for the current route. For example, `/foo/[c]`
16
+ * is a fallback for `/foo/a-[b]`, and `/[...catchall]` is a fallback for all routes
17
+ */
18
+ filter: (route: RouteDefinition) => boolean;
19
+
20
+ /**
21
+ * A function that is invoked once the entry has been created. This is where you
22
+ * should write the function to the filesystem and generate redirect manifests.
23
+ */
24
+ complete: (entry: {
25
+ generateManifest: (opts: { relativePath: string; format?: 'esm' | 'cjs' }) => string;
26
+ }) => MaybePromise<void>;
27
+ }
28
+
29
+ export type BodyValidator<T> = {
30
+ [P in keyof T]: T[P] extends JSONValue ? BodyValidator<T[P]> : never;
31
+ };
32
+
33
+ // Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts
34
+ //
35
+ // MIT License
36
+ //
37
+ // Copyright (c) 2021-present, Joshua Hemphill
38
+ // Copyright (c) 2021, Tecnico Corporation
39
+ //
40
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
41
+ // of this software and associated documentation files (the "Software"), to deal
42
+ // in the Software without restriction, including without limitation the rights
43
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44
+ // copies of the Software, and to permit persons to whom the Software is
45
+ // furnished to do so, subject to the following conditions:
46
+ //
47
+ // The above copyright notice and this permission notice shall be included in all
48
+ // copies or substantial portions of the Software.
49
+ //
50
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56
+ // SOFTWARE.
57
+
58
+ export namespace Csp {
59
+ type ActionSource = 'strict-dynamic' | 'report-sample';
60
+ type BaseSource = 'self' | 'unsafe-eval' | 'unsafe-hashes' | 'unsafe-inline' | 'none';
61
+ type CryptoSource = `${'nonce' | 'sha256' | 'sha384' | 'sha512'}-${string}`;
62
+ type FrameSource = HostSource | SchemeSource | 'self' | 'none';
63
+ type HostNameScheme = `${string}.${string}` | 'localhost';
64
+ type HostSource = `${HostProtocolSchemes}${HostNameScheme}${PortScheme}`;
65
+ type HostProtocolSchemes = `${string}://` | '';
66
+ type HttpDelineator = '/' | '?' | '#' | '\\';
67
+ type PortScheme = `:${number}` | '' | ':*';
68
+ type SchemeSource = 'http:' | 'https:' | 'data:' | 'mediastream:' | 'blob:' | 'filesystem:';
69
+ type Source = HostSource | SchemeSource | CryptoSource | BaseSource;
70
+ type Sources = Source[];
71
+ type UriPath = `${HttpDelineator}${string}`;
72
+ }
73
+
74
+ export interface CspDirectives {
75
+ 'child-src'?: Csp.Sources;
76
+ 'default-src'?: Array<Csp.Source | Csp.ActionSource>;
77
+ 'frame-src'?: Csp.Sources;
78
+ 'worker-src'?: Csp.Sources;
79
+ 'connect-src'?: Csp.Sources;
80
+ 'font-src'?: Csp.Sources;
81
+ 'img-src'?: Csp.Sources;
82
+ 'manifest-src'?: Csp.Sources;
83
+ 'media-src'?: Csp.Sources;
84
+ 'object-src'?: Csp.Sources;
85
+ 'prefetch-src'?: Csp.Sources;
86
+ 'script-src'?: Array<Csp.Source | Csp.ActionSource>;
87
+ 'script-src-elem'?: Csp.Sources;
88
+ 'script-src-attr'?: Csp.Sources;
89
+ 'style-src'?: Array<Csp.Source | Csp.ActionSource>;
90
+ 'style-src-elem'?: Csp.Sources;
91
+ 'style-src-attr'?: Csp.Sources;
92
+ 'base-uri'?: Array<Csp.Source | Csp.ActionSource>;
93
+ sandbox?: Array<
94
+ | 'allow-downloads-without-user-activation'
95
+ | 'allow-forms'
96
+ | 'allow-modals'
97
+ | 'allow-orientation-lock'
98
+ | 'allow-pointer-lock'
99
+ | 'allow-popups'
100
+ | 'allow-popups-to-escape-sandbox'
101
+ | 'allow-presentation'
102
+ | 'allow-same-origin'
103
+ | 'allow-scripts'
104
+ | 'allow-storage-access-by-user-activation'
105
+ | 'allow-top-navigation'
106
+ | 'allow-top-navigation-by-user-activation'
107
+ >;
108
+ 'form-action'?: Array<Csp.Source | Csp.ActionSource>;
109
+ 'frame-ancestors'?: Array<Csp.HostSource | Csp.SchemeSource | Csp.FrameSource>;
110
+ 'navigate-to'?: Array<Csp.Source | Csp.ActionSource>;
111
+ 'report-uri'?: Csp.UriPath[];
112
+ 'report-to'?: string[];
113
+
114
+ 'require-trusted-types-for'?: Array<'script'>;
115
+ 'trusted-types'?: Array<'none' | 'allow-duplicates' | '*' | string>;
116
+ 'upgrade-insecure-requests'?: boolean;
117
+
118
+ /** @deprecated */
119
+ 'require-sri-for'?: Array<'script' | 'style' | 'script style'>;
120
+
121
+ /** @deprecated */
122
+ 'block-all-mixed-content'?: boolean;
123
+
124
+ /** @deprecated */
125
+ 'plugin-types'?: Array<`${string}/${string}` | 'none'>;
126
+
127
+ /** @deprecated */
128
+ referrer?: Array<
129
+ | 'no-referrer'
130
+ | 'no-referrer-when-downgrade'
131
+ | 'origin'
132
+ | 'origin-when-cross-origin'
133
+ | 'same-origin'
134
+ | 'strict-origin'
135
+ | 'strict-origin-when-cross-origin'
136
+ | 'unsafe-url'
137
+ | 'none'
138
+ >;
139
+ }
140
+
141
+ export type HttpMethod = 'get' | 'head' | 'post' | 'put' | 'delete' | 'patch';
142
+
143
+ export interface JSONObject {
144
+ [key: string]: JSONValue;
145
+ }
146
+
147
+ export type JSONValue =
148
+ | string
149
+ | number
150
+ | boolean
151
+ | null
152
+ | undefined
153
+ | ToJSON
154
+ | JSONValue[]
155
+ | JSONObject;
156
+
157
+ export interface Logger {
158
+ (msg: string): void;
159
+ success(msg: string): void;
160
+ error(msg: string): void;
161
+ warn(msg: string): void;
162
+ minor(msg: string): void;
163
+ info(msg: string): void;
164
+ }
165
+
166
+ export type MaybePromise<T> = T | Promise<T>;
167
+
168
+ export interface Prerendered {
169
+ pages: Map<
170
+ string,
171
+ {
172
+ /** The location of the .html file relative to the output directory */
173
+ file: string;
174
+ }
175
+ >;
176
+ assets: Map<
177
+ string,
178
+ {
179
+ /** The MIME type of the asset */
180
+ type: string;
181
+ }
182
+ >;
183
+ redirects: Map<
184
+ string,
185
+ {
186
+ status: number;
187
+ location: string;
188
+ }
189
+ >;
190
+ /** An array of prerendered paths (without trailing slashes, regardless of the trailingSlash config) */
191
+ paths: string[];
192
+ }
193
+
194
+ export interface PrerenderErrorHandler {
195
+ (details: {
196
+ status: number;
197
+ path: string;
198
+ referrer: string | null;
199
+ referenceType: 'linked' | 'fetched';
200
+ }): void;
201
+ }
202
+
203
+ export type PrerenderOnErrorValue = 'fail' | 'continue' | PrerenderErrorHandler;
204
+
205
+ export interface RequestEvent<Params extends Record<string, string> = Record<string, string>> {
206
+ clientAddress: string;
207
+ locals: App.Locals;
208
+ params: Params;
209
+ platform: Readonly<App.Platform>;
210
+ request: Request;
211
+ routeId: string | null;
212
+ url: URL;
213
+ }
214
+
215
+ export interface RequestOptions {
216
+ getClientAddress: () => string;
217
+ platform?: App.Platform;
218
+ }
219
+
220
+ export interface ResolveOptions {
221
+ ssr?: boolean;
222
+ transformPage?: ({ html }: { html: string }) => MaybePromise<string>;
223
+ }
224
+
225
+ /** `string[]` is only for set-cookie, everything else must be type of `string` */
226
+ export type ResponseHeaders = Record<string, string | number | string[]>;
227
+
228
+ export interface RouteDefinition {
229
+ id: string;
230
+ type: 'page' | 'endpoint';
231
+ pattern: RegExp;
232
+ segments: RouteSegment[];
233
+ methods: HttpMethod[];
234
+ }
235
+
236
+ export interface RouteSegment {
237
+ content: string;
238
+ dynamic: boolean;
239
+ rest: boolean;
240
+ }
241
+
242
+ export interface ToJSON {
243
+ toJSON(...args: any[]): Exclude<JSONValue, ToJSON>;
244
+ }
245
+
246
+ export type TrailingSlash = 'never' | 'always' | 'ignore';
package/CHANGELOG.md DELETED
@@ -1,356 +0,0 @@
1
- # @sveltejs/kit
2
-
3
- ## 1.0.0-next.33
4
-
5
- ### Patch Changes
6
-
7
- - 474070e: Better errors when modules cannot be found
8
-
9
- ## 1.0.0-next.32
10
-
11
- ### Patch Changes
12
-
13
- - Convert everything to ESM
14
-
15
- ## 1.0.0-next.31
16
-
17
- ### Patch Changes
18
-
19
- - b6c2434: app.js -> app.cjs
20
-
21
- ## 1.0.0-next.30
22
-
23
- ### Patch Changes
24
-
25
- - 00cbaf6: Rename _.config.js to _.config.cjs
26
-
27
- ## 1.0.0-next.29
28
-
29
- ### Patch Changes
30
-
31
- - 4c0edce: Use addEventListener instead of onload
32
-
33
- ## 1.0.0-next.28
34
-
35
- ### Patch Changes
36
-
37
- - 4353025: Prevent infinite loop when fetching bad URLs inside error responses
38
- - 2860065: Handle assets path when prerendering
39
-
40
- ## 1.0.0-next.27
41
-
42
- ### Patch Changes
43
-
44
- - Fail build if prerender errors
45
- - Hide logging behind --verbose option
46
-
47
- ## 1.0.0-next.26
48
-
49
- ### Patch Changes
50
-
51
- - Fix svelte-announcer CSS
52
-
53
- ## 1.0.0-next.25
54
-
55
- ### Patch Changes
56
-
57
- - Surface stack traces for endpoint/page rendering errors
58
-
59
- ## 1.0.0-next.24
60
-
61
- ### Patch Changes
62
-
63
- - 26643df: Account for config.paths when prerendering
64
-
65
- ## 1.0.0-next.23
66
-
67
- ### Patch Changes
68
-
69
- - 9b758aa: Upgrade to Snowpack 3
70
-
71
- ## 1.0.0-next.22
72
-
73
- ### Patch Changes
74
-
75
- - bb68595: use readFileSync instead of createReadStream
76
-
77
- ## 1.0.0-next.21
78
-
79
- ### Patch Changes
80
-
81
- - 217e4cc: Set paths to empty string before prerender
82
-
83
- ## 1.0.0-next.20
84
-
85
- ### Patch Changes
86
-
87
- - ccf4aa7: Implement prerender config
88
-
89
- ## 1.0.0-next.19
90
-
91
- ### Patch Changes
92
-
93
- - deda984: Make navigating store contain from and to properties
94
-
95
- ## 1.0.0-next.18
96
-
97
- ### Patch Changes
98
-
99
- - c29b61e: Announce page changes
100
- - 72da270: Reset focus properly
101
-
102
- ## 1.0.0-next.17
103
-
104
- ### Patch Changes
105
-
106
- - f7dea55: Set process.env.NODE_ENV when invoking via the CLI
107
-
108
- ## 1.0.0-next.16
109
-
110
- ### Patch Changes
111
-
112
- - Remove temporary logging
113
- - Add sveltekit:prefetch and sveltekit:noscroll
114
-
115
- ## 1.0.0-next.15
116
-
117
- ### Patch Changes
118
-
119
- - 6d1bb11: Fix AMP CSS
120
- - d8b53af: Ignore $layout and $error files when finding static paths
121
- - Better scroll tracking
122
-
123
- ## 1.0.0-next.14
124
-
125
- ### Patch Changes
126
-
127
- - Fix dev loader
128
-
129
- ## 1.0.0-next.13
130
-
131
- ### Patch Changes
132
-
133
- - 1ea4d6b: More robust CSS extraction
134
-
135
- ## 1.0.0-next.12
136
-
137
- ### Patch Changes
138
-
139
- - e7c88dd: Tweak AMP validation screen
140
-
141
- ## 1.0.0-next.11
142
-
143
- ### Patch Changes
144
-
145
- - a31f218: Fix SSR loader invalidation
146
-
147
- ## 1.0.0-next.10
148
-
149
- ### Patch Changes
150
-
151
- - 8b14d29: Omit svelte-data scripts from AMP pages
152
-
153
- ## 1.0.0-next.9
154
-
155
- ### Patch Changes
156
-
157
- - f5fa223: AMP support
158
- - 47f2ee1: Always remove trailing slashes
159
- - 1becb94: Replace preload with load
160
-
161
- ## 1.0.0-next.8
162
-
163
- ### Patch Changes
164
-
165
- - 15dd751: Use meta http-equiv=refresh
166
- - be7e031: Fix handling of static files
167
- - ed6b8fd: Implement \$app/env
168
-
169
- ## 1.0.0-next.7
170
-
171
- ### Patch Changes
172
-
173
- - 76705b0: make HMR work outside localhost
174
-
175
- ## 1.0.0-next.6
176
-
177
- ### Patch Changes
178
-
179
- - 0e45255: Move options behind kit namespace, change paths -> kit.files
180
- - fa7f2b2: Implement live bindings for SSR code
181
-
182
- ## 1.0.0-next.5
183
-
184
- ### Patch Changes
185
-
186
- - Return dependencies from render
187
-
188
- ## 1.0.0-next.4
189
-
190
- ### Patch Changes
191
-
192
- - af01b0d: Move renderer out of app assets folder
193
-
194
- ## 1.0.0-next.3
195
-
196
- ### Patch Changes
197
-
198
- - Add paths to manifest, for static prerendering
199
-
200
- ## 1.0.0-next.2
201
-
202
- ### Patch Changes
203
-
204
- - Fix typo causing misnamed assets folder
205
-
206
- ## 1.0.0-next.1
207
-
208
- ### Patch Changes
209
-
210
- - a4bc090: Transform exported functions correctly
211
- - 00bbf98: Fix nested layouts
212
-
213
- ## 0.0.31-next.0
214
-
215
- ### Patch Changes
216
-
217
- - ffd7bba: Fix SSR cache invalidation
218
-
219
- ## 0.0.30
220
-
221
- ### Patch Changes
222
-
223
- - Add back stores(), but with deprecation warning
224
- - Rename stores.preloading to stores.navigating
225
- - Rewrite routing logic
226
-
227
- ## 0.0.29
228
-
229
- ### Patch Changes
230
-
231
- - 10872cc: Normalize request.query
232
-
233
- ## 0.0.28
234
-
235
- ### Patch Changes
236
-
237
- - Add svelte-kit start command
238
-
239
- ## 0.0.27
240
-
241
- ### Patch Changes
242
-
243
- - rename CLI to svelte-kit
244
- - 0904e22: rename svelte CLI to svelte-kit
245
- - Validate route responses
246
- - Make paths and target configurable
247
-
248
- ## 0.0.26
249
-
250
- ### Patch Changes
251
-
252
- - b475ed4: Overhaul adapter API - fixes #166
253
- - Updated dependencies [b475ed4]
254
- - @sveltejs/app-utils@0.0.18
255
-
256
- ## 0.0.25
257
-
258
- ### Patch Changes
259
-
260
- - Updated dependencies [3bdf33b]
261
- - @sveltejs/app-utils@0.0.17
262
-
263
- ## 0.0.24
264
-
265
- ### Patch Changes
266
-
267
- - 67eaeea: Move app-utils stuff into subpackages
268
- - 7f8df30: Move kit runtime code, expose via \$app aliases
269
- - Updated dependencies [67eaeea]
270
- - @sveltejs/app-utils@0.0.16
271
-
272
- ## 0.0.23
273
-
274
- ### Patch Changes
275
-
276
- - a163000: Parse body on incoming requests
277
- - a346eab: Copy over latest Sapper router code
278
- - Updated dependencies [a163000]
279
- - @sveltejs/app-utils@0.0.15
280
-
281
- ## 0.0.22
282
-
283
- ### Patch Changes
284
-
285
- - Force bump version
286
-
287
- ## 0.0.21
288
-
289
- ### Patch Changes
290
-
291
- - Build setup entry point
292
- - Work around pkg.exports constraint
293
- - Respond with 500s if render fails
294
- - Updated dependencies [undefined]
295
- - Updated dependencies [undefined]
296
- - Updated dependencies [undefined]
297
- - @sveltejs/app-utils@0.0.14
298
-
299
- ## 0.0.20
300
-
301
- ### Patch Changes
302
-
303
- - Pass setup module to renderer
304
- - Bump Snowpack version
305
- - Updated dependencies [undefined]
306
- - Updated dependencies [96c06d8]
307
- - @sveltejs/app-utils@0.0.13
308
-
309
- ## 0.0.19
310
-
311
- ### Patch Changes
312
-
313
- - fa9d7ce: Handle import.meta in SSR module loader
314
- - 0320208: Rename 'server route' to 'endpoint'
315
- - b9444d2: Update to Snowpack 2.15
316
- - 5ca907c: Use shared mkdirp helper
317
- - Updated dependencies [0320208]
318
- - Updated dependencies [5ca907c]
319
- - @sveltejs/app-utils@0.0.12
320
-
321
- ## 0.0.18
322
-
323
- ### Patch Changes
324
-
325
- - Updated dependencies [undefined]
326
- - @sveltejs/app-utils@0.0.11
327
-
328
- ## 0.0.17
329
-
330
- ### Patch Changes
331
-
332
- - 19323e9: Update Snowpack
333
- - Updated dependencies [19323e9]
334
- - @sveltejs/app-utils@0.0.10
335
-
336
- ## 0.0.16
337
-
338
- ### Patch Changes
339
-
340
- - Updated dependencies [90a98ae]
341
- - @sveltejs/app-utils@0.0.9
342
-
343
- ## 0.0.15
344
-
345
- ### Patch Changes
346
-
347
- - Updated dependencies [undefined]
348
- - @sveltejs/app-utils@0.0.8
349
-
350
- ## 0.0.14
351
-
352
- ### Patch Changes
353
-
354
- - various
355
- - Updated dependencies [undefined]
356
- - @sveltejs/app-utils@0.0.7
@@ -1,23 +0,0 @@
1
- import { router, renderer } from '../internal/singletons.js';
2
- import { g as get_base_uri } from '../utils-85ebcc60.js';
3
-
4
- async function goto(href, opts) {
5
- return router.goto(href, opts);
6
- }
7
-
8
- function prefetch(href) {
9
- return renderer.prefetch(new URL(href, get_base_uri(document)));
10
- }
11
-
12
- async function prefetchRoutes(pathnames) {
13
- const path_routes = pathnames
14
- ? router.pages.filter((page) => pathnames.some((pathname) => page.pattern.test(pathname)))
15
- : router.pages;
16
-
17
- const promises = path_routes.map((r) => Promise.all(r.parts.map((load) => load())));
18
-
19
- await Promise.all(promises);
20
- }
21
-
22
- export { goto, prefetch, prefetchRoutes };
23
- //# sourceMappingURL=navigation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigation.js","sources":["../../../src/runtime/app/navigation/index.js"],"sourcesContent":["import { router, renderer } from '../../internal/singletons';\nimport { get_base_uri } from '../../internal/utils';\n\nexport async function goto(href, opts) {\n\treturn router.goto(href, opts);\n}\n\nexport function prefetch(href) {\n\treturn renderer.prefetch(new URL(href, get_base_uri(document)));\n}\n\nexport async function prefetchRoutes(pathnames) {\n\tconst path_routes = pathnames\n\t\t? router.pages.filter((page) => pathnames.some((pathname) => page.pattern.test(pathname)))\n\t\t: router.pages;\n\n\tconst promises = path_routes.map((r) => Promise.all(r.parts.map((load) => load())));\n\n\tawait Promise.all(promises);\n}\n"],"names":[],"mappings":";;;AAGO,eAAe,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;AACvC,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC;AACD;AACO,SAAS,QAAQ,CAAC,IAAI,EAAE;AAC/B,CAAC,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC;AACD;AACO,eAAe,cAAc,CAAC,SAAS,EAAE;AAChD,CAAC,MAAM,WAAW,GAAG,SAAS;AAC9B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5F,IAAI,MAAM,CAAC,KAAK,CAAC;AACjB;AACA,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACrF;AACA,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC7B;;;;"}
@@ -1,2 +0,0 @@
1
- export { assets, base } from '../internal/singletons.js';
2
- //# sourceMappingURL=paths.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paths.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,78 +0,0 @@
1
- import { getContext } from 'svelte';
2
-
3
- // const ssr = (import.meta as any).env.SSR;
4
- const ssr = typeof window === 'undefined'; // TODO why doesn't previous line work in build?
5
-
6
- // TODO remove this (for 1.0? after 1.0?)
7
- let warned = false;
8
- function stores() {
9
- if (!warned) {
10
- console.error('stores() is deprecated; use getStores() instead');
11
- warned = true;
12
- }
13
- return getStores();
14
- }
15
-
16
- const getStores = () => {
17
- const stores = getContext('__svelte__');
18
-
19
- return {
20
- page: {
21
- subscribe: stores.page.subscribe
22
- },
23
- navigating: {
24
- subscribe: stores.navigating.subscribe
25
- },
26
- get preloading() {
27
- console.error('stores.preloading is deprecated; use stores.navigating instead');
28
- return {
29
- subscribe: stores.navigating.subscribe
30
- };
31
- },
32
- session: stores.session
33
- };
34
- };
35
-
36
- const page = {
37
- subscribe(fn) {
38
- const store = getStores().page;
39
- return store.subscribe(fn);
40
- }
41
- };
42
-
43
- const navigating = {
44
- subscribe(fn) {
45
- const store = getStores().navigating;
46
- return store.subscribe(fn);
47
- }
48
- };
49
-
50
- const error = (verb) => {
51
- throw new Error(
52
- ssr
53
- ? `Can only ${verb} session store in browser`
54
- : `Cannot ${verb} session store before subscribing`
55
- );
56
- };
57
-
58
- const session = {
59
- subscribe(fn) {
60
- const store = getStores().session;
61
-
62
- if (!ssr) {
63
- session.set = store.set;
64
- session.update = store.update;
65
- }
66
-
67
- return store.subscribe(fn);
68
- },
69
- set: (value) => {
70
- error('set');
71
- },
72
- update: (updater) => {
73
- error('update');
74
- }
75
- };
76
-
77
- export { getStores, navigating, page, session, stores };
78
- //# sourceMappingURL=stores.js.map