Skip to content

Commit c94bc23

Browse files
committed
cached data for extensions, second try
1 parent f4ed8a5 commit c94bc23

2 files changed

Lines changed: 51 additions & 47 deletions

File tree

src/vs/loader.js

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
*---------------------------------------------------------------------------------------------
2020
*--------------------------------------------------------------------------------------------*/
2121
var _amdLoaderGlobal = this;
22+
var _commonjsGlobal = typeof global === 'object' ? global : {};
2223
var AMDLoader;
2324
(function (AMDLoader) {
2425
AMDLoader.global = _amdLoaderGlobal;
25-
var Environment = /** @class */ (function () {
26+
var Environment = (function () {
2627
function Environment() {
2728
this._detected = false;
2829
this._isWindows = false;
@@ -93,7 +94,7 @@ var AMDLoader;
9394
*--------------------------------------------------------------------------------------------*/
9495
var AMDLoader;
9596
(function (AMDLoader) {
96-
var LoaderEvent = /** @class */ (function () {
97+
var LoaderEvent = (function () {
9798
function LoaderEvent(type, detail, timestamp) {
9899
this.type = type;
99100
this.detail = detail;
@@ -102,7 +103,7 @@ var AMDLoader;
102103
return LoaderEvent;
103104
}());
104105
AMDLoader.LoaderEvent = LoaderEvent;
105-
var LoaderEventRecorder = /** @class */ (function () {
106+
var LoaderEventRecorder = (function () {
106107
function LoaderEventRecorder(loaderAvailableTimestamp) {
107108
this._events = [new LoaderEvent(1 /* LoaderAvailable */, '', loaderAvailableTimestamp)];
108109
}
@@ -115,7 +116,7 @@ var AMDLoader;
115116
return LoaderEventRecorder;
116117
}());
117118
AMDLoader.LoaderEventRecorder = LoaderEventRecorder;
118-
var NullLoaderEventRecorder = /** @class */ (function () {
119+
var NullLoaderEventRecorder = (function () {
119120
function NullLoaderEventRecorder() {
120121
}
121122
NullLoaderEventRecorder.prototype.record = function (type, detail) {
@@ -124,9 +125,9 @@ var AMDLoader;
124125
NullLoaderEventRecorder.prototype.getEvents = function () {
125126
return [];
126127
};
127-
NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();
128128
return NullLoaderEventRecorder;
129129
}());
130+
NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();
130131
AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder;
131132
})(AMDLoader || (AMDLoader = {}));
132133
/*---------------------------------------------------------------------------------------------
@@ -135,7 +136,7 @@ var AMDLoader;
135136
*--------------------------------------------------------------------------------------------*/
136137
var AMDLoader;
137138
(function (AMDLoader) {
138-
var Utilities = /** @class */ (function () {
139+
var Utilities = (function () {
139140
function Utilities() {
140141
}
141142
/**
@@ -221,11 +222,11 @@ var AMDLoader;
221222
}
222223
return (this.HAS_PERFORMANCE_NOW ? AMDLoader.global.performance.now() : Date.now());
223224
};
224-
Utilities.NEXT_ANONYMOUS_ID = 1;
225-
Utilities.PERFORMANCE_NOW_PROBED = false;
226-
Utilities.HAS_PERFORMANCE_NOW = false;
227225
return Utilities;
228226
}());
227+
Utilities.NEXT_ANONYMOUS_ID = 1;
228+
Utilities.PERFORMANCE_NOW_PROBED = false;
229+
Utilities.HAS_PERFORMANCE_NOW = false;
229230
AMDLoader.Utilities = Utilities;
230231
})(AMDLoader || (AMDLoader = {}));
231232
/*---------------------------------------------------------------------------------------------
@@ -234,7 +235,7 @@ var AMDLoader;
234235
*--------------------------------------------------------------------------------------------*/
235236
var AMDLoader;
236237
(function (AMDLoader) {
237-
var ConfigurationOptionsUtil = /** @class */ (function () {
238+
var ConfigurationOptionsUtil = (function () {
238239
function ConfigurationOptionsUtil() {
239240
}
240241
/**
@@ -343,7 +344,7 @@ var AMDLoader;
343344
return ConfigurationOptionsUtil;
344345
}());
345346
AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil;
346-
var Configuration = /** @class */ (function () {
347+
var Configuration = (function () {
347348
function Configuration(env, options) {
348349
this._env = env;
349350
this.options = ConfigurationOptionsUtil.mergeConfigurationOptions(options);
@@ -554,7 +555,7 @@ var AMDLoader;
554555
/**
555556
* Load `scriptSrc` only once (avoid multiple <script> tags)
556557
*/
557-
var OnlyOnceScriptLoader = /** @class */ (function () {
558+
var OnlyOnceScriptLoader = (function () {
558559
function OnlyOnceScriptLoader(env) {
559560
this._env = env;
560561
this._scriptLoader = null;
@@ -596,7 +597,7 @@ var AMDLoader;
596597
};
597598
return OnlyOnceScriptLoader;
598599
}());
599-
var BrowserScriptLoader = /** @class */ (function () {
600+
var BrowserScriptLoader = (function () {
600601
function BrowserScriptLoader() {
601602
}
602603
/**
@@ -634,7 +635,7 @@ var AMDLoader;
634635
};
635636
return BrowserScriptLoader;
636637
}());
637-
var WorkerScriptLoader = /** @class */ (function () {
638+
var WorkerScriptLoader = (function () {
638639
function WorkerScriptLoader() {
639640
}
640641
WorkerScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
@@ -648,7 +649,7 @@ var AMDLoader;
648649
};
649650
return WorkerScriptLoader;
650651
}());
651-
var NodeScriptLoader = /** @class */ (function () {
652+
var NodeScriptLoader = (function () {
652653
function NodeScriptLoader(env) {
653654
this._env = env;
654655
this._didInitialize = false;
@@ -719,7 +720,7 @@ var AMDLoader;
719720
var compileWrapper = script.runInThisContext(options);
720721
var dirname = that._path.dirname(filename);
721722
var require = makeRequireFunction(this);
722-
var args = [this.exports, require, this, filename, dirname, process, AMDLoader.global, Buffer];
723+
var args = [this.exports, require, this, filename, dirname, process, _commonjsGlobal, Buffer];
723724
var result = compileWrapper.apply(this.exports, args);
724725
that._processCachedData(moduleManager, script, cachedDataPath);
725726
return result;
@@ -830,15 +831,17 @@ var AMDLoader;
830831
errorCode: 'cachedDataRejected',
831832
path: cachedDataPath
832833
});
833-
NodeScriptLoader._runSoon(function () { return _this._fs.unlink(cachedDataPath, function (err) {
834-
if (err) {
835-
moduleManager.getConfig().getOptionsLiteral().onNodeCachedData({
836-
errorCode: 'unlink',
837-
path: cachedDataPath,
838-
detail: err
839-
});
840-
}
841-
}); }, moduleManager.getConfig().getOptionsLiteral().nodeCachedDataWriteDelay);
834+
NodeScriptLoader._runSoon(function () {
835+
return _this._fs.unlink(cachedDataPath, function (err) {
836+
if (err) {
837+
moduleManager.getConfig().getOptionsLiteral().onNodeCachedData({
838+
errorCode: 'unlink',
839+
path: cachedDataPath,
840+
detail: err
841+
});
842+
}
843+
});
844+
}, moduleManager.getConfig().getOptionsLiteral().nodeCachedDataWriteDelay);
842845
}
843846
else if (script.cachedDataProduced) {
844847
// data produced => tell outside world
@@ -847,24 +850,26 @@ var AMDLoader;
847850
length: script.cachedData.length
848851
});
849852
// data produced => write cache file
850-
NodeScriptLoader._runSoon(function () { return _this._fs.writeFile(cachedDataPath, script.cachedData, function (err) {
851-
if (err) {
852-
moduleManager.getConfig().getOptionsLiteral().onNodeCachedData({
853-
errorCode: 'writeFile',
854-
path: cachedDataPath,
855-
detail: err
856-
});
857-
}
858-
}); }, moduleManager.getConfig().getOptionsLiteral().nodeCachedDataWriteDelay);
853+
NodeScriptLoader._runSoon(function () {
854+
return _this._fs.writeFile(cachedDataPath, script.cachedData, function (err) {
855+
if (err) {
856+
moduleManager.getConfig().getOptionsLiteral().onNodeCachedData({
857+
errorCode: 'writeFile',
858+
path: cachedDataPath,
859+
detail: err
860+
});
861+
}
862+
});
863+
}, moduleManager.getConfig().getOptionsLiteral().nodeCachedDataWriteDelay);
859864
}
860865
};
861866
NodeScriptLoader._runSoon = function (callback, minTimeout) {
862867
var timeout = minTimeout + Math.ceil(Math.random() * minTimeout);
863868
setTimeout(callback, timeout);
864869
};
865-
NodeScriptLoader._BOM = 0xFEFF;
866870
return NodeScriptLoader;
867871
}());
872+
NodeScriptLoader._BOM = 0xFEFF;
868873
function createScriptLoader(env) {
869874
return new OnlyOnceScriptLoader(env);
870875
}
@@ -878,7 +883,7 @@ var AMDLoader;
878883
(function (AMDLoader) {
879884
// ------------------------------------------------------------------------
880885
// ModuleIdResolver
881-
var ModuleIdResolver = /** @class */ (function () {
886+
var ModuleIdResolver = (function () {
882887
function ModuleIdResolver(fromModuleId) {
883888
var lastSlash = fromModuleId.lastIndexOf('/');
884889
if (lastSlash !== -1) {
@@ -921,13 +926,13 @@ var AMDLoader;
921926
}
922927
return result;
923928
};
924-
ModuleIdResolver.ROOT = new ModuleIdResolver('');
925929
return ModuleIdResolver;
926930
}());
931+
ModuleIdResolver.ROOT = new ModuleIdResolver('');
927932
AMDLoader.ModuleIdResolver = ModuleIdResolver;
928933
// ------------------------------------------------------------------------
929934
// Module
930-
var Module = /** @class */ (function () {
935+
var Module = (function () {
931936
function Module(id, strId, dependencies, callback, errorback, moduleIdResolver) {
932937
this.id = id;
933938
this.strId = strId;
@@ -1017,7 +1022,7 @@ var AMDLoader;
10171022
return Module;
10181023
}());
10191024
AMDLoader.Module = Module;
1020-
var ModuleIdProvider = /** @class */ (function () {
1025+
var ModuleIdProvider = (function () {
10211026
function ModuleIdProvider() {
10221027
this._nextId = 0;
10231028
this._strModuleIdToIntModuleId = new Map();
@@ -1044,17 +1049,17 @@ var AMDLoader;
10441049
};
10451050
return ModuleIdProvider;
10461051
}());
1047-
var RegularDependency = /** @class */ (function () {
1052+
var RegularDependency = (function () {
10481053
function RegularDependency(id) {
10491054
this.id = id;
10501055
}
1051-
RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);
1052-
RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);
1053-
RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);
10541056
return RegularDependency;
10551057
}());
1058+
RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);
1059+
RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);
1060+
RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);
10561061
AMDLoader.RegularDependency = RegularDependency;
1057-
var PluginDependency = /** @class */ (function () {
1062+
var PluginDependency = (function () {
10581063
function PluginDependency(id, pluginId, pluginParam) {
10591064
this.id = id;
10601065
this.pluginId = pluginId;
@@ -1063,7 +1068,7 @@ var AMDLoader;
10631068
return PluginDependency;
10641069
}());
10651070
AMDLoader.PluginDependency = PluginDependency;
1066-
var ModuleManager = /** @class */ (function () {
1071+
var ModuleManager = (function () {
10671072
function ModuleManager(env, scriptLoader, defineFunc, requireFunc, loaderAvailableTimestamp) {
10681073
if (loaderAvailableTimestamp === void 0) { loaderAvailableTimestamp = 0; }
10691074
this._env = env;

src/vs/workbench/services/extensions/electron-browser/extensionHost.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
177177
VSCODE_IPC_HOOK_EXTHOST: pipeName,
178178
VSCODE_HANDLES_UNCAUGHT_ERRORS: true,
179179
VSCODE_LOG_STACK: !this._isExtensionDevTestFromCli && (this._isExtensionDevHost || !this._environmentService.isBuilt || product.quality !== 'stable' || this._environmentService.verbose),
180-
VSCODE_LOG_LEVEL: this._environmentService.verbose ? 'trace' : this._environmentService.log,
181-
VSCODE_NODE_CACHED_DATA_DIR: ''
180+
VSCODE_LOG_LEVEL: this._environmentService.verbose ? 'trace' : this._environmentService.log
182181
}),
183182
// We only detach the extension host on windows. Linux and Mac orphan by default
184183
// and detach under Linux and Mac create another process group.

0 commit comments

Comments
 (0)