From 9930845d298be5d3bd55b0542d1f670ecf1a4141 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Fri, 12 Jun 2020 10:36:44 -0700 Subject: [PATCH] Update doc links to master branch --- README.md | 38 ++++++--------------- docs/api-reference.md | 4 +-- packages/history/index.ts | 70 +++++++++++++++++++-------------------- 3 files changed, 48 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 84360e8ff..56974e621 100644 --- a/README.md +++ b/README.md @@ -5,48 +5,32 @@ [build-badge]: https://img.shields.io/travis/ReactTraining/history/master.svg?style=flat-square [build]: https://travis-ci.org/ReactTraining/history -The history library lets you easily manage session history anywhere JavaScript -runs. A `history` object abstracts away the differences in various environments -and provides a minimal API that lets you manage the history stack, navigate, and -persist state between sessions. +The history library lets you easily manage session history anywhere JavaScript runs. A `history` object abstracts away the differences in various environments and provides a minimal API that lets you manage the history stack, navigate, and persist state between sessions. ## Documentation -Documentation for the current branch can be found in the [docs](docs) directory. +Documentation for version 5 can be found in the [docs](docs) directory. This is the current stable release. Version 5 is used in React Router version 6. + +Documentation for version 4 can be found [on the v4 branch](https://github.com/ReactTraining/history/tree/v4/docs). Version 4 is used in React Router versions 4 and 5. ## Changes -To see the changes that were made in a given release, please lookup the tag on -[the releases page](https://github.com/ReactTraining/history/releases). +To see the changes that were made in a given release, please lookup the tag on [the releases page](https://github.com/ReactTraining/history/releases). -For changes released in version 4.6.3 and earlier, please see [the `CHANGES.md` -file](https://github.com/ReactTraining/history/blob/845d690c5576c7f55ecbe14babe0092e8e5bc2bb/CHANGES.md). +For changes released in version 4.6.3 and earlier, please see [the `CHANGES.md` file](https://github.com/ReactTraining/history/blob/845d690c5576c7f55ecbe14babe0092e8e5bc2bb/CHANGES.md). ## Development -Development of the current stable release, version 4, happens on [the `master` -branch](https://github.com/ReactTraining/history/tree/master). Please keep in -mind that this branch may include some work that has not yet been published as -part of an official release. However, since `master` is always stable, you -should feel free to build your own working release straight from master at any -time. - -Development of the next major release, version 5, happens on [the `dev` -branch](https://github.com/ReactTraining/history/tree/dev). +Development of the current stable release, version 5, happens on [the `master` branch](https://github.com/ReactTraining/history/tree/master). Please keep in mind that this branch may include some work that has not yet been published as part of an official release. However, since `master` is always stable, you should feel free to build your own working release straight from master at any time. -If you're interested in helping out, please read [our contributing -guidelines](CONTRIBUTING.md). +If you're interested in helping out, please read [our contributing guidelines](CONTRIBUTING.md). ## About -`history` is developed and maintained by [React Training](https://reacttraining.com). If -you're interested in learning more about what React can do for your company, please -[get in touch](mailto:hello@reacttraining.com)! +`history` is developed and maintained by [React Training](https://reacttraining.com). If you're interested in learning more about what React can do for your company, please [get in touch](mailto:hello@reacttraining.com)! ## Thanks -A big thank-you to [BrowserStack](https://www.browserstack.com/) for providing -the infrastructure that allows us to run our build in real browsers. +A big thank-you to [BrowserStack](https://www.browserstack.com/) for providing the infrastructure that allows us to run our build in real browsers. -Also, thanks to [Dan Shaw](https://www.npmjs.com/~dshaw) for letting us use the -`history` npm package name. Thanks, Dan! +Also, thanks to [Dan Shaw](https://www.npmjs.com/~dshaw) for letting us use the `history` npm package name. Thanks, Dan! diff --git a/docs/api-reference.md b/docs/api-reference.md index 16b2a0f87..c149268e0 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -60,13 +60,13 @@ If you're building a link, you'll want to use [`history.createHref`](#history.cr ## Reference -The [source code](https://github.com/ReactTraining/history/tree/dev/packages/history) for the history library is written in TypeScript, but it is compiled to JavaScript before publishing. Some of the function signatures in this reference include their TypeScript type annotations, but you can always refer to the original source as well. +The [source code](https://github.com/ReactTraining/history/tree/master/packages/history) for the history library is written in TypeScript, but it is compiled to JavaScript before publishing. Some of the function signatures in this reference include their TypeScript type annotations, but you can always refer to the original source as well. ### Action -An [`Action`](https://github.com/ReactTraining/history/blob/0f992736/packages/history/index.ts#L4) represents a type of change that occurred in the history stack. `Action` is an `enum` with three members: +An `Action` represents a type of change that occurred in the history stack. `Action` is an `enum` with three members: - `Action.Pop` - A change to an arbitrary index in the stack, such as a back or forward navigation. This does not describe the direction of the navigation, only that the index changed. This is the default action for newly created history objects. - `Action.Push` - Indicates a new entry being added to the history stack, such as when a link is clicked and a new page loads. When this happens, all subsequent entries in the stack are lost. diff --git a/packages/history/index.ts b/packages/history/index.ts index bcf8b2042..4c83f7e5c 100644 --- a/packages/history/index.ts +++ b/packages/history/index.ts @@ -1,7 +1,7 @@ /** * Actions represent the type of change to a location value. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#action + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#action */ export enum Action { /** @@ -30,21 +30,21 @@ export enum Action { /** * A URL pathname, beginning with a /. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.pathname + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname */ export type Pathname = string; /** * A URL search string, beginning with a ?. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.search + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search */ export type Search = string; /** * A URL fragment identifier, beginning with a #. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.hash + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash */ export type Hash = string; @@ -52,7 +52,7 @@ export type Hash = string; * An object that is used to associate some arbitrary data with a location, but * that does not appear in the URL path. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.state + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state */ export type State = object | null; @@ -60,7 +60,7 @@ export type State = object | null; * A unique string associated with a location. May be used to safely store * and retrieve data in some other storage API, like `localStorage`. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.key + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key */ export type Key = string; @@ -71,21 +71,21 @@ export interface Path { /** * A URL pathname, beginning with a /. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.pathname + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname */ pathname: Pathname; /** * A URL search string, beginning with a ?. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.search + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search */ search: Search; /** * A URL fragment identifier, beginning with a #. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.hash + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash */ hash: Hash; } @@ -94,13 +94,13 @@ export interface Path { * An entry in a history stack. A location contains information about the * URL path, as well as possibly some arbitrary state and a key. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location */ export interface Location extends Path { /** * An object of arbitrary data associated with this location. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.state + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state */ state: S; @@ -110,7 +110,7 @@ export interface Location extends Path { * * Note: This value is always "default" on the initial location. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.key + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key */ key: Key; } @@ -122,21 +122,21 @@ export interface PartialPath { /** * The URL pathname, beginning with a /. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.pathname + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname */ pathname?: Pathname; /** * The URL search string, beginning with a ?. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.search + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search */ search?: Search; /** * The URL fragment identifier, beginning with a #. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.hash + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash */ hash?: Hash; } @@ -148,7 +148,7 @@ export interface PartialLocation extends PartialPath { /** * An object of arbitrary data associated with this location. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.state + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state */ state?: S; @@ -158,7 +158,7 @@ export interface PartialLocation extends PartialPath { * * Note: This value is always "default" on the initial location. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.key + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key */ key?: Key; } @@ -223,14 +223,14 @@ export interface History { * The last action that modified the current location. This will always be * Action.Pop when a history instance is first created. This value is mutable. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.action + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.action */ readonly action: Action; /** * The current location. This value is mutable. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.location + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.location */ readonly location: Location; @@ -240,7 +240,7 @@ export interface History { * * @param to - The destination URL * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.createHref + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.createHref */ createHref(to: To): string; @@ -252,7 +252,7 @@ export interface History { * @param to - The new URL * @param state - Data to associate with the new location * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.push + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.push */ push(to: To, state?: S): void; @@ -263,7 +263,7 @@ export interface History { * @param to - The new URL * @param state - Data to associate with the new location * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.replace + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.replace */ replace(to: To, state?: S): void; @@ -273,7 +273,7 @@ export interface History { * * @param delta - The delta in the stack index * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.go + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.go */ go(delta: number): void; @@ -283,14 +283,14 @@ export interface History { * Warning: if the current location is the first location in the stack, this * will unload the current document. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.back + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.back */ back(): void; /** * Navigates to the next entry in the stack. Identical to go(1). * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.forward + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.forward */ forward(): void; @@ -301,7 +301,7 @@ export interface History { * @param listener - A function that will be called when the location changes * @returns unlisten - A function that may be used to stop listening * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.listen + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.listen */ listen(listener: Listener): () => void; @@ -312,7 +312,7 @@ export interface History { * @param blocker - A function that will be called when a transition is blocked * @returns unblock - A function that may be used to stop blocking * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.block + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.block */ block(blocker: Blocker): () => void; } @@ -322,7 +322,7 @@ export interface History { * browser environment. This is the standard for most web apps and provides the * cleanest URLs the browser's address bar. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#browserhistory + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#browserhistory */ export interface BrowserHistory extends History {} @@ -335,7 +335,7 @@ export interface BrowserHistory extends History {} * shared hosting environments that do not provide fine-grained controls over * which pages are served at which URLs. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#hashhistory + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#hashhistory */ export interface HashHistory extends History {} @@ -344,7 +344,7 @@ export interface HashHistory extends History {} * environments where there is no web browser, such as node tests or React * Native. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#memoryhistory + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#memoryhistory */ export interface MemoryHistory extends History { index: number; @@ -392,7 +392,7 @@ export type BrowserHistoryOptions = { window?: Window }; * most web apps, but it requires some configuration on the server to ensure you * serve the same app at multiple URLs. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#createbrowserhistory + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createbrowserhistory */ export function createBrowserHistory( options: BrowserHistoryOptions = {} @@ -611,7 +611,7 @@ export type HashHistoryOptions = { window?: Window }; * some reason, either because you do cannot configure it or the URL space is * reserved for something else. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#createhashhistory + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createhashhistory */ export function createHashHistory( options: HashHistoryOptions = {} @@ -877,7 +877,7 @@ export type MemoryHistoryOptions = { * Memory history stores the current location in memory. It is designed for use * in stateful non-browser environments like tests and React Native. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#creatememoryhistory + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#creatememoryhistory */ export function createMemoryHistory( options: MemoryHistoryOptions = {} @@ -1073,7 +1073,7 @@ function createKey() { /** * Creates a string URL path from the given pathname, search, and hash components. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#createpath + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createpath */ export function createPath({ pathname = '/', @@ -1086,7 +1086,7 @@ export function createPath({ /** * Parses a string URL path into its separate pathname, search, and hash components. * - * @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#parsepath + * @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#parsepath */ export function parsePath(path: string) { let partialPath: PartialPath = {};