@blogmcp/mdx-schema 0.1.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/checkPin.d.ts +48 -0
- package/dist/checkPin.js +139 -0
- package/dist/checkPin.js.map +1 -0
- package/dist/composables/useMdxParsing.d.ts +71 -0
- package/dist/composables/useMdxParsing.js +239 -0
- package/dist/composables/useMdxParsing.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata/customComponents.d.ts +128 -0
- package/dist/metadata/customComponents.js +301 -0
- package/dist/metadata/customComponents.js.map +1 -0
- package/dist/metadata/index.d.ts +24 -0
- package/dist/metadata/index.js +427 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/metadata/validate.d.ts +46 -0
- package/dist/metadata/validate.js +95 -0
- package/dist/metadata/validate.js.map +1 -0
- package/dist/prepareProps.d.ts +42 -0
- package/dist/prepareProps.js +177 -0
- package/dist/prepareProps.js.map +1 -0
- package/dist/styles/index.d.ts +203 -0
- package/dist/styles/index.js +162 -0
- package/dist/styles/index.js.map +1 -0
- package/dist/types/index.d.ts +421 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/version.d.ts +23 -0
- package/dist/version.js +23 -0
- package/dist/version.js.map +1 -0
- package/package.json +80 -0
- package/src/checkPin.ts +163 -0
- package/src/composables/useMdxParsing.ts +248 -0
- package/src/index.ts +22 -0
- package/src/metadata/customComponents.ts +360 -0
- package/src/metadata/index.ts +437 -0
- package/src/metadata/validate.ts +153 -0
- package/src/prepareProps.ts +219 -0
- package/src/styles/index.ts +196 -0
- package/src/types/index.ts +469 -0
- package/src/version.ts +24 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Types for MDX Components
|
|
3
|
+
*
|
|
4
|
+
* These types are used by both edit and render components.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Callout component types
|
|
8
|
+
*/
|
|
9
|
+
export type CalloutType = 'info' | 'warning' | 'tip' | 'danger';
|
|
10
|
+
export interface CalloutProps {
|
|
11
|
+
/** The callout type determines styling and icon */
|
|
12
|
+
type?: CalloutType;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* CodeBlock component types
|
|
16
|
+
*/
|
|
17
|
+
export interface CodeBlockProps {
|
|
18
|
+
/** Programming language for syntax highlighting */
|
|
19
|
+
language?: string;
|
|
20
|
+
/** Optional file name/title displayed in header */
|
|
21
|
+
title?: string;
|
|
22
|
+
/** Whether to show line numbers (not implemented in all variants) */
|
|
23
|
+
showLineNumbers?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gallery component types
|
|
27
|
+
*/
|
|
28
|
+
export interface MediaObject {
|
|
29
|
+
src: string;
|
|
30
|
+
alt: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
type?: 'image' | 'video';
|
|
34
|
+
width?: number;
|
|
35
|
+
height?: number;
|
|
36
|
+
}
|
|
37
|
+
export type GalleryImage = string | MediaObject;
|
|
38
|
+
/** How a gallery image fills its tile. */
|
|
39
|
+
export type GalleryFit = 'cover' | 'contain';
|
|
40
|
+
export interface GalleryProps {
|
|
41
|
+
/** Array of image URLs or MediaObjects to display */
|
|
42
|
+
images: GalleryImage[];
|
|
43
|
+
/** Number of columns (1-4) */
|
|
44
|
+
columns?: 1 | 2 | 3 | 4;
|
|
45
|
+
/** Gap between images (Tailwind scale) */
|
|
46
|
+
gap?: number;
|
|
47
|
+
/**
|
|
48
|
+
* CSS aspect-ratio for each tile (e.g. "1", "16/9", "775/308"), controlling
|
|
49
|
+
* tile height. The literal "auto" drops the fixed box so images render at
|
|
50
|
+
* their natural height (full width, proportional). Default "1" (square).
|
|
51
|
+
*/
|
|
52
|
+
aspectRatio?: string;
|
|
53
|
+
/**
|
|
54
|
+
* How the image fills its tile: "cover" crops to fill (default), "contain"
|
|
55
|
+
* shows the whole image letterboxed (no crop). Ignored when aspectRatio="auto".
|
|
56
|
+
*/
|
|
57
|
+
fit?: GalleryFit;
|
|
58
|
+
/**
|
|
59
|
+
* CSS object-position selecting the region of interest shown when cropping
|
|
60
|
+
* (e.g. "center", "top", "50% 30%"). Only meaningful with fit="cover" and a
|
|
61
|
+
* fixed aspect-ratio. Default "center".
|
|
62
|
+
*/
|
|
63
|
+
position?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* YouTube component types
|
|
67
|
+
*/
|
|
68
|
+
export interface YouTubeProps {
|
|
69
|
+
/** YouTube video ID */
|
|
70
|
+
id: string;
|
|
71
|
+
/** Optional video title displayed below embed */
|
|
72
|
+
title?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* AudioPlayer component types
|
|
76
|
+
*/
|
|
77
|
+
export interface AudioPlayerProps {
|
|
78
|
+
/** Media slug — resolves to /api/media/file/{slug} */
|
|
79
|
+
slug: string;
|
|
80
|
+
/** Displayed title */
|
|
81
|
+
title?: string;
|
|
82
|
+
/** Show collapsible transcript */
|
|
83
|
+
showTranscription?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Common component variant type
|
|
87
|
+
*/
|
|
88
|
+
export type ComponentVariant = 'default' | 'minimal' | 'accent' | string;
|
|
89
|
+
/**
|
|
90
|
+
* Blog configuration types
|
|
91
|
+
*/
|
|
92
|
+
export interface ComponentStyleConfig {
|
|
93
|
+
[key: string]: string | number | boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface ComponentConfig {
|
|
96
|
+
/** Which render variant to use */
|
|
97
|
+
variant: ComponentVariant;
|
|
98
|
+
/** Style overrides passed as props */
|
|
99
|
+
styles?: ComponentStyleConfig;
|
|
100
|
+
}
|
|
101
|
+
export interface BlogComponentsConfig {
|
|
102
|
+
callout?: ComponentConfig;
|
|
103
|
+
codeblock?: ComponentConfig;
|
|
104
|
+
gallery?: ComponentConfig;
|
|
105
|
+
youtube?: ComponentConfig;
|
|
106
|
+
audioplayer?: ComponentConfig;
|
|
107
|
+
}
|
|
108
|
+
export interface BlogContentTranslation {
|
|
109
|
+
[locale: string]: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* How readers browse the blog's content. Two organization models, the
|
|
113
|
+
* customer's choice (see docs: concepts/organizing-content):
|
|
114
|
+
* - `menu` — hierarchy only: the curated navigation menu (docs-style sidebar).
|
|
115
|
+
* One home per article. Best for knowledge bases / docs.
|
|
116
|
+
* - `tags` — flat only: many-to-many tags + `/topics/<slug>` archives.
|
|
117
|
+
* Best for blogs/news where articles span multiple themes.
|
|
118
|
+
* - `both` — show both browses (default for the reference blog).
|
|
119
|
+
*/
|
|
120
|
+
export type ContentOrganizationMode = 'menu' | 'tags' | 'both';
|
|
121
|
+
export interface BlogOrganizationConfig {
|
|
122
|
+
/** Reader-facing browse model. Defaults to `both` when unset. */
|
|
123
|
+
mode?: ContentOrganizationMode;
|
|
124
|
+
}
|
|
125
|
+
export interface BlogConfig {
|
|
126
|
+
components: BlogComponentsConfig;
|
|
127
|
+
theme?: {
|
|
128
|
+
accent?: string;
|
|
129
|
+
accentHover?: string;
|
|
130
|
+
accentLight?: string;
|
|
131
|
+
[key: string]: string | undefined;
|
|
132
|
+
};
|
|
133
|
+
content?: Record<string, BlogContentTranslation>;
|
|
134
|
+
/** Which content-organization model the reader-facing blog presents. */
|
|
135
|
+
organization?: BlogOrganizationConfig;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* MDX parsed content types (for MdxPreview)
|
|
139
|
+
*/
|
|
140
|
+
export interface ParsedHtmlContent {
|
|
141
|
+
type: 'html';
|
|
142
|
+
content: string;
|
|
143
|
+
}
|
|
144
|
+
export interface ParsedComponentContent {
|
|
145
|
+
type: 'component';
|
|
146
|
+
name: string;
|
|
147
|
+
props: Record<string, unknown>;
|
|
148
|
+
children?: string;
|
|
149
|
+
}
|
|
150
|
+
export type ParsedContent = ParsedHtmlContent | ParsedComponentContent;
|
|
151
|
+
/**
|
|
152
|
+
* Snapshot of a prop's shape captured on a `propRemoved` deprecation
|
|
153
|
+
* entry at removal time. Lets a codemod author working months later
|
|
154
|
+
* reconstruct the prop's original contract without spelunking baseline
|
|
155
|
+
* history. CI-validated against the baseline shape via the
|
|
156
|
+
* `propRemovedShapeMismatch` rule — drift is rejected.
|
|
157
|
+
*
|
|
158
|
+
* Intentionally a structural subset of `PropMetadata` rather than a
|
|
159
|
+
* full clone — fields like `name` and `addedIn` are already implied by
|
|
160
|
+
* the entry's `prop` field and the SCHEMA_VERSION at which the prop
|
|
161
|
+
* existed, so omitting them avoids redundancy.
|
|
162
|
+
*/
|
|
163
|
+
export interface RemovedPropShape {
|
|
164
|
+
type: string;
|
|
165
|
+
required: boolean;
|
|
166
|
+
default?: string;
|
|
167
|
+
enum?: string[];
|
|
168
|
+
numericRange?: [number, number];
|
|
169
|
+
description?: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Schema-version metadata for a single component-level change.
|
|
173
|
+
*
|
|
174
|
+
* Each entry is a tagged discriminated union; the `kind` field selects
|
|
175
|
+
* the shape. The classifier in `test/compat.spec.ts` consumes these
|
|
176
|
+
* entries when matching a baseline-vs-current diff against the
|
|
177
|
+
* 3-tier rubric.
|
|
178
|
+
*
|
|
179
|
+
* - `propRename` — Tier 2 (soft, shimmable). Old prop name is
|
|
180
|
+
* silently aliased to the new name at render time
|
|
181
|
+
* by `prepareProps`. Removed at `removeIn`.
|
|
182
|
+
* - `enumValueRename` — Tier 2 (soft, shimmable). Old enum values are
|
|
183
|
+
* rewritten to new ones via the `valueAliases`
|
|
184
|
+
* map by `prepareProps`. Removed at `removeIn`.
|
|
185
|
+
* - `propRemoved` — Tier 3 (hard). A codemod under `codemod` must
|
|
186
|
+
* already have rewritten stored content; the
|
|
187
|
+
* entry exists for tracking + debug logging when
|
|
188
|
+
* the prop is still present on rendered nodes
|
|
189
|
+
* (signals a tenant on a stale `schema_version`).
|
|
190
|
+
* Carries `removedShape` — a snapshot of the
|
|
191
|
+
* prop's metadata at removal time so codemod
|
|
192
|
+
* authors months later don't have to spelunk
|
|
193
|
+
* baseline history to reconstruct the original
|
|
194
|
+
* contract. CI validates the snapshot against
|
|
195
|
+
* the baseline shape.
|
|
196
|
+
* - `propBecameRequired` — Tier 3 (hard). Used both when a NEW required
|
|
197
|
+
* prop is added and when an existing optional
|
|
198
|
+
* prop flips to required. A backfill codemod
|
|
199
|
+
* under `codemod` populates stored content;
|
|
200
|
+
* `defaultValue` is the runtime fallback the
|
|
201
|
+
* shim injects when stored content omits the
|
|
202
|
+
* prop (e.g. legacy article not yet migrated).
|
|
203
|
+
* Replaces the historical overload of
|
|
204
|
+
* `propRemoved` for required-flips, which had
|
|
205
|
+
* time-bomb semantics (the propRemoved arm
|
|
206
|
+
* logged on every render of a still-present
|
|
207
|
+
* prop).
|
|
208
|
+
* - `defaultChangeAccepted` — Tier 1 release-notes-only acknowledgement
|
|
209
|
+
* that a prop default changed and authors have
|
|
210
|
+
* opted to accept silent visual drift (no codemod
|
|
211
|
+
* is technically required — articles that omitted
|
|
212
|
+
* the prop will render with the new default).
|
|
213
|
+
* Replaces the historical `codemod:
|
|
214
|
+
* 'release-notes-only'` magic string on
|
|
215
|
+
* `propRemoved`.
|
|
216
|
+
* - `componentStructureChange` — Tier 3 acknowledgement that a
|
|
217
|
+
* component's `hasChildren` or `selfClosing`
|
|
218
|
+
* flipped. Authors MUST point at a codemod (or
|
|
219
|
+
* `releaseNotesOnly: true` if they explicitly
|
|
220
|
+
* accept the break) — the rewrite converts
|
|
221
|
+
* `<X />` ↔ `<X></X>` in stored MDX.
|
|
222
|
+
*
|
|
223
|
+
* All kinds carry `message` — the human-readable explanation
|
|
224
|
+
* shipped to dev-mode console logs. All kinds use `removeIn`
|
|
225
|
+
* (not `removedIn`) for naming consistency — the field marks the
|
|
226
|
+
* SCHEMA_VERSION at which the artefact disappears from the live
|
|
227
|
+
* schema. CI-enforced by the `removeInMissed` rule.
|
|
228
|
+
*/
|
|
229
|
+
export type DeprecationEntry = {
|
|
230
|
+
kind: 'propRename';
|
|
231
|
+
/** SCHEMA_VERSION at which the rename was introduced */
|
|
232
|
+
since: string;
|
|
233
|
+
/** SCHEMA_VERSION at which the alias must disappear (CI-enforced by `removeInMissed`) */
|
|
234
|
+
removeIn: string;
|
|
235
|
+
/** Old prop name as it appears in stored MDX content */
|
|
236
|
+
prop: string;
|
|
237
|
+
/** Current prop name in the component */
|
|
238
|
+
aliasFor: string;
|
|
239
|
+
/** Human-readable message logged once per process in dev mode */
|
|
240
|
+
message: string;
|
|
241
|
+
} | {
|
|
242
|
+
kind: 'enumValueRename';
|
|
243
|
+
since: string;
|
|
244
|
+
removeIn: string;
|
|
245
|
+
/** Prop whose enum values are being remapped */
|
|
246
|
+
prop: string;
|
|
247
|
+
/** Map of old → new enum values. Values not in the map pass through unchanged. */
|
|
248
|
+
valueAliases: Record<string, string>;
|
|
249
|
+
message: string;
|
|
250
|
+
} | {
|
|
251
|
+
kind: 'propRemoved';
|
|
252
|
+
since: string;
|
|
253
|
+
/**
|
|
254
|
+
* SCHEMA_VERSION at which the prop was removed from the component.
|
|
255
|
+
* Renamed from `removedIn` for naming consistency with all other
|
|
256
|
+
* deprecation kinds (CI-enforced by `removeInMissed`).
|
|
257
|
+
*/
|
|
258
|
+
removeIn: string;
|
|
259
|
+
/** Removed prop name (used by `prepareProps` to detect stale content + log) */
|
|
260
|
+
prop: string;
|
|
261
|
+
/**
|
|
262
|
+
* Snapshot of the prop's shape at the time of removal. Six months
|
|
263
|
+
* after removal a codemod author can read this directly instead of
|
|
264
|
+
* spelunking baseline history. The CI classifier validates that
|
|
265
|
+
* this snapshot matches the baseline shape — drift is rejected by
|
|
266
|
+
* the `propRemovedShapeMismatch` rule.
|
|
267
|
+
*/
|
|
268
|
+
removedShape: RemovedPropShape;
|
|
269
|
+
/** Path under `packages/mdx-codemods/migrations/` to the migration that rewrites stored content */
|
|
270
|
+
codemod: string;
|
|
271
|
+
message: string;
|
|
272
|
+
} | {
|
|
273
|
+
kind: 'propBecameRequired';
|
|
274
|
+
/**
|
|
275
|
+
* SCHEMA_VERSION at which the prop became (or was introduced as)
|
|
276
|
+
* required. Used to satisfy both `propAdded_required` (brand-new
|
|
277
|
+
* required prop) and `propRequiredFlipped` (existing optional →
|
|
278
|
+
* required) classifier rules.
|
|
279
|
+
*/
|
|
280
|
+
since: string;
|
|
281
|
+
/**
|
|
282
|
+
* SCHEMA_VERSION at which the shim's safety-net default stops
|
|
283
|
+
* being injected. Usually == `since` for a one-step rollout, or
|
|
284
|
+
* one major later for a grace period. CI-enforced by
|
|
285
|
+
* `removeInMissed`.
|
|
286
|
+
*/
|
|
287
|
+
removeIn: string;
|
|
288
|
+
/** Prop name (must match a prop in the component's `props[]`) */
|
|
289
|
+
prop: string;
|
|
290
|
+
/** Path under `packages/mdx-codemods/migrations/` to the backfill codemod */
|
|
291
|
+
codemod: string;
|
|
292
|
+
/**
|
|
293
|
+
* Runtime value injected by `prepareProps` when stored content
|
|
294
|
+
* omits the prop (e.g. a legacy article that the codemod hasn't
|
|
295
|
+
* touched yet, or a tenant lagging on `schema_version`). Must be
|
|
296
|
+
* a JSON-serializable value the receiving component can render.
|
|
297
|
+
*/
|
|
298
|
+
defaultValue: unknown;
|
|
299
|
+
message: string;
|
|
300
|
+
} | {
|
|
301
|
+
kind: 'defaultChangeAccepted';
|
|
302
|
+
/** SCHEMA_VERSION at which the default change was accepted */
|
|
303
|
+
since: string;
|
|
304
|
+
/** Prop whose default changed */
|
|
305
|
+
prop: string;
|
|
306
|
+
/** Human-readable explanation of the visual drift, surfaces in release notes */
|
|
307
|
+
message: string;
|
|
308
|
+
} | {
|
|
309
|
+
kind: 'componentStructureChange';
|
|
310
|
+
/** SCHEMA_VERSION at which the structure flipped */
|
|
311
|
+
since: string;
|
|
312
|
+
/**
|
|
313
|
+
* Which structural field flipped — used by the classifier to
|
|
314
|
+
* match the diff. `hasChildren` covers true↔false, `selfClosing`
|
|
315
|
+
* covers true↔false, `both` covers a paired flip in one bump.
|
|
316
|
+
*/
|
|
317
|
+
field: 'hasChildren' | 'selfClosing' | 'both';
|
|
318
|
+
/**
|
|
319
|
+
* Path under `packages/mdx-codemods/migrations/` to the rewrite
|
|
320
|
+
* that converts stored `<X />` ↔ `<X></X>`. Mutually exclusive
|
|
321
|
+
* with `releaseNotesOnly`.
|
|
322
|
+
*/
|
|
323
|
+
codemod?: string;
|
|
324
|
+
/**
|
|
325
|
+
* If true, authors explicitly accept the structural drift and no
|
|
326
|
+
* codemod is required. Use sparingly — stored MDX may stop
|
|
327
|
+
* rendering until articles are re-saved.
|
|
328
|
+
*/
|
|
329
|
+
releaseNotesOnly?: boolean;
|
|
330
|
+
message: string;
|
|
331
|
+
};
|
|
332
|
+
/** Type-guard helpers — used by `prepareProps` and the CI classifier. */
|
|
333
|
+
export declare function isPropRenameEntry(entry: DeprecationEntry): entry is Extract<DeprecationEntry, {
|
|
334
|
+
kind: 'propRename';
|
|
335
|
+
}>;
|
|
336
|
+
export declare function isEnumValueRenameEntry(entry: DeprecationEntry): entry is Extract<DeprecationEntry, {
|
|
337
|
+
kind: 'enumValueRename';
|
|
338
|
+
}>;
|
|
339
|
+
export declare function isPropRemovedEntry(entry: DeprecationEntry): entry is Extract<DeprecationEntry, {
|
|
340
|
+
kind: 'propRemoved';
|
|
341
|
+
}>;
|
|
342
|
+
export declare function isPropBecameRequiredEntry(entry: DeprecationEntry): entry is Extract<DeprecationEntry, {
|
|
343
|
+
kind: 'propBecameRequired';
|
|
344
|
+
}>;
|
|
345
|
+
export declare function isDefaultChangeAcceptedEntry(entry: DeprecationEntry): entry is Extract<DeprecationEntry, {
|
|
346
|
+
kind: 'defaultChangeAccepted';
|
|
347
|
+
}>;
|
|
348
|
+
export declare function isComponentStructureChangeEntry(entry: DeprecationEntry): entry is Extract<DeprecationEntry, {
|
|
349
|
+
kind: 'componentStructureChange';
|
|
350
|
+
}>;
|
|
351
|
+
/**
|
|
352
|
+
* Hand-curated description of one prop on a component.
|
|
353
|
+
*
|
|
354
|
+
* `addedIn` is optional; when omitted, `checkPin()` and the md-editor
|
|
355
|
+
* pin gate treat the prop as having been introduced at the component's
|
|
356
|
+
* `addedIn` (i.e. the prop has always existed on the component). Set
|
|
357
|
+
* `addedIn` explicitly only when the prop was added in a later
|
|
358
|
+
* SCHEMA_VERSION than the component itself.
|
|
359
|
+
*
|
|
360
|
+
* The classifier's `propAdded` rules REQUIRE explicit `addedIn` on any
|
|
361
|
+
* prop that did not exist in the previous baseline — omission of the
|
|
362
|
+
* field for a brand-new prop is rejected to prevent silently bypassing
|
|
363
|
+
* the tenant pin gate.
|
|
364
|
+
*/
|
|
365
|
+
export interface PropMetadata {
|
|
366
|
+
name: string;
|
|
367
|
+
type: string;
|
|
368
|
+
required: boolean;
|
|
369
|
+
default?: string;
|
|
370
|
+
description: string;
|
|
371
|
+
enum?: string[];
|
|
372
|
+
numericRange?: [number, number];
|
|
373
|
+
/**
|
|
374
|
+
* SCHEMA_VERSION at which this prop first appeared on the component.
|
|
375
|
+
* Defaults at lookup time to the parent component's `addedIn`.
|
|
376
|
+
* Immutable — decreasing this value is rejected by the
|
|
377
|
+
* `addedInRegressed` CI rule.
|
|
378
|
+
*/
|
|
379
|
+
addedIn?: string;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Hand-curated description of one MDX component, used by:
|
|
383
|
+
* - MCP `editor_list_mdx_components` tool (agent-facing)
|
|
384
|
+
* - `validateComponent` / `validateMarkdownComponents`
|
|
385
|
+
* - md-editor slash command picker UX
|
|
386
|
+
* - `prepareProps()` render-time shim
|
|
387
|
+
* - `checkPin()` write-time pin enforcement
|
|
388
|
+
*
|
|
389
|
+
* Both `addedIn` and `deprecated` are mandatory for the CI compat
|
|
390
|
+
* classifier — every entry in `componentMetadata` carries them, even
|
|
391
|
+
* if `deprecated` is `[]`. Use `'0.1.0'` for the existing 11
|
|
392
|
+
* components; bump by the rubric in `.claude/skills/mdx-component-versioning/SKILL.md`
|
|
393
|
+
* when a new component lands.
|
|
394
|
+
*/
|
|
395
|
+
export interface ComponentMetadata {
|
|
396
|
+
name: string;
|
|
397
|
+
description: string;
|
|
398
|
+
icon: string;
|
|
399
|
+
/** Component category for slash command grouping (e.g., 'content', 'media', 'code') */
|
|
400
|
+
category?: string;
|
|
401
|
+
aliases: string[];
|
|
402
|
+
props: PropMetadata[];
|
|
403
|
+
hasChildren: boolean;
|
|
404
|
+
selfClosing: boolean;
|
|
405
|
+
defaultProps: string;
|
|
406
|
+
defaultChildren: string;
|
|
407
|
+
example: string;
|
|
408
|
+
/**
|
|
409
|
+
* SCHEMA_VERSION at which this component first appeared. Immutable —
|
|
410
|
+
* decreasing this value is rejected by the `addedInRegressed` CI rule.
|
|
411
|
+
* Existing 11 components are stamped '0.1.0'.
|
|
412
|
+
*/
|
|
413
|
+
addedIn: string;
|
|
414
|
+
/**
|
|
415
|
+
* Schema-version-bearing deprecation entries. Empty array when the
|
|
416
|
+
* component has no soft/hard breaks in flight. Walked by
|
|
417
|
+
* `prepareProps()` at render time and by the CI classifier at
|
|
418
|
+
* compat-check time.
|
|
419
|
+
*/
|
|
420
|
+
deprecated: DeprecationEntry[];
|
|
421
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Types for MDX Components
|
|
3
|
+
*
|
|
4
|
+
* These types are used by both edit and render components.
|
|
5
|
+
*/
|
|
6
|
+
/** Type-guard helpers — used by `prepareProps` and the CI classifier. */
|
|
7
|
+
export function isPropRenameEntry(entry) {
|
|
8
|
+
return entry.kind === 'propRename';
|
|
9
|
+
}
|
|
10
|
+
export function isEnumValueRenameEntry(entry) {
|
|
11
|
+
return entry.kind === 'enumValueRename';
|
|
12
|
+
}
|
|
13
|
+
export function isPropRemovedEntry(entry) {
|
|
14
|
+
return entry.kind === 'propRemoved';
|
|
15
|
+
}
|
|
16
|
+
export function isPropBecameRequiredEntry(entry) {
|
|
17
|
+
return entry.kind === 'propBecameRequired';
|
|
18
|
+
}
|
|
19
|
+
export function isDefaultChangeAcceptedEntry(entry) {
|
|
20
|
+
return entry.kind === 'defaultChangeAccepted';
|
|
21
|
+
}
|
|
22
|
+
export function isComponentStructureChangeEntry(entry) {
|
|
23
|
+
return entry.kind === 'componentStructureChange';
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoWH,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAC/B,KAAuB;IAEvB,OAAO,KAAK,CAAC,IAAI,KAAK,YAAY,CAAA;AACpC,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,KAAuB;IAEvB,OAAO,KAAK,CAAC,IAAI,KAAK,iBAAiB,CAAA;AACzC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,KAAuB;IAEvB,OAAO,KAAK,CAAC,IAAI,KAAK,aAAa,CAAA;AACrC,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAuB;IAEvB,OAAO,KAAK,CAAC,IAAI,KAAK,oBAAoB,CAAA;AAC5C,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,KAAuB;IAEvB,OAAO,KAAK,CAAC,IAAI,KAAK,uBAAuB,CAAA;AAC/C,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,KAAuB;IAEvB,OAAO,KAAK,CAAC,IAAI,KAAK,0BAA0B,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SCHEMA_VERSION — the content-schema generation this build of
|
|
3
|
+
* `@blogmcp/mdx-schema` understands and emits.
|
|
4
|
+
*
|
|
5
|
+
* Distinct from the package version (in package.json) — the package
|
|
6
|
+
* version tracks the library's API surface (a non-breaking JS API tweak
|
|
7
|
+
* might bump the package patch without touching SCHEMA_VERSION; a
|
|
8
|
+
* Tier-2 / Tier-3 component schema change bumps SCHEMA_VERSION MAJOR
|
|
9
|
+
* without necessarily touching the JS API).
|
|
10
|
+
*
|
|
11
|
+
* Bump rubric (full table in `.claude/skills/mdx-component-versioning/SKILL.md`):
|
|
12
|
+
* Tier 0 — non-content edits, JSDoc → no SCHEMA_VERSION change
|
|
13
|
+
* Tier 1 — additive (new opt prop / variant / etc) → MINOR
|
|
14
|
+
* Tier 2 — soft-breaking + shim → MAJOR
|
|
15
|
+
* Tier 3 — hard-breaking + codemod → MAJOR
|
|
16
|
+
*
|
|
17
|
+
* The CI compat test (`test/compat.spec.ts`) enforces these bumps. After
|
|
18
|
+
* any change here, regenerate the baseline:
|
|
19
|
+
*
|
|
20
|
+
* npm run baseline:regen --workspace=@blogmcp/mdx-schema
|
|
21
|
+
*/
|
|
22
|
+
export declare const SCHEMA_VERSION: "0.2.0";
|
|
23
|
+
export type SchemaVersion = typeof SCHEMA_VERSION;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SCHEMA_VERSION — the content-schema generation this build of
|
|
3
|
+
* `@blogmcp/mdx-schema` understands and emits.
|
|
4
|
+
*
|
|
5
|
+
* Distinct from the package version (in package.json) — the package
|
|
6
|
+
* version tracks the library's API surface (a non-breaking JS API tweak
|
|
7
|
+
* might bump the package patch without touching SCHEMA_VERSION; a
|
|
8
|
+
* Tier-2 / Tier-3 component schema change bumps SCHEMA_VERSION MAJOR
|
|
9
|
+
* without necessarily touching the JS API).
|
|
10
|
+
*
|
|
11
|
+
* Bump rubric (full table in `.claude/skills/mdx-component-versioning/SKILL.md`):
|
|
12
|
+
* Tier 0 — non-content edits, JSDoc → no SCHEMA_VERSION change
|
|
13
|
+
* Tier 1 — additive (new opt prop / variant / etc) → MINOR
|
|
14
|
+
* Tier 2 — soft-breaking + shim → MAJOR
|
|
15
|
+
* Tier 3 — hard-breaking + codemod → MAJOR
|
|
16
|
+
*
|
|
17
|
+
* The CI compat test (`test/compat.spec.ts`) enforces these bumps. After
|
|
18
|
+
* any change here, regenerate the baseline:
|
|
19
|
+
*
|
|
20
|
+
* npm run baseline:regen --workspace=@blogmcp/mdx-schema
|
|
21
|
+
*/
|
|
22
|
+
export const SCHEMA_VERSION = '0.2.0';
|
|
23
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,OAAgB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blogmcp/mdx-schema",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Framework-agnostic schema + metadata + parsing for MDX components. Zero framework dependencies — consumed by Vue and React renderer packages.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./src/index.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./types": {
|
|
18
|
+
"types": "./src/types/index.ts",
|
|
19
|
+
"import": "./dist/types/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./metadata": {
|
|
22
|
+
"types": "./src/metadata/index.ts",
|
|
23
|
+
"import": "./dist/metadata/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./metadata/validate": {
|
|
26
|
+
"types": "./src/metadata/validate.ts",
|
|
27
|
+
"import": "./dist/metadata/validate.js"
|
|
28
|
+
},
|
|
29
|
+
"./composables/parsing": {
|
|
30
|
+
"types": "./src/composables/useMdxParsing.ts",
|
|
31
|
+
"import": "./dist/composables/useMdxParsing.js"
|
|
32
|
+
},
|
|
33
|
+
"./styles": {
|
|
34
|
+
"types": "./src/styles/index.ts",
|
|
35
|
+
"import": "./dist/styles/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./version": {
|
|
38
|
+
"types": "./src/version.ts",
|
|
39
|
+
"import": "./dist/version.js"
|
|
40
|
+
},
|
|
41
|
+
"./prepareProps": {
|
|
42
|
+
"types": "./src/prepareProps.ts",
|
|
43
|
+
"import": "./dist/prepareProps.js"
|
|
44
|
+
},
|
|
45
|
+
"./checkPin": {
|
|
46
|
+
"types": "./src/checkPin.ts",
|
|
47
|
+
"import": "./dist/checkPin.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist",
|
|
52
|
+
"src"
|
|
53
|
+
],
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsc -p tsconfig.build.json",
|
|
56
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
57
|
+
"test": "vitest run",
|
|
58
|
+
"test:watch": "vitest",
|
|
59
|
+
"typecheck": "tsc --noEmit",
|
|
60
|
+
"baseline:regen": "tsx scripts/regen-baseline.ts"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"semver": "^7.6.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/node": "^20.10.0",
|
|
67
|
+
"@types/semver": "^7.5.6",
|
|
68
|
+
"@vitest/utils": "3.2.4",
|
|
69
|
+
"tsx": "^4.7.0",
|
|
70
|
+
"typescript": "^5.3.3",
|
|
71
|
+
"vitest": "^3.0.0"
|
|
72
|
+
},
|
|
73
|
+
"keywords": [
|
|
74
|
+
"mdx",
|
|
75
|
+
"schema",
|
|
76
|
+
"metadata",
|
|
77
|
+
"markdown"
|
|
78
|
+
],
|
|
79
|
+
"license": "MIT"
|
|
80
|
+
}
|