node-karin 0.8.7 → 0.8.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.
@@ -0,0 +1 @@
1
+ export { default } from 'art-template';
@@ -0,0 +1 @@
1
+ export { default } from 'art-template'
@@ -0,0 +1,2 @@
1
+ export * from 'axios';
2
+ export { default } from 'axios';
@@ -0,0 +1,2 @@
1
+ export * from 'axios'
2
+ export { default } from 'axios'
@@ -0,0 +1,2 @@
1
+ export * from 'chalk';
2
+ export { default } from 'chalk';
@@ -0,0 +1,2 @@
1
+ export * from 'chalk'
2
+ export { default } from 'chalk'
@@ -0,0 +1,2 @@
1
+ export * from 'chokidar';
2
+ export { default } from 'chokidar';
@@ -0,0 +1,2 @@
1
+ export * from 'chokidar'
2
+ export { default } from 'chokidar'
@@ -0,0 +1,2 @@
1
+ export * from 'commander';
2
+ export { default } from 'commander';
@@ -0,0 +1,2 @@
1
+ export * from 'commander'
2
+ export { default } from 'commander'
@@ -0,0 +1,3 @@
1
+ import { query, Router } from 'express';
2
+ export { default } from 'express';
3
+ export { query, Router };
@@ -0,0 +1,3 @@
1
+ import { query, Router } from 'express'
2
+ export { default } from 'express'
3
+ export { query, Router }
@@ -0,0 +1,2 @@
1
+ export * from '@grpc/grpc-js';
2
+ export { default } from '@grpc/grpc-js';
@@ -0,0 +1,2 @@
1
+ export * from '@grpc/grpc-js'
2
+ export { default } from '@grpc/grpc-js'
@@ -0,0 +1,2 @@
1
+ export * from 'kritor-proto';
2
+ export { default } from 'kritor-proto';
@@ -0,0 +1,2 @@
1
+ export * from 'kritor-proto'
2
+ export { default } from 'kritor-proto'
@@ -0,0 +1,2 @@
1
+ export * from 'level';
2
+ export { default } from 'level';
@@ -0,0 +1,2 @@
1
+ export * from 'level'
2
+ export { default } from 'level'
@@ -0,0 +1 @@
1
+ export { default } from 'lodash';
@@ -0,0 +1 @@
1
+ export { default } from 'lodash'
@@ -0,0 +1,2 @@
1
+ export * from 'log4js';
2
+ export { default } from 'log4js';
@@ -0,0 +1,2 @@
1
+ export * from 'log4js'
2
+ export { default } from 'log4js'
@@ -0,0 +1 @@
1
+ export { default } from 'moment';
@@ -0,0 +1 @@
1
+ export { default } from 'moment'
@@ -0,0 +1,2 @@
1
+ export * from 'node-schedule';
2
+ export { default } from 'node-schedule';
@@ -0,0 +1,2 @@
1
+ export * from 'node-schedule'
2
+ export { default } from 'node-schedule'
@@ -0,0 +1,2 @@
1
+ export * from '@grpc/proto-loader';
2
+ export { default } from '@grpc/proto-loader';
@@ -0,0 +1,2 @@
1
+ export * from '@grpc/proto-loader'
2
+ export { default } from '@grpc/proto-loader'
@@ -0,0 +1,2 @@
1
+ export * from 'redis';
2
+ export { default } from 'redis';
@@ -0,0 +1,2 @@
1
+ export * from 'redis'
2
+ export { default } from 'redis'
@@ -0,0 +1,3 @@
1
+ import { WebSocket, WebSocketServer, createWebSocketStream } from 'ws';
2
+ export { WebSocket, WebSocketServer, createWebSocketStream };
3
+ export { default } from 'ws';
@@ -0,0 +1,3 @@
1
+ import { WebSocket, WebSocketServer, createWebSocketStream } from 'ws'
2
+ export { WebSocket, WebSocketServer, createWebSocketStream }
3
+ export { default } from 'ws'
@@ -0,0 +1,2 @@
1
+ export * from 'yaml';
2
+ export { default } from 'yaml';
@@ -0,0 +1,2 @@
1
+ export * from 'yaml'
2
+ export { default } from 'yaml'
@@ -33,9 +33,9 @@ export function Wormhole () {
33
33
  case 'msg': {
34
34
  const { post, token, WormholeClient } = config.Server.HttpRender
35
35
  const parsedUrl = new URL(WormholeClient)
36
- const { hostname, port } = parsedUrl
36
+ const { hostname, port, pathname } = parsedUrl
37
37
  const ishttps = WormholeClient.includes('wss://')
38
- const host = `${ishttps ? 'https' : 'http'}://${hostname}${port ? `:${port}` : ''}/web/${data.date}`
38
+ const host = `${ishttps ? 'https' : 'http'}://${hostname}${port ? `:${port}` : ''}${pathname.replace(/ws\/(?=[^ws/]*$)/, 'web/')}${data.date}`
39
39
  logger.mark(`web渲染器已连接,地址:${host}`)
40
40
  /** 注册渲染器 */
41
41
  const rd = new HttpRenderer(host, post, token)
@@ -420,22 +420,22 @@ class Common {
420
420
  return list
421
421
  } else {
422
422
  const list = []
423
- const readPackageJson = async (name) => {
423
+ const readPackageJson = async (files) => {
424
424
  try {
425
- const pkgPath = path.join(process.cwd(), 'node_modules', name, 'package.json')
425
+ const pkgPath = path.join(process.cwd(), 'node_modules', files, 'package.json')
426
426
  const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
427
427
  if (pkg?.karin) {
428
428
  if (pkg?.main) {
429
- const dir = `${name}/${path.dirname(pkg.main).replace(/\.\//, '')}`
429
+ const dir = `${files}/${path.dirname(pkg.main).replace(/\.\//, '')}`
430
430
  list.push({ dir, name: path.basename(pkg.main), isMain: true })
431
431
  }
432
432
  if (pkg?.karin?.apps?.length) {
433
433
  pkg.karin.apps.forEach((app) => {
434
- fs.readdirSync(`./node_modules/${name}/${app}`).forEach((name) => {
434
+ fs.readdirSync(`./node_modules/${files}/${app}`).forEach((filename) => {
435
435
  /** 忽略非js */
436
- if (!name.endsWith('.js')) { return }
437
- const dir = `${name}/${app}`
438
- list.push({ dir, name, isMain: false })
436
+ if (!filename.endsWith('.js')) { return }
437
+ const dir = `${files}/${app}`
438
+ list.push({ dir, name: filename, isMain: false })
439
439
  })
440
440
  })
441
441
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-karin",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "private": false,
5
5
  "description": "基于 Kritor 进行开发的nodejs机器人框架",
6
6
  "homepage": "https://github.com/KarinJS/Karin",
@@ -14,6 +14,98 @@
14
14
  "license": "GPL-3.0-only",
15
15
  "author": "Karin",
16
16
  "type": "module",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./lib/index.js",
20
+ "require": "./lib/index.js",
21
+ "types": "./lib/index.d.ts"
22
+ },
23
+ "./art-template": {
24
+ "import": "./lib/modules/art-template.js",
25
+ "require": "./lib/modules/art-template.js",
26
+ "types": "./lib/modules/art-template.d.ts"
27
+ },
28
+ "./axios": {
29
+ "import": "./lib/modules/axios.js",
30
+ "require": "./lib/modules/axios.js",
31
+ "types": "./lib/modules/axios.d.ts"
32
+ },
33
+ "./chalk": {
34
+ "import": "./lib/modules/chalk.js",
35
+ "require": "./lib/modules/chalk.js",
36
+ "types": "./lib/modules/chalk.d.ts"
37
+ },
38
+ "./chokidar": {
39
+ "import": "./lib/modules/chokidar.js",
40
+ "require": "./lib/modules/chokidar.js",
41
+ "types": "./lib/modules/chokidar.d.ts"
42
+ },
43
+ "./commander": {
44
+ "import": "./lib/modules/commander.js",
45
+ "require": "./lib/modules/commander.js",
46
+ "types": "./lib/modules/commander.d.ts"
47
+ },
48
+ "./express": {
49
+ "import": "./lib/modules/express.js",
50
+ "require": "./lib/modules/express.js",
51
+ "types": "./lib/modules/express.d.ts"
52
+ },
53
+ "./grpc-js": {
54
+ "import": "./lib/modules/grpc-js.js",
55
+ "require": "./lib/modules/grpc-js.js",
56
+ "types": "./lib/modules/grpc-js.d.ts"
57
+ },
58
+ "./kritor-proto": {
59
+ "import": "./lib/modules/kritor-proto.js",
60
+ "require": "./lib/modules/kritor-proto.js",
61
+ "types": "./lib/modules/kritor-proto.d.ts"
62
+ },
63
+ "./level": {
64
+ "import": "./lib/modules/level.js",
65
+ "require": "./lib/modules/level.js",
66
+ "types": "./lib/modules/level.d.ts"
67
+ },
68
+ "./lodash": {
69
+ "import": "./lib/modules/lodash.js",
70
+ "require": "./lib/modules/lodash.js",
71
+ "types": "./lib/modules/lodash.d.ts"
72
+ },
73
+ "./log4js": {
74
+ "import": "./lib/modules/log4js.js",
75
+ "require": "./lib/modules/log4js.js",
76
+ "types": "./lib/modules/log4js.d.ts"
77
+ },
78
+ "./moment": {
79
+ "import": "./lib/modules/moment.js",
80
+ "require": "./lib/modules/moment.js",
81
+ "types": "./lib/modules/moment.d.ts"
82
+ },
83
+ "./node-schedule": {
84
+ "import": "./lib/modules/node-schedule.js",
85
+ "require": "./lib/modules/node-schedule.js",
86
+ "types": "./lib/modules/node-schedule.d.ts"
87
+ },
88
+ "./proto-loader": {
89
+ "import": "./lib/modules/proto-loader.js",
90
+ "require": "./lib/modules/proto-loader.js",
91
+ "types": "./lib/modules/proto-loader.d.ts"
92
+ },
93
+ "./redis": {
94
+ "import": "./lib/modules/redis.js",
95
+ "require": "./lib/modules/redis.js",
96
+ "types": "./lib/modules/redis.d.ts"
97
+ },
98
+ "./ws": {
99
+ "import": "./lib/modules/ws.js",
100
+ "require": "./lib/modules/ws.js",
101
+ "types": "./lib/modules/ws.d.ts"
102
+ },
103
+ "./yaml": {
104
+ "import": "./lib/modules/yaml.js",
105
+ "require": "./lib/modules/yaml.js",
106
+ "types": "./lib/modules/yaml.d.ts"
107
+ }
108
+ },
17
109
  "main": "./lib/index.js",
18
110
  "types": "./lib/index.d.ts",
19
111
  "bin": {
@@ -40,7 +132,7 @@
40
132
  "fix": "eslint lib/**/*.js --fix",
41
133
  "fix:all": "eslint lib/**/*.js --fix && eslint lib/**/*.d.ts --fix",
42
134
  "pub": "npm publish --access public",
43
- "sort": "npx sort-package-json"
135
+ "sort": "npx sort-package-json && sort-json tsconfig.json"
44
136
  },
45
137
  "dependencies": {
46
138
  "@grpc/grpc-js": "1.11.1",
@@ -69,6 +161,7 @@
69
161
  "@types/ws": "^8.5.11",
70
162
  "eslint": "^9.7.0",
71
163
  "neostandard": "^0.11.1",
164
+ "sort-json": "^2.0.1",
72
165
  "sort-package-json": "^2.10.0",
73
166
  "tsc-alias": "^1.8.10",
74
167
  "tsx": "^4.16.2",