phecda-server 5.0.0-beta.31 → 5.0.0-beta.33

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 (67) hide show
  1. package/bin/cli.mjs +189 -0
  2. package/bin/schema.json +48 -0
  3. package/dist/{chunk-XCOZROAD.mjs → chunk-73I24DQB.mjs} +10 -5
  4. package/dist/{chunk-3BNP77AS.mjs → chunk-CMPQPS47.mjs} +1 -1
  5. package/dist/chunk-F5YWXY5W.js +252 -0
  6. package/dist/{chunk-76A2C5MK.js → chunk-INIUC4CX.js} +2 -2
  7. package/dist/{chunk-77NDBQUP.mjs → chunk-ITTD2GBR.mjs} +2 -4
  8. package/dist/{chunk-D43Y5B7X.js → chunk-MAXJYJDI.js} +3 -3
  9. package/dist/{chunk-DWVJG3GB.mjs → chunk-N3H5Q64U.mjs} +1 -1
  10. package/dist/{chunk-MNFNPNPN.js → chunk-PPWMPM3L.js} +61 -56
  11. package/dist/chunk-QA2ACJXC.js +304 -0
  12. package/dist/{chunk-JHNFTTTI.mjs → chunk-RCTOVYZY.mjs} +68 -169
  13. package/dist/{chunk-2F5GI3TP.js → chunk-SKQSX262.js} +3 -3
  14. package/dist/chunk-UKGE77X6.mjs +304 -0
  15. package/dist/{chunk-JI4JFZJ6.mjs → chunk-WCX6N5VH.mjs} +1 -1
  16. package/dist/{chunk-ZD3QIREU.js → chunk-YR5Q5F2K.js} +2 -4
  17. package/dist/{core-5b4022e6.d.ts → core-eb319626.d.ts} +26 -12
  18. package/dist/{helper-338f2427.d.ts → helper-1ec9374b.d.ts} +2 -2
  19. package/dist/index.d.ts +40 -21
  20. package/dist/index.js +132 -41
  21. package/dist/index.mjs +108 -17
  22. package/dist/rpc/bullmq/index.d.ts +1 -1
  23. package/dist/rpc/bullmq/index.js +98 -90
  24. package/dist/rpc/bullmq/index.mjs +88 -80
  25. package/dist/rpc/kafka/index.d.ts +1 -1
  26. package/dist/rpc/kafka/index.js +38 -32
  27. package/dist/rpc/kafka/index.mjs +26 -20
  28. package/dist/rpc/nats/index.d.ts +1 -1
  29. package/dist/rpc/nats/index.js +97 -89
  30. package/dist/rpc/nats/index.mjs +87 -79
  31. package/dist/rpc/rabbitmq/index.d.ts +1 -1
  32. package/dist/rpc/rabbitmq/index.js +38 -32
  33. package/dist/rpc/rabbitmq/index.mjs +24 -18
  34. package/dist/rpc/redis/index.d.ts +1 -1
  35. package/dist/rpc/redis/index.js +33 -27
  36. package/dist/rpc/redis/index.mjs +21 -15
  37. package/dist/server/elysia/index.d.ts +3 -3
  38. package/dist/server/elysia/index.js +83 -80
  39. package/dist/server/elysia/index.mjs +67 -64
  40. package/dist/server/express/index.d.ts +2 -2
  41. package/dist/server/express/index.js +87 -83
  42. package/dist/server/express/index.mjs +73 -69
  43. package/dist/server/fastify/index.d.ts +3 -3
  44. package/dist/server/fastify/index.js +92 -88
  45. package/dist/server/fastify/index.mjs +76 -72
  46. package/dist/server/h3/index.d.ts +1 -1
  47. package/dist/server/h3/index.js +83 -81
  48. package/dist/server/h3/index.mjs +69 -67
  49. package/dist/server/hono/index.d.ts +2 -2
  50. package/dist/server/hono/index.js +83 -79
  51. package/dist/server/hono/index.mjs +69 -65
  52. package/dist/server/hyper-express/index.d.ts +2 -2
  53. package/dist/server/hyper-express/index.js +91 -87
  54. package/dist/server/hyper-express/index.mjs +77 -73
  55. package/dist/server/koa/index.d.ts +2 -2
  56. package/dist/server/koa/index.js +84 -80
  57. package/dist/server/koa/index.mjs +70 -66
  58. package/dist/test.d.ts +1 -1
  59. package/dist/test.js +7 -7
  60. package/dist/test.mjs +3 -3
  61. package/package.json +4 -4
  62. package/register/loader.mjs +64 -44
  63. package/register/utils.mjs +28 -29
  64. package/bin/cli.js +0 -132
  65. package/dist/chunk-2YCQAPMD.js +0 -245
  66. package/dist/chunk-BE5ZBJ2W.js +0 -353
  67. package/dist/chunk-QVXVOOUG.mjs +0 -245
