@c4a/extract-ts 0.6.1 → 0.6.3

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.
Files changed (2) hide show
  1. package/index.js +186 -336
  2. package/package.json +4 -1
package/index.js CHANGED
@@ -320,26 +320,26 @@ var require_directives = __commonJS((exports) => {
320
320
  return false;
321
321
  }
322
322
  }
323
- tagName(source2, onError) {
324
- if (source2 === "!")
323
+ tagName(source, onError) {
324
+ if (source === "!")
325
325
  return "!";
326
- if (source2[0] !== "!") {
327
- onError(`Not a valid tag: ${source2}`);
326
+ if (source[0] !== "!") {
327
+ onError(`Not a valid tag: ${source}`);
328
328
  return null;
329
329
  }
330
- if (source2[1] === "<") {
331
- const verbatim = source2.slice(2, -1);
330
+ if (source[1] === "<") {
331
+ const verbatim = source.slice(2, -1);
332
332
  if (verbatim === "!" || verbatim === "!!") {
333
- onError(`Verbatim tags aren't resolved, so ${source2} is invalid.`);
333
+ onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
334
334
  return null;
335
335
  }
336
- if (source2[source2.length - 1] !== ">")
336
+ if (source[source.length - 1] !== ">")
337
337
  onError("Verbatim tags must end with a >");
338
338
  return verbatim;
339
339
  }
340
- const [, handle, suffix] = source2.match(/^(.*!)([^!]*)$/s);
340
+ const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
341
341
  if (!suffix)
342
- onError(`The ${source2} tag has no suffix`);
342
+ onError(`The ${source} tag has no suffix`);
343
343
  const prefix = this.tags[handle];
344
344
  if (prefix) {
345
345
  try {
@@ -350,8 +350,8 @@ var require_directives = __commonJS((exports) => {
350
350
  }
351
351
  }
352
352
  if (handle === "!")
353
- return source2;
354
- onError(`Could not resolve tag: ${source2}`);
353
+ return source;
354
+ onError(`Could not resolve tag: ${source}`);
355
355
  return null;
356
356
  }
357
357
  tagString(tag) {
@@ -423,21 +423,21 @@ var require_anchors = __commonJS((exports) => {
423
423
  const sourceObjects = new Map;
424
424
  let prevAnchors = null;
425
425
  return {
426
- onAnchor: (source2) => {
427
- aliasObjects.push(source2);
426
+ onAnchor: (source) => {
427
+ aliasObjects.push(source);
428
428
  prevAnchors ?? (prevAnchors = anchorNames(doc));
429
429
  const anchor = findNewAnchor(prefix, prevAnchors);
430
430
  prevAnchors.add(anchor);
431
431
  return anchor;
432
432
  },
433
433
  setAnchors: () => {
434
- for (const source2 of aliasObjects) {
435
- const ref = sourceObjects.get(source2);
434
+ for (const source of aliasObjects) {
435
+ const ref = sourceObjects.get(source);
436
436
  if (typeof ref === "object" && ref.anchor && (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {
437
437
  ref.node.anchor = ref.anchor;
438
438
  } else {
439
439
  const error = new Error("Failed to resolve repeated object (this should not happen)");
440
- error.source = source2;
440
+ error.source = source;
441
441
  throw error;
442
442
  }
443
443
  }
@@ -571,9 +571,9 @@ var require_Alias = __commonJS((exports) => {
571
571
  var toJS = require_toJS();
572
572
 
573
573
  class Alias extends Node.NodeBase {
574
- constructor(source2) {
574
+ constructor(source) {
575
575
  super(identity.ALIAS);
576
- this.source = source2;
576
+ this.source = source;
577
577
  Object.defineProperty(this, "tag", {
578
578
  set() {
579
579
  throw new Error("Alias nodes cannot have tags");
@@ -608,15 +608,15 @@ var require_Alias = __commonJS((exports) => {
608
608
  if (!ctx)
609
609
  return { source: this.source };
610
610
  const { anchors: anchors2, doc, maxAliasCount } = ctx;
611
- const source2 = this.resolve(doc, ctx);
612
- if (!source2) {
611
+ const source = this.resolve(doc, ctx);
612
+ if (!source) {
613
613
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
614
614
  throw new ReferenceError(msg);
615
615
  }
616
- let data = anchors2.get(source2);
616
+ let data = anchors2.get(source);
617
617
  if (!data) {
618
- toJS.toJS(source2, null, ctx);
619
- data = anchors2.get(source2);
618
+ toJS.toJS(source, null, ctx);
619
+ data = anchors2.get(source);
620
620
  }
621
621
  if (data?.res === undefined) {
622
622
  const msg = "This should not happen: Alias anchor was not resolved?";
@@ -625,7 +625,7 @@ var require_Alias = __commonJS((exports) => {
625
625
  if (maxAliasCount >= 0) {
626
626
  data.count += 1;
627
627
  if (data.aliasCount === 0)
628
- data.aliasCount = getAliasCount(doc, source2, anchors2);
628
+ data.aliasCount = getAliasCount(doc, source, anchors2);
629
629
  if (data.count * data.aliasCount > maxAliasCount) {
630
630
  const msg = "Excessive alias count indicates a resource exhaustion attack";
631
631
  throw new ReferenceError(msg);
@@ -649,8 +649,8 @@ var require_Alias = __commonJS((exports) => {
649
649
  }
650
650
  function getAliasCount(doc, node2, anchors2) {
651
651
  if (identity.isAlias(node2)) {
652
- const source2 = node2.resolve(doc);
653
- const anchor = anchors2 && source2 && anchors2.get(source2);
652
+ const source = node2.resolve(doc);
653
+ const anchor = anchors2 && source && anchors2.get(source);
654
654
  return anchor ? anchor.count * anchor.aliasCount : 0;
655
655
  } else if (identity.isCollection(node2)) {
656
656
  let count = 0;
@@ -1640,10 +1640,10 @@ var require_merge = __commonJS((exports) => {
1640
1640
  mergeValue(ctx, map, value);
1641
1641
  }
1642
1642
  function mergeValue(ctx, map, value) {
1643
- const source2 = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1644
- if (!identity.isMap(source2))
1643
+ const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
1644
+ if (!identity.isMap(source))
1645
1645
  throw new Error("Merge sources must be maps or map aliases");
1646
- const srcMap = source2.toJSON(null, ctx, Map);
1646
+ const srcMap = source.toJSON(null, ctx, Map);
1647
1647
  for (const [key, value2] of srcMap) {
1648
1648
  if (map instanceof Map) {
1649
1649
  if (!map.has(key))
@@ -2194,7 +2194,7 @@ var require_null = __commonJS((exports) => {
2194
2194
  tag: "tag:yaml.org,2002:null",
2195
2195
  test: /^(?:~|[Nn]ull|NULL)?$/,
2196
2196
  resolve: () => new Scalar.Scalar(null),
2197
- stringify: ({ source: source2 }, ctx) => typeof source2 === "string" && nullTag.test.test(source2) ? source2 : ctx.options.nullStr
2197
+ stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
2198
2198
  };
2199
2199
  exports.nullTag = nullTag;
2200
2200
  });
@@ -2208,11 +2208,11 @@ var require_bool = __commonJS((exports) => {
2208
2208
  tag: "tag:yaml.org,2002:bool",
2209
2209
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
2210
2210
  resolve: (str) => new Scalar.Scalar(str[0] === "t" || str[0] === "T"),
2211
- stringify({ source: source2, value }, ctx) {
2212
- if (source2 && boolTag.test.test(source2)) {
2213
- const sv = source2[0] === "t" || source2[0] === "T";
2211
+ stringify({ source, value }, ctx) {
2212
+ if (source && boolTag.test.test(source)) {
2213
+ const sv = source[0] === "t" || source[0] === "T";
2214
2214
  if (value === sv)
2215
- return source2;
2215
+ return source;
2216
2216
  }
2217
2217
  return value ? ctx.options.trueStr : ctx.options.falseStr;
2218
2218
  }
@@ -2623,10 +2623,10 @@ var require_omap = __commonJS((exports) => {
2623
2623
  // ../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js
2624
2624
  var require_bool2 = __commonJS((exports) => {
2625
2625
  var Scalar = require_Scalar();
2626
- function boolStringify({ value, source: source2 }, ctx) {
2626
+ function boolStringify({ value, source }, ctx) {
2627
2627
  const boolObj = value ? trueTag : falseTag;
2628
- if (source2 && boolObj.test.test(source2))
2629
- return source2;
2628
+ if (source && boolObj.test.test(source))
2629
+ return source;
2630
2630
  return value ? ctx.options.trueStr : ctx.options.falseStr;
2631
2631
  }
2632
2632
  var trueTag = {
@@ -3839,7 +3839,7 @@ var require_resolve_end = __commonJS((exports) => {
3839
3839
  let hasSpace = false;
3840
3840
  let sep = "";
3841
3841
  for (const token of end) {
3842
- const { source: source2, type } = token;
3842
+ const { source, type } = token;
3843
3843
  switch (type) {
3844
3844
  case "space":
3845
3845
  hasSpace = true;
@@ -3847,7 +3847,7 @@ var require_resolve_end = __commonJS((exports) => {
3847
3847
  case "comment": {
3848
3848
  if (reqSpace && !hasSpace)
3849
3849
  onError(token, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
3850
- const cb = source2.substring(1) || " ";
3850
+ const cb = source.substring(1) || " ";
3851
3851
  if (!comment)
3852
3852
  comment = cb;
3853
3853
  else
@@ -3857,13 +3857,13 @@ var require_resolve_end = __commonJS((exports) => {
3857
3857
  }
3858
3858
  case "newline":
3859
3859
  if (comment)
3860
- sep += source2;
3860
+ sep += source;
3861
3861
  hasSpace = true;
3862
3862
  break;
3863
3863
  default:
3864
3864
  onError(token, "UNEXPECTED_TOKEN", `Unexpected ${type} at node end`);
3865
3865
  }
3866
- offset += source2.length;
3866
+ offset += source.length;
3867
3867
  }
3868
3868
  }
3869
3869
  return { comment, offset };
@@ -4251,13 +4251,13 @@ var require_resolve_block_scalar = __commonJS((exports) => {
4251
4251
  onError(props[0], "IMPOSSIBLE", "Block scalar header not found");
4252
4252
  return null;
4253
4253
  }
4254
- const { source: source2 } = props[0];
4255
- const mode = source2[0];
4254
+ const { source } = props[0];
4255
+ const mode = source[0];
4256
4256
  let indent = 0;
4257
4257
  let chomp = "";
4258
4258
  let error = -1;
4259
- for (let i = 1;i < source2.length; ++i) {
4260
- const ch = source2[i];
4259
+ for (let i = 1;i < source.length; ++i) {
4260
+ const ch = source[i];
4261
4261
  if (!chomp && (ch === "-" || ch === "+"))
4262
4262
  chomp = ch;
4263
4263
  else {
@@ -4269,10 +4269,10 @@ var require_resolve_block_scalar = __commonJS((exports) => {
4269
4269
  }
4270
4270
  }
4271
4271
  if (error !== -1)
4272
- onError(error, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${source2}`);
4272
+ onError(error, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${source}`);
4273
4273
  let hasSpace = false;
4274
4274
  let comment = "";
4275
- let length = source2.length;
4275
+ let length = source.length;
4276
4276
  for (let i = 1;i < props.length; ++i) {
4277
4277
  const token = props[i];
4278
4278
  switch (token.type) {
@@ -4304,8 +4304,8 @@ var require_resolve_block_scalar = __commonJS((exports) => {
4304
4304
  }
4305
4305
  return { mode, indent, chomp, comment, length };
4306
4306
  }
4307
- function splitLines(source2) {
4308
- const split = source2.split(/\n( *)/);
4307
+ function splitLines(source) {
4308
+ const split = source.split(/\n( *)/);
4309
4309
  const first = split[0];
4310
4310
  const m = first.match(/^( *)/);
4311
4311
  const line0 = m?.[1] ? [m[1], first.slice(m[1].length)] : ["", first];
@@ -4322,22 +4322,22 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4322
4322
  var Scalar = require_Scalar();
4323
4323
  var resolveEnd = require_resolve_end();
4324
4324
  function resolveFlowScalar(scalar, strict, onError) {
4325
- const { offset, type, source: source2, end } = scalar;
4325
+ const { offset, type, source, end } = scalar;
4326
4326
  let _type;
4327
4327
  let value;
4328
4328
  const _onError = (rel, code, msg) => onError(offset + rel, code, msg);
4329
4329
  switch (type) {
4330
4330
  case "scalar":
4331
4331
  _type = Scalar.Scalar.PLAIN;
4332
- value = plainValue(source2, _onError);
4332
+ value = plainValue(source, _onError);
4333
4333
  break;
4334
4334
  case "single-quoted-scalar":
4335
4335
  _type = Scalar.Scalar.QUOTE_SINGLE;
4336
- value = singleQuotedValue(source2, _onError);
4336
+ value = singleQuotedValue(source, _onError);
4337
4337
  break;
4338
4338
  case "double-quoted-scalar":
4339
4339
  _type = Scalar.Scalar.QUOTE_DOUBLE;
4340
- value = doubleQuotedValue(source2, _onError);
4340
+ value = doubleQuotedValue(source, _onError);
4341
4341
  break;
4342
4342
  default:
4343
4343
  onError(scalar, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${type}`);
@@ -4345,10 +4345,10 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4345
4345
  value: "",
4346
4346
  type: null,
4347
4347
  comment: "",
4348
- range: [offset, offset + source2.length, offset + source2.length]
4348
+ range: [offset, offset + source.length, offset + source.length]
4349
4349
  };
4350
4350
  }
4351
- const valueEnd = offset + source2.length;
4351
+ const valueEnd = offset + source.length;
4352
4352
  const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);
4353
4353
  return {
4354
4354
  value,
@@ -4357,9 +4357,9 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4357
4357
  range: [offset, valueEnd, re.offset]
4358
4358
  };
4359
4359
  }
4360
- function plainValue(source2, onError) {
4360
+ function plainValue(source, onError) {
4361
4361
  let badChar = "";
4362
- switch (source2[0]) {
4362
+ switch (source[0]) {
4363
4363
  case "\t":
4364
4364
  badChar = "a tab character";
4365
4365
  break;
@@ -4371,25 +4371,25 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4371
4371
  break;
4372
4372
  case "|":
4373
4373
  case ">": {
4374
- badChar = `block scalar indicator ${source2[0]}`;
4374
+ badChar = `block scalar indicator ${source[0]}`;
4375
4375
  break;
4376
4376
  }
4377
4377
  case "@":
4378
4378
  case "`": {
4379
- badChar = `reserved character ${source2[0]}`;
4379
+ badChar = `reserved character ${source[0]}`;
4380
4380
  break;
4381
4381
  }
4382
4382
  }
4383
4383
  if (badChar)
4384
4384
  onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
4385
- return foldLines(source2);
4385
+ return foldLines(source);
4386
4386
  }
4387
- function singleQuotedValue(source2, onError) {
4388
- if (source2[source2.length - 1] !== "'" || source2.length === 1)
4389
- onError(source2.length, "MISSING_CHAR", "Missing closing 'quote");
4390
- return foldLines(source2.slice(1, -1)).replace(/''/g, "'");
4387
+ function singleQuotedValue(source, onError) {
4388
+ if (source[source.length - 1] !== "'" || source.length === 1)
4389
+ onError(source.length, "MISSING_CHAR", "Missing closing 'quote");
4390
+ return foldLines(source.slice(1, -1)).replace(/''/g, "'");
4391
4391
  }
4392
- function foldLines(source2) {
4392
+ function foldLines(source) {
4393
4393
  let first, line;
4394
4394
  try {
4395
4395
  first = new RegExp(`(.*?)(?<![ ])[ ]*\r?
@@ -4400,14 +4400,14 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4400
4400
  first = /(.*?)[ \t]*\r?\n/sy;
4401
4401
  line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
4402
4402
  }
4403
- let match = first.exec(source2);
4403
+ let match = first.exec(source);
4404
4404
  if (!match)
4405
- return source2;
4405
+ return source;
4406
4406
  let res = match[1];
4407
4407
  let sep = " ";
4408
4408
  let pos = first.lastIndex;
4409
4409
  line.lastIndex = pos;
4410
- while (match = line.exec(source2)) {
4410
+ while (match = line.exec(source)) {
4411
4411
  if (match[1] === "") {
4412
4412
  if (sep === `
4413
4413
  `)
@@ -4423,68 +4423,68 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4423
4423
  }
4424
4424
  const last = /[ \t]*(.*)/sy;
4425
4425
  last.lastIndex = pos;
4426
- match = last.exec(source2);
4426
+ match = last.exec(source);
4427
4427
  return res + sep + (match?.[1] ?? "");
4428
4428
  }
4429
- function doubleQuotedValue(source2, onError) {
4429
+ function doubleQuotedValue(source, onError) {
4430
4430
  let res = "";
4431
- for (let i = 1;i < source2.length - 1; ++i) {
4432
- const ch = source2[i];
4433
- if (ch === "\r" && source2[i + 1] === `
4431
+ for (let i = 1;i < source.length - 1; ++i) {
4432
+ const ch = source[i];
4433
+ if (ch === "\r" && source[i + 1] === `
4434
4434
  `)
4435
4435
  continue;
4436
4436
  if (ch === `
4437
4437
  `) {
4438
- const { fold, offset } = foldNewline(source2, i);
4438
+ const { fold, offset } = foldNewline(source, i);
4439
4439
  res += fold;
4440
4440
  i = offset;
4441
4441
  } else if (ch === "\\") {
4442
- let next = source2[++i];
4442
+ let next = source[++i];
4443
4443
  const cc = escapeCodes[next];
4444
4444
  if (cc)
4445
4445
  res += cc;
4446
4446
  else if (next === `
4447
4447
  `) {
4448
- next = source2[i + 1];
4448
+ next = source[i + 1];
4449
4449
  while (next === " " || next === "\t")
4450
- next = source2[++i + 1];
4451
- } else if (next === "\r" && source2[i + 1] === `
4450
+ next = source[++i + 1];
4451
+ } else if (next === "\r" && source[i + 1] === `
4452
4452
  `) {
4453
- next = source2[++i + 1];
4453
+ next = source[++i + 1];
4454
4454
  while (next === " " || next === "\t")
4455
- next = source2[++i + 1];
4455
+ next = source[++i + 1];
4456
4456
  } else if (next === "x" || next === "u" || next === "U") {
4457
4457
  const length = { x: 2, u: 4, U: 8 }[next];
4458
- res += parseCharCode(source2, i + 1, length, onError);
4458
+ res += parseCharCode(source, i + 1, length, onError);
4459
4459
  i += length;
4460
4460
  } else {
4461
- const raw = source2.substr(i - 1, 2);
4461
+ const raw = source.substr(i - 1, 2);
4462
4462
  onError(i - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
4463
4463
  res += raw;
4464
4464
  }
4465
4465
  } else if (ch === " " || ch === "\t") {
4466
4466
  const wsStart = i;
4467
- let next = source2[i + 1];
4467
+ let next = source[i + 1];
4468
4468
  while (next === " " || next === "\t")
4469
- next = source2[++i + 1];
4469
+ next = source[++i + 1];
4470
4470
  if (next !== `
4471
- ` && !(next === "\r" && source2[i + 2] === `
4471
+ ` && !(next === "\r" && source[i + 2] === `
4472
4472
  `))
4473
- res += i > wsStart ? source2.slice(wsStart, i + 1) : ch;
4473
+ res += i > wsStart ? source.slice(wsStart, i + 1) : ch;
4474
4474
  } else {
4475
4475
  res += ch;
4476
4476
  }
4477
4477
  }
4478
- if (source2[source2.length - 1] !== '"' || source2.length === 1)
4479
- onError(source2.length, "MISSING_CHAR", 'Missing closing "quote');
4478
+ if (source[source.length - 1] !== '"' || source.length === 1)
4479
+ onError(source.length, "MISSING_CHAR", 'Missing closing "quote');
4480
4480
  return res;
4481
4481
  }
4482
- function foldNewline(source2, offset) {
4482
+ function foldNewline(source, offset) {
4483
4483
  let fold = "";
4484
- let ch = source2[offset + 1];
4484
+ let ch = source[offset + 1];
4485
4485
  while (ch === " " || ch === "\t" || ch === `
4486
4486
  ` || ch === "\r") {
4487
- if (ch === "\r" && source2[offset + 2] !== `
4487
+ if (ch === "\r" && source[offset + 2] !== `
4488
4488
  `)
4489
4489
  break;
4490
4490
  if (ch === `
@@ -4492,7 +4492,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4492
4492
  fold += `
4493
4493
  `;
4494
4494
  offset += 1;
4495
- ch = source2[offset + 1];
4495
+ ch = source[offset + 1];
4496
4496
  }
4497
4497
  if (!fold)
4498
4498
  fold = " ";
@@ -4519,12 +4519,12 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
4519
4519
  "\\": "\\",
4520
4520
  "\t": "\t"
4521
4521
  };
4522
- function parseCharCode(source2, offset, length, onError) {
4523
- const cc = source2.substr(offset, length);
4522
+ function parseCharCode(source, offset, length, onError) {
4523
+ const cc = source.substr(offset, length);
4524
4524
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
4525
4525
  const code = ok ? parseInt(cc, 16) : NaN;
4526
4526
  if (isNaN(code)) {
4527
- const raw = source2.substr(offset - 2, length + 2);
4527
+ const raw = source.substr(offset - 2, length + 2);
4528
4528
  onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
4529
4529
  return raw;
4530
4530
  }
@@ -4719,13 +4719,13 @@ var require_compose_node = __commonJS((exports) => {
4719
4719
  }
4720
4720
  return node2;
4721
4721
  }
4722
- function composeAlias({ options }, { offset, source: source2, end }, onError) {
4723
- const alias = new Alias.Alias(source2.substring(1));
4722
+ function composeAlias({ options }, { offset, source, end }, onError) {
4723
+ const alias = new Alias.Alias(source.substring(1));
4724
4724
  if (alias.source === "")
4725
4725
  onError(offset, "BAD_ALIAS", "Alias cannot be an empty string");
4726
4726
  if (alias.source.endsWith(":"))
4727
- onError(offset + source2.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true);
4728
- const valueEnd = offset + source2.length;
4727
+ onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true);
4728
+ const valueEnd = offset + source.length;
4729
4729
  const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);
4730
4730
  alias.range = [offset, valueEnd, re.offset];
4731
4731
  if (re.comment)
@@ -4790,21 +4790,21 @@ var require_composer = __commonJS((exports) => {
4790
4790
  return [src, src + 1];
4791
4791
  if (Array.isArray(src))
4792
4792
  return src.length === 2 ? src : [src[0], src[1]];
4793
- const { offset, source: source2 } = src;
4794
- return [offset, offset + (typeof source2 === "string" ? source2.length : 1)];
4793
+ const { offset, source } = src;
4794
+ return [offset, offset + (typeof source === "string" ? source.length : 1)];
4795
4795
  }
4796
4796
  function parsePrelude(prelude) {
4797
4797
  let comment = "";
4798
4798
  let atComment = false;
4799
4799
  let afterEmptyLine = false;
4800
4800
  for (let i = 0;i < prelude.length; ++i) {
4801
- const source2 = prelude[i];
4802
- switch (source2[0]) {
4801
+ const source = prelude[i];
4802
+ switch (source[0]) {
4803
4803
  case "#":
4804
4804
  comment += (comment === "" ? "" : afterEmptyLine ? `
4805
4805
 
4806
4806
  ` : `
4807
- `) + (source2.substring(1) || " ");
4807
+ `) + (source.substring(1) || " ");
4808
4808
  atComment = true;
4809
4809
  afterEmptyLine = false;
4810
4810
  break;
@@ -4829,8 +4829,8 @@ var require_composer = __commonJS((exports) => {
4829
4829
  this.prelude = [];
4830
4830
  this.errors = [];
4831
4831
  this.warnings = [];
4832
- this.onError = (source2, code, message, warning) => {
4833
- const pos = getErrorPos(source2);
4832
+ this.onError = (source, code, message, warning) => {
4833
+ const pos = getErrorPos(source);
4834
4834
  if (warning)
4835
4835
  this.warnings.push(new errors2.YAMLWarning(pos, code, message));
4836
4836
  else
@@ -4993,7 +4993,7 @@ var require_cst_scalar = __commonJS((exports) => {
4993
4993
  }
4994
4994
  function createScalarToken(value, context) {
4995
4995
  const { implicitKey = false, indent, inFlow = false, offset = -1, type = "PLAIN" } = context;
4996
- const source2 = stringifyString.stringifyString({ type, value }, {
4996
+ const source = stringifyString.stringifyString({ type, value }, {
4997
4997
  implicitKey,
4998
4998
  indent: indent > 0 ? " ".repeat(indent) : "",
4999
4999
  inFlow,
@@ -5003,13 +5003,13 @@ var require_cst_scalar = __commonJS((exports) => {
5003
5003
  { type: "newline", offset: -1, indent, source: `
5004
5004
  ` }
5005
5005
  ];
5006
- switch (source2[0]) {
5006
+ switch (source[0]) {
5007
5007
  case "|":
5008
5008
  case ">": {
5009
- const he = source2.indexOf(`
5009
+ const he = source.indexOf(`
5010
5010
  `);
5011
- const head = source2.substring(0, he);
5012
- const body = source2.substring(he + 1) + `
5011
+ const head = source.substring(0, he);
5012
+ const body = source.substring(he + 1) + `
5013
5013
  `;
5014
5014
  const props = [
5015
5015
  { type: "block-scalar-header", offset, indent, source: head }
@@ -5020,11 +5020,11 @@ var require_cst_scalar = __commonJS((exports) => {
5020
5020
  return { type: "block-scalar", offset, indent, props, source: body };
5021
5021
  }
5022
5022
  case '"':
5023
- return { type: "double-quoted-scalar", offset, indent, source: source2, end };
5023
+ return { type: "double-quoted-scalar", offset, indent, source, end };
5024
5024
  case "'":
5025
- return { type: "single-quoted-scalar", offset, indent, source: source2, end };
5025
+ return { type: "single-quoted-scalar", offset, indent, source, end };
5026
5026
  default:
5027
- return { type: "scalar", offset, indent, source: source2, end };
5027
+ return { type: "scalar", offset, indent, source, end };
5028
5028
  }
5029
5029
  }
5030
5030
  function setScalarValue(token, value, context = {}) {
@@ -5050,32 +5050,32 @@ var require_cst_scalar = __commonJS((exports) => {
5050
5050
  default:
5051
5051
  type = "PLAIN";
5052
5052
  }
5053
- const source2 = stringifyString.stringifyString({ type, value }, {
5053
+ const source = stringifyString.stringifyString({ type, value }, {
5054
5054
  implicitKey: implicitKey || indent === null,
5055
5055
  indent: indent !== null && indent > 0 ? " ".repeat(indent) : "",
5056
5056
  inFlow,
5057
5057
  options: { blockQuote: true, lineWidth: -1 }
5058
5058
  });
5059
- switch (source2[0]) {
5059
+ switch (source[0]) {
5060
5060
  case "|":
5061
5061
  case ">":
5062
- setBlockScalarValue(token, source2);
5062
+ setBlockScalarValue(token, source);
5063
5063
  break;
5064
5064
  case '"':
5065
- setFlowScalarValue(token, source2, "double-quoted-scalar");
5065
+ setFlowScalarValue(token, source, "double-quoted-scalar");
5066
5066
  break;
5067
5067
  case "'":
5068
- setFlowScalarValue(token, source2, "single-quoted-scalar");
5068
+ setFlowScalarValue(token, source, "single-quoted-scalar");
5069
5069
  break;
5070
5070
  default:
5071
- setFlowScalarValue(token, source2, "scalar");
5071
+ setFlowScalarValue(token, source, "scalar");
5072
5072
  }
5073
5073
  }
5074
- function setBlockScalarValue(token, source2) {
5075
- const he = source2.indexOf(`
5074
+ function setBlockScalarValue(token, source) {
5075
+ const he = source.indexOf(`
5076
5076
  `);
5077
- const head = source2.substring(0, he);
5078
- const body = source2.substring(he + 1) + `
5077
+ const head = source.substring(0, he);
5078
+ const body = source.substring(he + 1) + `
5079
5079
  `;
5080
5080
  if (token.type === "block-scalar") {
5081
5081
  const header = token.props[0];
@@ -5112,32 +5112,32 @@ var require_cst_scalar = __commonJS((exports) => {
5112
5112
  }
5113
5113
  return false;
5114
5114
  }
5115
- function setFlowScalarValue(token, source2, type) {
5115
+ function setFlowScalarValue(token, source, type) {
5116
5116
  switch (token.type) {
5117
5117
  case "scalar":
5118
5118
  case "double-quoted-scalar":
5119
5119
  case "single-quoted-scalar":
5120
5120
  token.type = type;
5121
- token.source = source2;
5121
+ token.source = source;
5122
5122
  break;
5123
5123
  case "block-scalar": {
5124
5124
  const end = token.props.slice(1);
5125
- let oa = source2.length;
5125
+ let oa = source.length;
5126
5126
  if (token.props[0].type === "block-scalar-header")
5127
5127
  oa -= token.props[0].source.length;
5128
5128
  for (const tok of end)
5129
5129
  tok.offset += oa;
5130
5130
  delete token.props;
5131
- Object.assign(token, { type, source: source2, end });
5131
+ Object.assign(token, { type, source, end });
5132
5132
  break;
5133
5133
  }
5134
5134
  case "block-map":
5135
5135
  case "block-seq": {
5136
- const offset = token.offset + source2.length;
5136
+ const offset = token.offset + source.length;
5137
5137
  const nl = { type: "newline", offset, indent: token.indent, source: `
5138
5138
  ` };
5139
5139
  delete token.items;
5140
- Object.assign(token, { type, source: source2, end: [nl] });
5140
+ Object.assign(token, { type, source, end: [nl] });
5141
5141
  break;
5142
5142
  }
5143
5143
  default: {
@@ -5146,7 +5146,7 @@ var require_cst_scalar = __commonJS((exports) => {
5146
5146
  for (const key of Object.keys(token))
5147
5147
  if (key !== "type" && key !== "offset")
5148
5148
  delete token[key];
5149
- Object.assign(token, { type, indent, source: source2, end });
5149
+ Object.assign(token, { type, indent, source, end });
5150
5150
  }
5151
5151
  }
5152
5152
  }
@@ -5297,8 +5297,8 @@ var require_cst = __commonJS((exports) => {
5297
5297
  return JSON.stringify(token);
5298
5298
  }
5299
5299
  }
5300
- function tokenType(source2) {
5301
- switch (source2) {
5300
+ function tokenType(source) {
5301
+ switch (source) {
5302
5302
  case BOM:
5303
5303
  return "byte-order-mark";
5304
5304
  case DOCUMENT:
@@ -5334,7 +5334,7 @@ var require_cst = __commonJS((exports) => {
5334
5334
  case ",":
5335
5335
  return "comma";
5336
5336
  }
5337
- switch (source2[0]) {
5337
+ switch (source[0]) {
5338
5338
  case " ":
5339
5339
  case "\t":
5340
5340
  return "space";
@@ -5410,11 +5410,11 @@ var require_lexer = __commonJS((exports) => {
5410
5410
  this.next = null;
5411
5411
  this.pos = 0;
5412
5412
  }
5413
- *lex(source2, incomplete = false) {
5414
- if (source2) {
5415
- if (typeof source2 !== "string")
5413
+ *lex(source, incomplete = false) {
5414
+ if (source) {
5415
+ if (typeof source !== "string")
5416
5416
  throw TypeError("source is not a string");
5417
- this.buffer = this.buffer ? this.buffer + source2 : source2;
5417
+ this.buffer = this.buffer ? this.buffer + source : source;
5418
5418
  this.lineEndPos = null;
5419
5419
  }
5420
5420
  this.atEnd = !incomplete;
@@ -6088,29 +6088,29 @@ var require_parser = __commonJS((exports) => {
6088
6088
  this.lexer = new lexer.Lexer;
6089
6089
  this.onNewLine = onNewLine;
6090
6090
  }
6091
- *parse(source2, incomplete = false) {
6091
+ *parse(source, incomplete = false) {
6092
6092
  if (this.onNewLine && this.offset === 0)
6093
6093
  this.onNewLine(0);
6094
- for (const lexeme of this.lexer.lex(source2, incomplete))
6094
+ for (const lexeme of this.lexer.lex(source, incomplete))
6095
6095
  yield* this.next(lexeme);
6096
6096
  if (!incomplete)
6097
6097
  yield* this.end();
6098
6098
  }
6099
- *next(source2) {
6100
- this.source = source2;
6099
+ *next(source) {
6100
+ this.source = source;
6101
6101
  if (node_process.env.LOG_TOKENS)
6102
- console.log("|", cst.prettyToken(source2));
6102
+ console.log("|", cst.prettyToken(source));
6103
6103
  if (this.atScalar) {
6104
6104
  this.atScalar = false;
6105
6105
  yield* this.step();
6106
- this.offset += source2.length;
6106
+ this.offset += source.length;
6107
6107
  return;
6108
6108
  }
6109
- const type = cst.tokenType(source2);
6109
+ const type = cst.tokenType(source);
6110
6110
  if (!type) {
6111
- const message = `Not a YAML token: ${source2}`;
6112
- yield* this.pop({ type: "error", offset: this.offset, message, source: source2 });
6113
- this.offset += source2.length;
6111
+ const message = `Not a YAML token: ${source}`;
6112
+ yield* this.pop({ type: "error", offset: this.offset, message, source });
6113
+ this.offset += source.length;
6114
6114
  } else if (type === "scalar") {
6115
6115
  this.atNewLine = false;
6116
6116
  this.atScalar = true;
@@ -6123,17 +6123,17 @@ var require_parser = __commonJS((exports) => {
6123
6123
  this.atNewLine = true;
6124
6124
  this.indent = 0;
6125
6125
  if (this.onNewLine)
6126
- this.onNewLine(this.offset + source2.length);
6126
+ this.onNewLine(this.offset + source.length);
6127
6127
  break;
6128
6128
  case "space":
6129
- if (this.atNewLine && source2[0] === " ")
6130
- this.indent += source2.length;
6129
+ if (this.atNewLine && source[0] === " ")
6130
+ this.indent += source.length;
6131
6131
  break;
6132
6132
  case "explicit-key-ind":
6133
6133
  case "map-value-ind":
6134
6134
  case "seq-item-ind":
6135
6135
  if (this.atNewLine)
6136
- this.indent += source2.length;
6136
+ this.indent += source.length;
6137
6137
  break;
6138
6138
  case "doc-mode":
6139
6139
  case "flow-error-end":
@@ -6141,7 +6141,7 @@ var require_parser = __commonJS((exports) => {
6141
6141
  default:
6142
6142
  this.atNewLine = false;
6143
6143
  }
6144
- this.offset += source2.length;
6144
+ this.offset += source.length;
6145
6145
  }
6146
6146
  }
6147
6147
  *end() {
@@ -6850,26 +6850,26 @@ var require_public_api = __commonJS((exports) => {
6850
6850
  const lineCounter$1 = options.lineCounter || prettyErrors && new lineCounter.LineCounter || null;
6851
6851
  return { lineCounter: lineCounter$1, prettyErrors };
6852
6852
  }
6853
- function parseAllDocuments(source2, options = {}) {
6853
+ function parseAllDocuments(source, options = {}) {
6854
6854
  const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
6855
6855
  const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
6856
6856
  const composer$1 = new composer.Composer(options);
6857
- const docs = Array.from(composer$1.compose(parser$1.parse(source2)));
6857
+ const docs = Array.from(composer$1.compose(parser$1.parse(source)));
6858
6858
  if (prettyErrors && lineCounter2)
6859
6859
  for (const doc of docs) {
6860
- doc.errors.forEach(errors2.prettifyError(source2, lineCounter2));
6861
- doc.warnings.forEach(errors2.prettifyError(source2, lineCounter2));
6860
+ doc.errors.forEach(errors2.prettifyError(source, lineCounter2));
6861
+ doc.warnings.forEach(errors2.prettifyError(source, lineCounter2));
6862
6862
  }
6863
6863
  if (docs.length > 0)
6864
6864
  return docs;
6865
6865
  return Object.assign([], { empty: true }, composer$1.streamInfo());
6866
6866
  }
6867
- function parseDocument(source2, options = {}) {
6867
+ function parseDocument(source, options = {}) {
6868
6868
  const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
6869
6869
  const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
6870
6870
  const composer$1 = new composer.Composer(options);
6871
6871
  let doc = null;
6872
- for (const _doc of composer$1.compose(parser$1.parse(source2), true, source2.length)) {
6872
+ for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
6873
6873
  if (!doc)
6874
6874
  doc = _doc;
6875
6875
  else if (doc.options.logLevel !== "silent") {
@@ -6878,8 +6878,8 @@ var require_public_api = __commonJS((exports) => {
6878
6878
  }
6879
6879
  }
6880
6880
  if (prettyErrors && lineCounter2) {
6881
- doc.errors.forEach(errors2.prettifyError(source2, lineCounter2));
6882
- doc.warnings.forEach(errors2.prettifyError(source2, lineCounter2));
6881
+ doc.errors.forEach(errors2.prettifyError(source, lineCounter2));
6882
+ doc.warnings.forEach(errors2.prettifyError(source, lineCounter2));
6883
6883
  }
6884
6884
  return doc;
6885
6885
  }
@@ -7096,156 +7096,6 @@ var FactRelation;
7096
7096
  FactRelation2["Supersedes"] = "supersedes";
7097
7097
  FactRelation2["References"] = "references";
7098
7098
  })(FactRelation ||= {});
7099
- // ../core/src/types/serverConfig.ts
7100
- var DEFAULT_SERVER_CONFIG = {
7101
- server: {
7102
- port: 5100,
7103
- host: "::"
7104
- },
7105
- git_hosts: [],
7106
- daemon_scheduler: {
7107
- enabled: true,
7108
- host: "localhost",
7109
- port: 5110,
7110
- workspace: "./data/daemon-workspace",
7111
- max_daemons: 20
7112
- },
7113
- doc_db: {
7114
- provider: "sqlite",
7115
- sqlite: {
7116
- path: "./data/c4a.db"
7117
- },
7118
- mongodb: {
7119
- uri: "mongodb://localhost:27017/c4a?directConnection=true",
7120
- database: "c4a"
7121
- }
7122
- },
7123
- graph_db: {
7124
- provider: "neo4j",
7125
- neo4j: {
7126
- uri: "bolt://localhost:7687",
7127
- username: "neo4j",
7128
- password: ""
7129
- },
7130
- nebulagraph: {
7131
- uri: "localhost:9669",
7132
- username: "root",
7133
- password: "nebula",
7134
- space: "c4a"
7135
- },
7136
- duckdb: {
7137
- path: "./data/c4a-graph.duckdb"
7138
- }
7139
- },
7140
- vector_db: {
7141
- provider: "lancedb",
7142
- collection_prefix: "c4a_",
7143
- qdrant: {
7144
- url: "http://localhost:6333",
7145
- api_key: ""
7146
- },
7147
- milvus: {
7148
- address: "localhost:19530"
7149
- },
7150
- lancedb: {
7151
- path: "./data/lancedb"
7152
- }
7153
- },
7154
- llm: {
7155
- provider: "openai",
7156
- openai: {
7157
- api_key: "",
7158
- base_url: "",
7159
- default_model: "gpt-5.3-codex",
7160
- wire_api: "chat"
7161
- },
7162
- anthropic: {
7163
- api_key: "",
7164
- base_url: "",
7165
- default_model: "claude-opus-4-6"
7166
- },
7167
- google: {
7168
- api_key: "",
7169
- base_url: "",
7170
- default_model: "gemini-3-pro-preview"
7171
- }
7172
- },
7173
- task: {
7174
- concurrency: {
7175
- code_index: 2,
7176
- doc_index: 2,
7177
- remote_clone: 2,
7178
- modeling: 1
7179
- },
7180
- default_timeout_ms: 150 * 60 * 1000,
7181
- memory_ttl_ms: 48 * 60 * 60 * 1000,
7182
- cleanup_interval_ms: 10 * 60 * 1000,
7183
- log_max_entries: 500
7184
- },
7185
- indexing: {
7186
- task_timeout_ms: 150 * 60 * 1000,
7187
- file_timeout_ms: 15 * 60 * 1000
7188
- },
7189
- intent_router: {
7190
- provider: "huggingface",
7191
- huggingface: {
7192
- model_id: "context4ai/intent-router-onnx",
7193
- cache_dir: "./models/intent-router"
7194
- },
7195
- xenova: {
7196
- model_id: "context4ai/intent-router-onnx",
7197
- cache_dir: "./models/intent-router"
7198
- }
7199
- },
7200
- embedding: {
7201
- provider: "huggingface",
7202
- huggingface: {
7203
- model_id: "Xenova/all-MiniLM-L6-v2",
7204
- dtype: "q8",
7205
- cache_dir: "./models/embedding"
7206
- },
7207
- xenova: {
7208
- model_id: "Xenova/bge-m3",
7209
- dtype: "q8",
7210
- cache_dir: "./models/embedding"
7211
- },
7212
- openai: {
7213
- api_key: "",
7214
- base_url: "",
7215
- model_id: "text-embedding-3-small"
7216
- },
7217
- google: {
7218
- api_key: "",
7219
- model_id: "text-embedding-004"
7220
- }
7221
- },
7222
- reranker: {
7223
- enabled: false,
7224
- provider: "huggingface",
7225
- huggingface: {
7226
- model_id: "onnx-community/bge-reranker-v2-m3-ONNX",
7227
- dtype: "q8",
7228
- cache_dir: "./models/reranker"
7229
- },
7230
- xenova: {
7231
- model_id: "onnx-community/bge-reranker-v2-m3-ONNX",
7232
- dtype: "q8",
7233
- cache_dir: "./models/reranker"
7234
- },
7235
- max_rerank: 20
7236
- }
7237
- };
7238
- // ../core/src/types/daemon.ts
7239
- var CODE_PACKAGE_FILES = new Set([
7240
- "package.json",
7241
- "pyproject.toml",
7242
- "setup.py",
7243
- "go.mod",
7244
- "cargo.toml",
7245
- "pom.xml",
7246
- "build.gradle",
7247
- "build.gradle.kts"
7248
- ]);
7249
7099
  // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
7250
7100
  var exports_external = {};
7251
7101
  __export(exports_external, {
@@ -12386,9 +12236,9 @@ class ExtractionPluginRegistry {
12386
12236
  register(plugin) {
12387
12237
  this.#plugins.push(plugin);
12388
12238
  }
12389
- resolve(source2) {
12390
- const declaredLanguage = source2.language?.toLowerCase();
12391
- const manifestLanguages = new Set(source2.manifests.flatMap((manifest) => MANIFEST_LANGUAGE_CANDIDATES[manifest.type] ?? []));
12239
+ resolve(source) {
12240
+ const declaredLanguage = source.language?.toLowerCase();
12241
+ const manifestLanguages = new Set(source.manifests.flatMap((manifest) => MANIFEST_LANGUAGE_CANDIDATES[manifest.type] ?? []));
12392
12242
  const candidates = this.#plugins.filter((plugin) => {
12393
12243
  const pluginLanguages = plugin.languages.map((language) => language.toLowerCase());
12394
12244
  if (declaredLanguage) {
@@ -12400,7 +12250,7 @@ class ExtractionPluginRegistry {
12400
12250
  return pluginLanguages.some((language) => manifestLanguages.has(language));
12401
12251
  });
12402
12252
  for (const plugin of candidates) {
12403
- if (plugin.canHandle(source2)) {
12253
+ if (plugin.canHandle(source)) {
12404
12254
  return plugin;
12405
12255
  }
12406
12256
  }
@@ -12503,29 +12353,29 @@ var resetParser = () => {
12503
12353
  parsedBytesSinceReset = 0;
12504
12354
  parserDead = false;
12505
12355
  };
12506
- var tryParse = async (source2, isTsx) => {
12356
+ var tryParse = async (source, isTsx) => {
12507
12357
  const { parser, tsLanguage, tsxLanguage } = await initParser();
12508
12358
  parser.setLanguage(isTsx ? tsxLanguage : tsLanguage);
12509
- const tree = parser.parse(source2);
12510
- parsedBytesSinceReset += source2.length;
12359
+ const tree = parser.parse(source);
12360
+ parsedBytesSinceReset += source.length;
12511
12361
  if (tree.rootNode.hasError()) {
12512
12362
  return null;
12513
12363
  }
12514
12364
  return tree;
12515
12365
  };
12516
- var parseFile = async (source2, isTsx) => {
12366
+ var parseFile = async (source, isTsx) => {
12517
12367
  if (parserDead)
12518
12368
  return null;
12519
12369
  if (parsedBytesSinceReset > PARSER_RESET_THRESHOLD) {
12520
12370
  resetParser();
12521
12371
  }
12522
12372
  try {
12523
- return await tryParse(source2, isTsx);
12373
+ return await tryParse(source, isTsx);
12524
12374
  } catch {
12525
12375
  resetParser();
12526
12376
  }
12527
12377
  try {
12528
- return await tryParse(source2, isTsx);
12378
+ return await tryParse(source, isTsx);
12529
12379
  } catch (error) {
12530
12380
  console.warn("[extract] Parser unrecoverable after retry, skipping remaining files:", error);
12531
12381
  parserDead = true;
@@ -12596,11 +12446,11 @@ var collectImportBindings = (root) => {
12596
12446
  const stringNode = node2.namedChildren.find((child) => child.type === "string");
12597
12447
  if (!stringNode)
12598
12448
  continue;
12599
- const source2 = stripQuotes(stringNode.text);
12449
+ const source = stripQuotes(stringNode.text);
12600
12450
  const clause = node2.namedChildren.find((child) => child.type === "import_clause");
12601
12451
  for (const part of clause?.namedChildren ?? []) {
12602
12452
  if (part.type === "identifier") {
12603
- bindings.set(part.text, { source: source2, importedName: "default" });
12453
+ bindings.set(part.text, { source, importedName: "default" });
12604
12454
  continue;
12605
12455
  }
12606
12456
  if (part.type !== "named_imports")
@@ -12608,7 +12458,7 @@ var collectImportBindings = (root) => {
12608
12458
  for (const specifier of part.namedChildren.filter((child) => child.type === "import_specifier")) {
12609
12459
  const parsed = parseImportSpecifier(specifier);
12610
12460
  if (parsed) {
12611
- bindings.set(parsed.localName, { source: source2, importedName: parsed.importedName });
12461
+ bindings.set(parsed.localName, { source, importedName: parsed.importedName });
12612
12462
  }
12613
12463
  }
12614
12464
  }
@@ -12648,8 +12498,8 @@ var traceFile = async (filePath, fs, state) => {
12648
12498
  const promise = (async () => {
12649
12499
  state.inFlight.add(filePath);
12650
12500
  state.files.add(filePath);
12651
- const source2 = await fs.readFile(filePath);
12652
- const tree = await parseFile(source2, filePath.endsWith(".tsx"));
12501
+ const source = await fs.readFile(filePath);
12502
+ const tree = await parseFile(source, filePath.endsWith(".tsx"));
12653
12503
  if (!tree)
12654
12504
  return [];
12655
12505
  const root = tree.rootNode;
@@ -12778,10 +12628,10 @@ var BUILTIN_TYPES = new Set([
12778
12628
  "never",
12779
12629
  "any"
12780
12630
  ]);
12781
- var countLines = (source2) => {
12782
- if (!source2)
12631
+ var countLines = (source) => {
12632
+ if (!source)
12783
12633
  return 0;
12784
- const parts = source2.split(/\r\n|\r|\n/);
12634
+ const parts = source.split(/\r\n|\r|\n/);
12785
12635
  return parts[parts.length - 1] === "" ? parts.length - 1 : parts.length;
12786
12636
  };
12787
12637
  var createRelation = (type, from, to, isExternal, line) => ({
@@ -13278,14 +13128,14 @@ var collectImportBindings2 = async (root, filePath, fs, resolver, relations) =>
13278
13128
  return bindings;
13279
13129
  };
13280
13130
  var analyzeFile = async (filePath, fs, resolver = { mappings: [] }) => {
13281
- const source2 = await fs.readFile(filePath);
13282
- const tree = await parseFile(source2, filePath.endsWith(".tsx"));
13131
+ const source = await fs.readFile(filePath);
13132
+ const tree = await parseFile(source, filePath.endsWith(".tsx"));
13283
13133
  if (!tree) {
13284
13134
  return {
13285
13135
  declarations: new Map,
13286
13136
  importBindings: new Map,
13287
13137
  relations: [],
13288
- lines: countLines(source2)
13138
+ lines: countLines(source)
13289
13139
  };
13290
13140
  }
13291
13141
  const root = tree.rootNode;
@@ -13313,7 +13163,7 @@ var analyzeFile = async (filePath, fs, resolver = { mappings: [] }) => {
13313
13163
  declarations,
13314
13164
  importBindings,
13315
13165
  relations,
13316
- lines: countLines(source2)
13166
+ lines: countLines(source)
13317
13167
  };
13318
13168
  };
13319
13169
 
@@ -13425,8 +13275,8 @@ class TypeScriptPlugin {
13425
13275
  languages = ["typescript", "tsx"];
13426
13276
  packageManagers = ["npm"];
13427
13277
  #lastDetection = null;
13428
- canHandle(source2) {
13429
- return source2.manifests.some((manifest) => manifest.type === "package.json");
13278
+ canHandle(source) {
13279
+ return source.manifests.some((manifest) => manifest.type === "package.json");
13430
13280
  }
13431
13281
  async detectEntries(manifest, fs) {
13432
13282
  const result = await detectEntries(manifest, fs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/extract-ts",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "type": "module",
5
5
  "description": "TypeScript extraction plugin for C4A ExtractionResult v2",
6
6
  "license": "MIT",
@@ -9,6 +9,9 @@
9
9
  "url": "git+https://github.com/context4ai/context.git",
10
10
  "directory": "packages/extract-ts"
11
11
  },
12
+ "engines": {
13
+ "node": ">=20"
14
+ },
12
15
  "dependencies": {
13
16
  "web-tree-sitter": "^0.20.8"
14
17
  },