1 line
1.6 KiB
Plaintext
1 line
1.6 KiB
Plaintext
{"version":3,"file":"diagnostics-channel-esm.mjs","sourceRoot":"","sources":["../../src/diagnostics-channel-esm.mts"],"names":[],"mappings":"AASA;;;;;GAKG;AAEH,uEAAuE;AACvE,4EAA4E;AAC5E,oBAAoB;AACpB,MAAM,KAAK,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,CAAA;AACvC,MAAM,CAAC,IAAI,OAAO,GAAG,KAAyB,CAAA;AAC9C,MAAM,CAAC,IAAI,OAAO,GAAG,KAAgC,CAAA;AACrD,MAAM,CAAC,0BAA0B,CAAC;KAC/B,IAAI,CAAC,EAAE,CAAC,EAAE;IACT,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACzC,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;AAC1C,CAAC,CAAC;KACD,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA","sourcesContent":["// this is used in ESM environments that do not follow the 'node' import\n// condition. So, `node:diagnostics_channel` MAY be present, but might not.\n// Eg: browsers, webpack, react-native, etc.\nimport {\n type Channel,\n type TracingChannel,\n} from 'node:diagnostics_channel'\nexport type { TracingChannel, Channel }\n\n/**\n * no-op polyfills for non-node environments. tries to load the actual\n * diagnostics_channel module on platforms that support it, but fails\n * gracefully if not found. This means that the first tick of metrics\n * and tracing will be missed, but that probably doesn't matter much.\n */\n\n// conditionally import from diagnostic_channel, fall back to dummyfill\n// all we actually have to mock is the hasSubscribers, since we always check\n/* v8 ignore next */\nconst dummy = { hasSubscribers: false }\nexport let metrics = dummy as Channel<unknown>\nexport let tracing = dummy as TracingChannel<unknown>\nimport('node:diagnostics_channel')\n .then(dc => {\n metrics = dc.channel('lru-cache:metrics')\n tracing = dc.tracingChannel('lru-cache')\n })\n .catch(() => {})\n"]} |