@wevu/compiler 7.3.0 → 7.5.0

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
@@ -1,6 +1,7 @@
1
- import { n as StaticRouteValue, t as StaticPageDeclaration } from "./public-DEO6JWFi.mjs";
1
+ import { n as StaticPageMeta, r as StaticRouteValue, t as StaticPageDeclaration } from "./public-BqBfNRjA.mjs";
2
2
  import { WevuBindingUpdateMode, WevuBindingUpdateMode as WevuBindingUpdateMode$1, WevuRuntimeBindingManifestV1, WevuRuntimeBindingRecordV1 } from "@weapp-core/constants";
3
3
  import { LRUCache } from "lru-cache";
4
+ import MagicString from "magic-string";
4
5
  import { SFCBlock, SFCDescriptor, SFCParseResult, SFCStyleBlock } from "vue/compiler-sfc";
5
6
  import * as t from "@weapp-vite/ast/babelTypes";
6
7
  import { Expression, File } from "@weapp-vite/ast/babelTypes";
@@ -134,6 +135,7 @@ export declare function createRuntimeBindingManifest(manifest: WevuBindingManife
134
135
  //#region src/constants.d.ts
135
136
  export declare const WE_VU_PAGE_HOOK_TO_FEATURE: {
136
137
  readonly onPageScroll: "enableOnPageScroll";
138
+ readonly usePageScrollRestoration: "enableOnPageScroll";
137
139
  readonly onPullDownRefresh: "enableOnPullDownRefresh";
138
140
  readonly onReachBottom: "enableOnReachBottom";
139
141
  readonly onRouteDone: "enableOnRouteDone";
@@ -180,6 +182,8 @@ export declare const WE_VU_RUNTIME_MODULE_IDS: readonly ["wevu", "wevu/internal-
180
182
  * 判断模块 ID 是否为 wevu 运行时入口。
181
183
  */
182
184
  export declare function isWevuRuntimeModuleId(moduleId: string): boolean;
185
+ /** 页面特性可由独立 router 入口的适配器启用,但该入口不提供组件工厂。 */
186
+ export declare function isWevuPageFeatureModuleId(moduleId: string): boolean;
183
187
  /**
184
188
  * wevu 运行时 API 名称映射。
185
189
  */
@@ -1895,6 +1899,10 @@ interface JsonMergeContext {
1895
1899
  filename?: string;
1896
1900
  kind?: 'app' | 'page' | 'component' | 'unknown';
1897
1901
  stage: JsonMergeStage;
1902
+ /** 当前 SFC 页面的静态路由声明。 */
1903
+ routeConfig?: StaticPageDeclaration;
1904
+ /** 整个页面元信息对象可静态提取时提供。 */
1905
+ pageMeta?: StaticPageMeta;
1898
1906
  }
1899
1907
  /**
1900
1908
  * JSON 合并函数。
@@ -1984,6 +1992,8 @@ interface MiniProgramDirectiveAttrs {
1984
1992
  */
1985
1993
  interface MiniProgramPlatform {
1986
1994
  name: string;
1995
+ /** 非微信宿主复用 WXML 语法时,显式关闭原生插槽上下文协议。 */
1996
+ nativeSlotContext?: boolean;
1987
1997
  directives: MiniProgramDirectiveAttrs;
1988
1998
  wrapIf: (exp: string, content: string, renderMustache: (exp: string) => string) => string;
1989
1999
  wrapElseIf: (exp: string, content: string, renderMustache: (exp: string) => string) => string;
@@ -2091,6 +2101,17 @@ interface ForParseResult {
2091
2101
  index?: string;
2092
2102
  key?: string;
2093
2103
  itemAliases?: Record<string, string>;
2104
+ /** 原生声明寻址使用实际 wx:key,不重新计算用户 key 表达式。 */
2105
+ effectiveNativeKey?: {
2106
+ kind: 'field';
2107
+ field: string;
2108
+ } | {
2109
+ kind: 'self';
2110
+ } | {
2111
+ kind: 'position';
2112
+ };
2113
+ /** 源码循环别名与避开祖先及编译器内建标识符的原生别名。 */
2114
+ nativeAliases?: Record<string, string>;
2094
2115
  /** 需要在逻辑层完整执行的原始循环项模式。 */
2095
2116
  itemPattern?: string;
2096
2117
  /** 当前循环项模式是否需要投影,避免模板层近似执行。 */
@@ -2110,6 +2131,8 @@ interface TemplateCompileOptions {
2110
2131
  propsAliases?: Record<string, string>;
2111
2132
  propsDerivedKeys?: string[];
2112
2133
  scriptSetupBindings?: Record<string, unknown>;
2134
+ /** 可能与宿主属性同名的 setup 绑定,通过独立计算字段交付模板。 */
2135
+ scriptSetupPropConflicts?: readonly string[];
2113
2136
  htmlTagToWxml?: boolean | Record<string, string>;
2114
2137
  htmlTagToWxmlTagClass?: boolean;
2115
2138
  scopedSlotsCompiler?: ScopedSlotsCompilerMode;
@@ -2122,6 +2145,10 @@ interface TemplateCompileOptions {
2122
2145
  objectLiteralBindMode?: ObjectLiteralBindMode;
2123
2146
  mustacheInterpolation?: MustacheInterpolationMode;
2124
2147
  formatWxml?: boolean;
2148
+ /**
2149
+ * 保留模板注释,供最终产物阶段统一处理;默认移除。
2150
+ */
2151
+ preserveComments?: boolean;
2125
2152
  runtimeBindingManifest?: WevuRuntimeBindingManifestMode;
2126
2153
  wxsExtension?: string;
2127
2154
  classStyleWxsSrc?: string;
@@ -2309,6 +2336,8 @@ interface VueTransformResult {
2309
2336
  componentGenerics?: TemplateCompileResult['componentGenerics'];
2310
2337
  classStyleWxs?: boolean;
2311
2338
  meta?: {
2339
+ routeConfig?: JsonMergeContext['routeConfig'];
2340
+ pageMeta?: JsonMergeContext['pageMeta'];
2312
2341
  /** @internal */
2313
2342
  componentStyleOptions?: ComponentStyleOptions;
2314
2343
  /** @internal */
@@ -2318,6 +2347,8 @@ interface VueTransformResult {
2318
2347
  jsonMacroHash?: string;
2319
2348
  defineOptionsHash?: string;
2320
2349
  sfcSrcDeps?: string[];
2350
+ /** 模板和脚本外部块的编译输入,变化时必须失效完整编译结果。@internal */
2351
+ sfcSrcCompilationDeps?: string[];
2321
2352
  /** 已解析样式中的 CSS 变量表达式快照。@internal */
2322
2353
  cssVars?: string[];
2323
2354
  styleBlocks?: SFCStyleBlock[];
@@ -2814,6 +2845,12 @@ interface TransformScriptOptions {
2814
2845
  * 当前组件模板包含 scoped slot outlet,需要接收 scoped slot 桥接属性。
2815
2846
  */
2816
2847
  scopedSlotHostProperties?: boolean;
2848
+ /**
2849
+ * 微信原生插槽上下文协议,由 SFC 编译期平台与插槽配置决定。
2850
+ *
2851
+ * @internal
2852
+ */
2853
+ nativeSlotContext?: boolean;
2817
2854
  /**
2818
2855
  * 当前 SFC 的 CSS Modules 映射。
2819
2856
  */
@@ -3002,4 +3039,4 @@ interface CollectVueTemplateTagsOptions {
3002
3039
  */
3003
3040
  export declare function collectVueTemplateTags(template: string, options: CollectVueTemplateTagsOptions): Set<string>;
3004
3041
  //#endregion
3005
- export { type AstEngineName, type AutoImportTagsOptions, type AutoUsingComponentsOptions, type BindingCondition, type ClassStyleBinding, type ClassStyleRuntime, type CollectVueTemplateTagsOptions, type CompileVueFileOptions, type CompilerAppShell, type CompilerDiagnostic, type CompilerDiagnosticCode, type CompilerDiagnosticSeverity, type CompilerDiagnosticSource, type CompilerLayoutPropValue, type CompilerPageLayout, type CompilerPageLayoutPlan, type ComponentStyleOptions, type ComponentStylePrimitive, type ExtractPageDeclarationWithDependenciesResult, type ForParseResult, type InlineExpressionAsset, type JsLikeLang, type JsonConfig, type JsonMergeContext, type JsonMergeStage, type JsonMergeStrategy, type MiniProgramPlatform, type ModuleResolver, type MpPlatform, type ReadAndParseSfcOptions, type ResolveSfcBlockSrcOptions, type ResolvedUsingComponentInfo, type ResolvedUsingComponentPath, type ScopedSlotComponentAsset, type SlotFallbackWrapperComponentAsset, type SlotFallbackWrapperStrategy, type SourcePosition, type SourceSpan, type StaticComponentStyleOption, type StaticPageDeclaration, type StaticRouteValue, type StyleCompileOptions, type StyleCompileResult, type TemplateCompileOptions, type TemplateCompileResult, type TemplateRefBinding, type TransformResult, type TransformScriptOptions, type TransformUniAppSourceOptions, type UniAppCompatibilityTarget, type VueSfcBlockChanges, type VueSfcBlockSignatures, type VueSfcBlockType, type VueSfcHmrSignatures, type VueTransformResult, type WevuBindingDependencyV1, type WevuBindingKind, type WevuBindingManifestFeaturesV1, type WevuBindingManifestV1, type WevuBindingRecordV1, type WevuBindingScopeV1, type WevuBindingUpdateMode, type WevuDefaults, type WevuRuntimeBindingManifestMode, type WevuRuntimeBindingManifestV1, type WevuRuntimeBindingRecordV1, compileVueFile as compileSfc, compileVueStyleToWxss as compileStyle, compileVueTemplateToWxml as compileTemplate, transformScript as transformSfcScript };
3042
+ export { type AstEngineName, type AutoImportTagsOptions, type AutoUsingComponentsOptions, type BindingCondition, type ClassStyleBinding, type ClassStyleRuntime, type CollectVueTemplateTagsOptions, type CompileVueFileOptions, type CompilerAppShell, type CompilerDiagnostic, type CompilerDiagnosticCode, type CompilerDiagnosticSeverity, type CompilerDiagnosticSource, type CompilerLayoutPropValue, type CompilerPageLayout, type CompilerPageLayoutPlan, type ComponentStyleOptions, type ComponentStylePrimitive, type ExtractPageDeclarationWithDependenciesResult, type ForParseResult, type InlineExpressionAsset, type JsLikeLang, type JsonConfig, type JsonMergeContext, type JsonMergeFunction, type JsonMergeStage, type JsonMergeStrategy, type MiniProgramPlatform, type ModuleResolver, type MpPlatform, type ReadAndParseSfcOptions, type ResolveSfcBlockSrcOptions, type ResolvedUsingComponentInfo, type ResolvedUsingComponentPath, type ScopedSlotComponentAsset, type SlotFallbackWrapperComponentAsset, type SlotFallbackWrapperStrategy, type SourcePosition, type SourceSpan, type StaticComponentStyleOption, type StaticPageDeclaration, type StaticPageMeta, type StaticRouteValue, type StyleCompileOptions, type StyleCompileResult, type TemplateCompileOptions, type TemplateCompileResult, type TemplateRefBinding, type TransformResult, type TransformScriptOptions, type TransformUniAppSourceOptions, type UniAppCompatibilityTarget, type VueSfcBlockChanges, type VueSfcBlockSignatures, type VueSfcBlockType, type VueSfcHmrSignatures, type VueTransformResult, type WevuBindingDependencyV1, type WevuBindingKind, type WevuBindingManifestFeaturesV1, type WevuBindingManifestV1, type WevuBindingRecordV1, type WevuBindingScopeV1, type WevuBindingUpdateMode, type WevuDefaults, type WevuRuntimeBindingManifestMode, type WevuRuntimeBindingManifestV1, type WevuRuntimeBindingRecordV1, compileVueFile as compileSfc, compileVueStyleToWxss as compileStyle, compileVueTemplateToWxml as compileTemplate, transformScript as transformSfcScript };