pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/nodejs/node/commit/141be923f3249af870f274524dd0dacd3faf22c8

" /> module: skip preserveSymlinks for main · nodejs/node@141be92 · GitHub
Skip to content

Commit 141be92

Browse files
committed
module: skip preserveSymlinks for main
PR-URL: #19388 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2540581 commit 141be92

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

lib/internal/modules/esm/default_resolve.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ function resolve(specifier, parentURL) {
6969
throw e;
7070
}
7171

72-
if (!preserveSymlinks) {
72+
const isMain = parentURL === undefined;
73+
74+
if (!preserveSymlinks || isMain) {
7375
const real = realpathSync(getPathFromURL(url), {
7476
[internalFS.realpathCacheKey]: realpathCache
7577
});
@@ -83,7 +85,6 @@ function resolve(specifier, parentURL) {
8385

8486
let format = extensionFormatMap[ext];
8587
if (!format) {
86-
const isMain = parentURL === undefined;
8788
if (isMain)
8889
format = 'cjs';
8990
else
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const path = require('path');
6+
const { spawn } = require('child_process');
7+
const tmpdir = require('../common/tmpdir');
8+
const fs = require('fs');
9+
tmpdir.refresh();
10+
11+
const realPath = path.resolve(__dirname, '../fixtures/es-modules/symlink.mjs');
12+
const symlinkPath = path.resolve(tmpdir.path, 'symlink.js');
13+
14+
try {
15+
fs.symlinkSync(realPath, symlinkPath);
16+
} catch (err) {
17+
if (err.code !== 'EPERM') throw err;
18+
common.skip('insufficient privileges for symlinks');
19+
}
20+
21+
spawn(process.execPath,
22+
['--experimental-modules', '--preserve-symlinks', symlinkPath],
23+
{ stdio: 'inherit' }).on('exit', (code) => {
24+
assert.strictEqual(code, 0);
25+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export var symlinked = true;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy