yini-parser 1.0.0-alpha.7x → 1.0.0-beta.1

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 CHANGED
@@ -1,10 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
- ## --Upcoming-- -beta
3
+ ## 1.0.0-beta.1
4
4
  - Package updated to **beta**. The core API is stabilizing, some more advanced features may still change.
5
+ - Bugfix, fixed exports cleanly (so this lib can be imported in CJS and in full ESM).
5
6
  - Implemented support for colon lists, both empty and with elements, including nested lists. Also updated to the latest grammar, which fixes handling of empty lists with or without spaces or tabs between the brackets.
6
7
  - Optimized the top part of readme for npmjs Short Page.
7
8
  - Added a dir `examples/` with a few example Yini files, `compare-formats.md` and TS file.
9
+ - Updated to the latest grammar (logic) to the spec 1.0.0-rc.1.
8
10
 
9
11
  ## 1.0.0-alpha.7
10
12
  - Fixed serious bug that on error did exit process.
package/README.md CHANGED
@@ -540,6 +540,16 @@ We welcome feedback, bug reports, feature requests, and code contributions!
540
540
 
541
541
  ---
542
542
 
543
+ ## Links
544
+ - ➡️ [Why YINI? Why another format!?](./RATIONALE.md) (rationale)
545
+ - ➡️ [Intro to YINI Config Format](https://github.com/YINI-lang/yini-parser-typescript?tab=readme-ov-file#intro-to-yini-config-format) (learn YINI)
546
+ - ➡️ [Read the YINI Specification](./YINI-Specification.md#table-of-contents) (spec)
547
+ - ➡️ [Official YINI Parser on npm](https://www.npmjs.com/package/yini-parser) (npm)
548
+ - ➡️ [YINI Parser GitHub Repo](https://github.com/YINI-lang/yini-parser-typescript) (GitHub)
549
+ - ➡️ [YINI vs Other Formats](https://github.com/YINI-lang/YINI-spec/blob/develop/Docs/Examples%20of%20YINI%20vs%20Other%20Formats.md)
550
+
551
+ ---
552
+
543
553
  ## License
544
554
  This project is licensed under the Apache-2.0 license - see the [LICENSE](<./LICENSE>) file for details.
545
555
 
package/dist/YINI.js CHANGED
@@ -7,7 +7,7 @@ const fs_1 = __importDefault(require("fs"));
7
7
  const env_1 = require("./config/env");
8
8
  const parseEntry_1 = require("./parseEntry");
9
9
  const pathAndFileName_1 = require("./utils/pathAndFileName");
10
- const system_1 = require("./utils/system");
10
+ const print_1 = require("./utils/print");
11
11
  /**
12
12
  * This class is the public API, which exposes only parse(..) and
13
13
  * parseFile(..), rest of the implementation details are hidden.
@@ -33,7 +33,7 @@ YINI.filePath = ''; // Used in error reporting.
33
33
  * @returns A JavaScript object representing the parsed YINI content.
34
34
  */
35
35
  YINI.parse = (yiniContent, strictMode = false, bailSensitivity = 'auto', includeMetaData = false) => {
36
- (0, system_1.debugPrint)('-> Entered static parse(..) in class YINI\n');
36
+ (0, print_1.debugPrint)('-> Entered static parse(..) in class YINI\n');
37
37
  // Important: First, before anything, trim beginning and trailing whitespaces!
38
38
  yiniContent = yiniContent.trim();
39
39
  if (!yiniContent) {
@@ -63,16 +63,16 @@ YINI.parse = (yiniContent, strictMode = false, bailSensitivity = 'auto', include
63
63
  isWithDiagnostics: (0, env_1.isDev)() || (0, env_1.isDebug)(),
64
64
  isWithTiming: (0, env_1.isDebug)(),
65
65
  };
66
- (0, system_1.debugPrint)();
67
- (0, system_1.debugPrint)('==== Call parse ==========================');
66
+ (0, print_1.debugPrint)();
67
+ (0, print_1.debugPrint)('==== Call parse ==========================');
68
68
  const result = (0, parseEntry_1.parseMain)(yiniContent, options);
69
- (0, system_1.debugPrint)('==== End call parse ==========================\n');
69
+ (0, print_1.debugPrint)('==== End call parse ==========================\n');
70
70
  if ((0, env_1.isDev)()) {
71
71
  console.log();
72
- (0, system_1.devPrint)('YINI.parse(..): result:');
72
+ (0, print_1.devPrint)('YINI.parse(..): result:');
73
73
  console.log(result);
74
- (0, system_1.devPrint)('Complete result:');
75
- (0, system_1.printObject)(result);
74
+ (0, print_1.devPrint)('Complete result:');
75
+ (0, print_1.printObject)(result);
76
76
  }
77
77
  return result;
78
78
  };
@@ -93,7 +93,7 @@ YINI.parse = (yiniContent, strictMode = false, bailSensitivity = 'auto', include
93
93
  * @returns A JavaScript object representing the parsed YINI content.
94
94
  */
95
95
  YINI.parseFile = (filePath, strictMode = false, bailSensitivity = 'auto', includeMetaData = false) => {
96
- (0, system_1.debugPrint)('Current directory = ' + process.cwd());
96
+ (0, print_1.debugPrint)('Current directory = ' + process.cwd());
97
97
  if ((0, pathAndFileName_1.getFileNameExtension)(filePath).toLowerCase() !== '.yini') {
98
98
  console.error('Invalid file extension for YINI file:');
99
99
  console.error(`"${filePath}"`);
@@ -128,16 +128,16 @@ YINI.parseFile = (filePath, strictMode = false, bailSensitivity = 'auto', includ
128
128
  isWithDiagnostics: (0, env_1.isDev)() || (0, env_1.isDebug)(),
129
129
  isWithTiming: (0, env_1.isDebug)(),
130
130
  };
131
- (0, system_1.debugPrint)();
132
- (0, system_1.debugPrint)('==== Call parse ==========================');
131
+ (0, print_1.debugPrint)();
132
+ (0, print_1.debugPrint)('==== Call parse ==========================');
133
133
  const result = (0, parseEntry_1.parseMain)(content, options);
134
- (0, system_1.debugPrint)('==== End call parse ==========================\n');
134
+ (0, print_1.debugPrint)('==== End call parse ==========================\n');
135
135
  if ((0, env_1.isDev)()) {
136
136
  console.log();
137
- (0, system_1.devPrint)('YINI.parse(..): result:');
137
+ (0, print_1.devPrint)('YINI.parse(..): result:');
138
138
  console.log(result);
139
- (0, system_1.devPrint)('Complete result:');
140
- (0, system_1.printObject)(result);
139
+ (0, print_1.devPrint)('Complete result:');
140
+ (0, print_1.printObject)(result);
141
141
  }
142
142
  return result;
143
143
  };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ErrorDataHandler = void 0;
4
4
  const env_1 = require("../config/env");
5
- const system_1 = require("../utils/system");
5
+ const print_1 = require("../utils/print");
6
6
  // All the issue titles are defined here to get a quick overview of all
7
7
  // titles, and to easier check that all titles match with relation to
8
8
  // the other titles.
@@ -48,7 +48,7 @@ class ErrorDataHandler {
48
48
  column: endCol,
49
49
  },
50
50
  };
51
- (0, system_1.debugPrint)('issue:');
51
+ (0, print_1.debugPrint)('issue:');
52
52
  (0, env_1.isDebug)() && console.log(issue);
53
53
  return issue;
54
54
  };
@@ -67,16 +67,16 @@ class ErrorDataHandler {
67
67
  */
68
68
  this.pushOrBail = (ctx, type, msgWhat, msgWhy = '', msgHint = '') => {
69
69
  var _a, _b, _c, _d, _e, _f;
70
- (0, system_1.debugPrint)('-> pushOrBail(..)');
71
- (0, system_1.debugPrint)('ctx.exception?.name =' + ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _a === void 0 ? void 0 : _a.name));
72
- (0, system_1.debugPrint)('ctx.exception?.message = ' + ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _b === void 0 ? void 0 : _b.message));
73
- (0, system_1.debugPrint)('exception?.offendingToken = ' + ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _c === void 0 ? void 0 : _c.offendingToken));
74
- (0, system_1.debugPrint)();
75
- (0, system_1.debugPrint)('ctx.ruleIndex = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.start.channel));
76
- (0, system_1.debugPrint)('ctx.ruleIndex = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.ruleIndex));
77
- (0, system_1.debugPrint)('ctx.ruleContext = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.ruleContext));
78
- (0, system_1.debugPrint)('ctx.stop?.line = ' + ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.stop) === null || _d === void 0 ? void 0 : _d.line));
79
- (0, system_1.debugPrint)('ctx.stop?.column = ' + ((_e = ctx === null || ctx === void 0 ? void 0 : ctx.stop) === null || _e === void 0 ? void 0 : _e.column));
70
+ (0, print_1.debugPrint)('-> pushOrBail(..)');
71
+ (0, print_1.debugPrint)('ctx.exception?.name =' + ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _a === void 0 ? void 0 : _a.name));
72
+ (0, print_1.debugPrint)('ctx.exception?.message = ' + ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _b === void 0 ? void 0 : _b.message));
73
+ (0, print_1.debugPrint)('exception?.offendingToken = ' + ((_c = ctx === null || ctx === void 0 ? void 0 : ctx.exception) === null || _c === void 0 ? void 0 : _c.offendingToken));
74
+ (0, print_1.debugPrint)();
75
+ (0, print_1.debugPrint)('ctx.ruleIndex = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.start.channel));
76
+ (0, print_1.debugPrint)('ctx.ruleIndex = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.ruleIndex));
77
+ (0, print_1.debugPrint)('ctx.ruleContext = ' + (ctx === null || ctx === void 0 ? void 0 : ctx.ruleContext));
78
+ (0, print_1.debugPrint)('ctx.stop?.line = ' + ((_d = ctx === null || ctx === void 0 ? void 0 : ctx.stop) === null || _d === void 0 ? void 0 : _d.line));
79
+ (0, print_1.debugPrint)('ctx.stop?.column = ' + ((_e = ctx === null || ctx === void 0 ? void 0 : ctx.stop) === null || _e === void 0 ? void 0 : _e.column));
80
80
  const lineNum = (ctx === null || ctx === void 0 ? void 0 : ctx.start.line) || 0; // Column (1-based).
81
81
  const startCol = !ctx ? 0 : ++ctx.start.column; // Column (0-based).
82
82
  const endCol = (((_f = ctx === null || ctx === void 0 ? void 0 : ctx.stop) === null || _f === void 0 ? void 0 : _f.column) || 0) + 1; // Column (0-based).
@@ -85,9 +85,9 @@ class ErrorDataHandler {
85
85
  if (process.env.NODE_ENV === 'test') {
86
86
  msgWhat += `\nAt line: ${lineNum}, column(s): ${startCol}-${endCol}`;
87
87
  }
88
- (0, system_1.debugPrint)('persistThreshold = ' + this.persistThreshold);
89
- (0, system_1.debugPrint)('lineNum = ' + lineNum);
90
- (0, system_1.debugPrint)();
88
+ (0, print_1.debugPrint)('persistThreshold = ' + this.persistThreshold);
89
+ (0, print_1.debugPrint)('lineNum = ' + lineNum);
90
+ (0, print_1.debugPrint)();
91
91
  const issue = this.makeIssuePayload(type, msgWhat, lineNum, startCol, endCol);
92
92
  switch (type) {
93
93
  case 'Internal-Error':