@bettercms-ai/convert 0.24.0 → 0.24.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.d.ts CHANGED
@@ -955,7 +955,7 @@ declare function attrsFor(path: string, kind: string, props?: AttrBinding[], sco
955
955
  declare function propsAttribute(props: AttrBinding[]): string;
956
956
 
957
957
  /** Bumped whenever the emitted source changes. `isKnownHelper` upgrades anything older. */
958
- declare const HELPER_VERSION = 12;
958
+ declare const HELPER_VERSION = 13;
959
959
  /** Where each dialect's helper lives. Null = this dialect reads nothing at build time. */
960
960
  declare const HELPER_PATH: Record<Dialect, string | null>;
961
961
  /** The directory the snapshots live in, at the repository root. */
package/dist/index.js CHANGED
@@ -4187,7 +4187,7 @@ async function bindImages(ctx, targets) {
4187
4187
 
4188
4188
  // src/helper.ts
4189
4189
  import { createHash as createHash2 } from "crypto";
4190
- var HELPER_VERSION = 12;
4190
+ var HELPER_VERSION = 13;
4191
4191
  var HEADER = "// @bettercms-ai/convert helper v";
4192
4192
  var HELPER_PATH = Object.fromEntries(
4193
4193
  Object.keys(DIALECT_RULES).map((d) => [d, DIALECT_RULES[d].helper])
@@ -4233,9 +4233,16 @@ function readPath(root: unknown, path: string): unknown {
4233
4233
  return cursor;
4234
4234
  }
4235
4235
 
4236
+ /**
4237
+ * A repository image path \u2014 \`@/images/x.avif\`, \`~/assets/x.png\`, \`../assets/x.jpg\`, \`/src/x.png\`.
4238
+ * The bundler resolves one at build and nothing else can, so as a value it is never rendered: the
4239
+ * template's own fallback (the picture the build already imported) shows instead of a broken image.
4240
+ */
4241
+ const REPO_IMAGE_PATH = /^(?:@[\\w-]*|~|\\.{1,2}|\\/?src)\\/[^\\s?#"'<>]*\\.(?:avif|png|jpe?g|webp|gif|svg|bmp|ico|tiff?|jxl|heic)(?:[?#]\\S*)?$/i;
4242
+
4236
4243
  /** A stored value as a template renders it: richtext is its html, an image is its url. */
4237
4244
  function render(value: unknown): string | undefined {
4238
- if (typeof value === "string") return value;
4245
+ if (typeof value === "string") return REPO_IMAGE_PATH.test(value.trim()) ? undefined : value;
4239
4246
  if (typeof value === "number" || typeof value === "boolean") return String(value);
4240
4247
  if (isRecord(value)) {
4241
4248
  if (typeof value.html === "string") return value.html;
@@ -4729,7 +4736,8 @@ var HISTORICAL = {
4729
4736
  8: "484e72852d2b496e016a1f2a2b1a77bb993f8a163b290781522d6114b6519bb9",
4730
4737
  9: "d6441db2ff4578c3c5d4b7d461f3374b89247ef6ba9e0d535791e840d803e4f3",
4731
4738
  10: "ffcb59862972b15a67c5951e9f3b94ce5b8b50345e6aac2bfa5789cfc3136910",
4732
- 11: "ceb2a932d4c2761a5045ff35032e0b45130a0b5034547ff37579c72c9ce3594e"
4739
+ 11: "ceb2a932d4c2761a5045ff35032e0b45130a0b5034547ff37579c72c9ce3594e",
4740
+ 12: "10f71724484c84af12aa3eb90db44bf6acbf71fcf8ddff5b6361c1190ba16528"
4733
4741
  },
4734
4742
  "src/lib/bcms-content.ts": {
4735
4743
  1: "ae72ae14d706943d481c880d70da5789b4816ba1ba319a10fbc63ded4d0b42f2",
@@ -4742,7 +4750,8 @@ var HISTORICAL = {
4742
4750
  8: "1a6f669d76d42effe77f082436e9d21c0efa6fc499e919e3d116bc3a27a7f3d5",
4743
4751
  9: "eee9fb1635ae7d6f8f33676a1f390600ca24a62ee992775252273c73a011c494",
4744
4752
  10: "35bb7c0e30f5c41fe68e52259ec4764de6de2734064fa0e1521f3338eef0a09e",
4745
- 11: "818784f2088150d64d91b42eac944dc9503f104d32a0e7a18c753d2982a5adc0"
4753
+ 11: "818784f2088150d64d91b42eac944dc9503f104d32a0e7a18c753d2982a5adc0",
4754
+ 12: "79dafc525a541feae55ada5dbe2ea966cac82acd741a4b41d61fe9e0cdfaa208"
4746
4755
  },
4747
4756
  "composables/bcms-content.ts": {
4748
4757
  1: "c272412532efed7db64b6cf313b2bed4291f9951430412289c8a588b7f565407",
@@ -4755,7 +4764,8 @@ var HISTORICAL = {
4755
4764
  8: "484e72852d2b496e016a1f2a2b1a77bb993f8a163b290781522d6114b6519bb9",
4756
4765
  9: "d6441db2ff4578c3c5d4b7d461f3374b89247ef6ba9e0d535791e840d803e4f3",
4757
4766
  10: "ffcb59862972b15a67c5951e9f3b94ce5b8b50345e6aac2bfa5789cfc3136910",
4758
- 11: "ceb2a932d4c2761a5045ff35032e0b45130a0b5034547ff37579c72c9ce3594e"
4767
+ 11: "ceb2a932d4c2761a5045ff35032e0b45130a0b5034547ff37579c72c9ce3594e",
4768
+ 12: "10f71724484c84af12aa3eb90db44bf6acbf71fcf8ddff5b6361c1190ba16528"
4759
4769
  }
4760
4770
  };
4761
4771
  var sha256 = (value) => createHash2("sha256").update(value, "utf8").digest("hex");