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

fela-beautifier

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fela-beautifier - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

30

dist/fela-beautifier.js

@@ -516,28 +516,22 @@ (function (global, factory) {

var beautifier = (function () {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
return function (renderer) {
// DOM Renderer
if (renderer.hasOwnProperty('mountNode')) {
renderer.subscribe(function (css) {
renderer.mountNode.textContent = cssbeautify$1(css, babelHelpers.extends({}, defaultOptions, options));
});
function beautifier(renderer, options) {
var existingRenderToString = renderer.renderToString.bind(renderer);
return renderer;
}
renderer.renderToString = function () {
var css = existingRenderToString();
return cssbeautify$1(css, babelHelpers.extends({}, defaultOptions, options));
};
// Server Renderer
var existingRenderToString = renderer.renderToString.bind(renderer);
renderer.renderToString = function () {
var css = existingRenderToString();
return cssbeautify$1(css, babelHelpers.extends({}, defaultOptions, options));
};
return renderer;
}
return renderer;
var beautifier$1 = (function (options) {
return function (renderer) {
return beautifier(renderer, options);
};
});
return beautifier;
return beautifier$1;
}));
//# sourceMappingURL=fela-beautifier.js.map

2

dist/fela-beautifier.min.js

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.FelaBeautifier=n()}(this,function(){"use strict";function e(e,n){return n={exports:{}},e(n,n.exports),n.exports}var n={};n["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},n["extends"]=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};var t=e(function(e,t){!function(){function o(e,n){function t(e){return" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e}function o(e){return"'"===e||'"'===e}function r(e){return a>="a"&&a<="z"||a>="A"&&a<="Z"||a>="0"&&a<="9"||"-_*.:#[]".indexOf(e)>=0}function i(){var e;for(e=g;e>0;e-=1)m+=c.indent}function f(){m=b(m),R?m+=" {":(m+="\n",i(),m+="{"),"\n"!==s&&(m+="\n"),g+=1}function u(){var e;g-=1,m=b(m),m.length>0&&v&&(e=m.charAt(m.length-1),";"!==e&&"{"!==e&&(m+=";")),m+="\n",i(),m+="}",l.push(m),m=""}var c,l,a,s,p,h,d,g,y,S,b,A=0,x=e.length,m="",R=!0,v=!1;for(c=arguments.length>1?n:{},"undefined"==typeof c.indent&&(c.indent=" "),"string"==typeof c.openbrace&&(R="end-of-line"===c.openbrace),"boolean"==typeof c.autosemicolon&&(v=c.autosemicolon),b=String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/\s+$/,"")},d={Start:0,AtRule:1,Block:2,Selector:3,Ruleset:4,Property:5,Separator:6,Expression:7,URL:8},g=0,h=d.Start,S=!1,l=[],e=e.replace(/\r\n/g,"\n");A<x;)if(a=e.charAt(A),s=e.charAt(A+1),A+=1,o(y))m+=a,a===y&&(y=null),"\\"===a&&s===y&&(m+=s,A+=1);else if(o(a))m+=a,y=a;else if(S)m+=a,"*"===a&&"/"===s&&(S=!1,m+=s,A+=1);else if("/"!==a||"*"!==s){if(h===d.Start){if(0===l.length&&t(a)&&0===m.length)continue;if(a<=" "||a.charCodeAt(0)>=128){h=d.Start,m+=a;continue}if(r(a)||"@"===a){if(p=b(m),0===p.length)l.length>0&&(m="\n\n");else if("}"===p.charAt(p.length-1)||";"===p.charAt(p.length-1))m=p+"\n\n";else for(;;){if(s=m.charAt(m.length-1)," "!==s&&9!==s.charCodeAt(0))break;m=m.substr(0,m.length-1)}m+=a,h="@"===a?d.AtRule:d.Selector;continue}}if(h!==d.AtRule)if(h!==d.Block)if(h!==d.Selector)if(h!==d.Ruleset)if(h!==d.Property)if(h!==d.Separator)if(h!==d.Expression)h===d.URL&&")"===a&&m.charAt(m.length-1!=="\\")?(m+=a,h=d.Expression):m+=a;else{if("}"===a){u(),h=d.Start,g>0&&(h=d.Block);continue}if(";"===a){m=b(m),m+=";\n",h=d.Ruleset;continue}if(m+=a,"("===a&&"l"===m.charAt(m.length-2)&&"r"===m.charAt(m.length-3)&&"u"===m.charAt(m.length-4)){h=d.URL;continue}}else{if(!t(a)){m+=a,h=d.Expression;continue}o(s)&&(h=d.Expression)}else{if(":"===a){m=b(m),m+=": ",h=d.Expression,t(s)&&(h=d.Separator);continue}if("}"===a){u(),h=d.Start,g>0&&(h=d.Block);continue}m+=a}else{if("}"===a){u(),h=d.Start,g>0&&(h=d.Block);continue}if("\n"===a){m=b(m),m+="\n";continue}if(!t(a)){m=b(m),m+="\n",i(),m+=a,h=d.Property;continue}m+=a}else{if("{"===a){f(),h=d.Ruleset;continue}if("}"===a){u(),h=d.Start;continue}m+=a}else{if(r(a)){if(p=b(m),0===p.length)l.length>0&&(m="\n\n");else if("}"===p.charAt(p.length-1))m=p+"\n\n";else for(;;){if(s=m.charAt(m.length-1)," "!==s&&9!==s.charCodeAt(0))break;m=m.substr(0,m.length-1)}i(),m+=a,h=d.Selector;continue}if("}"===a){u(),h=d.Start;continue}m+=a}else{if(";"===a){m+=a,h=d.Start;continue}if("{"===a){p=b(m),f(),h="@font-face"===p?d.Ruleset:d.Block;continue}m+=a}}else S=!0,m+=a,m+=s,A+=1;return m=l.join("")+m}"undefined"!=typeof t?e.exports=t=o:"object"===("undefined"==typeof window?"undefined":n["typeof"](window))&&(window.cssbeautify=o)}()}),o=t&&"object"==typeof t&&"default"in t?t["default"]:t,r={indent:" ",openbrace:"end-of-line",autosemicolon:!1},i=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return function(t){if(t.hasOwnProperty("mountNode"))return t.subscribe(function(i){t.mountNode.textContent=o(i,n["extends"]({},r,e))}),t;var i=t.renderToString.bind(t);return t.renderToString=function(){var t=i();return o(t,n["extends"]({},r,e))},t}};return i});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.FelaBeautifier=n()}(this,function(){"use strict";function e(e,n){return n={exports:{}},e(n,n.exports),n.exports}function n(e,n){var o=e.renderToString.bind(e);return e.renderToString=function(){var e=o();return r(e,t.extends({},i,n))},e}var t={};t.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},t.extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};var o=e(function(e,n){!function(){function o(e,n){function t(e){return" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e}function o(e){return"'"===e||'"'===e}function r(e){return a>="a"&&a<="z"||a>="A"&&a<="Z"||a>="0"&&a<="9"||"-_*.:#[]".indexOf(e)>=0}function i(){var e;for(e=g;e>0;e-=1)m+=u.indent}function f(){m=b(m),R?m+=" {":(m+="\n",i(),m+="{"),"\n"!==s&&(m+="\n"),g+=1}function c(){var e;g-=1,m=b(m),m.length>0&&v&&(e=m.charAt(m.length-1),";"!==e&&"{"!==e&&(m+=";")),m+="\n",i(),m+="}",l.push(m),m=""}var u,l,a,s,p,h,d,g,y,S,b,A=0,x=e.length,m="",R=!0,v=!1;for(u=arguments.length>1?n:{},"undefined"==typeof u.indent&&(u.indent=" "),"string"==typeof u.openbrace&&(R="end-of-line"===u.openbrace),"boolean"==typeof u.autosemicolon&&(v=u.autosemicolon),b=String.prototype.trimRight?function(e){return e.trimRight()}:function(e){return e.replace(/\s+$/,"")},d={Start:0,AtRule:1,Block:2,Selector:3,Ruleset:4,Property:5,Separator:6,Expression:7,URL:8},g=0,h=d.Start,S=!1,l=[],e=e.replace(/\r\n/g,"\n");A<x;)if(a=e.charAt(A),s=e.charAt(A+1),A+=1,o(y))m+=a,a===y&&(y=null),"\\"===a&&s===y&&(m+=s,A+=1);else if(o(a))m+=a,y=a;else if(S)m+=a,"*"===a&&"/"===s&&(S=!1,m+=s,A+=1);else if("/"!==a||"*"!==s){if(h===d.Start){if(0===l.length&&t(a)&&0===m.length)continue;if(a<=" "||a.charCodeAt(0)>=128){h=d.Start,m+=a;continue}if(r(a)||"@"===a){if(p=b(m),0===p.length)l.length>0&&(m="\n\n");else if("}"===p.charAt(p.length-1)||";"===p.charAt(p.length-1))m=p+"\n\n";else for(;;){if(s=m.charAt(m.length-1)," "!==s&&9!==s.charCodeAt(0))break;m=m.substr(0,m.length-1)}m+=a,h="@"===a?d.AtRule:d.Selector;continue}}if(h!==d.AtRule)if(h!==d.Block)if(h!==d.Selector)if(h!==d.Ruleset)if(h!==d.Property)if(h!==d.Separator)if(h!==d.Expression)h===d.URL&&")"===a&&m.charAt(m.length-1!=="\\")?(m+=a,h=d.Expression):m+=a;else{if("}"===a){c(),h=d.Start,g>0&&(h=d.Block);continue}if(";"===a){m=b(m),m+=";\n",h=d.Ruleset;continue}if(m+=a,"("===a&&"l"===m.charAt(m.length-2)&&"r"===m.charAt(m.length-3)&&"u"===m.charAt(m.length-4)){h=d.URL;continue}}else{if(!t(a)){m+=a,h=d.Expression;continue}o(s)&&(h=d.Expression)}else{if(":"===a){m=b(m),m+=": ",h=d.Expression,t(s)&&(h=d.Separator);continue}if("}"===a){c(),h=d.Start,g>0&&(h=d.Block);continue}m+=a}else{if("}"===a){c(),h=d.Start,g>0&&(h=d.Block);continue}if("\n"===a){m=b(m),m+="\n";continue}if(!t(a)){m=b(m),m+="\n",i(),m+=a,h=d.Property;continue}m+=a}else{if("{"===a){f(),h=d.Ruleset;continue}if("}"===a){c(),h=d.Start;continue}m+=a}else{if(r(a)){if(p=b(m),0===p.length)l.length>0&&(m="\n\n");else if("}"===p.charAt(p.length-1))m=p+"\n\n";else for(;;){if(s=m.charAt(m.length-1)," "!==s&&9!==s.charCodeAt(0))break;m=m.substr(0,m.length-1)}i(),m+=a,h=d.Selector;continue}if("}"===a){c(),h=d.Start;continue}m+=a}else{if(";"===a){m+=a,h=d.Start;continue}if("{"===a){p=b(m),f(),h="@font-face"===p?d.Ruleset:d.Block;continue}m+=a}}else S=!0,m+=a,m+=s,A+=1;return m=l.join("")+m}"undefined"!=typeof n?e.exports=n=o:"object"===("undefined"==typeof window?"undefined":t.typeof(window))&&(window.cssbeautify=o)}()}),r=o&&"object"==typeof o&&"default"in o?o.default:o,i={indent:" ",openbrace:"end-of-line",autosemicolon:!1},f=function(e){return function(t){return n(t,e)}};return f});
{
"name": "fela-beautifier",
"version": "1.0.3",
"description": "Beautifier middleware for Fela",
"version": "1.1.0",
"description": "Fela enhancer to beautify CSS output",
"main": "index.js",

@@ -16,2 +16,3 @@ "files": [

"fela-devtools",
"fela-enhancer",
"dx",

@@ -28,5 +29,5 @@ "devtools",

},
"peerDependecies": {
"fela": "1.0.2"
"peerDependencies": {
"fela": "1.1.0"
}
}
# fela-beautifier
The beautifier middleware is a developer tool that automatically formats the rendered CSS markup on every change. It uses [cssbeautify](https://github.com/senchalabs/cssbeautify) to achieve this.
<img alt="npm downloads" src="https://img.shields.io/npm/dm/fela-beautifier.svg">
<img alt="gzipped size" src="https://img.shields.io/badge/gzipped-1.49kb-brightgreen.svg">
The beautifier enhancer is a developer tool that automatically formats the rendered CSS markup on every change. It uses [cssbeautify](https://github.com/senchalabs/cssbeautify) to achieve this.
## Installation
```sh
npm i --save fela-beautifier
```
Assuming you are using [npm](https://www.npmjs.com) as your package mananger you can just `npm install`.<br>
Otherwise we also provide a [UMD](https://github.com/umdjs/umd). You can easily use it via [npmcdn](https://npmcdn.com/). It registers a `FelaBeautifier` global.
```HTML
<!-- Fela (Development): Unminified version including all warnings -->
<script src="https://npmcdn.com/fela-beautifier@1.1.0/dist/fela-beautifier.js"></script>
<!-- Fela (Production): Minified version -->
<script src="https://npmcdn.com/fela-beautifier@1.1.0/dist/fela-beautifier.min.js"></script>
```
## Example
![Preview](preview.png)
## Usage
```javascript
import { createRenderer } from 'fela'
import beautifier from 'fela-beautifier'
const enhancer = beautifier({
ident: ' ',
openbrace: 'separate-line',
autosemicolon: 'false'
})
const renderer = createRenderer({ enhancers: [enhancer] })
```
## Configuration

@@ -13,1 +46,6 @@ Uses the same options as [cssbeautify](https://github.com/senchalabs/cssbeautify) does.

| autosemicolon | `boolean`| `false` | insert semicolon after the last rule |
## License
Fela is licensed under the [MIT License](http://opensource.org/licenses/MIT).<br>
Documentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).<br>
Created with ♥ by [@rofrischmann](http://rofrischmann.de) and all the great contributors.

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