@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,55 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('graceful-fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
const copySync = require('../copy').copySync
|
|
6
|
-
const removeSync = require('../remove').removeSync
|
|
7
|
-
const mkdirpSync = require('../mkdirs').mkdirpSync
|
|
8
|
-
const stat = require('../util/stat')
|
|
9
|
-
|
|
10
|
-
function moveSync (src, dest, opts) {
|
|
11
|
-
opts = opts || {}
|
|
12
|
-
const overwrite = opts.overwrite || opts.clobber || false
|
|
13
|
-
|
|
14
|
-
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
|
|
15
|
-
stat.checkParentPathsSync(src, srcStat, dest, 'move')
|
|
16
|
-
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
|
|
17
|
-
return doRename(src, dest, overwrite, isChangingCase)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function isParentRoot (dest) {
|
|
21
|
-
const parent = path.dirname(dest)
|
|
22
|
-
const parsedPath = path.parse(parent)
|
|
23
|
-
return parsedPath.root === parent
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function doRename (src, dest, overwrite, isChangingCase) {
|
|
27
|
-
if (isChangingCase) return rename(src, dest, overwrite)
|
|
28
|
-
if (overwrite) {
|
|
29
|
-
removeSync(dest)
|
|
30
|
-
return rename(src, dest, overwrite)
|
|
31
|
-
}
|
|
32
|
-
if (fs.existsSync(dest)) throw new Error('dest already exists.')
|
|
33
|
-
return rename(src, dest, overwrite)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function rename (src, dest, overwrite) {
|
|
37
|
-
try {
|
|
38
|
-
fs.renameSync(src, dest)
|
|
39
|
-
} catch (err) {
|
|
40
|
-
if (err.code !== 'EXDEV') throw err
|
|
41
|
-
return moveAcrossDevice(src, dest, overwrite)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function moveAcrossDevice (src, dest, overwrite) {
|
|
46
|
-
const opts = {
|
|
47
|
-
overwrite,
|
|
48
|
-
errorOnExist: true,
|
|
49
|
-
preserveTimestamps: true
|
|
50
|
-
}
|
|
51
|
-
copySync(src, dest, opts)
|
|
52
|
-
return removeSync(src)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = moveSync
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('../fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
const { copy } = require('../copy')
|
|
6
|
-
const { remove } = require('../remove')
|
|
7
|
-
const { mkdirp } = require('../mkdirs')
|
|
8
|
-
const { pathExists } = require('../path-exists')
|
|
9
|
-
const stat = require('../util/stat')
|
|
10
|
-
|
|
11
|
-
async function move (src, dest, opts = {}) {
|
|
12
|
-
const overwrite = opts.overwrite || opts.clobber || false
|
|
13
|
-
|
|
14
|
-
const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, 'move', opts)
|
|
15
|
-
|
|
16
|
-
await stat.checkParentPaths(src, srcStat, dest, 'move')
|
|
17
|
-
|
|
18
|
-
// If the parent of dest is not root, make sure it exists before proceeding
|
|
19
|
-
const destParent = path.dirname(dest)
|
|
20
|
-
const parsedParentPath = path.parse(destParent)
|
|
21
|
-
if (parsedParentPath.root !== destParent) {
|
|
22
|
-
await mkdirp(destParent)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return doRename(src, dest, overwrite, isChangingCase)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
async function doRename (src, dest, overwrite, isChangingCase) {
|
|
29
|
-
if (!isChangingCase) {
|
|
30
|
-
if (overwrite) {
|
|
31
|
-
await remove(dest)
|
|
32
|
-
} else if (await pathExists(dest)) {
|
|
33
|
-
throw new Error('dest already exists.')
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
// Try w/ rename first, and try copy + remove if EXDEV
|
|
39
|
-
await fs.rename(src, dest)
|
|
40
|
-
} catch (err) {
|
|
41
|
-
if (err.code !== 'EXDEV') {
|
|
42
|
-
throw err
|
|
43
|
-
}
|
|
44
|
-
await moveAcrossDevice(src, dest, overwrite)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async function moveAcrossDevice (src, dest, overwrite) {
|
|
49
|
-
const opts = {
|
|
50
|
-
overwrite,
|
|
51
|
-
errorOnExist: true,
|
|
52
|
-
preserveTimestamps: true
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
await copy(src, dest, opts)
|
|
56
|
-
return remove(src)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
module.exports = move
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const u = require('universalify').fromPromise
|
|
4
|
-
const fs = require('../fs')
|
|
5
|
-
const path = require('path')
|
|
6
|
-
const mkdir = require('../mkdirs')
|
|
7
|
-
const pathExists = require('../path-exists').pathExists
|
|
8
|
-
|
|
9
|
-
async function outputFile (file, data, encoding = 'utf-8') {
|
|
10
|
-
const dir = path.dirname(file)
|
|
11
|
-
|
|
12
|
-
if (!(await pathExists(dir))) {
|
|
13
|
-
await mkdir.mkdirs(dir)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return fs.writeFile(file, data, encoding)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function outputFileSync (file, ...args) {
|
|
20
|
-
const dir = path.dirname(file)
|
|
21
|
-
if (!fs.existsSync(dir)) {
|
|
22
|
-
mkdir.mkdirsSync(dir)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
fs.writeFileSync(file, ...args)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = {
|
|
29
|
-
outputFile: u(outputFile),
|
|
30
|
-
outputFileSync
|
|
31
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const u = require('universalify').fromPromise
|
|
3
|
-
const fs = require('../fs')
|
|
4
|
-
|
|
5
|
-
function pathExists (path) {
|
|
6
|
-
return fs.access(path).then(() => true).catch(() => false)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
pathExists: u(pathExists),
|
|
11
|
-
pathExistsSync: fs.existsSync
|
|
12
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('graceful-fs')
|
|
4
|
-
const u = require('universalify').fromCallback
|
|
5
|
-
|
|
6
|
-
function remove (path, callback) {
|
|
7
|
-
fs.rm(path, { recursive: true, force: true }, callback)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function removeSync (path) {
|
|
11
|
-
fs.rmSync(path, { recursive: true, force: true })
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
remove: u(remove),
|
|
16
|
-
removeSync
|
|
17
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
// https://github.com/jprichardson/node-fs-extra/issues/1056
|
|
4
|
-
// Performing parallel operations on each item of an async iterator is
|
|
5
|
-
// surprisingly hard; you need to have handlers in place to avoid getting an
|
|
6
|
-
// UnhandledPromiseRejectionWarning.
|
|
7
|
-
// NOTE: This function does not presently handle return values, only errors
|
|
8
|
-
async function asyncIteratorConcurrentProcess (iterator, fn) {
|
|
9
|
-
const promises = []
|
|
10
|
-
for await (const item of iterator) {
|
|
11
|
-
promises.push(
|
|
12
|
-
fn(item).then(
|
|
13
|
-
() => null,
|
|
14
|
-
(err) => err ?? new Error('unknown error')
|
|
15
|
-
)
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
await Promise.all(
|
|
19
|
-
promises.map((promise) =>
|
|
20
|
-
promise.then((possibleErr) => {
|
|
21
|
-
if (possibleErr !== null) throw possibleErr
|
|
22
|
-
})
|
|
23
|
-
)
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
module.exports = {
|
|
28
|
-
asyncIteratorConcurrentProcess
|
|
29
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('../fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
const u = require('universalify').fromPromise
|
|
6
|
-
|
|
7
|
-
function getStats (src, dest, opts) {
|
|
8
|
-
const statFunc = opts.dereference
|
|
9
|
-
? (file) => fs.stat(file, { bigint: true })
|
|
10
|
-
: (file) => fs.lstat(file, { bigint: true })
|
|
11
|
-
return Promise.all([
|
|
12
|
-
statFunc(src),
|
|
13
|
-
statFunc(dest).catch(err => {
|
|
14
|
-
if (err.code === 'ENOENT') return null
|
|
15
|
-
throw err
|
|
16
|
-
})
|
|
17
|
-
]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function getStatsSync (src, dest, opts) {
|
|
21
|
-
let destStat
|
|
22
|
-
const statFunc = opts.dereference
|
|
23
|
-
? (file) => fs.statSync(file, { bigint: true })
|
|
24
|
-
: (file) => fs.lstatSync(file, { bigint: true })
|
|
25
|
-
const srcStat = statFunc(src)
|
|
26
|
-
try {
|
|
27
|
-
destStat = statFunc(dest)
|
|
28
|
-
} catch (err) {
|
|
29
|
-
if (err.code === 'ENOENT') return { srcStat, destStat: null }
|
|
30
|
-
throw err
|
|
31
|
-
}
|
|
32
|
-
return { srcStat, destStat }
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function checkPaths (src, dest, funcName, opts) {
|
|
36
|
-
const { srcStat, destStat } = await getStats(src, dest, opts)
|
|
37
|
-
if (destStat) {
|
|
38
|
-
if (areIdentical(srcStat, destStat)) {
|
|
39
|
-
const srcBaseName = path.basename(src)
|
|
40
|
-
const destBaseName = path.basename(dest)
|
|
41
|
-
if (funcName === 'move' &&
|
|
42
|
-
srcBaseName !== destBaseName &&
|
|
43
|
-
srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
44
|
-
return { srcStat, destStat, isChangingCase: true }
|
|
45
|
-
}
|
|
46
|
-
throw new Error('Source and destination must not be the same.')
|
|
47
|
-
}
|
|
48
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
49
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
|
|
50
|
-
}
|
|
51
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
52
|
-
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
57
|
-
throw new Error(errMsg(src, dest, funcName))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return { srcStat, destStat }
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function checkPathsSync (src, dest, funcName, opts) {
|
|
64
|
-
const { srcStat, destStat } = getStatsSync(src, dest, opts)
|
|
65
|
-
|
|
66
|
-
if (destStat) {
|
|
67
|
-
if (areIdentical(srcStat, destStat)) {
|
|
68
|
-
const srcBaseName = path.basename(src)
|
|
69
|
-
const destBaseName = path.basename(dest)
|
|
70
|
-
if (funcName === 'move' &&
|
|
71
|
-
srcBaseName !== destBaseName &&
|
|
72
|
-
srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
|
|
73
|
-
return { srcStat, destStat, isChangingCase: true }
|
|
74
|
-
}
|
|
75
|
-
throw new Error('Source and destination must not be the same.')
|
|
76
|
-
}
|
|
77
|
-
if (srcStat.isDirectory() && !destStat.isDirectory()) {
|
|
78
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
|
|
79
|
-
}
|
|
80
|
-
if (!srcStat.isDirectory() && destStat.isDirectory()) {
|
|
81
|
-
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
|
|
86
|
-
throw new Error(errMsg(src, dest, funcName))
|
|
87
|
-
}
|
|
88
|
-
return { srcStat, destStat }
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// recursively check if dest parent is a subdirectory of src.
|
|
92
|
-
// It works for all file types including symlinks since it
|
|
93
|
-
// checks the src and dest inodes. It starts from the deepest
|
|
94
|
-
// parent and stops once it reaches the src parent or the root path.
|
|
95
|
-
async function checkParentPaths (src, srcStat, dest, funcName) {
|
|
96
|
-
const srcParent = path.resolve(path.dirname(src))
|
|
97
|
-
const destParent = path.resolve(path.dirname(dest))
|
|
98
|
-
if (destParent === srcParent || destParent === path.parse(destParent).root) return
|
|
99
|
-
|
|
100
|
-
let destStat
|
|
101
|
-
try {
|
|
102
|
-
destStat = await fs.stat(destParent, { bigint: true })
|
|
103
|
-
} catch (err) {
|
|
104
|
-
if (err.code === 'ENOENT') return
|
|
105
|
-
throw err
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (areIdentical(srcStat, destStat)) {
|
|
109
|
-
throw new Error(errMsg(src, dest, funcName))
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return checkParentPaths(src, srcStat, destParent, funcName)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function checkParentPathsSync (src, srcStat, dest, funcName) {
|
|
116
|
-
const srcParent = path.resolve(path.dirname(src))
|
|
117
|
-
const destParent = path.resolve(path.dirname(dest))
|
|
118
|
-
if (destParent === srcParent || destParent === path.parse(destParent).root) return
|
|
119
|
-
let destStat
|
|
120
|
-
try {
|
|
121
|
-
destStat = fs.statSync(destParent, { bigint: true })
|
|
122
|
-
} catch (err) {
|
|
123
|
-
if (err.code === 'ENOENT') return
|
|
124
|
-
throw err
|
|
125
|
-
}
|
|
126
|
-
if (areIdentical(srcStat, destStat)) {
|
|
127
|
-
throw new Error(errMsg(src, dest, funcName))
|
|
128
|
-
}
|
|
129
|
-
return checkParentPathsSync(src, srcStat, destParent, funcName)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function areIdentical (srcStat, destStat) {
|
|
133
|
-
// stat.dev can be 0n on windows when node version >= 22.x.x
|
|
134
|
-
return destStat.ino !== undefined && destStat.dev !== undefined && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// return true if dest is a subdir of src, otherwise false.
|
|
138
|
-
// It only checks the path strings.
|
|
139
|
-
function isSrcSubdir (src, dest) {
|
|
140
|
-
const srcArr = path.resolve(src).split(path.sep).filter(i => i)
|
|
141
|
-
const destArr = path.resolve(dest).split(path.sep).filter(i => i)
|
|
142
|
-
return srcArr.every((cur, i) => destArr[i] === cur)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function errMsg (src, dest, funcName) {
|
|
146
|
-
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
module.exports = {
|
|
150
|
-
// checkPaths
|
|
151
|
-
checkPaths: u(checkPaths),
|
|
152
|
-
checkPathsSync,
|
|
153
|
-
// checkParent
|
|
154
|
-
checkParentPaths: u(checkParentPaths),
|
|
155
|
-
checkParentPathsSync,
|
|
156
|
-
// Misc
|
|
157
|
-
isSrcSubdir,
|
|
158
|
-
areIdentical
|
|
159
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const fs = require('../fs')
|
|
4
|
-
const u = require('universalify').fromPromise
|
|
5
|
-
|
|
6
|
-
async function utimesMillis (path, atime, mtime) {
|
|
7
|
-
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
|
|
8
|
-
const fd = await fs.open(path, 'r+')
|
|
9
|
-
|
|
10
|
-
let closeErr = null
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
await fs.futimes(fd, atime, mtime)
|
|
14
|
-
} finally {
|
|
15
|
-
try {
|
|
16
|
-
await fs.close(fd)
|
|
17
|
-
} catch (e) {
|
|
18
|
-
closeErr = e
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (closeErr) {
|
|
23
|
-
throw closeErr
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function utimesMillisSync (path, atime, mtime) {
|
|
28
|
-
const fd = fs.openSync(path, 'r+')
|
|
29
|
-
fs.futimesSync(fd, atime, mtime)
|
|
30
|
-
return fs.closeSync(fd)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
module.exports = {
|
|
34
|
-
utimesMillis: u(utimesMillis),
|
|
35
|
-
utimesMillisSync
|
|
36
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "fs-extra",
|
|
3
|
-
"version": "11.3.3",
|
|
4
|
-
"description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.",
|
|
5
|
-
"engines": {
|
|
6
|
-
"node": ">=14.14"
|
|
7
|
-
},
|
|
8
|
-
"homepage": "https://github.com/jprichardson/node-fs-extra",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "https://github.com/jprichardson/node-fs-extra"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"fs",
|
|
15
|
-
"file",
|
|
16
|
-
"file system",
|
|
17
|
-
"copy",
|
|
18
|
-
"directory",
|
|
19
|
-
"extra",
|
|
20
|
-
"mkdirp",
|
|
21
|
-
"mkdir",
|
|
22
|
-
"mkdirs",
|
|
23
|
-
"recursive",
|
|
24
|
-
"json",
|
|
25
|
-
"read",
|
|
26
|
-
"write",
|
|
27
|
-
"extra",
|
|
28
|
-
"delete",
|
|
29
|
-
"remove",
|
|
30
|
-
"touch",
|
|
31
|
-
"create",
|
|
32
|
-
"text",
|
|
33
|
-
"output",
|
|
34
|
-
"move",
|
|
35
|
-
"promise"
|
|
36
|
-
],
|
|
37
|
-
"author": "JP Richardson <jprichardson@gmail.com>",
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"graceful-fs": "^4.2.0",
|
|
41
|
-
"jsonfile": "^6.0.1",
|
|
42
|
-
"universalify": "^2.0.0"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"klaw": "^2.1.1",
|
|
46
|
-
"klaw-sync": "^3.0.2",
|
|
47
|
-
"minimist": "^1.1.1",
|
|
48
|
-
"mocha": "^10.1.0",
|
|
49
|
-
"nyc": "^15.0.0",
|
|
50
|
-
"proxyquire": "^2.0.1",
|
|
51
|
-
"read-dir-files": "^0.1.1",
|
|
52
|
-
"standard": "^17.0.0"
|
|
53
|
-
},
|
|
54
|
-
"main": "./lib/index.js",
|
|
55
|
-
"exports": {
|
|
56
|
-
".": "./lib/index.js",
|
|
57
|
-
"./esm": "./lib/esm.mjs"
|
|
58
|
-
},
|
|
59
|
-
"files": [
|
|
60
|
-
"lib/",
|
|
61
|
-
"!lib/**/__tests__/"
|
|
62
|
-
],
|
|
63
|
-
"scripts": {
|
|
64
|
-
"lint": "standard",
|
|
65
|
-
"test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha",
|
|
66
|
-
"test": "npm run lint && npm run unit && npm run unit-esm",
|
|
67
|
-
"unit": "nyc node test.js",
|
|
68
|
-
"unit-esm": "node test.mjs"
|
|
69
|
-
},
|
|
70
|
-
"sideEffects": false
|
|
71
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "get-stream",
|
|
3
|
-
"version": "9.0.1",
|
|
4
|
-
"description": "Get a stream as a string, Buffer, ArrayBuffer or array",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "sindresorhus/get-stream",
|
|
7
|
-
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
-
"author": {
|
|
9
|
-
"name": "Sindre Sorhus",
|
|
10
|
-
"email": "sindresorhus@gmail.com",
|
|
11
|
-
"url": "https://sindresorhus.com"
|
|
12
|
-
},
|
|
13
|
-
"type": "module",
|
|
14
|
-
"exports": {
|
|
15
|
-
"types": "./source/index.d.ts",
|
|
16
|
-
"browser": "./source/exports.js",
|
|
17
|
-
"default": "./source/index.js"
|
|
18
|
-
},
|
|
19
|
-
"sideEffects": false,
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": ">=18"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"benchmark": "node benchmarks/index.js",
|
|
25
|
-
"test": "xo && ava && tsd --typings=source/index.d.ts --files=source/index.test-d.ts"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"source",
|
|
29
|
-
"!*.test-d.ts"
|
|
30
|
-
],
|
|
31
|
-
"keywords": [
|
|
32
|
-
"get",
|
|
33
|
-
"stream",
|
|
34
|
-
"promise",
|
|
35
|
-
"concat",
|
|
36
|
-
"string",
|
|
37
|
-
"text",
|
|
38
|
-
"buffer",
|
|
39
|
-
"read",
|
|
40
|
-
"data",
|
|
41
|
-
"consume",
|
|
42
|
-
"readable",
|
|
43
|
-
"readablestream",
|
|
44
|
-
"object",
|
|
45
|
-
"concat"
|
|
46
|
-
],
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"@sec-ant/readable-stream": "^0.4.1",
|
|
49
|
-
"is-stream": "^4.0.1"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@types/node": "^20.8.9",
|
|
53
|
-
"ava": "^6.1.2",
|
|
54
|
-
"onetime": "^7.0.0",
|
|
55
|
-
"precise-now": "^3.0.0",
|
|
56
|
-
"stream-json": "^1.8.0",
|
|
57
|
-
"tsd": "^0.29.0",
|
|
58
|
-
"xo": "^0.58.0"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import {getStreamContents} from './contents.js';
|
|
2
|
-
import {noop, throwObjectStream, getLengthProperty} from './utils.js';
|
|
3
|
-
|
|
4
|
-
export async function getStreamAsArrayBuffer(stream, options) {
|
|
5
|
-
return getStreamContents(stream, arrayBufferMethods, options);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const initArrayBuffer = () => ({contents: new ArrayBuffer(0)});
|
|
9
|
-
|
|
10
|
-
const useTextEncoder = chunk => textEncoder.encode(chunk);
|
|
11
|
-
const textEncoder = new TextEncoder();
|
|
12
|
-
|
|
13
|
-
const useUint8Array = chunk => new Uint8Array(chunk);
|
|
14
|
-
|
|
15
|
-
const useUint8ArrayWithOffset = chunk => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
16
|
-
|
|
17
|
-
const truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
|
|
18
|
-
|
|
19
|
-
// `contents` is an increasingly growing `Uint8Array`.
|
|
20
|
-
const addArrayBufferChunk = (convertedChunk, {contents, length: previousLength}, length) => {
|
|
21
|
-
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
|
|
22
|
-
new Uint8Array(newContents).set(convertedChunk, previousLength);
|
|
23
|
-
return newContents;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Without `ArrayBuffer.resize()`, `contents` size is always a power of 2.
|
|
27
|
-
// This means its last bytes are zeroes (not stream data), which need to be
|
|
28
|
-
// trimmed at the end with `ArrayBuffer.slice()`.
|
|
29
|
-
const resizeArrayBufferSlow = (contents, length) => {
|
|
30
|
-
if (length <= contents.byteLength) {
|
|
31
|
-
return contents;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
|
|
35
|
-
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
36
|
-
return arrayBuffer;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// With `ArrayBuffer.resize()`, `contents` size matches exactly the size of
|
|
40
|
-
// the stream data. It does not include extraneous zeroes to trim at the end.
|
|
41
|
-
// The underlying `ArrayBuffer` does allocate a number of bytes that is a power
|
|
42
|
-
// of 2, but those bytes are only visible after calling `ArrayBuffer.resize()`.
|
|
43
|
-
const resizeArrayBuffer = (contents, length) => {
|
|
44
|
-
if (length <= contents.maxByteLength) {
|
|
45
|
-
contents.resize(length);
|
|
46
|
-
return contents;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const arrayBuffer = new ArrayBuffer(length, {maxByteLength: getNewContentsLength(length)});
|
|
50
|
-
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
|
|
51
|
-
return arrayBuffer;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// Retrieve the closest `length` that is both >= and a power of 2
|
|
55
|
-
const getNewContentsLength = length => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
|
|
56
|
-
|
|
57
|
-
const SCALE_FACTOR = 2;
|
|
58
|
-
|
|
59
|
-
const finalizeArrayBuffer = ({contents, length}) => hasArrayBufferResize() ? contents : contents.slice(0, length);
|
|
60
|
-
|
|
61
|
-
// `ArrayBuffer.slice()` is slow. When `ArrayBuffer.resize()` is available
|
|
62
|
-
// (Node >=20.0.0, Safari >=16.4 and Chrome), we can use it instead.
|
|
63
|
-
// eslint-disable-next-line no-warning-comments
|
|
64
|
-
// TODO: remove after dropping support for Node 20.
|
|
65
|
-
// eslint-disable-next-line no-warning-comments
|
|
66
|
-
// TODO: use `ArrayBuffer.transferToFixedLength()` instead once it is available
|
|
67
|
-
const hasArrayBufferResize = () => 'resize' in ArrayBuffer.prototype;
|
|
68
|
-
|
|
69
|
-
const arrayBufferMethods = {
|
|
70
|
-
init: initArrayBuffer,
|
|
71
|
-
convertChunk: {
|
|
72
|
-
string: useTextEncoder,
|
|
73
|
-
buffer: useUint8Array,
|
|
74
|
-
arrayBuffer: useUint8Array,
|
|
75
|
-
dataView: useUint8ArrayWithOffset,
|
|
76
|
-
typedArray: useUint8ArrayWithOffset,
|
|
77
|
-
others: throwObjectStream,
|
|
78
|
-
},
|
|
79
|
-
getSize: getLengthProperty,
|
|
80
|
-
truncateChunk: truncateArrayBufferChunk,
|
|
81
|
-
addChunk: addArrayBufferChunk,
|
|
82
|
-
getFinalChunk: noop,
|
|
83
|
-
finalize: finalizeArrayBuffer,
|
|
84
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {getStreamContents} from './contents.js';
|
|
2
|
-
import {identity, noop, getContentsProperty} from './utils.js';
|
|
3
|
-
|
|
4
|
-
export async function getStreamAsArray(stream, options) {
|
|
5
|
-
return getStreamContents(stream, arrayMethods, options);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const initArray = () => ({contents: []});
|
|
9
|
-
|
|
10
|
-
const increment = () => 1;
|
|
11
|
-
|
|
12
|
-
const addArrayChunk = (convertedChunk, {contents}) => {
|
|
13
|
-
contents.push(convertedChunk);
|
|
14
|
-
return contents;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const arrayMethods = {
|
|
18
|
-
init: initArray,
|
|
19
|
-
convertChunk: {
|
|
20
|
-
string: identity,
|
|
21
|
-
buffer: identity,
|
|
22
|
-
arrayBuffer: identity,
|
|
23
|
-
dataView: identity,
|
|
24
|
-
typedArray: identity,
|
|
25
|
-
others: identity,
|
|
26
|
-
},
|
|
27
|
-
getSize: increment,
|
|
28
|
-
truncateChunk: noop,
|
|
29
|
-
addChunk: addArrayChunk,
|
|
30
|
-
getFinalChunk: noop,
|
|
31
|
-
finalize: getContentsProperty,
|
|
32
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {getStreamAsArrayBuffer} from './array-buffer.js';
|
|
2
|
-
|
|
3
|
-
export async function getStreamAsBuffer(stream, options) {
|
|
4
|
-
if (!('Buffer' in globalThis)) {
|
|
5
|
-
throw new Error('getStreamAsBuffer() is only supported in Node.js');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
return arrayBufferToNodeBuffer(await getStreamAsArrayBuffer(stream, options));
|
|
10
|
-
} catch (error) {
|
|
11
|
-
if (error.bufferedData !== undefined) {
|
|
12
|
-
error.bufferedData = arrayBufferToNodeBuffer(error.bufferedData);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
throw error;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const arrayBufferToNodeBuffer = arrayBuffer => globalThis.Buffer.from(arrayBuffer);
|