snec-mvc-framework
Advanced tools
Comparing version 1.3.2-alpha.3 to 1.3.2-alpha.4
@@ -108,3 +108,3 @@ "use strict"; | ||
initMiddlewares() { | ||
const { middlewares: businessMiddlewares, routes } = this.options; | ||
const { middlewares: [], routes } = this.options; | ||
// 使用this.use注册中间件 | ||
@@ -115,3 +115,3 @@ this.use(middlewares.init()); | ||
// 初始化业务中间件 | ||
businessMiddlewares.forEach((m) => { | ||
middlewares.forEach((m) => { | ||
if (typeof m === 'function') { | ||
@@ -118,0 +118,0 @@ this.use(m); |
@@ -59,3 +59,4 @@ "use strict"; | ||
try { | ||
const configContent = require(path.join(this.configDir, filepath)); | ||
const data = fs.readFileSync(path.join(this.configDir, filepath)); | ||
const configContent = json5_1.default.parse(data.toString()); | ||
this.configMap[basename] = configContent; | ||
@@ -62,0 +63,0 @@ } |
@@ -28,2 +28,6 @@ "use strict"; | ||
loadFiles(target) { | ||
const fileExist = fs.existsSync(target); | ||
if (!fileExist) { | ||
return []; | ||
} | ||
const files = fs.readdirSync(target); | ||
@@ -30,0 +34,0 @@ return files; |
@@ -65,4 +65,8 @@ "use strict"; | ||
function loadFiles(target) { | ||
const fileExist = fs.existsSync(target); | ||
if (!fileExist) { | ||
return []; | ||
} | ||
const files = fs.readdirSync(target); | ||
return files; | ||
} |
{ | ||
"name": "snec-mvc-framework", | ||
"version": "1.3.2-alpha.3", | ||
"version": "1.3.2-alpha.4", | ||
"description": "mvc framework based on koa", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -124,3 +124,3 @@ import Koa = require('koa'); | ||
initMiddlewares() { | ||
const { middlewares: businessMiddlewares, routes } = this.options; | ||
const { middlewares: [], routes } = this.options; | ||
// 使用this.use注册中间件 | ||
@@ -132,3 +132,3 @@ this.use(middlewares.init()); | ||
// 初始化业务中间件 | ||
businessMiddlewares.forEach((m :any) => { | ||
middlewares.forEach((m :any) => { | ||
if (typeof m === 'function') { | ||
@@ -135,0 +135,0 @@ this.use(m); |
@@ -47,3 +47,4 @@ import path = require('path'); | ||
try { | ||
const configContent: object = require(path.join(this.configDir, filepath)); | ||
const data = fs.readFileSync(path.join(this.configDir, filepath)); | ||
const configContent: object = JSON.parse(data.toString()); | ||
this.configMap[basename] = configContent; | ||
@@ -50,0 +51,0 @@ } catch (e) { |
@@ -30,2 +30,4 @@ import fs = require('fs'); | ||
loadFiles(target: string) { | ||
const fileExist = fs.existsSync(target); | ||
if(!fileExist){return []} | ||
const files = fs.readdirSync(target); | ||
@@ -32,0 +34,0 @@ return files |
@@ -74,2 +74,4 @@ import path = require('path'); | ||
function loadFiles(target: string) { | ||
const fileExist = fs.existsSync(target); | ||
if(!fileExist){return []} | ||
const files = fs.readdirSync(target); | ||
@@ -76,0 +78,0 @@ return files |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
319360
9626
14