@bettercms-ai/convert 0.17.0 → 0.17.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @bettercms-ai/convert
2
2
 
3
+ ## 0.17.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5a2fcc5: An Astro project that already has a live-preview lane no longer gets the `SSR_DRAFT_ROUTE` pending row. A mounted `<BcmsLiveBlocks>` reads as `bridge`, and `output: "server"` plus a mounted `<BcmsLive>` reads as `draft-route`. Before this, every Astro receipt stayed incomplete no matter what was wired.
8
+
3
9
  ## 0.17.0
4
10
 
5
11
  ### Minor Changes
package/dist/cli.js CHANGED
@@ -6080,9 +6080,28 @@ var pend = (reason, hint, file, line) => ({
6080
6080
  hint
6081
6081
  });
6082
6082
  var ASTRO_LANE_PENDING = pend("SSR_DRAFT_ROUTE", SSR_DRAFT_RECIPE);
6083
+ function mounts(content, component) {
6084
+ const from = new RegExp(
6085
+ `import\\s+([A-Za-z_$][\\w$]*)\\s+from\\s+["']@bettercms-ai/astro/components/${component}\\.astro["']`
6086
+ );
6087
+ const local = content.match(from)?.[1];
6088
+ return local !== void 0 && new RegExp(`<${local}[\\s/>]`).test(content);
6089
+ }
6090
+ var ASTRO_CONFIG = /(^|\/)astro\.config\.(mjs|cjs|js|ts|mts)$/;
6091
+ function astroLane(sources) {
6092
+ const astro = sources.filter((s) => s.path.toLowerCase().endsWith(".astro"));
6093
+ const server = sources.some(
6094
+ (s) => ASTRO_CONFIG.test(s.path) && /\boutput\s*:\s*["']server["']/.test(s.content)
6095
+ );
6096
+ if (server && astro.some((s) => mounts(s.content, "BcmsLive"))) return "draft-route";
6097
+ if (astro.some((s) => mounts(s.content, "BcmsLiveBlocks"))) return "bridge";
6098
+ return null;
6099
+ }
6083
6100
  function canvasBridge(sources, routes) {
6084
- if (sources.some((s) => s.path.toLowerCase().endsWith(".astro")))
6085
- return { lane: "pending", files: [], edits: /* @__PURE__ */ new Map(), pending: [ASTRO_LANE_PENDING] };
6101
+ if (sources.some((s) => s.path.toLowerCase().endsWith(".astro"))) {
6102
+ const lane = astroLane(sources);
6103
+ return lane ? { lane, files: [], edits: /* @__PURE__ */ new Map(), pending: [] } : { lane: "pending", files: [], edits: /* @__PURE__ */ new Map(), pending: [ASTRO_LANE_PENDING] };
6104
+ }
6086
6105
  const files = [];
6087
6106
  const edits = /* @__PURE__ */ new Map();
6088
6107
  const pending = [];
@@ -9782,7 +9801,7 @@ function emitStubs2(dialects, slugs, contents, out) {
9782
9801
  // package.json
9783
9802
  var package_default = {
9784
9803
  name: "@bettercms-ai/convert",
9785
- version: "0.17.0",
9804
+ version: "0.17.1",
9786
9805
  type: "module",
9787
9806
  description: "Deterministic codemod that turns an imported site's text-matched bindings into declared ones \u2014 parser offsets in, one magic-string pass out, plus a receipt of everything it could not do.",
9788
9807
  bin: {