UNPKG

@substrate-system/mergeparty

Version:
8 lines (7 loc) 1.47 kB
{ "version": 3, "sources": ["../../src/server/polyfill.js"], "sourcesContent": ["// Polyfill for performance.now in PartyKit environment\n// Try multiple approaches to ensure the polyfill reaches the bundled code\n\n// Approach 1: globalThis\nif (typeof globalThis.performance === 'undefined') {\n globalThis.performance = { now: () => Date.now() }\n}\n\n// Approach 2: global (Node.js style)\nif (typeof global !== 'undefined' && typeof global.performance === 'undefined') {\n global.performance = { now: () => Date.now() }\n}\n\n// Approach 3: Direct property assignment\ntry {\n Object.defineProperty(globalThis, 'performance', {\n value: { now: () => Date.now() },\n writable: true,\n configurable: true\n })\n} catch (_e) {\n // Ignore if already defined\n}\n\n// Approach 4: Try to override any existing partial performance object\nif (globalThis.performance && !globalThis.performance.now) {\n globalThis.performance.now = () => Date.now()\n}\n"], "mappings": ";;;AAIA,IAAI,OAAO,WAAW,gBAAgB,aAAa;AAC/C,aAAW,cAAc,EAAE,KAAK,6BAAM,KAAK,IAAI,GAAf,OAAiB;AACrD;AAGA,IAAI,OAAO,WAAW,eAAe,OAAO,OAAO,gBAAgB,aAAa;AAC5E,SAAO,cAAc,EAAE,KAAK,6BAAM,KAAK,IAAI,GAAf,OAAiB;AACjD;AAGA,IAAI;AACA,SAAO,eAAe,YAAY,eAAe;AAAA,IAC7C,OAAO,EAAE,KAAK,6BAAM,KAAK,IAAI,GAAf,OAAiB;AAAA,IAC/B,UAAU;AAAA,IACV,cAAc;AAAA,EAClB,CAAC;AACL,SAAS,IAAI;AAEb;AAGA,IAAI,WAAW,eAAe,CAAC,WAAW,YAAY,KAAK;AACvD,aAAW,YAAY,MAAM,MAAM,KAAK,IAAI;AAChD;", "names": [] }