@effected/env 0.1.2 → 0.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/TerminalEnv.js +3 -3
- package/index.d.ts +9 -3
- package/package.json +2 -2
package/TerminalEnv.js
CHANGED
|
@@ -30,7 +30,7 @@ const snapshot = (options, columns) => Effect.gen(function* () {
|
|
|
30
30
|
const stdio = yield* Stdio.Stdio;
|
|
31
31
|
const stdin = yield* stdio.stdinIsTerminal;
|
|
32
32
|
const stdout = yield* stdio.stdoutIsTerminal;
|
|
33
|
-
const stderr = yield* options?.stderrIsTerminal ??
|
|
33
|
+
const stderr = yield* options?.stderrIsTerminal ?? stdio.stderrIsTerminal;
|
|
34
34
|
const env = yield* readEnv([...allKeys, "COLUMNS"]);
|
|
35
35
|
return make(env, {
|
|
36
36
|
stdin,
|
|
@@ -71,7 +71,7 @@ var TerminalEnv = class TerminalEnv extends Context.Service()("@effected/env/Ter
|
|
|
71
71
|
* Build the snapshot from `Stdio`, `Terminal` and the ambient `ConfigProvider`.
|
|
72
72
|
*
|
|
73
73
|
* @remarks
|
|
74
|
-
*
|
|
74
|
+
* Every stream's terminal check comes from `Stdio`; `options.stderrIsTerminal` replaces stderr's alone.
|
|
75
75
|
* A layer-returning function mints a fresh layer per call: call it once and bind the result to a constant.
|
|
76
76
|
*
|
|
77
77
|
* @param options - `stderrIsTerminal` overrides the stderr TTY check
|
|
@@ -128,7 +128,7 @@ var TerminalEnv = class TerminalEnv extends Context.Service()("@effected/env/Ter
|
|
|
128
128
|
* requires only `Stdio`, never `Terminal` or `TerminalEnv`, so a caller that only decides colour (a CLI's
|
|
129
129
|
* output formatter) keeps a `Stdio`-only requirement.
|
|
130
130
|
*
|
|
131
|
-
* @param _stream - the stream to decide for; only `stdout` is
|
|
131
|
+
* @param _stream - the stream to decide for; only `stdout` is offered, the stream an output formatter paints
|
|
132
132
|
*/
|
|
133
133
|
static colorLevel(_stream) {
|
|
134
134
|
return Effect.gen(function* () {
|
package/index.d.ts
CHANGED
|
@@ -335,7 +335,13 @@ interface StreamEnv {
|
|
|
335
335
|
* @public
|
|
336
336
|
*/
|
|
337
337
|
interface TerminalEnvOptions {
|
|
338
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* Overrides the stderr terminal check; omitted, `Stdio.stderrIsTerminal` answers.
|
|
340
|
+
*
|
|
341
|
+
* @remarks
|
|
342
|
+
* The platform `Stdio` layers answer from the host (`process.stderr.isTTY` on Node), and a `Stdio` built with
|
|
343
|
+
* `Stdio.make` without the field answers `false`. Pass this only for a host whose `Stdio` cannot say.
|
|
344
|
+
*/
|
|
339
345
|
readonly stderrIsTerminal?: Effect.Effect<boolean>;
|
|
340
346
|
}
|
|
341
347
|
/**
|
|
@@ -397,7 +403,7 @@ export declare class TerminalEnv extends TerminalEnv_base {
|
|
|
397
403
|
* Build the snapshot from `Stdio`, `Terminal` and the ambient `ConfigProvider`.
|
|
398
404
|
*
|
|
399
405
|
* @remarks
|
|
400
|
-
*
|
|
406
|
+
* Every stream's terminal check comes from `Stdio`; `options.stderrIsTerminal` replaces stderr's alone.
|
|
401
407
|
* A layer-returning function mints a fresh layer per call: call it once and bind the result to a constant.
|
|
402
408
|
*
|
|
403
409
|
* @param options - `stderrIsTerminal` overrides the stderr TTY check
|
|
@@ -433,7 +439,7 @@ export declare class TerminalEnv extends TerminalEnv_base {
|
|
|
433
439
|
* requires only `Stdio`, never `Terminal` or `TerminalEnv`, so a caller that only decides colour (a CLI's
|
|
434
440
|
* output formatter) keeps a `Stdio`-only requirement.
|
|
435
441
|
*
|
|
436
|
-
* @param _stream - the stream to decide for; only `stdout` is
|
|
442
|
+
* @param _stream - the stream to decide for; only `stdout` is offered, the stream an output formatter paints
|
|
437
443
|
*/
|
|
438
444
|
static colorLevel(_stream: "stdout"): Effect.Effect<ColorLevel, never, Stdio.Stdio>;
|
|
439
445
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/env",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Effect-native environment detection: agent, CI, terminal colour level, hyperlinks, columns and audience — read once through Config, swapped in tests with layerTest",
|
|
6
6
|
"keywords": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"effect": "4.0.
|
|
43
|
+
"effect": "^4.0.0"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=24.11.0"
|