phecda-server 7.0.0-alpha.9 → 7.0.1

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 (99) hide show
  1. package/assets/schema.json +12 -9
  2. package/bin/cli.mjs +95 -36
  3. package/dist/{chunk-5RBTN33A.js → chunk-4LLLQOMF.js} +10 -5
  4. package/dist/{chunk-7ZGYJ5OW.mjs → chunk-AIAO6SV6.mjs} +10 -34
  5. package/dist/{chunk-V5EYXVJT.js → chunk-DPPDWBYO.js} +53 -25
  6. package/dist/{chunk-CVPZWDXU.mjs → chunk-E7EAPAGM.mjs} +10 -20
  7. package/dist/{chunk-ODVWOXVB.mjs → chunk-MKRHYZCL.mjs} +30 -2
  8. package/dist/{chunk-FXTJ3BJ6.mjs → chunk-NQ55PA2X.mjs} +9 -4
  9. package/dist/{chunk-FX3LDQII.js → chunk-XKK2SQ7W.js} +60 -70
  10. package/dist/{chunk-KJUD2BKE.js → chunk-ZWPOWMZP.js} +25 -49
  11. package/dist/{core-D_cz0tKa.d.ts → core-DbqWh47p.d.mts} +3 -2
  12. package/dist/{core-BDkhrEyf.d.mts → core-Rq7BhPHE.d.ts} +3 -2
  13. package/dist/helper.d.mts +3 -5
  14. package/dist/helper.d.ts +3 -5
  15. package/dist/helper.js +3 -5
  16. package/dist/helper.mjs +2 -4
  17. package/dist/http/elysia/index.d.mts +4 -4
  18. package/dist/http/elysia/index.d.ts +4 -4
  19. package/dist/http/elysia/index.js +41 -40
  20. package/dist/http/elysia/index.mjs +4 -3
  21. package/dist/http/express/index.d.mts +3 -3
  22. package/dist/http/express/index.d.ts +3 -3
  23. package/dist/http/express/index.js +38 -37
  24. package/dist/http/express/index.mjs +3 -2
  25. package/dist/http/fastify/index.d.mts +3 -3
  26. package/dist/http/fastify/index.d.ts +3 -3
  27. package/dist/http/fastify/index.js +39 -38
  28. package/dist/http/fastify/index.mjs +4 -3
  29. package/dist/http/h3/index.d.mts +3 -3
  30. package/dist/http/h3/index.d.ts +3 -3
  31. package/dist/http/h3/index.js +39 -38
  32. package/dist/http/h3/index.mjs +3 -2
  33. package/dist/http/hono/index.d.mts +3 -3
  34. package/dist/http/hono/index.d.ts +3 -3
  35. package/dist/http/hono/index.js +35 -34
  36. package/dist/http/hono/index.mjs +3 -2
  37. package/dist/http/hyper-express/index.d.mts +3 -3
  38. package/dist/http/hyper-express/index.d.ts +3 -3
  39. package/dist/http/hyper-express/index.js +36 -35
  40. package/dist/http/hyper-express/index.mjs +3 -2
  41. package/dist/http/koa/index.d.mts +3 -3
  42. package/dist/http/koa/index.d.ts +3 -3
  43. package/dist/http/koa/index.js +38 -37
  44. package/dist/http/koa/index.mjs +3 -2
  45. package/dist/index.d.mts +76 -12
  46. package/dist/index.d.ts +76 -12
  47. package/dist/index.js +102 -49
  48. package/dist/index.mjs +66 -13
  49. package/dist/{meta-BX5jhe4Z.d.mts → meta-BoS1E-Nz.d.mts} +6 -23
  50. package/dist/{meta-BX5jhe4Z.d.ts → meta-BoS1E-Nz.d.ts} +6 -23
  51. package/dist/rpc/bullmq/index.d.mts +4 -6
  52. package/dist/rpc/bullmq/index.d.ts +4 -6
  53. package/dist/rpc/bullmq/index.js +12 -80
  54. package/dist/rpc/bullmq/index.mjs +4 -72
  55. package/dist/rpc/electron/index.d.mts +13 -0
  56. package/dist/rpc/electron/index.d.ts +13 -0
  57. package/dist/rpc/electron/index.js +72 -0
  58. package/dist/rpc/electron/index.mjs +72 -0
  59. package/dist/rpc/kafka/index.d.mts +4 -9
  60. package/dist/rpc/kafka/index.d.ts +4 -9
  61. package/dist/rpc/kafka/index.js +11 -90
  62. package/dist/rpc/kafka/index.mjs +4 -83
  63. package/dist/rpc/nats/index.d.mts +4 -6
  64. package/dist/rpc/nats/index.d.ts +4 -6
  65. package/dist/rpc/nats/index.js +12 -72
  66. package/dist/rpc/nats/index.mjs +3 -63
  67. package/dist/rpc/rabbitmq/index.d.mts +4 -6
  68. package/dist/rpc/rabbitmq/index.d.ts +4 -6
  69. package/dist/rpc/rabbitmq/index.js +13 -79
  70. package/dist/rpc/rabbitmq/index.mjs +4 -70
  71. package/dist/rpc/redis/index.d.mts +4 -9
  72. package/dist/rpc/redis/index.d.ts +4 -9
  73. package/dist/rpc/redis/index.js +11 -78
  74. package/dist/rpc/redis/index.mjs +4 -71
  75. package/dist/rpc/web-ext/index.d.mts +2 -0
  76. package/dist/rpc/web-ext/index.d.ts +2 -0
  77. package/dist/rpc/web-ext/index.js +1 -0
  78. package/dist/rpc/web-ext/index.mjs +0 -0
  79. package/dist/rpc/ws/index.d.mts +14 -0
  80. package/dist/rpc/ws/index.d.ts +14 -0
  81. package/dist/rpc/ws/index.js +73 -0
  82. package/dist/rpc/ws/index.mjs +73 -0
  83. package/dist/test.d.mts +7 -3
  84. package/dist/test.d.ts +7 -3
  85. package/dist/test.js +6 -6
  86. package/dist/test.mjs +2 -2
  87. package/dist/types-CInz3bD0.d.ts +14 -0
  88. package/dist/types-E-rqlg3-.d.mts +14 -0
  89. package/dist/{types-DKVhyZk_.d.mts → types-SCJZFCYt.d.mts} +1 -1
  90. package/dist/{types-CMeuFoyd.d.ts → types-xruyYmyu.d.ts} +1 -1
  91. package/package.json +24 -8
  92. package/register/export.mjs +30 -0
  93. package/register/index.mjs +2 -3
  94. package/register/loader.mjs +83 -90
  95. package/register/utils.mjs +36 -6
  96. package/assets/ps.json +0 -24
  97. package/assets/tsconfig.json +0 -21
  98. package/dist/types-B-rUM9Fm.d.mts +0 -19
  99. package/dist/types-MxxtkZXw.d.ts +0 -19
