Skip to content
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

v5 #751

Merged
merged 133 commits into from
Jun 12, 2020
Merged

v5 #751

Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
4b8a816
Remove deprecated files from v4
mjackson Nov 4, 2019
c013f2f
Update ESLint config
mjackson Nov 4, 2019
5416474
Main v5 rewrite
mjackson Nov 5, 2019
d51e9b7
Use ES6 ESLint env
mjackson Nov 5, 2019
7496807
Tweak test function format
mjackson Nov 5, 2019
824ed29
Consolidate push/replace => navigate
mjackson Nov 6, 2019
3cc181f
Add beforeunload fixture
mjackson Nov 6, 2019
4bf15b1
Add location.index + fix blocking POP actions
mjackson Nov 6, 2019
0831aae
Add history.retry for retrying transitions
mjackson Nov 6, 2019
c1702ab
Run all tests in parallel
mjackson Nov 6, 2019
67f6aea
Remove location.index, use history.push/replace
mjackson Nov 7, 2019
87a042e
Update block fixtures
mjackson Nov 7, 2019
bb91b28
Skip failing tests
mjackson Nov 7, 2019
d9013e4
Fix hash history test reset
mjackson Nov 7, 2019
dc947ec
Remove encoding tests
mjackson Nov 7, 2019
8b3be6f
Add back missing pathname support
mjackson Nov 7, 2019
2acce39
Remove Safari from testing, hopefully temporary
mjackson Nov 7, 2019
50997b3
Small tweaks
mjackson Nov 7, 2019
c647e9c
Rename to avoid collision with browser globals
mjackson Nov 8, 2019
02b43fd
Update docs
mjackson Nov 8, 2019
105b64a
5.0.0-beta.0
mjackson Nov 8, 2019
f1ba1cd
No need to return push/replace values from retry
mjackson Nov 15, 2019
a9825bd
Only use Object.freeze in dev
mjackson Nov 15, 2019
da24367
Small tweaks
mjackson Nov 15, 2019
d09f4fe
Use Closure Compiler with Advanced Mode (#753)
kristoferbaxter Nov 20, 2019
59c5d5d
Remove CommonJS builds
mjackson Nov 20, 2019
9338571
Change global name from History => HistoryLib
mjackson Nov 20, 2019
0b350a3
Remove BUILD_ENV var
mjackson Nov 20, 2019
2058791
Add is*History functions for type checking
mjackson Nov 20, 2019
dd4f4be
More explicit externals
mjackson Nov 20, 2019
dbb8900
Remove transform-object-assign Babel plugin
mjackson Nov 20, 2019
ad95d95
Move mem history to last
mjackson Nov 20, 2019
d0011ed
Generate sourcemaps
mjackson Nov 22, 2019
ec6aa85
Update global UMD name
mjackson Nov 22, 2019
4083639
Update global UMD name to "HistoryLibrary"
mjackson Nov 22, 2019
11b295b
Update ignore paths
mjackson Dec 2, 2019
9b90395
Fix CommonJS entry point
mjackson Dec 2, 2019
211bb9f
Use simple optimizations instead of advanced
mjackson Dec 3, 2019
4c2a05a
Remove is*History functions
mjackson Dec 3, 2019
0ada9c2
Update size check paths
mjackson Dec 3, 2019
434fe90
Remove TEST_ENV variable
mjackson Dec 3, 2019
65dd4be
Version 5.0.0-beta.1
mjackson Dec 3, 2019
39c4af9
Explicitly include index.js
mjackson Dec 3, 2019
e2833f7
Use simple optimizations
mjackson Dec 3, 2019
5f19f4b
Rework builds
mjackson Dec 7, 2019
a6abd69
Fine-tuning the build
mjackson Dec 7, 2019
6d901ec
Use PRETTY env var to run prettier on builds
mjackson Dec 7, 2019
30951b7
Run the build before tests on Travis
mjackson Dec 7, 2019
7367169
Fix loading tests in IE11
mjackson Dec 7, 2019
b6bbdce
Run build before size check
mjackson Dec 7, 2019
4b149df
Run CommonJS entry point through CC
mjackson Dec 7, 2019
969a267
Fix deploy script
mjackson Dec 7, 2019
643e666
Version 5.0.0-beta.2
mjackson Dec 7, 2019
c43d1a4
Remove loose-envify dep
mjackson Dec 7, 2019
d2db803
Add browser module builds
mjackson Dec 10, 2019
0e43e72
Output ES8 in browser modules
mjackson Dec 11, 2019
9ffbead
Version 5.0.0-beta.3
mjackson Dec 11, 2019
e6c94da
Upgrade Rollup
mjackson Dec 11, 2019
88163eb
Rename some source files
mjackson Dec 18, 2019
e6df3da
Update build scripts
mjackson Dec 19, 2019
f81c90a
Also accept a string in createHref
mjackson Dec 19, 2019
bcb89a3
Remove unnecessary "use strict"
mjackson Dec 19, 2019
18dff0b
Clearer blocking description and typo fix
pshrmn Jan 5, 2020
85b134c
console.warn instead of throwing warnings in dev
mjackson Jan 22, 2020
2d74ea5
Export parsePath and createPath helpers
mjackson Jan 22, 2020
34f405b
Increase size limit for UMD bundle
mjackson Jan 22, 2020
97c3163
Version 5.0.0-beta.4
mjackson Jan 22, 2020
9532fb2
Reformat some docs files
mjackson Feb 3, 2020
5c56e90
Upgrade filesize dep
mjackson Feb 4, 2020
5f72346
Update cc rollup plugin
mjackson Feb 4, 2020
b266c94
Move files out of modules dir
mjackson Feb 6, 2020
e181153
Rename node-main.js to main.js in package output
mjackson Feb 7, 2020
4bfb134
Remove TODO about using hashchange
mjackson Feb 7, 2020
083400c
Add TypeScript declaration files
mjackson Feb 7, 2020
e25626f
Version 5.0.0-beta.5
mjackson Feb 7, 2020
a8a056b
Fix TS linting issues
mjackson Feb 7, 2020
aba0c9f
Fix no-unused-vars lint errors in TS files
mjackson Feb 14, 2020
fd866b2
Add version + publish scripts
mjackson Feb 18, 2020
007b42d
Configure CircleCI
mjackson Mar 24, 2020
1bb5554
Update BrowserStack config
mjackson Mar 25, 2020
a62364a
Update CircleCI config
mjackson Mar 25, 2020
44f6662
Remove Travis config
mjackson Mar 25, 2020
fc00d36
Use annotated git tags
mjackson Mar 25, 2020
21e6b8c
Use separate workflows for build + deploy
mjackson Mar 25, 2020
6695288
Trying out a different config for CircleCI
mjackson Mar 26, 2020
501d3f1
Use cleaned version from command prompt
mjackson Mar 26, 2020
374c0e0
Try again, yay
mjackson Mar 26, 2020
e91dbcf
Another try, weeee!!
mjackson Mar 26, 2020
820d032
Version 5.0.0-beta.6
mjackson Mar 26, 2020
0c5d004
Use Travis CI
mjackson Mar 26, 2020
2d91489
Version 5.0.0-beta.7
mjackson Mar 26, 2020
cb3897c
Use explicit install step
mjackson Mar 26, 2020
7904e45
Consolidate test utils
mjackson Mar 27, 2020
1e91a64
Convert to TypeScript
mjackson Apr 15, 2020
72e513e
Update doc comment
mjackson Apr 17, 2020
6ad66e3
Version 5.0.0-beta.8
mjackson Apr 17, 2020
59e7e6c
Add generics for events collections
mjackson Apr 22, 2020
10c36a6
location.state should be `null` by default
mjackson Apr 22, 2020
b2ccfd5
Some types tweaks
mjackson Apr 22, 2020
9bf1254
More types tweaks
mjackson Apr 24, 2020
2153e3e
Add LocationPieces interface
mjackson Apr 24, 2020
f210445
State type union with null
mjackson Apr 24, 2020
e282eba
Comment formatting
mjackson Apr 24, 2020
3a9cc2b
Add more details + links to doc comments
mjackson Apr 24, 2020
943f377
Use ... instead of Object.assign
mjackson Apr 29, 2020
2145ce3
Fix working directory clean check
mjackson Apr 29, 2020
c692ca5
Version 5.0.0-beta.9
mjackson Apr 29, 2020
513edad
Ran yarn upgrade
mjackson Apr 29, 2020
46eaaad
Add type aliases for some primitives
mjackson May 1, 2020
6996dd7
Re-formatting
mjackson May 12, 2020
fca4907
Add a generic type to readOnly
mjackson May 15, 2020
0f99273
Memory history initial index defaults to last
mjackson May 15, 2020
0b066ba
Update some docs
mjackson May 15, 2020
5a5d611
Rename n => delta
mjackson May 15, 2020
8402b31
Added API reference doc
mjackson May 15, 2020
fc0c588
Update docs README
mjackson May 15, 2020
35d1b3f
Update API reference links
mjackson May 15, 2020
3a32a36
Update docs
mjackson May 15, 2020
700f019
Use cleaner anchors
mjackson May 15, 2020
d1b2808
Add API docs for state
mjackson May 15, 2020
79bb32a
Update API reference intro
mjackson May 15, 2020
313f1c2
Minor docs tweaks
mjackson May 15, 2020
742a3a4
Add script for generating API docs
mjackson Jun 3, 2020
90144a7
Some scripts tweaks
mjackson Jun 3, 2020
da807d5
Export types for options objects
mjackson Jun 7, 2020
138ba28
Remove typeParam docs
mjackson Jun 7, 2020
f88b174
Small tweaks to api reference
mjackson Jun 7, 2020
0f95d29
More tweaks to API docs
mjackson Jun 8, 2020
1babffe
Update API docs
mjackson Jun 10, 2020
a7ae54c
More docs + IntelliSense doc comments
mjackson Jun 12, 2020
41bacf0
Add more links to doc comments
mjackson Jun 12, 2020
4ab6a42
Restore syntax highlights in declaration blocks
mjackson Jun 12, 2020
987ff43
Add some more type declarations
mjackson Jun 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/cjs
/esm
/umd
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": ["import"],
"env": {
"node": true
},
"extends": ["eslint:recommended", "plugin:import/errors"],
"rules": {
"prefer-arrow-callback": "error",
"no-unused-vars": [
"warn",
{
"args": "after-used",
"ignoreRestSiblings": true,
"argsIgnorePattern": "event"
}
]
}
}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/node_modules/
/esm/
/fixtures/history.js
/cjs/
/node_modules/
/umd/
/local.log
24 changes: 12 additions & 12 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"esm/history.js": {
"bundled": 28076,
"minified": 12353,
"gzipped": 3575,
"bundled": 18963,
"minified": 7493,
"gzipped": 2040,
"treeshaked": {
"rollup": {
"code": 208,
"import_statements": 132
"code": 43,
"import_statements": 43
},
"webpack": {
"code": 1324
"code": 1027
}
}
},
"umd/history.js": {
"bundled": 33021,
"minified": 11943,
"gzipped": 3917
"bundled": 20613,
"minified": 6873,
"gzipped": 2192
},
"umd/history.min.js": {
"bundled": 30384,
"minified": 9993,
"gzipped": 3501
"bundled": 18495,
"minified": 5944,
"gzipped": 1893
}
}
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
language: node_js
node_js: node
cache: yarn
env:
- TEST_ENV=cjs BUILD_ENV=cjs
- TEST_ENV=umd BUILD_ENV=umd
- TEST_ENV=source
before_script:
- ([[ -z "$BUILD_ENV" ]] || yarn build)
script:
- yarn lint
- yarn test
jobs:
include:
- stage: Test
env: TEST_ENV=cjs BUILD_ENV=cjs
before_script: yarn build
script: yarn test
- env: TEST_ENV=umd BUILD_ENV=umd
before_script: yarn build
script: yarn test
- env: TEST_ENV=source
script: yarn test
- stage: Release
if: tag =~ ^v[0-9]
env: NPM_TAG=$([[ "$TRAVIS_TAG" == *-* ]] && echo "next" || echo "latest")
Expand Down
3 changes: 0 additions & 3 deletions DOMUtils.js

