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

@@ -52,13 +52,15 @@ Pass `false` to disable the module from removing duplicated font families.
##### removeQuotes
Type: `boolean`
Type: `boolean` | `(prop: string) => '' | 'font' | 'font-family' | 'font-weight'`
Default: `true`
Pass `false` to disable the module from removing quotes from font families.
Note that oftentimes, this is a *safe optimisation* & is done safely. For more
details, see [Mathias Bynens' article][mathias].
Pass a function to determine whether a css variable is one of `font`, `font-family`, and `font-weight` to determine whether the variable needs to remove quotes.
## Usage
```js

View File

@@ -1,6 +1,6 @@
{
"name": "postcss-minify-font-values",
"version": "5.1.0",
"version": "7.0.1",
"description": "Minify font declarations with PostCSS",
"main": "src/index.js",
"types": "types/index.d.ts",
@@ -28,13 +28,12 @@
},
"homepage": "https://github.com/cssnano/cssnano",
"engines": {
"node": "^10 || ^12 || >=14.0"
"node": "^18.12.0 || ^20.9.0 || >=22.0"
},
"devDependencies": {
"postcss": "^8.2.15"
"postcss": "^8.5.3"
},
"peerDependencies": {
"postcss": "^8.2.15"
},
"readme": "# postcss-minify-font-values [![Build Status][ci-img]][ci]\n\n> Minify font declarations with PostCSS.\n\nThis module will try to minimise the `font-family`, `font-weight` and `font` shorthand\nproperties; it can unquote font families where necessary, detect & remove\nduplicates, and cut short a declaration after it finds a keyword. For more\nexamples, see the [tests](test).\n\n```css\nh1 {\n font:bold 2.2rem/.9 \"Open Sans Condensed\", sans-serif;\n}\n\np {\n font-family: \"Helvetica Neue\", Arial, sans-serif, Helvetica;\n font-weight: normal;\n}\n```\n\n```css\nh1 {\n font:700 2.2rem/.9 Open Sans Condensed,sans-serif\n}\n\np {\n font-family: Helvetica Neue,Arial,sans-serif;\n font-weight: 400;\n}\n```\n\n## API\n\n### minifyFontValues([options])\n\n#### options\n\n##### removeAfterKeyword\n\nType: `boolean`\nDefault: `false`\n\nPass `true` to remove font families after the module encounters a font keyword,\nfor example `sans-serif`.\n\n##### removeDuplicates\n\nType: `boolean`\nDefault: `true`\n\nPass `false` to disable the module from removing duplicated font families.\n\n##### removeQuotes\n\nType: `boolean`\nDefault: `true`\n\nPass `false` to disable the module from removing quotes from font families.\nNote that oftentimes, this is a *safe optimisation* & is done safely. For more\ndetails, see [Mathias Bynens' article][mathias].\n\n## Usage\n\n```js\npostcss([ require('postcss-minify-font-values') ])\n```\n\nSee [PostCSS] docs for examples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n# License\n\nMIT © [Bogdan Chadkin](mailto:trysound@yandex.ru)\n\n[mathias]: https://mathiasbynens.be/notes/unquoted-font-family\n[PostCSS]: https://github.com/postcss/postcss\n[ci-img]: https://travis-ci.org/cssnano/postcss-minify-font-values.svg\n[ci]: https://travis-ci.org/cssnano/postcss-minify-font-values\n"
"postcss": "^8.4.32"
}
}

View File

