phecda-server 7.0.0-alpha.12 → 7.0.0-alpha.13

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.
@@ -46,8 +46,17 @@
46
46
  "description": "Virtual module, just like in Vite."
47
47
  },
48
48
  "unimport": {
49
- "type": "object",
50
- "description": "Includes the arguments passed to unimport"
49
+ "oneOf": [
50
+ {
51
+ "type": "object",
52
+ "description": "Includes the arguments passed to unimport"
53
+ },
54
+ {
55
+ "type": "boolean",
56
+ "enum": [false],
57
+ "description": "Disable unimport"
58
+ }
59
+ ]
51
60
  }
52
61
  },
53
62
 
package/bin/cli.mjs CHANGED
@@ -1,9 +1,6 @@
1
1
  #! /usr/bin/env node
2
2
  import { fork } from 'child_process'
3
3
  import { createRequire } from 'module'
4
- import { fileURLToPath } from 'url'
5
-
6
- import { dirname, resolve } from 'path'
7
4
  import pc from 'picocolors'
8
5
  import cac from 'cac'
9
6
  import fse from 'fs-extra'
@@ -20,8 +17,6 @@ const cli = cac('phecda').option('-c,--config <config>', 'config file', {
20
17
  default: 'ps.json',
21
18
  })
22
19
 
23
- const __dirname = dirname(fileURLToPath(import.meta.url))
24
-
25
20
  const require = createRequire(import.meta.url)
26
21
  let child
27
22
 
@@ -36,7 +31,7 @@ if (nodeVersion < 18.19) {
36
31
  }
37
32
 