This file was deleted.

3 changes: 0 additions & 3 deletions ExecutionEnvironment.js

This file was deleted.

3 changes: 0 additions & 3 deletions LocationUtils.js

This file was deleted.

3 changes: 0 additions & 3 deletions PathUtils.js

This file was deleted.

3 changes: 0 additions & 3 deletions createBrowserHistory.js

This file was deleted.

3 changes: 0 additions & 3 deletions createHashHistory.js

This file was deleted.

3 changes: 0 additions & 3 deletions createMemoryHistory.js

This file was deleted.

3 changes: 0 additions & 3 deletions createTransitionManager.js

This file was deleted.

7 changes: 0 additions & 7 deletions es/DOMUtils.js

This file was deleted.

7 changes: 0 additions & 7 deletions es/ExecutionEnvironment.js

This file was deleted.

7 changes: 0 additions & 7 deletions es/LocationUtils.js

This file was deleted.

7 changes: 0 additions & 7 deletions es/PathUtils.js

This file was deleted.

7 changes: 0 additions & 7 deletions es/createBrowserHistory.js

This file was deleted.

7 changes: 0 additions & 7 deletions es/createHashHistory.js

This file was deleted.

7 changes: 0 additions & 7 deletions es/createMemoryHistory.js

This file was deleted.

