function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
(function () {
'use strict';
function errMsg(errCode, msg) {
return (msg || "") + " (SystemJS Error#" + errCode + " " + "https://git.io/JvFET#" + errCode + ")";
}
var hasSymbol = typeof Symbol !== 'undefined';
var hasSelf = typeof self !== 'undefined';
var hasDocument = typeof document !== 'undefined';
var envGlobal = hasSelf ? self : global;
var baseUrl;
if (hasDocument) {
var baseEl = document.querySelector('base[href]');
if (baseEl) baseUrl = baseEl.href;
}
if (!baseUrl && typeof location !== 'undefined') {
baseUrl = location.href.split('#')[0].split('?')[0];
var lastSepIndex = baseUrl.lastIndexOf('/');
if (lastSepIndex !== -1) baseUrl = baseUrl.slice(0, lastSepIndex + 1);
}
var backslashRegEx = /\\/g;
function resolveIfNotPlainOrUrl(relUrl, parentUrl) {
if (relUrl.indexOf('\\') !== -1) relUrl = relUrl.replace(backslashRegEx, '/'); // protocol-relative
if (relUrl[0] === '/' && relUrl[1] === '/') {
return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
} // relative-url
else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) || relUrl.length === 1 && (relUrl += '/')) || relUrl[0] === '/') {
var parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1); // Disabled, but these cases will give inconsistent results for deep backtracking
//if (parentUrl[parentProtocol.length] !== '/')
// throw Error('Cannot resolve');
// read pathname from parent URL
// pathname taken to be part after leading "/"
var pathname;
if (parentUrl[parentProtocol.length + 1] === '/') {
// resolving to a :// so we need to read out the auth and host
if (parentProtocol !== 'file:') {
pathname = parentUrl.slice(parentProtocol.length + 2);
pathname = pathname.slice(pathname.indexOf('/') + 1);
} else {
pathname = parentUrl.slice(8);
}
} else {
// resolving to :/ so pathname is the /... part
pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
}
if (relUrl[0] === '/') return parentUrl.slice(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'
var segmented = pathname.slice(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.slice(segmentIndex, i + 1));
segmentIndex = -1;
}
} // new segment - check if it is relative
else 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;
}
} // it is the start of a new segment
else {
segmentIndex = i;
}
} // finish reading out the last segment
if (segmentIndex !== -1) output.push(segmented.slice(segmentIndex));
return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
}
}
/*
* Import maps implementation
*
* To make lookups fast we pre-resolve the entire import map
* and then match based on backtracked hash lookups
*
*/
function resolveUrl(relUrl, parentUrl) {
return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
}
function resolveAndComposePackages(packages, outPackages, baseUrl, parentMap, parentUrl) {
for (var p in packages) {
var resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
var rhs = packages[p]; // package fallbacks not currently supported
if (typeof rhs !== 'string') continue;
var mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(rhs, baseUrl) || rhs, parentUrl);
if (!mapped) {
targetWarning('W1', p, rhs, 'bare specifier did not resolve');
} else outPackages[resolvedLhs] = mapped;
}
}
function
评论0