ganjiang-middleware
Advanced tools
Comparing version 3.7.17 to 3.7.18
@@ -29,2 +29,3 @@ 'use strict'; | ||
const crypto = require('crypto'); | ||
const url = require('url'); | ||
const chai = require('chai'); | ||
@@ -60,3 +61,4 @@ const memoryUsage = process.memoryUsage; | ||
zlib, | ||
crypto | ||
crypto, | ||
url | ||
}, | ||
@@ -63,0 +65,0 @@ ioredis |
@@ -46,2 +46,3 @@ 'use strict'; | ||
instrument(code) { | ||
console.log('xxxx===', code) | ||
const ast = babelParser.parse(code, { | ||
@@ -51,2 +52,3 @@ sourceType: 'script', | ||
}); | ||
console.log('ast===', ast) | ||
let loopIndex = 0; | ||
@@ -53,0 +55,0 @@ const asyncFuncExpression = ast.program.body[0].expression; |
@@ -49,2 +49,3 @@ 'use strict'; | ||
let loopGuardIns = null; | ||
let globalLog = console; | ||
@@ -75,3 +76,9 @@ const getGlobalApiListCfg = () => globalApiListCfg; | ||
if (_.isFunction(str)) str = str.toString(); | ||
if (loopGuardIns) str = loopGuardIns.instrument(str); | ||
if (loopGuardIns) { | ||
try { | ||
str = loopGuardIns.instrument(str); | ||
} catch (err) { | ||
globalLog.error(`could not add loop guard for code = \`${str}\`, the error is: `, err); | ||
} | ||
} | ||
return new VMScript(` | ||
@@ -591,2 +598,3 @@ module.exports = async function (${paramNames.join(", ")}${paramNames.length === 0 ? '' : ', '}${globalParamNames.join(", ")}) { | ||
loopGuardIns = new LoopGuard(_options.LOOP_CONFIG); | ||
globalLog = _options.log || console; | ||
globalApiListCfg = await generateAppConfig(config, _options); | ||
@@ -593,0 +601,0 @@ if (router) { |
{ | ||
"name": "ganjiang-middleware", | ||
"version": "3.7.17", | ||
"version": "3.7.18", | ||
"description": "geoengine ds support sql to api autogenerately", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
91661
2182