@wevu/compiler 6.18.7 → 6.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -272,6 +272,7 @@ interface ScopedSlotComponentAsset {
272
272
  classStyleBindings?: ClassStyleBinding[];
273
273
  classStyleWxs?: boolean;
274
274
  inlineExpressions?: InlineExpressionAsset[];
275
+ templateRefs?: TemplateRefBinding[];
275
276
  }
276
277
  /**
277
278
  * 内联表达式资源描述。
@@ -566,6 +567,10 @@ interface CompileVueFileOptions {
566
567
  astEngine?: AstEngineName$1;
567
568
  isPage?: boolean;
568
569
  isApp?: boolean;
570
+ /**
571
+ * 是否把组件注册交给上层逻辑入口,当前模块仅导出组件选项。
572
+ */
573
+ skipComponentTransform?: boolean;
569
574
  /**
570
575
  * 是否压缩生成的 wevu 脚本输出。
571
576
  */
@@ -578,6 +583,16 @@ interface CompileVueFileOptions {
578
583
  autoUsingComponents?: AutoUsingComponentsOptions;
579
584
  autoImportTags?: AutoImportTagsOptions;
580
585
  template?: TemplateCompileOptions;
586
+ style?: {
587
+ /**
588
+ * 保留 Vue deep 选择器,交由目标平台的最终 CSS 阶段处理。
589
+ */
590
+ preserveDeepSelectors?: boolean;
591
+ /**
592
+ * 是否在当前阶段改写 scoped 选择器。预处理语言应由最终 CSS 管线完成隔离时可关闭。
593
+ */
594
+ transformScoped?: boolean;
595
+ };
581
596
  json?: {
582
597
  kind?: 'app' | 'page' | 'component';
583
598
  defaults?: JsonConfig['defaults'];
@@ -597,6 +612,32 @@ interface CompileVueFileOptions {
597
612
  */
598
613
  declare function compileJsxFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
599
614
  //#endregion
615
+ //#region src/plugins/uniApp/index.d.ts
616
+ type UniAppCompatibilityTarget = 'h5' | 'mp-weixin';
617
+ interface TransformUniAppSourceOptions {
618
+ blockType?: 'script' | 'sfc' | 'style' | 'template';
619
+ filename: string;
620
+ target: UniAppCompatibilityTarget;
621
+ }
622
+ /**
623
+ * 按目标平台移除 uni-app 条件编译分支,并保留原始换行以稳定错误位置。
624
+ */
625
+ declare function transformUniAppConditionalCode(source: string, options: TransformUniAppSourceOptions): {
626
+ changed: boolean;
627
+ code: string;
628
+ };
629
+ /**
630
+ * 转换单个受控 uni-app 源文件;未命中语法时返回原文。
631
+ */
632
+ declare function transformUniAppSource(source: string, options: TransformUniAppSourceOptions): {
633
+ changed: boolean;
634
+ code: string;
635
+ };
636
+ /**
637
+ * 判断文件是否属于项目源码或显式允许的 npm 包。
638
+ */
639
+ declare function isUniAppCompatibilityFile(filename: string, srcRoot: string, include: readonly string[]): boolean;
640
+ //#endregion
600
641
  //#region src/plugins/utils/cache.d.ts
601
642
  declare const mtimeCache: Map<string, {
602
643
  ctimeMs: number;
@@ -630,7 +671,14 @@ declare function invalidateFileCache(id: string): void;
630
671
  */
631
672
  declare function clearFileCaches(): void;
632
673
  //#endregion
674
+ //#region src/plugins/vue/compiler/wxss.d.ts
675
+ /**
676
+ * 压平 WXSS 不接受的嵌套 CSS 变量回退值。
677
+ */
678
+ declare function transformNestedWxssVars(source: string): string;
679
+ //#endregion
633
680
  //#region src/plugins/vue/compiler/style.d.ts
681
+ declare function transformVueDeepSelectors(source: string): string;
634
682
  /**
635
683
  * 样式编译结果。
636
684
  */
@@ -646,8 +694,10 @@ interface StyleCompileResult {
646
694
  interface StyleCompileOptions {
647
695
  id: string;
648
696
  scoped?: boolean;
697
+ transformScoped?: boolean;
649
698
  modules?: boolean | string;
650
699
  preprocessOptions?: Record<string, any>;
700
+ preserveDeepSelectors?: boolean;
651
701
  }
652
702
  /**
653
703
  * 将 Vue SFC 的 style 块转换为 WXSS
@@ -786,6 +836,11 @@ interface TransformResult {
786
836
  map?: EncodedSourceMapLike | null;
787
837
  }
788
838
  interface TransformScriptOptions {
839
+ /**
840
+ * 输入是否来自 TypeScript SFC 区块。
841
+ * TypeScript 输入必须经过 AST 路径清理类型语法,不能使用仅重排文本的 script setup 快速路径。
842
+ */
843
+ isTypeScript?: boolean;
789
844
  /**
790
845
  * 是否跳过组件转换(不添加 createWevuComponent 调用)
791
846
  * 用于 app.vue 等入口文件
@@ -1040,4 +1095,4 @@ interface CollectVueTemplateTagsOptions {
1040
1095
  */
1041
1096
  declare function collectVueTemplateTags(template: string, options: CollectVueTemplateTagsOptions): Set<string>;
1042
1097
  //#endregion
1043
- export { type AstEngineName, type AutoImportTagsOptions, type AutoUsingComponentsOptions, CLASS_STYLE_WXS_FILE, CLASS_STYLE_WXS_MODULE, type ClassStyleBinding, type ClassStyleRuntime, type CollectVueTemplateTagsOptions, type CompileVueFileOptions, type ForParseResult, type InlineExpressionAsset, type JsLikeLang, type JsonConfig, type JsonMergeContext, type JsonMergeStage, type JsonMergeStrategy, type MiniProgramPlatform, type ModuleResolver, type MpPlatform, RESERVED_VUE_COMPONENT_TAGS, type ReadAndParseSfcOptions, type ResolveSfcBlockSrcOptions, type ResolvedUsingComponentInfo, type ResolvedUsingComponentPath, type ScopedSlotComponentAsset, type SlotFallbackWrapperComponentAsset, type SlotFallbackWrapperStrategy, type StyleCompileOptions, type StyleCompileResult, type TemplateCompileOptions, type TemplateCompileResult, type TemplateRefBinding, type TransformResult, type TransformScriptOptions, VUE_COMPONENT_TAG_RE, type VueTransformResult, WE_VU_COMPILER_REACTIVITY_MODULE_ID, WE_VU_COMPILER_RUNTIME_MODULE_ID, WE_VU_COMPILER_TEMPLATE_MODULE_ID, WE_VU_INTERNAL_REACTIVITY_APIS, WE_VU_INTERNAL_REACTIVITY_MODULE_ID, WE_VU_INTERNAL_RUNTIME_MODULE_ID, WE_VU_INTERNAL_TEMPLATE_APIS, WE_VU_INTERNAL_TEMPLATE_MODULE_ID, WE_VU_MODULE_ID, WE_VU_PAGE_HOOK_TO_FEATURE, WE_VU_RUNTIME_APIS, WE_VU_RUNTIME_MODULE_IDS, type WevuDefaults, WevuPageFeatureFlag, WevuPageHookName, WevuRuntimeApiName, alipayPlatform, buildClassStyleComputedCode, buildClassStyleWxsTag, builtinComponentsSet, clearFileCaches, collectTargetOptionsObjectsFromCode, collectVueTemplateTags, collectWevuFeaturesFromCodeReachableImports, collectWevuPageFeatureFlags, collectWevuPageFeatureFlagsFromCode, compileConfigBlocks, compileJsxFile, compileVueFile as compileSfc, compileVueFile, compileVueStyleToWxss as compileStyle, compileVueStyleToWxss, compileVueTemplateToWxml as compileTemplate, compileVueTemplateToWxml, createJsonMerger, createPageEntryMatcher, defaultMiniProgramPlatform, defaultMiniProgramTemplatePlatform, defaultPlatform, evaluateJsLikeConfig, extractJsonMacroFromScriptSetup, generateScopedId, getClassStyleWxsSource, getDefaultMiniProgramPlatform, getDefaultMiniProgramTemplatePlatform, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeatureFlagsIntoOptionsObject, injectWevuPageFeaturesInJs, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, isInvalidate, isJsonLikeLang, isWevuRuntimeModuleId, loadCache, mayContainJsonMacro, mergeJsonWithStrategy, mtimeCache, normalizeConfigLang, pathExists, preprocessScriptSetupSrc, preprocessScriptSrc, readAndParseSfc, readFile, refreshVueFileJsonConfig, resolveClassStyleWxsLocation, resolveJsLikeLang, resolveSfcBlockSrc, resolveWevuInternalImportModuleId, restoreScriptSetupSrc, restoreScriptSrc, stripJsonMacroCallsFromCode, swanPlatform, transformScript, transformScript as transformSfcScript, ttPlatform, wechatPlatform };
1098
+ export { type AstEngineName, type AutoImportTagsOptions, type AutoUsingComponentsOptions, CLASS_STYLE_WXS_FILE, CLASS_STYLE_WXS_MODULE, type ClassStyleBinding, type ClassStyleRuntime, type CollectVueTemplateTagsOptions, type CompileVueFileOptions, type ForParseResult, type InlineExpressionAsset, type JsLikeLang, type JsonConfig, type JsonMergeContext, type JsonMergeStage, type JsonMergeStrategy, type MiniProgramPlatform, type ModuleResolver, type MpPlatform, RESERVED_VUE_COMPONENT_TAGS, type ReadAndParseSfcOptions, type ResolveSfcBlockSrcOptions, type ResolvedUsingComponentInfo, type ResolvedUsingComponentPath, type ScopedSlotComponentAsset, type SlotFallbackWrapperComponentAsset, type SlotFallbackWrapperStrategy, type StyleCompileOptions, type StyleCompileResult, type TemplateCompileOptions, type TemplateCompileResult, type TemplateRefBinding, type TransformResult, type TransformScriptOptions, type TransformUniAppSourceOptions, type UniAppCompatibilityTarget, VUE_COMPONENT_TAG_RE, type VueTransformResult, WE_VU_COMPILER_REACTIVITY_MODULE_ID, WE_VU_COMPILER_RUNTIME_MODULE_ID, WE_VU_COMPILER_TEMPLATE_MODULE_ID, WE_VU_INTERNAL_REACTIVITY_APIS, WE_VU_INTERNAL_REACTIVITY_MODULE_ID, WE_VU_INTERNAL_RUNTIME_MODULE_ID, WE_VU_INTERNAL_TEMPLATE_APIS, WE_VU_INTERNAL_TEMPLATE_MODULE_ID, WE_VU_MODULE_ID, WE_VU_PAGE_HOOK_TO_FEATURE, WE_VU_RUNTIME_APIS, WE_VU_RUNTIME_MODULE_IDS, type WevuDefaults, WevuPageFeatureFlag, WevuPageHookName, WevuRuntimeApiName, alipayPlatform, buildClassStyleComputedCode, buildClassStyleWxsTag, builtinComponentsSet, clearFileCaches, collectTargetOptionsObjectsFromCode, collectVueTemplateTags, collectWevuFeaturesFromCodeReachableImports, collectWevuPageFeatureFlags, collectWevuPageFeatureFlagsFromCode, compileConfigBlocks, compileJsxFile, compileVueFile as compileSfc, compileVueFile, compileVueStyleToWxss as compileStyle, compileVueStyleToWxss, compileVueTemplateToWxml as compileTemplate, compileVueTemplateToWxml, createJsonMerger, createPageEntryMatcher, defaultMiniProgramPlatform, defaultMiniProgramTemplatePlatform, defaultPlatform, evaluateJsLikeConfig, extractJsonMacroFromScriptSetup, generateScopedId, getClassStyleWxsSource, getDefaultMiniProgramPlatform, getDefaultMiniProgramTemplatePlatform, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeatureFlagsIntoOptionsObject, injectWevuPageFeaturesInJs, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, isInvalidate, isJsonLikeLang, isUniAppCompatibilityFile, isWevuRuntimeModuleId, loadCache, mayContainJsonMacro, mergeJsonWithStrategy, mtimeCache, normalizeConfigLang, pathExists, preprocessScriptSetupSrc, preprocessScriptSrc, readAndParseSfc, readFile, refreshVueFileJsonConfig, resolveClassStyleWxsLocation, resolveJsLikeLang, resolveSfcBlockSrc, resolveWevuInternalImportModuleId, restoreScriptSetupSrc, restoreScriptSrc, stripJsonMacroCallsFromCode, swanPlatform, transformNestedWxssVars, transformScript, transformScript as transformSfcScript, transformUniAppConditionalCode, transformUniAppSource, transformVueDeepSelectors, ttPlatform, wechatPlatform };