Skip to content

Commit 3068c09

Browse files
authored
Merge pull request #222 from nuxt-modules/chore/1.11.0
chore: 1.11.0
2 parents 6a8f4f7 + a152147 commit 3068c09

File tree

16 files changed

+3082
-2456
lines changed

16 files changed

+3082
-2456
lines changed

docs/content/1.getting-started/2.configuration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ Defaults:
5151
secret: 'INDEXER_SECRET',
5252
algoliaAdminApiKey: 'ALGOLIA_ADMIN_KEY',
5353
indexName: 'ALGOLIA_INDEX_NAME',
54-
accessToken: 'STORYBLOK_ACCESS_TOKEN'
54+
accessToken: 'STORYBLOK_ACCESS_TOKEN',
55+
contentVersion: 'draft'
5556
}
5657
}
5758
}

docs/content/2.advanced/3.indexer.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export default defineNuxtConfig({
2424
secret: process.env.INDEXER_SECRET,
2525
algoliaAdminApiKey: process.env.ALGOLIA_ADMIN_KEY,
2626
indexName: process.env.ALGOLIA_INDEX_NAME,
27-
accessToken: process.env.STORYBLOK_ACCESS_TOKEN
27+
accessToken: process.env.STORYBLOK_ACCESS_TOKEN,
28+
contentVersion: process.env.STORYBLOK_CONTENT_VERSION
2829
}
2930
}
3031
})

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nuxtjs/algolia",
3-
"version": "1.10.2",
3+
"version": "1.11.2",
44
"description": "Algolia module for Nuxt",
55
"repository": {
66
"type": "git",
@@ -38,10 +38,14 @@
3838
"@algolia/cache-in-memory": "^4.14.2",
3939
"@algolia/recommend": "^4.12.2",
4040
"@algolia/requester-fetch": "^4.23.2",
41+
"@algolia/requester-node-http": "^5.21.0",
4142
"@nuxt/kit": "^3.7.0",
4243
"algoliasearch": "^4.11.0",
44+
"defu": "^6.1.4",
45+
"exsolve": "^1.0.4",
4346
"instantsearch.css": "^7.4.5",
4447
"metadata-scraper": "^0.2.49",
48+
"mocked-exports": "^0.1.1",
4549
"storyblok-algolia-indexer": "^1.1.0",
4650
"vue-instantsearch": "^4.3.2"
4751
},
@@ -51,7 +55,7 @@
5155
"@nuxt/module-builder": "latest",
5256
"@nuxtjs/eslint-config-typescript": "latest",
5357
"eslint": "latest",
54-
"nuxt": "^3.8.0",
58+
"nuxt": "^3.16.0",
5559
"standard-version": "^9.3.2",
5660
"typescript": "^5.2.2"
5761
},
@@ -70,5 +74,6 @@
7074
"docsearch",
7175
"nuxt",
7276
"module"
73-
]
77+
],
78+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
7479
}

playground/nuxt.config.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import AlgoliaModule from '..'
2-
31
export default defineNuxtConfig({
42
modules: [
5-
AlgoliaModule
3+
'../src/module'
64
],
5+
76
nitro: {
87
prerender: {
98
crawlLinks: true
@@ -14,9 +13,10 @@ export default defineNuxtConfig({
1413
}
1514
}
1615
},
16+
1717
algolia: {
18-
apiKey: process.env.ALGOLIA_API_KEY ?? '599cec31baffa4868cae4e79f180729b',
19-
applicationId: process.env.ALGOLIA_APPLICATION_ID ?? 'R2IYF7ETH7',
18+
apiKey: process.env.ALGOLIA_API_KEY ?? '0fd1c4eba2f831788333e77c9d855f1d',
19+
applicationId: process.env.ALGOLIA_APPLICATION_ID ?? 'AGN9HUEKF3',
2020
lite: false, // by default set to 'true'
2121
cache: true,
2222
docSearch: {
@@ -31,12 +31,15 @@ export default defineNuxtConfig({
3131
secret: process.env.INDEXER_SECRET,
3232
algoliaAdminApiKey: process.env.ALGOLIA_ADMIN_KEY,
3333
indexName: process.env.ALGOLIA_INDEX_NAME,
34-
accessToken: process.env.STORYBLOK_ACCESS_TOKEN
34+
accessToken: process.env.STORYBLOK_ACCESS_TOKEN,
35+
contentVersion: process.env.STORYBLOK_CONTENT_VERSION
3536
}
3637
},
3738
crawler: {
3839
apiKey: process.env.ALGOLIA_CRAWLER_API_KEY,
3940
indexName: process.env.ALGOLIA_CRAWLER_INDEX_NAME
4041
}
41-
}
42-
})
42+
},
43+
44+
compatibilityDate: '2025-03-19'
45+
})

playground/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</template>
2323

