spawn-term 3.4.0 → 3.4.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/cjs/compat.js +1 -3
- package/dist/cjs/compat.js.map +1 -1
- package/dist/cjs/lib/loadInk.js +1 -1
- package/dist/cjs/lib/loadInk.js.map +1 -1
- package/dist/esm/compat.js +1 -3
- package/dist/esm/compat.js.map +1 -1
- package/dist/esm/lib/loadInk.js +1 -1
- package/dist/esm/lib/loadInk.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/compat.js
CHANGED
|
@@ -53,9 +53,7 @@ var PassThrough = major > 0 ? _require('stream').PassThrough : _require('readabl
|
|
|
53
53
|
* - Falls back to lastIndexOf on Node 0.8-3.x
|
|
54
54
|
*/ var hasEndsWith = typeof String.prototype.endsWith === 'function';
|
|
55
55
|
function stringEndsWith(str, search, position) {
|
|
56
|
-
if (hasEndsWith)
|
|
57
|
-
return str.endsWith(search, position);
|
|
58
|
-
}
|
|
56
|
+
if (hasEndsWith) return str.endsWith(search, position);
|
|
59
57
|
var len = position === undefined ? str.length : position;
|
|
60
58
|
return str.lastIndexOf(search) === len - search.length;
|
|
61
59
|
}
|
package/dist/cjs/compat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\n\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n/**\n * Stream compatibility - Transform class\n * - Uses native stream.Transform on Node 0.10+\n * - Falls back to readable-stream for Node 0.8\n */\nconst major = +process.versions.node.split('.')[0];\nexport const Readable: typeof import('stream').Readable = major > 0 ? _require('stream').Readable : _require('readable-stream').Readable;\nexport const Writable: typeof import('stream').Writable = major > 0 ? _require('stream').Writable : _require('readable-stream').Writable;\nexport const Transform: typeof import('stream').Transform = major > 0 ? _require('stream').Transform : _require('readable-stream').Transform;\nexport const PassThrough: typeof import('stream').PassThrough = major > 0 ? _require('stream').PassThrough : _require('readable-stream').PassThrough;\n\n/**\n * String.prototype.endsWith wrapper for Node.js 0.8+\n * - Uses native endsWith on Node 4.0+ / ES2015+\n * - Falls back to lastIndexOf on Node 0.8-3.x\n */\nconst hasEndsWith = typeof String.prototype.endsWith === 'function';\nexport function stringEndsWith(str: string, search: string, position?: number): boolean {\n if (hasEndsWith)
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\n\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n/**\n * Stream compatibility - Transform class\n * - Uses native stream.Transform on Node 0.10+\n * - Falls back to readable-stream for Node 0.8\n */\nconst major = +process.versions.node.split('.')[0];\nexport const Readable: typeof import('stream').Readable = major > 0 ? _require('stream').Readable : _require('readable-stream').Readable;\nexport const Writable: typeof import('stream').Writable = major > 0 ? _require('stream').Writable : _require('readable-stream').Writable;\nexport const Transform: typeof import('stream').Transform = major > 0 ? _require('stream').Transform : _require('readable-stream').Transform;\nexport const PassThrough: typeof import('stream').PassThrough = major > 0 ? _require('stream').PassThrough : _require('readable-stream').PassThrough;\n\n/**\n * String.prototype.endsWith wrapper for Node.js 0.8+\n * - Uses native endsWith on Node 4.0+ / ES2015+\n * - Falls back to lastIndexOf on Node 0.8-3.x\n */\nconst hasEndsWith = typeof String.prototype.endsWith === 'function';\nexport function stringEndsWith(str: string, search: string, position?: number): boolean {\n if (hasEndsWith) return str.endsWith(search, position);\n const len = position === undefined ? str.length : position;\n return str.lastIndexOf(search) === len - search.length;\n}\n\n/**\n * Array.prototype.find wrapper for Node.js 0.8+\n * - Uses native find on Node 4.0+ / ES2015+\n * - Falls back to loop on Node 0.8-3.x\n */\nconst hasArrayFind = typeof Array.prototype.find === 'function';\n\nexport function arrayFind<T>(arr: T[], predicate: (item: T, index: number, arr: T[]) => boolean): T | undefined {\n if (hasArrayFind) {\n return arr.find(predicate);\n }\n for (let i = 0; i < arr.length; i++) {\n if (predicate(arr[i], i, arr)) return arr[i];\n }\n return undefined;\n}\n"],"names":["PassThrough","Readable","Transform","Writable","arrayFind","stringEndsWith","_require","require","Module","createRequire","major","process","versions","node","split","hasEndsWith","String","prototype","endsWith","str","search","position","len","undefined","length","lastIndexOf","hasArrayFind","Array","find","arr","predicate","i"],"mappings":"AAAA;;;CAGC;;;;;;;;;;;QAeYA;eAAAA;;QAHAC;eAAAA;;QAEAC;eAAAA;;QADAC;eAAAA;;QAuBGC;eAAAA;;QAbAC;eAAAA;;;6DArBG;;;;;;AAEnB,IAAMC,WAAW,OAAOC,YAAY,cAAcC,eAAM,CAACC,aAAa,CAAC,uDAAmBF;AAE1F;;;;CAIC,GACD,IAAMG,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAC3C,IAAMb,WAA6CS,QAAQ,IAAIJ,SAAS,UAAUL,QAAQ,GAAGK,SAAS,mBAAmBL,QAAQ;AACjI,IAAME,WAA6CO,QAAQ,IAAIJ,SAAS,UAAUH,QAAQ,GAAGG,SAAS,mBAAmBH,QAAQ;AACjI,IAAMD,YAA+CQ,QAAQ,IAAIJ,SAAS,UAAUJ,SAAS,GAAGI,SAAS,mBAAmBJ,SAAS;AACrI,IAAMF,cAAmDU,QAAQ,IAAIJ,SAAS,UAAUN,WAAW,GAAGM,SAAS,mBAAmBN,WAAW;AAEpJ;;;;CAIC,GACD,IAAMe,cAAc,OAAOC,OAAOC,SAAS,CAACC,QAAQ,KAAK;AAClD,SAASb,eAAec,GAAW,EAAEC,MAAc,EAAEC,QAAiB;IAC3E,IAAIN,aAAa,OAAOI,IAAID,QAAQ,CAACE,QAAQC;IAC7C,IAAMC,MAAMD,aAAaE,YAAYJ,IAAIK,MAAM,GAAGH;IAClD,OAAOF,IAAIM,WAAW,CAACL,YAAYE,MAAMF,OAAOI,MAAM;AACxD;AAEA;;;;CAIC,GACD,IAAME,eAAe,OAAOC,MAAMV,SAAS,CAACW,IAAI,KAAK;AAE9C,SAASxB,UAAayB,GAAQ,EAAEC,SAAwD;IAC7F,IAAIJ,cAAc;QAChB,OAAOG,IAAID,IAAI,CAACE;IAClB;IACA,IAAK,IAAIC,IAAI,GAAGA,IAAIF,IAAIL,MAAM,EAAEO,IAAK;QACnC,IAAID,UAAUD,GAAG,CAACE,EAAE,EAAEA,GAAGF,MAAM,OAAOA,GAAG,CAACE,EAAE;IAC9C;IACA,OAAOR;AACT"}
|
package/dist/cjs/lib/loadInk.js
CHANGED
|
@@ -26,7 +26,7 @@ function _interop_require_default(obj) {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
// Get the node_modules directory relative to this file
|
|
29
|
-
var _dirname = _path.default.dirname(typeof
|
|
29
|
+
var _dirname = _path.default.dirname(typeof __filename === 'undefined' ? _url.default.fileURLToPath(require("url").pathToFileURL(__filename).toString()) : __filename);
|
|
30
30
|
var nodeModules = _path.default.join(_dirname, '..', '..', '..', 'node_modules');
|
|
31
31
|
var installed = false;
|
|
32
32
|
var installing = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/loadInk.ts"],"sourcesContent":["import fs from 'fs';\nimport installModule from 'install-module-linked';\nimport path from 'path';\nimport url from 'url';\n\n// Get the node_modules directory relative to this file\nconst _dirname = path.dirname(typeof
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/loadInk.ts"],"sourcesContent":["import fs from 'fs';\nimport installModule from 'install-module-linked';\nimport path from 'path';\nimport url from 'url';\n\n// Get the node_modules directory relative to this file\nconst _dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst nodeModules = path.join(_dirname, '..', '..', '..', 'node_modules');\n\nlet installed = false;\nlet installing: Promise<void> | null = null;\n\nfunction installDependency(name: string): Promise<void> {\n return new Promise((resolve, reject) => {\n // install-module-linked will:\n // 1. Check if module exists locally or in ~/.iml cache\n // 2. If not, install to ~/.iml\n // 3. Create symlink in nodeModules pointing to ~/.iml/package\n installModule(name, nodeModules, {}, (err) => {\n if (err) return reject(err);\n resolve();\n });\n });\n}\n\nfunction symlinkReactFromInk(): Promise<void> {\n return new Promise((resolve) => {\n // After ink is installed, symlink react to ink's react to avoid duplicate React instances\n const inkPath = fs.realpathSync(path.join(nodeModules, 'ink'));\n const inkReactPath = path.join(inkPath, 'node_modules', 'react');\n const reactPath = path.join(nodeModules, 'react');\n\n // Check if react already exists\n try {\n const stat = fs.lstatSync(reactPath);\n if (stat.isSymbolicLink()) {\n // It's a symlink - check if it points to the right place\n const existing = fs.readlinkSync(reactPath);\n if (existing === inkReactPath) {\n return resolve(); // Already correct\n }\n // Wrong symlink, remove it\n fs.unlinkSync(reactPath);\n } else {\n // It's a real directory (e.g. from devDependencies) - leave it alone\n return resolve();\n }\n } catch {\n // Doesn't exist, continue to create symlink\n }\n\n // Create symlink to ink's react\n try {\n fs.symlinkSync(inkReactPath, reactPath);\n } catch {\n // Ignore errors - react may have been installed another way\n }\n resolve();\n });\n}\n\nfunction installInk(): Promise<void> {\n if (installed) return Promise.resolve();\n if (installing) return installing;\n\n // Install ink, then symlink react to ink's bundled react\n // This ensures session.tsx and ink use the SAME React instance\n installing = installDependency('ink')\n .then(() => symlinkReactFromInk())\n .then(() => {\n installed = true;\n })\n .catch((err) => {\n installing = null;\n throw err;\n });\n\n return installing;\n}\n\nexport function loadInk(callback: (err: Error | null) => void): void {\n installInk()\n .then(() => callback(null))\n .catch((err) => callback(err));\n}\n\nexport function isInkInstalled(): boolean {\n return installed;\n}\n"],"names":["isInkInstalled","loadInk","_dirname","path","dirname","__filename","url","fileURLToPath","nodeModules","join","installed","installing","installDependency","name","Promise","resolve","reject","installModule","err","symlinkReactFromInk","inkPath","fs","realpathSync","inkReactPath","reactPath","stat","lstatSync","isSymbolicLink","existing","readlinkSync","unlinkSync","symlinkSync","installInk","then","catch","callback"],"mappings":";;;;;;;;;;;QAsFgBA;eAAAA;;QANAC;eAAAA;;;yDAhFD;0EACW;2DACT;0DACD;;;;;;AAEhB,uDAAuD;AACvD,IAAMC,WAAWC,aAAI,CAACC,OAAO,CAAC,OAAOC,eAAe,cAAcC,YAAG,CAACC,aAAa,CAAC,uDAAmBF;AACvG,IAAMG,cAAcL,aAAI,CAACM,IAAI,CAACP,UAAU,MAAM,MAAM,MAAM;AAE1D,IAAIQ,YAAY;AAChB,IAAIC,aAAmC;AAEvC,SAASC,kBAAkBC,IAAY;IACrC,OAAO,IAAIC,QAAQ,SAACC,SAASC;QAC3B,8BAA8B;QAC9B,uDAAuD;QACvD,+BAA+B;QAC/B,8DAA8D;QAC9DC,IAAAA,4BAAa,EAACJ,MAAML,aAAa,CAAC,GAAG,SAACU;YACpC,IAAIA,KAAK,OAAOF,OAAOE;YACvBH;QACF;IACF;AACF;AAEA,SAASI;IACP,OAAO,IAAIL,QAAQ,SAACC;QAClB,0FAA0F;QAC1F,IAAMK,UAAUC,WAAE,CAACC,YAAY,CAACnB,aAAI,CAACM,IAAI,CAACD,aAAa;QACvD,IAAMe,eAAepB,aAAI,CAACM,IAAI,CAACW,SAAS,gBAAgB;QACxD,IAAMI,YAAYrB,aAAI,CAACM,IAAI,CAACD,aAAa;QAEzC,gCAAgC;QAChC,IAAI;YACF,IAAMiB,OAAOJ,WAAE,CAACK,SAAS,CAACF;YAC1B,IAAIC,KAAKE,cAAc,IAAI;gBACzB,yDAAyD;gBACzD,IAAMC,WAAWP,WAAE,CAACQ,YAAY,CAACL;gBACjC,IAAII,aAAaL,cAAc;oBAC7B,OAAOR,WAAW,kBAAkB;gBACtC;gBACA,2BAA2B;gBAC3BM,WAAE,CAACS,UAAU,CAACN;YAChB,OAAO;gBACL,qEAAqE;gBACrE,OAAOT;YACT;QACF,EAAE,eAAM;QACN,4CAA4C;QAC9C;QAEA,gCAAgC;QAChC,IAAI;YACFM,WAAE,CAACU,WAAW,CAACR,cAAcC;QAC/B,EAAE,eAAM;QACN,4DAA4D;QAC9D;QACAT;IACF;AACF;AAEA,SAASiB;IACP,IAAItB,WAAW,OAAOI,QAAQC,OAAO;IACrC,IAAIJ,YAAY,OAAOA;IAEvB,yDAAyD;IACzD,+DAA+D;IAC/DA,aAAaC,kBAAkB,OAC5BqB,IAAI,CAAC;eAAMd;OACXc,IAAI,CAAC;QACJvB,YAAY;IACd,GACCwB,KAAK,CAAC,SAAChB;QACNP,aAAa;QACb,MAAMO;IACR;IAEF,OAAOP;AACT;AAEO,SAASV,QAAQkC,QAAqC;IAC3DH,aACGC,IAAI,CAAC;eAAME,SAAS;OACpBD,KAAK,CAAC,SAAChB;eAAQiB,SAASjB;;AAC7B;AAEO,SAASlB;IACd,OAAOU;AACT"}
|
package/dist/esm/compat.js
CHANGED
|
@@ -18,9 +18,7 @@ export const PassThrough = major > 0 ? _require('stream').PassThrough : _require
|
|
|
18
18
|
* - Falls back to lastIndexOf on Node 0.8-3.x
|
|
19
19
|
*/ const hasEndsWith = typeof String.prototype.endsWith === 'function';
|
|
20
20
|
export function stringEndsWith(str, search, position) {
|
|
21
|
-
if (hasEndsWith)
|
|
22
|
-
return str.endsWith(search, position);
|
|
23
|
-
}
|
|
21
|
+
if (hasEndsWith) return str.endsWith(search, position);
|
|
24
22
|
const len = position === undefined ? str.length : position;
|
|
25
23
|
return str.lastIndexOf(search) === len - search.length;
|
|
26
24
|
}
|
package/dist/esm/compat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\n\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n/**\n * Stream compatibility - Transform class\n * - Uses native stream.Transform on Node 0.10+\n * - Falls back to readable-stream for Node 0.8\n */\nconst major = +process.versions.node.split('.')[0];\nexport const Readable: typeof import('stream').Readable = major > 0 ? _require('stream').Readable : _require('readable-stream').Readable;\nexport const Writable: typeof import('stream').Writable = major > 0 ? _require('stream').Writable : _require('readable-stream').Writable;\nexport const Transform: typeof import('stream').Transform = major > 0 ? _require('stream').Transform : _require('readable-stream').Transform;\nexport const PassThrough: typeof import('stream').PassThrough = major > 0 ? _require('stream').PassThrough : _require('readable-stream').PassThrough;\n\n/**\n * String.prototype.endsWith wrapper for Node.js 0.8+\n * - Uses native endsWith on Node 4.0+ / ES2015+\n * - Falls back to lastIndexOf on Node 0.8-3.x\n */\nconst hasEndsWith = typeof String.prototype.endsWith === 'function';\nexport function stringEndsWith(str: string, search: string, position?: number): boolean {\n if (hasEndsWith)
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/compat.ts"],"sourcesContent":["/**\n * Compatibility Layer for Node.js 0.8+\n * Local to this package - contains only needed functions.\n */\n\nimport Module from 'module';\n\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n/**\n * Stream compatibility - Transform class\n * - Uses native stream.Transform on Node 0.10+\n * - Falls back to readable-stream for Node 0.8\n */\nconst major = +process.versions.node.split('.')[0];\nexport const Readable: typeof import('stream').Readable = major > 0 ? _require('stream').Readable : _require('readable-stream').Readable;\nexport const Writable: typeof import('stream').Writable = major > 0 ? _require('stream').Writable : _require('readable-stream').Writable;\nexport const Transform: typeof import('stream').Transform = major > 0 ? _require('stream').Transform : _require('readable-stream').Transform;\nexport const PassThrough: typeof import('stream').PassThrough = major > 0 ? _require('stream').PassThrough : _require('readable-stream').PassThrough;\n\n/**\n * String.prototype.endsWith wrapper for Node.js 0.8+\n * - Uses native endsWith on Node 4.0+ / ES2015+\n * - Falls back to lastIndexOf on Node 0.8-3.x\n */\nconst hasEndsWith = typeof String.prototype.endsWith === 'function';\nexport function stringEndsWith(str: string, search: string, position?: number): boolean {\n if (hasEndsWith) return str.endsWith(search, position);\n const len = position === undefined ? str.length : position;\n return str.lastIndexOf(search) === len - search.length;\n}\n\n/**\n * Array.prototype.find wrapper for Node.js 0.8+\n * - Uses native find on Node 4.0+ / ES2015+\n * - Falls back to loop on Node 0.8-3.x\n */\nconst hasArrayFind = typeof Array.prototype.find === 'function';\n\nexport function arrayFind<T>(arr: T[], predicate: (item: T, index: number, arr: T[]) => boolean): T | undefined {\n if (hasArrayFind) {\n return arr.find(predicate);\n }\n for (let i = 0; i < arr.length; i++) {\n if (predicate(arr[i], i, arr)) return arr[i];\n }\n return undefined;\n}\n"],"names":["Module","_require","require","createRequire","url","major","process","versions","node","split","Readable","Writable","Transform","PassThrough","hasEndsWith","String","prototype","endsWith","stringEndsWith","str","search","position","len","undefined","length","lastIndexOf","hasArrayFind","Array","find","arrayFind","arr","predicate","i"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,YAAY,SAAS;AAE5B,MAAMC,WAAW,OAAOC,YAAY,cAAcF,OAAOG,aAAa,CAAC,YAAYC,GAAG,IAAIF;AAE1F;;;;CAIC,GACD,MAAMG,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,OAAO,MAAMC,WAA6CL,QAAQ,IAAIJ,SAAS,UAAUS,QAAQ,GAAGT,SAAS,mBAAmBS,QAAQ,CAAC;AACzI,OAAO,MAAMC,WAA6CN,QAAQ,IAAIJ,SAAS,UAAUU,QAAQ,GAAGV,SAAS,mBAAmBU,QAAQ,CAAC;AACzI,OAAO,MAAMC,YAA+CP,QAAQ,IAAIJ,SAAS,UAAUW,SAAS,GAAGX,SAAS,mBAAmBW,SAAS,CAAC;AAC7I,OAAO,MAAMC,cAAmDR,QAAQ,IAAIJ,SAAS,UAAUY,WAAW,GAAGZ,SAAS,mBAAmBY,WAAW,CAAC;AAErJ;;;;CAIC,GACD,MAAMC,cAAc,OAAOC,OAAOC,SAAS,CAACC,QAAQ,KAAK;AACzD,OAAO,SAASC,eAAeC,GAAW,EAAEC,MAAc,EAAEC,QAAiB;IAC3E,IAAIP,aAAa,OAAOK,IAAIF,QAAQ,CAACG,QAAQC;IAC7C,MAAMC,MAAMD,aAAaE,YAAYJ,IAAIK,MAAM,GAAGH;IAClD,OAAOF,IAAIM,WAAW,CAACL,YAAYE,MAAMF,OAAOI,MAAM;AACxD;AAEA;;;;CAIC,GACD,MAAME,eAAe,OAAOC,MAAMX,SAAS,CAACY,IAAI,KAAK;AAErD,OAAO,SAASC,UAAaC,GAAQ,EAAEC,SAAwD;IAC7F,IAAIL,cAAc;QAChB,OAAOI,IAAIF,IAAI,CAACG;IAClB;IACA,IAAK,IAAIC,IAAI,GAAGA,IAAIF,IAAIN,MAAM,EAAEQ,IAAK;QACnC,IAAID,UAAUD,GAAG,CAACE,EAAE,EAAEA,GAAGF,MAAM,OAAOA,GAAG,CAACE,EAAE;IAC9C;IACA,OAAOT;AACT"}
|
package/dist/esm/lib/loadInk.js
CHANGED
|
@@ -3,7 +3,7 @@ import installModule from 'install-module-linked';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import url from 'url';
|
|
5
5
|
// Get the node_modules directory relative to this file
|
|
6
|
-
const _dirname = path.dirname(typeof
|
|
6
|
+
const _dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);
|
|
7
7
|
const nodeModules = path.join(_dirname, '..', '..', '..', 'node_modules');
|
|
8
8
|
let installed = false;
|
|
9
9
|
let installing = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/loadInk.ts"],"sourcesContent":["import fs from 'fs';\nimport installModule from 'install-module-linked';\nimport path from 'path';\nimport url from 'url';\n\n// Get the node_modules directory relative to this file\nconst _dirname = path.dirname(typeof
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/node/spawn-term/src/lib/loadInk.ts"],"sourcesContent":["import fs from 'fs';\nimport installModule from 'install-module-linked';\nimport path from 'path';\nimport url from 'url';\n\n// Get the node_modules directory relative to this file\nconst _dirname = path.dirname(typeof __filename === 'undefined' ? url.fileURLToPath(import.meta.url) : __filename);\nconst nodeModules = path.join(_dirname, '..', '..', '..', 'node_modules');\n\nlet installed = false;\nlet installing: Promise<void> | null = null;\n\nfunction installDependency(name: string): Promise<void> {\n return new Promise((resolve, reject) => {\n // install-module-linked will:\n // 1. Check if module exists locally or in ~/.iml cache\n // 2. If not, install to ~/.iml\n // 3. Create symlink in nodeModules pointing to ~/.iml/package\n installModule(name, nodeModules, {}, (err) => {\n if (err) return reject(err);\n resolve();\n });\n });\n}\n\nfunction symlinkReactFromInk(): Promise<void> {\n return new Promise((resolve) => {\n // After ink is installed, symlink react to ink's react to avoid duplicate React instances\n const inkPath = fs.realpathSync(path.join(nodeModules, 'ink'));\n const inkReactPath = path.join(inkPath, 'node_modules', 'react');\n const reactPath = path.join(nodeModules, 'react');\n\n // Check if react already exists\n try {\n const stat = fs.lstatSync(reactPath);\n if (stat.isSymbolicLink()) {\n // It's a symlink - check if it points to the right place\n const existing = fs.readlinkSync(reactPath);\n if (existing === inkReactPath) {\n return resolve(); // Already correct\n }\n // Wrong symlink, remove it\n fs.unlinkSync(reactPath);\n } else {\n // It's a real directory (e.g. from devDependencies) - leave it alone\n return resolve();\n }\n } catch {\n // Doesn't exist, continue to create symlink\n }\n\n // Create symlink to ink's react\n try {\n fs.symlinkSync(inkReactPath, reactPath);\n } catch {\n // Ignore errors - react may have been installed another way\n }\n resolve();\n });\n}\n\nfunction installInk(): Promise<void> {\n if (installed) return Promise.resolve();\n if (installing) return installing;\n\n // Install ink, then symlink react to ink's bundled react\n // This ensures session.tsx and ink use the SAME React instance\n installing = installDependency('ink')\n .then(() => symlinkReactFromInk())\n .then(() => {\n installed = true;\n })\n .catch((err) => {\n installing = null;\n throw err;\n });\n\n return installing;\n}\n\nexport function loadInk(callback: (err: Error | null) => void): void {\n installInk()\n .then(() => callback(null))\n .catch((err) => callback(err));\n}\n\nexport function isInkInstalled(): boolean {\n return installed;\n}\n"],"names":["fs","installModule","path","url","_dirname","dirname","__filename","fileURLToPath","nodeModules","join","installed","installing","installDependency","name","Promise","resolve","reject","err","symlinkReactFromInk","inkPath","realpathSync","inkReactPath","reactPath","stat","lstatSync","isSymbolicLink","existing","readlinkSync","unlinkSync","symlinkSync","installInk","then","catch","loadInk","callback","isInkInstalled"],"mappings":"AAAA,OAAOA,QAAQ,KAAK;AACpB,OAAOC,mBAAmB,wBAAwB;AAClD,OAAOC,UAAU,OAAO;AACxB,OAAOC,SAAS,MAAM;AAEtB,uDAAuD;AACvD,MAAMC,WAAWF,KAAKG,OAAO,CAAC,OAAOC,eAAe,cAAcH,IAAII,aAAa,CAAC,YAAYJ,GAAG,IAAIG;AACvG,MAAME,cAAcN,KAAKO,IAAI,CAACL,UAAU,MAAM,MAAM,MAAM;AAE1D,IAAIM,YAAY;AAChB,IAAIC,aAAmC;AAEvC,SAASC,kBAAkBC,IAAY;IACrC,OAAO,IAAIC,QAAQ,CAACC,SAASC;QAC3B,8BAA8B;QAC9B,uDAAuD;QACvD,+BAA+B;QAC/B,8DAA8D;QAC9Df,cAAcY,MAAML,aAAa,CAAC,GAAG,CAACS;YACpC,IAAIA,KAAK,OAAOD,OAAOC;YACvBF;QACF;IACF;AACF;AAEA,SAASG;IACP,OAAO,IAAIJ,QAAQ,CAACC;QAClB,0FAA0F;QAC1F,MAAMI,UAAUnB,GAAGoB,YAAY,CAAClB,KAAKO,IAAI,CAACD,aAAa;QACvD,MAAMa,eAAenB,KAAKO,IAAI,CAACU,SAAS,gBAAgB;QACxD,MAAMG,YAAYpB,KAAKO,IAAI,CAACD,aAAa;QAEzC,gCAAgC;QAChC,IAAI;YACF,MAAMe,OAAOvB,GAAGwB,SAAS,CAACF;YAC1B,IAAIC,KAAKE,cAAc,IAAI;gBACzB,yDAAyD;gBACzD,MAAMC,WAAW1B,GAAG2B,YAAY,CAACL;gBACjC,IAAII,aAAaL,cAAc;oBAC7B,OAAON,WAAW,kBAAkB;gBACtC;gBACA,2BAA2B;gBAC3Bf,GAAG4B,UAAU,CAACN;YAChB,OAAO;gBACL,qEAAqE;gBACrE,OAAOP;YACT;QACF,EAAE,OAAM;QACN,4CAA4C;QAC9C;QAEA,gCAAgC;QAChC,IAAI;YACFf,GAAG6B,WAAW,CAACR,cAAcC;QAC/B,EAAE,OAAM;QACN,4DAA4D;QAC9D;QACAP;IACF;AACF;AAEA,SAASe;IACP,IAAIpB,WAAW,OAAOI,QAAQC,OAAO;IACrC,IAAIJ,YAAY,OAAOA;IAEvB,yDAAyD;IACzD,+DAA+D;IAC/DA,aAAaC,kBAAkB,OAC5BmB,IAAI,CAAC,IAAMb,uBACXa,IAAI,CAAC;QACJrB,YAAY;IACd,GACCsB,KAAK,CAAC,CAACf;QACNN,aAAa;QACb,MAAMM;IACR;IAEF,OAAON;AACT;AAEA,OAAO,SAASsB,QAAQC,QAAqC;IAC3DJ,aACGC,IAAI,CAAC,IAAMG,SAAS,OACpBF,KAAK,CAAC,CAACf,MAAQiB,SAASjB;AAC7B;AAEA,OAAO,SAASkB;IACd,OAAOzB;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spawn-term",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Formats spawn with for terminal grouping",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"spawn",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"version": "tsds version"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@xterm/headless": "^
|
|
45
|
+
"@xterm/headless": "^6.0.0",
|
|
46
46
|
"cross-spawn-cb": "^3.0.0",
|
|
47
47
|
"install-module-linked": "^1.3.16",
|
|
48
48
|
"on-one": "^1.0.0",
|