phecda-server 8.0.2 → 8.2.0

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.
Files changed (52) hide show
  1. package/bin/cli.mjs +35 -5
  2. package/dist/{chunk-BLLRB5DQ.mjs → chunk-2P2UICBC.mjs} +2 -1
  3. package/dist/{chunk-UYZSUBX4.js → chunk-C424F7TV.js} +27 -27
  4. package/dist/{chunk-NQ55PA2X.mjs → chunk-JRNXLEAU.mjs} +2 -2
  5. package/dist/{chunk-FI5756JX.mjs → chunk-LYLSA56Y.mjs} +1 -1
  6. package/dist/{chunk-HKN3AAB2.js → chunk-MPKVT4SQ.js} +55 -54
  7. package/dist/{chunk-4LLLQOMF.js → chunk-OUQM7GZH.js} +2 -2
  8. package/dist/{chunk-OLNN4U3O.js → chunk-SRPCXPAQ.js} +20 -20
  9. package/dist/{chunk-PFPOEZHH.mjs → chunk-YDJAOLT2.mjs} +1 -1
  10. package/dist/helper.js +3 -3
  11. package/dist/helper.mjs +2 -2
  12. package/dist/http/elysia/index.d.mts +3 -3
  13. package/dist/http/elysia/index.d.ts +3 -3
  14. package/dist/http/elysia/index.js +40 -40
  15. package/dist/http/elysia/index.mjs +3 -3
  16. package/dist/http/express/index.js +37 -37
  17. package/dist/http/express/index.mjs +2 -2
  18. package/dist/http/fastify/index.js +38 -38
  19. package/dist/http/fastify/index.mjs +3 -3
  20. package/dist/http/h3/index.js +38 -38
  21. package/dist/http/h3/index.mjs +2 -2
  22. package/dist/http/hono/index.js +34 -34
  23. package/dist/http/hono/index.mjs +2 -2
  24. package/dist/http/hyper-express/index.js +35 -35
  25. package/dist/http/hyper-express/index.mjs +2 -2
  26. package/dist/http/koa/index.js +37 -37
  27. package/dist/http/koa/index.mjs +2 -2
  28. package/dist/index.d.mts +3 -1
  29. package/dist/index.d.ts +3 -1
  30. package/dist/index.js +46 -44
  31. package/dist/index.mjs +6 -4
  32. package/dist/rpc/bullmq/index.js +11 -11
  33. package/dist/rpc/bullmq/index.mjs +2 -2
  34. package/dist/rpc/electron/index.js +8 -8
  35. package/dist/rpc/electron/index.mjs +2 -2
  36. package/dist/rpc/kafka/index.js +10 -10
  37. package/dist/rpc/kafka/index.mjs +2 -2
  38. package/dist/rpc/nats/index.js +11 -11
  39. package/dist/rpc/nats/index.mjs +2 -2
  40. package/dist/rpc/rabbitmq/index.js +12 -12
  41. package/dist/rpc/rabbitmq/index.mjs +2 -2
  42. package/dist/rpc/redis/index.js +10 -10
  43. package/dist/rpc/redis/index.mjs +2 -2
  44. package/dist/rpc/ws/index.js +7 -7
  45. package/dist/rpc/ws/index.mjs +2 -2
  46. package/dist/test.js +6 -6
  47. package/dist/test.mjs +2 -2
  48. package/package.json +31 -31
  49. package/register/index.mjs +27 -0
  50. package/register/loader.mjs +65 -65
  51. package/register/utils.mjs +10 -15
  52. package/register/export.mjs +0 -39
package/bin/cli.mjs CHANGED
@@ -95,6 +95,14 @@ cli
95
95
  hasUnimport = false
96
96
  }
97
97
 
98
+ if (hasUnimport) {
99
+ try {
100
+ await import('phecda-core')
101
+ } catch (e) {
102
+ log('please install \'phecda-core\' when using unimport', 'warn')
103
+ }
104
+ }
105
+
98
106
  const tsconfigPath = options.tsconfig
99
107
  const psconfigPath = process.env.PS_CONFIG_FILE || options.config
100
108
 
@@ -125,7 +133,7 @@ cli
125
133
  noImplicitReturns: true,
126
134
  skipLibCheck: true,
127
135
  },
128
- include: ['.', hasUnimport ? (process.env.PS_DTS_PATH || 'ps.d.ts') : undefined],
136
+ include: ['.', hasUnimport ? (process.env.PS_DTS_PATH || 'ps.d.ts') : false].filter(Boolean),
129
137
  },
130
138
 
131
139
  )
