@kubb/agent 4.28.1 → 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 +378 -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,445 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* content-disposition
|
|
3
|
-
* Copyright(c) 2014 Douglas Christopher Wilson
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
'use strict'
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Module exports.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
module.exports = contentDisposition
|
|
14
|
-
module.exports.parse = parse
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Module dependencies.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
var basename = require('path').basename
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* RegExp to match non attr-char, *after* encodeURIComponent (i.e. not including "%")
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g // eslint-disable-line no-control-regex
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* RegExp to match percent encoding escape.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/
|
|
33
|
-
var HEX_ESCAPE_REPLACE_REGEXP = /%([0-9A-Fa-f]{2})/g
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* RegExp to match non-latin1 characters.
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
var NON_LATIN1_REGEXP = /[^\x20-\x7e\xa0-\xff]/g
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* RegExp to match quoted-pair in RFC 2616
|
|
43
|
-
*
|
|
44
|
-
* quoted-pair = "\" CHAR
|
|
45
|
-
* CHAR = <any US-ASCII character (octets 0 - 127)>
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
var QESC_REGEXP = /\\([\u0000-\u007f])/g
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* RegExp to match chars that must be quoted-pair in RFC 2616
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
var QUOTE_REGEXP = /([\\"])/g
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* RegExp for various RFC 2616 grammar
|
|
58
|
-
*
|
|
59
|
-
* parameter = token "=" ( token | quoted-string )
|
|
60
|
-
* token = 1*<any CHAR except CTLs or separators>
|
|
61
|
-
* separators = "(" | ")" | "<" | ">" | "@"
|
|
62
|
-
* | "," | ";" | ":" | "\" | <">
|
|
63
|
-
* | "/" | "[" | "]" | "?" | "="
|
|
64
|
-
* | "{" | "}" | SP | HT
|
|
65
|
-
* quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
|
|
66
|
-
* qdtext = <any TEXT except <">>
|
|
67
|
-
* quoted-pair = "\" CHAR
|
|
68
|
-
* CHAR = <any US-ASCII character (octets 0 - 127)>
|
|
69
|
-
* TEXT = <any OCTET except CTLs, but including LWS>
|
|
70
|
-
* LWS = [CRLF] 1*( SP | HT )
|
|
71
|
-
* CRLF = CR LF
|
|
72
|
-
* CR = <US-ASCII CR, carriage return (13)>
|
|
73
|
-
* LF = <US-ASCII LF, linefeed (10)>
|
|
74
|
-
* SP = <US-ASCII SP, space (32)>
|
|
75
|
-
* HT = <US-ASCII HT, horizontal-tab (9)>
|
|
76
|
-
* CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
|
|
77
|
-
* OCTET = <any 8-bit sequence of data>
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
var PARAM_REGEXP = /;[\x09\x20]*([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*=[\x09\x20]*("(?:[\x20!\x23-\x5b\x5d-\x7e\x80-\xff]|\\[\x20-\x7e])*"|[!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*/g // eslint-disable-line no-control-regex
|
|
81
|
-
var TEXT_REGEXP = /^[\x20-\x7e\x80-\xff]+$/
|
|
82
|
-
var TOKEN_REGEXP = /^[!#$%&'*+.0-9A-Z^_`a-z|~-]+$/
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* RegExp for various RFC 5987 grammar
|
|
86
|
-
*
|
|
87
|
-
* ext-value = charset "'" [ language ] "'" value-chars
|
|
88
|
-
* charset = "UTF-8" / "ISO-8859-1" / mime-charset
|
|
89
|
-
* mime-charset = 1*mime-charsetc
|
|
90
|
-
* mime-charsetc = ALPHA / DIGIT
|
|
91
|
-
* / "!" / "#" / "$" / "%" / "&"
|
|
92
|
-
* / "+" / "-" / "^" / "_" / "`"
|
|
93
|
-
* / "{" / "}" / "~"
|
|
94
|
-
* language = ( 2*3ALPHA [ extlang ] )
|
|
95
|
-
* / 4ALPHA
|
|
96
|
-
* / 5*8ALPHA
|
|
97
|
-
* extlang = *3( "-" 3ALPHA )
|
|
98
|
-
* value-chars = *( pct-encoded / attr-char )
|
|
99
|
-
* pct-encoded = "%" HEXDIG HEXDIG
|
|
100
|
-
* attr-char = ALPHA / DIGIT
|
|
101
|
-
* / "!" / "#" / "$" / "&" / "+" / "-" / "."
|
|
102
|
-
* / "^" / "_" / "`" / "|" / "~"
|
|
103
|
-
*/
|
|
104
|
-
|
|
105
|
-
var EXT_VALUE_REGEXP = /^([A-Za-z0-9!#$%&+\-^_`{}~]+)'(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}|[A-Za-z]{4,8}|)'((?:%[0-9A-Fa-f]{2}|[A-Za-z0-9!#$&+.^_`|~-])+)$/
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* RegExp for various RFC 6266 grammar
|
|
109
|
-
*
|
|
110
|
-
* disposition-type = "inline" | "attachment" | disp-ext-type
|
|
111
|
-
* disp-ext-type = token
|
|
112
|
-
* disposition-parm = filename-parm | disp-ext-parm
|
|
113
|
-
* filename-parm = "filename" "=" value
|
|
114
|
-
* | "filename*" "=" ext-value
|
|
115
|
-
* disp-ext-parm = token "=" value
|
|
116
|
-
* | ext-token "=" ext-value
|
|
117
|
-
* ext-token = <the characters in token, followed by "*">
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
|
-
var DISPOSITION_TYPE_REGEXP = /^([!#$%&'*+.0-9A-Z^_`a-z|~-]+)[\x09\x20]*(?:$|;)/ // eslint-disable-line no-control-regex
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Create an attachment Content-Disposition header.
|
|
124
|
-
*
|
|
125
|
-
* @param {string} [filename]
|
|
126
|
-
* @param {object} [options]
|
|
127
|
-
* @param {string} [options.type=attachment]
|
|
128
|
-
* @param {string|boolean} [options.fallback=true]
|
|
129
|
-
* @return {string}
|
|
130
|
-
* @api public
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
function contentDisposition (filename, options) {
|
|
134
|
-
var opts = options || {}
|
|
135
|
-
|
|
136
|
-
// get type
|
|
137
|
-
var type = opts.type || 'attachment'
|
|
138
|
-
|
|
139
|
-
// get parameters
|
|
140
|
-
var params = createparams(filename, opts.fallback)
|
|
141
|
-
|
|
142
|
-
// format into string
|
|
143
|
-
return format(new ContentDisposition(type, params))
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Create parameters object from filename and fallback.
|
|
148
|
-
*
|
|
149
|
-
* @param {string} [filename]
|
|
150
|
-
* @param {string|boolean} [fallback=true]
|
|
151
|
-
* @return {object}
|
|
152
|
-
* @api private
|
|
153
|
-
*/
|
|
154
|
-
|
|
155
|
-
function createparams (filename, fallback) {
|
|
156
|
-
if (filename === undefined) {
|
|
157
|
-
return
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
var params = {}
|
|
161
|
-
|
|
162
|
-
if (typeof filename !== 'string') {
|
|
163
|
-
throw new TypeError('filename must be a string')
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// fallback defaults to true
|
|
167
|
-
if (fallback === undefined) {
|
|
168
|
-
fallback = true
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (typeof fallback !== 'string' && typeof fallback !== 'boolean') {
|
|
172
|
-
throw new TypeError('fallback must be a string or boolean')
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (typeof fallback === 'string' && NON_LATIN1_REGEXP.test(fallback)) {
|
|
176
|
-
throw new TypeError('fallback must be ISO-8859-1 string')
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// restrict to file base name
|
|
180
|
-
var name = basename(filename)
|
|
181
|
-
|
|
182
|
-
// determine if name is suitable for quoted string
|
|
183
|
-
var isQuotedString = TEXT_REGEXP.test(name)
|
|
184
|
-
|
|
185
|
-
// generate fallback name
|
|
186
|
-
var fallbackName = typeof fallback !== 'string'
|
|
187
|
-
? fallback && getlatin1(name)
|
|
188
|
-
: basename(fallback)
|
|
189
|
-
var hasFallback = typeof fallbackName === 'string' && fallbackName !== name
|
|
190
|
-
|
|
191
|
-
// set extended filename parameter
|
|
192
|
-
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) {
|
|
193
|
-
params['filename*'] = name
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// set filename parameter
|
|
197
|
-
if (isQuotedString || hasFallback) {
|
|
198
|
-
params.filename = hasFallback
|
|
199
|
-
? fallbackName
|
|
200
|
-
: name
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return params
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Format object to Content-Disposition header.
|
|
208
|
-
*
|
|
209
|
-
* @param {object} obj
|
|
210
|
-
* @param {string} obj.type
|
|
211
|
-
* @param {object} [obj.parameters]
|
|
212
|
-
* @return {string}
|
|
213
|
-
* @api private
|
|
214
|
-
*/
|
|
215
|
-
|
|
216
|
-
function format (obj) {
|
|
217
|
-
var parameters = obj.parameters
|
|
218
|
-
var type = obj.type
|
|
219
|
-
|
|
220
|
-
if (!type || typeof type !== 'string' || !TOKEN_REGEXP.test(type)) {
|
|
221
|
-
throw new TypeError('invalid type')
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// start with normalized type
|
|
225
|
-
var string = String(type).toLowerCase()
|
|
226
|
-
|
|
227
|
-
// append parameters
|
|
228
|
-
if (parameters && typeof parameters === 'object') {
|
|
229
|
-
var param
|
|
230
|
-
var params = Object.keys(parameters).sort()
|
|
231
|
-
|
|
232
|
-
for (var i = 0; i < params.length; i++) {
|
|
233
|
-
param = params[i]
|
|
234
|
-
|
|
235
|
-
var val = param.substr(-1) === '*'
|
|
236
|
-
? ustring(parameters[param])
|
|
237
|
-
: qstring(parameters[param])
|
|
238
|
-
|
|
239
|
-
string += '; ' + param + '=' + val
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return string
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Decode a RFC 6987 field value (gracefully).
|
|
248
|
-
*
|
|
249
|
-
* @param {string} str
|
|
250
|
-
* @return {string}
|
|
251
|
-
* @api private
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
function decodefield (str) {
|
|
255
|
-
var match = EXT_VALUE_REGEXP.exec(str)
|
|
256
|
-
|
|
257
|
-
if (!match) {
|
|
258
|
-
throw new TypeError('invalid extended field value')
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
var charset = match[1].toLowerCase()
|
|
262
|
-
var encoded = match[2]
|
|
263
|
-
var value
|
|
264
|
-
|
|
265
|
-
// to binary string
|
|
266
|
-
var binary = encoded.replace(HEX_ESCAPE_REPLACE_REGEXP, pdecode)
|
|
267
|
-
|
|
268
|
-
switch (charset) {
|
|
269
|
-
case 'iso-8859-1':
|
|
270
|
-
value = getlatin1(binary)
|
|
271
|
-
break
|
|
272
|
-
case 'utf-8':
|
|
273
|
-
value = new Buffer(binary, 'binary').toString('utf8')
|
|
274
|
-
break
|
|
275
|
-
default:
|
|
276
|
-
throw new TypeError('unsupported charset in extended field')
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
return value
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Get ISO-8859-1 version of string.
|
|
284
|
-
*
|
|
285
|
-
* @param {string} val
|
|
286
|
-
* @return {string}
|
|
287
|
-
* @api private
|
|
288
|
-
*/
|
|
289
|
-
|
|
290
|
-
function getlatin1 (val) {
|
|
291
|
-
// simple Unicode -> ISO-8859-1 transformation
|
|
292
|
-
return String(val).replace(NON_LATIN1_REGEXP, '?')
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Parse Content-Disposition header string.
|
|
297
|
-
*
|
|
298
|
-
* @param {string} string
|
|
299
|
-
* @return {object}
|
|
300
|
-
* @api private
|
|
301
|
-
*/
|
|
302
|
-
|
|
303
|
-
function parse (string) {
|
|
304
|
-
if (!string || typeof string !== 'string') {
|
|
305
|
-
throw new TypeError('argument string is required')
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
var match = DISPOSITION_TYPE_REGEXP.exec(string)
|
|
309
|
-
|
|
310
|
-
if (!match) {
|
|
311
|
-
throw new TypeError('invalid type format')
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// normalize type
|
|
315
|
-
var index = match[0].length
|
|
316
|
-
var type = match[1].toLowerCase()
|
|
317
|
-
|
|
318
|
-
var key
|
|
319
|
-
var names = []
|
|
320
|
-
var params = {}
|
|
321
|
-
var value
|
|
322
|
-
|
|
323
|
-
// calculate index to start at
|
|
324
|
-
index = PARAM_REGEXP.lastIndex = match[0].substr(-1) === ';'
|
|
325
|
-
? index - 1
|
|
326
|
-
: index
|
|
327
|
-
|
|
328
|
-
// match parameters
|
|
329
|
-
while ((match = PARAM_REGEXP.exec(string))) {
|
|
330
|
-
if (match.index !== index) {
|
|
331
|
-
throw new TypeError('invalid parameter format')
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
index += match[0].length
|
|
335
|
-
key = match[1].toLowerCase()
|
|
336
|
-
value = match[2]
|
|
337
|
-
|
|
338
|
-
if (names.indexOf(key) !== -1) {
|
|
339
|
-
throw new TypeError('invalid duplicate parameter')
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
names.push(key)
|
|
343
|
-
|
|
344
|
-
if (key.indexOf('*') + 1 === key.length) {
|
|
345
|
-
// decode extended value
|
|
346
|
-
key = key.slice(0, -1)
|
|
347
|
-
value = decodefield(value)
|
|
348
|
-
|
|
349
|
-
// overwrite existing value
|
|
350
|
-
params[key] = value
|
|
351
|
-
continue
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (typeof params[key] === 'string') {
|
|
355
|
-
continue
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
if (value[0] === '"') {
|
|
359
|
-
// remove quotes and escapes
|
|
360
|
-
value = value
|
|
361
|
-
.substr(1, value.length - 2)
|
|
362
|
-
.replace(QESC_REGEXP, '$1')
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
params[key] = value
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
if (index !== -1 && index !== string.length) {
|
|
369
|
-
throw new TypeError('invalid parameter format')
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
return new ContentDisposition(type, params)
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Percent decode a single character.
|
|
377
|
-
*
|
|
378
|
-
* @param {string} str
|
|
379
|
-
* @param {string} hex
|
|
380
|
-
* @return {string}
|
|
381
|
-
* @api private
|
|
382
|
-
*/
|
|
383
|
-
|
|
384
|
-
function pdecode (str, hex) {
|
|
385
|
-
return String.fromCharCode(parseInt(hex, 16))
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Percent encode a single character.
|
|
390
|
-
*
|
|
391
|
-
* @param {string} char
|
|
392
|
-
* @return {string}
|
|
393
|
-
* @api private
|
|
394
|
-
*/
|
|
395
|
-
|
|
396
|
-
function pencode (char) {
|
|
397
|
-
var hex = String(char)
|
|
398
|
-
.charCodeAt(0)
|
|
399
|
-
.toString(16)
|
|
400
|
-
.toUpperCase()
|
|
401
|
-
return hex.length === 1
|
|
402
|
-
? '%0' + hex
|
|
403
|
-
: '%' + hex
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Quote a string for HTTP.
|
|
408
|
-
*
|
|
409
|
-
* @param {string} val
|
|
410
|
-
* @return {string}
|
|
411
|
-
* @api private
|
|
412
|
-
*/
|
|
413
|
-
|
|
414
|
-
function qstring (val) {
|
|
415
|
-
var str = String(val)
|
|
416
|
-
|
|
417
|
-
return '"' + str.replace(QUOTE_REGEXP, '\\$1') + '"'
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Encode a Unicode string for HTTP (RFC 5987).
|
|
422
|
-
*
|
|
423
|
-
* @param {string} val
|
|
424
|
-
* @return {string}
|
|
425
|
-
* @api private
|
|
426
|
-
*/
|
|
427
|
-
|
|
428
|
-
function ustring (val) {
|
|
429
|
-
var str = String(val)
|
|
430
|
-
|
|
431
|
-
// percent encode as UTF-8
|
|
432
|
-
var encoded = encodeURIComponent(str)
|
|
433
|
-
.replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode)
|
|
434
|
-
|
|
435
|
-
return 'UTF-8\'\'' + encoded
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* Class for parsed Content-Disposition header for v8 optimization
|
|
440
|
-
*/
|
|
441
|
-
|
|
442
|
-
function ContentDisposition (type, parameters) {
|
|
443
|
-
this.type = type
|
|
444
|
-
this.parameters = parameters
|
|
445
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "content-disposition",
|
|
3
|
-
"description": "Create and parse Content-Disposition header",
|
|
4
|
-
"version": "0.5.2",
|
|
5
|
-
"contributors": [
|
|
6
|
-
"Douglas Christopher Wilson <doug@somethingdoug.com>"
|
|
7
|
-
],
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"keywords": [
|
|
10
|
-
"content-disposition",
|
|
11
|
-
"http",
|
|
12
|
-
"rfc6266",
|
|
13
|
-
"res"
|
|
14
|
-
],
|
|
15
|
-
"repository": "jshttp/content-disposition",
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"eslint": "3.11.1",
|
|
18
|
-
"eslint-config-standard": "6.2.1",
|
|
19
|
-
"eslint-plugin-promise": "3.3.0",
|
|
20
|
-
"eslint-plugin-standard": "2.0.1",
|
|
21
|
-
"istanbul": "0.4.5",
|
|
22
|
-
"mocha": "1.21.5"
|
|
23
|
-
},
|
|
24
|
-
"files": [
|
|
25
|
-
"LICENSE",
|
|
26
|
-
"HISTORY.md",
|
|
27
|
-
"README.md",
|
|
28
|
-
"index.js"
|
|
29
|
-
],
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">= 0.6"
|
|
32
|
-
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"lint": "eslint .",
|
|
35
|
-
"test": "mocha --reporter spec --bail --check-leaks test/",
|
|
36
|
-
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
|
37
|
-
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const cp = require('child_process');
|
|
4
|
-
const parse = require('./lib/parse');
|
|
5
|
-
const enoent = require('./lib/enoent');
|
|
6
|
-
|
|
7
|
-
function spawn(command, args, options) {
|
|
8
|
-
// Parse the arguments
|
|
9
|
-
const parsed = parse(command, args, options);
|
|
10
|
-
|
|
11
|
-
// Spawn the child process
|
|
12
|
-
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
13
|
-
|
|
14
|
-
// Hook into child process "exit" event to emit an error if the command
|
|
15
|
-
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
16
|
-
enoent.hookChildProcess(spawned, parsed);
|
|
17
|
-
|
|
18
|
-
return spawned;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function spawnSync(command, args, options) {
|
|
22
|
-
// Parse the arguments
|
|
23
|
-
const parsed = parse(command, args, options);
|
|
24
|
-
|
|
25
|
-
// Spawn the child process
|
|
26
|
-
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
27
|
-
|
|
28
|
-
// Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
29
|
-
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
30
|
-
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
module.exports = spawn;
|
|
35
|
-
module.exports.spawn = spawn;
|
|
36
|
-
module.exports.sync = spawnSync;
|
|
37
|
-
|
|
38
|
-
module.exports._parse = parse;
|
|
39
|
-
module.exports._enoent = enoent;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const isWin = process.platform === 'win32';
|
|
4
|
-
|
|
5
|
-
function notFoundError(original, syscall) {
|
|
6
|
-
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
|
|
7
|
-
code: 'ENOENT',
|
|
8
|
-
errno: 'ENOENT',
|
|
9
|
-
syscall: `${syscall} ${original.command}`,
|
|
10
|
-
path: original.command,
|
|
11
|
-
spawnargs: original.args,
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function hookChildProcess(cp, parsed) {
|
|
16
|
-
if (!isWin) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const originalEmit = cp.emit;
|
|
21
|
-
|
|
22
|
-
cp.emit = function (name, arg1) {
|
|
23
|
-
// If emitting "exit" event and exit code is 1, we need to check if
|
|
24
|
-
// the command exists and emit an "error" instead
|
|
25
|
-
// See https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
|
26
|
-
if (name === 'exit') {
|
|
27
|
-
const err = verifyENOENT(arg1, parsed);
|
|
28
|
-
|
|
29
|
-
if (err) {
|
|
30
|
-
return originalEmit.call(cp, 'error', err);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function verifyENOENT(status, parsed) {
|
|
39
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
40
|
-
return notFoundError(parsed.original, 'spawn');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function verifyENOENTSync(status, parsed) {
|
|
47
|
-
if (isWin && status === 1 && !parsed.file) {
|
|
48
|
-
return notFoundError(parsed.original, 'spawnSync');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
module.exports = {
|
|
55
|
-
hookChildProcess,
|
|
56
|
-
verifyENOENT,
|
|
57
|
-
verifyENOENTSync,
|
|
58
|
-
notFoundError,
|
|
59
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const resolveCommand = require('./util/resolveCommand');
|
|
5
|
-
const escape = require('./util/escape');
|
|
6
|
-
const readShebang = require('./util/readShebang');
|
|
7
|
-
|
|
8
|
-
const isWin = process.platform === 'win32';
|
|
9
|
-
const isExecutableRegExp = /\.(?:com|exe)$/i;
|
|
10
|
-
const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
11
|
-
|
|
12
|
-
function detectShebang(parsed) {
|
|
13
|
-
parsed.file = resolveCommand(parsed);
|
|
14
|
-
|
|
15
|
-
const shebang = parsed.file && readShebang(parsed.file);
|
|
16
|
-
|
|
17
|
-
if (shebang) {
|
|
18
|
-
parsed.args.unshift(parsed.file);
|
|
19
|
-
parsed.command = shebang;
|
|
20
|
-
|
|
21
|
-
return resolveCommand(parsed);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return parsed.file;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function parseNonShell(parsed) {
|
|
28
|
-
if (!isWin) {
|
|
29
|
-
return parsed;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Detect & add support for shebangs
|
|
33
|
-
const commandFile = detectShebang(parsed);
|
|
34
|
-
|
|
35
|
-
// We don't need a shell if the command filename is an executable
|
|
36
|
-
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
37
|
-
|
|
38
|
-
// If a shell is required, use cmd.exe and take care of escaping everything correctly
|
|
39
|
-
// Note that `forceShell` is an hidden option used only in tests
|
|
40
|
-
if (parsed.options.forceShell || needsShell) {
|
|
41
|
-
// Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/`
|
|
42
|
-
// The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument
|
|
43
|
-
// Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called,
|
|
44
|
-
// we need to double escape them
|
|
45
|
-
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
46
|
-
|
|
47
|
-
// Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
|
|
48
|
-
// This is necessary otherwise it will always fail with ENOENT in those cases
|
|
49
|
-
parsed.command = path.normalize(parsed.command);
|
|
50
|
-
|
|
51
|
-
// Escape command & arguments
|
|
52
|
-
parsed.command = escape.command(parsed.command);
|
|
53
|
-
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
54
|
-
|
|
55
|
-
const shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
|
56
|
-
|
|
57
|
-
parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`];
|
|
58
|
-
parsed.command = process.env.comspec || 'cmd.exe';
|
|
59
|
-
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return parsed;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function parse(command, args, options) {
|
|
66
|
-
// Normalize arguments, similar to nodejs
|
|
67
|
-
if (args && !Array.isArray(args)) {
|
|
68
|
-
options = args;
|
|
69
|
-
args = null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
|
73
|
-
options = Object.assign({}, options); // Clone object to avoid changing the original
|
|
74
|
-
|
|
75
|
-
// Build our parsed object
|
|
76
|
-
const parsed = {
|
|
77
|
-
command,
|
|
78
|
-
args,
|
|
79
|
-
options,
|
|
80
|
-
file: undefined,
|
|
81
|
-
original: {
|
|
82
|
-
command,
|
|
83
|
-
args,
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// Delegate further parsing to shell or non-shell
|
|
88
|
-
return options.shell ? parsed : parseNonShell(parsed);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
module.exports = parse;
|