cross-spawn-cb 0.6.18 → 1.0.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.
@@ -9,9 +9,4 @@ module.exports = {
9
9
  "output"
10
10
  ]
11
11
  };
12
-
13
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
14
- Object.defineProperty(exports.default, '__esModule', { value: true });
15
- for (var key in exports) exports.default[key] = exports[key];
16
- module.exports = exports.default;
17
- }
12
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) exports.default[key] = exports[key]; module.exports = exports.default; }
package/dist/cjs/index.js CHANGED
@@ -1,11 +1,32 @@
1
1
  "use strict";
2
- require("./polyfills");
3
- module.exports = require("./spawnCallback");
4
- module.exports.spawn = require("./spawnCallback");
5
- module.exports.sync = require("./spawnSyncCallback");
6
-
7
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
8
- Object.defineProperty(exports.default, '__esModule', { value: true });
9
- for (var key in exports) exports.default[key] = exports[key];
10
- module.exports = exports.default;
11
- }
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
+ require("./polyfills.js");
23
+ var _spawnCallback = /*#__PURE__*/ _interop_require_default(require("./spawnCallback"));
24
+ var _spawn = /*#__PURE__*/ _interop_require_default(require("./spawn"));
25
+ var _spawnCallbackSync = /*#__PURE__*/ _interop_require_default(require("./spawnCallbackSync"));
26
+ function _interop_require_default(obj) {
27
+ return obj && obj.__esModule ? obj : {
28
+ default: obj
29
+ };
30
+ }
31
+ var _default = _spawnCallback.default;
32
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) exports.default[key] = exports[key]; module.exports = exports.default; }
@@ -1 +1 @@
1
- {"version":3,"sources":["index.js"],"sourcesContent":["require('./polyfills');\n\nmodule.exports = require('./spawnCallback');\nmodule.exports.spawn = require('./spawnCallback');\nmodule.exports.sync = require('./spawnSyncCallback');\n"],"names":["require","module","exports","spawn","sync"],"mappings":";AAAAA,QAAQ;AAERC,OAAOC,OAAO,GAAGF,QAAQ;AACzBC,OAAOC,OAAO,CAACC,KAAK,GAAGH,QAAQ;AAC/BC,OAAOC,OAAO,CAACE,IAAI,GAAGJ,QAAQ"}
1
+ {"version":3,"sources":["index.mjs"],"sourcesContent":["import './polyfills.cjs';\n\nimport spawnCallback from './spawnCallback';\n\nexport default spawnCallback;\nexport { default as spawn } from './spawn';\nexport { default as sync } from './spawnCallbackSync';\n"],"names":["spawn","sync","spawnCallback"],"mappings":";;;;;;;;;;;IAIA,OAA6B;eAA7B;;IACoBA,KAAK;eAALA,cAAK;;IACLC,IAAI;eAAJA,0BAAI;;;QANjB;oEAEmB;4DAGO;wEACD;;;;;;IAFhC,WAAeC,sBAAa"}
@@ -16,9 +16,4 @@ if (!cp.spawnSync) {
16
16
  }, spawnCallback, cmd, args, options || {});
17
17
  };
18
18
  }