package/bin/cli.mjs ADDED
@@ -0,0 +1,189 @@
1
+ #! /usr/bin/env node
2
+ import { fork } from 'child_process'
3
+ import fs from 'fs'
4
+ import { createRequire } from 'module'
5
+ import pc from 'picocolors'
6
+ import cac from 'cac'
7
+ import { log } from '../dist/index.mjs'
8
+ const cli = cac('phecda')
9
+ const require = createRequire(import.meta.url)
10
+ let child
11
+
12
+ let closePromise
13
+ const nodeVersion = parseFloat(process.version.slice(1))
14
+
15
+ if (nodeVersion < 18.19) {
16
+ log(
17
+ `Nodejs version less than 18.19(current is ${nodeVersion}) can't support hmr`,
18
+ 'yellow',
19
+ )
20
+ }
21
+
22
+ function startChild(file, args) {
23
+ child = fork(file, {
24
+ env: { NODE_ENV: 'development', ...process.env },
25
+ stdio: 'inherit',
26
+ execArgv: [
27
+ nodeVersion < 18.19
28
+ ? '--loader=phecda-server/register/loader.mjs'
29
+ : '--import=phecda-server/register',
30
+ ...args,
31
+ ],
32
+ })
33
+
34
+ closePromise = new Promise((resolve) => {
35
+ child.once('exit', (code) => {
36
+ if (code === 4) {
37
+ log('only generate code')
38
+ process.exit(0)
39
+ }
40
+ if (code >= 2) {
41
+ // for relaunch
42
+ log('relaunch...')
43
+ startChild(file, args)
44
+ }
45
+ child = undefined
46
+
47
+ resolve()
48
+ })
49
+ })
50
+ }
51
+
52
+ function exit() {
53
+ log('process exit')
54
+
55
+ if (child) {
56
+ child.kill()
57
+ process.exit(0)
58
+ }
59
+ else {
60
+ process.exit(0)
61
+ }
62
+ }
63
+ process.on('SIGINT', () => {
64
+ process.exit()
65
+ })
66
+
67
+ cli.command('init', 'init config file').action(() => {
68
+ log('init tsconfig.json')
69
+
70
+ fs.writeFileSync(
71
+ 'tsconfig.json',
72
+ `{
73
+ "compilerOptions": {
74
+ "target": "esnext",
75
+ "useDefineForClassFields": false,
76
+ "experimentalDecorators": true,
77
+ "emitDecoratorMetadata": true,
78
+ "module": "esnext",
79
+ "lib": ["esnext", "DOM"],
80
+ "strictPropertyInitialization": false,
81
+ "moduleResolution": "Node",
82
+ "strict": true,
83
+ "resolveJsonModule": true,
84
+ "isolatedModules": true,
85
+ "esModuleInterop": true,
86
+ "noEmit": true,
87
+ "noUnusedLocals": true,
88
+ "noUnusedParameters": true,
89
+ "noImplicitReturns": true,
90
+ "skipLibCheck": true
91
+ },
92
+ "include": ["src","./ps.d.ts"]
93
+ }
94
+ `,
95
+ )
96
+
97
+ log('init ps.json')
98
+
99
+ fs.writeFileSync(
100
+ 'ps.json',
101
+ `{
102
+ "$schema": "node_modules/phecda-server/bin/schema.json",
103
+ "resolve": [
104
+ {
105
+ "source": "controller",
106
+ "importer": "http",
107
+ "path": "http.ts"
108
+ },
109
+ {
110
+ "source": "rpc",
111
+ "importer": "client",
112
+ "path": "rpc.ts"
113
+ }
114
+ ],
115
+ "unimport": {
116
+ "dirs": ["./src/*"],
117
+ "dirsScanOptions":{
118
+ "filePatterns":["*.{service,controller,module}.ts"]
119
+ },
120
+ "dtsPath": "./ps.d.ts"
121
+ },
122
+ "moduleFile": []
123
+ }
124
+ `,
125
+ )
126
+ })
127
+
128
+ cli
129
+ .command('[file]', 'run file')
130
+ .alias('run')
131
+ .option('-c, --config', 'config file', {
132
+ default: './ps.json',
133
+ })
134
+ .action((file, options) => {
135
+ process.env.PS_CONFIG_FILE = options.config
136
+
137
+ log('process start!')
138
+
139
+ startChild(file, options['--'])
140
+ console.log(`${pc.green('->')} press ${pc.green('e')} to exit`)
141
+ console.log(`${pc.green('->')} press ${pc.green('r')} to relaunch`)
142
+
143
+ process.stdin.on('data', async (data) => {
144
+ const input = data.toString().trim().toLocaleLowerCase()
145
+ if (input === 'r') {
146
+ if (child) {
147
+ await child.kill()
148
+ if (closePromise)
149
+ await closePromise
150
+ log('relaunch...')
151
+ startChild(file, options['--'])
152
+ }
153
+ else {
154
+ log('relaunch...')
155
+
156
+ startChild(file, options['--'])
157
+ }
158
+ }
159
+ if (input === 'e')
160
+ exit()
161
+ })
162
+ })
163
+
164
+ cli
165
+ .command('generate [file]', 'generate code(mainly for ci)')
166
+ .option('-c, --config', 'config file', {
167
+ default: './ps.json',
168
+ })
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()
@@ -0,0 +1,48 @@
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
+ "unimport": {
42
+ "type": "object",
43
+ "description": "Includes the arguments passed to unimport and 'dtsPath' that specifies the location for generating type files."
44
+ }
45
+ },
46
+
47
+ "required": ["resolve"]
48
+ }
@@ -6,7 +6,7 @@ import {
6
6
  __name,
7
7
  __publicField,
8
8
  log
9
- } from "./chunk-77NDBQUP.mjs";
9
+ } from "./chunk-ITTD2GBR.mjs";
10
10
 
