@nirnex/parser 4.1.3 → 4.2.1

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/index.d.ts CHANGED
@@ -18,5 +18,32 @@ export interface ParsedModule {
18
18
  endLine: number;
19
19
  }>;
20
20
  }
21
+ export type ParseStage = 'read_file' | 'decode_file' | 'select_language' | 'set_language' | 'parse' | 'postprocess_ast';
22
+ export interface ParseFileDiagnostics {
23
+ file: string;
24
+ extension: string;
25
+ size_bytes: number;
26
+ content_sha256?: string;
27
+ char_length?: number;
28
+ has_bom?: boolean;
29
+ has_null_bytes?: boolean;
30
+ newline_style?: 'LF' | 'CRLF' | 'mixed' | 'unknown';
31
+ selected_language?: string;
32
+ grammar_variant?: string;
33
+ language_set?: boolean;
34
+ input_type?: string;
35
+ stage: ParseStage;
36
+ error_name: string;
37
+ error_message: string;
38
+ stack?: string;
39
+ }
40
+ export type ParseFileResult = {
41
+ ok: true;
42
+ module: ParsedModule;
43
+ } | {
44
+ ok: false;
45
+ diagnostics: ParseFileDiagnostics;
46
+ };
47
+ export declare function parseFileWithDiagnostics(filePath: string): ParseFileResult;
21
48
  export declare function parseFile(filePath: string): ParsedModule | null;
22
49
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACrD,OAAO,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAA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AAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GAClC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAsFrD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CA6G1E;AAID,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAY/D"}
package/dist/index.js CHANGED
@@ -2,106 +2,201 @@ import Parser from 'tree-sitter';
2
2
  import tsLanguage from 'tree-sitter-typescript';
3
3
  import fs from 'node:fs';
4
4
  import path from 'node:path';
5
+ import crypto from 'node:crypto';
5
6
  const parser = new Parser();
