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:
root
2026-01-14 10:38:22 +00:00
parent bb9046af1b
commit d523f0f600
2355 changed files with 231384 additions and 32223 deletions

View File

@@ -1,5 +1,5 @@
var hasOwnProperty = Object.prototype.hasOwnProperty;
var noop = function() {};
const { hasOwnProperty } = Object.prototype;
const noop = function() {};
function ensureFunction(value) {
return typeof value === 'function' ? value : noop;
@@ -14,27 +14,26 @@ function invokeForType(fn, type) {
}
function getWalkersFromStructure(name, nodeType) {
var structure = nodeType.structure;
var walkers = [];
const structure = nodeType.structure;
const walkers = [];
for (var key in structure) {
for (const key in structure) {
if (hasOwnProperty.call(structure, key) === false) {
continue;
}
var fieldTypes = structure[key];
var walker = {
let fieldTypes = structure[key];
const walker = {
name: key,
type: false,
nullable: false
};
if (!Array.isArray(structure[key])) {
fieldTypes = [structure[key]];
if (!Array.isArray(fieldTypes)) {
fieldTypes = [fieldTypes];
}
for (var i = 0; i < fieldTypes.length; i++) {
var fieldType = fieldTypes[i];
for (const fieldType of fieldTypes) {
if (fieldType === null) {
walker.nullable = true;
} else if (typeof fieldType === 'string') {
@@ -60,11 +59,11 @@ function getWalkersFromStructure(name, nodeType) {
}
function getTypesFromConfig(config) {
var types = {};
const types = {};
for (var name in config.node) {
for (const name in config.node) {
if (hasOwnProperty.call(config.node, name)) {
var nodeType = config.node[name];
const nodeType = config.node[name];
if (!nodeType.structure) {
throw new Error('Missed `structure` field in `' + name + '` node type definition');
@@ -78,29 +77,28 @@ function getTypesFromConfig(config) {
}
function createTypeIterator(config, reverse) {
var fields = config.fields.slice();
var contextName = config.context;
var useContext = typeof contextName === 'string';
const fields = config.fields.slice();
const contextName = config.context;
const useContext = typeof contextName === 'string';
if (reverse) {
fields.reverse();
}
return function(node, context, walk, walkReducer) {
var prevContextValue;
let prevContextValue;
if (useContext) {
prevContextValue = context[contextName];
context[contextName] = node;
}
for (var i = 0; i < fields.length; i++) {
var field = fields[i];
var ref = node[field.name];
for (const field of fields) {
const ref = node[field.name];
if (!field.nullable || ref) {
if (field.type === 'list') {
var breakWalk = reverse
const breakWalk = reverse
? ref.reduceRight(walkReducer, false)
: ref.reduce(walkReducer, false);
@@ -119,53 +117,58 @@ function createTypeIterator(config, reverse) {
};
}
function createFastTraveralMap(iterators) {
function createFastTraveralMap({
StyleSheet,
Atrule,
Rule,
Block,
DeclarationList
}) {
return {
Atrule: {
StyleSheet: iterators.StyleSheet,
Atrule: iterators.Atrule,
Rule: iterators.Rule,
Block: iterators.Block
StyleSheet,
Atrule,
Rule,
Block
},
Rule: {
StyleSheet: iterators.StyleSheet,
Atrule: iterators.Atrule,
Rule: iterators.Rule,
Block: iterators.Block
StyleSheet,
Atrule,
Rule,
Block
},
Declaration: {
StyleSheet: iterators.StyleSheet,
Atrule: iterators.Atrule,
Rule: iterators.Rule,
Block: iterators.Block,
DeclarationList: iterators.DeclarationList
StyleSheet,
Atrule,
Rule,
Block,
DeclarationList
}
};
}
module.exports = function createWalker(config) {
var types = getTypesFromConfig(config);
var iteratorsNatural = {};
var iteratorsReverse = {};
var breakWalk = Symbol('break-walk');
var skipNode = Symbol('skip-node');
export function createWalker(config) {
const types = getTypesFromConfig(config);
const iteratorsNatural = {};
const iteratorsReverse = {};
const breakWalk = Symbol('break-walk');
const skipNode = Symbol('skip-node');
for (var name in types) {
for (const name in types) {
if (hasOwnProperty.call(types, name) && types[name] !== null) {
iteratorsNatural[name] = createTypeIterator(types[name], false);
iteratorsReverse[name] = createTypeIterator(types[name], true);
}
}
var fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
var fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
const fastTraversalIteratorsNatural = createFastTraveralMap(iteratorsNatural);
const fastTraversalIteratorsReverse = createFastTraveralMap(iteratorsReverse);
var walk = function(root, options) {
const walk = function(root, options) {
function walkNode(node, item, list) {
var enterRet = enter.call(context, node, item, list);
const enterRet = enter.call(context, node, item, list);
if (enterRet === breakWalk) {
debugger;
return true;
}
@@ -186,15 +189,15 @@ module.exports = function createWalker(config) {
return false;
}
var walkReducer = (ret, data, item, list) => ret || walkNode(data, item, list);
var enter = noop;
var leave = noop;
var iterators = iteratorsNatural;
var context = {
let enter = noop;
let leave = noop;
let iterators = iteratorsNatural;
let walkReducer = (ret, data, item, list) => ret || walkNode(data, item, list);
const context = {
break: breakWalk,
skip: skipNode,
root: root,
root,
stylesheet: null,
atrule: null,
atrulePrelude: null,
@@ -221,7 +224,7 @@ module.exports = function createWalker(config) {
? fastTraversalIteratorsReverse[options.visit]
: fastTraversalIteratorsNatural[options.visit];
} else if (!types.hasOwnProperty(options.visit)) {
throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).join(', ') + ')');
throw new Error('Bad value `' + options.visit + '` for `visit` option (should be: ' + Object.keys(types).sort().join(', ') + ')');
}
enter = invokeForType(enter, options.visit);
@@ -240,7 +243,7 @@ module.exports = function createWalker(config) {
walk.skip = skipNode;
walk.find = function(ast, fn) {
var found = null;
let found = null;
walk(ast, function(node, item, list) {
if (fn.call(this, node, item, list)) {
@@ -253,11 +256,11 @@ module.exports = function createWalker(config) {
};
walk.findLast = function(ast, fn) {
var found = null;
let found = null;
walk(ast, {
reverse: true,
enter: function(node, item, list) {
enter(node, item, list) {
if (fn.call(this, node, item, list)) {
found = node;
return breakWalk;
@@ -269,7 +272,7 @@ module.exports = function createWalker(config) {
};
walk.findAll = function(ast, fn) {
var found = [];
const found = [];
walk(ast, function(node, item, list) {
if (fn.call(this, node, item, list)) {