New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wordpress/warning

Package Overview
Dependencies
Maintainers
21
Versions
139
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.1.1 to 2.2.0

build-module/utils.js

12

build-module/index.js

@@ -0,1 +1,6 @@

/**
* Internal dependencies
*/
import { logged } from './utils';
function isDev() {

@@ -26,2 +31,7 @@ return typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production';

return;
} // Skip if already logged.
if (logged.has(message)) {
return;
} // eslint-disable-next-line no-console

@@ -38,3 +48,5 @@

}
logged.add(message);
}
//# sourceMappingURL=index.js.map

@@ -8,2 +8,7 @@ "use strict";

var _utils = require("./utils");
/**
* Internal dependencies
*/
function isDev() {

@@ -34,2 +39,7 @@ return typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production';

return;
} // Skip if already logged.
if (_utils.logged.has(message)) {
return;
} // eslint-disable-next-line no-console

@@ -46,3 +56,5 @@

}
_utils.logged.add(message);
}
//# sourceMappingURL=index.js.map

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

## 2.2.0 (2021-07-21)
### Enhancement
- Ensure that the warning for a given message is logged only once.
## 2.1.0 (2021-05-20)

@@ -7,0 +13,0 @@

4

package.json
{
"name": "@wordpress/warning",
"version": "2.1.1",
"version": "2.2.0",
"description": "Warning utility for WordPress.",

@@ -32,3 +32,3 @@ "author": "The WordPress Contributors",

},
"gitHead": "954d6776be2ee80b5975e4ced6a3d481d8a89354"
"gitHead": "743b70f86f1e75fd66a583bf659f2b2fe5daf1cc"
}

@@ -33,3 +33,3 @@ # Warning

<a name="default" href="#default">#</a> **default**
### default

@@ -36,0 +36,0 @@ Shows a warning with `message` if environment is not `production`.

@@ -0,1 +1,6 @@

/**
* Internal dependencies
*/
import { logged } from './utils';
function isDev() {

@@ -31,2 +36,7 @@ return (

// Skip if already logged.
if ( logged.has( message ) ) {
return;
}
// eslint-disable-next-line no-console

@@ -43,2 +53,4 @@ console.warn( message );

}
logged.add( message );
}

@@ -5,2 +5,3 @@ /**

import warning from '..';
import { logged } from '../utils';

@@ -12,2 +13,3 @@ const initialNodeEnv = process.env.NODE_ENV;

process.env.NODE_ENV = initialNodeEnv;
logged.clear();
} );

@@ -26,2 +28,11 @@

} );
it( 'should show a message once', () => {
warning( 'warning' );
warning( 'warning' );
expect( console ).toHaveWarned();
// eslint-disable-next-line no-console
expect( console.warn ).toHaveBeenCalledTimes( 1 );
} );
} );

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