Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
{"version":3,"file":"Runtimes.js","sourceRoot":"","sources":["../src/Runtimes.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAOvD,IAAI,mBAA2B,CAAC;AAChC,IAAI,mBAAmB,GAAG,EAAE,CAAC;AAE7B,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,QAAQ,GAAG,iBAAiB,CAAqB,UAAU,EAAE,EAAE,CAAC,CAAC;AAEvE;;GAEG;AACH,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACnC,IAAI,mBAAmB,KAAK,SAAS,EAAE;QACtC,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC;QACtC,MAAM,WAAW,GAAG,WAAW,CAAC;QAEhC,QAAQ,CAAC,IAAI,CAAC;YACb,GAAG,WAAW;YACd,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,WAAW,mBAAmB,UAAU,WAAW,CAAC,OAAO,GAAG,mBAAmB,CAAC,CAAC,CAAC,KAAK,mBAAmB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;SACnI,CAAC,CAAC;KACH;AACF,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,sBAAsB,GAAG,GAAG,EAAE;IACnC,OAAO,mBAAmB,CAAC;AAC5B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAAC,MAAc,EAAE,MAAc,EAAE,EAAE;IAC1D,MAAM,UAAU,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;IACzC,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QACjC,OAAO,YAAY,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;KACrC;IAED,MAAM,QAAQ,GAAG,QAAQ,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,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,GAAG,EAAE;IAC3B,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EACN,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,cAAc,GACd,CAAC","sourcesContent":["import VersionInfo from \"./generated/VersionInfo.js\";\nimport getSharedResource from \"./getSharedResource.js\";\n\ntype RuntimeData = VersionInfo & {\n\talias: string,\n\tdescription: string,\n};\n\nlet currentRuntimeIndex: number;\nlet currentRuntimeAlias = \"\";\n\nconst compareCache = new Map();\n\n/**\n * Central registry where all runtimes register themselves by pushing an object.\n * The index in the registry servers as an ID for the runtime.\n * @type {*}\n */\nconst Runtimes = getSharedResource>(\"Runtimes\", []);\n\n/**\n * Registers the current runtime in the shared runtimes resource registry\n */\nconst registerCurrentRuntime = () => {\n\tif (currentRuntimeIndex === undefined) {\n\t\tcurrentRuntimeIndex = Runtimes.length;\n\t\tconst versionInfo = VersionInfo;\n\n\t\tRuntimes.push({\n\t\t\t...versionInfo,\n\t\t\talias: currentRuntimeAlias,\n\t\t\tdescription: `Runtime ${currentRuntimeIndex} - ver ${versionInfo.version}${currentRuntimeAlias ? ` (${currentRuntimeAlias})` : \"\"}`,\n\t\t});\n\t}\n};\n\n/**\n * Returns the index of the current runtime's object in the shared runtimes resource registry\n * @returns {*}\n */\nconst getCurrentRuntimeIndex = () => {\n\treturn currentRuntimeIndex;\n};\n\n/**\n * Compares two runtimes and returns 1 if the first is of a bigger version, -1 if the second is of a bigger version, and 0 if equal\n * @param index1 The index of the first runtime to compare\n * @param index2 The index of the second runtime to compare\n * @returns {number}\n */\nconst compareRuntimes = (index1: number, index2: number) => {\n\tconst cacheIndex = `${index1},${index2}`;\n\tif (compareCache.has(cacheIndex)) {\n\t\treturn compareCache.get(cacheIndex)!;\n\t}\n\n\tconst runtime1 = Runtimes[index1];\n\tconst runtime2 = Runtimes[index2];\n\n\tif (!runtime1 || !runtime2) {\n\t\tthrow new Error(\"Invalid runtime index supplied\");\n\t}\n\n\t// If any of the two is a next version, bigger buildTime wins\n\tif (runtime1.isNext || runtime2.isNext) {\n\t\treturn runtime1.buildTime - runtime2.buildTime;\n\t}\n\n\t// If major versions differ, bigger one wins\n\tconst majorDiff = runtime1.major - runtime2.major;\n\tif (majorDiff) {\n\t\treturn majorDiff;\n\t}\n\n\t// If minor versions differ, bigger one wins\n\tconst minorDiff = runtime1.minor - runtime2.minor;\n\tif (minorDiff) {\n\t\treturn minorDiff;\n\t}\n\n\t// If patch versions differ, bigger one wins\n\tconst patchDiff = runtime1.patch - runtime2.patch;\n\tif (patchDiff) {\n\t\treturn patchDiff;\n\t}\n\n\t// Bigger suffix wins, f.e. rc10 > rc9\n\t// Important: suffix is alphanumeric, must use natural compare\n\tconst collator = new Intl.Collator(undefined, { numeric: true, sensitivity: \"base\" });\n\tconst result = collator.compare(runtime1.suffix, runtime2.suffix);\n\n\tcompareCache.set(cacheIndex, result);\n\treturn result;\n};\n\n/**\n * Set an alias for the the current app/library/microfrontend which will appear in debug messages and console warnings\n * @param alias\n */\nconst setRuntimeAlias = (alias: string) => {\n\tcurrentRuntimeAlias = alias;\n};\n\nconst getAllRuntimes = () => {\n\treturn Runtimes;\n};\n\nexport {\n\tgetCurrentRuntimeIndex,\n\tregisterCurrentRuntime,\n\tcompareRuntimes,\n\tsetRuntimeAlias,\n\tgetAllRuntimes,\n};\n"]}