lalph 0.1.33 → 0.1.34
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/dist/cli.mjs +507 -371
- package/package.json +1 -1
- package/src/Planner.ts +35 -30
- package/src/PromptGen.ts +30 -13
- package/src/cli.ts +8 -2
package/dist/cli.mjs
CHANGED
|
@@ -1579,8 +1579,8 @@ function formatPropertyKey(name) {
|
|
|
1579
1579
|
*
|
|
1580
1580
|
* @internal
|
|
1581
1581
|
*/
|
|
1582
|
-
function formatPath(path) {
|
|
1583
|
-
return path.map((key) => `[${formatPropertyKey(key)}]`).join("");
|
|
1582
|
+
function formatPath(path$2) {
|
|
1583
|
+
return path$2.map((key) => `[${formatPropertyKey(key)}]`).join("");
|
|
1584
1584
|
}
|
|
1585
1585
|
/**
|
|
1586
1586
|
* Fast path for formatting dates.
|
|
@@ -21555,9 +21555,9 @@ var Pointer = class extends Base$1 {
|
|
|
21555
21555
|
* The issue that occurred.
|
|
21556
21556
|
*/
|
|
21557
21557
|
issue;
|
|
21558
|
-
constructor(path, issue) {
|
|
21558
|
+
constructor(path$2, issue) {
|
|
21559
21559
|
super();
|
|
21560
|
-
this.path = path;
|
|
21560
|
+
this.path = path$2;
|
|
21561
21561
|
this.issue = issue;
|
|
21562
21562
|
}
|
|
21563
21563
|
};
|
|
@@ -21786,41 +21786,41 @@ const defaultCheckHook = (issue) => {
|
|
|
21786
21786
|
function getExpectedMessage(expected, actual) {
|
|
21787
21787
|
return `Expected ${expected}, got ${actual}`;
|
|
21788
21788
|
}
|
|
21789
|
-
function toDefaultIssues(issue, path, leafHook, checkHook) {
|
|
21789
|
+
function toDefaultIssues(issue, path$2, leafHook, checkHook) {
|
|
21790
21790
|
switch (issue._tag) {
|
|
21791
21791
|
case "Filter": {
|
|
21792
21792
|
const message = checkHook(issue);
|
|
21793
21793
|
if (message !== void 0) return [{
|
|
21794
|
-
path,
|
|
21794
|
+
path: path$2,
|
|
21795
21795
|
message
|
|
21796
21796
|
}];
|
|
21797
21797
|
switch (issue.issue._tag) {
|
|
21798
21798
|
case "InvalidValue": return [{
|
|
21799
|
-
path,
|
|
21799
|
+
path: path$2,
|
|
21800
21800
|
message: getExpectedMessage(formatCheck(issue.filter), format$2(issue.actual))
|
|
21801
21801
|
}];
|
|
21802
|
-
default: return toDefaultIssues(issue.issue, path, leafHook, checkHook);
|
|
21802
|
+
default: return toDefaultIssues(issue.issue, path$2, leafHook, checkHook);
|
|
21803
21803
|
}
|
|
21804
21804
|
}
|
|
21805
|
-
case "Encoding": return toDefaultIssues(issue.issue, path, leafHook, checkHook);
|
|
21806
|
-
case "Pointer": return toDefaultIssues(issue.issue, [...path, ...issue.path], leafHook, checkHook);
|
|
21807
|
-
case "Composite": return issue.issues.flatMap((issue$1) => toDefaultIssues(issue$1, path, leafHook, checkHook));
|
|
21805
|
+
case "Encoding": return toDefaultIssues(issue.issue, path$2, leafHook, checkHook);
|
|
21806
|
+
case "Pointer": return toDefaultIssues(issue.issue, [...path$2, ...issue.path], leafHook, checkHook);
|
|
21807
|
+
case "Composite": return issue.issues.flatMap((issue$1) => toDefaultIssues(issue$1, path$2, leafHook, checkHook));
|
|
21808
21808
|
case "AnyOf": {
|
|
21809
21809
|
const message = findMessage(issue);
|
|
21810
21810
|
if (issue.issues.length === 0) {
|
|
21811
21811
|
if (message !== void 0) return [{
|
|
21812
|
-
path,
|
|
21812
|
+
path: path$2,
|
|
21813
21813
|
message
|
|
21814
21814
|
}];
|
|
21815
21815
|
return [{
|
|
21816
|
-
path,
|
|
21816
|
+
path: path$2,
|
|
21817
21817
|
message: getExpectedMessage(getExpected(issue.ast), format$2(issue.actual))
|
|
21818
21818
|
}];
|
|
21819
21819
|
}
|
|
21820
|
-
return issue.issues.flatMap((issue$1) => toDefaultIssues(issue$1, path, leafHook, checkHook));
|
|
21820
|
+
return issue.issues.flatMap((issue$1) => toDefaultIssues(issue$1, path$2, leafHook, checkHook));
|
|
21821
21821
|
}
|
|
21822
21822
|
default: return [{
|
|
21823
|
-
path,
|
|
21823
|
+
path: path$2,
|
|
21824
21824
|
message: leafHook(issue)
|
|
21825
21825
|
}];
|
|
21826
21826
|
}
|
|
@@ -21848,8 +21848,8 @@ const defaultFormatter$1 = /* @__PURE__ */ makeFormatterDefault();
|
|
|
21848
21848
|
function formatDefaultIssue(issue) {
|
|
21849
21849
|
let out = issue.message;
|
|
21850
21850
|
if (issue.path && issue.path.length > 0) {
|
|
21851
|
-
const path = formatPath(issue.path);
|
|
21852
|
-
out += `\n at ${path}`;
|
|
21851
|
+
const path$2 = formatPath(issue.path);
|
|
21852
|
+
out += `\n at ${path$2}`;
|
|
21853
21853
|
}
|
|
21854
21854
|
return out;
|
|
21855
21855
|
}
|
|
@@ -31056,8 +31056,8 @@ var require_compiler = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31056
31056
|
valueAssignments.push(fullPath);
|
|
31057
31057
|
}
|
|
31058
31058
|
}
|
|
31059
|
-
function pathAssigned(path) {
|
|
31060
|
-
return assignedPaths.indexOf(path) !== -1;
|
|
31059
|
+
function pathAssigned(path$2) {
|
|
31060
|
+
return assignedPaths.indexOf(path$2) !== -1;
|
|
31061
31061
|
}
|
|
31062
31062
|
function reduceValueNode(node) {
|
|
31063
31063
|
if (node.type === "Array") return reduceArrayWithTypeChecking(node.value);
|
|
@@ -31074,18 +31074,18 @@ var require_compiler = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31074
31074
|
return obj;
|
|
31075
31075
|
}
|
|
31076
31076
|
function setPath(node) {
|
|
31077
|
-
var path = node.value;
|
|
31078
|
-
var quotedPath = path.map(quoteDottedString).join(".");
|
|
31077
|
+
var path$2 = node.value;
|
|
31078
|
+
var quotedPath = path$2.map(quoteDottedString).join(".");
|
|
31079
31079
|
var line = node.line;
|
|
31080
31080
|
var column = node.column;
|
|
31081
|
-
if (pathAssigned(quotedPath)) genError("Cannot redefine existing key '" + path + "'.", line, column);
|
|
31081
|
+
if (pathAssigned(quotedPath)) genError("Cannot redefine existing key '" + path$2 + "'.", line, column);
|
|
31082
31082
|
assignedPaths.push(quotedPath);
|
|
31083
|
-
context = deepRef(data, path, Object.create(null), line, column);
|
|
31084
|
-
currentPath = path;
|
|
31083
|
+
context = deepRef(data, path$2, Object.create(null), line, column);
|
|
31084
|
+
currentPath = path$2;
|
|
31085
31085
|
}
|
|
31086
31086
|
function addTableArray(node) {
|
|
31087
|
-
var path = node.value;
|
|
31088
|
-
var quotedPath = path.map(quoteDottedString).join(".");
|
|
31087
|
+
var path$2 = node.value;
|
|
31088
|
+
var quotedPath = path$2.map(quoteDottedString).join(".");
|
|
31089
31089
|
var line = node.line;
|
|
31090
31090
|
var column = node.column;
|
|
31091
31091
|
if (!pathAssigned(quotedPath)) assignedPaths.push(quotedPath);
|
|
@@ -31093,13 +31093,13 @@ var require_compiler = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
|
|
|
31093
31093
|
return p.indexOf(quotedPath) !== 0;
|
|
31094
31094
|
});
|
|
31095
31095
|
assignedPaths.push(quotedPath);
|
|
31096
|
-
context = deepRef(data, path, [], line, column);
|
|
31096
|
+
context = deepRef(data, path$2, [], line, column);
|
|
31097
31097
|
currentPath = quotedPath;
|
|
31098
31098
|
if (context instanceof Array) {
|
|
31099
31099
|
var newObj = Object.create(null);
|
|
31100
31100
|
context.push(newObj);
|
|
31101
31101
|
context = newObj;
|
|
31102
|
-
} else genError("Cannot redefine existing key '" + path + "'.", line, column);
|
|
31102
|
+
} else genError("Cannot redefine existing key '" + path$2 + "'.", line, column);
|
|
31103
31103
|
}
|
|
31104
31104
|
function deepRef(start, keys$1, value, line, column) {
|
|
31105
31105
|
var traversed = [];
|
|
@@ -31246,17 +31246,17 @@ var require_visit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31246
31246
|
visit.SKIP = SKIP;
|
|
31247
31247
|
/** Remove the current node */
|
|
31248
31248
|
visit.REMOVE = REMOVE;
|
|
31249
|
-
function visit_(key, node, visitor, path) {
|
|
31250
|
-
const ctrl = callVisitor(key, node, visitor, path);
|
|
31249
|
+
function visit_(key, node, visitor, path$2) {
|
|
31250
|
+
const ctrl = callVisitor(key, node, visitor, path$2);
|
|
31251
31251
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
31252
|
-
replaceNode(key, path, ctrl);
|
|
31253
|
-
return visit_(key, ctrl, visitor, path);
|
|
31252
|
+
replaceNode(key, path$2, ctrl);
|
|
31253
|
+
return visit_(key, ctrl, visitor, path$2);
|
|
31254
31254
|
}
|
|
31255
31255
|
if (typeof ctrl !== "symbol") {
|
|
31256
31256
|
if (identity.isCollection(node)) {
|
|
31257
|
-
path = Object.freeze(path.concat(node));
|
|
31257
|
+
path$2 = Object.freeze(path$2.concat(node));
|
|
31258
31258
|
for (let i = 0; i < node.items.length; ++i) {
|
|
31259
|
-
const ci = visit_(i, node.items[i], visitor, path);
|
|
31259
|
+
const ci = visit_(i, node.items[i], visitor, path$2);
|
|
31260
31260
|
if (typeof ci === "number") i = ci - 1;
|
|
31261
31261
|
else if (ci === BREAK) return BREAK;
|
|
31262
31262
|
else if (ci === REMOVE) {
|
|
@@ -31265,11 +31265,11 @@ var require_visit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31265
31265
|
}
|
|
31266
31266
|
}
|
|
31267
31267
|
} else if (identity.isPair(node)) {
|
|
31268
|
-
path = Object.freeze(path.concat(node));
|
|
31269
|
-
const ck = visit_("key", node.key, visitor, path);
|
|
31268
|
+
path$2 = Object.freeze(path$2.concat(node));
|
|
31269
|
+
const ck = visit_("key", node.key, visitor, path$2);
|
|
31270
31270
|
if (ck === BREAK) return BREAK;
|
|
31271
31271
|
else if (ck === REMOVE) node.key = null;
|
|
31272
|
-
const cv = visit_("value", node.value, visitor, path);
|
|
31272
|
+
const cv = visit_("value", node.value, visitor, path$2);
|
|
31273
31273
|
if (cv === BREAK) return BREAK;
|
|
31274
31274
|
else if (cv === REMOVE) node.value = null;
|
|
31275
31275
|
}
|
|
@@ -31319,17 +31319,17 @@ var require_visit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31319
31319
|
visitAsync.SKIP = SKIP;
|
|
31320
31320
|
/** Remove the current node */
|
|
31321
31321
|
visitAsync.REMOVE = REMOVE;
|
|
31322
|
-
async function visitAsync_(key, node, visitor, path) {
|
|
31323
|
-
const ctrl = await callVisitor(key, node, visitor, path);
|
|
31322
|
+
async function visitAsync_(key, node, visitor, path$2) {
|
|
31323
|
+
const ctrl = await callVisitor(key, node, visitor, path$2);
|
|
31324
31324
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
31325
|
-
replaceNode(key, path, ctrl);
|
|
31326
|
-
return visitAsync_(key, ctrl, visitor, path);
|
|
31325
|
+
replaceNode(key, path$2, ctrl);
|
|
31326
|
+
return visitAsync_(key, ctrl, visitor, path$2);
|
|
31327
31327
|
}
|
|
31328
31328
|
if (typeof ctrl !== "symbol") {
|
|
31329
31329
|
if (identity.isCollection(node)) {
|
|
31330
|
-
path = Object.freeze(path.concat(node));
|
|
31330
|
+
path$2 = Object.freeze(path$2.concat(node));
|
|
31331
31331
|
for (let i = 0; i < node.items.length; ++i) {
|
|
31332
|
-
const ci = await visitAsync_(i, node.items[i], visitor, path);
|
|
31332
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path$2);
|
|
31333
31333
|
if (typeof ci === "number") i = ci - 1;
|
|
31334
31334
|
else if (ci === BREAK) return BREAK;
|
|
31335
31335
|
else if (ci === REMOVE) {
|
|
@@ -31338,11 +31338,11 @@ var require_visit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31338
31338
|
}
|
|
31339
31339
|
}
|
|
31340
31340
|
} else if (identity.isPair(node)) {
|
|
31341
|
-
path = Object.freeze(path.concat(node));
|
|
31342
|
-
const ck = await visitAsync_("key", node.key, visitor, path);
|
|
31341
|
+
path$2 = Object.freeze(path$2.concat(node));
|
|
31342
|
+
const ck = await visitAsync_("key", node.key, visitor, path$2);
|
|
31343
31343
|
if (ck === BREAK) return BREAK;
|
|
31344
31344
|
else if (ck === REMOVE) node.key = null;
|
|
31345
|
-
const cv = await visitAsync_("value", node.value, visitor, path);
|
|
31345
|
+
const cv = await visitAsync_("value", node.value, visitor, path$2);
|
|
31346
31346
|
if (cv === BREAK) return BREAK;
|
|
31347
31347
|
else if (cv === REMOVE) node.value = null;
|
|
31348
31348
|
}
|
|
@@ -31365,16 +31365,16 @@ var require_visit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31365
31365
|
}, visitor);
|
|
31366
31366
|
return visitor;
|
|
31367
31367
|
}
|
|
31368
|
-
function callVisitor(key, node, visitor, path) {
|
|
31369
|
-
if (typeof visitor === "function") return visitor(key, node, path);
|
|
31370
|
-
if (identity.isMap(node)) return visitor.Map?.(key, node, path);
|
|
31371
|
-
if (identity.isSeq(node)) return visitor.Seq?.(key, node, path);
|
|
31372
|
-
if (identity.isPair(node)) return visitor.Pair?.(key, node, path);
|
|
31373
|
-
if (identity.isScalar(node)) return visitor.Scalar?.(key, node, path);
|
|
31374
|
-
if (identity.isAlias(node)) return visitor.Alias?.(key, node, path);
|
|
31368
|
+
function callVisitor(key, node, visitor, path$2) {
|
|
31369
|
+
if (typeof visitor === "function") return visitor(key, node, path$2);
|
|
31370
|
+
if (identity.isMap(node)) return visitor.Map?.(key, node, path$2);
|
|
31371
|
+
if (identity.isSeq(node)) return visitor.Seq?.(key, node, path$2);
|
|
31372
|
+
if (identity.isPair(node)) return visitor.Pair?.(key, node, path$2);
|
|
31373
|
+
if (identity.isScalar(node)) return visitor.Scalar?.(key, node, path$2);
|
|
31374
|
+
if (identity.isAlias(node)) return visitor.Alias?.(key, node, path$2);
|
|
31375
31375
|
}
|
|
31376
|
-
function replaceNode(key, path, node) {
|
|
31377
|
-
const parent = path[path.length - 1];
|
|
31376
|
+
function replaceNode(key, path$2, node) {
|
|
31377
|
+
const parent = path$2[path$2.length - 1];
|
|
31378
31378
|
if (identity.isCollection(parent)) parent.items[key] = node;
|
|
31379
31379
|
else if (identity.isPair(parent)) if (key === "key") parent.key = node;
|
|
31380
31380
|
else parent.value = node;
|
|
@@ -31923,10 +31923,10 @@ var require_Collection = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31923
31923
|
var createNode = require_createNode();
|
|
31924
31924
|
var identity = require_identity();
|
|
31925
31925
|
var Node = require_Node();
|
|
31926
|
-
function collectionFromPath(schema, path, value) {
|
|
31926
|
+
function collectionFromPath(schema, path$2, value) {
|
|
31927
31927
|
let v = value;
|
|
31928
|
-
for (let i = path.length - 1; i >= 0; --i) {
|
|
31929
|
-
const k = path[i];
|
|
31928
|
+
for (let i = path$2.length - 1; i >= 0; --i) {
|
|
31929
|
+
const k = path$2[i];
|
|
31930
31930
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
31931
31931
|
const a = [];
|
|
31932
31932
|
a[k] = v;
|
|
@@ -31943,7 +31943,7 @@ var require_Collection = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31943
31943
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
31944
31944
|
});
|
|
31945
31945
|
}
|
|
31946
|
-
const isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
|
|
31946
|
+
const isEmptyPath = (path$2) => path$2 == null || typeof path$2 === "object" && !!path$2[Symbol.iterator]().next().done;
|
|
31947
31947
|
var Collection = class extends Node.NodeBase {
|
|
31948
31948
|
constructor(type, schema) {
|
|
31949
31949
|
super(type);
|
|
@@ -31971,10 +31971,10 @@ var require_Collection = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31971
31971
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
31972
31972
|
* that already exists in the map.
|
|
31973
31973
|
*/
|
|
31974
|
-
addIn(path, value) {
|
|
31975
|
-
if (isEmptyPath(path)) this.add(value);
|
|
31974
|
+
addIn(path$2, value) {
|
|
31975
|
+
if (isEmptyPath(path$2)) this.add(value);
|
|
31976
31976
|
else {
|
|
31977
|
-
const [key, ...rest] = path;
|
|
31977
|
+
const [key, ...rest] = path$2;
|
|
31978
31978
|
const node = this.get(key, true);
|
|
31979
31979
|
if (identity.isCollection(node)) node.addIn(rest, value);
|
|
31980
31980
|
else if (node === void 0 && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));
|
|
@@ -31985,8 +31985,8 @@ var require_Collection = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31985
31985
|
* Removes a value from the collection.
|
|
31986
31986
|
* @returns `true` if the item was found and removed.
|
|
31987
31987
|
*/
|
|
31988
|
-
deleteIn(path) {
|
|
31989
|
-
const [key, ...rest] = path;
|
|
31988
|
+
deleteIn(path$2) {
|
|
31989
|
+
const [key, ...rest] = path$2;
|
|
31990
31990
|
if (rest.length === 0) return this.delete(key);
|
|
31991
31991
|
const node = this.get(key, true);
|
|
31992
31992
|
if (identity.isCollection(node)) return node.deleteIn(rest);
|
|
@@ -31997,8 +31997,8 @@ var require_Collection = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
31997
31997
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
31998
31998
|
* `true` (collections are always returned intact).
|
|
31999
31999
|
*/
|
|
32000
|
-
getIn(path, keepScalar) {
|
|
32001
|
-
const [key, ...rest] = path;
|
|
32000
|
+
getIn(path$2, keepScalar) {
|
|
32001
|
+
const [key, ...rest] = path$2;
|
|
32002
32002
|
const node = this.get(key, true);
|
|
32003
32003
|
if (rest.length === 0) return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
32004
32004
|
else return identity.isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
|
|
@@ -32013,8 +32013,8 @@ var require_Collection = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
32013
32013
|
/**
|
|
32014
32014
|
* Checks if the collection includes a value with the key `key`.
|
|
32015
32015
|
*/
|
|
32016
|
-
hasIn(path) {
|
|
32017
|
-
const [key, ...rest] = path;
|
|
32016
|
+
hasIn(path$2) {
|
|
32017
|
+
const [key, ...rest] = path$2;
|
|
32018
32018
|
if (rest.length === 0) return this.has(key);
|
|
32019
32019
|
const node = this.get(key, true);
|
|
32020
32020
|
return identity.isCollection(node) ? node.hasIn(rest) : false;
|
|
@@ -32023,8 +32023,8 @@ var require_Collection = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
32023
32023
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
32024
32024
|
* boolean to add/remove the item from the set.
|
|
32025
32025
|
*/
|
|
32026
|
-
setIn(path, value) {
|
|
32027
|
-
const [key, ...rest] = path;
|
|
32026
|
+
setIn(path$2, value) {
|
|
32027
|
+
const [key, ...rest] = path$2;
|
|
32028
32028
|
if (rest.length === 0) this.set(key, value);
|
|
32029
32029
|
else {
|
|
32030
32030
|
const node = this.get(key, true);
|
|
@@ -34140,8 +34140,8 @@ var require_Document = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
34140
34140
|
if (assertCollection(this.contents)) this.contents.add(value);
|
|
34141
34141
|
}
|
|
34142
34142
|
/** Adds a value to the document. */
|
|
34143
|
-
addIn(path, value) {
|
|
34144
|
-
if (assertCollection(this.contents)) this.contents.addIn(path, value);
|
|
34143
|
+
addIn(path$2, value) {
|
|
34144
|
+
if (assertCollection(this.contents)) this.contents.addIn(path$2, value);
|
|
34145
34145
|
}
|
|
34146
34146
|
/**
|
|
34147
34147
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -34209,13 +34209,13 @@ var require_Document = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
34209
34209
|
* Removes a value from the document.
|
|
34210
34210
|
* @returns `true` if the item was found and removed.
|
|
34211
34211
|
*/
|
|
34212
|
-
deleteIn(path) {
|
|
34213
|
-
if (Collection.isEmptyPath(path)) {
|
|
34212
|
+
deleteIn(path$2) {
|
|
34213
|
+
if (Collection.isEmptyPath(path$2)) {
|
|
34214
34214
|
if (this.contents == null) return false;
|
|
34215
34215
|
this.contents = null;
|
|
34216
34216
|
return true;
|
|
34217
34217
|
}
|
|
34218
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
|
|
34218
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path$2) : false;
|
|
34219
34219
|
}
|
|
34220
34220
|
/**
|
|
34221
34221
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -34230,9 +34230,9 @@ var require_Document = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
34230
34230
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
34231
34231
|
* `true` (collections are always returned intact).
|
|
34232
34232
|
*/
|
|
34233
|
-
getIn(path, keepScalar) {
|
|
34234
|
-
if (Collection.isEmptyPath(path)) return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
34235
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
|
|
34233
|
+
getIn(path$2, keepScalar) {
|
|
34234
|
+
if (Collection.isEmptyPath(path$2)) return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
34235
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path$2, keepScalar) : void 0;
|
|
34236
34236
|
}
|
|
34237
34237
|
/**
|
|
34238
34238
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -34243,9 +34243,9 @@ var require_Document = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
34243
34243
|
/**
|
|
34244
34244
|
* Checks if the document includes a value at `path`.
|
|
34245
34245
|
*/
|
|
34246
|
-
hasIn(path) {
|
|
34247
|
-
if (Collection.isEmptyPath(path)) return this.contents !== void 0;
|
|
34248
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
|
|
34246
|
+
hasIn(path$2) {
|
|
34247
|
+
if (Collection.isEmptyPath(path$2)) return this.contents !== void 0;
|
|
34248
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path$2) : false;
|
|
34249
34249
|
}
|
|
34250
34250
|
/**
|
|
34251
34251
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -34259,10 +34259,10 @@ var require_Document = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
34259
34259
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
34260
34260
|
* boolean to add/remove the item from the set.
|
|
34261
34261
|
*/
|
|
34262
|
-
setIn(path, value) {
|
|
34263
|
-
if (Collection.isEmptyPath(path)) this.contents = value;
|
|
34264
|
-
else if (this.contents == null) this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
|
|
34265
|
-
else if (assertCollection(this.contents)) this.contents.setIn(path, value);
|
|
34262
|
+
setIn(path$2, value) {
|
|
34263
|
+
if (Collection.isEmptyPath(path$2)) this.contents = value;
|
|
34264
|
+
else if (this.contents == null) this.contents = Collection.collectionFromPath(this.schema, Array.from(path$2), value);
|
|
34265
|
+
else if (assertCollection(this.contents)) this.contents.setIn(path$2, value);
|
|
34266
34266
|
}
|
|
34267
34267
|
/**
|
|
34268
34268
|
* Change the YAML version and schema used by the document.
|
|
@@ -36110,9 +36110,9 @@ var require_cst_visit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
36110
36110
|
/** Remove the current item */
|
|
36111
36111
|
visit.REMOVE = REMOVE;
|
|
36112
36112
|
/** Find the item at `path` from `cst` as the root */
|
|
36113
|
-
visit.itemAtPath = (cst, path) => {
|
|
36113
|
+
visit.itemAtPath = (cst, path$2) => {
|
|
36114
36114
|
let item = cst;
|
|
36115
|
-
for (const [field, index] of path) {
|
|
36115
|
+
for (const [field, index] of path$2) {
|
|
36116
36116
|
const tok = item?.[field];
|
|
36117
36117
|
if (tok && "items" in tok) item = tok.items[index];
|
|
36118
36118
|
else return void 0;
|
|
@@ -36124,21 +36124,21 @@ var require_cst_visit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
36124
36124
|
*
|
|
36125
36125
|
* Throws an error if the collection is not found, which should never happen if the item itself exists.
|
|
36126
36126
|
*/
|
|
36127
|
-
visit.parentCollection = (cst, path) => {
|
|
36128
|
-
const parent = visit.itemAtPath(cst, path.slice(0, -1));
|
|
36129
|
-
const field = path[path.length - 1][0];
|
|
36127
|
+
visit.parentCollection = (cst, path$2) => {
|
|
36128
|
+
const parent = visit.itemAtPath(cst, path$2.slice(0, -1));
|
|
36129
|
+
const field = path$2[path$2.length - 1][0];
|
|
36130
36130
|
const coll = parent?.[field];
|
|
36131
36131
|
if (coll && "items" in coll) return coll;
|
|
36132
36132
|
throw new Error("Parent collection not found");
|
|
36133
36133
|
};
|
|
36134
|
-
function _visit(path, item, visitor) {
|
|
36135
|
-
let ctrl = visitor(item, path);
|
|
36134
|
+
function _visit(path$2, item, visitor) {
|
|
36135
|
+
let ctrl = visitor(item, path$2);
|
|
36136
36136
|
if (typeof ctrl === "symbol") return ctrl;
|
|
36137
36137
|
for (const field of ["key", "value"]) {
|
|
36138
36138
|
const token = item[field];
|
|
36139
36139
|
if (token && "items" in token) {
|
|
36140
36140
|
for (let i = 0; i < token.items.length; ++i) {
|
|
36141
|
-
const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
|
|
36141
|
+
const ci = _visit(Object.freeze(path$2.concat([[field, i]])), token.items[i], visitor);
|
|
36142
36142
|
if (typeof ci === "number") i = ci - 1;
|
|
36143
36143
|
else if (ci === BREAK) return BREAK;
|
|
36144
36144
|
else if (ci === REMOVE) {
|
|
@@ -36146,10 +36146,10 @@ var require_cst_visit = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
36146
36146
|
i -= 1;
|
|
36147
36147
|
}
|
|
36148
36148
|
}
|
|
36149
|
-
if (typeof ctrl === "function" && field === "key") ctrl = ctrl(item, path);
|
|
36149
|
+
if (typeof ctrl === "function" && field === "key") ctrl = ctrl(item, path$2);
|
|
36150
36150
|
}
|
|
36151
36151
|
}
|
|
36152
|
-
return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
|
|
36152
|
+
return typeof ctrl === "function" ? ctrl(item, path$2) : ctrl;
|
|
36153
36153
|
}
|
|
36154
36154
|
exports.visit = visit;
|
|
36155
36155
|
}));
|
|
@@ -42181,8 +42181,8 @@ const FileSystem = /* @__PURE__ */ Service("effect/platform/FileSystem");
|
|
|
42181
42181
|
const make$28 = (impl) => FileSystem.of({
|
|
42182
42182
|
...impl,
|
|
42183
42183
|
[TypeId$26]: TypeId$26,
|
|
42184
|
-
exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason === "NotFound" ? succeed(false) : fail$3(e))),
|
|
42185
|
-
readFileString: (path, encoding) => flatMap(impl.readFile(path), (_) => try_({
|
|
42184
|
+
exists: (path$2) => pipe(impl.access(path$2), as(true), catchTag("PlatformError", (e) => e.reason === "NotFound" ? succeed(false) : fail$3(e))),
|
|
42185
|
+
readFileString: (path$2, encoding) => flatMap(impl.readFile(path$2), (_) => try_({
|
|
42186
42186
|
try: () => new TextDecoder(encoding).decode(_),
|
|
42187
42187
|
catch: (cause) => new BadArgument({
|
|
42188
42188
|
module: "FileSystem",
|
|
@@ -42191,8 +42191,8 @@ const make$28 = (impl) => FileSystem.of({
|
|
|
42191
42191
|
cause
|
|
42192
42192
|
})
|
|
42193
42193
|
})),
|
|
42194
|
-
stream: fnUntraced(function* (path, options) {
|
|
42195
|
-
const file = yield* impl.open(path, { flag: "r" });
|
|
42194
|
+
stream: fnUntraced(function* (path$2, options) {
|
|
42195
|
+
const file = yield* impl.open(path$2, { flag: "r" });
|
|
42196
42196
|
if (options?.offset) yield* file.seek(options.offset, "start");
|
|
42197
42197
|
const bytesToRead = options?.bytesToRead !== void 0 ? Size(options.bytesToRead) : void 0;
|
|
42198
42198
|
let totalBytesRead = BigInt(0);
|
|
@@ -42207,11 +42207,11 @@ const make$28 = (impl) => FileSystem.of({
|
|
|
42207
42207
|
return succeed(of(buf));
|
|
42208
42208
|
})));
|
|
42209
42209
|
}, unwrap),
|
|
42210
|
-
sink: (path, options) => pipe(impl.open(path, {
|
|
42210
|
+
sink: (path$2, options) => pipe(impl.open(path$2, {
|
|
42211
42211
|
flag: "w",
|
|
42212
42212
|
...options
|
|
42213
42213
|
}), map$4((file) => forEach((_) => file.writeAll(_))), unwrap$1),
|
|
42214
|
-
writeFileString: (path, data, options) => flatMap(try_({
|
|
42214
|
+
writeFileString: (path$2, data, options) => flatMap(try_({
|
|
42215
42215
|
try: () => new TextEncoder().encode(data),
|
|
42216
42216
|
catch: (cause) => new BadArgument({
|
|
42217
42217
|
module: "FileSystem",
|
|
@@ -42219,7 +42219,7 @@ const make$28 = (impl) => FileSystem.of({
|
|
|
42219
42219
|
description: "could not encode string",
|
|
42220
42220
|
cause
|
|
42221
42221
|
})
|
|
42222
|
-
}), (_) => impl.writeFile(path, _, options))
|
|
42222
|
+
}), (_) => impl.writeFile(path$2, _, options))
|
|
42223
42223
|
});
|
|
42224
42224
|
/**
|
|
42225
42225
|
* @since 4.0.0
|
|
@@ -42350,14 +42350,14 @@ const Path$1 = /* @__PURE__ */ Service("effect/Path");
|
|
|
42350
42350
|
* The following license applies to these functions:
|
|
42351
42351
|
* - MIT
|
|
42352
42352
|
*/
|
|
42353
|
-
function normalizeStringPosix(path, allowAboveRoot) {
|
|
42353
|
+
function normalizeStringPosix(path$2, allowAboveRoot) {
|
|
42354
42354
|
let res = "";
|
|
42355
42355
|
let lastSegmentLength = 0;
|
|
42356
42356
|
let lastSlash = -1;
|
|
42357
42357
|
let dots = 0;
|
|
42358
42358
|
let code;
|
|
42359
|
-
for (let i = 0; i <= path.length; ++i) {
|
|
42360
|
-
if (i < path.length) code = path.charCodeAt(i);
|
|
42359
|
+
for (let i = 0; i <= path$2.length; ++i) {
|
|
42360
|
+
if (i < path$2.length) code = path$2.charCodeAt(i);
|
|
42361
42361
|
else if (code === 47) break;
|
|
42362
42362
|
else code = 47;
|
|
42363
42363
|
if (code === 47) {
|
|
@@ -42391,8 +42391,8 @@ function normalizeStringPosix(path, allowAboveRoot) {
|
|
|
42391
42391
|
lastSegmentLength = 2;
|
|
42392
42392
|
}
|
|
42393
42393
|
} else {
|
|
42394
|
-
if (res.length > 0) res += "/" + path.slice(lastSlash + 1, i);
|
|
42395
|
-
else res = path.slice(lastSlash + 1, i);
|
|
42394
|
+
if (res.length > 0) res += "/" + path$2.slice(lastSlash + 1, i);
|
|
42395
|
+
else res = path$2.slice(lastSlash + 1, i);
|
|
42396
42396
|
lastSegmentLength = i - lastSlash - 1;
|
|
42397
42397
|
}
|
|
42398
42398
|
lastSlash = i;
|
|
@@ -42436,16 +42436,16 @@ const resolve = function resolve$3() {
|
|
|
42436
42436
|
let resolvedAbsolute = false;
|
|
42437
42437
|
let cwd = void 0;
|
|
42438
42438
|
for (let i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
42439
|
-
let path;
|
|
42440
|
-
if (i >= 0) path = arguments[i];
|
|
42439
|
+
let path$2;
|
|
42440
|
+
if (i >= 0) path$2 = arguments[i];
|
|
42441
42441
|
else {
|
|
42442
42442
|
const process$1 = globalThis.process;
|
|
42443
42443
|
if (cwd === void 0 && "process" in globalThis && typeof process$1 === "object" && process$1 !== null && typeof process$1.cwd === "function") cwd = process$1.cwd();
|
|
42444
|
-
path = cwd;
|
|
42444
|
+
path$2 = cwd;
|
|
42445
42445
|
}
|
|
42446
|
-
if (path.length === 0) continue;
|
|
42447
|
-
resolvedPath = path + "/" + resolvedPath;
|
|
42448
|
-
resolvedAbsolute = path.charCodeAt(0) === 47;
|
|
42446
|
+
if (path$2.length === 0) continue;
|
|
42447
|
+
resolvedPath = path$2 + "/" + resolvedPath;
|
|
42448
|
+
resolvedAbsolute = path$2.charCodeAt(0) === 47;
|
|
42449
42449
|
}
|
|
42450
42450
|
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
42451
42451
|
if (resolvedAbsolute) if (resolvedPath.length > 0) return "/" + resolvedPath;
|
|
@@ -42477,18 +42477,18 @@ function encodePathChars(filepath) {
|
|
|
42477
42477
|
const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
42478
42478
|
[TypeId$25]: TypeId$25,
|
|
42479
42479
|
resolve,
|
|
42480
|
-
normalize(path) {
|
|
42481
|
-
if (path.length === 0) return ".";
|
|
42482
|
-
const isAbsolute = path.charCodeAt(0) === 47;
|
|
42483
|
-
const trailingSeparator = path.charCodeAt(path.length - 1) === 47;
|
|
42484
|
-
path = normalizeStringPosix(path, !isAbsolute);
|
|
42485
|
-
if (path.length === 0 && !isAbsolute) path = ".";
|
|
42486
|
-
if (path.length > 0 && trailingSeparator) path += "/";
|
|
42487
|
-
if (isAbsolute) return "/" + path;
|
|
42488
|
-
return path;
|
|
42480
|
+
normalize(path$2) {
|
|
42481
|
+
if (path$2.length === 0) return ".";
|
|
42482
|
+
const isAbsolute = path$2.charCodeAt(0) === 47;
|
|
42483
|
+
const trailingSeparator = path$2.charCodeAt(path$2.length - 1) === 47;
|
|
42484
|
+
path$2 = normalizeStringPosix(path$2, !isAbsolute);
|
|
42485
|
+
if (path$2.length === 0 && !isAbsolute) path$2 = ".";
|
|
42486
|
+
if (path$2.length > 0 && trailingSeparator) path$2 += "/";
|
|
42487
|
+
if (isAbsolute) return "/" + path$2;
|
|
42488
|
+
return path$2;
|
|
42489
42489
|
},
|
|
42490
|
-
isAbsolute(path) {
|
|
42491
|
-
return path.length > 0 && path.charCodeAt(0) === 47;
|
|
42490
|
+
isAbsolute(path$2) {
|
|
42491
|
+
return path$2.length > 0 && path$2.charCodeAt(0) === 47;
|
|
42492
42492
|
},
|
|
42493
42493
|
join() {
|
|
42494
42494
|
if (arguments.length === 0) return ".";
|
|
@@ -42541,14 +42541,14 @@ const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
|
42541
42541
|
return to.slice(toStart);
|
|
42542
42542
|
}
|
|
42543
42543
|
},
|
|
42544
|
-
dirname(path) {
|
|
42545
|
-
if (path.length === 0) return ".";
|
|
42546
|
-
let code = path.charCodeAt(0);
|
|
42544
|
+
dirname(path$2) {
|
|
42545
|
+
if (path$2.length === 0) return ".";
|
|
42546
|
+
let code = path$2.charCodeAt(0);
|
|
42547
42547
|
const hasRoot = code === 47;
|
|
42548
42548
|
let end$1 = -1;
|
|
42549
42549
|
let matchedSlash = true;
|
|
42550
|
-
for (let i = path.length - 1; i >= 1; --i) {
|
|
42551
|
-
code = path.charCodeAt(i);
|
|
42550
|
+
for (let i = path$2.length - 1; i >= 1; --i) {
|
|
42551
|
+
code = path$2.charCodeAt(i);
|
|
42552
42552
|
if (code === 47) {
|
|
42553
42553
|
if (!matchedSlash) {
|
|
42554
42554
|
end$1 = i;
|
|
@@ -42558,19 +42558,19 @@ const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
|
42558
42558
|
}
|
|
42559
42559
|
if (end$1 === -1) return hasRoot ? "/" : ".";
|
|
42560
42560
|
if (hasRoot && end$1 === 1) return "//";
|
|
42561
|
-
return path.slice(0, end$1);
|
|
42561
|
+
return path$2.slice(0, end$1);
|
|
42562
42562
|
},
|
|
42563
|
-
basename(path, ext) {
|
|
42563
|
+
basename(path$2, ext) {
|
|
42564
42564
|
let start = 0;
|
|
42565
42565
|
let end$1 = -1;
|
|
42566
42566
|
let matchedSlash = true;
|
|
42567
42567
|
let i;
|
|
42568
|
-
if (ext !== void 0 && ext.length > 0 && ext.length <= path.length) {
|
|
42569
|
-
if (ext.length === path.length && ext === path) return "";
|
|
42568
|
+
if (ext !== void 0 && ext.length > 0 && ext.length <= path$2.length) {
|
|
42569
|
+
if (ext.length === path$2.length && ext === path$2) return "";
|
|
42570
42570
|
let extIdx = ext.length - 1;
|
|
42571
42571
|
let firstNonSlashEnd = -1;
|
|
42572
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
42573
|
-
const code = path.charCodeAt(i);
|
|
42572
|
+
for (i = path$2.length - 1; i >= 0; --i) {
|
|
42573
|
+
const code = path$2.charCodeAt(i);
|
|
42574
42574
|
if (code === 47) {
|
|
42575
42575
|
if (!matchedSlash) {
|
|
42576
42576
|
start = i + 1;
|
|
@@ -42590,10 +42590,10 @@ const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
|
42590
42590
|
}
|
|
42591
42591
|
}
|
|
42592
42592
|
if (start === end$1) end$1 = firstNonSlashEnd;
|
|
42593
|
-
else if (end$1 === -1) end$1 = path.length;
|
|
42594
|
-
return path.slice(start, end$1);
|
|
42593
|
+
else if (end$1 === -1) end$1 = path$2.length;
|
|
42594
|
+
return path$2.slice(start, end$1);
|
|
42595
42595
|
} else {
|
|
42596
|
-
for (i = path.length - 1; i >= 0; --i) if (path.charCodeAt(i) === 47) {
|
|
42596
|
+
for (i = path$2.length - 1; i >= 0; --i) if (path$2.charCodeAt(i) === 47) {
|
|
42597
42597
|
if (!matchedSlash) {
|
|
42598
42598
|
start = i + 1;
|
|
42599
42599
|
break;
|
|
@@ -42603,17 +42603,17 @@ const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
|
42603
42603
|
end$1 = i + 1;
|
|
42604
42604
|
}
|
|
42605
42605
|
if (end$1 === -1) return "";
|
|
42606
|
-
return path.slice(start, end$1);
|
|
42606
|
+
return path$2.slice(start, end$1);
|
|
42607
42607
|
}
|
|
42608
42608
|
},
|
|
42609
|
-
extname(path) {
|
|
42609
|
+
extname(path$2) {
|
|
42610
42610
|
let startDot = -1;
|
|
42611
42611
|
let startPart = 0;
|
|
42612
42612
|
let end$1 = -1;
|
|
42613
42613
|
let matchedSlash = true;
|
|
42614
42614
|
let preDotState = 0;
|
|
42615
|
-
for (let i = path.length - 1; i >= 0; --i) {
|
|
42616
|
-
const code = path.charCodeAt(i);
|
|
42615
|
+
for (let i = path$2.length - 1; i >= 0; --i) {
|
|
42616
|
+
const code = path$2.charCodeAt(i);
|
|
42617
42617
|
if (code === 47) {
|
|
42618
42618
|
if (!matchedSlash) {
|
|
42619
42619
|
startPart = i + 1;
|
|
@@ -42631,13 +42631,13 @@ const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
|
42631
42631
|
} else if (startDot !== -1) preDotState = -1;
|
|
42632
42632
|
}
|
|
42633
42633
|
if (startDot === -1 || end$1 === -1 || preDotState === 0 || preDotState === 1 && startDot === end$1 - 1 && startDot === startPart + 1) return "";
|
|
42634
|
-
return path.slice(startDot, end$1);
|
|
42634
|
+
return path$2.slice(startDot, end$1);
|
|
42635
42635
|
},
|
|
42636
42636
|
format: function format$3(pathObject) {
|
|
42637
42637
|
if (pathObject === null || typeof pathObject !== "object") throw new TypeError("The \"pathObject\" argument must be of type Object. Received type " + typeof pathObject);
|
|
42638
42638
|
return _format("/", pathObject);
|
|
42639
42639
|
},
|
|
42640
|
-
parse(path) {
|
|
42640
|
+
parse(path$2) {
|
|
42641
42641
|
const ret = {
|
|
42642
42642
|
root: "",
|
|
42643
42643
|
dir: "",
|
|
@@ -42645,8 +42645,8 @@ const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
|
42645
42645
|
ext: "",
|
|
42646
42646
|
name: ""
|
|
42647
42647
|
};
|
|
42648
|
-
if (path.length === 0) return ret;
|
|
42649
|
-
let code = path.charCodeAt(0);
|
|
42648
|
+
if (path$2.length === 0) return ret;
|
|
42649
|
+
let code = path$2.charCodeAt(0);
|
|
42650
42650
|
const isAbsolute = code === 47;
|
|
42651
42651
|
let start;
|
|
42652
42652
|
if (isAbsolute) {
|
|
@@ -42657,10 +42657,10 @@ const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
|
42657
42657
|
let startPart = 0;
|
|
42658
42658
|
let end$1 = -1;
|
|
42659
42659
|
let matchedSlash = true;
|
|
42660
|
-
let i = path.length - 1;
|
|
42660
|
+
let i = path$2.length - 1;
|
|
42661
42661
|
let preDotState = 0;
|
|
42662
42662
|
for (; i >= start; --i) {
|
|
42663
|
-
code = path.charCodeAt(i);
|
|
42663
|
+
code = path$2.charCodeAt(i);
|
|
42664
42664
|
if (code === 47) {
|
|
42665
42665
|
if (!matchedSlash) {
|
|
42666
42666
|
startPart = i + 1;
|
|
@@ -42678,19 +42678,19 @@ const posixImpl = /* @__PURE__ */ Path$1.of({
|
|
|
42678
42678
|
} else if (startDot !== -1) preDotState = -1;
|
|
42679
42679
|
}
|
|
42680
42680
|
if (startDot === -1 || end$1 === -1 || preDotState === 0 || preDotState === 1 && startDot === end$1 - 1 && startDot === startPart + 1) {
|
|
42681
|
-
if (end$1 !== -1) if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end$1);
|
|
42682
|
-
else ret.base = ret.name = path.slice(startPart, end$1);
|
|
42681
|
+
if (end$1 !== -1) if (startPart === 0 && isAbsolute) ret.base = ret.name = path$2.slice(1, end$1);
|
|
42682
|
+
else ret.base = ret.name = path$2.slice(startPart, end$1);
|
|
42683
42683
|
} else {
|
|
42684
42684
|
if (startPart === 0 && isAbsolute) {
|
|
42685
|
-
ret.name = path.slice(1, startDot);
|
|
42686
|
-
ret.base = path.slice(1, end$1);
|
|
42685
|
+
ret.name = path$2.slice(1, startDot);
|
|
42686
|
+
ret.base = path$2.slice(1, end$1);
|
|
42687
42687
|
} else {
|
|
42688
|
-
ret.name = path.slice(startPart, startDot);
|
|
42689
|
-
ret.base = path.slice(startPart, end$1);
|
|
42688
|
+
ret.name = path$2.slice(startPart, startDot);
|
|
42689
|
+
ret.base = path$2.slice(startPart, end$1);
|
|
42690
42690
|
}
|
|
42691
|
-
ret.ext = path.slice(startDot, end$1);
|
|
42691
|
+
ret.ext = path$2.slice(startDot, end$1);
|
|
42692
42692
|
}
|
|
42693
|
-
if (startPart > 0) ret.dir = path.slice(0, startPart - 1);
|
|
42693
|
+
if (startPart > 0) ret.dir = path$2.slice(0, startPart - 1);
|
|
42694
42694
|
else if (isAbsolute) ret.dir = "/";
|
|
42695
42695
|
return ret;
|
|
42696
42696
|
},
|
|
@@ -42754,10 +42754,10 @@ function make$27(get$8, mapInput$1, prefix$1) {
|
|
|
42754
42754
|
self$1.get = get$8;
|
|
42755
42755
|
self$1.mapInput = mapInput$1;
|
|
42756
42756
|
self$1.prefix = prefix$1;
|
|
42757
|
-
self$1.load = (path) => {
|
|
42758
|
-
if (mapInput$1) path = mapInput$1(path);
|
|
42759
|
-
if (prefix$1) path = [...prefix$1, ...path];
|
|
42760
|
-
return get$8(path);
|
|
42757
|
+
self$1.load = (path$2) => {
|
|
42758
|
+
if (mapInput$1) path$2 = mapInput$1(path$2);
|
|
42759
|
+
if (prefix$1) path$2 = [...prefix$1, ...path$2];
|
|
42760
|
+
return get$8(path$2);
|
|
42761
42761
|
};
|
|
42762
42762
|
return self$1;
|
|
42763
42763
|
}
|
|
@@ -42776,7 +42776,7 @@ function fromEnv(options) {
|
|
|
42776
42776
|
...import.meta?.env
|
|
42777
42777
|
};
|
|
42778
42778
|
const trie = buildEnvTrie(env);
|
|
42779
|
-
return make$27((path) => succeed(nodeAtEnv(trie, env, path)));
|
|
42779
|
+
return make$27((path$2) => succeed(nodeAtEnv(trie, env, path$2)));
|
|
42780
42780
|
}
|
|
42781
42781
|
function buildEnvTrie(env) {
|
|
42782
42782
|
const root$1 = {};
|
|
@@ -42793,18 +42793,18 @@ function buildEnvTrie(env) {
|
|
|
42793
42793
|
return root$1;
|
|
42794
42794
|
}
|
|
42795
42795
|
const NUMERIC_INDEX = /^(0|[1-9][0-9]*)$/;
|
|
42796
|
-
function nodeAtEnv(trie, env, path) {
|
|
42797
|
-
const leafValue = env[path.map(String).join("_")];
|
|
42798
|
-
const trieNode = trieNodeAt(trie, path);
|
|
42796
|
+
function nodeAtEnv(trie, env, path$2) {
|
|
42797
|
+
const leafValue = env[path$2.map(String).join("_")];
|
|
42798
|
+
const trieNode = trieNodeAt(trie, path$2);
|
|
42799
42799
|
const children = trieNode?.children ? Object.keys(trieNode.children) : [];
|
|
42800
42800
|
if (children.length === 0) return leafValue === void 0 ? void 0 : makeValue(leafValue);
|
|
42801
42801
|
if (children.every((k) => NUMERIC_INDEX.test(k))) return makeArray(Math.max(...children.map((k) => parseInt(k, 10))) + 1, leafValue);
|
|
42802
42802
|
return makeRecord(new Set(children), leafValue);
|
|
42803
42803
|
}
|
|
42804
|
-
function trieNodeAt(root$1, path) {
|
|
42805
|
-
if (path.length === 0) return root$1;
|
|
42804
|
+
function trieNodeAt(root$1, path$2) {
|
|
42805
|
+
if (path$2.length === 0) return root$1;
|
|
42806
42806
|
let node = root$1;
|
|
42807
|
-
for (const seg of path) {
|
|
42807
|
+
for (const seg of path$2) {
|
|
42808
42808
|
node = node?.children?.[String(seg)];
|
|
42809
42809
|
if (!node) return void 0;
|
|
42810
42810
|
}
|
|
@@ -43242,6 +43242,48 @@ const choice$2 = (choices) => {
|
|
|
43242
43242
|
});
|
|
43243
43243
|
};
|
|
43244
43244
|
/**
|
|
43245
|
+
* Creates a primitive that validates and resolves file system paths.
|
|
43246
|
+
*
|
|
43247
|
+
* @example
|
|
43248
|
+
* ```ts
|
|
43249
|
+
* import { Effect } from "effect"
|
|
43250
|
+
* import { Primitive } from "effect/unstable/cli"
|
|
43251
|
+
*
|
|
43252
|
+
* const program = Effect.gen(function*() {
|
|
43253
|
+
* // Parse a file path that must exist
|
|
43254
|
+
* const filePrimitive = Primitive.path("file", true)
|
|
43255
|
+
* const filePath = yield* filePrimitive.parse("./package.json")
|
|
43256
|
+
* console.log(filePath) // Absolute path to package.json
|
|
43257
|
+
*
|
|
43258
|
+
* // Parse a directory path
|
|
43259
|
+
* const dirPrimitive = Primitive.path("directory", false)
|
|
43260
|
+
* const dirPath = yield* dirPrimitive.parse("./src")
|
|
43261
|
+
* console.log(dirPath) // Absolute path to src directory
|
|
43262
|
+
*
|
|
43263
|
+
* // Parse any path type
|
|
43264
|
+
* const anyPrimitive = Primitive.path("either", false)
|
|
43265
|
+
* const anyPath = yield* anyPrimitive.parse("./some/path")
|
|
43266
|
+
* console.log(anyPath) // Absolute path
|
|
43267
|
+
* })
|
|
43268
|
+
* ```
|
|
43269
|
+
*
|
|
43270
|
+
* @since 4.0.0
|
|
43271
|
+
* @category constructors
|
|
43272
|
+
*/
|
|
43273
|
+
const path$1 = (pathType, mustExist) => makePrimitive("Path", fnUntraced(function* (value) {
|
|
43274
|
+
const fs = yield* FileSystem;
|
|
43275
|
+
const path$2 = yield* Path$1;
|
|
43276
|
+
const absolutePath = path$2.isAbsolute(value) ? value : path$2.resolve(value);
|
|
43277
|
+
const exists = yield* mapError$2(fs.exists(absolutePath), (error$1) => `Failed to check path existence: ${error$1.message}`);
|
|
43278
|
+
if (mustExist === true && !exists) return yield* fail$3(`Path does not exist: ${absolutePath}`);
|
|
43279
|
+
if (exists && pathType !== "either") {
|
|
43280
|
+
const stat$1 = yield* mapError$2(fs.stat(absolutePath), (error$1) => `Failed to stat path: ${error$1.message}`);
|
|
43281
|
+
if (pathType === "file" && stat$1.type !== "File") return yield* fail$3(`Path is not a file: ${absolutePath}`);
|
|
43282
|
+
if (pathType === "directory" && stat$1.type !== "Directory") return yield* fail$3(`Path is not a directory: ${absolutePath}`);
|
|
43283
|
+
}
|
|
43284
|
+
return absolutePath;
|
|
43285
|
+
}));
|
|
43286
|
+
/**
|
|
43245
43287
|
* A sentinel primitive that always fails to parse a value.
|
|
43246
43288
|
*
|
|
43247
43289
|
* Used for flags that don't accept values.
|
|
@@ -43520,6 +43562,67 @@ const choice$1 = (kind, name, choices) => {
|
|
|
43520
43562
|
return choiceWithValue$1(kind, name, choices.map((value) => [value, value]));
|
|
43521
43563
|
};
|
|
43522
43564
|
/**
|
|
43565
|
+
* Creates a path parameter that accepts file or directory paths.
|
|
43566
|
+
*
|
|
43567
|
+
* @example
|
|
43568
|
+
* ```ts
|
|
43569
|
+
* import * as Param from "effect/unstable/cli/Param"
|
|
43570
|
+
*
|
|
43571
|
+
* // @internal - this module is not exported publicly
|
|
43572
|
+
*
|
|
43573
|
+
* // Basic path parameter
|
|
43574
|
+
* const outputPath = Param.path(Param.flagKind, "output")
|
|
43575
|
+
*
|
|
43576
|
+
* // Path that must exist
|
|
43577
|
+
* const inputPath = Param.path(Param.flagKind, "input", { mustExist: true })
|
|
43578
|
+
*
|
|
43579
|
+
* // File-only path
|
|
43580
|
+
* const configFile = Param.path(Param.flagKind, "config", {
|
|
43581
|
+
* pathType: "file",
|
|
43582
|
+
* mustExist: true,
|
|
43583
|
+
* typeName: "config-file"
|
|
43584
|
+
* })
|
|
43585
|
+
* ```
|
|
43586
|
+
*
|
|
43587
|
+
* @since 4.0.0
|
|
43588
|
+
* @category constructors
|
|
43589
|
+
*/
|
|
43590
|
+
const path = (kind, name, options) => makeSingle({
|
|
43591
|
+
name,
|
|
43592
|
+
kind,
|
|
43593
|
+
primitiveType: path$1(options?.pathType ?? "either", options?.mustExist),
|
|
43594
|
+
typeName: options?.typeName
|
|
43595
|
+
});
|
|
43596
|
+
/**
|
|
43597
|
+
* Creates a directory path parameter.
|
|
43598
|
+
*
|
|
43599
|
+
* This is a convenience function that creates a path parameter with the
|
|
43600
|
+
* `pathType` set to `"directory"` and a default type name of `"directory"`.
|
|
43601
|
+
*
|
|
43602
|
+
* @example
|
|
43603
|
+
* ```ts
|
|
43604
|
+
* import * as Param from "effect/unstable/cli/Param"
|
|
43605
|
+
*
|
|
43606
|
+
* // @internal - this module is not exported publicly
|
|
43607
|
+
*
|
|
43608
|
+
* // Basic directory parameter
|
|
43609
|
+
* const outputDir = Param.directory(Param.flagKind, "output-dir")
|
|
43610
|
+
*
|
|
43611
|
+
* // Directory that must exist
|
|
43612
|
+
* const sourceDir = Param.directory(Param.flagKind, "source", { mustExist: true })
|
|
43613
|
+
*
|
|
43614
|
+
* // Usage: --output-dir /path/to/dir --source /existing/dir
|
|
43615
|
+
* ```
|
|
43616
|
+
*
|
|
43617
|
+
* @since 4.0.0
|
|
43618
|
+
* @category constructors
|
|
43619
|
+
*/
|
|
43620
|
+
const directory$1 = (kind, name, options) => path(kind, name, {
|
|
43621
|
+
pathType: "directory",
|
|
43622
|
+
typeName: "directory",
|
|
43623
|
+
mustExist: options?.mustExist
|
|
43624
|
+
});
|
|
43625
|
+
/**
|
|
43523
43626
|
* Creates an empty sentinel parameter that always fails to parse.
|
|
43524
43627
|
*
|
|
43525
43628
|
* This is useful for creating placeholder parameters or for combinators.
|
|
@@ -45079,6 +45182,26 @@ const choiceWithValue = (name, choices) => choiceWithValue$1(flagKind, name, cho
|
|
|
45079
45182
|
*/
|
|
45080
45183
|
const choice = (name, choices) => choice$1(flagKind, name, choices);
|
|
45081
45184
|
/**
|
|
45185
|
+
* Creates a directory path flag that accepts directory paths with optional existence validation.
|
|
45186
|
+
*
|
|
45187
|
+
* @example
|
|
45188
|
+
* ```ts
|
|
45189
|
+
* import { Flag } from "effect/unstable/cli"
|
|
45190
|
+
*
|
|
45191
|
+
* // Basic directory flag
|
|
45192
|
+
* const outputFlag = Flag.directory("output")
|
|
45193
|
+
* // Usage: --output ./build
|
|
45194
|
+
*
|
|
45195
|
+
* // Directory that must exist
|
|
45196
|
+
* const sourceFlag = Flag.directory("source", { mustExist: true })
|
|
45197
|
+
* // Usage: --source ./src (directory must exist)
|
|
45198
|
+
* ```
|
|
45199
|
+
*
|
|
45200
|
+
* @since 4.0.0
|
|
45201
|
+
* @category constructors
|
|
45202
|
+
*/
|
|
45203
|
+
const directory = (name, options) => directory$1(flagKind, name, options);
|
|
45204
|
+
/**
|
|
45082
45205
|
* Creates an empty sentinel flag that always fails to parse.
|
|
45083
45206
|
* This is useful for creating placeholder flags or for combinators.
|
|
45084
45207
|
*
|
|
@@ -46273,14 +46396,14 @@ const withSubcommands = /* @__PURE__ */ dual(2, (self$1, subcommands) => {
|
|
|
46273
46396
|
result: result$2
|
|
46274
46397
|
} });
|
|
46275
46398
|
});
|
|
46276
|
-
const handle = fnUntraced(function* (input, path) {
|
|
46399
|
+
const handle = fnUntraced(function* (input, path$2) {
|
|
46277
46400
|
const internal = input;
|
|
46278
46401
|
if (internal._subcommand) {
|
|
46279
46402
|
const child = byName.get(internal._subcommand.name);
|
|
46280
|
-
if (!child) return yield* new ShowHelp({ commandPath: path });
|
|
46281
|
-
return yield* child.handle(internal._subcommand.result, [...path, child.name]).pipe(provideService(impl.service, input));
|
|
46403
|
+
if (!child) return yield* new ShowHelp({ commandPath: path$2 });
|
|
46404
|
+
return yield* child.handle(internal._subcommand.result, [...path$2, child.name]).pipe(provideService(impl.service, input));
|
|
46282
46405
|
}
|
|
46283
|
-
return yield* impl.handle(input, path);
|
|
46406
|
+
return yield* impl.handle(input, path$2);
|
|
46284
46407
|
});
|
|
46285
46408
|
return makeCommand({
|
|
46286
46409
|
name: impl.name,
|
|
@@ -46324,7 +46447,7 @@ const mapHandler = (self$1, f) => {
|
|
|
46324
46447
|
const impl = toImpl(self$1);
|
|
46325
46448
|
return makeCommand({
|
|
46326
46449
|
...impl,
|
|
46327
|
-
handle: (input, path) => f(impl.handle(input, path), input)
|
|
46450
|
+
handle: (input, path$2) => f(impl.handle(input, path$2), input)
|
|
46328
46451
|
});
|
|
46329
46452
|
};
|
|
46330
46453
|
/**
|
|
@@ -47157,11 +47280,11 @@ const prefix = /* @__PURE__ */ dual(2, (self$1, prefix$1) => ({
|
|
|
47157
47280
|
* @since 4.0.0
|
|
47158
47281
|
* @category layers
|
|
47159
47282
|
*/
|
|
47160
|
-
const layerFileSystem = (directory) => effect(KeyValueStore)(gen(function* () {
|
|
47283
|
+
const layerFileSystem = (directory$2) => effect(KeyValueStore)(gen(function* () {
|
|
47161
47284
|
const fs = yield* FileSystem;
|
|
47162
|
-
const path = yield* Path$1;
|
|
47163
|
-
const keyPath = (key) => path.join(directory, encodeURIComponent(key));
|
|
47164
|
-
if (!(yield* fs.exists(directory))) yield* fs.makeDirectory(directory, { recursive: true });
|
|
47285
|
+
const path$2 = yield* Path$1;
|
|
47286
|
+
const keyPath = (key) => path$2.join(directory$2, encodeURIComponent(key));
|
|
47287
|
+
if (!(yield* fs.exists(directory$2))) yield* fs.makeDirectory(directory$2, { recursive: true });
|
|
47165
47288
|
return make$22({
|
|
47166
47289
|
get: (key) => catchTag(fs.readFileString(keyPath(key)), "PlatformError", (cause) => cause.reason === "NotFound" ? undefined_$1 : fail$3(new KeyValueStoreError({
|
|
47167
47290
|
method: "get",
|
|
@@ -47193,12 +47316,12 @@ const layerFileSystem = (directory) => effect(KeyValueStore)(gen(function* () {
|
|
|
47193
47316
|
message: `Unable to check existence of item with key ${key}`,
|
|
47194
47317
|
cause
|
|
47195
47318
|
})),
|
|
47196
|
-
clear: mapError$2(andThen(fs.remove(directory, { recursive: true }), fs.makeDirectory(directory, { recursive: true })), (cause) => new KeyValueStoreError({
|
|
47319
|
+
clear: mapError$2(andThen(fs.remove(directory$2, { recursive: true }), fs.makeDirectory(directory$2, { recursive: true })), (cause) => new KeyValueStoreError({
|
|
47197
47320
|
method: "clear",
|
|
47198
47321
|
message: `Unable to clear storage`,
|
|
47199
47322
|
cause
|
|
47200
47323
|
})),
|
|
47201
|
-
size: matchEffect(fs.readDirectory(directory), {
|
|
47324
|
+
size: matchEffect(fs.readDirectory(directory$2), {
|
|
47202
47325
|
onSuccess: (files) => succeed(files.length),
|
|
47203
47326
|
onFailure: (cause) => fail$3(new KeyValueStoreError({
|
|
47204
47327
|
method: "size",
|
|
@@ -48728,11 +48851,11 @@ var Mime = class {
|
|
|
48728
48851
|
}
|
|
48729
48852
|
return this;
|
|
48730
48853
|
}
|
|
48731
|
-
getType(path) {
|
|
48732
|
-
if (typeof path !== "string") return null;
|
|
48733
|
-
const last$1 = path.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
48854
|
+
getType(path$2) {
|
|
48855
|
+
if (typeof path$2 !== "string") return null;
|
|
48856
|
+
const last$1 = path$2.replace(/^.*[/\\]/s, "").toLowerCase();
|
|
48734
48857
|
const ext = last$1.replace(/^.*\./s, "").toLowerCase();
|
|
48735
|
-
const hasPath = last$1.length < path.length;
|
|
48858
|
+
const hasPath = last$1.length < path$2.length;
|
|
48736
48859
|
if (!(ext.length < last$1.length - 1) && hasPath) return null;
|
|
48737
48860
|
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
48738
48861
|
}
|
|
@@ -49105,7 +49228,7 @@ const concatTokens = (prevTokens, nextTokens, isSeparated) => isSeparated || pre
|
|
|
49105
49228
|
//#endregion
|
|
49106
49229
|
//#region node_modules/.pnpm/@effect+platform-node-shared@https+++pkg.pr.new+Effect-TS+effect-smol+@effect+platform-_54df9a1830a145bfb881d9dab26a21ab/node_modules/@effect/platform-node-shared/dist/internal/utils.js
|
|
49107
49230
|
/** @internal */
|
|
49108
|
-
const handleErrnoException = (module$1, method) => (err, [path]) => {
|
|
49231
|
+
const handleErrnoException = (module$1, method) => (err, [path$2]) => {
|
|
49109
49232
|
let reason = "Unknown";
|
|
49110
49233
|
switch (err.code) {
|
|
49111
49234
|
case "ENOENT":
|
|
@@ -49134,7 +49257,7 @@ const handleErrnoException = (module$1, method) => (err, [path]) => {
|
|
|
49134
49257
|
reason,
|
|
49135
49258
|
module: module$1,
|
|
49136
49259
|
method,
|
|
49137
|
-
pathOrDescriptor: path,
|
|
49260
|
+
pathOrDescriptor: path$2,
|
|
49138
49261
|
syscall: err.syscall,
|
|
49139
49262
|
cause: err
|
|
49140
49263
|
});
|
|
@@ -49323,7 +49446,7 @@ const toPlatformError = (method, error$1, command) => {
|
|
|
49323
49446
|
};
|
|
49324
49447
|
const make$20 = /* @__PURE__ */ gen(function* () {
|
|
49325
49448
|
const fs = yield* FileSystem;
|
|
49326
|
-
const path = yield* Path$1;
|
|
49449
|
+
const path$2 = yield* Path$1;
|
|
49327
49450
|
const resolveCommand = fnUntraced(function* (command) {
|
|
49328
49451
|
if (isStandardCommand(command)) return command;
|
|
49329
49452
|
const parsed = yield* sync(() => parseTemplates(command.templates, command.expressions));
|
|
@@ -49332,7 +49455,7 @@ const make$20 = /* @__PURE__ */ gen(function* () {
|
|
|
49332
49455
|
const resolveWorkingDirectory = fnUntraced(function* (options) {
|
|
49333
49456
|
if (isUndefined(options.cwd)) return void 0;
|
|
49334
49457
|
yield* fs.access(options.cwd);
|
|
49335
|
-
return path.resolve(options.cwd);
|
|
49458
|
+
return path$2.resolve(options.cwd);
|
|
49336
49459
|
});
|
|
49337
49460
|
const resolveEnvironment = (options) => {
|
|
49338
49461
|
return options.extendEnv ? {
|
|
@@ -50749,7 +50872,7 @@ const setUrl = /* @__PURE__ */ dual(2, (self$1, url) => {
|
|
|
50749
50872
|
* @since 4.0.0
|
|
50750
50873
|
* @category combinators
|
|
50751
50874
|
*/
|
|
50752
|
-
const prependUrl = /* @__PURE__ */ dual(2, (self$1, path) => makeProto(self$1.method, path.endsWith("/") && self$1.url.startsWith("/") ? path + self$1.url.slice(1) : path + self$1.url, self$1.urlParams, self$1.hash, self$1.headers, self$1.body));
|
|
50875
|
+
const prependUrl = /* @__PURE__ */ dual(2, (self$1, path$2) => makeProto(self$1.method, path$2.endsWith("/") && self$1.url.startsWith("/") ? path$2 + self$1.url.slice(1) : path$2 + self$1.url, self$1.urlParams, self$1.hash, self$1.headers, self$1.body));
|
|
50753
50876
|
/**
|
|
50754
50877
|
* @since 4.0.0
|
|
50755
50878
|
* @category combinators
|
|
@@ -51369,27 +51492,27 @@ var RouterImpl = class {
|
|
|
51369
51492
|
options;
|
|
51370
51493
|
routes = [];
|
|
51371
51494
|
trees = {};
|
|
51372
|
-
on(method, path, handler$1) {
|
|
51373
|
-
const optionalParamMatch = path.match(OPTIONAL_PARAM_REGEXP);
|
|
51495
|
+
on(method, path$2, handler$1) {
|
|
51496
|
+
const optionalParamMatch = path$2.match(OPTIONAL_PARAM_REGEXP);
|
|
51374
51497
|
if (optionalParamMatch && optionalParamMatch.index !== void 0) {
|
|
51375
|
-
assert(path.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
|
|
51376
|
-
const pathFull = path.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
|
|
51377
|
-
const pathOptional = path.replace(OPTIONAL_PARAM_REGEXP, "$2");
|
|
51498
|
+
assert(path$2.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
|
|
51499
|
+
const pathFull = path$2.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
|
|
51500
|
+
const pathOptional = path$2.replace(OPTIONAL_PARAM_REGEXP, "$2");
|
|
51378
51501
|
this.on(method, pathFull, handler$1);
|
|
51379
51502
|
this.on(method, pathOptional, handler$1);
|
|
51380
51503
|
return;
|
|
51381
51504
|
}
|
|
51382
|
-
if (this.options.ignoreDuplicateSlashes) path = removeDuplicateSlashes(path);
|
|
51383
|
-
if (this.options.ignoreTrailingSlash) path = trimLastSlash(path);
|
|
51505
|
+
if (this.options.ignoreDuplicateSlashes) path$2 = removeDuplicateSlashes(path$2);
|
|
51506
|
+
if (this.options.ignoreTrailingSlash) path$2 = trimLastSlash(path$2);
|
|
51384
51507
|
const methods = typeof method === "string" ? [method] : method;
|
|
51385
|
-
for (const method$1 of methods) this._on(method$1, path, handler$1);
|
|
51508
|
+
for (const method$1 of methods) this._on(method$1, path$2, handler$1);
|
|
51386
51509
|
}
|
|
51387
|
-
all(path, handler$1) {
|
|
51388
|
-
this.on(httpMethods, path, handler$1);
|
|
51510
|
+
all(path$2, handler$1) {
|
|
51511
|
+
this.on(httpMethods, path$2, handler$1);
|
|
51389
51512
|
}
|
|
51390
|
-
_on(method, path, handler$1) {
|
|
51513
|
+
_on(method, path$2, handler$1) {
|
|
51391
51514
|
if (this.trees[method] === void 0) this.trees[method] = new StaticNode("/");
|
|
51392
|
-
let pattern = path;
|
|
51515
|
+
let pattern = path$2;
|
|
51393
51516
|
if (pattern === "*" && this.trees[method].prefix.length !== 0) {
|
|
51394
51517
|
const currentRoot = this.trees[method];
|
|
51395
51518
|
this.trees[method] = new StaticNode("");
|
|
@@ -51469,7 +51592,7 @@ var RouterImpl = class {
|
|
|
51469
51592
|
for (const existRoute of this.routes) if (existRoute.method === method && existRoute.pattern === pattern) throw new Error(`Method '${method}' already declared for route '${pattern}'`);
|
|
51470
51593
|
const route$1 = {
|
|
51471
51594
|
method,
|
|
51472
|
-
path,
|
|
51595
|
+
path: path$2,
|
|
51473
51596
|
pattern,
|
|
51474
51597
|
params,
|
|
51475
51598
|
handler: handler$1
|
|
@@ -51477,36 +51600,36 @@ var RouterImpl = class {
|
|
|
51477
51600
|
this.routes.push(route$1);
|
|
51478
51601
|
currentNode.addRoute(route$1);
|
|
51479
51602
|
}
|
|
51480
|
-
has(method, path) {
|
|
51603
|
+
has(method, path$2) {
|
|
51481
51604
|
const node = this.trees[method];
|
|
51482
51605
|
if (node === void 0) return false;
|
|
51483
|
-
const staticNode = node.getStaticChild(path);
|
|
51606
|
+
const staticNode = node.getStaticChild(path$2);
|
|
51484
51607
|
if (staticNode === void 0) return false;
|
|
51485
51608
|
return staticNode.isLeafNode;
|
|
51486
51609
|
}
|
|
51487
|
-
find(method, path) {
|
|
51610
|
+
find(method, path$2) {
|
|
51488
51611
|
let currentNode = this.trees[method];
|
|
51489
51612
|
if (currentNode === void 0) return void 0;
|
|
51490
|
-
if (path.charCodeAt(0) !== 47) path = path.replace(FULL_PATH_REGEXP, "/");
|
|
51491
|
-
if (this.options.ignoreDuplicateSlashes) path = removeDuplicateSlashes(path);
|
|
51613
|
+
if (path$2.charCodeAt(0) !== 47) path$2 = path$2.replace(FULL_PATH_REGEXP, "/");
|
|
51614
|
+
if (this.options.ignoreDuplicateSlashes) path$2 = removeDuplicateSlashes(path$2);
|
|
51492
51615
|
let sanitizedUrl;
|
|
51493
51616
|
let querystring;
|
|
51494
51617
|
let shouldDecodeParam;
|
|
51495
51618
|
try {
|
|
51496
|
-
sanitizedUrl = safeDecodeURI(path);
|
|
51497
|
-
path = sanitizedUrl.path;
|
|
51619
|
+
sanitizedUrl = safeDecodeURI(path$2);
|
|
51620
|
+
path$2 = sanitizedUrl.path;
|
|
51498
51621
|
querystring = sanitizedUrl.querystring;
|
|
51499
51622
|
shouldDecodeParam = sanitizedUrl.shouldDecodeParam;
|
|
51500
51623
|
} catch (error$1) {
|
|
51501
51624
|
return;
|
|
51502
51625
|
}
|
|
51503
|
-
if (this.options.ignoreTrailingSlash) path = trimLastSlash(path);
|
|
51504
|
-
const originPath = path;
|
|
51505
|
-
if (this.options.caseSensitive === false) path = path.toLowerCase();
|
|
51626
|
+
if (this.options.ignoreTrailingSlash) path$2 = trimLastSlash(path$2);
|
|
51627
|
+
const originPath = path$2;
|
|
51628
|
+
if (this.options.caseSensitive === false) path$2 = path$2.toLowerCase();
|
|
51506
51629
|
const maxParamLength = this.options.maxParamLength;
|
|
51507
51630
|
let pathIndex = currentNode.prefix.length;
|
|
51508
51631
|
const params = [];
|
|
51509
|
-
const pathLen = path.length;
|
|
51632
|
+
const pathLen = path$2.length;
|
|
51510
51633
|
const brothersNodesStack = [];
|
|
51511
51634
|
while (true) {
|
|
51512
51635
|
if (pathIndex === pathLen && currentNode.isLeafNode) {
|
|
@@ -51517,7 +51640,7 @@ var RouterImpl = class {
|
|
|
51517
51640
|
searchParams: parse$2(querystring)
|
|
51518
51641
|
};
|
|
51519
51642
|
}
|
|
51520
|
-
let node = currentNode.getNextNode(path, pathIndex, brothersNodesStack, params.length);
|
|
51643
|
+
let node = currentNode.getNextNode(path$2, pathIndex, brothersNodesStack, params.length);
|
|
51521
51644
|
if (node === void 0) {
|
|
51522
51645
|
if (brothersNodesStack.length === 0) return;
|
|
51523
51646
|
const brotherNodeState = brothersNodesStack.pop();
|
|
@@ -51589,30 +51712,30 @@ var NodeBase = class {
|
|
|
51589
51712
|
};
|
|
51590
51713
|
var ParentNode = class extends NodeBase {
|
|
51591
51714
|
staticChildren = {};
|
|
51592
|
-
findStaticMatchingChild(path, pathIndex) {
|
|
51593
|
-
const staticChild = this.staticChildren[path.charAt(pathIndex)];
|
|
51594
|
-
if (staticChild === void 0 || !staticChild.matchPrefix(path, pathIndex)) return;
|
|
51715
|
+
findStaticMatchingChild(path$2, pathIndex) {
|
|
51716
|
+
const staticChild = this.staticChildren[path$2.charAt(pathIndex)];
|
|
51717
|
+
if (staticChild === void 0 || !staticChild.matchPrefix(path$2, pathIndex)) return;
|
|
51595
51718
|
return staticChild;
|
|
51596
51719
|
}
|
|
51597
|
-
getStaticChild(path, pathIndex = 0) {
|
|
51598
|
-
if (path.length === pathIndex) return this;
|
|
51599
|
-
const staticChild = this.findStaticMatchingChild(path, pathIndex);
|
|
51720
|
+
getStaticChild(path$2, pathIndex = 0) {
|
|
51721
|
+
if (path$2.length === pathIndex) return this;
|
|
51722
|
+
const staticChild = this.findStaticMatchingChild(path$2, pathIndex);
|
|
51600
51723
|
if (staticChild === void 0) return;
|
|
51601
|
-
return staticChild.getStaticChild(path, pathIndex + staticChild.prefix.length);
|
|
51724
|
+
return staticChild.getStaticChild(path$2, pathIndex + staticChild.prefix.length);
|
|
51602
51725
|
}
|
|
51603
|
-
createStaticChild(path) {
|
|
51604
|
-
if (path.length === 0) return this;
|
|
51605
|
-
let staticChild = this.staticChildren[path.charAt(0)];
|
|
51726
|
+
createStaticChild(path$2) {
|
|
51727
|
+
if (path$2.length === 0) return this;
|
|
51728
|
+
let staticChild = this.staticChildren[path$2.charAt(0)];
|
|
51606
51729
|
if (staticChild) {
|
|
51607
51730
|
let i = 1;
|
|
51608
|
-
for (; i < staticChild.prefix.length; i++) if (path.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
|
|
51731
|
+
for (; i < staticChild.prefix.length; i++) if (path$2.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
|
|
51609
51732
|
staticChild = staticChild.split(this, i);
|
|
51610
51733
|
break;
|
|
51611
51734
|
}
|
|
51612
|
-
return staticChild.createStaticChild(path.slice(i));
|
|
51735
|
+
return staticChild.createStaticChild(path$2.slice(i));
|
|
51613
51736
|
}
|
|
51614
|
-
const label = path.charAt(0);
|
|
51615
|
-
this.staticChildren[label] = new StaticNode(path);
|
|
51737
|
+
const label = path$2.charAt(0);
|
|
51738
|
+
this.staticChildren[label] = new StaticNode(path$2);
|
|
51616
51739
|
return this.staticChildren[label];
|
|
51617
51740
|
}
|
|
51618
51741
|
};
|
|
@@ -51631,8 +51754,8 @@ var StaticNode = class StaticNode extends ParentNode {
|
|
|
51631
51754
|
if (prefix$1.length === 1) this.matchPrefix = (_path, _pathIndex) => true;
|
|
51632
51755
|
else {
|
|
51633
51756
|
const len = prefix$1.length;
|
|
51634
|
-
this.matchPrefix = function(path, pathIndex) {
|
|
51635
|
-
for (let i = 1; i < len; i++) if (path.charCodeAt(pathIndex + i) !== this.prefix.charCodeAt(i)) return false;
|
|
51757
|
+
this.matchPrefix = function(path$2, pathIndex) {
|
|
51758
|
+
for (let i = 1; i < len; i++) if (path$2.charCodeAt(pathIndex + i) !== this.prefix.charCodeAt(i)) return false;
|
|
51636
51759
|
return true;
|
|
51637
51760
|
};
|
|
51638
51761
|
}
|
|
@@ -51677,8 +51800,8 @@ var StaticNode = class StaticNode extends ParentNode {
|
|
|
51677
51800
|
parentNode.staticChildren[parentPrefix.charAt(0)] = staticNode;
|
|
51678
51801
|
return staticNode;
|
|
51679
51802
|
}
|
|
51680
|
-
getNextNode(path, pathIndex, nodeStack, paramsCount) {
|
|
51681
|
-
let node = this.findStaticMatchingChild(path, pathIndex);
|
|
51803
|
+
getNextNode(path$2, pathIndex, nodeStack, paramsCount) {
|
|
51804
|
+
let node = this.findStaticMatchingChild(path$2, pathIndex);
|
|
51682
51805
|
let parametricBrotherNodeIndex = 0;
|
|
51683
51806
|
if (node === void 0) {
|
|
51684
51807
|
if (this.parametricChildren.length === 0) return this.wildcardChild;
|
|
@@ -51711,8 +51834,8 @@ var ParametricNode = class extends ParentNode {
|
|
|
51711
51834
|
}
|
|
51712
51835
|
isRegex;
|
|
51713
51836
|
nodePaths;
|
|
51714
|
-
getNextNode(path, pathIndex) {
|
|
51715
|
-
return this.findStaticMatchingChild(path, pathIndex);
|
|
51837
|
+
getNextNode(path$2, pathIndex) {
|
|
51838
|
+
return this.findStaticMatchingChild(path$2, pathIndex);
|
|
51716
51839
|
}
|
|
51717
51840
|
};
|
|
51718
51841
|
var WildcardNode = class extends NodeBase {
|
|
@@ -51722,12 +51845,12 @@ var WildcardNode = class extends NodeBase {
|
|
|
51722
51845
|
const assert = (condition, message) => {
|
|
51723
51846
|
if (!condition) throw new Error(message);
|
|
51724
51847
|
};
|
|
51725
|
-
function removeDuplicateSlashes(path) {
|
|
51726
|
-
return path.replace(/\/\/+/g, "/");
|
|
51848
|
+
function removeDuplicateSlashes(path$2) {
|
|
51849
|
+
return path$2.replace(/\/\/+/g, "/");
|
|
51727
51850
|
}
|
|
51728
|
-
function trimLastSlash(path) {
|
|
51729
|
-
if (path.length > 1 && path.charCodeAt(path.length - 1) === 47) return path.slice(0, -1);
|
|
51730
|
-
return path;
|
|
51851
|
+
function trimLastSlash(path$2) {
|
|
51852
|
+
if (path$2.length > 1 && path$2.charCodeAt(path$2.length - 1) === 47) return path$2.slice(0, -1);
|
|
51853
|
+
return path$2;
|
|
51731
51854
|
}
|
|
51732
51855
|
function compileCreateParams(params) {
|
|
51733
51856
|
const len = params.length;
|
|
@@ -51737,19 +51860,19 @@ function compileCreateParams(params) {
|
|
|
51737
51860
|
return paramsObject;
|
|
51738
51861
|
};
|
|
51739
51862
|
}
|
|
51740
|
-
function getClosingParenthensePosition(path, idx) {
|
|
51863
|
+
function getClosingParenthensePosition(path$2, idx) {
|
|
51741
51864
|
let parentheses = 1;
|
|
51742
|
-
while (idx < path.length) {
|
|
51865
|
+
while (idx < path$2.length) {
|
|
51743
51866
|
idx++;
|
|
51744
|
-
if (path[idx] === "\\") {
|
|
51867
|
+
if (path$2[idx] === "\\") {
|
|
51745
51868
|
idx++;
|
|
51746
51869
|
continue;
|
|
51747
51870
|
}
|
|
51748
|
-
if (path[idx] === ")") parentheses--;
|
|
51749
|
-
else if (path[idx] === "(") parentheses++;
|
|
51871
|
+
if (path$2[idx] === ")") parentheses--;
|
|
51872
|
+
else if (path$2[idx] === "(") parentheses++;
|
|
51750
51873
|
if (!parentheses) return idx;
|
|
51751
51874
|
}
|
|
51752
|
-
throw new TypeError("Invalid regexp expression in \"" + path + "\"");
|
|
51875
|
+
throw new TypeError("Invalid regexp expression in \"" + path$2 + "\"");
|
|
51753
51876
|
}
|
|
51754
51877
|
function trimRegExpStartAndEnd(regexString) {
|
|
51755
51878
|
if (regexString.charCodeAt(1) === 94) regexString = regexString.slice(0, 1) + regexString.slice(2);
|
|
@@ -51786,33 +51909,33 @@ function decodeComponentChar(highCharCode, lowCharCode) {
|
|
|
51786
51909
|
}
|
|
51787
51910
|
if (highCharCode === 52 && lowCharCode === 48) return "@";
|
|
51788
51911
|
}
|
|
51789
|
-
function safeDecodeURI(path) {
|
|
51912
|
+
function safeDecodeURI(path$2) {
|
|
51790
51913
|
let shouldDecode = false;
|
|
51791
51914
|
let shouldDecodeParam = false;
|
|
51792
51915
|
let querystring = "";
|
|
51793
|
-
for (let i = 1; i < path.length; i++) {
|
|
51794
|
-
const charCode = path.charCodeAt(i);
|
|
51916
|
+
for (let i = 1; i < path$2.length; i++) {
|
|
51917
|
+
const charCode = path$2.charCodeAt(i);
|
|
51795
51918
|
if (charCode === 37) {
|
|
51796
|
-
const highCharCode = path.charCodeAt(i + 1);
|
|
51797
|
-
const lowCharCode = path.charCodeAt(i + 2);
|
|
51919
|
+
const highCharCode = path$2.charCodeAt(i + 1);
|
|
51920
|
+
const lowCharCode = path$2.charCodeAt(i + 2);
|
|
51798
51921
|
if (decodeComponentChar(highCharCode, lowCharCode) === void 0) shouldDecode = true;
|
|
51799
51922
|
else {
|
|
51800
51923
|
shouldDecodeParam = true;
|
|
51801
51924
|
if (highCharCode === 50 && lowCharCode === 53) {
|
|
51802
51925
|
shouldDecode = true;
|
|
51803
|
-
path = path.slice(0, i + 1) + "25" + path.slice(i + 1);
|
|
51926
|
+
path$2 = path$2.slice(0, i + 1) + "25" + path$2.slice(i + 1);
|
|
51804
51927
|
i += 2;
|
|
51805
51928
|
}
|
|
51806
51929
|
i += 2;
|
|
51807
51930
|
}
|
|
51808
51931
|
} else if (charCode === 63 || charCode === 59 || charCode === 35) {
|
|
51809
|
-
querystring = path.slice(i + 1);
|
|
51810
|
-
path = path.slice(0, i);
|
|
51932
|
+
querystring = path$2.slice(i + 1);
|
|
51933
|
+
path$2 = path$2.slice(0, i);
|
|
51811
51934
|
break;
|
|
51812
51935
|
}
|
|
51813
51936
|
}
|
|
51814
51937
|
return {
|
|
51815
|
-
path: shouldDecode ? decodeURI(path) : path,
|
|
51938
|
+
path: shouldDecode ? decodeURI(path$2) : path$2,
|
|
51816
51939
|
querystring,
|
|
51817
51940
|
shouldDecodeParam
|
|
51818
51941
|
};
|
|
@@ -53475,7 +53598,7 @@ var FileImpl$1 = class extends PartBase$1 {
|
|
|
53475
53598
|
};
|
|
53476
53599
|
}
|
|
53477
53600
|
};
|
|
53478
|
-
const defaultWriteFile = (path, file) => flatMap(FileSystem.asEffect(), (fs) => mapError$2(run$4(file.content, fs.sink(path)), (cause) => new MultipartError({
|
|
53601
|
+
const defaultWriteFile = (path$2, file) => flatMap(FileSystem.asEffect(), (fs) => mapError$2(run$4(file.content, fs.sink(path$2)), (cause) => new MultipartError({
|
|
53479
53602
|
reason: "InternalError",
|
|
53480
53603
|
cause
|
|
53481
53604
|
})));
|
|
@@ -53510,11 +53633,11 @@ const toPersisted = (stream$3, writeFile$1 = defaultWriteFile) => gen(function*
|
|
|
53510
53633
|
return void_$1;
|
|
53511
53634
|
} else if (part.name === "") return void_$1;
|
|
53512
53635
|
const file = part;
|
|
53513
|
-
const path = path_.join(dir, path_.basename(file.name).slice(-128));
|
|
53514
|
-
const filePart = new PersistedFileImpl(file.key, file.name, file.contentType, path);
|
|
53636
|
+
const path$2 = path_.join(dir, path_.basename(file.name).slice(-128));
|
|
53637
|
+
const filePart = new PersistedFileImpl(file.key, file.name, file.contentType, path$2);
|
|
53515
53638
|
if (Array.isArray(persisted$1[part.key])) persisted$1[part.key].push(filePart);
|
|
53516
53639
|
else persisted$1[part.key] = [filePart];
|
|
53517
|
-
return writeFile$1(path, file);
|
|
53640
|
+
return writeFile$1(path$2, file);
|
|
53518
53641
|
});
|
|
53519
53642
|
return persisted$1;
|
|
53520
53643
|
}).pipe(catchTag("PlatformError", (cause) => fail$3(new MultipartError({
|
|
@@ -53527,12 +53650,12 @@ var PersistedFileImpl = class extends PartBase$1 {
|
|
|
53527
53650
|
name;
|
|
53528
53651
|
contentType;
|
|
53529
53652
|
path;
|
|
53530
|
-
constructor(key, name, contentType, path) {
|
|
53653
|
+
constructor(key, name, contentType, path$2) {
|
|
53531
53654
|
super();
|
|
53532
53655
|
this.key = key;
|
|
53533
53656
|
this.name = name;
|
|
53534
53657
|
this.contentType = contentType;
|
|
53535
|
-
this.path = path;
|
|
53658
|
+
this.path = path$2;
|
|
53536
53659
|
}
|
|
53537
53660
|
toJSON() {
|
|
53538
53661
|
return {
|
|
@@ -53992,15 +54115,15 @@ const make$7 = /* @__PURE__ */ fnUntraced(function* (impl) {
|
|
|
53992
54115
|
const fs = yield* FileSystem;
|
|
53993
54116
|
const etagGen = yield* Generator;
|
|
53994
54117
|
return HttpPlatform.of({
|
|
53995
|
-
fileResponse: fnUntraced(function* (path, options) {
|
|
53996
|
-
const info = yield* fs.stat(path);
|
|
54118
|
+
fileResponse: fnUntraced(function* (path$2, options) {
|
|
54119
|
+
const info = yield* fs.stat(path$2);
|
|
53997
54120
|
const etag = yield* etagGen.fromFileInfo(info);
|
|
53998
54121
|
const start = Number(options?.offset ?? 0);
|
|
53999
54122
|
const end$1 = options?.bytesToRead !== void 0 ? start + Number(options.bytesToRead) : void 0;
|
|
54000
54123
|
const headers = set$2(options?.headers ? fromInput$1(options.headers) : empty$4, "etag", toString(etag));
|
|
54001
54124
|
if (info.mtime) headers["last-modified"] = info.mtime.toUTCString();
|
|
54002
54125
|
const contentLength = end$1 !== void 0 ? end$1 - start : Number(info.size) - start;
|
|
54003
|
-
return impl.fileResponse(path, options?.status ?? 200, options?.statusText, headers, start, end$1, contentLength);
|
|
54126
|
+
return impl.fileResponse(path$2, options?.status ?? 200, options?.statusText, headers, start, end$1, contentLength);
|
|
54004
54127
|
}),
|
|
54005
54128
|
fileWebResponse(file, options) {
|
|
54006
54129
|
return map$4(etagGen.fromFileWeb(file), (etag) => {
|
|
@@ -54018,8 +54141,8 @@ const make$7 = /* @__PURE__ */ fnUntraced(function* (impl) {
|
|
|
54018
54141
|
* @category layers
|
|
54019
54142
|
*/
|
|
54020
54143
|
const layer$11 = /* @__PURE__ */ effect(HttpPlatform)(flatMap(FileSystem.asEffect(), (fs) => make$7({
|
|
54021
|
-
fileResponse(path, status, statusText, headers, start, end$1, contentLength) {
|
|
54022
|
-
return stream$1(fs.stream(path, {
|
|
54144
|
+
fileResponse(path$2, status, statusText, headers, start, end$1, contentLength) {
|
|
54145
|
+
return stream$1(fs.stream(path$2, {
|
|
54023
54146
|
offset: start,
|
|
54024
54147
|
bytesToRead: end$1 !== void 0 ? end$1 - start : void 0
|
|
54025
54148
|
}), {
|
|
@@ -54151,9 +54274,9 @@ const make$5 = /* @__PURE__ */ gen(function* () {
|
|
|
54151
54274
|
...this,
|
|
54152
54275
|
prefixed: (newPrefix) => this.prefixed(prefixPath(prefix$1, newPrefix)),
|
|
54153
54276
|
addAll: (routes) => addAll(routes.map(prefixRoute(prefix$1))),
|
|
54154
|
-
add: (method, path, handler$1, options) => addAll([makeRoute({
|
|
54277
|
+
add: (method, path$2, handler$1, options) => addAll([makeRoute({
|
|
54155
54278
|
method,
|
|
54156
|
-
path: prefixPath(path, prefix$1),
|
|
54279
|
+
path: prefixPath(path$2, prefix$1),
|
|
54157
54280
|
handler: isHttpServerResponse(handler$1) ? succeed(handler$1) : isEffect(handler$1) ? handler$1 : flatMap(HttpServerRequest.asEffect(), handler$1),
|
|
54158
54281
|
uninterruptible: options?.uninterruptible ?? false,
|
|
54159
54282
|
prefix: prefix$1
|
|
@@ -54161,7 +54284,7 @@ const make$5 = /* @__PURE__ */ gen(function* () {
|
|
|
54161
54284
|
});
|
|
54162
54285
|
},
|
|
54163
54286
|
addAll,
|
|
54164
|
-
add: (method, path, handler$1, options) => addAll([route(method, path, handler$1, options)]),
|
|
54287
|
+
add: (method, path$2, handler$1, options) => addAll([route(method, path$2, handler$1, options)]),
|
|
54165
54288
|
addGlobalMiddleware: (middleware_) => sync(() => {
|
|
54166
54289
|
middleware$1.add(middleware_);
|
|
54167
54290
|
}),
|
|
@@ -54243,7 +54366,7 @@ const use = (f) => effectDiscard(flatMap(HttpRouter.asEffect(), f));
|
|
|
54243
54366
|
* @since 4.0.0
|
|
54244
54367
|
* @category HttpRouter
|
|
54245
54368
|
*/
|
|
54246
|
-
const add = (method, path, handler$1, options) => use((router) => router.add(method, path, handler$1, options));
|
|
54369
|
+
const add = (method, path$2, handler$1, options) => use((router) => router.add(method, path$2, handler$1, options));
|
|
54247
54370
|
/**
|
|
54248
54371
|
* @since 4.0.0
|
|
54249
54372
|
* @category HttpRouter
|
|
@@ -54260,14 +54383,14 @@ const makeRoute = (options) => ({
|
|
|
54260
54383
|
* @since 4.0.0
|
|
54261
54384
|
* @category Route
|
|
54262
54385
|
*/
|
|
54263
|
-
const route = (method, path, handler$1, options) => makeRoute({
|
|
54386
|
+
const route = (method, path$2, handler$1, options) => makeRoute({
|
|
54264
54387
|
...options,
|
|
54265
54388
|
method,
|
|
54266
|
-
path,
|
|
54389
|
+
path: path$2,
|
|
54267
54390
|
handler: isHttpServerResponse(handler$1) ? succeed(handler$1) : isEffect(handler$1) ? handler$1 : flatMap(HttpServerRequest.asEffect(), handler$1),
|
|
54268
54391
|
uninterruptible: options?.uninterruptible ?? false
|
|
54269
54392
|
});
|
|
54270
|
-
const removeTrailingSlash = (path) => path.endsWith("/") ? path.slice(0, -1) : path;
|
|
54393
|
+
const removeTrailingSlash = (path$2) => path$2.endsWith("/") ? path$2.slice(0, -1) : path$2;
|
|
54271
54394
|
/**
|
|
54272
54395
|
* @since 4.0.0
|
|
54273
54396
|
* @category PathInput
|
|
@@ -57986,11 +58109,11 @@ const handleBadArgument = (method) => (err) => new BadArgument({
|
|
|
57986
58109
|
});
|
|
57987
58110
|
const access = /* @__PURE__ */ (() => {
|
|
57988
58111
|
const nodeAccess = /* @__PURE__ */ effectify(NFS.access, /* @__PURE__ */ handleErrnoException("FileSystem", "access"), /* @__PURE__ */ handleBadArgument("access"));
|
|
57989
|
-
return (path, options) => {
|
|
58112
|
+
return (path$2, options) => {
|
|
57990
58113
|
let mode = NFS.constants.F_OK;
|
|
57991
58114
|
if (options?.readable) mode |= NFS.constants.R_OK;
|
|
57992
58115
|
if (options?.writable) mode |= NFS.constants.W_OK;
|
|
57993
|
-
return nodeAccess(path, mode);
|
|
58116
|
+
return nodeAccess(path$2, mode);
|
|
57994
58117
|
};
|
|
57995
58118
|
})();
|
|
57996
58119
|
const copy = /* @__PURE__ */ (() => {
|
|
@@ -58007,11 +58130,11 @@ const copyFile = /* @__PURE__ */ (() => {
|
|
|
58007
58130
|
})();
|
|
58008
58131
|
const chmod = /* @__PURE__ */ (() => {
|
|
58009
58132
|
const nodeChmod = /* @__PURE__ */ effectify(NFS.chmod, /* @__PURE__ */ handleErrnoException("FileSystem", "chmod"), /* @__PURE__ */ handleBadArgument("chmod"));
|
|
58010
|
-
return (path, mode) => nodeChmod(path, mode);
|
|
58133
|
+
return (path$2, mode) => nodeChmod(path$2, mode);
|
|
58011
58134
|
})();
|
|
58012
58135
|
const chown = /* @__PURE__ */ (() => {
|
|
58013
58136
|
const nodeChown = /* @__PURE__ */ effectify(NFS.chown, /* @__PURE__ */ handleErrnoException("FileSystem", "chown"), /* @__PURE__ */ handleBadArgument("chown"));
|
|
58014
|
-
return (path, uid, gid) => nodeChown(path, uid, gid);
|
|
58137
|
+
return (path$2, uid, gid) => nodeChown(path$2, uid, gid);
|
|
58015
58138
|
})();
|
|
58016
58139
|
const link = /* @__PURE__ */ (() => {
|
|
58017
58140
|
const nodeLink = /* @__PURE__ */ effectify(NFS.link, /* @__PURE__ */ handleErrnoException("FileSystem", "link"), /* @__PURE__ */ handleBadArgument("link"));
|
|
@@ -58019,7 +58142,7 @@ const link = /* @__PURE__ */ (() => {
|
|
|
58019
58142
|
})();
|
|
58020
58143
|
const makeDirectory = /* @__PURE__ */ (() => {
|
|
58021
58144
|
const nodeMkdir = /* @__PURE__ */ effectify(NFS.mkdir, /* @__PURE__ */ handleErrnoException("FileSystem", "makeDirectory"), /* @__PURE__ */ handleBadArgument("makeDirectory"));
|
|
58022
|
-
return (path, options) => nodeMkdir(path, {
|
|
58145
|
+
return (path$2, options) => nodeMkdir(path$2, {
|
|
58023
58146
|
recursive: options?.recursive ?? false,
|
|
58024
58147
|
mode: options?.mode
|
|
58025
58148
|
});
|
|
@@ -58028,14 +58151,14 @@ const makeTempDirectoryFactory = (method) => {
|
|
|
58028
58151
|
const nodeMkdtemp = effectify(NFS.mkdtemp, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
58029
58152
|
return (options) => suspend$2(() => {
|
|
58030
58153
|
const prefix$1 = options?.prefix ?? "";
|
|
58031
|
-
const directory = typeof options?.directory === "string" ? Path.join(options.directory, ".") : OS.tmpdir();
|
|
58032
|
-
return nodeMkdtemp(prefix$1 ? Path.join(directory, prefix$1) : directory + "/");
|
|
58154
|
+
const directory$2 = typeof options?.directory === "string" ? Path.join(options.directory, ".") : OS.tmpdir();
|
|
58155
|
+
return nodeMkdtemp(prefix$1 ? Path.join(directory$2, prefix$1) : directory$2 + "/");
|
|
58033
58156
|
});
|
|
58034
58157
|
};
|
|
58035
58158
|
const makeTempDirectory = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectory");
|
|
58036
58159
|
const removeFactory = (method) => {
|
|
58037
58160
|
const nodeRm = effectify(NFS.rm, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
58038
|
-
return (path, options) => nodeRm(path, {
|
|
58161
|
+
return (path$2, options) => nodeRm(path$2, {
|
|
58039
58162
|
recursive: options?.recursive ?? false,
|
|
58040
58163
|
force: options?.force ?? false
|
|
58041
58164
|
});
|
|
@@ -58044,12 +58167,12 @@ const remove = /* @__PURE__ */ removeFactory("remove");
|
|
|
58044
58167
|
const makeTempDirectoryScoped = /* @__PURE__ */ (() => {
|
|
58045
58168
|
const makeDirectory$1 = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectoryScoped");
|
|
58046
58169
|
const removeDirectory = /* @__PURE__ */ removeFactory("makeTempDirectoryScoped");
|
|
58047
|
-
return (options) => acquireRelease(makeDirectory$1(options), (directory) => orDie$2(removeDirectory(directory, { recursive: true })));
|
|
58170
|
+
return (options) => acquireRelease(makeDirectory$1(options), (directory$2) => orDie$2(removeDirectory(directory$2, { recursive: true })));
|
|
58048
58171
|
})();
|
|
58049
58172
|
const openFactory = (method) => {
|
|
58050
58173
|
const nodeOpen = effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
58051
58174
|
const nodeClose = effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
58052
|
-
return (path, options) => pipe(acquireRelease(nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => orDie$2(nodeClose(fd))), map$4((fd) => makeFile(FileDescriptor(fd), options?.flag?.startsWith("a") ?? false)));
|
|
58175
|
+
return (path$2, options) => pipe(acquireRelease(nodeOpen(path$2, options?.flag ?? "r", options?.mode), (fd) => orDie$2(nodeClose(fd))), map$4((fd) => makeFile(FileDescriptor(fd), options?.flag?.startsWith("a") ?? false)));
|
|
58053
58176
|
};
|
|
58054
58177
|
const open = /* @__PURE__ */ openFactory("open");
|
|
58055
58178
|
const makeFile = /* @__PURE__ */ (() => {
|
|
@@ -58160,9 +58283,9 @@ const makeFile = /* @__PURE__ */ (() => {
|
|
|
58160
58283
|
const makeTempFileFactory = (method) => {
|
|
58161
58284
|
const makeDirectory$1 = makeTempDirectoryFactory(method);
|
|
58162
58285
|
return fnUntraced(function* (options) {
|
|
58163
|
-
const directory = yield* makeDirectory$1(options);
|
|
58286
|
+
const directory$2 = yield* makeDirectory$1(options);
|
|
58164
58287
|
const random$1 = Crypto.randomBytes(6).toString("hex");
|
|
58165
|
-
const name = Path.join(directory, options?.suffix ? `${random$1}${options.suffix}` : random$1);
|
|
58288
|
+
const name = Path.join(directory$2, options?.suffix ? `${random$1}${options.suffix}` : random$1);
|
|
58166
58289
|
yield* writeFile(name, new Uint8Array(0));
|
|
58167
58290
|
return name;
|
|
58168
58291
|
});
|
|
@@ -58173,14 +58296,14 @@ const makeTempFileScoped = /* @__PURE__ */ (() => {
|
|
|
58173
58296
|
const removeDirectory = /* @__PURE__ */ removeFactory("makeTempFileScoped");
|
|
58174
58297
|
return (options) => acquireRelease(makeFile$1(options), (file) => orDie$2(removeDirectory(Path.dirname(file), { recursive: true })));
|
|
58175
58298
|
})();
|
|
58176
|
-
const readDirectory = (path, options) => tryPromise({
|
|
58177
|
-
try: () => NFS.promises.readdir(path, options),
|
|
58178
|
-
catch: (err) => handleErrnoException("FileSystem", "readDirectory")(err, [path])
|
|
58299
|
+
const readDirectory = (path$2, options) => tryPromise({
|
|
58300
|
+
try: () => NFS.promises.readdir(path$2, options),
|
|
58301
|
+
catch: (err) => handleErrnoException("FileSystem", "readDirectory")(err, [path$2])
|
|
58179
58302
|
});
|
|
58180
|
-
const readFile = (path) => callback$1((resume, signal) => {
|
|
58303
|
+
const readFile = (path$2) => callback$1((resume, signal) => {
|
|
58181
58304
|
try {
|
|
58182
|
-
NFS.readFile(path, { signal }, (err, data) => {
|
|
58183
|
-
if (err) resume(fail$3(handleErrnoException("FileSystem", "readFile")(err, [path])));
|
|
58305
|
+
NFS.readFile(path$2, { signal }, (err, data) => {
|
|
58306
|
+
if (err) resume(fail$3(handleErrnoException("FileSystem", "readFile")(err, [path$2])));
|
|
58184
58307
|
else resume(succeed(data));
|
|
58185
58308
|
});
|
|
58186
58309
|
} catch (err) {
|
|
@@ -58189,11 +58312,11 @@ const readFile = (path) => callback$1((resume, signal) => {
|
|
|
58189
58312
|
});
|
|
58190
58313
|
const readLink = /* @__PURE__ */ (() => {
|
|
58191
58314
|
const nodeReadLink = /* @__PURE__ */ effectify(NFS.readlink, /* @__PURE__ */ handleErrnoException("FileSystem", "readLink"), /* @__PURE__ */ handleBadArgument("readLink"));
|
|
58192
|
-
return (path) => nodeReadLink(path);
|
|
58315
|
+
return (path$2) => nodeReadLink(path$2);
|
|
58193
58316
|
})();
|
|
58194
58317
|
const realPath = /* @__PURE__ */ (() => {
|
|
58195
58318
|
const nodeRealPath = /* @__PURE__ */ effectify(NFS.realpath, /* @__PURE__ */ handleErrnoException("FileSystem", "realPath"), /* @__PURE__ */ handleBadArgument("realPath"));
|
|
58196
|
-
return (path) => nodeRealPath(path);
|
|
58319
|
+
return (path$2) => nodeRealPath(path$2);
|
|
58197
58320
|
})();
|
|
58198
58321
|
const rename = /* @__PURE__ */ (() => {
|
|
58199
58322
|
const nodeRename = /* @__PURE__ */ effectify(NFS.rename, /* @__PURE__ */ handleErrnoException("FileSystem", "rename"), /* @__PURE__ */ handleBadArgument("rename"));
|
|
@@ -58217,40 +58340,40 @@ const makeFileInfo = (stat$1) => ({
|
|
|
58217
58340
|
});
|
|
58218
58341
|
const stat = /* @__PURE__ */ (() => {
|
|
58219
58342
|
const nodeStat = /* @__PURE__ */ effectify(NFS.stat, /* @__PURE__ */ handleErrnoException("FileSystem", "stat"), /* @__PURE__ */ handleBadArgument("stat"));
|
|
58220
|
-
return (path) => map$4(nodeStat(path), makeFileInfo);
|
|
58343
|
+
return (path$2) => map$4(nodeStat(path$2), makeFileInfo);
|
|
58221
58344
|
})();
|
|
58222
58345
|
const symlink = /* @__PURE__ */ (() => {
|
|
58223
58346
|
const nodeSymlink = /* @__PURE__ */ effectify(NFS.symlink, /* @__PURE__ */ handleErrnoException("FileSystem", "symlink"), /* @__PURE__ */ handleBadArgument("symlink"));
|
|
58224
|
-
return (target, path) => nodeSymlink(target, path);
|
|
58347
|
+
return (target, path$2) => nodeSymlink(target, path$2);
|
|
58225
58348
|
})();
|
|
58226
58349
|
const truncate = /* @__PURE__ */ (() => {
|
|
58227
58350
|
const nodeTruncate = /* @__PURE__ */ effectify(NFS.truncate, /* @__PURE__ */ handleErrnoException("FileSystem", "truncate"), /* @__PURE__ */ handleBadArgument("truncate"));
|
|
58228
|
-
return (path, length) => nodeTruncate(path, length !== void 0 ? Number(length) : void 0);
|
|
58351
|
+
return (path$2, length) => nodeTruncate(path$2, length !== void 0 ? Number(length) : void 0);
|
|
58229
58352
|
})();
|
|
58230
58353
|
const utimes = /* @__PURE__ */ (() => {
|
|
58231
58354
|
const nodeUtimes = /* @__PURE__ */ effectify(NFS.utimes, /* @__PURE__ */ handleErrnoException("FileSystem", "utime"), /* @__PURE__ */ handleBadArgument("utime"));
|
|
58232
|
-
return (path, atime, mtime) => nodeUtimes(path, atime, mtime);
|
|
58355
|
+
return (path$2, atime, mtime) => nodeUtimes(path$2, atime, mtime);
|
|
58233
58356
|
})();
|
|
58234
|
-
const watchNode = (path) => callback((queue) => acquireRelease(sync(() => {
|
|
58235
|
-
const watcher = NFS.watch(path, {}, (event, path$
|
|
58236
|
-
if (!path$
|
|
58357
|
+
const watchNode = (path$2) => callback((queue) => acquireRelease(sync(() => {
|
|
58358
|
+
const watcher = NFS.watch(path$2, {}, (event, path$3) => {
|
|
58359
|
+
if (!path$3) return;
|
|
58237
58360
|
switch (event) {
|
|
58238
58361
|
case "rename":
|
|
58239
|
-
runFork(matchEffect(stat(path$
|
|
58362
|
+
runFork(matchEffect(stat(path$3), {
|
|
58240
58363
|
onSuccess: (_) => offer(queue, {
|
|
58241
58364
|
_tag: "Create",
|
|
58242
|
-
path: path$
|
|
58365
|
+
path: path$3
|
|
58243
58366
|
}),
|
|
58244
58367
|
onFailure: (_) => offer(queue, {
|
|
58245
58368
|
_tag: "Remove",
|
|
58246
|
-
path: path$
|
|
58369
|
+
path: path$3
|
|
58247
58370
|
})
|
|
58248
58371
|
}));
|
|
58249
58372
|
return;
|
|
58250
58373
|
case "change":
|
|
58251
58374
|
offerUnsafe(queue, {
|
|
58252
58375
|
_tag: "Update",
|
|
58253
|
-
path: path$
|
|
58376
|
+
path: path$3
|
|
58254
58377
|
});
|
|
58255
58378
|
return;
|
|
58256
58379
|
}
|
|
@@ -58260,7 +58383,7 @@ const watchNode = (path) => callback((queue) => acquireRelease(sync(() => {
|
|
|
58260
58383
|
module: "FileSystem",
|
|
58261
58384
|
reason: "Unknown",
|
|
58262
58385
|
method: "watch",
|
|
58263
|
-
pathOrDescriptor: path,
|
|
58386
|
+
pathOrDescriptor: path$2,
|
|
58264
58387
|
cause: error$1
|
|
58265
58388
|
})));
|
|
58266
58389
|
});
|
|
@@ -58269,21 +58392,21 @@ const watchNode = (path) => callback((queue) => acquireRelease(sync(() => {
|
|
|
58269
58392
|
});
|
|
58270
58393
|
return watcher;
|
|
58271
58394
|
}), (watcher) => sync(() => watcher.close())));
|
|
58272
|
-
const watch = (backend, path) => stat(path).pipe(map$4((stat$1) => {
|
|
58395
|
+
const watch = (backend, path$2) => stat(path$2).pipe(map$4((stat$1) => {
|
|
58273
58396
|
if (backend) {
|
|
58274
|
-
const stream$3 = backend.register(path, stat$1);
|
|
58397
|
+
const stream$3 = backend.register(path$2, stat$1);
|
|
58275
58398
|
if (stream$3) return stream$3;
|
|
58276
58399
|
}
|
|
58277
|
-
return watchNode(path);
|
|
58400
|
+
return watchNode(path$2);
|
|
58278
58401
|
}), unwrap);
|
|
58279
|
-
const writeFile = (path, data, options) => callback$1((resume, signal) => {
|
|
58402
|
+
const writeFile = (path$2, data, options) => callback$1((resume, signal) => {
|
|
58280
58403
|
try {
|
|
58281
|
-
NFS.writeFile(path, data, {
|
|
58404
|
+
NFS.writeFile(path$2, data, {
|
|
58282
58405
|
signal,
|
|
58283
58406
|
flag: options?.flag,
|
|
58284
58407
|
mode: options?.mode
|
|
58285
58408
|
}, (err) => {
|
|
58286
|
-
if (err) resume(fail$3(handleErrnoException("FileSystem", "writeFile")(err, [path])));
|
|
58409
|
+
if (err) resume(fail$3(handleErrnoException("FileSystem", "writeFile")(err, [path$2])));
|
|
58287
58410
|
else resume(void_$1);
|
|
58288
58411
|
});
|
|
58289
58412
|
} catch (err) {
|
|
@@ -58313,8 +58436,8 @@ const makeFileSystem = /* @__PURE__ */ map$4(/* @__PURE__ */ serviceOption(Watch
|
|
|
58313
58436
|
symlink,
|
|
58314
58437
|
truncate,
|
|
58315
58438
|
utimes,
|
|
58316
|
-
watch(path) {
|
|
58317
|
-
return watch(getOrUndefined(backend), path);
|
|
58439
|
+
watch(path$2) {
|
|
58440
|
+
return watch(getOrUndefined(backend), path$2);
|
|
58318
58441
|
},
|
|
58319
58442
|
writeFile
|
|
58320
58443
|
}));
|
|
@@ -58464,15 +58587,15 @@ const layer$7 = /* @__PURE__ */ layerMergedServices(/* @__PURE__ */ succeed(fetc
|
|
|
58464
58587
|
* @category Constructors
|
|
58465
58588
|
*/
|
|
58466
58589
|
const make$4 = /* @__PURE__ */ make$7({
|
|
58467
|
-
fileResponse(path, status, statusText, headers, start, end$1, contentLength) {
|
|
58468
|
-
const stream$3 = NFS.createReadStream(path, {
|
|
58590
|
+
fileResponse(path$2, status, statusText, headers, start, end$1, contentLength) {
|
|
58591
|
+
const stream$3 = NFS.createReadStream(path$2, {
|
|
58469
58592
|
start,
|
|
58470
58593
|
end: end$1
|
|
58471
58594
|
});
|
|
58472
58595
|
return raw(stream$3, {
|
|
58473
58596
|
headers: {
|
|
58474
58597
|
...headers,
|
|
58475
|
-
"content-type": headers["content-type"] ?? Mime_default.getType(path) ?? "application/octet-stream",
|
|
58598
|
+
"content-type": headers["content-type"] ?? Mime_default.getType(path$2) ?? "application/octet-stream",
|
|
58476
58599
|
"content-length": contentLength.toString()
|
|
58477
58600
|
},
|
|
58478
58601
|
status,
|
|
@@ -58599,8 +58722,8 @@ const stream = (source, headers) => makeConfig(headers).pipe(map$4((config) => f
|
|
|
58599
58722
|
* @since 1.0.0
|
|
58600
58723
|
* @category constructors
|
|
58601
58724
|
*/
|
|
58602
|
-
const persisted = (source, headers) => toPersisted(stream(source, headers), (path, file) => tryPromise({
|
|
58603
|
-
try: (signal) => NodeStreamP.pipeline(file.file, NFS.createWriteStream(path), { signal }),
|
|
58725
|
+
const persisted = (source, headers) => toPersisted(stream(source, headers), (path$2, file) => tryPromise({
|
|
58726
|
+
try: (signal) => NodeStreamP.pipeline(file.file, NFS.createWriteStream(path$2), { signal }),
|
|
58604
58727
|
catch: (cause) => new MultipartError({
|
|
58605
58728
|
reason: "InternalError",
|
|
58606
58729
|
cause
|
|
@@ -58711,8 +58834,8 @@ const fromFileUrl = (url) => try_({
|
|
|
58711
58834
|
cause
|
|
58712
58835
|
})
|
|
58713
58836
|
});
|
|
58714
|
-
const toFileUrl = (path) => try_({
|
|
58715
|
-
try: () => NodeUrl.pathToFileURL(path),
|
|
58837
|
+
const toFileUrl = (path$2) => try_({
|
|
58838
|
+
try: () => NodeUrl.pathToFileURL(path$2),
|
|
58716
58839
|
catch: (cause) => new BadArgument({
|
|
58717
58840
|
module: "Path",
|
|
58718
58841
|
method: "toFileUrl",
|
|
@@ -60089,7 +60212,7 @@ var require_visitor = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
|
60089
60212
|
var node = void 0;
|
|
60090
60213
|
var key = void 0;
|
|
60091
60214
|
var parent = void 0;
|
|
60092
|
-
var path = [];
|
|
60215
|
+
var path$2 = [];
|
|
60093
60216
|
var ancestors = [];
|
|
60094
60217
|
var newRoot = root$1;
|
|
60095
60218
|
do {
|
|
@@ -60097,7 +60220,7 @@ var require_visitor = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
|
60097
60220
|
var isLeaving = index === keys$1.length;
|
|
60098
60221
|
var isEdited = isLeaving && edits.length !== 0;
|
|
60099
60222
|
if (isLeaving) {
|
|
60100
|
-
key = ancestors.length === 0 ? void 0 : path[path.length - 1];
|
|
60223
|
+
key = ancestors.length === 0 ? void 0 : path$2[path$2.length - 1];
|
|
60101
60224
|
node = parent;
|
|
60102
60225
|
parent = ancestors.pop();
|
|
60103
60226
|
if (isEdited) {
|
|
@@ -60130,32 +60253,32 @@ var require_visitor = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
|
60130
60253
|
key = parent ? inArray ? index : keys$1[index] : void 0;
|
|
60131
60254
|
node = parent ? parent[key] : newRoot;
|
|
60132
60255
|
if (node === null || node === void 0) continue;
|
|
60133
|
-
if (parent) path.push(key);
|
|
60256
|
+
if (parent) path$2.push(key);
|
|
60134
60257
|
}
|
|
60135
60258
|
var result$2 = void 0;
|
|
60136
60259
|
if (!Array.isArray(node)) {
|
|
60137
60260
|
if (!(0, _ast.isNode)(node)) throw new Error("Invalid AST Node: ".concat((0, _inspect.default)(node), "."));
|
|
60138
60261
|
var visitFn = getVisitFn(visitor, node.kind, isLeaving);
|
|
60139
60262
|
if (visitFn) {
|
|
60140
|
-
result$2 = visitFn.call(visitor, node, key, parent, path, ancestors);
|
|
60263
|
+
result$2 = visitFn.call(visitor, node, key, parent, path$2, ancestors);
|
|
60141
60264
|
if (result$2 === BREAK) break;
|
|
60142
60265
|
if (result$2 === false) {
|
|
60143
60266
|
if (!isLeaving) {
|
|
60144
|
-
path.pop();
|
|
60267
|
+
path$2.pop();
|
|
60145
60268
|
continue;
|
|
60146
60269
|
}
|
|
60147
60270
|
} else if (result$2 !== void 0) {
|
|
60148
60271
|
edits.push([key, result$2]);
|
|
60149
60272
|
if (!isLeaving) if ((0, _ast.isNode)(result$2)) node = result$2;
|
|
60150
60273
|
else {
|
|
60151
|
-
path.pop();
|
|
60274
|
+
path$2.pop();
|
|
60152
60275
|
continue;
|
|
60153
60276
|
}
|
|
60154
60277
|
}
|
|
60155
60278
|
}
|
|
60156
60279
|
}
|
|
60157
60280
|
if (result$2 === void 0 && isEdited) edits.push([key, node]);
|
|
60158
|
-
if (isLeaving) path.pop();
|
|
60281
|
+
if (isLeaving) path$2.pop();
|
|
60159
60282
|
else {
|
|
60160
60283
|
var _visitorKeys$node$kin;
|
|
60161
60284
|
stack = {
|
|
@@ -134682,7 +134805,7 @@ paginateRest.VERSION = VERSION$11;
|
|
|
134682
134805
|
|
|
134683
134806
|
//#endregion
|
|
134684
134807
|
//#region node_modules/.pnpm/@octokit+plugin-paginate-graphql@6.0.0_@octokit+core@7.0.6/node_modules/@octokit/plugin-paginate-graphql/dist-bundle/index.js
|
|
134685
|
-
var generateMessage = (path, cursorValue) => `The cursor at "${path.join(",")}" did not change its value "${cursorValue}" after a page transition. Please make sure your that your query is set up correctly.`;
|
|
134808
|
+
var generateMessage = (path$2, cursorValue) => `The cursor at "${path$2.join(",")}" did not change its value "${cursorValue}" after a page transition. Please make sure your that your query is set up correctly.`;
|
|
134686
134809
|
var MissingCursorChange = class extends Error {
|
|
134687
134810
|
constructor(pageInfo, cursorValue) {
|
|
134688
134811
|
super(generateMessage(pageInfo.pathInQuery, cursorValue));
|
|
@@ -134706,9 +134829,9 @@ function findPaginatedResourcePath(responseData) {
|
|
|
134706
134829
|
if (paginatedResourcePath.length === 0) throw new MissingPageInfo(responseData);
|
|
134707
134830
|
return paginatedResourcePath;
|
|
134708
134831
|
}
|
|
134709
|
-
var deepFindPathToProperty = (object, searchProp, path = []) => {
|
|
134832
|
+
var deepFindPathToProperty = (object, searchProp, path$2 = []) => {
|
|
134710
134833
|
for (const key of Object.keys(object)) {
|
|
134711
|
-
const currentPath = [...path, key];
|
|
134834
|
+
const currentPath = [...path$2, key];
|
|
134712
134835
|
const currentValue = object[key];
|
|
134713
134836
|
if (isObject(currentValue)) {
|
|
134714
134837
|
if (currentValue.hasOwnProperty(searchProp)) return currentPath;
|
|
@@ -134718,12 +134841,12 @@ var deepFindPathToProperty = (object, searchProp, path = []) => {
|
|
|
134718
134841
|
}
|
|
134719
134842
|
return [];
|
|
134720
134843
|
};
|
|
134721
|
-
var get$1 = (object, path) => {
|
|
134722
|
-
return path.reduce((current, nextProperty) => current[nextProperty], object);
|
|
134844
|
+
var get$1 = (object, path$2) => {
|
|
134845
|
+
return path$2.reduce((current, nextProperty) => current[nextProperty], object);
|
|
134723
134846
|
};
|
|
134724
|
-
var set$1 = (object, path, mutator) => {
|
|
134725
|
-
const lastProperty = path[path.length - 1];
|
|
134726
|
-
const parent = get$1(object, [...path].slice(0, -1));
|
|
134847
|
+
var set$1 = (object, path$2, mutator) => {
|
|
134848
|
+
const lastProperty = path$2[path$2.length - 1];
|
|
134849
|
+
const parent = get$1(object, [...path$2].slice(0, -1));
|
|
134727
134850
|
if (typeof mutator === "function") parent[lastProperty] = mutator(parent[lastProperty]);
|
|
134728
134851
|
else parent[lastProperty] = mutator;
|
|
134729
134852
|
};
|
|
@@ -134766,18 +134889,18 @@ var createIterator = (octokit) => {
|
|
|
134766
134889
|
};
|
|
134767
134890
|
var mergeResponses = (response1, response2) => {
|
|
134768
134891
|
if (Object.keys(response1).length === 0) return Object.assign(response1, response2);
|
|
134769
|
-
const path = findPaginatedResourcePath(response1);
|
|
134770
|
-
const nodesPath = [...path, "nodes"];
|
|
134892
|
+
const path$2 = findPaginatedResourcePath(response1);
|
|
134893
|
+
const nodesPath = [...path$2, "nodes"];
|
|
134771
134894
|
const newNodes = get$1(response2, nodesPath);
|
|
134772
134895
|
if (newNodes) set$1(response1, nodesPath, (values$1) => {
|
|
134773
134896
|
return [...values$1, ...newNodes];
|
|
134774
134897
|
});
|
|
134775
|
-
const edgesPath = [...path, "edges"];
|
|
134898
|
+
const edgesPath = [...path$2, "edges"];
|
|
134776
134899
|
const newEdges = get$1(response2, edgesPath);
|
|
134777
134900
|
if (newEdges) set$1(response1, edgesPath, (values$1) => {
|
|
134778
134901
|
return [...values$1, ...newEdges];
|
|
134779
134902
|
});
|
|
134780
|
-
const pageInfoPath = [...path, "pageInfo"];
|
|
134903
|
+
const pageInfoPath = [...path$2, "pageInfo"];
|
|
134781
134904
|
set$1(response1, pageInfoPath, get$1(response2, pageInfoPath));
|
|
134782
134905
|
return response1;
|
|
134783
134906
|
};
|
|
@@ -137489,7 +137612,7 @@ var triggers_notification_paths_default = [
|
|
|
137489
137612
|
"/teams/{team_id}/discussions/{discussion_number}/comments"
|
|
137490
137613
|
];
|
|
137491
137614
|
function routeMatcher$1(paths) {
|
|
137492
|
-
const regex2 = `^(?:${paths.map((path) => path.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/")).map((r) => `(?:${r})`).join("|")})[^/]*$`;
|
|
137615
|
+
const regex2 = `^(?:${paths.map((path$2) => path$2.split("/").map((c) => c.startsWith("{") ? "(?:.+?)" : c).join("/")).map((r) => `(?:${r})`).join("|")})[^/]*$`;
|
|
137493
137616
|
return new RegExp(regex2, "i");
|
|
137494
137617
|
}
|
|
137495
137618
|
var regex = routeMatcher$1(triggers_notification_paths_default);
|
|
@@ -140171,6 +140294,7 @@ permission.
|
|
|
140171
140294
|
HEAD as the base.
|
|
140172
140295
|
- New branches should be named using the format \`{task id}/description\`.
|
|
140173
140296
|
- When checking for PR reviews, make sure to check the "reviews" field and read ALL unresolved comments.
|
|
140297
|
+
Also read the normal comments to see if there are any additional requests.
|
|
140174
140298
|
4. Implement the task.
|
|
140175
140299
|
- This session will time out after a certain period, so make sure to record
|
|
140176
140300
|
key information that could speed up future work on the task in the task
|
|
@@ -140222,6 +140346,7 @@ permission.
|
|
|
140222
140346
|
3. Mark the original task as "done" by updating its \`state\` in the prd.yml file.
|
|
140223
140347
|
4. Each new task should have an id of \`null\`, a title, and a concise description that
|
|
140224
140348
|
includes a short summary of the task and a brief list of steps to complete it.
|
|
140349
|
+
- Include where to find the plan specification in the description (if applicable).
|
|
140225
140350
|
- The tasks should start in the "todo" state.
|
|
140226
140351
|
- Each task should be an atomic, committable piece of work.
|
|
140227
140352
|
Instead of creating tasks like "Refactor the authentication system", create
|
|
@@ -140231,32 +140356,46 @@ permission.
|
|
|
140231
140356
|
to assign ids to the new tasks before you can setup dependencies.
|
|
140232
140357
|
|
|
140233
140358
|
${prdNotes}`;
|
|
140234
|
-
|
|
140235
|
-
promptChoose,
|
|
140236
|
-
prompt,
|
|
140237
|
-
promptTimeout,
|
|
140238
|
-
planPrompt: `# Instructions
|
|
140359
|
+
const planPrompt = (options) => `# Instructions
|
|
140239
140360
|
|
|
140240
|
-
1. Ask the user for the idea / request, then
|
|
140241
|
-
|
|
140242
|
-
|
|
140243
|
-
|
|
140244
|
-
|
|
140245
|
-
|
|
140246
|
-
2.
|
|
140247
|
-
|
|
140361
|
+
1. Ask the user for the idea / request, then your job is to create a detailed
|
|
140362
|
+
specification for the project based on that input and save it to a file.
|
|
140363
|
+
- If the user is asking to update an existing plan, then read the
|
|
140364
|
+
existing specification before continuing.
|
|
140365
|
+
- Make sure to research the codebase before creating the specification, to
|
|
140366
|
+
ensure it is relevant and feasible.
|
|
140367
|
+
2. Once you have saved the specification, your next job is to break down the
|
|
140368
|
+
specification into smaller, manageable tasks.
|
|
140369
|
+
Each task should have a id of \`null\`, a title, and a concise description that
|
|
140370
|
+
includes a where to find the plan specification, a short summary of the task and a
|
|
140371
|
+
brief list of steps to complete it.
|
|
140248
140372
|
- The tasks should start in the "todo" state.
|
|
140249
140373
|
- Each task should be an atomic, committable piece of work.
|
|
140250
140374
|
Instead of creating tasks like "Refactor the authentication system", create
|
|
140251
140375
|
smaller tasks like "Implement OAuth2 login endpoint", "Add JWT token refresh mechanism", etc.
|
|
140252
|
-
3. Add the new tasks to the prd.yml file.
|
|
140376
|
+
3. Add the new or updated tasks to the prd.yml file.
|
|
140253
140377
|
4. Wait until the tasks are saved, then setup task dependencies using the \`blockedBy\` field.
|
|
140254
|
-
5.
|
|
140255
|
-
|
|
140378
|
+
5. Start a subagent with a copy of this prompt, to review the plan and provide feedback or improvements.
|
|
140379
|
+
|
|
140380
|
+
**Important:** You are only creating or updating a plan, not implementing any tasks yet.
|
|
140256
140381
|
|
|
140257
|
-
|
|
140382
|
+
## Specifications
|
|
140383
|
+
|
|
140384
|
+
- Should go into a \`${options.specsDirectory}\` directory, with a filename that reflects the
|
|
140385
|
+
project name.
|
|
140386
|
+
|
|
140387
|
+
A specification file should include:
|
|
140388
|
+
|
|
140389
|
+
- Requirements: functional and non-functional requirements.
|
|
140390
|
+
- Design: technical design, architecture decisions, data models, etc.
|
|
140391
|
+
- Acceptance criteria that define when the project is considered complete.
|
|
140258
140392
|
|
|
140259
|
-
${prdNotes}
|
|
140393
|
+
${prdNotes}`;
|
|
140394
|
+
return {
|
|
140395
|
+
promptChoose,
|
|
140396
|
+
prompt,
|
|
140397
|
+
promptTimeout,
|
|
140398
|
+
planPrompt
|
|
140260
140399
|
};
|
|
140261
140400
|
}) }) {
|
|
140262
140401
|
static layer = effect(this, this.make);
|
|
@@ -140267,19 +140406,19 @@ ${prdNotes}`
|
|
|
140267
140406
|
var Worktree = class extends Service()("lalph/Worktree", { make: gen(function* () {
|
|
140268
140407
|
const fs = yield* FileSystem;
|
|
140269
140408
|
const pathService = yield* Path$1;
|
|
140270
|
-
const directory = yield* fs.makeTempDirectory();
|
|
140409
|
+
const directory$2 = yield* fs.makeTempDirectory();
|
|
140271
140410
|
yield* addFinalizer(fnUntraced(function* () {
|
|
140272
|
-
yield* execIgnore(make$21`git worktree remove --force ${directory}`);
|
|
140411
|
+
yield* execIgnore(make$21`git worktree remove --force ${directory$2}`);
|
|
140273
140412
|
}));
|
|
140274
|
-
yield* make$21`git worktree add ${directory} -d HEAD`.pipe(exitCode);
|
|
140275
|
-
yield* fs.makeDirectory(pathService.join(directory, ".lalph"), { recursive: true });
|
|
140413
|
+
yield* make$21`git worktree add ${directory$2} -d HEAD`.pipe(exitCode);
|
|
140414
|
+
yield* fs.makeDirectory(pathService.join(directory$2, ".lalph"), { recursive: true });
|
|
140276
140415
|
const setupPath = pathService.resolve(".lalph-setup.sh");
|
|
140277
140416
|
if (yield* fs.exists(setupPath)) yield* make$21({
|
|
140278
|
-
cwd: directory,
|
|
140417
|
+
cwd: directory$2,
|
|
140279
140418
|
extendEnv: true,
|
|
140280
140419
|
shell: process.env.SHELL ?? true
|
|
140281
140420
|
})`${setupPath}`.pipe(exitCode);
|
|
140282
|
-
return { directory };
|
|
140421
|
+
return { directory: directory$2 };
|
|
140283
140422
|
}) }) {
|
|
140284
140423
|
static layer = effect(this, this.make);
|
|
140285
140424
|
};
|
|
@@ -140503,16 +140642,13 @@ const ChosenTask = fromJsonString(Struct({ id: String$1 }));
|
|
|
140503
140642
|
|
|
140504
140643
|
//#endregion
|
|
140505
140644
|
//#region src/Planner.ts
|
|
140506
|
-
const plan =
|
|
140645
|
+
const plan = fnUntraced(function* (options) {
|
|
140507
140646
|
const fs = yield* FileSystem;
|
|
140508
140647
|
const pathService = yield* Path$1;
|
|
140509
140648
|
const worktree = yield* Worktree;
|
|
140510
140649
|
const promptGen = yield* PromptGen;
|
|
140511
|
-
const
|
|
140512
|
-
|
|
140513
|
-
yield* scoped$1(fs.open(lalphPlanPath, { flag: "a+" }));
|
|
140514
|
-
const cliCommand = cliAgent.commandPlan({
|
|
140515
|
-
prompt: promptGen.planPrompt,
|
|
140650
|
+
const cliCommand = (yield* getOrSelectCliAgent).commandPlan({
|
|
140651
|
+
prompt: promptGen.planPrompt(options),
|
|
140516
140652
|
prdFilePath: pathService.join(worktree.directory, ".lalph", "prd.yml")
|
|
140517
140653
|
});
|
|
140518
140654
|
const exitCode$1 = yield* make$21(cliCommand[0], cliCommand.slice(1), {
|
|
@@ -140524,9 +140660,8 @@ const plan = gen(function* () {
|
|
|
140524
140660
|
stdin: "inherit"
|
|
140525
140661
|
}).pipe(exitCode);
|
|
140526
140662
|
yield* log$1(`Agent exited with code: ${exitCode$1}`);
|
|
140527
|
-
|
|
140528
|
-
|
|
140529
|
-
}).pipe(scoped$1, provide$1([
|
|
140663
|
+
yield* fs.copy(pathService.join(worktree.directory, options.specsDirectory), options.specsDirectory, { overwrite: true }).pipe(ignore);
|
|
140664
|
+
}, scoped$1, provide$1([
|
|
140530
140665
|
PromptGen.layer,
|
|
140531
140666
|
Prd.layer,
|
|
140532
140667
|
Worktree.layer
|
|
@@ -140536,7 +140671,8 @@ const plan = gen(function* () {
|
|
|
140536
140671
|
//#region src/cli.ts
|
|
140537
140672
|
const selectAgent = make$25("agent").pipe(withDescription("Select the CLI agent to use"), withHandler(() => selectCliAgent));
|
|
140538
140673
|
const selectSource = make$25("source").pipe(withDescription("Select the issue source to use"), withHandler(() => selectIssueSource));
|
|
140539
|
-
const
|
|
140674
|
+
const specsDirectory = directory("specs").pipe(withDescription$1("Directory to store plan specifications"), withAlias("s"), withDefault(".specs"));
|
|
140675
|
+
const planMode = make$25("plan", { specsDirectory }).pipe(withDescription("Iterate on an issue plan and create PRD tasks"), withHandler(plan), provide(CurrentIssueSource.layer));
|
|
140540
140676
|
const iterations = integer("iterations").pipe(withDescription$1("Number of iterations to run, defaults to unlimited"), withAlias("i"), withDefault(Number.POSITIVE_INFINITY));
|
|
140541
140677
|
const concurrency = integer("concurrency").pipe(withDescription$1("Number of concurrent agents, defaults to 1"), withAlias("c"), withDefault(1));
|
|
140542
140678
|
const autoMerge = boolean("auto-merge").pipe(withAlias("a"), withDescription$1("Automatically merge eligible PRs"));
|