svelte/compiler
import {
const VERSION: string
The current version, as set in package.json.
VERSION,
function compile(source: string, options: CompileOptions): CompileResult
compile
converts your .svelte
source code into a JavaScript module that exports a component
compile,
function compileModule(source: string, options: ModuleCompileOptions): CompileResult
compileModule
takes your JavaScript source code containing runes, and turns it into a JavaScript module.
compileModule,
function migrate(source: string, { filename, use_ts }?: {
filename?: string;
use_ts?: boolean;
} | undefined): {
code: string;
}
Does a best-effort migration of Svelte code towards using runes, event attributes and render tags.
May throw an error if the code is too complex to migrate automatically.
migrate,
function parse(source: string, options: {
filename?: string;
modern: true;
loose?: boolean;
}): AST.Root (+1 overload)
The parse function parses a component, returning only its abstract syntax tree.
The modern
option (false
by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST.
modern
will become true
by default in Svelte 6, and the option will be removed in Svelte 7.
parse,
function preprocess(source: string, preprocessor: PreprocessorGroup | PreprocessorGroup[], options?: {
filename?: string;
} | undefined): Promise<Processed>
The preprocess function provides convenient hooks for arbitrarily transforming component source code.
For example, it can be used to convert a <style lang="sass">
block into vanilla CSS.
preprocess,
function walk(): never
walk
} from 'svelte/compiler';
VERSION
当前版本,如 package.json 中设置的那样。
¥The current version, as set in package.json.
const VERSION: string;
compile
compile
将你的 .svelte
源代码转换为导出组件的 JavaScript 模块
¥compile
converts your .svelte
source code into a JavaScript module that exports a component
function compile(
source: string,
options: CompileOptions
): CompileResult;
compileModule
compileModule
获取包含符文的 JavaScript 源代码,并将其转换为 JavaScript 模块。
¥compileModule
takes your JavaScript source code containing runes, and turns it into a JavaScript module.
function compileModule(
source: string,
options: ModuleCompileOptions
): CompileResult;
migrate
尽最大努力将 Svelte 代码迁移到使用符文、事件属性和渲染标签。如果代码太复杂而无法自动迁移,可能会抛出错误。
¥Does a best-effort migration of Svelte code towards using runes, event attributes and render tags. May throw an error if the code is too complex to migrate automatically.
function migrate(
source: string,
{
filename,
use_ts
}?:
| {
filename?: string;
use_ts?: boolean;
}
| undefined
): {
code: string;
};
parse
parse 函数解析组件,仅返回其抽象语法树。
¥The parse function parses a component, returning only its abstract syntax tree.
modern
选项(Svelte 5 中默认为 false
)使解析器返回现代 AST 而不是旧式 AST。modern
在 Svelte 6 中将默认变为 true
,并且该选项将在 Svelte 7 中被删除。
¥The modern
option (false
by default in Svelte 5) makes the parser return a modern AST instead of the legacy AST.
modern
will become true
by default in Svelte 6, and the option will be removed in Svelte 7.
function parse(
source: string,
options: {
filename?: string;
modern: true;
loose?: boolean;
}
): AST.Root;
function parse(
source: string,
options?:
| {
filename?: string;
modern?: false;
loose?: boolean;
}
| undefined
): Record<string, any>;
preprocess
preprocess 函数提供了方便的钩子,可任意转换组件源代码。例如,它可用于将 <style lang="sass">
块转换为原始 CSS。
¥The preprocess function provides convenient hooks for arbitrarily transforming component source code.
For example, it can be used to convert a <style lang="sass">
block into vanilla CSS.
function preprocess(
source: string,
preprocessor: PreprocessorGroup | PreprocessorGroup[],
options?:
| {
filename?: string;
}
| undefined
): Promise<Processed>;
walk
用
import { walk } from 'estree-walker'
替换它¥Replace this with
import { walk } from 'estree-walker'
function walk(): never;
AST
namespace AST {
export interface BaseNode {
type: string;
start: number;
end: number;
}
export interface Fragment {
type: 'Fragment';
nodes: Array<
Text | Tag | ElementLike | Block | Comment
>;
}
export interface Root extends BaseNode {
type: 'Root';
/**
* Inline options provided by `<svelte:options>` — these override options passed to `compile(...)`
*/
options: SvelteOptions | null;
fragment: Fragment;
/** The parsed `<style>` element, if exists */
css: AST.CSS.StyleSheet | null;
/** The parsed `<script>` element, if exists */
instance: Script | null;
/** The parsed `<script module>` element, if exists */
module: Script | null;
}
export interface SvelteOptions {
// start/end info (needed for warnings and for our Prettier plugin)
start: number;
end: number;
// options
runes?: boolean;
immutable?: boolean;
accessors?: boolean;
preserveWhitespace?: boolean;
namespace?: Namespace;
css?: 'injected';
customElement?: {
tag?: string;
shadow?: 'open' | 'none';
props?: Record<
string,
{
attribute?: string;
reflect?: boolean;
type?:
| 'Array'
| 'Boolean'
| 'Number'
| 'Object'
| 'String';
}
>;
/**
* Is of type
* ```ts
* (ceClass: new () => HTMLElement) => new () => HTMLElement
* ```
*/
extend?: ArrowFunctionExpression | Identifier;
};
attributes: Attribute[];
}
/** Static text */
export interface Text extends BaseNode {
type: 'Text';
/** Text with decoded HTML entities */
data: string;
/** The original text, with undecoded HTML entities */
raw: string;
}
/** A (possibly reactive) template expression — `{...}` */
export interface ExpressionTag extends BaseNode {
type: 'ExpressionTag';
expression: Expression;
}
/** A (possibly reactive) HTML template expression — `{@html ...}` */
export interface HtmlTag extends BaseNode {
type: 'HtmlTag';
expression: Expression;
}
/** An HTML comment */
// TODO rename to disambiguate
export interface Comment extends BaseNode {
type: 'Comment';
/** the contents of the comment */
data: string;
}
/** A `{@const ...}` tag */
export interface ConstTag extends BaseNode {
type: 'ConstTag';
declaration: VariableDeclaration & {
declarations: [
VariableDeclarator & {
id: Pattern;
init: Expression;
}
];
};
}
/** A `{@debug ...}` tag */
export interface DebugTag extends BaseNode {
type: 'DebugTag';
identifiers: Identifier[];
}
/** A `{@render foo(...)} tag */
export interface RenderTag extends BaseNode {
type: 'RenderTag';
expression:
| SimpleCallExpression
| (ChainExpression & {
expression: SimpleCallExpression;
});
}
/** An `animate:` directive */
export interface AnimateDirective extends BaseNode {
type: 'AnimateDirective';
/** The 'x' in `animate:x` */
name: string;
/** The y in `animate:x={y}` */
expression: null | Expression;
}
/** A `bind:` directive */
export interface BindDirective extends BaseNode {
type: 'BindDirective';
/** The 'x' in `bind:x` */
name: string;
/** The y in `bind:x={y}` */
expression:
| Identifier
| MemberExpression
| SequenceExpression;
}
/** A `class:` directive */
export interface ClassDirective extends BaseNode {
type: 'ClassDirective';
/** The 'x' in `class:x` */
name: 'class';
/** The 'y' in `class:x={y}`, or the `x` in `class:x` */
expression: Expression;
}
/** A `let:` directive */
export interface LetDirective extends BaseNode {
type: 'LetDirective';
/** The 'x' in `let:x` */
name: string;
/** The 'y' in `let:x={y}` */
expression:
| null
| Identifier
| ArrayExpression
| ObjectExpression;
}
/** An `on:` directive */
export interface OnDirective extends BaseNode {
type: 'OnDirective';
/** The 'x' in `on:x` */
name: string;
/** The 'y' in `on:x={y}` */
expression: null | Expression;
modifiers: string[];
}
/** A `style:` directive */
export interface StyleDirective extends BaseNode {
type: 'StyleDirective';
/** The 'x' in `style:x` */
name: string;
/** The 'y' in `style:x={y}` */
value:
| true
| ExpressionTag
| Array<ExpressionTag | Text>;
modifiers: Array<'important'>;
}
// TODO have separate in/out/transition directives
/** A `transition:`, `in:` or `out:` directive */
export interface TransitionDirective extends BaseNode {
type: 'TransitionDirective';
/** The 'x' in `transition:x` */
name: string;
/** The 'y' in `transition:x={y}` */
expression: null | Expression;
modifiers: Array<'local' | 'global'>;
/** True if this is a `transition:` or `in:` directive */
intro: boolean;
/** True if this is a `transition:` or `out:` directive */
outro: boolean;
}
/** A `use:` directive */
export interface UseDirective extends BaseNode {
type: 'UseDirective';
/** The 'x' in `use:x` */
name: string;
/** The 'y' in `use:x={y}` */
expression: null | Expression;
}
interface BaseElement extends BaseNode {
name: string;
attributes: Array<
Attribute | SpreadAttribute | Directive
>;
fragment: Fragment;
}
export interface Component extends BaseElement {
type: 'Component';
}
export interface TitleElement extends BaseElement {
type: 'TitleElement';
name: 'title';
}
export interface SlotElement extends BaseElement {
type: 'SlotElement';
name: 'slot';
}
export interface RegularElement extends BaseElement {
type: 'RegularElement';
}
export interface SvelteBody extends BaseElement {
type: 'SvelteBody';
name: 'svelte:body';
}
export interface SvelteComponent extends BaseElement {
type: 'SvelteComponent';
name: 'svelte:component';
expression: Expression;
}
export interface SvelteDocument extends BaseElement {
type: 'SvelteDocument';
name: 'svelte:document';
}
export interface SvelteElement extends BaseElement {
type: 'SvelteElement';
name: 'svelte:element';
tag: Expression;
}
export interface SvelteFragment extends BaseElement {
type: 'SvelteFragment';
name: 'svelte:fragment';
}
export interface SvelteBoundary extends BaseElement {
type: 'SvelteBoundary';
name: 'svelte:boundary';
}
export interface SvelteHead extends BaseElement {
type: 'SvelteHead';
name: 'svelte:head';
}
/** This is only an intermediate representation while parsing, it doesn't exist in the final AST */
export interface SvelteOptionsRaw extends BaseElement {
type: 'SvelteOptions';
name: 'svelte:options';
}
export interface SvelteSelf extends BaseElement {
type: 'SvelteSelf';
name: 'svelte:self';
}
export interface SvelteWindow extends BaseElement {
type: 'SvelteWindow';
name: 'svelte:window';
}
/** An `{#each ...}` block */
export interface EachBlock extends BaseNode {
type: 'EachBlock';
expression: Expression;
/** The `entry` in `{#each item as entry}`. `null` if `as` part is omitted */
context: Pattern | null;
body: Fragment;
fallback?: Fragment;
index?: string;
key?: Expression;
}
/** An `{#if ...}` block */
export interface IfBlock extends BaseNode {
type: 'IfBlock';
elseif: boolean;
test: Expression;
consequent: Fragment;
alternate: Fragment | null;
}
/** An `{#await ...}` block */
export interface AwaitBlock extends BaseNode {
type: 'AwaitBlock';
expression: Expression;
// TODO can/should we move these inside the ThenBlock and CatchBlock?
/** The resolved value inside the `then` block */
value: Pattern | null;
/** The rejection reason inside the `catch` block */
error: Pattern | null;
pending: Fragment | null;
then: Fragment | null;
catch: Fragment | null;
}
export interface KeyBlock extends BaseNode {
type: 'KeyBlock';
expression: Expression;
fragment: Fragment;
}
export interface SnippetBlock extends BaseNode {
type: 'SnippetBlock';
expression: Identifier;
parameters: Pattern[];
body: Fragment;
}
export interface Attribute extends BaseNode {
type: 'Attribute';
name: string;
/**
* Quoted/string values are represented by an array, even if they contain a single expression like `"{x}"`
*/
value:
| true
| ExpressionTag
| Array<Text | ExpressionTag>;
}
export interface SpreadAttribute extends BaseNode {
type: 'SpreadAttribute';
expression: Expression;
}
export interface Script extends BaseNode {
type: 'Script';
context: 'default' | 'module';
content: Program;
attributes: Attribute[];
}
export type AttributeLike =
| Attribute
| SpreadAttribute
| Directive;
export type Directive =
| AST.AnimateDirective
| AST.BindDirective
| AST.ClassDirective
| AST.LetDirective
| AST.OnDirective
| AST.StyleDirective
| AST.TransitionDirective
| AST.UseDirective;
export type Block =
| AST.EachBlock
| AST.IfBlock
| AST.AwaitBlock
| AST.KeyBlock
| AST.SnippetBlock;
export type ElementLike =
| AST.Component
| AST.TitleElement
| AST.SlotElement
| AST.RegularElement
| AST.SvelteBody
| AST.SvelteBoundary
| AST.SvelteComponent
| AST.SvelteDocument
| AST.SvelteElement
| AST.SvelteFragment
| AST.SvelteHead
| AST.SvelteOptionsRaw
| AST.SvelteSelf
| AST.SvelteWindow
| AST.SvelteBoundary;
export type Tag =
| AST.ExpressionTag
| AST.HtmlTag
| AST.ConstTag
| AST.DebugTag
| AST.RenderTag;
export type TemplateNode =
| AST.Root
| AST.Text
| Tag
| ElementLike
| AST.Attribute
| AST.SpreadAttribute
| Directive
| AST.Comment
| Block;
export type SvelteNode =
| Node
| TemplateNode
| AST.Fragment
| _CSS.Node;
export type { _CSS as CSS };
}
CompileError
interface CompileError extends ICompileDiagnostic {}
CompileOptions
interface CompileOptions extends ModuleCompileOptions {…}
name?: string;
设置生成的 JavaScript 类的名称(尽管如果它与范围内的其他变量冲突,编译器将重命名它)。如果未指定,将从 filename
推断
¥Sets the name of the resulting JavaScript class (though the compiler will rename it if it would otherwise conflict with other variables in scope).
If unspecified, will be inferred from filename
customElement?: boolean;
默认
false
¥default
false
如果是 true
,则告诉编译器生成自定义元素构造函数而不是常规 Svelte 组件。
¥If true
, tells the compiler to generate a custom element constructor instead of a regular Svelte component.
accessors?: boolean;
默认
false
¥default
false
已弃用 这在符文模式下无效
¥deprecated This will have no effect in runes mode
如果是 true
,将为组件的 props 创建 getter 和 setter。如果是 false
,则仅为只读导出值(即使用 const
、class
和 function
声明的值)创建它们。如果使用 customElement: true
进行编译,则此选项默认为 true
。
¥If true
, getters and setters will be created for the component’s props. If false
, they will only be created for readonly exported values (i.e. those declared with const
, class
and function
). If compiling with customElement: true
this option defaults to true
.
namespace?: Namespace;
默认
'html'
¥default
'html'
元素的命名空间;端到端
¥The namespace of the element; e.g., "html"
, "svg"
, "mathml"
.
immutable?: boolean;
默认
false
¥default
false
已弃用 这在符文模式下无效
¥deprecated This will have no effect in runes mode
如果是 true
,则告诉编译器你 promise 不会改变任何对象。这允许它在检查值是否已更改时不那么保守。
¥If true
, tells the compiler that you promise not to mutate any objects.
This allows it to be less conservative about checking whether values have changed.
css?: 'injected' | 'external';
'injected'
:使用render(...)
时,样式将包含在head
中,并在组件安装时注入到文档中(如果尚不存在)。对于编译为自定义元素的组件,样式将注入影子根。¥
'injected'
: styles will be included in thehead
when usingrender(...)
, and injected into the document (if not already present) when the component mounts. For components compiled as custom elements, styles are injected to the shadow root.'external'
:CSS 将仅在编译结果的css
字段中返回。大多数 Svelte 打包器插件会将其设置为'external'
,并使用静态生成的 CSS 以获得更好的性能,因为它将产生更小的 JavaScript 打包包,并且输出可以作为可缓存的.css
文件提供。使用customElement
模式编译时,这始终是'injected'
。¥
'external'
: the CSS will only be returned in thecss
field of the compilation result. Most Svelte bundler plugins will set this to'external'
and use the CSS that is statically generated for better performance, as it will result in smaller JavaScript bundles and the output can be served as cacheable.css
files. This is always'injected'
when compiling withcustomElement
mode.
cssHash?: CssHashGetter;
默认
undefined
¥default
undefined
接受 { hash, css, name, filename }
参数并返回用作作用域 CSS 类名的字符串的函数。它默认返回 svelte-${hash(css)}
。
¥A function that takes a { hash, css, name, filename }
argument and returns the string that is used as a classname for scoped CSS.
It defaults to returning svelte-${hash(css)}
.
preserveComments?: boolean;
默认
false
¥default
false
如果是 true
,你的 HTML 注释将保留在输出中。默认情况下,它们会被删除。
¥If true
, your HTML comments will be preserved in the output. By default, they are stripped out.
preserveWhitespace?: boolean;
默认
false
¥default
false
如果是 true
,元素内部和元素之间的空格将保留为你输入的内容,而不是尽可能地删除或折叠为单个空格。
¥If true
, whitespace inside and between elements is kept as you typed it, rather than removed or collapsed to a single space where possible.
runes?: boolean | undefined;
默认
undefined
¥default
undefined
设置为 true
以强制编译器进入符文模式,即使没有符文使用的迹象。设置为 false
以强制编译器忽略符文,即使有符文使用的迹象。设置为 undefined
(默认值)以从组件代码推断符文模式。对于使用 Svelte 编译的 JS/TS 模块,始终为 true
。在 Svelte 6 中默认为 true
。请注意,在 svelte.config.js
中将其设置为 true
将强制整个项目(包括 node_modules
中的组件)使用符文模式,这可能不是你想要的。如果你使用的是 Vite,请考虑使用 dynamicCompileOptions。
¥Set to true
to force the compiler into runes mode, even if there are no indications of runes usage.
Set to false
to force the compiler into ignoring runes, even if there are indications of runes usage.
Set to undefined
(the default) to infer runes mode from the component code.
Is always true
for JS/TS modules compiled with Svelte.
Will be true
by default in Svelte 6.
Note that setting this to true
in your svelte.config.js
will force runes mode for your entire project, including components in node_modules
,
which is likely not what you want. If you’re using Vite, consider using dynamicCompileOptions instead.
discloseVersion?: boolean;
默认
true
¥default
true
如果是 true
,则通过将 Svelte 主版本添加到存储在全局 window.__svelte.v
中的 Set
中来在浏览器中公开 Svelte 主版本。
¥If true
, exposes the Svelte major version in the browser by adding it to a Set
stored in the global window.__svelte.v
.
compatibility?: {…}
已弃用 在迁移代码之前,仅将其用作临时解决方案
¥deprecated Use these only as a temporary solution before migrating your code
componentApi?: 4 | 5;
默认
5
¥default
5
应用转换,以便 Svelte 文件的默认导出仍然可以以与 Svelte 4 中相同的方式实例化 - 在为浏览器编译时作为类(就像使用 svelte/legacy
中的 createClassComponent(MyComponent, {...})
一样)或在为服务器编译时作为具有 .render(...)
方法的对象
¥Applies a transformation so that the default export of Svelte files can still be instantiated the same way as in Svelte 4 —
as a class when compiling for the browser (as though using createClassComponent(MyComponent, {...})
from svelte/legacy
)
or as an object with a .render(...)
method when compiling for the server
sourcemap?: object | string;
默认
null
¥default
null
将合并到最终输出源图中的初始源图。这通常是预处理器源映射。
¥An initial sourcemap that will be merged into the final output sourcemap. This is usually the preprocessor sourcemap.
outputFilename?: string;
默认
null
¥default
null
用于 JavaScript 源映射。
¥Used for your JavaScript sourcemap.
cssOutputFilename?: string;
默认
null
¥default
null
用于 CSS 源映射。
¥Used for your CSS sourcemap.
hmr?: boolean;
默认
false
¥default
false
如果是 true
,则编译具有热重载支持的组件。
¥If true
, compiles components with hot reloading support.
modernAst?: boolean;
默认
false
¥default
false
如果是 true
,则返回 AST 的现代版本。在 Svelte 6 中默认为 true
,并且该选项将在 Svelte 7 中被删除。
¥If true
, returns the modern version of the AST.
Will become true
by default in Svelte 6, and the option will be removed in Svelte 7.
CompileResult
svelte/compiler
的 compile
返回值
¥The return value of compile
from svelte/compiler
interface CompileResult {…}
js: {…}
编译后的 JavaScript
¥The compiled JavaScript
code: string;
生成的代码
¥The generated code
map: SourceMap;
源映射
¥A source map
css: null | {
/** The generated code */
code: string;
/** A source map */
map: SourceMap;
};
编译后的 CSS
¥The compiled CSS
warnings: Warning[];
编译期间生成的警告对象数组。每个警告都有几个属性:
¥An array of warning objects that were generated during compilation. Each warning has several properties:
code
是一个用于标识警告类别的字符串¥
code
is a string identifying the category of warningmessage
以人类可读的术语描述问题¥
message
describes the issue in human-readable terms如果警告与特定位置有关,则
start
和end
是具有line
、column
和character
属性的对象¥
start
andend
, if the warning relates to a specific location, are objects withline
,column
andcharacter
properties
metadata: {…}
有关已编译组件的元数据
¥Metadata about the compiled component
runes: boolean;
文件是否在符文模式下编译,无论是由于显式选项还是从使用中推断出来的。对于 compileModule
,这始终是 true
¥Whether the file was compiled in runes mode, either because of an explicit option or inferred from usage.
For compileModule
, this is always true
ast: any;
AST
MarkupPreprocessor
标记预处理器,接受一串代码并返回处理后的版本。
¥A markup preprocessor that takes a string of code and returns a processed version.
type MarkupPreprocessor = (options: {
/**
* The whole Svelte file content
*/
content: string;
/**
* The filename of the Svelte file
*/
filename?: string;
}) => Processed | void | Promise<Processed | void>;
ModuleCompileOptions
interface ModuleCompileOptions {…}
dev?: boolean;
默认
false
¥default
false
如果是 true
,则会导致添加额外的代码,这些代码将执行运行时检查并在开发期间提供调试信息。
¥If true
, causes extra code to be added that will perform runtime checks and provide debugging information during development.
generate?: 'client' | 'server' | false;
默认
'client'
¥default
'client'
如果是 "client"
,Svelte 会发出专为在浏览器中运行而设计的代码。如果是 "server"
,Svelte 会发出适合服务器端渲染的代码。如果是 false
,则不生成任何内容。适用于仅对警告感兴趣的工具。
¥If "client"
, Svelte emits code designed to run in the browser.
If "server"
, Svelte emits code suitable for server-side rendering.
If false
, nothing is generated. Useful for tooling that is only interested in warnings.
filename?: string;
用于调试提示和源映射。你的打包器插件将自动设置它。
¥Used for debugging hints and sourcemaps. Your bundler plugin will set it automatically.
rootDir?: string;
默认
process.cwd() on node-like environments, undefined elsewhere
¥default
process.cwd() on node-like environments, undefined elsewhere
用于确保文件名不会泄露文件系统信息。你的打包器插件将自动设置它。
¥Used for ensuring filenames don’t leak filesystem information. Your bundler plugin will set it automatically.
warningFilter?: (warning: Warning) => boolean;
获取 Warning
作为参数并返回布尔值的函数。使用它来过滤掉警告。返回 true
以保留警告,返回 false
以丢弃它。
¥A function that gets a Warning
as an argument and returns a boolean.
Use this to filter out warnings. Return true
to keep the warning, false
to discard it.
预处理器(Preprocessor)
¥Preprocessor
脚本/样式预处理器,它接受一串代码并返回处理后的版本。
¥A script/style preprocessor that takes a string of code and returns a processed version.
type Preprocessor = (options: {
/**
* The script/style tag content
*/
content: string;
/**
* The attributes on the script/style tag
*/
attributes: Record<string, string | boolean>;
/**
* The whole Svelte file content
*/
markup: string;
/**
* The filename of the Svelte file
*/
filename?: string;
}) => Processed | void | Promise<Processed | void>;
PreprocessorGroup
预处理器组是一组应用于 Svelte 文件的预处理器。
¥A preprocessor group is a set of preprocessors that are applied to a Svelte file.
interface PreprocessorGroup {…}
name?: string;
预处理器的名称。在下一个主要版本中将成为必需选项
¥Name of the preprocessor. Will be a required option in the next major version
markup?: MarkupPreprocessor;
style?: Preprocessor;
script?: Preprocessor;
已处理(Processed)
¥Processed
预处理器运行的结果。如果预处理器未返回结果,则假定代码未更改。
¥The result of a preprocessor run. If the preprocessor does not return a result, it is assumed that the code is unchanged.
interface Processed {…}
code: string;
新代码
¥The new code
map?: string | object;
映射回原始代码的源映射
¥A source map mapping back to the original code
dependencies?: string[];
要监视更改的其他文件列表
¥A list of additional files to watch for changes
attributes?: Record<string, string | boolean>;
仅适用于脚本/样式预处理器:要在标签上设置的更新属性。如果未定义,属性保持不变。
¥Only for script/style preprocessors: The updated attributes to set on the tag. If undefined, attributes stay unchanged.
toString?: () => string;
警告(Warning)
¥Warning
interface Warning extends ICompileDiagnostic {}