mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 16:15:41 +01:00
Inline metadata.js in dev-setup.js
This commit is contained in:
parent
3a6cbe0787
commit
7138fd1ffb
13 changed files with 70 additions and 123 deletions
|
|
@ -100,7 +100,6 @@ function generateTestSamplesTask() {
|
|||
'</div>',
|
||||
'<div style="clear:both"></div>',
|
||||
'',
|
||||
'<script src="../../metadata.js"></script>',
|
||||
'<script src="dev-setup.js"></script>',
|
||||
'<script>',
|
||||
'loadEditor(function() {',
|
||||
|
|
@ -148,7 +147,6 @@ function generateTestSamplesTask() {
|
|||
);
|
||||
})
|
||||
.join('<br/>\n'),
|
||||
'<script src="../../metadata.js"></script>',
|
||||
'<script src="dev-setup.js"></script>',
|
||||
'</body>',
|
||||
'</html>'
|
||||
|
|
|
|||
87
metadata.js
87
metadata.js
|
|
@ -1,87 +0,0 @@
|
|||
(function () {
|
||||
const METADATA = {
|
||||
CORE: {
|
||||
paths: {
|
||||
src: '/vscode/out/vs',
|
||||
'npm/dev': 'node_modules/monaco-editor-core/dev/vs',
|
||||
'npm/min': 'node_modules/monaco-editor-core/min/vs',
|
||||
built: '/vscode/out-monaco-editor-core/min/vs',
|
||||
releaseDev: 'release/dev/vs',
|
||||
releaseMin: 'release/min/vs'
|
||||
}
|
||||
},
|
||||
PLUGINS: [
|
||||
{
|
||||
name: 'monaco-typescript',
|
||||
contrib: 'vs/language/typescript/monaco.contribution',
|
||||
modulePrefix: 'vs/language/typescript',
|
||||
rootPath: './out/release',
|
||||
paths: {
|
||||
// use ./ to indicate it is relative to the `rootPath`
|
||||
src: './../amd/language/typescript',
|
||||
dev: './dev/vs/language/typescript',
|
||||
min: './min/vs/language/typescript',
|
||||
esm: './esm/vs/language/typescript'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monaco-css',
|
||||
contrib: 'vs/language/css/monaco.contribution',
|
||||
modulePrefix: 'vs/language/css',
|
||||
rootPath: './out/release',
|
||||
paths: {
|
||||
// use ./ to indicate it is relative to the `rootPath`
|
||||
src: './../amd/language/css',
|
||||
dev: './dev/vs/language/css',
|
||||
min: './min/vs/language/css',
|
||||
esm: './esm/vs/language/css'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monaco-json',
|
||||
contrib: 'vs/language/json/monaco.contribution',
|
||||
modulePrefix: 'vs/language/json',
|
||||
rootPath: './out/release',
|
||||
paths: {
|
||||
// use ./ to indicate it is relative to the `rootPath`
|
||||
src: './../amd/language/json',
|
||||
dev: './dev/vs/language/json',
|
||||
min: './min/vs/language/json',
|
||||
esm: './esm/vs/language/json'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monaco-html',
|
||||
contrib: 'vs/language/html/monaco.contribution',
|
||||
modulePrefix: 'vs/language/html',
|
||||
rootPath: './out/release',
|
||||
paths: {
|
||||
// use ./ to indicate it is relative to the `rootPath`
|
||||
src: './../amd/language/html',
|
||||
dev: './dev/vs/language/html',
|
||||
min: './min/vs/language/html',
|
||||
esm: './esm/vs/language/html'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monaco-languages',
|
||||
contrib: 'vs/basic-languages/monaco.contribution',
|
||||
modulePrefix: 'vs/basic-languages',
|
||||
rootPath: './out/release',
|
||||
paths: {
|
||||
// use ./ to indicate it is relative to the `rootPath`
|
||||
src: './../amd/basic-languages',
|
||||
dev: './dev/vs/basic-languages',
|
||||
min: './min/vs/basic-languages',
|
||||
esm: './esm/vs/basic-languages'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
if (typeof exports !== 'undefined') {
|
||||
exports.METADATA = METADATA;
|
||||
} else {
|
||||
self.METADATA = METADATA;
|
||||
}
|
||||
})();
|
||||
|
|
@ -13,7 +13,6 @@
|
|||
></div>
|
||||
<div style="clear: both"></div>
|
||||
|
||||
<script src="../../metadata.js"></script>
|
||||
<script src="dev-setup.js"></script>
|
||||
<script>
|
||||
loadEditor(function () {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,64 @@
|
|||
(function () {
|
||||
const METADATA = {
|
||||
CORE: {
|
||||
paths: {
|
||||
src: '/vscode/out/vs',
|
||||
'npm/dev': 'node_modules/monaco-editor-core/dev/vs',
|
||||
'npm/min': 'node_modules/monaco-editor-core/min/vs',
|
||||
built: '/vscode/out-monaco-editor-core/min/vs',
|
||||
releaseDev: 'release/dev/vs',
|
||||
releaseMin: 'release/min/vs'
|
||||
}
|
||||
},
|
||||
PLUGINS: [
|
||||
{
|
||||
name: 'monaco-typescript',
|
||||
modulePrefix: 'vs/language/typescript',
|
||||
paths: {
|
||||
src: './out/amd/language/typescript',
|
||||
dev: './out/release/dev/vs/language/typescript',
|
||||
min: './out/release/min/vs/language/typescript'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monaco-css',
|
||||
modulePrefix: 'vs/language/css',
|
||||
paths: {
|
||||
src: './out/amd/language/css',
|
||||
dev: './out/release/dev/vs/language/css',
|
||||
min: './out/release/min/vs/language/css'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monaco-json',
|
||||
modulePrefix: 'vs/language/json',
|
||||
paths: {
|
||||
src: './out/amd/language/json',
|
||||
dev: './out/release/dev/vs/language/json',
|
||||
min: './out/release/min/vs/language/json'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monaco-html',
|
||||
modulePrefix: 'vs/language/html',
|
||||
paths: {
|
||||
src: './out/amd/language/html',
|
||||
dev: './out/release/dev/vs/language/html',
|
||||
min: './out/release/min/vs/language/html'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'monaco-languages',
|
||||
modulePrefix: 'vs/basic-languages',
|
||||
paths: {
|
||||
src: './out/amd/basic-languages',
|
||||
dev: './out/release/dev/vs/basic-languages',
|
||||
min: './out/release/min/vs/basic-languages'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
let LOADER_OPTS = (function () {
|
||||
function parseQueryString() {
|
||||
let str = window.location.search;
|
||||
|
|
@ -35,12 +95,10 @@
|
|||
);
|
||||
}
|
||||
|
||||
function Component(name, modulePrefix, paths, rootPath, contrib) {
|
||||
function Component(name, modulePrefix, paths) {
|
||||
this.name = name;
|
||||
this.modulePrefix = modulePrefix;
|
||||
this.paths = paths;
|
||||
this.rootPath = rootPath;
|
||||
this.contrib = contrib;
|
||||
this.selectedPath = LOADER_OPTS[name];
|
||||
}
|
||||
Component.prototype.isRelease = function () {
|
||||
|
|
@ -48,17 +106,8 @@
|
|||
};
|
||||
Component.prototype.getResolvedPath = function (PATH_PREFIX) {
|
||||
let resolvedPath = this.paths[this.selectedPath];
|
||||
if (/\.\//.test(resolvedPath)) {
|
||||
// starts with ./ => treat as relative to the root path
|
||||
resolvedPath = PATH_PREFIX + '/monaco-editor/' + this.rootPath + '/' + resolvedPath;
|
||||
} else if (
|
||||
this.selectedPath === 'npm/dev' ||
|
||||
this.selectedPath === 'npm/min' ||
|
||||
this.isRelease()
|
||||
) {
|
||||
if (!/^\//.test(resolvedPath)) {
|
||||
resolvedPath = PATH_PREFIX + '/monaco-editor/' + resolvedPath;
|
||||
} else {
|
||||
resolvedPath = PATH_PREFIX + resolvedPath;
|
||||
}
|
||||
return resolvedPath;
|
||||
};
|
||||
|
|
@ -110,15 +159,8 @@
|
|||
let RESOLVED_CORE = new Component('editor', 'vs', METADATA.CORE.paths);
|
||||
self.RESOLVED_CORE_PATH = RESOLVED_CORE.getResolvedPath('');
|
||||
let RESOLVED_PLUGINS = METADATA.PLUGINS.map(function (plugin) {
|
||||
return new Component(
|
||||
plugin.name,
|
||||
plugin.modulePrefix,
|
||||
plugin.paths,
|
||||
plugin.rootPath,
|
||||
plugin.contrib
|
||||
);
|
||||
return new Component(plugin.name, plugin.modulePrefix, plugin.paths);
|
||||
});
|
||||
METADATA = null;
|
||||
|
||||
function loadScript(path, callback) {
|
||||
let script = document.createElement('script');
|
||||
|
|
@ -200,9 +242,13 @@
|
|||
require(['vs/editor/editor.main'], function () {
|
||||
if (!RESOLVED_CORE.isRelease()) {
|
||||
// At this point we've loaded the monaco-editor-core
|
||||
require(RESOLVED_PLUGINS.map(function (plugin) {
|
||||
return plugin.contrib;
|
||||
}), function () {
|
||||
require([
|
||||
'vs/basic-languages/monaco.contribution',
|
||||
'vs/language/css/monaco.contribution',
|
||||
'vs/language/html/monaco.contribution',
|
||||
'vs/language/json/monaco.contribution',
|
||||
'vs/language/typescript/monaco.contribution'
|
||||
], function () {
|
||||
// At this point we've loaded all the plugins
|
||||
callback();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
></div>
|
||||
<div style="clear: both"></div>
|
||||
|
||||
<script src="../../metadata.js"></script>
|
||||
<script src="dev-setup.js"></script>
|
||||
<script>
|
||||
loadEditor(function () {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
></div>
|
||||
<div style="clear: both"></div>
|
||||
|
||||
<script src="../../metadata.js"></script>
|
||||
<script src="dev-setup.js"></script>
|
||||
<script>
|
||||
loadEditor(function () {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
id="Editor"
|
||||
></div>
|
||||
|
||||
<script src="../../metadata.js"></script>
|
||||
<script src="dev-setup.js"></script>
|
||||
<script>
|
||||
loadEditor(function () {
|
||||
|
|
|
|||
|
|
@ -273,7 +273,6 @@
|
|||
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
</p>
|
||||
|
||||
<script src="../../metadata.js"></script>
|
||||
<script src="dev-setup.js"></script>
|
||||
<script>
|
||||
loadEditor(function () {
|
||||
|
|
|
|||
|
|
@ -191,7 +191,6 @@
|
|||
|
||||
<div style="clear: both"></div>
|
||||
|
||||
<script src="../../metadata.js"></script>
|
||||
<script src="dev-setup.js"></script>
|
||||
<script>
|
||||
loadEditor(function () {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
></div>
|
||||
<div style="clear: both"></div>
|
||||
|
||||
<script src="../../metadata.js"></script>
|
||||
<script src="dev-setup.js"></script>
|
||||
<script>
|
||||
const container = document.getElementById('container');
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
<body style="transform: scale(0.75)">
|
||||
<div id="editor"></div>
|
||||
|
||||
<script src="../../metadata.js"></script>
|
||||
<script src="dev-setup.js"></script>
|
||||
<script>
|
||||
loadEditor(function () {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
<button id="logDTS">Log DTS</button>
|
||||
<button id="getAST">Print AST to console</button>
|
||||
|
||||
<script src="../../../metadata.js"></script>
|
||||
<script src="../dev-setup.js"></script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
<textarea style="font-family: monospace" id="compilerOpts" cols="60" rows="30"></textarea><br />
|
||||
<button id="updateCompilerSettingsBtn">Update compiler settings</button>
|
||||
|
||||
<script src="../../../metadata.js"></script>
|
||||
<script src="../dev-setup.js"></script>
|
||||
<script>
|
||||
function getDefaultCode() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue