nextemos 3.7.9 → 3.8.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.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const html_entities_1 = require("html-entities");
3
4
  // Ortam değişkenlerinden CDN URL'si alınıyor, tanımlı değilse varsayılan olarak 'https://images.proj-e.com' kullanılıyor
4
5
  const CDN_URL = process.env.CDN_URL || 'https://images.proj-e.com';
5
6
  // Ortam değişkenlerinden CDN sağlayıcısı alınıyor
@@ -21,7 +22,7 @@ const cdn = {
21
22
  },
22
23
  // CDN'deki dosyayı linkini getiren fonksiyon
23
24
  getFile: function name(path = '') {
24
- return `${this.url}/${path}`;
25
+ return `${this.url}/${encodeURI((0, html_entities_1.decode)(path))}`;
25
26
  }
26
27
  };
27
28
  // Değerin geçerli olup olmadığını kontrol eden ve string olarak döndüren yardımcı fonksiyon
@@ -47,7 +48,7 @@ const huaweiImageProcessor = (props) => {
47
48
  if ((_e = props.options) === null || _e === void 0 ? void 0 : _e.backColor)
48
49
  thumbUrl.push((_f = props.options) === null || _f === void 0 ? void 0 : _f.backColor);
49
50
  // Görüntü yolu ekleniyor
50
- thumbUrl.push(props.path);
51
+ thumbUrl.push(encodeURI((0, html_entities_1.decode)(props.path)));
51
52
  // Sonuç olarak oluşturulan URL döndürülüyor
52
53
  return thumbUrl.join('/');
53
54
  };
@@ -89,7 +90,7 @@ const thumborImageProcessor = (props) => {
89
90
  if (source)
90
91
  thumbUrl.push(source);
91
92
  // Görüntü yolu ekleniyor
92
- thumbUrl.push(props.path);
93
+ thumbUrl.push(encodeURI((0, html_entities_1.decode)(props.path)));
93
94
  // Sonuç olarak oluşturulan URL döndürülüyor
94
95
  return thumbUrl.join('/');
95
96
  };
@@ -0,0 +1,2 @@
1
+ declare const decodeHTML: (html: string) => string;
2
+ export default decodeHTML;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const html_entities_1 = require("html-entities");
4
+ const decodeHTML = (html) => {
5
+ return isHTML(html) ? html : (0, html_entities_1.decode)(html);
6
+ };
7
+ const isHTML = (string) => {
8
+ const htmlPattern = /<\/?[a-z][\s\S]*>/i;
9
+ return htmlPattern.test(string);
10
+ };
11
+ exports.default = decodeHTML;
@@ -2,3 +2,4 @@ export { default as fetchRequest } from './fetchRequest';
2
2
  export { default as toIntArray } from './toIntArray';
3
3
  export { default as toQueryString } from './toQueryString';
4
4
  export { default as cdn } from './cdn';
5
+ export { default as decodeHTML } from './decodeHTML';
@@ -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.cdn = exports.toQueryString = exports.toIntArray = exports.fetchRequest = void 0;
6
+ exports.decodeHTML = exports.cdn = 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; } });
@@ -13,3 +13,5 @@ var toQueryString_1 = require("./toQueryString");
13
13
  Object.defineProperty(exports, "toQueryString", { enumerable: true, get: function () { return __importDefault(toQueryString_1).default; } });
14
14
  var cdn_1 = require("./cdn");
15
15
  Object.defineProperty(exports, "cdn", { enumerable: true, get: function () { return __importDefault(cdn_1).default; } });
16
+ var decodeHTML_1 = require("./decodeHTML");
17
+ Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return __importDefault(decodeHTML_1).default; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "3.7.9",
3
+ "version": "3.8.1",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -45,5 +45,7 @@
45
45
  "typescript",
46
46
  "nextemos"
47
47
  ],
48
- "dependencies": {}
48
+ "dependencies": {
49
+ "html-entities": "^2.5.2"
50
+ }
49
51
  }