@dxos/phoenix 0.3.7 → 0.3.8-main.152ec6f
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/dist/lib/node/index.cjs
CHANGED
|
@@ -26,56 +26,49 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var src_exports = {};
|
|
32
|
-
__export(src_exports, {
|
|
29
|
+
var node_exports = {};
|
|
30
|
+
__export(node_exports, {
|
|
33
31
|
Phoenix: () => Phoenix,
|
|
34
32
|
WatchDog: () => WatchDog
|
|
35
33
|
});
|
|
36
|
-
module.exports = __toCommonJS(
|
|
37
|
-
|
|
38
|
-
// packages/common/phoenix/src/phoenix.ts
|
|
34
|
+
module.exports = __toCommonJS(node_exports);
|
|
39
35
|
var import_node_child_process = require("node:child_process");
|
|
40
|
-
var
|
|
36
|
+
var import_node_fs = require("node:fs");
|
|
41
37
|
var import_node_path = require("node:path");
|
|
42
38
|
var import_pkg_up = __toESM(require("pkg-up"));
|
|
43
39
|
var import_invariant = require("@dxos/invariant");
|
|
44
40
|
var import_log = require("@dxos/log");
|
|
45
|
-
|
|
46
|
-
// packages/common/phoenix/src/utils.ts
|
|
47
|
-
var import_node_fs = require("node:fs");
|
|
41
|
+
var import_node_fs2 = require("node:fs");
|
|
48
42
|
var import_async = require("@dxos/async");
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
var import_node_child_process2 = require("node:child_process");
|
|
44
|
+
var import_node_fs3 = require("node:fs");
|
|
45
|
+
var import_async2 = require("@dxos/async");
|
|
46
|
+
var import_invariant2 = require("@dxos/invariant");
|
|
47
|
+
var import_log2 = require("@dxos/log");
|
|
51
48
|
var WATCHDOG_START_TIMEOUT = 1e4;
|
|
52
49
|
var WATCHDOG_STOP_TIMEOUT = 1e3;
|
|
53
50
|
var WATCHDOG_CHECK_INTERVAL = 50;
|
|
54
|
-
|
|
55
|
-
// packages/common/phoenix/src/utils.ts
|
|
56
51
|
var waitForPidDeletion = async (pidFile) => (0, import_async.waitForCondition)({
|
|
57
|
-
condition: () => !(0,
|
|
52
|
+
condition: () => !(0, import_node_fs2.existsSync)(pidFile),
|
|
58
53
|
timeout: WATCHDOG_STOP_TIMEOUT,
|
|
59
54
|
interval: WATCHDOG_CHECK_INTERVAL
|
|
60
55
|
});
|
|
61
56
|
var waitForPidFileBeingFilledWithInfo = async (pidFile) => (0, import_async.waitForCondition)({
|
|
62
|
-
condition: () => (0,
|
|
57
|
+
condition: () => (0, import_node_fs2.readFileSync)(pidFile, {
|
|
63
58
|
encoding: "utf-8"
|
|
64
59
|
}).includes("pid"),
|
|
65
60
|
timeout: WATCHDOG_START_TIMEOUT,
|
|
66
61
|
interval: WATCHDOG_CHECK_INTERVAL,
|
|
67
62
|
error: new Error("Lock file is not being propagated with info.")
|
|
68
63
|
});
|
|
69
|
-
|
|
70
|
-
// packages/common/phoenix/src/phoenix.ts
|
|
71
|
-
var __dxlog_file = "/mnt/ramdisk/work/packages/common/phoenix/src/phoenix.ts";
|
|
64
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/common/phoenix/src/phoenix.ts";
|
|
72
65
|
var Phoenix = class _Phoenix {
|
|
73
66
|
/**
|
|
74
67
|
* Starts detached watchdog process which starts and monitors selected command.
|
|
75
68
|
*/
|
|
76
69
|
static async start(params) {
|
|
77
70
|
{
|
|
78
|
-
if ((0,
|
|
71
|
+
if ((0, import_node_fs.existsSync)(params.pidFile)) {
|
|
79
72
|
await _Phoenix.stop(params.pidFile);
|
|
80
73
|
}
|
|
81
74
|
await waitForPidDeletion(params.pidFile);
|
|
@@ -86,11 +79,11 @@ var Phoenix = class _Phoenix {
|
|
|
86
79
|
params.errFile,
|
|
87
80
|
params.pidFile
|
|
88
81
|
].forEach((filename) => {
|
|
89
|
-
if (!(0,
|
|
90
|
-
(0,
|
|
82
|
+
if (!(0, import_node_fs.existsSync)(filename)) {
|
|
83
|
+
(0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(filename), {
|
|
91
84
|
recursive: true
|
|
92
85
|
});
|
|
93
|
-
(0,
|
|
86
|
+
(0, import_node_fs.writeFileSync)(filename, "", {
|
|
94
87
|
encoding: "utf-8"
|
|
95
88
|
});
|
|
96
89
|
}
|
|
@@ -127,10 +120,10 @@ var Phoenix = class _Phoenix {
|
|
|
127
120
|
* Stops detached watchdog process by PID info written down in PID file.
|
|
128
121
|
*/
|
|
129
122
|
static async stop(pidFile, force = false) {
|
|
130
|
-
if (!(0,
|
|
123
|
+
if (!(0, import_node_fs.existsSync)(pidFile)) {
|
|
131
124
|
throw new Error("PID file does not exist");
|
|
132
125
|
}
|
|
133
|
-
const fileContent = (0,
|
|
126
|
+
const fileContent = (0, import_node_fs.readFileSync)(pidFile, {
|
|
134
127
|
encoding: "utf-8"
|
|
135
128
|
});
|
|
136
129
|
if (!fileContent.includes("pid")) {
|
|
@@ -151,25 +144,18 @@ var Phoenix = class _Phoenix {
|
|
|
151
144
|
]
|
|
152
145
|
});
|
|
153
146
|
if (err.message.includes("ESRCH") || err.name.includes("ESRCH")) {
|
|
154
|
-
(0,
|
|
147
|
+
(0, import_node_fs.unlinkSync)(pidFile);
|
|
155
148
|
} else {
|
|
156
149
|
throw err;
|
|
157
150
|
}
|
|
158
151
|
}
|
|
159
152
|
}
|
|
160
153
|
static info(pidFile) {
|
|
161
|
-
return JSON.parse((0,
|
|
154
|
+
return JSON.parse((0, import_node_fs.readFileSync)(pidFile, {
|
|
162
155
|
encoding: "utf-8"
|
|
163
156
|
}));
|
|
164
157
|
}
|
|
165
158
|
};
|
|
166
|
-
|
|
167
|
-
// packages/common/phoenix/src/watchdog.ts
|
|
168
|
-
var import_node_child_process2 = require("node:child_process");
|
|
169
|
-
var import_node_fs3 = require("node:fs");
|
|
170
|
-
var import_async2 = require("@dxos/async");
|
|
171
|
-
var import_invariant2 = require("@dxos/invariant");
|
|
172
|
-
var import_log2 = require("@dxos/log");
|
|
173
159
|
function _ts_decorate(decorators, target, key, desc) {
|
|
174
160
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
175
161
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -180,7 +166,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
180
166
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
181
167
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
182
168
|
}
|
|
183
|
-
var __dxlog_file2 = "/
|
|
169
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/common/phoenix/src/watchdog.ts";
|
|
184
170
|
var WatchDog = class {
|
|
185
171
|
constructor(_params) {
|
|
186
172
|
this._params = _params;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["import_node_fs", "WATCHDOG_START_TIMEOUT", "WATCHDOG_STOP_TIMEOUT", "WATCHDOG_CHECK_INTERVAL", "waitForPidDeletion", "pidFile", "waitForCondition", "condition", "existsSync", "timeout", "
|
|
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';\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 WatchDogParams } from './watchdog';\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: WatchDogParams) {\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: __dirname })!), 'bin', 'watchdog');\n\n const watchDog = fork(watchdogPath, [JSON.stringify(params)], {\n detached: true,\n cwd: __dirname,\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 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) {\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 = WatchDogParams & {\n pid?: number;\n started?: number;\n restarts?: number;\n running?: boolean;\n};\n\nexport type WatchDogParams = {\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;\n private _child?: ChildProcessWithoutNullStreams;\n private _restarts = 0;\n\n constructor(private readonly _params: WatchDogParams) {}\n\n @synchronized\n async start() {\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() {\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() {\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) {\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) {\n writeFileSync(this._params.logFile, message + '\\n', {\n flag: 'a+',\n encoding: 'utf-8',\n });\n }\n\n private _err(message: string | Uint8Array) {\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,gCAAqB;AACrB,qBAA+E;AAC/E,uBAA8B;AAC9B,oBAAkB;AAElB,uBAA0B;AAC1B,iBAAoB;ACNpB,IAAAA,kBAAyC;AAEzC,mBAAiC;AEFjC,IAAAC,6BAA2D;AAC3D,IAAAD,kBAAsD;AAGtD,IAAAE,gBAA6B;AAC7B,IAAAC,oBAA0B;AAC1B,IAAAC,cAAoB;ADJb,IAAMC,yBAAyB;AAC/B,IAAMC,wBAAwB;AAC9B,IAAMC,0BAA0B;ADShC,IAAMC,qBAAqB,OAAOC,gBACvCC,+BAAiB;EACfC,WAAW,MAAM,KAACC,4BAAWH,OAAAA;EAC7BI,SAASP;EACTQ,UAAUP;AACZ,CAAA;AAEK,IAAMQ,oCAAoC,OAAON,gBACtDC,+BAAiB;EACfC,WAAW,UAAMK,8BAAaP,SAAS;IAAEQ,UAAU;EAAQ,CAAA,EAAGC,SAAS,KAAA;EACvEL,SAASR;EACTS,UAAUP;EACVY,OAAO,IAAIC,MAAM,8CAAA;AACnB,CAAA;;ADZK,IAAMC,UAAN,MAAMA,SAAAA;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Qf,KAAKX,SAA8B;AACzC3B,wBAAAA,eAAc,KAAKgC,QAAQvC,SAASkC,UAAU,MAAM;MAClD6B,MAAM;MACNvE,UAAU;IACZ,CAAA;EACF;EAEQ6D,KAAKnB,SAA8B;AACzC,SAAKW,KAAKX,OAAAA;AACV3B,wBAAAA,eAAc,KAAKgC,QAAQtC,SAASiC,UAAU,MAAM;MAClD6B,MAAM;MACNvE,UAAU;IACZ,CAAA;EACF;AACF;;EArFGwE;GAPU3B,SAAAA,WAAAA,SAAAA,IAAAA;;EA8CV2B;GA9CU3B,SAAAA,WAAAA,QAAAA,IAAAA;",
|
|
6
|
+
"names": ["import_node_fs", "import_node_child_process", "import_async", "import_invariant", "import_log", "WATCHDOG_START_TIMEOUT", "WATCHDOG_STOP_TIMEOUT", "WATCHDOG_CHECK_INTERVAL", "waitForPidDeletion", "pidFile", "waitForCondition", "condition", "existsSync", "timeout", "interval", "waitForPidFileBeingFilledWithInfo", "readFileSync", "encoding", "includes", "error", "Error", "Phoenix", "start", "params", "stop", "logFile", "errFile", "forEach", "filename", "mkdirSync", "dirname", "recursive", "writeFileSync", "watchdogPath", "join", "pkgUp", "sync", "cwd", "__dirname", "watchDog", "fork", "JSON", "stringify", "detached", "on", "code", "signal", "log", "disconnect", "unref", "info", "force", "fileContent", "pid", "parse", "process", "kill", "err", "invariant", "message", "name", "unlinkSync", "WatchDog", "constructor", "_params", "_restarts", "shell", "env", "command", "args", "_log", "_child", "spawn", "stdio", "stdout", "data", "String", "stderr", "_err", "restart", "childInfo", "started", "Date", "now", "restarts", "undefined", "_killWithSignal", "maxRestarts", "flag", "synchronized"]
|
|
7
7
|
}
|
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/common/phoenix/src/defs.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/common/phoenix/src/defs.ts":{"bytes":1201,"imports":[],"format":"esm"},"packages/common/phoenix/src/utils.ts":{"bytes":3673,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"packages/common/phoenix/src/defs.ts","kind":"import-statement","original":"./defs"}],"format":"esm"},"packages/common/phoenix/src/phoenix.ts":{"bytes":10490,"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":"packages/common/phoenix/src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"packages/common/phoenix/src/watchdog.ts":{"bytes":14356,"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":"packages/common/phoenix/src/utils.ts","kind":"import-statement","original":"./utils"}],"format":"esm"},"packages/common/phoenix/src/index.ts":{"bytes":987,"imports":[{"path":"packages/common/phoenix/src/phoenix.ts","kind":"import-statement","original":"./phoenix"},{"path":"packages/common/phoenix/src/watchdog.ts","kind":"import-statement","original":"./watchdog"}],"format":"esm"}},"outputs":{"packages/common/phoenix/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":14451},"packages/common/phoenix/dist/lib/node/index.cjs":{"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":"packages/common/phoenix/src/index.ts","inputs":{"packages/common/phoenix/src/phoenix.ts":{"bytesInOutput":2780},"packages/common/phoenix/src/utils.ts":{"bytesInOutput":586},"packages/common/phoenix/src/defs.ts":{"bytesInOutput":101},"packages/common/phoenix/src/index.ts":{"bytesInOutput":0},"packages/common/phoenix/src/watchdog.ts":{"bytesInOutput":3754}},"bytes":7541}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/phoenix",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.8-main.152ec6f",
|
|
4
4
|
"description": "Basic node daemon.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"pkg-up": "^3.1.0",
|
|
17
|
-
"@dxos/async": "0.3.
|
|
18
|
-
"@dxos/context": "0.3.
|
|
19
|
-
"@dxos/
|
|
20
|
-
"@dxos/
|
|
21
|
-
"@dxos/
|
|
22
|
-
"@dxos/log": "0.3.
|
|
23
|
-
"@dxos/
|
|
24
|
-
"@dxos/util": "0.3.
|
|
17
|
+
"@dxos/async": "0.3.8-main.152ec6f",
|
|
18
|
+
"@dxos/context": "0.3.8-main.152ec6f",
|
|
19
|
+
"@dxos/lock-file": "0.3.8-main.152ec6f",
|
|
20
|
+
"@dxos/invariant": "0.3.8-main.152ec6f",
|
|
21
|
+
"@dxos/node-std": "0.3.8-main.152ec6f",
|
|
22
|
+
"@dxos/log": "0.3.8-main.152ec6f",
|
|
23
|
+
"@dxos/keys": "0.3.8-main.152ec6f",
|
|
24
|
+
"@dxos/util": "0.3.8-main.152ec6f"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^18.11.9",
|