Skip to content

Commit

Permalink
Update some import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Sep 6, 2019
1 parent 8b3654f commit 773751c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 26 deletions.
2 changes: 1 addition & 1 deletion modules/LocationUtils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import resolvePathname from 'resolve-pathname';
import valueEqual from 'value-equal';

import { parsePath } from './PathUtils';
import { parsePath } from './PathUtils.js';

export function createLocation(path, state, key, currentLocation) {
let location;
Expand Down
13 changes: 6 additions & 7 deletions modules/createBrowserHistory.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import warning from 'tiny-warning';
import invariant from 'tiny-invariant';

import { createLocation } from './LocationUtils';
import { createLocation } from './LocationUtils.js';
import {
addLeadingSlash,
stripTrailingSlash,
hasBasename,
stripBasename,
createPath
} from './PathUtils';
import createTransitionManager from './createTransitionManager';
} from './PathUtils.js';
import createTransitionManager from './createTransitionManager.js';
import {
canUseDOM,
getConfirmation,
supportsHistory,
supportsPopStateOnHashChange,
isExtraneousPopstateEvent
} from './DOMUtils';
} from './DOMUtils.js';
import invariant from './invariant.js';
import warning from './warning.js';

const PopStateEvent = 'popstate';
const HashChangeEvent = 'hashchange';
Expand Down
19 changes: 12 additions & 7 deletions modules/createHashHistory.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import warning from 'tiny-warning';
import invariant from 'tiny-invariant';

import { createLocation, locationsAreEqual } from './LocationUtils';
import { createLocation } from './LocationUtils.js';
import {
addLeadingSlash,
stripLeadingSlash,
stripTrailingSlash,
hasBasename,
stripBasename,
createPath
} from './PathUtils';
import createTransitionManager from './createTransitionManager';
} from './PathUtils.js';
import createTransitionManager from './createTransitionManager.js';
import {
canUseDOM,
getConfirmation,
supportsGoWithoutReloadUsingHash
} from './DOMUtils';
} from './DOMUtils.js';
import invariant from './invariant.js';
import warning from './warning.js';

const HashChangeEvent = 'hashchange';

Expand Down Expand Up @@ -96,6 +95,12 @@ function createHashHistory(props = {}) {
let forceNextPop = false;
let ignorePath = null;

function locationsAreEqual(a, b) {
return (
a.pathname === b.pathname && a.search === b.search && a.hash === b.hash
);
}

function handleHashChange() {
const path = getHashPath();
const encodedPath = encodePath(path);
Expand Down
18 changes: 8 additions & 10 deletions modules/createMemoryHistory.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import warning from 'tiny-warning';

import { createPath } from './PathUtils';
import { createLocation } from './LocationUtils';
import createTransitionManager from './createTransitionManager';
import { createPath } from './PathUtils.js';
import { createLocation } from './LocationUtils.js';
import createTransitionManager from './createTransitionManager.js';
import warning from './warning.js';

function clamp(n, lowerBound, upperBound) {
return Math.min(Math.max(n, lowerBound), upperBound);
Expand Down Expand Up @@ -34,11 +33,10 @@ function createMemoryHistory(props = {}) {
}

const index = clamp(initialIndex, 0, initialEntries.length - 1);
const entries = initialEntries.map(
entry =>
typeof entry === 'string'
? createLocation(entry, undefined, createKey())
: createLocation(entry, undefined, entry.key || createKey())
const entries = initialEntries.map(entry =>
typeof entry === 'string'
? createLocation(entry, undefined, createKey())
: createLocation(entry, undefined, entry.key || createKey())
);

// Public interface
Expand Down
2 changes: 1 addition & 1 deletion modules/createTransitionManager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import warning from 'tiny-warning';
import warning from './warning.js';

function createTransitionManager() {
let prompt = null;
Expand Down
1 change: 1 addition & 0 deletions modules/invariant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'tiny-invariant';
1 change: 1 addition & 0 deletions modules/warning.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from 'tiny-warning';

0 comments on commit 773751c

Please sign in to comment.