gtfs-to-html 2.11.5 → 2.12.1

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.js CHANGED
@@ -12,6 +12,7 @@ import sanitize2 from "sanitize-filename";
12
12
 
13
13
  // src/lib/file-utils.ts
14
14
  import { dirname, join, resolve } from "path";
15
+ import cssEscape from "css.escape";
15
16
  import { createWriteStream } from "fs";
16
17
  import { fileURLToPath } from "url";
17
18
  import {
@@ -383,7 +384,6 @@ function getAgencyGeoJSON(config) {
383
384
  // src/lib/template-functions.ts
384
385
  var template_functions_exports = {};
385
386
  __export(template_functions_exports, {
386
- formatHtmlId: () => formatHtmlId,
387
387
  formatTripName: () => formatTripName,
388
388
  formatTripNameForCSV: () => formatTripNameForCSV,
389
389
  getNotesForStop: () => getNotesForStop,
@@ -396,9 +396,6 @@ __export(template_functions_exports, {
396
396
  timetablePageHasDifferentLabels: () => timetablePageHasDifferentLabels
397
397
  });
398
398
  import { every } from "lodash-es";
399
- function formatHtmlId(id) {
400
- return id.replace(/([^\w[\]{}.:-])\s?/g, "");
401
- }
402
399
  function timetableHasDifferentDays(timetable) {
403
400
  return !every(timetable.orderedTrips, (trip, idx) => {
404
401
  if (idx === 0) {
@@ -497,7 +494,7 @@ function formatTripNameForCSV(trip, timetable) {
497
494
  // package.json
498
495
  var package_default = {
499
496
  name: "gtfs-to-html",
500
- version: "2.11.5",
497
+ version: "2.12.1",
501
498
  private: false,
502
499
  description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
503
500
  keywords: [
@@ -544,23 +541,26 @@ var package_default = {
544
541
  prepare: "husky"
545
542
  },
546
543
  dependencies: {
547
- "@turf/helpers": "^7.2.0",
548
- "@turf/simplify": "^7.2.0",
544
+ "@maplibre/maplibre-gl-geocoder": "^1.9.1",
545
+ "@turf/helpers": "^7.3.0",
546
+ "@turf/simplify": "^7.3.0",
549
547
  anchorme: "^3.0.8",
550
548
  archiver: "^7.0.1",
551
549
  "cli-table": "^0.3.11",
550
+ "css.escape": "^1.5.1",
552
551
  "csv-stringify": "^6.6.0",
553
552
  express: "^5.1.0",
554
553
  gtfs: "^4.18.1",
555
554
  "gtfs-realtime-pbf-js-module": "^1.0.0",
556
555
  "js-beautify": "^1.15.4",
557
556
  "lodash-es": "^4.17.21",
558
- marked: "^16.4.1",
557
+ "maplibre-gl": "^5.13.0",
558
+ marked: "^17.0.0",
559
559
  moment: "^2.30.1",
560
560
  pbf: "^4.0.1",
561
561
  "pretty-error": "^4.0.0",
562
562
  pug: "^3.0.3",
563
- puppeteer: "^24.29.0",
563
+ puppeteer: "^24.30.0",
564
564
  "sanitize-filename": "^1.6.3",
565
565
  "sanitize-html": "^2.17.0",
566
566
  sqlstring: "^2.3.3",
@@ -581,11 +581,11 @@ var package_default = {
581
581
  "@types/sanitize-html": "^2.16.0",
582
582
  "@types/sqlstring": "^2.3.2",
583
583
  "@types/toposort": "^2.0.7",
584
- "@types/yargs": "^17.0.34",
584
+ "@types/yargs": "^17.0.35",
585
585
  husky: "^9.1.7",
586
- "lint-staged": "^16.2.6",
586
+ "lint-staged": "^16.2.7",
587
587
  prettier: "^3.6.2",
588
- tsup: "^8.5.0",
588
+ tsup: "^8.5.1",
589
589
  typescript: "^5.9.3"
590
590
  },
591
591
  engines: {
@@ -732,7 +732,12 @@ var getCalendarDatesForTimetable = (timetable, config) => {
732
732
  const excludedDates = /* @__PURE__ */ new Set();
733
733
  const includedDates = /* @__PURE__ */ new Set();
734
734
  for (const calendarDate of calendarDates) {
735
- if (moment2(calendarDate.date, "YYYYMMDD").isBetween(start, end, "day", "[]")) {
735
+ if (moment2(calendarDate.date, "YYYYMMDD").isBetween(
736
+ start,
737
+ end,
738
+ void 0,
739
+ "[]"
740
+ )) {
736
741
  if (calendarDate.exception_type === 1) {
737
742
  includedDates.add(formatDate(calendarDate, config.dateFormat));
738
743
  } else if (calendarDate.exception_type === 2) {
@@ -2254,10 +2259,10 @@ function formatTimetableLabel(timetable) {
2254
2259
  return timetableLabel;
2255
2260
  }
2256
2261
  var formatRouteName = (route) => {
2257
- if (route.route_long_name) {
2258
- return `Route ${route.route_long_name}`;
2262
+ if (route.route_long_name === null || route.route_long_name === "") {
2263
+ return `Route ${route.route_short_name}`;
2259
2264
  }
2260
- return route.route_short_name ?? "Unknown";
2265
+ return route.route_long_name ?? "Unknown";
2261
2266
  };
2262
2267
  var formatRouteNameForFilename = (route) => {
2263
2268
  if (route.route_short_name) {
@@ -2373,6 +2378,46 @@ async function copyStaticAssets(config, outputPath) {
2373
2378
  join(outputPath, "js/anchorme.min.js")
2374
2379
  );
2375
2380
  }
2381
+ if (config.showMap) {
2382
+ await copyFile(
2383
+ join(
2384
+ dirname(findPackageJSON("maplibre-gl", import.meta.url)),
2385
+ "dist/maplibre-gl.js"
2386
+ ),
2387
+ join(outputPath, "js/maplibre-gl.js")
2388
+ );
2389
+ await copyFile(
2390
+ join(
2391
+ dirname(findPackageJSON("maplibre-gl", import.meta.url)),
2392
+ "dist/maplibre-gl.css"
2393
+ ),
2394
+ join(outputPath, "css/maplibre-gl.css")
2395
+ );
2396
+ await copyFile(
2397
+ join(
2398
+ dirname(
2399
+ findPackageJSON(
2400
+ "@maplibre/maplibre-gl-geocoder",
2401
+ import.meta.url
2402
+ )
2403
+ ),
2404
+ "dist/maplibre-gl-geocoder.js"
2405
+ ),
2406
+ join(outputPath, "js/maplibre-gl-geocoder.js")
2407
+ );
2408
+ await copyFile(
2409
+ join(
2410
+ dirname(
2411
+ findPackageJSON(
2412
+ "@maplibre/maplibre-gl-geocoder",
2413
+ import.meta.url
2414
+ )
2415
+ ),
2416
+ "dist/maplibre-gl-geocoder.css"
2417
+ ),
2418
+ join(outputPath, "css/maplibre-gl-geocoder.css")
2419
+ );
2420
+ }
2376
2421
  }
2377
2422
  function zipFolder(outputPath) {
2378
2423
  const output = createWriteStream(join(outputPath, "timetables.zip"));
@@ -2433,6 +2478,7 @@ async function renderTemplate(templateFileName, templateVars, config) {
2433
2478
  const templatePath = getPathToTemplateFile(templateFileName, config);
2434
2479
  const html = await renderFile(templatePath, {
2435
2480
  _,
2481
+ cssEscape,
2436
2482
  md: (text) => sanitizeHtml(marked.parseInline(text)),
2437
2483
  ...template_functions_exports,
2438
2484
  formatRouteColor,