From 344e0b3382c982ca15261c5faab7855f8cb85bd0 Mon Sep 17 00:00:00 2001 From: netcon Date: Mon, 24 May 2021 23:12:42 +0800 Subject: [PATCH] Feature/browser compatibility (#307) * fix: compatible with chrome 86 * fix: upgrade vscode-web version * chore: fix indent whitespace --- package.json | 2 +- vscode-web-github1s/package.json | 3 +- .../src/vs/base/worker/workerMain.ts | 101 + vscode-web-github1s/src/vs/loader.js | 1904 +++++++++++++++++ .../api/worker/extHostExtensionService.ts | 247 +++ .../worker/extensionHostWorkerMain.ts | 76 + vscode-web-github1s/tsconfig.json | 3 + vscode-web-github1s/yarn.lock | 5 + yarn.lock | 8 +- 9 files changed, 2343 insertions(+), 6 deletions(-) create mode 100644 vscode-web-github1s/src/vs/base/worker/workerMain.ts create mode 100644 vscode-web-github1s/src/vs/loader.js create mode 100644 vscode-web-github1s/src/vs/workbench/api/worker/extHostExtensionService.ts create mode 100644 vscode-web-github1s/src/vs/workbench/services/extensions/worker/extensionHostWorkerMain.ts create mode 100644 vscode-web-github1s/tsconfig.json diff --git a/package.json b/package.json index 028dadb9f..87c9ccebf 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "lib": "lib" }, "devDependencies": { - "@github1s/vscode-web": "0.1.7", + "@github1s/vscode-web": "0.1.8", "@typescript-eslint/eslint-plugin": "^4.15.0", "@typescript-eslint/parser": "^4.15.0", "chokidar": "^3.5.1", diff --git a/vscode-web-github1s/package.json b/vscode-web-github1s/package.json index 6edf3d8dc..4a3b604b9 100644 --- a/vscode-web-github1s/package.json +++ b/vscode-web-github1s/package.json @@ -1,6 +1,6 @@ { "name": "@github1s/vscode-web", - "version": "0.1.7", + "version": "0.1.8", "description": "VS Code web for GitHub1s", "author": "github1s", "license": "MIT", @@ -38,6 +38,7 @@ "xterm-addon-webgl": "0.10.0-beta.1" }, "devDependencies": { + "@types/trusted-types": "^2.0.0", "npm-run-all": "^4.1.5" } } diff --git a/vscode-web-github1s/src/vs/base/worker/workerMain.ts b/vscode-web-github1s/src/vs/base/worker/workerMain.ts new file mode 100644 index 000000000..5765195d4 --- /dev/null +++ b/vscode-web-github1s/src/vs/base/worker/workerMain.ts @@ -0,0 +1,101 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +(function () { + + const MonacoEnvironment = (self).MonacoEnvironment; + const monacoBaseUrl = MonacoEnvironment && MonacoEnvironment.baseUrl ? MonacoEnvironment.baseUrl : '../../../'; + + const trustedTypesPolicy = ( + typeof self.trustedTypes?.createPolicy === 'function' + ? self.trustedTypes?.createPolicy('amdLoader', { + createScriptURL: value => value, + createScript: (_, ...args: string[]) => { + // workaround a chrome issue not allowing to create new functions + // see https://github.com/w3c/webappsec-trusted-types/wiki/Trusted-Types-for-function-constructor + const fnArgs = args.slice(0, -1).join(','); + const fnBody = args.pop()!.toString(); + const body = `(function anonymous(${fnArgs}) {\n${fnBody}\n})`; + return body; + } + }) + : undefined + ); + + function loadAMDLoader() { + return new Promise((resolve, reject) => { + if (typeof (self).define === 'function' && (self).define.amd) { + return resolve(); + } + const loaderSrc: string | TrustedScriptURL = monacoBaseUrl + 'vs/loader.js'; + + const isCrossOrigin = (/^((http:)|(https:)|(file:))/.test(loaderSrc) && loaderSrc.substring(0, self.origin.length) !== self.origin); + if (!isCrossOrigin) { + // use `fetch` if possible because `importScripts` + // is synchronous and can lead to deadlocks on Safari + fetch(loaderSrc).then((response) => { + if (response.status !== 200) { + throw new Error(response.statusText); + } + return response.text(); + }).then((text) => { + text = `${text}\n//# sourceURL=${loaderSrc}`; + const func = ( + trustedTypesPolicy + // below codes are changed by github1s + // fix error in webworker for old browsers + ? self.eval(trustedTypesPolicy.createScript('', text).toString()) + // above codes are changed by github1s + : new Function(text) + ); + func.call(self); + resolve(); + }).then(undefined, reject); + return; + } + + if (trustedTypesPolicy) { + importScripts(trustedTypesPolicy.createScriptURL(loaderSrc) as unknown as string); + } else { + importScripts(loaderSrc as string); + } + resolve(); + }); + } + + const loadCode = function (moduleId: string) { + loadAMDLoader().then(() => { + require.config({ + baseUrl: monacoBaseUrl, + catchError: true, + trustedTypesPolicy, + }); + require([moduleId], function (ws) { + setTimeout(function () { + let messageHandler = ws.create((msg: any, transfer?: Transferable[]) => { + (self).postMessage(msg, transfer); + }, null); + + self.onmessage = (e: MessageEvent) => messageHandler.onmessage(e.data); + while (beforeReadyMessages.length > 0) { + self.onmessage(beforeReadyMessages.shift()!); + } + }, 0); + }); + }); + }; + + let isFirstMessage = true; + let beforeReadyMessages: MessageEvent[] = []; + self.onmessage = (message: MessageEvent) => { + if (!isFirstMessage) { + beforeReadyMessages.push(message); + return; + } + + isFirstMessage = false; + loadCode(message.data); + }; +})(); diff --git a/vscode-web-github1s/src/vs/loader.js b/vscode-web-github1s/src/vs/loader.js new file mode 100644 index 000000000..10ee09e8d --- /dev/null +++ b/vscode-web-github1s/src/vs/loader.js @@ -0,0 +1,1904 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +'use strict'; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + * Please make sure to make edits in the .ts file at https://github.com/microsoft/vscode-loader/ + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------- + *--------------------------------------------------------------------------------------------*/ +var _amdLoaderGlobal = this; +var _commonjsGlobal = typeof global === 'object' ? global : {}; +var AMDLoader; +(function (AMDLoader) { + AMDLoader.global = _amdLoaderGlobal; + var Environment = /** @class */ (function () { + function Environment() { + this._detected = false; + this._isWindows = false; + this._isNode = false; + this._isElectronRenderer = false; + this._isWebWorker = false; + } + Object.defineProperty(Environment.prototype, "isWindows", { + get: function () { + this._detect(); + return this._isWindows; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Environment.prototype, "isNode", { + get: function () { + this._detect(); + return this._isNode; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Environment.prototype, "isElectronRenderer", { + get: function () { + this._detect(); + return this._isElectronRenderer; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Environment.prototype, "isWebWorker", { + get: function () { + this._detect(); + return this._isWebWorker; + }, + enumerable: false, + configurable: true + }); + Environment.prototype._detect = function () { + if (this._detected) { + return; + } + this._detected = true; + this._isWindows = Environment._isWindows(); + this._isNode = (typeof module !== 'undefined' && !!module.exports); + this._isElectronRenderer = (typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined' && process.type === 'renderer'); + this._isWebWorker = (typeof AMDLoader.global.importScripts === 'function'); + }; + Environment._isWindows = function () { + if (typeof navigator !== 'undefined') { + if (navigator.userAgent && navigator.userAgent.indexOf('Windows') >= 0) { + return true; + } + } + if (typeof process !== 'undefined') { + return (process.platform === 'win32'); + } + return false; + }; + return Environment; + }()); + AMDLoader.Environment = Environment; +})(AMDLoader || (AMDLoader = {})); +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var AMDLoader; +(function (AMDLoader) { + var LoaderEvent = /** @class */ (function () { + function LoaderEvent(type, detail, timestamp) { + this.type = type; + this.detail = detail; + this.timestamp = timestamp; + } + return LoaderEvent; + }()); + AMDLoader.LoaderEvent = LoaderEvent; + var LoaderEventRecorder = /** @class */ (function () { + function LoaderEventRecorder(loaderAvailableTimestamp) { + this._events = [new LoaderEvent(1 /* LoaderAvailable */, '', loaderAvailableTimestamp)]; + } + LoaderEventRecorder.prototype.record = function (type, detail) { + this._events.push(new LoaderEvent(type, detail, AMDLoader.Utilities.getHighPerformanceTimestamp())); + }; + LoaderEventRecorder.prototype.getEvents = function () { + return this._events; + }; + return LoaderEventRecorder; + }()); + AMDLoader.LoaderEventRecorder = LoaderEventRecorder; + var NullLoaderEventRecorder = /** @class */ (function () { + function NullLoaderEventRecorder() { + } + NullLoaderEventRecorder.prototype.record = function (type, detail) { + // Nothing to do + }; + NullLoaderEventRecorder.prototype.getEvents = function () { + return []; + }; + NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder(); + return NullLoaderEventRecorder; + }()); + AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder; +})(AMDLoader || (AMDLoader = {})); +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var AMDLoader; +(function (AMDLoader) { + var Utilities = /** @class */ (function () { + function Utilities() { + } + /** + * This method does not take care of / vs \ + */ + Utilities.fileUriToFilePath = function (isWindows, uri) { + uri = decodeURI(uri).replace(/%23/g, '#'); + if (isWindows) { + if (/^file:\/\/\//.test(uri)) { + // This is a URI without a hostname => return only the path segment + return uri.substr(8); + } + if (/^file:\/\//.test(uri)) { + return uri.substr(5); + } + } + else { + if (/^file:\/\//.test(uri)) { + return uri.substr(7); + } + } + // Not sure... + return uri; + }; + Utilities.startsWith = function (haystack, needle) { + return haystack.length >= needle.length && haystack.substr(0, needle.length) === needle; + }; + Utilities.endsWith = function (haystack, needle) { + return haystack.length >= needle.length && haystack.substr(haystack.length - needle.length) === needle; + }; + // only check for "?" before "#" to ensure that there is a real Query-String + Utilities.containsQueryString = function (url) { + return /^[^\#]*\?/gi.test(url); + }; + /** + * Does `url` start with http:// or https:// or file:// or / ? + */ + Utilities.isAbsolutePath = function (url) { + return /^((http:\/\/)|(https:\/\/)|(file:\/\/)|(\/))/.test(url); + }; + Utilities.forEachProperty = function (obj, callback) { + if (obj) { + var key = void 0; + for (key in obj) { + if (obj.hasOwnProperty(key)) { + callback(key, obj[key]); + } + } + } + }; + Utilities.isEmpty = function (obj) { + var isEmpty = true; + Utilities.forEachProperty(obj, function () { + isEmpty = false; + }); + return isEmpty; + }; + Utilities.recursiveClone = function (obj) { + if (!obj || typeof obj !== 'object' || obj instanceof RegExp) { + return obj; + } + if (!Array.isArray(obj) && Object.getPrototypeOf(obj) !== Object.prototype) { + // only clone "simple" objects + return obj; + } + var result = Array.isArray(obj) ? [] : {}; + Utilities.forEachProperty(obj, function (key, value) { + if (value && typeof value === 'object') { + result[key] = Utilities.recursiveClone(value); + } + else { + result[key] = value; + } + }); + return result; + }; + Utilities.generateAnonymousModule = function () { + return '===anonymous' + (Utilities.NEXT_ANONYMOUS_ID++) + '==='; + }; + Utilities.isAnonymousModule = function (id) { + return Utilities.startsWith(id, '===anonymous'); + }; + Utilities.getHighPerformanceTimestamp = function () { + if (!this.PERFORMANCE_NOW_PROBED) { + this.PERFORMANCE_NOW_PROBED = true; + this.HAS_PERFORMANCE_NOW = (AMDLoader.global.performance && typeof AMDLoader.global.performance.now === 'function'); + } + 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; + }()); + AMDLoader.Utilities = Utilities; +})(AMDLoader || (AMDLoader = {})); +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var AMDLoader; +(function (AMDLoader) { + function ensureError(err) { + if (err instanceof Error) { + return err; + } + var result = new Error(err.message || String(err) || 'Unknown Error'); + if (err.stack) { + result.stack = err.stack; + } + return result; + } + AMDLoader.ensureError = ensureError; + ; + var ConfigurationOptionsUtil = /** @class */ (function () { + function ConfigurationOptionsUtil() { + } + /** + * Ensure configuration options make sense + */ + ConfigurationOptionsUtil.validateConfigurationOptions = function (options) { + function defaultOnError(err) { + if (err.phase === 'loading') { + console.error('Loading "' + err.moduleId + '" failed'); + console.error(err); + console.error('Here are the modules that depend on it:'); + console.error(err.neededBy); + return; + } + if (err.phase === 'factory') { + console.error('The factory method of "' + err.moduleId + '" has thrown an exception'); + console.error(err); + return; + } + } + options = options || {}; + if (typeof options.baseUrl !== 'string') { + options.baseUrl = ''; + } + if (typeof options.isBuild !== 'boolean') { + options.isBuild = false; + } + if (typeof options.paths !== 'object') { + options.paths = {}; + } + if (typeof options.config !== 'object') { + options.config = {}; + } + if (typeof options.catchError === 'undefined') { + options.catchError = false; + } + if (typeof options.recordStats === 'undefined') { + options.recordStats = false; + } + if (typeof options.urlArgs !== 'string') { + options.urlArgs = ''; + } + if (typeof options.onError !== 'function') { + options.onError = defaultOnError; + } + if (!Array.isArray(options.ignoreDuplicateModules)) { + options.ignoreDuplicateModules = []; + } + if (options.baseUrl.length > 0) { + if (!AMDLoader.Utilities.endsWith(options.baseUrl, '/')) { + options.baseUrl += '/'; + } + } + if (typeof options.cspNonce !== 'string') { + options.cspNonce = ''; + } + if (typeof options.preferScriptTags === 'undefined') { + options.preferScriptTags = false; + } + if (!Array.isArray(options.nodeModules)) { + options.nodeModules = []; + } + if (options.nodeCachedData && typeof options.nodeCachedData === 'object') { + if (typeof options.nodeCachedData.seed !== 'string') { + options.nodeCachedData.seed = 'seed'; + } + if (typeof options.nodeCachedData.writeDelay !== 'number' || options.nodeCachedData.writeDelay < 0) { + options.nodeCachedData.writeDelay = 1000 * 7; + } + if (!options.nodeCachedData.path || typeof options.nodeCachedData.path !== 'string') { + var err = ensureError(new Error('INVALID cached data configuration, \'path\' MUST be set')); + err.phase = 'configuration'; + options.onError(err); + options.nodeCachedData = undefined; + } + } + return options; + }; + ConfigurationOptionsUtil.mergeConfigurationOptions = function (overwrite, base) { + if (overwrite === void 0) { overwrite = null; } + if (base === void 0) { base = null; } + var result = AMDLoader.Utilities.recursiveClone(base || {}); + // Merge known properties and overwrite the unknown ones + AMDLoader.Utilities.forEachProperty(overwrite, function (key, value) { + if (key === 'ignoreDuplicateModules' && typeof result.ignoreDuplicateModules !== 'undefined') { + result.ignoreDuplicateModules = result.ignoreDuplicateModules.concat(value); + } + else if (key === 'paths' && typeof result.paths !== 'undefined') { + AMDLoader.Utilities.forEachProperty(value, function (key2, value2) { return result.paths[key2] = value2; }); + } + else if (key === 'config' && typeof result.config !== 'undefined') { + AMDLoader.Utilities.forEachProperty(value, function (key2, value2) { return result.config[key2] = value2; }); + } + else { + result[key] = AMDLoader.Utilities.recursiveClone(value); + } + }); + return ConfigurationOptionsUtil.validateConfigurationOptions(result); + }; + return ConfigurationOptionsUtil; + }()); + AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil; + var Configuration = /** @class */ (function () { + function Configuration(env, options) { + this._env = env; + this.options = ConfigurationOptionsUtil.mergeConfigurationOptions(options); + this._createIgnoreDuplicateModulesMap(); + this._createNodeModulesMap(); + this._createSortedPathsRules(); + if (this.options.baseUrl === '') { + if (this.options.nodeRequire && this.options.nodeRequire.main && this.options.nodeRequire.main.filename && this._env.isNode) { + var nodeMain = this.options.nodeRequire.main.filename; + var dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\')); + this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1); + } + if (this.options.nodeMain && this._env.isNode) { + var nodeMain = this.options.nodeMain; + var dirnameIndex = Math.max(nodeMain.lastIndexOf('/'), nodeMain.lastIndexOf('\\')); + this.options.baseUrl = nodeMain.substring(0, dirnameIndex + 1); + } + } + } + Configuration.prototype._createIgnoreDuplicateModulesMap = function () { + // Build a map out of the ignoreDuplicateModules array + this.ignoreDuplicateModulesMap = {}; + for (var i = 0; i < this.options.ignoreDuplicateModules.length; i++) { + this.ignoreDuplicateModulesMap[this.options.ignoreDuplicateModules[i]] = true; + } + }; + Configuration.prototype._createNodeModulesMap = function () { + // Build a map out of nodeModules array + this.nodeModulesMap = Object.create(null); + for (var _i = 0, _a = this.options.nodeModules; _i < _a.length; _i++) { + var nodeModule = _a[_i]; + this.nodeModulesMap[nodeModule] = true; + } + }; + Configuration.prototype._createSortedPathsRules = function () { + var _this = this; + // Create an array our of the paths rules, sorted descending by length to + // result in a more specific -> less specific order + this.sortedPathsRules = []; + AMDLoader.Utilities.forEachProperty(this.options.paths, function (from, to) { + if (!Array.isArray(to)) { + _this.sortedPathsRules.push({ + from: from, + to: [to] + }); + } + else { + _this.sortedPathsRules.push({ + from: from, + to: to + }); + } + }); + this.sortedPathsRules.sort(function (a, b) { + return b.from.length - a.from.length; + }); + }; + /** + * Clone current configuration and overwrite options selectively. + * @param options The selective options to overwrite with. + * @result A new configuration + */ + Configuration.prototype.cloneAndMerge = function (options) { + return new Configuration(this._env, ConfigurationOptionsUtil.mergeConfigurationOptions(options, this.options)); + }; + /** + * Get current options bag. Useful for passing it forward to plugins. + */ + Configuration.prototype.getOptionsLiteral = function () { + return this.options; + }; + Configuration.prototype._applyPaths = function (moduleId) { + var pathRule; + for (var i = 0, len = this.sortedPathsRules.length; i < len; i++) { + pathRule = this.sortedPathsRules[i]; + if (AMDLoader.Utilities.startsWith(moduleId, pathRule.from)) { + var result = []; + for (var j = 0, lenJ = pathRule.to.length; j < lenJ; j++) { + result.push(pathRule.to[j] + moduleId.substr(pathRule.from.length)); + } + return result; + } + } + return [moduleId]; + }; + Configuration.prototype._addUrlArgsToUrl = function (url) { + if (AMDLoader.Utilities.containsQueryString(url)) { + return url + '&' + this.options.urlArgs; + } + else { + return url + '?' + this.options.urlArgs; + } + }; + Configuration.prototype._addUrlArgsIfNecessaryToUrl = function (url) { + if (this.options.urlArgs) { + return this._addUrlArgsToUrl(url); + } + return url; + }; + Configuration.prototype._addUrlArgsIfNecessaryToUrls = function (urls) { + if (this.options.urlArgs) { + for (var i = 0, len = urls.length; i < len; i++) { + urls[i] = this._addUrlArgsToUrl(urls[i]); + } + } + return urls; + }; + /** + * Transform a module id to a location. Appends .js to module ids + */ + Configuration.prototype.moduleIdToPaths = function (moduleId) { + var isNodeModule = ((this.nodeModulesMap[moduleId] === true) + || (this.options.amdModulesPattern instanceof RegExp && !this.options.amdModulesPattern.test(moduleId))); + if (isNodeModule) { + // This is a node module... + if (this.isBuild()) { + // ...and we are at build time, drop it + return ['empty:']; + } + else { + // ...and at runtime we create a `shortcut`-path + return ['node|' + moduleId]; + } + } + var result = moduleId; + var results; + if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.isAbsolutePath(result)) { + results = this._applyPaths(result); + for (var i = 0, len = results.length; i < len; i++) { + if (this.isBuild() && results[i] === 'empty:') { + continue; + } + if (!AMDLoader.Utilities.isAbsolutePath(results[i])) { + results[i] = this.options.baseUrl + results[i]; + } + if (!AMDLoader.Utilities.endsWith(results[i], '.js') && !AMDLoader.Utilities.containsQueryString(results[i])) { + results[i] = results[i] + '.js'; + } + } + } + else { + if (!AMDLoader.Utilities.endsWith(result, '.js') && !AMDLoader.Utilities.containsQueryString(result)) { + result = result + '.js'; + } + results = [result]; + } + return this._addUrlArgsIfNecessaryToUrls(results); + }; + /** + * Transform a module id or url to a location. + */ + Configuration.prototype.requireToUrl = function (url) { + var result = url; + if (!AMDLoader.Utilities.isAbsolutePath(result)) { + result = this._applyPaths(result)[0]; + if (!AMDLoader.Utilities.isAbsolutePath(result)) { + result = this.options.baseUrl + result; + } + } + return this._addUrlArgsIfNecessaryToUrl(result); + }; + /** + * Flag to indicate if current execution is as part of a build. + */ + Configuration.prototype.isBuild = function () { + return this.options.isBuild; + }; + /** + * Test if module `moduleId` is expected to be defined multiple times + */ + Configuration.prototype.isDuplicateMessageIgnoredFor = function (moduleId) { + return this.ignoreDuplicateModulesMap.hasOwnProperty(moduleId); + }; + /** + * Get the configuration settings for the provided module id + */ + Configuration.prototype.getConfigForModule = function (moduleId) { + if (this.options.config) { + return this.options.config[moduleId]; + } + }; + /** + * Should errors be caught when executing module factories? + */ + Configuration.prototype.shouldCatchError = function () { + return this.options.catchError; + }; + /** + * Should statistics be recorded? + */ + Configuration.prototype.shouldRecordStats = function () { + return this.options.recordStats; + }; + /** + * Forward an error to the error handler. + */ + Configuration.prototype.onError = function (err) { + this.options.onError(err); + }; + return Configuration; + }()); + AMDLoader.Configuration = Configuration; +})(AMDLoader || (AMDLoader = {})); +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var AMDLoader; +(function (AMDLoader) { + /** + * Load `scriptSrc` only once (avoid multiple