@fable-org/fable-library-js 1.9.0 → 1.11.0

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/Async.d.ts CHANGED
@@ -20,8 +20,7 @@ export declare function ignore<T>(computation: Async<T>): (ctx: IAsyncContext<un
20
20
  export declare function parallel<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<Awaited<T>[]>) => void;
21
21
  export declare function sequential<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<T[]>) => void;
22
22
  export declare function sleep(millisecondsDueTime: number): (ctx: IAsyncContext<void>) => void;
23
- export declare function runSynchronously(): never;
24
23
  export declare function start<T>(computation: Async<T>, cancellationToken?: CancellationToken): void;
25
24
  export declare function startImmediate<T>(computation: Async<T>, cancellationToken?: CancellationToken): void;
26
- export declare function startWithContinuations<T>(computation: Async<T>, continuation?: Continuation<T> | CancellationToken, exceptionContinuation?: Continuation<any>, cancellationContinuation?: Continuation<any>, cancelToken?: CancellationToken): void;
25
+ export declare function startWithContinuations<T>(computation: Async<T>, continuation: Continuation<T>, exceptionContinuation: Continuation<any>, cancellationContinuation: Continuation<any>, cancelToken?: CancellationToken): void;
27
26
  export declare function startAsPromise<T>(computation: Async<T>, cancellationToken?: CancellationToken): Promise<T>;
package/Async.js CHANGED
@@ -124,25 +124,18 @@ export function sleep(millisecondsDueTime) {
124
124
  });
125
125
  });
126
126
  }
127
- export function runSynchronously() {
128
- throw new Error("Asynchronous code cannot be run synchronously in JS");
129
- }
130
127
  export function start(computation, cancellationToken) {
131
- return startWithContinuations(computation, cancellationToken);
128
+ return startWithContinuations(computation, emptyContinuation, function (err) { throw err; }, emptyContinuation, cancellationToken);
132
129
  }
133
130
  export function startImmediate(computation, cancellationToken) {
134
131
  return start(computation, cancellationToken);
135
132
  }
