{"id":15413426,"url":"https://github.com/wooorm/babel-plugin-undebug","last_synced_at":"2025-04-19T11:40:35.494Z","repository":{"id":62354735,"uuid":"318563747","full_name":"wooorm/babel-plugin-undebug","owner":"wooorm","description":"Babel plugin to remove `debug` from code","archived":false,"fork":false,"pushed_at":"2024-09-02T15:48:04.000Z","size":42,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T12:04:27.892Z","etag":null,"topics":["babel","babel-plugin","debug"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/wooorm.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":"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":"wooorm"}},"created_at":"2020-12-04T15:53:40.000Z","updated_at":"2025-04-04T03:31:50.000Z","dependencies_parsed_at":"2024-10-21T14:36:12.963Z","dependency_job_id":null,"html_url":"https://github.com/wooorm/babel-plugin-undebug","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"f09e981902b481b76e03c9a0b8a92eea28adfb41"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fbabel-plugin-undebug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fbabel-plugin-undebug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fbabel-plugin-undebug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wooorm%2Fbabel-plugin-undebug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wooorm","download_url":"https://codeload.github.com/wooorm/babel-plugin-undebug/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249685284,"owners_count":21310576,"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":["babel","babel-plugin","debug"],"created_at":"2024-10-01T16:57:01.469Z","updated_at":"2025-04-19T11:40:35.472Z","avatar_url":"https://github.com/wooorm.png","language":"JavaScript","funding_links":["https://github.com/sponsors/wooorm"],"categories":[],"sub_categories":[],"readme":"# babel-plugin-undebug\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\nBabel plugin to remove `debug` from code.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n  * [`babelPluginUndebug`](#babelpluginundebug)\n* [Syntax tree](#syntax-tree)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Related](#related)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a [Babel][] plugin to remove [`debug`][debug] from code.\n\n## When should I use this?\n\nThis package is useful when `debug` is used to debug development code but can be\nstripped in production.\nAn example is `micromark`, which is a complex state machine that can be plugged\ninto with extensions but it’s also supposed to be small in browsers.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 18+), install with [npm][]:\n\n```sh\nnpm install babel-plugin-undebug\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport babelPluginUndebug from 'https://esm.sh/babel-plugin-undebug@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import babelPluginUndebug from 'https://esm.sh/babel-plugin-undebug@2?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n`example.js`:\n\n```js\nconst debug = require('debug')('math')\n\nlet value = 1\ndebug('Value was %d', value)\nvalue++\ndebug('Now we have %d', value)\n```\n\nThen (with `@babel/cli` and `@babel/core` installed):\n\n```sh\nbabel example.js --plugins babel-plugin-undebug\n```\n\nYields:\n\n```js\nlet value = 1;\nvalue++;\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is `babelPluginUndebug`.\n\n### `babelPluginUndebug`\n\nPlugin to remove `debug` from code.\nSee [Babel’s documentation][babel-plugins] on how to use Babel plugins.\n\n## Syntax tree\n\nThis package operates on the Babel (JavaScript) AST.\n\n* looks for ESM (`import`) and CJS (`require`) loading `'debug'`\n* looks for code calling that function and assigning it, whether `createDebug`\n  (`const createDebug = require('debug'), d = createDebug('math')`)\n  or direct use\n  (`const d = require('debug')('math')`)\n* looks for calls of those assigned identifiers and remove whole debug calls,\n  so side effects (`d(value++)`) will be dropped\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nThis package is at least compatible with all maintained versions of Node.js.\nAs of now, that is Node.js 18+.\nIt also works in Deno and modern browsers.\n\n## Security\n\nThis package is safe.\n\n## Related\n\n* [`babel-plugin-unassert`](https://github.com/unassert-js/babel-plugin-unassert)\n  — remove `assert`\n\n## Contribute\n\nYes please!\nSee [How to Contribute to Open Source][contribute].\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/wooorm/babel-plugin-undebug/workflows/main/badge.svg\n\n[build]: https://github.com/wooorm/babel-plugin-undebug/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/babel-plugin-undebug.svg\n\n[coverage]: https://codecov.io/github/wooorm/babel-plugin-undebug\n\n[downloads-badge]: https://img.shields.io/npm/dm/babel-plugin-undebug.svg\n\n[downloads]: https://www.npmjs.com/package/babel-plugin-undebug\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/babel-plugin-undebug.svg\n\n[size]: https://bundlephobia.com/result?p=babel-plugin-undebug\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esmsh]: https://esm.sh\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[typescript]: https://www.typescriptlang.org\n\n[contribute]: https://opensource.guide/how-to-contribute/\n\n[debug]: https://github.com/visionmedia/debug\n\n[babel]: https://babeljs.io\n\n[babel-plugins]: https://babeljs.io/docs/plugins\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwooorm%2Fbabel-plugin-undebug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwooorm%2Fbabel-plugin-undebug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwooorm%2Fbabel-plugin-undebug/lists"}