提交 dbd76d98 编写于 作者: A Alex Dima

Adopt latest loader (which is snapshot-friendly)

上级 6831fb4a
......@@ -146,6 +146,8 @@ function main() {
// In the bundled version the nls plugin is packaged with the loader so the NLS Plugins
// loads as soon as the loader loads. To be able to have pseudo translation
createScript(rootUrl + '/vs/loader.js', function () {
var define = global.define;
global.define = undefined;
define('fs', ['original-fs'], function (originalFS) { return originalFS; }); // replace the patched electron fs with the original node fs for all AMD code
window.MonacoEnvironment = {};
......
......@@ -131,6 +131,8 @@ function main() {
// In the bundled version the nls plugin is packaged with the loader so the NLS Plugins
// loads as soon as the loader loads. To be able to have pseudo translation
createScript(rootUrl + '/vs/loader.js', function () {
var define = global.define;
global.define = undefined;
define('fs', ['original-fs'], function (originalFS) { return originalFS; }); // replace the patched electron fs with the original node fs for all AMD code
window.MonacoEnvironment = {};
......
......@@ -20,7 +20,7 @@ var CSSLoaderPlugin;
* Known issue:
* - In IE there is no way to know if the CSS file loaded successfully or not.
*/
var BrowserCSSLoader = (function () {
var BrowserCSSLoader = /** @class */ (function () {
function BrowserCSSLoader() {
this._pendingLoads = 0;
}
......@@ -93,7 +93,7 @@ var CSSLoaderPlugin;
return BrowserCSSLoader;
}());
// ------------------------------ Finally, the plugin
var CSSPlugin = (function () {
var CSSPlugin = /** @class */ (function () {
function CSSPlugin() {
this._cssLoader = new BrowserCSSLoader();
}
......@@ -110,12 +110,5 @@ var CSSLoaderPlugin;
return CSSPlugin;
}());
CSSLoaderPlugin.CSSPlugin = CSSPlugin;
function init() {
define('vs/css', new CSSPlugin());
}
CSSLoaderPlugin.init = init;
;
if (typeof doNotInitLoader === 'undefined') {
init();
}
define('vs/css', new CSSPlugin());
})(CSSLoaderPlugin || (CSSLoaderPlugin = {}));
此差异已折叠。
......@@ -17,13 +17,24 @@
var NLSLoaderPlugin;
(function (NLSLoaderPlugin) {
var Environment = /** @class */ (function () {
function Environment(isPseudo) {
this.isPseudo = isPseudo;
//
function Environment() {
this._detected = false;
this._isPseudo = false;
}
Environment.detect = function () {
var isPseudo = (typeof document !== 'undefined' && document.location && document.location.hash.indexOf('pseudo=true') >= 0);
return new Environment(isPseudo);
Object.defineProperty(Environment.prototype, "isPseudo", {
get: function () {
this._detect();
return this._isPseudo;
},
enumerable: true,
configurable: true
});
Environment.prototype._detect = function () {
if (this._detected) {
return;
}
this._detected = true;
this._isPseudo = (typeof document !== 'undefined' && document.location && document.location.hash.indexOf('pseudo=true') >= 0);
};
return Environment;
}());
......@@ -79,7 +90,7 @@ var NLSLoaderPlugin;
};
}
NLSPlugin.prototype.setPseudoTranslation = function (value) {
this._env = new Environment(value);
this._env._isPseudo = value;
};
NLSPlugin.prototype.create = function (key, data) {
return {
......@@ -130,11 +141,5 @@ var NLSLoaderPlugin;
return NLSPlugin;
}());
NLSLoaderPlugin.NLSPlugin = NLSPlugin;
function init() {
define('vs/nls', new NLSPlugin(Environment.detect()));
}
NLSLoaderPlugin.init = init;
if (typeof doNotInitLoader === 'undefined') {
init();
}
define('vs/nls', new NLSPlugin(new Environment()));
})(NLSLoaderPlugin || (NLSLoaderPlugin = {}));
......@@ -205,6 +205,8 @@ function main() {
const loaderFilename = configuration.appRoot + '/out/vs/loader.js';
const loaderSource = require('fs').readFileSync(loaderFilename);
require('vm').runInThisContext(loaderSource, { filename: loaderFilename });
var define = global.define;
global.define = undefined;
window.nodeRequire = require.__$__nodeRequire;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册