@mybricks/to-code-taro 1.0.4 → 1.0.5

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.
@@ -38,10 +38,6 @@ function deepProxy(target, onSet) {
38
38
  if (prop === "toJSON")
39
39
  return () => obj;
40
40
  let value = obj[prop];
41
- const mybricksMethods = ["get", "set", "changed", "reset", "registerChange", "call", "apply", "bind", "push", "pop"];
42
- if (value === void 0 && typeof prop === "string" && !mybricksMethods.includes(prop)) {
43
- value = obj[prop] = {};
44
- }
45
41
  if (typeof value === "object" && value !== null && !value.__isProxy) {
46
42
  obj[prop] = deepProxy(value, onSet);
47
43
  }
@@ -19,12 +19,8 @@ export function deepProxy(target, onSet) {
19
19
  };
20
20
  var value = obj[prop];
21
21
 
22
- // 只有在访问不存在的对象属性时,才自动创建(实现类似 ensure 的效果)
23
- // 特意排除 MyBricks 内置的方法名,以便在生成代码中进行初始化判断
24
- var mybricksMethods = ['get', 'set', 'changed', 'reset', 'registerChange', 'call', 'apply', 'bind', 'push', 'pop'];
25
- if (value === undefined && typeof prop === 'string' && !mybricksMethods.includes(prop)) {
26
- value = obj[prop] = {};
27
- }
22
+ // 只代理已存在的对象属性,不自动创建空对象
23
+ // 避免访问不存在的属性(如 disabled)时污染原始数据
28
24
  if (_typeof(value) === 'object' && value !== null && !value.__isProxy) {
29
25
  obj[prop] = deepProxy(value, onSet);
30
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mybricks/to-code-taro",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "To code for Taro",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",