Skip to content

Latest commit

 

History

History
526 lines (314 loc) · 14.4 KB

File metadata and controls

526 lines (314 loc) · 14.4 KB

mini-i18n-extract-plugin

mini-i18n-extract-plugin

Index

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

ClassParams

Ƭ ClassParams: object

Defined in src/types/index.ts:37

Type declaration:


DepCtorParams

Ƭ DepCtorParams: ConstructorParameters‹typeof Dependency›

Defined in src/types/index.ts:11


DependencyOptions

Ƭ DependencyOptions: DependencyOptions & object

Defined in src/types/index.ts:7


DependencyParams

Ƭ DependencyParams: [DependencyOptions, DepCtorParams[1], DepCtorParams[2]]

Defined in src/types/index.ts:12


ExportType

Ƭ ExportType: "json" | "yaml"

Defined in src/types/index.ts:30


I18nDependencyClass

Ƭ I18nDependencyClass: types.DependencyClass‹I18nDependency, DependencyParams

Defined in src/types/index.ts:18


I18nModuleClass

Ƭ I18nModuleClass: types.ModuleClass‹I18nModule, I18nDependency› & typeof Module

Defined in src/types/index.ts:27


LoaderContext

Ƭ LoaderContext: PitchContext["loaderContext"]

Defined in src/lib/resolve-resource.ts:13


SourceType

Ƭ SourceType: "json" | "yaml"

Defined in src/lib/resolve-resource.ts:6


SourceTypeData

Ƭ SourceTypeData: object

Defined in src/lib/resolve-resource.ts:7

Type declaration:

  • lang: SourceType | null

  • locale: string | null

  • vue: boolean | null


Tail

Ƭ Tail: function extends function ? R : never

Defined in src/types/index.ts:52


Taps

Ƭ Taps: types.hook.Taps‹MiniI18nExtractPlugin

Defined in src/types/index.ts:47

Variables

Const MiniI18nExtractPlugin

MiniI18nExtractPlugin: object = miniExtractPluginFactory({ type, dependencyClass: Dependency, moduleClass: Module as I18nModuleClass, pluginOptionsSchema, hooks: [ { name: 'initialize' as 'initialize', type: 'tap' as 'tap', hooks: [hooks.initialize!], }, { name: 'source' as 'source', type: 'tap' as 'tap', hooks: [hooks.source!], }, { name: 'dependency' as 'dependency', type: 'tap' as 'tap', hooks: [hooks.dependency!], }, { name: 'extracted' as 'extracted', type: 'tap' as 'tap', hooks: [hooks.extracted!], }, { name: 'beforeRenderMain' as 'beforeRenderMain', type: 'tap' as 'tap', hooks: [hooks.beforeRenderMain!], }, { name: 'merge' as 'merge', type: 'tap' as 'tap', hooks: [hooks.merge!], }, ], })

Defined in src/index.ts:17

Type declaration:

  • new __type(options?: T["options"]): T

Const debug

debug: log = getDebugLogger()

Defined in src/lib/debug.ts:16


Const pluginOptionsSchema

pluginOptionsSchema: object & object = merge( {}, schema.pluginOptions, customOptionsSchema, )

Defined in src/schemas/plugin-options.ts:19


Const type

type: "i18n" = "i18n"

Defined in src/config.ts:1


Const typeReadable

typeReadable: "I18n" = "I18n"

Defined in src/config.ts:2

Functions

addQueryParams

addQueryParams(url: string, params: object): string

Defined in src/lib/add-query-params.ts:6

Parameters:

Name Type Default
url string -
params object {}

Returns: string


entrypointName

entrypointName(chunk: Chunk): string | undefined

Defined in src/lib/entrypoint-name.ts:6

Find Chunk's entrypoint name

Parameters:

Name Type
chunk Chunk

Returns: string | undefined


extractVueI18nData

extractVueI18nData(exportsData: any): any

Defined in src/lib/extract-vue-i18n-data.ts:4

Extract data from source that came from VueI18n loader

Parameters:

Name Type
exportsData any

Returns: any


getDebugLogger

getDebugLogger(): log

Defined in src/lib/debug.ts:4

