1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 | var _fetch = require("./fetch");
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | async function isPackagerRunning(packagerPort = process.env.RCT_METRO_PORT || '8081') {
|
24 | try {
|
25 | const {
|
26 | data,
|
27 | headers
|
28 | } = await (0, _fetch.fetch)(`http://localhost:${packagerPort}/status`);
|
29 | try {
|
30 | if (data === 'packager-status:running') {
|
31 | return {
|
32 | status: 'running',
|
33 | root: headers.get('X-React-Native-Project-Root') ?? ''
|
34 | };
|
35 | }
|
36 | } catch (_error) {
|
37 | return 'unrecognized';
|
38 | }
|
39 | return 'unrecognized';
|
40 | } catch (_error) {
|
41 | return 'not_running';
|
42 | }
|
43 | }
|
44 | var _default = isPackagerRunning;
|
45 | exports.default = _default;
|
46 |
|
47 |
|
\ | No newline at end of file |