{"_id":"node-typescript","_rev":"204141","name":"node-typescript","description":"The TypeScript API exposed to nodejs. Use to compile typescript code in memory","dist-tags":{"latest":"0.1.3"},"maintainers":[{"name":"diullei","email":"diullei@gmail.com"}],"time":{"modified":"2021-06-03T13:05:44.000Z","created":"2013-03-16T18:49:19.885Z","0.1.3":"2013-03-17T19:52:04.440Z","0.1.2":"2013-03-17T19:35:28.222Z","0.1.1":"2013-03-16T18:50:19.675Z","0.1.0":"2013-03-16T18:49:19.885Z"},"users":{"mhfrantz":true},"author":{"name":"Diullei Gomes","email":"diullei@gmail.com"},"repository":{"type":"git","url":"git://github.com/Diullei/node-typescript"},"versions":{"0.1.3":{"version":"0.1.3","author":{"name":"Diullei Gomes","email":"diullei@gmail.com"},"license":"MIT","name":"node-typescript","description":"The TypeScript API exposed to nodejs. Use to compile typescript code in memory","keywords":["TypeScript","Microsoft","compiler","language","javascript","nodejs"],"homepage":"","repository":{"type":"git","url":"git://github.com/Diullei/node-typescript"},"engines":{"node":"0.8.x"},"directories":{"lib":"./"},"main":"./ts-c.js","dependencies":{"typescript":"0.8.3"},"readmeFilename":"README.md","_id":"node-typescript@0.1.3","dist":{"shasum":"c57923f0e32f38d7c63e627d88f7984af2327d5a","size":11474,"noattachment":false,"key":"/node-typescript/-/node-typescript-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/node-typescript/download/node-typescript-0.1.3.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"diullei","email":"diullei@gmail.com"},"maintainers":[{"name":"diullei","email":"diullei@gmail.com"}],"publish_time":1363549924440,"_cnpm_publish_time":1363549924440,"_hasShrinkwrap":false},"0.1.2":{"version":"0.1.2","author":{"name":"Diullei Gomes","email":"diullei@gmail.com"},"license":"MIT","name":"node-typescript","description":"The TypeScript API exposed to nodejs. Use to compile typescript code in memory","keywords":["TypeScript","Microsoft","compiler","language","javascript","nodejs"],"homepage":"","repository":{"type":"git","url":"git://github.com/Diullei/node-typescript"},"engines":{"node":"0.8.x"},"directories":{"lib":"./"},"main":"./ts-c.js","dependencies":{"typescript":"0.8.3"},"readmeFilename":"README.md","_id":"node-typescript@0.1.2","dist":{"shasum":"b3807f78ada5e93d0fc815e81a2fc0fa0faec1c1","size":11470,"noattachment":false,"key":"/node-typescript/-/node-typescript-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/node-typescript/download/node-typescript-0.1.2.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"diullei","email":"diullei@gmail.com"},"maintainers":[{"name":"diullei","email":"diullei@gmail.com"}],"publish_time":1363548928222,"_cnpm_publish_time":1363548928222,"_hasShrinkwrap":false},"0.1.1":{"version":"0.1.1","author":{"name":"Diullei Gomes","email":"diullei@gmail.com"},"name":"node-typescript","description":"The TypeScript API exposed to nodejs. Use to compile typescript code in memory","keywords":["TypeScript","Microsoft","compiler","language","javascript","nodejs"],"homepage":"","repository":{"type":"git","url":"git://github.com/Diullei/node-typescript"},"engines":{"node":"0.8.x"},"main":"./lib/compiler","dependencies":{"typescript":"0.8.3"},"readmeFilename":"README.md","_id":"node-typescript@0.1.1","dist":{"shasum":"55a5a8ed3c0aebc6720b6503b182d403ae412b40","size":11307,"noattachment":false,"key":"/node-typescript/-/node-typescript-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/node-typescript/download/node-typescript-0.1.1.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"diullei","email":"diullei@gmail.com"},"maintainers":[{"name":"diullei","email":"diullei@gmail.com"}],"directories":{},"publish_time":1363459819675,"_cnpm_publish_time":1363459819675,"_hasShrinkwrap":false},"0.1.0":{"version":"0.1.0","author":{"name":"Diullei Gomes","email":"diullei@gmail.com"},"name":"node-typescript","description":"The TypeScript API exposed to nodejs. Use to compile typescript code in memory","keywords":["TypeScript","Microsoft","compiler","language","javascript","nodejs"],"homepage":"","repository":{"type":"git","url":"git://github.com/Diullei/node-typescript"},"engines":{"node":"0.8.x"},"main":"./lib/compiler","dependencies":{"typescript":"0.8.3"},"readmeFilename":"README.md","_id":"node-typescript@0.1.0","dist":{"shasum":"5d392f7099bc38673f00f54f9c503678230d6301","size":11307,"noattachment":false,"key":"/node-typescript/-/node-typescript-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/node-typescript/download/node-typescript-0.1.0.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"diullei","email":"diullei@gmail.com"},"maintainers":[{"name":"diullei","email":"diullei@gmail.com"}],"directories":{},"publish_time":1363459759885,"_cnpm_publish_time":1363459759885,"_hasShrinkwrap":false}},"readme":"node-typescript\r\n===============\r\n\r\nThe TypeScript API exposed to nodejs. Use to compile typescript code in memory.\r\n\r\n## Usage\r\n\r\ninstall `node-typescript` with npm:\r\n\r\n\tnpm i node-typescript\r\n\r\nCreate a file with this sample code:\r\n\r\n```javascript\r\nvar tsc = require('./node_modules/node-typescript/lib/compiler');\r\nvar compiler = tsc.compiler;\r\n\r\ntsc.initDefault();\r\n\r\nvar code = '\\\r\nclass Greeter {\\\r\n    greeting: string;\\\r\n    constructor(message: string) {\\\r\n        this.greeting = message;\\\r\n    }\\\r\n    greet() {\\\r\n        return \"Hello, \" + this.greeting;\\\r\n    }\\\r\n}\\\r\nvar greeter = new Greeter(\"world\");\\\r\nvar button = document.createElement(\"button\");\\\r\nbutton.innerText = \"Say Hello\";\\\r\nbutton.onclick = function() {\\\r\n    alert(greeter.greet());\\\r\n};\\\r\ndocument.body.appendChild(button);\\\r\n';\r\n\r\ntsc.resolve(__dirname + '/xxx.ts', code, compiler);\r\n\r\ncompiler.typeCheck();\r\n\r\nvar stdout = new tsc.EmitterIOHost();\r\ncompiler.emit(stdout);\r\n```\r\n\r\nGet the javascript output in `stdout.fileCollection`. To this example the javascript output is:\r\n\r\n```javascript\r\n{ '.../xxx.js':\r\n   { lines:\r\n      [ 'var Greeter = (function () {',\r\n        '    function Greeter(message) {',\r\n        '        this.greeting = message;',\r\n        '    }',\r\n        '    Greeter.prototype.greet = function () {',\r\n        '        return \"Hello, \" + this.greeting;',\r\n        '    };',\r\n        '    return Greeter;',\r\n        '})();',\r\n        'var greeter = new Greeter(\"world\");',\r\n        'var button = document.createElement(\"button\");',\r\n        'button.innerText = \"Say Hello\";',\r\n        'button.onclick = function () {',\r\n        '    alert(greeter.greet());',\r\n        '};',\r\n        'document.body.appendChild(button);' ],\r\n     currentLine: '' } }\r\n```","_attachments":{},"readmeFilename":"README.md","homepage":"","license":"MIT"}