phecda-server 5.1.0 → 5.1.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.
- package/README.md +10 -10
- package/bin/cli.mjs +189 -189
- package/bin/schema.json +55 -55
- package/dist/{chunk-OTHER3YM.mjs → chunk-2HKQPZDT.mjs} +1 -2
- package/dist/{chunk-GHOKWS5V.js → chunk-3BV2GRS7.js} +38 -39
- package/dist/{chunk-BZP6GKM6.mjs → chunk-665MB62T.mjs} +1 -2
- package/dist/{chunk-QG4X6H5Y.js → chunk-FSBD5R22.js} +65 -66
- package/dist/{chunk-423JPSEB.js → chunk-HMPTPTFL.js} +17 -18
- package/dist/{chunk-6MQP6OHU.mjs → chunk-UU6RHGRF.mjs} +2 -3
- package/dist/{chunk-4YVAW3L4.mjs → chunk-VLV3AO3H.mjs} +0 -1
- package/dist/{chunk-Z4YJHEXT.js → chunk-ZP7HNASU.js} +0 -1
- package/dist/index.js +39 -40
- package/dist/index.mjs +4 -5
- package/dist/rpc/bullmq/index.js +12 -13
- package/dist/rpc/bullmq/index.mjs +2 -3
- package/dist/rpc/kafka/index.js +10 -11
- package/dist/rpc/kafka/index.mjs +2 -3
- package/dist/rpc/nats/index.js +11 -12
- package/dist/rpc/nats/index.mjs +2 -3
- package/dist/rpc/rabbitmq/index.js +13 -14
- package/dist/rpc/rabbitmq/index.mjs +2 -3
- package/dist/rpc/redis/index.js +11 -12
- package/dist/rpc/redis/index.mjs +2 -3
- package/dist/server/elysia/index.js +20 -21
- package/dist/server/elysia/index.mjs +3 -4
- package/dist/server/express/index.js +18 -19
- package/dist/server/express/index.mjs +2 -3
- package/dist/server/fastify/index.js +19 -20
- package/dist/server/fastify/index.mjs +3 -4
- package/dist/server/h3/index.js +16 -17
- package/dist/server/h3/index.mjs +2 -3
- package/dist/server/hono/index.js +17 -18
- package/dist/server/hono/index.mjs +2 -3
- package/dist/server/hyper-express/index.js +17 -18
- package/dist/server/hyper-express/index.mjs +2 -3
- package/dist/server/koa/index.js +18 -19
- package/dist/server/koa/index.mjs +2 -3
- package/dist/test.js +6 -7
- package/dist/test.mjs +2 -3
- package/package.json +2 -2
- package/register/index.mjs +40 -40
- package/register/loader.mjs +354 -341
- package/register/utils.mjs +81 -81
- package/dist/chunk-423JPSEB.js.map +0 -1
- package/dist/chunk-4R55T3HG.js +0 -253
- package/dist/chunk-4R55T3HG.js.map +0 -1
- package/dist/chunk-4YVAW3L4.mjs.map +0 -1
- package/dist/chunk-5DOVDDO7.mjs +0 -295
- package/dist/chunk-5DOVDDO7.mjs.map +0 -1
- package/dist/chunk-5WQ2SMIK.js +0 -295
- package/dist/chunk-5WQ2SMIK.js.map +0 -1
- package/dist/chunk-6MQP6OHU.mjs.map +0 -1
- package/dist/chunk-6Q2PCC3A.mjs +0 -295
- package/dist/chunk-6Q2PCC3A.mjs.map +0 -1
- package/dist/chunk-6UQYEBAN.js +0 -253
- package/dist/chunk-6UQYEBAN.js.map +0 -1
- package/dist/chunk-6W7CGOZC.mjs +0 -565
- package/dist/chunk-6W7CGOZC.mjs.map +0 -1
- package/dist/chunk-7Y37NSBM.js +0 -88
- package/dist/chunk-7Y37NSBM.js.map +0 -1
- package/dist/chunk-BQBSVGMG.mjs +0 -253
- package/dist/chunk-BQBSVGMG.mjs.map +0 -1
- package/dist/chunk-BZP6GKM6.mjs.map +0 -1
- package/dist/chunk-C5JAHCS2.mjs +0 -88
- package/dist/chunk-C5JAHCS2.mjs.map +0 -1
- package/dist/chunk-DTBKDALR.mjs +0 -295
- package/dist/chunk-DTBKDALR.mjs.map +0 -1
- package/dist/chunk-GHOKWS5V.js.map +0 -1
- package/dist/chunk-H4N6SHNG.mjs +0 -76
- package/dist/chunk-H4N6SHNG.mjs.map +0 -1
- package/dist/chunk-ICYHM4UM.js +0 -565
- package/dist/chunk-ICYHM4UM.js.map +0 -1
- package/dist/chunk-LOLXPM4J.mjs +0 -529
- package/dist/chunk-LOLXPM4J.mjs.map +0 -1
- package/dist/chunk-MSS6A2TU.js +0 -585
- package/dist/chunk-MSS6A2TU.js.map +0 -1
- package/dist/chunk-NEM3FY7C.mjs +0 -537
- package/dist/chunk-NEM3FY7C.mjs.map +0 -1
- package/dist/chunk-OTHER3YM.mjs.map +0 -1
- package/dist/chunk-Q2FYFIEY.js +0 -295
- package/dist/chunk-Q2FYFIEY.js.map +0 -1
- package/dist/chunk-QG4X6H5Y.js.map +0 -1
- package/dist/chunk-QIEZ6YTG.mjs +0 -295
- package/dist/chunk-QIEZ6YTG.mjs.map +0 -1
- package/dist/chunk-QOAKHCM7.js +0 -295
- package/dist/chunk-QOAKHCM7.js.map +0 -1
- package/dist/chunk-QVUD6L5X.js +0 -565
- package/dist/chunk-QVUD6L5X.js.map +0 -1
- package/dist/chunk-RGLTGKAU.js +0 -537
- package/dist/chunk-RGLTGKAU.js.map +0 -1
- package/dist/chunk-SHRK3TVB.js +0 -295
- package/dist/chunk-SHRK3TVB.js.map +0 -1
- package/dist/chunk-TCH6S42Z.js +0 -529
- package/dist/chunk-TCH6S42Z.js.map +0 -1
- package/dist/chunk-UCGRFVHC.mjs +0 -253
- package/dist/chunk-UCGRFVHC.mjs.map +0 -1
- package/dist/chunk-VOISXWVF.mjs +0 -295
- package/dist/chunk-VOISXWVF.mjs.map +0 -1
- package/dist/chunk-W6BC5INO.mjs +0 -295
- package/dist/chunk-W6BC5INO.mjs.map +0 -1
- package/dist/chunk-X5WQRO4R.js +0 -295
- package/dist/chunk-X5WQRO4R.js.map +0 -1
- package/dist/chunk-XDMCVVD3.mjs +0 -585
- package/dist/chunk-XDMCVVD3.mjs.map +0 -1
- package/dist/chunk-XNTMYLK6.js +0 -76
- package/dist/chunk-XNTMYLK6.js.map +0 -1
- package/dist/chunk-Y6LI4FDO.js +0 -537
- package/dist/chunk-Y6LI4FDO.js.map +0 -1
- package/dist/chunk-YZ2AQ6IL.mjs +0 -537
- package/dist/chunk-YZ2AQ6IL.mjs.map +0 -1
- package/dist/chunk-Z4YJHEXT.js.map +0 -1
- package/dist/chunk-ZE336SKZ.js +0 -295
- package/dist/chunk-ZE336SKZ.js.map +0 -1
- package/dist/chunk-ZJD235TO.mjs +0 -565
- package/dist/chunk-ZJD235TO.mjs.map +0 -1
- package/dist/core-930ea883.d.ts +0 -131
- package/dist/core-eb646fe5.d.ts +0 -139
- package/dist/core-fd134ffa.d.ts +0 -130
- package/dist/helper-06d25b37.d.ts +0 -19
- package/dist/helper-48454c0b.d.ts +0 -20
- package/dist/helper-73e8d2f0.d.ts +0 -18
- package/dist/helper-867a598d.d.ts +0 -18
- package/dist/helper-88b19c66.d.ts +0 -12
- package/dist/helper-9e206c66.d.ts +0 -12
- package/dist/helper-f29f082f.d.ts +0 -19
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/rpc/bullmq/index.js.map +0 -1
- package/dist/rpc/bullmq/index.mjs.map +0 -1
- package/dist/rpc/kafka/index.js.map +0 -1
- package/dist/rpc/kafka/index.mjs.map +0 -1
- package/dist/rpc/nats/index.js.map +0 -1
- package/dist/rpc/nats/index.mjs.map +0 -1
- package/dist/rpc/rabbitmq/index.js.map +0 -1
- package/dist/rpc/rabbitmq/index.mjs.map +0 -1
- package/dist/rpc/redis/index.js.map +0 -1
- package/dist/rpc/redis/index.mjs.map +0 -1
- package/dist/server/elysia/index.js.map +0 -1
- package/dist/server/elysia/index.mjs.map +0 -1
- package/dist/server/express/index.js.map +0 -1
- package/dist/server/express/index.mjs.map +0 -1
- package/dist/server/fastify/index.js.map +0 -1
- package/dist/server/fastify/index.mjs.map +0 -1
- package/dist/server/h3/index.js.map +0 -1
- package/dist/server/h3/index.mjs.map +0 -1
- package/dist/server/hono/index.js.map +0 -1
- package/dist/server/hono/index.mjs.map +0 -1
- package/dist/server/hyper-express/index.js.map +0 -1
- package/dist/server/hyper-express/index.mjs.map +0 -1
- package/dist/server/koa/index.js.map +0 -1
- package/dist/server/koa/index.mjs.map +0 -1
- package/dist/test.js.map +0 -1
- package/dist/test.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# phecda-server
|
|
2
|
-
|
|
3
|
-
[DOCUMENT](https://fgsreally.github.io/phecda/)
|
|
4
|
-
|
|
5
|
-
nodejs server framework that provide IOC/type-reuse/http&rpc-adaptor
|
|
6
|
-
|
|
7
|
-
like `nestjs`+ `trpc`, work with `elysia/express/hono/h3/koa/fastify/hyper-express` and `redis/rabbimq/kafka/bullmq/nats`
|
|
8
|
-
|
|
9
|
-
Pragmatism , Progressive, Less code and Easy to maintain
|
|
10
|
-
|
|
1
|
+
# phecda-server
|
|
2
|
+
|
|
3
|
+
[DOCUMENT](https://fgsreally.github.io/phecda/)
|
|
4
|
+
|
|
5
|
+
nodejs server framework that provide IOC/type-reuse/http&rpc-adaptor
|
|
6
|
+
|
|
7
|
+
like `nestjs`+ `trpc`, work with `elysia/express/hono/h3/koa/fastify/hyper-express` and `redis/rabbimq/kafka/bullmq/nats`
|
|
8
|
+
|
|
9
|
+
Pragmatism , Progressive, Less code and Easy to maintain
|
|
10
|
+
|
package/bin/cli.mjs
CHANGED
|
@@ -1,189 +1,189 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
|
-
import { fork } from 'child_process'
|
|
3
|
-
import { createRequire } from 'module'
|
|
4
|
-
import pc from 'picocolors'
|
|
5
|
-
import cac from 'cac'
|
|
6
|
-
import fse from 'fs-extra'
|
|
7
|
-
import { log } from '../dist/index.mjs'
|
|
8
|
-
const cli = cac('phecda').option('-c,--config <config>', 'config file', {
|
|
9
|
-
default: 'ps.json',
|
|
10
|
-
})
|
|
11
|
-
const require = createRequire(import.meta.url)
|
|
12
|
-
let child
|
|
13
|
-
|
|
14
|
-
let closePromise
|
|
15
|
-
const nodeVersion = parseFloat(process.version.slice(1))
|
|
16
|
-
|
|
17
|
-
if (nodeVersion < 18.19) {
|
|
18
|
-
log(
|
|
19
|
-
`Nodejs version less than 18.19(current is ${nodeVersion}) can't support hmr`,
|
|
20
|
-
'yellow',
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function startChild(file, args) {
|
|
25
|
-
child = fork(file, {
|
|
26
|
-
env: { NODE_ENV: 'development', ...process.env },
|
|
27
|
-
stdio: 'inherit',
|
|
28
|
-
execArgv: [
|
|
29
|
-
nodeVersion < 18.19
|
|
30
|
-
? '--loader=phecda-server/register/loader.mjs'
|
|
31
|
-
: '--import=phecda-server/register',
|
|
32
|
-
...args,
|
|
33
|
-
],
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
closePromise = new Promise((resolve) => {
|
|
37
|
-
child.once('exit', (code) => {
|
|
38
|
-
if (code === 4) {
|
|
39
|
-
log('only generate code')
|
|
40
|
-
process.exit(0)
|
|
41
|
-
}
|
|
42
|
-
if (code >= 2) {
|
|
43
|
-
// for relaunch
|
|
44
|
-
log('relaunch...')
|
|
45
|
-
startChild(file, args)
|
|
46
|
-
}
|
|
47
|
-
child = undefined
|
|
48
|
-
|
|
49
|
-
resolve()
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function exit() {
|
|
55
|
-
log('process exit')
|
|
56
|
-
|
|
57
|
-
if (child) {
|
|
58
|
-
child.kill()
|
|
59
|
-
process.exit(0)
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
process.exit(0)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
process.on('SIGINT', () => {
|
|
66
|
-
process.exit()
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
cli.command('init', 'init config file').action(async (options) => {
|
|
70
|
-
if (!fse.existsSync('tsconfig.json')) {
|
|
71
|
-
log('init tsconfig.json')
|
|
72
|
-
|
|
73
|
-
await fse.outputFile(
|
|
74
|
-
'tsconfig.json',
|
|
75
|
-
`{
|
|
76
|
-
"compilerOptions": {
|
|
77
|
-
"target": "esnext",
|
|
78
|
-
"useDefineForClassFields": false,
|
|
79
|
-
"experimentalDecorators": true,
|
|
80
|
-
"emitDecoratorMetadata": true,
|
|
81
|
-
"module": "esnext",
|
|
82
|
-
"lib": ["esnext", "DOM"],
|
|
83
|
-
"strictPropertyInitialization": false,
|
|
84
|
-
"moduleResolution": "Node",
|
|
85
|
-
"strict": true,
|
|
86
|
-
"resolveJsonModule": true,
|
|
87
|
-
"esModuleInterop": true,
|
|
88
|
-
"noEmit": true,
|
|
89
|
-
"noUnusedLocals": true,
|
|
90
|
-
"noUnusedParameters": true,
|
|
91
|
-
"noImplicitReturns": true,
|
|
92
|
-
"skipLibCheck": true
|
|
93
|
-
},
|
|
94
|
-
"include": ["src","./ps.d.ts"]
|
|
95
|
-
}
|
|
96
|
-
`,
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (!fse.existsSync(options.config)) {
|
|
101
|
-
log(`init ${options.config}`)
|
|
102
|
-
|
|
103
|
-
await fse.outputFile(
|
|
104
|
-
options.config,
|
|
105
|
-
`{
|
|
106
|
-
"$schema": "node_modules/phecda-server/bin/schema.json",
|
|
107
|
-
"resolve": [
|
|
108
|
-
{
|
|
109
|
-
"source": "controller",
|
|
110
|
-
"importer": "http",
|
|
111
|
-
"path": ".ps/http.js"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"source": "rpc",
|
|
115
|
-
"importer": "client",
|
|
116
|
-
"path": ".ps/rpc.js"
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
"unimport": {
|
|
120
|
-
"dirs": [],
|
|
121
|
-
"dirsScanOptions":{
|
|
122
|
-
"filePatterns":["*.{service,controller,module,rpc,edge,guard,interceptor,extension,pipe,filter,plugin}.ts"]
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"virtualFile":{},
|
|
126
|
-
"moduleFile": []
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
`,
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
})
|
|
133
|
-
|
|
134
|
-
cli
|
|
135
|
-
.command('[file]', 'run file')
|
|
136
|
-
.alias('run')
|
|
137
|
-
.action((file, options) => {
|
|
138
|
-
process.env.PS_CONFIG_FILE = options.config
|
|
139
|
-
|
|
140
|
-
log('process start!')
|
|
141
|
-
|
|
142
|
-
startChild(file, options['--'])
|
|
143
|
-
console.log(`${pc.green('->')} press ${pc.green('e')} to exit`)
|
|
144
|
-
console.log(`${pc.green('->')} press ${pc.green('r')} to relaunch`)
|
|
145
|
-
|
|
146
|
-
process.stdin.on('data', async (data) => {
|
|
147
|
-
const input = data.toString().trim().toLocaleLowerCase()
|
|
148
|
-
if (input === 'r') {
|
|
149
|
-
if (child) {
|
|
150
|
-
await child.kill()
|
|
151
|
-
if (closePromise)
|
|
152
|
-
await closePromise
|
|
153
|
-
log('relaunch...')
|
|
154
|
-
startChild(file, options['--'])
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
log('relaunch...')
|
|
158
|
-
|
|
159
|
-
startChild(file, options['--'])
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (input === 'e')
|
|
163
|
-
exit()
|
|
164
|
-
})
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
cli
|
|
168
|
-
.command('generate [file]', 'generate code(mainly for ci)')
|
|
169
|
-
.action((file, options) => {
|
|
170
|
-
process.env.PS_GENERATE = 'true'
|
|
171
|
-
process.env.PS_CONFIG_FILE = options.config
|
|
172
|
-
startChild(file, options['--'])
|
|
173
|
-
})
|
|
174
|
-
// if (cmd[0] === 'init') {
|
|
175
|
-
|
|
176
|
-
// }
|
|
177
|
-
// else if (cmd[0] === 'code') {
|
|
178
|
-
// process.env.PS_GENERATE = 'true'
|
|
179
|
-
// cmd.splice(0, 1)
|
|
180
|
-
// startChild(file,options['--'])
|
|
181
|
-
// }
|
|
182
|
-
// else {
|
|
183
|
-
|
|
184
|
-
// }
|
|
185
|
-
|
|
186
|
-
cli.help()
|
|
187
|
-
cli.version(require('../package.json').version)
|
|
188
|
-
|
|
189
|
-
cli.parse()
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
import { fork } from 'child_process'
|
|
3
|
+
import { createRequire } from 'module'
|
|
4
|
+
import pc from 'picocolors'
|
|
5
|
+
import cac from 'cac'
|
|
6
|
+
import fse from 'fs-extra'
|
|
7
|
+
import { log } from '../dist/index.mjs'
|
|
8
|
+
const cli = cac('phecda').option('-c,--config <config>', 'config file', {
|
|
9
|
+
default: 'ps.json',
|
|
10
|
+
})
|
|
11
|
+
const require = createRequire(import.meta.url)
|
|
12
|
+
let child
|
|
13
|
+
|
|
14
|
+
let closePromise
|
|
15
|
+
const nodeVersion = parseFloat(process.version.slice(1))
|
|
16
|
+
|
|
17
|
+
if (nodeVersion < 18.19) {
|
|
18
|
+
log(
|
|
19
|
+
`Nodejs version less than 18.19(current is ${nodeVersion}) can't support hmr`,
|
|
20
|
+
'yellow',
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function startChild(file, args) {
|
|
25
|
+
child = fork(file, {
|
|
26
|
+
env: { NODE_ENV: 'development', ...process.env },
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
execArgv: [
|
|
29
|
+
nodeVersion < 18.19
|
|
30
|
+
? '--loader=phecda-server/register/loader.mjs'
|
|
31
|
+
: '--import=phecda-server/register',
|
|
32
|
+
...args,
|
|
33
|
+
],
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
closePromise = new Promise((resolve) => {
|
|
37
|
+
child.once('exit', (code) => {
|
|
38
|
+
if (code === 4) {
|
|
39
|
+
log('only generate code')
|
|
40
|
+
process.exit(0)
|
|
41
|
+
}
|
|
42
|
+
if (code >= 2) {
|
|
43
|
+
// for relaunch
|
|
44
|
+
log('relaunch...')
|
|
45
|
+
startChild(file, args)
|
|
46
|
+
}
|
|
47
|
+
child = undefined
|
|
48
|
+
|
|
49
|
+
resolve()
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function exit() {
|
|
55
|
+
log('process exit')
|
|
56
|
+
|
|
57
|
+
if (child) {
|
|
58
|
+
child.kill()
|
|
59
|
+
process.exit(0)
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
process.exit(0)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
process.on('SIGINT', () => {
|
|
66
|
+
process.exit()
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
cli.command('init', 'init config file').action(async (options) => {
|
|
70
|
+
if (!fse.existsSync('tsconfig.json')) {
|
|
71
|
+
log('init tsconfig.json')
|
|
72
|
+
|
|
73
|
+
await fse.outputFile(
|
|
74
|
+
'tsconfig.json',
|
|
75
|
+
`{
|
|
76
|
+
"compilerOptions": {
|
|
77
|
+
"target": "esnext",
|
|
78
|
+
"useDefineForClassFields": false,
|
|
79
|
+
"experimentalDecorators": true,
|
|
80
|
+
"emitDecoratorMetadata": true,
|
|
81
|
+
"module": "esnext",
|
|
82
|
+
"lib": ["esnext", "DOM"],
|
|
83
|
+
"strictPropertyInitialization": false,
|
|
84
|
+
"moduleResolution": "Node",
|
|
85
|
+
"strict": true,
|
|
86
|
+
"resolveJsonModule": true,
|
|
87
|
+
"esModuleInterop": true,
|
|
88
|
+
"noEmit": true,
|
|
89
|
+
"noUnusedLocals": true,
|
|
90
|
+
"noUnusedParameters": true,
|
|
91
|
+
"noImplicitReturns": true,
|
|
92
|
+
"skipLibCheck": true
|
|
93
|
+
},
|
|
94
|
+
"include": ["src","./ps.d.ts"]
|
|
95
|
+
}
|
|
96
|
+
`,
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (!fse.existsSync(options.config)) {
|
|
101
|
+
log(`init ${options.config}`)
|
|
102
|
+
|
|
103
|
+
await fse.outputFile(
|
|
104
|
+
options.config,
|
|
105
|
+
`{
|
|
106
|
+
"$schema": "node_modules/phecda-server/bin/schema.json",
|
|
107
|
+
"resolve": [
|
|
108
|
+
{
|
|
109
|
+
"source": "controller",
|
|
110
|
+
"importer": "http",
|
|
111
|
+
"path": ".ps/http.js"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"source": "rpc",
|
|
115
|
+
"importer": "client",
|
|
116
|
+
"path": ".ps/rpc.js"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"unimport": {
|
|
120
|
+
"dirs": [],
|
|
121
|
+
"dirsScanOptions":{
|
|
122
|
+
"filePatterns":["*.{service,controller,module,rpc,edge,guard,interceptor,extension,pipe,filter,plugin}.ts"]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"virtualFile":{},
|
|
126
|
+
"moduleFile": []
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
`,
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
cli
|
|
135
|
+
.command('[file]', 'run file')
|
|
136
|
+
.alias('run')
|
|
137
|
+
.action((file, options) => {
|
|
138
|
+
process.env.PS_CONFIG_FILE = options.config
|
|
139
|
+
|
|
140
|
+
log('process start!')
|
|
141
|
+
|
|
142
|
+
startChild(file, options['--'])
|
|
143
|
+
console.log(`${pc.green('->')} press ${pc.green('e')} to exit`)
|
|
144
|
+
console.log(`${pc.green('->')} press ${pc.green('r')} to relaunch`)
|
|
145
|
+
|
|
146
|
+
process.stdin.on('data', async (data) => {
|
|
147
|
+
const input = data.toString().trim().toLocaleLowerCase()
|
|
148
|
+
if (input === 'r') {
|
|
149
|
+
if (child) {
|
|
150
|
+
await child.kill()
|
|
151
|
+
if (closePromise)
|
|
152
|
+
await closePromise
|
|
153
|
+
log('relaunch...')
|
|
154
|
+
startChild(file, options['--'])
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
log('relaunch...')
|
|
158
|
+
|
|
159
|
+
startChild(file, options['--'])
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (input === 'e')
|
|
163
|
+
exit()
|
|
164
|
+
})
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
cli
|
|
168
|
+
.command('generate [file]', 'generate code(mainly for ci)')
|
|
169
|
+
.action((file, options) => {
|
|
170
|
+
process.env.PS_GENERATE = 'true'
|
|
171
|
+
process.env.PS_CONFIG_FILE = options.config
|
|
172
|
+
startChild(file, options['--'])
|
|
173
|
+
})
|
|
174
|
+
// if (cmd[0] === 'init') {
|
|
175
|
+
|
|
176
|
+
// }
|
|
177
|
+
// else if (cmd[0] === 'code') {
|
|
178
|
+
// process.env.PS_GENERATE = 'true'
|
|
179
|
+
// cmd.splice(0, 1)
|
|
180
|
+
// startChild(file,options['--'])
|
|
181
|
+
// }
|
|
182
|
+
// else {
|
|
183
|
+
|
|
184
|
+
// }
|
|
185
|
+
|
|
186
|
+
cli.help()
|
|
187
|
+
cli.version(require('../package.json').version)
|
|
188
|
+
|
|
189
|
+
cli.parse()
|
package/bin/schema.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"resolve": {
|
|
6
|
-
"type": "array",
|
|
7
|
-
"items": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"source": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "The middle name of the imported file."
|
|
13
|
-
},
|
|
14
|
-
"importer": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "The middle name of the importer file."
|
|
17
|
-
},
|
|
18
|
-
"path": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
|
|
21
|
-
"description": "Redirect path"
|
|
22
|
-
},
|
|
23
|
-
"filename": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"optional": true,
|
|
26
|
-
|
|
27
|
-
"description": "generate split chunk,only work in vite"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"required": ["source", "path", "importer"]
|
|
31
|
-
},
|
|
32
|
-
"description": "Resolve and redirect modules path"
|
|
33
|
-
},
|
|
34
|
-
"moduleFile": {
|
|
35
|
-
"type": "array",
|
|
36
|
-
"items": {
|
|
37
|
-
"type": "string"
|
|
38
|
-
},
|
|
39
|
-
"description": "Including the module's file middle name, such as controller mapping to xx.controller.ts"
|
|
40
|
-
},
|
|
41
|
-
"virtualFile": {
|
|
42
|
-
"type": "object",
|
|
43
|
-
"additionalProperties": {
|
|
44
|
-
"type": "string"
|
|
45
|
-
},
|
|
46
|
-
"description": "Virtual module, just like in Vite."
|
|
47
|
-
},
|
|
48
|
-
"unimport": {
|
|
49
|
-
"type": "object",
|
|
50
|
-
"description": "Includes the arguments passed to unimport and 'dtsPath' that specifies the location for generating type files."
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
"required": ["resolve"]
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"resolve": {
|
|
6
|
+
"type": "array",
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"source": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "The middle name of the imported file."
|
|
13
|
+
},
|
|
14
|
+
"importer": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "The middle name of the importer file."
|
|
17
|
+
},
|
|
18
|
+
"path": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
|
|
21
|
+
"description": "Redirect path"
|
|
22
|
+
},
|
|
23
|
+
"filename": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"optional": true,
|
|
26
|
+
|
|
27
|
+
"description": "generate split chunk,only work in vite"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": ["source", "path", "importer"]
|
|
31
|
+
},
|
|
32
|
+
"description": "Resolve and redirect modules path"
|
|
33
|
+
},
|
|
34
|
+
"moduleFile": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"description": "Including the module's file middle name, such as controller mapping to xx.controller.ts"
|
|
40
|
+
},
|
|
41
|
+
"virtualFile": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"additionalProperties": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"description": "Virtual module, just like in Vite."
|
|
47
|
+
},
|
|
48
|
+
"unimport": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"description": "Includes the arguments passed to unimport and 'dtsPath' that specifies the location for generating type files."
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
"required": ["resolve"]
|
|
55
|
+
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
IS_ONLY_GENERATE,
|
|
4
4
|
__name,
|
|
5
5
|
log
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VLV3AO3H.mjs";
|
|
7
7
|
|
|
8
8
|
// src/meta.ts
|
|
9
9
|
var Meta = class {
|
|
@@ -250,4 +250,3 @@ export {
|
|
|
250
250
|
emitter,
|
|
251
251
|
Factory
|
|
252
252
|
};
|
|
253
|
-
//# sourceMappingURL=chunk-OTHER3YM.mjs.map
|