{"id":24558039,"url":"https://github.com/rse/source-code-error","last_synced_at":"2025-06-20T15:34:50.791Z","repository":{"id":46761711,"uuid":"131422100","full_name":"rse/source-code-error","owner":"rse","description":"Render Error for Source-Code","archived":false,"fork":false,"pushed_at":"2024-03-09T13:28:40.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-18T20:02:30.097Z","etag":null,"topics":["code","error","frame","render","source"],"latest_commit_sha":null,"homepage":"http://npmjs.com/source-code-error","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-28T15:38:39.000Z","updated_at":"2024-03-09T13:28:07.000Z","dependencies_parsed_at":"2022-09-26T18:11:56.852Z","dependency_job_id":null,"html_url":"https://github.com/rse/source-code-error","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/rse/source-code-error","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fsource-code-error","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fsource-code-error/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fsource-code-error/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fsource-code-error/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/source-code-error/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Fsource-code-error/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260971117,"owners_count":23090677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","error","frame","render","source"],"created_at":"2025-01-23T05:47:15.063Z","updated_at":"2025-06-20T15:34:45.770Z","avatar_url":"https://github.com/rse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nSource-Code-Error\n=================\n\nRender Error for Source-Code\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/source-code-error.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/source-code-error.png\" alt=\"\"/\u003e\n\nAbout\n-----\n\nThis is a small wrapper around the\n[@babel/code-frame](http://npmjs.com/@babel/code-frame) module\nfor rendering a nice error message for source-code with a colorized code frame.\n\nUsage\n-----\n\nInstallation:\n\n```shell\n$ npm install error-frame\n```\n\nUsage:\n\n```js\nconst sourceCodeError = require(\"source-code-error\")\n\nconst code = `foo bar\\n    baz quux\\nfoo bar`\n\nlet report = sourceCodeError({\n    message:  \"Unknown error\",\n    origin:   \"somewhere\",\n    filename: \"foo.txt\",\n    code:     code,\n    line:     2,\n    column:   5,\n    colors:   true,\n    newline:  false\n})\n\nconsole.log(report)\n```\n\nOutput:\n\n```\nERROR: file \"./foo.txt\", line 2, column 5:\n       Unknown error [somewhere]\n  1 | foo bar\n\u003e 2 |     baz quux\n    |     ^\n  3 | foo bar\n```\n\nOptions\n-------\n\nThe following options in the API exist:\n\n- `type: string = \"ERROR\"`: type of error: ERROR or WARNING [optional].\n- `message: string = \"\"`: error description message [optional].\n- `origin: string = \"\"`: error origin indicator [optional].\n- `filename: string = \"\"`: source code filename [optional].\n- `code: string`: source code text [required].\n- `line: number`: source code line of error [required].\n- `column: number`: source code column of error [required].\n- `above: number = 2`: source code lines to show above error [optional].\n- `below: number = 2`: source code lines to show below error [optional].\n- `newline: boolean = true`: whether to close with trailing newline [optional].\n- `colors: boolean = true`: whether to use colors [optional].\n\nLicense\n-------\n\nCopyright (c) 2018-2021 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fsource-code-error","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Fsource-code-error","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Fsource-code-error/lists"}