piral-ng 0.15.0-beta.4803 → 0.15.0-beta.4812
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/RoutingService.js +33 -4
- package/esm/RoutingService.js.map +1 -1
- package/esm/bootstrap.d.ts +3 -2
- package/esm/bootstrap.js +41 -19
- package/esm/bootstrap.js.map +1 -1
- package/esm/converter.js +10 -5
- package/esm/converter.js.map +1 -1
- package/esm/module.d.ts +20 -1
- package/esm/module.js +35 -13
- package/esm/module.js.map +1 -1
- package/esm/queue.d.ts +1 -1
- package/esm/queue.js.map +1 -1
- package/esm/startup.d.ts +1 -0
- package/esm/startup.js +51 -35
- package/esm/startup.js.map +1 -1
- package/esm/types.d.ts +31 -3
- package/esm/utils.d.ts +2 -0
- package/esm/utils.js +7 -0
- package/esm/utils.js.map +1 -1
- package/lib/RoutingService.js +33 -4
- package/lib/RoutingService.js.map +1 -1
- package/lib/bootstrap.d.ts +3 -2
- package/lib/bootstrap.js +41 -19
- package/lib/bootstrap.js.map +1 -1
- package/lib/converter.js +10 -5
- package/lib/converter.js.map +1 -1
- package/lib/module.d.ts +20 -1
- package/lib/module.js +38 -14
- package/lib/module.js.map +1 -1
- package/lib/queue.d.ts +1 -1
- package/lib/queue.js.map +1 -1
- package/lib/startup.d.ts +1 -0
- package/lib/startup.js +52 -35
- package/lib/startup.js.map +1 -1
- package/lib/types.d.ts +31 -3
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +10 -1
- package/lib/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/RoutingService.ts +36 -4
- package/src/bootstrap.ts +48 -21
- package/src/converter.ts +13 -8
- package/src/module.ts +37 -13
- package/src/queue.ts +1 -1
- package/src/startup.ts +61 -39
- package/src/types.ts +29 -3
- package/src/utils.ts +9 -0
package/esm/RoutingService.js
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { Inject, Injectable, NgZone, Optional } from '@angular/core';
|
|
3
3
|
import { NavigationError, Router } from '@angular/router';
|
|
4
|
+
import { ɵBrowserPlatformLocation } from '@angular/common';
|
|
5
|
+
const noop = function () { };
|
|
6
|
+
// deactivates the usual platform behavior; all these operations are performed via the RoutingService
|
|
7
|
+
// to avoid any conflict, e.g., double-booking URL changes in React and Angular
|
|
8
|
+
ɵBrowserPlatformLocation.prototype.pushState = noop;
|
|
9
|
+
ɵBrowserPlatformLocation.prototype.replaceState = noop;
|
|
10
|
+
ɵBrowserPlatformLocation.prototype.forward = noop;
|
|
11
|
+
ɵBrowserPlatformLocation.prototype.back = noop;
|
|
12
|
+
ɵBrowserPlatformLocation.prototype.historyGo = noop;
|
|
13
|
+
function normalize(url) {
|
|
14
|
+
const search = url.indexOf('?');
|
|
15
|
+
const hash = url.indexOf('#');
|
|
16
|
+
if (search !== -1 || hash !== -1) {
|
|
17
|
+
if (search === -1) {
|
|
18
|
+
return url.substring(0, hash);
|
|
19
|
+
}
|
|
20
|
+
else if (hash === -1) {
|
|
21
|
+
return url.substring(0, search);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return url.substring(0, Math.min(search, hash));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return url;
|
|
28
|
+
}
|
|
4
29
|
let RoutingService = class RoutingService {
|
|
5
30
|
constructor(context, router, zone) {
|
|
6
31
|
this.context = context;
|
|
@@ -19,21 +44,25 @@ let RoutingService = class RoutingService {
|
|
|
19
44
|
this.dispose = nav.listen(({ location }) => {
|
|
20
45
|
const path = location.pathname;
|
|
21
46
|
if (!this.invalidRoutes.includes(path)) {
|
|
22
|
-
const url = path
|
|
47
|
+
const url = `${path}${location.search}${location.hash}`;
|
|
23
48
|
this.zone.run(() => this.router.navigateByUrl(url));
|
|
24
49
|
}
|
|
25
50
|
});
|
|
26
51
|
this.subscription = this.router.events.subscribe((e) => {
|
|
27
52
|
if (e instanceof NavigationError) {
|
|
28
|
-
const
|
|
53
|
+
const routerUrl = e.url;
|
|
54
|
+
const path = normalize(routerUrl);
|
|
55
|
+
const locationUrl = nav.url;
|
|
29
56
|
if (!this.invalidRoutes.includes(path)) {
|
|
30
57
|
this.invalidRoutes.push(path);
|
|
31
58
|
}
|
|
32
|
-
|
|
59
|
+
if (routerUrl !== locationUrl) {
|
|
60
|
+
nav.push(routerUrl);
|
|
61
|
+
}
|
|
33
62
|
}
|
|
34
63
|
else if (e.type === 15) {
|
|
35
64
|
// consistency check to avoid #535 and other Angular-specific issues
|
|
36
|
-
const locationUrl = nav.
|
|
65
|
+
const locationUrl = nav.url;
|
|
37
66
|
const routerUrl = e.routerEvent.url;
|
|
38
67
|
if (routerUrl !== locationUrl) {
|
|
39
68
|
nav.push(routerUrl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RoutingService.js","sourceRoot":"","sources":["../src/RoutingService.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAa,QAAQ,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,EAAU,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"RoutingService.js","sourceRoot":"","sources":["../src/RoutingService.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAa,QAAQ,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,EAAU,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,IAAI,GAAG,cAAa,CAAC,CAAC;AAE5B,qGAAqG;AACrG,+EAA+E;AAC/E,wBAAwB,CAAC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC;AACpD,wBAAwB,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC;AACvD,wBAAwB,CAAC,SAAS,CAAC,OAAO,GAAG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C,GAAG,CAAC;oBAEpC,IAAI,SAAS,KAAK,WAAW,EAAE;wBAC7B,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;qBACrB;iBACF;YACH,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,WAAW;;QACT,MAAA,IAAI,CAAC,OAAO,oDAAI,CAAC;QACjB,MAAA,IAAI,CAAC,YAAY,0CAAE,WAAW,EAAE,CAAC;IACnC,CAAC;CACF,CAAA;AA5DY,cAAc;IAD1B,UAAU,EAAE;IAOR,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;IACjB,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,QAAQ,EAAE,CAAA;6CADiB,MAAM;QACR,MAAM;GARvB,cAAc,CA4D1B;SA5DY,cAAc"}
|
package/esm/bootstrap.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BaseComponentProps, ComponentContext, Disposable, PiletApi } from 'piral-core';
|
|
2
2
|
import type { BehaviorSubject } from 'rxjs';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { Type } from '@angular/core';
|
|
4
|
+
import type { NgLazyType, PrepareBootstrapResult } from './types';
|
|
5
|
+
export declare function prepareBootstrap(moduleOrComponent: Type<any> | NgLazyType, piral: PiletApi): Promise<PrepareBootstrapResult>;
|
|
5
6
|
export declare function bootstrap<TProps extends BaseComponentProps>(result: PrepareBootstrapResult, node: HTMLElement, props: BehaviorSubject<TProps>, context: ComponentContext): Promise<Disposable>;
|
package/esm/bootstrap.js
CHANGED
|
@@ -1,25 +1,47 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
+
import { createModuleInstance, getModuleInstance, defineModule, findModule, activateModuleInstance } from './module';
|
|
3
|
+
import { getAnnotations, hasSelector } from './utils';
|
|
2
4
|
import { startup } from './startup';
|
|
3
|
-
import { getAnnotations } from './utils';
|
|
4
|
-
import { createModuleInstance, getModuleInstance, defineModule } from './module';
|
|
5
5
|
export function prepareBootstrap(moduleOrComponent, piral) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7
|
+
if ('module' in moduleOrComponent && typeof moduleOrComponent.module === 'function') {
|
|
8
|
+
if (!(moduleOrComponent.state.current instanceof Promise)) {
|
|
9
|
+
moduleOrComponent.state.current = moduleOrComponent.module().then((result) => {
|
|
10
|
+
if (typeof result !== 'object' || !('default' in result)) {
|
|
11
|
+
throw new Error('The lazy loaded module does not `default` export a NgModule class.');
|
|
12
|
+
}
|
|
13
|
+
defineModule(result.default, moduleOrComponent.opts);
|
|
14
|
+
return findModule(result.default);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
const moduleDef = yield moduleOrComponent.state.current;
|
|
18
|
+
const { components } = moduleDef;
|
|
19
|
+
const component = components.find((m) => hasSelector(m, moduleOrComponent.selector));
|
|
20
|
+
if (!component) {
|
|
21
|
+
throw new Error(`No component matching the selector "${moduleOrComponent.selector}" has been found.`);
|
|
22
|
+
}
|
|
23
|
+
return [...activateModuleInstance(moduleDef, piral), component];
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const [annotation] = getAnnotations(moduleOrComponent);
|
|
27
|
+
const standalone = annotation === null || annotation === void 0 ? void 0 : annotation.standalone;
|
|
28
|
+
// first way is to directly use a module, which is the legacy way
|
|
29
|
+
// second way is to find a previously defined Angular module
|
|
30
|
+
if (annotation && annotation.bootstrap) {
|
|
31
|
+
// usually contains things like imports, exports, declarations, ...
|
|
32
|
+
const [component] = annotation.bootstrap;
|
|
33
|
+
annotation.exports = [component];
|
|
34
|
+
defineModule(moduleOrComponent);
|
|
35
|
+
return [...getModuleInstance(component, standalone, piral), component];
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// usually contains things like selector, template or templateUrl, changeDetection, ...
|
|
39
|
+
const result = getModuleInstance(moduleOrComponent, standalone, piral) ||
|
|
40
|
+
createModuleInstance(moduleOrComponent, standalone, piral);
|
|
41
|
+
return [...result, moduleOrComponent];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
23
45
|
}
|
|
24
46
|
export function bootstrap(result, node, props, context) {
|
|
25
47
|
return __awaiter(this, void 0, void 0, function* () {
|
package/esm/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACrH,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAgB,gBAAgB,CACpC,iBAAyC,EACzC,KAAe;;QAEf,IAAI,QAAQ,IAAI,iBAAiB,IAAI,OAAO,iBAAiB,CAAC,MAAM,KAAK,UAAU,EAAE;YACnF,IAAI,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,YAAY,OAAO,CAAC,EAAE;gBACzD,iBAAiB,CAAC,KAAK,CAAC,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC3E,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE;wBACxD,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;qBAC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;oBACvD,oBAAoB,CAAC,iBAAiB,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;gBAC7D,OAAO,CAAC,GAAG,MAAM,EAAE,iBAAiB,CAAC,CAAC;aACvC;SACF;IACH,CAAC;CAAA;AAED,MAAM,UAAgB,SAAS,CAC7B,MAA8B,EAC9B,IAAiB,EACjB,KAA8B,EAC9B,OAAyB;;QAEzB,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC;QACtD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,cAAc,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QAE9D,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC5C,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SACnD;QAED,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;CAAA"}
|
package/esm/converter.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import { BehaviorSubject } from 'rxjs';
|
|
2
3
|
import { NgExtension } from './NgExtension';
|
|
3
4
|
import { enqueue } from './queue';
|
|
@@ -8,23 +9,27 @@ export function createConverter(_ = {}) {
|
|
|
8
9
|
const convert = (component) => ({
|
|
9
10
|
mount(el, props, ctx, locals) {
|
|
10
11
|
locals.active = true;
|
|
11
|
-
if (!registry.has(component)) {
|
|
12
|
-
registry.set(component, prepareBootstrap(component, props.piral));
|
|
13
|
-
}
|
|
14
12
|
if (!locals.props) {
|
|
15
13
|
locals.props = new BehaviorSubject(props);
|
|
16
14
|
}
|
|
17
15
|
if (!locals.queued) {
|
|
18
16
|
locals.queued = Promise.resolve();
|
|
19
17
|
}
|
|
20
|
-
locals.queued = locals.queued.then(() => enqueue(() =>
|
|
18
|
+
locals.queued = locals.queued.then(() => enqueue(() => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
if (!registry.has(component)) {
|
|
20
|
+
registry.set(component, yield prepareBootstrap(component, props.piral));
|
|
21
|
+
}
|
|
22
|
+
if (locals.active) {
|
|
23
|
+
bootstrap(registry.get(component), el, locals.props, ctx);
|
|
24
|
+
}
|
|
25
|
+
})));
|
|
21
26
|
},
|
|
22
27
|
update(el, props, ctx, locals) {
|
|
23
28
|
locals.props.next(props);
|
|
24
29
|
},
|
|
25
30
|
unmount(el, locals) {
|
|
26
31
|
locals.active = false;
|
|
27
|
-
locals.queued = locals.queued.then((dispose) => dispose && dispose
|
|
32
|
+
locals.queued = locals.queued.then((dispose) => dispose && enqueue(dispose));
|
|
28
33
|
},
|
|
29
34
|
});
|
|
30
35
|
convert.defineModule = defineModule;
|
package/esm/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAgB1D,MAAM,UAAU,eAAe,CAAC,IAAwB,EAAE;IACxD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA+B,CAAC;IACxD,MAAM,OAAO,GAAG,CAAoC,SAAiC,EAA4B,EAAE,CAAC,CAAC;QACnH,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAuB;YAC3C,MAAM,CAAC,MAAM,GAAG,IAAI,CA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"}
|
package/esm/module.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import type { PiletApi } from 'piral-core';
|
|
2
2
|
import type { NgOptions, ModuleInstanceResult } from './types';
|
|
3
|
+
interface ModuleDefinition {
|
|
4
|
+
active: any;
|
|
5
|
+
module: any;
|
|
6
|
+
components: Array<any>;
|
|
7
|
+
opts: NgOptions;
|
|
8
|
+
}
|
|
9
|
+
export declare function activateModuleInstance(moduleDef: ModuleDefinition, piral: PiletApi): ModuleInstanceResult;
|
|
3
10
|
export declare function getModuleInstance(component: any, standalone: boolean, piral: PiletApi): ModuleInstanceResult;
|
|
4
11
|
export declare function createModuleInstance(component: any, standalone: boolean, piral: PiletApi): ModuleInstanceResult;
|
|
5
|
-
export declare function
|
|
12
|
+
export declare function findModule(module: any): ModuleDefinition;
|
|
13
|
+
export declare function defineModule(module: any, opts?: NgOptions): (selector: string) => {
|
|
14
|
+
component: {
|
|
15
|
+
selector: string;
|
|
16
|
+
module: any;
|
|
17
|
+
opts: (import("@angular/core").CompilerOptions & import("@angular/core").BootstrapOptions) | (import("@angular/core").CompilerOptions & import("@angular/core").BootstrapOptions)[];
|
|
18
|
+
state: {
|
|
19
|
+
current: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type: "ng";
|
|
23
|
+
};
|
|
24
|
+
export {};
|
package/esm/module.js
CHANGED
|
@@ -2,11 +2,13 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import { BrowserModule } from '@angular/platform-browser';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { ComponentFactoryResolver, CUSTOM_ELEMENTS_SCHEMA, NgModule, NgZone, } from '@angular/core';
|
|
5
|
+
import { teardown } from './startup';
|
|
5
6
|
import { RoutingService } from './RoutingService';
|
|
6
7
|
import { SharedModule } from './SharedModule';
|
|
7
8
|
import { findComponents, getAnnotations } from './utils';
|
|
8
9
|
const availableModules = [];
|
|
9
10
|
function instantiateModule(moduleDef, piral) {
|
|
11
|
+
var BootstrapModule_1;
|
|
10
12
|
const { module, components } = moduleDef;
|
|
11
13
|
const imports = [BrowserModule, SharedModule, module];
|
|
12
14
|
const props = { current: undefined };
|
|
@@ -15,7 +17,7 @@ function instantiateModule(moduleDef, piral) {
|
|
|
15
17
|
{ provide: 'Props', useFactory: () => props.current.value, deps: [] },
|
|
16
18
|
{ provide: 'piral', useFactory: () => piral, deps: [] },
|
|
17
19
|
];
|
|
18
|
-
let BootstrapModule = class BootstrapModule {
|
|
20
|
+
let BootstrapModule = BootstrapModule_1 = class BootstrapModule {
|
|
19
21
|
constructor(resolver, zone, routing) {
|
|
20
22
|
this.resolver = resolver;
|
|
21
23
|
this.zone = zone;
|
|
@@ -51,9 +53,12 @@ function instantiateModule(moduleDef, piral) {
|
|
|
51
53
|
this.refs.splice(i, 1);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
56
|
+
if (this.refs.length === 0) {
|
|
57
|
+
teardown(BootstrapModule_1);
|
|
58
|
+
}
|
|
54
59
|
}
|
|
55
60
|
};
|
|
56
|
-
BootstrapModule = __decorate([
|
|
61
|
+
BootstrapModule = BootstrapModule_1 = __decorate([
|
|
57
62
|
NgModule({
|
|
58
63
|
imports,
|
|
59
64
|
entryComponents: components,
|
|
@@ -63,13 +68,16 @@ function instantiateModule(moduleDef, piral) {
|
|
|
63
68
|
], BootstrapModule);
|
|
64
69
|
return BootstrapModule;
|
|
65
70
|
}
|
|
71
|
+
export function activateModuleInstance(moduleDef, piral) {
|
|
72
|
+
if (!moduleDef.active) {
|
|
73
|
+
moduleDef.active = instantiateModule(moduleDef, piral);
|
|
74
|
+
}
|
|
75
|
+
return [moduleDef.active, moduleDef.opts];
|
|
76
|
+
}
|
|
66
77
|
export function getModuleInstance(component, standalone, piral) {
|
|
67
78
|
const [moduleDef] = availableModules.filter((m) => m.components.includes(component));
|
|
68
79
|
if (moduleDef) {
|
|
69
|
-
|
|
70
|
-
moduleDef.active = instantiateModule(moduleDef, piral);
|
|
71
|
-
}
|
|
72
|
-
return [moduleDef.active, moduleDef.opts];
|
|
80
|
+
return activateModuleInstance(moduleDef, piral);
|
|
73
81
|
}
|
|
74
82
|
if (process.env.NODE_ENV === 'development') {
|
|
75
83
|
if (!standalone) {
|
|
@@ -96,13 +104,27 @@ export function createModuleInstance(component, standalone, piral) {
|
|
|
96
104
|
defineModule(Module);
|
|
97
105
|
return getModuleInstance(component, standalone, piral);
|
|
98
106
|
}
|
|
107
|
+
export function findModule(module) {
|
|
108
|
+
return availableModules.find(m => m.module === module);
|
|
109
|
+
}
|
|
99
110
|
export function defineModule(module, opts = undefined) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
if (typeof module !== 'function') {
|
|
112
|
+
const [annotation] = getAnnotations(module);
|
|
113
|
+
availableModules.push({
|
|
114
|
+
active: undefined,
|
|
115
|
+
components: findComponents(annotation.exports),
|
|
116
|
+
module,
|
|
117
|
+
opts,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
const state = {
|
|
122
|
+
current: undefined,
|
|
123
|
+
};
|
|
124
|
+
return (selector) => ({
|
|
125
|
+
component: { selector, module, opts, state },
|
|
126
|
+
type: 'ng',
|
|
127
|
+
});
|
|
128
|
+
}
|
|
107
129
|
}
|
|
108
130
|
//# sourceMappingURL=module.js.map
|
package/esm/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAEL,wBAAwB,EAExB,sBAAsB,EACtB,QAAQ,EACR,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CA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C,UAAU,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAC5C,gBAAgB,CAAC,IAAI,CAAC;YACpB,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC;YAC9C,MAAM;YACN,IAAI;SACL,CAAC,CAAC;KACJ;SAAM;QACL,MAAM,KAAK,GAAG;YACZ,OAAO,EAAE,SAAS;SACnB,CAAC;QAEF,OAAO,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC;YAC5B,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE;YAC5C,IAAI,EAAE,IAAa;SACpB,CAAC,CAAC;KACJ;AACH,CAAC"}
|
package/esm/queue.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function enqueue<T>(callback: () => Promise<T>): Promise<T>;
|
|
1
|
+
export declare function enqueue<T>(callback: () => T | Promise<T>): Promise<T>;
|
package/esm/queue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;AAE9B,MAAM,UAAU,OAAO,CAAI,
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;AAE9B,MAAM,UAAU,OAAO,CAAI,QAA8B;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/esm/startup.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ import { NgModuleRef } from '@angular/core';
|
|
|
4
4
|
export declare type NgModuleInt = NgModuleRef<any> & {
|
|
5
5
|
_destroyed: boolean;
|
|
6
6
|
};
|
|
7
|
+
export declare function teardown(BootstrapModule: any): void;
|
|
7
8
|
export declare function startup(BootstrapModule: any, context: ComponentContext, ngOptions?: NgOptions): Promise<void | NgModuleInt>;
|
package/esm/startup.js
CHANGED
|
@@ -1,51 +1,67 @@
|
|
|
1
1
|
import { enableProdMode, NgZone } from '@angular/core';
|
|
2
2
|
import { APP_BASE_HREF } from '@angular/common';
|
|
3
3
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
4
|
-
import { getNgVersion } from './utils';
|
|
4
|
+
import { getId, getNgVersion } from './utils';
|
|
5
5
|
function getVersionHandler(versions) {
|
|
6
6
|
const major = getNgVersion();
|
|
7
7
|
const version = `v${major}`;
|
|
8
8
|
return versions[version];
|
|
9
9
|
}
|
|
10
10
|
const runningModules = [];
|
|
11
|
+
function startNew(BootstrapModule, context, ngOptions) {
|
|
12
|
+
const path = context.publicPath || '/';
|
|
13
|
+
const platform = platformBrowserDynamic([
|
|
14
|
+
{ provide: 'Context', useValue: context },
|
|
15
|
+
{ provide: APP_BASE_HREF, useValue: path },
|
|
16
|
+
]);
|
|
17
|
+
const id = getId();
|
|
18
|
+
const zoneIdentifier = `piral-ng:${id}`;
|
|
19
|
+
// This is a hack, since NgZone doesn't allow you to configure the property that identifies your zone.
|
|
20
|
+
// See:
|
|
21
|
+
// - https://github.com/PlaceMe-SAS/single-spa-angular-cli/issues/33
|
|
22
|
+
// - https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L144
|
|
23
|
+
// - https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L257
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
NgZone.isInAngularZone = () => window.Zone.current._properties[zoneIdentifier] === true;
|
|
26
|
+
return platform
|
|
27
|
+
.bootstrapModule(BootstrapModule, ngOptions)
|
|
28
|
+
.catch((err) => console.log(err))
|
|
29
|
+
.then((instance) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (instance) {
|
|
32
|
+
const zone = instance.injector.get(NgZone);
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
const z = (_a = zone === null || zone === void 0 ? void 0 : zone._inner) !== null && _a !== void 0 ? _a : zone === null || zone === void 0 ? void 0 : zone.inner;
|
|
35
|
+
if (z && '_properties' in z) {
|
|
36
|
+
z._properties[zoneIdentifier] = true;
|
|
37
|
+
}
|
|
38
|
+
runningModules.push([BootstrapModule, instance, platform]);
|
|
39
|
+
}
|
|
40
|
+
return instance;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export function teardown(BootstrapModule) {
|
|
44
|
+
const runningModuleIndex = runningModules.findIndex(([ref]) => ref === BootstrapModule);
|
|
45
|
+
if (runningModuleIndex !== -1) {
|
|
46
|
+
const [, , platform] = runningModules[runningModuleIndex];
|
|
47
|
+
runningModules.splice(runningModuleIndex, 1);
|
|
48
|
+
if (!platform.destroyed) {
|
|
49
|
+
platform.destroy();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
11
53
|
export function startup(BootstrapModule, context, ngOptions) {
|
|
12
54
|
const runningModule = runningModules.find(([ref]) => ref === BootstrapModule);
|
|
13
55
|
if (runningModule) {
|
|
14
|
-
const [, instance] = runningModule;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{ provide: APP_BASE_HREF, useValue: path },
|
|
22
|
-
]);
|
|
23
|
-
const id = Math.random().toString(36);
|
|
24
|
-
const zoneIdentifier = `piral-ng:${id}`;
|
|
25
|
-
// This is a hack, since NgZone doesn't allow you to configure the property that identifies your zone.
|
|
26
|
-
// See:
|
|
27
|
-
// - https://github.com/PlaceMe-SAS/single-spa-angular-cli/issues/33
|
|
28
|
-
// - https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L144
|
|
29
|
-
// - https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L257
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
NgZone.isInAngularZone = () => window.Zone.current._properties[zoneIdentifier] === true;
|
|
32
|
-
return platform
|
|
33
|
-
.bootstrapModule(BootstrapModule, ngOptions)
|
|
34
|
-
.catch((err) => console.log(err))
|
|
35
|
-
.then((instance) => {
|
|
36
|
-
var _a;
|
|
37
|
-
if (instance) {
|
|
38
|
-
const zone = instance.injector.get(NgZone);
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
const z = (_a = zone === null || zone === void 0 ? void 0 : zone._inner) !== null && _a !== void 0 ? _a : zone === null || zone === void 0 ? void 0 : zone.inner;
|
|
41
|
-
if (z && '_properties' in z) {
|
|
42
|
-
z._properties[zoneIdentifier] = true;
|
|
43
|
-
}
|
|
44
|
-
runningModules.push([BootstrapModule, instance]);
|
|
45
|
-
}
|
|
46
|
-
return instance;
|
|
47
|
-
});
|
|
56
|
+
const [, instance, platform] = runningModule;
|
|
57
|
+
if (platform.destroyed) {
|
|
58
|
+
teardown(BootstrapModule);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return Promise.resolve(instance);
|
|
62
|
+
}
|
|
48
63
|
}
|
|
64
|
+
return startNew(BootstrapModule, context, ngOptions);
|
|
49
65
|
}
|
|
50
66
|
if (process.env.NODE_ENV === 'development') {
|
|
51
67
|
// May be used later for something useful. Right now only debugging output.
|
package/esm/startup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup.js","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"startup.js","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"AAEA,OAAO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,eAAe,CAAC,IAAI;KAC1B,CAAC;IAEF,MAAM,OAAO,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC;IACvE,OAAO,EAAE,CAAC;CACX;AAED,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,cAAc,EAAE,CAAC;CAClB"}
|
package/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PlatformRef, NgModuleRef } from '@angular/core';
|
|
2
2
|
import type { ForeignComponent } from 'piral-core';
|
|
3
|
+
import type { Type } from '@angular/core';
|
|
3
4
|
declare module 'piral-core/lib/types/custom' {
|
|
4
5
|
interface PiletCustomApi extends PiletNgApi {
|
|
5
6
|
}
|
|
@@ -19,6 +20,24 @@ export declare type PrepareBootstrapResult = [...ModuleInstanceResult, any];
|
|
|
19
20
|
export declare type NgModuleInt = NgModuleRef<any> & {
|
|
20
21
|
_destroyed: boolean;
|
|
21
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Gives you the ability to use a component from a lazy loaded module.
|
|
25
|
+
*/
|
|
26
|
+
export interface NgComponentLoader {
|
|
27
|
+
/**
|
|
28
|
+
* Uses a component from a lazy loaded module.
|
|
29
|
+
* @param selector The selector defined for the component to load.
|
|
30
|
+
*/
|
|
31
|
+
(selector: string): NgComponent;
|
|
32
|
+
}
|
|
33
|
+
export interface NgLazyType {
|
|
34
|
+
selector: string;
|
|
35
|
+
module: () => Promise<{
|
|
36
|
+
default: Type<any>;
|
|
37
|
+
}>;
|
|
38
|
+
opts: NgOptions;
|
|
39
|
+
state: any;
|
|
40
|
+
}
|
|
22
41
|
/**
|
|
23
42
|
* Represents the interface implemented by a module definer function.
|
|
24
43
|
*/
|
|
@@ -28,13 +47,22 @@ export interface NgModuleDefiner {
|
|
|
28
47
|
* @param ngModule The module to use for running Angular.
|
|
29
48
|
* @param opts The options to pass when bootstrapping.
|
|
30
49
|
*/
|
|
31
|
-
(module:
|
|
50
|
+
<T>(module: Type<T>, opts?: NgOptions): void;
|
|
51
|
+
/**
|
|
52
|
+
* Defines the module to lazy load for bootstrapping the Angular pilet.
|
|
53
|
+
* @param getModule The module lazy loader to use for running Angular.
|
|
54
|
+
* @param opts The options to pass when bootstrapping.
|
|
55
|
+
* @returns The module ID to be used to reference components.
|
|
56
|
+
*/
|
|
57
|
+
<T>(getModule: () => Promise<{
|
|
58
|
+
default: Type<T>;
|
|
59
|
+
}>, opts?: NgOptions): NgComponentLoader;
|
|
32
60
|
}
|
|
33
61
|
export interface NgComponent {
|
|
34
62
|
/**
|
|
35
63
|
* The component root.
|
|
36
64
|
*/
|
|
37
|
-
component: any;
|
|
65
|
+
component: Type<any> | NgLazyType;
|
|
38
66
|
/**
|
|
39
67
|
* The type of the Angular component.
|
|
40
68
|
*/
|
|
@@ -56,7 +84,7 @@ export interface PiletNgApi {
|
|
|
56
84
|
* @param component The component root.
|
|
57
85
|
* @returns The Piral Ng component.
|
|
58
86
|
*/
|
|
59
|
-
fromNg(component:
|
|
87
|
+
fromNg<T>(component: Type<T>): NgComponent;
|
|
60
88
|
/**
|
|
61
89
|
* Angular component for displaying extensions of the given name.
|
|
62
90
|
*/
|
package/esm/utils.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ export interface NgAnnotation {
|
|
|
10
10
|
bootstrap: any;
|
|
11
11
|
selector: string;
|
|
12
12
|
}
|
|
13
|
+
export declare function getId(): string;
|
|
13
14
|
export declare function getNgVersion(): string;
|
|
14
15
|
export declare function getMinVersion(): string;
|
|
15
16
|
export declare function getAnnotations(component: any): Array<NgAnnotation>;
|
|
17
|
+
export declare function hasSelector(component: any, selector: string): boolean;
|
|
16
18
|
export declare function findComponents(exports: Array<any>): Array<any>;
|
package/esm/utils.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { VERSION } from '@angular/core';
|
|
2
|
+
export function getId() {
|
|
3
|
+
return Math.random().toString(36);
|
|
4
|
+
}
|
|
2
5
|
export function getNgVersion() {
|
|
3
6
|
return VERSION.major || VERSION.full.split('.')[0];
|
|
4
7
|
}
|
|
@@ -19,6 +22,10 @@ export function getAnnotations(component) {
|
|
|
19
22
|
}
|
|
20
23
|
return annotations || [];
|
|
21
24
|
}
|
|
25
|
+
export function hasSelector(component, selector) {
|
|
26
|
+
const [annotation] = getAnnotations(component);
|
|
27
|
+
return annotation && annotation.selector === selector;
|
|
28
|
+
}
|
|
22
29
|
export function findComponents(exports) {
|
|
23
30
|
const components = [];
|
|
24
31
|
if (Array.isArray(exports)) {
|
package/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,eAAe,CAAC;AAcxD,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,OAAO,GAAG,KAAK,MAAM,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAAc;IAC3C,IAAI,WAAW,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,eAAe,CAAC;IAE7C,IAAI,CAAC,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,gBAAgB,IAAI,OAAO,EAAE;QACjF,WAAW,GAAI,OAAe,CAAC,cAAc,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;KACzE;IAED,IAAI,CAAC,WAAW,IAAI,OAAO,SAAS,CAAC,IAAI,KAAK,WAAW,EAAE;QACzD,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC;KACpB;IAED,IAAI,CAAC,WAAW,IAAI,OAAO,SAAS,CAAC,IAAI,KAAK,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