@intlify/cli
- Version 0.13.1
- Published
- 108 kB
- 18 dependencies
- MIT license
Install
npm i @intlify/cli
yarn add @intlify/cli
pnpm add @intlify/cli
Overview
CLI Tooling for i18n development
Index
Variables
Functions
Classes
Interfaces
Enums
Variables
variable DEFAULT_PRETTIER_OPTIONS
const DEFAULT_PRETTIER_OPTIONS: { printWidth: number; tabWidth: number; jsonRecursiveSort: boolean; plugins: string[];};
The default prettier options for formatting the content of
i18n
custom blocksModifiers
@public
Functions
function annotate
annotate: ( source: string, filepath: string, options?: AnnotateOptions) => Promise<string>;
Annoate the Vue SFC block
Parameter source
The source code of the Vue SFC
Parameter filepath
The file path of the Vue SFC
Parameter options
The options of the annotate function
Returns
The annotated source code of the Vue SFC
Modifiers
@public
function compile
compile: ( source: string, output: string, options?: CompileOptions) => Promise<boolean>;
Compile i18n resources
Parameter source
the i18n resource source path, you can use glob pattern
Parameter output
the compiled i18n resource output path
Parameter options
Returns
true
when all i18n resource successfuly compile, notfalse
Remarks
This functoin is **asyncronous** function. If you want to get about error details, use the handler of CompileOptions and CompileErrorCodes
Modifiers
@public
function format
format: ( source: string, filepath: string, options?: FormatOptions) => Promise<string>;
Format the Vue SFC block
Parameter source
The source code of the Vue SFC
Parameter filepath
The file path of the Vue SFC
Parameter options
The options of the format function
Returns
The formatted source code of the Vue SFC
Remarks
Currently, only i18n custom blocks supporting
Modifiers
@public
Classes
class FormatLangNotFoundError
class FormatLangNotFoundError extends Error {}
Fortmat lang fwnot found error
Remarks
The error that not specified
lang
attribute ini18n
custom blockModifiers
@public
constructor
constructor(message: string, filepath: string);
Constructor
Parameter message
The error message
Parameter filepath
The filepath of the target file at formatting processing
property filepath
filepath: string;
The filepath of the target file at formatting processing
class SFCAnnotateError
class SFCAnnotateError extends Error {}
The Annocation error
Modifiers
@public
constructor
constructor(message: string, filepath: string);
Constructor
Parameter message
The error message
Parameter filepath
The filepath of the target file at annotate processing
property filepath
filepath: string;
The filepath of the target file at annotate processing
Interfaces
interface AnnotateOptions
interface AnnotateOptions {}
Annotate options of annotate function
Modifiers
@public
property attrs
attrs?: Record<string, any>;
The Attributes to be annotated on the block tag
Remarks
default as
{}
property force
force?: boolean;
Whether to force annotations
Remarks
Force annotation of the attribute values of
attrs
option to the block tag. Even if the actuallang
of the block content in thelang
attribute is different, it will be enforced if this flag is turned on. default asfalse
property onWarn
onWarn?: (code: number, args: Record<string, any>, block: SFCBlock) => void;
The warning handler
Remarks
Notify warnings generated by the annotate process
property type
type?: string;
The type of the block
Remarks
Only
i18n
type is supported, if you don't specify it. If any other type is specified, the function will raise the SFCAnnotateError.default as
i18n
property vue
vue?: number;
The Vue template compiler version
Remarks
The version of the Vue template to be parsed by the annotate function. If
2
is specified, thevue-template-compiler
used by Vue 2 is used; if3
is specified, the@vue/compiler-sfc
used by Vue 3 is used. defalt as3
interface CompileOptions
interface CompileOptions {}
property ast
ast?: boolean;
Whether to generate AST format
Remarks
default
false
, it will output the function format.
property mode
mode?: DevEnv;
Compile mode
Remarks
The mode of code generation. Default
production
for optimization. Ifdevelopment
, code generated with meta information from i18n resources.
property onCompile
onCompile?: (source: string, output: string) => void;
Compile handler
property onError
onError?: (code: number, source: string, output: string, msg?: string) => void;
Compile Error handler
interface FormatOptions
interface FormatOptions {}
Format options of format function
Modifiers
@public
property prettier
prettier?: Options;
The prettier options
Remarks
The options for formatting the content of
i18n
custom blocks with prettier default as DEFAULT_PRETTIER_OPTIONS
property vue
vue?: number;
The Vue template compiler version
Remarks
The version of the Vue template to be parsed by the annotate function. If
2
is specified, thevue-template-compiler
used by Vue 2 is used; if3
is specified, the@vue/compiler-sfc
used by Vue 3 is used. defalt as3
interface SFCParseError
interface SFCParseError extends SyntaxError {}
Vue SFC compiler error
Remarks
This is the error wrapping the error that occurred in Vue SFC compiler
Modifiers
@public
Enums
enum AnnotateWarningCodes
const enum AnnotateWarningCodes { NOT_SUPPORTED_TYPE = 1, LANG_MISMATCH_IN_SRC_AND_CONTENT = 2, LANG_MISMATCH_IN_OPTION_AND_CONTENT = 3, LANG_MISMATCH_IN_ATTR_AND_CONTENT = 4,}
member LANG_MISMATCH_IN_ATTR_AND_CONTENT
LANG_MISMATCH_IN_ATTR_AND_CONTENT = 4
Lang mismatch
lang
and block content
member LANG_MISMATCH_IN_OPTION_AND_CONTENT
LANG_MISMATCH_IN_OPTION_AND_CONTENT = 3
Lang mismatch option and block content
member LANG_MISMATCH_IN_SRC_AND_CONTENT
LANG_MISMATCH_IN_SRC_AND_CONTENT = 2
Lang mismatch block
src
and block content
member NOT_SUPPORTED_TYPE
NOT_SUPPORTED_TYPE = 1
Not supported type
enum CompileErrorCodes
const enum CompileErrorCodes { NOT_SUPPORTED_FORMAT = 1, INTERNAL_COMPILE_WARNING = 2, INTERNAL_COMPILE_ERROR = 3,}
member INTERNAL_COMPILE_ERROR
INTERNAL_COMPILE_ERROR = 3
Internal compile error
member INTERNAL_COMPILE_WARNING
INTERNAL_COMPILE_WARNING = 2
Internal compile warning
member NOT_SUPPORTED_FORMAT
NOT_SUPPORTED_FORMAT = 1
Not supported format
Package Files (1)
Dependencies (18)
Dev Dependencies (24)
- @intlify/eslint-plugin-vue-i18n
- @secretlint/secretlint-rule-preset-recommend
- @types/debug
- @types/diff-match-patch
- @types/eslint
- @types/glob
- @types/node
- @types/yargs
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- @vitest/coverage-v8
- bumpp
- eslint
- eslint-config-prettier
- eslint-plugin-prettier
- gh-changelogen
- jiti
- lint-staged
- npm-run-all
- opener
- secretlint
- typescript
- unbuild
- vitest
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@intlify/cli
.
- Markdown[](https://www.jsdocs.io/package/@intlify/cli)
- HTML<a href="https://www.jsdocs.io/package/@intlify/cli"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2797 ms. - Missing or incorrect documentation? Open an issue for this package.