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,13 +0,0 @@
import { ConfigAPI, NodePath, types } from '@babel/core';
interface Options {
width: number | string;
height: number | string;
}
declare const plugin: (_: ConfigAPI, opts: Options) => {
visitor: {
JSXOpeningElement(path: NodePath<types.JSXOpeningElement>): void;
};
};
export { Options, plugin as default };

View File

@@ -1,57 +0,0 @@
'use strict';
var core = require('@babel/core');
const elements = ["svg", "Svg"];
const getValue = (raw) => {
if (raw === void 0)
return core.types.stringLiteral("1em");
switch (typeof raw) {
case "number":
return core.types.jsxExpressionContainer(core.types.numericLiteral(raw));
case "string":
return core.types.stringLiteral(raw);
default:
return core.types.stringLiteral("1em");
}
};
const plugin = (_, opts) => ({
visitor: {
JSXOpeningElement(path) {
if (!elements.some(
(element) => path.get("name").isJSXIdentifier({ name: element })
))
return;
const values = {
width: getValue(opts.width),
height: getValue(opts.height)
};
const requiredAttributes = Object.keys(values);
path.get("attributes").forEach((attributePath) => {
if (!attributePath.isJSXAttribute())
return;
const namePath = attributePath.get("name");
if (!namePath.isJSXIdentifier())
return;
const index = requiredAttributes.indexOf(namePath.node.name);
if (index === -1)
return;
const valuePath = attributePath.get("value");
valuePath.replaceWith(values[namePath.node.name]);
requiredAttributes.splice(index, 1);
});
path.pushContainer(
"attributes",
requiredAttributes.map(
(attr) => core.types.jsxAttribute(
core.types.jsxIdentifier(attr),
values[attr]
)
)
);
}
}
});
module.exports = plugin;
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\nimport { types as t, NodePath, ConfigAPI } from '@babel/core'\n\nconst elements = ['svg', 'Svg']\n\nexport interface Options {\n width: number | string\n height: number | string\n}\n\nconst getValue = (raw: undefined | number | string) => {\n if (raw === undefined) return t.stringLiteral('1em')\n switch (typeof raw) {\n case 'number':\n return t.jsxExpressionContainer(t.numericLiteral(raw))\n case 'string':\n return t.stringLiteral(raw)\n default:\n return t.stringLiteral('1em')\n }\n}\n\nconst plugin = (_: ConfigAPI, opts: Options) => ({\n visitor: {\n JSXOpeningElement(path: NodePath<t.JSXOpeningElement>) {\n if (\n !elements.some((element) =>\n path.get('name').isJSXIdentifier({ name: element }),\n )\n )\n return\n\n const values = {\n width: getValue(opts.width),\n height: getValue(opts.height),\n }\n const requiredAttributes = Object.keys(values)\n\n path.get('attributes').forEach((attributePath) => {\n if (!attributePath.isJSXAttribute()) return\n const namePath = attributePath.get('name')\n if (!namePath.isJSXIdentifier()) return\n const index = requiredAttributes.indexOf(namePath.node.name)\n\n if (index === -1) return\n\n const valuePath = attributePath.get('value')\n valuePath.replaceWith(values[namePath.node.name as 'width' | 'height'])\n requiredAttributes.splice(index, 1)\n })\n\n path.pushContainer(\n 'attributes',\n requiredAttributes.map((attr) =>\n t.jsxAttribute(\n t.jsxIdentifier(attr),\n values[attr as 'width' | 'height'],\n ),\n ),\n )\n },\n },\n})\n\nexport default plugin\n"],"names":["t"],"mappings":";;;;AAGA,MAAM,QAAA,GAAW,CAAC,KAAA,EAAO,KAAK,CAAA,CAAA;AAO9B,MAAM,QAAA,GAAW,CAAC,GAAqC,KAAA;AACrD,EAAA,IAAI,GAAQ,KAAA,KAAA,CAAA;AAAW,IAAO,OAAAA,UAAA,CAAE,cAAc,KAAK,CAAA,CAAA;AACnD,EAAA,QAAQ,OAAO,GAAK;AAAA,IAClB,KAAK,QAAA;AACH,MAAA,OAAOA,UAAE,CAAA,sBAAA,CAAuBA,UAAE,CAAA,cAAA,CAAe,GAAG,CAAC,CAAA,CAAA;AAAA,IACvD,KAAK,QAAA;AACH,MAAO,OAAAA,UAAA,CAAE,cAAc,GAAG,CAAA,CAAA;AAAA,IAC5B;AACE,MAAO,OAAAA,UAAA,CAAE,cAAc,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