feat: optimize types ref

Signed-off-by: MiaoWoo <admin@yumc.pw>
clean
MiaoWoo 2020-03-01 20:28:16 +08:00
parent c10247e241
commit b3539d419e
22 changed files with 50 additions and 75 deletions

View File

@ -1,5 +1,3 @@
/// <reference types='@ms/nashorn' />
/**
* MiaoScript Event
*/

View File

@ -1,4 +1,4 @@
import "@ms/ployfill"
import "@ms/nashorn"
export * from './task'
export * from './event'
export * from './console'

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}

View File

@ -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) {

View File

@ -1,4 +1,3 @@
import '@ms/core'
/**
*
* Created by MiaoWoo on 2017/2/9 0009.

View File

@ -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"
}

View File

@ -1,6 +1,3 @@
/// <reference types="@ms/nashorn" />
import '@ms/i18n'
let containerStartTime = Date.now();
console.i18n("ms.core.ioc.initialize");
import { plugin, server, task } from '@ms/api'

View File

@ -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"
}

View File

@ -1,5 +1,4 @@
/// <reference types="@ms/types/dist/typings/nashorn" />
/// <reference types="@ms/ployfill" />
/// <reference types="@ms/nashorn" />
import * as yaml from 'js-yaml'
const File = Java.type("java.io.File");

View File

@ -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 { };

View File

@ -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"
}
}

View File

@ -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 { }

View File

@ -1,5 +1,5 @@
/// <reference path="./global.ts" />
/// <reference types='@ms/nashorn' />
/// <reference types="@ms/nashorn" />
import i18n from '@ms/i18n'
let ployfillStartTime = new Date().getTime();
i18n.initialize();

View File

@ -28,9 +28,8 @@
"typescript": "^3.8.3"
},
"dependencies": {
"@ms/plugin": "^0.3.0",
"axios": "^0.19.2",
"es6-map": "^0.1.5",
"inversify": "^5.0.1"
"@ms/api": "^0.3.0",
"@ms/container": "^0.3.0",
"@ms/plugin": "^0.3.0"
}
}

View File

@ -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"
}
}

View File

@ -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"
}

View File

@ -1 +1 @@
import '@ms/nashorn'
/// <reference types="@ms/nashorn" />

View File

@ -1,5 +1,3 @@
/// <reference types="@ms/ployfill" />
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'))

View File

@ -1,5 +1,3 @@
/// <reference types="@ms/ployfill" />
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')

View File

@ -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')