update loader (#149878)

This commit is contained in:
Tyler James Leonhardt 2022-05-18 17:14:29 -07:00 committed by GitHub
parent fbbcdc9411
commit ba2dd82580
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View file

@ -16,10 +16,6 @@
'use strict';
var CSSLoaderPlugin;
(function (CSSLoaderPlugin) {
/**
* Known issue:
* - In IE there is no way to know if the CSS file loaded successfully or not.
*/
var BrowserCSSLoader = /** @class */ (function () {
function BrowserCSSLoader() {
this._pendingLoads = 0;

View file

@ -277,8 +277,10 @@ var AMDLoader;
return;
}
if (err.phase === 'factory') {
console.error('The factory method of "' + err.moduleId + '" has thrown an exception');
console.error('The factory function of "' + err.moduleId + '" has thrown an exception');
console.error(err);
console.error('Here are the modules that depend on it:');
console.error(err.neededBy);
return;
}
}
@ -1183,7 +1185,7 @@ var AMDLoader;
producedError: null
};
};
Module.prototype.complete = function (recorder, config, dependenciesValues) {
Module.prototype.complete = function (recorder, config, dependenciesValues, inversedependenciesProvider) {
this._isComplete = true;
var producedError = null;
if (this._callback) {
@ -1204,6 +1206,7 @@ var AMDLoader;
var err = AMDLoader.ensureError(producedError);
err.phase = 'factory';
err.moduleId = this.strId;
err.neededBy = inversedependenciesProvider(this.id);
this.error = err;
config.onError(err);
}
@ -1815,7 +1818,10 @@ var AMDLoader;
dependenciesValues[i] = null;
}
}
module.complete(recorder, this._config, dependenciesValues);
var inversedependenciesProvider = function (moduleId) {
return (_this._inverseDependencies2[moduleId] || []).map(function (intModuleId) { return _this._moduleIdProvider.getStrModuleId(intModuleId); });
};
module.complete(recorder, this._config, dependenciesValues, inversedependenciesProvider);
// Fetch and clear inverse dependencies
var inverseDeps = this._inverseDependencies2[module.id];
this._inverseDependencies2[module.id] = null;

View file

@ -114,6 +114,7 @@ var NLSLoaderPlugin;
};
NLSPlugin.prototype.load = function (name, req, load, config) {
var _this = this;
var _a;
config = config || {};
if (!name || name.length === 0) {
load({
@ -148,7 +149,13 @@ var NLSLoaderPlugin;
});
}
else {
req([name + suffix], messagesLoaded_1);
var base = (_a = pluginConfig.baseUrl) !== null && _a !== void 0 ? _a : '';
req([base + name + suffix], messagesLoaded_1, function (err) {
var _a;
// We have an error. Load the English default strings instead.
console.warn("Falling back to default strings. Unable to load translations because of: " + ((_a = err.message) !== null && _a !== void 0 ? _a : err));
req([name + '.nls'], messagesLoaded_1);
});
}
}
};