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

single-spa-angular

Package Overview
Dependencies
Maintainers
13
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

single-spa-angular - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0-alpha.0

bundles/single-spa-angular-internals.umd.js

185

bundles/single-spa-angular.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define('single-spa-angular', ['exports', '@angular/core', '@angular/common'], factory) :
(global = global || self, factory(global['single-spa-angular'] = {}, global.ng.core, global.ng.common));
}(this, (function (exports, core, common) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('single-spa-angular/internals'), require('@angular/core'), require('@angular/common')) :
typeof define === 'function' && define.amd ? define('single-spa-angular', ['exports', 'single-spa-angular/internals', '@angular/core', '@angular/common'], factory) :
(global = global || self, factory(global['single-spa-angular'] = {}, global['single-spa-angular'].internals, global.ng.core, global.ng.common));
}(this, (function (exports, internals, core, common) { 'use strict';

@@ -224,15 +224,67 @@ /*! *****************************************************************************

function SingleSpaPlatformLocation() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
// This is a simple marker that helps us to ignore PopStateEvents
// that was not dispatched by the browser.
_this.skipNextPopState = false;
_this.onPopStateListeners = [];
return _this;
}
SingleSpaPlatformLocation.prototype.destroy = function () {
// TLDR: Angular adds `popstate` event listener and then doesn't remove it when application gets destroyed.
// Basically, Angular has a potentional memory leak. The `ɵBrowserPlatformLocation`
// has `onPopState` method which adds `popstate` event listener and forgets, see here:
// https://github.com/angular/angular/blob/14be55c9facf3e47b8c97df4502dc3f0f897da03/packages/common/src/location/platform_location.ts#L126
var e_1, _a;
try {
for (var _b = __values(this.onPopStateListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
var onPopStateListener = _c.value;
window.removeEventListener('popstate', onPopStateListener);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
// We do this because the `SingleSpaPlatformLocation` is a part of PLATFORM_INJECTOR,
// which means it's created only once and will not be garbage collected, since the PLATFORM_INJECTOR
// will keep reference to its instance.
// TODO: https://github.com/single-spa/single-spa-angular/issues/170
this.onPopStateListeners = [];
};
SingleSpaPlatformLocation.prototype.pushState = function (state, title, url) {
this.skipNextPopState = true;
_super.prototype.pushState.call(this, state, title, url);
};
SingleSpaPlatformLocation.prototype.replaceState = function (state, title, url) {
this.skipNextPopState = true;
_super.prototype.replaceState.call(this, state, title, url);
};
SingleSpaPlatformLocation.prototype.onPopState = function (fn) {
var _this = this;
_super.prototype.onPopState.call(this, function (event) {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more detail
_this.ngZone.run(function () { return fn(event); });
});
var onPopStateListener = function (event) {
// The `LocationChangeEvent` doesn't have the `singleSpa` property, since it's added
// by `single-spa` starting from `5.4` version. We need this check because we want
// to skip "unnatural" PopStateEvents, the one caused by `single-spa`.
var popStateEventWasDispatchedBySingleSpa = !!event
.singleSpa;
if (_this.skipNextPopState && popStateEventWasDispatchedBySingleSpa) {
_this.skipNextPopState = false;
}
else {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more details
_this.ngZone.run(function () { return fn(event); });
}
};
// All listeners should be stored inside an array because the `onPopState` can be called
// multiple times thus we wanna reference all listeners to remove them further.
this.onPopStateListeners.push(onPopStateListener);
_super.prototype.onPopState.call(this, onPopStateListener);
};

@@ -301,2 +353,8 @@ SingleSpaPlatformLocation.prototype.setNgZone = function (ngZone) {

return __generator(this, function (_a) {
// Angular provides an opportunity to develop `zone-less` application, where developers
// have to trigger change detection manually.
// See https://angular.io/guide/zone#noopzone
if (opts.NgZone === 'noop') {
return [2 /*return*/];
}
// In order for multiple Angular apps to work concurrently on a page, they each need a unique identifier.

@@ -326,11 +384,11 @@ opts.zoneIdentifier = "single-spa-angular:" + (props.name || props.appName);

return __awaiter(this, void 0, void 0, function () {
var domElementGetter, containerEl, bootstrapPromise, module, singleSpaPlatformLocation, bootstrappedOpts, ngZone;
var domElementGetter, containerEl, bootstrapPromise, module, singleSpaPlatformLocation, ngZoneEnabled, bootstrappedOpts, ngZone;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
domElementGetter = chooseDomElementGetter(opts, props);
domElementGetter = internals.chooseDomElementGetter(opts, props);
if (!domElementGetter) {
throw Error("cannot mount angular application '" + (props.name || props.appName) + "' without a domElementGetter provided either as an opt or a prop");
}
containerEl = getContainerEl(domElementGetter);
containerEl = internals.getContainerEl(domElementGetter);
containerEl.innerHTML = opts.template;

@@ -348,13 +406,25 @@ bootstrapPromise = opts.bootstrapFunction(props);

singleSpaPlatformLocation = module.injector.get(SingleSpaPlatformLocation, null);
ngZoneEnabled = opts.NgZone !== 'noop';
// The user has to provide `BrowserPlatformLocation` only if his application uses routing.
// So if he provided `Router` but didn't provide `BrowserPlatformLocation` then we have to inform him.
if (opts.Router && singleSpaPlatformLocation === null) {
// Also `getSingleSpaExtraProviders()` function should be called only if the user doesn't use
// `zone-less` change detection, if `NgZone` is `noop` then we can skip it.
if (ngZoneEnabled && opts.Router && singleSpaPlatformLocation === null) {
throw new Error("\t\n single-spa-angular: could not retrieve extra providers from the platform injector. Did you call getSingleSpaExtraProviders() when creating platform?\t\n ");
}
bootstrappedOpts = opts;
ngZone = module.injector.get(opts.NgZone);
singleSpaPlatformLocation.setNgZone(ngZone);
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
if (ngZoneEnabled) {
ngZone = module.injector.get(opts.NgZone);
// `NgZone` can be enabled but routing may not be used thus `getSingleSpaExtraProviders()`
// function was not called.
if (singleSpaPlatformLocation !== null) {
singleSpaPlatformLocation.setNgZone(ngZone);
// Cleanup resources, especially remove event listeners thus they will not be added
// twice when application gets bootstrapped the second time.
module.onDestroy(function () { return singleSpaPlatformLocation.destroy(); });
}
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
}
bootstrappedOpts.bootstrappedModule = module;

@@ -375,3 +445,5 @@ return [2 /*return*/, module];

}
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
if (opts.routingEventListener) {
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
}
if (opts.AnimationEngine) {

@@ -383,7 +455,5 @@ animationEngine = opts.bootstrappedModule.injector.get(opts.AnimationEngine);

delete opts.bootstrappedModule;
if (ivyEnabled()) {
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
}
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
internals.removeApplicationFromDOMIfIvyEnabled(opts, props);
return [2 /*return*/];

@@ -393,59 +463,2 @@ });

}
function ivyEnabled() {
try {
// `ɵivyEnabled` variable is exposed starting from version 8.
// We use `require` here except of a single `import { ɵivyEnabled }` because the
// developer can use Angular version that doesn't expose it (all versions <8).
// The `catch` statement will handle those cases.
// eslint-disable-next-line
var ɵivyEnabled = require('@angular/core').ɵivyEnabled;
return !!ɵivyEnabled;
}
catch (_a) {
return false;
}
}
function removeApplicationFromDOMIfIvyEnabled(opts, props) {
var domElementGetter = chooseDomElementGetter(opts, props);
var domElement = getContainerEl(domElementGetter);
// View Engine removes all nodes automatically when calling `NgModuleRef.destroy()`,
// which calls `ComponentRef.destroy()`.
// Basically this will remove `app-root` or any other selector from the container element.
while (domElement.firstChild)
domElement.removeChild(domElement.firstChild);
}
function getContainerEl(domElementGetter) {
var element = domElementGetter();
if (!element) {
throw Error('domElementGetter did not return a valid dom element');
}
return element;
}
function chooseDomElementGetter(opts, props) {
props = props && props.customProps ? props.customProps : props;
if (props.domElement) {
return function () { return props.domElement; };
}
else if (props.domElementGetter) {
return props.domElementGetter;
}
else if (opts.domElementGetter) {
return opts.domElementGetter;
}
else {
return defaultDomElementGetter(props.name);
}
}
function defaultDomElementGetter(name) {
return function getDefaultDomElement() {
var id = "single-spa-application:" + name;
var domElement = document.getElementById(id);
if (!domElement) {
domElement = document.createElement('div');
domElement.id = id;
document.body.appendChild(domElement);
}
return domElement;
};
}

@@ -452,0 +465,0 @@ var ParcelComponent = /** @class */ (function () {

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("single-spa-angular",["exports","@angular/core","@angular/common"],e):e((t=t||self)["single-spa-angular"]={},t.ng.core,t.ng.common)}(this,(function(t,e,n){"use strict";
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("single-spa-angular/internals"),require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("single-spa-angular",["exports","single-spa-angular/internals","@angular/core","@angular/common"],e):e((t=t||self)["single-spa-angular"]={},t["single-spa-angular"].internals,t.ng.core,t.ng.common)}(this,(function(t,e,n,o){"use strict";
/*! *****************************************************************************

@@ -15,3 +15,3 @@ Copyright (c) Microsoft Corporation. All rights reserved.

and limitations under the License.
***************************************************************************** */var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var r=function(){return(r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function i(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function a(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{l(o.next(t))}catch(t){i(t)}}function u(t){try{l(o.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}l((o=o.apply(t,e||[])).next())}))}function u(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function s(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(l(arguments[e]));return t}var p=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(n,t),n.prototype.onPopState=function(e){var n=this;t.prototype.onPopState.call(this,(function(t){n.ngZone.run((function(){return e(t)}))}))},n.prototype.setNgZone=function(t){this.ngZone=t},n=i([e.Injectable()],n)}(n["ɵBrowserPlatformLocation"]);var c={NgZone:null,bootstrapFunction:null,template:null,Router:void 0,domElementGetter:void 0,AnimationEngine:void 0,updateFunction:function(){return Promise.resolve()}};function d(t,e){return a(this,void 0,void 0,(function(){return u(this,(function(n){return t.zoneIdentifier="single-spa-angular:"+(e.name||e.appName),t.NgZone.isInAngularZone=function(){return!0===window.Zone.current._properties[t.zoneIdentifier]},t.routingEventListener=function(){t.bootstrappedNgZone.run((function(){}))},[2]}))}))}function f(t,e){return a(this,void 0,void 0,(function(){var n,o,r,i,a,l;return u(this,(function(u){switch(u.label){case 0:if(!(n=g(t,e)))throw Error("cannot mount angular application '"+(e.name||e.appName)+"' without a domElementGetter provided either as an opt or a prop");if(h(n).innerHTML=t.template,!((o=t.bootstrapFunction(e))instanceof Promise))throw Error("single-spa-angular: the opts.bootstrapFunction must return a promise, but instead returned a '"+typeof o+"' that is not a Promise");return[4,o];case 1:if(!(r=u.sent())||"function"!=typeof r.destroy)throw Error("single-spa-angular: the opts.bootstrapFunction returned a promise that did not resolve with a valid Angular module. Did you call platformBrowser().bootstrapModuleFactory() correctly?");if(i=r.injector.get(p,null),t.Router&&null===i)throw new Error("\t\n single-spa-angular: could not retrieve extra providers from the platform injector. Did you call getSingleSpaExtraProviders() when creating platform?\t\n ");return a=t,l=r.injector.get(t.NgZone),i.setNgZone(l),a.bootstrappedNgZone=l,a.bootstrappedNgZone._inner._properties[a.zoneIdentifier]=!0,window.addEventListener("single-spa:routing-event",a.routingEventListener),a.bootstrappedModule=r,[2,r]}}))}))}function m(t,e){return a(this,void 0,void 0,(function(){return u(this,(function(n){return t.Router&&t.bootstrappedModule.injector.get(t.Router).dispose(),window.removeEventListener("single-spa:routing-event",t.routingEventListener),t.AnimationEngine&&t.bootstrappedModule.injector.get(t.AnimationEngine)._transitionEngine.flush(),t.bootstrappedModule.destroy(),delete t.bootstrappedModule,function(){try{return!!require("@angular/core").ɵivyEnabled}catch(t){return!1}}()&&function(t,e){var n=h(g(t,e));for(;n.firstChild;)n.removeChild(n.firstChild)}(t,e),[2]}))}))}function h(t){var e=t();if(!e)throw Error("domElementGetter did not return a valid dom element");return e}function g(t,e){return(e=e&&e.customProps?e.customProps:e).domElement?function(){return e.domElement}:e.domElementGetter?e.domElementGetter:t.domElementGetter?t.domElementGetter:(n=e.name,function(){var t="single-spa-application:"+n,e=document.getElementById(t);return e||((e=document.createElement("div")).id=t,document.body.appendChild(e)),e});var n}var v=function(){function t(t){this.host=t,this.onParcelMount=null,this.wrapWith="div",this.customProps={},this.appendTo=null,this.handleError=function(t){return console.error(t)},this.createdDomElement=null,this.hasError=!1,this.unmounted=!0}return t.prototype.ngOnInit=function(){var t=this;if(!this.config)throw new Error("single-spa-angular's Parcel component requires the [config] binding to either be a parcel config or a loading function that returns a promise. See https://github.com/CanopyTax/single-spa-angular");this.addThingToDo("mount",(function(){var e,n=t.mountParcel;if(!n)throw new Error("\n\t\t\t\t <parcel> was not passed a [mountParcel] binding.\n\t\t\t\t If you are using <parcel> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <parcel> as a [mountParcel] binding\n\t\t\t\t");t.appendTo?(t.createdDomElement=e=document.createElement(t.wrapWith),t.appendTo.appendChild(e)):(t.createdDomElement=e=document.createElement(t.wrapWith),t.host.nativeElement.children[0].appendChild(e));return t.parcel=n(t.config,r({domElement:e},t.customProps)),t.onParcelMount&&t.parcel.mountPromise.then(t.onParcelMount),t.unmounted=!1,t.parcel.mountPromise}))},t.prototype.ngOnChanges=function(){var t=this;this.addThingToDo("update",(function(){if(t.parcel&&t.parcel.update)return t.parcel.update(t.customProps)}))},t.prototype.ngOnDestroy=function(){var t=this;this.addThingToDo("unmount",(function(){if(t.parcel&&"MOUNTED"===t.parcel.getStatus())return t.parcel.unmount()})),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0},t.prototype.addThingToDo=function(t,e){var n=this;this.hasError&&"unmount"!==t||(this.nextThingToDo=(this.nextThingToDo||Promise.resolve()).then((function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];if(!n.unmounted||"unmount"===t)return e.apply(void 0,s(o))})).catch((function(e){throw n.nextThingToDo=Promise.resolve(),n.hasError=!0,e&&e.message&&(e.message="During '"+t+"', parcel threw an error: "+e.message),"function"==typeof n.handleError?n.handleError(e):setTimeout((function(){throw e})),e})))},t.ctorParameters=function(){return[{type:e.ElementRef}]},i([e.Input()],t.prototype,"config",void 0),i([e.Input()],t.prototype,"mountParcel",void 0),i([e.Input()],t.prototype,"onParcelMount",void 0),i([e.Input()],t.prototype,"wrapWith",void 0),i([e.Input()],t.prototype,"customProps",void 0),i([e.Input()],t.prototype,"appendTo",void 0),i([e.Input()],t.prototype,"handleError",void 0),t=i([e.Component({selector:"parcel",template:"<div></div>"})],t)}(),y=function(){function t(){}return t=i([e.NgModule({declarations:[v],exports:[v],entryComponents:[v]})],t)}();t.ParcelComponent=v,t.ParcelModule=y,t.getSingleSpaExtraProviders=function(){return[{provide:p,useClass:p,deps:[[new e.Inject(n.DOCUMENT)]]},{provide:n.PlatformLocation,useExisting:p}]},t.singleSpaAngular=function(t){if("object"!=typeof t)throw Error("single-spa-angular requires a configuration object");var e=r(r({},c),t);if("function"!=typeof e.bootstrapFunction)throw Error("single-spa-angular must be passed an opts.bootstrapFunction");if("string"!=typeof e.template)throw Error("single-spa-angular must be passed opts.template string");if(!e.NgZone)throw Error("single-spa-angular must be passed the NgZone opt");return{bootstrap:d.bind(null,e),mount:f.bind(null,e),unmount:m.bind(null,e),update:e.updateFunction}},t.ɵa=p,Object.defineProperty(t,"__esModule",{value:!0})}));
***************************************************************************** */var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var i=function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function a(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var u=t.length-1;u>=0;u--)(r=t[u])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function u(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{s(o.next(t))}catch(t){i(t)}}function u(t){try{s(o.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((o=o.apply(t,e||[])).next())}))}function s(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function p(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],o=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function c(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(l(arguments[e]));return t}var f=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.skipNextPopState=!1,e.onPopStateListeners=[],e}return function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.destroy=function(){var t,e;try{for(var n=p(this.onPopStateListeners),o=n.next();!o.done;o=n.next()){var r=o.value;window.removeEventListener("popstate",r)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.onPopStateListeners=[]},e.prototype.pushState=function(e,n,o){this.skipNextPopState=!0,t.prototype.pushState.call(this,e,n,o)},e.prototype.replaceState=function(e,n,o){this.skipNextPopState=!0,t.prototype.replaceState.call(this,e,n,o)},e.prototype.onPopState=function(e){var n=this,o=function(t){var o=!!t.singleSpa;n.skipNextPopState&&o?n.skipNextPopState=!1:n.ngZone.run((function(){return e(t)}))};this.onPopStateListeners.push(o),t.prototype.onPopState.call(this,o)},e.prototype.setNgZone=function(t){this.ngZone=t},e=a([n.Injectable()],e)}(o["ɵBrowserPlatformLocation"]);var d={NgZone:null,bootstrapFunction:null,template:null,Router:void 0,domElementGetter:void 0,AnimationEngine:void 0,updateFunction:function(){return Promise.resolve()}};function h(t,e){return u(this,void 0,void 0,(function(){return s(this,(function(n){return"noop"===t.NgZone||(t.zoneIdentifier="single-spa-angular:"+(e.name||e.appName),t.NgZone.isInAngularZone=function(){return!0===window.Zone.current._properties[t.zoneIdentifier]},t.routingEventListener=function(){t.bootstrappedNgZone.run((function(){}))}),[2]}))}))}function g(t,n){return u(this,void 0,void 0,(function(){var o,r,i,a,u,p,l;return s(this,(function(s){switch(s.label){case 0:if(!(o=e.chooseDomElementGetter(t,n)))throw Error("cannot mount angular application '"+(n.name||n.appName)+"' without a domElementGetter provided either as an opt or a prop");if(e.getContainerEl(o).innerHTML=t.template,!((r=t.bootstrapFunction(n))instanceof Promise))throw Error("single-spa-angular: the opts.bootstrapFunction must return a promise, but instead returned a '"+typeof r+"' that is not a Promise");return[4,r];case 1:if(!(i=s.sent())||"function"!=typeof i.destroy)throw Error("single-spa-angular: the opts.bootstrapFunction returned a promise that did not resolve with a valid Angular module. Did you call platformBrowser().bootstrapModuleFactory() correctly?");if(a=i.injector.get(f,null),(u="noop"!==t.NgZone)&&t.Router&&null===a)throw new Error("\t\n single-spa-angular: could not retrieve extra providers from the platform injector. Did you call getSingleSpaExtraProviders() when creating platform?\t\n ");return p=t,u&&(l=i.injector.get(t.NgZone),null!==a&&(a.setNgZone(l),i.onDestroy((function(){return a.destroy()}))),p.bootstrappedNgZone=l,p.bootstrappedNgZone._inner._properties[p.zoneIdentifier]=!0,window.addEventListener("single-spa:routing-event",p.routingEventListener)),p.bootstrappedModule=i,[2,i]}}))}))}function m(t,n){return u(this,void 0,void 0,(function(){return s(this,(function(o){return t.Router&&t.bootstrappedModule.injector.get(t.Router).dispose(),t.routingEventListener&&window.removeEventListener("single-spa:routing-event",t.routingEventListener),t.AnimationEngine&&t.bootstrappedModule.injector.get(t.AnimationEngine)._transitionEngine.flush(),t.bootstrappedModule.destroy(),delete t.bootstrappedModule,e.removeApplicationFromDOMIfIvyEnabled(t,n),[2]}))}))}var y=function(){function t(t){this.host=t,this.onParcelMount=null,this.wrapWith="div",this.customProps={},this.appendTo=null,this.handleError=function(t){return console.error(t)},this.createdDomElement=null,this.hasError=!1,this.unmounted=!0}return t.prototype.ngOnInit=function(){var t=this;if(!this.config)throw new Error("single-spa-angular's Parcel component requires the [config] binding to either be a parcel config or a loading function that returns a promise. See https://github.com/CanopyTax/single-spa-angular");this.addThingToDo("mount",(function(){var e,n=t.mountParcel;if(!n)throw new Error("\n\t\t\t\t <parcel> was not passed a [mountParcel] binding.\n\t\t\t\t If you are using <parcel> within a module that is not a single-spa application, you will need to import mountRootParcel from single-spa and pass it into <parcel> as a [mountParcel] binding\n\t\t\t\t");t.appendTo?(t.createdDomElement=e=document.createElement(t.wrapWith),t.appendTo.appendChild(e)):(t.createdDomElement=e=document.createElement(t.wrapWith),t.host.nativeElement.children[0].appendChild(e));return t.parcel=n(t.config,i({domElement:e},t.customProps)),t.onParcelMount&&t.parcel.mountPromise.then(t.onParcelMount),t.unmounted=!1,t.parcel.mountPromise}))},t.prototype.ngOnChanges=function(){var t=this;this.addThingToDo("update",(function(){if(t.parcel&&t.parcel.update)return t.parcel.update(t.customProps)}))},t.prototype.ngOnDestroy=function(){var t=this;this.addThingToDo("unmount",(function(){if(t.parcel&&"MOUNTED"===t.parcel.getStatus())return t.parcel.unmount()})),this.createdDomElement&&this.createdDomElement.parentNode.removeChild(this.createdDomElement),this.unmounted=!0},t.prototype.addThingToDo=function(t,e){var n=this;this.hasError&&"unmount"!==t||(this.nextThingToDo=(this.nextThingToDo||Promise.resolve()).then((function(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];if(!n.unmounted||"unmount"===t)return e.apply(void 0,c(o))})).catch((function(e){throw n.nextThingToDo=Promise.resolve(),n.hasError=!0,e&&e.message&&(e.message="During '"+t+"', parcel threw an error: "+e.message),"function"==typeof n.handleError?n.handleError(e):setTimeout((function(){throw e})),e})))},t.ctorParameters=function(){return[{type:n.ElementRef}]},a([n.Input()],t.prototype,"config",void 0),a([n.Input()],t.prototype,"mountParcel",void 0),a([n.Input()],t.prototype,"onParcelMount",void 0),a([n.Input()],t.prototype,"wrapWith",void 0),a([n.Input()],t.prototype,"customProps",void 0),a([n.Input()],t.prototype,"appendTo",void 0),a([n.Input()],t.prototype,"handleError",void 0),t=a([n.Component({selector:"parcel",template:"<div></div>"})],t)}(),v=function(){function t(){}return t=a([n.NgModule({declarations:[y],exports:[y],entryComponents:[y]})],t)}();t.ParcelComponent=y,t.ParcelModule=v,t.getSingleSpaExtraProviders=function(){return[{provide:f,useClass:f,deps:[[new n.Inject(o.DOCUMENT)]]},{provide:o.PlatformLocation,useExisting:f}]},t.singleSpaAngular=function(t){if("object"!=typeof t)throw Error("single-spa-angular requires a configuration object");var e=i(i({},d),t);if("function"!=typeof e.bootstrapFunction)throw Error("single-spa-angular must be passed an opts.bootstrapFunction");if("string"!=typeof e.template)throw Error("single-spa-angular must be passed opts.template string");if(!e.NgZone)throw Error("single-spa-angular must be passed the NgZone opt");return{bootstrap:h.bind(null,e),mount:g.bind(null,e),unmount:m.bind(null,e),update:e.updateFunction}},t.ɵa=f,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=single-spa-angular.umd.min.js.map

@@ -5,12 +5,55 @@ import { __decorate } from "tslib";

let SingleSpaPlatformLocation = class SingleSpaPlatformLocation extends ɵBrowserPlatformLocation {
constructor() {
super(...arguments);
// This is a simple marker that helps us to ignore PopStateEvents
// that was not dispatched by the browser.
this.skipNextPopState = false;
this.onPopStateListeners = [];
}
destroy() {
// TLDR: Angular adds `popstate` event listener and then doesn't remove it when application gets destroyed.
// Basically, Angular has a potentional memory leak. The `ɵBrowserPlatformLocation`
// has `onPopState` method which adds `popstate` event listener and forgets, see here:
// https://github.com/angular/angular/blob/14be55c9facf3e47b8c97df4502dc3f0f897da03/packages/common/src/location/platform_location.ts#L126
for (const onPopStateListener of this.onPopStateListeners) {
window.removeEventListener('popstate', onPopStateListener);
}
// We do this because the `SingleSpaPlatformLocation` is a part of PLATFORM_INJECTOR,
// which means it's created only once and will not be garbage collected, since the PLATFORM_INJECTOR
// will keep reference to its instance.
// TODO: https://github.com/single-spa/single-spa-angular/issues/170
this.onPopStateListeners = [];
}
pushState(state, title, url) {
this.skipNextPopState = true;
super.pushState(state, title, url);
}
replaceState(state, title, url) {
this.skipNextPopState = true;
super.replaceState(state, title, url);
}
onPopState(fn) {
super.onPopState(event => {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more detail
this.ngZone.run(() => fn(event));
});
const onPopStateListener = (event) => {
// The `LocationChangeEvent` doesn't have the `singleSpa` property, since it's added
// by `single-spa` starting from `5.4` version. We need this check because we want
// to skip "unnatural" PopStateEvents, the one caused by `single-spa`.
const popStateEventWasDispatchedBySingleSpa = !!event
.singleSpa;
if (this.skipNextPopState && popStateEventWasDispatchedBySingleSpa) {
this.skipNextPopState = false;
}
else {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more details
this.ngZone.run(() => fn(event));
}
};
// All listeners should be stored inside an array because the `onPopState` can be called
// multiple times thus we wanna reference all listeners to remove them further.
this.onPopStateListeners.push(onPopStateListener);
super.onPopState(onPopStateListener);
}

@@ -43,2 +86,2 @@ setNgZone(ngZone) {

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0cmEtcHJvdmlkZXJzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vc2luZ2xlLXNwYS1hbmd1bGFyLyIsInNvdXJjZXMiOlsic3JjL2V4dHJhLXByb3ZpZGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUFFLFVBQVUsRUFBMEIsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQzNFLE9BQU8sRUFDTCx3QkFBd0IsRUFDeEIsZ0JBQWdCLEVBRWhCLFFBQVEsR0FDVCxNQUFNLGlCQUFpQixDQUFDO0FBR3pCLElBQWEseUJBQXlCLEdBQXRDLE1BQWEseUJBQTBCLFNBQVEsd0JBQXdCO0lBUXJFLFVBQVUsQ0FBQyxFQUF3QztRQUNqRCxLQUFLLENBQUMsVUFBVSxDQUFDLEtBQUssQ0FBQyxFQUFFO1lBQ3ZCLDBFQUEwRTtZQUMxRSw0RUFBNEU7WUFDNUUsNkVBQTZFO1lBQzdFLCtFQUErRTtZQUMvRSxzREFBc0Q7WUFDdEQsaUZBQWlGO1lBQ2pGLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDL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c2VkIGR1cmluZyBib290c3RyYXBwaW5nLlxuICovXG5leHBvcnQgZnVuY3Rpb24gZ2V0U2luZ2xlU3BhRXh0cmFQcm92aWRlcnMoKTogU3RhdGljUHJvdmlkZXJbXSB7XG4gIHJldHVybiBbXG4gICAge1xuICAgICAgcHJvdmlkZTogU2luZ2xlU3BhUGxhdGZvcm1Mb2NhdGlvbixcbiAgICAgIHVzZUNsYXNzOiBTaW5nbGVTcGFQbGF0Zm9ybUxvY2F0aW9uLFxuICAgICAgZGVwczogW1tuZXcgSW5qZWN0KERPQ1VNRU5UKV1dLFxuICAgIH0sXG4gICAge1xuICAgICAgcHJvdmlkZTogUGxhdGZvcm1Mb2NhdGlvbixcbiAgICAgIHVzZUV4aXN0aW5nOiBTaW5nbGVTcGFQbGF0Zm9ybUxvY2F0aW9uLFxuICAgIH0sXG4gIF07XG59XG4iXX0=
import { __awaiter } from "tslib";
import { getContainerEl, chooseDomElementGetter, removeApplicationFromDOMIfIvyEnabled, } from 'single-spa-angular/internals';
import { SingleSpaPlatformLocation } from './extra-providers';

@@ -37,2 +38,8 @@ const defaultOpts = {

return __awaiter(this, void 0, void 0, function* () {
// Angular provides an opportunity to develop `zone-less` application, where developers
// have to trigger change detection manually.
// See https://angular.io/guide/zone#noopzone
if (opts.NgZone === 'noop') {
return;
}
// In order for multiple Angular apps to work concurrently on a page, they each need a unique identifier.

@@ -75,5 +82,8 @@ opts.zoneIdentifier = `single-spa-angular:${props.name || props.appName}`;

const singleSpaPlatformLocation = module.injector.get(SingleSpaPlatformLocation, null);
const ngZoneEnabled = opts.NgZone !== 'noop';
// The user has to provide `BrowserPlatformLocation` only if his application uses routing.
// So if he provided `Router` but didn't provide `BrowserPlatformLocation` then we have to inform him.
if (opts.Router && singleSpaPlatformLocation === null) {
// Also `getSingleSpaExtraProviders()` function should be called only if the user doesn't use
// `zone-less` change detection, if `NgZone` is `noop` then we can skip it.
if (ngZoneEnabled && opts.Router && singleSpaPlatformLocation === null) {
throw new Error(`

@@ -84,7 +94,16 @@ single-spa-angular: could not retrieve extra providers from the platform injector. Did you call getSingleSpaExtraProviders() when creating platform?

const bootstrappedOpts = opts;
const ngZone = module.injector.get(opts.NgZone);
singleSpaPlatformLocation.setNgZone(ngZone);
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
if (ngZoneEnabled) {
const ngZone = module.injector.get(opts.NgZone);
// `NgZone` can be enabled but routing may not be used thus `getSingleSpaExtraProviders()`
// function was not called.
if (singleSpaPlatformLocation !== null) {
singleSpaPlatformLocation.setNgZone(ngZone);
// Cleanup resources, especially remove event listeners thus they will not be added
// twice when application gets bootstrapped the second time.
module.onDestroy(() => singleSpaPlatformLocation.destroy());
}
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
}
bootstrappedOpts.bootstrappedModule = module;

@@ -102,3 +121,5 @@ return module;

}
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
if (opts.routingEventListener) {
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
}
if (opts.AnimationEngine) {

@@ -134,66 +155,7 @@ /*

delete opts.bootstrappedModule;
if (ivyEnabled()) {
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
}
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
});
}
function ivyEnabled() {
try {
// `ɵivyEnabled` variable is exposed starting from version 8.
// We use `require` here except of a single `import { ɵivyEnabled }` because the
// developer can use Angular version that doesn't expose it (all versions <8).
// The `catch` statement will handle those cases.
// eslint-disable-next-line
const { ɵivyEnabled } = require('@angular/core');
return !!ɵivyEnabled;
}
catch (_a) {
return false;
}
}
function removeApplicationFromDOMIfIvyEnabled(opts, props) {
const domElementGetter = chooseDomElementGetter(opts, props);
const domElement = getContainerEl(domElementGetter);
// View Engine removes all nodes automatically when calling `NgModuleRef.destroy()`,
// which calls `ComponentRef.destroy()`.
// Basically this will remove `app-root` or any other selector from the container element.
while (domElement.firstChild)
domElement.removeChild(domElement.firstChild);
}
function getContainerEl(domElementGetter) {
const element = domElementGetter();
if (!element) {
throw Error('domElementGetter did not return a valid dom element');
}
return element;
}
function chooseDomElementGetter(opts, props) {
props = props && props.customProps ? props.customProps : props;
if (props.domElement) {
return () => props.domElement;
}
else if (props.domElementGetter) {
return props.domElementGetter;
}
else if (opts.domElementGetter) {
return opts.domElementGetter;
}
else {
return defaultDomElementGetter(props.name);
}
}
function defaultDomElementGetter(name) {
return function getDefaultDomElement() {
const id = `single-spa-application:${name}`;
let domElement = document.getElementById(id);
if (!domElement) {
domElement = document.createElement('div');
domElement.id = id;
document.body.appendChild(domElement);
}
return domElement;
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2luZ2xlLXNwYS1hbmd1bGFyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vc2luZ2xlLXNwYS1hbmd1bGFyLyIsInNvdXJjZXMiOlsic3JjL3NpbmdsZS1zcGEtYW5ndWxhci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBR0EsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFOUQsTUFBTSxXQUFXLEdBQUc7SUFDbEIsMERBQTBEO0lBQzFELE1BQU0sRUFBRSxJQUFLO0lBQ2IsaUJBQWlCLEVBQUUsSUFBSztJQUN4QixRQUFRLEVBQUUsSUFBSztJQUNmLGdCQUFnQjtJQUNoQixNQUFNLEVBQUUsU0FBUztJQUNqQixnQkFBZ0IsRUFBRSxTQUFTO0lBQzNCL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lIGZpeDpcbiAgLy8gaHR0cHM6Ly9naXRodWIuY29tL2FuZ3VsYXIvYW5ndWxhci9pc3N1ZXMvMzY0NDlcbiAgcmVtb3ZlQXBwbGljYXRpb25Gcm9tRE9NSWZJdnlFbmFibGVkKG9wdHMsIHByb3BzKTtcbn1cbiJdfQ==

@@ -1,2 +0,2 @@

import { __decorate, __extends } from "tslib";
import { __decorate, __extends, __values } from "tslib";
import { Injectable, Inject } from '@angular/core';

@@ -7,15 +7,67 @@ import { ɵBrowserPlatformLocation, PlatformLocation, DOCUMENT, } from '@angular/common';

function SingleSpaPlatformLocation() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
// This is a simple marker that helps us to ignore PopStateEvents
// that was not dispatched by the browser.
_this.skipNextPopState = false;
_this.onPopStateListeners = [];
return _this;
}
SingleSpaPlatformLocation.prototype.destroy = function () {
// TLDR: Angular adds `popstate` event listener and then doesn't remove it when application gets destroyed.
// Basically, Angular has a potentional memory leak. The `ɵBrowserPlatformLocation`
// has `onPopState` method which adds `popstate` event listener and forgets, see here:
// https://github.com/angular/angular/blob/14be55c9facf3e47b8c97df4502dc3f0f897da03/packages/common/src/location/platform_location.ts#L126
var e_1, _a;
try {
for (var _b = __values(this.onPopStateListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
var onPopStateListener = _c.value;
window.removeEventListener('popstate', onPopStateListener);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
// We do this because the `SingleSpaPlatformLocation` is a part of PLATFORM_INJECTOR,
// which means it's created only once and will not be garbage collected, since the PLATFORM_INJECTOR
// will keep reference to its instance.
// TODO: https://github.com/single-spa/single-spa-angular/issues/170
this.onPopStateListeners = [];
};
SingleSpaPlatformLocation.prototype.pushState = function (state, title, url) {
this.skipNextPopState = true;
_super.prototype.pushState.call(this, state, title, url);
};
SingleSpaPlatformLocation.prototype.replaceState = function (state, title, url) {
this.skipNextPopState = true;
_super.prototype.replaceState.call(this, state, title, url);
};
SingleSpaPlatformLocation.prototype.onPopState = function (fn) {
var _this = this;
_super.prototype.onPopState.call(this, function (event) {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more detail
_this.ngZone.run(function () { return fn(event); });
});
var onPopStateListener = function (event) {
// The `LocationChangeEvent` doesn't have the `singleSpa` property, since it's added
// by `single-spa` starting from `5.4` version. We need this check because we want
// to skip "unnatural" PopStateEvents, the one caused by `single-spa`.
var popStateEventWasDispatchedBySingleSpa = !!event
.singleSpa;
if (_this.skipNextPopState && popStateEventWasDispatchedBySingleSpa) {
_this.skipNextPopState = false;
}
else {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more details
_this.ngZone.run(function () { return fn(event); });
}
};
// All listeners should be stored inside an array because the `onPopState` can be called
// multiple times thus we wanna reference all listeners to remove them further.
this.onPopStateListeners.push(onPopStateListener);
_super.prototype.onPopState.call(this, onPopStateListener);
};

@@ -49,2 +101,2 @@ SingleSpaPlatformLocation.prototype.setNgZone = function (ngZone) {

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXh0cmEtcHJvdmlkZXJzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vc2luZ2xlLXNwYS1hbmd1bGFyLyIsInNvdXJjZXMiOlsic3JjL2V4dHJhLXByb3ZpZGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE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gICB9LFxuICBdO1xufVxuIl19
import { __assign, __awaiter, __generator } from "tslib";
import { getContainerEl, chooseDomElementGetter, removeApplicationFromDOMIfIvyEnabled, } from 'single-spa-angular/internals';
import { SingleSpaPlatformLocation } from './extra-providers';

@@ -38,2 +39,8 @@ var defaultOpts = {

return __generator(this, function (_a) {
// Angular provides an opportunity to develop `zone-less` application, where developers
// have to trigger change detection manually.
// See https://angular.io/guide/zone#noopzone
if (opts.NgZone === 'noop') {
return [2 /*return*/];
}
// In order for multiple Angular apps to work concurrently on a page, they each need a unique identifier.

@@ -63,3 +70,3 @@ opts.zoneIdentifier = "single-spa-angular:" + (props.name || props.appName);

return __awaiter(this, void 0, void 0, function () {
var domElementGetter, containerEl, bootstrapPromise, module, singleSpaPlatformLocation, bootstrappedOpts, ngZone;
var domElementGetter, containerEl, bootstrapPromise, module, singleSpaPlatformLocation, ngZoneEnabled, bootstrappedOpts, ngZone;
return __generator(this, function (_a) {

@@ -85,13 +92,25 @@ switch (_a.label) {

singleSpaPlatformLocation = module.injector.get(SingleSpaPlatformLocation, null);
ngZoneEnabled = opts.NgZone !== 'noop';
// The user has to provide `BrowserPlatformLocation` only if his application uses routing.
// So if he provided `Router` but didn't provide `BrowserPlatformLocation` then we have to inform him.
if (opts.Router && singleSpaPlatformLocation === null) {
// Also `getSingleSpaExtraProviders()` function should be called only if the user doesn't use
// `zone-less` change detection, if `NgZone` is `noop` then we can skip it.
if (ngZoneEnabled && opts.Router && singleSpaPlatformLocation === null) {
throw new Error("\t\n single-spa-angular: could not retrieve extra providers from the platform injector. Did you call getSingleSpaExtraProviders() when creating platform?\t\n ");
}
bootstrappedOpts = opts;
ngZone = module.injector.get(opts.NgZone);
singleSpaPlatformLocation.setNgZone(ngZone);
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
if (ngZoneEnabled) {
ngZone = module.injector.get(opts.NgZone);
// `NgZone` can be enabled but routing may not be used thus `getSingleSpaExtraProviders()`
// function was not called.
if (singleSpaPlatformLocation !== null) {
singleSpaPlatformLocation.setNgZone(ngZone);
// Cleanup resources, especially remove event listeners thus they will not be added
// twice when application gets bootstrapped the second time.
module.onDestroy(function () { return singleSpaPlatformLocation.destroy(); });
}
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
}
bootstrappedOpts.bootstrappedModule = module;

@@ -112,3 +131,5 @@ return [2 /*return*/, module];

}
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
if (opts.routingEventListener) {
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
}
if (opts.AnimationEngine) {

@@ -120,7 +141,5 @@ animationEngine = opts.bootstrappedModule.injector.get(opts.AnimationEngine);

delete opts.bootstrappedModule;
if (ivyEnabled()) {
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
}
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
return [2 /*return*/];

@@ -130,59 +149,2 @@ });

}
function ivyEnabled() {
try {
// `ɵivyEnabled` variable is exposed starting from version 8.
// We use `require` here except of a single `import { ɵivyEnabled }` because the
// developer can use Angular version that doesn't expose it (all versions <8).
// The `catch` statement will handle those cases.
// eslint-disable-next-line
var ɵivyEnabled = require('@angular/core').ɵivyEnabled;
return !!ɵivyEnabled;
}
catch (_a) {
return false;
}
}
function removeApplicationFromDOMIfIvyEnabled(opts, props) {
var domElementGetter = chooseDomElementGetter(opts, props);
var domElement = getContainerEl(domElementGetter);
// View Engine removes all nodes automatically when calling `NgModuleRef.destroy()`,
// which calls `ComponentRef.destroy()`.
// Basically this will remove `app-root` or any other selector from the container element.
while (domElement.firstChild)
domElement.removeChild(domElement.firstChild);
}
function getContainerEl(domElementGetter) {
var element = domElementGetter();
if (!element) {
throw Error('domElementGetter did not return a valid dom element');
}
return element;
}
function chooseDomElementGetter(opts, props) {
props = props && props.customProps ? props.customProps : props;
if (props.domElement) {
return function () { return props.domElement; };
}
else if (props.domElementGetter) {
return props.domElementGetter;
}
else if (opts.domElementGetter) {
return opts.domElementGetter;
}
else {
return defaultDomElementGetter(props.name);
}
}
function defaultDomElementGetter(name) {
return function getDefaultDomElement() {
var id = "single-spa-application:" + name;
var domElement = document.getElementById(id);
if (!domElement) {
domElement = document.createElement('div');
domElement.id = id;
document.body.appendChild(domElement);
}
return domElement;
};
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2luZ2xlLXNwYS1hbmd1bGFyLmpzIiwic291cmNlUm9vdCI6Im5nOi8vc2luZ2xlLXNwYS1hbmd1bGFyLyIsInNvdXJjZXMiOlsic3JjL3NpbmdsZS1zcGEtYW5ndWxhci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBR0EsT0FBTyxFQUFFLHlCQUF5QixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFOUQsSUFBTSxXQUFXLEdBQUc7SUFDbEIsMERBQTBEO0lBQzFELE1BQU0sRUFBRSxJQUFLO0lBQ2IsaUJBQWlCLEVBQUUsSUFBSztJQUN4QixRQUFRLEVBQUUsSUFBSztJQUNmLGdCQUFnQjtJQUNoQixNQUFNLEVBQUUsU0FBUztJQUNqQixnQkFBZ0IsRUFBRSxTQUFTO0lBQzNCLGVBQWUsRUFBRSxTQUFTO0lBQzFCLGNBQWMsRUFBRSxjQUFNLE9BQUEsT0FBTyxDQUFDLE9BQU8sRUFBRSxFQUFqQixDQUFpQjtDQUN4QyxDQUFDO0FBRUYsTUFBTSxVQUFVLGdCQUFnQixDQUFDLFFBQThCO0lBQzdELElBQUksT0FBTyxRQ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LCBpbnN0ZWFkLCB3ZSBnZXQgaXRzIHdyYXBwZXIgY2xhc3MsIEFuaW1hdGlvbkVuZ2luZSwgYW5kIHRoZW5cbiAgICBhY2Nlc3MgaXRzIHByaXZhdGUgdmFyaWFibGUgcmVmZXJlbmNlIHRvIHRoZSBUcmFuc2l0aW9uQW5pbWF0aW9uRW5naW5lIHNvIHRoYXQgd2UgY2FuIGNhbGwgZmx1c2guXG4gICAgKi9cbiAgICBjb25zdCBhbmltYXRpb25FbmdpbmUgPSBvcHRzLmJvb3RzdHJhcHBlZE1vZHVsZS5pbmplY3Rvci5nZXQob3B0cy5BbmltYXRpb25FbmdpbmUpO1xuICAgIGFuaW1hdGlvbkVuZ2luZS5fdHJhbnNpdGlvbkVuZ2luZS5mbHVzaCgpO1xuICB9XG5cbiAgb3B0cy5ib290c3RyYXBwZWRNb2R1bGUuZGVzdHJveSgpO1xuICBkZWxldGUgb3B0cy5ib290c3RyYXBwZWRNb2R1bGU7XG5cbiAgLy8gVGhpcyBpcyBhbiBpc3N1ZS4gSXNzdWUgaGFzIGJlZW4gY3JlYXRlZCBhbmQgQW5ndWxhciB0ZWFtIGlzIHdvcmtpbmcgb24gdGhlIGZpeDpcbiAgLy8gaHR0cHM6Ly9naXRodWIuY29tL2FuZ3VsYXIvYW5ndWxhci9pc3N1ZXMvMzY0NDlcbiAgcmVtb3ZlQXBwbGljYXRpb25Gcm9tRE9NSWZJdnlFbmFibGVkKG9wdHMsIHByb3BzKTtcbn1cbiJdfQ==
import { __decorate, __awaiter } from 'tslib';
import { chooseDomElementGetter, getContainerEl, removeApplicationFromDOMIfIvyEnabled } from 'single-spa-angular/internals';
import { Injectable, Inject, ElementRef, Input, Component, NgModule } from '@angular/core';

@@ -6,12 +7,55 @@ import { ɵBrowserPlatformLocation, DOCUMENT, PlatformLocation } from '@angular/common';

let SingleSpaPlatformLocation = class SingleSpaPlatformLocation extends ɵBrowserPlatformLocation {
constructor() {
super(...arguments);
// This is a simple marker that helps us to ignore PopStateEvents
// that was not dispatched by the browser.
this.skipNextPopState = false;
this.onPopStateListeners = [];
}
destroy() {
// TLDR: Angular adds `popstate` event listener and then doesn't remove it when application gets destroyed.
// Basically, Angular has a potentional memory leak. The `ɵBrowserPlatformLocation`
// has `onPopState` method which adds `popstate` event listener and forgets, see here:
// https://github.com/angular/angular/blob/14be55c9facf3e47b8c97df4502dc3f0f897da03/packages/common/src/location/platform_location.ts#L126
for (const onPopStateListener of this.onPopStateListeners) {
window.removeEventListener('popstate', onPopStateListener);
}
// We do this because the `SingleSpaPlatformLocation` is a part of PLATFORM_INJECTOR,
// which means it's created only once and will not be garbage collected, since the PLATFORM_INJECTOR
// will keep reference to its instance.
// TODO: https://github.com/single-spa/single-spa-angular/issues/170
this.onPopStateListeners = [];
}
pushState(state, title, url) {
this.skipNextPopState = true;
super.pushState(state, title, url);
}
replaceState(state, title, url) {
this.skipNextPopState = true;
super.replaceState(state, title, url);
}
onPopState(fn) {
super.onPopState(event => {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more detail
this.ngZone.run(() => fn(event));
});
const onPopStateListener = (event) => {
// The `LocationChangeEvent` doesn't have the `singleSpa` property, since it's added
// by `single-spa` starting from `5.4` version. We need this check because we want
// to skip "unnatural" PopStateEvents, the one caused by `single-spa`.
const popStateEventWasDispatchedBySingleSpa = !!event
.singleSpa;
if (this.skipNextPopState && popStateEventWasDispatchedBySingleSpa) {
this.skipNextPopState = false;
}
else {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more details
this.ngZone.run(() => fn(event));
}
};
// All listeners should be stored inside an array because the `onPopState` can be called
// multiple times thus we wanna reference all listeners to remove them further.
this.onPopStateListeners.push(onPopStateListener);
super.onPopState(onPopStateListener);
}

@@ -78,2 +122,8 @@ setNgZone(ngZone) {

return __awaiter(this, void 0, void 0, function* () {
// Angular provides an opportunity to develop `zone-less` application, where developers
// have to trigger change detection manually.
// See https://angular.io/guide/zone#noopzone
if (opts.NgZone === 'noop') {
return;
}
// In order for multiple Angular apps to work concurrently on a page, they each need a unique identifier.

@@ -116,5 +166,8 @@ opts.zoneIdentifier = `single-spa-angular:${props.name || props.appName}`;

const singleSpaPlatformLocation = module.injector.get(SingleSpaPlatformLocation, null);
const ngZoneEnabled = opts.NgZone !== 'noop';
// The user has to provide `BrowserPlatformLocation` only if his application uses routing.
// So if he provided `Router` but didn't provide `BrowserPlatformLocation` then we have to inform him.
if (opts.Router && singleSpaPlatformLocation === null) {
// Also `getSingleSpaExtraProviders()` function should be called only if the user doesn't use
// `zone-less` change detection, if `NgZone` is `noop` then we can skip it.
if (ngZoneEnabled && opts.Router && singleSpaPlatformLocation === null) {
throw new Error(`

@@ -125,7 +178,16 @@ single-spa-angular: could not retrieve extra providers from the platform injector. Did you call getSingleSpaExtraProviders() when creating platform?

const bootstrappedOpts = opts;
const ngZone = module.injector.get(opts.NgZone);
singleSpaPlatformLocation.setNgZone(ngZone);
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
if (ngZoneEnabled) {
const ngZone = module.injector.get(opts.NgZone);
// `NgZone` can be enabled but routing may not be used thus `getSingleSpaExtraProviders()`
// function was not called.
if (singleSpaPlatformLocation !== null) {
singleSpaPlatformLocation.setNgZone(ngZone);
// Cleanup resources, especially remove event listeners thus they will not be added
// twice when application gets bootstrapped the second time.
module.onDestroy(() => singleSpaPlatformLocation.destroy());
}
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
}
bootstrappedOpts.bootstrappedModule = module;

@@ -143,3 +205,5 @@ return module;

}
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
if (opts.routingEventListener) {
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
}
if (opts.AnimationEngine) {

@@ -175,66 +239,7 @@ /*

delete opts.bootstrappedModule;
if (ivyEnabled()) {
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
}
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
});
}
function ivyEnabled() {
try {
// `ɵivyEnabled` variable is exposed starting from version 8.
// We use `require` here except of a single `import { ɵivyEnabled }` because the
// developer can use Angular version that doesn't expose it (all versions <8).
// The `catch` statement will handle those cases.
// eslint-disable-next-line
const { ɵivyEnabled } = require('@angular/core');
return !!ɵivyEnabled;
}
catch (_a) {
return false;
}
}
function removeApplicationFromDOMIfIvyEnabled(opts, props) {
const domElementGetter = chooseDomElementGetter(opts, props);
const domElement = getContainerEl(domElementGetter);
// View Engine removes all nodes automatically when calling `NgModuleRef.destroy()`,
// which calls `ComponentRef.destroy()`.
// Basically this will remove `app-root` or any other selector from the container element.
while (domElement.firstChild)
domElement.removeChild(domElement.firstChild);
}
function getContainerEl(domElementGetter) {
const element = domElementGetter();
if (!element) {
throw Error('domElementGetter did not return a valid dom element');
}
return element;
}
function chooseDomElementGetter(opts, props) {
props = props && props.customProps ? props.customProps : props;
if (props.domElement) {
return () => props.domElement;
}
else if (props.domElementGetter) {
return props.domElementGetter;
}
else if (opts.domElementGetter) {
return opts.domElementGetter;
}
else {
return defaultDomElementGetter(props.name);
}
}
function defaultDomElementGetter(name) {
return function getDefaultDomElement() {
const id = `single-spa-application:${name}`;
let domElement = document.getElementById(id);
if (!domElement) {
domElement = document.createElement('div');
domElement.id = id;
document.body.appendChild(domElement);
}
return domElement;
};
}

@@ -241,0 +246,0 @@ let ParcelComponent = class ParcelComponent {

@@ -1,2 +0,3 @@

import { __extends, __decorate, __assign, __awaiter, __generator, __spread } from 'tslib';
import { __extends, __values, __decorate, __assign, __awaiter, __generator, __spread } from 'tslib';
import { chooseDomElementGetter, getContainerEl, removeApplicationFromDOMIfIvyEnabled } from 'single-spa-angular/internals';
import { Injectable, Inject, ElementRef, Input, Component, NgModule } from '@angular/core';

@@ -8,15 +9,67 @@ import { ɵBrowserPlatformLocation, DOCUMENT, PlatformLocation } from '@angular/common';

function SingleSpaPlatformLocation() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
// This is a simple marker that helps us to ignore PopStateEvents
// that was not dispatched by the browser.
_this.skipNextPopState = false;
_this.onPopStateListeners = [];
return _this;
}
SingleSpaPlatformLocation.prototype.destroy = function () {
// TLDR: Angular adds `popstate` event listener and then doesn't remove it when application gets destroyed.
// Basically, Angular has a potentional memory leak. The `ɵBrowserPlatformLocation`
// has `onPopState` method which adds `popstate` event listener and forgets, see here:
// https://github.com/angular/angular/blob/14be55c9facf3e47b8c97df4502dc3f0f897da03/packages/common/src/location/platform_location.ts#L126
var e_1, _a;
try {
for (var _b = __values(this.onPopStateListeners), _c = _b.next(); !_c.done; _c = _b.next()) {
var onPopStateListener = _c.value;
window.removeEventListener('popstate', onPopStateListener);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
// We do this because the `SingleSpaPlatformLocation` is a part of PLATFORM_INJECTOR,
// which means it's created only once and will not be garbage collected, since the PLATFORM_INJECTOR
// will keep reference to its instance.
// TODO: https://github.com/single-spa/single-spa-angular/issues/170
this.onPopStateListeners = [];
};
SingleSpaPlatformLocation.prototype.pushState = function (state, title, url) {
this.skipNextPopState = true;
_super.prototype.pushState.call(this, state, title, url);
};
SingleSpaPlatformLocation.prototype.replaceState = function (state, title, url) {
this.skipNextPopState = true;
_super.prototype.replaceState.call(this, state, title, url);
};
SingleSpaPlatformLocation.prototype.onPopState = function (fn) {
var _this = this;
_super.prototype.onPopState.call(this, function (event) {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more detail
_this.ngZone.run(function () { return fn(event); });
});
var onPopStateListener = function (event) {
// The `LocationChangeEvent` doesn't have the `singleSpa` property, since it's added
// by `single-spa` starting from `5.4` version. We need this check because we want
// to skip "unnatural" PopStateEvents, the one caused by `single-spa`.
var popStateEventWasDispatchedBySingleSpa = !!event
.singleSpa;
if (_this.skipNextPopState && popStateEventWasDispatchedBySingleSpa) {
_this.skipNextPopState = false;
}
else {
// Wrap any event listener into zone that is specific to some application.
// The main issue is `back/forward` buttons of browsers, because they invoke
// `history.back|forward` which dispatch `popstate` event. Since `single-spa`
// overrides `history.replaceState` Angular's zone cannot intercept this event.
// Only the root zone is able to intercept all events.
// See https://github.com/single-spa/single-spa-angular/issues/94 for more details
_this.ngZone.run(function () { return fn(event); });
}
};
// All listeners should be stored inside an array because the `onPopState` can be called
// multiple times thus we wanna reference all listeners to remove them further.
this.onPopStateListeners.push(onPopStateListener);
_super.prototype.onPopState.call(this, onPopStateListener);
};

@@ -85,2 +138,8 @@ SingleSpaPlatformLocation.prototype.setNgZone = function (ngZone) {

return __generator(this, function (_a) {
// Angular provides an opportunity to develop `zone-less` application, where developers
// have to trigger change detection manually.
// See https://angular.io/guide/zone#noopzone
if (opts.NgZone === 'noop') {
return [2 /*return*/];
}
// In order for multiple Angular apps to work concurrently on a page, they each need a unique identifier.

@@ -110,3 +169,3 @@ opts.zoneIdentifier = "single-spa-angular:" + (props.name || props.appName);

return __awaiter(this, void 0, void 0, function () {
var domElementGetter, containerEl, bootstrapPromise, module, singleSpaPlatformLocation, bootstrappedOpts, ngZone;
var domElementGetter, containerEl, bootstrapPromise, module, singleSpaPlatformLocation, ngZoneEnabled, bootstrappedOpts, ngZone;
return __generator(this, function (_a) {

@@ -132,13 +191,25 @@ switch (_a.label) {

singleSpaPlatformLocation = module.injector.get(SingleSpaPlatformLocation, null);
ngZoneEnabled = opts.NgZone !== 'noop';
// The user has to provide `BrowserPlatformLocation` only if his application uses routing.
// So if he provided `Router` but didn't provide `BrowserPlatformLocation` then we have to inform him.
if (opts.Router && singleSpaPlatformLocation === null) {
// Also `getSingleSpaExtraProviders()` function should be called only if the user doesn't use
// `zone-less` change detection, if `NgZone` is `noop` then we can skip it.
if (ngZoneEnabled && opts.Router && singleSpaPlatformLocation === null) {
throw new Error("\t\n single-spa-angular: could not retrieve extra providers from the platform injector. Did you call getSingleSpaExtraProviders() when creating platform?\t\n ");
}
bootstrappedOpts = opts;
ngZone = module.injector.get(opts.NgZone);
singleSpaPlatformLocation.setNgZone(ngZone);
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
if (ngZoneEnabled) {
ngZone = module.injector.get(opts.NgZone);
// `NgZone` can be enabled but routing may not be used thus `getSingleSpaExtraProviders()`
// function was not called.
if (singleSpaPlatformLocation !== null) {
singleSpaPlatformLocation.setNgZone(ngZone);
// Cleanup resources, especially remove event listeners thus they will not be added
// twice when application gets bootstrapped the second time.
module.onDestroy(function () { return singleSpaPlatformLocation.destroy(); });
}
bootstrappedOpts.bootstrappedNgZone = ngZone;
bootstrappedOpts.bootstrappedNgZone['_inner']._properties[bootstrappedOpts.zoneIdentifier] = true;
window.addEventListener('single-spa:routing-event', bootstrappedOpts.routingEventListener);
}
bootstrappedOpts.bootstrappedModule = module;

@@ -159,3 +230,5 @@ return [2 /*return*/, module];

}
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
if (opts.routingEventListener) {
window.removeEventListener('single-spa:routing-event', opts.routingEventListener);
}
if (opts.AnimationEngine) {

@@ -167,7 +240,5 @@ animationEngine = opts.bootstrappedModule.injector.get(opts.AnimationEngine);

delete opts.bootstrappedModule;
if (ivyEnabled()) {
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
}
// This is an issue. Issue has been created and Angular team is working on the fix:
// https://github.com/angular/angular/issues/36449
removeApplicationFromDOMIfIvyEnabled(opts, props);
return [2 /*return*/];

@@ -177,59 +248,2 @@ });

}
function ivyEnabled() {
try {
// `ɵivyEnabled` variable is exposed starting from version 8.
// We use `require` here except of a single `import { ɵivyEnabled }` because the
// developer can use Angular version that doesn't expose it (all versions <8).
// The `catch` statement will handle those cases.
// eslint-disable-next-line
var ɵivyEnabled = require('@angular/core').ɵivyEnabled;
return !!ɵivyEnabled;
}
catch (_a) {
return false;
}
}
function removeApplicationFromDOMIfIvyEnabled(opts, props) {
var domElementGetter = chooseDomElementGetter(opts, props);
var domElement = getContainerEl(domElementGetter);
// View Engine removes all nodes automatically when calling `NgModuleRef.destroy()`,
// which calls `ComponentRef.destroy()`.
// Basically this will remove `app-root` or any other selector from the container element.
while (domElement.firstChild)
domElement.removeChild(domElement.firstChild);
}
function getContainerEl(domElementGetter) {
var element = domElementGetter();
if (!element) {
throw Error('domElementGetter did not return a valid dom element');
}
return element;
}
function chooseDomElementGetter(opts, props) {
props = props && props.customProps ? props.customProps : props;
if (props.domElement) {
return function () { return props.domElement; };
}
else if (props.domElementGetter) {
return props.domElementGetter;
}
else if (opts.domElementGetter) {
return opts.domElementGetter;
}
else {
return defaultDomElementGetter(props.name);
}
}
function defaultDomElementGetter(name) {
return function getDefaultDomElement() {
var id = "single-spa-application:" + name;
var domElement = document.getElementById(id);
if (!domElement) {
domElement = document.createElement('div');
domElement.id = id;
document.body.appendChild(domElement);
}
return domElement;
};
}

@@ -236,0 +250,0 @@ var ParcelComponent = /** @class */ (function () {

{
"$schema": "../node_modules/ng-packagr/ng-package.schema.json",
"name": "single-spa-angular",
"version": "4.0.1",
"version": "4.1.0-alpha.0",
"description": "Helpers for building single-spa applications which use Angular 2",

@@ -6,0 +6,0 @@ "schematics": "./schematics/schematics.json",

import { NodeDependency } from '@schematics/angular/utility/dependencies';
export declare function getSingleSpaDependency(): NodeDependency;
export declare function getSingleSpaAngularDependency(): NodeDependency;

@@ -3,0 +4,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dependencies_1 = require("@schematics/angular/utility/dependencies");
const { version, peerDependencies, dependencies } = require('../../package.json');
function getSingleSpaDependency() {
const singleSpaVersion = (peerDependencies === null || peerDependencies === void 0 ? void 0 : peerDependencies['single-spa']) || (dependencies === null || dependencies === void 0 ? void 0 : dependencies['single-spa']) || 'latest';
return {
name: 'single-spa',
version: singleSpaVersion,
overwrite: true,
type: dependencies_1.NodeDependencyType.Default,
};
}
exports.getSingleSpaDependency = getSingleSpaDependency;
function getSingleSpaAngularDependency() {
return {
name: 'single-spa-angular',
version: require('../../package.json').version,
version,
overwrite: false,

@@ -9,0 +20,0 @@ type: dependencies_1.NodeDependencyType.Default,

@@ -20,2 +20,3 @@ "use strict";

const dependencies = [
dependencies_2.getSingleSpaDependency(),
dependencies_2.getSingleSpaAngularDependency(),

@@ -22,0 +23,0 @@ dependencies_2.getAngularBuildersCustomWebpackDependency(),

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@angular/common","name":"ɵBrowserPlatformLocation","line":9,"character":47},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"onPopState":[{"__symbolic":"method"}],"setNgZone":[{"__symbolic":"method"}]}},"singleSpaAngular":{"__symbolic":"function"},"getSingleSpaExtraProviders":{"__symbolic":"function","parameters":[],"value":[{"provide":{"__symbolic":"reference","name":"ɵa"},"useClass":{"__symbolic":"reference","name":"ɵa"},"deps":[[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":44,"character":18},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":44,"character":25}]}]]},{"provide":{"__symbolic":"reference","module":"@angular/common","name":"PlatformLocation","line":47,"character":15},"useExisting":{"__symbolic":"reference","name":"ɵa"}}]},"ParcelModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"ParcelComponent"}],"exports":[{"__symbolic":"reference","name":"ParcelComponent"}],"entryComponents":[{"__symbolic":"reference","name":"ParcelComponent"}]}]}],"members":{}},"ParcelComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":3,"character":1},"arguments":[{"selector":"parcel","template":"<div></div>"}]}],"members":{"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":8,"character":3}}]}],"mountParcel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":9,"character":3}}]}],"onParcelMount":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":3}}]}],"wrapWith":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"customProps":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"appendTo":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"handleError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":23,"character":39,"context":{"typeName":"HTMLElement"},"module":"./src/parcel-lib/parcel.component"}]}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"addThingToDo":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/extra-providers","singleSpaAngular":"./src/single-spa-angular","getSingleSpaExtraProviders":"./src/extra-providers","ParcelModule":"./src/parcel-lib/index","ParcelComponent":"./src/parcel-lib/parcel.component"},"importAs":"single-spa-angular"}
{"__symbolic":"module","version":4,"metadata":{"ɵa":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@angular/common","name":"ɵBrowserPlatformLocation","line":9,"character":47},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1}}],"members":{"destroy":[{"__symbolic":"method"}],"pushState":[{"__symbolic":"method"}],"replaceState":[{"__symbolic":"method"}],"onPopState":[{"__symbolic":"method"}],"setNgZone":[{"__symbolic":"method"}]}},"singleSpaAngular":{"__symbolic":"function"},"getSingleSpaExtraProviders":{"__symbolic":"function","parameters":[],"value":[{"provide":{"__symbolic":"reference","name":"ɵa"},"useClass":{"__symbolic":"reference","name":"ɵa"},"deps":[[{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":87,"character":18},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":87,"character":25}]}]]},{"provide":{"__symbolic":"reference","module":"@angular/common","name":"PlatformLocation","line":90,"character":15},"useExisting":{"__symbolic":"reference","name":"ɵa"}}]},"ParcelModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"ParcelComponent"}],"exports":[{"__symbolic":"reference","name":"ParcelComponent"}],"entryComponents":[{"__symbolic":"reference","name":"ParcelComponent"}]}]}],"members":{}},"ParcelComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":3,"character":1},"arguments":[{"selector":"parcel","template":"<div></div>"}]}],"members":{"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":8,"character":3}}]}],"mountParcel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":9,"character":3}}]}],"onParcelMount":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":3}}]}],"wrapWith":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"customProps":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"appendTo":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"handleError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":23,"character":39,"context":{"typeName":"HTMLElement"},"module":"./src/parcel-lib/parcel.component"}]}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"addThingToDo":[{"__symbolic":"method"}]}}},"origins":{"ɵa":"./src/extra-providers","singleSpaAngular":"./src/single-spa-angular","getSingleSpaExtraProviders":"./src/extra-providers","ParcelModule":"./src/parcel-lib/index","ParcelComponent":"./src/parcel-lib/parcel.component"},"importAs":"single-spa-angular"}
import { NgZone, StaticProvider } from '@angular/core';
import { ɵBrowserPlatformLocation, LocationChangeEvent } from '@angular/common';
export declare class SingleSpaPlatformLocation extends ɵBrowserPlatformLocation {
/**
* We could use the `inject` function from `@angular/core` which resolves
* dependencies from the currently active injector, but it's a feature
* of Angular 8+. Should be used when we drop support for older versions.
*/
private ngZone;
private skipNextPopState;
private onPopStateListeners;
destroy(): void;
pushState(state: any, title: string, url: string): void;
replaceState(state: any, title: string, url: string): void;
onPopState(fn: (event: LocationChangeEvent) => void): void;

@@ -11,0 +11,0 @@ setNgZone(ngZone: NgZone): void;

@@ -1,13 +0,3 @@

import { NgZone, Type, NgModuleRef } from '@angular/core';
import { AppProps, LifeCycles } from 'single-spa';
import { LifeCycles } from 'single-spa';
import { SingleSpaAngularOpts } from 'single-spa-angular/internals';
export declare function singleSpaAngular(userOpts: SingleSpaAngularOpts): LifeCycles;
interface SingleSpaAngularOpts {
NgZone: typeof NgZone;
bootstrapFunction(props: AppProps): Promise<NgModuleRef<any>>;
updateFunction?(props: AppProps): Promise<any>;
template: string;
Router?: Type<any>;
domElementGetter?(): HTMLElement;
AnimationEngine?: Type<any>;
}
export {};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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