19
-
20
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
21
- Object.defineProperty(exports.default, '__esModule', { value: true });
22
- for (var key in exports) exports.default[key] = exports[key];
23
- module.exports = exports.default;
24
- }
19
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) exports.default[key] = exports[key]; module.exports = exports.default; }
@@ -1 +1 @@
1
- {"version":3,"sources":["polyfills.js"],"sourcesContent":["require('core-js/actual/object/assign');\nrequire('core-js/actual/object/keys');\nrequire('core-js/actual/array/find');\nrequire('buffer-v6-polyfill');\n\nconst path = require('path');\nif (!path.delimiter) path.delimiter = process.platform === 'win32' ? ';' : ':';\n\nconst cp = require('child_process');\nif (!cp.spawnSync) {\n const spawnCallback = path.join(__dirname, 'spawnCallback.js');\n\n let functionExec = null; // break dependencies\n cp.spawnSync = function spawnSyncPolyfill(cmd, args, options) {\n if (!functionExec) functionExec = require('function-exec-sync');\n\n return functionExec({ callbacks: true }, spawnCallback, cmd, args, options || {});\n };\n}\n"],"names":["require","path","delimiter","process","platform","cp","spawnSync","spawnCallback","join","__dirname","functionExec","spawnSyncPolyfill","cmd","args","options","callbacks"],"mappings":";AAAAA,QAAQ;AACRA,QAAQ;AACRA,QAAQ;AACRA,QAAQ;AAER,IAAMC,OAAOD,QAAQ;AACrB,IAAI,CAACC,KAAKC,SAAS,EAAED,KAAKC,SAAS,GAAGC,QAAQC,QAAQ,KAAK,UAAU,MAAM;AAE3E,IAAMC,KAAKL,QAAQ;AACnB,IAAI,CAACK,GAAGC,SAAS,EAAE;IACjB,IAAMC,gBAAgBN,KAAKO,IAAI,CAACC,WAAW;IAE3C,IAAIC,eAAe,MAAM,qBAAqB;IAC9CL,GAAGC,SAAS,GAAG,SAASK,kBAAkBC,GAAG,EAAEC,IAAI,EAAEC,OAAO;QAC1D,IAAI,CAACJ,cAAcA,eAAeV,QAAQ;QAE1C,OAAOU,aAAa;YAAEK,WAAW;QAAK,GAAGR,eAAeK,KAAKC,MAAMC,WAAW,CAAC;IACjF;AACF"}
1
+ {"version":3,"sources":["polyfills.cjs"],"sourcesContent":["require('core-js/actual/object/assign');\nrequire('core-js/actual/object/keys');\nrequire('core-js/actual/array/find');\nrequire('buffer-v6-polyfill');\n\nconst path = require('path');\nif (!path.delimiter) path.delimiter = process.platform === 'win32' ? ';' : ':';\n\nconst cp = require('child_process');\nif (!cp.spawnSync) {\n const spawnCallback = path.join(__dirname, 'spawnCallback.js');\n\n let functionExec = null; // break dependencies\n cp.spawnSync = function spawnSyncPolyfill(cmd, args, options) {\n if (!functionExec) functionExec = require('function-exec-sync');\n\n return functionExec({ callbacks: true }, spawnCallback, cmd, args, options || {});\n };\n}\n"],"names":["require","path","delimiter","process","platform","cp","spawnSync","spawnCallback","join","__dirname","functionExec","spawnSyncPolyfill","cmd","args","options","callbacks"],"mappings":";AAAAA,QAAQ;AACRA,QAAQ;AACRA,QAAQ;AACRA,QAAQ;AAER,IAAMC,OAAOD,QAAQ;AACrB,IAAI,CAACC,KAAKC,SAAS,EAAED,KAAKC,SAAS,GAAGC,QAAQC,QAAQ,KAAK,UAAU,MAAM;AAE3E,IAAMC,KAAKL,QAAQ;AACnB,IAAI,CAACK,GAAGC,SAAS,EAAE;IACjB,IAAMC,gBAAgBN,KAAKO,IAAI,CAACC,WAAW;IAE3C,IAAIC,eAAe,MAAM,qBAAqB;IAC9CL,GAAGC,SAAS,GAAG,SAASK,kBAAkBC,GAAG,EAAEC,IAAI,EAAEC,OAAO;QAC1D,IAAI,CAACJ,cAAcA,eAAeV,QAAQ;QAE1C,OAAOU,aAAa;YAAEK,WAAW;QAAK,GAAGR,eAAeK,KAAKC,MAAMC,WAAW,CAAC;IACjF;AACF"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ var major = +process.versions.node.split(".")[0];
3
+ var spawn = major <= 7 ? require("../../assets/cross-spawn-6.0.5.js").spawn : require("cross-spawn").spawn;
4
+ module.exports = spawn;
5
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) exports.default[key] = exports[key]; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["spawn.js"],"sourcesContent":["const major = +process.versions.node.split('.')[0];\nconst spawn = major <= 7 ? require('../../assets/cross-spawn-6.0.5.js').spawn : require('cross-spawn').spawn;\n\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,qCAAqCD,KAAK,GAAGC,QAAQ,eAAeD,KAAK;AAE5GE,OAAOC,OAAO,GAAGH"}
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
- require("./polyfills");
2
+ require("./polyfills.js");
3
3
  var once = require("once");
