mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Add glue v4 typings
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import * as glue from "glue";
|
||||
import * as hapi from "hapi";
|
||||
|
||||
const manifest: glue.Manifest = {
|
||||
server: {
|
||||
debug: false,
|
||||
},
|
||||
connections: [
|
||||
{
|
||||
port: 8000,
|
||||
labels: ['web']
|
||||
},
|
||||
{
|
||||
port: 8001,
|
||||
labels: ['admin']
|
||||
}
|
||||
],
|
||||
registrations: [
|
||||
{
|
||||
plugin: {
|
||||
register: './assets',
|
||||
options: {
|
||||
uglify: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
plugin: './ui-user',
|
||||
options: {
|
||||
select: ['web']
|
||||
}
|
||||
},
|
||||
{
|
||||
plugin: {
|
||||
register: './ui-admin',
|
||||
options: {
|
||||
sessiontime: 500
|
||||
}
|
||||
},
|
||||
options: {
|
||||
select: ['admin'],
|
||||
routes: {
|
||||
prefix: '/admin'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
plugin: {
|
||||
register: require('./awesome-plugin.js'),
|
||||
options: {
|
||||
whyNot: true
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
const options: glue.Options = {
|
||||
relativeTo: `${__dirname}/modules`
|
||||
};
|
||||
|
||||
glue.compose(manifest, options, (err, server) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
server.start(() => {
|
||||
console.log('hapi days!');
|
||||
});
|
||||
});
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for glue 4.0
|
||||
// Project: https://github.com/hapijs/glue
|
||||
// Definitions by: Greg Jednaszewski <https://github.com/gjednaszewski>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { Server, ServerConnectionOptions, ServerOptions } from "hapi";
|
||||
|
||||
export interface Options {
|
||||
relativeTo: string;
|
||||
preConnections?: (Server: Server, next: (err: any) => void) => void;
|
||||
preRegister?: (Server: Server, next: (err: any) => void) => void;
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
plugin: string | {
|
||||
register: string;
|
||||
options?: any;
|
||||
};
|
||||
options?: any;
|
||||
}
|
||||
|
||||
export interface Manifest {
|
||||
server: ServerOptions;
|
||||
connections: ServerConnectionOptions[];
|
||||
registrations?: Plugin[];
|
||||
}
|
||||
|
||||
export function compose(manifest: Manifest,
|
||||
options?: Options,
|
||||
callback?: (err?: any, server?: Server) => void): Promise<Server>;
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"boom": [ "boom/v4" ],
|
||||
"catbox": [ "catbox/v7" ],
|
||||
"hapi": [ "hapi/v16" ],
|
||||
"glue": [ "glue/v4" ]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"glue-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user