Fix code quality violations and exclude Manifest from checks
Document application modes (development/debug/production) Add global file drop handler, order column normalization, SPA hash fix Serve CDN assets via /_vendor/ URLs instead of merging into bundles Add production minification with license preservation Improve JSON formatting for debugging and production optimization Add CDN asset caching with CSS URL inlining for production builds Add three-mode system (development, debug, production) Update Manifest CLAUDE.md to reflect helper class architecture Refactor Manifest.php into helper classes for better organization Pre-manifest-refactor checkpoint: Add app_mode documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
180
node_modules/css-tree/lib/lexer/match-graph.js
generated
vendored
180
node_modules/css-tree/lib/lexer/match-graph.js
generated
vendored
@@ -1,10 +1,11 @@
|
||||
var parse = require('../definition-syntax/parse');
|
||||
import { parse } from '../definition-syntax/parse.js';
|
||||
|
||||
var MATCH = { type: 'Match' };
|
||||
var MISMATCH = { type: 'Mismatch' };
|
||||
var DISALLOW_EMPTY = { type: 'DisallowEmpty' };
|
||||
var LEFTPARENTHESIS = 40; // (
|
||||
var RIGHTPARENTHESIS = 41; // )
|
||||
export const MATCH = { type: 'Match' };
|
||||
export const MISMATCH = { type: 'Mismatch' };
|
||||
export const DISALLOW_EMPTY = { type: 'DisallowEmpty' };
|
||||
|
||||
const LEFTPARENTHESIS = 40; // (
|
||||
const RIGHTPARENTHESIS = 41; // )
|
||||
|
||||
function createCondition(match, thenBranch, elseBranch) {
|
||||
// reduce node count
|
||||
@@ -23,7 +24,7 @@ function createCondition(match, thenBranch, elseBranch) {
|
||||
|
||||
return {
|
||||
type: 'If',
|
||||
match: match,
|
||||
match,
|
||||
then: thenBranch,
|
||||
else: elseBranch
|
||||
};
|
||||
@@ -46,9 +47,38 @@ function isEnumCapatible(term) {
|
||||
);
|
||||
}
|
||||
|
||||
function groupNode(terms, combinator = ' ', explicit = false) {
|
||||
return {
|
||||
type: 'Group',
|
||||
terms,
|
||||
combinator,
|
||||
disallowEmpty: false,
|
||||
explicit
|
||||
};
|
||||
}
|
||||
|
||||
function replaceTypeInGraph(node, replacements, visited = new Set()) {
|
||||
if (!visited.has(node)) {
|
||||
visited.add(node);
|
||||
|
||||
switch (node.type) {
|
||||
case 'If':
|
||||
node.match = replaceTypeInGraph(node.match, replacements, visited);
|
||||
node.then = replaceTypeInGraph(node.then, replacements, visited);
|
||||
node.else = replaceTypeInGraph(node.else, replacements, visited);
|
||||
break;
|
||||
|
||||
case 'Type':
|
||||
return replacements[node.name] || node;
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
switch (combinator) {
|
||||
case ' ':
|
||||
case ' ': {
|
||||
// Juxtaposing components means that all of them must occur, in the given order.
|
||||
//
|
||||
// a b c
|
||||
@@ -60,10 +90,10 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
// else MISMATCH
|
||||
// else MISMATCH
|
||||
// else MISMATCH
|
||||
var result = MATCH;
|
||||
let result = MATCH;
|
||||
|
||||
for (var i = terms.length - 1; i >= 0; i--) {
|
||||
var term = terms[i];
|
||||
for (let i = terms.length - 1; i >= 0; i--) {
|
||||
const term = terms[i];
|
||||
|
||||
result = createCondition(
|
||||
term,
|
||||
@@ -73,8 +103,9 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
case '|':
|
||||
case '|': {
|
||||
// A bar (|) separates two or more alternatives: exactly one of them must occur.
|
||||
//
|
||||
// a | b | c
|
||||
@@ -87,11 +118,11 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
// then MATCH
|
||||
// else MISMATCH
|
||||
|
||||
var result = MISMATCH;
|
||||
var map = null;
|
||||
let result = MISMATCH;
|
||||
let map = null;
|
||||
|
||||
for (var i = terms.length - 1; i >= 0; i--) {
|
||||
var term = terms[i];
|
||||
for (let i = terms.length - 1; i >= 0; i--) {
|
||||
let term = terms[i];
|
||||
|
||||
// reduce sequence of keywords into a Enum
|
||||
if (isEnumCapatible(term)) {
|
||||
@@ -100,7 +131,7 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
result = createCondition(
|
||||
{
|
||||
type: 'Enum',
|
||||
map: map
|
||||
map
|
||||
},
|
||||
MATCH,
|
||||
result
|
||||
@@ -108,7 +139,7 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
}
|
||||
|
||||
if (map !== null) {
|
||||
var key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
|
||||
const key = (isFunctionType(term.name) ? term.name.slice(0, -1) : term.name).toLowerCase();
|
||||
if (key in map === false) {
|
||||
map[key] = term;
|
||||
continue;
|
||||
@@ -127,8 +158,9 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
case '&&':
|
||||
case '&&': {
|
||||
// A double ampersand (&&) separates two or more components,
|
||||
// all of which must occur, in any order.
|
||||
|
||||
@@ -137,7 +169,7 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
if (terms.length > 5) {
|
||||
return {
|
||||
type: 'MatchOnce',
|
||||
terms: terms,
|
||||
terms,
|
||||
all: true
|
||||
};
|
||||
}
|
||||
@@ -165,11 +197,11 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
// then MATCH
|
||||
// else MISMATCH
|
||||
// else MISMATCH
|
||||
var result = MISMATCH;
|
||||
let result = MISMATCH;
|
||||
|
||||
for (var i = terms.length - 1; i >= 0; i--) {
|
||||
var term = terms[i];
|
||||
var thenClause;
|
||||
for (let i = terms.length - 1; i >= 0; i--) {
|
||||
const term = terms[i];
|
||||
let thenClause;
|
||||
|
||||
if (terms.length > 1) {
|
||||
thenClause = buildGroupMatchGraph(
|
||||
@@ -191,8 +223,9 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
case '||':
|
||||
case '||': {
|
||||
// A double bar (||) separates two or more options:
|
||||
// one or more of them must occur, in any order.
|
||||
|
||||
@@ -201,7 +234,7 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
if (terms.length > 5) {
|
||||
return {
|
||||
type: 'MatchOnce',
|
||||
terms: terms,
|
||||
terms,
|
||||
all: false
|
||||
};
|
||||
}
|
||||
@@ -229,11 +262,11 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
// then MATCH
|
||||
// else MATCH
|
||||
// else MISMATCH
|
||||
var result = atLeastOneTermMatched ? MATCH : MISMATCH;
|
||||
let result = atLeastOneTermMatched ? MATCH : MISMATCH;
|
||||
|
||||
for (var i = terms.length - 1; i >= 0; i--) {
|
||||
var term = terms[i];
|
||||
var thenClause;
|
||||
for (let i = terms.length - 1; i >= 0; i--) {
|
||||
const term = terms[i];
|
||||
let thenClause;
|
||||
|
||||
if (terms.length > 1) {
|
||||
thenClause = buildGroupMatchGraph(
|
||||
@@ -255,12 +288,13 @@ function buildGroupMatchGraph(combinator, terms, atLeastOneTermMatched) {
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildMultiplierMatchGraph(node) {
|
||||
var result = MATCH;
|
||||
var matchTerm = buildMatchGraph(node.term);
|
||||
let result = MATCH;
|
||||
let matchTerm = buildMatchGraphInternal(node.term);
|
||||
|
||||
if (node.max === 0) {
|
||||
// disable repeating of empty match to prevent infinite loop
|
||||
@@ -293,7 +327,7 @@ function buildMultiplierMatchGraph(node) {
|
||||
}
|
||||
} else {
|
||||
// create a match node chain for [min .. max] interval with optional matches
|
||||
for (var i = node.min || 1; i <= node.max; i++) {
|
||||
for (let i = node.min || 1; i <= node.max; i++) {
|
||||
if (node.comma && result !== MATCH) {
|
||||
result = createCondition(
|
||||
{ type: 'Comma', syntax: node },
|
||||
@@ -323,7 +357,7 @@ function buildMultiplierMatchGraph(node) {
|
||||
);
|
||||
} else {
|
||||
// create a match node chain to collect [0 ... min - 1] required matches
|
||||
for (var i = 0; i < node.min - 1; i++) {
|
||||
for (let i = 0; i < node.min - 1; i++) {
|
||||
if (node.comma && result !== MATCH) {
|
||||
result = createCondition(
|
||||
{ type: 'Comma', syntax: node },
|
||||
@@ -343,7 +377,7 @@ function buildMultiplierMatchGraph(node) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function buildMatchGraph(node) {
|
||||
function buildMatchGraphInternal(node) {
|
||||
if (typeof node === 'function') {
|
||||
return {
|
||||
type: 'Generic',
|
||||
@@ -352,10 +386,10 @@ function buildMatchGraph(node) {
|
||||
}
|
||||
|
||||
switch (node.type) {
|
||||
case 'Group':
|
||||
var result = buildGroupMatchGraph(
|
||||
case 'Group': {
|
||||
let result = buildGroupMatchGraph(
|
||||
node.combinator,
|
||||
node.terms.map(buildMatchGraph),
|
||||
node.terms.map(buildMatchGraphInternal),
|
||||
false
|
||||
);
|
||||
|
||||
@@ -368,10 +402,53 @@ function buildMatchGraph(node) {
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
case 'Multiplier':
|
||||
return buildMultiplierMatchGraph(node);
|
||||
|
||||
// https://drafts.csswg.org/css-values-5/#boolean
|
||||
case 'Boolean': {
|
||||
const term = buildMatchGraphInternal(node.term);
|
||||
// <boolean-expr[ <test> ]> = not <boolean-expr-group> | <boolean-expr-group> [ [ and <boolean-expr-group> ]* | [ or <boolean-expr-group> ]* ]
|
||||
const matchNode = buildMatchGraphInternal(groupNode([
|
||||
groupNode([
|
||||
{ type: 'Keyword', name: 'not' },
|
||||
{ type: 'Type', name: '!boolean-group' }
|
||||
]),
|
||||
groupNode([
|
||||
{ type: 'Type', name: '!boolean-group' },
|
||||
groupNode([
|
||||
{ type: 'Multiplier', comma: false, min: 0, max: 0, term: groupNode([
|
||||
{ type: 'Keyword', name: 'and' },
|
||||
{ type: 'Type', name: '!boolean-group' }
|
||||
]) },
|
||||
{ type: 'Multiplier', comma: false, min: 0, max: 0, term: groupNode([
|
||||
{ type: 'Keyword', name: 'or' },
|
||||
{ type: 'Type', name: '!boolean-group' }
|
||||
]) }
|
||||
], '|')
|
||||
])
|
||||
], '|'));
|
||||
// <boolean-expr-group> = <test> | ( <boolean-expr[ <test> ]> ) | <general-enclosed>
|
||||
const booleanGroup = buildMatchGraphInternal(
|
||||
groupNode([
|
||||
{ type: 'Type', name: '!term' },
|
||||
groupNode([
|
||||
{ type: 'Token', value: '(' },
|
||||
{ type: 'Type', name: '!self' },
|
||||
{ type: 'Token', value: ')' }
|
||||
]),
|
||||
{ type: 'Type', name: 'general-enclosed' }
|
||||
], '|')
|
||||
);
|
||||
|
||||
replaceTypeInGraph(booleanGroup, { '!term': term, '!self': matchNode });
|
||||
replaceTypeInGraph(matchNode, { '!boolean-group': booleanGroup });
|
||||
|
||||
return matchNode;
|
||||
}
|
||||
|
||||
case 'Type':
|
||||
case 'Property':
|
||||
return {
|
||||
@@ -436,20 +513,15 @@ function buildMatchGraph(node) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
MATCH: MATCH,
|
||||
MISMATCH: MISMATCH,
|
||||
DISALLOW_EMPTY: DISALLOW_EMPTY,
|
||||
buildMatchGraph: function(syntaxTree, ref) {
|
||||
if (typeof syntaxTree === 'string') {
|
||||
syntaxTree = parse(syntaxTree);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'MatchGraph',
|
||||
match: buildMatchGraph(syntaxTree),
|
||||
syntax: ref || null,
|
||||
source: syntaxTree
|
||||
};
|
||||
export function buildMatchGraph(syntaxTree, ref) {
|
||||
if (typeof syntaxTree === 'string') {
|
||||
syntaxTree = parse(syntaxTree);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
type: 'MatchGraph',
|
||||
match: buildMatchGraphInternal(syntaxTree),
|
||||
syntax: ref || null,
|
||||
source: syntaxTree
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user