4
4
  var nextTick = require("next-tick");
5
5
  var constants = require("./constants");
6
- var major = +process.versions.node.split(".")[0];
7
- var spawn = major <= 7 ? require("../../assets/cross-spawn-6.0.5.js").spawn : require("cross-spawn").spawn;
8
- module.exports = function spawnCallback(command, args, options, callback) {
6
+ var spawn = require("./spawn");
7
+ function normalize(cp, options, callback) {
9
8
  if (typeof options === "function") {
10
9
  callback = options;
11
10
  options = {};
12
11
  }
13
12
  options = options || {};
14
13
  callback = once(callback);
15
- var cp = spawn(command, args, options);
16
14
  // collect output
17
15
  var res = {
18
16
  stdout: null,
@@ -71,10 +69,17 @@ module.exports = function spawnCallback(command, args, options, callback) {
71
69
  if (options.input && (typeof options.input === "string" || Buffer.isBuffer(options.input))) {
72
70
  cp.stdin.end(options.input);
73
71
  }
74
- };
75
-
76
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
77
- Object.defineProperty(exports.default, '__esModule', { value: true });
78
- for (var key in exports) exports.default[key] = exports[key];
79
- module.exports = exports.default;
80
- }
72
+ }
73
+ function spawnCallback(command, args, options, callback) {
74
+ if (typeof options === "function") {
75
+ callback = options;
76
+ options = {};
77
+ }
78
+ options = options || {};
79
+ callback = once(callback);
80
+ var cp = spawn(command, args, options);
81
+ return normalize(cp, options, callback);
82
+ }
83
+ module.exports = spawnCallback;
84
+ module.exports.normalize = normalize;
85
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) exports.default[key] = exports[key]; module.exports = exports.default; }
@@ -1 +1 @@
1
- {"version":3,"sources":["spawnCallback.js"],"sourcesContent":["require('./polyfills');\nconst once = require('once');\nconst nextTick = require('next-tick');\nconst constants = require('./constants');\n\nconst major = +process.versions.node.split('.')[0];\nconst spawn = major <= 7 ? require('../../assets/cross-spawn-6.0.5.js').spawn : require('cross-spawn').spawn;\n\nmodule.exports = function spawnCallback(command, args, options, callback) {\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n options = options || {};\n callback = once(callback);\n\n const cp = spawn(command, args, options);\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) console.log('spawnCallback null status code', res);\n // res.status = res.status === null ? 0 : res.status;\n\n // process errors\n let err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (res.stderr && res.stderr.length) {\n err = err || new Error('stderr has content');\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"],"names":["require","once","nextTick","constants","major","process","versions","node","split","spawn","module","exports","spawnCallback","command","args","options","callback","cp","res","stdout","stderr","encoding","on","push","bind","error","err","code","status","signal","closeNextTick","pid","Buffer","concat","toString","output","console","log","Error","length","key","spawnKeys","indexOf","isBuffer","input","stdin","end"],"mappings":";AAAAA,QAAQ;AACR,IAAMC,OAAOD,QAAQ;AACrB,IAAME,WAAWF,QAAQ;AACzB,IAAMG,YAAYH,QAAQ;AAE1B,IAAMI,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,QAAQL,SAAS,IAAIJ,QAAQ,qCAAqCS,KAAK,GAAGT,QAAQ,eAAeS,KAAK;AAE5GC,OAAOC,OAAO,GAAG,SAASC,cAAcC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,QAAQ;IACtE,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IACtBC,WAAWf,KAAKe;IAEhB,IAAMC,KAAKR,MAAMI,SAASC,MAAMC;IAEhC,iBAAiB;IACjB,IAAMG,MAAM;QAAEC,QAAQ;QAAMC,QAAQ;IAAK;IACzC,IAAIL,QAAQM,QAAQ,EAAE;QACpB,IAAIJ,GAAGE,MAAM,EAAE;YACbD,IAAIC,MAAM,GAAG,EAAE;YACfF,GAAGE,MAAM,CAACG,EAAE,CAAC,QAAQJ,IAAIC,MAAM,CAACI,IAAI,CAACC,IAAI,CAACN,IAAIC,MAAM;QACtD;QACA,IAAIF,GAAGG,MAAM,EAAE;YACbF,IAAIE,MAAM,GAAG,EAAE;YACfH,GAAGG,MAAM,CAACE,EAAE,CAAC,QAAQJ,IAAIE,MAAM,CAACG,IAAI,CAACC,IAAI,CAACN,IAAIE,MAAM;QACtD;IACF;IAE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ACc,IAAI,GAAGR,OAAOW,QAAQ,CAACzB,GAAG,CAACsB,IAAI,IAAItB,GAAG,CAACsB,IAAI,CAACN,QAAQ,CAAC,UAAUhB,GAAG,CAACsB,IAAI;gBAC7E;YACF;YACAd,MAAMV,SAASU,OAAOV,SAAS,MAAME;QACvC;IACF;IAEA,aAAa;IACb,IAAIH,QAAQ6B,KAAK,IAAK,CAAA,OAAO7B,QAAQ6B,KAAK,KAAK,YAAYZ,OAAOW,QAAQ,CAAC5B,QAAQ6B,KAAK,CAAA,GAAI;QAC1F3B,GAAG4B,KAAK,CAACC,GAAG,CAAC/B,QAAQ6B,KAAK;IAC5B;AACF"}
1
+ {"version":3,"sources":["spawnCallback.js"],"sourcesContent":["require('./polyfills.cjs');\nconst once = require('once');\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) console.log('spawnCallback null status code', res);\n // res.status = res.status === null ? 0 : res.status;\n\n // process errors\n let err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (res.stderr && res.stderr.length) {\n err = err || new Error('stderr has content');\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":["require","once","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","console","log","Error","length","key","spawnKeys","indexOf","isBuffer","input","stdin","end","spawnCallback","command","args","module","exports"],"mappings":";AAAAA,QAAQ;AACR,IAAMC,OAAOD,QAAQ;AACrB,IAAME,WAAWF,QAAQ;AACzB,IAAMG,YAAYH,QAAQ;AAC1B,IAAMI,QAAQJ,QAAQ;AAEtB,SAASK,UAAUC,EAAE,EAAEC,OAAO,EAAEC,QAAQ;IACtC,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IACtBC,WAAWP,KAAKO;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,IAAI,CAACN,IAAIC,MAAM;QACtD;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F,IAAIE,MAAM,CAACmB,MAAM,EAAE;gBACnCb,MAAMA,OAAO,IAAIY,MAAM;gBACvB,IAAK,IAAME,OAAOtB,IAAK;oBACrB,IAAIN,UAAU6B,SAAS,CAACC,OAAO,CAACF,OAAO,GAAG;oBAC1Cd,GAAG,CAACc,IAAI,GAAGR,OAAOW,QAAQ,CAACzB,GAAG,CAACsB,IAAI,IAAItB,GAAG,CAACsB,IAAI,CAACN,QAAQ,CAAC,UAAUhB,GAAG,CAACsB,IAAI;gBAC7E;YACF;YACAd,MAAMT,SAASS,OAAOT,SAAS,MAAMC;QACvC;IACF;IAEA,aAAa;IACb,IAAIF,QAAQ4B,KAAK,IAAK,CAAA,OAAO5B,QAAQ4B,KAAK,KAAK,YAAYZ,OAAOW,QAAQ,CAAC3B,QAAQ4B,KAAK,CAAA,GAAI;QAC1F7B,GAAG8B,KAAK,CAACC,GAAG,CAAC9B,QAAQ4B,KAAK;IAC5B;AACF;AAEA,SAASG,cAAcC,OAAO,EAAEC,IAAI,EAAEjC,OAAO,EAAEC,QAAQ;IACrD,IAAI,OAAOD,YAAY,YAAY;QACjCC,WAAWD;QACXA,UAAU,CAAC;IACb;IACAA,UAAUA,WAAW,CAAC;IACtBC,WAAWP,KAAKO;IAChB,IAAMF,KAAKF,MAAMmC,SAASC,MAAMjC;IAChC,OAAOF,UAAUC,IAAIC,SAASC;AAChC;AAEAiC,OAAOC,OAAO,GAAGJ;AACjBG,OAAOC,OAAO,CAACrC,SAAS,GAAGA"}
@@ -1,17 +1,9 @@
1
1
  "use strict";
2
2
  var constants = require("./constants");
3
- var major = +process.versions.node.split(".")[0];
4
- var spawnSync = major <= 7 ? require("../../assets/cross-spawn-6.0.5.js").sync : require("cross-spawn").sync;
5
- module.exports = function spawnSyncCallback(command, args, options) {
6
- options = options || {};
7
- var syncOptions = Object.assign({}, options || {}, {
8
- env: options.env || process.env,
9
- stdio: "pipe",
10
- encoding: "utf8"
11
- });
12
- var res = spawnSync(command, args, syncOptions);
3
+ var spawn = require("./spawn");
4
+ function normalize(res, options) {
13
5
  // patch: early node on windows could return null
14
- if (res.status === null) console.log("spawnSyncCallback null status code", res);
6
+ if (res.status === null) console.log("spawnCallbackSync null status code", res);
15
7
  // res.status = res.status === null ? 0 : res.status;
16
8
  // pipe if inherited
17
9
  if (res.stdout && (options.stdout === "inherit" || options.stdio === "inherit")) {
@@ -33,10 +25,17 @@ module.exports = function spawnSyncCallback(command, args, options) {
33
25
  }
34
26
  if (err) throw err;
35
27
  return res;
36
- };
37
-
38
- if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
39
- Object.defineProperty(exports.default, '__esModule', { value: true });
40
- for (var key in exports) exports.default[key] = exports[key];
41
- module.exports = exports.default;
42
- }
28
+ }
29
+ function spawnCallbackSync(command, args, options) {
30
+ options = options || {};
31
+ var syncOptions = Object.assign({}, options || {}, {
32
+ env: options.env || process.env,
33
+ stdio: "pipe",
34
+ encoding: "utf8"
35
+ });
36
+ var res = spawn.sync(command, args, syncOptions);
37
+ return normalize(res, options);
38
+ }
39
+ module.exports = spawnCallbackSync;
40
+ module.exports.normalize = normalize;
41
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) exports.default[key] = exports[key]; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["spawnCallbackSync.js"],"sourcesContent":["const constants = require('./constants');\nconst spawn = require('./spawn');\n\nfunction normalize(res, options) {\n // patch: early node on windows could return null\n if (res.status === null) console.log('spawnCallbackSync null status code', res);\n // res.status = res.status === null ? 0 : res.status;\n\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 // process errors\n let err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (res.stderr && res.stderr.length) {\n err = err || new Error('stderr has content');\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\n const syncOptions = Object.assign({}, options || {}, {\n env: options.env || process.env,\n stdio: 'pipe',\n encoding: 'utf8',\n });\n const res = spawn.sync(command, args, syncOptions);\n\n return normalize(res, options);\n}\n\nmodule.exports = spawnCallbackSync;\nmodule.exports.normalize = normalize;\n"],"names":["constants","require","spawn","normalize","res","options","status","console","log","stdout","stdio","process","write","stderr","err","Error","length","key","spawnKeys","indexOf","Buffer","isBuffer","toString","spawnCallbackSync","command","args","syncOptions","Object","assign","env","encoding","sync","module","exports"],"mappings":";AAAA,IAAMA,YAAYC,QAAQ;AAC1B,IAAMC,QAAQD,QAAQ;AAEtB,SAASE,UAAUC,GAAG,EAAEC,OAAO;IAC7B,iDAAiD;IACjD,IAAID,IAAIE,MAAM,KAAK,MAAMC,QAAQC,GAAG,CAAC,sCAAsCJ;IAC3E,qDAAqD;IAErD,oBAAoB;IACpB,IAAIA,IAAIK,MAAM,IAAKJ,CAAAA,QAAQI,MAAM,KAAK,aAAaJ,QAAQK,KAAK,KAAK,SAAQ,GAAI;QAC/EC,QAAQF,MAAM,CAACG,KAAK,CAACR,IAAIK,MAAM;QAC/BL,IAAIK,MAAM,GAAG;IACf;IACA,IAAIL,IAAIS,MAAM,IAAKR,CAAAA,QAAQQ,MAAM,KAAK,aAAaR,QAAQK,KAAK,KAAK,SAAQ,GAAI;QAC/EC,QAAQE,MAAM,CAACD,KAAK,CAACR,IAAIS,MAAM;QAC/BT,IAAIS,MAAM,GAAG;IACf;IAEA,iBAAiB;IACjB,IAAIC,MAAMV,IAAIE,MAAM,KAAK,IAAI,IAAIS,MAAM,AAAC,uBAAiC,OAAXX,IAAIE,MAAM,KAAM;IAC9E,IAAIF,IAAIS,MAAM,IAAIT,IAAIS,MAAM,CAACG,MAAM,EAAE;QACnCF,MAAMA,OAAO,IAAIC,MAAM;QACvB,IAAK,IAAME,OAAOb,IAAK;YACrB,IAAIJ,UAAUkB,SAAS,CAACC,OAAO,CAACF,OAAO,GAAG;YAC1CH,GAAG,CAACG,IAAI,GAAGG,OAAOC,QAAQ,CAACjB,GAAG,CAACa,IAAI,IAAIb,GAAG,CAACa,IAAI,CAACK,QAAQ,CAAC,UAAUlB,GAAG,CAACa,IAAI;QAC7E;IACF;IACA,IAAIH,KAAK,MAAMA;IACf,OAAOV;AACT;AAEA,SAASmB,kBAAkBC,OAAO,EAAEC,IAAI,EAAEpB,OAAO;IAC/CA,UAAUA,WAAW,CAAC;IAEtB,IAAMqB,cAAcC,OAAOC,MAAM,CAAC,CAAC,GAAGvB,WAAW,CAAC,GAAG;QACnDwB,KAAKxB,QAAQwB,GAAG,IAAIlB,QAAQkB,GAAG;QAC/BnB,OAAO;QACPoB,UAAU;IACZ;IACA,IAAM1B,MAAMF,MAAM6B,IAAI,CAACP,SAASC,MAAMC;IAEtC,OAAOvB,UAAUC,KAAKC;AACxB;AAEA2B,OAAOC,OAAO,GAAGV;AACjBS,OAAOC,OAAO,CAAC9B,SAAS,GAAGA"}
@@ -0,0 +1,4 @@
1
+ export default spawnCallback;
2
+ export { default as spawn } from "./spawn";
3
+ export { default as sync } from "./spawnCallbackSync";
4
+ import spawnCallback from './spawnCallback';
@@ -0,0 +1,2 @@
1
+ export = spawn;
2
+ declare const spawn: any;
@@ -1,2 +1,6 @@
1
- declare function _exports(command: any, args: any, options: any, callback: any): void;
2
- export = _exports;
1
+ export = spawnCallback;
2
+ declare function spawnCallback(command: any, args: any, options: any, callback: any): void;
3
+ declare namespace spawnCallback {
4
+ export { normalize };
5
+ }
6
+ declare function normalize(cp: any, options: any, callback: any): void;
@@ -0,0 +1,6 @@
1
+ export = spawnCallbackSync;
2
+ declare function spawnCallbackSync(command: any, args: any, options: any): any;
3
+ declare namespace spawnCallbackSync {
4
+ export { normalize };
5
+ }
6
+ declare function normalize(res: any, options: any): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cross-spawn-cb",
3
- "version": "0.6.18",
3
+ "version": "1.0.0",
4
4
  "description": "Cross spawn with a completion callback",
