This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute/compare/v4.1.0...v4.2.0) (2019-04-11)
**Note:** Version bump only for package @svgr/babel-plugin-add-jsx-attribute
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,37 @@
# @svgr/babel-plugin-add-jsx-attribute
## Install
```
npm install --save-dev @svgr/babel-plugin-add-jsx-attribute
```
## Usage
**.babelrc**
```json
{
"plugins": [
[
"@svgr/babel-plugin-add-jsx-attribute",
{
"elements": ["svg"],
"attributes": [
{
"name": "width",
"value": "200",
"spread": false,
"literal": false,
"position": "end"
}
]
}
]
]
}
```
## License
MIT

View File

@@ -0,0 +1,102 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
const positionMethod = {
start: 'unshiftContainer',
end: 'pushContainer'
};
const addJSXAttribute = ({
types: t,
template
}, opts) => {
function getAttributeValue({
literal,
value
}) {
if (typeof value === 'boolean') {
return t.jsxExpressionContainer(t.booleanLiteral(value));
}
if (typeof value === 'number') {
return t.jsxExpressionContainer(t.numericLiteral(value));
}
if (typeof value === 'string' && literal) {
return t.jsxExpressionContainer(template.ast(value).expression);
}
if (typeof value === 'string') {
return t.stringLiteral(value);
}
return null;
}
function getAttribute({
spread,
name,
value,
literal
}) {
if (spread) {
return t.jsxSpreadAttribute(t.identifier(name));
}
return t.jsxAttribute(t.jsxIdentifier(name), getAttributeValue({
value,
literal
}));
}
return {
visitor: {
JSXOpeningElement(path) {
if (!opts.elements.includes(path.node.name.name)) return;
opts.attributes.forEach(({
name,
value = null,
spread = false,
literal = false,
position = 'end'
}) => {
const method = positionMethod[position];
const newAttribute = getAttribute({
spread,
name,
value,
literal
});
const attributes = path.get('attributes');
const isEqualAttribute = attribute => {
if (spread) {
return attribute.get('argument').isIdentifier({
name
});
}
return attribute.get('name').isJSXIdentifier({
name
});
};
const replaced = attributes.some(attribute => {
if (!isEqualAttribute(attribute)) return false;
attribute.replaceWith(newAttribute);
return true;
});
if (!replaced) {
path[method]('attributes', newAttribute);
}
});
}
}
};
};
var _default = addJSXAttribute;
exports.default = _default;

View File

@@ -0,0 +1,29 @@
{
"name": "@svgr/babel-plugin-add-jsx-attribute",
"description": "Add JSX attribute",
"version": "5.4.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-add-jsx-attribute",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"gitHead": "e9c9d2fbfbce7a6879c90cd8522101caf2406d42"
}

View File

