rrule-rust 2.0.2-next.1 → 2.0.3-next.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
@@ -12,12 +12,20 @@
12
12
 
13
13
  ## Quick Start
14
14
 
15
- See [test folder](https://github.com/lsndr/rrule-rust/tree/master/tests) to find more use cases
16
-
17
15
  ```
18
16
  npm i rrule-rust
19
17
  ```
20
18
 
19
+ If you need browser-compatible version with wasm support, install it from `alpha` channel:
20
+
21
+ ```
22
+ npm i rrule-rust@alpha
23
+ ```
24
+
25
+ Wasm package is distributed via `alpha` channel because it is based on alpha version of [napi.rs](https://napi.rs/). Once [napi.rs](https://napi.rs/) v3 get released, we will add wasm support to `latest` channel.
26
+
27
+ See [test folder](https://github.com/lsndr/rrule-rust/tree/master/tests) to find more use cases
28
+
21
29
  ```typescript
22
30
  import { RRule, RRuleSet, Frequency, DateTime } from 'rrule-rust';
23
31
 
@@ -39,7 +39,7 @@ export enum Weekday {
39
39
  Saturday = 5,
40
40
  Sunday = 6
41
41
  }
42
- export class RRule {
42
+ export declare class RRule {
43
43
  constructor(frequency: Frequency, interval?: number | undefined | null, count?: number | undefined | null, weekstart?: Weekday | undefined | null, until?: number | undefined | null, byWeekday?: (readonly (NWeekday | Weekday)[]) | undefined | null, byHour?: (readonly number[]) | undefined | null, byMinute?: (readonly number[]) | undefined | null, bySecond?: (readonly number[]) | undefined | null, byMonthday?: (readonly number[]) | undefined | null, bySetpos?: (readonly number[]) | undefined | null, byMonth?: (readonly number[]) | undefined | null, byWeekno?: (readonly number[]) | undefined | null, byYearday?: (readonly number[]) | undefined | null)
44
44
  static parse(str: string): RRule
45
45
  get frequency(): Frequency
@@ -58,7 +58,7 @@ export class RRule {
58
58
  get until(): number | null
59
59
  toString(): string
60
60
  }
61
- export class RRuleSet {
61
+ export declare class RRuleSet {
62
62
  constructor(dtstart: number, tzid?: string | undefined | null, rrules?: (readonly RRule[]) | undefined | null, exrules?: (readonly RRule[]) | undefined | null, exdates?: (readonly number[]) | undefined | null, rdates?: (readonly number[]) | undefined | null)
63
63
  get tzid(): string | null
64
64
  get dtstart(): number
@@ -73,9 +73,6 @@ export class RRuleSet {
73
73
  toString(): string
74
74
  iterator(): RRuleSetIterator
75
75
  }
76
- export class RRuleSetIterator {
77
- iterator(): RRuleSetIteratorIterable
78
- }
79
- export class RRuleSetIteratorIterable {
76
+ export declare class RRuleSetIterator {
80
77
  next(): number | null
81
78
  }
package/dist/lib/index.js CHANGED
@@ -310,12 +310,11 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { Frequency, Month, RRule, RRuleSet, RRuleSetIterator, RRuleSetIteratorIterable, Weekday } = nativeBinding
313
+ const { Frequency, Month, RRule, RRuleSet, RRuleSetIterator, Weekday } = nativeBinding
314
314
 
315
315
  module.exports.Frequency = Frequency
316
316
  module.exports.Month = Month
317
317
  module.exports.RRule = RRule
318
318
  module.exports.RRuleSet = RRuleSet
319
319
  module.exports.RRuleSetIterator = RRuleSetIterator
320
- module.exports.RRuleSetIteratorIterable = RRuleSetIteratorIterable
321
320
  module.exports.Weekday = Weekday
@@ -15,7 +15,7 @@ export declare class RRuleSet implements Iterable<DateTime> {
15
15
  readonly exrules: readonly RRule[];
16
16
  readonly exdates: readonly DateTime[];
17
17
  readonly rdates: readonly DateTime[];
18
- constructor(dtstart: DateTime, tzid: string | undefined);
18
+ constructor(dtstart: DateTime, tzid?: string);
19
19
  constructor(options: Partial<RRuleSetLike>);
20
20
  /**
21
21
  * Parses a string into an RRuleSet.
@@ -56,13 +56,5 @@ export declare class RRuleSet implements Iterable<DateTime> {
56
56
  * Converts the RRuleSet to a plain object.
57
57
  */
58
58
  toObject(): RRuleSetLike;
59
- [Symbol.iterator](): {
60
- next: () => {
61
- done: true;
62
- value: undefined;
63
- } | {
64
- done: boolean;
65
- value: DateTime;
66
- };
67
- };
59
+ [Symbol.iterator](): Iterator<DateTime, any, any>;
68
60
  }
package/dist/rrule-set.js CHANGED
@@ -148,9 +148,7 @@ class RRuleSet {
148
148
  * @internal
149
149
  */
150
150
  toRust() {
151
- if (!this.rust) {
152
- this.rust = new lib_1.RRuleSet(this.dtstart.toNumeric(), this.tzid, this.rrules.map((rrule) => rrule.toRust()), this.exrules.map((rrule) => rrule.toRust()), this.exdates.map((datetime) => datetime.toNumeric()), this.rdates.map((datetime) => datetime.toNumeric()));
153
- }
151
+ this.rust ??= new lib_1.RRuleSet(this.dtstart.toNumeric(), this.tzid, this.rrules.map((rrule) => rrule.toRust()), this.exrules.map((rrule) => rrule.toRust()), this.exdates.map((datetime) => datetime.toNumeric()), this.rdates.map((datetime) => datetime.toNumeric()));
154
152
  return this.rust;
155
153
  }
156
154
  toString() {
@@ -170,7 +168,7 @@ class RRuleSet {
170
168
  };
171
169
  }
172
170
  [Symbol.iterator]() {
173
- const iter = this.toRust().iterator().iterator();
171
+ const iter = this.toRust().iterator();
174
172
  return {
175
173
  next: () => {
176
174
  const result = iter.next();
package/dist/rrule.js CHANGED
@@ -84,7 +84,7 @@ class RRule {
84
84
  frequency: rust.frequency,
85
85
  interval: rust.interval ?? undefined,
86
86
  until: rust.until === null ? undefined : datetime_1.DateTime.fromNumeric(rust.until),
87
- count: rust.count === null ? undefined : rust.count,
87
+ count: rust.count ?? undefined,
88
88
  byWeekday: rust.byWeekday,
89
89
  byHour: rust.byHour,
90
90
  byMinute: rust.byMinute,
@@ -148,9 +148,7 @@ class RRule {
148
148
  * @internal
149
149
  */
150
150
  toRust() {
151
- if (!this.rust) {
152
- this.rust = new lib_1.RRule(this.frequency, this.interval, this.count, this.weekstart, this.until?.toNumeric(), this.byWeekday, this.byHour, this.byMinute, this.bySecond, this.byMonthday, this.bySetpos, this.byMonth, this.byWeekno, this.byYearday);
153
- }
151
+ this.rust ??= new lib_1.RRule(this.frequency, this.interval, this.count, this.weekstart, this.until?.toNumeric(), this.byWeekday, this.byHour, this.byMinute, this.bySecond, this.byMonthday, this.bySetpos, this.byMonth, this.byWeekno, this.byYearday);
154
152
  return this.rust;
155
153
  }
156
154
  toObject() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrule-rust",
3
- "version": "2.0.2-next.1",
3
+ "version": "2.0.3-next.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "keywords": [
@@ -43,33 +43,34 @@
43
43
  "devDependencies": {
44
44
  "@commitlint/cli": "^19.3.0",
45
45
  "@commitlint/config-conventional": "^19.2.2",
46
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
47
+ "@eslint/compat": "^1.2.9",
48
+ "@eslint/js": "^9.27.0",
46
49
  "@napi-rs/cli": "^2.18.2",
47
50
  "@semantic-release/git": "^10.0.1",
48
51
  "@types/jest": "^29.5.0",
49
52
  "@types/luxon": "^3.4.2",
50
- "@types/node": "^20.12.8",
51
- "@typescript-eslint/eslint-plugin": "^7.12.0",
52
- "@typescript-eslint/parser": "^7.12.0",
53
+ "@types/node": "^22.1.0",
53
54
  "benny": "^3.7.1",
54
55
  "conventional-changelog-conventionalcommits": "^7.0.2",
55
56
  "cpy-cli": "^5.0.0",
56
57
  "cross-env": "^7.0.3",
57
- "eslint": "^8.57.0",
58
- "eslint-config-prettier": "^9.1.0",
59
- "eslint-plugin-eslint-comments": "^3.2.0",
60
- "eslint-plugin-import": "^2.29.1",
61
- "eslint-plugin-json": "^3.1.0",
58
+ "eslint": "^9.27.0",
59
+ "eslint-config-prettier": "^10.1.5",
60
+ "eslint-import-resolver-typescript": "^4.3.5",
61
+ "eslint-plugin-import-x": "^4.12.2",
62
62
  "husky": "^9.0.11",
63
63
  "jest": "^29.5.0",
64
64
  "luxon": "^3.4.4",
65
65
  "mkdirp": "^3.0.1",
66
- "prettier": "^2.8.3",
67
- "rimraf": "^5.0.5",
66
+ "prettier": "^3.5.3",
67
+ "rimraf": "^6.0.1",
68
68
  "rrule": "^2.7.2",
69
69
  "semantic-release": "^23.0.8",
70
70
  "ts-jest": "^29.0.5",
71
71
  "ts-node": "^10.9.1",
72
- "typescript": "^5.4.5"
72
+ "typescript": "^5.4.5",
73
+ "typescript-eslint": "^8.32.1"
73
74
  },
74
75
  "engines": {
75
76
  "node": ">= 10"
@@ -79,6 +80,7 @@
79
80
  "build:lib": "napi build --no-const-enum --platform --release src/lib",
80
81
  "prebuild": "rimraf ./dist && npm run build:lib",
81
82
  "build": "tsc -p ./tsconfig.build.json",
83
+ "build:tests": "tsc -p ./tsconfig.test.json",
82
84
  "postbuild": "cpy ./src/lib/* ./dist/lib --flat",
83
85
  "prepublishOnly": "napi prepublish -t npm",
84
86
  "test": "cross-env TZ=Europe/Moscow jest --testPathIgnorePatterns=\\.e2e\\.spec\\.ts",
@@ -88,26 +90,26 @@
88
90
  "benchmark": "ts-node ./benchmark/index.ts",
89
91
  "format": "cargo fmt --all --check && prettier --check .",
90
92
  "format:fix": "cargo fmt --all && prettier --write .",
91
- "lint": "eslint \"**/*.{js,ts,json}\" --max-warnings=0",
93
+ "lint": "eslint --max-warnings=0",
92
94
  "lint:fix": "npm run lint -- --fix",
93
95
  "prepare": "husky && npm run build"
94
96
  },
95
97
  "optionalDependencies": {
96
- "@rrule-rust/lib-win32-x64-msvc": "2.0.2-next.1",
97
- "@rrule-rust/lib-darwin-x64": "2.0.2-next.1",
98
- "@rrule-rust/lib-linux-x64-gnu": "2.0.2-next.1",
99
- "@rrule-rust/lib-darwin-arm64": "2.0.2-next.1",
100
- "@rrule-rust/lib-android-arm64": "2.0.2-next.1",
101
- "@rrule-rust/lib-linux-arm64-gnu": "2.0.2-next.1",
102
- "@rrule-rust/lib-linux-arm64-musl": "2.0.2-next.1",
103
- "@rrule-rust/lib-win32-arm64-msvc": "2.0.2-next.1",
104
- "@rrule-rust/lib-linux-arm-gnueabihf": "2.0.2-next.1",
105
- "@rrule-rust/lib-linux-arm-musleabihf": "2.0.2-next.1",
106
- "@rrule-rust/lib-linux-x64-musl": "2.0.2-next.1",
107
- "@rrule-rust/lib-freebsd-x64": "2.0.2-next.1",
108
- "@rrule-rust/lib-win32-ia32-msvc": "2.0.2-next.1",
109
- "@rrule-rust/lib-android-arm-eabi": "2.0.2-next.1",
110
- "@rrule-rust/lib-darwin-universal": "2.0.2-next.1",
111
- "@rrule-rust/lib-linux-riscv64-gnu": "2.0.2-next.1"
98
+ "@rrule-rust/lib-win32-x64-msvc": "2.0.3-next.1",
99
+ "@rrule-rust/lib-darwin-x64": "2.0.3-next.1",
100
+ "@rrule-rust/lib-linux-x64-gnu": "2.0.3-next.1",
101
+ "@rrule-rust/lib-darwin-arm64": "2.0.3-next.1",
102
+ "@rrule-rust/lib-android-arm64": "2.0.3-next.1",
103
+ "@rrule-rust/lib-linux-arm64-gnu": "2.0.3-next.1",
104
+ "@rrule-rust/lib-linux-arm64-musl": "2.0.3-next.1",
105
+ "@rrule-rust/lib-win32-arm64-msvc": "2.0.3-next.1",
106
+ "@rrule-rust/lib-linux-arm-gnueabihf": "2.0.3-next.1",
107
+ "@rrule-rust/lib-linux-arm-musleabihf": "2.0.3-next.1",
108
+ "@rrule-rust/lib-linux-x64-musl": "2.0.3-next.1",
109
+ "@rrule-rust/lib-freebsd-x64": "2.0.3-next.1",
110
+ "@rrule-rust/lib-win32-ia32-msvc": "2.0.3-next.1",
111
+ "@rrule-rust/lib-android-arm-eabi": "2.0.3-next.1",
112
+ "@rrule-rust/lib-darwin-universal": "2.0.3-next.1",
113
+ "@rrule-rust/lib-linux-riscv64-gnu": "2.0.3-next.1"
112
114
  }
113
115
  }