Skip to content

Commit

Permalink
Update internal Node.js function call
Browse files Browse the repository at this point in the history
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
  • Loading branch information
BridgeAR committed Apr 6, 2019
1 parent 25264e3 commit 321abe3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
6 changes: 5 additions & 1 deletion build/get-nodejs/get-nodejs-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ YUI.add('get', function (Y, NAME) {
} else {
try {
// Try to resolve paths relative to the module that required yui.
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
var path = Module._resolveLookupPaths(url, module.parent.parent, true);

url = Module._findPath(url,
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
);

if (Y.config.useSync) {
//Needs to be in useSync
Expand Down
6 changes: 5 additions & 1 deletion build/get-nodejs/get-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ YUI.add('get', function (Y, NAME) {
} else {
try {
// Try to resolve paths relative to the module that required yui.
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
var path = Module._resolveLookupPaths(url, module.parent.parent, true);

url = Module._findPath(url,
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
);

if (Y.config.useSync) {
//Needs to be in useSync
Expand Down
6 changes: 5 additions & 1 deletion build/yui-nodejs/yui-nodejs-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -4383,7 +4383,11 @@ YUI.add('get', function (Y, NAME) {
} else {
try {
// Try to resolve paths relative to the module that required yui.
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
var path = Module._resolveLookupPaths(url, module.parent.parent, true);

url = Module._findPath(url,
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
);

if (Y.config.useSync) {
//Needs to be in useSync
Expand Down
6 changes: 5 additions & 1 deletion build/yui-nodejs/yui-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4132,7 +4132,11 @@ YUI.add('get', function (Y, NAME) {
} else {
try {
// Try to resolve paths relative to the module that required yui.
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
var path = Module._resolveLookupPaths(url, module.parent.parent, true);

url = Module._findPath(url,
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
);

if (Y.config.useSync) {
//Needs to be in useSync
Expand Down
6 changes: 5 additions & 1 deletion src/get/js/get-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@
} else {
try {
// Try to resolve paths relative to the module that required yui.
url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]);
var path = Module._resolveLookupPaths(url, module.parent.parent, true);

url = Module._findPath(url,
(path.length !== 2 || typeof path[1] !== 'object') ? path : path[1]
);

if (Y.config.useSync) {
//Needs to be in useSync
Expand Down

0 comments on commit 321abe3

Please sign in to comment.