update
This commit is contained in:
+6
-1
@@ -1,10 +1,15 @@
|
||||
declare namespace postcssValueParser {
|
||||
interface BaseNode {
|
||||
/**
|
||||
* The offset inside the CSS value at which the node starts
|
||||
* The offset, inclusive, inside the CSS value at which the node starts.
|
||||
*/
|
||||
sourceIndex: number;
|
||||
|
||||
/**
|
||||
* The offset, exclusive, inside the CSS value at which the node ends.
|
||||
*/
|
||||
sourceEndIndex: number;
|
||||
|
||||
/**
|
||||
* The node's characteristic value
|
||||
*/
|
||||
|
||||
+20
-3
@@ -50,6 +50,7 @@ module.exports = function(input) {
|
||||
after = token;
|
||||
} else if (prev && prev.type === "div") {
|
||||
prev.after = token;
|
||||
prev.sourceEndIndex += token.length;
|
||||
} else if (
|
||||
code === comma ||
|
||||
code === colon ||
|
||||
@@ -63,6 +64,7 @@ module.exports = function(input) {
|
||||
tokens.push({
|
||||
type: "space",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: next,
|
||||
value: token
|
||||
});
|
||||
}
|
||||
@@ -94,22 +96,25 @@ module.exports = function(input) {
|
||||
}
|
||||
} while (escape);
|
||||
token.value = value.slice(pos + 1, next);
|
||||
|
||||
token.sourceEndIndex = token.unclosed ? next : next + 1;
|
||||
tokens.push(token);
|
||||
pos = next + 1;
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
// Comments
|
||||
} else if (code === slash && value.charCodeAt(pos + 1) === star) {
|
||||
next = value.indexOf("*/", pos);
|
||||
|
||||
token = {
|
||||
type: "comment",
|
||||
sourceIndex: pos
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: next + 2
|
||||
};
|
||||
|
||||
next = value.indexOf("*/", pos);
|
||||
if (next === -1) {
|
||||
token.unclosed = true;
|
||||
next = value.length;
|
||||
token.sourceEndIndex = next;
|
||||
}
|
||||
|
||||
token.value = value.slice(pos + 2, next);
|
||||
@@ -129,6 +134,7 @@ module.exports = function(input) {
|
||||
tokens.push({
|
||||
type: "word",
|
||||
sourceIndex: pos - before.length,
|
||||
sourceEndIndex: pos + token.length,
|
||||
value: token
|
||||
});
|
||||
pos += 1;
|
||||
@@ -141,6 +147,7 @@ module.exports = function(input) {
|
||||
tokens.push({
|
||||
type: "div",
|
||||
sourceIndex: pos - before.length,
|
||||
sourceEndIndex: pos + token.length,
|
||||
value: token,
|
||||
before: before,
|
||||
after: ""
|
||||
@@ -196,6 +203,7 @@ module.exports = function(input) {
|
||||
{
|
||||
type: "word",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: whitespacePos + 1,
|
||||
value: value.slice(pos, whitespacePos + 1)
|
||||
}
|
||||
];
|
||||
@@ -207,21 +215,25 @@ module.exports = function(input) {
|
||||
token.nodes.push({
|
||||
type: "space",
|
||||
sourceIndex: whitespacePos + 1,
|
||||
sourceEndIndex: next,
|
||||
value: value.slice(whitespacePos + 1, next)
|
||||
});
|
||||
} else {
|
||||
token.after = value.slice(whitespacePos + 1, next);
|
||||
token.sourceEndIndex = next;
|
||||
}
|
||||
} else {
|
||||
token.after = "";
|
||||
token.nodes = [];
|
||||
}
|
||||
pos = next + 1;
|
||||
token.sourceEndIndex = token.unclosed ? next : pos;
|
||||
code = value.charCodeAt(pos);
|
||||
tokens.push(token);
|
||||
} else {
|
||||
balanced += 1;
|
||||
token.after = "";
|
||||
token.sourceEndIndex = pos + 1;
|
||||
tokens.push(token);
|
||||
stack.push(token);
|
||||
tokens = token.nodes = [];
|
||||
@@ -235,8 +247,10 @@ module.exports = function(input) {
|
||||
code = value.charCodeAt(pos);
|
||||
|
||||
parent.after = after;
|
||||
parent.sourceEndIndex += after.length;
|
||||
after = "";
|
||||
balanced -= 1;
|
||||
stack[stack.length - 1].sourceEndIndex = pos;
|
||||
stack.pop();
|
||||
parent = stack[balanced];
|
||||
tokens = parent.nodes;
|
||||
@@ -282,12 +296,14 @@ module.exports = function(input) {
|
||||
tokens.push({
|
||||
type: "unicode-range",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: next,
|
||||
value: token
|
||||
});
|
||||
} else {
|
||||
tokens.push({
|
||||
type: "word",
|
||||
sourceIndex: pos,
|
||||
sourceEndIndex: next,
|
||||
value: token
|
||||
});
|
||||
}
|
||||
@@ -298,6 +314,7 @@ module.exports = function(input) {
|
||||
|
||||
for (pos = stack.length - 1; pos; pos -= 1) {
|
||||
stack[pos].unclosed = true;
|
||||
stack[pos].sourceEndIndex = value.length;
|
||||
}
|
||||
|
||||
return stack[0].nodes;
|
||||
|
||||
+13
-13
@@ -1,25 +1,25 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"postcss-value-parser@4.1.0",
|
||||
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
|
||||
"postcss-value-parser@4.2.0",
|
||||
"/home/node/nuxt"
|
||||
]
|
||||
],
|
||||
"_from": "postcss-value-parser@4.1.0",
|
||||
"_id": "postcss-value-parser@4.1.0",
|
||||
"_from": "postcss-value-parser@4.2.0",
|
||||
"_id": "postcss-value-parser@4.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==",
|
||||
"_integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
|
||||
"_location": "/postcss-value-parser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "postcss-value-parser@4.1.0",
|
||||
"raw": "postcss-value-parser@4.2.0",
|
||||
"name": "postcss-value-parser",
|
||||
"escapedName": "postcss-value-parser",
|
||||
"rawSpec": "4.1.0",
|
||||
"rawSpec": "4.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "4.1.0"
|
||||
"fetchSpec": "4.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/autoprefixer",
|
||||
@@ -27,9 +27,9 @@
|
||||
"/postcss-calc",
|
||||
"/postcss-modules-local-by-default"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz",
|
||||
"_spec": "4.1.0",
|
||||
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
|
||||
"_resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
|
||||
"_spec": "4.2.0",
|
||||
"_where": "/home/node/nuxt",
|
||||
"author": {
|
||||
"name": "Bogdan Chadkin",
|
||||
"email": "trysound@yandex.ru"
|
||||
@@ -84,9 +84,9 @@
|
||||
"scripts": {
|
||||
"lint": "yarn lint:js && yarn lint:prettier",
|
||||
"lint:js": "eslint . --cache",
|
||||
"lint:prettier": "prettier '**/*.js' '**/*.ts' --list-different",
|
||||
"lint:prettier": "prettier \"**/*.js\" \"**/*.ts\" --list-different",
|
||||
"pretest": "yarn lint",
|
||||
"test": "tape test/*.js | tap-spec"
|
||||
},
|
||||
"version": "4.1.0"
|
||||
"version": "4.2.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user