@esbuild-plugins/node-resolve
Advanced tools
Comparing version 0.0.6 to 0.0.7
# @esbuild-plugins/node-resolve | ||
## 0.0.7 | ||
### Patch Changes | ||
- c00f990: Never use symlinks | ||
## 0.0.6 | ||
@@ -4,0 +10,0 @@ |
@@ -71,3 +71,3 @@ "use strict"; | ||
var util_1 = require("util"); | ||
var NAME = require('../package.json').name; | ||
var NAME = 'node-resolve'; | ||
var debug = require('debug')(NAME); | ||
@@ -130,3 +130,3 @@ exports.resolveAsync = util_1.promisify(resolve_1.default); | ||
_a.trys.push([1, 3, , 7]); | ||
return [4 /*yield*/, exports.resolveAsync(args.path, __assign({ basedir: args.resolveDir, preserveSymlinks: isUsingYarnPnp, extensions: extensions, packageFilter: function (packageJSON) { | ||
return [4 /*yield*/, exports.resolveAsync(args.path, __assign({ basedir: args.resolveDir, preserveSymlinks: false, extensions: extensions, packageFilter: function (packageJSON) { | ||
var e_3, _a; | ||
@@ -133,0 +133,0 @@ if (!(mainFields === null || mainFields === void 0 ? void 0 : mainFields.length)) { |
@@ -107,2 +107,37 @@ "use strict"; | ||
}); }); | ||
test('all resolved paths are absolute', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var _a, unlink, base, _b, ENTRY, resolved, res; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, test_support_1.writeFiles({ | ||
'entry.ts': "import {x} from './utils'; console.log(x);", | ||
'utils.ts': "import mod from 'mod'; export const x = mod('x');", | ||
'node_modules/mod/index.js': 'export default () => {}', | ||
})]; | ||
case 1: | ||
_a = _c.sent(), unlink = _a.unlink, base = _a.base, _b = __read(_a.paths, 1), ENTRY = _b[0]; | ||
resolved = []; | ||
return [4 /*yield*/, esbuild_1.build({ | ||
entryPoints: [ENTRY], | ||
write: false, | ||
format: 'esm', | ||
bundle: true, | ||
plugins: [ | ||
_1.default({ | ||
extensions: ['.js', '.ts'], | ||
onResolved: function (x) { | ||
resolved.push(x); | ||
return x; | ||
}, | ||
}), | ||
], | ||
})]; | ||
case 2: | ||
res = _c.sent(); | ||
expect(resolved.filter(function (x) { return path_1.default.isAbsolute(x); }).length).toEqual(3); | ||
unlink(); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
test('does not throw when onUnresolved', function () { return __awaiter(void 0, void 0, void 0, function () { | ||
@@ -109,0 +144,0 @@ var _a, unlink, _b, ENTRY, called; |
{ | ||
"name": "@esbuild-plugins/node-resolve", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -48,2 +48,33 @@ import { build } from 'esbuild' | ||
test('all resolved paths are absolute', async () => { | ||
const { | ||
unlink, | ||
base, | ||
paths: [ENTRY], | ||
} = await writeFiles({ | ||
'entry.ts': `import {x} from './utils'; console.log(x);`, | ||
'utils.ts': `import mod from 'mod'; export const x = mod('x');`, | ||
'node_modules/mod/index.js': 'export default () => {}', | ||
}) | ||
let resolved: string[] = [] | ||
const res = await build({ | ||
entryPoints: [ENTRY], | ||
write: false, | ||
format: 'esm', | ||
bundle: true, | ||
plugins: [ | ||
NodeResolvePlugin({ | ||
extensions: ['.js', '.ts'], | ||
onResolved: (x) => { | ||
resolved.push(x) | ||
return x | ||
}, | ||
}), | ||
], | ||
}) | ||
expect(resolved.filter((x) => path.isAbsolute(x)).length).toEqual(3) | ||
unlink() | ||
// console.log(formatEsbuildOutput(res)) | ||
}) | ||
test('does not throw when onUnresolved', async () => { | ||
@@ -50,0 +81,0 @@ const { |
@@ -9,3 +9,3 @@ import { OnResolveArgs, OnResolveResult, Plugin } from 'esbuild' | ||
const NAME = require('../package.json').name | ||
const NAME = 'node-resolve' | ||
const debug = require('debug')(NAME) | ||
@@ -83,3 +83,3 @@ | ||
basedir: args.resolveDir, | ||
preserveSymlinks: isUsingYarnPnp, | ||
preserveSymlinks: false, | ||
extensions, | ||
@@ -86,0 +86,0 @@ packageFilter: (packageJSON) => { |
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
59026
983