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

View File

@@ -1,5 +0,0 @@
import { Plugin } from '@svgr/core';
declare const jsxPlugin: Plugin;
export { jsxPlugin as default };

View File

@@ -1,101 +0,0 @@
'use strict';
var svgParser = require('svg-parser');
var hastToBabelAst = require('@svgr/hast-util-to-babel-ast');
var core = require('@babel/core');
var svgrBabelPreset = require('@svgr/babel-preset');
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
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 __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
const getJsxRuntimeOptions = (config) => {
if (config.jsxRuntimeImport) {
return {
importSource: config.jsxRuntimeImport.source,
jsxRuntimeImport: config.jsxRuntimeImport
};
}
switch (config.jsxRuntime) {
case null:
case void 0:
case "classic":
return {
jsxRuntime: "classic",
importSource: "react",
jsxRuntimeImport: { namespace: "React", source: "react" }
};
case "classic-preact":
return {
jsxRuntime: "classic",
importSource: "preact/compat",
jsxRuntimeImport: { specifiers: ["h"], source: "preact" }
};
case "automatic":
return { jsxRuntime: "automatic" };
default:
throw new Error(`Unsupported "jsxRuntime" "${config.jsxRuntime}"`);
}
};
const jsxPlugin = (code, config, state) => {
const filePath = state.filePath || "unknown";
const hastTree = svgParser.parse(code);
const babelTree = hastToBabelAst(hastTree);
const svgPresetOptions = __spreadProps(__spreadValues({
ref: config.ref,
titleProp: config.titleProp,
descProp: config.descProp,
expandProps: config.expandProps,
dimensions: config.dimensions,
icon: config.icon,
native: config.native,
svgProps: config.svgProps,
replaceAttrValues: config.replaceAttrValues,
typescript: config.typescript,
template: config.template,
memo: config.memo,
exportType: config.exportType,
namedExport: config.namedExport
}, getJsxRuntimeOptions(config)), {
state
});
const result = core.transformFromAstSync(babelTree, code, __spreadValues({
caller: {
name: "svgr"
},
presets: [
core.createConfigItem([svgrBabelPreset, svgPresetOptions], {
type: "preset"
})
],
filename: filePath,
babelrc: false,
configFile: false,
code: true,
ast: false,
// @ts-ignore
inputSourceMap: false
}, config.jsx && config.jsx.babelConfig));
if (!(result == null ? void 0 : result.code)) {
throw new Error(`Unable to generate SVG file`);
}
return result.code;
};
module.exports = jsxPlugin;
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { parse } from 'svg-parser'\nimport hastToBabelAst from '@svgr/hast-util-to-babel-ast'\nimport { transformFromAstSync, createConfigItem } from '@babel/core'\nimport svgrBabelPreset, {\n Options as SvgrPresetOptions,\n} from '@svgr/babel-preset'\nimport type { Plugin, Config } from '@svgr/core'\n\nconst getJsxRuntimeOptions = (config: Config): Partial<SvgrPresetOptions> => {\n if (config.jsxRuntimeImport) {\n return {\n importSource: config.jsxRuntimeImport.source,\n jsxRuntimeImport: config.jsxRuntimeImport,\n }\n }\n switch (config.jsxRuntime) {\n case null:\n case undefined:\n case 'classic':\n return {\n jsxRuntime: 'classic',\n importSource: 'react',\n jsxRuntimeImport: { namespace: 'React', source: 'react' },\n }\n case 'classic-preact':\n return {\n jsxRuntime: 'classic',\n importSource: 'preact/compat',\n jsxRuntimeImport: { specifiers: ['h'], source: 'preact' },\n }\n case 'automatic':\n return { jsxRuntime: 'automatic' }\n default:\n throw new Error(`Unsupported \"jsxRuntime\" \"${config.jsxRuntime}\"`)\n }\n}\n\nconst jsxPlugin: Plugin = (code, config, state) => {\n const filePath = state.filePath || 'unknown'\n const hastTree = parse(code)\n\n const babelTree = hastToBabelAst(hastTree)\n\n const svgPresetOptions: SvgrPresetOptions = {\n ref: config.ref,\n titleProp: config.titleProp,\n descProp: config.descProp,\n expandProps: config.expandProps,\n dimensions: config.dimensions,\n icon: config.icon,\n native: config.native,\n svgProps: config.svgProps,\n replaceAttrValues: config.replaceAttrValues,\n typescript: config.typescript,\n template: config.template,\n memo: config.memo,\n exportType: config.exportType,\n namedExport: config.namedExport,\n ...getJsxRuntimeOptions(config),\n state,\n }\n\n const result = transformFromAstSync(babelTree, code, {\n caller: {\n name: 'svgr',\n },\n presets: [\n createConfigItem([svgrBabelPreset, svgPresetOptions], {\n type: 'preset',\n }),\n ],\n filename: filePath,\n babelrc: false,\n configFile: false,\n code: true,\n ast: false,\n // @ts-ignore\n inputSourceMap: false,\n ...(config.jsx && config.jsx.babelConfig),\n })\n\n if (!result?.code) {\n throw new Error(`Unable to generate SVG file`)\n }\n\n return result.code\n}\n\nexport default jsxPlugin\n"],"names":["parse","transformFromAstSync","createConfigItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,oBAAA,GAAuB,CAAC,MAA+C,KAAA;AAC3E,EAAA,IAAI,OAAO,gBAAkB,EAAA;AAC3B,IAAO,OAAA;AAAA,MACL,YAAA,EAAc,OAAO,gBAAiB,CAAA,MAAA;AAAA,MACtC,kBAAkB,MAAO,CAAA,gBAAA;AAAA,KAC3B,CAAA;AAAA,GACF;AACA,EAAA,QAAQ,OAAO,UAAY;AAAA,IACzB,KAAK,IAAA,CAAA;AAAA,IACL,KAAK,KAAA,CAAA,CAAA;AAAA,IACL,KAAK,SAAA;AACH,MAAO,OAAA;AAAA,QACL,UAAY,EAAA,SAAA;AAAA,QACZ,YAAc,EAAA,OAAA;AAAA,QACd,gBAAkB,EAAA,EAAE,SAAW,EAAA,OAAA,EAAS,QAAQ,OAAQ,EAAA;AAAA,OAC1D,CAAA;AAAA,IACF,KAAK,gBAAA;AACH,MAAO,OAAA;AAAA,QACL,UAAY,EAAA,SAAA;AAAA,QACZ,YAAc,EAAA,eAAA;AAAA,QACd,kBAAkB,EAAE,UAAA,EAAY,CAAC,GAAG,CAAA,EAAG,QAAQ,QAAS,EAAA;AAAA,OAC1D,CAAA;AAAA,IACF,KAAK,WAAA;AACH,MAAO,OAAA,EAAE,YAAY,WAAY,EAAA,CAAA;AAAA,IACnC;AACE,MAAA,MAAM,IAAI,KAAA,CAAM,CAA6B,0BAAA,EAAA,MAAA,CAAO,UAAa,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,GACrE;AACF,CAAA,CAAA;A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A,IACV,OAAS,EAAA,KAAA;AAAA,IACT,UAAY,EAAA,KAAA;AAAA,IACZ,IAAM,EAAA,IAAA;AAAA,IACN,GAAK,EAAA,KAAA;AAAA;AAAA,IAEL,cAAgB,EAAA,KAAA;AAAA,GAAA,EACZ,MAAO,CAAA,GAAA,IAAO,MAAO,CAAA,GAAA,CAAI,WAC9B,CAAA,CAAA,CAAA;AAED,EAAI,IAAA,EAAC,iCAAQ,IAAM,CAAA,EAAA;AACjB,IAAM,MAAA,IAAI,MAAM,CAA6B,2BAAA,CAAA,CAAA,CAAA;AAAA,GAC/C;AAEA,EAAA,OAAO,MAAO,CAAA,IAAA,CAAA;AAChB;;;;"}

View File

@@ -1,50 +0,0 @@
{
"name": "@svgr/plugin-jsx",
"description": "Transform SVG into JSX",
"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/plugin-jsx",
"author": "Greg Bergé <berge.greg@gmail.com>",
"publishConfig": {
"access": "public"
},
"keywords": [
"svgr-plugin"
],
"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": "pnpm run reset && pnpm run build"
},
"dependencies": {
"@babel/core": "^7.21.3",
"@svgr/babel-preset": "8.1.0",
"@svgr/hast-util-to-babel-ast": "8.0.0",
"svg-parser": "^2.0.4"
},
"devDependencies": {
"@svgr/core": "8.1.0",
"@types/svg-parser": "^2.0.3"
},
"peerDependencies": {
"@svgr/core": "*"
},
"gitHead": "772592e042be5063e782bfb8711d024b2fefc6b8"
}