yini-parser 1.0.2-beta → 1.2.0-beta

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.
Files changed (103) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +83 -98
  3. package/dist/YINI.d.ts +162 -23
  4. package/dist/YINI.js +183 -99
  5. package/dist/YINI.js.map +1 -0
  6. package/dist/config/env.js +1 -0
  7. package/dist/config/env.js.map +1 -0
  8. package/dist/core/astBuilder.d.ts +191 -0
  9. package/dist/core/astBuilder.js +840 -0
  10. package/dist/core/astBuilder.js.map +1 -0
  11. package/dist/core/{ErrorDataHandler.d.ts → errorDataHandler.d.ts} +21 -19
  12. package/dist/core/errorDataHandler.js +271 -0
  13. package/dist/core/errorDataHandler.js.map +1 -0
  14. package/dist/core/internalTypes.d.ts +121 -0
  15. package/dist/core/internalTypes.js +16 -0
  16. package/dist/core/internalTypes.js.map +1 -0
  17. package/dist/core/objectBuilder.d.ts +10 -4
  18. package/dist/core/objectBuilder.js +127 -163
  19. package/dist/core/objectBuilder.js.map +1 -0
  20. package/dist/core/options/failLevel.d.ts +3 -0
  21. package/dist/core/options/failLevel.js +27 -0
  22. package/dist/core/options/failLevel.js.map +1 -0
  23. package/dist/core/options/normalizeOptions.d.ts +5 -0
  24. package/dist/core/options/normalizeOptions.js +53 -0
  25. package/dist/core/options/normalizeOptions.js.map +1 -0
  26. package/dist/core/options/parserOptionsConstants.d.ts +7 -0
  27. package/dist/core/options/parserOptionsConstants.js +37 -0
  28. package/dist/core/options/parserOptionsConstants.js.map +1 -0
  29. package/dist/core/pipeline.d.ts +18 -0
  30. package/dist/core/pipeline.js +323 -0
  31. package/dist/core/pipeline.js.map +1 -0
  32. package/dist/core/resultMetadataBuilder.d.ts +19 -0
  33. package/dist/core/resultMetadataBuilder.js +166 -0
  34. package/dist/core/resultMetadataBuilder.js.map +1 -0
  35. package/dist/core/runtime.d.ts +17 -0
  36. package/dist/core/runtime.js +189 -0
  37. package/dist/core/runtime.js.map +1 -0
  38. package/dist/dev/main.d.ts +1 -0
  39. package/dist/dev/main.js +374 -0
  40. package/dist/dev/main.js.map +1 -0
  41. package/dist/grammar/generated/YiniLexer.d.ts +74 -0
  42. package/dist/grammar/generated/YiniLexer.js +415 -0
  43. package/dist/grammar/generated/YiniLexer.js.map +1 -0
  44. package/dist/grammar/{YiniParser.d.ts → generated/YiniParser.d.ts} +167 -150
  45. package/dist/grammar/{YiniParser.js → generated/YiniParser.js} +1242 -1202
  46. package/dist/grammar/generated/YiniParser.js.map +1 -0
  47. package/dist/grammar/{YiniParserVisitor.d.ts → generated/YiniParserVisitor.d.ts} +59 -45
  48. package/dist/grammar/{YiniParserVisitor.js → generated/YiniParserVisitor.js} +2 -1
  49. package/dist/grammar/generated/YiniParserVisitor.js.map +1 -0
  50. package/dist/index.d.ts +43 -2
  51. package/dist/index.js +62 -101
  52. package/dist/index.js.map +1 -0
  53. package/dist/parsers/extractHeaderParts.d.ts +4 -3
  54. package/dist/parsers/extractHeaderParts.js +3 -1
  55. package/dist/parsers/extractHeaderParts.js.map +1 -0
  56. package/dist/parsers/extractSignificantYiniLine.js +2 -1
  57. package/dist/parsers/extractSignificantYiniLine.js.map +1 -0
  58. package/dist/parsers/parseBoolean.d.ts +1 -1
  59. package/dist/parsers/parseBoolean.js +3 -1
  60. package/dist/parsers/parseBoolean.js.map +1 -0
  61. package/dist/parsers/parseNull.js +1 -0
  62. package/dist/parsers/parseNull.js.map +1 -0
  63. package/dist/parsers/parseNumber.d.ts +8 -3
  64. package/dist/parsers/parseNumber.js +22 -7
  65. package/dist/parsers/parseNumber.js.map +1 -0
  66. package/dist/parsers/parseSectionHeader.d.ts +5 -4
  67. package/dist/parsers/parseSectionHeader.js +3 -1
  68. package/dist/parsers/parseSectionHeader.js.map +1 -0
  69. package/dist/parsers/parseString.js +3 -3
  70. package/dist/parsers/parseString.js.map +1 -0
  71. package/dist/types/index.d.ts +198 -0
  72. package/dist/types/index.js +4 -0
  73. package/dist/types/index.js.map +1 -0
  74. package/dist/utils/number.d.ts +3 -0
  75. package/dist/utils/number.js +19 -0
  76. package/dist/utils/number.js.map +1 -0
  77. package/dist/utils/object.d.ts +67 -0
  78. package/dist/utils/object.js +125 -0
  79. package/dist/utils/object.js.map +1 -0
  80. package/dist/utils/pathAndFileName.js +1 -0
  81. package/dist/utils/pathAndFileName.js.map +1 -0
  82. package/dist/utils/print.d.ts +2 -2
  83. package/dist/utils/print.js +11 -6
  84. package/dist/utils/print.js.map +1 -0
  85. package/dist/utils/string.d.ts +26 -1
  86. package/dist/utils/string.js +48 -4
  87. package/dist/utils/string.js.map +1 -0
  88. package/dist/utils/system.d.ts +15 -0
  89. package/dist/utils/system.js +22 -0
  90. package/dist/utils/system.js.map +1 -0
  91. package/dist/{yiniHelpers.d.ts → utils/yiniHelpers.d.ts} +3 -0
  92. package/dist/{yiniHelpers.js → utils/yiniHelpers.js} +46 -9
  93. package/dist/utils/yiniHelpers.js.map +1 -0
  94. package/package.json +7 -5
  95. package/dist/core/ErrorDataHandler.js +0 -203
  96. package/dist/core/YINIVisitor.d.ts +0 -158
  97. package/dist/core/YINIVisitor.js +0 -1008
  98. package/dist/core/types.d.ts +0 -59
  99. package/dist/core/types.js +0 -36
  100. package/dist/grammar/YiniLexer.d.ts +0 -68
  101. package/dist/grammar/YiniLexer.js +0 -379
  102. package/dist/parseEntry.d.ts +0 -2
  103. package/dist/parseEntry.js +0 -185
