Skip to content

Commit

Permalink
fix(browser-compat): replace hash-obj w object-hash and fix example f…
Browse files Browse the repository at this point in the history
…or IE

fix #84
  • Loading branch information
landonreed committed Jul 23, 2019
1 parent 69aa4f0 commit f343c8c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ coverage

# built example app
dist
dist.zip

# secrets
config.yml
2 changes: 1 addition & 1 deletion configurations/default/settings.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
entries:
- lib/index.js:dist/index.js
- example.js:dist/index.js
- lib/index.css:dist/index.css
6 changes: 6 additions & 0 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Polyfills to support IE, etc.
// Note: I attempted to update to core-js@3, but ran into issues about ES6
// imports. core-js@2 does not have core-js/stable, which is why we're importing
// the root.
import 'core-js'
import 'regenerator-runtime/runtime'
// import necessary React/Redux libraries
import { createHashHistory } from 'history'
import { connectRouter, routerMiddleware } from 'connected-react-router'
Expand Down
9 changes: 3 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title>OTP R.R.</title>

<link rel="stylesheet" href="dist/index.css">
<link rel="stylesheet" href="node_modules/transitive-js/lib/transitive.css">
<link rel="stylesheet" href="example.css">
<link rel="stylesheet" href="node_modules/leaflet.polylinemeasure/Leaflet.PolylineMeasure.css" />

