New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UniversalRouter to v4 #1403

Merged
merged 1 commit into from Sep 20, 2017
Jump to file or symbol
Failed to load files and symbols.
+18 −26
Diff settings

Always

Just for now

View
@@ -32,18 +32,6 @@ module.exports = {
},
rules: {
// `js` and `jsx` are common extensions
// `mjs` is for `universal-router` only, for now
'import/extensions': [
'error',
'always',
{
js: 'never',
jsx: 'never',
mjs: 'never',
},
],
// Not supporting nested package.json yet
// https://github.com/benmosher/eslint-plugin-import/issues/458
'import/no-extraneous-dependencies': 'off',
View
@@ -34,7 +34,7 @@
"serialize-javascript": "^1.3.0",
"source-map-support": "^0.4.15",
"sqlite3": "^3.1.8",
"universal-router": "^3.2.0",
"universal-router": "^4.0.0",
"whatwg-fetch": "^2.0.3"
},
"devDependencies": {
View
@@ -112,7 +112,7 @@ async function onLocationChange(location, action) {
// and whose action method returns anything other than `undefined`.
const route = await router.resolve({
...context,
path: location.pathname,
pathname: location.pathname,
query: queryString.parse(location.search),
});
View
@@ -7,10 +7,10 @@
* LICENSE.txt file in the root directory of this source tree.
*/
import Router from 'universal-router';
import UniversalRouter from 'universal-router';
import routes from './routes';
export default new Router(routes, {
export default new UniversalRouter(routes, {
resolveRoute(context, params) {
if (typeof context.route.load === 'function') {
return context.route
View
@@ -11,12 +11,12 @@
// The top-level (parent) route
const routes = {
path: '/',
path: '',
// Keep in mind, routes are evaluated in order
children: [
{
path: '/',
path: '',
load: () => import(/* webpackChunkName: 'home' */ './home'),
},
{
@@ -44,9 +44,9 @@ const routes = {
load: () => import(/* webpackChunkName: 'admin' */ './admin'),
},
// Wildcard routes, e.g. { path: '*', ... } (must go last)
// Wildcard routes, e.g. { path: '(.*)', ... } (must go last)
{
path: '*',
path: '(.*)',
load: () => import(/* webpackChunkName: 'not-found' */ './not-found'),
},
],
View
@@ -132,7 +132,7 @@ app.get('*', async (req, res, next) => {
const route = await router.resolve({
...context,
path: req.path,
pathname: req.path,
query: req.query,
});
View
@@ -20,7 +20,7 @@ const isVerbose = process.argv.includes('--verbose');
const isAnalyze =
process.argv.includes('--analyze') || process.argv.includes('--analyse');
const reScript = /\.jsx?$/;
const reScript = /\.m?jsx?$/;
const reStyle = /\.(css|less|scss|sss)$/;
const reImage = /\.(bmp|gif|jpe?g|png|svg)$/;
const staticAssetName = isDebug
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.