Skip to content

Commit 1237a97

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 1237a97

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ 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, (typeof path === 'string' || path === null) ? path : path[1]);
110112

111113
if (Y.config.useSync) {
112114
//Needs to be in useSync

build/get-nodejs/get-nodejs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ 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, (typeof path === 'string' || path === null) ? path : path[1]);
106108

107109
if (Y.config.useSync) {
108110
//Needs to be in useSync

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4383,7 +4383,9 @@ 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, (typeof path === 'string' || path === null) ? path : path[1]);
43874389

43884390
if (Y.config.useSync) {
43894391
//Needs to be in useSync

build/yui-nodejs/yui-nodejs.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4132,7 +4132,9 @@ 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, (typeof path === 'string' || path === null) ? path : path[1]);
41364138

41374139
if (Y.config.useSync) {
41384140
//Needs to be in useSync

0 commit comments

Comments
 (0)