metar-taf-parser 8.0.5 → 9.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/README.md CHANGED
@@ -19,7 +19,7 @@ Features:
19
19
  ## Installation
20
20
 
21
21
  ```sh
22
- yarn add metar-taf-parser
22
+ pnpm i metar-taf-parser
23
23
  # or
24
24
  npm i --save metar-taf-parser
25
25
  ```
@@ -345,6 +345,13 @@ declare enum DepositType {
345
345
  FrozenRidges = "9"
346
346
  }
347
347
  declare enum DepositCoverage {
348
+ /**
349
+ * Only reported by certain countries (e.g. Russia)
350
+ */
351
+ None = "0",
352
+ /**
353
+ * Not reported (e.g. due to rwy clearance in progress)
354
+ */
348
355
  NotReported = "/",
349
356
  Less10 = "1",
350
357
  From11To25 = "2",
@@ -1564,4 +1571,4 @@ declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptions): ITA
1564
1571
  declare function parseTAF(rawTAF: string, options?: IMetarTAFParserOptionsDated): ITAFDated;
1565
1572
  declare function parseTAFAsForecast(rawTAF: string, options: IMetarTAFParserOptionsDated): IForecastContainer;
1566
1573
 
1567
- export { AltimeterUnit, CloudQuantity, CloudType, CommandExecutionError, DepositCoverage, DepositType, Descriptive, Direction, Distance, DistanceUnit, Forecast, IAbstractTrend, IAbstractValidity, IAbstractWeatherCode, IAbstractWeatherCodeDated, IAbstractWeatherContainer, IAltimeter, IBaseRemark, IBaseRunwayInfo, IBaseTAFTrend, ICeilingHeightRemark, ICeilingSecondLocationRemark, ICloud, ICompositeForecast, IEndValidity, IFMValidity, IFlags, IForecastContainer, IHourlyMaximumMinimumTemperatureRemark, IHourlyMaximumTemperatureRemark, IHourlyMinimumTemperatureRemark, IHourlyPrecipitationAmountRemark, IHourlyPressureRemark, IHourlyTemperatureDewPointRemark, IIceAccretionRemark, IIcing, IMetar, IMetarDated, IMetarTAFParserOptions, IMetarTAFParserOptionsDated, IMetarTrend, IMetarTrendTime, IObscurationRemark, IPrecipitationAmount24HourRemark, IPrecipitationAmount36HourRemark, IPrecipitationBegEndRemark, IPrevailingVisibilityRemark, IRunwayInfoDeposit, IRunwayInfoRange, ISeaLevelPressureRemark, ISecondLocationVisibilityRemark, ISectorVisibilityRemark, ISmallHailSizeRemark, ISnowIncreaseRemark, ISnowPelletsRemark, ISunshineDurationRemark, ISurfaceVisibilityRemark, ITAF, ITAFDated, ITafGroups, ITemperature, ITemperatureDated, IThunderStormLocationMovingRemark, IThunderStormLocationRemark, ITime, ITornadicActivityBegEndRemark, ITornadicActivityBegRemark, ITornadicActivityEndRemark, ITowerVisibilityRemark, ITurbulence, IUnknownRemark, IValidity, IValidityDated, IVariableSkyHeightRemark, IVariableSkyRemark, IVirgaDirectionRemark, IWaterEquivalentSnowRemark, IWeatherCondition, IWind, IWindPeakCommandRemark, IWindShear, IWindShiftFropaRemark, IcingIntensity, Intensity, InvalidWeatherStatementError, Locale, MetarType, ParseError, PartialWeatherStatementError, Phenomenon, Remark, RemarkType, RunwayInfo, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, TAFTrend, TAFTrendDated, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, Visibility, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
1574
+ export { AltimeterUnit, CloudQuantity, CloudType, CommandExecutionError, DepositCoverage, DepositType, Descriptive, Direction, type Distance, DistanceUnit, type Forecast, type IAbstractTrend, type IAbstractValidity, type IAbstractWeatherCode, type IAbstractWeatherCodeDated, type IAbstractWeatherContainer, type IAltimeter, type IBaseRemark, type IBaseRunwayInfo, type IBaseTAFTrend, type ICeilingHeightRemark, type ICeilingSecondLocationRemark, type ICloud, type ICompositeForecast, type IEndValidity, type IFMValidity, type IFlags, type IForecastContainer, type IHourlyMaximumMinimumTemperatureRemark, type IHourlyMaximumTemperatureRemark, type IHourlyMinimumTemperatureRemark, type IHourlyPrecipitationAmountRemark, type IHourlyPressureRemark, type IHourlyTemperatureDewPointRemark, type IIceAccretionRemark, type IIcing, type IMetar, type IMetarDated, type IMetarTAFParserOptions, type IMetarTAFParserOptionsDated, type IMetarTrend, type IMetarTrendTime, type IObscurationRemark, type IPrecipitationAmount24HourRemark, type IPrecipitationAmount36HourRemark, type IPrecipitationBegEndRemark, type IPrevailingVisibilityRemark, type IRunwayInfoDeposit, type IRunwayInfoRange, type ISeaLevelPressureRemark, type ISecondLocationVisibilityRemark, type ISectorVisibilityRemark, type ISmallHailSizeRemark, type ISnowIncreaseRemark, type ISnowPelletsRemark, type ISunshineDurationRemark, type ISurfaceVisibilityRemark, type ITAF, type ITAFDated, type ITafGroups, type ITemperature, type ITemperatureDated, type IThunderStormLocationMovingRemark, type IThunderStormLocationRemark, type ITime, type ITornadicActivityBegEndRemark, type ITornadicActivityBegRemark, type ITornadicActivityEndRemark, type ITowerVisibilityRemark, type ITurbulence, type IUnknownRemark, type IValidity, type IValidityDated, type IVariableSkyHeightRemark, type IVariableSkyRemark, type IVirgaDirectionRemark, type IWaterEquivalentSnowRemark, type IWeatherCondition, type IWind, type IWindPeakCommandRemark, type IWindShear, type IWindShiftFropaRemark, IcingIntensity, Intensity, InvalidWeatherStatementError, type Locale, MetarType, ParseError, PartialWeatherStatementError, Phenomenon, type Remark, RemarkType, type RunwayInfo, RunwayInfoTrend, RunwayInfoUnit, SpeedUnit, type TAFTrend, type TAFTrendDated, TimeIndicator, TimestampOutOfBoundsError, TurbulenceIntensity, UnexpectedParseError, ValueIndicator, type Visibility, WeatherChangeType, getCompositeForecastForDate, isWeatherConditionValid, parseMetar, parseTAF, parseTAFAsForecast };
@@ -14,12 +14,26 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
14
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
15
  PERFORMANCE OF THIS SOFTWARE.
16
16
  ***************************************************************************** */
17
+ /* global Reflect, Promise, SuppressedError, Symbol */
18
+
17
19
 
18
20
  function __classPrivateFieldGet(receiver, state, kind, f) {
19
21
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
20
22
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
21
23
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
22
- }
24
+ }
25
+
26
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
27
+ if (kind === "m") throw new TypeError("Private method is not writable");
28
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
29
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
30
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
31
+ }
32
+
33
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
34
+ var e = new Error(message);
35
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
36
+ };
23
37
 
