Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

single-spa

Package Overview
Dependencies
Maintainers
0
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

single-spa - npm Package Compare versions

Comparing version 6.0.3 to 7.0.0-beta.0

lib/esm/single-spa.dev.js

122

package.json
{
"name": "single-spa",
"version": "6.0.3",
"version": "7.0.0-beta.0",
"description": "The router for easy microfrontends",
"main": "lib/es2015/umd/single-spa.min.cjs",
"types": "typings/single-spa.d.ts",
"type": "module",
"main": "lib/umd/single-spa.min.cjs",
"publishConfig": {

@@ -14,30 +13,15 @@ "access": "public"

"development": {
"import": {
"types": "./typings/single-spa.d.ts",
"default": "./lib/es2015/esm/single-spa.dev.js"
},
"require": {
"types": "./typings/single-spa.d.cts",
"default": "./lib/es2015/umd/single-spa.dev.cjs"
}
"import": "./lib/esm/single-spa.dev.js",
"require": "./lib/umd/single-spa.dev.cjs",
"types": "./typings/single-spa.d.ts"
},
"production": {
"import": {
"types": "./typings/single-spa.d.ts",
"default": "./lib/es2015/esm/single-spa.min.js"
},
"require": {
"types": "./typings/single-spa.d.cts",
"default": "./lib/es2015/umd/single-spa.min.cjs"
}
"import": "./lib/esm/single-spa.min.js",
"require": "./lib/umd/single-spa.min.cjs",
"types": "./typings/single-spa.d.ts"
},
"default": {
"import": {
"types": "./typings/single-spa.d.ts",
"default": "./lib/es2015/esm/single-spa.min.js"
},
"require": {
"types": "./typings/single-spa.d.cts",
"default": "./lib/es2015/umd/single-spa.min.cjs"
}
"import": "./lib/esm/single-spa.min.js",
"require": "./lib/umd/single-spa.min.cjs",
"types": "./typings/single-spa.d.ts"
}

@@ -48,16 +32,5 @@ },

},
"module": "lib/es2015/esm/single-spa.min.js",
"tsd": {
"testDir": "spec/typings",
"compilerOptions": {
"lib": [
"dom",
"ES2015"
]
}
},
"files": [
"lib",
"typings/single-spa.d.ts",
"typings/single-spa.d.cts"
"typings"
],

@@ -83,63 +56,58 @@ "homepage": "https://single-spa.js.org",

"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/eslint-parser": "^7.14.7",
"@babel/core": "^7.23.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@babel/runtime": "^7.14.6",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-node-resolve": "^13.0.0",
"@rollup/plugin-replace": "^2.3.1",
"@types/jest": "^26.0.23",
"babel-jest": "^27.0.6",
"@babel/preset-env": "^7.23.7",
"@babel/preset-typescript": "^7.23.3",
"@babel/runtime": "^7.23.7",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.8",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-replace": "^6.0.1",
"@rollup/plugin-terser": "^0.4.4",
"@types/jest": "^29.5.13",
"@typescript-eslint/parser": "^8.7.0",
"babel-jest": "^29.7.0",
"babel-plugin-dynamic-import-node": "^2.3.0",
"concurrently": "^6.2.0",
"concurrently": "^9.0.1",
"cross-env": "^7.0.2",
"custom-event": "^1.0.1",
"eslint": "7.30.0",
"eslint": "9.11.1",
"eslint-config-important-stuff": "^1.1.0",
"eslint-plugin-es5": "^1.5.0",
"husky": "^7.0.0",
"jest": "^27.0.6",
"globals": "^15.9.0",
"husky": "^9.1.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"js-correct-lockfile": "^1.0.0",
"pinst": "^2.1.6",
"prettier": "^2.0.2",
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
"rollup": "^2.79.2",
"prettier": "^3.3.3",
"pretty-quick": "^4.0.0",
"rimraf": "^6.0.1",
"rollup": "^4.22.5",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"tsd": "^0.17.0"
"typescript": "^5.3.3"
},
"browserslist": [
"ie >= 11",
"last 4 Safari major versions",
"last 10 Chrome major versions",
"last 10 Firefox major versions",
"last 4 Edge major versions"
">5%",
"not ie <= 11"
],
"ignore": [
"examples",
"docs"
],
"scripts": {
"build": "pnpm run clean && concurrently pnpm:build:dev pnpm:build:prod pnpm:build:types",
"build:prod": "rollup -c --environment NODE_ENV:'production'",
"build:prod": "rollup -c --environment ROLLUP_ENV:'production'",
"build:dev": "rollup -c",
"build:analyze": "rollup -c --environment ANALYZER:'analyzer'",
"build:types": "node scripts/copy-types.js",
"build:types": "tsc",
"watch": "rollup -c -w",
"clean": "rimraf lib",
"clean": "rimraf lib typings",
"test": "concurrently -n w: 'pnpm:test:*'",
"test:browser": "cross-env BABEL_ENV=test jest --config jest-browser.config.js",
"test:node": "cross-env BABEL_ENV=test jest --config jest-node.config.js",
"test:types": "tsd",
"test:lockfile": "js-correct-lockfile pnpm",
"format": "prettier --write .",
"check-format": "prettier --check .",
"lint": "eslint src",
"_postinstall": "husky install"
"lint": "eslint src"
}
}

