liftie 3.56.5 → 4.0.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/Makefile +2 -2
- package/app.js +33 -25
- package/lib/checker.js +1 -1
- package/lib/cli/curl.js +8 -8
- package/lib/cli/dirs.js +8 -6
- package/lib/cli/fetch.js +16 -17
- package/lib/cli/for-each-resort.js +4 -11
- package/lib/cli/generate.js +11 -11
- package/lib/cli/noaa.js +28 -42
- package/lib/client/about/index.js +2 -6
- package/lib/client/boot/height.js +2 -6
- package/lib/client/boot/index.js +8 -11
- package/lib/client/boot/service-worker.js +1 -5
- package/lib/client/minimax/index.js +1 -3
- package/lib/client/resort/dom.js +2 -7
- package/lib/client/resort/index.js +7 -10
- package/lib/client/resort/lifts.js +4 -5
- package/lib/client/resort/snow.js +3 -4
- package/lib/client/resort/weather.js +3 -4
- package/lib/client/resort/webcams.js +5 -8
- package/lib/client/state/index.js +4 -7
- package/lib/client/stats/index.js +1 -5
- package/lib/client/tag/index.js +1 -3
- package/lib/embed/index.js +0 -2
- package/lib/lifts/index.js +12 -12
- package/lib/lifts/parse.js +5 -5
- package/lib/lifts/parser.js +6 -10
- package/lib/lifts/pipe.js +3 -3
- package/lib/lifts/request.js +1 -3
- package/lib/lifts/rest.js +2 -4
- package/lib/lifts/stats.js +2 -5
- package/lib/loader.js +9 -12
- package/lib/loaders.js +7 -8
- package/lib/opening.js +6 -5
- package/lib/plugins.js +3 -8
- package/lib/resorts/3cime/index.js +1 -1
- package/lib/resorts/3cime/resort.json +1 -1
- package/lib/resorts/49-degrees-north/index.js +1 -1
- package/lib/resorts/abasin/index.js +2 -2
- package/lib/resorts/alpe-lusia-san-pellegrino/index.js +1 -1
- package/lib/resorts/alpe-lusia-san-pellegrino/resort.json +1 -1
- package/lib/resorts/alpine/index.js +1 -1
- package/lib/resorts/alta/index.js +6 -7
- package/lib/resorts/alta-badia/index.js +1 -1
- package/lib/resorts/alta-badia/resort.json +1 -1
- package/lib/resorts/alyeska/index.js +1 -1
- package/lib/resorts/alyeska/resort.json +1 -1
- package/lib/resorts/angel-fire/index.js +1 -1
- package/lib/resorts/arabba/index.js +1 -1
- package/lib/resorts/arabba/resort.json +1 -1
- package/lib/resorts/aspen-highlands/index.js +1 -1
- package/lib/resorts/aspen-mountain/index.js +1 -1
- package/lib/resorts/attitash/index.js +1 -1
- package/lib/resorts/attitash/resort.json +1 -1
- package/lib/resorts/beavercreek/index.js +1 -1
- package/lib/resorts/berkshire-east/index.js +1 -1
- package/lib/resorts/big-sky/index.js +1 -1
- package/lib/resorts/big-white/index.js +1 -1
- package/lib/resorts/big-white/resort.json +1 -1
- package/lib/resorts/blue-mountain-pa/index.js +1 -1
- package/lib/resorts/bluemountain/index.js +1 -1
- package/lib/resorts/bogusbasin/index.js +5 -4
- package/lib/resorts/bolton-valley/index.js +2 -3
- package/lib/resorts/boreal/index.js +1 -1
- package/lib/resorts/breck/index.js +1 -1
- package/lib/resorts/brettonwoods/index.js +7 -5
- package/lib/resorts/brettonwoods/resort.json +1 -1
- package/lib/resorts/brianhead/index.js +1 -1
- package/lib/resorts/bridger-bowl/index.js +4 -3
- package/lib/resorts/brighton/index.js +1 -1
- package/lib/resorts/bromley-mountain/index.js +1 -1
- package/lib/resorts/burke-mountain/index.js +1 -1
- package/lib/resorts/buttermilk/index.js +1 -1
- package/lib/resorts/caberfae-peaks/index.js +1 -1
- package/lib/resorts/camelback/index.js +1 -1
- package/lib/resorts/campo-felice/index.js +1 -1
- package/lib/resorts/campo-felice/resort.json +1 -1
- package/lib/resorts/canada-olympic-park/index.js +1 -1
- package/lib/resorts/cannon/index.js +1 -1
- package/lib/resorts/cannon/resort.json +1 -1
- package/lib/resorts/cataloochee/index.js +1 -1
- package/lib/resorts/catedral/index.js +1 -1
- package/lib/resorts/cervino/index.js +2 -2
- package/lib/resorts/chamonix/index.js +2 -2
- package/lib/resorts/chamonix/resort.json +1 -1
- package/lib/resorts/chinapeak/index.js +1 -1
- package/lib/resorts/civetta/index.js +1 -1
- package/lib/resorts/civetta/resort.json +1 -1
- package/lib/resorts/claviere/index.js +1 -1
- package/lib/resorts/copper/index.js +1 -1
- package/lib/resorts/coronetpeak/index.js +1 -1
- package/lib/resorts/coronetpeak/resort.json +1 -1
- package/lib/resorts/cortina-d-ampezzo/index.js +1 -1
- package/lib/resorts/cortina-d-ampezzo/resort.json +1 -1
- package/lib/resorts/courchevel/index.js +1 -1
- package/lib/resorts/courchevel/resort.json +2 -1
- package/lib/resorts/cranmore-mountain/index.js +1 -1
- package/lib/resorts/cranmore-mountain/resort.json +1 -1
- package/lib/resorts/cransmontana/index.js +2 -2
- package/lib/resorts/crested-butte/index.js +1 -1
- package/lib/resorts/crystal-mountain/index.js +1 -1
- package/lib/resorts/cypress-mountain/index.js +1 -1
- package/lib/resorts/deer-valley/index.js +1 -1
- package/lib/resorts/devils-head/index.js +1 -1
- package/lib/resorts/diamondpeak/index.js +1 -1
- package/lib/resorts/falls-creek/index.js +5 -3
- package/lib/resorts/falls-creek/resort.json +1 -1
- package/lib/resorts/flims-laax-falera/index.js +1 -1
- package/lib/resorts/flims-laax-falera/resort.json +1 -1
- package/lib/resorts/folgaria/index.js +1 -1
- package/lib/resorts/folgaria/resort.json +1 -1
- package/lib/resorts/folgarida-marilleva/index.js +2 -1
- package/lib/resorts/forni/index.js +1 -1
- package/lib/resorts/forni/resort.json +1 -1
- package/lib/resorts/gore-mountain/index.js +1 -1
- package/lib/resorts/grand-targhee/index.js +1 -1
- package/lib/resorts/grouse/index.js +1 -1
- package/lib/resorts/gunstock/index.js +1 -1
- package/lib/resorts/gunstock/resort.json +1 -1
- package/lib/resorts/heavenly/index.js +1 -1
- package/lib/resorts/hochfuegen/index.js +2 -2
- package/lib/resorts/homewood/index.js +1 -1
- package/lib/resorts/hoodoo/index.js +1 -1
- package/lib/resorts/hunter/index.js +1 -1
- package/lib/resorts/ischgl-silvretta-arena/index.js +1 -1
- package/lib/resorts/jackson-hole/index.js +5 -3
- package/lib/resorts/jay-peak/index.js +1 -1
- package/lib/resorts/jiminypeak/index.js +1 -1
- package/lib/resorts/june-mountain/index.js +1 -1
- package/lib/resorts/keystone/index.js +1 -1
- package/lib/resorts/killington/index.js +1 -1
- package/lib/resorts/king-pine/index.js +5 -3
- package/lib/resorts/king-pine/resort.json +1 -1
- package/lib/resorts/kirkwood/index.js +1 -1
- package/lib/resorts/kitzbuehel/index.js +1 -1
- package/lib/resorts/lamolina/index.js +1 -1
- package/lib/resorts/lamolina/resort.json +1 -1
- package/lib/resorts/laplagne/index.js +1 -1
- package/lib/resorts/laplagne/resort.json +2 -1
- package/lib/resorts/larosiere/index.js +1 -1
- package/lib/resorts/lavarone/index.js +1 -1
- package/lib/resorts/lavarone/resort.json +1 -1
- package/lib/resorts/lesarcs/index.js +1 -1
- package/lib/resorts/lesmenuires/index.js +1 -1
- package/lib/resorts/lesmenuires/resort.json +2 -1
- package/lib/resorts/loon/index.js +1 -1
- package/lib/resorts/loon/resort.json +1 -1
- package/lib/resorts/loveland/index.js +2 -2
- package/lib/resorts/mad-river-glen/index.js +2 -2
- package/lib/resorts/madonna-di-campiglio/index.js +2 -1
- package/lib/resorts/mammoth-lakes/index.js +1 -1
- package/lib/resorts/manning-park/index.js +1 -1
- package/lib/resorts/manning-park/resort.json +1 -1
- package/lib/resorts/megeve/index.js +1 -1
- package/lib/resorts/megeve/resort.json +2 -1
- package/lib/resorts/meribel/index.js +1 -1
- package/lib/resorts/meribel/resort.json +2 -1
- package/lib/resorts/monarch/index.js +2 -2
- package/lib/resorts/monte-amiata/index.js +1 -1
- package/lib/resorts/monte-amiata/resort.json +1 -1
- package/lib/resorts/monte-bondone/index.js +1 -1
- package/lib/resorts/montegenevre/index.js +1 -1
- package/lib/resorts/monterosa/index.js +1 -1
- package/lib/resorts/morzine/index.js +1 -1
- package/lib/resorts/morzine/resort.json +6 -2
- package/lib/resorts/mount-sunapee/index.js +1 -1
- package/lib/resorts/mount-sunapee/resort.json +1 -1
- package/lib/resorts/mountsnow/index.js +1 -1
- package/lib/resorts/mt-buller/index.js +1 -1
- package/lib/resorts/mt-hotham/index.js +5 -3
- package/lib/resorts/mt-seymour/index.js +1 -1
- package/lib/resorts/mt-spokane/index.js +1 -1
- package/lib/resorts/mtbachelor/index.js +1 -1
- package/lib/resorts/mtbrighton/index.js +1 -1
- package/lib/resorts/mthigh/index.js +1 -1
- package/lib/resorts/mthood/index.js +1 -1
- package/lib/resorts/mtpeter/index.js +1 -1
- package/lib/resorts/mtpeter/resort.json +1 -1
- package/lib/resorts/mtrose/index.js +1 -1
- package/lib/resorts/niseko/index.js +1 -1
- package/lib/resorts/niseko/resort.json +1 -1
- package/lib/resorts/northstar/index.js +1 -1
- package/lib/resorts/okemo/index.js +1 -1
- package/lib/resorts/ovindoli/index.js +1 -1
- package/lib/resorts/ovindoli/resort.json +1 -1
- package/lib/resorts/owlshead/index.js +1 -1
- package/lib/resorts/paganella/index.js +1 -1
- package/lib/resorts/paganella/resort.json +1 -1
- package/lib/resorts/palisades/index.js +1 -1
- package/lib/resorts/parkcity/index.js +1 -1
- package/lib/resorts/pats-peak/index.js +4 -2
- package/lib/resorts/pats-peak/resort.json +1 -1
- package/lib/resorts/peio/index.js +2 -2
- package/lib/resorts/perisher/index.js +1 -1
- package/lib/resorts/perisher/resort.json +1 -1
- package/lib/resorts/piancavallo/index.js +1 -1
- package/lib/resorts/piancavallo/resort.json +1 -1
- package/lib/resorts/pico/index.js +1 -1
- package/lib/resorts/pinzolo/index.js +2 -1
- package/lib/resorts/plan-de-corones/index.js +1 -1
- package/lib/resorts/plan-de-corones/resort.json +1 -1
- package/lib/resorts/pleasant-mountain/index.js +1 -1
- package/lib/resorts/pleasant-mountain/resort.json +1 -1
- package/lib/resorts/pontedilegno-tonale/index.js +1 -1
- package/lib/resorts/ragged-mountain/index.js +1 -1
- package/lib/resorts/ragged-mountain/resort.json +1 -1
- package/lib/resorts/ravascletto-zoncolan/index.js +1 -1
- package/lib/resorts/ravascletto-zoncolan/resort.json +1 -1
- package/lib/resorts/red-lodge-mountain/index.js +1 -1
- package/lib/resorts/red-mountain/index.js +2 -3
- package/lib/resorts/rio-pusteria-bressanone/index.js +1 -1
- package/lib/resorts/rio-pusteria-bressanone/resort.json +1 -1
- package/lib/resorts/roccaraso/index.js +1 -1
- package/lib/resorts/roccaraso/resort.json +1 -1
- package/lib/resorts/saddleback/index.js +1 -1
- package/lib/resorts/saddleback/resort.json +1 -1
- package/lib/resorts/san-martino-di-castrozza-passo-rolle/index.js +1 -1
- package/lib/resorts/san-martino-di-castrozza-passo-rolle/resort.json +1 -1
- package/lib/resorts/sansicario/index.js +1 -1
- package/lib/resorts/sappada/index.js +1 -1
- package/lib/resorts/sappada/resort.json +1 -1
- package/lib/resorts/sasquatch-mountain/index.js +1 -1
- package/lib/resorts/sauris/index.js +1 -1
- package/lib/resorts/sauris/resort.json +1 -1
- package/lib/resorts/sauze/index.js +1 -1
- package/lib/resorts/schweitzer/index.js +1 -1
- package/lib/resorts/sella/index.js +1 -1
- package/lib/resorts/sella/resort.json +1 -1
- package/lib/resorts/serfaus-fiss-ladis/index.js +1 -1
- package/lib/resorts/sestriere/index.js +1 -1
- package/lib/resorts/sestriere/resort.json +1 -1
- package/lib/resorts/shawnee-mountain/index.js +4 -2
- package/lib/resorts/sierra/index.js +1 -1
- package/lib/resorts/silver-star/index.js +2 -2
- package/lib/resorts/skiwelt/index.js +1 -1
- package/lib/resorts/smuggs/index.js +1 -1
- package/lib/resorts/snow-valley/index.js +2 -2
- package/lib/resorts/snowbasin/index.js +1 -1
- package/lib/resorts/snowbird/index.js +2 -3
- package/lib/resorts/snowmass/index.js +1 -1
- package/lib/resorts/snowshoe/index.js +1 -1
- package/lib/resorts/soelden/index.js +1 -1
- package/lib/resorts/solitude/index.js +1 -1
- package/lib/resorts/st-anton-am-arlberg/index.js +1 -1
- package/lib/resorts/steamboat/index.js +1 -1
- package/lib/resorts/stevens/index.js +1 -1
- package/lib/resorts/stowe/index.js +1 -1
- package/lib/resorts/stratton/index.js +1 -1
- package/lib/resorts/sugarbowl/index.js +1 -1
- package/lib/resorts/sugarbush/index.js +1 -1
- package/lib/resorts/sugarloaf/index.js +1 -1
- package/lib/resorts/sugarloaf/resort.json +1 -1
- package/lib/resorts/sun-peaks/index.js +1 -1
- package/lib/resorts/sun-peaks/resort.json +1 -1
- package/lib/resorts/sunday-river/index.js +1 -1
- package/lib/resorts/sunday-river/resort.json +1 -1
- package/lib/resorts/sunshine-village/index.js +6 -3
- package/lib/resorts/sunvalley/index.js +1 -1
- package/lib/resorts/tahoe-donner/index.js +1 -1
- package/lib/resorts/taos/index.js +1 -1
- package/lib/resorts/tarvisio/index.js +1 -1
- package/lib/resorts/tarvisio/resort.json +1 -1
- package/lib/resorts/telluride/index.js +1 -1
- package/lib/resorts/thredbo/index.js +1 -1
- package/lib/resorts/tignes/index.js +1 -1
- package/lib/resorts/tignes/resort.json +1 -1
- package/lib/resorts/timberline-lodge/index.js +1 -1
- package/lib/resorts/tremblant/index.js +1 -1
- package/lib/resorts/vail/index.js +1 -1
- package/lib/resorts/val-di-fassa/index.js +1 -1
- package/lib/resorts/val-di-fassa/resort.json +1 -1
- package/lib/resorts/val-di-fiemme/index.js +1 -1
- package/lib/resorts/val-di-fiemme/resort.json +1 -1
- package/lib/resorts/val-gardena/index.js +1 -1
- package/lib/resorts/val-gardena/resort.json +1 -1
- package/lib/resorts/valdisere/index.js +1 -1
- package/lib/resorts/valdisere/resort.json +1 -1
- package/lib/resorts/verbier/index.js +1 -1
- package/lib/resorts/waterville/index.js +1 -1
- package/lib/resorts/waterville/resort.json +1 -1
- package/lib/resorts/whistler-blackcomb/index.js +2 -2
- package/lib/resorts/whistler-blackcomb/resort.json +1 -1
- package/lib/resorts/whiteface/index.js +1 -1
- package/lib/resorts/whitefish/index.js +1 -1
- package/lib/resorts/wildcat/index.js +1 -1
- package/lib/resorts/wildcat/resort.json +1 -1
- package/lib/resorts/windham/index.js +1 -1
- package/lib/resorts/winter-park/index.js +1 -1
- package/lib/resorts/winterplace/index.js +1 -1
- package/lib/routes/cache.js +4 -4
- package/lib/routes/canonical.js +1 -3
- package/lib/routes/data.js +10 -12
- package/lib/routes/database.js +6 -7
- package/lib/routes/headers.js +2 -2
- package/lib/routes/index.js +9 -11
- package/lib/routes/plan.js +2 -4
- package/lib/routes/service-worker.js +6 -7
- package/lib/routes/sorter.js +2 -4
- package/lib/routes/tags.js +2 -4
- package/lib/select.js +3 -5
- package/lib/tools/aspen.js +4 -4
- package/lib/tools/boyne.js +4 -4
- package/lib/tools/campiglio-dolomiti.js +1 -1
- package/lib/tools/coerce.js +4 -4
- package/lib/tools/dolomitisuperski.js +1 -1
- package/lib/tools/domutil.js +11 -18
- package/lib/tools/infosnow.js +6 -6
- package/lib/tools/intrawest.js +3 -3
- package/lib/tools/limiter.js +2 -4
- package/lib/tools/lumiplan.js +2 -2
- package/lib/tools/millis.js +4 -11
- package/lib/tools/powdr.js +4 -4
- package/lib/tools/prism.js +5 -5
- package/lib/tools/skiplan.js +1 -1
- package/lib/tools/turismofvg.js +2 -2
- package/lib/tools/vail.js +8 -10
- package/lib/tools/vialattea.js +1 -1
- package/lib/weather/icons.js +3 -8
- package/lib/weather/index.js +5 -6
- package/lib/weather/noaa.js +5 -3
- package/lib/weather/openweather.js +6 -7
- package/lib/webcams.js +6 -6
- package/package.json +4 -3
- package/public/scripts/liftie-embed.js +41 -0
- package/public/scripts/liftie-embed.js.map +7 -0
- package/public/scripts/liftie.js +1561 -0
- package/public/scripts/liftie.js.map +7 -0
- package/public/stylesheets/style.css +864 -0
- package/public/stylesheets/style.mix.css +0 -1
package/lib/lifts/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import Debug from 'debug';
|
|
2
|
+
import getParseFn from './parse.js';
|
|
3
|
+
import pipe from './pipe.js';
|
|
4
|
+
import rest from './rest.js';
|
|
5
|
+
import stats from './stats.js';
|
|
2
6
|
|
|
3
|
-
const
|
|
4
|
-
const rest = require('./rest');
|
|
5
|
-
const stats = require('./stats');
|
|
6
|
-
const getParseFn = require('./parse');
|
|
7
|
+
const debug = Debug('liftie:lifts');
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
const longInterval = 30 *
|
|
9
|
+
const shortInterval = 60 * 1000; // once a minute - fetch status if there were requests
|
|
10
|
+
const longInterval = 30 * shortInterval; // once every 30 minutes - fetch even if there wasn't any requests
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
active: interval,
|
|
12
|
+
fetch.interval = {
|
|
13
|
+
active: shortInterval,
|
|
14
14
|
inactive: longInterval
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -39,12 +39,12 @@ function getRequestFnAndUrl(resort) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function fetch(resort, fn) {
|
|
42
|
+
export default async function fetch(resort, fn) {
|
|
43
43
|
if (!resort._rfau) {
|
|
44
44
|
resort._rfau = getRequestFnAndUrl(resort);
|
|
45
45
|
}
|
|
46
46
|
if (!resort._parseFn) {
|
|
47
|
-
resort._parseFn = getParseFn(resort.id);
|
|
47
|
+
resort._parseFn = await getParseFn(resort.id);
|
|
48
48
|
}
|
|
49
49
|
debug('Fetch lift status for %s', resort.id);
|
|
50
50
|
const rfau = resort._rfau;
|
package/lib/lifts/parse.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import Debug from 'debug';
|
|
2
|
+
import * as domutil from '../tools/domutil.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const debug = Debug('liftie:lifts');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* catch exceptions thrown by parse
|
|
8
8
|
*/
|
|
9
|
-
function getParseFn(resortId) {
|
|
10
|
-
const descriptor =
|
|
9
|
+
export default async function getParseFn(resortId) {
|
|
10
|
+
const { default: descriptor } = await import(`../resorts/${resortId}/index.js`);
|
|
11
11
|
const parse = typeof descriptor === 'function' ? descriptor : collectParse;
|
|
12
12
|
|
|
13
13
|
wrappedParse.isAsync = parse.length > 1;
|
package/lib/lifts/parser.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { nextTick } from 'node:process';
|
|
2
|
+
import { ElementType } from 'domelementtype';
|
|
3
|
+
import { DomHandler, Text } from 'domhandler';
|
|
4
|
+
import { WritableStream } from 'htmlparser2/WritableStream';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
parserStream.html = parseHtml;
|
|
9
|
-
|
|
10
|
-
function parseHtml(html, parse, fn) {
|
|
6
|
+
export function parseHtml(html, parse, fn) {
|
|
11
7
|
const stream = parserStream(parse, fn);
|
|
12
8
|
stream.write(html);
|
|
13
9
|
stream.end();
|
|
@@ -43,7 +39,7 @@ class IgnoreEmptiesDomHandler extends DomHandler {
|
|
|
43
39
|
* @param fn(err, data) - callback that receives identified data pieces (or error),
|
|
44
40
|
* first error should stop parsing
|
|
45
41
|
*/
|
|
46
|
-
function parserStream(parse, fn) {
|
|
42
|
+
export default function parserStream(parse, fn) {
|
|
47
43
|
function handle(err, dom) {
|
|
48
44
|
return err ? fn(err) : nextTick(fn, null, parse(dom));
|
|
49
45
|
}
|
package/lib/lifts/pipe.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { parseHtml } from './parser.js';
|
|
2
|
+
import request from './request.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default (url, parse, fn) => {
|
|
5
5
|
request(url)
|
|
6
6
|
.then(async res => {
|
|
7
7
|
if (res.status < 200 || res.status >= 300) {
|
package/lib/lifts/request.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function request({ host, pathname, query }) {
|
|
3
|
+
export default function request({ host, pathname, query }) {
|
|
6
4
|
const fullUrl = new URL(pathname, host);
|
|
7
5
|
if (query) {
|
|
8
6
|
fullUrl.search = new URLSearchParams(query).toString();
|
package/lib/lifts/rest.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { parseHtml } from './parser.js';
|
|
2
2
|
|
|
3
3
|
const userAgent = 'liftie/1.0.0 (https://liftie.info)';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function rest(url, parse, fn) {
|
|
5
|
+
export default function rest(url, parse, fn) {
|
|
8
6
|
const fullUrl = new URL(url.pathname, url.host);
|
|
9
7
|
if (url.query) {
|
|
10
8
|
fullUrl.search = new URLSearchParams(url.query).toString();
|
package/lib/lifts/stats.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
module.exports = stats;
|
|
2
|
-
module.exports.summary = summary;
|
|
3
|
-
|
|
4
1
|
const states = ['open', 'hold', 'scheduled', 'closed'];
|
|
5
2
|
|
|
6
3
|
function empty(val) {
|
|
@@ -22,7 +19,7 @@ function percentage(status) {
|
|
|
22
19
|
}, empty());
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
function stats(status) {
|
|
22
|
+
export default function stats(status) {
|
|
26
23
|
const r = Object.keys(status).reduce((memo, lift) => {
|
|
27
24
|
memo[status[lift]] += 1;
|
|
28
25
|
return memo;
|
|
@@ -31,7 +28,7 @@ function stats(status) {
|
|
|
31
28
|
return r;
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
function summary(arr) {
|
|
31
|
+
export function summary(arr) {
|
|
35
32
|
function add(sum, s) {
|
|
36
33
|
if (!s) {
|
|
37
34
|
return sum;
|
package/lib/loader.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default async function load() {
|
|
4
|
+
const names = await fs.readdir(`${import.meta.dirname}/resorts`);
|
|
5
|
+
const entries = names.map(entry);
|
|
6
|
+
return Object.fromEntries(await Promise.all(entries));
|
|
7
|
+
}
|
|
4
8
|
|
|
5
|
-
async function
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
id,
|
|
9
|
-
{
|
|
10
|
-
id,
|
|
11
|
-
...require(`./resorts/${id}/resort.json`)
|
|
12
|
-
}
|
|
13
|
-
]);
|
|
14
|
-
return Object.fromEntries(entries);
|
|
9
|
+
async function entry(id) {
|
|
10
|
+
const { default: resort } = await import(`./resorts/${id}/resort.json`, { with: { type: 'json' } });
|
|
11
|
+
return [id, { id, ...resort }];
|
|
15
12
|
}
|
package/lib/loaders.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { callbackify, promisify } from 'node:util';
|
|
2
|
+
import Debug from 'debug';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
register,
|
|
6
|
-
load: callbackify(load)
|
|
7
|
-
};
|
|
4
|
+
const debug = Debug('liftie:loaders');
|
|
8
5
|
|
|
9
6
|
const loaders = [];
|
|
10
7
|
|
|
11
|
-
function register(loader) {
|
|
8
|
+
export function register(loader) {
|
|
12
9
|
// promisify functions that take callback arg
|
|
13
10
|
loaders.push(loader.length > 0 ? promisify(loader) : loader);
|
|
14
11
|
}
|
|
@@ -18,7 +15,9 @@ function appendResorts(data, resorts) {
|
|
|
18
15
|
return data;
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
export const load = callbackify(asyncLoad);
|
|
19
|
+
|
|
20
|
+
async function asyncLoad() {
|
|
22
21
|
debug('Loading resorts...');
|
|
23
22
|
const results = await Promise.all(loaders.map(fn => fn()));
|
|
24
23
|
const data = results.reduce(appendResorts, Object.create(null));
|
package/lib/opening.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import Debug from 'debug';
|
|
2
|
+
import { hour } from './tools/millis.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const debug = Debug('liftie:opening');
|
|
5
|
+
|
|
6
|
+
fetch.interval = {
|
|
6
7
|
active: hour,
|
|
7
8
|
inactive: 12 * hour
|
|
8
9
|
};
|
|
@@ -22,7 +23,7 @@ function ifNotOpenYet(opening) {
|
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
function fetch(resort, fn) {
|
|
26
|
+
export default function fetch(resort, fn) {
|
|
26
27
|
debug('Calculate opening for %s', resort.id);
|
|
27
28
|
process.nextTick(fn.bind(null, null, ifNotOpenYet(resort.opening)));
|
|
28
29
|
}
|
package/lib/plugins.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
const plugins = Object.create(null);
|
|
2
2
|
|
|
3
|
-
function register(name, module) {
|
|
3
|
+
export function register(name, module) {
|
|
4
4
|
plugins[name] = module;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
function forEach(fn) {
|
|
8
|
-
Object.
|
|
9
|
-
fn(name, plugins[name]);
|
|
10
|
-
});
|
|
7
|
+
export function forEach(fn) {
|
|
8
|
+
Object.entries(plugins).forEach(([name, plugin]) => fn(name, plugin));
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
exports.forEach = forEach;
|
|
14
|
-
exports.register = register;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/dolomitisuperski.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/dolomitisuperski.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/intrawest.js';
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import vm from 'node:vm';
|
|
2
|
+
import Debug from 'debug';
|
|
3
|
+
import select from '../../select.js';
|
|
4
|
+
import { allText } from '../../tools/domutil.js';
|
|
3
5
|
|
|
4
|
-
const
|
|
5
|
-
const { allText } = require('../../tools/domutil');
|
|
6
|
-
|
|
7
|
-
module.exports = parse;
|
|
6
|
+
const debug = Debug('liftie:resort:alta');
|
|
8
7
|
|
|
9
8
|
function extractLiftData(script) {
|
|
10
9
|
const data = vm.runInNewContext(script, { window: Object.create(null) });
|
|
11
10
|
return data?.liftStatus?.lifts ?? {};
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
function parse(dom) {
|
|
13
|
+
export default function parse(dom) {
|
|
15
14
|
const dataScript = select(dom, 'script')
|
|
16
15
|
.map(script => allText(script).trim())
|
|
17
16
|
.find(script => script.includes('window.Alta = '));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/dolomitisuperski.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/aspen.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/aspen.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/vail.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/vail.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/boyne.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/intrawest.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import Debug from 'debug';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const coerce = require('../../tools/coerce');
|
|
3
|
+
const debug = Debug('liftie:resort:bogusbasin');
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
import select from '../../select.js';
|
|
6
|
+
import coerce from '../../tools/coerce.js';
|
|
7
|
+
export default parse;
|
|
7
8
|
|
|
8
9
|
function parse(dom) {
|
|
9
10
|
const dataScript = select(dom, 'x-filterable-lift-trail-status').map(script => script.attribs['data-data'].trim());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/powdr.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/vail.js';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import Debug from 'debug';
|
|
2
|
+
import select from '../../select.js';
|
|
3
|
+
import coerce from '../../tools/coerce.js';
|
|
4
|
+
import * as domutil from '../../tools/domutil.js';
|
|
5
|
+
|
|
6
|
+
const debug = Debug('liftie:resort:brettonwoods');
|
|
5
7
|
|
|
6
8
|
function parse(dom) {
|
|
7
9
|
const liftStatus = {};
|
|
@@ -30,4 +32,4 @@ function parse(dom) {
|
|
|
30
32
|
return liftStatus;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
export default parse;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import Debug from 'debug';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const debug = Debug('liftie:resort:bridger-bowl');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import coerce from '../../tools/coerce.js';
|
|
6
|
+
export default parse;
|
|
6
7
|
|
|
7
8
|
function parse({ data } = {}) {
|
|
8
9
|
const ls = data?.lift_status ?? [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/boyne.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { default } from '../../tools/aspen.js';
|