@optique/env 1.4.0-dev.2628 → 1.4.0-dev.2631
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/dist/index.cjs +21 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -326,6 +326,11 @@ function createEnvContext(options = {}) {
|
|
|
326
326
|
* > but this env context is not, the error explicitly names the `contexts`
|
|
327
327
|
* > option to aid diagnosis.
|
|
328
328
|
*
|
|
329
|
+
* Since 1.4.0, visible documentation entries include the full environment
|
|
330
|
+
* variable name in `DocEntry.envVars`. Set `showEnvironment` on the runner
|
|
331
|
+
* or formatter to display these names without reading their values. Parsers
|
|
332
|
+
* without documentation entries, such as `fail()`, have no automatic entry.
|
|
333
|
+
*
|
|
329
334
|
* @param parser Parser that reads CLI values.
|
|
330
335
|
* @param options Environment binding options.
|
|
331
336
|
* @returns A parser with environment fallback behavior.
|
|
@@ -441,7 +446,22 @@ function bindEnv(parser, options) {
|
|
|
441
446
|
...typeof deferPromptUntilConfigResolves === "function" ? { shouldDeferCompletion: (state, exec) => deferPromptUntilConfigResolves.call(parser, state, exec) } : {},
|
|
442
447
|
getDocFragments(state, upperDefaultValue) {
|
|
443
448
|
const defaultValue = upperDefaultValue ?? options.default;
|
|
444
|
-
|
|
449
|
+
const docs = parser.getDocFragments(state, defaultValue);
|
|
450
|
+
const name = `${options.context.prefix}${options.key}`;
|
|
451
|
+
const attach = (entry) => ({
|
|
452
|
+
...entry,
|
|
453
|
+
envVars: [...new Set([name, ...entry.envVars ?? []])]
|
|
454
|
+
});
|
|
455
|
+
return {
|
|
456
|
+
...docs,
|
|
457
|
+
fragments: docs.fragments.map((fragment) => fragment.type === "entry" ? {
|
|
458
|
+
...attach(fragment),
|
|
459
|
+
type: "entry"
|
|
460
|
+
} : {
|
|
461
|
+
...fragment,
|
|
462
|
+
entries: fragment.entries.map(attach)
|
|
463
|
+
})
|
|
464
|
+
};
|
|
445
465
|
}
|
|
446
466
|
};
|
|
447
467
|
(0, __optique_core_extension.inheritOptionScope)(boundParser, parser);
|
package/dist/index.d.cts
CHANGED
|
@@ -169,6 +169,11 @@ interface BindEnvOptions<M extends Mode, TValue> {
|
|
|
169
169
|
* > but this env context is not, the error explicitly names the `contexts`
|
|
170
170
|
* > option to aid diagnosis.
|
|
171
171
|
*
|
|
172
|
+
* Since 1.4.0, visible documentation entries include the full environment
|
|
173
|
+
* variable name in `DocEntry.envVars`. Set `showEnvironment` on the runner
|
|
174
|
+
* or formatter to display these names without reading their values. Parsers
|
|
175
|
+
* without documentation entries, such as `fail()`, have no automatic entry.
|
|
176
|
+
*
|
|
172
177
|
* @param parser Parser that reads CLI values.
|
|
173
178
|
* @param options Environment binding options.
|
|
174
179
|
* @returns A parser with environment fallback behavior.
|
package/dist/index.d.ts
CHANGED
|
@@ -169,6 +169,11 @@ interface BindEnvOptions<M extends Mode, TValue> {
|
|
|
169
169
|
* > but this env context is not, the error explicitly names the `contexts`
|
|
170
170
|
* > option to aid diagnosis.
|
|
171
171
|
*
|
|
172
|
+
* Since 1.4.0, visible documentation entries include the full environment
|
|
173
|
+
* variable name in `DocEntry.envVars`. Set `showEnvironment` on the runner
|
|
174
|
+
* or formatter to display these names without reading their values. Parsers
|
|
175
|
+
* without documentation entries, such as `fail()`, have no automatic entry.
|
|
176
|
+
*
|
|
172
177
|
* @param parser Parser that reads CLI values.
|
|
173
178
|
* @param options Environment binding options.
|
|
174
179
|
* @returns A parser with environment fallback behavior.
|
package/dist/index.js
CHANGED
|
@@ -303,6 +303,11 @@ function createEnvContext(options = {}) {
|
|
|
303
303
|
* > but this env context is not, the error explicitly names the `contexts`
|
|
304
304
|
* > option to aid diagnosis.
|
|
305
305
|
*
|
|
306
|
+
* Since 1.4.0, visible documentation entries include the full environment
|
|
307
|
+
* variable name in `DocEntry.envVars`. Set `showEnvironment` on the runner
|
|
308
|
+
* or formatter to display these names without reading their values. Parsers
|
|
309
|
+
* without documentation entries, such as `fail()`, have no automatic entry.
|
|
310
|
+
*
|
|
306
311
|
* @param parser Parser that reads CLI values.
|
|
307
312
|
* @param options Environment binding options.
|
|
308
313
|
* @returns A parser with environment fallback behavior.
|
|
@@ -418,7 +423,22 @@ function bindEnv(parser, options) {
|
|
|
418
423
|
...typeof deferPromptUntilConfigResolves === "function" ? { shouldDeferCompletion: (state, exec) => deferPromptUntilConfigResolves.call(parser, state, exec) } : {},
|
|
419
424
|
getDocFragments(state, upperDefaultValue) {
|
|
420
425
|
const defaultValue = upperDefaultValue ?? options.default;
|
|
421
|
-
|
|
426
|
+
const docs = parser.getDocFragments(state, defaultValue);
|
|
427
|
+
const name = `${options.context.prefix}${options.key}`;
|
|
428
|
+
const attach = (entry) => ({
|
|
429
|
+
...entry,
|
|
430
|
+
envVars: [...new Set([name, ...entry.envVars ?? []])]
|
|
431
|
+
});
|
|
432
|
+
return {
|
|
433
|
+
...docs,
|
|
434
|
+
fragments: docs.fragments.map((fragment) => fragment.type === "entry" ? {
|
|
435
|
+
...attach(fragment),
|
|
436
|
+
type: "entry"
|
|
437
|
+
} : {
|
|
438
|
+
...fragment,
|
|
439
|
+
entries: fragment.entries.map(attach)
|
|
440
|
+
})
|
|
441
|
+
};
|
|
422
442
|
}
|
|
423
443
|
};
|
|
424
444
|
inheritOptionScope(boundParser, parser);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/env",
|
|
3
|
-
"version": "1.4.0-dev.
|
|
3
|
+
"version": "1.4.0-dev.2631",
|
|
4
4
|
"description": "Environment variable support for Optique",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
},
|
|
61
61
|
"sideEffects": false,
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@optique/core": "1.4.0-dev.
|
|
63
|
+
"@optique/core": "1.4.0-dev.2631+0f2bd6a0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@optique/config": "1.4.0-dev.
|
|
66
|
+
"@optique/config": "1.4.0-dev.2631+0f2bd6a0",
|
|
67
67
|
"@types/node": "^24.0.0",
|
|
68
68
|
"fast-check": "^4.7.0",
|
|
69
69
|
"tsdown": "^0.13.0",
|