vite-plugin-zip-file 4.1.1 → 5.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/LICENSE +21 -21
- package/README.md +123 -123
- package/package.json +59 -56
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 shawn.wu
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 shawn.wu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
# vite-plugin-zip-file
|
|
2
|
-
|
|
3
|
-
[](./LICENSE)
|
|
4
|
-

|
|
5
|
-
[](https://www.npmjs.com/package/vite-plugin-zip-file)
|
|
6
|
-
|
|
7
|
-
Zip files at build time.
|
|
8
|
-
|
|
9
|
-
**Tips: Node.js
|
|
10
|
-
|
|
11
|
-
# Install
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
yarn add vite-plugin-zip-file --dev
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
or
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
npm install vite-plugin-zip-file --save-dev
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
or
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
pnpm add vite-plugin-zip-file -D
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
# Options
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| Params | Types | Rquired | Default | Desc |
|
|
33
|
-
| :---------------- | ------------ | ------- | ------- | ------------------------------------------------------------ |
|
|
34
|
-
| folderPath | String\|Path | true | /dist | Path to the compressed folder |
|
|
35
|
-
| outPath | String\|Path | true | / | Compressed package output path |
|
|
36
|
-
| zipName | String | false | dist | Package name |
|
|
37
|
-
| enabled | Boolean | false | true | This parameter is used to control whether the plugin is enabled. It is usually used to determine whether to compress files according to the environment |
|
|
38
|
-
| deleteFolder | Boolean | false | false | Whether to delete source files after compression is completed |
|
|
39
|
-
| withoutMainFolder | Boolean | false | false | The compressed file whether removes the outermost main folder. |
|
|
40
|
-
|
|
41
|
-
<br />
|
|
42
|
-
|
|
43
|
-
# 选项
|
|
44
|
-
|
|
45
|
-
<table>
|
|
46
|
-
<thead>
|
|
47
|
-
<tr>
|
|
48
|
-
<th>参数</th>
|
|
49
|
-
<th>类型</th>
|
|
50
|
-
<th width="75">必填</th>
|
|
51
|
-
<th width="95">默认值</th>
|
|
52
|
-
<th>说明</th>
|
|
53
|
-
</tr>
|
|
54
|
-
</thead>
|
|
55
|
-
<tbody>
|
|
56
|
-
<tr>
|
|
57
|
-
<td>folderPath</td>
|
|
58
|
-
<td>String|Path</td>
|
|
59
|
-
<td>是</td>
|
|
60
|
-
<td>/dist</td>
|
|
61
|
-
<td>需要被压缩的源文件夹</td>
|
|
62
|
-
</tr>
|
|
63
|
-
<tr>
|
|
64
|
-
<td>outPath</td>
|
|
65
|
-
<td>String|Path</td>
|
|
66
|
-
<td>是</td>
|
|
67
|
-
<td>/</td>
|
|
68
|
-
<td>压缩包输出路径</td>
|
|
69
|
-
</tr>
|
|
70
|
-
<tr>
|
|
71
|
-
<td>zipName</td>
|
|
72
|
-
<td>String</td>
|
|
73
|
-
<td>否</td>
|
|
74
|
-
<td>dist</td>
|
|
75
|
-
<td>压缩包名称</td>
|
|
76
|
-
</tr>
|
|
77
|
-
<tr>
|
|
78
|
-
<td>enabled</td>
|
|
79
|
-
<td>Boolean</td>
|
|
80
|
-
<td>否</td>
|
|
81
|
-
<td>true</td>
|
|
82
|
-
<td>用于控制插件是否启用, 通常用于根据环境判断是否压缩文件</td>
|
|
83
|
-
</tr>
|
|
84
|
-
<tr>
|
|
85
|
-
<td>deleteFolder</td>
|
|
86
|
-
<td>Boolean</td>
|
|
87
|
-
<td>否</td>
|
|
88
|
-
<td>false</td>
|
|
89
|
-
<td>压缩完成后是否删除源文件</td>
|
|
90
|
-
</tr>
|
|
91
|
-
<tr>
|
|
92
|
-
<td>withoutMainFolder</td>
|
|
93
|
-
<td>Boolean</td>
|
|
94
|
-
<td>否</td>
|
|
95
|
-
<td>false</td>
|
|
96
|
-
<td>压缩后的文件是否去掉最外层文件夹</td>
|
|
97
|
-
</tr>
|
|
98
|
-
</tbody>
|
|
99
|
-
</table>
|
|
100
|
-
|
|
101
|
-
<br />
|
|
102
|
-
|
|
103
|
-
# Usage
|
|
104
|
-
|
|
105
|
-
```javascript
|
|
106
|
-
import { defineConfig } from 'vite';
|
|
107
|
-
import { viteZip } from 'vite-plugin-zip-file';
|
|
108
|
-
import path from 'path';
|
|
109
|
-
import { fileURLToPath } from 'url';
|
|
110
|
-
import { env } from 'node:process';
|
|
111
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
112
|
-
|
|
113
|
-
// https://vitejs.dev/config/
|
|
114
|
-
export default defineConfig({
|
|
115
|
-
plugins: [
|
|
116
|
-
viteZip({
|
|
117
|
-
folderPath: path.resolve(__dirname, 'dist'),
|
|
118
|
-
outPath: path.resolve(__dirname),
|
|
119
|
-
zipName: 'dist.zip',
|
|
120
|
-
enabled: env.NODE_ENV === 'production'? true: false
|
|
121
|
-
})
|
|
122
|
-
]
|
|
123
|
-
})
|
|
1
|
+
# vite-plugin-zip-file
|
|
2
|
+
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+

|
|
5
|
+
[](https://www.npmjs.com/package/vite-plugin-zip-file)
|
|
6
|
+
|
|
7
|
+
Zip files at build time.
|
|
8
|
+
|
|
9
|
+
**Tips: Node.js 20+ is required.**
|
|
10
|
+
|
|
11
|
+
# Install
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
yarn add vite-plugin-zip-file --dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
or
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm install vite-plugin-zip-file --save-dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
pnpm add vite-plugin-zip-file -D
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
# Options
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
| Params | Types | Rquired | Default | Desc |
|
|
33
|
+
| :---------------- | ------------ | ------- | ------- | ------------------------------------------------------------ |
|
|
34
|
+
| folderPath | String\|Path | true | /dist | Path to the compressed folder |
|
|
35
|
+
| outPath | String\|Path | true | / | Compressed package output path |
|
|
36
|
+
| zipName | String | false | dist | Package name |
|
|
37
|
+
| enabled | Boolean | false | true | This parameter is used to control whether the plugin is enabled. It is usually used to determine whether to compress files according to the environment |
|
|
38
|
+
| deleteFolder | Boolean | false | false | Whether to delete source files after compression is completed |
|
|
39
|
+
| withoutMainFolder | Boolean | false | false | The compressed file whether removes the outermost main folder. |
|
|
40
|
+
|
|
41
|
+
<br />
|
|
42
|
+
|
|
43
|
+
# 选项
|
|
44
|
+
|
|
45
|
+
<table>
|
|
46
|
+
<thead>
|
|
47
|
+
<tr>
|
|
48
|
+
<th>参数</th>
|
|
49
|
+
<th>类型</th>
|
|
50
|
+
<th width="75">必填</th>
|
|
51
|
+
<th width="95">默认值</th>
|
|
52
|
+
<th>说明</th>
|
|
53
|
+
</tr>
|
|
54
|
+
</thead>
|
|
55
|
+
<tbody>
|
|
56
|
+
<tr>
|
|
57
|
+
<td>folderPath</td>
|
|
58
|
+
<td>String|Path</td>
|
|
59
|
+
<td>是</td>
|
|
60
|
+
<td>/dist</td>
|
|
61
|
+
<td>需要被压缩的源文件夹</td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr>
|
|
64
|
+
<td>outPath</td>
|
|
65
|
+
<td>String|Path</td>
|
|
66
|
+
<td>是</td>
|
|
67
|
+
<td>/</td>
|
|
68
|
+
<td>压缩包输出路径</td>
|
|
69
|
+
</tr>
|
|
70
|
+
<tr>
|
|
71
|
+
<td>zipName</td>
|
|
72
|
+
<td>String</td>
|
|
73
|
+
<td>否</td>
|
|
74
|
+
<td>dist</td>
|
|
75
|
+
<td>压缩包名称</td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr>
|
|
78
|
+
<td>enabled</td>
|
|
79
|
+
<td>Boolean</td>
|
|
80
|
+
<td>否</td>
|
|
81
|
+
<td>true</td>
|
|
82
|
+
<td>用于控制插件是否启用, 通常用于根据环境判断是否压缩文件</td>
|
|
83
|
+
</tr>
|
|
84
|
+
<tr>
|
|
85
|
+
<td>deleteFolder</td>
|
|
86
|
+
<td>Boolean</td>
|
|
87
|
+
<td>否</td>
|
|
88
|
+
<td>false</td>
|
|
89
|
+
<td>压缩完成后是否删除源文件</td>
|
|
90
|
+
</tr>
|
|
91
|
+
<tr>
|
|
92
|
+
<td>withoutMainFolder</td>
|
|
93
|
+
<td>Boolean</td>
|
|
94
|
+
<td>否</td>
|
|
95
|
+
<td>false</td>
|
|
96
|
+
<td>压缩后的文件是否去掉最外层文件夹</td>
|
|
97
|
+
</tr>
|
|
98
|
+
</tbody>
|
|
99
|
+
</table>
|
|
100
|
+
|
|
101
|
+
<br />
|
|
102
|
+
|
|
103
|
+
# Usage
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
import { defineConfig } from 'vite';
|
|
107
|
+
import { viteZip } from 'vite-plugin-zip-file';
|
|
108
|
+
import path from 'path';
|
|
109
|
+
import { fileURLToPath } from 'url';
|
|
110
|
+
import { env } from 'node:process';
|
|
111
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
112
|
+
|
|
113
|
+
// https://vitejs.dev/config/
|
|
114
|
+
export default defineConfig({
|
|
115
|
+
plugins: [
|
|
116
|
+
viteZip({
|
|
117
|
+
folderPath: path.resolve(__dirname, 'dist'),
|
|
118
|
+
outPath: path.resolve(__dirname),
|
|
119
|
+
zipName: 'dist.zip',
|
|
120
|
+
enabled: env.NODE_ENV === 'production'? true: false
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
})
|
|
124
124
|
```
|
package/package.json
CHANGED
|
@@ -1,56 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vite-plugin-zip-file",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Zip files at build time.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.cjs",
|
|
7
|
-
"files": [
|
|
8
|
-
"lib/*",
|
|
9
|
-
"LICENSE",
|
|
10
|
-
"package.json",
|
|
11
|
-
"README.md"
|
|
12
|
-
],
|
|
13
|
-
"module": "lib/index.mjs",
|
|
14
|
-
"types": "lib/index.d.ts",
|
|
15
|
-
"exports": {
|
|
16
|
-
".": {
|
|
17
|
-
"types": "./lib/index.d.ts",
|
|
18
|
-
"import": "./lib/index.mjs",
|
|
19
|
-
"require": "./lib/index.cjs"
|
|
20
|
-
},
|
|
21
|
-
"./package.json": "./package.json"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"dev": "vite",
|
|
25
|
-
"build": "vite build",
|
|
26
|
-
"build-d": "node --inspect-brk=9229 ./node_modules/vite/dist/node/cli.js build",
|
|
27
|
-
"build-plugin": "vite --config plugin.config.ts build && tsc"
|
|
28
|
-
},
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+ssh://git@github.com/Ssis53/vite-plugin-zip.git"
|
|
32
|
-
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"vite": "
|
|
55
|
-
}
|
|
56
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "vite-plugin-zip-file",
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "Zip files at build time.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.cjs",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib/*",
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"package.json",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"module": "lib/index.mjs",
|
|
14
|
+
"types": "lib/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./lib/index.d.ts",
|
|
18
|
+
"import": "./lib/index.mjs",
|
|
19
|
+
"require": "./lib/index.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "vite",
|
|
25
|
+
"build": "vite build",
|
|
26
|
+
"build-d": "node --inspect-brk=9229 ./node_modules/vite/dist/node/cli.js build",
|
|
27
|
+
"build-plugin": "vite --config plugin.config.ts build && tsc"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+ssh://git@github.com/Ssis53/vite-plugin-zip.git"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"vite",
|
|
38
|
+
"zip",
|
|
39
|
+
"compress"
|
|
40
|
+
],
|
|
41
|
+
"author": "Shawn Wu",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/Ssis53/vite-plugin-zip/issues"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://github.com/Ssis53/vite-plugin-zip#readme",
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"jszip": "3.10.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@rollup/plugin-node-resolve": "^15.2.0",
|
|
52
|
+
"@types/node": "^22.13.15",
|
|
53
|
+
"typescript": "^5.8.2",
|
|
54
|
+
"vite": "^7.2.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"vite": ">=2.0.0"
|
|
58
|
+
}
|
|
59
|
+
}
|