1 line
6.8 KiB
JSON
1 line
6.8 KiB
JSON
|
{"ast":null,"code":"import * as React from 'react';\nimport rcWarning, { resetWarned as rcResetWarned } from \"rc-util/es/warning\";\nexport function noop() {}\nlet deprecatedWarnList = null;\nexport function resetWarned() {\n deprecatedWarnList = null;\n rcResetWarned();\n}\n// eslint-disable-next-line import/no-mutable-exports\nlet warning = noop;\nif (process.env.NODE_ENV !== 'production') {\n warning = (valid, component, message) => {\n rcWarning(valid, `[antd: ${component}] ${message}`);\n // StrictMode will inject console which will not throw warning in React 17.\n if (process.env.NODE_ENV === 'test') {\n resetWarned();\n }\n };\n}\nexport const WarningContext = /*#__PURE__*/React.createContext({});\n/**\n * This is a hook but we not named as `useWarning`\n * since this is only used in development.\n * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition\n */\nexport const devUseWarning = process.env.NODE_ENV !== 'production' ? component => {\n const {\n strict\n } = React.useContext(WarningContext);\n const typeWarning = (valid, type, message) => {\n if (!valid) {\n if (strict === false && type === 'deprecated') {\n const existWarning = deprecatedWarnList;\n if (!deprecatedWarnList) {\n deprecatedWarnList = {};\n }\n deprecatedWarnList[component] = deprecatedWarnList[component] || [];\n if (!deprecatedWarnList[component].includes(message || '')) {\n deprecatedWarnList[component].push(message || '');\n }\n // Warning for the first time\n if (!existWarning) {\n // eslint-disable-next-line no-console\n console.warn('[antd] There exists deprecated usage in your code:', deprecatedWarnList);\n }\n } else {\n process.env.NODE_ENV !== \"production\" ? warning(valid, component, message) : void 0;\n }\n }\n };\n typeWarning.deprecated = (valid, oldProp, newProp, message) => {\n typeWarning(valid, 'deprecated', `\\`${oldProp}\\` is deprecated. Please use \\`${newProp}\\` instead.${message ? ` ${message}` : ''}`);\n };\n return typeWarning;\n} : () => {\n const noopWarning = () => {};\n noopWarning.deprecated = noop;\n return noopWarning;\n};\nexport default warning;","map":{"version":3,"names":["React","rcWarning","resetWarned","rcResetWarned","noop","deprecatedWarnList","warning","process","env","NODE_ENV","valid","component","message","WarningContext","createContext","devUseWarning","strict","useContext","typeWarning","type","existWarning","includes","push","console","warn","deprecated","oldProp","newProp","noopWarning"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/_util/warning.js"],"sourcesContent":["import * as React from 'react';\nimport rcWarning, { resetWarned as rcResetWarned } from \"rc-util/es/warning\";\nexport function noop() {}\nlet deprecatedWarnList = null;\nexport function resetWarned() {\n deprecatedWarnList = null;\n rcResetWarned();\n}\n// eslint-disable-next-line import/no-mutable-exports\nlet warning = noop;\nif (process.env.NODE_ENV !== 'production') {\n warning = (valid, component, message) => {\n rcWarning(valid, `[antd: ${component}] ${message}`);\n // StrictMode will inject console which will not throw warning in React 17.\n if (process.env.NODE_ENV === 'test') {\n resetWarned();\n }\n };\n}\nexport const WarningContext = /*#__PURE__*/React.createContext({});\n/**\n * This is a hook but we not named as `useWarning`\n * since this is only used in development.\n * We should always wrap this in `if (process.env.NODE_ENV !== 'production')` condition\n */\nexport const devUseWarning = process.env.NODE_ENV !== 'production' ? component => {\n const {\n strict\n } = React.useContext(WarningContext);\n const typeWarning = (valid, type, message) => {\n if (!valid) {\n if (strict === false && type === 'deprecated') {\n const existWarning = deprecatedWarnList;\n if (!deprecatedWarnList) {\n deprecatedWarnList = {};\n
|