forked from sergeche/site-import
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (52 loc) · 1.67 KB
/
index.js
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
59
'use strict';
var ReadConfigStream = require('./lib/stream/read-config');
var RewriteUrlStream = require('./lib/stream/rewrite-url');
var ExportProjectStream = require('./lib/stream/export-project');
var SymlinkStream = require('./lib/stream/symlink');
var FileTransformStream = require('./lib/stream/file-transform');
/**
* Creates readable stream with project configs in given `src` path
* @param {String} src
* @return {ReadConfigStream}
*/
module.exports.src = function(src, options) {
return new ReadConfigStream(src, options);
};
/**
* Creates writable stream that exports projects defined in incoming
* configs into `dest` folder
* @param {String} dest
* @return {ExportProjectStream}
*/
module.exports.dest = function(dest, options) {
return new ExportProjectStream(dest, options);
};
/**
* Creates a transformation stream for rewriting URLs on imported files
* @param {Object} config Rewrite config
* @return {RewriteUrlStream}
*/
module.exports.rewriteUrl = function(config) {
return new RewriteUrlStream(config);
};
/**
* Creates a transformation stream marking all files in current project that
* has no transformations to be symlinked instead of copied
* @return {SymlinkStream}
*/
module.exports.symlink = function() {
return new SymlinkStream();
};
/**
* A helper function that creates project’s file transform stream. Used by
* custom project consumers
* @param {Object} config Rewrite config
* @return {FileTransformStream}
*/
module.exports.fileTransform = function(project) {
return new FileTransformStream(project);
};
/**
* Expose project config class for creating custom readers
*/
module.exports.ProjectConfig = require('./lib/project-config');