UNPKG

874 BPlain TextView Raw
1/**
2 * @license
3 * Copyright 2020 Google Inc.
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7import type FS from 'fs';
8import type Path from 'path';
9
10import type {ScreenRecorder} from './node/ScreenRecorder.js';
11
12/**
13 * @internal
14 */
15export const isNode = !!(typeof process !== 'undefined' && process.version);
16
17export interface EnvironmentDependencies {
18 fs: typeof FS;
19 path?: typeof Path;
20 ScreenRecorder: typeof ScreenRecorder;
21}
22
23/**
24 * Holder for environment dependencies. These dependencies cannot
25 * be used during the module instantiation.
26 */
27export const environment: {
28 value: EnvironmentDependencies;
29} = {
30 value: {
31 get fs(): typeof FS {
32 throw new Error('fs is not available in this environment');
33 },
34 get ScreenRecorder(): typeof ScreenRecorder {
35 throw new Error('ScreenRecorder is not available in this environment');
36 },
37 },
38};