Remove support for running from `file://`

hediet/typify-build
Alex Dima 3 years ago
parent 8b3ac48ea1
commit f1be014b8f
No known key found for this signature in database
GPG Key ID: 39563C1504FDD0C9

@ -1,5 +1,5 @@
(function () { (function () {
var METADATA = { const METADATA = {
CORE: { CORE: {
paths: { paths: {
src: '/vscode/out/vs', src: '/vscode/out/vs',

@ -1,24 +1,4 @@
(function () { (function () {
let IS_FILE_PROTOCOL = window.location.protocol === 'file:';
let DIRNAME = null;
if (IS_FILE_PROTOCOL) {
let port = window.location.port;
if (port.length > 0) {
port = ':' + port;
}
DIRNAME =
window.location.protocol +
'//' +
window.location.hostname +
port +
window.location.pathname.substr(0, window.location.pathname.lastIndexOf('/'));
let bases = document.getElementsByTagName('base');
if (bases.length > 0) {
DIRNAME = DIRNAME + '/' + bases[0].getAttribute('href');
}
}
let LOADER_OPTS = (function () { let LOADER_OPTS = (function () {
function parseQueryString() { function parseQueryString() {
let str = window.location.search; let str = window.location.search;
@ -70,27 +50,15 @@
let resolvedPath = this.paths[this.selectedPath]; let resolvedPath = this.paths[this.selectedPath];
if (/\.\//.test(resolvedPath)) { if (/\.\//.test(resolvedPath)) {
// starts with ./ => treat as relative to the root path // starts with ./ => treat as relative to the root path
if (IS_FILE_PROTOCOL) { resolvedPath = PATH_PREFIX + '/monaco-editor/' + this.rootPath + '/' + resolvedPath;
resolvedPath = DIRNAME + '/../../' + this.rootPath + '/' + resolvedPath;
} else {
resolvedPath = PATH_PREFIX + '/monaco-editor/' + this.rootPath + '/' + resolvedPath;
}
} else if ( } else if (
this.selectedPath === 'npm/dev' || this.selectedPath === 'npm/dev' ||
this.selectedPath === 'npm/min' || this.selectedPath === 'npm/min' ||
this.isRelease() this.isRelease()
) { ) {
if (IS_FILE_PROTOCOL) { resolvedPath = PATH_PREFIX + '/monaco-editor/' + resolvedPath;
resolvedPath = DIRNAME + '/../../' + resolvedPath;
} else {
resolvedPath = PATH_PREFIX + '/monaco-editor/' + resolvedPath;
}
} else { } else {
if (IS_FILE_PROTOCOL) { resolvedPath = PATH_PREFIX + resolvedPath;
resolvedPath = DIRNAME + '/../../../' + resolvedPath;
} else {
resolvedPath = PATH_PREFIX + resolvedPath;
}
} }
return resolvedPath; return resolvedPath;
}; };
@ -208,13 +176,8 @@
loadScript(RESOLVED_CORE.getResolvedPath(PATH_PREFIX) + '/loader.js', function () { loadScript(RESOLVED_CORE.getResolvedPath(PATH_PREFIX) + '/loader.js', function () {
let loaderPathsConfig = {}; let loaderPathsConfig = {};
window.AMD = true; window.AMD = true;
if (IS_FILE_PROTOCOL) { loaderPathsConfig['vs/fillers/monaco-editor-core'] =
loaderPathsConfig['vs/fillers/monaco-editor-core'] = PATH_PREFIX + '/monaco-editor/./out/amd/fillers/monaco-editor-core-amd';
DIRNAME + '/../.././out/amd/fillers/monaco-editor-core-amd';
} else {
loaderPathsConfig['vs/fillers/monaco-editor-core'] =
PATH_PREFIX + '/monaco-editor/./out/amd/fillers/monaco-editor-core-amd';
}
if (!RESOLVED_CORE.isRelease()) { if (!RESOLVED_CORE.isRelease()) {
RESOLVED_PLUGINS.forEach(function (plugin) { RESOLVED_PLUGINS.forEach(function (plugin) {
plugin.generateLoaderConfig(loaderPathsConfig, PATH_PREFIX); plugin.generateLoaderConfig(loaderPathsConfig, PATH_PREFIX);

Loading…
Cancel
Save