Skip to content

Restructure exported package files #5151

@hediet

Description

@hediet

Currently, users of the monaco editor package use deep imports to access various modules, such as import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";.
Besides missing d.ts files, there is no clear difference between internal modules and API modules.

Additionally, some users want minimal monaco editor distributions where certain editor features are excluded.
The monaco editor webpack plugin allows them to configure which features are included/excluded. Alternatively, they can deep import editor.api.js and the selected features they need.

Instead, we should intentionally export modules to both distinguish between internal and exposed modules and to allow for easier configurations of "minimal" monaco editor distributions. This would be also be a first step to deprecate the webpack plugin.

The structure of the allowed imports could look like this:

import "monaco-editor"; // imports and registers everything

import * as m from "monaco-editor/editor"; // the core editor (no optional features, no languages)


import "monaco-editor/languages/register.all"; // imports all language features and definitions

import "monaco-editor/languages/definitions/register.all"; // all language definitions (syntax highlighting + bracket rules)
import "monaco-editor/languages/definitions/css/register";
import "monaco-editor/languages/definitions/cpp/register";
import "monaco-editor/languages/definitions/.../register"; // + ~50 more

import "monaco-editor/languages/features/register.all"; // all language features (autocompletion, diagnostics, etc)
import "monaco-editor/languages/features/css/register";
import "monaco-editor/languages/features/typescript/register";
import "monaco-editor/languages/features/.../register";// + ~3 more


import "monaco-editor/features/register.all"; // all editor features
import "monaco-editor/features/sectionHeaders/register";
import "monaco-editor/features/find/register";
import "monaco-editor/features/stickyScroll/register";
import "monaco-editor/features/.../register"; // + ~20 more

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions