postcss-safe-parser
Advanced tools
Comparing version 6.0.0 to 7.0.0
@@ -6,5 +6,3 @@ let tokenizer = require('postcss/lib/tokenize') | ||
class SafeParser extends Parser { | ||
createTokenizer() { | ||
this.tokenizer = tokenizer(this.input, { ignoreErrors: true }) | ||
} | ||
checkMissedSemicolon() {} | ||
@@ -18,5 +16,5 @@ comment(token) { | ||
node.source.end = { | ||
offset: token[3], | ||
column: pos.col, | ||
line: pos.line, | ||
column: pos.col | ||
offset: token[3] + 1 | ||
} | ||
@@ -39,2 +37,6 @@ | ||
createTokenizer() { | ||
this.tokenizer = tokenizer(this.input, { ignoreErrors: true }) | ||
} | ||
decl(tokens) { | ||
@@ -46,18 +48,17 @@ if (tokens.length > 1 && tokens.some(i => i[0] === 'word')) { | ||
unclosedBracket() {} | ||
doubleColon() {} | ||
unknownWord(tokens) { | ||
this.spaces += tokens.map(i => i[1]).join('') | ||
} | ||
endFile() { | ||
if (this.current.nodes && this.current.nodes.length) { | ||
this.current.raws.semicolon = this.semicolon | ||
} | ||
this.current.raws.after = (this.current.raws.after || '') + this.spaces | ||
unexpectedClose() { | ||
this.current.raws.after += '}' | ||
while (this.current.parent) { | ||
this.current = this.current.parent | ||
this.current.raws.after = '' | ||
} | ||
this.root.source.end = this.getPosition(this.tokenizer.position()) | ||
} | ||
doubleColon() {} | ||
unnamedAtrule(node) { | ||
node.name = '' | ||
} | ||
precheckMissedSemicolon(tokens) { | ||
@@ -88,17 +89,17 @@ let colon = this.colon(tokens) | ||
checkMissedSemicolon() {} | ||
unclosedBracket() {} | ||
endFile() { | ||
if (this.current.nodes && this.current.nodes.length) { | ||
this.current.raws.semicolon = this.semicolon | ||
} | ||
this.current.raws.after = (this.current.raws.after || '') + this.spaces | ||
unexpectedClose() { | ||
this.current.raws.after += '}' | ||
} | ||
while (this.current.parent) { | ||
this.current = this.current.parent | ||
this.current.raws.after = '' | ||
} | ||
unknownWord(tokens) { | ||
this.spaces += tokens.map(i => i[1]).join('') | ||
} | ||
unnamedAtrule(node) { | ||
node.name = '' | ||
} | ||
} | ||
module.exports = SafeParser |
{ | ||
"name": "postcss-safe-parser", | ||
"version": "6.0.0", | ||
"version": "7.0.0", | ||
"description": "Fault-tolerant CSS parser for PostCSS", | ||
@@ -16,12 +16,22 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=12.0" | ||
"node": ">=18.0" | ||
}, | ||
"main": "lib/safe-parse", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/postcss/" | ||
}, | ||
"funding": [ | ||
{ | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/postcss/" | ||
}, | ||
{ | ||
"type": "tidelift", | ||
"url": "https://tidelift.com/funding/github/npm/postcss-safe-parser" | ||
}, | ||
{ | ||
"type": "github", | ||
"url": "https://github.com/sponsors/ai" | ||
} | ||
], | ||
"peerDependencies": { | ||
"postcss": "^8.3.3" | ||
"postcss": "^8.4.31" | ||
} | ||
} |
@@ -24,12 +24,3 @@ # PostCSS Safe Parser | ||
## Usage | ||
```js | ||
const safe = require('postcss-safe-parser') | ||
const badCss = 'a {' | ||
postcss(plugins).process(badCss, { parser: safe }).then(result => { | ||
result.css //= 'a {}' | ||
}) | ||
``` | ||
## Docs | ||
Read full docs **[here](https://github.com/postcss/postcss-safe-parser#readme)**. |
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
5414
89
26