pi-lens 3.8.2 → 3.8.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-lens",
3
- "version": "3.8.2",
3
+ "version": "3.8.4",
4
4
  "type": "module",
5
5
  "description": "Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "rust:test": "cargo test --manifest-path rust/Cargo.toml --all-targets --all-features",
21
21
  "rust:build": "cargo build --manifest-path rust/Cargo.toml --release",
22
22
  "rust:build:debug": "cargo build --manifest-path rust/Cargo.toml",
23
- "download-grammars": "node --experimental-strip-types scripts/download-grammars.ts",
24
- "postinstall": "node --experimental-strip-types scripts/download-grammars.ts"
23
+ "download-grammars": "node scripts/download-grammars.js",
24
+ "postinstall": "node scripts/download-grammars.js"
25
25
  },
26
26
  "keywords": [
27
27
  "pi",
@@ -46,7 +46,7 @@
46
46
  "commands/**/*.ts",
47
47
  "rules/",
48
48
  "skills/",
49
- "scripts/download-grammars.ts",
49
+ "scripts/download-grammars.js",
50
50
  "rust/src/",
51
51
  "rust/Cargo.toml",
52
52
  "default-architect.yaml",
@@ -67,6 +67,7 @@
67
67
  "dependencies": {
68
68
  "@sinclair/typebox": "^0.34.0",
69
69
  "cross-spawn": "^7.0.6",
70
+ "typescript": "^5.0.0",
70
71
  "vscode-jsonrpc": "^8.2.1"
71
72
  },
72
73
  "optionalDependencies": {
@@ -1,78 +1,72 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Downloads tree-sitter WASM grammar files into node_modules/web-tree-sitter/grammars/.
4
- * Run automatically via postinstall. Skips gracefully if grammars already exist.
5
- *
6
- * Source: tree-sitter-wasms package on unpkg (mirrors npm registry artifacts).
7
- */
8
-
9
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
10
- import { dirname, join } from "node:path";
11
- import { fileURLToPath } from "node:url";
12
-
13
- const TREE_SITTER_WASMS_VERSION = "0.1.13";
14
- const BASE_URL = `https://unpkg.com/tree-sitter-wasms@${TREE_SITTER_WASMS_VERSION}/out`;
15
-
16
- const GRAMMARS = [
17
- "tree-sitter-typescript.wasm",
18
- "tree-sitter-tsx.wasm",
19
- "tree-sitter-javascript.wasm",
20
- "tree-sitter-python.wasm",
21
- "tree-sitter-rust.wasm",
22
- "tree-sitter-go.wasm",
23
- "tree-sitter-java.wasm",
24
- "tree-sitter-c.wasm",
25
- "tree-sitter-cpp.wasm",
26
- "tree-sitter-ruby.wasm",
27
- ];
28
-
29
- function findGrammarsDir(): string {
30
- const scriptDir = dirname(fileURLToPath(import.meta.url));
31
- const pkgRoot = dirname(scriptDir);
32
- // Prefer local node_modules next to this package
33
- return join(pkgRoot, "node_modules", "web-tree-sitter", "grammars");
34
- }
35
-
36
- async function downloadGrammar(destDir: string, filename: string): Promise<void> {
37
- const dest = join(destDir, filename);
38
- if (existsSync(dest)) {
39
- console.log(` skip ${filename} (already exists)`);
40
- return;
41
- }
42
- const url = `${BASE_URL}/${filename}`;
43
- const res = await fetch(url);
44
- if (!res.ok) throw new Error(`HTTP ${res.status} fetching ${url}`);
45
- const buf = await res.arrayBuffer();
46
- writeFileSync(dest, Buffer.from(buf));
47
- console.log(` ok ${filename}`);
48
- }
49
-
50
- async function main(): Promise<void> {
51
- const grammarsDir = findGrammarsDir();
52
-
53
- if (!existsSync(grammarsDir)) {
54
- mkdirSync(grammarsDir, { recursive: true });
55
- }
56
-
57
- console.log(`Downloading tree-sitter grammars → ${grammarsDir}`);
58
-
59
- const results = await Promise.allSettled(
60
- GRAMMARS.map((g) => downloadGrammar(grammarsDir, g)),
61
- );
62
-
63
- const failed = results.filter((r) => r.status === "rejected");
64
- if (failed.length > 0) {
65
- for (const f of failed) {
66
- console.warn(" warn ", (f as PromiseRejectedResult).reason?.message);
67
- }
68
- console.warn(`${failed.length} grammar(s) failed — tree-sitter analysis may be unavailable.`);
69
- } else {
70
- console.log("All grammars downloaded successfully.");
71
- }
72
- }
73
-
74
- main().catch((err) => {
75
- // Never fail the install — tree-sitter is optional
76
- console.warn("Warning: grammar download failed:", err.message);
77
- process.exit(0);
78
- });
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Downloads tree-sitter WASM grammar files into node_modules/web-tree-sitter/grammars/.
4
+ * Run automatically via postinstall. Skips gracefully if grammars already exist.
5
+ *
6
+ * Source: tree-sitter-wasms package on unpkg (mirrors npm registry artifacts).
7
+ */
8
+
9
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
10
+ import { dirname, join } from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+
13
+ const TREE_SITTER_WASMS_VERSION = "0.1.13";
14
+ const BASE_URL = `https://unpkg.com/tree-sitter-wasms@${TREE_SITTER_WASMS_VERSION}/out`;
15
+
16
+ const GRAMMARS = [
17
+ "tree-sitter-typescript.wasm",
18
+ "tree-sitter-tsx.wasm",
19
+ "tree-sitter-javascript.wasm",
20
+ "tree-sitter-python.wasm",
21
+ "tree-sitter-rust.wasm",
22
+ "tree-sitter-go.wasm",
23
+ "tree-sitter-java.wasm",
24
+ "tree-sitter-c.wasm",
25
+ "tree-sitter-cpp.wasm",
26
+ "tree-sitter-ruby.wasm",
27
+ ];
28
+
29
+ function findGrammarsDir() {
30
+ const scriptDir = dirname(fileURLToPath(import.meta.url));
31
+ const pkgRoot = dirname(scriptDir);
32
+ return join(pkgRoot, "node_modules", "web-tree-sitter", "grammars");
33
+ }
34
+
35
+ async function downloadGrammar(destDir, filename) {
36
+ const dest = join(destDir, filename);
37
+ if (existsSync(dest)) {
38
+ console.log(` skip ${filename} (already exists)`);
39
+ return;
40
+ }
41
+ const url = `${BASE_URL}/${filename}`;
42
+ const res = await fetch(url);
43
+ if (!res.ok) throw new Error(`HTTP ${res.status} fetching ${url}`);
44
+ const buf = await res.arrayBuffer();
45
+ writeFileSync(dest, Buffer.from(buf));
46
+ console.log(` ok ${filename}`);
47
+ }
48
+
49
+ async function main() {
50
+ const grammarsDir = findGrammarsDir();
51
+ if (!existsSync(grammarsDir)) {
52
+ mkdirSync(grammarsDir, { recursive: true });
53
+ }
54
+ console.log(`Downloading tree-sitter grammars to ${grammarsDir}`);
55
+ const results = await Promise.allSettled(
56
+ GRAMMARS.map((g) => downloadGrammar(grammarsDir, g)),
57
+ );
58
+ const failed = results.filter((r) => r.status === "rejected");
59
+ if (failed.length > 0) {
60
+ for (const f of failed) {
61
+ console.warn(" warn ", f.reason?.message);
62
+ }
63
+ console.warn(`${failed.length} grammar(s) failed - tree-sitter analysis may be unavailable.`);
64
+ } else {
65
+ console.log("All grammars downloaded successfully.");
66
+ }
67
+ }
68
+
69
+ main().catch((err) => {
70
+ console.warn("Warning: grammar download failed:", err.message);
71
+ process.exit(0);
72
+ });