{"action":"created","issue":{"url":"https://api.github.com/repos/typings/typings/issues/579","repository_url":"https://api.github.com/repos/typings/typings","labels_url":"https://api.github.com/repos/typings/typings/issues/579/labels{/name}","comments_url":"https://api.github.com/repos/typings/typings/issues/579/comments","events_url":"https://api.github.com/repos/typings/typings/issues/579/events","html_url":"https://github.com/typings/typings/issues/579","id":159552066,"number":579,"title":"jspm support proposal","user":{"login":"unional","id":3254987,"avatar_url":"https://avatars.githubusercontent.com/u/3254987?v=3","gravatar_id":"","url":"https://api.github.com/users/unional","html_url":"https://github.com/unional","followers_url":"https://api.github.com/users/unional/followers","following_url":"https://api.github.com/users/unional/following{/other_user}","gists_url":"https://api.github.com/users/unional/gists{/gist_id}","starred_url":"https://api.github.com/users/unional/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unional/subscriptions","organizations_url":"https://api.github.com/users/unional/orgs","repos_url":"https://api.github.com/users/unional/repos","events_url":"https://api.github.com/users/unional/events{/privacy}","received_events_url":"https://api.github.com/users/unional/received_events","type":"User","site_admin":false},"labels":[{"id":275591298,"url":"https://api.github.com/repos/typings/typings/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":326157845,"url":"https://api.github.com/repos/typings/typings/labels/typings:%20core","name":"typings: core","color":"f7c6c7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2016-06-10T03:23:57Z","updated_at":"2016-12-18T09:15:29Z","closed_at":"2016-12-07T23:34:27Z","body":"This is related to https://github.com/Microsoft/TypeScript/issues/6012 and if we have a solid way to do it (I have a not fully working solution below), when jspm'er can live on happily a little longer.\n## The Ugly\n\nI wrote package A, which depends on package B, C, and D. I get module typings B and global typings C through `typings`, and get typings D from the source itself. i.e., the setup is as follow:\n### For Package A:\n\n``` js\n// package.json\n{\n  \"main\": \"dist/index\",\n  \"typings\": \"dist/index.d.ts\",\n  \"jspm\": {\n    \"files\": [\n      \"dist/\",\n      \"typings.json\"\n    ],\n    \"dependencies\": {\n      \"packageB\": \"...\",\n      \"packageC\": \"...\",\n      \"packageD\": \"...\"\n  }\n}\n\n// tsconfig.json\n{\n  \"paths\": [\n    \"jspm_packages/npm/packageD@1.2.3\"\n  ]\n}\n\n// typings.json\n{\n  \"globalDependencies\": {\n    \"packageC\": \"registry:...\"\n  },\n  \"dependencies\": {\n    \"packageB\": \"registry:...\"\n  }\n}\n```\n### For package X\n\nAnother package X (or application) consumes package A. Since `paths` does not resolve dependencies as in the node module resolution, I have to:\n\n``` js\n// tsconfig.json\n{\n  \"paths\": {\n    \"packageA\": [ \"jspm_packages/...\" ],\n    \"packageB\": [ \"jspm_packages/...\" ],\n    \"packageC\": [ \"jspm_packages/...\" ],\n    \"packageD\": [ \"jspm_packages/...\" ],\n  }\n}\n```\n\nwhich clearly **doesn't scale** and **doesn't work with version mapping**.\n## Potential Solution (not working)\n\nMy solution is to use `typings` to do the typings dependency resolution, but currently is not possible.\n### For package A:\n\n``` js\n// package.json -- no change\n\n// tsconfig.json -- remove `paths` because we are not using it\n\n// typings.json\n{\n  \"globalDependencies\": {\n    \"packageC\": \"registry:...\"\n  },\n  \"dependencies\": {\n    \"packageB\": \"registry:...\",\n    \"packageD\": \"file:jspm_packages/npm/packageD@1.2.3/index.d.ts\"\n  }\n}\n```\n\nInstalling packageD is done by this command: `typings i -S file:jspm_packages/npm/packageD@1.2.3/index.d.ts`\n### For package X:\n\n``` js\n// tsconfig.json -- remove `paths` because we are not using it\n```\n\nAnd install packageA typings by `typings i -S file:jspm_package/npm/packageA@x.y.z`\n\nThis would solve the WHOLE jspm resolution problem because:\n- `typings` is capable of referencing typings files, `typings.json`, `package.json` (in `npm:` logic)\n- the whole dependency tree can be solved by `typings`.\n\nHowever it does not work right now for two reasons:\n- `file:` reference from current directory, thus the command above (`typings i -S file:jspm_package/npm/packageA@x.y.z`) fails with the following:\n\n``` sh\n... Unable to resolve \"file:jspm_packages/npm/packageD@1.2.3/index.d.ts\" from \"packageA\"\n... ENOENT: no such file or directory, open \n\".../packageX/jspm_packages/npm/packageA@x.y.z/jspm_packages/npm/packageD@1.2.3/index.d.ts\"\n```\n- `file:` currently only support `.d.ts` and `typings.json`, not `package.json`.\n## Real Solution\n\nThe solution is to support `jspm:` natively, #238 \nTo fully support requires us to read `package.json/jspm` and `config.js` or `jspm.config.js`. On the other hand, we can get a quick win if we do the following:\n- `jspm:` work with `package.json` just like `npm:`\n- `jspm:` work with `.d.ts` just like `file:`\n- `jspm:` work with `typings.json` similar to `file:`, except when resolving sub-dependency is `jspm:`, the resolution starts at project root instead of current directory.\n"},"comment":{"url":"https://api.github.com/repos/typings/typings/issues/comments/267811053","html_url":"https://github.com/typings/typings/issues/579#issuecomment-267811053","issue_url":"https://api.github.com/repos/typings/typings/issues/579","id":267811053,"user":{"login":"zakjan","id":173585,"avatar_url":"https://avatars.githubusercontent.com/u/173585?v=3","gravatar_id":"","url":"https://api.github.com/users/zakjan","html_url":"https://github.com/zakjan","followers_url":"https://api.github.com/users/zakjan/followers","following_url":"https://api.github.com/users/zakjan/following{/other_user}","gists_url":"https://api.github.com/users/zakjan/gists{/gist_id}","starred_url":"https://api.github.com/users/zakjan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zakjan/subscriptions","organizations_url":"https://api.github.com/users/zakjan/orgs","repos_url":"https://api.github.com/users/zakjan/repos","events_url":"https://api.github.com/users/zakjan/events{/privacy}","received_events_url":"https://api.github.com/users/zakjan/received_events","type":"User","site_admin":false},"created_at":"2016-12-18T09:15:29Z","updated_at":"2016-12-18T09:15:29Z","body":"Yep for beta testers. Personally I'm waiting for stable 0.17, which will take I guess a few more months."}}
{"actor":{"display_login":"zakjan"}}