@wordpress/warning
Advanced tools
@@ -0,1 +1,2 @@ | ||
| // packages/warning/src/index.ts | ||
| import { logged } from "./utils"; | ||
@@ -2,0 +3,0 @@ function isDev() { |
@@ -5,4 +5,4 @@ { | ||
| "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;", | ||
| "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,2 +0,3 @@ | ||
| const logged = /* @__PURE__ */ new Set(); | ||
| // packages/warning/src/utils.ts | ||
| var logged = /* @__PURE__ */ new Set(); | ||
| export { | ||
@@ -3,0 +4,0 @@ logged |
@@ -5,4 +5,4 @@ { | ||
| "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;", | ||
| "mappings": ";AAIO,IAAM,SAAwB,oBAAI,IAAI;", | ||
| "names": [] | ||
| } |
+2
-0
@@ -19,2 +19,4 @@ "use strict"; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // packages/warning/src/index.ts | ||
| var index_exports = {}; | ||
@@ -21,0 +23,0 @@ __export(index_exports, { |
@@ -5,4 +5,4 @@ { | ||
| "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;", | ||
| "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": [] | ||
| } |
+3
-1
@@ -19,2 +19,4 @@ "use strict"; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // packages/warning/src/utils.ts | ||
| var utils_exports = {}; | ||
@@ -25,3 +27,3 @@ __export(utils_exports, { | ||
| module.exports = __toCommonJS(utils_exports); | ||
| const logged = /* @__PURE__ */ new Set(); | ||
| var logged = /* @__PURE__ */ new Set(); | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
@@ -28,0 +30,0 @@ 0 && (module.exports = { |
@@ -5,4 +5,4 @@ { | ||
| "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;", | ||
| "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,SAAwB,oBAAI,IAAI;", | ||
| "names": [] | ||
| } |
+2
-2
| { | ||
| "name": "@wordpress/warning", | ||
| "version": "3.34.0", | ||
| "version": "3.34.1-next.2f1c7c01b.0", | ||
| "description": "Warning utility for WordPress.", | ||
@@ -44,3 +44,3 @@ "author": "The WordPress Contributors", | ||
| }, | ||
| "gitHead": "ceebff807958d2e8fc755b5a20473939c78b4d1d" | ||
| "gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8" | ||
| } |
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
73542
0.21%368
1.1%1
Infinity%