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,12 +1,16 @@
'use strict';
import { removeLeadingZero } from '../lib/svgo/tools.js';
const { removeLeadingZero } = require('../lib/svgo/tools');
/**
* @typedef CleanupNumericValuesParams
* @property {number=} floatPrecision
* @property {boolean=} leadingZero
* @property {boolean=} defaultPx
* @property {boolean=} convertToPx
*/
exports.name = 'cleanupNumericValues';
exports.type = 'visitor';
exports.active = true;
exports.description =
'rounds numeric values to the fixed precision, removes default px units';
export const name = 'cleanupNumericValues';
export const description =
'rounds numeric values to the fixed precision, removes default "px" units';
const regNumericValues =
/^([-+]?\d*\.?\d+([eE][-+]?\d+)?)(px|pt|pc|mm|cm|m|in|ft|em|ex|%)?$/;
@@ -22,19 +26,13 @@ const absoluteLengths = {
};
/**
* Round numeric values to the fixed precision,
* remove default 'px' units.
* Round numeric values to the fixed precision, remove default 'px' units.
*
* @author Kir Belevich
*
* @type {import('../lib/types').Plugin<{
* floatPrecision?: number,
* leadingZero?: boolean,
* defaultPx?: boolean,
* convertToPx?: boolean
* }>}
* @type {import('../lib/types.js').Plugin<CleanupNumericValuesParams>}
*/
exports.fn = (_root, params) => {
export const fn = (_root, params) => {
const {
floatPrecision = 3,
leadingZero = true,
@@ -46,7 +44,7 @@ exports.fn = (_root, params) => {
element: {
enter: (node) => {
if (node.attributes.viewBox != null) {
const nums = node.attributes.viewBox.split(/\s,?\s*|,\s*/g);
const nums = node.attributes.viewBox.trim().split(/(?:\s,?|,)\s*/g);
node.attributes.viewBox = nums
.map((value) => {
const num = Number(value);
@@ -63,27 +61,23 @@ exports.fn = (_root, params) => {
continue;
}
const match = value.match(regNumericValues);
const match = regNumericValues.exec(value);
// if attribute value matches regNumericValues
if (match) {
// round it to the fixed precision
let num = Number(Number(match[1]).toFixed(floatPrecision));
/**
* @type {any}
*/
let matchedUnit = match[3] || '';
/**
* @type{'' | keyof typeof absoluteLengths}
*/
/** @type {any} */
const matchedUnit = match[3] || '';
/** @type {'' | keyof typeof absoluteLengths} */
let units = matchedUnit;
// convert absolute values to pixels
if (convertToPx && units !== '' && units in absoluteLengths) {
const pxNum = Number(
(absoluteLengths[units] * Number(match[1])).toFixed(
floatPrecision
)
floatPrecision,
),
);
if (pxNum.toString().length < match[0].length) {
num = pxNum;