@sveltejs/kit 1.0.0-next.40 → 1.0.0-next.402

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 (48) hide show
  1. package/README.md +12 -9
  2. package/assets/app/env.js +13 -0
  3. package/assets/app/navigation.js +24 -0
  4. package/assets/app/paths.js +1 -0
  5. package/assets/{runtime/app → app}/stores.js +33 -29
  6. package/assets/client/singletons.js +13 -0
  7. package/assets/client/start.js +1845 -0
  8. package/assets/components/error.svelte +18 -2
  9. package/assets/env/dynamic/private.js +1 -0
  10. package/assets/env/dynamic/public.js +1 -0
  11. package/assets/env-private.js +9 -0
  12. package/assets/env-public.js +9 -0
  13. package/assets/env.js +8 -0
  14. package/assets/{runtime/chunks/paths.js → paths.js} +4 -3
  15. package/assets/server/index.js +3579 -0
  16. package/dist/chunks/error.js +12 -0
  17. package/dist/chunks/filesystem.js +110 -0
  18. package/dist/chunks/index.js +541 -3385
  19. package/dist/chunks/index2.js +15631 -473
  20. package/dist/chunks/index3.js +189 -217
  21. package/dist/chunks/multipart-parser.js +458 -0
  22. package/dist/chunks/sync.js +1366 -0
  23. package/dist/chunks/utils.js +40 -57
  24. package/dist/chunks/write_tsconfig.js +273 -0
  25. package/dist/cli.js +85 -513
  26. package/dist/hooks.js +28 -0
  27. package/dist/node/polyfills.js +17778 -0
  28. package/dist/node.js +348 -0
  29. package/dist/prerender.js +788 -0
  30. package/dist/vite.js +2520 -0
  31. package/package.json +98 -64
  32. package/svelte-kit.js +10 -1
  33. package/types/ambient.d.ts +375 -0
  34. package/types/index.d.ts +298 -0
  35. package/types/internal.d.ts +335 -0
  36. package/types/private.d.ts +235 -0
  37. package/CHANGELOG.md +0 -411
  38. package/assets/runtime/app/env.js +0 -5
  39. package/assets/runtime/app/navigation.js +0 -41
  40. package/assets/runtime/app/paths.js +0 -1
  41. package/assets/runtime/chunks/utils.js +0 -19
  42. package/assets/runtime/internal/singletons.js +0 -23
  43. package/assets/runtime/internal/start.js +0 -770
  44. package/dist/chunks/index4.js +0 -526
  45. package/dist/chunks/index5.js +0 -761
  46. package/dist/chunks/index6.js +0 -322
  47. package/dist/chunks/standard.js +0 -99
  48. package/dist/ssr.js +0 -2523
