@lydell/node-pty 1.1.0 → 1.2.0-beta.2

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/LICENSE CHANGED
@@ -1,52 +1,6 @@
1
- Copyright (c) 2012-2015, Christopher Jeffrey (https://github.com/chjj/)
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
20
-
21
-
22
-
23
- The MIT License (MIT)
24
-
25
- Copyright (c) 2016, Daniel Imms (http://www.growingwiththeweb.com)
26
-
27
- Permission is hereby granted, free of charge, to any person obtaining a copy
28
- of this software and associated documentation files (the "Software"), to deal
29
- in the Software without restriction, including without limitation the rights
30
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
- copies of the Software, and to permit persons to whom the Software is
32
- furnished to do so, subject to the following conditions:
33
-
34
- The above copyright notice and this permission notice shall be included in all
35
- copies or substantial portions of the Software.
36
-
37
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
- SOFTWARE.
44
-
45
-
46
-
47
1
  MIT License
48
2
 
49
- Copyright (c) 2018 - present Microsoft Corporation
3
+ Copyright (c) 2026 Simon Lydell
50
4
 
51
5
  All rights reserved.
52
6
 
package/README.md CHANGED
@@ -1,9 +1,18 @@
1
1
  # @lydell/node-pty
2
2
 
3
- Fork of [microsoft/node-pty](https://github.com/microsoft/node-pty) with prebuilt binaries.
3
+ Smaller distribution of [microsoft/node-pty](https://github.com/microsoft/node-pty).
4
4
 
5
- - Only supports platforms with prebuilt binaries. (Never builds with node-gyp at install.)
6
- - Removed support for old versions of Windows. (Removed winpty, only supports conpty.)
5
+ - microsoft/node-pty ships with prebuilt binaries for multiple platforms. @lydell/node-pty only installs the prebuilt binaries needed for the current platform (depends on your package manager).
6
+ - microsoft/node-pty supports compiling using node-gyp on unsupported platforms, which requires more source files. @lydell/node-pty only works on platforms with prebuilt binaries and never calls node-gyp.
7
+ - microsoft/node-pty ships with unneeded files, such as source code TypeScript files, source maps and test files. @lydell/node-pty removes those.
8
+ - microsoft/node-pty is about 60 MiB. @lydell/node-pty is less than 1 MiB on macOS and Linux, and around 30 MiB on Windows.
9
+
10
+ @lydell/node-pty is built like this:
11
+
12
+ 1. Download the original node-pty npm package.
13
+ 2. Make one copy of it per supported platform.
14
+ 3. For each copy, only include relevant files.
15
+ 4. Make the @lydell/node-pty wrapper package, which depends on all the platform-specific packages using `"optionalDependencies"` in package.json, allowing package managers to only install the platform-specific package matching the current platform. The wrapper package only re-exports everything from the correct platform-specific package.
7
16
 
8
17
  ## pty.js
9
18
 
@@ -17,15 +26,15 @@ Copyright (c) 2018, Microsoft Corporation (MIT License).
17
26
 
18
27
  ## Version
19
28
 
20
- @lydell/node-pty@1.1.0 is based on node-pty@1.1.0-beta14 (commit [efbf8ebbe7b09351548fa0a4ed07b36c5d2e539b](https://github.com/microsoft/node-pty/commit/efbf8ebbe7b09351548fa0a4ed07b36c5d2e539b)).
29
+ @lydell/node-pty@1.2.0-beta.2 is based on node-pty@1.2.0-beta.2.
21
30
 
22
31
  ## Prebuilt binaries
23
32
 
24
33
  This package includes prebuilt binaries for the following platforms and architectures:
25
34
 
26
- - macOS x86_64 (darwin-x64)
27
35
  - macOS ARM64 (darwin-arm64)
36
+ - macOS x86_64 (darwin-x64)
37
+ - Linux ARM64 (linux-arm64)
28
38
  - Linux x86_64 (linux-x64)
29
- - Linux ARM64 (linux-arm64) (not tested)
30
- - Windows x86_64 (win32-x64)
31
- - Windows ARM64 (win32-arm64) (not tested)
39
+ - Windows ARM64 (win32-arm64)
40
+ - Windows x86_64 (win32-x64)
package/index.js CHANGED
@@ -1,44 +1,41 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2012-2015, Christopher Jeffrey, Peter Sunde (MIT License)
4
- * Copyright (c) 2016, Daniel Imms (MIT License).
5
- * Copyright (c) 2018, Microsoft Corporation (MIT License).
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- var terminalCtor;
9
- if (process.platform === 'win32') {
10
- terminalCtor = require('./windowsTerminal').WindowsTerminal;
1
+ const PACKAGE_NAME = `@lydell/node-pty-${process.platform}-${process.arch}`;
2
+
3
+ const help = `
4
+ This can happen if you use the "--omit=optional" (or "--no-optional") npm flag.
5
+ The "optionalDependencies" package.json feature is used to install the correct
6
+ binary executable for your current platform. Remove that flag to use @lydell/node-pty.
7
+
8
+ This can also happen if the "node_modules" folder was copied between two operating systems
9
+ that need different binaries - including "virtual" operating systems like Docker and WSL.
10
+ If so, try installing with npm rather than copying "node_modules".
11
+ `.trim();
12
+
13
+ function requirePlatformSpecificPackage() {
14
+ try {
15
+ return require(PACKAGE_NAME);
16
+ } catch (error) {
17
+ if (error && error.code === "MODULE_NOT_FOUND") {
18
+ const optionalDependencies = getOptionalDependencies();
19
+ throw new Error(
20
+ optionalDependencies === undefined
21
+ ? `The @lydell/node-pty package could not find the platform-specific package: ${PACKAGE_NAME}\n\n${help}\n\nYour platform (${process.platform}-${process.arch}) might not be supported.`
22
+ : PACKAGE_NAME in optionalDependencies
23
+ ? `The @lydell/node-pty package supports your platform (${process.platform}-${process.arch}), but it could not find the platform-specific package for it: ${PACKAGE_NAME}\n\n${help}`
24
+ : `The @lydell/node-pty package currently does not support your platform: ${process.platform}-${process.arch}`,
25
+ { cause: error }
26
+ );
27
+ } else {
28
+ throw error;
29
+ }
30
+ }
11
31
  }
12
- else {
13
- terminalCtor = require('./unixTerminal').UnixTerminal;
32
+
33
+ function getOptionalDependencies() {
34
+ try {
35
+ return require("./package.json").optionalDependencies;
36
+ } catch (_error) {
37
+ return undefined;
38
+ }
14
39
  }
15
- /**
16
- * Forks a process as a pseudoterminal.
17
- * @param file The file to launch.
18
- * @param args The file's arguments as argv (string[]) or in a pre-escaped
19
- * CommandLine format (string). Note that the CommandLine option is only
20
- * available on Windows and is expected to be escaped properly.
21
- * @param options The options of the terminal.
22
- * @throws When the file passed to spawn with does not exists.
23
- * @see CommandLineToArgvW https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391(v=vs.85).aspx
24
- * @see Parsing C++ Comamnd-Line Arguments https://msdn.microsoft.com/en-us/library/17w5ykft.aspx
25
- * @see GetCommandLine https://msdn.microsoft.com/en-us/library/windows/desktop/ms683156.aspx
26
- */
27
- function spawn(file, args, opt) {
28
- return new terminalCtor(file, args, opt);
29
- }
30
- exports.spawn = spawn;
31
- /** @deprecated */
32
- function fork(file, args, opt) {
33
- return new terminalCtor(file, args, opt);
34
- }
35
- exports.fork = fork;
36
- /** @deprecated */
37
- function createTerminal(file, args, opt) {
38
- return new terminalCtor(file, args, opt);
39
- }
40
- exports.createTerminal = createTerminal;
41
- function open(options) {
42
- return terminalCtor.open(options);
43
- }
44
- exports.open = open;
40
+
41
+ module.exports = requirePlatformSpecificPackage();
package/node-pty.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2018, Microsoft Corporation (MIT License).
4
4
  */
5
5
 
6
- declare module "@lydell/node-pty" {
6
+ declare module '@lydell/node-pty' {
7
7
  /**
8
8
  * Forks a process as a pseudoterminal.
9
9
  * @param file The file to launch.
@@ -86,6 +86,23 @@ declare module "@lydell/node-pty" {
86
86
  }
87
87
 
88
88
  export interface IWindowsPtyForkOptions extends IBasePtyForkOptions {
89
+ /**
90
+ * Whether to use the ConPTY system on Windows. When this is not set, ConPTY will be used when
91
+ * the Windows build number is >= 18309 (instead of winpty). Note that ConPTY is available from
92
+ * build 17134 but is too unstable to enable by default.
93
+ *
94
+ * This setting does nothing on non-Windows.
95
+ */
96
+ useConpty?: boolean;
97
+
98
+ /**
99
+ * (EXPERIMENTAL)
100
+ *
101
+ * Whether to use the conpty.dll shipped with the node-pty package instead of the one built into
102
+ * Windows. Defaults to false.
103
+ */
104
+ useConptyDll?: boolean;
105
+
89
106
  /**
90
107
  * Whether to use PSEUDOCONSOLE_INHERIT_CURSOR in conpty.
91
108
  * @see https://docs.microsoft.com/en-us/windows/console/createpseudoconsole
@@ -94,7 +111,7 @@ declare module "@lydell/node-pty" {
94
111
  }
95
112
 
96
113
  /**
97
- * An interface representing a pseudoterminal.
114
+ * An interface representing a pseudoterminal, on Windows this is emulated via the winpty library.
98
115
  */
99
116
  export interface IPty {
100
117
  /**
@@ -156,7 +173,7 @@ declare module "@lydell/node-pty" {
156
173
  * Writes data to the pty.
157
174
  * @param data The data to write.
158
175
  */
159
- write(data: string): void;
176
+ write(data: string | Buffer): void;
160
177
 
161
178
  /**
162
179
  * Kills the pty.
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@lydell/node-pty",
3
- "description": "node-pty with prebuilt binaries",
3
+ "description": "Smaller distribution of node-pty.",
4
4
  "author": "Simon Lydell",
5
- "version": "1.1.0",
5
+ "version": "1.2.0-beta.2",
6
6
  "license": "MIT",
7
- "main": "./index.js",
7
+ "type": "commonjs",
8
+ "exports": "./index.js",
8
9
  "types": "./node-pty.d.ts",
9
10
  "repository": {
10
11
  "type": "git",
@@ -21,11 +22,11 @@
21
22
  "prebuilt"
22
23
  ],
23
24
  "optionalDependencies": {
24
- "@lydell/node-pty-darwin-x64": "1.1.0",
25
- "@lydell/node-pty-darwin-arm64": "1.1.0",
26
- "@lydell/node-pty-linux-x64": "1.1.0",
27
- "@lydell/node-pty-linux-arm64": "1.1.0",
28
- "@lydell/node-pty-win32-x64": "1.1.0",
29
- "@lydell/node-pty-win32-arm64": "1.1.0"
25
+ "@lydell/node-pty-darwin-arm64": "1.2.0-beta.2",
26
+ "@lydell/node-pty-darwin-x64": "1.2.0-beta.2",
27
+ "@lydell/node-pty-linux-arm64": "1.2.0-beta.2",
28
+ "@lydell/node-pty-linux-x64": "1.2.0-beta.2",
29
+ "@lydell/node-pty-win32-arm64": "1.2.0-beta.2",
30
+ "@lydell/node-pty-win32-x64": "1.2.0-beta.2"
30
31
  }
31
32
  }
@@ -1,13 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2019, Microsoft Corporation (MIT License).
4
- *
5
- * This module fetches the console process list for a particular PID. It must be
6
- * called from a different process (child_process.fork) as there can only be a
7
- * single console attached to a process.
8
- */
9
- var getConsoleProcessList = require("@lydell/node-pty-" + process.platform + "-" + process.arch + "/conpty_console_list.node").getConsoleProcessList;
10
- var shellPid = parseInt(process.argv[2], 10);
11
- var consoleProcessList = getConsoleProcessList(shellPid);
12
- process.send({ consoleProcessList: consoleProcessList });
13
- process.exit(0);
package/eventEmitter2.js DELETED
@@ -1,45 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2019, Microsoft Corporation (MIT License).
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var EventEmitter2 = /** @class */ (function () {
7
- function EventEmitter2() {
8
- this._listeners = [];
9
- }
10
- Object.defineProperty(EventEmitter2.prototype, "event", {
11
- get: function () {
12
- var _this = this;
13
- if (!this._event) {
14
- this._event = function (listener) {
15
- _this._listeners.push(listener);
16
- var disposable = {
17
- dispose: function () {
18
- for (var i = 0; i < _this._listeners.length; i++) {
19
- if (_this._listeners[i] === listener) {
20
- _this._listeners.splice(i, 1);
21
- return;
22
- }
23
- }
24
- }
25
- };
26
- return disposable;
27
- };
28
- }
29
- return this._event;
30
- },
31
- enumerable: true,
32
- configurable: true
33
- });
34
- EventEmitter2.prototype.fire = function (data) {
35
- var queue = [];
36
- for (var i = 0; i < this._listeners.length; i++) {
37
- queue.push(this._listeners[i]);
38
- }
39
- for (var i = 0; i < queue.length; i++) {
40
- queue[i].call(undefined, data);
41
- }
42
- };
43
- return EventEmitter2;
44
- }());
45
- exports.EventEmitter2 = EventEmitter2;
package/interfaces.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2016, Daniel Imms (MIT License).
4
- * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
package/requireBinary.js DELETED
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var PACKAGE_NAME = "@lydell/node-pty-" + process.platform + "-" + process.arch;
4
- var help = "\nThis can happen if you use the \"--omit=optional\" (or \"--no-optional\") npm flag.\nThe \"optionalDependencies\" package.json feature is used to install the correct\nbinary executable for your current platform. Remove that flag to use @lydell/node-pty.\n\nThis can also happen if the \"node_modules\" folder was copied between two operating systems\nthat need different binaries - including \"virtual\" operating systems like Docker and WSL.\nIf so, try installing with npm rather than copying \"node_modules\".\n".trim();
5
- function requireBinary(file) {
6
- try {
7
- return require(PACKAGE_NAME + "/" + file);
8
- }
9
- catch (error) {
10
- if (error && error.code === 'MODULE_NOT_FOUND') {
11
- var optionalDependencies = getOptionalDependencies();
12
- throw new Error(optionalDependencies === undefined
13
- ? "The @lydell/node-pty package could not find the binary package: " + PACKAGE_NAME + "/" + file + "\n\n" + help + "\n\nYour platform (" + process.platform + "-" + process.arch + ") might not be supported."
14
- : PACKAGE_NAME in optionalDependencies
15
- ? "The @lydell/node-pty package supports your platform (" + process.platform + "-" + process.arch + "), but it could not find the binary package for it: " + PACKAGE_NAME + "/" + file + "\n\n" + help
16
- : "The @lydell/node-pty package currently does not support your platform: " + process.platform + "-" + process.arch,
17
- // @ts-ignore: The TypeScript setup does not seem to support cause.
18
- { cause: error });
19
- }
20
- else {
21
- throw error;
22
- }
23
- }
24
- }
25
- exports.requireBinary = requireBinary;
26
- function getOptionalDependencies() {
27
- try {
28
- return require('./package.json').optionalDependencies;
29
- }
30
- catch (_error) {
31
- return undefined;
32
- }
33
- }
package/shared/conout.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2020, Microsoft Corporation (MIT License).
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- function getWorkerPipeName(conoutPipeName) {
7
- return conoutPipeName + "-worker";
8
- }
9
- exports.getWorkerPipeName = getWorkerPipeName;
package/terminal.js DELETED
@@ -1,188 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2012-2015, Christopher Jeffrey (MIT License)
4
- * Copyright (c) 2016, Daniel Imms (MIT License).
5
- * Copyright (c) 2018, Microsoft Corporation (MIT License).
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- var events_1 = require("events");
9
- var eventEmitter2_1 = require("./eventEmitter2");
10
- exports.DEFAULT_COLS = 80;
11
- exports.DEFAULT_ROWS = 24;
12
- /**
13
- * Default messages to indicate PAUSE/RESUME for automatic flow control.
14
- * To avoid conflicts with rebound XON/XOFF control codes (such as on-my-zsh),
15
- * the sequences can be customized in `IPtyForkOptions`.
16
- */
17
- var FLOW_CONTROL_PAUSE = '\x13'; // defaults to XOFF
18
- var FLOW_CONTROL_RESUME = '\x11'; // defaults to XON
19
- var Terminal = /** @class */ (function () {
20
- function Terminal(opt) {
21
- this._pid = 0;
22
- this._fd = 0;
23
- this._cols = 0;
24
- this._rows = 0;
25
- this._readable = false;
26
- this._writable = false;
27
- this._onData = new eventEmitter2_1.EventEmitter2();
28
- this._onExit = new eventEmitter2_1.EventEmitter2();
29
- // for 'close'
30
- this._internalee = new events_1.EventEmitter();
31
- // setup flow control handling
32
- this.handleFlowControl = !!(opt === null || opt === void 0 ? void 0 : opt.handleFlowControl);
33
- this._flowControlPause = (opt === null || opt === void 0 ? void 0 : opt.flowControlPause) || FLOW_CONTROL_PAUSE;
34
- this._flowControlResume = (opt === null || opt === void 0 ? void 0 : opt.flowControlResume) || FLOW_CONTROL_RESUME;
35
- if (!opt) {
36
- return;
37
- }
38
- // Do basic type checks here in case node-pty is being used within JavaScript. If the wrong
39
- // types go through to the C++ side it can lead to hard to diagnose exceptions.
40
- this._checkType('name', opt.name ? opt.name : undefined, 'string');
41
- this._checkType('cols', opt.cols ? opt.cols : undefined, 'number');
42
- this._checkType('rows', opt.rows ? opt.rows : undefined, 'number');
43
- this._checkType('cwd', opt.cwd ? opt.cwd : undefined, 'string');
44
- this._checkType('env', opt.env ? opt.env : undefined, 'object');
45
- this._checkType('uid', opt.uid ? opt.uid : undefined, 'number');
46
- this._checkType('gid', opt.gid ? opt.gid : undefined, 'number');
47
- this._checkType('encoding', opt.encoding ? opt.encoding : undefined, 'string');
48
- }
49
- Object.defineProperty(Terminal.prototype, "onData", {
50
- get: function () { return this._onData.event; },
51
- enumerable: true,
52
- configurable: true
53
- });
54
- Object.defineProperty(Terminal.prototype, "onExit", {
55
- get: function () { return this._onExit.event; },
56
- enumerable: true,
57
- configurable: true
58
- });
59
- Object.defineProperty(Terminal.prototype, "pid", {
60
- get: function () { return this._pid; },
61
- enumerable: true,
62
- configurable: true
63
- });
64
- Object.defineProperty(Terminal.prototype, "cols", {
65
- get: function () { return this._cols; },
66
- enumerable: true,
67
- configurable: true
68
- });
69
- Object.defineProperty(Terminal.prototype, "rows", {
70
- get: function () { return this._rows; },
71
- enumerable: true,
72
- configurable: true
73
- });
74
- Terminal.prototype.write = function (data) {
75
- if (this.handleFlowControl) {
76
- // PAUSE/RESUME messages are not forwarded to the pty
77
- if (data === this._flowControlPause) {
78
- this.pause();
79
- return;
80
- }
81
- if (data === this._flowControlResume) {
82
- this.resume();
83
- return;
84
- }
85
- }
86
- // everything else goes to the real pty
87
- this._write(data);
88
- };
89
- Terminal.prototype._forwardEvents = function () {
90
- var _this = this;
91
- this.on('data', function (e) { return _this._onData.fire(e); });
92
- this.on('exit', function (exitCode, signal) { return _this._onExit.fire({ exitCode: exitCode, signal: signal }); });
93
- };
94
- Terminal.prototype._checkType = function (name, value, type, allowArray) {
95
- if (allowArray === void 0) { allowArray = false; }
96
- if (value === undefined) {
97
- return;
98
- }
99
- if (allowArray) {
100
- if (Array.isArray(value)) {
101
- value.forEach(function (v, i) {
102
- if (typeof v !== type) {
103
- throw new Error(name + "[" + i + "] must be a " + type + " (not a " + typeof v[i] + ")");
104
- }
105
- });
106
- return;
107
- }
108
- }
109
- if (typeof value !== type) {
110
- throw new Error(name + " must be a " + type + " (not a " + typeof value + ")");
111
- }
112
- };
113
- /** See net.Socket.end */
114
- Terminal.prototype.end = function (data) {
115
- this._socket.end(data);
116
- };
117
- /** See stream.Readable.pipe */
118
- Terminal.prototype.pipe = function (dest, options) {
119
- return this._socket.pipe(dest, options);
120
- };
121
- /** See net.Socket.pause */
122
- Terminal.prototype.pause = function () {
123
- return this._socket.pause();
124
- };
125
- /** See net.Socket.resume */
126
- Terminal.prototype.resume = function () {
127
- return this._socket.resume();
128
- };
129
- /** See net.Socket.setEncoding */
130
- Terminal.prototype.setEncoding = function (encoding) {
131
- if (this._socket._decoder) {
132
- delete this._socket._decoder;
133
- }
134
- if (encoding) {
135
- this._socket.setEncoding(encoding);
136
- }
137
- };
138
- Terminal.prototype.addListener = function (eventName, listener) { this.on(eventName, listener); };
139
- Terminal.prototype.on = function (eventName, listener) {
140
- if (eventName === 'close') {
141
- this._internalee.on('close', listener);
142
- return;
143
- }
144
- this._socket.on(eventName, listener);
145
- };
146
- Terminal.prototype.emit = function (eventName) {
147
- var args = [];
148
- for (var _i = 1; _i < arguments.length; _i++) {
149
- args[_i - 1] = arguments[_i];
150
- }
151
- if (eventName === 'close') {
152
- return this._internalee.emit.apply(this._internalee, arguments);
153
- }
154
- return this._socket.emit.apply(this._socket, arguments);
155
- };
156
- Terminal.prototype.listeners = function (eventName) {
157
- return this._socket.listeners(eventName);
158
- };
159
- Terminal.prototype.removeListener = function (eventName, listener) {
160
- this._socket.removeListener(eventName, listener);
161
- };
162
- Terminal.prototype.removeAllListeners = function (eventName) {
163
- this._socket.removeAllListeners(eventName);
164
- };
165
- Terminal.prototype.once = function (eventName, listener) {
166
- this._socket.once(eventName, listener);
167
- };
168
- Terminal.prototype._close = function () {
169
- this._socket.readable = false;
170
- this.write = function () { };
171
- this.end = function () { };
172
- this._writable = false;
173
- this._readable = false;
174
- };
175
- Terminal.prototype._parseEnv = function (env) {
176
- var keys = Object.keys(env || {});
177
- var pairs = [];
178
- for (var i = 0; i < keys.length; i++) {
179
- if (keys[i] === undefined) {
180
- continue;
181
- }
182
- pairs.push(keys[i] + '=' + env[keys[i]]);
183
- }
184
- return pairs;
185
- };
186
- return Terminal;
187
- }());
188
- exports.Terminal = Terminal;
package/types.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2017, Daniel Imms (MIT License).
4
- * Copyright (c) 2018, Microsoft Corporation (MIT License).
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });