feat: docker compose maybe
This commit is contained in:
20
node_modules/postcss-safe-parser/LICENSE
generated
vendored
Normal file
20
node_modules/postcss-safe-parser/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
34
node_modules/postcss-safe-parser/README.md
generated
vendored
Normal file
34
node_modules/postcss-safe-parser/README.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# PostCSS Safe Parser
|
||||
|
||||
<img align="right" width="135" height="95"
|
||||
title="Philosopher’s stone, logo of PostCSS"
|
||||
src="https://postcss.org/logo-leftp.svg">
|
||||
|
||||
A fault-tolerant CSS parser for [PostCSS], which will find & fix syntax errors,
|
||||
capable of parsing any input. It is useful for:
|
||||
|
||||
* Parse legacy code with many hacks. For example, it can parse all examples
|
||||
from [Browserhacks].
|
||||
* Works with demo tools with live input like [Autoprefixer demo].
|
||||
|
||||
[Autoprefixer demo]: http://simevidas.jsbin.com/gufoko/quiet
|
||||
[Browserhacks]: http://browserhacks.com/
|
||||
[PostCSS]: https://github.com/postcss/postcss
|
||||
|
||||
<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">
|
||||
</a>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const safe = require('postcss-safe-parser')
|
||||
|
||||
const badCss = 'a {'
|
||||
|
||||
postcss(plugins).process(badCss, { parser: safe }).then(result => {
|
||||
result.css //= 'a {}'
|
||||
})
|
||||
```
|
12
node_modules/postcss-safe-parser/lib/safe-parse.js
generated
vendored
Normal file
12
node_modules/postcss-safe-parser/lib/safe-parse.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
let { Input } = require('postcss')
|
||||
|
||||
let SafeParser = require('./safe-parser')
|
||||
|
||||
module.exports = function safeParse(css, opts) {
|
||||
let input = new Input(css, opts)
|
||||
|
||||
let parser = new SafeParser(input)
|
||||
parser.parse()
|
||||
|
||||
return parser.root
|
||||
}
|
99
node_modules/postcss-safe-parser/lib/safe-parser.js
generated
vendored
Normal file
99
node_modules/postcss-safe-parser/lib/safe-parser.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
let tokenizer = require('postcss/lib/tokenize')
|
||||
let Comment = require('postcss/lib/comment')
|
||||
let Parser = require('postcss/lib/parser')
|
||||
|
||||
class SafeParser extends Parser {
|
||||
createTokenizer() {
|
||||
this.tokenizer = tokenizer(this.input, { ignoreErrors: true })
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
let 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 = ''
|
||||
} else {
|
||||
let match = text.match(/^(\s*)([^]*\S)(\s*)$/)
|
||||
node.text = match[2]
|
||||
node.raws.left = match[1]
|
||||
node.raws.right = match[3]
|
||||
}
|
||||
}
|
||||
|
||||
decl(tokens) {
|
||||
if (tokens.length > 1 && tokens.some(i => i[0] === 'word')) {
|
||||
super.decl(tokens)
|
||||
}
|
||||
}
|
||||
|
||||
unclosedBracket() {}
|
||||
|
||||
unknownWord(tokens) {
|
||||
this.spaces += tokens.map(i => i[1]).join('')
|
||||
}
|
||||
|
||||
unexpectedClose() {
|
||||
this.current.raws.after += '}'
|
||||
}
|
||||
|
||||
doubleColon() {}
|
||||
|
||||
unnamedAtrule(node) {
|
||||
node.name = ''
|
||||
}
|
||||
|
||||
precheckMissedSemicolon(tokens) {
|
||||
let colon = this.colon(tokens)
|
||||
if (colon === false) return
|
||||
|
||||
let nextStart, prevEnd
|
||||
for (nextStart = colon - 1; nextStart >= 0; nextStart--) {
|
||||
if (tokens[nextStart][0] === 'word') break
|
||||
}
|
||||
if (nextStart === 0) return
|
||||
|
||||
for (prevEnd = nextStart - 1; prevEnd >= 0; prevEnd--) {
|
||||
if (tokens[prevEnd][0] !== 'space') {
|
||||
prevEnd += 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
let other = tokens.slice(nextStart)
|
||||
let spaces = tokens.slice(prevEnd, nextStart)
|
||||
tokens.splice(prevEnd, tokens.length - prevEnd)
|
||||
this.spaces = spaces.map(i => i[1]).join('')
|
||||
|
||||
this.decl(other)
|
||||
}
|
||||
|
||||
checkMissedSemicolon() {}
|
||||
|
||||
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
|
||||
|
||||
while (this.current.parent) {
|
||||
this.current = this.current.parent
|
||||
this.current.raws.after = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SafeParser
|
26
node_modules/postcss-safe-parser/package.json
generated
vendored
Normal file
26
node_modules/postcss-safe-parser/package.json
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "postcss-safe-parser",
|
||||
"version": "6.0.0",
|
||||
"description": "Fault-tolerant CSS parser for PostCSS",
|
||||
"keywords": [
|
||||
"css",
|
||||
"postcss",
|
||||
"postcss-syntax",
|
||||
"parser",
|
||||
"fault tolerant"
|
||||
],
|
||||
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
||||
"license": "MIT",
|
||||
"repository": "postcss/postcss-safe-parser",
|
||||
"engines": {
|
||||
"node": ">=12.0"
|
||||
},
|
||||
"main": "lib/safe-parse",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.3.3"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user