* Coerce an options value to a `PluginIdentifier[]` or undefined. * Used for `activePlugins` and `disabledPlugins`: a stray string would * otherwise pass through and turn later `.includes(pluginIdentifier)` * calls into substring matches. Emits a warning so the typo isn't * silently swal
(value: unknown, fieldName: string)
| 120 | * full PluginManager. |
| 121 | */ |
| 122 | public static coerceIdentifierList(value: unknown, fieldName: string): PluginIdentifier[] | undefined { |
| 123 | if (value === undefined || value === null) { |
| 124 | return undefined |
| 125 | } |
| 126 | if (Array.isArray(value)) { |
| 127 | return value as PluginIdentifier[] |
| 128 | } |
| 129 | log.warn(`config.${fieldName} must be an array of plugin identifiers; got ${typeof value} — ignoring this setting.`) |
| 130 | return undefined |
| 131 | } |
| 132 | |
| 133 | public static isQualifiedPluginIdentifier(identifier: string): boolean { |
| 134 | return PluginManager.PLUGIN_IDENTIFIER_PATTERN.test(identifier) |