<title>OTP R.R.</title>
</head>
<body>
<div id="root"></div>
<script src="/example.js"></script>
<script src="dist/index.js"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions lib/actions/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* globals fetch */
import { push, replace } from 'connected-react-router'
import hashObject from 'hash-obj'
import hash from 'object-hash'
import { createAction } from 'redux-actions'
import qs from 'qs'
import moment from 'moment'
Expand Down Expand Up @@ -853,7 +853,7 @@ function createQueryAction (endpoint, responseAction, errorAction, options = {})
// don't make a request to a URL that has already seen the same request
// within the last 10 seconds
const throttleKey = options.fetchOptions
? `${url}-${hashObject(options.fetchOptions)}`
? `${url}-${hash(options.fetchOptions)}`
: url
if (throttledUrls[throttleKey] && throttledUrls[throttleKey] > now() - TEN_SECONDS) {
// URL already had a request within last 10 seconds, warn and exit
Expand Down
2 changes: 2 additions & 0 deletions lib/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
@import url(node_modules/font-awesome/css/font-awesome.css);
@import url(node_modules/react-dates/lib/css/_datepicker.css);
@import url(node_modules/react-select/dist/react-select.css);
@import url(node_modules/transitive-js/lib/transitive.css);
@import url(node_modules/leaflet.polylinemeasure/Leaflet.PolylineMeasure.css);

@import url(lib/components/app/app.css);
@import url(lib/components/map/map.css);
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"description": "A library for writing modern OpenTripPlanner-compatible multimodal journey planning web applications using React and Redux",
"main": "build/index.js",
"scripts": {
"build": "mastarm build",
"build": "mastarm build --env production",
"cover": "mastarm test --coverage",
"jest": "mastarm test",
"lint": "mastarm lint lib --quiet",
"lint-docs": "documentation lint lib/**/*.js",
"prepublish": "mastarm prepublish --config configurations/prepublish",
"prestart": "yarn",
"test": "yarn run lint && yarn run lint-docs && yarn run jest",
"start": "mastarm build --serve example.js"
"start": "mastarm build --serve example.js",
"zip": "zip -r dist.zip index.html example.css dist"
},
"standard": {
"parser": "babel-eslint"
Expand All @@ -34,12 +35,12 @@
"clone": "^2.1.0",
"connected-react-router": "^5.0.1",
"copy-to-clipboard": "^3.0.8",
"core-js": "2",
"currency-formatter": "^1.4.2",
"d3-selection": "^1.3.0",
"d3-zoom": "^1.7.1",
"deep-equal": "^1.0.1",
"font-awesome": "^4.7.0",
"hash-obj": "^2.0.0",
"haversine": "^1.1.0",
"history": "^4.7.2",
"immutability-helper": "^2.1.1",
Expand All @@ -51,6 +52,7 @@
"lodash.isequal": "^4.5.0",
"moment": "^2.17.1",
"moment-timezone": "^0.5.23",
"object-hash": "^1.3.1",
"object-path": "^0.11.3",
"prop-types": "^15.6.0",
"qs": "^6.3.0",
Expand Down
41 changes: 10 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4029,16 +4029,16 @@ core-js-pure@3.1.4:
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.4.tgz#5fa17dc77002a169a3566cc48dc774d2e13e3769"
integrity sha512-uJ4Z7iPNwiu1foygbcZYJsJs1jiXrTTCvxfLDXNhI/I+NHbSIEyr548y4fcsCEyWY0XgfAG/qqaunJ1SThHenA==

core-js@2, core-js@^2.4.0, core-js@^2.6.5:
version "2.6.9"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2"
integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==

core-js@^1.0.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=

core-js@^2.4.0, core-js@^2.6.5:
version "2.6.9"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2"
integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A==

core-js@^2.5.0:
version "2.6.5"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895"
Expand Down Expand Up @@ -6557,15 +6557,6 @@ hash-base@^3.0.0:
inherits "^2.0.1"
safe-buffer "^5.0.1"

hash-obj@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/hash-obj/-/hash-obj-2.0.0.tgz#dc50b5ef9f724cface4985dcec98dd98dacd103e"
integrity sha512-A+HRqvu8VeDDiSn0KyhMff12RrN8VkvLEkvyPVteTiqUKoKYsIaNo2oeu0l6nehhiTWjkzsCfvi7ZOIUgr9wjw==
dependencies:
is-obj "^2.0.0"
sort-keys "^3.0.0"
type-fest "^0.4.1"

hash.js@^1.0.0, hash.js@^1.0.3:
version "1.1.7"
resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
Expand Down Expand Up @@ -7358,11 +7349,6 @@ is-obj@^1.0.0:
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f"
integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8=

is-obj@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982"
integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==

is-path-inside@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036"
Expand All @@ -7374,11 +7360,6 @@ is-plain-obj@^1.0.0, is-plain-obj@^1.1.0:
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4=

is-plain-obj@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.0.0.tgz#7fd1a7f1b69e160cde9181d2313f445c68aa2679"
integrity sha512-EYisGhpgSCwspmIuRHGjROWTon2Xp8Z7U03Wubk/bTL5TTRC5R1rGVgyjzBrk9+ULdH6cRD06KRcw/xfqhVYKQ==

is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677"
Expand Down Expand Up @@ -10013,6 +9994,11 @@ object-copy@^0.1.0:
define-property "^0.2.5"
kind-of "^3.0.3"

object-hash@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-1.3.1.tgz#fde452098a951cb145f039bb7d455449ddc126df"
integrity sha512-OSuu/pU4ENM9kmREg0BdNrUDIl1heYa4mBZacJc+vVWz4GtAwu7jO8s4AIt2aGRUTqxykpWzI3Oqnsm13tTMDA==

object-is@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.0.1.tgz#0aa60ec9989a0b3ed795cf4d06f62cf1ad6539b6"
Expand Down Expand Up @@ -13474,13 +13460,6 @@ sort-keys@^1.0.0:
dependencies:
is-plain-obj "^1.0.0"

sort-keys@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-3.0.0.tgz#fa751737e3da363ef80632d4fd78e324d661fe9a"
integrity sha512-77XUKMiZN5LvQXZ9sgWfJza19AvYIDwaDGwGiULM+B5XYru8Z90Oh06JvqDlJczvjjYvssrV0aK1GI6+YXvn5A==
dependencies:
is-plain-obj "^2.0.0"

sorted-object@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/sorted-object/-/sorted-object-2.0.1.tgz#7d631f4bd3a798a24af1dffcfbfe83337a5df5fc"
Expand Down

0 comments on commit f343c8c

Please sign in to comment.