@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/CHANGELOG.md +6 -0
- package/dist/cli.js +16 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @bettercms-ai/convert
|
|
2
2
|
|
|
3
|
+
## 0.24.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 15e446a: Helper v13: a repository image path (`@/images/blog/post-1.avif`, `~/…`, `../…`, `/src/…`) is never rendered as a value; the template's own imported picture shows instead. Converted sites get it on their next BetterCMS build through the helper upgrade.
|
|
8
|
+
|
|
3
9
|
## 0.24.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/cli.js
CHANGED
|
@@ -4190,7 +4190,7 @@ async function bindImages(ctx, targets) {
|
|
|
4190
4190
|
|
|
4191
4191
|
// src/helper.ts
|
|
4192
4192
|
import { createHash as createHash2 } from "crypto";
|
|
4193
|
-
var HELPER_VERSION =
|
|
4193
|
+
var HELPER_VERSION = 13;
|
|
4194
4194
|
var HEADER = "// @bettercms-ai/convert helper v";
|
|
4195
4195
|
var HELPER_PATH = Object.fromEntries(
|
|
4196
4196
|
Object.keys(DIALECT_RULES).map((d) => [d, DIALECT_RULES[d].helper])
|
|
@@ -4236,9 +4236,16 @@ function readPath(root: unknown, path: string): unknown {
|
|
|
4236
4236
|
return cursor;
|
|
4237
4237
|
}
|
|
4238
4238
|
|
|
4239
|
+
/**
|
|
4240
|
+
* A repository image path \u2014 \`@/images/x.avif\`, \`~/assets/x.png\`, \`../assets/x.jpg\`, \`/src/x.png\`.
|
|
4241
|
+
* The bundler resolves one at build and nothing else can, so as a value it is never rendered: the
|
|
4242
|
+
* template's own fallback (the picture the build already imported) shows instead of a broken image.
|
|
4243
|
+
*/
|
|
4244
|
+
const REPO_IMAGE_PATH = /^(?:@[\\w-]*|~|\\.{1,2}|\\/?src)\\/[^\\s?#"'<>]*\\.(?:avif|png|jpe?g|webp|gif|svg|bmp|ico|tiff?|jxl|heic)(?:[?#]\\S*)?$/i;
|
|
4245
|
+
|
|
4239
4246
|
/** A stored value as a template renders it: richtext is its html, an image is its url. */
|
|
4240
4247
|
function render(value: unknown): string | undefined {
|
|
4241
|
-
if (typeof value === "string") return value;
|
|
4248
|
+
if (typeof value === "string") return REPO_IMAGE_PATH.test(value.trim()) ? undefined : value;
|
|
4242
4249
|
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
4243
4250
|
if (isRecord(value)) {
|
|
4244
4251
|
if (typeof value.html === "string") return value.html;
|
|
@@ -4732,7 +4739,8 @@ var HISTORICAL = {
|
|
|
4732
4739
|
8: "484e72852d2b496e016a1f2a2b1a77bb993f8a163b290781522d6114b6519bb9",
|
|
4733
4740
|
9: "d6441db2ff4578c3c5d4b7d461f3374b89247ef6ba9e0d535791e840d803e4f3",
|
|
4734
4741
|
10: "ffcb59862972b15a67c5951e9f3b94ce5b8b50345e6aac2bfa5789cfc3136910",
|
|
4735
|
-
11: "ceb2a932d4c2761a5045ff35032e0b45130a0b5034547ff37579c72c9ce3594e"
|
|
4742
|
+
11: "ceb2a932d4c2761a5045ff35032e0b45130a0b5034547ff37579c72c9ce3594e",
|
|
4743
|
+
12: "10f71724484c84af12aa3eb90db44bf6acbf71fcf8ddff5b6361c1190ba16528"
|
|
4736
4744
|
},
|
|
4737
4745
|
"src/lib/bcms-content.ts": {
|
|
4738
4746
|
1: "ae72ae14d706943d481c880d70da5789b4816ba1ba319a10fbc63ded4d0b42f2",
|
|
@@ -4745,7 +4753,8 @@ var HISTORICAL = {
|
|
|
4745
4753
|
8: "1a6f669d76d42effe77f082436e9d21c0efa6fc499e919e3d116bc3a27a7f3d5",
|
|
4746
4754
|
9: "eee9fb1635ae7d6f8f33676a1f390600ca24a62ee992775252273c73a011c494",
|
|
4747
4755
|
10: "35bb7c0e30f5c41fe68e52259ec4764de6de2734064fa0e1521f3338eef0a09e",
|
|
4748
|
-
11: "818784f2088150d64d91b42eac944dc9503f104d32a0e7a18c753d2982a5adc0"
|
|
4756
|
+
11: "818784f2088150d64d91b42eac944dc9503f104d32a0e7a18c753d2982a5adc0",
|
|
4757
|
+
12: "79dafc525a541feae55ada5dbe2ea966cac82acd741a4b41d61fe9e0cdfaa208"
|
|
4749
4758
|
},
|
|
4750
4759
|
"composables/bcms-content.ts": {
|
|
4751
4760
|
1: "c272412532efed7db64b6cf313b2bed4291f9951430412289c8a588b7f565407",
|
|
@@ -4758,7 +4767,8 @@ var HISTORICAL = {
|
|
|
4758
4767
|
8: "484e72852d2b496e016a1f2a2b1a77bb993f8a163b290781522d6114b6519bb9",
|
|
4759
4768
|
9: "d6441db2ff4578c3c5d4b7d461f3374b89247ef6ba9e0d535791e840d803e4f3",
|
|
4760
4769
|
10: "ffcb59862972b15a67c5951e9f3b94ce5b8b50345e6aac2bfa5789cfc3136910",
|
|
4761
|
-
11: "ceb2a932d4c2761a5045ff35032e0b45130a0b5034547ff37579c72c9ce3594e"
|
|
4770
|
+
11: "ceb2a932d4c2761a5045ff35032e0b45130a0b5034547ff37579c72c9ce3594e",
|
|
4771
|
+
12: "10f71724484c84af12aa3eb90db44bf6acbf71fcf8ddff5b6361c1190ba16528"
|
|
4762
4772
|
}
|
|
4763
4773
|
};
|
|
4764
4774
|
var sha256 = (value) => createHash2("sha256").update(value, "utf8").digest("hex");
|
|
@@ -10774,7 +10784,7 @@ function styleEdits(before, after) {
|
|
|
10774
10784
|
// package.json
|
|
10775
10785
|
var package_default = {
|
|
10776
10786
|
name: "@bettercms-ai/convert",
|
|
10777
|
-
version: "0.24.
|
|
10787
|
+
version: "0.24.1",
|
|
10778
10788
|
type: "module",
|
|
10779
10789
|
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.",
|
|
10780
10790
|
bin: {
|