5
5
addServerPlugin ,
6
6
createResolver ,
7
7
defineNuxtModule ,
8
- findPath ,
9
8
getNuxtModuleVersion ,
10
9
hasNuxtModule ,
11
10
hasNuxtModuleCompatibility ,
@@ -61,7 +60,6 @@ export default defineNuxtModule<ModuleOptions>({
61
60
autoLastmod : false ,
62
61
discoverImages : true ,
63
62
discoverVideos : true ,
64
- dynamicUrlsApiEndpoint : '/api/_sitemap-urls' ,
65
63
urls : [ ] ,
66
64
sortEntries : true ,
67
65
sitemapsPathPrefix : '/__sitemap__/' ,
@@ -78,7 +76,6 @@ export default defineNuxtModule<ModuleOptions>({
78
76
// sources
79
77
sources : [ ] ,
80
78
excludeAppSources : [ ] ,
81
- inferStaticPagesAsRoutes : true ,
82
79
} ,
83
80
async setup ( config , nuxt ) {
84
81
const { resolve } = createResolver ( import . meta. url )
@@ -378,30 +375,6 @@ declare module 'vue-router' {
378
375
fetch : '/__sitemap__/nuxt-content-urls.json' ,
379
376
} )
380
377
}
381
- const hasLegacyDefaultApiSource = ! ! ( await findPath ( resolve ( nuxt . options . serverDir , 'api/_sitemap-urls' ) ) )
382
- if (
383
- // make sure they didn't manually add it as a source
384
- ! config . sources ?. includes ( '/api/_sitemap-urls' )
385
- // if they didn't and they have the file OR if they've manually configured the URL to something else, provide the source
386
- && ( hasLegacyDefaultApiSource || config . dynamicUrlsApiEndpoint !== '/api/_sitemap-urls' )
387
- ) {
388
- userGlobalSources . push ( {
389
- context : {
390
- name : 'dynamicUrlsApiEndpoint' ,
391
- description : 'Generated from your dynamicUrlsApiEndpoint config.' ,
392
- tips : [
393
- 'The `dynamicUrlsApiEndpoint` config is deprecated.' ,
394
- hasLegacyDefaultApiSource
395
- ? 'Consider renaming the `api/_sitemap-urls` file and add it the `sitemap.sources` config instead. This provides more explicit sitemap generation.'
396
- : 'Consider switching to using the `sitemap.sources` config which also supports fetch options.' ,
397
- ] ,
398
- } ,
399
- fetch : hasLegacyDefaultApiSource ? '/api/_sitemap-urls' : config . dynamicUrlsApiEndpoint as string ,
400
- } )
401
- }
402
- else {
403
- config . dynamicUrlsApiEndpoint = false
404
- }
405
378
406
379
// config -> sitemaps
407
380
const sitemaps : ModuleRuntimeConfig [ 'sitemaps' ] = { }
@@ -434,7 +407,7 @@ declare module 'vue-router' {
434
407
{
435
408
sitemapName,
436
409
_route : withBase ( joinURL ( config . sitemapsPathPrefix , `${ sitemapName } .xml` ) , nuxt . options . app . baseURL || '/' ) ,
437
- _hasSourceChunk : typeof definition . urls !== 'undefined' || definition . sources ?. length || ! ! definition . dynamicUrlsApiEndpoint ,
410
+ _hasSourceChunk : typeof definition . urls !== 'undefined' || definition . sources ?. length ,
438
411
} ,
439
412
{ ...definition , urls : undefined , sources : undefined } ,
440
413
{ include : config . include , exclude : config . exclude } ,
@@ -561,10 +534,6 @@ declare module 'vue-router' {
561
534
setupDevToolsUI ( config , resolve )
562
535
}
563
536
564
- // support deprecated config
565
- if ( ! config . inferStaticPagesAsRoutes )
566
- config . excludeAppSources = true
567
-
568
537
const imports : typeof nuxt . options . imports . imports = [
569
538
{
570
539
from : resolve ( './runtime/server/composables/defineSitemapEventHandler' ) ,
@@ -700,18 +669,6 @@ declare module 'vue-router' {
700
669
urls : await resolveUrls ( definition . urls , { path : `sitemaps:${ sitemapName } :urls` , logger } ) ,
701
670
} )
702
671
}
703
- if ( definition ! . dynamicUrlsApiEndpoint ) {
704
- sitemapSources [ sitemapName ] . push ( {
705
- context : {
706
- name : `${ sitemapName } :dynamicUrlsApiEndpoint` ,
707
- description : `Generated from your ${ sitemapName } :dynamicUrlsApiEndpoint config.` ,
708
- tips : [
709
- `You should switch to using the \`sitemaps.${ sitemapName } .sources\` config which also supports fetch options.` ,
710
- ] ,
711
- } ,
712
- fetch : definition ! . dynamicUrlsApiEndpoint ,
713
- } )
714
- }
715
672
sitemapSources [ sitemapName ] . push ( ...( definition . sources || [ ] )
716
673
. map ( ( s ) => {
717
674
if ( typeof s === 'string' || Array . isArray ( s ) ) {
0 commit comments