@nuasite/cli 0.40.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -707,17 +707,17 @@ var require_visit = __commonJS((exports) => {
707
707
  visit.BREAK = BREAK;
708
708
  visit.SKIP = SKIP;
709
709
  visit.REMOVE = REMOVE;
710
- function visit_(key, node, visitor, path2) {
711
- const ctrl = callVisitor(key, node, visitor, path2);
710
+ function visit_(key, node, visitor, path) {
711
+ const ctrl = callVisitor(key, node, visitor, path);
712
712
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
713
- replaceNode(key, path2, ctrl);
714
- return visit_(key, ctrl, visitor, path2);
713
+ replaceNode(key, path, ctrl);
714
+ return visit_(key, ctrl, visitor, path);
715
715
  }
716
716
  if (typeof ctrl !== "symbol") {
717
717
  if (identity.isCollection(node)) {
718
- path2 = Object.freeze(path2.concat(node));
718
+ path = Object.freeze(path.concat(node));
719
719
  for (let i = 0;i < node.items.length; ++i) {
720
- const ci = visit_(i, node.items[i], visitor, path2);
720
+ const ci = visit_(i, node.items[i], visitor, path);
721
721
  if (typeof ci === "number")
722
722
  i = ci - 1;
723
723
  else if (ci === BREAK)
@@ -728,13 +728,13 @@ var require_visit = __commonJS((exports) => {
728
728
  }
729
729
  }
730
730
  } else if (identity.isPair(node)) {
731
- path2 = Object.freeze(path2.concat(node));
732
- const ck = visit_("key", node.key, visitor, path2);
731
+ path = Object.freeze(path.concat(node));
732
+ const ck = visit_("key", node.key, visitor, path);
733
733
  if (ck === BREAK)
734
734
  return BREAK;
735
735
  else if (ck === REMOVE)
736
736
  node.key = null;
737
- const cv = visit_("value", node.value, visitor, path2);
737
+ const cv = visit_("value", node.value, visitor, path);
738
738
  if (cv === BREAK)
739
739
  return BREAK;
740
740
  else if (cv === REMOVE)
@@ -755,17 +755,17 @@ var require_visit = __commonJS((exports) => {
755
755
  visitAsync.BREAK = BREAK;
756
756
  visitAsync.SKIP = SKIP;
757
757
  visitAsync.REMOVE = REMOVE;
758
- async function visitAsync_(key, node, visitor, path2) {
759
- const ctrl = await callVisitor(key, node, visitor, path2);
758
+ async function visitAsync_(key, node, visitor, path) {
759
+ const ctrl = await callVisitor(key, node, visitor, path);
760
760
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
761
- replaceNode(key, path2, ctrl);
762
- return visitAsync_(key, ctrl, visitor, path2);
761
+ replaceNode(key, path, ctrl);
762
+ return visitAsync_(key, ctrl, visitor, path);
763
763
  }
764
764
  if (typeof ctrl !== "symbol") {
765
765
  if (identity.isCollection(node)) {
766
- path2 = Object.freeze(path2.concat(node));
766
+ path = Object.freeze(path.concat(node));
767
767
  for (let i = 0;i < node.items.length; ++i) {
768
- const ci = await visitAsync_(i, node.items[i], visitor, path2);
768
+ const ci = await visitAsync_(i, node.items[i], visitor, path);
769
769
  if (typeof ci === "number")
770
770
  i = ci - 1;
771
771
  else if (ci === BREAK)
@@ -776,13 +776,13 @@ var require_visit = __commonJS((exports) => {
776
776
  }
777
777
  }
778
778
  } else if (identity.isPair(node)) {
779
- path2 = Object.freeze(path2.concat(node));
780
- const ck = await visitAsync_("key", node.key, visitor, path2);
779
+ path = Object.freeze(path.concat(node));
780
+ const ck = await visitAsync_("key", node.key, visitor, path);
781
781
  if (ck === BREAK)
782
782
  return BREAK;
783
783
  else if (ck === REMOVE)
784
784
  node.key = null;
785
- const cv = await visitAsync_("value", node.value, visitor, path2);
785
+ const cv = await visitAsync_("value", node.value, visitor, path);
786
786
  if (cv === BREAK)
787
787
  return BREAK;
788
788
  else if (cv === REMOVE)
@@ -809,23 +809,23 @@ var require_visit = __commonJS((exports) => {
809
809
  }
810
810
  return visitor;
811
811
  }
812
- function callVisitor(key, node, visitor, path2) {
812
+ function callVisitor(key, node, visitor, path) {
813
813
  if (typeof visitor === "function")
814
- return visitor(key, node, path2);
814
+ return visitor(key, node, path);
815
815
  if (identity.isMap(node))
816
- return visitor.Map?.(key, node, path2);
816
+ return visitor.Map?.(key, node, path);
817
817
  if (identity.isSeq(node))
818
- return visitor.Seq?.(key, node, path2);
818
+ return visitor.Seq?.(key, node, path);
819
819
  if (identity.isPair(node))
820
- return visitor.Pair?.(key, node, path2);
820
+ return visitor.Pair?.(key, node, path);
821
821
  if (identity.isScalar(node))
822
- return visitor.Scalar?.(key, node, path2);
822
+ return visitor.Scalar?.(key, node, path);
823
823
  if (identity.isAlias(node))
824
- return visitor.Alias?.(key, node, path2);
824
+ return visitor.Alias?.(key, node, path);
825
825
  return;
826
826
  }
827
- function replaceNode(key, path2, node) {
828
- const parent = path2[path2.length - 1];
827
+ function replaceNode(key, path, node) {
828
+ const parent = path[path.length - 1];
829
829
  if (identity.isCollection(parent)) {
830
830
  parent.items[key] = node;
831
831
  } else if (identity.isPair(parent)) {
@@ -1382,10 +1382,10 @@ var require_Collection = __commonJS((exports) => {
1382
1382
  var createNode = require_createNode();
1383
1383
  var identity = require_identity();
1384
1384
  var Node = require_Node();
1385
- function collectionFromPath(schema, path2, value) {
1385
+ function collectionFromPath(schema, path, value) {
1386
1386
  let v = value;
1387
- for (let i = path2.length - 1;i >= 0; --i) {
1388
- const k = path2[i];
1387
+ for (let i = path.length - 1;i >= 0; --i) {
1388
+ const k = path[i];
1389
1389
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
1390
1390
  const a = [];
1391
1391
  a[k] = v;
@@ -1404,7 +1404,7 @@ var require_Collection = __commonJS((exports) => {
1404
1404
  sourceObjects: new Map
1405
1405
  });
1406
1406
  }
1407
- var isEmptyPath = (path2) => path2 == null || typeof path2 === "object" && !!path2[Symbol.iterator]().next().done;
1407
+ var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
1408
1408
 
1409
1409
  class Collection extends Node.NodeBase {
1410
1410
  constructor(type, schema) {
@@ -1425,11 +1425,11 @@ var require_Collection = __commonJS((exports) => {
1425
1425
  copy.range = this.range.slice();
1426
1426
  return copy;
1427
1427
  }
1428
- addIn(path2, value) {
1429
- if (isEmptyPath(path2))
1428
+ addIn(path, value) {
1429
+ if (isEmptyPath(path))
1430
1430
  this.add(value);
1431
1431
  else {
1432
- const [key, ...rest] = path2;
1432
+ const [key, ...rest] = path;
1433
1433
  const node = this.get(key, true);
1434
1434
  if (identity.isCollection(node))
1435
1435
  node.addIn(rest, value);
@@ -1439,8 +1439,8 @@ var require_Collection = __commonJS((exports) => {
1439
1439
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
1440
1440
  }
1441
1441
  }
1442
- deleteIn(path2) {
1443
- const [key, ...rest] = path2;
1442
+ deleteIn(path) {
1443
+ const [key, ...rest] = path;
1444
1444
  if (rest.length === 0)
1445
1445
  return this.delete(key);
1446
1446
  const node = this.get(key, true);
@@ -1449,8 +1449,8 @@ var require_Collection = __commonJS((exports) => {
1449
1449
  else
1450
1450
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
1451
1451
  }
1452
- getIn(path2, keepScalar) {
1453
- const [key, ...rest] = path2;
1452
+ getIn(path, keepScalar) {
1453
+ const [key, ...rest] = path;
1454
1454
  const node = this.get(key, true);
1455
1455
  if (rest.length === 0)
1456
1456
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -1465,15 +1465,15 @@ var require_Collection = __commonJS((exports) => {
1465
1465
  return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
1466
1466
  });
1467
1467
  }
1468
- hasIn(path2) {
1469
- const [key, ...rest] = path2;
1468
+ hasIn(path) {
1469
+ const [key, ...rest] = path;
1470
1470
  if (rest.length === 0)
1471
1471
  return this.has(key);
1472
1472
  const node = this.get(key, true);
1473
1473
  return identity.isCollection(node) ? node.hasIn(rest) : false;
1474
1474
  }
1475
- setIn(path2, value) {
1476
- const [key, ...rest] = path2;
1475
+ setIn(path, value) {
1476
+ const [key, ...rest] = path;
1477
1477
  if (rest.length === 0) {
1478
1478
  this.set(key, value);
1479
1479
  } else {
@@ -3863,9 +3863,9 @@ var require_Document = __commonJS((exports) => {
3863
3863
  if (assertCollection(this.contents))
3864
3864
  this.contents.add(value);
3865
3865
  }
3866
- addIn(path2, value) {
3866
+ addIn(path, value) {
3867
3867
  if (assertCollection(this.contents))
3868
- this.contents.addIn(path2, value);
3868
+ this.contents.addIn(path, value);
3869
3869
  }
3870
3870
  createAlias(node, name) {
3871
3871
  if (!node.anchor) {
@@ -3914,30 +3914,30 @@ var require_Document = __commonJS((exports) => {
3914
3914
  delete(key) {
3915
3915
  return assertCollection(this.contents) ? this.contents.delete(key) : false;
3916
3916
  }
3917
- deleteIn(path2) {
3918
- if (Collection.isEmptyPath(path2)) {
3917
+ deleteIn(path) {
3918
+ if (Collection.isEmptyPath(path)) {
3919
3919
  if (this.contents == null)
3920
3920
  return false;
3921
3921
  this.contents = null;
3922
3922
  return true;
3923
3923
  }
3924
- return assertCollection(this.contents) ? this.contents.deleteIn(path2) : false;
3924
+ return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
3925
3925
  }
3926
3926
  get(key, keepScalar) {
3927
3927
  return identity.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
3928
3928
  }
3929
- getIn(path2, keepScalar) {
3930
- if (Collection.isEmptyPath(path2))
3929
+ getIn(path, keepScalar) {
3930
+ if (Collection.isEmptyPath(path))
3931
3931
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3932
- return identity.isCollection(this.contents) ? this.contents.getIn(path2, keepScalar) : undefined;
3932
+ return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : undefined;
3933
3933
  }
3934
3934
  has(key) {
3935
3935
  return identity.isCollection(this.contents) ? this.contents.has(key) : false;
3936
3936
  }
3937
- hasIn(path2) {
3938
- if (Collection.isEmptyPath(path2))
3937
+ hasIn(path) {
3938
+ if (Collection.isEmptyPath(path))
3939
3939
  return this.contents !== undefined;
3940
- return identity.isCollection(this.contents) ? this.contents.hasIn(path2) : false;
3940
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
3941
3941
  }
3942
3942
  set(key, value) {
3943
3943
  if (this.contents == null) {
@@ -3946,13 +3946,13 @@ var require_Document = __commonJS((exports) => {
3946
3946
  this.contents.set(key, value);
3947
3947
  }
3948
3948
  }
3949
- setIn(path2, value) {
3950
- if (Collection.isEmptyPath(path2)) {
3949
+ setIn(path, value) {
3950
+ if (Collection.isEmptyPath(path)) {
3951
3951
  this.contents = value;
3952
3952
  } else if (this.contents == null) {
3953
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path2), value);
3953
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
3954
3954
  } else if (assertCollection(this.contents)) {
3955
- this.contents.setIn(path2, value);
3955
+ this.contents.setIn(path, value);
3956
3956
  }
3957
3957
  }
3958
3958
  setSchema(version, options = {}) {
@@ -5846,9 +5846,9 @@ var require_cst_visit = __commonJS((exports) => {
5846
5846
  visit.BREAK = BREAK;
5847
5847
  visit.SKIP = SKIP;
5848
5848
  visit.REMOVE = REMOVE;
5849
- visit.itemAtPath = (cst, path2) => {
5849
+ visit.itemAtPath = (cst, path) => {
5850
5850
  let item = cst;
5851
- for (const [field, index] of path2) {
5851
+ for (const [field, index] of path) {
5852
5852
  const tok = item?.[field];
5853
5853
  if (tok && "items" in tok) {
5854
5854
  item = tok.items[index];
@@ -5857,23 +5857,23 @@ var require_cst_visit = __commonJS((exports) => {
5857
5857
  }
5858
5858
  return item;
5859
5859
  };
5860
- visit.parentCollection = (cst, path2) => {
5861
- const parent = visit.itemAtPath(cst, path2.slice(0, -1));
5862
- const field = path2[path2.length - 1][0];
5860
+ visit.parentCollection = (cst, path) => {
5861
+ const parent = visit.itemAtPath(cst, path.slice(0, -1));
5862
+ const field = path[path.length - 1][0];
5863
5863
  const coll = parent?.[field];
5864
5864
  if (coll && "items" in coll)
5865
5865
  return coll;
5866
5866
  throw new Error("Parent collection not found");
5867
5867
  };
5868
- function _visit(path2, item, visitor) {
5869
- let ctrl = visitor(item, path2);
5868
+ function _visit(path, item, visitor) {
5869
+ let ctrl = visitor(item, path);
5870
5870
  if (typeof ctrl === "symbol")
5871
5871
  return ctrl;
5872
5872
  for (const field of ["key", "value"]) {
5873
5873
  const token = item[field];
5874
5874
  if (token && "items" in token) {
5875
5875
  for (let i = 0;i < token.items.length; ++i) {
5876
- const ci = _visit(Object.freeze(path2.concat([[field, i]])), token.items[i], visitor);
5876
+ const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
5877
5877
  if (typeof ci === "number")
5878
5878
  i = ci - 1;
5879
5879
  else if (ci === BREAK)
@@ -5884,10 +5884,10 @@ var require_cst_visit = __commonJS((exports) => {
5884
5884
  }
5885
5885
  }
5886
5886
  if (typeof ctrl === "function" && field === "key")
5887
- ctrl = ctrl(item, path2);
5887
+ ctrl = ctrl(item, path);
5888
5888
  }
5889
5889
  }
5890
- return typeof ctrl === "function" ? ctrl(item, path2) : ctrl;
5890
+ return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
5891
5891
  }
5892
5892
  exports.visit = visit;
5893
5893
  });
@@ -7156,14 +7156,14 @@ var require_parser = __commonJS((exports) => {
7156
7156
  case "scalar":
7157
7157
  case "single-quoted-scalar":
7158
7158
  case "double-quoted-scalar": {
7159
- const fs3 = this.flowScalar(this.type);
7159
+ const fs = this.flowScalar(this.type);
7160
7160
  if (atNextItem || it.value) {
7161
- map.items.push({ start, key: fs3, sep: [] });
7161
+ map.items.push({ start, key: fs, sep: [] });
7162
7162
  this.onKeyLine = true;
7163
7163
  } else if (it.sep) {
7164
- this.stack.push(fs3);
7164
+ this.stack.push(fs);
7165
7165
  } else {
7166
- Object.assign(it, { key: fs3, sep: [] });
7166
+ Object.assign(it, { key: fs, sep: [] });
7167
7167
  this.onKeyLine = true;
7168
7168
  }
7169
7169
  return;
@@ -7291,13 +7291,13 @@ var require_parser = __commonJS((exports) => {
7291
7291
  case "scalar":
7292
7292
  case "single-quoted-scalar":
7293
7293
  case "double-quoted-scalar": {
7294
- const fs3 = this.flowScalar(this.type);
7294
+ const fs = this.flowScalar(this.type);
7295
7295
  if (!it || it.value)
7296
- fc.items.push({ start: [], key: fs3, sep: [] });
7296
+ fc.items.push({ start: [], key: fs, sep: [] });
7297
7297
  else if (it.sep)
7298
- this.stack.push(fs3);
7298
+ this.stack.push(fs);
7299
7299
  else
7300
- Object.assign(it, { key: fs3, sep: [] });
7300
+ Object.assign(it, { key: fs, sep: [] });
7301
7301
  return;
7302
7302
  }
7303
7303
  case "flow-map-end":
@@ -8524,13 +8524,13 @@ var require_lib = __commonJS((exports) => {
8524
8524
  this.preserveSpace = !!preserveSpace;
8525
8525
  }
8526
8526
  }
8527
- var types2 = {
8527
+ var types = {
8528
8528
  brace: new TokContext("{"),
8529
8529
  j_oTag: new TokContext("<tag"),
8530
8530
  j_cTag: new TokContext("</tag"),
8531
8531
  j_expr: new TokContext("<tag>...</tag>", true)
8532
8532
  };
8533
- types2.template = new TokContext("`", true);
8533
+ types.template = new TokContext("`", true);
8534
8534
  var beforeExpr = true;
8535
8535
  var startsExpr = true;
8536
8536
  var isLoop = true;
@@ -9065,17 +9065,17 @@ var require_lib = __commonJS((exports) => {
9065
9065
  context.pop();
9066
9066
  };
9067
9067
  tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = (context) => {
9068
- context.push(types2.brace);
9068
+ context.push(types.brace);
9069
9069
  };
9070
9070
  tokenTypes[22].updateContext = (context) => {
9071
- if (context[context.length - 1] === types2.template) {
9071
+ if (context[context.length - 1] === types.template) {
9072
9072
  context.pop();
9073
9073
  } else {
9074
- context.push(types2.template);
9074
+ context.push(types.template);
9075
9075
  }
9076
9076
  };
9077
9077
  tokenTypes[143].updateContext = (context) => {
9078
- context.push(types2.j_expr, types2.j_oTag);
9078
+ context.push(types.j_expr, types.j_oTag);
9079
9079
  };
9080
9080
  var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
9081
9081
  var nonASCIIidentifierChars = "\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";
@@ -9863,7 +9863,7 @@ var require_lib = __commonJS((exports) => {
9863
9863
  return this.finishNode(node, "TypeParameterDeclaration");
9864
9864
  }
9865
9865
  flowInTopLevelContext(cb) {
9866
- if (this.curContext() !== types2.brace) {
9866
+ if (this.curContext() !== types.brace) {
9867
9867
  const oldContext = this.state.context;
9868
9868
  this.state.context = [oldContext[0]];
9869
9869
  try {
@@ -9898,7 +9898,7 @@ var require_lib = __commonJS((exports) => {
9898
9898
  this.state.noAnonFunctionType = oldNoAnonFunctionType;
9899
9899
  });
9900
9900
  this.state.inType = oldInType;
9901
- if (!this.state.inType && this.curContext() === types2.brace) {
9901
+ if (!this.state.inType && this.curContext() === types.brace) {
9902
9902
  this.reScan_lt_gt();
9903
9903
  }
9904
9904
  this.expect(48);
@@ -11173,7 +11173,7 @@ var require_lib = __commonJS((exports) => {
11173
11173
  context
11174
11174
  } = this.state;
11175
11175
  const currentContext = context[context.length - 1];
11176
- if (currentContext === types2.j_oTag || currentContext === types2.j_expr) {
11176
+ if (currentContext === types.j_oTag || currentContext === types.j_expr) {
11177
11177
  context.pop();
11178
11178
  }
11179
11179
  }
@@ -12279,9 +12279,9 @@ var require_lib = __commonJS((exports) => {
12279
12279
  switch (this.state.type) {
12280
12280
  case 5:
12281
12281
  node = this.startNode();
12282
- this.setContext(types2.brace);
12282
+ this.setContext(types.brace);
12283
12283
  this.next();
12284
- node = this.jsxParseExpressionContainer(node, types2.j_oTag);
12284
+ node = this.jsxParseExpressionContainer(node, types.j_oTag);
12285
12285
  if (node.expression.type === "JSXEmptyExpression") {
12286
12286
  this.raise(JsxErrors.AttributeIsEmpty, node);
12287
12287
  }
@@ -12300,7 +12300,7 @@ var require_lib = __commonJS((exports) => {
12300
12300
  jsxParseSpreadChild(node) {
12301
12301
  this.next();
12302
12302
  node.expression = this.parseExpression();
12303
- this.setContext(types2.j_expr);
12303
+ this.setContext(types.j_expr);
12304
12304
  this.state.canStartJSXElement = true;
12305
12305
  this.expect(8);
12306
12306
  return this.finishNode(node, "JSXSpreadChild");
@@ -12320,11 +12320,11 @@ var require_lib = __commonJS((exports) => {
12320
12320
  jsxParseAttribute() {
12321
12321
  const node = this.startNode();
12322
12322
  if (this.match(5)) {
12323
- this.setContext(types2.brace);
12323
+ this.setContext(types.brace);
12324
12324
  this.next();
12325
12325
  this.expect(21);
12326
12326
  node.argument = this.parseMaybeAssignAllowIn();
12327
- this.setContext(types2.j_oTag);
12327
+ this.setContext(types.j_oTag);
12328
12328
  this.state.canStartJSXElement = true;
12329
12329
  this.expect(8);
12330
12330
  return this.finishNode(node, "JSXSpreadAttribute");
@@ -12383,12 +12383,12 @@ var require_lib = __commonJS((exports) => {
12383
12383
  break;
12384
12384
  case 5: {
12385
12385
  const node2 = this.startNode();
12386
- this.setContext(types2.brace);
12386
+ this.setContext(types.brace);
12387
12387
  this.next();
12388
12388
  if (this.match(21)) {
12389
12389
  children.push(this.jsxParseSpreadChild(node2));
12390
12390
  } else {
12391
- children.push(this.jsxParseExpressionContainer(node2, types2.j_expr));
12391
+ children.push(this.jsxParseExpressionContainer(node2, types.j_expr));
12392
12392
  }
12393
12393
  break;
12394
12394
  }
@@ -12451,11 +12451,11 @@ var require_lib = __commonJS((exports) => {
12451
12451
  }
12452
12452
  getTokenFromCode(code2) {
12453
12453
  const context = this.curContext();
12454
- if (context === types2.j_expr) {
12454
+ if (context === types.j_expr) {
12455
12455
  this.jsxReadToken();
12456
12456
  return;
12457
12457
  }
12458
- if (context === types2.j_oTag || context === types2.j_cTag) {
12458
+ if (context === types.j_oTag || context === types.j_cTag) {
12459
12459
  if (isIdentifierStart(code2)) {
12460
12460
  this.jsxReadWord();
12461
12461
  return;
@@ -12465,7 +12465,7 @@ var require_lib = __commonJS((exports) => {
12465
12465
  this.finishToken(144);
12466
12466
  return;
12467
12467
  }
12468
- if ((code2 === 34 || code2 === 39) && context === types2.j_oTag) {
12468
+ if ((code2 === 34 || code2 === 39) && context === types.j_oTag) {
12469
12469
  this.jsxReadString(code2);
12470
12470
  return;
12471
12471
  }
@@ -12483,17 +12483,17 @@ var require_lib = __commonJS((exports) => {
12483
12483
  type
12484
12484
  } = this.state;
12485
12485
  if (type === 56 && prevType === 143) {
12486
- context.splice(-2, 2, types2.j_cTag);
12486
+ context.splice(-2, 2, types.j_cTag);
12487
12487
  this.state.canStartJSXElement = false;
12488
12488
  } else if (type === 143) {
12489
- context.push(types2.j_oTag);
12489
+ context.push(types.j_oTag);
12490
12490
  } else if (type === 144) {
12491
12491
  const out = context[context.length - 1];
12492
- if (out === types2.j_oTag && prevType === 56 || out === types2.j_cTag) {
12492
+ if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) {
12493
12493
  context.pop();
12494
- this.state.canStartJSXElement = context[context.length - 1] === types2.j_expr;
12494
+ this.state.canStartJSXElement = context[context.length - 1] === types.j_expr;
12495
12495
  } else {
12496
- this.setContext(types2.j_expr);
12496
+ this.setContext(types.j_expr);
12497
12497
  this.state.canStartJSXElement = true;
12498
12498
  }
12499
12499
  } else {
@@ -12901,7 +12901,7 @@ var require_lib = __commonJS((exports) => {
12901
12901
  this.end = 0;
12902
12902
  this.lastTokEndLoc = null;
12903
12903
  this.lastTokStartLoc = null;
12904
- this.context = [types2.brace];
12904
+ this.context = [types.brace];
12905
12905
  this.firstInvalidTemplateEscapePos = null;
12906
12906
  this.strictErrors = new Map;
12907
12907
  this.tokensLength = 0;
@@ -16304,14 +16304,14 @@ var require_lib = __commonJS((exports) => {
16304
16304
  tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
16305
16305
  const node = this.startNode();
16306
16306
  const hasLeadingOperator = this.eat(operator);
16307
- const types3 = [];
16307
+ const types2 = [];
16308
16308
  do {
16309
- types3.push(parseConstituentType());
16309
+ types2.push(parseConstituentType());
16310
16310
  } while (this.eat(operator));
16311
- if (types3.length === 1 && !hasLeadingOperator) {
16312
- return types3[0];
16311
+ if (types2.length === 1 && !hasLeadingOperator) {
16312
+ return types2[0];
16313
16313
  }
16314
- node.types = types3;
16314
+ node.types = types2;
16315
16315
  return this.finishNode(node, kind);
16316
16316
  }
16317
16317
  tsParseIntersectionTypeOrHigher() {
@@ -16557,7 +16557,7 @@ var require_lib = __commonJS((exports) => {
16557
16557
  return this.finishNode(node, "TSTypeAliasDeclaration");
16558
16558
  }
16559
16559
  tsInTopLevelContext(cb) {
16560
- if (this.curContext() !== types2.brace) {
16560
+ if (this.curContext() !== types.brace) {
16561
16561
  const oldContext = this.state.context;
16562
16562
  this.state.context = [oldContext[0]];
16563
16563
  try {
@@ -16878,7 +16878,7 @@ var require_lib = __commonJS((exports) => {
16878
16878
  }));
16879
16879
  if (node.params.length === 0) {
16880
16880
  this.raise(TSErrors.EmptyTypeArguments, node);
16881
- } else if (!this.state.inType && this.curContext() === types2.brace) {
16881
+ } else if (!this.state.inType && this.curContext() === types.brace) {
16882
16882
  this.reScan_lt_gt();
16883
16883
  }
16884
16884
  this.expect(48);
@@ -17580,7 +17580,7 @@ var require_lib = __commonJS((exports) => {
17580
17580
  context
17581
17581
  } = this.state;
17582
17582
  const currentContext = context[context.length - 1];
17583
- if (currentContext === types2.j_oTag || currentContext === types2.j_expr) {
17583
+ if (currentContext === types.j_oTag || currentContext === types.j_expr) {
17584
17584
  context.pop();
17585
17585
  }
17586
17586
  }
@@ -22504,15 +22504,28 @@ var init_ast_parser = __esm(() => {
22504
22504
  });
22505
22505
 
22506
22506
  // ../cms/src/content-config-ast.ts
22507
- import fs3 from "fs/promises";
22508
- import path2 from "path";
22507
+ import fs from "fs/promises";
22508
+ import path from "path";
22509
+ function resolveExpression(node, bindings, visited = new Set) {
22510
+ let current = node;
22511
+ while (current.type === "Identifier") {
22512
+ if (visited.has(current.name))
22513
+ return current;
22514
+ visited.add(current.name);
22515
+ const next = bindings.get(current.name);
22516
+ if (!next)
22517
+ return current;
22518
+ current = next;
22519
+ }
22520
+ return current;
22521
+ }
22509
22522
  async function parseContentConfig() {
22510
22523
  const projectRoot = getProjectRoot();
22511
22524
  for (const configPath of ["src/content/config.ts", "src/content.config.ts"]) {
22512
- const fullPath = path2.join(projectRoot, configPath);
22525
+ const fullPath = path.join(projectRoot, configPath);
22513
22526
  let stat;
22514
22527
  try {
22515
- stat = await fs3.stat(fullPath);
22528
+ stat = await fs.stat(fullPath);
22516
22529
  } catch {
22517
22530
  continue;
22518
22531
  }
@@ -22522,7 +22535,7 @@ async function parseContentConfig() {
22522
22535
  return cached.parsed;
22523
22536
  continue;
22524
22537
  }
22525
- const content = await fs3.readFile(fullPath, "utf-8");
22538
+ const content = await fs.readFile(fullPath, "utf-8");
22526
22539
  const parsed = parseConfigSource(content, configPath);
22527
22540
  parseCache.set(fullPath, { mtimeMs: stat.mtimeMs, parsed });
22528
22541
  if (parsed.size > 0)
@@ -22535,6 +22548,7 @@ function parseConfigSource(source, sourcePath) {
22535
22548
  const ast = parseFrontmatter(source, sourcePath);
22536
22549
  if (!ast)
22537
22550
  return result;
22551
+ const bindings = new Map;
22538
22552
  const collectionDecls = new Map;
22539
22553
  const exportMap = new Map;
22540
22554
  for (const stmt of ast.program.body) {
@@ -22546,6 +22560,7 @@ function parseConfigSource(source, sourcePath) {
22546
22560
  continue;
22547
22561
  if (!decl.init)
22548
22562
  continue;
22563
+ bindings.set(decl.id.name, decl.init);
22549
22564
  if (decl.id.name === "collections" && decl.init.type === "ObjectExpression") {
22550
22565
  for (const prop of decl.init.properties) {
22551
22566
  if (prop.type !== "ObjectProperty")
@@ -22574,12 +22589,12 @@ function parseConfigSource(source, sourcePath) {
22574
22589
  const schemaProperty = decl.properties.find((p) => p.type === "ObjectProperty" && propertyKeyName(p.key) === "schema");
22575
22590
  if (!schemaProperty)
22576
22591
  continue;
22577
- const schemaObject = unwrapSchemaToObject(schemaProperty.value);
22592
+ const schemaObject = unwrapSchemaToObject(schemaProperty.value, bindings);
22578
22593
  if (!schemaObject)
22579
22594
  continue;
22580
22595
  result.set(collectionName, {
22581
22596
  name: collectionName,
22582
- fields: parseSchemaFields(schemaObject)
22597
+ fields: parseSchemaFields(schemaObject, bindings)
22583
22598
  });
22584
22599
  }
22585
22600
  return result;
@@ -22594,30 +22609,34 @@ function propertyKeyName(key) {
22594
22609
  return key.value;
22595
22610
  return null;
22596
22611
  }
22597
- function unwrapSchemaToObject(node) {
22598
- if (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression") {
22599
- const body = node.body;
22612
+ function unwrapSchemaToObject(node, bindings) {
22613
+ const resolved = resolveExpression(node, bindings);
22614
+ if (resolved.type === "ArrowFunctionExpression" || resolved.type === "FunctionExpression") {
22615
+ const body = resolved.body;
22600
22616
  if (body.type === "BlockStatement") {
22601
22617
  for (const stmt of body.body) {
22602
22618
  if (stmt.type === "ReturnStatement" && stmt.argument) {
22603
- return unwrapSchemaToObject(stmt.argument);
22619
+ return unwrapSchemaToObject(stmt.argument, bindings);
22604
22620
  }
22605
22621
  }
22606
22622
  return null;
22607
22623
  }
22608
- return unwrapSchemaToObject(body);
22624
+ return unwrapSchemaToObject(body, bindings);
22609
22625
  }
22610
- if (node.type === "CallExpression") {
22611
- const callee = node.callee;
22626
+ if (resolved.type === "CallExpression") {
22627
+ const callee = resolved.callee;
22612
22628
  if (callee.type === "MemberExpression" && callee.object.type === "Identifier" && (callee.object.name === "z" || callee.object.name === "n") && callee.property.type === "Identifier" && callee.property.name === "object") {
22613
- const arg = node.arguments[0];
22614
- if (arg?.type === "ObjectExpression")
22615
- return arg;
22629
+ const arg = resolved.arguments[0];
22630
+ if (!arg)
22631
+ return null;
22632
+ const resolvedArg = resolveExpression(arg, bindings);
22633
+ if (resolvedArg.type === "ObjectExpression")
22634
+ return resolvedArg;
22616
22635
  }
22617
22636
  }
22618
22637
  return null;
22619
22638
  }
22620
- function parseSchemaFields(schemaObject) {
22639
+ function parseSchemaFields(schemaObject, bindings) {
22621
22640
  const fields = [];
22622
22641
  for (const prop of schemaObject.properties) {
22623
22642
  if (prop.type !== "ObjectProperty")
@@ -22626,18 +22645,18 @@ function parseSchemaFields(schemaObject) {
22626
22645
  if (!name)
22627
22646
  continue;
22628
22647
  const field = { name, required: true };
22629
- analyzeFieldExpression(prop.value, field);
22648
+ analyzeFieldExpression(prop.value, field, bindings);
22630
22649
  fields.push(field);
22631
22650
  }
22632
22651
  return fields;
22633
22652
  }
22634
- function analyzeFieldExpression(node, field) {
22635
- let current = node;
22653
+ function analyzeFieldExpression(node, field, bindings) {
22654
+ let current = resolveExpression(node, bindings);
22636
22655
  while (current) {
22637
22656
  if (current.type !== "CallExpression")
22638
22657
  return;
22639
22658
  if (isBaseCall(current)) {
22640
- analyzeBaseCall(current, field);
22659
+ analyzeBaseCall(current, field, bindings);
22641
22660
  return;
22642
22661
  }
22643
22662
  if (current.callee.type !== "MemberExpression")
@@ -22651,7 +22670,7 @@ function analyzeFieldExpression(node, field) {
22651
22670
  const direction = arg?.type === "StringLiteral" && arg.value === "desc" ? "desc" : "asc";
22652
22671
  field.orderBy = { direction };
22653
22672
  }
22654
- current = current.callee.object;
22673
+ current = resolveExpression(current.callee.object, bindings);
22655
22674
  }
22656
22675
  }
22657
22676
  function isBaseCall(node) {
@@ -22664,7 +22683,7 @@ function isBaseCall(node) {
22664
22683
  }
22665
22684
  return false;
22666
22685
  }
22667
- function analyzeBaseCall(node, field) {
22686
+ function analyzeBaseCall(node, field, bindings) {
22668
22687
  const callee = node.callee;
22669
22688
  if (callee.type === "Identifier") {
22670
22689
  if (callee.name === "image") {
@@ -22712,14 +22731,36 @@ function analyzeBaseCall(node, field) {
22712
22731
  }
22713
22732
  return;
22714
22733
  }
22734
+ if ((ns === "z" || ns === "n") && fn === "object") {
22735
+ const arg = node.arguments[0];
22736
+ if (!arg)
22737
+ return;
22738
+ const resolved = resolveExpression(arg, bindings);
22739
+ if (resolved.type === "ObjectExpression") {
22740
+ field.type = "object";
22741
+ field.fields = parseSchemaFields(resolved, bindings);
22742
+ }
22743
+ return;
22744
+ }
22715
22745
  if ((ns === "z" || ns === "n") && fn === "array") {
22716
- const inner = node.arguments[0];
22717
- if (inner?.type === "CallExpression" && inner.callee.type === "Identifier" && inner.callee.name === "reference") {
22746
+ const innerRaw = node.arguments[0];
22747
+ if (!innerRaw)
22748
+ return;
22749
+ const inner = resolveExpression(innerRaw, bindings);
22750
+ if (inner.type === "CallExpression" && inner.callee.type === "Identifier" && inner.callee.name === "reference") {
22718
22751
  const target = inner.arguments[0];
22719
22752
  if (target?.type === "StringLiteral") {
22720
22753
  field.reference = { target: target.value, isArray: true };
22721
22754
  }
22755
+ return;
22722
22756
  }
22757
+ const innerField = { name: "__item__", required: true };
22758
+ analyzeFieldExpression(inner, innerField, bindings);
22759
+ field.type = "array";
22760
+ if (innerField.type)
22761
+ field.itemType = innerField.type;
22762
+ if (innerField.fields)
22763
+ field.fields = innerField.fields;
22723
22764
  return;
22724
22765
  }
22725
22766
  }
@@ -22752,6 +22793,7 @@ var init_content_config_ast = __esm(() => {
22752
22793
  "text",
22753
22794
  "number",
22754
22795
  "image",
22796
+ "file",
22755
22797
  "url",
22756
22798
  "email",
22757
22799
  "tel",
@@ -22759,6 +22801,8 @@ var init_content_config_ast = __esm(() => {
22759
22801
  "date",
22760
22802
  "datetime",
22761
22803
  "time",
22804
+ "year",
22805
+ "month",
22762
22806
  "textarea"
22763
22807
  ]);
22764
22808
  VALID_HINT_KEYS = new Set([
@@ -22784,8 +22828,8 @@ function slugifyHref(text) {
22784
22828
  }
22785
22829
 
22786
22830
  // ../cms/src/collection-scanner.ts
22787
- import fs4 from "fs/promises";
22788
- import path3 from "path";
22831
+ import fs2 from "fs/promises";
22832
+ import path2 from "path";
22789
22833
  function normalizeFieldName(name) {
22790
22834
  return name.toLowerCase().replace(/[_-]/g, "");
22791
22835
  }
@@ -22886,7 +22930,9 @@ function inferFieldType(value, key) {
22886
22930
  }
22887
22931
  return "text";
22888
22932
  }
22889
- function mergeFieldObservations(observations) {
22933
+ function mergeFieldObservations(observations, depth = 0) {
22934
+ if (depth >= MAX_NESTED_FIELD_DEPTH)
22935
+ return [];
22890
22936
  const fields = [];
22891
22937
  for (const obs of observations) {
22892
22938
  const nonNullValues = obs.values.filter((v2) => v2 !== null && v2 !== undefined);
@@ -22937,11 +22983,21 @@ function mergeFieldObservations(observations) {
22937
22983
  for (const item of objectItems) {
22938
22984
  collectFieldObservations(subFieldMap, item, objectItems.length);
22939
22985
  }
22940
- field.fields = mergeFieldObservations(Array.from(subFieldMap.values()));
22986
+ field.fields = mergeFieldObservations(Array.from(subFieldMap.values()), depth + 1);
22941
22987
  }
22942
22988
  }
22943
22989
  }
22944
22990
  }
22991
+ if (fieldType === "object") {
22992
+ const objectValues = nonNullValues.filter((v2) => typeof v2 === "object" && v2 !== null && !Array.isArray(v2));
22993
+ if (objectValues.length > 0) {
22994
+ const subFieldMap = new Map;
22995
+ for (const item of objectValues) {
22996
+ collectFieldObservations(subFieldMap, item, objectValues.length);
22997
+ }
22998
+ field.fields = mergeFieldObservations(Array.from(subFieldMap.values()), depth + 1);
22999
+ }
23000
+ }
22945
23001
  fields.push(field);
22946
23002
  }
22947
23003
  return fields;
@@ -22967,7 +23023,7 @@ function buildCollectionDefinition(collectionName, contentDir, fieldMap, entryIn
22967
23023
  return {
22968
23024
  name: collectionName,
22969
23025
  label,
22970
- path: path3.join(contentDir, collectionName),
23026
+ path: path2.join(contentDir, collectionName),
22971
23027
  entryCount,
22972
23028
  fields,
22973
23029
  fileExtension: "md",
@@ -22977,7 +23033,7 @@ function buildCollectionDefinition(collectionName, contentDir, fieldMap, entryIn
22977
23033
  }
22978
23034
  async function scanCollection(collectionPath, collectionName, contentDir) {
22979
23035
  try {
22980
- const dirEntries = await fs4.readdir(collectionPath, { withFileTypes: true });
23036
+ const dirEntries = await fs2.readdir(collectionPath, { withFileTypes: true });
22981
23037
  const sources = [];
22982
23038
  const takenSlugs = new Set;
22983
23039
  for (const entry of dirEntries) {
@@ -22994,9 +23050,9 @@ async function scanCollection(collectionPath, collectionName, contentDir) {
22994
23050
  if (takenSlugs.has(dir.name))
22995
23051
  return null;
22996
23052
  for (const ext of ["md", "mdx"]) {
22997
- const relPath = path3.join(dir.name, `index.${ext}`);
23053
+ const relPath = path2.join(dir.name, `index.${ext}`);
22998
23054
  try {
22999
- await fs4.access(path3.join(collectionPath, relPath));
23055
+ await fs2.access(path2.join(collectionPath, relPath));
23000
23056
  return { slug: dir.name, relPath };
23001
23057
  } catch {}
23002
23058
  }
@@ -23014,7 +23070,7 @@ async function scanCollection(collectionPath, collectionName, contentDir) {
23014
23070
  const allDirectives = {};
23015
23071
  const entryInfos = [];
23016
23072
  let hasDraft = false;
23017
- const fileContents = await Promise.all(sources.map((s) => fs4.readFile(path3.join(collectionPath, s.relPath), "utf-8")));
23073
+ const fileContents = await Promise.all(sources.map((s) => fs2.readFile(path2.join(collectionPath, s.relPath), "utf-8")));
23018
23074
  for (let i = 0;i < sources.length; i++) {
23019
23075
  const source = sources[i];
23020
23076
  const content = fileContents[i];
@@ -23027,7 +23083,7 @@ async function scanCollection(collectionPath, collectionName, contentDir) {
23027
23083
  }
23028
23084
  const entryInfo = {
23029
23085
  slug: source.slug,
23030
- sourcePath: path3.join(contentDir, collectionName, source.relPath)
23086
+ sourcePath: path2.join(contentDir, collectionName, source.relPath)
23031
23087
  };
23032
23088
  if (frontmatter) {
23033
23089
  if (typeof frontmatter.title === "string") {
@@ -23069,19 +23125,53 @@ function applyParsedConfig(collections, parsed) {
23069
23125
  const field = fieldsByName.get(pf.name);
23070
23126
  if (!field)
23071
23127
  continue;
23072
- if (pf.type) {
23073
- field.type = pf.type;
23074
- if (pf.options)
23075
- field.options = pf.options;
23076
- }
23077
- if (pf.hints)
23078
- field.hints = pf.hints;
23079
- if (pf.astroImage)
23080
- field.astroImage = true;
23081
- field.required = pf.required;
23128
+ applyParsedFieldOverrides(field, pf);
23082
23129
  }
23083
23130
  }
23084
23131
  }
23132
+ function applyParsedFieldOverrides(field, pf) {
23133
+ if (pf.type) {
23134
+ field.type = pf.type;
23135
+ if (pf.options)
23136
+ field.options = pf.options;
23137
+ }
23138
+ if (pf.itemType)
23139
+ field.itemType = pf.itemType;
23140
+ if (pf.hints)
23141
+ field.hints = pf.hints;
23142
+ if (pf.astroImage)
23143
+ field.astroImage = true;
23144
+ field.required = pf.required;
23145
+ if (pf.fields) {
23146
+ const existingByName = new Map((field.fields ?? []).map((f) => [f.name, f]));
23147
+ field.fields = pf.fields.map((subPf) => {
23148
+ const existing = existingByName.get(subPf.name);
23149
+ if (existing) {
23150
+ applyParsedFieldOverrides(existing, subPf);
23151
+ return existing;
23152
+ }
23153
+ return parsedFieldToFieldDefinition(subPf);
23154
+ });
23155
+ }
23156
+ }
23157
+ function parsedFieldToFieldDefinition(pf) {
23158
+ const fd = {
23159
+ name: pf.name,
23160
+ type: pf.type ?? (pf.fields ? "object" : "text"),
23161
+ required: pf.required
23162
+ };
23163
+ if (pf.options)
23164
+ fd.options = pf.options;
23165
+ if (pf.itemType)
23166
+ fd.itemType = pf.itemType;
23167
+ if (pf.hints)
23168
+ fd.hints = pf.hints;
23169
+ if (pf.astroImage)
23170
+ fd.astroImage = true;
23171
+ if (pf.fields)
23172
+ fd.fields = pf.fields.map(parsedFieldToFieldDefinition);
23173
+ return fd;
23174
+ }
23085
23175
  function applyCollectionOrderBy(collections, parsed) {
23086
23176
  for (const [collectionName, parsedColl] of parsed) {
23087
23177
  const orderField = parsedColl.fields.find((f) => f.orderBy);
@@ -23275,7 +23365,7 @@ function detectDerivedHrefFields(collections) {
23275
23365
  }
23276
23366
  async function scanDataCollection(collectionPath, collectionName, contentDir) {
23277
23367
  try {
23278
- const dirEntries = await fs4.readdir(collectionPath, { withFileTypes: true });
23368
+ const dirEntries = await fs2.readdir(collectionPath, { withFileTypes: true });
23279
23369
  const sources = [];
23280
23370
  const takenSlugs = new Set;
23281
23371
  for (const entry of dirEntries) {
@@ -23292,9 +23382,9 @@ async function scanDataCollection(collectionPath, collectionName, contentDir) {
23292
23382
  if (takenSlugs.has(dir.name))
23293
23383
  return null;
23294
23384
  for (const indexExt of ["json", "yaml", "yml"]) {
23295
- const relPath = path3.join(dir.name, `index.${indexExt}`);
23385
+ const relPath = path2.join(dir.name, `index.${indexExt}`);
23296
23386
  try {
23297
- await fs4.access(path3.join(collectionPath, relPath));
23387
+ await fs2.access(path2.join(collectionPath, relPath));
23298
23388
  return { slug: dir.name, relPath };
23299
23389
  } catch {}
23300
23390
  }
@@ -23309,7 +23399,7 @@ async function scanDataCollection(collectionPath, collectionName, contentDir) {
23309
23399
  const fieldMap = new Map;
23310
23400
  const entryInfos = [];
23311
23401
  const ext = sources.some((s) => s.relPath.endsWith(".json")) ? "json" : sources.some((s) => s.relPath.endsWith(".yaml")) ? "yaml" : "yml";
23312
- const fileContents = await Promise.all(sources.map((s) => fs4.readFile(path3.join(collectionPath, s.relPath), "utf-8").catch(() => null)));
23402
+ const fileContents = await Promise.all(sources.map((s) => fs2.readFile(path2.join(collectionPath, s.relPath), "utf-8").catch(() => null)));
23313
23403
  for (let i = 0;i < sources.length; i++) {
23314
23404
  const source = sources[i];
23315
23405
  const raw = fileContents[i];
@@ -23327,7 +23417,7 @@ async function scanDataCollection(collectionPath, collectionName, contentDir) {
23327
23417
  entryInfos.push({
23328
23418
  slug: source.slug,
23329
23419
  title,
23330
- sourcePath: path3.join(contentDir, collectionName, source.relPath),
23420
+ sourcePath: path2.join(contentDir, collectionName, source.relPath),
23331
23421
  data
23332
23422
  });
23333
23423
  collectFieldObservations(fieldMap, data, sources.length);
@@ -23342,12 +23432,12 @@ async function scanDataCollection(collectionPath, collectionName, contentDir) {
23342
23432
  }
23343
23433
  async function scanCollections(contentDir = "src/content") {
23344
23434
  const projectRoot = getProjectRoot();
23345
- const fullContentDir = path3.isAbsolute(contentDir) ? contentDir : path3.join(projectRoot, contentDir);
23435
+ const fullContentDir = path2.isAbsolute(contentDir) ? contentDir : path2.join(projectRoot, contentDir);
23346
23436
  const collections = {};
23347
23437
  try {
23348
- const entries = await fs4.readdir(fullContentDir, { withFileTypes: true });
23438
+ const entries = await fs2.readdir(fullContentDir, { withFileTypes: true });
23349
23439
  const scanPromises = entries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("_") && !entry.name.startsWith(".")).map(async (entry) => {
23350
- const collectionPath = path3.join(fullContentDir, entry.name);
23440
+ const collectionPath = path2.join(fullContentDir, entry.name);
23351
23441
  const definition = await scanCollection(collectionPath, entry.name, contentDir) ?? await scanDataCollection(collectionPath, entry.name, contentDir);
23352
23442
  if (definition) {
23353
23443
  collections[entry.name] = definition;
@@ -23363,7 +23453,7 @@ async function scanCollections(contentDir = "src/content") {
23363
23453
  applyCollectionOrderBy(collections, parsed);
23364
23454
  return collections;
23365
23455
  }
23366
- var import_yaml, DATE_PATTERN, URL_PATTERN, IMAGE_EXTENSIONS, MAX_SELECT_OPTIONS = 10, TEXTAREA_MIN_LENGTH = 200, SIDEBAR_FIELD_NAMES, DIRECTIVE_PATTERN, FREE_TEXT_FIELD_NAMES, PUBLISH_TOGGLE_NAMES, PUBLISH_DATE_NAMES, FRONTMATTER_PATTERN, HREF_SUFFIXES;
23456
+ var import_yaml, DATE_PATTERN, URL_PATTERN, IMAGE_EXTENSIONS, MAX_SELECT_OPTIONS = 10, TEXTAREA_MIN_LENGTH = 200, SIDEBAR_FIELD_NAMES, DIRECTIVE_PATTERN, FREE_TEXT_FIELD_NAMES, PUBLISH_TOGGLE_NAMES, PUBLISH_DATE_NAMES, FRONTMATTER_PATTERN, MAX_NESTED_FIELD_DEPTH = 16, HREF_SUFFIXES;
23367
23457
  var init_collection_scanner = __esm(() => {
23368
23458
  init_config();
23369
23459
  init_content_config_ast();
@@ -23413,8 +23503,8 @@ var init_collection_scanner = __esm(() => {
23413
23503
  });
23414
23504
 
23415
23505
  // ../cms/src/component-registry.ts
23416
- import fs5 from "fs/promises";
23417
- import path4 from "path";
23506
+ import fs3 from "fs/promises";
23507
+ import path3 from "path";
23418
23508
 
23419
23509
  class ComponentRegistry {
23420
23510
  components = new Map;
@@ -23424,7 +23514,7 @@ class ComponentRegistry {
23424
23514
  }
23425
23515
  async scan() {
23426
23516
  for (const dir of this.componentDirs) {
23427
- const fullPath = path4.join(getProjectRoot(), dir);
23517
+ const fullPath = path3.join(getProjectRoot(), dir);
23428
23518
  try {
23429
23519
  await this.scanDirectory(fullPath, dir);
23430
23520
  } catch {}
@@ -23437,10 +23527,10 @@ class ComponentRegistry {
23437
23527
  return this.components.get(name);
23438
23528
  }
23439
23529
  async scanDirectory(dir, relativePath) {
23440
- const entries = await fs5.readdir(dir, { withFileTypes: true });
23530
+ const entries = await fs3.readdir(dir, { withFileTypes: true });
23441
23531
  for (const entry of entries) {
23442
- const fullPath = path4.join(dir, entry.name);
23443
- const relPath = path4.join(relativePath, entry.name);
23532
+ const fullPath = path3.join(dir, entry.name);
23533
+ const relPath = path3.join(relativePath, entry.name);
23444
23534
  if (entry.isDirectory()) {
23445
23535
  await this.scanDirectory(fullPath, relPath);
23446
23536
  } else if (entry.isFile() && entry.name.endsWith(".astro")) {
@@ -23450,8 +23540,8 @@ class ComponentRegistry {
23450
23540
  }
23451
23541
  async parseComponent(filePath, relativePath) {
23452
23542
  try {
23453
- const content = await fs5.readFile(filePath, "utf-8");
23454
- const componentName = path4.basename(filePath, ".astro");
23543
+ const content = await fs3.readFile(filePath, "utf-8");
23544
+ const componentName = path3.basename(filePath, ".astro");
23455
23545
  const props = await this.extractProps(content);
23456
23546
  const slots = this.extractSlots(content);
23457
23547
  const description = this.extractDescription(content);
@@ -23710,14 +23800,14 @@ var init_local = __esm(() => {
23710
23800
  });
23711
23801
 
23712
23802
  // ../cms/src/media/project-images.ts
23713
- import fs6 from "fs/promises";
23714
- import path5 from "path";
23803
+ import fs4 from "fs/promises";
23804
+ import path4 from "path";
23715
23805
  async function listProjectImages(options) {
23716
23806
  const root = getProjectRoot();
23717
- const excludeDir = options?.excludeDir ? path5.resolve(options.excludeDir) : null;
23807
+ const excludeDir = options?.excludeDir ? path4.resolve(options.excludeDir) : null;
23718
23808
  const scanDirs = [
23719
- { dir: path5.join(root, "public"), urlPrefix: "" },
23720
- { dir: path5.join(root, "src"), urlPrefix: null }
23809
+ { dir: path4.join(root, "public"), urlPrefix: "" },
23810
+ { dir: path4.join(root, "src"), urlPrefix: null }
23721
23811
  ];
23722
23812
  const results = await Promise.all(scanDirs.map(({ dir, urlPrefix }) => {
23723
23813
  const items2 = [];
@@ -23728,11 +23818,11 @@ async function listProjectImages(options) {
23728
23818
  return items;
23729
23819
  }
23730
23820
  async function scanDirectory(currentDir, baseDir, urlPrefix, excludeDir, items) {
23731
- if (excludeDir && path5.resolve(currentDir) === excludeDir)
23821
+ if (excludeDir && path4.resolve(currentDir) === excludeDir)
23732
23822
  return;
23733
23823
  let entries;
23734
23824
  try {
23735
- entries = await fs6.readdir(currentDir, { withFileTypes: true });
23825
+ entries = await fs4.readdir(currentDir, { withFileTypes: true });
23736
23826
  } catch {
23737
23827
  return;
23738
23828
  }
@@ -23741,15 +23831,15 @@ async function scanDirectory(currentDir, baseDir, urlPrefix, excludeDir, items)
23741
23831
  const name = String(entry.name);
23742
23832
  if (name.startsWith(".") || name === "node_modules")
23743
23833
  continue;
23744
- const fullPath = path5.join(currentDir, name);
23834
+ const fullPath = path4.join(currentDir, name);
23745
23835
  if (entry.isDirectory()) {
23746
23836
  subdirs.push(scanDirectory(fullPath, baseDir, urlPrefix, excludeDir, items));
23747
23837
  } else if (entry.isFile()) {
23748
- const ext = path5.extname(name).toLowerCase();
23838
+ const ext = path4.extname(name).toLowerCase();
23749
23839
  if (!IMAGE_EXTENSIONS2.has(ext))
23750
23840
  continue;
23751
- const relativePath = path5.relative(baseDir, fullPath).split(path5.sep).join("/");
23752
- const url = urlPrefix !== null ? `/${relativePath}` : `/${path5.relative(getProjectRoot(), fullPath).split(path5.sep).join("/")}`;
23841
+ const relativePath = path4.relative(baseDir, fullPath).split(path4.sep).join("/");
23842
+ const url = urlPrefix !== null ? `/${relativePath}` : `/${path4.relative(getProjectRoot(), fullPath).split(path4.sep).join("/")}`;
23753
23843
  items.push({
23754
23844
  id: `project:${url}`,
23755
23845
  url,
@@ -23769,7 +23859,7 @@ var init_project_images = __esm(() => {
23769
23859
 
23770
23860
  // ../cms/src/utils.ts
23771
23861
  import { createHash } from "crypto";
23772
- import path6 from "path";
23862
+ import path5 from "path";
23773
23863
  function normalizePagePath(url) {
23774
23864
  let pathname;
23775
23865
  try {
@@ -23822,21 +23912,21 @@ function escapeReplacement(str) {
23822
23912
  return str.replace(/\$/g, "$$$$");
23823
23913
  }
23824
23914
  function resolveSourcePath(sourcePath) {
23825
- return path6.isAbsolute(sourcePath) ? sourcePath : path6.join(getProjectRoot(), sourcePath);
23915
+ return path5.isAbsolute(sourcePath) ? sourcePath : path5.join(getProjectRoot(), sourcePath);
23826
23916
  }
23827
23917
  function resolveAndValidatePath(filePath) {
23828
23918
  const projectRoot = getProjectRoot();
23829
- const resolvedRoot = path6.resolve(projectRoot);
23919
+ const resolvedRoot = path5.resolve(projectRoot);
23830
23920
  const isAbsoluteFs = filePath.startsWith(resolvedRoot);
23831
23921
  const normalizedPath = !isAbsoluteFs && filePath.startsWith("/") ? filePath.slice(1) : filePath;
23832
- const fullPath = path6.isAbsolute(normalizedPath) ? path6.resolve(normalizedPath) : path6.resolve(projectRoot, normalizedPath);
23833
- if (!fullPath.startsWith(resolvedRoot + path6.sep) && fullPath !== resolvedRoot) {
23922
+ const fullPath = path5.isAbsolute(normalizedPath) ? path5.resolve(normalizedPath) : path5.resolve(projectRoot, normalizedPath);
23923
+ if (!fullPath.startsWith(resolvedRoot + path5.sep) && fullPath !== resolvedRoot) {
23834
23924
  throw new Error(`Path traversal detected: ${filePath}`);
23835
23925
  }
23836
23926
  return fullPath;
23837
23927
  }
23838
23928
  async function acquireFileLock(filePath) {
23839
- const key = path6.resolve(filePath);
23929
+ const key = path5.resolve(filePath);
23840
23930
  while (fileLocks.has(key)) {
23841
23931
  await fileLocks.get(key);
23842
23932
  }
@@ -23857,8 +23947,8 @@ function escapeHtml(text) {
23857
23947
  return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
23858
23948
  }
23859
23949
  function relativeImportPath(fromFile, toFile) {
23860
- const fromDir = path6.dirname(fromFile);
23861
- let rel = path6.relative(fromDir, toFile).split(path6.sep).join("/");
23950
+ const fromDir = path5.dirname(fromFile);
23951
+ let rel = path5.relative(fromDir, toFile).split(path5.sep).join("/");
23862
23952
  if (!rel.startsWith("."))
23863
23953
  rel = `./${rel}`;
23864
23954
  return rel;
@@ -23870,8 +23960,8 @@ var init_utils2 = __esm(() => {
23870
23960
  });
23871
23961
 
23872
23962
  // ../cms/src/handlers/component-ops.ts
23873
- import fs7 from "fs/promises";
23874
- import path7 from "path";
23963
+ import fs5 from "fs/promises";
23964
+ import path6 from "path";
23875
23965
  async function handleInsertComponent(request, manifestWriter) {
23876
23966
  const { position, referenceComponentId, componentName, props, meta } = request;
23877
23967
  if (!meta?.url) {
@@ -23904,7 +23994,7 @@ async function handleInsertComponent(request, manifestWriter) {
23904
23994
  try {
23905
23995
  let currentContent;
23906
23996
  try {
23907
- currentContent = await fs7.readFile(fullPath, "utf-8");
23997
+ currentContent = await fs5.readFile(fullPath, "utf-8");
23908
23998
  } catch {
23909
23999
  return { success: false, error: `Source file not found: ${filePath}` };
23910
24000
  }
@@ -23929,7 +24019,7 @@ async function handleInsertComponent(request, manifestWriter) {
23929
24019
  `);
23930
24020
  lines.splice(insertIndex, 0, indentedJsx);
23931
24021
  ensureComponentImport(lines, componentName, componentDef.file, filePath);
23932
- await fs7.writeFile(fullPath, lines.join(`
24022
+ await fs5.writeFile(fullPath, lines.join(`
23933
24023
  `), "utf-8");
23934
24024
  return {
23935
24025
  success: true,
@@ -23972,7 +24062,7 @@ async function handleRemoveComponent(request, manifestWriter) {
23972
24062
  try {
23973
24063
  let currentContent;
23974
24064
  try {
23975
- currentContent = await fs7.readFile(fullPath, "utf-8");
24065
+ currentContent = await fs5.readFile(fullPath, "utf-8");
23976
24066
  } catch {
23977
24067
  return { success: false, error: `Source file not found: ${filePath}` };
23978
24068
  }
@@ -23994,7 +24084,7 @@ async function handleRemoveComponent(request, manifestWriter) {
23994
24084
  removeCount++;
23995
24085
  }
23996
24086
  lines.splice(startLine, removeCount);
23997
- await fs7.writeFile(fullPath, lines.join(`
24087
+ await fs5.writeFile(fullPath, lines.join(`
23998
24088
  `), "utf-8");
23999
24089
  return {
24000
24090
  success: true,
@@ -24089,9 +24179,9 @@ function getComponentOccurrenceIndex(manifest, referenceComponent) {
24089
24179
  async function findComponentInvocationFile(projectRoot, pageUrl, manifest, referenceComponent) {
24090
24180
  if (referenceComponent.invocationSourcePath) {
24091
24181
  const filePath = normalizeFilePath(referenceComponent.invocationSourcePath);
24092
- const fullPath = path7.resolve(projectRoot, filePath);
24182
+ const fullPath = path6.resolve(projectRoot, filePath);
24093
24183
  try {
24094
- const content = await fs7.readFile(fullPath, "utf-8");
24184
+ const content = await fs5.readFile(fullPath, "utf-8");
24095
24185
  const lines = content.split(`
24096
24186
  `);
24097
24187
  const lineIndex = findComponentInvocationLine(lines, referenceComponent.componentName, referenceComponent.invocationIndex ?? 0);
@@ -24103,9 +24193,9 @@ async function findComponentInvocationFile(projectRoot, pageUrl, manifest, refer
24103
24193
  const candidates = getPageFileCandidates(pageUrl);
24104
24194
  const occurrenceIndex = getComponentOccurrenceIndex(manifest, referenceComponent);
24105
24195
  for (const candidate of candidates) {
24106
- const fullPath = path7.resolve(projectRoot, candidate);
24196
+ const fullPath = path6.resolve(projectRoot, candidate);
24107
24197
  try {
24108
- const content = await fs7.readFile(fullPath, "utf-8");
24198
+ const content = await fs5.readFile(fullPath, "utf-8");
24109
24199
  const lines = content.split(`
24110
24200
  `);
24111
24201
  const lineIndex = findComponentInvocationLine(lines, referenceComponent.componentName, occurrenceIndex);
@@ -24163,7 +24253,7 @@ function getIndentation(line) {
24163
24253
  function normalizeFilePath(p) {
24164
24254
  if (!p.startsWith("/"))
24165
24255
  return p;
24166
- const projectRoot = path7.resolve(getProjectRoot());
24256
+ const projectRoot = path6.resolve(getProjectRoot());
24167
24257
  if (p.startsWith(projectRoot))
24168
24258
  return p;
24169
24259
  return p.slice(1);
@@ -24195,7 +24285,7 @@ var init_component_ops = __esm(() => {
24195
24285
  });
24196
24286
 
24197
24287
  // ../cms/src/handlers/array-ops.ts
24198
- import fs8 from "fs/promises";
24288
+ import fs6 from "fs/promises";
24199
24289
  function parseInlineArrayName(componentName) {
24200
24290
  if (!componentName.startsWith("__array:"))
24201
24291
  return null;
@@ -24275,7 +24365,7 @@ async function resolveArrayContext(component, manifest, pageUrl) {
24275
24365
  const { arrayVarName, mapOccurrence } = parsed;
24276
24366
  const filePath2 = normalizeFilePath(component.invocationSourcePath ?? component.sourcePath);
24277
24367
  const fullPath2 = resolveAndValidatePath(filePath2);
24278
- const content2 = await fs8.readFile(fullPath2, "utf-8");
24368
+ const content2 = await fs6.readFile(fullPath2, "utf-8");
24279
24369
  const lines2 = content2.split(`
24280
24370
  `);
24281
24371
  const fmEnd2 = findFrontmatterEnd(lines2);
@@ -24320,7 +24410,7 @@ async function resolveArrayContext(component, manifest, pageUrl) {
24320
24410
  const invocation = await findComponentInvocationFile(projectRoot, pageUrl, manifest, component);
24321
24411
  const filePath = invocation?.filePath ?? normalizeFilePath(component.invocationSourcePath ?? component.sourcePath);
24322
24412
  const fullPath = resolveAndValidatePath(filePath);
24323
- const content = await fs8.readFile(fullPath, "utf-8");
24413
+ const content = await fs6.readFile(fullPath, "utf-8");
24324
24414
  const lines = content.split(`
24325
24415
  `);
24326
24416
  let refLineIndex;
@@ -24392,7 +24482,7 @@ async function handleRemoveArrayItem(request, manifestWriter) {
24392
24482
  const { fullPath, arrayIndex } = ctx;
24393
24483
  const release = await acquireFileLock(fullPath);
24394
24484
  try {
24395
- const freshContent = await fs8.readFile(fullPath, "utf-8");
24485
+ const freshContent = await fs6.readFile(fullPath, "utf-8");
24396
24486
  const freshLines = freshContent.split(`
24397
24487
  `);
24398
24488
  const freshFmEnd = findFrontmatterEnd(freshLines);
@@ -24421,7 +24511,7 @@ async function handleRemoveArrayItem(request, manifestWriter) {
24421
24511
  freshLines[removeStart - 1] = prevLine.replace(/,\s*$/, "");
24422
24512
  }
24423
24513
  }
24424
- await fs8.writeFile(fullPath, freshLines.join(`
24514
+ await fs6.writeFile(fullPath, freshLines.join(`
24425
24515
  `), "utf-8");
24426
24516
  return {
24427
24517
  success: true,
@@ -24463,7 +24553,7 @@ async function handleAddArrayItem(request, manifestWriter) {
24463
24553
  const { fullPath, arrayIndex } = ctx;
24464
24554
  const release = await acquireFileLock(fullPath);
24465
24555
  try {
24466
- const freshContent = await fs8.readFile(fullPath, "utf-8");
24556
+ const freshContent = await fs6.readFile(fullPath, "utf-8");
24467
24557
  const freshLines = freshContent.split(`
24468
24558
  `);
24469
24559
  const freshFmEnd = findFrontmatterEnd(freshLines);
@@ -24514,7 +24604,7 @@ async function handleAddArrayItem(request, manifestWriter) {
24514
24604
  break;
24515
24605
  }
24516
24606
  }
24517
- await fs8.writeFile(fullPath, freshLines.join(`
24607
+ await fs6.writeFile(fullPath, freshLines.join(`
24518
24608
  `), "utf-8");
24519
24609
  return {
24520
24610
  success: true,
@@ -24570,46 +24660,46 @@ var init_array_ops = __esm(() => {
24570
24660
 
24571
24661
  // ../cms/src/astro-image-paths.ts
24572
24662
  import { createHash as createHash2 } from "crypto";
24573
- import fs9 from "fs/promises";
24574
- import path8 from "path";
24663
+ import fs7 from "fs/promises";
24664
+ import path7 from "path";
24575
24665
  function isHugoStyleEntry(entryAbsPath) {
24576
- return HUGO_INDEX_RE.test(path8.basename(entryAbsPath));
24666
+ return HUGO_INDEX_RE.test(path7.basename(entryAbsPath));
24577
24667
  }
24578
24668
  function shortContentHash(buf) {
24579
24669
  return createHash2("sha256").update(buf).digest("hex").slice(0, 8);
24580
24670
  }
24581
24671
  async function pickAstroImageTarget(args) {
24582
- const entryDir = path8.dirname(args.entryAbsPath);
24672
+ const entryDir = path7.dirname(args.entryAbsPath);
24583
24673
  const isHugoStyle = isHugoStyleEntry(args.entryAbsPath);
24584
- const safeFilename = path8.basename(args.originalFilename);
24674
+ const safeFilename = path7.basename(args.originalFilename);
24585
24675
  if (!safeFilename || safeFilename === "." || safeFilename === "..") {
24586
24676
  throw new Error(`Invalid filename: ${args.originalFilename}`);
24587
24677
  }
24588
24678
  const baseName = isHugoStyle ? safeFilename : `${args.slug}-${safeFilename}`;
24589
- const baseAbs = path8.join(entryDir, baseName);
24679
+ const baseAbs = path7.join(entryDir, baseName);
24590
24680
  if (await isFreeOrMatching(baseAbs, args.compareBuffer)) {
24591
24681
  return { absPath: baseAbs, relPath: `./${baseName}` };
24592
24682
  }
24593
24683
  const candidateAbs = await pickHashedSibling(entryDir, baseName, args.compareBuffer);
24594
- return { absPath: candidateAbs, relPath: `./${path8.basename(candidateAbs)}` };
24684
+ return { absPath: candidateAbs, relPath: `./${path7.basename(candidateAbs)}` };
24595
24685
  }
24596
24686
  async function pickSiblingTarget(dir, filename, buf) {
24597
- const safe = path8.basename(filename);
24687
+ const safe = path7.basename(filename);
24598
24688
  if (!safe || safe === "." || safe === "..") {
24599
24689
  throw new Error(`Invalid filename: ${filename}`);
24600
24690
  }
24601
- const baseAbs = path8.join(dir, safe);
24691
+ const baseAbs = path7.join(dir, safe);
24602
24692
  if (await isFreeOrMatching(baseAbs, buf))
24603
24693
  return baseAbs;
24604
24694
  return pickHashedSibling(dir, safe, buf);
24605
24695
  }
24606
24696
  async function pickHashedSibling(dir, baseName, buf) {
24607
24697
  const hash = shortContentHash(buf);
24608
- const ext = path8.extname(baseName);
24609
- const stem = path8.basename(baseName, ext);
24698
+ const ext = path7.extname(baseName);
24699
+ const stem = path7.basename(baseName, ext);
24610
24700
  for (let attempt = 0;attempt < 5; attempt++) {
24611
24701
  const suffix = attempt === 0 ? hash : `${hash}-${attempt}`;
24612
- const candidateAbs = path8.join(dir, `${stem}-${suffix}${ext}`);
24702
+ const candidateAbs = path7.join(dir, `${stem}-${suffix}${ext}`);
24613
24703
  if (await isFreeOrMatching(candidateAbs, buf))
24614
24704
  return candidateAbs;
24615
24705
  }
@@ -24617,10 +24707,10 @@ async function pickHashedSibling(dir, baseName, buf) {
24617
24707
  }
24618
24708
  async function isFreeOrMatching(absPath, compareBuffer) {
24619
24709
  try {
24620
- const stat = await fs9.stat(absPath);
24710
+ const stat = await fs7.stat(absPath);
24621
24711
  if (stat.size !== compareBuffer.length)
24622
24712
  return false;
24623
- const existing = await fs9.readFile(absPath);
24713
+ const existing = await fs7.readFile(absPath);
24624
24714
  return compareBuffer.equals(existing);
24625
24715
  } catch {
24626
24716
  return true;
@@ -24632,8 +24722,8 @@ var init_astro_image_paths = __esm(() => {
24632
24722
  });
24633
24723
 
24634
24724
  // ../cms/src/handlers/astro-image-upload.ts
24635
- import fs10 from "fs/promises";
24636
- import path9 from "path";
24725
+ import fs8 from "fs/promises";
24726
+ import path8 from "path";
24637
24727
  async function tryAstroImageUpload(args) {
24638
24728
  const { collection, entry, field } = args.context;
24639
24729
  if (!collection || !entry || !field)
@@ -24655,12 +24745,12 @@ async function tryAstroImageUpload(args) {
24655
24745
  originalFilename: args.originalFilename,
24656
24746
  compareBuffer: args.fileBuffer
24657
24747
  });
24658
- await fs10.mkdir(path9.dirname(target.absPath), { recursive: true });
24659
- await fs10.writeFile(target.absPath, args.fileBuffer);
24748
+ await fs8.mkdir(path8.dirname(target.absPath), { recursive: true });
24749
+ await fs8.writeFile(target.absPath, args.fileBuffer);
24660
24750
  return {
24661
24751
  success: true,
24662
24752
  url: target.relPath,
24663
- filename: path9.basename(target.absPath)
24753
+ filename: path8.basename(target.absPath)
24664
24754
  };
24665
24755
  }
24666
24756
  var init_astro_image_upload = __esm(() => {
@@ -24669,12 +24759,12 @@ var init_astro_image_upload = __esm(() => {
24669
24759
  });
24670
24760
 
24671
24761
  // ../cms/src/handlers/markdown-ops.ts
24672
- import fs11 from "fs/promises";
24673
- import path10 from "path";
24762
+ import fs9 from "fs/promises";
24763
+ import path9 from "path";
24674
24764
  async function handleGetMarkdownContent(filePath) {
24675
24765
  try {
24676
24766
  const fullPath = resolveAndValidatePath(filePath);
24677
- const raw = await fs11.readFile(fullPath, "utf-8");
24767
+ const raw = await fs9.readFile(fullPath, "utf-8");
24678
24768
  if (isDataFile(filePath)) {
24679
24769
  const data = filePath.endsWith(".json") ? JSON.parse(raw) : import_yaml2.default.parse(raw);
24680
24770
  return {
@@ -24699,14 +24789,14 @@ async function handleUpdateMarkdown(request, componentDefinitions) {
24699
24789
  const release = await acquireFileLock(fullPath);
24700
24790
  try {
24701
24791
  if (isDataFile(request.filePath)) {
24702
- const raw = await fs11.readFile(fullPath, "utf-8");
24792
+ const raw = await fs9.readFile(fullPath, "utf-8");
24703
24793
  const existing = request.filePath.endsWith(".json") ? JSON.parse(raw) : import_yaml2.default.parse(raw);
24704
24794
  const merged = { ...existing ?? {}, ...request.frontmatter };
24705
24795
  const output = request.filePath.endsWith(".json") ? JSON.stringify(merged, null, 2) + `
24706
24796
  ` : import_yaml2.default.stringify(merged);
24707
- await fs11.writeFile(fullPath, output, "utf-8");
24797
+ await fs9.writeFile(fullPath, output, "utf-8");
24708
24798
  } else {
24709
- const raw = await fs11.readFile(fullPath, "utf-8");
24799
+ const raw = await fs9.readFile(fullPath, "utf-8");
24710
24800
  const existing = parseFrontmatter3(raw);
24711
24801
  const mergedFrontmatter = {
24712
24802
  ...existing.frontmatter,
@@ -24717,7 +24807,7 @@ async function handleUpdateMarkdown(request, componentDefinitions) {
24717
24807
  finalContent = ensureMdxImports(finalContent, request.filePath, componentDefinitions);
24718
24808
  }
24719
24809
  const markdownContent = serializeFrontmatter(mergedFrontmatter, finalContent);
24720
- await fs11.writeFile(fullPath, markdownContent, "utf-8");
24810
+ await fs9.writeFile(fullPath, markdownContent, "utf-8");
24721
24811
  }
24722
24812
  return { success: true };
24723
24813
  } finally {
@@ -24756,8 +24846,8 @@ async function handleCreateMarkdown(request) {
24756
24846
  fileContent = serializeFrontmatter(fullFrontmatter, content);
24757
24847
  }
24758
24848
  try {
24759
- await fs11.mkdir(path10.dirname(fullPath), { recursive: true });
24760
- await fs11.writeFile(fullPath, fileContent, { encoding: "utf-8", flag: "wx" });
24849
+ await fs9.mkdir(path9.dirname(fullPath), { recursive: true });
24850
+ await fs9.writeFile(fullPath, fileContent, { encoding: "utf-8", flag: "wx" });
24761
24851
  return {
24762
24852
  success: true,
24763
24853
  filePath,
@@ -24774,8 +24864,8 @@ async function handleCreateMarkdown(request) {
24774
24864
  async function handleDeleteMarkdown(request) {
24775
24865
  try {
24776
24866
  const fullPath = resolveAndValidatePath(request.filePath);
24777
- await fs11.access(fullPath);
24778
- await fs11.unlink(fullPath);
24867
+ await fs9.access(fullPath);
24868
+ await fs9.unlink(fullPath);
24779
24869
  return { success: true };
24780
24870
  } catch (error) {
24781
24871
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
@@ -24792,16 +24882,16 @@ async function handleRenameMarkdown(request) {
24792
24882
  if (!normalizedSlug) {
24793
24883
  return { success: false, error: "Invalid slug" };
24794
24884
  }
24795
- const dir = path10.dirname(fullPath);
24796
- const ext = path10.extname(fullPath);
24797
- const newFullPath = path10.join(dir, `${normalizedSlug}${ext}`);
24885
+ const dir = path9.dirname(fullPath);
24886
+ const ext = path9.extname(fullPath);
24887
+ const newFullPath = path9.join(dir, `${normalizedSlug}${ext}`);
24798
24888
  if (fullPath === newFullPath) {
24799
24889
  return { success: true, newFilePath: request.filePath, newSlug: normalizedSlug };
24800
24890
  }
24801
24891
  const release = await acquireFileLock(fullPath);
24802
24892
  try {
24803
24893
  try {
24804
- await fs11.link(fullPath, newFullPath);
24894
+ await fs9.link(fullPath, newFullPath);
24805
24895
  } catch (err) {
24806
24896
  if (isNodeError(err, "EEXIST")) {
24807
24897
  return { success: false, error: `File already exists: ${normalizedSlug}${ext}` };
@@ -24809,16 +24899,16 @@ async function handleRenameMarkdown(request) {
24809
24899
  throw err;
24810
24900
  }
24811
24901
  try {
24812
- await fs11.unlink(fullPath);
24902
+ await fs9.unlink(fullPath);
24813
24903
  } catch (err) {
24814
- await fs11.unlink(newFullPath).catch(() => {});
24904
+ await fs9.unlink(newFullPath).catch(() => {});
24815
24905
  throw err;
24816
24906
  }
24817
24907
  } finally {
24818
24908
  release();
24819
24909
  }
24820
24910
  const projectRoot = getProjectRoot();
24821
- const newFilePath = path10.relative(projectRoot, newFullPath).split(path10.sep).join("/");
24911
+ const newFilePath = path9.relative(projectRoot, newFullPath).split(path9.sep).join("/");
24822
24912
  return { success: true, newFilePath, newSlug: normalizedSlug };
24823
24913
  } catch (error) {
24824
24914
  const message = error instanceof Error ? error.message : String(error);
@@ -24910,7 +25000,7 @@ function ensureMdxImports(content, filePath, componentDefinitions) {
24910
25000
  }
24911
25001
  }
24912
25002
  const root = getProjectRoot();
24913
- const mdxFullPath = path10.join(root, filePath);
25003
+ const mdxFullPath = path9.join(root, filePath);
24914
25004
  const missingImports = [];
24915
25005
  for (const name of usedComponents) {
24916
25006
  if (importedNames.has(name))
@@ -24918,7 +25008,7 @@ function ensureMdxImports(content, filePath, componentDefinitions) {
24918
25008
  const def = componentDefinitions[name];
24919
25009
  if (!def)
24920
25010
  continue;
24921
- const componentAbsPath = path10.join(root, def.file);
25011
+ const componentAbsPath = path9.join(root, def.file);
24922
25012
  const rel = relativeImportPath(mdxFullPath, componentAbsPath);
24923
25013
  missingImports.push(`import ${name} from '${rel}'`);
24924
25014
  }
@@ -24943,8 +25033,8 @@ var init_markdown_ops = __esm(() => {
24943
25033
  });
24944
25034
 
24945
25035
  // ../cms/src/handlers/page-ops.ts
24946
- import fs12 from "fs/promises";
24947
- import path11 from "path";
25036
+ import fs10 from "fs/promises";
25037
+ import path10 from "path";
24948
25038
  async function handleCreatePage(request) {
24949
25039
  const { title, slug } = request;
24950
25040
  const normalizedSlug = slugify(slug || title);
@@ -24956,8 +25046,8 @@ async function handleCreatePage(request) {
24956
25046
  const layoutImport = await resolveLayoutImport(request.layoutPath);
24957
25047
  const content = generatePageContent(title, layoutImport);
24958
25048
  try {
24959
- await fs12.mkdir(path11.dirname(fullPath), { recursive: true });
24960
- await fs12.writeFile(fullPath, content, { encoding: "utf-8", flag: "wx" });
25049
+ await fs10.mkdir(path10.dirname(fullPath), { recursive: true });
25050
+ await fs10.writeFile(fullPath, content, { encoding: "utf-8", flag: "wx" });
24961
25051
  const url = normalizedSlug === "index" ? "/" : `/${normalizedSlug}`;
24962
25052
  return { success: true, filePath, slug: normalizedSlug, url };
24963
25053
  } catch (error) {
@@ -24979,7 +25069,7 @@ async function handleDuplicatePage(request) {
24979
25069
  }
24980
25070
  let content;
24981
25071
  try {
24982
- content = await fs12.readFile(resolveAndValidatePath(sourceFile), "utf-8");
25072
+ content = await fs10.readFile(resolveAndValidatePath(sourceFile), "utf-8");
24983
25073
  } catch {
24984
25074
  return { success: false, error: `Could not read source file: ${sourceFile}` };
24985
25075
  }
@@ -24989,8 +25079,8 @@ async function handleDuplicatePage(request) {
24989
25079
  const newFilePath = `src/pages/${normalizedSlug}.astro`;
24990
25080
  const newFullPath = resolveAndValidatePath(newFilePath);
24991
25081
  try {
24992
- await fs12.mkdir(path11.dirname(newFullPath), { recursive: true });
24993
- await fs12.writeFile(newFullPath, content, { encoding: "utf-8", flag: "wx" });
25082
+ await fs10.mkdir(path10.dirname(newFullPath), { recursive: true });
25083
+ await fs10.writeFile(newFullPath, content, { encoding: "utf-8", flag: "wx" });
24994
25084
  const url = normalizedSlug === "index" ? "/" : `/${normalizedSlug}`;
24995
25085
  return { success: true, filePath: newFilePath, slug: normalizedSlug, url };
24996
25086
  } catch (error) {
@@ -25007,7 +25097,7 @@ async function handleDeletePage(request) {
25007
25097
  return { success: false, error: `Page not found: ${pagePath}` };
25008
25098
  }
25009
25099
  try {
25010
- await fs12.unlink(resolveAndValidatePath(pageFile));
25100
+ await fs10.unlink(resolveAndValidatePath(pageFile));
25011
25101
  return { success: true, filePath: pageFile, url: pagePath };
25012
25102
  } catch (error) {
25013
25103
  if (isNodeError(error, "ENOENT")) {
@@ -25024,10 +25114,10 @@ async function handleCheckSlugExists(slug) {
25024
25114
  return found ? { exists: true, filePath: found } : { exists: false };
25025
25115
  }
25026
25116
  async function handleGetLayouts() {
25027
- const layoutsDir = path11.join(getProjectRoot(), "src", "layouts");
25117
+ const layoutsDir = path10.join(getProjectRoot(), "src", "layouts");
25028
25118
  let entries;
25029
25119
  try {
25030
- entries = await fs12.readdir(layoutsDir, { withFileTypes: true });
25120
+ entries = await fs10.readdir(layoutsDir, { withFileTypes: true });
25031
25121
  } catch {
25032
25122
  return [];
25033
25123
  }
@@ -25035,7 +25125,7 @@ async function handleGetLayouts() {
25035
25125
  for (const entry of entries) {
25036
25126
  if (entry.isFile() && entry.name.endsWith(".astro")) {
25037
25127
  layouts.push({
25038
- name: path11.basename(entry.name, ".astro"),
25128
+ name: path10.basename(entry.name, ".astro"),
25039
25129
  path: `src/layouts/${entry.name}`
25040
25130
  });
25041
25131
  }
@@ -25047,7 +25137,7 @@ function errorMessage(error) {
25047
25137
  }
25048
25138
  async function fileExists(fullPath) {
25049
25139
  try {
25050
- await fs12.access(fullPath);
25140
+ await fs10.access(fullPath);
25051
25141
  return true;
25052
25142
  } catch {
25053
25143
  return false;
@@ -25069,7 +25159,7 @@ async function findPageFile(pagePath) {
25069
25159
  }
25070
25160
  async function resolveLayoutImport(layoutPath) {
25071
25161
  if (layoutPath) {
25072
- const name = path11.basename(layoutPath, ".astro");
25162
+ const name = path10.basename(layoutPath, ".astro");
25073
25163
  const importPath2 = `../${layoutPath.replace(/^src\//, "")}`;
25074
25164
  return { importPath: importPath2, componentName: pascalCase(name) };
25075
25165
  }
@@ -25132,10 +25222,10 @@ var init_page_ops = __esm(() => {
25132
25222
  });
25133
25223
 
25134
25224
  // ../cms/src/handlers/redirect-ops.ts
25135
- import fs13 from "fs/promises";
25136
- import path12 from "path";
25225
+ import fs11 from "fs/promises";
25226
+ import path11 from "path";
25137
25227
  function getRedirectsFilePath() {
25138
- return path12.join(getProjectRoot(), REDIRECTS_FILE);
25228
+ return path11.join(getProjectRoot(), REDIRECTS_FILE);
25139
25229
  }
25140
25230
  async function handleGetRedirects() {
25141
25231
  const lines = await readRedirectsFile(getRedirectsFilePath());
@@ -25212,7 +25302,7 @@ function formatRedirectLine(source, destination, statusCode) {
25212
25302
  }
25213
25303
  async function readRedirectsFile(filePath) {
25214
25304
  try {
25215
- const content = await fs13.readFile(filePath, "utf-8");
25305
+ const content = await fs11.readFile(filePath, "utf-8");
25216
25306
  return content.split(`
25217
25307
  `);
25218
25308
  } catch (error) {
@@ -25222,16 +25312,16 @@ async function readRedirectsFile(filePath) {
25222
25312
  }
25223
25313
  }
25224
25314
  async function writeRedirectsFile(filePath, lines) {
25225
- await fs13.mkdir(path12.dirname(filePath), { recursive: true });
25315
+ await fs11.mkdir(path11.dirname(filePath), { recursive: true });
25226
25316
  const trimmed = lines.slice();
25227
25317
  while (trimmed.length > 0 && trimmed[trimmed.length - 1].trim() === "") {
25228
25318
  trimmed.pop();
25229
25319
  }
25230
25320
  if (trimmed.length === 0) {
25231
- await fs13.writeFile(filePath, "", "utf-8");
25321
+ await fs11.writeFile(filePath, "", "utf-8");
25232
25322
  return;
25233
25323
  }
25234
- await fs13.writeFile(filePath, trimmed.join(`
25324
+ await fs11.writeFile(filePath, trimmed.join(`
25235
25325
  `) + `
25236
25326
  `, "utf-8");
25237
25327
  }
@@ -31019,8 +31109,8 @@ var init_snippet_utils = __esm(() => {
31019
31109
  });
31020
31110
 
31021
31111
  // ../cms/src/handlers/source-writer.ts
31022
- import fs14 from "fs/promises";
31023
- import path13 from "path";
31112
+ import fs12 from "fs/promises";
31113
+ import path12 from "path";
31024
31114
  async function handleUpdate(request, manifestWriter) {
31025
31115
  const { changes, meta } = request;
31026
31116
  const errors = [];
@@ -31050,17 +31140,17 @@ async function handleUpdate(request, manifestWriter) {
31050
31140
  const fullPath = resolveAndValidatePath(filePath);
31051
31141
  const release = await acquireFileLock(fullPath);
31052
31142
  try {
31053
- const currentContent = await fs14.readFile(fullPath, "utf-8");
31143
+ const currentContent = await fs12.readFile(fullPath, "utf-8");
31054
31144
  const { newContent, appliedCount, failedChanges, fileOps } = await applyChanges(currentContent, fileChanges, manifest, fullPath, meta.url);
31055
31145
  if (failedChanges.length > 0) {
31056
31146
  errors.push(...failedChanges);
31057
31147
  }
31058
31148
  if (appliedCount > 0 && newContent !== currentContent) {
31059
31149
  for (const op of fileOps) {
31060
- await fs14.mkdir(path13.dirname(op.target), { recursive: true });
31061
- await fs14.writeFile(op.target, op.bytes);
31150
+ await fs12.mkdir(path12.dirname(op.target), { recursive: true });
31151
+ await fs12.writeFile(op.target, op.bytes);
31062
31152
  }
31063
- await fs14.writeFile(fullPath, newContent, "utf-8");
31153
+ await fs12.writeFile(fullPath, newContent, "utf-8");
31064
31154
  updated += appliedCount;
31065
31155
  }
31066
31156
  } finally {
@@ -31323,8 +31413,8 @@ async function tryRewriteAssetImport(content, importInfo, newSrc, absFilePath, o
31323
31413
  const resolved = await resolveNewSrcBytes(newSrc, originUrl);
31324
31414
  if (!resolved)
31325
31415
  return null;
31326
- const originalAssetAbs = path13.resolve(path13.dirname(absFilePath), importInfo.source);
31327
- const targetAbs = await pickSiblingTarget(path13.dirname(originalAssetAbs), resolved.filename, resolved.bytes);
31416
+ const originalAssetAbs = path12.resolve(path12.dirname(absFilePath), importInfo.source);
31417
+ const targetAbs = await pickSiblingTarget(path12.dirname(originalAssetAbs), resolved.filename, resolved.bytes);
31328
31418
  const newRelImport = relativeImportPath(absFilePath, targetAbs);
31329
31419
  const newContent = content.slice(0, importInfo.sourceStart) + newRelImport + content.slice(importInfo.sourceEnd);
31330
31420
  return {
@@ -31334,11 +31424,11 @@ async function tryRewriteAssetImport(content, importInfo, newSrc, absFilePath, o
31334
31424
  };
31335
31425
  }
31336
31426
  async function resolveNewSrcBytes(newSrc, originUrl) {
31337
- const filenameFromPath = (p) => path13.basename(p.split("?")[0] ?? p);
31338
- const diskPath = newSrc.startsWith("/src/") ? path13.join(getProjectRoot(), newSrc.slice(1)) : newSrc.startsWith("/") && !newSrc.startsWith("//") ? path13.join(getProjectRoot(), "public", newSrc.replace(/^\/+/, "")) : null;
31427
+ const filenameFromPath = (p) => path12.basename(p.split("?")[0] ?? p);
31428
+ const diskPath = newSrc.startsWith("/src/") ? path12.join(getProjectRoot(), newSrc.slice(1)) : newSrc.startsWith("/") && !newSrc.startsWith("//") ? path12.join(getProjectRoot(), "public", newSrc.replace(/^\/+/, "")) : null;
31339
31429
  if (diskPath) {
31340
31430
  try {
31341
- return { bytes: await fs14.readFile(diskPath), filename: filenameFromPath(newSrc) };
31431
+ return { bytes: await fs12.readFile(diskPath), filename: filenameFromPath(newSrc) };
31342
31432
  } catch {}
31343
31433
  }
31344
31434
  try {
@@ -31883,7 +31973,7 @@ var init_source_writer = __esm(() => {
31883
31973
  });
31884
31974
 
31885
31975
  // ../cms/src/handlers/api-routes.ts
31886
- import path14 from "path";
31976
+ import path13 from "path";
31887
31977
  function requireMedia(ctx) {
31888
31978
  if (!ctx.mediaAdapter) {
31889
31979
  sendError(ctx.res, "Media storage not configured", 501);
@@ -31973,7 +32063,7 @@ var init_api_routes = __esm(() => {
31973
32063
  }),
31974
32064
  custom("POST", "markdown/delete", async ({ req, res, manifestWriter, contentDir }) => {
31975
32065
  const body = await parseJsonBody(req);
31976
- const fullPath = path14.resolve(getProjectRoot(), body.filePath?.replace(/^\//, "") ?? "");
32066
+ const fullPath = path13.resolve(getProjectRoot(), body.filePath?.replace(/^\//, "") ?? "");
31977
32067
  expectedDeletions.add(fullPath);
31978
32068
  const result = await handleDeleteMarkdown(body);
31979
32069
  if (result.success) {
@@ -32081,7 +32171,7 @@ var init_api_routes = __esm(() => {
32081
32171
  const body = await parseJsonBody(req);
32082
32172
  const result = await handleDeletePage(body);
32083
32173
  if (result.success && result.filePath) {
32084
- expectedDeletions.add(path14.resolve(getProjectRoot(), result.filePath));
32174
+ expectedDeletions.add(path13.resolve(getProjectRoot(), result.filePath));
32085
32175
  }
32086
32176
  if (result.success && body.createRedirect && body.redirectTo) {
32087
32177
  await handleAddRedirect({ source: body.pagePath, destination: body.redirectTo, statusCode: 307 });
@@ -32185,8 +32275,8 @@ var init_color_patterns = __esm(() => {
32185
32275
  });
32186
32276
 
32187
32277
  // ../cms/src/tailwind-colors.ts
32188
- import fs15 from "fs/promises";
32189
- import path15 from "path";
32278
+ import fs13 from "fs/promises";
32279
+ import path14 from "path";
32190
32280
  async function parseTailwindConfig(projectRoot = getProjectRoot()) {
32191
32281
  const cssFiles = [
32192
32282
  "src/styles/global.css",
@@ -32200,9 +32290,9 @@ async function parseTailwindConfig(projectRoot = getProjectRoot()) {
32200
32290
  ];
32201
32291
  let customColors = [];
32202
32292
  for (const cssFile of cssFiles) {
32203
- const fullPath = path15.join(projectRoot, cssFile);
32293
+ const fullPath = path14.join(projectRoot, cssFile);
32204
32294
  try {
32205
- const content = await fs15.readFile(fullPath, "utf-8");
32295
+ const content = await fs13.readFile(fullPath, "utf-8");
32206
32296
  customColors = extractColorsFromCss(content);
32207
32297
  if (customColors.length > 0) {
32208
32298
  break;
@@ -32273,9 +32363,9 @@ async function parseTextStyles(projectRoot = getProjectRoot()) {
32273
32363
  ];
32274
32364
  let customTextStyles = {};
32275
32365
  for (const cssFile of cssFiles) {
32276
- const fullPath = path15.join(projectRoot, cssFile);
32366
+ const fullPath = path14.join(projectRoot, cssFile);
32277
32367
  try {
32278
- const content = await fs15.readFile(fullPath, "utf-8");
32368
+ const content = await fs13.readFile(fullPath, "utf-8");
32279
32369
  customTextStyles = extractTextStylesFromCss(content);
32280
32370
  if (Object.values(customTextStyles).some((arr) => arr && arr.length > 0)) {
32281
32371
  break;
@@ -32729,8 +32819,8 @@ var init_dev_middleware = __esm(() => {
32729
32819
  });
32730
32820
 
32731
32821
  // ../cms/src/manifest-writer.ts
32732
- import fs16 from "fs/promises";
32733
- import path16 from "path";
32822
+ import fs14 from "fs/promises";
32823
+ import path15 from "path";
32734
32824
 
32735
32825
  class ManifestWriter {
32736
32826
  globalManifest;
@@ -32801,10 +32891,10 @@ class ManifestWriter {
32801
32891
  }
32802
32892
  getPageManifestPath(pagePath) {
32803
32893
  if (pagePath === "/" || pagePath === "") {
32804
- return path16.join(this.outDir, "index.json");
32894
+ return path15.join(this.outDir, "index.json");
32805
32895
  }
32806
32896
  const cleanPath = pagePath.replace(/^\//, "");
32807
- return path16.join(this.outDir, `${cleanPath}.json`);
32897
+ return path15.join(this.outDir, `${cleanPath}.json`);
32808
32898
  }
32809
32899
  addPage(pagePath, entries, components, collection, seo) {
32810
32900
  this.pageManifests.set(pagePath, { entries, components, collection, seo });
@@ -32830,8 +32920,8 @@ class ManifestWriter {
32830
32920
  }
32831
32921
  async writePageManifest(pagePath, entries, components, collection, seo) {
32832
32922
  const manifestPath = this.getPageManifestPath(pagePath);
32833
- const manifestDir = path16.dirname(manifestPath);
32834
- await fs16.mkdir(manifestDir, { recursive: true });
32923
+ const manifestDir = path15.dirname(manifestPath);
32924
+ await fs14.mkdir(manifestDir, { recursive: true });
32835
32925
  const metadata = {
32836
32926
  version: MANIFEST_VERSION,
32837
32927
  generatedAt: new Date().toISOString(),
@@ -32852,7 +32942,7 @@ class ManifestWriter {
32852
32942
  if (seo) {
32853
32943
  pageManifest.seo = seo;
32854
32944
  }
32855
- await fs16.writeFile(manifestPath, JSON.stringify(pageManifest, null, 2), "utf-8");
32945
+ await fs14.writeFile(manifestPath, JSON.stringify(pageManifest, null, 2), "utf-8");
32856
32946
  }
32857
32947
  async finalize() {
32858
32948
  await this.writeQueue;
@@ -32881,7 +32971,7 @@ class ManifestWriter {
32881
32971
  }
32882
32972
  }
32883
32973
  if (this.outDir) {
32884
- const globalManifestPath = path16.join(this.outDir, this.manifestFile);
32974
+ const globalManifestPath = path15.join(this.outDir, this.manifestFile);
32885
32975
  const globalSettings = {
32886
32976
  componentDefinitions: this.componentDefinitions,
32887
32977
  pages
@@ -32895,7 +32985,7 @@ class ManifestWriter {
32895
32985
  if (this.availableTextStyles) {
32896
32986
  globalSettings.availableTextStyles = this.availableTextStyles;
32897
32987
  }
32898
- await fs16.writeFile(globalManifestPath, JSON.stringify(globalSettings, null, 2), "utf-8");
32988
+ await fs14.writeFile(globalManifestPath, JSON.stringify(globalSettings, null, 2), "utf-8");
32899
32989
  }
32900
32990
  return {
32901
32991
  totalEntries: Object.keys(this.globalManifest.entries).length,
@@ -32961,17 +33051,533 @@ var init_vite_plugin = __esm(() => {
32961
33051
  init_vite_plugin_array_transform();
32962
33052
  });
32963
33053
 
33054
+ // ../../node_modules/zod/v4/core/core.js
33055
+ function $constructor(name, initializer, params) {
33056
+ function init2(inst, def) {
33057
+ if (!inst._zod) {
33058
+ Object.defineProperty(inst, "_zod", {
33059
+ value: {
33060
+ def,
33061
+ constr: _2,
33062
+ traits: new Set
33063
+ },
33064
+ enumerable: false
33065
+ });
33066
+ }
33067
+ if (inst._zod.traits.has(name)) {
33068
+ return;
33069
+ }
33070
+ inst._zod.traits.add(name);
33071
+ initializer(inst, def);
33072
+ const proto = _2.prototype;
33073
+ const keys = Object.keys(proto);
33074
+ for (let i = 0;i < keys.length; i++) {
33075
+ const k = keys[i];
33076
+ if (!(k in inst)) {
33077
+ inst[k] = proto[k].bind(inst);
33078
+ }
33079
+ }
33080
+ }
33081
+ const Parent = params?.Parent ?? Object;
33082
+
33083
+ class Definition extends Parent {
33084
+ }
33085
+ Object.defineProperty(Definition, "name", { value: name });
33086
+ function _2(def) {
33087
+ var _a;
33088
+ const inst = params?.Parent ? new Definition : this;
33089
+ init2(inst, def);
33090
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
33091
+ for (const fn of inst._zod.deferred) {
33092
+ fn();
33093
+ }
33094
+ return inst;
33095
+ }
33096
+ Object.defineProperty(_2, "init", { value: init2 });
33097
+ Object.defineProperty(_2, Symbol.hasInstance, {
33098
+ value: (inst) => {
33099
+ if (params?.Parent && inst instanceof params.Parent)
33100
+ return true;
33101
+ return inst?._zod?.traits?.has(name);
33102
+ }
33103
+ });
33104
+ Object.defineProperty(_2, "name", { value: name });
33105
+ return _2;
33106
+ }
33107
+ function config(newConfig) {
33108
+ if (newConfig)
33109
+ Object.assign(globalConfig, newConfig);
33110
+ return globalConfig;
33111
+ }
33112
+ var NEVER, $brand, globalConfig;
33113
+ var init_core = __esm(() => {
33114
+ NEVER = Object.freeze({
33115
+ status: "aborted"
33116
+ });
33117
+ $brand = Symbol("zod_brand");
33118
+ globalConfig = {};
33119
+ });
33120
+
33121
+ // ../../node_modules/zod/v4/core/util.js
33122
+ function joinValues(array, separator = "|") {
33123
+ return array.map((val) => stringifyPrimitive(val)).join(separator);
33124
+ }
33125
+ function jsonStringifyReplacer(_2, value) {
33126
+ if (typeof value === "bigint")
33127
+ return value.toString();
33128
+ return value;
33129
+ }
33130
+ function cached(getter) {
33131
+ const set = false;
33132
+ return {
33133
+ get value() {
33134
+ if (!set) {
33135
+ const value = getter();
33136
+ Object.defineProperty(this, "value", { value });
33137
+ return value;
33138
+ }
33139
+ throw new Error("cached value already set");
33140
+ }
33141
+ };
33142
+ }
33143
+ function stringifyPrimitive(value) {
33144
+ if (typeof value === "bigint")
33145
+ return value.toString() + "n";
33146
+ if (typeof value === "string")
33147
+ return `"${value}"`;
33148
+ return `${value}`;
33149
+ }
33150
+ function parsedType(data) {
33151
+ const t = typeof data;
33152
+ switch (t) {
33153
+ case "number": {
33154
+ return Number.isNaN(data) ? "nan" : "number";
33155
+ }
33156
+ case "object": {
33157
+ if (data === null) {
33158
+ return "null";
33159
+ }
33160
+ if (Array.isArray(data)) {
33161
+ return "array";
33162
+ }
33163
+ const obj = data;
33164
+ if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
33165
+ return obj.constructor.name;
33166
+ }
33167
+ }
33168
+ }
33169
+ return t;
33170
+ }
33171
+ var EVALUATING, captureStackTrace, allowsEval, propertyKeyTypes, primitiveTypes, NUMBER_FORMAT_RANGES;
33172
+ var init_util = __esm(() => {
33173
+ EVALUATING = Symbol("evaluating");
33174
+ captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
33175
+ allowsEval = cached(() => {
33176
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
33177
+ return false;
33178
+ }
33179
+ try {
33180
+ const F = Function;
33181
+ new F("");
33182
+ return true;
33183
+ } catch (_2) {
33184
+ return false;
33185
+ }
33186
+ });
33187
+ propertyKeyTypes = new Set(["string", "number", "symbol"]);
33188
+ primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
33189
+ NUMBER_FORMAT_RANGES = {
33190
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
33191
+ int32: [-2147483648, 2147483647],
33192
+ uint32: [0, 4294967295],
33193
+ float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000],
33194
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
33195
+ };
33196
+ });
33197
+
33198
+ // ../../node_modules/zod/v4/core/errors.js
33199
+ function flattenError(error, mapper = (issue) => issue.message) {
33200
+ const fieldErrors = {};
33201
+ const formErrors = [];
33202
+ for (const sub of error.issues) {
33203
+ if (sub.path.length > 0) {
33204
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
33205
+ fieldErrors[sub.path[0]].push(mapper(sub));
33206
+ } else {
33207
+ formErrors.push(mapper(sub));
33208
+ }
33209
+ }
33210
+ return { formErrors, fieldErrors };
33211
+ }
33212
+ function formatError(error, mapper = (issue) => issue.message) {
33213
+ const fieldErrors = { _errors: [] };
33214
+ const processError = (error2) => {
33215
+ for (const issue of error2.issues) {
33216
+ if (issue.code === "invalid_union" && issue.errors.length) {
33217
+ issue.errors.map((issues) => processError({ issues }));
33218
+ } else if (issue.code === "invalid_key") {
33219
+ processError({ issues: issue.issues });
33220
+ } else if (issue.code === "invalid_element") {
33221
+ processError({ issues: issue.issues });
33222
+ } else if (issue.path.length === 0) {
33223
+ fieldErrors._errors.push(mapper(issue));
33224
+ } else {
33225
+ let curr = fieldErrors;
33226
+ let i = 0;
33227
+ while (i < issue.path.length) {
33228
+ const el = issue.path[i];
33229
+ const terminal = i === issue.path.length - 1;
33230
+ if (!terminal) {
33231
+ curr[el] = curr[el] || { _errors: [] };
33232
+ } else {
33233
+ curr[el] = curr[el] || { _errors: [] };
33234
+ curr[el]._errors.push(mapper(issue));
33235
+ }
33236
+ curr = curr[el];
33237
+ i++;
33238
+ }
33239
+ }
33240
+ }
33241
+ };
33242
+ processError(error);
33243
+ return fieldErrors;
33244
+ }
33245
+ var initializer = (inst, def) => {
33246
+ inst.name = "$ZodError";
33247
+ Object.defineProperty(inst, "_zod", {
33248
+ value: inst._zod,
33249
+ enumerable: false
33250
+ });
33251
+ Object.defineProperty(inst, "issues", {
33252
+ value: def,
33253
+ enumerable: false
33254
+ });
33255
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
33256
+ Object.defineProperty(inst, "toString", {
33257
+ value: () => inst.message,
33258
+ enumerable: false
33259
+ });
33260
+ }, $ZodError, $ZodRealError;
33261
+ var init_errors = __esm(() => {
33262
+ init_core();
33263
+ init_util();
33264
+ $ZodError = $constructor("$ZodError", initializer);
33265
+ $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
33266
+ });
33267
+
33268
+ // ../../node_modules/zod/v4/core/parse.js
33269
+ var init_parse = () => {};
33270
+
33271
+ // ../../node_modules/zod/v4/core/regexes.js
33272
+ var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`, date;
33273
+ var init_regexes = __esm(() => {
33274
+ date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
33275
+ });
33276
+
33277
+ // ../../node_modules/zod/v4/core/checks.js
33278
+ var init_checks = () => {};
33279
+
33280
+ // ../../node_modules/zod/v4/core/versions.js
33281
+ var init_versions = () => {};
33282
+
33283
+ // ../../node_modules/zod/v4/core/schemas.js
33284
+ var init_schemas = () => {};
33285
+
33286
+ // ../../node_modules/zod/v4/locales/en.js
33287
+ function en_default() {
33288
+ return {
33289
+ localeError: error()
33290
+ };
33291
+ }
33292
+ var error = () => {
33293
+ const Sizable = {
33294
+ string: { unit: "characters", verb: "to have" },
33295
+ file: { unit: "bytes", verb: "to have" },
33296
+ array: { unit: "items", verb: "to have" },
33297
+ set: { unit: "items", verb: "to have" },
33298
+ map: { unit: "entries", verb: "to have" }
33299
+ };
33300
+ function getSizing(origin) {
33301
+ return Sizable[origin] ?? null;
33302
+ }
33303
+ const FormatDictionary = {
33304
+ regex: "input",
33305
+ email: "email address",
33306
+ url: "URL",
33307
+ emoji: "emoji",
33308
+ uuid: "UUID",
33309
+ uuidv4: "UUIDv4",
33310
+ uuidv6: "UUIDv6",
33311
+ nanoid: "nanoid",
33312
+ guid: "GUID",
33313
+ cuid: "cuid",
33314
+ cuid2: "cuid2",
33315
+ ulid: "ULID",
33316
+ xid: "XID",
33317
+ ksuid: "KSUID",
33318
+ datetime: "ISO datetime",
33319
+ date: "ISO date",
33320
+ time: "ISO time",
33321
+ duration: "ISO duration",
33322
+ ipv4: "IPv4 address",
33323
+ ipv6: "IPv6 address",
33324
+ mac: "MAC address",
33325
+ cidrv4: "IPv4 range",
33326
+ cidrv6: "IPv6 range",
33327
+ base64: "base64-encoded string",
33328
+ base64url: "base64url-encoded string",
33329
+ json_string: "JSON string",
33330
+ e164: "E.164 number",
33331
+ jwt: "JWT",
33332
+ template_literal: "input"
33333
+ };
33334
+ const TypeDictionary = {
33335
+ nan: "NaN"
33336
+ };
33337
+ return (issue) => {
33338
+ switch (issue.code) {
33339
+ case "invalid_type": {
33340
+ const expected = TypeDictionary[issue.expected] ?? issue.expected;
33341
+ const receivedType = parsedType(issue.input);
33342
+ const received = TypeDictionary[receivedType] ?? receivedType;
33343
+ return `Invalid input: expected ${expected}, received ${received}`;
33344
+ }
33345
+ case "invalid_value":
33346
+ if (issue.values.length === 1)
33347
+ return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
33348
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
33349
+ case "too_big": {
33350
+ const adj = issue.inclusive ? "<=" : "<";
33351
+ const sizing = getSizing(issue.origin);
33352
+ if (sizing)
33353
+ return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
33354
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
33355
+ }
33356
+ case "too_small": {
33357
+ const adj = issue.inclusive ? ">=" : ">";
33358
+ const sizing = getSizing(issue.origin);
33359
+ if (sizing) {
33360
+ return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
33361
+ }
33362
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
33363
+ }
33364
+ case "invalid_format": {
33365
+ const _issue = issue;
33366
+ if (_issue.format === "starts_with") {
33367
+ return `Invalid string: must start with "${_issue.prefix}"`;
33368
+ }
33369
+ if (_issue.format === "ends_with")
33370
+ return `Invalid string: must end with "${_issue.suffix}"`;
33371
+ if (_issue.format === "includes")
33372
+ return `Invalid string: must include "${_issue.includes}"`;
33373
+ if (_issue.format === "regex")
33374
+ return `Invalid string: must match pattern ${_issue.pattern}`;
33375
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
33376
+ }
33377
+ case "not_multiple_of":
33378
+ return `Invalid number: must be a multiple of ${issue.divisor}`;
33379
+ case "unrecognized_keys":
33380
+ return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
33381
+ case "invalid_key":
33382
+ return `Invalid key in ${issue.origin}`;
33383
+ case "invalid_union":
33384
+ return "Invalid input";
33385
+ case "invalid_element":
33386
+ return `Invalid value in ${issue.origin}`;
33387
+ default:
33388
+ return `Invalid input`;
33389
+ }
33390
+ };
33391
+ };
33392
+ var init_en = __esm(() => {
33393
+ init_util();
33394
+ });
33395
+
33396
+ // ../../node_modules/zod/v4/locales/index.js
33397
+ var init_locales = () => {};
33398
+
33399
+ // ../../node_modules/zod/v4/core/registries.js
33400
+ class $ZodRegistry {
33401
+ constructor() {
33402
+ this._map = new WeakMap;
33403
+ this._idmap = new Map;
33404
+ }
33405
+ add(schema, ..._meta) {
33406
+ const meta = _meta[0];
33407
+ this._map.set(schema, meta);
33408
+ if (meta && typeof meta === "object" && "id" in meta) {
33409
+ this._idmap.set(meta.id, schema);
33410
+ }
33411
+ return this;
33412
+ }
33413
+ clear() {
33414
+ this._map = new WeakMap;
33415
+ this._idmap = new Map;
33416
+ return this;
33417
+ }
33418
+ remove(schema) {
33419
+ const meta = this._map.get(schema);
33420
+ if (meta && typeof meta === "object" && "id" in meta) {
33421
+ this._idmap.delete(meta.id);
33422
+ }
33423
+ this._map.delete(schema);
33424
+ return this;
33425
+ }
33426
+ get(schema) {
33427
+ const p = schema._zod.parent;
33428
+ if (p) {
33429
+ const pm = { ...this.get(p) ?? {} };
33430
+ delete pm.id;
33431
+ const f = { ...pm, ...this._map.get(schema) };
33432
+ return Object.keys(f).length ? f : undefined;
33433
+ }
33434
+ return this._map.get(schema);
33435
+ }
33436
+ has(schema) {
33437
+ return this._map.has(schema);
33438
+ }
33439
+ }
33440
+ function registry() {
33441
+ return new $ZodRegistry;
33442
+ }
33443
+ var _a, $output, $input, globalRegistry;
33444
+ var init_registries = __esm(() => {
33445
+ $output = Symbol("ZodOutput");
33446
+ $input = Symbol("ZodInput");
33447
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
33448
+ globalRegistry = globalThis.__zod_globalRegistry;
33449
+ });
33450
+
33451
+ // ../../node_modules/zod/v4/core/api.js
33452
+ var init_api = () => {};
33453
+
33454
+ // ../../node_modules/zod/v4/core/to-json-schema.js
33455
+ var init_to_json_schema = () => {};
33456
+
33457
+ // ../../node_modules/zod/v4/core/json-schema.js
33458
+ var init_json_schema = () => {};
33459
+
33460
+ // ../../node_modules/zod/v4/core/index.js
33461
+ var init_core2 = __esm(() => {
33462
+ init_util();
33463
+ init_regexes();
33464
+ init_locales();
33465
+ init_json_schema();
33466
+ init_core();
33467
+ init_parse();
33468
+ init_errors();
33469
+ init_schemas();
33470
+ init_checks();
33471
+ init_versions();
33472
+ init_registries();
33473
+ init_api();
33474
+ init_to_json_schema();
33475
+ });
33476
+
33477
+ // ../../node_modules/zod/v4/classic/checks.js
33478
+ var init_checks2 = () => {};
33479
+
33480
+ // ../../node_modules/zod/v4/classic/iso.js
33481
+ var init_iso = () => {};
33482
+
33483
+ // ../../node_modules/zod/v4/classic/errors.js
33484
+ var initializer2 = (inst, issues) => {
33485
+ $ZodError.init(inst, issues);
33486
+ inst.name = "ZodError";
33487
+ Object.defineProperties(inst, {
33488
+ format: {
33489
+ value: (mapper) => formatError(inst, mapper)
33490
+ },
33491
+ flatten: {
33492
+ value: (mapper) => flattenError(inst, mapper)
33493
+ },
33494
+ addIssue: {
33495
+ value: (issue) => {
33496
+ inst.issues.push(issue);
33497
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
33498
+ }
33499
+ },
33500
+ addIssues: {
33501
+ value: (issues2) => {
33502
+ inst.issues.push(...issues2);
33503
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
33504
+ }
33505
+ },
33506
+ isEmpty: {
33507
+ get() {
33508
+ return inst.issues.length === 0;
33509
+ }
33510
+ }
33511
+ });
33512
+ }, ZodError, ZodRealError;
33513
+ var init_errors2 = __esm(() => {
33514
+ init_core2();
33515
+ init_core2();
33516
+ init_util();
33517
+ ZodError = $constructor("ZodError", initializer2);
33518
+ ZodRealError = $constructor("ZodError", initializer2, {
33519
+ Parent: Error
33520
+ });
33521
+ });
33522
+
33523
+ // ../../node_modules/zod/v4/classic/parse.js
33524
+ var init_parse2 = () => {};
33525
+
33526
+ // ../../node_modules/zod/v4/classic/schemas.js
33527
+ var init_schemas2 = () => {};
33528
+
33529
+ // ../../node_modules/zod/v4/classic/compat.js
33530
+ var ZodFirstPartyTypeKind;
33531
+ var init_compat = __esm(() => {
33532
+ (function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
33533
+ });
33534
+
33535
+ // ../../node_modules/zod/v4/classic/coerce.js
33536
+ var init_coerce = () => {};
33537
+
33538
+ // ../../node_modules/zod/v4/classic/external.js
33539
+ var init_external = __esm(() => {
33540
+ init_core2();
33541
+ init_core2();
33542
+ init_en();
33543
+ init_locales();
33544
+ init_iso();
33545
+ init_coerce();
33546
+ init_schemas2();
33547
+ init_checks2();
33548
+ init_errors2();
33549
+ init_parse2();
33550
+ init_compat();
33551
+ config(en_default());
33552
+ });
33553
+
33554
+ // ../../node_modules/zod/v4/classic/index.js
33555
+ var init_classic = __esm(() => {
33556
+ init_external();
33557
+ });
33558
+
33559
+ // ../../node_modules/zod/v4/index.js
33560
+ var init_v4 = __esm(() => {
33561
+ init_classic();
33562
+ });
33563
+
33564
+ // ../../node_modules/astro/dist/zod.js
33565
+ var init_zod = __esm(() => {
33566
+ init_v4();
33567
+ });
33568
+
32964
33569
  // ../cms/src/field-types.ts
32965
- import { z } from "astro/zod";
32966
- var init_field_types = () => {};
33570
+ var init_field_types = __esm(() => {
33571
+ init_zod();
33572
+ });
32967
33573
  // ../cms/src/media/s3.ts
32968
33574
  var init_s3 = __esm(() => {
32969
33575
  init_local();
32970
33576
  });
32971
33577
 
32972
33578
  // ../cms/src/migrate-astro-image.ts
32973
- import fs17 from "fs/promises";
32974
- import path17 from "path";
33579
+ import fs15 from "fs/promises";
33580
+ import path16 from "path";
32975
33581
  async function migrateAstroImages(options = {}) {
32976
33582
  const projectRoot = options.projectRoot ?? getProjectRoot();
32977
33583
  const dryRun = options.dryRun ?? false;
@@ -32983,10 +33589,10 @@ async function migrateAstroImages(options = {}) {
32983
33589
  if (astroFields.length === 0 || !def.entries)
32984
33590
  continue;
32985
33591
  for (const entry of def.entries) {
32986
- const entryAbs = path17.isAbsolute(entry.sourcePath) ? entry.sourcePath : path17.join(projectRoot, entry.sourcePath);
33592
+ const entryAbs = path16.isAbsolute(entry.sourcePath) ? entry.sourcePath : path16.join(projectRoot, entry.sourcePath);
32987
33593
  let raw;
32988
33594
  try {
32989
- raw = await fs17.readFile(entryAbs, "utf-8");
33595
+ raw = await fs15.readFile(entryAbs, "utf-8");
32990
33596
  } catch {
32991
33597
  skipped.push({ entrySourcePath: entry.sourcePath, fieldName: "*", reason: "read failed" });
32992
33598
  continue;
@@ -32997,10 +33603,10 @@ async function migrateAstroImages(options = {}) {
32997
33603
  continue;
32998
33604
  }
32999
33605
  const [fullFm, fmStart, yamlBody, fmEnd] = fmMatch;
33000
- const doc = import_yaml6.parseDocument(yamlBody);
33606
+ const doc2 = import_yaml6.parseDocument(yamlBody);
33001
33607
  let mutated = false;
33002
33608
  for (const field of astroFields) {
33003
- const current = doc.get(field.name);
33609
+ const current = doc2.get(field.name);
33004
33610
  if (typeof current !== "string") {
33005
33611
  if (current != null)
33006
33612
  skipped.push({ entrySourcePath: entry.sourcePath, fieldName: field.name, reason: "non-string value" });
@@ -33008,10 +33614,10 @@ async function migrateAstroImages(options = {}) {
33008
33614
  }
33009
33615
  if (!current.startsWith("/") || current.startsWith("//"))
33010
33616
  continue;
33011
- const sourceAbs = path17.join(projectRoot, "public", current.replace(/^\/+/, ""));
33617
+ const sourceAbs = path16.join(projectRoot, "public", current.replace(/^\/+/, ""));
33012
33618
  let sourceBuf;
33013
33619
  try {
33014
- sourceBuf = await fs17.readFile(sourceAbs);
33620
+ sourceBuf = await fs15.readFile(sourceAbs);
33015
33621
  } catch {
33016
33622
  skipped.push({ entrySourcePath: entry.sourcePath, fieldName: field.name, reason: `source missing: ${sourceAbs}` });
33017
33623
  continue;
@@ -33019,14 +33625,14 @@ async function migrateAstroImages(options = {}) {
33019
33625
  const target = await pickAstroImageTarget({
33020
33626
  entryAbsPath: entryAbs,
33021
33627
  slug: entry.slug,
33022
- originalFilename: path17.basename(current),
33628
+ originalFilename: path16.basename(current),
33023
33629
  compareBuffer: sourceBuf
33024
33630
  });
33025
33631
  if (!dryRun) {
33026
- await fs17.mkdir(path17.dirname(target.absPath), { recursive: true });
33027
- await fs17.writeFile(target.absPath, sourceBuf);
33632
+ await fs15.mkdir(path16.dirname(target.absPath), { recursive: true });
33633
+ await fs15.writeFile(target.absPath, sourceBuf);
33028
33634
  }
33029
- doc.set(field.name, target.relPath);
33635
+ doc2.set(field.name, target.relPath);
33030
33636
  mutated = true;
33031
33637
  migrations.push({
33032
33638
  entrySourcePath: entry.sourcePath,
@@ -33038,9 +33644,9 @@ async function migrateAstroImages(options = {}) {
33038
33644
  });
33039
33645
  }
33040
33646
  if (mutated && !dryRun) {
33041
- const newYaml = doc.toString().replace(/\n$/, "");
33647
+ const newYaml = doc2.toString().replace(/\n$/, "");
33042
33648
  const newRaw = raw.replace(fullFm, `${fmStart}${newYaml}${fmEnd}`);
33043
- await fs17.writeFile(entryAbs, newRaw, "utf-8");
33649
+ await fs15.writeFile(entryAbs, newRaw, "utf-8");
33044
33650
  }
33045
33651
  }
33046
33652
  }
@@ -33082,7 +33688,7 @@ var exports_migrate = {};
33082
33688
  __export(exports_migrate, {
33083
33689
  migrate: () => migrate
33084
33690
  });
33085
- import path18 from "path";
33691
+ import path17 from "path";
33086
33692
  async function migrate(args) {
33087
33693
  if (args.target !== "astro-image") {
33088
33694
  console.error(`Unknown migrate target: ${args.target}`);
@@ -33101,7 +33707,7 @@ async function migrate(args) {
33101
33707
  for (const m of result.migrations) {
33102
33708
  console.log(` ${m.entrySourcePath}`);
33103
33709
  console.log(` ${m.fieldName}: ${m.originalValue} \u2192 ${m.newValue}`);
33104
- console.log(` copy: ${path18.relative(process.cwd(), m.copiedFrom)} \u2192 ${path18.relative(process.cwd(), m.copiedTo)}`);
33710
+ console.log(` copy: ${path17.relative(process.cwd(), m.copiedFrom)} \u2192 ${path17.relative(process.cwd(), m.copiedTo)}`);
33105
33711
  }
33106
33712
  }
33107
33713
  if (result.skipped.length > 0) {
@@ -33120,224 +33726,9 @@ var init_migrate = __esm(() => {
33120
33726
  init_src();
33121
33727
  });
33122
33728
 
33123
- // ../agent-summary/src/agent-summary-integration.ts
33124
- import fs2 from "fs/promises";
33125
- import { fileURLToPath } from "url";
33126
-
33127
- // ../agent-summary/src/utils.ts
33128
- import { promises as fs } from "fs";
33129
- import path from "path";
33130
- var AGENTS_PATH = path.resolve("AGENTS.md");
33131
- var SUMMARY_START = "<page_summary>";
33132
- var SUMMARY_END = "</page_summary>";
33133
- var decodeEntities = (value) => {
33134
- return value.replace(/&amp;/gi, "&").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;/gi, "'").replace(/&nbsp;/gi, " ");
33135
- };
33136
- var sanitize = (value) => {
33137
- if (!value) {
33138
- return "";
33139
- }
33140
- const decoded = decodeEntities(value);
33141
- return decoded.replace(/\s+/g, " ").replace(/[\u2012-\u2015]/g, "-").replace(/\u2026/g, "...").trim();
33142
- };
33143
- var truncate = (value, maxLength) => {
33144
- if (value.length <= maxLength) {
33145
- return value;
33146
- }
33147
- return `${value.slice(0, maxLength - 3).trimEnd()}...`;
33148
- };
33149
- var normalizeRoute = (pathname) => {
33150
- const trimmed = pathname.replace(/^\/+/, "").replace(/\/+$/, "");
33151
- if (trimmed.length === 0) {
33152
- return "/";
33153
- }
33154
- return `/${trimmed}`;
33155
- };
33156
- var formatDestination = (value) => {
33157
- if (!value) {
33158
- return "/";
33159
- }
33160
- if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(value) || value.startsWith("#")) {
33161
- return value;
33162
- }
33163
- return normalizeRoute(value);
33164
- };
33165
- var resolveHtmlPath = async (distDir, pathname) => {
33166
- const normalizedRoute = normalizeRoute(pathname);
33167
- const routeSegment = normalizedRoute === "/" ? "" : normalizedRoute.slice(1);
33168
- const candidates = routeSegment === "" ? [path.join(distDir, "index.html")] : [
33169
- path.join(distDir, routeSegment, "index.html"),
33170
- path.join(distDir, `${routeSegment}.html`)
33171
- ];
33172
- for (const candidate of candidates) {
33173
- try {
33174
- const stats = await fs.stat(candidate);
33175
- if (stats.isFile()) {
33176
- return candidate;
33177
- }
33178
- } catch {}
33179
- }
33180
- return null;
33181
- };
33182
- var extractMetaFromHtml = (route, html) => {
33183
- const titleMatch = html.match(/<title[^>]*>([^<]*)<\/title>/i);
33184
- const metaMatch = html.match(/<meta[^>]+name=["']description["'][^>]*?>/i);
33185
- const contentMatch = metaMatch?.[0]?.match(/content=["']([^"']*)["']/i);
33186
- const headingMatches = [...html.matchAll(/<h([1-6])[^>]*>([\s\S]*?)<\/h\1>/gi)];
33187
- const headingEntries = headingMatches.map((match) => ({
33188
- level: `h${match[1]}`,
33189
- text: sanitize(match[2]?.replace(/<[^>]+>/g, ""))
33190
- })).filter((entry) => entry.text.length > 0);
33191
- const primaryHeading = headingEntries.find((entry) => entry.level === "h1" && entry.text.length >= 8) || headingEntries.find((entry) => entry.text.length >= 16) || headingEntries[0];
33192
- const primaryHeadingText = primaryHeading?.text ?? "";
33193
- const paragraphMatches = [...html.matchAll(/<p[^>]*>([\s\S]*?)<\/p>/gi)];
33194
- const paragraphCandidates = paragraphMatches.map((match) => sanitize(match[1]?.replace(/<[^>]+>/g, "")));
33195
- const fallbackParagraph = paragraphCandidates.find((text) => text.length >= 40) ?? paragraphCandidates[0] ?? "";
33196
- const title = sanitize(titleMatch?.[1] ?? (primaryHeadingText || "Untitled page"));
33197
- const descriptionSource = contentMatch?.[1];
33198
- const paragraphDescription = descriptionSource ? "" : fallbackParagraph;
33199
- const description = truncate((descriptionSource ? sanitize(descriptionSource) : paragraphDescription) || "Description unavailable", 220);
33200
- return {
33201
- route: normalizeRoute(route),
33202
- title,
33203
- description,
33204
- headlines: headingEntries
33205
- };
33206
- };
33207
- var createJsonlRecords = (pages, redirects) => {
33208
- const records = [];
33209
- for (const page of pages.sort((a, b) => a.route.localeCompare(b.route))) {
33210
- records.push(JSON.stringify({
33211
- kind: "page",
33212
- route: page.route,
33213
- title: page.title,
33214
- description: page.description,
33215
- headlines: page.headlines
33216
- }));
33217
- }
33218
- for (const redirect of redirects.sort((a, b) => a.from.localeCompare(b.from))) {
33219
- records.push(JSON.stringify({
33220
- kind: "redirect",
33221
- route: redirect.from,
33222
- to: redirect.to,
33223
- status: redirect.status
33224
- }));
33225
- }
33226
- return records;
33227
- };
33228
- var updateAgentsSummary = async (pages, redirects) => {
33229
- const jsonlRecords = createJsonlRecords(pages, redirects);
33230
- const summaryBody = jsonlRecords.join(`
33231
- `);
33232
- const summaryBlock = summaryBody ? `${SUMMARY_START}
33233
- ${summaryBody}
33234
- ${SUMMARY_END}
33235
- ` : `${SUMMARY_START}
33236
- ${SUMMARY_END}
33237
- `;
33238
- const agentsContent = await fs.readFile(AGENTS_PATH, "utf8").catch(() => "");
33239
- if (agentsContent.includes(SUMMARY_START) && agentsContent.includes(SUMMARY_END)) {
33240
- const startIndex = agentsContent.indexOf(SUMMARY_START);
33241
- const summaryEndIndex = agentsContent.indexOf(SUMMARY_END, startIndex);
33242
- if (summaryEndIndex === -1) {
33243
- const recovered = `${agentsContent.slice(0, startIndex)}${summaryBlock}`;
33244
- await fs.writeFile(AGENTS_PATH, recovered, "utf8");
33245
- return;
33246
- }
33247
- let endIndex = summaryEndIndex + SUMMARY_END.length;
33248
- while (endIndex < agentsContent.length && (agentsContent[endIndex] === `
33249
- ` || agentsContent[endIndex] === "\r")) {
33250
- endIndex += 1;
33251
- }
33252
- const updated = `${agentsContent.slice(0, startIndex)}${summaryBlock}${agentsContent.slice(endIndex)}`;
33253
- await fs.writeFile(AGENTS_PATH, updated, "utf8");
33254
- return;
33255
- }
33256
- const prefix = agentsContent.trimEnd();
33257
- const separator = prefix.length === 0 ? "" : `
33258
- `;
33259
- await fs.writeFile(AGENTS_PATH, `${prefix}${separator}${summaryBlock}`, "utf8");
33260
- };
33261
-
33262
- // ../agent-summary/src/agent-summary-integration.ts
33263
- var agentsSummary = () => {
33264
- const redirectPathnames = new Set;
33265
- const redirects = [];
33266
- return {
33267
- name: "agents-summary",
33268
- hooks: {
33269
- "astro:routes:resolved": ({ routes }) => {
33270
- redirectPathnames.clear();
33271
- redirects.length = 0;
33272
- for (const route of routes) {
33273
- if (route.type === "redirect" && route.pathname) {
33274
- const from = normalizeRoute(route.pathname);
33275
- redirectPathnames.add(from);
33276
- let destination = "";
33277
- let status = "";
33278
- const redirectConfig = route.redirect;
33279
- if (typeof redirectConfig === "string") {
33280
- destination = redirectConfig;
33281
- status = "302";
33282
- } else if (redirectConfig) {
33283
- destination = redirectConfig.destination;
33284
- status = redirectConfig.status?.toString() ?? "";
33285
- } else if (route.redirectRoute?.pathname) {
33286
- destination = route.redirectRoute.pathname;
33287
- }
33288
- let resolvedDestination = destination;
33289
- if (!resolvedDestination && route.redirectRoute?.pattern) {
33290
- resolvedDestination = route.redirectRoute.pattern.toString();
33291
- }
33292
- const to = resolvedDestination?.startsWith("^") ? resolvedDestination : formatDestination(resolvedDestination);
33293
- redirects.push({
33294
- from,
33295
- to,
33296
- status: status || "302"
33297
- });
33298
- }
33299
- }
33300
- },
33301
- "astro:build:done": async ({ dir, pages, logger }) => {
33302
- const distDir = fileURLToPath(dir);
33303
- const summaries = [];
33304
- for (const page of pages) {
33305
- const route = normalizeRoute(page.pathname);
33306
- if (redirectPathnames.has(route)) {
33307
- continue;
33308
- }
33309
- const htmlPath = await resolveHtmlPath(distDir, page.pathname);
33310
- if (!htmlPath) {
33311
- logger.warn(`Skipping ${page.pathname}; no HTML output found.`);
33312
- continue;
33313
- }
33314
- const html = await fs2.readFile(htmlPath, "utf8");
33315
- summaries.push(extractMetaFromHtml(page.pathname, html));
33316
- }
33317
- if (summaries.length === 0) {
33318
- logger.warn("No pages detected; AGENTS.md was not updated.");
33319
- return;
33320
- }
33321
- await updateAgentsSummary(summaries, redirects);
33322
- logger.info(`Updated AGENTS.md with ${summaries.length} page entries${redirects.length > 0 ? ` and ${redirects.length} redirects` : ""}.`);
33323
- }
33324
- }
33325
- };
33326
- };
33327
33729
  // src/index.ts
33328
- init_utils();
33329
- import { build as astroBuild, dev, preview } from "astro";
33330
33730
  import { spawn } from "child_process";
33331
- import { readFileSync as readFileSync3 } from "fs";
33332
33731
  var [, , command, ...args] = process.argv;
33333
- function hasNuaIntegration(configPath) {
33334
- try {
33335
- const content = readFileSync3(configPath, "utf-8");
33336
- return content.includes("@nuasite/agent-summary") || content.includes("agentsSummary");
33337
- } catch {
33338
- return false;
33339
- }
33340
- }
33341
33732
  function proxyToAstroCLI(command2, args2) {
33342
33733
  const astro = spawn("npx", ["astro", command2, ...args2], {
33343
33734
  stdio: "inherit",
@@ -33346,8 +33737,8 @@ function proxyToAstroCLI(command2, args2) {
33346
33737
  astro.on("close", (code) => {
33347
33738
  process.exit(code || 0);
33348
33739
  });
33349
- astro.on("error", (error) => {
33350
- console.error("Error running astro command:", error);
33740
+ astro.on("error", (error2) => {
33741
+ console.error("Error running astro command:", error2);
33351
33742
  process.exit(1);
33352
33743
  });
33353
33744
  }
@@ -33366,45 +33757,10 @@ Commands:`);
33366
33757
  All Astro CLI options are supported.
33367
33758
  `);
33368
33759
  }
33369
- var configPath = findAstroConfig();
33370
- var canProxyDirectly = configPath && hasNuaIntegration(configPath);
33371
- if (canProxyDirectly && command && ["build", "dev", "preview"].includes(command)) {
33760
+ if (command && ["build", "dev", "preview"].includes(command)) {
33372
33761
  proxyToAstroCLI(command, args);
33373
33762
  } else {
33374
33763
  switch (command) {
33375
- case "build":
33376
- astroBuild({
33377
- root: process.cwd(),
33378
- integrations: [agentsSummary()]
33379
- }).catch((error) => {
33380
- console.error("Error:", error);
33381
- process.exit(1);
33382
- });
33383
- break;
33384
- case "dev":
33385
- case "preview": {
33386
- const server = {};
33387
- for (let i = 0;i < args.length; i++) {
33388
- if (args[i] === "--port" && args[i + 1]) {
33389
- server.port = parseInt(args[i + 1], 10);
33390
- i++;
33391
- } else if (args[i] === "--host" && args[i + 1]) {
33392
- server.host = args[i + 1];
33393
- i++;
33394
- }
33395
- }
33396
- const options = {
33397
- root: process.cwd(),
33398
- integrations: [agentsSummary()],
33399
- server
33400
- };
33401
- const runner = command === "dev" ? dev : preview;
33402
- runner(options).catch((error) => {
33403
- console.error("Error:", error);
33404
- process.exit(1);
33405
- });
33406
- break;
33407
- }
33408
33764
  case "init": {
33409
33765
  const { init: init2 } = await Promise.resolve().then(() => (init_init(), exports_init));
33410
33766
  await init2({