Skip to content

Commit 174ae77

Browse files
authored
nodejs/importNpmLock: init source overrides option (#338973)
2 parents eae7121 + 34b7d20 commit 174ae77

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkgs/build-support/node/import-npm-lock/default.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ lib.fix (self: {
7272
# Example: { "node_modules/axios" = { curlOptsList = [ "--verbose" ]; }; }
7373
# This will download the axios package with curl's verbose option.
7474
, fetcherOpts ? {}
75+
# A map from node_module path to an alternative package to use instead of fetching the source in package-lock.json.
76+
# Example: { "node_modules/axios" = stdenv.mkDerivation { ... }; }
77+
# This is usefull if you want to inject custom sources for a specific package.
78+
, packageSourceOverrides ? {}
7579
}:
7680
let
7781
mapLockDependencies =
@@ -94,10 +98,10 @@ lib.fix (self: {
9498
mapAttrs
9599
(modulePath: module:
96100
let
97-
src = fetchModule {
101+
src = packageSourceOverrides.${modulePath} or (fetchModule {
98102
inherit module npmRoot;
99103
fetcherOpts = fetcherOpts.${modulePath} or {};
100-
};
104+
});
101105
in
102106
cleanModule module
103107
// lib.optionalAttrs (src != null) {

0 commit comments

Comments
 (0)