Returns: log


isVueI18nLoaderResource

isVueI18nLoaderResource(query: object): boolean

Defined in src/lib/resolve-resource.ts:15

Parameters:

Name Type
query object

Returns: boolean


resolveResource

resolveResource(loaderCtx: LoaderContext): object

Defined in src/lib/resolve-resource.ts:19

Parameters:

Name Type
loaderCtx LoaderContext

Returns: object

  • lang: SourceType | null

  • locale: string | null

  • vue: boolean | null


splitArray

splitArray<T, C>(arr: T[], categorizer: function): T[][]

Defined in src/lib/split-array.ts:5

Split an array into an array of arrays based on the return value of categorizer. Items with matching return values are grouped together.

Type parameters:

T

C

Parameters:

arr: T[]

categorizer: function

▸ (a: T, ...args: any[]): C

Parameters:

Name Type
a T
...args any[]

Returns: T[][]

Object literals

Const customOptionsSchema

customOptionsSchema: object

Defined in src/schemas/plugin-options.ts:4

errorMessages: object

Defined in src/schemas/plugin-options.ts:14

  • exportType: string = "must be either 'json' or 'yaml'"

properties: object

Defined in src/schemas/plugin-options.ts:5

  • exportType: object

    • oneOf: object[] = [{ enum: ['yaml', 'json'] }]

    • type: string = "string"

  • splitLocales: object

    • type: string = "boolean"

Const hooks

hooks: object

Defined in src/hooks.ts:15

beforeRenderMain

beforeRenderMain(context: RenderContext‹MiniI18nExtractPlugin‹››, modules: I18nModule‹› & Module‹object, Dependency‹object, DependencyOptions, any››[]): I18nModule‹› & Module‹object, Dependency‹object, DependencyOptions, any››[][]

Defined in src/hooks.ts:142

If splitLocales is enabled, split the modules that should be rendered for a given entrypoint into groups by locale, so separate files are emitted for individual locales.

Parameters:

Name Type
context RenderContext‹MiniI18nExtractPlugin‹››
modules I18nModule‹› & Module‹object, Dependency‹object, DependencyOptions, any››[]

Returns: I18nModule‹› & Module‹object, Dependency‹object, DependencyOptions, any››[][]

dependency

dependency(context: PitchCompilationContext‹MiniI18nExtractPlugin‹››, dependencyContext: LoaderModuleContext): object[]

Defined in src/hooks.ts:77

Split i18n data of each file into separate blocks by locales so they could be possibly optimized/cached

Parameters:

Name Type
context PitchCompilationContext‹MiniI18nExtractPlugin‹››
dependencyContext LoaderModuleContext

Returns: object[]

extracted

extracted(context: PitchCompilationContext‹MiniI18nExtractPlugin‹››, remainingSource: string): string

Defined in src/hooks.ts:131

Return empty JSON object, so the loader works with JSON Webpack module rules

Parameters:

Name Type
context PitchCompilationContext‹MiniI18nExtractPlugin‹››
remainingSource string

Returns: string

initialize

initialize(instance: MiniI18nExtractPlugin‹›, options: ConstructorOptions‹›): void

Defined in src/hooks.ts:19

Set defaults

Parameters:

Name Type
instance MiniI18nExtractPlugin‹›
options ConstructorOptions‹›

Returns: void

merge

merge(ctx: RenderContext‹MiniI18nExtractPlugin‹››, modules: I18nModule‹› & Module‹object, Dependency‹object, DependencyOptions, any››[]): ConcatSource‹›

Defined in src/hooks.ts:154

Override the merging process to join the i18n data as JSONs

Parameters:

Name Type
ctx RenderContext‹MiniI18nExtractPlugin‹››
modules I18nModule‹› & Module‹object, Dependency‹object, DependencyOptions, any››[]

Returns: ConcatSource‹›

source

source(context: PitchCompilationContext‹MiniI18nExtractPlugin‹››): any

Defined in src/hooks.ts:33

Modify the source from intlify/vue-i18n-loader and pass the module ID along

Parameters:

Name Type
context PitchCompilationContext‹MiniI18nExtractPlugin‹››

Returns: any