Add yet-another-react-lightbox package and update .gitignore to exclude node_modules

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-12 18:50:30 +00:00
parent bd2a5570a9
commit c92f4a5edd
9304 changed files with 29 additions and 2008667 deletions

View File

@@ -1,7 +0,0 @@
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

@@ -1,56 +0,0 @@
# @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 any plugin, 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

View File

@@ -1,78 +0,0 @@
import { Options } from 'prettier';
import { Config as Config$1 } 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;
}
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?: Config$1;
configFile?: string;
template?: Options$1['template'];
memo?: boolean;
exportType?: 'named' | 'default';
namedExport?: string;
jsxRuntime?: 'classic' | 'classic-preact' | 'automatic';
jsxRuntimeImport?: {
source: string;
namespace?: string;
specifiers?: string[];
defaultSpecifier?: string;
};
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 };

View File

@@ -1,192 +0,0 @@
'use strict';
var path = require('path');
var camelCase = require('camelcase');
var cosmiconfig = require('cosmiconfig');
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(
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), baseConfig), rcConfig);
};
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), baseConfig), rcConfig);
};
const DEFAULT_PLUGINS = [];
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

File diff suppressed because one or more lines are too long

View File

@@ -1,51 +0,0 @@
{
"name": "@svgr/core",
"description": "Transform SVG into React Components.",
"version": "8.1.0",
"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": ">=14"
},
"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.mjs",
"prepublishOnly": "npm run reset && npm run build"
},
"dependencies": {
"@babel/core": "^7.21.3",
"@svgr/babel-preset": "8.1.0",
"camelcase": "^6.2.0",
"cosmiconfig": "^8.1.3",
"snake-case": "^3.0.4"
},
"devDependencies": {
"svgo": "^3.0.2"
},
"gitHead": "772592e042be5063e782bfb8711d024b2fefc6b8"
}