API Reference
Qingkuai's API is organized by entry package, making on-demand imports easy and keeping responsibility boundaries clear. This article lists the public APIs exported from the source entry files of two packages: the runtime package qingkuai and the compiler package qingkuai/compiler.
The internal package qingkuai/internal is mainly intended for framework internals, and application code is generally not recommended to depend on it directly, so it is not covered here.
Runtime
The runtime package exports APIs for component lifecycle methods, contexts, reactive side effects, performance optimization, and state conversion.
Type Exports
BoundEffectFuncBoundLifecycleFuncBoundSetContextFuncBoundSetContextGetterFuncBoundWatchFuncComponentContextsComponentExportsComponentInstanceComponentPropsComponentRefsComponentShapeComponentSlotsDeclareComponentEffectCallbackEffectHandleHtmlBlockOptionsWatchCallback
See: Utility Types
Lifecycle
onAfterDestroyBuiltInonAfterMountBuiltInonAfterUpdateBuiltInonBeforeDestroyBuiltInonBeforeUpdateBuiltIn
See: Lifecycle. Note that inside component files these methods are built-in methods and can be called directly without importing. When importing them from the runtime package, the target component instance must be explicitly passed as the first argument.
Side Effects and Watchers
effectBuiltInpostEffectBuiltInpostWatchBuiltInpreEffectBuiltInpreWatchBuiltInsyncEffectBuiltInsyncWatchBuiltInwatchBuiltIn
See: Watchers and Side Effects. Like the lifecycle methods, when importing them from the runtime package, the first argument is the component instance or null.
Contexts
Used to operate on the contexts of a specific component instance in external logic: setContext writes a value into the target instance's contexts layer, setContextGetter writes a reactive getter, and getContexts returns the contexts chain-head object of the target instance. Inside component files, use the built-in methods setContext, setContextExp, and setContextGetter together with the built-in identifier contexts instead.
See: Contexts
Reactivity Optimization Controls
batchAndNoTrackingbatchUpdatingnoTrackingnoUpdatingpauseTrackingpauseUpdatingresumeTrackingresumeUpdatingstartBatchUpdatingstopBatchUpdating
State and Scheduling
createShallowStorecreateStoregetCurrentInstancemountAppnextTicktoRawtoReactivetoShallow
Other Exports
DESTRUCT_HTMLversion
Compiler (qingkuai/compiler)
The compiler package is used to parse and compile component source code. It is mainly consumed by build tools, language services, and plugin ecosystems.
Type Exports
ASTLocationASTPositionASTPositionWithFlagCompileIntermediateOptionsCompileIntermediateResultCompileOptionsCompileResultIdentifierStatusScriptDescriptorStyleDescriptorTemplateAttributeTemplateNodeTemplateNodeContextTextContentPart
Constants Object
The constants object exported by the compiler package contains the following properties:
LSCPRESERVED_IDPREFIXSPREAD_TAG
Utility Object
The util object exported by the compiler package contains the following properties:
camel2KebabfindEndBracketfindOutOfCommentfindOutOfLiteralfindOutOfLiteralCommentformatSourceCodeisEmbeddedLanguageTagisEmbeddedStyleTagisRequiredValueDirectiveisVoidTagkebab2CameltoPropertyKeyts
Flags
PositionFlagTestingMode
Methods
compilecompileIntermediateisCompileErrorisCompileWarningparseDirectiveValueparseEventFlagparseTemplate