minimal-forge-work-pack-sync 0.1.28 → 0.1.30

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/dist/index.js +42 -39
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -664,36 +664,38 @@ var require_Alias = __commonJS({
664
664
  if (node.anchor === this.source)
665
665
  found = node;
666
666
  }
667
+ if (found && ctx) {
668
+ const { anchors: anchors2, doc: doc2, maxAliasCount } = ctx;
669
+ let data = anchors2.get(found);
670
+ if (!data) {
671
+ toJS.toJS(found, null, ctx);
672
+ data = anchors2.get(found);
673
+ }
674
+ if (data?.res === void 0) {
675
+ const msg = "This should not happen: Alias anchor was not resolved?";
676
+ throw new ReferenceError(msg);
677
+ }
678
+ if (maxAliasCount >= 0) {
679
+ data.count += 1;
680
+ if (data.aliasCount === 0)
681
+ data.aliasCount = getAliasCount(doc2, found, anchors2);
682
+ if (data.count * data.aliasCount > maxAliasCount) {
683
+ const msg = "Excessive alias count indicates a resource exhaustion attack";
684
+ throw new ReferenceError(msg);
685
+ }
686
+ }
687
+ }
667
688
  return found;
668
689
  }
669
690
  toJSON(_arg, ctx) {
670
691
  if (!ctx)
671
692
  return { source: this.source };
672
- const { anchors: anchors2, doc, maxAliasCount } = ctx;
673
- const source = this.resolve(doc, ctx);
693
+ const source = this.resolve(ctx.doc, ctx);
674
694
  if (!source) {
675
695
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
676
696
  throw new ReferenceError(msg);
677
697
  }
678
- let data = anchors2.get(source);
679
- if (!data) {
680
- toJS.toJS(source, null, ctx);
681
- data = anchors2.get(source);
682
- }
683
- if (data?.res === void 0) {
684
- const msg = "This should not happen: Alias anchor was not resolved?";
685
- throw new ReferenceError(msg);
686
- }
687
- if (maxAliasCount >= 0) {
688
- data.count += 1;
689
- if (data.aliasCount === 0)
690
- data.aliasCount = getAliasCount(doc, source, anchors2);
691
- if (data.count * data.aliasCount > maxAliasCount) {
692
- const msg = "Excessive alias count indicates a resource exhaustion attack";
693
- throw new ReferenceError(msg);
694
- }
695
- }
696
- return data.res;
698
+ return ctx.anchors.get(source).res;
697
699
  }
698
700
  toString(ctx, _onComment, _onChompKeep) {
699
701
  const src = `*${this.source}`;
@@ -4695,37 +4697,38 @@ var require_resolve_flow_scalar = __commonJS({
4695
4697
  }
4696
4698
  if (badChar)
4697
4699
  onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
4698
- return foldLines(source);
4700
+ return unfoldLines(source);
4699
4701
  }
4700
4702
  function singleQuotedValue(source, onError) {
4701
4703
  if (source[source.length - 1] !== "'" || source.length === 1)
4702
4704
  onError(source.length, "MISSING_CHAR", "Missing closing 'quote");
4703
- return foldLines(source.slice(1, -1)).replace(/''/g, "'");
4705
+ return unfoldLines(source.slice(1, -1)).replace(/''/g, "'");
4704
4706
  }
4705
- function foldLines(source) {
4706
- let first, line;
4707
+ function unfoldLines(source) {
4708
+ const line = /(.*?)\r?\n/sy;
4709
+ let match = line.exec(source);
4710
+ if (!match)
4711
+ return source;
4712
+ let trimEnd, trimBoth;
4707
4713
  try {
4708
- first = new RegExp("(.*?)(?<![ ])[ ]*\r?\n", "sy");
4709
- line = new RegExp("[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?\n", "sy");
4714
+ trimEnd = new RegExp("(?<![ ])[ ]+$");
4715
+ trimBoth = new RegExp("^[ ]+|(?<![ ])[ ]+$", "g");
4710
4716
  } catch {
4711
- first = /(.*?)[ \t]*\r?\n/sy;
4712
- line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
4717
+ trimEnd = /[ \t]+$/;
4718
+ trimBoth = /^[ \t]+|[ \t]+$/g;
4713
4719
  }
4714
- let match = first.exec(source);
4715
- if (!match)
4716
- return source;
4717
- let res = match[1];
4720
+ let res = match[1].replace(trimEnd, "");
4718
4721
  let sep = " ";
4719
- let pos = first.lastIndex;
4720
- line.lastIndex = pos;
4722
+ let pos = line.lastIndex;
4721
4723
  while (match = line.exec(source)) {
4722
- if (match[1] === "") {
4724
+ const lm = match[1].replace(trimBoth, "");
4725
+ if (lm === "") {
4723
4726
  if (sep === "\n")
4724
4727
  res += sep;
4725
4728
  else
4726
4729
  sep = "\n";
4727
4730
  } else {
4728
- res += sep + match[1];
4731
+ res += sep + lm;
4729
4732
  sep = " ";
4730
4733
  }
4731
4734
  pos = line.lastIndex;
@@ -7548,7 +7551,7 @@ var DEFAULT_DEBUG_TRACE_LIMITS = {
7548
7551
  };
7549
7552
 
7550
7553
  // packages/shared/src/contracts/settings.ts
7551
- var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.28";
7554
+ var WORK_PACK_SYNC_PLUGIN_VERSION = "0.1.30";
7552
7555
  var WORK_PACK_SYNC_PLUGIN_PACKAGE = `minimal-forge-work-pack-sync@${WORK_PACK_SYNC_PLUGIN_VERSION}`;
7553
7556
  var WORK_PACK_SYNC_PLUGIN_FILENAME = `minimal-forge-work-pack-sync-${WORK_PACK_SYNC_PLUGIN_VERSION}.tgz`;
7554
7557
  var FIRECRAWL_KEYLESS_MCP_NAME = "firecrawl";
@@ -25165,7 +25168,7 @@ function isRecord(value) {
25165
25168
  }
25166
25169
 
25167
25170
  // packages/cli/src/workPackSyncPlugin.ts
25168
- var PLUGIN_VERSION = "0.1.28";
25171
+ var PLUGIN_VERSION = "0.1.30";
25169
25172
  var FORGE_DECISION_TIMEOUT_MS = 11e4;
25170
25173
  var STATUS_FILENAME = "work-pack-startup-status.json";
25171
25174
  var activeSync = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimal-forge-work-pack-sync",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Minimal Forge Work Pack startup synchronization for OpenCode and OpenWork.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {