fix(all): Fixes #399 tabs missing from JS output.
This commit is contained in:
parent
2dc6e327e8
commit
c23f025d6a
2 changed files with 157 additions and 151 deletions
|
@ -121,6 +121,7 @@
|
||||||
"ibm-watson": "7.1.2",
|
"ibm-watson": "7.1.2",
|
||||||
"join-images-updated": "1.1.4",
|
"join-images-updated": "1.1.4",
|
||||||
"js-md5": "0.8.3",
|
"js-md5": "0.8.3",
|
||||||
|
"just-indent": "0.0.1",
|
||||||
"keyv": "4.5.2",
|
"keyv": "4.5.2",
|
||||||
"koa": "2.13.4",
|
"koa": "2.13.4",
|
||||||
"koa-body": "6.0.1",
|
"koa-body": "6.0.1",
|
||||||
|
|
|
@ -32,8 +32,9 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { GBMinInstance, GBService, IGBCoreService, GBDialogStep, GBLog, GBError } from 'botlib';
|
import { GBMinInstance, GBService, IGBCoreService, GBLog } from 'botlib';
|
||||||
import * as Fs from 'fs';
|
import * as Fs from 'fs';
|
||||||
|
import * as ji from 'just-indent'
|
||||||
import { GBServer } from '../../../src/app.js';
|
import { GBServer } from '../../../src/app.js';
|
||||||
import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
|
import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
|
||||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||||
|
@ -52,10 +53,9 @@ import { KeywordsExpressions } from './KeywordsExpressions.js';
|
||||||
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
|
import { GBLogEx } from '../../core.gbapp/services/GBLogEx.js';
|
||||||
import { GuaribasUser } from '../../security.gbapp/models/index.js';
|
import { GuaribasUser } from '../../security.gbapp/models/index.js';
|
||||||
import { SystemKeywords } from './SystemKeywords.js';
|
import { SystemKeywords } from './SystemKeywords.js';
|
||||||
import lineReplace from 'line-replace';
|
import { Sequelize, QueryTypes } from '@sequelize/core';
|
||||||
import { Sequelize, DataTypes, QueryTypes } from '@sequelize/core';
|
|
||||||
import { table } from 'console';
|
|
||||||
import { SequelizeOptions } from 'sequelize-typescript';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @fileoverview Decision was to priorize security(isolation) and debugging,
|
* @fileoverview Decision was to priorize security(isolation) and debugging,
|
||||||
|
@ -632,10 +632,8 @@ export class GBVMService extends GBService {
|
||||||
};
|
};
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
await ensureTokens(true);
|
await ensureTokens(true);
|
||||||
|
${ code }
|
||||||
${code} // ISSUE: #339, tabify this.
|
|
||||||
}
|
}
|
||||||
catch(e){
|
catch(e){
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
@ -646,11 +644,12 @@ export class GBVMService extends GBService {
|
||||||
|
|
||||||
await wa.closeHandles({pid: pid});
|
await wa.closeHandles({pid: pid});
|
||||||
await sys.closeHandles({pid: pid});
|
await sys.closeHandles({pid: pid});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
code = ji.default(code, ' ');
|
||||||
|
|
||||||
Fs.writeFileSync(jsfile, code);
|
Fs.writeFileSync(jsfile, code);
|
||||||
GBLogEx.info(min, `[GBVMService] Finished loading of ${filename}, JavaScript from Word: \n ${code}`);
|
GBLogEx.info(min, `[GBVMService] Finished loading of ${filename}, JavaScript from Word: \n ${code}`);
|
||||||
|
|
||||||
|
@ -800,6 +799,8 @@ export class GBVMService extends GBService {
|
||||||
let fields = {};
|
let fields = {};
|
||||||
let tables = [];
|
let tables = [];
|
||||||
|
|
||||||
|
const outputLines = [];
|
||||||
|
let emmitIndex = 1;
|
||||||
for (let i = 1; i <= lines.length; i++) {
|
for (let i = 1; i <= lines.length; i++) {
|
||||||
|
|
||||||
let line = lines[i - 1];
|
let line = lines[i - 1];
|
||||||
|
@ -866,8 +867,12 @@ export class GBVMService extends GBService {
|
||||||
|
|
||||||
let add = emmit ? line.split(/\r\n|\r|\n/).length : 0;
|
let add = emmit ? line.split(/\r\n|\r|\n/).length : 0;
|
||||||
current = current + (add ? add : 0);
|
current = current + (add ? add : 0);
|
||||||
map[i] = current;
|
|
||||||
lines[i - 1] = emmit ? line : '';
|
if (emmit){
|
||||||
|
emmitIndex ++;
|
||||||
|
map[emmitIndex] = current;
|
||||||
|
outputLines[emmitIndex - 1] = line;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tables) {
|
if (tables) {
|
||||||
|
@ -877,7 +882,7 @@ export class GBVMService extends GBService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
code = `${lines.join('\n')}\n`;
|
code = `${outputLines.join('\n')}\n`;
|
||||||
|
|
||||||
let metadata = GBVMService.getMetadata(mainName, properties, description);
|
let metadata = GBVMService.getMetadata(mainName, properties, description);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue