@lcap/nasl 0.3.10-beta → 0.3.10-beta.7
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 +15 -2
- package/out/types/page/Element.js +63 -5
- package/out/types/page/Element.js.map +1 -1
- package/out/types/page/View.d.ts +10 -16
- package/out/types/page/View.js +41 -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 +124 -153
- package/src/types/page/Element.ts +133 -71
- package/src/types/page/View.ts +80 -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 = typeof window !== 'undefined' ? 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,18 @@ 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 '';
|
|
508
479
|
}
|
|
509
480
|
|
|
510
481
|
if (node.type === 'Destination') {
|
|
@@ -527,21 +498,33 @@ export default function (source, preScript) {
|
|
|
527
498
|
if (Array.isArray(node.consequent)) {
|
|
528
499
|
node.consequent = {
|
|
529
500
|
type: 'BlockStatement',
|
|
530
|
-
body:
|
|
501
|
+
body: [
|
|
502
|
+
{
|
|
503
|
+
type: 'CallConsoleInfo',
|
|
504
|
+
content: 'IF',
|
|
505
|
+
},
|
|
506
|
+
...node.consequent,
|
|
507
|
+
],
|
|
531
508
|
};
|
|
532
509
|
}
|
|
533
|
-
if (Array.isArray(node.alternate)) {
|
|
510
|
+
if (Array.isArray(node.alternate) && node.alternate.length > 0) {
|
|
534
511
|
node.alternate = {
|
|
535
512
|
type: 'BlockStatement',
|
|
536
|
-
body:
|
|
513
|
+
body: [
|
|
514
|
+
{
|
|
515
|
+
type: 'CallConsoleInfo',
|
|
516
|
+
content: 'ELSE',
|
|
517
|
+
},
|
|
518
|
+
...node.alternate,
|
|
519
|
+
],
|
|
537
520
|
};
|
|
538
521
|
}
|
|
539
|
-
|
|
540
|
-
let resultScript = `if(${generateNode(node.test)}) ${generateNode(node.consequent)}`;
|
|
541
522
|
let alternateScript = '';
|
|
542
523
|
if (node.alternate) {
|
|
543
524
|
alternateScript = generateNode(node.alternate);
|
|
544
525
|
}
|
|
526
|
+
|
|
527
|
+
let resultScript = `if(${generateNode(node.test)}) ${generateNode(node.consequent)}`;
|
|
545
528
|
resultScript = alternateScript ? `${resultScript} else ${alternateScript}` : resultScript;
|
|
546
529
|
return resultScript;
|
|
547
530
|
}
|
|
@@ -550,41 +533,51 @@ export default function (source, preScript) {
|
|
|
550
533
|
if (!node.body) {
|
|
551
534
|
return '';
|
|
552
535
|
}
|
|
553
|
-
const str = `{${newLine()}`;
|
|
554
536
|
const body = (node.body || []).map((body) => `${generateNode(body)}${colon()}${newLine()}`);
|
|
555
|
-
return
|
|
537
|
+
return `{
|
|
538
|
+
${body.join(' ')}
|
|
539
|
+
}`;
|
|
556
540
|
}
|
|
557
541
|
|
|
558
542
|
if (node.type === 'WhileStatement') {
|
|
559
|
-
let bodyScript =
|
|
543
|
+
let bodyScript = '';
|
|
560
544
|
if (Array.isArray(node.body)) {
|
|
561
545
|
node.body.forEach((body) => {
|
|
562
546
|
bodyScript += `${generateNode(body)}${newLine()}`;
|
|
563
547
|
});
|
|
564
548
|
}
|
|
565
|
-
return `${
|
|
549
|
+
return `${newLine()}while(${generateNode(node.test)}) {
|
|
550
|
+
${bodyScript}
|
|
551
|
+
}${newLine()}`;
|
|
566
552
|
}
|
|
567
553
|
|
|
568
554
|
if (node.type === 'SwitchStatement') {
|
|
569
|
-
|
|
570
|
-
return
|
|
555
|
+
Object.assign(node, switchCase2If(node.cases));
|
|
556
|
+
return generateNode(node);
|
|
571
557
|
}
|
|
572
558
|
|
|
573
559
|
if (node.type === 'ForEachStatement') {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
560
|
+
let bodyScript = '';
|
|
561
|
+
if (Array.isArray(node.body)) {
|
|
562
|
+
node.body.forEach((body) => {
|
|
563
|
+
bodyScript += `${generateNode(body)}${newLine()}`;
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
const indexScript = generateNode(node.index);
|
|
567
|
+
const startScript = generateNode(node.start);
|
|
568
|
+
const itemScript = generateNode(node.item);
|
|
569
|
+
const endScript = generateNode(node.end);
|
|
570
|
+
const eachScript = generateNode(node.each);
|
|
583
571
|
|
|
584
572
|
if (node.label === 'async') { // 临时测试 async 的方式
|
|
585
|
-
return
|
|
573
|
+
return `${newLine()}await Promise.all(${eachScript}.slice(${startScript}, ${endScript}).map(async (${itemScript}, ${indexScript}) => {
|
|
574
|
+
${bodyScript}
|
|
575
|
+
})${newLine()}`;
|
|
586
576
|
} else {
|
|
587
|
-
return
|
|
577
|
+
return `${newLine()}for (let ${indexScript}=${startScript}; ${indexScript} < ${endScript}; ${indexScript}++){
|
|
578
|
+
const ${itemScript} = ${eachScript}[${indexScript}];
|
|
579
|
+
${bodyScript}
|
|
580
|
+
}${newLine()}`;
|
|
588
581
|
}
|
|
589
582
|
}
|
|
590
583
|
|
|
@@ -601,16 +594,12 @@ export default function (source, preScript) {
|
|
|
601
594
|
}
|
|
602
595
|
|
|
603
596
|
if (node.type === 'JSBlock') {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
// await jsBlock_${logicItemIndex}();
|
|
610
|
-
// }${newLine()}`;
|
|
597
|
+
return `${newLine()}{
|
|
598
|
+
const jsBlock_${logicItemIndex} = async () => {
|
|
599
|
+
${node.code}
|
|
600
|
+
}
|
|
611
601
|
|
|
612
|
-
|
|
613
|
-
${node.code}
|
|
602
|
+
await jsBlock_${logicItemIndex}();
|
|
614
603
|
}${newLine()}`;
|
|
615
604
|
}
|
|
616
605
|
|
|
@@ -633,60 +622,42 @@ export default function (source, preScript) {
|
|
|
633
622
|
return '';
|
|
634
623
|
};
|
|
635
624
|
|
|
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
625
|
let script = '';
|
|
671
|
-
// vital
|
|
672
|
-
recorder.line += mstr.split('\n').length - 1;
|
|
673
626
|
logic.body.forEach((node, index) => {
|
|
674
627
|
script += `${generateNode(node, index)}${newLine()}`;
|
|
675
628
|
});
|
|
676
629
|
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
return mstr;
|
|
630
|
+
return `methods['${logic.name}'] = async function (${logic.params.map((param) => param.name).join(', ')}) {
|
|
631
|
+
${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') + '' : ''}
|
|
632
|
+
${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') + '' : ''}
|
|
633
|
+
let ${returnObj.name} = this.$genInitFromSchema(${JSON.stringify(returnObj.schema)}, ${JSON.stringify(returnObj.defaultValue)});` + (isGONGHANG ? `console.info(${returnObj.name})` : '') + `
|
|
634
|
+
${script}
|
|
635
|
+
}`;
|
|
684
636
|
});
|
|
685
637
|
|
|
686
|
-
output
|
|
638
|
+
const output = `
|
|
639
|
+
const methods = componentOptions.methods = componentOptions.methods || {};
|
|
640
|
+
const computed = componentOptions.computed = componentOptions.computed || {};
|
|
641
|
+
const oldDataFunc = componentOptions.data;
|
|
642
|
+
const data = function () {
|
|
643
|
+
const oldData = oldDataFunc ? oldDataFunc.call(this) : {};
|
|
644
|
+
return Object.assign(oldData, {
|
|
645
|
+
${paramsData ? paramsData + ',' : ''}
|
|
646
|
+
${variablesData}
|
|
647
|
+
});
|
|
648
|
+
};
|
|
649
|
+
componentOptions.data = data;
|
|
650
|
+
const meta = componentOptions.meta = componentOptions.meta || {};
|
|
651
|
+
Object.assign(meta, {
|
|
652
|
+
title: ${JSON.stringify(definition.title)},
|
|
653
|
+
crumb: ${JSON.stringify(definition.crumb)},
|
|
654
|
+
first: ${JSON.stringify(definition.first)},
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
${lifecycles.join('\n\n')}
|
|
687
658
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
659
|
+
${methods.join('\n\n')}
|
|
660
|
+
`;
|
|
661
|
+
|
|
662
|
+
return output;
|
|
692
663
|
}
|