Commit 1af012d0 authored by nanahira's avatar nanahira

bump to Koishi 4.8

parent e9a47155
import { App } from 'koishi'; import { Context } from 'koishi';
import TargetPlugin from '../src'; import TargetPlugin from '../src';
import ConsolePlugin from '@koishijs/plugin-console'; import ConsolePlugin from '@koishijs/plugin-console';
import SandboxPlugin from '@koishijs/plugin-sandbox'; import SandboxPlugin from '@koishijs/plugin-sandbox';
import * as DatabasePlugin from '@koishijs/plugin-database-memory';
import CachePlugin from '@koishijs/plugin-cache-lru';
import ExtrasInDev from './extras'; import ExtrasInDev from './extras';
const app = new App({ const app = new Context({
port: 14514, port: 14514,
host: 'localhost', host: 'localhost',
prefix: '.', prefix: '.',
}); });
// Console and sandbox // Console and sandbox
app.plugin(SandboxPlugin);
app.plugin(ConsolePlugin, { app.plugin(ConsolePlugin, {
open: false, open: false,
}); });
app.plugin(SandboxPlugin);
// Some services
app.plugin(CachePlugin);
app.plugin(DatabasePlugin);
// Some extras // Some extras
app.plugin(ExtrasInDev); app.plugin(ExtrasInDev);
......
This diff is collapsed.
// import 'source-map-support/register'; // import 'source-map-support/register';
import { import {
DefinePlugin, DefinePlugin,
BasePlugin, StarterPlugin,
UseCommand, UseCommand,
CommandUsage, CommandUsage,
CommandExample, CommandExample,
...@@ -15,7 +15,7 @@ import { ping, NewPingResult } from 'minecraft-protocol'; ...@@ -15,7 +15,7 @@ import { ping, NewPingResult } from 'minecraft-protocol';
import { Logger, segment } from 'koishi'; import { Logger, segment } from 'koishi';
@DefinePlugin({ name: 'mcinfo' }) @DefinePlugin({ name: 'mcinfo' })
export default class MinecraftInfoPlugin extends BasePlugin<any> { export default class MinecraftInfoPlugin extends StarterPlugin() {
private getServerPrefix(result: NewPingResult) { private getServerPrefix(result: NewPingResult) {
let text = ''; let text = '';
if (result.favicon?.startsWith('data:image/png;base64,')) { if (result.favicon?.startsWith('data:image/png;base64,')) {
......
import { App } from 'koishi'; import { Context } from 'koishi';
import TargetPlugin from '../src'; import TargetPlugin from '../src';
describe('Test of plugin.', () => { describe('Test of plugin.', () => {
let app: App; let app: Context;
beforeEach(async () => { beforeEach(async () => {
app = new App(); app = new Context();
// app.plugin(TargetPlugin); // app.plugin(TargetPlugin);
await app.start(); await app.start();
}); });
......
const path = require('path'); const path = require('path');
const packgeInfo = require('./package.json'); const packgeInfo = require('./package.json');
const { ESBuildMinifyPlugin } = require('esbuild-loader');
function externalsFromDep() { function externalsFromDep() {
return Object.fromEntries( return Object.fromEntries(
...@@ -43,4 +44,11 @@ module.exports = { ...@@ -43,4 +44,11 @@ module.exports = {
koishi: 'koishi', koishi: 'koishi',
...(packAll ? {} : externalsFromDep()), ...(packAll ? {} : externalsFromDep()),
}, },
optimization: {
minimizer: [
new ESBuildMinifyPlugin({
keepNames: true,
}),
],
},
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment