{"id":20150880,"url":"https://github.com/pawfa/ts-package-scope-plugin","last_synced_at":"2025-10-13T22:40:20.404Z","repository":{"id":39743674,"uuid":"490801452","full_name":"pawfa/ts-package-scope-plugin","owner":"pawfa","description":"TypeScript Language Service Plugin for creating package scope.","archived":false,"fork":false,"pushed_at":"2022-05-28T07:53:06.000Z","size":268,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-18T16:04:19.758Z","etag":null,"topics":["encapsulation","modules","package","plugin","scope","typescript"],"latest_commit_sha":null,"homepage":"","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/pawfa.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-05-10T17:41:43.000Z","updated_at":"2022-05-10T21:19:51.000Z","dependencies_parsed_at":"2022-09-20T10:55:43.564Z","dependency_job_id":null,"html_url":"https://github.com/pawfa/ts-package-scope-plugin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/pawfa/ts-package-scope-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawfa%2Fts-package-scope-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawfa%2Fts-package-scope-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawfa%2Fts-package-scope-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawfa%2Fts-package-scope-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pawfa","download_url":"https://codeload.github.com/pawfa/ts-package-scope-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawfa%2Fts-package-scope-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017145,"owners_count":26085984,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["encapsulation","modules","package","plugin","scope","typescript"],"created_at":"2024-11-13T22:53:43.700Z","updated_at":"2025-10-13T22:40:20.388Z","avatar_url":"https://github.com/pawfa.png","language":"TypeScript","readme":"[![npm version](https://img.shields.io/npm/v/ts-package-scope-plugin.svg)](https://www.npmjs.com/package/ts-package-scope-plugin)\n[![Build Status](https://github.com/pawfa/ts-package-scope-plugin/workflows/CI/badge.svg)](https://github.com/pawfa/ts-package-scope-plugin/actions)\n[![Build Status](https://snyk.io/test/github/pawfa/ts-package-scope-plugin/badge.svg?targetFile=package.json)](https://snyk.io/test/github/pawfa/ts-package-scope-plugin?targetFile=package.json)\n\n# ts-package-scope-plugin\n\nTypeScript Language Service Plugin for creating package scopes using dir names and JS Docs.\n\nIt provides IntelliSense for VS Code and error reporting using TypeScript TSServer.\n\n## Installation and usage\n\nInstall package:\n\n`yarn add -D ts-package-scope-plugin` or `npm i --save-dev ts-package-scope-plugin`\n\nUpdate `tsconfig.json`:\n\n```json\n{\n  \"compilerOptions\": {\n    \"plugins\": [\n      {\n        \"name\": \"ts-package-scope-plugin\"\n      }\n    ]\n  }\n}\n```\n\n_VS Code users_\n\nRun command _TypeScript: Select TypeScript version_ and choose _Use workspace version_:\n\n![](docs/typescript-version-vscode.png)\n\n## Configuration\n\nBy default, plugin will analyse the same files as the TypeScript compiler in your project. You can override this behavior by using `include` property:\n\n```\n{\n  \"compilerOptions\": {\n    \"plugins\": [\n      {\n        \"name\": \"ts-package-scope-plugin\",\n        \"options\": {\n          \"include\": [\"./src/**/*\"]\n        }\n      }\n    ]\n  }\n}\n```\n\n### Package scope\n\nThere are two ways to make module package scoped. Using suffix/prefix in folder name or setting plugin option with specific folder names.\n\n#### 1. `package` prefix/suffix\n\nTo make file package scoped using prefix/suffix it needs to be placed in folder with `package` in its name separated with dot ex. `package.\u003cname\u003e` or `\u003cname\u003e.package`:\n\n```\nproject\n│   README.md\n│   file001.txt\n│\n└───package.interface\n│   │   api.ts\n│\n└───package.domain\n    │   client.ts\n```\n\n#### 2. `packageNames` option\n\nTo make file package scoped using specific folder names, they have to be listed as an array in tsconfig.json plugin option:\n\n```\n{\n  \"compilerOptions\": {\n    \"plugins\": [\n      {\n        \"name\": \"ts-package-scope-plugin\",\n        \"options\": {\n          \"packageNames\": [\"core\", \"domain\"]\n        }\n      }\n    ]\n  }\n}\n```\n\nWhen you import file from one package into another, IDE will show a TypeScript error.\n\n#### Public scope\n\nTo make file available from other packages set its scope to public using JS Doc tag at the top of the file:\n\n```javascript\n/** @package-scope public **/\nimport { Helper } from \"./helpers\";\n\nexport function getClient() {}\n```\n\n#### IntelliSense filtering (only for VS Code)\n\nBy default, files which are not available for current package will be removed from intellisense suggestions.\nTo turn on or off this feature you can use `intelliSense` option in tsconfig.json:\n\n```json\n{\n  \"compilerOptions\": {\n    \"plugins\": [\n      {\n        \"name\": \"ts-package-scope-plugin\",\n        \"options\": {\n          \"intelliSense\": false\n        }\n      }\n    ]\n  }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawfa%2Fts-package-scope-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpawfa%2Fts-package-scope-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawfa%2Fts-package-scope-plugin/lists"}