7 changes: 0 additions & 7 deletions es/createTransitionManager.js

This file was deleted.

35 changes: 0 additions & 35 deletions es/warnAboutDeprecatedESMImport.js

This file was deleted.

89 changes: 89 additions & 0 deletions fixtures/unload-history.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html>
<body>
<h1>Controls</h1>

<p>
<label><input type="checkbox" id="blocker" /> block</label>
</p>
<p>
<span>back &amp; forward: </span><br />
<button onclick="goBack()">back</button>
<button onclick="goForward()">forward</button>
</p>
<p>
<span>pushState &amp; replaceState: </span><br />
<a href="/unload-history" onclick="return pushLink(this)">pushState(home)</a>
<a href="/unload-history-one" onclick="return pushLink(this)">pushState(one)</a>
<a href="/unload-history-two" onclick="return pushLink(this)">pushState(two)</a>
<a href="/unload-history-three" onclick="return replaceLink(this)">replaceState(three)</a>
</p>
<p>
<span>regular link: </span><br />
<a href="/unload-history">home</a>
</p>

<h1>Test Scenarios</h1>

<p>
<ul>
<li>Click block - Click back - You should be prompted to stay</li>
<li>Click block - Click home - You should be prompted to stay</li>
<li>Click block - Close the tab - You should be prompted to stay</li>
<li>Click pushState(one) - Click block - Click back - You should still be at /unload-history-one</li>
<li>Click pushState(one) - Click block - Click pushState(two) - You should still be at /unload-history-one</li>
<li>Click pushState(one) - Click pushState(two) - Click back - Click block - Click back - You should still be at /unload-history-one</li>
<li>Click pushState(one) - Click pushState(two) - Click back - Click block - Click forward - You should still be at /unload-history-one</li>
<li>Click pushState(one) - Click pushState(two) - Click replaceState(three) - Click block - Click back - You should still be at /unload-history-three</li>
</ul>
</p>

<script src="history.js"></script>
<script>
var h = History.createBrowserHistory();

// Blocker

var blocker = document.getElementById('blocker');
var unblock;

blocker.addEventListener('change', () => {
if (blocker.checked) {
unblock = h.block(tx => {
if (window.confirm(`Are you sure you want to go to ${tx.location.pathname}?`)) {
// Reset the blocker so the next transition is allowed.
blocker.checked = false;
unblock();
// Retry the transition.
h.retry(tx);
}
});
} else if (unblock) {
unblock();
unblock = undefined;
}
});

// Navigation

function pushLink(link) {
h.navigate(link.getAttribute('href'));
return false; // preventDefault
}

function replaceLink(link) {
h.navigate(link.getAttribute('href'), { replace: true });
return false; // preventDefault
}

function goBack() {
h.back();
}

function goForward() {
h.forward();
}
</script>
</body>
</html>

Loading