Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

single-spa

Package Overview
Dependencies
Maintainers
5
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

single-spa - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

lib/single-spa.helpers.js

19

lib/single-spa.js

@@ -35,2 +35,4 @@ 'use strict';

var _singleSpaHelpers = require('./single-spa.helpers.js');
var window = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : self;

@@ -252,9 +254,18 @@

var href = window.location.href;
var current = (0, _singleSpaHelpers.parseUri)(window.location.href);
var destination = (0, _singleSpaHelpers.parseUri)(url);
if (url.indexOf('#') > -1 && href.substring(0, href.indexOf('#')) === url.substring(0, url.indexOf('#'))) {
window.location.hash = url.substring(url.indexOf('#'));
if (url.indexOf('#') === 0) {
window.location.hash = '#' + destination.anchor;
} else if (!isSamePath(destination.path, current.path) || current.host !== destination.host && destination.host) {
// different path or a different host
window.history.pushState(null, null, url);
} else {
window.history.pushState(null, null, url);
window.location.hash = '#' + destination.anchor;
}
function isSamePath(destination, current) {
// if the destination has a path but no domain, it doesn't include the root '/'
return current === destination || current === '/' + destination;
}
}

@@ -261,0 +272,0 @@

{
"name": "single-spa",
"version": "2.1.3",
"version": "2.1.4",
"description": "Multiple applications, one page",

@@ -5,0 +5,0 @@ "main": "lib/single-spa.js",

import { handleChildAppError } from './single-spa-child-app-error.js';
import { ensureJQuerySupport } from './jquery-support.js';
import { parseUri } from './single-spa.helpers.js';

@@ -207,9 +208,18 @@ const window = typeof window !== 'undefined' ? window : (typeof global !== 'undefined' ? global : self);

const href = window.location.href;
const current = parseUri(window.location.href);
const destination = parseUri(url);
if (url.indexOf('#') > -1 && href.substring(0, href.indexOf('#')) === url.substring(0, url.indexOf('#'))) {
window.location.hash = url.substring(url.indexOf('#'));
if (url.indexOf('#') === 0) {
window.location.hash = '#' + destination.anchor;
} else if (!isSamePath(destination.path, current.path) || (current.host !== destination.host && destination.host)) {
// different path or a different host
window.history.pushState(null, null, url);
} else {
window.history.pushState(null, null, url);
window.location.hash = '#' + destination.anchor;
}
function isSamePath(destination, current) {
// if the destination has a path but no domain, it doesn't include the root '/'
return current === destination || current === '/' + destination;
}
}

@@ -216,0 +226,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc