2020-12-19 21:53:45 +00:00
|
|
|
{"version":3,"file":"s.min.js","sources":["../src/err-msg.js","../src/common.js","../src/system-core.js","../src/features/import-maps.js","../src/features/script-load.js","../src/features/fetch-load.js","../src/features/resolve.js","../src/features/depcache.js","../src/features/worker-load.js"],"sourcesContent":["export function errMsg(errCode, msg) {\n if (process.env.SYSTEM_PRODUCTION)\n return (msg || \"\") + \" (SystemJS https://git.io/JvFET#\" + errCode + \")\";\n else\n return (msg || \"\") + \" (SystemJS Error#\" + errCode + \" \" + \"https://git.io/JvFET#\" + errCode + \")\";\n}","import { errMsg } from './err-msg.js';\n\nexport var hasSymbol = typeof Symbol !== 'undefined';\nexport var hasSelf = typeof self !== 'undefined';\nexport var hasDocument = typeof document !== 'undefined';\n\nvar envGlobal = hasSelf ? self : global;\nexport { envGlobal as global };\n\n// Loader-scoped baseUrl and import map supported in Node.js only\nexport var BASE_URL = hasSymbol ? Symbol() : '_';\nexport var IMPORT_MAP = hasSymbol ? Symbol() : '#';\n\nexport var baseUrl;\n\nif (hasDocument) {\n var baseEl = document.querySelector('base[href]');\n if (baseEl)\n baseUrl = baseEl.href;\n}\n\nif (!baseUrl && typeof location !== 'undefined') {\n baseUrl = location.href.split('#')[0].split('?')[0];\n var lastSepIndex = baseUrl.lastIndexOf('/');\n if (lastSepIndex !== -1)\n baseUrl = baseUrl.slice(0, lastSepIndex + 1);\n}\n\nif (!process.env.SYSTEM_BROWSER && !baseUrl && typeof process !== 'undefined') {\n var cwd = process.cwd();\n // TODO: encoding edge cases\n baseUrl = 'file://' + (cwd[0] === '/' ? '' : '/') + cwd.replace(/\\\\/g, '/') + '/';\n}\n\nvar backslashRegEx = /\\\\/g;\nexport function resolveIfNotPlainOrUrl (relUrl, parentUrl) {\n if (relUrl.indexOf('\\\\') !== -1)\n relUrl = relUrl.replace(backslashRegEx, '/');\n // protocol-relative\n if (relUrl[0] === '/' && relUrl[1] === '/') {\n return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;\n }\n // relative-url\n else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||\n relUrl.length === 1 && (relUrl += '/')) ||\n relUrl[0] === '/') {\n var parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);\n // Disabled, but these cases will give inconsistent results for deep backtracking\n //if (parentUrl[parentProtocol.length] !== '/')\n // throw Error('Cannot resolve');\n // read pathname from parent URL\n // pathname taken to be part after leading \"/\"\n var pathname;\n if (parentUrl[parentProtocol.length + 1] === '/') {\n // resolving to a :// so we need to read out the auth and host\n if (parentProtocol !== 'file:') {\n pathname = parentUrl.slice(parentProtocol.length + 2);\n pathname = pathname.slice(pathname.indexOf('/') + 1);\n }\n else {\n pathname = parentUrl.slice(8);\n }\n }\n else {\n // resolving to :/ so pathname is the /... part\n pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));\n }\n\n if (relUrl[0] === '/')\n return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;\n\n // join together and split for removal of .. and . segments\n // looping the string instead of anything fancy for perf reasons\n // '../../../../../z' resolved to 'x/y' is just 'z'\n var segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;\n\n var output = [];\n var segmentIndex = -1;\n for (var i = 0; i < segmented.length; i++) {\n // busy reading a segment - only terminate on '/'\n if (segmentIndex !== -1) {\n if (segmented[i] === '/') {\n output.push(segmented.slice(segmentIndex, i + 1));\n segmentIndex = -1;\n }\n }\n\n // new segment - check if it is relative\n else if (segmented[i] === '.') {\n // ../ segment\n if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmen
|