@clusterflick/catalogue 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/chunks/{chunk-GUI27HOB.js → chunk-3DWRZ5I4.js} +2 -2
- package/dist/chunks/{chunk-TI76VIOF.js → chunk-6FYW3UT7.js} +2 -2
- package/dist/chunks/{chunk-OPALCKAK.js → chunk-GTI23JTH.js} +9 -9
- package/dist/chunks/{chunk-AYNADMCD.js → chunk-ISONXZFO.js} +1 -1
- package/dist/chunks/{chunk-WOBNU2QW.js → chunk-LKAQJ6EL.js} +5 -5
- package/dist/chunks/{chunk-66W2DK5T.js → chunk-PGAOHKV5.js} +2 -2
- package/dist/chunks/{chunk-LSY22J6X.js → chunk-W6DA5NIR.js} +13 -0
- package/dist/chunks/{chunk-LPQBBT23.js → chunk-X2IB3BLB.js} +68 -0
- package/dist/data/festivals.js +1 -1
- package/dist/data/film-clubs.js +1 -1
- package/dist/filters/apply-matchers.js +6 -6
- package/dist/filters/describe.js +7 -7
- package/dist/filters/filter-search.js +7 -7
- package/dist/filters/hidden-by-date.js +7 -7
- package/dist/filters/index.js +18 -18
- package/dist/filters/manager.js +6 -6
- package/dist/filters/modules/index.js +15 -15
- package/dist/filters/modules/programmes.js +3 -3
- package/dist/filters/suggest.js +8 -8
- package/dist/utils/movie-url-map.d.ts +133 -0
- package/dist/utils/movie-url-map.js +131 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,6 +57,18 @@ venue pages' addresses (`utils/get-movie-url`, `utils/get-venue-url`), so a
|
|
|
57
57
|
link from anywhere is the page the site built. It has no React, and never reads `window`,
|
|
58
58
|
`document` or `process`.
|
|
59
59
|
|
|
60
|
+
## Film URLs that moved
|
|
61
|
+
|
|
62
|
+
`utils/movie-url-map` is the shape of the site's `/movie-urls.json`
|
|
63
|
+
(`MovieUrlMap`, `MOVIE_URL_MAP_VERSION`) and the rules that read it.
|
|
64
|
+
`resolve(path, map)` is what the movie-redirects Worker does with a 404 under
|
|
65
|
+
`/movies/*`: a 301 for a known id or a matched listing's old id, a 302 for one
|
|
66
|
+
showing film under the slug or close to it, and otherwise the 404.
|
|
67
|
+
`findLostUrls(previous, current)` lists every film URL a deploy left behind,
|
|
68
|
+
why it went, and what `resolve` does with it now, which is how data-analysed
|
|
69
|
+
reports a deploy's 404s before anyone follows one. The site builds the map
|
|
70
|
+
itself (`src/utils/get-movie-url-map.ts`), since that needs Node's crypto.
|
|
71
|
+
|
|
60
72
|
## What goes in
|
|
61
73
|
|
|
62
74
|
Code about the listings that something outside the site needs. Anything only
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatList
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LKAQJ6EL.js";
|
|
4
4
|
import {
|
|
5
5
|
describeVenueOrigin,
|
|
6
6
|
getWiderVenueOrigins,
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getPermissiveState,
|
|
23
23
|
getRestrictiveFilterIds,
|
|
24
24
|
set
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-GTI23JTH.js";
|
|
26
26
|
import {
|
|
27
27
|
matchesTitleSearch
|
|
28
28
|
} from "./chunk-QZR35QGA.js";
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
filtersAtDefault,
|
|
13
13
|
get,
|
|
14
14
|
set
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-GTI23JTH.js";
|
|
16
16
|
import {
|
|
17
17
|
PEOPLE_GROUPS
|
|
18
18
|
} from "./chunk-OCKNY62N.js";
|
|
19
19
|
import {
|
|
20
20
|
PROGRAMME_GROUPS,
|
|
21
21
|
getProgrammeName
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-PGAOHKV5.js";
|
|
23
23
|
import {
|
|
24
24
|
FORMAT_GROUPS
|
|
25
25
|
} from "./chunk-XRUFSYND.js";
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
imdbRatingFilter,
|
|
3
|
+
letterboxdRatingFilter,
|
|
4
|
+
rottenTomatoesRatingFilter
|
|
5
|
+
} from "./chunk-5RULMHO5.js";
|
|
1
6
|
import {
|
|
2
7
|
searchFilter
|
|
3
8
|
} from "./chunk-QZR35QGA.js";
|
|
@@ -13,6 +18,9 @@ import {
|
|
|
13
18
|
import {
|
|
14
19
|
venuesFilter
|
|
15
20
|
} from "./chunk-JY3KJQD5.js";
|
|
21
|
+
import {
|
|
22
|
+
hideSeenFilter
|
|
23
|
+
} from "./chunk-FYTXRSFO.js";
|
|
16
24
|
import {
|
|
17
25
|
hideSoldOutFilter
|
|
18
26
|
} from "./chunk-HPTWM2R3.js";
|
|
@@ -32,12 +40,7 @@ import {
|
|
|
32
40
|
import {
|
|
33
41
|
PROGRAMME_GROUPS,
|
|
34
42
|
buildProgrammeFilter
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import {
|
|
37
|
-
imdbRatingFilter,
|
|
38
|
-
letterboxdRatingFilter,
|
|
39
|
-
rottenTomatoesRatingFilter
|
|
40
|
-
} from "./chunk-5RULMHO5.js";
|
|
43
|
+
} from "./chunk-PGAOHKV5.js";
|
|
41
44
|
import {
|
|
42
45
|
accessibilityFilter
|
|
43
46
|
} from "./chunk-R4GMUI2F.js";
|
|
@@ -58,9 +61,6 @@ import {
|
|
|
58
61
|
import {
|
|
59
62
|
hideFinishedFilter
|
|
60
63
|
} from "./chunk-E3U4RP6I.js";
|
|
61
|
-
import {
|
|
62
|
-
hideSeenFilter
|
|
63
|
-
} from "./chunk-FYTXRSFO.js";
|
|
64
64
|
import {
|
|
65
65
|
createMatchAny
|
|
66
66
|
} from "./chunk-BDBCYPQ7.js";
|
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
filtersAtDefault,
|
|
7
7
|
getRestrictiveFilterIds
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GTI23JTH.js";
|
|
9
|
+
import {
|
|
10
|
+
RATING_GROUPS
|
|
11
|
+
} from "./chunk-5RULMHO5.js";
|
|
9
12
|
import {
|
|
10
13
|
DAY_END_MINUTES,
|
|
11
14
|
DAY_START_MINUTES
|
|
@@ -16,10 +19,7 @@ import {
|
|
|
16
19
|
import {
|
|
17
20
|
PROGRAMME_GROUPS,
|
|
18
21
|
getProgrammeName
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
RATING_GROUPS
|
|
22
|
-
} from "./chunk-5RULMHO5.js";
|
|
22
|
+
} from "./chunk-PGAOHKV5.js";
|
|
23
23
|
import {
|
|
24
24
|
FORMAT_GROUPS
|
|
25
25
|
} from "./chunk-XRUFSYND.js";
|
|
@@ -739,6 +739,19 @@ var FILM_CLUBS = [
|
|
|
739
739
|
{ ["showingTitleSearch" /* ShowingTitleSearch */]: "Twickenham Cinema Club" },
|
|
740
740
|
{ ["performanceNotesSearch" /* PerformanceNotesSearch */]: "Twickenham Cinema Club" }
|
|
741
741
|
]
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
id: "goodfilmhunting",
|
|
745
|
+
name: "GoodFilmHunting",
|
|
746
|
+
kind: "community",
|
|
747
|
+
url: "https://clyx.com/community/goodfilmhunting",
|
|
748
|
+
aliases: [],
|
|
749
|
+
matchers: [
|
|
750
|
+
// Its screenings come from Clyx, titled by number ("GoodFilmHunting
|
|
751
|
+
// #7") and noted "Presented by GoodFilmHunting".
|
|
752
|
+
{ ["showingTitleSearch" /* ShowingTitleSearch */]: "GoodFilmHunting" },
|
|
753
|
+
{ ["performanceNotesSearch" /* PerformanceNotesSearch */]: "GoodFilmHunting" }
|
|
754
|
+
]
|
|
742
755
|
}
|
|
743
756
|
];
|
|
744
757
|
|
|
@@ -1082,6 +1082,74 @@ var FESTIVALS = [
|
|
|
1082
1082
|
["performanceNotesSearch" /* PerformanceNotesSearch */]: "Marginal Film Festival"
|
|
1083
1083
|
}
|
|
1084
1084
|
]
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
id: "london-baltic-film-festival",
|
|
1088
|
+
name: "London Baltic Film Festival",
|
|
1089
|
+
url: "https://www.londonbalticff.com/",
|
|
1090
|
+
aliases: ["lbff"],
|
|
1091
|
+
matchers: [
|
|
1092
|
+
{
|
|
1093
|
+
// Matches "London Baltic Film Festival: Kingpins + Q&A (UK premiere)"
|
|
1094
|
+
// at Regent Street Cinema and "London Baltic Film Festival presents
|
|
1095
|
+
// ..." at The Garden Cinema
|
|
1096
|
+
["showingTitleSearch" /* ShowingTitleSearch */]: "London Baltic Film Festival"
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
["performanceNotesSearch" /* PerformanceNotesSearch */]: "London Baltic Film Festival"
|
|
1100
|
+
}
|
|
1101
|
+
]
|
|
1102
|
+
},
|
|
1103
|
+
{
|
|
1104
|
+
id: "london-film-week",
|
|
1105
|
+
name: "London Film Week",
|
|
1106
|
+
url: "https://www.londonfilmweek.com/",
|
|
1107
|
+
aliases: ["film-week"],
|
|
1108
|
+
matchers: [
|
|
1109
|
+
{
|
|
1110
|
+
// Matches "London Film Week presents The Gate of Murder (UK Premiere)"
|
|
1111
|
+
// and, from 2025, "London Film Week and Cine Brazil present: Manas" at
|
|
1112
|
+
// The Garden Cinema, December 16–20 2026. The full name rather than
|
|
1113
|
+
// "Film Week", which "Family Film Week" seasons share.
|
|
1114
|
+
["showingTitleSearch" /* ShowingTitleSearch */]: "London Film Week"
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
["performanceNotesSearch" /* PerformanceNotesSearch */]: "London Film Week"
|
|
1118
|
+
}
|
|
1119
|
+
]
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
id: "set-film-festival",
|
|
1123
|
+
name: "SET Film Festival",
|
|
1124
|
+
url: "https://setspace.uk/set-film-festival/",
|
|
1125
|
+
aliases: [],
|
|
1126
|
+
matchers: [
|
|
1127
|
+
{
|
|
1128
|
+
// Matches "SET Film Festival 2026 – Night #3: A Conjuring, A Summoning"
|
|
1129
|
+
// and "SET Film Festival 2026 - Peckham, London" at SET Social,
|
|
1130
|
+
// Peckham, 5 November – 5 December 2026. Scoped to the venue because
|
|
1131
|
+
// search runs words together, so "SET Film Festival" alone would also
|
|
1132
|
+
// catch "Sunset Film Festival" anywhere else.
|
|
1133
|
+
["showingTitleSearch" /* ShowingTitleSearch */]: "SET Film Festival",
|
|
1134
|
+
["venues" /* Venues */]: ["setspace.uk"]
|
|
1135
|
+
}
|
|
1136
|
+
]
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
id: "london-independent-short-film-festival",
|
|
1140
|
+
name: "London Independent Short Film Festival",
|
|
1141
|
+
url: "https://www.lisff.org/",
|
|
1142
|
+
aliases: ["lisff"],
|
|
1143
|
+
matchers: [
|
|
1144
|
+
{
|
|
1145
|
+
// Matches "London Independent Short Film Festival Screenings 1" and
|
|
1146
|
+
// "... Screenings 2" at The Soho Screening Rooms, 23 November 2026.
|
|
1147
|
+
// Left unscoped because the full name is distinctive: it does not run
|
|
1148
|
+
// into the London Independent Film Festival, which never bills itself
|
|
1149
|
+
// with "Short" and is matched on "LIFF" at the Genesis only.
|
|
1150
|
+
["showingTitleSearch" /* ShowingTitleSearch */]: "London Independent Short Film Festival"
|
|
1151
|
+
}
|
|
1152
|
+
]
|
|
1085
1153
|
}
|
|
1086
1154
|
];
|
|
1087
1155
|
|
package/dist/data/festivals.js
CHANGED
package/dist/data/film-clubs.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
matchAny
|
|
3
|
-
} from "../chunks/chunk-
|
|
3
|
+
} from "../chunks/chunk-GTI23JTH.js";
|
|
4
4
|
import "../chunks/chunk-66CT4V45.js";
|
|
5
|
+
import "../chunks/chunk-5RULMHO5.js";
|
|
5
6
|
import "../chunks/chunk-QZR35QGA.js";
|
|
6
7
|
import "../chunks/chunk-PBWYSW5K.js";
|
|
7
8
|
import "../chunks/chunk-PH6CF27S.js";
|
|
8
9
|
import "../chunks/chunk-HM7BPTA6.js";
|
|
9
10
|
import "../chunks/chunk-JY3KJQD5.js";
|
|
11
|
+
import "../chunks/chunk-FYTXRSFO.js";
|
|
10
12
|
import "../chunks/chunk-HPTWM2R3.js";
|
|
11
13
|
import "../chunks/chunk-MWCGMINT.js";
|
|
12
14
|
import "../chunks/chunk-5GKQV2G2.js";
|
|
13
15
|
import "../chunks/chunk-OCKNY62N.js";
|
|
14
16
|
import "../chunks/chunk-GFZ2ILAU.js";
|
|
15
|
-
import "../chunks/chunk-
|
|
16
|
-
import "../chunks/chunk-
|
|
17
|
-
import "../chunks/chunk-
|
|
18
|
-
import "../chunks/chunk-5RULMHO5.js";
|
|
17
|
+
import "../chunks/chunk-PGAOHKV5.js";
|
|
18
|
+
import "../chunks/chunk-X2IB3BLB.js";
|
|
19
|
+
import "../chunks/chunk-W6DA5NIR.js";
|
|
19
20
|
import "../chunks/chunk-5AJT2CW2.js";
|
|
20
21
|
import "../chunks/chunk-R4GMUI2F.js";
|
|
21
22
|
import "../chunks/chunk-FRZUKW2P.js";
|
|
@@ -23,7 +24,6 @@ import "../chunks/chunk-PFAIK2SP.js";
|
|
|
23
24
|
import "../chunks/chunk-XRUFSYND.js";
|
|
24
25
|
import "../chunks/chunk-DXS2XOT4.js";
|
|
25
26
|
import "../chunks/chunk-E3U4RP6I.js";
|
|
26
|
-
import "../chunks/chunk-FYTXRSFO.js";
|
|
27
27
|
import "../chunks/chunk-BDBCYPQ7.js";
|
|
28
28
|
import "../chunks/chunk-AF57BXPT.js";
|
|
29
29
|
import "../chunks/chunk-IHWVIA2A.js";
|
package/dist/filters/describe.js
CHANGED
|
@@ -2,24 +2,25 @@ import {
|
|
|
2
2
|
describeFilterChips,
|
|
3
3
|
describeFilters,
|
|
4
4
|
formatList
|
|
5
|
-
} from "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-LKAQJ6EL.js";
|
|
6
6
|
import "../chunks/chunk-NUZXXNF3.js";
|
|
7
|
-
import "../chunks/chunk-
|
|
7
|
+
import "../chunks/chunk-GTI23JTH.js";
|
|
8
8
|
import "../chunks/chunk-66CT4V45.js";
|
|
9
|
+
import "../chunks/chunk-5RULMHO5.js";
|
|
9
10
|
import "../chunks/chunk-QZR35QGA.js";
|
|
10
11
|
import "../chunks/chunk-PBWYSW5K.js";
|
|
11
12
|
import "../chunks/chunk-PH6CF27S.js";
|
|
12
13
|
import "../chunks/chunk-HM7BPTA6.js";
|
|
13
14
|
import "../chunks/chunk-JY3KJQD5.js";
|
|
15
|
+
import "../chunks/chunk-FYTXRSFO.js";
|
|
14
16
|
import "../chunks/chunk-HPTWM2R3.js";
|
|
15
17
|
import "../chunks/chunk-MWCGMINT.js";
|
|
16
18
|
import "../chunks/chunk-5GKQV2G2.js";
|
|
17
19
|
import "../chunks/chunk-OCKNY62N.js";
|
|
18
20
|
import "../chunks/chunk-GFZ2ILAU.js";
|
|
19
|
-
import "../chunks/chunk-
|
|
20
|
-
import "../chunks/chunk-
|
|
21
|
-
import "../chunks/chunk-
|
|
22
|
-
import "../chunks/chunk-5RULMHO5.js";
|
|
21
|
+
import "../chunks/chunk-PGAOHKV5.js";
|
|
22
|
+
import "../chunks/chunk-X2IB3BLB.js";
|
|
23
|
+
import "../chunks/chunk-W6DA5NIR.js";
|
|
23
24
|
import "../chunks/chunk-5AJT2CW2.js";
|
|
24
25
|
import "../chunks/chunk-R4GMUI2F.js";
|
|
25
26
|
import "../chunks/chunk-FRZUKW2P.js";
|
|
@@ -27,7 +28,6 @@ import "../chunks/chunk-PFAIK2SP.js";
|
|
|
27
28
|
import "../chunks/chunk-XRUFSYND.js";
|
|
28
29
|
import "../chunks/chunk-DXS2XOT4.js";
|
|
29
30
|
import "../chunks/chunk-E3U4RP6I.js";
|
|
30
|
-
import "../chunks/chunk-FYTXRSFO.js";
|
|
31
31
|
import "../chunks/chunk-BDBCYPQ7.js";
|
|
32
32
|
import "../chunks/chunk-AF57BXPT.js";
|
|
33
33
|
import "../chunks/chunk-IHWVIA2A.js";
|
|
@@ -5,25 +5,26 @@ import {
|
|
|
5
5
|
isFilterSearchEntrySelected,
|
|
6
6
|
prepareFilterSearch,
|
|
7
7
|
searchFilterGroups
|
|
8
|
-
} from "../chunks/chunk-
|
|
8
|
+
} from "../chunks/chunk-6FYW3UT7.js";
|
|
9
9
|
import "../chunks/chunk-MQYAXMLE.js";
|
|
10
10
|
import "../chunks/chunk-P6LFPTGN.js";
|
|
11
|
-
import "../chunks/chunk-
|
|
11
|
+
import "../chunks/chunk-GTI23JTH.js";
|
|
12
12
|
import "../chunks/chunk-66CT4V45.js";
|
|
13
|
+
import "../chunks/chunk-5RULMHO5.js";
|
|
13
14
|
import "../chunks/chunk-QZR35QGA.js";
|
|
14
15
|
import "../chunks/chunk-PBWYSW5K.js";
|
|
15
16
|
import "../chunks/chunk-PH6CF27S.js";
|
|
16
17
|
import "../chunks/chunk-HM7BPTA6.js";
|
|
17
18
|
import "../chunks/chunk-JY3KJQD5.js";
|
|
19
|
+
import "../chunks/chunk-FYTXRSFO.js";
|
|
18
20
|
import "../chunks/chunk-HPTWM2R3.js";
|
|
19
21
|
import "../chunks/chunk-MWCGMINT.js";
|
|
20
22
|
import "../chunks/chunk-5GKQV2G2.js";
|
|
21
23
|
import "../chunks/chunk-OCKNY62N.js";
|
|
22
24
|
import "../chunks/chunk-GFZ2ILAU.js";
|
|
23
|
-
import "../chunks/chunk-
|
|
24
|
-
import "../chunks/chunk-
|
|
25
|
-
import "../chunks/chunk-
|
|
26
|
-
import "../chunks/chunk-5RULMHO5.js";
|
|
25
|
+
import "../chunks/chunk-PGAOHKV5.js";
|
|
26
|
+
import "../chunks/chunk-X2IB3BLB.js";
|
|
27
|
+
import "../chunks/chunk-W6DA5NIR.js";
|
|
27
28
|
import "../chunks/chunk-5AJT2CW2.js";
|
|
28
29
|
import "../chunks/chunk-R4GMUI2F.js";
|
|
29
30
|
import "../chunks/chunk-FRZUKW2P.js";
|
|
@@ -31,7 +32,6 @@ import "../chunks/chunk-PFAIK2SP.js";
|
|
|
31
32
|
import "../chunks/chunk-XRUFSYND.js";
|
|
32
33
|
import "../chunks/chunk-DXS2XOT4.js";
|
|
33
34
|
import "../chunks/chunk-E3U4RP6I.js";
|
|
34
|
-
import "../chunks/chunk-FYTXRSFO.js";
|
|
35
35
|
import "../chunks/chunk-BDBCYPQ7.js";
|
|
36
36
|
import "../chunks/chunk-AF57BXPT.js";
|
|
37
37
|
import "../chunks/chunk-IHWVIA2A.js";
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
THIN_RESULT_LIMIT,
|
|
3
3
|
getHiddenByDate
|
|
4
|
-
} from "../chunks/chunk-
|
|
5
|
-
import "../chunks/chunk-
|
|
4
|
+
} from "../chunks/chunk-ISONXZFO.js";
|
|
5
|
+
import "../chunks/chunk-GTI23JTH.js";
|
|
6
6
|
import "../chunks/chunk-66CT4V45.js";
|
|
7
|
+
import "../chunks/chunk-5RULMHO5.js";
|
|
7
8
|
import "../chunks/chunk-QZR35QGA.js";
|
|
8
9
|
import "../chunks/chunk-PBWYSW5K.js";
|
|
9
10
|
import "../chunks/chunk-PH6CF27S.js";
|
|
10
11
|
import "../chunks/chunk-HM7BPTA6.js";
|
|
11
12
|
import "../chunks/chunk-JY3KJQD5.js";
|
|
13
|
+
import "../chunks/chunk-FYTXRSFO.js";
|
|
12
14
|
import "../chunks/chunk-HPTWM2R3.js";
|
|
13
15
|
import "../chunks/chunk-MWCGMINT.js";
|
|
14
16
|
import "../chunks/chunk-5GKQV2G2.js";
|
|
15
17
|
import "../chunks/chunk-OCKNY62N.js";
|
|
16
18
|
import "../chunks/chunk-GFZ2ILAU.js";
|
|
17
|
-
import "../chunks/chunk-
|
|
18
|
-
import "../chunks/chunk-
|
|
19
|
-
import "../chunks/chunk-
|
|
20
|
-
import "../chunks/chunk-5RULMHO5.js";
|
|
19
|
+
import "../chunks/chunk-PGAOHKV5.js";
|
|
20
|
+
import "../chunks/chunk-X2IB3BLB.js";
|
|
21
|
+
import "../chunks/chunk-W6DA5NIR.js";
|
|
21
22
|
import "../chunks/chunk-5AJT2CW2.js";
|
|
22
23
|
import "../chunks/chunk-R4GMUI2F.js";
|
|
23
24
|
import "../chunks/chunk-FRZUKW2P.js";
|
|
@@ -25,7 +26,6 @@ import "../chunks/chunk-PFAIK2SP.js";
|
|
|
25
26
|
import "../chunks/chunk-XRUFSYND.js";
|
|
26
27
|
import "../chunks/chunk-DXS2XOT4.js";
|
|
27
28
|
import "../chunks/chunk-E3U4RP6I.js";
|
|
28
|
-
import "../chunks/chunk-FYTXRSFO.js";
|
|
29
29
|
import "../chunks/chunk-BDBCYPQ7.js";
|
|
30
30
|
import "../chunks/chunk-AF57BXPT.js";
|
|
31
31
|
import "../chunks/chunk-IHWVIA2A.js";
|
package/dist/filters/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
THIN_RESULT_LIMIT,
|
|
3
|
+
getHiddenByDate
|
|
4
|
+
} from "../chunks/chunk-ISONXZFO.js";
|
|
1
5
|
import {
|
|
2
6
|
getFilterValueOffers,
|
|
3
7
|
suggestFilterRelaxations,
|
|
4
8
|
suggestShowingRelaxations
|
|
5
|
-
} from "../chunks/chunk-
|
|
9
|
+
} from "../chunks/chunk-3DWRZ5I4.js";
|
|
6
10
|
import {
|
|
7
11
|
describeFilterChips,
|
|
8
12
|
describeFilters
|
|
9
|
-
} from "../chunks/chunk-
|
|
13
|
+
} from "../chunks/chunk-LKAQJ6EL.js";
|
|
10
14
|
import "../chunks/chunk-NUZXXNF3.js";
|
|
11
15
|
import {
|
|
12
16
|
MIN_FILTER_SEARCH_LENGTH,
|
|
@@ -15,13 +19,9 @@ import {
|
|
|
15
19
|
isFilterSearchEntrySelected,
|
|
16
20
|
prepareFilterSearch,
|
|
17
21
|
searchFilterGroups
|
|
18
|
-
} from "../chunks/chunk-
|
|
22
|
+
} from "../chunks/chunk-6FYW3UT7.js";
|
|
19
23
|
import "../chunks/chunk-MQYAXMLE.js";
|
|
20
24
|
import "../chunks/chunk-P6LFPTGN.js";
|
|
21
|
-
import {
|
|
22
|
-
THIN_RESULT_LIMIT,
|
|
23
|
-
getHiddenByDate
|
|
24
|
-
} from "../chunks/chunk-AYNADMCD.js";
|
|
25
25
|
import {
|
|
26
26
|
apply,
|
|
27
27
|
buildFilterUrl,
|
|
@@ -40,8 +40,14 @@ import {
|
|
|
40
40
|
resolveFilterStateFromUrl,
|
|
41
41
|
set,
|
|
42
42
|
widenFilters
|
|
43
|
-
} from "../chunks/chunk-
|
|
43
|
+
} from "../chunks/chunk-GTI23JTH.js";
|
|
44
44
|
import "../chunks/chunk-66CT4V45.js";
|
|
45
|
+
import {
|
|
46
|
+
RATING_GROUPS,
|
|
47
|
+
getHighlyRatedUrl,
|
|
48
|
+
getRatingGroup,
|
|
49
|
+
meetsRating
|
|
50
|
+
} from "../chunks/chunk-5RULMHO5.js";
|
|
45
51
|
import {
|
|
46
52
|
searchFilter
|
|
47
53
|
} from "../chunks/chunk-QZR35QGA.js";
|
|
@@ -53,6 +59,7 @@ import "../chunks/chunk-HM7BPTA6.js";
|
|
|
53
59
|
import {
|
|
54
60
|
venuesFilter
|
|
55
61
|
} from "../chunks/chunk-JY3KJQD5.js";
|
|
62
|
+
import "../chunks/chunk-FYTXRSFO.js";
|
|
56
63
|
import "../chunks/chunk-HPTWM2R3.js";
|
|
57
64
|
import {
|
|
58
65
|
getMovieVocabulary,
|
|
@@ -75,15 +82,9 @@ import {
|
|
|
75
82
|
PROGRAMME_GROUPS,
|
|
76
83
|
getProgrammeFilterUrl,
|
|
77
84
|
getProgrammeName
|
|
78
|
-
} from "../chunks/chunk-
|
|
79
|
-
import "../chunks/chunk-
|
|
80
|
-
import "../chunks/chunk-
|
|
81
|
-
import {
|
|
82
|
-
RATING_GROUPS,
|
|
83
|
-
getHighlyRatedUrl,
|
|
84
|
-
getRatingGroup,
|
|
85
|
-
meetsRating
|
|
86
|
-
} from "../chunks/chunk-5RULMHO5.js";
|
|
85
|
+
} from "../chunks/chunk-PGAOHKV5.js";
|
|
86
|
+
import "../chunks/chunk-X2IB3BLB.js";
|
|
87
|
+
import "../chunks/chunk-W6DA5NIR.js";
|
|
87
88
|
import "../chunks/chunk-5AJT2CW2.js";
|
|
88
89
|
import "../chunks/chunk-R4GMUI2F.js";
|
|
89
90
|
import {
|
|
@@ -104,7 +105,6 @@ import {
|
|
|
104
105
|
genresFilter
|
|
105
106
|
} from "../chunks/chunk-DXS2XOT4.js";
|
|
106
107
|
import "../chunks/chunk-E3U4RP6I.js";
|
|
107
|
-
import "../chunks/chunk-FYTXRSFO.js";
|
|
108
108
|
import "../chunks/chunk-BDBCYPQ7.js";
|
|
109
109
|
import "../chunks/chunk-AF57BXPT.js";
|
|
110
110
|
import "../chunks/chunk-IHWVIA2A.js";
|
package/dist/filters/manager.js
CHANGED
|
@@ -21,22 +21,23 @@ import {
|
|
|
21
21
|
set,
|
|
22
22
|
statesEqual,
|
|
23
23
|
widenFilters
|
|
24
|
-
} from "../chunks/chunk-
|
|
24
|
+
} from "../chunks/chunk-GTI23JTH.js";
|
|
25
25
|
import "../chunks/chunk-66CT4V45.js";
|
|
26
|
+
import "../chunks/chunk-5RULMHO5.js";
|
|
26
27
|
import "../chunks/chunk-QZR35QGA.js";
|
|
27
28
|
import "../chunks/chunk-PBWYSW5K.js";
|
|
28
29
|
import "../chunks/chunk-PH6CF27S.js";
|
|
29
30
|
import "../chunks/chunk-HM7BPTA6.js";
|
|
30
31
|
import "../chunks/chunk-JY3KJQD5.js";
|
|
32
|
+
import "../chunks/chunk-FYTXRSFO.js";
|
|
31
33
|
import "../chunks/chunk-HPTWM2R3.js";
|
|
32
34
|
import "../chunks/chunk-MWCGMINT.js";
|
|
33
35
|
import "../chunks/chunk-5GKQV2G2.js";
|
|
34
36
|
import "../chunks/chunk-OCKNY62N.js";
|
|
35
37
|
import "../chunks/chunk-GFZ2ILAU.js";
|
|
36
|
-
import "../chunks/chunk-
|
|
37
|
-
import "../chunks/chunk-
|
|
38
|
-
import "../chunks/chunk-
|
|
39
|
-
import "../chunks/chunk-5RULMHO5.js";
|
|
38
|
+
import "../chunks/chunk-PGAOHKV5.js";
|
|
39
|
+
import "../chunks/chunk-X2IB3BLB.js";
|
|
40
|
+
import "../chunks/chunk-W6DA5NIR.js";
|
|
40
41
|
import "../chunks/chunk-5AJT2CW2.js";
|
|
41
42
|
import "../chunks/chunk-R4GMUI2F.js";
|
|
42
43
|
import "../chunks/chunk-FRZUKW2P.js";
|
|
@@ -44,7 +45,6 @@ import "../chunks/chunk-PFAIK2SP.js";
|
|
|
44
45
|
import "../chunks/chunk-XRUFSYND.js";
|
|
45
46
|
import "../chunks/chunk-DXS2XOT4.js";
|
|
46
47
|
import "../chunks/chunk-E3U4RP6I.js";
|
|
47
|
-
import "../chunks/chunk-FYTXRSFO.js";
|
|
48
48
|
import "../chunks/chunk-BDBCYPQ7.js";
|
|
49
49
|
import "../chunks/chunk-AF57BXPT.js";
|
|
50
50
|
import "../chunks/chunk-IHWVIA2A.js";
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import "../../chunks/chunk-66CT4V45.js";
|
|
2
|
+
import {
|
|
3
|
+
RATING_GROUPS,
|
|
4
|
+
getHighlyRatedUrl,
|
|
5
|
+
getRatingGroup,
|
|
6
|
+
imdbRatingFilter,
|
|
7
|
+
letterboxdRatingFilter,
|
|
8
|
+
meetsRating,
|
|
9
|
+
rottenTomatoesRatingFilter
|
|
10
|
+
} from "../../chunks/chunk-5RULMHO5.js";
|
|
2
11
|
import {
|
|
3
12
|
searchFilter
|
|
4
13
|
} from "../../chunks/chunk-QZR35QGA.js";
|
|
@@ -16,6 +25,9 @@ import {
|
|
|
16
25
|
import {
|
|
17
26
|
venuesFilter
|
|
18
27
|
} from "../../chunks/chunk-JY3KJQD5.js";
|
|
28
|
+
import {
|
|
29
|
+
hideSeenFilter
|
|
30
|
+
} from "../../chunks/chunk-FYTXRSFO.js";
|
|
19
31
|
import {
|
|
20
32
|
hideSoldOutFilter
|
|
21
33
|
} from "../../chunks/chunk-HPTWM2R3.js";
|
|
@@ -44,18 +56,9 @@ import {
|
|
|
44
56
|
buildProgrammeFilter,
|
|
45
57
|
getProgrammeFilterUrl,
|
|
46
58
|
getProgrammeName
|
|
47
|
-
} from "../../chunks/chunk-
|
|
48
|
-
import "../../chunks/chunk-
|
|
49
|
-
import "../../chunks/chunk-
|
|
50
|
-
import {
|
|
51
|
-
RATING_GROUPS,
|
|
52
|
-
getHighlyRatedUrl,
|
|
53
|
-
getRatingGroup,
|
|
54
|
-
imdbRatingFilter,
|
|
55
|
-
letterboxdRatingFilter,
|
|
56
|
-
meetsRating,
|
|
57
|
-
rottenTomatoesRatingFilter
|
|
58
|
-
} from "../../chunks/chunk-5RULMHO5.js";
|
|
59
|
+
} from "../../chunks/chunk-PGAOHKV5.js";
|
|
60
|
+
import "../../chunks/chunk-X2IB3BLB.js";
|
|
61
|
+
import "../../chunks/chunk-W6DA5NIR.js";
|
|
59
62
|
import "../../chunks/chunk-5AJT2CW2.js";
|
|
60
63
|
import {
|
|
61
64
|
accessibilityFilter
|
|
@@ -80,9 +83,6 @@ import {
|
|
|
80
83
|
import {
|
|
81
84
|
hideFinishedFilter
|
|
82
85
|
} from "../../chunks/chunk-E3U4RP6I.js";
|
|
83
|
-
import {
|
|
84
|
-
hideSeenFilter
|
|
85
|
-
} from "../../chunks/chunk-FYTXRSFO.js";
|
|
86
86
|
import "../../chunks/chunk-BDBCYPQ7.js";
|
|
87
87
|
import "../../chunks/chunk-AF57BXPT.js";
|
|
88
88
|
import "../../chunks/chunk-IHWVIA2A.js";
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
buildProgrammeFilter,
|
|
4
4
|
getProgrammeFilterUrl,
|
|
5
5
|
getProgrammeName
|
|
6
|
-
} from "../../chunks/chunk-
|
|
7
|
-
import "../../chunks/chunk-
|
|
8
|
-
import "../../chunks/chunk-
|
|
6
|
+
} from "../../chunks/chunk-PGAOHKV5.js";
|
|
7
|
+
import "../../chunks/chunk-X2IB3BLB.js";
|
|
8
|
+
import "../../chunks/chunk-W6DA5NIR.js";
|
|
9
9
|
import "../../chunks/chunk-BDBCYPQ7.js";
|
|
10
10
|
import "../../chunks/chunk-HVUCNPND.js";
|
|
11
11
|
export {
|
package/dist/filters/suggest.js
CHANGED
|
@@ -2,27 +2,28 @@ import {
|
|
|
2
2
|
getFilterValueOffers,
|
|
3
3
|
suggestFilterRelaxations,
|
|
4
4
|
suggestShowingRelaxations
|
|
5
|
-
} from "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-3DWRZ5I4.js";
|
|
6
|
+
import "../chunks/chunk-LKAQJ6EL.js";
|
|
7
7
|
import "../chunks/chunk-NUZXXNF3.js";
|
|
8
8
|
import "../chunks/chunk-MQYAXMLE.js";
|
|
9
9
|
import "../chunks/chunk-P6LFPTGN.js";
|
|
10
|
-
import "../chunks/chunk-
|
|
10
|
+
import "../chunks/chunk-GTI23JTH.js";
|
|
11
11
|
import "../chunks/chunk-66CT4V45.js";
|
|
12
|
+
import "../chunks/chunk-5RULMHO5.js";
|
|
12
13
|
import "../chunks/chunk-QZR35QGA.js";
|
|
13
14
|
import "../chunks/chunk-PBWYSW5K.js";
|
|
14
15
|
import "../chunks/chunk-PH6CF27S.js";
|
|
15
16
|
import "../chunks/chunk-HM7BPTA6.js";
|
|
16
17
|
import "../chunks/chunk-JY3KJQD5.js";
|
|
18
|
+
import "../chunks/chunk-FYTXRSFO.js";
|
|
17
19
|
import "../chunks/chunk-HPTWM2R3.js";
|
|
18
20
|
import "../chunks/chunk-MWCGMINT.js";
|
|
19
21
|
import "../chunks/chunk-5GKQV2G2.js";
|
|
20
22
|
import "../chunks/chunk-OCKNY62N.js";
|
|
21
23
|
import "../chunks/chunk-GFZ2ILAU.js";
|
|
22
|
-
import "../chunks/chunk-
|
|
23
|
-
import "../chunks/chunk-
|
|
24
|
-
import "../chunks/chunk-
|
|
25
|
-
import "../chunks/chunk-5RULMHO5.js";
|
|
24
|
+
import "../chunks/chunk-PGAOHKV5.js";
|
|
25
|
+
import "../chunks/chunk-X2IB3BLB.js";
|
|
26
|
+
import "../chunks/chunk-W6DA5NIR.js";
|
|
26
27
|
import "../chunks/chunk-5AJT2CW2.js";
|
|
27
28
|
import "../chunks/chunk-R4GMUI2F.js";
|
|
28
29
|
import "../chunks/chunk-FRZUKW2P.js";
|
|
@@ -30,7 +31,6 @@ import "../chunks/chunk-PFAIK2SP.js";
|
|
|
30
31
|
import "../chunks/chunk-XRUFSYND.js";
|
|
31
32
|
import "../chunks/chunk-DXS2XOT4.js";
|
|
32
33
|
import "../chunks/chunk-E3U4RP6I.js";
|
|
33
|
-
import "../chunks/chunk-FYTXRSFO.js";
|
|
34
34
|
import "../chunks/chunk-BDBCYPQ7.js";
|
|
35
35
|
import "../chunks/chunk-AF57BXPT.js";
|
|
36
36
|
import "../chunks/chunk-IHWVIA2A.js";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a film URL that has stopped being a page should go: the rules the
|
|
3
|
+
* movie-redirects Worker (clusterflick/movie-redirects) answers a 404 under
|
|
4
|
+
* `/movies/*` with, and the comparison data-analysed makes between two
|
|
5
|
+
* deploys to say which URLs each one left behind and where they now end up.
|
|
6
|
+
* Both read the site's `/movie-urls.json` (`MovieUrlMap`), and both use this
|
|
7
|
+
* module, so the report says exactly what the Worker will do.
|
|
8
|
+
*
|
|
9
|
+
* The site builds the map (`src/utils/get-movie-url-map.ts` there), with
|
|
10
|
+
* Node's crypto, which this package can't use; everything here is plain
|
|
11
|
+
* string work that runs in a browser, Node and a Worker.
|
|
12
|
+
*/
|
|
13
|
+
/** Where the site publishes the map, from its origin. */
|
|
14
|
+
export declare const MOVIE_URL_MAP_FILE = "/movie-urls.json";
|
|
15
|
+
/**
|
|
16
|
+
* The map's shape. A reader refuses any other version: it is raised when a
|
|
17
|
+
* field is removed, renamed or changes meaning. A new optional field doesn't
|
|
18
|
+
* raise it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const MOVIE_URL_MAP_VERSION = 1;
|
|
21
|
+
export type MovieUrlMap = {
|
|
22
|
+
version: typeof MOVIE_URL_MAP_VERSION;
|
|
23
|
+
generatedAt: string;
|
|
24
|
+
/**
|
|
25
|
+
* Every film with a page, showing or departed: its id and the slug of its
|
|
26
|
+
* page, `/movies/<id>/<slug>/`.
|
|
27
|
+
*/
|
|
28
|
+
slugs: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Showing films only: the id an unmatched listing would have had (the
|
|
31
|
+
* pipeline's `getId`, the first 8 hex characters of the SHA-256 of the
|
|
32
|
+
* venue's title), mapped to the film that listing is now part of.
|
|
33
|
+
*/
|
|
34
|
+
titleHashes: Record<string, string>;
|
|
35
|
+
/**
|
|
36
|
+
* Showing films only: every slug a film can be found under (its title, its
|
|
37
|
+
* other English titles and its venues' titles) and the films under it.
|
|
38
|
+
*/
|
|
39
|
+
liveSlugs: Record<string, string[]>;
|
|
40
|
+
/**
|
|
41
|
+
* The ids whose page is a departed film's, sorted. Absent from maps built
|
|
42
|
+
* before 0.7.0 of this package.
|
|
43
|
+
*/
|
|
44
|
+
departed?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* The showing films nothing matched, keyed by a hash of the venue's title
|
|
47
|
+
* rather than a TheMovieDB id, sorted. Absent from maps built before 0.7.0.
|
|
48
|
+
*/
|
|
49
|
+
unmatched?: string[];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Below this many characters, a slug must match exactly. One edit in a short
|
|
53
|
+
* slug is usually a different title rather than a typo: `practical-magic`
|
|
54
|
+
* and `practical-magic-2` are both showing, and numbered parts differ by a
|
|
55
|
+
* digit.
|
|
56
|
+
*/
|
|
57
|
+
export declare const FUZZY_MIN_LENGTH = 20;
|
|
58
|
+
/**
|
|
59
|
+
* The most a slug may differ by, as a share of the longer one's length. At
|
|
60
|
+
* 10%, a retitle such as "… African Odysseys at BFI" → "… at the BFI" (about
|
|
61
|
+
* 6%) is caught, while `carrie` → `carrier` (14%) is not. Measured against
|
|
62
|
+
* the films showing on 19 November 2026, the distinct titles within 10% of
|
|
63
|
+
* each other were all siblings - parts 1, 2 and 3 of one programme, a 17:00
|
|
64
|
+
* and a 20:00 performance - which the one-film rule below turns into a 404.
|
|
65
|
+
* At 15%, different things started to meet: Manon and Carmen, Saturday and
|
|
66
|
+
* Sunday brunch.
|
|
67
|
+
*/
|
|
68
|
+
export declare const FUZZY_MAX_DISTANCE = 0.1;
|
|
69
|
+
export type Decision = {
|
|
70
|
+
outcome: "redirect";
|
|
71
|
+
status: 301 | 302;
|
|
72
|
+
location: string;
|
|
73
|
+
rule: "id" | "title-hash" | "slug" | "fuzzy-slug";
|
|
74
|
+
} | {
|
|
75
|
+
outcome: "not-found";
|
|
76
|
+
reason: "not-a-page" | "canonical" | "ambiguous" | "no-match";
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The edit distance between two strings, or Infinity once it must exceed
|
|
80
|
+
* `max` - most comparisons are abandoned within a few characters.
|
|
81
|
+
*/
|
|
82
|
+
export declare function boundedDistance(a: string, b: string, max: number): number;
|
|
83
|
+
/**
|
|
84
|
+
* Where a film URL that GitHub Pages answered with a 404 should go, if
|
|
85
|
+
* anywhere. Only ever asked about a 404, so a page that exists is never
|
|
86
|
+
* redirected.
|
|
87
|
+
*
|
|
88
|
+
* In order:
|
|
89
|
+
* 1. A known id, under the wrong slug or none: the page moved, when
|
|
90
|
+
* TheMovieDB or a venue retitled the film, or the link was cut short.
|
|
91
|
+
* 301, since the id is the page.
|
|
92
|
+
* 2. The old id of a venue's listing that has since been matched to a film:
|
|
93
|
+
* the film still carries the venue's title, and hashing it gives that id
|
|
94
|
+
* back exactly (`titleHashes`). 301, for the same reason.
|
|
95
|
+
* 3. A slug that one showing film is listed under, or long enough and close
|
|
96
|
+
* to one: retitled, or the next edition of a finished event. 302: it's
|
|
97
|
+
* true of today's listings, and tomorrow's could have two.
|
|
98
|
+
*
|
|
99
|
+
* Departed films are matched by id only. A departed film's own URL is a
|
|
100
|
+
* page, so it never reaches here, and counting departed films in 3 would
|
|
101
|
+
* only turn one showing Carrie into an ambiguous pair.
|
|
102
|
+
*/
|
|
103
|
+
export declare function resolve(pathname: string, map: MovieUrlMap): Decision;
|
|
104
|
+
/**
|
|
105
|
+
* Why a URL stopped being a page, which says how worried to be about where
|
|
106
|
+
* it now goes:
|
|
107
|
+
*
|
|
108
|
+
* - `retitled`: the film still has a page, under a new slug.
|
|
109
|
+
* - `listing`: an unmatched listing went: it finished, the venue retitled it,
|
|
110
|
+
* or it was matched to a film. Finishing is the usual reason, and a 404 is
|
|
111
|
+
* the honest answer to it.
|
|
112
|
+
* - `pruned`: a departed film's page went. The seen registry forgets a film a
|
|
113
|
+
* year after it was last listed, and that is the only way a departed page
|
|
114
|
+
* goes.
|
|
115
|
+
* - `lost`: a showing film, matched to TheMovieDB, left without a departed
|
|
116
|
+
* page. Every such film should become one, so this is a fault upstream.
|
|
117
|
+
* - `unknown`: the earlier map predates `departed` and `unmatched`, so a film
|
|
118
|
+
* that went can't be told apart from a listing.
|
|
119
|
+
*/
|
|
120
|
+
export type LostUrlKind = "retitled" | "listing" | "pruned" | "lost" | "unknown";
|
|
121
|
+
export type LostUrl = {
|
|
122
|
+
path: string;
|
|
123
|
+
id: string;
|
|
124
|
+
kind: LostUrlKind;
|
|
125
|
+
/** What the Worker does with the URL now, against the later map. */
|
|
126
|
+
decision: Decision;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Every page in `previous` that `current` doesn't have at the same address,
|
|
130
|
+
* and what the Worker does with it against `current`. In the order of
|
|
131
|
+
* `previous.slugs`, which the site sorts by id.
|
|
132
|
+
*/
|
|
133
|
+
export declare function findLostUrls(previous: MovieUrlMap, current: MovieUrlMap): LostUrl[];
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// src/utils/movie-url-map.ts
|
|
2
|
+
var MOVIE_URL_MAP_FILE = "/movie-urls.json";
|
|
3
|
+
var MOVIE_URL_MAP_VERSION = 1;
|
|
4
|
+
var FUZZY_MIN_LENGTH = 20;
|
|
5
|
+
var FUZZY_MAX_DISTANCE = 0.1;
|
|
6
|
+
var pagePath = (id, slug) => `/movies/${id}/${slug}/`;
|
|
7
|
+
function boundedDistance(a, b, max) {
|
|
8
|
+
if (Math.abs(a.length - b.length) > max) return Infinity;
|
|
9
|
+
let previous = Array.from({ length: b.length + 1 }, (_, j) => j);
|
|
10
|
+
for (let i = 1; i <= a.length; i++) {
|
|
11
|
+
const current = [i];
|
|
12
|
+
let rowMin = i;
|
|
13
|
+
for (let j = 1; j <= b.length; j++) {
|
|
14
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
15
|
+
const value = Math.min(
|
|
16
|
+
previous[j] + 1,
|
|
17
|
+
current[j - 1] + 1,
|
|
18
|
+
previous[j - 1] + cost
|
|
19
|
+
);
|
|
20
|
+
current.push(value);
|
|
21
|
+
if (value < rowMin) rowMin = value;
|
|
22
|
+
}
|
|
23
|
+
if (rowMin > max) return Infinity;
|
|
24
|
+
previous = current;
|
|
25
|
+
}
|
|
26
|
+
return previous[b.length] <= max ? previous[b.length] : Infinity;
|
|
27
|
+
}
|
|
28
|
+
function findNearby(slug, map) {
|
|
29
|
+
const ids = /* @__PURE__ */ new Set();
|
|
30
|
+
for (const [candidate, candidateIds] of Object.entries(map.liveSlugs)) {
|
|
31
|
+
const longer = Math.max(slug.length, candidate.length);
|
|
32
|
+
const max = Math.floor(longer * FUZZY_MAX_DISTANCE);
|
|
33
|
+
if (boundedDistance(slug, candidate, max) <= max) {
|
|
34
|
+
for (const id of candidateIds) ids.add(id);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return ids;
|
|
38
|
+
}
|
|
39
|
+
function resolve(pathname, map) {
|
|
40
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
41
|
+
if (segments[0] !== "movies" || segments.length < 2) {
|
|
42
|
+
return { outcome: "not-found", reason: "not-a-page" };
|
|
43
|
+
}
|
|
44
|
+
const rest = segments.slice(2);
|
|
45
|
+
if (rest.some((segment) => segment.includes("."))) {
|
|
46
|
+
return { outcome: "not-found", reason: "not-a-page" };
|
|
47
|
+
}
|
|
48
|
+
const id = decodeSegment(segments[1]);
|
|
49
|
+
const slug = decodeSegment(rest[0] ?? "").toLowerCase();
|
|
50
|
+
const known = map.slugs[id] ?? map.slugs[id.toLowerCase()];
|
|
51
|
+
if (known !== void 0) {
|
|
52
|
+
const canonicalId = map.slugs[id] !== void 0 ? id : id.toLowerCase();
|
|
53
|
+
const location = pagePath(canonicalId, known);
|
|
54
|
+
if (location === pathname) {
|
|
55
|
+
return { outcome: "not-found", reason: "canonical" };
|
|
56
|
+
}
|
|
57
|
+
return { outcome: "redirect", status: 301, location, rule: "id" };
|
|
58
|
+
}
|
|
59
|
+
const matched = map.titleHashes[id.toLowerCase()];
|
|
60
|
+
if (matched !== void 0) {
|
|
61
|
+
const matchedSlug = map.slugs[matched];
|
|
62
|
+
if (matchedSlug === void 0) {
|
|
63
|
+
throw new Error(`Title hash ${id} names ${matched}, which has no page`);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
outcome: "redirect",
|
|
67
|
+
status: 301,
|
|
68
|
+
location: pagePath(matched, matchedSlug),
|
|
69
|
+
rule: "title-hash"
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (!slug) return { outcome: "not-found", reason: "no-match" };
|
|
73
|
+
const exact = map.liveSlugs[slug];
|
|
74
|
+
if (exact) {
|
|
75
|
+
if (exact.length > 1) return { outcome: "not-found", reason: "ambiguous" };
|
|
76
|
+
return redirectToLive(exact[0], map, "slug");
|
|
77
|
+
}
|
|
78
|
+
if (slug.length < FUZZY_MIN_LENGTH) {
|
|
79
|
+
return { outcome: "not-found", reason: "no-match" };
|
|
80
|
+
}
|
|
81
|
+
const nearby = findNearby(slug, map);
|
|
82
|
+
if (nearby.size > 1) return { outcome: "not-found", reason: "ambiguous" };
|
|
83
|
+
if (nearby.size === 0) return { outcome: "not-found", reason: "no-match" };
|
|
84
|
+
return redirectToLive([...nearby][0], map, "fuzzy-slug");
|
|
85
|
+
}
|
|
86
|
+
function redirectToLive(id, map, rule) {
|
|
87
|
+
const slug = map.slugs[id];
|
|
88
|
+
if (slug === void 0) {
|
|
89
|
+
throw new Error(`Live slug names ${id}, which has no page`);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
outcome: "redirect",
|
|
93
|
+
status: 302,
|
|
94
|
+
location: pagePath(id, slug),
|
|
95
|
+
rule
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function decodeSegment(segment) {
|
|
99
|
+
try {
|
|
100
|
+
return decodeURIComponent(segment);
|
|
101
|
+
} catch {
|
|
102
|
+
return segment;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function findLostUrls(previous, current) {
|
|
106
|
+
const departed = previous.departed && new Set(previous.departed);
|
|
107
|
+
const unmatched = previous.unmatched && new Set(previous.unmatched);
|
|
108
|
+
const kindOf = (id) => {
|
|
109
|
+
if (current.slugs[id] !== void 0) return "retitled";
|
|
110
|
+
if (!departed || !unmatched) return "unknown";
|
|
111
|
+
if (unmatched.has(id)) return "listing";
|
|
112
|
+
if (departed.has(id)) return "pruned";
|
|
113
|
+
return "lost";
|
|
114
|
+
};
|
|
115
|
+
const lost = [];
|
|
116
|
+
for (const [id, slug] of Object.entries(previous.slugs)) {
|
|
117
|
+
if (current.slugs[id] === slug) continue;
|
|
118
|
+
const path = pagePath(id, slug);
|
|
119
|
+
lost.push({ path, id, kind: kindOf(id), decision: resolve(path, current) });
|
|
120
|
+
}
|
|
121
|
+
return lost;
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
FUZZY_MAX_DISTANCE,
|
|
125
|
+
FUZZY_MIN_LENGTH,
|
|
126
|
+
MOVIE_URL_MAP_FILE,
|
|
127
|
+
MOVIE_URL_MAP_VERSION,
|
|
128
|
+
boundedDistance,
|
|
129
|
+
findLostUrls,
|
|
130
|
+
resolve
|
|
131
|
+
};
|
package/package.json
CHANGED