Skip to content

Commit

Permalink
fix: support user source fetch shorthand
Browse files Browse the repository at this point in the history
Fixes #215
  • Loading branch information
harlan-zw committed Jan 16, 2024
1 parent 9615385 commit 52104bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ declare module 'vue-router' {
}
const globalSources: SitemapSourceInput[] = [
...userGlobalSources.map((s) => {
if (typeof s === 'string') {
return <SitemapSourceBase>{
if (typeof s === 'string' || Array.isArray(s)) {
return <SitemapSourceBase> {
sourceType: 'user',
fetch: s,
}
Expand Down Expand Up @@ -616,7 +616,7 @@ declare module 'vue-router' {
})
sitemapSources[sitemapName].push(...(definition.sources || [])
.map((s) => {
if (typeof s === 'string') {
if (typeof s === 'string' || Array.isArray(s)) {
return <SitemapSourceBase> {
sourceType: 'user',
fetch: s,
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export interface SitemapSourceResolved extends Omit<SitemapSourceBase, 'urls'> {

export type AppSourceContext = 'nuxt:pages' | 'nuxt:prerender' | 'nuxt:route-rules' | '@nuxtjs/i18n:pages' | '@nuxt/content:document-driven'

export type SitemapSourceInput = string | SitemapSourceBase | SitemapSourceResolved
export type SitemapSourceInput = string | [string, FetchOptions] | SitemapSourceBase | SitemapSourceResolved

export type NormalisedLocales = { code: string, iso?: string, domain?: string }[]
export interface AutoI18nConfig {
Expand All @@ -190,7 +190,7 @@ export interface AutoI18nConfig {
export interface ModuleRuntimeConfig extends Pick<ModuleOptions, 'cacheMaxAgeSeconds' | 'sitemapName' | 'excludeAppSources' | 'sortEntries' | 'defaultSitemapsChunkSize' | 'xslColumns' | 'xslTips' | 'debug' | 'discoverImages' | 'autoLastmod' | 'xsl' | 'credits' > {
version: string
isNuxtContentDocumentDriven: boolean
sitemaps: { index?: Pick<SitemapDefinition, 'sitemapName' | '_route'> & { sitemaps: SitemapIndexEntry[] } } & Record<string, Omit<SitemapDefinition, 'urls' | 'sources'> & { _hasSourceChunk?: boolean }>
sitemaps: { index?: Pick<SitemapDefinition, 'sitemapName' | '_route'> & { sitemaps: SitemapIndexEntry[] } } & Record<string, Omit<SitemapDefinition, 'urls'> & { _hasSourceChunk?: boolean }>
autoI18n?: AutoI18nConfig
isMultiSitemap: boolean
isI18nMapped: boolean
Expand Down

0 comments on commit 52104bc

Please sign in to comment.