diff --git a/packages/api/src/event.ts b/packages/api/src/event.ts index c2ba254a..8b2cb326 100644 --- a/packages/api/src/event.ts +++ b/packages/api/src/event.ts @@ -1,5 +1,3 @@ -/// - /** * MiaoScript Event处理类 */ diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index c1339bf7..b0104af1 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -1,4 +1,4 @@ -import "@ms/ployfill" +import "@ms/nashorn" export * from './task' export * from './event' export * from './console' diff --git a/packages/bukkit/package.json b/packages/bukkit/package.json index d931a2b0..a01b947f 100644 --- a/packages/bukkit/package.json +++ b/packages/bukkit/package.json @@ -29,7 +29,6 @@ "dependencies": { "@ms/api": "^0.3.0", "@ms/common": "^0.3.0", - "@ms/container": "^0.3.0", - "@ms/types": "^0.3.0" + "@ms/container": "^0.3.0" } } diff --git a/packages/bungee/package.json b/packages/bungee/package.json index ac758ae7..ad6e8d2f 100644 --- a/packages/bungee/package.json +++ b/packages/bungee/package.json @@ -29,7 +29,6 @@ "dependencies": { "@ms/api": "^0.3.0", "@ms/common": "^0.3.0", - "@ms/container": "^0.3.0", - "@ms/types": "^0.3.0" + "@ms/container": "^0.3.0" } } diff --git a/packages/common/package.json b/packages/common/package.json index c2f1dfe0..e4b01d40 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -27,8 +27,7 @@ "typescript": "^3.8.3" }, "dependencies": { - "@ms/nashorn": "^0.3.0", - "@ms/ployfill": "^0.3.0" + "@ms/nashorn": "^0.3.0" }, "gitHead": "562e2d00175c9d3a99c8b672aa07e6d92706a027" } diff --git a/packages/common/src/http.ts b/packages/common/src/http.ts index e609b387..bb7af2e0 100644 --- a/packages/common/src/http.ts +++ b/packages/common/src/http.ts @@ -1,5 +1,3 @@ -import '@ms/api' - const URL = Java.type('java.net.URL') const Paths = Java.type('java.nio.file.Paths'); const Files = Java.type('java.nio.file.Files'); @@ -37,7 +35,9 @@ function request(config: RequestConfig) { } function download(url: string, target: string) { + console.debug(`Start Download file ${target} from ${url}....`) Files.copy(new URL(url).openStream(), Paths.get(target), StandardCopyOption.REPLACE_EXISTING); + console.debug(`File ${target} Download Complate...`) } function _proxy(method: Method) { diff --git a/packages/common/src/reflect.ts b/packages/common/src/reflect.ts index c275736a..f111bfcb 100644 --- a/packages/common/src/reflect.ts +++ b/packages/common/src/reflect.ts @@ -1,4 +1,3 @@ -import '@ms/core' /** * 反射工具类 * Created by MiaoWoo on 2017/2/9 0009. diff --git a/packages/core/package.json b/packages/core/package.json index a6cf616f..50f90b2e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -28,11 +28,7 @@ }, "dependencies": { "@ms/api": "^0.3.0", - "@ms/bukkit": "^0.3.0", - "@ms/common": "^0.3.0", - "@ms/container": "^0.3.0", - "@ms/plugin": "^0.3.0", - "@ms/sponge": "^0.3.0" + "@ms/container": "^0.3.0" }, "gitHead": "781524f83e52cad26d7c480513e3c525df867121" } diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index edd84b6b..a9bd2eea 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,6 +1,3 @@ -/// -import '@ms/i18n' - let containerStartTime = Date.now(); console.i18n("ms.core.ioc.initialize"); import { plugin, server, task } from '@ms/api' diff --git a/packages/i18n/package.json b/packages/i18n/package.json index 07b6b40d..38c7966a 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -28,7 +28,8 @@ "typescript": "^3.8.3" }, "dependencies": { - "js-yaml": "^3.13.1" + "js-yaml": "^3.13.1", + "@ms/nashorn": "^0.3.0" }, "gitHead": "781524f83e52cad26d7c480513e3c525df867121" } diff --git a/packages/i18n/src/index.ts b/packages/i18n/src/index.ts index 1c0d269c..5b44ede5 100644 --- a/packages/i18n/src/index.ts +++ b/packages/i18n/src/index.ts @@ -1,5 +1,4 @@ -/// -/// +/// import * as yaml from 'js-yaml' const File = Java.type("java.io.File"); diff --git a/packages/nashorn/src/index.ts b/packages/nashorn/src/index.ts index 9c660108..94afa162 100644 --- a/packages/nashorn/src/index.ts +++ b/packages/nashorn/src/index.ts @@ -38,6 +38,37 @@ declare global { setPrototypeOf(obj: object, prototype: object); bindProperties(to: object, from: object); } + + namespace NodeJS { + interface Global { + logger: any; + debug: boolean; + level: string; + NashornEngineStartTime: number; + setGlobal: (key: string, value: any) => void; + noop: () => void; + console: Console; + } + } + var root: string; + var base: Core; + var ScriptEngineContextHolder: any; + function engineLoad(str: string): any; + interface Core { + getClass(name: String): any; + getProxyClass(): any; + getInstance(): any; + read(path: string): string; + save(path: string, content: string): void; + delete(path: string): void; + } + interface Console { + ex(err: Error): void; + stack(err: Error): string[]; + sender(...args: any): void; + console(...args: any): void; + i18n(name: string, ...params: any[]); + } } export { }; diff --git a/packages/nukkit/package.json b/packages/nukkit/package.json index 33353058..0291304c 100644 --- a/packages/nukkit/package.json +++ b/packages/nukkit/package.json @@ -29,7 +29,6 @@ "dependencies": { "@ms/api": "^0.3.0", "@ms/common": "^0.3.0", - "@ms/container": "^0.3.0", - "@ms/types": "^0.3.0" + "@ms/container": "^0.3.0" } } diff --git a/packages/ployfill/src/global.ts b/packages/ployfill/src/global.ts deleted file mode 100644 index baf41009..00000000 --- a/packages/ployfill/src/global.ts +++ /dev/null @@ -1,33 +0,0 @@ -declare global { - namespace NodeJS { - interface Global { - logger: any; - debug: boolean; - level: string; - NashornEngineStartTime: number; - setGlobal: (key: string, value: any) => void; - noop: () => void; - console: Console; - } - } - var root: string; - var base: Core; - var ScriptEngineContextHolder: any; - function engineLoad(str: string): any; - interface Core { - getClass(name: String): any; - getProxyClass(): any; - getInstance(): any; - read(path: string): string; - save(path: string, content: string): void; - delete(path: string): void; - } - interface Console { - ex(err: Error): void; - stack(err: Error): string[]; - sender(...args: any): void; - console(...args: any): void; - i18n(name: string, ...params: any[]); - } -} -export { } \ No newline at end of file diff --git a/packages/ployfill/src/index.ts b/packages/ployfill/src/index.ts index 276dea78..5cad9f24 100644 --- a/packages/ployfill/src/index.ts +++ b/packages/ployfill/src/index.ts @@ -1,5 +1,5 @@ -/// -/// +/// + import i18n from '@ms/i18n' let ployfillStartTime = new Date().getTime(); i18n.initialize(); diff --git a/packages/sponge/package.json b/packages/sponge/package.json index ebe07e0d..6e657789 100644 --- a/packages/sponge/package.json +++ b/packages/sponge/package.json @@ -29,7 +29,6 @@ "dependencies": { "@ms/api": "^0.3.0", "@ms/common": "^0.3.0", - "@ms/container": "^0.3.0", - "@ms/types": "^0.3.0" + "@ms/container": "^0.3.0" } } diff --git a/packages/websocket/package.json b/packages/websocket/package.json index 13e55505..2c045914 100644 --- a/packages/websocket/package.json +++ b/packages/websocket/package.json @@ -27,8 +27,7 @@ "typescript": "^3.8.3" }, "dependencies": { - "@ms/api": "^0.3.0", - "@ms/common": "^0.3.0" + "@ms/nashorn": "^0.3.0" }, "gitHead": "781524f83e52cad26d7c480513e3c525df867121" } diff --git a/packages/websocket/src/index.ts b/packages/websocket/src/index.ts index d1bccc19..19d4efa2 100644 --- a/packages/websocket/src/index.ts +++ b/packages/websocket/src/index.ts @@ -1 +1 @@ -import '@ms/nashorn' +/// diff --git a/packages/websocket/src/netty/httprequest.ts b/packages/websocket/src/netty/httprequest.ts index 4d8edc72..7942d180 100644 --- a/packages/websocket/src/netty/httprequest.ts +++ b/packages/websocket/src/netty/httprequest.ts @@ -1,5 +1,3 @@ -/// - const TypeParameterMatcher = Java.type('io.netty.util.internal.TypeParameterMatcher') const SimpleChannelInboundHandler = Java.type('io.netty.channel.SimpleChannelInboundHandler') const FullHttpRequestMatcher = TypeParameterMatcher.get(base.getClass('io.netty.handler.codec.http.FullHttpRequest')) diff --git a/packages/websocket/src/netty/text_websocket_frame.ts b/packages/websocket/src/netty/text_websocket_frame.ts index 88cf4022..c7760a28 100644 --- a/packages/websocket/src/netty/text_websocket_frame.ts +++ b/packages/websocket/src/netty/text_websocket_frame.ts @@ -1,5 +1,3 @@ -/// - const TypeParameterMatcher = Java.type('io.netty.util.internal.TypeParameterMatcher') const TextWebSocketFrameMatcher = TypeParameterMatcher.get(base.getClass('io.netty.handler.codec.http.websocketx.TextWebSocketFrame')) const SimpleChannelInboundHandler = Java.type('io.netty.channel.SimpleChannelInboundHandler') diff --git a/packages/websocket/src/netty/websocket.ts b/packages/websocket/src/netty/websocket.ts index f6648426..53692c4d 100644 --- a/packages/websocket/src/netty/websocket.ts +++ b/packages/websocket/src/netty/websocket.ts @@ -1,5 +1,3 @@ -import '@ms/api' - const MiaoWebSocket = 'miaowebsocket' const CharsetUtil = Java.type('io.netty.util.CharsetUtil') const ChannelInboundHandlerAdapter = Java.type('io.netty.channel.ChannelInboundHandlerAdapter')