mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 00:04:14 +08:00
Adopt latest loader that adds nodeModules option to disambiguate node modules from AMD modules at bundle time and adopt it in the gulp tasks
This commit is contained in:
parent
e78309f17e
commit
71dcb8069d
@ -40,10 +40,10 @@ exports.loaderConfig = function (emptyPaths) {
|
||||
paths: {
|
||||
'vs/extensions': 'extensions'
|
||||
}
|
||||
}
|
||||
},
|
||||
nodeModules: emptyPaths||[]
|
||||
};
|
||||
|
||||
(emptyPaths || []).forEach(function(m) { result.paths[m] = 'empty:'; });
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
@ -13,8 +13,6 @@
|
||||
*---------------------------------------------------------------------------------------------
|
||||
*---------------------------------------------------------------------------------------------
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
/// <reference path="declares.ts" />
|
||||
/// <reference path="loader.ts" />
|
||||
'use strict';
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
@ -100,7 +98,7 @@ var CSSLoaderPlugin;
|
||||
this._insertLinkNode(linkNode);
|
||||
};
|
||||
return BrowserCSSLoader;
|
||||
})();
|
||||
}());
|
||||
/**
|
||||
* Prior to IE10, IE could not go above 31 stylesheets in a page
|
||||
* http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/internet-explorer-stylesheet-rule-selector-import-sheet-limit-maximum.aspx
|
||||
@ -201,7 +199,7 @@ var CSSLoaderPlugin;
|
||||
}
|
||||
};
|
||||
return IE9CSSLoader;
|
||||
})(BrowserCSSLoader);
|
||||
}(BrowserCSSLoader));
|
||||
var IE8CSSLoader = (function (_super) {
|
||||
__extends(IE8CSSLoader, _super);
|
||||
function IE8CSSLoader() {
|
||||
@ -214,7 +212,7 @@ var CSSLoaderPlugin;
|
||||
};
|
||||
};
|
||||
return IE8CSSLoader;
|
||||
})(IE9CSSLoader);
|
||||
}(IE9CSSLoader));
|
||||
var NodeCSSLoader = (function () {
|
||||
function NodeCSSLoader() {
|
||||
this.fs = require.nodeRequire('fs');
|
||||
@ -229,7 +227,7 @@ var CSSLoaderPlugin;
|
||||
};
|
||||
NodeCSSLoader.BOM_CHAR_CODE = 65279;
|
||||
return NodeCSSLoader;
|
||||
})();
|
||||
}());
|
||||
// ------------------------------ Finally, the plugin
|
||||
var CSSPlugin = (function () {
|
||||
function CSSPlugin(cssLoader) {
|
||||
@ -279,7 +277,7 @@ var CSSLoaderPlugin;
|
||||
};
|
||||
CSSPlugin.BUILD_MAP = {};
|
||||
return CSSPlugin;
|
||||
})();
|
||||
}());
|
||||
CSSLoaderPlugin.CSSPlugin = CSSPlugin;
|
||||
var Utilities = (function () {
|
||||
function Utilities() {
|
||||
@ -411,7 +409,7 @@ var CSSLoaderPlugin;
|
||||
});
|
||||
};
|
||||
return Utilities;
|
||||
})();
|
||||
}());
|
||||
CSSLoaderPlugin.Utilities = Utilities;
|
||||
(function () {
|
||||
var cssLoader = null;
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
*---------------------------------------------------------------------------------------------
|
||||
*---------------------------------------------------------------------------------------------
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
/// <reference path="declares.ts" />
|
||||
'use strict';
|
||||
// Limitation: To load jquery through the loader, always require 'jquery' and add a path for it in the loader configuration
|
||||
var _amdLoaderGlobal = this, define;
|
||||
@ -123,7 +122,7 @@ var AMDLoader;
|
||||
};
|
||||
Utilities.NEXT_ANONYMOUS_ID = 1;
|
||||
return Utilities;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.Utilities = Utilities;
|
||||
var ConfigurationOptionsUtil = (function () {
|
||||
function ConfigurationOptionsUtil() {
|
||||
@ -189,6 +188,9 @@ var AMDLoader;
|
||||
options.baseUrl += '/';
|
||||
}
|
||||
}
|
||||
if (!Array.isArray(options.nodeModules)) {
|
||||
options.nodeModules = [];
|
||||
}
|
||||
return options;
|
||||
};
|
||||
ConfigurationOptionsUtil.mergeConfigurationOptions = function (overwrite, base) {
|
||||
@ -232,7 +234,7 @@ var AMDLoader;
|
||||
return ConfigurationOptionsUtil.validateConfigurationOptions(result);
|
||||
};
|
||||
return ConfigurationOptionsUtil;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil;
|
||||
var Configuration = (function () {
|
||||
function Configuration(options) {
|
||||
@ -428,6 +430,10 @@ var AMDLoader;
|
||||
* Transform a module id to a location. Appends .js to module ids
|
||||
*/
|
||||
Configuration.prototype.moduleIdToPaths = function (moduleId) {
|
||||
if (this.isBuild() && this.options.nodeModules.indexOf(moduleId) >= 0) {
|
||||
// This is a node module and we are at build time, drop it
|
||||
return ['empty:'];
|
||||
}
|
||||
var result = moduleId;
|
||||
if (this.overwriteModuleIdToPath.hasOwnProperty(result)) {
|
||||
result = this.overwriteModuleIdToPath[result];
|
||||
@ -522,7 +528,7 @@ var AMDLoader;
|
||||
this.options.onError(err);
|
||||
};
|
||||
return Configuration;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.Configuration = Configuration;
|
||||
// ------------------------------------------------------------------------
|
||||
// ModuleIdResolver
|
||||
@ -602,7 +608,7 @@ var AMDLoader;
|
||||
this._config.onError(err);
|
||||
};
|
||||
return ModuleIdResolver;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.ModuleIdResolver = ModuleIdResolver;
|
||||
// ------------------------------------------------------------------------
|
||||
// Module
|
||||
@ -832,7 +838,7 @@ var AMDLoader;
|
||||
return this._unresolvedDependenciesCount === 0;
|
||||
};
|
||||
return Module;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.Module = Module;
|
||||
// ------------------------------------------------------------------------
|
||||
// LoaderEvent
|
||||
@ -859,7 +865,7 @@ var AMDLoader;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
return LoaderEvent;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.LoaderEvent = LoaderEvent;
|
||||
var LoaderEventRecorder = (function () {
|
||||
function LoaderEventRecorder(loaderAvailableTimestamp) {
|
||||
@ -872,7 +878,7 @@ var AMDLoader;
|
||||
return this._events;
|
||||
};
|
||||
return LoaderEventRecorder;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.LoaderEventRecorder = LoaderEventRecorder;
|
||||
var NullLoaderEventRecorder = (function () {
|
||||
function NullLoaderEventRecorder() {
|
||||
@ -885,7 +891,7 @@ var AMDLoader;
|
||||
};
|
||||
NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();
|
||||
return NullLoaderEventRecorder;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder;
|
||||
var ModuleManager = (function () {
|
||||
function ModuleManager(scriptLoader) {
|
||||
@ -1520,7 +1526,7 @@ var AMDLoader;
|
||||
}
|
||||
};
|
||||
return ModuleManager;
|
||||
})();
|
||||
}());
|
||||
AMDLoader.ModuleManager = ModuleManager;
|
||||
/**
|
||||
* Load `scriptSrc` only once (avoid multiple <script> tags)
|
||||
@ -1561,7 +1567,7 @@ var AMDLoader;
|
||||
}
|
||||
};
|
||||
return OnlyOnceScriptLoader;
|
||||
})();
|
||||
}());
|
||||
var BrowserScriptLoader = (function () {
|
||||
function BrowserScriptLoader() {
|
||||
}
|
||||
@ -1628,7 +1634,7 @@ var AMDLoader;
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
};
|
||||
return BrowserScriptLoader;
|
||||
})();
|
||||
}());
|
||||
var WorkerScriptLoader = (function () {
|
||||
function WorkerScriptLoader() {
|
||||
this.loadCalls = [];
|
||||
@ -1681,7 +1687,7 @@ var AMDLoader;
|
||||
}
|
||||
};
|
||||
return WorkerScriptLoader;
|
||||
})();
|
||||
}());
|
||||
var NodeScriptLoader = (function () {
|
||||
function NodeScriptLoader() {
|
||||
this._initialized = false;
|
||||
@ -1760,7 +1766,7 @@ var AMDLoader;
|
||||
};
|
||||
NodeScriptLoader._BOM = 0xFEFF;
|
||||
return NodeScriptLoader;
|
||||
})();
|
||||
}());
|
||||
// ------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
@ -1790,7 +1796,7 @@ var AMDLoader;
|
||||
jQuery: true
|
||||
};
|
||||
return DefineFunc;
|
||||
})();
|
||||
}());
|
||||
var RequireFunc = (function () {
|
||||
function RequireFunc() {
|
||||
if (arguments.length === 1) {
|
||||
@ -1837,7 +1843,7 @@ var AMDLoader;
|
||||
return moduleManager.getLoaderEvents();
|
||||
};
|
||||
return RequireFunc;
|
||||
})();
|
||||
}());
|
||||
var global = _amdLoaderGlobal, hasPerformanceNow = (global.performance && typeof global.performance.now === 'function'), isWebWorker, isElectronRenderer, isElectronMain, isNode, scriptLoader, moduleManager, loaderAvailableTimestamp;
|
||||
function initVars() {
|
||||
isWebWorker = (typeof global.importScripts === 'function');
|
||||
|
||||
@ -81,7 +81,7 @@ var NLSLoaderPlugin;
|
||||
});
|
||||
}
|
||||
else {
|
||||
var suffix;
|
||||
var suffix = void 0;
|
||||
if (Resources && Resources.getString) {
|
||||
suffix = '.nls.keys';
|
||||
req([name + suffix], function (keyMap) {
|
||||
@ -175,7 +175,7 @@ var NLSLoaderPlugin;
|
||||
NLSPlugin.BUILD_MAP = {};
|
||||
NLSPlugin.BUILD_MAP_KEYS = {};
|
||||
return NLSPlugin;
|
||||
})();
|
||||
}());
|
||||
NLSLoaderPlugin.NLSPlugin = NLSPlugin;
|
||||
(function () {
|
||||
define('vs/nls', new NLSPlugin());
|
||||
|
||||
@ -39,7 +39,7 @@ var TextLoaderPlugin;
|
||||
req.send(null);
|
||||
};
|
||||
return BrowserTextLoader;
|
||||
})();
|
||||
}());
|
||||
function readFileAndRemoveBOM(fs, path) {
|
||||
var BOM_CHAR_CODE = 65279;
|
||||
var contents = fs.readFileSync(path, 'utf8');
|
||||
@ -57,7 +57,7 @@ var TextLoaderPlugin;
|
||||
callback(readFileAndRemoveBOM(this.fs, fileUrl));
|
||||
};
|
||||
return NodeTextLoader;
|
||||
})();
|
||||
}());
|
||||
// ------------------------------ Finally, the plugin
|
||||
var TextPlugin = (function () {
|
||||
function TextPlugin(textLoader) {
|
||||
@ -95,7 +95,7 @@ var TextLoaderPlugin;
|
||||
};
|
||||
TextPlugin.BUILD_MAP = {};
|
||||
return TextPlugin;
|
||||
})();
|
||||
}());
|
||||
TextLoaderPlugin.TextPlugin = TextPlugin;
|
||||
var Utilities = (function () {
|
||||
function Utilities() {
|
||||
@ -170,7 +170,7 @@ var TextLoaderPlugin;
|
||||
return resultPieces.join('');
|
||||
};
|
||||
return Utilities;
|
||||
})();
|
||||
}());
|
||||
TextLoaderPlugin.Utilities = Utilities;
|
||||
(function () {
|
||||
var textLoader = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user