This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

7
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
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 { transform } 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>
`
transform(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
```
```

72
node_modules/@svgr/core/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,72 @@
import { Options } from 'prettier';
import { OptimizeOptions } from 'svgo';
import { Options as Options$1 } from '@svgr/babel-preset';
import { TransformOptions } from '@babel/core';
interface State {
filePath?: string;
componentName: string;
caller?: {
name?: string;
previousExport?: string | null;
defaultPlugins?: ConfigPlugin[];
};
}
interface Plugin {
(code: string, config: Config, state: State): string;
}
declare type ConfigPlugin = string | Plugin;
interface Config {
ref?: boolean;
titleProp?: boolean;
descProp?: boolean;
expandProps?: boolean | 'start' | 'end';
dimensions?: boolean;
icon?: boolean | string | number;
native?: boolean;
svgProps?: {
[key: string]: string;
};
replaceAttrValues?: {
[key: string]: string;
};
runtimeConfig?: boolean;
typescript?: boolean;
prettier?: boolean;
prettierConfig?: Options;
svgo?: boolean;
svgoConfig?: OptimizeOptions;
configFile?: string;
template?: Options$1['template'];
memo?: boolean;
exportType?: 'named' | 'default';
namedExport?: string;
jsxRuntime?: 'classic' | 'classic-preact' | 'automatic';
index?: boolean;
plugins?: ConfigPlugin[];
jsx?: {
babelConfig?: TransformOptions;
};
}
declare const DEFAULT_CONFIG: Config;
declare const resolveConfig: {
(searchFrom?: string, configFile?: string): Promise<Config | null>;
sync(searchFrom?: string, configFile?: string): Config | null;
};
declare const resolveConfigFile: {
(filePath: string): Promise<string | null>;
sync(filePath: string): string | null;
};
declare const loadConfig: {
({ configFile, ...baseConfig }: Config, state?: Pick<State, 'filePath'>): Promise<Config>;
sync({ configFile, ...baseConfig }: Config, state?: Pick<State, 'filePath'>): Config;
};
declare const transform: {
(code: string, config?: Config, state?: Partial<State>): Promise<string>;
sync(code: string, config?: Config, state?: Partial<State>): string;
};
export { Config, ConfigPlugin, DEFAULT_CONFIG, Plugin, State, loadConfig, resolveConfig, resolveConfigFile, transform };

200
node_modules/@svgr/core/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,200 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var path = require('path');
var camelCase = require('camelcase');
var cosmiconfig = require('cosmiconfig');
var jsx = require('@svgr/plugin-jsx');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var camelCase__default = /*#__PURE__*/_interopDefaultLegacy(camelCase);
var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
var __defProp$1 = Object.defineProperty;
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues$1 = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
if (__getOwnPropSymbols$1)
for (var prop of __getOwnPropSymbols$1(b)) {
if (__propIsEnum$1.call(b, prop))
__defNormalProp$1(a, prop, b[prop]);
}
return a;
};
const VALID_CHAR_REGEX = /[^a-zA-Z0-9 _-]/g;
const getComponentName = (filePath) => {
if (!filePath)
return "SvgComponent";
const pascalCaseFileName = camelCase__default["default"](
path.parse(filePath).name.replace(VALID_CHAR_REGEX, ""),
{
pascalCase: true
}
);
return `Svg${pascalCaseFileName}`;
};
const expandState = (state) => {
return __spreadValues$1({
componentName: state.componentName || getComponentName(state.filePath)
}, state);
};
var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
const DEFAULT_CONFIG = {
dimensions: true,
expandProps: "end",
icon: false,
native: false,
typescript: false,
prettier: true,
prettierConfig: void 0,
memo: false,
ref: false,
replaceAttrValues: void 0,
svgProps: void 0,
svgo: true,
svgoConfig: void 0,
template: void 0,
index: false,
titleProp: false,
descProp: false,
runtimeConfig: true,
namedExport: "ReactComponent",
exportType: "default"
};
const explorer = cosmiconfig.cosmiconfig("svgr");
const explorerSync = cosmiconfig.cosmiconfigSync("svgr");
const resolveConfig = async (searchFrom, configFile) => {
if (configFile == null) {
const result2 = await explorer.search(searchFrom);
return result2 ? result2.config : null;
}
const result = await explorer.load(configFile);
return result ? result.config : null;
};
resolveConfig.sync = (searchFrom, configFile) => {
if (configFile == null) {
const result2 = explorerSync.search(searchFrom);
return result2 ? result2.config : null;
}
const result = explorerSync.load(configFile);
return result ? result.config : null;
};
const resolveConfigFile = async (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;
};
const loadConfig = async (_a, state = {}) => {
var _b = _a, { configFile } = _b, baseConfig = __objRest(_b, ["configFile"]);
const rcConfig = state.filePath && baseConfig.runtimeConfig !== false ? await resolveConfig(state.filePath, configFile) : {};
return __spreadValues(__spreadValues(__spreadValues({}, DEFAULT_CONFIG), rcConfig), baseConfig);
};
loadConfig.sync = (_c, state = {}) => {
var _d = _c, { configFile } = _d, baseConfig = __objRest(_d, ["configFile"]);
const rcConfig = state.filePath && baseConfig.runtimeConfig !== false ? resolveConfig.sync(state.filePath, configFile) : {};
return __spreadValues(__spreadValues(__spreadValues({}, DEFAULT_CONFIG), rcConfig), baseConfig);
};
const DEFAULT_PLUGINS = [jsx__default["default"]];
const getPlugins = (config, state) => {
var _a;
if (config.plugins) {
return config.plugins;
}
if ((_a = state.caller) == null ? void 0 : _a.defaultPlugins) {
return state.caller.defaultPlugins;
}
return DEFAULT_PLUGINS;
};
const resolvePlugin = (plugin) => {
if (typeof plugin === "function") {
return plugin;
}
if (typeof plugin === "string") {
return loadPlugin(plugin);
}
throw new Error(`Invalid plugin "${plugin}"`);
};
const pluginCache = {};
const resolveModule = (m) => m ? m.default || m : null;
const loadPlugin = (moduleName) => {
if (pluginCache[moduleName]) {
return pluginCache[moduleName];
}
try {
const plugin = resolveModule(require(moduleName));
if (!plugin) {
throw new Error(`Invalid plugin "${moduleName}"`);
}
pluginCache[moduleName] = plugin;
return pluginCache[moduleName];
} catch (error) {
console.log(error);
throw new Error(
`Module "${moduleName}" missing. Maybe \`npm install ${moduleName}\` could help!`
);
}
};
const run = (code, config, state) => {
const expandedState = expandState(state);
const plugins = getPlugins(config, state).map(resolvePlugin);
let nextCode = String(code).replace("\0", "");
for (const plugin of plugins) {
nextCode = plugin(nextCode, config, expandedState);
}
return nextCode;
};
const transform = async (code, config = {}, state = {}) => {
config = await loadConfig(config, state);
return run(code, config, state);
};
transform.sync = (code, config = {}, state = {}) => {
config = loadConfig.sync(config, state);
return run(code, config, state);
};
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
exports.loadConfig = loadConfig;
exports.resolveConfig = resolveConfig;
exports.resolveConfigFile = resolveConfigFile;
exports.transform = transform;
//# sourceMappingURL=index.js.map

1
node_modules/@svgr/core/dist/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

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

@@ -0,0 +1,51 @@
{
"name": "@svgr/core",
"description": "Transform SVG into React Components.",
"version": "6.5.1",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"repository": "https://github.com/gregberge/svgr/tree/main/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": {
"reset": "rm -rf dist",
"build": "rollup -c ../../build/rollup.config.js",
"prepublishOnly": "npm run reset && npm run build"
},
"dependencies": {
"@babel/core": "^7.19.6",
"@svgr/babel-preset": "^6.5.1",
"@svgr/plugin-jsx": "^6.5.1",
"camelcase": "^6.2.0",
"cosmiconfig": "^7.0.1"
},
"devDependencies": {
"@types/svgo": "^2.6.4"
},
"gitHead": "d5efedd372999692f84d30072e502b5a6b8fe734"
}