nextemos 6.2.1 → 6.2.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/dist/helpers/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { default as fetchRequest } from './fetchRequest';
|
|
2
2
|
export { default as toIntArray } from './toIntArray';
|
|
3
3
|
export { default as toQueryString } from './toQueryString';
|
|
4
|
-
export { default as cdn } from './cdn';
|
|
5
4
|
export { default as decodeHTML } from './decodeHTML';
|
|
6
5
|
export { default as NEXTEMOS_CONFIG } from './getConfigs';
|
package/dist/helpers/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NEXTEMOS_CONFIG = exports.decodeHTML = exports.
|
|
6
|
+
exports.NEXTEMOS_CONFIG = exports.decodeHTML = exports.toQueryString = exports.toIntArray = exports.fetchRequest = void 0;
|
|
7
7
|
/// helpers
|
|
8
8
|
var fetchRequest_1 = require("./fetchRequest");
|
|
9
9
|
Object.defineProperty(exports, "fetchRequest", { enumerable: true, get: function () { return __importDefault(fetchRequest_1).default; } });
|
|
@@ -11,8 +11,6 @@ var toIntArray_1 = require("./toIntArray");
|
|
|
11
11
|
Object.defineProperty(exports, "toIntArray", { enumerable: true, get: function () { return __importDefault(toIntArray_1).default; } });
|
|
12
12
|
var toQueryString_1 = require("./toQueryString");
|
|
13
13
|
Object.defineProperty(exports, "toQueryString", { enumerable: true, get: function () { return __importDefault(toQueryString_1).default; } });
|
|
14
|
-
var cdn_1 = require("./cdn");
|
|
15
|
-
Object.defineProperty(exports, "cdn", { enumerable: true, get: function () { return __importDefault(cdn_1).default; } });
|
|
16
14
|
var decodeHTML_1 = require("./decodeHTML");
|
|
17
15
|
Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return __importDefault(decodeHTML_1).default; } });
|
|
18
16
|
var getConfigs_1 = require("./getConfigs");
|
package/package.json
CHANGED
package/dist/helpers/cdn.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
interface IThumbImage {
|
|
2
|
-
width: number;
|
|
3
|
-
height?: number;
|
|
4
|
-
path: string;
|
|
5
|
-
quality?: number;
|
|
6
|
-
format?: string;
|
|
7
|
-
options?: {
|
|
8
|
-
service?: string;
|
|
9
|
-
backColor?: string;
|
|
10
|
-
quality?: number;
|
|
11
|
-
customOptions?: string;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
declare const cdn: {
|
|
15
|
-
url: string;
|
|
16
|
-
videoUrl: string;
|
|
17
|
-
thumbImage: (props: IThumbImage) => string;
|
|
18
|
-
getFile: (path?: string) => string;
|
|
19
|
-
getVideo: (path?: string) => string;
|
|
20
|
-
};
|
|
21
|
-
export default cdn;
|
package/dist/helpers/cdn.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const html_entities_1 = require("html-entities");
|
|
7
|
-
const getConfigs_1 = __importDefault(require("./getConfigs"));
|
|
8
|
-
const { CDN_URL, VIDEO_CDN_URL, CDN_PROVIDER, THUMBOR_SOURCE } = getConfigs_1.default;
|
|
9
|
-
// CDN işlemleri için kullanılan nesne
|
|
10
|
-
const cdn = {
|
|
11
|
-
// CDN URL'sini döndüren özellik
|
|
12
|
-
url: CDN_URL,
|
|
13
|
-
// Video CDN URL'sini döndüren özellik
|
|
14
|
-
videoUrl: VIDEO_CDN_URL,
|
|
15
|
-
// Thumbnail URL'si oluşturan fonksiyon
|
|
16
|
-
thumbImage: function (props) {
|
|
17
|
-
switch (CDN_PROVIDER // CDN sağlayıcısına göre işlemci fonksiyonunu seçiyor
|
|
18
|
-
) {
|
|
19
|
-
case "huawei":
|
|
20
|
-
return huaweiImageProcessor(props); // Huawei işlemcisi kullanılıyor
|
|
21
|
-
case "medianova":
|
|
22
|
-
return medianovaImageProcessor(props); // Medianova işlemcisi kullanılıyor
|
|
23
|
-
default:
|
|
24
|
-
return thumborImageProcessor(props); // Varsayılan olarak Thumbor işlemcisi kullanılıyor
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
// CDN'deki dosyayı linkini getiren fonksiyon
|
|
28
|
-
getFile: function (path = "") {
|
|
29
|
-
return `${this.url}/${encodeURI((0, html_entities_1.decode)(path))}`;
|
|
30
|
-
},
|
|
31
|
-
// CDN'deki video url'ini getiren fonksiyon
|
|
32
|
-
getVideo: function (path = "") {
|
|
33
|
-
return `${this.videoUrl}/${encodeURI((0, html_entities_1.decode)(path))}`;
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
// Değerin geçerli olup olmadığını kontrol eden ve string olarak döndüren yardımcı fonksiyon
|
|
37
|
-
const getValueOrDefault = (value) => !value || value <= 0 ? "-" : value.toString(); // Geçerli değilse "-" döner, aksi halde değeri string olarak döner
|
|
38
|
-
// Huawei CDN sağlayıcısı için thumbnail URL'si oluşturan fonksiyon
|
|
39
|
-
const huaweiImageProcessor = (props) => {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f;
|
|
41
|
-
// Varsayılan servis türü "mnresize" olarak ayarlanıyor
|
|
42
|
-
let service = "mnresize";
|
|
43
|
-
// Varsayılan genişlik ve yükseklik 0 olarak atanıyor
|
|
44
|
-
const width = (_a = props.width) !== null && _a !== void 0 ? _a : 0;
|
|
45
|
-
const height = (_b = props.height) !== null && _b !== void 0 ? _b : 0;
|
|
46
|
-
// Eğer props içinde servis belirtilmişse, o servis kullanılıyor
|
|
47
|
-
if ((_c = props.options) === null || _c === void 0 ? void 0 : _c.service)
|
|
48
|
-
service = (_d = props.options) === null || _d === void 0 ? void 0 : _d.service;
|
|
49
|
-
// Thumbnail URL'si oluşturmak için bir dizi başlatılıyor
|
|
50
|
-
const thumbUrl = new Array();
|
|
51
|
-
thumbUrl.push(CDN_URL); // CDN URL'si ekleniyor
|
|
52
|
-
thumbUrl.push(service); // Seçilen servis türü ekleniyor
|
|
53
|
-
thumbUrl.push(getValueOrDefault(width)); // Genişlik ekleniyor
|
|
54
|
-
thumbUrl.push(getValueOrDefault(height)); // Yükseklik ekleniyor
|
|
55
|
-
// Eğer arka plan rengi belirtilmişse, o da ekleniyor
|
|
56
|
-
if ((_e = props.options) === null || _e === void 0 ? void 0 : _e.backColor)
|
|
57
|
-
thumbUrl.push((_f = props.options) === null || _f === void 0 ? void 0 : _f.backColor);
|
|
58
|
-
// Görüntü yolu ekleniyor
|
|
59
|
-
thumbUrl.push(encodeURI((0, html_entities_1.decode)(props.path)));
|
|
60
|
-
// Sonuç olarak oluşturulan URL döndürülüyor
|
|
61
|
-
return thumbUrl.join("/");
|
|
62
|
-
};
|
|
63
|
-
// Medianova CDN sağlayıcısı için thumbnail URL'si oluşturan fonksiyon
|
|
64
|
-
const medianovaImageProcessor = (props) => {
|
|
65
|
-
// Şu an için Huawei işlemcisi ile aynı işlevi görüyor
|
|
66
|
-
return huaweiImageProcessor(props);
|
|
67
|
-
};
|
|
68
|
-
// Thumbor CDN sağlayıcısı için thumbnail URL'si oluşturan fonksiyon
|
|
69
|
-
const thumborImageProcessor = (props) => {
|
|
70
|
-
var _a, _b, _c, _d, _e, _f;
|
|
71
|
-
// Varsayılan hash değeri "unsafe" olarak ayarlanıyor
|
|
72
|
-
let hash = "unsafe";
|
|
73
|
-
// Varsayılan genişlik ve yükseklik 0 olarak atanıyor
|
|
74
|
-
const width = (_a = props.width) !== null && _a !== void 0 ? _a : 0;
|
|
75
|
-
const height = (_b = props.height) !== null && _b !== void 0 ? _b : 0;
|
|
76
|
-
// Thumbnail URL'si oluşturmak için bir dizi başlatılıyor
|
|
77
|
-
const thumbUrl = new Array();
|
|
78
|
-
thumbUrl.push(CDN_URL); // CDN URL'si ekleniyor
|
|
79
|
-
thumbUrl.push(hash); // Hash ekleniyor
|
|
80
|
-
// Genişlik veya yükseklik tanımlıysa, boyutlar ekleniyor
|
|
81
|
-
if (width > 0 || height > 0)
|
|
82
|
-
thumbUrl.push(`${props.width}x${props.height}`);
|
|
83
|
-
// Filtreler için bir dizi başlatılıyor
|
|
84
|
-
const filters = new Array();
|
|
85
|
-
// Kalite tanımlıysa ve 0'dan büyükse, kalite filtresi ekleniyor
|
|
86
|
-
if (((_c = props.options) === null || _c === void 0 ? void 0 : _c.quality) && ((_d = props.options) === null || _d === void 0 ? void 0 : _d.quality) > 0)
|
|
87
|
-
filters.push(`:quality(${props.options.quality})`);
|
|
88
|
-
// Arka plan rengi tanımlıysa, arka plan rengi filtresi ekleniyor
|
|
89
|
-
if ((_e = props.options) === null || _e === void 0 ? void 0 : _e.backColor)
|
|
90
|
-
filters.push(`:background_color(${props.options.backColor})`);
|
|
91
|
-
// Özelleştirilmiş diğer seçenekler tanımlıysa, onlar da ekleniyor
|
|
92
|
-
if ((_f = props.options) === null || _f === void 0 ? void 0 : _f.customOptions)
|
|
93
|
-
filters.push(`:(${props.options.customOptions})`);
|
|
94
|
-
// Filtreler birleştirilerek URL'ye ekleniyor
|
|
95
|
-
thumbUrl.push(filters.join(""));
|
|
96
|
-
// Ortam değişkeninden Thumbor kaynağı alınıyor, eğer tanımlıysa URL'ye ekleniyor
|
|
97
|
-
if (THUMBOR_SOURCE)
|
|
98
|
-
thumbUrl.push(THUMBOR_SOURCE);
|
|
99
|
-
// Görüntü yolu ekleniyor
|
|
100
|
-
thumbUrl.push(encodeURI((0, html_entities_1.decode)(props.path)));
|
|
101
|
-
// Sonuç olarak oluşturulan URL döndürülüyor
|
|
102
|
-
return thumbUrl.join("/");
|
|
103
|
-
};
|
|
104
|
-
exports.default = cdn;
|