@@ -0,0 +1,235 @@
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 { [k: string]: unknown }
31
+ ? BodyValidator<T[P]> // recurse when T[P] is an object
32
+ : T[P] extends BigInt | Function | Symbol
33
+ ? never
34
+ : T[P];
35
+ };
36
+
37
+ // Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts
38
+ //
39
+ // MIT License
40
+ //
41
+ // Copyright (c) 2021-present, Joshua Hemphill
42
+ // Copyright (c) 2021, Tecnico Corporation
43
+ //
44
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
45
+ // of this software and associated documentation files (the "Software"), to deal
46
+ // in the Software without restriction, including without limitation the rights
47
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48
+ // copies of the Software, and to permit persons to whom the Software is
49
+ // furnished to do so, subject to the following conditions:
50
+ //
51
+ // The above copyright notice and this permission notice shall be included in all
52
+ // copies or substantial portions of the Software.
53
+ //
54
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
60
+ // SOFTWARE.
61
+
62
+ export namespace Csp {
63
+ type ActionSource = 'strict-dynamic' | 'report-sample';
64
+ type BaseSource = 'self' | 'unsafe-eval' | 'unsafe-hashes' | 'unsafe-inline' | 'none';
65
+ type CryptoSource = `${'nonce' | 'sha256' | 'sha384' | 'sha512'}-${string}`;
66
+ type FrameSource = HostSource | SchemeSource | 'self' | 'none';
67
+ type HostNameScheme = `${string}.${string}` | 'localhost';
68
+ type HostSource = `${HostProtocolSchemes}${HostNameScheme}${PortScheme}`;
69
+ type HostProtocolSchemes = `${string}://` | '';
70
+ type HttpDelineator = '/' | '?' | '#' | '\\';
71
+ type PortScheme = `:${number}` | '' | ':*';
72
+ type SchemeSource = 'http:' | 'https:' | 'data:' | 'mediastream:' | 'blob:' | 'filesystem:';
73
+ type Source = HostSource | SchemeSource | CryptoSource | BaseSource;
74
+ type Sources = Source[];
75
+ type UriPath = `${HttpDelineator}${string}`;
76
+ }
77
+
78
+ export interface CspDirectives {
79
+ 'child-src'?: Csp.Sources;
80
+ 'default-src'?: Array<Csp.Source | Csp.ActionSource>;
81
+ 'frame-src'?: Csp.Sources;
82
+ 'worker-src'?: Csp.Sources;
83
+ 'connect-src'?: Csp.Sources;
84
+ 'font-src'?: Csp.Sources;
85
+ 'img-src'?: Csp.Sources;
86
+ 'manifest-src'?: Csp.Sources;
87
+ 'media-src'?: Csp.Sources;
88
+ 'object-src'?: Csp.Sources;
89
+ 'prefetch-src'?: Csp.Sources;
90
+ 'script-src'?: Array<Csp.Source | Csp.ActionSource>;
91
+ 'script-src-elem'?: Csp.Sources;
92
+ 'script-src-attr'?: Csp.Sources;
93
+ 'style-src'?: Array<Csp.Source | Csp.ActionSource>;
94
+ 'style-src-elem'?: Csp.Sources;
95
+ 'style-src-attr'?: Csp.Sources;
96
+ 'base-uri'?: Array<Csp.Source | Csp.ActionSource>;
97
+ sandbox?: Array<
98
+ | 'allow-downloads-without-user-activation'
99
+ | 'allow-forms'
100
+ | 'allow-modals'
101
+ | 'allow-orientation-lock'
102
+ | 'allow-pointer-lock'
103
+ | 'allow-popups'
104
+ | 'allow-popups-to-escape-sandbox'
105
+ | 'allow-presentation'
106
+ | 'allow-same-origin'
107
+ | 'allow-scripts'
108
+ | 'allow-storage-access-by-user-activation'
109
+ | 'allow-top-navigation'
110
+ | 'allow-top-navigation-by-user-activation'
111
+ >;
112
+ 'form-action'?: Array<Csp.Source | Csp.ActionSource>;
113
+ 'frame-ancestors'?: Array<Csp.HostSource | Csp.SchemeSource | Csp.FrameSource>;
114
+ 'navigate-to'?: Array<Csp.Source | Csp.ActionSource>;
115
+ 'report-uri'?: Csp.UriPath[];
116
+ 'report-to'?: string[];
117
+
118
+ 'require-trusted-types-for'?: Array<'script'>;
119
+ 'trusted-types'?: Array<'none' | 'allow-duplicates' | '*' | string>;
120
+ 'upgrade-insecure-requests'?: boolean;
121
+
122
+ /** @deprecated */
123
+ 'require-sri-for'?: Array<'script' | 'style' | 'script style'>;
124
+
125
+ /** @deprecated */
126
+ 'block-all-mixed-content'?: boolean;
127
+
128
+ /** @deprecated */
129
+ 'plugin-types'?: Array<`${string}/${string}` | 'none'>;
130
+
131
+ /** @deprecated */
132
+ referrer?: Array<
133
+ | 'no-referrer'
134
+ | 'no-referrer-when-downgrade'
135
+ | 'origin'
136
+ | 'origin-when-cross-origin'
137
+ | 'same-origin'
138
+ | 'strict-origin'
139
+ | 'strict-origin-when-cross-origin'
140
+ | 'unsafe-url'
141
+ | 'none'
142
+ >;
143
+ }
144
+
145
+ export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
146
+
147
+ export interface JSONObject {
148
+ [key: string]: JSONValue;
149
+ }
150
+
151
+ export type JSONValue =
152
+ | string
153
+ | number
154
+ | boolean
155
+ | null
156
+ | undefined
157
+ | ToJSON
158
+ | JSONValue[]
159
+ | JSONObject;
160
+
161
+ export interface Logger {
162
+ (msg: string): void;
163
+ success(msg: string): void;
164
+ error(msg: string): void;
165
+ warn(msg: string): void;
166
+ minor(msg: string): void;
167
+ info(msg: string): void;
168
+ }
169
+
170
+ export type MaybePromise<T> = T | Promise<T>;
171
+
172
+ export interface Prerendered {
173
+ pages: Map<
174
+ string,
175
+ {
176
+ /** The location of the .html file relative to the output directory */
177
+ file: string;
178
+ }
179
+ >;
180
+ assets: Map<
181
+ string,
182
+ {
183
+ /** The MIME type of the asset */
184
+ type: string;
185
+ }
186
+ >;
187
+ redirects: Map<
188
+ string,
189
+ {
190
+ status: number;
191
+ location: string;
192
+ }
193
+ >;
194
+ /** An array of prerendered paths (without trailing slashes, regardless of the trailingSlash config) */
195
+ paths: string[];
196
+ }
197
+
198
+ export interface PrerenderErrorHandler {
199
+ (details: {
200
+ status: number;
201
+ path: string;
202
+ referrer: string | null;
203
+ referenceType: 'linked' | 'fetched';
204
+ }): void;
205
+ }
206
+
207
+ export type PrerenderOnErrorValue = 'fail' | 'continue' | PrerenderErrorHandler;
208
+
209
+ export interface RequestOptions {
210
+ getClientAddress: () => string;
211
+ platform?: App.Platform;
212
+ }
213
+
214
+ /** `string[]` is only for set-cookie, everything else must be type of `string` */
215
+ export type ResponseHeaders = Record<string, string | number | string[]>;
216
+
217
+ export interface RouteDefinition {
218
+ id: string;
219
+ type: 'page' | 'endpoint';
220
+ pattern: RegExp;
221
+ segments: RouteSegment[];
222
+ methods: HttpMethod[];
223
+ }
224
+
225
+ export interface RouteSegment {
226
+ content: string;
227
+ dynamic: boolean;
228
+ rest: boolean;
229
+ }
230
+
231
+ export interface ToJSON {
232
+ toJSON(...args: any[]): Exclude<JSONValue, ToJSON>;
233
+ }
234
+
235
+ export type TrailingSlash = 'never' | 'always' | 'ignore';
package/CHANGELOG.md DELETED
@@ -1,411 +0,0 @@
1
- # @sveltejs/kit
2
-
3
- ## 1.0.0-next.40
4
-
5
- ### Patch Changes
6
-
7
- - 4c5fd3c: Include layout/error styles in SSR
8
-
9
- ## 1.0.0-next.39
10
-
11
- ### Patch Changes
12
-
13
- - b7fdb0d: Skip pre-bundling
14
-
15
- ## 1.0.0-next.38
16
-
17
- ### Patch Changes
18
-
19
- - 15402b1: Add service worker support
20
- - 0c630b5: Ignore dynamically imported components when constructing styles in dev mode
21
- - ac06af5: Fix svelte-kit adapt for Windows
22
- - 061fa46: Implement improved redirect API
23
- - b800049: Include type declarations
24
- - 07c6de4: Use posix paths in manifest even on Windows
25
- - 27ba872: Error if preload function exists
26
- - 0c630b5: Add default paths in case singletons module is invalidated
27
- - 73dd998: Allow custom extensions
28
-
29
- ## 1.0.0-next.37
30
-
31
- ### Patch Changes
32
-
33
- - 230c6d9: Indicate which request failed, if fetch fails inside load function
34
- - f1bc218: Run adapt via svelte-kit build
35
- - 6850ddc: Fix svelte-kit start for Windows
36
-
37
- ## 1.0.0-next.36
38
-
39
- ### Patch Changes
40
-
41
- - 7b70a33: Force version bump so that Kit uses updated vite-plugin-svelte
42
-
43
- ## 1.0.0-next.35
44
-
45
- ### Patch Changes
46
-
47
- - Use Vite
48
- - Fix Windows issues
49
- - Preserve load context during navigation
50
- - Return error from load
51
-
52
- ## 1.0.0-next.34
53
-
54
- ### Patch Changes
55
-
56
- - Fix adapters and convert to ES modules
57
-
58
- ## 1.0.0-next.33
59
-
60
- ### Patch Changes
61
-
62
- - 474070e: Better errors when modules cannot be found
63
-
64
- ## 1.0.0-next.32
65
-
66
- ### Patch Changes
67
-
68
- - Convert everything to ESM
69
-
70
- ## 1.0.0-next.31
71
-
72
- ### Patch Changes
73
-
74
- - b6c2434: app.js -> app.cjs
75
-
76
- ## 1.0.0-next.30
77
-
78
- ### Patch Changes
79
-
80
- - 00cbaf6: Rename _.config.js to _.config.cjs
81
-
82
- ## 1.0.0-next.29
83
-
84
- ### Patch Changes
85
-
86
- - 4c0edce: Use addEventListener instead of onload
87
-
88
- ## 1.0.0-next.28
89
-
90
- ### Patch Changes
91
-
92
- - 4353025: Prevent infinite loop when fetching bad URLs inside error responses
93
- - 2860065: Handle assets path when prerendering
94
-
95
- ## 1.0.0-next.27
96
-
97
- ### Patch Changes
98
-
99
- - Fail build if prerender errors
100
- - Hide logging behind --verbose option
101
-
102
- ## 1.0.0-next.26
103
-
104
- ### Patch Changes
105
-
106
- - Fix svelte-announcer CSS
107
-
108
- ## 1.0.0-next.25
109
-
110
- ### Patch Changes
111
-
112
- - Surface stack traces for endpoint/page rendering errors
113
-
114
- ## 1.0.0-next.24
115
-
116
- ### Patch Changes
117
-
118
- - 26643df: Account for config.paths when prerendering
119
-
120
- ## 1.0.0-next.23
121
-
122
- ### Patch Changes
123
-
124
- - 9b758aa: Upgrade to Snowpack 3
125
-
126
- ## 1.0.0-next.22
127
-
128
- ### Patch Changes
129
-
130
- - bb68595: use readFileSync instead of createReadStream
131
-
132
- ## 1.0.0-next.21
133
-
134
- ### Patch Changes
135
-
136
- - 217e4cc: Set paths to empty string before prerender
137
-
138
- ## 1.0.0-next.20
139
-
140
- ### Patch Changes
141
-
142
- - ccf4aa7: Implement prerender config
143
-
144
- ## 1.0.0-next.19
145
-
146
- ### Patch Changes
147
-
148
- - deda984: Make navigating store contain from and to properties
149
-
150
- ## 1.0.0-next.18
151
-
152
- ### Patch Changes
153
-
154
- - c29b61e: Announce page changes
155
- - 72da270: Reset focus properly
156
-
157
- ## 1.0.0-next.17
158
-
159
- ### Patch Changes
160
-
161
- - f7dea55: Set process.env.NODE_ENV when invoking via the CLI
162
-
163
- ## 1.0.0-next.16
164
-
165
- ### Patch Changes
166
-
167
- - Remove temporary logging
168
- - Add sveltekit:prefetch and sveltekit:noscroll
169
-
170
- ## 1.0.0-next.15
171
-
172
- ### Patch Changes
173
-
174
- - 6d1bb11: Fix AMP CSS
175
- - d8b53af: Ignore $layout and $error files when finding static paths
176
- - Better scroll tracking
177
-
178
- ## 1.0.0-next.14
179
-
180
- ### Patch Changes
181
-
182
- - Fix dev loader
183
-
184
- ## 1.0.0-next.13
185
-
186
- ### Patch Changes
187
-
188
- - 1ea4d6b: More robust CSS extraction
189
-
190
- ## 1.0.0-next.12
191
-
192
- ### Patch Changes
193
-
194
- - e7c88dd: Tweak AMP validation screen
195
-
196
- ## 1.0.0-next.11
197
-
198
- ### Patch Changes
199
-
200
- - a31f218: Fix SSR loader invalidation
201
-
202
- ## 1.0.0-next.10
203
-
204
- ### Patch Changes
205
-
206
- - 8b14d29: Omit svelte-data scripts from AMP pages
207
-
208
- ## 1.0.0-next.9
209
-
210
- ### Patch Changes
211
-
212
- - f5fa223: AMP support
213
- - 47f2ee1: Always remove trailing slashes
214
- - 1becb94: Replace preload with load
215
-
216
- ## 1.0.0-next.8
217
-
218
- ### Patch Changes
219
-
220
- - 15dd751: Use meta http-equiv=refresh
221
- - be7e031: Fix handling of static files
222
- - ed6b8fd: Implement \$app/env
223
-
224
- ## 1.0.0-next.7
225
-
226
- ### Patch Changes
227
-
228
- - 76705b0: make HMR work outside localhost
229
-
230
- ## 1.0.0-next.6
231
-
232
- ### Patch Changes
233
-
234
- - 0e45255: Move options behind kit namespace, change paths -> kit.files
235
- - fa7f2b2: Implement live bindings for SSR code
236
-
237
- ## 1.0.0-next.5
238
-
239
- ### Patch Changes
240
-
241
- - Return dependencies from render
242
-
243
- ## 1.0.0-next.4
244
-
245
- ### Patch Changes
246
-
247
- - af01b0d: Move renderer out of app assets folder
248
-
249
- ## 1.0.0-next.3
250
-
251
- ### Patch Changes
252
-
253
- - Add paths to manifest, for static prerendering
254
-
255
- ## 1.0.0-next.2
256
-
257
- ### Patch Changes
258
-
259
- - Fix typo causing misnamed assets folder
260
-
261
- ## 1.0.0-next.1
262
-
263
- ### Patch Changes
264
-
265
- - a4bc090: Transform exported functions correctly
266
- - 00bbf98: Fix nested layouts
267
-
268
- ## 0.0.31-next.0
269
-
270
- ### Patch Changes
271
-
272
- - ffd7bba: Fix SSR cache invalidation
273
-
274
- ## 0.0.30
275
-
276
- ### Patch Changes
277
-
278
- - Add back stores(), but with deprecation warning
279
- - Rename stores.preloading to stores.navigating
280
- - Rewrite routing logic
281
-
282
- ## 0.0.29
283
-
284
- ### Patch Changes
285
-
286
- - 10872cc: Normalize request.query
287
-
288
- ## 0.0.28
289
-
290
- ### Patch Changes
291
-
292
- - Add svelte-kit start command
293
-
294
- ## 0.0.27
295
-
296
- ### Patch Changes
297
-
298
- - rename CLI to svelte-kit
299
- - 0904e22: rename svelte CLI to svelte-kit
300
- - Validate route responses
301
- - Make paths and target configurable
302
-
303
- ## 0.0.26
304
-
305
- ### Patch Changes
306
-
307
- - b475ed4: Overhaul adapter API - fixes #166
308
- - Updated dependencies [b475ed4]
309
- - @sveltejs/app-utils@0.0.18
310
-
311
- ## 0.0.25
312
-
313
- ### Patch Changes
314
-
315
- - Updated dependencies [3bdf33b]
316
- - @sveltejs/app-utils@0.0.17
317
-
318
- ## 0.0.24
319
-
320
- ### Patch Changes
321
-
322
- - 67eaeea: Move app-utils stuff into subpackages
323
- - 7f8df30: Move kit runtime code, expose via \$app aliases
324
- - Updated dependencies [67eaeea]
325
- - @sveltejs/app-utils@0.0.16
326
-
327
- ## 0.0.23
328
-
329
- ### Patch Changes
330
-
331
- - a163000: Parse body on incoming requests
332
- - a346eab: Copy over latest Sapper router code
333
- - Updated dependencies [a163000]
334
- - @sveltejs/app-utils@0.0.15
335
-
336
- ## 0.0.22
337
-
338
- ### Patch Changes
339
-
340
- - Force bump version
341
-
342
- ## 0.0.21
343
-
344
- ### Patch Changes
345
-
346
- - Build setup entry point
347
- - Work around pkg.exports constraint
348
- - Respond with 500s if render fails
349
- - Updated dependencies [undefined]
350
- - Updated dependencies [undefined]
351
- - Updated dependencies [undefined]
352
- - @sveltejs/app-utils@0.0.14
353
-
354
- ## 0.0.20
355
-
356
- ### Patch Changes
357
-
358
- - Pass setup module to renderer
359
- - Bump Snowpack version
360
- - Updated dependencies [undefined]
361
- - Updated dependencies [96c06d8]
362
- - @sveltejs/app-utils@0.0.13
363
-
364
- ## 0.0.19
365
-
366
- ### Patch Changes
367
-
368
- - fa9d7ce: Handle import.meta in SSR module loader
369
- - 0320208: Rename 'server route' to 'endpoint'
370
- - b9444d2: Update to Snowpack 2.15
371
- - 5ca907c: Use shared mkdirp helper
372
- - Updated dependencies [0320208]
373
- - Updated dependencies [5ca907c]
374
- - @sveltejs/app-utils@0.0.12
375
-
376
- ## 0.0.18
377
-
378
- ### Patch Changes
379
-
380
- - Updated dependencies [undefined]
381
- - @sveltejs/app-utils@0.0.11
382
-
383
- ## 0.0.17
384
-
385
- ### Patch Changes
386
-
387
- - 19323e9: Update Snowpack
388
- - Updated dependencies [19323e9]
389
- - @sveltejs/app-utils@0.0.10
390
-
391
- ## 0.0.16
392
-
393
- ### Patch Changes
394
-
395
- - Updated dependencies [90a98ae]
396
- - @sveltejs/app-utils@0.0.9
397
-
398
- ## 0.0.15
399
-
400
- ### Patch Changes
401
-
402
- - Updated dependencies [undefined]
403
- - @sveltejs/app-utils@0.0.8
404
-
405
- ## 0.0.14
406
-
407
- ### Patch Changes
408
-
409
- - various
410
- - Updated dependencies [undefined]
411
- - @sveltejs/app-utils@0.0.7
@@ -1,5 +0,0 @@
1
- const browser = !import.meta.env.SSR;
2
- const dev = !!import.meta.env.DEV;
3
- const amp = !!import.meta.env.VITE_SVELTEKIT_AMP;
4
-
5
- export { amp, browser, dev };
@@ -1,41 +0,0 @@
1
- import { router, renderer } from '../internal/singletons.js';
2
- import { g as get_base_uri } from '../chunks/utils.js';
3
-
4
- function guard(name) {
5
- return () => {
6
- throw new Error(`Cannot call ${name}(...) on the server`);
7
- };
8
- }
9
-
10
- const goto = import.meta.env.SSR ? guard('goto') : goto_;
11
- const prefetch = import.meta.env.SSR ? guard('prefetch') : prefetch_;
12
- const prefetchRoutes = import.meta.env.SSR ? guard('prefetchRoutes') : prefetchRoutes_;
13
-
14
- /**
15
- * @param {string} href
16
- * @param {{
17
- * noscroll?: boolean;
18
- * resplaceState?: boolean;
19
- * }} [opts]
20
- */
21
- async function goto_(href, opts) {
22
- return router.goto(href, opts, []);
23
- }
24
-
25
- /** @param {string} href */
26
- function prefetch_(href) {
27
- return renderer.prefetch(new URL(href, get_base_uri(document)));
28
- }
29
-
30
- /** @param {string[]} [pathnames] */
31
- async function prefetchRoutes_(pathnames) {
32
- const path_routes = pathnames
33
- ? router.pages.filter((page) => pathnames.some((pathname) => page.pattern.test(pathname)))
34
- : router.pages;
35
-
36
- const promises = path_routes.map((r) => Promise.all(r.parts.map((load) => load())));
37
-
38
- await Promise.all(promises);
39
- }
40
-
41
- export { goto, prefetch, prefetchRoutes };
@@ -1 +0,0 @@
1
- export { a as assets, b as base } from '../chunks/paths.js';
@@ -1,19 +0,0 @@
1
- /** @param {Node} node */
2
- function find_anchor(node) {
3
- while (node && node.nodeName.toUpperCase() !== 'A') node = node.parentNode; // SVG <a> elements have a lowercase name
4
- return node;
5
- }
6
-
7
- /** @param {HTMLDocument} doc */
8
- function get_base_uri(doc) {
9
- let baseURI = doc.baseURI;
10
-
11
- if (!baseURI) {
12
- const baseTags = doc.getElementsByTagName('base');
13
- baseURI = baseTags.length ? baseTags[0].href : doc.URL;
14
- }
15
-
16
- return baseURI;
17
- }
18
-
19
- export { find_anchor as f, get_base_uri as g };