nodePackages: update

This commit is contained in:
Malo Bourgon 2019-07-15 11:35:07 -07:00 committed by Alyssa Ross
parent d1ba913ddd
commit 00f6c93f83
No known key found for this signature in database
GPG Key ID: F9DBED4859B271C0
5 changed files with 4008 additions and 3824 deletions

View File

@ -1,8 +1,8 @@
# This file has been generated by node2nix 1.6.0. Do not edit!
# This file has been generated by node2nix 1.7.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs.nodejs-10_x}:
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-10_x"}:
let
nodeEnv = import ./node-env.nix {

View File

@ -1,8 +1,8 @@
# This file has been generated by node2nix 1.6.0. Do not edit!
# This file has been generated by node2nix 1.7.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs.nodejs-6_x}:
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
let
nodeEnv = import ./node-env.nix {

View File

@ -11,7 +11,7 @@ let
cat > $out/bin/tar <<EOF
#! ${stdenv.shell} -e
$(type -p tar) "\$@" --warning=no-unknown-keyword
$(type -p tar) "\$@" --warning=no-unknown-keyword --delay-directory-restore
EOF
chmod +x $out/bin/tar
@ -72,7 +72,7 @@ let
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
# Restore write permissions to make building work
find "$packageDir" -type d -print0 | xargs -0 chmod u+x
find "$packageDir" -type d -exec chmod u+x {} \;
chmod -R u+w "$packageDir"
# Move the extracted tarball into the output folder
@ -219,7 +219,16 @@ let
packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads.
}
packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories.
if(dependency.resolved) {
packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided
} else {
packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories.
}
if(dependency.from !== undefined) { // Adopt from property if one has been provided
packageObj["_from"] = dependency.from;
}
fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2));
}
@ -308,50 +317,11 @@ let
'';
};
# Builds and composes an NPM package including all its dependencies
buildNodePackage =
{ name
, packageName
, version
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, preRebuild ? ""
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];
in
stdenv.mkDerivation ({
name = "node-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase;
compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
installPhase = ''
# Create and enter a root node_modules/ folder
mkdir -p $out/lib/node_modules
cd $out/lib/node_modules
# Compose the package and all its dependencies
source $compositionScriptPath
''
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
source $pinpointDependenciesScriptPath
@ -375,11 +345,18 @@ let
runHook preRebuild
${stdenv.lib.optionalString bypassCache ''
if [ ! -f package-lock.json ]
then
echo "No package-lock.json file found, reconstructing..."
node ${reconstructPackageLock}
fi
${stdenv.lib.optionalString reconstructLock ''
if [ -f package-lock.json ]
then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!"
rm package-lock.json
else
echo "No package-lock.json file found, reconstructing..."
fi
node ${reconstructPackageLock}
''}
node ${addIntegrityFieldsScript}
''}
@ -393,6 +370,53 @@ let
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
fi
'';
# Builds and composes an NPM package including all its dependencies
buildNodePackage =
{ name
, packageName
, version
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, preRebuild ? ""
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];
in
stdenv.mkDerivation ({
name = "node_${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase;
compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
installPhase = ''
# Create and enter a root node_modules/ folder
mkdir -p $out/lib/node_modules
cd $out/lib/node_modules
# Compose the package and all its dependencies
source $compositionScriptPath
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Create symlink to the deployed executable folder, if applicable
if [ -d "$out/lib/node_modules/.bin" ]
@ -431,14 +455,13 @@ let
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
nodeDependencies = stdenv.mkDerivation ({
@ -473,39 +496,13 @@ let
fi
''}
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
# Go to the parent folder to make sure that all packages are pinpointed
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
source $pinpointDependenciesScriptPath
cd ${packageName}
# Patch the shebangs of the bundled modules to prevent them from
# calling executables outside the Nix store as much as possible
patchShebangs .
export HOME=$PWD
${stdenv.lib.optionalString bypassCache ''
if [ ! -f package-lock.json ]
then
echo "No package-lock.json file found, reconstructing..."
node ${reconstructPackageLock}
fi
node ${addIntegrityFieldsScript}
''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
${stdenv.lib.optionalString (!dontNpmInstall) ''
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
''}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Expose the executables that were installed
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
@ -532,6 +529,7 @@ let
inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) ''
export NODE_PATH=$nodeDependencies/lib/node_modules
export PATH="$nodeDependencies/bin:$PATH"
'';
};
in

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# This file has been generated by node2nix 1.6.0. Do not edit!
# This file has been generated by node2nix 1.7.0. Do not edit!
{nodeEnv, fetchurl, fetchgit, globalBuildInputs ? []}:
@ -643,13 +643,13 @@ let
sha1 = "f46f0c75b7841f8d200b3348cd4d691d5a099d15";
};
};
"fs-minipass-1.2.6" = {
"fs-minipass-1.2.7" = {
name = "fs-minipass";
packageName = "fs-minipass";
version = "1.2.6";
version = "1.2.7";
src = fetchurl {
url = "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz";
sha512 = "crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==";
url = "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz";
sha512 = "GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==";
};
};
"fs.extra-1.3.2" = {
@ -724,13 +724,13 @@ let
sha1 = "dbf743c6c14992593c655568cb66ed32c0122ebe";
};
};
"graceful-fs-4.2.1" = {
"graceful-fs-4.2.2" = {
name = "graceful-fs";
packageName = "graceful-fs";
version = "4.2.1";
version = "4.2.2";
src = fetchurl {
url = "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.1.tgz";
sha512 = "b9usnbDGnD928gJB3LrCmxoibr3VE4U2SMo5PBuBnokWyDADTqDPXg4YpwKF1trpH+UbGp7QLicO3+aWEy0+mw==";
url = "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz";
sha512 = "IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==";
};
};
"grunt-known-options-1.1.1" = {
@ -814,13 +814,13 @@ let
sha512 = "eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==";
};
};
"hosted-git-info-2.8.2" = {
"hosted-git-info-2.8.4" = {
name = "hosted-git-info";
packageName = "hosted-git-info";
version = "2.8.2";
version = "2.8.4";
src = fetchurl {
url = "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.2.tgz";
sha512 = "CyjlXII6LMsPMyUzxpTt8fzh5QwzGqPmQXgY/Jyf4Zfp27t/FvfhwoE/8laaMUcMy816CkWF20I7NeQhwwY88w==";
url = "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.4.tgz";
sha512 = "pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ==";
};
};
"http-signature-1.2.0" = {
@ -1183,15 +1183,6 @@ let
sha1 = "2009291bb31cea861bbf10a7c15a28caf75c31ec";
};
};
"lru-cache-5.1.1" = {
name = "lru-cache";
packageName = "lru-cache";
version = "5.1.1";
src = fetchurl {
url = "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz";
sha512 = "KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==";
};
};
"make-iterator-1.0.1" = {
name = "make-iterator";
packageName = "make-iterator";
@ -1264,22 +1255,22 @@ let
sha1 = "857fcabfc3397d2625b8228262e86aa7a011b05d";
};
};
"minipass-2.3.5" = {
"minipass-2.6.2" = {
name = "minipass";
packageName = "minipass";
version = "2.3.5";
version = "2.6.2";
src = fetchurl {
url = "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz";
sha512 = "Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==";
url = "https://registry.npmjs.org/minipass/-/minipass-2.6.2.tgz";
sha512 = "38Jwdc8AttUDaQAIRX8Iaw3QoCDWjAwKMGeGDF9JUi9QCPMjH5qAQg/hdO8o1nC7Nmh1/CqzMg5FQPEKuKwznQ==";
};
};
"minizlib-1.2.1" = {
"minizlib-1.2.2" = {
name = "minizlib";
packageName = "minizlib";
version = "1.2.1";
version = "1.2.2";
src = fetchurl {
url = "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz";
sha512 = "7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==";
url = "https://registry.npmjs.org/minizlib/-/minizlib-1.2.2.tgz";
sha512 = "hR3At21uSrsjjDTWrbu0IMLTpnkpv8IIMFDFaoz43Tmu4LkmAXfH44vNNzpTnf+OAQQCHrb91y/wc2J4x5XgSQ==";
};
};
"mixin-deep-1.3.2" = {
@ -1372,13 +1363,13 @@ let
sha512 = "/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==";
};
};
"npm-package-arg-6.1.0" = {
"npm-package-arg-6.1.1" = {
name = "npm-package-arg";
packageName = "npm-package-arg";
version = "6.1.0";
version = "6.1.1";
src = fetchurl {
url = "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.0.tgz";
sha512 = "zYbhP2k9DbJhA0Z3HKUePUgdB1x7MfIfKssC+WLPFMKTBZKpZh5m13PgexJjCq6KW7j17r0jHWcCpxEqnnncSA==";
url = "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz";
sha512 = "qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==";
};
};
"npm-registry-client-8.6.0" = {
@ -1633,13 +1624,13 @@ let
sha1 = "212d5bfe1318306a420f6402b8e26ff39647a849";
};
};
"psl-1.3.0" = {
"psl-1.4.0" = {
name = "psl";
packageName = "psl";
version = "1.3.0";
version = "1.4.0";
src = fetchurl {
url = "https://registry.npmjs.org/psl/-/psl-1.3.0.tgz";
sha512 = "avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag==";
url = "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz";
sha512 = "HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==";
};
};
"punycode-1.4.1" = {
@ -1831,13 +1822,13 @@ let
sha1 = "300bc6e0e86374f7ba61068b5b1ecd57fc6532da";
};
};
"semver-5.7.0" = {
"semver-5.7.1" = {
name = "semver";
packageName = "semver";
version = "5.7.0";
version = "5.7.1";
src = fetchurl {
url = "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz";
sha512 = "Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==";
url = "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz";
sha512 = "sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==";
};
};
"semver-6.1.3" = {
@ -2200,13 +2191,13 @@ let
sha1 = "450d4dc9fa70de732762fbd2d4a28981419a0ccf";
};
};
"uuid-3.3.2" = {
"uuid-3.3.3" = {
name = "uuid";
packageName = "uuid";
version = "3.3.2";
version = "3.3.3";
src = fetchurl {
url = "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz";
sha512 = "yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==";
url = "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz";
sha512 = "pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==";
};
};
"v8flags-3.1.3" = {
@ -2312,7 +2303,8 @@ in
license = "MIT";
};
production = true;
bypassCache = false;
bypassCache = true;
reconstructLock = true;
};
coffee-script = nodeEnv.buildNodePackage {
name = "coffee-script";
@ -2329,7 +2321,8 @@ in
license = "MIT";
};
production = true;
bypassCache = false;
bypassCache = true;
reconstructLock = true;
};
grunt-cli = nodeEnv.buildNodePackage {
name = "grunt-cli";
@ -2594,7 +2587,8 @@ in
license = "MIT";
};
production = true;
bypassCache = false;
bypassCache = true;
reconstructLock = true;
};
node2nix = nodeEnv.buildNodePackage {
name = "node2nix";
@ -2648,7 +2642,7 @@ in
sources."rimraf-2.2.8"
];
})
sources."fs-minipass-1.2.6"
sources."fs-minipass-1.2.7"
(sources."fs.extra-1.3.2" // {
dependencies = [
sources."mkdirp-0.3.5"
@ -2658,11 +2652,11 @@ in
sources."gauge-2.7.4"
sources."getpass-0.1.7"
sources."glob-7.1.4"
sources."graceful-fs-4.2.1"
sources."graceful-fs-4.2.2"
sources."har-schema-2.0.0"
sources."har-validator-5.1.3"
sources."has-unicode-2.0.1"
sources."hosted-git-info-2.8.2"
sources."hosted-git-info-2.8.4"
sources."http-signature-1.2.0"
sources."inflight-1.0.6"
sources."inherits-2.0.4"
@ -2677,30 +2671,29 @@ in
sources."json-stringify-safe-5.0.1"
sources."jsonfile-1.0.1"
sources."jsprim-1.4.1"
sources."lru-cache-5.1.1"
sources."mime-db-1.40.0"
sources."mime-types-2.1.24"
sources."minimatch-3.0.4"
sources."minimist-0.0.8"
sources."minipass-2.3.5"
sources."minizlib-1.2.1"
sources."minipass-2.6.2"
sources."minizlib-1.2.2"
sources."mkdirp-0.5.1"
sources."ncp-0.4.2"
sources."nijs-0.0.25"
sources."nopt-3.0.6"
(sources."normalize-package-data-2.5.0" // {
dependencies = [
sources."semver-5.7.0"
sources."semver-5.7.1"
];
})
(sources."npm-package-arg-6.1.0" // {
(sources."npm-package-arg-6.1.1" // {
dependencies = [
sources."semver-5.7.0"
sources."semver-5.7.1"
];
})
(sources."npm-registry-client-8.6.0" // {
dependencies = [
sources."semver-5.7.0"
sources."semver-5.7.1"
];
})
(sources."npmconf-2.1.3" // {
@ -2723,7 +2716,7 @@ in
sources."performance-now-2.1.0"
sources."process-nextick-args-2.0.1"
sources."proto-list-1.2.4"
sources."psl-1.3.0"
sources."psl-1.4.0"
sources."punycode-2.1.1"
sources."qs-6.5.2"
(sources."readable-stream-2.3.6" // {
@ -2768,7 +2761,7 @@ in
sources."uid-number-0.0.5"
sources."uri-js-4.2.2"
sources."util-deprecate-1.0.2"
sources."uuid-3.3.2"
sources."uuid-3.3.3"
sources."validate-npm-package-license-3.0.4"
sources."validate-npm-package-name-3.0.0"
sources."verror-1.10.0"
@ -2784,6 +2777,7 @@ in
license = "MIT";
};
production = true;
bypassCache = false;
bypassCache = true;
reconstructLock = true;
};
}