All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.prod.CustomElementsRegistry.js.map Maven / Gradle / Ivy

{
  "version": 3,
  "sources": ["../../src/CustomElementsRegistry.ts"],
  "sourcesContent": ["import getSharedResource from \"./getSharedResource.js\";\nimport { getCurrentRuntimeIndex, compareRuntimes, getAllRuntimes } from \"./Runtimes.js\";\nimport type { Timeout } from \"./types.js\";\n\nconst Tags = getSharedResource>(\"Tags\", new Map());\nconst Definitions = new Set();\n\nlet Failures = new Map>();\nlet failureTimeout: Timeout | undefined;\n\nconst UNKNOWN_RUNTIME = -1;\n\nconst registerTag = (tag: string) => {\n\tDefinitions.add(tag);\n\tTags.set(tag, getCurrentRuntimeIndex());\n};\n\nconst isTagRegistered = (tag: string) => {\n\treturn Definitions.has(tag);\n};\n\nconst getAllRegisteredTags = () => {\n\treturn [...Definitions.values()];\n};\n\nconst recordTagRegistrationFailure = (tag: string) => {\n\tlet tagRegRuntimeIndex = Tags.get(tag);\n\tif (tagRegRuntimeIndex === undefined) {\n\t\ttagRegRuntimeIndex = UNKNOWN_RUNTIME; // If the tag is taken, but not registered in Tags, then a version before 1.1.0 defined it => use the \"unknown\" key\n\t}\n\n\tif (!Failures.has(tagRegRuntimeIndex)) {\n\t\tFailures.set(tagRegRuntimeIndex, new Set());\n\t}\n\tFailures.get(tagRegRuntimeIndex)!.add(tag);\n\n\tif (!failureTimeout) {\n\t\tfailureTimeout = setTimeout(() => {\n\t\t\tdisplayFailedRegistrations();\n\t\t\tFailures = new Map();\n\t\t\tfailureTimeout = undefined;\n\t\t}, 1000);\n\t}\n};\n\nconst displayFailedRegistrations = () => {\n\tconst allRuntimes = getAllRuntimes();\n\tconst currentRuntimeIndex = getCurrentRuntimeIndex();\n\tconst currentRuntime = allRuntimes[currentRuntimeIndex];\n\n\tlet message = `Multiple UI5 Web Components instances detected.`;\n\n\tif (allRuntimes.length > 1) {\n\t\tmessage = `${message}\\nLoading order (versions before 1.1.0 not listed): ${allRuntimes.map(runtime => `\\n${runtime.description}`).join(\"\")}`;\n\t}\n\n\t[...Failures.keys()].forEach(otherRuntimeIndex => {\n\t\tlet comparison: number;\n\t\tlet otherRuntime;\n\n\t\tif (otherRuntimeIndex === UNKNOWN_RUNTIME) { // version < 1.1.0 defined the tag\n\t\t\tcomparison = 1; // the current runtime is considered newer\n\t\t\totherRuntime = {\n\t\t\t\tdescription: `Older unknown runtime`,\n\t\t\t};\n\t\t} else {\n\t\t\tcomparison = compareRuntimes(currentRuntimeIndex, otherRuntimeIndex);\n\t\t\totherRuntime = allRuntimes[otherRuntimeIndex];\n\t\t}\n\n\t\tlet compareWord;\n\t\tif (comparison > 0) {\n\t\t\tcompareWord = \"an older\";\n\t\t} else if (comparison < 0) {\n\t\t\tcompareWord = \"a newer\";\n\t\t} else {\n\t\t\tcompareWord = \"the same\";\n\t\t}\n\t\tmessage = `${message}\\n\\n\"${currentRuntime.description}\" failed to define ${Failures.get(otherRuntimeIndex)!.size} tag(s) as they were defined by a runtime of ${compareWord} version \"${otherRuntime.description}\": ${([...Failures.get(otherRuntimeIndex)!]).sort().join(\", \")}.`;\n\n\t\tif (comparison > 0) {\n\t\t\tmessage = `${message}\\nWARNING! If your code uses features of the above web components, unavailable in ${otherRuntime.description}, it might not work as expected!`;\n\t\t} else {\n\t\t\tmessage = `${message}\\nSince the above web components were defined by the same or newer version runtime, they should be compatible with your code.`;\n\t\t}\n\t});\n\n\tmessage = `${message}\\n\\nTo prevent other runtimes from defining tags that you use, consider using scoping or have third-party libraries use scoping: https://github.com/SAP/ui5-webcomponents/blob/main/docs/2-advanced/03-scoping.md.`;\n\n\tconsole.warn(message); // eslint-disable-line\n};\n\nexport {\n\tregisterTag,\n\tisTagRegistered,\n\tgetAllRegisteredTags,\n\trecordTagRegistrationFailure,\n};\n"],
  "mappings": "aAAA,OAAOA,MAAuB,yBAC9B,OAAS,0BAAAC,EAAwB,mBAAAC,EAAiB,kBAAAC,MAAsB,gBAGxE,MAAMC,EAAOJ,EAAuC,O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,CAAiB,EAAG,IAAI,gDAAgDG,CAAW,aAAaD,EAAa,WAAW,MAAO,CAAC,GAAGjB,EAAS,IAAIe,CAAiB,CAAE,EAAG,KAAK,EAAE,KAAK,IAAI,CAAC,IAE5QC,EAAa,EAChBH,EAAU,GAAGA,CAAO;AAAA,kFAAqFI,EAAa,WAAW,mCAEjIJ,EAAU,GAAGA,CAAO;AAAA,4HAEtB,CAAC,EAEDA,EAAU,GAAGA,CAAO;AAAA;AAAA,gNAEpB,QAAQ,KAAKA,CAAO,CACrB,EAEA,OACCV,KAAA,YACAE,KAAA,gBACAC,KAAA,qBACAC,KAAA",
  "names": ["getSharedResource", "getCurrentRuntimeIndex", "compareRuntimes", "getAllRuntimes", "Tags", "Definitions", "Failures", "failureTimeout", "UNKNOWN_RUNTIME", "registerTag", "tag", "isTagRegistered", "getAllRegisteredTags", "recordTagRegistrationFailure", "tagRegRuntimeIndex", "displayFailedRegistrations", "allRuntimes", "currentRuntimeIndex", "currentRuntime", "message", "runtime", "otherRuntimeIndex", "comparison", "otherRuntime", "compareWord"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy