yini-parser 1.3.1-beta → 1.3.3-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.
- package/CHANGELOG.md +18 -2
- package/README.md +53 -176
- package/dist/YINI.d.ts +4 -4
- package/dist/YINI.js +0 -120
- package/dist/YINI.js.map +1 -1
- package/dist/core/options/defaultParserOptions.js +1 -7
- package/dist/core/options/defaultParserOptions.js.map +1 -1
- package/dist/core/options/optionsFunctions.js +7 -5
- package/dist/core/options/optionsFunctions.js.map +1 -1
- package/dist/core/resultMetadataBuilder.js +0 -1
- package/dist/core/resultMetadataBuilder.js.map +1 -1
- package/dist/dev/main.d.ts +1 -1
- package/dist/dev/main.js +24 -4
- package/dist/dev/main.js.map +1 -1
- package/dist/dev/quick-test-samples/defect-inputs.d.ts +37 -0
- package/dist/dev/quick-test-samples/defect-inputs.js +106 -0
- package/dist/dev/quick-test-samples/defect-inputs.js.map +1 -0
- package/dist/dev/quick-test-samples/valid-inputs.d.ts +21 -0
- package/dist/dev/quick-test-samples/valid-inputs.js +422 -0
- package/dist/dev/quick-test-samples/valid-inputs.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/string.d.ts +2 -0
- package/dist/utils/string.js +12 -1
- package/dist/utils/string.js.map +1 -1
- package/examples/nested-output.js +1 -1
- package/examples/nested.yini +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/dev/quick-test-samples/valid-inputs.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.validConfigComplexBigB = exports.validConfigComplexBigA = exports.validConfigComplex = exports.validConfigAdvanced = exports.validConfigWithObjects = exports.validConfigBasic = exports.validConfigShort = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Development-only YINI samples.
|
|
7
|
+
*
|
|
8
|
+
* These inputs are used for quick manual testing during development
|
|
9
|
+
* via src/dev/quick-test-samples/main.ts. They are NOT part of the automated test suite.
|
|
10
|
+
*
|
|
11
|
+
* All real testing belongs in /tests/.
|
|
12
|
+
*/
|
|
13
|
+
exports.validConfigShort = `
|
|
14
|
+
^ App
|
|
15
|
+
name = 'Hello'
|
|
16
|
+
`;
|
|
17
|
+
exports.validConfigBasic = `
|
|
18
|
+
^ App
|
|
19
|
+
name = "My Application"
|
|
20
|
+
version = 1.0
|
|
21
|
+
features = ["search", "logging"]
|
|
22
|
+
|
|
23
|
+
// Nested sub-section under App
|
|
24
|
+
^^ Database
|
|
25
|
+
host = "localhost"
|
|
26
|
+
port = 5432
|
|
27
|
+
`;
|
|
28
|
+
exports.validConfigWithObjects = `
|
|
29
|
+
^ App
|
|
30
|
+
name = "Demo"
|
|
31
|
+
version = "1.0.0"
|
|
32
|
+
features = [ "search", "dark-mode" ]
|
|
33
|
+
|
|
34
|
+
^ Database
|
|
35
|
+
host = "localhost"
|
|
36
|
+
port = 5432
|
|
37
|
+
auth = { user: "admin", pass: "secret" }
|
|
38
|
+
`;
|
|
39
|
+
/**
|
|
40
|
+
* Covers booleans, nulls, number formats, and deeper nesting
|
|
41
|
+
*/
|
|
42
|
+
exports.validConfigAdvanced = `
|
|
43
|
+
^ Server
|
|
44
|
+
enabled = ON
|
|
45
|
+
timeout = 3.5
|
|
46
|
+
retries = 5
|
|
47
|
+
threshold = 1e-3
|
|
48
|
+
fallback = null
|
|
49
|
+
|
|
50
|
+
^^ Logging
|
|
51
|
+
level = "info"
|
|
52
|
+
output = { file: "app.log", rotate: true }
|
|
53
|
+
`;
|
|
54
|
+
/**
|
|
55
|
+
* Covers arrays of objects and realistic structure
|
|
56
|
+
*/
|
|
57
|
+
exports.validConfigComplex = `
|
|
58
|
+
^ App
|
|
59
|
+
services = [
|
|
60
|
+
{ name: "api", port: 8080 },
|
|
61
|
+
{ name: "web", port: 3000 },
|
|
62
|
+
{ name: "auth", port: 9000 }
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
^ Security
|
|
66
|
+
roles = ["admin", "user", "guest"]
|
|
67
|
+
enabled = true
|
|
68
|
+
`;
|
|
69
|
+
/*
|
|
70
|
+
Covers:
|
|
71
|
+
- Sections & deep nesting
|
|
72
|
+
- Real-world domain structure
|
|
73
|
+
- Objects in arrays
|
|
74
|
+
- Arrays of objects
|
|
75
|
+
- Scalars of every type
|
|
76
|
+
- Complex policy logic
|
|
77
|
+
- Auth & security modeling
|
|
78
|
+
- Unicode in strings.
|
|
79
|
+
- Strings in double quotes.
|
|
80
|
+
- Large but readable
|
|
81
|
+
*/
|
|
82
|
+
exports.validConfigComplexBigA = `
|
|
83
|
+
@YINI
|
|
84
|
+
|
|
85
|
+
// Example A: Corporate SaaS Platform.
|
|
86
|
+
|
|
87
|
+
^ App
|
|
88
|
+
name = "Acme Platform" // Example Platform
|
|
89
|
+
description = "The word “Acme” has been used for over 100 years in technical and business examples."
|
|
90
|
+
meaning = "It comes from Greek akmḗ (ἀκμή), meaning “the highest point” or “best”."
|
|
91
|
+
version = "2.3.1"
|
|
92
|
+
debug = OFF
|
|
93
|
+
environment = "production"
|
|
94
|
+
maintainers = ["ops@acme.com", "dev@acme.com"]
|
|
95
|
+
|
|
96
|
+
^^ Features
|
|
97
|
+
enableSearch = true
|
|
98
|
+
enablePayments = true
|
|
99
|
+
enableAnalytics = false
|
|
100
|
+
experimental = ["new-ui", "streaming-api"]
|
|
101
|
+
|
|
102
|
+
^^ Limits
|
|
103
|
+
maxUsers = 50000
|
|
104
|
+
requestTimeoutMs = 3500
|
|
105
|
+
retryPolicy = { maxRetries: 5, backoff: "exponential" }
|
|
106
|
+
|
|
107
|
+
^^ Database
|
|
108
|
+
engine = "postgres"
|
|
109
|
+
host = "db.internal.acme.com"
|
|
110
|
+
port = 5432
|
|
111
|
+
ssl = true
|
|
112
|
+
pool = { min: 5, max: 50 }
|
|
113
|
+
|
|
114
|
+
^^^ Credentials
|
|
115
|
+
username = "app_user"
|
|
116
|
+
password = "****"
|
|
117
|
+
rotateEveryDays = 90
|
|
118
|
+
|
|
119
|
+
^^ API
|
|
120
|
+
baseUrl = "https://api.acme.com"
|
|
121
|
+
publicEndpoints = ["/health", "/status"]
|
|
122
|
+
internalEndpoints = ["/admin", "/metrics"]
|
|
123
|
+
|
|
124
|
+
^^^ Auth
|
|
125
|
+
provider = "oauth2"
|
|
126
|
+
tokenTTLSeconds = 3600
|
|
127
|
+
scopes = ["read", "write", "admin"]
|
|
128
|
+
|
|
129
|
+
^^^^ Clients
|
|
130
|
+
web = { clientId: "web-123", redirectUri: "https://acme.com/callback" }
|
|
131
|
+
mobile = { clientId: "mob-456", redirectUri: "acme://auth" }
|
|
132
|
+
|
|
133
|
+
^ Logging
|
|
134
|
+
level = "info"
|
|
135
|
+
format = "json"
|
|
136
|
+
outputs = ["stdout", "file"]
|
|
137
|
+
|
|
138
|
+
^^ File
|
|
139
|
+
path = "/var/log/acme/app.log"
|
|
140
|
+
maxSizeMB = 100
|
|
141
|
+
rotate = true
|
|
142
|
+
keepFiles = 10
|
|
143
|
+
|
|
144
|
+
^^ Metrics
|
|
145
|
+
enabled = true
|
|
146
|
+
endpoint = "/metrics"
|
|
147
|
+
sampleRate = 0.25
|
|
148
|
+
|
|
149
|
+
^ Services
|
|
150
|
+
enabled = true
|
|
151
|
+
|
|
152
|
+
^^ Email
|
|
153
|
+
provider = "smtp"
|
|
154
|
+
host = "smtp.acme.com"
|
|
155
|
+
port = 587
|
|
156
|
+
secure = false
|
|
157
|
+
from = "no-reply@acme.com"
|
|
158
|
+
|
|
159
|
+
^^^ Credentials
|
|
160
|
+
user = "mailer"
|
|
161
|
+
pass = "mailer-secret"
|
|
162
|
+
|
|
163
|
+
^^ Cache
|
|
164
|
+
type = "redis"
|
|
165
|
+
host = "cache.internal.acme.com"
|
|
166
|
+
port = 6379
|
|
167
|
+
ttlSeconds = 600
|
|
168
|
+
|
|
169
|
+
^^^ Cluster
|
|
170
|
+
nodes = [
|
|
171
|
+
{ host: "cache-1.internal", port: 6379 },
|
|
172
|
+
{ host: "cache-2.internal", port: 6379 },
|
|
173
|
+
{ host: "cache-3.internal", port: 6379 }
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
^ Observability
|
|
177
|
+
tracing = true
|
|
178
|
+
tracingProvider = "opentelemetry"
|
|
179
|
+
traceSampleRate = 0.1
|
|
180
|
+
|
|
181
|
+
^^ Exporters
|
|
182
|
+
jaeger = { enabled: true, endpoint: "http://jaeger:14268/api/traces" }
|
|
183
|
+
prometheus = { enabled: true, endpoint: "http://prom:9090" }
|
|
184
|
+
|
|
185
|
+
^ Security
|
|
186
|
+
allowedIPs = ["10.0.0.0/8", "192.168.0.0/16"]
|
|
187
|
+
blockedCountries = ["KP", "SD"]
|
|
188
|
+
|
|
189
|
+
^^ Policies
|
|
190
|
+
passwordMinLength = 14
|
|
191
|
+
require2FA = true
|
|
192
|
+
sessionTTLMinutes = 120
|
|
193
|
+
|
|
194
|
+
^^^ Lockout
|
|
195
|
+
maxAttempts = 5
|
|
196
|
+
lockoutMinutes = 30
|
|
197
|
+
`;
|
|
198
|
+
/*
|
|
199
|
+
Example B covers:
|
|
200
|
+
Covers:
|
|
201
|
+
- Nested arrays inside inline objects.
|
|
202
|
+
- Sections & deep nesting.
|
|
203
|
+
- Real-world domain structure.
|
|
204
|
+
- Objects in arrays.
|
|
205
|
+
- Arrays of objects.
|
|
206
|
+
- Scalars of every type.
|
|
207
|
+
- Complex policy logic.
|
|
208
|
+
- Auth & security modeling.
|
|
209
|
+
- Unicode in strings.
|
|
210
|
+
- Strings in single quotes.
|
|
211
|
+
- Large but readable.
|
|
212
|
+
*/
|
|
213
|
+
exports.validConfigComplexBigB = `
|
|
214
|
+
@YINI
|
|
215
|
+
|
|
216
|
+
// Example B: High-Security Distributed Control System.
|
|
217
|
+
|
|
218
|
+
^ App
|
|
219
|
+
name = 'Nebula Control Suite'
|
|
220
|
+
description = 'A distributed operations platform for autonomous systems and edge analytics.'
|
|
221
|
+
meaning = 'Nebula comes from Latin "nebula" meaning mist or cloud.'
|
|
222
|
+
version = '5.0.0-rc.4'
|
|
223
|
+
debug = ON
|
|
224
|
+
environment = 'staging'
|
|
225
|
+
maintainers = ['infra@nebula.io', 'platform@nebula.io', 'secops@nebula.io']
|
|
226
|
+
|
|
227
|
+
^^ Features
|
|
228
|
+
enableSearch = false
|
|
229
|
+
enablePayments = false
|
|
230
|
+
enableAnalytics = true
|
|
231
|
+
experimental = ['vector-engine', 'adaptive-ui', 'ai-routing']
|
|
232
|
+
|
|
233
|
+
^^ Limits
|
|
234
|
+
maxUsers = 120000
|
|
235
|
+
requestTimeoutMs = 7200
|
|
236
|
+
retryPolicy = {
|
|
237
|
+
maxRetries: 9,
|
|
238
|
+
backoff: 'fibonacci',
|
|
239
|
+
retryOn: ['timeout', '5xx', 'throttle'],
|
|
240
|
+
schedule: [
|
|
241
|
+
{ attempt: 1, delayMs: 80 },
|
|
242
|
+
{ attempt: 2, delayMs: 160 },
|
|
243
|
+
{ attempt: 3, delayMs: 320 },
|
|
244
|
+
{ attempt: 4, delayMs: 640 },
|
|
245
|
+
{ attempt: 5, delayMs: 1280 }
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
^^ Database
|
|
250
|
+
engine = 'cockroachdb'
|
|
251
|
+
host = 'cluster.db.nebula.io'
|
|
252
|
+
port = 26257
|
|
253
|
+
ssl = true
|
|
254
|
+
pool = {
|
|
255
|
+
min: 12,
|
|
256
|
+
max: 120,
|
|
257
|
+
warmup: {
|
|
258
|
+
enabled: true,
|
|
259
|
+
strategy: 'aggressive',
|
|
260
|
+
steps: [10, 25, 50, 75, 100],
|
|
261
|
+
healthChecks: [
|
|
262
|
+
{ name: 'connectivity', timeoutMs: 300 },
|
|
263
|
+
{ name: 'replication', maxLagMs: 200 },
|
|
264
|
+
{ name: 'quorum', minNodes: 3 }
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
^^^ Credentials
|
|
270
|
+
username = 'nebula_app'
|
|
271
|
+
password = '****'
|
|
272
|
+
rotateEveryDays = 45
|
|
273
|
+
history = [
|
|
274
|
+
{ rotatedAt: '2025-05-10', reason: 'scheduled' },
|
|
275
|
+
{ rotatedAt: '2025-03-02', reason: 'key-compromise' },
|
|
276
|
+
{ rotatedAt: '2024-12-15', reason: 'policy-change' }
|
|
277
|
+
]
|
|
278
|
+
|
|
279
|
+
^^ API
|
|
280
|
+
baseUrl = 'https://api.nebula.io'
|
|
281
|
+
publicEndpoints = ['/health', '/status', '/version']
|
|
282
|
+
internalEndpoints = ['/admin', '/metrics', '/orchestrator', '/scheduler']
|
|
283
|
+
|
|
284
|
+
^^^ Auth
|
|
285
|
+
provider = 'oidc'
|
|
286
|
+
tokenTTLSeconds = 5400
|
|
287
|
+
scopes = ['read', 'write', 'deploy', 'audit']
|
|
288
|
+
|
|
289
|
+
^^^^ Clients
|
|
290
|
+
web = {
|
|
291
|
+
clientId: 'nebula-web-prod',
|
|
292
|
+
redirectUri: 'https://nebula.io/auth/callback',
|
|
293
|
+
allowedOrigins: ['https://nebula.io', 'https://console.nebula.io'],
|
|
294
|
+
secrets: [
|
|
295
|
+
{ id: 'alpha', value: 'QX7faP9', active: true },
|
|
296
|
+
{ id: 'beta', value: 'LM8KdW2', active: true },
|
|
297
|
+
{ id: 'legacy', value: 'OLD-KEY-DO-NOT-USE', active: false }
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
mobile = {
|
|
302
|
+
clientId: 'nebula-mobile',
|
|
303
|
+
redirectUri: 'nebula://auth',
|
|
304
|
+
platforms: [
|
|
305
|
+
{ name: 'ios', minVersion: '15.2', enabled: true },
|
|
306
|
+
{ name: 'android', minVersion: '11', enabled: true },
|
|
307
|
+
{ name: 'harmonyos', minVersion: '4', enabled: false }
|
|
308
|
+
],
|
|
309
|
+
refreshPolicy: {
|
|
310
|
+
enabled: true,
|
|
311
|
+
limits: { perHour: 60, perDay: 600 },
|
|
312
|
+
audit: [
|
|
313
|
+
{ event: 'refresh', severity: 'info' },
|
|
314
|
+
{ event: 'suspicious-location', severity: 'warning' },
|
|
315
|
+
{ event: 'credential-stuffing', severity: 'critical' }
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
^ Logging
|
|
321
|
+
level = 'debug'
|
|
322
|
+
format = 'ndjson'
|
|
323
|
+
outputs = ['stdout', 'file', 'syslog']
|
|
324
|
+
|
|
325
|
+
^^ File
|
|
326
|
+
path = '/srv/log/nebula/nebula.log'
|
|
327
|
+
maxSizeMB = 250
|
|
328
|
+
rotate = true
|
|
329
|
+
keepFiles = 30
|
|
330
|
+
|
|
331
|
+
^^ Metrics
|
|
332
|
+
enabled = true
|
|
333
|
+
endpoint = '/internal/metrics'
|
|
334
|
+
sampleRate = 0.75
|
|
335
|
+
|
|
336
|
+
^ Services
|
|
337
|
+
enabled = true
|
|
338
|
+
|
|
339
|
+
^^ Email
|
|
340
|
+
provider = 'ses'
|
|
341
|
+
host = 'email.nebula.io'
|
|
342
|
+
port = 465
|
|
343
|
+
secure = true
|
|
344
|
+
from = 'system@nebula.io'
|
|
345
|
+
|
|
346
|
+
^^^ Credentials
|
|
347
|
+
user = 'mailer-nebula'
|
|
348
|
+
pass = 'MAIL-SEC-9921'
|
|
349
|
+
|
|
350
|
+
^^ Cache
|
|
351
|
+
type = 'keydb'
|
|
352
|
+
host = 'cache.nebula.internal'
|
|
353
|
+
port = 6380
|
|
354
|
+
ttlSeconds = 1800
|
|
355
|
+
|
|
356
|
+
^^^ Cluster
|
|
357
|
+
nodes = [
|
|
358
|
+
{ host: 'cache-a.nebula', port: 6380, role: 'primary', zones: ['eu-north-1a'] },
|
|
359
|
+
{ host: 'cache-b.nebula', port: 6380, role: 'replica', zones: ['eu-north-1b'] },
|
|
360
|
+
{ host: 'cache-c.nebula', port: 6380, role: 'replica', zones: ['eu-north-1c'] },
|
|
361
|
+
{ host: 'cache-d.nebula', port: 6380, role: 'observer', zones: ['eu-north-1a'] }
|
|
362
|
+
]
|
|
363
|
+
|
|
364
|
+
^^^ Failover
|
|
365
|
+
strategy = {
|
|
366
|
+
mode: 'predictive',
|
|
367
|
+
thresholds: { errorRate: 0.08, latencyMs: 180 },
|
|
368
|
+
actions: [
|
|
369
|
+
{ step: 'drain-traffic', timeoutMs: 1500 },
|
|
370
|
+
{ step: 'promote-replica', timeoutMs: 2000 },
|
|
371
|
+
{ step: 'resync', propagate: true },
|
|
372
|
+
{ step: 'notify', channels: ['pagerduty', 'slack', 'email'] }
|
|
373
|
+
]
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
^ Observability
|
|
377
|
+
tracing = true
|
|
378
|
+
tracingProvider = 'tempo'
|
|
379
|
+
traceSampleRate = 0.35
|
|
380
|
+
|
|
381
|
+
^^ Exporters
|
|
382
|
+
jaeger = {
|
|
383
|
+
enabled: false,
|
|
384
|
+
endpoint: 'http://jaeger.internal/api/traces',
|
|
385
|
+
tags: {
|
|
386
|
+
region: 'eu-north',
|
|
387
|
+
environment: 'staging',
|
|
388
|
+
build: { version: '5.0.0-rc.4', commit: 'c8f91d2', dirty: true }
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
prometheus = {
|
|
393
|
+
enabled: true,
|
|
394
|
+
endpoint: 'http://prometheus.nebula:9090',
|
|
395
|
+
scrapeIntervals: [2, 5, 10, 30],
|
|
396
|
+
retention: { days: 90, maxSeries: 3500000 }
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
^ Security
|
|
400
|
+
allowedIPs = ['172.16.0.0/12', '100.64.0.0/10']
|
|
401
|
+
blockedCountries = ['KP', 'NG', 'BY']
|
|
402
|
+
|
|
403
|
+
^^ Policies
|
|
404
|
+
passwordMinLength = 18
|
|
405
|
+
require2FA = true
|
|
406
|
+
sessionTTLMinutes = 45
|
|
407
|
+
|
|
408
|
+
^^^ Lockout
|
|
409
|
+
maxAttempts = 4
|
|
410
|
+
lockoutMinutes = 60
|
|
411
|
+
escalation = {
|
|
412
|
+
enabled: true,
|
|
413
|
+
notify: ['security@nebula.io', 'ciso@nebula.io'],
|
|
414
|
+
rules: [
|
|
415
|
+
{ attempts: 3, action: 'captcha' },
|
|
416
|
+
{ attempts: 4, action: 'temporary-block', minutes: 120 },
|
|
417
|
+
{ attempts: 6, action: 'account-freeze' },
|
|
418
|
+
{ attempts: 9, action: 'permanent-block' }
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
`;
|
|
422
|
+
//# sourceMappingURL=valid-inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valid-inputs.js","sourceRoot":"","sources":["../../../src/dev/quick-test-samples/valid-inputs.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAE7C;;;;;;;GAOG;AAEU,QAAA,gBAAgB,GAAG;;;CAG/B,CAAA;AAEY,QAAA,gBAAgB,GAAG;;;;;;;;;;CAU/B,CAAA;AAEY,QAAA,sBAAsB,GAAG;;;;;;;;;;CAUrC,CAAA;AAED;;GAEG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;CAWlC,CAAA;AAED;;GAEG;AACU,QAAA,kBAAkB,GAAG;;;;;;;;;;;CAWjC,CAAA;AAED;;;;;;;;;;;;GAYG;AACU,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHrC,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACU,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgNrC,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,eAAe;;;;;;AAEf;;;;;;;;;;;;;EAaE;AAEF,kDAAyB;AAEzB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wFAAwF;AACxF,kBAAe,cAAI,CAAA,CAAC,sBAAsB;AAE7B,QAAA,KAAK,GAAG,cAAI,CAAC,KAAK,CAAA;AAClB,QAAA,SAAS,GAAG,cAAI,CAAC,SAAS,CAAA;AAC1B,QAAA,UAAU,GAAG,cAAI,CAAC,UAAU,CAAA;AAC5B,QAAA,UAAU,GAAG,cAAI,CAAC,UAAU,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export interface PrimaryUserParams extends BasicOptions {
|
|
|
60
60
|
* @param options.failLevel - Preferred bail sensitivity level, controls if and when parsing should stop on problems:
|
|
61
61
|
* Accepts:
|
|
62
62
|
* `'ignore-errors'` - Continue despite errors, persist and try to recover.
|
|
63
|
-
* `'errors'` - Stop parsing on the first error.
|
|
63
|
+
* `'errors'` - Stop parsing on the first error (fail-fast).
|
|
64
64
|
* `'warnings-and-errors'` - Stop parsing on the first warning or error.
|
|
65
65
|
* (Type: TPreferredFailLevel; exact behavior is implementation-defined.)
|
|
66
66
|
* @param options.includeDiagnostics - Include diagnostics in the returned metadata.
|
package/dist/utils/string.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
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
|
+
export declare const toColRow: (size: number, label: string, value: string) => string;
|
|
5
6
|
/**
|
|
6
7
|
* Capitalizes the first character of a string.
|
|
7
8
|
*
|
|
@@ -65,3 +66,4 @@ export declare const toLowerSnakeCase: (txt: string) => string;
|
|
|
65
66
|
* Replaces all '_' to '-', and returns rusult in lower case.
|
|
66
67
|
*/
|
|
67
68
|
export declare const toLowerKebabCase: (txt: string) => string;
|
|
69
|
+
export declare const removeSuffix: (str: string, suffix: string) => string;
|
package/dist/utils/string.js
CHANGED
|
@@ -4,9 +4,13 @@
|
|
|
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.toLowerKebabCase = exports.toLowerSnakeCase = exports.stripNLAndAfter = exports.isDigit = exports.isAlpha = exports.isEnclosedInBackticks = exports.trimBackticks = exports.trimTrailingNonLetters = exports.splitLines = exports.computeSha256 = exports.capitalizeFirst = void 0;
|
|
7
|
+
exports.removeSuffix = exports.toLowerKebabCase = exports.toLowerSnakeCase = exports.stripNLAndAfter = exports.isDigit = exports.isAlpha = exports.isEnclosedInBackticks = exports.trimBackticks = exports.trimTrailingNonLetters = exports.splitLines = exports.computeSha256 = exports.capitalizeFirst = exports.toColRow = void 0;
|
|
8
8
|
const crypto_1 = require("crypto");
|
|
9
9
|
const print_1 = require("./print");
|
|
10
|
+
const toColRow = (size, label, value) => {
|
|
11
|
+
return `${label.padEnd(size)} ${value}`;
|
|
12
|
+
};
|
|
13
|
+
exports.toColRow = toColRow;
|
|
10
14
|
// export const stripBOM = (input: string): string => {
|
|
11
15
|
// // (!) NOTE: slice(1) only because UTF-8 BOM appears as one single Unicode code characte, even though it is 3 bytes (EF BB BF) on disk.
|
|
12
16
|
// return input.startsWith('\uFEFF') ? input.slice(1) : input
|
|
@@ -142,4 +146,11 @@ const toLowerKebabCase = (txt) => {
|
|
|
142
146
|
return txt.trim().toLowerCase().replace(/[_]/g, '-');
|
|
143
147
|
};
|
|
144
148
|
exports.toLowerKebabCase = toLowerKebabCase;
|
|
149
|
+
const removeSuffix = (str, suffix) => {
|
|
150
|
+
if (str.endsWith(suffix)) {
|
|
151
|
+
return str.slice(0, -suffix.length);
|
|
152
|
+
}
|
|
153
|
+
return str;
|
|
154
|
+
};
|
|
155
|
+
exports.removeSuffix = removeSuffix;
|
|
145
156
|
//# sourceMappingURL=string.js.map
|
package/dist/utils/string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mCAAmC;AACnC,mCAAoC;
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mCAAmC;AACnC,mCAAoC;AAE7B,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,KAAa,EAAE,EAAE;IACnE,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAA;AAC3C,CAAC,CAAA;AAFY,QAAA,QAAQ,YAEpB;AAED,uDAAuD;AACvD,8IAA8I;AAC9I,iEAAiE;AACjE,IAAI;AAEJ;;;;;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,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AC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IAEnE,IAAA,kBAAU,EAAC,sCAAsC,GAAG,IAAI,GAAG,KAAK,CAAC,CAAA;IACjE,IAAA,kBAAU,EAAC,sCAAsC,GAAG,UAAU,GAAG,KAAK,CAAC,CAAA;IACvE,OAAO,UAAU,CAAA;AACrB,CAAC,CAAA;AAhBY,QAAA,eAAe,mBAgB3B;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;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;AAEM,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,MAAc,EAAU,EAAE;IAChE,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACvC,CAAC;IACD,OAAO,GAAG,CAAA;AACd,CAAC,CAAA;AALY,QAAA,YAAY,gBAKxB"}
|
package/examples/nested.yini
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yini-parser",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "Node.js parser for YINI config format —
|
|
3
|
+
"version": "1.3.3-beta",
|
|
4
|
+
"description": "Readable configuration without YAML foot-guns or JSON noise. The official Node.js parser for YINI config format — An INI-inspired configuration format with clear nesting, explicit types, and predictable parsing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yini",
|
|
7
7
|
"yini-parser",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"nodejs",
|
|
20
20
|
"javascript"
|
|
21
21
|
],
|
|
22
|
-
"homepage": "https://
|
|
22
|
+
"homepage": "https://yini-lang.org/",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"files": [
|
|
25
25
|
"dist/",
|