tune(monaco-editor-webpack-plugin): expose plugin options type

This commit is contained in:
ValeraS 2021-12-24 18:26:10 +03:00
parent 684cbae427
commit fc603de98e

View file

@ -99,7 +99,8 @@ function resolveDesiredLanguages(
return coalesce(languages.map((id) => languagesById[id])).concat(userCustomLanguages || []); return coalesce(languages.map((id) => languagesById[id])).concat(userCustomLanguages || []);
} }
interface IMonacoEditorWebpackPluginOpts { declare namespace MonacoEditorWebpackPlugin {
interface IMonacoEditorWebpackPluginOpts {
/** /**
* Include only a subset of the languages supported. * Include only a subset of the languages supported.
*/ */
@ -144,8 +145,8 @@ interface IMonacoEditorWebpackPluginOpts {
* log](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md#0220-29012021)). * log](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md#0220-29012021)).
*/ */
globalAPI?: boolean; globalAPI?: boolean;
}
} }
interface IInternalMonacoEditorWebpackPluginOpts { interface IInternalMonacoEditorWebpackPluginOpts {
languages: IFeatureDefinition[]; languages: IFeatureDefinition[];
features: IFeatureDefinition[]; features: IFeatureDefinition[];
@ -158,7 +159,7 @@ interface IInternalMonacoEditorWebpackPluginOpts {
class MonacoEditorWebpackPlugin implements webpack.WebpackPluginInstance { class MonacoEditorWebpackPlugin implements webpack.WebpackPluginInstance {
private readonly options: IInternalMonacoEditorWebpackPluginOpts; private readonly options: IInternalMonacoEditorWebpackPluginOpts;
constructor(options: IMonacoEditorWebpackPluginOpts = {}) { constructor(options: MonacoEditorWebpackPlugin.IMonacoEditorWebpackPluginOpts = {}) {
const monacoEditorPath = options.monacoEditorPath; const monacoEditorPath = options.monacoEditorPath;
const metadata = getEditorMetadata(monacoEditorPath); const metadata = getEditorMetadata(monacoEditorPath);
const languages = resolveDesiredLanguages(metadata, options.languages, options.customLanguages); const languages = resolveDesiredLanguages(metadata, options.languages, options.customLanguages);