提交 c94bc234 编写于 作者: J Johannes Rieken

cached data for extensions, second try

上级 f4ed8a58
......@@ -19,10 +19,11 @@
*---------------------------------------------------------------------------------------------
*--------------------------------------------------------------------------------------------*/
var _amdLoaderGlobal = this;
var _commonjsGlobal = typeof global === 'object' ? global : {};
var AMDLoader;
(function (AMDLoader) {
AMDLoader.global = _amdLoaderGlobal;
var Environment = /** @class */ (function () {
var Environment = (function () {
function Environment() {
this._detected = false;
this._isWindows = false;
......@@ -93,7 +94,7 @@ var AMDLoader;
*--------------------------------------------------------------------------------------------*/
var AMDLoader;
(function (AMDLoader) {
var LoaderEvent = /** @class */ (function () {
var LoaderEvent = (function () {
function LoaderEvent(type, detail, timestamp) {
this.type = type;
this.detail = detail;
......@@ -102,7 +103,7 @@ var AMDLoader;
return LoaderEvent;
}());
AMDLoader.LoaderEvent = LoaderEvent;
var LoaderEventRecorder = /** @class */ (function () {
var LoaderEventRecorder = (function () {
function LoaderEventRecorder(loaderAvailableTimestamp) {
this._events = [new LoaderEvent(1 /* LoaderAvailable */, '', loaderAvailableTimestamp)];
}
......@@ -115,7 +116,7 @@ var AMDLoader;
return LoaderEventRecorder;
}());
AMDLoader.LoaderEventRecorder = LoaderEventRecorder;
var NullLoaderEventRecorder = /** @class */ (function () {
var NullLoaderEventRecorder = (function () {
function NullLoaderEventRecorder() {
}
NullLoaderEventRecorder.prototype.record = function (type, detail) {
......@@ -124,9 +125,9 @@ var AMDLoader;
NullLoaderEventRecorder.prototype.getEvents = function () {
return [];
};
NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();
return NullLoaderEventRecorder;
}());
NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder();
AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder;
})(AMDLoader || (AMDLoader = {}));
/*---------------------------------------------------------------------------------------------
......@@ -135,7 +136,7 @@ var AMDLoader;
*--------------------------------------------------------------------------------------------*/
var AMDLoader;
(function (AMDLoader) {
var Utilities = /** @class */ (function () {
var Utilities = (function () {
function Utilities() {
}
/**
......@@ -221,11 +222,11 @@ var AMDLoader;
}
return (this.HAS_PERFORMANCE_NOW ? AMDLoader.global.performance.now() : Date.now());
};
Utilities.NEXT_ANONYMOUS_ID = 1;
Utilities.PERFORMANCE_NOW_PROBED = false;
Utilities.HAS_PERFORMANCE_NOW = false;
return Utilities;
}());
Utilities.NEXT_ANONYMOUS_ID = 1;
Utilities.PERFORMANCE_NOW_PROBED = false;
Utilities.HAS_PERFORMANCE_NOW = false;
AMDLoader.Utilities = Utilities;
})(AMDLoader || (AMDLoader = {}));
/*---------------------------------------------------------------------------------------------
......@@ -234,7 +235,7 @@ var AMDLoader;
*--------------------------------------------------------------------------------------------*/
var AMDLoader;
(function (AMDLoader) {
var ConfigurationOptionsUtil = /** @class */ (function () {
var ConfigurationOptionsUtil = (function () {
function ConfigurationOptionsUtil() {
}
/**
......@@ -343,7 +344,7 @@ var AMDLoader;
return ConfigurationOptionsUtil;
}());
AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil;
var Configuration = /** @class */ (function () {
var Configuration = (function () {
function Configuration(env, options) {
this._env = env;
this.options = ConfigurationOptionsUtil.mergeConfigurationOptions(options);
......@@ -554,7 +555,7 @@ var AMDLoader;
/**
* Load `scriptSrc` only once (avoid multiple <script> tags)
*/
var OnlyOnceScriptLoader = /** @class */ (function () {
var OnlyOnceScriptLoader = (function () {
function OnlyOnceScriptLoader(env) {
this._env = env;
this._scriptLoader = null;
......@@ -596,7 +597,7 @@ var AMDLoader;
};
return OnlyOnceScriptLoader;
}());
var BrowserScriptLoader = /** @class */ (function () {
var BrowserScriptLoader = (function () {
function BrowserScriptLoader() {
}
/**
......@@ -634,7 +635,7 @@ var AMDLoader;
};
return BrowserScriptLoader;
}());
var WorkerScriptLoader = /** @class */ (function () {
var WorkerScriptLoader = (function () {
function WorkerScriptLoader() {
}
WorkerScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
......@@ -648,7 +649,7 @@ var AMDLoader;
};
return WorkerScriptLoader;
}());
var NodeScriptLoader = /** @class */ (function () {
var NodeScriptLoader = (function () {
function NodeScriptLoader(env) {
this._env = env;
this._didInitialize = false;
......@@ -719,7 +720,7 @@ var AMDLoader;
var compileWrapper = script.runInThisContext(options);
var dirname = that._path.dirname(filename);
var require = makeRequireFunction(this);
var args = [this.exports, require, this, filename, dirname, process, AMDLoader.global, Buffer];
var args = [this.exports, require, this, filename, dirname, process, _commonjsGlobal, Buffer];
var result = compileWrapper.apply(this.exports, args);
that._processCachedData(moduleManager, script, cachedDataPath);
return result;
......@@ -830,15 +831,17 @@ var AMDLoader;
errorCode: 'cachedDataRejected',
path: cachedDataPath
});
NodeScriptLoader._runSoon(function () { return _this._fs.unlink(cachedDataPath, function (err) {
if (err) {
moduleManager.getConfig().getOptionsLiteral().onNodeCachedData({
errorCode: 'unlink',
path: cachedDataPath,
detail: err
});
}
}); }, moduleManager.getConfig().getOptionsLiteral().nodeCachedDataWriteDelay);
NodeScriptLoader._runSoon(function () {
return _this._fs.unlink(cachedDataPath, function (err) {
if (err) {
moduleManager.getConfig().getOptionsLiteral().onNodeCachedData({
errorCode: 'unlink',
path: cachedDataPath,
detail: err
});
}
});
}, moduleManager.getConfig().getOptionsLiteral().nodeCachedDataWriteDelay);
}
else if (script.cachedDataProduced) {
// data produced => tell outside world
......@@ -847,24 +850,26 @@ var AMDLoader;
length: script.cachedData.length
});
// data produced => write cache file
NodeScriptLoader._runSoon(function () { return _this._fs.writeFile(cachedDataPath, script.cachedData, function (err) {
if (err) {
moduleManager.getConfig().getOptionsLiteral().onNodeCachedData({
errorCode: 'writeFile',
path: cachedDataPath,
detail: err
});
}
}); }, moduleManager.getConfig().getOptionsLiteral().nodeCachedDataWriteDelay);
NodeScriptLoader._runSoon(function () {
return _this._fs.writeFile(cachedDataPath, script.cachedData, function (err) {
if (err) {
moduleManager.getConfig().getOptionsLiteral().onNodeCachedData({
errorCode: 'writeFile',
path: cachedDataPath,
detail: err
});
}
});
}, moduleManager.getConfig().getOptionsLiteral().nodeCachedDataWriteDelay);
}
};
NodeScriptLoader._runSoon = function (callback, minTimeout) {
var timeout = minTimeout + Math.ceil(Math.random() * minTimeout);
setTimeout(callback, timeout);
};
NodeScriptLoader._BOM = 0xFEFF;
return NodeScriptLoader;
}());
NodeScriptLoader._BOM = 0xFEFF;
function createScriptLoader(env) {
return new OnlyOnceScriptLoader(env);
}
......@@ -878,7 +883,7 @@ var AMDLoader;
(function (AMDLoader) {
// ------------------------------------------------------------------------
// ModuleIdResolver
var ModuleIdResolver = /** @class */ (function () {
var ModuleIdResolver = (function () {
function ModuleIdResolver(fromModuleId) {
var lastSlash = fromModuleId.lastIndexOf('/');
if (lastSlash !== -1) {
......@@ -921,13 +926,13 @@ var AMDLoader;
}
return result;
};
ModuleIdResolver.ROOT = new ModuleIdResolver('');
return ModuleIdResolver;
}());
ModuleIdResolver.ROOT = new ModuleIdResolver('');
AMDLoader.ModuleIdResolver = ModuleIdResolver;
// ------------------------------------------------------------------------
// Module
var Module = /** @class */ (function () {
var Module = (function () {
function Module(id, strId, dependencies, callback, errorback, moduleIdResolver) {
this.id = id;
this.strId = strId;
......@@ -1017,7 +1022,7 @@ var AMDLoader;
return Module;
}());
AMDLoader.Module = Module;
var ModuleIdProvider = /** @class */ (function () {
var ModuleIdProvider = (function () {
function ModuleIdProvider() {
this._nextId = 0;
this._strModuleIdToIntModuleId = new Map();
......@@ -1044,17 +1049,17 @@ var AMDLoader;
};
return ModuleIdProvider;
}());
var RegularDependency = /** @class */ (function () {
var RegularDependency = (function () {
function RegularDependency(id) {
this.id = id;
}
RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);
RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);
RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);
return RegularDependency;
}());
RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);
RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);
RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);
AMDLoader.RegularDependency = RegularDependency;
var PluginDependency = /** @class */ (function () {
var PluginDependency = (function () {
function PluginDependency(id, pluginId, pluginParam) {
this.id = id;
this.pluginId = pluginId;
......@@ -1063,7 +1068,7 @@ var AMDLoader;
return PluginDependency;
}());
AMDLoader.PluginDependency = PluginDependency;
var ModuleManager = /** @class */ (function () {
var ModuleManager = (function () {
function ModuleManager(env, scriptLoader, defineFunc, requireFunc, loaderAvailableTimestamp) {
if (loaderAvailableTimestamp === void 0) { loaderAvailableTimestamp = 0; }
this._env = env;
......
......@@ -177,8 +177,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter {
VSCODE_IPC_HOOK_EXTHOST: pipeName,
VSCODE_HANDLES_UNCAUGHT_ERRORS: true,
VSCODE_LOG_STACK: !this._isExtensionDevTestFromCli && (this._isExtensionDevHost || !this._environmentService.isBuilt || product.quality !== 'stable' || this._environmentService.verbose),
VSCODE_LOG_LEVEL: this._environmentService.verbose ? 'trace' : this._environmentService.log,
VSCODE_NODE_CACHED_DATA_DIR: ''
VSCODE_LOG_LEVEL: this._environmentService.verbose ? 'trace' : this._environmentService.log
}),
// We only detach the extension host on windows. Linux and Mac orphan by default
// and detach under Linux and Mac create another process group.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册