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:
89
node_modules/css-tree/lib/generator/create.js
generated
vendored
89
node_modules/css-tree/lib/generator/create.js
generated
vendored
@@ -1,50 +1,70 @@
|
||||
var sourceMap = require('./sourceMap');
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
import { tokenize, Delim, WhiteSpace } from '../tokenizer/index.js';
|
||||
import { generateSourceMap } from './sourceMap.js';
|
||||
import * as tokenBefore from './token-before.js';
|
||||
|
||||
const REVERSESOLIDUS = 0x005c; // U+005C REVERSE SOLIDUS (\)
|
||||
|
||||
function processChildren(node, delimeter) {
|
||||
var list = node.children;
|
||||
var prev = null;
|
||||
if (typeof delimeter === 'function') {
|
||||
let prev = null;
|
||||
|
||||
if (typeof delimeter !== 'function') {
|
||||
list.forEach(this.node, this);
|
||||
} else {
|
||||
list.forEach(function(node) {
|
||||
node.children.forEach(node => {
|
||||
if (prev !== null) {
|
||||
delimeter.call(this, prev);
|
||||
}
|
||||
|
||||
this.node(node);
|
||||
prev = node;
|
||||
}, this);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
node.children.forEach(this.node, this);
|
||||
}
|
||||
|
||||
module.exports = function createGenerator(config) {
|
||||
function processNode(node) {
|
||||
if (hasOwnProperty.call(types, node.type)) {
|
||||
types[node.type].call(this, node);
|
||||
} else {
|
||||
throw new Error('Unknown node type: ' + node.type);
|
||||
}
|
||||
}
|
||||
function processChunk(chunk) {
|
||||
tokenize(chunk, (type, start, end) => {
|
||||
this.token(type, chunk.slice(start, end));
|
||||
});
|
||||
}
|
||||
|
||||
var types = {};
|
||||
export function createGenerator(config) {
|
||||
const types = new Map();
|
||||
|
||||
if (config.node) {
|
||||
for (var name in config.node) {
|
||||
types[name] = config.node[name].generate;
|
||||
for (let [name, item] of Object.entries(config.node)) {
|
||||
const fn = item.generate || item;
|
||||
|
||||
if (typeof fn === 'function') {
|
||||
types.set(name, item.generate || item);
|
||||
}
|
||||
}
|
||||
|
||||
return function(node, options) {
|
||||
var buffer = '';
|
||||
var handlers = {
|
||||
children: processChildren,
|
||||
node: processNode,
|
||||
chunk: function(chunk) {
|
||||
buffer += chunk;
|
||||
let buffer = '';
|
||||
let prevCode = 0;
|
||||
let handlers = {
|
||||
node(node) {
|
||||
if (types.has(node.type)) {
|
||||
types.get(node.type).call(publicApi, node);
|
||||
} else {
|
||||
throw new Error('Unknown node type: ' + node.type);
|
||||
}
|
||||
},
|
||||
result: function() {
|
||||
tokenBefore: tokenBefore.safe,
|
||||
token(type, value) {
|
||||
prevCode = this.tokenBefore(prevCode, type, value);
|
||||
|
||||
this.emit(value, type, false);
|
||||
|
||||
if (type === Delim && value.charCodeAt(0) === REVERSESOLIDUS) {
|
||||
this.emit('\n', WhiteSpace, true);
|
||||
}
|
||||
},
|
||||
emit(value) {
|
||||
buffer += value;
|
||||
},
|
||||
result() {
|
||||
return buffer;
|
||||
}
|
||||
};
|
||||
@@ -55,10 +75,21 @@ module.exports = function createGenerator(config) {
|
||||
}
|
||||
|
||||
if (options.sourceMap) {
|
||||
handlers = sourceMap(handlers);
|
||||
handlers = generateSourceMap(handlers);
|
||||
}
|
||||
|
||||
if (options.mode in tokenBefore) {
|
||||
handlers.tokenBefore = tokenBefore[options.mode];
|
||||
}
|
||||
}
|
||||
|
||||
const publicApi = {
|
||||
node: (node) => handlers.node(node),
|
||||
children: processChildren,
|
||||
token: (type, value) => handlers.token(type, value),
|
||||
tokenize: processChunk
|
||||
};
|
||||
|
||||
handlers.node(node);
|
||||
|
||||
return handlers.result();
|
||||
|
||||
6
node_modules/css-tree/lib/generator/index.js
generated
vendored
6
node_modules/css-tree/lib/generator/index.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
var createGenerator = require('./create');
|
||||
var config = require('../syntax/config/parser');
|
||||
import { createGenerator } from './create.js';
|
||||
import config from '../syntax/config/generator.js';
|
||||
|
||||
module.exports = createGenerator(config);
|
||||
export default createGenerator(config);
|
||||
|
||||
59
node_modules/css-tree/lib/generator/sourceMap.js
generated
vendored
59
node_modules/css-tree/lib/generator/sourceMap.js
generated
vendored
@@ -1,36 +1,33 @@
|
||||
var SourceMapGenerator = require('source-map/lib/source-map-generator').SourceMapGenerator;
|
||||
var trackNodes = {
|
||||
Atrule: true,
|
||||
Selector: true,
|
||||
Declaration: true
|
||||
};
|
||||
import { SourceMapGenerator } from 'source-map-js/lib/source-map-generator.js';
|
||||
|
||||
module.exports = function generateSourceMap(handlers) {
|
||||
var map = new SourceMapGenerator();
|
||||
var line = 1;
|
||||
var column = 0;
|
||||
var generated = {
|
||||
const trackNodes = new Set(['Atrule', 'Selector', 'Declaration']);
|
||||
|
||||
export function generateSourceMap(handlers) {
|
||||
const map = new SourceMapGenerator();
|
||||
const generated = {
|
||||
line: 1,
|
||||
column: 0
|
||||
};
|
||||
var original = {
|
||||
const original = {
|
||||
line: 0, // should be zero to add first mapping
|
||||
column: 0
|
||||
};
|
||||
var sourceMappingActive = false;
|
||||
var activatedGenerated = {
|
||||
const activatedGenerated = {
|
||||
line: 1,
|
||||
column: 0
|
||||
};
|
||||
var activatedMapping = {
|
||||
const activatedMapping = {
|
||||
generated: activatedGenerated
|
||||
};
|
||||
let line = 1;
|
||||
let column = 0;
|
||||
let sourceMappingActive = false;
|
||||
|
||||
var handlersNode = handlers.node;
|
||||
const origHandlersNode = handlers.node;
|
||||
handlers.node = function(node) {
|
||||
if (node.loc && node.loc.start && trackNodes.hasOwnProperty(node.type)) {
|
||||
var nodeLine = node.loc.start.line;
|
||||
var nodeColumn = node.loc.start.column - 1;
|
||||
if (node.loc && node.loc.start && trackNodes.has(node.type)) {
|
||||
const nodeLine = node.loc.start.line;
|
||||
const nodeColumn = node.loc.start.column - 1;
|
||||
|
||||
if (original.line !== nodeLine ||
|
||||
original.column !== nodeColumn) {
|
||||
@@ -51,24 +48,24 @@ module.exports = function generateSourceMap(handlers) {
|
||||
sourceMappingActive = true;
|
||||
map.addMapping({
|
||||
source: node.loc.source,
|
||||
original: original,
|
||||
generated: generated
|
||||
original,
|
||||
generated
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
handlersNode.call(this, node);
|
||||
origHandlersNode.call(this, node);
|
||||
|
||||
if (sourceMappingActive && trackNodes.hasOwnProperty(node.type)) {
|
||||
if (sourceMappingActive && trackNodes.has(node.type)) {
|
||||
activatedGenerated.line = line;
|
||||
activatedGenerated.column = column;
|
||||
}
|
||||
};
|
||||
|
||||
var handlersChunk = handlers.chunk;
|
||||
handlers.chunk = function(chunk) {
|
||||
for (var i = 0; i < chunk.length; i++) {
|
||||
if (chunk.charCodeAt(i) === 10) { // \n
|
||||
const origHandlersEmit = handlers.emit;
|
||||
handlers.emit = function(value, type, auto) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (value.charCodeAt(i) === 10) { // \n
|
||||
line++;
|
||||
column = 0;
|
||||
} else {
|
||||
@@ -76,18 +73,18 @@ module.exports = function generateSourceMap(handlers) {
|
||||
}
|
||||
}
|
||||
|
||||
handlersChunk(chunk);
|
||||
origHandlersEmit(value, type, auto);
|
||||
};
|
||||
|
||||
var handlersResult = handlers.result;
|
||||
const origHandlersResult = handlers.result;
|
||||
handlers.result = function() {
|
||||
if (sourceMappingActive) {
|
||||
map.addMapping(activatedMapping);
|
||||
}
|
||||
|
||||
return {
|
||||
css: handlersResult(),
|
||||
map: map
|
||||
css: origHandlersResult(),
|
||||
map
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
182
node_modules/css-tree/lib/generator/token-before.js
generated
vendored
Normal file
182
node_modules/css-tree/lib/generator/token-before.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
import {
|
||||
WhiteSpace,
|
||||
Delim,
|
||||
Ident,
|
||||
Function as FunctionToken,
|
||||
Url,
|
||||
BadUrl,
|
||||
AtKeyword,
|
||||
Hash,
|
||||
Percentage,
|
||||
Dimension,
|
||||
Number as NumberToken,
|
||||
String as StringToken,
|
||||
Colon,
|
||||
LeftParenthesis,
|
||||
RightParenthesis,
|
||||
CDC
|
||||
} from '../tokenizer/index.js';
|
||||
|
||||
const PLUSSIGN = 0x002B; // U+002B PLUS SIGN (+)
|
||||
const HYPHENMINUS = 0x002D; // U+002D HYPHEN-MINUS (-)
|
||||
|
||||
const code = (type, value) => {
|
||||
if (type === Delim) {
|
||||
type = value;
|
||||
}
|
||||
|
||||
if (typeof type === 'string') {
|
||||
const charCode = type.charCodeAt(0);
|
||||
return charCode > 0x7F ? 0x8000 : charCode << 8;
|
||||
}
|
||||
|
||||
return type;
|
||||
};
|
||||
|
||||
// https://www.w3.org/TR/css-syntax-3/#serialization
|
||||
// The only requirement for serialization is that it must "round-trip" with parsing,
|
||||
// that is, parsing the stylesheet must produce the same data structures as parsing,
|
||||
// serializing, and parsing again, except for consecutive <whitespace-token>s,
|
||||
// which may be collapsed into a single token.
|
||||
|
||||
const specPairs = [
|
||||
[Ident, Ident],
|
||||
[Ident, FunctionToken],
|
||||
[Ident, Url],
|
||||
[Ident, BadUrl],
|
||||
[Ident, '-'],
|
||||
[Ident, NumberToken],
|
||||
[Ident, Percentage],
|
||||
[Ident, Dimension],
|
||||
[Ident, CDC],
|
||||
[Ident, LeftParenthesis],
|
||||
|
||||
[AtKeyword, Ident],
|
||||
[AtKeyword, FunctionToken],
|
||||
[AtKeyword, Url],
|
||||
[AtKeyword, BadUrl],
|
||||
[AtKeyword, '-'],
|
||||
[AtKeyword, NumberToken],
|
||||
[AtKeyword, Percentage],
|
||||
[AtKeyword, Dimension],
|
||||
[AtKeyword, CDC],
|
||||
|
||||
[Hash, Ident],
|
||||
[Hash, FunctionToken],
|
||||
[Hash, Url],
|
||||
[Hash, BadUrl],
|
||||
[Hash, '-'],
|
||||
[Hash, NumberToken],
|
||||
[Hash, Percentage],
|
||||
[Hash, Dimension],
|
||||
[Hash, CDC],
|
||||
|
||||
[Dimension, Ident],
|
||||
[Dimension, FunctionToken],
|
||||
[Dimension, Url],
|
||||
[Dimension, BadUrl],
|
||||
[Dimension, '-'],
|
||||
[Dimension, NumberToken],
|
||||
[Dimension, Percentage],
|
||||
[Dimension, Dimension],
|
||||
[Dimension, CDC],
|
||||
|
||||
['#', Ident],
|
||||
['#', FunctionToken],
|
||||
['#', Url],
|
||||
['#', BadUrl],
|
||||
['#', '-'],
|
||||
['#', NumberToken],
|
||||
['#', Percentage],
|
||||
['#', Dimension],
|
||||
['#', CDC], // https://github.com/w3c/csswg-drafts/pull/6874
|
||||
|
||||
['-', Ident],
|
||||
['-', FunctionToken],
|
||||
['-', Url],
|
||||
['-', BadUrl],
|
||||
['-', '-'],
|
||||
['-', NumberToken],
|
||||
['-', Percentage],
|
||||
['-', Dimension],
|
||||
['-', CDC], // https://github.com/w3c/csswg-drafts/pull/6874
|
||||
|
||||
[NumberToken, Ident],
|
||||
[NumberToken, FunctionToken],
|
||||
[NumberToken, Url],
|
||||
[NumberToken, BadUrl],
|
||||
[NumberToken, NumberToken],
|
||||
[NumberToken, Percentage],
|
||||
[NumberToken, Dimension],
|
||||
[NumberToken, '%'],
|
||||
[NumberToken, CDC], // https://github.com/w3c/csswg-drafts/pull/6874
|
||||
|
||||
['@', Ident],
|
||||
['@', FunctionToken],
|
||||
['@', Url],
|
||||
['@', BadUrl],
|
||||
['@', '-'],
|
||||
['@', CDC], // https://github.com/w3c/csswg-drafts/pull/6874
|
||||
|
||||
['.', NumberToken],
|
||||
['.', Percentage],
|
||||
['.', Dimension],
|
||||
|
||||
['+', NumberToken],
|
||||
['+', Percentage],
|
||||
['+', Dimension],
|
||||
|
||||
['/', '*']
|
||||
];
|
||||
// validate with scripts/generate-safe
|
||||
const safePairs = specPairs.concat([
|
||||
[Ident, Hash],
|
||||
|
||||
[Dimension, Hash],
|
||||
|
||||
[Hash, Hash],
|
||||
|
||||
[AtKeyword, LeftParenthesis],
|
||||
[AtKeyword, StringToken],
|
||||
[AtKeyword, Colon],
|
||||
|
||||
[Percentage, Percentage],
|
||||
[Percentage, Dimension],
|
||||
[Percentage, FunctionToken],
|
||||
[Percentage, '-'],
|
||||
|
||||
[RightParenthesis, Ident],
|
||||
[RightParenthesis, FunctionToken],
|
||||
[RightParenthesis, Percentage],
|
||||
[RightParenthesis, Dimension],
|
||||
[RightParenthesis, Hash],
|
||||
[RightParenthesis, '-']
|
||||
]);
|
||||
|
||||
function createMap(pairs) {
|
||||
const isWhiteSpaceRequired = new Set(
|
||||
pairs.map(([prev, next]) => (code(prev) << 16 | code(next)))
|
||||
);
|
||||
|
||||
return function(prevCode, type, value) {
|
||||
const nextCode = code(type, value);
|
||||
const nextCharCode = value.charCodeAt(0);
|
||||
const emitWs =
|
||||
(nextCharCode === HYPHENMINUS &&
|
||||
type !== Ident &&
|
||||
type !== FunctionToken &&
|
||||
type !== CDC) ||
|
||||
(nextCharCode === PLUSSIGN)
|
||||
? isWhiteSpaceRequired.has(prevCode << 16 | nextCharCode << 8)
|
||||
: isWhiteSpaceRequired.has(prevCode << 16 | nextCode);
|
||||
|
||||
if (emitWs) {
|
||||
this.emit(' ', WhiteSpace, true);
|
||||
}
|
||||
|
||||
return nextCode;
|
||||
};
|
||||
}
|
||||
|
||||
export const spec = createMap(specPairs);
|
||||
export const safe = createMap(safePairs);
|
||||
Reference in New Issue
Block a user