@@ -0,0 +1,198 @@
1
+ /**
2
+ *
3
+ * Public (user-facing) types (shapes) here only.
4
+ *
5
+ * @note Internal-only types (shapes) should go into core/internalTypes.ts.
6
+ * @note These types and interface (shapes) should NOT include the 'T' and,
7
+ * 'I' prefixes, due to these are public user-facing.
8
+ */
9
+ import { TBailSensitivityLevel } from '../core/internalTypes';
10
+ /**
11
+ * JavaScript object produced by parsing a YINI document.
12
+ */
13
+ export type ParsedObject = any;
14
+ /**
15
+ * Result returned from `parse(..)` and `parseFile(..)`,
16
+ * containing both the parsed object and associated metadata.
17
+ */
18
+ export interface YiniParseResult {
19
+ result: ParsedObject;
20
+ meta: ResultMetadata;
21
+ }
22
+ export type FailLevelKey = 'ignore-errors' | 'errors' | 'warnings-and-errors';
23
+ export type PreferredFailLevel = 'auto' | FailLevelKey;
24
+ export type OnDuplicateKey = 'warn-and-keep-first' | 'warn-and-overwrite' | 'keep-first' | 'overwrite' | 'error';
25
+ /** Version tag for the public metadata schema. */
26
+ export type MetaSchemaVersion = '1.1.0';
27
+ /** Source of the order guarantee. */
28
+ export type OrderGuarantee = 'spec' | 'language' | 'implementation-defined' | 'none';
29
+ /**
30
+ * User-facing options, these are external and should be more user friendly,
31
+ * and shorter, parameter names than the (more descriptive) internal
32
+ * engine option names.
33
+ *
34
+ * @note These parameters are emphasizes a bit more than the other options,
35
+ * therefor these are kept a bit shorter for usability-purposes.
36
+ * @note These are the same as in the "simple positional API" function in
37
+ * the YINI class.
38
+ */
39
+ export interface PrimaryUserParams {
40
+ /** Enable stricter syntax and well-formedness checks. */
41
+ strictMode?: boolean;
42
+ /**
43
+ * Minimum severity that should cause parse to fail.
44
+ * 'auto' | 'ignore-errors' | 'errors' | 'warnings-and-errors'
45
+ */
46
+ failLevel?: PreferredFailLevel;
47
+ /** Attach metadata to the parse result (timings, diagnostics, etc.). */
48
+ includeMetadata?: boolean;
49
+ }
50
+ /**
51
+ * @param failLevel - Minimum severity that should cause the parse to fail.
52
+ * Accepts:
53
+ * `'ignore-errors'` - Don't bail/fail on error, persist and try to recover.
54
+ * `'errors'` - Stop parsing on the first error.
55
+ * `'warnings-and-errors'` - Stop parsing on the first warning or error.
56
+ * (Type: TPreferredFailLevel; exact behavior is implementation-defined.)
57
+ * @param includeDiagnostics - Include diagnostics in the returned metadata.
58
+ * Requires: `includeMetadata = true`. Ignored otherwise.
59
+ * @param includeMetadata - Attach a metadata object to the parse result
60
+ * (e.g., timings, diagnostics).
61
+ * @param includeTiming - Include timing information for parser phases in metadata.
62
+ * Requires: `includeMetadata = true`. Ignored otherwise.
63
+ * @param onDuplicateKey - Strategy/handler when encountering a duplicate key.
64
+ * Allowed values: `'warn-and-keep-first'` | `'warn-and-overwrite'` | `'keep-first'` (silent, first wins) | `'overwrite'` (silent, last wins) | `'error'`.
65
+ * @param preserveUndefinedInMeta - Keep properties with value `undefined` inside
66
+ * the returned metadata. Requires: `includeMetadata = true`. Ignored otherwise.
67
+ * @param requireDocTerminator - Controls whether a document terminator is required.
68
+ * Allowed values: `'optional'` | `'warn-if-missing'` | `'required'`.
69
+ * @param strictMode - Enable stricter syntax and well-formedness checks according
70
+ * to the spec (exact rules are implementation-defined).
71
+ * @param suppressWarnings - Suppress warnings sent to the console/log.
72
+ * Does not affect warnings included in returned metadata.
73
+ * @param treatEmptyValueAsNull - How to treat an explicitly empty value on the
74
+ * right-hand side of '='. Allowed values: `'allow'` | `'allow-with-warning'` | `'disallow'`.
75
+ */
76
+ export interface AllUserOptions extends PrimaryUserParams {
77
+ includeDiagnostics?: boolean;
78
+ includeTiming?: boolean;
79
+ preserveUndefinedInMeta?: boolean;
80
+ suppressWarnings?: boolean;
81
+ requireDocTerminator?: 'optional' | 'warn-if-missing' | 'required';
82
+ treatEmptyValueAsNull?: 'allow' | 'allow-with-warning' | 'disallow';
83
+ onDuplicateKey?: OnDuplicateKey;
84
+ }
85
+ export interface IssuePayload {
86
+ /** 1-based; use undefined when not applicable. */
87
+ line: number | undefined;
88
+ /** 1-based; use undefined when not applicable. */
89
+ column: number | undefined;
90
+ /** Lowercase key for easy tooling. */
91
+ typeKey: string;
92
+ message: string;
93
+ advice: string | undefined;
94
+ hint: string | undefined;
95
+ }
96
+ /**
97
+ * @note NOTE: USE NO TYPES here (or neither in nested structures), they
98
+ * should only be strings (and content MUST be transformed from the
99
+ * types to lower snake case)
100
+ *
101
+ * *** DUE TO make easier for tooling ***
102
+ *
103
+ * @note UPDATE 'metaSchemaVersion' on any edits to the meta structure.
104
+ */
105
+ export interface ResultMetadata {
106
+ parserVersion: string;
107
+ mode: 'lenient' | 'strict';
108
+ totalErrors: number;
109
+ totalWarnings: number;
110
+ totalMessages: number;
111
+ runStartedAt: string;
112
+ runFinishedAt: string;
113
+ durationMs: number;
114
+ preservesOrder: boolean;
115
+ orderGuarantee: OrderGuarantee;
116
+ orderNotes?: string;
117
+ source: {
118
+ sourceType: string;
119
+ fileName: undefined | string;
120
+ hasDocumentTerminator: boolean;
121
+ hasYiniMarker: boolean;
122
+ byteSize: null | number;
123
+ lineCount: null | number;
124
+ sha256: null | string;
125
+ };
126
+ structure: {
127
+ maxDepth: null | number;
128
+ sectionCount: null | number;
129
+ memberCount: null | number;
130
+ keysParsedCount: null | number;
131
+ sectionNamePaths: string[] | null;
132
+ };
133
+ metaSchemaVersion: MetaSchemaVersion;
134
+ diagnostics?: {
135
+ failLevel: {
136
+ preferredLevel: null | PreferredFailLevel;
137
+ usedLevelType: TBailSensitivityLevel;
138
+ usedLevelKey: FailLevelKey;
139
+ levelDescription: string | null;
140
+ };
141
+ errors: {
142
+ errorCount: number;
143
+ payload: IssuePayload[];
144
+ };
145
+ warnings: {
146
+ warningCount: number;
147
+ payload: IssuePayload[];
148
+ };
149
+ notices: {
150
+ noticeCount: number;
151
+ payload: IssuePayload[];
152
+ };
153
+ infos: {
154
+ infoCount: number;
155
+ payload: IssuePayload[];
156
+ };
157
+ environment: {
158
+ NODE_ENV: undefined | string;
159
+ APP_ENV: undefined | string;
160
+ lib: {
161
+ nodeEnv: undefined | string;
162
+ appEnv: undefined | string;
163
+ flags: {
164
+ isDev: boolean;
165
+ isDebug: boolean;
166
+ };
167
+ };
168
+ };
169
+ effectiveOptions: AllUserOptions;
170
+ options: AllUserOptions;
171
+ };
172
+ timing?: {
173
+ total: null | {
174
+ timeMs: number;
175
+ name: string;
176
+ };
177
+ phase0: undefined | {
178
+ timeMs: number;
179
+ name: string;
180
+ };
181
+ phase1: null | {
182
+ timeMs: number;
183
+ name: string;
184
+ };
185
+ phase2: null | {
186
+ timeMs: number;
187
+ name: string;
188
+ };
189
+ phase3: null | {
190
+ timeMs: number;
191
+ name: string;
192
+ };
193
+ phase4: null | {
194
+ timeMs: number;
195
+ name: string;
196
+ };
197
+ };
198
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // File: src/types/index.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,2BAA2B"}
@@ -0,0 +1,3 @@
1
+ export declare const isNaNValue: (n: number) => boolean;
2
+ export declare const isInfinityValue: (n: number) => boolean;
3
+ export declare const isValidJSNumber: (str: string) => boolean;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidJSNumber = exports.isInfinityValue = exports.isNaNValue = void 0;
4
+ const isNaNValue = (n) => {
5
+ return Number.isNaN(n);
6
+ };
7
+ exports.isNaNValue = isNaNValue;
8
+ const isInfinityValue = (n) => {
9
+ return n === Infinity || n === -Infinity;
10
+ };
11
+ exports.isInfinityValue = isInfinityValue;
12
+ const isValidJSNumber = (str) => {
13
+ if (str.trim() === '')
14
+ return false; // Reject empty or whitespace-only.
15
+ const n = Number(str);
16
+ return !Number.isNaN(n); // True only if parse succeeded.
17
+ };
18
+ exports.isValidJSNumber = isValidJSNumber;
19
+ //# sourceMappingURL=number.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","sourceRoot":"","sources":["../../src/utils/number.ts"],"names":[],"mappings":";;;AAAO,MAAM,UAAU,GAAG,CAAC,CAAS,EAAW,EAAE;IAC7C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAC1B,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AAEM,MAAM,eAAe,GAAG,CAAC,CAAS,EAAW,EAAE;IAClD,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;AAC5C,CAAC,CAAA;AAFY,QAAA,eAAe,mBAE3B;AAEM,MAAM,eAAe,GAAG,CAAC,GAAW,EAAW,EAAE;IACpD,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,KAAK,CAAA,CAAC,mCAAmC;IACvE,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA,CAAC,gCAAgC;AAC5D,CAAC,CAAA;AAJY,QAAA,eAAe,mBAI3B"}
@@ -0,0 +1,67 @@
1
+ interface SortOptions {
2
+ /** Sort nested objects too (default: false) */
3
+ deep?: boolean;
4
+ /** Custom key comparator (default: a.localeCompare(b)) */
5
+ comparator?: (a: string, b: string) => number;
6
+ }
7
+ /**
8
+ * Returns a new object with keys sorted alphabetically.
9
+ * Arrays and non-plain objects are preserved as-is (unless deep + they contain plain objects).
10
+ */
11
+ export declare const sortObjectKeys: <T>(obj: T, options?: SortOptions) => T;
12
+ /**
13
+ * Removes top-level properties with value `undefined`.
14
+ * Does not recurse into nested objects or arrays.
15
+ *
16
+ * @param obj Any JS object
17
+ * @returns A shallow copy with undefined properties removed,
18
+ * except in nested objects or arrays.
19
+ *
20
+ * @example
21
+ * Input:
22
+ * const input = {
23
+ * a: 1,
24
+ * b: undefined,
25
+ * c: { d: undefined, e: 2 },
26
+ * f: [1, undefined, 2]
27
+ * };
28
+ *
29
+ * Output:
30
+ * {
31
+ * a: 1,
32
+ * c: { d: undefined, e: 2 },
33
+ * f: [1, undefined, 2]
34
+ * }
35
+ */
36
+ export declare const removeUndefinedShallow: <T extends object>(obj: T) => Partial<T>;
37
+ /**
38
+ * Recursively removes properties with value `undefined` from objects
39
+ * and arrays.
40
+ *
41
+ * @param obj Any JS value (object, array, primitive)
42
+ * @returns A deep-cloned copy with all `undefined` removed, including in
43
+ * nested objects and arrays.
44
+ *
45
+ * @example
46
+ * Input:
47
+ * const input = {
48
+ * a: 1,
49
+ * b: undefined,
50
+ * c: {
51
+ * d: undefined,
52
+ * e: 2,
53
+ * f: [1, undefined, { g: undefined, h: 42 }]
54
+ * }
55
+ * };
56
+ *
57
+ * Output:
58
+ * {
59
+ * a: 1,
60
+ * c: {
61
+ * e: 2,
62
+ * f: [1, { h: 42 }]
63
+ * }
64
+ * }
65
+ */
66
+ export declare const removeUndefinedDeep: <T>(obj: T) => T;
67
+ export {};
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeUndefinedDeep = exports.removeUndefinedShallow = exports.sortObjectKeys = void 0;
4
+ const isPlainObject = (value) => {
5
+ return (typeof value === 'object' &&
6
+ value !== null &&
7
+ !Array.isArray(value) &&
8
+ Object.prototype.toString.call(value) === '[object Object]');
9
+ };
10
+ /**
11
+ * Returns a new object with keys sorted alphabetically.
12
+ * Arrays and non-plain objects are preserved as-is (unless deep + they contain plain objects).
13
+ */
14
+ const sortObjectKeys = (obj, options = {}) => {
15
+ const { deep = false, comparator } = options;
16
+ if (!isPlainObject(obj)) {
17
+ // If it's not a plain object (array, Date, null, primitive), return as-is.
18
+ return obj;
19
+ }
20
+ const keys = Object.keys(obj).sort(comparator ?? ((a, b) => a.localeCompare(b)));
21
+ const sortedEntries = keys.map((k) => {
22
+ const value = obj[k];
23
+ if (deep) {
24
+ if (isPlainObject(value)) {
25
+ return [k, (0, exports.sortObjectKeys)(value, options)];
26
+ }
27
+ if (Array.isArray(value)) {
28
+ // Deep-sort any plain objects inside arrays, leave others as-is.
29
+ return [
30
+ k,
31
+ value.map((item) => isPlainObject(item)
32
+ ? (0, exports.sortObjectKeys)(item, options)
33
+ : item),
34
+ ];
35
+ }
36
+ }
37
+ return [k, value];
38
+ });
39
+ // Preserve the original type T structurally.
40
+ return Object.fromEntries(sortedEntries);
41
+ };
42
+ exports.sortObjectKeys = sortObjectKeys;
43
+ /**
44
+ * Removes top-level properties with value `undefined`.
45
+ * Does not recurse into nested objects or arrays.
46
+ *
47
+ * @param obj Any JS object
48
+ * @returns A shallow copy with undefined properties removed,
49
+ * except in nested objects or arrays.
50
+ *
51
+ * @example
52
+ * Input:
53
+ * const input = {
54
+ * a: 1,
55
+ * b: undefined,
56
+ * c: { d: undefined, e: 2 },
57
+ * f: [1, undefined, 2]
58
+ * };
59
+ *
60
+ * Output:
61
+ * {
62
+ * a: 1,
63
+ * c: { d: undefined, e: 2 },
64
+ * f: [1, undefined, 2]
65
+ * }
66
+ */
67
+ const removeUndefinedShallow = (obj) => {
68
+ const cleaned = {};
69
+ for (const [key, value] of Object.entries(obj)) {
70
+ if (value !== undefined) {
71
+ cleaned[key] = value;
72
+ }
73
+ }
74
+ return cleaned;
75
+ };
76
+ exports.removeUndefinedShallow = removeUndefinedShallow;
77
+ /**
78
+ * Recursively removes properties with value `undefined` from objects
79
+ * and arrays.
80
+ *
81
+ * @param obj Any JS value (object, array, primitive)
82
+ * @returns A deep-cloned copy with all `undefined` removed, including in
83
+ * nested objects and arrays.
84
+ *
85
+ * @example
86
+ * Input:
87
+ * const input = {
88
+ * a: 1,
89
+ * b: undefined,
90
+ * c: {
91
+ * d: undefined,
92
+ * e: 2,
93
+ * f: [1, undefined, { g: undefined, h: 42 }]
94
+ * }
95
+ * };
96
+ *
97
+ * Output:
98
+ * {
99
+ * a: 1,
100
+ * c: {
101
+ * e: 2,
102
+ * f: [1, { h: 42 }]
103
+ * }
104
+ * }
105
+ */
106
+ const removeUndefinedDeep = (obj) => {
107
+ if (obj === null || typeof obj !== 'object') {
108
+ return obj; // primitive value
109
+ }
110
+ if (Array.isArray(obj)) {
111
+ // Clean each element, and filter out undefined entries
112
+ return obj
113
+ .map((item) => (0, exports.removeUndefinedDeep)(item))
114
+ .filter((item) => item !== undefined);
115
+ }
116
+ const cleaned = {};
117
+ for (const [key, value] of Object.entries(obj)) {
118
+ if (value !== undefined) {
119
+ cleaned[key] = (0, exports.removeUndefinedDeep)(value);
120
+ }
121
+ }
122
+ return cleaned;
123
+ };
124
+ exports.removeUndefinedDeep = removeUndefinedDeep;
125
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":";;;AASA,MAAM,aAAa,GAAG,CAAC,KAAc,EAAwB,EAAE;IAC3D,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAC9D,CAAA;AACL,CAAC,CAAA;AAED;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAI,GAAM,EAAE,UAAuB,EAAE,EAAK,EAAE;IACtE,MAAM,EAAE,IAAI,GAAG,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;IAE5C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,2EAA2E;QAC3E,OAAO,GAAG,CAAA;IACd,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAC9B,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAC/C,CAAA;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACjC,MAAM,KAAK,GAAI,GAAmB,CAAC,CAAC,CAAC,CAAA;QACrC,IAAI,IAAI,EAAE,CAAC;YACP,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;gBACvB,OAAO,CAAC,CAAC,EAAE,IAAA,sBAAc,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;YAC9C,CAAC;YACD,IAAI,KAAK,CAAC,OA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E,CAAC,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC;aACxC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAQ,CAAA;IACpD,CAAC;IAED,MAAM,OAAO,GAAQ,EAAE,CAAA;IACvB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,GAAG,IAAA,2BAAmB,EAAC,KAAY,CAAC,CAAA;QACpD,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAA;AAClB,CAAC,CAAA;AAnBY,QAAA,mBAAmB,uBAmB/B"}
@@ -13,3 +13,4 @@ const getFileNameExtension = (fullPath) => {
13
13
  return path_1.default.extname(fullPath);
14
14
  };
15
15
  exports.getFileNameExtension = getFileNameExtension;
16
+ //# sourceMappingURL=pathAndFileName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathAndFileName.js","sourceRoot":"","sources":["../../src/utils/pathAndFileName.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,gDAAuB;AAEhB,MAAM,oBAAoB,GAAG,CAAC,QAAgB,EAAU,EAAE;IAC7D,OAAO,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;AACjC,CAAC,CAAA;AAFY,QAAA,oBAAoB,wBAEhC"}
@@ -4,10 +4,10 @@ export declare const toPrettyJSON: (obj: any) => string;
4
4
  /** Pretty-prints a JavaScript object as formatted JSON to the console.
5
5
  * Strict JSON, all keys are enclosed in ", etc.
6
6
  */
7
- export declare const printJSON: (obj: any) => void;
7
+ export declare const printJSON: (obj: any, isForce?: boolean) => void;
8
8
  /**
9
9
  * Print a full JavaScript object in a human-readable way (not as JSON).
10
10
  * Not strict JSON, and shows functions, symbols, getters/setters, and class names.
11
11
  * @param isColors If true, the output is styled with ANSI color codes.
12
12
  */
13
- export declare const printObject: (obj: any, isColors?: boolean) => void;
13
+ export declare const printObject: (obj: any, isForce?: boolean, isColors?: boolean) => void;
@@ -26,9 +26,11 @@ exports.toPrettyJSON = toPrettyJSON;
26
26
  /** Pretty-prints a JavaScript object as formatted JSON to the console.
27
27
  * Strict JSON, all keys are enclosed in ", etc.
28
28
  */
29
- const printJSON = (obj) => {
30
- if ((0, env_1.isProdEnv)() || ((0, env_1.isTestEnv)() && !(0, env_1.isDebug)()))
31
- return;
29
+ const printJSON = (obj, isForce = false) => {
30
+ if (!isForce) {
31
+ if ((0, env_1.isProdEnv)() || ((0, env_1.isTestEnv)() && !(0, env_1.isDebug)()))
32
+ return;
33
+ }
32
34
  const str = (0, exports.toPrettyJSON)(obj);
33
35
  console.log(str);
34
36
  };
@@ -38,9 +40,12 @@ exports.printJSON = printJSON;
38
40
  * Not strict JSON, and shows functions, symbols, getters/setters, and class names.
39
41
  * @param isColors If true, the output is styled with ANSI color codes.
40
42
  */
41
- const printObject = (obj, isColors = true) => {
42
- if ((0, env_1.isProdEnv)() || ((0, env_1.isTestEnv)() && !(0, env_1.isDebug)()))
43
- return;
43
+ const printObject = (obj, isForce = false, isColors = true) => {
44
+ if (!isForce) {
45
+ if ((0, env_1.isProdEnv)() || ((0, env_1.isTestEnv)() && !(0, env_1.isDebug)()))
46
+ return;
47
+ }
44
48
  console.log(util_1.default.inspect(obj, { depth: null, colors: isColors }));
45
49
  };
46
50
  exports.printObject = printObject;
51
+ //# sourceMappingURL=print.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/utils/print.ts"],"names":[],"mappings":";;;;;;AAAA;;;GAGG;AACH,gDAAuB;AACvB,uCAAoE;AAE7D,MAAM,UAAU,GAAG,CAAC,MAAW,EAAE,EAAE,EAAE;IACxC,IAAA,aAAO,GAAE,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,CAAA;AAC/C,CA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,EAAE,CAAC,CAAC,CAAA;AACrE,CAAC,CAAA;AANY,QAAA,WAAW,eAMvB"}
@@ -2,12 +2,27 @@
2
2
  * This file contains general string helper functions (utils).
3
3
  * @note More specific YINI helper functions should go into yiniHelpers.ts-file.
4
4
  */
5
+ /**
6
+ * Capitalizes the first character of a string.
7
+ *
8
+ * @param str The input string.
9
+ * @returns A new string with the first character uppercased.
10
+ */
11
+ export declare const capitalizeFirst: (str: string) => string;
12
+ export declare const computeSha256: (content: string) => string;
5
13
  /**
6
14
  * Splits a string into an array of lines, handling both LF and CRLF newlines.
7
15
  * @param content The input string.
8
16
  * @returns Array of lines (strings).
9
17
  */
10
- export declare function splitLines(content: string): string[];
18
+ export declare const splitLines: (content: string) => string[];
19
+ /**
20
+ * Trims trailing non-letter characters (A–Z, a–z) from the end of a string.
21
+ *
22
+ * @param str Input string
23
+ * @returns String with trailing non-letters removed
24
+ */
25
+ export declare const trimTrailingNonLetters: (str: string) => string;
11
26
  /**
12
27
  * If a string starts and ends with a backtick `, if so trims the
13
28
  * first and last character (the backticks).
@@ -40,3 +55,13 @@ export declare const isDigit: (character: string) => boolean;
40
55
  * @deprecated This seems not useful anymore, use stripCommentsAndAfter(..) instead.
41
56
  */
42
57
  export declare const stripNLAndAfter: (line: string) => string;
58
+ /**
59
+ * Transforms strings such as 'Id-Name' to 'id_name'.
60
+ * Replaces all '-' to '_', and returns rusult in lower case.
61
+ */
62
+ export declare const toLowerSnakeCase: (txt: string) => string;
63
+ /**
64
+ * Transforms strings such as 'Id-Name' to 'id-name'.
65
+ * Replaces all '_' to '-', and returns rusult in lower case.
66
+ */
67
+ export declare const toLowerKebabCase: (txt: string) => string;
@@ -4,18 +4,45 @@
4
4
  * @note More specific YINI helper functions should go into yiniHelpers.ts-file.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.stripNLAndAfter = exports.isDigit = exports.isAlpha = exports.isEnclosedInBackticks = exports.trimBackticks = void 0;
8
- exports.splitLines = splitLines;
7
+ exports.toLowerKebabCase = exports.toLowerSnakeCase = exports.stripNLAndAfter = exports.isDigit = exports.isAlpha = exports.isEnclosedInBackticks = exports.trimBackticks = exports.trimTrailingNonLetters = exports.splitLines = exports.computeSha256 = exports.capitalizeFirst = void 0;
8
+ const crypto_1 = require("crypto");
9
9
  const print_1 = require("./print");
10
+ /**
11
+ * Capitalizes the first character of a string.
12
+ *
13
+ * @param str The input string.
14
+ * @returns A new string with the first character uppercased.
15
+ */
16
+ const capitalizeFirst = (str) => {
17
+ if (!str)
18
+ return str;
19
+ return str.charAt(0).toUpperCase() + str.slice(1);
20
+ };
21
+ exports.capitalizeFirst = capitalizeFirst;
22
+ const computeSha256 = (content) => {
23
+ return (0, crypto_1.createHash)('sha256').update(content, 'utf8').digest('hex');
24
+ };
25
+ exports.computeSha256 = computeSha256;
10
26
  /**
11
27
  * Splits a string into an array of lines, handling both LF and CRLF newlines.
12
28
  * @param content The input string.
13
29
  * @returns Array of lines (strings).
14
30
  */
15
- function splitLines(content) {
31
+ const splitLines = (content) => {
16
32
  // Chould handle \n (LF), \r\n (CRLF), and even just \r (old Mac style).
17
33
  return content.split(/\r\n|\r|\n/);
18
- }
34
+ };
35
+ exports.splitLines = splitLines;
36
+ /**
37
+ * Trims trailing non-letter characters (A–Z, a–z) from the end of a string.
38
+ *
39
+ * @param str Input string
40
+ * @returns String with trailing non-letters removed
41
+ */
42
+ const trimTrailingNonLetters = (str) => {
43
+ return str.replace(/[^a-zA-Z]+$/g, '');
44
+ };
45
+ exports.trimTrailingNonLetters = trimTrailingNonLetters;
19
46
  /**
20
47
  * If a string starts and ends with a backtick `, if so trims the
21
48
  * first and last character (the backticks).
@@ -95,3 +122,20 @@ const stripNLAndAfter = (line) => {
95
122
  return resultLine;
96
123
  };
97
124
  exports.stripNLAndAfter = stripNLAndAfter;
125
+ /**
126
+ * Transforms strings such as 'Id-Name' to 'id_name'.
127
+ * Replaces all '-' to '_', and returns rusult in lower case.
128
+ */
129
+ const toLowerSnakeCase = (txt) => {
130
+ return txt.trim().toLowerCase().replace(/[-]/g, '_');
131
+ };
132
+ exports.toLowerSnakeCase = toLowerSnakeCase;
133
+ /**
134
+ * Transforms strings such as 'Id-Name' to 'id-name'.
135
+ * Replaces all '_' to '-', and returns rusult in lower case.
136
+ */
137
+ const toLowerKebabCase = (txt) => {
138
+ return txt.trim().toLowerCase().replace(/[_]/g, '-');
139
+ };
140
+ exports.toLowerKebabCase = toLowerKebabCase;
141
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mCAAmC;AACnC,mCAAoC;AAEpC;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,GAAW,EAAU,EAAE;IACnD,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAA;IACpB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACrD,CAAC,CAAA;AAHY,QAAA,eAAe,mBAG3B;AAEM,MAAM,aAAa,GAAG,CAAC,OAAe,EAAU,EAAE;IACrD,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACrE,CAAC,CAAA;AAFY,QAAA,aAAa,iBAEzB;AAED;;;;GAIG;AACI,MAAM,UAAU,GAAG,CAAC,OAAe,EAAY,EAAE;IACpD,wEAAwE;IACxE,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;AACtC,CAAC,CAAA;AAHY,QAAA,UAAU,cAGtB;AAED;;;;;GAKG;AACI,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAU,EAAE;IAC1D,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC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,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AACxD,CAAC,CAAA;AAFY,QAAA,gBAAgB,oBAE5B;AAED;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAU,EAAE;IACpD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AACxD,CAAC,CAAA;AAFY,QAAA,gBAAgB,oBAE5B"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Error instance helper.
3
+ * @example
4
+ * ...
5
+ * } catch (err: unknown) {
6
+ * if (err instanceof Error) {
7
+ * console.error("Message:", err.message)
8
+ * console.error("Stack:", err.stack)
9
+ * } else {
10
+ * console.error("Unknown error:", err)
11
+ * console.error("Thrown value:", JSON.stringify(err))
12
+ * }
13
+ * }
14
+ */
15
+ export declare const isError: (e: unknown) => e is Error;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isError = void 0;
4
+ /**
5
+ * Error instance helper.
6
+ * @example
7
+ * ...
8
+ * } catch (err: unknown) {
9
+ * if (err instanceof Error) {
10
+ * console.error("Message:", err.message)
11
+ * console.error("Stack:", err.stack)
12
+ * } else {
13
+ * console.error("Unknown error:", err)
14
+ * console.error("Thrown value:", JSON.stringify(err))
15
+ * }
16
+ * }
17
+ */
18
+ const isError = (e) => {
19
+ return e instanceof Error;
20
+ };
21
+ exports.isError = isError;
22
+ //# sourceMappingURL=system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/utils/system.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACI,MAAM,OAAO,GAAG,CAAC,CAAU,EAAc,EAAE;IAC9C,OAAO,CAAC,YAAY,KAAK,CAAA;AAC7B,CAAC,CAAA;AAFY,QAAA,OAAO,WAEnB"}