| 328 | * @since 0.6.0 |
| 329 | */ |
| 330 | export class Process extends Context.Service<Process, { |
| 331 | readonly cwd: Effect.Effect<string> |
| 332 | readonly platform: Effect.Effect<NodeJS.Platform> |
| 333 | readonly argv: Effect.Effect<Array<string>> |
| 334 | readonly env: Effect.Effect<Record<string, string>> |
| 335 | }>()("@effect/docgen/Process") { |
| 336 | static readonly layer = Layer.succeed(Process, { |
| 337 | cwd: Effect.sync(() => process.cwd()), |
| 338 | platform: Effect.sync(() => process.platform), |
| 339 | argv: Effect.sync(() => process.argv), |
| 340 | env: Effect.sync(() => { |
| 341 | const env: Record<string, string> = {} |
| 342 | for (const [key, value] of Object.entries(process.env)) { |
| 343 | if (value !== undefined) Rec.assignProperty(env, key, value) |
| 344 | } |
| 345 | return env |
| 346 | }) |
| 347 | }) |
| 348 | } |