@opensip-cli/lang-rust 0.1.7 → 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-rust
|
|
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,gFAAgF;AAChF,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC;AAElC,oFAAoF;AACpF,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAK7E"}
|
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 Rust 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-rust.wasm', import.meta.url)));
|
|
22
|
+
parser = createParser(grammar);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
logger.warn({
|
|
26
|
+
evt: 'lang.grammar.load_failed',
|
|
27
|
+
module: 'lang:rust',
|
|
28
|
+
msg: `Rust grammar failed to load — Rust analysis is unavailable this run: ${error instanceof Error ? error.message : String(error)}`,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
16
31
|
/** Parses Rust source into a {@link RustTree}, or null when no tree is produced. */
|
|
17
32
|
export function parseRust(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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AC,CAAC,EAAE,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-rust",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Rust language adapter for opensip-cli",
|
|
6
6
|
"keywords": [
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"NOTICE"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@opensip-cli/core": "0.1.
|
|
38
|
-
"@opensip-cli/tree-sitter": "0.1.
|
|
37
|
+
"@opensip-cli/core": "0.1.8",
|
|
38
|
+
"@opensip-cli/tree-sitter": "0.1.8"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^24.13.2",
|