@@ -150,7 +158,14 @@ cli
150
158
  ],
151
159
  unimport: hasUnimport && {
152
160
  dirs: [
153
- '.',
161
+ ],
162
+ presets: [
163
+ {
164
+ package: 'phecda-core'
165
+ },
166
+ {
167
+ package: 'phecda-server'
168
+ }
154
169
  ],
155
170
  dirsScanOptions: {
156
171
  filePatterns: [
@@ -191,8 +206,10 @@ cli
191
206
  console.log(`${pc.green('->')} press ${pc.green('e')} to exit`)
192
207
  console.log(`${pc.green('->')} press ${pc.green('r')} to relaunch`)
193
208
  console.log(`${pc.green('->')} press ${pc.green('c')} to clear terminal`)
209
+ console.log(`${pc.green('->')} press ${pc.green('i')} to debug`)
194
210
 
195
211
  process.stdin.on('data', async (data) => {
212
+ const args = [...nodeArgs]
196
213
  const input = data.toString().trim().toLocaleLowerCase()
197
214
  if (input === 'r') {
198
215
  if (child) {
@@ -200,12 +217,11 @@ cli
200
217
  if (closePromise)
201
218
  await closePromise
202
219
  log('relaunch...')
203
- startChild(file, nodeArgs)
220
+ startChild(file, args)
204
221
  }
205
222
  else {
206
223
  log('relaunch...')
207
-
208
- startChild(file, nodeArgs)
224
+ startChild(file, args)
209
225
  }
210
226
  }
211
227
  if (input === 'e')
@@ -213,6 +229,20 @@ cli
213
229
 
214
230
  if (input === 'c')
215
231
  console.clear()
232
+
233
+ if (input === 'i' || input.startsWith('i ')) {
234
+ const [, arg] = input.split(' ')
235
+
236
+ if (child) {
237
+ child.send({
238
+ type: 'inspect',
239
+ arg
240
+ })
241
+ } else {
242
+ args.push(`--inspect${arg ? `=${arg}` : ''}`)
243
+ startChild(file, args)
244
+ }
245
+ }
216
246
  })
217
247
  })
218
248
 
@@ -7,7 +7,7 @@ import {
7
7
  LOG_LEVEL,
8
8
  __name,
9
9
  log
10
- } from "./chunk-NQ55PA2X.mjs";
10
+ } from "./chunk-JRNXLEAU.mjs";
11
11
 
12
12
  // src/helper.ts
13
13
  import pc2 from "picocolors";
@@ -601,6 +601,7 @@ export {
601
601
  TimerException,
602
602
  WorkerException,
603
603
  defaultPipe,
604
+ defaultFilter,
604
605
  Context,
605
606
  addPipe,
606
607
  addFilter,
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunk4LLLQOMFjs = require('./chunk-4LLLQOMF.js');
3
+ var _chunkOUQM7GZHjs = require('./chunk-OUQM7GZH.js');
4
4
 
5
5
  // src/decorators/param.ts
6
6
  var _phecdacore = require('phecda-core');
@@ -10,56 +10,56 @@ function BaseParam(data) {
10
10
  _phecdacore.setMeta.call(void 0, target, property, index, data);
11
11
  };
12
12
  }
13
- _chunk4LLLQOMFjs.__name.call(void 0, BaseParam, "BaseParam");
13
+ _chunkOUQM7GZHjs.__name.call(void 0, BaseParam, "BaseParam");
14
14
  function Body(key = "") {
15
15
  return BaseParam({
16
16
  type: "body",
17
17
  key
18
18
  });
19
19
  }
20
- _chunk4LLLQOMFjs.__name.call(void 0, Body, "Body");
20
+ _chunkOUQM7GZHjs.__name.call(void 0, Body, "Body");
21
21
  function Head(key) {
22
22
  return BaseParam({
23
23
  type: "headers",
24
24
  key: key.toLowerCase()
25
25
  });
26
26
  }
27
- _chunk4LLLQOMFjs.__name.call(void 0, Head, "Head");
27
+ _chunkOUQM7GZHjs.__name.call(void 0, Head, "Head");
28
28
  function Query(key = "") {
29
29
  return BaseParam({
30
30
  type: "query",
31
31
  key
32
32
  });
33
33
  }
34
- _chunk4LLLQOMFjs.__name.call(void 0, Query, "Query");
34
+ _chunkOUQM7GZHjs.__name.call(void 0, Query, "Query");
35
35
  function Param(key) {
36
36
  return BaseParam({
37
37
  type: "params",
38
38
  key
39
39
  });
40
40
  }
