@worktile/planet 10.0.0 → 12.1.1

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 (256) hide show
  1. package/.all-contributorsrc +84 -0
  2. package/.circleci/config.yml +17 -0
  3. package/.coveralls.yml +1 -0
  4. package/.docgeni/public/assets/favicon.ico +0 -0
  5. package/.docgeni/public/index.html +13 -0
  6. package/.docgenirc.js +35 -0
  7. package/.dockerignore +1 -0
  8. package/.editorconfig +22 -0
  9. package/.github/FUNDING.yml +12 -0
  10. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  11. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  12. package/.prettierignore +7 -0
  13. package/.prettierrc +28 -0
  14. package/.travis.yml +26 -0
  15. package/.wpmrc.js +11 -0
  16. package/CHANGELOG.md +391 -0
  17. package/CODE_OF_CONDUCT.md +76 -0
  18. package/Dockerfile +11 -0
  19. package/LICENSE +21 -0
  20. package/README.md +348 -0
  21. package/README.zh-CN.md +307 -0
  22. package/SECURITY.md +21 -0
  23. package/angular.json +373 -0
  24. package/commitlint.config.js +6 -0
  25. package/docs/api/defineApplication.md +46 -0
  26. package/docs/api/globalEventDispatcher.md +51 -0
  27. package/docs/api/index.md +5 -0
  28. package/docs/api/planet.md +117 -0
  29. package/docs/guides/getting-started.md +174 -0
  30. package/docs/guides/index.md +5 -0
  31. package/docs/guides/intro.md +216 -0
  32. package/examples/app1/browserslist +11 -0
  33. package/examples/app1/extra-webpack.config.js +33 -0
  34. package/examples/app1/karma.conf.js +31 -0
  35. package/examples/app1/postcss.config.js +1 -0
  36. package/examples/app1/src/app/app.module.ts +44 -0
  37. package/examples/app1/src/app/app.routing.ts +49 -0
  38. package/examples/app1/src/app/counter.service.ts +16 -0
  39. package/examples/app1/src/app/dashboard/dashboard.component.html +51 -0
  40. package/examples/app1/src/app/dashboard/dashboard.component.ts +70 -0
  41. package/examples/app1/src/app/detail/detail.component.html +8 -0
  42. package/examples/app1/src/app/detail/detail.component.ts +18 -0
  43. package/examples/app1/src/app/overlay.ts +26 -0
  44. package/examples/app1/src/app/projects/dialog/projects-dialog.component.html +10 -0
  45. package/examples/app1/src/app/projects/dialog/projects-dialog.component.ts +41 -0
  46. package/examples/app1/src/app/projects/projects.component.ts +33 -0
  47. package/examples/app1/src/app/root/root.component.css +3 -0
  48. package/examples/app1/src/app/root/root.component.html +16 -0
  49. package/examples/app1/src/app/root/root.component.ts +35 -0
  50. package/examples/app1/src/app/services/initialized-data.resolver.ts +15 -0
  51. package/examples/app1/src/app/shared.module.ts +57 -0
  52. package/examples/app1/src/app/user/detail/user-detail.component.html +5 -0
  53. package/examples/app1/src/app/user/detail/user-detail.component.ts +20 -0
  54. package/examples/app1/src/app/user/user-list.component.html +7 -0
  55. package/examples/app1/src/app/user/user-list.component.ts +20 -0
  56. package/examples/app1/src/app/user/user.module.ts +31 -0
  57. package/examples/app1/src/assets/.gitkeep +0 -0
  58. package/examples/app1/src/assets/github.png +0 -0
  59. package/examples/app1/src/assets/main.css +3 -0
  60. package/examples/app1/src/environments/environment.prod.ts +3 -0
  61. package/examples/app1/src/environments/environment.ts +16 -0
  62. package/examples/app1/src/favicon.ico +0 -0
  63. package/examples/app1/src/index.html +14 -0
  64. package/examples/app1/src/main.ts +35 -0
  65. package/examples/app1/src/polyfills.ts +84 -0
  66. package/examples/app1/src/styles.scss +35 -0
  67. package/examples/app1/src/test.ts +14 -0
  68. package/examples/app1/temp.js +221 -0
  69. package/examples/app1/tsconfig.app.json +10 -0
  70. package/examples/app1/tsconfig.spec.json +18 -0
  71. package/examples/app1/tslint.json +17 -0
  72. package/examples/app1/webpack.config.js +127 -0
  73. package/examples/app2/browserslist +11 -0
  74. package/examples/app2/extra-webpack.config.js +32 -0
  75. package/examples/app2/karma.conf.js +31 -0
  76. package/examples/app2/src/app/app.module.ts +90 -0
  77. package/examples/app2/src/app/dashboard/dashboard.component.html +21 -0
  78. package/examples/app2/src/app/dashboard/dashboard.component.ts +27 -0
  79. package/examples/app2/src/app/overlay.ts +26 -0
  80. package/examples/app2/src/app/projects/detail/detail.component.html +16 -0
  81. package/examples/app2/src/app/projects/detail/detail.component.ts +21 -0
  82. package/examples/app2/src/app/projects/project-list.component.html +29 -0
  83. package/examples/app2/src/app/projects/project-list.component.ts +58 -0
  84. package/examples/app2/src/app/projects/project.resolver.ts +15 -0
  85. package/examples/app2/src/app/projects/projects.service.ts +28 -0
  86. package/examples/app2/src/app/projects/tasks/tasks.component.html +10 -0
  87. package/examples/app2/src/app/projects/tasks/tasks.component.ts +16 -0
  88. package/examples/app2/src/app/projects/view/view.component.html +1 -0
  89. package/examples/app2/src/app/projects/view/view.component.ts +20 -0
  90. package/examples/app2/src/app/root/root.component.html +14 -0
  91. package/examples/app2/src/app/root/root.component.scss +12 -0
  92. package/examples/app2/src/app/root/root.component.ts +28 -0
  93. package/examples/app2/src/app/shared.module.ts +59 -0
  94. package/examples/app2/src/assets/.gitkeep +0 -0
  95. package/examples/app2/src/environments/environment.prod.ts +3 -0
  96. package/examples/app2/src/environments/environment.ts +16 -0
  97. package/examples/app2/src/favicon.ico +0 -0
  98. package/examples/app2/src/index.html +14 -0
  99. package/examples/app2/src/main.ts +36 -0
  100. package/examples/app2/src/polyfills.ts +84 -0
  101. package/examples/app2/src/styles.scss +28 -0
  102. package/examples/app2/src/test.ts +14 -0
  103. package/examples/app2/tsconfig.app.json +10 -0
  104. package/examples/app2/tsconfig.spec.json +18 -0
  105. package/examples/app2/tslint.json +7 -0
  106. package/examples/app2/webpack.config.js +92 -0
  107. package/examples/common/app-root-context.ts +10 -0
  108. package/examples/common/cache.ts +82 -0
  109. package/examples/common/index.ts +13 -0
  110. package/examples/common/module.ts +10 -0
  111. package/examples/common/overlay-container.service.ts +28 -0
  112. package/examples/common/section-card/section-card.component.html +5 -0
  113. package/examples/common/section-card/section-card.component.scss +15 -0
  114. package/examples/common/section-card/section-card.component.ts +11 -0
  115. package/examples/common/utils.ts +0 -0
  116. package/examples/portal/src/app/a-detail/a-detail.component.html +8 -0
  117. package/examples/portal/src/app/a-detail/a-detail.component.ts +18 -0
  118. package/examples/portal/src/app/about/about.component.html +27 -0
  119. package/examples/portal/src/app/about/about.component.scss +0 -0
  120. package/examples/portal/src/app/about/about.component.spec.ts +26 -0
  121. package/examples/portal/src/app/about/about.component.ts +26 -0
  122. package/examples/portal/src/app/app-routing.module.ts +57 -0
  123. package/examples/portal/src/app/app.component.html +73 -0
  124. package/examples/portal/src/app/app.component.scss +58 -0
  125. package/examples/portal/src/app/app.component.spec.ts +33 -0
  126. package/examples/portal/src/app/app.component.ts +111 -0
  127. package/examples/portal/src/app/app.module.ts +64 -0
  128. package/examples/portal/src/app/custom-settings.service.ts +44 -0
  129. package/examples/portal/src/app/overlay.ts +26 -0
  130. package/examples/portal/src/app/settings/settings.component.html +31 -0
  131. package/examples/portal/src/app/settings/settings.component.scss +3 -0
  132. package/examples/portal/src/app/settings/settings.component.ts +43 -0
  133. package/examples/portal/src/assets/.gitkeep +0 -0
  134. package/examples/portal/src/assets/apps.json +29 -0
  135. package/examples/portal/src/assets/icons/sprite.defs.svg +1 -0
  136. package/examples/portal/src/assets/images/logo.svg +16 -0
  137. package/examples/portal/src/assets/ngx-planet-micro-front-end.gif +0 -0
  138. package/examples/portal/src/browserslist +11 -0
  139. package/examples/portal/src/environments/environment.prod.ts +3 -0
  140. package/examples/portal/src/environments/environment.ts +16 -0
  141. package/examples/portal/src/extra-webpack.config.js +32 -0
  142. package/examples/portal/src/favicon.ico +0 -0
  143. package/examples/portal/src/index.html +14 -0
  144. package/examples/portal/src/karma.conf.js +31 -0
  145. package/examples/portal/src/main.ts +18 -0
  146. package/examples/portal/src/polyfills.ts +84 -0
  147. package/examples/portal/src/reboot.scss +14 -0
  148. package/examples/portal/src/styles.scss +14 -0
  149. package/examples/portal/src/test.ts +14 -0
  150. package/examples/portal/src/tsconfig.app.json +10 -0
  151. package/examples/portal/src/tsconfig.spec.json +9 -0
  152. package/examples/portal/src/tslint.json +7 -0
  153. package/extra-webpack.config.js +5 -0
  154. package/nginx.conf +17 -0
  155. package/package.json +120 -15
  156. package/packages/planet/karma.conf.js +37 -0
  157. package/packages/planet/ng-package.json +7 -0
  158. package/packages/planet/package.json +10 -0
  159. package/packages/planet/src/application/planet-application-loader.spec.ts +1102 -0
  160. package/packages/planet/src/application/planet-application-loader.ts +549 -0
  161. package/packages/planet/src/application/planet-application-ref.spec.ts +233 -0
  162. package/packages/planet/src/application/planet-application-ref.ts +131 -0
  163. package/packages/planet/src/application/planet-application.service.spec.ts +145 -0
  164. package/packages/planet/src/application/planet-application.service.ts +88 -0
  165. package/packages/planet/src/application/portal-application.spec.ts +53 -0
  166. package/packages/planet/src/application/portal-application.ts +28 -0
  167. package/packages/planet/src/assets-loader.spec.ts +689 -0
  168. package/packages/planet/src/assets-loader.ts +247 -0
  169. package/packages/planet/src/component/planet-component-loader.spec.ts +187 -0
  170. package/packages/planet/src/component/planet-component-loader.ts +173 -0
  171. package/{component/planet-component-ref.d.ts → packages/planet/src/component/planet-component-ref.ts} +3 -2
  172. package/{component/plant-component.config.d.ts → packages/planet/src/component/plant-component.config.ts} +4 -3
  173. package/packages/planet/src/debug.spec.ts +58 -0
  174. package/packages/planet/src/debug.ts +66 -0
  175. package/packages/planet/src/empty/empty.component.spec.ts +34 -0
  176. package/packages/planet/src/empty/empty.component.ts +7 -0
  177. package/packages/planet/src/global-event-dispatcher.spec.ts +81 -0
  178. package/packages/planet/src/global-event-dispatcher.ts +82 -0
  179. package/packages/planet/src/global-planet.spec.ts +39 -0
  180. package/packages/planet/src/global-planet.ts +73 -0
  181. package/packages/planet/src/helpers.spec.ts +242 -0
  182. package/packages/planet/src/helpers.ts +125 -0
  183. package/packages/planet/src/module.spec.ts +79 -0
  184. package/packages/planet/src/module.ts +25 -0
  185. package/packages/planet/src/planet.class.ts +59 -0
  186. package/packages/planet/src/planet.spec.ts +226 -0
  187. package/packages/planet/src/planet.ts +113 -0
  188. package/{public-api.d.ts → packages/planet/src/public-api.ts} +4 -0
  189. package/packages/planet/src/sandbox/constants.ts +6 -0
  190. package/packages/planet/src/sandbox/exec.ts +22 -0
  191. package/packages/planet/src/sandbox/index.ts +24 -0
  192. package/packages/planet/src/sandbox/proxy/patches/document.ts +13 -0
  193. package/packages/planet/src/sandbox/proxy/patches/eventListener.ts +49 -0
  194. package/packages/planet/src/sandbox/proxy/patches/index.ts +13 -0
  195. package/packages/planet/src/sandbox/proxy/patches/storage.ts +53 -0
  196. package/packages/planet/src/sandbox/proxy/patches/timer.ts +50 -0
  197. package/packages/planet/src/sandbox/proxy/proxies/common.ts +137 -0
  198. package/packages/planet/src/sandbox/proxy/proxies/document.ts +140 -0
  199. package/packages/planet/src/sandbox/proxy/proxies/window.ts +176 -0
  200. package/packages/planet/src/sandbox/proxy/proxy-sandbox.ts +59 -0
  201. package/packages/planet/src/sandbox/proxy/types.ts +20 -0
  202. package/packages/planet/src/sandbox/sandbox.ts +20 -0
  203. package/packages/planet/src/sandbox/snapshot/snapshot-sandbox.ts +12 -0
  204. package/packages/planet/src/sandbox/types.ts +1 -0
  205. package/packages/planet/src/test.ts +16 -0
  206. package/packages/planet/src/testing/app1.module.ts +34 -0
  207. package/packages/planet/src/testing/app2.module.ts +24 -0
  208. package/packages/planet/src/testing/applications.ts +58 -0
  209. package/packages/planet/src/testing/index.ts +2 -0
  210. package/packages/planet/src/testing/utils.ts +31 -0
  211. package/packages/planet/tsconfig.lib.json +27 -0
  212. package/packages/planet/tsconfig.lib.prod.json +9 -0
  213. package/packages/planet/tsconfig.spec.json +17 -0
  214. package/packages/planet/tslint.json +7 -0
  215. package/postcss.config.js +3 -0
  216. package/proxy.conf.js +15 -0
  217. package/tsconfig.json +23 -0
  218. package/tslint.json +80 -0
  219. package/application/planet-application-loader.d.ts +0 -68
  220. package/application/planet-application-ref.d.ts +0 -32
  221. package/application/planet-application.service.d.ts +0 -18
  222. package/application/portal-application.d.ts +0 -14
  223. package/assets-loader.d.ts +0 -23
  224. package/bundles/worktile-planet.umd.js +0 -1670
  225. package/bundles/worktile-planet.umd.js.map +0 -1
  226. package/bundles/worktile-planet.umd.min.js +0 -16
  227. package/bundles/worktile-planet.umd.min.js.map +0 -1
  228. package/component/planet-component-loader.d.ts +0 -27
  229. package/empty/empty.component.d.ts +0 -2
  230. package/esm2015/application/planet-application-loader.js +0 -417
  231. package/esm2015/application/planet-application-ref.js +0 -86
  232. package/esm2015/application/planet-application.service.js +0 -87
  233. package/esm2015/application/portal-application.js +0 -16
  234. package/esm2015/assets-loader.js +0 -165
  235. package/esm2015/component/planet-component-loader.js +0 -157
  236. package/esm2015/component/planet-component-ref.js +0 -3
  237. package/esm2015/component/plant-component.config.js +0 -7
  238. package/esm2015/empty/empty.component.js +0 -10
  239. package/esm2015/global-event-dispatcher.js +0 -71
  240. package/esm2015/global-planet.js +0 -51
  241. package/esm2015/helpers.js +0 -116
  242. package/esm2015/module.js +0 -27
  243. package/esm2015/planet.class.js +0 -9
  244. package/esm2015/planet.js +0 -86
  245. package/esm2015/public-api.js +0 -18
  246. package/esm2015/worktile-planet.js +0 -6
  247. package/fesm2015/worktile-planet.js +0 -1257
  248. package/fesm2015/worktile-planet.js.map +0 -1
  249. package/global-event-dispatcher.d.ts +0 -19
  250. package/global-planet.d.ts +0 -22
  251. package/helpers.d.ts +0 -37
  252. package/module.d.ts +0 -5
  253. package/planet.class.d.ts +0 -34
  254. package/planet.d.ts +0 -24
  255. package/worktile-planet.d.ts +0 -5
  256. package/worktile-planet.metadata.json +0 -1
