@wevu/compiler 7.0.2 → 7.0.4

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.
Files changed (2) hide show
  1. package/dist/index.d.mts +92 -92
  2. package/package.json +5 -5
package/dist/index.d.mts CHANGED
@@ -9,14 +9,14 @@ import "@weapp-vite/ast/babelTraverse";
9
9
  /**
10
10
  * 内置组件集合(来自自动生成的组件列表)。
11
11
  */
12
- declare const builtinComponentsSet: Set<string>;
12
+ export declare const builtinComponentsSet: Set<string>;
13
13
  /**
14
14
  * 判断标签是否为内置组件。
15
15
  */
16
- declare function isBuiltinComponent(tag: string): boolean;
16
+ export declare function isBuiltinComponent(tag: string): boolean;
17
17
  //#endregion
18
18
  //#region src/constants.d.ts
19
- declare const WE_VU_PAGE_HOOK_TO_FEATURE: {
19
+ export declare const WE_VU_PAGE_HOOK_TO_FEATURE: {
20
20
  readonly onPageScroll: "enableOnPageScroll";
21
21
  readonly onPullDownRefresh: "enableOnPullDownRefresh";
22
22
  readonly onReachBottom: "enableOnReachBottom";
@@ -31,43 +31,43 @@ declare const WE_VU_PAGE_HOOK_TO_FEATURE: {
31
31
  /**
32
32
  * wevu 运行时模块 ID。
33
33
  */
34
- declare const WE_VU_MODULE_ID: "wevu";
34
+ export declare const WE_VU_MODULE_ID: "wevu";
35
35
  /**
36
36
  * wevu 编译产物内部运行时模块 ID。
37
37
  */
38
- declare const WE_VU_INTERNAL_RUNTIME_MODULE_ID: "wevu/internal-runtime";
38
+ export declare const WE_VU_INTERNAL_RUNTIME_MODULE_ID: "wevu/internal-runtime";
39
39
  /**
40
40
  * wevu 编译产物内部响应式模块 ID。
41
41
  */
42
- declare const WE_VU_INTERNAL_REACTIVITY_MODULE_ID: "wevu/internal-reactivity";
42
+ export declare const WE_VU_INTERNAL_REACTIVITY_MODULE_ID: "wevu/internal-reactivity";
43
43
  /**
44
44
  * wevu 编译产物内部模板工具模块 ID。
45
45
  */
46
- declare const WE_VU_INTERNAL_TEMPLATE_MODULE_ID: "wevu/internal-template";
46
+ export declare const WE_VU_INTERNAL_TEMPLATE_MODULE_ID: "wevu/internal-template";
47
47
  /**
48
48
  * wevu 编译产物使用的稳定运行时虚拟模块 ID。
49
49
  */
50
- declare const WE_VU_COMPILER_RUNTIME_MODULE_ID = "virtual:weapp-vite/runtime";
50
+ export declare const WE_VU_COMPILER_RUNTIME_MODULE_ID = "virtual:weapp-vite/runtime";
51
51
  /**
52
52
  * wevu 编译产物使用的稳定响应式虚拟模块 ID。
53
53
  */
54
- declare const WE_VU_COMPILER_REACTIVITY_MODULE_ID = "virtual:weapp-vite/runtime/reactivity";
54
+ export declare const WE_VU_COMPILER_REACTIVITY_MODULE_ID = "virtual:weapp-vite/runtime/reactivity";
55
55
  /**
56
56
  * wevu 编译产物使用的稳定模板工具虚拟模块 ID。
57
57
  */
58
- declare const WE_VU_COMPILER_TEMPLATE_MODULE_ID = "virtual:weapp-vite/runtime/template";
58
+ export declare const WE_VU_COMPILER_TEMPLATE_MODULE_ID = "virtual:weapp-vite/runtime/template";
59
59
  /**
60
60
  * wevu 运行时模块 ID 列表。
61
61
  */
62
- declare const WE_VU_RUNTIME_MODULE_IDS: readonly ["wevu", "wevu/internal-runtime", "virtual:weapp-vite/runtime", "virtual:weapp-vite/runtime/reactivity", "virtual:weapp-vite/runtime/template"];
62
+ export declare const WE_VU_RUNTIME_MODULE_IDS: readonly ["wevu", "wevu/internal-runtime", "virtual:weapp-vite/runtime", "virtual:weapp-vite/runtime/reactivity", "virtual:weapp-vite/runtime/template"];
63
63
  /**
64
64
  * 判断模块 ID 是否为 wevu 运行时入口。
65
65
  */
66
- declare function isWevuRuntimeModuleId(moduleId: string): boolean;
66
+ export declare function isWevuRuntimeModuleId(moduleId: string): boolean;
67
67
  /**
68
68
  * wevu 运行时 API 名称映射。
69
69
  */
70
- declare const WE_VU_RUNTIME_APIS: {
70
+ export declare const WE_VU_RUNTIME_APIS: {
71
71
  readonly createApp: "createApp";
72
72
  readonly createWevuComponent: "createWevuComponent";
73
73
  readonly createWevuScopedSlotComponent: "createWevuScopedSlotComponent";
@@ -78,19 +78,19 @@ declare const WE_VU_RUNTIME_APIS: {
78
78
  /**
79
79
  * wevu 运行时 API 名称类型。
80
80
  */
81
- type WevuRuntimeApiName = (typeof WE_VU_RUNTIME_APIS)[keyof typeof WE_VU_RUNTIME_APIS];
81
+ export type WevuRuntimeApiName = (typeof WE_VU_RUNTIME_APIS)[keyof typeof WE_VU_RUNTIME_APIS];
82
82
  /**
83
83
  * wevu 内部响应式 API 名称。
84
84
  */
85
- declare const WE_VU_INTERNAL_REACTIVITY_APIS: readonly ["addMutationRecorder", "batch", "computed", "customRef", "effect", "effectScope", "endBatch", "getCurrentScope", "getDeepWatchStrategy", "getReactiveVersion", "isProxy", "isRaw", "isReactive", "isReadonly", "isRef", "isShallowReactive", "isShallowRef", "markRaw", "nextTick", "onScopeDispose", "prelinkReactiveTree", "reactive", "readonly", "ref", "removeMutationRecorder", "setDeepWatchStrategy", "shallowReactive", "shallowReadonly", "shallowRef", "startBatch", "stop", "toRaw", "toRef", "toRefs", "toValue", "touchReactive", "traverse", "triggerRef", "unref", "watch", "watchEffect", "watchPostEffect", "watchSyncEffect"];
85
+ export declare const WE_VU_INTERNAL_REACTIVITY_APIS: readonly ["addMutationRecorder", "batch", "computed", "customRef", "effect", "effectScope", "endBatch", "getCurrentScope", "getDeepWatchStrategy", "getReactiveVersion", "isProxy", "isRaw", "isReactive", "isReadonly", "isRef", "isShallowReactive", "isShallowRef", "markRaw", "nextTick", "onScopeDispose", "prelinkReactiveTree", "reactive", "readonly", "ref", "removeMutationRecorder", "setDeepWatchStrategy", "shallowReactive", "shallowReadonly", "shallowRef", "startBatch", "stop", "toRaw", "toRef", "toRefs", "toValue", "touchReactive", "traverse", "triggerRef", "unref", "watch", "watchEffect", "watchPostEffect", "watchSyncEffect"];
86
86
  /**
87
87
  * wevu 内部模板工具 API 名称。
88
88
  */
89
- declare const WE_VU_INTERNAL_TEMPLATE_APIS: readonly ["normalizeClass", "normalizeStyle", "resolvePropValue"];
89
+ export declare const WE_VU_INTERNAL_TEMPLATE_APIS: readonly ["normalizeClass", "normalizeStyle", "resolvePropValue"];
90
90
  /**
91
91
  * 根据 wevu API 名称解析编译产物内部导入入口。
92
92
  */
93
- declare function resolveWevuInternalImportModuleId(apiName: string): "virtual:weapp-vite/runtime" | "virtual:weapp-vite/runtime/reactivity" | "virtual:weapp-vite/runtime/template";
93
+ export declare function resolveWevuInternalImportModuleId(apiName: string): "virtual:weapp-vite/runtime" | "virtual:weapp-vite/runtime/reactivity" | "virtual:weapp-vite/runtime/template";
94
94
  //#endregion
95
95
  //#region src/types/diagnostics.d.ts
96
96
  type CompilerDiagnosticCode = 'WV1002' | 'WV1003' | 'WV2002' | 'WV2001' | 'WV1001';
@@ -200,7 +200,7 @@ interface ResolveSfcBlockSrcOptions {
200
200
  /**
201
201
  * 解析 SFC 中带 `src` 的 block,并返回依赖列表。
202
202
  */
203
- declare function resolveSfcBlockSrc(descriptor: SFCDescriptor, filename: string, options?: ResolveSfcBlockSrcOptions): Promise<{
203
+ export declare function resolveSfcBlockSrc(descriptor: SFCDescriptor, filename: string, options?: ResolveSfcBlockSrcOptions): Promise<{
204
204
  descriptor: SFCDescriptor;
205
205
  deps: string[];
206
206
  templateResolvedId?: string;
@@ -235,23 +235,23 @@ interface ReadAndParseSfcOptions {
235
235
  /**
236
236
  * 预处理 `<script setup src>`,避免编译器丢失 src。
237
237
  */
238
- declare function preprocessScriptSetupSrc(source: string): string;
238
+ export declare function preprocessScriptSetupSrc(source: string): string;
239
239
  /**
240
240
  * 预处理普通 `<script src>`,避免编译器丢失 src。
241
241
  */
242
- declare function preprocessScriptSrc(source: string): string;
242
+ export declare function preprocessScriptSrc(source: string): string;
243
243
  /**
244
244
  * 将预处理的 `<script setup src>` 恢复为真实 src。
245
245
  */
246
- declare function restoreScriptSetupSrc(descriptor: SFCDescriptor): void;
246
+ export declare function restoreScriptSetupSrc(descriptor: SFCDescriptor): void;
247
247
  /**
248
248
  * 将预处理的 `<script src>` 恢复为真实 src。
249
249
  */
250
- declare function restoreScriptSrc(descriptor: SFCDescriptor): void;
250
+ export declare function restoreScriptSrc(descriptor: SFCDescriptor): void;
251
251
  /**
252
252
  * 读取并解析 SFC,支持缓存与 src 解析。
253
253
  */
254
- declare function readAndParseSfc(filename: string, options?: ReadAndParseSfcOptions): Promise<{
254
+ export declare function readAndParseSfc(filename: string, options?: ReadAndParseSfcOptions): Promise<{
255
255
  source: string;
256
256
  descriptor: SFCDescriptor;
257
257
  errors: SFCParseResult['errors'];
@@ -259,7 +259,7 @@ declare function readAndParseSfc(filename: string, options?: ReadAndParseSfcOpti
259
259
  /**
260
260
  * 获取 SFC 读取时是否检查 mtime 的策略。
261
261
  */
262
- declare function getSfcCheckMtime(config?: {
262
+ export declare function getSfcCheckMtime(config?: {
263
263
  isDev?: boolean;
264
264
  }): boolean;
265
265
  //#endregion
@@ -486,7 +486,7 @@ interface LayoutHostBinding {
486
486
  }
487
487
  //#endregion
488
488
  //#region src/plugins/vue/compiler/template/platforms/alipay.d.ts
489
- declare const alipayPlatform: MiniProgramPlatform;
489
+ export declare const alipayPlatform: MiniProgramPlatform;
490
490
  //#endregion
491
491
  //#region src/plugins/vue/compiler/template/platforms/default.d.ts
492
492
  /**
@@ -495,47 +495,47 @@ declare const alipayPlatform: MiniProgramPlatform;
495
495
  * 当前默认实现与微信模板语义保持一致,但应作为默认平台接入点使用,
496
496
  * 以避免内部链路继续绑定具体宿主命名。
497
497
  */
498
- declare const defaultMiniProgramPlatform: MiniProgramPlatform;
498
+ export declare const defaultMiniProgramPlatform: MiniProgramPlatform;
499
499
  /**
500
500
  * 默认模板平台对象的简写别名。
501
501
  */
502
- declare const defaultPlatform: MiniProgramPlatform;
502
+ export declare const defaultPlatform: MiniProgramPlatform;
503
503
  //#endregion
504
504
  //#region src/plugins/vue/compiler/template/platforms/swan.d.ts
505
- declare const swanPlatform: MiniProgramPlatform;
505
+ export declare const swanPlatform: MiniProgramPlatform;
506
506
  //#endregion
507
507
  //#region src/plugins/vue/compiler/template/platforms/tt.d.ts
508
- declare const ttPlatform: MiniProgramPlatform;
508
+ export declare const ttPlatform: MiniProgramPlatform;
509
509
  //#endregion
510
510
  //#region src/plugins/vue/compiler/template/platforms/index.d.ts
511
511
  /**
512
512
  * 获取默认模板适配器。
513
513
  */
514
- declare function getDefaultMiniProgramTemplatePlatform(): MiniProgramPlatform;
514
+ export declare function getDefaultMiniProgramTemplatePlatform(): MiniProgramPlatform;
515
515
  /**
516
516
  * 获取默认小程序平台适配器。
517
517
  */
518
- declare const getDefaultMiniProgramPlatform: typeof getDefaultMiniProgramTemplatePlatform;
518
+ export declare const getDefaultMiniProgramPlatform: typeof getDefaultMiniProgramTemplatePlatform;
519
519
  /**
520
520
  * 默认模板平台对象别名,便于调用方避免继续依赖具体宿主命名。
521
521
  */
522
- declare const defaultMiniProgramTemplatePlatform: MiniProgramPlatform;
522
+ export declare const defaultMiniProgramTemplatePlatform: MiniProgramPlatform;
523
523
  /**
524
524
  * 微信模板平台兼容别名。
525
525
  *
526
526
  * 新代码应优先使用 defaultMiniProgramPlatform/defaultPlatform。
527
527
  */
528
- declare const wechatPlatform: MiniProgramPlatform;
528
+ export declare const wechatPlatform: MiniProgramPlatform;
529
529
  /**
530
530
  * 获取指定平台的模板适配器,默认回退到默认模板平台。
531
531
  */
532
- declare function getMiniProgramTemplatePlatform(platform?: MpPlatform): MiniProgramPlatform;
532
+ export declare function getMiniProgramTemplatePlatform(platform?: MpPlatform): MiniProgramPlatform;
533
533
  //#endregion
534
534
  //#region src/plugins/vue/compiler/template.d.ts
535
535
  /**
536
536
  * 将 Vue 模板编译为 WXML。
537
537
  */
538
- declare function compileVueTemplateToWxml(template: string, filename: string, options?: TemplateCompileOptions): TemplateCompileResult;
538
+ export declare function compileVueTemplateToWxml(template: string, filename: string, options?: TemplateCompileOptions): TemplateCompileResult;
539
539
  //#endregion
540
540
  //#region src/plugins/vue/transform/compileVueFile/types.d.ts
541
541
  interface ResolvedUsingComponentInfo {
@@ -670,7 +670,7 @@ interface CompileVueFileOptions {
670
670
  /**
671
671
  * 编译 JSX/TSX 文件,输出 wevu 脚本与 WXML 模板。
672
672
  */
673
- declare function compileJsxFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
673
+ export declare function compileJsxFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
674
674
  //#endregion
675
675
  //#region src/plugins/uniApp/index.d.ts
676
676
  type UniAppCompatibilityTarget = 'h5' | 'mp-weixin';
@@ -682,60 +682,60 @@ interface TransformUniAppSourceOptions {
682
682
  /**
683
683
  * 按目标平台移除 uni-app 条件编译分支,并保留原始换行以稳定错误位置。
684
684
  */
685
- declare function transformUniAppConditionalCode(source: string, options: TransformUniAppSourceOptions): {
685
+ export declare function transformUniAppConditionalCode(source: string, options: TransformUniAppSourceOptions): {
686
686
  changed: boolean;
687
687
  code: string;
688
688
  };
689
689
  /**
690
690
  * 转换单个受控 uni-app 源文件;未命中语法时返回原文。
691
691
  */
692
- declare function transformUniAppSource(source: string, options: TransformUniAppSourceOptions): {
692
+ export declare function transformUniAppSource(source: string, options: TransformUniAppSourceOptions): {
693
693
  changed: boolean;
694
694
  code: string;
695
695
  };
696
696
  /**
697
697
  * 判断文件是否属于项目源码或显式允许的 npm 包。
698
698
  */
699
- declare function isUniAppCompatibilityFile(filename: string, srcRoot: string, include: readonly string[]): boolean;
699
+ export declare function isUniAppCompatibilityFile(filename: string, srcRoot: string, include: readonly string[]): boolean;
700
700
  //#endregion
701
701
  //#region src/plugins/utils/cache.d.ts
702
- declare const mtimeCache: Map<string, {
702
+ export declare const mtimeCache: Map<string, {
703
703
  ctimeMs: number;
704
704
  ino: number;
705
705
  mtimeMs: number;
706
706
  size: number;
707
707
  }>;
708
- declare const loadCache: LRUCache<string, string, unknown>;
708
+ export declare const loadCache: LRUCache<string, string, unknown>;
709
709
  /**
710
710
  * 返回 true 的时候需要重新 fs 读取
711
711
  * @param id 文件路径
712
712
  * @returns {Promise<boolean>} 当文件需要重新读取时返回 true
713
713
  */
714
- declare function isInvalidate(id: string): Promise<boolean>;
715
- declare function readFile(id: string, options?: {
714
+ export declare function isInvalidate(id: string): Promise<boolean>;
715
+ export declare function readFile(id: string, options?: {
716
716
  checkMtime?: boolean;
717
717
  encoding?: BufferEncoding;
718
718
  }): Promise<string>;
719
719
  /**
720
720
  * 判断文件或路径是否存在,可选缓存。
721
721
  */
722
- declare function pathExists(id: string, options?: {
722
+ export declare function pathExists(id: string, options?: {
723
723
  ttlMs?: number;
724
724
  }): Promise<boolean>;
725
725
  /**
726
726
  * 清理指定文件相关的缓存。
727
727
  */
728
- declare function invalidateFileCache(id: string): void;
728
+ export declare function invalidateFileCache(id: string): void;
729
729
  /**
730
730
  * 清空所有文件缓存。
731
731
  */
732
- declare function clearFileCaches(): void;
732
+ export declare function clearFileCaches(): void;
733
733
  //#endregion
734
734
  //#region src/plugins/vue/compiler/wxss.d.ts
735
735
  /**
736
736
  * 压平 WXSS 不接受的嵌套 CSS 变量回退值。
737
737
  */
738
- declare function transformNestedWxssVars(source: string): string;
738
+ export declare function transformNestedWxssVars(source: string): string;
739
739
  //#endregion
740
740
  //#region src/plugins/vue/compiler/style.d.ts
741
741
  /**
@@ -764,32 +764,32 @@ interface StyleCompileOptions {
764
764
  /**
765
765
  * compiler-sfc 已在 scoped 插件中处理 deep 选择器,此函数保留为兼容入口。
766
766
  */
767
- declare function transformVueDeepSelectors(source: string): string;
767
+ export declare function transformVueDeepSelectors(source: string): string;
768
768
  /**
769
769
  * 将 Vue SFC style 块编译为可交给 Vite CSS 管线的内容。
770
770
  */
771
- declare function compileVueStyleToWxss(styleBlock: SFCStyleBlock, options: StyleCompileOptions): Promise<StyleCompileResult>;
771
+ export declare function compileVueStyleToWxss(styleBlock: SFCStyleBlock, options: StyleCompileOptions): Promise<StyleCompileResult>;
772
772
  //#endregion
773
773
  //#region src/plugins/vue/compiler/template/classStyleRuntime.d.ts
774
774
  /**
775
775
  * class/style WXS 模块名。
776
776
  */
777
- declare const CLASS_STYLE_WXS_MODULE = "__weapp_vite";
777
+ export declare const CLASS_STYLE_WXS_MODULE = "__weapp_vite";
778
778
  /**
779
779
  * class/style WXS 文件名(不含扩展名)。
780
780
  */
781
- declare const CLASS_STYLE_WXS_FILE = "__weapp_vite_class_style";
781
+ export declare const CLASS_STYLE_WXS_FILE = "__weapp_vite_class_style";
782
782
  interface ClassStyleWxsSourceOptions {
783
783
  extension?: string;
784
784
  }
785
785
  /**
786
786
  * 构建 class/style WXS 引用标签。
787
787
  */
788
- declare function buildClassStyleWxsTag(extension: string, src?: string): string;
788
+ export declare function buildClassStyleWxsTag(extension: string, src?: string): string;
789
789
  /**
790
790
  * 解析 class/style WXS 文件位置与引用路径。
791
791
  */
792
- declare function resolveClassStyleWxsLocation(options: {
792
+ export declare function resolveClassStyleWxsLocation(options: {
793
793
  relativeBase: string;
794
794
  extension: string;
795
795
  packageRoot?: string;
@@ -800,10 +800,10 @@ declare function resolveClassStyleWxsLocation(options: {
800
800
  /**
801
801
  * 获取内置 class/style WXS 运行时代码。
802
802
  */
803
- declare function getClassStyleWxsSource(options?: ClassStyleWxsSourceOptions): string;
803
+ export declare function getClassStyleWxsSource(options?: ClassStyleWxsSourceOptions): string;
804
804
  //#endregion
805
805
  //#region src/plugins/vue/hmr/sfcSignature.d.ts
806
- declare const VUE_SFC_BLOCK_TYPES: readonly ["script", "template", "style", "config"];
806
+ export declare const VUE_SFC_BLOCK_TYPES: readonly ["script", "template", "style", "config"];
807
807
  type VueSfcBlockType = typeof VUE_SFC_BLOCK_TYPES[number];
808
808
  type VueSfcBlockSignatures = Readonly<Record<VueSfcBlockType, string>>;
809
809
  type VueSfcBlockChanges = VueSfcBlockType[];
@@ -817,13 +817,13 @@ interface VueSfcHmrSignatures {
817
817
  readonly tailwindScriptContentSignature?: string;
818
818
  readonly tailwindTemplateContentSignature?: string;
819
819
  }
820
- declare function resolveVueSfcHmrSignatures(source: string, filename: string): VueSfcHmrSignatures;
821
- declare function classifyVueSfcBlockChanges(previous: VueSfcBlockSignatures, current: VueSfcBlockSignatures): VueSfcBlockChanges;
822
- declare function resolveVueSfcNonJsonSignature(source: string, filename: string): string | undefined;
823
- declare function resolveVueSfcScriptSignature(source: string, filename: string): string | undefined;
824
- declare function resolveVueSfcStyleIndependentSignature(source: string, filename: string): string | undefined;
825
- declare function resolveVueSfcTailwindContentSignature(source: string, filename: string): string | undefined;
826
- declare function resolveVueSfcHasTemplate(source: string, filename: string): boolean | undefined;
820
+ export declare function resolveVueSfcHmrSignatures(source: string, filename: string): VueSfcHmrSignatures;
821
+ export declare function classifyVueSfcBlockChanges(previous: VueSfcBlockSignatures, current: VueSfcBlockSignatures): VueSfcBlockChanges;
822
+ export declare function resolveVueSfcNonJsonSignature(source: string, filename: string): string | undefined;
823
+ export declare function resolveVueSfcScriptSignature(source: string, filename: string): string | undefined;
824
+ export declare function resolveVueSfcStyleIndependentSignature(source: string, filename: string): string | undefined;
825
+ export declare function resolveVueSfcTailwindContentSignature(source: string, filename: string): string | undefined;
826
+ export declare function resolveVueSfcHasTemplate(source: string, filename: string): boolean | undefined;
827
827
  //#endregion
828
828
  //#region src/plugins/vue/transform/classStyleComputed.d.ts
829
829
  interface ClassStyleHelperNames {
@@ -831,7 +831,7 @@ interface ClassStyleHelperNames {
831
831
  normalizeStyleName: string;
832
832
  unrefName?: string;
833
833
  }
834
- declare function buildClassStyleComputedCode(bindings: ClassStyleBinding[], helpers: ClassStyleHelperNames): string | null;
834
+ export declare function buildClassStyleComputedCode(bindings: ClassStyleBinding[], helpers: ClassStyleHelperNames): string | null;
835
835
  //#endregion
836
836
  //#region src/plugins/vue/transform/compileVueFile/jsonOnly.d.ts
837
837
  /**
@@ -839,13 +839,13 @@ declare function buildClassStyleComputedCode(bindings: ClassStyleBinding[], help
839
839
  *
840
840
  * @internal
841
841
  */
842
- declare function refreshVueFileJsonConfig(source: string, filename: string, cachedResult: VueTransformResult, options?: CompileVueFileOptions): Promise<VueTransformResult | undefined>;
842
+ export declare function refreshVueFileJsonConfig(source: string, filename: string, cachedResult: VueTransformResult, options?: CompileVueFileOptions): Promise<VueTransformResult | undefined>;
843
843
  //#endregion
844
844
  //#region src/plugins/vue/transform/compileVueFile/index.d.ts
845
845
  /**
846
846
  * 编译 Vue 单文件组件,输出脚本、模板、样式与配置结果。
847
847
  */
848
- declare function compileVueFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
848
+ export declare function compileVueFile(source: string, filename: string, options?: CompileVueFileOptions): Promise<VueTransformResult>;
849
849
  //#endregion
850
850
  //#region src/plugins/vue/transform/config.d.ts
851
851
  /**
@@ -855,40 +855,40 @@ type JsLikeLang = 'js' | 'ts';
855
855
  /**
856
856
  * 规范化配置块语言。
857
857
  */
858
- declare function normalizeConfigLang(lang?: string): string;
858
+ export declare function normalizeConfigLang(lang?: string): string;
859
859
  /**
860
860
  * 判断是否为 JSON 类语言。
861
861
  */
862
- declare function isJsonLikeLang(lang: string): lang is "json" | "jsonc" | "json5";
862
+ export declare function isJsonLikeLang(lang: string): lang is "json" | "jsonc" | "json5";
863
863
  /**
864
864
  * 将语言标识归一为 js/ts。
865
865
  */
866
- declare function resolveJsLikeLang(lang: string): JsLikeLang;
866
+ export declare function resolveJsLikeLang(lang: string): JsLikeLang;
867
867
  /**
868
868
  * 执行 JS/TS 配置块并返回对象结果。
869
869
  */
870
- declare function evaluateJsLikeConfig(source: string, filename: string, lang: string): Promise<any>;
870
+ export declare function evaluateJsLikeConfig(source: string, filename: string, lang: string): Promise<any>;
871
871
  /**
872
872
  * 编译 SFC 内的 <json> 配置块并返回 JSON 字符串。
873
873
  */
874
- declare function compileConfigBlocks(blocks: SFCBlock[], filename: string, options?: {
874
+ export declare function compileConfigBlocks(blocks: SFCBlock[], filename: string, options?: {
875
875
  merge?: (target: Record<string, any>, source: Record<string, any>) => Record<string, any> | void;
876
876
  }): Promise<string | undefined>;
877
877
  //#endregion
878
878
  //#region src/plugins/vue/transform/jsonMacros/parse.d.ts
879
- declare function mayContainJsonMacro(content: string): boolean;
879
+ export declare function mayContainJsonMacro(content: string): boolean;
880
880
  //#endregion
881
881
  //#region src/plugins/vue/transform/jsonMacros/rewrite.d.ts
882
882
  /**
883
883
  * 从任意代码中剥离 JSON 宏调用。
884
884
  */
885
- declare function stripJsonMacroCallsFromCode(code: string, filename: string): string;
885
+ export declare function stripJsonMacroCallsFromCode(code: string, filename: string): string;
886
886
  //#endregion
887
887
  //#region src/plugins/vue/transform/jsonMacros/index.d.ts
888
888
  /**
889
889
  * 从 `<script setup>` 中提取 JSON 宏配置并返回剥离后的代码。
890
890
  */
891
- declare function extractJsonMacroFromScriptSetup(content: string, filename: string, lang?: string, options?: {
891
+ export declare function extractJsonMacroFromScriptSetup(content: string, filename: string, lang?: string, options?: {
892
892
  merge?: (target: Record<string, any>, source: Record<string, any>) => Record<string, any> | void;
893
893
  preambleContent?: string;
894
894
  }): Promise<{
@@ -902,17 +902,17 @@ declare function extractJsonMacroFromScriptSetup(content: string, filename: stri
902
902
  /**
903
903
  * 按策略合并 JSON 配置对象。
904
904
  */
905
- declare function mergeJsonWithStrategy(target: Record<string, any>, source: Record<string, any>, strategy: JsonMergeStrategy | undefined, context: JsonMergeContext): Record<string, any>;
905
+ export declare function mergeJsonWithStrategy(target: Record<string, any>, source: Record<string, any>, strategy: JsonMergeStrategy | undefined, context: JsonMergeContext): Record<string, any>;
906
906
  /**
907
907
  * 创建带上下文的 JSON 合并函数。
908
908
  */
909
- declare function createJsonMerger(strategy: JsonMergeStrategy | undefined, baseContext: Omit<JsonMergeContext, 'stage'>): (target: Record<string, any>, source: Record<string, any>, stage: JsonMergeContext["stage"]) => Record<string, any>;
909
+ export declare function createJsonMerger(strategy: JsonMergeStrategy | undefined, baseContext: Omit<JsonMergeContext, 'stage'>): (target: Record<string, any>, source: Record<string, any>, stage: JsonMergeContext["stage"]) => Record<string, any>;
910
910
  //#endregion
911
911
  //#region src/plugins/vue/transform/scopedId.d.ts
912
912
  /**
913
913
  * 根据项目内相对路径生成跨机器稳定的 scoped ID。
914
914
  */
915
- declare function generateScopedId(filename: string): string;
915
+ export declare function generateScopedId(filename: string): string;
916
916
  //#endregion
917
917
  //#region src/plugins/vue/transform/transformScript/utils.d.ts
918
918
  /**
@@ -1016,17 +1016,17 @@ interface TransformScriptOptions {
1016
1016
  /**
1017
1017
  * 转换 Vue SFC 脚本:处理宏、导入、默认导出与 wevu 相关注入。
1018
1018
  */
1019
- declare function transformScript(source: string, options?: TransformScriptOptions): TransformResult;
1019
+ export declare function transformScript(source: string, options?: TransformScriptOptions): TransformResult;
1020
1020
  //#endregion
1021
1021
  //#region src/plugins/wevu/pageFeatures/types.d.ts
1022
1022
  /**
1023
1023
  * wevu 页面特性标识(由钩子映射表推导)。
1024
1024
  */
1025
- type WevuPageFeatureFlag = (typeof WE_VU_PAGE_HOOK_TO_FEATURE)[keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE];
1025
+ export type WevuPageFeatureFlag = (typeof WE_VU_PAGE_HOOK_TO_FEATURE)[keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE];
1026
1026
  /**
1027
1027
  * wevu 页面钩子名称。
1028
1028
  */
1029
- type WevuPageHookName = keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE;
1029
+ export type WevuPageHookName = keyof typeof WE_VU_PAGE_HOOK_TO_FEATURE;
1030
1030
  /**
1031
1031
  * 模块解析器,用于注入特性时按需解析模块与源码。
1032
1032
  */
@@ -1039,7 +1039,7 @@ interface ModuleResolver {
1039
1039
  /**
1040
1040
  * 从源码中收集 wevu 页面特性。
1041
1041
  */
1042
- declare function collectWevuPageFeatureFlagsFromCode(code: string, options?: {
1042
+ export declare function collectWevuPageFeatureFlagsFromCode(code: string, options?: {
1043
1043
  astEngine?: AstEngineName$1;
1044
1044
  }): Set<WevuPageFeatureFlag>;
1045
1045
  //#endregion
@@ -1091,7 +1091,7 @@ type OptionsObject = t.ObjectExpression | {
1091
1091
  properties: any[];
1092
1092
  [key: string]: any;
1093
1093
  };
1094
- declare function collectTargetOptionsObjectsFromCode(code: string, moduleId: string, options?: {
1094
+ export declare function collectTargetOptionsObjectsFromCode(code: string, moduleId: string, options?: {
1095
1095
  astEngine?: AstEngineName$1;
1096
1096
  }): {
1097
1097
  optionsObjects: OptionsObject[];
@@ -1099,7 +1099,7 @@ declare function collectTargetOptionsObjectsFromCode(code: string, moduleId: str
1099
1099
  };
1100
1100
  //#endregion
1101
1101
  //#region src/plugins/wevu/pageFeatures/reachability/index.d.ts
1102
- declare function collectWevuFeaturesFromCodeReachableImports(code: string, options: {
1102
+ export declare function collectWevuFeaturesFromCodeReachableImports(code: string, options: {
1103
1103
  id: string;
1104
1104
  resolver: ModuleResolver;
1105
1105
  astEngine?: AstEngineName$1;
@@ -1109,17 +1109,17 @@ declare function collectWevuFeaturesFromCodeReachableImports(code: string, optio
1109
1109
  /**
1110
1110
  * 扫描 AST,收集启用的 wevu 页面特性标识。
1111
1111
  */
1112
- declare function collectWevuPageFeatureFlags(ast: t.File): Set<WevuPageFeatureFlag>;
1112
+ export declare function collectWevuPageFeatureFlags(ast: t.File): Set<WevuPageFeatureFlag>;
1113
1113
  /**
1114
1114
  * 将启用的页面特性注入到 options 对象中。
1115
1115
  */
1116
- declare function injectWevuPageFeatureFlagsIntoOptionsObject(optionsObject: t.ObjectExpression, enabled: Set<WevuPageFeatureFlag>): boolean;
1116
+ export declare function injectWevuPageFeatureFlagsIntoOptionsObject(optionsObject: t.ObjectExpression, enabled: Set<WevuPageFeatureFlag>): boolean;
1117
1117
  //#endregion
1118
1118
  //#region src/plugins/wevu/pageFeatures/inject.d.ts
1119
1119
  /**
1120
1120
  * 在 JS 源码中注入 wevu 页面特性(基于本文件分析)。
1121
1121
  */
1122
- declare function injectWevuPageFeaturesInJs(source: string, options?: {
1122
+ export declare function injectWevuPageFeaturesInJs(source: string, options?: {
1123
1123
  astEngine?: AstEngineName$1;
1124
1124
  minify?: boolean;
1125
1125
  sourceMap?: boolean;
@@ -1131,7 +1131,7 @@ declare function injectWevuPageFeaturesInJs(source: string, options?: {
1131
1131
  /**
1132
1132
  * 在 JS 源码中注入 wevu 页面特性(支持跨模块解析)。
1133
1133
  */
1134
- declare function injectWevuPageFeaturesInJsWithResolver(source: string, options: {
1134
+ export declare function injectWevuPageFeaturesInJsWithResolver(source: string, options: {
1135
1135
  id: string;
1136
1136
  resolver: ModuleResolver;
1137
1137
  astEngine?: AstEngineName$1;
@@ -1162,18 +1162,18 @@ interface PageEntryMatcherSource {
1162
1162
  /**
1163
1163
  * 创建页面入口匹配器。
1164
1164
  */
1165
- declare function createPageEntryMatcher(source: PageEntryMatcherSource): {
1165
+ export declare function createPageEntryMatcher(source: PageEntryMatcherSource): {
1166
1166
  markDirty(): void;
1167
1167
  isPageFile(filePath: string): Promise<boolean>;
1168
1168
  };
1169
1169
  //#endregion
1170
1170
  //#region src/utils/vueTemplateTags.d.ts
1171
- declare const RESERVED_VUE_COMPONENT_TAGS: Set<string>;
1172
- declare const VUE_COMPONENT_TAG_RE: RegExp;
1171
+ export declare const RESERVED_VUE_COMPONENT_TAGS: Set<string>;
1172
+ export declare const VUE_COMPONENT_TAG_RE: RegExp;
1173
1173
  /**
1174
1174
  * 判断模板标签是否可能需要自动导入。
1175
1175
  */
1176
- declare function isAutoImportCandidateTag(tag: string): boolean;
1176
+ export declare function isAutoImportCandidateTag(tag: string): boolean;
1177
1177
  /**
1178
1178
  * 模板标签收集配置。
1179
1179
  */
@@ -1186,6 +1186,6 @@ interface CollectVueTemplateTagsOptions {
1186
1186
  /**
1187
1187
  * 收集 Vue 模板中的自定义组件标签。
1188
1188
  */
1189
- declare function collectVueTemplateTags(template: string, options: CollectVueTemplateTagsOptions): Set<string>;
1189
+ export declare function collectVueTemplateTags(template: string, options: CollectVueTemplateTagsOptions): Set<string>;
1190
1190
  //#endregion
1191
- export { type AstEngineName, type AutoImportTagsOptions, type AutoUsingComponentsOptions, CLASS_STYLE_WXS_FILE, CLASS_STYLE_WXS_MODULE, type ClassStyleBinding, type ClassStyleRuntime, type CollectVueTemplateTagsOptions, type CompileVueFileOptions, type CompilerDiagnostic, type CompilerDiagnosticCode, type CompilerDiagnosticSeverity, type CompilerDiagnosticSource, 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 SourcePosition, type SourceSpan, type StyleCompileOptions, type StyleCompileResult, type TemplateCompileOptions, type TemplateCompileResult, type TemplateRefBinding, type TransformResult, type TransformScriptOptions, type TransformUniAppSourceOptions, type UniAppCompatibilityTarget, VUE_COMPONENT_TAG_RE, VUE_SFC_BLOCK_TYPES, type VueSfcBlockChanges, type VueSfcBlockSignatures, type VueSfcBlockType, type VueSfcHmrSignatures, 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, classifyVueSfcBlockChanges, 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, resolveVueSfcHasTemplate, resolveVueSfcHmrSignatures, resolveVueSfcNonJsonSignature, resolveVueSfcScriptSignature, resolveVueSfcStyleIndependentSignature, resolveVueSfcTailwindContentSignature, resolveWevuInternalImportModuleId, restoreScriptSetupSrc, restoreScriptSrc, stripJsonMacroCallsFromCode, swanPlatform, transformNestedWxssVars, transformScript, transformScript as transformSfcScript, transformUniAppConditionalCode, transformUniAppSource, transformVueDeepSelectors, ttPlatform, wechatPlatform };
1191
+ export { type AstEngineName, type AutoImportTagsOptions, type AutoUsingComponentsOptions, type ClassStyleBinding, type ClassStyleRuntime, type CollectVueTemplateTagsOptions, type CompileVueFileOptions, type CompilerDiagnostic, type CompilerDiagnosticCode, type CompilerDiagnosticSeverity, type CompilerDiagnosticSource, 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 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 WevuDefaults, compileVueFile as compileSfc, compileVueStyleToWxss as compileStyle, compileVueTemplateToWxml as compileTemplate, transformScript as transformSfcScript };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wevu/compiler",
3
3
  "type": "module",
4
- "version": "7.0.2",
4
+ "version": "7.0.4",
5
5
  "description": "wevu 编译器基础包,面向小程序模板的编译与转换",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -46,15 +46,15 @@
46
46
  "@vue/compiler-core": "^3.5.42",
47
47
  "@vue/compiler-dom": "^3.5.42",
48
48
  "@weapp-core/constants": "0.2.1",
49
- "@weapp-core/shared": "3.2.0",
50
- "@weapp-vite/ast": "7.0.2",
49
+ "@weapp-core/shared": "3.2.1",
50
+ "@weapp-vite/ast": "7.0.4",
51
51
  "comment-json": "^5.0.0",
52
52
  "lru-cache": "^11.5.2",
53
53
  "magic-string": "^1.2.3",
54
54
  "merge": "^2.1.1",
55
55
  "pathe": "^2.0.3",
56
- "postcss": "^8.5.26",
57
- "postcss-selector-parser": "^7.1.5",
56
+ "postcss": "^8.5.28",
57
+ "postcss-selector-parser": "^7.1.6",
58
58
  "rolldown-require": "2.0.28",
59
59
  "vue": "^3.5.42"
60
60
  },