mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-04 15:12:20 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
116
web/node_modules/@svgr/babel-plugin-transform-svg-component/CHANGELOG.md
generated
vendored
Normal file
116
web/node_modules/@svgr/babel-plugin-transform-svg-component/CHANGELOG.md
generated
vendored
Normal 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
|
7
web/node_modules/@svgr/babel-plugin-transform-svg-component/LICENSE
generated
vendored
Normal file
7
web/node_modules/@svgr/babel-plugin-transform-svg-component/LICENSE
generated
vendored
Normal 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.
|
23
web/node_modules/@svgr/babel-plugin-transform-svg-component/README.md
generated
vendored
Normal file
23
web/node_modules/@svgr/babel-plugin-transform-svg-component/README.md
generated
vendored
Normal 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
|
67
web/node_modules/@svgr/babel-plugin-transform-svg-component/lib/index.js
generated
vendored
Normal file
67
web/node_modules/@svgr/babel-plugin-transform-svg-component/lib/index.js
generated
vendored
Normal 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;
|
211
web/node_modules/@svgr/babel-plugin-transform-svg-component/lib/util.js
generated
vendored
Normal file
211
web/node_modules/@svgr/babel-plugin-transform-svg-component/lib/util.js
generated
vendored
Normal 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;
|
29
web/node_modules/@svgr/babel-plugin-transform-svg-component/package.json
generated
vendored
Normal file
29
web/node_modules/@svgr/babel-plugin-transform-svg-component/package.json
generated
vendored
Normal 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"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue