Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
remove empiric rules for FLAG_DISABLE_DOT_NODE. fixes sha3
Browse files Browse the repository at this point in the history
  • Loading branch information
igorklopov committed May 24, 2017
1 parent 8c55615 commit af10e79
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
17 changes: 9 additions & 8 deletions prelude/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1265,16 +1265,17 @@ var modifyNativeAddonWin32 = (function () {
Module._resolveFilename = function (request) {
var filename;

var reqDotNode = (request.slice(-5) === '.node'); // bindings.js: opts.bindings += '.node'
var reqLeftSlash = (request.indexOf('\\') >= 0); // heapdump: require('../build/Release/addon')
var reqRightSlash = (request.indexOf('/') >= 0); // slash means that non-package is required ...
var enable = reqDotNode || reqLeftSlash || reqRightSlash; // ... (had a problem in levelup/pouchdb)

FLAG_DISABLE_DOT_NODE = !enable;
try {
filename = ancestor._resolveFilename.apply(this, arguments);
} finally {
FLAG_DISABLE_DOT_NODE = false;
} catch (error) {
if (error.code !== 'MODULE_NOT_FOUND') throw error;

FLAG_DISABLE_DOT_NODE = true;
try {
filename = ancestor._resolveFilename.apply(this, arguments);
} finally {
FLAG_DISABLE_DOT_NODE = false;
}
}

if (!insideSnapshot(filename)) {
Expand Down
1 change: 1 addition & 0 deletions test/test-79-npm/sha3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "private": true }
6 changes: 6 additions & 0 deletions test/test-79-npm/sha3/sha3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

var sha3 = require('sha3');
if (sha3.SHA3Hash) {
console.log('ok');
}
9 changes: 9 additions & 0 deletions test/test-79-npm/sha3/sha3.meta.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

const home = require('../home.js');

module.exports = function (stamp) {
return {
allow: home(stamp)
};
};

0 comments on commit af10e79

Please sign in to comment.