🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

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
+12
-43
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 @@

{"version":3,"file":"jss-plugin-extend.js","sources":["../../../node_modules/warning/warning.js","../src/index.js"],"sourcesContent":["/**\n * Copyright 2014-2015, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n'use strict';\n\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\nvar __DEV__ = process.env.NODE_ENV !== 'production';\n\nvar warning = function() {};\n\nif (__DEV__) {\n warning = function(condition, format, args) {\n var len = arguments.length;\n args = new Array(len > 2 ? len - 2 : 0);\n for (var key = 2; key < len; key++) {\n args[key - 2] = arguments[key];\n }\n if (format === undefined) {\n throw new Error(\n '`warning(condition, format, ...args)` requires a warning ' +\n 'message argument'\n );\n }\n\n if (format.length < 10 || (/^[s\\W]*$/).test(format)) {\n throw new Error(\n 'The warning format should be able to uniquely identify this ' +\n 'warning. Please, use a more descriptive format than: ' + format\n );\n }\n\n if (!condition) {\n var argIndex = 0;\n var message = 'Warning: ' +\n format.replace(/%s/g, function() {\n return args[argIndex++];\n });\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch(x) {}\n }\n };\n}\n\nmodule.exports = warning;\n","// @flow\n/* eslint-disable no-use-before-define */\nimport warning from 'warning'\nimport type {Plugin} from 'jss'\n\nconst isObject = obj => obj && typeof obj === 'object' && !Array.isArray(obj)\nconst valueNs = `extendCurrValue${Date.now()}`\n\nfunction mergeExtend(style, rule, sheet, newStyle) {\n const extendType = typeof style.extend\n // Extend using a rule name.\n if (extendType === 'string') {\n if (!sheet) return\n const refRule = sheet.getRule(style.extend)\n if (!refRule) return\n if (refRule === rule) {\n warning(false, '[JSS] A rule tries to extend itself \\r\\n%s', rule)\n return\n }\n const {parent} = refRule.options\n if (parent) {\n const originalStyle = parent.rules.raw[style.extend]\n extend(originalStyle, rule, sheet, newStyle)\n }\n return\n }\n\n // Extend using an array of objects.\n if (Array.isArray(style.extend)) {\n for (let index = 0; index < style.extend.length; index++) {\n extend(style.extend[index], rule, sheet, newStyle)\n }\n return\n }\n\n // Extend is a style object.\n for (const prop in style.extend) {\n if (prop === 'extend') {\n extend(style.extend.extend, rule, sheet, newStyle)\n continue\n }\n if (isObject(style.extend[prop])) {\n if (!(prop in newStyle)) newStyle[prop] = {}\n extend(style.extend[prop], rule, sheet, newStyle[prop])\n continue\n }\n newStyle[prop] = style.extend[prop]\n }\n}\n\nfunction mergeRest(style, rule, sheet, newStyle) {\n // Copy base style.\n for (const prop in style) {\n if (prop === 'extend') continue\n if (isObject(newStyle[prop]) && isObject(style[prop])) {\n extend(style[prop], rule, sheet, newStyle[prop])\n continue\n }\n\n if (isObject(style[prop])) {\n newStyle[prop] = extend(style[prop], rule, sheet)\n continue\n }\n\n newStyle[prop] = style[prop]\n }\n}\n\n/**\n * Recursively extend styles.\n */\nfunction extend(style, rule, sheet, newStyle = {}) {\n mergeExtend(style, rule, sheet, newStyle)\n mergeRest(style, rule, sheet, newStyle)\n return newStyle\n}\n\n/**\n * Handle `extend` property.\n *\n * @param {Rule} rule\n * @api public\n */\nexport default function jssExtend(): Plugin {\n function onProcessStyle(style, rule, sheet) {\n if ('extend' in style) return extend(style, rule, sheet)\n return style\n }\n\n function onChangeValue(value, prop, rule) {\n if (prop !== 'extend') return value\n\n // Value is empty, remove properties set previously.\n if (value == null || value === false) {\n // $FlowFixMe: Flow complains because there is no indexer property in StyleRule\n for (const key in rule[valueNs]) {\n rule.prop(key, null)\n }\n // $FlowFixMe: Flow complains because there is no indexer property in StyleRule\n rule[valueNs] = null\n return null\n }\n\n if (typeof value === 'object') {\n // $FlowFixMe: This will be an object\n for (const key in value) {\n rule.prop(key, value[key])\n }\n\n // $FlowFixMe: Flow complains because there is no indexer property in StyleRule\n rule[valueNs] = value\n }\n\n // Make sure we don't set the value in the core.\n return null\n }\n\n return {onProcessStyle, onChangeValue}\n}\n"],"names":["warning","condition","format","args","len","arguments","length","Array","key","undefined","Error","test","argIndex","message","replace","console","error","x","module","isObject","obj","isArray","valueNs","Date","now","mergeExtend","style","rule","sheet","newStyle","extendType","extend","refRule","getRule","parent","options","originalStyle","rules","raw","index","prop","mergeRest","jssExtend","onProcessStyle","onChangeValue","value"],"mappings":";;;;;;EAAA;;;;;;;;AASA;EAWA,IAAIA,OAAO,GAAG,mBAAW,EAAzB;;AAEA,EAAa;IACXA,OAAO,GAAG,iBAASC,SAAT,EAAoBC,MAApB,EAA4BC,IAA5B,EAAkC;UACtCC,GAAG,GAAGC,SAAS,CAACC,MAApB;MACAH,IAAI,GAAG,IAAII,KAAJ,CAAUH,GAAG,GAAG,CAAN,GAAUA,GAAG,GAAG,CAAhB,GAAoB,CAA9B,CAAP;;WACK,IAAII,GAAG,GAAG,CAAf,EAAkBA,GAAG,GAAGJ,GAAxB,EAA6BI,GAAG,EAAhC,EAAoC;QAClCL,IAAI,CAACK,GAAG,GAAG,CAAP,CAAJ,GAAgBH,SAAS,CAACG,GAAD,CAAzB;;;UAEEN,MAAM,KAAKO,SAAf,EAA0B;cAClB,IAAIC,KAAJ,CACJ,8DACA,kBAFI,CAAN;;;UAMER,MAAM,CAACI,MAAP,GAAgB,EAAhB,IAAuB,UAAD,CAAaK,IAAb,CAAkBT,MAAlB,CAA1B,EAAqD;cAC7C,IAAIQ,KAAJ,CACJ,iEACA,uDADA,GAC0DR,MAFtD,CAAN;;;UAME,CAACD,SAAL,EAAgB;YACVW,QAAQ,GAAG,CAAf;YACIC,OAAO,GAAG,cACZX,MAAM,CAACY,OAAP,CAAe,KAAf,EAAsB,YAAW;iBACxBX,IAAI,CAACS,QAAQ,EAAT,CAAX;SADF,CADF;;YAII,OAAOG,OAAP,KAAmB,WAAvB,EAAoC;UAClCA,OAAO,CAACC,KAAR,CAAcH,OAAd;;;YAEE;;;gBAGI,IAA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B,MAAAA,IAAI,CAACL,OAAD,CAAJ,GAAgB,IAAhB;EACA,aAAO,IAAP;EACD;;EAED,QAAI,OAAOuB,KAAP,KAAiB,QAArB,EAA+B;EAC7B;EACA,WAAK,IAAMrC,IAAX,IAAkBqC,KAAlB,EAAyB;EACvBlB,QAAAA,IAAI,CAACa,IAAL,CAAUhC,IAAV,EAAeqC,KAAK,CAACrC,IAAD,CAApB;EACD,OAJ4B;;;EAO7BmB,MAAAA,IAAI,CAACL,OAAD,CAAJ,GAAgBuB,KAAhB;EACD,KAtBuC;;;EAyBxC,WAAO,IAAP;EACD;;EAED,SAAO;EAACF,IAAAA,cAAc,EAAdA,cAAD;EAAiBC,IAAAA,aAAa,EAAbA;EAAjB,GAAP;EACD;;;;;;;;;;;;"}
{"version":3,"file":"jss-plugin-extend.js","sources":["../../../node_modules/tiny-warning/dist/tiny-warning.esm.js","../src/index.js"],"sourcesContent":["var isProduction = process.env.NODE_ENV === 'production';\nfunction warning(condition, message) {\n if (!isProduction) {\n if (condition) {\n return;\n }\n\n var text = \"Warning: \" + message;\n\n if (typeof console !== 'undefined') {\n console.warn(text);\n }\n\n try {\n throw Error(text);\n } catch (x) {}\n }\n}\n\nexport default warning;\n","// @flow\n/* eslint-disable no-use-before-define */\nimport warning from 'tiny-warning'\nimport type {Plugin} from 'jss'\n\nconst isObject = obj => obj && typeof obj === 'object' && !Array.isArray(obj)\nconst valueNs = `extendCurrValue${Date.now()}`\n\nfunction mergeExtend(style, rule, sheet, newStyle) {\n const extendType = typeof style.extend\n // Extend using a rule name.\n if (extendType === 'string') {\n if (!sheet) return\n const refRule = sheet.getRule(style.extend)\n if (!refRule) return\n if (refRule === rule) {\n warning(false, `[JSS] A rule tries to extend itself \\n${rule.toString()}`)\n return\n }\n const {parent} = refRule.options\n if (parent) {\n const originalStyle = parent.rules.raw[style.extend]\n extend(originalStyle, rule, sheet, newStyle)\n }\n return\n }\n\n // Extend using an array of objects.\n if (Array.isArray(style.extend)) {\n for (let index = 0; index < style.extend.length; index++) {\n extend(style.extend[index], rule, sheet, newStyle)\n }\n return\n }\n\n // Extend is a style object.\n for (const prop in style.extend) {\n if (prop === 'extend') {\n extend(style.extend.extend, rule, sheet, newStyle)\n continue\n }\n if (isObject(style.extend[prop])) {\n if (!(prop in newStyle)) newStyle[prop] = {}\n extend(style.extend[prop], rule, sheet, newStyle[prop])\n continue\n }\n newStyle[prop] = style.extend[prop]\n }\n}\n\nfunction mergeRest(style, rule, sheet, newStyle) {\n // Copy base style.\n for (const prop in style) {\n if (prop === 'extend') continue\n if (isObject(newStyle[prop]) && isObject(style[prop])) {\n extend(style[prop], rule, sheet, newStyle[prop])\n continue\n }\n\n if (isObject(style[prop])) {\n newStyle[prop] = extend(style[prop], rule, sheet)\n continue\n }\n\n newStyle[prop] = style[prop]\n }\n}\n\n/**\n * Recursively extend styles.\n */\nfunction extend(style, rule, sheet, newStyle = {}) {\n mergeExtend(style, rule, sheet, newStyle)\n mergeRest(style, rule, sheet, newStyle)\n return newStyle\n}\n\n/**\n * Handle `extend` property.\n *\n * @param {Rule} rule\n * @api public\n */\nexport default function jssExtend(): Plugin {\n function onProcessStyle(style, rule, sheet) {\n if ('extend' in style) return extend(style, rule, sheet)\n return style\n }\n\n function onChangeValue(value, prop, rule) {\n if (prop !== 'extend') return value\n\n // Value is empty, remove properties set previously.\n if (value == null || value === false) {\n // $FlowFixMe: Flow complains because there is no indexer property in StyleRule\n for (const key in rule[valueNs]) {\n rule.prop(key, null)\n }\n // $FlowFixMe: Flow complains because there is no indexer property in StyleRule\n rule[valueNs] = null\n return null\n }\n\n if (typeof value === 'object') {\n // $FlowFixMe: This will be an object\n for (const key in value) {\n rule.prop(key, value[key])\n }\n\n // $FlowFixMe: Flow complains because there is no indexer property in StyleRule\n rule[valueNs] = value\n }\n\n // Make sure we don't set the value in the core.\n return null\n }\n\n return {onProcessStyle, onChangeValue}\n}\n"],"names":["warning","condition","message","text","console","warn","Error","x","isObject","obj","Array","isArray","valueNs","Date","now","mergeExtend","style","rule","sheet","newStyle","extendType","extend","refRule","getRule","toString","parent","options","originalStyle","rules","raw","index","length","prop","mergeRest","jssExtend","onProcessStyle","onChangeValue","value","key"],"mappings":";;;;;;EACA,SAASA,OAAT,CAAiBC,SAAjB,EAA4BC,OAA5B,EAAqC;EACnC,EAAmB;EACjB,QAAID,SAAJ,EAAe;EACb;EACD;;EAED,QAAIE,IAAI,GAAG,cAAcD,OAAzB;;EAEA,QAAI,OAAOE,OAAP,KAAmB,WAAvB,EAAoC;EAClCA,MAAAA,OAAO,CAACC,IAAR,CAAaF,IAAb;EACD;;EAED,QAAI;EACF,YAAMG,KAAK,CAACH,IAAD,CAAX;EACD,KAFD,CAEE,OAAOI,CAAP,EAAU;EACb;EACF;;EChBD;AACA;EAGA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAAAC,GAAG;EAAA,SAAIA,GAAG,IAAI,OAAOA,GAAP,KAAe,QAAtB,IAAkC,CAACC,KAAK,CAACC,OAAN,CAAcF,GAAd,CAAvC;EAAA,CAApB;;EACA,IAAMG,OAAO,uBAAqBC,IAAI,CAACC,GAAL,EAAlC;;EAEA,SAASC,WAAT,CAAqBC,KAArB,EAA4BC,IAA5B,EAAkCC,KAAlC,EAAyCC,QAAzC,EAAmD;EACjD,MAAMC,UAAU,GAAG,OAAOJ,KAAK,CAACK,MAAhC,CADiD;;EAGjD,MAAID,UAAU,KAAK,QAAnB,EAA6B;EAC3B,QAAI,CAACF,KAAL,EAAY;EACZ,QAAMI,OAAO,GAAGJ,KAAK,CAACK,OAAN,CAAcP,KAAK,CAACK,MAApB,CAAhB;EACA,QAAI,CAACC,OAAL,EAAc;;EACd,QAAIA,OAAO,KAAKL,IAAhB,EAAsB;EACpBjB,MAAAA,OAAO,CAAC,KAAD,6CAAiDiB,IAAI,CAACO,QAAL,EAAjD,CAAP;EACA;EACD;;EAP0B,QAQpBC,MARoB,GAQVH,OAAO,CAACI,OARE,CAQpBD,MARoB;;EAS3B,QAAIA,MA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EACvB,WAAOF,KAAP;EACD;;EAED,WAASoB,aAAT,CAAuBC,KAAvB,EAA8BL,IAA9B,EAAoCf,IAApC,EAA0C;EACxC,QAAIe,IAAI,KAAK,QAAb,EAAuB,OAAOK,KAAP,CADiB;;EAIxC,QAAIA,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,KAA/B,EAAsC;EACpC;EACA,WAAK,IAAMC,GAAX,IAAkBrB,IAAI,CAACL,OAAD,CAAtB,EAAiC;EAC/BK,QAAAA,IAAI,CAACe,IAAL,CAAUM,GAAV,EAAe,IAAf;EACD,OAJmC;;;EAMpCrB,MAAAA,IAAI,CAACL,OAAD,CAAJ,GAAgB,IAAhB;EACA,aAAO,IAAP;EACD;;EAED,QAAI,OAAOyB,KAAP,KAAiB,QAArB,EAA+B;EAC7B;EACA,WAAK,IAAMC,IAAX,IAAkBD,KAAlB,EAAyB;EACvBpB,QAAAA,IAAI,CAACe,IAAL,CAAUM,IAAV,EAAeD,KAAK,CAACC,IAAD,CAApB;EACD,OAJ4B;;;EAO7BrB,MAAAA,IAAI,CAACL,OAAD,CAAJ,GAAgByB,KAAhB;EACD,KAtBuC;;;EAyBxC,WAAO,IAAP;EACD;;EAED,SAAO;EAACF,IAAAA,cAAc,EAAdA,cAAD;EAAiBC,IAAAA,aAAa,EAAbA;EAAjB,GAAP;EACD;;;;;;;;;;;;"}

@@ -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}')