@hebcal/icalendar 6.3.2 → 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,5 @@
1
- import { CalOptions, Event } from '@hebcal/core';
1
+ import { Event } from '@hebcal/core/dist/esm/event';
2
+ import { CalOptions } from '@hebcal/core/dist/esm/CalOptions';
2
3
  export type ICalEventOptions = {
3
4
  dtstamp?: string;
4
5
  sequence?: number;
@@ -1,16 +1,15 @@
1
- /*! @hebcal/icalendar v6.3.2 */
2
- import { flags, Locale, greg } from '@hebcal/core';
1
+ /*! @hebcal/icalendar v6.3.4 */
2
+ import { flags } from '@hebcal/core/dist/esm/event';
3
+ import { Locale } from '@hebcal/core/dist/esm/locale';
3
4
  import { murmur32HexSync } from 'murmurhash3';
4
- import { pad2, pad4 } from '@hebcal/hdate';
5
+ import { pad2, isDate, pad4 } from '@hebcal/hdate';
5
6
  import { shouldRenderBrief, getEventCategories, getCalendarTitle } from '@hebcal/rest-api/dist/esm/common';
6
7
  import { getHolidayDescription } from '@hebcal/rest-api/dist/esm/holiday';
7
8
  import { makeTorahMemoText } from '@hebcal/rest-api/dist/esm/memo';
8
9
  import { appendIsraelAndTracking } from '@hebcal/rest-api/dist/esm/url';
9
10
  import { makeAnchor } from '@hebcal/rest-api/dist/esm/makeAnchor';
10
- import { promises } from 'fs';
11
-
12
- // DO NOT EDIT THIS AUTO-GENERATED FILE!
13
- const version = '6.3.2';
11
+ import { promises } from 'node:fs';
12
+ import { version } from './pkgVersion.js';
14
13
 
15
14
  const vtimezoneCache = new Map();
16
15
  const CATEGORY = {
@@ -77,6 +76,7 @@ class IcalEvent {
77
76
  const opts = Object.assign({}, options);
78
77
  this.options = opts;
79
78
  this.dtstamp = opts.dtstamp || IcalEvent.makeDtstamp(new Date());
79
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
80
  const ev0 = ev;
81
81
  if (typeof ev0.sequence === 'number') {
82
82
  this.sequence = ev0.sequence;
@@ -159,7 +159,7 @@ class IcalEvent {
159
159
  else if (typeof evAlarm === 'boolean' && !evAlarm) {
160
160
  return null;
161
161
  }
162
- else if (greg.isDate(evAlarm)) {
162
+ else if (isDate(evAlarm)) {
163
163
  const alarmDt = evAlarm;
164
164
  alarmDt.setSeconds(0);
165
165
  return 'TRIGGER;VALUE=DATE-TIME:' + IcalEvent.makeDtstamp(alarmDt);
@@ -299,11 +299,11 @@ class IcalEvent {
299
299
  return result + current;
300
300
  }
301
301
  static escape(str) {
302
- if (str.indexOf(',') !== -1) {
303
- str = str.replace(/,/g, '\\,');
302
+ if (str.includes(',')) {
303
+ str = str.replaceAll(',', '\\,');
304
304
  }
305
- if (str.indexOf(';') !== -1) {
306
- str = str.replace(/;/g, '\\;');
305
+ if (str.includes(';')) {
306
+ str = str.replaceAll(';', '\\;');
307
307
  }
308
308
  return str;
309
309
  }
@@ -341,10 +341,13 @@ const HOLIDAY_IGNORE_MASK = DAILY_LEARNING |
341
341
  flags.MOLAD |
342
342
  flags.USER_EVENT |
343
343
  flags.HEBREW_DATE;
344
+ const ESC_NEWLINE = String.raw `\n`;
345
+ const DBL_NEWLINE = ESC_NEWLINE + ESC_NEWLINE;
344
346
  /**
345
347
  * @private
346
348
  */
347
349
  function makeTorahMemo(ev, il) {
350
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
348
351
  if (ev.getFlags() & HOLIDAY_IGNORE_MASK || ev.eventTime) {
349
352
  return '';
350
353
  }
@@ -357,7 +360,7 @@ function makeTorahMemo(ev, il) {
357
360
  if (typeof memo === 'string') {
358
361
  return memo;
359
362
  }
360
- memo = makeTorahMemoText(ev, il).replace(/\n/g, '\\n');
363
+ memo = makeTorahMemoText(ev, il).replaceAll('\n', ESC_NEWLINE);
361
364
  torahMemoCache.set(key, memo);
362
365
  return memo;
363
366
  }
@@ -366,8 +369,8 @@ function makeTorahMemo(ev, il) {
366
369
  */
367
370
  function createMemo(ev, options) {
368
371
  let memo = ev.memo || '';
369
- if (memo.length && memo.indexOf('\n') !== -1) {
370
- memo = memo.replace(/\n/g, '\\n');
372
+ if (memo.length && memo.includes('\n')) {
373
+ memo = memo.replaceAll('\n', ESC_NEWLINE);
371
374
  }
372
375
  const desc = ev.getDesc();
373
376
  if (desc === 'Havdalah' || desc === 'Candle lighting') {
@@ -380,33 +383,34 @@ function createMemo(ev, options) {
380
383
  omerEv.sefira('en'),
381
384
  omerEv.sefira('he'),
382
385
  omerEv.sefira('translit'),
383
- ].join('\\n');
386
+ ].join(ESC_NEWLINE);
384
387
  return (omerEv.getTodayIs('en') +
385
- '\\n\\n' +
388
+ DBL_NEWLINE +
386
389
  omerEv.getTodayIs('he') +
387
- '\\n\\n' +
390
+ DBL_NEWLINE +
388
391
  sefira);
389
392
  }
390
393
  if (!memo) {
391
394
  memo = getHolidayDescription(ev);
392
395
  }
393
396
  if (!memo) {
397
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
394
398
  const linkEv = ev.linkedEvent;
395
- if (typeof linkEv !== 'undefined' && linkEv.getDesc() !== ev.getDesc()) {
399
+ if (linkEv && linkEv.getDesc() !== ev.getDesc()) {
396
400
  memo = linkEv.render(options.locale);
397
401
  }
398
402
  }
399
403
  const torahMemo = makeTorahMemo(ev, options.il);
400
404
  if (torahMemo) {
401
405
  if (memo.length) {
402
- memo += '\\n\\n';
406
+ memo += DBL_NEWLINE;
403
407
  }
404
408
  memo += torahMemo;
405
409
  }
406
410
  const url = appendTrackingToUrl(ev.url(), options);
407
411
  if (url) {
408
412
  if (memo.length) {
409
- memo += '\\n\\n';
413
+ memo += DBL_NEWLINE;
410
414
  }
411
415
  memo += url;
412
416
  }
@@ -505,7 +509,7 @@ async function icalEventsToString(icals, options) {
505
509
  stream.push('\r\n');
506
510
  vtimezoneCache.set(tzid, str);
507
511
  }
508
- catch (error) {
512
+ catch (_a) {
509
513
  // ignore failure when no timezone definition to read
510
514
  }
511
515
  }
@@ -1 +1 @@
1
- export declare const version = "6.3.2";
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.2",
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
  }