wevu 0.0.0 → 0.0.2-alpha.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/store.cjs ADDED
@@ -0,0 +1,5 @@
1
+ const require_store = require('./store-Cmw9vWBT.cjs');
2
+
3
+ exports.createStore = require_store.createStore;
4
+ exports.defineStore = require_store.defineStore;
5
+ exports.storeToRefs = require_store.storeToRefs;
@@ -0,0 +1,2 @@
1
+ import { a as DefineStoreOptions, c as SubscriptionCallback, i as ActionSubscriber, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs } from "./index-D1r6nN-t.cjs";
2
+ export { ActionSubscriber, DefineStoreOptions, MutationType, StoreManager, SubscriptionCallback, createStore, defineStore, storeToRefs };
@@ -0,0 +1,2 @@
1
+ import { a as DefineStoreOptions, c as SubscriptionCallback, i as ActionSubscriber, n as createStore, o as MutationType, r as defineStore, s as StoreManager, t as storeToRefs } from "./index-DHBSC7mS.mjs";
2
+ export { ActionSubscriber, DefineStoreOptions, MutationType, StoreManager, SubscriptionCallback, createStore, defineStore, storeToRefs };
package/dist/store.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { n as defineStore, r as createStore, t as storeToRefs } from "./store-BcU7YVhB.mjs";
2
+
3
+ export { createStore, defineStore, storeToRefs };
package/package.json CHANGED
@@ -1,39 +1,63 @@
1
1
  {
2
2
  "name": "wevu",
3
3
  "type": "module",
4
- "version": "0.0.0",
5
- "description": "wevue",
4
+ "version": "0.0.2-alpha.0",
5
+ "description": "Vue 3 风格的小程序运行时,包含响应式、diff+setData 与轻量状态管理",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
- "license": "ISC",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/weapp-vite/weapp-vite/tree/main/packages/wevu",
8
9
  "repository": {
9
10
  "type": "git",
10
11
  "url": "git+https://github.com/weapp-vite/weapp-vite.git",
11
- "directory": "packages/wevue"
12
+ "directory": "packages/wevu"
12
13
  },
13
14
  "bugs": {
14
15
  "url": "https://github.com/weapp-vite/weapp-vite/issues"
15
16
  },
16
- "keywords": [],
17
+ "keywords": [
18
+ "weapp",
19
+ "mini-program",
20
+ "wechat",
21
+ "vue3",
22
+ "runtime",
23
+ "reactivity",
24
+ "setData",
25
+ "pinia",
26
+ "state-management"
27
+ ],
17
28
  "sideEffects": false,
18
29
  "exports": {
19
30
  ".": {
20
- "types": "./dist/index.d.ts",
21
- "import": "./dist/index.mjs",
22
- "require": "./dist/index.cjs"
31
+ "types": "./dist/index.d.mts",
32
+ "import": {
33
+ "types": "./dist/index.d.mts",
34
+ "default": "./dist/index.mjs"
35
+ },
36
+ "require": {
37
+ "types": "./dist/index.d.cts",
38
+ "default": "./dist/index.cjs"
39
+ }
23
40
  }
24
41
  },
25
42
  "main": "./dist/index.cjs",
26
43
  "module": "./dist/index.mjs",
27
- "types": "./dist/index.d.ts",
44
+ "types": "./dist/index.d.mts",
28
45
  "files": [
29
46
  "dist"
30
47
  ],
48
+ "publishConfig": {
49
+ "access": "public",
50
+ "registry": "https://registry.npmjs.org"
51
+ },
52
+ "engines": {
53
+ "node": ">=20.19.0"
54
+ },
31
55
  "scripts": {
32
- "dev": "unbuild --stub",
33
- "build:watch": "unbuild --watch --sourcemap",
34
- "build": "unbuild",
56
+ "dev": "tsdown -w",
57
+ "build": "tsdown",
35
58
  "test": "vitest run",
36
59
  "test:dev": "vitest",
60
+ "test:types": "tsd",
37
61
  "release": "pnpm publish",
38
62
  "lint": "eslint .",
39
63
  "lint:fix": "eslint . --fix"
package/dist/index.d.ts DELETED
@@ -1,97 +0,0 @@
1
- type EffectScheduler = () => void;
2
- type Dep = Set<ReactiveEffect>;
3
- interface ReactiveEffect<T = any> {
4
- (): T;
5
- deps: Dep[];
6
- scheduler?: EffectScheduler;
7
- active: boolean;
8
- _fn: () => T;
9
- onStop?: () => void;
10
- }
11
- interface EffectOptions {
12
- scheduler?: EffectScheduler;
13
- lazy?: boolean;
14
- onStop?: () => void;
15
- }
16
- declare function effect<T = any>(fn: () => T, options?: EffectOptions): ReactiveEffect<T>;
17
- declare function stop(runner: ReactiveEffect): void;
18
- declare function reactive<T extends object>(target: T): T;
19
- declare function isReactive(value: unknown): boolean;
20
- declare function toRaw<T>(observed: T): T;
21
- interface Ref<T = any> {
22
- value: T;
23
- }
24
- declare function isRef(value: unknown): value is Ref<any>;
25
- declare function ref<T>(value: T): Ref<T>;
26
- declare function unref<T>(value: T | Ref<T>): T;
27
- type ComputedGetter<T> = () => T;
28
- type ComputedSetter<T> = (value: T) => void;
29
- interface ComputedRef<T> {
30
- readonly value: T;
31
- }
32
- interface WritableComputedRef<T> {
33
- value: T;
34
- }
35
- interface WritableComputedOptions<T> {
36
- get: ComputedGetter<T>;
37
- set: ComputedSetter<T>;
38
- }
39
- declare function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>;
40
- declare function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>;
41
- interface WatchOptions {
42
- immediate?: boolean;
43
- deep?: boolean;
44
- }
45
- type WatchSource<T = any> = (() => T) | Ref<T> | object;
46
- type WatchStopHandle = () => void;
47
- declare function traverse(value: any, seen?: Set<object>): any;
48
- declare function watch<T>(source: WatchSource<T>, cb: (value: T, oldValue: T, onCleanup: (cleanupFn: () => void) => void) => void, options?: WatchOptions): WatchStopHandle;
49
-
50
- type ComputedDefinitions = Record<string, ComputedGetter<any> | WritableComputedOptions<any>>;
51
- type MethodDefinitions = Record<string, (...args: any[]) => any>;
52
- type ExtractComputed<C extends ComputedDefinitions> = {
53
- [K in keyof C]: C[K] extends ComputedGetter<infer R> ? R : C[K] extends WritableComputedOptions<infer R> ? R : never;
54
- };
55
- type ExtractMethods<M extends MethodDefinitions> = {
56
- [K in keyof M]: M[K] extends (...args: infer P) => infer R ? (...args: P) => R : never;
57
- };
58
- type ComponentPublicInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> = D & ExtractComputed<C> & ExtractMethods<M>;
59
- interface MiniProgramAdapter {
60
- setData?: (payload: Record<string, any>) => void | Promise<void>;
61
- }
62
- interface ModelBindingOptions<T = any> {
63
- event?: string;
64
- valueProp?: string;
65
- parser?: (payload: any) => T;
66
- formatter?: (value: T) => any;
67
- }
68
- interface ModelBinding<T = any> {
69
- value: T;
70
- update: (value: T) => void;
71
- model: (options?: ModelBindingOptions<T>) => Record<string, any>;
72
- }
73
- interface CreateAppOptions<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
74
- data?: () => D;
75
- computed?: C;
76
- methods?: M;
77
- }
78
- interface RuntimeApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
79
- mount: (adapter?: MiniProgramAdapter) => RuntimeInstance<D, C, M>;
80
- }
81
- interface RuntimeInstance<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions> {
82
- readonly state: D;
83
- readonly proxy: ComponentPublicInstance<D, C, M>;
84
- readonly methods: ExtractMethods<M>;
85
- readonly computed: Readonly<ExtractComputed<C>>;
86
- readonly adapter?: MiniProgramAdapter;
87
- bindModel: <T = any>(path: string, options?: ModelBindingOptions<T>) => ModelBinding<T>;
88
- watch: <T>(source: (() => T) | Record<string, any>, cb: (value: T, oldValue: T) => void, options?: WatchOptions) => WatchStopHandle;
89
- snapshot: () => Record<string, any>;
90
- unmount: () => void;
91
- }
92
- declare function createApp<D extends object, C extends ComputedDefinitions, M extends MethodDefinitions>(options: CreateAppOptions<D, C, M>): RuntimeApp<D, C, M>;
93
-
94
- declare function nextTick<T>(fn?: () => T): Promise<T>;
95
-
96
- export { computed, createApp, effect, isReactive, isRef, nextTick, reactive, ref, stop, toRaw, traverse, unref, watch };
97
- export type { ComponentPublicInstance, ComputedDefinitions, ComputedGetter, ComputedRef, ComputedSetter, CreateAppOptions, EffectOptions, EffectScheduler, MethodDefinitions, MiniProgramAdapter, ModelBinding, ModelBindingOptions, ReactiveEffect, Ref, RuntimeApp, RuntimeInstance, WatchOptions, WatchStopHandle, WritableComputedOptions, WritableComputedRef };