@@ -0,0 +1,55 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-attribute
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute/compare/v4.1.0...v4.2.0) (2019-04-11)
**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-attribute
## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)
### Bug Fixes
* **babel-plugin:** fix usage of spread attribute([#231](https://github.com/gregberge/svgr/issues/231)) ([4186953](https://github.com/gregberge/svgr/commit/4186953))
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,29 @@
# @svgr/babel-plugin-remove-jsx-attribute
## Install
```
npm install --save-dev @svgr/babel-plugin-remove-jsx-attribute
```
## Usage
**.babelrc**
```json
{
"plugins": [
[
"@svgr/babel-plugin-remove-jsx-attribute",
{
"elements": ["svg"],
"attributes": ["width", "height"]
}
]
]
}
```
## License
MIT

View File

@@ -0,0 +1,23 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
const removeJSXAttribute = (api, opts) => ({
visitor: {
JSXOpeningElement(path) {
if (!opts.elements.includes(path.node.name.name)) return;
path.get('attributes').forEach(attribute => {
const nodeName = attribute.node.name;
if (nodeName && opts.attributes.includes(nodeName.name)) {
attribute.remove();
}
});
}
}
});
var _default = removeJSXAttribute;
exports.default = _default;

View File

@@ -0,0 +1,29 @@
{
"name": "@svgr/babel-plugin-remove-jsx-attribute",
"description": "Remove JSX attribute",
"version": "5.4.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-attribute",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"gitHead": "e9c9d2fbfbce7a6879c90cd8522101caf2406d42"
}

View File

@@ -0,0 +1,36 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-empty-expression/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-empty-expression/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-empty-expression/compare/v4.1.0...v4.2.0) (2019-04-11)
**Note:** Version bump only for package @svgr/babel-plugin-remove-jsx-empty-expression
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,21 @@
# @svgr/babel-plugin-remove-jsx-empty-expression
## Install
```
npm install --save-dev @svgr/babel-plugin-remove-jsx-empty-expression
```
## Usage
**.babelrc**
```json
{
"plugins": ["@svgr/babel-plugin-remove-jsx-empty-expression"]
}
```
## License
MIT

View File

@@ -0,0 +1,17 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
const removeJSXEmptyExpression = () => ({
visitor: {
JSXExpressionContainer(path) {
if (!path.get('expression').isJSXEmptyExpression()) return;
path.remove();
}
}
});
var _default = removeJSXEmptyExpression;
exports.default = _default;

View File

@@ -0,0 +1,29 @@
{
"name": "@svgr/babel-plugin-remove-jsx-empty-expression",
"description": "Remove JSX empty expression",
"version": "5.0.1",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-remove-jsx-empty-expression",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"gitHead": "2c0863b6821ef6b86bd7ad1a0267ba7e07b163ff"
}

View File

@@ -0,0 +1,37 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-replace-jsx-attribute-value/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-replace-jsx-attribute-value/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-replace-jsx-attribute-value/compare/v4.1.0...v4.2.0) (2019-04-11)
**Note:** Version bump only for package @svgr/babel-plugin-replace-jsx-attribute-value
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
* allow dynamic properties in replaceAttrValues option ([15f55fe](https://github.com/gregberge/svgr/commit/15f55fe)), closes [#205](https://github.com/gregberge/svgr/issues/205)
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,31 @@
# @svgr/babel-plugin-replace-jsx-attribute-value
## Install
```
npm install --save-dev @svgr/babel-plugin-replace-jsx-attribute-value
```
## Usage
**.babelrc**
```json
{
"plugins": [
[
"@svgr/babel-plugin-replace-jsx-attribute-value",
{
"values": [
{ "value": "#000", "newValue": "#fff" },
{ "value": "blue", "newValue": "props.color", "literal": true }
]
}
]
]
}
```
## License
MIT

View File

@@ -0,0 +1,52 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
const addJSXAttribute = ({
types: t,
template
}, opts) => {
function getAttributeValue(value, literal) {
if (typeof value === 'string' && literal) {
return t.jsxExpressionContainer(template.ast(value).expression);
}
if (typeof value === 'string') {
return t.stringLiteral(value);
}
if (typeof value === 'boolean') {
return t.jsxExpressionContainer(t.booleanLiteral(value));
}
if (typeof value === 'number') {
return t.jsxExpressionContainer(t.numericLiteral(value));
}
return null;
}
return {
visitor: {
JSXAttribute(path) {
const valuePath = path.get('value');
if (!valuePath.isStringLiteral()) return;
opts.values.forEach(({
value,
newValue,
literal
}) => {
if (!valuePath.isStringLiteral({
value
})) return;
valuePath.replaceWith(getAttributeValue(newValue, literal));
});
}
}
};
};
var _default = addJSXAttribute;
exports.default = _default;

View File

@@ -0,0 +1,29 @@
{
"name": "@svgr/babel-plugin-replace-jsx-attribute-value",
"description": "Replace JSX attribute value",
"version": "5.0.1",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-replace-jsx-attribute-value",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"gitHead": "2c0863b6821ef6b86bd7ad1a0267ba7e07b163ff"
}

View File

@@ -0,0 +1,77 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/babel-plugin-svg-dynamic-title
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v4.3.2...v4.3.3) (2019-09-24)
### Bug Fixes
* **babel-plugin-svg-dynamic-title:** dont render empty title ([#341](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/issues/341)) ([88b24c5](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/commit/88b24c5)), closes [#333](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/issues/333)
## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v4.3.0...v4.3.1) (2019-07-01)
### Bug Fixes
* **titleProp:** handle the existing title case by using element instead of value (children) ([#315](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/issues/315)) ([065e7a9](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/commit/065e7a9))
# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v4.2.0...v4.3.0) (2019-05-28)
### Features
* titleProps fallbacks to svg's title ([#311](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/issues/311)) ([8f92366](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/commit/8f92366))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title/compare/v4.1.0...v4.2.0) (2019-04-11)
**Note:** Version bump only for package @svgr/babel-plugin-svg-dynamic-title
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,21 @@
# @svgr/babel-plugin-svg-dynamic-title
## Install
```
npm install --save-dev @svgr/babel-plugin-svg-dynamic-title
```
## Usage
**.babelrc**
```json
{
"plugins": ["@svgr/babel-plugin-svg-dynamic-title"]
}
```
## License
MIT

View File

@@ -0,0 +1,85 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
const elements = ['svg', 'Svg'];
const plugin = ({
types: t
}) => ({
visitor: {
JSXElement(path) {
if (!elements.some(element => path.get('openingElement.name').isJSXIdentifier({
name: element
}))) {
return;
}
function createTitle(children = [], attributes = []) {
return t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier('title'), attributes), t.jsxClosingElement(t.jsxIdentifier('title')), children);
}
function createTitleIdAttribute() {
return t.jsxAttribute(t.jsxIdentifier('id'), t.jsxExpressionContainer(t.identifier('titleId')));
}
function enhanceAttributes(attributes) {
const existingId = attributes.find(attribute => attribute.name.name === 'id');
if (!existingId) {
return [...attributes, createTitleIdAttribute()];
}
existingId.value = t.jsxExpressionContainer(t.logicalExpression('||', t.identifier('titleId'), existingId.value));
return attributes;
}
function getTitleElement(existingTitle) {
const titleExpression = t.identifier('title');
if (existingTitle) {
existingTitle.openingElement.attributes = enhanceAttributes(existingTitle.openingElement.attributes);
}
let titleElement = t.conditionalExpression(titleExpression, createTitle([t.jsxExpressionContainer(titleExpression)], existingTitle ? existingTitle.openingElement.attributes : [t.jsxAttribute(t.jsxIdentifier('id'), t.jsxExpressionContainer(t.identifier('titleId')))]), t.nullLiteral());
if (existingTitle && existingTitle.children && existingTitle.children.length) {
// if title already exists
// render as follows
const fallbackTitleElement = existingTitle; // {title === undefined ? fallbackTitleElement : titleElement}
const conditionalExpressionForTitle = t.conditionalExpression(t.binaryExpression('===', titleExpression, t.identifier('undefined')), fallbackTitleElement, titleElement);
titleElement = t.jsxExpressionContainer(conditionalExpressionForTitle);
} else {
titleElement = t.jsxExpressionContainer(titleElement);
}
return titleElement;
} // store the title element
let titleElement;
const hasTitle = path.get('children').some(childPath => {
if (!childPath.isJSXElement()) return false;
if (childPath.node === titleElement) return false;
if (childPath.node.openingElement.name.name !== 'title') return false;
titleElement = getTitleElement(childPath.node);
childPath.replaceWith(titleElement);
return true;
}); // create a title element if not already create
titleElement = titleElement || getTitleElement();
if (!hasTitle) {
// path.unshiftContainer is not working well :(
// path.unshiftContainer('children', titleElement)
path.node.children.unshift(titleElement);
path.replaceWith(path.node);
}
}
}
});
var _default = plugin;
exports.default = _default;

View File

@@ -0,0 +1,29 @@
{
"name": "@svgr/babel-plugin-svg-dynamic-title",
"description": "Transform SVG by adding a dynamic title element",
"version": "5.4.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-dynamic-title",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"gitHead": "e9c9d2fbfbce7a6879c90cd8522101caf2406d42"
}

View File

@@ -0,0 +1,44 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/babel-plugin-svg-em-dimensions
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions/compare/v4.1.0...v4.2.0) (2019-04-11)
**Note:** Version bump only for package @svgr/babel-plugin-svg-em-dimensions
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,21 @@
# @svgr/babel-plugin-svg-em-dimensions
## Install
```
npm install --save-dev @svgr/babel-plugin-svg-em-dimensions
```
## Usage
**.babelrc**
```json
{
"plugins": ["@svgr/babel-plugin-svg-em-dimensions"]
}
```
## License
MIT

View 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;

View File

@@ -0,0 +1,29 @@
{
"name": "@svgr/babel-plugin-svg-em-dimensions",
"description": "Transform SVG to use em-based dimensions",
"version": "5.4.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-svg-em-dimensions",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"gitHead": "e9c9d2fbfbce7a6879c90cd8522101caf2406d42"
}

View File

@@ -0,0 +1,50 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/compare/v5.3.1...v5.4.0) (2020-04-27)
### Features
* add `ForeignObject` support for react native ([#430](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/issues/430)) ([1b56b85](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/commit/1b56b851478803d40105ce63c70e457bd3183da6))
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/compare/v4.1.0...v4.2.0) (2019-04-11)
### Features
* add expo option ([#289](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/issues/289)) ([978db3e](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg/commit/978db3e))
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,21 @@
# @svgr/babel-plugin-transform-react-native-svg
## Install
```
npm install --save-dev @svgr/babel-plugin-transform-react-native-svg
```
## Usage
**.babelrc**
```json
{
"plugins": ["@svgr/babel-plugin-transform-react-native-svg"]
}
```
## License
MIT

View File

@@ -0,0 +1,133 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
const elementToComponent = {
svg: 'Svg',
circle: 'Circle',
clipPath: 'ClipPath',
ellipse: 'Ellipse',
g: 'G',
linearGradient: 'LinearGradient',
radialGradient: 'RadialGradient',
line: 'Line',
path: 'Path',
pattern: 'Pattern',
polygon: 'Polygon',
polyline: 'Polyline',
rect: 'Rect',
symbol: 'Symbol',
text: 'Text',
textPath: 'TextPath',
tspan: 'TSpan',
use: 'Use',
defs: 'Defs',
stop: 'Stop',
mask: 'Mask',
image: 'Image',
foreignObject: 'ForeignObject'
};
const expoPrefix = (component, expo) => {
// Prefix with 'Svg.' in the case we're transforming for Expo
if (!expo) {
return component;
}
return (component !== 'Svg' ? 'Svg.' : '') + component;
};
const plugin = ({
types: t
}, {
expo
}) => {
function replaceElement(path, state) {
const {
name
} = path.node.openingElement.name; // Replace element by react-native-svg components
const component = elementToComponent[name];
if (component) {
const prefixedComponent = expoPrefix(component, expo);
const openingElementName = path.get('openingElement.name');
openingElementName.replaceWith(t.jsxIdentifier(prefixedComponent));
if (path.has('closingElement')) {
const closingElementName = path.get('closingElement.name');
closingElementName.replaceWith(t.jsxIdentifier(prefixedComponent));
}
state.replacedComponents.add(prefixedComponent);
return;
} // Remove element if not supported
state.unsupportedComponents.add(name);
path.remove();
}
const svgElementVisitor = {
JSXElement(path, state) {
if (!path.get('openingElement.name').isJSXIdentifier({
name: 'svg'
})) {
return;
}
replaceElement(path, state);
path.traverse(jsxElementVisitor, state);
}
};
const jsxElementVisitor = {
JSXElement(path, state) {
replaceElement(path, state);
}
};
const importDeclarationVisitor = {
ImportDeclaration(path, state) {
if (path.get('source').isStringLiteral({
value: 'react-native-svg'
})) {
state.replacedComponents.forEach(component => {
if (path.get('specifiers').some(specifier => specifier.get('local').isIdentifier({
name: component
}))) {
return;
}
path.pushContainer('specifiers', t.importSpecifier(t.identifier(component), t.identifier(component)));
});
} else if (path.get('source').isStringLiteral({
value: 'expo'
})) {
path.pushContainer('specifiers', t.importSpecifier(t.identifier('Svg'), t.identifier('Svg')));
} else {
return;
}
if (state.unsupportedComponents.size && !path.has('trailingComments')) {
const componentList = [...state.unsupportedComponents].join(', ');
path.addComment('trailing', ` SVGR has dropped some elements not supported by react-native-svg: ${componentList} `);
}
}
};
return {
visitor: {
Program(path, state) {
state.replacedComponents = new Set();
state.unsupportedComponents = new Set();
path.traverse(svgElementVisitor, state);
path.traverse(importDeclarationVisitor, state);
}
}
};
};
var _default = plugin;
exports.default = _default;

View File

@@ -0,0 +1,29 @@
{
"name": "@svgr/babel-plugin-transform-react-native-svg",
"description": "Transform DOM elements into react-native-svg components",
"version": "5.4.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-react-native-svg",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"gitHead": "e9c9d2fbfbce7a6879c90cd8522101caf2406d42"
}

View File

@@ -0,0 +1,116 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.4.0...v5.5.0) (2020-11-15)
### Bug Fixes
* **typescript:** fix react-native support [#465](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/465) ([#488](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/488)) ([d61e0cf](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/d61e0cface065afc1478fdb44d87ca8177041eab))
### Features
* allow custom name for named export ([#493](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/493)) ([16a58d6](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/16a58d6e817c065f72a68be91600a1a360205f44))
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.3.1...v5.4.0) (2020-04-27)
### Bug Fixes
* wrap svg component directly with memo/forwardRef ([#440](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/440)) ([#441](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/441)) ([a6de2da](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/a6de2dacb63e36572a2167b928418bdc39f3a9c2))
## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.3.0...v5.3.1) (2020-04-05)
### Bug Fixes
* fix typescript types (ref, title) ([#419](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/419)) ([6e7e6b2](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/6e7e6b2e73d26d30f64604e0fc627f9ff94079c2))
# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.2.0...v5.3.0) (2020-03-22)
### Features
* add typescript option ([4596d7b](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/4596d7bb470babb5ec4b87f5281174fb182bd9c7)), closes [#373](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/373)
# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.1.0...v5.2.0) (2020-02-23)
**Note:** Version bump only for package @svgr/babel-plugin-transform-svg-component
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/compare/v4.1.0...v4.2.0) (2019-04-11)
### Features
* add expo option ([#289](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/issues/289)) ([978db3e](https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component/commit/978db3e))
# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)
**Note:** Version bump only for package @svgr/babel-plugin-transform-svg-component
## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)
### Bug Fixes
* **babel-plugin-transform-svg:** support template that only return a single node ([80ac40f](https://github.com/gregberge/svgr/commit/80ac40f)), closes [#223](https://github.com/gregberge/svgr/issues/223)
* **babel-plugin-transform-svg-component:** parsing error of JSX template exports defs ([#225](https://github.com/gregberge/svgr/issues/225)) ([1e56309](https://github.com/gregberge/svgr/commit/1e56309)), closes [/github.com/gregberge/svgr/blob/master/packages/babel-plugin-transform-svg-component/src/util.js#L61](https://github.com//github.com/gregberge/svgr/blob/master/packages/babel-plugin-transform-svg-component/src/util.js/issues/L61)
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,23 @@
# @svgr/babel-plugin-transform-svg-component
## Install
```
npm install --save-dev @svgr/babel-plugin-transform-svg-component
```
## Usage
**.babelrc**
```json
{
"plugins": [
["@svgr/babel-plugin-transform-svg-component", { "titleProp": true }]
]
}
```
## License
MIT

View File

@@ -0,0 +1,67 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _util = require("./util");
function defaultTemplate({
template
}, opts, {
imports,
interfaces,
componentName,
props,
jsx,
exports
}) {
const plugins = ['jsx'];
if (opts.typescript) {
plugins.push('typescript');
}
const typeScriptTpl = template.smart({
plugins
});
return typeScriptTpl.ast`${imports}
${interfaces}
function ${componentName}(${props}) {
return ${jsx};
}
${exports}
`;
}
const plugin = (api, opts) => ({
visitor: {
Program(path) {
const {
types: t
} = api;
const template = opts.template || defaultTemplate;
const body = template(api, opts, {
componentName: t.identifier(opts.state.componentName),
interfaces: (0, _util.getInterface)(api, opts),
props: (0, _util.getProps)(api, opts),
imports: (0, _util.getImport)(api, opts),
exports: (0, _util.getExport)(api, opts),
jsx: path.node.body[0].expression
});
if (Array.isArray(body)) {
path.node.body = body;
} else {
path.node.body = [body];
}
path.replaceWith(path.node);
}
}
});
var _default = plugin;
exports.default = _default;

View File

@@ -0,0 +1,211 @@
"use strict";
exports.__esModule = true;
exports.getExport = exports.getImport = exports.getInterface = exports.getProps = void 0;
function typeAnnotation(typeAnnotation) {
return {
type: 'TypeAnnotation',
typeAnnotation
};
}
function genericTypeAnnotation(id, typeParameters = null) {
return {
type: 'GenericTypeAnnotation',
id,
typeParameters
};
}
function typeParameters(params) {
return {
type: 'TypeParameterInstantiation',
params
};
}
function qualifiedTypeIdentifier(qualification, id) {
return {
type: 'QualifiedTypeIdentifier',
qualification,
id
};
}
function intersectionTypeAnnotation(types) {
return {
type: 'IntersectionTypeAnnotation',
types
};
}
function interfaceDeclaration(id, body) {
return {
type: 'InterfaceDeclaration',
id,
typeParameters: null,
extends: [],
implements: [],
mixins: [],
body
};
}
function objectTypeAnnotation(properties) {
return {
type: 'ObjectTypeAnnotation',
properties
};
}
function objectTypeProperty(key, value, optional = false) {
return {
type: 'ObjectTypeProperty',
key,
static: false,
proto: false,
kind: 'init',
method: false,
value,
variance: null,
optional
};
}
function addTypeAnotation(obj, typeAnnotation, opts) {
if (!opts.typescript) return obj;
return { ...obj,
typeAnnotation
};
}
function getSvgPropsTypeAnnotation(t, opts) {
if (opts.native) {
return t.genericTypeAnnotation(t.identifier('SvgProps'));
}
return genericTypeAnnotation(qualifiedTypeIdentifier(t.identifier('React'), t.identifier('SVGProps')), typeParameters([genericTypeAnnotation(t.identifier('SVGSVGElement'))]));
}
const getProps = ({
types: t
}, opts) => {
const props = [];
if (opts.titleProp) {
props.push(t.objectProperty(t.identifier('title'), t.identifier('title'), false, true));
props.push(t.objectProperty(t.identifier('titleId'), t.identifier('titleId'), false, true));
}
if (opts.expandProps && props.length > 0) {
props.push(t.restElement(t.identifier('props')));
}
const propsArgument = props.length > 0 ? t.objectPattern(props) : t.identifier('props');
let propsTypeAnnotation;
if (props.length > 0) {
propsTypeAnnotation = genericTypeAnnotation(t.identifier('SVGRProps'));
if (opts.expandProps) {
propsTypeAnnotation = intersectionTypeAnnotation([getSvgPropsTypeAnnotation(t, opts), propsTypeAnnotation]);
}
} else {
propsTypeAnnotation = opts.expandProps ? getSvgPropsTypeAnnotation(t, opts) : t.objectPattern([]);
}
const typedPropsArgument = addTypeAnotation(propsArgument, typeAnnotation(propsTypeAnnotation), opts);
const args = [];
if (opts.expandProps || props.length > 0 || opts.ref) args.push(typedPropsArgument);
if (opts.ref) {
const refArgument = t.identifier(opts.typescript ? 'svgRef?' : 'svgRef');
const typedRefArgument = addTypeAnotation(refArgument, typeAnnotation(genericTypeAnnotation(qualifiedTypeIdentifier(t.identifier('React'), t.identifier('Ref')), typeParameters([opts.native ? genericTypeAnnotation(qualifiedTypeIdentifier(t.identifier('React'), t.identifier('Component')), typeParameters([genericTypeAnnotation(t.identifier('SvgProps'))])) : genericTypeAnnotation(t.identifier('SVGSVGElement'))]))), opts);
args.push(typedRefArgument);
}
return args;
};
exports.getProps = getProps;
const getInterface = ({
types: t
}, opts) => {
if (!opts.typescript) return null;
const properties = [];
if (opts.titleProp) {
properties.push(objectTypeProperty(t.identifier('title'), t.identifier('string'), true));
properties.push(objectTypeProperty(t.identifier('titleId'), t.identifier('string'), true));
}
if (properties.length === 0) return null;
return interfaceDeclaration(t.identifier('SVGRProps'), objectTypeAnnotation(properties));
};
exports.getInterface = getInterface;
const getImport = ({
types: t
}, opts) => {
const importDeclarations = [t.importDeclaration([t.importNamespaceSpecifier(t.identifier('React'))], t.stringLiteral('react'))];
if (opts.native) {
if (opts.native.expo) {
importDeclarations.push(t.importDeclaration([], t.stringLiteral('expo')));
} else {
const imports = [t.importDefaultSpecifier(t.identifier('Svg'))];
if (opts.typescript && opts.expandProps) {
imports.push(t.importSpecifier(t.identifier('SvgProps'), t.identifier('SvgProps')));
}
importDeclarations.push(t.importDeclaration(imports, t.stringLiteral('react-native-svg')));
}
}
return importDeclarations;
};
exports.getImport = getImport;
const getExport = ({
template
}, opts) => {
let result = '';
let exportName = opts.state.componentName;
const plugins = ['jsx'];
if (opts.typescript) {
plugins.push('typescript');
}
if (opts.ref) {
const nextExportName = `ForwardRef`;
result += `const ${nextExportName} = React.forwardRef(${exportName})\n\n`;
exportName = nextExportName;
}
if (opts.memo) {
const nextExportName = `Memo${exportName}`;
result += `const ${nextExportName} = React.memo(${exportName})\n\n`;
exportName = nextExportName;
}
if (opts.state.caller && opts.state.caller.previousExport) {
result += `${opts.state.caller.previousExport}\n`;
result += `export { ${exportName} as ${opts.namedExport} }`;
return template.ast(result, {
plugins
});
}
result += `export default ${exportName}`;
return template.ast(result, {
plugins
});
};
exports.getExport = getExport;

View File

@@ -0,0 +1,29 @@
{
"name": "@svgr/babel-plugin-transform-svg-component",
"description": "Transform SVG into component",
"version": "5.5.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-plugin-transform-svg-component",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"gitHead": "b5920550bd966f876cb65c5e23af180461e5aa23"
}

145
frontend/node_modules/@svgr/babel-preset/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,145 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.4.0...v5.5.0) (2020-11-15)
### Bug Fixes
* prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/babel-preset
## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.3.0...v5.3.1) (2020-04-05)
**Note:** Version bump only for package @svgr/babel-preset
# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.2.0...v5.3.0) (2020-03-22)
**Note:** Version bump only for package @svgr/babel-preset
# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.1.0...v5.2.0) (2020-02-23)
**Note:** Version bump only for package @svgr/babel-preset
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v4.3.2...v4.3.3) (2019-09-24)
### Bug Fixes
* **babel-plugin-svg-dynamic-title:** dont render empty title ([#341](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/341)) ([88b24c5](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/88b24c5)), closes [#333](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/333)
## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v4.3.0...v4.3.1) (2019-07-01)
### Bug Fixes
* **titleProp:** handle the existing title case by using element instead of value (children) ([#315](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/315)) ([065e7a9](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/065e7a9))
# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v4.2.0...v4.3.0) (2019-05-28)
### Features
* titleProps fallbacks to svg's title ([#311](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/311)) ([8f92366](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/8f92366))
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/compare/v4.1.0...v4.2.0) (2019-04-11)
### Bug Fixes
* **babel-preset:** expandProps + icon option ([ddfae22](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/ddfae22)), closes [#277](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/277)
### Features
* add expo option ([#289](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/issues/289)) ([978db3e](https://github.com/gregberge/svgr/tree/master/packages/babel-preset/commit/978db3e))
# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)
**Note:** Version bump only for package @svgr/babel-preset
## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)
**Note:** Version bump only for package @svgr/babel-preset
## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)
**Note:** Version bump only for package @svgr/babel-preset
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
* allow dynamic properties in replaceAttrValues option ([15f55fe](https://github.com/gregberge/svgr/commit/15f55fe)), closes [#205](https://github.com/gregberge/svgr/issues/205)
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

7
frontend/node_modules/@svgr/babel-preset/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

21
frontend/node_modules/@svgr/babel-preset/README.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
# @svgr/babel-preset
## Install
```
npm install --save-dev @svgr/babel-preset
```
## Usage
**.babelrc**
```json
{
"presets": [["@svgr/babel-preset", { "svgProps": { "width": 200 } }]]
}
```
## License
MIT

128
frontend/node_modules/@svgr/babel-preset/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,128 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _babelPluginAddJsxAttribute = _interopRequireDefault(require("@svgr/babel-plugin-add-jsx-attribute"));
var _babelPluginRemoveJsxAttribute = _interopRequireDefault(require("@svgr/babel-plugin-remove-jsx-attribute"));
var _babelPluginRemoveJsxEmptyExpression = _interopRequireDefault(require("@svgr/babel-plugin-remove-jsx-empty-expression"));
var _babelPluginReplaceJsxAttributeValue = _interopRequireDefault(require("@svgr/babel-plugin-replace-jsx-attribute-value"));
var _babelPluginSvgDynamicTitle = _interopRequireDefault(require("@svgr/babel-plugin-svg-dynamic-title"));
var _babelPluginSvgEmDimensions = _interopRequireDefault(require("@svgr/babel-plugin-svg-em-dimensions"));
var _babelPluginTransformReactNativeSvg = _interopRequireDefault(require("@svgr/babel-plugin-transform-react-native-svg"));
var _babelPluginTransformSvgComponent = _interopRequireDefault(require("@svgr/babel-plugin-transform-svg-component"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getAttributeValue(value) {
const literal = typeof value === 'string' && value.startsWith('{') && value.endsWith('}');
return {
value: literal ? value.slice(1, -1) : value,
literal
};
}
function propsToAttributes(props) {
return Object.keys(props).map(name => {
const {
literal,
value
} = getAttributeValue(props[name]);
return {
name,
literal,
value
};
});
}
function replaceMapToValues(replaceMap) {
return Object.keys(replaceMap).map(value => {
const {
literal,
value: newValue
} = getAttributeValue(replaceMap[value]);
return {
value,
newValue,
literal
};
});
}
const plugin = (api, opts) => {
let toRemoveAttributes = ['version'];
let toAddAttributes = [];
if (opts.svgProps) {
toAddAttributes = [...toAddAttributes, ...propsToAttributes(opts.svgProps)];
}
if (opts.ref) {
toAddAttributes = [...toAddAttributes, {
name: 'ref',
value: 'svgRef',
literal: true
}];
}
if (opts.titleProp) {
toAddAttributes = [...toAddAttributes, {
name: 'aria-labelledby',
value: 'titleId',
literal: true
}];
}
if (opts.expandProps) {
toAddAttributes = [...toAddAttributes, {
name: 'props',
spread: true,
position: opts.expandProps
}];
}
if (!opts.dimensions) {
toRemoveAttributes = [...toRemoveAttributes, 'width', 'height'];
}
const plugins = [[_babelPluginTransformSvgComponent.default, opts], ...(opts.icon && opts.dimensions ? [_babelPluginSvgEmDimensions.default] : []), [_babelPluginRemoveJsxAttribute.default, {
elements: ['svg', 'Svg'],
attributes: toRemoveAttributes
}], [_babelPluginAddJsxAttribute.default, {
elements: ['svg', 'Svg'],
attributes: toAddAttributes
}], _babelPluginRemoveJsxEmptyExpression.default];
if (opts.replaceAttrValues) {
plugins.push([_babelPluginReplaceJsxAttributeValue.default, {
values: replaceMapToValues(opts.replaceAttrValues)
}]);
}
if (opts.titleProp) {
plugins.push(_babelPluginSvgDynamicTitle.default);
}
if (opts.native) {
if (opts.native.expo) {
plugins.push([_babelPluginTransformReactNativeSvg.default, opts.native]);
} else {
plugins.push(_babelPluginTransformReactNativeSvg.default);
}
}
return {
plugins
};
};
var _default = plugin;
exports.default = _default;

40
frontend/node_modules/@svgr/babel-preset/package.json generated vendored Normal file
View File

@@ -0,0 +1,40 @@
{
"name": "@svgr/babel-preset",
"description": "SVGR preset that apply transformations from config",
"version": "5.5.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/babel-preset",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"babel-plugin",
"babel-preset"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"dependencies": {
"@svgr/babel-plugin-add-jsx-attribute": "^5.4.0",
"@svgr/babel-plugin-remove-jsx-attribute": "^5.4.0",
"@svgr/babel-plugin-remove-jsx-empty-expression": "^5.0.1",
"@svgr/babel-plugin-replace-jsx-attribute-value": "^5.0.1",
"@svgr/babel-plugin-svg-dynamic-title": "^5.4.0",
"@svgr/babel-plugin-svg-em-dimensions": "^5.4.0",
"@svgr/babel-plugin-transform-react-native-svg": "^5.4.0",
"@svgr/babel-plugin-transform-svg-component": "^5.5.0"
},
"gitHead": "b5920550bd966f876cb65c5e23af180461e5aa23"
}

307
frontend/node_modules/@svgr/core/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,307 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.4.0...v5.5.0) (2020-11-15)
### Bug Fixes
* **typescript:** fix react-native support [#465](https://github.com/gregberge/svgr/tree/master/packages/core/issues/465) ([#488](https://github.com/gregberge/svgr/tree/master/packages/core/issues/488)) ([d61e0cf](https://github.com/gregberge/svgr/tree/master/packages/core/commit/d61e0cface065afc1478fdb44d87ca8177041eab))
* prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/core/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/core/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/core/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))
### Features
* allow custom name for named export ([#493](https://github.com/gregberge/svgr/tree/master/packages/core/issues/493)) ([16a58d6](https://github.com/gregberge/svgr/tree/master/packages/core/commit/16a58d6e817c065f72a68be91600a1a360205f44))
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.3.1...v5.4.0) (2020-04-27)
### Bug Fixes
* wrap svg component directly with memo/forwardRef ([#440](https://github.com/gregberge/svgr/tree/master/packages/core/issues/440)) ([#441](https://github.com/gregberge/svgr/tree/master/packages/core/issues/441)) ([a6de2da](https://github.com/gregberge/svgr/tree/master/packages/core/commit/a6de2dacb63e36572a2167b928418bdc39f3a9c2))
### Features
* **cli:** make all CLI options available in config ([a23a186](https://github.com/gregberge/svgr/tree/master/packages/core/commit/a23a18675c0dd4a461d2fcbdc72a305cabd32a13)), closes [#431](https://github.com/gregberge/svgr/tree/master/packages/core/issues/431) [#437](https://github.com/gregberge/svgr/tree/master/packages/core/issues/437)
## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.3.0...v5.3.1) (2020-04-05)
**Note:** Version bump only for package @svgr/core
# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.2.0...v5.3.0) (2020-03-22)
### Features
* add typescript option ([4596d7b](https://github.com/gregberge/svgr/tree/master/packages/core/commit/4596d7bb470babb5ec4b87f5281174fb182bd9c7)), closes [#373](https://github.com/gregberge/svgr/tree/master/packages/core/issues/373)
# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.1.0...v5.2.0) (2020-02-23)
**Note:** Version bump only for package @svgr/core
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/core/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.3.2...v4.3.3) (2019-09-24)
### Bug Fixes
* **babel-plugin-svg-dynamic-title:** dont render empty title ([#341](https://github.com/gregberge/svgr/tree/master/packages/core/issues/341)) ([88b24c5](https://github.com/gregberge/svgr/tree/master/packages/core/commit/88b24c5)), closes [#333](https://github.com/gregberge/svgr/tree/master/packages/core/issues/333)
* invalid characters in component name ([#332](https://github.com/gregberge/svgr/tree/master/packages/core/issues/332)) ([4b4bd2c](https://github.com/gregberge/svgr/tree/master/packages/core/commit/4b4bd2c)), closes [#331](https://github.com/gregberge/svgr/tree/master/packages/core/issues/331)
## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.3.1...v4.3.2) (2019-07-15)
**Note:** Version bump only for package @svgr/core
## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.3.0...v4.3.1) (2019-07-01)
**Note:** Version bump only for package @svgr/core
# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.2.0...v4.3.0) (2019-05-28)
**Note:** Version bump only for package @svgr/core
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/core/compare/v4.1.0...v4.2.0) (2019-04-11)
### Bug Fixes
* keep viewBox when dimensions are removed ([#281](https://github.com/gregberge/svgr/tree/master/packages/core/issues/281)) ([f476c8e](https://github.com/gregberge/svgr/tree/master/packages/core/commit/f476c8e))
### Features
* add expo option ([#289](https://github.com/gregberge/svgr/tree/master/packages/core/issues/289)) ([978db3e](https://github.com/gregberge/svgr/tree/master/packages/core/commit/978db3e))
# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)
**Note:** Version bump only for package @svgr/core
## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)
### Bug Fixes
* upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))
## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)
**Note:** Version bump only for package @svgr/core
## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)
**Note:** Version bump only for package @svgr/core
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
* allow dynamic properties in replaceAttrValues option ([15f55fe](https://github.com/gregberge/svgr/commit/15f55fe)), closes [#205](https://github.com/gregberge/svgr/issues/205)
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default
# [3.1.0](https://github.com/gregberge/svgr/compare/v3.0.0...v3.1.0) (2018-10-05)
### Bug Fixes
* style & custom SVG properties ([#203](https://github.com/gregberge/svgr/issues/203)) ([f8b2212](https://github.com/gregberge/svgr/commit/f8b2212)), closes [#199](https://github.com/gregberge/svgr/issues/199) [#201](https://github.com/gregberge/svgr/issues/201)
### Features
* allow Mask & Image on React Native ([#202](https://github.com/gregberge/svgr/issues/202)) ([0256bc0](https://github.com/gregberge/svgr/commit/0256bc0))
<a name="3.0.0"></a>
# [3.0.0](https://github.com/gregberge/svgr/compare/v2.4.1...v3.0.0) (2018-10-01)
### Bug Fixes
* fix --icon + --no-dimensions ([7535693](https://github.com/gregberge/svgr/commit/7535693)), closes [#141](https://github.com/gregberge/svgr/issues/141)
* fix expandProps when position is not allowed ([45522fc](https://github.com/gregberge/svgr/commit/45522fc))
### Features
* **config:** improve runtime config ([e52cdce](https://github.com/gregberge/svgr/commit/e52cdce)), closes [#192](https://github.com/gregberge/svgr/issues/192)
* **template:** expose `getProps` util for template ([5cb238e](https://github.com/gregberge/svgr/commit/5cb238e)), closes [#187](https://github.com/gregberge/svgr/issues/187)
* add synchronous API ([169eb2f](https://github.com/gregberge/svgr/commit/169eb2f)), closes [#185](https://github.com/gregberge/svgr/issues/185)
* always prefix component name with "Svg" ([f71aa7a](https://github.com/gregberge/svgr/commit/f71aa7a)), closes [#190](https://github.com/gregberge/svgr/issues/190)
* do not remove style tag ([a4ce09a](https://github.com/gregberge/svgr/commit/a4ce09a)), closes [#191](https://github.com/gregberge/svgr/issues/191)
* new "expandProps" option ([bb95828](https://github.com/gregberge/svgr/commit/bb95828)), closes [#170](https://github.com/gregberge/svgr/issues/170)
* remove "svgAttributes" option ([4e46a5d](https://github.com/gregberge/svgr/commit/4e46a5d)), closes [#173](https://github.com/gregberge/svgr/issues/173)
* use forwardRef on React Native ([4bdd989](https://github.com/gregberge/svgr/commit/4bdd989)), closes [#184](https://github.com/gregberge/svgr/issues/184)
* use React.forwardRef ([cbee51c](https://github.com/gregberge/svgr/commit/cbee51c)), closes [#184](https://github.com/gregberge/svgr/issues/184)
### BREAKING CHANGES
* "--no-expand-props" is now replaced by "--expand-props none". You can now specify a position "start" or "end" for "expandProps"
property.
* `svgAttributes` has been removed, please use `svgProps` instead.
* "ref" option now uses `React.forwardRef`. You don't have to use "svgRef"
prop, just use "ref" and it will work. `React.forwardRef` requires React
> 16.3.
* Style tag will no longer be automatically removed. SVGO should handle it
correctly using "inlineStyles" plugin. If you want to remove them,
enable "removeStyleElement" plugin in your SVGO config.
* **config:** - Runtime configuration is always loaded (even with Node API `convert`)
- In CLI, "--config" is now "--config-file"; this new option can be used
everywhere
<a name="2.4.1"></a>
## [2.4.1](https://github.com/gregberge/svgr/compare/v2.4.0...v2.4.1) (2018-09-16)
### Bug Fixes
* **config:** fix custom config & default options ([#176](https://github.com/gregberge/svgr/issues/176)) ([9a6c40b](https://github.com/gregberge/svgr/commit/9a6c40b))
<a name="2.4.0"></a>
# [2.4.0](https://github.com/gregberge/svgr/compare/v2.3.0...v2.4.0) (2018-09-16)
### Bug Fixes
* use literal instead of litteral ([7849fd4](https://github.com/gregberge/svgr/commit/7849fd4))
### Features
* allow to spread props at the start ([#166](https://github.com/gregberge/svgr/issues/166)) ([cd659dc](https://github.com/gregberge/svgr/commit/cd659dc))
* **upgrade:** h2x@1.1.0 (jsdom@12.0.0) & others ([2d9b7bd](https://github.com/gregberge/svgr/commit/2d9b7bd))
* new option "svgProps" ([#172](https://github.com/gregberge/svgr/issues/172)) ([9657110](https://github.com/gregberge/svgr/commit/9657110))
<a name="2.2.0"></a>
# [2.2.0](https://github.com/gregberge/svgr/compare/v2.1.1...v2.2.0) (2018-08-13)
### Bug Fixes
* remove null-byte characters ([#154](https://github.com/gregberge/svgr/issues/154)) ([de7f8a7](https://github.com/gregberge/svgr/commit/de7f8a7)), closes [#153](https://github.com/gregberge/svgr/issues/153)
### Features
* **core:** pass info to SVGO ([2b2353b](https://github.com/gregberge/svgr/commit/2b2353b)), closes [#152](https://github.com/gregberge/svgr/issues/152)
<a name="2.1.1"></a>
## [2.1.1](https://github.com/gregberge/svgr/compare/v2.1.0...v2.1.1) (2018-07-11)
### Bug Fixes
* **core:** config conflict with icon option ([#137](https://github.com/gregberge/svgr/issues/137)) ([e13a99a](https://github.com/gregberge/svgr/commit/e13a99a))
<a name="2.1.0"></a>
# [2.1.0](https://github.com/gregberge/svgr/compare/v2.0.0...v2.1.0) (2018-07-08)
### Features
* add .editorconfig support ([#129](https://github.com/gregberge/svgr/issues/129)) ([968fd82](https://github.com/gregberge/svgr/commit/968fd82))
* **cli:** support custom filename cases ([#136](https://github.com/gregberge/svgr/issues/136)) ([4922f7a](https://github.com/gregberge/svgr/commit/4922f7a)), closes [#118](https://github.com/gregberge/svgr/issues/118)

7
frontend/node_modules/@svgr/core/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

60
frontend/node_modules/@svgr/core/README.md generated vendored Normal file
View File

@@ -0,0 +1,60 @@
# @svgr/core
[![Build Status][build-badge]][build]
[![version][version-badge]][package]
[![MIT License][license-badge]][license]
Node API of SVGR.
```
npm install @svgr/core
```
## Usage
```js
import svgr from '@svgr/core'
const svgCode = `
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<rect x="10" y="10" height="100" width="100"
style="stroke:#ff0000; fill: #0000ff"/>
</svg>
`
svgr(svgCode, { icon: true }, { componentName: 'MyComponent' }).then(
(jsCode) => {
console.log(jsCode)
},
)
```
Use `svgr.sync(code, config, state)` if you would like to use sync version.
### Plugins
By default `@svgr/core` doesn't include `svgo` and `prettier` plugins, if you want them, you have to install them and include them in config.
```js
svgr(svgCode, {
plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],
}).then((jsCode) => {
console.log(jsCode)
})
```
## License
MIT
[build-badge]: https://img.shields.io/travis/smooth-code/svgr.svg?style=flat-square
[build]: https://travis-ci.org/smooth-code/svgr
[version-badge]: https://img.shields.io/npm/v/@svgr/core.svg?style=flat-square
[package]: https://www.npmjs.com/package/@svgr/core
[license-badge]: https://img.shields.io/npm/l/@svgr/core.svg?style=flat-square
[license]: https://github.com/smooth-code/svgr/blob/master/LICENSE
```
```

93
frontend/node_modules/@svgr/core/lib/config.js generated vendored Normal file
View File

@@ -0,0 +1,93 @@
"use strict";
exports.__esModule = true;
exports.resolveConfig = resolveConfig;
exports.resolveConfigFile = resolveConfigFile;
exports.loadConfig = loadConfig;
exports.DEFAULT_CONFIG = void 0;
var _cosmiconfig = require("cosmiconfig");
const DEFAULT_CONFIG = {
dimensions: true,
expandProps: 'end',
icon: false,
native: false,
typescript: false,
prettier: true,
prettierConfig: null,
memo: false,
ref: false,
replaceAttrValues: null,
svgProps: null,
svgo: true,
svgoConfig: null,
template: null,
titleProp: false,
runtimeConfig: true,
plugins: null,
namedExport: 'ReactComponent'
};
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
const explorer = (0, _cosmiconfig.cosmiconfig)('svgr', {
sync: true,
cache: true,
rcExtensions: true
});
const explorerSync = (0, _cosmiconfig.cosmiconfigSync)('svgr', {
sync: true,
cache: true,
rcExtensions: true
});
async function resolveConfig(searchFrom, configFile) {
if (configFile == null) {
const result = await explorer.search(searchFrom);
return result ? result.config : null;
}
const result = await explorer.load(configFile);
return result ? result.config : null;
}
resolveConfig.sync = (searchFrom, configFile) => {
if (configFile == null) {
const result = explorerSync.search(searchFrom);
return result ? result.config : null;
}
const result = explorerSync.load(configFile);
return result ? result.config : null;
};
async function resolveConfigFile(filePath) {
const result = await explorer.search(filePath);
return result ? result.filepath : null;
}
resolveConfigFile.sync = filePath => {
const result = explorerSync.search(filePath);
return result ? result.filepath : null;
};
async function loadConfig({
configFile,
...baseConfig
}, state = {}) {
const rcConfig = state.filePath && baseConfig.runtimeConfig !== false ? await resolveConfig(state.filePath, configFile) : {};
return { ...DEFAULT_CONFIG,
...rcConfig,
...baseConfig
};
}
loadConfig.sync = ({
configFile,
...baseConfig
}, state = {}) => {
const rcConfig = state.filePath && baseConfig.runtimeConfig !== false ? resolveConfig.sync(state.filePath, configFile) : {};
return { ...DEFAULT_CONFIG,
...rcConfig,
...baseConfig
};
};

35
frontend/node_modules/@svgr/core/lib/convert.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _state = require("./state");
var _config = require("./config");
var _plugins = require("./plugins");
function run(code, config, state) {
const expandedState = (0, _state.expandState)(state);
const plugins = (0, _plugins.getPlugins)(config, state).map(_plugins.resolvePlugin);
let nextCode = String(code).replace('\0', ''); // eslint-disable-next-line no-restricted-syntax
for (const plugin of plugins) {
nextCode = plugin(nextCode, config, expandedState);
}
return nextCode;
}
async function convert(code, config = {}, state = {}) {
config = await (0, _config.loadConfig)(config, state);
return run(code, config, state);
}
convert.sync = (code, config = {}, state = {}) => {
config = _config.loadConfig.sync(config, state);
return run(code, config, state);
};
var _default = convert;
exports.default = _default;

20
frontend/node_modules/@svgr/core/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
"use strict";
exports.__esModule = true;
var _exportNames = {};
exports.default = void 0;
var _convert = _interopRequireDefault(require("./convert"));
exports.default = _convert.default;
var _config = require("./config");
Object.keys(_config).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _config[key]) return;
exports[key] = _config[key];
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

58
frontend/node_modules/@svgr/core/lib/plugins.js generated vendored Normal file
View File

@@ -0,0 +1,58 @@
"use strict";
exports.__esModule = true;
exports.getPlugins = getPlugins;
exports.resolvePlugin = resolvePlugin;
exports.loadPlugin = loadPlugin;
var _pluginJsx = _interopRequireDefault(require("@svgr/plugin-jsx"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const DEFAULT_PLUGINS = [_pluginJsx.default];
function getPlugins(config, state) {
if (config.plugins) {
return config.plugins;
}
if (state.caller && state.caller.defaultPlugins) {
return state.caller.defaultPlugins;
}
return DEFAULT_PLUGINS;
}
function resolvePlugin(plugin) {
if (typeof plugin === 'function') {
return plugin;
}
if (typeof plugin === 'string') {
return loadPlugin(plugin);
}
throw new Error(`Invalid plugin "${plugin}"`);
}
const pluginCache = {};
function loadPlugin(moduleName) {
if (pluginCache[moduleName]) {
return pluginCache[moduleName];
}
try {
// eslint-disable-next-line
const plugin = require(moduleName);
if (!plugin.default || !plugin) {
throw new Error(`Invalid plugin "${moduleName}"`);
}
pluginCache[moduleName] = plugin.default || plugin;
return pluginCache[moduleName];
} catch (error) {
throw new Error(`Module "${moduleName}" missing. Maybe \`npm install ${moduleName}\` could help!`);
}
}

27
frontend/node_modules/@svgr/core/lib/state.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
"use strict";
exports.__esModule = true;
exports.expandState = expandState;
var _path = _interopRequireDefault(require("path"));
var _camelcase = _interopRequireDefault(require("camelcase"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const validCharacters = /[^a-zA-Z0-9_-]/g;
function getComponentName(state) {
if (!state.filePath) return 'SvgComponent';
const pascalCaseFileName = (0, _camelcase.default)(_path.default.parse(state.filePath).name.replace(validCharacters, ''), {
pascalCase: true
});
return `Svg${pascalCaseFileName}`;
}
function expandState(state) {
return {
componentName: state.componentName || getComponentName(state),
...state
};
}

38
frontend/node_modules/@svgr/core/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "@svgr/core",
"description": "Transform SVG into React Components.",
"version": "5.5.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/core",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"svgr",
"svg",
"react",
"core",
"api"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"dependencies": {
"@svgr/plugin-jsx": "^5.5.0",
"camelcase": "^6.2.0",
"cosmiconfig": "^7.0.0"
},
"gitHead": "b5920550bd966f876cb65c5e23af180461e5aa23"
}

View File

@@ -0,0 +1,116 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v5.4.0...v5.5.0) (2020-11-15)
**Note:** Version bump only for package @svgr/hast-util-to-babel-ast
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/hast-util-to-babel-ast
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v4.3.1...v4.3.2) (2019-07-15)
### Performance Improvements
* replace rehype with svg-parser ([#321](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/issues/321)) ([7eb5ef6](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/commit/7eb5ef6))
## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v4.3.0...v4.3.1) (2019-07-01)
**Note:** Version bump only for package @svgr/hast-util-to-babel-ast
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/compare/v4.1.0...v4.2.0) (2019-04-11)
### Bug Fixes
* **hast-util-to-babel-ast:** correctly handle aria attributes ([23d12aa](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/commit/23d12aa)), closes [#279](https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast/issues/279)
# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)
**Note:** Version bump only for package @svgr/hast-util-to-babel-ast
## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)
### Bug Fixes
* upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))
## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)
### Bug Fixes
* **hast-util-to-babel-ast:** replace tabs by spaces in attributes ([b0f3d19](https://github.com/gregberge/svgr/commit/b0f3d19)), closes [#219](https://github.com/gregberge/svgr/issues/219)
## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)
### Bug Fixes
* **hast-util-to-babel-ast:** correctly transforms data & aria attributes ([99711c4](https://github.com/gregberge/svgr/commit/99711c4)), closes [#221](https://github.com/gregberge/svgr/issues/221)
* **hast-util-to-babel-ast:** replace line-breaks in attributes ([00a2625](https://github.com/gregberge/svgr/commit/00a2625)), closes [#219](https://github.com/gregberge/svgr/issues/219)
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,28 @@
# @svgr/hast-util-to-babel-ast
[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg)](https://travis-ci.org/smooth-code/svgr)
[![Version](https://img.shields.io/npm/v/@svgr/hast-util-to-babel-ast.svg)](https://www.npmjs.com/package/@svgr/hast-util-to-babel-ast)
[![MIT License](https://img.shields.io/npm/l/@svgr/hast-util-to-babel-ast.svg)](https://github.com/smooth-code/svgr/blob/master/LICENSE)
Transforms HAST into Babel AST.
## Install
```
npm install --save-dev @svgr/hast-util-to-babel-ast
```
## Usage
```js
import { parse } from 'svg-parser'
import toBabelAST from '@svgr/hast-util-to-babel-ast'
const hastTree = parse(`<svg></svg>`)
const babelTree = hastToBabelAst(hastTree)
```
## License
MIT

View File

@@ -0,0 +1,28 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _one = _interopRequireDefault(require("./one"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* Transform the children of `parent`. */
function all(h, parent) {
const nodes = parent.children || [];
const {
length
} = nodes;
const values = [];
let index = -1;
while (++index < length) {
const result = (0, _one.default)(h, nodes[index], parent);
values.push(result);
}
return values.filter(node => node);
}
var _default = all;
exports.default = _default;

View File

@@ -0,0 +1,80 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var t = _interopRequireWildcard(require("@babel/types"));
var _util = require("./util");
var _stringToObjectStyle = _interopRequireDefault(require("./stringToObjectStyle"));
var _mappings = require("./mappings");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function convertAriaAttribute(kebabKey) {
const [aria, ...parts] = kebabKey.split('-');
return `${aria}-${parts.join('').toLowerCase()}`;
}
function getKey(key, value, node) {
const lowerCaseKey = key.toLowerCase();
const mappedElementAttribute = _mappings.ELEMENT_ATTRIBUTE_MAPPING[node.name] && _mappings.ELEMENT_ATTRIBUTE_MAPPING[node.name][lowerCaseKey];
const mappedAttribute = _mappings.ATTRIBUTE_MAPPING[lowerCaseKey];
if (mappedElementAttribute || mappedAttribute) {
return t.jsxIdentifier(mappedElementAttribute || mappedAttribute);
}
const kebabKey = (0, _util.kebabCase)(key);
if (kebabKey.startsWith('aria-')) {
return t.jsxIdentifier(convertAriaAttribute(kebabKey));
}
if (kebabKey.startsWith('data-')) {
return t.jsxIdentifier(kebabKey);
}
return t.jsxIdentifier(key);
}
function getValue(key, value) {
// Handle className
if (Array.isArray(value)) {
return t.stringLiteral((0, _util.replaceSpaces)(value.join(' ')));
}
if (key === 'style') {
return t.jsxExpressionContainer((0, _stringToObjectStyle.default)(value));
}
if ((0, _util.isNumeric)(value)) {
return t.jsxExpressionContainer(t.numericLiteral(Number(value)));
}
return t.stringLiteral((0, _util.replaceSpaces)(value));
}
const getAttributes = node => {
const keys = Object.keys(node.properties);
const attributes = [];
let index = -1;
while (++index < keys.length) {
const key = keys[index];
const value = node.properties[key];
const attribute = t.jsxAttribute(getKey(key, value, node), getValue(key, value, node));
attributes.push(attribute);
}
return attributes;
};
var _default = getAttributes;
exports.default = _default;

View File

@@ -0,0 +1,65 @@
"use strict";
exports.__esModule = true;
exports.element = exports.text = exports.comment = exports.root = void 0;
var t = _interopRequireWildcard(require("@babel/types"));
var _all = _interopRequireDefault(require("./all"));
var _getAttributes = _interopRequireDefault(require("./getAttributes"));
var _mappings = require("./mappings");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const root = (h, node) => t.program((0, _all.default)(h, node));
exports.root = root;
const comment = (h, node, parent) => {
if (parent.type === 'root') {
return null;
}
const expression = t.jsxEmptyExpression();
t.addComment(expression, 'inner', node.value);
return t.jsxExpressionContainer(expression);
};
exports.comment = comment;
const text = (h, node, parent) => {
if (parent.type === 'root') {
return null;
}
if (node.value.match(/^\s+$/)) {
return null;
}
return t.jsxExpressionContainer(t.stringLiteral(node.value));
};
exports.text = text;
const element = (h, node, parent) => {
const children = (0, _all.default)(h, node);
const selfClosing = children.length === 0;
const name = _mappings.ELEMENT_TAG_NAME_MAPPING[node.tagName] || node.tagName;
const openingElement = t.jsxOpeningElement(t.jsxIdentifier(name), (0, _getAttributes.default)(node), selfClosing);
const closingElement = !selfClosing ? t.jsxClosingElement(t.jsxIdentifier(name)) : null;
const jsxElement = t.jsxElement(openingElement, closingElement, children);
if (parent.type === 'root') {
return t.expressionStatement(jsxElement);
}
return jsxElement;
};
exports.element = element;

View File

@@ -0,0 +1,25 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var handlers = _interopRequireWildcard(require("./handlers"));
var _one = _interopRequireDefault(require("./one"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const h = {
handlers
};
function toBabelAST(tree) {
return (0, _one.default)(h, tree);
}
var _default = toBabelAST;
exports.default = _default;

View File

@@ -0,0 +1,599 @@
"use strict";
exports.__esModule = true;
exports.ELEMENT_TAG_NAME_MAPPING = exports.ELEMENT_ATTRIBUTE_MAPPING = exports.ATTRIBUTE_MAPPING = void 0;
// From https://raw.githubusercontent.com/facebook/react/master/packages/react-dom/src/shared/possibleStandardNames.js
const ATTRIBUTE_MAPPING = {
// HTML
accept: 'accept',
acceptcharset: 'acceptCharset',
'accept-charset': 'acceptCharset',
accesskey: 'accessKey',
action: 'action',
allowfullscreen: 'allowFullScreen',
alt: 'alt',
as: 'as',
async: 'async',
autocapitalize: 'autoCapitalize',
autocomplete: 'autoComplete',
autocorrect: 'autoCorrect',
autofocus: 'autoFocus',
autoplay: 'autoPlay',
autosave: 'autoSave',
capture: 'capture',
cellpadding: 'cellPadding',
cellspacing: 'cellSpacing',
challenge: 'challenge',
charset: 'charSet',
checked: 'checked',
children: 'children',
cite: 'cite',
class: 'className',
classid: 'classID',
classname: 'className',
cols: 'cols',
colspan: 'colSpan',
content: 'content',
contenteditable: 'contentEditable',
contextmenu: 'contextMenu',
controls: 'controls',
controlslist: 'controlsList',
coords: 'coords',
crossorigin: 'crossOrigin',
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
data: 'data',
datetime: 'dateTime',
default: 'default',
defaultchecked: 'defaultChecked',
defaultvalue: 'defaultValue',
defer: 'defer',
dir: 'dir',
disabled: 'disabled',
download: 'download',
draggable: 'draggable',
enctype: 'encType',
for: 'htmlFor',
form: 'form',
formmethod: 'formMethod',
formaction: 'formAction',
formenctype: 'formEncType',
formnovalidate: 'formNoValidate',
formtarget: 'formTarget',
frameborder: 'frameBorder',
headers: 'headers',
height: 'height',
hidden: 'hidden',
high: 'high',
href: 'href',
hreflang: 'hrefLang',
htmlfor: 'htmlFor',
httpequiv: 'httpEquiv',
'http-equiv': 'httpEquiv',
icon: 'icon',
id: 'id',
innerhtml: 'innerHTML',
inputmode: 'inputMode',
integrity: 'integrity',
is: 'is',
itemid: 'itemID',
itemprop: 'itemProp',
itemref: 'itemRef',
itemscope: 'itemScope',
itemtype: 'itemType',
keyparams: 'keyParams',
keytype: 'keyType',
kind: 'kind',
label: 'label',
lang: 'lang',
list: 'list',
loop: 'loop',
low: 'low',
manifest: 'manifest',
marginwidth: 'marginWidth',
marginheight: 'marginHeight',
max: 'max',
maxlength: 'maxLength',
media: 'media',
mediagroup: 'mediaGroup',
method: 'method',
min: 'min',
minlength: 'minLength',
multiple: 'multiple',
muted: 'muted',
name: 'name',
nomodule: 'noModule',
nonce: 'nonce',
novalidate: 'noValidate',
open: 'open',
optimum: 'optimum',
pattern: 'pattern',
placeholder: 'placeholder',
playsinline: 'playsInline',
poster: 'poster',
preload: 'preload',
profile: 'profile',
radiogroup: 'radioGroup',
readonly: 'readOnly',
referrerpolicy: 'referrerPolicy',
rel: 'rel',
required: 'required',
reversed: 'reversed',
role: 'role',
rows: 'rows',
rowspan: 'rowSpan',
sandbox: 'sandbox',
scope: 'scope',
scoped: 'scoped',
scrolling: 'scrolling',
seamless: 'seamless',
selected: 'selected',
shape: 'shape',
size: 'size',
sizes: 'sizes',
span: 'span',
spellcheck: 'spellCheck',
src: 'src',
srcdoc: 'srcDoc',
srclang: 'srcLang',
srcset: 'srcSet',
start: 'start',
step: 'step',
style: 'style',
summary: 'summary',
tabindex: 'tabIndex',
target: 'target',
title: 'title',
type: 'type',
usemap: 'useMap',
value: 'value',
width: 'width',
wmode: 'wmode',
wrap: 'wrap',
// SVG
about: 'about',
accentheight: 'accentHeight',
'accent-height': 'accentHeight',
accumulate: 'accumulate',
additive: 'additive',
alignmentbaseline: 'alignmentBaseline',
'alignment-baseline': 'alignmentBaseline',
allowreorder: 'allowReorder',
alphabetic: 'alphabetic',
amplitude: 'amplitude',
arabicform: 'arabicForm',
'arabic-form': 'arabicForm',
ascent: 'ascent',
attributename: 'attributeName',
attributetype: 'attributeType',
autoreverse: 'autoReverse',
azimuth: 'azimuth',
basefrequency: 'baseFrequency',
baselineshift: 'baselineShift',
'baseline-shift': 'baselineShift',
baseprofile: 'baseProfile',
bbox: 'bbox',
begin: 'begin',
bias: 'bias',
by: 'by',
calcmode: 'calcMode',
capheight: 'capHeight',
'cap-height': 'capHeight',
clip: 'clip',
clippath: 'clipPath',
'clip-path': 'clipPath',
clippathunits: 'clipPathUnits',
cliprule: 'clipRule',
'clip-rule': 'clipRule',
color: 'color',
colorinterpolation: 'colorInterpolation',
'color-interpolation': 'colorInterpolation',
colorinterpolationfilters: 'colorInterpolationFilters',
'color-interpolation-filters': 'colorInterpolationFilters',
colorprofile: 'colorProfile',
'color-profile': 'colorProfile',
colorrendering: 'colorRendering',
'color-rendering': 'colorRendering',
contentscripttype: 'contentScriptType',
contentstyletype: 'contentStyleType',
cursor: 'cursor',
cx: 'cx',
cy: 'cy',
d: 'd',
datatype: 'datatype',
decelerate: 'decelerate',
descent: 'descent',
diffuseconstant: 'diffuseConstant',
direction: 'direction',
display: 'display',
divisor: 'divisor',
dominantbaseline: 'dominantBaseline',
'dominant-baseline': 'dominantBaseline',
dur: 'dur',
dx: 'dx',
dy: 'dy',
edgemode: 'edgeMode',
elevation: 'elevation',
enablebackground: 'enableBackground',
'enable-background': 'enableBackground',
end: 'end',
exponent: 'exponent',
externalresourcesrequired: 'externalResourcesRequired',
fill: 'fill',
fillopacity: 'fillOpacity',
'fill-opacity': 'fillOpacity',
fillrule: 'fillRule',
'fill-rule': 'fillRule',
filter: 'filter',
filterres: 'filterRes',
filterunits: 'filterUnits',
floodopacity: 'floodOpacity',
'flood-opacity': 'floodOpacity',
floodcolor: 'floodColor',
'flood-color': 'floodColor',
focusable: 'focusable',
fontfamily: 'fontFamily',
'font-family': 'fontFamily',
fontsize: 'fontSize',
'font-size': 'fontSize',
fontsizeadjust: 'fontSizeAdjust',
'font-size-adjust': 'fontSizeAdjust',
fontstretch: 'fontStretch',
'font-stretch': 'fontStretch',
fontstyle: 'fontStyle',
'font-style': 'fontStyle',
fontvariant: 'fontVariant',
'font-variant': 'fontVariant',
fontweight: 'fontWeight',
'font-weight': 'fontWeight',
format: 'format',
from: 'from',
fx: 'fx',
fy: 'fy',
g1: 'g1',
g2: 'g2',
glyphname: 'glyphName',
'glyph-name': 'glyphName',
glyphorientationhorizontal: 'glyphOrientationHorizontal',
'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
glyphorientationvertical: 'glyphOrientationVertical',
'glyph-orientation-vertical': 'glyphOrientationVertical',
glyphref: 'glyphRef',
gradienttransform: 'gradientTransform',
gradientunits: 'gradientUnits',
hanging: 'hanging',
horizadvx: 'horizAdvX',
'horiz-adv-x': 'horizAdvX',
horizoriginx: 'horizOriginX',
'horiz-origin-x': 'horizOriginX',
ideographic: 'ideographic',
imagerendering: 'imageRendering',
'image-rendering': 'imageRendering',
in2: 'in2',
in: 'in',
inlist: 'inlist',
intercept: 'intercept',
k1: 'k1',
k2: 'k2',
k3: 'k3',
k4: 'k4',
k: 'k',
kernelmatrix: 'kernelMatrix',
kernelunitlength: 'kernelUnitLength',
kerning: 'kerning',
keypoints: 'keyPoints',
keysplines: 'keySplines',
keytimes: 'keyTimes',
lengthadjust: 'lengthAdjust',
letterspacing: 'letterSpacing',
'letter-spacing': 'letterSpacing',
lightingcolor: 'lightingColor',
'lighting-color': 'lightingColor',
limitingconeangle: 'limitingConeAngle',
local: 'local',
markerend: 'markerEnd',
'marker-end': 'markerEnd',
markerheight: 'markerHeight',
markermid: 'markerMid',
'marker-mid': 'markerMid',
markerstart: 'markerStart',
'marker-start': 'markerStart',
markerunits: 'markerUnits',
markerwidth: 'markerWidth',
mask: 'mask',
maskcontentunits: 'maskContentUnits',
maskunits: 'maskUnits',
mathematical: 'mathematical',
mode: 'mode',
numoctaves: 'numOctaves',
offset: 'offset',
opacity: 'opacity',
operator: 'operator',
order: 'order',
orient: 'orient',
orientation: 'orientation',
origin: 'origin',
overflow: 'overflow',
overlineposition: 'overlinePosition',
'overline-position': 'overlinePosition',
overlinethickness: 'overlineThickness',
'overline-thickness': 'overlineThickness',
paintorder: 'paintOrder',
'paint-order': 'paintOrder',
panose1: 'panose1',
'panose-1': 'panose1',
pathlength: 'pathLength',
patterncontentunits: 'patternContentUnits',
patterntransform: 'patternTransform',
patternunits: 'patternUnits',
pointerevents: 'pointerEvents',
'pointer-events': 'pointerEvents',
points: 'points',
pointsatx: 'pointsAtX',
pointsaty: 'pointsAtY',
pointsatz: 'pointsAtZ',
prefix: 'prefix',
preservealpha: 'preserveAlpha',
preserveaspectratio: 'preserveAspectRatio',
primitiveunits: 'primitiveUnits',
property: 'property',
r: 'r',
radius: 'radius',
refx: 'refX',
refy: 'refY',
renderingintent: 'renderingIntent',
'rendering-intent': 'renderingIntent',
repeatcount: 'repeatCount',
repeatdur: 'repeatDur',
requiredextensions: 'requiredExtensions',
requiredfeatures: 'requiredFeatures',
resource: 'resource',
restart: 'restart',
result: 'result',
results: 'results',
rotate: 'rotate',
rx: 'rx',
ry: 'ry',
scale: 'scale',
security: 'security',
seed: 'seed',
shaperendering: 'shapeRendering',
'shape-rendering': 'shapeRendering',
slope: 'slope',
spacing: 'spacing',
specularconstant: 'specularConstant',
specularexponent: 'specularExponent',
speed: 'speed',
spreadmethod: 'spreadMethod',
startoffset: 'startOffset',
stddeviation: 'stdDeviation',
stemh: 'stemh',
stemv: 'stemv',
stitchtiles: 'stitchTiles',
stopcolor: 'stopColor',
'stop-color': 'stopColor',
stopopacity: 'stopOpacity',
'stop-opacity': 'stopOpacity',
strikethroughposition: 'strikethroughPosition',
'strikethrough-position': 'strikethroughPosition',
strikethroughthickness: 'strikethroughThickness',
'strikethrough-thickness': 'strikethroughThickness',
string: 'string',
stroke: 'stroke',
strokedasharray: 'strokeDasharray',
'stroke-dasharray': 'strokeDasharray',
strokedashoffset: 'strokeDashoffset',
'stroke-dashoffset': 'strokeDashoffset',
strokelinecap: 'strokeLinecap',
'stroke-linecap': 'strokeLinecap',
strokelinejoin: 'strokeLinejoin',
'stroke-linejoin': 'strokeLinejoin',
strokemiterlimit: 'strokeMiterlimit',
'stroke-miterlimit': 'strokeMiterlimit',
strokewidth: 'strokeWidth',
'stroke-width': 'strokeWidth',
strokeopacity: 'strokeOpacity',
'stroke-opacity': 'strokeOpacity',
suppresscontenteditablewarning: 'suppressContentEditableWarning',
suppresshydrationwarning: 'suppressHydrationWarning',
surfacescale: 'surfaceScale',
systemlanguage: 'systemLanguage',
tablevalues: 'tableValues',
targetx: 'targetX',
targety: 'targetY',
textanchor: 'textAnchor',
'text-anchor': 'textAnchor',
textdecoration: 'textDecoration',
'text-decoration': 'textDecoration',
textlength: 'textLength',
textrendering: 'textRendering',
'text-rendering': 'textRendering',
to: 'to',
transform: 'transform',
typeof: 'typeof',
u1: 'u1',
u2: 'u2',
underlineposition: 'underlinePosition',
'underline-position': 'underlinePosition',
underlinethickness: 'underlineThickness',
'underline-thickness': 'underlineThickness',
unicode: 'unicode',
unicodebidi: 'unicodeBidi',
'unicode-bidi': 'unicodeBidi',
unicoderange: 'unicodeRange',
'unicode-range': 'unicodeRange',
unitsperem: 'unitsPerEm',
'units-per-em': 'unitsPerEm',
unselectable: 'unselectable',
valphabetic: 'vAlphabetic',
'v-alphabetic': 'vAlphabetic',
values: 'values',
vectoreffect: 'vectorEffect',
'vector-effect': 'vectorEffect',
version: 'version',
vertadvy: 'vertAdvY',
'vert-adv-y': 'vertAdvY',
vertoriginx: 'vertOriginX',
'vert-origin-x': 'vertOriginX',
vertoriginy: 'vertOriginY',
'vert-origin-y': 'vertOriginY',
vhanging: 'vHanging',
'v-hanging': 'vHanging',
videographic: 'vIdeographic',
'v-ideographic': 'vIdeographic',
viewbox: 'viewBox',
viewtarget: 'viewTarget',
visibility: 'visibility',
vmathematical: 'vMathematical',
'v-mathematical': 'vMathematical',
vocab: 'vocab',
widths: 'widths',
wordspacing: 'wordSpacing',
'word-spacing': 'wordSpacing',
writingmode: 'writingMode',
'writing-mode': 'writingMode',
x1: 'x1',
x2: 'x2',
x: 'x',
xchannelselector: 'xChannelSelector',
xheight: 'xHeight',
'x-height': 'xHeight',
xlinkactuate: 'xlinkActuate',
'xlink:actuate': 'xlinkActuate',
xlinkarcrole: 'xlinkArcrole',
'xlink:arcrole': 'xlinkArcrole',
xlinkhref: 'xlinkHref',
'xlink:href': 'xlinkHref',
xlinkrole: 'xlinkRole',
'xlink:role': 'xlinkRole',
xlinkshow: 'xlinkShow',
'xlink:show': 'xlinkShow',
xlinktitle: 'xlinkTitle',
'xlink:title': 'xlinkTitle',
xlinktype: 'xlinkType',
'xlink:type': 'xlinkType',
xmlbase: 'xmlBase',
'xml:base': 'xmlBase',
xmllang: 'xmlLang',
'xml:lang': 'xmlLang',
xmlns: 'xmlns',
'xml:space': 'xmlSpace',
xmlnsxlink: 'xmlnsXlink',
'xmlns:xlink': 'xmlnsXlink',
xmlspace: 'xmlSpace',
y1: 'y1',
y2: 'y2',
y: 'y',
ychannelselector: 'yChannelSelector',
z: 'z',
zoomandpan: 'zoomAndPan'
};
exports.ATTRIBUTE_MAPPING = ATTRIBUTE_MAPPING;
const ELEMENT_ATTRIBUTE_MAPPING = {
input: {
checked: 'defaultChecked',
value: 'defaultValue',
maxlength: 'maxLength'
},
form: {
enctype: 'encType'
}
}; // Reference: https://developer.mozilla.org/en-US/docs/Web/SVG/Element#SVG_elements
exports.ELEMENT_ATTRIBUTE_MAPPING = ELEMENT_ATTRIBUTE_MAPPING;
const ELEMENT_TAG_NAME_MAPPING = {
a: 'a',
altglyph: 'altGlyph',
altglyphdef: 'altGlyphDef',
altglyphitem: 'altGlyphItem',
animate: 'animate',
animatecolor: 'animateColor',
animatemotion: 'animateMotion',
animatetransform: 'animateTransform',
audio: 'audio',
canvas: 'canvas',
circle: 'circle',
clippath: 'clipPath',
'color-profile': 'colorProfile',
cursor: 'cursor',
defs: 'defs',
desc: 'desc',
discard: 'discard',
ellipse: 'ellipse',
feblend: 'feBlend',
fecolormatrix: 'feColorMatrix',
fecomponenttransfer: 'feComponentTransfer',
fecomposite: 'feComposite',
feconvolvematrix: 'feConvolveMatrix',
fediffuselighting: 'feDiffuseLighting',
fedisplacementmap: 'feDisplacementMap',
fedistantlight: 'feDistantLight',
fedropshadow: 'feDropShadow',
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',
filter: 'filter',
font: 'font',
'font-face': 'fontFace',
'font-face-format': 'fontFaceFormat',
'font-face-name': 'fontFaceName',
'font-face-src': 'fontFaceSrc',
'font-face-uri': 'fontFaceUri',
foreignobject: 'foreignObject',
g: 'g',
glyph: 'glyph',
glyphref: 'glyphRef',
hatch: 'hatch',
hatchpath: 'hatchpath',
hkern: 'hkern',
iframe: 'iframe',
image: 'image',
line: 'line',
lineargradient: 'linearGradient',
marker: 'marker',
mask: 'mask',
mesh: 'mesh',
meshgradient: 'meshgradient',
meshpatch: 'meshpatch',
meshrow: 'meshrow',
metadata: 'metadata',
'missing-glyph': 'missingGlyph',
mpath: 'mpath',
path: 'path',
pattern: 'pattern',
polygon: 'polygon',
polyline: 'polyline',
radialgradient: 'radialGradient',
rect: 'rect',
script: 'script',
set: 'set',
solidcolor: 'solidcolor',
stop: 'stop',
style: 'style',
svg: 'svg',
switch: 'switch',
symbol: 'symbol',
text: 'text',
textpath: 'textPath',
title: 'title',
tref: 'tref',
tspan: 'tspan',
unknown: 'unknown',
use: 'use',
video: 'video',
view: 'view',
vkern: 'vkern'
};
exports.ELEMENT_TAG_NAME_MAPPING = ELEMENT_TAG_NAME_MAPPING;

View File

@@ -0,0 +1,23 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
function one(h, node, parent) {
const type = node && node.type;
const fn = h.handlers[type];
/* Fail on non-nodes. */
if (!type) {
throw new Error(`Expected node, got \`${node}\``);
}
if (!fn) {
throw new Error(`Node of type ${type} is unknown`);
}
return fn(h, node, parent);
}
var _default = one;
exports.default = _default;

View File

@@ -0,0 +1,83 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var t = _interopRequireWildcard(require("@babel/types"));
var _util = require("./util");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
// Inspired by https://github.com/reactjs/react-magic/blob/master/src/htmltojsx.js
/**
* Determines if the CSS value can be converted from a
* 'px' suffixed string to a numeric value.
*
* @param {string} value CSS property value
* @return {boolean}
*/
function isConvertiblePixelValue(value) {
return /^\d+px$/.test(value);
}
/**
* Format style key into JSX style object key.
*
* @param {string} key
* @return {string}
*/
function formatKey(key) {
key = key.toLowerCase(); // Don't capitalize -ms- prefix
if (/^-ms-/.test(key)) key = key.substr(1);
return t.identifier((0, _util.hyphenToCamelCase)(key));
}
/**
* Format style value into JSX style object value.
*
* @param {string} key
* @return {string}
*/
function formatValue(value) {
if ((0, _util.isNumeric)(value)) return t.numericLiteral(Number(value));
if (isConvertiblePixelValue(value)) return t.numericLiteral(Number((0, _util.trimEnd)(value, 'px')));
return t.stringLiteral(value);
}
/**
* Handle parsing of inline styles.
*
* @param {string} rawStyle
* @returns {object}
*/
function stringToObjectStyle(rawStyle) {
const entries = rawStyle.split(';');
const properties = [];
let index = -1;
while (++index < entries.length) {
const entry = entries[index];
const style = entry.trim();
const firstColon = style.indexOf(':');
const value = style.substr(firstColon + 1).trim();
const key = style.substr(0, firstColon);
if (key !== '') {
const property = t.objectProperty(formatKey(key), formatValue(value));
properties.push(property);
}
}
return t.objectExpression(properties);
}
var _default = stringToObjectStyle;
exports.default = _default;

View File

@@ -0,0 +1,54 @@
"use strict";
exports.__esModule = true;
exports.isNumeric = isNumeric;
exports.hyphenToCamelCase = hyphenToCamelCase;
exports.trimEnd = trimEnd;
exports.kebabCase = kebabCase;
exports.replaceSpaces = replaceSpaces;
/**
* Determines if the specified string consists entirely of numeric characters.
*
* @param {*} [value]
* @returns {boolean}
*/
function isNumeric(value) {
return !Number.isNaN(value - parseFloat(value));
}
/**
* Convert a hyphenated string to camelCase.
*
* @param {string} string
* @returns {string}
*/
function hyphenToCamelCase(string) {
return string.replace(/-(.)/g, (match, chr) => chr.toUpperCase());
}
/**
* Trim the specified substring off the string. If the string does not end
* with the specified substring, this is a no-op.
*
* @param {string} haystack String to search in
* @param {string} needle String to search for
* @return {string}
*/
function trimEnd(haystack, needle) {
return haystack.endsWith(needle) ? haystack.slice(0, -needle.length) : haystack;
}
const KEBAB_REGEX = /[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;
function kebabCase(str) {
return str.replace(KEBAB_REGEX, match => `-${match.toLowerCase()}`);
}
const SPACES_REGEXP = /[\t\r\n\u0085\u2028\u2029]+/g;
function replaceSpaces(str) {
return str.replace(SPACES_REGEXP, ' ');
}

View File

@@ -0,0 +1,37 @@
{
"name": "@svgr/hast-util-to-babel-ast",
"description": "Transform HAST to Babel AST (JSX)",
"version": "5.5.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/hast-util-to-babel-ast",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"html",
"hast",
"babel",
"hast-util",
"unist-util",
"unist"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"dependencies": {
"@babel/types": "^7.12.6"
},
"gitHead": "b5920550bd966f876cb65c5e23af180461e5aa23"
}

150
frontend/node_modules/@svgr/plugin-jsx/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,150 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.4.0...v5.5.0) (2020-11-15)
### Bug Fixes
* prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/plugin-jsx
## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.3.0...v5.3.1) (2020-04-05)
**Note:** Version bump only for package @svgr/plugin-jsx
# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.2.0...v5.3.0) (2020-03-22)
**Note:** Version bump only for package @svgr/plugin-jsx
# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.1.0...v5.2.0) (2020-02-23)
**Note:** Version bump only for package @svgr/plugin-jsx
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.3.2...v4.3.3) (2019-09-24)
**Note:** Version bump only for package @svgr/plugin-jsx
## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.3.1...v4.3.2) (2019-07-15)
### Performance Improvements
* replace rehype with svg-parser ([#321](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/issues/321)) ([7eb5ef6](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/commit/7eb5ef6))
## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.3.0...v4.3.1) (2019-07-01)
**Note:** Version bump only for package @svgr/plugin-jsx
# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.2.0...v4.3.0) (2019-05-28)
**Note:** Version bump only for package @svgr/plugin-jsx
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx/compare/v4.1.0...v4.2.0) (2019-04-11)
**Note:** Version bump only for package @svgr/plugin-jsx
# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)
**Note:** Version bump only for package @svgr/plugin-jsx
## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)
### Bug Fixes
* upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))
## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)
**Note:** Version bump only for package @svgr/plugin-jsx
## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)
**Note:** Version bump only for package @svgr/plugin-jsx
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

7
frontend/node_modules/@svgr/plugin-jsx/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

73
frontend/node_modules/@svgr/plugin-jsx/README.md generated vendored Normal file
View File

@@ -0,0 +1,73 @@
# @svgr/plugin-jsx
[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg)](https://travis-ci.org/smooth-code/svgr)
[![Version](https://img.shields.io/npm/v/@svgr/plugin-jsx.svg)](https://www.npmjs.com/package/@svgr/plugin-jsx)
[![MIT License](https://img.shields.io/npm/l/@svgr/plugin-jsx.svg)](https://github.com/smooth-code/svgr/blob/master/LICENSE)
Transforms SVG into JSX.
## Install
```
npm install --save-dev @svgr/plugin-jsx
```
## Usage
**.svgrrc**
```json
{
"plugins": ["@svgr/plugin-jsx"]
}
```
## How does it work?
`@svgr/plugin-jsx` consists in three phases:
- Parsing the SVG code using [svg-parser](https://github.com/Rich-Harris/svg-parser)
- Converting the [HAST](https://github.com/syntax-tree/hast) into a [Babel AST](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)
- Applying [`@svgr/babel-preset`](../babel-preset/README.md) transformations
## Applying custom transformations
You can extend the Babel config applied in this plugin using `jsx.babelConfig` config path:
```js
// .svgrrc.js
module.exports = {
jsx: {
babelConfig: {
plugins: [
// For an example, this plugin will remove "id" attribute from "svg" tag
[
'@svgr/babel-plugin-remove-jsx-attribute',
{
elements: ['svg'],
attributes: ['id'],
},
],
],
},
},
}
```
Several Babel plugins are available:
- [`@svgr/babel-plugin-add-jsx-attribute`](../babel-plugin-add-jsx-attribute/README.md)
- [`@svgr/babel-plugin-remove-jsx-attribute`](../babel-plugin-remove-jsx-attribute/README.md)
- [`@svgr/babel-plugin-remove-jsx-empty-expression`](../babel-plugin-remove-jsx-empty-expression/README.md)
- [`@svgr/babel-plugin-replace-jsx-attribute-value`](../babel-plugin-replace-jsx-attribute-value/README.md)
- [`@svgr/babel-plugin-svg-dynamic-title`](../babel-plugin-svg-dynamic-title/README.md)
- [`@svgr/babel-plugin-svg-em-dimensions`](../babel-plugin-svg-em-dimensions/README.md)
- [`@svgr/babel-plugin-transform-react-native-svg`](../babel-plugin-transform-react-native-svg/README.md)
- [`@svgr/babel-plugin-transform-svg-component`](../babel-plugin-transform-svg-component/README.md)
If you want to create your own, reading [Babel Handbook](https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md) is a good start!
## License
MIT

40
frontend/node_modules/@svgr/plugin-jsx/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
"use strict";
exports.__esModule = true;
exports.default = jsxPlugin;
var _svgParser = require("svg-parser");
var _hastUtilToBabelAst = _interopRequireDefault(require("@svgr/hast-util-to-babel-ast"));
var _core = require("@babel/core");
var _babelPreset = _interopRequireDefault(require("@svgr/babel-preset"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function jsxPlugin(code, config, state) {
const filePath = state.filePath || 'unknown';
const hastTree = (0, _svgParser.parse)(code);
const babelTree = (0, _hastUtilToBabelAst.default)(hastTree);
const {
code: generatedCode
} = (0, _core.transformFromAstSync)(babelTree, code, {
caller: {
name: 'svgr'
},
presets: [(0, _core.createConfigItem)([_babelPreset.default, { ...config,
state
}], {
type: 'preset'
})],
filename: filePath,
babelrc: false,
configFile: false,
code: true,
ast: false,
inputSourceMap: false,
...(config.jsx && config.jsx.babelConfig)
});
return generatedCode;
}

35
frontend/node_modules/@svgr/plugin-jsx/package.json generated vendored Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "@svgr/plugin-jsx",
"description": "Transform SVG into JSX",
"version": "5.5.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/plugin-jsx",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"svgr-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"dependencies": {
"@babel/core": "^7.12.3",
"@svgr/babel-preset": "^5.5.0",
"@svgr/hast-util-to-babel-ast": "^5.5.0",
"svg-parser": "^2.0.2"
},
"gitHead": "b5920550bd966f876cb65c5e23af180461e5aa23"
}

116
frontend/node_modules/@svgr/plugin-svgo/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,116 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.4.0...v5.5.0) (2020-11-15)
### Features
* **svgo:** add .svgorc.js config file support ([#451](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/451)) ([8049b1a](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/8049b1a63603672096892b6ab3d303580c2f303f)), closes [#412](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/412)
### Performance Improvements
* replace merge-deep with smaller deepmerge ([#463](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/463)) ([1f015eb](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/1f015eb16fca093a08b012236dc83623f7bcce55))
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/plugin-svgo
# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.2.0...v5.3.0) (2020-03-22)
### Bug Fixes
* **svgo:** support any SVGO config format ([#412](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/412)) ([f2b2367](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/f2b2367389fda20baba6e0a5e884e7f7fe29a3ed)), closes [#400](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/400)
# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.1.0...v5.2.0) (2020-02-23)
### Bug Fixes
* verify that `svgoConfig.plugins` is an array ([#397](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/397)) ([88110b6](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/88110b6eb4d93ded68ca2de05cc82654dfac977d))
# [5.1.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.0.1...v5.1.0) (2020-01-20)
### Bug Fixes
* fix merging svgo plugins in config ([#384](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/384)) ([c9d2dfc](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/c9d2dfcb8d4da55eb21a13507c87d9e549a86e7e))
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v4.3.0...v4.3.1) (2019-07-01)
**Note:** Version bump only for package @svgr/plugin-svgo
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/compare/v4.1.0...v4.2.0) (2019-04-11)
### Bug Fixes
* keep viewBox when dimensions are removed ([#281](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/issues/281)) ([f476c8e](https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo/commit/f476c8e))
## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)
### Bug Fixes
* upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Features
* **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default

7
frontend/node_modules/@svgr/plugin-svgo/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

27
frontend/node_modules/@svgr/plugin-svgo/README.md generated vendored Normal file
View File

@@ -0,0 +1,27 @@
# @svgr/plugin-svgo
[![Build Status](https://img.shields.io/travis/smooth-code/svgr.svg)](https://travis-ci.org/smooth-code/svgr)
[![Version](https://img.shields.io/npm/v/@svgr/plugin-svgo.svg)](https://www.npmjs.com/package/@svgr/plugin-svgo)
[![MIT License](https://img.shields.io/npm/l/@svgr/plugin-svgo.svg)](https://github.com/smooth-code/svgr/blob/master/LICENSE)
Optimize SVG using SVGO.
## Install
```
npm install --save-dev @svgr/plugin-svgo
```
## Usage
**.svgrrc**
```json
{
"plugins": ["@svgr/plugin-svgo"]
}
```
## License
MIT

67
frontend/node_modules/@svgr/plugin-svgo/lib/config.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
"use strict";
exports.__esModule = true;
exports.getFilePath = getFilePath;
exports.getBaseSvgoConfig = getBaseSvgoConfig;
exports.getPlugins = getPlugins;
exports.mergeSvgoConfig = mergeSvgoConfig;
var _deepmerge = _interopRequireDefault(require("deepmerge"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getFilePath(state) {
return state.filePath || process.cwd();
}
function getBaseSvgoConfig(config) {
const baseSvgoConfig = {
plugins: [{
prefixIds: true
}]
};
if (config.icon || config.dimensions === false) {
baseSvgoConfig.plugins.push({
removeViewBox: false
});
}
return baseSvgoConfig;
}
function getPlugins(config) {
if (!config || !config.plugins) {
return [];
}
if (!Array.isArray(config.plugins)) {
throw Error('`svgoConfig.plugins` must be an array');
}
return config.plugins;
}
function extractPlugins(config) {
if (!config) return [];
if (!config.plugins) return [];
if (!Array.isArray(config.plugins)) return [config.plugins];
return config.plugins;
}
function mergePlugins(configs) {
const plugins = configs.reduce((merged, config) => _deepmerge.default.all([merged, ...extractPlugins(config)]), {});
return Object.keys(plugins).reduce((array, key) => {
array.push({
[key]: plugins[key]
});
return array;
}, []);
}
function mergeSvgoConfig(...configs) {
const plugins = mergePlugins(configs);
return { ..._deepmerge.default.all(configs.filter(Boolean)),
plugins
};
}

111
frontend/node_modules/@svgr/plugin-svgo/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,111 @@
"use strict";
exports.__esModule = true;
exports.default = svgoPlugin;
var _svgo = _interopRequireDefault(require("svgo"));
var _cosmiconfig = require("cosmiconfig");
var _config = require("./config");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable no-underscore-dangle */
const explorer = (0, _cosmiconfig.cosmiconfigSync)('svgo', {
searchPlaces: ['package.json', '.svgorc', '.svgorc.js', '.svgorc.json', '.svgorc.yaml', '.svgorc.yml', 'svgo.config.js', '.svgo.yml'],
transform: result => result && result.config,
cache: true
});
function encodeSVGDatauri(str, type) {
let prefix = 'data:image/svg+xml'; // base64
if (!type || type === 'base64') {
prefix += ';base64,';
if (Buffer.from) {
str = prefix + Buffer.from(str).toString('base64');
} else {
// eslint-disable-next-line
str = prefix + new Buffer(str).toString('base64');
} // URI encoded
} else if (type === 'enc') {
str = `${prefix},${encodeURIComponent(str)}`; // unencoded
} else if (type === 'unenc') {
str = `${prefix},${str}`;
}
return str;
} // See https://github.com/svg/svgo/blob/master/lib/svgo.js#L24
// _optimizeOnce is synchronous internally
function optimizeSync(svgstr, info) {
const {
config
} = this;
if (config.error) {
throw config.error;
}
const maxPassCount = config.multipass ? 10 : 1;
let counter = 0;
let prevResultSize = Number.POSITIVE_INFINITY;
let result;
const optimizeOnceCallback = svgjs => {
if (svgjs.error) {
throw svgjs.error;
} // eslint-disable-next-line no-plusplus
if (++counter < maxPassCount && svgjs.data.length < prevResultSize) {
prevResultSize = svgjs.data.length;
this._optimizeOnce(svgjs.data, info, optimizeOnceCallback);
} else {
if (config.datauri) {
svgjs.data = encodeSVGDatauri(svgjs.data, config.datauri);
}
if (info.path) {
svgjs.path = info.path;
}
result = svgjs;
}
};
this._optimizeOnce(svgstr, info, optimizeOnceCallback);
return result;
}
function createSvgo(config, rcConfig) {
const baseSvgoConfig = (0, _config.getBaseSvgoConfig)(config);
const mergedConfig = (0, _config.mergeSvgoConfig)(baseSvgoConfig, rcConfig, config.svgoConfig);
return new _svgo.default(mergedConfig);
}
function getInfo(state) {
return state.filePath ? {
input: 'file',
path: state.filePath
} : {
input: 'string'
};
}
function svgoPlugin(code, config, state) {
if (!config.svgo) return code;
const filePath = (0, _config.getFilePath)(state);
const svgoRcConfig = config.runtimeConfig ? explorer.search(filePath) : {};
const svgo = createSvgo(config, svgoRcConfig);
const {
data
} = optimizeSync.call(svgo, code, getInfo(state));
return data;
}

34
frontend/node_modules/@svgr/plugin-svgo/package.json generated vendored Normal file
View File

@@ -0,0 +1,34 @@
{
"name": "@svgr/plugin-svgo",
"description": "Optimize SVG",
"version": "5.5.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/plugin-svgo",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"svgr-plugin"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"dependencies": {
"cosmiconfig": "^7.0.0",
"deepmerge": "^4.2.2",
"svgo": "^1.2.2"
},
"gitHead": "b5920550bd966f876cb65c5e23af180461e5aa23"
}

284
frontend/node_modules/@svgr/webpack/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,284 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [5.5.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.4.0...v5.5.0) (2020-11-15)
### Bug Fixes
* prevent removing the namespace by svgr ([[#475](https://github.com/gregberge/svgr/tree/master/packages/webpack/issues/475)](https://github.com/gregberge/svgr/issues/475) ([#498](https://github.com/gregberge/svgr/tree/master/packages/webpack/issues/498)) ([00e84ea](https://github.com/gregberge/svgr/tree/master/packages/webpack/commit/00e84ead96d89bcbd072b9585b4db1365e392d33))
### Features
* allow custom name for named export ([#493](https://github.com/gregberge/svgr/tree/master/packages/webpack/issues/493)) ([16a58d6](https://github.com/gregberge/svgr/tree/master/packages/webpack/commit/16a58d6e817c065f72a68be91600a1a360205f44))
# [5.4.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.3.1...v5.4.0) (2020-04-27)
**Note:** Version bump only for package @svgr/webpack
## [5.3.1](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.3.0...v5.3.1) (2020-04-05)
**Note:** Version bump only for package @svgr/webpack
# [5.3.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.2.0...v5.3.0) (2020-03-22)
**Note:** Version bump only for package @svgr/webpack
# [5.2.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.1.0...v5.2.0) (2020-02-23)
**Note:** Version bump only for package @svgr/webpack
# [5.1.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.0.1...v5.1.0) (2020-01-20)
**Note:** Version bump only for package @svgr/webpack
## [5.0.1](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v5.0.0...v5.0.1) (2019-12-29)
### Bug Fixes
* fix engines in package.json ([a45d6fc](https://github.com/gregberge/svgr/tree/master/packages/webpack/commit/a45d6fc8b43402bec60ed4e9273f90fdc65a23a7))
## [4.3.3](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.3.2...v4.3.3) (2019-09-24)
**Note:** Version bump only for package @svgr/webpack
## [4.3.2](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.3.1...v4.3.2) (2019-07-15)
**Note:** Version bump only for package @svgr/webpack
## [4.3.1](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.3.0...v4.3.1) (2019-07-01)
**Note:** Version bump only for package @svgr/webpack
# [4.3.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.2.0...v4.3.0) (2019-05-28)
**Note:** Version bump only for package @svgr/webpack
# [4.2.0](https://github.com/gregberge/svgr/tree/master/packages/webpack/compare/v4.1.0...v4.2.0) (2019-04-11)
**Note:** Version bump only for package @svgr/webpack
# [4.1.0](https://github.com/gregberge/svgr/compare/v4.0.4...v4.1.0) (2018-11-24)
### Features
* add parcel plugin ([#235](https://github.com/gregberge/svgr/issues/235)) ([144dbe3](https://github.com/gregberge/svgr/commit/144dbe3)), closes [#215](https://github.com/gregberge/svgr/issues/215)
## [4.0.4](https://github.com/gregberge/svgr/compare/v4.0.3...v4.0.4) (2018-11-24)
### Bug Fixes
* **webpack:** use static babel config ([#240](https://github.com/gregberge/svgr/issues/240)) ([d67af31](https://github.com/gregberge/svgr/commit/d67af31)), closes [#232](https://github.com/gregberge/svgr/issues/232)
## [4.0.3](https://github.com/gregberge/svgr/compare/v4.0.2...v4.0.3) (2018-11-13)
### Bug Fixes
* upgrade dependencies ([7e2195f](https://github.com/gregberge/svgr/commit/7e2195f))
## [4.0.2](https://github.com/gregberge/svgr/compare/v4.0.1...v4.0.2) (2018-11-08)
**Note:** Version bump only for package @svgr/webpack
## [4.0.1](https://github.com/gregberge/svgr/compare/v4.0.0...v4.0.1) (2018-11-08)
**Note:** Version bump only for package @svgr/webpack
# [4.0.0](https://github.com/gregberge/svgr/compare/v3.1.0...v4.0.0) (2018-11-04)
### Bug Fixes
* prevent babel read babel.config.js ([#206](https://github.com/gregberge/svgr/issues/206)) ([514d43d](https://github.com/gregberge/svgr/commit/514d43d))
### Features
* **svgo:** prefix ids by default ([06c338d](https://github.com/gregberge/svgr/commit/06c338d)), closes [#210](https://github.com/gregberge/svgr/issues/210)
* **v4:** new architecture ([ac8b8ca](https://github.com/gregberge/svgr/commit/ac8b8ca))
### BREAKING CHANGES
* **v4:** - `template` option must now returns a Babel AST
- `@svgr/core` does not include svgo & prettier by default
# [3.1.0](https://github.com/gregberge/svgr/compare/v3.0.0...v3.1.0) (2018-10-05)
**Note:** Version bump only for package @svgr/webpack
<a name="3.0.0"></a>
# [3.0.0](https://github.com/gregberge/svgr/compare/v2.4.1...v3.0.0) (2018-10-01)
### Bug Fixes
* **webpack:** forward filePath in webpack loader ([b7a108e](https://github.com/gregberge/svgr/commit/b7a108e)), closes [#177](https://github.com/gregberge/svgr/issues/177) [#188](https://github.com/gregberge/svgr/issues/188)
### Features
* always prefix component name with "Svg" ([f71aa7a](https://github.com/gregberge/svgr/commit/f71aa7a)), closes [#190](https://github.com/gregberge/svgr/issues/190)
### BREAKING CHANGES
* **webpack:** runtime configuration is now loaded using webpack
loader.
<a name="2.4.1"></a>
## [2.4.1](https://github.com/gregberge/svgr/compare/v2.4.0...v2.4.1) (2018-09-16)
**Note:** Version bump only for package @svgr/webpack
<a name="2.4.0"></a>
# [2.4.0](https://github.com/gregberge/svgr/compare/v2.3.0...v2.4.0) (2018-09-16)
### Features
* **upgrade:** h2x@1.1.0 (jsdom@12.0.0) & others ([2d9b7bd](https://github.com/gregberge/svgr/commit/2d9b7bd))
<a name="2.3.0"></a>
# [2.3.0](https://github.com/gregberge/svgr/compare/v2.2.1...v2.3.0) (2018-09-03)
### Features
* upgrade to Babel v7 ([7bc908d](https://github.com/gregberge/svgr/commit/7bc908d))
<a name="2.2.1"></a>
## [2.2.1](https://github.com/gregberge/svgr/compare/v2.2.0...v2.2.1) (2018-08-16)
**Note:** Version bump only for package @svgr/webpack
<a name="2.2.0"></a>
# [2.2.0](https://github.com/gregberge/svgr/compare/v2.1.1...v2.2.0) (2018-08-13)
### Bug Fixes
* **webpack:** use source when possible ([#139](https://github.com/gregberge/svgr/issues/139)) ([ae9965d](https://github.com/gregberge/svgr/commit/ae9965d))
<a name="2.1.1"></a>
## [2.1.1](https://github.com/gregberge/svgr/compare/v2.1.0...v2.1.1) (2018-07-11)
**Note:** Version bump only for package @svgr/webpack
<a name="2.1.0"></a>
# [2.1.0](https://github.com/gregberge/svgr/compare/v2.0.0...v2.1.0) (2018-07-08)
**Note:** Version bump only for package @svgr/webpack

7
frontend/node_modules/@svgr/webpack/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,7 @@
Copyright 2017 Smooth Code
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

125
frontend/node_modules/@svgr/webpack/README.md generated vendored Normal file
View File

@@ -0,0 +1,125 @@
# @svgr/webpack
[![Build Status](https://img.shields.io/travis/gregberge/svgr.svg)](https://travis-ci.org/gregberge/svgr)
[![Version](https://img.shields.io/npm/v/@svgr/webpack.svg)](https://www.npmjs.com/package/@svgr/webpack)
[![MIT License](https://img.shields.io/npm/l/@svgr/webpack.svg)](https://github.com/gregberge/svgr/blob/master/LICENSE)
Webpack loader for SVGR.
```
npm install @svgr/webpack --save-dev
```
## Usage
In your `webpack.config.js`:
```js
{
test: /\.svg$/,
use: ['@svgr/webpack'],
}
```
In your code:
```js
import Star from './star.svg'
const App = () => (
<div>
<Star />
</div>
)
```
### Passing options
```js
{
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
native: true,
},
},
],
}
```
### Using with `url-loader` or `file-loader`
It is possible to use it with [`url-loader`](https://github.com/webpack-contrib/url-loader) or [`file-loader`](https://github.com/webpack-contrib/file-loader).
In your `webpack.config.js`:
```js
{
test: /\.svg$/,
use: ['@svgr/webpack', 'url-loader'],
}
```
In your code:
```js
import starUrl, { ReactComponent as Star } from './star.svg'
const App = () => (
<div>
<img src={starUrl} alt="star" />
<Star />
</div>
)
```
The named export defaults to `ReactComponent`, but can be customized with the `namedExport` option.
### Use your own Babel configuration
By default, `@svgr/webpack` includes a `babel-loader` with [an optimized configuration](https://github.com/gregberge/svgr/blob/master/packages/webpack/src/index.js). In some case you may want to apply a custom one (if you are using Preact for an example). You can turn off Babel transformation by specifying `babel: false` in options.
```js
// Example using preact
{
test: /\.svg$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['preact', 'env'],
},
},
{
loader: '@svgr/webpack',
options: { babel: false },
}
],
}
```
### Handle SVG in CSS, Sass or Less
It is possible to detect the module that requires your SVG using [`Rule.issuer`](https://webpack.js.org/configuration/module/#rule-issuer) in Webpack. Using it you can specify two different configurations for JavaScript and the rest of your files.
```js
[
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
issuer: {
test: /\.jsx?$/
},
use: ['babel-loader', '@svgr/webpack', 'url-loader']
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader'
},
]
```
## License
MIT

82
frontend/node_modules/@svgr/webpack/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,82 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _loaderUtils = require("loader-utils");
var _core = require("@babel/core");
var _core2 = _interopRequireDefault(require("@svgr/core"));
var _pluginSvgo = _interopRequireDefault(require("@svgr/plugin-svgo"));
var _pluginJsx = _interopRequireDefault(require("@svgr/plugin-jsx"));
var _presetReact = _interopRequireDefault(require("@babel/preset-react"));
var _presetEnv = _interopRequireDefault(require("@babel/preset-env"));
var _pluginTransformReactConstantElements = _interopRequireDefault(require("@babel/plugin-transform-react-constant-elements"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const babelOptions = {
babelrc: false,
configFile: false,
presets: [(0, _core.createConfigItem)(_presetReact.default, {
type: 'preset'
}), (0, _core.createConfigItem)([_presetEnv.default, {
modules: false
}], {
type: 'preset'
})],
plugins: [(0, _core.createConfigItem)(_pluginTransformReactConstantElements.default)]
};
function svgrLoader(source) {
const callback = this.async();
const {
babel = true,
...options
} = (0, _loaderUtils.getOptions)(this) || {};
const readSvg = () => new Promise((resolve, reject) => {
this.fs.readFile(this.resourcePath, (err, result) => {
if (err) reject(err);
resolve(result);
});
});
const previousExport = (() => {
if (source.toString('utf-8').startsWith('export ')) {
return source;
}
const exportMatches = source.toString('utf-8').match(/^module.exports\s*=\s*(.*)/);
return exportMatches ? `export default ${exportMatches[1]}` : null;
})();
const tranformSvg = svg => (0, _core2.default)(svg, options, {
caller: {
name: '@svgr/webpack',
previousExport,
defaultPlugins: [_pluginSvgo.default, _pluginJsx.default]
},
filePath: this.resourcePath
}).then(jsCode => {
if (!babel) return jsCode;
return (0, _core.transformAsync)(jsCode, babelOptions).then(({
code
}) => code);
}).then(result => callback(null, result)).catch(err => callback(err));
if (previousExport) {
readSvg().then(tranformSvg);
} else {
tranformSvg(source);
}
}
var _default = svgrLoader;
exports.default = _default;

49
frontend/node_modules/@svgr/webpack/package.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "@svgr/webpack",
"description": "SVGR webpack loader.",
"version": "5.5.0",
"main": "lib/index.js",
"repository": "https://github.com/gregberge/svgr/tree/master/packages/webpack",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"svgr",
"svg",
"react",
"webpack",
"webpack-loader"
],
"engines": {
"node": ">=10"
},
"homepage": "https://react-svgr.com",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/gregberge"
},
"license": "MIT",
"scripts": {
"prebuild": "rm -rf lib/",
"build": "babel --config-file ../../babel.config.js -d lib --ignore \"**/*.test.js\" src",
"prepublishOnly": "yarn run build"
},
"dependencies": {
"@babel/core": "^7.12.3",
"@babel/plugin-transform-react-constant-elements": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.5",
"@svgr/core": "^5.5.0",
"@svgr/plugin-jsx": "^5.5.0",
"@svgr/plugin-svgo": "^5.5.0",
"loader-utils": "^2.0.0"
},
"devDependencies": {
"babel-loader": "^8.2.1",
"memory-fs": "^0.5.0",
"url-loader": "^4.1.1",
"webpack": "^5.4.0"
},
"gitHead": "b5920550bd966f876cb65c5e23af180461e5aa23"
}