Skip to content

Commit ca34cf4

Browse files
committed
refactor(common): consolidate XML parsing (Commit 2.7)
- Create common/src/util/xml/ directory for organized modules - Move saxy.ts to xml/saxy.ts (streaming XML parser) - Create xml/tag-utils.ts (closeXml, getStopSequences) - Create xml/tool-call-parser.ts (parseToolCallXml) - Add unified xml/index.ts re-exports - Add explicit package.json export for @codebuff/common/util/xml - Update consumers to use new import path
1 parent 6a7f7e3 commit ca34cf4

File tree

7 files changed

+799
-2
lines changed

7 files changed

+799
-2
lines changed

common/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
"private": true,
66
"type": "module",
77
"exports": {
8+
"./analytics": {
9+
"bun": "./src/analytics/index.ts",
10+
"import": "./src/analytics/index.ts",
11+
"types": "./src/analytics/index.ts",
12+
"default": "./src/analytics/index.ts"
13+
},
14+
"./util/xml": {
15+
"bun": "./src/util/xml/index.ts",
16+
"import": "./src/util/xml/index.ts",
17+
"types": "./src/util/xml/index.ts",
18+
"default": "./src/util/xml/index.ts"
19+
},
820
"./*": {
921
"bun": "./src/*.ts",
1022
"import": "./src/*.ts",

common/src/util/__tests__/saxy.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'bun:test'
22

3-
import { Saxy } from '../saxy'
3+
import { Saxy } from '../xml'
44

55
describe('Saxy XML Parser', () => {
66
// Helper function to process XML and get events

common/src/util/xml/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export {
2+
Saxy,
3+
parseAttrs,
4+
type TextNode,
5+
type CDATANode,
6+
type CommentNode,
7+
type ProcessingInstructionNode,
8+
type TagOpenNode,
9+
type TagCloseNode,
10+
type NextFunction,
11+
type SaxyEvents,
12+
type SaxyEventNames,
13+
type SaxyEventArgs,
14+
type TagSchema,
15+
} from './saxy'
16+
export { parseToolCallXml } from './tool-call-parser'
17+
export { closeXml, getStopSequences } from './tag-utils'

0 commit comments

Comments
 (0)