38
33
  function startChild(file, args) {
39
- child = fork(file, {
34
+ child = globalThis.PS_CREATE_CHILD?.() || fork(file, {
40
35
  env: { ...process.env },
41
36
  stdio: 'inherit',
42
37
  execArgv: [
@@ -87,22 +82,80 @@ cli
87
82
  if (root)
88
83
  process.chdir(root)
89
84
 
85
+ let hasUnimport
86
+
87
+ try {
88
+ await import('unimport')
89
+ hasUnimport = true
90
+ }
91
+
92
+ catch (e) {
93
+ hasUnimport = false
94
+ }
95
+
90
96
  const tsconfigPath = options.tsconfig
91
97
  const psconfigPath = process.env.PS_CONFIG_FILE || options.config
92
98
 
93
99
  if (!fse.existsSync(tsconfigPath)) {
94
100
  log(`create ${tsconfigPath}`)
95
101
 
96
- await fse.copyFile(
97
- resolve(__dirname, '../assets/tsconfig.json'),
102
+ await fse.outputJSON(
98
103
  tsconfigPath,
104
+ {
105
+ compilerOptions: {
106
+ target: 'esnext',
107
+ useDefineForClassFields: false,
108
+ experimentalDecorators: true,
109
+ emitDecoratorMetadata: true,
110
+ module: 'esnext',
111
+ lib: ['esnext', 'DOM'],
112
+ strictPropertyInitialization: false,
113
+ moduleResolution: 'bundler',
114
+ strict: true,
115
+ resolveJsonModule: true,
116
+ esModuleInterop: true,
117
+ noEmit: true,
118
+ noUnusedLocals: true,
119
+ noUnusedParameters: true,
120
+ noImplicitReturns: true,
121
+ skipLibCheck: true,
122
+ },
123
+ include: ['.', hasUnimport ? (process.env.PS_DTS_PATH || 'ps.d.ts') : undefined],
124
+ },
125
+
99
126
  )
100
127
  }
101
128
 
102
129
  if (!fse.existsSync(psconfigPath)) {
103
130
  log(`create ${psconfigPath}`)
104
131
 
105
- await fse.copyFile(resolve(__dirname, '../assets/ps.json'), psconfigPath)
132
+ await fse.outputJSON(psconfigPath, {
133
+ $schema: './node_modules/phecda-server/assets/schema.json',
134
+ resolve: [
135
+ {
136
+ source: 'controller',
137
+ importer: 'http',
138
+ path: '.ps/http.js',
139
+ },
140
+ {
141
+ source: 'rpc',
142
+ importer: 'client',
143
+ path: '.ps/rpc.js',
144
+ },
145
+ ],
146
+ unimport: hasUnimport && {
147
+ dirs: [
148
+ '.',
149
+ ],
150
+ dirsScanOptions: {
151
+ filePatterns: [
152
+ '*.{service,controller,module,rpc,solo,guard,extension,pipe,filter,addon}.ts',
153
+ ],
154
+ },
155
+ },
156
+ virtualFile: {},
157
+ moduleFile: [],
158
+ })
106
159
  }
107
160
 
108
161
  log('init finish')
@@ -0,0 +1,13 @@
1
+ import Electron from 'electron';
2
+ import { F as Factory } from '../../core-jUg1HvYT.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-6qaaUIKZ.mjs';
4
+ import 'phecda-core';
5
+ import '../../meta-xvg6V7pH.mjs';
6
+
7
+ interface ElectronCtx extends RpcCtx {
8
+ type: 'electron';
9
+ event: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent;
10
+ }
11
+ declare function bind(IPC: Electron.IpcMain, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: RpcServerOptions): void;
12
+
13
+ export { type ElectronCtx, bind };
@@ -0,0 +1,13 @@
1
+ import Electron from 'electron';
2
+ import { F as Factory } from '../../core-CDzIy2g0.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-BtXOT5rI.js';
4
+ import 'phecda-core';
5
+ import '../../meta-xvg6V7pH.js';
6
+
7
+ interface ElectronCtx extends RpcCtx {
8
+ type: 'electron';
9
+ event: Electron.IpcMainEvent | Electron.IpcMainInvokeEvent;
10
+ }
11
+ declare function bind(IPC: Electron.IpcMain, { moduleMap, meta }: Awaited<ReturnType<typeof Factory>>, opts?: RpcServerOptions): void;
12
+
13
+ export { type ElectronCtx, bind };
@@ -0,0 +1,72 @@
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
+ var _chunkIJFIY6QNjs = require('../../chunk-IJFIY6QN.js');
6
+
7
+
8
+ var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
9
+
10
+ // src/rpc/electron/bind.ts
11
+ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
12
+ var debug = _debug2.default.call(void 0, "phecda-server/electron");
13
+ function bind(IPC, { moduleMap, meta }, opts = {}) {
14
+ const { globalGuards, globalFilter, globalPipe, globalAddons = [] } = opts;
15
+ const metaMap = _chunkIJFIY6QNjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
16
+ const { controller, rpc, func, tag } = meta2.data;
17
+ if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
18
+ debug(`register method "${func}" in module "${tag}"`);
19
+ return true;
20
+ }
21
+ });
22
+ _chunkIJFIY6QNjs.detectAopDep.call(void 0, meta, {
23
+ guards: globalGuards,
24
+ addons: globalAddons
25
+ }, "rpc");
26
+ IPC.handle("phecda-server:invoke", callback);
27
+ IPC.on("phecda-server:send", callback);
28
+ async function callback(event, data) {
29
+ const { func, id, tag, _ps, args } = data || {};
30
+ debug(`invoke method "${func}" in module "${tag}"`);
31
+ if (_ps !== 1) return;
32
+ const meta2 = metaMap.get(tag)[func];
33
+ const { data: { rpc: { isEvent } = {} } } = meta2;
34
+ const aop = _chunkIJFIY6QNjs.Context.getAop(meta2, {
35
+ globalFilter,
36
+ globalGuards,
37
+ globalPipe
38
+ });
39
+ const context = new (0, _chunkIJFIY6QNjs.Context)({
40
+ type: "electron",
41
+ category: "rpc",
42
+ moduleMap,
43
+ meta: meta2,
44
+ tag,
45
+ func,
46
+ args,
47
+ id,
48
+ isEvent,
49
+ queue: tag,
50
+ event
51
+ });
52
+ return await context.run(aop, (returnData) => {
53
+ if (!isEvent) return {
54
+ data: returnData,
55
+ id
56
+ };
57
+ }, (err) => {
58
+ if (!isEvent) {
59
+ return {
60
+ data: err,
61
+ error: true,
62
+ id
63
+ };
64
+ }
65
+ });
66
+ }
67
+ _chunk4LLLQOMFjs.__name.call(void 0, callback, "callback");
68
+ }
69
+ _chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
70
+
71
+
72
+ exports.bind = bind;
@@ -0,0 +1,72 @@
1
+ import {
2
+ Context,
3
+ createControllerMetaMap,
4
+ detectAopDep
5
+ } from "../../chunk-VX4BZEL7.mjs";
6
+ import {
7
+ __name
8
+ } from "../../chunk-NQ55PA2X.mjs";
9
+
10
+ // src/rpc/electron/bind.ts
11
+ import Debug from "debug";
12
+ var debug = Debug("phecda-server/electron");
13
+ function bind(IPC, { moduleMap, meta }, opts = {}) {
14
+ const { globalGuards, globalFilter, globalPipe, globalAddons = [] } = opts;
15
+ const metaMap = createControllerMetaMap(meta, (meta2) => {
16
+ const { controller, rpc, func, tag } = meta2.data;
17
+ if (controller === "rpc" && rpc?.queue !== void 0) {
18
+ debug(`register method "${func}" in module "${tag}"`);
19
+ return true;
20
+ }
21
+ });
22
+ detectAopDep(meta, {
23
+ guards: globalGuards,
24
+ addons: globalAddons
25
+ }, "rpc");
26
+ IPC.handle("phecda-server:invoke", callback);
27
+ IPC.on("phecda-server:send", callback);
28
+ async function callback(event, data) {
29
+ const { func, id, tag, _ps, args } = data || {};
30
+ debug(`invoke method "${func}" in module "${tag}"`);
31
+ if (_ps !== 1) return;
32
+ const meta2 = metaMap.get(tag)[func];
33
+ const { data: { rpc: { isEvent } = {} } } = meta2;
34
+ const aop = Context.getAop(meta2, {
35
+ globalFilter,
36
+ globalGuards,
37
+ globalPipe
38
+ });
39
+ const context = new Context({
40
+ type: "electron",
41
+ category: "rpc",
42
+ moduleMap,
43
+ meta: meta2,
44
+ tag,
45
+ func,
46
+ args,
47
+ id,
48
+ isEvent,
49
+ queue: tag,
50
+ event
51
+ });
52
+ return await context.run(aop, (returnData) => {
53
+ if (!isEvent) return {
54
+ data: returnData,
55
+ id
56
+ };
57
+ }, (err) => {
58
+ if (!isEvent) {
59
+ return {
60
+ data: err,
61
+ error: true,
62
+ id
63
+ };
64
+ }
65
+ });
66
+ }
67
+ __name(callback, "callback");
68
+ }
69
+ __name(bind, "bind");
70
+ export {
71
+ bind
72
+ };
@@ -0,0 +1,14 @@
1
+ import WS from 'ws';
2
+ import { F as Factory } from '../../core-jUg1HvYT.mjs';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-6qaaUIKZ.mjs';
4
+ import 'phecda-core';
5
+ import '../../meta-xvg6V7pH.mjs';
6
+
7
+ interface WsCtx extends RpcCtx {
8
+ type: 'ws';
9
+ ws: WS;
10
+ wss: WS.Server;
11
+ }
12
+ declare function bind(wss: WS.Server, data: Awaited<ReturnType<typeof Factory>>, opts?: RpcServerOptions): void;
13
+
14
+ export { type WsCtx, bind };
@@ -0,0 +1,14 @@
1
+ import WS from 'ws';
2
+ import { F as Factory } from '../../core-CDzIy2g0.js';
3
+ import { R as RpcCtx, a as RpcServerOptions } from '../../types-BtXOT5rI.js';
4
+ import 'phecda-core';
5
+ import '../../meta-xvg6V7pH.js';
6
+
7
+ interface WsCtx extends RpcCtx {
8
+ type: 'ws';
9
+ ws: WS;
10
+ wss: WS.Server;
11
+ }
12
+ declare function bind(wss: WS.Server, data: Awaited<ReturnType<typeof Factory>>, opts?: RpcServerOptions): void;
13
+
14
+ export { type WsCtx, bind };
@@ -0,0 +1,73 @@
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
+ var _chunkIJFIY6QNjs = require('../../chunk-IJFIY6QN.js');
6
+
7
+
8
+ var _chunk4LLLQOMFjs = require('../../chunk-4LLLQOMF.js');
9
+
10
+ // src/rpc/ws/bind.ts
11
+ var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
12
+ var debug = _debug2.default.call(void 0, "phecda-server/ws");
13
+ function bind(wss, data, opts = {}) {
14
+ const { globalGuards, globalAddons, globalFilter, globalPipe } = opts;
15
+ const { moduleMap, meta } = data;
16
+ const metaMap = _chunkIJFIY6QNjs.createControllerMetaMap.call(void 0, meta, (meta2) => {
17
+ const { controller, rpc, func, tag } = meta2.data;
18
+ if (controller === "rpc" && _optionalChain([rpc, 'optionalAccess', _ => _.queue]) !== void 0) {
19
+ debug(`register method "${func}" in module "${tag}"`);
20
+ return true;
21
+ }
22
+ });
23
+ _chunkIJFIY6QNjs.detectAopDep.call(void 0, meta, {
24
+ guards: globalGuards,
25
+ addons: globalAddons
26
+ }, "rpc");
27
+ wss.on("connection", (ws) => {
28
+ ws.on("message", async (raw) => {
29
+ try {
30
+ const data2 = JSON.parse(raw.toString());
31
+ const { func, id, tag, _ps, args, queue } = data2;
32
+ if (_ps !== 1) return;
33
+ const meta2 = metaMap.get(tag)[func];
34
+ const { data: { rpc: { isEvent } = {} } } = meta2;
35
+ const aop = _chunkIJFIY6QNjs.Context.getAop(meta2, {
36
+ globalFilter,
37
+ globalGuards,
38
+ globalPipe
39
+ });
40
+ const context = new (0, _chunkIJFIY6QNjs.Context)({
41
+ type: "ws",
42
+ category: "rpc",
43
+ meta: meta2,
44
+ moduleMap,
45
+ tag,
46
+ func,
47
+ args,
48
+ id,
49
+ queue,
50
+ wss,
51
+ ws
52
+ });
53
+ return await context.run(aop, (returnData) => {
54
+ if (!isEvent) ws.send(JSON.stringify({
55
+ id,
56
+ data: returnData
57
+ }));
58
+ }, (err) => {
59
+ if (!isEvent) ws.send(JSON.stringify({
60
+ id,
61
+ data: err,
62
+ error: true
63
+ }));
64
+ });
65
+ } catch (e) {
66
+ }
67
+ });
68
+ });
69
+ }
70
+ _chunk4LLLQOMFjs.__name.call(void 0, bind, "bind");
71
+
72
+
73
+ exports.bind = bind;
@@ -0,0 +1,73 @@
1
+ import {
2
+ Context,
3
+ createControllerMetaMap,
4
+ detectAopDep
5
+ } from "../../chunk-VX4BZEL7.mjs";
6
+ import {
7
+ __name
8
+ } from "../../chunk-NQ55PA2X.mjs";
9
+
10
+ // src/rpc/ws/bind.ts
11
+ import Debug from "debug";
12
+ var debug = Debug("phecda-server/ws");
13
+ function bind(wss, data, opts = {}) {
14
+ const { globalGuards, globalAddons, globalFilter, globalPipe } = opts;
15
+ const { moduleMap, meta } = data;
16
+ const metaMap = createControllerMetaMap(meta, (meta2) => {
17
+ const { controller, rpc, func, tag } = meta2.data;
18
+ if (controller === "rpc" && rpc?.queue !== void 0) {
19
+ debug(`register method "${func}" in module "${tag}"`);
20
+ return true;
21
+ }
22
+ });
23
+ detectAopDep(meta, {
24
+ guards: globalGuards,
25
+ addons: globalAddons
26
+ }, "rpc");
27
+ wss.on("connection", (ws) => {
28
+ ws.on("message", async (raw) => {
29
+ try {
30
+ const data2 = JSON.parse(raw.toString());
31
+ const { func, id, tag, _ps, args, queue } = data2;
32
+ if (_ps !== 1) return;
33
+ const meta2 = metaMap.get(tag)[func];
34
+ const { data: { rpc: { isEvent } = {} } } = meta2;
35
+ const aop = Context.getAop(meta2, {
36
+ globalFilter,
37
+ globalGuards,
38
+ globalPipe
39
+ });
40
+ const context = new Context({
41
+ type: "ws",
42
+ category: "rpc",
43
+ meta: meta2,
44
+ moduleMap,
45
+ tag,
46
+ func,
47
+ args,
48
+ id,
49
+ queue,
50
+ wss,
51
+ ws
52
+ });
53
+ return await context.run(aop, (returnData) => {
54
+ if (!isEvent) ws.send(JSON.stringify({
55
+ id,
56
+ data: returnData
57
+ }));
58
+ }, (err) => {
59
+ if (!isEvent) ws.send(JSON.stringify({
60
+ id,
61
+ data: err,
62
+ error: true
63
+ }));
64
+ });
65
+ } catch (e) {
66
+ }
67
+ });
68
+ });
69
+ }
70
+ __name(bind, "bind");
71
+ export {
72
+ bind
73
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phecda-server",
3
- "version": "7.0.0-alpha.12",
3
+ "version": "7.0.0-alpha.13",
4
4
  "description": "server framework that provide IOC/type-reuse/http&rpc-adaptor",
5
5
  "author": "fgsreally",
6
6
  "license": "MIT",
@@ -74,6 +74,14 @@
74
74
  "require": "./dist/rpc/nats/index.js",
75
75
  "import": "./dist/rpc/nats/index.mjs"
76
76
  },
77
+ "./electron": {
78
+ "require": "./dist/rpc/electron/index.js",
79
+ "import": "./dist/rpc/electron/index.mjs"
80
+ },
81
+ "./ws": {
82
+ "require": "./dist/rpc/ws/index.js",
83
+ "import": "./dist/rpc/ws/index.mjs"
84
+ },
77
85
  "./register": "./register/index.mjs",
78
86
  "./*": "./*"
79
87
  },
@@ -160,8 +168,10 @@
160
168
  "@types/koa": "^2.13.12",
161
169
  "@types/koa__router": "^12.0.4",
162
170
  "@types/supertest": "^2.0.12",
171
+ "@types/ws": "^8.5.13",
163
172
  "amqplib": "^0.10.3",
164
173
  "bullmq": "^5.7.1",
174
+ "electron": "^33.2.1",
165
175
  "elysia": "^1.0.17",
166
176
  "express": "^4.18.2",
167
177
  "fastify": "^4.25.1",
@@ -178,7 +188,8 @@
178
188
  "supertest": "^6.3.3",
179
189
  "tsup": "^8.1.0",
180
190
  "typescript": "^5.7.2",
181
- "unimport": "^3.7.1"
191
+ "unimport": "^3.7.1",
192
+ "ws": "^8.18.0"
182
193
  },
183
194
  "scripts": {
184
195
  "dev": "tsup --watch",
@@ -16,7 +16,6 @@ const fileModelMap = new Map()
16
16
 
17
17
  port1.on('message', async (data) => {
18
18
  const { type, files } = JSON.parse(data)
19
-
20
19
  if (!isRunning || type === 'relaunch')
21
20
  return RELAUNCH()// file change -> relaunch
22
21
 
@@ -7,7 +7,6 @@ import {
7
7
  relative,
8
8
  resolve as resolvePath,
9
9
  } from 'path'
10
- import { existsSync } from 'fs'
11
10
  import { createRequire } from 'module'
12
11
  import ts from 'typescript'
13
12
  import chokidar from 'chokidar'
@@ -32,7 +31,6 @@ let unimportRet
32
31
  const dtsPath = process.env.PS_DTS_PATH || 'ps.d.ts'
33
32
 
34
33
  // graph
35
- let entryUrl
36
34
  const watchFiles = new Set()
37
35
  const filesRecord = new Map()
38
36
  const moduleGraph = {}
@@ -137,9 +135,12 @@ function addUrlToGraph(url, parent) {
137
135
  function getFileMid(file) {
138
136
  const filename = basename(file)
139
137
  const ret = filename.split('.')
140
- if (ret.length === 3)
141
- return ret[1]
142
- else return ''
138
+ if (!['js', 'mjs', 'cjs', 'ts', 'tsx', 'mts', 'cts'].includes(ret.pop()))
139
+ return ''
140
+ if (!ret[0])// .dockerfile
141
+ return ''
142
+
143
+ return ret[1]
143
144
  }
144
145
 
145
146
  export const resolve = async (specifier, context, nextResolve) => {
@@ -151,45 +152,12 @@ export const resolve = async (specifier, context, nextResolve) => {
151
152
  shortCircuit: true,
152
153
  }
153
154
  }
154
- // entrypoint
155
- if (!context.parentURL) {
156
- if (/^file:\/\/\//.test(specifier) && existsSync(fileURLToPath(specifier))) {
157
- entryUrl = specifier
155
+ // if (isAbsolute(specifier))
156
+ // specifier = pathToFileURL(specifier).href
158
157
 
159
- return {
160
- format: EXTENSIONS.some(ext => specifier.endsWith(ext))
161
- ? 'ts'
162
- : undefined,
163
- url: specifier,
164
- shortCircuit: true,
165
- }
166
- }
167
- else {
168
- // won't resolve virtual file as entry in vite
169
- return nextResolve(specifier)
170
- }
171
- }
172
- // url import
173
- // it seems useless
174
- // if (/^file:\/\/\//.test(specifier) && extname(specifier) === '.ts') {
175
- // const url = addUrlToGraph(specifier, context.parentURL.split('?')[0])
176
- // return {
177
- // format: 'ts',
178
- // url,
179
- // shortCircuit: true,
180
- // }
181
- // }
182
-
183
- // hmr import
184
- if (
185
- context.parentURL.includes('/node_modules/phecda-server')
186
- && isAbsolute(specifier)
187
- ) {
188
- specifier = relative(fileURLToPath(entryUrl), specifier)
189
- .replace(/\.ts$/, '')
190
- .slice(1)
191
- context.parentURL = entryUrl
192
- }
158
+ // entrypoint
159
+ if (!context.parentURL)
160
+ return nextResolve(specifier)
193
161
 
194
162
  // import/require from external library
195
163
  if (context.parentURL.includes('/node_modules/'))
@@ -261,6 +229,7 @@ export const load = async (url, context, nextLoad) => {
261
229
  }
262
230
 
263
231
  url = url.split('?')[0]
232
+
264
233
  if (
265
234
  !url.includes('/node_modules/')
266
235
  && url.startsWith('file://')
@@ -24,28 +24,28 @@ export async function compile(sourcecode, filename) {
24
24
 
25
25
  jsc: {
26
26
  parser: {
27
- syntax: "typescript",
27
+ syntax: 'typescript',
28
28
  importAttributes: true,
29
29
  decorators: true,
30
30
  tsx: false,
31
31
  dynamicImport: true,
32
- strictPropertyInitialization: false
32
+ strictPropertyInitialization: false,
33
33
  },
34
34
  experimental: {
35
- keepImportAssertions: true
35
+ keepImportAssertions: true,
36
36
  },
37
37
  transform: {
38
38
  legacyDecorator: true,
39
- decoratorMetadata: true
40
- }
39
+ decoratorMetadata: true,
40
+ },
41
41
  // parser: {
42
42
  // importAttributes: true
43
43
  // },
44
44
  // experimental: {
45
45
  // keepImportAssertions: true
46
46
  // }
47
- }
48
- }
47
+ },
48
+ },
49
49
  })
50
50
 
51
51
  return injectInlineSourceMap({ code, map })
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
- }