@@ -19,13 +19,16 @@ import {
1919 isNoPrefixStrategy ,
2020 isPrefixStrategy ,
2121 withPrefixStrategy ,
22- isPrefixExceptDefaultStrategy , isPrefixAndDefaultStrategy ,
22+ isPrefixExceptDefaultStrategy ,
23+ isPrefixAndDefaultStrategy ,
2324} from 'nuxt-i18n-micro-core'
2425import { setupDevToolsUI } from './devtools'
2526import { PageManager } from './page-manager'
2627import type { PluginsInjections } from './runtime/plugins/01.plugin'
2728import { LocaleManager } from './locale-manager'
2829
30+ const isInternalPath = ( p : string ) => / (?: ^ | \/ ) _ _ [ ^ / ] + / . test ( p )
31+
2932function generateI18nTypes ( ) {
3033 return `
3134import type {PluginsInjections} from "nuxt-i18n-micro";
@@ -410,7 +413,8 @@ export default defineNuxtModule<ModuleOptions>({
410413 const shouldGenerate = locale . code !== defaultLocale || withPrefixStrategy ( options . strategy ! )
411414 if ( shouldGenerate ) {
412415 pages . forEach ( ( page ) => {
413- if ( ! / \. [ a - z 0 - 9 ] + $ / i. test ( page ) ) {
416+ // Пропускаем файлоподобные пути и служебные сегменты `__*`
417+ if ( ! / \. [ a - z 0 - 9 ] + $ / i. test ( page ) && ! isInternalPath ( page ) ) {
414418 routes . push ( `/${ locale . code } ${ page } ` )
415419 }
416420 } )
@@ -466,10 +470,9 @@ export default defineNuxtModule<ModuleOptions>({
466470 }
467471 const routesSet = prerenderRoutes . routes
468472 const additionalRoutes = new Set < string > ( )
469-
470473 // Проходим по каждому существующему маршруту и добавляем локализованные версии
471474 routesSet . forEach ( ( route ) => {
472- if ( ! / \. [ a - z 0 - 9 ] + $ / i. test ( route ) ) {
475+ if ( ! / \. [ a - z 0 - 9 ] + $ / i. test ( route ) && ! isInternalPath ( route ) ) {
473476 localeManager . locales ! . forEach ( ( locale ) => {
474477 // Для стратегий prefix и prefix_and_default генерируем маршруты и для defaultLocale
475478 // Для стратегии prefix_except_default пропускаем defaultLocale
0 commit comments