From 459446bafb268106b28b881c407998afd756e839 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Fri, 5 Apr 2024 16:37:54 +0200 Subject: [PATCH] chore: resolve linting issues --- README.md | 2 +- package.json | 2 +- src/cli/bin.ts | 12 +-- src/cli/createServer.ts | 2 +- src/cli/resolveOptions.ts | 14 ++-- src/data/AtlasFileSource.ts | 80 +++++++++---------- src/data/MetroGraphSource.ts | 10 +-- src/data/__tests__/atlas.test.ts | 22 ++--- src/data/types.ts | 6 +- src/metro.ts | 13 ++- src/utils/env.ts | 4 +- src/utils/errors.ts | 10 +-- src/utils/middleware.ts | 4 +- webui/metro.config.js | 6 +- .../app/(atlas)/[entry]/folders/[path].tsx | 2 +- webui/src/app/(atlas)/[entry]/index.tsx | 2 +- .../app/(atlas)/[entry]/modules/[path].tsx | 2 +- .../--/entries/[entry]/modules/index+api.ts | 2 +- webui/src/components/Page.tsx | 6 +- webui/src/components/forms/EntrySelect.tsx | 2 +- webui/src/providers/entries.tsx | 2 +- 21 files changed, 102 insertions(+), 103 deletions(-) diff --git a/README.md b/README.md index eb7003d..fbcbe6b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Expo Atlas -Inspect the bundle stats from Metro. +Inspect bundle contents, on module level, from Metro. > [!Warning] > This project is highly experimental and will likely not work for your project. diff --git a/package.json b/package.json index 80649b4..4bd8f0b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "sideEffects": false, "name": "expo-atlas", "version": "0.0.18-preview.2", - "description": "Inspect bundle stats from Metro", + "description": "Inspect bundle contents, on module level, from Metro", "keywords": [ "expo", "atlas", diff --git a/src/cli/bin.ts b/src/cli/bin.ts index 6bbc380..fa5d361 100644 --- a/src/cli/bin.ts +++ b/src/cli/bin.ts @@ -29,7 +29,7 @@ if (args['--version']) { if (args['--help']) { printLines([ chalk.bold('Usage'), - ` ${chalk.dim('$')} expo-atlas ${chalk.dim('[statsFile]')}`, + ` ${chalk.dim('$')} expo-atlas ${chalk.dim('[atlas file]')}`, '', chalk.bold('Options'), ` --port${chalk.dim(', -p')} Port to listen on`, @@ -52,7 +52,7 @@ async function run() { printLines([ `Expo Atlas is ready on: ${chalk.underline(href)}`, - ` ${chalk.dim(`Using: ${options.statsFile}`)}`, + ` ${chalk.dim(`Using: ${options.atlasFile}`)}`, ]); if (options.browserOpen) { @@ -72,10 +72,10 @@ run().catch((error) => { throw error; } - if (error.code === 'STATS_FILE_INCOMPATIBLE') { - const statsFile = path.relative(process.cwd(), error.statsFile); - console.error('Stats file is incompatible with this version, use this instead:'); - console.error(` npx expo-atlas@${error.incompatibleVersion} ${statsFile}`); + if (error.code === 'ATLAS_FILE_INCOMPATIBLE') { + const atlasFile = path.relative(process.cwd(), error.filePath); + console.error('Atlas file is incompatible with this version, use this instead:'); + console.error(` npx expo-atlas@${error.incompatibleVersion} ${atlasFile}`); } else { console.error(`${error.message} (${error.code})`); } diff --git a/src/cli/createServer.ts b/src/cli/createServer.ts index 27f409b..743f271 100644 --- a/src/cli/createServer.ts +++ b/src/cli/createServer.ts @@ -8,7 +8,7 @@ import { createAtlasMiddleware } from '../utils/middleware'; export function createServer(options: Options) { process.env.NODE_ENV = 'production'; - const source = new AtlasFileSource(options.statsFile); + const source = new AtlasFileSource(options.atlasFile); const middleware = createAtlasMiddleware(source); const baseUrl = '/_expo/atlas'; // Keep in sync with webui `app.json` `baseUrl` diff --git a/src/cli/resolveOptions.ts b/src/cli/resolveOptions.ts index 76cae0a..7f894a6 100644 --- a/src/cli/resolveOptions.ts +++ b/src/cli/resolveOptions.ts @@ -2,20 +2,20 @@ import freeport from 'freeport-async'; import path from 'path'; import { type Input } from './bin'; -import { getAtlasPath, validateAtlasFile } from '../utils/stats'; +import { getAtlasPath, validateAtlasFile } from '../data/AtlasFileSource'; export type Options = Awaited>; export async function resolveOptions(input: Input) { - const statsFile = await resolveStatsFile(input); + const atlasFile = await resolveAtlasFile(input); const port = await resolvePort(input); - return { statsFile, port, browserOpen: input['--no-open'] !== true }; + return { atlasFile, port, browserOpen: input['--no-open'] !== true }; } -async function resolveStatsFile(input: Input) { - const statsFile = input._[0] ?? getAtlasPath(process.cwd()); - await validateAtlasFile(statsFile); - return path.resolve(statsFile); +async function resolveAtlasFile(input: Input) { + const atlasFile = input._[0] ?? getAtlasPath(process.cwd()); + await validateAtlasFile(atlasFile); + return path.resolve(atlasFile); } async function resolvePort(input: Pick) { diff --git a/src/data/AtlasFileSource.ts b/src/data/AtlasFileSource.ts index 0272d44..505d586 100644 --- a/src/data/AtlasFileSource.ts +++ b/src/data/AtlasFileSource.ts @@ -11,31 +11,31 @@ import { appendJsonLine, forEachJsonLines, parseJsonLine } from '../utils/jsonl' export type AtlasMetadata = { name: string; version: string }; export class AtlasFileSource implements AtlasSource { - constructor(public readonly statsPath: string) { + constructor(public readonly filePath: string) { // } listEntries() { - return listAtlasEntries(this.statsPath); + return listAtlasEntries(this.filePath); } getEntry(id: string) { const numeric = parseInt(id, 10); assert(!Number.isNaN(numeric) && numeric > 1, `Invalid entry ID: ${id}`); - return readAtlasEntry(this.statsPath, Number(id)); + return readAtlasEntry(this.filePath, Number(id)); } } /** - * List all stats entries without parsing the data. + * List all entries without parsing the data. * This only reads the bundle name, and adds a line number as ID. */ -export async function listAtlasEntries(statsPath: string) { +export async function listAtlasEntries(filePath: string) { const bundlePattern = /^\["([^"]+)","([^"]+)","([^"]+)/; const entries: PartialAtlasEntry[] = []; - await forEachJsonLines(statsPath, (contents, line) => { - // Skip the stats metadata line + await forEachJsonLines(filePath, (contents, line) => { + // Skip the metadata line if (line === 1) return; const [_, platform, projectRoot, entryPoint] = contents.match(bundlePattern) ?? []; @@ -53,72 +53,72 @@ export async function listAtlasEntries(statsPath: string) { } /** - * Get the stats entry by id or line number, and parse the data. + * Get the entry by id or line number, and parse the data. */ -export async function readAtlasEntry(statsPath: string, id: number): Promise { - const statsEntry = await parseJsonLine(statsPath, id); +export async function readAtlasEntry(filePath: string, id: number): Promise { + const atlasEntry = await parseJsonLine(filePath, id); return { id: String(id), - platform: statsEntry[0], - projectRoot: statsEntry[1], - entryPoint: statsEntry[2], - runtimeModules: statsEntry[3], - modules: new Map(statsEntry[4].map((module) => [module.path, module])), - transformOptions: statsEntry[5], - serializeOptions: statsEntry[6], + platform: atlasEntry[0], + projectRoot: atlasEntry[1], + entryPoint: atlasEntry[2], + runtimeModules: atlasEntry[3], + modules: new Map(atlasEntry[4].map((module) => [module.path, module])), + transformOptions: atlasEntry[5], + serializeOptions: atlasEntry[6], }; } /** Simple promise to avoid mixing appended data */ -let writeStatsQueue: Promise = Promise.resolve(); +let writeQueue: Promise = Promise.resolve(); /** - * Add a new stats entry to the stats file. - * This is appended on a new line, so we can load the stats selectively. + * Add a new entry to the file. + * This is appended on a new line, so we can load the selectively. */ -export function writeAtlasEntry(statsPath: string, stats: AtlasEntry) { - const entry = [ - stats.platform, - stats.projectRoot, - stats.entryPoint, - stats.runtimeModules, - Array.from(stats.modules.values()), - stats.transformOptions, - stats.serializeOptions, +export function writeAtlasEntry(filePath: string, entry: AtlasEntry) { + const line = [ + entry.platform, + entry.projectRoot, + entry.entryPoint, + entry.runtimeModules, + Array.from(entry.modules.values()), + entry.transformOptions, + entry.serializeOptions, ]; - return (writeStatsQueue = writeStatsQueue.then(() => appendJsonLine(statsPath, entry))); + return (writeQueue = writeQueue.then(() => appendJsonLine(filePath, line))); } -/** The default location of the metro stats file */ +/** The default location of the metro file */ export function getAtlasPath(projectRoot: string) { return path.join(projectRoot, '.expo/atlas.jsonl'); } -/** The information to validate if a stats file is compatible with this library version */ +/** The information to validate if a file is compatible with this library version */ export function getAtlasMetdata(): AtlasMetadata { return { name, version }; } -/** Validate if the stats file is compatible with this library version */ -export async function validateAtlasFile(statsFile: string, metadata = getAtlasMetdata()) { - if (!fs.existsSync(statsFile)) { - throw new AtlasValidationError('STATS_FILE_NOT_FOUND', statsFile); +/** Validate if the file is compatible with this library version */ +export async function validateAtlasFile(filePath: string, metadata = getAtlasMetdata()) { + if (!fs.existsSync(filePath)) { + throw new AtlasValidationError('ATLAS_FILE_NOT_FOUND', filePath); } - if (env.EXPO_ATLAS_NO_STATS_VALIDATION) { + if (env.EXPO_ATLAS_NO_VALIDATION) { return; } - const data = await parseJsonLine(statsFile, 1); + const data = await parseJsonLine(filePath, 1); if (data.name !== metadata.name || data.version !== metadata.version) { - throw new AtlasValidationError('STATS_FILE_INCOMPATIBLE', statsFile, data.version); + throw new AtlasValidationError('ATLAS_FILE_INCOMPATIBLE', filePath, data.version); } } /** - * Create or overwrite the stats file with basic metadata. + * Create or overwrite the file with basic metadata. * This metdata is used by the API to determine version compatibility. */ export async function createAtlasFile(filePath: string) { diff --git a/src/data/MetroGraphSource.ts b/src/data/MetroGraphSource.ts index c273d85..e2880e6 100644 --- a/src/data/MetroGraphSource.ts +++ b/src/data/MetroGraphSource.ts @@ -21,7 +21,7 @@ type ConvertGraphToAtlasOptions = { }; export class MetroGraphSource implements AtlasSource { - /** All known stats entries, stored by ID */ + /** All known entries, stored by ID */ protected entries: Map = new Map(); listEntries() { @@ -36,14 +36,14 @@ export class MetroGraphSource implements AtlasSource { getEntry(id: string) { const entry = this.entries.get(id); if (!entry) { - throw new Error(`Stats entry "${id}" not found.`); + throw new Error(`Entry "${id}" not found.`); } return entry; } /** * Event handler when a new graph instance is ready to serialize. - * This converts all relevant data stored in the graph to stats objects. + * This converts all relevant data stored in the graph to objects. */ onSerializeGraph(options: ConvertGraphToAtlasOptions) { const entry = convertGraph(options); @@ -52,7 +52,7 @@ export class MetroGraphSource implements AtlasSource { } } -/** Convert a Metro graph instance to a JSON-serializable stats entry */ +/** Convert a Metro graph instance to a JSON-serializable entry */ export function convertGraph(options: ConvertGraphToAtlasOptions): AtlasEntry { const serializeOptions = convertSerializeOptions(options); const transformOptions = convertTransformOptions(options); @@ -92,7 +92,7 @@ export function collectEntryPointModules( return modules; } -/** Convert a Metro module to a JSON-serializable stats module */ +/** Convert a Metro module to a JSON-serializable Atlas module */ export function convertModule( options: Pick, module: MetroModule diff --git a/src/data/__tests__/atlas.test.ts b/src/data/__tests__/atlas.test.ts index 5c0d85e..81756dc 100644 --- a/src/data/__tests__/atlas.test.ts +++ b/src/data/__tests__/atlas.test.ts @@ -17,14 +17,14 @@ describe('getAtlasPath', () => { }); }); -describe('getStatsMetadata', () => { +describe('getAtlasMetdata', () => { it('returns package name and version', () => { expect(getAtlasMetdata()).toMatchObject({ name, version }); }); }); describe('createAtlasFile', () => { - it('creates a stats file with the correct metadata', async () => { + it('creates a file with the correct metadata', async () => { const file = fixture('create-metadata', { temporary: true }); await createAtlasFile(file); await expect(fs.promises.readFile(file, 'utf8')).resolves.toBe( @@ -32,7 +32,7 @@ describe('createAtlasFile', () => { ); }); - it('overwrites invalid stats file', async () => { + it('overwrites invalid file', async () => { const file = fixture('create-invalid', { temporary: true }); await fs.promises.writeFile(file, JSON.stringify({ name, version: '0.0.0' }) + '\n'); await createAtlasFile(file); @@ -41,7 +41,7 @@ describe('createAtlasFile', () => { ); }); - it('reuses valid stats file', async () => { + it('reuses valid file', async () => { const file = fixture('create-valid', { temporary: true }); await fs.promises.writeFile(file, JSON.stringify({ name, version }) + '\n'); await createAtlasFile(file); @@ -52,26 +52,26 @@ describe('createAtlasFile', () => { }); describe('validateAtlasFile', () => { - it('passes for valid stats file', async () => { + it('passes for valid file', async () => { const file = fixture('validate-valid', { temporary: true }); await createAtlasFile(file); await expect(validateAtlasFile(file)).resolves.pass(); }); - it('fails for non-existing stats file', async () => { + it('fails for non-existing file', async () => { await expect(validateAtlasFile('./this-file-does-not-exists')).rejects.toThrow( AtlasValidationError ); }); - it('fails for invalid stats file', async () => { + it('fails for invalid file', async () => { const file = fixture('validate-invalid', { temporary: true }); await fs.promises.writeFile(file, JSON.stringify({ name, version: '0.0.0' }) + '\n'); await expect(validateAtlasFile(file)).rejects.toThrow(AtlasValidationError); }); - it('skips validation when EXPO_ATLAS_NO_STATS_VALIDATION is true-ish', async () => { - using _env = env('EXPO_ATLAS_NO_STATS_VALIDATION', 'true'); + it('skips validation when EXPO_ATLAS_NO_VALIDATION is true-ish', async () => { + using _env = env('EXPO_ATLAS_NO_VALIDATION', 'true'); const file = fixture('validate-skip-invalid', { temporary: true }); await fs.promises.writeFile(file, JSON.stringify({ name, version: '0.0.0' }) + '\n'); await expect(validateAtlasFile(file)).resolves.pass(); @@ -85,8 +85,8 @@ describe('validateAtlasFile', () => { */ function fixture(name: string, { temporary = false }: { temporary?: boolean } = {}) { const file = temporary - ? path.join(__dirname, 'fixtures/stats', `${name}.temp.jsonl`) - : path.join(__dirname, 'fixtures/stats', `${name}.jsonl`); + ? path.join(__dirname, 'fixtures/atlas', `${name}.temp.jsonl`) + : path.join(__dirname, 'fixtures/atlas', `${name}.jsonl`); fs.mkdirSync(path.dirname(file), { recursive: true }); diff --git a/src/data/types.ts b/src/data/types.ts index e081f1e..7df8dae 100644 --- a/src/data/types.ts +++ b/src/data/types.ts @@ -1,16 +1,16 @@ import type { MixedOutput } from 'metro'; export interface AtlasSource { - /** List all available stats entries */ + /** List all available entries */ listEntries(): PartialAtlasEntry[] | Promise; - /** Load the full stats entry, by reference */ + /** Load the full entry, by reference */ getEntry(ref: string): AtlasEntry | Promise; } export type PartialAtlasEntry = Pick; export type AtlasEntry = { - /** The unique reference or ID to this stats entry */ + /** The unique reference or ID to this entry */ id: string; /** The platform for which the bundle was created */ platform: 'android' | 'ios' | 'web'; diff --git a/src/metro.ts b/src/metro.ts index aa13092..d3cd288 100644 --- a/src/metro.ts +++ b/src/metro.ts @@ -1,12 +1,11 @@ import { type MetroConfig } from 'metro-config'; +import { createAtlasFile, getAtlasPath, writeAtlasEntry } from './data/AtlasFileSource'; import { convertGraph } from './data/MetroGraphSource'; -import { writeAtlasEntry } from './data/AtlasFileSource'; -import { createAtlasFile, getAtlasPath } from './utils/stats'; type ExpoAtlasOptions = Partial<{ - /** The output of the stats file, defaults to `.expo/stats.json` */ - statsFile: string; + /** The output of the atlas file, defaults to `.expo/atlas.json` */ + atlasFile: string; }>; /** @@ -33,20 +32,20 @@ export function withExpoAtlas(config: MetroConfig, options: ExpoAtlasOptions = { throw new Error('No "projectRoot" configured in Metro config.'); } - const statsFile = options?.statsFile ?? getAtlasPath(projectRoot); + const atlasFile = options?.atlasFile ?? getAtlasPath(projectRoot); const extensions = { source: config.resolver?.sourceExts, asset: config.resolver?.assetExts, }; // Note(cedric): we don't have to await this, Metro would never bundle before this is finisheds - createAtlasFile(statsFile); + createAtlasFile(atlasFile); // @ts-expect-error config.serializer.customSerializer = (entryPoint, preModules, graph, options) => { // Note(cedric): we don't have to await this, it has a built-in write queue writeAtlasEntry( - statsFile, + atlasFile, convertGraph({ projectRoot, entryPoint, preModules, graph, options, extensions }) ); diff --git a/src/utils/env.ts b/src/utils/env.ts index 073bee9..5c09474 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -4,7 +4,7 @@ export const env = { get EXPO_DEBUG() { return boolish('EXPO_DEBUG', false); }, - get EXPO_ATLAS_NO_STATS_VALIDATION() { - return boolish('EXPO_ATLAS_NO_STATS_VALIDATION', false); + get EXPO_ATLAS_NO_VALIDATION() { + return boolish('EXPO_ATLAS_NO_VALIDATION', false); }, }; diff --git a/src/utils/errors.ts b/src/utils/errors.ts index 2c9c1c0..f1cd219 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -15,15 +15,15 @@ export class AtlasError extends Error { export class AtlasValidationError extends AtlasError { constructor( - code: 'STATS_FILE_NOT_FOUND' | 'STATS_FILE_INCOMPATIBLE', - public readonly statsFile: string, + code: 'ATLAS_FILE_NOT_FOUND' | 'ATLAS_FILE_INCOMPATIBLE', + public readonly filePath: string, public readonly incompatibleVersion?: string ) { super( code, - code === 'STATS_FILE_NOT_FOUND' - ? `Stats file not found: ${statsFile}` - : `Stats file is incompatible with this version.` + code === 'ATLAS_FILE_NOT_FOUND' + ? `Atlas file not found: ${filePath}` + : `Atlas file is incompatible with this version.` ); } } diff --git a/src/utils/middleware.ts b/src/utils/middleware.ts index c114e54..f23f72d 100644 --- a/src/utils/middleware.ts +++ b/src/utils/middleware.ts @@ -14,8 +14,8 @@ const SERVER_BUILD_DIR = path.join(WEBUI_ROOT, 'dist/server'); /** * Initialize Expo Atlas to gather statistics from Metro during development. - * This function creates a connect middleware to serve the webui and the stats API. - * It's designed to use any `StatsSource` implementation and passes it to the webui. + * This function creates a connect middleware to serve the webui and the Atlas API. + * It's designed to use any `AtlasSource` implementation and passes it to the webui. * * @example ```js * import { createAtlasMiddleware, MetroGraphSource } from 'expo-atlas/middleware'; diff --git a/webui/metro.config.js b/webui/metro.config.js index 4900a27..6200769 100644 --- a/webui/metro.config.js +++ b/webui/metro.config.js @@ -17,10 +17,10 @@ config.cacheStores = [ // Initialize the Expo Atlas global data source in development if (process.env.NODE_ENV === 'development') { - const { StatsFileSource } = require('../build/src/data/StatsFileSource'); - const statsFile = path.resolve(__dirname, './fixture/atlas-tabs-50.jsonl'); + const { AtlasFileSource } = require('../build/src/data/AtlasFileSource'); + const filePath = path.resolve(__dirname, './fixture/atlas-tabs-50.jsonl'); - global.EXPO_ATLAS_SOURCE = new StatsFileSource(statsFile); + global.EXPO_ATLAS_SOURCE = new AtlasFileSource(filePath); } module.exports = config; diff --git a/webui/src/app/(atlas)/[entry]/folders/[path].tsx b/webui/src/app/(atlas)/[entry]/folders/[path].tsx index a42fff6..79eb525 100644 --- a/webui/src/app/(atlas)/[entry]/folders/[path].tsx +++ b/webui/src/app/(atlas)/[entry]/folders/[path].tsx @@ -8,9 +8,9 @@ import { ModuleFiltersForm } from '~/components/forms/ModuleFilter'; import { useEntry } from '~/providers/entries'; import { Tag } from '~/ui/Tag'; import { fetchApi } from '~/utils/api'; +import { relativeEntryPath } from '~/utils/entry'; import { type ModuleFilters, useModuleFilters, moduleFiltersToParams } from '~/utils/filters'; import { formatFileSize } from '~/utils/formatString'; -import { relativeEntryPath } from '~/utils/entry'; export default function FolderPage() { const { path: absolutePath } = useLocalSearchParams<{ path: string }>(); diff --git a/webui/src/app/(atlas)/[entry]/index.tsx b/webui/src/app/(atlas)/[entry]/index.tsx index 5ef9275..6171116 100644 --- a/webui/src/app/(atlas)/[entry]/index.tsx +++ b/webui/src/app/(atlas)/[entry]/index.tsx @@ -11,7 +11,7 @@ import { fetchApi } from '~/utils/api'; import { type ModuleFilters, moduleFiltersToParams, useModuleFilters } from '~/utils/filters'; import { formatFileSize } from '~/utils/formatString'; -export default function StatsPage() { +export default function BundlePage() { const { entry } = useEntry(); const { filters, filtersEnabled } = useModuleFilters(); const modules = useModuleGraphData(entry.id, filters); diff --git a/webui/src/app/(atlas)/[entry]/modules/[path].tsx b/webui/src/app/(atlas)/[entry]/modules/[path].tsx index a468dd5..4105bce 100644 --- a/webui/src/app/(atlas)/[entry]/modules/[path].tsx +++ b/webui/src/app/(atlas)/[entry]/modules/[path].tsx @@ -7,8 +7,8 @@ import { CodeBlock, CodeBlockSectionWithPrettier, guessLanguageFromPath } from ' import { Skeleton } from '~/ui/Skeleton'; import { Tag } from '~/ui/Tag'; import { fetchApi } from '~/utils/api'; -import { formatFileSize } from '~/utils/formatString'; import { relativeEntryPath } from '~/utils/entry'; +import { formatFileSize } from '~/utils/formatString'; import { type PartialAtlasEntry, type AtlasModule } from '~core/data/types'; export default function ModulePage() { diff --git a/webui/src/app/--/entries/[entry]/modules/index+api.ts b/webui/src/app/--/entries/[entry]/modules/index+api.ts index b1e780f..49411ab 100644 --- a/webui/src/app/--/entries/[entry]/modules/index+api.ts +++ b/webui/src/app/--/entries/[entry]/modules/index+api.ts @@ -2,7 +2,7 @@ import { getSource } from '~/utils/atlas'; import { filterModules, moduleFiltersFromParams } from '~/utils/filters'; import { type AtlasEntry, type AtlasModule } from '~core/data/types'; -/** The partial module data, when listing all available modules from a stats entry */ +/** The partial module data, when listing all available modules from an entry */ export type PartialModule = Omit; export type ModuleListResponse = { diff --git a/webui/src/components/Page.tsx b/webui/src/components/Page.tsx index 78c2932..e1c1023 100644 --- a/webui/src/components/Page.tsx +++ b/webui/src/components/Page.tsx @@ -2,7 +2,7 @@ import { cva, type VariantProps } from 'class-variance-authority'; import cn from 'classnames'; import { forwardRef, type PropsWithChildren, type HTMLAttributes } from 'react'; -import { StatsEntrySelect } from '~/components/forms/EntrySelect'; +import { EntrySelectForm } from '~/components/forms/EntrySelect'; import { LayoutContent, LayoutNavigation } from '~/ui/Layout'; export { LayoutHeader as PageHeader, LayoutTitle as PageTitle } from '~/ui/Layout'; @@ -27,7 +27,7 @@ export const Page = forwardRef( return (
- + {children}
@@ -37,7 +37,7 @@ export const Page = forwardRef( return (
- + {children}
diff --git a/webui/src/components/forms/EntrySelect.tsx b/webui/src/components/forms/EntrySelect.tsx index bd02563..e9445ad 100644 --- a/webui/src/components/forms/EntrySelect.tsx +++ b/webui/src/components/forms/EntrySelect.tsx @@ -11,7 +11,7 @@ import { Button } from '~/ui/Button'; import { Tag } from '~/ui/Tag'; import { relativeEntryPath } from '~/utils/entry'; -export function StatsEntrySelect() { +export function EntrySelectForm() { const router = useRouter(); const { entry, entries } = useEntry(); diff --git a/webui/src/providers/entries.tsx b/webui/src/providers/entries.tsx index 18b6f51..d2e7a6f 100644 --- a/webui/src/providers/entries.tsx +++ b/webui/src/providers/entries.tsx @@ -63,7 +63,7 @@ export function EntryProvider({ children }: PropsWithChildren) { ); } -/** Load all available stats entries from API */ +/** Load all available entries from API */ function useEntryData() { return useQuery({ refetchOnWindowFocus: false,