├── .eslintrc.json
├── .gitignore
├── .gitmodules
├── LICENSE
├── README.md
├── package.json
├── paths.js
├── scripts
└── generate-typings
├── webpack.config.external.js
├── webpack.config.standalone.js
├── webpack
├── createConfig.js
├── loaders
│ ├── babel.js
│ ├── umd.js
│ └── wrap.js
└── stub.js
└── yarn.lock
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@timkendrick/eslint-config",
3 | "rules": {
4 | "import/no-extraneous-dependencies": "off"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /dist/
2 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "monaco-html"]
2 | path = submodules/monaco-html
3 | url = https://github.com/Microsoft/monaco-html.git
4 | [submodule "monaco-css"]
5 | path = submodules/monaco-css
6 | url = https://github.com/Microsoft/monaco-css.git
7 | [submodule "monaco-json"]
8 | path = submodules/monaco-json
9 | url = https://github.com/Microsoft/monaco-json.git
10 | [submodule "monaco-languages"]
11 | path = submodules/monaco-languages
12 | url = https://github.com/Microsoft/monaco-languages.git
13 | [submodule "monaco-typescript"]
14 | path = submodules/monaco-typescript
15 | url = https://github.com/Microsoft/monaco-typescript.git
16 | [submodule "vscode"]
17 | path = submodules/vscode
18 | url = https://github.com/Microsoft/vscode.git
19 | [submodule "vscode-css-languageservice"]
20 | path = submodules/vscode-css-languageservice
21 | url = https://github.com/Microsoft/vscode-css-languageservice.git
22 | [submodule "vscode-json-languageservice"]
23 | path = submodules/vscode-json-languageservice
24 | url = https://github.com/Microsoft/vscode-json-languageservice.git
25 | [submodule "vscode-html-languageservice"]
26 | path = submodules/vscode-html-languageservice
27 | url = https://github.com/Microsoft/vscode-html-languageservice.git
28 | [submodule "vscode-languageserver-node"]
29 | path = submodules/vscode-languageserver-node
30 | url = https://github.com/Microsoft/vscode-languageserver-node.git
31 | [submodule "vscode-nls"]
32 | path = submodules/vscode-nls
33 | url = https://github.com/Microsoft/vscode-nls.git
34 | [submodule "vscode-uri"]
35 | path = submodules/vscode-uri
36 | url = https://github.com/Microsoft/vscode-uri.git
37 | [submodule "jsonc-parser"]
38 | path = submodules/jsonc-parser
39 | url = https://github.com/Microsoft/node-jsonc-parser.git
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Tim Kendrick
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # @timkendrick/monaco-editor
2 | [](https://www.npmjs.com/package/@timkendrick/monaco-editor)
3 | 
4 |
5 | > CommonJS/Webpack compatible Monaco editor
6 |
7 | This module exports a prebuilt UMD bundle that exposes a standalone [Monaco editor](https://microsoft.github.io/monaco-editor/).
8 |
9 | ## Installation
10 |
11 | ```bash
12 | npm install @timkendrick/monaco-editor --save
13 | ```
14 |
15 | ## Usage
16 |
17 | The editor comes in two versions: standalone and external.
18 |
19 | In the standalone version, the accompanying CSS and web worker scripts are all compiled into the main JavaScript bundle, avoiding the need to serve external assets separately.
20 |
21 | In the external version, the accompanying CSS and web worker scripts are provided as separate assets that must be served separately.
22 |
23 | ### Importing the standalone version
24 |
25 | As a CommonJS module:
26 |
27 | ```js
28 | const monaco = require('@timkendrick/monaco-editor');
29 |
30 | monaco.editor.create(...);
31 | ```
32 |
33 | As an ECMAScript module:
34 |
35 | ```js
36 | import * as monaco from '@timkendrick/monaco-editor';
37 |
38 | monaco.editor.create(...);
39 | ```
40 |
41 | As a global variable:
42 |
43 | ```js
44 | window.monaco.editor.create(...);
45 | ```
46 |
47 | ### Using the external version
48 |
49 | #### Setup
50 |
51 | Additional CSS and worker scripts are located in the `dist/external` directory. These must be loaded by the browser at runtime.
52 |
53 | The `monaco.css` file must be loaded as a stylesheet, and the path to directory containing the worker scripts can be specified as `window.MonacoEnvironment.baseUrl`:
54 |
55 | ```html
56 |
57 |