@fable-org/fable-library-js 2.4.2 → 2.5.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 +10 -1
- package/Directory.js +11 -0
- package/package.json +1 -1
- package/quotation.js +25 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
last_commit_released:
|
|
2
|
+
last_commit_released: 6568f35ece227fc30ce84111c8d2e975b09bac00
|
|
3
3
|
updaters:
|
|
4
4
|
- package.json:
|
|
5
5
|
file: package.json
|
|
@@ -15,6 +15,15 @@ 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.5.0 - 2026-07-15
|
|
19
|
+
|
|
20
|
+
### 🚀 Features
|
|
21
|
+
|
|
22
|
+
* *(js/ts)* Add `System.IO.Directory` support (Exists, CreateDirectory) (#4798) ([6568f35e](https://github.com/fable-compiler/Fable/commit/6568f35ece227fc30ce84111c8d2e975b09bac00))
|
|
23
|
+
* *(js/ts/python/beam)* Preserve member calls and pattern matches in quotations (#4780) ([55482e6b](https://github.com/fable-compiler/Fable/commit/55482e6b5e6306fd4dbaba5759024313cb26682a))
|
|
24
|
+
|
|
25
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/a8d9bf5f0b7cc4560bb107963348e765695c22b6..6568f35ece227fc30ce84111c8d2e975b09bac00)</small></strong>
|
|
26
|
+
|
|
18
27
|
## 2.4.2 - 2026-07-11
|
|
19
28
|
|
|
20
29
|
### 🐞 Bug Fixes
|
package/Directory.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This library doesn't depend on @types/node (to stay browser-compatible),
|
|
2
|
+
// so this Node.js built-in import can't be type-checked; the exported
|
|
3
|
+
// functions below still declare their own types for callers to rely on.
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import { existsSync, mkdirSync, statSync } from "node:fs";
|
|
6
|
+
export function exists(path) {
|
|
7
|
+
return existsSync(path) && statSync(path).isDirectory();
|
|
8
|
+
}
|
|
9
|
+
export function createDirectory(path) {
|
|
10
|
+
mkdirSync(path, { recursive: true });
|
|
11
|
+
}
|
package/package.json
CHANGED
package/quotation.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* and pattern matching helpers compatible with Fable's option convention
|
|
6
6
|
* (undefined = no match, value/tuple = match).
|
|
7
7
|
*/
|
|
8
|
+
import { ofArray } from "./List.js";
|
|
8
9
|
// ===================================================================
|
|
9
10
|
// Var: represents an F# quotation variable
|
|
10
11
|
// ===================================================================
|
|
@@ -74,11 +75,12 @@ export class ExprIfThenElse {
|
|
|
74
75
|
toJSON() { return ["IfThenElse", this.guard, this.thenExpr, this.elseExpr]; }
|
|
75
76
|
}
|
|
76
77
|
export class ExprCall {
|
|
77
|
-
constructor(instance, method, args) {
|
|
78
|
+
constructor(instance, method, args, declaringType = "") {
|
|
78
79
|
this.tag = "Call";
|
|
79
80
|
this.instance = instance;
|
|
80
81
|
this.method = method;
|
|
81
82
|
this.args = args;
|
|
83
|
+
this.declaringType = declaringType;
|
|
82
84
|
}
|
|
83
85
|
toJSON() { return ["Call", this.instance, this.method, this.args]; }
|
|
84
86
|
}
|
|
@@ -176,6 +178,10 @@ export class ExprVarSet {
|
|
|
176
178
|
export function mkValue(value, type) {
|
|
177
179
|
return new ExprValue(value, type);
|
|
178
180
|
}
|
|
181
|
+
export function mkNull(type) {
|
|
182
|
+
// A null-value node (no instance / null literal / empty option or list).
|
|
183
|
+
return new ExprValue(null, type);
|
|
184
|
+
}
|
|
179
185
|
export function mkVar(v) {
|
|
180
186
|
return new ExprVarExpr(v);
|
|
181
187
|
}
|
|
@@ -191,8 +197,8 @@ export function mkLet(v, value, body) {
|
|
|
191
197
|
export function mkIfThenElse(guard, thenExpr, elseExpr) {
|
|
192
198
|
return new ExprIfThenElse(guard, thenExpr, elseExpr);
|
|
193
199
|
}
|
|
194
|
-
export function mkCall(instance, method, args) {
|
|
195
|
-
return new ExprCall(instance, method, args);
|
|
200
|
+
export function mkCall(instance, method, args, declaringType = "") {
|
|
201
|
+
return new ExprCall(instance, method, args, declaringType);
|
|
196
202
|
}
|
|
197
203
|
export function mkSequential(first, second) {
|
|
198
204
|
return new ExprSequential(first, second);
|
|
@@ -273,10 +279,17 @@ export function isIfThenElse(expr) {
|
|
|
273
279
|
return undefined;
|
|
274
280
|
}
|
|
275
281
|
export function isCall(expr) {
|
|
276
|
-
if (expr instanceof ExprCall)
|
|
277
|
-
|
|
282
|
+
if (expr instanceof ExprCall) {
|
|
283
|
+
// "novalue" is the "no instance" sentinel, distinct from a genuine quoted null ("null").
|
|
284
|
+
const instance = (expr.instance instanceof ExprValue && expr.instance.type === "novalue") ? null : expr.instance;
|
|
285
|
+
// Must be a real FSharpList (not the raw array), same reasoning as isFieldGet below.
|
|
286
|
+
return [instance, expr.method, ofArray(expr.args)];
|
|
287
|
+
}
|
|
278
288
|
return undefined;
|
|
279
289
|
}
|
|
290
|
+
export function callDeclaringType(expr) {
|
|
291
|
+
return expr instanceof ExprCall ? expr.declaringType : "";
|
|
292
|
+
}
|
|
280
293
|
export function isSequential(expr) {
|
|
281
294
|
if (expr instanceof ExprSequential)
|
|
282
295
|
return [expr.first, expr.second];
|
|
@@ -303,8 +316,12 @@ export function isTupleGet(expr) {
|
|
|
303
316
|
return undefined;
|
|
304
317
|
}
|
|
305
318
|
export function isFieldGet(expr) {
|
|
306
|
-
|
|
307
|
-
|
|
319
|
+
// Third element mirrors PropertyGet's indexer-args slot, always empty here (never indexed).
|
|
320
|
+
// "novalue" is the "no instance" sentinel, distinct from a genuine quoted null ("null").
|
|
321
|
+
if (expr instanceof ExprFieldGet) {
|
|
322
|
+
const instance = (expr.expr instanceof ExprValue && expr.expr.type === "novalue") ? null : expr.expr;
|
|
323
|
+
return [instance, expr.fieldName, []];
|
|
324
|
+
}
|
|
308
325
|
return undefined;
|
|
309
326
|
}
|
|
310
327
|
// ===================================================================
|
|
@@ -555,7 +572,7 @@ export function substitute(expr, fn) {
|
|
|
555
572
|
return new ExprIfThenElse(sub(e.guard), sub(e.thenExpr), sub(e.elseExpr));
|
|
556
573
|
if (e instanceof ExprCall) {
|
|
557
574
|
const newInst = e.instance != null ? sub(e.instance) : e.instance;
|
|
558
|
-
return new ExprCall(newInst, e.method, e.args.map(sub));
|
|
575
|
+
return new ExprCall(newInst, e.method, e.args.map(sub), e.declaringType);
|
|
559
576
|
}
|
|
560
577
|
if (e instanceof ExprSequential)
|
|
561
578
|
return new ExprSequential(sub(e.first), sub(e.second));
|