@wordpress/warning
Advanced tools
@@ -1,50 +0,22 @@ | ||
| /** | ||
| * Internal dependencies | ||
| */ | ||
| import { logged } from './utils'; | ||
| import { logged } from "./utils"; | ||
| function isDev() { | ||
| // eslint-disable-next-line @wordpress/wp-global-usage | ||
| return globalThis.SCRIPT_DEBUG === true; | ||
| } | ||
| /** | ||
| * Shows a warning with `message` if environment is not `production`. | ||
| * | ||
| * @param message Message to show in the warning. | ||
| * | ||
| * @example | ||
| * ```js | ||
| * import warning from '@wordpress/warning'; | ||
| * | ||
| * function MyComponent( props ) { | ||
| * if ( ! props.title ) { | ||
| * warning( '`props.title` was not passed' ); | ||
| * } | ||
| * ... | ||
| * } | ||
| * ``` | ||
| */ | ||
| export default function warning(message) { | ||
| function warning(message) { | ||
| if (!isDev()) { | ||
| return; | ||
| } | ||
| // Skip if already logged. | ||
| if (logged.has(message)) { | ||
| return; | ||
| } | ||
| // eslint-disable-next-line no-console | ||
| console.warn(message); | ||
| // Throwing an error and catching it immediately to improve debugging | ||
| // A consumer can use 'pause on caught exceptions' | ||
| // https://github.com/facebook/react/issues/4216 | ||
| try { | ||
| throw Error(message); | ||
| } catch (x) { | ||
| // Do nothing. | ||
| } | ||
| logged.add(message); | ||
| } | ||
| //# sourceMappingURL=index.js.map | ||
| export { | ||
| warning as default | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,7 @@ | ||
| {"version":3,"names":["logged","isDev","globalThis","SCRIPT_DEBUG","warning","message","has","console","warn","Error","x","add"],"sources":["@wordpress/warning/src/index.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { logged } from './utils';\n\nfunction isDev(): boolean {\n\t// eslint-disable-next-line @wordpress/wp-global-usage\n\treturn globalThis.SCRIPT_DEBUG === true;\n}\n\n/**\n * Shows a warning with `message` if environment is not `production`.\n *\n * @param message Message to show in the warning.\n *\n * @example\n * ```js\n * import warning from '@wordpress/warning';\n *\n * function MyComponent( props ) {\n * if ( ! props.title ) {\n * warning( '`props.title` was not passed' );\n * }\n * ...\n * }\n * ```\n */\nexport default function warning( message: string ): void {\n\tif ( ! isDev() ) {\n\t\treturn;\n\t}\n\n\t// Skip if already logged.\n\tif ( logged.has( message ) ) {\n\t\treturn;\n\t}\n\n\t// eslint-disable-next-line no-console\n\tconsole.warn( message );\n\n\t// Throwing an error and catching it immediately to improve debugging\n\t// A consumer can use 'pause on caught exceptions'\n\t// https://github.com/facebook/react/issues/4216\n\ttry {\n\t\tthrow Error( message );\n\t} catch ( x ) {\n\t\t// Do nothing.\n\t}\n\tlogged.add( message );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,SAAS;AAEhC,SAASC,KAAKA,CAAA,EAAY;EACzB;EACA,OAAOC,UAAU,CAACC,YAAY,KAAK,IAAI;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,OAAOA,CAAEC,OAAe,EAAS;EACxD,IAAK,CAAEJ,KAAK,CAAC,CAAC,EAAG;IAChB;EACD;;EAEA;EACA,IAAKD,MAAM,CAACM,GAAG,CAAED,OAAQ,CAAC,EAAG;IAC5B;EACD;;EAEA;EACAE,OAAO,CAACC,IAAI,CAAEH,OAAQ,CAAC;;EAEvB;EACA;EACA;EACA,IAAI;IACH,MAAMI,KAAK,CAAEJ,OAAQ,CAAC;EACvB,CAAC,CAAC,OAAQK,CAAC,EAAG;IACb;EAAA;EAEDV,MAAM,CAACW,GAAG,CAAEN,OAAQ,CAAC;AACtB","ignoreList":[]} | ||
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { logged } from './utils';\n\nfunction isDev(): boolean {\n\t// eslint-disable-next-line @wordpress/wp-global-usage\n\treturn globalThis.SCRIPT_DEBUG === true;\n}\n\n/**\n * Shows a warning with `message` if environment is not `production`.\n *\n * @param message Message to show in the warning.\n *\n * @example\n * ```js\n * import warning from '@wordpress/warning';\n *\n * function MyComponent( props ) {\n * if ( ! props.title ) {\n * warning( '`props.title` was not passed' );\n * }\n * ...\n * }\n * ```\n */\nexport default function warning( message: string ): void {\n\tif ( ! isDev() ) {\n\t\treturn;\n\t}\n\n\t// Skip if already logged.\n\tif ( logged.has( message ) ) {\n\t\treturn;\n\t}\n\n\t// eslint-disable-next-line no-console\n\tconsole.warn( message );\n\n\t// Throwing an error and catching it immediately to improve debugging\n\t// A consumer can use 'pause on caught exceptions'\n\t// https://github.com/facebook/react/issues/4216\n\ttry {\n\t\tthrow Error( message );\n\t} catch ( x ) {\n\t\t// Do nothing.\n\t}\n\tlogged.add( message );\n}\n"], | ||
| "mappings": "AAGA,SAAS,cAAc;AAEvB,SAAS,QAAiB;AAEzB,SAAO,WAAW,iBAAiB;AACpC;AAmBe,SAAR,QAA0B,SAAwB;AACxD,MAAK,CAAE,MAAM,GAAI;AAChB;AAAA,EACD;AAGA,MAAK,OAAO,IAAK,OAAQ,GAAI;AAC5B;AAAA,EACD;AAGA,UAAQ,KAAM,OAAQ;AAKtB,MAAI;AACH,UAAM,MAAO,OAAQ;AAAA,EACtB,SAAU,GAAI;AAAA,EAEd;AACA,SAAO,IAAK,OAAQ;AACrB;", | ||
| "names": [] | ||
| } |
@@ -1,6 +0,5 @@ | ||
| /** | ||
| * Object map tracking messages which have been logged, for use in ensuring a | ||
| * message is only logged once. | ||
| */ | ||
| export const logged = new Set(); | ||
| //# sourceMappingURL=utils.js.map | ||
| const logged = /* @__PURE__ */ new Set(); | ||
| export { | ||
| logged | ||
| }; | ||
| //# sourceMappingURL=utils.js.map |
@@ -1,1 +0,7 @@ | ||
| {"version":3,"names":["logged","Set"],"sources":["@wordpress/warning/src/utils.ts"],"sourcesContent":["/**\n * Object map tracking messages which have been logged, for use in ensuring a\n * message is only logged once.\n */\nexport const logged: Set< string > = new Set();\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,MAAMA,MAAqB,GAAG,IAAIC,GAAG,CAAC,CAAC","ignoreList":[]} | ||
| { | ||
| "version": 3, | ||
| "sources": ["../src/utils.ts"], | ||
| "sourcesContent": ["/**\n * Object map tracking messages which have been logged, for use in ensuring a\n * message is only logged once.\n */\nexport const logged: Set< string > = new Set();\n"], | ||
| "mappings": "AAIO,MAAM,SAAwB,oBAAI,IAAI;", | ||
| "names": [] | ||
| } |
+25
-40
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| default: () => warning | ||
| }); | ||
| exports.default = warning; | ||
| var _utils = require("./utils"); | ||
| /** | ||
| * Internal dependencies | ||
| */ | ||
| module.exports = __toCommonJS(index_exports); | ||
| var import_utils = require("./utils"); | ||
| function isDev() { | ||
| // eslint-disable-next-line @wordpress/wp-global-usage | ||
| return globalThis.SCRIPT_DEBUG === true; | ||
| } | ||
| /** | ||
| * Shows a warning with `message` if environment is not `production`. | ||
| * | ||
| * @param message Message to show in the warning. | ||
| * | ||
| * @example | ||
| * ```js | ||
| * import warning from '@wordpress/warning'; | ||
| * | ||
| * function MyComponent( props ) { | ||
| * if ( ! props.title ) { | ||
| * warning( '`props.title` was not passed' ); | ||
| * } | ||
| * ... | ||
| * } | ||
| * ``` | ||
| */ | ||
| function warning(message) { | ||
@@ -38,21 +32,12 @@ if (!isDev()) { | ||
| } | ||
| // Skip if already logged. | ||
| if (_utils.logged.has(message)) { | ||
| if (import_utils.logged.has(message)) { | ||
| return; | ||
| } | ||
| // eslint-disable-next-line no-console | ||
| console.warn(message); | ||
| // Throwing an error and catching it immediately to improve debugging | ||
| // A consumer can use 'pause on caught exceptions' | ||
| // https://github.com/facebook/react/issues/4216 | ||
| try { | ||
| throw Error(message); | ||
| } catch (x) { | ||
| // Do nothing. | ||
| } | ||
| _utils.logged.add(message); | ||
| import_utils.logged.add(message); | ||
| } | ||
| //# sourceMappingURL=index.js.map | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,7 @@ | ||
| {"version":3,"names":["_utils","require","isDev","globalThis","SCRIPT_DEBUG","warning","message","logged","has","console","warn","Error","x","add"],"sources":["@wordpress/warning/src/index.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { logged } from './utils';\n\nfunction isDev(): boolean {\n\t// eslint-disable-next-line @wordpress/wp-global-usage\n\treturn globalThis.SCRIPT_DEBUG === true;\n}\n\n/**\n * Shows a warning with `message` if environment is not `production`.\n *\n * @param message Message to show in the warning.\n *\n * @example\n * ```js\n * import warning from '@wordpress/warning';\n *\n * function MyComponent( props ) {\n * if ( ! props.title ) {\n * warning( '`props.title` was not passed' );\n * }\n * ...\n * }\n * ```\n */\nexport default function warning( message: string ): void {\n\tif ( ! isDev() ) {\n\t\treturn;\n\t}\n\n\t// Skip if already logged.\n\tif ( logged.has( message ) ) {\n\t\treturn;\n\t}\n\n\t// eslint-disable-next-line no-console\n\tconsole.warn( message );\n\n\t// Throwing an error and catching it immediately to improve debugging\n\t// A consumer can use 'pause on caught exceptions'\n\t// https://github.com/facebook/react/issues/4216\n\ttry {\n\t\tthrow Error( message );\n\t} catch ( x ) {\n\t\t// Do nothing.\n\t}\n\tlogged.add( message );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,SAASC,KAAKA,CAAA,EAAY;EACzB;EACA,OAAOC,UAAU,CAACC,YAAY,KAAK,IAAI;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,OAAOA,CAAEC,OAAe,EAAS;EACxD,IAAK,CAAEJ,KAAK,CAAC,CAAC,EAAG;IAChB;EACD;;EAEA;EACA,IAAKK,aAAM,CAACC,GAAG,CAAEF,OAAQ,CAAC,EAAG;IAC5B;EACD;;EAEA;EACAG,OAAO,CAACC,IAAI,CAAEJ,OAAQ,CAAC;;EAEvB;EACA;EACA;EACA,IAAI;IACH,MAAMK,KAAK,CAAEL,OAAQ,CAAC;EACvB,CAAC,CAAC,OAAQM,CAAC,EAAG;IACb;EAAA;EAEDL,aAAM,CAACM,GAAG,CAAEP,OAAQ,CAAC;AACtB","ignoreList":[]} | ||
| { | ||
| "version": 3, | ||
| "sources": ["../src/index.ts"], | ||
| "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { logged } from './utils';\n\nfunction isDev(): boolean {\n\t// eslint-disable-next-line @wordpress/wp-global-usage\n\treturn globalThis.SCRIPT_DEBUG === true;\n}\n\n/**\n * Shows a warning with `message` if environment is not `production`.\n *\n * @param message Message to show in the warning.\n *\n * @example\n * ```js\n * import warning from '@wordpress/warning';\n *\n * function MyComponent( props ) {\n * if ( ! props.title ) {\n * warning( '`props.title` was not passed' );\n * }\n * ...\n * }\n * ```\n */\nexport default function warning( message: string ): void {\n\tif ( ! isDev() ) {\n\t\treturn;\n\t}\n\n\t// Skip if already logged.\n\tif ( logged.has( message ) ) {\n\t\treturn;\n\t}\n\n\t// eslint-disable-next-line no-console\n\tconsole.warn( message );\n\n\t// Throwing an error and catching it immediately to improve debugging\n\t// A consumer can use 'pause on caught exceptions'\n\t// https://github.com/facebook/react/issues/4216\n\ttry {\n\t\tthrow Error( message );\n\t} catch ( x ) {\n\t\t// Do nothing.\n\t}\n\tlogged.add( message );\n}\n"], | ||
| "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAuB;AAEvB,SAAS,QAAiB;AAEzB,SAAO,WAAW,iBAAiB;AACpC;AAmBe,SAAR,QAA0B,SAAwB;AACxD,MAAK,CAAE,MAAM,GAAI;AAChB;AAAA,EACD;AAGA,MAAK,oBAAO,IAAK,OAAQ,GAAI;AAC5B;AAAA,EACD;AAGA,UAAQ,KAAM,OAAQ;AAKtB,MAAI;AACH,UAAM,MAAO,OAAQ;AAAA,EACtB,SAAU,GAAI;AAAA,EAEd;AACA,sBAAO,IAAK,OAAQ;AACrB;", | ||
| "names": [] | ||
| } |
+27
-10
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| var utils_exports = {}; | ||
| __export(utils_exports, { | ||
| logged: () => logged | ||
| }); | ||
| exports.logged = void 0; | ||
| /** | ||
| * Object map tracking messages which have been logged, for use in ensuring a | ||
| * message is only logged once. | ||
| */ | ||
| const logged = exports.logged = new Set(); | ||
| //# sourceMappingURL=utils.js.map | ||
| module.exports = __toCommonJS(utils_exports); | ||
| const logged = /* @__PURE__ */ new Set(); | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| logged | ||
| }); | ||
| //# sourceMappingURL=utils.js.map |
@@ -1,1 +0,7 @@ | ||
| {"version":3,"names":["logged","exports","Set"],"sources":["@wordpress/warning/src/utils.ts"],"sourcesContent":["/**\n * Object map tracking messages which have been logged, for use in ensuring a\n * message is only logged once.\n */\nexport const logged: Set< string > = new Set();\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,MAAqB,GAAAC,OAAA,CAAAD,MAAA,GAAG,IAAIE,GAAG,CAAC,CAAC","ignoreList":[]} | ||
| { | ||
| "version": 3, | ||
| "sources": ["../src/utils.ts"], | ||
| "sourcesContent": ["/**\n * Object map tracking messages which have been logged, for use in ensuring a\n * message is only logged once.\n */\nexport const logged: Set< string > = new Set();\n"], | ||
| "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAM,SAAwB,oBAAI,IAAI;", | ||
| "names": [] | ||
| } |
+12
-2
| { | ||
| "name": "@wordpress/warning", | ||
| "version": "3.32.0", | ||
| "version": "3.32.1-next.47f435fc9.0", | ||
| "description": "Warning utility for WordPress.", | ||
@@ -27,4 +27,14 @@ "author": "The WordPress Contributors", | ||
| "module": "build-module/index.js", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./build-types/index.d.ts", | ||
| "import": "./build-module/index.js", | ||
| "require": "./build/index.js" | ||
| }, | ||
| "./package.json": "./package.json", | ||
| "./babel-plugin": "./babel-plugin.js" | ||
| }, | ||
| "react-native": "src/index", | ||
| "wpScript": true, | ||
| "wpScriptDefaultExport": true, | ||
| "types": "build-types", | ||
@@ -35,3 +45,3 @@ "sideEffects": false, | ||
| }, | ||
| "gitHead": "a030b4c0e0695239b942c7dc18511782b64f10ed" | ||
| "gitHead": "9720f22c138771d2ed1a0522725c3cdf1c242953" | ||
| } |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
73358
-0.57%364
-3.19%1
Infinity%