136
133
  export function startWithContinuations(computation, continuation, exceptionContinuation, cancellationContinuation, cancelToken) {
137
- if (typeof continuation !== "function") {
138
- cancelToken = continuation;
139
- continuation = undefined;
140
- }
141
134
  const trampoline = new Trampoline();
142
135
  computation({
143
136
  onSuccess: continuation ? continuation : emptyContinuation,
144
- onError: exceptionContinuation ? exceptionContinuation : emptyContinuation,
145
- onCancel: cancellationContinuation ? cancellationContinuation : emptyContinuation,
137
+ onError: exceptionContinuation,
138
+ onCancel: cancellationContinuation,
146
139
  cancelToken: cancelToken ? cancelToken : defaultCancellationToken,
147
140
  trampoline,
148
141
  });
package/CHANGELOG.md CHANGED
@@ -7,20 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
- ## 1.9.0 - 2025-01-09
11
-
12
- ### Added
13
-
14
- * [JS/TS] Add new `TimSpan` overload support coming from .NET 9 (by @MangelMaxime)
10
+ ## 1.11.0- 2025-04-26
15
11
 
16
12
  ### Fixed
17
13
 
18
- * [JS/TS] Fix `DateTimeOffset.ToLocalTime` (by @MangelMaxime)
19
-
20
- ## 1.8.0 - 2024-11-19
21
-
22
- * [JS/TS] Fix `h` in `DateTime.ToString` (@MangelMaxime)
23
- * [JS/TS] Fix `hh` in `DateTime.ToString` (@MangelMaxime)
14
+ * [JS/TS] Propagate non-captured exception when running `Async.Start` or `Async.StartImmediate` (by @MangelMaxime)
15
+ * [JS/TS] Remove `Async.RunSynchronously` (by @MangelMaxime)
16
+ * [JS/TS] Change signature of `startWithContinuations` to always require all its arguments (by @MangelMaxime)
24
17
 
25
18
  ## 1.7.0 - 2024-11-19
26
19
 
package/Date.js CHANGED
@@ -145,12 +145,10 @@ function dateToStringWithCustomFormat(date, format, utc) {
145
145
  cursorPos += tokenLength;
146
146
  switch (tokenLength) {
147
147
  case 1:
148
- const h1Value = hour(localizedDate) % 12;
149
- result += h1Value ? h1Value : 12;
148
+ result += hour(localizedDate) % 12;
150
149
  break;
151
150
  case 2:
152
- const h2Value = hour(localizedDate) % 12;
153
- result += padWithZeros(h2Value ? h2Value : 12, 2);
151
+ result += padWithZeros(hour(localizedDate) % 12, 2);
154
152
  break;
155
153
  default:
156
154
  break;
package/DateOffset.d.ts CHANGED
@@ -31,7 +31,6 @@ export declare function now(): IDateTimeOffset;
31
31
  export declare function utcNow(): IDateTimeOffset;
32
32
  export declare function toUniversalTime(date: IDateTimeOffset): Date;
33
33
  export declare function toLocalTime(date: IDateTimeOffset): Date;
34
- export declare function localDateTime(date: IDateTimeOffset): Date;
35
34
  export declare function timeOfDay(d: IDateTimeOffset): number;
36
35
  export declare function date(d: IDateTimeOffset): IDateTime;
37
36
  export declare function day(d: IDateTimeOffset): number;
package/DateOffset.js CHANGED
@@ -141,9 +141,6 @@ export function toUniversalTime(date) {
141
141
  return DateTime(date.getTime(), 1 /* DateKind.UTC */);
142
142
  }
143
143
  export function toLocalTime(date) {
144
- return DateTime(date.getTime() + offset(now()), 2 /* DateKind.Local */);
145
- }
146
- export function localDateTime(date) {
147
144
  return DateTime(date.getTime(), 2 /* DateKind.Local */);
148
145
  }
149
146
  export function timeOfDay(d) {
package/TimeSpan.d.ts CHANGED
@@ -3,11 +3,10 @@ import { comparePrimitives } from "./Util.js";
3
3
  export type TimeSpan = number;
4
4
  export declare function create(d?: number, h?: number, m?: number, s?: number, ms?: number): number;
5
5
  export declare function fromTicks(ticks: number | bigint): number;
6
- export declare function fromDays(d: number, h?: number, m?: bigint, s?: bigint, ms?: bigint): number;
7
- export declare function fromHours(h: number, m?: bigint, s?: bigint, ms?: bigint): number;
8
- export declare function fromMinutes(m: number | bigint, s?: bigint, ms?: bigint): number;
9
- export declare function fromSeconds(s: number | bigint, ms?: bigint): number;
10
- export declare function fromMilliseconds(ms: number | bigint): number;
6
+ export declare function fromDays(d: number): number;
7
+ export declare function fromHours(h: number): number;
8
+ export declare function fromMinutes(m: number): number;
9
+ export declare function fromSeconds(s: number): number;
11
10
  export declare function days(ts: TimeSpan): number;
12
11
  export declare function hours(ts: TimeSpan): number;
13
12
  export declare function minutes(ts: TimeSpan): number;
package/TimeSpan.js CHANGED
@@ -27,20 +27,17 @@ export function create(d = 0, h = 0, m = 0, s = 0, ms = 0) {
27
27
  export function fromTicks(ticks) {
28
28
  return Number(BigInt(ticks) / 10000n);
29
29
  }
30
- export function fromDays(d, h = 0, m = 0n, s = 0n, ms = 0n) {
31
- return create(d, h, Number(m), Number(s), Number(ms));
30
+ export function fromDays(d) {
31
+ return create(d, 0, 0, 0);
32
32
  }
33
- export function fromHours(h, m = 0n, s = 0n, ms = 0n) {
34
- return create(0, h, Number(m), Number(s), Number(ms));
33
+ export function fromHours(h) {
34
+ return create(h, 0, 0);
35
35
  }
36
- export function fromMinutes(m, s = 0n, ms = 0n) {
37
- return create(0, 0, Number(m), Number(s), Number(ms));
36
+ export function fromMinutes(m) {
37
+ return create(0, m, 0);
38
38
  }
39
- export function fromSeconds(s, ms = 0n) {
40
- return create(0, 0, 0, Number(s), Number(ms));
41
- }
42
- export function fromMilliseconds(ms) {
43
- return Number(ms);
39
+ export function fromSeconds(s) {
40
+ return create(0, 0, s);
44
41
  }
45
42
  export function days(ts) {
46
43
  return signedRound(ts / 86400000);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-js",
6
- "version": "1.9.0",
6
+ "version": "1.11.0",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",