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:
232
node_modules/cssnano-preset-default/src/index.js
generated
vendored
232
node_modules/cssnano-preset-default/src/index.js
generated
vendored
@@ -43,89 +43,163 @@ const postcssNormalizeDisplayValues = require('postcss-normalize-display-values'
|
||||
const postcssNormalizeTimingFunctions = require('postcss-normalize-timing-functions');
|
||||
const { rawCache } = require('cssnano-utils');
|
||||
|
||||
/** @typedef {{
|
||||
discardComments?: false | import('postcss-discard-comments').Options & { exclude?: true},
|
||||
reduceInitial?: false | { exclude?: true}
|
||||
minifyGradients?: false | { exclude?: true}
|
||||
svgo?: false | import('postcss-svgo').Options & { exclude?: true},
|
||||
reduceTransforms?: false | { exclude?: true}
|
||||
convertValues?: false | import('postcss-convert-values').Options & { exclude?: true},
|
||||
calc?: false | import('postcss-calc').PostCssCalcOptions & { exclude?: true},
|
||||
colormin?: false | Record<string, any> & { exclude?: true},
|
||||
orderedValues?: false | { exclude?: true},
|
||||
minifySelectors?: false | { exclude?: true},
|
||||
minifyParams?: false | { exclude?: true},
|
||||
normalizeCharset?: false | import('postcss-normalize-charset').Options & { exclude?: true},
|
||||
minifyFontValues?: false | import('postcss-minify-font-values').Options & { exclude?: true},
|
||||
normalizeUrl?: false | import('postcss-normalize-url').Options & { exclude?: true},
|
||||
mergeLonghand?: false | { exclude?: true},
|
||||
discardDuplicates?: false | { exclude?: true},
|
||||
discardOverridden?: false | { exclude?: true},
|
||||
normalizeRepeatStyle?: false | { exclude?: true},
|
||||
mergeRules?: false | { exclude?: true},
|
||||
discardEmpty?: false | { exclude?: true},
|
||||
uniqueSelectors?: false | { exclude?: true},
|
||||
normalizeString?: false | import('postcss-normalize-string').Options & { exclude?: true},
|
||||
normalizePositions?: false | { exclude?: true},
|
||||
normalizeWhitespace?: false| { exclude?: true},
|
||||
normalizeUnicode?: false | { exclude?: true},
|
||||
normalizeDisplayValues?: false | { exclude?: true},
|
||||
normalizeTimingFunctions?: false | { exclude?: true},
|
||||
rawCache?: false | { exclude?: true}}} Options */
|
||||
|
||||
const defaultOpts = {
|
||||
convertValues: {
|
||||
length: false,
|
||||
},
|
||||
normalizeCharset: {
|
||||
add: false,
|
||||
},
|
||||
cssDeclarationSorter: {
|
||||
keepOverrides: true,
|
||||
},
|
||||
};
|
||||
/**
|
||||
* @template {object | void} [OptionsExtends=void]
|
||||
* @typedef {false | OptionsExtends & {exclude?: true}} SimpleOptions
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Options} opts
|
||||
* @return {{plugins: [import('postcss').PluginCreator<any>, boolean | Record<string, any> | undefined][]}}
|
||||
* @typedef {object} Options
|
||||
* @property {SimpleOptions<Parameters<typeof cssDeclarationSorter>[0]>} [cssDeclarationSorter]
|
||||
* @property {SimpleOptions<import('postcss-discard-comments').Options>} [discardComments]
|
||||
* @property {SimpleOptions<import('postcss-reduce-initial').Options>} [reduceInitial]
|
||||
* @property {SimpleOptions} [minifyGradients]
|
||||
* @property {SimpleOptions<import('postcss-svgo').Options>} [svgo]
|
||||
* @property {SimpleOptions} [reduceTransforms]
|
||||
* @property {SimpleOptions<import('postcss-convert-values').Options>} [convertValues]
|
||||
* @property {SimpleOptions<import('postcss-calc').PostCssCalcOptions>} [calc]
|
||||
* @property {SimpleOptions<import('postcss-colormin').Options>} [colormin]
|
||||
* @property {SimpleOptions} [orderedValues]
|
||||
* @property {SimpleOptions<import('postcss-minify-selectors').Options>} [minifySelectors]
|
||||
* @property {SimpleOptions<import('postcss-minify-params').Options>} [minifyParams]
|
||||
* @property {SimpleOptions<import('postcss-normalize-charset').Options>} [normalizeCharset]
|
||||
* @property {SimpleOptions<import('postcss-minify-font-values').Options>} [minifyFontValues]
|
||||
* @property {SimpleOptions} [normalizeUrl]
|
||||
* @property {SimpleOptions} [mergeLonghand]
|
||||
* @property {SimpleOptions} [discardDuplicates]
|
||||
* @property {SimpleOptions} [discardOverridden]
|
||||
* @property {SimpleOptions} [normalizeRepeatStyle]
|
||||
* @property {SimpleOptions<import('postcss-merge-rules').Options>} [mergeRules]
|
||||
* @property {SimpleOptions} [discardEmpty]
|
||||
* @property {SimpleOptions} [uniqueSelectors]
|
||||
* @property {SimpleOptions<import('postcss-normalize-string').Options>} [normalizeString]
|
||||
* @property {SimpleOptions} [normalizePositions]
|
||||
* @property {SimpleOptions} [normalizeWhitespace]
|
||||
* @property {SimpleOptions<import('postcss-normalize-unicode').Options>} [normalizeUnicode]
|
||||
* @property {SimpleOptions} [normalizeDisplayValues]
|
||||
* @property {SimpleOptions} [normalizeTimingFunctions]
|
||||
* @property {SimpleOptions} [rawCache]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {{ overrideBrowserslist?: string | string[] }} AutoprefixerOptions
|
||||
* @typedef {Pick<import('browserslist').Options, 'stats' | 'path' | 'env'>} BrowserslistOptions
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {[import('postcss').PluginCreator<any>, keyof Options][]} plugins
|
||||
* @param {Parameters<typeof defaultPreset>[0]} opts
|
||||
* @returns {ReturnType<typeof defaultPreset>["plugins"]}
|
||||
*/
|
||||
function configurePlugins(plugins, opts = {}) {
|
||||
const { overrideBrowserslist, stats, env, path } = opts;
|
||||
|
||||
// Shared Autoprefixer + Browserslist options
|
||||
const sharedProps = {
|
||||
overrideBrowserslist,
|
||||
stats,
|
||||
env,
|
||||
path,
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {Options}
|
||||
*/
|
||||
const defaults = {
|
||||
colormin: {
|
||||
...sharedProps,
|
||||
},
|
||||
convertValues: {
|
||||
length: false,
|
||||
...sharedProps,
|
||||
},
|
||||
mergeRules: {
|
||||
...sharedProps,
|
||||
},
|
||||
minifyParams: {
|
||||
...sharedProps,
|
||||
},
|
||||
normalizeCharset: {
|
||||
add: false,
|
||||
},
|
||||
normalizeUnicode: {
|
||||
...sharedProps,
|
||||
},
|
||||
reduceInitial: {
|
||||
...sharedProps,
|
||||
},
|
||||
cssDeclarationSorter: {
|
||||
keepOverrides: true,
|
||||
},
|
||||
minifySelectors: {
|
||||
sort: true,
|
||||
},
|
||||
svgo: {
|
||||
plugins: [
|
||||
{
|
||||
name: 'preset-default',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
// Merge option properties for each plugin
|
||||
return plugins.map(([plugin, opt]) => {
|
||||
const defaultProps = defaults[opt] ?? {};
|
||||
const presetProps = opts[opt] ?? {};
|
||||
|
||||
return [
|
||||
plugin,
|
||||
presetProps !== false
|
||||
? { ...defaultProps, ...presetProps }
|
||||
: { exclude: true },
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Safe defaults for cssnano which require minimal configuration
|
||||
*
|
||||
* @param {Options & AutoprefixerOptions & BrowserslistOptions} opts
|
||||
* @returns {{ plugins: [import('postcss').PluginCreator<any>, Options[keyof Options]][] }}
|
||||
*/
|
||||
function defaultPreset(opts = {}) {
|
||||
const options = Object.assign({}, defaultOpts, opts);
|
||||
|
||||
/** @type {[import('postcss').PluginCreator<any>, boolean | Record<string, any> | undefined][]} **/
|
||||
const plugins = [
|
||||
[postcssDiscardComments, options.discardComments],
|
||||
[postcssMinifyGradients, options.minifyGradients],
|
||||
[postcssReduceInitial, options.reduceInitial],
|
||||
[postcssSvgo, options.svgo],
|
||||
[postcssNormalizeDisplayValues, options.normalizeDisplayValues],
|
||||
[postcssReduceTransforms, options.reduceTransforms],
|
||||
[postcssColormin, options.colormin],
|
||||
[postcssNormalizeTimingFunctions, options.normalizeTimingFunctions],
|
||||
[postcssCalc, options.calc],
|
||||
[postcssConvertValues, options.convertValues],
|
||||
[postcssOrderedValues, options.orderedValues],
|
||||
[postcssMinifySelectors, options.minifySelectors],
|
||||
[postcssMinifyParams, options.minifyParams],
|
||||
[postcssNormalizeCharset, options.normalizeCharset],
|
||||
[postcssDiscardOverridden, options.discardOverridden],
|
||||
[postcssNormalizeString, options.normalizeString],
|
||||
[postcssNormalizeUnicode, options.normalizeUnicode],
|
||||
[postcssMinifyFontValues, options.minifyFontValues],
|
||||
[postcssNormalizeUrl, options.normalizeUrl],
|
||||
[postcssNormalizeRepeatStyle, options.normalizeRepeatStyle],
|
||||
[postcssNormalizePositions, options.normalizePositions],
|
||||
[postcssNormalizeWhitespace, options.normalizeWhitespace],
|
||||
[postcssMergeLonghand, options.mergeLonghand],
|
||||
[postcssDiscardDuplicates, options.discardDuplicates],
|
||||
[postcssMergeRules, options.mergeRules],
|
||||
[postcssDiscardEmpty, options.discardEmpty],
|
||||
[postcssUniqueSelectors, options.uniqueSelectors],
|
||||
[cssDeclarationSorter, options.cssDeclarationSorter],
|
||||
[rawCache, options.rawCache],
|
||||
];
|
||||
|
||||
return { plugins };
|
||||
return {
|
||||
plugins: configurePlugins(
|
||||
[
|
||||
[postcssDiscardComments, 'discardComments'],
|
||||
[postcssMinifyGradients, 'minifyGradients'],
|
||||
[postcssReduceInitial, 'reduceInitial'],
|
||||
[postcssSvgo, 'svgo'],
|
||||
[postcssNormalizeDisplayValues, 'normalizeDisplayValues'],
|
||||
[postcssReduceTransforms, 'reduceTransforms'],
|
||||
[postcssColormin, 'colormin'],
|
||||
[postcssNormalizeTimingFunctions, 'normalizeTimingFunctions'],
|
||||
[postcssCalc, 'calc'],
|
||||
[postcssConvertValues, 'convertValues'],
|
||||
[postcssOrderedValues, 'orderedValues'],
|
||||
[postcssMinifySelectors, 'minifySelectors'],
|
||||
[postcssMinifyParams, 'minifyParams'],
|
||||
[postcssNormalizeCharset, 'normalizeCharset'],
|
||||
[postcssDiscardOverridden, 'discardOverridden'],
|
||||
[postcssNormalizeString, 'normalizeString'],
|
||||
[postcssNormalizeUnicode, 'normalizeUnicode'],
|
||||
[postcssMinifyFontValues, 'minifyFontValues'],
|
||||
[postcssNormalizeUrl, 'normalizeUrl'],
|
||||
[postcssNormalizeRepeatStyle, 'normalizeRepeatStyle'],
|
||||
[postcssNormalizePositions, 'normalizePositions'],
|
||||
[postcssNormalizeWhitespace, 'normalizeWhitespace'],
|
||||
[postcssMergeLonghand, 'mergeLonghand'],
|
||||
[postcssDiscardDuplicates, 'discardDuplicates'],
|
||||
[postcssMergeRules, 'mergeRules'],
|
||||
[postcssDiscardEmpty, 'discardEmpty'],
|
||||
[postcssUniqueSelectors, 'uniqueSelectors'],
|
||||
[cssDeclarationSorter, 'cssDeclarationSorter'],
|
||||
[rawCache, 'rawCache'],
|
||||
],
|
||||
opts
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = defaultPreset;
|
||||
|
||||
Reference in New Issue
Block a user