rename create_matchers -> create_routes

This commit is contained in:
Rich Harris
2017-12-12 11:41:45 -05:00
parent cf0ab4b9c7
commit 2549477e05
2 changed files with 4 additions and 0 deletions

View File

@@ -8,6 +8,8 @@ module.exports = function create_matchers(files) {
const parts = file.replace(/\.(html|js|mjs)$/, '').split(path.sep);
if (parts[parts.length - 1] === 'index') parts.pop();
const id = parts.join('_').replace(/[[\]]/g, '$');
const dynamic = parts
.filter(part => part[0] === '[')
.map(part => part.slice(1, -1));
@@ -31,6 +33,8 @@ module.exports = function create_matchers(files) {
};
return {
id,
type: path.extname(file) === '.html' ? 'page' : 'route',
file,
pattern,
test,