@wevu/test-utils 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ice breaker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # @wevu/test-utils
2
+
3
+ 用于测试 Wevu 逻辑的轻量工具。它会创建真实的 Wevu runtime 实例,提供 `mount`、`mountComposable`、`mountComponent`、`wrapper.vm`、`setProps`、`setData`、`emitted`、生命周期触发和卸载能力。
4
+
5
+ 该包只负责逻辑层测试,不模拟 WXML 查询、布局或完整微信宿主。需要测试编译产物、页面/组件树和用户交互时,请使用 `@mpcore/test`。
6
+
7
+ ```ts
8
+ import { mountComposable } from '@wevu/test-utils'
9
+ import { computed, onMounted, onUnmounted, ref } from 'wevu'
10
+
11
+ const wrapper = mountComposable((props, { emit }) => {
12
+ const count = ref(props.initial)
13
+ const doubled = computed(() => count.value * 2)
14
+
15
+ onMounted(() => emit('ready'))
16
+ onUnmounted(() => emit('closed'))
17
+
18
+ return {
19
+ count,
20
+ doubled,
21
+ increment() {
22
+ count.value += 1
23
+ },
24
+ }
25
+ }, {
26
+ props: { initial: 1 },
27
+ })
28
+
29
+ expect(wrapper.vm.count.value).toBe(1)
30
+ expect(wrapper.emitted('ready')).toEqual([[undefined]])
31
+
32
+ wrapper.vm.increment()
33
+ await wrapper.nextTick()
34
+ expect(wrapper.vm.doubled.value).toBe(4)
35
+
36
+ wrapper.unmount()
37
+ expect(wrapper.emitted('closed')).toEqual([[undefined]])
38
+ ```
39
+
40
+ ## 测试真实 Vue SFC
41
+
42
+ 在 Vitest 配置中显式加入 `wevuSfc()`,它会调用 `@wevu/compiler` 编译 `.vue` 的 script,保留 source map,并将 Wevu 的三个虚拟 runtime 入口映射到 `wevu/internal-*`。该入口不会使用 `@vitejs/plugin-vue`,也不会渲染模板、WXML、CSS 或 DOM。
43
+
44
+ ```ts
45
+ import { wevuSfc } from '@wevu/test-utils/vitest'
46
+ // vitest.config.ts
47
+ import { defineConfig } from 'vitest/config'
48
+
49
+ export default defineConfig({
50
+ plugins: [wevuSfc()],
51
+ })
52
+ ```
53
+
54
+ ```ts
55
+ import { mountComponent } from '@wevu/test-utils'
56
+ import Counter from './Counter.vue'
57
+
58
+ const wrapper = mountComponent(Counter, {
59
+ props: { initial: 1 },
60
+ global: {
61
+ provide: { token: 'test-value' },
62
+ mocks: { $feature: true },
63
+ },
64
+ })
65
+
66
+ wrapper.vm.increment()
67
+ await wrapper.nextTick()
68
+ expect(wrapper.vm.count.value).toBe(2)
69
+ wrapper.unmount()
70
+ ```
71
+
72
+ `mountComponent()` 接收编译后的 SFC 默认导出、组件选项或 Wevu component definition,不接收源码路径或字符串。它复用组件自身的 props 默认值、data、computed、methods、watch、setup、Options API provide/inject、emits 和生命周期,挂载顺序为 `created -> attached -> ready`,卸载时调用 `detached`。
73
+
74
+ `app.vue` 和页面组件不属于该入口的测试对象;需要验证完整编译产物、WXML 查询、组件树、宿主 mock 或交互时,请使用 `@mpcore/test`。
75
+
76
+ `@mpcore/test` 与本包的边界是明确的:前者验证真实编译产物和逻辑 WXML 树,后者验证不依赖模板的组合式逻辑与生命周期。`onUpdated` 目前只有 runtime 注册和手动派发入口,生产更新链路尚未自动派发,因此不由本包伪造该语义。
@@ -0,0 +1,4 @@
1
+ import { ComponentBindingsOf, ComponentMountOptions, ComponentPropsOf, EmittedEventMap, MountOptions, TestGlobalMountOptions, TestPlugin, TestSetupContext, TestSetupFunction, WevuComponentInput, WevuTestWrapper } from "./types.mjs";
2
+ import { mountComponent } from "./mountComponent.mjs";
3
+ import { mount, mountComposable } from "./mount.mjs";
4
+ export { type ComponentBindingsOf, type ComponentMountOptions, type ComponentPropsOf, type EmittedEventMap, type MountOptions, type TestGlobalMountOptions, type TestPlugin, type TestSetupContext, type TestSetupFunction, type WevuComponentInput, type WevuTestWrapper, mount, mountComponent, mountComposable };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{mountComponent as e}from"./mountComponent.mjs";import{mount as t,mountComposable as n}from"./mount.mjs";export{t as mount,e as mountComponent,n as mountComposable};
@@ -0,0 +1,10 @@
1
+ import { MountOptions, TestSetupFunction, WevuTestWrapper } from "./types.mjs";
2
+ import { mountComponent } from "./mountComponent.mjs";
3
+ //#region src/mount.d.ts
4
+ type MountSubject<Bindings extends Record<string, any>, Props extends Record<string, any>> = TestSetupFunction<Bindings, Props> | {
5
+ setup?: TestSetupFunction<Bindings, Props>;
6
+ };
7
+ declare function mount<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>>(subject: MountSubject<Bindings, Props> | Record<string, any>, options?: MountOptions<Props, Data>): WevuTestWrapper<Bindings, Props, Data>;
8
+ declare function mountComposable<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>>(setup: TestSetupFunction<Bindings, Props>, options?: MountOptions<Props, Data>): WevuTestWrapper<Bindings, Props, Data>;
9
+ //#endregion
10
+ export { mount, mountComponent, mountComposable };
package/dist/mount.mjs ADDED
@@ -0,0 +1 @@
1
+ import{applyDataPayload as e,applyGlobalOptions as t,createEmitted as n}from"./mountHelpers.mjs";import{isComponentSubject as r,mountComponent as i}from"./mountComponent.mjs";import{WEVU_COMPONENT_NAME_KEY as a,WEVU_PROPS_KEY as o,WEVU_PROP_KEYS_KEY as s}from"@weapp-core/constants";import{nextTick as c}from"wevu";import{INTERNAL_DEFAULTS_SCOPE_KEY as l,callHookList as u,createApp as d,mountRuntimeInstance as f,teardownRuntimeInstance as p}from"wevu/internal-runtime";function m(e){return typeof e==`function`?e():e==null?{}:e}function h(e){let t=typeof e==`function`?e:e.setup;if(typeof t!=`function`)throw TypeError(`mount() 需要接收 setup 函数,或包含 setup 函数的对象`);return t}function g(g,_={}){var v;if(r(g))return i(g,_);let y=h(g),b={...(v=_.props)==null?{}:v},x=m(_.data),S=[],C=Object.create(null),w=!1,T={data:{...x},properties:b,route:_.route,is:_.componentName,setData(t,n){var r,i;S.push({...t}),e(T.data,t);let a=(r=_.adapter)==null||(i=r.setData)==null?void 0:i.call(r,t);return a&&typeof a.then==`function`?a.then(()=>n==null?void 0:n()):(n==null||n(),a)},triggerEvent(e,t,n){var r;((r=C[e])==null?C[e]=[]:r).push([t])}};Object.defineProperty(T,s,{configurable:!0,enumerable:!1,value:Object.keys(b),writable:!0}),_.componentName&&Object.defineProperty(T,a,{configurable:!0,enumerable:!1,value:_.componentName,writable:!0});let E=d({[l]:`component`,data:x,computed:_.computed,methods:_.methods,setData:_.setData,setup:y,watch:_.watch});t(E,_);let D=f(T,E,_.watch,y);u(T,`onAttached`),u(T,`onReady`);let O=e=>{var t;let n=D.state[o];Object.assign((t=T.properties)==null?{}:t,e),n&&Object.assign(n,e)};return{get vm(){return D.proxy},instance:D,host:T,setDataCalls:S,get isUnmounted(){return w},async setProps(e){if(w)throw Error(`不能在已卸载的 wrapper 上调用 setProps()`);O(e),await c()},async setData(e){if(w)throw Error(`不能在已卸载的 wrapper 上调用 setData()`);Object.assign(D.state,e),await c()},emitted:n(C),async triggerHook(e,...t){if(w)throw Error(`不能在已卸载的 wrapper 上调用 triggerHook()`);u(T,e,t),await c()},nextTick:()=>c(),unmount(){w||(w=!0,p(T),E.unmount())}}}function _(e,t){return g(e,t)}export{g as mount,i as mountComponent,_ as mountComposable};
@@ -0,0 +1,11 @@
1
+ import { ComponentBindingsOf, ComponentMountOptions, ComponentPropsOf, WevuTestWrapper } from "./types.mjs";
2
+ //#region src/mountComponent.d.ts
3
+ /**
4
+ * 挂载不渲染模板的 Wevu 组件逻辑层。
5
+ *
6
+ * @param component 编译后的 SFC 默认导出、组件选项或 Wevu 组件定义
7
+ * @param options 挂载选项
8
+ */
9
+ declare function mountComponent<Component extends object, Props extends Record<string, any> = ComponentPropsOf<Component>, Data extends Record<string, any> = Record<string, any>>(component: Component, options?: ComponentMountOptions<Props>): WevuTestWrapper<ComponentBindingsOf<Component>, Props, Data>;
10
+ //#endregion
11
+ export { mountComponent };
@@ -0,0 +1 @@
1
+ import{applyDataPayload as e,applyGlobalOptions as t,createEmitted as n}from"./mountHelpers.mjs";import{nextTick as r}from"wevu";import{callHookList as i,createWevuComponentDefinition as a,getWevuComponentLifecycleDefinition as o}from"wevu/internal-runtime";function s(e){return!!(e&&(typeof e==`object`||typeof e==`function`)&&e.__wevu_runtime&&e.__wevu_options)}function c(e){if(s(e))return!0;if(!e||typeof e!=`object`)return!1;let t=e;return t.__wevu_isPage===!0||t.__wevu_isPage===!1||[`props`,`properties`,`data`,`computed`,`methods`,`watch`,`lifetimes`,`pageLifetimes`,`observers`,`beforeCreate`,`created`,`mounted`,`unmounted`].some(e=>e in t)}function l(e){if(s(e))return e;if(!e||typeof e!=`object`)throw TypeError(`mountComponent() 需要接收编译后的 Vue SFC、组件选项或 Wevu 组件定义`);return a(e)}function u(e,t=new WeakMap){if(!e||typeof e!=`object`)return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let n=[];return t.set(e,n),e.forEach(e=>n.push(u(e,t))),n}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return e;let r={};t.set(e,r);for(let[n,i]of Object.entries(e))r[n]=u(i,t);return r}function d(e,t){var n;let r={};for(let[t,i]of Object.entries((n=e.properties)==null?{}:n))i&&typeof i==`object`&&`value`in i&&(r[t]=u(i.value));return Object.assign(r,t),r}function f(a,s={}){var c,u,f,p,m;let h=l(a),g=o(h);if(!g)throw TypeError(`mountComponent() 无法解析 Wevu 组件生命周期定义`);if(g.__wevu_isPage===!0)throw Error(`mountComponent() 不支持 app.vue 或页面组件,请改用 @mpcore/test`);let _=h.__wevu_options,v=h.__wevu_runtime,y=d(g,(c=s.props)==null?{}:c),b=Object.create(null),x=[],S=!1,C=typeof _.data==`function`?_.data():{},w={data:{...C==null?{}:C},properties:y,route:s.route,is:s.componentName,setData(t,n){var r,i;x.push({...t}),e(w.data,t);let a=(r=s.adapter)==null||(i=r.setData)==null?void 0:i.call(r,t);return a&&typeof a.then==`function`?a.then(()=>n==null?void 0:n()):(n==null||n(),a)},triggerEvent(e,t,n){var r;((r=b[e])==null?b[e]=[]:r).push([t])}};t(v,s);let T=(u=g.lifetimes)==null?{}:u;return(f=T.created)==null||f.call(w),(p=T.attached)==null||p.call(w),(m=T.ready)==null||m.call(w),{get vm(){var e;return(e=w.__wevu)==null?void 0:e.proxy},get instance(){return w.__wevu},host:w,setDataCalls:x,get isUnmounted(){return S},async setProps(e){var t,n,i;if(S)throw Error(`不能在已卸载的 wrapper 上调用 setProps()`);let a={...(t=w.properties)==null?{}:t};Object.assign((n=w.properties)==null?{}:n,e);let o=(i=g.observers)==null?{}:i;for(let[t,n]of Object.entries(e)){if(Object.is(a[t],n))continue;let e=o[t];typeof e==`function`&&e.call(w,n,a[t])}typeof o[`**`]==`function`&&o[`**`].call(w,w.properties,a),await r()},async setData(e){var t,n;if(S)throw Error(`不能在已卸载的 wrapper 上调用 setData()`);Object.assign(w.data,e),Object.assign((t=(n=w.__wevu)==null?void 0:n.state)==null?{}:t,e),await r()},emitted:n(b),async triggerHook(e,...t){if(S)throw Error(`不能在已卸载的 wrapper 上调用 triggerHook()`);i(w,e,t),await r()},nextTick:()=>r(),unmount(){var e;S||(S=!0,(e=T.detached)==null||e.call(w),v.unmount())}}}export{c as isComponentSubject,f as mountComponent};
@@ -0,0 +1 @@
1
+ function e(e,t,n){let r=t.split(`.`).filter(Boolean);if(r.length<2){e[t]=n;return}let i=e;for(let e of r.slice(0,-1)){let t=i[e];(!t||typeof t!=`object`||Array.isArray(t))&&(i[e]={}),i=i[e]}i[r[r.length-1]]=n}function t(t,n){for(let[r,i]of Object.entries(n))e(t,r,i)}function n(e){return(t=>{if(t){let n=e[t];return n==null?void 0:n.map(e=>[...e])}return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.map(e=>[...e])]))})}function r(e,t){var n,r;let i=t.global;if(i){if(Object.assign(e.config.globalProperties,(n=i.config)==null?void 0:n.globalProperties),Object.assign(e.config.globalProperties,i.mocks),i.provide instanceof Map)for(let[t,n]of i.provide)e.provide(t,n);else if(i.provide)for(let t of Reflect.ownKeys(i.provide))e.provide(t,i.provide[t]);for(let t of(r=i.plugins)==null?[]:r)if(Array.isArray(t)){let[n,...r]=t;e.use(n,...r)}else e.use(t)}}export{t as applyDataPayload,r as applyGlobalOptions,n as createEmitted};
@@ -0,0 +1,59 @@
1
+ import { ComponentPropsOptions, CreateAppOptions, DefineComponentOptions, InternalRuntimeState, MiniProgramAdapter, RuntimeInstance, SetDataSnapshotOptions, SetupContext, WevuPlugin } from "wevu";
2
+ //#region src/types.d.ts
3
+ type TestSetupContext = SetupContext<any, any, any, ComponentPropsOptions>;
4
+ type TestSetupFunction<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>> = (props: Props, context: TestSetupContext) => Bindings | void;
5
+ type TestPlugin = WevuPlugin | readonly [WevuPlugin, ...any[]];
6
+ interface TestGlobalMountOptions {
7
+ plugins?: TestPlugin[];
8
+ provide?: Map<any, unknown> | Record<PropertyKey, unknown>;
9
+ mocks?: Record<string, unknown>;
10
+ config?: {
11
+ globalProperties?: Record<string, unknown>;
12
+ };
13
+ }
14
+ interface MountOptions<Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>> {
15
+ props?: Props;
16
+ data?: Data | (() => Data);
17
+ computed?: CreateAppOptions['computed'];
18
+ methods?: CreateAppOptions['methods'];
19
+ watch?: CreateAppOptions['watch'];
20
+ setData?: SetDataSnapshotOptions;
21
+ global?: TestGlobalMountOptions;
22
+ route?: string;
23
+ componentName?: string;
24
+ adapter?: Pick<MiniProgramAdapter, 'setData'>;
25
+ }
26
+ interface ComponentMountOptions<Props extends Record<string, any> = Record<string, any>> extends Omit<MountOptions<Props>, 'props' | 'data' | 'computed' | 'methods' | 'watch' | 'setData'> {
27
+ props?: Partial<Props>;
28
+ componentName?: string;
29
+ }
30
+ type WevuComponentInput<Props extends Record<string, any> = Record<string, any>> = DefineComponentOptions<ComponentPropsOptions, any, any, any, any> | (new () => {
31
+ $props: Props;
32
+ } & Record<string, any>) | Record<string, any>;
33
+ type ComponentInstance<Component> = Component extends (abstract new (...args: any[]) => infer Instance) ? Instance : Record<string, any>;
34
+ type ComponentPropsOf<Component> = ComponentInstance<Component> extends {
35
+ $props: infer Props;
36
+ } ? Props extends Record<string, any> ? Props : Record<string, any> : Component extends {
37
+ props: infer Props;
38
+ } ? Props extends ComponentPropsOptions ? import('wevu').InferProps<Props> : Record<string, any> : Record<string, any>;
39
+ type ComponentBindingsOf<Component> = ComponentInstance<Component> extends (infer Instance) ? Instance extends Record<string, any> ? Omit<Instance, '$props'> : Record<string, any> : Record<string, any>;
40
+ interface EmittedEventMap {
41
+ [eventName: string]: unknown[][];
42
+ }
43
+ interface WevuTestWrapper<Bindings extends Record<string, any> = Record<string, any>, Props extends Record<string, any> = Record<string, any>, Data extends Record<string, any> = Record<string, any>> {
44
+ readonly vm: Record<string, any> & Bindings & {
45
+ $props: Props;
46
+ };
47
+ readonly instance: RuntimeInstance<Data, any, any>;
48
+ readonly host: InternalRuntimeState;
49
+ readonly setDataCalls: readonly Record<string, any>[];
50
+ readonly isUnmounted: boolean;
51
+ setProps: (props: Partial<Props>) => Promise<void>;
52
+ setData: (data: Partial<Data> & Record<string, any>) => Promise<void>;
53
+ emitted: (() => EmittedEventMap) & ((eventName: string) => unknown[][] | undefined);
54
+ triggerHook: (name: string, ...args: any[]) => Promise<void>;
55
+ nextTick: () => Promise<void>;
56
+ unmount: () => void;
57
+ }
58
+ //#endregion
59
+ export { ComponentBindingsOf, ComponentMountOptions, ComponentPropsOf, EmittedEventMap, MountOptions, TestGlobalMountOptions, TestPlugin, TestSetupContext, TestSetupFunction, WevuComponentInput, WevuTestWrapper };
@@ -0,0 +1,27 @@
1
+ //#region src/vitest.d.ts
2
+ interface WevuSfcPlugin {
3
+ name: string;
4
+ enforce: 'pre';
5
+ resolveId: (this: {
6
+ resolve: (source: string, importer?: string, options?: {
7
+ skipSelf?: boolean;
8
+ }) => Promise<{
9
+ id: string;
10
+ } | null>;
11
+ }, source: string, importer?: string) => string | undefined | Promise<string | undefined>;
12
+ transform: (code: string, id: string) => undefined | {
13
+ code: string;
14
+ map: any;
15
+ } | Promise<undefined | {
16
+ code: string;
17
+ map: any;
18
+ }>;
19
+ }
20
+ /**
21
+ * 为 Vitest 提供 Wevu SFC 逻辑编译入口。
22
+ *
23
+ * 该插件只输出 SFC script,不加载 Vue Web runtime,也不渲染模板、样式或 WXML。
24
+ */
25
+ declare function wevuSfc(): WevuSfcPlugin;
26
+ //#endregion
27
+ export { WevuSfcPlugin, wevuSfc };
@@ -0,0 +1 @@
1
+ import{WEAPP_VITE_RUNTIME_REACTIVITY_VIRTUAL_ID as e,WEAPP_VITE_RUNTIME_TEMPLATE_VIRTUAL_ID as t,WEAPP_VITE_RUNTIME_VIRTUAL_ID as n}from"@weapp-core/constants";import{compileVueFile as r}from"@wevu/compiler";const i={[n]:`wevu/internal-runtime`,[e]:`wevu/internal-reactivity`,[t]:`wevu/internal-template`};function a(e){return/\.vue(?:$|\?)/.test(e)}function o(e){let t=e.split(`?`)[0].replaceAll(`\\`,`/`);return/(?:^|\/)app\.vue$/.test(t)||/(?:^|\/)pages?(?:\/|$)/.test(t)}function s(){return{name:`wevu-test-utils:sfc`,enforce:`pre`,async resolveId(e,t){var n;let r=i[e];if(!r)return;let a=await this.resolve(r,t,{skipSelf:!0});return(n=a==null?void 0:a.id)==null?r:n},async transform(e,t){var n,i;if(!a(t))return;if(o(t))throw Error(`@wevu/test-utils/vitest 不支持 app.vue 或页面组件:${t},请改用 @mpcore/test`);let s=await r(e,t.split(`?`)[0],{skipComponentTransform:!0,sourceMap:!0});return{code:(n=s.script)==null?`export default {}`:n,map:(i=s.scriptMap)==null?null:i}}}}export{s as wevuSfc};
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@wevu/test-utils",
3
+ "type": "module",
4
+ "version": "0.1.0",
5
+ "description": "Lightweight test utilities for Wevu Composition API logic",
6
+ "author": "ice breaker <1324318532@qq.com>",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/weapp-vite/weapp-vite.git",
11
+ "directory": "packages-runtime/wevu-test-utils"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/weapp-vite/weapp-vite/issues"
15
+ },
16
+ "keywords": [
17
+ "wevu",
18
+ "testing",
19
+ "composition-api",
20
+ "vitest"
21
+ ],
22
+ "sideEffects": false,
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.mts",
26
+ "import": "./dist/index.mjs"
27
+ },
28
+ "./vitest": {
29
+ "types": "./dist/vitest.d.mts",
30
+ "import": "./dist/vitest.mjs"
31
+ }
32
+ },
33
+ "main": "./dist/index.mjs",
34
+ "module": "./dist/index.mjs",
35
+ "types": "./dist/index.d.mts",
36
+ "files": [
37
+ "README.md",
38
+ "dist"
39
+ ],
40
+ "engines": {
41
+ "node": "^20.19.0 || >=22.12.0"
42
+ },
43
+ "peerDependencies": {
44
+ "wevu": "6.20.4"
45
+ },
46
+ "dependencies": {
47
+ "@wevu/compiler": "6.20.4",
48
+ "@weapp-core/constants": "0.1.17"
49
+ },
50
+ "devDependencies": {
51
+ "wevu": "6.20.4"
52
+ },
53
+ "publishConfig": {
54
+ "access": "public",
55
+ "registry": "https://registry.npmjs.org"
56
+ },
57
+ "scripts": {
58
+ "dev": "tsdown -w",
59
+ "build": "tsdown",
60
+ "test": "vitest run",
61
+ "test:dev": "vitest",
62
+ "test:types": "pnpm build && tsd",
63
+ "typecheck": "tsc --noEmit",
64
+ "lint": "eslint .",
65
+ "lint:fix": "eslint . --fix"
66
+ }
67
+ }