@maxelms/create-plugin-cli 1.1.26 → 1.1.27
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/package.json +1 -1
- package/templates/angular-micro-app/.eslintrc.js +3 -0
- package/templates/angular-micro-app/README.md +5 -0
- package/templates/angular-micro-app/examples/main.css +2 -0
- package/templates/angular-micro-app/examples/main.js +2 -0
- package/templates/angular-micro-app/examples/main.js.LICENSE.txt +52 -0
- package/templates/angular-micro-app/examples/playground.html +1 -0
- package/templates/angular-micro-app/examples/react-dom.production.min.js +2 -0
- package/templates/angular-micro-app/examples/react-dom.production.min.js.LICENSE.txt +8 -0
- package/templates/angular-micro-app/examples/react.production.min.js +2 -0
- package/templates/angular-micro-app/examples/react.production.min.js.LICENSE.txt +8 -0
- package/templates/angular-micro-app/examples/vue.runtime.global.js +9054 -0
- package/templates/angular-micro-app/examples/zone.umd.min.js +2 -0
- package/templates/angular-micro-app/examples/zone.umd.min.js.LICENSE.txt +29 -0
- package/templates/angular-micro-app/manifest.json.tpl +3 -0
- package/templates/angular-micro-app/package.json.tpl +40 -0
- package/templates/angular-micro-app/pnpm-lock.yaml +7998 -0
- package/templates/angular-micro-app/public/configuration.json +34 -0
- package/templates/angular-micro-app/public/index.html.tpl +15 -0
- package/templates/angular-micro-app/src/about.component.ts +42 -0
- package/templates/angular-micro-app/src/app-routing.module.ts +12 -0
- package/templates/angular-micro-app/src/app.component.css +22 -0
- package/templates/angular-micro-app/src/app.component.html +304 -0
- package/templates/angular-micro-app/src/app.component.ts +42 -0
- package/templates/angular-micro-app/src/app.module.ts +27 -0
- package/templates/angular-micro-app/src/contact.component.ts +42 -0
- package/templates/angular-micro-app/src/home.component.ts +42 -0
- package/templates/angular-micro-app/src/index.ts +54 -0
- package/templates/angular-micro-app/src/props.service.ts +18 -0
- package/templates/angular-micro-app/src/single-spa-props.ts +7 -0
- package/templates/angular-micro-app/tsconfig.json +25 -0
- package/templates/angular-micro-app/webpack.config.js +112 -0
- package/templates/angular-micro-button/.eslintrc.js +3 -0
- package/templates/angular-micro-button/README.md +5 -0
- package/templates/angular-micro-button/manifest.json.tpl +3 -0
- package/templates/angular-micro-button/package.json.tpl +39 -0
- package/templates/angular-micro-button/pnpm-lock.yaml +7977 -0
- package/templates/angular-micro-button/public/configuration.json +34 -0
- package/templates/angular-micro-button/public/index.html.tpl +15 -0
- package/templates/angular-micro-button/src/app.component.css +10 -0
- package/templates/angular-micro-button/src/app.component.html +2 -0
- package/templates/angular-micro-button/src/app.component.ts.tpl +38 -0
- package/templates/angular-micro-button/src/app.module.ts +27 -0
- package/templates/angular-micro-button/src/components/content.component.css +116 -0
- package/templates/angular-micro-button/src/components/content.component.html +3 -0
- package/templates/angular-micro-button/src/components/content.component.ts +16 -0
- package/templates/angular-micro-button/src/index.ts.tpl +107 -0
- package/templates/angular-micro-button/src/master-props.ts +7 -0
- package/templates/angular-micro-button/tsconfig.json +25 -0
- package/templates/angular-micro-button/webpack.config.js +112 -0
- package/templates/angular-micro-field/.eslintrc.js +3 -0
- package/templates/angular-micro-field/README.md +5 -0
- package/templates/angular-micro-field/examples/main.css +2 -0
- package/templates/angular-micro-field/examples/main.js +2 -0
- package/templates/angular-micro-field/examples/main.js.LICENSE.txt +52 -0
- package/templates/angular-micro-field/examples/playground.html +1 -0
- package/templates/angular-micro-field/examples/react-dom.production.min.js +2 -0
- package/templates/angular-micro-field/examples/react-dom.production.min.js.LICENSE.txt +8 -0
- package/templates/angular-micro-field/examples/react.production.min.js +2 -0
- package/templates/angular-micro-field/examples/react.production.min.js.LICENSE.txt +8 -0
- package/templates/angular-micro-field/examples/vue.runtime.global.js +9054 -0
- package/templates/angular-micro-field/examples/zone.umd.min.js +2 -0
- package/templates/angular-micro-field/examples/zone.umd.min.js.LICENSE.txt +29 -0
- package/templates/angular-micro-field/manifest.json.tpl +3 -0
- package/templates/angular-micro-field/package.json.tpl +39 -0
- package/templates/angular-micro-field/pnpm-lock.yaml +7977 -0
- package/templates/angular-micro-field/public/configuration.json +34 -0
- package/templates/angular-micro-field/public/index.html.tpl +15 -0
- package/templates/angular-micro-field/src/app.component.css +10 -0
- package/templates/angular-micro-field/src/app.component.html +8 -0
- package/templates/angular-micro-field/src/app.component.ts.tpl +60 -0
- package/templates/angular-micro-field/src/app.module.ts +14 -0
- package/templates/angular-micro-field/src/components/content.component.css +116 -0
- package/templates/angular-micro-field/src/components/content.component.html +10 -0
- package/templates/angular-micro-field/src/components/content.component.ts +21 -0
- package/templates/angular-micro-field/src/index.ts.tpl +101 -0
- package/templates/angular-micro-field/src/master-props.ts +7 -0
- package/templates/angular-micro-field/tsconfig.json +25 -0
- package/templates/angular-micro-field/webpack.config.js +112 -0
- package/templates/angular-micro-plugin/package.json.tpl +2 -2
- package/templates/react-micro-app/package.json.tpl +6 -0
- package/templates/react-micro-button/package.json.tpl +5 -0
- package/templates/react-micro-button/src/index.tsx +1 -0
- package/templates/react-micro-field/package.json.tpl +5 -0
- package/templates/react-micro-field-umi/package.json.tpl +5 -0
- package/templates/react-micro-plugin/package.json.tpl +5 -0
- package/templates/react-micro-plugin-umi/package.json.tpl +5 -0
- package/templates/vue3-micro-button/package.json.tpl +1 -1
- package/templates/vue3-micro-field/package.json.tpl +1 -1
- package/templates/vue3-micro-plugin/package.json.tpl +1 -1
- package/templates/vue3vite-micro-button/package.json.tpl +1 -1
- package/templates/vue3vite-micro-plugin/package.json.tpl +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"propName1": {
|
|
3
|
+
"label": "配置项一",
|
|
4
|
+
"type": "string",
|
|
5
|
+
"defaultValue": "配置项内容"
|
|
6
|
+
},
|
|
7
|
+
"propName2": {
|
|
8
|
+
"label": "配置项二",
|
|
9
|
+
"type": "number",
|
|
10
|
+
"defaultValue": 350
|
|
11
|
+
},
|
|
12
|
+
"propName3": {
|
|
13
|
+
"label": "配置项三",
|
|
14
|
+
"type": "select",
|
|
15
|
+
"options": [
|
|
16
|
+
{
|
|
17
|
+
"label": "选项1",
|
|
18
|
+
"value": "option1"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"label": "选项2",
|
|
22
|
+
"value": "option2"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"label": "选项3",
|
|
26
|
+
"value": "option3"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"externalParams": {
|
|
31
|
+
"label": "外部参数",
|
|
32
|
+
"type": "string"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>Maxelms 页面组件 angular13</title>
|
|
7
|
+
<base href="/">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root-<%= timestamp %>"></div>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* App component styles - minimal styles for layout */
|
|
2
|
+
:host {
|
|
3
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
4
|
+
font-size: 14px;
|
|
5
|
+
color: #333;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
-webkit-font-smoothing: antialiased;
|
|
8
|
+
-moz-osx-font-smoothing: grayscale;
|
|
9
|
+
}
|
|
10
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Component, OnDestroy, OnInit, ChangeDetectorRef } from '@angular/core'
|
|
2
|
+
import { Subscription } from 'rxjs'
|
|
3
|
+
import { MasterPropsSubject } from './master-props'
|
|
4
|
+
|
|
5
|
+
type Value = {
|
|
6
|
+
text?: string
|
|
7
|
+
value?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: '#root-<%= timestamp %>',
|
|
12
|
+
templateUrl: './app.component.html',
|
|
13
|
+
styleUrls: ['./app.component.css'],
|
|
14
|
+
})
|
|
15
|
+
export class AppComponent implements OnInit, OnDestroy {
|
|
16
|
+
|
|
17
|
+
title = 'angular13';
|
|
18
|
+
propName1: string = '';
|
|
19
|
+
propName2: string = '';
|
|
20
|
+
isFormEditing?: boolean = false;
|
|
21
|
+
value?: string = '';
|
|
22
|
+
onChange?: (val: Value) => void;
|
|
23
|
+
|
|
24
|
+
private propsSub?: Subscription;
|
|
25
|
+
|
|
26
|
+
constructor(private cdr: ChangeDetectorRef) {}
|
|
27
|
+
|
|
28
|
+
ngOnInit() {
|
|
29
|
+
console.log('ngOnInit')
|
|
30
|
+
|
|
31
|
+
// 订阅 singleSpaProps
|
|
32
|
+
this.propsSub = MasterPropsSubject.subscribe((props: any) => {
|
|
33
|
+
// console.log('收到主应用传来的 props:', props)
|
|
34
|
+
const {
|
|
35
|
+
configurations, bizData,
|
|
36
|
+
isFormEditing, value, onChange
|
|
37
|
+
} = props || {}
|
|
38
|
+
this.propName1 = configurations?.propName1 || ''
|
|
39
|
+
this.propName2 = configurations?.propName2 || ''
|
|
40
|
+
// this.isFormEditing = isFormEditing || false
|
|
41
|
+
this.isFormEditing = true
|
|
42
|
+
this.value = value?.text || ''
|
|
43
|
+
console.log(value?.text, 123412341234)
|
|
44
|
+
this.onChange = onChange
|
|
45
|
+
this.cdr.detectChanges() // 手动触发变更检测
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onValueChange(newValue: string): void {
|
|
50
|
+
this.value = newValue;
|
|
51
|
+
console.log('Value changed to:', newValue);
|
|
52
|
+
// 这里可以添加其他逻辑,比如发送到父应用
|
|
53
|
+
this.onChange?.({ text: newValue, value: newValue });
|
|
54
|
+
this.cdr.detectChanges() // 手动触发变更检测
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ngOnDestroy() {
|
|
58
|
+
this.propsSub?.unsubscribe()
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core'
|
|
2
|
+
import { BrowserModule } from '@angular/platform-browser'
|
|
3
|
+
import { AppComponent } from './app.component'
|
|
4
|
+
import { ContentComponent } from './components/content.component'
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
declarations: [
|
|
8
|
+
AppComponent,
|
|
9
|
+
ContentComponent,
|
|
10
|
+
],
|
|
11
|
+
imports: [BrowserModule],
|
|
12
|
+
bootstrap: [AppComponent],
|
|
13
|
+
})
|
|
14
|
+
export class AppModule {}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
.content {
|
|
2
|
+
display: flex;
|
|
3
|
+
margin: 82px auto 32px;
|
|
4
|
+
padding: 0 16px;
|
|
5
|
+
max-width: 960px;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.readonly-text {
|
|
11
|
+
padding: 20px;
|
|
12
|
+
border: 1px solid #ddd;
|
|
13
|
+
border-radius: 8px;
|
|
14
|
+
background-color: #f9f9f9;
|
|
15
|
+
min-width: 300px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.readonly-text p {
|
|
19
|
+
margin: 8px 0;
|
|
20
|
+
color: #333;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
input {
|
|
24
|
+
padding: 10px;
|
|
25
|
+
border: 1px solid #ccc;
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
min-width: 300px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
input:focus {
|
|
32
|
+
outline: none;
|
|
33
|
+
border-color: #1976d2;
|
|
34
|
+
box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.card {
|
|
38
|
+
border-radius: 4px;
|
|
39
|
+
border: 1px solid #eee;
|
|
40
|
+
background-color: #fafafa;
|
|
41
|
+
height: 40px;
|
|
42
|
+
width: 200px;
|
|
43
|
+
margin: 0 8px 16px;
|
|
44
|
+
padding: 16px;
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: row;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
transition: all 0.2s ease-in-out;
|
|
50
|
+
line-height: 24px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.card.card-small {
|
|
54
|
+
height: 16px;
|
|
55
|
+
width: 168px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.card.highlight-card {
|
|
59
|
+
background-color: #1976d2;
|
|
60
|
+
color: white;
|
|
61
|
+
font-weight: 600;
|
|
62
|
+
border: none;
|
|
63
|
+
width: auto;
|
|
64
|
+
min-width: 30%;
|
|
65
|
+
position: relative;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.card.card.highlight-card span {
|
|
69
|
+
margin-left: 60px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
svg#rocket {
|
|
73
|
+
width: 80px;
|
|
74
|
+
position: absolute;
|
|
75
|
+
left: -10px;
|
|
76
|
+
top: -24px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
svg#rocket-smoke {
|
|
80
|
+
height: calc(100vh - 95px);
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 10px;
|
|
83
|
+
right: 180px;
|
|
84
|
+
z-index: -10;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
svg#clouds {
|
|
88
|
+
position: fixed;
|
|
89
|
+
bottom: -160px;
|
|
90
|
+
left: -230px;
|
|
91
|
+
z-index: -10;
|
|
92
|
+
width: 1920px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* Responsive Styles */
|
|
96
|
+
@media screen and (max-width: 767px) {
|
|
97
|
+
.content {
|
|
98
|
+
width: 100%;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.card.highlight-card span {
|
|
102
|
+
margin-left: 72px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
svg#rocket-smoke {
|
|
106
|
+
right: 120px;
|
|
107
|
+
transform: rotate(-5deg);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@media screen and (max-width: 575px) {
|
|
112
|
+
svg#rocket-smoke {
|
|
113
|
+
display: none;
|
|
114
|
+
visibility: hidden;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="content" role="main">
|
|
2
|
+
<!-- 当 isFormEditing 为 true 时显示 input 框 -->
|
|
3
|
+
<input *ngIf="isFormEditing" [title]="propName1" [placeholder]="propName2" [value]="value"
|
|
4
|
+
(input)="onInputChange($event)" />
|
|
5
|
+
|
|
6
|
+
<!-- 当 isFormEditing 为 false 时显示只读文本 -->
|
|
7
|
+
<div *ngIf="!isFormEditing" class="readonly-text">
|
|
8
|
+
{{ value }}
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'app-content',
|
|
5
|
+
templateUrl: './content.component.html',
|
|
6
|
+
styleUrls: ['./content.component.css']
|
|
7
|
+
})
|
|
8
|
+
export class ContentComponent {
|
|
9
|
+
@Input() title: string = 'angular13';
|
|
10
|
+
@Input() propName1: string = '';
|
|
11
|
+
@Input() propName2: string = '';
|
|
12
|
+
@Input() value: string = '';
|
|
13
|
+
@Input() isFormEditing: boolean = false;
|
|
14
|
+
|
|
15
|
+
@Output() valueChange = new EventEmitter<string>();
|
|
16
|
+
|
|
17
|
+
onInputChange(event: Event): void {
|
|
18
|
+
const target = event.target as HTMLInputElement;
|
|
19
|
+
this.valueChange.emit(target.value);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { enableProdMode } from '@angular/core'
|
|
2
|
+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
|
|
3
|
+
// import { singleSpaAngular, getSingleSpaExtraProviders } from 'single-spa-angular';
|
|
4
|
+
import { registerPlugin, poweredByMaxelms } from '@maxelms/create-pulgin-api'
|
|
5
|
+
|
|
6
|
+
import { AppModule } from './app.module'
|
|
7
|
+
import { MasterPropsSubject } from './master-props'
|
|
8
|
+
|
|
9
|
+
const container = '#root-<%= timestamp %>'
|
|
10
|
+
const environment = process.env.NODE_ENV === 'production'
|
|
11
|
+
let $root: any
|
|
12
|
+
let appModuleRef: any = null; // 保存应用模块引用
|
|
13
|
+
|
|
14
|
+
if (environment) {
|
|
15
|
+
enableProdMode()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!poweredByMaxelms) {
|
|
19
|
+
const props = {
|
|
20
|
+
configurations: {
|
|
21
|
+
'propName1': '11',
|
|
22
|
+
'propName2': 3502,
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
console.log(props, 'props poweredByMaxelms')
|
|
26
|
+
render(props, 'mount')
|
|
27
|
+
|
|
28
|
+
// 为开发环境添加全局卸载函数
|
|
29
|
+
(window as any).unmountAngularApp = unmountApp
|
|
30
|
+
} else {
|
|
31
|
+
|
|
32
|
+
registerPlugin?.({
|
|
33
|
+
bootstrap() {
|
|
34
|
+
},
|
|
35
|
+
mount(props: any) {
|
|
36
|
+
// console.log(props, 'props mount')
|
|
37
|
+
render(props, 'mount')
|
|
38
|
+
$root = document.querySelector(`#${props.containerId} ${container}`)
|
|
39
|
+
},
|
|
40
|
+
update(props: any) {
|
|
41
|
+
// console.log(props, 'props update')
|
|
42
|
+
render(props, 'update')
|
|
43
|
+
},
|
|
44
|
+
unmount(props: any) {
|
|
45
|
+
// console.log(props, 'props unmount')
|
|
46
|
+
unmountApp()
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
function render(singleSpaProps: any, mode: 'mount' | 'update') {
|
|
53
|
+
MasterPropsSubject.next(singleSpaProps)
|
|
54
|
+
|
|
55
|
+
if (mode === 'mount') {
|
|
56
|
+
// 首次挂载时创建应用
|
|
57
|
+
console.log('首次挂载,创建 Angular 应用')
|
|
58
|
+
appModuleRef = platformBrowserDynamic().bootstrapModule(AppModule, {
|
|
59
|
+
ngZone: 'noop',
|
|
60
|
+
})
|
|
61
|
+
return appModuleRef
|
|
62
|
+
} else if (mode === 'update') {
|
|
63
|
+
// 更新时只发送新的 props,不重新创建应用
|
|
64
|
+
console.log('更新模式,只发送新的 props')
|
|
65
|
+
MasterPropsSubject.next(singleSpaProps)
|
|
66
|
+
return appModuleRef
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function unmountApp() {
|
|
71
|
+
console.log('卸载 Angular 应用')
|
|
72
|
+
|
|
73
|
+
if (appModuleRef) {
|
|
74
|
+
try {
|
|
75
|
+
// 销毁 Angular 应用实例
|
|
76
|
+
appModuleRef.destroy()
|
|
77
|
+
console.log('Angular 应用已成功销毁')
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error('销毁 Angular 应用时出错:', error)
|
|
80
|
+
} finally {
|
|
81
|
+
// 清理引用
|
|
82
|
+
appModuleRef = null
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
console.log('没有找到 Angular 应用实例,无需销毁')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 清理 DOM 元素
|
|
89
|
+
try {
|
|
90
|
+
const containerElement = document.querySelector(container)
|
|
91
|
+
if (containerElement) {
|
|
92
|
+
containerElement.innerHTML = ''
|
|
93
|
+
console.log('DOM 容器已清理')
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error('清理 DOM 时出错:', error)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 清理全局变量
|
|
100
|
+
$root = null
|
|
101
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReplaySubject } from 'rxjs'
|
|
2
|
+
|
|
3
|
+
export const MasterPropsSubject = new ReplaySubject<MasterProps>(1)
|
|
4
|
+
|
|
5
|
+
// Add any custom single-spa props you have to this type def
|
|
6
|
+
// https://single-spa.js.org/docs/building-applications.html#custom-props
|
|
7
|
+
export type MasterProps = any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"sourceMap": true,
|
|
7
|
+
"declaration": false,
|
|
8
|
+
"downlevelIteration": true,
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"importHelpers": true,
|
|
12
|
+
"target": "es2017",
|
|
13
|
+
"module": "es2020",
|
|
14
|
+
"lib": ["es2018", "dom"],
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"noImplicitAny": false,
|
|
17
|
+
"strict": false
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"src/index.ts"
|
|
21
|
+
],
|
|
22
|
+
"include": [
|
|
23
|
+
"src/app/**/*",
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
3
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
4
|
+
const { AngularWebpackPlugin } = require('@ngtools/webpack')
|
|
5
|
+
|
|
6
|
+
const isProduction = process.env.NODE_ENV == 'production'
|
|
7
|
+
|
|
8
|
+
const config = {
|
|
9
|
+
entry: {
|
|
10
|
+
index: './src/index.ts',
|
|
11
|
+
},
|
|
12
|
+
output: {
|
|
13
|
+
publicPath: '',
|
|
14
|
+
path: path.resolve(__dirname, 'dist'),
|
|
15
|
+
filename: isProduction
|
|
16
|
+
? '[name].[contenthash].bundle.js'
|
|
17
|
+
: '[name].bundle.js',
|
|
18
|
+
},
|
|
19
|
+
devServer: {
|
|
20
|
+
open: ['/', '/playground.html'],
|
|
21
|
+
host: 'localhost',
|
|
22
|
+
port: 8080,
|
|
23
|
+
headers: {
|
|
24
|
+
'Access-Control-Allow-Origin': '*',
|
|
25
|
+
},
|
|
26
|
+
proxy: {
|
|
27
|
+
'/api/': {
|
|
28
|
+
target: 'https://max-ai.maxelms.com/',
|
|
29
|
+
changeOrigin: true,
|
|
30
|
+
cookieDomainRewrite: '',
|
|
31
|
+
},
|
|
32
|
+
'/app/api/': {
|
|
33
|
+
target: 'https://max-ai.maxelms.com/',
|
|
34
|
+
changeOrigin: true,
|
|
35
|
+
cookieDomainRewrite: '',
|
|
36
|
+
},
|
|
37
|
+
'/app-admin/api/': {
|
|
38
|
+
target: 'https://max-ai.maxelms.com/',
|
|
39
|
+
changeOrigin: true,
|
|
40
|
+
cookieDomainRewrite: '',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
static: [{
|
|
44
|
+
directory: path.join(__dirname, 'examples/'),
|
|
45
|
+
}, {
|
|
46
|
+
directory: path.join(__dirname, 'public/'),
|
|
47
|
+
}],
|
|
48
|
+
},
|
|
49
|
+
plugins: [
|
|
50
|
+
new HtmlWebpackPlugin({
|
|
51
|
+
inject: true,
|
|
52
|
+
template: 'public/index.html',
|
|
53
|
+
chunks: ['index'],
|
|
54
|
+
filename: 'index.html',
|
|
55
|
+
}),
|
|
56
|
+
new CopyWebpackPlugin({
|
|
57
|
+
patterns: [
|
|
58
|
+
{
|
|
59
|
+
from: 'public',
|
|
60
|
+
globOptions: {
|
|
61
|
+
dot: true,
|
|
62
|
+
gitignore: true,
|
|
63
|
+
ignore: ['**/public/index.html', '**/public/configuration.html'],
|
|
64
|
+
},
|
|
65
|
+
noErrorOnMissing: true,
|
|
66
|
+
},
|
|
67
|
+
{ from: 'README.md' },
|
|
68
|
+
{ from: 'manifest.json' },
|
|
69
|
+
],
|
|
70
|
+
}),
|
|
71
|
+
new AngularWebpackPlugin({
|
|
72
|
+
tsconfig: './tsconfig.json',
|
|
73
|
+
jitMode: true,
|
|
74
|
+
}),
|
|
75
|
+
],
|
|
76
|
+
module: {
|
|
77
|
+
rules: [
|
|
78
|
+
{
|
|
79
|
+
test: /\.ts$/,
|
|
80
|
+
loader: '@ngtools/webpack',
|
|
81
|
+
exclude: /node_modules/,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
test: /\.html$/,
|
|
85
|
+
use: 'raw-loader',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
test: /\.css$/,
|
|
89
|
+
use: ['to-string-loader', 'css-loader'],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
|
|
93
|
+
type: 'asset',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
resolve: {
|
|
98
|
+
extensions: ['.ts', '.js'],
|
|
99
|
+
alias: {
|
|
100
|
+
'@': path.resolve('src'),
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
module.exports = () => {
|
|
106
|
+
if (isProduction) {
|
|
107
|
+
config.mode = 'production'
|
|
108
|
+
} else {
|
|
109
|
+
config.mode = 'development'
|
|
110
|
+
}
|
|
111
|
+
return config
|
|
112
|
+
}
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@angular/core": "13.0.0",
|
|
11
11
|
"@angular/platform-browser": "13.0.0",
|
|
12
12
|
"@angular/platform-browser-dynamic": "13.0.0",
|
|
13
|
-
"@maxelms/create-plugin-cli": "1.
|
|
14
|
-
"@maxelms/create-pulgin-api": "1.0.0",
|
|
13
|
+
"@maxelms/create-plugin-cli": "^1.0.0",
|
|
14
|
+
"@maxelms/create-pulgin-api": "^1.0.0",
|
|
15
15
|
"@ngtools/webpack": "13",
|
|
16
16
|
"css-loader": "7.1.2",
|
|
17
17
|
"raw-loader": "4.0.2",
|