6
- export function parseFile(filePath) {
7
+ // ─── AST traversal (shared) ──────────────────────────────────────────────────
8
+ function traverseAST(tree) {
9
+ const imports = [];
10
+ const exports = [];
11
+ const declarations = [];
12
+ const traverse = (node) => {
13
+ if (node.type === 'import_statement') {
14
+ let source = '';
15
+ const specifiers = [];
16
+ for (const child of node.children) {
17
+ if (child.type === 'string') {
18
+ source = child.text.slice(1, -1);
19
+ }
20
+ else if (child.type === 'import_clause') {
21
+ for (const c of child.children) {
22
+ if (c.type === 'identifier') {
23
+ specifiers.push(c.text);
24
+ }
25
+ else if (c.type === 'named_imports') {
26
+ for (const nc of c.children) {
27
+ if (nc.type === 'import_specifier')
28
+ specifiers.push(nc.text);
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
34
+ if (source)
35
+ imports.push({ source, specifiers });
36
+ }
37
+ if (node.type === 'export_statement') {
38
+ let isDefault = false;
39
+ for (const child of node.children) {
40
+ if (child.type === 'default')
41
+ isDefault = true;
42
+ if (child.type === 'export_clause') {
43
+ for (const c of child.children) {
44
+ if (c.type === 'export_specifier')
45
+ exports.push({ name: c.text, isDefault: false });
46
+ }
47
+ }
48
+ if (child.type === 'class_declaration' ||
49
+ child.type === 'function_declaration' ||
50
+ child.type === 'lexical_declaration') {
51
+ const nameNode = child.children.find(c => c.type === 'identifier');
52
+ if (nameNode) {
53
+ exports.push({ name: nameNode.text, isDefault });
54
+ }
55
+ else if (child.type === 'lexical_declaration') {
56
+ const declC = child.children.find(c => c.type === 'variable_declarator');
57
+ if (declC) {
58
+ const idNode = declC.children.find(c => c.type === 'identifier');
59
+ if (idNode)
60
+ exports.push({ name: idNode.text, isDefault });
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ if (node.type === 'function_declaration' || node.type === 'class_declaration') {
67
+ const nameNode = node.children.find(c => c.type === 'identifier');
68
+ if (nameNode) {
69
+ declarations.push({
70
+ name: nameNode.text,
71
+ kind: node.type.split('_')[0],
72
+ startLine: node.startPosition.row + 1,
73
+ endLine: node.endPosition.row + 1,
74
+ });
75
+ }
76
+ }
77
+ for (const child of node.children)
78
+ traverse(child);
79
+ };
80
+ traverse(tree.rootNode);
81
+ return { imports, exports, declarations };
82
+ }
83
+ // ─── Stage-aware parse with full diagnostics ────────────────────────────────
84
+ export function parseFileWithDiagnostics(filePath) {
85
+ let stage = 'read_file';
86
+ let size_bytes = 0;
87
+ let content_sha256;
88
+ let char_length;
89
+ let has_bom;
90
+ let has_null_bytes;
91
+ let newline_style;
92
+ let selected_language;
93
+ let language_set = false;
94
+ let input_type;
7
95
  try {
8
96
  const ext = path.extname(filePath);
9
97
  if (!['.ts', '.tsx'].includes(ext)) {
10
- return null;
98
+ return {
99
+ ok: false,
100
+ diagnostics: {
101
+ file: filePath,
102
+ extension: ext,
103
+ size_bytes: 0,
104
+ stage: 'select_language',
105
+ error_name: 'UnsupportedExtension',
106
+ error_message: `File extension "${ext}" is not supported by nirnex parser (expected .ts or .tsx)`,
107
+ },
108
+ };
11
109
  }
12
- const content = fs.readFileSync(filePath, 'utf-8');
110
+ // ── Stage: read_file ──────────────────────────────────────────────────
111
+ stage = 'read_file';
112
+ size_bytes = fs.statSync(filePath).size;
113
+ const rawBuffer = fs.readFileSync(filePath);
114
+ // ── Stage: decode_file ────────────────────────────────────────────────
115
+ stage = 'decode_file';
116
+ has_bom = rawBuffer[0] === 0xef && rawBuffer[1] === 0xbb && rawBuffer[2] === 0xbf;
117
+ has_null_bytes = rawBuffer.indexOf(0x00) !== -1;
118
+ content_sha256 = crypto.createHash('sha256').update(rawBuffer).digest('hex').slice(0, 16);
119
+ const content = rawBuffer.toString('utf-8');
120
+ char_length = content.length;
121
+ input_type = typeof content;
122
+ // Newline style detection
123
+ const crlfCount = (content.match(/\r\n/g) ?? []).length;
124
+ const lfCount = (content.match(/(?<!\r)\n/g) ?? []).length;
125
+ if (crlfCount > 0 && lfCount > 0)
126
+ newline_style = 'mixed';
127
+ else if (crlfCount > 0)
128
+ newline_style = 'CRLF';
129
+ else if (lfCount > 0)
130
+ newline_style = 'LF';
131
+ else
132
+ newline_style = 'unknown';
133
+ // ── Stage: select_language ────────────────────────────────────────────
134
+ stage = 'select_language';
13
135
  const tsLang = tsLanguage;
136
+ selected_language = ext === '.tsx' ? 'tsx' : 'typescript';
137
+ // ── Stage: set_language ───────────────────────────────────────────────
138
+ stage = 'set_language';
14
139
  if (ext === '.tsx') {
15
140
  parser.setLanguage(tsLang.tsx);
16
141
  }
17
142
  else {
18
143
  parser.setLanguage(tsLang.typescript);
19
144
  }
145
+ language_set = true;
146
+ // ── Stage: parse ──────────────────────────────────────────────────────
147
+ stage = 'parse';
20
148
  const tree = parser.parse(content);
21
- const imports = [];
22
- const exports = [];
23
- const declarations = [];
24
- const traverse = (node) => {
25
- if (node.type === 'import_statement') {
26
- let source = '';
27
- const specifiers = [];
28
- for (const child of node.children) {
29
- if (child.type === 'string') {
30
- source = child.text.slice(1, -1);
31
- }
32
- else if (child.type === 'import_clause') {
33
- for (const c of child.children) {
34
- if (c.type === 'identifier') {
35
- specifiers.push(c.text);
36
- }
37
- else if (c.type === 'named_imports') {
38
- for (const nc of c.children) {
39
- if (nc.type === 'import_specifier') {
40
- specifiers.push(nc.text);
41
- }
42
- }
43
- }
44
- }
45
- }
46
- }
47
- if (source)
48
- imports.push({ source, specifiers });
49
- }
50
- if (node.type === 'export_statement') {
51
- let isDefault = false;
52
- for (const child of node.children) {
53
- if (child.type === 'default')
54
- isDefault = true;
55
- if (child.type === 'export_clause') {
56
- for (const c of child.children) {
57
- if (c.type === 'export_specifier')
58
- exports.push({ name: c.text, isDefault: false });
59
- }
60
- }
61
- if (child.type === 'class_declaration' || child.type === 'function_declaration' || child.type === 'lexical_declaration') {
62
- const nameNode = child.children.find(c => c.type === 'identifier');
63
- if (nameNode) {
64
- exports.push({ name: nameNode.text, isDefault });
65
- }
66
- else if (child.type === 'lexical_declaration') {
67
- const declC = child.children.find(c => c.type === 'variable_declarator');
68
- if (declC) {
69
- const idNode = declC.children.find(c => c.type === 'identifier');
70
- if (idNode)
71
- exports.push({ name: idNode.text, isDefault });
72
- }
73
- }
74
- }
75
- }
76
- }
77
- if (node.type === 'function_declaration' || node.type === 'class_declaration') {
78
- const nameNode = node.children.find(c => c.type === 'identifier');
79
- if (nameNode) {
80
- declarations.push({
81
- name: nameNode.text,
82
- kind: node.type.split('_')[0],
83
- startLine: node.startPosition.row + 1,
84
- endLine: node.endPosition.row + 1
85
- });
86
- }
87
- }
88
- for (const child of node.children)
89
- traverse(child);
90
- };
91
- traverse(tree.rootNode);
149
+ // ── Stage: postprocess_ast ────────────────────────────────────────────
150
+ stage = 'postprocess_ast';
151
+ const { imports, exports, declarations } = traverseAST(tree);
92
152
  return {
93
- path: filePath,
94
- name: path.basename(filePath),
95
- language: ext === '.tsx' ? 'tsx' : 'typescript',
96
- loc: content.split('\n').length,
97
- imports,
98
- exports,
99
- declarations
153
+ ok: true,
154
+ module: {
155
+ path: filePath,
156
+ name: path.basename(filePath),
157
+ language: selected_language,
158
+ loc: content.split('\n').length,
159
+ imports,
160
+ exports,
161
+ declarations,
162
+ },
100
163
  };
101
164
  }
102
165
  catch (error) {
103
- console.error(`Error parsing file ${filePath}`, error);
104
- return null;
166
+ const err = error instanceof Error ? error : new Error(String(error));
167
+ return {
168
+ ok: false,
169
+ diagnostics: {
170
+ file: filePath,
171
+ extension: path.extname(filePath),
172
+ size_bytes,
173
+ content_sha256,
174
+ char_length,
175
+ has_bom,
176
+ has_null_bytes,
177
+ newline_style,
178
+ selected_language,
179
+ grammar_variant: selected_language,
180
+ language_set,
181
+ input_type,
182
+ stage,
183
+ error_name: err.name,
184
+ error_message: err.message,
185
+ stack: err.stack,
186
+ },
187
+ };
105
188
  }
106
189
  }
190
+ // ─── Backward-compatible wrapper ─────────────────────────────────────────────
191
+ export function parseFile(filePath) {
192
+ const result = parseFileWithDiagnostics(filePath);
193
+ if (result.ok)
194
+ return result.module;
195
+ const d = result.diagnostics;
196
+ // Minimal stderr output — CLI layer writes the full debug log
197
+ process.stderr.write(`[nirnex parser] Failed to parse ${d.file}\n` +
198
+ ` extension: ${d.extension} size: ${d.size_bytes} bytes stage: ${d.stage}\n` +
199
+ ` reason: ${d.error_message}\n`);
200
+ return null;
201
+ }
107
202
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,MAAM,SAAS,CAAC;A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kB,CAAC,CAAC,KAAK,IAAI;QAC/E,aAAa,CAAC,CAAC,aAAa,IAAI,CACjC,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nirnex/parser",
3
- "version": "4.1.3",
3
+ "version": "4.2.1",
4
4
  "description": "Nirnex parser — Tree-sitter based source code analysis",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",