@pnpm/plugin-commands-server 3.0.38 → 3.0.39
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/lib/server.js +6 -6
- package/lib/server.js.map +1 -1
- package/lib/start.js +18 -18
- package/lib/start.js.map +1 -1
- package/lib/status.js +4 -4
- package/lib/status.js.map +1 -1
- package/lib/stop.js +12 -12
- package/lib/stop.js.map +1 -1
- package/package.json +5 -5
package/lib/server.js
CHANGED
|
@@ -16,7 +16,7 @@ const stop_1 = __importDefault(require("./stop"));
|
|
|
16
16
|
exports.rcOptionsTypes = cliOptionsTypes;
|
|
17
17
|
function cliOptionsTypes() {
|
|
18
18
|
return {
|
|
19
|
-
...pick_1.default([
|
|
19
|
+
...(0, pick_1.default)([
|
|
20
20
|
'store',
|
|
21
21
|
'store-dir',
|
|
22
22
|
], config_1.types),
|
|
@@ -30,7 +30,7 @@ function cliOptionsTypes() {
|
|
|
30
30
|
exports.cliOptionsTypes = cliOptionsTypes;
|
|
31
31
|
exports.commandNames = ['server'];
|
|
32
32
|
function help() {
|
|
33
|
-
return render_help_1.default({
|
|
33
|
+
return (0, render_help_1.default)({
|
|
34
34
|
description: 'Manage a store server',
|
|
35
35
|
descriptionLists: [
|
|
36
36
|
{
|
|
@@ -91,7 +91,7 @@ Other commands will delegate any store-related tasks to this service',
|
|
|
91
91
|
],
|
|
92
92
|
},
|
|
93
93
|
],
|
|
94
|
-
url: cli_utils_1.docsUrl('server'),
|
|
94
|
+
url: (0, cli_utils_1.docsUrl)('server'),
|
|
95
95
|
usages: ['pnpm server <command>'],
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -101,11 +101,11 @@ function handler(opts, params) {
|
|
|
101
101
|
opts.protocol = 'tcp';
|
|
102
102
|
switch (params[0]) {
|
|
103
103
|
case 'start':
|
|
104
|
-
return start_1.default(opts);
|
|
104
|
+
return (0, start_1.default)(opts);
|
|
105
105
|
case 'status':
|
|
106
|
-
return status_1.default(opts);
|
|
106
|
+
return (0, status_1.default)(opts);
|
|
107
107
|
case 'stop':
|
|
108
|
-
return stop_1.default(opts);
|
|
108
|
+
return (0, stop_1.default)(opts);
|
|
109
109
|
default:
|
|
110
110
|
help();
|
|
111
111
|
if (params[0]) {
|
package/lib/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAyC;AACzC,2EAA0E;AAC1E,yCAAgD;AAChD,wDAAmC;AAEnC,0DAAiC;AACjC,8DAAoC;AACpC,oDAA2B;AAC3B,sDAA6B;AAC7B,kDAAyB;AAEZ,QAAA,cAAc,GAAG,eAAe,CAAA;AAE7C,SAAgB,eAAe;IAC7B,OAAO;QACL,GAAG,cAAI,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAyC;AACzC,2EAA0E;AAC1E,yCAAgD;AAChD,wDAAmC;AAEnC,0DAAiC;AACjC,8DAAoC;AACpC,oDAA2B;AAC3B,sDAA6B;AAC7B,kDAAyB;AAEZ,QAAA,cAAc,GAAG,eAAe,CAAA;AAE7C,SAAgB,eAAe;IAC7B,OAAO;QACL,GAAG,IAAA,cAAI,EAAC;YACN,OAAO;YACP,WAAW;SACZ,EAAE,cAAQ,CAAC;QACZ,UAAU,EAAE,OAAO;QACnB,sBAAsB,EAAE,OAAO;QAC/B,wBAAwB,EAAE,OAAO;QACjC,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC;KACjC,CAAA;AACH,CAAC;AAZD,0CAYC;AAEY,QAAA,YAAY,GAAG,CAAC,QAAQ,CAAC,CAAA;AAEtC,SAAgB,IAAI;IAClB,OAAO,IAAA,qBAAU,EAAC;QAChB,WAAW,EAAE,uBAAuB;QACpC,gBAAgB,EAAE;YAChB;gBACE,KAAK,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AAO,IAAA,gBAAM,EAAC,IAAI,CAAC,CAAA;QACrB,KAAK,MAAM;YACT,OAAO,IAAA,cAAI,EAAC,IAAI,CAAC,CAAA;QACnB;YACE,IAAI,EAAE,CAAA;YACN,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;gBACb,MAAM,IAAI,eAAS,CAAC,wBAAwB,EAAE,WAAW,MAAM,CAAC,CAAC,CAAC,kDAAkD,CAAC,CAAA;aACtH;YACD,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AAxBD,0BAwBC"}
|
package/lib/start.js
CHANGED
|
@@ -16,20 +16,20 @@ const diable_1 = __importDefault(require("@zkochan/diable"));
|
|
|
16
16
|
const get_port_1 = __importDefault(require("get-port"));
|
|
17
17
|
const is_windows_1 = __importDefault(require("is-windows"));
|
|
18
18
|
const signal_exit_1 = __importDefault(require("signal-exit"));
|
|
19
|
-
const storeServerLogger = logger_1.default('store-server');
|
|
20
|
-
const write = util_1.promisify(fs_1.write);
|
|
21
|
-
const close = util_1.promisify(fs_1.close);
|
|
22
|
-
const open = util_1.promisify(fs_1.open);
|
|
19
|
+
const storeServerLogger = (0, logger_1.default)('store-server');
|
|
20
|
+
const write = (0, util_1.promisify)(fs_1.write);
|
|
21
|
+
const close = (0, util_1.promisify)(fs_1.close);
|
|
22
|
+
const open = (0, util_1.promisify)(fs_1.open);
|
|
23
23
|
exports.default = async (opts) => {
|
|
24
24
|
var _a;
|
|
25
25
|
if (opts.protocol === 'ipc' && opts.port) {
|
|
26
26
|
throw new Error('Port cannot be selected when server communicates via IPC');
|
|
27
27
|
}
|
|
28
28
|
if (opts.background && !diable_1.default.isDaemon()) {
|
|
29
|
-
diable_1.default();
|
|
29
|
+
(0, diable_1.default)();
|
|
30
30
|
}
|
|
31
|
-
const storeDir = await store_path_1.default(opts.dir, opts.storeDir);
|
|
32
|
-
const connectionInfoDir = store_connection_manager_1.serverConnectionInfoDir(storeDir);
|
|
31
|
+
const storeDir = await (0, store_path_1.default)(opts.dir, opts.storeDir);
|
|
32
|
+
const connectionInfoDir = (0, store_connection_manager_1.serverConnectionInfoDir)(storeDir);
|
|
33
33
|
const serverJsonPath = path_1.default.join(connectionInfoDir, 'server.json');
|
|
34
34
|
await fs_1.promises.mkdir(connectionInfoDir, { recursive: true });
|
|
35
35
|
// Open server.json with exclusive write access to ensure only one process can successfully
|
|
@@ -39,14 +39,14 @@ exports.default = async (opts) => {
|
|
|
39
39
|
try {
|
|
40
40
|
fd = await open(serverJsonPath, 'wx');
|
|
41
41
|
}
|
|
42
|
-
catch (error) {
|
|
42
|
+
catch (error) { // eslint-disable-line
|
|
43
43
|
if (error.code !== 'EEXIST') {
|
|
44
44
|
throw error;
|
|
45
45
|
}
|
|
46
46
|
throw new error_1.default('SERVER_MANIFEST_LOCKED', `Canceling startup of server (pid ${process.pid}) because another process got exclusive access to server.json`);
|
|
47
47
|
}
|
|
48
48
|
let server = null;
|
|
49
|
-
signal_exit_1.default(() => {
|
|
49
|
+
(0, signal_exit_1.default)(() => {
|
|
50
50
|
if (server !== null) {
|
|
51
51
|
// Note that server.close returns a Promise, but we cannot wait for it because we may be
|
|
52
52
|
// inside the 'exit' even of process.
|
|
@@ -54,22 +54,22 @@ exports.default = async (opts) => {
|
|
|
54
54
|
}
|
|
55
55
|
if (fd !== null) {
|
|
56
56
|
try {
|
|
57
|
-
fs_1.closeSync(fd);
|
|
57
|
+
(0, fs_1.closeSync)(fd);
|
|
58
58
|
}
|
|
59
|
-
catch (error) {
|
|
59
|
+
catch (error) { // eslint-disable-line
|
|
60
60
|
storeServerLogger.error(error, 'Got error while closing file descriptor of server.json, but the process is already exiting');
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
try {
|
|
64
|
-
fs_1.unlinkSync(serverJsonPath);
|
|
64
|
+
(0, fs_1.unlinkSync)(serverJsonPath);
|
|
65
65
|
}
|
|
66
|
-
catch (error) {
|
|
66
|
+
catch (error) { // eslint-disable-line
|
|
67
67
|
if (error.code !== 'ENOENT') {
|
|
68
68
|
storeServerLogger.error(error, 'Got error unlinking server.json, but the process is already exiting');
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
const store = await store_connection_manager_1.createNewStoreController(Object.assign(opts, {
|
|
72
|
+
const store = await (0, store_connection_manager_1.createNewStoreController)(Object.assign(opts, {
|
|
73
73
|
storeDir,
|
|
74
74
|
}));
|
|
75
75
|
const protocol = (_a = opts.protocol) !== null && _a !== void 0 ? _a : (opts.port ? 'tcp' : 'auto');
|
|
@@ -79,7 +79,7 @@ exports.default = async (opts) => {
|
|
|
79
79
|
? `http://unix:${serverOptions.path}:`
|
|
80
80
|
: `http://${serverOptions.hostname}:${serverOptions.port}`,
|
|
81
81
|
};
|
|
82
|
-
server = server_1.createServer(store.ctrl, {
|
|
82
|
+
server = (0, server_1.createServer)(store.ctrl, {
|
|
83
83
|
...serverOptions,
|
|
84
84
|
ignoreStopRequests: opts.ignoreStopRequests,
|
|
85
85
|
ignoreUploadRequests: opts.ignoreUploadRequests,
|
|
@@ -106,12 +106,12 @@ async function getServerOptions(connectionInfoDir, opts) {
|
|
|
106
106
|
case 'tcp':
|
|
107
107
|
return getTcpOptions();
|
|
108
108
|
case 'ipc':
|
|
109
|
-
if (is_windows_1.default()) {
|
|
109
|
+
if ((0, is_windows_1.default)()) {
|
|
110
110
|
throw new Error('IPC protocol is not supported on Windows currently');
|
|
111
111
|
}
|
|
112
112
|
return getIpcOptions();
|
|
113
113
|
case 'auto':
|
|
114
|
-
if (is_windows_1.default()) {
|
|
114
|
+
if ((0, is_windows_1.default)()) {
|
|
115
115
|
return getTcpOptions();
|
|
116
116
|
}
|
|
117
117
|
return getIpcOptions();
|
|
@@ -121,7 +121,7 @@ async function getServerOptions(connectionInfoDir, opts) {
|
|
|
121
121
|
async function getTcpOptions() {
|
|
122
122
|
return {
|
|
123
123
|
hostname: 'localhost',
|
|
124
|
-
port: opts.port || await get_port_1.default({ port: 5813 }), // eslint-disable-line
|
|
124
|
+
port: opts.port || await (0, get_port_1.default)({ port: 5813 }), // eslint-disable-line
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
function getIpcOptions() {
|
package/lib/start.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";;;;;AAAA,2BAOW;AACX,+BAAgC;AAChC,gDAAuB;AACvB,8DAA2C;AAC3C,wDAAmC;AACnC,0DAAiC;AACjC,yCAA2C;AAC3C,6EAIuC;AACvC,kEAAwC;AACxC,6DAAoC;AACpC,wDAA8B;AAC9B,4DAAkC;AAClC,8DAAgC;AAEhC,MAAM,iBAAiB,GAAG,gBAAM,
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":";;;;;AAAA,2BAOW;AACX,+BAAgC;AAChC,gDAAuB;AACvB,8DAA2C;AAC3C,wDAAmC;AACnC,0DAAiC;AACjC,yCAA2C;AAC3C,6EAIuC;AACvC,kEAAwC;AACxC,6DAAoC;AACpC,wDAA8B;AAC9B,4DAAkC;AAClC,8DAAgC;AAEhC,MAAM,iBAAiB,GAAG,IAAA,gBAAM,EAAC,cAAc,CAAC,CAAA;AAChD,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,UAAM,CAAC,CAAA;AAC/B,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,UAAM,CAAC,CAAA;AAC/B,MAAM,IAAI,GAAG,IAAA,gBAAS,EAAC,SAAK,CAAC,CAAA;AAE7B,kBAAe,KAAK,EAClB,IAMC,EACD,EAAE;;IACF,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE;QACxC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;KAC5E;IACD,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,gBAAM,CAAC,QAAQ,EAAE,EAAE;QACzC,IAAA,gBAAM,GAAE,CAAA;K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Aa,EAAE,MAAM,CAAC,CAAA;IAC3D,4EAA4E;IAC5E,wGAAwG;IACxG,MAAM,KAAK,CAAC,EAAE,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IAEjE,MAAM,UAAU,GAAG,EAAE,CAAA;IACrB,sDAAsD;IACtD,EAAE,GAAG,IAAI,CAAA;IACT,MAAM,KAAK,CAAC,UAAU,CAAC,CAAA;AACzB,CAAC,CAAA;AAED,KAAK,UAAU,gBAAgB,CAC7B,iBAAyB,EACzB,IAGC;IAOD,QAAQ,IAAI,CAAC,QAAQ,EAAE;QACvB,KAAK,KAAK;YACR,OAAO,aAAa,EAAE,CAAA;QACxB,KAAK,KAAK;YACR,IAAI,IAAA,oBAAS,GAAE,EAAE;gBACf,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;aACtE;YACD,OAAO,aAAa,EAAE,CAAA;QACxB,KAAK,MAAM;YACT,IAAI,IAAA,oBAAS,GAAE,EAAE;gBACf,OAAO,aAAa,EAAE,CAAA;aACvB;YACD,OAAO,aAAa,EAAE,CAAA;QACxB;YACE,MAAM,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC,QAAkB,mBAAmB,CAAC,CAAA;KACxE;IAED,KAAK,UAAU,aAAa;QAC1B,OAAO;YACL,QAAQ,EAAE,WAAW;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,MAAM,IAAA,kBAAO,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,sBAAsB;SACzE,CAAA;IACH,CAAC;IAED,SAAS,aAAa;QACpB,OAAO;YACL,IAAI,EAAE,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;SAC7C,CAAA;IACH,CAAC;AACH,CAAC"}
|
package/lib/status.js
CHANGED
|
@@ -8,14 +8,14 @@ const logger_1 = require("@pnpm/logger");
|
|
|
8
8
|
const store_connection_manager_1 = require("@pnpm/store-connection-manager");
|
|
9
9
|
const store_path_1 = __importDefault(require("@pnpm/store-path"));
|
|
10
10
|
exports.default = async (opts) => {
|
|
11
|
-
const storeDir = await store_path_1.default(opts.dir, opts.storeDir);
|
|
12
|
-
const connectionInfoDir = store_connection_manager_1.serverConnectionInfoDir(storeDir);
|
|
13
|
-
const serverJson = await store_connection_manager_1.tryLoadServerJson({
|
|
11
|
+
const storeDir = await (0, store_path_1.default)(opts.dir, opts.storeDir);
|
|
12
|
+
const connectionInfoDir = (0, store_connection_manager_1.serverConnectionInfoDir)(storeDir);
|
|
13
|
+
const serverJson = await (0, store_connection_manager_1.tryLoadServerJson)({
|
|
14
14
|
serverJsonPath: path_1.default.join(connectionInfoDir, 'server.json'),
|
|
15
15
|
shouldRetryOnNoent: false,
|
|
16
16
|
});
|
|
17
17
|
if (serverJson === null) {
|
|
18
|
-
logger_1.globalInfo(`No server is running for the store at ${storeDir}`);
|
|
18
|
+
(0, logger_1.globalInfo)(`No server is running for the store at ${storeDir}`);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
21
|
console.log(`store: ${storeDir}
|
package/lib/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AAEvB,yCAAyC;AACzC,6EAA2F;AAC3F,kEAAwC;AAExC,kBAAe,KAAK,EAClB,IAAsC,EACtC,EAAE;IACF,MAAM,QAAQ,GAAG,MAAM,oBAAS,
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AAEvB,yCAAyC;AACzC,6EAA2F;AAC3F,kEAAwC;AAExC,kBAAe,KAAK,EAClB,IAAsC,EACtC,EAAE;IACF,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAS,EAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACzD,MAAM,iBAAiB,GAAG,IAAA,kDAAuB,EAAC,QAAQ,CAAC,CAAA;IAC3D,MAAM,UAAU,GAAG,MAAM,IAAA,4CAAiB,EAAC;QACzC,cAAc,EAAE,cAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC;QAC3D,kBAAkB,EAAE,KAAK;KAC1B,CAAC,CAAA;IACF,IAAI,UAAU,KAAK,IAAI,EAAE;QACvB,IAAA,mBAAU,EAAC,yCAAyC,QAAQ,EAAE,CAAC,CAAA;QAC/D,OAAM;KACP;IACD,OAAO,CAAC,GAAG,CAAC,UAAU,QAAQ;cAClB,UAAU,CAAC,GAAG;iBACX,UAAU,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,CAAA;AAC7D,CAAC,CAAA"}
|
package/lib/stop.js
CHANGED
|
@@ -12,32 +12,32 @@ const store_path_1 = __importDefault(require("@pnpm/store-path"));
|
|
|
12
12
|
const delay_1 = __importDefault(require("delay"));
|
|
13
13
|
const process_exists_1 = __importDefault(require("process-exists"));
|
|
14
14
|
const tree_kill_1 = __importDefault(require("tree-kill"));
|
|
15
|
-
const kill = util_1.promisify(tree_kill_1.default);
|
|
15
|
+
const kill = (0, util_1.promisify)(tree_kill_1.default);
|
|
16
16
|
exports.default = async (opts) => {
|
|
17
|
-
const storeDir = await store_path_1.default(opts.dir, opts.storeDir);
|
|
18
|
-
const connectionInfoDir = store_connection_manager_1.serverConnectionInfoDir(storeDir);
|
|
19
|
-
const serverJson = await store_connection_manager_1.tryLoadServerJson({
|
|
17
|
+
const storeDir = await (0, store_path_1.default)(opts.dir, opts.storeDir);
|
|
18
|
+
const connectionInfoDir = (0, store_connection_manager_1.serverConnectionInfoDir)(storeDir);
|
|
19
|
+
const serverJson = await (0, store_connection_manager_1.tryLoadServerJson)({
|
|
20
20
|
serverJsonPath: path_1.default.join(connectionInfoDir, 'server.json'),
|
|
21
21
|
shouldRetryOnNoent: false,
|
|
22
22
|
});
|
|
23
23
|
if (serverJson === null) {
|
|
24
|
-
logger_1.globalInfo(`Nothing to stop. No server is running for the store at ${storeDir}`);
|
|
24
|
+
(0, logger_1.globalInfo)(`Nothing to stop. No server is running for the store at ${storeDir}`);
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
const storeController = await server_1.connectStoreController(serverJson.connectionOptions);
|
|
27
|
+
const storeController = await (0, server_1.connectStoreController)(serverJson.connectionOptions);
|
|
28
28
|
await storeController.stop();
|
|
29
29
|
if (await serverGracefullyStops(serverJson.pid)) {
|
|
30
|
-
logger_1.globalInfo('Server gracefully stopped');
|
|
30
|
+
(0, logger_1.globalInfo)('Server gracefully stopped');
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
logger_1.globalWarn('Graceful shutdown failed');
|
|
33
|
+
(0, logger_1.globalWarn)('Graceful shutdown failed');
|
|
34
34
|
await kill(serverJson.pid, 'SIGINT');
|
|
35
|
-
logger_1.globalInfo('Server process terminated');
|
|
35
|
+
(0, logger_1.globalInfo)('Server process terminated');
|
|
36
36
|
};
|
|
37
37
|
async function serverGracefullyStops(pid) {
|
|
38
|
-
if (!await process_exists_1.default(pid))
|
|
38
|
+
if (!await (0, process_exists_1.default)(pid))
|
|
39
39
|
return true;
|
|
40
|
-
await delay_1.default(5000);
|
|
41
|
-
return !await process_exists_1.default(pid);
|
|
40
|
+
await (0, delay_1.default)(5000);
|
|
41
|
+
return !await (0, process_exists_1.default)(pid);
|
|
42
42
|
}
|
|
43
43
|
//# sourceMappingURL=stop.js.map
|
package/lib/stop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../src/stop.ts"],"names":[],"mappings":";;;;;AAAA,+BAAgC;AAChC,gDAAuB;AACvB,yCAAqD;AACrD,yCAAqD;AACrD,6EAA2F;AAC3F,kEAAwC;AACxC,kDAAyB;AACzB,oEAA0C;AAC1C,0DAA8B;AAE9B,MAAM,IAAI,GAAG,gBAAS,
|
|
1
|
+
{"version":3,"file":"stop.js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wBAAa,EAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAE1C,MAAM,IAAA,eAAK,EAAC,IAAI,CAAC,CAAA;IAEjB,OAAO,CAAC,MAAM,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;AAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/plugin-commands-server",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.39",
|
|
4
4
|
"description": "Commands for controlling the store server",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@pnpm/cli-meta": "2.0.0",
|
|
33
|
-
"@pnpm/cli-utils": "0.6.
|
|
33
|
+
"@pnpm/cli-utils": "0.6.27",
|
|
34
34
|
"@pnpm/common-cli-options-help": "0.7.1",
|
|
35
|
-
"@pnpm/config": "13.
|
|
35
|
+
"@pnpm/config": "13.3.0",
|
|
36
36
|
"@pnpm/error": "2.0.0",
|
|
37
|
-
"@pnpm/server": "11.0.
|
|
38
|
-
"@pnpm/store-connection-manager": "3.0
|
|
37
|
+
"@pnpm/server": "11.0.8",
|
|
38
|
+
"@pnpm/store-connection-manager": "3.1.0",
|
|
39
39
|
"@pnpm/store-path": "^5.0.0",
|
|
40
40
|
"@zkochan/diable": "^1.0.2",
|
|
41
41
|
"delay": "^5.0.0",
|