yini-parser 1.0.0-alpha.4 → 1.0.0-alpha.6
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/CHANGELOG.md +14 -0
- package/README.md +274 -9
- package/dist/core/ErrorDataHandler.js +6 -6
- package/dist/core/YINIVisitor.d.ts +3 -0
- package/dist/core/YINIVisitor.js +55 -4
- package/dist/core/objectBuilder.js +21 -2
- package/dist/grammar/YiniLexer.d.ts +40 -41
- package/dist/grammar/YiniLexer.js +283 -287
- package/dist/grammar/YiniParser.d.ts +40 -41
- package/dist/grammar/YiniParser.js +138 -141
- package/dist/index.js +14 -12
- package/dist/parsers/extractHeaderParts.js +1 -1
- package/dist/utils/system.d.ts +11 -5
- package/dist/utils/system.js +27 -4
- package/dist/yiniHelpers.js +1 -1
- package/package.json +13 -5
package/dist/utils/system.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains general system helper functions (utils).
|
|
3
|
-
* @note More specific YINI helper functions should go into yiniHelpers.ts-file.
|
|
4
|
-
*/
|
|
5
1
|
export declare const debugPrint: (str?: any) => void;
|
|
6
2
|
export declare const devPrint: (str?: any) => void;
|
|
7
|
-
export declare const
|
|
3
|
+
export declare const toPrettyJSON: (obj: any) => string;
|
|
4
|
+
/** Pretty-prints a JavaScript object as formatted JSON to the console.
|
|
5
|
+
* Strict JSON, all keys are enclosed in ", etc.
|
|
6
|
+
*/
|
|
7
|
+
export declare const printJSON: (obj: any) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Print a full JavaScript object in a human-readable way (not as JSON).
|
|
10
|
+
* Not strict JSON, and shows functions, symbols, getters/setters, and class names.
|
|
11
|
+
* @param isColors If true, the output is styled with ANSI color codes.
|
|
12
|
+
*/
|
|
13
|
+
export declare const printObject: (obj: any, isColors?: boolean) => void;
|
package/dist/utils/system.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.printObject = exports.printJSON = exports.toPrettyJSON = exports.devPrint = exports.debugPrint = void 0;
|
|
2
7
|
/**
|
|
3
8
|
* This file contains general system helper functions (utils).
|
|
4
9
|
* @note More specific YINI helper functions should go into yiniHelpers.ts-file.
|
|
5
10
|
*/
|
|
6
|
-
|
|
7
|
-
exports.printObject = exports.devPrint = exports.debugPrint = void 0;
|
|
11
|
+
const util_1 = __importDefault(require("util"));
|
|
8
12
|
const env_1 = require("../config/env");
|
|
9
13
|
const debugPrint = (str = '') => {
|
|
10
14
|
(0, env_1.isDebug)() && console.debug('DEBUG: ' + str);
|
|
@@ -14,10 +18,29 @@ const devPrint = (str = '') => {
|
|
|
14
18
|
(0, env_1.isDev)() && !(0, env_1.isTestEnv)() && console.log('DEV: ' + str);
|
|
15
19
|
};
|
|
16
20
|
exports.devPrint = devPrint;
|
|
17
|
-
const
|
|
21
|
+
const toPrettyJSON = (obj) => {
|
|
22
|
+
const str = JSON.stringify(obj, null, 4);
|
|
23
|
+
return str;
|
|
24
|
+
};
|
|
25
|
+
exports.toPrettyJSON = toPrettyJSON;
|
|
26
|
+
/** Pretty-prints a JavaScript object as formatted JSON to the console.
|
|
27
|
+
* Strict JSON, all keys are enclosed in ", etc.
|
|
28
|
+
*/
|
|
29
|
+
const printJSON = (obj) => {
|
|
18
30
|
if ((0, env_1.isProdEnv)() || ((0, env_1.isTestEnv)() && !(0, env_1.isDebug)()))
|
|
19
31
|
return;
|
|
20
|
-
const str =
|
|
32
|
+
const str = (0, exports.toPrettyJSON)(obj);
|
|
21
33
|
console.log(str);
|
|
22
34
|
};
|
|
35
|
+
exports.printJSON = printJSON;
|
|
36
|
+
/**
|
|
37
|
+
* Print a full JavaScript object in a human-readable way (not as JSON).
|
|
38
|
+
* Not strict JSON, and shows functions, symbols, getters/setters, and class names.
|
|
39
|
+
* @param isColors If true, the output is styled with ANSI color codes.
|
|
40
|
+
*/
|
|
41
|
+
const printObject = (obj, isColors = true) => {
|
|
42
|
+
if ((0, env_1.isProdEnv)() || ((0, env_1.isTestEnv)() && !(0, env_1.isDebug)()))
|
|
43
|
+
return;
|
|
44
|
+
console.log(util_1.default.inspect(obj, { depth: null, colors: isColors }));
|
|
45
|
+
};
|
|
23
46
|
exports.printObject = printObject;
|
package/dist/yiniHelpers.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.isValidBacktickedIdent = exports.isValidSimpleIdent = exports.stripComme
|
|
|
8
8
|
const string_1 = require("./utils/string");
|
|
9
9
|
const system_1 = require("./utils/system");
|
|
10
10
|
const SECTION_MARKER1 = '^';
|
|
11
|
-
const SECTION_MARKER2 = '
|
|
11
|
+
const SECTION_MARKER2 = '<';
|
|
12
12
|
const SECTION_MARKER3 = '\u00A7'; // Section sign §.
|
|
13
13
|
const SECTION_MARKER4 = '\u20AC'; // Euro sign €.
|
|
14
14
|
/**
|
package/package.json
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yini-parser",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
|
+
"description": "Simple and flexible config parser for Node.js. YINI: an enhanced, readable alternative to JSON, INI, and YAML—built for modern JavaScript and TypeScript projects.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"read",
|
|
7
6
|
"yini",
|
|
7
|
+
"yini-parser",
|
|
8
8
|
"config",
|
|
9
|
+
"config-file",
|
|
10
|
+
"configuration",
|
|
11
|
+
"settings",
|
|
9
12
|
"ini",
|
|
13
|
+
"ini-parser",
|
|
14
|
+
"json-alternative",
|
|
15
|
+
"yaml-alternative",
|
|
10
16
|
"parser",
|
|
11
|
-
"file",
|
|
12
17
|
"parse",
|
|
13
|
-
"
|
|
18
|
+
"read",
|
|
19
|
+
"nodejs",
|
|
20
|
+
"javascript"
|
|
14
21
|
],
|
|
15
22
|
"homepage": "https://m4se.com/yini-lang.org/",
|
|
16
23
|
"license": "Apache-2.0",
|
|
@@ -49,6 +56,7 @@
|
|
|
49
56
|
"test:smoke:debug": "cross-env npm run test:smoke -- --isDebug=1",
|
|
50
57
|
"test:unit:debug": "cross-env npm run test:unit -- --isDebug=1",
|
|
51
58
|
"test:integr:debug": "cross-env npm run test:integr -- --isDebug=1",
|
|
59
|
+
"test:esm": "node ./tests/fixtures/test-src-files/esm-smoke.js",
|
|
52
60
|
"ci:test": "cross-env NODE_ENV=test APP_ENV=ci jest --verbose --runInBand",
|
|
53
61
|
"ci:test:smoke": "cross-env NODE_ENV=test APP_ENV=ci jest tests/smoke --verbose --runInBand",
|
|
54
62
|
"tsc": "npx tsc -p ./tsconfig.json",
|