24
38
  class ParseError extends Error {
25
39
  constructor(message) {
@@ -561,6 +575,13 @@ var DepositType;
561
575
  })(DepositType || (DepositType = {}));
562
576
  var DepositCoverage;
563
577
  (function (DepositCoverage) {
578
+ /**
579
+ * Only reported by certain countries (e.g. Russia)
580
+ */
581
+ DepositCoverage["None"] = "0";
582
+ /**
583
+ * Not reported (e.g. due to rwy clearance in progress)
584
+ */
564
585
  DepositCoverage["NotReported"] = "/";
565
586
  DepositCoverage["Less10"] = "1";
566
587
  DepositCoverage["From11To25"] = "2";
@@ -2029,7 +2050,7 @@ class MainVisibilityNauticalMilesCommand {
2029
2050
  }
2030
2051
  }
2031
2052
  _MainVisibilityNauticalMilesCommand_regex = new WeakMap();
2032
- class CommandSupplier$2 {
2053
+ let CommandSupplier$2 = class CommandSupplier {
2033
2054
  constructor() {
2034
2055
  _CommandSupplier_commands$2.set(this, [
2035
2056
  new WindShearCommand(),
@@ -2048,7 +2069,7 @@ class CommandSupplier$2 {
2048
2069
  return command;
2049
2070
  }
2050
2071
  }
2051
- }
2072
+ };
2052
2073
  _CommandSupplier_commands$2 = new WeakMap();
2053
2074
 
2054
2075
  var _AltimeterCommand_regex;
@@ -2174,7 +2195,7 @@ class TemperatureCommand {
2174
2195
  _TemperatureCommand_regex = new WeakMap();
2175
2196
 
2176
2197
  var _CommandSupplier_commands$1;
2177
- class CommandSupplier$1 {
2198
+ let CommandSupplier$1 = class CommandSupplier {
2178
2199
  constructor() {
2179
2200
  _CommandSupplier_commands$1.set(this, [
2180
2201
  new RunwayCommand(),
@@ -2189,7 +2210,7 @@ class CommandSupplier$1 {
2189
2210
  return command;
2190
2211
  }
2191
2212
  }
2192
- }
2213
+ };
2193
2214
  _CommandSupplier_commands$1 = new WeakMap();
2194
2215
 
2195
2216
  var _IcingCommand_regex;
@@ -2252,7 +2273,7 @@ class CommandSupplier {
2252
2273
  }
2253
2274
  _CommandSupplier_commands = new WeakMap();
2254
2275
 
2255
- var _AbstractParser_INTENSITY_REGEX, _AbstractParser_CAVOK, _AbstractParser_commonSupplier, _MetarParser_commandSupplier, _TAFParser_commandSupplier, _TAFParser_validityPattern, _TAFParser_partialPattern, _RemarkParser_supplier;
2276
+ var _a, _AbstractParser_TOKENIZE_REGEX, _AbstractParser_INTENSITY_REGEX, _AbstractParser_CAVOK, _AbstractParser_commonSupplier, _MetarParser_commandSupplier, _TAFParser_commandSupplier, _TAFParser_validityPattern, _TAFParser_partialPattern, _RemarkParser_supplier;
2256
2277
  function isStation(stationString) {
2257
2278
  return stationString.length === 4;
2258
2279
  }
@@ -2355,16 +2376,11 @@ class AbstractParser {
2355
2376
  this.INTER = "INTER";
2356
2377
  this.BECMG = "BECMG";
2357
2378
  this.RMK = "RMK";
2358
- // Safari does not currently support negative lookbehind
2359
- // #TOKENIZE_REGEX = /\s((?=\d\/\dSM)(?<!\s\d\s)|(?!\d\/\dSM))|=/;
2360
- _AbstractParser_INTENSITY_REGEX.set(this, /^(-|\+|VC)/);
2361
- _AbstractParser_CAVOK.set(this, "CAVOK");
2362
- _AbstractParser_commonSupplier.set(this, new CommandSupplier$2());
2363
2379
  }
2364
2380
  parseWeatherCondition(input) {
2365
2381
  let intensity;
2366
- if (input.match(__classPrivateFieldGet(this, _AbstractParser_INTENSITY_REGEX, "f"))) {
2367
- const match = input.match(__classPrivateFieldGet(this, _AbstractParser_INTENSITY_REGEX, "f"))?.[0];
2382
+ if (input.match(__classPrivateFieldGet(_a, _a, "f", _AbstractParser_INTENSITY_REGEX))) {
2383
+ const match = input.match(__classPrivateFieldGet(_a, _a, "f", _AbstractParser_INTENSITY_REGEX))?.[0];
2368
2384
  if (match) {
2369
2385
  intensity = match;
2370
2386
  input = input.slice(match.length);
@@ -2413,22 +2429,7 @@ class AbstractParser {
2413
2429
  * @returns List of tokens
2414
2430
  */
2415
2431
  tokenize(input) {
2416
- // Missing safari support. If added in the future, put this back
2417
- // return input.split(this.#TOKENIZE_REGEX).filter((v) => v);
2418
- // Hack for safari below...
2419
- const splitRegex = /\s|=/;
2420
- const smRegex = /^\d\/\dSM$/;
2421
- const digitRegex = /^(P|M)?\d$/;
2422
- // return input.split(this.#TOKENIZE_REGEX).filter((v) => v);
2423
- const splitted = input.split(splitRegex);
2424
- for (let i = 0; i < splitted.length; i++) {
2425
- if (digitRegex.test(splitted[i])) {
2426
- if (splitted[i + 1] && smRegex.test(splitted[i + 1])) {
2427
- splitted.splice(i, 2, `${splitted[i]} ${splitted[i + 1]}`);
2428
- }
2429
- }
2430
- }
2431
- return splitted.filter((t) => t);
2432
+ return input.split(__classPrivateFieldGet(_a, _a, "f", _AbstractParser_TOKENIZE_REGEX)).filter((v) => v);
2432
2433
  }
2433
2434
  /**
2434
2435
  * Common parse method for METAR, TAF and trends object
@@ -2437,7 +2438,7 @@ class AbstractParser {
2437
2438
  * @returns True if the token was parsed false otherwise
2438
2439
  */
2439
2440
  generalParse(abstractWeatherContainer, input) {
2440
- if (input === __classPrivateFieldGet(this, _AbstractParser_CAVOK, "f")) {
2441
+ if (input === __classPrivateFieldGet(_a, _a, "f", _AbstractParser_CAVOK)) {
2441
2442
  abstractWeatherContainer.cavok = true;
2442
2443
  abstractWeatherContainer.visibility = {
2443
2444
  indicator: ValueIndicator.GreaterThan,
@@ -2451,7 +2452,7 @@ class AbstractParser {
2451
2452
  abstractWeatherContainer.weatherConditions.push(weatherCondition);
2452
2453
  return true;
2453
2454
  }
2454
- const command = __classPrivateFieldGet(this, _AbstractParser_commonSupplier, "f").get(input);
2455
+ const command = __classPrivateFieldGet(_a, _a, "f", _AbstractParser_commonSupplier).get(input);
2455
2456
  if (command) {
2456
2457
  try {
2457
2458
  return command.execute(abstractWeatherContainer, input);
@@ -2465,7 +2466,11 @@ class AbstractParser {
2465
2466
  return false;
2466
2467
  }
2467
2468
  }
2468
- _AbstractParser_INTENSITY_REGEX = new WeakMap(), _AbstractParser_CAVOK = new WeakMap(), _AbstractParser_commonSupplier = new WeakMap();
2469
+ _a = AbstractParser;
2470
+ _AbstractParser_TOKENIZE_REGEX = { value: /\s((?=\d\/\dSM)(?<!\s(P|M)?\d\s)|(?!\d\/\dSM))|=/ };
2471
+ _AbstractParser_INTENSITY_REGEX = { value: /^(-|\+|VC)/ };
2472
+ _AbstractParser_CAVOK = { value: "CAVOK" };
2473
+ _AbstractParser_commonSupplier = { value: new CommandSupplier$2() };
2469
2474
  class MetarParser extends AbstractParser {
2470
2475
  constructor() {
2471
2476
  super(...arguments);
@@ -2820,7 +2825,8 @@ _TAFParser_commandSupplier = new WeakMap(), _TAFParser_validityPattern = new Wea
2820
2825
  class RemarkParser {
2821
2826
  constructor(locale) {
2822
2827
  this.locale = locale;
2823
- _RemarkParser_supplier.set(this, new RemarkCommandSupplier(this.locale));
2828
+ _RemarkParser_supplier.set(this, void 0);
2829
+ __classPrivateFieldSet(this, _RemarkParser_supplier, new RemarkCommandSupplier(this.locale), "f");
2824
2830
  }
2825
2831
  parse(code) {
2826
2832
  let rmkStr = code;
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "metar-taf-parser",
3
- "version": "8.0.5",
3
+ "version": "9.0.1",
4
4
  "description": "Parse METAR and TAF reports",
5
5
  "homepage": "https://aeharding.github.io/metar-taf-parser",
6
+ "packageManager": "pnpm@9.0.6+sha256.0624e30eff866cdeb363b15061bdb7fd9425b17bc1bb42c22f5f4efdea21f6b3",
6
7
  "keywords": [
7
8
  "aviation",
8
9
  "weather",
@@ -22,36 +23,39 @@
22
23
  },
23
24
  "scripts": {
24
25
  "clean": "rimraf dist locale metar-taf-parser.*",
25
- "build": "yarn clean && rollup -c rollup.config.ts && cp -R dist/locale/. locale/ && cp dist/metar-taf-parser.js metar-taf-parser.js && yarn clean:after",
26
+ "build": "pnpm clean && rollup -c rollup.config.ts --configPlugin typescript && cp -R dist/locale/. locale/ && cp dist/metar-taf-parser.js metar-taf-parser.js && pnpm clean:after",
26
27
  "clean:after": "rimraf dist",
27
- "start": "rollup -c rollup.config.ts -w",
28
+ "start": "rollup -c rollup.config.ts -w --configPlugin typescript",
28
29
  "check-types": "tsc --skipLibCheck --noEmit",
29
30
  "check-formatting": "prettier --check '**/*.{js,json,css,md,scss,tsx,ts}'",
30
- "watch": "watch 'yarn build' src",
31
+ "watch": "watch 'pnpm build' src",
31
32
  "test": "jest --coverage",
32
33
  "test-watch": "jest --watch --coverage",
33
- "prepublishOnly": "yarn clean && yarn build"
34
+ "prepublishOnly": "pnpm clean && pnpm build",
35
+ "upgrade:packageManager": "corepack use pnpm@latest"
34
36
  },
35
37
  "files": [
36
38
  "locale",
37
39
  "metar-taf-parser.*"
38
40
  ],
39
41
  "devDependencies": {
40
- "@babel/preset-env": "^7.17.10",
41
- "@babel/preset-typescript": "^7.16.7",
42
- "@rollup/plugin-typescript": "^8.3.2",
43
- "@types/jest": "^27.5.0",
44
- "@types/lodash": "^4.14.182",
45
- "jest": "^28",
42
+ "@babel/preset-env": "^7.24.5",
43
+ "@babel/preset-typescript": "^7.24.1",
44
+ "@rollup/plugin-typescript": "^11.1.6",
45
+ "@types/jest": "^29.5.12",
46
+ "@types/lodash": "^4.17.1",
47
+ "@types/node": "^20.12.8",
48
+ "jest": "^29.7.0",
46
49
  "lodash": "^4.17.21",
47
- "prettier": "^2.6.2",
48
- "rollup": "^2.71.1",
49
- "rollup-plugin-dts": "^4.2.1",
50
- "ts-jest": "^28.0.1",
51
- "ts-node": "^10.7.0",
52
- "tsc-alias": "^1.6.7",
53
- "tslib": "^2.4.0",
54
- "typescript": "^4.6.4",
50
+ "prettier": "^3.2.5",
51
+ "rimraf": "^5.0.5",
52
+ "rollup": "^4.17.2",
53
+ "rollup-plugin-dts": "^6.1.0",
54
+ "ts-jest": "^29.1.2",
55
+ "ts-node": "^10.9.2",
56
+ "tsc-alias": "^1.8.8",
57
+ "tslib": "^2.6.2",
58
+ "typescript": "^5.4.5",
55
59
  "watch": "^1.0.2"
56
60
  }
57
61
  }