@opensip-cli/lang-go 0.1.6 → 0.1.8
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 +2 -2
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +20 -2
- package/dist/parse.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -23,8 +23,8 @@ This package is published for the CLI and advanced plugin authors; most users sh
|
|
|
23
23
|
## Documentation
|
|
24
24
|
|
|
25
25
|
- 📚 Project docs: https://opensip.ai/docs/opensip-cli/
|
|
26
|
-
- 🧭 Package catalog (what every package does): https://github.com/opensip-ai/opensip-cli/blob/v0.1.
|
|
27
|
-
- 📦 Source: https://github.com/opensip-ai/opensip-cli/tree/v0.1.
|
|
26
|
+
- 🧭 Package catalog (what every package does): https://github.com/opensip-ai/opensip-cli/blob/v0.1.8/docs/public/70-reference/02-package-catalog.md
|
|
27
|
+
- 📦 Source: https://github.com/opensip-ai/opensip-cli/tree/v0.1.8/packages/languages/lang-go
|
|
28
28
|
|
|
29
29
|
## License
|
|
30
30
|
|
package/dist/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAA0C,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAqBnG,8EAA8E;AAC9E,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAEhC,gFAAgF;AAChF,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKzE"}
|
package/dist/parse.js
CHANGED
|
@@ -10,11 +10,29 @@
|
|
|
10
10
|
* (non-null) rather than throwing.
|
|
11
11
|
*/
|
|
12
12
|
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { logger } from '@opensip-cli/core';
|
|
13
14
|
import { loadGrammar, createParser, parseToTree } from '@opensip-cli/tree-sitter';
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
// Load the grammar once at module top level (keeps parse() synchronous). A
|
|
16
|
+
// missing/corrupt/ABI-mismatched .wasm must NOT crash the whole CLI — contain
|
|
17
|
+
// the failure so Go analysis degrades to "unavailable" (parse returns null).
|
|
18
|
+
let parser;
|
|
19
|
+
/* v8 ignore start -- grammar-load failure is environment-dependent (bad/missing .wasm); not reproducible under the test runner */
|
|
20
|
+
try {
|
|
21
|
+
const grammar = await loadGrammar(fileURLToPath(new URL('../wasm/tree-sitter-go.wasm', import.meta.url)));
|
|
22
|
+
parser = createParser(grammar);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
logger.warn({
|
|
26
|
+
evt: 'lang.grammar.load_failed',
|
|
27
|
+
module: 'lang:go',
|
|
28
|
+
msg: `Go grammar failed to load — Go analysis is unavailable this run: ${error instanceof Error ? error.message : String(error)}`,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
16
31
|
/** Parses Go source into a {@link GoTree}, or null when no tree is produced. */
|
|
17
32
|
export function parseGo(content, _filePath) {
|
|
33
|
+
/* v8 ignore next -- defensive: parser is undefined only when the grammar failed to load */
|
|
34
|
+
if (!parser)
|
|
35
|
+
return null;
|
|
18
36
|
const tree = parseToTree(parser, content);
|
|
19
37
|
return tree ? { tree, source: content } : null;
|
|
20
38
|
}
|
package/dist/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAmB,MAAM,0B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AAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensip-cli/lang-go",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Go language adapter for opensip-cli",
|
|
6
6
|
"keywords": [
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"NOTICE"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@opensip-cli/
|
|
39
|
-
"@opensip-cli/
|
|
38
|
+
"@opensip-cli/tree-sitter": "0.1.8",
|
|
39
|
+
"@opensip-cli/core": "0.1.8"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^24.13.2",
|