annil 1.14.0 → 1.15.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/CHANGELOG.md +25 -0
- package/README.md +15 -1
- package/dist/api/CustomComponent/CustomStore/CustomStoreConstraint.d.ts +1 -1
- package/dist/api/CustomComponent/index.js.map +1 -1
- package/dist/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.d.ts +2 -2
- package/dist/api/DefineComponent/NameOrPath/NameOrPathOption.js.map +1 -0
- package/dist/api/DefineComponent/index.d.ts +1 -1
- package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.js +31 -15
- package/dist/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js +0 -4
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/index.js +2 -2
- package/dist/api/DefineComponent/normalizeOptions/index.js.map +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.d.ts +1 -1
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js +3 -3
- package/dist/api/DefineComponent/normalizeOptions/watchHandler/index.js.map +1 -1
- package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +1 -3
- package/dist/api/RootComponent/Properties/GetPropertiesDef.d.ts +3 -2
- package/dist/api/RootComponent/Properties/PropertiesOption.d.ts +1 -3
- package/dist/api/RootComponent/Store/StoreOption.d.ts +1 -2
- package/dist/thirdLib/index.js +2 -1
- package/dist/thirdLib/index.js.map +1 -1
- package/package.json +5 -4
- package/src/api/CustomComponent/CustomStore/CustomStoreConstraint.ts +1 -1
- package/src/api/CustomComponent/CustomStore/test/error.test.ts +2 -2
- package/src/api/CustomComponent/CustomStore/test/normal.test.ts +9 -2
- package/src/api/CustomComponent/index.ts +1 -13
- package/src/api/CustomComponent/returnType.ts +0 -1
- package/src/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.ts +3 -3
- package/src/api/DefineComponent/index.ts +1 -1
- package/src/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.ts +56 -17
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts +5 -5
- package/src/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.ts +22 -22
- package/src/api/DefineComponent/normalizeOptions/index.ts +2 -2
- package/src/api/DefineComponent/normalizeOptions/watchHandler/index.ts +17 -3
- package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +1 -11
- package/src/api/RootComponent/PageLifetimes/test/error.test.ts +0 -3
- package/src/api/RootComponent/PageLifetimes/test/normal.test.ts +0 -5
- package/src/api/RootComponent/Properties/GetPropertiesDef.ts +4 -7
- package/src/api/RootComponent/Properties/PropertiesOption.ts +3 -4
- package/src/api/RootComponent/Store/StoreOption.ts +1 -1
- package/src/api/RootComponent/Store/test/error.test.ts +1 -8
- package/src/api/RootComponent/Store/test/normal.test.ts +20 -9
- package/tsconfig.json +3 -3
- package/dist/api/DefineComponent/NameOrPage/NameOrPathOption.js.map +0 -1
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.d.ts +0 -3
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js +0 -12
- package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js.map +0 -1
- /package/dist/api/DefineComponent/{NameOrPage → NameOrPath}/NameOrPathOption.js +0 -0
- /package/src/api/DefineComponent/{NameOrPage → NameOrPath}/test/error.test.ts +0 -0
- /package/src/api/DefineComponent/{NameOrPage → NameOrPath}/test/normal.test.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@
|
|
|
4
4
|
|
|
5
5
|
* 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
|
|
6
6
|
|
|
7
|
+
## [1.15.1](https://github.com/missannil/annil/compare/v1.15.0...v1.15.1) (2026-06-16)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* ts6.xxx要去显示的声明rootDir字段 ([f400d04](https://github.com/missannil/annil/commit/f400d04373b513e9cbe60e8f5783d44727fdb2ec))
|
|
13
|
+
* ts6.xxx要去显示的声明rootDir字段 ([#286](https://github.com/missannil/annil/issues/286)) ([7b0300f](https://github.com/missannil/annil/commit/7b0300f374f691b502a270fc3ff40a45391466f1))
|
|
14
|
+
|
|
15
|
+
## [1.15.0](https://github.com/missannil/annil/compare/v1.14.0...v1.15.0) (2026-06-16)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* store加入为依赖验证和返回值为undefined时的警告 ([8c19098](https://github.com/missannil/annil/commit/8c1909805db762607549c59e4d5ae5b7040debf5))
|
|
21
|
+
* 自动化合并 ([cfad291](https://github.com/missannil/annil/commit/cfad291e3c238147419b2e467cc7598e8153f1d4))
|
|
22
|
+
* 自动化合并 ([277e295](https://github.com/missannil/annil/commit/277e295927fcf7a5240394a508736a59802dc1e9))
|
|
23
|
+
* 自动化合并3 ([5de49b0](https://github.com/missannil/annil/commit/5de49b03b115c19d420c18af97b27910e2fe59b5))
|
|
24
|
+
* 自动化合并3 ([#284](https://github.com/missannil/annil/issues/284)) ([77515c7](https://github.com/missannil/annil/commit/77515c70b2e3c14ceca232fd0c80135061a625a9))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* release-please-action@v4-[@v5](https://github.com/v5) ([ecf54a2](https://github.com/missannil/annil/commit/ecf54a2dc0c082adbc9d2a876667c09195ba081d))
|
|
30
|
+
* 去除组件load声明周期 ([241c89a](https://github.com/missannil/annil/commit/241c89a76ade24ab2dfa70c25d0c54679edcb739))
|
|
31
|
+
|
|
7
32
|
## [1.14.0](https://github.com/missannil/annil/compare/v1.13.2...v1.14.0) (2026-06-05)
|
|
8
33
|
|
|
9
34
|
|
package/README.md
CHANGED
|
@@ -51,6 +51,18 @@ npm i annil
|
|
|
51
51
|
- [watch](./docs/demo/watch.md)
|
|
52
52
|
- [store](./docs/demo/store.md)
|
|
53
53
|
|
|
54
|
+
### 自动提交
|
|
55
|
+
|
|
56
|
+
如果你已经把仓库的 PR 合并限制放宽,并且只要 `test.yml` 通过就可以自动合并,可以直接用这个命令把整条链路串起来。
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
GH_TOKEN=xxxx npm run ship -- "feat: your message"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
它会自动执行 `git add -A`、`git commit`、`git pull --rebase origin main`、`git push`、创建或复用 PR、等待 GitHub Actions 检查通过,然后自动合并。
|
|
63
|
+
|
|
64
|
+
需要一个带有仓库权限的 GitHub token,环境变量用 `GH_TOKEN` 或 `GITHUB_TOKEN` 都可以。
|
|
65
|
+
|
|
54
66
|
### 特点
|
|
55
67
|
|
|
56
68
|
[代码片段](https://developers.weixin.qq.com/s/kRjkFlme7nTV)
|
|
@@ -132,7 +144,9 @@ npm i annil
|
|
|
132
144
|
{
|
|
133
145
|
"compilerOptions": {
|
|
134
146
|
"target": "ES2022",
|
|
135
|
-
"
|
|
147
|
+
"module": "ESNext",
|
|
148
|
+
"moduleResolution": "bundler",
|
|
149
|
+
"verbatimModuleSyntax": true,
|
|
136
150
|
"skipLibCheck": true, // 跳过声明文件的类型检查(.d.ts)。
|
|
137
151
|
"esModuleInterop": true, // 默认false. 兼容非ES模块引用的写法(如 import type mobx from 'mobx'等).
|
|
138
152
|
"strict": true, // 启用严格模式
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AddNullForObject } from "../../../types/AddNullForObject";
|
|
2
2
|
import type { Getter } from "../../RootComponent/Store/StoreConstraint";
|
|
3
3
|
export type CustomStoreConstraint<PropertyDoc extends object, legal extends object> = {
|
|
4
|
-
[k in keyof legal]?: Getter<PropertyDoc, AddNullForObject<legal[k]
|
|
4
|
+
[k in keyof legal]?: Getter<PropertyDoc, AddNullForObject<legal[k]> | undefined>;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/CustomComponent/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/CustomComponent/index.ts"],"names":[],"mappings":"AAgSA,MAAM,UAAU,eAAe;IAW7B,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAQ,CAAC;AAC5C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IfExtends } from "hry-types/src/Any/
|
|
1
|
+
import type { IfEquals, IfExtends } from "hry-types/src/Any/_api";
|
|
2
2
|
import type { Includes } from "../../../types/includes";
|
|
3
3
|
export type NameOrPathOption<TName extends string, TPath extends `/${string}`, IsPage extends boolean> = IsPage extends true ? {
|
|
4
4
|
path: TPath;
|
|
5
5
|
} : {
|
|
6
|
-
name: TName & IfExtends<TName, "", () => "⚠️组件名不可为空⚠️",
|
|
6
|
+
name: TName & IfExtends<TName, "", () => "⚠️组件名不可为空⚠️", IfEquals<Includes<TName, "_" | " ">, true, () => "⚠️组件名不可包含下划线或空格⚠️", unknown>>;
|
|
7
7
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NameOrPathOption.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/NameOrPath/NameOrPathOption.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { CustomComponentDefinition, CustomComponentDefinitionRuntime } from "../CustomComponent/returnType";
|
|
3
3
|
import type { RootComponentDefinition, RootComponentDefinitionRuntime } from "../RootComponent/returnType";
|
|
4
|
-
import type { NameOrPathOption } from "./
|
|
4
|
+
import type { NameOrPathOption } from "./NameOrPath/NameOrPathOption";
|
|
5
5
|
import type { GenerateComponentDoc } from "./returnType/GenerateComponentDoc";
|
|
6
6
|
import type { GeneratePageDoc } from "./returnType/GeneratePageDoc";
|
|
7
7
|
import type { RootComponentOption } from "./RootComponent/RootComponentOption";
|
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
export function reactionRegister(storeConfig) {
|
|
2
|
-
|
|
2
|
+
var _a;
|
|
3
|
+
const { comparer, getDependencyTree, reaction, toJS } = require("mobx");
|
|
4
|
+
if (this.disposer) {
|
|
5
|
+
for (const key of Object.keys(this.disposer)) {
|
|
6
|
+
this.disposer[key]();
|
|
7
|
+
}
|
|
8
|
+
}
|
|
3
9
|
this.disposer = {};
|
|
4
|
-
const
|
|
5
|
-
for (const key
|
|
10
|
+
const pendingSetData = {};
|
|
11
|
+
for (const key of Object.keys(storeConfig)) {
|
|
6
12
|
const getter = storeConfig[key];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
let hasObservableDependency = false;
|
|
14
|
+
let firstRunValue;
|
|
15
|
+
const tempDisposer = reaction(() => {
|
|
16
|
+
const value = getter(this.data);
|
|
17
|
+
firstRunValue = value;
|
|
18
|
+
return value;
|
|
19
|
+
}, () => void 0, { fireImmediately: true });
|
|
20
|
+
const deps = (_a = getDependencyTree(tempDisposer).dependencies) !== null && _a !== void 0 ? _a : [];
|
|
21
|
+
hasObservableDependency = deps.length > 0;
|
|
22
|
+
tempDisposer();
|
|
23
|
+
if (firstRunValue === undefined) {
|
|
24
|
+
console.warn(`store字段 ${key} 的getter函数返回了undefined,该字段将不会被注册为响应式字段。`);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (!hasObservableDependency) {
|
|
28
|
+
throw new Error(`store字段 ${key} 的getter函数没有依赖任何响应式数据。`);
|
|
10
29
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, {
|
|
17
|
-
equals: comparer.structural,
|
|
18
|
-
});
|
|
30
|
+
const disposer = reaction(() => getter(this.data), (value) => {
|
|
31
|
+
this.setData({ [key]: toJS(value) });
|
|
32
|
+
}, { equals: comparer.structural });
|
|
33
|
+
pendingSetData[key] = toJS(firstRunValue);
|
|
34
|
+
this.disposer[key] = disposer;
|
|
19
35
|
}
|
|
20
|
-
this.setData(
|
|
36
|
+
this.setData(pendingSetData);
|
|
21
37
|
}
|
|
22
38
|
//# sourceMappingURL=reactionRegister.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactionRegister.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reactionRegister.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/handleStore/reactionRegister.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,gBAAgB,CAAiB,WAA4B;;IAE3E,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,MAAM,CAAgB,CAAC;IAEvF,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;IACD,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACnB,MAAM,cAAc,GAA4B,EAAE,CAAC;IAEnD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAGhC,IAAI,uBAAuB,GAAG,KAAK,CAAC;QACpC,IAAI,aAAsB,CAAC;QAE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|
|
5
5
|
import { addDetachedData } from "./addDetachedData";
|
|
6
6
|
import { hijack } from "./hijack";
|
|
7
7
|
import { isPageCheck } from "./isPageCheck";
|
|
8
|
-
import { loadReceivedDataHandle } from "./loadReceivedDataHandle";
|
|
9
8
|
import { onLoadReceivedDataHandle } from "./onLoadReceivedDataHandle";
|
|
10
9
|
import { pagePathCheck } from "./pagePathCheck";
|
|
11
10
|
export function hijackHandle(finalOptionsForComponent, isPage, path) {
|
|
12
|
-
if (finalOptionsForComponent.isPage) {
|
|
13
|
-
hijack(finalOptionsForComponent.pageLifetimes, "load", [loadReceivedDataHandle]);
|
|
14
|
-
}
|
|
15
11
|
hijack(finalOptionsForComponent.methods, "onLoad", [onLoadReceivedDataHandle]);
|
|
16
12
|
hijack(finalOptionsForComponent.observers, "**", [
|
|
17
13
|
computedUpdater,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/hijackHandle/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,M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AAC,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { hijackHandle } from "./hijackHandle";
|
|
|
8
8
|
import { injectInfoHandler } from "./injectInfoHandler";
|
|
9
9
|
import { InternalFieldProtection } from "./internalFieldProtection";
|
|
10
10
|
import { sameFuncOptionsHandle } from "./sameFuncOptionsHandle";
|
|
11
|
-
import {
|
|
11
|
+
import { handleWatchConfig } from "./watchHandler";
|
|
12
12
|
export function normalizeOptions(defineComponentOption) {
|
|
13
13
|
var _a;
|
|
14
14
|
const { rootComponent, subComponents, path } = defineComponentOption;
|
|
@@ -42,7 +42,7 @@ export function normalizeOptions(defineComponentOption) {
|
|
|
42
42
|
Reflect.deleteProperty(finalOptionsForComponent.options, "virtualHost");
|
|
43
43
|
}
|
|
44
44
|
applyDebounceAndThrottle(finalOptionsForComponent.methods);
|
|
45
|
-
|
|
45
|
+
handleWatchConfig(finalOptionsForComponent);
|
|
46
46
|
finalOptionsForComponent.behaviors.push(BBeforeCreate);
|
|
47
47
|
hijackHandle(finalOptionsForComponent, isPage, path);
|
|
48
48
|
return finalOptionsForComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/normalizeOptions/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AASrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OA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,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,EAAE;KACZ,CAAC;IAEF,iBAAiB,CAAC,wBAAwB,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAKvE,MAAM,eAAe,GAAoB;QACvC,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,EAAE;KACd,CAAC;IAEF,mBAAmB,CAAC,wBAAwB,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;IAE9E,mBAAmB,CAAC,wBAAwB,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;IAE9E,qBAAqB,CAAC,wBAAwB,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;IAGzE,uBAAuB,CAAC,wBAAwB,CAAC,CAAC;IAGlD,IAAI,MAAM,IAAI,wBAAwB,CAAC,OAAO,EAAE,CAAC;QAC/C,OAAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC1E,CAAC;IAGD,wBAAwB,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAG3D,iBAAiB,CAAC,wBAAwB,CAAC,CAAC;IAG5C,wBAAwB,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAGvD,YAAY,CAAC,wBAAwB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAErD,OAAO,wBAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { FinalOptionsOfComponent } from "..";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function handleWatchConfig(finalOptionsForComponent: FinalOptionsOfComponent): void;
|
|
@@ -2,7 +2,7 @@ import { deepClone, deepEqual, isEmptyObject, nonNullable } from "../../../../ut
|
|
|
2
2
|
import { getPathsValue } from "./getPathsValue";
|
|
3
3
|
import { getPropertiesValue } from "./getPropertiesValue";
|
|
4
4
|
import { hasComputedPath } from "./hasComputedPath";
|
|
5
|
-
function
|
|
5
|
+
function initWatchOldValuesWithoutComputed(data, watchConfig, computedKeys) {
|
|
6
6
|
const watchOldValue = {};
|
|
7
7
|
for (const path in watchConfig) {
|
|
8
8
|
if (hasComputedPath(path, computedKeys))
|
|
@@ -20,12 +20,12 @@ function observerHandler(key, originObserversHandle, watchHadle, ...newValue) {
|
|
|
20
20
|
watchOldValue[key] = deepClone(newValue);
|
|
21
21
|
watchHadle.call(this, ...newValue, ...oldValue);
|
|
22
22
|
}
|
|
23
|
-
export function
|
|
23
|
+
export function handleWatchConfig(finalOptionsForComponent) {
|
|
24
24
|
const { observers: observersConfig, watch: watchConfig, data, properties, computed: computedConfig } = finalOptionsForComponent;
|
|
25
25
|
if (!isEmptyObject(watchConfig)) {
|
|
26
26
|
const rawPropertiesValue = getPropertiesValue(properties);
|
|
27
27
|
const computedKeys = Object.keys(computedConfig);
|
|
28
|
-
data.__watchOldValue__ =
|
|
28
|
+
data.__watchOldValue__ = initWatchOldValuesWithoutComputed(Object.assign(Object.assign({}, data), rawPropertiesValue), watchConfig, computedKeys);
|
|
29
29
|
for (const key in watchConfig) {
|
|
30
30
|
const watchHadle = watchConfig[key];
|
|
31
31
|
const originObserversHandle = observersConfig[key];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/watchHandler/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5F,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normaliz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E,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,GAClG,wBAAwB,CAAC;IAC3B,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC1D,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACjD,IAAI,CAAC,iBAAiB,GAAG,iCAAiC,iCACnD,IAAI,GAAK,kBAAkB,GAChC,WAAW,EACX,YAAY,CACb,CAAC;QACF,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YACpC,MAAM,qBAAqB,GAAG,eAAe,CAAC,GAAG,CAAqB,CAAC;YAEvE,eAAe,CAAC,GAAG,CAAC,GAAG,UAAyB,GAAG,QAAmB;;gBACpE,IAAI,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;oBACjC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,qBAAqB,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;gBAClF,CAAC;qBAAM,CAAC;oBACN,OAAC,IAAI,CAAC,IAAI,EAAC,kBAAkB,QAAlB,kBAAkB,GAAK,EAAE,EAAC,CAAC,IAAI,CACxC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,qBAAqB,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC,CAChF,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -4,9 +4,7 @@ import type { ComputeObject } from "../../../types/ComputeObject";
|
|
|
4
4
|
import type { WMCompPageLifetimes, WMPageLifetimes } from "../../../types/OfficialTypeAlias";
|
|
5
5
|
import type { RemoveNullOfRequired } from "../../../types/RemoveNullOfRequired";
|
|
6
6
|
export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends object> = IfExtends<TIsPage, false, {
|
|
7
|
-
pageLifetimes?:
|
|
8
|
-
load?: (props?: object) => void;
|
|
9
|
-
}>;
|
|
7
|
+
pageLifetimes?: Partial<WMCompPageLifetimes>;
|
|
10
8
|
}, {
|
|
11
9
|
pageLifetimes?: ComputeIntersection<Partial<Omit<WMPageLifetimes, "onLoad">> & {
|
|
12
10
|
onLoad?: (props: ComputeObject<RemoveNullOfRequired<PropertiesDoc>>) => void | Promise<void>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Select } from "hry-types/src/Object/Select";
|
|
2
2
|
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
3
3
|
import type { GetOptionalDef } from "./GetOptionalDef";
|
|
4
|
+
import type { As } from "hry-types/src/Any/As";
|
|
4
5
|
import type { GetRequiredDef } from "./GetRequiredDef";
|
|
5
|
-
import type { OptionalType, PropertiesConstraint } from "./PropertiesConstraint";
|
|
6
|
-
type _GetPropertiesDef<TProperties extends PropertiesConstraint, OptionalDef extends object = GetOptionalDef<Select<TProperties, OptionalType
|
|
6
|
+
import type { OptionalType, PropertiesConstraint, RequiredType } from "./PropertiesConstraint";
|
|
7
|
+
type _GetPropertiesDef<TProperties extends PropertiesConstraint, OptionalDef extends object = GetOptionalDef<As<Select<TProperties, OptionalType>, Record<string, OptionalType>>>, RequiredDef extends object = GetRequiredDef<As<Omit<TProperties, keyof OptionalDef>, Record<string, RequiredType>>>> = ComputeIntersection<OptionalDef & RequiredDef>;
|
|
7
8
|
export type GetPropertiesDef<TProperties extends PropertiesConstraint> = _GetPropertiesDef<TProperties>;
|
|
8
9
|
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
1
|
import type { Validators } from "../../../types/Validators";
|
|
3
2
|
import type { PropertiesConstraint } from "./PropertiesConstraint";
|
|
4
3
|
import type { PropertiesValueValidator } from "./PropertiesValueValidator";
|
|
5
4
|
export type PropertiesOption<TProperties extends PropertiesConstraint> = {
|
|
6
5
|
properties?: TProperties & Validators<[
|
|
7
|
-
PropertiesValueValidator<TProperties
|
|
8
|
-
G.IllegalFieldValidator<TProperties, "value" | "type" | "optionalTypes", 1>
|
|
6
|
+
PropertiesValueValidator<TProperties>
|
|
9
7
|
]>;
|
|
10
8
|
};
|
|
@@ -6,8 +6,7 @@ import type { Validators } from "../../../types/Validators";
|
|
|
6
6
|
import type { StoreConstraint } from "./StoreConstraint";
|
|
7
7
|
export type StoreOption<TStore extends StoreConstraint, TDuplicateKeys extends PropertyKey> = {
|
|
8
8
|
store?: TStore & Validators<[
|
|
9
|
-
G.DuplicateFieldValidator<TStore, TDuplicateKeys, "字段重复"
|
|
10
|
-
TypeValidator<TStore>
|
|
9
|
+
G.DuplicateFieldValidator<TStore, TDuplicateKeys, "字段重复">
|
|
11
10
|
]>;
|
|
12
11
|
};
|
|
13
12
|
export type TypeValidator<TStore, Result = {
|
package/dist/thirdLib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/thirdLib/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/thirdLib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "annil",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.1",
|
|
4
4
|
"description": "微信小程序(原生开发)插件",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"coverage": "jest --coverage",
|
|
14
14
|
"prepare": "husky install",
|
|
15
|
+
"ship": "node scripts/ship.mjs",
|
|
15
16
|
"lint": "eslint . --max-warnings 0",
|
|
16
17
|
"fmt": "dprint fmt",
|
|
17
18
|
"tsc": "tsc --watch",
|
|
@@ -35,9 +36,9 @@
|
|
|
35
36
|
"jest-environment-jsdom": "^29.7.0",
|
|
36
37
|
"miniprogram-simulate": "^1.6.1",
|
|
37
38
|
"mobx": "^6.9.0",
|
|
38
|
-
"ts-jest": "^29.
|
|
39
|
-
"typescript": "^
|
|
40
|
-
"typescript-eslint": "^8.
|
|
39
|
+
"ts-jest": "^29.4.11",
|
|
40
|
+
"typescript": "^6.0.3",
|
|
41
|
+
"typescript-eslint": "^8.60.1",
|
|
41
42
|
"vitepress": "^1.6.4"
|
|
42
43
|
},
|
|
43
44
|
"files": [
|
|
@@ -34,7 +34,7 @@ CustomComponent<{
|
|
|
34
34
|
// @ts-expect-error 3 超出约束字段
|
|
35
35
|
nu1m: () => user.age,
|
|
36
36
|
// @ts-expect-error 4 与data的内部字段重复
|
|
37
|
-
|
|
37
|
+
_aaa_xxx: () => user.age,
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
40
|
CustomComponent<{
|
|
@@ -55,6 +55,6 @@ CustomComponent<{
|
|
|
55
55
|
}, DocA>()({
|
|
56
56
|
store: {
|
|
57
57
|
// @ts-expect-error 返回类型错误
|
|
58
|
-
aaa_num: () =>
|
|
58
|
+
aaa_num: () => "str",
|
|
59
59
|
},
|
|
60
60
|
});
|
|
@@ -5,6 +5,7 @@ import { CustomComponent } from "../..";
|
|
|
5
5
|
const user = observable({
|
|
6
6
|
name: "zhao",
|
|
7
7
|
age: 20,
|
|
8
|
+
isReady: false,
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
type DocA = ComponentDoc<{
|
|
@@ -16,7 +17,7 @@ type DocA = ComponentDoc<{
|
|
|
16
17
|
|
|
17
18
|
CustomComponent<{}, DocA>()({
|
|
18
19
|
store: {
|
|
19
|
-
// 1
|
|
20
|
+
// 1 可写文档字段
|
|
20
21
|
aaa_str: () => user.name,
|
|
21
22
|
aaa_num: () => user.age,
|
|
22
23
|
},
|
|
@@ -31,6 +32,12 @@ CustomComponent<{}, DocA, "a">()({
|
|
|
31
32
|
// store中可写 额外字段 isReady
|
|
32
33
|
CustomComponent<{ data: { _num: number } }, DocA, "a">()({
|
|
33
34
|
store: {
|
|
34
|
-
aaaA_isReady: () =>
|
|
35
|
+
aaaA_isReady: () => user.isReady,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
// 4 可以返回undefined,表示该字段不可响应式,不报错,有警告。
|
|
39
|
+
CustomComponent<{ properties: { num: number } }, DocA, "a">()({
|
|
40
|
+
store: {
|
|
41
|
+
aaaA_num: (data) => data.num > 10 ? user.age : void 0,
|
|
35
42
|
},
|
|
36
43
|
});
|
|
@@ -31,10 +31,7 @@ import type { CreatCustomComponentDoc } from "./CustomReturnType/CreateCustomCom
|
|
|
31
31
|
import type { CustomStoreConstraint } from "./CustomStore/CustomStoreConstraint";
|
|
32
32
|
import type { CustomStoreOption } from "./CustomStore/CustomStoreOption";
|
|
33
33
|
import type { CustomWatchOption } from "./CustomWatch/CustomWatchOption";
|
|
34
|
-
|
|
35
|
-
// : K extends keyof AllRootDataDoc ? never
|
|
36
|
-
// : K extends Extract<Exclude<keyof NoInfer<TSubStore>, keyof SubDataDoc>, InnerFields<Prefix>> ? K
|
|
37
|
-
// : never;
|
|
34
|
+
|
|
38
35
|
type Options<
|
|
39
36
|
RootDoc extends RootComponentDefinition,
|
|
40
37
|
IsPage extends boolean,
|
|
@@ -94,15 +91,6 @@ type Options<
|
|
|
94
91
|
: never;
|
|
95
92
|
}[keyof NoInfer<TSubStore>]
|
|
96
93
|
>
|
|
97
|
-
// 下面为之前的写法 不好与根组件的字段重复检测。
|
|
98
|
-
|
|
99
|
-
// // 合法的字段(继承组件类型的keys)
|
|
100
|
-
// | Exclude<CompDocKeys, (keyof (InheritDoc & SubDataDoc))>
|
|
101
|
-
// // 合法的内部字段(不与data重复的内部字段)
|
|
102
|
-
// | Extract<Exclude<keyof NoInfer<TSubStore>, keyof SubDataDoc>, InnerFields<Prefix>>
|
|
103
|
-
// 不与allData重复的字段
|
|
104
|
-
// | Exclude<keyof NoInfer<TSubStore>, keyof AllRootDataDoc>
|
|
105
|
-
|
|
106
94
|
& CustomComputedOption<
|
|
107
95
|
TSubComputed,
|
|
108
96
|
{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IfExtends } from "hry-types/src/Any/
|
|
1
|
+
import type { IfEquals, IfExtends } from "hry-types/src/Any/_api";
|
|
2
2
|
import type { Includes } from "../../../types/includes";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -18,7 +18,7 @@ export type NameOrPathOption<
|
|
|
18
18
|
: {
|
|
19
19
|
/**
|
|
20
20
|
* 组件名
|
|
21
|
-
* @remarks
|
|
21
|
+
* @remarks 不可为空串或包含下划线或空格
|
|
22
22
|
*/
|
|
23
23
|
name:
|
|
24
24
|
& TName
|
|
@@ -26,6 +26,6 @@ export type NameOrPathOption<
|
|
|
26
26
|
TName,
|
|
27
27
|
"",
|
|
28
28
|
() => "⚠️组件名不可为空⚠️",
|
|
29
|
-
|
|
29
|
+
IfEquals<Includes<TName, "_" | " ">, true, () => "⚠️组件名不可包含下划线或空格⚠️", unknown>
|
|
30
30
|
>;
|
|
31
31
|
};
|
|
@@ -2,7 +2,7 @@ import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
|
2
2
|
|
|
3
3
|
import type { CustomComponentDefinition, CustomComponentDefinitionRuntime } from "../CustomComponent/returnType";
|
|
4
4
|
import type { RootComponentDefinition, RootComponentDefinitionRuntime } from "../RootComponent/returnType";
|
|
5
|
-
import type { NameOrPathOption } from "./
|
|
5
|
+
import type { NameOrPathOption } from "./NameOrPath/NameOrPathOption";
|
|
6
6
|
import { normalizeOptions } from "./normalizeOptions";
|
|
7
7
|
import type { GenerateComponentDoc } from "./returnType/GenerateComponentDoc";
|
|
8
8
|
import type { GeneratePageDoc } from "./returnType/GeneratePageDoc";
|
|
@@ -1,31 +1,70 @@
|
|
|
1
1
|
import type mobx from "mobx";
|
|
2
2
|
import type { Instance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
3
3
|
import type { StoreConstraint } from "../../../RootComponent/Store/StoreConstraint";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 为store字段注册reaction,以实现响应式更新。
|
|
7
|
+
* 注意:如果getter函数返回undefined,则不会注册reaction,该字段将不可响应式,但不报错(有警告)。如果getter函数没有依赖任何响应式数据,则不会注册reaction,该字段将不可响应式,并抛出错误。
|
|
8
|
+
* @param this
|
|
9
|
+
* @param storeConfig
|
|
10
|
+
*/
|
|
4
11
|
export function reactionRegister(this: Instance, storeConfig: StoreConstraint) {
|
|
5
12
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
6
|
-
const { comparer, reaction, toJS } = require("mobx") as typeof mobx;
|
|
7
|
-
//
|
|
13
|
+
const { comparer, getDependencyTree, reaction, toJS } = require("mobx") as typeof mobx;
|
|
14
|
+
// 1. 清理旧的reaction,避免重复注册(组件detached),虽然在detached时加入了清理reaction的逻辑,但在某些极端情况下可能无法触发(如组件未调用detached周期,就又运行了attached周期),因此在这里先清理一次,确保不会重复注册。
|
|
15
|
+
if (this.disposer) {
|
|
16
|
+
for (const key of Object.keys(this.disposer)) {
|
|
17
|
+
this.disposer[key]();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
8
20
|
this.disposer = {};
|
|
9
|
-
const
|
|
10
|
-
|
|
21
|
+
const pendingSetData: Record<string, unknown> = {};
|
|
22
|
+
|
|
23
|
+
for (const key of Object.keys(storeConfig)) {
|
|
11
24
|
const getter = storeConfig[key];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
|
|
26
|
+
// 1. 临时 reaction:只用来检测依赖
|
|
27
|
+
let hasObservableDependency = false;
|
|
28
|
+
let firstRunValue: unknown;
|
|
29
|
+
|
|
30
|
+
const tempDisposer = reaction(
|
|
31
|
+
() => {
|
|
32
|
+
const value = getter(this.data);
|
|
33
|
+
firstRunValue = value; // 顺便获取初始值
|
|
34
|
+
return value;
|
|
35
|
+
},
|
|
36
|
+
() => void 0, // 空回调,零副作用
|
|
37
|
+
{ fireImmediately: true },
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// 2. 检查依赖
|
|
41
|
+
const deps = getDependencyTree(tempDisposer).dependencies ?? [];
|
|
42
|
+
hasObservableDependency = deps.length > 0;
|
|
43
|
+
// 3. 清理临时 reaction
|
|
44
|
+
tempDisposer();
|
|
45
|
+
|
|
46
|
+
// 4. 验证
|
|
47
|
+
if (firstRunValue === undefined) {
|
|
48
|
+
console.warn(`store字段 ${key} 的getter函数返回了undefined,该字段将不会被注册为响应式字段。`);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!hasObservableDependency) {
|
|
53
|
+
throw new Error(`store字段 ${key} 的getter函数没有依赖任何响应式数据。`);
|
|
15
54
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
55
|
+
|
|
56
|
+
// 5. 正式绑定
|
|
57
|
+
const disposer = reaction(
|
|
19
58
|
() => getter(this.data),
|
|
20
59
|
(value: unknown) => {
|
|
21
|
-
this.setData({
|
|
22
|
-
[key]: toJS(value),
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
equals: comparer.structural,
|
|
60
|
+
this.setData({ [key]: toJS(value) });
|
|
27
61
|
},
|
|
62
|
+
{ equals: comparer.structural },
|
|
28
63
|
);
|
|
64
|
+
|
|
65
|
+
pendingSetData[key] = toJS(firstRunValue);
|
|
66
|
+
this.disposer[key] = disposer;
|
|
29
67
|
}
|
|
30
|
-
|
|
68
|
+
|
|
69
|
+
this.setData(pendingSetData);
|
|
31
70
|
}
|
|
@@ -7,7 +7,7 @@ import { computedUpdater } from "../initComputed/computedUpdater";
|
|
|
7
7
|
import { addDetachedData } from "./addDetachedData";
|
|
8
8
|
import { hijack } from "./hijack";
|
|
9
9
|
import { isPageCheck } from "./isPageCheck";
|
|
10
|
-
import { loadReceivedDataHandle } from "./loadReceivedDataHandle";
|
|
10
|
+
// import { loadReceivedDataHandle } from "./loadReceivedDataHandle";
|
|
11
11
|
import { onLoadReceivedDataHandle } from "./onLoadReceivedDataHandle";
|
|
12
12
|
import { pagePathCheck } from "./pagePathCheck";
|
|
13
13
|
|
|
@@ -16,10 +16,9 @@ export function hijackHandle(
|
|
|
16
16
|
isPage: boolean | undefined,
|
|
17
17
|
path: string | undefined,
|
|
18
18
|
) {
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
19
|
+
// if (finalOptionsForComponent.isPage) {
|
|
20
|
+
// hijack(finalOptionsForComponent.pageLifetimes, "load", [loadReceivedDataHandle]);
|
|
21
|
+
// }
|
|
23
22
|
|
|
24
23
|
hijack(finalOptionsForComponent.methods, "onLoad", [onLoadReceivedDataHandle]);
|
|
25
24
|
hijack(finalOptionsForComponent.observers, "**", [
|
|
@@ -37,6 +36,7 @@ export function hijackHandle(
|
|
|
37
36
|
initStore(finalOptionsForComponent.store),
|
|
38
37
|
// 计算属性的初始化应该在store初始化之后,因为计算属性可能依赖store。
|
|
39
38
|
initComputed(finalOptionsForComponent.computed, finalOptionsForComponent.watch),
|
|
39
|
+
// 在初始化计算属性后,再让构建组件时的observers的回调函数被调用.避免回调函数中用到了计算属性的值时报错。
|
|
40
40
|
function(this: Instance) {
|
|
41
41
|
const observerhandlers = this.data.__oberverHandler__;
|
|
42
42
|
if (observerhandlers) {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
// /**
|
|
2
|
+
// * 针对通过 navigateTo传过来的数据对组件load周期传入数据解析
|
|
3
|
+
// * @param option - option中的url是拼接了encodeURIComponent转码的data对象的,key为INNERMARKER.url
|
|
4
|
+
// */
|
|
5
5
|
|
|
6
|
-
import { INNERMARKER } from "../../../../utils/InnerMarker";
|
|
7
|
-
import type { PageInstance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
6
|
+
// import { INNERMARKER } from "../../../../utils/InnerMarker";
|
|
7
|
+
// import type { PageInstance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
8
8
|
|
|
9
|
-
/* istanbul ignore next miniprogram-simulate(当前版本 1.6.1) 无法测试load */
|
|
10
|
-
export function loadReceivedDataHandle(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
// /* istanbul ignore next miniprogram-simulate(当前版本 1.6.1) 无法测试load */
|
|
10
|
+
// export function loadReceivedDataHandle(
|
|
11
|
+
// this: PageInstance,
|
|
12
|
+
// option: Record<typeof INNERMARKER.url, string>,
|
|
13
|
+
// ) {
|
|
14
|
+
// const innerData: string | undefined = option[INNERMARKER.url];
|
|
15
|
+
// // 未使用自定义的navigateTo
|
|
16
|
+
// if (innerData === undefined) return;
|
|
17
|
+
// // 使用navigateTo API
|
|
18
|
+
// const decodeOption = JSON.parse(decodeURIComponent(innerData));
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
20
|
+
// for (const key in decodeOption) {
|
|
21
|
+
// option[key] = decodeOption[key];
|
|
22
|
+
// }
|
|
23
|
+
// // 给onLoad劫持函数一个标记,判断在新框架下已经被解析过了
|
|
24
|
+
// option[INNERMARKER.url] = INNERMARKER.url;
|
|
25
|
+
// }
|
|
@@ -18,7 +18,7 @@ import type { ComputedCache } from "./initComputed/initComputedAndGetCache";
|
|
|
18
18
|
import { injectInfoHandler } from "./injectInfoHandler";
|
|
19
19
|
import { InternalFieldProtection } from "./internalFieldProtection";
|
|
20
20
|
import { sameFuncOptionsHandle } from "./sameFuncOptionsHandle";
|
|
21
|
-
import {
|
|
21
|
+
import { handleWatchConfig } from "./watchHandler";
|
|
22
22
|
// 因为watch字段可能有多个变量,所以在这里定义的value是一个数组
|
|
23
23
|
export type WatchOldValue = Record<string, unknown[]>;
|
|
24
24
|
export type ThrottleDebounce = Partial<Record<"throttle" | "debounce", Record<string, number>>>;
|
|
@@ -116,7 +116,7 @@ export function normalizeOptions(
|
|
|
116
116
|
applyDebounceAndThrottle(finalOptionsForComponent.methods);
|
|
117
117
|
|
|
118
118
|
// 处理watch配置,注意的是 oldValue中的计算属性初始赋值在计算属性初始化完毕后,即计算属性初始化后,再变化时才会被watch到。
|
|
119
|
-
|
|
119
|
+
handleWatchConfig(finalOptionsForComponent);
|
|
120
120
|
|
|
121
121
|
// BBeforeCreate在最后面,让BeforeCreate生命周期运行在最终建立组件时。用于测试。
|
|
122
122
|
finalOptionsForComponent.behaviors.push(BBeforeCreate);
|
|
@@ -6,7 +6,8 @@ import { getPathsValue } from "./getPathsValue";
|
|
|
6
6
|
import { getPropertiesValue } from "./getPropertiesValue";
|
|
7
7
|
import { hasComputedPath } from "./hasComputedPath";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// 初始化watch监控字段的旧值对象,排除有计算属性的字段。
|
|
10
|
+
function initWatchOldValuesWithoutComputed(
|
|
10
11
|
data: FinalOptionsOfComponent["data"],
|
|
11
12
|
watchConfig: object,
|
|
12
13
|
computedKeys: string[],
|
|
@@ -27,6 +28,7 @@ function observerHandler(
|
|
|
27
28
|
watchHadle: Func,
|
|
28
29
|
...newValue: unknown[]
|
|
29
30
|
) {
|
|
31
|
+
// 先调用原生observers的回调函数,再调用watch的回调函数。因为watch的回调函数可能会用到原生observers回调函数中更新的数据。
|
|
30
32
|
originObserversHandle?.call(this, ...newValue);
|
|
31
33
|
const watchOldValue = nonNullable(this.data.__watchOldValue__);
|
|
32
34
|
const oldValue = watchOldValue[key];
|
|
@@ -34,7 +36,15 @@ function observerHandler(
|
|
|
34
36
|
watchOldValue[key] = deepClone(newValue);
|
|
35
37
|
watchHadle.call(this, ...newValue, ...oldValue);
|
|
36
38
|
}
|
|
37
|
-
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 把watch配置转换成observers配置的形式,并在回调函数中调用watch的回调函数。
|
|
42
|
+
* 小程序的observers是通过监控setData字段,来触发的,不会比较值的变化,小程序底层代码可以监控到properties变化时的setData动作.
|
|
43
|
+
* watch字段的目的是数据变化时才触发回调函数,但由于实例中无法通过setData的调用来监听到properties字段变化,所以watch字段的实现方式是通过在observers回调函数中比较新旧值来实现的。
|
|
44
|
+
* 还要在组件实例上维护一个__watchOldValue__对象来存储watch监控字段的旧值,以便在回调函数中进行比较。
|
|
45
|
+
* @param finalOptionsForComponent
|
|
46
|
+
*/
|
|
47
|
+
export function handleWatchConfig(
|
|
38
48
|
finalOptionsForComponent: FinalOptionsOfComponent,
|
|
39
49
|
) {
|
|
40
50
|
const { observers: observersConfig, watch: watchConfig, data, properties, computed: computedConfig } =
|
|
@@ -42,7 +52,11 @@ export function watchHandler(
|
|
|
42
52
|
if (!isEmptyObject(watchConfig)) {
|
|
43
53
|
const rawPropertiesValue = getPropertiesValue(properties);
|
|
44
54
|
const computedKeys = Object.keys(computedConfig);
|
|
45
|
-
data.__watchOldValue__ =
|
|
55
|
+
data.__watchOldValue__ = initWatchOldValuesWithoutComputed(
|
|
56
|
+
{ ...data, ...rawPropertiesValue },
|
|
57
|
+
watchConfig,
|
|
58
|
+
computedKeys,
|
|
59
|
+
);
|
|
46
60
|
for (const key in watchConfig) {
|
|
47
61
|
const watchHadle = watchConfig[key];
|
|
48
62
|
const originObserversHandle = observersConfig[key] as Func | undefined;
|
|
@@ -8,17 +8,7 @@ export type PageLifetimesOption<TIsPage extends boolean, PropertiesDoc extends o
|
|
|
8
8
|
TIsPage,
|
|
9
9
|
false,
|
|
10
10
|
{
|
|
11
|
-
pageLifetimes?:
|
|
12
|
-
// 官方组件页面生命周期
|
|
13
|
-
& Partial<WMCompPageLifetimes>
|
|
14
|
-
& {
|
|
15
|
-
/**
|
|
16
|
-
* 周期发生在组件attached之后,页面onLoad之前,要求组件为同步组件
|
|
17
|
-
* 最低基础库: `3.0.2`
|
|
18
|
-
*/
|
|
19
|
-
load?: (props?: object) => void;
|
|
20
|
-
}
|
|
21
|
-
>;
|
|
11
|
+
pageLifetimes?: Partial<WMCompPageLifetimes>;
|
|
22
12
|
},
|
|
23
13
|
{
|
|
24
14
|
/**
|
|
@@ -3,17 +3,14 @@ import type { Select } from "hry-types/src/Object/Select";
|
|
|
3
3
|
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
4
4
|
import type { GetOptionalDef } from "./GetOptionalDef";
|
|
5
5
|
|
|
6
|
+
import type { As } from "hry-types/src/Any/As";
|
|
6
7
|
import type { GetRequiredDef } from "./GetRequiredDef";
|
|
7
|
-
import type { OptionalType, PropertiesConstraint } from "./PropertiesConstraint";
|
|
8
|
+
import type { OptionalType, PropertiesConstraint, RequiredType } from "./PropertiesConstraint";
|
|
8
9
|
|
|
9
10
|
type _GetPropertiesDef<
|
|
10
11
|
TProperties extends PropertiesConstraint,
|
|
11
|
-
OptionalDef extends object =
|
|
12
|
-
|
|
13
|
-
GetOptionalDef<Select<TProperties, OptionalType>>,
|
|
14
|
-
RequiredDef extends object =
|
|
15
|
-
// @ts-expect-error dddf
|
|
16
|
-
GetRequiredDef<Omit<TProperties, keyof OptionalDef>>,
|
|
12
|
+
OptionalDef extends object = GetOptionalDef<As<Select<TProperties, OptionalType>, Record<string, OptionalType>>>,
|
|
13
|
+
RequiredDef extends object = GetRequiredDef<As<Omit<TProperties, keyof OptionalDef>, Record<string, RequiredType>>>,
|
|
17
14
|
> = ComputeIntersection<OptionalDef & RequiredDef>;
|
|
18
15
|
|
|
19
16
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { G } from "hry-types";
|
|
2
1
|
import type { Validators } from "../../../types/Validators";
|
|
3
2
|
import type { PropertiesConstraint } from "./PropertiesConstraint";
|
|
4
3
|
import type { PropertiesValueValidator } from "./PropertiesValueValidator";
|
|
@@ -12,7 +11,7 @@ export type PropertiesOption<
|
|
|
12
11
|
*
|
|
13
12
|
* 禁用observable字段(watch代替)
|
|
14
13
|
*
|
|
15
|
-
*
|
|
14
|
+
* 简写 → 必传,单一类型。对象写法 + optionalTypes → 必传,联合类型。对象写法 + value → 可选传(有默认值),可同时配合 optionalTypes。
|
|
16
15
|
*
|
|
17
16
|
* 有value类型检测和非法字段检测(例如value写出values)
|
|
18
17
|
*/
|
|
@@ -20,7 +19,7 @@ export type PropertiesOption<
|
|
|
20
19
|
& TProperties
|
|
21
20
|
& Validators<[
|
|
22
21
|
PropertiesValueValidator<TProperties>,
|
|
23
|
-
// 放在最后一个,正常返回不是unknown 而是Record<string,unknown>
|
|
24
|
-
G.IllegalFieldValidator<TProperties, "value" | "type" | "optionalTypes", 1>,
|
|
22
|
+
// // 放在最后一个,正常返回不是unknown 而是Record<string,unknown>
|
|
23
|
+
// G.IllegalFieldValidator<TProperties, "value" | "type" | "optionalTypes", 1>,
|
|
25
24
|
]>;
|
|
26
25
|
};
|
|
@@ -8,7 +8,7 @@ const user = observable({
|
|
|
8
8
|
// 1 约束错误
|
|
9
9
|
RootComponent()({
|
|
10
10
|
store: {
|
|
11
|
-
// @ts-expect-error 1.1 不能将类型“string”分配给类型“
|
|
11
|
+
// @ts-expect-error 1.1 不能将类型“string”分配给类型“Getter<{}, unknown>”
|
|
12
12
|
userName: user.name,
|
|
13
13
|
},
|
|
14
14
|
});
|
|
@@ -28,10 +28,3 @@ RootComponent()({
|
|
|
28
28
|
userAge: () => user.age,
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
|
-
// 3. 返回类型错误
|
|
32
|
-
RootComponent()({
|
|
33
|
-
store: {
|
|
34
|
-
// @ts-expect-error 3.1 返回类型中不可以包含undefined
|
|
35
|
-
xxx: () => "xxx" as string | undefined,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Checking, type Test } from "hry-types";
|
|
2
1
|
import { observable } from "mobx";
|
|
2
|
+
import { typeEqual } from "../../../../utils/_utils";
|
|
3
3
|
import { RootComponent } from "../..";
|
|
4
4
|
const user = observable({
|
|
5
5
|
name: "zhao",
|
|
@@ -7,18 +7,29 @@ const user = observable({
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
const storeDoc = RootComponent()({
|
|
10
|
+
properties: {
|
|
11
|
+
condition: Number,
|
|
12
|
+
},
|
|
10
13
|
store: {
|
|
14
|
+
// normal
|
|
11
15
|
userName: () => user.name,
|
|
12
|
-
|
|
16
|
+
// 条件反应式,当condition>10时,响应式,否则不可响应式(返回undefined),但不报错(有警告).
|
|
17
|
+
userAge: (props) => {
|
|
18
|
+
if (props.condition > 10) {
|
|
19
|
+
return user.age;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
},
|
|
13
23
|
},
|
|
14
24
|
});
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
|
|
26
|
+
type StoreDocExpected = {
|
|
27
|
+
properties: {
|
|
28
|
+
condition: number;
|
|
29
|
+
};
|
|
17
30
|
store: {
|
|
18
31
|
userName: string;
|
|
19
|
-
userAge: number;
|
|
32
|
+
userAge: number | undefined;
|
|
20
33
|
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// 返回类型为函数返回类型
|
|
24
|
-
void Checking<typeof storeDoc, StoreDocExpected, Test.Pass>;
|
|
34
|
+
};
|
|
35
|
+
typeEqual<StoreDocExpected>()(storeDoc);
|
package/tsconfig.json
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": ["ES2022", "DOM"], // jest中用到了DOM类型
|
|
4
4
|
"target": "ES2017",
|
|
5
|
-
"module": "
|
|
6
|
-
"moduleResolution": "
|
|
5
|
+
"module": "es2022",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
7
|
"skipLibCheck": true, // 跳过声明文件的类型检查(.d.ts),你引用的依然会检查, 默认false(不跳过)。
|
|
8
8
|
"esModuleInterop": true, // 默认false. 兼容非ES模块引用的写法(如 import fs from 'fs').
|
|
9
9
|
"allowSyntheticDefaultImports": true, // 默认false. 允许从没有设置默认导出的模块中默认导入。
|
|
10
|
+
"verbatimModuleSyntax": true, // 保留原始import/export语法, 与ESM写法一致。
|
|
10
11
|
"strict": true,
|
|
11
12
|
"noEmit": true, // 不生成输出文件。
|
|
12
13
|
// "resolveJsonModule": true, // 允许导入json模块。
|
|
@@ -16,7 +17,6 @@
|
|
|
16
17
|
"exactOptionalPropertyTypes": true, // 带有?标志的属性类型不在包含undefined类型
|
|
17
18
|
"noImplicitReturns": true, // 当启用时,TypeScript会检查函数中的所有代码路径,以确保它们返回值
|
|
18
19
|
"isolatedModules": true, // 模块化(.ts文件必须有导入或导出) 默认false
|
|
19
|
-
// "verbatimModuleSyntax": true, // 5.0后新增配置,替代preserveValueImports。
|
|
20
20
|
"types": ["hry-types", "mobx", "jest", "miniprogram-api-typings", "node"]
|
|
21
21
|
},
|
|
22
22
|
"include": ["src/**/*.ts", "jest/**/*.ts"],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NameOrPathOption.js","sourceRoot":"","sources":["../../../../src/api/DefineComponent/NameOrPage/NameOrPathOption.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { INNERMARKER } from "../../../../utils/InnerMarker";
|
|
2
|
-
import type { PageInstance } from "../../../RootComponent/Instance/RootComponentInstance";
|
|
3
|
-
export declare function loadReceivedDataHandle(this: PageInstance, option: Record<typeof INNERMARKER.url, string>): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { INNERMARKER } from "../../../../utils/InnerMarker";
|
|
2
|
-
export function loadReceivedDataHandle(option) {
|
|
3
|
-
const innerData = option[INNERMARKER.url];
|
|
4
|
-
if (innerData === undefined)
|
|
5
|
-
return;
|
|
6
|
-
const decodeOption = JSON.parse(decodeURIComponent(innerData));
|
|
7
|
-
for (const key in decodeOption) {
|
|
8
|
-
option[key] = decodeOption[key];
|
|
9
|
-
}
|
|
10
|
-
option[INNERMARKER.url] = INNERMARKER.url;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=loadReceivedDataHandle.js.map
|
package/dist/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loadReceivedDataHandle.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/normalizeOptions/hijackHandle/loadReceivedDataHandle.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAI5D,MAAM,UAAU,sBAAsB,CAEpC,MAA8C;IAE9C,MAAM,SAAS,GAAuB,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAE9D,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO;IAEpC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;IAE/D,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC;AAC5C,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|