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:
73
node_modules/csso/cjs/clean/Atrule.cjs
generated
vendored
Normal file
73
node_modules/csso/cjs/clean/Atrule.cjs
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
const cssTree = require('css-tree');
|
||||
const utils = require('./utils.cjs');
|
||||
|
||||
function cleanAtrule(node, item, list) {
|
||||
if (node.block) {
|
||||
// otherwise removed at-rule don't prevent @import for removal
|
||||
if (this.stylesheet !== null) {
|
||||
this.stylesheet.firstAtrulesAllowed = false;
|
||||
}
|
||||
|
||||
if (utils.hasNoChildren(node.block)) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.name) {
|
||||
case 'charset':
|
||||
if (utils.hasNoChildren(node.prelude)) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
// if there is any rule before @charset -> remove it
|
||||
if (item.prev) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'import':
|
||||
if (this.stylesheet === null || !this.stylesheet.firstAtrulesAllowed) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
// if there are some rules that not an @import or @charset before @import
|
||||
// remove it
|
||||
list.prevUntil(item.prev, function(rule) {
|
||||
if (rule.type === 'Atrule') {
|
||||
if (rule.name === 'import' || rule.name === 'charset') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.root.firstAtrulesAllowed = false;
|
||||
list.remove(item);
|
||||
|
||||
return true;
|
||||
}, this);
|
||||
|
||||
break;
|
||||
|
||||
default: {
|
||||
const name = cssTree.keyword(node.name).basename;
|
||||
|
||||
if (name === 'keyframes' ||
|
||||
name === 'media' ||
|
||||
name === 'supports') {
|
||||
|
||||
// drop at-rule with no prelude
|
||||
if (utils.hasNoChildren(node.prelude) || utils.hasNoChildren(node.block)) {
|
||||
list.remove(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = cleanAtrule;
|
||||
7
node_modules/csso/cjs/clean/Comment.cjs
generated
vendored
Normal file
7
node_modules/csso/cjs/clean/Comment.cjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
function cleanComment(data, item, list) {
|
||||
list.remove(item);
|
||||
}
|
||||
|
||||
module.exports = cleanComment;
|
||||
18
node_modules/csso/cjs/clean/Declaration.cjs
generated
vendored
Normal file
18
node_modules/csso/cjs/clean/Declaration.cjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
const cssTree = require('css-tree');
|
||||
|
||||
function cleanDeclartion(node, item, list) {
|
||||
if (node.value.children && node.value.children.isEmpty) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cssTree.property(node.property).custom) {
|
||||
if (/\S/.test(node.value.value)) {
|
||||
node.value.value = node.value.value.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = cleanDeclartion;
|
||||
13
node_modules/csso/cjs/clean/Raw.cjs
generated
vendored
Normal file
13
node_modules/csso/cjs/clean/Raw.cjs
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const utils = require('./utils.cjs');
|
||||
|
||||
function cleanRaw(node, item, list) {
|
||||
// raw in stylesheet or block children
|
||||
if (utils.isNodeChildrenList(this.stylesheet, list) ||
|
||||
utils.isNodeChildrenList(this.block, list)) {
|
||||
list.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = cleanRaw;
|
||||
104
node_modules/csso/cjs/clean/Rule.cjs
generated
vendored
Normal file
104
node_modules/csso/cjs/clean/Rule.cjs
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
|
||||
const cssTree = require('css-tree');
|
||||
const utils = require('./utils.cjs');
|
||||
|
||||
const { hasOwnProperty } = Object.prototype;
|
||||
const skipUsageFilteringAtrule = new Set(['keyframes']);
|
||||
|
||||
function cleanUnused(selectorList, usageData) {
|
||||
selectorList.children.forEach((selector, item, list) => {
|
||||
let shouldRemove = false;
|
||||
|
||||
cssTree.walk(selector, function(node) {
|
||||
// ignore nodes in nested selectors
|
||||
if (this.selector === null || this.selector === selectorList) {
|
||||
switch (node.type) {
|
||||
case 'SelectorList':
|
||||
// TODO: remove toLowerCase when pseudo selectors will be normalized
|
||||
// ignore selectors inside :not()
|
||||
if (this.function === null || this.function.name.toLowerCase() !== 'not') {
|
||||
if (cleanUnused(node, usageData)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ClassSelector':
|
||||
if (usageData.whitelist !== null &&
|
||||
usageData.whitelist.classes !== null &&
|
||||
!hasOwnProperty.call(usageData.whitelist.classes, node.name)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
if (usageData.blacklist !== null &&
|
||||
usageData.blacklist.classes !== null &&
|
||||
hasOwnProperty.call(usageData.blacklist.classes, node.name)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'IdSelector':
|
||||
if (usageData.whitelist !== null &&
|
||||
usageData.whitelist.ids !== null &&
|
||||
!hasOwnProperty.call(usageData.whitelist.ids, node.name)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
if (usageData.blacklist !== null &&
|
||||
usageData.blacklist.ids !== null &&
|
||||
hasOwnProperty.call(usageData.blacklist.ids, node.name)) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'TypeSelector':
|
||||
// TODO: remove toLowerCase when type selectors will be normalized
|
||||
// ignore universal selectors
|
||||
if (node.name.charAt(node.name.length - 1) !== '*') {
|
||||
if (usageData.whitelist !== null &&
|
||||
usageData.whitelist.tags !== null &&
|
||||
!hasOwnProperty.call(usageData.whitelist.tags, node.name.toLowerCase())) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
if (usageData.blacklist !== null &&
|
||||
usageData.blacklist.tags !== null &&
|
||||
hasOwnProperty.call(usageData.blacklist.tags, node.name.toLowerCase())) {
|
||||
shouldRemove = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (shouldRemove) {
|
||||
list.remove(item);
|
||||
}
|
||||
});
|
||||
|
||||
return selectorList.children.isEmpty;
|
||||
}
|
||||
|
||||
function cleanRule(node, item, list, options) {
|
||||
if (utils.hasNoChildren(node.prelude) || utils.hasNoChildren(node.block)) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
|
||||
// avoid usage filtering for some at-rules
|
||||
if (this.atrule && skipUsageFilteringAtrule.has(cssTree.keyword(this.atrule.name).basename)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { usage } = options;
|
||||
|
||||
if (usage && (usage.whitelist !== null || usage.blacklist !== null)) {
|
||||
cleanUnused(node.prelude, usage);
|
||||
|
||||
if (utils.hasNoChildren(node.prelude)) {
|
||||
list.remove(item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = cleanRule;
|
||||
23
node_modules/csso/cjs/clean/TypeSelector.cjs
generated
vendored
Normal file
23
node_modules/csso/cjs/clean/TypeSelector.cjs
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
// remove useless universal selector
|
||||
function cleanTypeSelector(node, item, list) {
|
||||
const name = item.data.name;
|
||||
|
||||
// check it's a non-namespaced universal selector
|
||||
if (name !== '*') {
|
||||
return;
|
||||
}
|
||||
|
||||
// remove when universal selector before other selectors
|
||||
const nextType = item.next && item.next.data.type;
|
||||
if (nextType === 'IdSelector' ||
|
||||
nextType === 'ClassSelector' ||
|
||||
nextType === 'AttributeSelector' ||
|
||||
nextType === 'PseudoClassSelector' ||
|
||||
nextType === 'PseudoElementSelector') {
|
||||
list.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = cleanTypeSelector;
|
||||
7
node_modules/csso/cjs/clean/WhiteSpace.cjs
generated
vendored
Normal file
7
node_modules/csso/cjs/clean/WhiteSpace.cjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
function cleanWhitespace(node, item, list) {
|
||||
list.remove(item);
|
||||
}
|
||||
|
||||
module.exports = cleanWhitespace;
|
||||
32
node_modules/csso/cjs/clean/index.cjs
generated
vendored
Normal file
32
node_modules/csso/cjs/clean/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const cssTree = require('css-tree');
|
||||
const Atrule = require('./Atrule.cjs');
|
||||
const Comment = require('./Comment.cjs');
|
||||
const Declaration = require('./Declaration.cjs');
|
||||
const Raw = require('./Raw.cjs');
|
||||
const Rule = require('./Rule.cjs');
|
||||
const TypeSelector = require('./TypeSelector.cjs');
|
||||
const WhiteSpace = require('./WhiteSpace.cjs');
|
||||
|
||||
const handlers = {
|
||||
Atrule,
|
||||
Comment,
|
||||
Declaration,
|
||||
Raw,
|
||||
Rule,
|
||||
TypeSelector,
|
||||
WhiteSpace
|
||||
};
|
||||
|
||||
function clean(ast, options) {
|
||||
cssTree.walk(ast, {
|
||||
leave(node, item, list) {
|
||||
if (handlers.hasOwnProperty(node.type)) {
|
||||
handlers[node.type].call(this, node, item, list, options);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = clean;
|
||||
12
node_modules/csso/cjs/clean/utils.cjs
generated
vendored
Normal file
12
node_modules/csso/cjs/clean/utils.cjs
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
function hasNoChildren(node) {
|
||||
return !node || !node.children || node.children.isEmpty;
|
||||
}
|
||||
|
||||
function isNodeChildrenList(node, list) {
|
||||
return node !== null && node.children === list;
|
||||
}
|
||||
|
||||
exports.hasNoChildren = hasNoChildren;
|
||||
exports.isNodeChildrenList = isNodeChildrenList;
|
||||
Reference in New Issue
Block a user