1 line
2.6 KiB
Plaintext
1 line
2.6 KiB
Plaintext
{"version":3,"file":"deprecation.mjs","sources":["../../src/logging/deprecation.ts"],"sourcesContent":["import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict<boolean> = {};\n\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n"],"names":[],"mappings":"AAGA,MAAM,WAA0B,CAAA;AAazB,SAAS,YAAY,SAAiB,SAAiB,cAAc,GAC5E;AAEI,MAAI,SAAS,OAAO;AAEhB;AAIA,MAAA,QAAQ,IAAI,MAAQ,EAAA;AAGpB,SAAO,QAAU,MAEjB,QAAQ,KAAK,gCAAgC,GAAG,OAAO;AAAA,oBAAuB,OAAO,EAAE,KAKvF,QAAQ,MAAM,MAAM;AAAA,CAAI,EAAE,OAAO,WAAW,EAAE,KAAK;AAAA,CAAI,GAEnD,QAAQ,kBAER,QAAQ;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG,OAAO;AAAA,oBAAuB,OAAO;AAAA,EAE5C,GAAA,QAAQ,KAAK,KAAK,GAClB,QAAQ,eAIR,QAAQ,KAAK,gCAAgC,GAAG,OAAO;AAAA,oBAAuB,OAAO,EAAE,GACvF,QAAQ,KAAK,KAAK,KAK1B,SAAS,OAAO,IAAI;AACxB;"} |