@sveltejs/kit 1.5.0 → 1.5.1
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/package.json
CHANGED
|
@@ -85,19 +85,29 @@ export function get_tsconfig(kit, include_base_url) {
|
|
|
85
85
|
/** @param {string} file */
|
|
86
86
|
const config_relative = (file) => posixify(path.relative(kit.outDir, file));
|
|
87
87
|
|
|
88
|
-
const include =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
const include = new Set([
|
|
89
|
+
'ambient.d.ts',
|
|
90
|
+
'./types/**/$types.d.ts',
|
|
91
|
+
config_relative('vite.config.ts')
|
|
92
|
+
]);
|
|
93
|
+
// TODO(v2): find a better way to include all src files. We can't just use routes/lib only because
|
|
94
|
+
// people might have other folders/files in src that they want included.
|
|
95
|
+
const src_includes = [kit.files.routes, kit.files.lib, path.resolve('src')].filter((dir) => {
|
|
96
|
+
const relative = path.relative(path.resolve('src'), dir);
|
|
97
|
+
return !relative || relative.startsWith('..');
|
|
98
|
+
});
|
|
99
|
+
for (const dir of src_includes) {
|
|
100
|
+
include.add(config_relative(`${dir}/**/*.js`));
|
|
101
|
+
include.add(config_relative(`${dir}/**/*.ts`));
|
|
102
|
+
include.add(config_relative(`${dir}/**/*.svelte`));
|
|
94
103
|
}
|
|
104
|
+
|
|
95
105
|
// Test folder is a special case - we advocate putting tests in a top-level test folder
|
|
96
106
|
// and it's not configurable (should we make it?)
|
|
97
107
|
const test_folder = project_relative('tests');
|
|
98
|
-
include.
|
|
99
|
-
include.
|
|
100
|
-
include.
|
|
108
|
+
include.add(config_relative(`${test_folder}/**/*.js`));
|
|
109
|
+
include.add(config_relative(`${test_folder}/**/*.ts`));
|
|
110
|
+
include.add(config_relative(`${test_folder}/**/*.svelte`));
|
|
101
111
|
|
|
102
112
|
const exclude = [config_relative('node_modules/**'), './[!ambient.d.ts]**'];
|
|
103
113
|
if (path.extname(kit.files.serviceWorker)) {
|
|
@@ -135,7 +145,7 @@ export function get_tsconfig(kit, include_base_url) {
|
|
|
135
145
|
// TODO(v2): use the new flag verbatimModuleSyntax instead (requires support by Vite/Esbuild)
|
|
136
146
|
ignoreDeprecations: ts && Number(ts.version.split('.')[0]) >= 5 ? '5.0' : undefined
|
|
137
147
|
},
|
|
138
|
-
include,
|
|
148
|
+
include: [...include],
|
|
139
149
|
exclude
|
|
140
150
|
};
|
|
141
151
|
|
|
@@ -853,7 +853,7 @@ export function create_client({ target }) {
|
|
|
853
853
|
// server_data_node is undefined if it wasn't reloaded from the server;
|
|
854
854
|
// and if current loader uses server data, we want to reuse previous data.
|
|
855
855
|
server_data_node === undefined && loader[0] ? { type: 'skip' } : server_data_node ?? null,
|
|
856
|
-
previous?.server
|
|
856
|
+
loader[0] ? previous?.server : undefined
|
|
857
857
|
)
|
|
858
858
|
});
|
|
859
859
|
});
|
package/types/index.d.ts
CHANGED
|
@@ -520,7 +520,23 @@ export interface KitConfig {
|
|
|
520
520
|
config?: (config: Record<string, any>) => Record<string, any> | void;
|
|
521
521
|
};
|
|
522
522
|
/**
|
|
523
|
-
* Client-side navigation can be buggy if you deploy a new version of your app while people are using it. If the code for the new page is already loaded, it may have stale content; if it isn't, the app's route manifest may point to a JavaScript file that no longer exists.
|
|
523
|
+
* Client-side navigation can be buggy if you deploy a new version of your app while people are using it. If the code for the new page is already loaded, it may have stale content; if it isn't, the app's route manifest may point to a JavaScript file that no longer exists.
|
|
524
|
+
* SvelteKit helps you solve this problem through version management.
|
|
525
|
+
* If SvelteKit encounters an error while loading the page and detects that a new version has been deployed (using the `name` specified here, which defaults to a timestamp of the build) it will fall back to traditional full-page navigation.
|
|
526
|
+
* Not all navigations will result in an error though, for example if the JavaScript for the next page is already loaded. If you still want to force a full-page navigation in these cases, use techniques such as setting the `pollInverval` and then using `beforeNavigate`:
|
|
527
|
+
* ```html
|
|
528
|
+
* /// +layout.svelte
|
|
529
|
+
* <script>
|
|
530
|
+
* import { beforeNavigate } from '$app/navigation';
|
|
531
|
+
* import { updated } from '$app/stores';
|
|
532
|
+
*
|
|
533
|
+
* beforeNavigate(({ willUnload, to }) => {
|
|
534
|
+
* if ($updated && !willUnload && to?.url) {
|
|
535
|
+
* location.href = to.route.url.href;
|
|
536
|
+
* }
|
|
537
|
+
* });
|
|
538
|
+
* </script>
|
|
539
|
+
* ```
|
|
524
540
|
*
|
|
525
541
|
* If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of the [`updated`](/docs/modules#$app-stores-updated) store to `true` when it detects one.
|
|
526
542
|
*/
|
|
@@ -1091,6 +1107,13 @@ export type Actions<
|
|
|
1091
1107
|
|
|
1092
1108
|
/**
|
|
1093
1109
|
* When calling a form action via fetch, the response will be one of these shapes.
|
|
1110
|
+
* ```svelte
|
|
1111
|
+
* <form method="post" use:enhance={() => {
|
|
1112
|
+
* return ({ result }) => {
|
|
1113
|
+
* // result is of type ActionResult
|
|
1114
|
+
* };
|
|
1115
|
+
* }}
|
|
1116
|
+
* ```
|
|
1094
1117
|
*/
|
|
1095
1118
|
export type ActionResult<
|
|
1096
1119
|
Success extends Record<string, unknown> | undefined = Record<string, any>,
|
package/types/internal.d.ts
CHANGED