digitalmars.D.announce - typescript plugin for vibe.d diet templates
- Mengu (8/8) Jan 17 2015 a friend of mine liked d so much -you know, after i show off all
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (18/26) Jan 17 2015 Nice work, but I have some gripes with it:
- Fatih Kadir Akin (10/25) Jan 17 2015 TypeScript compiler doesn't accept stdin pipes, I tried using
- Jacob Carlborg (6/9) Jan 18 2015 How about embedding the TypeScript compiler and call it from D, perhaps
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (10/33) Jan 18 2015 I was going to make a PR to use pipes, but also found that `tsc`
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (3/4) Jan 18 2015 I'm in awe! :)
a friend of mine liked d so much -you know, after i show off all the kewl features :)- he just built a typescript plugin for vibe.d diet templates. it's a fork of martin's coffeescript plugin. https://github.com/f/diet-typescript for the uninformed, typescript is a typed superset of javascript that compiles to plain old javascript. more info can be reached at www.typescriptlang.org.
Jan 17 2015
On Saturday, 17 January 2015 at 11:26:40 UTC, Mengu wrote:a friend of mine liked d so much -you know, after i show off all the kewl features :)- he just built a typescript plugin for vibe.d diet templates. it's a fork of martin's coffeescript plugin. https://github.com/f/diet-typescript for the uninformed, typescript is a typed superset of javascript that compiles to plain old javascript. more info can be reached at www.typescriptlang.org.Nice work, but I have some gripes with it: First, creating temporary files with predictable names is a bad idea, because it opens the door for symlink attacks. Unfortunately, I don't know of an alternative way to do this safely using only the standard library; it seems, this crucial functionality is missing. I've asked here: http://forum.dlang.org/thread/xliylzcxrsfilmqsncxf forum.dlang.org The second thing is that you're using `pipeShell()`, which takes only the entire command as a parameter. Because this command will be interpreted by the shell, you have to make sure that all you're arguments are correctly escaped. However, in your case you don't actually need a shell; `pipeProcess()` is a better solution, because it takes the argument list as an array: auto pipes = pipeProcess( ["tsc", inputFileName, "--out", outputFileName], Redirect.stderrToStdout | Redirect.stdout );
Jan 17 2015
First, creating temporary files with predictable names is a bad idea, because it opens the door for symlink attacks. Unfortunately, I don't know of an alternative way to do this safely using only the standard library; it seems, this crucial functionality is missing. I've asked here:TypeScript compiler doesn't accept stdin pipes, I tried using Unix fifo but since I'm not an Unix expert, couldn't figure it out. The last thing was using a temporary file -- which also sounds not good to me :)The second thing is that you're using `pipeShell()`, which takes only the entire command as a parameter. Because this command will be interpreted by the shell, you have to make sure that all you're arguments are correctly escaped. However, in your case you don't actually need a shell; `pipeProcess()` is a better solution, because it takes the argument list as an array: auto pipes = pipeProcess( ["tsc", inputFileName, "--out", outputFileName], Redirect.stderrToStdout | Redirect.stdout );It really makes sense, I'm going to update -- you also can open a PR. I met the language yesterday, I wrote the package yesterday :) I don't know internals, but when I learn them, (which is happening by now) going to fix it, Thanks for your detailed comments! :)
Jan 17 2015
On 2015-01-17 19:24, Fatih Kadir Akin wrote:TypeScript compiler doesn't accept stdin pipes, I tried using Unix fifo but since I'm not an Unix expert, couldn't figure it out. The last thing was using a temporary file -- which also sounds not good to me :)How about embedding the TypeScript compiler and call it from D, perhaps using DMDScript [1]. [1] http://code.dlang.org/packages/dmdscript -- /Jacob Carlborg
Jan 18 2015
On Saturday, 17 January 2015 at 18:24:52 UTC, Fatih Kadir Akin wrote:I was going to make a PR to use pipes, but also found that `tsc` sadly doesn't support stdin/stdout. But they have an as-of-yet unimplemented enhancement request; they probably wouldn't refuse a PR: https://github.com/Microsoft/TypeScript/issues/1226 As for FIFOs, they unfortunately don't work on Windows... (and NTFS _does_ support symlinks!)First, creating temporary files with predictable names is a bad idea, because it opens the door for symlink attacks. Unfortunately, I don't know of an alternative way to do this safely using only the standard library; it seems, this crucial functionality is missing. I've asked here:TypeScript compiler doesn't accept stdin pipes, I tried using Unix fifo but since I'm not an Unix expert, couldn't figure it out. The last thing was using a temporary file -- which also sounds not good to me :)https://github.com/f/diet-typescript/pull/1The second thing is that you're using `pipeShell()`, which takes only the entire command as a parameter. Because this command will be interpreted by the shell, you have to make sure that all you're arguments are correctly escaped. However, in your case you don't actually need a shell; `pipeProcess()` is a better solution, because it takes the argument list as an array: auto pipes = pipeProcess( ["tsc", inputFileName, "--out", outputFileName], Redirect.stderrToStdout | Redirect.stdout );It really makes sense, I'm going to update -- you also can open a PR.
Jan 18 2015
On 01/17/2015 10:24 AM, Fatih Kadir Akin wrote:I met the language yesterday, I wrote the package yesterday :)I'm in awe! :) Ali
Jan 18 2015