@hebcal/icalendar 6.3.3 → 6.3.4

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.
@@ -1,4 +1,4 @@
1
- /*! @hebcal/icalendar v6.3.3 */
1
+ /*! @hebcal/icalendar v6.3.4 */
2
2
  import { flags } from '@hebcal/core/dist/esm/event';
3
3
  import { Locale } from '@hebcal/core/dist/esm/locale';
4
4
  import { murmur32HexSync } from 'murmurhash3';
@@ -8,10 +8,8 @@ import { getHolidayDescription } from '@hebcal/rest-api/dist/esm/holiday';
8
8
  import { makeTorahMemoText } from '@hebcal/rest-api/dist/esm/memo';
9
9
  import { appendIsraelAndTracking } from '@hebcal/rest-api/dist/esm/url';
10
10
  import { makeAnchor } from '@hebcal/rest-api/dist/esm/makeAnchor';
11
- import { promises } from 'fs';
12
-
13
- // DO NOT EDIT THIS AUTO-GENERATED FILE!
14
- const version = '6.3.3';
11
+ import { promises } from 'node:fs';
12
+ import { version } from './pkgVersion.js';
15
13
 
16
14
  const vtimezoneCache = new Map();
17
15
  const CATEGORY = {
@@ -78,6 +76,7 @@ class IcalEvent {
78
76
  const opts = Object.assign({}, options);
79
77
  this.options = opts;
80
78
  this.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
79
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
80
  const ev0 = ev;
82
81
  if (typeof ev0.sequence === 'number') {
83
82
  this.sequence = ev0.sequence;
@@ -300,11 +299,11 @@ class IcalEvent {
300
299
  return result + current;
301
300
  }
302
301
  static escape(str) {
303
- if (str.indexOf(',') !== -1) {
304
- str = str.replace(/,/g, '\\,');
302
+ if (str.includes(',')) {
303
+ str = str.replaceAll(',', '\\,');
305
304
  }
306
- if (str.indexOf(';') !== -1) {
307
- str = str.replace(/;/g, '\\;');
305
+ if (str.includes(';')) {
306
+ str = str.replaceAll(';', '\\;');
308
307
  }
309
308
  return str;
310
309
  }
@@ -342,10 +341,13 @@ const HOLIDAY_IGNORE_MASK = DAILY_LEARNING |
342
341
  flags.MOLAD |
343
342
  flags.USER_EVENT |
344
343
  flags.HEBREW_DATE;
344
+ const ESC_NEWLINE = String.raw `\n`;
345
+ const DBL_NEWLINE = ESC_NEWLINE + ESC_NEWLINE;
345
346
  /**
346
347
  * @private
347
348
  */
348
349
  function makeTorahMemo(ev, il) {
350
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
349
351
  if (ev.getFlags() & HOLIDAY_IGNORE_MASK || ev.eventTime) {
350
352
  return '';
351
353
  }
@@ -358,7 +360,7 @@ function makeTorahMemo(ev, il) {
358
360
  if (typeof memo === 'string') {
359
361
  return memo;
360
362
  }
361
- memo = makeTorahMemoText(ev, il).replace(/\n/g, '\\n');
363
+ memo = makeTorahMemoText(ev, il).replaceAll('\n', ESC_NEWLINE);
362
364
  torahMemoCache.set(key, memo);
363
365
  return memo;
364
366
  }
@@ -367,8 +369,8 @@ function makeTorahMemo(ev, il) {
367
369
  */
368
370
  function createMemo(ev, options) {
369
371
  let memo = ev.memo || '';
370
- if (memo.length && memo.indexOf('\n') !== -1) {
371
- memo = memo.replace(/\n/g, '\\n');
372
+ if (memo.length && memo.includes('\n')) {
373
+ memo = memo.replaceAll('\n', ESC_NEWLINE);
372
374
  }
373
375
  const desc = ev.getDesc();
374
376
  if (desc === 'Havdalah' || desc === 'Candle lighting') {
@@ -381,33 +383,34 @@ function createMemo(ev, options) {
381
383
  omerEv.sefira('en'),
382
384
  omerEv.sefira('he'),
383
385
  omerEv.sefira('translit'),
384
- ].join('\\n');
386
+ ].join(ESC_NEWLINE);
385
387
  return (omerEv.getTodayIs('en') +
386
- '\\n\\n' +
388
+ DBL_NEWLINE +
387
389
  omerEv.getTodayIs('he') +
388
- '\\n\\n' +
390
+ DBL_NEWLINE +
389
391
  sefira);
390
392
  }
391
393
  if (!memo) {
392
394
  memo = getHolidayDescription(ev);
393
395
  }
394
396
  if (!memo) {
397
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
395
398
  const linkEv = ev.linkedEvent;
396
- if (typeof linkEv !== 'undefined' && linkEv.getDesc() !== ev.getDesc()) {
399
+ if (linkEv && linkEv.getDesc() !== ev.getDesc()) {
397
400
  memo = linkEv.render(options.locale);
398
401
  }
399
402
  }
400
403
  const torahMemo = makeTorahMemo(ev, options.il);
401
404
  if (torahMemo) {
402
405
  if (memo.length) {
403
- memo += '\\n\\n';
406
+ memo += DBL_NEWLINE;
404
407
  }
405
408
  memo += torahMemo;
406
409
  }
407
410
  const url = appendTrackingToUrl(ev.url(), options);
408
411
  if (url) {
409
412
  if (memo.length) {
410
- memo += '\\n\\n';
413
+ memo += DBL_NEWLINE;
411
414
  }
412
415
  memo += url;
413
416
  }
@@ -506,7 +509,7 @@ async function icalEventsToString(icals, options) {
506
509
  stream.push('\r\n');
507
510
  vtimezoneCache.set(tzid, str);
508
511
  }
509
- catch (error) {
512
+ catch (_a) {
510
513
  // ignore failure when no timezone definition to read
511
514
  }
512
515
  }
@@ -1 +1 @@
1
- export declare const version = "6.3.3";
1
+ export declare const version = "6.3.4";
@@ -0,0 +1,5 @@
1
+ /*! @hebcal/icalendar v6.3.4 */
2
+ // DO NOT EDIT THIS AUTO-GENERATED FILE!
3
+ const version = '6.3.4';
4
+
5
+ export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/icalendar",
3
- "version": "6.3.3",
3
+ "version": "6.3.4",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "ical",
@@ -10,13 +10,13 @@
10
10
  ],
11
11
  "description": "Jewish holidays and Hebrew calendar as iCalendar RFC 2445",
12
12
  "type": "module",
13
- "module": "./dist/index.js",
13
+ "module": "./dist/icalendar.js",
14
14
  "typings": "./dist/icalendar.d.ts",
15
15
  "exports": {
16
- ".": "./dist/index.js"
16
+ ".": "./dist/icalendar.js"
17
17
  },
18
18
  "engines": {
19
- "node": ">= 18.0.0"
19
+ "node": ">= 20"
20
20
  },
21
21
  "files": [
22
22
  "dist"
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "homepage": "https://hebcal.github.io/api/icalendar/",
32
32
  "dependencies": {
33
- "@hebcal/core": "^6.0.6",
33
+ "@hebcal/core": "^6.0.8",
34
34
  "@hebcal/hdate": "^0.21.1",
35
35
  "@hebcal/rest-api": "^6.4.0",
36
36
  "murmurhash3": "^0.5.0",
@@ -40,7 +40,6 @@
40
40
  "build:rollup": "rollup -c",
41
41
  "build:version": "node ./version.cjs package.json src/pkgVersion.ts",
42
42
  "build": "npm run build:version && npm run build:rollup",
43
- "prepare": "npm run build",
44
43
  "pretest": "npm run build",
45
44
  "docs": "typedoc",
46
45
  "test": "vitest",
@@ -53,11 +52,11 @@
53
52
  "devDependencies": {
54
53
  "@hebcal/learning": "^6.6.0",
55
54
  "@rollup/plugin-typescript": "^12.3.0",
56
- "@types/node": "24.9.2",
57
- "gts": "^5.3.1",
58
- "rollup": "^4.53.3",
55
+ "@types/node": "25.0.6",
56
+ "gts": "^7.0.0",
57
+ "rollup": "^4.55.1",
59
58
  "typedoc": "^0.28.15",
60
59
  "typescript": "^5.9.3",
61
- "vitest": "^4.0.15"
60
+ "vitest": "^4.0.16"
62
61
  }
63
62
  }