{"id":13672885,"url":"https://github.com/KFlash/seafox","last_synced_at":"2025-04-28T04:30:31.796Z","repository":{"id":42960250,"uuid":"225255312","full_name":"KFlash/seafox","owner":"KFlash","description":"A blazing fast 100% spec compliant, self-hosted javascript parser written in Typescript","archived":false,"fork":false,"pushed_at":"2023-03-04T05:28:00.000Z","size":8409,"stargazers_count":485,"open_issues_count":7,"forks_count":14,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-19T10:38:36.948Z","etag":null,"topics":["acorn","ecmascript","es2020","estree","javascript","parser","parsing","tc39","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KFlash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-02T00:55:04.000Z","updated_at":"2025-03-29T04:46:51.000Z","dependencies_parsed_at":"2024-01-14T17:28:14.039Z","dependency_job_id":null,"html_url":"https://github.com/KFlash/seafox","commit_stats":{"total_commits":380,"total_committers":5,"mean_commits":76.0,"dds":"0.023684210526315752","last_synced_commit":"9888de164d25b350cfc1b9774d9b62652e15ce01"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KFlash%2Fseafox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KFlash%2Fseafox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KFlash%2Fseafox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KFlash%2Fseafox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KFlash","download_url":"https://codeload.github.com/KFlash/seafox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251251773,"owners_count":21559660,"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":["acorn","ecmascript","es2020","estree","javascript","parser","parsing","tc39","typescript"],"created_at":"2024-08-02T09:01:54.807Z","updated_at":"2025-04-28T04:30:30.886Z","avatar_url":"https://github.com/KFlash.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003eSeafox\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e A blazing fast 100% spec compliant, self-hosted javascript parser written in Typescript.\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/seafox\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/seafox.svg?style=flat-square\" alt=\"Seafox NPM\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://lgtm.com/projects/g/KFlash/seafox/context:javascript\"\u003e\u003cimg src=\"https://img.shields.io/lgtm/grade/javascript/g/KFlash/seafox.svg?logo=lgtm\u0026logoWidth=18\" alt=\"GitHub license\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://lgtm.com/projects/g/KFlash/seafox/alerts\"\u003e\u003cimg src=\"https://img.shields.io/lgtm/alerts/g/KFlash/seafox.svg?logo=lgtm\u0026logoWidth=18\" alt=\"Total alerts\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://circleci.com/gh/KFlash/seafox\"\u003e\u003cimg src=\"https://circleci.com/gh/KFlash/seafox.svg?style=svg\" alt=\"Circle\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/KFlash/seafox/blob/master/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/github/license/KFlash/seafox.svg\" alt=\"License\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n* Conforms to the standard ECMAScript® 2021 (ECMA-262 11th Edition) language specification\n* Support for additional ECMAScript features for Web Browsers\n* Optionally track syntactic node locations\n* Emits an ESTree-compatible abstract syntax tree\n* Lexical analysis\n* No backtracking\n* Low memory usage\n* Insane performance both on desktop computers and handheld devices\n* Twice as fast as other Javascript parsers\n* Very well tested (~33 000 unit tests with full code coverage)\n* Lightweight - ~84 KB minified\n\n## Installation\n\n```sh\nnpm install seafox --save-dev\n```\n\n## API\n\nSeafox generates `AST` according to [ESTree AST format](https://github.com/estree/estree), and can be used to perform [syntactic analysis](https://en.wikipedia.org/wiki/Parsing) (parsing) or [lexical analysis](https://en.wikipedia.org/wiki/Lexical_analysis) (tokenization) of a JavaScript program, and with `ES2015` and later a JavaScript program can be either [a script or a module](https://tc39.github.io/ecma262/index.html#sec-ecmascript-language-scripts-and-modules).\n\nThe `parse` method exposed by `Seafox` takes an optional `options` object which allows you to specify whether to parse in [`script`](https://tc39.github.io/ecma262/#sec-parse-script) mode (the default) or in [`module`](https://tc39.github.io/ecma262/#sec-parsemodule) mode.\n\n\nThis is the available options:\n\n```js\n{\n  // Allow parsing using Module as the goal symbol\n  module?: boolean;\n\n  // The flag to enable start and end offsets and line/column location information to each node\n  loc: false;\n\n  // Disable web compatibility\n  disableWebCompat: false;\n\n  // The flag to attach raw property to each literal and identifier node\n  raw: false;\n\n  // Enabled directives\n  directives: false;\n\n  // The flag to allow return in the global scope\n  globalReturn: false;\n\n  // The flag to enable implied strict mode\n  impliedStrict: false;\n\n// Enable non-standard parenthesized expression node\n  preserveParens: false;\n\n   // Allows token extraction. Accepts only a function\n  onToken: function() {}\n}\n```\n\nExample usage:\n\n```ts\n\nimport { parseScript, parseModule, parse } from './seafox';\n\nparseScript('({x: [y] = 0} = 1)');\n\nparseModule('({x: [y] = 0} = 1)', { directives: true, raw: true });\n\nparse('({x: [y] = 0} = 1)', { module: true });\n\nparse('({x: [y] = 0} = 1)');\n\n```\n\n# Lexical analysis\n\nLexical analysis can only be done during parsing and accepts only a function type as the option\n\n```ts\n parseScript('foo = bar', { onToken: () =\u003e {}});\n```\nThe callback function have 4 arguments.\n\n| Arguments   | Description |\n| ----------- | ------------------------------------------------------------ |\n| `token`     | The token to be extracted |\n| `value`     | Value of the extracted token |\n| `start`     | Start position of the extracted token |\n| `end`       | End position of the extracted token |\n\nThe `loc` option needs to be enabled for `start` and `end`. Otherwise this values will be set to `undefined`\n\n\n# Performance\n\nSeafox is developed for performance and low memory usage, and the parser is about 2x - 4x faster than all other javascript parsers.\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKFlash%2Fseafox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKFlash%2Fseafox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKFlash%2Fseafox/lists"}