convert css-schema.xml to json, remove dependency to xml2js (#81)
This commit is contained in:
Родитель
2717840603
Коммит
d191e1d345
|
@ -9,25 +9,25 @@
|
|||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@mdn/browser-compat-data": "^5.2.45",
|
||||
"@mdn/browser-compat-data": "^5.3.13",
|
||||
"@types/cheerio": "^0.22.31",
|
||||
"@types/got": "^9.6.12",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/turndown": "^5.0.1",
|
||||
"@types/vscode": "^1.76.0",
|
||||
"@types/vscode": "^1.81.0",
|
||||
"cheerio": "1.0.0-rc.12",
|
||||
"mdn-data": "^2.0.31",
|
||||
"mdn-data": "^2.0.33",
|
||||
"turndown": "^7.1.2",
|
||||
"typescript": "^5.0.2"
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "^1.25.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@mdn/browser-compat-data": {
|
||||
"version": "5.2.45",
|
||||
"resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-5.2.45.tgz",
|
||||
"integrity": "sha512-Er03EjYAx3TTMvdBdm6Z3SG4IV0/FWfRJP4CBNtRLWoPVVyp9BdYt/9X4zSFw4GAIOVx6+6r7d8VAw0sbPtMjg==",
|
||||
"version": "5.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-5.3.13.tgz",
|
||||
"integrity": "sha512-58+1nu0GOUsNtuPbSRKI6/oDti++pJ/cSIy0+OgjtGD8dfvAYfVu3+OqsPkHLpRbcBPvf8nJt7NQDK6n9KD5Zw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/cheerio": {
|
||||
|
@ -69,9 +69,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@types/vscode": {
|
||||
"version": "1.76.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.76.0.tgz",
|
||||
"integrity": "sha512-CQcY3+Fe5hNewHnOEAVYj4dd1do/QHliXaknAEYSXx2KEHUzFibDZSKptCon+HPgK55xx20pR+PBJjf0MomnBA==",
|
||||
"version": "1.81.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.81.0.tgz",
|
||||
"integrity": "sha512-YIaCwpT+O2E7WOMq0eCgBEABE++SX3Yl/O02GoMIF2DO3qAtvw7m6BXFYsxnc6XyzwZgh6/s/UG78LSSombl2w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
|
@ -280,9 +280,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/mdn-data": {
|
||||
"version": "2.0.31",
|
||||
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.31.tgz",
|
||||
"integrity": "sha512-BoMtKzFjk2+b5QDi1QtS4XBZtwd1WIBVQSVe9Q6iIgQP+m6KhlbukWM8bp7rYgWXOXzp/cBqgHWU7az4hGV1WA==",
|
||||
"version": "2.0.33",
|
||||
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.33.tgz",
|
||||
"integrity": "sha512-7n9sfbaiI7Eqow7h/ObqtPie0/8x0NR8Mm7wuy9UBGRnpUKaVUpJUgK826lBWWRAcVQ1vEjtP1bXDE+nCXbMzw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
|
@ -353,24 +353,24 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
|
||||
"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
|
||||
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
"node": ">=14.17"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdn/browser-compat-data": {
|
||||
"version": "5.2.45",
|
||||
"resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-5.2.45.tgz",
|
||||
"integrity": "sha512-Er03EjYAx3TTMvdBdm6Z3SG4IV0/FWfRJP4CBNtRLWoPVVyp9BdYt/9X4zSFw4GAIOVx6+6r7d8VAw0sbPtMjg==",
|
||||
"version": "5.3.13",
|
||||
"resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-5.3.13.tgz",
|
||||
"integrity": "sha512-58+1nu0GOUsNtuPbSRKI6/oDti++pJ/cSIy0+OgjtGD8dfvAYfVu3+OqsPkHLpRbcBPvf8nJt7NQDK6n9KD5Zw==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/cheerio": {
|
||||
|
@ -412,9 +412,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@types/vscode": {
|
||||
"version": "1.76.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.76.0.tgz",
|
||||
"integrity": "sha512-CQcY3+Fe5hNewHnOEAVYj4dd1do/QHliXaknAEYSXx2KEHUzFibDZSKptCon+HPgK55xx20pR+PBJjf0MomnBA==",
|
||||
"version": "1.81.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.81.0.tgz",
|
||||
"integrity": "sha512-YIaCwpT+O2E7WOMq0eCgBEABE++SX3Yl/O02GoMIF2DO3qAtvw7m6BXFYsxnc6XyzwZgh6/s/UG78LSSombl2w==",
|
||||
"dev": true
|
||||
},
|
||||
"asynckit": {
|
||||
|
@ -565,9 +565,9 @@
|
|||
}
|
||||
},
|
||||
"mdn-data": {
|
||||
"version": "2.0.31",
|
||||
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.31.tgz",
|
||||
"integrity": "sha512-BoMtKzFjk2+b5QDi1QtS4XBZtwd1WIBVQSVe9Q6iIgQP+m6KhlbukWM8bp7rYgWXOXzp/cBqgHWU7az4hGV1WA==",
|
||||
"version": "2.0.33",
|
||||
"resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.33.tgz",
|
||||
"integrity": "sha512-7n9sfbaiI7Eqow7h/ObqtPie0/8x0NR8Mm7wuy9UBGRnpUKaVUpJUgK826lBWWRAcVQ1vEjtP1bXDE+nCXbMzw==",
|
||||
"dev": true
|
||||
},
|
||||
"mime-db": {
|
||||
|
@ -623,9 +623,9 @@
|
|||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
|
||||
"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
|
||||
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,15 +31,15 @@
|
|||
"update-data": "npm run compile && node ./dist/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mdn/browser-compat-data": "^5.2.45",
|
||||
"@mdn/browser-compat-data": "^5.3.13",
|
||||
"@types/cheerio": "^0.22.31",
|
||||
"@types/got": "^9.6.12",
|
||||
"@types/node": "^18.11.18",
|
||||
"@types/turndown": "^5.0.1",
|
||||
"@types/vscode": "^1.76.0",
|
||||
"@types/vscode": "^1.81.0",
|
||||
"cheerio": "1.0.0-rc.12",
|
||||
"mdn-data": "^2.0.31",
|
||||
"mdn-data": "^2.0.33",
|
||||
"turndown": "^7.1.2",
|
||||
"typescript": "^5.0.2"
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -842,7 +842,7 @@
|
|||
"status": "standard",
|
||||
"syntax": "auto | inter-character | inter-word | none",
|
||||
"browsers": [
|
||||
"E12",
|
||||
"E79",
|
||||
"FF55",
|
||||
"C32",
|
||||
"IE11",
|
||||
|
@ -869,7 +869,7 @@
|
|||
}
|
||||
],
|
||||
"status": "standard",
|
||||
"syntax": "normal | pre | nowrap | pre-wrap | pre-line | break-spaces"
|
||||
"syntax": "normal | pre | nowrap | pre-wrap | pre-line | break-spaces | [ <'white-space-collapse'> || <'text-wrap'> || <'white-space-trim'> ]"
|
||||
},
|
||||
{
|
||||
"name": "word-break",
|
||||
|
@ -2123,7 +2123,7 @@
|
|||
"status": "standard",
|
||||
"syntax": "auto | inter-character | inter-word | none",
|
||||
"browsers": [
|
||||
"E12",
|
||||
"E79",
|
||||
"FF55",
|
||||
"C32",
|
||||
"IE11",
|
||||
|
@ -2150,7 +2150,7 @@
|
|||
}
|
||||
],
|
||||
"status": "standard",
|
||||
"syntax": "normal | pre | nowrap | pre-wrap | pre-line | break-spaces"
|
||||
"syntax": "normal | pre | nowrap | pre-wrap | pre-line | break-spaces | [ <'white-space-collapse'> || <'text-wrap'> || <'white-space-trim'> ]"
|
||||
},
|
||||
{
|
||||
"name": "word-break",
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@mdn/browser-compat-data@^5.2.45":
|
||||
"integrity" "sha512-Er03EjYAx3TTMvdBdm6Z3SG4IV0/FWfRJP4CBNtRLWoPVVyp9BdYt/9X4zSFw4GAIOVx6+6r7d8VAw0sbPtMjg=="
|
||||
"resolved" "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-5.2.45.tgz"
|
||||
"version" "5.2.45"
|
||||
"@mdn/browser-compat-data@^5.3.13":
|
||||
"integrity" "sha512-58+1nu0GOUsNtuPbSRKI6/oDti++pJ/cSIy0+OgjtGD8dfvAYfVu3+OqsPkHLpRbcBPvf8nJt7NQDK6n9KD5Zw=="
|
||||
"resolved" "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-5.3.13.tgz"
|
||||
"version" "5.3.13"
|
||||
|
||||
"@types/cheerio@^0.22.31":
|
||||
"integrity" "sha512-Kt7Cdjjdi2XWSfrZ53v4Of0wG3ZcmaegFXjMmz9tfNrZSkzzo36G0AL1YqSdcIA78Etjt6E609pt5h1xnQkPUw=="
|
||||
|
@ -38,10 +38,10 @@
|
|||
"resolved" "https://registry.npmjs.org/@types/turndown/-/turndown-5.0.1.tgz"
|
||||
"version" "5.0.1"
|
||||
|
||||
"@types/vscode@^1.76.0":
|
||||
"integrity" "sha512-CQcY3+Fe5hNewHnOEAVYj4dd1do/QHliXaknAEYSXx2KEHUzFibDZSKptCon+HPgK55xx20pR+PBJjf0MomnBA=="
|
||||
"resolved" "https://registry.npmjs.org/@types/vscode/-/vscode-1.76.0.tgz"
|
||||
"version" "1.76.0"
|
||||
"@types/vscode@^1.81.0":
|
||||
"integrity" "sha512-YIaCwpT+O2E7WOMq0eCgBEABE++SX3Yl/O02GoMIF2DO3qAtvw7m6BXFYsxnc6XyzwZgh6/s/UG78LSSombl2w=="
|
||||
"resolved" "https://registry.npmjs.org/@types/vscode/-/vscode-1.81.0.tgz"
|
||||
"version" "1.81.0"
|
||||
|
||||
"asynckit@^0.4.0":
|
||||
"integrity" "sha1-x57Zf380y48robyXkLzDZkdLS3k="
|
||||
|
@ -165,10 +165,10 @@
|
|||
"domutils" "^3.0.1"
|
||||
"entities" "^4.4.0"
|
||||
|
||||
"mdn-data@^2.0.31":
|
||||
"integrity" "sha512-BoMtKzFjk2+b5QDi1QtS4XBZtwd1WIBVQSVe9Q6iIgQP+m6KhlbukWM8bp7rYgWXOXzp/cBqgHWU7az4hGV1WA=="
|
||||
"resolved" "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.31.tgz"
|
||||
"version" "2.0.31"
|
||||
"mdn-data@^2.0.33":
|
||||
"integrity" "sha512-7n9sfbaiI7Eqow7h/ObqtPie0/8x0NR8Mm7wuy9UBGRnpUKaVUpJUgK826lBWWRAcVQ1vEjtP1bXDE+nCXbMzw=="
|
||||
"resolved" "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.33.tgz"
|
||||
"version" "2.0.33"
|
||||
|
||||
"mime-db@1.50.0":
|
||||
"integrity" "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A=="
|
||||
|
@ -211,7 +211,7 @@
|
|||
dependencies:
|
||||
"domino" "^2.1.6"
|
||||
|
||||
"typescript@^5.0.2":
|
||||
"integrity" "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw=="
|
||||
"resolved" "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz"
|
||||
"version" "5.0.2"
|
||||
"typescript@^5.2.2":
|
||||
"integrity" "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w=="
|
||||
"resolved" "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz"
|
||||
"version" "5.2.2"
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -7,7 +7,6 @@
|
|||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const xml2js = require('xml2js')
|
||||
|
||||
const { readFile, writeFile } = fs.promises;
|
||||
|
||||
|
@ -324,9 +323,7 @@ function toSource(object, keyName) {
|
|||
|
||||
return result
|
||||
}
|
||||
|
||||
const parser = new xml2js.Parser({ explicitArray: false })
|
||||
const schemaFileName = 'css-schema.xml'
|
||||
const schemaFileName = 'css-schema.json'
|
||||
|
||||
const { addMDNProperties } = require('./mdn/mdn-data-importer');
|
||||
const { addMDNPseudoElements, addMDNPseudoSelectors } = require('./mdn/mdn-data-selector-importer');
|
||||
|
@ -336,7 +333,7 @@ const { applyRelevance } = require('./chromestatus/applyRelevance');
|
|||
async function process() {
|
||||
|
||||
const data = await readFile(path.resolve(__dirname, schemaFileName));
|
||||
const result = await parser.parseStringPromise(data);
|
||||
const result = JSON.parse(data.toString());
|
||||
const atDirectives = toSource(result, 'atDirectives');
|
||||
|
||||
let pseudoClasses = toSource(result, 'pseudoClasses');
|
||||
|
|
|
@ -55,7 +55,7 @@ async function addMDNPseudoElements(vscPseudoElements) {
|
|||
const mdnExcludedPseudoSelectors = [
|
||||
/**
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/CSS/:matches
|
||||
* -moz-any and -webkit-any are already in css-schema.xml
|
||||
* -moz-any and -webkit-any are already in css-schema.json
|
||||
*/
|
||||
':any'
|
||||
]
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
],
|
||||
"devDependencies": {
|
||||
"@mdn/browser-compat-data": "^5.3.11",
|
||||
"mdn-data": "^2.0.33",
|
||||
"xml2js": "^0.4.23"
|
||||
"mdn-data": "^2.0.33"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,21 +11,3 @@ mdn-data@^2.0.33:
|
|||
version "2.0.33"
|
||||
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.33.tgz#4aa2471da4abbb0bbb7436fcf3e4c134081fadef"
|
||||
integrity sha512-7n9sfbaiI7Eqow7h/ObqtPie0/8x0NR8Mm7wuy9UBGRnpUKaVUpJUgK826lBWWRAcVQ1vEjtP1bXDE+nCXbMzw==
|
||||
|
||||
sax@>=0.6.0:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz"
|
||||
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
|
||||
|
||||
xml2js@^0.4.23:
|
||||
version "0.4.23"
|
||||
resolved "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz"
|
||||
integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==
|
||||
dependencies:
|
||||
sax ">=0.6.0"
|
||||
xmlbuilder "~11.0.0"
|
||||
|
||||
xmlbuilder@~11.0.0:
|
||||
version "11.0.1"
|
||||
resolved "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz"
|
||||
integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==
|
||||
|
|
Загрузка…
Ссылка в новой задаче