@tbela99/css-parser
Version:
CSS parser for node and the browser
53 lines (50 loc) • 1.52 kB
JavaScript
import { ValidationLevel } from '../../ast/types.js';
import '../../ast/minify.js';
import '../../ast/walk.js';
import '../../parser/parse.js';
import '../../renderer/color/utils/constants.js';
import '../../renderer/sourcemap/lib/encode.js';
import '../../parser/utils/config.js';
import { validateFamilyName } from '../syntaxes/family-name.js';
import '../syntaxes/complex-selector.js';
import '../parser/types.js';
import '../parser/parse.js';
import '../config.js';
function validateAtRuleFontFeatureValues(atRule, options, root) {
if (!Array.isArray(atRule.tokens) || atRule.tokens.length == 0) {
// @ts-ignore
return {
valid: ValidationLevel.Drop,
matches: [],
node: null,
syntax: '@' + atRule.nam,
error: 'expected at-rule prelude',
tokens: []
};
}
const result = validateFamilyName(atRule.tokens, atRule);
if (result.valid == ValidationLevel.Drop) {
return result;
}
if (!('chi' in atRule)) {
// @ts-ignore
return {
valid: ValidationLevel.Drop,
matches: [],
node: atRule,
syntax: '@' + atRule.nam,
error: 'expected at-rule body',
tokens: []
};
}
// @ts-ignore
return {
valid: ValidationLevel.Valid,
matches: [],
node: atRule,
syntax: '@' + atRule.nam,
error: '',
tokens: []
};
}
export { validateAtRuleFontFeatureValues };