Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | 247x 741x 741x 741x 741x 14279x 4759x 4759x 4265x 4759x 9518x 741x 741x 1482x 9518x 4759x 741x 741x 741x 247x 247x 247x 494x 494x | // Runtime plugin loading helpers, imported by the generated pluginImports.js
// (codegen in platform/app/.rspack/writePluginImportsFile.js — both build
// pipelines regenerate that file from the same codegen, so they share this
// module). All descriptor/cache/allowlist/audit logic lives here, testable
// under jest; the codegen only emits per-package static branches. This module
// is the single gate for the loadModule URL fallthrough AND the runtime
// descriptor loader for window.config.extensions / window.config.modes.
import satisfies from 'semver/functions/satisfies';
import { isOriginAllowed } from './utils/isOriginAllowed';
export interface RuntimePluginDescriptor {
/** MUST equal the extension/mode id exported by the package (settled contract). */
packageName: string;
/** Absolute URL, '/rooted' path, or path relative to PUBLIC_URL. */
importPath: string;
/**
* Format discriminator (strict, per RP-DESC-4 in
* platform/docs/docs/development/specs/runtime-plugins/implementation.md): UMD builds
* MUST set globalName (normally equal to packageName, matching the plugin build's
* output.library name) and the loader returns window[globalName]; ESM builds
* MUST omit it and the loader
* returns the import() namespace's default export. There is no fallback
* chain and the loader never defaults globalName to packageName.
*/
globalName?: string;
/** semver range checked against process.env.VERSION_NUMBER (fail-closed). */
coreVersionRange?: string;
/** 'sha256-…'|'sha384-…'|'sha512-…'; REQUIRED when importPath is cross-origin. */
integrity?: string;
/** Stylesheet URLs appended as <link rel="stylesheet">; same allowlist rules. */
styles?: string[];
}
export type RuntimePluginStatus =
| 'loaded'
| 'refused-origin'
| 'integrity-failed'
| 'version-mismatch'
| 'import-error'
| 'registration-error'
| 'duplicate-of-built-in';
export interface RuntimePluginAuditRecord {
packageName: string;
/** Which list the descriptor came from: window.config.extensions or .modes.
* Absent on URL-fallthrough records, which load libraries, not plugins. */
kind?: 'extension' | 'mode';
importPath: string;
resolvedUrl?: string;
status: RuntimePluginStatus;
hostVersion: string; // trimmed process.env.VERSION_NUMBER
requiredRange?: string; // descriptor.coreVersionRange
/** Derived from the descriptor discriminator: globalName present = 'umd', absent = 'esm'. */
format?: 'umd' | 'esm';
error?: string;
durationMs?: number;
timestamp: string; // ISO 8601
surfaced?: boolean; // internal: notification already shown
}
/**
* Loaded runtime modules keyed by packageName. LOAD-BEARING for Mode.tsx:
* a bundled mode listing a runtime-loaded extension in extensionDependencies
* re-resolves it by BARE package name through the generated loadModule, whose
* string branch consults this cache via resolveRuntimeModule.
*/
const runtimeModules = new Map<string, unknown>();
function getAudit(): RuntimePluginAuditRecord[] {
const w = window as any;
w.__ohif = w.__ohif || {};
w.__ohif.runtimePlugins = w.__ohif.runtimePlugins || [];
return w.__ohif.runtimePlugins;
}
export function isRuntimeDescriptor(x: unknown): x is RuntimePluginDescriptor {
return (
!!x &&
typeof x === 'object' &&
!Array.isArray(x) &&
typeof (x as any).packageName === 'string' &&
typeof (x as any).importPath === 'string'
);
}
/** String-branch cache consulted by generated loadModule (see runtimeModules above). */
export function resolveRuntimeModule(name: string): unknown | undefined {
return runtimeModules.get(name);
}
/**
* Assigns the host's shared packages to window (runtimeShared.ts). Every path
* that runs a plugin bundle awaits this first: the bundle reads its externals
* from those globals when its file runs. It loads here rather than from
* index.js so that a viewer with no runtime plugins never downloads it;
* importing it at startup put the cornerstone extension and libraries into
* every deployment's initial scripts. The bundler fetches the chunk once.
*/
function shareHostPackages(): Promise<unknown> {
return import('./runtimeShared');
}
/**
* Plugin self-sharing: the generated loadModule passes every compiled-in
* extension and mode through here, which puts the whole module (its default
* export and every named export) on window under its package name. A UMD
* runtime plugin built with .rspack/pluginExternals.js leaves every @ohif/*
* import for the host to provide, and reads it from that global.
*
* Never overwrites an existing global. The default and cornerstone extensions
* are usually shared here first; runtimeShared.ts assigns the same modules
* again before the first runtime plugin loads. Unlike that list, these globals
* carry no compatibility promise: a plugin's exports can change between releases.
*/
export function sharePlugin<T>(packageName: string, module: T): T {
const globals = window as unknown as Record<string, unknown>;
if (globals[packageName] === undefined) {
globals[packageName] = module;
}
return module;
}
function isRuntimeEntry(entry: unknown): boolean {
return isRuntimeDescriptor(entry) || (Array.isArray(entry) && isRuntimeDescriptor(entry[0]));
}
/**
* Loads plugin entries in two phases: compiled-in plugins first, then runtime
* descriptors. A UMD runtime plugin reads its dependencies from window once,
* when its file runs, so the compiled-in plugins in the same list must already
* be shared (see sharePlugin) by then. Compiled-in extensions marked
* `default: false` in pluginConfig.json load only when a mode needs them, so a
* runtime plugin that imports one relies on the deployer also listing it, by
* name, in window.config.extensions. Within a phase entries load in
* parallel; results keep the input order.
*/
export async function loadInPhases<T>(
entries: unknown[],
load: (entry: unknown) => Promise<T>
): Promise<T[]> {
const results: T[] = new Array(entries.length);
const loadPhase = (runtime: boolean) =>
Promise.all(
entries.map(async (entry, i) => {
if (isRuntimeEntry(entry) === runtime) {
results[i] = await load(entry);
}
})
);
await loadPhase(false);
await loadPhase(true);
return results;
}
/**
* URL-shaped module specifiers: absolute http(s) URLs or explicit paths.
* Anything else is treated as a bare package name.
*/
export function isUrlLike(name: string): boolean {
return (
name.startsWith('http://') ||
name.startsWith('https://') ||
name.startsWith('/') ||
name.startsWith('./') ||
name.startsWith('../')
);
}
/**
* Origins allowed to serve runtime-loaded plugin code. Same-origin is always
* allowed; every other origin must be listed in
* window.config.runtimePluginOrigins (array of origin strings).
* Function-style app configs cannot carry the array on window.config, so the
* canonical stash window.__ohif.runtimePluginOrigins takes precedence.
*/
export function getAllowedRuntimeOrigins(): string[] {
const w = window as any;
const configured = w.__ohif?.runtimePluginOrigins ?? w.config?.runtimePluginOrigins ?? [];
const extra = Array.isArray(configured) ? configured : [];
return [window.location.origin, ...extra]; // same-origin implicit, deny-by-default
}
/**
* Deny-by-default origin allowlist check for runtime-loaded plugin code.
* The allowed origins are this page's plus window.config.runtimePluginOrigins
* (see getAllowedRuntimeOrigins); isOriginAllowed does the comparison.
*/
export function isAllowedRuntimeOrigin(url: URL): boolean {
return isOriginAllowed(url, getAllowedRuntimeOrigins());
}
function resolveImportUrl(importPath: string): URL {
// Matches the codegen's importPath semantics: absolute http(s) and '/rooted'
// paths pass through; relative paths resolve against PUBLIC_URL
// (window.PUBLIC_URL is set by the index.html bootstrap). Resolving through
// an absolute base also makes protocol-relative specifiers
// ('//evil.example.com/x.js', which pass the startsWith('/') check) resolve
// to their real cross-origin so the allowlist can deny them.
const base = new URL((window as any).PUBLIC_URL || '/', window.location.href);
return new URL(importPath, base);
}
/** Cross-origin path: fetch -> SubtleCrypto digest -> blob URL for import().
* CSP caveat: the fetch needs the plugin's origin in `connect-src`, and
* importing the blob URL needs `script-src blob:`; the baseline deployment
* CSP includes neither — deployments using cross-origin runtime extensions
* must extend CSP_HEADER (see deployment/runtime-plugins.md). Server must send
* CORS. */
async function fetchWithIntegrity(url: URL, integrity: string): Promise<string> {
const m = /^(sha256|sha384|sha512)-(.+)$/.exec(integrity);
Iif (!m) {
throw Object.assign(new Error(`malformed integrity "${integrity}"`), {
name: 'IntegrityError',
});
}
const algo = { sha256: 'SHA-256', sha384: 'SHA-384', sha512: 'SHA-512' }[m[1]];
const response = await fetch(url.href, { mode: 'cors' });
Iif (!response.ok) {
throw new Error(`fetch ${url.href} failed: HTTP ${response.status}`);
}
const buf = await response.arrayBuffer();
const digest = new Uint8Array(await crypto.subtle.digest(algo, buf));
let bin = '';
for (let i = 0; i < digest.length; i += 0x8000) {
// chunked: avoid arg-spread stack limits
bin += String.fromCharCode.apply(null, digest.subarray(i, i + 0x8000) as any);
}
Iif (btoa(bin) !== m[2]) {
throw Object.assign(new Error('integrity mismatch'), { name: 'IntegrityError' });
}
return URL.createObjectURL(new Blob([buf], { type: 'text/javascript' }));
}
function injectStyles(styles: string[] | undefined): void {
for (const s of styles || []) {
try {
const url = resolveImportUrl(s);
Iif (!isAllowedRuntimeOrigin(url)) {
console.error(`OHIF: refusing stylesheet from non-allowlisted origin: ${s}`);
continue;
}
Iif (document.querySelector(`link[href="${url.href}"]`)) {
continue;
}
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = url.href;
document.head.appendChild(link);
} catch (e) {
console.error(`OHIF: bad stylesheet URL "${s}"`, e);
}
}
}
/** Loads one app-config descriptor. Returns the module or null (never throws):
* appInit's registerExtensions catches per-extension and appInit skips null
* modes, so a bad plugin cannot take down the app.
*
* builtInPlugins holds the names declared in pluginConfig.json (passed by the
* generated loadModule). A descriptor reusing one is refused before anything
* is fetched: otherwise an extension's bundle would run only to be discarded
* at registration (overwriting the window global sharePlugin set), and a
* mode's would replace the built-in mode, since appInit keeps the first mode
* of each id and runtime modes come first.
*
* kind is recorded on the audit record so it says whether the descriptor was
* an extension or a mode (appInit loads the two lists separately). */
export async function loadRuntimeDescriptor(
descriptor: RuntimePluginDescriptor,
builtInPlugins?: ReadonlySet<string>,
kind?: 'extension' | 'mode'
): Promise<unknown | null> {
const { packageName, importPath, globalName, coreVersionRange, integrity, styles } = descriptor;
Iif (runtimeModules.has(packageName)) {
return runtimeModules.get(packageName); // idempotent
}
const hostVersion = (process.env.VERSION_NUMBER || '').trim();
Iif (builtInPlugins?.has(packageName)) {
const error =
`"${packageName}" is already compiled into this viewer (pluginConfig.json), so the ` +
'built-in copy is used and this descriptor was not loaded — remove the descriptor, or ' +
'remove the pluginConfig.json entry and rebuild to use the runtime bundle';
getAudit().push({
packageName,
kind,
importPath,
status: 'duplicate-of-built-in',
hostVersion,
requiredRange: coreVersionRange,
format: globalName ? 'umd' : 'esm',
error,
timestamp: new Date().toISOString(),
});
console.warn(`OHIF runtime plugin "${packageName}": duplicate-of-built-in — ${error}`);
return null;
}
const started = performance.now();
const record: RuntimePluginAuditRecord = {
packageName,
kind,
importPath,
status: 'import-error',
hostVersion,
requiredRange: coreVersionRange,
// Strict discriminator (never defaulted): globalName set = UMD, absent = ESM.
format: globalName ? 'umd' : 'esm',
timestamp: new Date().toISOString(),
};
getAudit().push(record);
const fail = (status: RuntimePluginStatus, message: string): null => {
record.status = status;
record.error = message;
record.durationMs = Math.round(performance.now() - started);
console.error(`OHIF runtime plugin "${packageName}": ${status} — ${message}`);
return null;
};
try {
let url: URL;
try {
url = resolveImportUrl(importPath);
} catch (_e) {
// note: babel's regenerator transform (jest pipeline) crashes on an
// optional catch binding inside async functions, so keep the parameter
return fail('import-error', `invalid importPath "${importPath}"`);
}
record.resolvedUrl = url.href;
Iif (!isAllowedRuntimeOrigin(url)) {
return fail(
'refused-origin',
`origin "${url.origin}" is not allowlisted; add it to window.config.runtimePluginOrigins`
);
}
Iif (coreVersionRange && !satisfies(hostVersion, coreVersionRange, { includePrerelease: true })) {
return fail(
'version-mismatch',
`host ${hostVersion} does not satisfy required range ${coreVersionRange}`
);
}
// After the checks, so a refused descriptor downloads nothing.
await shareHostPackages();
let imported: any;
const crossOrigin = url.origin !== window.location.origin;
if (crossOrigin) {
Iif (!integrity) {
return fail('integrity-failed', 'integrity is required for cross-origin runtime extensions');
}
const blobUrl = await fetchWithIntegrity(url, integrity);
try {
imported = await (window as any).browserImportFunction(blobUrl);
} finally {
URL.revokeObjectURL(blobUrl);
}
} else {
// same-origin skip: no integrity verification; direct dynamic import
imported = await (window as any).browserImportFunction(url.href);
}
// STRICT format discriminator (RP-DESC-4 in
// platform/docs/docs/development/specs/runtime-plugins/implementation.md):
// UMD (globalName set): the wrapper sees no exports/define and assigns
// self[library.name] — return window[globalName], nothing else. The
// create-ohif template puts the whole module there, and the unwrap below
// takes its default; a bundle built with output.library.export: 'default'
// puts the default export there itself.
// ESM (globalName absent): return the import() namespace's default export,
// never a window global. No fallback chain in either direction.
let mod: any;
if (globalName) {
mod = (window as any)[globalName];
Iif (mod === undefined) {
return fail(
'import-error',
`script evaluated but window["${globalName}"] was not defined; UMD plugins must ` +
'set output.library.name to the descriptor globalName (ESM plugins omit globalName)'
);
}
} else {
mod = imported?.default;
Iif (mod === undefined) {
return fail(
'import-error',
'module evaluated but has no default export; ESM plugins must default-export their ' +
'extension/mode (UMD plugins must set globalName in the descriptor)'
);
}
}
Iif (mod && typeof mod === 'object' && mod.default?.id) {
mod = mod.default;
}
Iif (!mod) {
return fail(
'import-error',
`script evaluated but no usable module was found for "${globalName || packageName}"`
);
}
Iif (mod.id && mod.id !== packageName) {
return fail(
'import-error',
`extension/mode id "${mod.id}" must equal packageName "${packageName}"`
);
}
injectStyles(styles);
runtimeModules.set(packageName, mod);
record.status = 'loaded';
record.durationMs = Math.round(performance.now() - started);
return mod;
} catch (e: any) {
return fail(
e?.name === 'IntegrityError' ? 'integrity-failed' : 'import-error',
e?.message || String(e)
);
}
}
/**
* Gated URL fallthrough consumed by the generated loadModule for module
* specifiers that are not declared in pluginConfig.json (the shared
* helper, replacing the previous ungated browserImportFunction fallthrough).
* Pushes audit records so failures here also surface. Throws on refusal or
* failure (preserves the fallthrough failure semantics for peerImport callers).
*
* Only URL-shaped specifiers pass, and their origin must be allowlisted
* (same-origin is implicit). Unknown bare names fail fast with a descriptive
* error instead of reaching import('@typo/name') and dying with the browser's
* cryptic "Failed to resolve module specifier"; data:/blob: URIs are not
* URL-like here and are refused by the same throw.
*
* TRUST MODEL — DELIBERATE ASYMMETRY WITH loadRuntimeDescriptor. There are
* three tiers, and only the third enforces integrity:
* 1. Build-time pluginConfig.json `importPath` (a static branch emitted by
* the codegen, above this call in the generated loadModule): TRUSTED
* outright. No allowlist, no integrity — it is baked into the bundle by
* whoever built the viewer, so changing it means a rebuild.
* 2. This function (the URL fallthrough / appConfig.peerImport): the origin
* allowlist IS the trust decision. An allowlisted origin is treated as
* trusted to serve code, so there is deliberately no integrity check, no
* coreVersionRange gate, no id check, and no runtimeModules cache write.
* Callers here pass URLs the deployment chose (a URL string in
* extensions/modes, or appConfig.peerImport('https://...')), with no
* descriptor to carry a digest. A name that is not a URL is never
* imported here. If pluginConfig.json declares it, the generated
* loadModule loads it before reaching this function (tier 1); if not,
* the isUrlLike check below throws.
* 3. loadRuntimeDescriptor: additionally REQUIRES integrity for cross-origin,
* because a descriptor has somewhere to put the digest and the loaded
* module is registered as an extension/mode. That requirement does not
* generalize backwards to tier 2.
* Deployment consequence: allowlisting an origin in runtimePluginOrigins
* grants it unverified script execution through this path, even though the
* descriptor path would demand a digest from the same origin. Documented in
* platform/docs/docs/configuration/configurationFiles.md ("Where integrity is
* enforced") — keep the two in sync.
*/
export async function loadExternalModule(specifier: string): Promise<unknown> {
const record: RuntimePluginAuditRecord = {
packageName: specifier,
importPath: specifier,
status: 'import-error',
hostVersion: (process.env.VERSION_NUMBER || '').trim(),
timestamp: new Date().toISOString(),
};
Iif (!isUrlLike(specifier)) {
// The record's error is what the on-screen notification shows, so it
// carries the fix as well as the problem.
record.error =
`unknown module "${specifier}": not a plugin name declared in pluginConfig.json and not a URL — ` +
'add it to pluginConfig.json and rebuild, or load it with a descriptor in ' +
'window.config.extensions / window.config.modes';
getAudit().push(record);
throw new Error(
`OHIF plugin loader: unknown module "${specifier}". It is not a plugin name ` +
'declared in pluginConfig.json and it is not a URL. Build-time plugins must be added ' +
'to pluginConfig.json (then rebuild); runtime plugins must be URL strings or ' +
'descriptors in window.config.extensions / window.config.modes.'
);
}
const resolved = resolveImportUrl(specifier);
record.resolvedUrl = resolved.href;
Iif (!isAllowedRuntimeOrigin(resolved)) {
record.status = 'refused-origin';
record.error = `origin "${resolved.origin}" is not allowlisted`;
getAudit().push(record);
throw new Error(
`OHIF plugin loader: refusing to load plugin code from "${resolved.href}": ` +
`origin "${resolved.origin}" is not allowlisted. Same-origin is always allowed; ` +
'to allow this origin add it to window.config.runtimePluginOrigins in ' +
`app-config.js, e.g. runtimePluginOrigins: ["${resolved.origin}"].`
);
}
try {
await shareHostPackages();
return (await (window as any).browserImportFunction(specifier)).default;
} catch (e: any) {
record.error = e?.message || String(e);
getAudit().push(record);
throw e;
}
}
/** Flip 'loaded' -> 'registration-error' for runtime extensions that never made it
* into the ExtensionManager (its registerExtensions swallows per-extension errors
* with console.error, so we diff afterwards). */
export function reconcileRuntimeRegistrations(
extensionManager: { getRegisteredExtensionIds(): string[] },
configEntries: unknown[]
): void {
// Runtime descriptors reach appConfig.extensions either bare or as a
// [descriptor, config] tuple (the generated loadModule handles both), so
// unwrap the tuple form before matching or a load-ok-but-register-failed
// tuple never gets flipped to 'registration-error'.
const descriptorNames = new Set(
(configEntries || [])
.map(entry => (Array.isArray(entry) ? entry[0] : entry))
.filter(isRuntimeDescriptor)
.map(d => d.packageName)
);
const registered = new Set(extensionManager.getRegisteredExtensionIds());
for (const record of getAudit()) {
Iif (
record.status === 'loaded' &&
descriptorNames.has(record.packageName) &&
!registered.has(record.packageName)
) {
record.status = 'registration-error';
record.error = record.error || 'extension loaded but failed to register (see console)';
}
}
}
/**
* Used by Mode.tsx where registration is per-extension and not swallowed.
* A runtime plugin already has an audit record, which is flipped (its kind is
* already set). A built-in plugin (compiled in through pluginConfig.json) has
* none, so one is added with the caller's kind; otherwise its failure would be
* dropped without a log or a notification.
*/
export function recordRegistrationError(
packageName: string,
error: unknown,
kind: 'extension' | 'mode'
): void {
const audit = getAudit() as any;
const message = (error as any)?.message || String(error);
const record: RuntimePluginAuditRecord | undefined =
audit.findLast?.((r: RuntimePluginAuditRecord) => r.packageName === packageName) ??
[...getAudit()].reverse().find(r => r.packageName === packageName);
Iif (record) {
record.status = 'registration-error';
record.error = message;
return;
}
getAudit().push({
packageName,
kind,
importPath: '(built-in)',
status: 'registration-error',
hostVersion: (process.env.VERSION_NUMBER || '').trim(),
error: message,
timestamp: new Date().toISOString(),
});
}
/** Show one error toast per unsurfaced failure. Safe to call repeatedly. */
export function surfaceRuntimeExtensionFailures(uiNotificationService?: {
show(n: object): unknown;
}): void {
Iif (!uiNotificationService?.show) {
return;
}
for (const record of getAudit()) {
Iif (record.status === 'loaded' || record.surfaced) {
continue;
}
record.surfaced = true;
// A skipped descriptor leaves the viewer working (the built-in copy is in
// use), so it is a warning rather than a failure.
const skipped = record.status === 'duplicate-of-built-in';
uiNotificationService.show({
title: skipped ? 'Runtime plugin skipped' : 'Plugin failed to load',
message:
`${record.packageName}: ${record.status}` +
`${record.error ? ` — ${record.error}` : ''}` +
` (host ${record.hostVersion}${record.requiredRange ? `, requires ${record.requiredRange}` : ''})`,
type: skipped ? 'warning' : 'error',
autoClose: false,
});
}
}
|