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

5
node_modules/@svgr/plugin-jsx/dist/index.d.ts generated vendored Normal file
View File

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

99
node_modules/@svgr/plugin-jsx/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,99 @@
'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');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var hastToBabelAst__default = /*#__PURE__*/_interopDefaultLegacy(hastToBabelAst);
var svgrBabelPreset__default = /*#__PURE__*/_interopDefaultLegacy(svgrBabelPreset);
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) => {
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__default["default"](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__default["default"], svgPresetOptions], {
type: "preset"
})
],
filename: filePath,
babelrc: false,
configFile: false,
code: true,
ast: false,
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

1
node_modules/@svgr/plugin-jsx/dist/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"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 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","hastToBabelAst","transformFromAstSync","createConfigItem","svgrBabelPreset"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,MAAM,oBAAA,GAAuB,CAAC,MAA+C,KAAA;AAC3E,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,OA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