cos-wx-sdk-v5 1.1.1 → 1.1.2
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 +9 -3
- package/build.js +8 -2
- package/demo/lib/cos-wx-sdk-v5.js +2841 -2818
- package/demo/lib/cos-wx-sdk-v5.min.js +1 -0
- package/demo-album/lib/cos-wx-sdk-v5.js +2841 -2818
- package/demo-album/lib/cos-wx-sdk-v5.min.js +1 -0
- package/lib/request.js +29 -29
- package/package.json +9 -5
- package/src/base.js +49 -7
- package/src/cos.js +9 -1
- package/src/util.js +52 -25
package/README.md
CHANGED
|
@@ -18,7 +18,11 @@
|
|
|
18
18
|
1. 把 demo/lib/cos-wx-sdk-v5.js 复制到自己小程序项目代码里,在需要上传文件的地方贴以下代码
|
|
19
19
|
|
|
20
20
|
```javascript
|
|
21
|
+
|
|
22
|
+
// 存储桶名称,由bucketname-appid 组成,appid必须填入,可以在COS控制台查看存储桶名称。 https://console.cloud.tencent.com/cos5/bucket
|
|
21
23
|
var Bucket = 'test-1250000000';
|
|
24
|
+
// 存储桶Region可以在COS控制台指定存储桶的概览页查看 https://console.cloud.tencent.com/cos5/bucket/
|
|
25
|
+
// 关于地域的详情见 https://cloud.tencent.com/document/product/436/6224
|
|
22
26
|
var Region = 'ap-guangzhou';
|
|
23
27
|
|
|
24
28
|
// 初始化实例
|
|
@@ -68,8 +72,10 @@ wx.chooseImage({
|
|
|
68
72
|
});
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
## 说明文档
|
|
75
|
+
## 说明文档
|
|
76
|
+
|
|
77
|
+
[使用例子](demo/demo-sdk.js)
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
[快速入门](https://cloud.tencent.com/document/product/436/31953)
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
[接口文档](https://cloud.tencent.com/document/product/436/31953)
|
package/build.js
CHANGED
|
@@ -45,7 +45,10 @@ var config = {
|
|
|
45
45
|
rules: [
|
|
46
46
|
{
|
|
47
47
|
test: /\.m?js$/,
|
|
48
|
-
|
|
48
|
+
loader: 'babel-loader',
|
|
49
|
+
options: {
|
|
50
|
+
presets: ['es2015']
|
|
51
|
+
}
|
|
49
52
|
}
|
|
50
53
|
]
|
|
51
54
|
},
|
|
@@ -66,7 +69,7 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
66
69
|
'demo-album/project.config.json',
|
|
67
70
|
]);
|
|
68
71
|
config.watch = false;
|
|
69
|
-
config.output.filename = 'cos-wx-sdk-v5.js';
|
|
72
|
+
config.output.filename = 'cos-wx-sdk-v5.min.js';
|
|
70
73
|
config.plugins = (config.plugins || []).concat([
|
|
71
74
|
new webpack.DefinePlugin({
|
|
72
75
|
'process.env': {
|
|
@@ -92,7 +95,10 @@ webpack(config, function (err, stats) {
|
|
|
92
95
|
// 每次运行 npm run build,将 sourcePath 代码复制一份放入 targetPath
|
|
93
96
|
var sourcePath = path.resolve(__dirname, './demo/lib/cos-wx-sdk-v5.js');
|
|
94
97
|
var targetPath = path.resolve(__dirname, './demo-album/lib/cos-wx-sdk-v5.js');
|
|
98
|
+
var minSourcePath = path.resolve(__dirname, './demo/lib/cos-wx-sdk-v5.min.js');
|
|
99
|
+
var mintTargetPath = path.resolve(__dirname, './demo-album/lib/cos-wx-sdk-v5.min.js');
|
|
95
100
|
fs.createReadStream(sourcePath).pipe(fs.createWriteStream(targetPath));
|
|
101
|
+
fs.createReadStream(minSourcePath).pipe(fs.createWriteStream(mintTargetPath));
|
|
96
102
|
if (err) throw err
|
|
97
103
|
process.stdout.write(stats.toString({
|
|
98
104
|
colors: true,
|