1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _fetch = require("./fetch");
|
9 |
|
10 | /**
|
11 | * Copyright (c) Facebook, Inc. and its affiliates.
|
12 | *
|
13 | * This source code is licensed under the MIT license found in the
|
14 | * LICENSE file in the root directory of this source tree.
|
15 | *
|
16 | */
|
17 |
|
18 | /**
|
19 | * Indicates whether or not the packager is running. It returns a promise that
|
20 | * returns one of these possible values:
|
21 | * - `running`: the packager is running
|
22 | * - `not_running`: the packager nor any process is running on the expected port.
|
23 | * - `unrecognized`: one other process is running on the port we expect the packager to be running.
|
24 | */
|
25 | async function isPackagerRunning(packagerPort = process.env.RCT_METRO_PORT || '8081') {
|
26 | try {
|
27 | const {
|
28 | data
|
29 | } = await (0, _fetch.fetch)(`http://localhost:${packagerPort}/status`);
|
30 | return data === 'packager-status:running' ? 'running' : 'unrecognized';
|
31 | } catch (_error) {
|
32 | return 'not_running';
|
33 | }
|
34 | }
|
35 |
|
36 | var _default = isPackagerRunning;
|
37 | exports.default = _default;
|
38 |
|
39 | //# sourceMappingURL=isPackagerRunning.js.map |
\ | No newline at end of file |