Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wordpress/warning

Package Overview
Dependencies
Maintainers
24
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/warning - npm Package Compare versions

Comparing version 2.58.0 to 3.0.0

19

babel-plugin.js

@@ -17,20 +17,11 @@ /**

const typeofProcessExpression = t.binaryExpression(
'!==',
t.unaryExpression( 'typeof', t.identifier( 'SCRIPT_DEBUG' ), false ),
t.stringLiteral( 'undefined' )
);
const scriptDebugCheckExpression = t.binaryExpression(
'===',
t.identifier( 'SCRIPT_DEBUG' ),
t.memberExpression(
t.identifier( 'globalThis' ),
t.identifier( 'SCRIPT_DEBUG' )
),
t.booleanLiteral( true )
);
const logicalExpression = t.logicalExpression(
'&&',
typeofProcessExpression,
scriptDebugCheckExpression
);
return {

@@ -74,3 +65,3 @@ visitor: {

t.ifStatement(
logicalExpression,
scriptDebugCheckExpression,
t.blockStatement( [

@@ -77,0 +68,0 @@ t.expressionStatement( node ),

@@ -6,3 +6,4 @@ /**

function isDev() {
return typeof SCRIPT_DEBUG !== 'undefined' && SCRIPT_DEBUG === true;
// eslint-disable-next-line @wordpress/wp-global-usage
return globalThis.SCRIPT_DEBUG === true;
}

@@ -9,0 +10,0 @@

@@ -13,3 +13,4 @@ "use strict";

function isDev() {
return typeof SCRIPT_DEBUG !== 'undefined' && SCRIPT_DEBUG === true;
// eslint-disable-next-line @wordpress/wp-global-usage
return globalThis.SCRIPT_DEBUG === true;
}

@@ -16,0 +17,0 @@

@@ -5,2 +5,9 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## 3.0.0 (2024-05-31)
### Breaking Changes
- Variables like `process.env.IS_GUTENBERG_PLUGIN` have been replaced by `globalThis.IS_GUTENBERG_PLUGIN`. Build systems using `process.env` should be updated ([#61486](https://github.com/WordPress/gutenberg/pull/61486)).
- Increase the minimum required Node.js version to v18.12.0 matching long-term support releases ([#31270](https://github.com/WordPress/gutenberg/pull/61930)). Learn more about [Node.js releases](https://nodejs.org/en/about/previous-releases).
## 2.58.0 (2024-05-16)

@@ -7,0 +14,0 @@

{
"name": "@wordpress/warning",
"version": "2.58.0",
"version": "3.0.0",
"description": "Warning utility for WordPress.",

@@ -22,3 +22,4 @@ "author": "The WordPress Contributors",

"engines": {
"node": ">=12"
"node": ">=18.12.0",
"npm": ">=8.19.2"
},

@@ -33,3 +34,3 @@ "main": "build/index.js",

},
"gitHead": "42f38f287506a6b3ed8ccba839b18ad066821044"
"gitHead": "2f30cddff15723ac7017fd009fc5913b7b419400"
}

@@ -7,3 +7,4 @@ /**

function isDev() {
return typeof SCRIPT_DEBUG !== 'undefined' && SCRIPT_DEBUG === true;
// eslint-disable-next-line @wordpress/wp-global-usage
return globalThis.SCRIPT_DEBUG === true;
}

@@ -10,0 +11,0 @@

@@ -7,7 +7,10 @@ /**

// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable @wordpress/wp-global-usage */
describe( 'warning', () => {
const initialScriptDebug = global.SCRIPT_DEBUG;
const initialScriptDebug = globalThis.SCRIPT_DEBUG;
afterEach( () => {
global.SCRIPT_DEBUG = initialScriptDebug;
globalThis.SCRIPT_DEBUG = initialScriptDebug;
logged.clear();

@@ -17,3 +20,3 @@ } );

it( 'logs to console.warn when SCRIPT_DEBUG is set to `true`', () => {
global.SCRIPT_DEBUG = true;
globalThis.SCRIPT_DEBUG = true;
warning( 'warning' );

@@ -24,3 +27,3 @@ expect( console ).toHaveWarnedWith( 'warning' );

it( 'does not log to console.warn if SCRIPT_DEBUG not set to `true`', () => {
global.SCRIPT_DEBUG = false;
globalThis.SCRIPT_DEBUG = false;
warning( 'warning' );

@@ -31,3 +34,3 @@ expect( console ).not.toHaveWarned();

it( 'should show a message once', () => {
global.SCRIPT_DEBUG = true;
globalThis.SCRIPT_DEBUG = true;
warning( 'warning' );

@@ -34,0 +37,0 @@ warning( 'warning' );

@@ -31,3 +31,3 @@ /**

'import warning from "@wordpress/warning";',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning("a") : void 0;'
'globalThis.SCRIPT_DEBUG === true ? warning("a") : void 0;'
);

@@ -49,3 +49,3 @@

const expected =
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning("a") : void 0;';
'globalThis.SCRIPT_DEBUG === true ? warning("a") : void 0;';

@@ -64,5 +64,5 @@ expect( transformCode( input, options ) ).toEqual( expected );

'import warning from "@wordpress/warning";',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning("a") : void 0;',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning("b") : void 0;',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning("c") : void 0;'
'globalThis.SCRIPT_DEBUG === true ? warning("a") : void 0;',
'globalThis.SCRIPT_DEBUG === true ? warning("b") : void 0;',
'globalThis.SCRIPT_DEBUG === true ? warning("c") : void 0;'
);

@@ -82,5 +82,5 @@

'import warn from "@wordpress/warning";',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warn("a") : void 0;',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warn("b") : void 0;',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warn("c") : void 0;'
'globalThis.SCRIPT_DEBUG === true ? warn("a") : void 0;',
'globalThis.SCRIPT_DEBUG === true ? warn("b") : void 0;',
'globalThis.SCRIPT_DEBUG === true ? warn("c") : void 0;'
);

@@ -100,5 +100,5 @@

'import warn from "@wordpress/warning";',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warn("a") : void 0;',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warn("b") : void 0;',
'typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warn("c") : void 0;'
'globalThis.SCRIPT_DEBUG === true ? warn("a") : void 0;',
'globalThis.SCRIPT_DEBUG === true ? warn("b") : void 0;',
'globalThis.SCRIPT_DEBUG === true ? warn("c") : void 0;'
);

@@ -105,0 +105,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc