piral-ng 1.0.0-pre.2196 → 1.0.0

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.
Files changed (120) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +701 -42
  3. package/common/NgExtension.d.ts +14 -0
  4. package/common/ResourceUrlPipe.d.ts +10 -0
  5. package/common/SharedModule.d.ts +10 -0
  6. package/common/esm2022/NgExtension.mjs +47 -0
  7. package/common/esm2022/ResourceUrlPipe.mjs +23 -0
  8. package/common/esm2022/SharedModule.mjs +25 -0
  9. package/common/esm2022/piral-ng-common.mjs +5 -0
  10. package/common/esm2022/public_api.mjs +4 -0
  11. package/common/fesm2022/piral-ng-common.mjs +93 -0
  12. package/common/fesm2022/piral-ng-common.mjs.map +1 -0
  13. package/common/index.d.ts +1 -0
  14. package/common/package.json +35 -0
  15. package/common/piral-ng-common.js +3 -0
  16. package/common/public_api.d.ts +3 -0
  17. package/convert.d.ts +17 -7
  18. package/convert.js +17 -11
  19. package/esm/RoutingService.d.ts +13 -0
  20. package/esm/RoutingService.js +109 -0
  21. package/esm/RoutingService.js.map +1 -0
  22. package/esm/bootstrap.d.ts +6 -5
  23. package/esm/bootstrap.js +52 -87
  24. package/esm/bootstrap.js.map +1 -1
  25. package/esm/common/NgExtension.d.ts +11 -0
  26. package/esm/common/NgExtension.js +41 -0
  27. package/esm/common/NgExtension.js.map +1 -0
  28. package/esm/common/ResourceUrlPipe.d.ts +7 -0
  29. package/esm/common/ResourceUrlPipe.js +18 -0
  30. package/esm/common/ResourceUrlPipe.js.map +1 -0
  31. package/esm/common/SharedModule.d.ts +3 -0
  32. package/esm/common/SharedModule.js +21 -0
  33. package/esm/common/SharedModule.js.map +1 -0
  34. package/esm/common/public_api.d.ts +3 -0
  35. package/esm/common/public_api.js +4 -0
  36. package/esm/common/public_api.js.map +1 -0
  37. package/esm/converter.d.ts +10 -2
  38. package/esm/converter.js +35 -16
  39. package/esm/converter.js.map +1 -1
  40. package/esm/create.d.ts +2 -16
  41. package/esm/create.js +9 -13
  42. package/esm/create.js.map +1 -1
  43. package/esm/module.d.ts +24 -0
  44. package/esm/module.js +131 -0
  45. package/esm/module.js.map +1 -0
  46. package/esm/queue.d.ts +1 -1
  47. package/esm/queue.js +3 -3
  48. package/esm/queue.js.map +1 -1
  49. package/esm/startup.d.ts +8 -0
  50. package/esm/startup.js +115 -0
  51. package/esm/startup.js.map +1 -0
  52. package/esm/types.d.ts +71 -3
  53. package/esm/utils.d.ts +18 -0
  54. package/esm/utils.js +46 -0
  55. package/esm/utils.js.map +1 -0
  56. package/extend-webpack.js +107 -0
  57. package/lib/RoutingService.d.ts +13 -0
  58. package/lib/RoutingService.js +112 -0
  59. package/lib/RoutingService.js.map +1 -0
  60. package/lib/bootstrap.d.ts +6 -5
  61. package/lib/bootstrap.js +55 -91
  62. package/lib/bootstrap.js.map +1 -1
  63. package/lib/common/NgExtension.d.ts +11 -0
  64. package/lib/common/NgExtension.js +44 -0
  65. package/lib/common/NgExtension.js.map +1 -0
  66. package/lib/common/ResourceUrlPipe.d.ts +7 -0
  67. package/lib/common/ResourceUrlPipe.js +21 -0
  68. package/lib/common/ResourceUrlPipe.js.map +1 -0
  69. package/lib/common/SharedModule.d.ts +3 -0
  70. package/lib/common/SharedModule.js +24 -0
  71. package/lib/common/SharedModule.js.map +1 -0
  72. package/lib/common/public_api.d.ts +3 -0
  73. package/lib/common/public_api.js +7 -0
  74. package/lib/common/public_api.js.map +1 -0
  75. package/lib/converter.d.ts +10 -2
  76. package/lib/converter.js +36 -17
  77. package/lib/converter.js.map +1 -1
  78. package/lib/create.d.ts +2 -16
  79. package/lib/create.js +10 -14
  80. package/lib/create.js.map +1 -1
  81. package/lib/index.js +1 -1
  82. package/lib/module.d.ts +24 -0
  83. package/lib/module.js +139 -0
  84. package/lib/module.js.map +1 -0
  85. package/lib/queue.d.ts +1 -1
  86. package/lib/queue.js +3 -3
  87. package/lib/queue.js.map +1 -1
  88. package/lib/startup.d.ts +8 -0
  89. package/lib/startup.js +120 -0
  90. package/lib/startup.js.map +1 -0
  91. package/lib/types.d.ts +71 -3
  92. package/lib/utils.d.ts +18 -0
  93. package/lib/utils.js +55 -0
  94. package/lib/utils.js.map +1 -0
  95. package/package.json +51 -16
  96. package/src/RoutingService.ts +114 -0
  97. package/src/bootstrap.ts +57 -104
  98. package/src/common/NgExtension.ts +33 -0
  99. package/src/common/ResourceUrlPipe.ts +12 -0
  100. package/src/common/SharedModule.ts +18 -0
  101. package/src/common/index.d.ts +1 -0
  102. package/src/common/ng-package.json +11 -0
  103. package/src/common/package.json +19 -0
  104. package/src/common/piral-ng-common.js +3 -0
  105. package/src/common/public_api.ts +3 -0
  106. package/src/converter.ts +58 -20
  107. package/src/create.ts +6 -23
  108. package/src/module.ts +163 -0
  109. package/src/queue.ts +1 -1
  110. package/src/startup.ts +148 -0
  111. package/src/types.ts +73 -3
  112. package/src/utils.ts +69 -0
  113. package/convert.ts +0 -16
  114. package/esm/extension.d.ts +0 -1
  115. package/esm/extension.js +0 -41
  116. package/esm/extension.js.map +0 -1
  117. package/lib/extension.d.ts +0 -1
  118. package/lib/extension.js +0 -45
  119. package/lib/extension.js.map +0 -1
  120. package/src/extension.ts +0 -29
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 CHANGED
@@ -1,7 +1,7 @@
1
- var queue = Promise.resolve();
1
+ let queue = Promise.resolve();
2
2
  export function enqueue(callback) {
3
- var next = queue.then(callback);
4
- queue = next.then(function () { });
3
+ const next = queue.then(callback);
4
+ queue = next.then(() => { });
5
5
  return next;
6
6
  }
