Skip to content

Commit c2c1e03

Browse files
author
Eric MORAND
authored
Merge pull request #69 from ericmorand/issue_66
Fix issue #66
2 parents a3260f7 + 89bca97 commit c2c1e03

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"dateformat-converter": "^2.0.1",
4848
"eval": "^0.1.2",
4949
"fs-extra": "^5.0.0",
50-
"hash.js": "^1.1.3",
5150
"htmlspecialchars": "^1.0.5",
5251
"iconv-lite": "^0.4.19",
5352
"is-integer": "^1.0.7",
@@ -63,7 +62,7 @@
6362
"regex-parser": "^2.2.8",
6463
"require-uncached": "^1.0.3",
6564
"secure-filters": "^1.1.0",
66-
"sha.js": "^2.4.9",
65+
"sha.js": "^2.4.10",
6766
"snake-case": "^2.1.0",
6867
"stack-trace": "0.0.10",
6968
"tmp": "0.0.33",

src/twing/cache/filesystem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {TwingCacheInterface} from "../cache-interface";
22

33
let fs = require('fs-extra');
44
let path = require('path');
5-
let hashJs = require('hash.js');
5+
let hashJs = require('sha.js');
66
let tmp = require('tmp');
77

88
/**
@@ -26,7 +26,7 @@ export class TwingCacheFilesystem implements TwingCacheInterface {
2626
}
2727

2828
generateKey(name: string, className: string) {
29-
let hash: string = hashJs.sha256().update(className).digest('hex');
29+
let hash: string = hashJs('sha256').update(className).digest('hex');
3030

3131
return path.join(
3232
this.directory,

src/twing/environment.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {TwingRuntimeLoaderInterface} from "./runtime-loader-interface";
3333
import {TwingReflectionObject} from "./reflection-object";
3434

3535
const merge = require('merge');
36-
const hash = require('hash.js');
36+
const hash = require('sha.js');
3737
const path = require('path');
3838

3939
/**
@@ -290,7 +290,7 @@ export class TwingEnvironment {
290290
getTemplateClass(name: string, index: number = null) {
291291
let key = this.getLoader().getCacheKey(name) + this.optionsHash;
292292

293-
return this.templateClassPrefix + hash.sha256().update(key).digest('hex') + (index === null ? '' : '_' + index);
293+
return this.templateClassPrefix + hash('sha256').update(key).digest('hex') + (index === null ? '' : '_' + index);
294294
}
295295

296296
/**
@@ -450,7 +450,7 @@ export class TwingEnvironment {
450450
*/
451451
createTemplate(template: string) {
452452
let result: TwingTemplate;
453-
let name = `__string_template__${hash.sha256().update(template).digest('hex')}`;
453+
let name = `__string_template__${hash('sha256').update(template).digest('hex')}`;
454454
let current = this.getLoader();
455455

456456
let loader = new TwingLoaderChain([

0 commit comments

Comments
 (0)