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

thinkjs

Package Overview
Dependencies
Maintainers
1
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thinkjs - npm Package Compare versions

Comparing version 0.5.5 to 0.5.6

2

lib/Conf/config.js

@@ -20,2 +20,3 @@ /**

default_action: 'index', //默认Action
call_controller: "Home:Index:_404", //controller不存在时调用的controller,可以配置为 "Home:Index:_404",表示调用Home分组下Index Controller的_404Action方法
call_method: "__call", //当找不到方法时调用什么方法,这个方法存在时才有效

@@ -31,3 +32,2 @@ before_action_name: "__before", //调用一个action前调用的方法,会将action名传递进去

auto_send_content_type: true, //是否自动发送Content-Type,默认值为`tpl_content_type`配置值
empty_controller_event: "", //controller不存在时处理的自定义事件,可以在Common/common.js里通过E函数注册自定义事件
log_process_pid: true, //记录进程的id,方便其他脚本处理。

@@ -34,0 +34,0 @@ use_cluster: false, //是否使用cluster,默认不使用,0:为cpu的数量,可以自定义值

@@ -1,5 +0,1 @@

/**
* 应用程序
* @type {Object}
*/
var cluster = require("cluster");

@@ -11,7 +7,10 @@ var fs = require("fs");

/**
* 应用程序
* @type {Object}
*/
var App = module.exports = Class(function(){
"use strict";
//controller和action的校验正则
var nameReg = /^[A-Za-z](\w)*$/;
var nameReg = /^[A-Za-z\_](\w)*$/;
//注释的正则

@@ -34,9 +33,8 @@ var commentReg = /((\/\/.*$)|(\/\*[\s\S]*?\*\/)|(\s))/mg;

/**
* 执行
* 获取controller
* @return {[type]} [description]
*/
exec: function(){
getController: function(){
var group = this.http.group;
var controller = '';
var self = this;
//检测controller名

@@ -47,11 +45,33 @@ if (!nameReg.test(this.http.controller)) {

controller = A(group + "/" + this.http.controller, this.http);
if (controller) {
return controller;
}
}
if (!controller) {
var event = C('empty_controller_event');
if (event && E(event, true).length > 0) {
E(event, this.http.controller, group, this.http);
return true;
var controllerConf = C('call_controller');
if (controllerConf) {
if (isString(controllerConf)) {
controllerConf = controllerConf.split(":");
}
return getPromise(this.http.controller + " controller not found", true);
var action = Dispatcher.getAction(controllerConf.pop());
controller = Dispatcher.getController(controllerConf.pop());
group = Dispatcher.getGroup(controllerConf.pop());
controller = A(group + "/" + controller, this.http);
if (controller && typeof controller[action + C('action_suffix')] === 'function') {
this.http.group = group;
this.http.controller = controller;
this.http.action = action;
return controller;
}
}
},
/**
* 执行
* @return {[type]} [description]
*/
exec: function(){
var controller = this.getController();
if (!controller) {
return getPromise(new Error("Controller `" + this.http.controller + "` not found"), true);
}
var self = this;
var action = this.http.action;

@@ -63,3 +83,3 @@ var act = action;

if (!nameReg.test(action)) {
return getPromise('action name error', true);
return getPromise(new Error('action `' + act + '` is not valid'), true);
}

@@ -101,3 +121,3 @@ var initReturnPromise = getPromise(controller.__initReturn);

}
return getPromise("action: " + action + " not found", true);
return getPromise(new Error("action `" + action + "` not found"), true);
},

@@ -104,0 +124,0 @@ /**

{
"name": "thinkjs",
"description": "thinkphp web framework for nodejs",
"version": "0.5.5",
"version": "0.5.6",
"author": {

@@ -6,0 +6,0 @@ "name": "welefen",

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