diff --git a/index.d.ts b/index.d.ts index 58163e8..ddded59 100644 --- a/index.d.ts +++ b/index.d.ts @@ -47,3 +47,31 @@ export class Preprocessor { */ parse(src: string, filename?: string): Parsed[]; } + +export interface ParseError { + /** + * Formatted output for CLI + */ + source_code: string; + /** + * Color-Formatted output for CLI + */ + source_code_color: string; + + /** + * 0-indexed starting line of the error + */ + start_line: number; + /** + * 0-indexed starting byte-based column of the error + */ + start_column: number; + /** + * 0-indexed ending line of the error + */ + end_line: number; + /** + * 0-indexed ending byte-based column of the error + */ + end_column: number; +} diff --git a/package-lock.json b/package-lock.json index 0bf3765..ee67ef5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "content-tag", - "version": "1.2.1", + "version": "1.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "content-tag", - "version": "1.2.1", + "version": "1.2.2", "license": "MIT", "devDependencies": { "@arethetypeswrong/cli": "^0.13.2", diff --git a/src/bindings.rs b/src/bindings.rs index a546d91..737be21 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -69,9 +69,23 @@ fn as_javascript_error(err: swc_ecma_parser::error::Error, source_map: Lrc parse errors", function () { + let parseError; + try { + p.process(`let foo = 2; + +const Foo = + +