Regularize page and server routes

Treats both page and server routes similarly in regards to indexes.

It's a (somewhat) breaking change: server routes will accept trailing
slashes to match page routes behavior, but only if there's no extension.

We still need a stronger support for dealing with different clean urls
rules.
This commit is contained in:
mrkishi
2019-05-05 03:40:58 -03:00
parent f886a12bd7
commit 54e92c3b99
4 changed files with 52 additions and 44 deletions

View File

@@ -20,7 +20,7 @@ describe('manifest_data', () => {
assert.deepEqual(pages, [
{
pattern: /^\/?$/,
pattern: /^\/$/,
parts: [
{ component: index, params: [] }
]
@@ -50,6 +50,13 @@ describe('manifest_data', () => {
]);
assert.deepEqual(server_routes, [
{
name: 'route_index',
pattern: /^\/$/,
file: 'index.js',
params: []
},
{
name: 'route_blog_json',
pattern: /^\/blog.json$/,
@@ -167,7 +174,7 @@ describe('manifest_data', () => {
file: 'foo.js',
name: 'route_foo',
params: [],
pattern: /^\/foo$/
pattern: /^\/foo\/?$/
}]);
});
});