gtfs-to-html 2.11.2 → 2.11.4
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 +27 -19
- package/dist/app/index.js.map +1 -1
- package/dist/bin/gtfs-to-html.js +28 -20
- package/dist/bin/gtfs-to-html.js.map +1 -1
- package/dist/index.d.ts +19 -2
- package/dist/index.js +28 -20
- package/dist/index.js.map +1 -1
- package/package.json +13 -11
- package/views/default/formatting_functions.pug +1 -1
- package/views/default/js/system-map.js +1 -1
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[];
|
|
@@ -24,6 +24,7 @@ interface Config {
|
|
|
24
24
|
noHead?: boolean;
|
|
25
25
|
noPickupSymbol?: string;
|
|
26
26
|
noPickupText?: string;
|
|
27
|
+
noRegularServiceDaysText?: string;
|
|
27
28
|
noServiceSymbol?: string;
|
|
28
29
|
noServiceText?: string;
|
|
29
30
|
outputFormat?: 'html' | 'pdf' | 'csv';
|
|
@@ -55,6 +56,22 @@ interface Config {
|
|
|
55
56
|
logFunction?: (text: string) => void;
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
interface FormattedTimetable extends Timetable {
|
|
60
|
+
route_ids: string[];
|
|
61
|
+
trip_ids: string[];
|
|
62
|
+
routes: Route[];
|
|
63
|
+
service_ids?: string[];
|
|
64
|
+
warnings?: string[];
|
|
65
|
+
has_continues_as_route?: boolean;
|
|
66
|
+
has_continues_from_route?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface FormattedTimetablePage extends TimetablePage {
|
|
70
|
+
timetables: FormattedTimetable[];
|
|
71
|
+
routes: Route[];
|
|
72
|
+
relativePath?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
58
75
|
declare const gtfsToHtml: (initialConfig: Config) => Promise<string>;
|
|
59
76
|
|
|
60
|
-
export { gtfsToHtml as default };
|
|
77
|
+
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.
|
|
500
|
+
version: "2.11.4",
|
|
501
501
|
private: false,
|
|
502
502
|
description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
|
|
503
503
|
keywords: [
|
|
@@ -522,7 +522,8 @@ var package_default = {
|
|
|
522
522
|
"Holly Kvalheim",
|
|
523
523
|
"Pawajoro",
|
|
524
524
|
"Andrea Mignone",
|
|
525
|
-
"Evo Stamatov"
|
|
525
|
+
"Evo Stamatov",
|
|
526
|
+
"Sebastian Knopf"
|
|
526
527
|
],
|
|
527
528
|
type: "module",
|
|
528
529
|
main: "./dist/index.js",
|
|
@@ -550,16 +551,16 @@ var package_default = {
|
|
|
550
551
|
"cli-table": "^0.3.11",
|
|
551
552
|
"csv-stringify": "^6.6.0",
|
|
552
553
|
express: "^5.1.0",
|
|
553
|
-
gtfs: "^4.18.
|
|
554
|
+
gtfs: "^4.18.1",
|
|
554
555
|
"gtfs-realtime-pbf-js-module": "^1.0.0",
|
|
555
556
|
"js-beautify": "^1.15.4",
|
|
556
557
|
"lodash-es": "^4.17.21",
|
|
557
|
-
marked: "^16.
|
|
558
|
+
marked: "^16.4.1",
|
|
558
559
|
moment: "^2.30.1",
|
|
559
560
|
pbf: "^4.0.1",
|
|
560
561
|
"pretty-error": "^4.0.0",
|
|
561
562
|
pug: "^3.0.3",
|
|
562
|
-
puppeteer: "^24.
|
|
563
|
+
puppeteer: "^24.26.1",
|
|
563
564
|
"sanitize-filename": "^1.6.3",
|
|
564
565
|
"sanitize-html": "^2.17.0",
|
|
565
566
|
sqlstring: "^2.3.3",
|
|
@@ -568,23 +569,24 @@ var package_default = {
|
|
|
568
569
|
yoctocolors: "^2.1.2"
|
|
569
570
|
},
|
|
570
571
|
devDependencies: {
|
|
571
|
-
"@types/archiver": "^
|
|
572
|
-
"@types/
|
|
572
|
+
"@types/archiver": "^7.0.0",
|
|
573
|
+
"@types/cli-table": "^0.3.4",
|
|
574
|
+
"@types/express": "^5.0.4",
|
|
573
575
|
"@types/insane": "^1.0.0",
|
|
574
576
|
"@types/js-beautify": "^1.14.3",
|
|
575
577
|
"@types/lodash-es": "^4.17.12",
|
|
576
578
|
"@types/morgan": "^1.9.10",
|
|
577
|
-
"@types/node": "^
|
|
579
|
+
"@types/node": "^24",
|
|
578
580
|
"@types/pug": "^2.0.10",
|
|
579
581
|
"@types/sanitize-html": "^2.16.0",
|
|
580
582
|
"@types/sqlstring": "^2.3.2",
|
|
581
583
|
"@types/toposort": "^2.0.7",
|
|
582
|
-
"@types/yargs": "^17.0.
|
|
584
|
+
"@types/yargs": "^17.0.34",
|
|
583
585
|
husky: "^9.1.7",
|
|
584
|
-
"lint-staged": "^16.
|
|
586
|
+
"lint-staged": "^16.2.6",
|
|
585
587
|
prettier: "^3.6.2",
|
|
586
588
|
tsup: "^8.5.0",
|
|
587
|
-
typescript: "^5.9.
|
|
589
|
+
typescript: "^5.9.3"
|
|
588
590
|
},
|
|
589
591
|
engines: {
|
|
590
592
|
node: ">= 22"
|
|
@@ -711,9 +713,6 @@ var sortTrips = (trips, config) => {
|
|
|
711
713
|
const lastStopId = last(longestTripStoptimes).stop_id;
|
|
712
714
|
sortedTrips = sortTripsByStoptimeAtStop(trips, lastStopId);
|
|
713
715
|
}
|
|
714
|
-
if (config.showDuplicateTrips === false) {
|
|
715
|
-
return deduplicateTrips(sortedTrips ?? []);
|
|
716
|
-
}
|
|
717
716
|
return sortedTrips ?? [];
|
|
718
717
|
};
|
|
719
718
|
var sortTripsByStoptimeAtStop = (trips, stopId) => sortBy(trips, (trip) => {
|
|
@@ -733,7 +732,7 @@ var getCalendarDatesForTimetable = (timetable, config) => {
|
|
|
733
732
|
const excludedDates = /* @__PURE__ */ new Set();
|
|
734
733
|
const includedDates = /* @__PURE__ */ new Set();
|
|
735
734
|
for (const calendarDate of calendarDates) {
|
|
736
|
-
if (moment2(calendarDate.date, "YYYYMMDD").isBetween(start, end)) {
|
|
735
|
+
if (moment2(calendarDate.date, "YYYYMMDD").isBetween(start, end, "day", "[]")) {
|
|
737
736
|
if (calendarDate.exception_type === 1) {
|
|
738
737
|
includedDates.add(formatDate(calendarDate, config.dateFormat));
|
|
739
738
|
} else if (calendarDate.exception_type === 2) {
|
|
@@ -1342,7 +1341,7 @@ var addTripContinuation = (trip, timetable) => {
|
|
|
1342
1341
|
trip.continues_as_route = nextTrip;
|
|
1343
1342
|
}
|
|
1344
1343
|
};
|
|
1345
|
-
var filterTrips = (timetable) => {
|
|
1344
|
+
var filterTrips = (timetable, config) => {
|
|
1346
1345
|
let filteredTrips = timetable.orderedTrips;
|
|
1347
1346
|
for (const trip of filteredTrips) {
|
|
1348
1347
|
const combinedStoptimes = [];
|
|
@@ -1366,6 +1365,9 @@ var filterTrips = (timetable) => {
|
|
|
1366
1365
|
filteredTrips = filteredTrips.filter(
|
|
1367
1366
|
(trip) => trip.stoptimes.length > 1
|
|
1368
1367
|
);
|
|
1368
|
+
if (config.showDuplicateTrips === false) {
|
|
1369
|
+
filteredTrips = deduplicateTrips(filteredTrips);
|
|
1370
|
+
}
|
|
1369
1371
|
return filteredTrips;
|
|
1370
1372
|
};
|
|
1371
1373
|
var getTripsForTimetable = (timetable, calendars, config) => {
|
|
@@ -1503,7 +1505,10 @@ var formatTimetables = (timetables, config) => {
|
|
|
1503
1505
|
if (config.showMap) {
|
|
1504
1506
|
timetable.geojson = getTimetableGeoJSON(timetable, config);
|
|
1505
1507
|
}
|
|
1506
|
-
timetable.
|
|
1508
|
+
timetable.trip_ids = uniq(
|
|
1509
|
+
timetable.orderedTrips.map((trip) => trip.trip_id)
|
|
1510
|
+
);
|
|
1511
|
+
timetable.orderedTrips = filterTrips(timetable, config);
|
|
1507
1512
|
timetable.stops = formatStops(timetable, config);
|
|
1508
1513
|
return timetable;
|
|
1509
1514
|
});
|
|
@@ -1608,7 +1613,9 @@ var getTimetablePageById = (timetablePageId, config) => {
|
|
|
1608
1613
|
const timetablePages = getTimetablePages({
|
|
1609
1614
|
timetable_page_id: timetablePageId
|
|
1610
1615
|
});
|
|
1611
|
-
const timetables = mergeTimetablesWithSameId(
|
|
1616
|
+
const timetables = mergeTimetablesWithSameId(
|
|
1617
|
+
getTimetables()
|
|
1618
|
+
);
|
|
1612
1619
|
if (timetablePages.length > 1) {
|
|
1613
1620
|
throw new Error(
|
|
1614
1621
|
`Multiple timetable_pages found for timetable_page_id=${timetablePageId}`
|
|
@@ -1749,6 +1756,7 @@ function setDefaultConfig(initialConfig) {
|
|
|
1749
1756
|
noHead: false,
|
|
1750
1757
|
noPickupSymbol: "**",
|
|
1751
1758
|
noPickupText: "No pickup available",
|
|
1759
|
+
noRegularServiceDaysText: "No regular service days",
|
|
1752
1760
|
noServiceSymbol: "-",
|
|
1753
1761
|
noServiceText: "No service at this stop",
|
|
1754
1762
|
outputFormat: "html",
|
|
@@ -2047,7 +2055,7 @@ function formatDays(calendar, config) {
|
|
|
2047
2055
|
}
|
|
2048
2056
|
}
|
|
2049
2057
|
if (dayString.length === 0) {
|
|
2050
|
-
dayString =
|
|
2058
|
+
dayString = config.noRegularServiceDaysText;
|
|
2051
2059
|
}
|
|
2052
2060
|
return dayString;
|
|
2053
2061
|
}
|
|
@@ -2507,7 +2515,7 @@ var gtfsToHtml = async (initialConfig) => {
|
|
|
2507
2515
|
timetablePageId,
|
|
2508
2516
|
config
|
|
2509
2517
|
);
|
|
2510
|
-
for (const timetable of timetablePage.
|
|
2518
|
+
for (const timetable of timetablePage.consolidatedTimetables) {
|
|
2511
2519
|
if (timetable.warnings) {
|
|
2512
2520
|
for (const warning of timetable.warnings) {
|
|
2513
2521
|
stats.warnings.push(warning);
|