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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ types
build
*/build
dist
dist-ts
.output
lib
es
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
**/build
**/coverage
**/dist
**/dist-ts
pnpm-lock.yaml
**/snapshots
**/.vercel
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
- For sandbox-blocked registry/store access, escalate the same command; report the blocker if unavailable. Do not change stores, delete dependencies/lockfiles, use `--force`/`--ignore-scripts`, or weaken workspace trust/build policies to bypass it.
- Never manually edit `pnpm-lock.yaml` or any `routeTree.gen.ts`. Regenerate the lockfile with `pnpm install --no-frozen-lockfile` after intentional dependency changes; regenerate route trees through app builds/dev servers or the generator fixture harness.
- Always use control-flow braces. Run `pnpm format` before validation.
- Use Nx: workspace imports consume built packages, so direct runners can test stale dependencies. Inspect resolved targets with `pnpm nx show project <project> --json`; some are inferred.
- Use Nx: at runtime, workspace imports consume built packages, so direct runners can test stale dependencies. Inspect resolved targets with `pnpm nx show project <project> --json`; some are inferred.
- In `packages/*`, type checks read a workspace dependency's `dist-ts`. Its `compile` target (`tsc6 -p tsconfig.internal.json`) writes that set with `stripInternal: false`, and `packages/tsconfig.paths.json` maps each `@tanstack/*` entry point to it for types only. Nx compiles the dependencies before `build`, `test:types`, `test:eslint` and `test:unit`; run `compile` for them yourself before a direct `tsc`, ESLint or editor check. After changing a package's `exports` or workspace dependencies, run `node scripts/internal-types-config.mjs` to regenerate the map, each `tsconfig.internal.json` and the `references`; the root `test:unit` fails while they are stale. A package's imports of its own specifiers map to its `src` in its `tsconfig.json`.
- Run finite validation through `run-many` with explicit projects and targets, including a single project/target. Nx automatically selects `summary` output when it detects an AI agent: omit `--outputStyle` for normal runs. Read the reported full log files for failures; use `--outputStyle=summary` if agent detection is unavailable.
- Use `--outputStyle=static` or `pnpm nx run <project>:<target>` only when diagnosing a task and its full output is needed. Continuous/watch targets may use live output.

