@lcap/nasl 0.3.10-beta → 0.3.10-beta.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/out/service/logic/logic.d.ts +26 -17
- package/out/service/logic/logic.js +6 -0
- package/out/service/logic/logic.js.map +1 -1
- package/out/types/app/App.d.ts +5 -4
- package/out/types/app/App.js +30 -24
- package/out/types/app/App.js.map +1 -1
- package/out/types/cacheData.js.map +1 -1
- package/out/types/data/dataTypes.js +1 -1
- package/out/types/data/dataTypes.js.map +1 -1
- package/out/types/index.d.ts +2 -4
- package/out/types/index.js +3 -6
- package/out/types/index.js.map +1 -1
- package/out/types/logic/Logic.d.ts +4 -12
- package/out/types/logic/Logic.js +26 -14
- package/out/types/logic/Logic.js.map +1 -1
- package/out/types/logic/LogicItem.d.ts +1 -20
- package/out/types/logic/LogicItem.js +0 -184
- package/out/types/logic/LogicItem.js.map +1 -1
- package/out/types/logic/Param.js +2 -0
- package/out/types/logic/Param.js.map +1 -1
- package/out/types/logic/translator.js +39 -8
- package/out/types/logic/translator.js.map +1 -1
- package/out/types/page/Element.d.ts +10 -2
- package/out/types/page/Element.js +51 -4
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/View.d.ts +10 -16
- package/out/types/page/View.js +40 -15
- package/out/types/page/View.js.map +1 -1
- package/out/types/process/ProcessParam.js +3 -1
- package/out/types/process/ProcessParam.js.map +1 -1
- package/package.json +1 -2
- package/src/service/logic/logic.js +6 -0
- package/src/types/app/App.ts +36 -27
- package/src/types/cacheData.ts +7 -7
- package/src/types/data/dataTypes.ts +1 -1
- package/src/types/index.ts +2 -4
- package/src/types/logic/Logic.ts +35 -30
- package/src/types/logic/LogicItem.ts +5 -207
- package/src/types/logic/Param.ts +20 -17
- package/src/types/logic/translator.js +125 -153
- package/src/types/page/Element.ts +121 -71
- package/src/types/page/View.ts +79 -61
- package/src/types/page/dist/View.js +727 -0
- package/src/types/process/ProcessParam.ts +4 -1
- package/tsconfig.json +1 -1
- package/out/service/debugger/debugger.d.ts +0 -3
- package/out/service/debugger/debugger.js +0 -95
- package/out/service/debugger/debugger.js.map +0 -1
- package/out/test/units/config.spec.d.ts +0 -1
- package/out/test/units/config.spec.js +0 -12
- package/out/test/units/config.spec.js.map +0 -1
- package/out/types/logic/BreakPoint.d.ts +0 -42
- package/out/types/logic/BreakPoint.js +0 -155
- package/out/types/logic/BreakPoint.js.map +0 -1
- package/out/types/logic/Debugger.d.ts +0 -156
- package/out/types/logic/Debugger.js +0 -912
- package/out/types/logic/Debugger.js.map +0 -1
- package/src/service/debugger/debugger.js +0 -90
- package/src/types/logic/BreakPoint.ts +0 -200
- package/src/types/logic/Debugger.ts +0 -1140
- package/src/types/logic/translator.d.ts +0 -16
|
@@ -1,34 +1,44 @@
|
|
|
1
1
|
import { Vertex } from '..';
|
|
2
2
|
|
|
3
|
-
function switchCase2If(
|
|
3
|
+
function switchCase2If(cases) {
|
|
4
4
|
const cas = cases.shift();
|
|
5
5
|
|
|
6
6
|
const result = {
|
|
7
7
|
type: 'IfStatement',
|
|
8
8
|
test: cas.test,
|
|
9
|
-
level: 'logicNode',
|
|
10
|
-
id: cas.id,
|
|
11
9
|
consequent: {
|
|
12
10
|
type: 'BlockStatement',
|
|
13
|
-
body:
|
|
11
|
+
body: [
|
|
12
|
+
{
|
|
13
|
+
type: 'CallConsoleInfo',
|
|
14
|
+
content: 'SWITCHCASE',
|
|
15
|
+
},
|
|
16
|
+
...cas.consequent || [],
|
|
17
|
+
]
|
|
14
18
|
},
|
|
15
19
|
alternate: null,
|
|
16
20
|
};
|
|
17
21
|
|
|
18
22
|
if (cases.length) {
|
|
19
|
-
result.alternate = switchCase2If(
|
|
23
|
+
result.alternate = switchCase2If(cases);
|
|
20
24
|
} else {
|
|
21
25
|
return {
|
|
22
26
|
type: 'BlockStatement',
|
|
23
|
-
body:
|
|
24
|
-
|
|
27
|
+
body: [
|
|
28
|
+
{
|
|
29
|
+
type: 'CallConsoleInfo',
|
|
30
|
+
content: 'SWITCHDEFAULT',
|
|
31
|
+
},
|
|
32
|
+
...cas.consequent || [],
|
|
33
|
+
]
|
|
25
34
|
};
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
return result;
|
|
29
38
|
}
|
|
30
39
|
|
|
31
|
-
export default function (source
|
|
40
|
+
export default function (source) {
|
|
41
|
+
const isGONGHANG = window.appInfo.env === 'gonghang' || global.appInfoEnv === 'gonghang';
|
|
32
42
|
const definition = typeof source === 'string' ? JSON.parse(source) : source;
|
|
33
43
|
|
|
34
44
|
function traverse(node, func, parent, index) {
|
|
@@ -124,35 +134,6 @@ export default function (source, preScript) {
|
|
|
124
134
|
}
|
|
125
135
|
}`);
|
|
126
136
|
|
|
127
|
-
let output = `
|
|
128
|
-
const methods = componentOptions.methods = componentOptions.methods || {};
|
|
129
|
-
const computed = componentOptions.computed = componentOptions.computed || {};
|
|
130
|
-
const oldDataFunc = componentOptions.data;
|
|
131
|
-
const data = function () {
|
|
132
|
-
const oldData = oldDataFunc ? oldDataFunc.call(this) : {};
|
|
133
|
-
return Object.assign(oldData, {
|
|
134
|
-
${paramsData ? paramsData + ',' : ''}
|
|
135
|
-
${variablesData}
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
componentOptions.data = data;
|
|
139
|
-
const meta = componentOptions.meta = componentOptions.meta || {};
|
|
140
|
-
Object.assign(meta, {
|
|
141
|
-
title: ${JSON.stringify(definition.title)},
|
|
142
|
-
crumb: ${JSON.stringify(definition.crumb)},
|
|
143
|
-
first: ${JSON.stringify(definition.first)},
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
${lifecycles.join('\n\n')}
|
|
147
|
-
|
|
148
|
-
`;
|
|
149
|
-
|
|
150
|
-
let startLineNumber = output.split('\n').length;
|
|
151
|
-
if (preScript && typeof preScript === 'string') {
|
|
152
|
-
startLineNumber += (preScript.split('\n').length - 2);
|
|
153
|
-
}
|
|
154
|
-
// console.log(preScript.split('\n').length, output.split('\n').length, startLineNumber);
|
|
155
|
-
const sourceMap = {};
|
|
156
137
|
const methods = (definition.logics || []).map((logic) => {
|
|
157
138
|
let returnObj = {
|
|
158
139
|
type: 'Identifier',
|
|
@@ -162,18 +143,10 @@ export default function (source, preScript) {
|
|
|
162
143
|
if (logic.returns[0])
|
|
163
144
|
returnObj = logic.returns[0];
|
|
164
145
|
|
|
165
|
-
|
|
166
|
-
const recorder = {
|
|
167
|
-
line: startLineNumber,
|
|
168
|
-
};
|
|
169
|
-
const _newLine = () => '\n';
|
|
170
|
-
const newLine = () => {
|
|
171
|
-
recorder.line += 1;
|
|
172
|
-
return _newLine();
|
|
173
|
-
};
|
|
146
|
+
const newLine = () => '\n';
|
|
174
147
|
const colon = () => ';';
|
|
175
148
|
|
|
176
|
-
const
|
|
149
|
+
const generateNode = (node, logicItemIndex) => {
|
|
177
150
|
if (!node)
|
|
178
151
|
return '';
|
|
179
152
|
if (node.type === 'End') {
|
|
@@ -218,7 +191,7 @@ export default function (source, preScript) {
|
|
|
218
191
|
return `${object}[${property.value}]`;
|
|
219
192
|
}
|
|
220
193
|
if (node.type === 'AssignmentExpression') {
|
|
221
|
-
return `${generateNode(node.left)} = ${generateNode(node.right)}${colon()}${newLine()}`;
|
|
194
|
+
return `${newLine()}${generateNode(node.left)} = ${generateNode(node.right)}${colon()}${newLine()}`;
|
|
222
195
|
}
|
|
223
196
|
if (node.type === 'CallExpression') {
|
|
224
197
|
const args = [];
|
|
@@ -267,29 +240,23 @@ export default function (source, preScript) {
|
|
|
267
240
|
const interfaceKeyTarget = Vertex.getVertexByRef(key);
|
|
268
241
|
const arr = key.split('/');
|
|
269
242
|
const download = interfaceKeyTarget && interfaceKeyTarget.name && interfaceKeyTarget.name.includes('export');
|
|
270
|
-
return `await
|
|
243
|
+
return `await this.$services['_custom']['ID_${arr[arr.length - 1]}']({
|
|
271
244
|
config: {
|
|
272
245
|
download: ${download},
|
|
273
246
|
},
|
|
274
247
|
path: {
|
|
275
|
-
${getParams('path').join('
|
|
248
|
+
${getParams('path').join(',\n')}
|
|
276
249
|
},
|
|
277
250
|
query: {
|
|
278
|
-
${getParams('query').join('
|
|
251
|
+
${getParams('query').join(',\n')}
|
|
279
252
|
},
|
|
280
253
|
headers: {
|
|
281
|
-
${getParams('header').join('
|
|
254
|
+
${getParams('header').join(',\n')}
|
|
282
255
|
},
|
|
283
256
|
body: ${getParams('body') || '{}'},
|
|
284
|
-
})
|
|
285
|
-
console.debug('logic-trace-end');
|
|
286
|
-
return result;
|
|
287
|
-
})();
|
|
288
|
-
`;
|
|
257
|
+
})`;
|
|
289
258
|
} else {
|
|
290
|
-
return `await
|
|
291
|
-
console.debug('logic-trace-end');return result; })()
|
|
292
|
-
`;
|
|
259
|
+
return `await this.${node.calleeCode}(${node.params.map((param) => generateNode(param.callInterParamValue) || 'undefined').join(',')})`;
|
|
293
260
|
}
|
|
294
261
|
}
|
|
295
262
|
|
|
@@ -328,24 +295,21 @@ export default function (source, preScript) {
|
|
|
328
295
|
const interfaceKeyTarget = Vertex.getVertexByRef(node.interfaceKey);
|
|
329
296
|
const download = interfaceKeyTarget && interfaceKeyTarget.name && interfaceKeyTarget.name.includes('export');
|
|
330
297
|
|
|
331
|
-
return `await
|
|
298
|
+
return `await this.$services['_custom']['ID_${arr[arr.length - 1]}']({
|
|
332
299
|
config: {
|
|
333
300
|
download: ${download},
|
|
334
301
|
},
|
|
335
302
|
path: {
|
|
336
|
-
${getParams('path').join('
|
|
303
|
+
${getParams('path').join(',\n')}
|
|
337
304
|
},
|
|
338
305
|
query: {
|
|
339
|
-
${getParams('query').join('
|
|
306
|
+
${getParams('query').join(',\n')}
|
|
340
307
|
},
|
|
341
308
|
headers: {
|
|
342
|
-
${getParams('header').join('
|
|
309
|
+
${getParams('header').join(',\n')}
|
|
343
310
|
},
|
|
344
311
|
body: ${getParams('body') || '{}'},
|
|
345
|
-
})
|
|
346
|
-
console.debug('logic-trace-end');
|
|
347
|
-
return result; })()
|
|
348
|
-
`;
|
|
312
|
+
})`;
|
|
349
313
|
}
|
|
350
314
|
|
|
351
315
|
if (node.type === 'CallGraphQL') {
|
|
@@ -400,13 +364,13 @@ export default function (source, preScript) {
|
|
|
400
364
|
download: ${key.includes('export')},
|
|
401
365
|
},
|
|
402
366
|
path: {
|
|
403
|
-
${getParams('path').join('
|
|
367
|
+
${getParams('path').join(',\n')}
|
|
404
368
|
},
|
|
405
369
|
query: {
|
|
406
|
-
${getParams('query').join('
|
|
370
|
+
${getParams('query').join(',\n')}
|
|
407
371
|
},
|
|
408
372
|
headers: {
|
|
409
|
-
${getParams('header').join('
|
|
373
|
+
${getParams('header').join(',\n')}
|
|
410
374
|
},
|
|
411
375
|
body: ${getParams('body') || '{}'},
|
|
412
376
|
})).Data`;
|
|
@@ -417,7 +381,7 @@ export default function (source, preScript) {
|
|
|
417
381
|
.filter((param) => param.in === undefined) // 放在body内部的参数
|
|
418
382
|
.filter((param) => generateNode(param.value) !== '')
|
|
419
383
|
.map((param) => `${safeKey(param.name)}: ${generateNode(param.value)}`)
|
|
420
|
-
.join('
|
|
384
|
+
.join(',\n');
|
|
421
385
|
const getObj = (type) =>
|
|
422
386
|
(node.params || [])
|
|
423
387
|
.filter((param) => param.in === type)
|
|
@@ -500,11 +464,19 @@ export default function (source, preScript) {
|
|
|
500
464
|
}
|
|
501
465
|
|
|
502
466
|
if (node.type === 'CallMessageShow') {
|
|
503
|
-
return
|
|
467
|
+
return `${newLine()}this.$toast.show(${generateNode(node.arguments[0])})${colon()}${newLine()}`;
|
|
504
468
|
}
|
|
505
469
|
|
|
506
470
|
if (node.type === 'CallConsoleLog') {
|
|
507
|
-
return
|
|
471
|
+
return `${newLine()}console.log(${generateNode(node.arguments[0])})${colon()}${newLine()}`;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
if(node.type === 'CallConsoleInfo') {
|
|
475
|
+
if(isGONGHANG) {
|
|
476
|
+
return `console.info(${node.content})${colon()}`;
|
|
477
|
+
}
|
|
478
|
+
return '';
|
|
479
|
+
|
|
508
480
|
}
|
|
509
481
|
|
|
510
482
|
if (node.type === 'Destination') {
|
|
@@ -527,21 +499,33 @@ export default function (source, preScript) {
|
|
|
527
499
|
if (Array.isArray(node.consequent)) {
|
|
528
500
|
node.consequent = {
|
|
529
501
|
type: 'BlockStatement',
|
|
530
|
-
body:
|
|
502
|
+
body: [
|
|
503
|
+
{
|
|
504
|
+
type: 'CallConsoleInfo',
|
|
505
|
+
content: 'IF',
|
|
506
|
+
},
|
|
507
|
+
...node.consequent,
|
|
508
|
+
]
|
|
531
509
|
};
|
|
532
510
|
}
|
|
533
|
-
if (Array.isArray(node.alternate)) {
|
|
511
|
+
if (Array.isArray(node.alternate) && node.alternate.length > 0) {
|
|
534
512
|
node.alternate = {
|
|
535
513
|
type: 'BlockStatement',
|
|
536
|
-
body:
|
|
514
|
+
body: [
|
|
515
|
+
{
|
|
516
|
+
type: 'CallConsoleInfo',
|
|
517
|
+
content: 'ELSE',
|
|
518
|
+
},
|
|
519
|
+
...node.alternate,
|
|
520
|
+
]
|
|
537
521
|
};
|
|
538
522
|
}
|
|
539
|
-
|
|
540
|
-
let resultScript = `if(${generateNode(node.test)}) ${generateNode(node.consequent)}`;
|
|
541
523
|
let alternateScript = '';
|
|
542
524
|
if (node.alternate) {
|
|
543
525
|
alternateScript = generateNode(node.alternate);
|
|
544
526
|
}
|
|
527
|
+
|
|
528
|
+
let resultScript = `if(${generateNode(node.test)}) ${generateNode(node.consequent)}`;
|
|
545
529
|
resultScript = alternateScript ? `${resultScript} else ${alternateScript}` : resultScript;
|
|
546
530
|
return resultScript;
|
|
547
531
|
}
|
|
@@ -550,41 +534,51 @@ export default function (source, preScript) {
|
|
|
550
534
|
if (!node.body) {
|
|
551
535
|
return '';
|
|
552
536
|
}
|
|
553
|
-
const str = `{${newLine()}`;
|
|
554
537
|
const body = (node.body || []).map((body) => `${generateNode(body)}${colon()}${newLine()}`);
|
|
555
|
-
return
|
|
538
|
+
return `{
|
|
539
|
+
${body.join(' ')}
|
|
540
|
+
}`;
|
|
556
541
|
}
|
|
557
542
|
|
|
558
543
|
if (node.type === 'WhileStatement') {
|
|
559
|
-
let bodyScript =
|
|
544
|
+
let bodyScript = '';
|
|
560
545
|
if (Array.isArray(node.body)) {
|
|
561
546
|
node.body.forEach((body) => {
|
|
562
547
|
bodyScript += `${generateNode(body)}${newLine()}`;
|
|
563
548
|
});
|
|
564
549
|
}
|
|
565
|
-
return `${
|
|
550
|
+
return `${newLine()}while(${generateNode(node.test)}) {
|
|
551
|
+
${bodyScript}
|
|
552
|
+
}${newLine()}`;
|
|
566
553
|
}
|
|
567
554
|
|
|
568
555
|
if (node.type === 'SwitchStatement') {
|
|
569
|
-
|
|
570
|
-
return
|
|
556
|
+
Object.assign(node, switchCase2If(node.cases));
|
|
557
|
+
return generateNode(node);
|
|
571
558
|
}
|
|
572
559
|
|
|
573
560
|
if (node.type === 'ForEachStatement') {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
561
|
+
let bodyScript = '';
|
|
562
|
+
if (Array.isArray(node.body)) {
|
|
563
|
+
node.body.forEach((body) => {
|
|
564
|
+
bodyScript += `${generateNode(body)}${newLine()}`;
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
const indexScript = generateNode(node.index);
|
|
568
|
+
const startScript = generateNode(node.start);
|
|
569
|
+
const itemScript = generateNode(node.item);
|
|
570
|
+
const endScript = generateNode(node.end);
|
|
571
|
+
const eachScript = generateNode(node.each);
|
|
583
572
|
|
|
584
573
|
if (node.label === 'async') { // 临时测试 async 的方式
|
|
585
|
-
return
|
|
574
|
+
return `${newLine()}await Promise.all(${eachScript}.slice(${startScript}, ${endScript}).map(async (${itemScript}, ${indexScript}) => {
|
|
575
|
+
${bodyScript}
|
|
576
|
+
})${newLine()}`;
|
|
586
577
|
} else {
|
|
587
|
-
return
|
|
578
|
+
return `${newLine()}for (let ${indexScript}=${startScript}; ${indexScript} < ${endScript}; ${indexScript}++){
|
|
579
|
+
const ${itemScript} = ${eachScript}[${indexScript}];
|
|
580
|
+
${bodyScript}
|
|
581
|
+
}${newLine()}`;
|
|
588
582
|
}
|
|
589
583
|
}
|
|
590
584
|
|
|
@@ -601,16 +595,12 @@ export default function (source, preScript) {
|
|
|
601
595
|
}
|
|
602
596
|
|
|
603
597
|
if (node.type === 'JSBlock') {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
// await jsBlock_${logicItemIndex}();
|
|
610
|
-
// }${newLine()}`;
|
|
598
|
+
return `${newLine()}{
|
|
599
|
+
const jsBlock_${logicItemIndex} = async () => {
|
|
600
|
+
${node.code}
|
|
601
|
+
}
|
|
611
602
|
|
|
612
|
-
|
|
613
|
-
${node.code}
|
|
603
|
+
await jsBlock_${logicItemIndex}();
|
|
614
604
|
}${newLine()}`;
|
|
615
605
|
}
|
|
616
606
|
|
|
@@ -633,60 +623,42 @@ export default function (source, preScript) {
|
|
|
633
623
|
return '';
|
|
634
624
|
};
|
|
635
625
|
|
|
636
|
-
// source map for debugger!!!
|
|
637
|
-
const generateNode = (node, logicItemIndex) => {
|
|
638
|
-
const startLine = recorder.line;
|
|
639
|
-
|
|
640
|
-
const str = _generateNode(node, logicItemIndex);
|
|
641
|
-
const length = String(str).split('\n').length - 1;
|
|
642
|
-
recorder.line = startLine + length;
|
|
643
|
-
// console.log(node.type, startLine);
|
|
644
|
-
// if (node.type === 'JSBlock') {
|
|
645
|
-
// startLine = recorder.line - 2;
|
|
646
|
-
// }
|
|
647
|
-
sourceMap[node.id] = {
|
|
648
|
-
node,
|
|
649
|
-
// jsBlockFrom: recorder.line - 2,
|
|
650
|
-
from: startLine,
|
|
651
|
-
to: recorder.line,
|
|
652
|
-
};
|
|
653
|
-
return str;
|
|
654
|
-
};
|
|
655
|
-
|
|
656
|
-
// console.info("JSON generate:", JSON.stringify(logic.body));
|
|
657
|
-
// console.log(generate({ type: 'Program', body: logic.body }).code);
|
|
658
|
-
sourceMap[logic.id] = {
|
|
659
|
-
node: logic,
|
|
660
|
-
isLogic: true,
|
|
661
|
-
from: startLineNumber,
|
|
662
|
-
};
|
|
663
|
-
// console.log(logic.name, startLineNumber);
|
|
664
|
-
let mstr = `methods['${logic.name}'] = async function (${logic.params.map((param) => param.name).join(', ')}) {
|
|
665
|
-
${logic.params.length ? logic.params.map((param) => `${param.name} = ${param.name} !== undefined ? ${param.name} : this.$genInitFromSchema(${JSON.stringify(param.schema)}, ${JSON.stringify(param.defaultValue)});`).join('\n') + '' : ''}
|
|
666
|
-
${logic.variables.length ? logic.variables.map((variable) => `let ${variable.name} = this.$genInitFromSchema(${JSON.stringify(variable.schema)}, ${JSON.stringify(variable.defaultValue)});`).join('\n') + '' : ''}
|
|
667
|
-
let ${returnObj.name} = this.$genInitFromSchema(${JSON.stringify(returnObj.schema)}, ${JSON.stringify(returnObj.defaultValue)});
|
|
668
|
-
`;
|
|
669
|
-
|
|
670
626
|
let script = '';
|
|
671
|
-
// vital
|
|
672
|
-
recorder.line += mstr.split('\n').length - 1;
|
|
673
627
|
logic.body.forEach((node, index) => {
|
|
674
628
|
script += `${generateNode(node, index)}${newLine()}`;
|
|
675
629
|
});
|
|
676
630
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
return mstr;
|
|
631
|
+
return `methods['${logic.name}'] = async function (${logic.params.map((param) => param.name).join(', ')}) {
|
|
632
|
+
${logic.params.length ? logic.params.map((param) => `${param.name} = ${param.name} !== undefined ? ${param.name} : this.$genInitFromSchema(${JSON.stringify(param.schema)}, ${JSON.stringify(param.defaultValue)});` + (isGONGHANG ? `console.info(${param.name})` : '')).join('\n') + '' : ''}
|
|
633
|
+
${logic.variables.length ? logic.variables.map((variable) => `let ${variable.name} = this.$genInitFromSchema(${JSON.stringify(variable.schema)}, ${JSON.stringify(variable.defaultValue)});` + (isGONGHANG ? `console.info(${variable.name})` : '')).join('\n') + '' : ''}
|
|
634
|
+
let ${returnObj.name} = this.$genInitFromSchema(${JSON.stringify(returnObj.schema)}, ${JSON.stringify(returnObj.defaultValue)});` + (isGONGHANG ? `console.info(${returnObj.name})` : '') + `
|
|
635
|
+
${script}
|
|
636
|
+
}`;
|
|
684
637
|
});
|
|
685
638
|
|
|
686
|
-
output
|
|
639
|
+
const output = `
|
|
640
|
+
const methods = componentOptions.methods = componentOptions.methods || {};
|
|
641
|
+
const computed = componentOptions.computed = componentOptions.computed || {};
|
|
642
|
+
const oldDataFunc = componentOptions.data;
|
|
643
|
+
const data = function () {
|
|
644
|
+
const oldData = oldDataFunc ? oldDataFunc.call(this) : {};
|
|
645
|
+
return Object.assign(oldData, {
|
|
646
|
+
${paramsData ? paramsData + ',' : ''}
|
|
647
|
+
${variablesData}
|
|
648
|
+
});
|
|
649
|
+
};
|
|
650
|
+
componentOptions.data = data;
|
|
651
|
+
const meta = componentOptions.meta = componentOptions.meta || {};
|
|
652
|
+
Object.assign(meta, {
|
|
653
|
+
title: ${JSON.stringify(definition.title)},
|
|
654
|
+
crumb: ${JSON.stringify(definition.crumb)},
|
|
655
|
+
first: ${JSON.stringify(definition.first)},
|
|
656
|
+
});
|
|
687
657
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
658
|
+
${lifecycles.join('\n\n')}
|
|
659
|
+
|
|
660
|
+
${methods.join('\n\n')}
|
|
661
|
+
`;
|
|
662
|
+
|
|
663
|
+
return output;
|
|
692
664
|
}
|