{"version":3,"file":"debug.js","sources":["../src/check-props.js","../src/component-stack.js","../src/debug.js","../src/constants.js","../src/util.js"],"sourcesContent":["const ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\r\n\r\nlet loggedTypeFailures = {};\r\n\r\n/**\r\n * Reset the history of which prop type warnings have been logged.\r\n */\r\nexport function resetPropWarnings() {\r\n\tloggedTypeFailures = {};\r\n}\r\n\r\n/**\r\n * Assert that the values match with the type specs.\r\n * Error messages are memorized and will only be shown once.\r\n *\r\n * Adapted from https://github.com/facebook/prop-types/blob/master/checkPropTypes.js\r\n *\r\n * @param {object} typeSpecs Map of name to a ReactPropType\r\n * @param {object} values Runtime values that need to be type-checked\r\n * @param {string} location e.g. \"prop\", \"context\", \"child context\"\r\n * @param {string} componentName Name of the component for error messages.\r\n * @param {?Function} getStack Returns the component stack.\r\n */\r\nexport function checkPropTypes(\r\n\ttypeSpecs,\r\n\tvalues,\r\n\tlocation,\r\n\tcomponentName,\r\n\tgetStack\r\n) {\r\n\tObject.keys(typeSpecs).forEach(typeSpecName => {\r\n\t\tlet error;\r\n\t\ttry {\r\n\t\t\terror = typeSpecs[typeSpecName](\r\n\t\t\t\tvalues,\r\n\t\t\t\ttypeSpecName,\r\n\t\t\t\tcomponentName,\r\n\t\t\t\tlocation,\r\n\t\t\t\tnull,\r\n\t\t\t\tReactPropTypesSecret\r\n\t\t\t);\r\n\t\t} catch (e) {\r\n\t\t\terror = e;\r\n\t\t}\r\n\t\tif (error && !(error.message in loggedTypeFailures)) {\r\n\t\t\tloggedTypeFailures[error.message] = true;\r\n\t\t\tconsole.error(\r\n\t\t\t\t`Failed ${location} type: ${error.message}${(getStack &&\r\n\t\t\t\t\t`\\n${getStack()}`) ||\r\n\t\t\t\t\t''}`\r\n\t\t\t);\r\n\t\t}\r\n\t});\r\n}\r\n","import { options, Fragment } from 'preact';\r\n\r\n/**\r\n * Get human readable name of the component/dom node\r\n * @param {import('./internal').VNode} vnode\r\n * @param {import('./internal').VNode} vnode\r\n * @returns {string}\r\n */\r\nexport function getDisplayName(vnode) {\r\n\tif (vnode.type === Fragment) {\r\n\t\treturn 'Fragment';\r\n\t} else if (typeof vnode.type == 'function') {\r\n\t\treturn vnode.type.displayName || vnode.type.name;\r\n\t} else if (typeof vnode.type == 'string') {\r\n\t\treturn vnode.type;\r\n\t}\r\n\r\n\treturn '#text';\r\n}\r\n\r\n/**\r\n * Used to keep track of the currently rendered `vnode` and print it\r\n * in debug messages.\r\n */\r\nlet renderStack = [];\r\n\r\n/**\r\n * Keep track of the current owners. An owner describes a component\r\n * which was responsible to render a specific `vnode`. This exclude\r\n * children that are passed via `props.children`, because they belong\r\n * to the parent owner.\r\n *\r\n * ```jsx\r\n * const Foo = props =>
should have a | |
should have a | |
---|---|