sim 2.3.0-preview.326.1 → 2.3.0-preview.328.1

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
@@ -43523,8 +43523,8 @@ var VERB_SYNONYMS = [
43523
43523
  ["delete", "remove", "destroy", "archive"]
43524
43524
  ];
43525
43525
  function splitVerb(method) {
43526
- const match = /^([a-z]+)(.*)$/.exec(method);
43527
- return match ? [match[1], (match[2] ?? "").toLowerCase()] : ["", method.toLowerCase()];
43526
+ const verb = /^[a-z]*/.exec(method)?.[0] ?? "";
43527
+ return [verb, method.slice(verb.length).toLowerCase()];
43528
43528
  }
43529
43529
  var BUILDER_ALIASES = {
43530
43530
  http: "api",
@@ -50684,12 +50684,19 @@ function declaredBlockTypes(catalog) {
50684
50684
  function legacyOnlyBlockTypes(catalog) {
50685
50685
  return new Set([...declaredBlockTypes(catalog)].flatMap(([type, { legacyOnly }]) => legacyOnly ? [type] : []));
50686
50686
  }
50687
- var CALL = /([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*)\s*\(/g;
50687
+ var CHAIN = /[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*/g;
50688
+ var OPEN_PAREN = /\s*\(/y;
50689
+ function* calledPaths(text) {
50690
+ for (const match of text.matchAll(CHAIN)) {
50691
+ OPEN_PAREN.lastIndex = match.index + match[0].length;
50692
+ if (OPEN_PAREN.test(text))
50693
+ yield match[0].replace(/\s+/g, "").split(".");
50694
+ }
50695
+ }
50688
50696
  function referencedBuilders(catalog, sources) {
50689
50697
  const keys = new Set;
50690
50698
  for (const text of sources) {
50691
- for (const match of text.matchAll(CALL)) {
50692
- const path = match[1].replace(/\s+/g, "").split(".");
50699
+ for (const path of calledPaths(text)) {
50693
50700
  if (path.length > 1 && path[path.length - 2] === TOOL_NAMESPACE)
50694
50701
  path.splice(path.length - 2, 1);
50695
50702
  else if (path.length > 1 && path[path.length - 1] === TOOL_NAMESPACE)
@@ -51856,7 +51863,7 @@ var MAX_CORE_LINES = 80;
51856
51863
  function coreDeclarationRanges(name) {
51857
51864
  const lines = CORE_DTS.split(`
51858
51865
  `);
51859
- const start = new RegExp(`^export (?:declare )?(?:const|function|namespace|interface|type) ${name}\\b`);
51866
+ const start = new RegExp(`^export (?:declare )?(?:const|function|namespace|interface|type) ${escapeRegExp(name)}\\b`);
51860
51867
  const declarations = [];
51861
51868
  for (let index = 0;index < lines.length; index++) {
51862
51869
  if (!start.test(lines[index]))
@@ -53725,7 +53732,7 @@ function isAlive(pid) {
53725
53732
  }
53726
53733
  }
53727
53734
  async function isStaleLock(lock, seen) {
53728
- const owner = toRecord(await readFile2(join6(lock, LOCK_OWNER_FILE), "utf8").then((text) => JSON.parse(text), () => null));
53735
+ const owner = toRecord(await readFile2(join6(lock, LOCK_OWNER_FILE), "utf8").then((text) => JSON.parse(text)).catch(() => null));
53729
53736
  if (typeof owner.pid === "number" && typeof owner.host === "string") {
53730
53737
  return owner.host === hostname() && !isAlive(owner.pid);
53731
53738
  }
@@ -65671,7 +65678,7 @@ function realPath(path) {
65671
65678
  function filterForms(filter, dir) {
65672
65679
  const forms = new Set;
65673
65680
  if (!isAbsolute3(filter)) {
65674
- const given = filter.replace(/\\/g, "/").replace(/^(\.\/)+/, "").replace(/\/+$/, "");
65681
+ const given = stripTrailingSlashes(filter.replace(/\\/g, "/").replace(/^(\.\/)+/, ""));
65675
65682
  forms.add(given === "" ? "." : given);
65676
65683
  }
65677
65684
  const resolved = relative2(realPath(resolve6(dir)), realPath(resolve6(filter))).split(sep).join("/");
package/dist/runtime.js CHANGED
@@ -43572,8 +43572,8 @@ var VERB_SYNONYMS = [
43572
43572
  ["delete", "remove", "destroy", "archive"]
43573
43573
  ];
43574
43574
  function splitVerb(method) {
43575
- const match = /^([a-z]+)(.*)$/.exec(method);
43576
- return match ? [match[1], (match[2] ?? "").toLowerCase()] : ["", method.toLowerCase()];
43575
+ const verb = /^[a-z]*/.exec(method)?.[0] ?? "";
43576
+ return [verb, method.slice(verb.length).toLowerCase()];
43577
43577
  }
43578
43578
  var BUILDER_ALIASES = {
43579
43579
  http: "api",
@@ -50733,12 +50733,19 @@ function declaredBlockTypes(catalog) {
50733
50733
  function legacyOnlyBlockTypes(catalog) {
50734
50734
  return new Set([...declaredBlockTypes(catalog)].flatMap(([type, { legacyOnly }]) => legacyOnly ? [type] : []));
50735
50735
  }
50736
- var CALL = /([A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*)\s*\(/g;
50736
+ var CHAIN = /[A-Za-z_$][\w$]*(?:\s*\.\s*[A-Za-z_$][\w$]*)*/g;
50737
+ var OPEN_PAREN = /\s*\(/y;
50738
+ function* calledPaths(text) {
50739
+ for (const match of text.matchAll(CHAIN)) {
50740
+ OPEN_PAREN.lastIndex = match.index + match[0].length;
50741
+ if (OPEN_PAREN.test(text))
50742
+ yield match[0].replace(/\s+/g, "").split(".");
50743
+ }
50744
+ }
50737
50745
  function referencedBuilders(catalog, sources) {
50738
50746
  const keys = new Set;
50739
50747
  for (const text of sources) {
50740
- for (const match of text.matchAll(CALL)) {
50741
- const path = match[1].replace(/\s+/g, "").split(".");
50748
+ for (const path of calledPaths(text)) {
50742
50749
  if (path.length > 1 && path[path.length - 2] === TOOL_NAMESPACE)
50743
50750
  path.splice(path.length - 2, 1);
50744
50751
  else if (path.length > 1 && path[path.length - 1] === TOOL_NAMESPACE)
@@ -51905,7 +51912,7 @@ var MAX_CORE_LINES = 80;
51905
51912
  function coreDeclarationRanges(name) {
51906
51913
  const lines = CORE_DTS.split(`
51907
51914
  `);
51908
- const start = new RegExp(`^export (?:declare )?(?:const|function|namespace|interface|type) ${name}\\b`);
51915
+ const start = new RegExp(`^export (?:declare )?(?:const|function|namespace|interface|type) ${escapeRegExp(name)}\\b`);
51909
51916
  const declarations = [];
51910
51917
  for (let index = 0;index < lines.length; index++) {
51911
51918
  if (!start.test(lines[index]))
@@ -53774,7 +53781,7 @@ function isAlive(pid) {
53774
53781
  }
53775
53782
  }
53776
53783
  async function isStaleLock(lock, seen) {
53777
- const owner = toRecord(await readFile2(join6(lock, LOCK_OWNER_FILE), "utf8").then((text) => JSON.parse(text), () => null));
53784
+ const owner = toRecord(await readFile2(join6(lock, LOCK_OWNER_FILE), "utf8").then((text) => JSON.parse(text)).catch(() => null));
53778
53785
  if (typeof owner.pid === "number" && typeof owner.host === "string") {
53779
53786
  return owner.host === hostname() && !isAlive(owner.pid);
53780
53787
  }
@@ -65720,7 +65727,7 @@ function realPath(path) {
65720
65727
  function filterForms(filter, dir) {
65721
65728
  const forms = new Set;
65722
65729
  if (!isAbsolute3(filter)) {
65723
- const given = filter.replace(/\\/g, "/").replace(/^(\.\/)+/, "").replace(/\/+$/, "");
65730
+ const given = stripTrailingSlashes(filter.replace(/\\/g, "/").replace(/^(\.\/)+/, ""));
65724
65731
  forms.add(given === "" ? "." : given);
65725
65732
  }
65726
65733
  const resolved = relative2(realPath(resolve6(dir)), realPath(resolve6(filter))).split(sep).join("/");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim",
3
- "version": "2.3.0-preview.326.1",
3
+ "version": "2.3.0-preview.328.1",
4
4
  "description": "Sim CLI - talk to the Sim API from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -56,6 +56,7 @@
56
56
  "proper-lockfile": "4.1.2"
57
57
  },
58
58
  "devDependencies": {
59
+ "@sim/testing": "0.1.0",
59
60
  "@sim/tsconfig": "0.0.0",
60
61
  "@sim/utils": "0.1.0",
61
62
  "@sim/workflow-code": "0.1.0",