Skip to content

Commit 71dcb80

Browse files
committed
Adopt latest loader that adds nodeModules option to disambiguate node modules from AMD modules at bundle time and adopt it in the gulp tasks
1 parent e78309f commit 71dcb80

5 files changed

Lines changed: 36 additions & 32 deletions

File tree

build/gulpfile.common.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ exports.loaderConfig = function (emptyPaths) {
4040
paths: {
4141
'vs/extensions': 'extensions'
4242
}
43-
}
43+
},
44+
nodeModules: emptyPaths||[]
4445
};
4546

46-
(emptyPaths || []).forEach(function(m) { result.paths[m] = 'empty:'; });
4747
return result;
4848
};
4949

src/vs/css.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
*---------------------------------------------------------------------------------------------
1414
*---------------------------------------------------------------------------------------------
1515
*--------------------------------------------------------------------------------------------*/
16-
/// <reference path="declares.ts" />
17-
/// <reference path="loader.ts" />
1816
'use strict';
1917
var __extends = (this && this.__extends) || function (d, b) {
2018
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
@@ -100,7 +98,7 @@ var CSSLoaderPlugin;
10098
this._insertLinkNode(linkNode);
10199
};
102100
return BrowserCSSLoader;
103-
})();
101+
}());
104102
/**
105103
* Prior to IE10, IE could not go above 31 stylesheets in a page
106104
* 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;
201199
}
202200
};
203201
return IE9CSSLoader;
204-
})(BrowserCSSLoader);
202+
}(BrowserCSSLoader));
205203
var IE8CSSLoader = (function (_super) {
206204
__extends(IE8CSSLoader, _super);
207205
function IE8CSSLoader() {
@@ -214,7 +212,7 @@ var CSSLoaderPlugin;
214212
};
215213
};
216214
return IE8CSSLoader;
217-
})(IE9CSSLoader);
215+
}(IE9CSSLoader));
218216
var NodeCSSLoader = (function () {
219217
function NodeCSSLoader() {
220218
this.fs = require.nodeRequire('fs');
@@ -229,7 +227,7 @@ var CSSLoaderPlugin;
229227
};
230228
NodeCSSLoader.BOM_CHAR_CODE = 65279;
231229
return NodeCSSLoader;
232-
})();
230+
}());
233231
// ------------------------------ Finally, the plugin
234232
var CSSPlugin = (function () {
235233
function CSSPlugin(cssLoader) {
@@ -279,7 +277,7 @@ var CSSLoaderPlugin;
279277
};
280278
CSSPlugin.BUILD_MAP = {};
281279
return CSSPlugin;
282-
})();
280+
}());
283281
CSSLoaderPlugin.CSSPlugin = CSSPlugin;
284282
var Utilities = (function () {
285283
function Utilities() {
@@ -411,7 +409,7 @@ var CSSLoaderPlugin;
411409
});
412410
};
413411
return Utilities;
414-
})();
412+
}());
415413
CSSLoaderPlugin.Utilities = Utilities;
416414
(function () {
417415
var cssLoader = null;

src/vs/loader.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*---------------------------------------------------------------------------------------------
1414
*---------------------------------------------------------------------------------------------
1515
*--------------------------------------------------------------------------------------------*/
16-
/// <reference path="declares.ts" />
1716
'use strict';
1817
// Limitation: To load jquery through the loader, always require 'jquery' and add a path for it in the loader configuration
1918
var _amdLoaderGlobal = this, define;
@@ -123,7 +122,7 @@ var AMDLoader;
123122
};
124123
Utilities.NEXT_ANONYMOUS_ID = 1;
125124
return Utilities;
126-
})();
125+
}());
127126
AMDLoader.Utilities = Utilities;
128127
var ConfigurationOptionsUtil = (function () {
129128
function ConfigurationOptionsUtil() {
@@ -189,6 +188,9 @@ var AMDLoader;
189188
options.baseUrl += '/';
190189
}
191190
}
191+
if (!Array.isArray(options.nodeModules)) {
192+
options.nodeModules = [];
193+
}
192194
return options;
193195
};
194196
ConfigurationOptionsUtil.mergeConfigurationOptions = function (overwrite, base) {
@@ -232,7 +234,7 @@ var AMDLoader;
232234
return ConfigurationOptionsUtil.validateConfigurationOptions(result);
233235
};
234236
return ConfigurationOptionsUtil;
235-
})();
237+
}());
236238
AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil;
237239
var Configuration = (function () {
238240
function Configuration(options) {
@@ -428,6 +430,10 @@ var AMDLoader;
428430
* Transform a module id to a location. Appends .js to module ids
429431
*/
430432
Configuration.prototype.moduleIdToPaths = function (moduleId) {
433+
if (this.isBuild() && this.options.nodeModules.indexOf(moduleId) >= 0) {
434+
// This is a node module and we are at build time, drop it
435+
return ['empty:'];
436+
}
431437
var result = moduleId;
432438
if (this.overwriteModuleIdToPath.hasOwnProperty(result)) {
433439
result = this.overwriteModuleIdToPath[result];
@@ -522,7 +528,7 @@ var AMDLoader;
522528
this.options.onError(err);
523529
};
524530
return Configuration;
525-
})();
531+
}());
526532
AMDLoader.Configuration = Configuration;
527533
// ------------------------------------------------------------------------
528534
// ModuleIdResolver
@@ -602,7 +608,7 @@ var AMDLoader;
602608
this._config.onError(err);
603609
};
604610
return ModuleIdResolver;
605-
})();
611+
}());
606612
AMDLoader.ModuleIdResolver = ModuleIdResolver;
607613
// ------------------------------------------------------------------------
608614
// Module
@@ -832,7 +838,7 @@ var AMDLoader;
832838
return this._unresolvedDependenciesCount === 0;
833839
};
834840
return Module;
835-
})();
841+
}());
836842
AMDLoader.Module = Module;
837843
// ------------------------------------------------------------------------
838844
// LoaderEvent
@@ -859,7 +865,7 @@ var AMDLoader;
859865
this.timestamp = timestamp;
860866
}
861867
return LoaderEvent;
862-
})();
868+
}());
863869
AMDLoader.LoaderEvent = LoaderEvent;
864870
var LoaderEventRecorder = (function () {
865871
function LoaderEventRecorder(loaderAvailableTimestamp) {
@@ -872,7 +878,7 @@ var AMDLoader;
872878
return this._events;
873879
};
874880
return LoaderEventRecorder;
875-
})();
881+
}());
876882
AMDLoader.LoaderEventRecorder = LoaderEventRecorder;
877883
var NullLoaderEventRecorder = (function () {
878884
function NullLoaderEventRecorder() {
@@ -885,7 +891,7 @@ var AMDLoader;
885891
};
886892
NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();
887893
return NullLoaderEventRecorder;
888-
})();
894+
}());
889895
AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder;
890896
var ModuleManager = (function () {
891897
function ModuleManager(scriptLoader) {
@@ -1520,7 +1526,7 @@ var AMDLoader;
15201526
}
15211527
};
15221528
return ModuleManager;
1523-
})();
1529+
}());
15241530
AMDLoader.ModuleManager = ModuleManager;
15251531
/**
15261532
* Load `scriptSrc` only once (avoid multiple <script> tags)
@@ -1561,7 +1567,7 @@ var AMDLoader;
15611567
}
15621568
};
15631569
return OnlyOnceScriptLoader;
1564-
})();
1570+
}());
15651571
var BrowserScriptLoader = (function () {
15661572
function BrowserScriptLoader() {
15671573
}
@@ -1628,7 +1634,7 @@ var AMDLoader;
16281634
document.getElementsByTagName('head')[0].appendChild(script);
16291635
};
16301636
return BrowserScriptLoader;
1631-
})();
1637+
}());
16321638
var WorkerScriptLoader = (function () {
16331639
function WorkerScriptLoader() {
16341640
this.loadCalls = [];
@@ -1681,7 +1687,7 @@ var AMDLoader;
16811687
}
16821688
};
16831689
return WorkerScriptLoader;
1684-
})();
1690+
}());
16851691
var NodeScriptLoader = (function () {
16861692
function NodeScriptLoader() {
16871693
this._initialized = false;
@@ -1760,7 +1766,7 @@ var AMDLoader;
17601766
};
17611767
NodeScriptLoader._BOM = 0xFEFF;
17621768
return NodeScriptLoader;
1763-
})();
1769+
}());
17641770
// ------------------------------------------------------------------------
17651771
// ------------------------------------------------------------------------
17661772
// ------------------------------------------------------------------------
@@ -1790,7 +1796,7 @@ var AMDLoader;
17901796
jQuery: true
17911797
};
17921798
return DefineFunc;
1793-
})();
1799+
}());
17941800
var RequireFunc = (function () {
17951801
function RequireFunc() {
17961802
if (arguments.length === 1) {
@@ -1837,7 +1843,7 @@ var AMDLoader;
18371843
return moduleManager.getLoaderEvents();
18381844
};
18391845
return RequireFunc;
1840-
})();
1846+
}());
18411847
var global = _amdLoaderGlobal, hasPerformanceNow = (global.performance && typeof global.performance.now === 'function'), isWebWorker, isElectronRenderer, isElectronMain, isNode, scriptLoader, moduleManager, loaderAvailableTimestamp;
18421848
function initVars() {
18431849
isWebWorker = (typeof global.importScripts === 'function');

src/vs/nls.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ var NLSLoaderPlugin;
8181
});
8282
}
8383
else {
84-
var suffix;
84+
var suffix = void 0;
8585
if (Resources && Resources.getString) {
8686
suffix = '.nls.keys';
8787
req([name + suffix], function (keyMap) {
@@ -175,7 +175,7 @@ var NLSLoaderPlugin;
175175
NLSPlugin.BUILD_MAP = {};
176176
NLSPlugin.BUILD_MAP_KEYS = {};
177177
return NLSPlugin;
178-
})();
178+
}());
179179
NLSLoaderPlugin.NLSPlugin = NLSPlugin;
180180
(function () {
181181
define('vs/nls', new NLSPlugin());

src/vs/text.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var TextLoaderPlugin;
3939
req.send(null);
4040
};
4141
return BrowserTextLoader;
42-
})();
42+
}());
4343
function readFileAndRemoveBOM(fs, path) {
4444
var BOM_CHAR_CODE = 65279;
4545
var contents = fs.readFileSync(path, 'utf8');
@@ -57,7 +57,7 @@ var TextLoaderPlugin;
5757
callback(readFileAndRemoveBOM(this.fs, fileUrl));
5858
};
5959
return NodeTextLoader;
60-
})();
60+
}());
6161
// ------------------------------ Finally, the plugin
6262
var TextPlugin = (function () {
6363
function TextPlugin(textLoader) {
@@ -95,7 +95,7 @@ var TextLoaderPlugin;
9595
};
9696
TextPlugin.BUILD_MAP = {};
9797
return TextPlugin;
98-
})();
98+
}());
9999
TextLoaderPlugin.TextPlugin = TextPlugin;
100100
var Utilities = (function () {
101101
function Utilities() {
@@ -170,7 +170,7 @@ var TextLoaderPlugin;
170170
return resultPieces.join('');
171171
};
172172
return Utilities;
173-
})();
173+
}());
174174
TextLoaderPlugin.Utilities = Utilities;
175175
(function () {
176176
var textLoader = null;

0 commit comments

Comments
 (0)