fix: correct import paths for coaster-match module
Imports must appear before other statements in ES modules. Also drop the explicit .ts extension from import paths — Next.js bundler resolves them without it, and the extension after const was causing the module to silently fail in the app. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -52,21 +52,8 @@ export function areCoastersStale(entry: ParkMeta): boolean {
|
|||||||
return Date.now() - new Date(entry.coasters_scraped_at).getTime() > COASTER_STALE_MS;
|
return Date.now() - new Date(entry.coasters_scraped_at).getTime() > COASTER_STALE_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
import { normalizeForMatch } from "./coaster-match";
|
||||||
* Normalize a ride name for fuzzy matching between data sources.
|
export { normalizeForMatch as normalizeRideName } from "./coaster-match";
|
||||||
*
|
|
||||||
* Queue-Times uses branded names (BATMAN™ The Ride, THE JOKER™ Funhouse Coaster)
|
|
||||||
* while RCDB uses clean names (Batman The Ride, Joker Funhouse Coaster).
|
|
||||||
*
|
|
||||||
* Normalization steps:
|
|
||||||
* 1. Strip trademark/copyright symbols (™ ® ©)
|
|
||||||
* 2. Strip leading "THE " / "THE" prefix
|
|
||||||
* 3. Replace punctuation (- : ' ") with spaces
|
|
||||||
* 4. Collapse runs of whitespace
|
|
||||||
* 5. Lowercase and trim
|
|
||||||
*/
|
|
||||||
export { normalizeForMatch as normalizeRideName } from "./coaster-match.ts";
|
|
||||||
import { normalizeForMatch } from "./coaster-match.ts";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Set of normalized coaster names for fast membership checks.
|
* Returns a Set of normalized coaster names for fast membership checks.
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
* See: https://queue-times.com/en-US/pages/api
|
* See: https://queue-times.com/en-US/pages/api
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const BASE = "https://queue-times.com/parks";
|
import { isCoasterMatch } from "../coaster-match";
|
||||||
|
|
||||||
import { isCoasterMatch, normalizeForMatch } from "../coaster-match.ts";
|
const BASE = "https://queue-times.com/parks";
|
||||||
|
|
||||||
const HEADERS = {
|
const HEADERS = {
|
||||||
"User-Agent":
|
"User-Agent":
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import { test } from "node:test";
|
import { test } from "node:test";
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { isCoasterMatch, normalizeForMatch } from "../lib/coaster-match.ts";
|
import { isCoasterMatch, normalizeForMatch } from "../lib/coaster-match";
|
||||||
|
|
||||||
// ── Helper ──────────────────────────────────────────────────────────────────
|
// ── Helper ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user