cross-spawn-cb 1.4.2 → 1.5.0

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.
@@ -4093,16 +4093,16 @@ function requireSrc() {
4093
4093
  var env = options.env || process.env;
4094
4094
  return env.NODE || env.npm_node_execpath;
4095
4095
  }
4096
- var spawn = requireCrossSpawn6_0_5();
4097
- function spawnCompat(command, args, options, callback1) {
4098
- return spawn.spawn(patchNode(command, args, options), args, options, callback1);
4099
- }
4100
- function spawnSyncCompat(command, args, options) {
4101
- return spawn.sync(patchNode(command, args, options), args, options);
4102
- }
4103
- spawnCompat.sync = spawnSyncCompat;
4104
- src$1.exports = spawnCompat;
4105
- src$1.exports.spawn = spawnCompat;
4096
+ var spawn_ = requireCrossSpawn6_0_5();
4097
+ src$1.exports = spawn_;
4098
+ src$1.exports.spawn = function(command, args, options, callback1) {
4099
+ return spawn_.spawn(patchNode(command, args, options), args, options, callback1);
4100
+ };
4101
+ src$1.exports.spawnSync = function(command, args, options) {
4102
+ return spawn_.sync(patchNode(command, args, options), args, options);
4103
+ };
4104
+ src$1.exports._parse = spawn_._parse;
4105
+ src$1.exports._enoent = spawn_._enoent;
4106
4106
  return src$1.exports;
4107
4107
  }
4108
4108
 
