@taro-minify-pack/plugin-remote-assets 0.1.1 → 0.1.3-alpha.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.
|
@@ -26,7 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.aliOssUploadAdapter = void 0;
|
|
27
27
|
const define_adapter_1 = require("./define-adapter");
|
|
28
28
|
const ali_oss_1 = __importDefault(require("ali-oss"));
|
|
29
|
-
const path_1 = __importDefault(require("path"));
|
|
30
29
|
exports.aliOssUploadAdapter = (0, define_adapter_1.defineUploaderAdapter)((opt) => {
|
|
31
30
|
const { customDomain, bucketDir = '/' } = opt, aliOssOpt = __rest(opt, ["customDomain", "bucketDir"]);
|
|
32
31
|
const client = new ali_oss_1.default(aliOssOpt);
|
|
@@ -44,12 +43,12 @@ exports.aliOssUploadAdapter = (0, define_adapter_1.defineUploaderAdapter)((opt)
|
|
|
44
43
|
const uploadToAliOss = (...args) => __awaiter(void 0, void 0, void 0, function* () { return client.put(...args); });
|
|
45
44
|
const getRemoteAssetPath = (localAssetInfo) => {
|
|
46
45
|
const { uniqueKey, ext } = localAssetInfo;
|
|
47
|
-
return
|
|
46
|
+
return `${bucketDir}/${uniqueKey}${ext}`;
|
|
48
47
|
};
|
|
49
48
|
const getRemoteAssetUrl = (localAssetInfo) => {
|
|
50
49
|
const { uniqueKey, ext } = localAssetInfo;
|
|
51
50
|
if (customDomain)
|
|
52
|
-
return
|
|
51
|
+
return `${customDomain}/${uniqueKey}${ext}`;
|
|
53
52
|
const remotePath = getRemoteAssetPath(localAssetInfo);
|
|
54
53
|
return client.signatureUrl(remotePath);
|
|
55
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-adapter-ali-oss.js","sourceRoot":"","sources":["../../src/upload-adapter/upload-adapter-ali-oss.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAwD;AAExD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AAS,GAAG,GAAG,EAAE,CAAA;QAC7D,MAAM,UAAU,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAA;QACrD,OAAO,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;IACxC,CAAC,CAAA;IAED,OAAO,CAAO,cAA8B,EAAE,EAAE;QAC9C,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,CAAA;QACpC,MAAM,eAAe,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAA;QAC1D,MAAM,cAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAA;QACxD,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,eAAe,CAAC,CAAA;QACzD,IAAI,OAAO;YAAE,uCAAY,cAAc,KAAE,SAAS,EAAE,cAAc,IAAE;QACpE,MAAM,cAAc,CAAC,eAAe,EAAE,SAAS,CAAC,CAAA;QAChD,uCAAY,cAAc,KAAE,SAAS,EAAE,cAAc,IAAE;IACzD,CAAC,CAAA,CAAA;AACH,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineUploaderAdapter } from './define-adapter'
|
|
2
2
|
import { LocalAssetInfo } from '@/types'
|
|
3
3
|
import AliOss from 'ali-oss'
|
|
4
|
-
import path from 'path'
|
|
5
4
|
|
|
6
5
|
export interface AliOssUploadAdapterOpt extends AliOss.Options {
|
|
7
6
|
customDomain?: string
|
|
@@ -27,12 +26,12 @@ export const aliOssUploadAdapter = defineUploaderAdapter((opt: AliOssUploadAdapt
|
|
|
27
26
|
|
|
28
27
|
const getRemoteAssetPath = (localAssetInfo: LocalAssetInfo) => {
|
|
29
28
|
const { uniqueKey, ext } = localAssetInfo
|
|
30
|
-
return
|
|
29
|
+
return `${bucketDir}/${uniqueKey}${ext}`
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
const getRemoteAssetUrl = (localAssetInfo: LocalAssetInfo) => {
|
|
34
33
|
const { uniqueKey, ext } = localAssetInfo
|
|
35
|
-
if (customDomain) return
|
|
34
|
+
if (customDomain) return `${customDomain}/${uniqueKey}${ext}`
|
|
36
35
|
const remotePath = getRemoteAssetPath(localAssetInfo)
|
|
37
36
|
return client.signatureUrl(remotePath)
|
|
38
37
|
}
|