makepack 1.7.12 → 1.7.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/actions/start/index.js +40 -1
package/package.json
CHANGED
|
@@ -30,6 +30,21 @@ let uxpfile = expExists ? (fs.existsSync(uxpfileJS) ? uxpfileJS : uxpfileTS) : n
|
|
|
30
30
|
|
|
31
31
|
const connections = new Set();
|
|
32
32
|
|
|
33
|
+
function safeHandler(fn) {
|
|
34
|
+
return (req, res, next) => {
|
|
35
|
+
try {
|
|
36
|
+
const result = fn(req, res, next);
|
|
37
|
+
if (result && typeof result.catch === 'function') {
|
|
38
|
+
result.catch(next);
|
|
39
|
+
}
|
|
40
|
+
} catch (err) {
|
|
41
|
+
logger.error(`Error in request handler: ${err.message || err}`);
|
|
42
|
+
res.status(500).send('Internal Server Error');
|
|
43
|
+
// next();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
33
48
|
function trackConnections(srv) {
|
|
34
49
|
srv.on('connection', (conn) => {
|
|
35
50
|
connections.add(conn);
|
|
@@ -61,9 +76,34 @@ async function bootServer(args) {
|
|
|
61
76
|
}
|
|
62
77
|
|
|
63
78
|
app = express();
|
|
79
|
+
|
|
64
80
|
try {
|
|
65
81
|
const middleware = await loadExp();
|
|
66
82
|
if (typeof middleware === 'function') {
|
|
83
|
+
const _get = app.get.bind(app);
|
|
84
|
+
const _post = app.post.bind(app);
|
|
85
|
+
const _delete = app.delete.bind(app);
|
|
86
|
+
const _put = app.put.bind(app);
|
|
87
|
+
|
|
88
|
+
app.get = (path, ...handlers) => {
|
|
89
|
+
handlers = handlers.map(h => safeHandler(h));
|
|
90
|
+
return _get(path, ...handlers);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
app.post = (path, ...handlers) => {
|
|
94
|
+
handlers = handlers.map(h => safeHandler(h));
|
|
95
|
+
return _post(path, ...handlers);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
app.put = (path, ...handlers) => {
|
|
99
|
+
handlers = handlers.map(h => safeHandler(h));
|
|
100
|
+
return _put(path, ...handlers);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
app.delete = (path, ...handlers) => {
|
|
104
|
+
handlers = handlers.map(h => safeHandler(h));
|
|
105
|
+
return _delete(path, ...handlers);
|
|
106
|
+
};
|
|
67
107
|
middleware(app);
|
|
68
108
|
}
|
|
69
109
|
|
|
@@ -80,7 +120,6 @@ async function bootServer(args) {
|
|
|
80
120
|
}
|
|
81
121
|
}
|
|
82
122
|
|
|
83
|
-
|
|
84
123
|
let esbuildCtx = null;
|
|
85
124
|
|
|
86
125
|
const buildFile = path.join(mpack, `${randomUUID().substring(0, 15)}.js`);
|