From 34ae5469b654b9e36bca0c4a5ba97a28955fc654 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Fri, 10 Apr 2020 23:11:41 -0700 Subject: [PATCH] fixup! feat(builtin): use linker for all generated :bin targets --- internal/linker/index.js | 8 ++++---- internal/linker/link_node_modules.ts | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/linker/index.js b/internal/linker/index.js index 87e8cc2c65..4f30625f9a 100644 --- a/internal/linker/index.js +++ b/internal/linker/index.js @@ -145,7 +145,7 @@ class Runfiles { if (path.isAbsolute(modulePath)) { return modulePath; } - const result = this._resolve(modulePath, ''); + const result = this._resolve(modulePath, undefined); if (result) { return result; } @@ -158,7 +158,7 @@ class Runfiles { const result = this.lookupDirectory(moduleBase); if (result) { if (moduleTail) { - const maybe = path.join(result, moduleTail); + const maybe = path.join(result, moduleTail || ''); if (fs.existsSync(maybe)) { return maybe; } @@ -169,7 +169,7 @@ class Runfiles { } } if (exports.runfiles.dir) { - const maybe = path.join(exports.runfiles.dir, moduleBase, moduleTail); + const maybe = path.join(exports.runfiles.dir, moduleBase, moduleTail || ''); if (fs.existsSync(maybe)) { return maybe; } @@ -178,7 +178,7 @@ class Runfiles { if (dirname == '.') { return undefined; } - return this._resolve(dirname, path.join(path.basename(moduleBase), moduleTail)); + return this._resolve(dirname, path.join(path.basename(moduleBase), moduleTail || '')); } resolveWorkspaceRelative(modulePath) { if (!this.workspace) { diff --git a/internal/linker/link_node_modules.ts b/internal/linker/link_node_modules.ts index 240f2c2ce1..848d9fff47 100644 --- a/internal/linker/link_node_modules.ts +++ b/internal/linker/link_node_modules.ts @@ -246,7 +246,7 @@ export class Runfiles { if (path.isAbsolute(modulePath)) { return modulePath; } - const result = this._resolve(modulePath, ''); + const result = this._resolve(modulePath, undefined); if (result) { return result; } @@ -255,12 +255,12 @@ export class Runfiles { throw e; } - _resolve(moduleBase: string, moduleTail: string): string|undefined { + _resolve(moduleBase: string, moduleTail: string|undefined): string|undefined { if (this.manifest) { const result = this.lookupDirectory(moduleBase); if (result) { if (moduleTail) { - const maybe = path.join(result, moduleTail); + const maybe = path.join(result, moduleTail || ''); if (fs.existsSync(maybe)) { return maybe; } @@ -270,7 +270,7 @@ export class Runfiles { } } if (runfiles.dir) { - const maybe = path.join(runfiles.dir, moduleBase, moduleTail); + const maybe = path.join(runfiles.dir, moduleBase, moduleTail || ''); if (fs.existsSync(maybe)) { return maybe; } @@ -280,7 +280,7 @@ export class Runfiles { // no match return undefined; } - return this._resolve(dirname, path.join(path.basename(moduleBase), moduleTail)); + return this._resolve(dirname, path.join(path.basename(moduleBase), moduleTail || '')); } resolveWorkspaceRelative(modulePath: string) {