@spotpatch/runtime 1.14.0 → 1.15.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.
Files changed (37) hide show
  1. package/dist/{chunk-2WA6XVA4.js → chunk-DCN6OMLH.js} +13 -3
  2. package/dist/{chunk-2WA6XVA4.js.map → chunk-DCN6OMLH.js.map} +1 -1
  3. package/dist/{chunk-KIDHJQRG.js → chunk-PXJKFEUJ.js} +1 -1
  4. package/dist/chunk-PXJKFEUJ.js.map +1 -0
  5. package/dist/contextual-ask-panel.cjs +217 -127
  6. package/dist/contextual-ask-panel.cjs.map +1 -1
  7. package/dist/contextual-ask-panel.d.cts +2 -0
  8. package/dist/contextual-ask-panel.d.ts +2 -0
  9. package/dist/contextual-ask-panel.js +219 -128
  10. package/dist/contextual-ask-panel.js.map +1 -1
  11. package/dist/data-flow-panel.cjs +12 -2
  12. package/dist/data-flow-panel.cjs.map +1 -1
  13. package/dist/data-flow-panel.d.cts +1 -1
  14. package/dist/data-flow-panel.d.ts +1 -1
  15. package/dist/data-flow-panel.js +7 -1
  16. package/dist/data-flow-panel.js.map +1 -1
  17. package/dist/{data-flow-runtime-DMmV0d3E.d.cts → data-flow-runtime-CacBbxN0.d.cts} +2 -1
  18. package/dist/{data-flow-runtime-DMmV0d3E.d.ts → data-flow-runtime-CacBbxN0.d.ts} +2 -1
  19. package/dist/data-flow.cjs +13 -2
  20. package/dist/data-flow.cjs.map +1 -1
  21. package/dist/data-flow.d.cts +1 -1
  22. package/dist/data-flow.d.ts +1 -1
  23. package/dist/data-flow.js +3 -1
  24. package/dist/external-handoff-panel.cjs +22 -6
  25. package/dist/external-handoff-panel.cjs.map +1 -1
  26. package/dist/external-handoff-panel.d.cts +5 -2
  27. package/dist/external-handoff-panel.d.ts +5 -2
  28. package/dist/external-handoff-panel.js +21 -6
  29. package/dist/external-handoff-panel.js.map +1 -1
  30. package/dist/index.cjs +15 -6
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +5 -5
  33. package/dist/index.d.ts +5 -5
  34. package/dist/index.js +11 -6
  35. package/dist/index.js.map +1 -1
  36. package/package.json +2 -2
  37. package/dist/chunk-KIDHJQRG.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -293,7 +293,7 @@ function readSuccessData(value) {
293
293
  return value.data;
294
294
  }
295
295
  function isCodeContext(value) {
296
- return isRecord2(value) && typeof value.relativePath === "string" && (value.language === "tsx" || value.language === "jsx") && typeof value.startLine === "number" && typeof value.endLine === "number" && typeof value.excerpt === "string" && (value.boundary === "component" || value.boundary === "nearby-lines");
296
+ return isRecord2(value) && typeof value.relativePath === "string" && (value.language === "tsx" || value.language === "jsx" || value.language === "astro") && typeof value.startLine === "number" && typeof value.endLine === "number" && typeof value.excerpt === "string" && (value.boundary === "component" || value.boundary === "nearby-lines");
297
297
  }
