@prezly/theme-kit-core 10.5.4 → 10.6.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/build/routing/Route.cjs
CHANGED
|
@@ -35,10 +35,14 @@ var Route;
|
|
|
35
35
|
return matched;
|
|
36
36
|
},
|
|
37
37
|
generate(params) {
|
|
38
|
+
var encoded = Object.fromEntries(Object.entries(params !== null && params !== void 0 ? params : {}).map(_ref => {
|
|
39
|
+
var [key, value] = _ref;
|
|
40
|
+
return [key, typeof value === 'string' ? encodeURIComponent(value) : value];
|
|
41
|
+
}));
|
|
38
42
|
if (generate) {
|
|
39
|
-
return (0, _index.normalizeUrl)(generate(urlPattern,
|
|
43
|
+
return (0, _index.normalizeUrl)(generate(urlPattern, encoded));
|
|
40
44
|
}
|
|
41
|
-
return (0, _index.normalizeUrl)(urlPattern.stringify(
|
|
45
|
+
return (0, _index.normalizeUrl)(urlPattern.stringify(encoded));
|
|
42
46
|
},
|
|
43
47
|
rewrite(params) {
|
|
44
48
|
return rewritePattern.stringify(params);
|
package/build/routing/Route.mjs
CHANGED
|
@@ -28,10 +28,14 @@ export var Route;
|
|
|
28
28
|
return matched;
|
|
29
29
|
},
|
|
30
30
|
generate(params) {
|
|
31
|
+
var encoded = Object.fromEntries(Object.entries(params !== null && params !== void 0 ? params : {}).map(_ref => {
|
|
32
|
+
var [key, value] = _ref;
|
|
33
|
+
return [key, typeof value === 'string' ? encodeURIComponent(value) : value];
|
|
34
|
+
}));
|
|
31
35
|
if (generate) {
|
|
32
|
-
return normalizeUrl(generate(urlPattern,
|
|
36
|
+
return normalizeUrl(generate(urlPattern, encoded));
|
|
33
37
|
}
|
|
34
|
-
return normalizeUrl(urlPattern.stringify(
|
|
38
|
+
return normalizeUrl(urlPattern.stringify(encoded));
|
|
35
39
|
},
|
|
36
40
|
rewrite(params) {
|
|
37
41
|
return rewritePattern.stringify(params);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Route = require("./Route.cjs");
|
|
4
|
+
describe('generate()', () => {
|
|
5
|
+
it('should generate URLs with non-ascii characters', () => {
|
|
6
|
+
var route = _Route.Route.create('/:slug', '/');
|
|
7
|
+
expect(route.generate({
|
|
8
|
+
slug: '年春夏コレクション'
|
|
9
|
+
})).toBe('/%E5%B9%B4%E6%98%A5%E5%A4%8F%E3%82%B3%E3%83%AC%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3');
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Route } from "./Route.mjs";
|
|
2
|
+
describe('generate()', () => {
|
|
3
|
+
it('should generate URLs with non-ascii characters', () => {
|
|
4
|
+
var route = Route.create('/:slug', '/');
|
|
5
|
+
expect(route.generate({
|
|
6
|
+
slug: '年春夏コレクション'
|
|
7
|
+
})).toBe('/%E5%B9%B4%E6%98%A5%E5%A4%8F%E3%82%B3%E3%83%AC%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3');
|
|
8
|
+
});
|
|
9
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prezly/theme-kit-core",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.6.2",
|
|
4
4
|
"description": "Data layer and utility library for developing Prezly themes with JavaScript",
|
|
5
5
|
"main": "build/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@prezly/sdk": "21.12.0 || ^23.x"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@prezly/theme-kit-intl": "^10.
|
|
42
|
+
"@prezly/theme-kit-intl": "^10.6.2",
|
|
43
43
|
"@prezly/uploadcare": "2.4.4",
|
|
44
44
|
"@technically/is-not-undefined": "^1.0.0",
|
|
45
45
|
"@technically/omit-undefined": "^1.0.4",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "77511a82856d54a31c84d45636600d104b28e395"
|
|
78
78
|
}
|