@codebolt/codeboltjs 1.1.35 → 1.1.36
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/index.d.ts +1 -1
- package/modules/codeutils.d.ts +2 -2
- package/modules/codeutils.js +2 -2
- package/package.json +1 -1
- package/src/modules/codeutils.ts +3 -3
package/index.d.ts
CHANGED
|
@@ -131,7 +131,7 @@ declare class Codebolt {
|
|
|
131
131
|
executeCommandWithStream(command: string): EventEmitter<[never]>;
|
|
132
132
|
};
|
|
133
133
|
codeutils: {
|
|
134
|
-
getJsTree: (filePath?: string | undefined) => Promise<
|
|
134
|
+
getJsTree: (filePath?: string | undefined) => Promise<any>;
|
|
135
135
|
getAllFilesAsMarkDown: () => Promise<string>;
|
|
136
136
|
performMatch: (matcherDefinition: object, problemPatterns: any[], problems: any[]) => Promise<import("@codebolt/types").MatchProblemResponse>;
|
|
137
137
|
getMatcherList: () => Promise<import("@codebolt/types").GetMatcherListTreeResponse>;
|
package/modules/codeutils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MatchProblemResponse, GetMatcherListTreeResponse, getMatchDetail } from '@codebolt/types';
|
|
2
2
|
/**
|
|
3
3
|
* A utility module for working with code.
|
|
4
4
|
*/
|
|
@@ -8,7 +8,7 @@ declare const cbcodeutils: {
|
|
|
8
8
|
* @param {string} filePath - The path of the file to retrieve the JS tree for.
|
|
9
9
|
* @returns {Promise<GetJsTreeResponse>} A promise that resolves with the JS tree response.
|
|
10
10
|
*/
|
|
11
|
-
getJsTree: (filePath?: string) => Promise<
|
|
11
|
+
getJsTree: (filePath?: string) => Promise<any>;
|
|
12
12
|
/**
|
|
13
13
|
* Retrieves all files as Markdown.
|
|
14
14
|
* @returns {Promise<string>} A promise that resolves with the Markdown content of all files.
|
package/modules/codeutils.js
CHANGED
|
@@ -84,11 +84,11 @@ const cbcodeutils = {
|
|
|
84
84
|
let tree = parser.parse(code);
|
|
85
85
|
trees.push(tree);
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
resolve({ event: 'GetJsTreeResponse', payload: trees }); // Return an array of abstract syntax trees (ASTs)
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
90
|
console.error('An error occurred:', error);
|
|
91
|
-
return null; // Return null in case of error
|
|
91
|
+
return { event: 'GetJsTreeResponse', payload: null }; // Return null in case of error
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
});
|
package/package.json
CHANGED
package/src/modules/codeutils.ts
CHANGED
|
@@ -16,7 +16,7 @@ const cbcodeutils = {
|
|
|
16
16
|
* @param {string} filePath - The path of the file to retrieve the JS tree for.
|
|
17
17
|
* @returns {Promise<GetJsTreeResponse>} A promise that resolves with the JS tree response.
|
|
18
18
|
*/
|
|
19
|
-
getJsTree: (filePath?: string): Promise<
|
|
19
|
+
getJsTree: (filePath?: string): Promise<any> => {
|
|
20
20
|
return new Promise( async (resolve, reject) => {
|
|
21
21
|
cbws.getWebsocket.send(JSON.stringify({
|
|
22
22
|
"type": "settingEvent",
|
|
@@ -62,10 +62,10 @@ const cbcodeutils = {
|
|
|
62
62
|
trees.push(tree);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
resolve({ event: 'GetJsTreeResponse',payload:trees}); // Return an array of abstract syntax trees (ASTs)
|
|
66
66
|
} catch (error) {
|
|
67
67
|
console.error('An error occurred:', error);
|
|
68
|
-
return null; // Return null in case of error
|
|
68
|
+
return { event: 'GetJsTreeResponse',payload:null}; // Return null in case of error
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
});
|