@absolu/assets-toolkit 1.0.2 → 1.1.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/README.md +72 -42
- package/bin/cli.js +11 -0
- package/dist/create-config.d.ts +1 -1
- package/dist/create-config.d.ts.map +1 -1
- package/dist/create-config.js +16 -22
- package/dist/create-config.js.map +1 -1
- package/package.json +17 -18
package/README.md
CHANGED
|
@@ -3,24 +3,34 @@
|
|
|
3
3
|
|
|
4
4
|
Toolkit Vite pour les pipelines d'assets front-end. Fournit une **factory de configuration Vite** et deux **plugins Vite** (iconfont & svgstore), pensés pour les projets utilisant Vite avec SCSS (typiquement des thèmes Drupal ou CMS).
|
|
5
5
|
|
|
6
|
+
**Prérequis :** Node.js >= 22
|
|
7
|
+
|
|
6
8
|
## Installation
|
|
7
9
|
|
|
8
10
|
```bash
|
|
9
|
-
|
|
11
|
+
pnpm add -D @absolu/assets-toolkit
|
|
10
12
|
```
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
Toutes les dépendances nécessaires (Sass, Vite, plugins d'optimisation) sont incluses — aucune peer dependency à installer manuellement.
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|---|---|
|
|
16
|
-
| `vite` >= 5.0.0 | oui |
|
|
17
|
-
| `sass` >= 1.0.0 | oui |
|
|
18
|
-
| `vite-plugin-imagemin` >= 0.6.0 | optionnel |
|
|
19
|
-
| `vite-plugin-live-reload` >= 3.0.0 | optionnel |
|
|
16
|
+
> **Peer dependency :** `vite >= 5.0.0` est requis uniquement si vous utilisez les plugins de manière standalone (voir [Utilisation standalone](#utilisation-standalone-des-plugins)) ou si vous importez directement depuis `vite` dans votre config.
|
|
20
17
|
|
|
21
18
|
## Utilisation rapide
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
### 1. Scripts `package.json`
|
|
21
|
+
|
|
22
|
+
La toolkit expose un binaire `assets-toolkit` qui encapsule Vite — pas besoin d'installer Vite en dépendance directe :
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"scripts": {
|
|
27
|
+
"dev": "assets-toolkit -c ./vite.config.ts",
|
|
28
|
+
"build": "assets-toolkit build -c ./vite.config.ts"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. `vite.config.ts`
|
|
24
34
|
|
|
25
35
|
```ts
|
|
26
36
|
import { createViteConfig } from '@absolu/assets-toolkit'
|
|
@@ -32,9 +42,9 @@ export default createViteConfig({
|
|
|
32
42
|
})
|
|
33
43
|
```
|
|
34
44
|
|
|
35
|
-
C'est tout. Tous les plugins (iconfont, svgstore, live reload) sont **activés par défaut** avec des valeurs sensibles.
|
|
45
|
+
C'est tout. Tous les plugins (iconfont, svgstore, optimisation images, live reload) sont **activés par défaut** avec des valeurs sensibles.
|
|
36
46
|
|
|
37
|
-
Le fichier `config.json` (non versionné) contient
|
|
47
|
+
Le fichier `config.json` (non versionné) contient la configuration locale, propre à chaque machine :
|
|
38
48
|
|
|
39
49
|
```json
|
|
40
50
|
{
|
|
@@ -51,30 +61,21 @@ Le fichier `config.json` (non versionné) contient uniquement la configuration l
|
|
|
51
61
|
|
|
52
62
|
### `createViteConfig(options)`
|
|
53
63
|
|
|
54
|
-
Factory qui produit une configuration Vite complète
|
|
64
|
+
Factory qui produit une configuration Vite complète.
|
|
55
65
|
|
|
56
66
|
| Option | Type | Défaut | Description |
|
|
57
67
|
|---|---|---|---|
|
|
58
|
-
| `base` | `string` | — | **Requis.** Chemin de base pour le serveur de dev
|
|
68
|
+
| `base` | `string` | — | **Requis.** Chemin de base pour le serveur de dev |
|
|
59
69
|
| `localConfig` | `LocalConfig` | — | Configuration locale non versionnée (certificats HTTPS) |
|
|
60
70
|
| `iconfont` | `IconfontOptions \| false` | `{}` (activé) | Options du plugin iconfont. `false` pour désactiver |
|
|
61
71
|
| `svgstore` | `SvgstoreOptions \| false` | `{}` (activé) | Options du plugin svgstore. `false` pour désactiver |
|
|
62
|
-
| `imagemin` | `boolean` | `true` | Activer
|
|
72
|
+
| `imagemin` | `boolean` | `true` | Activer l'optimisation des images raster (png, jpg, webp…) |
|
|
63
73
|
| `liveReload` | `string[] \| false` | `['../templates/**/*.twig']` | Glob patterns pour le live reload. `false` pour désactiver |
|
|
64
74
|
| `entries` | `string[]` | voir ci-dessous | Glob patterns des fichiers d'entrée |
|
|
65
75
|
| `entriesIgnore` | `string[]` | voir ci-dessous | Patterns à exclure |
|
|
66
76
|
| `manualChunks` | `(id: string) => string \| undefined` | — | Définition des manual chunks |
|
|
67
77
|
| `plugins` | `Plugin[]` | — | Plugins Vite supplémentaires |
|
|
68
78
|
|
|
69
|
-
#### `localConfig`
|
|
70
|
-
|
|
71
|
-
Configuration locale, typiquement chargée depuis un `config.json` non versionné.
|
|
72
|
-
|
|
73
|
-
| Propriété | Type | Description |
|
|
74
|
-
|---|---|---|
|
|
75
|
-
| `server.https.key` | `string` | Chemin vers le fichier clé privée du certificat SSL |
|
|
76
|
-
| `server.https.cert` | `string` | Chemin vers le fichier certificat SSL |
|
|
77
|
-
|
|
78
79
|
#### Valeurs par défaut
|
|
79
80
|
|
|
80
81
|
**Entrées :**
|
|
@@ -82,7 +83,7 @@ Configuration locale, typiquement chargée depuis un `config.json` non versionn
|
|
|
82
83
|
- `src/scss/*.scss`
|
|
83
84
|
- `src/scripts/*.{js,ts}`
|
|
84
85
|
- `src/iconfonts/*.{woff2,woff}`
|
|
85
|
-
- `src/images/**/*.{png,jpeg,jpg,gif,svg}`
|
|
86
|
+
- `src/images/**/*.{png,jpeg,jpg,gif,svg,webp}`
|
|
86
87
|
|
|
87
88
|
**Exclusions :** `src/images/icons/**/*.svg`, `src/images/icons-sprite/**/*.svg`
|
|
88
89
|
|
|
@@ -95,10 +96,10 @@ Configuration locale, typiquement chargée depuis un `config.json` non versionn
|
|
|
95
96
|
```ts
|
|
96
97
|
export default createViteConfig({
|
|
97
98
|
base: '/themes/custom/mon-theme/assets',
|
|
98
|
-
iconfont: false,
|
|
99
|
-
svgstore: false,
|
|
100
|
-
liveReload: false,
|
|
101
|
-
imagemin: false,
|
|
99
|
+
iconfont: false,
|
|
100
|
+
svgstore: false,
|
|
101
|
+
liveReload: false,
|
|
102
|
+
imagemin: false,
|
|
102
103
|
})
|
|
103
104
|
```
|
|
104
105
|
|
|
@@ -121,13 +122,12 @@ export default createViteConfig({
|
|
|
121
122
|
symbolId: '[name]',
|
|
122
123
|
},
|
|
123
124
|
liveReload: ['../templates/**/*.twig'],
|
|
124
|
-
imagemin: true,
|
|
125
125
|
entries: [
|
|
126
126
|
'src/scss/*.scss',
|
|
127
127
|
'src/scripts/*.js',
|
|
128
128
|
'src/scripts/*.ts',
|
|
129
129
|
'src/iconfonts/*.{woff2,woff}',
|
|
130
|
-
'src/images/**/*.{png,jpeg,jpg,gif,svg}',
|
|
130
|
+
'src/images/**/*.{png,jpeg,jpg,gif,svg,webp}',
|
|
131
131
|
],
|
|
132
132
|
entriesIgnore: [
|
|
133
133
|
'src/images/icons/**/*.svg',
|
|
@@ -156,11 +156,15 @@ Plugin Vite qui fusionne des fichiers SVG en un sprite SVG unique, optimisé ave
|
|
|
156
156
|
|---|---|---|---|
|
|
157
157
|
| `srcDir` | `string` | `src/images/icons-sprite` | Dossier source des SVG |
|
|
158
158
|
| `targetFile` | `string` | `src/images/sprite.svg` | Fichier de sortie du sprite |
|
|
159
|
-
| `symbolId` | `string` | `[name]` | Pattern pour l'id des symboles
|
|
159
|
+
| `symbolId` | `string` | `[name]` | Pattern pour l'id des symboles |
|
|
160
160
|
|
|
161
161
|
## Utilisation standalone des plugins
|
|
162
162
|
|
|
163
|
-
Les plugins peuvent être utilisés indépendamment de la factory :
|
|
163
|
+
Les plugins peuvent être utilisés indépendamment de la factory. Dans ce cas, `vite` doit être installé en devDependency directe :
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
pnpm add -D vite
|
|
167
|
+
```
|
|
164
168
|
|
|
165
169
|
```ts
|
|
166
170
|
import { VitePluginIconfont, VitePluginSvgstore } from '@absolu/assets-toolkit'
|
|
@@ -168,19 +172,45 @@ import { defineConfig } from 'vite'
|
|
|
168
172
|
|
|
169
173
|
export default defineConfig({
|
|
170
174
|
plugins: [
|
|
171
|
-
VitePluginIconfont({
|
|
172
|
-
|
|
173
|
-
scssDir: 'src/scss/icons',
|
|
174
|
-
iconClassName: 'icon',
|
|
175
|
-
}),
|
|
176
|
-
VitePluginSvgstore({
|
|
177
|
-
srcDir: 'src/sprites',
|
|
178
|
-
symbolId: 'icon-[name]',
|
|
179
|
-
}),
|
|
175
|
+
VitePluginIconfont({ fontName: 'my-icons' }),
|
|
176
|
+
VitePluginSvgstore({ srcDir: 'src/sprites' }),
|
|
180
177
|
],
|
|
181
178
|
})
|
|
182
179
|
```
|
|
183
180
|
|
|
181
|
+
## Développement local (test avec pnpm link)
|
|
182
|
+
|
|
183
|
+
Pour tester la toolkit dans un projet consommateur avant publication :
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# 1. Builder la lib
|
|
187
|
+
cd /chemin/vers/assets-toolkit
|
|
188
|
+
pnpm run build
|
|
189
|
+
|
|
190
|
+
# 2. Lier dans le projet consommateur
|
|
191
|
+
cd /chemin/vers/projet-conso
|
|
192
|
+
pnpm link /chemin/vers/assets-toolkit
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Les scripts du conso utilisent `assets-toolkit` — Vite est résolu depuis les `node_modules` de la toolkit, pas besoin de l'installer dans le conso :
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"scripts": {
|
|
200
|
+
"dev": "assets-toolkit -c ./vite.config.ts",
|
|
201
|
+
"build": "assets-toolkit build -c ./vite.config.ts"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Après chaque modification de la lib, rebuilder avant de relancer le conso :
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
cd /chemin/vers/assets-toolkit && pnpm run build
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
> **Note :** En mode `pnpm link`, l'optimisation des images raster est désactivée (`vite-plugin-image-optimizer` ne trouve pas `sharp` à cause de l'isolation pnpm). Pour l'activer en dev, ajouter `sharp` en devDependency du conso (`pnpm add -D sharp`). Ce problème n'existe pas en installation réelle depuis npm.
|
|
213
|
+
|
|
184
214
|
## Licence
|
|
185
215
|
|
|
186
|
-
MIT
|
|
216
|
+
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
import { dirname, join } from 'path';
|
|
5
|
+
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const viteRoot = dirname(require.resolve('vite/package.json'));
|
|
8
|
+
const viteBin = join(viteRoot, 'bin/vite.js');
|
|
9
|
+
|
|
10
|
+
spawn('node', [viteBin, ...process.argv.slice(2)], { stdio: 'inherit' })
|
|
11
|
+
.on('exit', (code) => process.exit(code ?? 0));
|
package/dist/create-config.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CreateViteConfigOptions } from './types.js';
|
|
2
|
-
export declare function createViteConfig(options: CreateViteConfigOptions): import("vite").UserConfig
|
|
2
|
+
export declare function createViteConfig(options: CreateViteConfigOptions): Promise<import("vite").UserConfig>;
|
|
3
3
|
//# sourceMappingURL=create-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../src/create-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-config.d.ts","sourceRoot":"","sources":["../src/create-config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AAwBxD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,sCAgItE"}
|
package/dist/create-config.js
CHANGED
|
@@ -10,21 +10,21 @@ function getFiles(entries, ignore) {
|
|
|
10
10
|
const files = globSync(patterns, { ignore: ignorePatterns });
|
|
11
11
|
const input = {};
|
|
12
12
|
files.forEach((file) => {
|
|
13
|
-
const nameMatch = file.match(/([^\/]+)\.(js|scss|css|ts|png|jpeg|jpg|gif|svg|woff2|woff)$/);
|
|
13
|
+
const nameMatch = file.match(/([^\/]+)\.(js|scss|css|ts|png|jpeg|jpg|gif|svg|webp|woff2|woff)$/);
|
|
14
14
|
if (nameMatch && nameMatch[0]) {
|
|
15
15
|
input[nameMatch[0]] = resolve(cwd, file);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
return input;
|
|
19
19
|
}
|
|
20
|
-
export function createViteConfig(options) {
|
|
20
|
+
export async function createViteConfig(options) {
|
|
21
21
|
const cwd = process.cwd();
|
|
22
22
|
const entries = options.entries ?? [
|
|
23
23
|
'src/scss/*.scss',
|
|
24
24
|
'src/scripts/*.js',
|
|
25
25
|
'src/scripts/*.ts',
|
|
26
26
|
'src/iconfonts/*.{woff2,woff}',
|
|
27
|
-
'src/images/**/*.{png,jpeg,jpg,gif,svg}',
|
|
27
|
+
'src/images/**/*.{png,jpeg,jpg,gif,svg,webp}',
|
|
28
28
|
];
|
|
29
29
|
const entriesIgnore = options.entriesIgnore ?? [
|
|
30
30
|
'src/images/icons/**/*.svg',
|
|
@@ -32,24 +32,26 @@ export function createViteConfig(options) {
|
|
|
32
32
|
];
|
|
33
33
|
// Construction des plugins
|
|
34
34
|
const plugins = [];
|
|
35
|
+
const inputFiles = getFiles(entries, entriesIgnore);
|
|
35
36
|
// Live reload
|
|
36
37
|
if (options.liveReload !== false) {
|
|
37
38
|
const liveReloadPatterns = options.liveReload ?? ['../templates/**/*.twig'];
|
|
38
39
|
try {
|
|
39
|
-
const { default: LiveReloadPlugin } =
|
|
40
|
+
const { default: LiveReloadPlugin } = await import('vite-plugin-live-reload');
|
|
40
41
|
plugins.push(LiveReloadPlugin(liveReloadPatterns.map(p => resolve(cwd, p))));
|
|
41
42
|
}
|
|
42
|
-
catch { /*
|
|
43
|
+
catch { /* dep non installée */ }
|
|
43
44
|
}
|
|
44
|
-
//
|
|
45
|
+
// Optimisation des images raster (optionnel) — uniquement si des images raster sont présentes
|
|
45
46
|
if (options.imagemin !== false) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
const hasRasterImages = Object.values(inputFiles).some(f => /\.(png|jpe?g|gif|tiff|webp)$/i.test(f));
|
|
48
|
+
if (hasRasterImages) {
|
|
49
|
+
try {
|
|
50
|
+
const { ViteImageOptimizer } = await import('vite-plugin-image-optimizer');
|
|
51
|
+
plugins.push(ViteImageOptimizer({ exclude: /\.svg$/i }));
|
|
52
|
+
}
|
|
53
|
+
catch { /* dep non installée */ }
|
|
51
54
|
}
|
|
52
|
-
catch { /* peer dep non installée */ }
|
|
53
55
|
}
|
|
54
56
|
// Iconfont
|
|
55
57
|
if (options.iconfont !== false) {
|
|
@@ -81,21 +83,13 @@ export function createViteConfig(options) {
|
|
|
81
83
|
'@fonts': resolve(cwd, 'src/fonts'),
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
|
-
esbuild: {
|
|
85
|
-
target: 'esnext',
|
|
86
|
-
},
|
|
87
|
-
optimizeDeps: {
|
|
88
|
-
esbuildOptions: {
|
|
89
|
-
target: 'esnext'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
86
|
build: {
|
|
93
87
|
target: 'esnext',
|
|
94
88
|
manifest: true,
|
|
95
89
|
outDir: 'dist',
|
|
96
90
|
copyPublicDir: true,
|
|
97
91
|
rollupOptions: {
|
|
98
|
-
input:
|
|
92
|
+
input: inputFiles,
|
|
99
93
|
output: {
|
|
100
94
|
manualChunks: options.manualChunks,
|
|
101
95
|
chunkFileNames: () => 'scripts/chunks/[name]-[hash].js',
|
|
@@ -113,7 +107,7 @@ export function createViteConfig(options) {
|
|
|
113
107
|
if (ext === 'css') {
|
|
114
108
|
return `css/[name].css`;
|
|
115
109
|
}
|
|
116
|
-
if (['png', 'jpg', 'jpeg', 'gif', 'svg'].includes(ext)) {
|
|
110
|
+
if (['png', 'jpg', 'jpeg', 'gif', 'svg', 'webp'].includes(ext)) {
|
|
117
111
|
const originalPath = assetInfo.originalFileNames && assetInfo.originalFileNames.length > 0
|
|
118
112
|
? assetInfo.originalFileNames[0]
|
|
119
113
|
: '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-config.js","sourceRoot":"","sources":["../src/create-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"create-config.js","sourceRoot":"","sources":["../src/create-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,kBAAkB,MAAM,0CAA0C,CAAC;AAC1E,OAAO,kBAAkB,MAAM,0CAA0C,CAAC;AAM1E,SAAS,QAAQ,CAAC,OAAiB,EAAE,MAAgB;IACjD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAExD,MAAM,KAAK,GAA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;gCACD,OAAO,UAAU,QAAQ,eAAe,CAAC;4BAC7C,CAAC;4BACD,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gCACxC,OAAO,4BAA4B,CAAC;4BACxC,CAAC;4BACD,OAAO,qBAAqB,CAAC;wBACjC,CAAC;wBACD,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;4BAC/F,OAAO,wBAAwB,CAAC;wBACpC,CAAC;wBACD,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;4BAC3F,OAAO,oBAAoB,CAAC;wBAChC,CAAC;wBACD,OAAO,cAAc,CAAC;oBAC1B,CAAC;oBACD,MAAM,EAAE,IAAI;iBACf;aACJ;SACJ;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolu/assets-toolkit",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Toolkit Vite pour les pipelines d'assets front-end : factory de configuration, plugins iconfont et svgstore",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,24 +11,35 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"assets-toolkit": "./bin/cli.js"
|
|
16
|
+
},
|
|
14
17
|
"files": [
|
|
18
|
+
"bin",
|
|
15
19
|
"dist"
|
|
16
20
|
],
|
|
17
21
|
"scripts": {
|
|
18
22
|
"build": "tsc && cp -r src/plugins/iconfont/templates dist/plugins/iconfont/",
|
|
19
|
-
"prepublishOnly": "
|
|
23
|
+
"prepublishOnly": "pnpm run build"
|
|
20
24
|
},
|
|
21
25
|
"dependencies": {
|
|
22
26
|
"chalk": "^5.6.2",
|
|
23
27
|
"fs-extra": "^11.2.0",
|
|
24
28
|
"glob": "^10.4.5",
|
|
25
29
|
"nunjucks": "^3.2.4",
|
|
30
|
+
"sass": "^1.0.0",
|
|
31
|
+
"sharp": "^0.33.5",
|
|
26
32
|
"svg2ttf": "^6.0.3",
|
|
27
33
|
"svgicons2svgfont": "^13.0.0",
|
|
28
34
|
"svgo": "^4.0.1",
|
|
29
35
|
"svgstore": "^3.0.1",
|
|
30
36
|
"ttf2woff": "^3.0.0",
|
|
31
|
-
"ttf2woff2": "^7.0.0"
|
|
37
|
+
"ttf2woff2": "^7.0.0",
|
|
38
|
+
"vite-plugin-image-optimizer": "^1.1.9",
|
|
39
|
+
"vite-plugin-live-reload": "^3.0.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"vite": ">=5.0.0"
|
|
32
43
|
},
|
|
33
44
|
"devDependencies": {
|
|
34
45
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -36,22 +47,10 @@
|
|
|
36
47
|
"@types/nunjucks": "^3.2.6",
|
|
37
48
|
"@types/svg2ttf": "^5.0.3",
|
|
38
49
|
"@types/ttf2woff": "^2.0.4",
|
|
39
|
-
"typescript": "^5.3.3"
|
|
40
|
-
"vite": "^6.4.1"
|
|
50
|
+
"typescript": "^5.3.3"
|
|
41
51
|
},
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"vite": ">=5.0.0",
|
|
45
|
-
"vite-plugin-imagemin": ">=0.6.0",
|
|
46
|
-
"vite-plugin-live-reload": ">=3.0.0"
|
|
47
|
-
},
|
|
48
|
-
"peerDependenciesMeta": {
|
|
49
|
-
"vite-plugin-imagemin": {
|
|
50
|
-
"optional": true
|
|
51
|
-
},
|
|
52
|
-
"vite-plugin-live-reload": {
|
|
53
|
-
"optional": true
|
|
54
|
-
}
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=22"
|
|
55
54
|
},
|
|
56
55
|
"license": "MIT"
|
|
57
56
|
}
|