astro-accelerator 0.3.14 → 0.3.15

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.14",
2
+ "version": "0.3.15",
3
3
  "author": "Steve Fenton",
4
4
  "name": "astro-accelerator",
5
5
  "description": "A super-lightweight, accessible, SEO-friendly starter project for Astro",
@@ -227,15 +227,21 @@ var dataUrl = qs('#site-search').dataset.sourcedata;
227
227
  var ready = false;
228
228
  var scrolled = false;
229
229
 
230
- var synonyms = {};
230
+ var _synonyms = null;
231
231
 
232
232
  async function getSynonyms() {
233
+ if (_synonyms != null) {
234
+ return _synonyms;
235
+ }
236
+
233
237
  try {
234
238
  const synonymsModule = await import('./synonyms.js');
235
- synonyms =synonymsModule.synonyms;
239
+ _synonyms =synonymsModule.synonyms;
236
240
  } catch {
237
- synonyms = {};
241
+ _synonyms = {};
238
242
  }
243
+
244
+ return _synonyms;
239
245
  }
240
246
 
241
247
  /**
@@ -243,6 +249,8 @@ async function getSynonyms() {
243
249
  * @param {string[]} queryTerms
244
250
  */
245
251
  function replaceSynonyms(queryTerms) {
252
+ const synonyms = getSynonyms();
253
+
246
254
  for (let i = 0; i < queryTerms.length; i++) {
247
255
  const term = queryTerms[i];
248
256
  if (synonyms[term] != null) {