@bettercms-ai/convert 0.9.0 → 0.11.0

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
@@ -37,6 +37,18 @@ interface BriefPath {
37
37
  kind: string;
38
38
  /** The declared field type, which `kind` deliberately loses (richtext vs document). */
39
39
  type: string;
40
+ /**
41
+ * The richtext value IS the element's whole inline subtree — the field's `config.inline`.
42
+ *
43
+ * A heading with a styled run (`<h1>Notes from a <span class="serif">web studio</span></h1>`)
44
+ * derives as ONE richtext field whose value is that innerHTML, not as the text node beside the
45
+ * span. Without this the codemod cannot tell it from the icon+text shape, whose value really is
46
+ * one text node — and it wraps the text node in a `<span>`, leaving the styled run rendered
47
+ * twice. Optional on purpose: a brief written before the distinction existed carries none, and
48
+ * the old wrap-the-text-node reading is still the right answer for it.
49
+ * @see derive-schema.ts textType, which mints `config: { inline: true }` for exactly this shape.
50
+ */
51
+ inline?: true;
40
52
  label: string;
41
53
  /** The copy the REPO renders today. Null when the import captured no default. */
42
54
  original: string | null;
@@ -142,8 +154,13 @@ interface UnlocatedPath {
142
154
  * correctly formatted file, which is every file.
143
155
  */
144
156
  declare const flat: (value: string) => string;
145
- /** The same text with tags removed — what a reader sees, not what the file says. */
146
- declare const stripTags: (value: string) => string;
157
+ /**
158
+ * The same text with tags removed — what a reader sees, not what the file says.
159
+ *
160
+ * `br` is what a line break becomes. A SPACE is what a reader sees; the empty string is what
161
+ * `textContent` sees, and the matcher works on the latter. @see locate, which searches both.
162
+ */
163
+ declare const stripTags: (value: string, br?: string) => string;
147
164
  interface BriefLike {
148
165
  pages: {
149
166
  route: string;
@@ -192,7 +209,9 @@ declare function locate(brief: BriefLike, sources: SourceFile[], options?: Locat
192
209
  * sentence appears in three files" and "this field is bound" are different questions — and a path
193
210
  * is only `rewritten` when EVERY located occurrence of it was.
194
211
  */
195
- type PendingReason = "NO_ORIGINAL" | "NOT_IN_SOURCE" | "DIALECT_UNSUPPORTED" | "IN_EXPRESSION" | "IN_SCRIPT_OR_COMMENT" | "IN_DATA_FILE" | "AMBIGUOUS_LITERAL" | "KIND_MISMATCH" | "SUBSTRING_ONLY" | "PROP_TARGET_NOT_FOUND" | "PROP_DRILLED_DEEP" | "REPEATER_FIXED_LENGTH"
212
+ type PendingReason = "NO_ORIGINAL" | "NOT_IN_SOURCE" | "DIALECT_UNSUPPORTED" | "IN_EXPRESSION" | "IN_SCRIPT_OR_COMMENT" | "IN_DATA_FILE" | "AMBIGUOUS_LITERAL" | "KIND_MISMATCH" | "SUBSTRING_ONLY"
213
+ /** An INLINE richtext value whose element holds a component, a `<slot>` or an expression. */
214
+ | "SUBTREE_NOT_HTML" | "PROP_TARGET_NOT_FOUND" | "PROP_DRILLED_DEEP" | "REPEATER_FIXED_LENGTH"
196
215
  /** One array declaration, two loops over it: the row this leaf belongs to has two homes. */
197
216
  | "REPEATER_AMBIGUOUS"
198
217
  /** An image whose built url maps to no repository asset, or to more than one. */
@@ -515,6 +534,12 @@ interface Site {
515
534
  literal: string;
516
535
  /** The literal is only PART of what this element renders; rewriting it would eat the rest. */
517
536
  partial: boolean;
537
+ /**
538
+ * The subtree holds markup only the FRAMEWORK renders — a component, a `<slot>`, an expression.
539
+ *
540
+ * Absent on every site whose children are plain html, which is the common case. @see ownsSubtree
541
+ */
542
+ nonHtml?: true;
518
543
  /** Tag chain from the document root down to the element's parent, outermost first. */
519
544
  ancestors: string[];
520
545
  /** Index among the element's ELEMENT siblings. */
@@ -629,6 +654,8 @@ interface Rewrite {
629
654
  path: string;
630
655
  /** The brief's kind: "text" | "richtext" | "image". */
631
656
  kind: string;
657
+ /** The richtext value is the element's whole inline subtree. @see BriefPath.inline */
658
+ inline?: true;
632
659
  /** The copy the repo renders today, kept as the in-code fallback. */
633
660
  fallback: string;
634
661
  /** The identifier this page's snapshot is imported under. */
@@ -802,7 +829,7 @@ declare function attrsFor(path: string, kind: string, props?: AttrBinding[], sco
802
829
  declare function propsAttribute(props: AttrBinding[]): string;
803
830
 
804
831
  /** Bumped whenever the emitted source changes. `isKnownHelper` upgrades anything older. */
805
- declare const HELPER_VERSION = 6;
832
+ declare const HELPER_VERSION = 7;
806
833
  /** Where each dialect's helper lives. Null = this dialect reads nothing at build time. */
807
834
  declare const HELPER_PATH: Record<Dialect, string | null>;
808
835
  /** The directory the snapshots live in, at the repository root. */
@@ -1132,6 +1159,41 @@ declare const SOURCE_EXTENSIONS: string[];
1132
1159
  /** Is this repository-relative path a file worth opening? */
1133
1160
  declare function isSourceCandidate(path: string): boolean;
1134
1161
 
1162
+ /**
1163
+ * Text that is NOT copy, and is therefore outside both halves of the ratio.
1164
+ *
1165
+ * 🔴 IN THE DENOMINATOR TOO. Counting a `✓`, a `01`, the platform badge or a skip link as
1166
+ * unaddressable text would put a floor under every route's percentage that no amount of binding
1167
+ * could lift — and the target is a number someone has to be able to reach. They are not copy an
1168
+ * author edits, so they are not copy this measures.
1169
+ *
1170
+ * - a decorative glyph: two characters or fewer, a single non-letter symbol, or an ordinal
1171
+ * (`01`, `2.`, `3 /`) that numbers a list rather than saying anything;
1172
+ * - the platform badge every free site renders;
1173
+ * - a skip link, which exists for keyboards and is never edited.
1174
+ */
1175
+ declare const isDecorativeGlyph: (text: string) => boolean;
1176
+ interface XrayBucket {
1177
+ /** The element that renders it. */
1178
+ tag: string;
1179
+ /** Its landmark chain, outermost first — `main>ul`. */
1180
+ context: string;
1181
+ chars: number;
1182
+ nodes: number;
1183
+ /** Up to two examples, ≤ 50 characters each. */
1184
+ samples: string[];
1185
+ }
1186
+ interface Xray {
1187
+ /** Characters of visible copy, decorative glyphs excluded. */
1188
+ visible: number;
1189
+ /** Of those, the characters no binding owns. */
1190
+ unaddressable: number;
1191
+ /** The biggest buckets, largest first — at most 12. */
1192
+ buckets: XrayBucket[];
1193
+ }
1194
+ /** What a reader sees on this page, and how much of it no field owns. */
1195
+ declare function measureUnaddressable(html: string): Xray;
1196
+
1135
1197
  /**
1136
1198
  * The project's own `compilerOptions.paths`, when a tsconfig is among the files.
1137
1199
  *
@@ -1354,6 +1416,11 @@ declare function carryFor(options: {
1354
1416
  * an unexpected extra key is simply carried past. The shape is frozen; the reader is not brittle.
1355
1417
  */
1356
1418
  interface ComponentizePlanField {
1419
+ /**
1420
+ * Where an instance holds this leaf's copy (`h2_latest`, `group_webgl[0].a_webgl`) — allocated by the
1421
+ * server, which alone knows the dedupe suffixes and table keys. Absent from older plans.
1422
+ */
1423
+ overrideKey?: string;
1357
1424
  /** The leaf's key inside the group — `title`, `items[0].q`. */
1358
1425
  key?: string;
1359
1426
  /** The whole page path — `hero.title`. Derived from `groupKey` + `key` when absent. */
@@ -1497,6 +1564,15 @@ interface ComponentizeReceipt {
1497
1564
  sections: SectionsReceipt;
1498
1565
  /** The component slugs this run wrote a file for, sorted. */
1499
1566
  components: string[];
1567
+ /**
1568
+ * The file each of those components was written to — what lets the server record a component's source
1569
+ * (kind `section`) without anyone claiming it by hand. Additive: readers of `components` are unchanged.
1570
+ */
1571
+ componentFiles?: {
1572
+ slug: string;
1573
+ path: string;
1574
+ export: "default";
1575
+ }[];
1500
1576
  /**
1501
1577
  * Sections the SERVER already marked pending (`NO_GROUP_ROOT`, `ALREADY_COMPONENTIZED`, …).
1502
1578
  *
@@ -1644,4 +1720,4 @@ declare function convertSources(briefIn: Brief, sources: SourceFile[], options?:
1644
1720
  receipt: ConversionReceipt;
1645
1721
  }>;
1646
1722
 
1647
- export { ASTRO_LANE_PENDING, type AstNode, type AttrBinding, type Brief, type BriefForm, type BriefPage, type BriefPath, COMPONENT_DIR, CONTENT_DIR, type CanvasResult, type CanvasSource, type Carried, type ComponentizeOptions, type ComponentizePlan, type ComponentizePlanComponent, type ComponentizePlanField, type ComponentizePlanPage, type ComponentizePlanSection, type ComponentizeReceipt, type ConversionReceipt, ConvertError, type ConvertErrorCode, type ConvertOptions, DIALECT_RULES, type DataMember, type DataResult, type DeclaredPath, type Dialect, type DynamicBinding, FORM_SCRIPT, type FileDeclaration, type FindSitesResult, FormInvariantError, type FormPendingReason, type FormsReceipt, HELPER_PATH, HELPER_VERSION, type ImageResult, type ImageTarget, type ImportedFrom, type LlmFallback, type LocatedPath, type Node, PARSE_FILE, type ParsedFile, type ParserError, type PathLocator, type PendingForm, type PendingPath, type PendingReason, type PendingSection, type PlanFile, REGISTRY_MARKER, type ReceiptFile, ReceiptInvariantError, type ReceiptNote, type Rewrite, SECTIONS_LIB, SECTION_MARKER, SKIP_DIRS, SKIP_FILES, SOURCE_EXTENSIONS, SSR_DRAFT_RECIPE, STUB_CONTENT, SectionInvariantError, type SectionPendingReason, type SectionsReceipt, type Site, type SiteWhere, type SourceFile, type Splice, type TargetIdentity, type UnlocatedPath, type ValidationCode, ValidationError, aliasesFrom, assertForms, assertReceipt, assertSections, assetCandidates, assetImport, attrsFor, bindDataLiterals, bindImages, briefDigest, canvasBridge, carryFor, componentizeSources, convertSources, convertedHere, coverageOf, declaringElements, dialectOf, exportedFunction, extendedConfigs, findSites, findSitesTolerant, flat, helperSource, importsIn, isDynamicRoute, isKnownHelper, isSourceCandidate, locate, overlapping, pageFilesFor, parseFile, propsAttribute, readBrief, readComponentizePlan, readDeclarations, readExpr, readPlan, relativeImport, resolveSpecifier, rewriteFile, routeOfFile, stripTags, unreadableConfigs, walkAst, wireForms };
1723
+ export { ASTRO_LANE_PENDING, type AstNode, type AttrBinding, type Brief, type BriefForm, type BriefPage, type BriefPath, COMPONENT_DIR, CONTENT_DIR, type CanvasResult, type CanvasSource, type Carried, type ComponentizeOptions, type ComponentizePlan, type ComponentizePlanComponent, type ComponentizePlanField, type ComponentizePlanPage, type ComponentizePlanSection, type ComponentizeReceipt, type ConversionReceipt, ConvertError, type ConvertErrorCode, type ConvertOptions, DIALECT_RULES, type DataMember, type DataResult, type DeclaredPath, type Dialect, type DynamicBinding, FORM_SCRIPT, type FileDeclaration, type FindSitesResult, FormInvariantError, type FormPendingReason, type FormsReceipt, HELPER_PATH, HELPER_VERSION, type ImageResult, type ImageTarget, type ImportedFrom, type LlmFallback, type LocatedPath, type Node, PARSE_FILE, type ParsedFile, type ParserError, type PathLocator, type PendingForm, type PendingPath, type PendingReason, type PendingSection, type PlanFile, REGISTRY_MARKER, type ReceiptFile, ReceiptInvariantError, type ReceiptNote, type Rewrite, SECTIONS_LIB, SECTION_MARKER, SKIP_DIRS, SKIP_FILES, SOURCE_EXTENSIONS, SSR_DRAFT_RECIPE, STUB_CONTENT, SectionInvariantError, type SectionPendingReason, type SectionsReceipt, type Site, type SiteWhere, type SourceFile, type Splice, type TargetIdentity, type UnlocatedPath, type ValidationCode, ValidationError, type Xray, type XrayBucket, aliasesFrom, assertForms, assertReceipt, assertSections, assetCandidates, assetImport, attrsFor, bindDataLiterals, bindImages, briefDigest, canvasBridge, carryFor, componentizeSources, convertSources, convertedHere, coverageOf, declaringElements, dialectOf, exportedFunction, extendedConfigs, findSites, findSitesTolerant, flat, helperSource, importsIn, isDecorativeGlyph, isDynamicRoute, isKnownHelper, isSourceCandidate, locate, measureUnaddressable, overlapping, pageFilesFor, parseFile, propsAttribute, readBrief, readComponentizePlan, readDeclarations, readExpr, readPlan, relativeImport, resolveSpecifier, rewriteFile, routeOfFile, stripTags, unreadableConfigs, walkAst, wireForms };