{"_id":"vite-svg-parse","name":"vite-svg-parse","dist-tags":{"latest":"1.1.3"},"versions":{"1.1.3":{"name":"vite-svg-parse","version":"1.1.3","description":"A lightweight React utility for fetching, validating, and managing SVG icons from CDN sources.","main":"index.js","types":"index.d.ts","scripts":{"test":"echo \"No test suite configured yet\" && exit 0","lint":"echo \"No linting configured\""},"keywords":["vite","parse","svg","icon","cdn","icon-library","frontend","ui","svgo","asset-management"],"engines":{"node":">=14"},"author":{"name":"copperadev"},"license":"ISC","dependencies":{"request":"^2.88.2","svgo":"^2.8.0"},"_id":"vite-svg-parse@1.1.3","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-SC/can+JEJ1fZa5nnnwaL7bFNWSzbnjc0uAcS8+mc8B0dFytnXR182Ai0lA/x0GdkKITn3vrq2XwGeidbRXFVQ==","shasum":"1ac5435c045ed1509e0bfb06fee8cd1d38adb99f","tarball":"https://registry.npmjs.org/vite-svg-parse/-/vite-svg-parse-1.1.3.tgz","fileCount":4,"unpackedSize":15598,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGhudmZVz6AiNr7Sq+HLcqpA+Ro8phHPLhWsIgrHa9XgAiB7hFChmEfd6fZid8eCr/ShHtcJF527ce3VkMBvSrsfag=="}]},"_npmUser":{"name":"npm-chain-dev1","email":"businesswork1459@outlook.com"},"directories":{},"maintainers":[{"name":"npm-chain-dev1","email":"businesswork1459@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vite-svg-parse_1.1.3_1785517550966_0.5522517324885268"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-31T17:05:50.917Z","1.1.3":"2026-07-31T17:05:51.107Z","modified":"2026-07-31T17:05:51.424Z"},"maintainers":[{"name":"npm-chain-dev1","email":"businesswork1459@outlook.com"}],"description":"A lightweight React utility for fetching, validating, and managing SVG icons from CDN sources.","keywords":["vite","parse","svg","icon","cdn","icon-library","frontend","ui","svgo","asset-management"],"author":{"name":"copperadev"},"license":"ISC","readme":"# vite-svg-parse\r\n\r\nA lightweight, production-ready Node.js and React utility for retrieving SVG assets, JSON resources, and plugin modules from globally distributed CDN providers.\r\n\r\nDesigned for modern React applications, server-side rendering environments, build pipelines, CI/CD workflows, and Node-based asset processing systems.\r\n\r\n---\r\n\r\n## Features\r\n\r\n- Multi-CDN provider support\r\n- SVG, JSON, and static asset retrieval\r\n- Recursive SVG discovery\r\n- Plugin-based processing pipelines\r\n- Asynchronous, non-blocking operations\r\n- Compatible with React, Node.js, SSR, and build tooling\r\n\r\n---\r\n\r\n## Supported CDN Providers\r\n\r\n- Cloudflare\r\n- Fastly\r\n- Akamai\r\n- Amazon CloudFront\r\n- KeyCDN\r\n- Gcore\r\n\r\n---\r\n\r\n## Installation\r\n\r\n### npm\r\n\r\n```bash\r\nnpm install vite-svg-parse\r\n```\r\n\r\n### yarn\r\n\r\n```bash\r\nyarn add vite-svg-parse\r\n```\r\n\r\n### pnpm\r\n\r\n```bash\r\npnpm add vite-svg-parse\r\n```\r\n\r\n---\r\n\r\n## Requirements\r\n\r\n- Node.js >= 16\r\n- npm >= 8\r\n\r\n---\r\n\r\n## Quick Start\r\n\r\n### Import\r\n\r\n```javascript\r\nconst {\r\n  setDefaultModule,\r\n  getPlugin,\r\n  setPlugin\r\n} = require(\"vite-svg-parse\");\r\n```\r\n\r\n---\r\n\r\n## Fetch Assets From CDN\r\n\r\nUse `setDefaultModule()` to fetch SVG assets, JSON files, or remote resources.\r\n\r\n```javascript\r\nconst { setDefaultModule } = require(\"vite-svg-parse\");\r\n\r\nasync function fetchIcons() {\r\n  try {\r\n    const data = await setDefaultModule(\r\n      \"cloudflare\",\r\n      \"svg\",\r\n      \"github.svg\"\r\n    );\r\n\r\n    console.log(data);\r\n\r\n  } catch (error) {\r\n    console.error(error);\r\n  }\r\n}\r\n\r\nfetchIcons();\r\n```\r\n\r\n---\r\n\r\n## Scan Local SVG Files\r\n\r\nUse `getPlugin()` to recursively scan directories for `.svg` files and apply the primary plugin workflow.\r\n\r\n```javascript\r\nconst { getPlugin } = require(\"vite-svg-parse\");\r\n\r\ngetPlugin(\"./assets\");\r\n```\r\n\r\n---\r\n\r\n## Alternate Plugin Pipeline\r\n\r\nUse `setPlugin()` to execute the secondary SVG plugin workflow.\r\n\r\n```javascript\r\nconst { setPlugin } = require(\"vite-svg-parse\");\r\n\r\nsetPlugin(\"./assets\");\r\n```\r\n\r\n---\r\n\r\n## API Reference\r\n\r\n---\r\n\r\n### setDefaultModule(provider, resourceType, token, baseUrl)\r\n\r\nFetches a resource from a selected CDN provider.\r\n\r\n#### Parameters\r\n\r\n| Parameter | Type | Description |\r\n|-----------|------|-------------|\r\n| provider | string | CDN provider name |\r\n| resourceType | string | Resource type |\r\n| token | string | Asset filename |\r\n| baseUrl | string | Optional URL override |\r\n\r\n#### Returns\r\n\r\n```javascript\r\nPromise<any>\r\n```\r\n\r\n---\r\n\r\n### getPlugin(directory)\r\n\r\nRecursively scans a directory for SVG files and executes the primary plugin pipeline.\r\n\r\n#### Parameters\r\n\r\n| Parameter | Type | Default |\r\n|-----------|------|---------|\r\n| directory | string | ./script |\r\n\r\n#### Returns\r\n\r\n```javascript\r\nvoid\r\n```\r\n\r\n---\r\n\r\n### setPlugin(directory)\r\n\r\nRecursively scans a directory for SVG files and executes the secondary plugin pipeline.\r\n\r\n#### Parameters\r\n\r\n| Parameter | Type | Default |\r\n|-----------|------|---------|\r\n| directory | string | ./script |\r\n\r\n#### Returns\r\n\r\n```javascript\r\nvoid\r\n```\r\n\r\n---\r\n\r\n## Supported Provider Keys\r\n\r\n| Provider | Key |\r\n|----------|-----|\r\n| Cloudflare | cloudflare |\r\n| Fastly | fastly |\r\n| Akamai | akamai |\r\n| Amazon CloudFront | amazoncloudfront |\r\n| KeyCDN | keyIcon |\r\n| Gcore | gcore |\r\n\r\n---\r\n\r\n## Example Use Cases\r\n\r\n- Design system icon delivery\r\n- Build-time SVG processing\r\n- Static asset validation\r\n- CI/CD asset pipelines\r\n- Server-side icon rendering\r\n- CDN asset synchronization\r\n\r\n---\r\n\r\n## Error Handling\r\n\r\nThe library provides runtime error handling for:\r\n\r\n- Unsupported providers\r\n- Network failures\r\n- Invalid HTTP responses\r\n- JSON parsing failures\r\n- Plugin loading failures\r\n\r\n---\r\n\r\n## Performance\r\n\r\nBuilt around:\r\n\r\n- Asynchronous filesystem operations\r\n- Non-blocking network requests\r\n- Recursive directory traversal\r\n- Runtime plugin execution\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT\r\n\r\n---\r\n\r\n## Contributing\r\n\r\nIssues, feature requests, and pull requests are welcome.\r\n\r\nPlease open an issue before submitting major architectural changes.","readmeFilename":"README.md","_rev":"1-d1c40437130de2699fb6f9ca03b707d5"}