Color mode

Search notes

Filter with tag:, lang:, or path:.

プラグインオプション(Plugin Options)

プラグインオプションは、プラグインファクトリに渡す設定値です。副作用のない純粋な validateOptions 関数で検証され、解決済みのオプションはプラグインの options プロパティから参照できます。

オプションの検証

ts
type ExampleOptions = {
  enabled?: boolean;
};
 
export function example(options: ExampleOptions = {}) {
  return definePlugin({
    name: "example",
    options,
  });
}

バリデータの契約

バリデータに副作用を持たせてはいけません。ファイルシステムの走査、ビルド、キャッシュへの書き込み、外部状態の変更は行いません。問題は構造化されたissueとして返します。バリデータの型は PluginOptionsValidator<TOptions> で、options を受け取って readonly Issue[] | void を返します。

関連用語

さらに詳しく

Local Graph

Nearby Notes

Open in Explorer →
プラグインオプション(Plugin Options)設定(Config)プラグイン(Plugin)
CurrentOutgoingBacklink