@uxf/resizer 11.11.3 → 11.32.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.
package/index.js CHANGED
@@ -58,8 +58,8 @@ const getQuality = ({ quality }) => (quality && quality !== "x" ? Number(quality
58
58
  const getWidth = ({ width }) => (width && width !== "x" ? Number(width) : undefined);
59
59
  const getHeight = ({ height }) => (height && height !== "x" ? Number(height) : undefined);
60
60
  const getBackground = ({ background }) => background === undefined ? undefined : background === "t" ? "transparent" : `#${background}`;
61
- const getFit = ({ fit }) => { var _a; return (fit ? (_a = FIT_OPTIONS[fit]) !== null && _a !== void 0 ? _a : "cover" : "cover"); };
62
- const getPosition = ({ position }) => { var _a; return (position ? (_a = POSITION_OPTIONS[position]) !== null && _a !== void 0 ? _a : "centre" : undefined); };
61
+ const getFit = ({ fit }) => { var _a; return (fit ? ((_a = FIT_OPTIONS[fit]) !== null && _a !== void 0 ? _a : "cover") : "cover"); };
62
+ const getPosition = ({ position }) => { var _a; return (position ? ((_a = POSITION_OPTIONS[position]) !== null && _a !== void 0 ? _a : "centre") : undefined); };
63
63
  const getWithoutEnlargement = ({ extension }) => extension !== "svg";
64
64
  const getTrim = ({ trim }) => (trim === undefined || trim === "nt" ? undefined : Number(trim));
65
65
  const resizerMiddleware = (config) => {
package/index.ts CHANGED
@@ -38,8 +38,8 @@ const getWidth = ({ width }: any) => (width && width !== "x" ? Number(width) : u
38
38
  const getHeight = ({ height }: any) => (height && height !== "x" ? Number(height) : undefined);
39
39
  const getBackground = ({ background }: any) =>
40
40
  background === undefined ? undefined : background === "t" ? "transparent" : `#${background}`;
41
- const getFit = ({ fit }: any): keyof FitEnum => (fit ? FIT_OPTIONS[fit] ?? "cover" : "cover");
42
- const getPosition = ({ position }: any) => (position ? POSITION_OPTIONS[position] ?? "centre" : undefined);
41
+ const getFit = ({ fit }: any): keyof FitEnum => (fit ? (FIT_OPTIONS[fit] ?? "cover") : "cover");
42
+ const getPosition = ({ position }: any) => (position ? (POSITION_OPTIONS[position] ?? "centre") : undefined);
43
43
  const getWithoutEnlargement = ({ extension }: any) => extension !== "svg";
44
44
  const getTrim = ({ trim }: any) => (trim === undefined || trim === "nt" ? undefined : Number(trim));
45
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/resizer",
3
- "version": "11.11.3",
3
+ "version": "11.32.0",
4
4
  "main": "index.js",
5
5
  "description": "UXF Resizer",
6
6
  "author": "UXFans <dev@uxf.cz>",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
- "express": "4.18.3",
20
- "path-to-regexp": "6.2.1",
19
+ "express": "4.19.2",
20
+ "path-to-regexp": "6.2.2",
21
21
  "process": "0.11.10",
22
22
  "sharp": "0.32.6",
23
23
  "yargs": "17.7.2"
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSourceFilename = void 0;
3
+ exports.getSourceFilename = getSourceFilename;
4
4
  const path_to_regexp_1 = require("path-to-regexp");
5
5
  const log_1 = require("./log");
6
6
  const parse_http_source_1 = require("./parse-http-source");
@@ -19,4 +19,3 @@ function getSourceFilename(source, params) {
19
19
  }
20
20
  return (0, path_to_regexp_1.compile)(source, {})(repairedParams);
21
21
  }
22
- exports.getSourceFilename = getSourceFilename;
package/utils/log.js CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.log = void 0;
3
+ exports.log = log;
4
4
  function log(message) {
5
5
  // eslint-disable-next-line no-console
6
6
  console.log(message);
7
7
  }
8
- exports.log = log;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseHttpSource = void 0;
3
+ exports.parseHttpSource = parseHttpSource;
4
4
  function parseHttpSource(source) {
5
5
  var _a;
6
- return (_a = /^(?<protocol>http|https):\/\/(?<domain>.*)\/(?<path>.*)$/.exec(source)) === null || _a === void 0 ? void 0 : _a.groups;
6
+ return (_a = /^(?<protocol>http|https):\/\/(?<domain>[^/]*)\/(?<path>.*)$/.exec(source)) === null || _a === void 0 ? void 0 : _a.groups;
7
7
  }
8
- exports.parseHttpSource = parseHttpSource;
@@ -12,6 +12,11 @@ test("parse source", () => {
12
12
  domain: "localhost:3000",
13
13
  path: ":filename+.:extension",
14
14
  });
15
+ expect((0, parse_http_source_1.parseHttpSource)("http://localhost:3000/test/:filename+.:extension")).toEqual({
16
+ protocol: "http",
17
+ domain: "localhost:3000",
18
+ path: "test/:filename+.:extension",
19
+ });
15
20
  expect((0, parse_http_source_1.parseHttpSource)("https://:url/:filename+.:extension")).toEqual({
16
21
  protocol: "https",
17
22
  domain: ":url",
@@ -11,6 +11,11 @@ test("parse source", () => {
11
11
  domain: "localhost:3000",
12
12
  path: ":filename+.:extension",
13
13
  });
14
+ expect(parseHttpSource("http://localhost:3000/test/:filename+.:extension")).toEqual({
15
+ protocol: "http",
16
+ domain: "localhost:3000",
17
+ path: "test/:filename+.:extension",
18
+ });
14
19
  expect(parseHttpSource("https://:url/:filename+.:extension")).toEqual({
15
20
  protocol: "https",
16
21
  domain: ":url",
@@ -5,5 +5,5 @@ interface Result {
5
5
  }
6
6
 
7
7
  export function parseHttpSource(source: string): Result | undefined {
8
- return /^(?<protocol>http|https):\/\/(?<domain>.*)\/(?<path>.*)$/.exec(source)?.groups as Result | undefined;
8
+ return /^(?<protocol>http|https):\/\/(?<domain>[^/]*)\/(?<path>.*)$/.exec(source)?.groups as Result | undefined;
9
9
  }