@sveltejs/kit 1.0.0-next.43 → 1.0.0-next.430
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.
- package/README.md +12 -9
- package/package.json +95 -63
- package/src/cli.js +112 -0
- package/src/core/adapt/builder.js +207 -0
- package/src/core/adapt/index.js +19 -0
- package/src/core/config/index.js +86 -0
- package/src/core/config/options.js +488 -0
- package/src/core/config/types.d.ts +1 -0
- package/src/core/constants.js +5 -0
- package/src/core/env.js +97 -0
- package/src/core/generate_manifest/index.js +99 -0
- package/src/core/prerender/crawl.js +194 -0
- package/src/core/prerender/prerender.js +378 -0
- package/src/core/prerender/queue.js +80 -0
- package/src/core/sync/create_manifest_data/index.js +506 -0
- package/src/core/sync/create_manifest_data/types.d.ts +40 -0
- package/src/core/sync/sync.js +59 -0
- package/src/core/sync/utils.js +44 -0
- package/src/core/sync/write_ambient.js +27 -0
- package/src/core/sync/write_client_manifest.js +82 -0
- package/src/core/sync/write_matchers.js +25 -0
- package/src/core/sync/write_root.js +91 -0
- package/src/core/sync/write_tsconfig.js +195 -0
- package/src/core/sync/write_types.js +775 -0
- package/src/core/utils.js +70 -0
- package/src/hooks.js +26 -0
- package/src/index/index.js +45 -0
- package/src/index/private.js +33 -0
- package/src/node/index.js +145 -0
- package/src/node/polyfills.js +40 -0
- package/src/runtime/app/env.js +11 -0
- package/src/runtime/app/navigation.js +22 -0
- package/src/runtime/app/paths.js +1 -0
- package/src/runtime/app/stores.js +102 -0
- package/src/runtime/client/ambient.d.ts +17 -0
- package/src/runtime/client/client.js +1289 -0
- package/src/runtime/client/fetcher.js +60 -0
- package/src/runtime/client/parse.js +36 -0
- package/src/runtime/client/singletons.js +21 -0
- package/src/runtime/client/start.js +46 -0
- package/src/runtime/client/types.d.ts +105 -0
- package/src/runtime/client/utils.js +113 -0
- package/src/runtime/components/error.svelte +16 -0
- package/{assets → src/runtime}/components/layout.svelte +0 -0
- package/src/runtime/env/dynamic/private.js +1 -0
- package/src/runtime/env/dynamic/public.js +1 -0
- package/src/runtime/env-private.js +7 -0
- package/src/runtime/env-public.js +7 -0
- package/src/runtime/env.js +6 -0
- package/src/runtime/hash.js +16 -0
- package/src/runtime/paths.js +11 -0
- package/src/runtime/server/endpoint.js +58 -0
- package/src/runtime/server/index.js +448 -0
- package/src/runtime/server/page/cookie.js +25 -0
- package/src/runtime/server/page/crypto.js +239 -0
- package/src/runtime/server/page/csp.js +249 -0
- package/src/runtime/server/page/fetch.js +266 -0
- package/src/runtime/server/page/index.js +416 -0
- package/src/runtime/server/page/load_data.js +135 -0
- package/src/runtime/server/page/render.js +362 -0
- package/src/runtime/server/page/respond_with_error.js +94 -0
- package/src/runtime/server/page/types.d.ts +44 -0
- package/src/runtime/server/utils.js +116 -0
- package/src/utils/error.js +22 -0
- package/src/utils/escape.js +104 -0
- package/src/utils/filesystem.js +108 -0
- package/src/utils/http.js +55 -0
- package/src/utils/misc.js +1 -0
- package/src/utils/routing.js +108 -0
- package/src/utils/url.js +97 -0
- package/src/vite/build/build_server.js +337 -0
- package/src/vite/build/build_service_worker.js +90 -0
- package/src/vite/build/utils.js +160 -0
- package/src/vite/dev/index.js +551 -0
- package/src/vite/index.js +574 -0
- package/src/vite/preview/index.js +186 -0
- package/src/vite/types.d.ts +3 -0
- package/src/vite/utils.js +345 -0
- package/svelte-kit.js +1 -1
- package/types/ambient.d.ts +357 -0
- package/types/index.d.ts +343 -0
- package/types/internal.d.ts +308 -0
- package/types/private.d.ts +209 -0
- package/CHANGELOG.md +0 -431
- package/assets/components/error.svelte +0 -13
- package/assets/runtime/app/env.js +0 -5
- package/assets/runtime/app/navigation.js +0 -41
- package/assets/runtime/app/paths.js +0 -1
- package/assets/runtime/app/stores.js +0 -93
- package/assets/runtime/chunks/utils.js +0 -19
- package/assets/runtime/internal/singletons.js +0 -23
- package/assets/runtime/internal/start.js +0 -770
- package/assets/runtime/paths.js +0 -12
- package/dist/.DS_Store +0 -0
- package/dist/chunks/index.js +0 -3521
- package/dist/chunks/index2.js +0 -587
- package/dist/chunks/index3.js +0 -246
- package/dist/chunks/index4.js +0 -538
- package/dist/chunks/index5.js +0 -761
- package/dist/chunks/index6.js +0 -322
- package/dist/chunks/standard.js +0 -99
- package/dist/chunks/utils.js +0 -83
- package/dist/cli.js +0 -546
- package/dist/ssr.js +0 -2581
package/CHANGELOG.md
DELETED
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
# @sveltejs/kit
|
|
2
|
-
|
|
3
|
-
## 1.0.0-next.43
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- 672e9be: Fix AMP styles, again
|
|
8
|
-
|
|
9
|
-
## 1.0.0-next.42
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- 0f54ebc: Fix AMP styles
|
|
14
|
-
|
|
15
|
-
## 1.0.0-next.41
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- 4aa5a73: Future-proof prepare argument
|
|
20
|
-
- 58dc400: Call correct set_paths function
|
|
21
|
-
- 2322291: Update to node-fetch@3
|
|
22
|
-
|
|
23
|
-
## 1.0.0-next.40
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- 4c5fd3c: Include layout/error styles in SSR
|
|
28
|
-
|
|
29
|
-
## 1.0.0-next.39
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
- b7fdb0d: Skip pre-bundling
|
|
34
|
-
|
|
35
|
-
## 1.0.0-next.38
|
|
36
|
-
|
|
37
|
-
### Patch Changes
|
|
38
|
-
|
|
39
|
-
- 15402b1: Add service worker support
|
|
40
|
-
- 0c630b5: Ignore dynamically imported components when constructing styles in dev mode
|
|
41
|
-
- ac06af5: Fix svelte-kit adapt for Windows
|
|
42
|
-
- 061fa46: Implement improved redirect API
|
|
43
|
-
- b800049: Include type declarations
|
|
44
|
-
- 07c6de4: Use posix paths in manifest even on Windows
|
|
45
|
-
- 27ba872: Error if preload function exists
|
|
46
|
-
- 0c630b5: Add default paths in case singletons module is invalidated
|
|
47
|
-
- 73dd998: Allow custom extensions
|
|
48
|
-
|
|
49
|
-
## 1.0.0-next.37
|
|
50
|
-
|
|
51
|
-
### Patch Changes
|
|
52
|
-
|
|
53
|
-
- 230c6d9: Indicate which request failed, if fetch fails inside load function
|
|
54
|
-
- f1bc218: Run adapt via svelte-kit build
|
|
55
|
-
- 6850ddc: Fix svelte-kit start for Windows
|
|
56
|
-
|
|
57
|
-
## 1.0.0-next.36
|
|
58
|
-
|
|
59
|
-
### Patch Changes
|
|
60
|
-
|
|
61
|
-
- 7b70a33: Force version bump so that Kit uses updated vite-plugin-svelte
|
|
62
|
-
|
|
63
|
-
## 1.0.0-next.35
|
|
64
|
-
|
|
65
|
-
### Patch Changes
|
|
66
|
-
|
|
67
|
-
- Use Vite
|
|
68
|
-
- Fix Windows issues
|
|
69
|
-
- Preserve load context during navigation
|
|
70
|
-
- Return error from load
|
|
71
|
-
|
|
72
|
-
## 1.0.0-next.34
|
|
73
|
-
|
|
74
|
-
### Patch Changes
|
|
75
|
-
|
|
76
|
-
- Fix adapters and convert to ES modules
|
|
77
|
-
|
|
78
|
-
## 1.0.0-next.33
|
|
79
|
-
|
|
80
|
-
### Patch Changes
|
|
81
|
-
|
|
82
|
-
- 474070e: Better errors when modules cannot be found
|
|
83
|
-
|
|
84
|
-
## 1.0.0-next.32
|
|
85
|
-
|
|
86
|
-
### Patch Changes
|
|
87
|
-
|
|
88
|
-
- Convert everything to ESM
|
|
89
|
-
|
|
90
|
-
## 1.0.0-next.31
|
|
91
|
-
|
|
92
|
-
### Patch Changes
|
|
93
|
-
|
|
94
|
-
- b6c2434: app.js -> app.cjs
|
|
95
|
-
|
|
96
|
-
## 1.0.0-next.30
|
|
97
|
-
|
|
98
|
-
### Patch Changes
|
|
99
|
-
|
|
100
|
-
- 00cbaf6: Rename _.config.js to _.config.cjs
|
|
101
|
-
|
|
102
|
-
## 1.0.0-next.29
|
|
103
|
-
|
|
104
|
-
### Patch Changes
|
|
105
|
-
|
|
106
|
-
- 4c0edce: Use addEventListener instead of onload
|
|
107
|
-
|
|
108
|
-
## 1.0.0-next.28
|
|
109
|
-
|
|
110
|
-
### Patch Changes
|
|
111
|
-
|
|
112
|
-
- 4353025: Prevent infinite loop when fetching bad URLs inside error responses
|
|
113
|
-
- 2860065: Handle assets path when prerendering
|
|
114
|
-
|
|
115
|
-
## 1.0.0-next.27
|
|
116
|
-
|
|
117
|
-
### Patch Changes
|
|
118
|
-
|
|
119
|
-
- Fail build if prerender errors
|
|
120
|
-
- Hide logging behind --verbose option
|
|
121
|
-
|
|
122
|
-
## 1.0.0-next.26
|
|
123
|
-
|
|
124
|
-
### Patch Changes
|
|
125
|
-
|
|
126
|
-
- Fix svelte-announcer CSS
|
|
127
|
-
|
|
128
|
-
## 1.0.0-next.25
|
|
129
|
-
|
|
130
|
-
### Patch Changes
|
|
131
|
-
|
|
132
|
-
- Surface stack traces for endpoint/page rendering errors
|
|
133
|
-
|
|
134
|
-
## 1.0.0-next.24
|
|
135
|
-
|
|
136
|
-
### Patch Changes
|
|
137
|
-
|
|
138
|
-
- 26643df: Account for config.paths when prerendering
|
|
139
|
-
|
|
140
|
-
## 1.0.0-next.23
|
|
141
|
-
|
|
142
|
-
### Patch Changes
|
|
143
|
-
|
|
144
|
-
- 9b758aa: Upgrade to Snowpack 3
|
|
145
|
-
|
|
146
|
-
## 1.0.0-next.22
|
|
147
|
-
|
|
148
|
-
### Patch Changes
|
|
149
|
-
|
|
150
|
-
- bb68595: use readFileSync instead of createReadStream
|
|
151
|
-
|
|
152
|
-
## 1.0.0-next.21
|
|
153
|
-
|
|
154
|
-
### Patch Changes
|
|
155
|
-
|
|
156
|
-
- 217e4cc: Set paths to empty string before prerender
|
|
157
|
-
|
|
158
|
-
## 1.0.0-next.20
|
|
159
|
-
|
|
160
|
-
### Patch Changes
|
|
161
|
-
|
|
162
|
-
- ccf4aa7: Implement prerender config
|
|
163
|
-
|
|
164
|
-
## 1.0.0-next.19
|
|
165
|
-
|
|
166
|
-
### Patch Changes
|
|
167
|
-
|
|
168
|
-
- deda984: Make navigating store contain from and to properties
|
|
169
|
-
|
|
170
|
-
## 1.0.0-next.18
|
|
171
|
-
|
|
172
|
-
### Patch Changes
|
|
173
|
-
|
|
174
|
-
- c29b61e: Announce page changes
|
|
175
|
-
- 72da270: Reset focus properly
|
|
176
|
-
|
|
177
|
-
## 1.0.0-next.17
|
|
178
|
-
|
|
179
|
-
### Patch Changes
|
|
180
|
-
|
|
181
|
-
- f7dea55: Set process.env.NODE_ENV when invoking via the CLI
|
|
182
|
-
|
|
183
|
-
## 1.0.0-next.16
|
|
184
|
-
|
|
185
|
-
### Patch Changes
|
|
186
|
-
|
|
187
|
-
- Remove temporary logging
|
|
188
|
-
- Add sveltekit:prefetch and sveltekit:noscroll
|
|
189
|
-
|
|
190
|
-
## 1.0.0-next.15
|
|
191
|
-
|
|
192
|
-
### Patch Changes
|
|
193
|
-
|
|
194
|
-
- 6d1bb11: Fix AMP CSS
|
|
195
|
-
- d8b53af: Ignore $layout and $error files when finding static paths
|
|
196
|
-
- Better scroll tracking
|
|
197
|
-
|
|
198
|
-
## 1.0.0-next.14
|
|
199
|
-
|
|
200
|
-
### Patch Changes
|
|
201
|
-
|
|
202
|
-
- Fix dev loader
|
|
203
|
-
|
|
204
|
-
## 1.0.0-next.13
|
|
205
|
-
|
|
206
|
-
### Patch Changes
|
|
207
|
-
|
|
208
|
-
- 1ea4d6b: More robust CSS extraction
|
|
209
|
-
|
|
210
|
-
## 1.0.0-next.12
|
|
211
|
-
|
|
212
|
-
### Patch Changes
|
|
213
|
-
|
|
214
|
-
- e7c88dd: Tweak AMP validation screen
|
|
215
|
-
|
|
216
|
-
## 1.0.0-next.11
|
|
217
|
-
|
|
218
|
-
### Patch Changes
|
|
219
|
-
|
|
220
|
-
- a31f218: Fix SSR loader invalidation
|
|
221
|
-
|
|
222
|
-
## 1.0.0-next.10
|
|
223
|
-
|
|
224
|
-
### Patch Changes
|
|
225
|
-
|
|
226
|
-
- 8b14d29: Omit svelte-data scripts from AMP pages
|
|
227
|
-
|
|
228
|
-
## 1.0.0-next.9
|
|
229
|
-
|
|
230
|
-
### Patch Changes
|
|
231
|
-
|
|
232
|
-
- f5fa223: AMP support
|
|
233
|
-
- 47f2ee1: Always remove trailing slashes
|
|
234
|
-
- 1becb94: Replace preload with load
|
|
235
|
-
|
|
236
|
-
## 1.0.0-next.8
|
|
237
|
-
|
|
238
|
-
### Patch Changes
|
|
239
|
-
|
|
240
|
-
- 15dd751: Use meta http-equiv=refresh
|
|
241
|
-
- be7e031: Fix handling of static files
|
|
242
|
-
- ed6b8fd: Implement \$app/env
|
|
243
|
-
|
|
244
|
-
## 1.0.0-next.7
|
|
245
|
-
|
|
246
|
-
### Patch Changes
|
|
247
|
-
|
|
248
|
-
- 76705b0: make HMR work outside localhost
|
|
249
|
-
|
|
250
|
-
## 1.0.0-next.6
|
|
251
|
-
|
|
252
|
-
### Patch Changes
|
|
253
|
-
|
|
254
|
-
- 0e45255: Move options behind kit namespace, change paths -> kit.files
|
|
255
|
-
- fa7f2b2: Implement live bindings for SSR code
|
|
256
|
-
|
|
257
|
-
## 1.0.0-next.5
|
|
258
|
-
|
|
259
|
-
### Patch Changes
|
|
260
|
-
|
|
261
|
-
- Return dependencies from render
|
|
262
|
-
|
|
263
|
-
## 1.0.0-next.4
|
|
264
|
-
|
|
265
|
-
### Patch Changes
|
|
266
|
-
|
|
267
|
-
- af01b0d: Move renderer out of app assets folder
|
|
268
|
-
|
|
269
|
-
## 1.0.0-next.3
|
|
270
|
-
|
|
271
|
-
### Patch Changes
|
|
272
|
-
|
|
273
|
-
- Add paths to manifest, for static prerendering
|
|
274
|
-
|
|
275
|
-
## 1.0.0-next.2
|
|
276
|
-
|
|
277
|
-
### Patch Changes
|
|
278
|
-
|
|
279
|
-
- Fix typo causing misnamed assets folder
|
|
280
|
-
|
|
281
|
-
## 1.0.0-next.1
|
|
282
|
-
|
|
283
|
-
### Patch Changes
|
|
284
|
-
|
|
285
|
-
- a4bc090: Transform exported functions correctly
|
|
286
|
-
- 00bbf98: Fix nested layouts
|
|
287
|
-
|
|
288
|
-
## 0.0.31-next.0
|
|
289
|
-
|
|
290
|
-
### Patch Changes
|
|
291
|
-
|
|
292
|
-
- ffd7bba: Fix SSR cache invalidation
|
|
293
|
-
|
|
294
|
-
## 0.0.30
|
|
295
|
-
|
|
296
|
-
### Patch Changes
|
|
297
|
-
|
|
298
|
-
- Add back stores(), but with deprecation warning
|
|
299
|
-
- Rename stores.preloading to stores.navigating
|
|
300
|
-
- Rewrite routing logic
|
|
301
|
-
|
|
302
|
-
## 0.0.29
|
|
303
|
-
|
|
304
|
-
### Patch Changes
|
|
305
|
-
|
|
306
|
-
- 10872cc: Normalize request.query
|
|
307
|
-
|
|
308
|
-
## 0.0.28
|
|
309
|
-
|
|
310
|
-
### Patch Changes
|
|
311
|
-
|
|
312
|
-
- Add svelte-kit start command
|
|
313
|
-
|
|
314
|
-
## 0.0.27
|
|
315
|
-
|
|
316
|
-
### Patch Changes
|
|
317
|
-
|
|
318
|
-
- rename CLI to svelte-kit
|
|
319
|
-
- 0904e22: rename svelte CLI to svelte-kit
|
|
320
|
-
- Validate route responses
|
|
321
|
-
- Make paths and target configurable
|
|
322
|
-
|
|
323
|
-
## 0.0.26
|
|
324
|
-
|
|
325
|
-
### Patch Changes
|
|
326
|
-
|
|
327
|
-
- b475ed4: Overhaul adapter API - fixes #166
|
|
328
|
-
- Updated dependencies [b475ed4]
|
|
329
|
-
- @sveltejs/app-utils@0.0.18
|
|
330
|
-
|
|
331
|
-
## 0.0.25
|
|
332
|
-
|
|
333
|
-
### Patch Changes
|
|
334
|
-
|
|
335
|
-
- Updated dependencies [3bdf33b]
|
|
336
|
-
- @sveltejs/app-utils@0.0.17
|
|
337
|
-
|
|
338
|
-
## 0.0.24
|
|
339
|
-
|
|
340
|
-
### Patch Changes
|
|
341
|
-
|
|
342
|
-
- 67eaeea: Move app-utils stuff into subpackages
|
|
343
|
-
- 7f8df30: Move kit runtime code, expose via \$app aliases
|
|
344
|
-
- Updated dependencies [67eaeea]
|
|
345
|
-
- @sveltejs/app-utils@0.0.16
|
|
346
|
-
|
|
347
|
-
## 0.0.23
|
|
348
|
-
|
|
349
|
-
### Patch Changes
|
|
350
|
-
|
|
351
|
-
- a163000: Parse body on incoming requests
|
|
352
|
-
- a346eab: Copy over latest Sapper router code
|
|
353
|
-
- Updated dependencies [a163000]
|
|
354
|
-
- @sveltejs/app-utils@0.0.15
|
|
355
|
-
|
|
356
|
-
## 0.0.22
|
|
357
|
-
|
|
358
|
-
### Patch Changes
|
|
359
|
-
|
|
360
|
-
- Force bump version
|
|
361
|
-
|
|
362
|
-
## 0.0.21
|
|
363
|
-
|
|
364
|
-
### Patch Changes
|
|
365
|
-
|
|
366
|
-
- Build setup entry point
|
|
367
|
-
- Work around pkg.exports constraint
|
|
368
|
-
- Respond with 500s if render fails
|
|
369
|
-
- Updated dependencies [undefined]
|
|
370
|
-
- Updated dependencies [undefined]
|
|
371
|
-
- Updated dependencies [undefined]
|
|
372
|
-
- @sveltejs/app-utils@0.0.14
|
|
373
|
-
|
|
374
|
-
## 0.0.20
|
|
375
|
-
|
|
376
|
-
### Patch Changes
|
|
377
|
-
|
|
378
|
-
- Pass setup module to renderer
|
|
379
|
-
- Bump Snowpack version
|
|
380
|
-
- Updated dependencies [undefined]
|
|
381
|
-
- Updated dependencies [96c06d8]
|
|
382
|
-
- @sveltejs/app-utils@0.0.13
|
|
383
|
-
|
|
384
|
-
## 0.0.19
|
|
385
|
-
|
|
386
|
-
### Patch Changes
|
|
387
|
-
|
|
388
|
-
- fa9d7ce: Handle import.meta in SSR module loader
|
|
389
|
-
- 0320208: Rename 'server route' to 'endpoint'
|
|
390
|
-
- b9444d2: Update to Snowpack 2.15
|
|
391
|
-
- 5ca907c: Use shared mkdirp helper
|
|
392
|
-
- Updated dependencies [0320208]
|
|
393
|
-
- Updated dependencies [5ca907c]
|
|
394
|
-
- @sveltejs/app-utils@0.0.12
|
|
395
|
-
|
|
396
|
-
## 0.0.18
|
|
397
|
-
|
|
398
|
-
### Patch Changes
|
|
399
|
-
|
|
400
|
-
- Updated dependencies [undefined]
|
|
401
|
-
- @sveltejs/app-utils@0.0.11
|
|
402
|
-
|
|
403
|
-
## 0.0.17
|
|
404
|
-
|
|
405
|
-
### Patch Changes
|
|
406
|
-
|
|
407
|
-
- 19323e9: Update Snowpack
|
|
408
|
-
- Updated dependencies [19323e9]
|
|
409
|
-
- @sveltejs/app-utils@0.0.10
|
|
410
|
-
|
|
411
|
-
## 0.0.16
|
|
412
|
-
|
|
413
|
-
### Patch Changes
|
|
414
|
-
|
|
415
|
-
- Updated dependencies [90a98ae]
|
|
416
|
-
- @sveltejs/app-utils@0.0.9
|
|
417
|
-
|
|
418
|
-
## 0.0.15
|
|
419
|
-
|
|
420
|
-
### Patch Changes
|
|
421
|
-
|
|
422
|
-
- Updated dependencies [undefined]
|
|
423
|
-
- @sveltejs/app-utils@0.0.8
|
|
424
|
-
|
|
425
|
-
## 0.0.14
|
|
426
|
-
|
|
427
|
-
### Patch Changes
|
|
428
|
-
|
|
429
|
-
- various
|
|
430
|
-
- Updated dependencies [undefined]
|
|
431
|
-
- @sveltejs/app-utils@0.0.7
|
|
@@ -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 { 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 | 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,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 };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** @type {any} */
|
|
2
|
-
let router;
|
|
3
|
-
|
|
4
|
-
/** @type {any} */
|
|
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 };
|