editorconfig 0.11.3 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitmodules +3 -3
- package/LICENSE +19 -19
- package/README.md +104 -84
- package/bin/editorconfig +42 -39
- package/editorconfig.js +102 -77
- package/lib/fnmatch.js +1080 -1080
- package/lib/ini.js +65 -65
- package/lib/version.js +48 -48
- package/package.json +8 -2
- package/cmake_install.cmake +0 -45
package/.gitmodules
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
[submodule "tests"]
|
|
2
|
-
path = tests
|
|
3
|
-
url = git://github.com/editorconfig/editorconfig-core-test.git
|
|
1
|
+
[submodule "tests"]
|
|
2
|
+
path = tests
|
|
3
|
+
url = git://github.com/editorconfig/editorconfig-core-test.git
|
package/LICENSE
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
Copyright © 2012 EditorConfig Team
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the “Software”), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|
|
1
|
+
Copyright © 2012 EditorConfig Team
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,84 +1,104 @@
|
|
|
1
|
-
# EditorConfig JavaScript Core
|
|
2
|
-
|
|
3
|
-
[](https://travis-ci.org/editorconfig/editorconfig-core-js)
|
|
4
|
-
|
|
5
|
-
The EditorConfig JavaScript core will provide the same functionality as the
|
|
6
|
-
[EditorConfig C Core][] and [EditorConfig Python Core][].
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
1
|
+
# EditorConfig JavaScript Core
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/editorconfig/editorconfig-core-js)
|
|
4
|
+
|
|
5
|
+
The EditorConfig JavaScript core will provide the same functionality as the
|
|
6
|
+
[EditorConfig C Core][] and [EditorConfig Python Core][].
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
You need [node][] to use this package.
|
|
12
|
+
|
|
13
|
+
To install this package (system-wide):
|
|
14
|
+
|
|
15
|
+
$ npm install editorconfig
|
|
16
|
+
|
|
17
|
+
To install the package system-wide:
|
|
18
|
+
|
|
19
|
+
$ npm install -g editorconfig
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
Usage as a Node library:
|
|
25
|
+
|
|
26
|
+
$ node
|
|
27
|
+
> var editorconfig = require('./editorconfig');
|
|
28
|
+
undefined
|
|
29
|
+
> editorconfig.parse('/home/zoidberg/humans/anatomy.md');
|
|
30
|
+
{ charset: 'utf-8',
|
|
31
|
+
insert_final_newline: 'true',
|
|
32
|
+
end_of_line: 'lf',
|
|
33
|
+
tab_width: '8',
|
|
34
|
+
trim_trailing_whitespace: 'sometimes' }
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Usage as a command line tool:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
$ ./bin/editorconfig
|
|
41
|
+
|
|
42
|
+
Usage: editorconfig [OPTIONS] FILEPATH1 [FILEPATH2 FILEPATH3 ...]
|
|
43
|
+
|
|
44
|
+
EditorConfig Node.js Core Version 0.11.4-development
|
|
45
|
+
|
|
46
|
+
FILEPATH can be a hyphen (-) if you want path(s) to be read from stdin.
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
|
|
50
|
+
-h, --help output usage information
|
|
51
|
+
-V, --version output the version number
|
|
52
|
+
-f <path> Specify conf filename other than ".editorconfig"
|
|
53
|
+
-b <version> Specify version (used by devs to test compatibility)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Example:
|
|
57
|
+
|
|
58
|
+
$ ./bin/editorconfig /home/zoidberg/humans/anatomy.md
|
|
59
|
+
charset=utf-8
|
|
60
|
+
insert_final_newline=true
|
|
61
|
+
end_of_line=lf
|
|
62
|
+
tab_width=8
|
|
63
|
+
trim_trailing_whitespace=sometimes
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
To install dependencies for this package run this in the package directory:
|
|
69
|
+
|
|
70
|
+
$ npm install
|
|
71
|
+
|
|
72
|
+
Next, run:
|
|
73
|
+
|
|
74
|
+
$ npm link
|
|
75
|
+
|
|
76
|
+
The global editorconfig will now point to the files in your development
|
|
77
|
+
repository instead of a globally-installed version from npm. You can now use
|
|
78
|
+
editorconfig directly to test your changes.
|
|
79
|
+
|
|
80
|
+
If you ever update from the central repository and there are errors, it might
|
|
81
|
+
be because you are missing some dependencies. If that happens, just run npm
|
|
82
|
+
link again to get the latest dependencies.
|
|
83
|
+
|
|
84
|
+
To test the command line interface:
|
|
85
|
+
|
|
86
|
+
$ editorconfig <filepath>
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Testing
|
|
90
|
+
|
|
91
|
+
[CMake][] must be installed to run the tests.
|
|
92
|
+
|
|
93
|
+
To run the tests:
|
|
94
|
+
|
|
95
|
+
$ npm test
|
|
96
|
+
|
|
97
|
+
To run the tests with increased verbosity (for debugging test failures):
|
|
98
|
+
|
|
99
|
+
$ npm run-script test-verbose
|
|
100
|
+
|
|
101
|
+
[EditorConfig C Core]: https://github.com/editorconfig/editorconfig-core
|
|
102
|
+
[EditorConfig Python Core]: https://github.com/editorconfig/editorconfig-core-py
|
|
103
|
+
[node]: http://nodejs.org/
|
|
104
|
+
[cmake]: http://www.cmake.org
|
package/bin/editorconfig
CHANGED
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
var path = require("path");
|
|
4
|
-
var program = require("commander");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
program.version("EditorConfig Node.js Core Version " + package.version);
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.usage([
|
|
14
|
-
"[OPTIONS] FILEPATH1 [FILEPATH2 FILEPATH3 ...]",
|
|
15
|
-
program._version,
|
|
16
|
-
"FILEPATH can be a hyphen (-) if you want path(s) to be read from stdin."
|
|
17
|
-
].join("\n\n "))
|
|
18
|
-
.option("-f <path>", "Specify conf filename other than \".editorconfig\"")
|
|
19
|
-
.option("-b <version>", "Specify version (used by devs to test compatibility)")
|
|
20
|
-
.option("-v, --version", "Display version information")
|
|
21
|
-
.parse(process.argv);
|
|
22
|
-
|
|
23
|
-
// Throw away the native -V flag in lieu of the one we've manually specified
|
|
24
|
-
// to adhere to testing requirements
|
|
25
|
-
program.options.shift();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.log(
|
|
38
|
-
}
|
|
39
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
var path = require("path");
|
|
4
|
+
var program = require("commander");
|
|
5
|
+
var Promise = require("bluebird");
|
|
6
|
+
|
|
7
|
+
var editorconfig = require("../editorconfig");
|
|
8
|
+
var package = require("../package.json");
|
|
9
|
+
|
|
10
|
+
program.version("EditorConfig Node.js Core Version " + package.version);
|
|
11
|
+
|
|
12
|
+
program
|
|
13
|
+
.usage([
|
|
14
|
+
"[OPTIONS] FILEPATH1 [FILEPATH2 FILEPATH3 ...]",
|
|
15
|
+
program._version,
|
|
16
|
+
"FILEPATH can be a hyphen (-) if you want path(s) to be read from stdin."
|
|
17
|
+
].join("\n\n "))
|
|
18
|
+
.option("-f <path>", "Specify conf filename other than \".editorconfig\"")
|
|
19
|
+
.option("-b <version>", "Specify version (used by devs to test compatibility)")
|
|
20
|
+
.option("-v, --version", "Display version information")
|
|
21
|
+
.parse(process.argv);
|
|
22
|
+
|
|
23
|
+
// Throw away the native -V flag in lieu of the one we've manually specified
|
|
24
|
+
// to adhere to testing requirements
|
|
25
|
+
program.options.shift();
|
|
26
|
+
|
|
27
|
+
var files = program.args;
|
|
28
|
+
|
|
29
|
+
if (!files.length) {
|
|
30
|
+
program.help();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Promise.map(files, function(filePath) {
|
|
34
|
+
return editorconfig.parse(filePath, {config: program.F, version: program.B});
|
|
35
|
+
}).each(function(parsed, i, length) {
|
|
36
|
+
if (length > 1) {
|
|
37
|
+
console.log("[%s]", files[i]);
|
|
38
|
+
}
|
|
39
|
+
Object.keys(parsed).forEach(function(key) {
|
|
40
|
+
console.log(key + "=" + parsed[key]);
|
|
41
|
+
});
|
|
42
|
+
});
|
package/editorconfig.js
CHANGED
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
var
|
|
1
|
+
var os = require('os');
|
|
2
2
|
var path = require('path');
|
|
3
|
+
var Promise = require('bluebird');
|
|
4
|
+
var whenReadFile = Promise.promisify(require('fs').readFile);
|
|
3
5
|
|
|
4
6
|
var minimatch = require('./lib/fnmatch');
|
|
5
7
|
var iniparser = require('./lib/ini');
|
|
6
8
|
var Version = require('./lib/version');
|
|
7
9
|
var pkg = require('./package.json');
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'
|
|
12
|
-
|
|
11
|
+
var knownProps = [
|
|
12
|
+
'end_of_line',
|
|
13
|
+
'indent_style',
|
|
14
|
+
'indent_size',
|
|
15
|
+
'insert_final_newline',
|
|
16
|
+
'trim_trailing_whitespace',
|
|
17
|
+
'charset'
|
|
18
|
+
].reduce(function (set, prop) {
|
|
19
|
+
set[prop] = true;
|
|
20
|
+
return set;
|
|
21
|
+
}, {});
|
|
13
22
|
|
|
14
23
|
function fnmatch(filepath, glob) {
|
|
15
24
|
var matchOptions = {matchBase: true, dot: true, noext: true};
|
|
@@ -17,21 +26,27 @@ function fnmatch(filepath, glob) {
|
|
|
17
26
|
return minimatch(filepath, glob, matchOptions);
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
|
|
21
|
-
function getConfigFileNames(filepath, configname) {
|
|
22
|
-
var old_dirname = filepath;
|
|
23
|
-
var dirname = old_dirname;
|
|
29
|
+
function getConfigFileNames(filepath, options) {
|
|
24
30
|
var paths = [];
|
|
25
31
|
do {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} while(dirname != old_dirname);
|
|
32
|
+
filepath = path.dirname(filepath);
|
|
33
|
+
paths.push(path.join(filepath, options.config));
|
|
34
|
+
} while (filepath !== options.root);
|
|
30
35
|
return paths;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
|
-
function
|
|
38
|
+
function getFilepathRoot(filepath) {
|
|
39
|
+
if (path.parse !== undefined) {
|
|
40
|
+
// Node.js >= 0.11.15
|
|
41
|
+
return path.parse(filepath).root;
|
|
42
|
+
}
|
|
43
|
+
if (os.platform() === 'win32') {
|
|
44
|
+
return path.resolve(filepath).match(/^(\\\\[^\\]+\\)?[^\\]+\\/)[0];
|
|
45
|
+
}
|
|
46
|
+
return '/';
|
|
47
|
+
}
|
|
34
48
|
|
|
49
|
+
function processMatches(matches, version) {
|
|
35
50
|
// Set indent_size to "tab" if indent_size is unspecified and
|
|
36
51
|
// indent_style is set to "tab".
|
|
37
52
|
if ("indent_style" in matches && matches.indent_style === "tab" &&
|
|
@@ -42,99 +57,109 @@ function processMatches(matches, version) {
|
|
|
42
57
|
// Set tab_width to indent_size if indent_size is specified and
|
|
43
58
|
// tab_width is unspecified
|
|
44
59
|
if ("indent_size" in matches && !("tab_width" in matches) &&
|
|
45
|
-
|
|
60
|
+
matches.indent_size !== "tab")
|
|
46
61
|
matches.tab_width = matches.indent_size;
|
|
47
62
|
|
|
48
63
|
// Set indent_size to tab_width if indent_size is "tab"
|
|
49
64
|
if("indent_size" in matches && "tab_width" in matches &&
|
|
50
|
-
|
|
65
|
+
matches.indent_size === "tab")
|
|
51
66
|
matches.indent_size = matches.tab_width;
|
|
52
67
|
|
|
53
68
|
return matches;
|
|
54
69
|
}
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
function processOptions(options) {
|
|
71
|
+
function processOptions(options, filepath) {
|
|
58
72
|
options = options || {};
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
return {
|
|
74
|
+
config: options.config || '.editorconfig',
|
|
75
|
+
version: new Version(options.version || pkg.version),
|
|
76
|
+
root: path.resolve(options.root || getFilepathRoot(filepath))
|
|
77
|
+
};
|
|
61
78
|
}
|
|
62
79
|
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
configs.reverse().forEach(function (file) {
|
|
80
|
+
function parseFromFiles(filepath, files, options) {
|
|
81
|
+
return getConfigsForFiles(files).then(function (configs) {
|
|
82
|
+
return configs.reverse();
|
|
83
|
+
}).reduce(function (matches, file) {
|
|
68
84
|
var pathPrefix = path.dirname(file.name);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var fullGlob;
|
|
72
|
-
var glob = section[0];
|
|
73
|
-
var options = section[1];
|
|
85
|
+
file.contents.forEach(function (section) {
|
|
86
|
+
var glob = section[0], options = section[1];
|
|
74
87
|
if (!glob) return;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
fullGlob = path.join(pathPrefix, glob.substring(1));
|
|
79
|
-
} else {
|
|
80
|
-
fullGlob = path.join(pathPrefix, glob);
|
|
88
|
+
switch (glob.indexOf('/')) {
|
|
89
|
+
case -1: glob = "**/" + glob; break;
|
|
90
|
+
case 0: glob = glob.substring(1); break;
|
|
81
91
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
var fullGlob = path.join(pathPrefix, glob);
|
|
93
|
+
if (!fnmatch(filepath, fullGlob)) return;
|
|
94
|
+
for (var key in options) {
|
|
95
|
+
var value = options[key];
|
|
96
|
+
key = key.toLowerCase();
|
|
97
|
+
if (knownProps[key]) {
|
|
98
|
+
value = value.toLowerCase();
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
value = JSON.parse(value);
|
|
102
|
+
} catch(e) {}
|
|
103
|
+
if (typeof value === 'undefined' || value === null) {
|
|
104
|
+
// null and undefined are values specific to JSON (no special meaning
|
|
105
|
+
// in editorconfig) & should just be returned as regular strings.
|
|
106
|
+
value = String(value);
|
|
92
107
|
}
|
|
108
|
+
matches[key] = value;
|
|
93
109
|
}
|
|
94
110
|
});
|
|
111
|
+
return matches;
|
|
112
|
+
}, {}).then(function (matches) {
|
|
113
|
+
return processMatches(matches, options.version);
|
|
95
114
|
});
|
|
115
|
+
}
|
|
96
116
|
|
|
97
|
-
|
|
98
|
-
|
|
117
|
+
function StopReduce(array) {
|
|
118
|
+
this.array = array;
|
|
99
119
|
}
|
|
100
120
|
|
|
121
|
+
StopReduce.prototype = Object.create(Error.prototype);
|
|
101
122
|
|
|
102
123
|
function getConfigsForFiles(files) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
124
|
+
return Promise.reduce(files, function (configs, file) {
|
|
125
|
+
var contents = iniparser.parseString(file.contents);
|
|
126
|
+
configs.push({
|
|
127
|
+
name: file.name,
|
|
128
|
+
contents: contents
|
|
129
|
+
});
|
|
130
|
+
if ((contents[0][1].root || '').toLowerCase() === 'true') {
|
|
131
|
+
return Promise.reject(new StopReduce(configs));
|
|
132
|
+
}
|
|
133
|
+
return configs;
|
|
134
|
+
}, []).catch(StopReduce, function (stop) {
|
|
135
|
+
return stop.array;
|
|
136
|
+
});
|
|
110
137
|
}
|
|
111
138
|
|
|
112
|
-
|
|
113
139
|
function readConfigFiles(filepaths) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
}
|
|
140
|
+
return Promise.map(filepaths, function (path) {
|
|
141
|
+
return whenReadFile(path, 'utf-8').catch(function () {
|
|
142
|
+
return '';
|
|
143
|
+
}).then(function (contents) {
|
|
144
|
+
return {name: path, contents: contents};
|
|
145
|
+
});
|
|
122
146
|
});
|
|
123
|
-
return files;
|
|
124
147
|
}
|
|
125
148
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
module.exports.parseFromFiles = function (filepath, files, options) {
|
|
150
|
+
return new Promise (function (resolve, reject) {
|
|
151
|
+
filepath = path.resolve(filepath);
|
|
152
|
+
options = processOptions(options, filepath);
|
|
153
|
+
resolve(parseFromFiles(filepath, files, option));
|
|
154
|
+
});
|
|
131
155
|
};
|
|
132
156
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
157
|
+
module.exports.parse = function (filepath, options) {
|
|
158
|
+
return new Promise (function (resolve, reject) {
|
|
159
|
+
filepath = path.resolve(filepath);
|
|
160
|
+
options = processOptions(options, filepath);
|
|
161
|
+
var filepaths = getConfigFileNames(filepath, options);
|
|
162
|
+
var files = readConfigFiles(filepaths);
|
|
163
|
+
resolve(parseFromFiles(filepath, files, options));
|
|
164
|
+
});
|
|
140
165
|
};
|