{"version":3,"file":"module-cjs.cjs","sourceRoot":"","sources":["../../../src/shared/module-cjs.cts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AASlC,sDAQC;AAMD,0BAEC;AAOD,gDAUC;AAxCD,kEAAkE;AAClE,sFAAsF;AACtF,sEAAsE;AAEtE;;GAEG;AACH,SAAgB,qBAAqB;IACnC,IAAI,CAAC;QACH,iEAAiE;QACjE,OAAO,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,yEAAyE;QACzE,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,OAAO;IACrB,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB;IAChC,IAAI,CAAC;QACH,4DAA4D;QAC5D,iEAAiE;QACjE,MAAM,EAAE,aAAa,EAAE,GAA8B,OAAO,CAAC,UAAU,CAAC,CAAC;QACzE,OAAO,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,yBAAyB;QACzB,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// Provides CommonJS-specific implementation for various functions\n// As per https://github.com/isaacs/tshy?tab=readme-ov-file#commonjs-dialect-polyfills\n// Encapsulating the ESM / CommonJS specific implementation as needed.\n\n/**\n * A CommonJS module loader for Azure Function Core.\n */\nexport function loadAzureFunctionCore(): ReturnType<typeof require> {\n  try {\n    // eslint-disable-next-line @typescript-eslint/no-require-imports\n    return require(\"@azure/functions-core\");\n  } catch (e) {\n    // Module not found, this is expected in non-Azure Functions environments\n    return undefined;\n  }\n}\n\n/**\n * A polyfill for __dirname in CommonJS\n * @returns The directory name of the current module.\n */\nexport function dirName(): string {\n  return __dirname;\n}\n\n/**\n * Returns a file URL for the current module for loader registration scenarios.\n * Used by the instrumentation loader to register Node.js module hooks.\n * @internal\n */\nexport function getModuleParentURL(): string | undefined {\n  try {\n    // Convert __filename to a file URL for consistency with ESM\n    // eslint-disable-next-line @typescript-eslint/no-require-imports\n    const { pathToFileURL }: typeof import(\"node:url\") = require(\"node:url\");\n    return pathToFileURL(__filename).href;\n  } catch {\n    // node:url not available\n    return undefined;\n  }\n}\n"]}