@@ -1,5 +1,6 @@
1
1
  import { basename } from 'path'
2
2
  import { transform } from '@swc-node/core'
3
+ import psExports from './export.mjs'
3
4
  const injectInlineSourceMap = ({ code, map }) => {
4
5
  if (map) {
5
6
  const base64Map = Buffer.from(map, 'utf8').toString('base64')
@@ -19,6 +20,32 @@ export async function compile(sourcecode, filename) {
19
20
  emitDecoratorMetadata: true,
20
21
  experimentalDecorators: true,
21
22
  esModuleInterop: false,
23
+ swc: {
24
+
25
+ jsc: {
26
+ parser: {
27
+ syntax: 'typescript',
28
+ importAttributes: true,
29
+ decorators: true,
30
+ tsx: false,
31
+ dynamicImport: true,
32
+ strictPropertyInitialization: false,
33
+ },
34
+ experimental: {
35
+ keepImportAssertions: true,
36
+ },
37
+ transform: {
38
+ legacyDecorator: true,
39
+ decoratorMetadata: true,
40
+ },
41
+ // parser: {
42
+ // importAttributes: true
43
+ // },
44
+ // experimental: {
45
+ // keepImportAssertions: true
46
+ // }
47
+ },
48
+ },
22
49
  })
23
50
 
24
51
  return injectInlineSourceMap({ code, map })
@@ -26,18 +53,21 @@ export async function compile(sourcecode, filename) {
26
53
 
27
54
  export async function genUnImportRet(opts) {
28
55
  try {
29
- const psExports = Object.keys(await import('../dist/index.mjs'))
30
56
  const { createUnimport } = await import('unimport')
31
57
  return createUnimport({
32
58
  ...opts,
33
- imports: psExports
34
- .map((k) => {
35
- return { name: k, from: 'phecda-server' }
36
- })
37
- .concat(opts.imports || []),
59
+
60
+ presets: [
61
+ {
62
+ from: 'phecda-server',
63
+ imports: psExports,
64
+ },
65
+ ]
66
+ .concat(opts.presets || []),
38
67
  })
39
68
  }
40
69
  catch (e) {
70
+ console.error(e)
41
71
  return false
42
72
  }
43
73
  }
package/assets/ps.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "$schema": "https://unpkg.com/phecda-server/assets/schema.json",
3
- "resolve": [
4
- {
5
- "source": "controller",
6
- "importer": "http",
7
- "path": ".ps/http.js"
8
- },
9
- {
10
- "source": "rpc",
11
- "importer": "client",
12
- "path": ".ps/rpc.js"
13
- }
14
- ],
15
- "unimport": {
16
- "dirs": ["."],
17
- "dirsScanOptions": {
18
- "filePatterns": ["*.{service,controller,module,rpc,solo,guard,extension,pipe,filter,addon}.ts"]
19
- }
20
- },
21
- "virtualFile": {},
22
- "moduleFile": []
23
-
24
- }
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext",
4
- "useDefineForClassFields": false,
5
- "experimentalDecorators": true,
6
- "emitDecoratorMetadata": true,
7
- "module": "esnext",
8
- "lib": ["esnext", "DOM"],
9
- "strictPropertyInitialization": false,
10
- "moduleResolution": "Node",
11
- "strict": true,
12
- "resolveJsonModule": true,
13
- "esModuleInterop": true,
14
- "noEmit": true,
15
- "noUnusedLocals": true,
16
- "noUnusedParameters": true,
17
- "noImplicitReturns": true,
18
- "skipLibCheck": true
19
- },
20
- "include": [".","./ps.d.ts"]
21
- }
@@ -1,19 +0,0 @@
1
- import { D as DefaultOptions, B as BaseCtx } from './meta-BX5jhe4Z.mjs';
2
-
3
- interface RpcServerOptions extends DefaultOptions {
4
- defaultQueue?: string;
5
- }
6
- interface RpcClientOptions {
7
- key?: string;
8
- timeout?: number;
9
- max?: number;
10
- }
11
- interface RpcCtx extends BaseCtx {
12
- args: any[];
13
- id: string;
14
- queue: string;
15
- isEvent?: boolean;
16
- category: 'rpc';
17
- }
18
-
19
- export type { RpcCtx as R, RpcServerOptions as a, RpcClientOptions as b };
@@ -1,19 +0,0 @@
1
- import { D as DefaultOptions, B as BaseCtx } from './meta-BX5jhe4Z.js';
2
-
3
- interface RpcServerOptions extends DefaultOptions {
4
- defaultQueue?: string;
5
- }
6
- interface RpcClientOptions {
7
- key?: string;
8
- timeout?: number;
9
- max?: number;
10
- }
11
- interface RpcCtx extends BaseCtx {
12
- args: any[];
13
- id: string;
14
- queue: string;
15
- isEvent?: boolean;
16
- category: 'rpc';
17
- }
18
-
19
- export type { RpcCtx as R, RpcServerOptions as a, RpcClientOptions as b };