@esbuild-plugins/node-resolve
Advanced tools
Comparing version 0.0.8 to 0.0.9
# @esbuild-plugins/node-resolve | ||
## 0.0.9 | ||
### Patch Changes | ||
- 69e5c9c: Node resolve asyncResolve does not resolve to wrong extension | ||
## 0.0.8 | ||
@@ -4,0 +10,0 @@ |
@@ -73,3 +73,19 @@ "use strict"; | ||
var debug = require('debug')(NAME); | ||
exports.resolveAsync = util_1.promisify(resolve_1.default); | ||
var resolveAsync = function (id, opts) { return __awaiter(void 0, void 0, void 0, function () { | ||
var result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, util_1.promisify(resolve_1.default)(id, opts)]; | ||
case 1: | ||
result = _a.sent(); | ||
if (result && | ||
opts.extensions && | ||
!opts.extensions.includes(path_1.default.extname(result))) { | ||
return [2 /*return*/]; | ||
} | ||
return [2 /*return*/, result]; | ||
} | ||
}); | ||
}); }; | ||
exports.resolveAsync = resolveAsync; | ||
var isUsingYarnPnp = false; | ||
@@ -194,6 +210,9 @@ try { | ||
debug('onResolve'); | ||
return [2 /*return*/, { | ||
path: resolved, | ||
namespace: namespace, | ||
}]; | ||
if (resolved) { | ||
return [2 /*return*/, { | ||
path: resolved, | ||
namespace: namespace, | ||
}]; | ||
} | ||
return [2 /*return*/]; | ||
} | ||
@@ -200,0 +219,0 @@ }); |
{ | ||
"name": "@esbuild-plugins/node-resolve", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -15,3 +15,13 @@ import { OnResolveArgs, OnResolveResult, Plugin } from 'esbuild' | ||
opts: AsyncOpts, | ||
) => Promise<string | void> = promisify(resolve) | ||
) => Promise<string | void> = async (id, opts) => { | ||
const result = await promisify(resolve as any)(id, opts) | ||
if ( | ||
result && | ||
opts.extensions && | ||
!opts.extensions.includes(path.extname(result)) | ||
) { | ||
return | ||
} | ||
return result | ||
} | ||
@@ -138,5 +148,7 @@ interface Options { | ||
debug('onResolve') | ||
return { | ||
path: resolved, | ||
namespace, | ||
if (resolved) { | ||
return { | ||
path: resolved, | ||
namespace, | ||
} | ||
} | ||
@@ -143,0 +155,0 @@ }) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61392
1025