Socket
Socket
Sign inDemoInstall

jss-plugin-extend

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jss-plugin-extend - npm Package Compare versions

Comparing version 10.0.0-alpha.3 to 10.0.0-alpha.4

55

dist/jss-plugin-extend.bundle.js

@@ -1,50 +0,19 @@

/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
var warning = function warning() {};
{
warning = function warning(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
function warning(condition, message) {
{
if (condition) {
return;
}
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
var text = "Warning: " + message;
if (format.length < 10 || /^[s\W]*$/.test(format)) {
throw new Error('The warning format should be able to uniquely identify this ' + 'warning. Please, use a more descriptive format than: ' + format);
if (typeof console !== 'undefined') {
console.warn(text);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
}
};
try {
throw Error(text);
} catch (x) {}
}
}
var warning_1 = warning;
/* eslint-disable no-use-before-define */

@@ -67,3 +36,3 @@

if (refRule === rule) {
warning_1(false, '[JSS] A rule tries to extend itself \r\n%s', rule);
warning(false, "[JSS] A rule tries to extend itself \n" + rule.toString());
return;

@@ -70,0 +39,0 @@ }

@@ -7,3 +7,3 @@ 'use strict';

var warning = _interopDefault(require('warning'));
var warning = _interopDefault(require('tiny-warning'));

@@ -27,3 +27,3 @@ /* eslint-disable no-use-before-define */

if (refRule === rule) {
warning(false, '[JSS] A rule tries to extend itself \r\n%s', rule);
warning(false, "[JSS] A rule tries to extend itself \n" + rule.toString());
return;

@@ -30,0 +30,0 @@ }

@@ -1,2 +0,2 @@

import warning from 'warning';
import warning from 'tiny-warning';

@@ -20,3 +20,3 @@ /* eslint-disable no-use-before-define */

if (refRule === rule) {
warning(false, '[JSS] A rule tries to extend itself \r\n%s', rule);
warning(false, "[JSS] A rule tries to extend itself \n" + rule.toString());
return;

@@ -23,0 +23,0 @@ }

@@ -7,51 +7,20 @@ (function (global, factory) {

/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
var warning = function warning() {};
{
warning = function warning(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
function warning(condition, message) {
{
if (condition) {
return;
}
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
var text = "Warning: " + message;
if (format.length < 10 || /^[s\W]*$/.test(format)) {
throw new Error('The warning format should be able to uniquely identify this ' + 'warning. Please, use a more descriptive format than: ' + format);
if (typeof console !== 'undefined') {
console.warn(text);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
}
};
try {
throw Error(text);
} catch (x) {}
}
}
var warning_1 = warning;
/* eslint-disable no-use-before-define */

@@ -74,3 +43,3 @@

if (refRule === rule) {
warning_1(false, '[JSS] A rule tries to extend itself \r\n%s', rule);
warning(false, "[JSS] A rule tries to extend itself \n" + rule.toString());
return;

@@ -77,0 +46,0 @@ }

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.jssPluginExtend={})}(this,function(e){"use strict";var d=function(){},l=function(e){return e&&"object"==typeof e&&!Array.isArray(e)},i="extendCurrValue"+Date.now();function x(e,n,t,r){return void 0===r&&(r={}),function(e,n,t,r){if("string"!=typeof e.extend)if(Array.isArray(e.extend))for(var o=0;o<e.extend.length;o++)x(e.extend[o],n,t,r);else for(var i in e.extend)"extend"!==i?l(e.extend[i])?(i in r||(r[i]={}),x(e.extend[i],n,t,r[i])):r[i]=e.extend[i]:x(e.extend.extend,n,t,r);else{if(!t)return;var u=t.getRule(e.extend);if(!u)return;if(u===n)return d(!1,"[JSS] A rule tries to extend itself \r\n%s",n);var f=u.options.parent;f&&x(f.rules.raw[e.extend],n,t,r)}}(e,n,t,r),function(e,n,t,r){for(var o in e)"extend"!==o&&(l(r[o])&&l(e[o])?x(e[o],n,t,r[o]):l(e[o])?r[o]=x(e[o],n,t):r[o]=e[o])}(e,n,t,r),r}e.default=function(){return{onProcessStyle:function(e,n,t){return"extend"in e?x(e,n,t):e},onChangeValue:function(e,n,t){if("extend"!==n)return e;if(null==e||!1===e){for(var r in t[i])t.prop(r,null);return t[i]=null}if("object"==typeof e){for(var o in e)t.prop(o,e[o]);t[i]=e}return null}}},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.jssPluginExtend={})}(this,function(e){"use strict";var d=function(e){return e&&"object"==typeof e&&!Array.isArray(e)},i="extendCurrValue"+Date.now();function a(e,n,t,r){return void 0===r&&(r={}),function(e,n,t,r){if("string"!=typeof e.extend)if(Array.isArray(e.extend))for(var o=0;o<e.extend.length;o++)a(e.extend[o],n,t,r);else for(var i in e.extend)"extend"!==i?d(e.extend[i])?(i in r||(r[i]={}),a(e.extend[i],n,t,r[i])):r[i]=e.extend[i]:a(e.extend.extend,n,t,r);else{if(!t)return;var u=t.getRule(e.extend);if(!u)return;if(u===n)return n.toString();var f=u.options.parent;f&&a(f.rules.raw[e.extend],n,t,r)}}(e,n,t,r),function(e,n,t,r){for(var o in e)"extend"!==o&&(d(r[o])&&d(e[o])?a(e[o],n,t,r[o]):d(e[o])?r[o]=a(e[o],n,t):r[o]=e[o])}(e,n,t,r),r}e.default=function(){return{onProcessStyle:function(e,n,t){return"extend"in e?a(e,n,t):e},onChangeValue:function(e,n,t){if("extend"!==n)return e;if(null==e||!1===e){for(var r in t[i])t.prop(r,null);return t[i]=null}if("object"==typeof e){for(var o in e)t.prop(o,e[o]);t[i]=e}return null}}},Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "jss-plugin-extend",
"description": "JSS plugin that enables mixing in styles.",
"version": "10.0.0-alpha.3",
"version": "10.0.0-alpha.4",
"license": "MIT",

@@ -36,18 +36,19 @@ "homepage": "https://cssinjs.org/jss-extend",

"scripts": {
"build": "node ../../scripts/build.js",
"prepare": "node ../../scripts/build.js",
"check-snapshot": "node ../../scripts/match-snapshot.js"
},
"devDependencies": {
"jss": "^10.0.0-alpha.3",
"jss-plugin-expand": "^10.0.0-alpha.3",
"jss-plugin-nested": "^10.0.0-alpha.3",
"jss-plugin-rule-value-function": "^10.0.0-alpha.3"
"jss": "^10.0.0-alpha.4",
"jss-plugin-expand": "^10.0.0-alpha.4",
"jss-plugin-nested": "^10.0.0-alpha.4",
"jss-plugin-rule-value-function": "^10.0.0-alpha.4"
},
"peerDependencies": {
"jss": "^9.7.0"
"jss": "^10.0.0-alpha.3"
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"warning": "^3.0.0"
}
"tiny-warning": "^1.0.2"
},
"gitHead": "4efd47a4af45de9c8784d68f3a239f9a1d29c942"
}
// @flow
/* eslint-disable no-use-before-define */
import warning from 'warning'
import warning from 'tiny-warning'
import type {Plugin} from 'jss'

@@ -17,3 +17,3 @@

if (refRule === rule) {
warning(false, '[JSS] A rule tries to extend itself \r\n%s', rule)
warning(false, `[JSS] A rule tries to extend itself \n${rule.toString()}`)
return

@@ -20,0 +20,0 @@ }

@@ -7,2 +7,3 @@ /* eslint-disable no-underscore-dangle */

import expand from 'jss-plugin-expand'
import sinon from 'sinon'
import functionPlugin from 'jss-plugin-rule-value-function'

@@ -18,9 +19,7 @@ import {create} from 'jss'

describe('jss-plugin-extend', () => {
let spy
let jss
let warning
beforeEach(() => {
extend.__Rewire__('warning', (condition, message) => {
warning = message
})
spy = sinon.spy(console, 'warn')
jss = create(settings).use(functionPlugin(), extend(), nested(), expand())

@@ -30,4 +29,3 @@ })

afterEach(() => {
extend.__ResetDependency__('warning')
warning = undefined
console.warn.restore()
})

@@ -328,3 +326,9 @@

it('error if extend using same rule name', () => {
expect(warning).to.be('[JSS] A rule tries to extend itself \r\n%s')
expect(spy.callCount).to.be(1)
expect(
spy.calledWithExactly(
'Warning: [JSS] A rule tries to extend itself \n.a-id {\n extend: a;\n width: 1px;\n}'
)
).to.be(true)
expect(sheet.getRule('a')).to.not.be(undefined)

@@ -331,0 +335,0 @@ expect(sheet.toString()).to.be('.a-id {\n width: 1px;\n}')

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