efront 3.38.1 → 3.38.2

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.
@@ -199,11 +199,11 @@ var getString = function (object, filter, space) {
199
199
  while (cx < dx) {
200
200
  key = ks ? ks[cx] : cx;
201
201
  var backlength = str.length;
202
- if (backlength > 1) str += ',';
202
+ if (cx > 0) str += ',';
203
203
  if (space) str += '\n' + new Array(objects.length + 1).join(space);
204
204
  if (ks) {
205
- str += (toString(key) + ":");
206
- if (space) str += (" ");
205
+ str += toString(key) + ":";
206
+ if (space) str += " ";
207
207
  };
208
208
  var v = get(object[key]);
209
209
  if (isObject(v)) {
@@ -221,7 +221,7 @@ var getString = function (object, filter, space) {
221
221
  }
222
222
  if (cx === dx) {
223
223
  if (dx > 0) {
224
- if (space) str += ('\n' + new Array(objects.length).join(space))
224
+ if (space) str += '\n' + new Array(objects.length).join(space)
225
225
  }
226
226
  str += ks ? '}' : ']';
227
227
  pop();
@@ -64,7 +64,7 @@ var test = function (JSON) {
64
64
  var start = new Date();
65
65
  try {
66
66
  var res = call(arg, null, space);
67
- } catch{
67
+ } catch {
68
68
  res = "error";
69
69
  }
70
70
  var delta = new Date - start;
@@ -79,10 +79,88 @@ var test = function (JSON) {
79
79
  });
80
80
 
81
81
  };
82
+ var test2 = function (JSON) {
83
+ var data = [{
84
+ "name": i18n(`\u4ee3\u7406\u8def\u5f84`, `Proxy Path`),
85
+ "type": "input",
86
+ "key": "url",
87
+ "comment": "",
88
+ "size": "120",
89
+ "unit": "bit",
90
+ "ratio": 0.125,
91
+ "required": true
92
+ }, {
93
+ "name": i18n(`\u4e8c\u7ef4\u7801`, `QR code`),
94
+ "type": "1byte",
95
+ "key": "url",
96
+ "comment": "",
97
+ "size": "1",
98
+ "unit": "byte",
99
+ "ratio": 1,
100
+ "readonly": true
101
+ }, {
102
+ "name": i18n(`\u771f\u5b9e\u8def\u5f84`, `Real path`),
103
+ "type": "url",
104
+ "key": "realpath",
105
+ "comment": "",
106
+ "size": "300",
107
+ "unit": "bit",
108
+ "ratio": 0.125
109
+ }, {
110
+ "name": i18n(`\u52a8\u4f5c`, `action`),
111
+ "type": "select",
112
+ "key": "action",
113
+ "comment": "",
114
+ "options": [{
115
+ "name": "跳转",
116
+ "value": 0
117
+ }, {
118
+ "name": "转发",
119
+ "value": 1
120
+ }],
121
+ "size": "100",
122
+ "unit": "bit",
123
+ "ratio": 0.125
124
+ }, {
125
+ "name": i18n(`\u72b6\u6001`, `state`),
126
+ "type": "select",
127
+ "key": "status",
128
+ "comment": "",
129
+ "options": [{
130
+ "name": "启用",
131
+ "value": 0
132
+ }, {
133
+ "name": "禁用",
134
+ "value": 1
135
+ }],
136
+ "size": "100",
137
+ "unit": "bit",
138
+ "ratio": 0.125
139
+ }, {
140
+ "name": i18n(``, ``),
141
+ "type": "byte",
142
+ "key": "",
143
+ "comment": "",
144
+ "options": {
145
+ name: "访问",
146
+ do(o) {
147
+ var url = o.url;
148
+ if (!/^\//.test(url))
149
+ url = "/" + url;
150
+ window.open(url, null);
151
+ }
152
+ },
153
+ "size": 1,
154
+ "unit": "byte",
155
+ "ratio": 1,
156
+ "readonly": true
157
+ }];
158
+ assert(JSON.stringify(data, null, 4), JSON0.stringify(data, null, 4))
159
+ }
82
160
  function JSON_test() {
83
161
  window.JSON0 = JSON0;
84
162
  window.JSON = void 0;
85
163
  delete modules.JSON;
86
- modules.init("JSON", test);
164
+ modules.init("JSON", test2);
87
165
  window.JSON = JSON0;
88
166
  }
@@ -63,19 +63,17 @@ var trimStringLiteral = function (block) {
63
63
  }
64
64
  return block_string;
65
65
  };
66
- var paramsMap = Object.create(null);
66
+ var paramsMap = null;
67
67
  var module_string = '';
68
- function breakcode(data, args) {
69
- if (!args) return [data];
68
+ function breakcode(data, occurs) {
69
+ if (!occurs) return [data];
70
70
  module_string = data;
71
- Object.keys(args).forEach(function (key) {
72
- paramsMap[key] = true;
73
- });
71
+ paramsMap = Object.assign(Object.create(null), occurs);
74
72
  var code_blocks = scanner(module_string);
75
73
  module_string = code_blocks.map(trimStringLiteral).join("");
76
- var res = Object.keys(paramsMap).filter(k => !hasOwnProperty.call(args, k));
74
+ var res = Object.keys(paramsMap).filter(k => !hasOwnProperty.call(occurs, k));
77
75
  var val = res.map(k => paramsMap[k]);
78
- paramsMap = Object.create(null);
76
+ paramsMap = null;
79
77
  data = module_string;
80
78
  module_string = '';
81
79
  return [data, res, val];
@@ -126,6 +126,24 @@ class Code extends Array {
126
126
  set scoped(w) {
127
127
  this._scoped = w;
128
128
  }
129
+ get occurs() {
130
+ var rest = [this.scoped];
131
+ var occurs = Object.create(null);
132
+ Object.assign(occurs, this.scoped.envs);
133
+ while (rest.length) {
134
+ var scoped = rest.pop();
135
+ for (var k in scoped.vars) {
136
+ if (k in occurs) continue;
137
+ occurs[k] = true;
138
+ }
139
+ for (var k in scoped.lets) {
140
+ if (k in occurs) continue;
141
+ occurs[k] = true;
142
+ }
143
+ rest.push(...scoped);
144
+ }
145
+ return occurs;
146
+ }
129
147
  getUndecleared() {
130
148
  var res = Object.create(null);
131
149
  for (var k in this.envs) {
@@ -26,8 +26,8 @@ var checkUnEqual = function (deepEqual) {
26
26
  && !deepEqual({ b: 0 }, { a: 0 })
27
27
  && !deepEqual({ b: 0 }, { a: 0 })
28
28
  && !deepEqual(new Date(1), new Date(2))
29
- && !deepEqual(document.createElement("a"), document.createElement("b"))
30
- && !deepEqual(window, document)
29
+ // && !deepEqual(document.createElement("a"), document.createElement("b"))
30
+ // && !deepEqual(window, document)
31
31
  && !deepEqual(function () { }, function (a) { return a })
32
32
  && !deepEqual({ a: {} }, { a: new Date() })
33
33
  && !deepEqual({ a: { c: {} } }, { a: { b: {} } })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.38.1",
3
+ "version": "3.38.2",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {