diff options
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/external-editor/main')
10 files changed, 0 insertions, 435 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/CreateFileError.d.ts b/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/CreateFileError.d.ts deleted file mode 100644 index 0df1b3d7..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/CreateFileError.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 - */ -export declare class CreateFileError extends Error { - originalError: Error; - constructor(originalError: Error); -} diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/CreateFileError.js b/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/CreateFileError.js deleted file mode 100644 index 7faa34c8..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/CreateFileError.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 - */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var CreateFileError = /** @class */ (function (_super) { - __extends(CreateFileError, _super); - function CreateFileError(originalError) { - var _newTarget = this.constructor; - var _this = _super.call(this, "Failed to create temporary file for editor") || this; - _this.originalError = originalError; - var proto = _newTarget.prototype; - if (Object.setPrototypeOf) { - Object.setPrototypeOf(_this, proto); - } - else { - _this.__proto__ = _newTarget.prototype; - } - return _this; - } - return CreateFileError; -}(Error)); -exports.CreateFileError = CreateFileError; diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/LaunchEditorError.d.ts b/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/LaunchEditorError.d.ts deleted file mode 100644 index 105077cc..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/LaunchEditorError.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 - */ -export declare class LaunchEditorError extends Error { - originalError: Error; - constructor(originalError: Error); -} diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/LaunchEditorError.js b/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/LaunchEditorError.js deleted file mode 100644 index 85a164e7..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/LaunchEditorError.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 - */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var LaunchEditorError = /** @class */ (function (_super) { - __extends(LaunchEditorError, _super); - function LaunchEditorError(originalError) { - var _newTarget = this.constructor; - var _this = _super.call(this, "Failed launch editor") || this; - _this.originalError = originalError; - var proto = _newTarget.prototype; - if (Object.setPrototypeOf) { - Object.setPrototypeOf(_this, proto); - } - else { - _this.__proto__ = _newTarget.prototype; - } - return _this; - } - return LaunchEditorError; -}(Error)); -exports.LaunchEditorError = LaunchEditorError; diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/ReadFileError.d.ts b/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/ReadFileError.d.ts deleted file mode 100644 index 438eae1c..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/ReadFileError.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 - */ -export declare class ReadFileError extends Error { - originalError: Error; - constructor(originalError: Error); -} diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/ReadFileError.js b/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/ReadFileError.js deleted file mode 100644 index 69e05136..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/ReadFileError.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 - */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var ReadFileError = /** @class */ (function (_super) { - __extends(ReadFileError, _super); - function ReadFileError(originalError) { - var _newTarget = this.constructor; - var _this = _super.call(this, "Failed to read temporary file") || this; - _this.originalError = originalError; - var proto = _newTarget.prototype; - if (Object.setPrototypeOf) { - Object.setPrototypeOf(_this, proto); - } - else { - _this.__proto__ = _newTarget.prototype; - } - return _this; - } - return ReadFileError; -}(Error)); -exports.ReadFileError = ReadFileError; diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/RemoveFileError.d.ts b/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/RemoveFileError.d.ts deleted file mode 100644 index a6402e41..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/RemoveFileError.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 - */ -export declare class RemoveFileError extends Error { - originalError: Error; - constructor(originalError: Error); -} diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/RemoveFileError.js b/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/RemoveFileError.js deleted file mode 100644 index 23d266f2..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/RemoveFileError.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2018 - */ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var RemoveFileError = /** @class */ (function (_super) { - __extends(RemoveFileError, _super); - function RemoveFileError(originalError) { - var _newTarget = this.constructor; - var _this = _super.call(this, "Failed to cleanup temporary file") || this; - _this.originalError = originalError; - var proto = _newTarget.prototype; - if (Object.setPrototypeOf) { - Object.setPrototypeOf(_this, proto); - } - else { - _this.__proto__ = _newTarget.prototype; - } - return _this; - } - return RemoveFileError; -}(Error)); -exports.RemoveFileError = RemoveFileError; diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/index.d.ts b/sandbox/testAppNevena/Front/node_modules/external-editor/main/index.d.ts deleted file mode 100644 index d1e2730c..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/index.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2019 - */ -import { CreateFileError } from "./errors/CreateFileError"; -import { LaunchEditorError } from "./errors/LaunchEditorError"; -import { ReadFileError } from "./errors/ReadFileError"; -import { RemoveFileError } from "./errors/RemoveFileError"; -export interface IEditorParams { - args: string[]; - bin: string; -} -export interface IFileOptions { - prefix?: string; - postfix?: string; - mode?: number; - template?: string; - dir?: string; -} -export declare type StringCallback = (err: Error, result: string) => void; -export declare type VoidCallback = () => void; -export { CreateFileError, LaunchEditorError, ReadFileError, RemoveFileError }; -export declare function edit(text?: string, fileOptions?: IFileOptions): string; -export declare function editAsync(text: string, callback: StringCallback, fileOptions?: IFileOptions): void; -export declare class ExternalEditor { - private static splitStringBySpace; - text: string; - tempFile: string; - editor: IEditorParams; - lastExitStatus: number; - private fileOptions; - readonly temp_file: string; - readonly last_exit_status: number; - constructor(text?: string, fileOptions?: IFileOptions); - run(): string; - runAsync(callback: StringCallback): void; - cleanup(): void; - private determineEditor; - private createTemporaryFile; - private readTemporaryFile; - private removeTemporaryFile; - private launchEditor; - private launchEditorAsync; -} diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/main/index.js b/sandbox/testAppNevena/Front/node_modules/external-editor/main/index.js deleted file mode 100644 index 258f3196..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/main/index.js +++ /dev/null @@ -1,193 +0,0 @@ -"use strict"; -/*** - * Node External Editor - * - * Kevin Gravier <kevin@mrkmg.com> - * MIT 2019 - */ -Object.defineProperty(exports, "__esModule", { value: true }); -var chardet_1 = require("chardet"); -var child_process_1 = require("child_process"); -var fs_1 = require("fs"); -var iconv_lite_1 = require("iconv-lite"); -var tmp_1 = require("tmp"); -var CreateFileError_1 = require("./errors/CreateFileError"); -exports.CreateFileError = CreateFileError_1.CreateFileError; -var LaunchEditorError_1 = require("./errors/LaunchEditorError"); -exports.LaunchEditorError = LaunchEditorError_1.LaunchEditorError; -var ReadFileError_1 = require("./errors/ReadFileError"); -exports.ReadFileError = ReadFileError_1.ReadFileError; -var RemoveFileError_1 = require("./errors/RemoveFileError"); -exports.RemoveFileError = RemoveFileError_1.RemoveFileError; -function edit(text, fileOptions) { - if (text === void 0) { text = ""; } - var editor = new ExternalEditor(text, fileOptions); - editor.run(); - editor.cleanup(); - return editor.text; -} -exports.edit = edit; -function editAsync(text, callback, fileOptions) { - if (text === void 0) { text = ""; } - var editor = new ExternalEditor(text, fileOptions); - editor.runAsync(function (err, result) { - if (err) { - setImmediate(callback, err, null); - } - else { - try { - editor.cleanup(); - setImmediate(callback, null, result); - } - catch (cleanupError) { - setImmediate(callback, cleanupError, null); - } - } - }); -} -exports.editAsync = editAsync; -var ExternalEditor = /** @class */ (function () { - function ExternalEditor(text, fileOptions) { - if (text === void 0) { text = ""; } - this.text = ""; - this.fileOptions = {}; - this.text = text; - if (fileOptions) { - this.fileOptions = fileOptions; - } - this.determineEditor(); - this.createTemporaryFile(); - } - ExternalEditor.splitStringBySpace = function (str) { - var pieces = []; - var currentString = ""; - for (var strIndex = 0; strIndex < str.length; strIndex++) { - var currentLetter = str[strIndex]; - if (strIndex > 0 && currentLetter === " " && str[strIndex - 1] !== "\\" && currentString.length > 0) { - pieces.push(currentString); - currentString = ""; - } - else { - currentString += currentLetter; - } - } - if (currentString.length > 0) { - pieces.push(currentString); - } - return pieces; - }; - Object.defineProperty(ExternalEditor.prototype, "temp_file", { - get: function () { - console.log("DEPRECATED: temp_file. Use tempFile moving forward."); - return this.tempFile; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ExternalEditor.prototype, "last_exit_status", { - get: function () { - console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."); - return this.lastExitStatus; - }, - enumerable: true, - configurable: true - }); - ExternalEditor.prototype.run = function () { - this.launchEditor(); - this.readTemporaryFile(); - return this.text; - }; - ExternalEditor.prototype.runAsync = function (callback) { - var _this = this; - try { - this.launchEditorAsync(function () { - try { - _this.readTemporaryFile(); - setImmediate(callback, null, _this.text); - } - catch (readError) { - setImmediate(callback, readError, null); - } - }); - } - catch (launchError) { - setImmediate(callback, launchError, null); - } - }; - ExternalEditor.prototype.cleanup = function () { - this.removeTemporaryFile(); - }; - ExternalEditor.prototype.determineEditor = function () { - var editor = process.env.VISUAL ? process.env.VISUAL : - process.env.EDITOR ? process.env.EDITOR : - /^win/.test(process.platform) ? "notepad" : - "vim"; - var editorOpts = ExternalEditor.splitStringBySpace(editor).map(function (piece) { return piece.replace("\\ ", " "); }); - var bin = editorOpts.shift(); - this.editor = { args: editorOpts, bin: bin }; - }; - ExternalEditor.prototype.createTemporaryFile = function () { - try { - this.tempFile = tmp_1.tmpNameSync(this.fileOptions); - var opt = { encoding: "utf8" }; - if (this.fileOptions.hasOwnProperty("mode")) { - opt.mode = this.fileOptions.mode; - } - fs_1.writeFileSync(this.tempFile, this.text, opt); - } - catch (createFileError) { - throw new CreateFileError_1.CreateFileError(createFileError); - } - }; - ExternalEditor.prototype.readTemporaryFile = function () { - try { - var tempFileBuffer = fs_1.readFileSync(this.tempFile); - if (tempFileBuffer.length === 0) { - this.text = ""; - } - else { - var encoding = chardet_1.detect(tempFileBuffer).toString(); - if (!iconv_lite_1.encodingExists(encoding)) { - // Probably a bad idea, but will at least prevent crashing - encoding = "utf8"; - } - this.text = iconv_lite_1.decode(tempFileBuffer, encoding); - } - } - catch (readFileError) { - throw new ReadFileError_1.ReadFileError(readFileError); - } - }; - ExternalEditor.prototype.removeTemporaryFile = function () { - try { - fs_1.unlinkSync(this.tempFile); - } - catch (removeFileError) { - throw new RemoveFileError_1.RemoveFileError(removeFileError); - } - }; - ExternalEditor.prototype.launchEditor = function () { - try { - var editorProcess = child_process_1.spawnSync(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" }); - this.lastExitStatus = editorProcess.status; - } - catch (launchError) { - throw new LaunchEditorError_1.LaunchEditorError(launchError); - } - }; - ExternalEditor.prototype.launchEditorAsync = function (callback) { - var _this = this; - try { - var editorProcess = child_process_1.spawn(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" }); - editorProcess.on("exit", function (code) { - _this.lastExitStatus = code; - setImmediate(callback); - }); - } - catch (launchError) { - throw new LaunchEditorError_1.LaunchEditorError(launchError); - } - }; - return ExternalEditor; -}()); -exports.ExternalEditor = ExternalEditor; |