@sveltejs/kit 1.0.0-next.52 → 1.0.0-next.520

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 (128) hide show
  1. package/README.md +6 -3
  2. package/package.json +93 -67
  3. package/postinstall.js +47 -0
  4. package/scripts/special-types/$env+dynamic+private.md +10 -0
  5. package/scripts/special-types/$env+dynamic+public.md +8 -0
  6. package/scripts/special-types/$env+static+private.md +19 -0
  7. package/scripts/special-types/$env+static+public.md +7 -0
  8. package/scripts/special-types/$lib.md +5 -0
  9. package/src/cli.js +108 -0
  10. package/src/constants.js +7 -0
  11. package/src/core/adapt/builder.js +215 -0
  12. package/src/core/adapt/index.js +31 -0
  13. package/src/core/config/default-error.html +56 -0
  14. package/src/core/config/index.js +110 -0
  15. package/src/core/config/options.js +504 -0
  16. package/src/core/config/types.d.ts +1 -0
  17. package/src/core/env.js +121 -0
  18. package/src/core/generate_manifest/index.js +94 -0
  19. package/src/core/prerender/crawl.js +198 -0
  20. package/src/core/prerender/entities.js +2252 -0
  21. package/src/core/prerender/prerender.js +458 -0
  22. package/src/core/prerender/queue.js +80 -0
  23. package/src/core/sync/create_manifest_data/conflict.js +0 -0
  24. package/src/core/sync/create_manifest_data/index.js +470 -0
  25. package/src/core/sync/create_manifest_data/sort.js +163 -0
  26. package/src/core/sync/create_manifest_data/types.d.ts +37 -0
  27. package/src/core/sync/sync.js +78 -0
  28. package/src/core/sync/utils.js +33 -0
  29. package/src/core/sync/write_ambient.js +53 -0
  30. package/src/core/sync/write_client_manifest.js +106 -0
  31. package/src/core/sync/write_matchers.js +25 -0
  32. package/src/core/sync/write_root.js +91 -0
  33. package/src/core/sync/write_tsconfig.js +195 -0
  34. package/src/core/sync/write_types/index.js +783 -0
  35. package/src/core/utils.js +70 -0
  36. package/src/exports/hooks/index.js +1 -0
  37. package/src/exports/hooks/sequence.js +44 -0
  38. package/src/exports/index.js +45 -0
  39. package/src/exports/node/index.js +161 -0
  40. package/src/exports/node/polyfills.js +28 -0
  41. package/src/exports/vite/build/build_server.js +378 -0
  42. package/src/exports/vite/build/build_service_worker.js +91 -0
  43. package/src/exports/vite/build/utils.js +181 -0
  44. package/src/exports/vite/dev/index.js +581 -0
  45. package/src/exports/vite/graph_analysis/index.js +277 -0
  46. package/src/exports/vite/graph_analysis/types.d.ts +5 -0
  47. package/src/exports/vite/graph_analysis/utils.js +30 -0
  48. package/src/exports/vite/index.js +603 -0
  49. package/src/exports/vite/preview/index.js +189 -0
  50. package/src/exports/vite/types.d.ts +3 -0
  51. package/src/exports/vite/utils.js +157 -0
  52. package/src/runtime/app/env.js +1 -0
  53. package/src/runtime/app/environment.js +11 -0
  54. package/src/runtime/app/forms.js +123 -0
  55. package/src/runtime/app/navigation.js +23 -0
  56. package/src/runtime/app/paths.js +1 -0
  57. package/src/runtime/app/stores.js +102 -0
  58. package/src/runtime/client/ambient.d.ts +30 -0
  59. package/src/runtime/client/client.js +1595 -0
  60. package/src/runtime/client/fetcher.js +107 -0
  61. package/src/runtime/client/parse.js +60 -0
  62. package/src/runtime/client/singletons.js +21 -0
  63. package/src/runtime/client/start.js +37 -0
  64. package/src/runtime/client/types.d.ts +84 -0
  65. package/src/runtime/client/utils.js +159 -0
  66. package/src/runtime/components/error.svelte +16 -0
  67. package/{assets → src/runtime}/components/layout.svelte +0 -0
  68. package/src/runtime/control.js +98 -0
  69. package/src/runtime/env/dynamic/private.js +1 -0
  70. package/src/runtime/env/dynamic/public.js +1 -0
  71. package/src/runtime/env-private.js +6 -0
  72. package/src/runtime/env-public.js +6 -0
  73. package/src/runtime/env.js +6 -0
  74. package/src/runtime/hash.js +20 -0
  75. package/src/runtime/paths.js +11 -0
  76. package/src/runtime/server/cookie.js +166 -0
  77. package/src/runtime/server/data/index.js +131 -0
  78. package/src/runtime/server/endpoint.js +92 -0
  79. package/src/runtime/server/fetch.js +174 -0
  80. package/src/runtime/server/index.js +355 -0
  81. package/src/runtime/server/page/actions.js +256 -0
  82. package/src/runtime/server/page/crypto.js +239 -0
  83. package/src/runtime/server/page/csp.js +250 -0
  84. package/src/runtime/server/page/index.js +304 -0
  85. package/src/runtime/server/page/load_data.js +215 -0
  86. package/src/runtime/server/page/render.js +346 -0
  87. package/src/runtime/server/page/respond_with_error.js +102 -0
  88. package/src/runtime/server/page/serialize_data.js +87 -0
  89. package/src/runtime/server/page/types.d.ts +35 -0
  90. package/src/runtime/server/utils.js +181 -0
  91. package/src/utils/array.js +9 -0
  92. package/src/utils/error.js +22 -0
  93. package/src/utils/escape.js +46 -0
  94. package/src/utils/filesystem.js +142 -0
  95. package/src/utils/functions.js +16 -0
  96. package/src/utils/http.js +72 -0
  97. package/src/utils/misc.js +1 -0
  98. package/src/utils/promises.js +17 -0
  99. package/src/utils/routing.js +130 -0
  100. package/src/utils/unit_test.js +11 -0
  101. package/src/utils/url.js +144 -0
  102. package/svelte-kit.js +1 -1
  103. package/types/ambient.d.ts +431 -0
  104. package/types/index.d.ts +477 -0
  105. package/types/internal.d.ts +380 -0
  106. package/types/private.d.ts +224 -0
  107. package/CHANGELOG.md +0 -496
  108. package/assets/components/error.svelte +0 -13
  109. package/assets/runtime/app/env.js +0 -5
  110. package/assets/runtime/app/navigation.js +0 -44
  111. package/assets/runtime/app/paths.js +0 -1
  112. package/assets/runtime/app/stores.js +0 -93
  113. package/assets/runtime/chunks/utils.js +0 -22
  114. package/assets/runtime/internal/singletons.js +0 -23
  115. package/assets/runtime/internal/start.js +0 -776
  116. package/assets/runtime/paths.js +0 -12
  117. package/dist/chunks/index.js +0 -3537
  118. package/dist/chunks/index2.js +0 -587
  119. package/dist/chunks/index3.js +0 -246
  120. package/dist/chunks/index4.js +0 -568
  121. package/dist/chunks/index5.js +0 -763
  122. package/dist/chunks/index6.js +0 -323
  123. package/dist/chunks/standard.js +0 -99
  124. package/dist/chunks/utils.js +0 -83
  125. package/dist/cli.js +0 -555
  126. package/dist/ssr.js +0 -2604
  127. package/types.d.ts +0 -73
  128. package/types.internal.d.ts +0 -222
