Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ES UI] Reintroduce import of brace/mode/json #78571

Merged
19 changes: 17 additions & 2 deletions packages/kbn-ace/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @kbn/ace

Contains all Kibana-specific brace related code. Excluding the code that still inside of Console because that code is only used inside of console at the moment.
This package contains the XJSON mode for brace. This is an extension of the `brace/mode/json` mode.

This package enables plugins to use this functionality and import it as needed -- behind an async import so that brace does not bloat the JS code needed for first page load of Kibana.
This package also contains an import of the entire brace editor which is used for creating the custom XJSON worker.

## Note to plugins
_This code should not be eagerly loaded_.

Make sure imports of this package are behind a lazy-load `import()` statement.

Your plugin should already be loading application code this way in the `mount` function.

## Deprecated

This package is considered deprecated and will be removed in future.

New and existing editor functionality should use Monaco.

_Do not add new functionality to this package_. Build new functionality for Monaco and use it instead.
15 changes: 15 additions & 0 deletions src/plugins/es_ui_shared/static/forms/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
* under the License.
*/

/*
@TODO

The brace/mode/json import below is loaded eagerly - before this plugin is explicitly loaded by users. This makes
the brace JSON mode, used for JSON syntax highlighting and grammar checking, available across all of Kibana plugins.

This is not ideal because we are loading JS that is not necessary for Kibana to start, but the alternative
is breaking JSON mode for an unknown number of ace editors across Kibana - not all components reference the underlying
EuiCodeEditor (for instance, explicitly).

Importing here is a way of preventing a more sophisticated solution to this problem since we want to, eventually,
migrate all code editors over to Monaco. Once that is done, we should remove this import.
*/
import 'brace/mode/json';

export * from './field';
export * from './form_row';
export * from './fields';