Skip to content

Commit 321abe3

Browse files
committed
Update internal Node.js function call
This updates the call to _resolveLookupPaths. It returns a string by default since Node.js v8 when called with a third truthy argument. The backwards compatible return value should change soon, so detect what return type is used and handle both cases. Refs: nodejs/node#26983
1 parent 25264e3 commit 321abe3

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

build/get-nodejs/get-nodejs-debug.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ YUI.add('get', function (Y, NAME) {
106106
} else {
107107
try {
108108
// Try to resolve paths relative to the module that required yui.
109-
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
109+
var path = Module._resolveLookupPaths(url, module.parent.parent, true);
110+
111+
url = Module._findPath(url,
112+
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
113+
);
110114

111115
if (Y.config.useSync) {
112116
//Needs to be in useSync

build/get-nodejs/get-nodejs.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ YUI.add('get', function (Y, NAME) {
102102
} else {
103103
try {
104104
// Try to resolve paths relative to the module that required yui.
105-
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
105+
var path = Module._resolveLookupPaths(url, module.parent.parent, true);
106+
107+
url = Module._findPath(url,
108+
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
109+
);
106110

107111
if (Y.config.useSync) {
108112
//Needs to be in useSync

build/yui-nodejs/yui-nodejs-debug.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -4383,7 +4383,11 @@ YUI.add('get', function (Y, NAME) {
43834383
} else {
43844384
try {
43854385
// Try to resolve paths relative to the module that required yui.
4386-
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
4386+
var path = Module._resolveLookupPaths(url, module.parent.parent, true);
4387+
4388+
url = Module._findPath(url,
4389+
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
4390+
);
43874391

43884392
if (Y.config.useSync) {
43894393
//Needs to be in useSync

build/yui-nodejs/yui-nodejs.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -4132,7 +4132,11 @@ YUI.add('get', function (Y, NAME) {
41324132
} else {
41334133
try {
41344134
// Try to resolve paths relative to the module that required yui.
4135-
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
4135+
var path = Module._resolveLookupPaths(url, module.parent.parent, true);
4136+
4137+
url = Module._findPath(url,
4138+
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
4139+
);
41364140

41374141
if (Y.config.useSync) {
41384142
//Needs to be in useSync

src/get/js/get-nodejs.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@
104104
} else {
105105
try {
106106
// Try to resolve paths relative to the module that required yui.
107-
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
107+
var path = Module._resolveLookupPaths(url, module.parent.parent, true);
108+
109+
url = Module._findPath(url,
110+
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
111+
);
108112

109113
if (Y.config.useSync) {
110114
//Needs to be in useSync

0 commit comments

Comments
 (0)