Expand Down
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import unusedImports from 'eslint-plugin-unused-imports'
/** @type {import('eslint').Linter.Config[]} */
export default [
...tanstackConfig,
{
// The internal declarations written by each package's `compile` target.
name: 'tanstack/internal-declarations',
ignores: ['**/dist-ts/**'],
},
{
name: 'tanstack/temp',
rules: {
Expand Down
128 changes: 86 additions & 42 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"{workspaceRoot}/.nx/workflows/ultracache-config.yaml",
"{workspaceRoot}/.nvmrc",
"{workspaceRoot}/package.json",
"{workspaceRoot}/tsconfig.json"
"{workspaceRoot}/tsconfig.json",
"{workspaceRoot}/packages/tsconfig.base.json",
"{workspaceRoot}/packages/tsconfig.paths.json"
],
"dependentTaskOutputs": [
{
Expand Down Expand Up @@ -47,27 +49,43 @@
"cache": true,
"inputs": ["sharedGlobals", "{workspaceRoot}/docs/**/*"]
},
"test:eslint": {
"cache": true,
"dependsOn": ["^build", "build"],
"inputs": [
"default",
"^production",
"{workspaceRoot}/eslint.config.js",
"dependentTaskOutputs"
]
},
"test:unit": {
"cache": true,
"dependsOn": ["^build"],
"inputs": [
"default",
"^production",
"{workspaceRoot}/eslint.config.js",
"dependentTaskOutputs"
],
"outputs": ["{projectRoot}/coverage"]
},
"test:eslint": [
{
"cache": true,
"dependsOn": ["^build", "build"],
"inputs": [
"default",
"^production",
"{workspaceRoot}/eslint.config.js",
"dependentTaskOutputs"
]
},
{
"filter": {
"projects": ["packages/*"]
},
"dependsOn": ["^compile"]
}
],
"test:unit": [
{
"cache": true,
"dependsOn": ["^build"],
"inputs": [
"default",
"^production",
"{workspaceRoot}/eslint.config.js",
"dependentTaskOutputs"
],
"outputs": ["{projectRoot}/coverage"]
},
{
"filter": {
"projects": ["packages/*"]
},
"dependsOn": ["^build", "^compile"]
}
],
"test:e2e": {
"cache": true,
"dependsOn": ["^build", "test:e2e--*"],
Expand All @@ -93,16 +111,24 @@
"inputs": ["default", "^production"],
"parallelism": false
},
"test:types": {
"cache": true,
"dependsOn": ["^build", "build"],
"inputs": [
"default",
"^production",
"{workspaceRoot}/eslint.config.js",
"dependentTaskOutputs"
]
},
"test:types": [
{
"cache": true,
"dependsOn": ["^build", "build"],
"inputs": [
"default",
"^production",
"{workspaceRoot}/eslint.config.js",
"dependentTaskOutputs"
]
},
{
"filter": {
"projects": ["packages/*"]
},
"dependsOn": ["^compile"]
}
],
"test:types:client": {
"cache": true,
"inputs": [
Expand Down Expand Up @@ -133,18 +159,36 @@
"dependentTaskOutputs"
]
},
"build": {
"compile": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["buildProduction", "^buildProduction", "dependentTaskOutputs"],
"outputs": [
"{projectRoot}/.netlify",
"{projectRoot}/.wrangler",
"{projectRoot}/.output",
"{projectRoot}/build",
"{projectRoot}/dist"
]
"dependsOn": ["^compile"],
"inputs": ["production", "dependentTaskOutputs"],
"outputs": ["{projectRoot}/dist-ts"]
},
"build": [
{
"cache": true,
"dependsOn": ["^build"],
"inputs": [
"buildProduction",
"^buildProduction",
"dependentTaskOutputs"
],
"outputs": [
"{projectRoot}/.netlify",
"{projectRoot}/.wrangler",
"{projectRoot}/.output",
"{projectRoot}/build",
"{projectRoot}/dist"
]
},
{
"filter": {
"projects": ["packages/*"]
},
"dependsOn": ["^build", "^compile"]
}
],
"test:build": {
"cache": true,
"dependsOn": ["build"],
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,21 @@
],
"targets": {
"test:unit": {
"command": "node --test scripts/check-published-types.test.mjs",
"command": "node --test scripts/check-published-types.test.mjs scripts/internal-types-config.test.mjs",
"dependsOn": [],
"inputs": [
"{workspaceRoot}/scripts/check-published-types.mjs",
"{workspaceRoot}/scripts/check-published-types.test.mjs",
"{workspaceRoot}/scripts/internal-types-config.mjs",
"{workspaceRoot}/scripts/internal-types-config.test.mjs",
"{workspaceRoot}/tsconfig.json",
"{workspaceRoot}/prettier.config.js",
"{workspaceRoot}/packages/**/*",
{
"externalDependencies": [
"typescript",
"@types/node"
"@types/node",
"prettier"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion packages/arktype-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"typescript"
],
"scripts": {
"clean": "rimraf ./dist && rimraf ./coverage",
"clean": "rimraf ./dist ./dist-ts && rimraf ./coverage",
"test:eslint": "eslint ./src",
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
Expand All @@ -36,6 +36,7 @@
"test:unit": "vitest",
"test:unit:dev": "pnpm run test:unit --watch --typecheck",
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack . && node ../../scripts/check-published-types.mjs",
"compile": "tsc6 -p tsconfig.internal.json",
"build": "vite build"
},
"type": "module",
Expand Down
16 changes: 16 additions & 0 deletions packages/arktype-adapter/tsconfig.internal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Generated by scripts/internal-types-config.mjs. Do not edit.
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"stripInternal": false,
"rootDir": "./src",
"outDir": "./dist-ts",
"tsBuildInfoFile": "./dist-ts/tsconfig.internal.tsbuildinfo"
},
"include": ["src"],
"references": [{ "path": "../react-router/tsconfig.internal.json" }]
}
5 changes: 3 additions & 2 deletions packages/arktype-adapter/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"jsx": "react-jsx"
},
"include": ["src", "tests", "vite.config.ts"]
"include": ["src", "tests", "vite.config.ts"],
"references": [{ "path": "../react-router/tsconfig.internal.json" }]
}
3 changes: 2 additions & 1 deletion packages/eslint-plugin-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/sponsors/tannerlinsley"
},
"scripts": {
"clean": "rimraf ./dist ./coverage",
"clean": "rimraf ./dist ./dist-ts ./coverage",
"test:eslint": "eslint ./src",
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
Expand All @@ -27,6 +27,7 @@
"test:unit": "vitest",
"test:unit:dev": "pnpm run test:unit --watch --typecheck",
"test:build": "publint --strict && attw --pack . && node ../../scripts/check-published-types.mjs",
"compile": "tsc6 -p tsconfig.internal.json",
"build": "vite build && tsc --noEmit"
},
"type": "module",
Expand Down
15 changes: 15 additions & 0 deletions packages/eslint-plugin-router/tsconfig.internal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Generated by scripts/internal-types-config.mjs. Do not edit.
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"stripInternal": false,
"rootDir": "./src",
"outDir": "./dist-ts",
"tsBuildInfoFile": "./dist-ts/tsconfig.internal.tsbuildinfo"
},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/eslint-plugin-router/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"moduleResolution": "Bundler"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin-start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/sponsors/tannerlinsley"
},
"scripts": {
"clean": "rimraf ./dist ./coverage",
"clean": "rimraf ./dist ./dist-ts ./coverage",
"test:eslint": "eslint ./src",
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
Expand All @@ -27,6 +27,7 @@
"test:unit": "vitest",
"test:unit:dev": "pnpm run test:unit --watch --typecheck",
"test:build": "publint --strict && attw --pack . && node ../../scripts/check-published-types.mjs",
"compile": "tsc6 -p tsconfig.internal.json",
"build": "vite build && tsc --noEmit"
},
"type": "module",
Expand Down
15 changes: 15 additions & 0 deletions packages/eslint-plugin-start/tsconfig.internal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Generated by scripts/internal-types-config.mjs. Do not edit.
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"stripInternal": false,
"rootDir": "./src",
"outDir": "./dist-ts",
"tsBuildInfoFile": "./dist-ts/tsconfig.internal.tsbuildinfo"
},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/eslint-plugin-start/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"moduleResolution": "Bundler",
"types": ["node"]
Expand Down
3 changes: 2 additions & 1 deletion packages/history/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"typescript"
],
"scripts": {
"clean": "rimraf ./dist && rimraf ./coverage",
"clean": "rimraf ./dist ./dist-ts && rimraf ./coverage",
"test:eslint": "eslint ./src",
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
Expand All @@ -31,6 +31,7 @@
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack . && node ../../scripts/check-published-types.mjs",
"test:unit": "vitest",
"test:unit:dev": "pnpm run test:unit --watch",
"compile": "tsc6 -p tsconfig.internal.json",
"build": "vite build"
},
"type": "module",
Expand Down
15 changes: 15 additions & 0 deletions packages/history/tsconfig.internal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Generated by scripts/internal-types-config.mjs. Do not edit.
{
"extends": "./tsconfig.build.json",
"compilerOptions": {
"composite": true,
"declaration": true,
"emitDeclarationOnly": true,
"noEmit": false,
"stripInternal": false,
"rootDir": "./src",
"outDir": "./dist-ts",
"tsBuildInfoFile": "./dist-ts/tsconfig.internal.tsbuildinfo"
},
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/history/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "../../tsconfig.json",
"extends": "../tsconfig.base.json",
"include": ["src", "vite.config.ts"]
}
Loading
Loading