Skip to content
This repository was archived by the owner on May 17, 2025. It is now read-only.

Commit 27f728b

Browse files
committed
preserve symlinks option
1 parent 6b5e303 commit 27f728b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/generator.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,15 @@ export interface GeneratorOptions {
334334
*/
335335
fetchRetries?: number;
336336

337+
/**
338+
* The same as the Node.js `--preserve-symlinks` flag, except it will apply
339+
* to both the main and the dependencies.
340+
* See https://nodejs.org/api/cli.html#--preserve-symlinks.
341+
* This is only supported for file: URLs.
342+
* Defaults to false, like Node.js.
343+
*/
344+
preserveSymlinks?: boolean;
345+
337346
/**
338347
* Provider configuration options
339348
*
@@ -446,6 +455,7 @@ export class Generator {
446455
integrity = false,
447456
fetchRetries,
448457
providerConfig = {},
458+
preserveSymlinks,
449459
}: GeneratorOptions = {}) {
450460
// Initialise the debug logger:
451461
const { log, logStream } = createLogger();
@@ -458,6 +468,8 @@ export class Generator {
458468
}
459469
})();
460470
}
471+
if (typeof preserveSymlinks !== "boolean")
472+
preserveSymlinks = typeof process?.versions?.node === "string";
461473

462474
// Initialise the resource fetcher:
463475
let fetchOpts: Record<string, any> = {
@@ -511,7 +523,7 @@ export class Generator {
511523
env,
512524
log,
513525
fetchOpts,
514-
preserveSymlinks: typeof process?.versions?.node === "string",
526+
preserveSymlinks,
515527
traceCjs: commonJS,
516528
traceTs: typeScript,
517529
traceSystem: system,

0 commit comments

Comments
 (0)