Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
**/coverage
**/dist
**/dist-ts
# API Extractor reports, compared byte for byte by scripts/api-report.mjs.
packages/*/api/**/*.api.md
pnpm-lock.yaml
**/snapshots
**/.vercel
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CI=1 NX_DAEMON=false pnpm nx run-many -p <project> -t <target> --skipRemoteCache

- Run one Nx command at a time. For a ~20-second startup/graph stall, stop, run `pnpm nx reset`, and retry once, then escalate. Do not apply that timeout to running tests.
- For code changes, run affected packages' `test:unit`, `test:types`, and `test:eslint` where available, including affected consumers; use `test:e2e` for browser/app behavior and `test:build` for exports/build changes. Root `pnpm test` includes the full e2e suite. Published-code changes require `pnpm changeset`.
- `packages/<name>/api/**/*.api.md` are API Extractor reports of the published declarations, and `test:build` fails when one is stale. Adding, removing or changing a public export, member or signature changes them, and so does an `@internal` tag. Build the package, run `node scripts/api-report.mjs packages/<name>` and commit the reports with the change. Never edit a report by hand.

## Runtime rules

Expand Down
4 changes: 3 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@
"inputs": [
"buildProduction",
"dependentTaskOutputs",
"{workspaceRoot}/scripts/check-published-types.mjs"
"{workspaceRoot}/scripts/check-published-types.mjs",
"{workspaceRoot}/scripts/api-report.mjs",
{ "externalDependencies": ["@microsoft/api-extractor"] }
]
},
"test:e2e*": {
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@
],
"targets": {
"test:unit": {
"command": "node --test scripts/check-published-types.test.mjs scripts/internal-types-config.test.mjs",
"command": "node --test scripts/api-report.test.mjs scripts/check-published-types.test.mjs scripts/internal-types-config.test.mjs",
"dependsOn": [],
"inputs": [
"{workspaceRoot}/scripts/api-report.mjs",
"{workspaceRoot}/scripts/api-report.test.mjs",
"{workspaceRoot}/scripts/check-published-types.mjs",
"{workspaceRoot}/scripts/check-published-types.test.mjs",
"{workspaceRoot}/scripts/internal-types-config.mjs",
Expand All @@ -75,6 +77,7 @@
"{workspaceRoot}/packages/**/*",
{
"externalDependencies": [
"@microsoft/api-extractor",
"typescript",
"@types/node",
"prettier"
Expand All @@ -91,6 +94,7 @@
"devDependencies": {
"@changesets/changelog-github": "^0.7.0",
"@changesets/cli": "^2.30.0",
"@microsoft/api-extractor": "catalog:",
"@nx/devkit": "24.0.0",
"@playwright/test": "catalog:",
"@swc-node/register": "^1.11.1",
Expand Down
160 changes: 160 additions & 0 deletions packages/history/api/index.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
## API Report File for "@tanstack/history"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

> Declarations: `dist/esm/index.d.ts`. Regenerate with `node scripts/api-report.mjs packages/history` after a build.
>
> Imported as:
>
> - `@tanstack/history` (`import`)

```ts

// Warning: (ae-forgotten-export) The symbol "ShouldAllowNavigation" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type BlockerFn = (args: BlockerFnArgs) => Promise<ShouldAllowNavigation> | ShouldAllowNavigation;

// @public (undocumented)
export type BlockerFnArgs = {
currentLocation: HistoryLocation;
nextLocation: HistoryLocation;
action: HistoryAction;
};

// @public
export function createBrowserHistory(opts?: {
parseLocation?: () => HistoryLocation;
createHref?: (path: string) => string;
window?: any;
}): RouterHistory;

// @public
export function createHashHistory(opts?: {
window?: any;
}): RouterHistory;

// @public (undocumented)
export function createHistory(opts: {
getLocation: () => HistoryLocation;
getLength: () => number;
pushState: (path: string, state: any) => void;
replaceState: (path: string, state: any) => void;
go: (n: number, ignoreBlocker: boolean) => void;
back: (ignoreBlocker: boolean) => void;
forward: (ignoreBlocker: boolean) => void;
createHref: (path: string) => string;
flush?: () => void;
destroy?: () => void;
onBlocked?: () => void;
getBlockers?: () => Array<NavigationBlocker>;
setBlockers?: (blockers: Array<NavigationBlocker>) => void;
notifyOnIndexChange?: boolean;
}): RouterHistory;

// @public
export function createMemoryHistory(opts?: {
initialEntries: Array<string>;
initialIndex?: number;
}): RouterHistory;

// @public
export function createServerHistory(href: string): RouterHistory;

// @public (undocumented)
export type HistoryAction = 'PUSH' | 'REPLACE' | 'FORWARD' | 'BACK' | 'GO';

// @public (undocumented)
export interface HistoryLocation extends ParsedPath {
// (undocumented)
state: ParsedHistoryState;
}

// @public (undocumented)
export interface HistoryState {
}

// @public (undocumented)
export interface NavigateOptions {
// (undocumented)
ignoreBlocker?: boolean;
}

// @public (undocumented)
export type NavigationBlocker = {
blockerFn: BlockerFn;
enableBeforeUnload?: (() => boolean) | boolean;
};

// @public (undocumented)
export function normalizeProtocolRelative(url: string): string;

// @public (undocumented)
export type ParsedHistoryState = HistoryState & {
key?: string;
__TSR_key?: string;
__TSR_index: number;
};

// @public (undocumented)
export interface ParsedPath {
// (undocumented)
hash: string;
// (undocumented)
href: string;
// (undocumented)
pathname: string;
// (undocumented)
search: string;
}

// @public (undocumented)
export function parseHref(href: string, state: ParsedHistoryState | undefined): HistoryLocation;

// @public (undocumented)
export interface RouterHistory {
// (undocumented)
back: (navigateOpts?: NavigateOptions) => void;
// (undocumented)
block: (blocker: NavigationBlocker) => () => void;
// (undocumented)
canGoBack: () => boolean;
// (undocumented)
createHref: (href: string) => string;
// (undocumented)
destroy: () => void;
// (undocumented)
flush: () => void;
// (undocumented)
forward: (navigateOpts?: NavigateOptions) => void;
// (undocumented)
_getBlockers: () => Array<NavigationBlocker>;
// (undocumented)
go: (index: number, navigateOpts?: NavigateOptions) => void;
// (undocumented)
_ignoreNextBeforeUnload?: (href: string) => void;
// (undocumented)
_ignoreSubscribers?: boolean;
// (undocumented)
length: number;
// (undocumented)
location: HistoryLocation;
// Warning: (ae-forgotten-export) The symbol "SubscriberHistoryAction" needs to be exported by the entry point index.d.ts
//
// (undocumented)
notify: (action: SubscriberHistoryAction) => void;
// (undocumented)
push: (path: string, state?: any, navigateOpts?: NavigateOptions) => void;
// (undocumented)
replace: (path: string, state?: any, navigateOpts?: NavigateOptions) => void;
// (undocumented)
subscribe: (cb: (opts: SubscriberArgs) => void) => () => void;
// Warning: (ae-forgotten-export) The symbol "SubscriberArgs" needs to be exported by the entry point index.d.ts
//
// (undocumented)
subscribers: Set<(opts: SubscriberArgs) => void>;
}

// (No @packageDocumentation comment for this package)

```
2 changes: 1 addition & 1 deletion packages/history/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js",
"test:types:ts60": "tsc6",
"test:types:ts70": "tsc",
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack . && node ../../scripts/check-published-types.mjs",
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack . && node ../../scripts/check-published-types.mjs && node ../../scripts/api-report.mjs --check",
"test:unit": "vitest",
"test:unit:dev": "pnpm run test:unit --watch",
"compile": "tsc6 -p tsconfig.internal.json",
Expand Down
Loading
Loading