@fable-org/fable-library-js 2.7.1 → 2.8.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/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- last_commit_released: 4a441b1926387a42db6a3a4294acd97b02760ca3
2
+ last_commit_released: 2369fbd24fafe851544c1ed6eb54f0bfc2b75f36
3
3
  updaters:
4
4
  - package.json:
5
5
  file: package.json
@@ -15,6 +15,19 @@ All notable changes to this project will be documented in this file.
15
15
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
16
16
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
17
17
 
18
+ ## 2.8.0 - 2026-09-25
19
+
20
+ ### 🐞 Bug Fixes
21
+
22
+ * *(js/ts)* Fix Dictionary.Remove and HashSet.Remove to remove empty buckets (#4985) ([aea61b56](https://github.com/fable-compiler/Fable/commit/aea61b562c461a9b383e805f06f68a3b21ed45c2))
23
+ * *(js/ts)* Clear custom System.Collections.IList implementations ([2369fbd2](https://github.com/fable-compiler/Fable/commit/2369fbd24fafe851544c1ed6eb54f0bfc2b75f36))
24
+
25
+ ### ⚡ Performance Improvements
26
+
27
+ * *(js/ts)* Faster `resizeArray.Clear()` in JS/TS ([32d85add](https://github.com/fable-compiler/Fable/commit/32d85add01422547dba03b15e0a0787d8afb031b))
28
+
29
+ <strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/4a441b1926387a42db6a3a4294acd97b02760ca3..2369fbd24fafe851544c1ed6eb54f0bfc2b75f36)</small></strong>
30
+
18
31
  ## 2.7.1 - 2026-09-11
19
32
 
20
33
  ### 🐞 Bug Fixes
package/CollectionUtil.js CHANGED
@@ -161,22 +161,16 @@ export function clear(col) {
161
161
  if (typeof col["System.Collections.Generic.ICollection`1.Clear"] === "function") {
162
162
  return col["System.Collections.Generic.ICollection`1.Clear"](); // collection
163
163
  }
164
+ else if (Array.isArray(col)) {
165
+ col.length = 0;
166
+ }
167
+ else if (ArrayBuffer.isView(col)) {
168
+ // TODO: throw for typed arrays?
169
+ }
170
+ else if (typeof col.clear === "function") {
171
+ col.clear(); // map, set
172
+ }
164
173
  else {
165
- if (isArrayLike(col)) {
166
- if (ArrayBuffer.isView(col)) {
167
- // TODO: throw for typed arrays?
168
- }
169
- else {
170
- col.splice(0); // array, resize array
171
- }
172
- }
173
- else {
174
- if (typeof col.clear === "function") {
175
- col.clear(); // map, set
176
- }
177
- else {
178
- // TODO: throw for other collections?
179
- }
180
- }
174
+ // TODO: throw for other collections?
181
175
  }
182
176
  }
package/MutableMap.js CHANGED
@@ -330,7 +330,11 @@ export function Dictionary__Remove_2B595(this$, k) {
330
330
  }
331
331
  switch (matchResult) {
332
332
  case 0: {
333
- getItemFromDict(this$.hashMap, matchValue[1]).splice(matchValue[2], 1);
333
+ const h_1 = matchValue[1] | 0;
334
+ getItemFromDict(this$.hashMap, h_1).splice(matchValue[2], 1);
335
+ if (getItemFromDict(this$.hashMap, h_1).length === 0) {
336
+ this$.hashMap.delete(h_1);
337
+ }
334
338
  return true;
335
339
  }
336
340
  default:
package/MutableSet.js CHANGED
@@ -224,7 +224,11 @@ export function HashSet__Remove_2B595(this$, k) {
224
224
  }
225
225
  switch (matchResult) {
226
226
  case 0: {
227
- getItemFromDict(this$.hashMap, matchValue[1]).splice(matchValue[2], 1);
227
+ const h_1 = matchValue[1] | 0;
228
+ getItemFromDict(this$.hashMap, h_1).splice(matchValue[2], 1);
229
+ if (getItemFromDict(this$.hashMap, h_1).length === 0) {
230
+ this$.hashMap.delete(h_1);
231
+ }
228
232
  return true;
229
233
  }
230
234
  default:
package/Util.js CHANGED
@@ -559,11 +559,23 @@ export function count(col) {
559
559
  }
560
560
  }
561
561
  export function clear(col) {
562
- if (isArrayLike(col)) {
563
- col.splice(0);
562
+ if (Array.isArray(col)) {
563
+ col.length = 0;
564
+ }
565
+ else if (ArrayBuffer.isView(col)) {
566
+ // TODO: throw for typed arrays?
567
+ }
568
+ else if (typeof col.clear === "function") {
569
+ col.clear(); // map, set
570
+ }
571
+ else if (typeof col["System.Collections.Generic.ICollection`1.Clear"] === "function") {
572
+ col["System.Collections.Generic.ICollection`1.Clear"](); // collection
573
+ }
574
+ else if (typeof col["System.Collections.IList.Clear"] === "function") {
575
+ col["System.Collections.IList.Clear"](); // collection
564
576
  }
565
577
  else {
566
- col.clear();
578
+ // TODO: throw for other collections?
567
579
  }
568
580
  }
569
581
  const curried = new WeakMap();
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": "2.7.1",
6
+ "version": "2.8.0",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",