@@ -0,0 +1,20 @@
1
+ import { Global } from '../types';
2
+
3
+ // SandboxInstance 主要是为了解决循环依赖
4
+ export interface ProxySandboxInstance {
5
+ app: string;
6
+
7
+ running: boolean;
8
+
9
+ global: Global;
10
+
11
+ rewriteVariables: PropertyKey[];
12
+ }
13
+
14
+ export interface SandboxPatchHandler {
15
+ rewrite?: Record<PropertyKey, any>;
16
+ init?: () => void;
17
+ destroy?: () => void;
18
+ }
19
+
20
+ export type SandboxPatch = (sandbox?: ProxySandboxInstance) => SandboxPatchHandler;
@@ -0,0 +1,20 @@
1
+ import { execScript } from './exec';
2
+ import { Global } from './types';
3
+
4
+ export interface SandboxOptions {
5
+ strictGlobal?: boolean;
6
+ }
7
+
8
+ export abstract class Sandbox {
9
+ options!: SandboxOptions;
10
+
11
+ global!: Global;
12
+
13
+ abstract start(): void;
14
+
15
+ abstract destroy(): void;
16
+
17
+ execScript(code: string, url = '') {
18
+ execScript(code, url, this.global, !!this.options.strictGlobal);
19
+ }
20
+ }
@@ -0,0 +1,12 @@
1
+ import { Sandbox, SandboxOptions } from '../sandbox';
2
+
3
+ export class SnapshotSandbox extends Sandbox {
4
+ constructor(public app: string, public options: SandboxOptions) {
5
+ super();
6
+ this.start();
7
+ }
8
+
9
+ start() {}
10
+
11
+ destroy() {}
12
+ }
@@ -0,0 +1 @@
1
+ export type Global = Record<PropertyKey, any>;
@@ -0,0 +1,16 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ // import 'core-js/es7/reflect';
4
+ import 'zone.js';
5
+ import 'zone.js/testing';
6
+ import { getTestBed } from '@angular/core/testing';
7
+ import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
8
+
9
+ declare const require: any;
10
+
11
+ // First, initialize the Angular testing environment.
12
+ getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
13
+ // Then we find all the tests.
14
+ const context = require.context('./', true, /\.spec\.ts$/);
15
+ // And load the modules.
16
+ context.keys().map(context);
@@ -0,0 +1,34 @@
1
+ import { Component, NgModule } from '@angular/core';
2
+ import { RouterModule } from '@angular/router';
3
+ import { PlanetComponentLoader } from '../component/planet-component-loader';
4
+ import { PlanetApplicationLoader } from '../application/planet-application-loader';
5
+
6
+ export const app1Name = 'app1';
7
+
8
+ @Component({
9
+ selector: 'app1-projects',
10
+ template: `
11
+ projects is work
12
+ `
13
+ })
14
+ export class App1ProjectsComponent {}
15
+
16
+ @NgModule({
17
+ declarations: [App1ProjectsComponent],
18
+ entryComponents: [App1ProjectsComponent],
19
+ imports: [RouterModule.forChild([])],
20
+ providers: [
21
+ PlanetComponentLoader,
22
+ {
23
+ provide: PlanetApplicationLoader,
24
+ useValue: {
25
+ preload: () => {}
26
+ }
27
+ }
28
+ ]
29
+ })
30
+ export class App1Module {
31
+ constructor(private componentLoader: PlanetComponentLoader) {
32
+ // componentLoader.register([{ name: 'app1-projects', component: App1ProjectsComponent }]);
33
+ }
34
+ }
@@ -0,0 +1,24 @@
1
+ import { Component, NgModule } from '@angular/core';
2
+ import { RouterModule } from '@angular/router';
3
+ import { PlanetApplicationLoader } from '../application/planet-application-loader';
4
+ import { PlanetComponentLoader } from '../component/planet-component-loader';
5
+
6
+ export const app2Name = 'app2';
7
+
8
+ @NgModule({
9
+ declarations: [],
10
+ entryComponents: [],
11
+ imports: [RouterModule.forChild([])],
12
+ providers: [
13
+ PlanetComponentLoader,
14
+ {
15
+ provide: PlanetApplicationLoader,
16
+ useValue: {
17
+ preload: () => {}
18
+ }
19
+ }
20
+ ]
21
+ })
22
+ export class App2Module {
23
+ constructor() {}
24
+ }
@@ -0,0 +1,58 @@
1
+ import { SwitchModes } from '../planet.class';
2
+ const app1 = {
3
+ name: 'app1',
4
+ hostParent: '.host-selector',
5
+ selector: 'app1-root',
6
+ stylePrefix: 'app1-prefix',
7
+ routerPathPrefix: '/app1',
8
+ hostClass: 'app1-host',
9
+ preload: false,
10
+ switchMode: SwitchModes.default,
11
+ resourcePathPrefix: '/static/app1/',
12
+ styles: ['styles/main.css'],
13
+ scripts: ['vendor.js', 'main.js'],
14
+ loadSerial: false,
15
+ manifest: '',
16
+ extra: {
17
+ appName: '应用1'
18
+ }
19
+ };
20
+
21
+ const app1WithManifest = {
22
+ ...app1,
23
+ manifest: '/static/app/manifest.json'
24
+ };
25
+
26
+ const app1WithPreload = {
27
+ ...app1,
28
+ preload: true
29
+ };
30
+
31
+ const app2 = {
32
+ name: 'app2',
33
+ hostParent: '.host-selector',
34
+ selector: 'app2-root',
35
+ routerPathPrefix: '/app2',
36
+ hostClass: 'app2-host',
37
+ preload: false,
38
+ switchMode: SwitchModes.coexist,
39
+ resourcePathPrefix: '/static/app2',
40
+ styles: ['styles/main.css'],
41
+ scripts: ['vendor.js', 'main.js'],
42
+ loadSerial: false,
43
+ extra: {
44
+ appName: '应用2'
45
+ }
46
+ };
47
+
48
+ const app2WithManifest = {
49
+ ...app2,
50
+ manifest: '/static/app/manifest.json'
51
+ };
52
+
53
+ const app2WithPreload = {
54
+ ...app2,
55
+ preload: true
56
+ };
57
+
58
+ export { app1, app1WithManifest, app1WithPreload, app2, app2WithManifest, app2WithPreload };
@@ -0,0 +1,2 @@
1
+ export * from './applications';
2
+ export * from './utils';
@@ -0,0 +1,31 @@
1
+ import { setDebugFactory, clearDebugFactory } from '../debug';
2
+
3
+ export function roundNumber(minNum: number, maxNum?: number): number {
4
+ switch (arguments.length) {
5
+ case 1:
6
+ return parseInt((Math.random() * minNum + 1) as any, 10);
7
+ case 2:
8
+ return parseInt((Math.random() * (maxNum! - minNum + 1) + minNum) as any, 10);
9
+ default:
10
+ return 0;
11
+ }
12
+ }
13
+
14
+ export function sample<T>(items: T[]): T {
15
+ const num = roundNumber(1, items.length);
16
+ return items[num - 1];
17
+ }
18
+
19
+ export function enableDebugForTest() {
20
+ const debugFactory = (namespace: string) => {
21
+ return (formatter: string) => {
22
+ console.log(`[${namespace}] ${formatter}`);
23
+ };
24
+ };
25
+
26
+ setDebugFactory(debugFactory as any);
27
+ }
28
+
29
+ export function disableDebugForTest() {
30
+ clearDebugFactory();
31
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/lib",
5
+ "declarationMap": true,
6
+ "target": "es2015",
7
+ "module": "es2015",
8
+ "moduleResolution": "node",
9
+ "declaration": true,
10
+ "sourceMap": true,
11
+ "inlineSources": true,
12
+ "emitDecoratorMetadata": true,
13
+ "experimentalDecorators": true,
14
+ "importHelpers": true,
15
+ "types": [],
16
+ "lib": ["dom", "es2018"]
17
+ },
18
+ "angularCompilerOptions": {
19
+ "skipTemplateCodegen": true,
20
+ "strictMetadataEmit": true,
21
+ "fullTemplateTypeCheck": true,
22
+ "strictInjectionParameters": true,
23
+ "enableResourceInlining": true,
24
+ "enableIvy": false
25
+ },
26
+ "exclude": ["src/test.ts", "**/*.spec.ts"]
27
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "declarationMap": false
5
+ },
6
+ "angularCompilerOptions": {
7
+ "compilationMode": "partial"
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/spec",
5
+ "types": [
6
+ "jasmine",
7
+ "node"
8
+ ]
9
+ },
10
+ "files": [
11
+ "src/test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tslint.json",
3
+ "rules": {
4
+ "directive-selector": [true, "attribute", "lib", "camelCase"],
5
+ "component-selector": [true, "element", "empty", "kebab-case"]
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ plugins: [require('autoprefixer')]
3
+ };
package/proxy.conf.js ADDED
@@ -0,0 +1,15 @@
1
+ const PROXY_CONFIG = {};
2
+
3
+ PROXY_CONFIG['/static/app1'] = {
4
+ target: 'http://localhost:3001',
5
+ secure: false,
6
+ changeOrigin: false
7
+ };
8
+
9
+ PROXY_CONFIG['/static/app2'] = {
10
+ target: 'http://localhost:3002',
11
+ secure: false,
12
+ changeOrigin: true
13
+ };
14
+
15
+ module.exports = PROXY_CONFIG;
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compileOnSave": false,
3
+ "compilerOptions": {
4
+ "baseUrl": "./",
5
+ "outDir": "./dist/out-tsc",
6
+ "sourceMap": true,
7
+ "declaration": false,
8
+ "module": "esnext",
9
+ "moduleResolution": "node",
10
+ "emitDecoratorMetadata": true,
11
+ "experimentalDecorators": true,
12
+ "importHelpers": true,
13
+ "target": "es5",
14
+ "typeRoots": ["node_modules/@types"],
15
+ "lib": ["es2018", "dom"],
16
+ "paths": {
17
+ "@demo/common": ["examples/common"],
18
+ "ngx-planet": ["packages/planet/src/public-api.ts"],
19
+ "ngx-planet/*": ["packages/planet/src/*"]
20
+ }
21
+ },
22
+ "angularCompilerOptions": {}
23
+ }
package/tslint.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "rulesDirectory": ["codelyzer"],
3
+ "rules": {
4
+ "arrow-return-shorthand": true,
5
+ "callable-types": true,
6
+ "class-name": true,
7
+ "comment-format": [true, "check-space"],
8
+ "curly": true,
9
+ "deprecation": {
10
+ "severity": "warn"
11
+ },
12
+ "eofline": true,
13
+ "forin": true,
14
+ "import-blacklist": [true, "rxjs/Rx"],
15
+ "import-spacing": true,
16
+ "indent": [true, "spaces"],
17
+ "interface-over-type-literal": true,
18
+ "label-position": true,
19
+ "max-line-length": [true, 140],
20
+ "member-access": false,
21
+ "member-ordering": [
22
+ true,
23
+ {
24
+ "order": ["static-field", "instance-field", "static-method", "instance-method"]
25
+ }
26
+ ],
27
+ "no-arg": true,
28
+ "no-bitwise": false,
29
+ "no-console": [true, "debug", "info", "time", "timeEnd", "trace"],
30
+ "no-construct": true,
31
+ "no-debugger": true,
32
+ "no-duplicate-super": true,
33
+ "no-empty": false,
34
+ "no-empty-interface": true,
35
+ "no-eval": true,
36
+ "no-inferrable-types": [true, "ignore-params"],
37
+ "no-misused-new": true,
38
+ "no-non-null-assertion": true,
39
+ "no-redundant-jsdoc": true,
40
+ "no-shadowed-variable": true,
41
+ "no-string-literal": false,
42
+ "no-string-throw": true,
43
+ "no-switch-case-fall-through": true,
44
+ "no-trailing-whitespace": true,
45
+ "no-unnecessary-initializer": true,
46
+ "no-unused-expression": true,
47
+ "no-use-before-declare": true,
48
+ "no-var-keyword": true,
49
+ "object-literal-sort-keys": false,
50
+ "one-line": [true, "check-open-brace", "check-catch", "check-else", "check-whitespace"],
51
+ "prefer-const": true,
52
+ "quotemark": [true, "single"],
53
+ "radix": true,
54
+ "semicolon": [true, "always", "strict-bound-class-methods"],
55
+ "triple-equals": [true, "allow-null-check"],
56
+ "typedef-whitespace": [
57
+ true,
58
+ {
59
+ "call-signature": "nospace",
60
+ "index-signature": "nospace",
61
+ "parameter": "nospace",
62
+ "property-declaration": "nospace",
63
+ "variable-declaration": "nospace"
64
+ }
65
+ ],
66
+ "unified-signatures": true,
67
+ "variable-name": false,
68
+ "whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type"],
69
+ "no-output-on-prefix": true,
70
+ "use-input-property-decorator": true,
71
+ "use-output-property-decorator": true,
72
+ "use-host-property-decorator": true,
73
+ "no-input-rename": true,
74
+ "no-output-rename": true,
75
+ "use-life-cycle-interface": true,
76
+ "use-pipe-transform-interface": true,
77
+ "component-class-suffix": true,
78
+ "directive-class-suffix": true
79
+ }
80
+ }
@@ -1,68 +0,0 @@
1
- import { NgZone, ApplicationRef, Injector } from '@angular/core';
2
- import { Observable } from 'rxjs';
3
- import { AssetsLoader } from '../assets-loader';
4
- import { PlanetApplication, PlanetRouterEvent, PlanetOptions } from '../planet.class';
5
- import { PlanetApplicationRef } from './planet-application-ref';
6
- import { PlanetApplicationService } from './planet-application.service';
7
- import { Router } from '@angular/router';
8
- export declare enum ApplicationStatus {
9
- assetsLoading = 1,
10
- assetsLoaded = 2,
11
- bootstrapping = 3,
12
- bootstrapped = 4,
13
- active = 5,
14
- loadError = 10
15
- }
16
- export interface AppsLoadingStartEvent {
17
- shouldLoadApps: PlanetApplication[];
18
- shouldUnloadApps: PlanetApplication[];
19
- }
20
- export interface AppStatusChangeEvent {
21
- app: PlanetApplication;
22
- status: ApplicationStatus;
23
- }
24
- export declare class PlanetApplicationLoader {
25
- private assetsLoader;
26
- private planetApplicationService;
27
- private ngZone;
28
- private firstLoad;
29
- private startRouteChangeEvent;
30
- private options;
31
- private inProgressAppAssetsLoads;
32
- private appsStatus;
33
- private portalApp;
34
- private routeChange$;
35
- private appStatusChange$;
36
- private appsLoadingStart$;
37
- get appStatusChange(): Observable<AppStatusChangeEvent>;
38
- get appsLoadingStart(): Observable<AppsLoadingStartEvent>;
39
- loadingDone: boolean;
40
- constructor(assetsLoader: AssetsLoader, planetApplicationService: PlanetApplicationService, ngZone: NgZone, router: Router, injector: Injector, applicationRef: ApplicationRef);
41
- private setAppStatus;
42
- private switchModeIsCoexist;
43
- private errorHandler;
44
- private takeOneStable;
45
- private setLoadingDone;
46
- private setupRouteChange;
47
- private startLoadAppAssets;
48
- private hideApp;
49
- private showApp;
50
- private destroyApp;
51
- private bootstrapApp;
52
- private getUnloadApps;
53
- private unloadApps;
54
- private preloadApps;
55
- private ensurePreloadApps;
56
- setOptions(options: Partial<PlanetOptions>): void;
57
- /**
58
- * reset route by current router
59
- */
60
- reroute(event: PlanetRouterEvent): void;
61
- private preloadInternal;
62
- /**
63
- * Preload planet application
64
- * @param app app
65
- * @param immediate bootstrap on stable by default, setting immediate is true, it will bootstrap immediate
66
- */
67
- preload(app: PlanetApplication, immediate?: boolean): Observable<PlanetApplicationRef>;
68
- }
@@ -1,32 +0,0 @@
1
- import { NgModuleRef } from '@angular/core';
2
- import { Router } from '@angular/router';
3
- import { Observable } from 'rxjs';
4
- import { PlanetPortalApplication } from './portal-application';
5
- import { PlantComponentConfig } from '../component/plant-component.config';
6
- import { PlanetComponentRef } from '../component/planet-component-ref';
7
- export interface BootstrapOptions {
8
- template: string;
9
- bootstrap: BootstrapAppModule;
10
- }
11
- export declare type BootstrapAppModule = (portalApp?: PlanetPortalApplication) => Promise<NgModuleRef<any>>;
12
- export declare type PlantComponentFactory = <TData, TComp>(componentName: string, config: PlantComponentConfig<TData>) => PlanetComponentRef<TComp>;
13
- export declare class PlanetApplicationRef {
14
- appModuleRef: NgModuleRef<any>;
15
- template: string;
16
- private innerSelector;
17
- get selector(): string;
18
- get bootstrapped(): boolean;
19
- private name;
20
- private portalApp;
21
- private appModuleBootstrap;
22
- private componentFactory;
23
- constructor(name: string, options: BootstrapOptions);
24
- private syncPortalRouteWhenNavigationEnd;
25
- bootstrap(app: PlanetPortalApplication): Observable<this>;
26
- getRouter(): Router;
27
- getCurrentRouterStateUrl(): string;
28
- navigateByUrl(url: string): void;
29
- getComponentFactory(): PlantComponentFactory;
30
- registerComponentFactory(componentFactory: PlantComponentFactory): void;
31
- destroy(): void;
32
- }
@@ -1,18 +0,0 @@
1
- import { PlanetApplication } from '../planet.class';
2
- import { HttpClient } from '@angular/common/http';
3
- import { Observable } from 'rxjs';
4
- import { AssetsLoader } from '../assets-loader';
5
- export declare class PlanetApplicationService {
6
- private http;
7
- private assetsLoader;
8
- private apps;
9
- private appsMap;
10
- constructor(http: HttpClient, assetsLoader: AssetsLoader);
11
- register<TExtra>(appOrApps: PlanetApplication<TExtra> | PlanetApplication<TExtra>[]): void;
12
- registerByUrl(url: string): Observable<void>;
13
- unregister(name: string): void;
14
- getAppsByMatchedUrl<TExtra>(url: string): PlanetApplication<TExtra>[];
15
- getAppByName(name: string): PlanetApplication<any>;
16
- getAppsToPreload(excludeAppNames?: string[]): PlanetApplication<any>[];
17
- getApps(): PlanetApplication<any>[];
18
- }
@@ -1,14 +0,0 @@
1
- import { Router, UrlTree, NavigationExtras } from '@angular/router';
2
- import { NgZone, Injector, ApplicationRef } from '@angular/core';
3
- import { GlobalEventDispatcher } from '../global-event-dispatcher';
4
- export declare class PlanetPortalApplication<TData = any> {
5
- applicationRef: ApplicationRef;
6
- injector: Injector;
7
- router: Router;
8
- ngZone: NgZone;
9
- globalEventDispatcher: GlobalEventDispatcher;
10
- data: TData;
11
- navigateByUrl(url: string | UrlTree, extras?: NavigationExtras): Promise<boolean>;
12
- run<T>(fn: (...args: any[]) => T): T;
13
- tick(): void;
14
- }
@@ -1,23 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { HttpClient } from '@angular/common/http';
3
- import { PlanetApplication } from './planet.class';
4
- export interface AssetsLoadResult {
5
- src: string;
6
- hashCode: number;
7
- loaded: boolean;
8
- status: string;
9
- }
10
- export declare class AssetsLoader {
11
- private http;
12
- private loadedSources;
13
- constructor(http: HttpClient);
14
- loadScript(src: string): Observable<AssetsLoadResult>;
15
- loadStyle(src: string): Observable<AssetsLoadResult>;
16
- loadScripts(sources: string[], serial?: boolean): Observable<AssetsLoadResult[]>;
17
- loadStyles(sources: string[]): Observable<AssetsLoadResult[]>;
18
- loadScriptsAndStyles(scripts?: string[], styles?: string[], serial?: boolean): Observable<[AssetsLoadResult[], AssetsLoadResult[]]>;
19
- loadAppAssets(app: PlanetApplication): Observable<[AssetsLoadResult[], AssetsLoadResult[]]>;
20
- loadManifest(url: string): Observable<{
21
- [key: string]: string;
22
- }>;
23
- }