Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Yarn workspaces (PoC for #189) #200

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions bin/node2nix.js
Original file line number Diff line number Diff line change
@@ -33,7 +33,8 @@ var switches = [
['--no-bypass-cache', 'Specifies that package builds do not need to bypass the content addressable cache (required for NPM 5.x)'],
['--no-copy-node-env', 'Do not create a copy of the Nix expression that builds NPM packages'],
['--use-fetchgit-private', 'Use fetchGitPrivate instead of fetchgit in the generated Nix expressions'],
['--strip-optional-dependencies', 'Strips the optional dependencies from the regular dependencies in the NPM registry']
['--strip-optional-dependencies', 'Strips the optional dependencies from the regular dependencies in the NPM registry'],
['--yarn-workspace FILE', 'Use a Yarn workspace package.json to find project interdependencies'],
];

var parser = new optparse.OptionParser(switches);
@@ -59,6 +60,7 @@ var noCopyNodeEnv = false;
var bypassCache = true;
var useFetchGitPrivate = false;
var stripOptionalDependencies = false;
var yarnWorkspaceJSON;
var executable;

/* Define process rules for option parameters */
@@ -185,6 +187,10 @@ parser.on('strip-optional-dependencies', function(arg, value) {
stripOptionalDependencies = true;
});

parser.on('yarn-workspace', function(arg, value) {
yarnWorkspaceJSON = value;
});

/* Define process rules for non-option parameters */

parser.on(1, function(opt) {
@@ -247,7 +253,7 @@ if(version) {
}

/* Perform the NPM to Nix conversion */
node2nix.npmToNix(inputJSON, outputNix, compositionNix, nodeEnvNix, lockJSON, supplementJSON, supplementNix, production, includePeerDependencies, flatten, nodePackage, registryURL, registryAuthToken, noCopyNodeEnv, bypassCache, useFetchGitPrivate, stripOptionalDependencies, function(err) {
node2nix.npmToNix(inputJSON, outputNix, compositionNix, nodeEnvNix, lockJSON, supplementJSON, supplementNix, production, includePeerDependencies, flatten, nodePackage, registryURL, registryAuthToken, noCopyNodeEnv, bypassCache, useFetchGitPrivate, stripOptionalDependencies, yarnWorkspaceJSON, function(err) {
if(err) {
process.stderr.write(err + "\n");
process.exit(1);
1 change: 1 addition & 0 deletions lib/DeploymentConfig.js
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ function DeploymentConfig(registryURL, registryAuthToken, production, includePee
this.outputDir = outputDir;
this.bypassCache = bypassCache;
this.stripOptionalDependencies = stripOptionalDependencies;
this.packageOverrides = {};
}

exports.DeploymentConfig = DeploymentConfig;
26 changes: 16 additions & 10 deletions lib/Package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var path = require('path');
var slasp = require('slasp');
var semver = require('semver');
var nijs = require('nijs');
var Source = require('./sources/Source.js').Source;
var inherit = require('nijs/lib/ast/util/inherit.js').inherit;
@@ -64,7 +63,7 @@ Package.prototype.findMatchingProvidedDependencyByParent = function(name, versio
} else if(dependency === null) {
return null; // If we have encountered a bundled dependency with the same name, consider it a conflict (is not a perfect resolution, but does not result in an error)
} else {
if(semver.satisfies(dependency.source.config.version, versionSpec, true)) { // If we found a dependency with the same name, see if the version fits
if(dependency.source.versionSatisfies(versionSpec)) { // If we found a dependency with the same name, see if the version fits
return dependency;
} else {
return null; // If there is a version mismatch, then a conflicting version has been encountered
@@ -144,20 +143,27 @@ Package.prototype.bundleDependencies = function(resolvedDependencies, dependenci
slasp.fromEach(function(callback) {
callback(null, dependencies);
}, function(dependencyName, callback) {
var versionSpec = dependencies[dependencyName];
var parentDependency = self.findMatchingProvidedDependencyByParent(dependencyName, versionSpec);

if(self.isBundledDependency(dependencyName)) {
self.requiredDependencies[dependencyName] = null;
callback();
} else if(parentDependency === null) {
var pkg = new Package(self.deploymentConfig, self.lock, self, dependencyName, versionSpec, self.source.baseDir, true /* Never include development dependencies of transitive dependencies */, self.sourcesCache);
return callback();
}

var pkg = self.deploymentConfig.packageOverrides[dependencyName];
var bundlePkg = !!pkg;
if(!pkg) {
var versionSpec = dependencies[dependencyName];
pkg = self.findMatchingProvidedDependencyByParent(dependencyName, versionSpec);
}
if(!pkg) {
pkg = new Package(self.deploymentConfig, self.lock, self, dependencyName, versionSpec, self.source.baseDir, true /* Never include development dependencies of transitive dependencies */, self.sourcesCache);
bundlePkg = true;
}

if(bundlePkg) {
slasp.sequence([
function(callback) {
pkg.source.fetch(callback);
},

function(callback) {
self.sourcesCache.addSource(pkg.source);
self.bundleDependency(dependencyName, pkg);
@@ -166,7 +172,7 @@ Package.prototype.bundleDependencies = function(resolvedDependencies, dependenci
}
], callback);
} else {
self.requiredDependencies[dependencyName] = parentDependency; // If there is a parent package that provides the requested dependency -> use it
self.requiredDependencies[dependencyName] = pkg; // If there is a parent package that provides the requested dependency -> use it
callback();
}

24 changes: 18 additions & 6 deletions lib/expressions/OutputExpression.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var nijs = require('nijs');
var inherit = require('nijs/lib/ast/util/inherit.js').inherit;
var SourcesCache = require('../SourcesCache.js').SourcesCache;
var WorkspaceSource = require('../sources/WorkspaceSource').WorkspaceSource;

/**
* Creates a new output expression instance.
@@ -34,13 +35,24 @@ OutputExpression.prototype.resolveDependencies = function(callback) {
* @see NixASTNode#toNixAST
*/
OutputExpression.prototype.toNixAST = function() {
var argSpec = {
nodeEnv: undefined,
fetchurl: undefined,
fetchgit: undefined,
globalBuildInputs: []
};

// Add arguments for workspace dependencies
for(var identifier in this.sourcesCache.sources) {
var source = this.sourcesCache.sources[identifier];
if(source instanceof WorkspaceSource && !source.symlink) {
var varName = source.variableName();
argSpec[varName] = source.fileExpression();
}
}

return new nijs.NixFunction({
argSpec: {
nodeEnv: undefined,
fetchurl: undefined,
fetchgit: undefined,
globalBuildInputs: []
},
argSpec: argSpec,
body: new nijs.NixLet({
value: {
sources: this.sourcesCache
116 changes: 113 additions & 3 deletions lib/node2nix.js
Original file line number Diff line number Diff line change
@@ -6,11 +6,13 @@ var fs = require('fs');
var path = require('path');
var slasp = require('slasp');
var nijs = require('nijs');
var glob = require('glob');

var CollectionExpression = require('./expressions/CollectionExpression.js').CollectionExpression;
var PackageExpression = require('./expressions/PackageExpression.js').PackageExpression;
var CompositionExpression = require('./expressions/CompositionExpression.js').CompositionExpression;
var DeploymentConfig = require('./DeploymentConfig.js').DeploymentConfig;
var Package = require('./Package.js').Package;

function copyNodeEnvExpr(nodeEnvNix, callback) {
/* Compose a read stream that reads the build expression */
@@ -32,6 +34,59 @@ function copyNodeEnvExpr(nodeEnvNix, callback) {
rs.pipe(ws);
}

/**
* Resolve a Yarn workspaces list to package paths.
*
* The result is a map of package names to paths relative to baseDir.
*
* @function
* @param {Array<String>} workspaces The workspaces field from package.json
* @param {String} baseDir Directory in which the referrer's package.json configuration resides
* @param {String} resolveDir Directory in which the workspace package.json configuration resides
* @param {function(String)} callback Callback that gets invoked when the work
* is done. In case of an error, the first parameter contains a string with
* an error message.
*/
function resolveYarnWorkspaces(workspaces, baseDir, resolveDir, callback) {
var pkgPaths = {};
slasp.sequence([
function(callback) {
// Resolve globs to unique paths relative to baseDir.
slasp.fromEach(function(callback) {
callback(null, workspaces);
}, function(idx, callback) {
slasp.sequence([
function(callback) {
glob(workspaces[idx] + '/package.json', {
cwd: resolveDir,
absolute: true,
}, callback);
},
function(callback, matches) {
matches.forEach(function(match) {
var matchRel = path.relative(baseDir, match);
if (matchRel !== 'package.json') { // ignore self
var pkgPath = matchRel.slice(0, -13)
pkgPaths[pkgPath] = true;
}
});
callback();
}
], callback);
}, callback);
},
function(callback) {
// Build a map of: name -> path
var pkgsMap = {};
Object.keys(pkgPaths).forEach(function(pkgPath) {
var config = JSON.parse(fs.readFileSync(pkgPath + '/package.json'));
pkgsMap[config.name] = pkgPath;
});
callback(null, pkgsMap);
}
], callback);
}

/**
* Writes a copy of node-env.nix to a specified path.
*
@@ -42,7 +97,7 @@ function copyNodeEnvExpr(nodeEnvNix, callback) {
*/
exports.copyNodeEnvExpr = copyNodeEnvExpr;

function npmToNix(inputJSON, outputNix, compositionNix, nodeEnvNix, lockJSON, supplementJSON, supplementNix, production, includePeerDependencies, flatten, nodePackage, registryURL, registryAuthToken, noCopyNodeEnv, bypassCache, useFetchGitPrivate, stripOptionalDependencies, callback) {
function npmToNix(inputJSON, outputNix, compositionNix, nodeEnvNix, lockJSON, supplementJSON, supplementNix, production, includePeerDependencies, flatten, nodePackage, registryURL, registryAuthToken, noCopyNodeEnv, bypassCache, useFetchGitPrivate, stripOptionalDependencies, yarnWorkspaceJSON, callback) {
var obj = JSON.parse(fs.readFileSync(inputJSON));
var version = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"))).version;
var disclaimer = "# This file has been generated by node2nix " + version + ". Do not edit!\n\n";
@@ -66,6 +121,7 @@ function npmToNix(inputJSON, outputNix, compositionNix, nodeEnvNix, lockJSON, su
if(typeof obj == "object" && obj !== null) {
if(Array.isArray(obj)) {
expr = new CollectionExpression(deploymentConfig, baseDir, obj);
callback();
} else {
// Display error if mandatory package.json attributes are not set
if(!obj.name) {
@@ -79,14 +135,68 @@ function npmToNix(inputJSON, outputNix, compositionNix, nodeEnvNix, lockJSON, su

// Display a warning if we expect a lock file to be used, but the user does not specify it
displayLockWarning = bypassCache && !lockJSON && fs.existsSync(path.join(path.dirname(inputJSON), path.basename(inputJSON, ".json")) + "-lock.json");
}

expr.resolveDependencies(callback);
// If this is a Yarn workspace, bundle all packages as virtual dependencies at the top level
if(obj.workspaces) {
slasp.sequence([
function(callback) {
resolveYarnWorkspaces(obj.workspaces, baseDir, baseDir, callback);
},
function(callback, pkgs) {
slasp.fromEach(function(callback) {
callback(null, pkgs);
}, function(pkgName, callback) {
var pkgPath = pkgs[pkgName];
var pkg = new Package(deploymentConfig, lock, expr.package, pkgName, "workspace:" + pkgPath, baseDir, production, expr.sourcesCache);
pkg.source.symlink = true; // Symlink workspace interdependencies
slasp.sequence([
function(callback) {
pkg.source.fetch(callback);
},
function(callback) {
expr.sourcesCache.addSource(pkg.source);
expr.package.providedDependencies[pkgName] = pkg;
pkg.resolveDependenciesAndSources(callback);
},
], callback);
}, callback);
},
], callback);
} else {
callback();
}
}
} else {
callback("The provided JSON file must consist of an object or an array");
}
},

/* If a Yarn workspace was specified, add source overrides for workspace packages. */
function(callback) {
if(yarnWorkspaceJSON !== undefined) {
var config = JSON.parse(fs.readFileSync(yarnWorkspaceJSON));
slasp.sequence([
function(callback) {
var resolveDir = path.dirname(yarnWorkspaceJSON);
resolveYarnWorkspaces(config.workspaces, baseDir, resolveDir, callback);
},
function(callback, pkgs) {
for(var pkgName in pkgs) {
var pkgPath = pkgs[pkgName];
deploymentConfig.packageOverrides[pkgName] = new Package(deploymentConfig, lock, null, pkgName, 'workspace:' + pkgPath, baseDir, true /* Never include development dependencies of transitive dependencies */, expr.sourcesCache);
}
callback();
}
], callback);
} else {
callback();
}
},

function(callback) {
expr.resolveDependencies(callback);
},

/* Write the output Nix expression to the specified output file */
function(callback) {
fs.writeFile(outputNix, disclaimer + nijs.jsToNix(expr, true), callback);
19 changes: 12 additions & 7 deletions lib/sources/LocalSource.js
Original file line number Diff line number Diff line change
@@ -93,19 +93,24 @@ LocalSource.prototype.convertFromLockedDependency = function(dependencyObj, call
};

/**
* @see NixASTNode#toNixAST
* Create a NixFile AST node for the package source path.
*/
LocalSource.prototype.toNixAST = function() {
var ast = Source.prototype.toNixAST.call(this);

LocalSource.prototype.fileExpression = function() {
if(this.srcPath === "./") {
ast.src = new nijs.NixFile({ value: "./." }); // ./ is not valid in the Nix expression language
return new nijs.NixFile({ value: "./." }); // ./ is not valid in the Nix expression language
} else if(this.srcPath === "..") {
ast.src = new nijs.NixFile({ value: "./.." }); // .. is not valid in the Nix expression language
return new nijs.NixFile({ value: "./.." }); // .. is not valid in the Nix expression language
} else {
ast.src = new nijs.NixFile({ value: this.srcPath });
return new nijs.NixFile({ value: this.srcPath });
}
};

/**
* @see NixASTNode#toNixAST
*/
LocalSource.prototype.toNixAST = function() {
var ast = Source.prototype.toNixAST.call(this);
ast.src = this.fileExpression();
return ast;
};

24 changes: 23 additions & 1 deletion lib/sources/Source.js
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ Source.constructSource = function(registryURL, registryAuthToken, baseDir, outpu
var GitSource = require('./GitSource.js').GitSource;
var HTTPSource = require('./HTTPSource.js').HTTPSource;
var LocalSource = require('./LocalSource.js').LocalSource;
var WorkspaceSource = require('./WorkspaceSource.js').WorkspaceSource;
var NPMRegistrySource = require('./NPMRegistrySource.js').NPMRegistrySource;

var parsedVersionSpec = semver.validRange(versionSpec, true);
@@ -66,6 +67,8 @@ Source.constructSource = function(registryURL, registryAuthToken, baseDir, outpu
return new GitSource(baseDir, dependencyName, "git://github.com/"+versionSpec);
} else if(parsedUrl.protocol == "file:") { // If the version is a file URL, simply compose a Nix path
return new LocalSource(baseDir, dependencyName, outputDir, parsedUrl.path);
} else if(parsedUrl.protocol == "workspace:") { // If the version is a workspace URL, the package is provided as a Nix expression
return new WorkspaceSource(baseDir, dependencyName, outputDir, versionSpec.slice(10));
} else if(versionSpec.substr(0, 3) == "../" || versionSpec.substr(0, 2) == "~/" || versionSpec.substr(0, 2) == "./" || versionSpec.substr(0, 1) == "/") { // If the version is a path, simply compose a Nix path
return new LocalSource(baseDir, dependencyName, outputDir, versionSpec);
} else { // In all other cases, just try the registry. Sometimes invalid semver ranges are encountered or a tag has been provided (e.g. 'latest', 'unstable')
@@ -85,6 +88,16 @@ Source.prototype.fetch = function(callback) {
callback("fetch() is not implemented, please use a prototype that inherits from Source");
};

/**
* Whether the version of this source satisfies the given version specifier.
*
* @method
* @param {String} versionSpec Version specifier to commpare
*/
Source.prototype.versionSatisfies = function(versionSpec) {
return semver.satisfies(this.config.version, versionSpec, true);
};

/**
* Takes a dependency object from a lock file and converts it into a source object.
*
@@ -117,12 +130,21 @@ Source.prototype.convertIntegrityStringToNixHash = function(integrity) {
}
};

/**
* Return a version of the package name suitable for use as a Nix variable.
*
* Escapes characters from scoped package names that aren't allowed.
*/
Source.prototype.variableName = function() {
return this.config.name.replace("@", "_at_").replace("/", "_slash_");
};

/**
* @see NixASTNode#toNixAST
*/
Source.prototype.toNixAST = function() {
return {
name: this.config.name.replace("@", "_at_").replace("/", "_slash_"), // Escape characters from scoped package names that aren't allowed
name: this.variableName(),
packageName: this.config.name,
version: this.config.version
};
53 changes: 53 additions & 0 deletions lib/sources/WorkspaceSource.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
var nijs = require('nijs');
var Source = require('./Source.js').Source;
var LocalSource = require('./LocalSource.js').LocalSource;
var inherit = require('nijs/lib/ast/util/inherit.js').inherit;

/**
* Constructs a new WorkspaceSource instance.
*
* @class WorkspaceSource
* @extends LocalSource
* @classdesc Represents a dependency source that is part of the same project
*
* @constructor
* @param {String} baseDir Directory in which the referrer's package.json configuration resides
* @param {String} dependencyName Name of the dependency
* @param {String} outputDir Directory in which the nix expression will be written
* @param {String} versionSpec Version specifier of the Node.js package to fetch
*/
function WorkspaceSource(baseDir, dependencyName, outputDir, versionSpec) {
LocalSource.call(this, baseDir, dependencyName, outputDir, versionSpec);
this.symlink = false;
}

/* WorkspaceSource inherits from LocalSource */
inherit(LocalSource, WorkspaceSource);

/**
* @see Source#versionSatisfies
*/
WorkspaceSource.prototype.versionSatisfies = function() {
return true; // Ignore version for packages part of the same project
};

/**
* @see NixASTNode#toNixAST
*/
WorkspaceSource.prototype.toNixAST = function() {
// Override LocalSource method, but do call super Source method
var ast = Source.prototype.toNixAST.call(this);

if(this.symlink) {
// Use a symlink if the output directory contains the package
ast.symlink = this.versionSpec;
} else {
// The package is bundled, but it may need to be built
// Use a variable to allow the user to provide a custom derivation
ast.src = new nijs.NixExpression(ast.name);
}

return ast;
};

exports.WorkspaceSource = WorkspaceSource;
118 changes: 68 additions & 50 deletions nix/node-env.nix
Original file line number Diff line number Diff line change
@@ -43,65 +43,82 @@ let
''
# Bundle the dependencies of the package
mkdir -p node_modules
cd node_modules
pushd node_modules
# Only include dependencies if they don't exist. They may also be bundled in the package.
if [ ! -e "${dependency.name}" ]
then
${composePackage dependency}
fi
cd ..
popd
''
) dependencies);

# Recursively composes the dependencies of a package
composePackage = { name, packageName, src, dependencies ? [], ... }@args:
builtins.addErrorContext "while evaluating node package '${packageName}'" ''
DIR=$(pwd)
cd $TMPDIR
unpackFile ${src}
# Make the base dir in which the target dependency resides first
mkdir -p "$(dirname "$DIR/${packageName}")"
composePackage = { name, packageName, src ? null, symlink ? null, dependencies ? [], ... }@args:
let
isOrgPackage = builtins.substring 0 1 packageName == "@";
in builtins.addErrorContext "while evaluating node package '${packageName}'" (
if symlink != null then ''
# Make the base dir in which the target dependency resides first
mkdir -p "$(dirname "${packageName}")"
# Create the symlink to the workspace package
# The symlink path is relative to the top-level workspace directory
ln -s "$toplevelPackagePath/${symlink}" "${packageName}"
# Include the dependencies of the package
pushd "${packageName}"
${includeDependencies { inherit dependencies; }}
popd
'' else ''
DIR=$(pwd)
pushd $TMPDIR
unpackFile ${src}
# Make the base dir in which the target dependency resides first
mkdir -p "$(dirname "$DIR/${packageName}")"
if [ -f "${src}" ]
then
# Figure out what directory has been unpacked
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
if [ -f "${src}" ]
then
# Figure out what directory has been unpacked
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
# Restore write permissions to make building work
find "$packageDir" -type d -exec chmod u+x {} \;
chmod -R u+w "$packageDir"
# Restore write permissions to make building work
find "$packageDir" -type d -exec chmod u+x {} \;
chmod -R u+w "$packageDir"
# Move the extracted tarball into the output folder
mv "$packageDir" "$DIR/${packageName}"
elif [ -d "${src}" ]
then
# Get a stripped name (without hash) of the source directory.
# On old nixpkgs it's already set internally.
if [ -z "$strippedName" ]
then
strippedName="$(stripHash ${src})"
fi
# Move the extracted tarball into the output folder
mv "$packageDir" "$DIR/${packageName}"
elif [ -d "${src}" ]
then
# Get a stripped name (without hash) of the source directory.
# On old nixpkgs it's already set internally.
if [ -z "$strippedName" ]
then
strippedName="$(stripHash ${src})"
fi
# Restore write permissions to make building work
chmod -R u+w "$strippedName"
# Restore write permissions to make building work
chmod -R u+w "$strippedName"
# Move the extracted directory into the output folder
mv "$strippedName" "$DIR/${packageName}"
fi
# Move the extracted directory into the output folder
mv "$strippedName" "$DIR/${packageName}"
fi
# Unset the stripped name to not confuse the next unpack step
unset strippedName
# Unset the stripped name to not confuse the next unpack step
unset strippedName
popd
# Include the dependencies of the package
cd "$DIR/${packageName}"
${includeDependencies { inherit dependencies; }}
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
'';
# Include the dependencies of the package
pushd "${packageName}"
${includeDependencies { inherit dependencies; }}
popd
''
);

pinpointDependencies = {dependencies, production}:
let
@@ -165,9 +182,9 @@ let
''
if [ -d node_modules ]
then
cd node_modules
pushd node_modules
${stdenv.lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies}
cd ..
popd
fi
''}
'';
@@ -180,10 +197,9 @@ let
''
if [ -d "${packageName}" ]
then
cd "${packageName}"
pushd "${packageName}"
${pinpointDependencies { inherit dependencies production; }}
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
popd
fi
'';

@@ -415,7 +431,10 @@ let
mkdir -p $out/lib/node_modules
cd $out/lib/node_modules
# Compose the package and all its dependencies
# Store the top-level package path to help with symlinked dependencies
toplevelPackagePath="$PWD/${packageName}"
# Compose the package and all dependencies
source $compositionScriptPath
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
@@ -484,7 +503,7 @@ let

installPhase = ''
mkdir -p $out/${packageName}
cd $out/${packageName}
pushd $out/${packageName}
source $includeScriptPath
@@ -499,8 +518,7 @@ let
''}
# Go to the parent folder to make sure that all packages are pinpointed
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
popd
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
91 changes: 46 additions & 45 deletions node-packages.nix
Original file line number Diff line number Diff line change
@@ -4,13 +4,13 @@

let
sources = {
"@babel/parser-7.10.2" = {
"@babel/parser-7.11.3" = {
name = "_at_babel_slash_parser";
packageName = "@babel/parser";
version = "7.10.2";
version = "7.11.3";
src = fetchurl {
url = "https://registry.npmjs.org/@babel/parser/-/parser-7.10.2.tgz";
sha512 = "PApSXlNMJyB4JiGVhCOlzKIif+TKFTvu0aQAhnTvfP/z3vVSN6ZypH5bfUNwFXXjRQtUEBNFd2PtmCmG2Py3qQ==";
url = "https://registry.npmjs.org/@babel/parser/-/parser-7.11.3.tgz";
sha512 = "REo8xv7+sDxkKvoxEywIdsNFiZLybwdI7hcT5uEPyQrSMB4YQ973BfC9OOrD/81MaIjh6UxdulIQXkjmiH3PcA==";
};
};
"abbrev-1.1.1" = {
@@ -22,13 +22,13 @@ let
sha512 = "nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==";
};
};
"ajv-6.12.2" = {
"ajv-6.12.4" = {
name = "ajv";
packageName = "ajv";
version = "6.12.2";
version = "6.12.4";
src = fetchurl {
url = "https://registry.npmjs.org/ajv/-/ajv-6.12.2.tgz";
sha512 = "k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ==";
url = "https://registry.npmjs.org/ajv/-/ajv-6.12.4.tgz";
sha512 = "eienB2c9qVQs2KWexhkrdMLVDoIQCz5KSeLxwg9Lzk4DOfBtIK9PQwwufcsn1jjGuf9WZmqPMbGxOzfcuphJCQ==";
};
};
"ansi-regex-2.1.1" = {
@@ -103,13 +103,13 @@ let
sha1 = "b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8";
};
};
"aws4-1.10.0" = {
"aws4-1.10.1" = {
name = "aws4";
packageName = "aws4";
version = "1.10.0";
version = "1.10.1";
src = fetchurl {
url = "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz";
sha512 = "3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==";
url = "https://registry.npmjs.org/aws4/-/aws4-1.10.1.tgz";
sha512 = "zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==";
};
};
"balanced-match-1.0.0" = {
@@ -472,13 +472,13 @@ let
sha1 = "a94c2224ebcac04782a0d9035521f24735b7ec92";
};
};
"har-validator-5.1.3" = {
"har-validator-5.1.5" = {
name = "har-validator";
packageName = "har-validator";
version = "5.1.3";
version = "5.1.5";
src = fetchurl {
url = "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz";
sha512 = "sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==";
url = "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz";
sha512 = "nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==";
};
};
"has-unicode-2.0.1" = {
@@ -589,13 +589,13 @@ let
sha1 = "a5e654c2e5a2deb5f201d96cefbca80c0ef2f513";
};
};
"jsdoc-3.6.4" = {
"jsdoc-3.6.5" = {
name = "jsdoc";
packageName = "jsdoc";
version = "3.6.4";
version = "3.6.5";
src = fetchurl {
url = "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.4.tgz";
sha512 = "3G9d37VHv7MFdheviDCjUfQoIjdv4TC5zTTf5G9VODLtOnVS6La1eoYBDlbWfsRT3/Xo+j2MIqki2EV12BZfwA==";
url = "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.5.tgz";
sha512 = "SbY+i9ONuxSK35cgVHaI8O9senTE4CDYAmGSDJ5l3+sfe62Ff4gy96osy6OW84t4K4A8iGnMrlRrsSItSNp3RQ==";
};
};
"json-schema-0.2.3" = {
@@ -661,13 +661,13 @@ let
sha512 = "GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==";
};
};
"lodash-4.17.15" = {
"lodash-4.17.20" = {
name = "lodash";
packageName = "lodash";
version = "4.17.15";
version = "4.17.20";
src = fetchurl {
url = "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz";
sha512 = "8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==";
url = "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz";
sha512 = "PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==";
};
};
"markdown-it-10.0.0" = {
@@ -751,13 +751,13 @@ let
sha512 = "Mgd2GdMVzY+x3IJ+oHnVM+KG3lA5c8tnabyJKmHSaG2kAGpudxuOf8ToDkhumF7UzME7DecbQE9uOZhNm7PuJg==";
};
};
"minizlib-2.1.0" = {
"minizlib-2.1.2" = {
name = "minizlib";
packageName = "minizlib";
version = "2.1.0";
version = "2.1.2";
src = fetchurl {
url = "https://registry.npmjs.org/minizlib/-/minizlib-2.1.0.tgz";
sha512 = "EzTZN/fjSvifSX0SlqUERCN39o6T40AMarPbv0MrarSFtIITCBh7bi+dU8nxGFHuqs9jdIAeoYoKuQAAASsPPA==";
url = "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz";
sha512 = "bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==";
};
};
"mkdirp-0.3.5" = {
@@ -1255,13 +1255,13 @@ let
sha1 = "6a385fb8853d952d5ff05d0e8aaf94278dc63dcf";
};
};
"strip-json-comments-3.1.0" = {
"strip-json-comments-3.1.1" = {
name = "strip-json-comments";
packageName = "strip-json-comments";
version = "3.1.0";
version = "3.1.1";
src = fetchurl {
url = "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz";
sha512 = "e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==";
url = "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz";
sha512 = "6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==";
};
};
"taffydb-2.6.2" = {
@@ -1273,13 +1273,13 @@ let
sha1 = "7cbcb64b5a141b6a2efc2c5d2c67b4e150b2a268";
};
};
"tar-6.0.2" = {
"tar-6.0.5" = {
name = "tar";
packageName = "tar";
version = "6.0.2";
version = "6.0.5";
src = fetchurl {
url = "https://registry.npmjs.org/tar/-/tar-6.0.2.tgz";
sha512 = "Glo3jkRtPcvpDlAs/0+hozav78yoXKFr+c4wgw62NNMO3oo4AaJdCo21Uu7lcwr55h39W2XD1LMERc64wtbItg==";
url = "https://registry.npmjs.org/tar/-/tar-6.0.5.tgz";
sha512 = "0b4HOimQHj9nXNEAA7zWwMM91Zhhba3pspja6sQbgTpynOJf+bkjBnfybNYzbpLbnwXnbyB4LOREvlyXLkCHSg==";
};
};
"temp-0.9.1" = {
@@ -1460,9 +1460,9 @@ let
version = "1.8.0";
src = ./.;
dependencies = [
sources."@babel/parser-7.10.2"
sources."@babel/parser-7.11.3"
sources."abbrev-1.1.1"
sources."ajv-6.12.2"
sources."ajv-6.12.4"
sources."ansi-regex-2.1.1"
sources."aproba-1.2.0"
sources."are-we-there-yet-1.1.5"
@@ -1471,7 +1471,7 @@ let
sources."assert-plus-1.0.0"
sources."asynckit-0.4.0"
sources."aws-sign2-0.7.0"
sources."aws4-1.10.0"
sources."aws4-1.10.1"
sources."balanced-match-1.0.0"
sources."base64-js-1.3.1"
sources."bcrypt-pbkdf-1.0.2"
@@ -1521,7 +1521,7 @@ let
sources."glob-7.1.6"
sources."graceful-fs-4.2.4"
sources."har-schema-2.0.0"
sources."har-validator-5.1.3"
sources."har-validator-5.1.5"
sources."has-unicode-2.0.1"
sources."hosted-git-info-2.8.8"
sources."http-signature-1.2.0"
@@ -1534,7 +1534,7 @@ let
sources."isstream-0.1.2"
sources."js2xmlparser-4.0.1"
sources."jsbn-0.1.1"
(sources."jsdoc-3.6.4" // {
(sources."jsdoc-3.6.5" // {
dependencies = [
sources."mkdirp-1.0.4"
];
@@ -1546,7 +1546,7 @@ let
sources."jsprim-1.4.1"
sources."klaw-3.0.0"
sources."linkify-it-2.2.0"
sources."lodash-4.17.15"
sources."lodash-4.17.20"
sources."markdown-it-10.0.0"
sources."markdown-it-anchor-5.3.0"
sources."marked-0.8.2"
@@ -1556,7 +1556,7 @@ let
sources."minimatch-3.0.4"
sources."minimist-1.2.5"
sources."minipass-3.1.3"
sources."minizlib-2.1.0"
sources."minizlib-2.1.2"
sources."mkdirp-0.5.5"
sources."ncp-0.4.2"
sources."nijs-0.0.25"
@@ -1630,9 +1630,9 @@ let
];
})
sources."strip-ansi-3.0.1"
sources."strip-json-comments-3.1.0"
sources."strip-json-comments-3.1.1"
sources."taffydb-2.6.2"
(sources."tar-6.0.2" // {
(sources."tar-6.0.5" // {
dependencies = [
sources."mkdirp-1.0.4"
];
@@ -1674,4 +1674,5 @@ in
tarball = nodeEnv.buildNodeSourceDist args;
package = nodeEnv.buildNodePackage args;
shell = nodeEnv.buildNodeShell args;
nodeDependencies = nodeEnv.buildNodeDependencies args;
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -23,7 +23,8 @@
"base64-js": "1.3.x",
"slasp": "0.0.4",
"nijs": "0.0.25",
"spdx-license-ids": "3.0.x"
"spdx-license-ids": "3.0.x",
"glob": "7.x.x"
},
"devDependencies": {
"jsdoc": "*"
1,812 changes: 1,373 additions & 439 deletions tests/grunt/node-packages.nix

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tests/grunt/supplement.nix
Original file line number Diff line number Diff line change
@@ -1255,13 +1255,13 @@ let
sha1 = "956905708d58b4bab4c2261b04f59f31c99374c0";
};
};
"lodash-4.17.15" = {
"lodash-4.17.20" = {
name = "lodash";
packageName = "lodash";
version = "4.17.15";
version = "4.17.20";
src = fetchurl {
url = "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz";
sha512 = "8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==";
url = "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz";
sha512 = "PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==";
};
};
"loud-rejection-1.6.0" = {
@@ -2364,7 +2364,7 @@ in
sources."kind-of-6.0.3"
sources."liftoff-2.5.0"
sources."load-json-file-1.1.0"
sources."lodash-4.17.15"
sources."lodash-4.17.20"
sources."loud-rejection-1.6.0"
sources."make-iterator-1.0.1"
sources."map-cache-0.2.2"
6 changes: 3 additions & 3 deletions tests/lockfile/node-packages.nix
Original file line number Diff line number Diff line change
@@ -746,6 +746,6 @@ in
sources = sources;
tarball = nodeEnv.buildNodeSourceDist args;
package = nodeEnv.buildNodePackage args;
shell = (nodeEnv.buildNodeShell args).shell;
nodeDependencies = (nodeEnv.buildNodeShell args).nodeDependencies;
}
shell = nodeEnv.buildNodeShell args;
nodeDependencies = nodeEnv.buildNodeDependencies args;
}
227 changes: 164 additions & 63 deletions tests/node-packages-v10.nix

Large diffs are not rendered by default.

227 changes: 164 additions & 63 deletions tests/node-packages-v12.nix

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/scoped/node-packages.nix
Original file line number Diff line number Diff line change
@@ -22,6 +22,6 @@ in
sources = sources;
tarball = nodeEnv.buildNodeSourceDist args;
package = nodeEnv.buildNodePackage args;
shell = (nodeEnv.buildNodeShell args).shell;
nodeDependencies = (nodeEnv.buildNodeShell args).nodeDependencies;
}
shell = nodeEnv.buildNodeShell args;
nodeDependencies = nodeEnv.buildNodeDependencies args;
}