7
7
  //# sourceMappingURL=queue.js.map
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,QAA0B;IACnD,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,cAAO,CAAC,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC;AACd,CAAC"}
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"}
@@ -0,0 +1,8 @@
1
+ import type { ComponentContext } from 'piral-core';
2
+ import type { NgOptions } from './types';
3
+ import { NgModuleRef } from '@angular/core';
4
+ export type NgModuleInt = NgModuleRef<any> & {
5
+ _destroyed: boolean;
6
+ };
7
+ export declare function teardown(BootstrapModule: any): void;
8
+ export declare function startup(BootstrapModule: any, context: ComponentContext, ngOptions?: NgOptions): Promise<void | NgModuleInt>;
package/esm/startup.js ADDED
@@ -0,0 +1,115 @@
1
+ import { createPlatformFactory, enableProdMode, NgZone, ɵALLOW_MULTIPLE_PLATFORMS as ALLOW_MULTIPLE_PLATFORMS, } from '@angular/core';
2
+ import { APP_BASE_HREF } from '@angular/common';
3
+ import { ɵplatformCoreDynamic as platformCoreDynamic, ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS as INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, } from '@angular/platform-browser-dynamic';
4
+ import { getId, getNgVersion } from './utils';
5
+ function getVersionHandler(versions) {
6
+ const major = getNgVersion();
7
+ const version = `v${major}`;
8
+ return versions[version];
9
+ }
10
+ // Equivalent to platformBrowserDynamic, but with support for multiple platforms
11
+ const customPlatformDynamicFactory = createPlatformFactory(platformCoreDynamic, 'piralDynamic', [
12
+ ...INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
13
+ {
14
+ provide: ALLOW_MULTIPLE_PLATFORMS,
15
+ useValue: true,
16
+ },
17
+ ]);
18
+ const runningModules = [];
19
+ function startNew(BootstrapModule, context, ngOptions) {
20
+ const path = context.publicPath || '/';
21
+ const platform = customPlatformDynamicFactory([
22
+ { provide: 'Context', useValue: context },
23
+ { provide: APP_BASE_HREF, useValue: path },
24
+ ]);
25
+ const id = getId();
26
+ const zoneIdentifier = `piral-ng:${id}`;
27
+ // This is a hack, since NgZone doesn't allow you to configure the property that identifies your zone.
28
+ // See:
29
+ // - https://github.com/PlaceMe-SAS/single-spa-angular-cli/issues/33
30
+ // - https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L144
31
+ // - https://github.com/angular/angular/blob/a14dc2d7a4821a19f20a9547053a5734798f541e/packages/core/src/zone/ng_zone.ts#L257
32
+ // @ts-ignore
33
+ NgZone.isInAngularZone = () => window.Zone.current._properties[zoneIdentifier] === true;
34
+ return platform
35
+ .bootstrapModule(BootstrapModule, ngOptions)
36
+ .catch((err) => console.log(err))
37
+ .then((instance) => {
38
+ var _a;
39
+ if (instance) {
40
+ const zone = instance.injector.get(NgZone);
41
+ // @ts-ignore
42
+ 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;
43
+ if (z && '_properties' in z) {
44
+ z._properties[zoneIdentifier] = true;
45
+ }
46
+ runningModules.push([BootstrapModule, instance, platform]);
47
+ }
48
+ return instance;
49
+ });
50
+ }
51
+ export function teardown(BootstrapModule) {
52
+ const runningModuleIndex = runningModules.findIndex(([ref]) => ref === BootstrapModule);
53
+ if (runningModuleIndex !== -1) {
54
+ const [, , platform] = runningModules[runningModuleIndex];
55
+ runningModules.splice(runningModuleIndex, 1);
56
+ if (!platform.destroyed) {
57
+ platform.destroy();
58
+ }
59
+ }
60
+ }
61
+ export function startup(BootstrapModule, context, ngOptions) {
62
+ const runningModule = runningModules.find(([ref]) => ref === BootstrapModule);
63
+ if (runningModule) {
64
+ const [, instance, platform] = runningModule;
65
+ if (platform.destroyed) {
66
+ teardown(BootstrapModule);
67
+ }
68
+ else {
69
+ return Promise.resolve(instance);
70
+ }
71
+ }
72
+ return startNew(BootstrapModule, context, ngOptions);
73
+ }
74
+ if (process.env.NODE_ENV === 'development') {
75
+ // May be used later for something useful. Right now only debugging output.
76
+ const versionHandlers = {
77
+ legacy() {
78
+ console.log('Running in legacy mode (Angular 2, Angular 4)');
79
+ },
80
+ outdated() {
81
+ console.log('Running in outdated mode (Angular 5-8)');
82
+ },
83
+ current() {
84
+ console.log('Running in current mode (Angular 9-15)');
85
+ },
86
+ next() {
87
+ console.log('Running in next mode (Angular 16)');
88
+ },
89
+ unknown() {
90
+ console.log('Running with an unknown version of Angular');
91
+ },
92
+ };
93
+ const versions = {
94
+ v2: versionHandlers.legacy,
95
+ v4: versionHandlers.legacy,
96
+ v5: versionHandlers.outdated,
97
+ v6: versionHandlers.outdated,
98
+ v7: versionHandlers.outdated,
99
+ v8: versionHandlers.outdated,
100
+ v9: versionHandlers.current,
101
+ v10: versionHandlers.current,
102
+ v11: versionHandlers.current,
103
+ v12: versionHandlers.current,
104
+ v13: versionHandlers.current,
105
+ v14: versionHandlers.current,
106
+ v15: versionHandlers.current,
107
+ v16: versionHandlers.next,
108
+ };
109
+ const handler = getVersionHandler(versions) || versionHandlers.unknown;
110
+ handler();
111
+ }
112
+ if (process.env.NODE_ENV === 'production') {
113
+ enableProdMode();
114
+ }
115
+ //# sourceMappingURL=startup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startup.js","sourceRoot":"","sources":["../src/startup.ts"],"names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AC,QAAQ;QAC5B,EAAE,EAAE,eAAe,CAAC,QAAQ;QAC5B,EAAE,EAAE,eAAe,CAAC,OAAO;QAC3B,GAAG,EAAE,eAAe,CAAC,OAAO;QAC5B,GAAG,EAAE,eAAe,CAAC,OAAO;QAC5B,GAAG,EAAE,eAAe,CAAC,OAAO;QAC5B,GAAG,EAAE,eAAe,CAAC,OAAO;QAC5B,GAAG,EAAE,eAAe,CAAC,OAAO;QAC5B,GAAG,EAAE,eAAe,CAAC,OAAO;QAC5B,GAAG,EAAE,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,4 +1,6 @@
1
+ import type { PlatformRef, NgModuleRef } from '@angular/core';
1
2
  import type { ForeignComponent } from 'piral-core';