298
298
  function deepFreezeUnknown(value) {
299
299
  if (!isRecord2(value) && !Array.isArray(value)) {
@@ -1721,7 +1721,11 @@ function createSourceResolver(options) {
1721
1721
  if (marker !== void 0) {
1722
1722
  return Object.freeze({
1723
1723
  react: react2,
1724
- source: markerSource(marker, "jsx-host", "exact")
1724
+ source: markerSource(
1725
+ marker,
1726
+ marker.kind === "astro" ? "astro-host" : "jsx-host",
1727
+ "exact"
1728
+ )
1725
1729
  });
1726
1730
  }
1727
1731
  if (react2.source !== void 0) {
@@ -5576,7 +5580,7 @@ function sourceLocation2(resolution, context, messages) {
5576
5580
  function createSelectionSummary(input, messages) {
5577
5581
  const lines = [
5578
5582
  `SpotPatch: ${input.spotPatchVersion}`,
5579
- `${input.framework === "next" ? "Next.js" : "Vite"}: ${input.frameworkVersion}`,
5583
+ `${{ next: "Next.js", vite: "Vite", astro: "Astro" }[input.framework]}: ${input.frameworkVersion}`,
5580
5584
  `${messages.source}: ${sourceLocation2(input.resolution, input.code, messages)}`,
5581
5585
  `${messages.confidence}: ${input.resolution.source.confidence} (${messages.confidenceLabels[input.resolution.source.confidence]})`,
5582
5586
  `${messages.origin}: ${input.resolution.source.origin}`
@@ -6692,7 +6696,6 @@ ${summary}`;
6692
6696
  view.hideHighlight();
6693
6697
  resizeObserver?.observe(element2);
6694
6698
  refreshSelectionView(true);
6695
- void loadDataFlowReports();
6696
6699
  selectionOpen = true;
6697
6700
  view.focusTargetInstruction(target2.id);
6698
6701
  scheduleBrowserContextCollection(target2, revision);
@@ -6703,6 +6706,7 @@ ${summary}`;
6703
6706
  resolution.source.confidence === "probable" ? view.messages().announcements.sourceProbable : view.messages().announcements.sourceMissing
6704
6707
  );
6705
6708
  }
6709
+ void loadDataFlowReports();
6706
6710
  }
6707
6711
  function updateHoveredElement() {
6708
6712
  animationFrame = void 0;
@@ -7135,6 +7139,7 @@ function bootstrapSpotPatch(config) {
7135
7139
  const controller = createController(config);
7136
7140
  target2[RUNTIME_INSTANCE_KEY] = controller;
7137
7141
  controller.mount();
7142
+ return controller;
7138
7143
  }
7139
7144
 
7140
7145
  // src/data-flow/data-flow-runtime.ts
@@ -7554,7 +7559,7 @@ var import_shared10 = require("@spotpatch/shared");
7554
7559
  function observationMatchesDependency(observation, dependency) {
7555
7560
  const origin = dependency.origin;
7556
7561
  const transportMatches = dependency.kind === "rpc" ? observation.transport === "trpc" && dependency.operation !== void 0 && observation.operation === dependency.operation : dependency.kind === "http" ? observation.transport === "fetch" || observation.transport === "xhr" : false;
7557
- if (!transportMatches || observation.freshness !== "current" || origin === void 0 || observation.requestCallsiteId !== origin.requestCallsiteId || observation.sourceVersion !== origin.sourceVersion || dependency.method !== void 0 && observation.method.toUpperCase() !== dependency.method.toUpperCase() || dependency.url !== void 0 && observation.url.pathname !== dependency.url.pathname || dependency.url?.origin !== void 0 && observation.url.origin !== dependency.url.origin || origin.componentSourceId !== void 0 && observation.componentSourceId !== void 0 && observation.componentSourceId !== origin.componentSourceId || origin.triggerCallsiteId !== void 0 && observation.triggerCallsiteId !== void 0 && observation.triggerCallsiteId !== origin.triggerCallsiteId) {
7562
+ if (dependency.environment === "server" || !transportMatches || observation.freshness !== "current" || origin === void 0 || observation.requestCallsiteId !== origin.requestCallsiteId || observation.sourceVersion !== origin.sourceVersion || dependency.method !== void 0 && observation.method.toUpperCase() !== dependency.method.toUpperCase() || dependency.url !== void 0 && observation.url.pathname !== dependency.url.pathname || dependency.url?.origin !== void 0 && observation.url.origin !== dependency.url.origin || origin.componentSourceId !== void 0 && observation.componentSourceId !== void 0 && observation.componentSourceId !== origin.componentSourceId || origin.triggerCallsiteId !== void 0 && observation.triggerCallsiteId !== void 0 && observation.triggerCallsiteId !== origin.triggerCallsiteId) {
7558
7563
  return false;
7559
7564
  }
7560
7565
  return dependency.association !== "transitive" || observation.componentSourceId === origin.componentSourceId && observation.triggerCallsiteId === origin.triggerCallsiteId;
@@ -7612,8 +7617,12 @@ function appendRuntimeEvidence(evidence, observations, matchedIds) {
7612
7617
  ]);
7613
7618
  }
7614
7619
  function mergeComponentDataFlowReport(report, observations) {
7620
+ const owners = /* @__PURE__ */ new Set([
7621
+ report.component.componentSourceId,
7622
+ ...report.dependencies.filter((dependency) => dependency.environment !== "server").map((dependency) => dependency.origin?.componentSourceId)
7623
+ ]);
7615
7624
  const componentObservations = observations.filter(
7616
- (observation) => observation.componentSourceId === void 0 || observation.componentSourceId === report.component.componentSourceId
7625
+ (observation) => observation.componentSourceId === void 0 || owners.has(observation.componentSourceId)
7617
7626
  );
7618
7627
  const merged = mergeDependencies(report.dependencies, componentObservations);
7619
7628
  return (0, import_shared10.limitDataFlowReportCollections)(