@yidun/cdn-upload-webpack-plugin 1.1.0 → 1.1.1
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/package.json +1 -1
- package/src/index.js +4 -2
- package/src/vite.js +3 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -14,13 +14,15 @@ exports.CdnUploadWebpackPlugin = class CdnUploadWebpackPlugin {
|
|
|
14
14
|
* @param {String} secretKey
|
|
15
15
|
* @param {String} bucket 桶名
|
|
16
16
|
* @param {String} namespace 不同项目在使用同一个桶时做隔离
|
|
17
|
+
* @param {Number} parallelCount 并行上传数, 默认 3
|
|
17
18
|
*/
|
|
18
19
|
constructor (options) {
|
|
19
|
-
const { dirs, includeRootDir, ignores, client } = options
|
|
20
|
+
const { dirs, includeRootDir, ignores, client, parallelCount } = options
|
|
20
21
|
this._dirs = dirs
|
|
21
22
|
this._includeRootDir = includeRootDir
|
|
22
23
|
this._ignores = ignores
|
|
23
24
|
this._client = client
|
|
25
|
+
this._parallelCount = parallelCount
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
apply (compiler) {
|
|
@@ -35,7 +37,7 @@ exports.CdnUploadWebpackPlugin = class CdnUploadWebpackPlugin {
|
|
|
35
37
|
onError: error => callback(error)
|
|
36
38
|
})
|
|
37
39
|
console.log('CdnUploadWebpackPlugin: assets uploading ...')
|
|
38
|
-
taskDispatcher.dispatch()
|
|
40
|
+
taskDispatcher.dispatch(this._parallelCount)
|
|
39
41
|
})
|
|
40
42
|
}
|
|
41
43
|
}
|
package/src/vite.js
CHANGED
|
@@ -12,10 +12,11 @@ const NosUploadTask = require('./adaptor/nos')
|
|
|
12
12
|
* @param {String} secretKey
|
|
13
13
|
* @param {String} bucket 桶名
|
|
14
14
|
* @param {String} namespace 不同项目在使用同一个桶时做隔离
|
|
15
|
+
* @param {Number} parallelCount 并行上传数, 默认 3
|
|
15
16
|
* @returns
|
|
16
17
|
*/
|
|
17
18
|
function CdnUploadVitePlugin (options) {
|
|
18
|
-
const { dirs, includeRootDir, ignores, client } = options
|
|
19
|
+
const { dirs, includeRootDir, ignores, client, parallelCount } = options
|
|
19
20
|
return {
|
|
20
21
|
name: 'vite-plugin-cdn-upload',
|
|
21
22
|
closeBundle () {
|
|
@@ -30,7 +31,7 @@ function CdnUploadVitePlugin (options) {
|
|
|
30
31
|
onError: (error) => reject(error)
|
|
31
32
|
})
|
|
32
33
|
console.log('CdnUploadWebpackPlugin: assets uploading ...')
|
|
33
|
-
taskDispatcher.dispatch()
|
|
34
|
+
taskDispatcher.dispatch(parallelCount)
|
|
34
35
|
})
|
|
35
36
|
}
|
|
36
37
|
}
|