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:
60
node_modules/svgo/plugins/convertShapeToPath.js
generated
vendored
60
node_modules/svgo/plugins/convertShapeToPath.js
generated
vendored
@@ -1,34 +1,28 @@
|
||||
'use strict';
|
||||
import { stringifyPathData } from '../lib/path.js';
|
||||
import { detachNodeFromParent } from '../lib/xast.js';
|
||||
|
||||
/**
|
||||
* @typedef {import('../lib/types').PathDataItem} PathDataItem
|
||||
* @typedef ConvertShapeToPathParams
|
||||
* @property {boolean=} convertArcs
|
||||
* @property {number=} floatPrecision
|
||||
*/
|
||||
|
||||
const { stringifyPathData } = require('../lib/path.js');
|
||||
const { detachNodeFromParent } = require('../lib/xast.js');
|
||||
|
||||
exports.name = 'convertShapeToPath';
|
||||
exports.type = 'visitor';
|
||||
exports.active = true;
|
||||
exports.description = 'converts basic shapes to more compact path form';
|
||||
export const name = 'convertShapeToPath';
|
||||
export const description = 'converts basic shapes to more compact path form';
|
||||
|
||||
const regNumber = /[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/g;
|
||||
|
||||
/**
|
||||
* Converts basic shape to more compact path.
|
||||
* It also allows further optimizations like
|
||||
* combining paths with similar attributes.
|
||||
* Converts basic shape to more compact path. It also allows further
|
||||
* optimizations like combining paths with similar attributes.
|
||||
*
|
||||
* @see https://www.w3.org/TR/SVG11/shapes.html
|
||||
*
|
||||
* @author Lev Solntsev
|
||||
*
|
||||
* @type {import('../lib/types').Plugin<{
|
||||
* convertArcs?: boolean,
|
||||
* floatPrecision?: number
|
||||
* }>}
|
||||
* @type {import('../lib/types.js').Plugin<ConvertShapeToPathParams>}
|
||||
*/
|
||||
exports.fn = (root, params) => {
|
||||
export const fn = (root, params) => {
|
||||
const { convertArcs = false, floatPrecision: precision } = params;
|
||||
|
||||
return {
|
||||
@@ -49,10 +43,10 @@ exports.fn = (root, params) => {
|
||||
// Values like '100%' compute to NaN, thus running after
|
||||
// cleanupNumericValues when 'px' units has already been removed.
|
||||
// TODO: Calculate sizes from % and non-px units if possible.
|
||||
if (Number.isNaN(x - y + width - height)) return;
|
||||
/**
|
||||
* @type {Array<PathDataItem>}
|
||||
*/
|
||||
if (Number.isNaN(x - y + width - height)) {
|
||||
return;
|
||||
}
|
||||
/** @type {import('../lib/types.js').PathDataItem[]} */
|
||||
const pathData = [
|
||||
{ command: 'M', args: [x, y] },
|
||||
{ command: 'H', args: [x + width] },
|
||||
@@ -74,10 +68,10 @@ exports.fn = (root, params) => {
|
||||
const y1 = Number(node.attributes.y1 || '0');
|
||||
const x2 = Number(node.attributes.x2 || '0');
|
||||
const y2 = Number(node.attributes.y2 || '0');
|
||||
if (Number.isNaN(x1 - y1 + x2 - y2)) return;
|
||||
/**
|
||||
* @type {Array<PathDataItem>}
|
||||
*/
|
||||
if (Number.isNaN(x1 - y1 + x2 - y2)) {
|
||||
return;
|
||||
}
|
||||
/** @type {import('../lib/types.js').PathDataItem[]} */
|
||||
const pathData = [
|
||||
{ command: 'M', args: [x1, y1] },
|
||||
{ command: 'L', args: [x2, y2] },
|
||||
@@ -96,15 +90,13 @@ exports.fn = (root, params) => {
|
||||
node.attributes.points != null
|
||||
) {
|
||||
const coords = (node.attributes.points.match(regNumber) || []).map(
|
||||
Number
|
||||
Number,
|
||||
);
|
||||
if (coords.length < 4) {
|
||||
detachNodeFromParent(node, parentNode);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @type {Array<PathDataItem>}
|
||||
*/
|
||||
/** @type {import('../lib/types.js').PathDataItem[]} */
|
||||
const pathData = [];
|
||||
for (let i = 0; i < coords.length; i += 2) {
|
||||
pathData.push({
|
||||
@@ -128,9 +120,7 @@ exports.fn = (root, params) => {
|
||||
if (Number.isNaN(cx - cy + r)) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @type {Array<PathDataItem>}
|
||||
*/
|
||||
/** @type {import('../lib/types.js').PathDataItem[]} */
|
||||
const pathData = [
|
||||
{ command: 'M', args: [cx, cy - r] },
|
||||
{ command: 'A', args: [r, r, 0, 1, 0, cx, cy + r] },
|
||||
@@ -144,7 +134,7 @@ exports.fn = (root, params) => {
|
||||
delete node.attributes.r;
|
||||
}
|
||||
|
||||
// optionally covert ellipse
|
||||
// optionally convert ellipse
|
||||
if (node.name === 'ellipse' && convertArcs) {
|
||||
const ecx = Number(node.attributes.cx || '0');
|
||||
const ecy = Number(node.attributes.cy || '0');
|
||||
@@ -153,9 +143,7 @@ exports.fn = (root, params) => {
|
||||
if (Number.isNaN(ecx - ecy + rx - ry)) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @type {Array<PathDataItem>}
|
||||
*/
|
||||
/** @type {import('../lib/types.js').PathDataItem[]} */
|
||||
const pathData = [
|
||||
{ command: 'M', args: [ecx, ecy - ry] },
|
||||
{ command: 'A', args: [rx, ry, 0, 1, 0, ecx, ecy + ry] },
|
||||
|
||||
Reference in New Issue
Block a user