@sveltejs/kit 1.0.0-next.280 → 1.0.0-next.283

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.
@@ -37,6 +37,11 @@ try {
37
37
  // do nothing
38
38
  }
39
39
 
40
+ /** @param {number} index */
41
+ function update_scroll_positions(index) {
42
+ scroll_positions[index] = scroll_state();
43
+ }
44
+
40
45
  function scroll_state() {
41
46
  return {
42
47
  x: pageXOffset,
@@ -143,7 +148,7 @@ class Router {
143
148
 
144
149
  addEventListener('visibilitychange', () => {
145
150
  if (document.visibilityState === 'hidden') {
146
- this.#update_scroll_positions();
151
+ update_scroll_positions(this.current_history_index);
147
152
 
148
153
  try {
149
154
  sessionStorage[SCROLL_KEY] = JSON.stringify(scroll_positions);
@@ -223,7 +228,7 @@ class Router {
223
228
  // clicking a hash link and those triggered by popstate
224
229
  this.hash_navigating = true;
225
230
 
226
- this.#update_scroll_positions();
231
+ update_scroll_positions(this.current_history_index);
227
232
  this.renderer.update_page_store(new URL(url.href));
228
233
 
229
234
  return;
@@ -282,10 +287,6 @@ class Router {
282
287
  this.initialized = true;
283
288
  }
284
289
 
285
- #update_scroll_positions() {
286
- scroll_positions[this.current_history_index] = scroll_state();
287
- }
288
-
289
290
  /**
290
291
  * Returns true if `url` has the same origin and basepath as the app
291
292
  * @param {URL} url
@@ -434,7 +435,7 @@ class Router {
434
435
  });
435
436
  }
436
437
 
437
- this.#update_scroll_positions();
438
+ update_scroll_positions(this.current_history_index);
438
439
 
439
440
  accepted();
440
441
 
@@ -1326,7 +1326,7 @@ async function render_response({
1326
1326
  const assets =
1327
1327
  options.paths.assets || (segments.length > 0 ? segments.map(() => '..').join('/') : '.');
1328
1328
 
1329
- const html = resolve_opts.transformPage({
1329
+ const html = await resolve_opts.transformPage({
1330
1330
  html: options.template({ head, body, assets, nonce: /** @type {string} */ (csp.nonce) })
1331
1331
  });
1332
1332
 
@@ -1844,7 +1844,7 @@ async function load_node({
1844
1844
 
1845
1845
  // generate __data.json files when prerendering
1846
1846
  if (shadow.body && state.prerender) {
1847
- const pathname = `${event.url.pathname}/__data.json`;
1847
+ const pathname = `${event.url.pathname.replace(/\/$/, '')}/__data.json`;
1848
1848
 
1849
1849
  const dependency = {
1850
1850
  response: new Response(undefined),
package/dist/cli.js CHANGED
@@ -998,7 +998,7 @@ async function launch(port, https) {
998
998
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
999
999
  }
1000
1000
 
1001
- const prog = sade('svelte-kit').version('1.0.0-next.280');
1001
+ const prog = sade('svelte-kit').version('1.0.0-next.283');
1002
1002
 
1003
1003
  prog
1004
1004
  .command('dev')
@@ -1156,7 +1156,7 @@ async function check_port(port) {
1156
1156
  function welcome({ port, host, https, open, loose, allow, cwd }) {
1157
1157
  if (open) launch(port, https);
1158
1158
 
1159
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.280'}\n`));
1159
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.283'}\n`));
1160
1160
 
1161
1161
  const protocol = https ? 'https:' : 'http:';
1162
1162
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.280",
3
+ "version": "1.0.0-next.283",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@playwright/test": "^1.17.1",
19
- "@rollup/plugin-replace": "^3.0.0",
19
+ "@rollup/plugin-replace": "^4.0.0",
20
20
  "@types/amphtml-validator": "^1.0.1",
21
21
  "@types/cookie": "^0.4.1",
22
22
  "@types/marked": "^4.0.1",
@@ -206,7 +206,7 @@ export type RecursiveRequired<T> = {
206
206
 
207
207
  export interface RequiredResolveOptions {
208
208
  ssr: boolean;
209
- transformPage: ({ html }: { html: string }) => string;
209
+ transformPage: ({ html }: { html: string }) => MaybePromise<string>;
210
210
  }
211
211
 
212
212
  export interface Respond {