{"version":3,"names":["warnings","Set","deprecationWarning","oldName","newName","prefix","has","add","internal","trace","captureShortStackTrace","console","warn","skip","length","stackTraceLimit","prepareStackTrace","Error","stackTrace","err","stack","shortStackTrace","slice","test","getFileName","map","frame","join"],"sources":["../../src/utils/deprecationWarning.ts"],"sourcesContent":["const warnings = new Set();\n\nexport default function deprecationWarning(\n oldName: string,\n newName: string,\n prefix: string = \"\",\n) {\n if (warnings.has(oldName)) return;\n warnings.add(oldName);\n\n const { internal, trace } = captureShortStackTrace(1, 2);\n if (internal) {\n // If usage comes from an internal package, there is no point in warning because\n // 1. The new version of the package will already use the new API\n // 2. When the deprecation will become an error (in a future major version), users\n // will have to update every package anyway.\n return;\n }\n console.warn(\n `${prefix}\\`${oldName}\\` has been deprecated, please migrate to \\`${newName}\\`\\n${trace}`,\n );\n}\n\nfunction captureShortStackTrace(skip: number, length: number) {\n const { stackTraceLimit, prepareStackTrace } = Error;\n let stackTrace: NodeJS.CallSite[];\n // We add 1 to also take into account this function.\n Error.stackTraceLimit = 1 + skip + length;\n Error.prepareStackTrace = function (err, stack) {\n stackTrace = stack;\n };\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n new Error().stack;\n Error.stackTraceLimit = stackTraceLimit;\n Error.prepareStackTrace = prepareStackTrace;\n\n if (!stackTrace) return { internal: false, trace: \"\" };\n\n const shortStackTrace = stackTrace.slice(1 + skip, 1 + skip + length);\n return {\n internal: /[\\\\/]@babel[\\\\/]/.test(shortStackTrace[1].getFileName()),\n trace: shortStackTrace.map(frame => ` at ${frame}`).join(\"\\n\"),\n };\n}\n"],"mappings":";;;;;;AAAA,MAAMA,QAAQ,GAAG,IAAIC,GAAG,CAAC,CAAC;AAEX,SAASC,kBAAkBA,CACxCC,OAAe,EACfC,OAAe,EACfC,MAAc,GAAG,EAAE,EACnB;EACA,IAAIL,QAAQ,CAACM,GAAG,CAACH,OAAO,CAAC,EAAE;EAC3BH,QAAQ,CAACO,GAAG,CAACJ,OAAO,CAAC;EA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