mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
include esclusions typings
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
import historyApiFallback = require('connect-history-api-fallback-exclusions');
|
||||
import express = require('express');
|
||||
|
||||
const app = express();
|
||||
app.use(historyApiFallback());
|
||||
|
||||
historyApiFallback({
|
||||
verbose: true
|
||||
});
|
||||
|
||||
historyApiFallback({
|
||||
logger: console.log.bind(console)
|
||||
});
|
||||
|
||||
historyApiFallback({
|
||||
rewrites: [
|
||||
{ from: /\/soccer/, to: '/soccer.html' }
|
||||
]
|
||||
});
|
||||
|
||||
historyApiFallback({
|
||||
index: 'default.html'
|
||||
});
|
||||
|
||||
historyApiFallback({
|
||||
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml']
|
||||
});
|
||||
|
||||
historyApiFallback({
|
||||
rewrites: [
|
||||
{
|
||||
from: /^\/libs\/(.*)$/,
|
||||
to(context) {
|
||||
return './bower_components' + context.parsedUrl.pathname;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
historyApiFallback({
|
||||
rewrites: [
|
||||
{
|
||||
from: /\/app\/login/,
|
||||
to: function onMatch(ctx) {
|
||||
if (ctx.parsedUrl.path && ctx.parsedUrl.path.indexOf('.js')) {
|
||||
return ctx.parsedUrl.href || '';
|
||||
}
|
||||
return '/app/login/index.html';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
historyApiFallback({
|
||||
rewrites: [
|
||||
{
|
||||
from: /^\/libs\/(.*)$/,
|
||||
to(context) {
|
||||
return `/${context.match[2]}/${context.match[3]}`;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
// Type definitions for connect-history-api-fallback-exclusions 1.5.1
|
||||
// Project: https://github.com/Wirewheel/connect-history-api-fallback#readme
|
||||
// Definitions by: Tony Stone <https://github.com/tonystonee>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Url } from 'url';
|
||||
|
||||
import * as core from "express-serve-static-core";
|
||||
|
||||
declare function historyApiFallback(options?: Options): core.RequestHandler;
|
||||
declare namespace historyApiFallback {}
|
||||
export = historyApiFallback;
|
||||
|
||||
interface Options {
|
||||
exclusions?: string[];
|
||||
disableDotRule?: true;
|
||||
htmlAcceptHeaders?: string[];
|
||||
index?: string;
|
||||
logger?: typeof console.log;
|
||||
rewrites?: Rewrite[];
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
interface Context {
|
||||
match: RegExpMatchArray;
|
||||
parsedUrl: Url;
|
||||
}
|
||||
type RewriteTo = (context: Context) => string;
|
||||
|
||||
interface Rewrite {
|
||||
from: RegExp;
|
||||
to: string | RegExp | RewriteTo;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"connect-history-api-fallback-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user