@mrsf/cli 0.4.3 → 0.5.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 +29 -0
- package/dist/browser.cjs +887 -0
- package/dist/browser.cjs.map +7 -0
- package/dist/browser.d.ts +11 -1
- package/dist/browser.js +9 -0
- package/dist/index.cjs +2137 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +10 -0
- package/dist/lib/comments.js +2 -2
- package/dist/lib/fuzzy.js +15 -152
- package/dist/lib/identity.d.ts +12 -0
- package/dist/lib/identity.js +23 -0
- package/dist/lib/reanchor-core.d.ts +4 -1
- package/dist/lib/reanchor-core.js +62 -0
- package/dist/lib/reanchor.d.ts +1 -1
- package/dist/lib/reanchor.js +1 -1
- package/dist/lib/schema.d.ts +106 -0
- package/dist/lib/schema.js +3 -0
- package/dist/lib/types.d.ts +18 -0
- package/dist/lib/validate-core.d.ts +6 -0
- package/dist/lib/validate-core.js +128 -0
- package/dist/lib/validator.js +4 -112
- package/package.json +14 -6
package/README.md
CHANGED
|
@@ -36,6 +36,35 @@ npm run build
|
|
|
36
36
|
node dist/bin.js --help
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
## Browser / Embedder API (`@mrsf/cli/browser`)
|
|
40
|
+
|
|
41
|
+
Use `@mrsf/cli/browser` in Vite, Electron renderers, and editor extensions that
|
|
42
|
+
need side-effect-free MRSF helpers without Node built-ins. This entrypoint does
|
|
43
|
+
not import `fs`, git helpers, or other Node-only APIs, and is designed to be
|
|
44
|
+
tree-shakeable.
|
|
45
|
+
|
|
46
|
+
Key exports include:
|
|
47
|
+
|
|
48
|
+
- Types: `MrsfDocument`, `Comment`, `AnchorPosition`
|
|
49
|
+
- Anchoring: `resolveAnchor`, `reanchorComment`, `reanchorDocumentText`,
|
|
50
|
+
`toReanchorLines`, `applyReanchorResults`
|
|
51
|
+
- Validation: `validateDocument`, `mrsfSchema`
|
|
52
|
+
- Identity: `formatAuthor`, `parseAuthor`, `newCommentId`
|
|
53
|
+
- Pure fuzzy helpers: `exactMatch`, `normalizedMatch`, `fuzzySearch`,
|
|
54
|
+
`combinedScore`
|
|
55
|
+
|
|
56
|
+
Example editor decoration flow:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { resolveAnchor, type Comment } from "@mrsf/cli/browser";
|
|
60
|
+
|
|
61
|
+
function decorationRange(comment: Comment, text: string) {
|
|
62
|
+
const anchor = resolveAnchor(comment, text);
|
|
63
|
+
if (anchor.from == null || anchor.to == null) return undefined;
|
|
64
|
+
return { from: anchor.from, to: anchor.to };
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
39
68
|
## Commands
|
|
40
69
|
|
|
41
70
|
### `mrsf validate [files...]`
|