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:
70
node_modules/csso/lib/index.js
generated
vendored
70
node_modules/csso/lib/index.js
generated
vendored
@@ -1,35 +1,36 @@
|
||||
var csstree = require('css-tree');
|
||||
var parse = csstree.parse;
|
||||
var compress = require('./compress');
|
||||
var generate = csstree.generate;
|
||||
import { version } from './version.js';
|
||||
import * as syntax from './syntax.js';
|
||||
import * as utils from './utils.js';
|
||||
|
||||
const { parse, generate, compress } = syntax;
|
||||
|
||||
function debugOutput(name, options, startTime, data) {
|
||||
if (options.debug) {
|
||||
console.error('## ' + name + ' done in %d ms\n', Date.now() - startTime);
|
||||
console.error(`## ${name} done in %d ms\n`, Date.now() - startTime);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function createDefaultLogger(level) {
|
||||
var lastDebug;
|
||||
let lastDebug;
|
||||
|
||||
return function logger(title, ast) {
|
||||
var line = title;
|
||||
let line = title;
|
||||
|
||||
if (ast) {
|
||||
line = '[' + ((Date.now() - lastDebug) / 1000).toFixed(3) + 's] ' + line;
|
||||
line = `[${((Date.now() - lastDebug) / 1000).toFixed(3)}s] ${line}`;
|
||||
}
|
||||
|
||||
if (level > 1 && ast) {
|
||||
var css = generate(ast);
|
||||
let css = generate(ast);
|
||||
|
||||
// when level 2, limit css to 256 symbols
|
||||
if (level === 2 && css.length > 256) {
|
||||
css = css.substr(0, 256) + '...';
|
||||
}
|
||||
|
||||
line += '\n ' + css + '\n';
|
||||
line += `\n ${css}\n`;
|
||||
}
|
||||
|
||||
console.error(line);
|
||||
@@ -37,18 +38,8 @@ function createDefaultLogger(level) {
|
||||
};
|
||||
}
|
||||
|
||||
function copy(obj) {
|
||||
var result = {};
|
||||
|
||||
for (var key in obj) {
|
||||
result[key] = obj[key];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function buildCompressOptions(options) {
|
||||
options = copy(options);
|
||||
options = { ...options };
|
||||
|
||||
if (typeof options.logger !== 'function' && options.debug) {
|
||||
options.logger = createDefaultLogger(options.debug);
|
||||
@@ -62,22 +53,20 @@ function runHandler(ast, options, handlers) {
|
||||
handlers = [handlers];
|
||||
}
|
||||
|
||||
handlers.forEach(function(fn) {
|
||||
fn(ast, options);
|
||||
});
|
||||
handlers.forEach(fn => fn(ast, options));
|
||||
}
|
||||
|
||||
function minify(context, source, options) {
|
||||
options = options || {};
|
||||
|
||||
var filename = options.filename || '<unknown>';
|
||||
var result;
|
||||
const filename = options.filename || '<unknown>';
|
||||
let result;
|
||||
|
||||
// parse
|
||||
var ast = debugOutput('parsing', options, Date.now(),
|
||||
const ast = debugOutput('parsing', options, Date.now(),
|
||||
parse(source, {
|
||||
context: context,
|
||||
filename: filename,
|
||||
context,
|
||||
filename,
|
||||
positions: Boolean(options.sourceMap)
|
||||
})
|
||||
);
|
||||
@@ -90,7 +79,7 @@ function minify(context, source, options) {
|
||||
}
|
||||
|
||||
// compress
|
||||
var compressResult = debugOutput('compress', options, Date.now(),
|
||||
const compressResult = debugOutput('compress', options, Date.now(),
|
||||
compress(ast, buildCompressOptions(options))
|
||||
);
|
||||
|
||||
@@ -103,12 +92,14 @@ function minify(context, source, options) {
|
||||
|
||||
// generate
|
||||
if (options.sourceMap) {
|
||||
result = debugOutput('generate(sourceMap: true)', options, Date.now(), (function() {
|
||||
var tmp = generate(compressResult.ast, { sourceMap: true });
|
||||
result = debugOutput('generate(sourceMap: true)', options, Date.now(), (() => {
|
||||
const tmp = generate(compressResult.ast, { sourceMap: true });
|
||||
|
||||
tmp.map._file = filename; // since other tools can relay on file in source map transform chain
|
||||
tmp.map.setSourceContent(filename, source);
|
||||
|
||||
return tmp;
|
||||
}()));
|
||||
})());
|
||||
} else {
|
||||
result = debugOutput('generate', options, Date.now(), {
|
||||
css: generate(compressResult.ast),
|
||||
@@ -127,15 +118,14 @@ function minifyBlock(source, options) {
|
||||
return minify('declarationList', source, options);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
version: require('../package.json').version,
|
||||
export {
|
||||
version,
|
||||
utils,
|
||||
|
||||
// main methods
|
||||
minify: minifyStylesheet,
|
||||
minifyBlock: minifyBlock,
|
||||
minifyStylesheet as minify,
|
||||
minifyBlock,
|
||||
|
||||
// css syntax parser/walkers/generator/etc
|
||||
syntax: Object.assign({
|
||||
compress: compress
|
||||
}, csstree)
|
||||
syntax
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user