Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

/* eslint import/no-unresolved: 0*/
/* eslint import/no-unresolved: 0 */
const Benchmark = require('benchmark');
const Route = require('route-parser');
const FnRoute = require('../src');
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"chai": "^3.5.0",
"codecov": "^2.1.0",
"commitizen": "^2.9.6",
"copy-webpack-plugin": "^4.6.0",
"cross-env": "^4.0.0",
"cz-conventional-changelog": "^2.0.0",
"eslint": "^3.16.1",
Expand Down
13 changes: 13 additions & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export type RouteNamedSegments = { [key: string]: string };

export interface RouteMatcher {
route: string;
match(route?: string): RouteNamedSegments | false;
}

export interface RouterOptions {
delimiter?: string;
namedSegment?: string;
}

export default function Router(route?: string, options?: RouterOptions): RouteMatcher;
8 changes: 6 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

const BabiliPlugin = require('babili-webpack-plugin');

const CopyWebpackPlugin = require('copy-webpack-plugin');
const { join } = require('path');

const copyTypings = new CopyWebpackPlugin(['src/index.d.ts']);

const isProduction = process.env.NODE_ENV === 'production';
const include = join(__dirname, 'src');

Expand All @@ -20,5 +22,7 @@ module.exports = {
{ test: /\.js$/, loader: 'babel-loader', include }
]
},
plugins: isProduction ? [new BabiliPlugin({}, { comments: false })] : []
plugins: isProduction
? [new BabiliPlugin({}, { comments: false }), copyTypings]
: [copyTypings]
};