Files
start-os/sdk/base/lib/exver/exver.ts
Aiden McClelland 3320391fcc feat: support preferred external ports besides 443 (#3117)
* docs: update preferred external port design in TODO

* docs: add user-controlled public/private and port forward mapping to design

* docs: overhaul interfaces page design with view/manage split and per-address controls

* docs: move address enable/disable to overflow menu, add SSL indicator, defer UI placement decisions

* chore: remove tor from startos core

Tor is being moved from a built-in OS feature to a service. This removes
the Arti-based Tor client, onion address management, hidden service
creation, and all related code from the core backend, frontend, and SDK.

- Delete core/src/net/tor/ module (~2060 lines)
- Remove OnionAddress, TorSecretKey, TorController from all consumers
- Remove HostnameInfo::Onion and HostAddress::Onion variants
- Remove onion CRUD RPC endpoints and tor subcommand
- Remove tor key handling from account and backup/restore
- Remove ~12 tor-related Cargo dependencies (arti-client, torut, etc.)
- Remove tor UI components, API methods, mock data, and routes
- Remove OnionHostname and tor patterns/regexes from SDK
- Add v0_4_0_alpha_20 database migration to strip onion data
- Bump version to 0.4.0-alpha.20

* chore: flatten HostnameInfo from enum to struct

HostnameInfo only had one variant (Ip) after removing Tor. Flatten it
into a plain struct with fields gateway, public, hostname. Remove all
kind === 'ip' type guards and narrowing across SDK, frontend, and
container runtime. Update DB migration to strip the kind field.

* chore: format RPCSpec.md markdown table

* docs: update TODO.md with DerivedAddressInfo design, remove completed tor task

* feat: implement preferred port allocation and per-address enable/disable

- Add AvailablePorts::try_alloc() with SSL tracking (BTreeMap<u16, bool>)
- Add DerivedAddressInfo on BindInfo with private_disabled/public_enabled/possible sets
- Add Bindings wrapper with Map impl for patchdb indexed access
- Flatten HostAddress from single-variant enum to struct
- Replace set-gateway-enabled RPC with set-address-enabled
- Remove hostname_info from Host; computed addresses now in BindInfo.addresses.possible
- Compute possible addresses inline in NetServiceData::update()
- Update DB migration, SDK types, frontend, and container-runtime

* feat: replace InterfaceFilter with ForwardRequirements, add WildcardListener, complete alpha.20 bump

- Replace DynInterfaceFilter with ForwardRequirements for per-IP forward
  precision with source-subnet iptables filtering for private forwards
- Add WildcardListener (binds [::]:port) to replace the per-gateway
  NetworkInterfaceListener/SelfContainedNetworkInterfaceListener/
  UpgradableListener infrastructure
- Update forward-port script with src_subnet and excluded_src env vars
- Remove unused filter types and listener infrastructure from gateway.rs
- Add availablePorts migration (IdPool -> BTreeMap<u16, bool>) to alpha.20
- Complete version bump to 0.4.0-alpha.20 in SDK and web

* outbound gateway support (#3120)

* Multiple (#3111)

* fix alerts i18n, fix status display, better, remove usb media, hide shutdown for install complete

* trigger chnage detection for localize pipe and round out implementing localize pipe for consistency even though not needed

* Fix PackageInfoShort to handle LocaleString on releaseNotes (#3112)

* Fix PackageInfoShort to handle LocaleString on releaseNotes

* fix: filter by target_version in get_matching_models and pass otherVersions from install

* chore: add exver documentation for ai agents

* frontend plus some be types

---------

Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com>

* feat: replace SourceFilter with IpNet, add policy routing, remove MASQUERADE

* build ts types and fix i18n

* fix license display in marketplace

* wip refactor

* chore: update ts bindings for preferred port design

* feat: refactor NetService to watch DB and reconcile network state

- NetService sync task now uses PatchDB DbWatch instead of being called
  directly after DB mutations
- Read gateways from DB instead of network interface context when
  updating host addresses
- gateway sync updates all host addresses in the DB
- Add Watch<u64> channel for callers to wait on sync completion
- Fix ts-rs codegen bug with #[ts(skip)] on flattened Plugin field
- Update SDK getServiceInterface.ts for new HostnameInfo shape
- Remove unnecessary HTTPS redirect in static_server.rs
- Fix tunnel/api.rs to filter for WAN IPv4 address

* re-arrange (#3123)

* new service interfacee page

* feat: add mdns hostname metadata variant and fix vhost routing

- Add HostnameMetadata::Mdns variant to distinguish mDNS from private domains
- Mark mDNS addresses as private (public: false) since mDNS is local-only
- Fall back to null SNI entry when hostname not found in vhost mapping
- Simplify public detection in ProxyTarget filter
- Pass hostname to update_addresses for mDNS domain name generation

* looking good

* feat: add port_forwards field to Host for tracking gateway forwarding rules

* update bindings for API types, add ARCHITECTURE (#3124)

* update binding for API types, add ARCHITECTURE

* translations

* fix: add CONNMARK restore-mark to mangle OUTPUT chain

The CONNMARK --restore-mark rule was only in PREROUTING, which handles
forwarded packets. Locally-bound listeners (e.g. vhost) generate replies
through the OUTPUT chain, where the fwmark was never restored. This
caused response packets to route via the default table instead of back
through the originating interface.

* chore: reserialize db on equal version, update bindings and docs

- Run de/ser roundtrip in pre_init even when db version matches, ensuring
  all #[serde(default)] fields are populated before any typed access
- Add patchdb.md documentation for TypedDbWatch patterns
- Update TS bindings for CheckPortParams, CheckPortRes, ifconfigUrl
- Update CLAUDE.md docs with patchdb and component-level references

* fix: include public gateways for IP-based addresses in vhost targets

The server hostname vhost construction only collected private IPs,
always setting public to empty. Public IP addresses (Ipv4/Ipv6 metadata
with public=true) were never added to the vhost target's public gateway
set, causing the vhost filter to reject public traffic for IP-based
addresses.

* fix: add TLS handshake timeout and fix accept loop deadlock

Two issues in TlsListener::poll_accept:

1. No timeout on TLS handshakes: LazyConfigAcceptor waits indefinitely
   for ClientHello. Attackers that complete TCP handshake but never send
   TLS data create zombie futures in `in_progress` that never complete.
   Fix: wrap the entire handshake in tokio::time::timeout(15s).

2. Missing waker on new-connection pending path: when a TCP connection
   is accepted and the TLS handshake is pending, poll_accept returned
   Pending without calling wake_by_ref(). Since the TcpListener returned
   Ready (not Pending), no waker was registered for it. With edge-
   triggered epoll and no other wakeup source, the task sleeps forever
   and remaining connections in the kernel accept queue are never
   drained. Fix: add cx.waker().wake_by_ref() so the task immediately
   re-polls and continues draining the accept queue.

* fix: switch BackgroundJobRunner from Vec to FuturesUnordered

BackgroundJobRunner stored active jobs in a Vec<BoxFuture> and polled
ALL of them on every wakeup — O(n) per poll. Since this runs in the
same tokio::select! as the WebServer accept loop, polling overhead from
active connections directly delayed acceptance of new connections.

FuturesUnordered only polls woken futures — O(woken) instead of O(n).

* chore: update bindings and use typed params for outbound gateway API

* feat: per-service and default outbound gateway routing

Add set-outbound-gateway RPC for packages and set-default-outbound RPC
for the server, with policy routing enforcement via ip rules. Fix
connmark restore to skip packets with existing fwmarks, add bridge
subnet routes to per-interface tables, and fix squashfs path in
update-image-local.sh.

* refactor: manifest wraps PackageMetadata, move dependency_metadata to PackageVersionInfo

Manifest now embeds PackageMetadata via #[serde(flatten)] instead of
duplicating ~14 fields. icon and dependency_metadata moved from
PackageMetadata to PackageVersionInfo since they are registry-enrichment
data loaded from the S9PK archive. merge_with now returns errors on
metadata/icon/dependency_metadata mismatches instead of silently ignoring
them.

* fix: replace .status() with .invoke() for iptables/ip commands

Using .status() leaks stderr directly to system logs, causing noisy
iptables error messages. Switch all networking CLI invocations to use
.invoke() which captures stderr properly. For check-then-act patterns
(iptables -C), use .invoke().await.is_err() instead of
.status().await.map_or(false, |s| s.success()).

* feat: add check-dns gateway endpoint and fix per-interface routing tables

Add a `check-dns` RPC endpoint that verifies whether a gateway's DNS
is properly configured for private domain resolution. Uses a three-tier
check: direct match (DNS == server IP), TXT challenge probe (DNS on
LAN), or failure (DNS off-subnet).

Fix per-interface routing tables to clone all non-default routes from
the main table instead of only the interface's own subnets. This
preserves LAN reachability when the priority-75 catch-all overrides
default routing. Filter out status-only flags (linkdown, dead) that
are invalid for `ip route add`.

* refactor: rename manifest metadata fields and improve error display

Rename wrapperRepo→packageRepo, marketingSite→marketingUrl,
docsUrl→docsUrls (array), remove supportSite. Add display_src/display_dbg
helpers to Error. Fix DepInfo description type to LocaleString. Update
web UI, SDK bindings, tests, and fixtures to match. Clean up cli_attach
error handling and remove dead commented code.

* chore: bump sdk version to 0.4.0-beta.49

* chore: add createTask decoupling TODO

* chore: add TODO to clear service error state on install/update

* round out dns check, dns server check, port forward check, and gateway port forwards

* chore: add TODOs for URL plugins, NAT hairpinning, and start-tunnel OTA updates

* version instead of os query param

* interface row clickable again, bu now with a chevron!

* feat: implement URL plugins with table/row actions and prefill support

- Add URL plugin effects (register, export_url, clear_urls) in core
- Add PluginHostnameInfo, HostnameMetadata::Plugin, and plugin registration types
- Implement plugin URL table in web UI with tableAction button and rowAction overflow menus
- Thread urlPluginMetadata (packageId, hostId, interfaceId, internalPort) as prefill to actions
- Add prefill support to PackageActionData so metadata passes through form dialogs
- Add i18n translations for plugin error messages
- Clean up plugin URLs on package uninstall

* feat: split row_actions into remove_action and overflow_actions for URL plugins

* touch up URL plugins table

* show table even when no addresses

* feat: NAT hairpinning, DNS static servers, clear service error on install

- Add POSTROUTING MASQUERADE rules for container and host hairpin NAT
- Allow bridge subnet containers to reach private forwards via LAN IPs
- Pass bridge_subnet env var from forward.rs to forward-port script
- Use DB-configured static DNS servers in resolver with DB watcher
- Fall back to resolv.conf servers when no static servers configured
- Clear service error state when install/update completes successfully
- Remove completed TODO items

* feat: builder-style InputSpec API, prefill plumbing, and port forward fix

- Add addKey() and add() builder methods to InputSpec with InputSpecTools
- Move OuterType to last generic param on Value, List, and all dynamic methods
- Plumb prefill through getActionInput end-to-end (core → container-runtime → SDK)
- Filter port_forwards to enabled addresses only
- Bump SDK to 0.4.0-beta.50

* fix: propagate host locale into LXC containers and write locale.conf

* chore: remove completed URL plugins TODO

* feat: OTA updates for start-tunnel via apt repository (untested)

- Add apt repo publish script (build/apt/publish-deb.sh) for S3-hosted repo
- Add apt source config and GPG key placeholder (apt/)
- Add tunnel.update.check and tunnel.update.apply RPC endpoints
- Wire up update API in tunnel frontend (api service + mock)
- Uses systemd-run --scope to survive service restart during update

* fix: publish script dpkg-name, s3cfg fallback, and --reinstall for apply

* chore: replace OTA updates TODO with UI TODO for MattDHill

* feat: add getOutboundGateway effect and simplify VersionGraph init/uninit

Add getOutboundGateway effect across core, container-runtime, and SDK
to let services query their effective outbound gateway with callback
support. Remove preInstall/uninstall hooks from VersionGraph as they
are no longer needed.

* frontend start-tunnel updates

* chore: remove completed TODO

* feat: tor hidden service key migration

* chore: migrate from ts-matches to zod across all TypeScript packages

* feat(core): allow setting server hostname

* send prefill for tasks and hide operations to hidden fields

* fix(core): preserve plugin URLs across binding updates

BindInfo::update was replacing addresses with a new DerivedAddressInfo
that cleared the available set, wiping plugin-exported URLs whenever
bind() was called. Also simplify update_addresses plugin preservation
to use retain in place rather than collecting into a separate set.

* minor cleanup from patch-db audit

* clean up prefill flow

* frontend support for setting and changing hostname

* feat(core): refactor hostname to ServerHostnameInfo with name/hostname pair

- Rename Hostname to ServerHostnameInfo, add name + hostname fields
- Add set_hostname_rpc for changing hostname at runtime
- Migrate alpha_20: generate serverInfo.name from hostname, delete ui.name
- Extract gateway.rs helpers to fix rustfmt nesting depth issue
- Add i18n key for hostname validation error
- Update SDK bindings

* add comments to everything potentially consumer facing (#3127)

* add comments to everything potentially consumer facing

* rework smtp

---------

Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com>

* implement server name

* setup changes

* clean up copy around addresses table

* feat: add zod-deep-partial, partialValidator on InputSpec, and z.deepPartial re-export

* fix: header color in zoom (#3128)

* fix: merge version ranges when adding existing package signer (#3125)

* fix: merge version ranges when adding existing package signer

   Previously, add_package_signer unconditionally inserted the new
   version range, overwriting any existing authorization for that signer.
   Now it OR-merges the new range with the existing one, so running
   signer add multiple times accumulates permissions rather than
   replacing them.

* add --merge flag to registry package signer add

  Default behavior remains overwrite. When --merge is passed, the new
  version range is OR-merged with the existing one, allowing admins to
  accumulate permissions incrementally.

* add missing attribute to TS type

* make merge optional

* upsert instead of insert

* VersionRange::None on upsert

* fix: header color in zoom

---------

Co-authored-by: Dominion5254 <musashidisciple@proton.me>

* update snake and add about this server to system general

* chore: bump sdk to beta.53, wrap z.deepPartial with passthrough

* reset instead of reset defaults

* action failure show dialog

* chore: bump sdk to beta.54, add device-info RPC, improve SDK abort handling and InputSpec filtering

- Bump SDK version to 0.4.0-beta.54
- Add `server.device-info` RPC endpoint and `s9pk select` CLI command
- Extract `HardwareRequirements::is_compatible()` method, reuse in registry filtering
- Add `AbortedError` class with `muteUnhandled` flag, replace generic abort errors
- Handle unhandled promise rejections in container-runtime with mute support
- Improve `InputSpec.filter()` with `keepByDefault` param and boolean filter values
- Accept readonly tuples in `CommandType` and `splitCommand`
- Remove `sync_host` calls from host API handlers (binding/address changes)
- Filter mDNS hostnames by secure gateway availability
- Derive mDNS enabled state from LAN IPs in web UI
- Add "Open UI" action to address table, disable mDNS toggle
- Hide debug details in service error component
- Update rpc-toolkit docs for no-params handlers

* fix: add --no-nvram to efi grub-install to preserve built-in boot order

* update snake

* diable actions when in error state

* chore: split out nvidia variant

* misc bugfixes

* create manage-release script (untested)

* fix: preserve z namespace types for sdk consumers

* sdk version bump

* new checkPort types

* multiple bugs and better port forward ux

* fix link

* chore: todos and formatting

* fix build

---------

Co-authored-by: Matt Hill <MattDHill@users.noreply.github.com>
Co-authored-by: Matt Hill <mattnine@protonmail.com>
Co-authored-by: Alex Inkin <alexander@inkin.ru>
Co-authored-by: Dominion5254 <musashidisciple@proton.me>
2026-03-04 04:37:31 -07:00

2903 lines
60 KiB
TypeScript

/* eslint-disable */
const peggyParser: {parse: any, SyntaxError: any, DefaultTracer?: any} = // Generated by Peggy 3.0.2.
//
// https://peggyjs.org/
// @ts-ignore
(function() {
// @ts-ignore
"use strict";
// @ts-ignore
function peg$subclass(child, parent) {
// @ts-ignore
function C() { this.constructor = child; }
// @ts-ignore
C.prototype = parent.prototype;
// @ts-ignore
child.prototype = new C();
}
// @ts-ignore
function peg$SyntaxError(message, expected, found, location) {
// @ts-ignore
var self = Error.call(this, message);
// istanbul ignore next Check is a necessary evil to support older environments
// @ts-ignore
if (Object.setPrototypeOf) {
// @ts-ignore
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
}
// @ts-ignore
self.expected = expected;
// @ts-ignore
self.found = found;
// @ts-ignore
self.location = location;
// @ts-ignore
self.name = "SyntaxError";
// @ts-ignore
return self;
}
// @ts-ignore
peg$subclass(peg$SyntaxError, Error);
// @ts-ignore
function peg$padEnd(str, targetLength, padString) {
// @ts-ignore
padString = padString || " ";
// @ts-ignore
if (str.length > targetLength) { return str; }
// @ts-ignore
targetLength -= str.length;
// @ts-ignore
padString += padString.repeat(targetLength);
// @ts-ignore
return str + padString.slice(0, targetLength);
}
// @ts-ignore
peg$SyntaxError.prototype.format = function(sources) {
// @ts-ignore
var str = "Error: " + this.message;
// @ts-ignore
if (this.location) {
// @ts-ignore
var src = null;
// @ts-ignore
var k;
// @ts-ignore
for (k = 0; k < sources.length; k++) {
// @ts-ignore
if (sources[k].source === this.location.source) {
// @ts-ignore
src = sources[k].text.split(/\r\n|\n|\r/g);
// @ts-ignore
break;
}
}
// @ts-ignore
var s = this.location.start;
// @ts-ignore
var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
// @ts-ignore
? this.location.source.offset(s)
// @ts-ignore
: s;
// @ts-ignore
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
// @ts-ignore
if (src) {
// @ts-ignore
var e = this.location.end;
// @ts-ignore
var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
// @ts-ignore
var line = src[s.line - 1];
// @ts-ignore
var last = s.line === e.line ? e.column : line.length + 1;
// @ts-ignore
var hatLen = (last - s.column) || 1;
// @ts-ignore
str += "\n --> " + loc + "\n"
// @ts-ignore
+ filler + " |\n"
// @ts-ignore
+ offset_s.line + " | " + line + "\n"
// @ts-ignore
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
// @ts-ignore
+ peg$padEnd("", hatLen, "^");
// @ts-ignore
} else {
// @ts-ignore
str += "\n at " + loc;
}
}
// @ts-ignore
return str;
};
// @ts-ignore
peg$SyntaxError.buildMessage = function(expected, found) {
// @ts-ignore
var DESCRIBE_EXPECTATION_FNS = {
// @ts-ignore
literal: function(expectation) {
// @ts-ignore
return "\"" + literalEscape(expectation.text) + "\"";
},
// @ts-ignore
class: function(expectation) {
// @ts-ignore
var escapedParts = expectation.parts.map(function(part) {
// @ts-ignore
return Array.isArray(part)
// @ts-ignore
? classEscape(part[0]) + "-" + classEscape(part[1])
// @ts-ignore
: classEscape(part);
});
// @ts-ignore
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
},
// @ts-ignore
any: function() {
// @ts-ignore
return "any character";
},
// @ts-ignore
end: function() {
// @ts-ignore
return "end of input";
},
// @ts-ignore
other: function(expectation) {
// @ts-ignore
return expectation.description;
}
};
// @ts-ignore
function hex(ch) {
// @ts-ignore
return ch.charCodeAt(0).toString(16).toUpperCase();
}
// @ts-ignore
function literalEscape(s) {
// @ts-ignore
return s
// @ts-ignore
.replace(/\\/g, "\\\\")
// @ts-ignore
.replace(/"/g, "\\\"")
// @ts-ignore
.replace(/\0/g, "\\0")
// @ts-ignore
.replace(/\t/g, "\\t")
// @ts-ignore
.replace(/\n/g, "\\n")
// @ts-ignore
.replace(/\r/g, "\\r")
// @ts-ignore
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
// @ts-ignore
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
}
// @ts-ignore
function classEscape(s) {
// @ts-ignore
return s
// @ts-ignore
.replace(/\\/g, "\\\\")
// @ts-ignore
.replace(/\]/g, "\\]")
// @ts-ignore
.replace(/\^/g, "\\^")
// @ts-ignore
.replace(/-/g, "\\-")
// @ts-ignore
.replace(/\0/g, "\\0")
// @ts-ignore
.replace(/\t/g, "\\t")
// @ts-ignore
.replace(/\n/g, "\\n")
// @ts-ignore
.replace(/\r/g, "\\r")
// @ts-ignore
.replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
// @ts-ignore
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
}
// @ts-ignore
function describeExpectation(expectation) {
// @ts-ignore
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
// @ts-ignore
function describeExpected(expected) {
// @ts-ignore
var descriptions = expected.map(describeExpectation);
// @ts-ignore
var i, j;
// @ts-ignore
descriptions.sort();
// @ts-ignore
if (descriptions.length > 0) {
// @ts-ignore
for (i = 1, j = 1; i < descriptions.length; i++) {
// @ts-ignore
if (descriptions[i - 1] !== descriptions[i]) {
// @ts-ignore
descriptions[j] = descriptions[i];
// @ts-ignore
j++;
}
}
// @ts-ignore
descriptions.length = j;
}
// @ts-ignore
switch (descriptions.length) {
// @ts-ignore
case 1:
// @ts-ignore
return descriptions[0];
// @ts-ignore
case 2:
// @ts-ignore
return descriptions[0] + " or " + descriptions[1];
// @ts-ignore
default:
// @ts-ignore
return descriptions.slice(0, -1).join(", ")
// @ts-ignore
+ ", or "
// @ts-ignore
+ descriptions[descriptions.length - 1];
}
}
// @ts-ignore
function describeFound(found) {
// @ts-ignore
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
// @ts-ignore
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
// @ts-ignore
function peg$parse(input, options) {
// @ts-ignore
options = options !== undefined ? options : {};
// @ts-ignore
var peg$FAILED = {};
// @ts-ignore
var peg$source = options.grammarSource;
// @ts-ignore
var peg$startRuleFunctions = { VersionRange: peg$parseVersionRange, Or: peg$parseOr, And: peg$parseAnd, VersionRangeAtom: peg$parseVersionRangeAtom, Parens: peg$parseParens, Anchor: peg$parseAnchor, VersionSpec: peg$parseVersionSpec, FlavorAtom: peg$parseFlavorAtom, Not: peg$parseNot, Any: peg$parseAny, None: peg$parseNone, CmpOp: peg$parseCmpOp, ExtendedVersion: peg$parseExtendedVersion, EmverVersionRange: peg$parseEmverVersionRange, EmverVersionRangeAtom: peg$parseEmverVersionRangeAtom, EmverParens: peg$parseEmverParens, EmverAnchor: peg$parseEmverAnchor, EmverNot: peg$parseEmverNot, Emver: peg$parseEmver, Flavor: peg$parseFlavor, FlavorString: peg$parseFlavorString, String: peg$parseString, Version: peg$parseVersion, PreRelease: peg$parsePreRelease, PreReleaseSegment: peg$parsePreReleaseSegment, VersionNumber: peg$parseVersionNumber, Digit: peg$parseDigit, _: peg$parse_ };
// @ts-ignore
var peg$startRuleFunction = peg$parseVersionRange;
// @ts-ignore
var peg$c0 = "||";
var peg$c1 = "&&";
var peg$c2 = "(";
var peg$c3 = ")";
var peg$c4 = ":";
var peg$c5 = "#";
var peg$c6 = "!";
var peg$c7 = "*";
var peg$c8 = ">=";
var peg$c9 = "<=";
var peg$c10 = ">";
var peg$c11 = "<";
var peg$c12 = "=";
var peg$c13 = "!=";
var peg$c14 = "^";
var peg$c15 = "~";
var peg$c16 = ".";
var peg$c17 = "-";
var peg$r0 = /^[a-z]/;
var peg$r1 = /^[a-zA-Z]/;
var peg$r2 = /^[0-9]/;
var peg$r3 = /^[ \t\n\r]/;
var peg$e0 = peg$literalExpectation("||", false);
var peg$e1 = peg$literalExpectation("&&", false);
var peg$e2 = peg$literalExpectation("(", false);
var peg$e3 = peg$literalExpectation(")", false);
var peg$e4 = peg$literalExpectation(":", false);
var peg$e5 = peg$literalExpectation("#", false);
var peg$e6 = peg$literalExpectation("!", false);
var peg$e7 = peg$literalExpectation("*", false);
var peg$e8 = peg$literalExpectation(">=", false);
var peg$e9 = peg$literalExpectation("<=", false);
var peg$e10 = peg$literalExpectation(">", false);
var peg$e11 = peg$literalExpectation("<", false);
var peg$e12 = peg$literalExpectation("=", false);
var peg$e13 = peg$literalExpectation("!=", false);
var peg$e14 = peg$literalExpectation("^", false);
var peg$e15 = peg$literalExpectation("~", false);
var peg$e16 = peg$literalExpectation(".", false);
var peg$e17 = peg$classExpectation([["a", "z"]], false, false);
var peg$e18 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false);
var peg$e19 = peg$literalExpectation("-", false);
var peg$e20 = peg$classExpectation([["0", "9"]], false, false);
var peg$e21 = peg$otherExpectation("whitespace");
var peg$e22 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false);
// @ts-ignore
var peg$f0 = function(expr) {// @ts-ignore
return { type: "Parens", expr } };// @ts-ignore
var peg$f1 = function(operator, version) {// @ts-ignore
return { type: "Anchor", operator, version } };// @ts-ignore
var peg$f2 = function(flavor, upstream, downstream) {// @ts-ignore
return { flavor: flavor || null, upstream, downstream: downstream ? downstream[1] : { number: [0], prerelease: [] } } };// @ts-ignore
var peg$f3 = function(flavor) {// @ts-ignore
return { type: "Flavor", flavor: flavor } };// @ts-ignore
var peg$f4 = function(value) {// @ts-ignore
return { type: "Not", value: value }};// @ts-ignore
var peg$f5 = function() {// @ts-ignore
return { type: "Any" } };// @ts-ignore
var peg$f6 = function() {// @ts-ignore
return { type: "None" } };// @ts-ignore
var peg$f7 = function() {// @ts-ignore
return ">="; };// @ts-ignore
var peg$f8 = function() {// @ts-ignore
return "<="; };// @ts-ignore
var peg$f9 = function() {// @ts-ignore
return ">"; };// @ts-ignore
var peg$f10 = function() {// @ts-ignore
return "<"; };// @ts-ignore
var peg$f11 = function() {// @ts-ignore
return "="; };// @ts-ignore
var peg$f12 = function() {// @ts-ignore
return "!="; };// @ts-ignore
var peg$f13 = function() {// @ts-ignore
return "^"; };// @ts-ignore
var peg$f14 = function() {// @ts-ignore
return "~"; };// @ts-ignore
var peg$f15 = function(flavor, upstream, downstream) {
// @ts-ignore
return { flavor: flavor || null, upstream, downstream }
};// @ts-ignore
var peg$f16 = function(expr) {// @ts-ignore
return { type: "Parens", expr } };// @ts-ignore
var peg$f17 = function(operator, version) {// @ts-ignore
return { type: "Anchor", operator, version } };// @ts-ignore
var peg$f18 = function(value) {// @ts-ignore
return { type: "Not", value: value }};// @ts-ignore
var peg$f19 = function(major, minor, patch, revision) {// @ts-ignore
return revision };// @ts-ignore
var peg$f20 = function(major, minor, patch, revision) {
// @ts-ignore
return {
// @ts-ignore
flavor: null,
// @ts-ignore
upstream: {
// @ts-ignore
number: [major, minor, patch],
// @ts-ignore
prerelease: [],
},
// @ts-ignore
downstream: {
// @ts-ignore
number: [revision || 0],
// @ts-ignore
prerelease: [],
},
}
};// @ts-ignore
var peg$f21 = function(flavor) {// @ts-ignore
return flavor };// @ts-ignore
var peg$f22 = function() {// @ts-ignore
return text() };// @ts-ignore
var peg$f23 = function() {// @ts-ignore
return text(); };// @ts-ignore
var peg$f24 = function(number, prerelease) {
// @ts-ignore
return {
// @ts-ignore
number,
// @ts-ignore
prerelease: prerelease || []
};
};// @ts-ignore
var peg$f25 = function(first, rest) {
// @ts-ignore
return [first].concat(rest.map(r => r[1]));
};// @ts-ignore
var peg$f26 = function(segment) {
// @ts-ignore
return segment;
};// @ts-ignore
var peg$f27 = function(first, rest) {
// @ts-ignore
return [first].concat(rest.map(r => r[1]));
};// @ts-ignore
var peg$f28 = function() {// @ts-ignore
return parseInt(text(), 10); };
// @ts-ignore
var peg$currPos = 0;
// @ts-ignore
var peg$savedPos = 0;
// @ts-ignore
var peg$posDetailsCache = [{ line: 1, column: 1 }];
// @ts-ignore
var peg$maxFailPos = 0;
// @ts-ignore
var peg$maxFailExpected = [];
// @ts-ignore
var peg$silentFails = 0;
// @ts-ignore
var peg$result;
// @ts-ignore
if ("startRule" in options) {
// @ts-ignore
if (!(options.startRule in peg$startRuleFunctions)) {
// @ts-ignore
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
}
// @ts-ignore
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
}
// @ts-ignore
function text() {
// @ts-ignore
return input.substring(peg$savedPos, peg$currPos);
}
// @ts-ignore
function offset() {
// @ts-ignore
return peg$savedPos;
}
// @ts-ignore
function range() {
// @ts-ignore
return {
// @ts-ignore
source: peg$source,
// @ts-ignore
start: peg$savedPos,
// @ts-ignore
end: peg$currPos
};
}
// @ts-ignore
function location() {
// @ts-ignore
return peg$computeLocation(peg$savedPos, peg$currPos);
}
// @ts-ignore
function expected(description, location) {
// @ts-ignore
location = location !== undefined
// @ts-ignore
? location
// @ts-ignore
: peg$computeLocation(peg$savedPos, peg$currPos);
// @ts-ignore
throw peg$buildStructuredError(
// @ts-ignore
[peg$otherExpectation(description)],
// @ts-ignore
input.substring(peg$savedPos, peg$currPos),
// @ts-ignore
location
);
}
// @ts-ignore
function error(message, location) {
// @ts-ignore
location = location !== undefined
// @ts-ignore
? location
// @ts-ignore
: peg$computeLocation(peg$savedPos, peg$currPos);
// @ts-ignore
throw peg$buildSimpleError(message, location);
}
// @ts-ignore
function peg$literalExpectation(text, ignoreCase) {
// @ts-ignore
return { type: "literal", text: text, ignoreCase: ignoreCase };
}
// @ts-ignore
function peg$classExpectation(parts, inverted, ignoreCase) {
// @ts-ignore
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
}
// @ts-ignore
function peg$anyExpectation() {
// @ts-ignore
return { type: "any" };
}
// @ts-ignore
function peg$endExpectation() {
// @ts-ignore
return { type: "end" };
}
// @ts-ignore
function peg$otherExpectation(description) {
// @ts-ignore
return { type: "other", description: description };
}
// @ts-ignore
function peg$computePosDetails(pos) {
// @ts-ignore
var details = peg$posDetailsCache[pos];
// @ts-ignore
var p;
// @ts-ignore
if (details) {
// @ts-ignore
return details;
// @ts-ignore
} else {
// @ts-ignore
p = pos - 1;
// @ts-ignore
while (!peg$posDetailsCache[p]) {
// @ts-ignore
p--;
}
// @ts-ignore
details = peg$posDetailsCache[p];
// @ts-ignore
details = {
// @ts-ignore
line: details.line,
// @ts-ignore
column: details.column
};
// @ts-ignore
while (p < pos) {
// @ts-ignore
if (input.charCodeAt(p) === 10) {
// @ts-ignore
details.line++;
// @ts-ignore
details.column = 1;
// @ts-ignore
} else {
// @ts-ignore
details.column++;
}
// @ts-ignore
p++;
}
// @ts-ignore
peg$posDetailsCache[pos] = details;
// @ts-ignore
return details;
}
}
// @ts-ignore
function peg$computeLocation(startPos, endPos, offset) {
// @ts-ignore
var startPosDetails = peg$computePosDetails(startPos);
// @ts-ignore
var endPosDetails = peg$computePosDetails(endPos);
// @ts-ignore
var res = {
// @ts-ignore
source: peg$source,
// @ts-ignore
start: {
// @ts-ignore
offset: startPos,
// @ts-ignore
line: startPosDetails.line,
// @ts-ignore
column: startPosDetails.column
},
// @ts-ignore
end: {
// @ts-ignore
offset: endPos,
// @ts-ignore
line: endPosDetails.line,
// @ts-ignore
column: endPosDetails.column
}
};
// @ts-ignore
if (offset && peg$source && (typeof peg$source.offset === "function")) {
// @ts-ignore
res.start = peg$source.offset(res.start);
// @ts-ignore
res.end = peg$source.offset(res.end);
}
// @ts-ignore
return res;
}
// @ts-ignore
function peg$fail(expected) {
// @ts-ignore
if (peg$currPos < peg$maxFailPos) { return; }
// @ts-ignore
if (peg$currPos > peg$maxFailPos) {
// @ts-ignore
peg$maxFailPos = peg$currPos;
// @ts-ignore
peg$maxFailExpected = [];
}
// @ts-ignore
peg$maxFailExpected.push(expected);
}
// @ts-ignore
function peg$buildSimpleError(message, location) {
// @ts-ignore
return new peg$SyntaxError(message, null, null, location);
}
// @ts-ignore
function peg$buildStructuredError(expected, found, location) {
// @ts-ignore
return new peg$SyntaxError(
// @ts-ignore
peg$SyntaxError.buildMessage(expected, found),
// @ts-ignore
expected,
// @ts-ignore
found,
// @ts-ignore
location
);
}
// @ts-ignore
function // @ts-ignore
peg$parseVersionRange() {
// @ts-ignore
var s0, s1, s2, s3, s4, s5, s6, s7;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseVersionRangeAtom();
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = [];
// @ts-ignore
s3 = peg$currPos;
// @ts-ignore
s4 = peg$parse_();
// @ts-ignore
s5 = peg$currPos;
// @ts-ignore
s6 = peg$parseOr();
// @ts-ignore
if (s6 === peg$FAILED) {
// @ts-ignore
s6 = peg$parseAnd();
}
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s7 = peg$parse_();
// @ts-ignore
s6 = [s6, s7];
// @ts-ignore
s5 = s6;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s5;
// @ts-ignore
s5 = peg$FAILED;
}
// @ts-ignore
if (s5 === peg$FAILED) {
// @ts-ignore
s5 = null;
}
// @ts-ignore
s6 = peg$parseVersionRangeAtom();
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s4 = [s4, s5, s6];
// @ts-ignore
s3 = s4;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
// @ts-ignore
while (s3 !== peg$FAILED) {
// @ts-ignore
s2.push(s3);
// @ts-ignore
s3 = peg$currPos;
// @ts-ignore
s4 = peg$parse_();
// @ts-ignore
s5 = peg$currPos;
// @ts-ignore
s6 = peg$parseOr();
// @ts-ignore
if (s6 === peg$FAILED) {
// @ts-ignore
s6 = peg$parseAnd();
}
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s7 = peg$parse_();
// @ts-ignore
s6 = [s6, s7];
// @ts-ignore
s5 = s6;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s5;
// @ts-ignore
s5 = peg$FAILED;
}
// @ts-ignore
if (s5 === peg$FAILED) {
// @ts-ignore
s5 = null;
}
// @ts-ignore
s6 = peg$parseVersionRangeAtom();
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s4 = [s4, s5, s6];
// @ts-ignore
s3 = s4;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
}
// @ts-ignore
s1 = [s1, s2];
// @ts-ignore
s0 = s1;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseOr() {
// @ts-ignore
var s0;
// @ts-ignore
if (input.substr(peg$currPos, 2) === peg$c0) {
// @ts-ignore
s0 = peg$c0;
// @ts-ignore
peg$currPos += 2;
// @ts-ignore
} else {
// @ts-ignore
s0 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e0); }
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseAnd() {
// @ts-ignore
var s0;
// @ts-ignore
if (input.substr(peg$currPos, 2) === peg$c1) {
// @ts-ignore
s0 = peg$c1;
// @ts-ignore
peg$currPos += 2;
// @ts-ignore
} else {
// @ts-ignore
s0 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e1); }
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseVersionRangeAtom() {
// @ts-ignore
var s0;
// @ts-ignore
s0 = peg$parseParens();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseAnchor();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseNot();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseAny();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseNone();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseFlavorAtom();
}
}
}
}
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseParens() {
// @ts-ignore
var s0, s1, s2, s3, s4, s5;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 40) {
// @ts-ignore
s1 = peg$c2;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e2); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = peg$parse_();
// @ts-ignore
s3 = peg$parseVersionRange();
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
s4 = peg$parse_();
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 41) {
// @ts-ignore
s5 = peg$c3;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s5 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e3); }
}
// @ts-ignore
if (s5 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f0(s3);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseAnchor() {
// @ts-ignore
var s0, s1, s2, s3;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseCmpOp();
// @ts-ignore
if (s1 === peg$FAILED) {
// @ts-ignore
s1 = null;
}
// @ts-ignore
s2 = peg$parse_();
// @ts-ignore
s3 = peg$parseVersionSpec();
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f1(s1, s3);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseVersionSpec() {
// @ts-ignore
var s0, s1, s2, s3, s4, s5;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseFlavor();
// @ts-ignore
if (s1 === peg$FAILED) {
// @ts-ignore
s1 = null;
}
// @ts-ignore
s2 = peg$parseVersion();
// @ts-ignore
if (s2 !== peg$FAILED) {
// @ts-ignore
s3 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 58) {
// @ts-ignore
s4 = peg$c4;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s4 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e4); }
}
// @ts-ignore
if (s4 !== peg$FAILED) {
// @ts-ignore
s5 = peg$parseVersion();
// @ts-ignore
if (s5 !== peg$FAILED) {
// @ts-ignore
s4 = [s4, s5];
// @ts-ignore
s3 = s4;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
// @ts-ignore
if (s3 === peg$FAILED) {
// @ts-ignore
s3 = null;
}
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f2(s1, s2, s3);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseFlavorAtom() {
// @ts-ignore
var s0, s1, s2;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 35) {
// @ts-ignore
s1 = peg$c5;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e5); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = peg$parseFlavorString();
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f3(s2);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseNot() {
// @ts-ignore
var s0, s1, s2, s3;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 33) {
// @ts-ignore
s1 = peg$c6;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e6); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = peg$parse_();
// @ts-ignore
s3 = peg$parseVersionRangeAtom();
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f4(s3);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseAny() {
// @ts-ignore
var s0, s1;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 42) {
// @ts-ignore
s1 = peg$c7;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e7); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f5();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseNone() {
// @ts-ignore
var s0, s1;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 33) {
// @ts-ignore
s1 = peg$c6;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e6); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f6();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseCmpOp() {
// @ts-ignore
var s0, s1;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.substr(peg$currPos, 2) === peg$c8) {
// @ts-ignore
s1 = peg$c8;
// @ts-ignore
peg$currPos += 2;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e8); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f7();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.substr(peg$currPos, 2) === peg$c9) {
// @ts-ignore
s1 = peg$c9;
// @ts-ignore
peg$currPos += 2;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e9); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f8();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 62) {
// @ts-ignore
s1 = peg$c10;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e10); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f9();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 60) {
// @ts-ignore
s1 = peg$c11;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e11); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f10();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 61) {
// @ts-ignore
s1 = peg$c12;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e12); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f11();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.substr(peg$currPos, 2) === peg$c13) {
// @ts-ignore
s1 = peg$c13;
// @ts-ignore
peg$currPos += 2;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e13); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f12();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 94) {
// @ts-ignore
s1 = peg$c14;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e14); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f13();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 126) {
// @ts-ignore
s1 = peg$c15;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e15); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f14();
}
// @ts-ignore
s0 = s1;
}
}
}
}
}
}
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseExtendedVersion() {
// @ts-ignore
var s0, s1, s2, s3, s4;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseFlavor();
// @ts-ignore
if (s1 === peg$FAILED) {
// @ts-ignore
s1 = null;
}
// @ts-ignore
s2 = peg$parseVersion();
// @ts-ignore
if (s2 !== peg$FAILED) {
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 58) {
// @ts-ignore
s3 = peg$c4;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s3 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e4); }
}
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
s4 = peg$parseVersion();
// @ts-ignore
if (s4 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f15(s1, s2, s4);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseEmverVersionRange() {
// @ts-ignore
var s0, s1, s2, s3, s4, s5, s6, s7;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseEmverVersionRangeAtom();
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = [];
// @ts-ignore
s3 = peg$currPos;
// @ts-ignore
s4 = peg$parse_();
// @ts-ignore
s5 = peg$currPos;
// @ts-ignore
s6 = peg$parseOr();
// @ts-ignore
if (s6 === peg$FAILED) {
// @ts-ignore
s6 = peg$parseAnd();
}
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s7 = peg$parse_();
// @ts-ignore
s6 = [s6, s7];
// @ts-ignore
s5 = s6;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s5;
// @ts-ignore
s5 = peg$FAILED;
}
// @ts-ignore
if (s5 === peg$FAILED) {
// @ts-ignore
s5 = null;
}
// @ts-ignore
s6 = peg$parseEmverVersionRangeAtom();
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s4 = [s4, s5, s6];
// @ts-ignore
s3 = s4;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
// @ts-ignore
while (s3 !== peg$FAILED) {
// @ts-ignore
s2.push(s3);
// @ts-ignore
s3 = peg$currPos;
// @ts-ignore
s4 = peg$parse_();
// @ts-ignore
s5 = peg$currPos;
// @ts-ignore
s6 = peg$parseOr();
// @ts-ignore
if (s6 === peg$FAILED) {
// @ts-ignore
s6 = peg$parseAnd();
}
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s7 = peg$parse_();
// @ts-ignore
s6 = [s6, s7];
// @ts-ignore
s5 = s6;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s5;
// @ts-ignore
s5 = peg$FAILED;
}
// @ts-ignore
if (s5 === peg$FAILED) {
// @ts-ignore
s5 = null;
}
// @ts-ignore
s6 = peg$parseEmverVersionRangeAtom();
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s4 = [s4, s5, s6];
// @ts-ignore
s3 = s4;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
}
// @ts-ignore
s1 = [s1, s2];
// @ts-ignore
s0 = s1;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseEmverVersionRangeAtom() {
// @ts-ignore
var s0;
// @ts-ignore
s0 = peg$parseEmverParens();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseEmverAnchor();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseEmverNot();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseAny();
// @ts-ignore
if (s0 === peg$FAILED) {
// @ts-ignore
s0 = peg$parseNone();
}
}
}
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseEmverParens() {
// @ts-ignore
var s0, s1, s2, s3, s4, s5;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 40) {
// @ts-ignore
s1 = peg$c2;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e2); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = peg$parse_();
// @ts-ignore
s3 = peg$parseEmverVersionRange();
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
s4 = peg$parse_();
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 41) {
// @ts-ignore
s5 = peg$c3;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s5 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e3); }
}
// @ts-ignore
if (s5 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f16(s3);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseEmverAnchor() {
// @ts-ignore
var s0, s1, s2, s3;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseCmpOp();
// @ts-ignore
if (s1 === peg$FAILED) {
// @ts-ignore
s1 = null;
}
// @ts-ignore
s2 = peg$parse_();
// @ts-ignore
s3 = peg$parseEmver();
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f17(s1, s3);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseEmverNot() {
// @ts-ignore
var s0, s1, s2, s3;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 33) {
// @ts-ignore
s1 = peg$c6;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e6); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = peg$parse_();
// @ts-ignore
s3 = peg$parseEmverVersionRangeAtom();
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f18(s3);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseEmver() {
// @ts-ignore
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseDigit();
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 46) {
// @ts-ignore
s2 = peg$c16;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s2 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
// @ts-ignore
if (s2 !== peg$FAILED) {
// @ts-ignore
s3 = peg$parseDigit();
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 46) {
// @ts-ignore
s4 = peg$c16;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s4 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
// @ts-ignore
if (s4 !== peg$FAILED) {
// @ts-ignore
s5 = peg$parseDigit();
// @ts-ignore
if (s5 !== peg$FAILED) {
// @ts-ignore
s6 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 46) {
// @ts-ignore
s7 = peg$c16;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s7 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
// @ts-ignore
if (s7 !== peg$FAILED) {
// @ts-ignore
s8 = peg$parseDigit();
// @ts-ignore
if (s8 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s6;
// @ts-ignore
s6 = peg$f19(s1, s3, s5, s8);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s6;
// @ts-ignore
s6 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s6;
// @ts-ignore
s6 = peg$FAILED;
}
// @ts-ignore
if (s6 === peg$FAILED) {
// @ts-ignore
s6 = null;
}
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f20(s1, s3, s5, s6);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseFlavor() {
// @ts-ignore
var s0, s1, s2, s3;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 35) {
// @ts-ignore
s1 = peg$c5;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e5); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = peg$parseFlavorString();
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 58) {
// @ts-ignore
s3 = peg$c4;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s3 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e4); }
}
// @ts-ignore
if (s3 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f21(s2);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseFlavorString() {
// @ts-ignore
var s0, s1, s2;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = [];
// @ts-ignore
if (peg$r0.test(input.charAt(peg$currPos))) {
// @ts-ignore
s2 = input.charAt(peg$currPos);
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s2 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e17); }
}
// @ts-ignore
while (s2 !== peg$FAILED) {
// @ts-ignore
s1.push(s2);
// @ts-ignore
if (peg$r0.test(input.charAt(peg$currPos))) {
// @ts-ignore
s2 = input.charAt(peg$currPos);
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s2 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e17); }
}
}
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f22();
// @ts-ignore
s0 = s1;
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseString() {
// @ts-ignore
var s0, s1, s2;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = [];
// @ts-ignore
if (peg$r1.test(input.charAt(peg$currPos))) {
// @ts-ignore
s2 = input.charAt(peg$currPos);
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s2 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e18); }
}
// @ts-ignore
if (s2 !== peg$FAILED) {
// @ts-ignore
while (s2 !== peg$FAILED) {
// @ts-ignore
s1.push(s2);
// @ts-ignore
if (peg$r1.test(input.charAt(peg$currPos))) {
// @ts-ignore
s2 = input.charAt(peg$currPos);
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s2 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e18); }
}
}
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f23();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseVersion() {
// @ts-ignore
var s0, s1, s2;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseVersionNumber();
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = peg$parsePreRelease();
// @ts-ignore
if (s2 === peg$FAILED) {
// @ts-ignore
s2 = null;
}
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f24(s1, s2);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parsePreRelease() {
// @ts-ignore
var s0, s1, s2, s3, s4, s5, s6;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 45) {
// @ts-ignore
s1 = peg$c17;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e19); }
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = peg$parsePreReleaseSegment();
// @ts-ignore
if (s2 !== peg$FAILED) {
// @ts-ignore
s3 = [];
// @ts-ignore
s4 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 46) {
// @ts-ignore
s5 = peg$c16;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s5 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
// @ts-ignore
if (s5 !== peg$FAILED) {
// @ts-ignore
s6 = peg$parsePreReleaseSegment();
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s5 = [s5, s6];
// @ts-ignore
s4 = s5;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s4;
// @ts-ignore
s4 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s4;
// @ts-ignore
s4 = peg$FAILED;
}
// @ts-ignore
while (s4 !== peg$FAILED) {
// @ts-ignore
s3.push(s4);
// @ts-ignore
s4 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 46) {
// @ts-ignore
s5 = peg$c16;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s5 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
// @ts-ignore
if (s5 !== peg$FAILED) {
// @ts-ignore
s6 = peg$parsePreReleaseSegment();
// @ts-ignore
if (s6 !== peg$FAILED) {
// @ts-ignore
s5 = [s5, s6];
// @ts-ignore
s4 = s5;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s4;
// @ts-ignore
s4 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s4;
// @ts-ignore
s4 = peg$FAILED;
}
}
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f25(s2, s3);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parsePreReleaseSegment() {
// @ts-ignore
var s0, s1, s2;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 46) {
// @ts-ignore
s1 = peg$c16;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
// @ts-ignore
if (s1 === peg$FAILED) {
// @ts-ignore
s1 = null;
}
// @ts-ignore
s2 = peg$parseDigit();
// @ts-ignore
if (s2 === peg$FAILED) {
// @ts-ignore
s2 = peg$parseString();
}
// @ts-ignore
if (s2 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f26(s2);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseVersionNumber() {
// @ts-ignore
var s0, s1, s2, s3, s4, s5;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = peg$parseDigit();
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
s2 = [];
// @ts-ignore
s3 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 46) {
// @ts-ignore
s4 = peg$c16;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s4 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
// @ts-ignore
if (s4 !== peg$FAILED) {
// @ts-ignore
s5 = peg$parseDigit();
// @ts-ignore
if (s5 !== peg$FAILED) {
// @ts-ignore
s4 = [s4, s5];
// @ts-ignore
s3 = s4;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
// @ts-ignore
while (s3 !== peg$FAILED) {
// @ts-ignore
s2.push(s3);
// @ts-ignore
s3 = peg$currPos;
// @ts-ignore
if (input.charCodeAt(peg$currPos) === 46) {
// @ts-ignore
s4 = peg$c16;
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s4 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
// @ts-ignore
if (s4 !== peg$FAILED) {
// @ts-ignore
s5 = peg$parseDigit();
// @ts-ignore
if (s5 !== peg$FAILED) {
// @ts-ignore
s4 = [s4, s5];
// @ts-ignore
s3 = s4;
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s3;
// @ts-ignore
s3 = peg$FAILED;
}
}
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s0 = peg$f27(s1, s2);
// @ts-ignore
} else {
// @ts-ignore
peg$currPos = s0;
// @ts-ignore
s0 = peg$FAILED;
}
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parseDigit() {
// @ts-ignore
var s0, s1, s2;
// @ts-ignore
s0 = peg$currPos;
// @ts-ignore
s1 = [];
// @ts-ignore
if (peg$r2.test(input.charAt(peg$currPos))) {
// @ts-ignore
s2 = input.charAt(peg$currPos);
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s2 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e20); }
}
// @ts-ignore
if (s2 !== peg$FAILED) {
// @ts-ignore
while (s2 !== peg$FAILED) {
// @ts-ignore
s1.push(s2);
// @ts-ignore
if (peg$r2.test(input.charAt(peg$currPos))) {
// @ts-ignore
s2 = input.charAt(peg$currPos);
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s2 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e20); }
}
}
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
}
// @ts-ignore
if (s1 !== peg$FAILED) {
// @ts-ignore
peg$savedPos = s0;
// @ts-ignore
s1 = peg$f28();
}
// @ts-ignore
s0 = s1;
// @ts-ignore
return s0;
}
// @ts-ignore
function // @ts-ignore
peg$parse_() {
// @ts-ignore
var s0, s1;
// @ts-ignore
peg$silentFails++;
// @ts-ignore
s0 = [];
// @ts-ignore
if (peg$r3.test(input.charAt(peg$currPos))) {
// @ts-ignore
s1 = input.charAt(peg$currPos);
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e22); }
}
// @ts-ignore
while (s1 !== peg$FAILED) {
// @ts-ignore
s0.push(s1);
// @ts-ignore
if (peg$r3.test(input.charAt(peg$currPos))) {
// @ts-ignore
s1 = input.charAt(peg$currPos);
// @ts-ignore
peg$currPos++;
// @ts-ignore
} else {
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e22); }
}
}
// @ts-ignore
peg$silentFails--;
// @ts-ignore
s1 = peg$FAILED;
// @ts-ignore
if (peg$silentFails === 0) { peg$fail(peg$e21); }
// @ts-ignore
return s0;
}
// @ts-ignore
peg$result = peg$startRuleFunction();
// @ts-ignore
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
// @ts-ignore
return peg$result;
// @ts-ignore
} else {
// @ts-ignore
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
// @ts-ignore
peg$fail(peg$endExpectation());
}
// @ts-ignore
throw peg$buildStructuredError(
// @ts-ignore
peg$maxFailExpected,
// @ts-ignore
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
// @ts-ignore
peg$maxFailPos < input.length
// @ts-ignore
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
// @ts-ignore
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
);
}
}
// @ts-ignore
return {
SyntaxError: peg$SyntaxError,
parse: peg$parse
};
})()
export interface FilePosition {
offset: number;
line: number;
column: number;
}
export interface FileRange {
start: FilePosition;
end: FilePosition;
source: string;
}
export interface LiteralExpectation {
type: "literal";
text: string;
ignoreCase: boolean;
}
export interface ClassParts extends Array<string | ClassParts> {}
export interface ClassExpectation {
type: "class";
parts: ClassParts;
inverted: boolean;
ignoreCase: boolean;
}
export interface AnyExpectation {
type: "any";
}
export interface EndExpectation {
type: "end";
}
export interface OtherExpectation {
type: "other";
description: string;
}
export type Expectation = LiteralExpectation | ClassExpectation | AnyExpectation | EndExpectation | OtherExpectation;
declare class _PeggySyntaxError extends Error {
public static buildMessage(expected: Expectation[], found: string | null): string;
public message: string;
public expected: Expectation[];
public found: string | null;
public location: FileRange;
public name: string;
constructor(message: string, expected: Expectation[], found: string | null, location: FileRange);
format(sources: {
source?: any;
text: string;
}[]): string;
}
export interface TraceEvent {
type: string;
rule: string;
result?: any;
location: FileRange;
}
declare class _DefaultTracer {
private indentLevel: number;
public trace(event: TraceEvent): void;
}
peggyParser.SyntaxError.prototype.name = "PeggySyntaxError";
export interface ParseOptions {
filename?: string;
startRule?: "VersionRange" | "Or" | "And" | "VersionRangeAtom" | "Parens" | "Anchor" | "VersionSpec" | "FlavorAtom" | "Not" | "Any" | "None" | "CmpOp" | "ExtendedVersion" | "EmverVersionRange" | "EmverVersionRangeAtom" | "EmverParens" | "EmverAnchor" | "EmverNot" | "Emver" | "Flavor" | "FlavorString" | "String" | "Version" | "PreRelease" | "PreReleaseSegment" | "VersionNumber" | "Digit" | "_";
tracer?: any;
[key: string]: any;
}
export type ParseFunction = <Options extends ParseOptions>(
input: string,
options?: Options
) => Options extends { startRule: infer StartRule } ?
StartRule extends "VersionRange" ? VersionRange :
StartRule extends "Or" ? Or :
StartRule extends "And" ? And :
StartRule extends "VersionRangeAtom" ? VersionRangeAtom :
StartRule extends "Parens" ? Parens :
StartRule extends "Anchor" ? Anchor :
StartRule extends "VersionSpec" ? VersionSpec :
StartRule extends "FlavorAtom" ? FlavorAtom :
StartRule extends "Not" ? Not :
StartRule extends "Any" ? Any :
StartRule extends "None" ? None :
StartRule extends "CmpOp" ? CmpOp :
StartRule extends "ExtendedVersion" ? ExtendedVersion :
StartRule extends "EmverVersionRange" ? EmverVersionRange :
StartRule extends "EmverVersionRangeAtom" ? EmverVersionRangeAtom :
StartRule extends "EmverParens" ? EmverParens :
StartRule extends "EmverAnchor" ? EmverAnchor :
StartRule extends "EmverNot" ? EmverNot :
StartRule extends "Emver" ? Emver :
StartRule extends "Flavor" ? Flavor :
StartRule extends "FlavorString" ? FlavorString :
StartRule extends "String" ? String_1 :
StartRule extends "Version" ? Version :
StartRule extends "PreRelease" ? PreRelease :
StartRule extends "PreReleaseSegment" ? PreReleaseSegment :
StartRule extends "VersionNumber" ? VersionNumber :
StartRule extends "Digit" ? Digit :
StartRule extends "_" ? _ : VersionRange
: VersionRange;
export const parse: ParseFunction = peggyParser.parse;
export const PeggySyntaxError = peggyParser.SyntaxError as typeof _PeggySyntaxError;
export type PeggySyntaxError = _PeggySyntaxError;
// These types were autogenerated by ts-pegjs
export type VersionRange = [
VersionRangeAtom,
[_, [Or | And, _] | null, VersionRangeAtom][]
];
export type Or = "||";
export type And = "&&";
export type VersionRangeAtom = Parens | Anchor | Not | Any | None | FlavorAtom;
export type Parens = { type: "Parens"; expr: VersionRange };
export type Anchor = {
type: "Anchor";
operator: CmpOp | null;
version: VersionSpec;
};
export type VersionSpec = {
flavor: NonNullable<Flavor | null> | null;
upstream: Version;
downstream: any;
};
export type FlavorAtom = { type: "Flavor"; flavor: FlavorString };
export type Not = { type: "Not"; value: VersionRangeAtom };
export type Any = { type: "Any" };
export type None = { type: "None" };
export type CmpOp = ">=" | "<=" | ">" | "<" | "=" | "!=" | "^" | "~";
export type ExtendedVersion = {
flavor: NonNullable<Flavor | null> | null;
upstream: Version;
downstream: Version;
};
export type EmverVersionRange = [
EmverVersionRangeAtom,
[_, [Or | And, _] | null, EmverVersionRangeAtom][]
];
export type EmverVersionRangeAtom =
| EmverParens
| EmverAnchor
| EmverNot
| Any
| None;
export type EmverParens = { type: "Parens"; expr: EmverVersionRange };
export type EmverAnchor = {
type: "Anchor";
operator: CmpOp | null;
version: Emver;
};
export type EmverNot = { type: "Not"; value: EmverVersionRangeAtom };
export type Emver = {
flavor: null;
upstream: { number: [Digit, Digit, Digit]; prerelease: [] };
downstream: { number: [0 | NonNullable<Digit | null>]; prerelease: [] };
};
export type Flavor = FlavorString;
export type FlavorString = string;
export type String_1 = string;
export type Version = {
number: VersionNumber;
prerelease: never[] | NonNullable<PreRelease | null>;
};
export type PreRelease = PreReleaseSegment[];
export type PreReleaseSegment = Digit | String_1;
export type VersionNumber = Digit[];
export type Digit = number;
export type _ = string[];