cmx-sdk 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/README.md ADDED
@@ -0,0 +1,307 @@
1
+ # cmx-sdk
2
+
3
+ Official SDK for building content-driven websites with CMX (Content Management Experience).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install cmx-sdk
9
+ # or
10
+ pnpm add cmx-sdk
11
+ # or
12
+ yarn add cmx-sdk
13
+ ```
14
+
15
+ ## Features
16
+
17
+ - 🚀 **Type-Safe API Client** - Fetch content from CMX Admin with full TypeScript support
18
+ - 📝 **MDX Components** - Pre-built React components for rich content rendering
19
+ - ⚡ **Next.js Optimized** - Built-in support for ISR, caching, and revalidation
20
+ - 🎨 **Customizable** - Extend with your own components and styles
21
+ - 🔒 **Secure** - Environment-based API key authentication
22
+
23
+ ## Quick Start
24
+
25
+ ### 1. Set up environment variables
26
+
27
+ Create a `.env.local` file:
28
+
29
+ ```env
30
+ CMX_API_URL=https://your-cmx-admin.example.com
31
+ CMX_API_KEY=your_api_key_here
32
+ ```
33
+
34
+ ### 2. Fetch content
35
+
36
+ ```tsx
37
+ import { getCollectionPosts, getCollectionPostDetail } from 'cmx-sdk';
38
+
39
+ // List posts
40
+ export default async function BlogPage() {
41
+ const posts = await getCollectionPosts('blog');
42
+
43
+ return (
44
+ <div>
45
+ {posts.items.map((post) => (
46
+ <article key={post.slug}>
47
+ <h2>{post.title}</h2>
48
+ <p>{post.description}</p>
49
+ </article>
50
+ ))}
51
+ </div>
52
+ );
53
+ }
54
+
55
+ // Get post detail
56
+ export default async function PostPage({ params }: { params: { slug: string } }) {
57
+ const post = await getCollectionPostDetail('blog', params.slug);
58
+
59
+ return (
60
+ <article>
61
+ <h1>{post.title}</h1>
62
+ <MDXRender content={post.mdx} />
63
+ </article>
64
+ );
65
+ }
66
+ ```
67
+
68
+ ### 3. Render MDX content
69
+
70
+ ```tsx
71
+ import { MDXRender, ComponentCatalog } from 'cmx-sdk';
72
+
73
+ export default function PostContent({ mdx }: { mdx: string }) {
74
+ return <MDXRender content={mdx} components={ComponentCatalog} />;
75
+ }
76
+ ```
77
+
78
+ ## API Reference
79
+
80
+ ### Content Fetching
81
+
82
+ ```tsx
83
+ import {
84
+ getCollectionPosts,
85
+ getCollectionPostDetail,
86
+ getDataEntries,
87
+ getDataEntry,
88
+ } from 'cmx-sdk';
89
+
90
+ // Get posts from a collection
91
+ const posts = await getCollectionPosts('blog');
92
+
93
+ // Get a specific post
94
+ const post = await getCollectionPostDetail('blog', 'my-post-slug');
95
+
96
+ // Get data entries
97
+ const entries = await getDataEntries('team-members');
98
+
99
+ // Get a specific data entry
100
+ const entry = await getDataEntry('team-members', '123');
101
+ ```
102
+
103
+ ### MDX Rendering
104
+
105
+ ```tsx
106
+ import { MDXRender, ComponentCatalog } from 'cmx-sdk';
107
+
108
+ // Basic rendering
109
+ <MDXRender content={mdxContent} components={ComponentCatalog} />
110
+
111
+ // With custom components
112
+ import { ComponentCatalog } from 'cmx-sdk';
113
+ import { MyCustomComponent } from './components';
114
+
115
+ const customComponents = {
116
+ ...ComponentCatalog,
117
+ MyCustomComponent,
118
+ };
119
+
120
+ <MDXRender content={mdxContent} components={customComponents} />
121
+ ```
122
+
123
+ ### Cache Tags
124
+
125
+ Use Next.js cache tags for on-demand revalidation:
126
+
127
+ ```tsx
128
+ import { CACHE_TAGS, publicFetchWithTags } from 'cmx-sdk';
129
+
130
+ // Fetch with specific cache tags
131
+ const posts = await publicFetchWithTags(
132
+ '/collections/blog/posts',
133
+ [CACHE_TAGS.collections, CACHE_TAGS.collection('blog')]
134
+ );
135
+
136
+ // Revalidate by tag
137
+ import { revalidateTag } from 'next/cache';
138
+
139
+ revalidateTag(CACHE_TAGS.collection('blog'));
140
+ ```
141
+
142
+ ### Preview Mode
143
+
144
+ ```tsx
145
+ import { getPreviewByToken } from 'cmx-sdk';
146
+
147
+ // Get preview content by token
148
+ const preview = await getPreviewByToken(token);
149
+
150
+ if (preview) {
151
+ return <MDXRender content={preview.post.mdx} />;
152
+ }
153
+ ```
154
+
155
+ ## Components
156
+
157
+ The SDK includes a comprehensive set of MDX components:
158
+
159
+ ### Basic Components
160
+
161
+ - `Alert` - Alert messages with variants
162
+ - `Badge` - Status and label badges
163
+ - `Button` - Interactive buttons
164
+ - `Card` - Content cards
165
+ - `Code` - Syntax-highlighted code blocks
166
+ - `Tabs` - Tabbed content interface
167
+
168
+ ### Custom Components
169
+
170
+ - `Callout` - Highlighted information boxes
171
+ - `Embed` - External content embedding (YouTube, Twitter, etc.)
172
+ - `Accordion` - Collapsible content sections
173
+ - `Steps` - Step-by-step guides
174
+ - `FileTree` - File structure visualization
175
+
176
+ ### Component Catalog
177
+
178
+ Access component metadata and validation:
179
+
180
+ ```tsx
181
+ import {
182
+ getComponentDefinition,
183
+ validateComponentProps,
184
+ getAllComponentDefinitions,
185
+ } from 'cmx-sdk';
186
+
187
+ // Get component definition
188
+ const calloutDef = getComponentDefinition('Callout');
189
+
190
+ // Validate props
191
+ const result = validateComponentProps('Callout', {
192
+ type: 'info',
193
+ title: 'Info',
194
+ children: 'Content',
195
+ });
196
+
197
+ // Get all component definitions
198
+ const allComponents = getAllComponentDefinitions();
199
+ ```
200
+
201
+ ## TypeScript
202
+
203
+ The SDK is fully typed. Import types as needed:
204
+
205
+ ```tsx
206
+ import type {
207
+ CollectionPostsResponse,
208
+ CollectionPostDetailResponse,
209
+ PostListItem,
210
+ PostDetail,
211
+ DataListResponse,
212
+ DataEntryItem,
213
+ PreviewResponse,
214
+ Frontmatter,
215
+ ComponentDefinition,
216
+ } from 'cmx-sdk';
217
+ ```
218
+
219
+ ## Advanced Usage
220
+
221
+ ### Custom API Instance
222
+
223
+ For advanced use cases, you can access the underlying API client:
224
+
225
+ ```tsx
226
+ import 'cmx-sdk/client';
227
+
228
+ // Access all API client functions and utilities
229
+ ```
230
+
231
+ ### Component-Only Import
232
+
233
+ If you only need MDX components:
234
+
235
+ ```tsx
236
+ import 'cmx-sdk/components';
237
+
238
+ // Access all MDX components and utilities
239
+ ```
240
+
241
+ ## Environment Variables
242
+
243
+ | Variable | Description | Required |
244
+ |----------|-------------|----------|
245
+ | `CMX_API_URL` | CMX Admin API base URL | Yes |
246
+ | `CMX_API_KEY` | API key for authentication | Yes |
247
+
248
+ ## Next.js Integration
249
+
250
+ The SDK is optimized for Next.js App Router:
251
+
252
+ ```tsx
253
+ // app/blog/[slug]/page.tsx
254
+ import { getCollectionPostDetail } from 'cmx-sdk';
255
+ import { MDXRender, ComponentCatalog } from 'cmx-sdk';
256
+
257
+ export default async function BlogPost({
258
+ params,
259
+ }: {
260
+ params: { slug: string };
261
+ }) {
262
+ const post = await getCollectionPostDetail('blog', params.slug);
263
+
264
+ return (
265
+ <article>
266
+ <h1>{post.title}</h1>
267
+ <p>{post.description}</p>
268
+ <MDXRender content={post.mdx} components={ComponentCatalog} />
269
+ </article>
270
+ );
271
+ }
272
+
273
+ // Generate static params
274
+ export async function generateStaticParams() {
275
+ const posts = await getCollectionPosts('blog');
276
+ return posts.items.map((post) => ({ slug: post.slug }));
277
+ }
278
+
279
+ // Generate metadata
280
+ export async function generateMetadata({
281
+ params,
282
+ }: {
283
+ params: { slug: string };
284
+ }) {
285
+ const post = await getCollectionPostDetail('blog', params.slug);
286
+
287
+ return {
288
+ title: post.title,
289
+ description: post.description,
290
+ };
291
+ }
292
+ ```
293
+
294
+ ## Examples
295
+
296
+ Check out the [CMX Starter Kit](https://github.com/kzkm-lab/cmx-starter-kit) for a complete example of using the SDK.
297
+
298
+ ## License
299
+
300
+ MIT
301
+
302
+ ## Links
303
+
304
+ - [Documentation](https://github.com/kzkm-lab/cmx)
305
+ - [CMX Starter Kit](https://github.com/kzkm-lab/cmx-starter-kit)
306
+ - [Issues](https://github.com/kzkm-lab/cmx/issues)
307
+ - [Changelog](../../CHANGELOG.md)
@@ -0,0 +1,5 @@
1
+ export { ApiResponse, CACHE_TAGS, PublicFetcherOptions, getPublicApiBaseUrl, getPublicApiToken, publicCustomInstance, publicFetchWithTags, publicFetcher } from '@cmx/api-client/core/public';
2
+ export { getCollectionsSlugPosts, getCollectionsSlugPostsContentSlug, getDataTypeSlug, getGetCollectionsSlugPostsContentSlugUrl, getGetCollectionsSlugPostsUrl, getGetDataTypeSlugUrl, getGetPreviewTokenUrl, getPreviewToken } from '@cmx/api-client/public';
3
+ export * from '@cmx/api-client/public/models';
4
+ export { BlogCard, Button, Callout, Embed, Image, basicComponents, customComponents, markdownComponents, mdxComponents } from '@cmx/mdx/components';
5
+ export { ComponentDefinition, ComponentName, ValidationError, ValidationResult, componentCatalog, componentSchemas, getCatalogForAI, getComponentsByCategory, getComponentsWithReferences, isValidComponent, quickValidateMdx, validateComponentProps, validateMdx } from '@cmx/mdx';
package/dist/index.js ADDED
@@ -0,0 +1,755 @@
1
+ // ../../packages/api-client/dist/core/public-fetcher.js
2
+ function getPublicApiBaseUrl() {
3
+ const adminUrl = process.env.CMX_API_URL;
4
+ if (!adminUrl) {
5
+ throw new Error("CMX_API_URL environment variable is not set");
6
+ }
7
+ return `${adminUrl}/api/v1/public`;
8
+ }
9
+ function getPublicApiToken() {
10
+ const token = process.env.CMX_API_KEY;
11
+ if (!token) {
12
+ throw new Error("CMX_API_KEY environment variable is not set");
13
+ }
14
+ return token;
15
+ }
16
+ async function publicFetcher(path, options) {
17
+ const { token, tags, revalidate } = options;
18
+ const baseUrl = getPublicApiBaseUrl();
19
+ const url = `${baseUrl}${path}`;
20
+ const fetchOptions = {
21
+ method: "GET",
22
+ headers: {
23
+ "Content-Type": "application/json",
24
+ Authorization: `Bearer ${token}`
25
+ },
26
+ next: Object.assign({ tags: tags || [] }, revalidate !== void 0 && { revalidate })
27
+ };
28
+ const response = await fetch(url, fetchOptions);
29
+ if (!response.ok) {
30
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
31
+ throw new Error(error.error || `API error: ${response.status}`);
32
+ }
33
+ return response.json();
34
+ }
35
+ async function publicCustomInstance(url, options) {
36
+ const token = getPublicApiToken();
37
+ const baseUrl = getPublicApiBaseUrl();
38
+ const fullUrl = url.startsWith("http") ? url : `${baseUrl}${url}`;
39
+ const response = await fetch(fullUrl, Object.assign(Object.assign({}, options), { headers: Object.assign({ "Content-Type": "application/json", Authorization: `Bearer ${token}` }, options === null || options === void 0 ? void 0 : options.headers) }));
40
+ if (!response.ok) {
41
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
42
+ throw new Error(error.error || `API error: ${response.status}`);
43
+ }
44
+ return response.json();
45
+ }
46
+ async function publicFetchWithTags(path, tags, revalidate) {
47
+ const token = getPublicApiToken();
48
+ const baseUrl = getPublicApiBaseUrl();
49
+ const url = `${baseUrl}${path}`;
50
+ const fetchOptions = {
51
+ method: "GET",
52
+ headers: {
53
+ "Content-Type": "application/json",
54
+ Authorization: `Bearer ${token}`
55
+ },
56
+ next: Object.assign({ tags: tags || [] }, revalidate !== void 0 && { revalidate })
57
+ };
58
+ const response = await fetch(url, fetchOptions);
59
+ if (!response.ok) {
60
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
61
+ throw new Error(error.error || `API error: ${response.status}`);
62
+ }
63
+ return response.json();
64
+ }
65
+
66
+ // ../../packages/api-client/dist/core/cache-tags.js
67
+ var CACHE_TAGS = {
68
+ /** 全コレクション共通 */
69
+ collections: "collections",
70
+ /** 特定コレクション */
71
+ collection: (slug) => `collection:${slug}`,
72
+ /** 特定記事 */
73
+ post: (collectionSlug, postSlug) => `post:${collectionSlug}:${postSlug}`,
74
+ /** 全データタイプ共通 */
75
+ data: "data",
76
+ /** 特定データタイプ */
77
+ dataType: (slug) => `data:${slug}`
78
+ };
79
+
80
+ // ../../packages/api-client/dist/core/date-reviver.js
81
+ var isoDateFormat = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/;
82
+ function dateReviver(_key, value) {
83
+ if (typeof value === "string" && isoDateFormat.test(value)) {
84
+ return new Date(value);
85
+ }
86
+ return value;
87
+ }
88
+
89
+ // ../../packages/api-client/dist/generated/public/endpoints/public.js
90
+ var getGetCollectionsSlugPostsUrl = (slug) => {
91
+ return `/api/v1/public/collections/${slug}/posts`;
92
+ };
93
+ var getCollectionsSlugPosts = async (slug, options) => {
94
+ const res = await fetch(getGetCollectionsSlugPostsUrl(slug), Object.assign(Object.assign({}, options), { method: "GET" }));
95
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
96
+ const data = body ? JSON.parse(body, dateReviver) : {};
97
+ return { data, status: res.status, headers: res.headers };
98
+ };
99
+ var getGetCollectionsSlugPostsContentSlugUrl = (slug, contentSlug) => {
100
+ return `/api/v1/public/collections/${slug}/posts/${contentSlug}`;
101
+ };
102
+ var getCollectionsSlugPostsContentSlug = async (slug, contentSlug, options) => {
103
+ const res = await fetch(getGetCollectionsSlugPostsContentSlugUrl(slug, contentSlug), Object.assign(Object.assign({}, options), { method: "GET" }));
104
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
105
+ const data = body ? JSON.parse(body, dateReviver) : {};
106
+ return { data, status: res.status, headers: res.headers };
107
+ };
108
+ var getGetDataTypeSlugUrl = (typeSlug, params) => {
109
+ const normalizedParams = new URLSearchParams();
110
+ Object.entries(params || {}).forEach(([key, value]) => {
111
+ if (value !== void 0) {
112
+ normalizedParams.append(key, value === null ? "null" : value.toString());
113
+ }
114
+ });
115
+ const stringifiedParams = normalizedParams.toString();
116
+ return stringifiedParams.length > 0 ? `/api/v1/public/data/${typeSlug}?${stringifiedParams}` : `/api/v1/public/data/${typeSlug}`;
117
+ };
118
+ var getDataTypeSlug = async (typeSlug, params, options) => {
119
+ const res = await fetch(getGetDataTypeSlugUrl(typeSlug, params), Object.assign(Object.assign({}, options), { method: "GET" }));
120
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
121
+ const data = body ? JSON.parse(body, dateReviver) : {};
122
+ return { data, status: res.status, headers: res.headers };
123
+ };
124
+ var getGetPreviewTokenUrl = (token) => {
125
+ return `/api/v1/public/preview/${token}`;
126
+ };
127
+ var getPreviewToken = async (token, options) => {
128
+ const res = await fetch(getGetPreviewTokenUrl(token), Object.assign(Object.assign({}, options), { method: "GET" }));
129
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
130
+ const data = body ? JSON.parse(body, dateReviver) : {};
131
+ return { data, status: res.status, headers: res.headers };
132
+ };
133
+
134
+ // ../../packages/mdx/dist/components/basic/Callout.js
135
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
136
+ import { AlertCircle, AlertTriangle, CheckCircle, Info, Lightbulb } from "lucide-react";
137
+ var icons = {
138
+ info: Info,
139
+ warning: AlertTriangle,
140
+ error: AlertCircle,
141
+ success: CheckCircle,
142
+ tip: Lightbulb
143
+ };
144
+ var styles = {
145
+ info: "cmx-mdx__callout--info bg-blue-50 border-blue-200 text-blue-800",
146
+ warning: "cmx-mdx__callout--warning bg-yellow-50 border-yellow-200 text-yellow-800",
147
+ error: "cmx-mdx__callout--error bg-red-50 border-red-200 text-red-800",
148
+ success: "cmx-mdx__callout--success bg-green-50 border-green-200 text-green-800",
149
+ tip: "cmx-mdx__callout--tip bg-purple-50 border-purple-200 text-purple-800"
150
+ };
151
+ var iconColors = {
152
+ info: "text-blue-500",
153
+ warning: "text-yellow-500",
154
+ error: "text-red-500",
155
+ success: "text-green-500",
156
+ tip: "text-purple-500"
157
+ };
158
+ function Callout({ type = "info", title, children }) {
159
+ const Icon = icons[type];
160
+ return _jsx("div", { className: `cmx-mdx__callout my-4 p-4 border rounded-lg ${styles[type]}`, children: _jsxs("div", { className: "cmx-mdx__callout-content flex gap-3", children: [_jsx(Icon, { className: `cmx-mdx__callout-icon w-5 h-5 flex-shrink-0 mt-0.5 ${iconColors[type]}` }), _jsxs("div", { className: "cmx-mdx__callout-body flex-1", children: [title && _jsx("p", { className: "cmx-mdx__callout-title font-semibold mb-1", children: title }), _jsx("div", { className: "cmx-mdx__callout-text text-sm", children })] })] }) });
161
+ }
162
+
163
+ // ../../packages/mdx/dist/components/basic/Embed.js
164
+ import { jsx as _jsx2, jsxs as _jsxs2 } from "react/jsx-runtime";
165
+ function extractYouTubeId(url) {
166
+ const patterns = [
167
+ /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([^&\n?#]+)/
168
+ ];
169
+ for (const pattern of patterns) {
170
+ const match = url.match(pattern);
171
+ if (match)
172
+ return match[1];
173
+ }
174
+ return null;
175
+ }
176
+ function Embed({ url, type = "generic" }) {
177
+ if (type === "youtube") {
178
+ const videoId = extractYouTubeId(url);
179
+ if (videoId) {
180
+ return _jsx2("div", { className: "cmx-mdx__embed cmx-mdx__embed--youtube my-4 aspect-video", children: _jsx2("iframe", { src: `https://www.youtube.com/embed/${videoId}`, className: "cmx-mdx__embed-iframe w-full h-full rounded-lg", allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true }) });
181
+ }
182
+ }
183
+ if (type === "twitter") {
184
+ return _jsxs2("div", { className: "cmx-mdx__embed cmx-mdx__embed--twitter my-4 border border-gray-200 rounded-lg p-4 bg-gray-50", children: [_jsx2("p", { className: "cmx-mdx__embed-label text-sm text-gray-500", children: "Twitter\u57CB\u3081\u8FBC\u307F" }), _jsx2("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "cmx-mdx__embed-link text-blue-500 hover:underline text-sm", children: url })] });
185
+ }
186
+ return _jsx2("div", { className: "cmx-mdx__embed cmx-mdx__embed--generic my-4 aspect-video", children: _jsx2("iframe", { src: url, className: "cmx-mdx__embed-iframe w-full h-full rounded-lg border border-gray-200", allowFullScreen: true }) });
187
+ }
188
+
189
+ // ../../packages/mdx/dist/components/basic/Button.js
190
+ import { jsx as _jsx3 } from "react/jsx-runtime";
191
+ import Link from "next/link";
192
+ var variants = {
193
+ primary: "cmx-mdx__button--primary bg-blue-600 text-white hover:bg-blue-700",
194
+ secondary: "cmx-mdx__button--secondary bg-gray-600 text-white hover:bg-gray-700",
195
+ outline: "cmx-mdx__button--outline border border-gray-300 text-gray-700 hover:bg-gray-50"
196
+ };
197
+ function Button({ href, children, variant = "primary" }) {
198
+ const isExternal = href.startsWith("http");
199
+ const className = `cmx-mdx__button inline-block px-4 py-2 rounded-lg font-medium transition-colors ${variants[variant]}`;
200
+ if (isExternal) {
201
+ return _jsx3("a", { href, target: "_blank", rel: "noopener noreferrer", className, children });
202
+ }
203
+ return _jsx3(Link, { href, className, children });
204
+ }
205
+
206
+ // ../../packages/mdx/dist/components/basic/index.js
207
+ var basicComponents = {
208
+ Callout,
209
+ Embed,
210
+ Button
211
+ };
212
+
213
+ // ../../packages/mdx/dist/components/custom/BlogCard.js
214
+ import { jsxs as _jsxs3, jsx as _jsx4 } from "react/jsx-runtime";
215
+ import Link2 from "next/link";
216
+ function BlogCard({ postId, title, slug, excerpt }) {
217
+ if (!title || !slug) {
218
+ return _jsx4("div", { className: "border border-dashed border-gray-300 rounded-lg p-4 bg-gray-50", children: _jsxs3("p", { className: "text-sm text-gray-500", children: ["\u8A18\u4E8B\u30AB\u30FC\u30C9: ", postId] }) });
219
+ }
220
+ return _jsxs3(Link2, { href: `/${slug}`, className: "block border border-gray-200 rounded-lg p-4 hover:border-blue-400 hover:shadow-md transition-all", children: [_jsx4("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: title }), excerpt && _jsx4("p", { className: "text-sm text-gray-600 line-clamp-2", children: excerpt })] });
221
+ }
222
+
223
+ // ../../packages/mdx/dist/components/custom/Image.js
224
+ import { jsxs as _jsxs4, jsx as _jsx5 } from "react/jsx-runtime";
225
+ import NextImage from "next/image";
226
+ function Image({ assetId, alt = "", size = "large", caption, url, width, height }) {
227
+ if (!url) {
228
+ return _jsxs4("figure", { className: "my-4", children: [_jsxs4("div", { className: "border border-dashed border-gray-300 rounded-lg p-8 bg-gray-50 text-center", children: [_jsxs4("p", { className: "text-sm text-gray-500", children: ["\u753B\u50CF: ", assetId] }), _jsxs4("p", { className: "text-xs text-gray-400", children: ["\u30B5\u30A4\u30BA: ", size] })] }), caption && _jsx5("figcaption", { className: "mt-2 text-sm text-gray-500 text-center", children: caption })] });
229
+ }
230
+ return _jsxs4("figure", { className: "my-4", children: [_jsx5(NextImage, { src: url, alt, width: width || 800, height: height || 600, className: "rounded-lg" }), caption && _jsx5("figcaption", { className: "mt-2 text-sm text-gray-500 text-center", children: caption })] });
231
+ }
232
+
233
+ // ../../packages/mdx/dist/components/custom/index.js
234
+ var customComponents = {
235
+ BlogCard,
236
+ Image
237
+ };
238
+
239
+ // ../../packages/mdx/dist/components/markdown/index.js
240
+ import { jsx as _jsx6 } from "react/jsx-runtime";
241
+ var __rest = function(s, e) {
242
+ var t = {};
243
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
244
+ t[p] = s[p];
245
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
246
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
247
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
248
+ t[p[i]] = s[p[i]];
249
+ }
250
+ return t;
251
+ };
252
+ var mdxH1 = (_a) => {
253
+ var { children } = _a, props = __rest(_a, ["children"]);
254
+ return _jsx6("h1", Object.assign({ className: "text-4xl font-bold mt-8 mb-4" }, props, { children }));
255
+ };
256
+ var mdxH2 = (_a) => {
257
+ var { children } = _a, props = __rest(_a, ["children"]);
258
+ return _jsx6("h2", Object.assign({ className: "text-3xl font-bold mt-6 mb-3" }, props, { children }));
259
+ };
260
+ var mdxH3 = (_a) => {
261
+ var { children } = _a, props = __rest(_a, ["children"]);
262
+ return _jsx6("h3", Object.assign({ className: "text-2xl font-semibold mt-4 mb-2" }, props, { children }));
263
+ };
264
+ var mdxH4 = (_a) => {
265
+ var { children } = _a, props = __rest(_a, ["children"]);
266
+ return _jsx6("h4", Object.assign({ className: "text-xl font-semibold mt-3 mb-2" }, props, { children }));
267
+ };
268
+ var mdxH5 = (_a) => {
269
+ var { children } = _a, props = __rest(_a, ["children"]);
270
+ return _jsx6("h5", Object.assign({ className: "text-lg font-medium mt-2 mb-1" }, props, { children }));
271
+ };
272
+ var mdxH6 = (_a) => {
273
+ var { children } = _a, props = __rest(_a, ["children"]);
274
+ return _jsx6("h6", Object.assign({ className: "text-base font-medium mt-2 mb-1" }, props, { children }));
275
+ };
276
+ var mdxP = (_a) => {
277
+ var { children } = _a, props = __rest(_a, ["children"]);
278
+ return _jsx6("p", Object.assign({ className: "my-4 leading-7" }, props, { children }));
279
+ };
280
+ var mdxUl = (_a) => {
281
+ var { children } = _a, props = __rest(_a, ["children"]);
282
+ return _jsx6("ul", Object.assign({ className: "my-4 pl-6 list-disc" }, props, { children }));
283
+ };
284
+ var mdxOl = (_a) => {
285
+ var { children } = _a, props = __rest(_a, ["children"]);
286
+ return _jsx6("ol", Object.assign({ className: "my-4 pl-6 list-decimal" }, props, { children }));
287
+ };
288
+ var mdxLi = (_a) => {
289
+ var { children } = _a, props = __rest(_a, ["children"]);
290
+ return _jsx6("li", Object.assign({ className: "my-1" }, props, { children }));
291
+ };
292
+ var mdxBlockquote = (_a) => {
293
+ var { children } = _a, props = __rest(_a, ["children"]);
294
+ return _jsx6("blockquote", Object.assign({ className: "border-l-4 border-primary pl-4 italic my-4" }, props, { children }));
295
+ };
296
+ var mdxPre = (_a) => {
297
+ var { children } = _a, props = __rest(_a, ["children"]);
298
+ return _jsx6("pre", Object.assign({ className: "overflow-x-auto rounded-lg bg-slate-900 p-4 text-sm my-4" }, props, { children }));
299
+ };
300
+ var mdxCode = (_a) => {
301
+ var { children } = _a, props = __rest(_a, ["children"]);
302
+ return _jsx6("code", Object.assign({ className: "bg-muted px-1.5 py-0.5 rounded text-sm font-mono" }, props, { children }));
303
+ };
304
+ var mdxHr = () => _jsx6("hr", { className: "my-8 border-t border-border" });
305
+ var mdxA = (_a) => {
306
+ var { children, href } = _a, props = __rest(_a, ["children", "href"]);
307
+ return _jsx6("a", Object.assign({ href, className: "text-primary underline underline-offset-4 hover:text-primary/80", target: (href === null || href === void 0 ? void 0 : href.startsWith("http")) ? "_blank" : void 0, rel: (href === null || href === void 0 ? void 0 : href.startsWith("http")) ? "noopener noreferrer" : void 0 }, props, { children }));
308
+ };
309
+ var mdxImg = (_a) => {
310
+ var { src, alt } = _a, props = __rest(_a, ["src", "alt"]);
311
+ return (
312
+ // eslint-disable-next-line @next/next/no-img-element
313
+ _jsx6("img", Object.assign({ src, alt: alt || "", className: "max-w-full h-auto rounded-lg my-4" }, props))
314
+ );
315
+ };
316
+ var mdxStrong = (_a) => {
317
+ var { children } = _a, props = __rest(_a, ["children"]);
318
+ return _jsx6("strong", Object.assign({ className: "font-bold" }, props, { children }));
319
+ };
320
+ var mdxEm = (_a) => {
321
+ var { children } = _a, props = __rest(_a, ["children"]);
322
+ return _jsx6("em", Object.assign({ className: "italic" }, props, { children }));
323
+ };
324
+ var mdxTable = (_a) => {
325
+ var { children } = _a, props = __rest(_a, ["children"]);
326
+ return _jsx6("div", { className: "my-4 overflow-x-auto", children: _jsx6("table", Object.assign({ className: "min-w-full border-collapse border border-border" }, props, { children })) });
327
+ };
328
+ var mdxThead = (_a) => {
329
+ var { children } = _a, props = __rest(_a, ["children"]);
330
+ return _jsx6("thead", Object.assign({ className: "bg-muted" }, props, { children }));
331
+ };
332
+ var mdxTbody = (_a) => {
333
+ var { children } = _a, props = __rest(_a, ["children"]);
334
+ return _jsx6("tbody", Object.assign({}, props, { children }));
335
+ };
336
+ var mdxTr = (_a) => {
337
+ var { children } = _a, props = __rest(_a, ["children"]);
338
+ return _jsx6("tr", Object.assign({ className: "border-b border-border" }, props, { children }));
339
+ };
340
+ var mdxTh = (_a) => {
341
+ var { children } = _a, props = __rest(_a, ["children"]);
342
+ return _jsx6("th", Object.assign({ className: "px-4 py-2 text-left font-semibold border border-border" }, props, { children }));
343
+ };
344
+ var mdxTd = (_a) => {
345
+ var { children } = _a, props = __rest(_a, ["children"]);
346
+ return _jsx6("td", Object.assign({ className: "px-4 py-2 border border-border" }, props, { children }));
347
+ };
348
+ var markdownComponents = {
349
+ h1: mdxH1,
350
+ h2: mdxH2,
351
+ h3: mdxH3,
352
+ h4: mdxH4,
353
+ h5: mdxH5,
354
+ h6: mdxH6,
355
+ p: mdxP,
356
+ ul: mdxUl,
357
+ ol: mdxOl,
358
+ li: mdxLi,
359
+ blockquote: mdxBlockquote,
360
+ pre: mdxPre,
361
+ code: mdxCode,
362
+ hr: mdxHr,
363
+ a: mdxA,
364
+ img: mdxImg,
365
+ strong: mdxStrong,
366
+ em: mdxEm,
367
+ table: mdxTable,
368
+ thead: mdxThead,
369
+ tbody: mdxTbody,
370
+ tr: mdxTr,
371
+ th: mdxTh,
372
+ td: mdxTd
373
+ };
374
+
375
+ // ../../packages/mdx/dist/components/index.js
376
+ var mdxComponents = Object.assign(Object.assign(Object.assign({}, markdownComponents), basicComponents), customComponents);
377
+
378
+ // ../../packages/mdx/dist/component-catalog.js
379
+ import { z } from "zod";
380
+ var componentSchemas = {
381
+ // BlogCard: 他記事への参照
382
+ BlogCard: z.object({
383
+ postId: z.string().uuid().describe("\u53C2\u7167\u5148\u8A18\u4E8B\u306EUUID")
384
+ }),
385
+ // Image: 画像表示
386
+ Image: z.object({
387
+ assetId: z.string().uuid().describe("\u30A2\u30BB\u30C3\u30C8\u306EUUID"),
388
+ alt: z.string().optional().describe("\u4EE3\u66FF\u30C6\u30AD\u30B9\u30C8"),
389
+ size: z.enum(["thumbnail", "medium", "large", "original"]).default("large").describe("\u8868\u793A\u30B5\u30A4\u30BA"),
390
+ caption: z.string().optional().describe("\u30AD\u30E3\u30D7\u30B7\u30E7\u30F3")
391
+ }),
392
+ // Callout: 注意書きボックス
393
+ Callout: z.object({
394
+ type: z.enum(["info", "warning", "error", "success", "tip"]).default("info").describe("\u30BF\u30A4\u30D7"),
395
+ title: z.string().optional().describe("\u30BF\u30A4\u30C8\u30EB"),
396
+ children: z.string().describe("\u672C\u6587\uFF08Markdown\u53EF\uFF09")
397
+ }),
398
+ // Embed: 外部埋め込み
399
+ Embed: z.object({
400
+ url: z.string().url().describe("\u57CB\u3081\u8FBC\u307FURL"),
401
+ type: z.enum(["youtube", "twitter", "generic"]).default("generic").describe("\u30BF\u30A4\u30D7")
402
+ }),
403
+ // Button: ボタンリンク
404
+ Button: z.object({
405
+ href: z.string().describe("\u30EA\u30F3\u30AF\u5148URL"),
406
+ children: z.string().describe("\u30DC\u30BF\u30F3\u30C6\u30AD\u30B9\u30C8"),
407
+ variant: z.enum(["primary", "secondary", "outline"]).default("primary").describe("\u30B9\u30BF\u30A4\u30EB")
408
+ })
409
+ };
410
+ var componentCatalog = {
411
+ BlogCard: {
412
+ name: "BlogCard",
413
+ displayName: "\u8A18\u4E8B\u30AB\u30FC\u30C9",
414
+ description: "\u4ED6\u306E\u8A18\u4E8B\u3078\u306E\u30EA\u30F3\u30AF\u30AB\u30FC\u30C9\u3092\u8868\u793A\u3057\u307E\u3059",
415
+ category: "reference",
416
+ schema: componentSchemas.BlogCard,
417
+ examples: ['<BlogCard postId="123e4567-e89b-12d3-a456-426614174000" />'],
418
+ hasReferences: true
419
+ },
420
+ Image: {
421
+ name: "Image",
422
+ displayName: "\u753B\u50CF",
423
+ description: "\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u6E08\u307F\u753B\u50CF\u3092\u8868\u793A\u3057\u307E\u3059",
424
+ category: "media",
425
+ schema: componentSchemas.Image,
426
+ examples: [
427
+ '<Image assetId="123e4567-e89b-12d3-a456-426614174000" alt="\u8AAC\u660E" />',
428
+ '<Image assetId="123e4567-e89b-12d3-a456-426614174000" size="medium" caption="\u30AD\u30E3\u30D7\u30B7\u30E7\u30F3" />'
429
+ ],
430
+ hasReferences: true
431
+ },
432
+ Callout: {
433
+ name: "Callout",
434
+ displayName: "\u30B3\u30FC\u30EB\u30A2\u30A6\u30C8",
435
+ description: "\u6CE8\u610F\u66F8\u304D\u3084\u88DC\u8DB3\u60C5\u5831\u3092\u76EE\u7ACB\u305F\u305B\u308B\u30DC\u30C3\u30AF\u30B9",
436
+ category: "content",
437
+ schema: componentSchemas.Callout,
438
+ examples: [
439
+ '<Callout type="info">\u3053\u308C\u306F\u60C5\u5831\u3067\u3059</Callout>',
440
+ '<Callout type="warning" title="\u6CE8\u610F">\u91CD\u8981\u306A\u6CE8\u610F\u4E8B\u9805\u3067\u3059</Callout>'
441
+ ],
442
+ hasReferences: false
443
+ },
444
+ Embed: {
445
+ name: "Embed",
446
+ displayName: "\u57CB\u3081\u8FBC\u307F",
447
+ description: "YouTube\u52D5\u753B\u3084\u30C4\u30A4\u30FC\u30C8\u3092\u57CB\u3081\u8FBC\u307F\u307E\u3059",
448
+ category: "media",
449
+ schema: componentSchemas.Embed,
450
+ examples: [
451
+ '<Embed url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" type="youtube" />',
452
+ '<Embed url="https://twitter.com/example/status/123456789" type="twitter" />'
453
+ ],
454
+ hasReferences: false
455
+ },
456
+ Button: {
457
+ name: "Button",
458
+ displayName: "\u30DC\u30BF\u30F3",
459
+ description: "\u30A2\u30AF\u30B7\u30E7\u30F3\u3092\u4FC3\u3059\u30DC\u30BF\u30F3\u30EA\u30F3\u30AF",
460
+ category: "content",
461
+ schema: componentSchemas.Button,
462
+ examples: [
463
+ '<Button href="/contact">\u304A\u554F\u3044\u5408\u308F\u305B</Button>',
464
+ '<Button href="https://example.com" variant="secondary">\u8A73\u7D30\u3092\u898B\u308B</Button>'
465
+ ],
466
+ hasReferences: false
467
+ }
468
+ };
469
+ function isValidComponent(name) {
470
+ return name in componentCatalog;
471
+ }
472
+ function validateComponentProps(name, props) {
473
+ const schema = componentSchemas[name];
474
+ const result = schema.safeParse(props);
475
+ if (result.success) {
476
+ return { success: true, data: result.data };
477
+ }
478
+ return { success: false, error: result.error };
479
+ }
480
+ function getComponentsWithReferences() {
481
+ return Object.keys(componentCatalog).filter((name) => componentCatalog[name].hasReferences);
482
+ }
483
+ function getComponentsByCategory() {
484
+ const grouped = {};
485
+ for (const def of Object.values(componentCatalog)) {
486
+ if (!grouped[def.category]) {
487
+ grouped[def.category] = [];
488
+ }
489
+ grouped[def.category].push(def);
490
+ }
491
+ return grouped;
492
+ }
493
+ function getCatalogForAI() {
494
+ return Object.values(componentCatalog).map((def) => {
495
+ const shape = def.schema.shape;
496
+ const props = {};
497
+ for (const [key, zodType] of Object.entries(shape)) {
498
+ const isOptional = zodType.isOptional();
499
+ props[key] = {
500
+ type: getZodTypeName(zodType),
501
+ description: zodType.description,
502
+ required: !isOptional
503
+ };
504
+ }
505
+ return {
506
+ name: def.name,
507
+ description: def.description,
508
+ props,
509
+ examples: def.examples
510
+ };
511
+ });
512
+ }
513
+ function getZodTypeName(zodType) {
514
+ var _a, _b, _c, _d, _e;
515
+ const typeDef = (_b = (_a = zodType._zod) === null || _a === void 0 ? void 0 : _a.def) !== null && _b !== void 0 ? _b : zodType._def;
516
+ if (!typeDef)
517
+ return "unknown";
518
+ const typeName = (_c = typeDef.type) !== null && _c !== void 0 ? _c : typeDef.typeName;
519
+ switch (typeName) {
520
+ case "string":
521
+ case "ZodString":
522
+ return "string";
523
+ case "number":
524
+ case "ZodNumber":
525
+ return "number";
526
+ case "boolean":
527
+ case "ZodBoolean":
528
+ return "boolean";
529
+ case "enum":
530
+ case "ZodEnum":
531
+ return `enum(${(_e = (_d = typeDef.values) === null || _d === void 0 ? void 0 : _d.join("|")) !== null && _e !== void 0 ? _e : ""})`;
532
+ case "array":
533
+ case "ZodArray":
534
+ return "array";
535
+ case "optional":
536
+ case "ZodOptional":
537
+ return typeDef.innerType ? getZodTypeName(typeDef.innerType) : "unknown";
538
+ case "default":
539
+ case "ZodDefault":
540
+ return typeDef.innerType ? getZodTypeName(typeDef.innerType) : "unknown";
541
+ default:
542
+ return "unknown";
543
+ }
544
+ }
545
+
546
+ // ../../packages/mdx/dist/validator.js
547
+ import { compile } from "@mdx-js/mdx";
548
+ var FORBIDDEN_PATTERNS = [
549
+ // import/export statements
550
+ { pattern: /^\s*import\s+/m, message: "import\u6587\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" },
551
+ { pattern: /^\s*export\s+/m, message: "export\u6587\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" },
552
+ // JS expressions in curly braces (except component props)
553
+ { pattern: /\{[^}]*(?:=>|function|new\s+|typeof|instanceof)[^}]*\}/m, message: "JavaScript\u5F0F\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" },
554
+ // eval, Function constructor
555
+ { pattern: /\beval\s*\(/m, message: "eval\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" },
556
+ { pattern: /\bnew\s+Function\s*\(/m, message: "Function constructor\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" },
557
+ // script tags
558
+ { pattern: /<script[\s>]/i, message: "script\u30BF\u30B0\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" },
559
+ // on* event handlers
560
+ { pattern: /\bon\w+\s*=/i, message: "\u30A4\u30D9\u30F3\u30C8\u30CF\u30F3\u30C9\u30E9\u5C5E\u6027\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" },
561
+ // javascript: URLs
562
+ { pattern: /javascript\s*:/i, message: "javascript: URL\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" },
563
+ // data: URLs (for images - can be XSS vector)
564
+ { pattern: /src\s*=\s*["']?\s*data:/i, message: "data: URL\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093" }
565
+ ];
566
+ function extractComponents(mdx) {
567
+ const components = [];
568
+ const lines = mdx.split("\n");
569
+ const componentPattern = /<([A-Z][a-zA-Z0-9]*)\s*([^>]*?)\s*\/?>/g;
570
+ for (let i = 0; i < lines.length; i++) {
571
+ const line = lines[i];
572
+ let match;
573
+ while ((match = componentPattern.exec(line)) !== null) {
574
+ const name = match[1];
575
+ const propsString = match[2];
576
+ const props = parseProps(propsString);
577
+ components.push({
578
+ name,
579
+ props,
580
+ line: i + 1
581
+ });
582
+ }
583
+ }
584
+ return components;
585
+ }
586
+ function parseProps(propsString) {
587
+ var _a;
588
+ const props = {};
589
+ const propPattern = /(\w+)\s*=\s*(?:"([^"]*)"|'([^']*)'|\{([^}]*)\})/g;
590
+ let match;
591
+ while ((match = propPattern.exec(propsString)) !== null) {
592
+ const key = match[1];
593
+ const stringValue = (_a = match[2]) !== null && _a !== void 0 ? _a : match[3];
594
+ const expressionValue = match[4];
595
+ if (stringValue !== void 0) {
596
+ props[key] = stringValue;
597
+ } else if (expressionValue !== void 0) {
598
+ const trimmed = expressionValue.trim();
599
+ if (trimmed === "true") {
600
+ props[key] = true;
601
+ } else if (trimmed === "false") {
602
+ props[key] = false;
603
+ } else if (/^\d+$/.test(trimmed)) {
604
+ props[key] = parseInt(trimmed, 10);
605
+ } else if (/^\d+\.\d+$/.test(trimmed)) {
606
+ props[key] = parseFloat(trimmed);
607
+ } else if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
608
+ try {
609
+ props[key] = JSON.parse(trimmed.replace(/'/g, '"'));
610
+ } catch (_b) {
611
+ props[key] = trimmed;
612
+ }
613
+ } else {
614
+ props[key] = trimmed;
615
+ }
616
+ }
617
+ }
618
+ const booleanPattern = /(?:^|\s)(\w+)(?=\s|\/|>|$)/g;
619
+ while ((match = booleanPattern.exec(propsString)) !== null) {
620
+ const key = match[1];
621
+ if (!(key in props)) {
622
+ props[key] = true;
623
+ }
624
+ }
625
+ return props;
626
+ }
627
+ function extractReferences(components) {
628
+ const postIds = [];
629
+ const assetIds = [];
630
+ for (const component of components) {
631
+ if (component.name === "BlogCard" && typeof component.props.postId === "string") {
632
+ postIds.push(component.props.postId);
633
+ }
634
+ if (component.name === "Image" && typeof component.props.assetId === "string") {
635
+ assetIds.push(component.props.assetId);
636
+ }
637
+ }
638
+ return {
639
+ postIds: [...new Set(postIds)],
640
+ assetIds: [...new Set(assetIds)]
641
+ };
642
+ }
643
+ async function validateMdx(mdx) {
644
+ const errors = [];
645
+ const warnings = [];
646
+ for (const { pattern, message } of FORBIDDEN_PATTERNS) {
647
+ if (pattern.test(mdx)) {
648
+ const lines = mdx.split("\n");
649
+ for (let i = 0; i < lines.length; i++) {
650
+ if (pattern.test(lines[i])) {
651
+ errors.push({
652
+ type: "forbidden",
653
+ message,
654
+ line: i + 1
655
+ });
656
+ break;
657
+ }
658
+ }
659
+ }
660
+ }
661
+ try {
662
+ await compile(mdx, {
663
+ development: false
664
+ // Minimal compilation to check syntax
665
+ });
666
+ } catch (error) {
667
+ const err = error;
668
+ errors.push({
669
+ type: "syntax",
670
+ message: err.message,
671
+ line: err.line,
672
+ column: err.column
673
+ });
674
+ }
675
+ const components = extractComponents(mdx);
676
+ for (const component of components) {
677
+ if (!isValidComponent(component.name)) {
678
+ errors.push({
679
+ type: "component",
680
+ message: `\u672A\u77E5\u306E\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8: ${component.name}`,
681
+ line: component.line,
682
+ component: component.name
683
+ });
684
+ continue;
685
+ }
686
+ const result = validateComponentProps(component.name, component.props);
687
+ if (!result.success) {
688
+ for (const issue of result.error.issues) {
689
+ errors.push({
690
+ type: "props",
691
+ message: `${component.name}: ${issue.path.join(".")} - ${issue.message}`,
692
+ line: component.line,
693
+ component: component.name
694
+ });
695
+ }
696
+ }
697
+ }
698
+ const references = extractReferences(components);
699
+ return {
700
+ valid: errors.length === 0,
701
+ errors,
702
+ warnings,
703
+ references
704
+ };
705
+ }
706
+ function quickValidateMdx(mdx) {
707
+ const errors = [];
708
+ for (const { pattern, message } of FORBIDDEN_PATTERNS) {
709
+ if (pattern.test(mdx)) {
710
+ errors.push({
711
+ type: "forbidden",
712
+ message
713
+ });
714
+ }
715
+ }
716
+ return {
717
+ valid: errors.length === 0,
718
+ errors
719
+ };
720
+ }
721
+ export {
722
+ BlogCard,
723
+ Button,
724
+ CACHE_TAGS,
725
+ Callout,
726
+ Embed,
727
+ Image,
728
+ basicComponents,
729
+ componentCatalog,
730
+ componentSchemas,
731
+ customComponents,
732
+ getCatalogForAI,
733
+ getCollectionsSlugPosts,
734
+ getCollectionsSlugPostsContentSlug,
735
+ getComponentsByCategory,
736
+ getComponentsWithReferences,
737
+ getDataTypeSlug,
738
+ getGetCollectionsSlugPostsContentSlugUrl,
739
+ getGetCollectionsSlugPostsUrl,
740
+ getGetDataTypeSlugUrl,
741
+ getGetPreviewTokenUrl,
742
+ getPreviewToken,
743
+ getPublicApiBaseUrl,
744
+ getPublicApiToken,
745
+ isValidComponent,
746
+ markdownComponents,
747
+ mdxComponents,
748
+ publicCustomInstance,
749
+ publicFetchWithTags,
750
+ publicFetcher,
751
+ quickValidateMdx,
752
+ validateComponentProps,
753
+ validateMdx
754
+ };
755
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/api-client/dist/core/public-fetcher.js","../../../packages/api-client/dist/core/cache-tags.js","../../../packages/api-client/dist/core/date-reviver.js","../../../packages/api-client/dist/generated/public/endpoints/public.js","../../../packages/mdx/dist/components/basic/Callout.js","../../../packages/mdx/dist/components/basic/Embed.js","../../../packages/mdx/dist/components/basic/Button.js","../../../packages/mdx/dist/components/basic/index.js","../../../packages/mdx/dist/components/custom/BlogCard.js","../../../packages/mdx/dist/components/custom/Image.js","../../../packages/mdx/dist/components/custom/index.js","../../../packages/mdx/dist/components/markdown/index.js","../../../packages/mdx/dist/components/index.js","../../../packages/mdx/dist/component-catalog.js","../../../packages/mdx/dist/validator.js"],"sourcesContent":["/**\n * Public API用カスタムfetcher\n * サーバーサイドからAdmin側のPublic APIを呼び出すためのfetcher\n * - Authorization: Bearer ヘッダー付与\n * - Next.js cache tags対応\n */\n/**\n * Admin APIのベースURL取得\n */\nexport function getPublicApiBaseUrl() {\n const adminUrl = process.env.CMX_API_URL;\n if (!adminUrl) {\n throw new Error(\"CMX_API_URL environment variable is not set\");\n }\n return `${adminUrl}/api/v1/public`;\n}\n/**\n * 環境変数からPublic APIトークン取得\n */\nexport function getPublicApiToken() {\n const token = process.env.CMX_API_KEY;\n if (!token) {\n throw new Error(\"CMX_API_KEY environment variable is not set\");\n }\n return token;\n}\n/**\n * Public API用のカスタムfetcher\n * サーバーサイドでのみ使用(SSR/RSC)\n */\nexport async function publicFetcher(path, options) {\n const { token, tags, revalidate } = options;\n const baseUrl = getPublicApiBaseUrl();\n const url = `${baseUrl}${path}`;\n const fetchOptions = {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${token}`,\n },\n next: Object.assign({ tags: tags || [] }, (revalidate !== undefined && { revalidate })),\n };\n const response = await fetch(url, fetchOptions);\n if (!response.ok) {\n const error = await response.json().catch(() => ({ error: \"Unknown error\" }));\n throw new Error(error.error || `API error: ${response.status}`);\n }\n return response.json();\n}\n/**\n * Orval用のカスタムインスタンス\n * OrvalはURLとRequestInitを直接渡す形式で呼び出す\n */\nexport async function publicCustomInstance(url, options) {\n const token = getPublicApiToken();\n const baseUrl = getPublicApiBaseUrl();\n const fullUrl = url.startsWith(\"http\") ? url : `${baseUrl}${url}`;\n const response = await fetch(fullUrl, Object.assign(Object.assign({}, options), { headers: Object.assign({ \"Content-Type\": \"application/json\", Authorization: `Bearer ${token}` }, options === null || options === void 0 ? void 0 : options.headers) }));\n if (!response.ok) {\n const error = await response.json().catch(() => ({ error: \"Unknown error\" }));\n throw new Error(error.error || `API error: ${response.status}`);\n }\n return response.json();\n}\n/**\n * キャッシュタグ付きのPublic APIリクエスト用ラッパー\n * Next.js ISR/on-demand revalidation対応\n */\nexport async function publicFetchWithTags(path, tags, revalidate) {\n const token = getPublicApiToken();\n const baseUrl = getPublicApiBaseUrl();\n const url = `${baseUrl}${path}`;\n const fetchOptions = {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${token}`,\n },\n next: Object.assign({ tags: tags || [] }, (revalidate !== undefined && { revalidate })),\n };\n const response = await fetch(url, fetchOptions);\n if (!response.ok) {\n const error = await response.json().catch(() => ({ error: \"Unknown error\" }));\n throw new Error(error.error || `API error: ${response.status}`);\n }\n return response.json();\n}\n","/**\n * キャッシュタグ定義\n * Next.js ISR/on-demand revalidation用\n */\nexport const CACHE_TAGS = {\n /** 全コレクション共通 */\n collections: \"collections\",\n /** 特定コレクション */\n collection: (slug) => `collection:${slug}`,\n /** 特定記事 */\n post: (collectionSlug, postSlug) => `post:${collectionSlug}:${postSlug}`,\n /** 全データタイプ共通 */\n data: \"data\",\n /** 特定データタイプ */\n dataType: (slug) => `data:${slug}`,\n};\n","/**\n * JSON reviver for automatic date parsing\n * Converts ISO date strings to JavaScript Date objects\n */\nconst isoDateFormat = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}/;\nexport function dateReviver(_key, value) {\n if (typeof value === \"string\" && isoDateFormat.test(value)) {\n return new Date(value);\n }\n return value;\n}\n","import { dateReviver } from '../../../core/date-reviver';\nexport const getGetCollectionsSlugPostsUrl = (slug) => {\n return `/api/v1/public/collections/${slug}/posts`;\n};\nexport const getCollectionsSlugPosts = async (slug, options) => {\n const res = await fetch(getGetCollectionsSlugPostsUrl(slug), Object.assign(Object.assign({}, options), { method: 'GET' }));\n const body = [204, 205, 304].includes(res.status) ? null : await res.text();\n const data = body ? JSON.parse(body, dateReviver) : {};\n return { data, status: res.status, headers: res.headers };\n};\nexport const getGetCollectionsSlugPostsContentSlugUrl = (slug, contentSlug) => {\n return `/api/v1/public/collections/${slug}/posts/${contentSlug}`;\n};\nexport const getCollectionsSlugPostsContentSlug = async (slug, contentSlug, options) => {\n const res = await fetch(getGetCollectionsSlugPostsContentSlugUrl(slug, contentSlug), Object.assign(Object.assign({}, options), { method: 'GET' }));\n const body = [204, 205, 304].includes(res.status) ? null : await res.text();\n const data = body ? JSON.parse(body, dateReviver) : {};\n return { data, status: res.status, headers: res.headers };\n};\nexport const getGetDataTypeSlugUrl = (typeSlug, params) => {\n const normalizedParams = new URLSearchParams();\n Object.entries(params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : value.toString());\n }\n });\n const stringifiedParams = normalizedParams.toString();\n return stringifiedParams.length > 0 ? `/api/v1/public/data/${typeSlug}?${stringifiedParams}` : `/api/v1/public/data/${typeSlug}`;\n};\nexport const getDataTypeSlug = async (typeSlug, params, options) => {\n const res = await fetch(getGetDataTypeSlugUrl(typeSlug, params), Object.assign(Object.assign({}, options), { method: 'GET' }));\n const body = [204, 205, 304].includes(res.status) ? null : await res.text();\n const data = body ? JSON.parse(body, dateReviver) : {};\n return { data, status: res.status, headers: res.headers };\n};\nexport const getGetPreviewTokenUrl = (token) => {\n return `/api/v1/public/preview/${token}`;\n};\nexport const getPreviewToken = async (token, options) => {\n const res = await fetch(getGetPreviewTokenUrl(token), Object.assign(Object.assign({}, options), { method: 'GET' }));\n const body = [204, 205, 304].includes(res.status) ? null : await res.text();\n const data = body ? JSON.parse(body, dateReviver) : {};\n return { data, status: res.status, headers: res.headers };\n};\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { AlertCircle, AlertTriangle, CheckCircle, Info, Lightbulb } from \"lucide-react\";\nconst icons = {\n info: Info,\n warning: AlertTriangle,\n error: AlertCircle,\n success: CheckCircle,\n tip: Lightbulb,\n};\nconst styles = {\n info: \"cmx-mdx__callout--info bg-blue-50 border-blue-200 text-blue-800\",\n warning: \"cmx-mdx__callout--warning bg-yellow-50 border-yellow-200 text-yellow-800\",\n error: \"cmx-mdx__callout--error bg-red-50 border-red-200 text-red-800\",\n success: \"cmx-mdx__callout--success bg-green-50 border-green-200 text-green-800\",\n tip: \"cmx-mdx__callout--tip bg-purple-50 border-purple-200 text-purple-800\",\n};\nconst iconColors = {\n info: \"text-blue-500\",\n warning: \"text-yellow-500\",\n error: \"text-red-500\",\n success: \"text-green-500\",\n tip: \"text-purple-500\",\n};\nexport function Callout({ type = \"info\", title, children }) {\n const Icon = icons[type];\n return (_jsx(\"div\", { className: `cmx-mdx__callout my-4 p-4 border rounded-lg ${styles[type]}`, children: _jsxs(\"div\", { className: \"cmx-mdx__callout-content flex gap-3\", children: [_jsx(Icon, { className: `cmx-mdx__callout-icon w-5 h-5 flex-shrink-0 mt-0.5 ${iconColors[type]}` }), _jsxs(\"div\", { className: \"cmx-mdx__callout-body flex-1\", children: [title && _jsx(\"p\", { className: \"cmx-mdx__callout-title font-semibold mb-1\", children: title }), _jsx(\"div\", { className: \"cmx-mdx__callout-text text-sm\", children: children })] })] }) }));\n}\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction extractYouTubeId(url) {\n const patterns = [\n /(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/|youtube\\.com\\/embed\\/)([^&\\n?#]+)/,\n ];\n for (const pattern of patterns) {\n const match = url.match(pattern);\n if (match)\n return match[1];\n }\n return null;\n}\nexport function Embed({ url, type = \"generic\" }) {\n if (type === \"youtube\") {\n const videoId = extractYouTubeId(url);\n if (videoId) {\n return (_jsx(\"div\", { className: \"cmx-mdx__embed cmx-mdx__embed--youtube my-4 aspect-video\", children: _jsx(\"iframe\", { src: `https://www.youtube.com/embed/${videoId}`, className: \"cmx-mdx__embed-iframe w-full h-full rounded-lg\", allow: \"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\", allowFullScreen: true }) }));\n }\n }\n if (type === \"twitter\") {\n // Twitterの埋め込みはクライアントサイドで処理が必要\n return (_jsxs(\"div\", { className: \"cmx-mdx__embed cmx-mdx__embed--twitter my-4 border border-gray-200 rounded-lg p-4 bg-gray-50\", children: [_jsx(\"p\", { className: \"cmx-mdx__embed-label text-sm text-gray-500\", children: \"Twitter\\u57CB\\u3081\\u8FBC\\u307F\" }), _jsx(\"a\", { href: url, target: \"_blank\", rel: \"noopener noreferrer\", className: \"cmx-mdx__embed-link text-blue-500 hover:underline text-sm\", children: url })] }));\n }\n // Generic embed\n return (_jsx(\"div\", { className: \"cmx-mdx__embed cmx-mdx__embed--generic my-4 aspect-video\", children: _jsx(\"iframe\", { src: url, className: \"cmx-mdx__embed-iframe w-full h-full rounded-lg border border-gray-200\", allowFullScreen: true }) }));\n}\n","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport Link from \"next/link\";\nconst variants = {\n primary: \"cmx-mdx__button--primary bg-blue-600 text-white hover:bg-blue-700\",\n secondary: \"cmx-mdx__button--secondary bg-gray-600 text-white hover:bg-gray-700\",\n outline: \"cmx-mdx__button--outline border border-gray-300 text-gray-700 hover:bg-gray-50\",\n};\nexport function Button({ href, children, variant = \"primary\" }) {\n const isExternal = href.startsWith(\"http\");\n const className = `cmx-mdx__button inline-block px-4 py-2 rounded-lg font-medium transition-colors ${variants[variant]}`;\n if (isExternal) {\n return (_jsx(\"a\", { href: href, target: \"_blank\", rel: \"noopener noreferrer\", className: className, children: children }));\n }\n return (_jsx(Link, { href: href, className: className, children: children }));\n}\n","// CMX Basic MDX Components\n// テンプレートとして提供する標準コンポーネント\n// クラス名: cmx-mdx__[component], cmx-mdx__[component]-[element], cmx-mdx__[component]--[modifier]\nexport { Callout } from \"./Callout\";\nexport { Embed } from \"./Embed\";\nexport { Button } from \"./Button\";\nimport { Callout } from \"./Callout\";\nimport { Embed } from \"./Embed\";\nimport { Button } from \"./Button\";\nexport const basicComponents = {\n Callout,\n Embed,\n Button,\n};\n","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport Link from \"next/link\";\nexport function BlogCard({ postId, title, slug, excerpt }) {\n // postIdのみの場合(未解決)\n if (!title || !slug) {\n return (_jsx(\"div\", { className: \"border border-dashed border-gray-300 rounded-lg p-4 bg-gray-50\", children: _jsxs(\"p\", { className: \"text-sm text-gray-500\", children: [\"\\u8A18\\u4E8B\\u30AB\\u30FC\\u30C9: \", postId] }) }));\n }\n return (_jsxs(Link, { href: `/${slug}`, className: \"block border border-gray-200 rounded-lg p-4 hover:border-blue-400 hover:shadow-md transition-all\", children: [_jsx(\"h3\", { className: \"text-lg font-semibold text-gray-900 mb-2\", children: title }), excerpt && _jsx(\"p\", { className: \"text-sm text-gray-600 line-clamp-2\", children: excerpt })] }));\n}\n","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport NextImage from \"next/image\";\nexport function Image({ assetId, alt = \"\", size = \"large\", caption, url, width, height, }) {\n // 未解決の場合\n if (!url) {\n return (_jsxs(\"figure\", { className: \"my-4\", children: [_jsxs(\"div\", { className: \"border border-dashed border-gray-300 rounded-lg p-8 bg-gray-50 text-center\", children: [_jsxs(\"p\", { className: \"text-sm text-gray-500\", children: [\"\\u753B\\u50CF: \", assetId] }), _jsxs(\"p\", { className: \"text-xs text-gray-400\", children: [\"\\u30B5\\u30A4\\u30BA: \", size] })] }), caption && (_jsx(\"figcaption\", { className: \"mt-2 text-sm text-gray-500 text-center\", children: caption }))] }));\n }\n return (_jsxs(\"figure\", { className: \"my-4\", children: [_jsx(NextImage, { src: url, alt: alt, width: width || 800, height: height || 600, className: \"rounded-lg\" }), caption && (_jsx(\"figcaption\", { className: \"mt-2 text-sm text-gray-500 text-center\", children: caption }))] }));\n}\n","// CMX Custom MDX Components\n// プロジェクト固有のカスタムコンポーネント(reference解決が必要)\n// これらは企業ごとにカスタマイズされることを想定\nexport { BlogCard } from \"./BlogCard\";\nexport { Image } from \"./Image\";\nimport { BlogCard } from \"./BlogCard\";\nimport { Image } from \"./Image\";\nexport const customComponents = {\n BlogCard,\n Image,\n};\n","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n// Headings: # ## ### #### ##### ######\nconst mdxH1 = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"h1\", Object.assign({ className: \"text-4xl font-bold mt-8 mb-4\" }, props, { children: children })));\n};\nconst mdxH2 = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"h2\", Object.assign({ className: \"text-3xl font-bold mt-6 mb-3\" }, props, { children: children })));\n};\nconst mdxH3 = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"h3\", Object.assign({ className: \"text-2xl font-semibold mt-4 mb-2\" }, props, { children: children })));\n};\nconst mdxH4 = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"h4\", Object.assign({ className: \"text-xl font-semibold mt-3 mb-2\" }, props, { children: children })));\n};\nconst mdxH5 = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"h5\", Object.assign({ className: \"text-lg font-medium mt-2 mb-1\" }, props, { children: children })));\n};\nconst mdxH6 = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"h6\", Object.assign({ className: \"text-base font-medium mt-2 mb-1\" }, props, { children: children })));\n};\n// Paragraph\nconst mdxP = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"p\", Object.assign({ className: \"my-4 leading-7\" }, props, { children: children })));\n};\n// Lists: - item / 1. item\nconst mdxUl = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"ul\", Object.assign({ className: \"my-4 pl-6 list-disc\" }, props, { children: children })));\n};\nconst mdxOl = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"ol\", Object.assign({ className: \"my-4 pl-6 list-decimal\" }, props, { children: children })));\n};\nconst mdxLi = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"li\", Object.assign({ className: \"my-1\" }, props, { children: children })));\n};\n// Blockquote: > quote\nconst mdxBlockquote = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"blockquote\", Object.assign({ className: \"border-l-4 border-primary pl-4 italic my-4\" }, props, { children: children })));\n};\n// Code: ```code``` and `inline`\nconst mdxPre = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"pre\", Object.assign({ className: \"overflow-x-auto rounded-lg bg-slate-900 p-4 text-sm my-4\" }, props, { children: children })));\n};\nconst mdxCode = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"code\", Object.assign({ className: \"bg-muted px-1.5 py-0.5 rounded text-sm font-mono\" }, props, { children: children })));\n};\n// Horizontal rule: ---\nconst mdxHr = () => (_jsx(\"hr\", { className: \"my-8 border-t border-border\" }));\n// Links: [text](url)\nconst mdxA = (_a) => {\n var { children, href } = _a, props = __rest(_a, [\"children\", \"href\"]);\n return (_jsx(\"a\", Object.assign({ href: href, className: \"text-primary underline underline-offset-4 hover:text-primary/80\", target: (href === null || href === void 0 ? void 0 : href.startsWith(\"http\")) ? \"_blank\" : undefined, rel: (href === null || href === void 0 ? void 0 : href.startsWith(\"http\")) ? \"noopener noreferrer\" : undefined }, props, { children: children })));\n};\n// Images: ![alt](url)\nconst mdxImg = (_a) => {\n var { src, alt } = _a, props = __rest(_a, [\"src\", \"alt\"]);\n return (\n // eslint-disable-next-line @next/next/no-img-element\n _jsx(\"img\", Object.assign({ src: src, alt: alt || \"\", className: \"max-w-full h-auto rounded-lg my-4\" }, props)));\n};\n// Text formatting: **bold** *italic*\nconst mdxStrong = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"strong\", Object.assign({ className: \"font-bold\" }, props, { children: children })));\n};\nconst mdxEm = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"em\", Object.assign({ className: \"italic\" }, props, { children: children })));\n};\n// Tables (GFM)\nconst mdxTable = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"div\", { className: \"my-4 overflow-x-auto\", children: _jsx(\"table\", Object.assign({ className: \"min-w-full border-collapse border border-border\" }, props, { children: children })) }));\n};\nconst mdxThead = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"thead\", Object.assign({ className: \"bg-muted\" }, props, { children: children })));\n};\nconst mdxTbody = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"tbody\", Object.assign({}, props, { children: children })));\n};\nconst mdxTr = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"tr\", Object.assign({ className: \"border-b border-border\" }, props, { children: children })));\n};\nconst mdxTh = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"th\", Object.assign({ className: \"px-4 py-2 text-left font-semibold border border-border\" }, props, { children: children })));\n};\nconst mdxTd = (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (_jsx(\"td\", Object.assign({ className: \"px-4 py-2 border border-border\" }, props, { children: children })));\n};\n/**\n * Standard markdown element mappings for MDX\n * Use with MDX's components prop: <MDXContent components={markdownComponents} />\n */\nexport const markdownComponents = {\n h1: mdxH1,\n h2: mdxH2,\n h3: mdxH3,\n h4: mdxH4,\n h5: mdxH5,\n h6: mdxH6,\n p: mdxP,\n ul: mdxUl,\n ol: mdxOl,\n li: mdxLi,\n blockquote: mdxBlockquote,\n pre: mdxPre,\n code: mdxCode,\n hr: mdxHr,\n a: mdxA,\n img: mdxImg,\n strong: mdxStrong,\n em: mdxEm,\n table: mdxTable,\n thead: mdxThead,\n tbody: mdxTbody,\n tr: mdxTr,\n th: mdxTh,\n td: mdxTd,\n};\n","// MDX Components\n// basic: CMXテンプレート(cmx-mdx__プレフィックス付き)\n// custom: プロジェクト固有(reference解決が必要)\n// markdown: 標準Markdown要素(h1, p, ul, etc.)\n// Basic Components (CMX templates)\nexport { Callout, Embed, Button, basicComponents } from \"./basic\";\n// Custom Components (project-specific)\nexport { BlogCard, Image, customComponents } from \"./custom\";\n// Standard Markdown Element Components\nexport { markdownComponents } from \"./markdown\";\n// Combined MDX Component Map\nimport { basicComponents } from \"./basic\";\nimport { customComponents } from \"./custom\";\nimport { markdownComponents } from \"./markdown\";\nexport const mdxComponents = Object.assign(Object.assign(Object.assign({}, markdownComponents), basicComponents), customComponents);\n","import { z } from \"zod\";\n// ============================================\n// Component Props Schema Definitions\n// ============================================\n// カスタムコンポーネントのみ定義\n// Heading, Quote, List, Table, Divider, CodeBlockはMDX標準のHTML出力を使用\nexport const componentSchemas = {\n // BlogCard: 他記事への参照\n BlogCard: z.object({\n postId: z.string().uuid().describe(\"参照先記事のUUID\"),\n }),\n // Image: 画像表示\n Image: z.object({\n assetId: z.string().uuid().describe(\"アセットのUUID\"),\n alt: z.string().optional().describe(\"代替テキスト\"),\n size: z\n .enum([\"thumbnail\", \"medium\", \"large\", \"original\"])\n .default(\"large\")\n .describe(\"表示サイズ\"),\n caption: z.string().optional().describe(\"キャプション\"),\n }),\n // Callout: 注意書きボックス\n Callout: z.object({\n type: z\n .enum([\"info\", \"warning\", \"error\", \"success\", \"tip\"])\n .default(\"info\")\n .describe(\"タイプ\"),\n title: z.string().optional().describe(\"タイトル\"),\n children: z.string().describe(\"本文(Markdown可)\"),\n }),\n // Embed: 外部埋め込み\n Embed: z.object({\n url: z.string().url().describe(\"埋め込みURL\"),\n type: z.enum([\"youtube\", \"twitter\", \"generic\"]).default(\"generic\").describe(\"タイプ\"),\n }),\n // Button: ボタンリンク\n Button: z.object({\n href: z.string().describe(\"リンク先URL\"),\n children: z.string().describe(\"ボタンテキスト\"),\n variant: z.enum([\"primary\", \"secondary\", \"outline\"]).default(\"primary\").describe(\"スタイル\"),\n }),\n};\n// ============================================\n// Component Catalog\n// ============================================\nexport const componentCatalog = {\n BlogCard: {\n name: \"BlogCard\",\n displayName: \"記事カード\",\n description: \"他の記事へのリンクカードを表示します\",\n category: \"reference\",\n schema: componentSchemas.BlogCard,\n examples: ['<BlogCard postId=\"123e4567-e89b-12d3-a456-426614174000\" />'],\n hasReferences: true,\n },\n Image: {\n name: \"Image\",\n displayName: \"画像\",\n description: \"アップロード済み画像を表示します\",\n category: \"media\",\n schema: componentSchemas.Image,\n examples: [\n '<Image assetId=\"123e4567-e89b-12d3-a456-426614174000\" alt=\"説明\" />',\n '<Image assetId=\"123e4567-e89b-12d3-a456-426614174000\" size=\"medium\" caption=\"キャプション\" />',\n ],\n hasReferences: true,\n },\n Callout: {\n name: \"Callout\",\n displayName: \"コールアウト\",\n description: \"注意書きや補足情報を目立たせるボックス\",\n category: \"content\",\n schema: componentSchemas.Callout,\n examples: [\n '<Callout type=\"info\">これは情報です</Callout>',\n '<Callout type=\"warning\" title=\"注意\">重要な注意事項です</Callout>',\n ],\n hasReferences: false,\n },\n Embed: {\n name: \"Embed\",\n displayName: \"埋め込み\",\n description: \"YouTube動画やツイートを埋め込みます\",\n category: \"media\",\n schema: componentSchemas.Embed,\n examples: [\n '<Embed url=\"https://www.youtube.com/watch?v=dQw4w9WgXcQ\" type=\"youtube\" />',\n '<Embed url=\"https://twitter.com/example/status/123456789\" type=\"twitter\" />',\n ],\n hasReferences: false,\n },\n Button: {\n name: \"Button\",\n displayName: \"ボタン\",\n description: \"アクションを促すボタンリンク\",\n category: \"content\",\n schema: componentSchemas.Button,\n examples: [\n '<Button href=\"/contact\">お問い合わせ</Button>',\n '<Button href=\"https://example.com\" variant=\"secondary\">詳細を見る</Button>',\n ],\n hasReferences: false,\n },\n};\n// ============================================\n// Utility Functions\n// ============================================\n/**\n * コンポーネント名が有効かチェック\n */\nexport function isValidComponent(name) {\n return name in componentCatalog;\n}\n/**\n * コンポーネントのpropsをバリデート\n */\nexport function validateComponentProps(name, props) {\n const schema = componentSchemas[name];\n const result = schema.safeParse(props);\n if (result.success) {\n return { success: true, data: result.data };\n }\n return { success: false, error: result.error };\n}\n/**\n * 参照を持つコンポーネント名の一覧\n */\nexport function getComponentsWithReferences() {\n return Object.keys(componentCatalog).filter((name) => componentCatalog[name].hasReferences);\n}\n/**\n * カテゴリでコンポーネントをグループ化\n */\nexport function getComponentsByCategory() {\n const grouped = {};\n for (const def of Object.values(componentCatalog)) {\n if (!grouped[def.category]) {\n grouped[def.category] = [];\n }\n grouped[def.category].push(def);\n }\n return grouped;\n}\n/**\n * AI向けのカタログ情報(MCP用)\n */\nexport function getCatalogForAI() {\n return Object.values(componentCatalog).map((def) => {\n const shape = def.schema.shape;\n const props = {};\n for (const [key, zodType] of Object.entries(shape)) {\n const isOptional = zodType.isOptional();\n props[key] = {\n type: getZodTypeName(zodType),\n description: zodType.description,\n required: !isOptional,\n };\n }\n return {\n name: def.name,\n description: def.description,\n props,\n examples: def.examples,\n };\n });\n}\nfunction getZodTypeName(zodType) {\n var _a, _b, _c, _d, _e;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const typeDef = (_b = (_a = zodType._zod) === null || _a === void 0 ? void 0 : _a.def) !== null && _b !== void 0 ? _b : zodType._def;\n if (!typeDef)\n return \"unknown\";\n const typeName = (_c = typeDef.type) !== null && _c !== void 0 ? _c : typeDef.typeName;\n switch (typeName) {\n case \"string\":\n case \"ZodString\":\n return \"string\";\n case \"number\":\n case \"ZodNumber\":\n return \"number\";\n case \"boolean\":\n case \"ZodBoolean\":\n return \"boolean\";\n case \"enum\":\n case \"ZodEnum\":\n return `enum(${(_e = (_d = typeDef.values) === null || _d === void 0 ? void 0 : _d.join(\"|\")) !== null && _e !== void 0 ? _e : \"\"})`;\n case \"array\":\n case \"ZodArray\":\n return \"array\";\n case \"optional\":\n case \"ZodOptional\":\n return typeDef.innerType ? getZodTypeName(typeDef.innerType) : \"unknown\";\n case \"default\":\n case \"ZodDefault\":\n return typeDef.innerType ? getZodTypeName(typeDef.innerType) : \"unknown\";\n default:\n return \"unknown\";\n }\n}\n","import { compile } from \"@mdx-js/mdx\";\nimport { isValidComponent, validateComponentProps } from \"./component-catalog\";\n// ============================================\n// Forbidden Patterns\n// ============================================\nconst FORBIDDEN_PATTERNS = [\n // import/export statements\n { pattern: /^\\s*import\\s+/m, message: \"import文は使用できません\" },\n { pattern: /^\\s*export\\s+/m, message: \"export文は使用できません\" },\n // JS expressions in curly braces (except component props)\n { pattern: /\\{[^}]*(?:=>|function|new\\s+|typeof|instanceof)[^}]*\\}/m, message: \"JavaScript式は使用できません\" },\n // eval, Function constructor\n { pattern: /\\beval\\s*\\(/m, message: \"evalは使用できません\" },\n { pattern: /\\bnew\\s+Function\\s*\\(/m, message: \"Function constructorは使用できません\" },\n // script tags\n { pattern: /<script[\\s>]/i, message: \"scriptタグは使用できません\" },\n // on* event handlers\n { pattern: /\\bon\\w+\\s*=/i, message: \"イベントハンドラ属性は使用できません\" },\n // javascript: URLs\n { pattern: /javascript\\s*:/i, message: \"javascript: URLは使用できません\" },\n // data: URLs (for images - can be XSS vector)\n { pattern: /src\\s*=\\s*[\"']?\\s*data:/i, message: \"data: URLは使用できません\" },\n];\nfunction extractComponents(mdx) {\n const components = [];\n const lines = mdx.split(\"\\n\");\n // Simple regex to find JSX-like components\n // <ComponentName prop=\"value\" prop2={expression} />\n const componentPattern = /<([A-Z][a-zA-Z0-9]*)\\s*([^>]*?)\\s*\\/?>/g;\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n let match;\n while ((match = componentPattern.exec(line)) !== null) {\n const name = match[1];\n const propsString = match[2];\n const props = parseProps(propsString);\n components.push({\n name,\n props,\n line: i + 1,\n });\n }\n }\n return components;\n}\nfunction parseProps(propsString) {\n var _a;\n const props = {};\n // Match prop=\"value\" or prop={value} patterns\n const propPattern = /(\\w+)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|\\{([^}]*)\\})/g;\n let match;\n while ((match = propPattern.exec(propsString)) !== null) {\n const key = match[1];\n const stringValue = (_a = match[2]) !== null && _a !== void 0 ? _a : match[3];\n const expressionValue = match[4];\n if (stringValue !== undefined) {\n props[key] = stringValue;\n }\n else if (expressionValue !== undefined) {\n // Try to parse simple values\n const trimmed = expressionValue.trim();\n if (trimmed === \"true\") {\n props[key] = true;\n }\n else if (trimmed === \"false\") {\n props[key] = false;\n }\n else if (/^\\d+$/.test(trimmed)) {\n props[key] = parseInt(trimmed, 10);\n }\n else if (/^\\d+\\.\\d+$/.test(trimmed)) {\n props[key] = parseFloat(trimmed);\n }\n else if (trimmed.startsWith(\"[\") && trimmed.endsWith(\"]\")) {\n // Try to parse array\n try {\n props[key] = JSON.parse(trimmed.replace(/'/g, '\"'));\n }\n catch (_b) {\n props[key] = trimmed;\n }\n }\n else {\n props[key] = trimmed;\n }\n }\n }\n // Handle boolean props without value (e.g., <CodeBlock showLineNumbers />)\n const booleanPattern = /(?:^|\\s)(\\w+)(?=\\s|\\/|>|$)/g;\n while ((match = booleanPattern.exec(propsString)) !== null) {\n const key = match[1];\n if (!(key in props)) {\n props[key] = true;\n }\n }\n return props;\n}\n// ============================================\n// Extract References\n// ============================================\nfunction extractReferences(components) {\n const postIds = [];\n const assetIds = [];\n for (const component of components) {\n if (component.name === \"BlogCard\" && typeof component.props.postId === \"string\") {\n postIds.push(component.props.postId);\n }\n if (component.name === \"Image\" && typeof component.props.assetId === \"string\") {\n assetIds.push(component.props.assetId);\n }\n }\n return {\n postIds: [...new Set(postIds)],\n assetIds: [...new Set(assetIds)],\n };\n}\n// ============================================\n// Main Validation Function\n// ============================================\nexport async function validateMdx(mdx) {\n const errors = [];\n const warnings = [];\n // 1. Check forbidden patterns\n for (const { pattern, message } of FORBIDDEN_PATTERNS) {\n if (pattern.test(mdx)) {\n const lines = mdx.split(\"\\n\");\n for (let i = 0; i < lines.length; i++) {\n if (pattern.test(lines[i])) {\n errors.push({\n type: \"forbidden\",\n message,\n line: i + 1,\n });\n break;\n }\n }\n }\n }\n // 2. Try to compile MDX (syntax check)\n try {\n await compile(mdx, {\n development: false,\n // Minimal compilation to check syntax\n });\n }\n catch (error) {\n const err = error;\n errors.push({\n type: \"syntax\",\n message: err.message,\n line: err.line,\n column: err.column,\n });\n }\n // 3. Extract and validate components\n const components = extractComponents(mdx);\n for (const component of components) {\n // Check if component is in catalog\n if (!isValidComponent(component.name)) {\n errors.push({\n type: \"component\",\n message: `未知のコンポーネント: ${component.name}`,\n line: component.line,\n component: component.name,\n });\n continue;\n }\n // Validate props\n const result = validateComponentProps(component.name, component.props);\n if (!result.success) {\n for (const issue of result.error.issues) {\n errors.push({\n type: \"props\",\n message: `${component.name}: ${issue.path.join(\".\")} - ${issue.message}`,\n line: component.line,\n component: component.name,\n });\n }\n }\n }\n // 4. Extract references\n const references = extractReferences(components);\n return {\n valid: errors.length === 0,\n errors,\n warnings,\n references,\n };\n}\n// ============================================\n// Quick Validation (for save)\n// ============================================\nexport function quickValidateMdx(mdx) {\n const errors = [];\n // Only check forbidden patterns (fast)\n for (const { pattern, message } of FORBIDDEN_PATTERNS) {\n if (pattern.test(mdx)) {\n errors.push({\n type: \"forbidden\",\n message,\n });\n }\n }\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n"],"mappings":";AASO,SAAS,sBAAsB;AAClC,QAAM,WAAW,QAAQ,IAAI;AAC7B,MAAI,CAAC,UAAU;AACX,UAAM,IAAI,MAAM,6CAA6C;AAAA,EACjE;AACA,SAAO,GAAG,QAAQ;AACtB;AAIO,SAAS,oBAAoB;AAChC,QAAM,QAAQ,QAAQ,IAAI;AAC1B,MAAI,CAAC,OAAO;AACR,UAAM,IAAI,MAAM,6CAA6C;AAAA,EACjE;AACA,SAAO;AACX;AAKA,eAAsB,cAAc,MAAM,SAAS;AAC/C,QAAM,EAAE,OAAO,MAAM,WAAW,IAAI;AACpC,QAAM,UAAU,oBAAoB;AACpC,QAAM,MAAM,GAAG,OAAO,GAAG,IAAI;AAC7B,QAAM,eAAe;AAAA,IACjB,QAAQ;AAAA,IACR,SAAS;AAAA,MACL,gBAAgB;AAAA,MAChB,eAAe,UAAU,KAAK;AAAA,IAClC;AAAA,IACA,MAAM,OAAO,OAAO,EAAE,MAAM,QAAQ,CAAC,EAAE,GAAI,eAAe,UAAa,EAAE,WAAW,CAAE;AAAA,EAC1F;AACA,QAAM,WAAW,MAA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;AACnD,QAAI,QAAQ,KAAK,GAAG,GAAG;AACnB,aAAO,KAAK;AAAA,QACR,MAAM;AAAA,QACN;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,EACJ;AACA,SAAO;AAAA,IACH,OAAO,OAAO,WAAW;AAAA,IACzB;AAAA,EACJ;AACJ;","names":["_jsx","_jsxs","_jsx","_jsxs","_jsx","Link","_jsxs","_jsx","_jsx"]}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "cmx-sdk",
3
+ "version": "0.1.0",
4
+ "description": "CMX SDK - Official SDK for building content-driven websites with CMX",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/kzkm-lab/cmx.git",
10
+ "directory": "publish/sdk"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "keywords": [
16
+ "cmx",
17
+ "cms",
18
+ "content",
19
+ "mdx",
20
+ "nextjs",
21
+ "react",
22
+ "sdk"
23
+ ],
24
+ "files": [
25
+ "dist",
26
+ "README.md"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/index.d.ts",
31
+ "import": "./dist/index.js"
32
+ }
33
+ },
34
+ "dependencies": {
35
+ "@mdx-js/mdx": "^3.1.1",
36
+ "lucide-react": "^0.468.0",
37
+ "zod": "^3.24.0"
38
+ },
39
+ "peerDependencies": {
40
+ "react": "^18 || ^19",
41
+ "react-dom": "^18 || ^19",
42
+ "next": "^14 || ^15 || ^16"
43
+ },
44
+ "devDependencies": {
45
+ "@types/react": "^19",
46
+ "@types/react-dom": "^19",
47
+ "tsup": "^8",
48
+ "typescript": "^5",
49
+ "@cmx/api-client": "0.0.0",
50
+ "@cmx/mdx": "0.1.0"
51
+ },
52
+ "scripts": {
53
+ "build": "tsup",
54
+ "dev": "tsup --watch",
55
+ "typecheck": "tsc --noEmit"
56
+ }
57
+ }