custom version validator is redundant now

...thanks to 4913ba1d2c
This commit is contained in:
tophf 2021-08-01 18:38:36 +03:00
parent f35bf6a2a5
commit 55046ef68c

View File

@ -5,12 +5,6 @@ const metaParser = (() => {
require(['/vendor/usercss-meta/usercss-meta.min']); /* global usercssMeta */ require(['/vendor/usercss-meta/usercss-meta.min']); /* global usercssMeta */
const {createParser, ParseError} = usercssMeta; const {createParser, ParseError} = usercssMeta;
const PREPROCESSORS = new Set(['default', 'uso', 'stylus', 'less']); const PREPROCESSORS = new Set(['default', 'uso', 'stylus', 'less']);
/** Relaxed semver:
* dot-separated digits sequence e.g. 1 or 1.2 or 1.2.3.4.5
* optional pre-release chunk: "-" followed by dot-separated word characters, "-"
* optional build chunk: "+" followed by dot-separated word characters, "-"
*/
const RX_VER = /^\d+(\.\d+)*(?:-(\w[-\w]*(\.[-\w]+)*))?(?:\+(\w[-\w]*(\.[-\w]+)*))?$/;
const options = { const options = {
validateKey: { validateKey: {
preprocessor: state => { preprocessor: state => {
@ -22,15 +16,6 @@ const metaParser = (() => {
}); });
} }
}, },
version: state => {
if (!RX_VER.test(state.value)) {
throw new ParseError({
code: 'invalidVersion',
message: 'Invalid @version',
index: state.valueIndex,
});
}
},
}, },
validateVar: { validateVar: {
select: state => { select: state => {