diff --git a/packages/compiler-test-utils/src/app-directory.ts b/packages/compiler-test-utils/src/app-directory.ts index 9bbac08438..45d01186b6 100644 --- a/packages/compiler-test-utils/src/app-directory.ts +++ b/packages/compiler-test-utils/src/app-directory.ts @@ -161,7 +161,7 @@ function withoutPrivilege(error: unknown): boolean { * packages (see `linkType`): the app resolves its bare imports through it * as from `target`'s place. */ -export function linkDirectorySync(target: string, link: string): void { +function linkDirectorySync(target: string, link: string): void { try { symlinkSync(target, link, linkType) } catch (error) { diff --git a/packages/compiler-test-utils/src/console-hook.ts b/packages/compiler-test-utils/src/console-hook.ts index f32ff52df8..3bd8f251fc 100644 --- a/packages/compiler-test-utils/src/console-hook.ts +++ b/packages/compiler-test-utils/src/console-hook.ts @@ -35,7 +35,7 @@ const activeSinks = new AsyncLocalStorage>() export type ConsoleMethod = 'error' | 'warn' | 'log' | 'info' | 'debug' -export const consoleMethods: ReadonlyArray = [ +const consoleMethods: ReadonlyArray = [ 'error', 'warn', 'log', diff --git a/packages/compiler-test-utils/src/diagnostic-channel.ts b/packages/compiler-test-utils/src/diagnostic-channel.ts index 249a4f6763..63029ac26b 100644 --- a/packages/compiler-test-utils/src/diagnostic-channel.ts +++ b/packages/compiler-test-utils/src/diagnostic-channel.ts @@ -113,7 +113,7 @@ const consoleSeverities: Record = { } /** The text of `console.*` arguments, as the console would print them. */ -export function consoleText(args: Array) { +function consoleText(args: Array) { return stripVTControlCharacters( args .map((arg) => diff --git a/packages/compiler-test-utils/src/plugin-host.ts b/packages/compiler-test-utils/src/plugin-host.ts index ddf71abc92..ec11028dec 100644 --- a/packages/compiler-test-utils/src/plugin-host.ts +++ b/packages/compiler-test-utils/src/plugin-host.ts @@ -167,7 +167,7 @@ export interface PluginHost { } /** The page the host serves for `runClient`. */ -export const hostPagePath = '/__plugin-host__/page.html' +const hostPagePath = '/__plugin-host__/page.html' const hostPageHtml = ` diff --git a/packages/compiler-test-utils/src/rsbuild-dev-server.ts b/packages/compiler-test-utils/src/rsbuild-dev-server.ts index 5d1fda7aeb..d922f8d26c 100644 --- a/packages/compiler-test-utils/src/rsbuild-dev-server.ts +++ b/packages/compiler-test-utils/src/rsbuild-dev-server.ts @@ -1185,7 +1185,7 @@ const nonAppDirectories = new Set(['node_modules', 'dist', '.git']) * How long before the dev server starts its initial files were last * modified: more than watchpack's coarsest modification-time accuracy (2 s). */ -export const initialFilesAge = 10_000 +const initialFilesAge = 10_000 /** * Dates the app's initial files `initialFilesAge` back: a user starts the diff --git a/packages/router-generator/src/analyze/route-file.ts b/packages/router-generator/src/analyze/route-file.ts index 638d00d943..4c75e34030 100644 --- a/packages/router-generator/src/analyze/route-file.ts +++ b/packages/router-generator/src/analyze/route-file.ts @@ -5,7 +5,7 @@ import type { CodeStyle } from '../print/style' import type { RouteProps } from '../types' import type { CallExpression, Expression, Node, SourceFile } from 'yuku' -export type RouteConstructorName = 'createFileRoute' | 'createLazyFileRoute' +type RouteConstructorName = 'createFileRoute' | 'createLazyFileRoute' const routeConstructors: ReadonlyArray = [ 'createFileRoute', @@ -46,7 +46,7 @@ export type RouteFileAnalysis = diagnostics: Array } -export interface RouteFileExpectation { +interface RouteFileExpectation { /** The route id the file's location implies. */ routeId: string /** Whether the file is a `.lazy` route file (`createLazyFileRoute`). */ diff --git a/packages/router-generator/src/filesystem/physical/getRouteNodes.ts b/packages/router-generator/src/filesystem/physical/getRouteNodes.ts index 2c97622fd0..6dc26e3802 100644 --- a/packages/router-generator/src/filesystem/physical/getRouteNodes.ts +++ b/packages/router-generator/src/filesystem/physical/getRouteNodes.ts @@ -433,7 +433,7 @@ export function isRootRouteFile(node: RouteNode) { * @param tokenRegexes - Pre-compiled token regexes for matching. * @returns An object containing the type of the route and the variable name derived from the route path. */ -export function getRouteMeta( +function getRouteMeta( routePath: string, originalRoutePath: string, tokenRegexes: TokenRegexBundle, diff --git a/packages/router-generator/src/filesystem/virtual/getRouteNodes.ts b/packages/router-generator/src/filesystem/virtual/getRouteNodes.ts index 61ad218bfa..36678cb528 100644 --- a/packages/router-generator/src/filesystem/virtual/getRouteNodes.ts +++ b/packages/router-generator/src/filesystem/virtual/getRouteNodes.ts @@ -132,7 +132,7 @@ async function getVirtualRouteConfigFromFileExport( return virtualRootRouteSchema.parse(virtualRouteConfig) } -export async function getRouteNodesRecursive( +async function getRouteNodesRecursive( tsrConfig: Pick< Config, | 'routesDirectory' diff --git a/packages/router-generator/src/generator.ts b/packages/router-generator/src/generator.ts index 3023b88cc9..c8ef2ad64a 100644 --- a/packages/router-generator/src/generator.ts +++ b/packages/router-generator/src/generator.ts @@ -181,7 +181,7 @@ function sameProps(a: RouteProps | undefined, b: RouteProps | undefined) { } /** A route file no earlier read of the generator knows does not parse: it fails a build that does not watch (R86). */ -export class UnparsableRouteFileError extends RouteGenerationError {} +class UnparsableRouteFileError extends RouteGenerationError {} UnparsableRouteFileError.prototype.name = 'UnparsableRouteFileError' function formatDiagnostic(file: string, diagnostic: FileDiagnostic) { diff --git a/packages/router-generator/src/index.ts b/packages/router-generator/src/index.ts index 5d1e896548..3285ed0170 100644 --- a/packages/router-generator/src/index.ts +++ b/packages/router-generator/src/index.ts @@ -40,7 +40,5 @@ export { getRouteNodes as virtualGetRouteNodes } from './filesystem/virtual/getR export { rootPathId } from './filesystem/physical/rootPathId' -export { watchRouteFiles } from './watch/chokidar' -export type { RouteFileWatcher } from './watch/chokidar' export { createGeneratorSession } from './watch/session' export type { GeneratorSession } from './watch/session' diff --git a/packages/router-generator/src/model/build.ts b/packages/router-generator/src/model/build.ts index ba7b959a97..e3bc6695fe 100644 --- a/packages/router-generator/src/model/build.ts +++ b/packages/router-generator/src/model/build.ts @@ -45,7 +45,7 @@ const componentPieceRegex = /[./](component|errorComponent|notFoundComponent|pendingComponent|loader|lazy)[.]/ const routeGroupPatternRegex = /\(.+\)/ -export interface TreeModelInput { +interface TreeModelInput { scan: ScanResult config: Pick /** Whether a route file joins the tree (its analysis found a route). */ diff --git a/packages/router-generator/src/print/tree.ts b/packages/router-generator/src/print/tree.ts index b3ca16a0b8..407f95dfce 100644 --- a/packages/router-generator/src/print/tree.ts +++ b/packages/router-generator/src/print/tree.ts @@ -5,7 +5,7 @@ import { key, lit } from './style' import type { CodeStyle } from './style' import type { ModelRoute, RoutePieceName, TreeModel } from '../types' -export interface PrintTreeOptions { +interface PrintTreeOptions { style: CodeStyle disableTypes: boolean /** The router package the tree imports its runtime from (`@tanstack/react-router`). */ diff --git a/packages/router-generator/src/scaffold/templates.ts b/packages/router-generator/src/scaffold/templates.ts index 4c75510bd5..62c2b6337b 100644 --- a/packages/router-generator/src/scaffold/templates.ts +++ b/packages/router-generator/src/scaffold/templates.ts @@ -2,9 +2,9 @@ import { lit } from '../print/style' import type { CodeStyle } from '../print/style' import type { Config } from '../config' -export type ScaffoldKind = 'root' | 'route' | 'lazy' +type ScaffoldKind = 'root' | 'route' | 'lazy' -export interface ScaffoldOptions { +interface ScaffoldOptions { target: Config['target'] kind: ScaffoldKind /** The route id (`__root` for the root route). */ diff --git a/packages/router-generator/src/utils.ts b/packages/router-generator/src/utils.ts index cffa25fbc9..53f52aa1c3 100644 --- a/packages/router-generator/src/utils.ts +++ b/packages/router-generator/src/utils.ts @@ -256,7 +256,7 @@ export function hasEscapedLeadingUnderscore(originalSegment: string): boolean { * - Segment ends with [_] pattern: "blog[_]" -> "blog_" * - Segment is fully escaped and content ends with _: "[_r0ut3_]" -> "_r0ut3_" */ -export function hasEscapedTrailingUnderscore(originalSegment: string): boolean { +function hasEscapedTrailingUnderscore(originalSegment: string): boolean { // Pattern: something[_] or [something_] return ( originalSegment.endsWith('[_]') || @@ -294,7 +294,7 @@ export function countSlashSeparatedParts(path: string): number { return count } -export function hasRoutePathSegmentMetadata( +function hasRoutePathSegmentMetadata( metadata: RoutePathSegmentMetadata | undefined, ): metadata is RoutePathSegmentMetadata { return !!( @@ -681,7 +681,7 @@ export function removeGroups(s: string) { * @example * removeLayoutSegments('/workspace/_auth/foo') // '/workspace/foo' */ -export function removeLayoutSegments(routePath: string = '/'): string { +function removeLayoutSegments(routePath: string = '/'): string { const segments = routePath.split('/') const newSegments = segments.filter((segment) => !segment.startsWith('_')) return newSegments.join('/') diff --git a/packages/router-plugin/src/core/config.ts b/packages/router-plugin/src/core/config.ts index e65bc627fe..312aaad888 100644 --- a/packages/router-plugin/src/core/config.ts +++ b/packages/router-plugin/src/core/config.ts @@ -41,7 +41,7 @@ export function groupingsProblem(value: unknown): string | null { return null } -export const splitGroupingsSchema = z +const splitGroupingsSchema = z .custom(() => true) .superRefine((value, ctx) => { const problem = groupingsProblem(value) diff --git a/packages/router-plugin/src/core/router-plugin-context.ts b/packages/router-plugin/src/core/router-plugin-context.ts index f1da277315..0d2208a441 100644 --- a/packages/router-plugin/src/core/router-plugin-context.ts +++ b/packages/router-plugin/src/core/router-plugin-context.ts @@ -6,7 +6,7 @@ export type RouterPluginContext = { routesByFile: GetRoutesByFileMapResult } -export type RoutesChangedListener = ( +type RoutesChangedListener = ( next: GetRoutesByFileMapResult, previous: GetRoutesByFileMapResult, ) => void diff --git a/packages/router-plugin/src/hosts/session.ts b/packages/router-plugin/src/hosts/session.ts index 4095814e9e..dc28d88c72 100644 --- a/packages/router-plugin/src/hosts/session.ts +++ b/packages/router-plugin/src/hosts/session.ts @@ -49,7 +49,7 @@ import type { export type Bundler = 'vite' | 'rspack' | 'webpack' -export interface RouterCompilerOptions { +interface RouterCompilerOptions { context: RouterPluginContext config: Config /** The project root: messages name files relative to it. */ @@ -58,7 +58,7 @@ export interface RouterCompilerOptions { mode: 'dev' | 'build' } -export interface CompileRequest { +interface CompileRequest { /** The bundler's module id (path with query). */ id: string code: string diff --git a/packages/router-plugin/src/hosts/vite.ts b/packages/router-plugin/src/hosts/vite.ts index e75724c8b5..38079c3532 100644 --- a/packages/router-plugin/src/hosts/vite.ts +++ b/packages/router-plugin/src/hosts/vite.ts @@ -38,7 +38,7 @@ import type { Config } from '../core/config' import type { ModuleGraphLike } from '@tanstack/router-utils/compiler' import type { Plugin, ViteDevServer } from 'vite' -export const CODE_SPLITTER_PLUGIN_NAME = +const CODE_SPLITTER_PLUGIN_NAME = 'tanstack-router:code-splitter:compile-reference-file' type TransformationPluginInfo = { diff --git a/packages/router-plugin/src/hosts/webpack.ts b/packages/router-plugin/src/hosts/webpack.ts index 63350dd574..2638549491 100644 --- a/packages/router-plugin/src/hosts/webpack.ts +++ b/packages/router-plugin/src/hosts/webpack.ts @@ -40,7 +40,7 @@ import type { WatchingCompilerLike, } from '@tanstack/router-utils/compiler' -export type WebpackPluginOptions = Partial | (() => Partial) +type WebpackPluginOptions = Partial | (() => Partial) /** The parts of a webpack / Rspack compiler the host uses. */ export interface CompilerLike extends WatchingCompilerLike { @@ -89,7 +89,7 @@ const JS_FILE_RE = /\.[cm]?[jt]sx?$/ let loaderPath: string | null = null /** The static loader file of this package (`loader/index.cjs`), found from the package root. */ -export function routerLoaderPath(): string { +function routerLoaderPath(): string { if (loaderPath) { return loaderPath } diff --git a/packages/router-plugin/src/planners/config.ts b/packages/router-plugin/src/planners/config.ts index c6c8598bce..956a2917ff 100644 --- a/packages/router-plugin/src/planners/config.ts +++ b/packages/router-plugin/src/planners/config.ts @@ -24,7 +24,7 @@ export interface RouterPlannerConfig { hmr: { style: HmrStyle } | null } -export interface RouterPlannerEnv { +interface RouterPlannerEnv { framework: RouterPlannerConfig['framework'] envType: 'client' | 'server' mode: 'dev' | 'build' diff --git a/packages/router-plugin/src/planners/decisions.ts b/packages/router-plugin/src/planners/decisions.ts index 9d89e984c7..2995cbf5a6 100644 --- a/packages/router-plugin/src/planners/decisions.ts +++ b/packages/router-plugin/src/planners/decisions.ts @@ -28,7 +28,7 @@ import type { } from '@tanstack/router-utils/compiler' import type { Node } from 'yuku' -export type SplitShape = 'init' | 'method' | 'shorthand' +type SplitShape = 'init' | 'method' | 'shorthand' export interface SplitDecision { /** The route option (`component`, `loader`, …). */ @@ -56,7 +56,7 @@ export interface SplitDecision { member: string | null } -export type NotSplitReason = +type NotSplitReason = | 'shared-writer' | 'multi-writer' | 'ordered-effect' @@ -67,7 +67,7 @@ export type NotSplitReason = | 'reassigned' | 'loader-object' -export interface NotSplit { +interface NotSplit { key: string reason: NotSplitReason range: Range diff --git a/packages/router-plugin/src/planners/route.ts b/packages/router-plugin/src/planners/route.ts index d863fbdef6..36452d3840 100644 --- a/packages/router-plugin/src/planners/route.ts +++ b/packages/router-plugin/src/planners/route.ts @@ -24,9 +24,9 @@ import type { Node } from 'yuku' import type { CodeSplitGroupings } from '../core/constants' import type { RouterPlannerConfig } from './config' -export type RouteKind = 'file' | 'root' | 'lazy' +type RouteKind = 'file' | 'root' | 'lazy' -export type RouteFactory = +type RouteFactory = | 'createFileRoute' | 'createRootRoute' | 'createRootRouteWithContext' @@ -46,9 +46,9 @@ const FACTORIES: ReadonlySet = new Set([ ]) /** Packages whose `createFileRoute` & co. are the router's. */ -export const ROUTER_PACKAGE_RE = /^@tanstack\/(react|solid|vue)-router(\/|$)/ +const ROUTER_PACKAGE_RE = /^@tanstack\/(react|solid|vue)-router(\/|$)/ -export type OptionKind = +type OptionKind = | 'init' | 'method' | 'shorthand' @@ -68,7 +68,7 @@ export interface RouteOption { keyText: string } -export type OptionsResolution = +type OptionsResolution = | { kind: 'object'; node: Node } | { kind: 'opaque'; reason: 'imported' | 'call' | 'written' | 'other' } /** `createRootRoute()`: no options to split or remove */ @@ -98,7 +98,7 @@ export interface RouteModuleInfo { routeId: string | null } -export type RouteRecognition = +type RouteRecognition = | { route: RouteModuleInfo; warnings: Array } | { route: null; warnings: Array } diff --git a/packages/start-plugin-core/src/compiler/session.ts b/packages/start-plugin-core/src/compiler/session.ts index fdab287939..c22293f874 100644 --- a/packages/start-plugin-core/src/compiler/session.ts +++ b/packages/start-plugin-core/src/compiler/session.ts @@ -246,7 +246,7 @@ export class StartCompilerSession { return cfg } - envInfo(env: StartCompilerEnvironment, layer?: string): EnvInfo { + private envInfo(env: StartCompilerEnvironment, layer?: string): EnvInfo { return { name: env.name, type: env.type, diff --git a/packages/start-plugin-core/src/import-protection/rules.ts b/packages/start-plugin-core/src/import-protection/rules.ts index 87b0fb6fa2..93643d2256 100644 --- a/packages/start-plugin-core/src/import-protection/rules.ts +++ b/packages/start-plugin-core/src/import-protection/rules.ts @@ -64,7 +64,7 @@ export function relativeTargetPath( } /** Whether the resolved target skips the file and marker rules (`excludeFiles`). */ -export function targetExcluded( +function targetExcluded( rules: ImportProtectionEnvRules, relativePath: string, ): boolean { @@ -75,7 +75,7 @@ export function targetExcluded( } /** The file rule matching the resolved target's root-relative path, if any. */ -export function matchFile( +function matchFile( rules: ImportProtectionEnvRules, relativePath: string, ): RuleRef | null { diff --git a/packages/start-plugin-core/src/import-protection/violations.ts b/packages/start-plugin-core/src/import-protection/violations.ts index 3ae57e64cb..a9b0f423fa 100644 --- a/packages/start-plugin-core/src/import-protection/violations.ts +++ b/packages/start-plugin-core/src/import-protection/violations.ts @@ -78,7 +78,7 @@ export interface RenderedUse { } /** The edge key of a module's own violation (`EdgeViolation.self`) in an environment. */ -export function selfEdgeKey(canonicalId: string): string { +function selfEdgeKey(canonicalId: string): string { return `self\u0000${canonicalId}` }