5
5
  "keywords": [
6
6
  "cross-spawn",
@@ -21,37 +21,38 @@
21
21
  "scripts": {
22
22
  "build": "tsds build",
23
23
  "deploy": "tsds deploy",
24
- "format": "biome check --apply-unsafe src/ test/",
25
- "test": "mocha-compat test/**/*.test.js --no-timeouts",
24
+ "format": "biome check --write --unsafe src/ test/",
25
+ "test": "ts-swc node_modules/.bin/mocha-compat test/**/*.test.js --no-timeouts",
26
26
  "test:engines": "nvu engines npm test",
27
27
  "version": "tsds version"
28
28
  },
29
29
  "dependencies": {
30
30
  "buffer-v6-polyfill": "^1.0.5",
31
- "core-js": "^3.36.0",
32
- "cross-spawn": "^7.0.3",
31
+ "core-js": "^3.39.0",
32
+ "cross-spawn": "^7.0.6",
33
33
  "function-exec-sync": "^0.2.11",
34
34
  "next-tick": "^1.1.0",
35
35
  "once": "^1.4.0",
36
36
  "semver": "^5.7.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@biomejs/biome": "^1.5.3",
40
- "@types/mocha": "^10.0.6",
41
- "@types/node": "^20.11.17",
39
+ "@biomejs/biome": "^1.9.4",
40
+ "@types/mocha": "^10.0.10",
41
+ "@types/node": "^22.9.2",
42
42
  "cr": "^0.1.0",
43
43
  "depcheck": "^1.4.7",
44
44
  "is-version": "^0.2.1",
45
- "node-install-release": "^0.4.8",
46
- "node-resolve-versions": "^0.3.9",
45
+ "mocha-compat": "^3.5.5",
46
+ "node-install-release": "^1.1.1",
47
+ "node-resolve-versions": "^0.3.10",
47
48
  "node-version-utils": "^0.5.6",
48
- "ts-dev-stack": "^0.9.10"
49
+ "ts-dev-stack": "^0.15.8"
49
50
  },
50
51
  "engines": {
51
52
  "node": ">=0.8"
52
53
  },
53
54
  "tsds": {
54
- "source": "src/index.js",
55
+ "source": "src/index.mjs",
55
56
  "targets": [
56
57
  "cjs"
57
58
  ]
@@ -1 +0,0 @@
1
- {"version":3,"sources":["spawnSyncCallback.js"],"sourcesContent":["const constants = require('./constants');\n\nconst major = +process.versions.node.split('.')[0];\nconst spawnSync = major <= 7 ? require('../../assets/cross-spawn-6.0.5.js').sync : require('cross-spawn').sync;\n\nmodule.exports = function spawnSyncCallback(command, args, options) {\n options = options || {};\n const syncOptions = Object.assign({}, options || {}, {\n env: options.env || process.env,\n stdio: 'pipe',\n encoding: 'utf8',\n });\n\n const res = spawnSync(command, args, syncOptions);\n\n // patch: early node on windows could return null\n if (res.status === null) console.log('spawnSyncCallback null status code', res);\n // res.status = res.status === null ? 0 : res.status;\n\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 // process errors\n let err = res.status !== 0 ? new Error(`Non-zero exit code: ${res.status}`) : null;\n if (res.stderr && res.stderr.length) {\n err = err || new Error('stderr has content');\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"],"names":["constants","require","major","process","versions","node","split","spawnSync","sync","module","exports","spawnSyncCallback","command","args","options","syncOptions","Object","assign","env","stdio","encoding","res","status","console","log","stdout","write","stderr","err","Error","length","key","spawnKeys","indexOf","Buffer","isBuffer","toString"],"mappings":";AAAA,IAAMA,YAAYC,QAAQ;AAE1B,IAAMC,QAAQ,CAACC,QAAQC,QAAQ,CAACC,IAAI,CAACC,KAAK,CAAC,IAAI,CAAC,EAAE;AAClD,IAAMC,YAAYL,SAAS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IAAI,CAACK,QAAQ,CAAC,UAAUf,GAAG,CAACU,IAAI;QAC7E;IACF;IACA,IAAIH,KAAK,MAAMA;IACf,OAAOP;AACT"}
@@ -1,6 +0,0 @@
1
- declare function _exports(command: any, args: any, options: any, callback: any): void;
2
- declare namespace _exports {
3
- let spawn: (command: any, args: any, options: any, callback: any) => void;
4
- let sync: (command: any, args: any, options: any) => any;
5
- }
6
- export = _exports;
@@ -1,2 +0,0 @@
1
- declare function _exports(command: any, args: any, options: any): any;
2
- export = _exports;
File without changes