/..' parts.
- *
- * Based on code in the Node.js 'path' core module.
- *
- * @param aPath The path or url to normalize.
- */
-function normalize(aPath) {
- var path = aPath;
- var url = urlParse(aPath);
- if (url) {
- if (!url.path) {
- return aPath;
- }
- path = url.path;
- }
- var isAbsolute = exports.isAbsolute(path);
-
- var parts = path.split(/\/+/);
- for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
- part = parts[i];
- if (part === '.') {
- parts.splice(i, 1);
- } else if (part === '..') {
- up++;
- } else if (up > 0) {
- if (part === '') {
- // The first part is blank if the path is absolute. Trying to go
- // above the root is a no-op. Therefore we can remove all '..' parts
- // directly after the root.
- parts.splice(i + 1, up);
- up = 0;
- } else {
- parts.splice(i, 2);
- up--;
- }
- }
- }
- path = parts.join('/');
-
- if (path === '') {
- path = isAbsolute ? '/' : '.';
- }
-
- if (url) {
- url.path = path;
- return urlGenerate(url);
- }
- return path;
-}
-exports.normalize = normalize;
-
-/**
- * Joins two paths/URLs.
- *
- * @param aRoot The root path or URL.
- * @param aPath The path or URL to be joined with the root.
- *
- * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
- * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
- * first.
- * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
- * is updated with the result and aRoot is returned. Otherwise the result
- * is returned.
- * - If aPath is absolute, the result is aPath.
- * - Otherwise the two paths are joined with a slash.
- * - Joining for example 'http://' and 'www.example.com' is also supported.
- */
-function join(aRoot, aPath) {
- if (aRoot === "") {
- aRoot = ".";
- }
- if (aPath === "") {
- aPath = ".";
- }
- var aPathUrl = urlParse(aPath);
- var aRootUrl = urlParse(aRoot);
- if (aRootUrl) {
- aRoot = aRootUrl.path || '/';
- }
-
- // `join(foo, '//www.example.org')`
- if (aPathUrl && !aPathUrl.scheme) {
- if (aRootUrl) {
- aPathUrl.scheme = aRootUrl.scheme;
- }
- return urlGenerate(aPathUrl);
- }
-
- if (aPathUrl || aPath.match(dataUrlRegexp)) {
- return aPath;
- }
-
- // `join('http://', 'www.example.com')`
- if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
- aRootUrl.host = aPath;
- return urlGenerate(aRootUrl);
- }
-
- var joined = aPath.charAt(0) === '/'
- ? aPath
- : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
-
- if (aRootUrl) {
- aRootUrl.path = joined;
- return urlGenerate(aRootUrl);
- }
- return joined;
-}
-exports.join = join;
-
-exports.isAbsolute = function (aPath) {
- return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
-};
-
-/**
- * Make a path relative to a URL or another path.
- *
- * @param aRoot The root path or URL.
- * @param aPath The path or URL to be made relative to aRoot.
- */
-function relative(aRoot, aPath) {
- if (aRoot === "") {
- aRoot = ".";
- }
-
- aRoot = aRoot.replace(/\/$/, '');
-
- // It is possible for the path to be above the root. In this case, simply
- // checking whether the root is a prefix of the path won't work. Instead, we
- // need to remove components from the root one by one, until either we find
- // a prefix that fits, or we run out of components to remove.
- var level = 0;
- while (aPath.indexOf(aRoot + '/') !== 0) {
- var index = aRoot.lastIndexOf("/");
- if (index < 0) {
- return aPath;
- }
-
- // If the only part of the root that is left is the scheme (i.e. http://,
- // file:///, etc.), one or more slashes (/), or simply nothing at all, we
- // have exhausted all components, so the path is not relative to the root.
- aRoot = aRoot.slice(0, index);
- if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
- return aPath;
- }
-
- ++level;
- }
-
- // Make sure we add a "../" for each component we removed from the root.
- return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
-}
-exports.relative = relative;
-
-var supportsNullProto = (function () {
- var obj = Object.create(null);
- return !('__proto__' in obj);
-}());
-
-function identity (s) {
- return s;
-}
-
-/**
- * Because behavior goes wacky when you set `__proto__` on objects, we
- * have to prefix all the strings in our set with an arbitrary character.
- *
- * See https://github.com/mozilla/source-map/pull/31 and
- * https://github.com/mozilla/source-map/issues/30
- *
- * @param String aStr
- */
-function toSetString(aStr) {
- if (isProtoString(aStr)) {
- return '$' + aStr;
- }
-
- return aStr;
-}
-exports.toSetString = supportsNullProto ? identity : toSetString;
-
-function fromSetString(aStr) {
- if (isProtoString(aStr)) {
- return aStr.slice(1);
- }
-
- return aStr;
-}
-exports.fromSetString = supportsNullProto ? identity : fromSetString;
-
-function isProtoString(s) {
- if (!s) {
- return false;
- }
-
- var length = s.length;
-
- if (length < 9 /* "__proto__".length */) {
- return false;
- }
-
- if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
- s.charCodeAt(length - 2) !== 95 /* '_' */ ||
- s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
- s.charCodeAt(length - 4) !== 116 /* 't' */ ||
- s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
- s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
- s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
- s.charCodeAt(length - 8) !== 95 /* '_' */ ||
- s.charCodeAt(length - 9) !== 95 /* '_' */) {
- return false;
- }
-
- for (var i = length - 10; i >= 0; i--) {
- if (s.charCodeAt(i) !== 36 /* '$' */) {
- return false;
- }
- }
-
- return true;
-}
-
-/**
- * Comparator between two mappings where the original positions are compared.
- *
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
- * mappings with the same original source/line/column, but different generated
- * line and column the same. Useful when searching for a mapping with a
- * stubbed out mapping.
- */
-function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
- var cmp = mappingA.source - mappingB.source;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0 || onlyCompareOriginal) {
- return cmp;
- }
-
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
-
- return mappingA.name - mappingB.name;
-}
-exports.compareByOriginalPositions = compareByOriginalPositions;
-
-/**
- * Comparator between two mappings with deflated source and name indices where
- * the generated positions are compared.
- *
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
- * mappings with the same generated line and column, but different
- * source/name/original line and column the same. Useful when searching for a
- * mapping with a stubbed out mapping.
- */
-function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0 || onlyCompareGenerated) {
- return cmp;
- }
-
- cmp = mappingA.source - mappingB.source;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0) {
- return cmp;
- }
-
- return mappingA.name - mappingB.name;
-}
-exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
-
-function strcmp(aStr1, aStr2) {
- if (aStr1 === aStr2) {
- return 0;
- }
-
- if (aStr1 > aStr2) {
- return 1;
- }
-
- return -1;
-}
-
-/**
- * Comparator between two mappings with inflated source and name strings where
- * the generated positions are compared.
- */
-function compareByGeneratedPositionsInflated(mappingA, mappingB) {
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
-
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0) {
- return cmp;
- }
-
- return strcmp(mappingA.name, mappingB.name);
-}
-exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
-
-},{}],484:[function(require,module,exports){
-/*
- * Copyright 2009-2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE.txt or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
-exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
-exports.SourceNode = require('./lib/source-node').SourceNode;
-
-},{"./lib/source-map-consumer":480,"./lib/source-map-generator":481,"./lib/source-node":482}],485:[function(require,module,exports){
-'use strict';
-var ansiRegex = require('ansi-regex')();
-
-module.exports = function (str) {
- return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
-};
-
-},{"ansi-regex":1}],486:[function(require,module,exports){
-(function (process){
-'use strict';
-var argv = process.argv;
-
-var terminator = argv.indexOf('--');
-var hasFlag = function (flag) {
- flag = '--' + flag;
- var pos = argv.indexOf(flag);
- return pos !== -1 && (terminator !== -1 ? pos < terminator : true);
-};
-
-module.exports = (function () {
- if ('FORCE_COLOR' in process.env) {
- return true;
- }
-
- if (hasFlag('no-color') ||
- hasFlag('no-colors') ||
- hasFlag('color=false')) {
- return false;
- }
-
- if (hasFlag('color') ||
- hasFlag('colors') ||
- hasFlag('color=true') ||
- hasFlag('color=always')) {
- return true;
- }
-
- if (process.stdout && !process.stdout.isTTY) {
- return false;
- }
-
- if (process.platform === 'win32') {
- return true;
- }
-
- if ('COLORTERM' in process.env) {
- return true;
- }
-
- if (process.env.TERM === 'dumb') {
- return false;
- }
-
- if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
- return true;
- }
-
- return false;
-})();
-
-}).call(this,require('_process'))
-},{"_process":471}],487:[function(require,module,exports){
-'use strict';
-module.exports = function toFastProperties(obj) {
- function f() {}
- f.prototype = obj;
- new f();
- return;
- eval(obj);
-};
-
-},{}],488:[function(require,module,exports){
-'use strict';
-module.exports = function (str) {
- var tail = str.length;
-
- while (/[\s\uFEFF\u00A0]/.test(str[tail - 1])) {
- tail--;
- }
-
- return str.slice(0, tail);
-};
-
-},{}],489:[function(require,module,exports){
-exports.isatty = function () { return false; };
-
-function ReadStream() {
- throw new Error('tty.ReadStream is not implemented');
-}
-exports.ReadStream = ReadStream;
-
-function WriteStream() {
- throw new Error('tty.ReadStream is not implemented');
-}
-exports.WriteStream = WriteStream;
-
-},{}],490:[function(require,module,exports){
-if (typeof Object.create === 'function') {
- // implementation from standard node.js 'util' module
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- };
-} else {
- // old school shim for old browsers
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor
- var TempCtor = function () {}
- TempCtor.prototype = superCtor.prototype
- ctor.prototype = new TempCtor()
- ctor.prototype.constructor = ctor
- }
-}
-
-},{}],491:[function(require,module,exports){
-module.exports = function isBuffer(arg) {
- return arg && typeof arg === 'object'
- && typeof arg.copy === 'function'
- && typeof arg.fill === 'function'
- && typeof arg.readUInt8 === 'function';
-}
-},{}],492:[function(require,module,exports){
-(function (process,global){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var formatRegExp = /%[sdj%]/g;
-exports.format = function(f) {
- if (!isString(f)) {
- var objects = [];
- for (var i = 0; i < arguments.length; i++) {
- objects.push(inspect(arguments[i]));
- }
- return objects.join(' ');
- }
-
- var i = 1;
- var args = arguments;
- var len = args.length;
- var str = String(f).replace(formatRegExp, function(x) {
- if (x === '%%') return '%';
- if (i >= len) return x;
- switch (x) {
- case '%s': return String(args[i++]);
- case '%d': return Number(args[i++]);
- case '%j':
- try {
- return JSON.stringify(args[i++]);
- } catch (_) {
- return '[Circular]';
- }
- default:
- return x;
- }
- });
- for (var x = args[i]; i < len; x = args[++i]) {
- if (isNull(x) || !isObject(x)) {
- str += ' ' + x;
- } else {
- str += ' ' + inspect(x);
- }
- }
- return str;
-};
-
-
-// Mark that a method should not be used.
-// Returns a modified function which warns once by default.
-// If --no-deprecation is set, then it is a no-op.
-exports.deprecate = function(fn, msg) {
- // Allow for deprecating things in the process of starting up.
- if (isUndefined(global.process)) {
- return function() {
- return exports.deprecate(fn, msg).apply(this, arguments);
- };
- }
-
- if (process.noDeprecation === true) {
- return fn;
- }
-
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (process.throwDeprecation) {
- throw new Error(msg);
- } else if (process.traceDeprecation) {
- console.trace(msg);
- } else {
- console.error(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
-
- return deprecated;
-};
-
-
-var debugs = {};
-var debugEnviron;
-exports.debuglog = function(set) {
- if (isUndefined(debugEnviron))
- debugEnviron = process.env.NODE_DEBUG || '';
- set = set.toUpperCase();
- if (!debugs[set]) {
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
- var pid = process.pid;
- debugs[set] = function() {
- var msg = exports.format.apply(exports, arguments);
- console.error('%s %d: %s', set, pid, msg);
- };
- } else {
- debugs[set] = function() {};
- }
- }
- return debugs[set];
-};
-
-
-/**
- * Echos the value of a value. Trys to print the value out
- * in the best way possible given the different types.
- *
- * @param {Object} obj The object to print out.
- * @param {Object} opts Optional options object that alters the output.
- */
-/* legacy: obj, showHidden, depth, colors*/
-function inspect(obj, opts) {
- // default options
- var ctx = {
- seen: [],
- stylize: stylizeNoColor
- };
- // legacy...
- if (arguments.length >= 3) ctx.depth = arguments[2];
- if (arguments.length >= 4) ctx.colors = arguments[3];
- if (isBoolean(opts)) {
- // legacy...
- ctx.showHidden = opts;
- } else if (opts) {
- // got an "options" object
- exports._extend(ctx, opts);
- }
- // set default options
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
- if (isUndefined(ctx.depth)) ctx.depth = 2;
- if (isUndefined(ctx.colors)) ctx.colors = false;
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
- if (ctx.colors) ctx.stylize = stylizeWithColor;
- return formatValue(ctx, obj, ctx.depth);
-}
-exports.inspect = inspect;
-
-
-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
-inspect.colors = {
- 'bold' : [1, 22],
- 'italic' : [3, 23],
- 'underline' : [4, 24],
- 'inverse' : [7, 27],
- 'white' : [37, 39],
- 'grey' : [90, 39],
- 'black' : [30, 39],
- 'blue' : [34, 39],
- 'cyan' : [36, 39],
- 'green' : [32, 39],
- 'magenta' : [35, 39],
- 'red' : [31, 39],
- 'yellow' : [33, 39]
-};
-
-// Don't use 'blue' not visible on cmd.exe
-inspect.styles = {
- 'special': 'cyan',
- 'number': 'yellow',
- 'boolean': 'yellow',
- 'undefined': 'grey',
- 'null': 'bold',
- 'string': 'green',
- 'date': 'magenta',
- // "name": intentionally not styling
- 'regexp': 'red'
-};
-
-
-function stylizeWithColor(str, styleType) {
- var style = inspect.styles[styleType];
-
- if (style) {
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
- '\u001b[' + inspect.colors[style][1] + 'm';
- } else {
- return str;
- }
-}
-
-
-function stylizeNoColor(str, styleType) {
- return str;
-}
-
-
-function arrayToHash(array) {
- var hash = {};
-
- array.forEach(function(val, idx) {
- hash[val] = true;
- });
-
- return hash;
-}
-
-
-function formatValue(ctx, value, recurseTimes) {
- // Provide a hook for user-specified inspect functions.
- // Check that value is an object with an inspect function on it
- if (ctx.customInspect &&
- value &&
- isFunction(value.inspect) &&
- // Filter out the util module, it's inspect function is special
- value.inspect !== exports.inspect &&
- // Also filter out any prototype objects using the circular check.
- !(value.constructor && value.constructor.prototype === value)) {
- var ret = value.inspect(recurseTimes, ctx);
- if (!isString(ret)) {
- ret = formatValue(ctx, ret, recurseTimes);
- }
- return ret;
- }
-
- // Primitive types cannot have properties
- var primitive = formatPrimitive(ctx, value);
- if (primitive) {
- return primitive;
- }
-
- // Look up the keys of the object.
- var keys = Object.keys(value);
- var visibleKeys = arrayToHash(keys);
-
- if (ctx.showHidden) {
- keys = Object.getOwnPropertyNames(value);
- }
-
- // IE doesn't make error fields non-enumerable
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
- if (isError(value)
- && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
- return formatError(value);
- }
-
- // Some type of object without properties can be shortcutted.
- if (keys.length === 0) {
- if (isFunction(value)) {
- var name = value.name ? ': ' + value.name : '';
- return ctx.stylize('[Function' + name + ']', 'special');
- }
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
- }
- if (isDate(value)) {
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
- }
- if (isError(value)) {
- return formatError(value);
- }
- }
-
- var base = '', array = false, braces = ['{', '}'];
-
- // Make Array say that they are Array
- if (isArray(value)) {
- array = true;
- braces = ['[', ']'];
- }
-
- // Make functions say that they are functions
- if (isFunction(value)) {
- var n = value.name ? ': ' + value.name : '';
- base = ' [Function' + n + ']';
- }
-
- // Make RegExps say that they are RegExps
- if (isRegExp(value)) {
- base = ' ' + RegExp.prototype.toString.call(value);
- }
-
- // Make dates with properties first say the date
- if (isDate(value)) {
- base = ' ' + Date.prototype.toUTCString.call(value);
- }
-
- // Make error with message first say the error
- if (isError(value)) {
- base = ' ' + formatError(value);
- }
-
- if (keys.length === 0 && (!array || value.length == 0)) {
- return braces[0] + base + braces[1];
- }
-
- if (recurseTimes < 0) {
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
- } else {
- return ctx.stylize('[Object]', 'special');
- }
- }
-
- ctx.seen.push(value);
-
- var output;
- if (array) {
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
- } else {
- output = keys.map(function(key) {
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
- });
- }
-
- ctx.seen.pop();
-
- return reduceToSingleString(output, base, braces);
-}
-
-
-function formatPrimitive(ctx, value) {
- if (isUndefined(value))
- return ctx.stylize('undefined', 'undefined');
- if (isString(value)) {
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
- .replace(/'/g, "\\'")
- .replace(/\\"/g, '"') + '\'';
- return ctx.stylize(simple, 'string');
- }
- if (isNumber(value))
- return ctx.stylize('' + value, 'number');
- if (isBoolean(value))
- return ctx.stylize('' + value, 'boolean');
- // For some reason typeof null is "object", so special case here.
- if (isNull(value))
- return ctx.stylize('null', 'null');
-}
-
-
-function formatError(value) {
- return '[' + Error.prototype.toString.call(value) + ']';
-}
-
-
-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
- var output = [];
- for (var i = 0, l = value.length; i < l; ++i) {
- if (hasOwnProperty(value, String(i))) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
- String(i), true));
- } else {
- output.push('');
- }
- }
- keys.forEach(function(key) {
- if (!key.match(/^\d+$/)) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
- key, true));
- }
- });
- return output;
-}
-
-
-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
- var name, str, desc;
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
- if (desc.get) {
- if (desc.set) {
- str = ctx.stylize('[Getter/Setter]', 'special');
- } else {
- str = ctx.stylize('[Getter]', 'special');
- }
- } else {
- if (desc.set) {
- str = ctx.stylize('[Setter]', 'special');
- }
- }
- if (!hasOwnProperty(visibleKeys, key)) {
- name = '[' + key + ']';
- }
- if (!str) {
- if (ctx.seen.indexOf(desc.value) < 0) {
- if (isNull(recurseTimes)) {
- str = formatValue(ctx, desc.value, null);
- } else {
- str = formatValue(ctx, desc.value, recurseTimes - 1);
- }
- if (str.indexOf('\n') > -1) {
- if (array) {
- str = str.split('\n').map(function(line) {
- return ' ' + line;
- }).join('\n').substr(2);
- } else {
- str = '\n' + str.split('\n').map(function(line) {
- return ' ' + line;
- }).join('\n');
- }
- }
- } else {
- str = ctx.stylize('[Circular]', 'special');
- }
- }
- if (isUndefined(name)) {
- if (array && key.match(/^\d+$/)) {
- return str;
- }
- name = JSON.stringify('' + key);
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
- name = name.substr(1, name.length - 2);
- name = ctx.stylize(name, 'name');
- } else {
- name = name.replace(/'/g, "\\'")
- .replace(/\\"/g, '"')
- .replace(/(^"|"$)/g, "'");
- name = ctx.stylize(name, 'string');
- }
- }
-
- return name + ': ' + str;
-}
-
-
-function reduceToSingleString(output, base, braces) {
- var numLinesEst = 0;
- var length = output.reduce(function(prev, cur) {
- numLinesEst++;
- if (cur.indexOf('\n') >= 0) numLinesEst++;
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
- }, 0);
-
- if (length > 60) {
- return braces[0] +
- (base === '' ? '' : base + '\n ') +
- ' ' +
- output.join(',\n ') +
- ' ' +
- braces[1];
- }
-
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
-}
-
-
-// NOTE: These type checking functions intentionally don't use `instanceof`
-// because it is fragile and can be easily faked with `Object.create()`.
-function isArray(ar) {
- return Array.isArray(ar);
-}
-exports.isArray = isArray;
-
-function isBoolean(arg) {
- return typeof arg === 'boolean';
-}
-exports.isBoolean = isBoolean;
-
-function isNull(arg) {
- return arg === null;
-}
-exports.isNull = isNull;
-
-function isNullOrUndefined(arg) {
- return arg == null;
-}
-exports.isNullOrUndefined = isNullOrUndefined;
-
-function isNumber(arg) {
- return typeof arg === 'number';
-}
-exports.isNumber = isNumber;
-
-function isString(arg) {
- return typeof arg === 'string';
-}
-exports.isString = isString;
-
-function isSymbol(arg) {
- return typeof arg === 'symbol';
-}
-exports.isSymbol = isSymbol;
-
-function isUndefined(arg) {
- return arg === void 0;
-}
-exports.isUndefined = isUndefined;
-
-function isRegExp(re) {
- return isObject(re) && objectToString(re) === '[object RegExp]';
-}
-exports.isRegExp = isRegExp;
-
-function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
-}
-exports.isObject = isObject;
-
-function isDate(d) {
- return isObject(d) && objectToString(d) === '[object Date]';
-}
-exports.isDate = isDate;
-
-function isError(e) {
- return isObject(e) &&
- (objectToString(e) === '[object Error]' || e instanceof Error);
-}
-exports.isError = isError;
-
-function isFunction(arg) {
- return typeof arg === 'function';
-}
-exports.isFunction = isFunction;
-
-function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
-}
-exports.isPrimitive = isPrimitive;
-
-exports.isBuffer = require('./support/isBuffer');
-
-function objectToString(o) {
- return Object.prototype.toString.call(o);
-}
-
-
-function pad(n) {
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
-}
-
-
-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
- 'Oct', 'Nov', 'Dec'];
-
-// 26 Feb 16:19:34
-function timestamp() {
- var d = new Date();
- var time = [pad(d.getHours()),
- pad(d.getMinutes()),
- pad(d.getSeconds())].join(':');
- return [d.getDate(), months[d.getMonth()], time].join(' ');
-}
-
-
-// log is just a thin wrapper to console.log that prepends a timestamp
-exports.log = function() {
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
-};
-
-
-/**
- * Inherit the prototype methods from one constructor into another.
- *
- * The Function.prototype.inherits from lang.js rewritten as a standalone
- * function (not on Function.prototype). NOTE: If this file is to be loaded
- * during bootstrapping this function needs to be rewritten using some native
- * functions as prototype setup using normal JavaScript does not work as
- * expected during bootstrapping (see mirror.js in r114903).
- *
- * @param {function} ctor Constructor function which needs to inherit the
- * prototype.
- * @param {function} superCtor Constructor function to inherit prototype from.
- */
-exports.inherits = require('inherits');
-
-exports._extend = function(origin, add) {
- // Don't do anything if add isn't an object
- if (!add || !isObject(add)) return origin;
-
- var keys = Object.keys(add);
- var i = keys.length;
- while (i--) {
- origin[keys[i]] = add[keys[i]];
- }
- return origin;
-};
-
-function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
-}
-
-}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./support/isBuffer":491,"_process":471,"inherits":490}],493:[function(require,module,exports){
-/*import { transform as babelTransform } from 'babel-core';
-import babelTransformDynamicImport from 'babel-plugin-syntax-dynamic-import';
-import babelTransformES2015ModulesSystemJS from 'babel-plugin-transform-es2015-modules-systemjs';*/
-
-// sadly, due to how rollup works, we can't use es6 imports here
-var babelTransform = require('babel-core').transform;
-var babelTransformDynamicImport = require('babel-plugin-syntax-dynamic-import');
-var babelTransformES2015ModulesSystemJS = require('babel-plugin-transform-es2015-modules-systemjs');
-
-self.onmessage = function (evt) {
- // transform source with Babel
- var output = babelTransform(evt.data.source, {
- compact: false,
- filename: evt.data.key + '!transpiled',
- sourceFileName: evt.data.key,
- moduleIds: false,
- sourceMaps: 'inline',
- babelrc: false,
- plugins: [babelTransformDynamicImport, babelTransformES2015ModulesSystemJS],
- });
-
- self.postMessage({key: evt.data.key, code: output.code, source: evt.data.source});
-};
-
-},{"babel-core":4,"babel-plugin-syntax-dynamic-import":54,"babel-plugin-transform-es2015-modules-systemjs":55}]},{},[493]);
diff -Nru novnc-1.0.0/vendor/browser-es-module-loader/dist/browser-es-module-loader.js novnc-1.3.0/vendor/browser-es-module-loader/dist/browser-es-module-loader.js
--- novnc-1.0.0/vendor/browser-es-module-loader/dist/browser-es-module-loader.js 2018-02-22 13:10:10.000000000 +0000
+++ novnc-1.3.0/vendor/browser-es-module-loader/dist/browser-es-module-loader.js 1970-01-01 00:00:00.000000000 +0000
@@ -1,1420 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global.BrowserESModuleLoader = factory());
-}(this, (function () { 'use strict';
-
-/*
- * Environment
- */
-var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
-var isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
-var isWindows = typeof process !== 'undefined' && typeof process.platform === 'string' && process.platform.match(/^win/);
-
-var envGlobal = typeof self !== 'undefined' ? self : global;
-/*
- * Simple Symbol() shim
- */
-var hasSymbol = typeof Symbol !== 'undefined';
-function createSymbol (name) {
- return hasSymbol ? Symbol() : '@@' + name;
-}
-
-
-
-
-
-/*
- * Environment baseURI
- */
-var baseURI;
-
-// environent baseURI detection
-if (typeof document != 'undefined' && document.getElementsByTagName) {
- baseURI = document.baseURI;
-
- if (!baseURI) {
- var bases = document.getElementsByTagName('base');
- baseURI = bases[0] && bases[0].href || window.location.href;
- }
-}
-else if (typeof location != 'undefined') {
- baseURI = location.href;
-}
-
-// sanitize out the hash and querystring
-if (baseURI) {
- baseURI = baseURI.split('#')[0].split('?')[0];
- var slashIndex = baseURI.lastIndexOf('/');
- if (slashIndex !== -1)
- baseURI = baseURI.substr(0, slashIndex + 1);
-}
-else if (typeof process !== 'undefined' && process.cwd) {
- baseURI = 'file://' + (isWindows ? '/' : '') + process.cwd();
- if (isWindows)
- baseURI = baseURI.replace(/\\/g, '/');
-}
-else {
- throw new TypeError('No environment baseURI');
-}
-
-// ensure baseURI has trailing "/"
-if (baseURI[baseURI.length - 1] !== '/')
- baseURI += '/';
-
-/*
- * LoaderError with chaining for loader stacks
- */
-var errArgs = new Error(0, '_').fileName == '_';
-function LoaderError__Check_error_message_for_loader_stack (childErr, newMessage) {
- // Convert file:/// URLs to paths in Node
- if (!isBrowser)
- newMessage = newMessage.replace(isWindows ? /file:\/\/\//g : /file:\/\//g, '');
-
- var message = (childErr.message || childErr) + '\n ' + newMessage;
-
- var err;
- if (errArgs && childErr.fileName)
- err = new Error(message, childErr.fileName, childErr.lineNumber);
- else
- err = new Error(message);
-
-
- var stack = childErr.originalErr ? childErr.originalErr.stack : childErr.stack;
-
- if (isNode)
- // node doesn't show the message otherwise
- err.stack = message + '\n ' + stack;
- else
- err.stack = stack;
-
- err.originalErr = childErr.originalErr || childErr;
-
- return err;
-}
-
-var resolvedPromise = Promise.resolve();
-
-/*
- * Simple Array values shim
- */
-function arrayValues (arr) {
- if (arr.values)
- return arr.values();
-
- if (typeof Symbol === 'undefined' || !Symbol.iterator)
- throw new Error('Symbol.iterator not supported in this browser');
-
- var iterable = {};
- iterable[Symbol.iterator] = function () {
- var keys = Object.keys(arr);
- var keyIndex = 0;
- return {
- next: function () {
- if (keyIndex < keys.length)
- return {
- value: arr[keys[keyIndex++]],
- done: false
- };
- else
- return {
- value: undefined,
- done: true
- };
- }
- };
- };
- return iterable;
-}
-
-/*
- * 3. Reflect.Loader
- *
- * We skip the entire native internal pipeline, just providing the bare API
- */
-// 3.1.1
-function Loader () {
- this.registry = new Registry();
-}
-// 3.3.1
-Loader.prototype.constructor = Loader;
-
-function ensureInstantiated (module) {
- if (!(module instanceof ModuleNamespace))
- throw new TypeError('Module instantiation did not return a valid namespace object.');
- return module;
-}
-
-// 3.3.2
-Loader.prototype.import = function (key, parent) {
- if (typeof key !== 'string')
- throw new TypeError('Loader import method must be passed a module key string');
- // custom resolveInstantiate combined hook for better perf
- var loader = this;
- return resolvedPromise
- .then(function () {
- return loader[RESOLVE_INSTANTIATE](key, parent);
- })
- .then(ensureInstantiated)
- //.then(Module.evaluate)
- .catch(function (err) {
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Loading ' + key + (parent ? ' from ' + parent : ''));
- });
-};
-// 3.3.3
-var RESOLVE = Loader.resolve = createSymbol('resolve');
-
-/*
- * Combined resolve / instantiate hook
- *
- * Not in current reduced spec, but necessary to separate RESOLVE from RESOLVE + INSTANTIATE as described
- * in the spec notes of this repo to ensure that loader.resolve doesn't instantiate when not wanted.
- *
- * We implement RESOLVE_INSTANTIATE as a single hook instead of a separate INSTANTIATE in order to avoid
- * the need for double registry lookups as a performance optimization.
- */
-var RESOLVE_INSTANTIATE = Loader.resolveInstantiate = createSymbol('resolveInstantiate');
-
-// default resolveInstantiate is just to call resolve and then get from the registry
-// this provides compatibility for the resolveInstantiate optimization
-Loader.prototype[RESOLVE_INSTANTIATE] = function (key, parent) {
- var loader = this;
- return loader.resolve(key, parent)
- .then(function (resolved) {
- return loader.registry.get(resolved);
- });
-};
-
-function ensureResolution (resolvedKey) {
- if (resolvedKey === undefined)
- throw new RangeError('No resolution found.');
- return resolvedKey;
-}
-
-Loader.prototype.resolve = function (key, parent) {
- var loader = this;
- return resolvedPromise
- .then(function() {
- return loader[RESOLVE](key, parent);
- })
- .then(ensureResolution)
- .catch(function (err) {
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Resolving ' + key + (parent ? ' to ' + parent : ''));
- });
-};
-
-// 3.3.4 (import without evaluate)
-// this is not documented because the use of deferred evaluation as in Module.evaluate is not
-// documented, as it is not considered a stable feature to be encouraged
-// Loader.prototype.load may well be deprecated if this stays disabled
-/* Loader.prototype.load = function (key, parent) {
- return Promise.resolve(this[RESOLVE_INSTANTIATE](key, parent || this.key))
- .catch(function (err) {
- throw addToError(err, 'Loading ' + key + (parent ? ' from ' + parent : ''));
- });
-}; */
-
-/*
- * 4. Registry
- *
- * Instead of structuring through a Map, just use a dictionary object
- * We throw for construction attempts so this doesn't affect the public API
- *
- * Registry has been adjusted to use Namespace objects over ModuleStatus objects
- * as part of simplifying loader API implementation
- */
-var iteratorSupport = typeof Symbol !== 'undefined' && Symbol.iterator;
-var REGISTRY = createSymbol('registry');
-function Registry() {
- this[REGISTRY] = {};
-}
-// 4.4.1
-if (iteratorSupport) {
- // 4.4.2
- Registry.prototype[Symbol.iterator] = function () {
- return this.entries()[Symbol.iterator]();
- };
-
- // 4.4.3
- Registry.prototype.entries = function () {
- var registry = this[REGISTRY];
- return arrayValues(Object.keys(registry).map(function (key) {
- return [key, registry[key]];
- }));
- };
-}
-
-// 4.4.4
-Registry.prototype.keys = function () {
- return arrayValues(Object.keys(this[REGISTRY]));
-};
-// 4.4.5
-Registry.prototype.values = function () {
- var registry = this[REGISTRY];
- return arrayValues(Object.keys(registry).map(function (key) {
- return registry[key];
- }));
-};
-// 4.4.6
-Registry.prototype.get = function (key) {
- return this[REGISTRY][key];
-};
-// 4.4.7
-Registry.prototype.set = function (key, namespace) {
- if (!(namespace instanceof ModuleNamespace))
- throw new Error('Registry must be set with an instance of Module Namespace');
- this[REGISTRY][key] = namespace;
- return this;
-};
-// 4.4.8
-Registry.prototype.has = function (key) {
- return Object.hasOwnProperty.call(this[REGISTRY], key);
-};
-// 4.4.9
-Registry.prototype.delete = function (key) {
- if (Object.hasOwnProperty.call(this[REGISTRY], key)) {
- delete this[REGISTRY][key];
- return true;
- }
- return false;
-};
-
-/*
- * Simple ModuleNamespace Exotic object based on a baseObject
- * We export this for allowing a fast-path for module namespace creation over Module descriptors
- */
-// var EVALUATE = createSymbol('evaluate');
-var BASE_OBJECT = createSymbol('baseObject');
-
-// 8.3.1 Reflect.Module
-/*
- * Best-effort simplified non-spec implementation based on
- * a baseObject referenced via getters.
- *
- * Allows:
- *
- * loader.registry.set('x', new Module({ default: 'x' }));
- *
- * Optional evaluation function provides experimental Module.evaluate
- * support for non-executed modules in registry.
- */
-function ModuleNamespace (baseObject/*, evaluate*/) {
- Object.defineProperty(this, BASE_OBJECT, {
- value: baseObject
- });
-
- // evaluate defers namespace population
- /* if (evaluate) {
- Object.defineProperty(this, EVALUATE, {
- value: evaluate,
- configurable: true,
- writable: true
- });
- }
- else { */
- Object.keys(baseObject).forEach(extendNamespace, this);
- //}
-}
-// 8.4.2
-ModuleNamespace.prototype = Object.create(null);
-
-if (typeof Symbol !== 'undefined' && Symbol.toStringTag)
- Object.defineProperty(ModuleNamespace.prototype, Symbol.toStringTag, {
- value: 'Module'
- });
-
-function extendNamespace (key) {
- Object.defineProperty(this, key, {
- enumerable: true,
- get: function () {
- return this[BASE_OBJECT][key];
- }
- });
-}
-
-/* function doEvaluate (evaluate, context) {
- try {
- evaluate.call(context);
- }
- catch (e) {
- return e;
- }
-}
-
-// 8.4.1 Module.evaluate... not documented or used because this is potentially unstable
-Module.evaluate = function (ns) {
- var evaluate = ns[EVALUATE];
- if (evaluate) {
- ns[EVALUATE] = undefined;
- var err = doEvaluate(evaluate);
- if (err) {
- // cache the error
- ns[EVALUATE] = function () {
- throw err;
- };
- throw err;
- }
- Object.keys(ns[BASE_OBJECT]).forEach(extendNamespace, ns);
- }
- // make chainable
- return ns;
-}; */
-
-/*
- * Optimized URL normalization assuming a syntax-valid URL parent
- */
-function throwResolveError (relUrl, parentUrl) {
- throw new RangeError('Unable to resolve "' + relUrl + '" to ' + parentUrl);
-}
-function resolveIfNotPlain (relUrl, parentUrl) {
- relUrl = relUrl.trim();
- var parentProtocol = parentUrl && parentUrl.substr(0, parentUrl.indexOf(':') + 1);
-
- var firstChar = relUrl[0];
- var secondChar = relUrl[1];
-
- // protocol-relative
- if (firstChar === '/' && secondChar === '/') {
- if (!parentProtocol)
- throwResolveError(relUrl, parentUrl);
- return parentProtocol + relUrl;
- }
- // relative-url
- else if (firstChar === '.' && (secondChar === '/' || secondChar === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
- relUrl.length === 1 && (relUrl += '/')) ||
- firstChar === '/') {
- var parentIsPlain = !parentProtocol || parentUrl[parentProtocol.length] !== '/';
-
- // read pathname from parent if a URL
- // pathname taken to be part after leading "/"
- var pathname;
- if (parentIsPlain) {
- // resolving to a plain parent -> skip standard URL prefix, and treat entire parent as pathname
- if (parentUrl === undefined)
- throwResolveError(relUrl, parentUrl);
- pathname = parentUrl;
- }
- else if (parentUrl[parentProtocol.length + 1] === '/') {
- // resolving to a :// so we need to read out the auth and host
- if (parentProtocol !== 'file:') {
- pathname = parentUrl.substr(parentProtocol.length + 2);
- pathname = pathname.substr(pathname.indexOf('/') + 1);
- }
- else {
- pathname = parentUrl.substr(8);
- }
- }
- else {
- // resolving to :/ so pathname is the /... part
- pathname = parentUrl.substr(parentProtocol.length + 1);
- }
-
- if (firstChar === '/') {
- if (parentIsPlain)
- throwResolveError(relUrl, parentUrl);
- else
- return parentUrl.substr(0, parentUrl.length - pathname.length - 1) + relUrl;
- }
-
- // join together and split for removal of .. and . segments
- // looping the string instead of anything fancy for perf reasons
- // '../../../../../z' resolved to 'x/y' is just 'z' regardless of parentIsPlain
- var segmented = pathname.substr(0, pathname.lastIndexOf('/') + 1) + relUrl;
-
- var output = [];
- var segmentIndex = -1;
-
- for (var i = 0; i < segmented.length; i++) {
- // busy reading a segment - only terminate on '/'
- if (segmentIndex !== -1) {
- if (segmented[i] === '/') {
- output.push(segmented.substring(segmentIndex, i + 1));
- segmentIndex = -1;
- }
- continue;
- }
-
- // new segment - check if it is relative
- if (segmented[i] === '.') {
- // ../ segment
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
- output.pop();
- i += 2;
- }
- // ./ segment
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
- i += 1;
- }
- else {
- // the start of a new segment as below
- segmentIndex = i;
- continue;
- }
-
- // this is the plain URI backtracking error (../, package:x -> error)
- if (parentIsPlain && output.length === 0)
- throwResolveError(relUrl, parentUrl);
-
- continue;
- }
-
- // it is the start of a new segment
- segmentIndex = i;
- }
- // finish reading out the last segment
- if (segmentIndex !== -1)
- output.push(segmented.substr(segmentIndex));
-
- return parentUrl.substr(0, parentUrl.length - pathname.length) + output.join('');
- }
-
- // sanitizes and verifies (by returning undefined if not a valid URL-like form)
- // Windows filepath compatibility is an added convenience here
- var protocolIndex = relUrl.indexOf(':');
- if (protocolIndex !== -1) {
- if (isNode) {
- // C:\x becomes file:///c:/x (we don't support C|\x)
- if (relUrl[1] === ':' && relUrl[2] === '\\' && relUrl[0].match(/[a-z]/i))
- return 'file:///' + relUrl.replace(/\\/g, '/');
- }
- return relUrl;
- }
-}
-
-/*
- * Register Loader
- *
- * Builds directly on top of loader polyfill to provide:
- * - loader.register support
- * - hookable higher-level resolve
- * - instantiate hook returning a ModuleNamespace or undefined for es module loading
- * - loader error behaviour as in HTML and loader specs, caching load and eval errors separately
- * - build tracing support by providing a .trace=true and .loads object format
- */
-
-var REGISTER_INTERNAL = createSymbol('register-internal');
-
-function RegisterLoader$1 () {
- Loader.call(this);
-
- var registryDelete = this.registry.delete;
- this.registry.delete = function (key) {
- var deleted = registryDelete.call(this, key);
-
- // also delete from register registry if linked
- if (records.hasOwnProperty(key) && !records[key].linkRecord) {
- delete records[key];
- deleted = true;
- }
-
- return deleted;
- };
-
- var records = {};
-
- this[REGISTER_INTERNAL] = {
- // last anonymous System.register call
- lastRegister: undefined,
- // in-flight es module load records
- records: records
- };
-
- // tracing
- this.trace = false;
-}
-
-RegisterLoader$1.prototype = Object.create(Loader.prototype);
-RegisterLoader$1.prototype.constructor = RegisterLoader$1;
-
-var INSTANTIATE = RegisterLoader$1.instantiate = createSymbol('instantiate');
-
-// default normalize is the WhatWG style normalizer
-RegisterLoader$1.prototype[RegisterLoader$1.resolve = Loader.resolve] = function (key, parentKey) {
- return resolveIfNotPlain(key, parentKey || baseURI);
-};
-
-RegisterLoader$1.prototype[INSTANTIATE] = function (key, processAnonRegister) {};
-
-// once evaluated, the linkRecord is set to undefined leaving just the other load record properties
-// this allows tracking new binding listeners for es modules through importerSetters
-// for dynamic modules, the load record is removed entirely.
-function createLoadRecord (state, key, registration) {
- return state.records[key] = {
- key: key,
-
- // defined System.register cache
- registration: registration,
-
- // module namespace object
- module: undefined,
-
- // es-only
- // this sticks around so new module loads can listen to binding changes
- // for already-loaded modules by adding themselves to their importerSetters
- importerSetters: undefined,
-
- loadError: undefined,
- evalError: undefined,
-
- // in-flight linking record
- linkRecord: {
- // promise for instantiated
- instantiatePromise: undefined,
- dependencies: undefined,
- execute: undefined,
- executingRequire: false,
-
- // underlying module object bindings
- moduleObj: undefined,
-
- // es only, also indicates if es or not
- setters: undefined,
-
- // promise for instantiated dependencies (dependencyInstantiations populated)
- depsInstantiatePromise: undefined,
- // will be the array of dependency load record or a module namespace
- dependencyInstantiations: undefined,
-
- // NB optimization and way of ensuring module objects in setters
- // indicates setters which should run pre-execution of that dependency
- // setters is then just for completely executed module objects
- // alternatively we just pass the partially filled module objects as
- // arguments into the execute function
- // hoisted: undefined
- }
- };
-}
-
-RegisterLoader$1.prototype[Loader.resolveInstantiate] = function (key, parentKey) {
- var loader = this;
- var state = this[REGISTER_INTERNAL];
- var registry = this.registry[REGISTRY];
-
- return resolveInstantiate(loader, key, parentKey, registry, state)
- .then(function (instantiated) {
- if (instantiated instanceof ModuleNamespace)
- return instantiated;
-
- // resolveInstantiate always returns a load record with a link record and no module value
- var link = instantiated.linkRecord;
-
- // if already beaten to done, return
- if (!link) {
- if (instantiated.module)
- return instantiated.module;
- throw instantiated.evalError;
- }
-
- return deepInstantiateDeps(loader, instantiated, link, registry, state)
- .then(function () {
- return ensureEvaluate(loader, instantiated, link, registry, state, undefined);
- });
- });
-};
-
-function resolveInstantiate (loader, key, parentKey, registry, state) {
- // normalization shortpath for already-normalized key
- // could add a plain name filter, but doesn't yet seem necessary for perf
- var module = registry[key];
- if (module)
- return Promise.resolve(module);
-
- var load = state.records[key];
-
- // already linked but not in main registry is ignored
- if (load && !load.module) {
- if (load.loadError)
- return Promise.reject(load.loadError);
- return instantiate(loader, load, load.linkRecord, registry, state);
- }
-
- return loader.resolve(key, parentKey)
- .then(function (resolvedKey) {
- // main loader registry always takes preference
- module = registry[resolvedKey];
- if (module)
- return module;
-
- load = state.records[resolvedKey];
-
- // already has a module value but not already in the registry (load.module)
- // means it was removed by registry.delete, so we should
- // disgard the current load record creating a new one over it
- // but keep any existing registration
- if (!load || load.module)
- load = createLoadRecord(state, resolvedKey, load && load.registration);
-
- if (load.loadError)
- return Promise.reject(load.loadError);
-
- var link = load.linkRecord;
- if (!link)
- return load;
-
- return instantiate(loader, load, link, registry, state);
- });
-}
-
-function createProcessAnonRegister (loader, load, state) {
- return function () {
- var lastRegister = state.lastRegister;
-
- if (!lastRegister)
- return !!load.registration;
-
- state.lastRegister = undefined;
- load.registration = lastRegister;
-
- return true;
- };
-}
-
-function instantiate (loader, load, link, registry, state) {
- return link.instantiatePromise || (link.instantiatePromise =
- // if there is already an existing registration, skip running instantiate
- (load.registration ? Promise.resolve() : Promise.resolve().then(function () {
- state.lastRegister = undefined;
- return loader[INSTANTIATE](load.key, loader[INSTANTIATE].length > 1 && createProcessAnonRegister(loader, load, state));
- }))
- .then(function (instantiation) {
- // direct module return from instantiate -> we're done
- if (instantiation !== undefined) {
- if (!(instantiation instanceof ModuleNamespace))
- throw new TypeError('Instantiate did not return a valid Module object.');
-
- delete state.records[load.key];
- if (loader.trace)
- traceLoad(loader, load, link);
- return registry[load.key] = instantiation;
- }
-
- // run the cached loader.register declaration if there is one
- var registration = load.registration;
- // clear to allow new registrations for future loads (combined with registry delete)
- load.registration = undefined;
- if (!registration)
- throw new TypeError('Module instantiation did not call an anonymous or correctly named System.register.');
-
- link.dependencies = registration[0];
-
- load.importerSetters = [];
-
- link.moduleObj = {};
-
- // process System.registerDynamic declaration
- if (registration[2]) {
- link.moduleObj.default = link.moduleObj.__useDefault = {};
- link.executingRequire = registration[1];
- link.execute = registration[2];
- }
-
- // process System.register declaration
- else {
- registerDeclarative(loader, load, link, registration[1]);
- }
-
- return load;
- })
- .catch(function (err) {
- load.linkRecord = undefined;
- throw load.loadError = load.loadError || LoaderError__Check_error_message_for_loader_stack(err, 'Instantiating ' + load.key);
- }));
-}
-
-// like resolveInstantiate, but returning load records for linking
-function resolveInstantiateDep (loader, key, parentKey, registry, state, traceDepMap) {
- // normalization shortpaths for already-normalized key
- // DISABLED to prioritise consistent resolver calls
- // could add a plain name filter, but doesn't yet seem necessary for perf
- /* var load = state.records[key];
- var module = registry[key];
-
- if (module) {
- if (traceDepMap)
- traceDepMap[key] = key;
-
- // registry authority check in case module was deleted or replaced in main registry
- if (load && load.module && load.module === module)
- return load;
- else
- return module;
- }
-
- // already linked but not in main registry is ignored
- if (load && !load.module) {
- if (traceDepMap)
- traceDepMap[key] = key;
- return instantiate(loader, load, load.linkRecord, registry, state);
- } */
- return loader.resolve(key, parentKey)
- .then(function (resolvedKey) {
- if (traceDepMap)
- traceDepMap[key] = resolvedKey;
-
- // normalization shortpaths for already-normalized key
- var load = state.records[resolvedKey];
- var module = registry[resolvedKey];
-
- // main loader registry always takes preference
- if (module && (!load || load.module && module !== load.module))
- return module;
-
- if (load && load.loadError)
- throw load.loadError;
-
- // already has a module value but not already in the registry (load.module)
- // means it was removed by registry.delete, so we should
- // disgard the current load record creating a new one over it
- // but keep any existing registration
- if (!load || !module && load.module)
- load = createLoadRecord(state, resolvedKey, load && load.registration);
-
- var link = load.linkRecord;
- if (!link)
- return load;
-
- return instantiate(loader, load, link, registry, state);
- });
-}
-
-function traceLoad (loader, load, link) {
- loader.loads = loader.loads || {};
- loader.loads[load.key] = {
- key: load.key,
- deps: link.dependencies,
- dynamicDeps: [],
- depMap: link.depMap || {}
- };
-}
-
-/*
- * Convert a CJS module.exports into a valid object for new Module:
- *
- * new Module(getEsModule(module.exports))
- *
- * Sets the default value to the module, while also reading off named exports carefully.
- */
-function registerDeclarative (loader, load, link, declare) {
- var moduleObj = link.moduleObj;
- var importerSetters = load.importerSetters;
-
- var definedExports = false;
-
- // closure especially not based on link to allow link record disposal
- var declared = declare.call(envGlobal, function (name, value) {
- if (typeof name === 'object') {
- var changed = false;
- for (var p in name) {
- value = name[p];
- if (p !== '__useDefault' && (!(p in moduleObj) || moduleObj[p] !== value)) {
- changed = true;
- moduleObj[p] = value;
- }
- }
- if (changed === false)
- return value;
- }
- else {
- if ((definedExports || name in moduleObj) && moduleObj[name] === value)
- return value;
- moduleObj[name] = value;
- }
-
- for (var i = 0; i < importerSetters.length; i++)
- importerSetters[i](moduleObj);
-
- return value;
- }, new ContextualLoader(loader, load.key));
-
- link.setters = declared.setters;
- link.execute = declared.execute;
- if (declared.exports) {
- link.moduleObj = moduleObj = declared.exports;
- definedExports = true;
- }
-}
-
-function instantiateDeps (loader, load, link, registry, state) {
- if (link.depsInstantiatePromise)
- return link.depsInstantiatePromise;
-
- var depsInstantiatePromises = Array(link.dependencies.length);
-
- for (var i = 0; i < link.dependencies.length; i++)
- depsInstantiatePromises[i] = resolveInstantiateDep(loader, link.dependencies[i], load.key, registry, state, loader.trace && link.depMap || (link.depMap = {}));
-
- var depsInstantiatePromise = Promise.all(depsInstantiatePromises)
- .then(function (dependencyInstantiations) {
- link.dependencyInstantiations = dependencyInstantiations;
-
- // run setters to set up bindings to instantiated dependencies
- if (link.setters) {
- for (var i = 0; i < dependencyInstantiations.length; i++) {
- var setter = link.setters[i];
- if (setter) {
- var instantiation = dependencyInstantiations[i];
-
- if (instantiation instanceof ModuleNamespace) {
- setter(instantiation);
- }
- else {
- if (instantiation.loadError)
- throw instantiation.loadError;
- setter(instantiation.module || instantiation.linkRecord.moduleObj);
- // this applies to both es and dynamic registrations
- if (instantiation.importerSetters)
- instantiation.importerSetters.push(setter);
- }
- }
- }
- }
-
- return load;
- });
-
- if (loader.trace)
- depsInstantiatePromise = depsInstantiatePromise.then(function () {
- traceLoad(loader, load, link);
- return load;
- });
-
- depsInstantiatePromise = depsInstantiatePromise.catch(function (err) {
- // throw up the instantiateDeps stack
- link.depsInstantiatePromise = undefined;
- throw LoaderError__Check_error_message_for_loader_stack(err, 'Loading ' + load.key);
- });
-
- depsInstantiatePromise.catch(function () {});
-
- return link.depsInstantiatePromise = depsInstantiatePromise;
-}
-
-function deepInstantiateDeps (loader, load, link, registry, state) {
- return new Promise(function (resolve, reject) {
- var seen = [];
- var loadCnt = 0;
- function queueLoad (load) {
- var link = load.linkRecord;
- if (!link)
- return;
-
- if (seen.indexOf(load) !== -1)
- return;
- seen.push(load);
-
- loadCnt++;
- instantiateDeps(loader, load, link, registry, state)
- .then(processLoad, reject);
- }
- function processLoad (load) {
- loadCnt--;
- var link = load.linkRecord;
- if (link) {
- for (var i = 0; i < link.dependencies.length; i++) {
- var depLoad = link.dependencyInstantiations[i];
- if (!(depLoad instanceof ModuleNamespace))
- queueLoad(depLoad);
- }
- }
- if (loadCnt === 0)
- resolve();
- }
- queueLoad(load);
- });
-}
-
-/*
- * System.register
- */
-RegisterLoader$1.prototype.register = function (key, deps, declare) {
- var state = this[REGISTER_INTERNAL];
-
- // anonymous modules get stored as lastAnon
- if (declare === undefined) {
- state.lastRegister = [key, deps, undefined];
- }
-
- // everything else registers into the register cache
- else {
- var load = state.records[key] || createLoadRecord(state, key, undefined);
- load.registration = [deps, declare, undefined];
- }
-};
-
-/*
- * System.registerDyanmic
- */
-RegisterLoader$1.prototype.registerDynamic = function (key, deps, executingRequire, execute) {
- var state = this[REGISTER_INTERNAL];
-
- // anonymous modules get stored as lastAnon
- if (typeof key !== 'string') {
- state.lastRegister = [key, deps, executingRequire];
- }
-
- // everything else registers into the register cache
- else {
- var load = state.records[key] || createLoadRecord(state, key, undefined);
- load.registration = [deps, executingRequire, execute];
- }
-};
-
-// ContextualLoader class
-// backwards-compatible with previous System.register context argument by exposing .id, .key
-function ContextualLoader (loader, key) {
- this.loader = loader;
- this.key = this.id = key;
- this.meta = {
- url: key
- // scriptElement: null
- };
-}
-/*ContextualLoader.prototype.constructor = function () {
- throw new TypeError('Cannot subclass the contextual loader only Reflect.Loader.');
-};*/
-ContextualLoader.prototype.import = function (key) {
- if (this.loader.trace)
- this.loader.loads[this.key].dynamicDeps.push(key);
- return this.loader.import(key, this.key);
-};
-/*ContextualLoader.prototype.resolve = function (key) {
- return this.loader.resolve(key, this.key);
-};*/
-
-// this is the execution function bound to the Module namespace record
-function ensureEvaluate (loader, load, link, registry, state, seen) {
- if (load.module)
- return load.module;
-
- if (load.evalError)
- throw load.evalError;
-
- if (seen && seen.indexOf(load) !== -1)
- return load.linkRecord.moduleObj;
-
- // for ES loads we always run ensureEvaluate on top-level, so empty seen is passed regardless
- // for dynamic loads, we pass seen if also dynamic
- var err = doEvaluate(loader, load, link, registry, state, link.setters ? [] : seen || []);
- if (err)
- throw err;
-
- return load.module;
-}
-
-function makeDynamicRequire (loader, key, dependencies, dependencyInstantiations, registry, state, seen) {
- // we can only require from already-known dependencies
- return function (name) {
- for (var i = 0; i < dependencies.length; i++) {
- if (dependencies[i] === name) {
- var depLoad = dependencyInstantiations[i];
- var module;
-
- if (depLoad instanceof ModuleNamespace)
- module = depLoad;
- else
- module = ensureEvaluate(loader, depLoad, depLoad.linkRecord, registry, state, seen);
-
- return '__useDefault' in module ? module.__useDefault : module;
- }
- }
- throw new Error('Module ' + name + ' not declared as a System.registerDynamic dependency of ' + key);
- };
-}
-
-// ensures the given es load is evaluated
-// returns the error if any
-function doEvaluate (loader, load, link, registry, state, seen) {
- seen.push(load);
-
- var err;
-
- // es modules evaluate dependencies first
- // non es modules explicitly call moduleEvaluate through require
- if (link.setters) {
- var depLoad, depLink;
- for (var i = 0; i < link.dependencies.length; i++) {
- depLoad = link.dependencyInstantiations[i];
-
- if (depLoad instanceof ModuleNamespace)
- continue;
-
- // custom Module returned from instantiate
- depLink = depLoad.linkRecord;
- if (depLink && seen.indexOf(depLoad) === -1) {
- if (depLoad.evalError)
- err = depLoad.evalError;
- else
- // dynamic / declarative boundaries clear the "seen" list
- // we just let cross format circular throw as would happen in real implementations
- err = doEvaluate(loader, depLoad, depLink, registry, state, depLink.setters ? seen : []);
- }
-
- if (err) {
- load.linkRecord = undefined;
- load.evalError = LoaderError__Check_error_message_for_loader_stack(err, 'Evaluating ' + load.key);
- return load.evalError;
- }
- }
- }
-
- // link.execute won't exist for Module returns from instantiate on top-level load
- if (link.execute) {
- // ES System.register execute
- // "this" is null in ES
- if (link.setters) {
- err = declarativeExecute(link.execute);
- }
- // System.registerDynamic execute
- // "this" is "exports" in CJS
- else {
- var module = { id: load.key };
- var moduleObj = link.moduleObj;
- Object.defineProperty(module, 'exports', {
- configurable: true,
- set: function (exports) {
- moduleObj.default = moduleObj.__useDefault = exports;
- },
- get: function () {
- return moduleObj.__useDefault;
- }
- });
-
- var require = makeDynamicRequire(loader, load.key, link.dependencies, link.dependencyInstantiations, registry, state, seen);
-
- // evaluate deps first
- if (!link.executingRequire)
- for (var i = 0; i < link.dependencies.length; i++)
- require(link.dependencies[i]);
-
- err = dynamicExecute(link.execute, require, moduleObj.default, module);
-
- // pick up defineProperty calls to module.exports when we can
- if (module.exports !== moduleObj.__useDefault)
- moduleObj.default = moduleObj.__useDefault = module.exports;
-
- var moduleDefault = moduleObj.default;
-
- // __esModule flag extension support via lifting
- if (moduleDefault && moduleDefault.__esModule) {
- for (var p in moduleDefault) {
- if (Object.hasOwnProperty.call(moduleDefault, p))
- moduleObj[p] = moduleDefault[p];
- }
- }
- }
- }
-
- // dispose link record
- load.linkRecord = undefined;
-
- if (err)
- return load.evalError = LoaderError__Check_error_message_for_loader_stack(err, 'Evaluating ' + load.key);
-
- registry[load.key] = load.module = new ModuleNamespace(link.moduleObj);
-
- // if not an esm module, run importer setters and clear them
- // this allows dynamic modules to update themselves into es modules
- // as soon as execution has completed
- if (!link.setters) {
- if (load.importerSetters)
- for (var i = 0; i < load.importerSetters.length; i++)
- load.importerSetters[i](load.module);
- load.importerSetters = undefined;
- }
-}
-
-// {} is the closest we can get to call(undefined)
-var nullContext = {};
-if (Object.freeze)
- Object.freeze(nullContext);
-
-function declarativeExecute (execute) {
- try {
- execute.call(nullContext);
- }
- catch (e) {
- return e;
- }
-}
-
-function dynamicExecute (execute, require, exports, module) {
- try {
- var output = execute.call(envGlobal, require, exports, module);
- if (output !== undefined)
- module.exports = output;
- }
- catch (e) {
- return e;
- }
-}
-
-var loader;
-
-//
- -->
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
-
@@ -102,113 +77,101 @@
@@ -288,21 +269,25 @@
-