@byteluck-fe/model-driven-engine 2.6.0-alpha.1 → 2.6.0-alpha.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.
- package/dist/esm/common/ActionManager.js +72 -154
- package/dist/esm/common/DataManager.js +60 -128
- package/dist/esm/common/Engine.js +1104 -1054
- package/dist/esm/common/OkWorker.js +106 -75
- package/dist/esm/common/Runtime.js +29 -27
- package/dist/esm/common/Store.js +180 -148
- package/dist/esm/common/checkerValue.js +328 -253
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +47 -47
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +378 -302
- package/dist/esm/plugins/ControlsEventPlugin.js +141 -225
- package/dist/esm/plugins/ES6ModulePlugin.js +56 -38
- package/dist/esm/plugins/LifecycleEventPlugin.js +107 -190
- package/dist/esm/plugins/StylePlugin.js +31 -13
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +7 -5
- package/dist/index.umd.js +8 -8
- package/dist/types/common/ActionManager.d.ts +14 -14
- package/dist/types/common/DataManager.d.ts +10 -10
- package/dist/types/common/Engine.d.ts +180 -180
- package/dist/types/common/OkWorker.d.ts +13 -13
- package/dist/types/common/Plugin.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +25 -25
- package/dist/types/common/Store.d.ts +49 -49
- package/dist/types/common/checkerValue.d.ts +3 -3
- package/dist/types/common/index.d.ts +2 -2
- package/dist/types/common/proxyState.d.ts +30 -30
- package/dist/types/index.d.ts +3 -3
- package/dist/types/plugins/CalcPlugin.d.ts +121 -121
- package/dist/types/plugins/ControlsEventPlugin.d.ts +15 -15
- package/dist/types/plugins/ES6ModulePlugin.d.ts +26 -26
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +14 -14
- package/dist/types/plugins/StylePlugin.d.ts +12 -12
- package/dist/types/plugins/index.d.ts +5 -5
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/runtimeUtils.d.ts +5 -5
- package/package.json +4 -4
|
@@ -32,102 +32,22 @@ function _classCallCheck(instance, Constructor) {
|
|
|
32
32
|
throw new TypeError("Cannot call a class as a function");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
trys: [],
|
|
43
|
-
ops: []
|
|
44
|
-
};
|
|
45
|
-
return(g = {
|
|
46
|
-
next: verb(0),
|
|
47
|
-
"throw": verb(1),
|
|
48
|
-
"return": verb(2)
|
|
49
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
50
|
-
return this;
|
|
51
|
-
}), g);
|
|
52
|
-
function verb(n) {
|
|
53
|
-
return function(v) {
|
|
54
|
-
return step([
|
|
55
|
-
n,
|
|
56
|
-
v
|
|
57
|
-
]);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function step(op) {
|
|
61
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
62
|
-
while(_)try {
|
|
63
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
64
|
-
if (y = 0, t) op = [
|
|
65
|
-
op[0] & 2,
|
|
66
|
-
t.value
|
|
67
|
-
];
|
|
68
|
-
switch(op[0]){
|
|
69
|
-
case 0:
|
|
70
|
-
case 1:
|
|
71
|
-
t = op;
|
|
72
|
-
break;
|
|
73
|
-
case 4:
|
|
74
|
-
_.label++;
|
|
75
|
-
return {
|
|
76
|
-
value: op[1],
|
|
77
|
-
done: false
|
|
78
|
-
};
|
|
79
|
-
case 5:
|
|
80
|
-
_.label++;
|
|
81
|
-
y = op[1];
|
|
82
|
-
op = [
|
|
83
|
-
0
|
|
84
|
-
];
|
|
85
|
-
continue;
|
|
86
|
-
case 7:
|
|
87
|
-
op = _.ops.pop();
|
|
88
|
-
_.trys.pop();
|
|
89
|
-
continue;
|
|
90
|
-
default:
|
|
91
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
92
|
-
_ = 0;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
96
|
-
_.label = op[1];
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
100
|
-
_.label = t[1];
|
|
101
|
-
t = op;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
if (t && _.label < t[2]) {
|
|
105
|
-
_.label = t[2];
|
|
106
|
-
_.ops.push(op);
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
if (t[2]) _.ops.pop();
|
|
110
|
-
_.trys.pop();
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
op = body.call(thisArg, _);
|
|
114
|
-
} catch (e) {
|
|
115
|
-
op = [
|
|
116
|
-
6,
|
|
117
|
-
e
|
|
118
|
-
];
|
|
119
|
-
y = 0;
|
|
120
|
-
} finally{
|
|
121
|
-
f = t = 0;
|
|
122
|
-
}
|
|
123
|
-
if (op[0] & 5) throw op[1];
|
|
124
|
-
return {
|
|
125
|
-
value: op[0] ? op[1] : void 0,
|
|
126
|
-
done: true
|
|
127
|
-
};
|
|
35
|
+
function _defineProperties(target, props) {
|
|
36
|
+
for(var i = 0; i < props.length; i++){
|
|
37
|
+
var descriptor = props[i];
|
|
38
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
39
|
+
descriptor.configurable = true;
|
|
40
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
41
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
128
42
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
43
|
+
}
|
|
44
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
45
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
46
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
|
+
return Constructor;
|
|
48
|
+
}
|
|
49
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
50
|
+
import { EventLogic } from '@byteluck-fe/model-driven-shared';
|
|
131
51
|
// type EventKeyMap = {
|
|
132
52
|
// [eventKey in EventKeys]?: string
|
|
133
53
|
// }
|
|
@@ -137,140 +57,136 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
|
|
|
137
57
|
_classCallCheck(this, ControlsEventPlugin);
|
|
138
58
|
this.config = config;
|
|
139
59
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
};
|
|
174
|
-
_proto.engineAddEventListener = function engineAddEventListener(eventKey, controlEventKey) {
|
|
175
|
-
var _this = this;
|
|
176
|
-
this.engine.on(eventKey, function() {
|
|
177
|
-
var _ref = _asyncToGenerator(function(payload) {
|
|
178
|
-
return __generator(this, function(_state) {
|
|
179
|
-
switch(_state.label){
|
|
180
|
-
case 0:
|
|
181
|
-
// 初始化state的时候不触发change事件,必须在engine mounted以后才触发
|
|
182
|
-
if (eventKey === "change" && !_this.engine.isMounted) {
|
|
183
|
-
return [
|
|
184
|
-
2
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
if (!(payload.instance !== undefined)) return [
|
|
188
|
-
3,
|
|
189
|
-
2
|
|
190
|
-
];
|
|
191
|
-
return [
|
|
192
|
-
4,
|
|
193
|
-
_this.callControlEvent(controlEventKey, payload)
|
|
194
|
-
];
|
|
195
|
-
case 1:
|
|
196
|
-
return [
|
|
197
|
-
2,
|
|
198
|
-
_state.sent()
|
|
199
|
-
];
|
|
200
|
-
case 2:
|
|
201
|
-
return [
|
|
202
|
-
2
|
|
203
|
-
];
|
|
60
|
+
_createClass(ControlsEventPlugin, [
|
|
61
|
+
{
|
|
62
|
+
key: "apply",
|
|
63
|
+
value: function apply(engine) {
|
|
64
|
+
var _this = this;
|
|
65
|
+
this.engine = engine;
|
|
66
|
+
// const eventKeyMap: EventKeyMap = {
|
|
67
|
+
// click: 'on_click',
|
|
68
|
+
// change: 'on_change',
|
|
69
|
+
// search: 'on_search',
|
|
70
|
+
// focus: 'on_focus',
|
|
71
|
+
// blur: 'on_blur',
|
|
72
|
+
// input: 'on_input',
|
|
73
|
+
// 'click-finish': 'on_click_finish',
|
|
74
|
+
// 'list-change': 'on_list_change',
|
|
75
|
+
// 'list-delete': 'on_list_delete',
|
|
76
|
+
// 'list-search': 'on_list_search',
|
|
77
|
+
// 'list-mounted': 'on_list_mounted',
|
|
78
|
+
// 'list-actions': 'on_list_actions',
|
|
79
|
+
// 'list-rowclick': 'on_list_rowclick',
|
|
80
|
+
// 'list-before-import': 'on_list_before_import',
|
|
81
|
+
// 'wps-open': 'on_wps_open',
|
|
82
|
+
// 'wps-save': 'on_wps_save',
|
|
83
|
+
// 'wps-rename': 'on_wps_rename',
|
|
84
|
+
// }
|
|
85
|
+
// Object.entries(eventKeyMap).forEach(([eventKey, controlEventKey]) => {
|
|
86
|
+
// if (eventKey && controlEventKey) {
|
|
87
|
+
// this.engineAddEventListener(eventKey as EventKeys, controlEventKey)
|
|
88
|
+
// }
|
|
89
|
+
// })
|
|
90
|
+
EventLogic.events.forEach(function(eventItem) {
|
|
91
|
+
if (eventItem.code && eventItem.key) {
|
|
92
|
+
_this.engineAddEventListener(eventItem.code, eventItem.key);
|
|
204
93
|
}
|
|
205
94
|
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
2
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "engineAddEventListener",
|
|
99
|
+
value: function engineAddEventListener(eventKey, controlEventKey) {
|
|
100
|
+
var _this = this;
|
|
101
|
+
this.engine.on(eventKey, function() {
|
|
102
|
+
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(payload) {
|
|
103
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
104
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
105
|
+
case 0:
|
|
106
|
+
if (!(eventKey === 'change' && !_this.engine.isMounted)) {
|
|
107
|
+
_ctx.next = 2;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
return _ctx.abrupt("return");
|
|
111
|
+
case 2:
|
|
112
|
+
if (!(payload.instance !== undefined)) {
|
|
113
|
+
_ctx.next = 6;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
_ctx.next = 5;
|
|
117
|
+
return _this.callControlEvent(controlEventKey, payload);
|
|
118
|
+
case 5:
|
|
119
|
+
return _ctx.abrupt("return", _ctx.sent);
|
|
120
|
+
case 6:
|
|
121
|
+
case "end":
|
|
122
|
+
return _ctx.stop();
|
|
123
|
+
}
|
|
124
|
+
}, _callee);
|
|
125
|
+
}));
|
|
126
|
+
return function(payload) {
|
|
127
|
+
return _ref.apply(this, arguments);
|
|
128
|
+
};
|
|
129
|
+
}());
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
key: "callControlEvent",
|
|
134
|
+
value: function callControlEvent(name, payload) {
|
|
135
|
+
var _this = this;
|
|
136
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee1() {
|
|
137
|
+
var events, result;
|
|
138
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx1) {
|
|
139
|
+
while(1)switch(_ctx1.prev = _ctx1.next){
|
|
140
|
+
case 0:
|
|
141
|
+
events = _this.config[payload.instance.id];
|
|
142
|
+
if (!(!events || !Array.isArray(events[name]))) {
|
|
143
|
+
_ctx1.next = 3;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
return _ctx1.abrupt("return", []);
|
|
147
|
+
case 3:
|
|
148
|
+
_ctx1.next = 5;
|
|
149
|
+
return Promise.all(events[name].map(function() {
|
|
150
|
+
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(eventName) {
|
|
151
|
+
var execResult;
|
|
152
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
153
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
154
|
+
case 0:
|
|
155
|
+
_ctx.next = 2;
|
|
156
|
+
return _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
|
|
237
157
|
// this.engine,
|
|
238
158
|
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
239
|
-
payload)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
result
|
|
266
|
-
];
|
|
159
|
+
payload);
|
|
160
|
+
case 2:
|
|
161
|
+
execResult = _ctx.sent;
|
|
162
|
+
return _ctx.abrupt("return", execResult);
|
|
163
|
+
case 4:
|
|
164
|
+
case "end":
|
|
165
|
+
return _ctx.stop();
|
|
166
|
+
}
|
|
167
|
+
}, _callee);
|
|
168
|
+
}));
|
|
169
|
+
return function(eventName) {
|
|
170
|
+
return _ref.apply(this, arguments);
|
|
171
|
+
};
|
|
172
|
+
}()));
|
|
173
|
+
case 5:
|
|
174
|
+
result = _ctx1.sent;
|
|
175
|
+
if (!result.includes(false)) {
|
|
176
|
+
_ctx1.next = 10;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
return _ctx1.abrupt("return", false);
|
|
180
|
+
case 10:
|
|
181
|
+
return _ctx1.abrupt("return", result);
|
|
182
|
+
case 11:
|
|
183
|
+
case "end":
|
|
184
|
+
return _ctx1.stop();
|
|
267
185
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
})();
|
|
274
|
-
};
|
|
186
|
+
}, _callee1);
|
|
187
|
+
}))();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
]);
|
|
275
191
|
return ControlsEventPlugin;
|
|
276
192
|
}();
|
|
@@ -11,6 +11,20 @@ function _classCallCheck(instance, Constructor) {
|
|
|
11
11
|
throw new TypeError("Cannot call a class as a function");
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
function _defineProperties(target, props) {
|
|
15
|
+
for(var i = 0; i < props.length; i++){
|
|
16
|
+
var descriptor = props[i];
|
|
17
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
18
|
+
descriptor.configurable = true;
|
|
19
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
20
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
24
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
25
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
26
|
+
return Constructor;
|
|
27
|
+
}
|
|
14
28
|
function _iterableToArrayLimit(arr, i) {
|
|
15
29
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
16
30
|
if (_i == null) return;
|
|
@@ -49,7 +63,7 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
49
63
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
50
64
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
51
65
|
}
|
|
52
|
-
import { error } from
|
|
66
|
+
import { error } from '@byteluck-fe/model-driven-shared';
|
|
53
67
|
export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
54
68
|
"use strict";
|
|
55
69
|
function ES6ModulePlugin(config, env) {
|
|
@@ -57,41 +71,45 @@ export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
|
57
71
|
this.config = config;
|
|
58
72
|
this.env = env;
|
|
59
73
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (!res) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
var actionManager = engine.getAction();
|
|
72
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
73
|
-
try {
|
|
74
|
-
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
75
|
-
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
76
|
-
actionManager.addAction(key, value);
|
|
77
|
-
}
|
|
78
|
-
} catch (err) {
|
|
79
|
-
_didIteratorError = true;
|
|
80
|
-
_iteratorError = err;
|
|
81
|
-
} finally{
|
|
82
|
-
try {
|
|
83
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
84
|
-
_iterator.return();
|
|
74
|
+
_createClass(ES6ModulePlugin, [
|
|
75
|
+
{
|
|
76
|
+
key: "apply",
|
|
77
|
+
value: function apply(engine) {
|
|
78
|
+
this.engine = engine;
|
|
79
|
+
var action = this.config;
|
|
80
|
+
if (!action) {
|
|
81
|
+
return;
|
|
85
82
|
}
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
|
|
83
|
+
var res = parseModule(action, engine, this.env);
|
|
84
|
+
if (!res) {
|
|
85
|
+
return;
|
|
89
86
|
}
|
|
87
|
+
var actionManager = engine.getAction();
|
|
88
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
89
|
+
try {
|
|
90
|
+
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
91
|
+
var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
|
|
92
|
+
actionManager.addAction(key, value);
|
|
93
|
+
}
|
|
94
|
+
} catch (err) {
|
|
95
|
+
_didIteratorError = true;
|
|
96
|
+
_iteratorError = err;
|
|
97
|
+
} finally{
|
|
98
|
+
try {
|
|
99
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
100
|
+
_iterator.return();
|
|
101
|
+
}
|
|
102
|
+
} finally{
|
|
103
|
+
if (_didIteratorError) {
|
|
104
|
+
throw _iteratorError;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//qiyu state会proxy,将过深的变量存储会导致崩溃
|
|
109
|
+
// engine.setState('variables', res.variables)
|
|
90
110
|
}
|
|
91
111
|
}
|
|
92
|
-
|
|
93
|
-
// engine.setState('variables', res.variables)
|
|
94
|
-
};
|
|
112
|
+
]);
|
|
95
113
|
return ES6ModulePlugin;
|
|
96
114
|
}();
|
|
97
115
|
export function parseModule(action, engine, env) {
|
|
@@ -107,11 +125,11 @@ export function parseModule(action, engine, env) {
|
|
|
107
125
|
}
|
|
108
126
|
};
|
|
109
127
|
try {
|
|
110
|
-
new Function(
|
|
128
|
+
new Function('module', 'exports', compiled).call(module, module, module.exports);
|
|
111
129
|
} catch (e) {
|
|
112
|
-
error(e.message +
|
|
113
|
-
if (process.env.NODE_ENV !==
|
|
114
|
-
error(
|
|
130
|
+
error(e.message + '. fail to parse the module');
|
|
131
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
132
|
+
error('fail to parse the module');
|
|
115
133
|
}
|
|
116
134
|
}
|
|
117
135
|
var funcMap = {};
|
|
@@ -119,8 +137,8 @@ export function parseModule(action, engine, env) {
|
|
|
119
137
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
120
138
|
try {
|
|
121
139
|
for(var _iterator = Object.entries(module.exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
122
|
-
var
|
|
123
|
-
if (typeof value ===
|
|
140
|
+
var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
|
|
141
|
+
if (typeof value === 'function') {
|
|
124
142
|
funcMap[key] = value;
|
|
125
143
|
} else {
|
|
126
144
|
variables[key] = value;
|