@@ -22,27 +22,34 @@ function hasVariableFunction(value) {
*/
function transform(prop, value, opts) {
let lowerCasedProp = prop.toLowerCase();
let variableType = '';
if (lowerCasedProp === 'font-weight' && !hasVariableFunction(value)) {
if (typeof opts.removeQuotes === 'function') {
variableType = opts.removeQuotes(prop);
opts.removeQuotes = true;
}
if (
(lowerCasedProp === 'font-weight' || variableType === 'font-weight') &&
!hasVariableFunction(value)
) {
return minifyWeight(value);
} else if (lowerCasedProp === 'font-family' && !hasVariableFunction(value)) {
} else if (
(lowerCasedProp === 'font-family' || variableType === 'font-family') &&
!hasVariableFunction(value)
) {
const tree = valueParser(value);
tree.nodes = minifyFamily(tree.nodes, opts);
return tree.toString();
} else if (lowerCasedProp === 'font') {
const tree = valueParser(value);
tree.nodes = minifyFont(tree.nodes, opts);
return tree.toString();
} else if (lowerCasedProp === 'font' || variableType === 'font') {
return minifyFont(value, opts);
}
return value;
}
/** @typedef {{removeAfterKeyword?: boolean, removeDuplicates?: boolean, removeQuotes?: boolean}} Options */
/** @typedef {{removeAfterKeyword?: boolean, removeDuplicates?: boolean, removeQuotes?: boolean | ((prop: string) => '' | 'font' | 'font-family' | 'font-weight')}} Options */
/**
* @type {import('postcss').PluginCreator<Options>}

View File

@@ -1,21 +1,46 @@
'use strict';
const { unit } = require('postcss-value-parser');
const valueParser = require('postcss-value-parser');
const keywords = require('./keywords');
const minifyFamily = require('./minify-family');
const minifyWeight = require('./minify-weight');
/**
* Adds missing spaces before strings.
*
* @param toBeSpliced {Set<number>}
* @param {import('postcss-value-parser').Node[]} nodes
* @param {import('../index').Options} opts
* @return {import('postcss-value-parser').Node[]}
* @return {void}
*/
module.exports = function (nodes, opts) {
let i, max, node, family;
function normalizeNodes(nodes, toBeSpliced) {
for (const index of toBeSpliced) {
nodes.splice(
index,
0,
/** @type {import('postcss-value-parser').SpaceNode} */ ({
type: 'space',
value: ' ',
})
);
}
}
/**
* @param {string} unminified
* @param {import('../index').Options} opts
* @return {string}
*/
module.exports = function (unminified, opts) {
const tree = valueParser(unminified);
const nodes = tree.nodes;
let familyStart = NaN;
let hasSize = false;
const toBeSpliced = new Set();
for (i = 0, max = nodes.length; i < max; i += 1) {
node = nodes[i];
for (const [i, node] of nodes.entries()) {
if (node.type === 'string' && i > 0 && nodes[i - 1].type !== 'space') {
toBeSpliced.add(i);
}
if (node.type === 'word') {
if (hasSize) {
@@ -23,7 +48,6 @@ module.exports = function (nodes, opts) {
}
const value = node.value.toLowerCase();
if (
value === 'normal' ||
value === 'inherit' ||
@@ -31,7 +55,7 @@ module.exports = function (nodes, opts) {
value === 'unset'
) {
familyStart = i;
} else if (keywords.style.has(value) || unit(value)) {
} else if (keywords.style.has(value) || valueParser.unit(value)) {
familyStart = i;
} else if (keywords.variant.has(value)) {
familyStart = i;
@@ -40,7 +64,7 @@ module.exports = function (nodes, opts) {
familyStart = i;
} else if (keywords.stretch.has(value)) {
familyStart = i;
} else if (keywords.size.has(value) || unit(value)) {
} else if (keywords.size.has(value) || valueParser.unit(value)) {
familyStart = i;
hasSize = true;
}
@@ -56,9 +80,11 @@ module.exports = function (nodes, opts) {
}
}
normalizeNodes(nodes, toBeSpliced);
familyStart += 2;
family = minifyFamily(nodes.slice(familyStart), opts);
const family = minifyFamily(nodes.slice(familyStart), opts);
return nodes.slice(0, familyStart).concat(family);
tree.nodes = nodes.slice(0, familyStart).concat(family);
return tree.toString();
};

View File

@@ -9,6 +9,6 @@ module.exports = function (value) {
return lowerCasedValue === 'normal'
? '400'
: lowerCasedValue === 'bold'
? '700'
: value;
? '700'
: value;
};

View File

@@ -1,17 +1,18 @@
export = pluginCreator;
/** @typedef {{removeAfterKeyword?: boolean, removeDuplicates?: boolean, removeQuotes?: boolean}} Options */
/** @typedef {{removeAfterKeyword?: boolean, removeDuplicates?: boolean, removeQuotes?: boolean | ((prop: string) => '' | 'font' | 'font-family' | 'font-weight')}} Options */
/**
* @type {import('postcss').PluginCreator<Options>}
* @param {Options} opts
* @return {import('postcss').Plugin}
*/
declare function pluginCreator(opts: Options): import('postcss').Plugin;
declare function pluginCreator(opts: Options): import("postcss").Plugin;
declare namespace pluginCreator {
export { postcss, Options };
}
declare var postcss: true;
type Options = {
removeAfterKeyword?: boolean;
removeDuplicates?: boolean;
removeQuotes?: boolean;
removeQuotes?: boolean | ((prop: string) => "" | "font" | "font-family" | "font-weight");
};
declare var postcss: true;
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AAmDA,8KAA8K;AAE9K;;;;GAIG;AACH,qCAHW,OAAO,GACN,OAAO,SAAS,EAAE,MAAM,CA6CnC;;;;;eAlDa;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,EAAE,GAAG,MAAM,GAAG,aAAa,GAAG,aAAa,CAAC,CAAA;CAAC"}

View File

@@ -1,5 +1,6 @@
export const style: Set<string>;
export const variant: Set<string>;
export const weight: Set<string>;
export const stretch: Set<string>;
export const size: Set<string>;
export let style: Set<string>;
export let variant: Set<string>;
export let weight: Set<string>;
export let stretch: Set<string>;
export let size: Set<string>;
//# sourceMappingURL=keywords.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"keywords.d.ts","sourceRoot":"","sources":["../../src/lib/keywords.js"],"names":[],"mappings":""}

View File

@@ -1,2 +1,3 @@
declare function _exports(nodes: import('postcss-value-parser').Node[], opts: import('../index').Options): import('postcss-value-parser').WordNode[];
declare function _exports(nodes: import("postcss-value-parser").Node[], opts: import("../index").Options): import("postcss-value-parser").WordNode[];
export = _exports;
//# sourceMappingURL=minify-family.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"minify-family.d.ts","sourceRoot":"","sources":["../../src/lib/minify-family.js"],"names":[],"mappings":"AAiLiB,iCAJN,OAAO,sBAAsB,EAAE,IAAI,EAAE,QACrC,OAAO,UAAU,EAAE,OAAO,GACzB,OAAO,sBAAsB,EAAE,QAAQ,EAAE,CAwEpD"}

View File

@@ -1,2 +1,3 @@
declare function _exports(nodes: import('postcss-value-parser').Node[], opts: import('../index').Options): import('postcss-value-parser').Node[];
declare function _exports(unminified: string, opts: import("../index").Options): string;
export = _exports;
//# sourceMappingURL=minify-font.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"minify-font.d.ts","sourceRoot":"","sources":["../../src/lib/minify-font.js"],"names":[],"mappings":"AA+BiB,sCAJN,MAAM,QACN,OAAO,UAAU,EAAE,OAAO,GACzB,MAAM,CA4DjB"}

View File

@@ -1,2 +1,3 @@
declare function _exports(value: string): string;
export = _exports;
//# sourceMappingURL=minify-weight.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"minify-weight.d.ts","sourceRoot":"","sources":["../../src/lib/minify-weight.js"],"names":[],"mappings":"AAKiB,iCAHN,MAAM,GACL,MAAM,CAUjB"}