Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

egg-controller

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-controller - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

45

app.js

@@ -6,23 +6,32 @@ "use strict";

const register_1 = require("./lib/register");
function autoLoadDir(dirPath) {
if (!fs.existsSync(dirPath))
return;
fs.readdirSync(dirPath)
.forEach(dirName => {
const fullPath = path.join(dirPath, dirName);
const stat = fs.statSync(fullPath);
if (stat.isDirectory()) {
this.autoLoadDir(fullPath);
}
else if (stat.isFile()) {
const ext = path.parse(dirName).ext;
if (ext === '.js' || (ext === '.ts' && dirName.indexOf('.d.ts') < 0)) {
require(fullPath);
}
}
});
}
exports.default = (app) => {
const config = app.config.controller;
if (config.autoLoad) {
function autoLoadDir(dirPath) {
if (!fs.existsSync(dirPath))
return;
fs.readdirSync(dirPath)
.forEach(dirName => {
const fullPath = path.join(dirPath, dirName);
const stat = fs.statSync(fullPath);
if (stat.isDirectory()) {
this.autoLoadDir(fullPath);
}
else if (stat.isFile()) {
const parsedPath = path.parse(dirName);
if (parsedPath.ext === '.ts' && dirName.indexOf('.d.ts') < 0) {
const jsPath = path.join(dirPath, parsedPath.name, '.js');
if (fs.existsSync(jsPath)) {
app.loader.loadFile(jsPath);
}
else {
app.loader.loadFile(fullPath);
}
}
if (parsedPath.ext === '.js') {
app.loader.loadFile(fullPath);
}
}
});
}
[].concat(config.dir).forEach(dir => {

@@ -29,0 +38,0 @@ autoLoadDir(dir);

2

package.json
{
"name": "egg-controller",
"version": "0.1.3",
"version": "0.1.4",
"description": "controller for egg.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc