gtfs-to-html 2.11.4 → 2.12.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/dist/app/index.js CHANGED
@@ -123,6 +123,7 @@ import toposort from "toposort";
123
123
 
124
124
  // src/lib/file-utils.ts
125
125
  import { dirname, join, resolve } from "path";
126
+ import cssEscape from "css.escape";
126
127
  import { createWriteStream } from "fs";
127
128
  import { fileURLToPath } from "url";
128
129
  import {
@@ -149,7 +150,6 @@ import { marked } from "marked";
149
150
  // src/lib/template-functions.ts
150
151
  var template_functions_exports = {};
151
152
  __export(template_functions_exports, {
152
- formatHtmlId: () => formatHtmlId,
153
153
  formatTripName: () => formatTripName,
154
154
  formatTripNameForCSV: () => formatTripNameForCSV,
155
155
  getNotesForStop: () => getNotesForStop,
@@ -162,9 +162,6 @@ __export(template_functions_exports, {
162
162
  timetablePageHasDifferentLabels: () => timetablePageHasDifferentLabels
163
163
  });
164
164
  import { every } from "lodash-es";
165
- function formatHtmlId(id) {
166
- return id.replace(/([^\w[\]{}.:-])\s?/g, "");
167
- }
168
165
  function timetableHasDifferentDays(timetable) {
169
166
  return !every(timetable.orderedTrips, (trip, idx) => {
170
167
  if (idx === 0) {
@@ -309,6 +306,7 @@ async function renderTemplate(templateFileName, templateVars, config2) {
309
306
  const templatePath = getPathToTemplateFile(templateFileName, config2);
310
307
  const html = await renderFile(templatePath, {
311
308
  _,
309
+ cssEscape,
312
310
  md: (text) => sanitizeHtml(marked.parseInline(text)),
313
311
  ...template_functions_exports,
314
312
  formatRouteColor,
@@ -430,7 +428,7 @@ function getAgencyGeoJSON(config2) {
430
428
  // package.json
431
429
  var package_default = {
432
430
  name: "gtfs-to-html",
433
- version: "2.11.4",
431
+ version: "2.12.0",
434
432
  private: false,
435
433
  description: "Build human readable transit timetables as HTML, PDF or CSV from GTFS",
436
434
  keywords: [
@@ -477,23 +475,26 @@ var package_default = {
477
475
  prepare: "husky"
478
476
  },
479
477
  dependencies: {
478
+ "@maplibre/maplibre-gl-geocoder": "^1.9.1",
480
479
  "@turf/helpers": "^7.2.0",
481
480
  "@turf/simplify": "^7.2.0",
482
481
  anchorme: "^3.0.8",
483
482
  archiver: "^7.0.1",
484
483
  "cli-table": "^0.3.11",
484
+ "css.escape": "^1.5.1",
485
485
  "csv-stringify": "^6.6.0",
486
486
  express: "^5.1.0",
487
487
  gtfs: "^4.18.1",
488
488
  "gtfs-realtime-pbf-js-module": "^1.0.0",
489
489
  "js-beautify": "^1.15.4",
490
490
  "lodash-es": "^4.17.21",
491
- marked: "^16.4.1",
491
+ "maplibre-gl": "^5.12.0",
492
+ marked: "^17.0.0",
492
493
  moment: "^2.30.1",
493
494
  pbf: "^4.0.1",
494
495
  "pretty-error": "^4.0.0",
495
496
  pug: "^3.0.3",
496
- puppeteer: "^24.26.1",
497
+ puppeteer: "^24.29.1",
497
498
  "sanitize-filename": "^1.6.3",
498
499
  "sanitize-html": "^2.17.0",
499
500
  sqlstring: "^2.3.3",
@@ -504,7 +505,7 @@ var package_default = {
504
505
  devDependencies: {
505
506
  "@types/archiver": "^7.0.0",
506
507
  "@types/cli-table": "^0.3.4",
507
- "@types/express": "^5.0.4",
508
+ "@types/express": "^5.0.5",
508
509
  "@types/insane": "^1.0.0",
509
510
  "@types/js-beautify": "^1.14.3",
510
511
  "@types/lodash-es": "^4.17.12",
@@ -665,7 +666,12 @@ var getCalendarDatesForTimetable = (timetable, config2) => {
665
666
  const excludedDates = /* @__PURE__ */ new Set();
666
667
  const includedDates = /* @__PURE__ */ new Set();
667
668
  for (const calendarDate of calendarDates) {
668
- if (moment2(calendarDate.date, "YYYYMMDD").isBetween(start, end, "day", "[]")) {
669
+ if (moment2(calendarDate.date, "YYYYMMDD").isBetween(
670
+ start,
671
+ end,
672
+ void 0,
673
+ "[]"
674
+ )) {
669
675
  if (calendarDate.exception_type === 1) {
670
676
  includedDates.add(formatDate(calendarDate, config2.dateFormat));
671
677
  } else if (calendarDate.exception_type === 2) {
@@ -2187,27 +2193,30 @@ app.use((req, res, next) => {
2187
2193
  });
2188
2194
  var staticAssetPath = config.templatePath === void 0 ? getPathToViewsFolder(config) : untildify(config.templatePath);
2189
2195
  app.use(express.static(staticAssetPath));
2190
- app.use(
2191
- "/js",
2192
- express.static(
2193
- join2(dirname2(fileURLToPath2(import.meta.resolve("pbf"))), "dist")
2194
- )
2195
- );
2196
- app.use(
2197
- "/js",
2198
- express.static(
2199
- dirname2(fileURLToPath2(import.meta.resolve("gtfs-realtime-pbf-js-module")))
2200
- )
2201
- );
2202
- app.use(
2203
- "/js",
2204
- express.static(
2205
- join2(
2206
- dirname2(fileURLToPath2(import.meta.resolve("anchorme"))),
2207
- "../../dist/browser"
2208
- )
2209
- )
2210
- );
2196
+ var frontendLibraryPaths = [
2197
+ { route: "/js", package: "pbf", subPath: "dist" },
2198
+ { route: "/js", package: "gtfs-realtime-pbf-js-module", subPath: "" },
2199
+ { route: "/js", package: "anchorme", subPath: "../../dist/browser" },
2200
+ { route: "/js", package: "maplibre-gl", subPath: "../dist" },
2201
+ {
2202
+ route: "/js",
2203
+ package: "@maplibre/maplibre-gl-geocoder",
2204
+ subPath: "../dist"
2205
+ },
2206
+ { route: "/css", package: "maplibre-gl", subPath: "../dist" },
2207
+ {
2208
+ route: "/css",
2209
+ package: "@maplibre/maplibre-gl-geocoder",
2210
+ subPath: "../dist"
2211
+ }
2212
+ ];
2213
+ var resolvePackagePath = (packageName, subPath) => {
2214
+ const packagePath = dirname2(fileURLToPath2(import.meta.resolve(packageName)));
2215
+ return subPath ? join2(packagePath, subPath) : packagePath;
2216
+ };
2217
+ for (const { route, package: pkg, subPath } of frontendLibraryPaths) {
2218
+ app.use(route, express.static(resolvePackagePath(pkg, subPath)));
2219
+ }
2211
2220
  app.get("/", async (req, res, next) => {
2212
2221
  try {
2213
2222
  const timetablePages = [];