Socket
Socket
Sign inDemoInstall

@micro-zoe/micro-app

Package Overview
Dependencies
0
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7

87

lib/index.d.ts

@@ -7,3 +7,3 @@ /// <reference path="../typings/global.d.ts" />

declare module '@micro-zoe/micro-app' {
export { default, MicroApp, getActiveApps, getAllApps, unmountApp, unmountAllApps, } from '@micro-zoe/micro-app/micro_app';
export { default, MicroApp, getActiveApps, getAllApps, unmountApp, unmountAllApps, reload, renderApp, } from '@micro-zoe/micro-app/micro_app';
export { default as preFetch, } from '@micro-zoe/micro-app/prefetch';

@@ -15,3 +15,3 @@ export { removeDomScope, pureCreateElement, version, } from '@micro-zoe/micro-app/libs/utils';

declare module '@micro-zoe/micro-app/micro_app' {
import type { OptionsType, MicroAppConfigType, Router, appName } from '@micro-app/types';
import type { OptionsType, MicroAppBaseType, Router, AppName, Func, lifeCyclesType, MicroAppConfig } from '@micro-app/types';
import preFetch from '@micro-zoe/micro-app/prefetch';

@@ -24,3 +24,3 @@ import { EventCenterForBaseApp } from '@micro-zoe/micro-app/interact';

*/
export function getActiveApps(excludeHiddenApp?: boolean): appName[];
export function getActiveApps(excludeHiddenApp?: boolean): AppName[];
export function getAllApps(): string[];

@@ -30,2 +30,3 @@ type unmountAppOptions = {

clearAliveState?: boolean;
clearData?: boolean;
};

@@ -38,13 +39,44 @@ /**

*/
export function unmountApp(appName: string, options?: unmountAppOptions): Promise<void>;
export function unmountAllApps(options?: unmountAppOptions): Promise<void>;
export class MicroApp extends EventCenterForBaseApp implements MicroAppConfigType {
export function unmountApp(appName: string, options?: unmountAppOptions): Promise<boolean>;
export function unmountAllApps(options?: unmountAppOptions): Promise<boolean>;
/**
* Re render app from the command line
* microApp.reload(destroy)
* @param appName app.name
* @param destroy unmount app with destroy mode
* @returns Promise<boolean>
*/
export function reload(appName: string, destroy?: boolean): Promise<boolean>;
interface RenderAppOptions extends MicroAppConfig {
name: string;
url: string;
container: string | Element;
baseroute?: string;
'default-page'?: string;
data?: Record<PropertyKey, unknown>;
onDataChange?: Func;
lifeCycles?: lifeCyclesType;
[key: string]: unknown;
}
/**
* Manually render app
* @param options RenderAppOptions
* @returns Promise<boolean>
*/
export function renderApp(options: RenderAppOptions): Promise<boolean>;
export class MicroApp extends EventCenterForBaseApp implements MicroAppBaseType {
tagName: string;
options: OptionsType;
router: Router;
preFetch: typeof preFetch;
router: Router;
unmountApp: typeof unmountApp;
unmountAllApps: typeof unmountAllApps;
getActiveApps: typeof getActiveApps;
getAllApps: typeof getAllApps;
reload: typeof reload;
renderApp: typeof renderApp;
start(options?: OptionsType): void;
}
const _default: MicroApp;
export default _default;
const microApp: MicroApp;
export default microApp;
}

@@ -100,3 +132,3 @@

export function isFunction(target: unknown): target is Function;
export function isPlainObject(target: unknown): target is Record<PropertyKey, unknown>;
export function isPlainObject<T = Record<PropertyKey, unknown>>(target: unknown): target is T;
export function isObject(target: unknown): target is Object;

@@ -108,2 +140,4 @@ export function isPromise(target: unknown): target is Promise<unknown>;

export function isURL(target: unknown): target is URL;
export function isElement(target: unknown): target is Element;
export function isNode(target: unknown): target is Node;
export function isProxyDocument(target: unknown): target is Document;

@@ -262,2 +296,9 @@ /**

export function isInlineScript(address: string): boolean;
/**
* call function with try catch
* @param fn target function
* @param appName app.name
* @param args arguments
*/
export function callFnWithTryCatch(fn: Func | null, appName: string, msgSuffix: string, ...args: unknown[]): void;
}

@@ -283,3 +324,4 @@

*/
setGlobalData(data: Record<PropertyKey, unknown>): void;
setGlobalData(data: Record<PropertyKey, unknown>, nextStep?: CallableFunction, force?: boolean): void;
forceSetGlobalData(data: Record<PropertyKey, unknown>, nextStep?: CallableFunction): void;
/**

@@ -290,2 +332,6 @@ * get global data

/**
* clear global data
*/
clearGlobalData(): void;
/**
* clear all listener of global data

@@ -322,4 +368,11 @@ * if appName exists, only the specified functions is cleared

*/
setData(appName: string, data: Record<PropertyKey, unknown>): void;
setData(appName: string, data: Record<PropertyKey, unknown>, nextStep?: CallableFunction, force?: boolean): void;
forceSetData(appName: string, data: Record<PropertyKey, unknown>, nextStep?: CallableFunction): void;
/**
* clear data from base app
* @param appName app.name
* @param fromBaseApp whether clear data from child app, default is true
*/
clearData(appName: string, fromBaseApp?: boolean): void;
/**
* clear all listener for specified micro app

@@ -351,3 +404,3 @@ * @param appName app.name

*/
getData(): Record<PropertyKey, unknown> | null;
getData(fromBaseApp?: boolean): Record<PropertyKey, unknown> | null;
/**

@@ -357,4 +410,10 @@ * dispatch data to base app

*/
dispatch(data: Record<PropertyKey, unknown>): void;
dispatch(data: Record<PropertyKey, unknown>, nextStep?: CallableFunction, force?: boolean): void;
forceDispatch(data: Record<PropertyKey, unknown>, nextStep?: CallableFunction): void;
/**
* clear data from child app
* @param fromBaseApp whether clear data from base app, default is false
*/
clearData(fromBaseApp?: boolean): void;
/**
* clear all listeners

@@ -361,0 +420,0 @@ */

2

package.json
{
"name": "@micro-zoe/micro-app",
"version": "1.0.0-alpha.6",
"version": "1.0.0-alpha.7",
"description": "A lightweight, efficient and powerful micro front-end framework",

@@ -5,0 +5,0 @@ "private": false,

@@ -10,3 +10,3 @@ declare module '@micro-app/types' {

type appName = string
type AppName = string

@@ -31,2 +31,3 @@ type SourceAddress = string

clearEventSource: boolean
clearData: boolean
}

@@ -104,4 +105,11 @@

esmodule: boolean
}
interface UnmountParam {
destroy: boolean,
clearData: boolean
unmountcb?: CallableFunction
}
// app instance

@@ -141,3 +149,3 @@ interface AppInterface {

// unmount app
unmount (destroy: boolean, unmountcb?: CallableFunction): void
unmount (unmountParam: UnmountParam): void

@@ -156,3 +164,3 @@ // app rendering error

// hidden app when disconnectedCallback with keep-alive
hiddenKeepAliveApp (): void
hiddenKeepAliveApp (callback?: CallableFunction): void

@@ -195,10 +203,10 @@ // show app when connectedCallback with keep-alive

interface lifeCyclesType {
created?(e?: CustomEvent): void
beforemount?(e?: CustomEvent): void
mounted?(e?: CustomEvent): void
unmount?(e?: CustomEvent): void
error?(e?: CustomEvent): void
beforeshow?(e?: CustomEvent): void
aftershow?(e?: CustomEvent): void
afterhidden?(e?: CustomEvent): void
created(e: CustomEvent): void
beforemount(e: CustomEvent): void
mounted(e: CustomEvent): void
unmount(e: CustomEvent): void
error(e: CustomEvent): void
beforeshow(e: CustomEvent): void
aftershow(e: CustomEvent): void
afterhidden(e: CustomEvent): void
}

@@ -255,4 +263,3 @@

type OptionsType = {
tagName?: string
interface MicroAppConfig {
shadowDOM?: boolean

@@ -273,5 +280,10 @@ destroy?: boolean

'keep-alive'?: boolean
'clear-data'?: boolean
esmodule?: boolean
ssr?: boolean
fiber?: boolean
}
interface OptionsType extends MicroAppConfig {
tagName?: string
lifeCycles?: lifeCyclesType

@@ -286,3 +298,3 @@ preFetchApps?: prefetchParamList

// MicroApp config
interface MicroAppConfigType {
interface MicroAppBaseType {
tagName: string

@@ -289,0 +301,0 @@ options: OptionsType

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc