@karmaniverous/get-dotenv 6.2.4 → 6.3.0
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/README.md +1 -0
- package/dist/chunks/{AwsRestJsonProtocol-Bq1HE-Ln.mjs → AwsRestJsonProtocol-Dv5q8CFK.mjs} +2 -2
- package/dist/chunks/{createCli-BY6_cfZr.mjs → createCli-BSn6Be40.mjs} +6 -5
- package/dist/chunks/{externalDataInterceptor-CbsdEYa-.mjs → externalDataInterceptor-pqHO-Qmn.mjs} +2 -2
- package/dist/chunks/{getSSOTokenFromFile-hUSpR7Wf.mjs → getSSOTokenFromFile-otmZHSRV.mjs} +1 -1
- package/dist/chunks/{index-BpCF5UKx.mjs → index-B18W-ELX.mjs} +5 -4
- package/dist/chunks/{index-CeCufHlm.mjs → index-BNcKuiBy.mjs} +11 -10
- package/dist/chunks/{index-DyU5pKKi.mjs → index-Bi0RIILn.mjs} +5 -4
- package/dist/chunks/{index-Bc3h0a95.mjs → index-BqZ3PB6c.mjs} +6 -5
- package/dist/chunks/{index-Dp1Ip6Ra.mjs → index-C4Ac6feq.mjs} +10 -9
- package/dist/chunks/{index-cIunyiUQ.mjs → index-C6uLiKpC.mjs} +5 -4
- package/dist/chunks/{index-C_wqbTwI.mjs → index-CGg5wWCm.mjs} +6 -5
- package/dist/chunks/{index-c7zKtEuy.mjs → index-CXpZ0pei.mjs} +7 -6
- package/dist/chunks/{index-Cu7rdyqN.mjs → index-CYoFYXZv.mjs} +8 -7
- package/dist/chunks/{index-B5JKTBOL.mjs → index-DFNcs3pR.mjs} +7 -6
- package/dist/chunks/{index-BPYF6K_G.mjs → index-DLQEHTw4.mjs} +8 -7
- package/dist/chunks/{index-DWAtHEA-.mjs → index-DtRaL61T.mjs} +5 -4
- package/dist/chunks/{index-BEJFiHMX.mjs → index-eZMlmESW.mjs} +14 -14
- package/dist/chunks/{loadSso-w1eTVg0O.mjs → loadSso-CJ_XUhEj.mjs} +7 -6
- package/dist/chunks/{loader-DnhPeGfq.mjs → loader-CePOf74i.mjs} +1 -0
- package/dist/chunks/{overlayEnv-Bs2kVayG.mjs → overlayEnv-Bqh_kPGA.mjs} +2 -1
- package/dist/chunks/{parseKnownFiles-B9cDK21V.mjs → parseKnownFiles-B6x1cUmR.mjs} +1 -1
- package/dist/chunks/{readMergedOptions-Nt0TR7dX.mjs → readMergedOptions-DLBDzpXX.mjs} +5 -4
- package/dist/chunks/{resolveCliOptions-TFRzhB2c.mjs → resolveCliOptions-_qtsVxda.mjs} +2 -1
- package/dist/chunks/{sdk-stream-mixin-BZoJ5jy9.mjs → sdk-stream-mixin-DCdC70Up.mjs} +1 -1
- package/dist/chunks/{spawnEnv-CN8a7cNR.mjs → spawnEnv-CQwFu7ZJ.mjs} +2 -1
- package/dist/chunks/{types-DJ-BGABd.mjs → types-DdqcXCV1.mjs} +1 -1
- package/dist/cli.mjs +9 -9
- package/dist/cliHost.mjs +7 -6
- package/dist/config.mjs +2 -1
- package/dist/env-overlay.mjs +2 -1
- package/dist/getdotenv.cli.mjs +9 -9
- package/dist/index.d.ts +485 -2
- package/dist/index.mjs +703 -11
- package/dist/plugins-aws.mjs +5 -4
- package/dist/plugins-batch.mjs +5 -4
- package/dist/plugins-cmd.mjs +7 -6
- package/dist/plugins-init.mjs +4 -4
- package/dist/plugins.mjs +8 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1170,6 +1170,489 @@ declare function dotenvExpandAll<T extends Record<string, string | undefined> |
|
|
|
1170
1170
|
*/
|
|
1171
1171
|
declare const dotenvExpandFromProcessEnv: (value: string | undefined) => string | undefined;
|
|
1172
1172
|
|
|
1173
|
+
/**
|
|
1174
|
+
* Dotenv editor types (format-preserving).
|
|
1175
|
+
*
|
|
1176
|
+
* Requirements addressed:
|
|
1177
|
+
* - Provide a format-preserving dotenv edit surface (pure text pipeline + FS adapter).
|
|
1178
|
+
* - Preserve comments/blank lines/unknown lines and separator spacing; support merge vs sync.
|
|
1179
|
+
* - Deterministic target selection across getdotenv `paths` with optional template bootstrap.
|
|
1180
|
+
*
|
|
1181
|
+
* Notes:
|
|
1182
|
+
* - The parser intentionally preserves unknown lines verbatim rather than rejecting them.
|
|
1183
|
+
* - The editor focuses on `.env`-style KEY=VALUE lines; anything not recognized is preserved as raw text.
|
|
1184
|
+
*
|
|
1185
|
+
* @packageDocumentation
|
|
1186
|
+
*/
|
|
1187
|
+
/**
|
|
1188
|
+
* EOL policy for rendering a dotenv document.
|
|
1189
|
+
*
|
|
1190
|
+
* - `preserve`: preserve existing EOLs when possible; inserted line breaks use the detected file EOL.
|
|
1191
|
+
* - `lf`: normalize all line breaks to `\n`.
|
|
1192
|
+
* - `crlf`: normalize all line breaks to `\r\n`.
|
|
1193
|
+
*
|
|
1194
|
+
* @public
|
|
1195
|
+
*/
|
|
1196
|
+
type DotenvEolMode = 'preserve' | 'lf' | 'crlf';
|
|
1197
|
+
/**
|
|
1198
|
+
* Editing mode for dotenv updates.
|
|
1199
|
+
*
|
|
1200
|
+
* - `merge` (default): update/add only the provided keys; do not delete unrelated keys.
|
|
1201
|
+
* - `sync`: delete assignment/bare-key lines for keys not present in the update map.
|
|
1202
|
+
*
|
|
1203
|
+
* @public
|
|
1204
|
+
*/
|
|
1205
|
+
type DotenvEditMode = 'merge' | 'sync';
|
|
1206
|
+
/**
|
|
1207
|
+
* Strategy for handling duplicate key occurrences.
|
|
1208
|
+
*
|
|
1209
|
+
* - `all` (default): update/delete all occurrences.
|
|
1210
|
+
* - `first`: update/delete only the first occurrence.
|
|
1211
|
+
* - `last`: update/delete only the last occurrence.
|
|
1212
|
+
*
|
|
1213
|
+
* @public
|
|
1214
|
+
*/
|
|
1215
|
+
type DotenvDuplicateKeyStrategy = 'all' | 'first' | 'last';
|
|
1216
|
+
/**
|
|
1217
|
+
* Behavior when an update map contains a key with value `undefined`.
|
|
1218
|
+
*
|
|
1219
|
+
* - `skip` (default): do not modify existing occurrences; do not add a new key.
|
|
1220
|
+
*
|
|
1221
|
+
* @public
|
|
1222
|
+
*/
|
|
1223
|
+
type DotenvUndefinedBehavior = 'skip';
|
|
1224
|
+
/**
|
|
1225
|
+
* Behavior when an update map contains a key with value `null`.
|
|
1226
|
+
*
|
|
1227
|
+
* - `delete` (default): delete matching assignment/bare-key lines (subject to duplicate strategy).
|
|
1228
|
+
*
|
|
1229
|
+
* @public
|
|
1230
|
+
*/
|
|
1231
|
+
type DotenvNullBehavior = 'delete';
|
|
1232
|
+
/**
|
|
1233
|
+
* Update-map value types supported by the editor.
|
|
1234
|
+
*
|
|
1235
|
+
* Notes:
|
|
1236
|
+
* - Objects/arrays are stringified with `JSON.stringify` before writing.
|
|
1237
|
+
* - `null` deletes (by default).
|
|
1238
|
+
* - `undefined` skips (by default).
|
|
1239
|
+
*
|
|
1240
|
+
* @public
|
|
1241
|
+
*/
|
|
1242
|
+
type DotenvUpdateValue = string | number | boolean | null | undefined | Record<string, unknown> | Array<unknown>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Update map keyed by dotenv variable name.
|
|
1245
|
+
*
|
|
1246
|
+
* @public
|
|
1247
|
+
*/
|
|
1248
|
+
type DotenvUpdateMap = Record<string, DotenvUpdateValue>;
|
|
1249
|
+
/**
|
|
1250
|
+
* Options for editing a dotenv document in memory.
|
|
1251
|
+
*
|
|
1252
|
+
* @public
|
|
1253
|
+
*/
|
|
1254
|
+
interface DotenvEditOptions {
|
|
1255
|
+
/**
|
|
1256
|
+
* Editing mode (`merge` vs `sync`).
|
|
1257
|
+
*
|
|
1258
|
+
* @defaultValue `'merge'`
|
|
1259
|
+
*/
|
|
1260
|
+
mode?: DotenvEditMode;
|
|
1261
|
+
/**
|
|
1262
|
+
* Duplicate key handling strategy.
|
|
1263
|
+
*
|
|
1264
|
+
* @defaultValue `'all'`
|
|
1265
|
+
*/
|
|
1266
|
+
duplicateKeys?: DotenvDuplicateKeyStrategy;
|
|
1267
|
+
/**
|
|
1268
|
+
* `undefined` behavior.
|
|
1269
|
+
*
|
|
1270
|
+
* @defaultValue `'skip'`
|
|
1271
|
+
*/
|
|
1272
|
+
undefinedBehavior?: DotenvUndefinedBehavior;
|
|
1273
|
+
/**
|
|
1274
|
+
* `null` behavior.
|
|
1275
|
+
*
|
|
1276
|
+
* @defaultValue `'delete'`
|
|
1277
|
+
*/
|
|
1278
|
+
nullBehavior?: DotenvNullBehavior;
|
|
1279
|
+
/**
|
|
1280
|
+
* EOL normalization policy.
|
|
1281
|
+
*
|
|
1282
|
+
* @defaultValue `'preserve'`
|
|
1283
|
+
*/
|
|
1284
|
+
eol?: DotenvEolMode;
|
|
1285
|
+
/**
|
|
1286
|
+
* Separator to use when converting a bare-key placeholder into an assignment.
|
|
1287
|
+
*
|
|
1288
|
+
* @defaultValue `'='`
|
|
1289
|
+
*/
|
|
1290
|
+
defaultSeparator?: string;
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* A raw, unrecognized segment of a dotenv file. Preserved verbatim.
|
|
1294
|
+
*
|
|
1295
|
+
* @public
|
|
1296
|
+
*/
|
|
1297
|
+
interface DotenvRawSegment {
|
|
1298
|
+
/**
|
|
1299
|
+
* Segment kind.
|
|
1300
|
+
*/
|
|
1301
|
+
kind: 'raw';
|
|
1302
|
+
/**
|
|
1303
|
+
* Raw text (including any EOL tokens) preserved verbatim.
|
|
1304
|
+
*/
|
|
1305
|
+
raw: string;
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Common fields for key-bearing segments (assignment or bare-key placeholder).
|
|
1309
|
+
*
|
|
1310
|
+
* @public
|
|
1311
|
+
*/
|
|
1312
|
+
interface DotenvKeySegmentBase {
|
|
1313
|
+
/**
|
|
1314
|
+
* Raw text for the segment, including EOL tokens.
|
|
1315
|
+
*/
|
|
1316
|
+
raw: string;
|
|
1317
|
+
/**
|
|
1318
|
+
* The parsed key name (e.g., `APP_SETTING`).
|
|
1319
|
+
*/
|
|
1320
|
+
key: string;
|
|
1321
|
+
/**
|
|
1322
|
+
* Prefix before the key (indentation and optional `export` token).
|
|
1323
|
+
* Preserved verbatim.
|
|
1324
|
+
*/
|
|
1325
|
+
prefix: string;
|
|
1326
|
+
/**
|
|
1327
|
+
* Trailing EOL token for the last physical line of this segment.
|
|
1328
|
+
* For segments that end at EOF without a trailing newline, this is `''`.
|
|
1329
|
+
*/
|
|
1330
|
+
eol: '' | '\n' | '\r\n';
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* A KEY=VALUE assignment segment.
|
|
1334
|
+
*
|
|
1335
|
+
* Supports single-line and multi-line quoted values (double/single quotes).
|
|
1336
|
+
*
|
|
1337
|
+
* @public
|
|
1338
|
+
*/
|
|
1339
|
+
interface DotenvAssignmentSegment extends DotenvKeySegmentBase {
|
|
1340
|
+
/**
|
|
1341
|
+
* Segment kind.
|
|
1342
|
+
*/
|
|
1343
|
+
kind: 'assignment';
|
|
1344
|
+
/**
|
|
1345
|
+
* Separator including surrounding whitespace (e.g., `" = "` or `"="`).
|
|
1346
|
+
*/
|
|
1347
|
+
separator: string;
|
|
1348
|
+
/**
|
|
1349
|
+
* Whitespace between separator and the start of the value token (preserved).
|
|
1350
|
+
*/
|
|
1351
|
+
valuePadding: string;
|
|
1352
|
+
/**
|
|
1353
|
+
* Quote style when the value was quoted in the source.
|
|
1354
|
+
*/
|
|
1355
|
+
quote: '"' | "'" | null;
|
|
1356
|
+
/**
|
|
1357
|
+
* Value content (without surrounding quotes).
|
|
1358
|
+
*
|
|
1359
|
+
* Note: multiline values use `\n` internally regardless of file EOL.
|
|
1360
|
+
*/
|
|
1361
|
+
value: string;
|
|
1362
|
+
/**
|
|
1363
|
+
* Suffix after the value token on the closing line (typically inline comment + spaces).
|
|
1364
|
+
* Preserved verbatim.
|
|
1365
|
+
*/
|
|
1366
|
+
suffix: string;
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* A bare-key placeholder segment (e.g., `KEY` or `KEY # comment`).
|
|
1370
|
+
*
|
|
1371
|
+
* @public
|
|
1372
|
+
*/
|
|
1373
|
+
interface DotenvBareKeySegment extends DotenvKeySegmentBase {
|
|
1374
|
+
/**
|
|
1375
|
+
* Segment kind.
|
|
1376
|
+
*/
|
|
1377
|
+
kind: 'bare';
|
|
1378
|
+
/**
|
|
1379
|
+
* Trailing text after the key (spaces and/or inline comment).
|
|
1380
|
+
* Preserved verbatim.
|
|
1381
|
+
*/
|
|
1382
|
+
suffix: string;
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* A parsed dotenv segment.
|
|
1386
|
+
*
|
|
1387
|
+
* @public
|
|
1388
|
+
*/
|
|
1389
|
+
type DotenvSegment = DotenvRawSegment | DotenvAssignmentSegment | DotenvBareKeySegment;
|
|
1390
|
+
/**
|
|
1391
|
+
* A parsed dotenv document suitable for format-preserving edits.
|
|
1392
|
+
*
|
|
1393
|
+
* @public
|
|
1394
|
+
*/
|
|
1395
|
+
interface DotenvDocument {
|
|
1396
|
+
/**
|
|
1397
|
+
* Detected file EOL (used for inserted line breaks when preserving).
|
|
1398
|
+
*/
|
|
1399
|
+
fileEol: '\n' | '\r\n';
|
|
1400
|
+
/**
|
|
1401
|
+
* Whether the original file ended with a trailing newline.
|
|
1402
|
+
*/
|
|
1403
|
+
trailingNewline: boolean;
|
|
1404
|
+
/**
|
|
1405
|
+
* Ordered segments comprising the file.
|
|
1406
|
+
*/
|
|
1407
|
+
segments: DotenvSegment[];
|
|
1408
|
+
}
|
|
1409
|
+
/**
|
|
1410
|
+
* Minimal filesystem port used by the FS-level editor adapter.
|
|
1411
|
+
*
|
|
1412
|
+
* @public
|
|
1413
|
+
*/
|
|
1414
|
+
interface DotenvFs {
|
|
1415
|
+
/**
|
|
1416
|
+
* Return true when a path exists.
|
|
1417
|
+
*
|
|
1418
|
+
* @param p - Path to check.
|
|
1419
|
+
*/
|
|
1420
|
+
pathExists(p: string): Promise<boolean>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Read a UTF-8 text file.
|
|
1423
|
+
*
|
|
1424
|
+
* @param p - Path to read.
|
|
1425
|
+
*/
|
|
1426
|
+
readFile(p: string): Promise<string>;
|
|
1427
|
+
/**
|
|
1428
|
+
* Write a UTF-8 text file.
|
|
1429
|
+
*
|
|
1430
|
+
* @param p - Path to write.
|
|
1431
|
+
* @param contents - File contents.
|
|
1432
|
+
*/
|
|
1433
|
+
writeFile(p: string, contents: string): Promise<void>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Copy a file.
|
|
1436
|
+
*
|
|
1437
|
+
* @param src - Source path.
|
|
1438
|
+
* @param dest - Destination path.
|
|
1439
|
+
*/
|
|
1440
|
+
copyFile(src: string, dest: string): Promise<void>;
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Dotenv target scope selector for FS-level editing.
|
|
1444
|
+
*
|
|
1445
|
+
* @public
|
|
1446
|
+
*/
|
|
1447
|
+
type DotenvTargetScope = 'global' | 'env';
|
|
1448
|
+
/**
|
|
1449
|
+
* Dotenv target privacy selector for FS-level editing.
|
|
1450
|
+
*
|
|
1451
|
+
* @public
|
|
1452
|
+
*/
|
|
1453
|
+
type DotenvTargetPrivacy = 'public' | 'private';
|
|
1454
|
+
/**
|
|
1455
|
+
* Path search order for selecting the first target match under `paths`.
|
|
1456
|
+
*
|
|
1457
|
+
* @public
|
|
1458
|
+
*/
|
|
1459
|
+
type DotenvPathSearchOrder = 'reverse' | 'forward';
|
|
1460
|
+
/**
|
|
1461
|
+
* Options for resolving and editing a dotenv file in a multi-path cascade.
|
|
1462
|
+
*
|
|
1463
|
+
* @public
|
|
1464
|
+
*/
|
|
1465
|
+
interface EditDotenvFileOptions extends DotenvEditOptions {
|
|
1466
|
+
/**
|
|
1467
|
+
* Search paths (directories) to locate the target dotenv file.
|
|
1468
|
+
*/
|
|
1469
|
+
paths: string[];
|
|
1470
|
+
/**
|
|
1471
|
+
* Base dotenv filename token.
|
|
1472
|
+
*
|
|
1473
|
+
* @defaultValue `'.env'`
|
|
1474
|
+
*/
|
|
1475
|
+
dotenvToken?: string;
|
|
1476
|
+
/**
|
|
1477
|
+
* Private token used for private dotenv files.
|
|
1478
|
+
*
|
|
1479
|
+
* @defaultValue `'local'`
|
|
1480
|
+
*/
|
|
1481
|
+
privateToken?: string;
|
|
1482
|
+
/**
|
|
1483
|
+
* Selected environment name (used when `scope` is `env`).
|
|
1484
|
+
*/
|
|
1485
|
+
env?: string;
|
|
1486
|
+
/**
|
|
1487
|
+
* Default environment name used when `env` is not provided.
|
|
1488
|
+
*/
|
|
1489
|
+
defaultEnv?: string;
|
|
1490
|
+
/**
|
|
1491
|
+
* Scope axis (global vs env-specific).
|
|
1492
|
+
*/
|
|
1493
|
+
scope: DotenvTargetScope;
|
|
1494
|
+
/**
|
|
1495
|
+
* Privacy axis (public vs private).
|
|
1496
|
+
*/
|
|
1497
|
+
privacy: DotenvTargetPrivacy;
|
|
1498
|
+
/**
|
|
1499
|
+
* Path search order.
|
|
1500
|
+
*
|
|
1501
|
+
* @defaultValue `'reverse'`
|
|
1502
|
+
*/
|
|
1503
|
+
searchOrder?: DotenvPathSearchOrder;
|
|
1504
|
+
/**
|
|
1505
|
+
* Template extension used for bootstrap.
|
|
1506
|
+
*
|
|
1507
|
+
* When a target does not exist anywhere under `paths`, but a template exists
|
|
1508
|
+
* (e.g. `.env.local.template`), the template will be copied to the target
|
|
1509
|
+
* path and then edited in place.
|
|
1510
|
+
*
|
|
1511
|
+
* @defaultValue `'template'`
|
|
1512
|
+
*/
|
|
1513
|
+
templateExtension?: string;
|
|
1514
|
+
/**
|
|
1515
|
+
* Optional filesystem port override (defaults to a Node FS adapter).
|
|
1516
|
+
*/
|
|
1517
|
+
fs?: DotenvFs;
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Result of a successful FS-level dotenv edit.
|
|
1521
|
+
*
|
|
1522
|
+
* @public
|
|
1523
|
+
*/
|
|
1524
|
+
interface EditDotenvFileResult {
|
|
1525
|
+
/**
|
|
1526
|
+
* Absolute path to the edited dotenv file.
|
|
1527
|
+
*/
|
|
1528
|
+
path: string;
|
|
1529
|
+
/**
|
|
1530
|
+
* Whether the file was created from a template during this operation.
|
|
1531
|
+
*/
|
|
1532
|
+
createdFromTemplate: boolean;
|
|
1533
|
+
/**
|
|
1534
|
+
* Whether the resulting file content differed from the prior content.
|
|
1535
|
+
*/
|
|
1536
|
+
changed: boolean;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Apply edits to a parsed dotenv document while preserving formatting.
|
|
1541
|
+
*
|
|
1542
|
+
* Requirements addressed:
|
|
1543
|
+
* - Mode: merge vs sync.
|
|
1544
|
+
* - Duplicate key strategy: all/first/last.
|
|
1545
|
+
* - undefined behavior: skip (default).
|
|
1546
|
+
* - null behavior: delete (default).
|
|
1547
|
+
* - Quote preservation where safe; upgrade quoting when required (multiline, whitespace safety, inline comment safety).
|
|
1548
|
+
*
|
|
1549
|
+
* @packageDocumentation
|
|
1550
|
+
*/
|
|
1551
|
+
|
|
1552
|
+
/**
|
|
1553
|
+
* Apply a set of key/value updates to a parsed dotenv document.
|
|
1554
|
+
*
|
|
1555
|
+
* @param doc - Parsed dotenv document.
|
|
1556
|
+
* @param updates - Key/value update map.
|
|
1557
|
+
* @param opts - Editing options.
|
|
1558
|
+
* @returns A new {@link DotenvDocument} with edits applied.
|
|
1559
|
+
*
|
|
1560
|
+
* @public
|
|
1561
|
+
*/
|
|
1562
|
+
declare function applyDotenvEdits(doc: DotenvDocument, updates: DotenvUpdateMap, opts?: {
|
|
1563
|
+
mode?: DotenvEditMode;
|
|
1564
|
+
duplicateKeys?: DotenvDuplicateKeyStrategy;
|
|
1565
|
+
undefinedBehavior?: DotenvUndefinedBehavior;
|
|
1566
|
+
nullBehavior?: DotenvNullBehavior;
|
|
1567
|
+
defaultSeparator?: string;
|
|
1568
|
+
}): DotenvDocument;
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* FS-level dotenv editor adapter (target resolution + template bootstrap).
|
|
1572
|
+
*
|
|
1573
|
+
* Requirements addressed:
|
|
1574
|
+
* - Deterministic target selection across getdotenv `paths` only.
|
|
1575
|
+
* - Scope axis (global|env) × privacy axis (public|private).
|
|
1576
|
+
* - Template bootstrap: copy `<target>.<templateExtension>` to `<target>` when needed.
|
|
1577
|
+
* - Edit in place while preserving formatting via the pure text editor.
|
|
1578
|
+
*
|
|
1579
|
+
* @packageDocumentation
|
|
1580
|
+
*/
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Edit a dotenv file selected by scope/privacy across a list of search paths.
|
|
1584
|
+
*
|
|
1585
|
+
* @param updates - Update map of keys to values.
|
|
1586
|
+
* @param options - Target selection options + edit options.
|
|
1587
|
+
* @returns An {@link EditDotenvFileResult}.
|
|
1588
|
+
*
|
|
1589
|
+
* @public
|
|
1590
|
+
*/
|
|
1591
|
+
declare function editDotenvFile(updates: DotenvUpdateMap, options: EditDotenvFileOptions): Promise<EditDotenvFileResult>;
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* High-level convenience API for editing dotenv text in memory.
|
|
1595
|
+
*
|
|
1596
|
+
* Requirements addressed:
|
|
1597
|
+
* - Pure/text layer: parse → apply edits → render (no FS).
|
|
1598
|
+
*
|
|
1599
|
+
* @packageDocumentation
|
|
1600
|
+
*/
|
|
1601
|
+
|
|
1602
|
+
/**
|
|
1603
|
+
* Edit dotenv text with format preservation.
|
|
1604
|
+
*
|
|
1605
|
+
* @param text - Existing dotenv text.
|
|
1606
|
+
* @param updates - Update map of keys to values.
|
|
1607
|
+
* @param options - Edit options (merge vs sync, duplicates, null/undefined behavior, EOL policy).
|
|
1608
|
+
* @returns Updated dotenv text.
|
|
1609
|
+
*
|
|
1610
|
+
* @public
|
|
1611
|
+
*/
|
|
1612
|
+
declare function editDotenvText(text: string, updates: DotenvUpdateMap, options?: DotenvEditOptions): string;
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Parse a dotenv file into a format-preserving document model.
|
|
1616
|
+
*
|
|
1617
|
+
* Requirements addressed:
|
|
1618
|
+
* - Preserve comments, blank lines, ordering, and unknown lines verbatim.
|
|
1619
|
+
* - Preserve separator spacing around `=`.
|
|
1620
|
+
* - Support multiline quoted values (double/single quotes) by grouping physical lines.
|
|
1621
|
+
*
|
|
1622
|
+
* @packageDocumentation
|
|
1623
|
+
*/
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* Parse dotenv text into a document model that preserves formatting.
|
|
1627
|
+
*
|
|
1628
|
+
* @param text - Dotenv file contents as UTF-8 text.
|
|
1629
|
+
* @returns A parsed {@link DotenvDocument}.
|
|
1630
|
+
*
|
|
1631
|
+
* @public
|
|
1632
|
+
*/
|
|
1633
|
+
declare function parseDotenvDocument(text: string): DotenvDocument;
|
|
1634
|
+
|
|
1635
|
+
/**
|
|
1636
|
+
* Render a parsed dotenv document back to text.
|
|
1637
|
+
*
|
|
1638
|
+
* Requirements addressed:
|
|
1639
|
+
* - Preserve existing EOLs by default; support forcing LF/CRLF.
|
|
1640
|
+
* - Preserve trailing newline presence/absence.
|
|
1641
|
+
*
|
|
1642
|
+
* @packageDocumentation
|
|
1643
|
+
*/
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* Render a {@link DotenvDocument} to text.
|
|
1647
|
+
*
|
|
1648
|
+
* @param doc - Document to render.
|
|
1649
|
+
* @param eolMode - EOL policy (`preserve` | `lf` | `crlf`).
|
|
1650
|
+
* @returns Rendered dotenv text.
|
|
1651
|
+
*
|
|
1652
|
+
* @public
|
|
1653
|
+
*/
|
|
1654
|
+
declare function renderDotenvDocument(doc: DotenvDocument, eolMode?: DotenvEolMode): string;
|
|
1655
|
+
|
|
1173
1656
|
/**
|
|
1174
1657
|
* Deep interpolation utility for string leaves.
|
|
1175
1658
|
* - Expands string values using dotenv-style expansion against the provided envRef.
|
|
@@ -1192,5 +1675,5 @@ declare const dotenvExpandFromProcessEnv: (value: string | undefined) => string
|
|
|
1192
1675
|
*/
|
|
1193
1676
|
declare const interpolateDeep: <T>(value: T, envRef: ProcessEnv) => T;
|
|
1194
1677
|
|
|
1195
|
-
export { GetDotenvCli, baseRootOptionDefaults, buildSpawnEnv, createCli, defineDynamic, defineGetDotenvConfig, definePlugin, defineScripts, dotenvExpand, dotenvExpandAll, dotenvExpandFromProcessEnv, getDotenv, getDotenvCliOptions2Options, groupPlugins, interpolateDeep, maybeWarnEntropy, readMergedOptions, redactDisplay, redactObject, shouldCapture, traceChildEnv };
|
|
1196
|
-
export type { CreateCliOptions, DynamicFn, DynamicMap, EntropyOptions, GetDotenvCliOptions, GetDotenvCliPlugin, GetDotenvCliPublic, GetDotenvConfig, GetDotenvDynamic, GetDotenvOptions, InferGetDotenvVarsFromConfig, InferPluginConfig, PluginWithInstanceHelpers, ProcessEnv, RedactOptions, ScriptsTable, TraceChildEnvOptions };
|
|
1678
|
+
export { GetDotenvCli, applyDotenvEdits, baseRootOptionDefaults, buildSpawnEnv, createCli, defineDynamic, defineGetDotenvConfig, definePlugin, defineScripts, dotenvExpand, dotenvExpandAll, dotenvExpandFromProcessEnv, editDotenvFile, editDotenvText, getDotenv, getDotenvCliOptions2Options, groupPlugins, interpolateDeep, maybeWarnEntropy, parseDotenvDocument, readMergedOptions, redactDisplay, redactObject, renderDotenvDocument, shouldCapture, traceChildEnv };
|
|
1679
|
+
export type { CreateCliOptions, DotenvAssignmentSegment, DotenvBareKeySegment, DotenvDocument, DotenvDuplicateKeyStrategy, DotenvEditMode, DotenvEditOptions, DotenvEolMode, DotenvFs, DotenvPathSearchOrder, DotenvSegment, DotenvTargetPrivacy, DotenvTargetScope, DotenvUpdateMap, DotenvUpdateValue, DynamicFn, DynamicMap, EditDotenvFileOptions, EditDotenvFileResult, EntropyOptions, GetDotenvCliOptions, GetDotenvCliPlugin, GetDotenvCliPublic, GetDotenvConfig, GetDotenvDynamic, GetDotenvOptions, InferGetDotenvVarsFromConfig, InferPluginConfig, PluginWithInstanceHelpers, ProcessEnv, RedactOptions, ScriptsTable, TraceChildEnvOptions };
|