Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use uuid for filenames instead of md5 because md5 sometimes contains …

…slashes. fixes #2
  • Loading branch information...
commit 32d3b935852d96761bf2698bb87c737ccbb09086 1 parent 8245242
Olivier Lalonde authored November 17, 2012

Showing 2 changed files with 3 additions and 4 deletions. Show diff stats Hide diff stats

  1. 6  index.js
  2. 1  package.json
6  index.js
... ...
@@ -1,7 +1,7 @@
1 1
 // @see http://nodejs.org/api/all.html#all_require_extensions
2 2
 var fs = require('fs')
3 3
   , exec = require('child_process').exec
4  
-  , crypto = require('crypto')
  4
+  , uuid = require('node-uuid')
5 5
   , fs = require('fs')
6 6
   , execSync = require('execSync');
7 7
 
@@ -11,9 +11,7 @@ var fs = require('fs')
11 11
 // @todo: cache compiled files and don't recompile them if source didn't
12 12
 //        change (last modified date comparison)
13 13
 require.extensions['.ts'] = function(module, filename) {
14  
-  var md5 = crypto.createHash('md5').update(filename).digest('base64');
15  
-
16  
-  var out = '/tmp/require-typescript-' + md5;
  14
+  var out = '/tmp/require-typescript-' + uuid.v1();
17 15
   var cmd = __dirname + '/node_modules/.bin/tsc --out ' + out + ' ' + filename;
18 16
   execSync.stdout(cmd);
19 17
   var content = fs.readFileSync(out, 'utf8');
1  package.json
@@ -18,6 +18,7 @@
18 18
   "license": "BSD",
19 19
   "dependencies": {
20 20
     "typescript": "",
  21
+    "node-uuid": "",
21 22
     "execSync": "0.0.1"
22 23
   }
23 24
 }

0 notes on commit 32d3b93

Please sign in to comment.
Something went wrong with that request. Please try again.