@c4a/extract-mdx 0.0.0-bootstrap.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 context4ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # MDX Catalog Bridge for Context
2
+
3
+ [简体中文](./README.zh-CN.md)
4
+
5
+ `@c4a/extract-mdx` parses registered MDX sources without compiling or executing them. It catalogs ESM imports/exports, JSX component references, fenced examples, demo/story/sandbox hosts, and links those examples to caller-registered public targets.
6
+
7
+ ```ts
8
+ import { mdxSourcesToEvidenceAdapterResult } from "@c4a/extract-mdx";
9
+
10
+ const evidence = mdxSourcesToEvidenceAdapterResult(files, {
11
+ ...invocation,
12
+ public_targets: [{
13
+ target_ref: "public-target:button",
14
+ export_name: "Button",
15
+ source_module: "@example/ui",
16
+ }],
17
+ });
18
+ ```
19
+
20
+ Public targets are an input authority, not inferred from uppercase JSX names. Example identities include the complete source path and an ordinal, so equal basenames in different directories cannot collide. Fenced code is retained only by digest; script-language blocks are parsed statically for imports and JSX references. Invalid fenced script receives a warning without making otherwise valid MDX disappear. Invalid MDX makes the whole file `unsupported` and publishes no partial facts.
21
+
22
+ ## Development
23
+
24
+ ```bash
25
+ bun run --filter @c4a/extract-mdx typecheck
26
+ bun run --filter @c4a/extract-mdx lint
27
+ bun run --filter @c4a/extract-mdx test
28
+ bun run --filter @c4a/extract-mdx build
29
+ ```
@@ -0,0 +1,16 @@
1
+ # Context MDX 目录桥接
2
+
3
+ [English](./README.md)
4
+
5
+ `@c4a/extract-mdx` 静态解析已登记的 MDX source,不编译也不执行。它生成 ESM import/export、JSX component reference、fenced example、demo/story/sandbox host,并把示例关联到调用方已登记的公共目标。
6
+
7
+ 公共目标是输入 authority,解析器不会根据大写 JSX 名称自行创建公开 API。示例 identity 包含完整 source path 和 ordinal,不同目录下的同 basename 文件不会碰撞。代码块正文只保留 digest;脚本语言代码块仅静态提取 import 和 JSX reference。代码块语法错误产生 warning,但不会抹掉其他有效 MDX;MDX 本身语法错误时整文件为 `unsupported`,且不发布部分 facts。
8
+
9
+ ## 开发
10
+
11
+ ```bash
12
+ bun run --filter @c4a/extract-mdx typecheck
13
+ bun run --filter @c4a/extract-mdx lint
14
+ bun run --filter @c4a/extract-mdx test
15
+ bun run --filter @c4a/extract-mdx build
16
+ ```