package/CHANGELOG.md DELETED
@@ -1,496 +0,0 @@
1
- # @sveltejs/kit
2
-
3
- ## 1.0.0-next.52
4
-
5
- ### Patch Changes
6
-
7
- - ac3669e: Move Vite config into svelte.config.cjs
8
-
9
- ## 1.0.0-next.51
10
-
11
- ### Patch Changes
12
-
13
- - 34a00f9: Bypass router on hydration
14
-
15
- ## 1.0.0-next.50
16
-
17
- ### Patch Changes
18
-
19
- - 0512fd1: Remove startGlobal option
20
- - 9212aa5: Add options to adapter-node, and add adapter types
21
- - 0512fd1: Fire custom events for start, and navigation start/end
22
-
23
- ## 1.0.0-next.49
24
-
25
- ### Patch Changes
26
-
27
- - ab28c0a: kit: include missing types.d.ts
28
- - c76c9bf: Upgrade Vite
29
-
30
- ## 1.0.0-next.48
31
-
32
- ### Patch Changes
33
-
34
- - e37a302: Make getSession future-proof
35
-
36
- ## 1.0.0-next.47
37
-
38
- ### Patch Changes
39
-
40
- - 5554acc: Add \$lib alias
41
- - 5cd6f11: bump vite-plugin-svelte to 0.11.0
42
-
43
- ## 1.0.0-next.46
44
-
45
- ### Patch Changes
46
-
47
- - f35a5cd: Change adapter signature
48
-
49
- ## 1.0.0-next.45
50
-
51
- ### Minor Changes
52
-
53
- - 925638a: Remove endpoints from the files built for the client
54
-
55
- ### Patch Changes
56
-
57
- - c3cf3f3: Bump deps
58
- - 625747d: kit: bundle @sveltejs/kit into built application
59
- - Updated dependencies [c3cf3f3]
60
- - @sveltejs/vite-plugin-svelte@1.0.0-next.3
61
-
62
- ## 1.0.0-next.44
63
-
64
- ### Patch Changes
65
-
66
- - e6449d2: Fix AMP styles for real
67
-
68
- ## 1.0.0-next.43
69
-
70
- ### Patch Changes
71
-
72
- - 672e9be: Fix AMP styles, again
73
-
74
- ## 1.0.0-next.42
75
-
76
- ### Patch Changes
77
-
78
- - 0f54ebc: Fix AMP styles
79
-
80
- ## 1.0.0-next.41
81
-
82
- ### Patch Changes
83
-
84
- - 4aa5a73: Future-proof prepare argument
85
- - 58dc400: Call correct set_paths function
86
- - 2322291: Update to node-fetch@3
87
-
88
- ## 1.0.0-next.40
89
-
90
- ### Patch Changes
91
-
92
- - 4c5fd3c: Include layout/error styles in SSR
93
-
94
- ## 1.0.0-next.39
95
-
96
- ### Patch Changes
97
-
98
- - b7fdb0d: Skip pre-bundling
99
-
100
- ## 1.0.0-next.38
101
-
102
- ### Patch Changes
103
-
104
- - 15402b1: Add service worker support
105
- - 0c630b5: Ignore dynamically imported components when constructing styles in dev mode
106
- - ac06af5: Fix svelte-kit adapt for Windows
107
- - 061fa46: Implement improved redirect API
108
- - b800049: Include type declarations
109
- - 07c6de4: Use posix paths in manifest even on Windows
110
- - 27ba872: Error if preload function exists
111
- - 0c630b5: Add default paths in case singletons module is invalidated
112
- - 73dd998: Allow custom extensions
113
-
114
- ## 1.0.0-next.37
115
-
116
- ### Patch Changes
117
-
118
- - 230c6d9: Indicate which request failed, if fetch fails inside load function
119
- - f1bc218: Run adapt via svelte-kit build
120
- - 6850ddc: Fix svelte-kit start for Windows
121
-
122
- ## 1.0.0-next.36
123
-
124
- ### Patch Changes
125
-
126
- - 7b70a33: Force version bump so that Kit uses updated vite-plugin-svelte
127
-
128
- ## 1.0.0-next.35
129
-
130
- ### Patch Changes
131
-
132
- - Use Vite
133
- - Fix Windows issues
134
- - Preserve load context during navigation
135
- - Return error from load
136
-
137
- ## 1.0.0-next.34
138
-
139
- ### Patch Changes
140
-
141
- - Fix adapters and convert to ES modules
142
-
143
- ## 1.0.0-next.33
144
-
145
- ### Patch Changes
146
-
147
- - 474070e: Better errors when modules cannot be found
148
-
149
- ## 1.0.0-next.32
150
-
151
- ### Patch Changes
152
-
153
- - Convert everything to ESM
154
-
155
- ## 1.0.0-next.31
156
-
157
- ### Patch Changes
158
-
159
- - b6c2434: app.js -> app.cjs
160
-
161
- ## 1.0.0-next.30
162
-
163
- ### Patch Changes
164
-
165
- - 00cbaf6: Rename _.config.js to _.config.cjs
166
-
167
- ## 1.0.0-next.29
168
-
169
- ### Patch Changes
170
-
171
- - 4c0edce: Use addEventListener instead of onload
172
-
173
- ## 1.0.0-next.28
174
-
175
- ### Patch Changes
176
-
177
- - 4353025: Prevent infinite loop when fetching bad URLs inside error responses
178
- - 2860065: Handle assets path when prerendering
179
-
180
- ## 1.0.0-next.27
181
-
182
- ### Patch Changes
183
-
184
- - Fail build if prerender errors
185
- - Hide logging behind --verbose option
186
-
187
- ## 1.0.0-next.26
188
-
189
- ### Patch Changes
190
-
191
- - Fix svelte-announcer CSS
192
-
193
- ## 1.0.0-next.25
194
-
195
- ### Patch Changes
196
-
197
- - Surface stack traces for endpoint/page rendering errors
198
-
199
- ## 1.0.0-next.24
200
-
201
- ### Patch Changes
202
-
203
- - 26643df: Account for config.paths when prerendering
204
-
205
- ## 1.0.0-next.23
206
-
207
- ### Patch Changes
208
-
209
- - 9b758aa: Upgrade to Snowpack 3
210
-
211
- ## 1.0.0-next.22
212
-
213
- ### Patch Changes
214
-
215
- - bb68595: use readFileSync instead of createReadStream
216
-
217
- ## 1.0.0-next.21
218
-
219
- ### Patch Changes
220
-
221
- - 217e4cc: Set paths to empty string before prerender
222
-
223
- ## 1.0.0-next.20
224
-
225
- ### Patch Changes
226
-
227
- - ccf4aa7: Implement prerender config
228
-
229
- ## 1.0.0-next.19
230
-
231
- ### Patch Changes
232
-
233
- - deda984: Make navigating store contain from and to properties
234
-
235
- ## 1.0.0-next.18
236
-
237
- ### Patch Changes
238
-
239
- - c29b61e: Announce page changes
240
- - 72da270: Reset focus properly
241
-
242
- ## 1.0.0-next.17
243
-
244
- ### Patch Changes
245
-
246
- - f7dea55: Set process.env.NODE_ENV when invoking via the CLI
247
-
248
- ## 1.0.0-next.16
249
-
250
- ### Patch Changes
251
-
252
- - Remove temporary logging
253
- - Add sveltekit:prefetch and sveltekit:noscroll
254
-
255
- ## 1.0.0-next.15
256
-
257
- ### Patch Changes
258
-
259
- - 6d1bb11: Fix AMP CSS
260
- - d8b53af: Ignore $layout and $error files when finding static paths
261
- - Better scroll tracking
262
-
263
- ## 1.0.0-next.14
264
-
265
- ### Patch Changes
266
-
267
- - Fix dev loader
268
-
269
- ## 1.0.0-next.13
270
-
271
- ### Patch Changes
272
-
273
- - 1ea4d6b: More robust CSS extraction
274
-
275
- ## 1.0.0-next.12
276
-
277
- ### Patch Changes
278
-
279
- - e7c88dd: Tweak AMP validation screen
280
-
281
- ## 1.0.0-next.11
282
-
283
- ### Patch Changes
284
-
285
- - a31f218: Fix SSR loader invalidation
286
-
287
- ## 1.0.0-next.10
288
-
289
- ### Patch Changes
290
-
291
- - 8b14d29: Omit svelte-data scripts from AMP pages
292
-
293
- ## 1.0.0-next.9
294
-
295
- ### Patch Changes
296
-
297
- - f5fa223: AMP support
298
- - 47f2ee1: Always remove trailing slashes
299
- - 1becb94: Replace preload with load
300
-
301
- ## 1.0.0-next.8
302
-
303
- ### Patch Changes
304
-
305
- - 15dd751: Use meta http-equiv=refresh
306
- - be7e031: Fix handling of static files
307
- - ed6b8fd: Implement \$app/env
308
-
309
- ## 1.0.0-next.7
310
-
311
- ### Patch Changes
312
-
313
- - 76705b0: make HMR work outside localhost
314
-
315
- ## 1.0.0-next.6
316
-
317
- ### Patch Changes
318
-
319
- - 0e45255: Move options behind kit namespace, change paths -> kit.files
320
- - fa7f2b2: Implement live bindings for SSR code
321
-
322
- ## 1.0.0-next.5
323
-
324
- ### Patch Changes
325
-
326
- - Return dependencies from render
327
-
328
- ## 1.0.0-next.4
329
-
330
- ### Patch Changes
331
-
332
- - af01b0d: Move renderer out of app assets folder
333
-
334
- ## 1.0.0-next.3
335
-
336
- ### Patch Changes
337
-
338
- - Add paths to manifest, for static prerendering
339
-
340
- ## 1.0.0-next.2
341
-
342
- ### Patch Changes
343
-
344
- - Fix typo causing misnamed assets folder
345
-
346
- ## 1.0.0-next.1
347
-
348
- ### Patch Changes
349
-
350
- - a4bc090: Transform exported functions correctly
351
- - 00bbf98: Fix nested layouts
352
-
353
- ## 0.0.31-next.0
354
-
355
- ### Patch Changes
356
-
357
- - ffd7bba: Fix SSR cache invalidation
358
-
359
- ## 0.0.30
360
-
361
- ### Patch Changes
362
-
363
- - Add back stores(), but with deprecation warning
364
- - Rename stores.preloading to stores.navigating
365
- - Rewrite routing logic
366
-
367
- ## 0.0.29
368
-
369
- ### Patch Changes
370
-
371
- - 10872cc: Normalize request.query
372
-
373
- ## 0.0.28
374
-
375
- ### Patch Changes
376
-
377
- - Add svelte-kit start command
378
-
379
- ## 0.0.27
380
-
381
- ### Patch Changes
382
-
383
- - rename CLI to svelte-kit
384
- - 0904e22: rename svelte CLI to svelte-kit
385
- - Validate route responses
386
- - Make paths and target configurable
387
-
388
- ## 0.0.26
389
-
390
- ### Patch Changes
391
-
392
- - b475ed4: Overhaul adapter API - fixes #166
393
- - Updated dependencies [b475ed4]
394
- - @sveltejs/app-utils@0.0.18
395
-
396
- ## 0.0.25
397
-
398
- ### Patch Changes
399
-
400
- - Updated dependencies [3bdf33b]
401
- - @sveltejs/app-utils@0.0.17
402
-
403
- ## 0.0.24
404
-
405
- ### Patch Changes
406
-
407
- - 67eaeea: Move app-utils stuff into subpackages
408
- - 7f8df30: Move kit runtime code, expose via \$app aliases
409
- - Updated dependencies [67eaeea]
410
- - @sveltejs/app-utils@0.0.16
411
-
412
- ## 0.0.23
413
-
414
- ### Patch Changes
415
-
416
- - a163000: Parse body on incoming requests
417
- - a346eab: Copy over latest Sapper router code
418
- - Updated dependencies [a163000]
419
- - @sveltejs/app-utils@0.0.15
420
-
421
- ## 0.0.22
422
-
423
- ### Patch Changes
424
-
425
- - Force bump version
426
-
427
- ## 0.0.21
428
-
429
- ### Patch Changes
430
-
431
- - Build setup entry point
432
- - Work around pkg.exports constraint
433
- - Respond with 500s if render fails
434
- - Updated dependencies [undefined]
435
- - Updated dependencies [undefined]
436
- - Updated dependencies [undefined]
437
- - @sveltejs/app-utils@0.0.14
438
-
439
- ## 0.0.20
440
-
441
- ### Patch Changes
442
-
443
- - Pass setup module to renderer
444
- - Bump Snowpack version
445
- - Updated dependencies [undefined]
446
- - Updated dependencies [96c06d8]
447
- - @sveltejs/app-utils@0.0.13
448
-
449
- ## 0.0.19
450
-
451
- ### Patch Changes
452
-
453
- - fa9d7ce: Handle import.meta in SSR module loader
454
- - 0320208: Rename 'server route' to 'endpoint'
455
- - b9444d2: Update to Snowpack 2.15
456
- - 5ca907c: Use shared mkdirp helper
457
- - Updated dependencies [0320208]
458
- - Updated dependencies [5ca907c]
459
- - @sveltejs/app-utils@0.0.12
460
-
461
- ## 0.0.18
462
-
463
- ### Patch Changes
464
-
465
- - Updated dependencies [undefined]
466
- - @sveltejs/app-utils@0.0.11
467
-
468
- ## 0.0.17
469
-
470
- ### Patch Changes
471
-
472
- - 19323e9: Update Snowpack
473
- - Updated dependencies [19323e9]
474
- - @sveltejs/app-utils@0.0.10
475
-
476
- ## 0.0.16
477
-
478
- ### Patch Changes
479
-
480
- - Updated dependencies [90a98ae]
481
- - @sveltejs/app-utils@0.0.9
482
-
483
- ## 0.0.15
484
-
485
- ### Patch Changes
486
-
487
- - Updated dependencies [undefined]
488
- - @sveltejs/app-utils@0.0.8
489
-
490
- ## 0.0.14
491
-
492
- ### Patch Changes
493
-
494
- - various
495
- - Updated dependencies [undefined]
496
- - @sveltejs/app-utils@0.0.7
@@ -1,13 +0,0 @@
1
- <script>
2
- export let status;
3
- export let error;
4
- </script>
5
-
6
- <h1>{status}</h1>
7
-
8
- <p>{error.message}</p>
9
-
10
- <!-- TODO figure out what to do with stacktraces in prod -->
11
- {#if error.stack}
12
- <pre>{error.stack}</pre>
13
- {/if}
@@ -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,44 +0,0 @@
1
- import { router, renderer } from '../internal/singletons.js';
2
- import { g as get_base_uri } from '../chunks/utils.js';
3
-
4
- /**
5
- * @param {string} name
6
- */
7
- function guard(name) {
8
- return () => {
9
- throw new Error(`Cannot call ${name}(...) on the server`);
10
- };
11
- }
12
-
13
- const goto = import.meta.env.SSR ? guard('goto') : goto_;
14
- const prefetch = import.meta.env.SSR ? guard('prefetch') : prefetch_;
15
- const prefetchRoutes = import.meta.env.SSR ? guard('prefetchRoutes') : prefetchRoutes_;
16
-
17
- /**
18
- * @param {string} href
19
- * @param {{
20
- * noscroll?: boolean;
21
- * resplaceState?: boolean;
22
- * }} [opts]
23
- */
24
- async function goto_(href, opts) {
25
- return router.goto(href, opts, []);
26
- }
27
-
28
- /** @param {string} href */
29
- function prefetch_(href) {
30
- return renderer.prefetch(new URL(href, get_base_uri(document)));
31
- }
32
-
33
- /** @param {string[]} [pathnames] */
34
- async function prefetchRoutes_(pathnames) {
35
- const path_routes = pathnames
36
- ? router.pages.filter((page) => pathnames.some((pathname) => page.pattern.test(pathname)))
37
- : router.pages;
38
-
39
- const promises = path_routes.map((r) => Promise.all(r.parts.map((load) => load())));
40
-
41
- await Promise.all(promises);
42
- }
43
-
44
- export { goto, prefetch, prefetchRoutes };
@@ -1 +0,0 @@
1
- export { assets, base } from '../paths.js';
@@ -1,93 +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
- /** @typedef {import('svelte/store').Readable<{
17
- * host: string;
18
- * path: string;
19
- * query: URLSearchParams;
20
- * params: Record<string, string>
21
- * }>} PageStore */
22
-
23
- const getStores = () => {
24
- const stores = getContext('__svelte__');
25
-
26
- return {
27
- /** @type {PageStore} */
28
- page: {
29
- subscribe: stores.page.subscribe
30
- },
31
- /** @type {import('svelte/store').Readable<boolean>} */
32
- navigating: {
33
- subscribe: stores.navigating.subscribe
34
- },
35
- get preloading() {
36
- console.error('stores.preloading is deprecated; use stores.navigating instead');
37
- return {
38
- subscribe: stores.navigating.subscribe
39
- };
40
- },
41
- /** @type {import('svelte/store').Writable<any>} */
42
- session: stores.session
43
- };
44
- };
45
-
46
- /** @type {PageStore} */
47
- const page = {
48
- /** @param {(value: any) => void} fn */
49
- subscribe(fn) {
50
- const store = getStores().page;
51
- return store.subscribe(fn);
52
- }
53
- };
54
-
55
- /** @type {import('svelte/store').Readable<boolean>} */
56
- const navigating = {
57
- /** @param {(value: any) => void} fn */
58
- subscribe(fn) {
59
- const store = getStores().navigating;
60
- return store.subscribe(fn);
61
- }
62
- };
63
-
64
- /** @param {string} verb */
65
- const error = (verb) => {
66
- throw new Error(
67
- ssr
68
- ? `Can only ${verb} session store in browser`
69
- : `Cannot ${verb} session store before subscribing`
70
- );
71
- };
72
-
73
- /** @type {import('svelte/store').Writable<any>} */
74
- const session = {
75
- subscribe(fn) {
76
- const store = getStores().session;
77
-
78
- if (!ssr) {
79
- session.set = store.set;
80
- session.update = store.update;
81
- }
82
-
83
- return store.subscribe(fn);
84
- },
85
- set: (value) => {
86
- error('set');
87
- },
88
- update: (updater) => {
89
- error('update');
90
- }
91
- };
92
-
93
- export { getStores, navigating, page, session, stores };
@@ -1,22 +0,0 @@
1
- /**
2
- * @param {Node} node
3
- * @returns {HTMLAnchorElement | SVGAElement}
4
- */
5
- function find_anchor(node) {
6
- while (node && node.nodeName.toUpperCase() !== 'A') node = node.parentNode; // SVG <a> elements have a lowercase name
7
- return /** @type {HTMLAnchorElement | SVGAElement} */ (node);
8
- }
9
-
10
- /** @param {HTMLDocument} doc */
11
- function get_base_uri(doc) {
12
- let baseURI = doc.baseURI;
13
-
14
- if (!baseURI) {
15
- const baseTags = doc.getElementsByTagName('base');
16
- baseURI = baseTags.length ? baseTags[0].href : doc.URL;
17
- }
18
-
19
- return baseURI;
20
- }
21
-
22
- export { find_anchor as f, get_base_uri as g };
@@ -1,23 +0,0 @@
1
- /** @type {import('./router').Router} */
2
- let router;
3
-
4
- /** @type {import('./renderer').Renderer} */
5
- let renderer;
6
-
7
- /** @type {string} */
8
- let base = '';
9
-
10
- /** @type {string} */
11
- let assets = '/.';
12
-
13
- /** @param {any} opts */
14
- function init(opts) {
15
- ({ router, renderer } = opts);
16
- }
17
-
18
- /** @param {{ base: string, assets: string }} paths */
19
- function set_paths(paths) {
20
- ({ base, assets } = paths);
21
- }
22
-
23
- export { assets, base, init, renderer, router, set_paths };