From 6555fb80fdd8f6a5d201efadec3189d1244830a0 Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 22:05:25 +0100 Subject: Izbrisala bin, obj i node-modules. --- .../Front/node_modules/external-editor/LICENSE | 21 --- .../Front/node_modules/external-editor/README.md | 171 ------------------ .../node_modules/external-editor/example_async.js | 40 ----- .../node_modules/external-editor/example_sync.js | 38 ---- .../main/errors/CreateFileError.d.ts | 10 -- .../external-editor/main/errors/CreateFileError.js | 39 ----- .../main/errors/LaunchEditorError.d.ts | 10 -- .../main/errors/LaunchEditorError.js | 39 ----- .../external-editor/main/errors/ReadFileError.d.ts | 10 -- .../external-editor/main/errors/ReadFileError.js | 39 ----- .../main/errors/RemoveFileError.d.ts | 10 -- .../external-editor/main/errors/RemoveFileError.js | 39 ----- .../node_modules/external-editor/main/index.d.ts | 46 ----- .../node_modules/external-editor/main/index.js | 193 --------------------- .../node_modules/external-editor/package.json | 61 ------- 15 files changed, 766 deletions(-) delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/LICENSE delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/README.md delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/example_async.js delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/example_sync.js delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/CreateFileError.d.ts delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/CreateFileError.js delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/LaunchEditorError.d.ts delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/LaunchEditorError.js delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/ReadFileError.d.ts delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/ReadFileError.js delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/RemoveFileError.d.ts delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/errors/RemoveFileError.js delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/index.d.ts delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/main/index.js delete mode 100644 sandbox/testAppNevena/Front/node_modules/external-editor/package.json (limited to 'sandbox/testAppNevena/Front/node_modules/external-editor') diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/LICENSE b/sandbox/testAppNevena/Front/node_modules/external-editor/LICENSE deleted file mode 100644 index f5f61859..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Kevin Gravier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/README.md b/sandbox/testAppNevena/Front/node_modules/external-editor/README.md deleted file mode 100644 index 53a8e701..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/README.md +++ /dev/null @@ -1,171 +0,0 @@ -# External Editor - -[![ExternalEditor on Travis CI](https://img.shields.io/travis/mrkmg/node-external-editor.svg?style=flat-square)](https://travis-ci.org/mrkmg/node-external-editor/branches) -[![ExternalEditor on NPM](https://img.shields.io/npm/v/external-editor.svg?style=flat-square)](https://www.npmjs.com/package/external-editor) -[![ExternalEditor uses the MIT](https://img.shields.io/npm/l/external-editor.svg?style=flat-square)](https://opensource.org/licenses/MIT) - - -A node module to edit a string with a users preferred text editor using $VISUAL or $ENVIRONMENT. - -Version: 3.1.0 - -As of version 3.0.0, the minimum version of node supported is 4. - -## Install - -`npm install external-editor --save` - -## Usage - -A simple example using the `.edit` convenience method - - import {edit} from "external-editor"; - const data = edit('\n\n# Please write your text above'); - console.log(data); - -A full featured example - - import {ExternalEditor, CreateFileError, ReadFileError, RemoveFileError} from "external-editor" - - try { - const editor = new ExternalEditor(); - const text = editor.run() // the text is also available in editor.text - - if (editor.last_exit_status !== 0) { - console.log("The editor exited with a non-zero code"); - } - } catch (err) { - if (err instanceOf CreateFileError) { - console.log('Failed to create the temporary file'); - } else if (err instanceOf ReadFileError) { - console.log('Failed to read the temporary file'); - } else if (err instanceOf LaunchEditorError) { - console.log('Failed to launch your editor'); - } else { - throw err; - } - } - - // Do things with the text - - // Eventually call the cleanup to remove the temporary file - try { - editor.cleanup(); - } catch (err) { - if (err instanceOf RemoveFileError) { - console.log('Failed to remove the temporary file'); - } else { - throw err - } - } - - -#### API -**Convenience Methods** - -- `edit(text, config)` - - `text` (string) *Optional* Defaults to empty string - - `config` (Config) *Optional* Options for temporary file creation - - **Returns** (string) The contents of the file - - Could throw `CreateFileError`, `ReadFileError`, or `LaunchEditorError`, or `RemoveFileError` -- `editAsync(text, callback, config)` - - `text` (string) *Optional* Defaults to empty string - - `callback` (function (error, text)) - - `error` could be of type `CreateFileError`, `ReadFileError`, or `LaunchEditorError`, or `RemoveFileError` - - `text`(string) The contents of the file - - `config` (Config) *Optional* Options for temporary file creation - - -**Errors** - -- `CreateFileError` Error thrown if the temporary file could not be created. -- `ReadFileError` Error thrown if the temporary file could not be read. -- `RemoveFileError` Error thrown if the temporary file could not be removed during cleanup. -- `LaunchEditorError` Error thrown if the editor could not be launched. - -**External Editor Public Methods** - -- `new ExternalEditor(text, config)` - - `text` (string) *Optional* Defaults to empty string - - `config` (Config) *Optional* Options for temporary file creation - - Could throw `CreateFileError` -- `run()` Launches the editor. - - **Returns** (string) The contents of the file - - Could throw `LaunchEditorError` or `ReadFileError` -- `runAsync(callback)` Launches the editor in an async way - - `callback` (function (error, text)) - - `error` could be of type `ReadFileError` or `LaunchEditorError` - - `text`(string) The contents of the file -- `cleanup()` Removes the temporary file. - - Could throw `RemoveFileError` - -**External Editor Public Properties** - -- `text` (string) *readonly* The text in the temporary file. -- `editor.bin` (string) The editor determined from the environment. -- `editor.args` (array) Default arguments for the bin -- `tempFile` (string) Path to temporary file. Can be changed, but be careful as the temporary file probably already - exists and would need be removed manually. -- `lastExitStatus` (number) The last exit code emitted from the editor. - -**Config Options** - -- `prefix` (string) *Optional* A prefix for the file name. -- `postfix` (string; *Optional* A postfix for the file name. Useful if you want to provide an extension. -- `mode` (number) *Optional* Which mode to create the file with. e.g. 644 -- `template` (string) *Optional* A template for the filename. See [tmp](https://www.npmjs.com/package/tmp). -- `dir` (string) *Optional* Which path to store the file. - -## Errors - -All errors have a simple message explaining what went wrong. They all also have an `originalError` property containing -the original error thrown for debugging purposes. - -## Why Synchronous? - -Everything is synchronous to make sure the editor has complete control of the stdin and stdout. Testing has shown -async launching of the editor can lead to issues when using readline or other packages which try to read from stdin or -write to stdout. Seeing as this will be used in an interactive CLI environment, I made the decision to force the package -to be synchronous. If you know a reliable way to force all stdin and stdout to be limited only to the child_process, -please submit a PR. - -If async is really needed, you can use `editAsync` or `runAsync`. If you are using readline or have anything else -listening to the stdin or you write to stdout, you will most likely have problem, so make sure to remove any other -listeners on stdin, stdout, or stderr. - -## Demo - -[![asciicast](https://asciinema.org/a/a1qh9lypbe65mj0ivfuoslz2s.png)](https://asciinema.org/a/a1qh9lypbe65mj0ivfuoslz2s) - -## Breaking Changes from v2 to v3 - -- NodeJS 0.12 support dropped. -- Switched to named imports. -- All "snake_cased" variables and properties are now "camelCased". - - `ExternalEditor.temp_file` is now `ExternalEditor.tempFile`. - - `ExternalEditor.last_exit_status` is now `ExternalEditor.lastExitStatus`. - - `Error.original_error` is now `Error.originalError`. - -## License - -The MIT License (MIT) - -Copyright (c) 2016-2018 Kevin Gravier - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/example_async.js b/sandbox/testAppNevena/Front/node_modules/external-editor/example_async.js deleted file mode 100644 index 05261661..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/example_async.js +++ /dev/null @@ -1,40 +0,0 @@ -var ExternalEditor = require('./main').ExternalEditor; -var readline = require('readline'); - -var rl = readline.createInterface({ - input: process.stdin, - output: null -}); - -var message = '\n\n# Please Write a message\n# Any line starting with # is ignored'; - -process.stdout.write('Please write a message. (press enter to launch your preferred editor)'); - -editor = new ExternalEditor(message); - -rl.on('line', function () { - try { - rl.pause(); - editor.runAsync(function (error, response) - { - if (error) { - process.stdout.write(error.message); - process.exit(1); - } - if (response.length === 0) { - readline.moveCursor(process.stdout, 0, -1); - process.stdout.write('Your message was empty, please try again. (press enter to launch your preferred editor)'); - rl.resume(); - } else { - process.stdout.write('Your Message:\n'); - process.stdout.write(response); - process.stdout.write('\n'); - rl.close(); - } - }); - } catch (err) { - process.stderr.write(err.message); - process.stdout.write('\n'); - rl.close(); - } -}); diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/example_sync.js b/sandbox/testAppNevena/Front/node_modules/external-editor/example_sync.js deleted file mode 100644 index 4ebee95f..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/example_sync.js +++ /dev/null @@ -1,38 +0,0 @@ -var ExternalEditor = require('./main').ExternalEditor; -var readline = require('readline'); - -var rl = readline.createInterface({ - input: process.stdin, - output: null -}); - -var message = '\n\n# Please Write a message\n# Any line starting with # is ignored'; - -process.stdout.write('Please write a message. (press enter to launch your preferred editor)'); - -editor = new ExternalEditor(message); - -rl.on('line', function () { - try { - // Get response, remove all lines starting with #, remove any trailing newlines. - var response = editor.run().replace(/^#.*\n?/gm, '').replace(/\n+$/g, '').trim(); - - if (editor.lastExitStatus !== 0) { - process.stderr.write("WARN: The editor exited with a non-zero status\n\n") - } - - if (response.length === 0) { - readline.moveCursor(process.stdout, 0, -1); - process.stdout.write('Your message was empty, please try again. (press enter to launch your preferred editor)'); - } else { - process.stdout.write('Your Message:\n'); - process.stdout.write(response); - process.stdout.write('\n'); - rl.close(); - } - } catch (err) { - process.stderr.write(err.message); - process.stdout.write('\n'); - rl.close(); - } -}); 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 - * 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 - * 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 - * 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 - * 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 - * 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 - * 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 - * 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 - * 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 - * 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 - * 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; diff --git a/sandbox/testAppNevena/Front/node_modules/external-editor/package.json b/sandbox/testAppNevena/Front/node_modules/external-editor/package.json deleted file mode 100644 index b0e2474e..00000000 --- a/sandbox/testAppNevena/Front/node_modules/external-editor/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "external-editor", - "version": "3.1.0", - "description": "Edit a string with the users preferred text editor using $VISUAL or $ENVIRONMENT", - "main": "main/index.js", - "types": "main/index.d.ts", - "scripts": { - "test": "mocha --recursive --require ts-node/register --timeout 10000 ./test/spec 'test/spec/**/*.ts'", - "compile": "tsc -p tsconfig.json", - "lint": "tslint './src/**/*.ts' './test/**/*.ts'" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/mrkmg/node-external-editor.git" - }, - "keywords": [ - "editor", - "external", - "user", - "visual" - ], - "author": "Kevin Gravier (https://mrkmg.com)", - "license": "MIT", - "bugs": { - "url": "https://github.com/mrkmg/node-external-editor/issues" - }, - "homepage": "https://github.com/mrkmg/node-external-editor#readme", - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=4" - }, - "devDependencies": { - "@types/chai": "^4.1.4", - "@types/chardet": "^0.5.0", - "@types/mocha": "^5.2.5", - "@types/node": "^10.14.12", - "@types/tmp": "0.0.33", - "chai": "^4.0.0", - "es6-shim": "^0.35.3", - "mocha": "^5.2.0", - "ts-node": "^7.0.1", - "tslint": "^5.18.0", - "typescript": "^3.5.2" - }, - "files": [ - "main", - "example_sync.js", - "example_async.js" - ], - "config": { - "ndt": { - "versions": [ - "major" - ] - } - } -} -- cgit v1.2.3