mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +01:00
Add support from running out of /release/
This commit is contained in:
parent
196f355660
commit
8a50a4ffc0
2 changed files with 32 additions and 17 deletions
|
|
@ -6,6 +6,8 @@
|
||||||
npm: 'node_modules/monaco-editor-core/min/vs',
|
npm: 'node_modules/monaco-editor-core/min/vs',
|
||||||
dev: '/vscode/out/vs',
|
dev: '/vscode/out/vs',
|
||||||
built: '/vscode/out-monaco-editor-core/min/vs',
|
built: '/vscode/out-monaco-editor-core/min/vs',
|
||||||
|
releaseDev: 'release/dev/vs',
|
||||||
|
releaseMin: 'release/min/vs',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PLUGINS: [{
|
PLUGINS: [{
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
}
|
}
|
||||||
DIRNAME = window.location.protocol + '//' + window.location.hostname + port + window.location.pathname.substr(0, window.location.pathname.lastIndexOf('/'));
|
DIRNAME = window.location.protocol + '//' + window.location.hostname + port + window.location.pathname.substr(0, window.location.pathname.lastIndexOf('/'));
|
||||||
}
|
}
|
||||||
console.log(DIRNAME);
|
|
||||||
|
|
||||||
var LOADER_OPTS = (function() {
|
var LOADER_OPTS = (function() {
|
||||||
function parseQueryString() {
|
function parseQueryString() {
|
||||||
|
|
@ -31,6 +31,13 @@
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
})();
|
})();
|
||||||
|
function toHREF(search) {
|
||||||
|
var port = window.location.port;
|
||||||
|
if (port.length > 0) {
|
||||||
|
port = ':' + port;
|
||||||
|
}
|
||||||
|
return window.location.protocol + '//' + window.location.hostname + port + window.location.pathname + search + window.location.hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function Component(name, modulePrefix, paths, contrib) {
|
function Component(name, modulePrefix, paths, contrib) {
|
||||||
|
|
@ -40,9 +47,12 @@
|
||||||
this.contrib = contrib;
|
this.contrib = contrib;
|
||||||
this.selectedPath = LOADER_OPTS[name];
|
this.selectedPath = LOADER_OPTS[name];
|
||||||
}
|
}
|
||||||
|
Component.prototype.isRelease = function() {
|
||||||
|
return /release/.test(this.selectedPath);
|
||||||
|
};
|
||||||
Component.prototype.getResolvedPath = function() {
|
Component.prototype.getResolvedPath = function() {
|
||||||
var resolvedPath = this.paths[this.selectedPath];
|
var resolvedPath = this.paths[this.selectedPath];
|
||||||
if (this.selectedPath === 'npm') {
|
if (this.selectedPath === 'npm' || this.isRelease()) {
|
||||||
if (IS_FILE_PROTOCOL) {
|
if (IS_FILE_PROTOCOL) {
|
||||||
resolvedPath = DIRNAME + '/../' + resolvedPath;
|
resolvedPath = DIRNAME + '/../' + resolvedPath;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -75,13 +85,7 @@
|
||||||
if (search.length > 0) {
|
if (search.length > 0) {
|
||||||
search = '?' + search;
|
search = '?' + search;
|
||||||
}
|
}
|
||||||
var port = window.location.port;
|
return toHREF(search);
|
||||||
if (port.length > 0) {
|
|
||||||
port = ':' + port;
|
|
||||||
}
|
|
||||||
var result = window.location.protocol + '//' + window.location.hostname + port + window.location.pathname + search + window.location.hash;
|
|
||||||
// console.log(result);
|
|
||||||
return result;
|
|
||||||
};
|
};
|
||||||
Component.prototype.renderLoadingOptions = function() {
|
Component.prototype.renderLoadingOptions = function() {
|
||||||
return '<strong style="width:130px;display:inline-block;">' + this.name + '</strong>: ' + Object.keys(this.paths).map(function(pathName) {
|
return '<strong style="width:130px;display:inline-block;">' + this.name + '</strong>: ' + Object.keys(this.paths).map(function(pathName) {
|
||||||
|
|
@ -112,7 +116,10 @@
|
||||||
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var allComponents = [RESOLVED_CORE].concat(RESOLVED_PLUGINS);
|
var allComponents = [RESOLVED_CORE];
|
||||||
|
if (!RESOLVED_CORE.isRelease()) {
|
||||||
|
allComponents = allComponents.concat(RESOLVED_PLUGINS);
|
||||||
|
}
|
||||||
|
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.style.position = 'fixed';
|
div.style.position = 'fixed';
|
||||||
|
|
@ -132,9 +139,11 @@
|
||||||
|
|
||||||
loadScript(PATH_PREFIX + RESOLVED_CORE.getResolvedPath() + '/loader.js', function() {
|
loadScript(PATH_PREFIX + RESOLVED_CORE.getResolvedPath() + '/loader.js', function() {
|
||||||
var loaderPathsConfig = {};
|
var loaderPathsConfig = {};
|
||||||
RESOLVED_PLUGINS.forEach(function(plugin) {
|
if (!RESOLVED_CORE.isRelease()) {
|
||||||
plugin.generateLoaderConfig(loaderPathsConfig);
|
RESOLVED_PLUGINS.forEach(function(plugin) {
|
||||||
});
|
plugin.generateLoaderConfig(loaderPathsConfig);
|
||||||
|
});
|
||||||
|
}
|
||||||
RESOLVED_CORE.generateLoaderConfig(loaderPathsConfig);
|
RESOLVED_CORE.generateLoaderConfig(loaderPathsConfig);
|
||||||
|
|
||||||
console.log('LOADER CONFIG: ');
|
console.log('LOADER CONFIG: ');
|
||||||
|
|
@ -145,11 +154,15 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
require(['vs/editor/editor.main'], function() {
|
require(['vs/editor/editor.main'], function() {
|
||||||
// At this point we've loaded the monaco-editor-core
|
if (!RESOLVED_CORE.isRelease()) {
|
||||||
require(RESOLVED_PLUGINS.map(function(plugin) { return plugin.contrib; }), function() {
|
// At this point we've loaded the monaco-editor-core
|
||||||
// At this point we've loaded all the plugins
|
require(RESOLVED_PLUGINS.map(function(plugin) { return plugin.contrib; }), function() {
|
||||||
|
// At this point we've loaded all the plugins
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
callback();
|
callback();
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue