@prezly/theme-kit-core 10.10.1 → 10.12.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.
@@ -0,0 +1,219 @@
1
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
2
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
3
+ import { createStackedCache } from "./stacked.mjs";
4
+ /** A layer that exposes `lookup`, with a spy on `set`. */
5
+ function layer(name) {
6
+ var entries = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
7
+ var store = new Map(Object.entries(entries));
8
+ var set = jest.fn(/*#__PURE__*/function () {
9
+ var _ref = _asyncToGenerator(function* (key, value, version, options) {
10
+ store.set(key, {
11
+ value,
12
+ version,
13
+ ttl: options === null || options === void 0 ? void 0 : options.ttl
14
+ });
15
+ });
16
+ return function (_x, _x2, _x3, _x4) {
17
+ return _ref.apply(this, arguments);
18
+ };
19
+ }());
20
+ var cache = {
21
+ get: (key, latestVersion) => {
22
+ var entry = store.get(key);
23
+ return entry && entry.version >= latestVersion ? entry.value : undefined;
24
+ },
25
+ lookup: (key, latestVersion) => {
26
+ var entry = store.get(key);
27
+ if (!entry || entry.version < latestVersion) return undefined;
28
+ return {
29
+ value: entry.value,
30
+ version: entry.version,
31
+ ttl: entry.ttl,
32
+ layer: name
33
+ };
34
+ },
35
+ set,
36
+ namespace() {
37
+ return cache;
38
+ }
39
+ };
40
+ return {
41
+ cache,
42
+ set,
43
+ store
44
+ };
45
+ }
46
+
47
+ /** A layer without `lookup`, as a third-party cache would be. */
48
+ function legacyLayer() {
49
+ var entries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
50
+ var store = new Map(Object.entries(entries));
51
+ var set = jest.fn(/*#__PURE__*/_asyncToGenerator(function* () {}));
52
+ var cache = {
53
+ get: (key, latestVersion, onSource) => {
54
+ var entry = store.get(key);
55
+ if (!entry || entry.version < latestVersion) return undefined;
56
+ onSource === null || onSource === void 0 || onSource('custom');
57
+ return entry.value;
58
+ },
59
+ set,
60
+ namespace() {
61
+ return cache;
62
+ }
63
+ };
64
+ return {
65
+ cache,
66
+ set
67
+ };
68
+ }
69
+ var flush = () => new Promise(resolve => setImmediate(resolve));
70
+ it('refills every earlier layer from a later hit with the entry version and retention', /*#__PURE__*/_asyncToGenerator(function* () {
71
+ var memory = layer('memory');
72
+ var redis = layer('redis', {
73
+ key: {
74
+ value: {
75
+ name: 'room'
76
+ },
77
+ version: 5
78
+ }
79
+ });
80
+ var stacked = createStackedCache([memory.cache, redis.cache]);
81
+ var sources = [];
82
+ expect(yield stacked.get('key', 3, source => sources.push(source))).toEqual({
83
+ name: 'room'
84
+ });
85
+ expect(sources).toEqual(['redis']);
86
+ yield flush();
87
+ expect(memory.set).toHaveBeenCalledWith('key', {
88
+ name: 'room'
89
+ }, 5, undefined);
90
+ expect(redis.set).not.toHaveBeenCalled();
91
+ sources.length = 0;
92
+ expect(yield stacked.get('key', 5, source => sources.push(source))).toEqual({
93
+ name: 'room'
94
+ });
95
+ expect(sources).toEqual(['memory']);
96
+ }));
97
+ it('carries a short retention into the refilled layer', /*#__PURE__*/_asyncToGenerator(function* () {
98
+ var memory = layer('memory');
99
+ var redis = layer('redis', {
100
+ missing: {
101
+ value: null,
102
+ version: 2,
103
+ ttl: 45
104
+ }
105
+ });
106
+ var stacked = createStackedCache([memory.cache, redis.cache]);
107
+ expect(yield stacked.get('missing', 2)).toBeNull();
108
+ yield flush();
109
+ expect(memory.set).toHaveBeenCalledWith('missing', null, 2, {
110
+ ttl: 45
111
+ });
112
+ }));
113
+ it('never refills from a stale entry or on a miss', /*#__PURE__*/_asyncToGenerator(function* () {
114
+ var memory = layer('memory');
115
+ var redis = layer('redis', {
116
+ key: {
117
+ value: 'old',
118
+ version: 1
119
+ }
120
+ });
121
+ var stacked = createStackedCache([memory.cache, redis.cache]);
122
+ expect(yield stacked.get('key', 2)).toBeUndefined();
123
+ expect(yield stacked.get('absent', 1)).toBeUndefined();
124
+ yield flush();
125
+ expect(memory.set).not.toHaveBeenCalled();
126
+ }));
127
+ it('treats an entry holding undefined as a miss and reads the next layer', /*#__PURE__*/_asyncToGenerator(function* () {
128
+ var memory = layer('memory', {
129
+ key: {
130
+ value: undefined,
131
+ version: 1
132
+ }
133
+ });
134
+ var redis = layer('redis', {
135
+ key: {
136
+ value: 'value',
137
+ version: 1
138
+ }
139
+ });
140
+ var stacked = createStackedCache([memory.cache, redis.cache]);
141
+ var sources = [];
142
+ expect(yield stacked.get('key', 1, source => sources.push(source))).toBe('value');
143
+ expect(sources).toEqual(['redis']);
144
+ }));
145
+ it('does not refill from a layer without lookup', /*#__PURE__*/_asyncToGenerator(function* () {
146
+ var memory = layer('memory');
147
+ var custom = legacyLayer({
148
+ key: {
149
+ value: 'custom value',
150
+ version: 1
151
+ }
152
+ });
153
+ var stacked = createStackedCache([memory.cache, custom.cache]);
154
+ var sources = [];
155
+ expect(yield stacked.get('key', 1, source => sources.push(source))).toBe('custom value');
156
+ expect(sources).toEqual(['custom']);
157
+ yield flush();
158
+ expect(memory.set).not.toHaveBeenCalled();
159
+ }));
160
+ it('withholds lookup when a layer cannot report hits, so nested stacks keep those hits', /*#__PURE__*/_asyncToGenerator(function* () {
161
+ var memory = layer('memory');
162
+ var custom = legacyLayer({
163
+ key: {
164
+ value: 'custom value',
165
+ version: 1
166
+ }
167
+ });
168
+ var inner = createStackedCache([memory.cache, custom.cache]);
169
+ expect(inner.lookup).toBeUndefined();
170
+ var outerMemory = layer('memory');
171
+ var outer = createStackedCache([outerMemory.cache, inner]);
172
+ var sources = [];
173
+ expect(yield outer.get('key', 1, source => sources.push(source))).toBe('custom value');
174
+ expect(sources).toEqual(['custom']);
175
+ yield flush();
176
+ expect(outerMemory.set).not.toHaveBeenCalled();
177
+ expect(createStackedCache([memory.cache, layer('redis').cache]).lookup).toBeDefined();
178
+ }));
179
+ it('returns the hit even when a refill write fails', /*#__PURE__*/_asyncToGenerator(function* () {
180
+ var memory = layer('memory');
181
+ memory.set.mockRejectedValue(new Error('memory full'));
182
+ var redis = layer('redis', {
183
+ key: {
184
+ value: 'value',
185
+ version: 1
186
+ }
187
+ });
188
+ var stacked = createStackedCache([memory.cache, redis.cache]);
189
+ yield expect(stacked.get('key', 1)).resolves.toBe('value');
190
+ yield flush();
191
+ expect(memory.set).toHaveBeenCalled();
192
+ }));
193
+ it('exposes lookup itself so stacks can nest, and writes through to all layers', /*#__PURE__*/_asyncToGenerator(function* () {
194
+ var _stacked$lookup;
195
+ var memory = layer('memory');
196
+ var redis = layer('redis', {
197
+ key: {
198
+ value: 'value',
199
+ version: 9,
200
+ ttl: 10
201
+ }
202
+ });
203
+ var stacked = createStackedCache([memory.cache, redis.cache]);
204
+ expect(yield (_stacked$lookup = stacked.lookup) === null || _stacked$lookup === void 0 ? void 0 : _stacked$lookup.call(stacked, 'key', 9)).toEqual({
205
+ value: 'value',
206
+ version: 9,
207
+ ttl: 10,
208
+ layer: 'redis'
209
+ });
210
+ yield stacked.set('other', 'written', 3, {
211
+ ttl: 5
212
+ });
213
+ expect(memory.set).toHaveBeenCalledWith('other', 'written', 3, {
214
+ ttl: 5
215
+ });
216
+ expect(redis.set).toHaveBeenCalledWith('other', 'written', 3, {
217
+ ttl: 5
218
+ });
219
+ }));
@@ -8,12 +8,28 @@ export interface SetOptions {
8
8
  */
9
9
  ttl?: Seconds;
10
10
  }
11
+ /**
12
+ * A validated entry with the metadata another layer needs to store it as is.
13
+ */
14
+ export interface Lookup<T> {
15
+ value: T;
16
+ version: UnixTimestampInSeconds;
17
+ /** Remaining or original short retention, when the entry has one. */
18
+ ttl?: Seconds;
19
+ layer: CacheLayer;
20
+ }
11
21
  export interface Cache {
12
22
  /**
13
23
  * Resolves `undefined` only when no entry exists (or it is stale).
14
24
  * A stored `null`, `false` or `0` is a valid hit and must be returned as is.
15
25
  */
16
26
  get<T>(key: string, latestVersion: UnixTimestampInSeconds, onSource?: (layer: CacheLayer) => void): Awaitable<T | undefined>;
27
+ /**
28
+ * Like `get`, but returns the entry's version and retention as well, so a
29
+ * stacked cache can refill an earlier layer without guessing. Layers that
30
+ * do not implement it are read with `get` and never used as a refill source.
31
+ */
32
+ lookup?<T>(key: string, latestVersion: UnixTimestampInSeconds): Awaitable<Lookup<T> | undefined>;
17
33
  set<T>(key: string, value: T, version: UnixTimestampInSeconds, options?: SetOptions): Awaitable<void>;
18
34
  namespace(namespace: string): Cache;
19
35
  }
@@ -130,8 +130,9 @@ function _generateCategoriesEntries() {
130
130
  categories = context.categories,
131
131
  generateUrl = context.generateUrl;
132
132
  var entries = categories.flatMap(category => _sdk.Category.translations(category).filter(_ref6 => {
133
- var locale = _ref6.locale;
134
- return locales.includes(locale);
133
+ var locale = _ref6.locale,
134
+ public_stories_number = _ref6.public_stories_number;
135
+ return locales.includes(locale) && public_stories_number !== 0;
135
136
  }).map(translation => {
136
137
  var params = _objectSpread(_objectSpread({}, translation), {}, {
137
138
  localeCode: translation.locale
@@ -119,8 +119,9 @@ function _generateCategoriesEntries() {
119
119
  categories = context.categories,
120
120
  generateUrl = context.generateUrl;
121
121
  var entries = categories.flatMap(category => Category.translations(category).filter(_ref6 => {
122
- var locale = _ref6.locale;
123
- return locales.includes(locale);
122
+ var locale = _ref6.locale,
123
+ public_stories_number = _ref6.public_stories_number;
124
+ return locales.includes(locale) && public_stories_number !== 0;
124
125
  }).map(translation => {
125
126
  var params = _objectSpread(_objectSpread({}, translation), {}, {
126
127
  localeCode: translation.locale
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ var _generate = require("./generate.cjs");
4
+ var _stringify = require("./stringify.cjs");
5
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
6
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
+ function category(japaneseStories) {
14
+ return {
15
+ id: 1,
16
+ display_name: 'Contacts',
17
+ display_description: null,
18
+ stories_number: 5 + japaneseStories,
19
+ public_stories_number: 5 + japaneseStories,
20
+ image: null,
21
+ is_featured: false,
22
+ i18n: Object.fromEntries([['en', 'contacts', 3], ['fr', 'contacter', 2], ['ja_JP', 'contacts-ja', japaneseStories]].map(_ref => {
23
+ var _ref2 = _slicedToArray(_ref, 3),
24
+ code = _ref2[0],
25
+ slug = _ref2[1],
26
+ count = _ref2[2];
27
+ return [code, {
28
+ locale: {
29
+ code
30
+ },
31
+ name: 'Contacts',
32
+ description: null,
33
+ slug,
34
+ public_stories_number: count
35
+ }];
36
+ }))
37
+ };
38
+ }
39
+ function sitemap(value) {
40
+ var locales = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['en', 'fr', 'ja_JP'];
41
+ return (0, _generate.generate)({
42
+ categories: [value],
43
+ locales,
44
+ newsroom: {
45
+ public_galleries_number: 0
46
+ },
47
+ stories: [],
48
+ generateUrl: (route, params) => route === 'category' && 'slug' in params ? "https://example.com/".concat(params.localeCode, "/category/").concat(params.slug) : undefined
49
+ }, {
50
+ baseUrl: 'https://example.com'
51
+ });
52
+ }
53
+ describe('category sitemap entries', () => {
54
+ it('omits empty translations from both URL entries and alternate links', /*#__PURE__*/_asyncToGenerator(function* () {
55
+ var result = yield sitemap(category(0));
56
+ expect(result).toEqual([{
57
+ url: 'https://example.com/en/category/contacts',
58
+ priority: 0.8,
59
+ changeFrequency: 'weekly',
60
+ alternate: [{
61
+ lang: 'fr',
62
+ url: 'https://example.com/fr/category/contacter'
63
+ }]
64
+ }, {
65
+ url: 'https://example.com/fr/category/contacter',
66
+ priority: 0.8,
67
+ changeFrequency: 'weekly',
68
+ alternate: [{
69
+ lang: 'en',
70
+ url: 'https://example.com/en/category/contacts'
71
+ }]
72
+ }]);
73
+ expect((0, _stringify.stringify)(result)).not.toContain('/ja_JP/category/');
74
+ }));
75
+ it('includes a translation once it has a public story', /*#__PURE__*/_asyncToGenerator(function* () {
76
+ var result = yield sitemap(category(1));
77
+ expect(result.map(_ref5 => {
78
+ var url = _ref5.url;
79
+ return url;
80
+ })).toContain('https://example.com/ja_JP/category/contacts-ja');
81
+ expect(result[0].alternate).toContainEqual({
82
+ lang: 'ja-JP',
83
+ url: 'https://example.com/ja_JP/category/contacts-ja'
84
+ });
85
+ }));
86
+ it('omits missing and disabled translations', /*#__PURE__*/_asyncToGenerator(function* () {
87
+ var result = yield sitemap(category(1), ['en', 'de']);
88
+ expect(result).toEqual([{
89
+ url: 'https://example.com/en/category/contacts',
90
+ priority: 0.8,
91
+ changeFrequency: 'weekly',
92
+ alternate: []
93
+ }]);
94
+ }));
95
+ it('omits a category when every enabled translation is empty', /*#__PURE__*/_asyncToGenerator(function* () {
96
+ expect(yield sitemap(category(0), ['ja_JP'])).toEqual([]);
97
+ }));
98
+ });
@@ -0,0 +1,96 @@
1
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
2
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
3
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
6
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
9
+ import { generate } from "./generate.mjs";
10
+ import { stringify } from "./stringify.mjs";
11
+ function category(japaneseStories) {
12
+ return {
13
+ id: 1,
14
+ display_name: 'Contacts',
15
+ display_description: null,
16
+ stories_number: 5 + japaneseStories,
17
+ public_stories_number: 5 + japaneseStories,
18
+ image: null,
19
+ is_featured: false,
20
+ i18n: Object.fromEntries([['en', 'contacts', 3], ['fr', 'contacter', 2], ['ja_JP', 'contacts-ja', japaneseStories]].map(_ref => {
21
+ var _ref2 = _slicedToArray(_ref, 3),
22
+ code = _ref2[0],
23
+ slug = _ref2[1],
24
+ count = _ref2[2];
25
+ return [code, {
26
+ locale: {
27
+ code
28
+ },
29
+ name: 'Contacts',
30
+ description: null,
31
+ slug,
32
+ public_stories_number: count
33
+ }];
34
+ }))
35
+ };
36
+ }
37
+ function sitemap(value) {
38
+ var locales = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['en', 'fr', 'ja_JP'];
39
+ return generate({
40
+ categories: [value],
41
+ locales,
42
+ newsroom: {
43
+ public_galleries_number: 0
44
+ },
45
+ stories: [],
46
+ generateUrl: (route, params) => route === 'category' && 'slug' in params ? "https://example.com/".concat(params.localeCode, "/category/").concat(params.slug) : undefined
47
+ }, {
48
+ baseUrl: 'https://example.com'
49
+ });
50
+ }
51
+ describe('category sitemap entries', () => {
52
+ it('omits empty translations from both URL entries and alternate links', /*#__PURE__*/_asyncToGenerator(function* () {
53
+ var result = yield sitemap(category(0));
54
+ expect(result).toEqual([{
55
+ url: 'https://example.com/en/category/contacts',
56
+ priority: 0.8,
57
+ changeFrequency: 'weekly',
58
+ alternate: [{
59
+ lang: 'fr',
60
+ url: 'https://example.com/fr/category/contacter'
61
+ }]
62
+ }, {
63
+ url: 'https://example.com/fr/category/contacter',
64
+ priority: 0.8,
65
+ changeFrequency: 'weekly',
66
+ alternate: [{
67
+ lang: 'en',
68
+ url: 'https://example.com/en/category/contacts'
69
+ }]
70
+ }]);
71
+ expect(stringify(result)).not.toContain('/ja_JP/category/');
72
+ }));
73
+ it('includes a translation once it has a public story', /*#__PURE__*/_asyncToGenerator(function* () {
74
+ var result = yield sitemap(category(1));
75
+ expect(result.map(_ref5 => {
76
+ var url = _ref5.url;
77
+ return url;
78
+ })).toContain('https://example.com/ja_JP/category/contacts-ja');
79
+ expect(result[0].alternate).toContainEqual({
80
+ lang: 'ja-JP',
81
+ url: 'https://example.com/ja_JP/category/contacts-ja'
82
+ });
83
+ }));
84
+ it('omits missing and disabled translations', /*#__PURE__*/_asyncToGenerator(function* () {
85
+ var result = yield sitemap(category(1), ['en', 'de']);
86
+ expect(result).toEqual([{
87
+ url: 'https://example.com/en/category/contacts',
88
+ priority: 0.8,
89
+ changeFrequency: 'weekly',
90
+ alternate: []
91
+ }]);
92
+ }));
93
+ it('omits a category when every enabled translation is empty', /*#__PURE__*/_asyncToGenerator(function* () {
94
+ expect(yield sitemap(category(0), ['ja_JP'])).toEqual([]);
95
+ }));
96
+ });
package/package.json CHANGED
@@ -1,73 +1,75 @@
1
1
  {
2
- "name": "@prezly/theme-kit-core",
3
- "version": "10.10.1",
4
- "description": "Data layer and utility library for developing Prezly themes with JavaScript",
5
- "main": "build/index.mjs",
6
- "type": "module",
7
- "types": "build/index.d.ts",
8
- "files": [
9
- "build",
10
- "README.md"
11
- ],
12
- "exports": {
13
- ".": {
14
- "types": "./build/index.d.ts",
15
- "require": "./build/index.cjs",
16
- "default": "./build/index.mjs"
17
- }
18
- },
19
- "peerDependencies": {
20
- "@prezly/sdk": "21.12.0 || ^23.x"
21
- },
22
- "dependencies": {
23
- "@prezly/uploadcare": "2.4.4",
24
- "@technically/is-not-undefined": "^1.0.0",
25
- "@technically/omit-undefined": "^1.0.4",
26
- "parse-data-url": "^6.0.0",
27
- "url-pattern": "^1.0.3",
28
- "@prezly/theme-kit-intl": "^10.9.1"
29
- },
30
- "devDependencies": {
31
- "@types/parse-data-url": "3.0.2"
32
- },
33
- "engines": {
34
- "node": ">= 16.x",
35
- "npm": ">= 8.x"
36
- },
37
- "keywords": [
38
- "prezly"
39
- ],
40
- "author": "Prezly Team",
41
- "license": "MIT",
42
- "bugs": {
43
- "url": "https://github.com/prezly/theme-kit-js/issues"
44
- },
45
- "homepage": "https://github.com/prezly/theme-kit-js/tree/main/packages/core#readme",
46
- "repository": {
47
- "type": "git",
48
- "url": "git+https://github.com/prezly/theme-kit-js.git",
49
- "directory": "packages/core"
50
- },
51
- "publishConfig": {
52
- "access": "public"
53
- },
54
- "scripts": {
55
- "prebuild": "rimraf --glob build/* *.tsbuildinfo",
56
- "build": "pnpm build:types && pnpm build:esm && pnpm build:cjs",
57
- "build:types": "tsc --project .",
58
- "build:esm": "babel --config-file=../../babel.esm.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.mjs",
59
- "build:cjs": "babel --config-file=../../babel.cjs.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.cjs",
60
- "dev": "tsc --watch --preserveWatchOutput --project .",
61
- "typecheck": "tsc --noEmit --emitDeclarationOnly false --incremental --project .",
62
- "lint": "biome lint src",
63
- "lint:fix": "biome lint --write src",
64
- "format": "biome format src",
65
- "format:fix": "biome format --write src",
66
- "test": "pnpm test:unit && pnpm test:build",
67
- "test:unit": "jest",
68
- "test:build": "pnpm test:build:cjs && pnpm test:build:esm && pnpm test:build:types",
69
- "test:build:types": "tsc --esModuleInterop --noEmit --target esnext --moduleResolution node build/index.d.ts",
70
- "test:build:esm": "node tests/test-build.mjs",
71
- "test:build:cjs": "node tests/test-build.cjs"
72
- }
73
- }
2
+ "name": "@prezly/theme-kit-core",
3
+ "version": "10.12.0",
4
+ "description": "Data layer and utility library for developing Prezly themes with JavaScript",
5
+ "main": "build/index.mjs",
6
+ "type": "module",
7
+ "types": "build/index.d.ts",
8
+ "files": [
9
+ "build",
10
+ "README.md"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./build/index.d.ts",
15
+ "require": "./build/index.cjs",
16
+ "default": "./build/index.mjs"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "prepack": "pnpm test:build",
21
+ "prebuild": "rimraf --glob build/* *.tsbuildinfo",
22
+ "build": "pnpm build:types && pnpm build:esm && pnpm build:cjs",
23
+ "build:types": "tsc --project .",
24
+ "build:esm": "babel --config-file=../../babel.esm.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.mjs",
25
+ "build:cjs": "babel --config-file=../../babel.cjs.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.cjs",
26
+ "dev": "tsc --watch --preserveWatchOutput --project .",
27
+ "typecheck": "tsc --noEmit --emitDeclarationOnly false --incremental --project .",
28
+ "lint": "biome lint src",
29
+ "lint:fix": "biome lint --write src",
30
+ "format": "biome format src",
31
+ "format:fix": "biome format --write src",
32
+ "test": "pnpm test:unit && pnpm test:build",
33
+ "test:unit": "jest",
34
+ "test:build": "pnpm test:build:cjs && pnpm test:build:esm && pnpm test:build:types",
35
+ "test:build:types": "tsc --esModuleInterop --noEmit --target esnext --moduleResolution node build/index.d.ts",
36
+ "test:build:esm": "node tests/test-build.mjs",
37
+ "test:build:cjs": "node tests/test-build.cjs"
38
+ },
39
+ "peerDependencies": {
40
+ "@prezly/sdk": "21.12.0 || ^23.x"
41
+ },
42
+ "dependencies": {
43
+ "@prezly/theme-kit-intl": "^10.12.0",
44
+ "@prezly/uploadcare": "2.4.4",
45
+ "@technically/is-not-undefined": "^1.0.0",
46
+ "@technically/omit-undefined": "^1.0.4",
47
+ "parse-data-url": "^6.0.0",
48
+ "url-pattern": "^1.0.3"
49
+ },
50
+ "devDependencies": {
51
+ "@types/parse-data-url": "3.0.2"
52
+ },
53
+ "engines": {
54
+ "node": ">= 16.x",
55
+ "npm": ">= 8.x"
56
+ },
57
+ "keywords": [
58
+ "prezly"
59
+ ],
60
+ "author": "Prezly Team",
61
+ "license": "MIT",
62
+ "bugs": {
63
+ "url": "https://github.com/prezly/theme-kit-js/issues"
64
+ },
65
+ "homepage": "https://github.com/prezly/theme-kit-js/tree/main/packages/core#readme",
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "git+https://github.com/prezly/theme-kit-js.git",
69
+ "directory": "packages/core"
70
+ },
71
+ "publishConfig": {
72
+ "access": "public"
73
+ },
74
+ "gitHead": "aa8fe2c8311ddf0c5aa2329da15e086b12a81d96"
75
+ }