@pellux/goodvibes-sdk 0.24.0 → 0.25.1
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/_internal/platform/agents/orchestrator.d.ts +2 -0
- package/dist/_internal/platform/agents/orchestrator.d.ts.map +1 -1
- package/dist/_internal/platform/agents/orchestrator.js +38 -0
- package/dist/_internal/platform/automation/delivery-manager.d.ts +5 -0
- package/dist/_internal/platform/automation/delivery-manager.d.ts.map +1 -1
- package/dist/_internal/platform/automation/delivery-manager.js +14 -1
- package/dist/_internal/platform/automation/manager-runtime.d.ts +5 -0
- package/dist/_internal/platform/automation/manager-runtime.d.ts.map +1 -1
- package/dist/_internal/platform/automation/manager-runtime.js +32 -0
- package/dist/_internal/platform/channels/plugin-registry.d.ts +6 -0
- package/dist/_internal/platform/channels/plugin-registry.d.ts.map +1 -1
- package/dist/_internal/platform/channels/plugin-registry.js +17 -4
- package/dist/_internal/platform/channels/route-manager.d.ts +7 -0
- package/dist/_internal/platform/channels/route-manager.d.ts.map +1 -1
- package/dist/_internal/platform/channels/route-manager.js +41 -3
- package/dist/_internal/platform/channels/surface-registry.d.ts +3 -1
- package/dist/_internal/platform/channels/surface-registry.d.ts.map +1 -1
- package/dist/_internal/platform/channels/surface-registry.js +16 -17
- package/dist/_internal/platform/config/schema-types.d.ts +1 -1
- package/dist/_internal/platform/config/schema-types.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/gateway.d.ts +5 -0
- package/dist/_internal/platform/control-plane/gateway.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/gateway.js +69 -4
- package/dist/_internal/platform/daemon/facade-composition.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/facade-composition.js +2 -0
- package/dist/_internal/platform/daemon/facade.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/facade.js +3 -1
- package/dist/_internal/platform/daemon/service-manager.d.ts +5 -0
- package/dist/_internal/platform/daemon/service-manager.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/service-manager.js +29 -0
- package/dist/_internal/platform/integrations/delivery.d.ts +5 -1
- package/dist/_internal/platform/integrations/delivery.d.ts.map +1 -1
- package/dist/_internal/platform/integrations/delivery.js +8 -1
- package/dist/_internal/platform/integrations/notifier.d.ts +5 -1
- package/dist/_internal/platform/integrations/notifier.d.ts.map +1 -1
- package/dist/_internal/platform/integrations/notifier.js +6 -3
- package/dist/_internal/platform/intelligence/lsp/service.d.ts.map +1 -1
- package/dist/_internal/platform/intelligence/lsp/service.js +18 -9
- package/dist/_internal/platform/permissions/manager.d.ts +3 -1
- package/dist/_internal/platform/permissions/manager.d.ts.map +1 -1
- package/dist/_internal/platform/permissions/manager.js +9 -5
- package/dist/_internal/platform/providers/anthropic-vertex.d.ts.map +1 -1
- package/dist/_internal/platform/providers/anthropic-vertex.js +135 -2
- package/dist/_internal/platform/runtime/emitters/routes.d.ts +5 -0
- package/dist/_internal/platform/runtime/emitters/routes.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/routes.js +3 -0
- package/dist/_internal/platform/runtime/events/contracts/automation-route.d.ts +1 -0
- package/dist/_internal/platform/runtime/events/contracts/automation-route.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/contracts/automation-route.js +7 -0
- package/dist/_internal/platform/runtime/events/contracts.d.ts +1 -1
- package/dist/_internal/platform/runtime/events/contracts.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/contracts.js +3 -2
- package/dist/_internal/platform/runtime/events/routes.d.ts +5 -0
- package/dist/_internal/platform/runtime/events/routes.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/feature-flags/flags.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/feature-flags/flags.js +17 -21
- package/dist/_internal/platform/runtime/feature-flags/gates.d.ts +7 -0
- package/dist/_internal/platform/runtime/feature-flags/gates.d.ts.map +1 -0
- package/dist/_internal/platform/runtime/feature-flags/gates.js +38 -0
- package/dist/_internal/platform/runtime/feature-flags/index.d.ts +2 -0
- package/dist/_internal/platform/runtime/feature-flags/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/feature-flags/index.js +1 -0
- package/dist/_internal/platform/runtime/mcp/index.d.ts +2 -1
- package/dist/_internal/platform/runtime/mcp/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/mcp/index.js +4 -1
- package/dist/_internal/platform/runtime/permissions/index.d.ts +20 -1
- package/dist/_internal/platform/runtime/permissions/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/permissions/index.js +27 -1
- package/dist/_internal/platform/runtime/permissions/policy-loader.d.ts +6 -0
- package/dist/_internal/platform/runtime/permissions/policy-loader.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/permissions/policy-loader.js +7 -2
- package/dist/_internal/platform/runtime/plugins/index.d.ts +2 -1
- package/dist/_internal/platform/runtime/plugins/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/plugins/index.js +4 -1
- package/dist/_internal/platform/runtime/services.d.ts +1 -0
- package/dist/_internal/platform/runtime/services.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/services.js +21 -5
- package/dist/_internal/platform/runtime/shell-command-ops.d.ts +2 -0
- package/dist/_internal/platform/runtime/shell-command-ops.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/shell-command-ops.js +4 -1
- package/dist/_internal/platform/runtime/tasks/index.d.ts +2 -1
- package/dist/_internal/platform/runtime/tasks/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/tasks/index.js +2 -2
- package/dist/_internal/platform/runtime/tasks/manager.d.ts +5 -1
- package/dist/_internal/platform/runtime/tasks/manager.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/tasks/manager.js +30 -1
- package/dist/_internal/platform/runtime/telemetry/index.d.ts +9 -3
- package/dist/_internal/platform/runtime/telemetry/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/telemetry/index.js +7 -4
- package/dist/_internal/platform/runtime/tools/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/tools/index.js +4 -1
- package/dist/_internal/platform/runtime/tools/types.d.ts +6 -0
- package/dist/_internal/platform/runtime/tools/types.d.ts.map +1 -1
- package/dist/_internal/platform/security/token-audit.d.ts +7 -0
- package/dist/_internal/platform/security/token-audit.d.ts.map +1 -1
- package/dist/_internal/platform/security/token-audit.js +6 -2
- package/dist/_internal/platform/state/mode-manager.d.ts +7 -0
- package/dist/_internal/platform/state/mode-manager.d.ts.map +1 -1
- package/dist/_internal/platform/state/mode-manager.js +25 -0
- package/dist/_internal/platform/tools/index.d.ts +4 -0
- package/dist/_internal/platform/tools/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/index.js +37 -23
- package/dist/_internal/platform/tools/shared/overflow.d.ts +3 -0
- package/dist/_internal/platform/tools/shared/overflow.d.ts.map +1 -1
- package/dist/_internal/platform/tools/shared/overflow.js +6 -2
- package/dist/_internal/platform/version.js +1 -1
- package/dist/_internal/platform/watchers/registry.d.ts +6 -0
- package/dist/_internal/platform/watchers/registry.d.ts.map +1 -1
- package/dist/_internal/platform/watchers/registry.js +35 -0
- package/package.json +9 -8
- package/vendor/bash-language-server/CHANGELOG.md +453 -0
- package/vendor/bash-language-server/GOODVIBES_PATCH.md +22 -0
- package/vendor/bash-language-server/README.md +230 -0
- package/vendor/bash-language-server/out/analyser.d.ts +187 -0
- package/vendor/bash-language-server/out/analyser.js +782 -0
- package/vendor/bash-language-server/out/analyser.js.map +1 -0
- package/vendor/bash-language-server/out/builtins.d.ts +2 -0
- package/vendor/bash-language-server/out/builtins.js +71 -0
- package/vendor/bash-language-server/out/builtins.js.map +1 -0
- package/vendor/bash-language-server/out/cli.d.ts +3 -0
- package/vendor/bash-language-server/out/cli.js +74 -0
- package/vendor/bash-language-server/out/cli.js.map +1 -0
- package/vendor/bash-language-server/out/config.d.ts +88 -0
- package/vendor/bash-language-server/out/config.js +96 -0
- package/vendor/bash-language-server/out/config.js.map +1 -0
- package/vendor/bash-language-server/out/executables.d.ts +19 -0
- package/vendor/bash-language-server/out/executables.js +86 -0
- package/vendor/bash-language-server/out/executables.js.map +1 -0
- package/vendor/bash-language-server/out/parser.d.ts +2 -0
- package/vendor/bash-language-server/out/parser.js +36 -0
- package/vendor/bash-language-server/out/parser.js.map +1 -0
- package/vendor/bash-language-server/out/reserved-words.d.ts +2 -0
- package/vendor/bash-language-server/out/reserved-words.js +33 -0
- package/vendor/bash-language-server/out/reserved-words.js.map +1 -0
- package/vendor/bash-language-server/out/server.d.ts +56 -0
- package/vendor/bash-language-server/out/server.js +756 -0
- package/vendor/bash-language-server/out/server.js.map +1 -0
- package/vendor/bash-language-server/out/shellcheck/config.d.ts +5 -0
- package/vendor/bash-language-server/out/shellcheck/config.js +17 -0
- package/vendor/bash-language-server/out/shellcheck/config.js.map +1 -0
- package/vendor/bash-language-server/out/shellcheck/directive.d.ts +18 -0
- package/vendor/bash-language-server/out/shellcheck/directive.js +62 -0
- package/vendor/bash-language-server/out/shellcheck/directive.js.map +1 -0
- package/vendor/bash-language-server/out/shellcheck/index.d.ts +22 -0
- package/vendor/bash-language-server/out/shellcheck/index.js +229 -0
- package/vendor/bash-language-server/out/shellcheck/index.js.map +1 -0
- package/vendor/bash-language-server/out/shellcheck/types.d.ts +175 -0
- package/vendor/bash-language-server/out/shellcheck/types.js +35 -0
- package/vendor/bash-language-server/out/shellcheck/types.js.map +1 -0
- package/vendor/bash-language-server/out/shfmt/index.d.ts +18 -0
- package/vendor/bash-language-server/out/shfmt/index.js +151 -0
- package/vendor/bash-language-server/out/shfmt/index.js.map +1 -0
- package/vendor/bash-language-server/out/snippets.d.ts +2 -0
- package/vendor/bash-language-server/out/snippets.js +671 -0
- package/vendor/bash-language-server/out/snippets.js.map +1 -0
- package/vendor/bash-language-server/out/types.d.ts +13 -0
- package/vendor/bash-language-server/out/types.js +12 -0
- package/vendor/bash-language-server/out/types.js.map +1 -0
- package/vendor/bash-language-server/out/util/array.d.ts +14 -0
- package/vendor/bash-language-server/out/util/array.js +36 -0
- package/vendor/bash-language-server/out/util/array.js.map +1 -0
- package/vendor/bash-language-server/out/util/async.d.ts +13 -0
- package/vendor/bash-language-server/out/util/async.js +24 -0
- package/vendor/bash-language-server/out/util/async.js.map +1 -0
- package/vendor/bash-language-server/out/util/declarations.d.ts +88 -0
- package/vendor/bash-language-server/out/util/declarations.js +295 -0
- package/vendor/bash-language-server/out/util/declarations.js.map +1 -0
- package/vendor/bash-language-server/out/util/discriminate.d.ts +1 -0
- package/vendor/bash-language-server/out/util/discriminate.js +7 -0
- package/vendor/bash-language-server/out/util/discriminate.js.map +1 -0
- package/vendor/bash-language-server/out/util/fs.d.ts +6 -0
- package/vendor/bash-language-server/out/util/fs.js +73 -0
- package/vendor/bash-language-server/out/util/fs.js.map +1 -0
- package/vendor/bash-language-server/out/util/logger.d.ts +35 -0
- package/vendor/bash-language-server/out/util/logger.js +105 -0
- package/vendor/bash-language-server/out/util/logger.js.map +1 -0
- package/vendor/bash-language-server/out/util/lsp.d.ts +5 -0
- package/vendor/bash-language-server/out/util/lsp.js +13 -0
- package/vendor/bash-language-server/out/util/lsp.js.map +1 -0
- package/vendor/bash-language-server/out/util/platform.d.ts +1 -0
- package/vendor/bash-language-server/out/util/platform.js +7 -0
- package/vendor/bash-language-server/out/util/platform.js.map +1 -0
- package/vendor/bash-language-server/out/util/sh.d.ts +16 -0
- package/vendor/bash-language-server/out/util/sh.js +132 -0
- package/vendor/bash-language-server/out/util/sh.js.map +1 -0
- package/vendor/bash-language-server/out/util/shebang.d.ts +10 -0
- package/vendor/bash-language-server/out/util/shebang.js +53 -0
- package/vendor/bash-language-server/out/util/shebang.js.map +1 -0
- package/vendor/bash-language-server/out/util/sourcing.d.ts +15 -0
- package/vendor/bash-language-server/out/util/sourcing.js +182 -0
- package/vendor/bash-language-server/out/util/sourcing.js.map +1 -0
- package/vendor/bash-language-server/out/util/tree-sitter.d.ts +22 -0
- package/vendor/bash-language-server/out/util/tree-sitter.js +110 -0
- package/vendor/bash-language-server/out/util/tree-sitter.js.map +1 -0
- package/vendor/bash-language-server/package.json +52 -0
- package/vendor/bash-language-server/parser.info +2 -0
- package/vendor/bash-language-server/tree-sitter-bash.wasm +0 -0
- package/scripts/postinstall-patch-minimatch.mjs +0 -285
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as LSP from 'vscode-languageserver/node';
|
|
2
|
+
import { TextDocument, TextEdit } from 'vscode-languageserver-textdocument';
|
|
3
|
+
type FormatterOptions = {
|
|
4
|
+
executablePath: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class Formatter {
|
|
8
|
+
private cwd;
|
|
9
|
+
executablePath: string;
|
|
10
|
+
private _canFormat;
|
|
11
|
+
constructor({ cwd, executablePath }: FormatterOptions);
|
|
12
|
+
get canFormat(): boolean;
|
|
13
|
+
format(document: TextDocument, formatOptions?: LSP.FormattingOptions | null, shfmtConfig?: Record<string, string | boolean> | null): Promise<TextEdit[]>;
|
|
14
|
+
private executeFormat;
|
|
15
|
+
private getShfmtArguments;
|
|
16
|
+
private runShfmt;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Formatter = void 0;
|
|
13
|
+
const child_process_1 = require("child_process");
|
|
14
|
+
const editorconfig = require("editorconfig");
|
|
15
|
+
const LSP = require("vscode-languageserver/node");
|
|
16
|
+
const logger_1 = require("../util/logger");
|
|
17
|
+
class Formatter {
|
|
18
|
+
constructor({ cwd, executablePath }) {
|
|
19
|
+
this._canFormat = true;
|
|
20
|
+
this.cwd = cwd || process.cwd();
|
|
21
|
+
this.executablePath = executablePath;
|
|
22
|
+
}
|
|
23
|
+
get canFormat() {
|
|
24
|
+
return this._canFormat;
|
|
25
|
+
}
|
|
26
|
+
format(document, formatOptions, shfmtConfig) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
if (!this._canFormat) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
return this.executeFormat(document, formatOptions, shfmtConfig);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
executeFormat(document, formatOptions, shfmtConfig) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const result = yield this.runShfmt(document, formatOptions, shfmtConfig);
|
|
37
|
+
if (!this._canFormat) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
range: LSP.Range.create(LSP.Position.create(0, 0), LSP.Position.create(Number.MAX_VALUE, Number.MAX_VALUE)),
|
|
43
|
+
newText: result,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getShfmtArguments(documentUri, formatOptions, lspShfmtConfig) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const args = [];
|
|
51
|
+
// this is the config that we'll use to build args - default to language server config
|
|
52
|
+
let activeShfmtConfig = Object.assign({}, lspShfmtConfig);
|
|
53
|
+
// do we have a document stored on the local filesystem?
|
|
54
|
+
const filepathMatch = documentUri.match(/^file:\/\/(.*)$/);
|
|
55
|
+
if (filepathMatch) {
|
|
56
|
+
const filepath = filepathMatch[1];
|
|
57
|
+
args.push(`--filename=${filepathMatch[1]}`);
|
|
58
|
+
if (!(lspShfmtConfig === null || lspShfmtConfig === void 0 ? void 0 : lspShfmtConfig.ignoreEditorconfig)) {
|
|
59
|
+
const editorconfigProperties = yield editorconfig.parse(filepath);
|
|
60
|
+
logger_1.logger.debug(`Shfmt: found .editorconfig properties: ${JSON.stringify(editorconfigProperties)}`);
|
|
61
|
+
const editorconfigShfmtConfig = {};
|
|
62
|
+
editorconfigShfmtConfig.binaryNextLine = editorconfigProperties.binary_next_line;
|
|
63
|
+
editorconfigShfmtConfig.caseIndent = editorconfigProperties.switch_case_indent;
|
|
64
|
+
editorconfigShfmtConfig.funcNextLine = editorconfigProperties.function_next_line;
|
|
65
|
+
editorconfigShfmtConfig.keepPadding = editorconfigProperties.keep_padding;
|
|
66
|
+
// --simplify is not supported via .editorconfig
|
|
67
|
+
editorconfigShfmtConfig.spaceRedirects = editorconfigProperties.space_redirects;
|
|
68
|
+
editorconfigShfmtConfig.languageDialect = editorconfigProperties.shell_variant;
|
|
69
|
+
// if we have any shfmt-specific options in .editorconfig, use the config in .editorconfig and
|
|
70
|
+
// ignore the language server config (this is similar to shfmt's approach of using either
|
|
71
|
+
// .editorconfig or command line flags, but not both)
|
|
72
|
+
if (editorconfigShfmtConfig.binaryNextLine !== undefined ||
|
|
73
|
+
editorconfigShfmtConfig.caseIndent !== undefined ||
|
|
74
|
+
editorconfigShfmtConfig.funcNextLine !== undefined ||
|
|
75
|
+
editorconfigShfmtConfig.keepPadding !== undefined ||
|
|
76
|
+
editorconfigShfmtConfig.spaceRedirects !== undefined ||
|
|
77
|
+
editorconfigShfmtConfig.languageDialect !== undefined) {
|
|
78
|
+
logger_1.logger.debug('Shfmt: detected shfmt properties in .editorconfig - ignoring language server shfmt config');
|
|
79
|
+
activeShfmtConfig = Object.assign({}, editorconfigShfmtConfig);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
logger_1.logger.debug('Shfmt: no shfmt properties found in .editorconfig - using language server shfmt config');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
logger_1.logger.debug('Shfmt: configured to ignore .editorconfig - using language server shfmt config');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// indentation always comes via the editor - if someone is using .editorconfig then the
|
|
90
|
+
// expectation is that they will have configured their editor's indentation in this way too
|
|
91
|
+
const indentation = (formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.insertSpaces) ? formatOptions.tabSize : 0;
|
|
92
|
+
args.push(`-i=${indentation}`); // --indent
|
|
93
|
+
if (activeShfmtConfig === null || activeShfmtConfig === void 0 ? void 0 : activeShfmtConfig.binaryNextLine)
|
|
94
|
+
args.push('-bn'); // --binary-next-line
|
|
95
|
+
if (activeShfmtConfig === null || activeShfmtConfig === void 0 ? void 0 : activeShfmtConfig.caseIndent)
|
|
96
|
+
args.push('-ci'); // --case-indent
|
|
97
|
+
if (activeShfmtConfig === null || activeShfmtConfig === void 0 ? void 0 : activeShfmtConfig.funcNextLine)
|
|
98
|
+
args.push('-fn'); // --func-next-line
|
|
99
|
+
if (activeShfmtConfig === null || activeShfmtConfig === void 0 ? void 0 : activeShfmtConfig.keepPadding)
|
|
100
|
+
args.push('-kp'); // --keep-padding
|
|
101
|
+
if (activeShfmtConfig === null || activeShfmtConfig === void 0 ? void 0 : activeShfmtConfig.simplifyCode)
|
|
102
|
+
args.push('-s'); // --simplify
|
|
103
|
+
if (activeShfmtConfig === null || activeShfmtConfig === void 0 ? void 0 : activeShfmtConfig.spaceRedirects)
|
|
104
|
+
args.push('-sr'); // --space-redirects
|
|
105
|
+
if (activeShfmtConfig === null || activeShfmtConfig === void 0 ? void 0 : activeShfmtConfig.languageDialect)
|
|
106
|
+
args.push(`-ln=${activeShfmtConfig.languageDialect}`); // --language-dialect
|
|
107
|
+
return args;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
runShfmt(document, formatOptions, shfmtConfig) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const args = yield this.getShfmtArguments(document.uri, formatOptions, shfmtConfig);
|
|
113
|
+
logger_1.logger.debug(`Shfmt: running "${this.executablePath} ${args.join(' ')}"`);
|
|
114
|
+
let out = '';
|
|
115
|
+
let err = '';
|
|
116
|
+
const proc = new Promise((resolve, reject) => {
|
|
117
|
+
const proc = (0, child_process_1.spawn)(this.executablePath, [...args, '-'], { cwd: this.cwd });
|
|
118
|
+
proc.on('error', reject);
|
|
119
|
+
proc.on('close', resolve);
|
|
120
|
+
proc.stdout.on('data', (data) => (out += data));
|
|
121
|
+
proc.stderr.on('data', (data) => (err += data));
|
|
122
|
+
proc.stdin.on('error', () => {
|
|
123
|
+
// NOTE: Ignore STDIN errors in case the process ends too quickly, before we try to
|
|
124
|
+
// write. If we write after the process ends without this, we get an uncatchable EPIPE.
|
|
125
|
+
// This is solved in Node >= 15.1 by the "on('spawn', ...)" event, but we need to
|
|
126
|
+
// support earlier versions.
|
|
127
|
+
});
|
|
128
|
+
proc.stdin.end(document.getText());
|
|
129
|
+
});
|
|
130
|
+
let exit;
|
|
131
|
+
try {
|
|
132
|
+
exit = yield proc;
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
if (e.code === 'ENOENT') {
|
|
136
|
+
// shfmt path wasn't found, don't try to format any more:
|
|
137
|
+
logger_1.logger.warn(`Shfmt: disabling formatting as no executable was found at path '${this.executablePath}'`);
|
|
138
|
+
this._canFormat = false;
|
|
139
|
+
return '';
|
|
140
|
+
}
|
|
141
|
+
throw new Error(`Shfmt: child process error: ${e}`);
|
|
142
|
+
}
|
|
143
|
+
if (exit != 0) {
|
|
144
|
+
throw new Error(`Shfmt: exited with status ${exit}: ${err}`);
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.Formatter = Formatter;
|
|
151
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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