phecda-server 7.0.0-alpha.8 → 7.0.0-alpha.9
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/dist/{chunk-VSGYTGHY.js → chunk-5RBTN33A.js} +22 -2
- package/dist/{chunk-B45BN7LY.mjs → chunk-7ZGYJ5OW.mjs} +88 -54
- package/dist/{chunk-SGMQZRP6.mjs → chunk-CVPZWDXU.mjs} +2 -23
- package/dist/{chunk-7EMAZGYO.js → chunk-FX3LDQII.js} +59 -80
- package/dist/{chunk-YKP4ODZA.mjs → chunk-FXTJ3BJ6.mjs} +23 -3
- package/dist/{chunk-QJIAXSLZ.js → chunk-KJUD2BKE.js} +103 -69
- package/dist/{chunk-7NWDKK7D.mjs → chunk-ODVWOXVB.mjs} +1 -1
- package/dist/{chunk-BBNJVYVX.js → chunk-V5EYXVJT.js} +24 -24
- package/dist/{core-BcKywWLd.d.mts → core-BDkhrEyf.d.mts} +4 -3
- package/dist/{core-BGEsBtTG.d.ts → core-D_cz0tKa.d.ts} +4 -3
- package/dist/helper.d.mts +6 -5
- package/dist/helper.d.ts +6 -5
- package/dist/helper.js +6 -3
- package/dist/helper.mjs +8 -5
- package/dist/http/elysia/index.d.mts +3 -3
- package/dist/http/elysia/index.d.ts +3 -3
- package/dist/http/elysia/index.js +41 -45
- package/dist/http/elysia/index.mjs +4 -8
- package/dist/http/express/index.d.mts +3 -3
- package/dist/http/express/index.d.ts +3 -3
- package/dist/http/express/index.js +38 -42
- package/dist/http/express/index.mjs +4 -8
- package/dist/http/fastify/index.d.mts +3 -3
- package/dist/http/fastify/index.d.ts +3 -3
- package/dist/http/fastify/index.js +39 -43
- package/dist/http/fastify/index.mjs +4 -8
- package/dist/http/h3/index.d.mts +3 -3
- package/dist/http/h3/index.d.ts +3 -3
- package/dist/http/h3/index.js +39 -43
- package/dist/http/h3/index.mjs +3 -7
- package/dist/http/hono/index.d.mts +3 -3
- package/dist/http/hono/index.d.ts +3 -3
- package/dist/http/hono/index.js +35 -39
- package/dist/http/hono/index.mjs +3 -7
- package/dist/http/hyper-express/index.d.mts +3 -3
- package/dist/http/hyper-express/index.d.ts +3 -3
- package/dist/http/hyper-express/index.js +36 -40
- package/dist/http/hyper-express/index.mjs +3 -7
- package/dist/http/koa/index.d.mts +3 -3
- package/dist/http/koa/index.d.ts +3 -3
- package/dist/http/koa/index.js +38 -42
- package/dist/http/koa/index.mjs +4 -8
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +40 -42
- package/dist/index.mjs +4 -6
- package/dist/{meta-B_HW7cWh.d.mts → meta-BX5jhe4Z.d.mts} +1 -2
- package/dist/{meta-B_HW7cWh.d.ts → meta-BX5jhe4Z.d.ts} +1 -2
- package/dist/rpc/bullmq/index.d.mts +3 -3
- package/dist/rpc/bullmq/index.d.ts +3 -3
- package/dist/rpc/bullmq/index.js +14 -14
- package/dist/rpc/bullmq/index.mjs +3 -3
- package/dist/rpc/kafka/index.d.mts +3 -3
- package/dist/rpc/kafka/index.d.ts +3 -3
- package/dist/rpc/kafka/index.js +14 -14
- package/dist/rpc/kafka/index.mjs +2 -2
- package/dist/rpc/nats/index.d.mts +3 -3
- package/dist/rpc/nats/index.d.ts +3 -3
- package/dist/rpc/nats/index.js +13 -13
- package/dist/rpc/nats/index.mjs +3 -3
- package/dist/rpc/rabbitmq/index.d.mts +3 -3
- package/dist/rpc/rabbitmq/index.d.ts +3 -3
- package/dist/rpc/rabbitmq/index.js +15 -15
- package/dist/rpc/rabbitmq/index.mjs +3 -3
- package/dist/rpc/redis/index.d.mts +3 -3
- package/dist/rpc/redis/index.d.ts +3 -3
- package/dist/rpc/redis/index.js +13 -13
- package/dist/rpc/redis/index.mjs +3 -3
- package/dist/test.d.mts +3 -3
- package/dist/test.d.ts +3 -3
- package/dist/test.js +6 -6
- package/dist/test.mjs +2 -2
- package/dist/{types-DEQb_e59.d.mts → types-B-rUM9Fm.d.mts} +1 -1
- package/dist/{types-PFPIQWVF.d.ts → types-CMeuFoyd.d.ts} +1 -1
- package/dist/{types-C2SQ9U9V.d.mts → types-DKVhyZk_.d.mts} +1 -1
- package/dist/{types-CYF0vha6.d.ts → types-MxxtkZXw.d.ts} +1 -1
- package/package.json +1 -1
- package/register/index.mjs +20 -11
- package/register/loader.mjs +12 -27
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import {
|
|
2
|
+
import { D as DefaultOptions, B as BaseCtx } from './meta-BX5jhe4Z.js';
|
|
3
3
|
|
|
4
4
|
interface HttpOptions extends DefaultOptions {
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import {
|
|
2
|
+
import { D as DefaultOptions, B as BaseCtx } from './meta-BX5jhe4Z.mjs';
|
|
3
3
|
|
|
4
4
|
interface HttpOptions extends DefaultOptions {
|
|
5
5
|
/**
|
package/package.json
CHANGED
package/register/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { register } from 'node:module'
|
|
2
2
|
import { MessageChannel } from 'node:worker_threads'
|
|
3
|
-
import { log } from '../dist/index.mjs'
|
|
4
|
-
|
|
3
|
+
import { isPhecda, log } from '../dist/index.mjs'
|
|
4
|
+
import { RELAUNCH, RELOAD } from '../dist/helper.mjs'
|
|
5
5
|
const { port1, port2 } = new MessageChannel()
|
|
6
6
|
|
|
7
7
|
register('./loader.mjs', {
|
|
@@ -12,18 +12,27 @@ register('./loader.mjs', {
|
|
|
12
12
|
|
|
13
13
|
let isRunning = true
|
|
14
14
|
|
|
15
|
+
const fileModelMap = new Map()
|
|
16
|
+
|
|
15
17
|
port1.on('message', async (data) => {
|
|
16
18
|
const { type, files } = JSON.parse(data)
|
|
17
19
|
|
|
18
|
-
if (!isRunning ||
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
if (type === 'change') {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
if (!isRunning || type === 'relaunch')
|
|
21
|
+
return RELAUNCH()// file change -> relaunch
|
|
22
|
+
|
|
23
|
+
if (type === 'change' || type === 'init') {
|
|
24
|
+
if (!files.length)
|
|
25
|
+
return
|
|
26
|
+
const oldModels = []
|
|
27
|
+
const newModels = []
|
|
28
|
+
for (const file of files) {
|
|
29
|
+
oldModels.push(...fileModelMap.get(file) || [])
|
|
30
|
+
const models = Object.values(await import(file)).filter(isPhecda)
|
|
31
|
+
fileModelMap.set(file, models)
|
|
32
|
+
newModels.push(...models)
|
|
33
|
+
}
|
|
34
|
+
if (type === 'change')
|
|
35
|
+
return RELOAD(oldModels, newModels)
|
|
27
36
|
}
|
|
28
37
|
})
|
|
29
38
|
|
package/register/loader.mjs
CHANGED
|
@@ -75,7 +75,7 @@ export async function initialize(data) {
|
|
|
75
75
|
if (!config.paths)
|
|
76
76
|
config.paths = {}
|
|
77
77
|
|
|
78
|
-
if (
|
|
78
|
+
if (IS_DEV) {
|
|
79
79
|
chokidar.watch(configPath, { persistent: true }).on('change', () => {
|
|
80
80
|
port.postMessage(
|
|
81
81
|
JSON.stringify({
|
|
@@ -254,32 +254,17 @@ export const load = async (url, context, nextLoad) => {
|
|
|
254
254
|
&& !isLowVersion
|
|
255
255
|
) {
|
|
256
256
|
watchFiles.add(url)
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
// }),
|
|
269
|
-
// )
|
|
270
|
-
// }
|
|
271
|
-
// catch (e) {
|
|
272
|
-
// port.postMessage(
|
|
273
|
-
// JSON.stringify({
|
|
274
|
-
// type: 'relaunch',
|
|
275
|
-
// }),
|
|
276
|
-
// )
|
|
277
|
-
// }
|
|
278
|
-
// }
|
|
279
|
-
// }),
|
|
280
|
-
// )
|
|
281
|
-
|
|
282
|
-
if (IS_DEV && !process.env.PS_HMR_BAN) {
|
|
257
|
+
|
|
258
|
+
if (IS_DEV) {
|
|
259
|
+
if (isModuleFileUrl(url)) {
|
|
260
|
+
port.postMessage(
|
|
261
|
+
JSON.stringify({
|
|
262
|
+
type: 'init',
|
|
263
|
+
files: [fileURLToPath(url)],
|
|
264
|
+
}),
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
|
|
283
268
|
chokidar.watch(fileURLToPath(url), { persistent: true }).on(
|
|
284
269
|
'change',
|
|
285
270
|
debounce(() => {
|