|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 |
| -function _defineProperty(obj, key, value) { |
4 |
| - if (key in obj) { |
5 |
| - Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); |
6 |
| - } else { |
7 |
| - obj[key] = value; |
8 |
| - } |
9 |
| - return obj; |
10 |
| -} |
| 3 | +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
11 | 4 |
|
12 | 5 | var connect = require('connect'),
|
13 | 6 | fs = require('fs'),
|
@@ -135,19 +128,21 @@ exports.run = function (options) {
|
135 | 128 |
|
136 | 129 | app.use(function (req, res, next) {
|
137 | 130 | try {
|
138 |
| - var projectInfo = getProjectInfo(req); |
139 |
| - var project = Manager.getProject(projectInfo.projectCwd, { cache: false }); |
140 |
| - var customMiddlewares = project.config.getMiddlewares(); |
141 |
| - var _next = () => { |
142 |
| - if (customMiddlewares.length === 0) { |
143 |
| - next(); |
144 |
| - } else { |
145 |
| - const nextMw = customMiddlewares.shift(); |
146 |
| - nextMw(req, res, _next); |
147 |
| - } |
148 |
| - }; |
149 |
| - |
150 |
| - _next(); |
| 131 | + (function () { |
| 132 | + var projectInfo = getProjectInfo(req); |
| 133 | + var project = Manager.getProject(projectInfo.projectCwd, { cache: false }); |
| 134 | + var customMiddlewares = project.config.getMiddlewares(); |
| 135 | + var _next = function _next() { |
| 136 | + if (customMiddlewares.length === 0) { |
| 137 | + next(); |
| 138 | + } else { |
| 139 | + var nextMw = customMiddlewares.shift(); |
| 140 | + nextMw(req, res, _next); |
| 141 | + } |
| 142 | + }; |
| 143 | + |
| 144 | + _next(); |
| 145 | + })(); |
151 | 146 | } catch (e) {
|
152 | 147 | next();
|
153 | 148 | }
|
|
0 commit comments