@alpaca-headless/alpaca-headless 1.0.511 → 1.0.516

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.
@@ -123,7 +123,7 @@ function getSourceAttrs(variants, params, isEditMode, mediaQuery, defaultParams)
123
123
  }
124
124
  function getSourceSet(variant, params, maxWidth, scales) {
125
125
  if (!scales || scales.length === 0) {
126
- const scaledImage = getScaledImage(variant, params);
126
+ const scaledImage = getScaledImage(variant, params, maxWidth);
127
127
  const srcSet = hashImageUrl(scaledImage.src);
128
128
  return srcSet;
129
129
  }
@@ -5,8 +5,7 @@ export async function loadDictionary(siteName, language, mode, apiConfig) {
5
5
  const cacheKey = siteName + "_#_" + language;
6
6
  if (mode !== "edit" &&
7
7
  dictionaryCache[cacheKey] &&
8
- dictionaryCache[cacheKey].timestamp <
9
- new Date(Date.now() + cacheExpirationTime)) {
8
+ dictionaryCache[cacheKey].timestamp.getTime() + cacheExpirationTime > Date.now()) {
10
9
  return dictionaryCache[cacheKey].dictionary;
11
10
  }
12
11
  let url = "/alpaca/headless/dictionary" +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpaca-headless/alpaca-headless",
3
- "version": "1.0.511",
3
+ "version": "1.0.516",
4
4
  "type": "module",
5
5
  "description": "Alpaca Headless",
6
6
  "main": "dist/index.js",
@@ -234,7 +234,7 @@ function getSourceSet(
234
234
  scales?: number[]
235
235
  ) {
236
236
  if (!scales || scales.length === 0) {
237
- const scaledImage = getScaledImage(variant, params);
237
+ const scaledImage = getScaledImage(variant, params, maxWidth);
238
238
  const srcSet = hashImageUrl(scaledImage.src);
239
239
  return srcSet;
240
240
  }
@@ -21,8 +21,7 @@ export async function loadDictionary(
21
21
  if (
22
22
  mode !== "edit" &&
23
23
  dictionaryCache[cacheKey] &&
24
- dictionaryCache[cacheKey].timestamp <
25
- new Date(Date.now() + cacheExpirationTime)
24
+ dictionaryCache[cacheKey].timestamp.getTime() + cacheExpirationTime > Date.now()
26
25
  ) {
27
26
  return dictionaryCache[cacheKey].dictionary;
28
27
  }