Socket
Socket
Sign inDemoInstall

next

Package Overview
Dependencies
39
Maintainers
3
Versions
2644
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta.4 to 2.0.0-beta.5

10

dist/lib/link.js

@@ -63,3 +63,4 @@ 'use strict';

href = _props.href,
as = _props.as;
_props$as = _props.as,
as = _props$as === undefined ? href : _props$as;

@@ -74,5 +75,2 @@

var route = as ? href : null;
var url = as || href;
// avoid scroll for urls with anchor refs

@@ -82,7 +80,7 @@ var scroll = this.props.scroll;

if (scroll == null) {
scroll = url.indexOf('#') < 0;
scroll = as.indexOf('#') < 0;
}
// straight up redirect
_router2.default.push(route, url).then(function (success) {
_router2.default.push(href, as).then(function (success) {
if (!success) return;

@@ -89,0 +87,0 @@ if (scroll) window.scrollTo(0, 0);

63

dist/lib/router/router.js

@@ -89,10 +89,13 @@ 'use strict';

var as = getURL();
var _ref2 = e.state || {},
route = _ref2.route;
_ref2$url = _ref2.url,
url = _ref2$url === undefined ? as : _ref2$url;
var _parse = (0, _url.parse)(route || window.location.href, true),
var _parse = (0, _url.parse)(url, true),
pathname = _parse.pathname,
query = _parse.query;
if (!route) route = toRoute(pathname);
var route = toRoute(pathname);

@@ -119,3 +122,3 @@ _promise2.default.resolve().then((0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {

_this.route = route;
_this.set(getURL(), (0, _extends3.default)({}, data, { props: props }));
_this.set(pathname, query, (0, _extends3.default)({}, data, { props: props }));

@@ -153,3 +156,3 @@ case 9:

_this.route = route;
_this.set(getURL(), (0, _extends3.default)({}, data, { props: props }));
_this.set(pathname, query, (0, _extends3.default)({}, data, { props: props }));
console.error(err);

@@ -279,13 +282,13 @@

key: 'push',
value: function push(route) {
var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : route;
value: function push(url) {
var as = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : url;
return this.change('pushState', route, url);
return this.change('pushState', url, as);
}
}, {
key: 'replace',
value: function replace(route) {
var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : route;
value: function replace(url) {
var as = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : url;
return this.change('replaceState', route, url);
return this.change('replaceState', url, as);
}

@@ -295,4 +298,4 @@ }, {

value: function () {
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(method, route, url) {
var _parse3, pathname, query, data, props, _err, ctx, _ctx2;
var _ref6 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee4(method, url, as) {
var _parse3, pathname, query, route, data, props, _err, ctx, _ctx2;

@@ -303,7 +306,6 @@ return _regenerator2.default.wrap(function _callee4$(_context4) {

case 0:
_parse3 = (0, _url.parse)(route || url, true), pathname = _parse3.pathname, query = _parse3.query;
_parse3 = (0, _url.parse)(url, true), pathname = _parse3.pathname, query = _parse3.query;
route = toRoute(pathname);
if (!route) route = toRoute(pathname);
this.abortComponentLoad();

@@ -356,8 +358,8 @@

if (method !== 'pushState' || getURL() !== url) {
window.history[method]({ route: route }, null, url);
if (method !== 'pushState' || getURL() !== as) {
window.history[method]({ url: url }, null, as);
}
this.route = route;
this.set(url, (0, _extends3.default)({}, data, { props: props }));
this.set(pathname, query, (0, _extends3.default)({}, data, { props: props }));

@@ -390,8 +392,6 @@ if (!_err) {

key: 'set',
value: function set(url, data) {
var parsed = (0, _url.parse)(url, true);
if (this.urlIsNew(parsed)) {
this.pathname = parsed.pathname;
this.query = parsed.query;
value: function set(pathname, query, data) {
if (this.urlIsNew(pathname, query)) {
this.pathname = pathname;
this.query = query;
this.notify(data);

@@ -402,6 +402,3 @@ }

key: 'urlIsNew',
value: function urlIsNew(_ref7) {
var pathname = _ref7.pathname,
query = _ref7.query;
value: function urlIsNew(pathname, query) {
return this.pathname !== pathname || !(0, _shallowEquals2.default)(query, this.query);

@@ -412,3 +409,3 @@ }

value: function () {
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(route) {
var _ref7 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee5(route) {
var _this2 = this;

@@ -467,3 +464,3 @@

function fetchComponent(_x9) {
return _ref8.apply(this, arguments);
return _ref7.apply(this, arguments);
}

@@ -476,3 +473,3 @@

value: function () {
var _ref9 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(Component, ctx) {
var _ref8 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee6(Component, ctx) {
var cancelled, cancel, props, err;

@@ -524,3 +521,3 @@ return _regenerator2.default.wrap(function _callee6$(_context6) {

function getInitialProps(_x10, _x11) {
return _ref9.apply(this, arguments);
return _ref8.apply(this, arguments);
}

@@ -527,0 +524,0 @@

{
"name": "next",
"version": "2.0.0-beta.4",
"version": "2.0.0-beta.5",
"description": "Minimalistic framework for server-rendered React applications",

@@ -5,0 +5,0 @@ "main": "./dist/server/next.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc