{"id":15763395,"url":"https://github.com/shigma/dtsc","last_synced_at":"2025-04-21T03:32:27.391Z","repository":{"id":37745569,"uuid":"494510120","full_name":"shigma/dtsc","owner":"shigma","description":"Generate bundled TypeScript declaration files","archived":false,"fork":false,"pushed_at":"2024-03-04T16:04:12.000Z","size":50,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-05T11:41:51.610Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shigma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2022-05-20T15:09:00.000Z","updated_at":"2024-02-19T16:35:41.000Z","dependencies_parsed_at":"2024-06-19T00:28:19.219Z","dependency_job_id":"dd260d7c-1a03-4db6-9419-8a86f470e06c","html_url":"https://github.com/shigma/dtsc","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"55f79370888052515aebb46910c236a851b1b5b6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shigma%2Fdtsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shigma%2Fdtsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shigma%2Fdtsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shigma%2Fdtsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shigma","download_url":"https://codeload.github.com/shigma/dtsc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249991150,"owners_count":21357208,"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":[],"created_at":"2024-10-04T11:41:50.741Z","updated_at":"2025-04-21T03:32:27.157Z","avatar_url":"https://github.com/shigma.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dtsc\n\n[![npm](https://img.shields.io/npm/v/dtsc?style=flat-square)](https://www.npmjs.com/package/dtsc)\n[![GitHub](https://img.shields.io/github/license/shigma/dtsc?style=flat-square)](https://github.com/shigma/dtsc/blob/master/LICENSE)\n\nGenerate bundled TypeScript declaration files.\n\n## Background\n\nTypeScript has a [`outFile`](https://www.typescriptlang.org/tsconfig/#outFile) compiler option:\n\n\u003e If specified, all global (non-module) files will be concatenated into the single output file specified.\n\u003e\n\u003e If module is system or amd, all module files will also be concatenated into this file after all global content.\n\u003e\n\u003e Note: outFile cannot be used unless module is None, System, or AMD. **This option cannot be used to bundle CommonJS or ES6 modules.**\n\nSupposing you have a project structure like this:\n\n```\n├── src\n│   ├── index.ts\n│   ├── foo.ts\n│   └── bar.ts\n├── package.json\n└── tsconfig.json\n```\n\nAfter running `tsc --outFile lib/index.d.ts`, the following file will be generated:\n\n```ts\n// lib/index.d.ts\ndeclare module \"foo\" {\n  export function someMethod(): void;\n}\ndeclare module \"bar\" {\n  export function otherMethod(): void;\n}\ndeclare module \"index\" {\n  export * from \"foo\";\n  export * from \"bar\";\n  export * from \"baz\";\n}\n```\n\nHowever, what we really want is:\n\n```ts\n// lib/index.d.ts\nexport function someMethod(): void;\nexport function otherMethod(): void;\n```\n\nThis is where dtsc comes in. It generates a single bundled declaration file which behaves like other bundling tools.\n\n## Usage\n\ndtsc supports `outFile` option out of the box.\n\n```jsonc\n// tsconfig.json\n{\n  \"compilerOptions\": {\n    \"rootDir\": \"src\",\n    \"outFile\": \"lib/index.d.ts\",\n  },\n  \"include\": [\n    \"src\",\n  ],\n}\n```\n\n```jsonc\n// package.json\n{\n  \"typings\": \"lib/index.d.ts\",\n  \"scripts\": {\n    \"build\": \"dtsc\",\n  },\n}\n```\n\n```bash\nnpm run build\n```\n\n## Limitations\n\nThis package uses a string-based approach to generate bundle from a .d.ts file. It may have some limitations:\n\n- If you find one, welcome to report an issue.\n\n\u003c!-- In most cases I would recommend using tsc directly. --\u003e\n\n## See also\n\n- [atsc](https://github.com/shigma/atsc): augment tsc with non-typescript files support\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshigma%2Fdtsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshigma%2Fdtsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshigma%2Fdtsc/lists"}