41
- _chunk4LLLQOMFjs.__name.call(void 0, Param, "Param");
41
+ _chunkOUQM7GZHjs.__name.call(void 0, Param, "Param");
42
42
  function Arg(target, k, index) {
43
43
  BaseParam({
44
44
  type: "args",
45
45
  key: `${index}`
46
46
  })(target, k, index);
47
47
  }
48
- _chunk4LLLQOMFjs.__name.call(void 0, Arg, "Arg");
48
+ _chunkOUQM7GZHjs.__name.call(void 0, Arg, "Arg");
49
49
  function OneFile(key = "") {
50
50
  return BaseParam({
51
51
  type: "file",
52
52
  key
53
53
  });
54
54
  }
55
- _chunk4LLLQOMFjs.__name.call(void 0, OneFile, "OneFile");
55
+ _chunkOUQM7GZHjs.__name.call(void 0, OneFile, "OneFile");
56
56
  function ManyFiles(key = "") {
57
57
  return BaseParam({
58
58
  type: "files",
59
59
  key
60
60
  });
61
61
  }
62
- _chunk4LLLQOMFjs.__name.call(void 0, ManyFiles, "ManyFiles");
62
+ _chunkOUQM7GZHjs.__name.call(void 0, ManyFiles, "ManyFiles");
63
63
 
64
64
  // src/decorators/aop.ts
65
65
 
@@ -70,7 +70,7 @@ function Guard(...guards) {
70
70
  });
71
71
  };
72
72
  }
73
- _chunk4LLLQOMFjs.__name.call(void 0, Guard, "Guard");
73
+ _chunkOUQM7GZHjs.__name.call(void 0, Guard, "Guard");
74
74
  function Addon(...addons) {
75
75
  return (target, property) => {
76
76
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
@@ -78,7 +78,7 @@ function Addon(...addons) {
78
78
  });
79
79
  };
80
80
  }
81
- _chunk4LLLQOMFjs.__name.call(void 0, Addon, "Addon");
81
+ _chunkOUQM7GZHjs.__name.call(void 0, Addon, "Addon");
82
82
  function Filter(filter) {
83
83
  return (target, property) => {
84
84
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
@@ -86,7 +86,7 @@ function Filter(filter) {
86
86
  });
87
87
  };
88
88
  }
89
- _chunk4LLLQOMFjs.__name.call(void 0, Filter, "Filter");
89
+ _chunkOUQM7GZHjs.__name.call(void 0, Filter, "Filter");
90
90
  function Pipe(pipe) {
91
91
  return (target, property, index) => {
92
92
  if (typeof index === "number") {
@@ -100,7 +100,7 @@ function Pipe(pipe) {
100
100
  });
101
101
  };
102
102
  }
103
- _chunk4LLLQOMFjs.__name.call(void 0, Pipe, "Pipe");
103
+ _chunkOUQM7GZHjs.__name.call(void 0, Pipe, "Pipe");
104
104
 
105
105
  // src/decorators/http.ts
106
106
 
@@ -114,7 +114,7 @@ function Route(route, method) {
114
114
  });
115
115
  };
116
116
  }
117
- _chunk4LLLQOMFjs.__name.call(void 0, Route, "Route");
117
+ _chunkOUQM7GZHjs.__name.call(void 0, Route, "Route");
118
118
  function Header(headers) {
119
119
  return (target, property) => {
120
120
  _phecdacore.setMeta.call(void 0, target, property, void 0, {
@@ -124,31 +124,31 @@ function Header(headers) {
124
124
  });
125
125
  };
126
126
  }
127
- _chunk4LLLQOMFjs.__name.call(void 0, Header, "Header");
127
+ _chunkOUQM7GZHjs.__name.call(void 0, Header, "Header");
128
128
  function Get(route = "") {
129
129
  return Route(route, "get");
130
130
  }
131
- _chunk4LLLQOMFjs.__name.call(void 0, Get, "Get");
131
+ _chunkOUQM7GZHjs.__name.call(void 0, Get, "Get");
132
132
  function Post(route = "") {
133
133
  return Route(route, "post");
134
134
  }
135
- _chunk4LLLQOMFjs.__name.call(void 0, Post, "Post");
135
+ _chunkOUQM7GZHjs.__name.call(void 0, Post, "Post");
136
136
  function Put(route = "") {
137
137
  return Route(route, "put");
138
138
  }
139
- _chunk4LLLQOMFjs.__name.call(void 0, Put, "Put");
139
+ _chunkOUQM7GZHjs.__name.call(void 0, Put, "Put");
140
140
  function Search(route = "") {
141
141
  return Route(route, "search");
142
142
  }
143
- _chunk4LLLQOMFjs.__name.call(void 0, Search, "Search");
143
+ _chunkOUQM7GZHjs.__name.call(void 0, Search, "Search");
144
144
  function Patch(route = "") {
145
145
  return Route(route, "patch");
146
146
  }
147
- _chunk4LLLQOMFjs.__name.call(void 0, Patch, "Patch");
147
+ _chunkOUQM7GZHjs.__name.call(void 0, Patch, "Patch");
148
148
  function Delete(route = "") {
149
149
  return Route(route, "delete");
150
150
  }
151
- _chunk4LLLQOMFjs.__name.call(void 0, Delete, "Delete");
151
+ _chunkOUQM7GZHjs.__name.call(void 0, Delete, "Delete");
152
152
  function Controller(prefix = "") {
153
153
  return (target) => {
154
154
  _phecdacore.setMeta.call(void 0, target, void 0, void 0, {
@@ -159,7 +159,7 @@ function Controller(prefix = "") {
159
159
  });
160
160
  };
161
161
  }
162
- _chunk4LLLQOMFjs.__name.call(void 0, Controller, "Controller");
162
+ _chunkOUQM7GZHjs.__name.call(void 0, Controller, "Controller");
163
163
 
164
164
  // src/decorators/rpc.ts
165
165
 
@@ -173,7 +173,7 @@ function Queue(queue = "", isEvent) {
173
173
  });
174
174
  };
