@sveltejs/kit 1.0.0-next.272 → 1.0.0-next.273

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.
@@ -212,6 +212,8 @@ class Router {
212
212
  // Removing the hash does a full page navigation in the browser, so make sure a hash is present
213
213
  const [base, hash] = url.href.split('#');
214
214
  if (hash !== undefined && base === location.href.split('#')[0]) {
215
+ // set this flag to distinguish between navigations triggered by
216
+ // clicking a hash link and those triggered by popstate
215
217
  this.hash_navigating = true;
216
218
 
217
219
  const info = this.parse(url);
@@ -259,6 +261,8 @@ class Router {
259
261
  });
260
262
 
261
263
  addEventListener('hashchange', () => {
264
+ // if the hashchange happened as a result of clicking on a link,
265
+ // we need to update history, otherwise we have to leave it alone
262
266
  if (this.hash_navigating) {
263
267
  this.hash_navigating = false;
264
268
  history.replaceState(
@@ -80,7 +80,7 @@ function is_pojo(body) {
80
80
 
81
81
  // body could be a node Readable, but we don't want to import
82
82
  // node built-ins, so we use duck typing
83
- if (body._readableState && body._writableState && body._events) return false;
83
+ if (body._readableState && typeof body.pipe === 'function') return false;
84
84
 
85
85
  // similarly, it could be a web ReadableStream
86
86
  if (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) return false;
@@ -1881,7 +1881,7 @@ async function load_shadow_data(route, event, options, prerender) {
1881
1881
  const mod = await route.shadow();
1882
1882
 
1883
1883
  if (prerender && (mod.post || mod.put || mod.del || mod.patch)) {
1884
- throw new Error('Cannot prerender pages that have shadow endpoints with mutative methods');
1884
+ throw new Error('Cannot prerender pages that have endpoints with mutative methods');
1885
1885
  }
1886
1886
 
1887
1887
  const method = normalize_request_method(event);
@@ -1988,7 +1988,7 @@ function validate_shadow_output(result) {
1988
1988
  if (headers instanceof Headers) {
1989
1989
  if (headers.has('set-cookie')) {
1990
1990
  throw new Error(
1991
- 'Shadow endpoint request handler cannot use Headers interface with Set-Cookie headers'
1991
+ 'Endpoint request handler cannot use Headers interface with Set-Cookie headers'
1992
1992
  );
1993
1993
  }
1994
1994
  } else {
@@ -1996,7 +1996,7 @@ function validate_shadow_output(result) {
1996
1996
  }
1997
1997
 
1998
1998
  if (!is_pojo(body)) {
1999
- throw new Error('Body returned from shadow endpoint request handler must be a plain object');
1999
+ throw new Error('Body returned from endpoint request handler must be a plain object');
2000
2000
  }
2001
2001
 
2002
2002
  return { status, headers, body };
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.272');
1001
+ const prog = sade('svelte-kit').version('1.0.0-next.273');
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.272'}\n`));
1159
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.273'}\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.272",
3
+ "version": "1.0.0-next.273",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",