index.d.ts 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import type * as webpack from 'webpack';
  2. import { EditorLanguage } from './languages';
  3. import { EditorFeature, NegatedEditorFeature } from './features';
  4. import { IFeatureDefinition } from './types';
  5. interface IMonacoEditorWebpackPluginOpts {
  6. /**
  7. * Include only a subset of the languages supported.
  8. */
  9. languages?: EditorLanguage[];
  10. /**
  11. * Custom languages (outside of the ones shipped with the `monaco-editor`).
  12. */
  13. customLanguages?: IFeatureDefinition[];
  14. /**
  15. * Include only a subset of the editor features.
  16. * Use e.g. '!contextmenu' to exclude a certain feature.
  17. */
  18. features?: (EditorFeature | NegatedEditorFeature)[];
  19. /**
  20. * Specify a filename template to use for generated files.
  21. * Use e.g. '[name].worker.[contenthash].js' to include content-based hashes.
  22. */
  23. filename?: string;
  24. /**
  25. * Override the public path from which files generated by this plugin will be served.
  26. * This wins out over Webpack's dynamic runtime path and can be useful to avoid attempting to load workers cross-
  27. * origin when using a CDN for other static resources.
  28. * Use e.g. '/' if you want to load your resources from the current origin.
  29. */
  30. publicPath?: string;
  31. /**
  32. * Specify whether the editor API should be exposed through a global `monaco` object or not. This
  33. * option is applicable to `0.22.0` and newer version of `monaco-editor`. Since `0.22.0`, the ESM
  34. * version of the monaco editor does no longer define a global `monaco` object unless
  35. * `global.MonacoEnvironment = { globalAPI: true }` is set ([change
  36. * log](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md#0220-29012021)).
  37. */
  38. globalAPI?: boolean;
  39. }
  40. declare class MonacoEditorWebpackPlugin implements webpack.WebpackPluginInstance {
  41. private readonly options;
  42. constructor(options?: IMonacoEditorWebpackPluginOpts);
  43. apply(compiler: webpack.Compiler): void;
  44. }
  45. export = MonacoEditorWebpackPlugin;