mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-12-14 09:52:16 +00:00
larry babby and threejs for glsl
This commit is contained in:
163
webGl/my-threejs-test/node_modules/@parcel/optimizer-htmlnano/lib/HTMLNanoOptimizer.js
generated
vendored
Normal file
163
webGl/my-threejs-test/node_modules/@parcel/optimizer-htmlnano/lib/HTMLNanoOptimizer.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _htmlnano() {
|
||||
const data = _interopRequireDefault(require("htmlnano"));
|
||||
_htmlnano = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _plugin() {
|
||||
const data = require("@parcel/plugin");
|
||||
_plugin = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _posthtml() {
|
||||
const data = _interopRequireDefault(require("posthtml"));
|
||||
_posthtml = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _path() {
|
||||
const data = _interopRequireDefault(require("path"));
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _svgMappings = require("./svgMappings");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _default = exports.default = new (_plugin().Optimizer)({
|
||||
async loadConfig({
|
||||
config,
|
||||
options
|
||||
}) {
|
||||
let userConfig = await config.getConfigFrom(_path().default.join(options.projectRoot, 'index.html'), ['.htmlnanorc', '.htmlnanorc.json', '.htmlnanorc.js', '.htmlnanorc.cjs', '.htmlnanorc.mjs', 'htmlnano.config.js', 'htmlnano.config.cjs', 'htmlnano.config.mjs'], {
|
||||
packageKey: 'htmlnano'
|
||||
});
|
||||
return userConfig === null || userConfig === void 0 ? void 0 : userConfig.contents;
|
||||
},
|
||||
async optimize({
|
||||
bundle,
|
||||
contents,
|
||||
map,
|
||||
config
|
||||
}) {
|
||||
if (!bundle.env.shouldOptimize) {
|
||||
return {
|
||||
contents,
|
||||
map
|
||||
};
|
||||
}
|
||||
if (typeof contents !== 'string') {
|
||||
throw new Error('HTMLNanoOptimizer: Only string contents are currently supported');
|
||||
}
|
||||
const clonedConfig = config || {};
|
||||
|
||||
// $FlowFixMe
|
||||
const presets = _htmlnano().default.presets;
|
||||
const preset = typeof clonedConfig.preset === 'string' ? presets[clonedConfig.preset] : {};
|
||||
delete clonedConfig.preset;
|
||||
const htmlNanoConfig = {
|
||||
// Inline <script> and <style> elements, and style attributes are already
|
||||
// minified before they are re-inserted by the packager.
|
||||
minifyJs: false,
|
||||
minifyCss: false,
|
||||
minifySvg: {
|
||||
plugins: [{
|
||||
name: 'preset-default',
|
||||
params: {
|
||||
overrides: {
|
||||
// Copied from htmlnano defaults.
|
||||
collapseGroups: false,
|
||||
convertShapeToPath: false,
|
||||
// Additional defaults to preserve accessibility information.
|
||||
removeTitle: false,
|
||||
removeDesc: false,
|
||||
removeUnknownsAndDefaults: {
|
||||
keepAriaAttrs: true,
|
||||
keepRoleAttr: true
|
||||
},
|
||||
// Do not minify ids or remove unreferenced elements in
|
||||
// inline SVGs because they could actually be referenced
|
||||
// by a separate inline SVG.
|
||||
cleanupIDs: false
|
||||
}
|
||||
}
|
||||
},
|
||||
// XML namespaces are not required in HTML.
|
||||
'removeXMLNS']
|
||||
},
|
||||
...(preset || {}),
|
||||
...clonedConfig
|
||||
// TODO: Uncomment this line once we update htmlnano, new version isn't out yet
|
||||
// skipConfigLoading: true,
|
||||
};
|
||||
|
||||
let plugins = [(0, _htmlnano().default)(htmlNanoConfig)];
|
||||
|
||||
// $FlowFixMe
|
||||
if (htmlNanoConfig.minifySvg !== false) {
|
||||
plugins.unshift(mapSVG);
|
||||
}
|
||||
return {
|
||||
contents: (await (0, _posthtml().default)(plugins).process(contents, {
|
||||
xmlMode: bundle.type === 'xhtml',
|
||||
closingSingleTag: bundle.type === 'xhtml' ? 'slash' : undefined
|
||||
})).html
|
||||
};
|
||||
}
|
||||
}); // HTML tags and attributes are case insensitive. The HTML transformer normalizes them so it can
|
||||
// more easily process any case. But SVGO requires case sensitive tags and attributes to work correctly.
|
||||
// So map lowercased tag and attribute names back to their case-sensitive equivalents.
|
||||
function mapSVG(node, inSVG = false) {
|
||||
if (Array.isArray(node)) {
|
||||
for (let i = 0; i < node.length; i++) {
|
||||
// $FlowFixMe
|
||||
node[i] = mapSVG(node[i], inSVG);
|
||||
}
|
||||
} else if (node && typeof node === 'object') {
|
||||
let {
|
||||
tag,
|
||||
attrs
|
||||
} = node;
|
||||
|
||||
// SVG in HTML does not require xml namespaces to be declared, but standalone SVG files do.
|
||||
// If unset, add them here so that SVGO doesn't have parse errors.
|
||||
if (tag === 'svg') {
|
||||
if (!attrs) {
|
||||
node.attrs = attrs = {};
|
||||
}
|
||||
if (!attrs.xmlns) {
|
||||
attrs.xmlns = 'http://www.w3.org/2000/svg';
|
||||
}
|
||||
if (!attrs['xmlns:xlink']) {
|
||||
attrs['xmlns:xlink'] = 'http://www.w3.org/1999/xlink';
|
||||
}
|
||||
}
|
||||
if (inSVG || tag === 'svg') {
|
||||
if (_svgMappings.SVG_TAG_NAMES[tag]) {
|
||||
node.tag = _svgMappings.SVG_TAG_NAMES[tag];
|
||||
}
|
||||
if (attrs) {
|
||||
for (let key in attrs) {
|
||||
if (_svgMappings.SVG_ATTRS[key]) {
|
||||
attrs[_svgMappings.SVG_ATTRS[key]] = attrs[key];
|
||||
delete attrs[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.content != null) {
|
||||
mapSVG(node.content, inSVG || tag === 'svg');
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
105
webGl/my-threejs-test/node_modules/@parcel/optimizer-htmlnano/lib/svgMappings.js
generated
vendored
Normal file
105
webGl/my-threejs-test/node_modules/@parcel/optimizer-htmlnano/lib/svgMappings.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SVG_TAG_NAMES = exports.SVG_ATTRS = void 0;
|
||||
// Based on parse5: https://github.com/inikulin/parse5/blob/252819607421a5741cf745bb60c404f023531b0d/packages/parse5/lib/common/foreign-content.js#L54
|
||||
const SVG_TAG_NAMES = exports.SVG_TAG_NAMES = {
|
||||
altglyph: 'altGlyph',
|
||||
altglyphdef: 'altGlyphDef',
|
||||
altglyphitem: 'altGlyphItem',
|
||||
animatecolor: 'animateColor',
|
||||
animatemotion: 'animateMotion',
|
||||
animatetransform: 'animateTransform',
|
||||
clippath: 'clipPath',
|
||||
feblend: 'feBlend',
|
||||
fecolormatrix: 'feColorMatrix',
|
||||
fecomponenttransfer: 'feComponentTransfer',
|
||||
fecomposite: 'feComposite',
|
||||
feconvolvematrix: 'feConvolveMatrix',
|
||||
fediffuselighting: 'feDiffuseLighting',
|
||||
fedisplacementmap: 'feDisplacementMap',
|
||||
fedistantlight: 'feDistantLight',
|
||||
feflood: 'feFlood',
|
||||
fefunca: 'feFuncA',
|
||||
fefuncb: 'feFuncB',
|
||||
fefuncg: 'feFuncG',
|
||||
fefuncr: 'feFuncR',
|
||||
fegaussianblur: 'feGaussianBlur',
|
||||
feimage: 'feImage',
|
||||
femerge: 'feMerge',
|
||||
femergenode: 'feMergeNode',
|
||||
femorphology: 'feMorphology',
|
||||
feoffset: 'feOffset',
|
||||
fepointlight: 'fePointLight',
|
||||
fespecularlighting: 'feSpecularLighting',
|
||||
fespotlight: 'feSpotLight',
|
||||
fetile: 'feTile',
|
||||
feturbulence: 'feTurbulence',
|
||||
foreignobject: 'foreignObject',
|
||||
glyphref: 'glyphRef',
|
||||
lineargradient: 'linearGradient',
|
||||
radialgradient: 'radialGradient',
|
||||
textpath: 'textPath'
|
||||
};
|
||||
const SVG_ATTRS = exports.SVG_ATTRS = {
|
||||
attributename: 'attributeName',
|
||||
attributetype: 'attributeType',
|
||||
basefrequency: 'baseFrequency',
|
||||
baseprofile: 'baseProfile',
|
||||
calcmode: 'calcMode',
|
||||
clippathunits: 'clipPathUnits',
|
||||
diffuseconstant: 'diffuseConstant',
|
||||
edgemode: 'edgeMode',
|
||||
filterunits: 'filterUnits',
|
||||
glyphref: 'glyphRef',
|
||||
gradienttransform: 'gradientTransform',
|
||||
gradientunits: 'gradientUnits',
|
||||
kernelmatrix: 'kernelMatrix',
|
||||
kernelunitlength: 'kernelUnitLength',
|
||||
keypoints: 'keyPoints',
|
||||
keysplines: 'keySplines',
|
||||
keytimes: 'keyTimes',
|
||||
lengthadjust: 'lengthAdjust',
|
||||
limitingconeangle: 'limitingConeAngle',
|
||||
markerheight: 'markerHeight',
|
||||
markerunits: 'markerUnits',
|
||||
markerwidth: 'markerWidth',
|
||||
maskcontentunits: 'maskContentUnits',
|
||||
maskunits: 'maskUnits',
|
||||
numoctaves: 'numOctaves',
|
||||
pathlength: 'pathLength',
|
||||
patterncontentunits: 'patternContentUnits',
|
||||
patterntransform: 'patternTransform',
|
||||
patternunits: 'patternUnits',
|
||||
pointsatx: 'pointsAtX',
|
||||
pointsaty: 'pointsAtY',
|
||||
pointsatz: 'pointsAtZ',
|
||||
preservealpha: 'preserveAlpha',
|
||||
preserveaspectratio: 'preserveAspectRatio',
|
||||
primitiveunits: 'primitiveUnits',
|
||||
refx: 'refX',
|
||||
refy: 'refY',
|
||||
repeatcount: 'repeatCount',
|
||||
repeatdur: 'repeatDur',
|
||||
requiredextensions: 'requiredExtensions',
|
||||
requiredfeatures: 'requiredFeatures',
|
||||
specularconstant: 'specularConstant',
|
||||
specularexponent: 'specularExponent',
|
||||
spreadmethod: 'spreadMethod',
|
||||
startoffset: 'startOffset',
|
||||
stddeviation: 'stdDeviation',
|
||||
stitchtiles: 'stitchTiles',
|
||||
surfacescale: 'surfaceScale',
|
||||
systemlanguage: 'systemLanguage',
|
||||
tablevalues: 'tableValues',
|
||||
targetx: 'targetX',
|
||||
targety: 'targetY',
|
||||
textlength: 'textLength',
|
||||
viewbox: 'viewBox',
|
||||
viewtarget: 'viewTarget',
|
||||
xchannelselector: 'xChannelSelector',
|
||||
ychannelselector: 'yChannelSelector',
|
||||
zoomandpan: 'zoomAndPan'
|
||||
};
|
||||
Reference in New Issue
Block a user