spawn-term 3.0.2 → 3.0.3

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.
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createSession", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createSession;
9
+ }
10
+ });
11
+ function _getRequireWildcardCache(nodeInterop) {
12
+ if (typeof WeakMap !== "function") return null;
13
+ var cacheBabelInterop = new WeakMap();
14
+ var cacheNodeInterop = new WeakMap();
15
+ return (_getRequireWildcardCache = function(nodeInterop) {
16
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
+ })(nodeInterop);
18
+ }
19
+ function _interop_require_wildcard(obj, nodeInterop) {
20
+ if (!nodeInterop && obj && obj.__esModule) {
21
+ return obj;
22
+ }
23
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
+ return {
25
+ default: obj
26
+ };
27
+ }
28
+ var cache = _getRequireWildcardCache(nodeInterop);
29
+ if (cache && cache.has(obj)) {
30
+ return cache.get(obj);
31
+ }
32
+ var newObj = {
33
+ __proto__: null
34
+ };
35
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
36
+ for(var key in obj){
37
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
38
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
39
+ if (desc && (desc.get || desc.set)) {
40
+ Object.defineProperty(newObj, key, desc);
41
+ } else {
42
+ newObj[key] = obj[key];
43
+ }
44
+ }
45
+ }
46
+ newObj.default = obj;
47
+ if (cache) {
48
+ cache.set(obj, newObj);
49
+ }
50
+ return newObj;
51
+ }
52
+ function createSession(options) {
53
+ var realSession = null;
54
+ var loadError = null;
55
+ // Start loading immediately
56
+ Promise.resolve().then(function() {
57
+ return /*#__PURE__*/ _interop_require_wildcard(require("./session.js"));
58
+ }).then(function(mod) {
59
+ realSession = mod.createSession(options);
60
+ }).catch(function(err) {
61
+ loadError = err;
62
+ });
63
+ return {
64
+ spawn: function spawn(command, args, spawnOptions, processOptions, callback) {
65
+ if (loadError) {
66
+ callback(loadError);
67
+ return;
68
+ }
69
+ if (realSession) {
70
+ realSession.spawn(command, args, spawnOptions, processOptions, callback);
71
+ return;
72
+ }
73
+ // Still loading, wait for it
74
+ Promise.resolve().then(function() {
75
+ return /*#__PURE__*/ _interop_require_wildcard(require("./session.js"));
76
+ }).then(function(mod) {
77
+ if (!realSession) realSession = mod.createSession(options);
78
+ realSession.spawn(command, args, spawnOptions, processOptions, callback);
79
+ }).catch(callback);
80
+ },
81
+ close: function close() {
82
+ if (realSession) realSession.close();
83
+ },
84
+ waitAndClose: function waitAndClose(callback) {
85
+ if (realSession) {
86
+ realSession.waitAndClose(callback);
87
+ return;
88
+ }
89
+ // Still loading, wait for it
90
+ Promise.resolve().then(function() {
91
+ return /*#__PURE__*/ _interop_require_wildcard(require("./session.js"));
92
+ }).then(function(mod) {
93
+ if (!realSession) realSession = mod.createSession(options);
94
+ realSession.waitAndClose(callback);
95
+ }).catch(function() {
96
+ callback === null || callback === void 0 ? void 0 : callback();
97
+ });
98
+ }
99
+ };
100
+ }
101
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createSessionWrapper.ts"],"sourcesContent":["import type { ProcessOptions, SessionOptions, SpawnError, SpawnOptions, TerminalCallback } from './types.ts';\n\nexport interface Session {\n spawn(command: string, args: string[], spawnOptions: SpawnOptions, options: ProcessOptions, callback: TerminalCallback): void;\n close(): void;\n waitAndClose(callback?: () => void): void;\n}\n\nexport function createSession(options?: SessionOptions): Session {\n let realSession: Session | null = null;\n let loadError: SpawnError | null = null;\n\n // Start loading immediately\n import('./session.ts')\n .then((mod) => {\n realSession = mod.createSession(options);\n })\n .catch((err) => {\n loadError = err;\n });\n\n return {\n spawn(command: string, args: string[], spawnOptions: SpawnOptions, processOptions: ProcessOptions, callback: TerminalCallback): void {\n if (loadError) {\n callback(loadError);\n return;\n }\n if (realSession) {\n realSession.spawn(command, args, spawnOptions, processOptions, callback);\n return;\n }\n // Still loading, wait for it\n import('./session.ts')\n .then((mod) => {\n if (!realSession) realSession = mod.createSession(options);\n realSession.spawn(command, args, spawnOptions, processOptions, callback);\n })\n .catch(callback);\n },\n close(): void {\n if (realSession) realSession.close();\n },\n waitAndClose(callback?: () => void): void {\n if (realSession) {\n realSession.waitAndClose(callback);\n return;\n }\n // Still loading, wait for it\n import('./session.ts')\n .then((mod) => {\n if (!realSession) realSession = mod.createSession(options);\n realSession.waitAndClose(callback);\n })\n .catch(() => {\n callback?.();\n });\n },\n };\n}\n"],"names":["createSession","options","realSession","loadError","then","mod","catch","err","spawn","command","args","spawnOptions","processOptions","callback","close","waitAndClose"],"mappings":";;;;+BAQgBA;;;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAT,SAASA,cAAcC,OAAwB;IACpD,IAAIC,cAA8B;IAClC,IAAIC,YAA+B;IAEnC,4BAA4B;IAC5B;uDAAA,QAAO;OACJC,IAAI,CAAC,SAACC;QACLH,cAAcG,IAAIL,aAAa,CAACC;IAClC,GACCK,KAAK,CAAC,SAACC;QACNJ,YAAYI;IACd;IAEF,OAAO;QACLC,OAAAA,SAAAA,MAAMC,OAAe,EAAEC,IAAc,EAAEC,YAA0B,EAAEC,cAA8B,EAAEC,QAA0B;YAC3H,IAAIV,WAAW;gBACbU,SAASV;gBACT;YACF;YACA,IAAID,aAAa;gBACfA,YAAYM,KAAK,CAACC,SAASC,MAAMC,cAAcC,gBAAgBC;gBAC/D;YACF;YACA,6BAA6B;YAC7B;+DAAA,QAAO;eACJT,IAAI,CAAC,SAACC;gBACL,IAAI,CAACH,aAAaA,cAAcG,IAAIL,aAAa,CAACC;gBAClDC,YAAYM,KAAK,CAACC,SAASC,MAAMC,cAAcC,gBAAgBC;YACjE,GACCP,KAAK,CAACO;QACX;QACAC,OAAAA,SAAAA;YACE,IAAIZ,aAAaA,YAAYY,KAAK;QACpC;QACAC,cAAAA,SAAAA,aAAaF,QAAqB;YAChC,IAAIX,aAAa;gBACfA,YAAYa,YAAY,CAACF;gBACzB;YACF;YACA,6BAA6B;YAC7B;+DAAA,QAAO;eACJT,IAAI,CAAC,SAACC;gBACL,IAAI,CAACH,aAAaA,cAAcG,IAAIL,aAAa,CAACC;gBAClDC,YAAYa,YAAY,CAACF;YAC3B,GACCP,KAAK,CAAC;gBACLO,qBAAAA,+BAAAA;YACF;QACJ;IACF;AACF"}
@@ -22,7 +22,7 @@ _export(exports, {
22
22
  var _figurests = /*#__PURE__*/ _interop_require_default(require("./lib/figures.js"));
23
23
  var _formatArgumentsts = /*#__PURE__*/ _interop_require_default(require("./lib/formatArguments.js"));
24
24
  _export_star(require("./types.js"), exports);
25
- var _sessionts = require("./session.js");
25
+ var _createSessionWrapperts = require("./createSessionWrapper.js");
26
26
  function _export_star(from, to) {
27
27
  Object.keys(from).forEach(function(k) {
28
28
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -42,5 +42,5 @@ function _interop_require_default(obj) {
42
42
  };
43
43
  }
44
44
  var major = +process.versions.node.split('.')[0];
45
- var createSession = major > 18 ? _sessionts.createSession : undefined;
45
+ var createSession = major > 18 ? _createSessionWrapperts.createSession : undefined;
46
46
  /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/index-esm.ts"],"sourcesContent":["export { default as figures } from './lib/figures.ts';\nexport { default as formatArguments } from './lib/formatArguments.ts';\nexport * from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\n\nimport { createSession as createSessionImpl, type Session } from './session.ts';\nexport type { Session };\nexport const createSession = major > 18 ? createSessionImpl : (undefined as typeof createSessionImpl);\n"],"names":["createSession","figures","formatArguments","major","process","versions","node","split","createSessionImpl","undefined"],"mappings":";;;;;;;;;;;QAQaA;eAAAA;;QAROC;eAAAA,kBAAO;;QACPC;eAAAA,0BAAe;;;gEADA;wEACQ;qBAC7B;yBAImD;;;;;;;;;;;;;;;;;;;AAFjE,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAI3C,IAAMP,gBAAgBG,QAAQ,KAAKK,wBAAiB,GAAIC"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/index-esm.ts"],"sourcesContent":["export { default as figures } from './lib/figures.ts';\nexport { default as formatArguments } from './lib/formatArguments.ts';\nexport * from './types.ts';\n\nimport type { createSession as createSessionType, Session } from './createSessionWrapper.ts';\nexport type { Session };\n\nconst major = +process.versions.node.split('.')[0];\n\nimport { createSession as createSessionImpl } from './createSessionWrapper.ts';\nexport const createSession = major > 18 ? createSessionImpl : (undefined as typeof createSessionType);\n"],"names":["createSession","figures","formatArguments","major","process","versions","node","split","createSessionImpl","undefined"],"mappings":";;;;;;;;;;;QAUaA;eAAAA;;QAVOC;eAAAA,kBAAO;;QACPC;eAAAA,0BAAe;;;gEADA;wEACQ;qBAC7B;sCAOqC;;;;;;;;;;;;;;;;;;;AAFnD,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAG3C,IAAMP,gBAAgBG,QAAQ,KAAKK,qCAAiB,GAAIC"}
@@ -0,0 +1,7 @@
1
+ import type { ProcessOptions, SessionOptions, SpawnOptions, TerminalCallback } from './types.js';
2
+ export interface Session {
3
+ spawn(command: string, args: string[], spawnOptions: SpawnOptions, options: ProcessOptions, callback: TerminalCallback): void;
4
+ close(): void;
5
+ waitAndClose(callback?: () => void): void;
6
+ }
7
+ export declare function createSession(options?: SessionOptions): Session;
@@ -1,6 +1,6 @@
1
1
  export { default as figures } from './lib/figures.js';
2
2
  export { default as formatArguments } from './lib/formatArguments.js';
3
3
  export * from './types.js';
4
- import { createSession as createSessionImpl, type Session } from './session.js';
4
+ import type { createSession as createSessionType, Session } from './createSessionWrapper.js';
5
5
  export type { Session };
6
- export declare const createSession: typeof createSessionImpl;
6
+ export declare const createSession: typeof createSessionType;
@@ -0,0 +1,43 @@
1
+ export function createSession(options) {
2
+ let realSession = null;
3
+ let loadError = null;
4
+ // Start loading immediately
5
+ import('./session.js').then((mod)=>{
6
+ realSession = mod.createSession(options);
7
+ }).catch((err)=>{
8
+ loadError = err;
9
+ });
10
+ return {
11
+ spawn (command, args, spawnOptions, processOptions, callback) {
12
+ if (loadError) {
13
+ callback(loadError);
14
+ return;
15
+ }
16
+ if (realSession) {
17
+ realSession.spawn(command, args, spawnOptions, processOptions, callback);
18
+ return;
19
+ }
20
+ // Still loading, wait for it
21
+ import('./session.js').then((mod)=>{
22
+ if (!realSession) realSession = mod.createSession(options);
23
+ realSession.spawn(command, args, spawnOptions, processOptions, callback);
24
+ }).catch(callback);
25
+ },
26
+ close () {
27
+ if (realSession) realSession.close();
28
+ },
29
+ waitAndClose (callback) {
30
+ if (realSession) {
31
+ realSession.waitAndClose(callback);
32
+ return;
33
+ }
34
+ // Still loading, wait for it
35
+ import('./session.js').then((mod)=>{
36
+ if (!realSession) realSession = mod.createSession(options);
37
+ realSession.waitAndClose(callback);
38
+ }).catch(()=>{
39
+ callback === null || callback === void 0 ? void 0 : callback();
40
+ });
41
+ }
42
+ };
43
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/createSessionWrapper.ts"],"sourcesContent":["import type { ProcessOptions, SessionOptions, SpawnError, SpawnOptions, TerminalCallback } from './types.ts';\n\nexport interface Session {\n spawn(command: string, args: string[], spawnOptions: SpawnOptions, options: ProcessOptions, callback: TerminalCallback): void;\n close(): void;\n waitAndClose(callback?: () => void): void;\n}\n\nexport function createSession(options?: SessionOptions): Session {\n let realSession: Session | null = null;\n let loadError: SpawnError | null = null;\n\n // Start loading immediately\n import('./session.ts')\n .then((mod) => {\n realSession = mod.createSession(options);\n })\n .catch((err) => {\n loadError = err;\n });\n\n return {\n spawn(command: string, args: string[], spawnOptions: SpawnOptions, processOptions: ProcessOptions, callback: TerminalCallback): void {\n if (loadError) {\n callback(loadError);\n return;\n }\n if (realSession) {\n realSession.spawn(command, args, spawnOptions, processOptions, callback);\n return;\n }\n // Still loading, wait for it\n import('./session.ts')\n .then((mod) => {\n if (!realSession) realSession = mod.createSession(options);\n realSession.spawn(command, args, spawnOptions, processOptions, callback);\n })\n .catch(callback);\n },\n close(): void {\n if (realSession) realSession.close();\n },\n waitAndClose(callback?: () => void): void {\n if (realSession) {\n realSession.waitAndClose(callback);\n return;\n }\n // Still loading, wait for it\n import('./session.ts')\n .then((mod) => {\n if (!realSession) realSession = mod.createSession(options);\n realSession.waitAndClose(callback);\n })\n .catch(() => {\n callback?.();\n });\n },\n };\n}\n"],"names":["createSession","options","realSession","loadError","then","mod","catch","err","spawn","command","args","spawnOptions","processOptions","callback","close","waitAndClose"],"mappings":"AAQA,OAAO,SAASA,cAAcC,OAAwB;IACpD,IAAIC,cAA8B;IAClC,IAAIC,YAA+B;IAEnC,4BAA4B;IAC5B,MAAM,CAAC,gBACJC,IAAI,CAAC,CAACC;QACLH,cAAcG,IAAIL,aAAa,CAACC;IAClC,GACCK,KAAK,CAAC,CAACC;QACNJ,YAAYI;IACd;IAEF,OAAO;QACLC,OAAMC,OAAe,EAAEC,IAAc,EAAEC,YAA0B,EAAEC,cAA8B,EAAEC,QAA0B;YAC3H,IAAIV,WAAW;gBACbU,SAASV;gBACT;YACF;YACA,IAAID,aAAa;gBACfA,YAAYM,KAAK,CAACC,SAASC,MAAMC,cAAcC,gBAAgBC;gBAC/D;YACF;YACA,6BAA6B;YAC7B,MAAM,CAAC,gBACJT,IAAI,CAAC,CAACC;gBACL,IAAI,CAACH,aAAaA,cAAcG,IAAIL,aAAa,CAACC;gBAClDC,YAAYM,KAAK,CAACC,SAASC,MAAMC,cAAcC,gBAAgBC;YACjE,GACCP,KAAK,CAACO;QACX;QACAC;YACE,IAAIZ,aAAaA,YAAYY,KAAK;QACpC;QACAC,cAAaF,QAAqB;YAChC,IAAIX,aAAa;gBACfA,YAAYa,YAAY,CAACF;gBACzB;YACF;YACA,6BAA6B;YAC7B,MAAM,CAAC,gBACJT,IAAI,CAAC,CAACC;gBACL,IAAI,CAACH,aAAaA,cAAcG,IAAIL,aAAa,CAACC;gBAClDC,YAAYa,YAAY,CAACF;YAC3B,GACCP,KAAK,CAAC;gBACLO,qBAAAA,+BAAAA;YACF;QACJ;IACF;AACF"}
@@ -2,5 +2,5 @@ export { default as figures } from './lib/figures.js';
2
2
  export { default as formatArguments } from './lib/formatArguments.js';
3
3
  export * from './types.js';
4
4
  const major = +process.versions.node.split('.')[0];
5
- import { createSession as createSessionImpl } from './session.js';
5
+ import { createSession as createSessionImpl } from './createSessionWrapper.js';
6
6
  export const createSession = major > 18 ? createSessionImpl : undefined;
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/index-esm.ts"],"sourcesContent":["export { default as figures } from './lib/figures.ts';\nexport { default as formatArguments } from './lib/formatArguments.ts';\nexport * from './types.ts';\n\nconst major = +process.versions.node.split('.')[0];\n\nimport { createSession as createSessionImpl, type Session } from './session.ts';\nexport type { Session };\nexport const createSession = major > 18 ? createSessionImpl : (undefined as typeof createSessionImpl);\n"],"names":["default","figures","formatArguments","major","process","versions","node","split","createSession","createSessionImpl","undefined"],"mappings":"AAAA,SAASA,WAAWC,OAAO,QAAQ,mBAAmB;AACtD,SAASD,WAAWE,eAAe,QAAQ,2BAA2B;AACtE,cAAc,aAAa;AAE3B,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAElD,SAASC,iBAAiBC,iBAAiB,QAAsB,eAAe;AAEhF,OAAO,MAAMD,gBAAgBL,QAAQ,KAAKM,oBAAqBC,UAAuC"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/index-esm.ts"],"sourcesContent":["export { default as figures } from './lib/figures.ts';\nexport { default as formatArguments } from './lib/formatArguments.ts';\nexport * from './types.ts';\n\nimport type { createSession as createSessionType, Session } from './createSessionWrapper.ts';\nexport type { Session };\n\nconst major = +process.versions.node.split('.')[0];\n\nimport { createSession as createSessionImpl } from './createSessionWrapper.ts';\nexport const createSession = major > 18 ? createSessionImpl : (undefined as typeof createSessionType);\n"],"names":["default","figures","formatArguments","major","process","versions","node","split","createSession","createSessionImpl","undefined"],"mappings":"AAAA,SAASA,WAAWC,OAAO,QAAQ,mBAAmB;AACtD,SAASD,WAAWE,eAAe,QAAQ,2BAA2B;AACtE,cAAc,aAAa;AAK3B,MAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAElD,SAASC,iBAAiBC,iBAAiB,QAAQ,4BAA4B;AAC/E,OAAO,MAAMD,gBAAgBL,QAAQ,KAAKM,oBAAqBC,UAAuC"}
@@ -0,0 +1,7 @@
1
+ import type { ProcessOptions, SessionOptions, SpawnOptions, TerminalCallback } from './types.js';
2
+ export interface Session {
3
+ spawn(command: string, args: string[], spawnOptions: SpawnOptions, options: ProcessOptions, callback: TerminalCallback): void;
4
+ close(): void;
5
+ waitAndClose(callback?: () => void): void;
6
+ }
7
+ export declare function createSession(options?: SessionOptions): Session;
@@ -1,6 +1,6 @@
1
1
  export { default as figures } from './lib/figures.js';
2
2
  export { default as formatArguments } from './lib/formatArguments.js';
3
3
  export * from './types.js';
4
- import { createSession as createSessionImpl, type Session } from './session.js';
4
+ import type { createSession as createSessionType, Session } from './createSessionWrapper.js';
5
5
  export type { Session };
6
- export declare const createSession: typeof createSessionImpl;
6
+ export declare const createSession: typeof createSessionType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawn-term",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Formats spawn with for terminal grouping",
5
5
  "keywords": [
6
6
  "spawn",