/// /// import type { IClientSideComponentManifest } from '@microsoft/sp-module-interfaces'; import { ServiceKey, type ServiceScope } from '@microsoft/sp-core-library'; import type { IModuleLoader, ErrorProcessor } from '../interfaces/IModuleLoader'; /** * Loader for SystemJS. * Provides the instance of SystemJS and allows methods for configuration. */ export default class SystemJsLoader implements IModuleLoader { static readonly serviceKey: ServiceKey; static readonly pluginName: string; private static readonly _systemImportEventName; /** * This is the configured base URL for SystemJS. * When a user tries to call SystemJS with a relative path, an error will show this as the base URL. * * Example: * `System.import("myModule") => Error: https://relative-path.invalid/myModule not found` */ private static readonly _invalidBaseUrl; private _originalSystemConfig; private _system; private _configuredFailoverPaths; constructor(serviceScope: ServiceScope); get loadEntryPointErrorProcessors(): ErrorProcessor[]; get loadComponentDependencyErrorProcessors(): ErrorProcessor[]; get loadPathDependencyErrorProcessors(): ErrorProcessor[]; ensure(manifest: IClientSideComponentManifest, module: unknown): void; /** * If a module hasn't been loaded with the specified name, * it created a new module and sets it in SystemJS */ _ensure(name: string, module: unknown): void; delete(manifest: IClientSideComponentManifest): void; /** * If a module has been loaded with the specified name, * it delete it from SystemJS */ _delete(name: string): void; /** * Calls actual System.config() */ systemConfig(config: SystemJSLoader.Config): void; load(manifest: IClientSideComponentManifest, name?: string, globalName?: string): Promise; loadFromFailoverPath(name: string): Promise; /** * Calls System.import() * Catches exceptions and returns a rejected promise with the error from SystemJS */ systemImport(name: string): Promise; /** Calls System.delete() with the name matching the input manifest */ systemDelete(manifest: IClientSideComponentManifest): void; /** * Sets the config for SystemJS. Handles global exports, renames the dependencies. * Also sets AddressStore with the right mapping between script and URL. */ configure(manifest: IClientSideComponentManifest): void; /** * Returns the dependencies of a component, as detected by SystemJS when importing the module. * This method ignores the manifest dependencies and looks only at the JS file instead. * Used as a helper to find mismatching dependencies. * * @returns Array with the dependencies in a component. Empty array if dependencies could not be found. */ getDependencies(manifest: IClientSideComponentManifest): string[]; /** * Executes the base configuration for SystemJS. It should be private but it's public * so STS pages can modify scriptLoad to be false. */ _baseSystemConfig(pluginName: string, scriptLoad: boolean): void; private _initialize; private _loadSystemJs; private _setCustomLoader; /** * Returns the id used by SystemJS in System.defined. * This allows to browse through SystemJS internals for additional data, like the JS dependencies. */ private _getDefinedId; /** * Configures the SystemJS metadata with the crossOrigin parameter, * and if the resource has a globalName; sets the global name configuration. * The crossOrigin parameter is needed for the SPFx service worker to transparently * read cross-domain resources. */ private _configureMetadata; /** * Checks if the loaded JS dependencies match with dependencies declared in the manifest. * This can happen when a component is re-built but the manifest hasn't been modified. * If missing dependencies are found, it throws with an error stating the first mismatch. * * @param manifest - Manifest to check * @param name - Name of the entry point. Unused in this function. */ private _checkEntryPointDependenciesError; } //# sourceMappingURL=SystemJsLoader.d.ts.map