11
11
  // src/exception/base.ts
12
12
  var Exception = class extends Error {
@@ -190,12 +190,12 @@ import Debug from "debug";
190
190
  var defaultFilter = /* @__PURE__ */ __name((e) => {
191
191
  if (!(e instanceof Exception)) {
192
192
  log(e.message, "error");
193
- if (LOG_LEVEL <= 2)
193
+ if (LOG_LEVEL <= 0)
194
194
  console.error(e.stack);
195
195
  e = new UndefinedException(e.message || e);
196
196
  } else {
197
197
  log(`[${e.constructor.name}] ${e.message}`, "error");
198
- if (LOG_LEVEL <= 2)
198
+ if (LOG_LEVEL <= 0)
199
199
  console.error(e.stack);
200
200
  }
201
201
  return e.data;
@@ -351,15 +351,19 @@ function addInterceptor(key, handler) {
351
351
  Context.interceptorRecord[key] = handler;
352
352
  }
353
353
  __name(addInterceptor, "addInterceptor");
354
- function detectAopDep(meta, { guards, interceptors, plugins } = {}, type = "http") {
354
+ function detectAopDep(meta, { guards, interceptors, plugins } = {}, controller = "http") {
355
355
  const pluginSet = new Set(plugins);
356
356
  const guardSet = new Set(guards);
357
357
  const interceptorSet = new Set(interceptors);
358
358
  const pipeSet = /* @__PURE__ */ new Set();
359
359
  const filterSet = /* @__PURE__ */ new Set();
360
+ const warningSet = /* @__PURE__ */ new Set();
360
361
  meta.forEach(({ data }) => {
361
- if (!data[type])
362
+ if (data.controller !== controller) {
363
+ if (data[controller])
364
+ warningSet.add(`Module "${data.tag === data.name ? data.name : `${data.name}(${data.tag})`}" should use ${controller} controller to decorate class or remove ${controller} decorator on method "${data.func}"`);
362
365
  return;
366
+ }
363
367
  if (data.filter)
364
368
  filterSet.add(data.filter);
365
369
  data.interceptors.forEach((i) => interceptorSet.add(i));
@@ -395,6 +399,7 @@ function detectAopDep(meta, { guards, interceptors, plugins } = {}, type = "http
395
399
  log(`${pc.blue(`Pipe [${missPipes.join(",")}]`)} doesn't exist`, "warn");
396
400
  if (missFilters.length)
397
401
  log(`${pc.red(`Filter [${missFilters.join(",")}]`)} doesn't exist`, "warn");
402
+ warningSet.forEach((warn) => log(warn, "warn"));
398
403
  return {
399
404
  missPlugins,
400
405
  missGuards,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-77NDBQUP.mjs";
3
+ } from "./chunk-ITTD2GBR.mjs";
4
4
 
5
5
  // src/rpc/helper.ts
6
6
  import { hostname } from "os";
@@ -0,0 +1,252 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+
6
+ var _chunkYR5Q5F2Kjs = require('./chunk-YR5Q5F2K.js');
7
+
8
+ // src/meta.ts
9
+ var Meta = class {
10
+
11
+
12
+ constructor(data, paramsType) {
13
+ this.data = data;
14
+ this.paramsType = paramsType;
15
+ }
16
+ };
17
+ _chunkYR5Q5F2Kjs.__name.call(void 0, Meta, "Meta");
18
+
19
+ // src/core.ts
20
+ require('reflect-metadata');
21
+ var _events = require('events'); var _events2 = _interopRequireDefault(_events);
22
+ var _phecdacore = require('phecda-core');
23
+ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
24
+ var debug = _debug2.default.call(void 0, "phecda-server(Factory)");
25
+ var emitter = new (0, _events2.default)();
26
+ async function Factory(models, opts = {}) {
27
+ const moduleMap = /* @__PURE__ */ new Map();
28
+ const meta = [];
29
+ const constructorMap = /* @__PURE__ */ new Map();
30
+ const constructorSet = /* @__PURE__ */ new WeakSet();
31
+ const dependenceGraph = /* @__PURE__ */ new Map();
32
+ const { parseModule = /* @__PURE__ */ _chunkYR5Q5F2Kjs.__name.call(void 0, (module) => module, "parseModule"), parseMeta = /* @__PURE__ */ _chunkYR5Q5F2Kjs.__name.call(void 0, (meta2) => meta2, "parseMeta"), generators } = opts;
33
+ if (!_phecdacore.getInject.call(void 0, "watcher")) {
34
+ _phecdacore.setInject.call(void 0, "watcher", ({ eventName, instance, key, options }) => {
35
+ const fn = typeof instance[key] === "function" ? instance[key].bind(instance) : (v) => instance[key] = v;
36
+ if (_optionalChain([options, 'optionalAccess', _ => _.once]))
37
+ emitter.once(eventName, fn);
38
+ else
39
+ emitter.on(eventName, fn);
40
+ return () => {
41
+ emitter.off(eventName, fn);
42
+ };
43
+ });
44
+ }
45
+ async function del(tag) {
46
+ if (!moduleMap.has(tag))
47
+ return;
48
+ const instance = moduleMap.get(tag);
49
+ debug(`unmount module "${String(tag)}"`);
50
+ await _phecdacore.invokeHandler.call(void 0, "unmount", instance);
51
+ debug(`del module "${String(tag)}"`);
52
+ moduleMap.delete(tag);
53
+ constructorMap.delete(tag);
54
+ for (let i = meta.length - 1; i >= 0; i--) {
55
+ if (meta[i].data.tag === tag)
56
+ meta.splice(i, 1);
57
+ }
58
+ return instance;
59
+ }
60
+ _chunkYR5Q5F2Kjs.__name.call(void 0, del, "del");
61
+ async function destroy() {
62
+ debug("destroy all");
63
+ for (const [tag] of moduleMap)
64
+ await del(tag);
65
+ }
66
+ _chunkYR5Q5F2Kjs.__name.call(void 0, destroy, "destroy");
67
+ async function add(Model) {
68
+ const tag = _phecdacore.getTag.call(void 0, Model);
69
+ const oldInstance = await del(tag);
70
+ const { instance: newModule } = await buildDepModule(Model);
71
+ if (oldInstance && dependenceGraph.has(tag)) {
72
+ debug(`replace module "${String(tag)}"`);
73
+ [
74
+ ...dependenceGraph.get(tag)
75
+ ].forEach((tag2) => {
76
+ const module = moduleMap.get(tag2);
77
+ for (const key in module) {
78
+ if (module[key] === oldInstance)
79
+ module[key] = newModule;
80
+ }
81
+ });
82
+ }
83
+ }
84
+ _chunkYR5Q5F2Kjs.__name.call(void 0, add, "add");
85
+ async function buildDepModule(Model) {
86
+ const paramtypes = getParamTypes(Model);
87
+ let instance;
88
+ const tag = _phecdacore.getTag.call(void 0, Model);
89
+ if (moduleMap.has(tag)) {
90
+ instance = moduleMap.get(tag);
91
+ if (!instance)
92
+ throw new Error(`exist Circular-Dependency or Multiple modules with the same name/tag [tag] ${String(tag)}--[module] ${Model}`);
93
+ if (constructorMap.get(tag) !== Model && !constructorSet.has(Model)) {
94
+ constructorSet.add(Model);
95
+ _chunkYR5Q5F2Kjs.log.call(void 0, `Synonym module: Module taged "${String(tag)}" has been loaded before, so phecda-server won't load Module "${Model.name}"`, "warn");
96
+ }
97
+ return {
98
+ instance,
99
+ tag
100
+ };
101
+ }
102
+ moduleMap.set(tag, void 0);
103
+ debug(`instantiate module "${String(tag)}"`);
104
+ if (paramtypes) {
105
+ const paramtypesInstances = [];
106
+ for (const i in paramtypes) {
107
+ const { instance: sub, tag: subTag } = await buildDepModule(paramtypes[i]);
108
+ paramtypesInstances[i] = sub;
109
+ if (!dependenceGraph.has(subTag))
110
+ dependenceGraph.set(subTag, /* @__PURE__ */ new Set());
111
+ dependenceGraph.get(subTag).add(tag);
112
+ }
113
+ instance = parseModule(new Model(...paramtypesInstances));
114
+ } else {
115
+ instance = parseModule(new Model());
116
+ }
117
+ meta.push(...getMetaFromInstance(instance, tag, Model.name).map(parseMeta).filter((item) => !!item));
118
+ debug(`init module "${String(tag)}"`);
119
+ if (!_chunkYR5Q5F2Kjs.IS_ONLY_GENERATE)
120
+ await _phecdacore.invokeHandler.call(void 0, "init", instance);
121
+ debug(`add module "${String(tag)}"`);
122
+ moduleMap.set(tag, instance);
123
+ constructorMap.set(tag, Model);
124
+ return {
125
+ instance,
126
+ tag
127
+ };
128
+ }
129
+ _chunkYR5Q5F2Kjs.__name.call(void 0, buildDepModule, "buildDepModule");
130
+ for (const model of models)
131
+ await buildDepModule(model);
132
+ async function generateCode() {
133
+ if (generators) {
134
+ return Promise.all(generators.map((generator) => {
135
+ debug(`generate "${generator.name}" code to ${generator.path}`);
136
+ return generator.output(meta);
137
+ }));
138
+ }
139
+ }
140
+ _chunkYR5Q5F2Kjs.__name.call(void 0, generateCode, "generateCode");
141
+ generateCode().then(() => {
142
+ if (_chunkYR5Q5F2Kjs.IS_ONLY_GENERATE)
143
+ process.exit(4);
144
+ });
145
+ if (_chunkYR5Q5F2Kjs.IS_HMR) {
146
+ if (!globalThis.__PS_HMR__)
147
+ globalThis.__PS_HMR__ = [];
148
+ _optionalChain([globalThis, 'access', _2 => _2.__PS_HMR__, 'optionalAccess', _3 => _3.push, 'call', _4 => _4(async (files) => {
149
+ debug("reload files ");
150
+ for (const file of files) {
151
+ const models2 = await Promise.resolve().then(() => require(file));
152
+ for (const i in models2) {
153
+ if (_phecdacore.isPhecda.call(void 0, models2[i]))
154
+ await add(models2[i]);
155
+ }
156
+ }
157
+ generateCode();
158
+ })]);
159
+ }
160
+ return {
161
+ moduleMap,
162
+ constructorMap,
163
+ meta,
164
+ add,
165
+ del,
166
+ destroy
167
+ };
168
+ }
169
+ _chunkYR5Q5F2Kjs.__name.call(void 0, Factory, "Factory");
170
+ function getMetaFromInstance(instance, tag, name) {
171
+ const vars = _phecdacore.getExposeKey.call(void 0, instance).filter((item) => typeof item === "string");
172
+ const baseState = _phecdacore.getState.call(void 0, instance);
173
+ initState(baseState);
174
+ const ctx = _phecdacore.get.call(void 0, instance, "context");
175
+ return vars.filter((i) => typeof instance[i] === "function").map((i) => {
176
+ const state = _phecdacore.getState.call(void 0, instance, i);
177
+ const meta = {
178
+ ...state,
179
+ name,
180
+ tag,
181
+ func: i
182
+ };
183
+ if (baseState.controller) {
184
+ if (typeof tag !== "string")
185
+ _chunkYR5Q5F2Kjs.log.call(void 0, `can't use Tag with ${typeof tag} on controller "${instance.constructor.name}",instead with "${tag = String(tag)}"`, "error");
186
+ initState(state);
187
+ meta.ctx = ctx;
188
+ meta.controller = baseState.controller;
189
+ meta[baseState.controller] = {
190
+ ...baseState[baseState.controller],
191
+ ...state[baseState.controller]
192
+ };
193
+ const params = [];
194
+ for (const i2 of state.params || []) {
195
+ if (!i2.pipe)
196
+ i2.pipe = state.pipe || baseState.pipe;
197
+ if (!i2.define)
198
+ i2.define = {};
199
+ params.unshift(i2);
200
+ if (i2.index === 0)
201
+ break;
202
+ }
203
+ meta.params = params;
204
+ meta.filter = state.filter || baseState.filter;
205
+ meta.define = {
206
+ ...baseState.define,
207
+ ...state.define
208
+ };
209
+ meta.plugins = [
210
+ .../* @__PURE__ */ new Set([
211
+ ...baseState.plugins,
212
+ ...state.plugins
213
+ ])
214
+ ];
215
+ meta.guards = [
216
+ .../* @__PURE__ */ new Set([
217
+ ...baseState.guards,
218
+ ...state.guards
219
+ ])
220
+ ];
221
+ meta.interceptors = [
222
+ .../* @__PURE__ */ new Set([
223
+ ...baseState.interceptors,
224
+ ...state.interceptors
225
+ ])
226
+ ];
227
+ }
228
+ return new Meta(meta, getParamTypes(instance, i) || []);
229
+ });
230
+ }
231
+ _chunkYR5Q5F2Kjs.__name.call(void 0, getMetaFromInstance, "getMetaFromInstance");
232
+ function getParamTypes(Module, key) {
233
+ return Reflect.getMetadata("design:paramtypes", Module, key);
234
+ }
235
+ _chunkYR5Q5F2Kjs.__name.call(void 0, getParamTypes, "getParamTypes");
236
+ function initState(state) {
237
+ if (!state.define)
238
+ state.define = {};
239
+ if (!state.plugins)
240
+ state.plugins = /* @__PURE__ */ new Set();
241
+ if (!state.guards)
242
+ state.guards = /* @__PURE__ */ new Set();
243
+ if (!state.interceptors)
244
+ state.interceptors = /* @__PURE__ */ new Set();
245
+ }
246
+ _chunkYR5Q5F2Kjs.__name.call(void 0, initState, "initState");
247
+
248
+
249
+
250
+
251
+
252
+ exports.Meta = Meta; exports.emitter = emitter; exports.Factory = Factory;
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZD3QIREUjs = require('./chunk-ZD3QIREU.js');
3
+ var _chunkYR5Q5F2Kjs = require('./chunk-YR5Q5F2K.js');
4
4
 
5
5
  // src/rpc/helper.ts
6
6
  var _os = require('os');
7
7
  function genClientQueue(key) {
8
8
  return `PS-${key ? `${key}-` : ""}${_os.hostname.call(void 0, )}-${process.pid}`;
9
9
  }
10
- _chunkZD3QIREUjs.__name.call(void 0, genClientQueue, "genClientQueue");
10
+ _chunkYR5Q5F2Kjs.__name.call(void 0, genClientQueue, "genClientQueue");
11
11
 
12
12
 
13
13
 
@@ -10,10 +10,9 @@ var __publicField = (obj, key, value) => {
10
10
  var UNMOUNT_SYMBOL = "__PS_UNMOUNT__";
11
11
  var ERROR_SYMBOL = "__PS_ERROR__";
12
12
  var IS_HMR = process.env.NODE_ENV === "development";
13
- var IS_ONLY_CODE = !!process.env.PS_CODE;
13
+ var IS_ONLY_GENERATE = !!process.env.PS_GENERATE;
14
14
  var IS_STRICT = !!process.env.PS_STRICT;
15
15
  var LOG_LEVEL = Number(process.env.PS_LOG_LEVEL || 0);
16
- var PS_FILE_RE = /[^.](?:\.controller|rpc|service|module|extension|ext|guard|interceptor|plugin|filter|pipe|edge)\.ts$/i;
17
16
  var PS_EXIT_CODE;
18
17
  (function(PS_EXIT_CODE2) {
19
18
  PS_EXIT_CODE2[PS_EXIT_CODE2["RELAUNCH"] = 2] = "RELAUNCH";
@@ -77,10 +76,9 @@ export {
77
76
  UNMOUNT_SYMBOL,
78
77
  ERROR_SYMBOL,
79
78
  IS_HMR,
80
- IS_ONLY_CODE,
79
+ IS_ONLY_GENERATE,
81
80
  IS_STRICT,
82
81
  LOG_LEVEL,
83
- PS_FILE_RE,
84
82
  PS_EXIT_CODE,
85
83
  log,
86
84
  getConfig,
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkZD3QIREUjs = require('./chunk-ZD3QIREU.js');
4
+ var _chunkYR5Q5F2Kjs = require('./chunk-YR5Q5F2K.js');
5
5
 
6
6
  // src/hmr.ts
7
7
  function HMR(cb) {
8
- if (_chunkZD3QIREUjs.IS_HMR)
8
+ if (_chunkYR5Q5F2Kjs.IS_HMR)
9
9
  _optionalChain([globalThis, 'access', _ => _.__PS_HMR__, 'optionalAccess', _2 => _2.push, 'call', _3 => _3(cb)]);
10
10
  }
11
- _chunkZD3QIREUjs.__name.call(void 0, HMR, "HMR");
11
+ _chunkYR5Q5F2Kjs.__name.call(void 0, HMR, "HMR");
12
12
 
13
13
 
14
14
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __name
3
- } from "./chunk-77NDBQUP.mjs";
3
+ } from "./chunk-ITTD2GBR.mjs";
4
4
 
5
5
  // src/server/helper.ts
6
6
  function resolveDep(ret, key) {