175
175
  }
176
- _chunk4LLLQOMFjs.__name.call(void 0, Queue, "Queue");
176
+ _chunkOUQM7GZHjs.__name.call(void 0, Queue, "Queue");
177
177
  function Rpc() {
178
178
  return (target) => {
179
179
  _phecdacore.setMeta.call(void 0, target, void 0, void 0, {
@@ -181,11 +181,11 @@ function Rpc() {
181
181
  });
182
182
  };
183
183
  }
184
- _chunk4LLLQOMFjs.__name.call(void 0, Rpc, "Rpc");
184
+ _chunkOUQM7GZHjs.__name.call(void 0, Rpc, "Rpc");
185
185
 
186
186
  // src/decorators/ctx.ts
187
187
 
188
- var Ctx = /* @__PURE__ */ _chunk4LLLQOMFjs.__name.call(void 0, (target, property) => {
188
+ var Ctx = /* @__PURE__ */ _chunkOUQM7GZHjs.__name.call(void 0, (target, property) => {
189
189
  _phecdacore.setMeta.call(void 0, target, _phecdacore.SHARE_KEY, void 0, {
190
190
  ctxs: [
191
191
  property
@@ -214,7 +214,7 @@ function Define(key, value) {
214
214
  }
215
215
  };
216
216
  }
217
- _chunk4LLLQOMFjs.__name.call(void 0, Define, "Define");
217
+ _chunkOUQM7GZHjs.__name.call(void 0, Define, "Define");
218
218
 
219
219
  // src/decorators/openapi.ts
220
220
 
@@ -225,7 +225,7 @@ function ApiDoc(config) {
225
225
  });
226
226
  };
227
227
  }
228
- _chunk4LLLQOMFjs.__name.call(void 0, ApiDoc, "ApiDoc");
228
+ _chunkOUQM7GZHjs.__name.call(void 0, ApiDoc, "ApiDoc");
229
229
 
230
230
 
231
231
 
@@ -8,11 +8,11 @@ var IS_ONLY_GENERATE = !!process.env.PS_GENERATE;
8
8
  var IS_STRICT = !!process.env.PS_STRICT;
9
9
  var IS_PURE = !!process.env.PS_PURE;
10
10
  var LOG_LEVEL = Number(process.env.PS_LOG_LEVEL || 0);
11
- var PS_EXIT_CODE = /* @__PURE__ */ function(PS_EXIT_CODE2) {
11
+ var PS_EXIT_CODE = /* @__PURE__ */ (function(PS_EXIT_CODE2) {
12
12
  PS_EXIT_CODE2[PS_EXIT_CODE2["RELAUNCH"] = 4171] = "RELAUNCH";
13
13
  PS_EXIT_CODE2[PS_EXIT_CODE2["EXIT"] = 4172] = "EXIT";
14
14
  return PS_EXIT_CODE2;
15
- }({});
15
+ })({});
16
16
 
17
17
  // src/utils.ts
18
18
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-NQ55PA2X.mjs";
3
+ } from "./chunk-JRNXLEAU.mjs";
4
4
 
5
5
  // src/decorators/param.ts
6
6
  import { setMeta } from "phecda-core";