postcss-safe-parser
Advanced tools
Comparing version 4.0.2 to 5.0.0
# Change Log | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## 5.0 | ||
* Removed support for Node.js 6.x, 8.x, 11.x, and 13.x versions. | ||
* Used PostCSS 8.0. | ||
## 4.0.2 | ||
@@ -5,0 +9,0 @@ * Fix parsing `:;`. |
@@ -1,13 +0,12 @@ | ||
"use strict"; | ||
let { Input } = require('postcss') | ||
var Input = require('postcss/lib/input'); | ||
let SafeParser = require('./safe-parser') | ||
var SafeParser = require('./safe-parser'); | ||
module.exports = function safeParse (css, opts) { | ||
let input = new Input(css, opts) | ||
module.exports = function safeParse(css, opts) { | ||
var input = new Input(css, opts); | ||
var parser = new SafeParser(input); | ||
parser.parse(); | ||
return parser.root; | ||
}; | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNhZmUtcGFyc2UuZXM2Il0sIm5hbWVzIjpbIklucHV0IiwicmVxdWlyZSIsIlNhZmVQYXJzZXIiLCJtb2R1bGUiLCJleHBvcnRzIiwic2FmZVBhcnNlIiwiY3NzIiwib3B0cyIsImlucHV0IiwicGFyc2VyIiwicGFyc2UiLCJyb290Il0sIm1hcHBpbmdzIjoiOztBQUFBLElBQUlBLEtBQUssR0FBR0MsT0FBTyxDQUFDLG1CQUFELENBQW5COztBQUVBLElBQUlDLFVBQVUsR0FBR0QsT0FBTyxDQUFDLGVBQUQsQ0FBeEI7O0FBRUFFLE1BQU0sQ0FBQ0MsT0FBUCxHQUFpQixTQUFTQyxTQUFULENBQW9CQyxHQUFwQixFQUF5QkMsSUFBekIsRUFBK0I7QUFDOUMsTUFBSUMsS0FBSyxHQUFHLElBQUlSLEtBQUosQ0FBVU0sR0FBVixFQUFlQyxJQUFmLENBQVo7QUFFQSxNQUFJRSxNQUFNLEdBQUcsSUFBSVAsVUFBSixDQUFlTSxLQUFmLENBQWI7QUFDQUMsRUFBQUEsTUFBTSxDQUFDQyxLQUFQO0FBRUEsU0FBT0QsTUFBTSxDQUFDRSxJQUFkO0FBQ0QsQ0FQRCIsInNvdXJjZXNDb250ZW50IjpbImxldCBJbnB1dCA9IHJlcXVpcmUoJ3Bvc3Rjc3MvbGliL2lucHV0JylcblxubGV0IFNhZmVQYXJzZXIgPSByZXF1aXJlKCcuL3NhZmUtcGFyc2VyJylcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiBzYWZlUGFyc2UgKGNzcywgb3B0cykge1xuICBsZXQgaW5wdXQgPSBuZXcgSW5wdXQoY3NzLCBvcHRzKVxuXG4gIGxldCBwYXJzZXIgPSBuZXcgU2FmZVBhcnNlcihpbnB1dClcbiAgcGFyc2VyLnBhcnNlKClcblxuICByZXR1cm4gcGFyc2VyLnJvb3Rcbn1cbiJdLCJmaWxlIjoic2FmZS1wYXJzZS5qcyJ9 | ||
let parser = new SafeParser(input) | ||
parser.parse() | ||
return parser.root | ||
} |
@@ -1,115 +0,92 @@ | ||
"use strict"; | ||
let tokenizer = require('postcss/lib/tokenize') | ||
let Comment = require('postcss/lib/comment') | ||
let Parser = require('postcss/lib/parser') | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
var tokenizer = require('postcss/lib/tokenize'); | ||
var Comment = require('postcss/lib/comment'); | ||
var Parser = require('postcss/lib/parser'); | ||
var SafeParser = | ||
/*#__PURE__*/ | ||
function (_Parser) { | ||
_inheritsLoose(SafeParser, _Parser); | ||
function SafeParser() { | ||
return _Parser.apply(this, arguments) || this; | ||
class SafeParser extends Parser { | ||
createTokenizer () { | ||
this.tokenizer = tokenizer(this.input, { ignoreErrors: true }) | ||
} | ||
var _proto = SafeParser.prototype; | ||
comment (token) { | ||
let node = new Comment() | ||
this.init(node, token[2]) | ||
let pos = | ||
this.input.fromOffset(token[3]) || | ||
this.input.fromOffset(this.input.css.length - 1) | ||
node.source.end = { | ||
offset: token[3], | ||
line: pos.line, | ||
column: pos.col | ||
} | ||
_proto.createTokenizer = function createTokenizer() { | ||
this.tokenizer = tokenizer(this.input, { | ||
ignoreErrors: true | ||
}); | ||
}; | ||
let text = token[1].slice(2) | ||
if (text.slice(-2) === '*/') text = text.slice(0, -2) | ||
_proto.comment = function comment(token) { | ||
var node = new Comment(); | ||
this.init(node, token[2], token[3]); | ||
node.source.end = { | ||
line: token[4], | ||
column: token[5] | ||
}; | ||
var text = token[1].slice(2); | ||
if (text.slice(-2) === '*/') text = text.slice(0, -2); | ||
if (/^\s*$/.test(text)) { | ||
node.text = ''; | ||
node.raws.left = text; | ||
node.raws.right = ''; | ||
node.text = '' | ||
node.raws.left = text | ||
node.raws.right = '' | ||
} else { | ||
var match = text.match(/^(\s*)([^]*\S)(\s*)$/); | ||
node.text = match[2]; | ||
node.raws.left = match[1]; | ||
node.raws.right = match[3]; | ||
let match = text.match(/^(\s*)([^]*\S)(\s*)$/) | ||
node.text = match[2] | ||
node.raws.left = match[1] | ||
node.raws.right = match[3] | ||
} | ||
}; | ||
} | ||
_proto.decl = function decl(tokens) { | ||
if (tokens.length > 1 && tokens.some(function (i) { | ||
return i[0] === 'word'; | ||
})) { | ||
_Parser.prototype.decl.call(this, tokens); | ||
decl (tokens) { | ||
if (tokens.length > 1 && tokens.some(i => i[0] === 'word')) { | ||
super.decl(tokens) | ||
} | ||
}; | ||
} | ||
_proto.unclosedBracket = function unclosedBracket() {}; | ||
unclosedBracket () {} | ||
_proto.unknownWord = function unknownWord(tokens) { | ||
this.spaces += tokens.map(function (i) { | ||
return i[1]; | ||
}).join(''); | ||
}; | ||
unknownWord (tokens) { | ||
this.spaces += tokens.map(i => i[1]).join('') | ||
} | ||
_proto.unexpectedClose = function unexpectedClose() { | ||
this.current.raws.after += '}'; | ||
}; | ||
unexpectedClose () { | ||
this.current.raws.after += '}' | ||
} | ||
_proto.doubleColon = function doubleColon() {}; | ||
doubleColon () {} | ||
_proto.unnamedAtrule = function unnamedAtrule(node) { | ||
node.name = ''; | ||
}; | ||
unnamedAtrule (node) { | ||
node.name = '' | ||
} | ||
_proto.precheckMissedSemicolon = function precheckMissedSemicolon(tokens) { | ||
var colon = this.colon(tokens); | ||
if (colon === false) return; | ||
var split; | ||
precheckMissedSemicolon (tokens) { | ||
let colon = this.colon(tokens) | ||
if (colon === false) return | ||
let split | ||
for (split = colon - 1; split >= 0; split--) { | ||
if (tokens[split][0] === 'word') break; | ||
if (tokens[split][0] === 'word') break | ||
} | ||
for (split -= 1; split >= 0; split--) { | ||
if (tokens[split][0] !== 'space') { | ||
split += 1; | ||
break; | ||
split += 1 | ||
break | ||
} | ||
} | ||
let other = tokens.splice(split, tokens.length - split) | ||
this.decl(other) | ||
} | ||
var other = tokens.splice(split, tokens.length - split); | ||
this.decl(other); | ||
}; | ||
checkMissedSemicolon () {} | ||
_proto.checkMissedSemicolon = function checkMissedSemicolon() {}; | ||
_proto.endFile = function endFile() { | ||
endFile () { | ||
if (this.current.nodes && this.current.nodes.length) { | ||
this.current.raws.semicolon = this.semicolon; | ||
this.current.raws.semicolon = this.semicolon | ||
} | ||
this.current.raws.after = (this.current.raws.after || '') + this.spaces | ||
this.current.raws.after = (this.current.raws.after || '') + this.spaces; | ||
while (this.current.parent) { | ||
this.current = this.current.parent; | ||
this.current.raws.after = ''; | ||
this.current = this.current.parent | ||
this.current.raws.after = '' | ||
} | ||
}; | ||
} | ||
} | ||
return SafeParser; | ||
}(Parser); | ||
module.exports = SafeParser; | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNhZmUtcGFyc2VyLmVzNiJdLCJuYW1lcyI6WyJ0b2tlbml6ZXIiLCJyZXF1aXJlIiwiQ29tbWVudCIsIlBhcnNlciIsIlNhZmVQYXJzZXIiLCJjcmVhdGVUb2tlbml6ZXIiLCJpbnB1dCIsImlnbm9yZUVycm9ycyIsImNvbW1lbnQiLCJ0b2tlbiIsIm5vZGUiLCJpbml0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+PSAwOyBzcGxpdC0tKSB7XG4gICAgICBpZiAodG9rZW5zW3NwbGl0XVswXSAhPT0gJ3NwYWNlJykge1xuICAgICAgICBzcGxpdCArPSAxXG4gICAgICAgIGJyZWFrXG4gICAgICB9XG4gICAgfVxuICAgIGxldCBvdGhlciA9IHRva2Vucy5zcGxpY2Uoc3BsaXQsIHRva2Vucy5sZW5ndGggLSBzcGxpdClcbiAgICB0aGlzLmRlY2wob3RoZXIpXG4gIH1cblxuICBjaGVja01pc3NlZFNlbWljb2xvbiAoKSB7IH1cblxuICBlbmRGaWxlICgpIHtcbiAgICBpZiAodGhpcy5jdXJyZW50Lm5vZGVzICYmIHRoaXMuY3VycmVudC5ub2Rlcy5sZW5ndGgpIHtcbiAgICAgIHRoaXMuY3VycmVudC5yYXdzLnNlbWljb2xvbiA9IHRoaXMuc2VtaWNvbG9uXG4gICAgfVxuICAgIHRoaXMuY3VycmVudC5yYXdzLmFmdGVyID0gKHRoaXMuY3VycmVudC5yYXdzLmFmdGVyIHx8ICcnKSArIHRoaXMuc3BhY2VzXG5cbiAgICB3aGlsZSAodGhpcy5jdXJyZW50LnBhcmVudCkge1xuICAgICAgdGhpcy5jdXJyZW50ID0gdGhpcy5jdXJyZW50LnBhcmVudFxuICAgICAgdGhpcy5jdXJyZW50LnJhd3MuYWZ0ZXIgPSAnJ1xuICAgIH1cbiAgfVxufVxuXG5tb2R1bGUuZXhwb3J0cyA9IFNhZmVQYXJzZXJcbiJdLCJmaWxlIjoic2FmZS1wYXJzZXIuanMifQ== | ||
module.exports = SafeParser |
{ | ||
"name": "postcss-safe-parser", | ||
"version": "4.0.2", | ||
"version": "5.0.0", | ||
"description": "Fault-tolerant CSS parser for PostCSS", | ||
@@ -12,7 +12,2 @@ "keywords": [ | ||
], | ||
"scripts": { | ||
"clean": "del-cli build/ lib/*.js", | ||
"build": "yarn clean && gulp build", | ||
"test": "gulp build && eslint-ci . && jest && ./test/integration.js" | ||
}, | ||
"author": "Andrey Sitnik <andrey@sitnik.ru>", | ||
@@ -22,83 +17,8 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=6.0.0" | ||
"node": ">=10.0" | ||
}, | ||
"main": "lib/safe-parse", | ||
"dependencies": { | ||
"postcss": "^7.0.26" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.8.4", | ||
"@babel/preset-env": "^7.8.4", | ||
"@logux/eslint-config": "^35.0.4", | ||
"babel-plugin-add-module-exports": "^1.0.2", | ||
"ci-job-number": "^0.3.1", | ||
"del-cli": "^3.0.0", | ||
"eslint": "^6.8.0", | ||
"eslint-ci": "^1.0.0", | ||
"eslint-config-standard": "^14.1.0", | ||
"eslint-plugin-es5": "^1.5.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-jest": "^23.6.0", | ||
"eslint-plugin-node": "^11.0.0", | ||
"eslint-plugin-prefer-let": "^1.0.1", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-security": "^1.4.0", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"eslint-plugin-unicorn": "^16.0.0", | ||
"gulp": "^4.0.2", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"husky": "^4.2.1", | ||
"jest": "^25.1.0", | ||
"lint-staged": "^10.0.7", | ||
"postcss-parser-tests": "^6.5.0", | ||
"pre-commit": "^1.1.3" | ||
}, | ||
"eslintConfig": { | ||
"extends": "@logux/eslint-config/node", | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"gulpfile.js" | ||
], | ||
"rules": { | ||
"node/no-unpublished-require": "off", | ||
"global-require": "off" | ||
} | ||
} | ||
] | ||
}, | ||
"eslintIgnore": [ | ||
"build/", | ||
"lib/*.js" | ||
], | ||
"jest": { | ||
"testEnvironment": "node", | ||
"modulePathIgnorePatterns": [ | ||
"<rootDir>/build" | ||
] | ||
}, | ||
"babel": { | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"loose": true | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"add-module-exports" | ||
] | ||
}, | ||
"main": "lib/safe-parse", | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"gulpfile.js": "eslint", | ||
"test/*.js": "eslint", | ||
"lib/*.es6": "eslint" | ||
"postcss": "^8.0.2" | ||
} | ||
} |
@@ -1,6 +0,6 @@ | ||
# PostCSS Safe Parser [![Build Status][ci-img]][ci] | ||
# PostCSS Safe Parser | ||
<img align="right" width="95" height="95" | ||
<img align="right" width="135" height="95" | ||
title="Philosopher’s stone, logo of PostCSS" | ||
src="http://postcss.github.io/postcss/logo.svg"> | ||
src="https://postcss.org/logo-leftp.svg"> | ||
@@ -17,18 +17,18 @@ A fault-tolerant CSS parser for [PostCSS], which will find & fix syntax errors, | ||
[PostCSS]: https://github.com/postcss/postcss | ||
[ci-img]: https://img.shields.io/travis/postcss/postcss-safe-parser.svg | ||
[ci]: https://travis-ci.org/postcss/postcss-safe-parser | ||
<a href="https://evilmartians.com/?utm_source=postcss"> | ||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"> | ||
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"> | ||
</a> | ||
## Usage | ||
```js | ||
var safe = require('postcss-safe-parser'); | ||
var badCss = 'a {'; | ||
const safe = require('postcss-safe-parser') | ||
postcss(plugins).process(badCss, { parser: safe }).then(function (result) { | ||
result.css //= 'a {}' | ||
}); | ||
const badCss = 'a {' | ||
postcss(plugins).process(badCss, { parser: safe }).then(result => { | ||
result.css //= 'a {}' | ||
}) | ||
``` |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
5946
84
+ Addednanoid@3.3.7(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpostcss@8.4.47(transitive)
+ Addedsource-map-js@1.2.1(transitive)
- Removedpicocolors@0.2.1(transitive)
- Removedpostcss@7.0.39(transitive)
- Removedsource-map@0.6.1(transitive)
Updatedpostcss@^8.0.2