package/dist/cjs/index.js CHANGED
@@ -1,31 +1,8 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- default: function() {
13
- return _default;
14
- },
15
- spawn: function() {
16
- return _spawn.default;
17
- },
18
- sync: function() {
19
- return _spawnCallbackSync.default;
20
- }
21
- });
22
- var _spawnCallback = /*#__PURE__*/ _interop_require_default(require("./spawnCallback"));
23
- var _spawn = /*#__PURE__*/ _interop_require_default(require("./spawn"));
24
- var _spawnCallbackSync = /*#__PURE__*/ _interop_require_default(require("./spawnCallbackSync"));
25
- function _interop_require_default(obj) {
26
- return obj && obj.__esModule ? obj : {
27
- default: obj
28
- };
29
- }
30
- var _default = _spawnCallback.default;
2
+ var spawn_ = require('./spawn.js');
3
+ module.exports = require('./spawnCallback.js');
4
+ module.exports.sync = require('./spawnSyncCallback.js');
5
+ module.exports.spawn = spawn_;
6
+ module.exports._parse = spawn_._parse;
7
+ module.exports._enoent = spawn_._enoent;
31
8
  /* 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/@compat/cross-spawn-cb/src/index.mjs"],"sourcesContent":["import spawnCallback from './spawnCallback';\nexport default spawnCallback;\nexport { default as spawn } from './spawn';\nexport { default as sync } from './spawnCallbackSync';\n"],"names":["spawn","sync","spawnCallback"],"mappings":";;;;;;;;;;;IACA,OAA6B;eAA7B;;IACoBA,KAAK;eAALA,cAAK;;IACLC,IAAI;eAAJA,0BAAI;;;oEAHE;4DAEO;wEACD;;;;;;IAFhC,WAAeC,sBAAa"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/@compat/cross-spawn-cb/src/index.cjs"],"sourcesContent":["const spawn_ = require('./spawn.cjs');\nmodule.exports = require('./spawnCallback.cjs');\nmodule.exports.sync = require('./spawnSyncCallback.cjs');\nmodule.exports.spawn = spawn_;\nmodule.exports._parse = spawn_._parse;\nmodule.exports._enoent = spawn_._enoent;\n"],"names":["spawn_","require","module","exports","sync","spawn","_parse","_enoent"],"mappings":";AAAA,IAAMA,SAASC,QAAQ;AACvBC,OAAOC,OAAO,GAAGF,QAAQ;AACzBC,OAAOC,OAAO,CAACC,IAAI,GAAGH,QAAQ;AAC9BC,OAAOC,OAAO,CAACE,KAAK,GAAGL;AACvBE,OAAOC,OAAO,CAACG,MAAM,GAAGN,OAAOM,MAAM;AACrCJ,OAAOC,OAAO,CAACI,OAAO,GAAGP,OAAOO,OAAO"}
package/dist/cjs/spawn.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
2
  var major = +process.versions.node.split('.')[0];
3
- var spawn = major <= 7 ? require('../../assets/cross-spawn-6.0.5').spawn : require('cross-spawn').spawn;
4
- module.exports = spawn;
3
+ module.exports = major <= 7 ? require('../../assets/cross-spawn-6.0.5.js') : require('cross-spawn');
5
4
  /* 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/@compat/cross-spawn-cb/src/spawn.js"],"sourcesContent":["const major = +process.versions.node.split('.')[0];\nconst spawn = major <= 7 ? require('../../assets/cross-spawn-6.0.5').spawn : require('cross-spawn').spawn;\nmodule.exports = spawn;\n"],"names":["major","process","versions","node","split","spawn","require","module","exports"],"mappings":";AAAA,IAAMA,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,QAAQL,SAAS,IAAIM,QAAQ,kCAAkCD,KAAK,GAAGC,QAAQ,eAAeD,KAAK;AACzGE,OAAOC,OAAO,GAAGH"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/@compat/cross-spawn-cb/src/spawn.cjs"],"sourcesContent":["const major = +process.versions.node.split('.')[0];\nmodule.exports = major <= 7 ? require('../../assets/cross-spawn-6.0.5.js') : require('cross-spawn');\n"],"names":["major","process","versions","node","split","module","exports","require"],"mappings":";AAAA,IAAMA,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClDC,OAAOC,OAAO,GAAGN,SAAS,IAAIO,QAAQ,uCAAuCA,QAAQ"}
@@ -3,7 +3,7 @@ var once = require('call-once-fn');
3
3
  var nextTick = require('next-tick');
4
4
  var constants = require('./constants');
5
5
  var spawn = require('./spawn');
6
- function normalize(cp, options, callback) {
6
+ function worker(cp, options, callback) {
7
7
  if (typeof options === 'function') {
8
8
  callback = options;
9
9
  options = {};
@@ -75,8 +75,8 @@ function spawnCallback(command, args, options, callback) {
75
75
  options = options || {};
76
76
  callback = once(callback);
77
77
  var cp = spawn(command, args, options);
78
- return normalize(cp, options, callback);
78
+ return worker(cp, options, callback);
79
79
  }
80
80
  module.exports = spawnCallback;
81
- module.exports.normalize = normalize;
81
+ module.exports.worker = worker;
82
82
  /* 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/@compat/cross-spawn-cb/src/spawnCallback.js"],"sourcesContent":["const once = require('call-once-fn');\nconst nextTick = require('next-tick');\nconst constants = require('./constants');\nconst spawn = require('./spawn');\n\nfunction normalize(cp, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n callback = once(callback);\n\n // collect output\n const res = { stdout: null, stderr: null };\n if (options.encoding) {\n if (cp.stdout) {\n res.stdout = [];\n cp.stdout.on('data', res.stdout.push.bind(res.stdout));\n }\n if (cp.stderr) {\n res.stderr = [];\n cp.stderr.on('data', res.stderr.push.bind(res.stderr));\n }\n }\n\n // some versions of node emit both an error and close\n cp.on('error', function error(err) {\n err.code === 'OK' || callback(err);\n });\n\n // done\n cp.on('close', (status, signal) => {\n nextTick(function closeNextTick() {\n // prepare result\n res.pid = cp.pid;\n res.status = status;\n res.signal = signal;\n if (res.stdout) {\n res.stdout = Buffer.concat(res.stdout);\n if (options.encoding !== 'buffer') res.stdout = res.stdout.toString(options.encoding);\n }\n if (res.stderr) {\n res.stderr = Buffer.concat(res.stderr);\n if (options.encoding !== 'buffer') res.stderr = res.stderr.toString(options.encoding);\n }\n res.output = [null, res.stdout, res.stderr];\n\n // patch: early node on windows could return null\n if (res.status === null) res.status = 0;\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (constants.spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString('utf8') : res[key];\n }\n }\n err ? callback(err) : callback(null, res);\n });\n });\n\n // pipe input\n if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {\n cp.stdin.end(options.input);\n }\n}\n\nfunction spawnCallback(command, args, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n callback = once(callback);\n const cp = spawn(command, args, options);\n return normalize(cp, options, callback);\n}\n\nmodule.exports = spawnCallback;\nmodule.exports.normalize = normalize;\n"],"names":["once","require","nextTick","constants","spawn","normalize","cp","options","callback","res","stdout","stderr","encoding","on","push","bind","error","err","code","status","signal","closeNextTick","pid","Buffer","concat","toString","output","Error","key","spawnKeys","indexOf","isBuffer","input","stdin","end","spawnCallback","command","args","module","exports"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,WAAWD,QAAQ;AACzB,IAAME,YAAYF,QAAQ;AAC1B,IAAMG,QAAQH,QAAQ;AAEtB,SAASI,UAAUC,EAAE,EAAEC,OAAO,EAAEC,QAAQ;IACtC,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IACtBC,WAAWR,KAAKQ;IAEhB,iBAAiB;IACjB,IAAMC,MAAM;QAAEC,QAAQ;QAAMC,QAAQ;IAAK;IACzC,IAAIJ,QAAQK,QAAQ,EAAE;QACpB,IAAIN,GAAGI,MAAM,EAAE;YACbD,IAAIC,MAAM,GAAG,EAAE;YACfJ,GAAGI,MAAM,CAACG,EAAE,CAAC,QAAQJ,IAAIC,MAAM,CAACI,IAAI,CAACC,IAA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,IAAMW,OAAOnB,IAAK;oBACrB,IAAIN,UAAU0B,SAAS,CAACC,OAAO,CAACF,OAAO,GAAG;oBAC1CX,GAAG,CAACW,IAAI,GAAGL,OAAOQ,QAAQ,CAACtB,GAAG,CAACmB,IAAI,IAAInB,GAAG,CAACmB,IAAI,CAACH,QAAQ,CAAC,UAAUhB,GAAG,CAACmB,IAAI;gBAC7E;YACF;YACAX,MAAMT,SAASS,OAAOT,SAAS,MAAMC;QACvC;IACF;IAEA,aAAa;IACb,IAAIF,QAAQyB,KAAK,IAAK,CAAA,OAAOzB,QAAQyB,KAAK,KAAK,YAAYT,OAAOQ,QAAQ,CAACxB,QAAQyB,KAAK,CAAA,GAAI;QAC1F1B,GAAG2B,KAAK,CAACC,GAAG,CAAC3B,QAAQyB,KAAK;IAC5B;AACF;AAEA,SAASG,cAAcC,OAAO,EAAEC,IAAI,EAAE9B,OAAO,EAAEC,QAAQ;IACrD,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IACtBC,WAAWR,KAAKQ;IAChB,IAAMF,KAAKF,MAAMgC,SAASC,MAAM9B;IAChC,OAAOF,UAAUC,IAAIC,SAASC;AAChC;AAEA8B,OAAOC,OAAO,GAAGJ;AACjBG,OAAOC,OAAO,CAAClC,SAAS,GAAGA"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/@compat/cross-spawn-cb/src/spawnCallback.cjs"],"sourcesContent":["const once = require('call-once-fn');\nconst nextTick = require('next-tick');\nconst constants = require('./constants');\nconst spawn = require('./spawn');\n\nfunction worker(cp, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n callback = once(callback);\n\n // collect output\n const res = { stdout: null, stderr: null };\n if (options.encoding) {\n if (cp.stdout) {\n res.stdout = [];\n cp.stdout.on('data', res.stdout.push.bind(res.stdout));\n }\n if (cp.stderr) {\n res.stderr = [];\n cp.stderr.on('data', res.stderr.push.bind(res.stderr));\n }\n }\n\n // some versions of node emit both an error and close\n cp.on('error', function error(err) {\n err.code === 'OK' || callback(err);\n });\n\n // done\n cp.on('close', (status, signal) => {\n nextTick(function closeNextTick() {\n // prepare result\n res.pid = cp.pid;\n res.status = status;\n res.signal = signal;\n if (res.stdout) {\n res.stdout = Buffer.concat(res.stdout);\n if (options.encoding !== 'buffer') res.stdout = res.stdout.toString(options.encoding);\n }\n if (res.stderr) {\n res.stderr = Buffer.concat(res.stderr);\n if (options.encoding !== 'buffer') res.stderr = res.stderr.toString(options.encoding);\n }\n res.output = [null, res.stdout, res.stderr];\n\n // patch: early node on windows could return null\n if (res.status === null) res.status = 0;\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (constants.spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString('utf8') : res[key];\n }\n }\n err ? callback(err) : callback(null, res);\n });\n });\n\n // pipe input\n if (options.input && (typeof options.input === 'string' || Buffer.isBuffer(options.input))) {\n cp.stdin.end(options.input);\n }\n}\n\nfunction spawnCallback(command, args, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n callback = once(callback);\n const cp = spawn(command, args, options);\n return worker(cp, options, callback);\n}\n\nmodule.exports = spawnCallback;\nmodule.exports.worker = worker;\n"],"names":["once","require","nextTick","constants","spawn","worker","cp","options","callback","res","stdout","stderr","encoding","on","push","bind","error","err","code","status","signal","closeNextTick","pid","Buffer","concat","toString","output","Error","key","spawnKeys","indexOf","isBuffer","input","stdin","end","spawnCallback","command","args","module","exports"],"mappings":";AAAA,IAAMA,OAAOC,QAAQ;AACrB,IAAMC,WAAWD,QAAQ;AACzB,IAAME,YAAYF,QAAQ;AAC1B,IAAMG,QAAQH,QAAQ;AAEtB,SAASI,OAAOC,EAAE,EAAEC,OAAO,EAAEC,QAAQ;IACnC,IAAI,OAAOD,YAAY,Y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
54
  var constants = require('./constants');
55
55
  var spawn = require('./spawn');
56
- function normalize(res, options) {
56
+ function worker(res, options) {
57
57
  // pipe if inherited
58
58
  if (res.stdout && (options.stdout === 'inherit' || options.stdio === 'inherit')) {
59
59
  process.stdout.write(res.stdout);
@@ -84,8 +84,8 @@ function spawnCallbackSync(command, args, options) {
84
84
  encoding: 'utf8'
85
85
  });
86
86
  var res = spawn.sync(command, args, syncOptions);
87
- return normalize(res, options);
87
+ return worker(res, options);
88
88
  }
89
89
  module.exports = spawnCallbackSync;
90
- module.exports.normalize = normalize;
90
+ module.exports.worker = worker;
91
91
  /* 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/@compat/cross-spawn-cb/src/spawnSyncCallback.cjs"],"sourcesContent":["const constants = require('./constants');\nconst spawn = require('./spawn');\n\nfunction worker(res, options) {\n // pipe if inherited\n if (res.stdout && (options.stdout === 'inherit' || options.stdio === 'inherit')) {\n process.stdout.write(res.stdout);\n res.stdout = null;\n }\n if (res.stderr && (options.stderr === 'inherit' || options.stdio === 'inherit')) {\n process.stderr.write(res.stderr);\n res.stderr = null;\n }\n\n // patch: early node on windows could return null\n if (res.status === null) res.status = 0;\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (constants.spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString('utf8') : res[key];\n }\n }\n if (err) throw err;\n return res;\n}\n\nfunction spawnCallbackSync(command, args, options) {\n options = options || {};\n const syncOptions = { ...options, env: options.env || process.env, stdio: 'pipe', encoding: 'utf8' };\n const res = spawn.sync(command, args, syncOptions);\n return worker(res, options);\n}\n\nmodule.exports = spawnCallbackSync;\nmodule.exports.worker = worker;\n"],"names":["constants","require","spawn","worker","res","options","stdout","stdio","process","write","stderr","status","err","Error","key","spawnKeys","indexOf","Buffer","isBuffer","toString","spawnCallbackSync","command","args","syncOptions","env","encoding","sync","module","exports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,YAAYC,QAAQ;AAC1B,IAAMC,QAAQD,QAAQ;AAEtB,SAASE,OAAOC,GAAG,EAAEC,OAAO;IAC1B,oBAAoB;IACpB,IAAID,IAAIE,MAAM,IAAKD,CAAAA,QAAQC,MAAM,KAAK,aAAaD,QAAQE,KAAK,KAAK,SAAQ,GAAI;QAC/EC,QAAQF,MAAM,CAACG,KAAK,CAACL,IAAIE,MAAM;QAC/BF,IAAIE,MAAM,GAAG;IACf;IACA,IAAIF,IAAIM,MAAM,IAAKL,CAAAA,QAAQK,MAAM,KAAK,aAAaL,QAAQE,KAAK,KAAK,SAAQ,GAAI;QAC/EC,QAAQE,MAAM,CAACD,KAAK,CAACL,IAAIM,MAAM;QAC/BN,IAAIM,MAAM,GAAG;IACf;IAEA,iDAAiD;IACjD,IAAIN,IAAIO,MAAM,KAAK,MAAMP,IAAIO,MAAM,GAAG;IAEtC,iBAAiB;IACjB,IAAMC,MAAMR,IAAIO,MAAM,KAAK,IAAI,IAAIE,MAAM,AAAC,uBAAiC,OAAXT,IAAIO,MAAM,KAAM;IAChF,IAAIC,KAAK;QACP,IAAK,IAAME,OAAOV,IAAK;YACrB,IAAIJ,UAAUe,SAAS,CAACC,OAAO,CAACF,OAAO,GAAG;YAC1CF,GAAG,CAACE,IAAI,GAAGG,OAAOC,QAAQ,CAACd,GAAG,CAACU,IAAI,IAAIV,GAAG,CAACU,IAAI,CAACK,QAAQ,CAAC,UAAUf,GAAG,CAACU,IAAI;QAC7E;IACF;IACA,IAAIF,KAAK,MAAMA;IACf,OAAOR;AACT;AAEA,SAASgB,kBAAkBC,OAAO,EAAEC,IAAI,EAAEjB,OAAO;IAC/CA,UAAUA,WAAW,CAAC;IACtB,IAAMkB,cAAc,wCAAKlB;QAASmB,KAAKnB,QAAQmB,GAAG,IAAIhB,QAAQgB,GAAG;QAAEjB,OAAO;QAAQkB,UAAU;;IAC5F,IAAMrB,MAAMF,MAAMwB,IAAI,CAACL,SAASC,MAAMC;IACtC,OAAOpB,OAAOC,KAAKC;AACrB;AAEAsB,OAAOC,OAAO,GAAGR;AACjBO,OAAOC,OAAO,CAACzB,MAAM,GAAGA"}
@@ -0,0 +1,9 @@
1
+ declare const _exports: {
2
+ (command: any, args: any, options: any, callback: any): void;
3
+ worker: typeof import("./spawnCallback.cjs").worker;
4
+ sync: typeof import("./spawnSyncCallback.cjs");
5
+ spawn: any;
6
+ _parse: any;
7
+ _enoent: any;
8
+ };
9
+ export = _exports;
@@ -0,0 +1,2 @@
1
+ declare const _exports: any;
2
+ export = _exports;
@@ -1,6 +1,6 @@
1
1
  export = spawnCallback;
2
2
  declare function spawnCallback(command: any, args: any, options: any, callback: any): void;
3
3
  declare namespace spawnCallback {
4
- export { normalize };
4
+ export { worker };
5
5
  }
6
- declare function normalize(cp: any, options: any, callback: any): void;
6
+ declare function worker(cp: any, options: any, callback: any): void;
@@ -1,6 +1,6 @@
1
1
  export = spawnCallbackSync;
2
2
  declare function spawnCallbackSync(command: any, args: any, options: any): any;
3
3
  declare namespace spawnCallbackSync {
4
- export { normalize };
4
+ export { worker };
5
5
  }
6
- declare function normalize(res: any, options: any): any;
6
+ declare function worker(res: any, options: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cross-spawn-cb",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "Cross spawn with a completion callback",
5
5
  "keywords": [
6
6
  "cross-spawn",
@@ -44,13 +44,13 @@
44
44
  "node-resolve-versions": "^1.0.2",
45
45
  "node-version-utils": "^1.1.2",
46
46
  "rimraf2": "^2.8.2",
47
- "ts-swc-loaders": "^1.5.7"
47
+ "ts-swc-loaders": "^1.5.9"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=0.8"
51
51
  },
52
52
  "tsds": {
53
- "source": "src/index.mjs",
53
+ "source": "src/index.cjs",
54
54
  "targets": [
55
55
  "cjs"
56
56
  ]
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/OpenSource/@compat/cross-spawn-cb/src/spawnCallbackSync.js"],"sourcesContent":["const constants = require('./constants');\nconst spawn = require('./spawn');\n\nfunction normalize(res, options) {\n // pipe if inherited\n if (res.stdout && (options.stdout === 'inherit' || options.stdio === 'inherit')) {\n process.stdout.write(res.stdout);\n res.stdout = null;\n }\n if (res.stderr && (options.stderr === 'inherit' || options.stdio === 'inherit')) {\n process.stderr.write(res.stderr);\n res.stderr = null;\n }\n\n // patch: early node on windows could return null\n if (res.status === null) res.status = 0;\n\n // process errors\n const err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (err) {\n for (const key in res) {\n if (constants.spawnKeys.indexOf(key) < 0) continue;\n err[key] = Buffer.isBuffer(res[key]) ? res[key].toString('utf8') : res[key];\n }\n }\n if (err) throw err;\n return res;\n}\n\nfunction spawnCallbackSync(command, args, options) {\n options = options || {};\n const syncOptions = { ...options, env: options.env || process.env, stdio: 'pipe', encoding: 'utf8' };\n const res = spawn.sync(command, args, syncOptions);\n return normalize(res, options);\n}\n\nmodule.exports = spawnCallbackSync;\nmodule.exports.normalize = normalize;\n"],"names":["constants","require","spawn","normalize","res","options","stdout","stdio","process","write","stderr","status","err","Error","key","spawnKeys","indexOf","Buffer","isBuffer","toString","spawnCallbackSync","command","args","syncOptions","env","encoding","sync","module","exports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,YAAYC,QAAQ;AAC1B,IAAMC,QAAQD,QAAQ;AAEtB,SAASE,UAAUC,GAAG,EAAEC,OAAO;IAC7B,oBAAoB;IACpB,IAAID,IAAIE,MAAM,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
- export { default as spawn } from "./spawn";
3
- export { default as sync } from "./spawnCallbackSync";
4
- import spawnCallback from './spawnCallback';
@@ -1,2 +0,0 @@
1
- export = spawn;
2
- declare const spawn: any;