svger-cli 2.0.7 โ 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +259 -9
- package/README.md +383 -13
- package/dist/index.d.ts +30 -0
- package/dist/index.js +33 -0
- package/dist/integrations/babel.d.ts +58 -0
- package/dist/integrations/babel.js +221 -0
- package/dist/integrations/jest-preset.d.ts +44 -0
- package/dist/integrations/jest-preset.js +169 -0
- package/dist/integrations/nextjs.d.ts +56 -0
- package/dist/integrations/nextjs.js +140 -0
- package/dist/integrations/rollup.d.ts +29 -0
- package/dist/integrations/rollup.js +197 -0
- package/dist/integrations/vite.d.ts +29 -0
- package/dist/integrations/vite.js +221 -0
- package/dist/integrations/webpack.d.ts +84 -0
- package/dist/integrations/webpack.js +273 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +2 -1
- package/dist/types/integrations.d.ts +255 -0
- package/dist/types/integrations.js +4 -0
- package/docs/INTEGRATION-IMPLEMENTATION-SUMMARY.md +448 -0
- package/docs/INTEGRATIONS.md +543 -0
- package/examples/babel.config.example.js +182 -0
- package/examples/jest.config.example.js +158 -0
- package/examples/next.config.example.js +133 -0
- package/examples/rollup.config.example.js +129 -0
- package/examples/vite.config.example.js +98 -0
- package/examples/webpack.config.example.js +88 -0
- package/package.json +75 -5
package/README.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
# SVGER-CLI
|
|
1
|
+
# SVGER-CLI v3.0.0 - Enterprise SVG Processing Framework
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/svger-cli)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://www.npmjs.com/package/svger-cli)
|
|
7
7
|
|
|
8
|
-
> **The most advanced, zero-dependency SVG to component converter
|
|
9
|
-
>
|
|
10
|
-
>
|
|
8
|
+
> **The most advanced, zero-dependency SVG to component converter with official build tool
|
|
9
|
+
> integrations. First-class support for Webpack, Vite, Rollup, Babel, Next.js, and Jest. Supporting
|
|
10
|
+
> 9+ UI frameworks including React Native with enterprise-grade performance and auto-generated
|
|
11
|
+
> exports.**
|
|
11
12
|
|
|
12
13
|
---
|
|
13
14
|
|
|
@@ -16,7 +17,14 @@
|
|
|
16
17
|
### ๐ **Getting Started**
|
|
17
18
|
|
|
18
19
|
- [๐ฆ Installation](#-installation)
|
|
19
|
-
- [
|
|
20
|
+
- [๏ฟฝ Build Tool Integrations](#-build-tool-integrations) **โ NEW in v3.0**
|
|
21
|
+
- [Webpack](#webpack-integration)
|
|
22
|
+
- [Vite](#vite-integration)
|
|
23
|
+
- [Rollup](#rollup-integration)
|
|
24
|
+
- [Babel](#babel-integration)
|
|
25
|
+
- [Next.js](#nextjs-integration)
|
|
26
|
+
- [Jest](#jest-integration)
|
|
27
|
+
- [๏ฟฝ๐ Quick Start: Your First Conversion](#-quick-start-your-first-conversion)
|
|
20
28
|
- [๐ก Why SVGER-CLI?](#-why-svger-cli-the-zero-dependency-advantage)
|
|
21
29
|
|
|
22
30
|
### ๐ **Core Documentation**
|
|
@@ -74,6 +82,32 @@
|
|
|
74
82
|
| ------------------------------------- | --------------------------------------------------------------- |
|
|
75
83
|
| ๐ฏ Get started immediately | [Quick Start](#-quick-start-your-first-conversion) |
|
|
76
84
|
| ๐ฆ Install the package | [Installation](#-installation) |
|
|
85
|
+
| ๐ง Use with Webpack/Vite/Rollup | [Build Tool Integrations](#-build-tool-integrations) **NEW** |
|
|
86
|
+
| โ๏ธ Configure Webpack | [Webpack Integration](#webpack-integration) |
|
|
87
|
+
| โก Set up Vite | [Vite Integration](#vite-integration) |
|
|
88
|
+
| ๐ฆ Use with Rollup | [Rollup Integration](#rollup-integration) |
|
|
89
|
+
| ๐ Integrate Babel | [Babel Integration](#babel-integration) |
|
|
90
|
+
| โฒ Use with Next.js | [Next.js Integration](#nextjs-integration) |
|
|
91
|
+
| ๐งช Set up Jest | [Jest Integration](#jest-integration) |
|
|
92
|
+
| ๐ค Understand why SVGER-CLI is better | [Why SVGER-CLI?](#-why-svger-cli-the-zero-dependency-advantage) |
|
|
93
|
+
| โก Compare features with competitors | [Feature Comparison](#-feature-comparison-matrix) |
|
|
94
|
+
| ๐ Convert SVGs to React components | [React Guide](#react) |
|
|
95
|
+
| ๐ฑ Use with React Native | [React Native Guide](#react-native) |
|
|
96
|
+
| ๐ Use with Vue | [Vue Guide](#vue-3) |
|
|
97
|
+
| ๐
ฐ๏ธ Use with Angular | [Angular Guide](#angular) |
|
|
98
|
+
| ๐ช๏ธ Use with Svelte | [Svelte Guide](#svelte) |
|
|
99
|
+
| ๐ Learn all CLI commands | [CLI Reference](#-comprehensive-cli-reference) |
|
|
100
|
+
| ๐ป Use the programmatic API | [API Reference](#-programmatic-api) |
|
|
101
|
+
| ๐จ Configure styling & theming | [Styling Guide](#-advanced-styling--theming) |
|
|
102
|
+
| โก Optimize performance | [Performance Guide](#-performance-optimization) |
|
|
103
|
+
| ๐ Deploy to production | [Deployment Guide](#-production-deployment) |
|
|
104
|
+
| ๐ณ Use with Docker | [Docker Setup](#docker-integration) |
|
|
105
|
+
| ๐งช Test my components | [Testing Guide](#-testing--quality-assurance) |
|
|
106
|
+
| ๐ง Configure everything | [Configuration Reference](#-configuration-reference) |
|
|
107
|
+
| ๐ Create custom plugins | [Plugin Development](#-plugin-development) |
|
|
108
|
+
| ๐ Fix issues | [Troubleshooting](#-troubleshooting--faq) |
|
|
109
|
+
| ๐ Migrate from another tool | [Migration Guide](#-migration-guide) |
|
|
110
|
+
| ๐ฆ Install the package | [Installation](#-installation) |
|
|
77
111
|
| ๐ค Understand why SVGER-CLI is better | [Why SVGER-CLI?](#-why-svger-cli-the-zero-dependency-advantage) |
|
|
78
112
|
| โก Compare features with competitors | [Feature Comparison](#-feature-comparison-matrix) |
|
|
79
113
|
| ๐ Convert SVGs to React components | [React Guide](#react) |
|
|
@@ -99,10 +133,34 @@
|
|
|
99
133
|
|
|
100
134
|
## ๐ **Key Features Overview**
|
|
101
135
|
|
|
136
|
+
### **๐ง Official Build Tool Integrations (NEW in v3.0)**
|
|
137
|
+
|
|
138
|
+
First-class support for all major build tools with zero configuration:
|
|
139
|
+
|
|
140
|
+
- โ
**Webpack Plugin** - HMR, watch mode, and loader support
|
|
141
|
+
- โ
**Vite Plugin** - Lightning-fast HMR and virtual modules
|
|
142
|
+
- โ
**Rollup Plugin** - Tree-shaking and source maps
|
|
143
|
+
- โ
**Babel Plugin** - Universal transpilation and import transformation
|
|
144
|
+
- โ
**Next.js Integration** - SSR support for App and Pages Router
|
|
145
|
+
- โ
**Jest Preset** - SVG transformers and mocking for tests
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
// One-line setup for any build tool
|
|
149
|
+
const { SvgerWebpackPlugin } = require('svger-cli/webpack');
|
|
150
|
+
import { svgerVitePlugin } from 'svger-cli/vite';
|
|
151
|
+
import { svgerRollupPlugin } from 'svger-cli/rollup';
|
|
152
|
+
const { svgerBabelPlugin } = require('svger-cli/babel');
|
|
153
|
+
const { withSvger } = require('svger-cli/nextjs');
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**[See full integration guide โ](#-build-tool-integrations)**
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
102
160
|
### **โจ Auto-Generated index.ts Exports (Enhanced)**
|
|
103
161
|
|
|
104
|
-
Automatically generates clean index.ts files with **
|
|
105
|
-
|
|
162
|
+
Automatically generates clean index.ts files with a **single, consistent export pattern** that
|
|
163
|
+
avoids naming conflicts:
|
|
106
164
|
|
|
107
165
|
```typescript
|
|
108
166
|
// Auto-generated in your output directory
|
|
@@ -110,11 +168,16 @@ flexibility:
|
|
|
110
168
|
export { default as ArrowLeft } from './ArrowLeft';
|
|
111
169
|
export { default as ArrowRight } from './ArrowRight';
|
|
112
170
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
171
|
+
/**
|
|
172
|
+
* SVG Components Index
|
|
173
|
+
* Generated by svger-cli
|
|
174
|
+
*
|
|
175
|
+
* Import individual components:
|
|
176
|
+
* import { ArrowLeft } from './components';
|
|
177
|
+
*
|
|
178
|
+
* Import all components:
|
|
179
|
+
* import * as Icons from './components';
|
|
180
|
+
*/
|
|
118
181
|
```
|
|
119
182
|
|
|
120
183
|
**Import flexibility:**
|
|
@@ -151,6 +214,11 @@ svger-cli lock ./icons/critical-logo.svg # Protects during all operations
|
|
|
151
214
|
|
|
152
215
|
## ๐ **Feature Comparison Matrix**
|
|
153
216
|
|
|
217
|
+
> ๐ **For detailed technical analysis and documented benchmarks:**
|
|
218
|
+
> **[โ Read Complete Performance Deep Dive (COMPARISON.md)](./COMPARISON.md)**
|
|
219
|
+
> Includes: Benchmark methodology, dependency analysis, Webpack integration guide, and all 28
|
|
220
|
+
> configuration options explained.
|
|
221
|
+
|
|
154
222
|
| **Feature** | **SVGER-CLI v2.0.7** | **SVGR (React)** | **vite-svg-loader (Vue)** | **svelte-svg (Svelte)** | **SVGO** |
|
|
155
223
|
| -------------------------- | -------------------------- | ---------------- | ------------------------- | ----------------------- | ------------------- |
|
|
156
224
|
| **Dependencies** | โ
**Zero** | โ 15+ deps | โ 9+ deps | โ 7+ deps | โ 8+ deps |
|
|
@@ -185,6 +253,19 @@ engineered from the ground up with a single philosophy: **native, zero-dependenc
|
|
|
185
253
|
This lean approach delivers up to **85% faster processing** and a **90% smaller bundle size**
|
|
186
254
|
compared to alternatives that rely on dozens of transitive dependencies.
|
|
187
255
|
|
|
256
|
+
> ๐ **Want to understand why it's faster?** Read the complete technical analysis with benchmarks,
|
|
257
|
+
> methodology, and measurements:
|
|
258
|
+
> **[โ View Performance Deep Dive & Benchmarks (COMPARISON.md)](./COMPARISON.md)**
|
|
259
|
+
>
|
|
260
|
+
> Learn about:
|
|
261
|
+
>
|
|
262
|
+
> - Detailed benchmark methodology and test environment
|
|
263
|
+
> - 4 architectural optimizations that deliver 85% improvement
|
|
264
|
+
> - Memory usage comparison (12MB vs 68MB)
|
|
265
|
+
> - Parallel processing performance (6.6x throughput)
|
|
266
|
+
> - Smart caching system (99% hit rate)
|
|
267
|
+
> - Real-world CI/CD impact and cost savings
|
|
268
|
+
|
|
188
269
|
---
|
|
189
270
|
|
|
190
271
|
## ๐ฆ **Installation**
|
|
@@ -203,7 +284,284 @@ npm install --save-dev svger-cli
|
|
|
203
284
|
|
|
204
285
|
---
|
|
205
286
|
|
|
206
|
-
##
|
|
287
|
+
## ๏ฟฝ **Build Tool Integrations**
|
|
288
|
+
|
|
289
|
+
**NEW in v3.0**: SVGER-CLI now provides official integrations for all major build tools, enabling
|
|
290
|
+
seamless SVG-to-component conversion directly in your build pipeline.
|
|
291
|
+
|
|
292
|
+
### Quick Integration Overview
|
|
293
|
+
|
|
294
|
+
| Build Tool | Package Import | Use Case | Key Features |
|
|
295
|
+
| ----------- | ------------------- | ----------------------- | -------------------------------- |
|
|
296
|
+
| **Webpack** | `svger-cli/webpack` | Modern web apps | HMR, Watch mode, Loader support |
|
|
297
|
+
| **Vite** | `svger-cli/vite` | Lightning-fast dev | HMR, Virtual modules, Dev server |
|
|
298
|
+
| **Rollup** | `svger-cli/rollup` | Libraries & apps | Tree-shaking, Source maps |
|
|
299
|
+
| **Babel** | `svger-cli/babel` | Universal transpilation | Import transform, CRA, Gatsby |
|
|
300
|
+
| **Next.js** | `svger-cli/nextjs` | React SSR apps | SSR support, App Router |
|
|
301
|
+
| **Jest** | `svger-cli/jest` | Testing | SVG mocking, Transformers |
|
|
302
|
+
|
|
303
|
+
### Webpack Integration
|
|
304
|
+
|
|
305
|
+
Perfect for modern webpack-based applications with full HMR support.
|
|
306
|
+
|
|
307
|
+
**Install:**
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
npm install svger-cli --save-dev
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**webpack.config.js:**
|
|
314
|
+
|
|
315
|
+
```javascript
|
|
316
|
+
const { SvgerWebpackPlugin } = require('svger-cli/webpack');
|
|
317
|
+
|
|
318
|
+
module.exports = {
|
|
319
|
+
plugins: [
|
|
320
|
+
new SvgerWebpackPlugin({
|
|
321
|
+
source: './src/icons', // SVG source directory
|
|
322
|
+
output: './src/components/icons', // Output directory
|
|
323
|
+
framework: 'react', // Target framework
|
|
324
|
+
typescript: true, // Generate TypeScript files
|
|
325
|
+
hmr: true, // Enable Hot Module Replacement
|
|
326
|
+
generateIndex: true, // Generate index.ts with exports
|
|
327
|
+
}),
|
|
328
|
+
],
|
|
329
|
+
|
|
330
|
+
// Optional: Use the loader for inline SVG imports
|
|
331
|
+
module: {
|
|
332
|
+
rules: [
|
|
333
|
+
{
|
|
334
|
+
test: /\.svg$/,
|
|
335
|
+
use: ['svger-cli/webpack-loader'],
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**Usage in your app:**
|
|
343
|
+
|
|
344
|
+
```tsx
|
|
345
|
+
import { HomeIcon, UserIcon } from './components/icons';
|
|
346
|
+
|
|
347
|
+
function App() {
|
|
348
|
+
return <HomeIcon width={24} height={24} />;
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
### Vite Integration
|
|
355
|
+
|
|
356
|
+
Lightning-fast development with HMR and virtual module support.
|
|
357
|
+
|
|
358
|
+
**vite.config.js:**
|
|
359
|
+
|
|
360
|
+
```javascript
|
|
361
|
+
import { svgerVitePlugin } from 'svger-cli/vite';
|
|
362
|
+
|
|
363
|
+
export default {
|
|
364
|
+
plugins: [
|
|
365
|
+
svgerVitePlugin({
|
|
366
|
+
source: './src/icons',
|
|
367
|
+
output: './src/components/icons',
|
|
368
|
+
framework: 'react',
|
|
369
|
+
typescript: true,
|
|
370
|
+
hmr: true, // Hot Module Replacement
|
|
371
|
+
virtualModules: true, // Enable virtual module imports
|
|
372
|
+
}),
|
|
373
|
+
],
|
|
374
|
+
};
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
**Features:**
|
|
378
|
+
|
|
379
|
+
- โ
Instant HMR - changes reflect immediately
|
|
380
|
+
- โ
Virtual modules - `import Icon from 'virtual:svger/icon-name'`
|
|
381
|
+
- โ
Dev server integration
|
|
382
|
+
- โ
Optimized production builds
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
### Rollup Integration
|
|
387
|
+
|
|
388
|
+
Ideal for library development and tree-shakeable bundles.
|
|
389
|
+
|
|
390
|
+
**rollup.config.js:**
|
|
391
|
+
|
|
392
|
+
```javascript
|
|
393
|
+
import { svgerRollupPlugin } from 'svger-cli/rollup';
|
|
394
|
+
|
|
395
|
+
export default {
|
|
396
|
+
plugins: [
|
|
397
|
+
svgerRollupPlugin({
|
|
398
|
+
source: './src/icons',
|
|
399
|
+
output: './dist/icons',
|
|
400
|
+
framework: 'react',
|
|
401
|
+
typescript: true,
|
|
402
|
+
sourcemap: true, // Generate source maps
|
|
403
|
+
exportType: 'named', // 'named' or 'default'
|
|
404
|
+
}),
|
|
405
|
+
],
|
|
406
|
+
};
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Perfect for:**
|
|
410
|
+
|
|
411
|
+
- Component libraries
|
|
412
|
+
- Tree-shakeable exports
|
|
413
|
+
- Multi-framework support
|
|
414
|
+
- Production optimization
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
### Babel Integration
|
|
419
|
+
|
|
420
|
+
Universal transpilation with automatic import transformation.
|
|
421
|
+
|
|
422
|
+
**babel.config.js:**
|
|
423
|
+
|
|
424
|
+
```javascript
|
|
425
|
+
const { svgerBabelPlugin } = require('svger-cli/babel');
|
|
426
|
+
|
|
427
|
+
module.exports = {
|
|
428
|
+
presets: ['@babel/preset-env', '@babel/preset-react'],
|
|
429
|
+
plugins: [
|
|
430
|
+
[
|
|
431
|
+
svgerBabelPlugin,
|
|
432
|
+
{
|
|
433
|
+
source: './src/icons',
|
|
434
|
+
output: './src/components/icons',
|
|
435
|
+
framework: 'react',
|
|
436
|
+
typescript: true,
|
|
437
|
+
transformImports: true, // Auto-transform SVG imports
|
|
438
|
+
processOnInit: true, // Process all SVGs on plugin init
|
|
439
|
+
generateIndex: true, // Generate barrel exports
|
|
440
|
+
},
|
|
441
|
+
],
|
|
442
|
+
],
|
|
443
|
+
};
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Import transformation:**
|
|
447
|
+
|
|
448
|
+
```javascript
|
|
449
|
+
// Before (write this in your code)
|
|
450
|
+
import HomeIcon from './assets/home.svg';
|
|
451
|
+
|
|
452
|
+
// After (automatically transformed)
|
|
453
|
+
import HomeIcon from './components/icons/HomeIcon';
|
|
454
|
+
|
|
455
|
+
// Use it
|
|
456
|
+
<HomeIcon width={24} height={24} />;
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Works with:**
|
|
460
|
+
|
|
461
|
+
- Create React App
|
|
462
|
+
- Gatsby
|
|
463
|
+
- Vue CLI
|
|
464
|
+
- Any Babel-based setup
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
### Next.js Integration
|
|
469
|
+
|
|
470
|
+
Seamless integration with Next.js App Router and Pages Router.
|
|
471
|
+
|
|
472
|
+
**next.config.js:**
|
|
473
|
+
|
|
474
|
+
```javascript
|
|
475
|
+
const { withSvger } = require('svger-cli/nextjs');
|
|
476
|
+
|
|
477
|
+
module.exports = withSvger({
|
|
478
|
+
svger: {
|
|
479
|
+
source: './public/icons',
|
|
480
|
+
output: './components/icons',
|
|
481
|
+
framework: 'react',
|
|
482
|
+
typescript: true,
|
|
483
|
+
ssr: true, // Server-Side Rendering support
|
|
484
|
+
hmr: true, // Hot Module Replacement
|
|
485
|
+
},
|
|
486
|
+
// ...other Next.js config
|
|
487
|
+
reactStrictMode: true,
|
|
488
|
+
});
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
**Features:**
|
|
492
|
+
|
|
493
|
+
- โ
SSR (Server-Side Rendering) support
|
|
494
|
+
- โ
App Router compatible
|
|
495
|
+
- โ
Pages Router compatible
|
|
496
|
+
- โ
Automatic webpack configuration
|
|
497
|
+
- โ
TypeScript support
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
### Jest Integration
|
|
502
|
+
|
|
503
|
+
Transform SVGs in your tests or mock them for faster execution.
|
|
504
|
+
|
|
505
|
+
**jest.config.js:**
|
|
506
|
+
|
|
507
|
+
**Option 1: Use the preset (recommended)**
|
|
508
|
+
|
|
509
|
+
```javascript
|
|
510
|
+
module.exports = {
|
|
511
|
+
preset: 'svger-cli/jest',
|
|
512
|
+
testEnvironment: 'jsdom',
|
|
513
|
+
};
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
**Option 2: Manual configuration**
|
|
517
|
+
|
|
518
|
+
```javascript
|
|
519
|
+
module.exports = {
|
|
520
|
+
transform: {
|
|
521
|
+
'\\.svg$': [
|
|
522
|
+
'svger-cli/jest-transformer',
|
|
523
|
+
{
|
|
524
|
+
framework: 'react',
|
|
525
|
+
typescript: true,
|
|
526
|
+
mock: false, // Set true for mock mode
|
|
527
|
+
},
|
|
528
|
+
],
|
|
529
|
+
},
|
|
530
|
+
testEnvironment: 'jsdom',
|
|
531
|
+
};
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
**Mock mode** (faster tests):
|
|
535
|
+
|
|
536
|
+
```javascript
|
|
537
|
+
transform: {
|
|
538
|
+
'\\.svg$': ['svger-cli/jest-transformer', {
|
|
539
|
+
mock: true, // Returns simple mock component
|
|
540
|
+
}],
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
---
|
|
545
|
+
|
|
546
|
+
### Complete Integration Documentation
|
|
547
|
+
|
|
548
|
+
For detailed documentation, configuration options, and advanced examples, see:
|
|
549
|
+
|
|
550
|
+
๐ **[Complete Integration Guide](./docs/INTEGRATIONS.md)** - 500+ lines of comprehensive
|
|
551
|
+
documentation
|
|
552
|
+
|
|
553
|
+
**What's included:**
|
|
554
|
+
|
|
555
|
+
- Detailed setup instructions for each build tool
|
|
556
|
+
- All configuration options explained
|
|
557
|
+
- Framework-specific examples (React, Vue, Angular, etc.)
|
|
558
|
+
- Troubleshooting guides
|
|
559
|
+
- Performance optimization tips
|
|
560
|
+
- Feature comparison matrix
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
## ๏ฟฝ๐ **Quick Start: Your First Conversion**
|
|
207
565
|
|
|
208
566
|
1. **Place your SVGs** in a directory (e.g., `./my-svgs`).
|
|
209
567
|
2. **Run the build command**:
|
|
@@ -2338,3 +2696,15 @@ instrumental in shaping the design and functionality of the SVGER-CLI v2.0.
|
|
|
2338
2696
|
---
|
|
2339
2697
|
|
|
2340
2698
|
**ยฉ 2025 SVGER-CLI Development Team. Built with โค๏ธ for the developer community.**
|
|
2699
|
+
|
|
2700
|
+
---
|
|
2701
|
+
|
|
2702
|
+
## ๐ **Additional Documentation**
|
|
2703
|
+
|
|
2704
|
+
- **[๐ Complete Feature Comparison & Benchmarks](./COMPARISON.md)** - Detailed technical analysis
|
|
2705
|
+
with documented performance claims
|
|
2706
|
+
- Benchmark methodology and test environment
|
|
2707
|
+
- Detailed dependency tree analysis
|
|
2708
|
+
- Webpack integration guide
|
|
2709
|
+
- Complete configuration options breakdown
|
|
2710
|
+
- Real-world performance examples
|
package/dist/index.d.ts
CHANGED
|
@@ -146,6 +146,36 @@ export declare const SVGER: {
|
|
|
146
146
|
*/
|
|
147
147
|
export declare const VERSION = "2.0.0";
|
|
148
148
|
export declare const PACKAGE_NAME = "svger-cli";
|
|
149
|
+
/**
|
|
150
|
+
* Webpack Plugin - Official webpack integration for SVGER-CLI
|
|
151
|
+
* Provides: HMR support, asset processing, and webpack loader
|
|
152
|
+
*/
|
|
153
|
+
export { SvgerWebpackPlugin, svgerLoader, default as webpackPlugin, } from './integrations/webpack.js';
|
|
154
|
+
/**
|
|
155
|
+
* Vite Plugin - Official Vite integration for SVGER-CLI
|
|
156
|
+
* Provides: HMR support, virtual modules, and dev server integration
|
|
157
|
+
*/
|
|
158
|
+
export { svgerVitePlugin, default as vitePlugin } from './integrations/vite.js';
|
|
159
|
+
/**
|
|
160
|
+
* Rollup Plugin - Official Rollup integration for SVGER-CLI
|
|
161
|
+
* Provides: Bundle optimization and tree-shaking support
|
|
162
|
+
*/
|
|
163
|
+
export { svgerRollupPlugin, default as rollupPlugin, } from './integrations/rollup.js';
|
|
164
|
+
/**
|
|
165
|
+
* Babel Plugin - Official Babel integration for SVGER-CLI
|
|
166
|
+
* Provides: SVG import transformation and component generation
|
|
167
|
+
*/
|
|
168
|
+
export { svgerBabelPlugin, createBabelPlugin, default as babelPlugin, } from './integrations/babel.js';
|
|
169
|
+
/**
|
|
170
|
+
* Next.js Plugin - Official Next.js integration for SVGER-CLI
|
|
171
|
+
* Provides: SSR support, webpack integration, and HMR
|
|
172
|
+
*/
|
|
173
|
+
export { withSvger, SvgerNextJsPlugin, configureSvgImports, default as nextjsPlugin, } from './integrations/nextjs.js';
|
|
174
|
+
/**
|
|
175
|
+
* Jest Preset - Official Jest integration for SVGER-CLI
|
|
176
|
+
* Provides: SVG transformers and test configuration
|
|
177
|
+
*/
|
|
178
|
+
export { svgerJestTransformer, jestPreset, createJestTransformer, default as jestTransformer, } from './integrations/jest-preset.js';
|
|
149
179
|
/**
|
|
150
180
|
* Default export - Primary SVG processor instance for quick access
|
|
151
181
|
* Most common entry point for programmatic usage
|
package/dist/index.js
CHANGED
|
@@ -148,6 +148,39 @@ export const SVGER = {
|
|
|
148
148
|
export const VERSION = '2.0.0';
|
|
149
149
|
export const PACKAGE_NAME = 'svger-cli';
|
|
150
150
|
// ============================================================================
|
|
151
|
+
// BUILD TOOL INTEGRATIONS
|
|
152
|
+
// ============================================================================
|
|
153
|
+
/**
|
|
154
|
+
* Webpack Plugin - Official webpack integration for SVGER-CLI
|
|
155
|
+
* Provides: HMR support, asset processing, and webpack loader
|
|
156
|
+
*/
|
|
157
|
+
export { SvgerWebpackPlugin, svgerLoader, default as webpackPlugin, } from './integrations/webpack.js';
|
|
158
|
+
/**
|
|
159
|
+
* Vite Plugin - Official Vite integration for SVGER-CLI
|
|
160
|
+
* Provides: HMR support, virtual modules, and dev server integration
|
|
161
|
+
*/
|
|
162
|
+
export { svgerVitePlugin, default as vitePlugin } from './integrations/vite.js';
|
|
163
|
+
/**
|
|
164
|
+
* Rollup Plugin - Official Rollup integration for SVGER-CLI
|
|
165
|
+
* Provides: Bundle optimization and tree-shaking support
|
|
166
|
+
*/
|
|
167
|
+
export { svgerRollupPlugin, default as rollupPlugin, } from './integrations/rollup.js';
|
|
168
|
+
/**
|
|
169
|
+
* Babel Plugin - Official Babel integration for SVGER-CLI
|
|
170
|
+
* Provides: SVG import transformation and component generation
|
|
171
|
+
*/
|
|
172
|
+
export { svgerBabelPlugin, createBabelPlugin, default as babelPlugin, } from './integrations/babel.js';
|
|
173
|
+
/**
|
|
174
|
+
* Next.js Plugin - Official Next.js integration for SVGER-CLI
|
|
175
|
+
* Provides: SSR support, webpack integration, and HMR
|
|
176
|
+
*/
|
|
177
|
+
export { withSvger, SvgerNextJsPlugin, configureSvgImports, default as nextjsPlugin, } from './integrations/nextjs.js';
|
|
178
|
+
/**
|
|
179
|
+
* Jest Preset - Official Jest integration for SVGER-CLI
|
|
180
|
+
* Provides: SVG transformers and test configuration
|
|
181
|
+
*/
|
|
182
|
+
export { svgerJestTransformer, jestPreset, createJestTransformer, default as jestTransformer, } from './integrations/jest-preset.js';
|
|
183
|
+
// ============================================================================
|
|
151
184
|
// DEFAULT EXPORT
|
|
152
185
|
// ============================================================================
|
|
153
186
|
/**
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official Babel Plugin for SVGER-CLI
|
|
3
|
+
*
|
|
4
|
+
* Transforms SVG imports into framework components during Babel transpilation.
|
|
5
|
+
* Works with any Babel-based build process including standalone Babel, Create React App,
|
|
6
|
+
* and other tools that use Babel under the hood.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```js
|
|
10
|
+
* // babel.config.js
|
|
11
|
+
* const { svgerBabelPlugin } = require('svger-cli/babel');
|
|
12
|
+
*
|
|
13
|
+
* module.exports = {
|
|
14
|
+
* plugins: [
|
|
15
|
+
* [svgerBabelPlugin, {
|
|
16
|
+
* source: './src/icons',
|
|
17
|
+
* output: './src/components/icons',
|
|
18
|
+
* framework: 'react',
|
|
19
|
+
* typescript: true
|
|
20
|
+
* }]
|
|
21
|
+
* ]
|
|
22
|
+
* };
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```js
|
|
27
|
+
* // Direct SVG import transformation
|
|
28
|
+
* import Icon from './icon.svg';
|
|
29
|
+
* // Transforms to:
|
|
30
|
+
* import Icon from './components/icons/Icon';
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import type { BabelPluginOptions } from '../types/integrations.js';
|
|
34
|
+
/**
|
|
35
|
+
* Babel Plugin for SVGER-CLI
|
|
36
|
+
*
|
|
37
|
+
* This plugin processes SVG files and transforms SVG imports to component imports.
|
|
38
|
+
* It can run in two modes:
|
|
39
|
+
* - Pre-build: Process all SVGs before Babel transformation
|
|
40
|
+
* - On-demand: Transform SVG imports as they're encountered
|
|
41
|
+
*/
|
|
42
|
+
export declare function svgerBabelPlugin(api: any, options?: BabelPluginOptions): any;
|
|
43
|
+
/**
|
|
44
|
+
* Create a Babel plugin instance with preset options
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```js
|
|
48
|
+
* const plugin = createBabelPlugin({
|
|
49
|
+
* source: './icons',
|
|
50
|
+
* framework: 'react'
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function createBabelPlugin(options?: BabelPluginOptions): (api: any) => any;
|
|
55
|
+
/**
|
|
56
|
+
* Default export for convenient usage
|
|
57
|
+
*/
|
|
58
|
+
export default svgerBabelPlugin;
|