Compare commits
6 Commits
v0.27.4
...
v0.28.0-be
| Author | SHA1 | Date | |
|---|---|---|---|
| 9126ec8035 | |||
| 23bc6068b5 | |||
| 27b428fbe2 | |||
| c07f1131c4 | |||
| 002f2c47c6 | |||
| 8633d9ea95 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,9 +1,9 @@
|
|||||||
.rollup.cache
|
|
||||||
.yarn*
|
.yarn*
|
||||||
.vscode
|
.vscode
|
||||||
.theia
|
.theia
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
packages/nashorn/docs
|
packages/nashorn/docs
|
||||||
!packages/types/dist
|
!packages/types/dist
|
||||||
|
|||||||
@@ -23,4 +23,3 @@ wallaby.js
|
|||||||
type_definitions
|
type_definitions
|
||||||
tsconfig.tsbuildinfo
|
tsconfig.tsbuildinfo
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
.rollup.cache
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
"ug": "yarn upgrade-interactive",
|
"ug": "yarn upgrade-interactive",
|
||||||
"np": "./script/push.sh",
|
"np": "./script/push.sh",
|
||||||
"lsp": "npm login -scope=@ccms",
|
"lsp": "npm login -scope=@ccms",
|
||||||
"lp": "lerna publish --verify-access --force-publish",
|
"lp": "lerna publish --force-publish",
|
||||||
"lpb": "lerna publish --preid beta --dist-tag beta --verify-access --force-publish",
|
"lpb": "lerna publish --preid beta --dist-tag beta --force-publish",
|
||||||
"lpc": "lerna publish --canary --preid beta --pre-dist-tag beta --verify-access --force-publish",
|
"lpc": "lerna publish --canary --preid beta --pre-dist-tag beta --force-publish",
|
||||||
"lpf": "lerna publish from-package --yes",
|
"lpf": "lerna publish from-package --yes",
|
||||||
"sync": "./script/sync.sh"
|
"sync": "./script/sync.sh"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/amqp",
|
"name": "@ccms/amqp",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript amqp package",
|
"description": "MiaoScript amqp package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -19,12 +19,12 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ccms/nashorn": "^0.27.4",
|
"@ccms/nashorn": "^0.28.0-beta.1",
|
||||||
"@javatypes/amqp-client": "^0.0.3",
|
"@javatypes/amqp-client": "^0.0.3",
|
||||||
"@javatypes/spring-amqp": "^0.0.3",
|
"@javatypes/spring-amqp": "^0.0.3",
|
||||||
"@javatypes/spring-rabbit": "^0.0.3",
|
"@javatypes/spring-rabbit": "^0.0.3",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/api",
|
"name": "@ccms/api",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript api package",
|
"description": "MiaoScript api package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -19,9 +19,9 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4",
|
"@ccms/container": "^0.28.0-beta.1",
|
||||||
"@ccms/polyfill": "^0.27.4",
|
"@ccms/polyfill": "^0.28.0-beta.1",
|
||||||
"base64-js": "^1.5.1",
|
"base64-js": "^1.5.1",
|
||||||
"source-map-builder": "^0.0.7"
|
"source-map-builder": "^0.0.7"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ export namespace event {
|
|||||||
if (!plugin || !plugin.description || !plugin.description.name) throw new TypeError(i18n.translate("ms.api.event.listen.plugin.name.empty"))
|
if (!plugin || !plugin.description || !plugin.description.name) throw new TypeError(i18n.translate("ms.api.event.listen.plugin.name.empty"))
|
||||||
var name = plugin.description.name
|
var name = plugin.description.name
|
||||||
var eventCls = this.name2Class(name, event)
|
var eventCls = this.name2Class(name, event)
|
||||||
if (!eventCls) { return }
|
if (!eventCls) { return () => { console.warn('event ' + event + ' not found ignore off listener.') } }
|
||||||
if (typeof priority === 'boolean') {
|
if (typeof priority === 'boolean') {
|
||||||
ignoreCancel = priority
|
ignoreCancel = priority
|
||||||
priority = EventPriority.NORMAL
|
priority = EventPriority.NORMAL
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
export namespace service {
|
|
||||||
export class ServiceManager {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/bukkit",
|
"name": "@ccms/bukkit",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript bukkit package",
|
"description": "MiaoScript bukkit package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/bungee",
|
"name": "@ccms/bungee",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript bungee package",
|
"description": "MiaoScript bungee package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/common",
|
"name": "@ccms/common",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript common package",
|
"description": "MiaoScript common package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ccms/nashorn": "^0.27.4",
|
"@ccms/nashorn": "^0.28.0-beta.1",
|
||||||
"@javatypes/jdk": "^0.0.3",
|
"@javatypes/jdk": "^0.0.3",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rimraf": "^4.1.2",
|
"rimraf": "^4.1.2",
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function declaredField(clazz: java.lang.Class<any>, name: string | java.lang.Str
|
|||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (target === undefined) { break }
|
if (target === undefined) { break }
|
||||||
target = target.getSuperclass()
|
target = target.getSuperclass()
|
||||||
console.debug(`切换到超类: ${target.getName()}`)
|
console.debug(`switch to super class: ${target.getName()}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (field === null) {
|
if (field === null) {
|
||||||
@@ -174,7 +174,7 @@ function declaredMethod(clazz: java.lang.Class<any>, nameOrIndex: string | numbe
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (target === undefined) { break }
|
if (target === undefined) { break }
|
||||||
target = target.getSuperclass()
|
target = target.getSuperclass()
|
||||||
console.debug(`切换到超类: ${target.getName()}`)
|
console.debug(`switch to super class: ${target.getName()}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ function declaredMethods(clazz: java.lang.Class<any>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mapToObject(javaObj) {
|
function mapToObject(javaObj) {
|
||||||
if (!Java.isJavaObject(javaObj)) { throw new TypeError(`参数 ${javaObj} 不是一个Java对象!`) }
|
if (!Java.isJavaObject(javaObj)) { throw new TypeError(`argument ${javaObj} is not a java object.`) }
|
||||||
let target = Proxy.newProxy(javaObj, {
|
let target = Proxy.newProxy(javaObj, {
|
||||||
apply: (target, name, args) => { return args ? javaObj[name](args) : javaObj[name]() }
|
apply: (target, name, args) => { return args ? javaObj[name](args) : javaObj[name]() }
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/compile",
|
"name": "@ccms/compile",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript compile package",
|
"description": "MiaoScript compile package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/container",
|
"name": "@ccms/container",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript container package",
|
"description": "MiaoScript container package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ccms/nashorn": "^0.27.4",
|
"@ccms/nashorn": "^0.28.0-beta.1",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rimraf": "^4.1.2",
|
"rimraf": "^4.1.2",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
|
|||||||
@@ -156,7 +156,8 @@ function initAutowired(container: Container) {
|
|||||||
var metadata: any = reduceMetadata(ctx)
|
var metadata: any = reduceMetadata(ctx)
|
||||||
let key = Object.prototype.toString.call(metadata.named)
|
let key = Object.prototype.toString.call(metadata.named)
|
||||||
if (key === "[object Function]" || key === "[object Symbol]") { return container.get(metadata.named) }
|
if (key === "[object Function]" || key === "[object Symbol]") { return container.get(metadata.named) }
|
||||||
console.warn('container autowired', metadata.named, 'failed. Error: illegal serviceIdentifier type', key)
|
console.warn('container Autowired', metadata.named, 'failed. Error: illegal serviceIdentifier type', key)
|
||||||
|
console.debug(metadata.named, 'metadata', JSON.stringify(metadata))
|
||||||
return undefined
|
return undefined
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/core",
|
"name": "@ccms/core",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript core package",
|
"description": "MiaoScript core package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -24,8 +24,8 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
},
|
},
|
||||||
"gitHead": "781524f83e52cad26d7c480513e3c525df867121"
|
"gitHead": "781524f83e52cad26d7c480513e3c525df867121"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/database",
|
"name": "@ccms/database",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript database package",
|
"description": "MiaoScript database package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/i18n",
|
"name": "@ccms/i18n",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript i18n package",
|
"description": "MiaoScript i18n package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ccms/nashorn": "^0.27.4",
|
"@ccms/nashorn": "^0.28.0-beta.1",
|
||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rimraf": "^4.1.2",
|
"rimraf": "^4.1.2",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/keyvalue",
|
"name": "@ccms/keyvalue",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript keyvalue package",
|
"description": "MiaoScript keyvalue package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -19,12 +19,12 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ccms/nashorn": "^0.27.4",
|
"@ccms/nashorn": "^0.28.0-beta.1",
|
||||||
"@javatypes/amqp-client": "^0.0.3",
|
"@javatypes/amqp-client": "^0.0.3",
|
||||||
"@javatypes/spring-amqp": "^0.0.3",
|
"@javatypes/spring-amqp": "^0.0.3",
|
||||||
"@javatypes/spring-rabbit": "^0.0.3",
|
"@javatypes/spring-rabbit": "^0.0.3",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/molang",
|
"name": "@ccms/molang",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "A fast parser for Minecraft's MoLang",
|
"description": "A fast parser for Minecraft's MoLang",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/nashorn",
|
"name": "@ccms/nashorn",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript nashorn package",
|
"description": "MiaoScript nashorn package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/nodejs",
|
"name": "@ccms/nodejs",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript nodejs package",
|
"description": "MiaoScript nodejs package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ccms/nashorn": "^0.27.4",
|
"@ccms/nashorn": "^0.28.0-beta.1",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rimraf": "^4.1.2",
|
"rimraf": "^4.1.2",
|
||||||
"tslib": "^2.5.0",
|
"tslib": "^2.5.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/nukkit",
|
"name": "@ccms/nukkit",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript nukkit package",
|
"description": "MiaoScript nukkit package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/plugin",
|
"name": "@ccms/plugin",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript plugin package",
|
"description": "MiaoScript plugin package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -26,10 +26,10 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4",
|
"@ccms/container": "^0.28.0-beta.1",
|
||||||
"@ccms/i18n": "^0.27.4",
|
"@ccms/i18n": "^0.28.0-beta.1",
|
||||||
"@ccms/verify": "^0.25.1",
|
"@ccms/verify": "^0.25.1",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"js-yaml": "^4.1.0"
|
"js-yaml": "^4.1.0"
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export class PluginEventManager {
|
|||||||
let off = () => {
|
let off = () => {
|
||||||
if (off['offed']) return
|
if (off['offed']) return
|
||||||
off['offed'] = true
|
off['offed'] = true
|
||||||
execes.forEach((off: () => any) => off())
|
execes.forEach((exec: { off: () => void }) => exec.off())
|
||||||
}
|
}
|
||||||
listener.off = off
|
listener.off = off
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/polyfill",
|
"name": "@ccms/polyfill",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript polyfill package",
|
"description": "MiaoScript polyfill package",
|
||||||
"author": "MiaoWoo <admin@yumc.pw>",
|
"author": "MiaoWoo <admin@yumc.pw>",
|
||||||
"homepage": "https://github.com/circlecloud/ms.git",
|
"homepage": "https://github.com/circlecloud/ms.git",
|
||||||
@@ -14,12 +14,12 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1"
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/i18n": "^0.27.4",
|
"@ccms/i18n": "^0.28.0-beta.1",
|
||||||
"@ccms/nodejs": "^0.27.4",
|
"@ccms/nodejs": "^0.28.0-beta.1",
|
||||||
"core-js": "^3.27.2"
|
"core-js": "^3.27.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ccms/nashorn": "^0.27.4",
|
"@ccms/nashorn": "^0.28.0-beta.1",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rimraf": "^4.1.2",
|
"rimraf": "^4.1.2",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/protocol",
|
"name": "@ccms/protocol",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript protocol package",
|
"description": "MiaoScript protocol package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/qrcode",
|
"name": "@ccms/qrcode",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript qrcode package",
|
"description": "MiaoScript qrcode package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/sponge",
|
"name": "@ccms/sponge",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript sponge package",
|
"description": "MiaoScript sponge package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/spring",
|
"name": "@ccms/spring",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript spring package",
|
"description": "MiaoScript spring package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/common": "^0.27.4",
|
"@ccms/common": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4",
|
"@ccms/container": "^0.28.0-beta.1",
|
||||||
"@ccms/database": "^0.27.4"
|
"@ccms/database": "^0.28.0-beta.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/web",
|
"name": "@ccms/web",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript web package",
|
"description": "MiaoScript web package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ccms/api": "^0.27.4",
|
"@ccms/api": "^0.28.0-beta.1",
|
||||||
"@ccms/container": "^0.27.4"
|
"@ccms/container": "^0.28.0-beta.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ccms/websocket",
|
"name": "@ccms/websocket",
|
||||||
"version": "0.27.4",
|
"version": "0.28.0-beta.1",
|
||||||
"description": "MiaoScript websocket package",
|
"description": "MiaoScript websocket package",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"miaoscript",
|
"miaoscript",
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"parseuri": "^0.0.6"
|
"parseuri": "^0.0.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ccms/nashorn": "^0.27.4",
|
"@ccms/nashorn": "^0.28.0-beta.1",
|
||||||
"@javatypes/tomcat-websocket-api": "^0.0.3",
|
"@javatypes/tomcat-websocket-api": "^0.0.3",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rimraf": "^4.1.2",
|
"rimraf": "^4.1.2",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { EventEmitter } from 'events'
|
import { EventEmitter } from 'events'
|
||||||
import { Transport } from './transport'
|
import { Transport } from './transport'
|
||||||
import { CloseEvent, ErrorEvent, Event, EventType, MessageEvent, WebSocketHeader } from './interface'
|
import { ClientEvent, CloseEvent, ErrorEvent, Event, EventType, MessageEvent, WebSocketHeader } from './interface'
|
||||||
|
|
||||||
export class WebSocketManager {
|
export class WebSocketManager {
|
||||||
private clients = new Map<string, WebSocket>()
|
private clients = new Map<string, WebSocket>()
|
||||||
@@ -18,7 +18,9 @@ export class WebSocketManager {
|
|||||||
add(client: WebSocket) {
|
add(client: WebSocket) {
|
||||||
this.clients.set(client.id, client)
|
this.clients.set(client.id, client)
|
||||||
}
|
}
|
||||||
|
|
||||||
del(client: WebSocket) {
|
del(client: WebSocket) {
|
||||||
|
client.removeAllListeners()
|
||||||
this.clients.delete(client.id)
|
this.clients.delete(client.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,16 +54,7 @@ export class WebSocket extends EventEmitter {
|
|||||||
console.ex(error)
|
console.ex(error)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.client.on('open', (event) => {
|
manager.add(this)
|
||||||
this.onopen?.(event)
|
|
||||||
manager.add(this)
|
|
||||||
})
|
|
||||||
this.client.on('message', (event) => this.onmessage?.(event))
|
|
||||||
this.client.on('close', (event) => {
|
|
||||||
this.onclose?.(event)
|
|
||||||
manager.del(this)
|
|
||||||
})
|
|
||||||
this.client.on('error', (event) => this.onerror?.(event))
|
|
||||||
setTimeout(() => this.client.connect(), 20)
|
setTimeout(() => this.client.connect(), 20)
|
||||||
}
|
}
|
||||||
get id() {
|
get id() {
|
||||||
@@ -82,21 +75,25 @@ export class WebSocket extends EventEmitter {
|
|||||||
get url() {
|
get url() {
|
||||||
return this._url
|
return this._url
|
||||||
}
|
}
|
||||||
public onopen: (event: Event) => void
|
set onopen(func: (event: Event) => void) {
|
||||||
public onmessage: (event: MessageEvent) => void
|
this.client.on(ClientEvent.open, func)
|
||||||
public onclose: (event: CloseEvent) => void
|
}
|
||||||
public onerror: (event: ErrorEvent) => void
|
set onmessage(func: (event: MessageEvent) => void) {
|
||||||
|
this.client.on(ClientEvent.message, func)
|
||||||
addEventListener(event: EventType, callback: () => void) {
|
}
|
||||||
this[`on${event.toLowerCase()}`] = callback
|
set onclose(func: (event: CloseEvent) => void) {
|
||||||
this.client.on(event, callback)
|
this.client.on(ClientEvent.close, func)
|
||||||
|
manager.del(this)
|
||||||
|
}
|
||||||
|
set onerror(func: (event: ErrorEvent) => void) {
|
||||||
|
this.client.on(ClientEvent.error, func)
|
||||||
}
|
}
|
||||||
public send(data: any) {
|
public send(data: any) {
|
||||||
this.client.send(data)
|
this.client.send(data)
|
||||||
}
|
}
|
||||||
public close(code?: number, reason?: string) {
|
public close(code?: number, reason?: string) {
|
||||||
this.client.close(code, reason)
|
this.client.close(code, reason)
|
||||||
this.removeAllListeners()
|
manager.del(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
global.setGlobal('WebSocket', WebSocket)
|
global.setGlobal('WebSocket', WebSocket)
|
||||||
|
|||||||
@@ -4,10 +4,18 @@ export interface WebSocketHeader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type EventType =
|
export type EventType =
|
||||||
| 'close'
|
| ClientEvent.open
|
||||||
| 'error'
|
| ClientEvent.message
|
||||||
| 'message'
|
| ClientEvent.close
|
||||||
| 'open'
|
| ClientEvent.error
|
||||||
|
|
||||||
|
export enum ClientEvent {
|
||||||
|
open = 'open',
|
||||||
|
message = 'message',
|
||||||
|
close = 'close',
|
||||||
|
error = 'error',
|
||||||
|
}
|
||||||
|
|
||||||
export interface Event {
|
export interface Event {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export class WebSocketClientHandler extends WebSocketClientHandlerAdapter {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
handlerAdded(ctx: any) {
|
handlerAdded(ctx: any) {
|
||||||
console.debug(`${ctx} handlerAdded`)
|
|
||||||
if (ctx.newPromise) {
|
if (ctx.newPromise) {
|
||||||
this.handshakeFuture = ctx.newPromise()
|
this.handshakeFuture = ctx.newPromise()
|
||||||
} else {
|
} else {
|
||||||
@@ -28,15 +27,14 @@ export class WebSocketClientHandler extends WebSocketClientHandlerAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
channelActive(ctx: any) {
|
channelActive(ctx: any) {
|
||||||
console.debug(`${ctx} channelActive`)
|
|
||||||
this.handshaker.handshake(ctx.channel())
|
this.handshaker.handshake(ctx.channel())
|
||||||
}
|
}
|
||||||
channelInactive(ctx: any) {
|
channelInactive(ctx: any) {
|
||||||
console.debug(`${ctx} channelInactive`)
|
if (this.client.readyStatus != WebSocket.CLOSED) {
|
||||||
this.client.onclose({ code: 0, reason: 'client connection channel inactive!' })
|
this.client.onclose({ code: 1006, reason: 'client connection channel inactive.' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
channelRead0(ctx: any, msg: any) {
|
channelRead0(ctx: any, msg: any) {
|
||||||
console.trace(`${ctx} channelRead0 ${msg}`)
|
|
||||||
let ch = ctx.channel()
|
let ch = ctx.channel()
|
||||||
if (!this.handshaker.isHandshakeComplete()) {
|
if (!this.handshaker.isHandshakeComplete()) {
|
||||||
// web socket client connected
|
// web socket client connected
|
||||||
@@ -54,7 +52,7 @@ export class WebSocketClientHandler extends WebSocketClientHandlerAdapter {
|
|||||||
if (frame instanceof TextWebSocketFrame) {
|
if (frame instanceof TextWebSocketFrame) {
|
||||||
this.client.onmessage({ data: frame.text() })
|
this.client.onmessage({ data: frame.text() })
|
||||||
} else if (frame instanceof CloseWebSocketFrame) {
|
} else if (frame instanceof CloseWebSocketFrame) {
|
||||||
this.client.onclose({ code: 0, reason: 'server close connection!' })
|
this.client.close(1000, 'server close connection.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exceptionCaught(ctx: any, cause: Error) {
|
exceptionCaught(ctx: any, cause: Error) {
|
||||||
|
|||||||
@@ -85,10 +85,7 @@ export class NettyWebSocket extends Transport {
|
|||||||
console.debug(`constructor NettyWebSocket url: ${url} scheme: ${this._schema} host: ${this._host} port: ${this._port} header: ${JSON.stringify(headers)}`)
|
console.debug(`constructor NettyWebSocket url: ${url} scheme: ${this._schema} host: ${this._host} port: ${this._port} header: ${JSON.stringify(headers)}`)
|
||||||
}
|
}
|
||||||
getId() {
|
getId() {
|
||||||
if (this.channel?.id) {
|
return `${this.channel?.id()}` || `NettyWebSocket#${channelCount.incrementAndGet()}`
|
||||||
return this.channel?.id() + ''
|
|
||||||
}
|
|
||||||
return 'NettyWebSocket#' + channelCount.incrementAndGet()
|
|
||||||
}
|
}
|
||||||
doConnect() {
|
doConnect() {
|
||||||
console.debug('client NettyWebSocket doConnect', this._url)
|
console.debug('client NettyWebSocket doConnect', this._url)
|
||||||
@@ -147,8 +144,9 @@ export class NettyWebSocket extends Transport {
|
|||||||
}
|
}
|
||||||
doClose(code: number, reason: string) {
|
doClose(code: number, reason: string) {
|
||||||
this.channel.writeAndFlush(new CloseWebSocketFrame())
|
this.channel.writeAndFlush(new CloseWebSocketFrame())
|
||||||
this.channel.close()
|
this.channel.closeFuture().addListener(new ChannelFutureListener(() => {
|
||||||
this.channel.closeFuture().addListener(new ChannelFutureListener(() => console.debug(`NettyWebSocket close code: ${code} reason: ${reason}`)))
|
this.onclose({ code, reason })
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
getChannel() {
|
getChannel() {
|
||||||
return this.channel
|
return this.channel
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EventEmitter } from 'events'
|
import { EventEmitter } from 'events'
|
||||||
import { WebSocket } from './index'
|
import { WebSocket } from './index'
|
||||||
import { CloseEvent, ErrorEvent, Event, MessageEvent, WebSocketHeader } from './interface'
|
import { ClientEvent, CloseEvent, ErrorEvent, Event, MessageEvent, WebSocketHeader } from './interface'
|
||||||
|
|
||||||
export abstract class Transport extends EventEmitter {
|
export abstract class Transport extends EventEmitter {
|
||||||
protected _url: string
|
protected _url: string
|
||||||
@@ -32,7 +32,6 @@ export abstract class Transport extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect() {
|
connect() {
|
||||||
console.debug(`client Transport connect`)
|
|
||||||
try {
|
try {
|
||||||
this.doConnect()
|
this.doConnect()
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@@ -49,19 +48,16 @@ export abstract class Transport extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
close(code: number = 0, reason: string = '') {
|
close(code: number = 1000, reason: string = '') {
|
||||||
if (this.readyStatus != WebSocket.CLOSING && this.readyStatus != WebSocket.CLOSED) {
|
if (this.readyStatus < WebSocket.CLOSING) {
|
||||||
this.readyStatus = WebSocket.CLOSING
|
this.readyStatus = WebSocket.CLOSING
|
||||||
try {
|
try {
|
||||||
this.onclose({ code, reason })
|
|
||||||
this.doClose(code, reason)
|
this.doClose(code, reason)
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
this.onerror({ error })
|
this.onerror({ error })
|
||||||
} finally {
|
|
||||||
this.removeAllListeners()
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.debug(`${this.id} call close but state is ${this.readyStatus}`)
|
console.debug(`WebSocket Transport ${this.id} call close code ${code} reason ${reason} but state is ${this.readyStatus}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,31 +69,31 @@ export abstract class Transport extends EventEmitter {
|
|||||||
onconnect(event: Event) {
|
onconnect(event: Event) {
|
||||||
if (this.readyStatus != WebSocket.OPEN) {
|
if (this.readyStatus != WebSocket.OPEN) {
|
||||||
this.readyStatus = WebSocket.OPEN
|
this.readyStatus = WebSocket.OPEN
|
||||||
this.emit('open', event)
|
this.emit(ClientEvent.open, event)
|
||||||
} else {
|
} else {
|
||||||
console.debug(`${this.id} call onconnect but state is ${this.readyStatus}`)
|
console.debug(`WebSocket Transport ${this.id} call onconnect but state is ${this.readyStatus}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onmessage(event: MessageEvent) {
|
onmessage(event: MessageEvent) {
|
||||||
this.emit('message', event)
|
this.emit(ClientEvent.message, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
onerror(event: ErrorEvent) {
|
onerror(event: ErrorEvent) {
|
||||||
this.emit('error', event)
|
this.emit(ClientEvent.error, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
onclose(event: CloseEvent) {
|
onclose(event: CloseEvent) {
|
||||||
if (this.readyStatus != WebSocket.CLOSED) {
|
if (this.readyStatus != WebSocket.CLOSED) {
|
||||||
this.readyStatus = WebSocket.CLOSED
|
this.readyStatus = WebSocket.CLOSED
|
||||||
this.emit('close', event)
|
this.emit(ClientEvent.close, event)
|
||||||
this.removeAllListeners()
|
|
||||||
} else {
|
} else {
|
||||||
console.debug(`${this.id} call onclose but state is ${this.readyStatus} CloseEvent[code: ${event.code}, reason: ${event.reason}]`)
|
console.debug(`WebSocket Transport ${this.id} call onclose but state is ${this.readyStatus} CloseEvent[code: ${event.code}, reason: ${event.reason}]`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
abstract getId()
|
|
||||||
abstract doConnect()
|
abstract getId(): string
|
||||||
abstract doSend(text: string)
|
abstract doConnect(): void
|
||||||
abstract doClose(code: number, reason: string)
|
abstract doSend(text: string): void
|
||||||
|
abstract doClose(code: number, reason: string): void
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/// <reference types="@ccms/nashorn" />
|
/// <reference types="@ccms/nashorn" />
|
||||||
/// <reference types="@javatypes/tomcat-websocket-api" />
|
/// <reference types="@javatypes/tomcat-websocket-api" />
|
||||||
|
|
||||||
import * as server from './server'
|
import { WebSocketServer } from './server'
|
||||||
import { Server, ServerOptions } from './socket.io'
|
import { Server, ServerOptions } from './socket.io'
|
||||||
|
|
||||||
interface SocketIOStatic {
|
interface SocketIOStatic {
|
||||||
@@ -45,7 +45,7 @@ let singletonServer: Server
|
|||||||
let io: SocketStatic = function io(pipeline: any, options: Partial<JavaServerOptions>, singleton = true) {
|
let io: SocketStatic = function io(pipeline: any, options: Partial<JavaServerOptions>, singleton = true) {
|
||||||
if (singleton) {
|
if (singleton) {
|
||||||
if (!singletonServer) {
|
if (!singletonServer) {
|
||||||
singletonServer = new Server(server.attach(pipeline, options), options)
|
singletonServer = new Server(WebSocketServer.attach(pipeline, options), options)
|
||||||
process.emit('websocket.create', singletonServer)
|
process.emit('websocket.create', singletonServer)
|
||||||
process.on('exit', () => {
|
process.on('exit', () => {
|
||||||
singletonServer.close()
|
singletonServer.close()
|
||||||
@@ -53,7 +53,7 @@ let io: SocketStatic = function io(pipeline: any, options: Partial<JavaServerOpt
|
|||||||
}
|
}
|
||||||
return singletonServer
|
return singletonServer
|
||||||
}
|
}
|
||||||
return new Server(server.attach(pipeline, options), options)
|
return new Server(WebSocketServer.attach(pipeline, options), options)
|
||||||
}
|
}
|
||||||
io.Instance = Symbol("@ccms/websocket")
|
io.Instance = Symbol("@ccms/websocket")
|
||||||
export default io
|
export default io
|
||||||
|
|||||||
@@ -26,6 +26,24 @@ export abstract class WebSocketServer extends EventEmitter {
|
|||||||
protected instance: any
|
protected instance: any
|
||||||
protected options: JavaServerOptions
|
protected options: JavaServerOptions
|
||||||
private clients: Map<string, WebSocketClient>
|
private clients: Map<string, WebSocketClient>
|
||||||
|
|
||||||
|
public static attach(instance, options) {
|
||||||
|
if (!instance) { throw new Error('instance can\'t be undefiend!') }
|
||||||
|
options = Object.assign({
|
||||||
|
event: new EventEmitter(),
|
||||||
|
path: '/ws',
|
||||||
|
root: root + Java.type("java.io.File").separatorChar + 'wwwroot',
|
||||||
|
}, options)
|
||||||
|
let WebSocketServerImpl = undefined
|
||||||
|
if (instance.class.name.startsWith('io.netty.channel')) {
|
||||||
|
WebSocketServerImpl = require("./netty").NettyWebSocketServer
|
||||||
|
} else {
|
||||||
|
WebSocketServerImpl = require("./tomcat").TomcatWebSocketServer
|
||||||
|
}
|
||||||
|
console.debug('create websocket server from ' + WebSocketServerImpl.name)
|
||||||
|
return new WebSocketServerImpl(instance, options)
|
||||||
|
}
|
||||||
|
|
||||||
constructor(instance: any, options: JavaServerOptions) {
|
constructor(instance: any, options: JavaServerOptions) {
|
||||||
super()
|
super()
|
||||||
this.instance = instance
|
this.instance = instance
|
||||||
@@ -69,20 +87,3 @@ export abstract class WebSocketServer extends EventEmitter {
|
|||||||
protected abstract getSocket(handler: any): WebSocketClient
|
protected abstract getSocket(handler: any): WebSocketClient
|
||||||
protected abstract doClose(): void
|
protected abstract doClose(): void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const attach = (instance, options) => {
|
|
||||||
if (!instance) { throw new Error('instance can\'t be undefiend!') }
|
|
||||||
options = Object.assign({
|
|
||||||
event: new EventEmitter(),
|
|
||||||
path: '/ws',
|
|
||||||
root: root + Java.type("java.io.File").separatorChar + 'wwwroot',
|
|
||||||
}, options)
|
|
||||||
let WebSocketServerImpl = undefined
|
|
||||||
if (instance.class.name.startsWith('io.netty.channel')) {
|
|
||||||
WebSocketServerImpl = require("./netty").NettyWebSocketServer
|
|
||||||
} else {
|
|
||||||
WebSocketServerImpl = require("./tomcat").TomcatWebSocketServer
|
|
||||||
}
|
|
||||||
console.debug('create websocket server from ' + WebSocketServerImpl.name)
|
|
||||||
return new WebSocketServerImpl(instance, options)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
DISTTAG=${1:latest}
|
||||||
for package in `ls packages`; do
|
for package in `ls packages`; do
|
||||||
echo $package
|
echo $package
|
||||||
pushd packages/$package
|
pushd packages/$package
|
||||||
npm publish --access=public --registry https://registry.npmjs.org
|
npm publish --tag ${DISTTAG} --access=public --registry https://registry.npmjs.org
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
for PACKAGE in `ls packages`;do
|
for PACKAGE in `ls packages`;do
|
||||||
echo "${PACKAGE} $(curl -s "https://registry-direct.npmmirror.com/@ccms/${PACKAGE}/sync?sync_upstream=true" -X 'PUT')"
|
echo "${PACKAGE} $(curl -s "https://registry-direct.npmmirror.com/@ccms/${PACKAGE}/sync?sync_upstream=true" -X 'PUT')"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user