Skip to content

Commit

Permalink
fix: enable verbatimModuleSyntax and use explicit type imports
Browse files Browse the repository at this point in the history
  • Loading branch information
BobbieGoede authored and kazupon committed Nov 7, 2023
1 parent 898d3c8 commit b889e39
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 20 deletions.
6 changes: 4 additions & 2 deletions src/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { resolve } from 'pathe'
import { extendWebpackConfig, extendViteConfig, addWebpackPlugin, addVitePlugin } from '@nuxt/kit'
import VueI18nWebpackPlugin from '@intlify/unplugin-vue-i18n/webpack'
import VueI18nVitePlugin from '@intlify/unplugin-vue-i18n/vite'
import { TransformMacroPlugin, TransformMacroPluginOptions } from './transform/macros'
import { ResourcePlugin, ResourcePluginOptions } from './transform/resource'
import { TransformMacroPlugin } from './transform/macros'
import { ResourcePlugin } from './transform/resource'
import { assign } from '@intlify/shared'
import { getLayerLangPaths } from './layers'

import type { Nuxt } from '@nuxt/schema'
import type { PluginOptions } from '@intlify/unplugin-vue-i18n'
import type { NuxtI18nOptions } from './types'
import type { TransformMacroPluginOptions } from './transform/macros'
import type { ResourcePluginOptions } from './transform/resource'

const debug = createDebug('@nuxtjs/i18n:bundler')

Expand Down
3 changes: 2 additions & 1 deletion src/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import createDebug from 'debug'
import { EXECUTABLE_EXTENSIONS } from './constants'
import { genImport, genDynamicImport } from 'knitwork'
import { withQuery } from 'ufo'
import { PrerenderTarget, getLocalePaths, toCode } from './utils'
import { getLocalePaths, toCode } from './utils'

import type { Nuxt } from '@nuxt/schema'
import type { PrerenderTarget } from './utils'
import type { NuxtI18nOptions, LocaleInfo, VueI18nConfigPathInfo, FileMeta } from './types'
import type { LocaleObject } from 'vue-i18n-routing'

Expand Down
10 changes: 2 additions & 8 deletions src/layers.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import createDebug from 'debug'
import {
getLayerI18n,
getProjectPath,
mergeConfigLocales,
resolveVueI18nConfigInfo,
LocaleConfig,
formatMessage
} from './utils'
import { getLayerI18n, getProjectPath, mergeConfigLocales, resolveVueI18nConfigInfo, formatMessage } from './utils'

import { useLogger } from '@nuxt/kit'
import { isAbsolute, resolve } from 'pathe'
import { isString } from '@intlify/shared'
import { NUXT_I18N_MODULE_ID } from './constants'

import type { LocaleConfig } from './utils'
import type { Nuxt, NuxtConfigLayer } from '@nuxt/schema'
import type { NuxtI18nOptions, VueI18nConfigPathInfo } from './types'

Expand Down
9 changes: 7 additions & 2 deletions src/pages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import createDebug from 'debug'
import { extendPages } from '@nuxt/kit'
import { I18nRoute, localizeRoutes, DefaultLocalizeRoutesPrefixable } from 'vue-i18n-routing'
import { localizeRoutes, DefaultLocalizeRoutesPrefixable } from 'vue-i18n-routing'
import { isString } from '@intlify/shared'
import { parse as parseSFC, compileScript } from '@vue/compiler-sfc'
import { walk } from 'estree-walker'
Expand All @@ -11,7 +11,12 @@ import { resolve, parse as parsePath } from 'pathe'
import { NUXT_I18N_COMPOSABLE_DEFINE_ROUTE } from './constants'

import type { Nuxt, NuxtPage } from '@nuxt/schema'
import type { RouteOptionsResolver, ComputedRouteOptions, LocalizeRoutesPrefixableOptions } from 'vue-i18n-routing'
import type {
I18nRoute,
RouteOptionsResolver,
ComputedRouteOptions,
LocalizeRoutesPrefixableOptions
} from 'vue-i18n-routing'
import type { NuxtI18nOptions, CustomRoutePages } from './types'
import type { Node, ObjectExpression, ArrayExpression } from '@babel/types'

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
localeRoute,
switchLocalePath,
localeHead,
LocaleObject,
DefaultPrefixable,
DefaultSwitchLocalePathIntercepter,
getComposer,
Expand All @@ -35,6 +34,7 @@ import { joinURL, isEqual } from 'ufo'

import type {
Route,
LocaleObject,
RouteLocationNormalized,
RouteLocationNormalizedLoaded,
BaseUrlResolveHandler,
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export interface LocaleMessageCompilationOptions {
escapeHtml?: boolean
}

export { I18nOptions }
export type { I18nOptions }

export type NuxtI18nOptions<Context = unknown> = {
vueI18n?: string
Expand Down
2 changes: 1 addition & 1 deletion test/gen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { generateLoaderOptions } from '../src/gen'
import { resolveLocales, resolveVueI18nConfigInfo } from '../src/utils'

import type { LocaleInfo, NuxtI18nOptions, VueI18nConfigPathInfo } from '../src/types'
import { Nuxt } from '@nuxt/schema'
import type { Nuxt } from '@nuxt/schema'

vi.mock('node:fs')

Expand Down
2 changes: 1 addition & 1 deletion test/pages/custom_route.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { localizeRoutes } from 'vue-i18n-routing'
import { getRouteOptionsResolver, analyzeNuxtPages } from '../../src/pages'
import { getNuxtOptions, stripFilePropertyFromPages } from './utils'

import { NuxtPageAnalyzeContext, AnalyzedNuxtPageMeta } from '../../src/pages'
import type { NuxtPageAnalyzeContext, AnalyzedNuxtPageMeta } from '../../src/pages'
import type { NuxtI18nOptions } from '../../src/types'
import type { NuxtPage } from './utils'

Expand Down
2 changes: 1 addition & 1 deletion test/pages/ignore_route/disable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { localizeRoutes } from 'vue-i18n-routing'
import { getRouteOptionsResolver, analyzeNuxtPages } from '../../../src/pages'
import { getNuxtOptions, stripFilePropertyFromPages } from '../utils'

import { NuxtPageAnalyzeContext, AnalyzedNuxtPageMeta } from '../../../src/pages'
import type { NuxtPageAnalyzeContext, AnalyzedNuxtPageMeta } from '../../../src/pages'
import type { NuxtI18nOptions } from '../../../src/types'
import type { NuxtPage } from '../utils'

Expand Down
2 changes: 1 addition & 1 deletion test/pages/ignore_route/pick.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { localizeRoutes } from 'vue-i18n-routing'
import { getRouteOptionsResolver, analyzeNuxtPages } from '../../../src/pages'
import { getNuxtOptions, stripFilePropertyFromPages } from '../utils'

import { NuxtPageAnalyzeContext, AnalyzedNuxtPageMeta } from '../../../src/pages'
import type { NuxtPageAnalyzeContext, AnalyzedNuxtPageMeta } from '../../../src/pages'
import type { NuxtI18nOptions } from '../../../src/types'
import type { NuxtPage } from '../utils'

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@

/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
"verbatimModuleSyntax": true
},
"exclude": ["**/.nuxt/**", "**/*/dist/*", "docs/**", "playground/**", "specs/**.spec*", "src/runtime/templates/**"]
}

0 comments on commit b889e39

Please sign in to comment.