3
+ import type { Type } from '@angular/core';
2
4
  declare module 'piral-core/lib/types/custom' {
3
5
  interface PiletCustomApi extends PiletNgApi {
4
6
  }
@@ -6,11 +8,70 @@ declare module 'piral-core/lib/types/custom' {
6
8
  ng(component: NgComponent): ForeignComponent<TProps>;
7
9
  }
8
10
  }
11
+ /**
12
+ * Options passed through to Angular `bootstrapModule`.
13
+ *
14
+ * Mainly to specify Noop Zone, but also includes compiler specific settings.
15
+ * See https://angular.io/api/core/PlatformRef#bootstrapModule for possible values.
16
+ */
17
+ export type NgOptions = Parameters<PlatformRef['bootstrapModule']>[1];
18
+ export type ModuleInstanceResult = [any, NgOptions];
19
+ export type PrepareBootstrapResult = [...ModuleInstanceResult, any];
20
+ export type NgModuleInt = NgModuleRef<any> & {
21
+ _destroyed: boolean;
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
+ }
41
+ /**
42
+ * The lazy loading interface for retrieving Angular components.
43
+ */
44
+ export interface LazyType<T> {
45
+ /**
46
+ * Callback to be invoked for lazy loading an Angular module or component.
47
+ */
48
+ (): Promise<{
49
+ default: Type<T>;
50
+ }>;
51
+ }
52
+ /**
53
+ * Represents the interface implemented by a module definer function.
54
+ */
55
+ export interface NgModuleDefiner {
56
+ /**
57
+ * Defines the module to use when bootstrapping the Angular pilet.
58
+ * @param ngModule The module to use for running Angular.
59
+ * @param opts The options to pass when bootstrapping.
60
+ */
61
+ <T>(module: Type<T>, opts?: NgOptions): void;
62
+ /**
63
+ * Defines the module to lazy load for bootstrapping the Angular pilet.
64
+ * @param getModule The module lazy loader to use for running Angular.
65
+ * @param opts The options to pass when bootstrapping.
66
+ * @returns The module ID to be used to reference components.
67
+ */
68
+ <T>(getModule: LazyType<T>, opts?: NgOptions): NgComponentLoader;
69
+ }
9
70
  export interface NgComponent {
10
71
  /**
11
72
  * The component root.
12
73
  */
13
- component: any;
74
+ component: Type<any> | NgLazyType;
14
75
  /**
15
76
  * The type of the Angular component.
16
77
  */
@@ -21,11 +82,18 @@ export interface NgComponent {
21
82
  */
22
83
  export interface PiletNgApi {
23
84
  /**
24
- * Wraps an Angular component for use in Piral.
85
+ * Defines the module to use when bootstrapping the Angular pilet.
86
+ */
87
+ defineNgModule: NgModuleDefiner;
88
+ /**
89
+ * Wraps an Angular component for use in Piral. Might reuse a previously
90
+ * defined module if the component was exported from it.
91
+ * Alternatively, a module might be passed in, where the first component
92
+ * of either the bootstrap or the entryComponents declaration is used.
25
93
  * @param component The component root.
26
94
  * @returns The Piral Ng component.
27
95
  */
28
- fromNg(component: any): NgComponent;
96
+ fromNg<T>(component: Type<T>): NgComponent;
29
97
  /**
30
98
  * Angular component for displaying extensions of the given name.
31
99
  */
package/esm/utils.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { StaticProvider } from '@angular/core';
2
+ export interface NgAnnotation {
3
+ _initial?: Array<StaticProvider>;
4
+ standalone?: boolean;
5
+ providers: Array<StaticProvider>;
6
+ imports: Array<any>;
7
+ exports: Array<any>;
8
+ declarations: Array<any>;
9
+ entryComponents: Array<any>;
10
+ bootstrap: any;
11
+ selector: string;
12
+ }
13
+ export declare function getId(): string;
14
+ export declare function getNgVersion(): string;
15
+ export declare function getMinVersion(): string;
16
+ export declare function getAnnotations(component: any): Array<NgAnnotation>;
17
+ export declare function hasSelector(component: any, selector: string): boolean;
18
+ export declare function findComponents(exports: Array<any>): Array<any>;
package/esm/utils.js ADDED
@@ -0,0 +1,46 @@
1
+ import { VERSION } from '@angular/core';
2
+ export function getId() {
3
+ return Math.random().toString(36);
4
+ }
5
+ export function getNgVersion() {
6
+ return VERSION.major || VERSION.full.split('.')[0];
7
+ }
8
+ export function getMinVersion() {
9
+ const major = getNgVersion();
10
+ return `${major}.0.0`;
11
+ }
12
+ export function getAnnotations(component) {
13
+ let annotations = component === null || component === void 0 ? void 0 : component.__annotations__;
14
+ if (!annotations && typeof Reflect !== 'undefined' && 'getOwnMetadata' in Reflect) {
15
+ annotations = Reflect.getOwnMetadata('annotations', component);
16
+ }
17
+ if (!annotations && typeof component.ɵcmp !== 'undefined') {
18
+ annotations = [{}];
19
+ }
20
+ if (!annotations && typeof component.ɵmod !== 'undefined') {
21
+ annotations = [component.ɵmod];
22
+ }
23
+ return annotations || [];
24
+ }
25
+ export function hasSelector(component, selector) {
26
+ const [annotation] = getAnnotations(component);
27
+ return annotation && annotation.selector === selector;
28
+ }
29
+ export function findComponents(exports) {
30
+ const components = [];
31
+ if (Array.isArray(exports)) {
32
+ for (const ex of exports) {
33
+ const [annotation] = getAnnotations(ex);
34
+ if (annotation) {
35
+ if (annotation.exports) {
36
+ components.push(...findComponents(annotation.exports));
37
+ }
38
+ else if (!annotation.imports || annotation.standalone) {
39
+ components.push(ex);
40
+ }
41
+ }
42
+ }
43
+ }
44
+ return components;
45
+ }
46
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +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,KAAK;IACnB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,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,WAAW,EAAE;QACzD,WAAW,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAChC;IAED,OAAO,WAAW,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,SAAc,EAAE,QAAgB;IAC1D,MAAM,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAC/C,OAAO,UAAU,IAAI,UAAU,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAmB;IAChD,MAAM,UAAU,GAAG,EAAE,CAAC;IAEtB,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1B,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE;YACxB,MAAM,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;YAExC,IAAI,UAAU,EAAE;gBACd,IAAI,UAAU,CAAC,OAAO,EAAE;oBACtB,UAAU,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC;iBACxD;qBAAM,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,UAAU,EAAE;oBACvD,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;iBACrB;aACF;SACF;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,107 @@
1
+ const CopyPlugin = require('copy-webpack-plugin');
2
+
3
+ const { AngularWebpackPlugin } = require('@ngtools/webpack');
4
+ const { resolve } = require('path');
5
+
6
+ const ngtoolsLoader = require.resolve('@ngtools/webpack');
7
+ const toStringLoader = require.resolve('to-string-loader');
8
+ const cssLoader = require.resolve('css-loader');
9
+ const sassLoader = require.resolve('sass-loader');
10
+ const htmlLoader = require.resolve('html-loader');
11
+
12
+ module.exports =
13
+ (options = {}) =>
14
+ (config) => {
15
+ const {
16
+ patterns = [{ from: resolve(process.cwd(), 'src/assets'), noErrorOnMissing: true }],
17
+ ngOptions = {},
18
+ compilerOptions = {},
19
+ } = options;
20
+ const cssLoaderNoModule = `${cssLoader}?esModule=false`;
21
+ const htmlLoaderNoModule = {
22
+ loader: htmlLoader,
23
+ options: {
24
+ esModule: false,
25
+ },
26
+ };
27
+
28
+ function findRule(tester, changer) {
29
+ config.module.rules.forEach((rule) => {
30
+ if (rule.oneOf) {
31
+ rule.oneOf.forEach((r) => {
32
+ if (r.test && tester(r)) {
33
+ changer(r, rule.oneOf);
34
+ }
35
+ });
36
+ } else if (rule.test && tester(rule)) {
37
+ changer(rule, config.module.rules);
38
+ }
39
+ });
40
+ }
41
+
42
+ findRule(
43
+ (m) => m.test.toString() === /\.css$/i.toString(),
44
+ (m) => {
45
+ m.exclude = /\.component.css$/i;
46
+ },
47
+ );
48
+
49
+ findRule(
50
+ (m) => m.test && m.test.toString() === /\.css$/i.toString(),
51
+ (m) => {
52
+ m.exclude = /\.component.css$/i;
53
+ },
54
+ );
55
+
56
+ findRule(
57
+ (m) => m.test && m.test.toString() === /\.s[ac]ss$/i.toString(),
58
+ (m) => {
59
+ m.exclude = /\.component.s[ac]ss$/i;
60
+ },
61
+ );
62
+
63
+ findRule(
64
+ (m) => m.test && m.test.toString() === /\.tsx?$/i.toString(),
65
+ (m, all) => {
66
+ const ruleIndex = all.indexOf(m);
67
+
68
+ all.splice(
69
+ ruleIndex,
70
+ 1,
71
+ {
72
+ test: /\.[jt]sx?$/,
73
+ loader: ngtoolsLoader,
74
+ },
75
+ {
76
+ test: /\.component.html$/i,
77
+ use: [toStringLoader, htmlLoaderNoModule],
78
+ },
79
+ {
80
+ test: /\.component.css$/i,
81
+ use: [toStringLoader, cssLoaderNoModule],
82
+ },
83
+ {
84
+ test: /\.component.s[ac]ss$/i,
85
+ use: [toStringLoader, cssLoaderNoModule, sassLoader],
86
+ },
87
+ );
88
+ },
89
+ );
90
+
91
+ config.plugins.push(
92
+ new AngularWebpackPlugin({
93
+ tsconfig: resolve(process.cwd(), 'tsconfig.json'),
94
+ jitMode: true,
95
+ ...ngOptions,
96
+ compilerOptions: {
97
+ ...compilerOptions,
98
+ compilationMode: 'partial',
99
+ },
100
+ }),
101
+ new CopyPlugin({
102
+ patterns,
103
+ }),
104
+ );
105
+
106
+ return config;
107
+ };
@@ -0,0 +1,13 @@
1
+ import type { ComponentContext } from 'piral-core';
2
+ import { NgZone, OnDestroy } from '@angular/core';
3
+ import { Router } from '@angular/router';
4
+ export declare class RoutingService implements OnDestroy {
5
+ context: ComponentContext;
6
+ private router;
7
+ private zone;
8
+ private dispose;
9
+ private subscription;
10
+ private invalidRoutes;
11
+ constructor(context: ComponentContext, router: Router, zone: NgZone);
12
+ ngOnDestroy(): void;
13
+ }
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RoutingService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@angular/core");
6
+ const router_1 = require("@angular/router");
7
+ const common_1 = require("@angular/common");
8
+ let skipNavigation = false;
9
+ const noop = function () { };
10
+ const navigateByUrl = router_1.Router.prototype.navigateByUrl;
11
+ // deactivates the usual platform behavior; all these operations are performed via the RoutingService
12
+ // to avoid any conflict, e.g., double-booking URL changes in React and Angular
13
+ common_1.BrowserPlatformLocation.prototype.pushState = noop;
14
+ common_1.BrowserPlatformLocation.prototype.replaceState = noop;
15
+ common_1.BrowserPlatformLocation.prototype.forward = noop;
16
+ common_1.BrowserPlatformLocation.prototype.back = noop;
17
+ common_1.BrowserPlatformLocation.prototype.historyGo = noop;
18
+ // required to detect / react to hidden URL change (see #554 for details)
19
+ router_1.Router.prototype.navigateByUrl = function (url, extras) {
20
+ var _a;
21
+ skipNavigation = (_a = extras === null || extras === void 0 ? void 0 : extras.skipLocationChange) !== null && _a !== void 0 ? _a : false;
22
+ const result = navigateByUrl.call(this, url, extras);
23
+ skipNavigation = false;
24
+ return result;
25
+ };
26
+ function normalize(url) {
27
+ const search = url.indexOf('?');
28
+ const hash = url.indexOf('#');
29
+ if (search !== -1 || hash !== -1) {
30
+ if (search === -1) {
31
+ return url.substring(0, hash);
32
+ }
33
+ else if (hash === -1) {
34
+ return url.substring(0, search);
35
+ }
36
+ else {
37
+ return url.substring(0, Math.min(search, hash));
38
+ }
39
+ }
40
+ return url;
41
+ }
42
+ let RoutingService = class RoutingService {
43
+ constructor(context, router, zone) {
44
+ this.context = context;
45
+ this.router = router;
46
+ this.zone = zone;
47
+ this.invalidRoutes = [];
48
+ if (this.router) {
49
+ this.router.errorHandler = (error) => {
50
+ if (error.message.match('Cannot match any routes')) {
51
+ // ignore this special error
52
+ return undefined;
53
+ }
54
+ throw error;
55
+ };
56
+ const skipIds = [];
57
+ const nav = this.context.navigation;
58
+ this.dispose = nav.listen(({ location }) => {
59
+ const path = location.pathname;
60
+ if (!this.invalidRoutes.includes(path)) {
61
+ const url = `${path}${location.search}${location.hash}`;
62
+ this.zone.run(() => navigateByUrl.call(this.router, url));
63
+ }
64
+ });
65
+ this.subscription = this.router.events.subscribe((e) => {
66
+ if (e instanceof router_1.NavigationError) {
67
+ const routerUrl = e.url;
68
+ const path = normalize(routerUrl);
69
+ const locationUrl = nav.url;
70
+ if (!this.invalidRoutes.includes(path)) {
71
+ this.invalidRoutes.push(path);
72
+ }
73
+ if (routerUrl !== locationUrl) {
74
+ nav.push(routerUrl);
75
+ }
76
+ }
77
+ else if (e.type === 0 && skipNavigation) {
78
+ skipIds.push(e.id);
79
+ }
80
+ else if (e.type === 15) {
81
+ const index = skipIds.indexOf(e.routerEvent.id);
82
+ if (index === -1) {
83
+ // consistency check to avoid #535 and other Angular-specific issues
84
+ const locationUrl = nav.url;
85
+ const routerUrl = e.routerEvent.url;
86
+ if (routerUrl !== locationUrl) {
87
+ nav.push(routerUrl);
88
+ }
89
+ }
90
+ else {
91
+ skipIds.splice(index, 1);
92
+ }
93
+ }
94
+ });
95
+ }
96
+ }
97
+ ngOnDestroy() {
98
+ var _a, _b;
99
+ (_a = this.dispose) === null || _a === void 0 ? void 0 : _a.call(this);
100
+ (_b = this.subscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
101
+ }
102
+ };
103
+ RoutingService = tslib_1.__decorate([
104
+ (0, core_1.Injectable)(),
105
+ tslib_1.__param(0, (0, core_1.Inject)('Context')),
106
+ tslib_1.__param(1, (0, core_1.Optional)()),
107
+ tslib_1.__param(2, (0, core_1.Optional)()),
108
+ tslib_1.__metadata("design:paramtypes", [Object, router_1.Router,
109
+ core_1.NgZone])
110
+ ], RoutingService);
111
+ exports.RoutingService = RoutingService;
112
+ //# sourceMappingURL=RoutingService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoutingService.js","sourceRoot":"","sources":["../src/RoutingService.ts"],"names":[],"mappings":";;;;AAEA,wCAAgF;AAChF,4CAAmF;AACnF,4CAAsF;AAEtF,IAAI,cAAc,GAAG,KAAK,CAAC;AAC3B,MAAM,IAAI,GAAG,cAAa,CAAC,CAAC;AAC5B,MAAM,aAAa,GAAG,eAAM,CAAC,SAAS,CAAC,aAAa,CAAC;AAErD,qGAAqG;AACrG,+EAA+E;AAC/E,gCAAwB,CAAC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC;AACpD,gCAAwB,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC;AACvD,gCAAwB,CAAC,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;AAClD,gCAAwB,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;AAC/C,gCAAwB,CAAC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC;AAEpD,yEAAyE;AACzE,eAAM,CAAC,SAAS,CAAC,aAAa,GAAG,UAAU,GAAG,EAAE,MAAM;;IACpD,cAAc,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,kBAAkB,mCAAI,KAAK,CAAC;IACrD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IACrD,cAAc,GAAG,KAAK,CAAC;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,SA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,EAAE,CAAC,CAAC;oBAEhD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;wBAChB,oEAAoE;wBACpE,MAAM,WAAW,GAAG,GAAG,CAAC,GAAG,CAAC;wBAC5B,MAAM,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC;wBAEpC,IAAI,SAAS,KAAK,WAAW,EAAE;4BAC7B,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;yBACrB;qBACF;yBAAM;wBACL,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;qBAC1B;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;AArEY,cAAc;IAD1B,IAAA,iBAAU,GAAE;IAOR,mBAAA,IAAA,aAAM,EAAC,SAAS,CAAC,CAAA;IACjB,mBAAA,IAAA,eAAQ,GAAE,CAAA;IACV,mBAAA,IAAA,eAAQ,GAAE,CAAA;qDADiB,eAAM;QACR,aAAM;GARvB,cAAc,CAqE1B;AArEY,wCAAc"}
@@ -1,5 +1,6 @@
1
- import { NgModuleRef } from '@angular/core';
2
- import { BaseComponentProps } from 'piral-core';
3
- export declare function bootstrap<T extends BaseComponentProps>(context: any, props: T, moduleOrComponent: any, node: HTMLElement, id: string): Promise<void | NgModuleRef<any>>;
4
- export declare function bootstrapComponent<T extends BaseComponentProps>(context: any, props: T, component: any, node: HTMLElement, id: string): Promise<void | NgModuleRef<any>>;
5
- export declare function bootstrapModule<T extends BaseComponentProps>(context: any, props: T, BootstrapModule: any, node: HTMLElement, id: string): Promise<void | NgModuleRef<any>>;
1
+ import type { BaseComponentProps, ComponentContext, Disposable, PiletApi } from 'piral-core';
2
+ import type { BehaviorSubject } from 'rxjs';
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>;
6
+ export declare function bootstrap<TProps extends BaseComponentProps>(result: PrepareBootstrapResult, node: HTMLElement, props: BehaviorSubject<TProps>, context: ComponentContext): Promise<Disposable>;