@@ -1,238 +0,17 @@

declare module "single-spa" {
interface CustomProps {
[str: string]: any;
[num: number]: any;
}
type CustomPropsFn<ExtraProps extends CustomProps = CustomProps> = (
name: string,
location: Location
) => ExtraProps;
export type AppProps = {
name: string;
singleSpa: any;
mountParcel(
parcelConfig: ParcelConfig,
customProps: ParcelProps & CustomProps
): Parcel;
};
export type ParcelConfig<ExtraProps = CustomProps> =
| ParcelConfigObject<ExtraProps>
| (() => Promise<ParcelConfigObject<ExtraProps>>);
type ParcelProps = { domElement: HTMLElement };
type ParcelConfigObject<ExtraProps = CustomProps> = {
name?: string;
} & LifeCycles<ExtraProps>;
type Parcel<ExtraProps = CustomProps> = {
mount(): Promise<null>;
unmount(): Promise<null>;
update?(customProps: ExtraProps): Promise<any>;
getStatus():
| "NOT_LOADED"
| "LOADING_SOURCE_CODE"
| "NOT_BOOTSTRAPPED"
| "BOOTSTRAPPING"
| "NOT_MOUNTED"
| "MOUNTING"
| "MOUNTED"
| "UPDATING"
| "UNMOUNTING"
| "UNLOADING"
| "SKIP_BECAUSE_BROKEN"
| "LOAD_ERROR";
loadPromise: Promise<null>;
bootstrapPromise: Promise<null>;
mountPromise: Promise<null>;
unmountPromise: Promise<null>;
};
type LifeCycleFn<ExtraProps> = (
config: ExtraProps & AppProps
) => Promise<any>;
export type LifeCycles<ExtraProps = {}> = {
bootstrap: LifeCycleFn<ExtraProps> | Array<LifeCycleFn<ExtraProps>>;
mount: LifeCycleFn<ExtraProps> | Array<LifeCycleFn<ExtraProps>>;
unmount: LifeCycleFn<ExtraProps> | Array<LifeCycleFn<ExtraProps>>;
update?: LifeCycleFn<ExtraProps> | Array<LifeCycleFn<ExtraProps>>;
};
export type StartOpts = {
urlRerouteOnly?: boolean;
};
// ./start.js
export function start(opts?: StartOpts): void;
// ./jquery-support.js
export function ensureJQuerySupport(jQuery?: any): void;
// ./applications/timeouts.js
/**
* Sets the timeout for the given lifecycle.
* @param {number} time - The timeout in milliseconds.
* @param {boolean=} dieOnTimeout - Whether to throw an error if the timeout is reached. Default false.
* @param {number=} warningMillis - The number of milliseconds before the timeout warning is triggered. Default 1000.
* @returns {void}
**/
export function setBootstrapMaxTime(
time: number,
dieOnTimeout?: boolean,
warningMillis?: number
): void;
/**
* Sets the timeout for the given lifecycle.
* @param {number} time - The timeout in milliseconds.
* @param {boolean=} dieOnTimeout - Whether to throw an error if the timeout is reached. Default false.
* @param {number=} warningMillis - The number of milliseconds before the timeout warning is triggered. Default 1000.
* @returns {void}
**/
export function setMountMaxTime(
time: number,
dieOnTimeout?: boolean,
warningMillis?: number
): void;
/**
* Sets the timeout for the given lifecycle.
* @param {number} time - The timeout in milliseconds.
* @param {boolean=} dieOnTimeout - Whether to throw an error if the timeout is reached. Default false.
* @param {number=} warningMillis - The number of milliseconds before the timeout warning is triggered. Default 1000.
* @returns {void}
**/
export function setUnmountMaxTime(
time: number,
dieOnTimeout?: boolean,
warningMillis?: number
): void;
/**
* Sets the timeout for the given lifecycle.
* @param {number} time - The timeout in milliseconds.
* @param {boolean=} dieOnTimeout - Whether to throw an error if the timeout is reached. Default false.
* @param {number=} warningMillis - The number of milliseconds before the timeout warning is triggered. Default 1000.
* @returns {void}
**/
export function setUnloadMaxTime(
time: number,
dieOnTimeout?: boolean,
warningMillis?: number
): void;
type Application<ExtraProps = {}> =
| LifeCycles<ExtraProps>
| ((config: ExtraProps & AppProps) => Promise<LifeCycles<ExtraProps>>);
type ActivityFn = (location: Location) => boolean;
type Activity = ActivityFn | string | (ActivityFn | string)[];
export type RegisterApplicationConfig<ExtraProps extends CustomProps = {}> = {
name: string;
app: Application<ExtraProps>;
activeWhen: Activity;
customProps?: ExtraProps | CustomPropsFn<ExtraProps>;
};
interface SingleSpaNewAppStatus {
[key: string]:
| "MOUNTED"
| "NOT_MOUNTED"
| "NOT_LOADED"
| "SKIP_BECAUSE_BROKEN";
}
interface SingleSpaAppsByNewStatus {
[MOUNTED]: string[];
[NOT_MOUNTED]: string[];
[NOT_LOADED]: string[];
[SKIP_BECAUSE_BROKEN]: string[];
}
export type SingleSpaCustomEventDetail = {
newAppStatuses: SingleSpaNewAppStatus;
appsByNewStatus: SingleSpaAppsByNewStatus;
totalAppChanges: number;
originalEvent?: Event;
oldUrl: string;
newUrl: string;
navigationIsCanceled: boolean;
cancelNavigation?: () => void;
};
// ./applications/apps.js
export function registerApplication<ExtraProps extends CustomProps = {}>(
appName: string,
applicationOrLoadingFn: Application<ExtraProps>,
activityFn: ActivityFn,
customProps?: ExtraProps | CustomPropsFn<ExtraProps>
): void;
export function registerApplication<ExtraProps extends CustomProps = {}>(
config: RegisterApplicationConfig<ExtraProps>
): void;
export function unregisterApplication(appName: string): Promise<any>;
export function getMountedApps(): string[];
export const {
NOT_LOADED = "NOT_LOADED",
LOADING_SOURCE_CODE = "LOADING_SOURCE_CODE",
NOT_BOOTSTRAPPED = "NOT_BOOTSTRAPPED",
BOOTSTRAPPING = "BOOTSTRAPPING",
NOT_MOUNTED = "NOT_MOUNTED",
MOUNTING = "MOUNTING",
MOUNTED = "MOUNTED",
UPDATING = "UPDATING",
UNMOUNTING = "UNMOUNTING",
UNLOADING = "UNLOADING",
SKIP_BECAUSE_BROKEN = "SKIP_BECAUSE_BROKEN",
LOAD_ERROR = "LOAD_ERROR",
};
export function getAppStatus(appName: string): string | null;
export function unloadApplication(
appName: string,
opts?: { waitForUnmount: boolean }
): Promise<any>;
export function checkActivityFunctions(location: Location): string[];
export function getAppNames(): string[];
// ./navigation/navigation-events.js'
export function navigateToUrl(
obj:
| string
| {
currentTarget: {
href: string;
};
preventDefault: any;
},
opts?: Object
): void;
// './navigation/reroute.js'
export function triggerAppChange(): Promise<any>;
// './applications/app-errors.js'
type AppError = Error & {
appOrParcelName: string;
};
export function addErrorHandler(handler: (error: AppError) => void): void;
export function removeErrorHandler(handler: (error: AppError) => void): void;
// './parcels/mount-parcel.js'
export function mountRootParcel<ExtraProps = CustomProps>(
parcelConfig: ParcelConfig<ExtraProps>,
parcelProps: ParcelProps & ExtraProps
): Parcel<ExtraProps>;
export function pathToActiveWhen(
path: string,
exactMatch?: boolean
): ActivityFn;
export function patchHistoryApi(opts?: StartOpts): void;
export { start } from "./start";
export { ensureJQuerySupport } from "./jquery-support";
export { setBootstrapMaxTime, setMountMaxTime, setUnmountMaxTime, setUnloadMaxTime, } from "./applications/timeouts";
export { registerApplication, unregisterApplication, getMountedApps, getAppStatus, unloadApplication, checkActivityFunctions, getAppNames, pathToActiveWhen, } from "./applications/apps";
export { navigateToUrl, patchHistoryApi } from "./navigation/navigation-events";
export { triggerAppChange } from "./navigation/reroute";
export { addErrorHandler, removeErrorHandler } from "./applications/app-errors";
export { mountRootParcel } from "./parcels/mount-parcel";
export { NOT_LOADED, LOADING_SOURCE_CODE, NOT_BOOTSTRAPPED, BOOTSTRAPPING, NOT_MOUNTED, MOUNTING, UPDATING, LOAD_ERROR, MOUNTED, UNLOADING, UNMOUNTING, SKIP_BECAUSE_BROKEN, } from "./applications/app.helpers";
import devtools from "./devtools/devtools";
declare global {
interface Window {
__SINGLE_SPA_DEVTOOLS__: {
exposedMethods: typeof devtools;
};
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc