{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9038","repository_url":"https://api.github.com/repos/Microsoft/TypeScript","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9038/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9038/comments","events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9038/events","html_url":"https://github.com/Microsoft/TypeScript/pull/9038","id":159300619,"number":9038,"title":"RFC: Extensibility model","user":{"login":"weswigham","id":2932786,"avatar_url":"https://avatars.githubusercontent.com/u/2932786?v=3","gravatar_id":"","url":"https://api.github.com/users/weswigham","html_url":"https://github.com/weswigham","followers_url":"https://api.github.com/users/weswigham/followers","following_url":"https://api.github.com/users/weswigham/following{/other_user}","gists_url":"https://api.github.com/users/weswigham/gists{/gist_id}","starred_url":"https://api.github.com/users/weswigham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weswigham/subscriptions","organizations_url":"https://api.github.com/users/weswigham/orgs","repos_url":"https://api.github.com/users/weswigham/repos","events_url":"https://api.github.com/users/weswigham/events{/privacy}","received_events_url":"https://api.github.com/users/weswigham/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/TypeScript/labels/cla-already-signed","name":"cla-already-signed","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-08T23:40:21Z","updated_at":"2016-06-17T21:37:54Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/9038","html_url":"https://github.com/Microsoft/TypeScript/pull/9038","diff_url":"https://github.com/Microsoft/TypeScript/pull/9038.diff","patch_url":"https://github.com/Microsoft/TypeScript/pull/9038.patch"},"body":"We use our internal module resolution logic to resolve the location of the entrypoint of a plugin from the compilation, then pass that path off to the host to have it load the code. For our `node` host, this is just a `require` call. We then look at the exported values of this module and check for members annotated with the private member `__tsCompilerExtensionKind` which is intended to be one of the string literal values defined as valid `ExtensionKind`s. Later on, the loaded extensions can be retrieved and constructed when required, then have their methods called.\r\n\r\nPlease note: The extension API is not included anywhere in the compiler - however, an example of how to implement a package for using the extension API is given in the tests. It's my recommendation that the extension API be a separate package from TS proper, since the 'global' `tsc` needs to use the 'local' extension, and if that local extension has its own bundled typescript, then version mismatching can happen unexpectedly.\r\n\r\nAdditionally, to serve as a testbed for extension loading (and to implement a frequently asked for feature), single-pass semantic and syntactic lint extensions are also in this PR.\r\n\r\nThoughts:\r\n- We could implement the `loadExtension` method on other hosts similarly to how I've implemented it in the tests (if that is desirable). This is pretty much amounts to building a commonjs module loader into the compiler.\r\n- Extensions are loaded from a namespace under `node_modules` right now. The namespace is questionable - do we want to gate compiler extensions behind a namespace (in which case we should get one), or not?\r\n\r\nFuture PRs:\r\n- 'discoverTypings' hook\r\n- Language Service plugins\r\n- Add quick fix support to lint plugins\r\n- Type provider plugins\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments/226887712","html_url":"https://github.com/Microsoft/TypeScript/pull/9038#issuecomment-226887712","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/9038","id":226887712,"user":{"login":"weswigham","id":2932786,"avatar_url":"https://avatars.githubusercontent.com/u/2932786?v=3","gravatar_id":"","url":"https://api.github.com/users/weswigham","html_url":"https://github.com/weswigham","followers_url":"https://api.github.com/users/weswigham/followers","following_url":"https://api.github.com/users/weswigham/following{/other_user}","gists_url":"https://api.github.com/users/weswigham/gists{/gist_id}","starred_url":"https://api.github.com/users/weswigham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weswigham/subscriptions","organizations_url":"https://api.github.com/users/weswigham/orgs","repos_url":"https://api.github.com/users/weswigham/repos","events_url":"https://api.github.com/users/weswigham/events{/privacy}","received_events_url":"https://api.github.com/users/weswigham/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T21:37:54Z","updated_at":"2016-06-17T21:37:54Z","body":"@billti You should take a look at this, too."}}
{"actor":{"display_login":"weswigham"}}