Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 021b174

Browse filesBrowse files
JakobJingleheimeraduh95
authored andcommitted
module: tidy code string concat → string templates
PR-URL: #55820 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 6ffb66f commit 021b174
Copy full SHA for 021b174

File tree

Expand file treeCollapse file tree

1 file changed

+6
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-7
lines changed

‎lib/internal/modules/package_json_reader.js

Copy file name to clipboardExpand all lines: lib/internal/modules/package_json_reader.js
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ function parsePackageName(specifier, base) {
219219
}
220220

221221
function getPackageJSONURL(specifier, base) {
222-
const { packageName, packageSubpath, isScoped } =
223-
parsePackageName(specifier, base);
222+
const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base);
224223

225224
// ResolveSelf
226225
const packageConfig = getPackageScopeConfig(base);
@@ -231,8 +230,7 @@ function getPackageJSONURL(specifier, base) {
231230
}
232231
}
233232

234-
let packageJSONUrl =
235-
new URL('./node_modules/' + packageName + '/package.json', base);
233+
let packageJSONUrl = new URL(`./node_modules/${packageName}/package.json`, base);
236234
let packageJSONPath = fileURLToPath(packageJSONUrl);
237235
let lastPath;
238236
do {
@@ -243,9 +241,10 @@ function getPackageJSONURL(specifier, base) {
243241
// Check for !stat.isDirectory()
244242
if (stat !== 1) {
245243
lastPath = packageJSONPath;
246-
packageJSONUrl = new URL((isScoped ?
247-
'../../../../node_modules/' : '../../../node_modules/') +
248-
packageName + '/package.json', packageJSONUrl);
244+
packageJSONUrl = new URL(
245+
`${isScoped ? '../' : ''}../../../node_modules/${packageName}/package.json`,
246+
packageJSONUrl,
247+
);
249248
packageJSONPath = fileURLToPath(packageJSONUrl);
250249
continue;
251250
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.