{"id":15130247,"url":"https://github.com/hyrious/esbuild-plugin-code-tag","last_synced_at":"2026-01-19T07:04:59.518Z","repository":{"id":58282700,"uuid":"530945228","full_name":"hyrious/esbuild-plugin-code-tag","owner":"hyrious","description":"Strip code tag functions and dedent strings","archived":false,"fork":false,"pushed_at":"2022-08-31T05:24:35.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-23T07:26:03.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/hyrious.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":"2022-08-31T05:21:27.000Z","updated_at":"2025-05-05T10:22:00.000Z","dependencies_parsed_at":"2022-09-01T10:11:58.660Z","dependency_job_id":null,"html_url":"https://github.com/hyrious/esbuild-plugin-code-tag","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hyrious/esbuild-plugin-code-tag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-code-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-code-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-code-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-code-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyrious","download_url":"https://codeload.github.com/hyrious/esbuild-plugin-code-tag/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyrious%2Fesbuild-plugin-code-tag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28562700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T03:31:16.861Z","status":"ssl_error","status_checked_at":"2026-01-19T03:31:15.069Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-09-26T02:43:01.579Z","updated_at":"2026-01-19T07:04:59.490Z","avatar_url":"https://github.com/hyrious.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## @hyrious/esbuild-plugin-code-tag\n\nThis plugin strips [code tags](https://github.com/fregante/code-tag) from your source code.\n\n### Install\n\n```\nnpm add -D code-tag @hyrious/esbuild-plugin-code-tag\n```\n\n### Usage\n\n```js\nconst { build } = require(\"esbuild\");\nconst { codeTag } = require(\"@hyrious/esbuild-plugin-code-tag\");\n\nbuild({\n  entryPoints: [\"src/index.ts\"],\n  bundle: true,\n  format: \"esm\",\n  plugins: [codeTag()],\n}).catch(() =\u003e process.exit(1));\n```\n\n### Options\n\n```js\ncodeTag({\n  filter: /\\.(m?ts|[jt]sx)$/,\n  tags: [\"html\", \"css\", \"gql\", \"graphql\", \"md\", \"markdown\", \"sql\"],\n  dedent: [],\n});\n```\n\n**filter** (default: `/\\.(m?ts|[jt]sx)$/`)\n\nA RegExp passed to [`onLoad()`](https://esbuild.github.io/plugins/#on-load) to\nmatch source codes, it is recommended to set a custom filter to skip files\nfor better performance. By default it does not process .{js,mjs} files.\n\n**tags** (default: `[\"html\", \"css\", \"gql\", \"graphql\", \"md\", \"markdown\", \"sql\"]`)\n\nAn array of tags to be stripped. For example if you set `tags` to `[\"html\", \"css\"]`,\nthe following transform will happen:\n\n```js\nconsole.log(html`\n  \u003ch2\u003eTitle\u003c/h2\u003e\n  \u003cp\u003ehello, world!\u003c/p\u003e\n`);\n```\n\nbecomes\n\n```js\nconsole.log(`\n  \u003ch2\u003eTitle\u003c/h2\u003e\n  \u003cp\u003ehello, world!\u003c/p\u003e\n`);\n```\n\n**dedent** (default: `[]`)\n\nTemplate literals after these tags will be [de-indented](https://github.com/tamino-martinius/node-ts-dedent).\nFor example if you set `dedent` to `[\"html\", \"css\"]`, the following transform will happen:\n\n```js\nconsole.log(html`\n  \u003ch2\u003eTitle\u003c/h2\u003e\n  \u003cp\u003ehello, world!\u003c/p\u003e\n`);\n```\n\nbecomes\n\n```js\nconsole.log(`\u003ch2\u003eTitle\u003c/h2\u003e\n\u003cp\u003ehello, world!\u003c/p\u003e`);\n```\n\nBy default `dedent` is empty, so that the default behavior will be the same as\nnot having this plugin.\n\n### Caveats\n\n- It does not support nested code tags, i.e.\n\n  ```js\n  const fragment = html`\n    \u003cstyle\u003e\n      ${css`\n        body {\n          color: red;\n        }\n      `}\n    \u003c/style\u003e\n  `;\n  ```\n\n  If you need to write code like above, you can move inner strings to another scope:\n\n  ```js\n  const style = css`\n    body {\n      color: red;\n    }\n  `;\n  const fragment = html`\u003cstyle\u003e${style}\u003cstyle\u003e`;\n  ```\n\n## License\n\nMIT @ [hyrious](https://github.com/hyrious)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyrious%2Fesbuild-plugin-code-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyrious%2Fesbuild-plugin-code-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyrious%2Fesbuild-plugin-code-tag/lists"}