config 3.3.10 → 3.3.11
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/package.json +1 -1
- package/parser.js +12 -7
package/package.json
CHANGED
package/parser.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
// External libraries are lazy-loaded only if these file types exist.
|
|
2
2
|
const util = require("util");
|
|
3
|
+
|
|
4
|
+
// webpack can't solve dynamic module
|
|
5
|
+
// @see https://github.com/node-config/node-config/issues/755
|
|
6
|
+
// @see https://webpack.js.org/guides/dependency-management/#require-with-expression
|
|
7
|
+
const JSON5Module = require('json5');
|
|
8
|
+
|
|
9
|
+
// webpack resolves json5 with module field out of the box which lead to this usage
|
|
10
|
+
// @see https://github.com/node-config/node-config/issues/755
|
|
11
|
+
// @see https://github.com/json5/json5/issues/240
|
|
12
|
+
const JSON5 = JSON5Module.default || JSON5Module;
|
|
13
|
+
|
|
3
14
|
var Yaml = null,
|
|
4
15
|
VisionmediaYaml = null,
|
|
5
16
|
Coffee = null,
|
|
6
17
|
Iced = null,
|
|
7
18
|
CSON = null,
|
|
8
19
|
PPARSER = null,
|
|
9
|
-
JSON5 = null,
|
|
10
20
|
TOML = null,
|
|
11
21
|
HJSON = null,
|
|
12
22
|
XML = null;
|
|
@@ -160,15 +170,10 @@ Parser.jsonParser = function(filename, content) {
|
|
|
160
170
|
* This is due to issues with removing supported comments.
|
|
161
171
|
* More information can be found here: https://github.com/node-config/node-config/issues/715
|
|
162
172
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return JSON5.parse(content);
|
|
173
|
+
return JSON5.parse(content);
|
|
166
174
|
};
|
|
167
175
|
|
|
168
176
|
Parser.json5Parser = function(filename, content) {
|
|
169
|
-
if (!JSON5) {
|
|
170
|
-
JSON5 = require(JSON5_DEP);
|
|
171
|
-
}
|
|
172
177
|
return JSON5.parse(content);
|
|
173
178
|
};
|
|
174
179
|
|