{"id":15677821,"url":"https://github.com/sxzz/magic-string-ast","last_synced_at":"2025-04-07T15:11:00.677Z","repository":{"id":146230567,"uuid":"617929516","full_name":"sxzz/magic-string-ast","owner":"sxzz","description":"magic-string with Babel AST shortcut.","archived":false,"fork":false,"pushed_at":"2024-10-29T18:14:08.000Z","size":347,"stargazers_count":17,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T21:26:43.005Z","etag":null,"topics":["ast","babel","magic-string"],"latest_commit_sha":null,"homepage":"https://jsr.io/@sxzz/magic-string-ast","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sxzz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["sxzz"]}},"created_at":"2023-03-23T12:08:17.000Z","updated_at":"2024-09-20T20:55:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9585131-9314-4c7e-8468-88fae09a8162","html_url":"https://github.com/sxzz/magic-string-ast","commit_stats":{"total_commits":90,"total_committers":3,"mean_commits":30.0,"dds":"0.48888888888888893","last_synced_commit":"318eb64d561172d014640bb5867dc249478c69b5"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxzz%2Fmagic-string-ast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxzz%2Fmagic-string-ast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxzz%2Fmagic-string-ast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sxzz%2Fmagic-string-ast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sxzz","download_url":"https://codeload.github.com/sxzz/magic-string-ast/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675607,"owners_count":20977378,"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":["ast","babel","magic-string"],"created_at":"2024-10-03T16:12:24.478Z","updated_at":"2025-04-07T15:11:00.648Z","avatar_url":"https://github.com/sxzz.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sxzz"],"categories":[],"sub_categories":[],"readme":"# magic-string-ast [![npm](https://img.shields.io/npm/v/magic-string-ast.svg)](https://npmjs.com/package/magic-string-ast) [![JSR](https://jsr.io/badges/@sxzz/magic-string-ast)](https://jsr.io/@sxzz/magic-string-ast)\n\n[![Unit Test](https://github.com/sxzz/magic-string-ast/actions/workflows/unit-test.yml/badge.svg)](https://github.com/sxzz/magic-string-ast/actions/workflows/unit-test.yml)\n\n[magic-string](https://github.com/rich-harris/magic-string) with AST shortcut.\n\n## Install\n\n```bash\n# npm\nnpm i magic-string-ast\n\n# jsr\nnpx jsr add -D @sxzz/magic-string-ast\n```\n\n## Usage\n\n```ts\nimport { MagicStringAST } from 'magic-string-ast'\n\nconst offset = 0\nconst node = {\n  // AST node with `start` and `end` properties\n  start: 6,\n  end: 7,\n  // ...\n}\n\nconst s = new MagicStringAST('const a = 1')\ns.sliceNode(node, { offset }) // 'a'\ns.removeNode(node)\ns.moveNode(node, 0)\ns.overwriteNode(node, 'foo')\n```\n\nFor more APIs, see [docs](https://jsr.io/@sxzz/magic-string-ast/doc) and [magic-string](https://github.com/rich-harris/magic-string#usage).\n\n## Sponsors\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg\"\u003e\n    \u003cimg src='https://cdn.jsdelivr.net/gh/sxzz/sponsors/sponsors.svg'/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## License\n\n[MIT](./LICENSE) License © 2023-PRESENT [三咲智子](https://github.com/sxzz)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsxzz%2Fmagic-string-ast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsxzz%2Fmagic-string-ast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsxzz%2Fmagic-string-ast/lists"}