2424
<script lang="ts" setup>
25-
import { useSeoMeta } from '@unhead/vue'
25+
import { useSeoMeta } from '#imports'
2626
import { AisInstantSearch, AisSearchBox, AisHits } from 'vue-instantsearch/vue3/es'
2727
// Used to try the refresh of the component on options changes
2828
const indexName = ref('test_index')

playground/pages/other-page.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { useSeoMeta } from '@unhead/vue'
2+
import { useSeoMeta } from '#imports'
33
44
useHead({
55
title: 'Other Page'

renovate.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
23
"extends": [
3-
"@nuxtjs"
4+
"github>nuxt/renovate-config-nuxt"
45
]
5-
}
6+
}

src/module.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { defu } from 'defu'
55
import { createPageGenerateHook, createGenerateDoneHook } from './hooks'
66
import type { CrawlerPage, CrawlerHooks, CrawlerOptions } from './hooks'
77
import { InstantSearchThemes, type ModuleBaseOptions } from './types'
8+
import { resolveModulePath } from 'exsolve'
89

910
const MODULE_NAME = '@nuxtjs/algolia'
1011
const logger = useLogger(MODULE_NAME)
@@ -26,7 +27,7 @@ export default defineNuxtModule<ModuleOptions>({
2627
name: '@nuxtjs/algolia',
2728
configKey: 'algolia',
2829
compatibility: {
29-
nuxt: '^3.0.0-rc.9 || ^2.16.0',
30+
nuxt: '>=3.0.0-rc.9 || ^2.16.0',
3031
bridge: true
3132
}
3233
},
@@ -52,12 +53,9 @@ export default defineNuxtModule<ModuleOptions>({
5253

5354
const notRunningInPrepareScript = !nuxt.options._prepare
5455

55-
if (!options.apiKey && notRunningInPrepareScript) {
56-
throwError('Missing `apiKey`')
57-
}
58-
59-
if (!options.applicationId && notRunningInPrepareScript) {
60-
throwError('Missing `applicationId`')
56+
if (notRunningInPrepareScript && (!options.apiKey || !options.applicationId)) {
57+
console.warn('Missing `apiKey` or `applicationId` in `nuxt.config.js`')
58+
return
6159
}
6260

6361
if (options.crawler!.apiKey || options.crawler!.indexName) {
@@ -76,7 +74,7 @@ export default defineNuxtModule<ModuleOptions>({
7674

7775
if (isNuxt2(nuxt)) {
7876
nuxt.addHooks({
79-
// @ts-expect-error Nuxt 2 only hook
77+
// Nuxt 2 only hook
8078
'generate:page': createPageGenerateHook(nuxt, options, pages),
8179
'generate:done': createGenerateDoneHook(nuxt, options, pages)
8280
})
@@ -120,7 +118,7 @@ export default defineNuxtModule<ModuleOptions>({
120118
})
121119
}
122120
// Nuxt 3
123-
// @ts-expect-error TODO: Workaround for rc.14 only
121+
// Workaround for rc.14 only
124122
nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {}
125123
// @ts-ignore
126124
nuxt.options.runtimeConfig.public.algolia = defu(nuxt.options.runtimeConfig.algolia, {
@@ -153,8 +151,7 @@ export default defineNuxtModule<ModuleOptions>({
153151
// Polyfilling server packages for SSR support
154152
nuxt.hook('vite:extendConfig', (config, { isClient }) => {
155153
if (isClient) {
156-
(config as any).resolve.alias['@algolia/requester-node-http'] =
157-
'unenv/runtime/mock/empty'
154+
(config as any).resolve.alias['@algolia/requester-node-http'] = resolveModulePath('mocked-exports/empty', { from: import.meta.url })
158155
}
159156
})
160157

src/runtime/composables/useAlgoliaFacetedSearch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { computed } from 'vue'
33
import type { SearchForFacetValuesResponse } from '@algolia/client-search'
44
import type { ComputedRef } from 'vue'
5-
import { AlgoliaIndices, RequestOptionsObject } from '../../types'
5+
import type { AlgoliaIndices, RequestOptionsObject } from '../../types'
66
import { useAlgoliaInitIndex } from './useAlgoliaInitIndex'
77
import { useState } from '#imports'
88

src/runtime/composables/useAlgoliaRecommend.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { RecommendationsQuery, RecommendClient } from '@algolia/recommend'
2-
import { ComputedRef, computed } from 'vue'
3-
import { RequestOptionsObject, SearchResponse } from '../../types'
1+
import type { RecommendationsQuery, RecommendClient } from '@algolia/recommend'
2+
import { type ComputedRef, computed } from 'vue'
3+
import type { RequestOptionsObject, SearchResponse } from '../../types'
44
import { useNuxtApp, useState } from '#imports'
55

66
export type RecommendParams = { queries: RecommendationsQuery[] } & RequestOptionsObject

0 commit comments

Comments
 (0)