Registry / devops / single-spa-aurelia-framework

single-spa-aurelia-framework

JSON →
library1.0.10jsnpmunverified

Adapter that exposes Aurelia v1 application lifecycle methods (bootstrap, mount, unmount) to single-spa. Version 1.0.10 is the current stable release. It manually bootstraps Aurelia, starts it, and sets the root on mount; for unmount it removes, detaches, and unbinds the root component (since Aurelia has no teardown API). Requires Aurelia v1, single-spa, and explicit dependency injection via Container.instance. Differentiates by providing a custom singleton (SingleSpaAureliaCustomProps) for passing customProps to Aurelia views, and supports debug logging. Known limitation: no official teardown means manual cleanup is used, which can lead to memory leaks if not handled carefully.

npm install single-spa-aurelia-framework
INSTALL
IMPORT
SIG · SINGLE-SPA-AURELIA
S
single-spa-aurelia-framework
devopsjavascriptv1.0.10
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (singleSpaAureliaFramework)
import singleSpaAureliaFramework from 'single-spa-aurelia-framework'
const singleSpaAureliaFramework = require('single-spa-aurelia-framework')
ESM default export – not a named export. CommonJS require() works but is not recommended.
bootstrap
const { bootstrap } = singleSpaAureliaFramework(...)
import { bootstrap } from 'single-spa-aurelia-framework'
bootstrap, mount, unmount are returned by calling the default export with options, not directly exported from the package.
SingleSpaAureliaCustomProps
import { SingleSpaAureliaCustomProps } from 'single-spa-aurelia-framework'
TypeScript type exported for custom props injection.

Exposes single-spa lifecycle methods from an Aurelia v1 application using the adapter.

import singleSpaAureliaFramework from 'single-spa-aurelia-framework'; import { bootstrap as aureliaBootstrap } from 'aurelia-bootstrapper'; import { Container } from 'aurelia-dependency-injection'; import { Aurelia, PLATFORM } from 'aurelia-framework'; export async function configure(aurelia: Aurelia) { aurelia.use.standardConfiguration(); // Do not call aurelia.start() or aurelia.setRoot() here } const lifecycles = singleSpaAureliaFramework({ configure, getInstance: () => Container.instance.get(Aurelia), bootstrap: aureliaBootstrap, component: PLATFORM.moduleName('app'), debug: false, }); export const bootstrap = lifecycles.bootstrap; export const mount = lifecycles.mount; export const unmount = lifecycles.unmount;
Debug
Known issues
gotchaUnmount does not fully teardown Aurelia; it only removes, detaches, and unbinds the root component. This may cause memory leaks if applications are mounted/unmounted repeatedly.
fix
Manually clean up subscriptions, timers, and event listeners in your Aurelia view models or use a framework that supports proper teardown.
affects: >=1.0
gotchaThe customProps object must have a top-level 'payload' property; other keys are ignored.
fix
Pass customProps as { payload: { user: ..., locale: ... } } in registerApplication().
affects: >=1.0
deprecatedPLATFORM.moduleName() is deprecated in Aurelia v1. Use a direct string path instead.
fix
Replace PLATFORM.moduleName('app') with 'app'.
affects: >=1.0
gotchaThe configure function must NOT call aurelia.start() or aurelia.setRoot(); the adapter does that on mount.
fix
Ensure your configure() only sets up plugins and features, not start/setRoot.
affects: >=1.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'get')
Container.instance is undefined if aurelia-dependency-injection is not configured or loaded too early.
fix
Ensure aurelia-dependency-injection is imported and Container is available before calling getInstance.
Error: aurelia is already started
The configure function called aurelia.start() or aurelia.setRoot(), conflicting with the adapter's lifecycle.
fix
Remove aurelia.start() and aurelia.setRoot() from the configure function.
Uncaught (in promise) TypeError: Cannot read property 'root' of null
The root component was not set properly, or unmount was called before mount completed.
fix
Ensure mount lifecycle completes before unmount is triggered, and check the component option.
Upgrade
Version history
1.0.10latest on npm
Audit
Dependencies
single-sparequiredpeer – requires single-spa lifecycle integration
aurelia-frameworkrequiredpeer – requires Aurelia v1 framework for bootstrapping and DI
aurelia-bootstrapperrequiredpeer – manual bootstrap function required
aurelia-dependency-injectionrequiredpeer – used to obtain Aurelia instance via Container.instance
Agent activity
8 hits · last 30 days
node
8
Resources
single-spa-aurelia-framework — npm install single-spa-aurelia-framework · libregistry