codebuff 1.0.169 → 1.0.170
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/browser-runner.js +17 -7
- package/dist/browser-runner.js.map +1 -1
- package/dist/chat-storage.d.ts +2 -27
- package/dist/chat-storage.js +73 -139
- package/dist/chat-storage.js.map +1 -1
- package/dist/checkpoint-file-manager.d.ts +8 -0
- package/dist/checkpoint-file-manager.js +125 -0
- package/dist/checkpoint-file-manager.js.map +1 -0
- package/dist/checkpoints.d.ts +61 -0
- package/dist/checkpoints.js +171 -0
- package/dist/checkpoints.js.map +1 -0
- package/dist/cli.d.ts +7 -8
- package/dist/cli.js +127 -155
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +179 -28
- package/dist/client.js +154 -150
- package/dist/client.js.map +1 -1
- package/dist/code-map/languages.js +17 -7
- package/dist/code-map/languages.js.map +1 -1
- package/dist/code-map/parse.js +17 -7
- package/dist/code-map/parse.js.map +1 -1
- package/dist/code-map/tsconfig.tsbuildinfo +1 -1
- package/dist/common/actions.d.ts +2121 -560
- package/dist/common/actions.js +58 -81
- package/dist/common/actions.js.map +1 -1
- package/dist/common/constants/tools.d.ts +13 -0
- package/dist/common/constants/tools.js +22 -0
- package/dist/common/constants/tools.js.map +1 -0
- package/dist/common/constants.d.ts +0 -1
- package/dist/common/constants.js +3 -3
- package/dist/common/constants.js.map +1 -1
- package/dist/common/logger.d.ts +1 -0
- package/dist/common/logger.js +7 -0
- package/dist/common/logger.js.map +1 -0
- package/dist/common/types/agent-state.d.ts +461 -0
- package/dist/common/types/agent-state.js +30 -0
- package/dist/common/types/agent-state.js.map +1 -0
- package/dist/common/types/message.d.ts +311 -0
- package/dist/common/types/message.js +54 -0
- package/dist/common/types/message.js.map +1 -0
- package/dist/common/types/tools.d.ts +5 -0
- package/dist/common/types/tools.js +3 -0
- package/dist/common/types/tools.js.map +1 -0
- package/dist/common/util/changes.js +3 -3
- package/dist/common/util/changes.js.map +1 -1
- package/dist/common/util/constants.d.ts +1 -0
- package/dist/common/util/constants.js +7 -0
- package/dist/common/util/constants.js.map +1 -0
- package/dist/common/util/credentials.d.ts +4 -4
- package/dist/common/util/file.d.ts +6 -2
- package/dist/common/util/file.js +25 -24
- package/dist/common/util/file.js.map +1 -1
- package/dist/common/util/git.js +1 -1
- package/dist/common/util/git.js.map +1 -1
- package/dist/common/util/helpers.d.ts +1 -0
- package/dist/common/util/helpers.js +6 -0
- package/dist/common/util/helpers.js.map +1 -0
- package/dist/common/util/messages.d.ts +1 -1
- package/dist/common/util/promise.d.ts +8 -0
- package/dist/common/util/promise.js +25 -2
- package/dist/common/util/promise.js.map +1 -1
- package/dist/common/util/saxy.d.ts +158 -0
- package/dist/common/util/saxy.js +450 -0
- package/dist/common/util/saxy.js.map +1 -0
- package/dist/common/util/string.d.ts +13 -0
- package/dist/common/util/string.js +21 -1
- package/dist/common/util/string.js.map +1 -1
- package/dist/common/util/token-counter.d.ts +3 -0
- package/dist/common/util/token-counter.js +27 -0
- package/dist/common/util/token-counter.js.map +1 -0
- package/dist/common/websockets/websocket-schema.d.ts +3646 -530
- package/dist/create-template-project.js +17 -7
- package/dist/create-template-project.js.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/menu.js +31 -19
- package/dist/menu.js.map +1 -1
- package/dist/project-files.d.ts +40 -2
- package/dist/project-files.js +94 -34
- package/dist/project-files.js.map +1 -1
- package/dist/tool-handlers.d.ts +21 -7
- package/dist/tool-handlers.js +99 -37
- package/dist/tool-handlers.js.map +1 -1
- package/dist/utils/__tests__/xml-stream-parser.test.js +221 -0
- package/dist/utils/__tests__/xml-stream-parser.test.js.map +1 -0
- package/dist/utils/spinner.d.ts +1 -0
- package/dist/utils/spinner.js +28 -7
- package/dist/utils/spinner.js.map +1 -1
- package/dist/utils/terminal.d.ts +23 -3
- package/dist/utils/terminal.js +68 -45
- package/dist/utils/terminal.js.map +1 -1
- package/dist/utils/tool-renderers.d.ts +16 -0
- package/dist/utils/tool-renderers.js +105 -0
- package/dist/utils/tool-renderers.js.map +1 -0
- package/dist/utils/xml-stream-parser.d.ts +9 -0
- package/dist/utils/xml-stream-parser.js +128 -0
- package/dist/utils/xml-stream-parser.js.map +1 -0
- package/dist/worker-script-project-context.js +1 -1
- package/dist/worker-script-project-context.js.map +1 -1
- package/package.json +2 -1
- package/dist/__tests__/browser-runner.test.js +0 -15
- package/dist/__tests__/browser-runner.test.js.map +0 -1
- /package/dist/{__tests__/browser-runner.test.d.ts → utils/__tests__/xml-stream-parser.test.d.ts} +0 -0
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sleep = exports.mapAsync = exports.INITIAL_RETRY_DELAY = void 0;
|
|
4
4
|
exports.withRetry = withRetry;
|
|
5
|
+
exports.withTimeout = withTimeout;
|
|
5
6
|
exports.INITIAL_RETRY_DELAY = 1000; // 1 second
|
|
6
7
|
async function withRetry(operation, options = {}) {
|
|
7
|
-
const { maxRetries = 3, shouldRetry = (error) => error?.type === 'APIConnectionError', onRetry = () => { }, retryDelayMs = exports.INITIAL_RETRY_DELAY } = options;
|
|
8
|
+
const { maxRetries = 3, shouldRetry = (error) => error?.type === 'APIConnectionError', onRetry = () => { }, retryDelayMs = exports.INITIAL_RETRY_DELAY, } = options;
|
|
8
9
|
let lastError = null;
|
|
9
10
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
10
11
|
try {
|
|
@@ -18,7 +19,7 @@ async function withRetry(operation, options = {}) {
|
|
|
18
19
|
onRetry(error, attempt + 1);
|
|
19
20
|
// Exponential backoff
|
|
20
21
|
const delayMs = retryDelayMs * Math.pow(2, attempt);
|
|
21
|
-
await new Promise(resolve => setTimeout(resolve, delayMs));
|
|
22
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
throw lastError;
|
|
@@ -54,4 +55,26 @@ const mapAsync = (items, f, maxConcurrentRequests = 20) => {
|
|
|
54
55
|
exports.mapAsync = mapAsync;
|
|
55
56
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
56
57
|
exports.sleep = sleep;
|
|
58
|
+
/**
|
|
59
|
+
* Wraps a promise with a timeout
|
|
60
|
+
* @param promise The promise to wrap
|
|
61
|
+
* @param timeoutMs Timeout in milliseconds
|
|
62
|
+
* @param timeoutMessage Optional message for the timeout error
|
|
63
|
+
* @returns A promise that resolves with the result of the original promise or rejects with a timeout error
|
|
64
|
+
*/
|
|
65
|
+
async function withTimeout(promise, timeoutMs, timeoutMessage = 'Operation timed out') {
|
|
66
|
+
let timeoutId;
|
|
67
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
68
|
+
timeoutId = setTimeout(() => {
|
|
69
|
+
reject(new Error(timeoutMessage));
|
|
70
|
+
}, timeoutMs);
|
|
71
|
+
});
|
|
72
|
+
return Promise.race([
|
|
73
|
+
promise.then((result) => {
|
|
74
|
+
clearTimeout(timeoutId);
|
|
75
|
+
return result;
|
|
76
|
+
}),
|
|
77
|
+
timeoutPromise,
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
57
80
|
//# sourceMappingURL=promise.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../../src/util/promise.ts"],"names":[],"mappings":";;;AAEA,8BAqCC;
|
|
1
|
+
{"version":3,"file":"promise.js","sourceRoot":"","sources":["../../src/util/promise.ts"],"names":[],"mappings":";;;AAEA,8BAqCC;AA2CD,kCAoBC;AAtGY,QAAA,mBAAmB,GAAG,IAAI,CAAA,CAAC,WAAW;AAE5C,KAAK,UAAU,SAAS,CAC7B,SAA2B,EAC3B,UAKI,EAAE;IAEN,MAAM,EACJ,UAAU,GAAG,CAAC,EACd,WAAW,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,oBAAoB,EAC7D,OAAO,GAAG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AY,CAAC,SAAS,CAAC,CAAA;YACvB,OAAO,MAAM,CAAA;QACf,CAAC,CAAC;QACF,cAAc;KACf,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a modified version of the Saxy library that emits text nodes immediately
|
|
3
|
+
*/
|
|
4
|
+
import { Transform } from 'readable-stream';
|
|
5
|
+
export type TextNode = {
|
|
6
|
+
/** The text value */
|
|
7
|
+
contents: string;
|
|
8
|
+
};
|
|
9
|
+
export type CDATANode = {
|
|
10
|
+
/** The CDATA contents */
|
|
11
|
+
contents: string;
|
|
12
|
+
};
|
|
13
|
+
export type CommentNode = {
|
|
14
|
+
/** The comment contents */
|
|
15
|
+
contents: string;
|
|
16
|
+
};
|
|
17
|
+
export type ProcessingInstructionNode = {
|
|
18
|
+
/** The instruction contents */
|
|
19
|
+
contents: string;
|
|
20
|
+
};
|
|
21
|
+
/** Information about an opened tag */
|
|
22
|
+
export type TagOpenNode = {
|
|
23
|
+
/** Name of the tag that was opened. */
|
|
24
|
+
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Attributes passed to the tag, in a string representation
|
|
27
|
+
* (use Saxy.parseAttributes to get an attribute-value mapping).
|
|
28
|
+
*/
|
|
29
|
+
attrs: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the tag self-closes (tags of the form `<tag />`).
|
|
32
|
+
* Such tags will not be followed by a closing tag.
|
|
33
|
+
*/
|
|
34
|
+
isSelfClosing: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** Information about a closed tag */
|
|
37
|
+
export type TagCloseNode = {
|
|
38
|
+
/** Name of the tag that was closed. */
|
|
39
|
+
name: string;
|
|
40
|
+
};
|
|
41
|
+
export type NextFunction = (err?: Error) => void;
|
|
42
|
+
export interface SaxyEvents {
|
|
43
|
+
finish: () => void;
|
|
44
|
+
error: (err: Error) => void;
|
|
45
|
+
text: (data: TextNode) => void;
|
|
46
|
+
cdata: (data: CDATANode) => void;
|
|
47
|
+
comment: (data: CommentNode) => void;
|
|
48
|
+
processinginstruction: (data: ProcessingInstructionNode) => void;
|
|
49
|
+
tagopen: (data: TagOpenNode) => void;
|
|
50
|
+
tagclose: (data: TagCloseNode) => void;
|
|
51
|
+
}
|
|
52
|
+
export type SaxyEventNames = keyof SaxyEvents;
|
|
53
|
+
export type SaxyEventArgs = Error | TextNode | CDATANode | CommentNode | ProcessingInstructionNode | TagOpenNode | TagCloseNode;
|
|
54
|
+
export interface Saxy {
|
|
55
|
+
on<U extends SaxyEventNames>(event: U, listener: SaxyEvents[U]): this;
|
|
56
|
+
on(event: string | symbol | Event, listener: (...args: any[]) => void): this;
|
|
57
|
+
once<U extends SaxyEventNames>(event: U, listener: SaxyEvents[U]): this;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Schema for defining allowed tags and their children
|
|
61
|
+
*/
|
|
62
|
+
export type TagSchema = {
|
|
63
|
+
[topLevelTag: string]: string[];
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Parse a string of XML attributes to a map of attribute names to their values.
|
|
67
|
+
*
|
|
68
|
+
* @param input A string of XML attributes
|
|
69
|
+
* @throws If the string is malformed
|
|
70
|
+
* @return A map of attribute names to their values
|
|
71
|
+
*/
|
|
72
|
+
export declare const parseAttrs: (input: string) => Record<string, unknown>;
|
|
73
|
+
/**
|
|
74
|
+
* Parse an XML stream and emit events corresponding
|
|
75
|
+
* to the different tokens encountered.
|
|
76
|
+
*/
|
|
77
|
+
export declare class Saxy extends Transform {
|
|
78
|
+
private _decoder;
|
|
79
|
+
private _tagStack;
|
|
80
|
+
private _waiting;
|
|
81
|
+
private _schema;
|
|
82
|
+
/**
|
|
83
|
+
* Parse a string of XML attributes to a map of attribute names
|
|
84
|
+
* to their values
|
|
85
|
+
*
|
|
86
|
+
* @param input A string of XML attributes
|
|
87
|
+
* @throws If the string is malformed
|
|
88
|
+
* @return A map of attribute names to their values
|
|
89
|
+
*/
|
|
90
|
+
static parseAttrs: (input: string) => Record<string, unknown>;
|
|
91
|
+
/**
|
|
92
|
+
* Expand a piece of XML text by replacing all XML entities
|
|
93
|
+
* by their canonical value. Ignore invalid and unknown
|
|
94
|
+
* entities
|
|
95
|
+
*
|
|
96
|
+
* @param input A string of XML text
|
|
97
|
+
* @return The input string, expanded
|
|
98
|
+
*/
|
|
99
|
+
static parseEntities: (input: string) => string;
|
|
100
|
+
/**
|
|
101
|
+
* Create a new parser instance.
|
|
102
|
+
* @param schema Optional schema defining allowed top-level tags and their children
|
|
103
|
+
*/
|
|
104
|
+
constructor(schema?: TagSchema);
|
|
105
|
+
/**
|
|
106
|
+
* Handle a chunk of data written into the stream.
|
|
107
|
+
*
|
|
108
|
+
* @param chunk Chunk of data.
|
|
109
|
+
* @param encoding Encoding of the string, or 'buffer'.
|
|
110
|
+
* @param callback Called when the chunk has been parsed, with
|
|
111
|
+
* an optional error argument.
|
|
112
|
+
*/
|
|
113
|
+
_write(chunk: Buffer | string, encoding: string, callback: NextFunction): void;
|
|
114
|
+
/**
|
|
115
|
+
* Handle the end of incoming data.
|
|
116
|
+
*
|
|
117
|
+
* @param callback
|
|
118
|
+
*/
|
|
119
|
+
_final(callback: NextFunction): void;
|
|
120
|
+
/**
|
|
121
|
+
* Immediately parse a complete chunk of XML and close the stream.
|
|
122
|
+
*
|
|
123
|
+
* @param input Input chunk.
|
|
124
|
+
*/
|
|
125
|
+
parse(input: Buffer | string): this;
|
|
126
|
+
/**
|
|
127
|
+
* Put the stream into waiting mode, which means we need more data
|
|
128
|
+
* to finish parsing the current token.
|
|
129
|
+
*
|
|
130
|
+
* @param token Type of token that is being parsed.
|
|
131
|
+
* @param data Pending data.
|
|
132
|
+
*/
|
|
133
|
+
private _wait;
|
|
134
|
+
/**
|
|
135
|
+
* Put the stream out of waiting mode.
|
|
136
|
+
*
|
|
137
|
+
* @return Any data that was pending.
|
|
138
|
+
*/
|
|
139
|
+
private _unwait;
|
|
140
|
+
/**
|
|
141
|
+
* Handle the opening of a tag in the text stream.
|
|
142
|
+
*
|
|
143
|
+
* Push the tag into the opened tag stack and emit the
|
|
144
|
+
* corresponding event on the event emitter.
|
|
145
|
+
*
|
|
146
|
+
* @param node Information about the opened tag.
|
|
147
|
+
*/
|
|
148
|
+
private _handleTagOpening;
|
|
149
|
+
/**
|
|
150
|
+
* Parse a XML chunk.
|
|
151
|
+
*
|
|
152
|
+
* @private
|
|
153
|
+
* @param input A string with the chunk data.
|
|
154
|
+
* @param callback Called when the chunk has been parsed, with
|
|
155
|
+
* an optional error argument.
|
|
156
|
+
*/
|
|
157
|
+
private _parseChunk;
|
|
158
|
+
}
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Saxy = exports.parseAttrs = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* This is a modified version of the Saxy library that emits text nodes immediately
|
|
6
|
+
*/
|
|
7
|
+
const readable_stream_1 = require("readable-stream");
|
|
8
|
+
const string_decoder_1 = require("string_decoder");
|
|
9
|
+
const string_1 = require("./string");
|
|
10
|
+
/**
|
|
11
|
+
* Nodes that can be found inside an XML stream.
|
|
12
|
+
*/
|
|
13
|
+
const Node = {
|
|
14
|
+
text: 'text',
|
|
15
|
+
cdata: 'cdata',
|
|
16
|
+
comment: 'comment',
|
|
17
|
+
processingInstruction: 'processinginstruction',
|
|
18
|
+
tagOpen: 'tagopen',
|
|
19
|
+
tagClose: 'tagclose',
|
|
20
|
+
// markupDeclaration: 'markupDeclaration',
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Expand a piece of XML text by replacing all XML entities by
|
|
24
|
+
* their canonical value. Ignore invalid and unknown entities.
|
|
25
|
+
*
|
|
26
|
+
* @param input A string of XML text
|
|
27
|
+
* @return The input string, expanded
|
|
28
|
+
*/
|
|
29
|
+
const parseEntities = (input) => {
|
|
30
|
+
let position = 0, next = 0;
|
|
31
|
+
const parts = [];
|
|
32
|
+
while ((next = input.indexOf('&', position)) !== -1) {
|
|
33
|
+
// remember anything there was before the entity
|
|
34
|
+
if (next > position) {
|
|
35
|
+
parts.push(input.slice(position, next));
|
|
36
|
+
}
|
|
37
|
+
const end = input.indexOf(';', next);
|
|
38
|
+
// ignore unterminated entities
|
|
39
|
+
if (end === -1) {
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
const entity = input.slice(next, end);
|
|
43
|
+
if (entity === '"') {
|
|
44
|
+
parts.push('"');
|
|
45
|
+
}
|
|
46
|
+
else if (entity === '&') {
|
|
47
|
+
parts.push('&');
|
|
48
|
+
}
|
|
49
|
+
else if (entity === '&apos') {
|
|
50
|
+
parts.push("'");
|
|
51
|
+
}
|
|
52
|
+
else if (entity === '<') {
|
|
53
|
+
parts.push('<');
|
|
54
|
+
}
|
|
55
|
+
else if (entity === '>') {
|
|
56
|
+
parts.push('>');
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// ignore unrecognized character entities
|
|
60
|
+
if (entity[1] !== '#') {
|
|
61
|
+
parts.push(entity + ';');
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// hexadecimal numeric entities
|
|
65
|
+
if (entity[2] == 'x') {
|
|
66
|
+
const value = parseInt(entity.slice(3), 16);
|
|
67
|
+
// ignore non-numeric numeric entities
|
|
68
|
+
if (isNaN(value)) {
|
|
69
|
+
parts.push(entity + ';');
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
parts.push(String.fromCharCode(value));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// decimal numeric entities
|
|
77
|
+
const value = parseInt(entity.slice(2), 10);
|
|
78
|
+
// ignore non-numeric numeric entities
|
|
79
|
+
if (isNaN(value)) {
|
|
80
|
+
parts.push(entity + ';');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
parts.push(String.fromCharCode(value));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
position = end + 1;
|
|
89
|
+
}
|
|
90
|
+
if (position < input.length) {
|
|
91
|
+
parts.push(input.slice(position));
|
|
92
|
+
}
|
|
93
|
+
return parts.join('');
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Parse a string of XML attributes to a map of attribute names to their values.
|
|
97
|
+
*
|
|
98
|
+
* @param input A string of XML attributes
|
|
99
|
+
* @throws If the string is malformed
|
|
100
|
+
* @return A map of attribute names to their values
|
|
101
|
+
*/
|
|
102
|
+
const parseAttrs = (input) => {
|
|
103
|
+
const attrs = {};
|
|
104
|
+
const end = input.length;
|
|
105
|
+
let position = 0;
|
|
106
|
+
while (position < end) {
|
|
107
|
+
// Skip all whitespace
|
|
108
|
+
if ((0, string_1.isWhitespace)(input[position])) {
|
|
109
|
+
position += 1;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
// Check that the attribute name contains valid chars
|
|
113
|
+
const startName = position;
|
|
114
|
+
while (input[position] !== '=' && position < end) {
|
|
115
|
+
if ((0, string_1.isWhitespace)(input[position])) {
|
|
116
|
+
throw new Error('Attribute names may not contain whitespace');
|
|
117
|
+
}
|
|
118
|
+
position += 1;
|
|
119
|
+
}
|
|
120
|
+
// This is XML, so we need a value for the attribute
|
|
121
|
+
if (position === end) {
|
|
122
|
+
throw new Error('Expected a value for the attribute');
|
|
123
|
+
}
|
|
124
|
+
const attrName = input.slice(startName, position);
|
|
125
|
+
position += 1;
|
|
126
|
+
const startQuote = input[position];
|
|
127
|
+
position += 1;
|
|
128
|
+
if (startQuote !== '"' && startQuote !== "'") {
|
|
129
|
+
throw new Error('Attribute values should be quoted');
|
|
130
|
+
}
|
|
131
|
+
const endQuote = input.indexOf(startQuote, position);
|
|
132
|
+
if (endQuote === -1) {
|
|
133
|
+
throw new Error('Unclosed attribute value');
|
|
134
|
+
}
|
|
135
|
+
const attrValue = input.slice(position, endQuote);
|
|
136
|
+
attrs[attrName] = attrValue;
|
|
137
|
+
position = endQuote + 1;
|
|
138
|
+
}
|
|
139
|
+
return attrs;
|
|
140
|
+
};
|
|
141
|
+
exports.parseAttrs = parseAttrs;
|
|
142
|
+
/**
|
|
143
|
+
* Find the first character in a string that matches a predicate
|
|
144
|
+
* while being outside the given delimiters.
|
|
145
|
+
*
|
|
146
|
+
* @param haystack String to search in
|
|
147
|
+
* @param predicate Checks whether a character is permissible
|
|
148
|
+
* @param [delim=''] Delimiter inside which no match should be
|
|
149
|
+
* returned. If empty, all characters are considered.
|
|
150
|
+
* @param [fromIndex=0] Start the search from this index
|
|
151
|
+
* @return Index of the first match, or -1 if no match
|
|
152
|
+
*/
|
|
153
|
+
const findIndexOutside = (haystack, predicate, delim = '', fromIndex = 0) => {
|
|
154
|
+
const length = haystack.length;
|
|
155
|
+
let index = fromIndex;
|
|
156
|
+
let inDelim = false;
|
|
157
|
+
while (index < length && (inDelim || !predicate(haystack[index]))) {
|
|
158
|
+
if (haystack[index] === delim) {
|
|
159
|
+
inDelim = !inDelim;
|
|
160
|
+
}
|
|
161
|
+
++index;
|
|
162
|
+
}
|
|
163
|
+
return index === length ? -1 : index;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Parse an XML stream and emit events corresponding
|
|
167
|
+
* to the different tokens encountered.
|
|
168
|
+
*/
|
|
169
|
+
class Saxy extends readable_stream_1.Transform {
|
|
170
|
+
_decoder;
|
|
171
|
+
_tagStack;
|
|
172
|
+
_waiting;
|
|
173
|
+
_schema;
|
|
174
|
+
/**
|
|
175
|
+
* Parse a string of XML attributes to a map of attribute names
|
|
176
|
+
* to their values
|
|
177
|
+
*
|
|
178
|
+
* @param input A string of XML attributes
|
|
179
|
+
* @throws If the string is malformed
|
|
180
|
+
* @return A map of attribute names to their values
|
|
181
|
+
*/
|
|
182
|
+
static parseAttrs = exports.parseAttrs;
|
|
183
|
+
/**
|
|
184
|
+
* Expand a piece of XML text by replacing all XML entities
|
|
185
|
+
* by their canonical value. Ignore invalid and unknown
|
|
186
|
+
* entities
|
|
187
|
+
*
|
|
188
|
+
* @param input A string of XML text
|
|
189
|
+
* @return The input string, expanded
|
|
190
|
+
*/
|
|
191
|
+
static parseEntities = parseEntities;
|
|
192
|
+
/**
|
|
193
|
+
* Create a new parser instance.
|
|
194
|
+
* @param schema Optional schema defining allowed top-level tags and their children
|
|
195
|
+
*/
|
|
196
|
+
constructor(schema) {
|
|
197
|
+
super({ decodeStrings: false });
|
|
198
|
+
// String decoder instance
|
|
199
|
+
const state = this._writableState;
|
|
200
|
+
this._decoder = new string_decoder_1.StringDecoder(state.defaultEncoding);
|
|
201
|
+
// Stack of tags that were opened up until the current cursor position
|
|
202
|
+
this._tagStack = [];
|
|
203
|
+
// Not waiting initially
|
|
204
|
+
this._waiting = null;
|
|
205
|
+
// Store schema if provided
|
|
206
|
+
this._schema = schema || null;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Handle a chunk of data written into the stream.
|
|
210
|
+
*
|
|
211
|
+
* @param chunk Chunk of data.
|
|
212
|
+
* @param encoding Encoding of the string, or 'buffer'.
|
|
213
|
+
* @param callback Called when the chunk has been parsed, with
|
|
214
|
+
* an optional error argument.
|
|
215
|
+
*/
|
|
216
|
+
_write(chunk, encoding, callback) {
|
|
217
|
+
const data = encoding === 'buffer'
|
|
218
|
+
? this._decoder.write(chunk)
|
|
219
|
+
: chunk;
|
|
220
|
+
this._parseChunk(data, callback);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Handle the end of incoming data.
|
|
224
|
+
*
|
|
225
|
+
* @param callback
|
|
226
|
+
*/
|
|
227
|
+
_final(callback) {
|
|
228
|
+
// Make sure all data has been extracted from the decoder
|
|
229
|
+
this._parseChunk(this._decoder.end(), (err) => {
|
|
230
|
+
if (err) {
|
|
231
|
+
callback(err);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
// Handle unclosed nodes
|
|
235
|
+
if (this._waiting !== null) {
|
|
236
|
+
switch (this._waiting.token) {
|
|
237
|
+
case Node.text:
|
|
238
|
+
// Text nodes are implicitly closed
|
|
239
|
+
this.emit('text', { contents: this._waiting.data });
|
|
240
|
+
break;
|
|
241
|
+
case Node.cdata:
|
|
242
|
+
callback(new Error('Unclosed CDATA section'));
|
|
243
|
+
return;
|
|
244
|
+
case Node.comment:
|
|
245
|
+
callback(new Error('Unclosed comment'));
|
|
246
|
+
return;
|
|
247
|
+
case Node.processingInstruction:
|
|
248
|
+
callback(new Error('Unclosed processing instruction'));
|
|
249
|
+
return;
|
|
250
|
+
case Node.tagOpen:
|
|
251
|
+
case Node.tagClose:
|
|
252
|
+
// We do not distinguish between unclosed opening
|
|
253
|
+
// or unclosed closing tags
|
|
254
|
+
callback(new Error('Unclosed tag'));
|
|
255
|
+
return;
|
|
256
|
+
default:
|
|
257
|
+
// Pass
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (this._tagStack.length !== 0) {
|
|
261
|
+
// callback(new Error(`Unclosed tags: ${this._tagStack.join(',')}`))
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
callback();
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Immediately parse a complete chunk of XML and close the stream.
|
|
269
|
+
*
|
|
270
|
+
* @param input Input chunk.
|
|
271
|
+
*/
|
|
272
|
+
parse(input) {
|
|
273
|
+
this.end(input);
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Put the stream into waiting mode, which means we need more data
|
|
278
|
+
* to finish parsing the current token.
|
|
279
|
+
*
|
|
280
|
+
* @param token Type of token that is being parsed.
|
|
281
|
+
* @param data Pending data.
|
|
282
|
+
*/
|
|
283
|
+
_wait(token, data) {
|
|
284
|
+
this._waiting = { token, data };
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Put the stream out of waiting mode.
|
|
288
|
+
*
|
|
289
|
+
* @return Any data that was pending.
|
|
290
|
+
*/
|
|
291
|
+
_unwait() {
|
|
292
|
+
if (this._waiting === null) {
|
|
293
|
+
return '';
|
|
294
|
+
}
|
|
295
|
+
const data = this._waiting.data;
|
|
296
|
+
this._waiting = null;
|
|
297
|
+
return data;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Handle the opening of a tag in the text stream.
|
|
301
|
+
*
|
|
302
|
+
* Push the tag into the opened tag stack and emit the
|
|
303
|
+
* corresponding event on the event emitter.
|
|
304
|
+
*
|
|
305
|
+
* @param node Information about the opened tag.
|
|
306
|
+
*/
|
|
307
|
+
_handleTagOpening(node) {
|
|
308
|
+
const { name } = node;
|
|
309
|
+
// If we have a schema, validate against it
|
|
310
|
+
if (this._schema) {
|
|
311
|
+
// For top-level tags
|
|
312
|
+
if (this._tagStack.length === 0) {
|
|
313
|
+
// Ignore if not in schema
|
|
314
|
+
if (!this._schema[name]) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// For nested tags
|
|
319
|
+
else {
|
|
320
|
+
const parentTag = this._tagStack[this._tagStack.length - 1];
|
|
321
|
+
// Ignore if parent not in schema or this tag not allowed as child
|
|
322
|
+
if (!this._schema[parentTag] ||
|
|
323
|
+
!this._schema[parentTag].includes(name)) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (!node.isSelfClosing) {
|
|
329
|
+
this._tagStack.push(node.name);
|
|
330
|
+
}
|
|
331
|
+
this.emit(Node.tagOpen, node);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Parse a XML chunk.
|
|
335
|
+
*
|
|
336
|
+
* @private
|
|
337
|
+
* @param input A string with the chunk data.
|
|
338
|
+
* @param callback Called when the chunk has been parsed, with
|
|
339
|
+
* an optional error argument.
|
|
340
|
+
*/
|
|
341
|
+
_parseChunk(input, callback) {
|
|
342
|
+
// Use pending data if applicable and get out of waiting mode
|
|
343
|
+
input = this._unwait() + input;
|
|
344
|
+
let chunkPos = 0;
|
|
345
|
+
const end = input.length;
|
|
346
|
+
while (chunkPos < end) {
|
|
347
|
+
if (input[chunkPos] !== '<') {
|
|
348
|
+
const nextTag = input.indexOf('<', chunkPos);
|
|
349
|
+
// We read a TEXT node but there might be some
|
|
350
|
+
// more text data left, so we wait
|
|
351
|
+
if (nextTag === -1) {
|
|
352
|
+
// this._wait(Node.text, input.slice(chunkPos))
|
|
353
|
+
let chunk = input.slice(chunkPos);
|
|
354
|
+
if (this._tagStack.length === 1) {
|
|
355
|
+
// Trim whitespace for text within top level tags
|
|
356
|
+
chunk = chunk.trim();
|
|
357
|
+
}
|
|
358
|
+
if (chunk.length > 0) {
|
|
359
|
+
// NOTE (James): We changed this to emit the partial text node immediately
|
|
360
|
+
this.emit(Node.text, { contents: chunk });
|
|
361
|
+
}
|
|
362
|
+
chunkPos = end;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
// A tag follows, so we can be confident that
|
|
366
|
+
// we have all the data needed for the TEXT node
|
|
367
|
+
let chunk = input.slice(chunkPos, nextTag);
|
|
368
|
+
if (this._tagStack.length === 1) {
|
|
369
|
+
// Trim whitespace for text within top level tags
|
|
370
|
+
chunk = chunk.trim();
|
|
371
|
+
}
|
|
372
|
+
// Only emit non-whitespace text or text within a single tag (not between tags)
|
|
373
|
+
if (chunk.length > 0) {
|
|
374
|
+
this.emit(Node.text, { contents: chunk });
|
|
375
|
+
}
|
|
376
|
+
chunkPos = nextTag;
|
|
377
|
+
}
|
|
378
|
+
// Invariant: the cursor now points on the name of a tag,
|
|
379
|
+
// after an opening angled bracket
|
|
380
|
+
chunkPos += 1;
|
|
381
|
+
// Recognize regular tags (< ... >)
|
|
382
|
+
const tagClose = findIndexOutside(input, (char) => char === '>', '"', chunkPos);
|
|
383
|
+
if (tagClose === -1) {
|
|
384
|
+
this._wait(Node.tagOpen, input.slice(chunkPos - 1));
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
// Check if the tag is a closing tag
|
|
388
|
+
if (input[chunkPos] === '/') {
|
|
389
|
+
const tagName = input.slice(chunkPos + 1, tagClose);
|
|
390
|
+
const stackedTagName = this._tagStack[this._tagStack.length - 1];
|
|
391
|
+
// Only emit close tag if it matches schema validation
|
|
392
|
+
if (this._schema) {
|
|
393
|
+
// For top-level tags
|
|
394
|
+
if (this._tagStack.length === 1) {
|
|
395
|
+
if (!this._schema[tagName]) {
|
|
396
|
+
chunkPos = tagClose + 1;
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// For nested tags
|
|
401
|
+
else {
|
|
402
|
+
const parentTag = this._tagStack[this._tagStack.length - 2];
|
|
403
|
+
if (!this._schema[parentTag] ||
|
|
404
|
+
!this._schema[parentTag].includes(tagName)) {
|
|
405
|
+
chunkPos = tagClose + 1;
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
this._tagStack.pop();
|
|
411
|
+
// Only emit if the tag matches what we expect
|
|
412
|
+
if (stackedTagName === tagName) {
|
|
413
|
+
this.emit(Node.tagClose, { name: tagName });
|
|
414
|
+
}
|
|
415
|
+
chunkPos = tagClose + 1;
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
// Check if the tag is self-closing
|
|
419
|
+
const isSelfClosing = input[tagClose - 1] === '/';
|
|
420
|
+
let realTagClose = isSelfClosing ? tagClose - 1 : tagClose;
|
|
421
|
+
// Extract the tag name and attributes
|
|
422
|
+
const whitespace = input.slice(chunkPos).search(/\s/);
|
|
423
|
+
if (whitespace === -1 || whitespace >= tagClose - chunkPos) {
|
|
424
|
+
// Tag without any attribute
|
|
425
|
+
this._handleTagOpening({
|
|
426
|
+
name: input.slice(chunkPos, realTagClose),
|
|
427
|
+
attrs: '',
|
|
428
|
+
isSelfClosing,
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
else if (whitespace === 0) {
|
|
432
|
+
// console.log('Tag names may not start with whitespace:', input)
|
|
433
|
+
// callback(new Error('Tag names may not start with whitespace'))
|
|
434
|
+
// return
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
// Tag with attributes
|
|
438
|
+
this._handleTagOpening({
|
|
439
|
+
name: input.slice(chunkPos, chunkPos + whitespace),
|
|
440
|
+
attrs: input.slice(chunkPos + whitespace, realTagClose),
|
|
441
|
+
isSelfClosing,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
chunkPos = tagClose + 1;
|
|
445
|
+
}
|
|
446
|
+
callback();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
exports.Saxy = Saxy;
|
|
450
|
+
//# sourceMappingURL=saxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saxy.js","sourceRoot":"","sources":["../../src/util/saxy.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,qDAA2C;AAC3C,mDAA8C;AAC9C,qCAAuC;AAiFvC;;GAEG;AACH,MAAM,IAAI,GAAG;IACX,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,qBAAqB,EAAE,uBAAuB;IAC9C,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,0CAA0C;CACT,CAAA;AAEnC;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE;IACtC,IAAI,QAAQ,GAAG,CAAC,EACd,IAAI,GAAG,CAAC,CAAA;IACV,MAAM,KAAK,GAAG,EAAE,CAAA;IAEhB,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACpD,gDAAgD;QAChD,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;YACpB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAA;QACzC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