@kubb/agent 4.28.0 → 4.29.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.
- package/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +382 -642
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +4 -6
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
- package/.output/server/index.mjs +4 -6
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/@kubb/fabric-core/dist/{defaultParser-BD_N68Bo.js → defaultParser-C1atU7yU.js} +2 -3
- package/.output/server/node_modules/@kubb/fabric-core/dist/{getRelativePath-C4Au07ON.js → getRelativePath-BcieQL5M.js} +1 -2
- package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +8 -9
- package/.output/server/node_modules/@kubb/fabric-core/dist/{Root-BQX3eHqb.js → onProcessExit-CF200hsz.js} +109 -190
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers/typescript.js +3 -4
- package/.output/server/node_modules/@kubb/fabric-core/dist/parsers.js +2 -3
- package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +58 -298
- package/.output/server/node_modules/@kubb/fabric-core/package.json +8 -18
- package/.output/server/node_modules/@kubb/react-fabric/dist/{chunk-DbZtQ4qb.js → chunk-Cnw5r_-A.js} +1 -5
- package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +39 -41
- package/.output/server/node_modules/@kubb/react-fabric/dist/{jsx-runtime-CQFBnRKx.js → jsx-runtime-Dm7PKVbc.js} +6 -24
- package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime.js +5 -4
- package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +3 -3
- package/.output/server/node_modules/@kubb/react-fabric/dist/{react--draJ5Pm.js → react-D652OKii.js} +31 -91
- package/.output/server/node_modules/@kubb/react-fabric/dist/{reactPlugin-DqJsInTf.js → reactPlugin-BkDkx1cs.js} +410 -1650
- package/.output/server/node_modules/@kubb/react-fabric/package.json +8 -11
- package/.output/server/node_modules/empathic/access.js +39 -0
- package/.output/server/node_modules/empathic/access.mjs +34 -0
- package/.output/server/node_modules/empathic/find.js +81 -0
- package/.output/server/node_modules/empathic/find.mjs +76 -0
- package/.output/server/node_modules/empathic/package.json +49 -0
- package/.output/server/node_modules/empathic/package.mjs +52 -0
- package/.output/server/node_modules/empathic/resolve.js +31 -0
- package/.output/server/node_modules/empathic/resolve.mjs +27 -0
- package/.output/server/node_modules/empathic/walk.js +22 -0
- package/.output/server/node_modules/empathic/walk.mjs +20 -0
- package/.output/server/node_modules/tinyexec/dist/main.js +633 -0
- package/.output/server/node_modules/tinyexec/package.json +61 -0
- package/.output/server/package.json +6 -44
- package/package.json +19 -21
- package/.output/server/node_modules/.nitro/path-key@3.1.1/index.js +0 -16
- package/.output/server/node_modules/.nitro/path-key@3.1.1/package.json +0 -39
- package/.output/server/node_modules/.nitro/path-key@4.0.0/index.js +0 -12
- package/.output/server/node_modules/.nitro/path-key@4.0.0/package.json +0 -41
- package/.output/server/node_modules/.nitro/path-to-regexp@3.3.0/index.js +0 -421
- package/.output/server/node_modules/.nitro/path-to-regexp@3.3.0/package.json +0 -46
- package/.output/server/node_modules/@kubb/fabric-core/dist/chunk-BVHe6Par.js +0 -22
- package/.output/server/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.js +0 -89
- package/.output/server/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.js +0 -34
- package/.output/server/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.js +0 -6
- package/.output/server/node_modules/@sec-ant/readable-stream/package.json +0 -98
- package/.output/server/node_modules/@sindresorhus/merge-streams/index.js +0 -265
- package/.output/server/node_modules/@sindresorhus/merge-streams/package.json +0 -49
- package/.output/server/node_modules/balanced-match/index.js +0 -62
- package/.output/server/node_modules/balanced-match/package.json +0 -48
- package/.output/server/node_modules/brace-expansion/index.js +0 -201
- package/.output/server/node_modules/brace-expansion/package.json +0 -50
- package/.output/server/node_modules/bytes/index.js +0 -159
- package/.output/server/node_modules/bytes/package.json +0 -39
- package/.output/server/node_modules/concat-map/index.js +0 -13
- package/.output/server/node_modules/concat-map/package.json +0 -59
- package/.output/server/node_modules/content-disposition/index.js +0 -445
- package/.output/server/node_modules/content-disposition/package.json +0 -39
- package/.output/server/node_modules/cross-spawn/index.js +0 -39
- package/.output/server/node_modules/cross-spawn/lib/enoent.js +0 -59
- package/.output/server/node_modules/cross-spawn/lib/parse.js +0 -91
- package/.output/server/node_modules/cross-spawn/lib/util/escape.js +0 -47
- package/.output/server/node_modules/cross-spawn/lib/util/readShebang.js +0 -23
- package/.output/server/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -52
- package/.output/server/node_modules/cross-spawn/package.json +0 -73
- package/.output/server/node_modules/execa/index.js +0 -28
- package/.output/server/node_modules/execa/lib/arguments/command.js +0 -20
- package/.output/server/node_modules/execa/lib/arguments/cwd.js +0 -39
- package/.output/server/node_modules/execa/lib/arguments/encoding-option.js +0 -50
- package/.output/server/node_modules/execa/lib/arguments/escape.js +0 -88
- package/.output/server/node_modules/execa/lib/arguments/fd-options.js +0 -108
- package/.output/server/node_modules/execa/lib/arguments/file-url.js +0 -25
- package/.output/server/node_modules/execa/lib/arguments/options.js +0 -96
- package/.output/server/node_modules/execa/lib/arguments/shell.js +0 -11
- package/.output/server/node_modules/execa/lib/arguments/specific.js +0 -111
- package/.output/server/node_modules/execa/lib/convert/add.js +0 -15
- package/.output/server/node_modules/execa/lib/convert/concurrent.js +0 -33
- package/.output/server/node_modules/execa/lib/convert/duplex.js +0 -69
- package/.output/server/node_modules/execa/lib/convert/iterable.js +0 -34
- package/.output/server/node_modules/execa/lib/convert/readable.js +0 -113
- package/.output/server/node_modules/execa/lib/convert/shared.js +0 -46
- package/.output/server/node_modules/execa/lib/convert/writable.js +0 -90
- package/.output/server/node_modules/execa/lib/io/contents.js +0 -116
- package/.output/server/node_modules/execa/lib/io/input-sync.js +0 -44
- package/.output/server/node_modules/execa/lib/io/iterate.js +0 -110
- package/.output/server/node_modules/execa/lib/io/max-buffer.js +0 -89
- package/.output/server/node_modules/execa/lib/io/output-async.js +0 -80
- package/.output/server/node_modules/execa/lib/io/output-sync.js +0 -135
- package/.output/server/node_modules/execa/lib/io/pipeline.js +0 -48
- package/.output/server/node_modules/execa/lib/io/strip-newline.js +0 -12
- package/.output/server/node_modules/execa/lib/ipc/array.js +0 -4
- package/.output/server/node_modules/execa/lib/ipc/buffer-messages.js +0 -47
- package/.output/server/node_modules/execa/lib/ipc/forward.js +0 -56
- package/.output/server/node_modules/execa/lib/ipc/get-each.js +0 -89
- package/.output/server/node_modules/execa/lib/ipc/get-one.js +0 -69
- package/.output/server/node_modules/execa/lib/ipc/graceful.js +0 -72
- package/.output/server/node_modules/execa/lib/ipc/incoming.js +0 -79
- package/.output/server/node_modules/execa/lib/ipc/ipc-input.js +0 -44
- package/.output/server/node_modules/execa/lib/ipc/methods.js +0 -49
- package/.output/server/node_modules/execa/lib/ipc/outgoing.js +0 -47
- package/.output/server/node_modules/execa/lib/ipc/reference.js +0 -44
- package/.output/server/node_modules/execa/lib/ipc/send.js +0 -91
- package/.output/server/node_modules/execa/lib/ipc/strict.js +0 -113
- package/.output/server/node_modules/execa/lib/ipc/validation.js +0 -111
- package/.output/server/node_modules/execa/lib/methods/bind.js +0 -23
- package/.output/server/node_modules/execa/lib/methods/command.js +0 -43
- package/.output/server/node_modules/execa/lib/methods/create.js +0 -65
- package/.output/server/node_modules/execa/lib/methods/main-async.js +0 -194
- package/.output/server/node_modules/execa/lib/methods/main-sync.js +0 -163
- package/.output/server/node_modules/execa/lib/methods/node.js +0 -51
- package/.output/server/node_modules/execa/lib/methods/parameters.js +0 -31
- package/.output/server/node_modules/execa/lib/methods/promise.js +0 -15
- package/.output/server/node_modules/execa/lib/methods/script.js +0 -22
- package/.output/server/node_modules/execa/lib/methods/template.js +0 -153
- package/.output/server/node_modules/execa/lib/pipe/abort.js +0 -20
- package/.output/server/node_modules/execa/lib/pipe/pipe-arguments.js +0 -91
- package/.output/server/node_modules/execa/lib/pipe/sequence.js +0 -24
- package/.output/server/node_modules/execa/lib/pipe/setup.js +0 -72
- package/.output/server/node_modules/execa/lib/pipe/streaming.js +0 -51
- package/.output/server/node_modules/execa/lib/pipe/throw.js +0 -58
- package/.output/server/node_modules/execa/lib/resolve/all-async.js +0 -46
- package/.output/server/node_modules/execa/lib/resolve/all-sync.js +0 -33
- package/.output/server/node_modules/execa/lib/resolve/exit-async.js +0 -54
- package/.output/server/node_modules/execa/lib/resolve/exit-sync.js +0 -25
- package/.output/server/node_modules/execa/lib/resolve/stdio.js +0 -47
- package/.output/server/node_modules/execa/lib/resolve/wait-stream.js +0 -96
- package/.output/server/node_modules/execa/lib/resolve/wait-subprocess.js +0 -146
- package/.output/server/node_modules/execa/lib/return/duration.js +0 -8
- package/.output/server/node_modules/execa/lib/return/early-error.js +0 -60
- package/.output/server/node_modules/execa/lib/return/final-error.js +0 -40
- package/.output/server/node_modules/execa/lib/return/message.js +0 -157
- package/.output/server/node_modules/execa/lib/return/reject.js +0 -13
- package/.output/server/node_modules/execa/lib/return/result.js +0 -186
- package/.output/server/node_modules/execa/lib/stdio/direction.js +0 -76
- package/.output/server/node_modules/execa/lib/stdio/duplicate.js +0 -116
- package/.output/server/node_modules/execa/lib/stdio/handle-async.js +0 -52
- package/.output/server/node_modules/execa/lib/stdio/handle-sync.js +0 -57
- package/.output/server/node_modules/execa/lib/stdio/handle.js +0 -214
- package/.output/server/node_modules/execa/lib/stdio/input-option.js +0 -50
- package/.output/server/node_modules/execa/lib/stdio/native.js +0 -106
- package/.output/server/node_modules/execa/lib/stdio/stdio-option.js +0 -60
- package/.output/server/node_modules/execa/lib/stdio/type.js +0 -173
- package/.output/server/node_modules/execa/lib/terminate/cancel.js +0 -20
- package/.output/server/node_modules/execa/lib/terminate/cleanup.js +0 -16
- package/.output/server/node_modules/execa/lib/terminate/graceful.js +0 -71
- package/.output/server/node_modules/execa/lib/terminate/kill.js +0 -93
- package/.output/server/node_modules/execa/lib/terminate/signal.js +0 -70
- package/.output/server/node_modules/execa/lib/terminate/timeout.js +0 -21
- package/.output/server/node_modules/execa/lib/transform/encoding-transform.js +0 -51
- package/.output/server/node_modules/execa/lib/transform/generator.js +0 -107
- package/.output/server/node_modules/execa/lib/transform/normalize.js +0 -111
- package/.output/server/node_modules/execa/lib/transform/object-mode.js +0 -41
- package/.output/server/node_modules/execa/lib/transform/run-async.js +0 -60
- package/.output/server/node_modules/execa/lib/transform/run-sync.js +0 -50
- package/.output/server/node_modules/execa/lib/transform/split.js +0 -110
- package/.output/server/node_modules/execa/lib/transform/validate.js +0 -43
- package/.output/server/node_modules/execa/lib/utils/abort-signal.js +0 -8
- package/.output/server/node_modules/execa/lib/utils/deferred.js +0 -7
- package/.output/server/node_modules/execa/lib/utils/max-listeners.js +0 -14
- package/.output/server/node_modules/execa/lib/utils/standard-stream.js +0 -6
- package/.output/server/node_modules/execa/lib/utils/uint-array.js +0 -69
- package/.output/server/node_modules/execa/lib/verbose/complete.js +0 -24
- package/.output/server/node_modules/execa/lib/verbose/custom.js +0 -26
- package/.output/server/node_modules/execa/lib/verbose/default.js +0 -54
- package/.output/server/node_modules/execa/lib/verbose/error.js +0 -13
- package/.output/server/node_modules/execa/lib/verbose/info.js +0 -39
- package/.output/server/node_modules/execa/lib/verbose/ipc.js +0 -15
- package/.output/server/node_modules/execa/lib/verbose/log.js +0 -54
- package/.output/server/node_modules/execa/lib/verbose/output.js +0 -60
- package/.output/server/node_modules/execa/lib/verbose/start.js +0 -15
- package/.output/server/node_modules/execa/lib/verbose/values.js +0 -33
- package/.output/server/node_modules/execa/package.json +0 -105
- package/.output/server/node_modules/figures/index.js +0 -292
- package/.output/server/node_modules/figures/package.json +0 -49
- package/.output/server/node_modules/fs-extra/lib/copy/copy-sync.js +0 -176
- package/.output/server/node_modules/fs-extra/lib/copy/copy.js +0 -180
- package/.output/server/node_modules/fs-extra/lib/copy/index.js +0 -7
- package/.output/server/node_modules/fs-extra/lib/empty/index.js +0 -39
- package/.output/server/node_modules/fs-extra/lib/ensure/file.js +0 -66
- package/.output/server/node_modules/fs-extra/lib/ensure/index.js +0 -23
- package/.output/server/node_modules/fs-extra/lib/ensure/link.js +0 -64
- package/.output/server/node_modules/fs-extra/lib/ensure/symlink-paths.js +0 -101
- package/.output/server/node_modules/fs-extra/lib/ensure/symlink-type.js +0 -34
- package/.output/server/node_modules/fs-extra/lib/ensure/symlink.js +0 -67
- package/.output/server/node_modules/fs-extra/lib/fs/index.js +0 -146
- package/.output/server/node_modules/fs-extra/lib/index.js +0 -16
- package/.output/server/node_modules/fs-extra/lib/json/index.js +0 -16
- package/.output/server/node_modules/fs-extra/lib/json/jsonfile.js +0 -11
- package/.output/server/node_modules/fs-extra/lib/json/output-json-sync.js +0 -12
- package/.output/server/node_modules/fs-extra/lib/json/output-json.js +0 -12
- package/.output/server/node_modules/fs-extra/lib/mkdirs/index.js +0 -14
- package/.output/server/node_modules/fs-extra/lib/mkdirs/make-dir.js +0 -27
- package/.output/server/node_modules/fs-extra/lib/mkdirs/utils.js +0 -21
- package/.output/server/node_modules/fs-extra/lib/move/index.js +0 -7
- package/.output/server/node_modules/fs-extra/lib/move/move-sync.js +0 -55
- package/.output/server/node_modules/fs-extra/lib/move/move.js +0 -59
- package/.output/server/node_modules/fs-extra/lib/output-file/index.js +0 -31
- package/.output/server/node_modules/fs-extra/lib/path-exists/index.js +0 -12
- package/.output/server/node_modules/fs-extra/lib/remove/index.js +0 -17
- package/.output/server/node_modules/fs-extra/lib/util/async.js +0 -29
- package/.output/server/node_modules/fs-extra/lib/util/stat.js +0 -159
- package/.output/server/node_modules/fs-extra/lib/util/utimes.js +0 -36
- package/.output/server/node_modules/fs-extra/package.json +0 -71
- package/.output/server/node_modules/get-stream/package.json +0 -60
- package/.output/server/node_modules/get-stream/source/array-buffer.js +0 -84
- package/.output/server/node_modules/get-stream/source/array.js +0 -32
- package/.output/server/node_modules/get-stream/source/buffer.js +0 -19
- package/.output/server/node_modules/get-stream/source/contents.js +0 -121
- package/.output/server/node_modules/get-stream/source/exports.js +0 -5
- package/.output/server/node_modules/get-stream/source/index.js +0 -13
- package/.output/server/node_modules/get-stream/source/stream.js +0 -65
- package/.output/server/node_modules/get-stream/source/string.js +0 -41
- package/.output/server/node_modules/get-stream/source/utils.js +0 -11
- package/.output/server/node_modules/graceful-fs/clone.js +0 -23
- package/.output/server/node_modules/graceful-fs/graceful-fs.js +0 -448
- package/.output/server/node_modules/graceful-fs/legacy-streams.js +0 -118
- package/.output/server/node_modules/graceful-fs/package.json +0 -53
- package/.output/server/node_modules/graceful-fs/polyfills.js +0 -355
- package/.output/server/node_modules/human-signals/build/src/core.js +0 -273
- package/.output/server/node_modules/human-signals/build/src/main.js +0 -70
- package/.output/server/node_modules/human-signals/build/src/realtime.js +0 -16
- package/.output/server/node_modules/human-signals/build/src/signals.js +0 -34
- package/.output/server/node_modules/human-signals/package.json +0 -66
- package/.output/server/node_modules/is-plain-obj/index.js +0 -8
- package/.output/server/node_modules/is-plain-obj/package.json +0 -41
- package/.output/server/node_modules/is-stream/index.js +0 -37
- package/.output/server/node_modules/is-stream/package.json +0 -48
- package/.output/server/node_modules/is-unicode-supported/index.js +0 -21
- package/.output/server/node_modules/is-unicode-supported/package.json +0 -47
- package/.output/server/node_modules/isexe/index.js +0 -57
- package/.output/server/node_modules/isexe/mode.js +0 -41
- package/.output/server/node_modules/isexe/package.json +0 -31
- package/.output/server/node_modules/isexe/windows.js +0 -42
- package/.output/server/node_modules/js-runtime/dist/index.js +0 -5
- package/.output/server/node_modules/js-runtime/package.json +0 -72
- package/.output/server/node_modules/jsonfile/index.js +0 -88
- package/.output/server/node_modules/jsonfile/package.json +0 -40
- package/.output/server/node_modules/jsonfile/utils.js +0 -14
- package/.output/server/node_modules/mime-db/db.json +0 -7088
- package/.output/server/node_modules/mime-db/index.js +0 -11
- package/.output/server/node_modules/mime-db/package.json +0 -57
- package/.output/server/node_modules/mime-types/index.js +0 -188
- package/.output/server/node_modules/mime-types/package.json +0 -43
- package/.output/server/node_modules/minimatch/minimatch.js +0 -947
- package/.output/server/node_modules/minimatch/package.json +0 -33
- package/.output/server/node_modules/natural-orderby/dist/main.js +0 -19
- package/.output/server/node_modules/natural-orderby/dist/umd/natural-orderby.development.js +0 -420
- package/.output/server/node_modules/natural-orderby/dist/umd/natural-orderby.production.min.js +0 -11
- package/.output/server/node_modules/natural-orderby/package.json +0 -119
- package/.output/server/node_modules/npm-run-path/index.js +0 -55
- package/.output/server/node_modules/npm-run-path/package.json +0 -52
- package/.output/server/node_modules/parse-ms/index.js +0 -45
- package/.output/server/node_modules/parse-ms/package.json +0 -47
- package/.output/server/node_modules/path-is-inside/lib/path-is-inside.js +0 -28
- package/.output/server/node_modules/path-is-inside/package.json +0 -27
- package/.output/server/node_modules/pretty-ms/index.js +0 -149
- package/.output/server/node_modules/pretty-ms/package.json +0 -55
- package/.output/server/node_modules/range-parser/index.js +0 -158
- package/.output/server/node_modules/range-parser/package.json +0 -40
- package/.output/server/node_modules/serve-handler/package.json +0 -68
- package/.output/server/node_modules/serve-handler/src/directory.js +0 -16
- package/.output/server/node_modules/serve-handler/src/error.js +0 -10
- package/.output/server/node_modules/serve-handler/src/glob-slash.js +0 -9
- package/.output/server/node_modules/serve-handler/src/index.js +0 -769
- package/.output/server/node_modules/shebang-command/index.js +0 -19
- package/.output/server/node_modules/shebang-command/package.json +0 -34
- package/.output/server/node_modules/shebang-regex/index.js +0 -2
- package/.output/server/node_modules/shebang-regex/package.json +0 -35
- package/.output/server/node_modules/signal-exit/dist/mjs/index.js +0 -275
- package/.output/server/node_modules/signal-exit/dist/mjs/package.json +0 -3
- package/.output/server/node_modules/signal-exit/dist/mjs/signals.js +0 -39
- package/.output/server/node_modules/signal-exit/package.json +0 -106
- package/.output/server/node_modules/string-argv/index.js +0 -41
- package/.output/server/node_modules/string-argv/package.json +0 -51
- package/.output/server/node_modules/strip-final-newline/index.js +0 -26
- package/.output/server/node_modules/strip-final-newline/package.json +0 -49
- package/.output/server/node_modules/unicorn-magic/default.js +0 -14
- package/.output/server/node_modules/unicorn-magic/node.js +0 -49
- package/.output/server/node_modules/unicorn-magic/package.json +0 -62
- package/.output/server/node_modules/universalify/index.js +0 -24
- package/.output/server/node_modules/universalify/package.json +0 -34
- package/.output/server/node_modules/which/package.json +0 -43
- package/.output/server/node_modules/which/which.js +0 -125
- package/.output/server/node_modules/yoctocolors/base.js +0 -94
- package/.output/server/node_modules/yoctocolors/index.js +0 -2
- package/.output/server/node_modules/yoctocolors/package.json +0 -69
- /package/.output/server/node_modules/{.nitro/path-to-regexp@8.3.0 → path-to-regexp}/dist/index.js +0 -0
- /package/.output/server/node_modules/{.nitro/path-to-regexp@8.3.0 → path-to-regexp}/package.json +0 -0
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// See http://www.robvanderwoude.com/escapechars.php
|
|
4
|
-
const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
|
|
5
|
-
|
|
6
|
-
function escapeCommand(arg) {
|
|
7
|
-
// Escape meta chars
|
|
8
|
-
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
9
|
-
|
|
10
|
-
return arg;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function escapeArgument(arg, doubleEscapeMetaChars) {
|
|
14
|
-
// Convert to string
|
|
15
|
-
arg = `${arg}`;
|
|
16
|
-
|
|
17
|
-
// Algorithm below is based on https://qntm.org/cmd
|
|
18
|
-
// It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input
|
|
19
|
-
// Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information
|
|
20
|
-
|
|
21
|
-
// Sequence of backslashes followed by a double quote:
|
|
22
|
-
// double up all the backslashes and escape the double quote
|
|
23
|
-
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
|
|
24
|
-
|
|
25
|
-
// Sequence of backslashes followed by the end of the string
|
|
26
|
-
// (which will become a double quote later):
|
|
27
|
-
// double up all the backslashes
|
|
28
|
-
arg = arg.replace(/(?=(\\+?)?)\1$/, '$1$1');
|
|
29
|
-
|
|
30
|
-
// All other backslashes occur literally
|
|
31
|
-
|
|
32
|
-
// Quote the whole thing:
|
|
33
|
-
arg = `"${arg}"`;
|
|
34
|
-
|
|
35
|
-
// Escape meta chars
|
|
36
|
-
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
37
|
-
|
|
38
|
-
// Double escape meta chars if necessary
|
|
39
|
-
if (doubleEscapeMetaChars) {
|
|
40
|
-
arg = arg.replace(metaCharsRegExp, '^$1');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return arg;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
module.exports.command = escapeCommand;
|
|
47
|
-
module.exports.argument = escapeArgument;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const shebangCommand = require('shebang-command');
|
|
5
|
-
|
|
6
|
-
function readShebang(command) {
|
|
7
|
-
// Read the first 150 bytes from the file
|
|
8
|
-
const size = 150;
|
|
9
|
-
const buffer = Buffer.alloc(size);
|
|
10
|
-
|
|
11
|
-
let fd;
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
fd = fs.openSync(command, 'r');
|
|
15
|
-
fs.readSync(fd, buffer, 0, size, 0);
|
|
16
|
-
fs.closeSync(fd);
|
|
17
|
-
} catch (e) { /* Empty */ }
|
|
18
|
-
|
|
19
|
-
// Attempt to extract shebang (null is returned if not a shebang)
|
|
20
|
-
return shebangCommand(buffer.toString());
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
module.exports = readShebang;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const which = require('which');
|
|
5
|
-
const getPathKey = require('path-key');
|
|
6
|
-
|
|
7
|
-
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
8
|
-
const env = parsed.options.env || process.env;
|
|
9
|
-
const cwd = process.cwd();
|
|
10
|
-
const hasCustomCwd = parsed.options.cwd != null;
|
|
11
|
-
// Worker threads do not have process.chdir()
|
|
12
|
-
const shouldSwitchCwd = hasCustomCwd && process.chdir !== undefined && !process.chdir.disabled;
|
|
13
|
-
|
|
14
|
-
// If a custom `cwd` was specified, we need to change the process cwd
|
|
15
|
-
// because `which` will do stat calls but does not support a custom cwd
|
|
16
|
-
if (shouldSwitchCwd) {
|
|
17
|
-
try {
|
|
18
|
-
process.chdir(parsed.options.cwd);
|
|
19
|
-
} catch (err) {
|
|
20
|
-
/* Empty */
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let resolved;
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
resolved = which.sync(parsed.command, {
|
|
28
|
-
path: env[getPathKey({ env })],
|
|
29
|
-
pathExt: withoutPathExt ? path.delimiter : undefined,
|
|
30
|
-
});
|
|
31
|
-
} catch (e) {
|
|
32
|
-
/* Empty */
|
|
33
|
-
} finally {
|
|
34
|
-
if (shouldSwitchCwd) {
|
|
35
|
-
process.chdir(cwd);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// If we successfully resolved, ensure that an absolute path is returned
|
|
40
|
-
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
|
41
|
-
if (resolved) {
|
|
42
|
-
resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return resolved;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function resolveCommand(parsed) {
|
|
49
|
-
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
module.exports = resolveCommand;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cross-spawn",
|
|
3
|
-
"version": "7.0.6",
|
|
4
|
-
"description": "Cross platform child_process#spawn and child_process#spawnSync",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"spawn",
|
|
7
|
-
"spawnSync",
|
|
8
|
-
"windows",
|
|
9
|
-
"cross-platform",
|
|
10
|
-
"path-ext",
|
|
11
|
-
"shebang",
|
|
12
|
-
"cmd",
|
|
13
|
-
"execute"
|
|
14
|
-
],
|
|
15
|
-
"author": "André Cruz <andre@moxy.studio>",
|
|
16
|
-
"homepage": "https://github.com/moxystudio/node-cross-spawn",
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "git@github.com:moxystudio/node-cross-spawn.git"
|
|
20
|
-
},
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"main": "index.js",
|
|
23
|
-
"files": [
|
|
24
|
-
"lib"
|
|
25
|
-
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"lint": "eslint .",
|
|
28
|
-
"test": "jest --env node --coverage",
|
|
29
|
-
"prerelease": "npm t && npm run lint",
|
|
30
|
-
"release": "standard-version",
|
|
31
|
-
"postrelease": "git push --follow-tags origin HEAD && npm publish"
|
|
32
|
-
},
|
|
33
|
-
"husky": {
|
|
34
|
-
"hooks": {
|
|
35
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
|
|
36
|
-
"pre-commit": "lint-staged"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"lint-staged": {
|
|
40
|
-
"*.js": [
|
|
41
|
-
"eslint --fix",
|
|
42
|
-
"git add"
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
"commitlint": {
|
|
46
|
-
"extends": [
|
|
47
|
-
"@commitlint/config-conventional"
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"path-key": "^3.1.0",
|
|
52
|
-
"shebang-command": "^2.0.0",
|
|
53
|
-
"which": "^2.0.1"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@commitlint/cli": "^8.1.0",
|
|
57
|
-
"@commitlint/config-conventional": "^8.1.0",
|
|
58
|
-
"babel-core": "^6.26.3",
|
|
59
|
-
"babel-jest": "^24.9.0",
|
|
60
|
-
"babel-preset-moxy": "^3.1.0",
|
|
61
|
-
"eslint": "^5.16.0",
|
|
62
|
-
"eslint-config-moxy": "^7.1.0",
|
|
63
|
-
"husky": "^3.0.5",
|
|
64
|
-
"jest": "^24.9.0",
|
|
65
|
-
"lint-staged": "^9.2.5",
|
|
66
|
-
"mkdirp": "^0.5.1",
|
|
67
|
-
"rimraf": "^3.0.0",
|
|
68
|
-
"standard-version": "^9.5.0"
|
|
69
|
-
},
|
|
70
|
-
"engines": {
|
|
71
|
-
"node": ">= 8"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {createExeca} from './lib/methods/create.js';
|
|
2
|
-
import {mapCommandAsync, mapCommandSync} from './lib/methods/command.js';
|
|
3
|
-
import {mapNode} from './lib/methods/node.js';
|
|
4
|
-
import {mapScriptAsync, setScriptSync, deepScriptOptions} from './lib/methods/script.js';
|
|
5
|
-
import {getIpcExport} from './lib/ipc/methods.js';
|
|
6
|
-
|
|
7
|
-
export {parseCommandString} from './lib/methods/command.js';
|
|
8
|
-
export {ExecaError, ExecaSyncError} from './lib/return/final-error.js';
|
|
9
|
-
|
|
10
|
-
export const execa = createExeca(() => ({}));
|
|
11
|
-
export const execaSync = createExeca(() => ({isSync: true}));
|
|
12
|
-
export const execaCommand = createExeca(mapCommandAsync);
|
|
13
|
-
export const execaCommandSync = createExeca(mapCommandSync);
|
|
14
|
-
export const execaNode = createExeca(mapNode);
|
|
15
|
-
export const $ = createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
sendMessage,
|
|
19
|
-
getOneMessage,
|
|
20
|
-
getEachMessage,
|
|
21
|
-
getCancelSignal,
|
|
22
|
-
} = getIpcExport();
|
|
23
|
-
export {
|
|
24
|
-
sendMessage,
|
|
25
|
-
getOneMessage,
|
|
26
|
-
getEachMessage,
|
|
27
|
-
getCancelSignal,
|
|
28
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {logCommand} from '../verbose/start.js';
|
|
2
|
-
import {getVerboseInfo} from '../verbose/info.js';
|
|
3
|
-
import {getStartTime} from '../return/duration.js';
|
|
4
|
-
import {joinCommand} from './escape.js';
|
|
5
|
-
import {normalizeFdSpecificOption} from './specific.js';
|
|
6
|
-
|
|
7
|
-
// Compute `result.command`, `result.escapedCommand` and `verbose`-related information
|
|
8
|
-
export const handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
9
|
-
const startTime = getStartTime();
|
|
10
|
-
const {command, escapedCommand} = joinCommand(filePath, rawArguments);
|
|
11
|
-
const verbose = normalizeFdSpecificOption(rawOptions, 'verbose');
|
|
12
|
-
const verboseInfo = getVerboseInfo(verbose, escapedCommand, {...rawOptions});
|
|
13
|
-
logCommand(escapedCommand, verboseInfo);
|
|
14
|
-
return {
|
|
15
|
-
command,
|
|
16
|
-
escapedCommand,
|
|
17
|
-
startTime,
|
|
18
|
-
verboseInfo,
|
|
19
|
-
};
|
|
20
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {statSync} from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import process from 'node:process';
|
|
4
|
-
import {safeNormalizeFileUrl} from './file-url.js';
|
|
5
|
-
|
|
6
|
-
// Normalize `cwd` option
|
|
7
|
-
export const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
8
|
-
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
9
|
-
return path.resolve(cwdString);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const getDefaultCwd = () => {
|
|
13
|
-
try {
|
|
14
|
-
return process.cwd();
|
|
15
|
-
} catch (error) {
|
|
16
|
-
error.message = `The current directory does not exist.\n${error.message}`;
|
|
17
|
-
throw error;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// When `cwd` option has an invalid value, provide with a better error message
|
|
22
|
-
export const fixCwdError = (originalMessage, cwd) => {
|
|
23
|
-
if (cwd === getDefaultCwd()) {
|
|
24
|
-
return originalMessage;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let cwdStat;
|
|
28
|
-
try {
|
|
29
|
-
cwdStat = statSync(cwd);
|
|
30
|
-
} catch (error) {
|
|
31
|
-
return `The "cwd" option is invalid: ${cwd}.\n${error.message}\n${originalMessage}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (!cwdStat.isDirectory()) {
|
|
35
|
-
return `The "cwd" option is not a directory: ${cwd}.\n${originalMessage}`;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return originalMessage;
|
|
39
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Validate `encoding` option
|
|
2
|
-
export const validateEncoding = ({encoding}) => {
|
|
3
|
-
if (ENCODINGS.has(encoding)) {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const correctEncoding = getCorrectEncoding(encoding);
|
|
8
|
-
if (correctEncoding !== undefined) {
|
|
9
|
-
throw new TypeError(`Invalid option \`encoding: ${serializeEncoding(encoding)}\`.
|
|
10
|
-
Please rename it to ${serializeEncoding(correctEncoding)}.`);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const correctEncodings = [...ENCODINGS].map(correctEncoding => serializeEncoding(correctEncoding)).join(', ');
|
|
14
|
-
throw new TypeError(`Invalid option \`encoding: ${serializeEncoding(encoding)}\`.
|
|
15
|
-
Please rename it to one of: ${correctEncodings}.`);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const TEXT_ENCODINGS = new Set(['utf8', 'utf16le']);
|
|
19
|
-
export const BINARY_ENCODINGS = new Set(['buffer', 'hex', 'base64', 'base64url', 'latin1', 'ascii']);
|
|
20
|
-
const ENCODINGS = new Set([...TEXT_ENCODINGS, ...BINARY_ENCODINGS]);
|
|
21
|
-
|
|
22
|
-
const getCorrectEncoding = encoding => {
|
|
23
|
-
if (encoding === null) {
|
|
24
|
-
return 'buffer';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (typeof encoding !== 'string') {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const lowerEncoding = encoding.toLowerCase();
|
|
32
|
-
if (lowerEncoding in ENCODING_ALIASES) {
|
|
33
|
-
return ENCODING_ALIASES[lowerEncoding];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (ENCODINGS.has(lowerEncoding)) {
|
|
37
|
-
return lowerEncoding;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const ENCODING_ALIASES = {
|
|
42
|
-
// eslint-disable-next-line unicorn/text-encoding-identifier-case
|
|
43
|
-
'utf-8': 'utf8',
|
|
44
|
-
'utf-16le': 'utf16le',
|
|
45
|
-
'ucs-2': 'utf16le',
|
|
46
|
-
ucs2: 'utf16le',
|
|
47
|
-
binary: 'latin1',
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const serializeEncoding = encoding => typeof encoding === 'string' ? `"${encoding}"` : String(encoding);
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import {platform} from 'node:process';
|
|
2
|
-
import {stripVTControlCharacters} from 'node:util';
|
|
3
|
-
|
|
4
|
-
// Compute `result.command` and `result.escapedCommand`
|
|
5
|
-
export const joinCommand = (filePath, rawArguments) => {
|
|
6
|
-
const fileAndArguments = [filePath, ...rawArguments];
|
|
7
|
-
const command = fileAndArguments.join(' ');
|
|
8
|
-
const escapedCommand = fileAndArguments
|
|
9
|
-
.map(fileAndArgument => quoteString(escapeControlCharacters(fileAndArgument)))
|
|
10
|
-
.join(' ');
|
|
11
|
-
return {command, escapedCommand};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Remove ANSI sequences and escape control characters and newlines
|
|
15
|
-
export const escapeLines = lines => stripVTControlCharacters(lines)
|
|
16
|
-
.split('\n')
|
|
17
|
-
.map(line => escapeControlCharacters(line))
|
|
18
|
-
.join('\n');
|
|
19
|
-
|
|
20
|
-
const escapeControlCharacters = line => line.replaceAll(SPECIAL_CHAR_REGEXP, character => escapeControlCharacter(character));
|
|
21
|
-
|
|
22
|
-
const escapeControlCharacter = character => {
|
|
23
|
-
const commonEscape = COMMON_ESCAPES[character];
|
|
24
|
-
if (commonEscape !== undefined) {
|
|
25
|
-
return commonEscape;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const codepoint = character.codePointAt(0);
|
|
29
|
-
const codepointHex = codepoint.toString(16);
|
|
30
|
-
return codepoint <= ASTRAL_START
|
|
31
|
-
? `\\u${codepointHex.padStart(4, '0')}`
|
|
32
|
-
: `\\U${codepointHex}`;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Characters that would create issues when printed are escaped using the \u or \U notation.
|
|
36
|
-
// Those include control characters and newlines.
|
|
37
|
-
// The \u and \U notation is Bash specific, but there is no way to do this in a shell-agnostic way.
|
|
38
|
-
// Some shells do not even have a way to print those characters in an escaped fashion.
|
|
39
|
-
// Therefore, we prioritize printing those safely, instead of allowing those to be copy-pasted.
|
|
40
|
-
// List of Unicode character categories: https://www.fileformat.info/info/unicode/category/index.htm
|
|
41
|
-
const getSpecialCharRegExp = () => {
|
|
42
|
-
try {
|
|
43
|
-
// This throws when using Node.js without ICU support.
|
|
44
|
-
// When using a RegExp literal, this would throw at parsing-time, instead of runtime.
|
|
45
|
-
// eslint-disable-next-line prefer-regex-literals
|
|
46
|
-
return new RegExp('\\p{Separator}|\\p{Other}', 'gu');
|
|
47
|
-
} catch {
|
|
48
|
-
// Similar to the above RegExp, but works even when Node.js has been built without ICU support.
|
|
49
|
-
// Unlike the above RegExp, it only covers whitespaces and C0/C1 control characters.
|
|
50
|
-
// It does not cover some edge cases, such as Unicode reserved characters.
|
|
51
|
-
// See https://github.com/sindresorhus/execa/issues/1143
|
|
52
|
-
// eslint-disable-next-line no-control-regex
|
|
53
|
-
return /[\s\u0000-\u001F\u007F-\u009F\u00AD]/g;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const SPECIAL_CHAR_REGEXP = getSpecialCharRegExp();
|
|
58
|
-
|
|
59
|
-
// Accepted by $'...' in Bash.
|
|
60
|
-
// Exclude \a \e \v which are accepted in Bash but not in JavaScript (except \v) and JSON.
|
|
61
|
-
const COMMON_ESCAPES = {
|
|
62
|
-
' ': ' ',
|
|
63
|
-
'\b': '\\b',
|
|
64
|
-
'\f': '\\f',
|
|
65
|
-
'\n': '\\n',
|
|
66
|
-
'\r': '\\r',
|
|
67
|
-
'\t': '\\t',
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// Up until that codepoint, \u notation can be used instead of \U
|
|
71
|
-
const ASTRAL_START = 65_535;
|
|
72
|
-
|
|
73
|
-
// Some characters are shell-specific, i.e. need to be escaped when the command is copy-pasted then run.
|
|
74
|
-
// Escaping is shell-specific. We cannot know which shell is used: `process.platform` detection is not enough.
|
|
75
|
-
// For example, Windows users could be using `cmd.exe`, Powershell or Bash for Windows which all use different escaping.
|
|
76
|
-
// We use '...' on Unix, which is POSIX shell compliant and escape all characters but ' so this is fairly safe.
|
|
77
|
-
// On Windows, we assume cmd.exe is used and escape with "...", which also works with Powershell.
|
|
78
|
-
const quoteString = escapedArgument => {
|
|
79
|
-
if (NO_ESCAPE_REGEXP.test(escapedArgument)) {
|
|
80
|
-
return escapedArgument;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return platform === 'win32'
|
|
84
|
-
? `"${escapedArgument.replaceAll('"', '""')}"`
|
|
85
|
-
: `'${escapedArgument.replaceAll('\'', '\'\\\'\'')}'`;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import {parseFd} from './specific.js';
|
|
2
|
-
|
|
3
|
-
// Retrieve stream targeted by the `to` option
|
|
4
|
-
export const getToStream = (destination, to = 'stdin') => {
|
|
5
|
-
const isWritable = true;
|
|
6
|
-
const {options, fileDescriptors} = SUBPROCESS_OPTIONS.get(destination);
|
|
7
|
-
const fdNumber = getFdNumber(fileDescriptors, to, isWritable);
|
|
8
|
-
const destinationStream = destination.stdio[fdNumber];
|
|
9
|
-
|
|
10
|
-
if (destinationStream === null) {
|
|
11
|
-
throw new TypeError(getInvalidStdioOptionMessage(fdNumber, to, options, isWritable));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return destinationStream;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// Retrieve stream targeted by the `from` option
|
|
18
|
-
export const getFromStream = (source, from = 'stdout') => {
|
|
19
|
-
const isWritable = false;
|
|
20
|
-
const {options, fileDescriptors} = SUBPROCESS_OPTIONS.get(source);
|
|
21
|
-
const fdNumber = getFdNumber(fileDescriptors, from, isWritable);
|
|
22
|
-
const sourceStream = fdNumber === 'all' ? source.all : source.stdio[fdNumber];
|
|
23
|
-
|
|
24
|
-
if (sourceStream === null || sourceStream === undefined) {
|
|
25
|
-
throw new TypeError(getInvalidStdioOptionMessage(fdNumber, from, options, isWritable));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return sourceStream;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// Keeps track of the options passed to each Execa call
|
|
32
|
-
export const SUBPROCESS_OPTIONS = new WeakMap();
|
|
33
|
-
|
|
34
|
-
const getFdNumber = (fileDescriptors, fdName, isWritable) => {
|
|
35
|
-
const fdNumber = parseFdNumber(fdName, isWritable);
|
|
36
|
-
validateFdNumber(fdNumber, fdName, isWritable, fileDescriptors);
|
|
37
|
-
return fdNumber;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const parseFdNumber = (fdName, isWritable) => {
|
|
41
|
-
const fdNumber = parseFd(fdName);
|
|
42
|
-
if (fdNumber !== undefined) {
|
|
43
|
-
return fdNumber;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const {validOptions, defaultValue} = isWritable
|
|
47
|
-
? {validOptions: '"stdin"', defaultValue: 'stdin'}
|
|
48
|
-
: {validOptions: '"stdout", "stderr", "all"', defaultValue: 'stdout'};
|
|
49
|
-
throw new TypeError(`"${getOptionName(isWritable)}" must not be "${fdName}".
|
|
50
|
-
It must be ${validOptions} or "fd3", "fd4" (and so on).
|
|
51
|
-
It is optional and defaults to "${defaultValue}".`);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const validateFdNumber = (fdNumber, fdName, isWritable, fileDescriptors) => {
|
|
55
|
-
const fileDescriptor = fileDescriptors[getUsedDescriptor(fdNumber)];
|
|
56
|
-
if (fileDescriptor === undefined) {
|
|
57
|
-
throw new TypeError(`"${getOptionName(isWritable)}" must not be ${fdName}. That file descriptor does not exist.
|
|
58
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (fileDescriptor.direction === 'input' && !isWritable) {
|
|
62
|
-
throw new TypeError(`"${getOptionName(isWritable)}" must not be ${fdName}. It must be a readable stream, not writable.`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (fileDescriptor.direction !== 'input' && isWritable) {
|
|
66
|
-
throw new TypeError(`"${getOptionName(isWritable)}" must not be ${fdName}. It must be a writable stream, not readable.`);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const getInvalidStdioOptionMessage = (fdNumber, fdName, options, isWritable) => {
|
|
71
|
-
if (fdNumber === 'all' && !options.all) {
|
|
72
|
-
return 'The "all" option must be true to use "from: \'all\'".';
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const {optionName, optionValue} = getInvalidStdioOption(fdNumber, options);
|
|
76
|
-
return `The "${optionName}: ${serializeOptionValue(optionValue)}" option is incompatible with using "${getOptionName(isWritable)}: ${serializeOptionValue(fdName)}".
|
|
77
|
-
Please set this option with "pipe" instead.`;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const getInvalidStdioOption = (fdNumber, {stdin, stdout, stderr, stdio}) => {
|
|
81
|
-
const usedDescriptor = getUsedDescriptor(fdNumber);
|
|
82
|
-
|
|
83
|
-
if (usedDescriptor === 0 && stdin !== undefined) {
|
|
84
|
-
return {optionName: 'stdin', optionValue: stdin};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (usedDescriptor === 1 && stdout !== undefined) {
|
|
88
|
-
return {optionName: 'stdout', optionValue: stdout};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (usedDescriptor === 2 && stderr !== undefined) {
|
|
92
|
-
return {optionName: 'stderr', optionValue: stderr};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return {optionName: `stdio[${usedDescriptor}]`, optionValue: stdio[usedDescriptor]};
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const getUsedDescriptor = fdNumber => fdNumber === 'all' ? 1 : fdNumber;
|
|
99
|
-
|
|
100
|
-
const getOptionName = isWritable => isWritable ? 'to' : 'from';
|
|
101
|
-
|
|
102
|
-
export const serializeOptionValue = value => {
|
|
103
|
-
if (typeof value === 'string') {
|
|
104
|
-
return `'${value}'`;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return typeof value === 'number' ? `${value}` : 'Stream';
|
|
108
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {fileURLToPath} from 'node:url';
|
|
2
|
-
|
|
3
|
-
// Allow some arguments/options to be either a file path string or a file URL
|
|
4
|
-
export const safeNormalizeFileUrl = (file, name) => {
|
|
5
|
-
const fileString = normalizeFileUrl(normalizeDenoExecPath(file));
|
|
6
|
-
|
|
7
|
-
if (typeof fileString !== 'string') {
|
|
8
|
-
throw new TypeError(`${name} must be a string or a file URL: ${fileString}.`);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return fileString;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// In Deno node:process execPath is a special object, not just a string:
|
|
15
|
-
// https://github.com/denoland/deno/blob/f460188e583f00144000aa0d8ade08218d47c3c1/ext/node/polyfills/process.ts#L344
|
|
16
|
-
const normalizeDenoExecPath = file => isDenoExecPath(file)
|
|
17
|
-
? file.toString()
|
|
18
|
-
: file;
|
|
19
|
-
|
|
20
|
-
export const isDenoExecPath = file => typeof file !== 'string'
|
|
21
|
-
&& file
|
|
22
|
-
&& Object.getPrototypeOf(file) === String.prototype;
|
|
23
|
-
|
|
24
|
-
// Same but also allows other values, e.g. `boolean` for the `shell` option
|
|
25
|
-
export const normalizeFileUrl = file => file instanceof URL ? fileURLToPath(file) : file;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
import crossSpawn from 'cross-spawn';
|
|
4
|
-
import {npmRunPathEnv} from 'npm-run-path';
|
|
5
|
-
import {normalizeForceKillAfterDelay} from '../terminate/kill.js';
|
|
6
|
-
import {normalizeKillSignal} from '../terminate/signal.js';
|
|
7
|
-
import {validateCancelSignal} from '../terminate/cancel.js';
|
|
8
|
-
import {validateGracefulCancel} from '../terminate/graceful.js';
|
|
9
|
-
import {validateTimeout} from '../terminate/timeout.js';
|
|
10
|
-
import {handleNodeOption} from '../methods/node.js';
|
|
11
|
-
import {validateIpcInputOption} from '../ipc/ipc-input.js';
|
|
12
|
-
import {validateEncoding, BINARY_ENCODINGS} from './encoding-option.js';
|
|
13
|
-
import {normalizeCwd} from './cwd.js';
|
|
14
|
-
import {normalizeFileUrl} from './file-url.js';
|
|
15
|
-
import {normalizeFdSpecificOptions} from './specific.js';
|
|
16
|
-
|
|
17
|
-
// Normalize the options object, and sometimes also the file paths and arguments.
|
|
18
|
-
// Applies default values, validate allowed options, normalize them.
|
|
19
|
-
export const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
20
|
-
rawOptions.cwd = normalizeCwd(rawOptions.cwd);
|
|
21
|
-
const [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, rawOptions);
|
|
22
|
-
|
|
23
|
-
const {command: file, args: commandArguments, options: initialOptions} = crossSpawn._parse(processedFile, processedArguments, processedOptions);
|
|
24
|
-
|
|
25
|
-
const fdOptions = normalizeFdSpecificOptions(initialOptions);
|
|
26
|
-
const options = addDefaultOptions(fdOptions);
|
|
27
|
-
validateTimeout(options);
|
|
28
|
-
validateEncoding(options);
|
|
29
|
-
validateIpcInputOption(options);
|
|
30
|
-
validateCancelSignal(options);
|
|
31
|
-
validateGracefulCancel(options);
|
|
32
|
-
options.shell = normalizeFileUrl(options.shell);
|
|
33
|
-
options.env = getEnv(options);
|
|
34
|
-
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
35
|
-
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
36
|
-
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
37
|
-
|
|
38
|
-
if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {
|
|
39
|
-
// #116
|
|
40
|
-
commandArguments.unshift('/q');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return {file, commandArguments, options};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const addDefaultOptions = ({
|
|
47
|
-
extendEnv = true,
|
|
48
|
-
preferLocal = false,
|
|
49
|
-
cwd,
|
|
50
|
-
localDir: localDirectory = cwd,
|
|
51
|
-
encoding = 'utf8',
|
|
52
|
-
reject = true,
|
|
53
|
-
cleanup = true,
|
|
54
|
-
all = false,
|
|
55
|
-
windowsHide = true,
|
|
56
|
-
killSignal = 'SIGTERM',
|
|
57
|
-
forceKillAfterDelay = true,
|
|
58
|
-
gracefulCancel = false,
|
|
59
|
-
ipcInput,
|
|
60
|
-
ipc = ipcInput !== undefined || gracefulCancel,
|
|
61
|
-
serialization = 'advanced',
|
|
62
|
-
...options
|
|
63
|
-
}) => ({
|
|
64
|
-
...options,
|
|
65
|
-
extendEnv,
|
|
66
|
-
preferLocal,
|
|
67
|
-
cwd,
|
|
68
|
-
localDirectory,
|
|
69
|
-
encoding,
|
|
70
|
-
reject,
|
|
71
|
-
cleanup,
|
|
72
|
-
all,
|
|
73
|
-
windowsHide,
|
|
74
|
-
killSignal,
|
|
75
|
-
forceKillAfterDelay,
|
|
76
|
-
gracefulCancel,
|
|
77
|
-
ipcInput,
|
|
78
|
-
ipc,
|
|
79
|
-
serialization,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const getEnv = ({env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath}) => {
|
|
83
|
-
const env = extendEnv ? {...process.env, ...envOption} : envOption;
|
|
84
|
-
|
|
85
|
-
if (preferLocal || node) {
|
|
86
|
-
return npmRunPathEnv({
|
|
87
|
-
env,
|
|
88
|
-
cwd: localDirectory,
|
|
89
|
-
execPath: nodePath,
|
|
90
|
-
preferLocal,
|
|
91
|
-
addExecPath: node,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return env;
|
|
96
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// When the `shell` option is set, any command argument is concatenated as a single string by Node.js:
|
|
2
|
-
// https://github.com/nodejs/node/blob/e38ce27f3ca0a65f68a31cedd984cddb927d4002/lib/child_process.js#L614-L624
|
|
3
|
-
// However, since Node 24, it also prints a deprecation warning.
|
|
4
|
-
// To avoid this warning, we perform that same operation before calling `node:child_process`.
|
|
5
|
-
// Shells only understand strings, which is why Node.js performs that concatenation.
|
|
6
|
-
// However, we rely on users splitting command arguments as an array.
|
|
7
|
-
// For example, this allows us to easily detect which arguments are passed.
|
|
8
|
-
// So we do want users to pass array of arguments even with `shell: true`, but we also want to avoid any warning.
|
|
9
|
-
export const concatenateShell = (file, commandArguments, options) => options.shell && commandArguments.length > 0
|
|
10
|
-
? [[file, ...commandArguments].join(' '), [], options]
|
|
11
|
-
: [file, commandArguments, options];
|