@dxos/phoenix 0.8.4-main.ef1bc66f44 → 0.8.4-main.f466a3d56e
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/LICENSE +102 -5
- package/README.md +1 -1
- package/bin/watchdog.mjs +5 -0
- package/dist/lib/node-esm/index.mjs +6 -37
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/phoenix.d.ts.map +1 -1
- package/dist/types/src/testing-utils.d.ts.map +1 -1
- package/dist/types/src/utils.d.ts.map +1 -1
- package/dist/types/src/watchdog.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -9
- package/src/phoenix.node.test.ts +6 -6
- package/src/phoenix.ts +0 -1
- package/src/watchdog.node.test.ts +0 -1
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2023 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -18,4 +18,4 @@ pnpm i @dxos/phoenix
|
|
|
18
18
|
|
|
19
19
|
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
20
20
|
|
|
21
|
-
License: [
|
|
21
|
+
License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2022 © DXOS
|
package/bin/watchdog.mjs
CHANGED
|
@@ -75,23 +75,13 @@ var Phoenix = class _Phoenix {
|
|
|
75
75
|
log.error("Monitor died unexpectedly", {
|
|
76
76
|
code,
|
|
77
77
|
signal
|
|
78
|
-
}, {
|
|
79
|
-
F: __dxlog_file,
|
|
80
|
-
L: 54,
|
|
81
|
-
S: this,
|
|
82
|
-
C: (f, a) => f(...a)
|
|
83
|
-
});
|
|
78
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 52, S: this });
|
|
84
79
|
}
|
|
85
80
|
});
|
|
86
81
|
watchDog.on("error", (err) => {
|
|
87
82
|
log.error("Monitor error", {
|
|
88
83
|
err
|
|
89
|
-
}, {
|
|
90
|
-
F: __dxlog_file,
|
|
91
|
-
L: 59,
|
|
92
|
-
S: this,
|
|
93
|
-
C: (f, a) => f(...a)
|
|
94
|
-
});
|
|
84
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 59, S: this });
|
|
95
85
|
});
|
|
96
86
|
await waitForPidFileBeingFilledWithInfo(params.pidFile);
|
|
97
87
|
watchDog.disconnect();
|
|
@@ -116,15 +106,7 @@ var Phoenix = class _Phoenix {
|
|
|
116
106
|
try {
|
|
117
107
|
process.kill(pid, signal);
|
|
118
108
|
} catch (err) {
|
|
119
|
-
invariant(err instanceof Error, "Invalid error type", {
|
|
120
|
-
F: __dxlog_file,
|
|
121
|
-
L: 87,
|
|
122
|
-
S: this,
|
|
123
|
-
A: [
|
|
124
|
-
"err instanceof Error",
|
|
125
|
-
"'Invalid error type'"
|
|
126
|
-
]
|
|
127
|
-
});
|
|
109
|
+
invariant(err instanceof Error, "Invalid error type", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 85, S: this, A: ["err instanceof Error", "'Invalid error type'"] });
|
|
128
110
|
if (err.message.includes("ESRCH") || err.name.includes("ESRCH")) {
|
|
129
111
|
unlinkSync(pidFile);
|
|
130
112
|
} else {
|
|
@@ -145,13 +127,13 @@ import { existsSync as existsSync3, unlinkSync as unlinkSync2, writeFileSync as
|
|
|
145
127
|
import { synchronized } from "@dxos/async";
|
|
146
128
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
147
129
|
import { log as log2 } from "@dxos/log";
|
|
130
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/phoenix/src/watchdog.ts";
|
|
148
131
|
function _ts_decorate(decorators, target, key, desc) {
|
|
149
132
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
150
133
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
151
134
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
152
135
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
153
136
|
}
|
|
154
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/phoenix/src/watchdog.ts";
|
|
155
137
|
var WatchDog = class {
|
|
156
138
|
_params;
|
|
157
139
|
_lock;
|
|
@@ -217,26 +199,13 @@ var WatchDog = class {
|
|
|
217
199
|
if (this._params.maxRestarts !== void 0 && this._restarts >= this._params.maxRestarts) {
|
|
218
200
|
this._err("Max restarts number is reached");
|
|
219
201
|
} else {
|
|
220
|
-
log2("Restarting...", void 0, {
|
|
221
|
-
F: __dxlog_file2,
|
|
222
|
-
L: 120,
|
|
223
|
-
S: this,
|
|
224
|
-
C: (f, a) => f(...a)
|
|
225
|
-
});
|
|
202
|
+
log2("Restarting...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 80, S: this });
|
|
226
203
|
this._restarts++;
|
|
227
204
|
await this.start();
|
|
228
205
|
}
|
|
229
206
|
}
|
|
230
207
|
async _killWithSignal(signal) {
|
|
231
|
-
invariant2(this._child?.pid, "Child process has no pid.", {
|
|
232
|
-
F: __dxlog_file2,
|
|
233
|
-
L: 127,
|
|
234
|
-
S: this,
|
|
235
|
-
A: [
|
|
236
|
-
"this._child?.pid",
|
|
237
|
-
"'Child process has no pid.'"
|
|
238
|
-
]
|
|
239
|
-
});
|
|
208
|
+
invariant2(this._child?.pid, "Child process has no pid.", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 86, S: this, A: ["this._child?.pid", "'Child process has no pid.'"] });
|
|
240
209
|
this._child.kill(signal);
|
|
241
210
|
this._child = void 0;
|
|
242
211
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/phoenix.ts", "../../../src/utils.ts", "../../../src/defs.ts", "../../../src/watchdog.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { fork } from 'node:child_process';\nimport { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,YAAY;AACrB,SAASC,cAAAA,aAAYC,WAAWC,gBAAAA,eAAcC,YAAYC,qBAAqB;AAC/E,SAASC,SAASC,YAAY;
|
|
6
|
-
"names": ["fork", "existsSync", "mkdirSync", "readFileSync", "unlinkSync", "writeFileSync", "dirname", "join", "pkgUp", "invariant", "log", "existsSync", "readFileSync", "waitForCondition", "WATCHDOG_START_TIMEOUT", "WATCHDOG_STOP_TIMEOUT", "WATCHDOG_CHECK_INTERVAL", "waitForPidDeletion", "pidFile", "waitForCondition", "condition", "existsSync", "timeout", "WATCHDOG_STOP_TIMEOUT", "interval", "WATCHDOG_CHECK_INTERVAL", "waitForPidFileBeingFilledWithInfo", "readFileSync", "encoding", "includes", "WATCHDOG_START_TIMEOUT", "error", "Error", "scriptDir", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { fork } from 'node:child_process';\nimport { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport pkgUp from 'pkg-up';\n\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport { waitForPidDeletion, waitForPidFileBeingFilledWithInfo } from './utils';\nimport { type ProcessInfo, type WatchDogProps } from './watchdog';\n\nconst scriptDir = typeof __dirname === 'string' ? __dirname : dirname(new URL(import.meta.url).pathname);\n\n/**\n * Utils to start/stop detached process with errors and logs handling.\n */\nexport class Phoenix {\n /**\n * Starts detached watchdog process which starts and monitors selected command.\n */\n static async start(params: WatchDogProps): Promise<ProcessInfo> {\n {\n // Clear stale pid file.\n if (existsSync(params.pidFile)) {\n await Phoenix.stop(params.pidFile);\n }\n\n await waitForPidDeletion(params.pidFile);\n }\n\n {\n // Create log folders.\n [params.logFile, params.errFile, params.pidFile].forEach((filename) => {\n if (!existsSync(filename)) {\n mkdirSync(dirname(filename), { recursive: true });\n writeFileSync(filename, '', { encoding: 'utf-8' });\n }\n });\n }\n\n const watchdogPath = join(dirname(pkgUp.sync({ cwd: scriptDir })!), 'bin', 'watchdog.mjs');\n\n const watchDog = fork(watchdogPath, [JSON.stringify(params)], {\n detached: true,\n });\n\n watchDog.on('exit', (code, signal) => {\n if (code && code !== 0) {\n log.error('Monitor died unexpectedly', { code, signal });\n }\n });\n\n watchDog.on('error', (err) => {\n log.error('Monitor error', { err });\n });\n\n await waitForPidFileBeingFilledWithInfo(params.pidFile);\n\n watchDog.disconnect();\n watchDog.unref();\n\n return Phoenix.info(params.pidFile);\n }\n\n /**\n * Stops detached watchdog process by PID info written down in PID file.\n */\n static async stop(pidFile: string, force = false): Promise<void> {\n if (!existsSync(pidFile)) {\n throw new Error('PID file does not exist');\n }\n const fileContent = readFileSync(pidFile, { encoding: 'utf-8' });\n if (!fileContent.includes('pid')) {\n throw new Error('Invalid PID file content');\n }\n\n const { pid } = JSON.parse(fileContent);\n const signal: NodeJS.Signals = force ? 'SIGKILL' : 'SIGINT';\n try {\n process.kill(pid, signal);\n } catch (err) {\n invariant(err instanceof Error, 'Invalid error type');\n if (err.message.includes('ESRCH') || err.name.includes('ESRCH')) {\n // Process is already dead.\n unlinkSync(pidFile);\n } else {\n throw err;\n }\n }\n }\n\n static info(pidFile: string): ProcessInfo {\n return JSON.parse(readFileSync(pidFile, { encoding: 'utf-8' }));\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { existsSync, readFileSync } from 'node:fs';\n\nimport { waitForCondition } from '@dxos/async';\n\nimport { WATCHDOG_CHECK_INTERVAL, WATCHDOG_START_TIMEOUT, WATCHDOG_STOP_TIMEOUT } from './defs';\n\nexport const waitForPidCreation = async (pidFile: string) =>\n waitForCondition({\n condition: () => existsSync(pidFile),\n timeout: WATCHDOG_START_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n });\n\nexport const waitForPidDeletion = async (pidFile: string) =>\n waitForCondition({\n condition: () => !existsSync(pidFile),\n timeout: WATCHDOG_STOP_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n });\n\nexport const waitForPidFileBeingFilledWithInfo = async (pidFile: string) =>\n waitForCondition({\n condition: () => readFileSync(pidFile, { encoding: 'utf-8' }).includes('pid'),\n timeout: WATCHDOG_START_TIMEOUT,\n interval: WATCHDOG_CHECK_INTERVAL,\n error: new Error('Lock file is not being propagated with info.'),\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const LOCK_TIMEOUT = 1_000;\nexport const LOCK_CHECK_INTERVAL = 50;\nexport const WATCHDOG_START_TIMEOUT = 10_000;\nexport const WATCHDOG_STOP_TIMEOUT = 1_000;\nexport const WATCHDOG_CHECK_INTERVAL = 50;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type ChildProcessWithoutNullStreams, spawn } from 'node:child_process';\nimport { existsSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { type FileHandle } from 'node:fs/promises';\n\nimport { synchronized } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport { waitForPidDeletion, waitForPidFileBeingFilledWithInfo } from './utils';\n\nexport type ProcessInfo = WatchDogProps & {\n pid?: number;\n started?: number;\n restarts?: number;\n running?: boolean;\n};\n\nexport type WatchDogProps = {\n profile?: string; // Human readable process identifier\n pidFile: string; // Path to PID file\n\n //\n // Log files and associated logging options for this instance\n //\n logFile: string; // Path to log output all logs\n errFile: string; // Path to log output from child stderr\n\n //\n // Basic configuration options\n //\n maxRestarts?: number | undefined; // Sets the maximum number of times a given script should run\n killTree?: boolean | undefined; // Kills the entire child process tree on `exit`\n\n //\n // Command to spawn as well as options and other vars\n // (env, cwd, etc) to pass along\n //\n command: string; // Binary to run (default: 'node')\n args?: string[] | undefined; // Additional arguments to pass to the script,\n\n //\n // More specific options to pass along to `child_process.spawn` which\n // will override anything passed to the `spawnWith` option\n //\n env?: NodeJS.ProcessEnv | undefined;\n cwd?: string | undefined;\n shell?: boolean | undefined;\n};\n\nexport class WatchDog {\n private _lock?: FileHandle; // TODO(burdon): Not used?\n private _child?: ChildProcessWithoutNullStreams;\n private _restarts = 0;\n\n constructor(private readonly _params: WatchDogProps) {}\n\n @synchronized\n async start(): Promise<void> {\n const { cwd, shell, env, command, args } = { cwd: process.cwd(), ...this._params };\n\n this._log(`Spawning process \\`\\`\\`${command} ${args?.join(' ')}\\`\\`\\``);\n this._child = spawn(command, args, { cwd, shell, env, stdio: 'pipe' });\n\n this._child.stdout.on('data', (data: Uint8Array) => {\n this._log(String(data));\n });\n this._child.stderr.on('data', (data: Uint8Array) => {\n this._err(data);\n });\n this._child.on('close', async (code: number, signal: number | NodeJS.Signals) => {\n if (code && code !== 0 && signal !== 'SIGINT' && signal !== 'SIGKILL') {\n this._err(`Died unexpectedly with exit code ${code} (signal: ${signal}).`);\n await this.restart();\n }\n this._log(`Stopped with exit code ${code} (signal: ${signal}).`);\n if (existsSync(this._params.pidFile)) {\n unlinkSync(this._params.pidFile);\n }\n });\n\n const childInfo: ProcessInfo = {\n pid: this._child.pid,\n started: Date.now(),\n restarts: this._restarts,\n ...this._params,\n };\n\n writeFileSync(this._params.pidFile, JSON.stringify(childInfo, undefined, 2), { encoding: 'utf-8' });\n\n await waitForPidFileBeingFilledWithInfo(this._params.pidFile);\n }\n\n /**\n * Sends SIGKILL to the child process and the tree it spawned (if `killTree` param is `true`).\n */\n @synchronized\n async kill(): Promise<void> {\n if (!this._child) {\n return;\n }\n\n await this._killWithSignal('SIGKILL');\n\n if (existsSync(this._params.pidFile)) {\n unlinkSync(this._params.pidFile);\n }\n\n await waitForPidDeletion(this._params.pidFile);\n }\n\n async restart(): Promise<void> {\n await this.kill();\n if (this._params.maxRestarts !== undefined && this._restarts >= this._params.maxRestarts) {\n this._err('Max restarts number is reached');\n } else {\n log('Restarting...');\n this._restarts++;\n await this.start();\n }\n }\n\n async _killWithSignal(signal: number | NodeJS.Signals): Promise<void> {\n invariant(this._child?.pid, 'Child process has no pid.');\n this._child.kill(signal);\n this._child = undefined;\n }\n\n private _log(message: string | Uint8Array): void {\n writeFileSync(this._params.logFile, message + '\\n', {\n flag: 'a+',\n encoding: 'utf-8',\n });\n }\n\n private _err(message: string | Uint8Array): void {\n this._log(message);\n writeFileSync(this._params.errFile, message + '\\n', {\n flag: 'a+',\n encoding: 'utf-8',\n });\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,YAAY;AACrB,SAASC,cAAAA,aAAYC,WAAWC,gBAAAA,eAAcC,YAAYC,qBAAqB;AAC/E,SAASC,SAASC,YAAY;AAC9B,OAAOC,WAAW;AAElB,SAASC,iBAAiB;AAC1B,SAASC,WAAW;;;ACNpB,SAASC,YAAYC,oBAAoB;AAEzC,SAASC,wBAAwB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LY;AACA,MAAAA,KAAI,iBAAU,QAAA,EAAA,YAAA,YAAA,GAAAC,eAAA,GAAA,IAAA,GAAA,KAAA,CAAA;AACd,WAAA;AACF,YAAA,KAAA,MAAA;IACF;EAEA;QACEC,gBAAezB,QAAQiB;AACvB,IAAAQ,WAAKzB,KAAOsB,QAAKT,KAAAA,6BAAAA,EAAAA,YAAAA,YAAAA,GAAAA,eAAAA,GAAAA,IAAAA,GAAAA,MAAAA,GAAAA,CAAAA,oBAAAA,6BAAAA,EAAAA,CAAAA;AACjB,SAAKb,OAAM,KAAG0B,MAAAA;AAChB,SAAA,SAAA;EAEQlB;OACNa,SAAAA;mBACQ,KAAA,QAAA,SAAA,UAAA,MAAA;MACNM,MAAAA;MACF,UAAA;IACF,CAAA;EAEQhB;OACN,SAAUiB;AACVP,SAAAA,KAAAA,OAAc;mBACN,KAAA,QAAA,SAAA,UAAA,MAAA;MACNM,MAAAA;MACF,UAAA;IACF,CAAA;EACF;;;;;;;;",
|
|
6
|
+
"names": ["fork", "existsSync", "mkdirSync", "readFileSync", "unlinkSync", "writeFileSync", "dirname", "join", "pkgUp", "invariant", "log", "existsSync", "readFileSync", "waitForCondition", "WATCHDOG_START_TIMEOUT", "WATCHDOG_STOP_TIMEOUT", "WATCHDOG_CHECK_INTERVAL", "waitForPidDeletion", "pidFile", "waitForCondition", "condition", "existsSync", "timeout", "WATCHDOG_STOP_TIMEOUT", "interval", "WATCHDOG_CHECK_INTERVAL", "waitForPidFileBeingFilledWithInfo", "readFileSync", "encoding", "includes", "WATCHDOG_START_TIMEOUT", "error", "Error", "scriptDir", "existsSync", "waitForPidDeletion", "params", "pidFile", "forEach", "filename", "mkdirSync", "dirname", "recursive", "writeFileSync", "watchDog", "JSON", "stringify", "detached", "log", "error", "code", "signal", "err", "waitForPidFileBeingFilledWithInfo", "Phoenix", "Error", "fileContent", "readFileSync", "pid", "process", "kill", "invariant", "message", "unlinkSync", "encoding", "existsSync", "unlinkSync", "synchronized", "writeFileSync", "invariant", "log", "waitForPidDeletion", "_lock", "_child", "_restarts", "_params", "cwd", "process", "shell", "env", "stdio", "_log", "String", "data", "_err", "code", "signal", "existsSync", "unlinkSync", "pidFile", "pid", "started", "Date", "restarts", "writeFileSync", "kill", "log", "__dxlog_file", "invariant", "undefined", "encoding", "message"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/defs.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/defs.ts":{"bytes":1115,"imports":[],"format":"esm"},"src/utils.ts":{"bytes":3586,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"src/defs.ts","kind":"import-statement","original":"./defs"}],"format":"esm"},"src/phoenix.ts":{"bytes":11043,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/watchdog.ts":{"bytes":14201,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"src/index.ts":{"bytes":900,"imports":[{"path":"src/phoenix.ts","kind":"import-statement","original":"./phoenix"},{"path":"src/watchdog.ts","kind":"import-statement","original":"./watchdog"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14145},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Phoenix","WatchDog"],"entryPoint":"src/index.ts","inputs":{"src/phoenix.ts":{"bytesInOutput":2925},"src/utils.ts":{"bytesInOutput":586},"src/defs.ts":{"bytesInOutput":101},"src/index.ts":{"bytesInOutput":0},"src/watchdog.ts":{"bytesInOutput":3676}},"bytes":7557}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phoenix.d.ts","sourceRoot":"","sources":["../../../src/phoenix.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"phoenix.d.ts","sourceRoot":"","sources":["../../../src/phoenix.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAIlE;;GAEG;AACH,qBAAa,OAAO;IAClB;;OAEG;IACH,OAAa,KAAK,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CA0C9D;IAED;;OAEG;IACH,OAAa,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB/D;IAED,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAExC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing-utils.d.ts","sourceRoot":"","sources":["../../../src/testing-utils.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,8BAA8B,CAAC;AAMpD,eAAO,MAAM,kBAAkB,YAI9B,CAAC;AAEF,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"testing-utils.d.ts","sourceRoot":"","sources":["../../../src/testing-utils.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,8BAA8B,CAAC;AAMpD,eAAO,MAAM,kBAAkB,YAI9B,CAAC;AAEF,eAAO,MAAM,UAAU,iBAAkB,MAAM,EAAE,SAMhD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,kBAAkB,YAAmB,MAAM,qBAKpD,CAAC;AAEL,eAAO,MAAM,kBAAkB,YAAmB,MAAM,qBAKpD,CAAC;AAEL,eAAO,MAAM,iCAAiC,YAAmB,MAAM,qBAMnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchdog.d.ts","sourceRoot":"","sources":["../../../src/watchdog.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAKhB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAKhB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAM/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI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