mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-02 14:12:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
36
web/node_modules/@svgr/babel-plugin-svg-em-dimensions/lib/index.js
generated
vendored
Normal file
36
web/node_modules/@svgr/babel-plugin-svg-em-dimensions/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
const elements = ['svg', 'Svg'];
|
||||
|
||||
const plugin = ({
|
||||
types: t
|
||||
}) => ({
|
||||
visitor: {
|
||||
JSXOpeningElement: {
|
||||
enter(path) {
|
||||
if (!elements.some(element => path.get('name').isJSXIdentifier({
|
||||
name: element
|
||||
}))) return;
|
||||
const requiredAttributes = ['width', 'height'];
|
||||
const attributeValue = '1em';
|
||||
path.get('attributes').forEach(attributePath => {
|
||||
if (!attributePath.isJSXAttribute()) return;
|
||||
const index = requiredAttributes.indexOf(attributePath.node.name.name);
|
||||
if (index === -1) return;
|
||||
const value = attributePath.get('value');
|
||||
value.replaceWith(t.stringLiteral(attributeValue));
|
||||
requiredAttributes.splice(index, 1);
|
||||
});
|
||||
requiredAttributes.forEach(attribute => {
|
||||
path.pushContainer('attributes', t.jsxAttribute(t.jsxIdentifier(attribute), t.stringLiteral(attributeValue)));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
Loading…
Add table
Add a link
Reference in a new issue