-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
153 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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); | ||
} | ||
|
||
/* 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); | ||
|
||
ast.src = new nijs.NixExpression(ast.name); | ||
|
||
return ast; | ||
}; | ||
|
||
exports.WorkspaceSource = WorkspaceSource; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters