fix(lib/plugins): ignore re-registration for internal plugins
This commit is contained in:
parent
2dd77f24b5
commit
57961ae5d7
1 changed files with 8 additions and 2 deletions
|
|
@ -345,6 +345,7 @@ export function registerInternalPlugin<O extends PluginApiExtensionsOptions>(
|
||||||
iflags = 0,
|
iflags = 0,
|
||||||
) {
|
) {
|
||||||
manifest.version ??= InternalPluginVersion
|
manifest.version ??= InternalPluginVersion
|
||||||
|
// TODO: This has to be shared from native somehow.
|
||||||
manifest.format ??= 1
|
manifest.format ??= 1
|
||||||
manifest.dependencies ??= {}
|
manifest.dependencies ??= {}
|
||||||
manifest.dependencies[ApiDependencyId] ??= { version: '*' }
|
manifest.dependencies[ApiDependencyId] ??= { version: '*' }
|
||||||
|
|
@ -359,8 +360,13 @@ function register<O extends PluginApiExtensionsOptions>(
|
||||||
defflags: number,
|
defflags: number,
|
||||||
iflags: number,
|
iflags: number,
|
||||||
) {
|
) {
|
||||||
if (pList.has(manifest.id))
|
if (pList.has(manifest.id)) {
|
||||||
throw new Error(`Plugin with ID "${manifest.id}" already registered`)
|
// Ignore re-registration if internal
|
||||||
|
if (!iflags)
|
||||||
|
throw new Error(
|
||||||
|
`Plugin with ID "${manifest.id}" already registered`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const factory = typeof options === 'function' ? options : undefined
|
const factory = typeof options === 'function' ? options : undefined
|
||||||
const resolved = typeof options === 'function' ? undefined : options
|
const resolved = typeof options === 'function' ? undefined : options
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue