From b2d9016fa193ba0ff9429d9e30d6b0977ce254bd Mon Sep 17 00:00:00 2001 From: pimlie Date: Mon, 18 Nov 2019 15:08:34 +0100 Subject: [PATCH 1/3] chore: upgrade path-to-regexp to v1.8.0 --- package.json | 2 +- yarn.lock | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4e6980f3e..801bc2685 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "lint-staged": "^8.2.0", "nightwatch": "^1.1.13", "nightwatch-helpers": "^1.0.0", - "path-to-regexp": "^1.7.0", + "path-to-regexp": "^1.8.0", "rollup": "^1.20.1", "rollup-plugin-buble": "^0.19.8", "rollup-plugin-commonjs": "^10.0.2", diff --git a/yarn.lock b/yarn.lock index 46570e9dc..6ff2c9e79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7769,13 +7769,20 @@ path-to-regexp@0.1.7: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= -path-to-regexp@^1.0.3, path-to-regexp@^1.7.0: +path-to-regexp@^1.0.3: version "1.7.0" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" integrity sha1-Wf3g9DW62suhA6hOnTvGTpa5k30= dependencies: isarray "0.0.1" +path-to-regexp@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a" + integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA== + dependencies: + isarray "0.0.1" + path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" From a6b8a61816d9e9372c95175cb710cb51cc91d7c1 Mon Sep 17 00:00:00 2001 From: pimlie Date: Mon, 18 Nov 2019 15:09:34 +0100 Subject: [PATCH 2/3] test: update location test to test case insensitive params --- test/unit/specs/location.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/unit/specs/location.spec.js b/test/unit/specs/location.spec.js index e333421b1..ea3db4072 100644 --- a/test/unit/specs/location.spec.js +++ b/test/unit/specs/location.spec.js @@ -79,13 +79,13 @@ describe('Location utils', () => { }) it('relative params (non-named)', () => { - const loc = normalizeLocation({ params: { lang: 'fr' }}, { + const loc = normalizeLocation({ params: { lang: 'FR' }}, { path: '/en/foo', params: { lang: 'en', id: 'foo' }, - matched: [{ path: '/:lang/:id' }] + matched: [{ path: '/:lang(en|fr)/:id' }] }) expect(loc._normalized).toBe(true) - expect(loc.path).toBe('/fr/foo') + expect(loc.path).toBe('/FR/foo') }) it('relative append', () => { From 7263e2cfbb93f3385588d13425642fb5f24a690a Mon Sep 17 00:00:00 2001 From: pimlie Date: Mon, 18 Nov 2019 15:10:33 +0100 Subject: [PATCH 3/3] chore: make server host configurable --- examples/server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/server.js b/examples/server.js index 0f37cc57d..be636798e 100644 --- a/examples/server.js +++ b/examples/server.js @@ -27,7 +27,8 @@ fs.readdirSync(__dirname).forEach(file => { app.use(express.static(__dirname)) +const host = process.env.HOST || 'localhost' const port = process.env.PORT || 8080 -module.exports = app.listen(port, () => { - console.log(`Server listening on http://localhost:${port}, Ctrl+C to stop`) +module.exports = app.listen(port, host, () => { + console.log(`Server listening on http://${host}:${port}, Ctrl+C to stop`) })