gtfs-to-html 2.12.6 → 2.12.7

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/dist/app/index.js CHANGED
@@ -426,6 +426,10 @@ function formatWarning(text) {
426
426
  return colors.yellow(warningMessage);
427
427
  }
428
428
 
429
+ // src/lib/trip-id-utils.ts
430
+ var getBaseTripId = (tripId) => tripId.replace(/_freq_\d+$/, "");
431
+ var getBaseTripIds = (trips) => Array.from(new Set(trips.map((trip) => getBaseTripId(trip.trip_id))));
432
+
429
433
  // src/lib/geojson-utils.ts
430
434
  var mergeGeojson = (...geojsons) => featureCollection(geojsons.flatMap((geojson) => geojson.features));
431
435
  var truncateGeoJSONDecimals = (geojson, config2) => {
@@ -455,18 +459,19 @@ var truncateGeoJSONDecimals = (geojson, config2) => {
455
459
  return geojson;
456
460
  };
457
461
  function getTimetableGeoJSON(timetable, config2) {
462
+ const tripIds = getBaseTripIds(timetable.orderedTrips);
458
463
  const shapesGeojsons = timetable.route_ids.map(
459
464
  (routeId) => getShapesAsGeoJSON({
460
465
  route_id: routeId,
461
466
  direction_id: timetable.direction_id,
462
- trip_id: timetable.orderedTrips.map((trip) => trip.trip_id)
467
+ trip_id: tripIds
463
468
  })
464
469
  );
465
470
  const stopsGeojsons = timetable.route_ids.map(
466
471
  (routeId) => getStopsAsGeoJSON({
467
472
  route_id: routeId,
468
473
  direction_id: timetable.direction_id,
469
- trip_id: timetable.orderedTrips.map((trip) => trip.trip_id)
474
+ trip_id: tripIds
470
475
  })
471
476
  );
472
477
  const geojson = mergeGeojson(...shapesGeojsons, ...stopsGeojsons);
@@ -504,7 +509,7 @@ function getAgencyGeoJSON(config2) {
504
509
  // package.json
505
510
  var package_default = {
506
511
  name: "gtfs-to-html",
507
- version: "2.12.6",
512
+ version: "2.12.7",
508
513
  private: false,
509
514
  description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
510
515
  keywords: [
@@ -563,11 +568,11 @@ var package_default = {
563
568
  "css.escape": "^1.5.1",
564
569
  "csv-stringify": "^6.7.0",
565
570
  express: "^5.2.1",
566
- gtfs: "^4.18.4",
571
+ gtfs: "^4.18.5",
567
572
  "gtfs-realtime-pbf-js-module": "^1.0.0",
568
573
  "js-beautify": "^1.15.4",
569
- "lodash-es": "^4.17.23",
570
- "maplibre-gl": "^5.21.0",
574
+ "lodash-es": "^4.18.1",
575
+ "maplibre-gl": "^5.21.1",
571
576
  marked: "^17.0.5",
572
577
  moment: "^2.30.1",
573
578
  pbf: "^4.0.1",
@@ -597,7 +602,7 @@ var package_default = {
597
602
  "lint-staged": "^16.4.0",
598
603
  prettier: "^3.8.1",
599
604
  tsup: "^8.5.1",
600
- typescript: "^5.9.3"
605
+ typescript: "^6.0.2"
601
606
  },
602
607
  engines: {
603
608
  node: ">= 22"
@@ -827,7 +832,7 @@ var getTimetableNotesForTimetable = (timetable, config2) => {
827
832
  }),
828
833
  // Get all notes for all trips in this timetable.
829
834
  ...getTimetableNotesReferences({
830
- trip_id: timetable.orderedTrips.map((trip) => trip.trip_id)
835
+ trip_id: getBaseTripIds(timetable.orderedTrips)
831
836
  }),
832
837
  // Get all notes for all stops in this timetable.
833
838
  ...getTimetableNotesReferences({
@@ -1021,7 +1026,7 @@ var convertRoutesToTimetablePages = (config2) => {
1021
1026
  if (config2.groupTimetablesIntoPages === true) {
1022
1027
  timetablePages.push(
1023
1028
  createTimetablePage({
1024
- timetablePageId: `route_${route.route_short_name ?? route.route_long_name}`,
1029
+ timetablePageId: `route_${route.route_id}`,
1025
1030
  timetables,
1026
1031
  config: config2
1027
1032
  })
@@ -1636,9 +1641,7 @@ var formatTimetables = (timetables, config2) => {
1636
1641
  if (config2.showMap) {
1637
1642
  timetable.geojson = getTimetableGeoJSON(timetable, config2);
1638
1643
  }
1639
- timetable.trip_ids = uniq(
1640
- timetable.orderedTrips.map((trip) => trip.trip_id)
1641
- );
1644
+ timetable.trip_ids = uniq(getBaseTripIds(timetable.orderedTrips));
1642
1645
  timetable.orderedTrips = filterTrips(timetable, calendars, config2);
1643
1646
  timetable.stops = formatStops(timetable, config2);
1644
1647
  return timetable;
@@ -1804,7 +1807,7 @@ var getTimetablePageById = (timetablePageId, config2) => {
1804
1807
  }
1805
1808
  if (timetablePageId.startsWith("route_")) {
1806
1809
  const routes = getRoutes({
1807
- route_short_name: timetablePageId.split("_")[1]
1810
+ route_id: timetablePageId.split("_")[1]
1808
1811
  });
1809
1812
  if (routes.length === 0) {
1810
1813
  throw new GtfsToHtmlError(