
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
[](https://travis-ci.org/phodal/mooa) [](https://coveralls.io/github/phodal/mooa?branch=master) [!
A single SPA Utils for Angular 2+
based on single-spa && single-spa-angular-cli
difference:
Examples: see in examples/
Online Demo:
Features:
apps.json
Goal:
App Boilerplate: https://github.com/phodal/mooa-boilerplate
in Host and Child App
yarn add mooa
app.component.ts
)constructor(private renderer: Renderer2, http: HttpClient, private router: Router) {
// config Mooa
this.mooa = new Mooa({
mode: 'iframe',
debug: false,
parentElement: 'app-home',
urlPrefix: 'app',
switchMode: 'coexist',
preload: true,
includeZone: true
});
http.get<IAppOption[]>('/assets/apps.json')
.subscribe(
data => {
this.createApps(data);
},
err => console.log(err)
);
}
private createApps(data: IAppOption[]) {
data.map((config) => {
this.mooa.registerApplication(config.name, config, mooaRouter.hashPrefix(config.prefix));
});
this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
this.mooa.reRouter(event);
}
});
return this.mooa.start();
}
main.ts
for loadimport mooaPlatform from 'mooa';
if (environment.production) {
enableProdMode();
}
mooaPlatform.mount('help').then((opts) => {
platformBrowserDynamic().bootstrapModule(AppModule).then((module) => {
opts['attachUnmount'](module);
});
});
app.module.ts
const appRoutes: Routes = [
{path: '*', component: AppComponent}
...
];
@NgModule({
declarations: [
AppComponent,
...
],
imports: [
BrowserModule,
RouterModule.forRoot(
appRoutes
)
],
providers: [
{provide: APP_BASE_HREF, useValue: mooaPlatform.appBase()},
],
bootstrap: [AppComponent]
})
export class AppModule {
}
app.component.ts
constructor(private router: Router) {
mooaPlatform.handleRouterUpdate(this.router, 'app1');
}
npm install -g mooa
Examples: apps.txt
http://mooa.phodal.com/assets/app1
http://mooa.phodal.com/assets/help
mooa -g apps.txt
Examples:
[
{
"name": "app1",
"selector": "app-app1",
"baseScriptUrl": "/assets/app1",
"styles": [
"styles.bundle.css"
],
"prefix": "app/app1",
"scripts": [
"inline.bundle.js",
"polyfills.bundle.js",
"main.bundle.js"
]
}
]
config in Host app's app.component.ts
this.mooa = new Mooa({
mode: 'iframe',
debug: false,
parentElement: 'app-home',
urlPrefix: 'app',
switchMode: 'coexist'
})
use iframe as application container:
<app-home _nghost-c2="">
<iframe frameborder="" width="100%" height="100%" src="http://localhost:4200/app/help/homeassets/iframe.html" id="help_206547"></iframe>
</app-home>
hidden application when inactive:
<app-home _nghost-c2="">
<app-app1 _nghost-c0="" ng-version="5.2.8" style="display: none;"><nav _ngcontent-c0="" class="navbar"></app-app1>
<iframe frameborder="" width="100%" height="100%" src="http://localhost:4200/app/help/homeassets/iframe.html" id="help_206547"></iframe>
</app-home>
inline.bundle.js
will load script for /
path.
So, just copy *.chunk.js
files to dist/
, then deploy it.
exmples:
mooa.registerApplicationByLink('help', '/assets/help', mooaRouter.matchRoute('help'));
mooa.registerApplication(config.name, config, mooaRouter.matchRoute(config.prefix));
hybrid
if (config.sourceType) {
that.mooa.registerApplicationByLink(config.name, config.link, mooaRouter.matchRoute(config.name));
} else {
that.mooa.registerApplication(config.name, config, mooaRouter.matchRoute(config.prefix));
}
mooaPlatform.navigateTo({
appName: 'help',
router: 'home'
});
Copyright (c) 2013-2014 Christopher Simpkins Copyright (c) 2017-2018 Robin Coma Delperier
© 2018 A Phodal Huang's Idea. This code is distributed under the MIT license. See LICENSE
in this directory.
FAQs
[](https://travis-ci.org/phodal/mooa) [](https://coveralls.io/github/phodal/mooa?branch=master) [!
The npm package mooa receives a total of 78 weekly downloads. As such, mooa popularity was classified as not popular.
We found that mooa demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.