gtfs-to-html 2.11.2 → 2.11.3

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ConfigAgency } from 'gtfs';
1
+ import { ConfigAgency, Timetable, Route, TimetablePage } from 'gtfs';
2
2
 
3
3
  interface Config {
4
4
  agencies: ConfigAgency[];
@@ -55,6 +55,22 @@ interface Config {
55
55
  logFunction?: (text: string) => void;
56
56
  }
57
57
 
58
+ interface FormattedTimetable extends Timetable {
59
+ route_ids: string[];
60
+ trip_ids: string[];
61
+ routes: Route[];
62
+ service_ids?: string[];
63
+ warnings?: string[];
64
+ has_continues_as_route?: boolean;
65
+ has_continues_from_route?: boolean;
66
+ }
67
+
68
+ interface FormattedTimetablePage extends TimetablePage {
69
+ timetables: FormattedTimetable[];
70
+ routes: Route[];
71
+ relativePath?: string;
72
+ }
73
+
58
74
  declare const gtfsToHtml: (initialConfig: Config) => Promise<string>;
59
75
 
60
- export { gtfsToHtml as default };
76
+ export { type Config, type FormattedTimetable, type FormattedTimetablePage, gtfsToHtml as default };
package/dist/index.js CHANGED
@@ -497,7 +497,7 @@ function formatTripNameForCSV(trip, timetable) {
497
497
  // package.json
498
498
  var package_default = {
499
499
  name: "gtfs-to-html",
500
- version: "2.11.2",
500
+ version: "2.11.3",
501
501
  private: false,
502
502
  description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
503
503
  keywords: [
@@ -559,7 +559,7 @@ var package_default = {
559
559
  pbf: "^4.0.1",
560
560
  "pretty-error": "^4.0.0",
561
561
  pug: "^3.0.3",
562
- puppeteer: "^24.21.0",
562
+ puppeteer: "^24.23.0",
563
563
  "sanitize-filename": "^1.6.3",
564
564
  "sanitize-html": "^2.17.0",
565
565
  sqlstring: "^2.3.3",
@@ -569,22 +569,23 @@ var package_default = {
569
569
  },
570
570
  devDependencies: {
571
571
  "@types/archiver": "^6.0.3",
572
+ "@types/cli-table": "^0.3.4",
572
573
  "@types/express": "^5.0.3",
573
574
  "@types/insane": "^1.0.0",
574
575
  "@types/js-beautify": "^1.14.3",
575
576
  "@types/lodash-es": "^4.17.12",
576
577
  "@types/morgan": "^1.9.10",
577
- "@types/node": "^22",
578
+ "@types/node": "^24",
578
579
  "@types/pug": "^2.0.10",
579
580
  "@types/sanitize-html": "^2.16.0",
580
581
  "@types/sqlstring": "^2.3.2",
581
582
  "@types/toposort": "^2.0.7",
582
583
  "@types/yargs": "^17.0.33",
583
584
  husky: "^9.1.7",
584
- "lint-staged": "^16.1.6",
585
+ "lint-staged": "^16.2.3",
585
586
  prettier: "^3.6.2",
586
587
  tsup: "^8.5.0",
587
- typescript: "^5.9.2"
588
+ typescript: "^5.9.3"
588
589
  },
589
590
  engines: {
590
591
  node: ">= 22"
@@ -711,9 +712,6 @@ var sortTrips = (trips, config) => {
711
712
  const lastStopId = last(longestTripStoptimes).stop_id;
712
713
  sortedTrips = sortTripsByStoptimeAtStop(trips, lastStopId);
713
714
  }
714
- if (config.showDuplicateTrips === false) {
715
- return deduplicateTrips(sortedTrips ?? []);
716
- }
717
715
  return sortedTrips ?? [];
718
716
  };
719
717
  var sortTripsByStoptimeAtStop = (trips, stopId) => sortBy(trips, (trip) => {
@@ -1342,7 +1340,7 @@ var addTripContinuation = (trip, timetable) => {
1342
1340
  trip.continues_as_route = nextTrip;
1343
1341
  }
1344
1342
  };
1345
- var filterTrips = (timetable) => {
1343
+ var filterTrips = (timetable, config) => {
1346
1344
  let filteredTrips = timetable.orderedTrips;
1347
1345
  for (const trip of filteredTrips) {
1348
1346
  const combinedStoptimes = [];
@@ -1366,6 +1364,9 @@ var filterTrips = (timetable) => {
1366
1364
  filteredTrips = filteredTrips.filter(
1367
1365
  (trip) => trip.stoptimes.length > 1
1368
1366
  );
1367
+ if (config.showDuplicateTrips === false) {
1368
+ filteredTrips = deduplicateTrips(filteredTrips);
1369
+ }
1369
1370
  return filteredTrips;
1370
1371
  };
1371
1372
  var getTripsForTimetable = (timetable, calendars, config) => {
@@ -1503,7 +1504,10 @@ var formatTimetables = (timetables, config) => {
1503
1504
  if (config.showMap) {
1504
1505
  timetable.geojson = getTimetableGeoJSON(timetable, config);
1505
1506
  }
1506
- timetable.orderedTrips = filterTrips(timetable);
1507
+ timetable.trip_ids = uniq(
1508
+ timetable.orderedTrips.map((trip) => trip.trip_id)
1509
+ );
1510
+ timetable.orderedTrips = filterTrips(timetable, config);
1507
1511
  timetable.stops = formatStops(timetable, config);
1508
1512
  return timetable;
1509
1513
  });
@@ -1608,7 +1612,9 @@ var getTimetablePageById = (timetablePageId, config) => {
1608
1612
  const timetablePages = getTimetablePages({
1609
1613
  timetable_page_id: timetablePageId
1610
1614
  });
1611
- const timetables = mergeTimetablesWithSameId(getTimetables());
1615
+ const timetables = mergeTimetablesWithSameId(
1616
+ getTimetables()
1617
+ );
1612
1618
  if (timetablePages.length > 1) {
1613
1619
  throw new Error(
1614
1620
  `Multiple timetable_pages found for timetable_page_id=${timetablePageId}`