output.js
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var assert = require("assert");
var util = require("./util");
var log = util.log;
function AbstractOutput() {
assert.ok(this instanceof AbstractOutput);
Object.defineProperties(this, {
outputModule: { value: this.outputModule.bind(this) }
});
}
var AOp = AbstractOutput.prototype;
exports.AbstractOutput = AbstractOutput;
AOp.outputModule = function(module) {
throw new Error("not implemented");
};
function StdOutput() {
assert.ok(this instanceof StdOutput);
AbstractOutput.call(this);
}
var SOp = util.inherits(StdOutput, AbstractOutput);
exports.StdOutput = StdOutput;
SOp.outputModule = function(module) {
log.out(module.source);
};
function DirOutput(outputDir) {
assert.ok(this instanceof DirOutput);
assert.strictEqual(typeof outputDir, "string");
AbstractOutput.call(this);
Object.defineProperties(this, {
outputDir: { value: outputDir }
});
}
var DOp = util.inherits(DirOutput, AbstractOutput);
exports.DirOutput = DirOutput;
DOp.outputModule = function(module) {
return module.writeVersionP(this.outputDir);
};
function TestOutput() {
assert.ok(this instanceof TestOutput);
AbstractOutput.call(this);
}
var TOp = util.inherits(TestOutput, AbstractOutput);
exports.TestOutput = TestOutput;
TOp.outputModule = function(module) {
// Swallow any output.
};