Skip to content

Commit

Permalink
chore: bump deps & lint
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Sep 19, 2023
1 parent a3cdc6b commit 9538ab0
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 92 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nuxt-simple-sitemap",
"type": "module",
"version": "3.3.3",
"packageManager": "[email protected].5",
"packageManager": "[email protected].6",
"description": "Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.",
"license": "MIT",
"funding": "https://github.com/sponsors/harlan-zw",
Expand Down Expand Up @@ -43,16 +43,16 @@
"escape-string-regexp": "^5.0.0",
"fast-glob": "^3.3.1",
"knitwork": "^1.0.0",
"nuxt-site-config": "^1.2.2",
"nuxt-site-config-kit": "^1.2.2",
"nuxt-site-config": "^1.3.0",
"nuxt-site-config-kit": "^1.3.0",
"pathe": "^1.1.1",
"radix3": "^1.1.0",
"semver": "^7.5.4",
"site-config-stack": "^1.2.1",
"site-config-stack": "^1.3.0",
"ufo": "^1.3.0"
},
"devDependencies": {
"@antfu/eslint-config": "^0.42.0",
"@antfu/eslint-config": "^0.43.0",
"@nuxt/content": "^2.8.2",
"@nuxt/kit": "^3.7.3",
"@nuxt/module-builder": "^0.5.1",
Expand All @@ -63,7 +63,7 @@
"eslint": "8.49.0",
"execa": "^8.0.1",
"nuxt": "^3.7.3",
"nuxt-simple-robots": "3.1.2",
"nuxt-simple-robots": "3.1.3",
"vitest": "0.34.4"
},
"build": {
Expand Down
311 changes: 248 additions & 63 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export default defineNuxtModule<ModuleOptions>({
driver: 'memory',
}
}
else if (config.runtimeCacheStorage && !nuxt.options.dev && typeof config.runtimeCacheStorage === 'object') {
else if (config.runtimeCacheStorage && !nuxt.options.dev && typeof config.runtimeCacheStorage === 'object') {
nuxt.options.nitro.storage['nuxt-simple-sitemap'] = config.runtimeCacheStorage
}

Expand Down Expand Up @@ -402,11 +402,11 @@ declare module 'nitropack' {
for (const k in config.sitemaps)
nuxt.options.routeRules[`/${k}-sitemap.xml`] = routeRules
}
else {
else {
nuxt.options.routeRules[`/${config.sitemapName}`] = routeRules
}
}
else {
else {
nuxt.options.routeRules[`/${config.sitemapName}`] = routeRules
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export function setupPrerenderHandler(moduleConfig: ModuleRuntimeConfig['moduleC
logs.push(`/${sitemap.sitemapName}-sitemap.xml (${generateTimeMS}ms)`)
}
}
else {
else {
let sitemapXml = await buildSitemap(options)
const ctx = { sitemap: sitemapXml, sitemapName: moduleConfig.sitemapName }
await nuxt.hooks.callHook('sitemap:output', ctx)
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/routes/sitemap.xsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default defineEventHandler(async (e) => {
conditionalTips.push(`Your canonical site URL is <strong>${siteUrl}</strong>.`)
conditionalTips.push(`You can preview your canonical sitemap by visiting <a href="${canonicalPreviewUrl}" style="color: #398465; white-space: nowrap;">${fixPath(canonicalPreviewUrl)}?canonical</a>`)
}
else {
else {
// avoid text wrap
conditionalTips.push(`You are viewing the canonical sitemap. You can switch to using the request origin: <a href="${fixPath(referrer)}" style="color: #398465; white-space: nowrap ">${fixPath(referrer)}</a>`)
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/sitemap/builder/sitemap-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function buildSitemapIndex(options: BuildSitemapIndexInput) {
chunks[chunkIndex].urls.push(url)
})
}
else {
else {
for (const sitemap in multiSitemapConfig) {
if (sitemap !== 'index') {
// user provided sitemap config
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/sitemap/entries/normalise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export async function normaliseSitemapData(data: SitemapEntryInput[], options: B
// xDefault is the e.loc replacing the prefix with the default lang
xDefault = joinURL('/', autoI18n.defaultLocale, withoutPrefix)
}
else if (autoI18n.strategy === 'prefix_except_default') {
else if (autoI18n.strategy === 'prefix_except_default') {
// xDefault is the e.loc without the prefix
xDefault = withoutPrefix
}
Expand All @@ -123,12 +123,12 @@ export async function normaliseSitemapData(data: SitemapEntryInput[], options: B
if (autoI18n.strategy === 'prefix') {
href = joinURL('/', locale.code, withoutPrefix)
}
else if (autoI18n.strategy === 'prefix_except_default') {
else if (autoI18n.strategy === 'prefix_except_default') {
if (isDefault) {
// no prefix
href = withoutPrefix
}
else {
else {
href = joinURL('/', locale.code, withoutPrefix)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/sitemap/entries/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function resolveAsyncDataSources(input: BuildSitemapInput | BuildSi
error: 'Received HTML response instead of JSON',
})
}
else {
else {
entries.push({
context,
timeTakenMs,
Expand Down Expand Up @@ -123,7 +123,7 @@ export async function resolveAsyncDataSources(input: BuildSitemapInput | BuildSi
})
}
}
else if (input.sitemap) {
else if (input.sitemap) {
await loadSitemapSources(input.sitemap)
}

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/util/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export async function setupCache(e: H3Event, key: string) {
xSitemapCacheHeader = 'PURGE'
await cache.removeItem(key)
}
else {
else {
xSitemapCacheHeader = 'HIT'
xSitemapCacheExpires = expiresAt
cachedSitemap = value as string
}
}
else {
else {
await cache.removeItem(key)
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/runtime/util/pageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ export function generateRoutesFromFiles(files: string[], pagesDir: string): Nuxt
parent = child.children
route.path = ''
}
else if (segmentName === 'index' && !route.path) {
else if (segmentName === 'index' && !route.path) {
route.path += '/'
}
else if (segmentName !== 'index') {
else if (segmentName !== 'index') {
route.path += getRoutePath(tokens)
}
}
Expand All @@ -126,8 +126,8 @@ export function generateRoutesFromFiles(files: string[], pagesDir: string): Nuxt
function getRoutePath(tokens: SegmentToken[]): string {
return tokens.reduce((path, token) => {
return (
path
+ (token.type === SegmentTokenType.optional
path +
(token.type === SegmentTokenType.optional
? `:${token.value}?`
: token.type === SegmentTokenType.dynamic
? `:${token.value}`
Expand Down Expand Up @@ -178,7 +178,7 @@ function parseSegment(segment: string) {
if (c === '[') {
state = SegmentParserState.dynamic
}
else {
else {
i--
state = SegmentParserState.static
}
Expand All @@ -189,7 +189,7 @@ function parseSegment(segment: string) {
consumeBuffer()
state = SegmentParserState.dynamic
}
else {
else {
buffer += c
}
break
Expand All @@ -212,10 +212,10 @@ function parseSegment(segment: string) {

state = SegmentParserState.initial
}
else if (PARAM_CHAR_RE.test(c)) {
else if (PARAM_CHAR_RE.test(c)) {
buffer += c
}
else {
else {

// console.debug(`[pages]Ignored character "${c}" while building param "${buffer}" from "segment"`)
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function convertNuxtPagesToSitemapEntries(pages: NuxtPage[], config: Nuxt
if (stats)
p.lastmod = stats.mtime
}
catch (e) {}
catch (e) {}
}
return p
})
Expand All @@ -49,7 +49,7 @@ export function convertNuxtPagesToSitemapEntries(pages: NuxtPage[], config: Nuxt
acc[name] = []
acc[name].push({ ...entry, locale })
}
else {
else {
acc.default = acc.default || []
acc.default.push(entry)
}
Expand Down

0 comments on commit 9538ab0

Please sign in to comment.