style-to-object
Advanced tools
Comparing version 0.3.0 to 0.4.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global = global || self, global.StyleToObject = factory()); | ||
}(this, (function () { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.StyleToObject = factory()); | ||
})(this, (function () { 'use strict'; | ||
var styleToObject = {exports: {}}; | ||
// http://www.w3.org/TR/CSS21/grammar.html | ||
@@ -265,2 +267,4 @@ // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027 | ||
var parse = inlineStyleParser; | ||
/** | ||
@@ -284,3 +288,3 @@ * Parses inline style to object. | ||
var declaration; | ||
var declarations = inlineStyleParser(style); | ||
var declarations = parse(style); | ||
var hasIterator = typeof iterator === 'function'; | ||
@@ -306,6 +310,7 @@ var property; | ||
var styleToObject = StyleToObject; | ||
styleToObject.exports = StyleToObject; | ||
styleToObject.exports.default = StyleToObject; // ESM support | ||
return styleToObject; | ||
return styleToObject.exports; | ||
}))); | ||
})); |
@@ -1,2 +0,2 @@ | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(n=n||self).StyleToObject=r()}(this,function(){"use strict";function s(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var o=1,i=1;function u(n){var r=n.match(g);r&&(o+=r.length);var t=n.lastIndexOf("\n");i=~t?n.length-t:i+n.length}function c(){var r={line:o,column:i};return function(n){return n.position=new f(r),l(),n}}function f(n){this.start=n,this.end={line:o,column:i},this.source=t.source}function a(n){var r=new Error(t.source+":"+o+":"+i+": "+n);if(r.reason=n,r.filename=t.source,r.line=o,r.column=i,r.source=e,!t.silent)throw r}function s(n){var r=n.exec(e);if(r){var t=r[0];return u(t),e=e.slice(t.length),r}}function l(){s(n)}function p(n){var r;for(n=n||[];r=h();)!1!==r&&n.push(r);return n}function h(){var n=c();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;x!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,x===e.charAt(r-1))return a("End of comment missing");var t=e.slice(2,r-2);return i+=2,u(t),e=e.slice(r),i+=2,n({type:"comment",comment:t})}}function v(){var n=c(),r=s(y);if(r){if(h(),!s(d))return a("property missing ':'");var t=s(w),e=n({type:"declaration",property:b(r[0].replace(m,x)),value:t?b(t[0].replace(m,x)):x});return s(A),e}}return f.prototype.content=e,l(),function(){var n,r=[];for(p(r);n=v();)!1!==n&&(r.push(n),p(r));return r}()}var m=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,g=/\n/g,n=/^\s*/,y=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,d=/^:\s*/,w=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,A=/^[;\s]*/,r=/^\s+|\s+$/g,x="";function b(n){return n?n.replace(r,x):x}return function(n,r){var t,e=null;if(!n||"string"!=typeof n)return e;for(var o,i,u=s(n),c="function"==typeof r,f=0,a=u.length;f<a;f++)o=(t=u[f]).property,i=t.value,c?r(o,i,t):i&&((e=e||{})[o]=i);return e}}); | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).StyleToObject=e()}(this,(function(){"use strict";var r={exports:{}},e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,t=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,s="";function a(r){return r?r.replace(f,s):s}var l=function(r,f){if("string"!=typeof r)throw new TypeError("First argument must be a string");if(!r)return[];f=f||{};var l=1,p=1;function h(r){var e=r.match(n);e&&(l+=e.length);var t=r.lastIndexOf("\n");p=~t?r.length-t:p+r.length}function v(){var r={line:l,column:p};return function(e){return e.position=new m(r),y(),e}}function m(r){this.start=r,this.end={line:l,column:p},this.source=f.source}function g(e){var n=new Error(f.source+":"+l+":"+p+": "+e);if(n.reason=e,n.filename=f.source,n.line=l,n.column=p,n.source=r,!f.silent)throw n}function d(e){var n=e.exec(r);if(n){var t=n[0];return h(t),r=r.slice(t.length),n}}function y(){d(t)}function x(r){var e;for(r=r||[];e=w();)!1!==e&&r.push(e);return r}function w(){var e=v();if("/"==r.charAt(0)&&"*"==r.charAt(1)){for(var n=2;s!=r.charAt(n)&&("*"!=r.charAt(n)||"/"!=r.charAt(n+1));)++n;if(n+=2,s===r.charAt(n-1))return g("End of comment missing");var t=r.slice(2,n-2);return p+=2,h(t),r=r.slice(n),p+=2,e({type:"comment",comment:t})}}function A(){var r=v(),n=d(o);if(n){if(w(),!d(i))return g("property missing ':'");var t=d(u),f=r({type:"declaration",property:a(n[0].replace(e,s)),value:t?a(t[0].replace(e,s)):s});return d(c),f}}return m.prototype.content=r,y(),function(){var r,e=[];for(x(e);r=A();)!1!==r&&(e.push(r),x(e));return e}()};function p(r,e){var n,t=null;if(!r||"string"!=typeof r)return t;for(var o,i,u=l(r),c="function"==typeof e,f=0,s=u.length;f<s;f++)o=(n=u[f]).property,i=n.value,c?e(o,i,n):i&&(t||(t={}),t[o]=i);return t}return r.exports=p,r.exports.default=p,r.exports})); | ||
//# sourceMappingURL=style-to-object.min.js.map |
@@ -43,1 +43,2 @@ var parse = require('inline-style-parser'); | ||
module.exports = StyleToObject; | ||
module.exports.default = StyleToObject; // ESM support |
{ | ||
"name": "style-to-object", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Converts inline style to object.", | ||
@@ -8,2 +8,7 @@ "author": "Mark <mark@remarkablemark.org>", | ||
"types": "index.d.ts", | ||
"module": "index.mjs", | ||
"exports": { | ||
"import": "./index.mjs", | ||
"require": "./index.js" | ||
}, | ||
"scripts": { | ||
@@ -14,12 +19,12 @@ "build": "run-s build:*", | ||
"clean": "rm -rf dist", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls", | ||
"lint": "eslint --ignore-path .gitignore .", | ||
"lint:fix": "npm run lint -- --fix", | ||
"lint:dts": "dtslint .", | ||
"prepublishOnly": "run-s lint lint:dts test clean build", | ||
"release": "standard-version --no-verify", | ||
"test": "mocha", | ||
"_postinstall": "husky install", | ||
"postpublish": "pinst --enable", | ||
"prepublishOnly": "pinst --disable && run-s lint lint:dts test clean build", | ||
"test": "mocha --exclude **/*.mjs", | ||
"test:coverage": "nyc npm test", | ||
"test:coverage:report": "nyc report --reporter=html", | ||
"test:watch": "mocha --watch" | ||
"test:module": "node --experimental-modules test/index.mjs", | ||
"test:watch": "npm run test -- --watch" | ||
}, | ||
@@ -46,25 +51,27 @@ "repository": { | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.2.0", | ||
"@commitlint/config-conventional": "^8.2.0", | ||
"coveralls": "^3.0.7", | ||
"dtslint": "^1.0.3", | ||
"eslint": "^6.6.0", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"husky": "^3.0.9", | ||
"lint-staged": "^9.4.2", | ||
"mocha": "^6.2.2", | ||
"@commitlint/cli": "^17.0.1", | ||
"@commitlint/config-conventional": "^17.0.0", | ||
"@rollup/plugin-commonjs": "^23.0.0", | ||
"@rollup/plugin-node-resolve": "^15.0.0", | ||
"dtslint": "^4.2.1", | ||
"eslint": "^8.16.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^8.0.1", | ||
"lint-staged": "^13.0.0", | ||
"mocha": "^10.0.0", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^14.1.1", | ||
"prettier": "^1.18.2", | ||
"rollup": "^1.26.3", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-uglify": "^6.0.3", | ||
"standard-version": "^6" | ||
"nyc": "^15.1.0", | ||
"pinst": "^3.0.0", | ||
"prettier": "^2.6.2", | ||
"rollup": "^2.75.3", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"typescript": "^4.7.2" | ||
}, | ||
"files": [ | ||
"/dist", | ||
"index.d.ts" | ||
"index.d.ts", | ||
"index.js", | ||
"index.mjs" | ||
], | ||
"license": "MIT" | ||
} |
@@ -6,5 +6,4 @@ # style-to-object | ||
[![NPM version](https://img.shields.io/npm/v/style-to-object.svg)](https://www.npmjs.com/package/style-to-object) | ||
[![Build Status](https://travis-ci.org/remarkablemark/style-to-object.svg?branch=master)](https://travis-ci.org/remarkablemark/style-to-object) | ||
[![Coverage Status](https://coveralls.io/repos/github/remarkablemark/style-to-object/badge.svg?branch=master)](https://coveralls.io/github/remarkablemark/style-to-object?branch=master) | ||
[![Dependency status](https://david-dm.org/remarkablemark/style-to-object.svg)](https://david-dm.org/remarkablemark/style-to-object) | ||
[![build](https://github.com/remarkablemark/style-to-object/actions/workflows/build.yml/badge.svg)](https://github.com/remarkablemark/style-to-object/actions/workflows/build.yml) | ||
[![codecov](https://codecov.io/gh/remarkablemark/style-to-object/branch/master/graph/badge.svg?token=XWxph9dpa4)](https://codecov.io/gh/remarkablemark/style-to-object) | ||
[![NPM downloads](https://img.shields.io/npm/dm/style-to-object.svg?style=flat-square)](https://www.npmjs.com/package/style-to-object) | ||
@@ -25,3 +24,3 @@ | ||
[JSFiddle](https://jsfiddle.net/remarkablemark/ykz2meot/) | [Repl.it](https://repl.it/@remarkablemark/style-to-object) | [Examples](https://github.com/remarkablemark/style-to-object/tree/master/examples) | ||
[JSFiddle](https://jsfiddle.net/remarkablemark/ykz2meot/) | [Replit](https://replit.com/@remarkablemark/style-to-object) | [Examples](https://github.com/remarkablemark/style-to-object/tree/master/examples) | ||
@@ -33,3 +32,3 @@ ## Installation | ||
```sh | ||
$ npm install style-to-object --save | ||
npm install style-to-object --save | ||
``` | ||
@@ -40,3 +39,3 @@ | ||
```sh | ||
$ yarn add style-to-object | ||
yarn add style-to-object | ||
``` | ||
@@ -106,2 +105,4 @@ | ||
<!-- prettier-ignore-start --> | ||
```js | ||
@@ -126,2 +127,4 @@ parse(` | ||
<!-- prettier-ignore-end --> | ||
### Iterator | ||
@@ -137,2 +140,4 @@ | ||
<!-- prettier-ignore-start --> | ||
```js | ||
@@ -146,2 +151,4 @@ parse('color: #f00', function(name, value, declaration) { | ||
<!-- prettier-ignore-end --> | ||
This makes it easy to customize the output: | ||
@@ -169,3 +176,3 @@ | ||
```sh | ||
$ npm test | ||
npm test | ||
``` | ||
@@ -176,3 +183,3 @@ | ||
```sh | ||
$ npm run test:watch | ||
npm run test:watch | ||
``` | ||
@@ -183,6 +190,3 @@ | ||
```sh | ||
$ npm run test:coverage | ||
# generate html report | ||
$ npm run test:coverage:report | ||
npm run test:coverage | ||
``` | ||
@@ -193,3 +197,3 @@ | ||
```sh | ||
$ npm run lint | ||
npm run lint | ||
``` | ||
@@ -200,3 +204,3 @@ | ||
```sh | ||
$ npm run lint:fix | ||
npm run lint:fix | ||
``` | ||
@@ -207,3 +211,3 @@ | ||
```sh | ||
$ npm run lint:dts | ||
npm run lint:dts | ||
``` | ||
@@ -213,9 +217,4 @@ | ||
Only collaborators with credentials can release and publish: | ||
Release and publish are automated by [Release Please](https://github.com/googleapis/release-please). | ||
```sh | ||
$ npm run release | ||
$ git push --follow-tags && npm publish | ||
``` | ||
## Special Thanks | ||
@@ -222,0 +221,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
348
27966
213