@rollup/plugin-node-resolve
Advanced tools
Comparing version 13.0.1 to 13.0.2
# @rollup/plugin-node-resolve ChangeLog | ||
## v13.0.2 | ||
_2021-07-15_ | ||
### Bugfixes | ||
- fix | ||
## v13.0.1 | ||
@@ -446,2 +454,2 @@ | ||
- First release | ||
- First release |
@@ -24,10 +24,11 @@ 'use strict'; | ||
const access = util.promisify(fs__default['default'].access); | ||
util.promisify(fs__default['default'].access); | ||
const readFile$1 = util.promisify(fs__default['default'].readFile); | ||
const realpath = util.promisify(fs__default['default'].realpath); | ||
const stat = util.promisify(fs__default['default'].stat); | ||
async function exists(filePath) { | ||
async function fileExists(filePath) { | ||
try { | ||
await access(filePath); | ||
return true; | ||
const res = await stat(filePath); | ||
return res.isFile(); | ||
} catch { | ||
@@ -255,4 +256,2 @@ return false; | ||
const fileExists = util.promisify(fs__default['default'].exists); | ||
function isModuleDir(current, moduleDirs) { | ||
@@ -571,3 +570,3 @@ return moduleDirs.some((dir) => current.endsWith(dir)); | ||
const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf-8')); | ||
return { pkgJsonPath, pkgJson }; | ||
return { pkgJsonPath, pkgJson, pkgPath: path.dirname(pkgJsonPath) }; | ||
} catch (_) { | ||
@@ -660,8 +659,7 @@ return null; | ||
if (result && result.pkgJson.exports) { | ||
const { pkgJson, pkgJsonPath } = result; | ||
const { pkgJson, pkgJsonPath, pkgPath } = result; | ||
try { | ||
const subpath = | ||
pkgName === importSpecifier ? '.' : `.${importSpecifier.substring(pkgName.length)}`; | ||
const pkgDr = pkgJsonPath.replace('package.json', ''); | ||
const pkgURL = url.pathToFileURL(pkgDr); | ||
const pkgURL = url.pathToFileURL(`${pkgPath}/`); | ||
@@ -704,3 +702,3 @@ const context = { | ||
if (!preserveSymlinks) { | ||
if (await exists(location)) { | ||
if (await fileExists(location)) { | ||
location = await realpath(location); | ||
@@ -1015,4 +1013,4 @@ } | ||
if (hasPackageEntry && !preserveSymlinks) { | ||
const fileExists = await exists(location); | ||
if (fileExists) { | ||
const exists = await fileExists(location); | ||
if (exists) { | ||
location = await realpath(location); | ||
@@ -1037,3 +1035,3 @@ } | ||
if (options.modulesOnly && (await exists(location))) { | ||
if (options.modulesOnly && (await fileExists(location))) { | ||
const code = await readFile$1(location, 'utf-8'); | ||
@@ -1040,0 +1038,0 @@ if (isModule__default['default'](code)) { |
@@ -11,10 +11,11 @@ import path, { dirname, resolve, extname, normalize, sep } from 'path'; | ||
const access = promisify(fs.access); | ||
promisify(fs.access); | ||
const readFile$1 = promisify(fs.readFile); | ||
const realpath = promisify(fs.realpath); | ||
const stat = promisify(fs.stat); | ||
async function exists(filePath) { | ||
async function fileExists(filePath) { | ||
try { | ||
await access(filePath); | ||
return true; | ||
const res = await stat(filePath); | ||
return res.isFile(); | ||
} catch { | ||
@@ -242,4 +243,2 @@ return false; | ||
const fileExists = promisify(fs.exists); | ||
function isModuleDir(current, moduleDirs) { | ||
@@ -558,3 +557,3 @@ return moduleDirs.some((dir) => current.endsWith(dir)); | ||
const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf-8')); | ||
return { pkgJsonPath, pkgJson }; | ||
return { pkgJsonPath, pkgJson, pkgPath: dirname(pkgJsonPath) }; | ||
} catch (_) { | ||
@@ -647,8 +646,7 @@ return null; | ||
if (result && result.pkgJson.exports) { | ||
const { pkgJson, pkgJsonPath } = result; | ||
const { pkgJson, pkgJsonPath, pkgPath } = result; | ||
try { | ||
const subpath = | ||
pkgName === importSpecifier ? '.' : `.${importSpecifier.substring(pkgName.length)}`; | ||
const pkgDr = pkgJsonPath.replace('package.json', ''); | ||
const pkgURL = pathToFileURL(pkgDr); | ||
const pkgURL = pathToFileURL(`${pkgPath}/`); | ||
@@ -691,3 +689,3 @@ const context = { | ||
if (!preserveSymlinks) { | ||
if (await exists(location)) { | ||
if (await fileExists(location)) { | ||
location = await realpath(location); | ||
@@ -1002,4 +1000,4 @@ } | ||
if (hasPackageEntry && !preserveSymlinks) { | ||
const fileExists = await exists(location); | ||
if (fileExists) { | ||
const exists = await fileExists(location); | ||
if (exists) { | ||
location = await realpath(location); | ||
@@ -1024,3 +1022,3 @@ } | ||
if (options.modulesOnly && (await exists(location))) { | ||
if (options.modulesOnly && (await fileExists(location))) { | ||
const code = await readFile$1(location, 'utf-8'); | ||
@@ -1027,0 +1025,0 @@ if (isModule(code)) { |
{ | ||
"name": "@rollup/plugin-node-resolve", | ||
"version": "13.0.1", | ||
"version": "13.0.2", | ||
"publishConfig": { | ||
@@ -28,11 +28,12 @@ "access": "public" | ||
"build": "rollup -c", | ||
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov", | ||
"ci:lint": "pnpm run build && pnpm run lint", | ||
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov", | ||
"ci:lint": "pnpm build && pnpm lint", | ||
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", | ||
"ci:test": "pnpm run test -- --verbose && pnpm run test:ts", | ||
"ci:test": "pnpm test -- --verbose && pnpm test:ts", | ||
"prebuild": "del-cli dist", | ||
"prepare": "pnpm run build", | ||
"prepublishOnly": "pnpm -w run lint && pnpm run test && pnpm run test:ts", | ||
"pretest": "pnpm run build", | ||
"test": "ava", | ||
"prepare": "if [ ! -d 'dist' ]; then pnpm build; fi", | ||
"prerelease": "pnpm build", | ||
"pretest": "pnpm build", | ||
"release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name", | ||
"test": "ava && pnpm test:ts", | ||
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit" | ||
@@ -39,0 +40,0 @@ }, |
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
88277
1977