From edc65756467833efff490a9b598c4e01123d5aea Mon Sep 17 00:00:00 2001 From: Drew Heavner Date: Thu, 18 Mar 2021 14:18:40 +0000 Subject: [PATCH] Ensuring node modules are up to date for running --- lib/main.js | 4 +- node_modules/@nodelib/fs.scandir/LICENSE | 21 + node_modules/@nodelib/fs.scandir/README.md | 171 ++++ .../@nodelib/fs.scandir/out/adapters/fs.d.ts | 13 + .../fs.scandir/out/adapters/fs.d.ts.map | 1 + .../@nodelib/fs.scandir/out/adapters/fs.js | 19 + .../fs.scandir/out/adapters/fs.spec.d.ts | 2 + .../fs.scandir/out/adapters/fs.spec.d.ts.map | 1 + .../fs.scandir/out/adapters/fs.spec.js | 20 + .../@nodelib/fs.scandir/out/constants.d.ts | 5 + .../fs.scandir/out/constants.d.ts.map | 1 + .../@nodelib/fs.scandir/out/constants.js | 14 + .../@nodelib/fs.scandir/out/index.d.ts | 13 + .../@nodelib/fs.scandir/out/index.d.ts.map | 1 + node_modules/@nodelib/fs.scandir/out/index.js | 25 + .../@nodelib/fs.scandir/out/index.spec.d.ts | 2 + .../fs.scandir/out/index.spec.d.ts.map | 1 + .../@nodelib/fs.scandir/out/index.spec.js | 71 ++ .../fs.scandir/out/providers/async.d.ts | 8 + .../fs.scandir/out/providers/async.d.ts.map | 1 + .../fs.scandir/out/providers/async.js | 92 ++ .../fs.scandir/out/providers/async.spec.d.ts | 2 + .../out/providers/async.spec.d.ts.map | 1 + .../fs.scandir/out/providers/async.spec.js | 180 ++++ .../fs.scandir/out/providers/common.d.ts | 2 + .../fs.scandir/out/providers/common.d.ts.map | 1 + .../fs.scandir/out/providers/common.js | 13 + .../fs.scandir/out/providers/common.spec.d.ts | 2 + .../out/providers/common.spec.d.ts.map | 1 + .../fs.scandir/out/providers/common.spec.js | 22 + .../fs.scandir/out/providers/sync.d.ts | 6 + .../fs.scandir/out/providers/sync.d.ts.map | 1 + .../@nodelib/fs.scandir/out/providers/sync.js | 54 ++ .../fs.scandir/out/providers/sync.spec.d.ts | 2 + .../out/providers/sync.spec.d.ts.map | 1 + .../fs.scandir/out/providers/sync.spec.js | 144 ++++ .../@nodelib/fs.scandir/out/settings.d.ts | 21 + .../@nodelib/fs.scandir/out/settings.d.ts.map | 1 + .../@nodelib/fs.scandir/out/settings.js | 24 + .../fs.scandir/out/settings.spec.d.ts | 2 + .../fs.scandir/out/settings.spec.d.ts.map | 1 + .../@nodelib/fs.scandir/out/settings.spec.js | 27 + .../@nodelib/fs.scandir/out/types/index.d.ts | 20 + .../fs.scandir/out/types/index.d.ts.map | 1 + .../@nodelib/fs.scandir/out/types/index.js | 2 + .../@nodelib/fs.scandir/out/utils/fs.d.ts | 3 + .../@nodelib/fs.scandir/out/utils/fs.d.ts.map | 1 + .../@nodelib/fs.scandir/out/utils/fs.js | 19 + .../fs.scandir/out/utils/fs.spec.d.ts | 2 + .../fs.scandir/out/utils/fs.spec.d.ts.map | 1 + .../@nodelib/fs.scandir/out/utils/fs.spec.js | 20 + .../@nodelib/fs.scandir/out/utils/index.d.ts | 3 + .../fs.scandir/out/utils/index.d.ts.map | 1 + .../@nodelib/fs.scandir/out/utils/index.js | 5 + node_modules/@nodelib/fs.scandir/package.json | 67 ++ .../fs.scandir/src/adapters/fs.spec.ts | 31 + .../@nodelib/fs.scandir/src/adapters/fs.ts | 30 + .../@nodelib/fs.scandir/src/constants.ts | 15 + .../@nodelib/fs.scandir/src/index.spec.ts | 85 ++ node_modules/@nodelib/fs.scandir/src/index.ts | 51 ++ .../fs.scandir/src/providers/async.spec.ts | 236 ++++++ .../fs.scandir/src/providers/async.ts | 121 +++ .../fs.scandir/src/providers/common.spec.ts | 24 + .../fs.scandir/src/providers/common.ts | 10 + .../fs.scandir/src/providers/sync.spec.ts | 186 ++++ .../@nodelib/fs.scandir/src/providers/sync.ts | 62 ++ .../@nodelib/fs.scandir/src/settings.spec.ts | 32 + .../@nodelib/fs.scandir/src/settings.ts | 33 + .../@nodelib/fs.scandir/src/types/index.ts | 21 + .../@nodelib/fs.scandir/src/utils/fs.spec.ts | 21 + .../@nodelib/fs.scandir/src/utils/fs.ts | 27 + .../@nodelib/fs.scandir/src/utils/index.ts | 5 + .../@nodelib/fs.scandir/tsconfig.json | 15 + node_modules/@nodelib/fs.stat/LICENSE | 21 + node_modules/@nodelib/fs.stat/README.md | 126 +++ .../@nodelib/fs.stat/out/adapters/fs.d.ts | 11 + .../@nodelib/fs.stat/out/adapters/fs.d.ts.map | 1 + .../@nodelib/fs.stat/out/adapters/fs.js | 17 + .../fs.stat/out/adapters/fs.spec.d.ts | 2 + .../fs.stat/out/adapters/fs.spec.d.ts.map | 1 + .../@nodelib/fs.stat/out/adapters/fs.spec.js | 20 + node_modules/@nodelib/fs.stat/out/index.d.ts | 13 + .../@nodelib/fs.stat/out/index.d.ts.map | 1 + node_modules/@nodelib/fs.stat/out/index.js | 25 + .../@nodelib/fs.stat/out/index.spec.d.ts | 2 + .../@nodelib/fs.stat/out/index.spec.d.ts.map | 1 + .../@nodelib/fs.stat/out/index.spec.js | 56 ++ .../@nodelib/fs.stat/out/providers/async.d.ts | 5 + .../fs.stat/out/providers/async.d.ts.map | 1 + .../@nodelib/fs.stat/out/providers/async.js | 32 + .../fs.stat/out/providers/async.spec.d.ts | 2 + .../fs.stat/out/providers/async.spec.d.ts.map | 1 + .../fs.stat/out/providers/async.spec.js | 83 ++ .../@nodelib/fs.stat/out/providers/sync.d.ts | 4 + .../fs.stat/out/providers/sync.d.ts.map | 1 + .../@nodelib/fs.stat/out/providers/sync.js | 23 + .../fs.stat/out/providers/sync.spec.d.ts | 2 + .../fs.stat/out/providers/sync.spec.d.ts.map | 1 + .../fs.stat/out/providers/sync.spec.js | 66 ++ .../@nodelib/fs.stat/out/settings.d.ts | 17 + .../@nodelib/fs.stat/out/settings.d.ts.map | 1 + node_modules/@nodelib/fs.stat/out/settings.js | 16 + .../@nodelib/fs.stat/out/settings.spec.d.ts | 2 + .../fs.stat/out/settings.spec.d.ts.map | 1 + .../@nodelib/fs.stat/out/settings.spec.js | 26 + .../@nodelib/fs.stat/out/types/index.d.ts | 5 + .../@nodelib/fs.stat/out/types/index.d.ts.map | 1 + .../@nodelib/fs.stat/out/types/index.js | 2 + node_modules/@nodelib/fs.stat/package.json | 62 ++ .../@nodelib/fs.stat/src/adapters/fs.spec.ts | 31 + .../@nodelib/fs.stat/src/adapters/fs.ts | 26 + .../@nodelib/fs.stat/src/index.spec.ts | 70 ++ node_modules/@nodelib/fs.stat/src/index.ts | 50 ++ .../fs.stat/src/providers/async.spec.ts | 102 +++ .../@nodelib/fs.stat/src/providers/async.ts | 43 + .../fs.stat/src/providers/sync.spec.ts | 90 ++ .../@nodelib/fs.stat/src/providers/sync.ts | 26 + .../@nodelib/fs.stat/src/settings.spec.ts | 31 + node_modules/@nodelib/fs.stat/src/settings.ts | 21 + .../@nodelib/fs.stat/src/types/index.ts | 4 + node_modules/@nodelib/fs.stat/tsconfig.json | 12 + node_modules/@nodelib/fs.walk/LICENSE | 21 + node_modules/@nodelib/fs.walk/README.md | 215 +++++ node_modules/@nodelib/fs.walk/out/index.d.ts | 15 + .../@nodelib/fs.walk/out/index.d.ts.map | 1 + node_modules/@nodelib/fs.walk/out/index.js | 33 + .../@nodelib/fs.walk/out/index.spec.d.ts | 2 + .../@nodelib/fs.walk/out/index.spec.d.ts.map | 1 + .../@nodelib/fs.walk/out/index.spec.js | 99 +++ .../@nodelib/fs.walk/out/providers/async.d.ts | 13 + .../fs.walk/out/providers/async.d.ts.map | 1 + .../@nodelib/fs.walk/out/providers/async.js | 30 + .../fs.walk/out/providers/async.spec.d.ts | 2 + .../fs.walk/out/providers/async.spec.d.ts.map | 1 + .../fs.walk/out/providers/async.spec.js | 42 + .../@nodelib/fs.walk/out/providers/index.d.ts | 5 + .../fs.walk/out/providers/index.d.ts.map | 1 + .../@nodelib/fs.walk/out/providers/index.js | 9 + .../fs.walk/out/providers/stream.d.ts | 13 + .../fs.walk/out/providers/stream.d.ts.map | 1 + .../@nodelib/fs.walk/out/providers/stream.js | 34 + .../fs.walk/out/providers/stream.spec.d.ts | 2 + .../out/providers/stream.spec.d.ts.map | 1 + .../fs.walk/out/providers/stream.spec.js | 62 ++ .../@nodelib/fs.walk/out/providers/sync.d.ts | 11 + .../fs.walk/out/providers/sync.d.ts.map | 1 + .../@nodelib/fs.walk/out/providers/sync.js | 14 + .../fs.walk/out/providers/sync.spec.d.ts | 2 + .../fs.walk/out/providers/sync.spec.d.ts.map | 1 + .../fs.walk/out/providers/sync.spec.js | 27 + .../@nodelib/fs.walk/out/readers/async.d.ts | 31 + .../fs.walk/out/readers/async.d.ts.map | 1 + .../@nodelib/fs.walk/out/readers/async.js | 96 +++ .../fs.walk/out/readers/async.spec.d.ts | 2 + .../fs.walk/out/readers/async.spec.d.ts.map | 1 + .../fs.walk/out/readers/async.spec.js | 165 ++++ .../@nodelib/fs.walk/out/readers/common.d.ts | 7 + .../fs.walk/out/readers/common.d.ts.map | 1 + .../@nodelib/fs.walk/out/readers/common.js | 31 + .../fs.walk/out/readers/common.spec.d.ts | 2 + .../fs.walk/out/readers/common.spec.d.ts.map | 1 + .../fs.walk/out/readers/common.spec.js | 85 ++ .../@nodelib/fs.walk/out/readers/reader.d.ts | 7 + .../fs.walk/out/readers/reader.d.ts.map | 1 + .../@nodelib/fs.walk/out/readers/reader.js | 11 + .../fs.walk/out/readers/reader.spec.d.ts | 2 + .../fs.walk/out/readers/reader.spec.d.ts.map | 1 + .../fs.walk/out/readers/reader.spec.js | 25 + .../@nodelib/fs.walk/out/readers/sync.d.ts | 16 + .../fs.walk/out/readers/sync.d.ts.map | 1 + .../@nodelib/fs.walk/out/readers/sync.js | 59 ++ .../fs.walk/out/readers/sync.spec.d.ts | 2 + .../fs.walk/out/readers/sync.spec.d.ts.map | 1 + .../@nodelib/fs.walk/out/readers/sync.spec.js | 89 ++ .../@nodelib/fs.walk/out/settings.d.ts | 31 + .../@nodelib/fs.walk/out/settings.d.ts.map | 1 + node_modules/@nodelib/fs.walk/out/settings.js | 26 + .../@nodelib/fs.walk/out/settings.spec.d.ts | 2 + .../fs.walk/out/settings.spec.d.ts.map | 1 + .../@nodelib/fs.walk/out/settings.spec.js | 28 + .../@nodelib/fs.walk/out/tests/index.d.ts | 16 + .../@nodelib/fs.walk/out/tests/index.d.ts.map | 1 + .../@nodelib/fs.walk/out/tests/index.js | 34 + .../@nodelib/fs.walk/out/types/index.d.ts | 9 + .../@nodelib/fs.walk/out/types/index.d.ts.map | 1 + .../@nodelib/fs.walk/out/types/index.js | 2 + node_modules/@nodelib/fs.walk/package.json | 67 ++ .../@nodelib/fs.walk/src/index.spec.ts | 129 +++ node_modules/@nodelib/fs.walk/src/index.ts | 63 ++ .../fs.walk/src/providers/async.spec.ts | 57 ++ .../@nodelib/fs.walk/src/providers/async.ts | 40 + .../@nodelib/fs.walk/src/providers/index.ts | 9 + .../fs.walk/src/providers/stream.spec.ts | 90 ++ .../@nodelib/fs.walk/src/providers/stream.ts | 36 + .../fs.walk/src/providers/sync.spec.ts | 34 + .../@nodelib/fs.walk/src/providers/sync.ts | 13 + .../fs.walk/src/readers/async.spec.ts | 232 +++++ .../@nodelib/fs.walk/src/readers/async.ts | 126 +++ .../fs.walk/src/readers/common.spec.ts | 114 +++ .../@nodelib/fs.walk/src/readers/common.ts | 33 + .../fs.walk/src/readers/reader.spec.ts | 30 + .../@nodelib/fs.walk/src/readers/reader.ts | 8 + .../@nodelib/fs.walk/src/readers/sync.spec.ts | 126 +++ .../@nodelib/fs.walk/src/readers/sync.ts | 69 ++ .../@nodelib/fs.walk/src/settings.spec.ts | 33 + node_modules/@nodelib/fs.walk/src/settings.ts | 46 + .../@nodelib/fs.walk/src/tests/index.ts | 40 + .../@nodelib/fs.walk/src/types/index.ts | 9 + node_modules/@nodelib/fs.walk/tsconfig.json | 15 + node_modules/fast-glob/LICENSE | 21 + node_modules/fast-glob/README.md | 793 ++++++++++++++++++ node_modules/fast-glob/out/index.d.ts | 27 + node_modules/fast-glob/out/index.js | 67 ++ .../fast-glob/out/managers/tasks.d.ts | 16 + node_modules/fast-glob/out/managers/tasks.js | 65 ++ .../fast-glob/out/providers/async.d.ts | 11 + node_modules/fast-glob/out/providers/async.js | 28 + .../fast-glob/out/providers/filters/deep.d.ts | 16 + .../fast-glob/out/providers/filters/deep.js | 62 ++ .../out/providers/filters/entry.d.ts | 16 + .../fast-glob/out/providers/filters/entry.js | 56 ++ .../out/providers/filters/error.d.ts | 8 + .../fast-glob/out/providers/filters/error.js | 15 + .../out/providers/matchers/matcher.d.ts | 33 + .../out/providers/matchers/matcher.js | 50 ++ .../out/providers/matchers/partial.d.ts | 4 + .../out/providers/matchers/partial.js | 38 + .../fast-glob/out/providers/provider.d.ts | 19 + .../fast-glob/out/providers/provider.js | 48 ++ .../fast-glob/out/providers/stream.d.ts | 11 + .../fast-glob/out/providers/stream.js | 31 + .../fast-glob/out/providers/sync.d.ts | 9 + node_modules/fast-glob/out/providers/sync.js | 23 + .../out/providers/transformers/entry.d.ts | 8 + .../out/providers/transformers/entry.js | 26 + .../fast-glob/out/readers/reader.d.ts | 15 + node_modules/fast-glob/out/readers/reader.js | 33 + .../fast-glob/out/readers/stream.d.ts | 14 + node_modules/fast-glob/out/readers/stream.js | 55 ++ node_modules/fast-glob/out/readers/sync.d.ts | 12 + node_modules/fast-glob/out/readers/sync.js | 43 + node_modules/fast-glob/out/settings.d.ts | 164 ++++ node_modules/fast-glob/out/settings.js | 57 ++ node_modules/fast-glob/out/types/index.d.ts | 31 + node_modules/fast-glob/out/types/index.js | 2 + node_modules/fast-glob/out/utils/array.d.ts | 2 + node_modules/fast-glob/out/utils/array.js | 22 + node_modules/fast-glob/out/utils/errno.d.ts | 2 + node_modules/fast-glob/out/utils/errno.js | 7 + node_modules/fast-glob/out/utils/fs.d.ts | 4 + node_modules/fast-glob/out/utils/fs.js | 19 + node_modules/fast-glob/out/utils/index.d.ts | 8 + node_modules/fast-glob/out/utils/index.js | 17 + node_modules/fast-glob/out/utils/path.d.ts | 8 + node_modules/fast-glob/out/utils/path.js | 33 + node_modules/fast-glob/out/utils/pattern.d.ts | 25 + node_modules/fast-glob/out/utils/pattern.js | 132 +++ node_modules/fast-glob/out/utils/stream.d.ts | 3 + node_modules/fast-glob/out/utils/stream.js | 17 + node_modules/fast-glob/out/utils/string.d.ts | 2 + node_modules/fast-glob/out/utils/string.js | 11 + node_modules/fast-glob/package.json | 123 +++ node_modules/fastq/.github/workflows/ci.yml | 50 ++ node_modules/fastq/LICENSE | 13 + node_modules/fastq/README.md | 255 ++++++ node_modules/fastq/bench.js | 66 ++ node_modules/fastq/example.js | 12 + node_modules/fastq/index.d.ts | 35 + node_modules/fastq/package.json | 78 ++ node_modules/fastq/queue.js | 253 ++++++ node_modules/fastq/test/example.ts | 81 ++ node_modules/fastq/test/promise.js | 120 +++ node_modules/fastq/test/test.js | 564 +++++++++++++ node_modules/fastq/test/tsconfig.json | 11 + node_modules/glob-parent/CHANGELOG.md | 110 +++ node_modules/glob-parent/LICENSE | 15 + node_modules/glob-parent/README.md | 137 +++ node_modules/glob-parent/index.js | 42 + node_modules/glob-parent/package.json | 93 ++ node_modules/is-extglob/LICENSE | 21 + node_modules/is-extglob/README.md | 107 +++ node_modules/is-extglob/index.js | 20 + node_modules/is-extglob/package.json | 103 +++ node_modules/is-glob/LICENSE | 21 + node_modules/is-glob/README.md | 206 +++++ node_modules/is-glob/index.js | 48 ++ node_modules/is-glob/package.json | 124 +++ node_modules/merge2/LICENSE | 21 + node_modules/merge2/README.md | 144 ++++ node_modules/merge2/index.js | 144 ++++ node_modules/merge2/package.json | 74 ++ node_modules/queue-microtask/LICENSE | 20 + node_modules/queue-microtask/README.md | 90 ++ node_modules/queue-microtask/index.d.ts | 2 + node_modules/queue-microtask/index.js | 9 + node_modules/queue-microtask/package.json | 84 ++ node_modules/reusify/.coveralls.yml | 1 + node_modules/reusify/.travis.yml | 28 + node_modules/reusify/LICENSE | 22 + node_modules/reusify/README.md | 145 ++++ .../benchmarks/createNoCodeFunction.js | 30 + node_modules/reusify/benchmarks/fib.js | 13 + .../reusify/benchmarks/reuseNoCodeFunction.js | 38 + node_modules/reusify/package.json | 76 ++ node_modules/reusify/reusify.js | 33 + node_modules/reusify/test.js | 66 ++ node_modules/run-parallel/LICENSE | 20 + node_modules/run-parallel/README.md | 85 ++ node_modules/run-parallel/index.js | 51 ++ node_modules/run-parallel/package.json | 86 ++ package.json | 2 +- 311 files changed, 12398 insertions(+), 3 deletions(-) create mode 100644 node_modules/@nodelib/fs.scandir/LICENSE create mode 100644 node_modules/@nodelib/fs.scandir/README.md create mode 100644 node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/adapters/fs.js create mode 100644 node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.js create mode 100644 node_modules/@nodelib/fs.scandir/out/constants.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/constants.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/constants.js create mode 100644 node_modules/@nodelib/fs.scandir/out/index.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/index.js create mode 100644 node_modules/@nodelib/fs.scandir/out/index.spec.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/index.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/index.spec.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/async.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/async.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/async.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/async.spec.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/common.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/common.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/common.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/common.spec.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/sync.js create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/providers/sync.spec.js create mode 100644 node_modules/@nodelib/fs.scandir/out/settings.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/settings.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/settings.js create mode 100644 node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/settings.spec.js create mode 100644 node_modules/@nodelib/fs.scandir/out/types/index.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/types/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/types/index.js create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/fs.js create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/fs.spec.js create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/index.d.ts create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.scandir/out/utils/index.js create mode 100644 node_modules/@nodelib/fs.scandir/package.json create mode 100644 node_modules/@nodelib/fs.scandir/src/adapters/fs.spec.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/adapters/fs.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/constants.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/index.spec.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/index.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/providers/async.spec.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/providers/async.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/providers/common.spec.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/providers/common.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/providers/sync.spec.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/providers/sync.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/settings.spec.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/settings.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/types/index.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/utils/fs.spec.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/utils/fs.ts create mode 100644 node_modules/@nodelib/fs.scandir/src/utils/index.ts create mode 100644 node_modules/@nodelib/fs.scandir/tsconfig.json create mode 100644 node_modules/@nodelib/fs.stat/LICENSE create mode 100644 node_modules/@nodelib/fs.stat/README.md create mode 100644 node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/adapters/fs.js create mode 100644 node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/adapters/fs.spec.js create mode 100644 node_modules/@nodelib/fs.stat/out/index.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/index.js create mode 100644 node_modules/@nodelib/fs.stat/out/index.spec.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/index.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/index.spec.js create mode 100644 node_modules/@nodelib/fs.stat/out/providers/async.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/providers/async.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/providers/async.js create mode 100644 node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/providers/async.spec.js create mode 100644 node_modules/@nodelib/fs.stat/out/providers/sync.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/providers/sync.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/providers/sync.js create mode 100644 node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/providers/sync.spec.js create mode 100644 node_modules/@nodelib/fs.stat/out/settings.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/settings.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/settings.js create mode 100644 node_modules/@nodelib/fs.stat/out/settings.spec.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/settings.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/settings.spec.js create mode 100644 node_modules/@nodelib/fs.stat/out/types/index.d.ts create mode 100644 node_modules/@nodelib/fs.stat/out/types/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.stat/out/types/index.js create mode 100644 node_modules/@nodelib/fs.stat/package.json create mode 100644 node_modules/@nodelib/fs.stat/src/adapters/fs.spec.ts create mode 100644 node_modules/@nodelib/fs.stat/src/adapters/fs.ts create mode 100644 node_modules/@nodelib/fs.stat/src/index.spec.ts create mode 100644 node_modules/@nodelib/fs.stat/src/index.ts create mode 100644 node_modules/@nodelib/fs.stat/src/providers/async.spec.ts create mode 100644 node_modules/@nodelib/fs.stat/src/providers/async.ts create mode 100644 node_modules/@nodelib/fs.stat/src/providers/sync.spec.ts create mode 100644 node_modules/@nodelib/fs.stat/src/providers/sync.ts create mode 100644 node_modules/@nodelib/fs.stat/src/settings.spec.ts create mode 100644 node_modules/@nodelib/fs.stat/src/settings.ts create mode 100644 node_modules/@nodelib/fs.stat/src/types/index.ts create mode 100644 node_modules/@nodelib/fs.stat/tsconfig.json create mode 100644 node_modules/@nodelib/fs.walk/LICENSE create mode 100644 node_modules/@nodelib/fs.walk/README.md create mode 100644 node_modules/@nodelib/fs.walk/out/index.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/index.js create mode 100644 node_modules/@nodelib/fs.walk/out/index.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/index.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/index.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/async.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/async.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/providers/async.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/async.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/async.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/providers/async.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/index.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/providers/index.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/stream.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/stream.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/providers/stream.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/stream.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/stream.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/providers/stream.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/sync.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/sync.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/providers/sync.js create mode 100644 node_modules/@nodelib/fs.walk/out/providers/sync.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/providers/sync.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/providers/sync.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/async.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/async.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/readers/async.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/async.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/async.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/readers/async.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/common.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/common.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/readers/common.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/common.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/common.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/readers/common.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/reader.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/reader.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/readers/reader.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/reader.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/reader.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/readers/reader.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/sync.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/sync.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/readers/sync.js create mode 100644 node_modules/@nodelib/fs.walk/out/readers/sync.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/readers/sync.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/readers/sync.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/settings.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/settings.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/settings.js create mode 100644 node_modules/@nodelib/fs.walk/out/settings.spec.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/settings.spec.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/settings.spec.js create mode 100644 node_modules/@nodelib/fs.walk/out/tests/index.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/tests/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/tests/index.js create mode 100644 node_modules/@nodelib/fs.walk/out/types/index.d.ts create mode 100644 node_modules/@nodelib/fs.walk/out/types/index.d.ts.map create mode 100644 node_modules/@nodelib/fs.walk/out/types/index.js create mode 100644 node_modules/@nodelib/fs.walk/package.json create mode 100644 node_modules/@nodelib/fs.walk/src/index.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/index.ts create mode 100644 node_modules/@nodelib/fs.walk/src/providers/async.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/providers/async.ts create mode 100644 node_modules/@nodelib/fs.walk/src/providers/index.ts create mode 100644 node_modules/@nodelib/fs.walk/src/providers/stream.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/providers/stream.ts create mode 100644 node_modules/@nodelib/fs.walk/src/providers/sync.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/providers/sync.ts create mode 100644 node_modules/@nodelib/fs.walk/src/readers/async.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/readers/async.ts create mode 100644 node_modules/@nodelib/fs.walk/src/readers/common.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/readers/common.ts create mode 100644 node_modules/@nodelib/fs.walk/src/readers/reader.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/readers/reader.ts create mode 100644 node_modules/@nodelib/fs.walk/src/readers/sync.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/readers/sync.ts create mode 100644 node_modules/@nodelib/fs.walk/src/settings.spec.ts create mode 100644 node_modules/@nodelib/fs.walk/src/settings.ts create mode 100644 node_modules/@nodelib/fs.walk/src/tests/index.ts create mode 100644 node_modules/@nodelib/fs.walk/src/types/index.ts create mode 100644 node_modules/@nodelib/fs.walk/tsconfig.json create mode 100644 node_modules/fast-glob/LICENSE create mode 100644 node_modules/fast-glob/README.md create mode 100644 node_modules/fast-glob/out/index.d.ts create mode 100644 node_modules/fast-glob/out/index.js create mode 100644 node_modules/fast-glob/out/managers/tasks.d.ts create mode 100644 node_modules/fast-glob/out/managers/tasks.js create mode 100644 node_modules/fast-glob/out/providers/async.d.ts create mode 100644 node_modules/fast-glob/out/providers/async.js create mode 100644 node_modules/fast-glob/out/providers/filters/deep.d.ts create mode 100644 node_modules/fast-glob/out/providers/filters/deep.js create mode 100644 node_modules/fast-glob/out/providers/filters/entry.d.ts create mode 100644 node_modules/fast-glob/out/providers/filters/entry.js create mode 100644 node_modules/fast-glob/out/providers/filters/error.d.ts create mode 100644 node_modules/fast-glob/out/providers/filters/error.js create mode 100644 node_modules/fast-glob/out/providers/matchers/matcher.d.ts create mode 100644 node_modules/fast-glob/out/providers/matchers/matcher.js create mode 100644 node_modules/fast-glob/out/providers/matchers/partial.d.ts create mode 100644 node_modules/fast-glob/out/providers/matchers/partial.js create mode 100644 node_modules/fast-glob/out/providers/provider.d.ts create mode 100644 node_modules/fast-glob/out/providers/provider.js create mode 100644 node_modules/fast-glob/out/providers/stream.d.ts create mode 100644 node_modules/fast-glob/out/providers/stream.js create mode 100644 node_modules/fast-glob/out/providers/sync.d.ts create mode 100644 node_modules/fast-glob/out/providers/sync.js create mode 100644 node_modules/fast-glob/out/providers/transformers/entry.d.ts create mode 100644 node_modules/fast-glob/out/providers/transformers/entry.js create mode 100644 node_modules/fast-glob/out/readers/reader.d.ts create mode 100644 node_modules/fast-glob/out/readers/reader.js create mode 100644 node_modules/fast-glob/out/readers/stream.d.ts create mode 100644 node_modules/fast-glob/out/readers/stream.js create mode 100644 node_modules/fast-glob/out/readers/sync.d.ts create mode 100644 node_modules/fast-glob/out/readers/sync.js create mode 100644 node_modules/fast-glob/out/settings.d.ts create mode 100644 node_modules/fast-glob/out/settings.js create mode 100644 node_modules/fast-glob/out/types/index.d.ts create mode 100644 node_modules/fast-glob/out/types/index.js create mode 100644 node_modules/fast-glob/out/utils/array.d.ts create mode 100644 node_modules/fast-glob/out/utils/array.js create mode 100644 node_modules/fast-glob/out/utils/errno.d.ts create mode 100644 node_modules/fast-glob/out/utils/errno.js create mode 100644 node_modules/fast-glob/out/utils/fs.d.ts create mode 100644 node_modules/fast-glob/out/utils/fs.js create mode 100644 node_modules/fast-glob/out/utils/index.d.ts create mode 100644 node_modules/fast-glob/out/utils/index.js create mode 100644 node_modules/fast-glob/out/utils/path.d.ts create mode 100644 node_modules/fast-glob/out/utils/path.js create mode 100644 node_modules/fast-glob/out/utils/pattern.d.ts create mode 100644 node_modules/fast-glob/out/utils/pattern.js create mode 100644 node_modules/fast-glob/out/utils/stream.d.ts create mode 100644 node_modules/fast-glob/out/utils/stream.js create mode 100644 node_modules/fast-glob/out/utils/string.d.ts create mode 100644 node_modules/fast-glob/out/utils/string.js create mode 100644 node_modules/fast-glob/package.json create mode 100644 node_modules/fastq/.github/workflows/ci.yml create mode 100644 node_modules/fastq/LICENSE create mode 100644 node_modules/fastq/README.md create mode 100644 node_modules/fastq/bench.js create mode 100644 node_modules/fastq/example.js create mode 100644 node_modules/fastq/index.d.ts create mode 100644 node_modules/fastq/package.json create mode 100644 node_modules/fastq/queue.js create mode 100644 node_modules/fastq/test/example.ts create mode 100644 node_modules/fastq/test/promise.js create mode 100644 node_modules/fastq/test/test.js create mode 100644 node_modules/fastq/test/tsconfig.json create mode 100644 node_modules/glob-parent/CHANGELOG.md create mode 100644 node_modules/glob-parent/LICENSE create mode 100644 node_modules/glob-parent/README.md create mode 100644 node_modules/glob-parent/index.js create mode 100644 node_modules/glob-parent/package.json create mode 100644 node_modules/is-extglob/LICENSE create mode 100644 node_modules/is-extglob/README.md create mode 100644 node_modules/is-extglob/index.js create mode 100644 node_modules/is-extglob/package.json create mode 100644 node_modules/is-glob/LICENSE create mode 100644 node_modules/is-glob/README.md create mode 100644 node_modules/is-glob/index.js create mode 100644 node_modules/is-glob/package.json create mode 100644 node_modules/merge2/LICENSE create mode 100644 node_modules/merge2/README.md create mode 100644 node_modules/merge2/index.js create mode 100644 node_modules/merge2/package.json create mode 100755 node_modules/queue-microtask/LICENSE create mode 100644 node_modules/queue-microtask/README.md create mode 100644 node_modules/queue-microtask/index.d.ts create mode 100644 node_modules/queue-microtask/index.js create mode 100644 node_modules/queue-microtask/package.json create mode 100644 node_modules/reusify/.coveralls.yml create mode 100644 node_modules/reusify/.travis.yml create mode 100644 node_modules/reusify/LICENSE create mode 100644 node_modules/reusify/README.md create mode 100644 node_modules/reusify/benchmarks/createNoCodeFunction.js create mode 100644 node_modules/reusify/benchmarks/fib.js create mode 100644 node_modules/reusify/benchmarks/reuseNoCodeFunction.js create mode 100644 node_modules/reusify/package.json create mode 100644 node_modules/reusify/reusify.js create mode 100644 node_modules/reusify/test.js create mode 100644 node_modules/run-parallel/LICENSE create mode 100644 node_modules/run-parallel/README.md create mode 100644 node_modules/run-parallel/index.js create mode 100644 node_modules/run-parallel/package.json diff --git a/lib/main.js b/lib/main.js index 734ef6fe..384e36d1 100644 --- a/lib/main.js +++ b/lib/main.js @@ -114,10 +114,10 @@ function run() { } } else if (releaseFiles.length > 0) { - core.debug(`Finding files ${releaseFiles}`); + core.debug(`Finding files ${releaseFiles.join(',')}`); const files = yield fast_glob_1.default(releaseFiles); if (!files.length) { - core.setFailed(`Unable to find any release file @ ${releaseFiles}`); + core.setFailed(`Unable to find any release file @ ${releaseFiles.join(',')}`); return; } validatedReleaseFiles = files; diff --git a/node_modules/@nodelib/fs.scandir/LICENSE b/node_modules/@nodelib/fs.scandir/LICENSE new file mode 100644 index 00000000..65a99946 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Denis Malinochkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@nodelib/fs.scandir/README.md b/node_modules/@nodelib/fs.scandir/README.md new file mode 100644 index 00000000..e0b218b9 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/README.md @@ -0,0 +1,171 @@ +# @nodelib/fs.scandir + +> List files and directories inside the specified directory. + +## :bulb: Highlights + +The package is aimed at obtaining information about entries in the directory. + +* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). +* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode). +* :link: Can safely work with broken symbolic links. + +## Install + +```console +npm install @nodelib/fs.scandir +``` + +## Usage + +```ts +import * as fsScandir from '@nodelib/fs.scandir'; + +fsScandir.scandir('path', (error, stats) => { /* … */ }); +``` + +## API + +### .scandir(path, [optionsOrSettings], callback) + +Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style. + +```ts +fsScandir.scandir('path', (error, entries) => { /* … */ }); +fsScandir.scandir('path', {}, (error, entries) => { /* … */ }); +fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ }); +``` + +### .scandirSync(path, [optionsOrSettings]) + +Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path. + +```ts +const entries = fsScandir.scandirSync('path'); +const entries = fsScandir.scandirSync('path', {}); +const entries = fsScandir.scandirSync(('path', new fsScandir.Settings()); +``` + +#### path + +* Required: `true` +* Type: `string | Buffer | URL` + +A path to a file. If a URL is provided, it must use the `file:` protocol. + +#### optionsOrSettings + +* Required: `false` +* Type: `Options | Settings` +* Default: An instance of `Settings` class + +An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class. + +> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. + +### Settings([options]) + +A class of full settings of the package. + +```ts +const settings = new fsScandir.Settings({ followSymbolicLinks: false }); + +const entries = fsScandir.scandirSync('path', settings); +``` + +## Entry + +* `name` — The name of the entry (`unknown.txt`). +* `path` — The path of the entry relative to call directory (`root/unknown.txt`). +* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class. +* `stats` (optional) — An instance of `fs.Stats` class. + +For example, the `scandir` call for `tools` directory with one directory inside: + +```ts +{ + dirent: Dirent { name: 'typedoc', /* … */ }, + name: 'typedoc', + path: 'tools/typedoc' +} +``` + +## Options + +### stats + +* Type: `boolean` +* Default: `false` + +Adds an instance of `fs.Stats` class to the [`Entry`](#entry). + +> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO?? + +### followSymbolicLinks + +* Type: `boolean` +* Default: `false` + +Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. + +### `throwErrorOnBrokenSymbolicLink` + +* Type: `boolean` +* Default: `true` + +Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`. + +### `pathSegmentSeparator` + +* Type: `string` +* Default: `path.sep` + +By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. + +### `fs` + +* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) +* Default: A default FS methods + +By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. + +```ts +interface FileSystemAdapter { + lstat?: typeof fs.lstat; + stat?: typeof fs.stat; + lstatSync?: typeof fs.lstatSync; + statSync?: typeof fs.statSync; + readdir?: typeof fs.readdir; + readdirSync?: typeof fs.readdirSync; +} + +const settings = new fsScandir.Settings({ + fs: { lstat: fakeLstat } +}); +``` + +## `old` and `modern` mode + +This package has two modes that are used depending on the environment and parameters of use. + +### old + +* Node.js below `10.10` or when the `stats` option is enabled + +When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links). + +### modern + +* Node.js 10.10+ and the `stats` option is disabled + +In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present. + +This mode makes fewer calls to the file system. It's faster. + +## Changelog + +See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. + +## License + +This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts b/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts new file mode 100644 index 00000000..d0adcb4f --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts @@ -0,0 +1,13 @@ +/// +import * as fs from 'fs'; +export declare type FileSystemAdapter = { + lstat: typeof fs.lstat; + stat: typeof fs.stat; + lstatSync: typeof fs.lstatSync; + statSync: typeof fs.statSync; + readdir: typeof fs.readdir; + readdirSync: typeof fs.readdirSync; +}; +export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; +export declare function createFileSystemAdapter(fsMethods?: Partial): FileSystemAdapter; +//# sourceMappingURL=fs.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts.map b/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts.map new file mode 100644 index 00000000..3cc3d1e8 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/adapters/fs.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,oBAAY,iBAAiB,GAAG;IAC/B,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC;IACvB,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC;IAC7B,OAAO,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC;IAC3B,WAAW,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAOjC,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CASjG"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.js b/node_modules/@nodelib/fs.scandir/out/adapters/fs.js new file mode 100644 index 00000000..a1d16ba9 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/adapters/fs.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; +const fs = require("fs"); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); +} +exports.createFileSystemAdapter = createFileSystemAdapter; diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts b/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts new file mode 100644 index 00000000..2858c4bc --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=fs.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts.map b/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts.map new file mode 100644 index 00000000..8e096bbc --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fs.spec.d.ts","sourceRoot":"","sources":["../../src/adapters/fs.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.js b/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.js new file mode 100644 index 00000000..1b9031e7 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const fs_macchiato_1 = require("../../../fs.macchiato"); +const adapter = require("./fs"); +describe('Adapters → FileSystem', () => { + it('should return original FS methods', () => { + const expected = adapter.FILE_SYSTEM_ADAPTER; + const actual = adapter.createFileSystemAdapter(); + assert.deepStrictEqual(actual, expected); + }); + it('should return custom FS methods', () => { + const customLstatSyncMethod = () => new fs_macchiato_1.Stats(); + const expected = Object.assign(Object.assign({}, adapter.FILE_SYSTEM_ADAPTER), { lstatSync: customLstatSyncMethod }); + const actual = adapter.createFileSystemAdapter({ + lstatSync: customLstatSyncMethod + }); + assert.deepStrictEqual(actual, expected); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/out/constants.d.ts b/node_modules/@nodelib/fs.scandir/out/constants.d.ts new file mode 100644 index 00000000..bb3f4fde --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/constants.d.ts @@ -0,0 +1,5 @@ +/** + * IS `true` for Node.js 10.10 and greater. + */ +export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean; +//# sourceMappingURL=constants.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/constants.d.ts.map b/node_modules/@nodelib/fs.scandir/out/constants.d.ts.map new file mode 100644 index 00000000..a986bb6f --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/constants.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,eAAO,MAAM,kCAAkC,SAAuD,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/constants.js b/node_modules/@nodelib/fs.scandir/out/constants.js new file mode 100644 index 00000000..8b6c8d14 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/constants.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0; +const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); +const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); +const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); +const SUPPORTED_MAJOR_VERSION = 10; +const SUPPORTED_MINOR_VERSION = 10; +const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; +const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; +/** + * IS `true` for Node.js 10.10 and greater. + */ +exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; diff --git a/node_modules/@nodelib/fs.scandir/out/index.d.ts b/node_modules/@nodelib/fs.scandir/out/index.d.ts new file mode 100644 index 00000000..b12b5293 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/index.d.ts @@ -0,0 +1,13 @@ +import { FileSystemAdapter } from './adapters/fs'; +import * as async from './providers/async'; +import Settings, { Options } from './settings'; +import { Dirent, Entry } from './types'; +declare type AsyncCallback = async.AsyncCallback; +declare function scandir(path: string, callback: AsyncCallback): void; +declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +declare namespace scandir { + function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise; +} +declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[]; +export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/index.d.ts.map b/node_modules/@nodelib/fs.scandir/out/index.d.ts.map new file mode 100644 index 00000000..bc4dec0a --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAExC,aAAK,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;AAEzC,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAC9D,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,GAAG,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAWrG,OAAO,WAAW,OAAO,CAAC;IACzB,SAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;CAC/F;AAED,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,EAAE,CAIlF;AAUD,OAAO,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EAIR,aAAa,EACb,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,OAAO,EACP,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/index.js b/node_modules/@nodelib/fs.scandir/out/index.js new file mode 100644 index 00000000..653a5109 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/index.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Settings = exports.scandirSync = exports.scandir = void 0; +const async = require("./providers/async"); +const sync = require("./providers/sync"); +const settings_1 = require("./settings"); +exports.Settings = settings_1.default; +function scandir(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + return async.read(path, getSettings(), optionsOrSettingsOrCallback); + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.scandir = scandir; +function scandirSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.scandirSync = scandirSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} diff --git a/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts b/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts new file mode 100644 index 00000000..4e9d2bbe --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=index.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts.map b/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts.map new file mode 100644 index 00000000..47bd6666 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/index.spec.js b/node_modules/@nodelib/fs.scandir/out/index.spec.js new file mode 100644 index 00000000..09773f6b --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/index.spec.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const fs = require("fs"); +const rimraf = require("rimraf"); +const _1 = require("."); +describe('Package', () => { + before(() => { + rimraf.sync('fixtures'); + fs.mkdirSync('fixtures'); + fs.writeFileSync('fixtures/file.txt', ''); + }); + after(() => { + rimraf.sync('fixtures'); + }); + describe('.scandir', () => { + it('should work without options or settings', (done) => { + _1.scandir('fixtures', (error, entries) => { + assert.strictEqual(error, null); + assert.ok(entries[0].name); + assert.ok(entries[0].path); + assert.ok(entries[0].dirent); + done(); + }); + }); + it('should work with options', (done) => { + _1.scandir('fixtures', { stats: true }, (error, entries) => { + assert.strictEqual(error, null); + assert.ok(entries[0].name); + assert.ok(entries[0].path); + assert.ok(entries[0].dirent); + assert.ok(entries[0].stats); + done(); + }); + }); + it('should work with settings', (done) => { + const settings = new _1.Settings({ stats: true }); + _1.scandir('fixtures', settings, (error, entries) => { + assert.strictEqual(error, null); + assert.ok(entries[0].name); + assert.ok(entries[0].path); + assert.ok(entries[0].dirent); + assert.ok(entries[0].stats); + done(); + }); + }); + }); + describe('.scandirSync', () => { + it('should work without options or settings', () => { + const actual = _1.scandirSync('fixtures'); + assert.ok(actual[0].name); + assert.ok(actual[0].path); + assert.ok(actual[0].dirent); + }); + it('should work with options', () => { + const actual = _1.scandirSync('fixtures', { stats: true }); + assert.ok(actual[0].name); + assert.ok(actual[0].path); + assert.ok(actual[0].dirent); + assert.ok(actual[0].stats); + }); + it('should work with settings', () => { + const settings = new _1.Settings({ stats: true }); + const actual = _1.scandirSync('fixtures', settings); + assert.ok(actual[0].name); + assert.ok(actual[0].path); + assert.ok(actual[0].dirent); + assert.ok(actual[0].stats); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts new file mode 100644 index 00000000..def26de3 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts @@ -0,0 +1,8 @@ +/// +import Settings from '../settings'; +import { Entry } from '../types'; +export declare type AsyncCallback = (err: NodeJS.ErrnoException, entries: Entry[]) => void; +export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void; +export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void; +export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void; +//# sourceMappingURL=async.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts.map b/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts.map new file mode 100644 index 00000000..7f486b5a --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/providers/async.ts"],"names":[],"mappings":";AAIA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAS,MAAM,UAAU,CAAC;AASxC,oBAAY,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;AAEnF,wBAAgB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAMzF;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CA0BzG;AAwBD,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAsC5F"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.js b/node_modules/@nodelib/fs.scandir/out/providers/async.js new file mode 100644 index 00000000..182d1af3 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/async.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; +const fsStat = require("@nodelib/fs.stat"); +const rpl = require("run-parallel"); +const constants_1 = require("../constants"); +const utils = require("../utils"); +const common = require("./common"); +function read(directory, settings, callback) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings, callback); + } + return readdir(directory, settings, callback); +} +exports.read = read; +function readdirWithFileTypes(directory, settings, callback) { + settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { + if (readdirError !== null) { + return callFailureCallback(callback, readdirError); + } + const entries = dirents.map((dirent) => ({ + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + })); + if (!settings.followSymbolicLinks) { + return callSuccessCallback(callback, entries); + } + const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings)); + rpl(tasks, (rplError, rplEntries) => { + if (rplError !== null) { + return callFailureCallback(callback, rplError); + } + callSuccessCallback(callback, rplEntries); + }); + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function makeRplTaskEntry(entry, settings) { + return (done) => { + if (!entry.dirent.isSymbolicLink()) { + return done(null, entry); + } + settings.fs.stat(entry.path, (statError, stats) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + return done(statError); + } + return done(null, entry); + } + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + return done(null, entry); + }); + }; +} +function readdir(directory, settings, callback) { + settings.fs.readdir(directory, (readdirError, names) => { + if (readdirError !== null) { + return callFailureCallback(callback, readdirError); + } + const filepaths = names.map((name) => common.joinPathSegments(directory, name, settings.pathSegmentSeparator)); + const tasks = filepaths.map((filepath) => { + return (done) => fsStat.stat(filepath, settings.fsStatSettings, done); + }); + rpl(tasks, (rplError, results) => { + if (rplError !== null) { + return callFailureCallback(callback, rplError); + } + const entries = []; + names.forEach((name, index) => { + const stats = results[index]; + const entry = { + name, + path: filepaths[index], + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + entries.push(entry); + }); + callSuccessCallback(callback, entries); + }); + }); +} +exports.readdir = readdir; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); +} diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts new file mode 100644 index 00000000..c3f82484 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=async.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts.map b/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts.map new file mode 100644 index 00000000..a67f476b --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.spec.d.ts","sourceRoot":"","sources":["../../src/providers/async.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/async.spec.js b/node_modules/@nodelib/fs.scandir/out/providers/async.spec.js new file mode 100644 index 00000000..b41ad709 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/async.spec.js @@ -0,0 +1,180 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const path = require("path"); +const sinon = require("sinon"); +const fs_macchiato_1 = require("../../../fs.macchiato"); +const constants_1 = require("../constants"); +const settings_1 = require("../settings"); +const provider = require("./async"); +const ROOT_PATH = 'root'; +const FIRST_FILE_PATH = 'first.txt'; +const SECOND_FILE_PATH = 'second.txt'; +const FIRST_ENTRY_PATH = path.join(ROOT_PATH, FIRST_FILE_PATH); +const SECOND_ENTRY_PATH = path.join(ROOT_PATH, SECOND_FILE_PATH); +describe('Providers → Async', () => { + describe('.read', () => { + it('should call correct method based on Node.js version', (done) => { + const readdir = sinon.stub(); + readdir.yields(null, []); + const settings = new settings_1.default({ + fs: { readdir: readdir } + }); + provider.read(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + assert.deepStrictEqual(entries, []); + if (constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + sinon.assert.match(readdir.args, [[ROOT_PATH, { withFileTypes: true }, sinon.match.func]]); + } + else { + sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]); + } + done(); + }); + }); + it('should always use `readdir` method when the `stats` option is enabled', (done) => { + const readdir = sinon.stub(); + readdir.yields(null, []); + const settings = new settings_1.default({ + fs: { readdir: readdir }, + stats: true + }); + provider.read(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + assert.deepStrictEqual(entries, []); + sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]); + done(); + }); + }); + }); + describe('.readdirWithFileTypes', () => { + it('should return entries', (done) => { + const dirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH }); + const readdir = sinon.stub(); + readdir.yields(null, [dirent]); + const settings = new settings_1.default({ + fs: { readdir: readdir } + }); + const expected = [ + { + dirent, + name: FIRST_FILE_PATH, + path: FIRST_ENTRY_PATH + } + ]; + provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + sinon.assert.match(readdir.args, [[ROOT_PATH, { withFileTypes: true }, sinon.match.func]]); + assert.deepStrictEqual(entries, expected); + done(); + }); + }); + it('should call fs.stat for symbolic link when the "followSymbolicLink" option is enabled', (done) => { + const firstDirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH }); + const secondDirent = new fs_macchiato_1.Dirent({ name: SECOND_FILE_PATH, isSymbolicLink: true }); + const stats = new fs_macchiato_1.Stats(); + const readdir = sinon.stub(); + const stat = sinon.stub(); + readdir.yields(null, [firstDirent, secondDirent]); + stat.yields(null, stats); + const settings = new settings_1.default({ + followSymbolicLinks: true, + fs: { + readdir: readdir, + stat: stat + } + }); + provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + assert.strictEqual(entries.length, 2); + assert.ok(!entries[1].dirent.isSymbolicLink()); + sinon.assert.match(stat.args, [[SECOND_ENTRY_PATH, sinon.match.func]]); + done(); + }); + }); + it('should return lstat for broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is disabled', (done) => { + const firstDirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true }); + const readdir = sinon.stub(); + const stat = sinon.stub(); + readdir.yields(null, [firstDirent]); + stat.yields(new Error('error')); + const settings = new settings_1.default({ + followSymbolicLinks: true, + throwErrorOnBrokenSymbolicLink: false, + fs: { + readdir: readdir, + stat: stat + } + }); + provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + assert.strictEqual(entries.length, 1); + assert.ok(entries[0].dirent.isSymbolicLink()); + done(); + }); + }); + it('should throw an error fro broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is enabled', (done) => { + const firstDirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true }); + const readdir = sinon.stub(); + const stat = sinon.stub(); + readdir.yields(null, [firstDirent]); + stat.yields(new Error('error')); + const settings = new settings_1.default({ + followSymbolicLinks: true, + throwErrorOnBrokenSymbolicLink: true, + fs: { + readdir: readdir, + stat: stat + } + }); + provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error.message, 'error'); + assert.strictEqual(entries, undefined); + done(); + }); + }); + }); + describe('.readdir', () => { + it('should return entries', (done) => { + const stats = new fs_macchiato_1.Stats(); + const readdir = sinon.stub(); + const lstat = sinon.stub(); + readdir.yields(null, [FIRST_FILE_PATH]); + lstat.yields(null, stats); + const settings = new settings_1.default({ + fs: { + readdir: readdir, + lstat: lstat + } + }); + provider.readdir(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]); + sinon.assert.match(lstat.args, [[FIRST_ENTRY_PATH, sinon.match.func]]); + assert.strictEqual(entries[0].name, FIRST_FILE_PATH); + assert.strictEqual(entries[0].path, FIRST_ENTRY_PATH); + assert.strictEqual(entries[0].dirent.name, FIRST_FILE_PATH); + done(); + }); + }); + it('should return entries with `stats` property', (done) => { + const stats = new fs_macchiato_1.Stats(); + const readdir = sinon.stub(); + const lstat = sinon.stub(); + readdir.yields(null, [FIRST_FILE_PATH]); + lstat.yields(null, stats); + const settings = new settings_1.default({ + fs: { + readdir: readdir, + lstat: lstat + }, + stats: true + }); + provider.readdir(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + assert.deepStrictEqual(entries[0].stats, stats); + done(); + }); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts new file mode 100644 index 00000000..cbfb4f3b --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts @@ -0,0 +1,2 @@ +export declare function joinPathSegments(a: string, b: string, separator: string): string; +//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts.map b/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts.map new file mode 100644 index 00000000..18decb20 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/providers/common.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAShF"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.js b/node_modules/@nodelib/fs.scandir/out/providers/common.js new file mode 100644 index 00000000..2ce7318f --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/common.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.joinPathSegments = void 0; +function joinPathSegments(a, b, separator) { + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + return a + separator + b; +} +exports.joinPathSegments = joinPathSegments; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts new file mode 100644 index 00000000..c5ccf64b --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=common.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts.map b/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts.map new file mode 100644 index 00000000..693b534a --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"common.spec.d.ts","sourceRoot":"","sources":["../../src/providers/common.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/common.spec.js b/node_modules/@nodelib/fs.scandir/out/providers/common.spec.js new file mode 100644 index 00000000..8990c5aa --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/common.spec.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const common = require("./common"); +describe('Readers → Common', () => { + describe('.joinPathSegments', () => { + it('should return concatenated string', () => { + assert.strictEqual(common.joinPathSegments('.', 'a', '/'), './a'); + }); + it('should return correct string when the first segment ens with the separator symbol', () => { + // Unix + assert.strictEqual(common.joinPathSegments('/', 'a', '/'), '/a'); + assert.strictEqual(common.joinPathSegments('//', 'a', '/'), '//a'); + assert.strictEqual(common.joinPathSegments('/a/', 'b', '/'), '/a/b'); + // Windows + assert.strictEqual(common.joinPathSegments('C:/', 'Users', '/'), 'C:/Users'); + assert.strictEqual(common.joinPathSegments('C:\\', 'Users', '\\'), 'C:\\Users'); + assert.strictEqual(common.joinPathSegments('//?/C:/', 'Users', '/'), '//?/C:/Users'); + assert.strictEqual(common.joinPathSegments('\\\\?\\C:\\', 'Users', '\\'), '\\\\?\\C:\\Users'); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts new file mode 100644 index 00000000..d6ed468c --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts @@ -0,0 +1,6 @@ +import Settings from '../settings'; +import { Entry } from '../types'; +export declare function read(directory: string, settings: Settings): Entry[]; +export declare function readdirWithFileTypes(directory: string, settings: Settings): Entry[]; +export declare function readdir(directory: string, settings: Settings): Entry[]; +//# sourceMappingURL=sync.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts.map b/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts.map new file mode 100644 index 00000000..ba3de162 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/providers/sync.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,wBAAgB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,CAMnE;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,CAwBnF;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,CAmBtE"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.js b/node_modules/@nodelib/fs.scandir/out/providers/sync.js new file mode 100644 index 00000000..1b32e386 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/sync.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readdir = exports.readdirWithFileTypes = exports.read = void 0; +const fsStat = require("@nodelib/fs.stat"); +const constants_1 = require("../constants"); +const utils = require("../utils"); +const common = require("./common"); +function read(directory, settings) { + if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings); + } + return readdir(directory, settings); +} +exports.read = read; +function readdirWithFileTypes(directory, settings) { + const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); + return dirents.map((dirent) => { + const entry = { + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + }; + if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { + try { + const stats = settings.fs.statSync(entry.path); + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + } + catch (error) { + if (settings.throwErrorOnBrokenSymbolicLink) { + throw error; + } + } + } + return entry; + }); +} +exports.readdirWithFileTypes = readdirWithFileTypes; +function readdir(directory, settings) { + const names = settings.fs.readdirSync(directory); + return names.map((name) => { + const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + const stats = fsStat.statSync(entryPath, settings.fsStatSettings); + const entry = { + name, + path: entryPath, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + if (settings.stats) { + entry.stats = stats; + } + return entry; + }); +} +exports.readdir = readdir; diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts b/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts new file mode 100644 index 00000000..5167ab33 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=sync.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts.map b/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts.map new file mode 100644 index 00000000..aae94987 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sync.spec.d.ts","sourceRoot":"","sources":["../../src/providers/sync.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.js b/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.js new file mode 100644 index 00000000..e6e82d47 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.js @@ -0,0 +1,144 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const path = require("path"); +const sinon = require("sinon"); +const fs_macchiato_1 = require("../../../fs.macchiato"); +const constants_1 = require("../constants"); +const settings_1 = require("../settings"); +const provider = require("./sync"); +const ROOT_PATH = 'root'; +const FIRST_FILE_PATH = 'first.txt'; +const SECOND_FILE_PATH = 'second.txt'; +const FIRST_ENTRY_PATH = path.join(ROOT_PATH, FIRST_FILE_PATH); +const SECOND_ENTRY_PATH = path.join(ROOT_PATH, SECOND_FILE_PATH); +describe('Providers → Sync', () => { + describe('.read', () => { + it('should call correct method based on Node.js version', () => { + const readdirSync = sinon.stub().returns([]); + const settings = new settings_1.default({ + fs: { readdirSync: readdirSync } + }); + const actual = provider.read(ROOT_PATH, settings); + assert.deepStrictEqual(actual, []); + if (constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH, { withFileTypes: true }]]); + } + else { + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]); + } + }); + it('should always use `readdir` method when the `stats` option is enabled', () => { + const readdirSync = sinon.stub().returns([]); + const settings = new settings_1.default({ + fs: { readdirSync: readdirSync }, + stats: true + }); + provider.read(ROOT_PATH, settings); + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]); + }); + }); + describe('.readdirWithFileTypes', () => { + it('should return entries', () => { + const dirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH }); + const readdirSync = sinon.stub().returns([dirent]); + const settings = new settings_1.default({ + fs: { readdirSync: readdirSync } + }); + const expected = [ + { + dirent, + name: FIRST_FILE_PATH, + path: FIRST_ENTRY_PATH + } + ]; + const actual = provider.readdirWithFileTypes(ROOT_PATH, settings); + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH, { withFileTypes: true }]]); + assert.deepStrictEqual(actual, expected); + }); + it('should call fs.stat for symbolic link when the "followSymbolicLink" option is enabled', () => { + const firstDirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH }); + const secondDirent = new fs_macchiato_1.Dirent({ name: SECOND_FILE_PATH, isSymbolicLink: true }); + const stats = new fs_macchiato_1.Stats(); + const readdirSync = sinon.stub().returns([firstDirent, secondDirent]); + const statSync = sinon.stub().returns(stats); + const settings = new settings_1.default({ + followSymbolicLinks: true, + fs: { + readdirSync: readdirSync, + statSync: statSync + } + }); + const actual = provider.readdirWithFileTypes(ROOT_PATH, settings); + assert.strictEqual(actual.length, 2); + assert.deepStrictEqual(statSync.args, [[SECOND_ENTRY_PATH]]); + assert.ok(!actual[1].dirent.isSymbolicLink()); + }); + it('should return lstat for broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is disabled', () => { + const dirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true }); + const readdirSync = sinon.stub().returns([dirent]); + const statSync = () => { + throw new Error('error'); + }; + const settings = new settings_1.default({ + followSymbolicLinks: true, + throwErrorOnBrokenSymbolicLink: false, + fs: { + readdirSync: readdirSync, + statSync: statSync + } + }); + const actual = provider.readdirWithFileTypes(ROOT_PATH, settings); + assert.strictEqual(actual.length, 1); + }); + it('should throw an error fro broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is enabled', () => { + const dirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true }); + const readdirSync = sinon.stub().returns([dirent]); + const statSync = () => { + throw new Error('error'); + }; + const settings = new settings_1.default({ + followSymbolicLinks: true, + throwErrorOnBrokenSymbolicLink: true, + fs: { + readdirSync: readdirSync, + statSync: statSync + } + }); + const expectedErrorMessageRe = /Error: error/; + assert.throws(() => provider.readdirWithFileTypes(ROOT_PATH, settings), expectedErrorMessageRe); + }); + }); + describe('.readdir', () => { + it('should return entries', () => { + const stats = new fs_macchiato_1.Stats(); + const readdirSync = sinon.stub().returns([FIRST_FILE_PATH]); + const lstatSync = sinon.stub().returns(stats); + const settings = new settings_1.default({ + fs: { + readdirSync: readdirSync, + lstatSync: lstatSync + } + }); + const actual = provider.readdir(ROOT_PATH, settings); + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]); + assert.strictEqual(actual[0].name, FIRST_FILE_PATH); + assert.strictEqual(actual[0].path, FIRST_ENTRY_PATH); + assert.strictEqual(actual[0].dirent.name, FIRST_FILE_PATH); + }); + it('should return entries with `stats` property', () => { + const stats = new fs_macchiato_1.Stats(); + const readdirSync = sinon.stub().returns([FIRST_FILE_PATH]); + const lstatSync = sinon.stub().returns(stats); + const settings = new settings_1.default({ + fs: { + readdirSync: readdirSync, + lstatSync: lstatSync + }, + stats: true + }); + const actual = provider.readdir(ROOT_PATH, settings); + assert.deepStrictEqual(actual[0].stats, stats); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/out/settings.d.ts b/node_modules/@nodelib/fs.scandir/out/settings.d.ts new file mode 100644 index 00000000..175f7c11 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/settings.d.ts @@ -0,0 +1,21 @@ +import * as fsStat from '@nodelib/fs.stat'; +import * as fs from './adapters/fs'; +export declare type Options = { + followSymbolicLinks?: boolean; + fs?: Partial; + pathSegmentSeparator?: string; + stats?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +}; +export default class Settings { + private readonly _options; + readonly followSymbolicLinks: boolean; + readonly fs: fs.FileSystemAdapter; + readonly pathSegmentSeparator: string; + readonly stats: boolean; + readonly throwErrorOnBrokenSymbolicLink: boolean; + readonly fsStatSettings: fsStat.Settings; + constructor(_options?: Options); + private _getValue; +} +//# sourceMappingURL=settings.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/settings.d.ts.map b/node_modules/@nodelib/fs.scandir/out/settings.d.ts.map new file mode 100644 index 00000000..afc1803f --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/settings.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpC,oBAAY,OAAO,GAAG;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;IACnC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8BAA8B,CAAC,EAAE,OAAO,CAAC;CACzC,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAQ;IAahB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAZrC,SAAgB,mBAAmB,EAAE,OAAO,CAA4D;IACxG,SAAgB,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAgD;IACxF,SAAgB,oBAAoB,EAAE,MAAM,CAAgE;IAC5G,SAAgB,KAAK,EAAE,OAAO,CAA8C;IAC5E,SAAgB,8BAA8B,EAAE,OAAO,CAAsE;IAE7H,SAAgB,cAAc,EAAE,MAAM,CAAC,QAAQ,CAI5C;gBAE0B,QAAQ,GAAE,OAAY;IAEnD,OAAO,CAAC,SAAS;CAGjB"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/settings.js b/node_modules/@nodelib/fs.scandir/out/settings.js new file mode 100644 index 00000000..700d2e94 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/settings.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const fsStat = require("@nodelib/fs.stat"); +const fs = require("./adapters/fs"); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.stats = this._getValue(this._options.stats, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + this.fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports.default = Settings; diff --git a/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts b/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts new file mode 100644 index 00000000..ff5bc0fd --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=settings.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts.map b/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts.map new file mode 100644 index 00000000..b69e1aa7 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.spec.d.ts","sourceRoot":"","sources":["../src/settings.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/settings.spec.js b/node_modules/@nodelib/fs.scandir/out/settings.spec.js new file mode 100644 index 00000000..c5b442a9 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/settings.spec.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const path = require("path"); +const fs_macchiato_1 = require("../../fs.macchiato"); +const fs = require("./adapters/fs"); +const settings_1 = require("./settings"); +describe('Settings', () => { + it('should return instance with default values', () => { + const settings = new settings_1.default(); + assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter()); + assert.ok(!settings.followSymbolicLinks); + assert.ok(!settings.stats); + assert.strictEqual(settings.pathSegmentSeparator, path.sep); + assert.ok(settings.fsStatSettings); + assert.ok(settings.throwErrorOnBrokenSymbolicLink); + }); + it('should return instance with custom values', () => { + const lstatSync = () => new fs_macchiato_1.Stats(); + const settings = new settings_1.default({ + fs: fs.createFileSystemAdapter({ lstatSync }), + stats: true + }); + assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter({ lstatSync })); + assert.ok(settings.stats); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/out/types/index.d.ts b/node_modules/@nodelib/fs.scandir/out/types/index.d.ts new file mode 100644 index 00000000..50e4b8fc --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/types/index.d.ts @@ -0,0 +1,20 @@ +/// +import * as fs from 'fs'; +export declare type Entry = { + dirent: Dirent; + name: string; + path: string; + stats?: Stats; +}; +export declare type Stats = fs.Stats; +export declare type Dirent = { + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isDirectory(): boolean; + isFIFO(): boolean; + isFile(): boolean; + isSocket(): boolean; + isSymbolicLink(): boolean; + name: string; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/types/index.d.ts.map b/node_modules/@nodelib/fs.scandir/out/types/index.d.ts.map new file mode 100644 index 00000000..4147dda4 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/types/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,oBAAY,KAAK,GAAG;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,oBAAY,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;AAE7B,oBAAY,MAAM,GAAG;IACpB,aAAa,IAAI,OAAO,CAAC;IACzB,iBAAiB,IAAI,OAAO,CAAC;IAC7B,WAAW,IAAI,OAAO,CAAC;IACvB,MAAM,IAAI,OAAO,CAAC;IAClB,MAAM,IAAI,OAAO,CAAC;IAClB,QAAQ,IAAI,OAAO,CAAC;IACpB,cAAc,IAAI,OAAO,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACb,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/types/index.js b/node_modules/@nodelib/fs.scandir/out/types/index.js new file mode 100644 index 00000000..ce03781e --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/types/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts b/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts new file mode 100644 index 00000000..8aef0084 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts @@ -0,0 +1,3 @@ +import { Dirent, Stats } from '../types'; +export declare function createDirentFromStats(name: string, stats: Stats): Dirent; +//# sourceMappingURL=fs.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts.map b/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts.map new file mode 100644 index 00000000..57093d77 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAsBzC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAExE"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.js b/node_modules/@nodelib/fs.scandir/out/utils/fs.js new file mode 100644 index 00000000..f15b8cf2 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/fs.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts b/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts new file mode 100644 index 00000000..2858c4bc --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=fs.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts.map b/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts.map new file mode 100644 index 00000000..262a0648 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fs.spec.d.ts","sourceRoot":"","sources":["../../src/utils/fs.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.js b/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.js new file mode 100644 index 00000000..ea8f426f --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const fs_macchiato_1 = require("../../../fs.macchiato"); +const util = require("./fs"); +describe('Utils → FS', () => { + describe('.createDirentFromStats', () => { + it('should convert fs.Stats to fs.Dirent', () => { + const actual = util.createDirentFromStats('name', new fs_macchiato_1.Stats()); + assert.strictEqual(actual.name, 'name'); + assert.ok(!actual.isBlockDevice()); + assert.ok(!actual.isCharacterDevice()); + assert.ok(!actual.isDirectory()); + assert.ok(!actual.isFIFO()); + assert.ok(actual.isFile()); + assert.ok(!actual.isSocket()); + assert.ok(!actual.isSymbolicLink()); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts b/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts new file mode 100644 index 00000000..5ecd8948 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts @@ -0,0 +1,3 @@ +import * as fs from './fs'; +export { fs }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts.map b/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts.map new file mode 100644 index 00000000..2f98e7ec --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAE3B,OAAO,EACN,EAAE,EACF,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.scandir/out/utils/index.js b/node_modules/@nodelib/fs.scandir/out/utils/index.js new file mode 100644 index 00000000..f03f4ade --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/out/utils/index.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +const fs = require("./fs"); +exports.fs = fs; diff --git a/node_modules/@nodelib/fs.scandir/package.json b/node_modules/@nodelib/fs.scandir/package.json new file mode 100644 index 00000000..7441ca43 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/package.json @@ -0,0 +1,67 @@ +{ + "_args": [ + [ + "@nodelib/fs.scandir@2.1.4", + "/workspaces/upload-google-play" + ] + ], + "_from": "@nodelib/fs.scandir@2.1.4", + "_id": "@nodelib/fs.scandir@2.1.4", + "_inBundle": false, + "_integrity": "sha512-33g3pMJk3bg5nXbL/+CY6I2eJDzZAni49PfJnL5fghPTggPvBd/pFNSgJsdAgWptuFu7qq/ERvOYFlhvsLTCKA==", + "_location": "/@nodelib/fs.scandir", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@nodelib/fs.scandir@2.1.4", + "name": "@nodelib/fs.scandir", + "escapedName": "@nodelib%2ffs.scandir", + "scope": "@nodelib", + "rawSpec": "2.1.4", + "saveSpec": null, + "fetchSpec": "2.1.4" + }, + "_requiredBy": [ + "/@nodelib/fs.walk" + ], + "_resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz", + "_spec": "2.1.4", + "_where": "/workspaces/upload-google-play", + "dependencies": { + "@nodelib/fs.stat": "2.0.4", + "run-parallel": "^1.1.9" + }, + "description": "List files and directories inside the specified directory", + "engines": { + "node": ">= 8" + }, + "gitHead": "cb5f7e893a986164c3b847a4f1faef6c54cadd68", + "keywords": [ + "NodeLib", + "fs", + "FileSystem", + "file system", + "scandir", + "readdir", + "dirent" + ], + "license": "MIT", + "main": "out/index.js", + "name": "@nodelib/fs.scandir", + "repository": { + "type": "git", + "url": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir" + }, + "scripts": { + "build": "npm run clean && npm run compile && npm run lint && npm test", + "clean": "rimraf {tsconfig.tsbuildinfo,out}", + "compile": "tsc -b .", + "compile:watch": "tsc -p . --watch --sourceMap", + "lint": "eslint \"src/**/*.ts\" --cache", + "test": "mocha \"out/**/*.spec.js\" -s 0", + "watch": "npm run clean && npm run compile:watch" + }, + "typings": "out/index.d.ts", + "version": "2.1.4" +} diff --git a/node_modules/@nodelib/fs.scandir/src/adapters/fs.spec.ts b/node_modules/@nodelib/fs.scandir/src/adapters/fs.spec.ts new file mode 100644 index 00000000..e274bc03 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/adapters/fs.spec.ts @@ -0,0 +1,31 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; + +import { Stats } from '../../../fs.macchiato'; + +import * as adapter from './fs'; + +describe('Adapters → FileSystem', () => { + it('should return original FS methods', () => { + const expected: adapter.FileSystemAdapter = adapter.FILE_SYSTEM_ADAPTER; + + const actual = adapter.createFileSystemAdapter(); + + assert.deepStrictEqual(actual, expected); + }); + + it('should return custom FS methods', () => { + const customLstatSyncMethod: typeof fs.lstatSync = () => new Stats(); + + const expected: adapter.FileSystemAdapter = { + ...adapter.FILE_SYSTEM_ADAPTER, + lstatSync: customLstatSyncMethod + }; + + const actual = adapter.createFileSystemAdapter({ + lstatSync: customLstatSyncMethod + }); + + assert.deepStrictEqual(actual, expected); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/src/adapters/fs.ts b/node_modules/@nodelib/fs.scandir/src/adapters/fs.ts new file mode 100644 index 00000000..c604fe8a --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/adapters/fs.ts @@ -0,0 +1,30 @@ +import * as fs from 'fs'; + +export type FileSystemAdapter = { + lstat: typeof fs.lstat; + stat: typeof fs.stat; + lstatSync: typeof fs.lstatSync; + statSync: typeof fs.statSync; + readdir: typeof fs.readdir; + readdirSync: typeof fs.readdirSync; +}; + +export const FILE_SYSTEM_ADAPTER: FileSystemAdapter = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; + +export function createFileSystemAdapter(fsMethods?: Partial): FileSystemAdapter { + if (fsMethods === undefined) { + return FILE_SYSTEM_ADAPTER; + } + + return { + ...FILE_SYSTEM_ADAPTER, + ...fsMethods + }; +} diff --git a/node_modules/@nodelib/fs.scandir/src/constants.ts b/node_modules/@nodelib/fs.scandir/src/constants.ts new file mode 100644 index 00000000..6ce0b766 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/constants.ts @@ -0,0 +1,15 @@ +const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.'); + +const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10); +const MINOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[1], 10); + +const SUPPORTED_MAJOR_VERSION = 10; +const SUPPORTED_MINOR_VERSION = 10; + +const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION; +const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION; + +/** + * IS `true` for Node.js 10.10 and greater. + */ +export const IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR; diff --git a/node_modules/@nodelib/fs.scandir/src/index.spec.ts b/node_modules/@nodelib/fs.scandir/src/index.spec.ts new file mode 100644 index 00000000..ff979321 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/index.spec.ts @@ -0,0 +1,85 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; + +import * as rimraf from 'rimraf'; + +import { scandir, scandirSync, Settings } from '.'; + +describe('Package', () => { + before(() => { + rimraf.sync('fixtures'); + + fs.mkdirSync('fixtures'); + fs.writeFileSync('fixtures/file.txt', ''); + }); + + after(() => { + rimraf.sync('fixtures'); + }); + + describe('.scandir', () => { + it('should work without options or settings', (done) => { + scandir('fixtures', (error, entries) => { + assert.strictEqual(error, null); + assert.ok(entries[0].name); + assert.ok(entries[0].path); + assert.ok(entries[0].dirent); + done(); + }); + }); + + it('should work with options', (done) => { + scandir('fixtures', { stats: true }, (error, entries) => { + assert.strictEqual(error, null); + assert.ok(entries[0].name); + assert.ok(entries[0].path); + assert.ok(entries[0].dirent); + assert.ok(entries[0].stats); + done(); + }); + }); + + it('should work with settings', (done) => { + const settings = new Settings({ stats: true }); + + scandir('fixtures', settings, (error, entries) => { + assert.strictEqual(error, null); + assert.ok(entries[0].name); + assert.ok(entries[0].path); + assert.ok(entries[0].dirent); + assert.ok(entries[0].stats); + done(); + }); + }); + }); + + describe('.scandirSync', () => { + it('should work without options or settings', () => { + const actual = scandirSync('fixtures'); + + assert.ok(actual[0].name); + assert.ok(actual[0].path); + assert.ok(actual[0].dirent); + }); + + it('should work with options', () => { + const actual = scandirSync('fixtures', { stats: true }); + + assert.ok(actual[0].name); + assert.ok(actual[0].path); + assert.ok(actual[0].dirent); + assert.ok(actual[0].stats); + }); + + it('should work with settings', () => { + const settings = new Settings({ stats: true }); + + const actual = scandirSync('fixtures', settings); + + assert.ok(actual[0].name); + assert.ok(actual[0].path); + assert.ok(actual[0].dirent); + assert.ok(actual[0].stats); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/src/index.ts b/node_modules/@nodelib/fs.scandir/src/index.ts new file mode 100644 index 00000000..01470407 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/index.ts @@ -0,0 +1,51 @@ +import { FileSystemAdapter } from './adapters/fs'; +import * as async from './providers/async'; +import * as sync from './providers/sync'; +import Settings, { Options } from './settings'; +import { Dirent, Entry } from './types'; + +type AsyncCallback = async.AsyncCallback; + +function scandir(path: string, callback: AsyncCallback): void; +function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +function scandir(path: string, optionsOrSettingsOrCallback: Options | Settings | AsyncCallback, callback?: AsyncCallback): void { + if (typeof optionsOrSettingsOrCallback === 'function') { + return async.read(path, getSettings(), optionsOrSettingsOrCallback); + } + + async.read(path, getSettings(optionsOrSettingsOrCallback), callback as AsyncCallback); +} + +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +declare namespace scandir { + function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise; +} + +function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[] { + const settings = getSettings(optionsOrSettings); + + return sync.read(path, settings); +} + +function getSettings(settingsOrOptions: Settings | Options = {}): Settings { + if (settingsOrOptions instanceof Settings) { + return settingsOrOptions; + } + + return new Settings(settingsOrOptions); +} + +export { + scandir, + scandirSync, + Settings, + + // https://github.com/typescript-eslint/typescript-eslint/issues/131 + // eslint-disable-next-line no-undef + AsyncCallback, + Dirent, + Entry, + FileSystemAdapter, + Options +}; diff --git a/node_modules/@nodelib/fs.scandir/src/providers/async.spec.ts b/node_modules/@nodelib/fs.scandir/src/providers/async.spec.ts new file mode 100644 index 00000000..8861d417 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/providers/async.spec.ts @@ -0,0 +1,236 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as path from 'path'; + +import * as sinon from 'sinon'; + +import { Dirent, Stats } from '../../../fs.macchiato'; +import { IS_SUPPORT_READDIR_WITH_FILE_TYPES } from '../constants'; +import Settings from '../settings'; +import { Entry } from '../types'; +import * as provider from './async'; + +const ROOT_PATH = 'root'; +const FIRST_FILE_PATH = 'first.txt'; +const SECOND_FILE_PATH = 'second.txt'; +const FIRST_ENTRY_PATH = path.join(ROOT_PATH, FIRST_FILE_PATH); +const SECOND_ENTRY_PATH = path.join(ROOT_PATH, SECOND_FILE_PATH); + +describe('Providers → Async', () => { + describe('.read', () => { + it('should call correct method based on Node.js version', (done) => { + const readdir = sinon.stub(); + + readdir.yields(null, []); + + const settings = new Settings({ + fs: { readdir: readdir as unknown as typeof fs.readdir } + }); + + provider.read(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + + assert.deepStrictEqual(entries, []); + + if (IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + sinon.assert.match(readdir.args, [[ROOT_PATH, { withFileTypes: true }, sinon.match.func]]); + } else { + sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]); + } + + done(); + }); + }); + + it('should always use `readdir` method when the `stats` option is enabled', (done) => { + const readdir = sinon.stub(); + + readdir.yields(null, []); + + const settings = new Settings({ + fs: { readdir: readdir as unknown as typeof fs.readdir }, + stats: true + }); + + provider.read(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + + assert.deepStrictEqual(entries, []); + sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]); + + done(); + }); + }); + }); + + describe('.readdirWithFileTypes', () => { + it('should return entries', (done) => { + const dirent = new Dirent({ name: FIRST_FILE_PATH }); + const readdir = sinon.stub(); + + readdir.yields(null, [dirent]); + + const settings = new Settings({ + fs: { readdir: readdir as unknown as typeof fs.readdir } + }); + + const expected: Entry[] = [ + { + dirent, + name: FIRST_FILE_PATH, + path: FIRST_ENTRY_PATH + } + ]; + + provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + + sinon.assert.match(readdir.args, [[ROOT_PATH, { withFileTypes: true }, sinon.match.func]]); + assert.deepStrictEqual(entries, expected); + + done(); + }); + }); + + it('should call fs.stat for symbolic link when the "followSymbolicLink" option is enabled', (done) => { + const firstDirent = new Dirent({ name: FIRST_FILE_PATH }); + const secondDirent = new Dirent({ name: SECOND_FILE_PATH, isSymbolicLink: true }); + const stats = new Stats(); + + const readdir = sinon.stub(); + const stat = sinon.stub(); + + readdir.yields(null, [firstDirent, secondDirent]); + stat.yields(null, stats); + + const settings = new Settings({ + followSymbolicLinks: true, + fs: { + readdir: readdir as unknown as typeof fs.readdir, + stat: stat as unknown as typeof fs.stat + } + }); + + provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + + assert.strictEqual(entries.length, 2); + assert.ok(!entries[1].dirent.isSymbolicLink()); + sinon.assert.match(stat.args, [[SECOND_ENTRY_PATH, sinon.match.func]]); + + done(); + }); + }); + + it('should return lstat for broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is disabled', (done) => { + const firstDirent = new Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true }); + + const readdir = sinon.stub(); + const stat = sinon.stub(); + + readdir.yields(null, [firstDirent]); + stat.yields(new Error('error')); + + const settings = new Settings({ + followSymbolicLinks: true, + throwErrorOnBrokenSymbolicLink: false, + fs: { + readdir: readdir as unknown as typeof fs.readdir, + stat: stat as unknown as typeof fs.stat + } + }); + + provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + + assert.strictEqual(entries.length, 1); + assert.ok(entries[0].dirent.isSymbolicLink()); + + done(); + }); + }); + + it('should throw an error fro broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is enabled', (done) => { + const firstDirent = new Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true }); + + const readdir = sinon.stub(); + const stat = sinon.stub(); + + readdir.yields(null, [firstDirent]); + stat.yields(new Error('error')); + + const settings = new Settings({ + followSymbolicLinks: true, + throwErrorOnBrokenSymbolicLink: true, + fs: { + readdir: readdir as unknown as typeof fs.readdir, + stat: stat as unknown as typeof fs.stat + } + }); + + provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error.message, 'error'); + assert.strictEqual(entries, undefined); + + done(); + }); + }); + }); + + describe('.readdir', () => { + it('should return entries', (done) => { + const stats = new Stats(); + + const readdir = sinon.stub(); + const lstat = sinon.stub(); + + readdir.yields(null, [FIRST_FILE_PATH]); + lstat.yields(null, stats); + + const settings = new Settings({ + fs: { + readdir: readdir as unknown as typeof fs.readdir, + lstat: lstat as unknown as typeof fs.lstat + } + }); + + provider.readdir(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + + sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]); + sinon.assert.match(lstat.args, [[FIRST_ENTRY_PATH, sinon.match.func]]); + + assert.strictEqual(entries[0].name, FIRST_FILE_PATH); + assert.strictEqual(entries[0].path, FIRST_ENTRY_PATH); + assert.strictEqual(entries[0].dirent.name, FIRST_FILE_PATH); + + done(); + }); + }); + + it('should return entries with `stats` property', (done) => { + const stats = new Stats(); + + const readdir = sinon.stub(); + const lstat = sinon.stub(); + + readdir.yields(null, [FIRST_FILE_PATH]); + lstat.yields(null, stats); + + const settings = new Settings({ + fs: { + readdir: readdir as unknown as typeof fs.readdir, + lstat: lstat as unknown as typeof fs.lstat + }, + stats: true + }); + + provider.readdir(ROOT_PATH, settings, (error, entries) => { + assert.strictEqual(error, null); + assert.deepStrictEqual(entries[0].stats, stats); + + done(); + }); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/src/providers/async.ts b/node_modules/@nodelib/fs.scandir/src/providers/async.ts new file mode 100644 index 00000000..1ab93a20 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/providers/async.ts @@ -0,0 +1,121 @@ +import * as fsStat from '@nodelib/fs.stat'; +import * as rpl from 'run-parallel'; + +import { IS_SUPPORT_READDIR_WITH_FILE_TYPES } from '../constants'; +import Settings from '../settings'; +import { Entry, Stats } from '../types'; +import * as utils from '../utils'; +import * as common from './common'; + +type RplTaskStats = rpl.Task; +type RplTaskEntry = rpl.Task; +type FailureCallback = (err: NodeJS.ErrnoException) => void; +type SuccessCallback = (err: null, entries: Entry[]) => void; + +export type AsyncCallback = (err: NodeJS.ErrnoException, entries: Entry[]) => void; + +export function read(directory: string, settings: Settings, callback: AsyncCallback): void { + if (!settings.stats && IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings, callback); + } + + return readdir(directory, settings, callback); +} + +export function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void { + settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => { + if (readdirError !== null) { + return callFailureCallback(callback, readdirError); + } + + const entries: Entry[] = dirents.map((dirent) => ({ + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + })); + + if (!settings.followSymbolicLinks) { + return callSuccessCallback(callback, entries); + } + + const tasks: RplTaskEntry[] = entries.map((entry) => makeRplTaskEntry(entry, settings)); + + rpl(tasks, (rplError: Error | null, rplEntries) => { + if (rplError !== null) { + return callFailureCallback(callback, rplError); + } + + callSuccessCallback(callback, rplEntries); + }); + }); +} + +function makeRplTaskEntry(entry: Entry, settings: Settings): RplTaskEntry { + return (done) => { + if (!entry.dirent.isSymbolicLink()) { + return done(null, entry); + } + + settings.fs.stat(entry.path, (statError, stats) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + return done(statError); + } + + return done(null, entry); + } + + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + + return done(null, entry); + }); + }; +} + +export function readdir(directory: string, settings: Settings, callback: AsyncCallback): void { + settings.fs.readdir(directory, (readdirError, names) => { + if (readdirError !== null) { + return callFailureCallback(callback, readdirError); + } + + const filepaths = names.map((name) => common.joinPathSegments(directory, name, settings.pathSegmentSeparator)); + + const tasks: RplTaskStats[] = filepaths.map((filepath): RplTaskStats => { + return (done) => fsStat.stat(filepath, settings.fsStatSettings, done); + }); + + rpl(tasks, (rplError: Error | null, results) => { + if (rplError !== null) { + return callFailureCallback(callback, rplError); + } + + const entries: Entry[] = []; + + names.forEach((name, index) => { + const stats = results[index]; + + const entry: Entry = { + name, + path: filepaths[index], + dirent: utils.fs.createDirentFromStats(name, stats) + }; + + if (settings.stats) { + entry.stats = stats; + } + + entries.push(entry); + }); + + callSuccessCallback(callback, entries); + }); + }); +} + +function callFailureCallback(callback: AsyncCallback, error: NodeJS.ErrnoException): void { + (callback as FailureCallback)(error); +} + +function callSuccessCallback(callback: AsyncCallback, result: Entry[]): void { + (callback as unknown as SuccessCallback)(null, result); +} diff --git a/node_modules/@nodelib/fs.scandir/src/providers/common.spec.ts b/node_modules/@nodelib/fs.scandir/src/providers/common.spec.ts new file mode 100644 index 00000000..4c4b3986 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/providers/common.spec.ts @@ -0,0 +1,24 @@ +import * as assert from 'assert'; + +import * as common from './common'; + +describe('Readers → Common', () => { + describe('.joinPathSegments', () => { + it('should return concatenated string', () => { + assert.strictEqual(common.joinPathSegments('.', 'a', '/'), './a'); + }); + + it('should return correct string when the first segment ens with the separator symbol', () => { + // Unix + assert.strictEqual(common.joinPathSegments('/', 'a', '/'), '/a'); + assert.strictEqual(common.joinPathSegments('//', 'a', '/'), '//a'); + assert.strictEqual(common.joinPathSegments('/a/', 'b', '/'), '/a/b'); + + // Windows + assert.strictEqual(common.joinPathSegments('C:/', 'Users', '/'), 'C:/Users'); + assert.strictEqual(common.joinPathSegments('C:\\', 'Users', '\\'), 'C:\\Users'); + assert.strictEqual(common.joinPathSegments('//?/C:/', 'Users', '/'), '//?/C:/Users'); + assert.strictEqual(common.joinPathSegments('\\\\?\\C:\\', 'Users', '\\'), '\\\\?\\C:\\Users'); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/src/providers/common.ts b/node_modules/@nodelib/fs.scandir/src/providers/common.ts new file mode 100644 index 00000000..e13e8060 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/providers/common.ts @@ -0,0 +1,10 @@ +export function joinPathSegments(a: string, b: string, separator: string): string { + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + + return a + separator + b; +} diff --git a/node_modules/@nodelib/fs.scandir/src/providers/sync.spec.ts b/node_modules/@nodelib/fs.scandir/src/providers/sync.spec.ts new file mode 100644 index 00000000..4b7f9b4e --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/providers/sync.spec.ts @@ -0,0 +1,186 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as path from 'path'; + +import * as sinon from 'sinon'; + +import { Dirent, Stats } from '../../../fs.macchiato'; +import { IS_SUPPORT_READDIR_WITH_FILE_TYPES } from '../constants'; +import Settings from '../settings'; +import { Entry } from '../types'; +import * as provider from './sync'; + +const ROOT_PATH = 'root'; +const FIRST_FILE_PATH = 'first.txt'; +const SECOND_FILE_PATH = 'second.txt'; +const FIRST_ENTRY_PATH = path.join(ROOT_PATH, FIRST_FILE_PATH); +const SECOND_ENTRY_PATH = path.join(ROOT_PATH, SECOND_FILE_PATH); + +describe('Providers → Sync', () => { + describe('.read', () => { + it('should call correct method based on Node.js version', () => { + const readdirSync = sinon.stub().returns([]); + + const settings = new Settings({ + fs: { readdirSync: readdirSync as unknown as typeof fs.readdirSync } + }); + + const actual = provider.read(ROOT_PATH, settings); + + assert.deepStrictEqual(actual, []); + + if (IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH, { withFileTypes: true }]]); + } else { + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]); + } + }); + + it('should always use `readdir` method when the `stats` option is enabled', () => { + const readdirSync = sinon.stub().returns([]); + + const settings = new Settings({ + fs: { readdirSync: readdirSync as unknown as typeof fs.readdirSync }, + stats: true + }); + + provider.read(ROOT_PATH, settings); + + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]); + }); + }); + + describe('.readdirWithFileTypes', () => { + it('should return entries', () => { + const dirent = new Dirent({ name: FIRST_FILE_PATH }); + const readdirSync = sinon.stub().returns([dirent]); + + const settings = new Settings({ + fs: { readdirSync: readdirSync as unknown as typeof fs.readdirSync } + }); + + const expected: Entry[] = [ + { + dirent, + name: FIRST_FILE_PATH, + path: FIRST_ENTRY_PATH + } + ]; + + const actual = provider.readdirWithFileTypes(ROOT_PATH, settings); + + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH, { withFileTypes: true }]]); + assert.deepStrictEqual(actual, expected); + }); + + it('should call fs.stat for symbolic link when the "followSymbolicLink" option is enabled', () => { + const firstDirent = new Dirent({ name: FIRST_FILE_PATH }); + const secondDirent = new Dirent({ name: SECOND_FILE_PATH, isSymbolicLink: true }); + const stats = new Stats(); + + const readdirSync = sinon.stub().returns([firstDirent, secondDirent]); + const statSync = sinon.stub().returns(stats); + + const settings = new Settings({ + followSymbolicLinks: true, + fs: { + readdirSync: readdirSync as unknown as typeof fs.readdirSync, + statSync: statSync as unknown as typeof fs.statSync + } + }); + + const actual = provider.readdirWithFileTypes(ROOT_PATH, settings); + + assert.strictEqual(actual.length, 2); + assert.deepStrictEqual(statSync.args, [[SECOND_ENTRY_PATH]]); + assert.ok(!actual[1].dirent.isSymbolicLink()); + }); + + it('should return lstat for broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is disabled', () => { + const dirent = new Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true }); + + const readdirSync = sinon.stub().returns([dirent]); + const statSync = (): never => { + throw new Error('error'); + }; + + const settings = new Settings({ + followSymbolicLinks: true, + throwErrorOnBrokenSymbolicLink: false, + fs: { + readdirSync: readdirSync as unknown as typeof fs.readdirSync, + statSync: statSync as unknown as typeof fs.statSync + } + }); + + const actual = provider.readdirWithFileTypes(ROOT_PATH, settings); + + assert.strictEqual(actual.length, 1); + }); + + it('should throw an error fro broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is enabled', () => { + const dirent = new Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true }); + + const readdirSync = sinon.stub().returns([dirent]); + const statSync = (): never => { + throw new Error('error'); + }; + + const settings = new Settings({ + followSymbolicLinks: true, + throwErrorOnBrokenSymbolicLink: true, + fs: { + readdirSync: readdirSync as unknown as typeof fs.readdirSync, + statSync: statSync as unknown as typeof fs.statSync + } + }); + + const expectedErrorMessageRe = /Error: error/; + + assert.throws(() => provider.readdirWithFileTypes(ROOT_PATH, settings), expectedErrorMessageRe); + }); + }); + + describe('.readdir', () => { + it('should return entries', () => { + const stats = new Stats(); + + const readdirSync = sinon.stub().returns([FIRST_FILE_PATH]); + const lstatSync = sinon.stub().returns(stats); + + const settings = new Settings({ + fs: { + readdirSync: readdirSync as unknown as typeof fs.readdirSync, + lstatSync: lstatSync as unknown as typeof fs.lstatSync + } + }); + + const actual = provider.readdir(ROOT_PATH, settings); + + assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]); + + assert.strictEqual(actual[0].name, FIRST_FILE_PATH); + assert.strictEqual(actual[0].path, FIRST_ENTRY_PATH); + assert.strictEqual(actual[0].dirent.name, FIRST_FILE_PATH); + }); + + it('should return entries with `stats` property', () => { + const stats = new Stats(); + + const readdirSync = sinon.stub().returns([FIRST_FILE_PATH]); + const lstatSync = sinon.stub().returns(stats); + + const settings = new Settings({ + fs: { + readdirSync: readdirSync as unknown as typeof fs.readdirSync, + lstatSync: lstatSync as unknown as typeof fs.lstatSync + }, + stats: true + }); + + const actual = provider.readdir(ROOT_PATH, settings); + + assert.deepStrictEqual(actual[0].stats, stats); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/src/providers/sync.ts b/node_modules/@nodelib/fs.scandir/src/providers/sync.ts new file mode 100644 index 00000000..5a15c0f7 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/providers/sync.ts @@ -0,0 +1,62 @@ +import * as fsStat from '@nodelib/fs.stat'; + +import { IS_SUPPORT_READDIR_WITH_FILE_TYPES } from '../constants'; +import Settings from '../settings'; +import { Entry } from '../types'; +import * as utils from '../utils'; +import * as common from './common'; + +export function read(directory: string, settings: Settings): Entry[] { + if (!settings.stats && IS_SUPPORT_READDIR_WITH_FILE_TYPES) { + return readdirWithFileTypes(directory, settings); + } + + return readdir(directory, settings); +} + +export function readdirWithFileTypes(directory: string, settings: Settings): Entry[] { + const dirents = settings.fs.readdirSync(directory, { withFileTypes: true }); + + return dirents.map((dirent) => { + const entry: Entry = { + dirent, + name: dirent.name, + path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator) + }; + + if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) { + try { + const stats = settings.fs.statSync(entry.path); + + entry.dirent = utils.fs.createDirentFromStats(entry.name, stats); + } catch (error) { + if (settings.throwErrorOnBrokenSymbolicLink) { + throw error; + } + } + } + + return entry; + }); +} + +export function readdir(directory: string, settings: Settings): Entry[] { + const names = settings.fs.readdirSync(directory); + + return names.map((name) => { + const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator); + const stats = fsStat.statSync(entryPath, settings.fsStatSettings); + + const entry: Entry = { + name, + path: entryPath, + dirent: utils.fs.createDirentFromStats(name, stats) + }; + + if (settings.stats) { + entry.stats = stats; + } + + return entry; + }); +} diff --git a/node_modules/@nodelib/fs.scandir/src/settings.spec.ts b/node_modules/@nodelib/fs.scandir/src/settings.spec.ts new file mode 100644 index 00000000..5dd9894b --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/settings.spec.ts @@ -0,0 +1,32 @@ +import * as assert from 'assert'; +import * as path from 'path'; + +import { Stats } from '../../fs.macchiato'; + +import * as fs from './adapters/fs'; +import Settings from './settings'; + +describe('Settings', () => { + it('should return instance with default values', () => { + const settings = new Settings(); + + assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter()); + assert.ok(!settings.followSymbolicLinks); + assert.ok(!settings.stats); + assert.strictEqual(settings.pathSegmentSeparator, path.sep); + assert.ok(settings.fsStatSettings); + assert.ok(settings.throwErrorOnBrokenSymbolicLink); + }); + + it('should return instance with custom values', () => { + const lstatSync = (): Stats => new Stats(); + + const settings = new Settings({ + fs: fs.createFileSystemAdapter({ lstatSync }), + stats: true + }); + + assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter({ lstatSync })); + assert.ok(settings.stats); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/src/settings.ts b/node_modules/@nodelib/fs.scandir/src/settings.ts new file mode 100644 index 00000000..7e8dd3bb --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/settings.ts @@ -0,0 +1,33 @@ +import * as path from 'path'; + +import * as fsStat from '@nodelib/fs.stat'; + +import * as fs from './adapters/fs'; + +export type Options = { + followSymbolicLinks?: boolean; + fs?: Partial; + pathSegmentSeparator?: string; + stats?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +}; + +export default class Settings { + public readonly followSymbolicLinks: boolean = this._getValue(this._options.followSymbolicLinks, false); + public readonly fs: fs.FileSystemAdapter = fs.createFileSystemAdapter(this._options.fs); + public readonly pathSegmentSeparator: string = this._getValue(this._options.pathSegmentSeparator, path.sep); + public readonly stats: boolean = this._getValue(this._options.stats, false); + public readonly throwErrorOnBrokenSymbolicLink: boolean = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + + public readonly fsStatSettings: fsStat.Settings = new fsStat.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + + constructor(private readonly _options: Options = {}) { } + + private _getValue(option: T | undefined, value: T): T { + return option ?? value; + } +} diff --git a/node_modules/@nodelib/fs.scandir/src/types/index.ts b/node_modules/@nodelib/fs.scandir/src/types/index.ts new file mode 100644 index 00000000..5a20ffb7 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/types/index.ts @@ -0,0 +1,21 @@ +import * as fs from 'fs'; + +export type Entry = { + dirent: Dirent; + name: string; + path: string; + stats?: Stats; +}; + +export type Stats = fs.Stats; + +export type Dirent = { + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isDirectory(): boolean; + isFIFO(): boolean; + isFile(): boolean; + isSocket(): boolean; + isSymbolicLink(): boolean; + name: string; +}; diff --git a/node_modules/@nodelib/fs.scandir/src/utils/fs.spec.ts b/node_modules/@nodelib/fs.scandir/src/utils/fs.spec.ts new file mode 100644 index 00000000..a47760a4 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/utils/fs.spec.ts @@ -0,0 +1,21 @@ +import * as assert from 'assert'; + +import { Stats } from '../../../fs.macchiato'; +import * as util from './fs'; + +describe('Utils → FS', () => { + describe('.createDirentFromStats', () => { + it('should convert fs.Stats to fs.Dirent', () => { + const actual = util.createDirentFromStats('name', new Stats()); + + assert.strictEqual(actual.name, 'name'); + assert.ok(!actual.isBlockDevice()); + assert.ok(!actual.isCharacterDevice()); + assert.ok(!actual.isDirectory()); + assert.ok(!actual.isFIFO()); + assert.ok(actual.isFile()); + assert.ok(!actual.isSocket()); + assert.ok(!actual.isSymbolicLink()); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.scandir/src/utils/fs.ts b/node_modules/@nodelib/fs.scandir/src/utils/fs.ts new file mode 100644 index 00000000..645f4a36 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/utils/fs.ts @@ -0,0 +1,27 @@ +import * as fs from 'fs'; + +import { Dirent, Stats } from '../types'; + +class DirentFromStats implements fs.Dirent { + public isBlockDevice: Stats['isBlockDevice']; + public isCharacterDevice: Stats['isCharacterDevice']; + public isDirectory: Stats['isDirectory']; + public isFIFO: Stats['isFIFO']; + public isFile: Stats['isFile']; + public isSocket: Stats['isSocket']; + public isSymbolicLink: Stats['isSymbolicLink']; + + constructor(public name: string, stats: Stats) { + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} + +export function createDirentFromStats(name: string, stats: Stats): Dirent { + return new DirentFromStats(name, stats); +} diff --git a/node_modules/@nodelib/fs.scandir/src/utils/index.ts b/node_modules/@nodelib/fs.scandir/src/utils/index.ts new file mode 100644 index 00000000..6fa8f6de --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/src/utils/index.ts @@ -0,0 +1,5 @@ +import * as fs from './fs'; + +export { + fs +}; diff --git a/node_modules/@nodelib/fs.scandir/tsconfig.json b/node_modules/@nodelib/fs.scandir/tsconfig.json new file mode 100644 index 00000000..11e723f0 --- /dev/null +++ b/node_modules/@nodelib/fs.scandir/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "out" + }, + "references": [ + { + "path": "../fs.macchiato" + }, + { + "path": "../fs.stat" + } + ] +} diff --git a/node_modules/@nodelib/fs.stat/LICENSE b/node_modules/@nodelib/fs.stat/LICENSE new file mode 100644 index 00000000..65a99946 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Denis Malinochkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@nodelib/fs.stat/README.md b/node_modules/@nodelib/fs.stat/README.md new file mode 100644 index 00000000..686f0471 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/README.md @@ -0,0 +1,126 @@ +# @nodelib/fs.stat + +> Get the status of a file with some features. + +## :bulb: Highlights + +Wrapper around standard method `fs.lstat` and `fs.stat` with some features. + +* :beginner: Normally follows symbolic link. +* :gear: Can safely work with broken symbolic link. + +## Install + +```console +npm install @nodelib/fs.stat +``` + +## Usage + +```ts +import * as fsStat from '@nodelib/fs.stat'; + +fsStat.stat('path', (error, stats) => { /* … */ }); +``` + +## API + +### .stat(path, [optionsOrSettings], callback) + +Returns an instance of `fs.Stats` class for provided path with standard callback-style. + +```ts +fsStat.stat('path', (error, stats) => { /* … */ }); +fsStat.stat('path', {}, (error, stats) => { /* … */ }); +fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ }); +``` + +### .statSync(path, [optionsOrSettings]) + +Returns an instance of `fs.Stats` class for provided path. + +```ts +const stats = fsStat.stat('path'); +const stats = fsStat.stat('path', {}); +const stats = fsStat.stat('path', new fsStat.Settings()); +``` + +#### path + +* Required: `true` +* Type: `string | Buffer | URL` + +A path to a file. If a URL is provided, it must use the `file:` protocol. + +#### optionsOrSettings + +* Required: `false` +* Type: `Options | Settings` +* Default: An instance of `Settings` class + +An [`Options`](#options) object or an instance of [`Settings`](#settings) class. + +> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. + +### Settings([options]) + +A class of full settings of the package. + +```ts +const settings = new fsStat.Settings({ followSymbolicLink: false }); + +const stats = fsStat.stat('path', settings); +``` + +## Options + +### `followSymbolicLink` + +* Type: `boolean` +* Default: `true` + +Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`. + +### `markSymbolicLink` + +* Type: `boolean` +* Default: `false` + +Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`). + +> :book: Can be used if you want to know what is hidden behind a symbolic link, but still continue to know that it is a symbolic link. + +### `throwErrorOnBrokenSymbolicLink` + +* Type: `boolean` +* Default: `true` + +Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. + +### `fs` + +* Type: [`FileSystemAdapter`](./src/adapters/fs.ts) +* Default: A default FS methods + +By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. + +```ts +interface FileSystemAdapter { + lstat?: typeof fs.lstat; + stat?: typeof fs.stat; + lstatSync?: typeof fs.lstatSync; + statSync?: typeof fs.statSync; +} + +const settings = new fsStat.Settings({ + fs: { lstat: fakeLstat } +}); +``` + +## Changelog + +See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. + +## License + +This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts new file mode 100644 index 00000000..d17b356b --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts @@ -0,0 +1,11 @@ +/// +import * as fs from 'fs'; +export declare type FileSystemAdapter = { + lstat: typeof fs.lstat; + stat: typeof fs.stat; + lstatSync: typeof fs.lstatSync; + statSync: typeof fs.statSync; +}; +export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter; +export declare function createFileSystemAdapter(fsMethods?: Partial): FileSystemAdapter; +//# sourceMappingURL=fs.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts.map b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts.map new file mode 100644 index 00000000..d84a447a --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/adapters/fs.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,oBAAY,iBAAiB,GAAG;IAC/B,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC;IACvB,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAKjC,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CASjG"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.js b/node_modules/@nodelib/fs.stat/out/adapters/fs.js new file mode 100644 index 00000000..c000ee9b --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0; +const fs = require("fs"); +exports.FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync +}; +function createFileSystemAdapter(fsMethods) { + if (fsMethods === undefined) { + return exports.FILE_SYSTEM_ADAPTER; + } + return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods); +} +exports.createFileSystemAdapter = createFileSystemAdapter; diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts b/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts new file mode 100644 index 00000000..2858c4bc --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=fs.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts.map b/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts.map new file mode 100644 index 00000000..8e096bbc --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fs.spec.d.ts","sourceRoot":"","sources":["../../src/adapters/fs.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.js b/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.js new file mode 100644 index 00000000..1b9031e7 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const fs_macchiato_1 = require("../../../fs.macchiato"); +const adapter = require("./fs"); +describe('Adapters → FileSystem', () => { + it('should return original FS methods', () => { + const expected = adapter.FILE_SYSTEM_ADAPTER; + const actual = adapter.createFileSystemAdapter(); + assert.deepStrictEqual(actual, expected); + }); + it('should return custom FS methods', () => { + const customLstatSyncMethod = () => new fs_macchiato_1.Stats(); + const expected = Object.assign(Object.assign({}, adapter.FILE_SYSTEM_ADAPTER), { lstatSync: customLstatSyncMethod }); + const actual = adapter.createFileSystemAdapter({ + lstatSync: customLstatSyncMethod + }); + assert.deepStrictEqual(actual, expected); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/out/index.d.ts b/node_modules/@nodelib/fs.stat/out/index.d.ts new file mode 100644 index 00000000..5f092f9c --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/index.d.ts @@ -0,0 +1,13 @@ +import { FileSystemAdapter } from './adapters/fs'; +import * as async from './providers/async'; +import Settings, { Options } from './settings'; +import { Stats } from './types'; +declare type AsyncCallback = async.AsyncCallback; +declare function stat(path: string, callback: AsyncCallback): void; +declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +declare namespace stat { + function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise; +} +declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats; +export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, Options, Stats }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/index.d.ts.map b/node_modules/@nodelib/fs.stat/out/index.d.ts.map new file mode 100644 index 00000000..e07ff1ac --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,aAAK,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;AAEzC,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAC3D,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,GAAG,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAWlG,OAAO,WAAW,IAAI,CAAC;IACtB,SAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC7F;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAI7E;AAUD,OAAO,EACN,QAAQ,EACR,IAAI,EACJ,QAAQ,EAIR,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,KAAK,EACL,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/index.js b/node_modules/@nodelib/fs.stat/out/index.js new file mode 100644 index 00000000..9808b5a9 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/index.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.statSync = exports.stat = exports.Settings = void 0; +const async = require("./providers/async"); +const sync = require("./providers/sync"); +const settings_1 = require("./settings"); +exports.Settings = settings_1.default; +function stat(path, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + return async.read(path, getSettings(), optionsOrSettingsOrCallback); + } + async.read(path, getSettings(optionsOrSettingsOrCallback), callback); +} +exports.stat = stat; +function statSync(path, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + return sync.read(path, settings); +} +exports.statSync = statSync; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} diff --git a/node_modules/@nodelib/fs.stat/out/index.spec.d.ts b/node_modules/@nodelib/fs.stat/out/index.spec.d.ts new file mode 100644 index 00000000..4e9d2bbe --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/index.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=index.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/index.spec.d.ts.map b/node_modules/@nodelib/fs.stat/out/index.spec.d.ts.map new file mode 100644 index 00000000..47bd6666 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/index.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/index.spec.js b/node_modules/@nodelib/fs.stat/out/index.spec.js new file mode 100644 index 00000000..941ec3ee --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/index.spec.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const fs = require("fs"); +const rimraf = require("rimraf"); +const _1 = require("."); +describe('Package', () => { + before(() => { + rimraf.sync('fixtures'); + fs.mkdirSync('fixtures'); + fs.mkdirSync('fixtures/a'); + fs.symlinkSync('a', 'fixtures/b', 'junction'); + }); + after(() => { + rimraf.sync('fixtures'); + }); + describe('.stat', () => { + it('should work without options or settings', (done) => { + _1.stat('fixtures/b', (error, stats) => { + assert.strictEqual(error, null); + assert.ok(stats); + done(); + }); + }); + it('should work with options', (done) => { + _1.stat('fixtures/b', { markSymbolicLink: true }, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.isSymbolicLink(), true); + done(); + }); + }); + it('should work with settings', (done) => { + const settings = new _1.Settings({ markSymbolicLink: true }); + _1.stat('fixtures/b', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.isSymbolicLink(), true); + done(); + }); + }); + }); + describe('.statSync', () => { + it('should work without options or settings', () => { + const actual = _1.statSync('fixtures/b'); + assert.ok(actual); + }); + it('should work with options', () => { + const actual = _1.statSync('fixtures/b', { markSymbolicLink: true }); + assert.strictEqual(actual.isSymbolicLink(), true); + }); + it('should work with settings', () => { + const settings = new _1.Settings({ markSymbolicLink: true }); + const actual = _1.statSync('fixtures/b', settings); + assert.strictEqual(actual.isSymbolicLink(), true); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.d.ts b/node_modules/@nodelib/fs.stat/out/providers/async.d.ts new file mode 100644 index 00000000..a9637c55 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/async.d.ts @@ -0,0 +1,5 @@ +import Settings from '../settings'; +import { ErrnoException, Stats } from '../types'; +export declare type AsyncCallback = (err: ErrnoException, stats: Stats) => void; +export declare function read(path: string, settings: Settings, callback: AsyncCallback): void; +//# sourceMappingURL=async.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.d.ts.map b/node_modules/@nodelib/fs.stat/out/providers/async.d.ts.map new file mode 100644 index 00000000..2a50cf6e --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/async.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/providers/async.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjD,oBAAY,aAAa,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAExE,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CA0BpF"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.js b/node_modules/@nodelib/fs.stat/out/providers/async.js new file mode 100644 index 00000000..6235ea98 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/async.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.read = void 0; +function read(path, settings, callback) { + settings.fs.lstat(path, (lstatError, lstat) => { + if (lstatError !== null) { + return callFailureCallback(callback, lstatError); + } + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return callSuccessCallback(callback, lstat); + } + settings.fs.stat(path, (statError, stat) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + return callFailureCallback(callback, statError); + } + return callSuccessCallback(callback, lstat); + } + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + callSuccessCallback(callback, stat); + }); + }); +} +exports.read = read; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, result) { + callback(null, result); +} diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts b/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts new file mode 100644 index 00000000..c3f82484 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=async.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts.map b/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts.map new file mode 100644 index 00000000..a67f476b --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.spec.d.ts","sourceRoot":"","sources":["../../src/providers/async.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/providers/async.spec.js b/node_modules/@nodelib/fs.stat/out/providers/async.spec.js new file mode 100644 index 00000000..ead04b53 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/async.spec.js @@ -0,0 +1,83 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const sinon = require("sinon"); +const fs_macchiato_1 = require("../../../fs.macchiato"); +const settings_1 = require("../settings"); +const provider = require("./async"); +describe('Providers → Async', () => { + describe('.read', () => { + it('should return lstat for non-symlink entry', (done) => { + const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats()); + const settings = new settings_1.default({ + fs: { lstat } + }); + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.ino, 0); + done(); + }); + }); + it('should return lstat for symlink entry when the "followSymbolicLink" option is disabled', (done) => { + const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const settings = new settings_1.default({ + followSymbolicLink: false, + fs: { lstat } + }); + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.ino, 0); + done(); + }); + }); + it('should return stat for symlink entry', (done) => { + const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const stat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ ino: 1 })); + const settings = new settings_1.default({ + fs: { lstat, stat } + }); + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.ino, 1); + done(); + }); + }); + it('should return marked stat for symlink entry when the "markSymbolicLink" option is enabled', (done) => { + const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const stat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ ino: 1 })); + const settings = new settings_1.default({ + fs: { lstat, stat }, + markSymbolicLink: true + }); + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.isSymbolicLink(), true); + done(); + }); + }); + it('should return lstat for broken symlink entry when the "throwErrorOnBrokenSymbolicLink" option is disabled', (done) => { + const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const stat = sinon.stub().yields(new Error()); + const settings = new settings_1.default({ + fs: { lstat, stat }, + throwErrorOnBrokenSymbolicLink: false + }); + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.ino, 0); + done(); + }); + }); + it('should throw an error when symlink entry is broken', (done) => { + const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const stat = sinon.stub().yields(new Error('broken')); + const settings = new settings_1.default({ + fs: { lstat, stat } + }); + provider.read('filepath', settings, (error) => { + assert.strictEqual(error.message, 'broken'); + done(); + }); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts b/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts new file mode 100644 index 00000000..f4c1d78d --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts @@ -0,0 +1,4 @@ +import Settings from '../settings'; +import { Stats } from '../types'; +export declare function read(path: string, settings: Settings): Stats; +//# sourceMappingURL=sync.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts.map b/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts.map new file mode 100644 index 00000000..4f4eb438 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/providers/sync.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAsB5D"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.js b/node_modules/@nodelib/fs.stat/out/providers/sync.js new file mode 100644 index 00000000..d478e1f3 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/sync.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.read = void 0; +function read(path, settings) { + const lstat = settings.fs.lstatSync(path); + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return lstat; + } + try { + const stat = settings.fs.statSync(path); + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + return stat; + } + catch (error) { + if (!settings.throwErrorOnBrokenSymbolicLink) { + return lstat; + } + throw error; + } +} +exports.read = read; diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts b/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts new file mode 100644 index 00000000..5167ab33 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=sync.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts.map b/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts.map new file mode 100644 index 00000000..aae94987 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sync.spec.d.ts","sourceRoot":"","sources":["../../src/providers/sync.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/providers/sync.spec.js b/node_modules/@nodelib/fs.stat/out/providers/sync.spec.js new file mode 100644 index 00000000..99e34b9d --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/providers/sync.spec.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const sinon = require("sinon"); +const fs_macchiato_1 = require("../../../fs.macchiato"); +const settings_1 = require("../settings"); +const provider = require("./sync"); +describe('Providers → Sync', () => { + describe('.read', () => { + it('should return lstat for non-symlink entry', () => { + const lstatSync = sinon.stub().returns(new fs_macchiato_1.Stats()); + const settings = new settings_1.default({ + fs: { lstatSync } + }); + const actual = provider.read('filepath', settings); + assert.strictEqual(actual.ino, 0); + }); + it('should return lstat for symlink entry when the "followSymbolicLink" option is disabled', () => { + const lstatSync = sinon.stub().returns(new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const settings = new settings_1.default({ + followSymbolicLink: false, + fs: { lstatSync } + }); + const actual = provider.read('filepath', settings); + assert.strictEqual(actual.ino, 0); + }); + it('should return stat for symlink entry', () => { + const lstatSync = sinon.stub().returns(new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const statSync = sinon.stub().returns(new fs_macchiato_1.Stats({ ino: 1 })); + const settings = new settings_1.default({ + fs: { lstatSync, statSync } + }); + const actual = provider.read('filepath', settings); + assert.strictEqual(actual.ino, 1); + }); + it('should return marked stat for symlink entry when the "markSymbolicLink" option is enabled', () => { + const lstatSync = sinon.stub().returns(new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const statSync = sinon.stub().returns(new fs_macchiato_1.Stats({ ino: 1 })); + const settings = new settings_1.default({ + markSymbolicLink: true, + fs: { lstatSync, statSync } + }); + const actual = provider.read('filepath', settings); + assert.strictEqual(actual.isSymbolicLink(), true); + }); + it('should return lstat for broken symlink entry when the "throwErrorOnBrokenSymbolicLink" option is disabled', () => { + const lstatSync = sinon.stub().returns(new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const statSync = sinon.stub().throws(new Error('error')); + const settings = new settings_1.default({ + fs: { lstatSync, statSync }, + throwErrorOnBrokenSymbolicLink: false + }); + const actual = provider.read('filepath', settings); + assert.strictEqual(actual.ino, 0); + }); + it('should throw an error when symlink entry is broken', () => { + const lstatSync = sinon.stub().returns(new fs_macchiato_1.Stats({ isSymbolicLink: true })); + const statSync = sinon.stub().throws(new Error('broken')); + const settings = new settings_1.default({ + fs: { lstatSync, statSync } + }); + const expectedErrorMessageRe = /broken/; + assert.throws(() => provider.read('filepath', settings), expectedErrorMessageRe); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/out/settings.d.ts b/node_modules/@nodelib/fs.stat/out/settings.d.ts new file mode 100644 index 00000000..34c46206 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/settings.d.ts @@ -0,0 +1,17 @@ +import * as fs from './adapters/fs'; +export declare type Options = { + followSymbolicLink?: boolean; + fs?: Partial; + markSymbolicLink?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +}; +export default class Settings { + private readonly _options; + readonly followSymbolicLink: boolean; + readonly fs: fs.FileSystemAdapter; + readonly markSymbolicLink: boolean; + readonly throwErrorOnBrokenSymbolicLink: boolean; + constructor(_options?: Options); + private _getValue; +} +//# sourceMappingURL=settings.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/settings.d.ts.map b/node_modules/@nodelib/fs.stat/out/settings.d.ts.map new file mode 100644 index 00000000..e98652ce --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/settings.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpC,oBAAY,OAAO,GAAG;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8BAA8B,CAAC,EAAE,OAAO,CAAC;CACzC,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAQ;IAMhB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IALrC,SAAgB,kBAAkB,EAAE,OAAO,CAA0D;IACrG,SAAgB,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAgD;IACxF,SAAgB,gBAAgB,EAAE,OAAO,CAAyD;IAClG,SAAgB,8BAA8B,EAAE,OAAO,CAAsE;gBAEhG,QAAQ,GAAE,OAAY;IAEnD,OAAO,CAAC,SAAS;CAGjB"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/settings.js b/node_modules/@nodelib/fs.stat/out/settings.js new file mode 100644 index 00000000..18fa816c --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/settings.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs = require("./adapters/fs"); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports.default = Settings; diff --git a/node_modules/@nodelib/fs.stat/out/settings.spec.d.ts b/node_modules/@nodelib/fs.stat/out/settings.spec.d.ts new file mode 100644 index 00000000..ff5bc0fd --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/settings.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=settings.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/settings.spec.d.ts.map b/node_modules/@nodelib/fs.stat/out/settings.spec.d.ts.map new file mode 100644 index 00000000..b69e1aa7 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/settings.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.spec.d.ts","sourceRoot":"","sources":["../src/settings.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/settings.spec.js b/node_modules/@nodelib/fs.stat/out/settings.spec.js new file mode 100644 index 00000000..14489ee2 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/settings.spec.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const fs_macchiato_1 = require("../../fs.macchiato"); +const fs = require("./adapters/fs"); +const settings_1 = require("./settings"); +describe('Settings', () => { + it('should return instance with default values', () => { + const settings = new settings_1.default(); + assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter()); + assert.ok(settings.throwErrorOnBrokenSymbolicLink); + assert.ok(!settings.markSymbolicLink); + assert.ok(settings.followSymbolicLink); + }); + it('should return instance with custom values', () => { + const lstatSync = () => new fs_macchiato_1.Stats(); + const settings = new settings_1.default({ + followSymbolicLink: false, + fs: fs.createFileSystemAdapter({ lstatSync }), + throwErrorOnBrokenSymbolicLink: false + }); + assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter({ lstatSync })); + assert.ok(!settings.throwErrorOnBrokenSymbolicLink); + assert.ok(!settings.followSymbolicLink); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/out/types/index.d.ts b/node_modules/@nodelib/fs.stat/out/types/index.d.ts new file mode 100644 index 00000000..227f7bf8 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/types/index.d.ts @@ -0,0 +1,5 @@ +/// +import * as fs from 'fs'; +export declare type Stats = fs.Stats; +export declare type ErrnoException = NodeJS.ErrnoException; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/types/index.d.ts.map b/node_modules/@nodelib/fs.stat/out/types/index.d.ts.map new file mode 100644 index 00000000..9c0ca100 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/types/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,oBAAY,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;AAC7B,oBAAY,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.stat/out/types/index.js b/node_modules/@nodelib/fs.stat/out/types/index.js new file mode 100644 index 00000000..ce03781e --- /dev/null +++ b/node_modules/@nodelib/fs.stat/out/types/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.stat/package.json b/node_modules/@nodelib/fs.stat/package.json new file mode 100644 index 00000000..16666f5f --- /dev/null +++ b/node_modules/@nodelib/fs.stat/package.json @@ -0,0 +1,62 @@ +{ + "_args": [ + [ + "@nodelib/fs.stat@2.0.4", + "/workspaces/upload-google-play" + ] + ], + "_from": "@nodelib/fs.stat@2.0.4", + "_id": "@nodelib/fs.stat@2.0.4", + "_inBundle": false, + "_integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "_location": "/@nodelib/fs.stat", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@nodelib/fs.stat@2.0.4", + "name": "@nodelib/fs.stat", + "escapedName": "@nodelib%2ffs.stat", + "scope": "@nodelib", + "rawSpec": "2.0.4", + "saveSpec": null, + "fetchSpec": "2.0.4" + }, + "_requiredBy": [ + "/@nodelib/fs.scandir", + "/fast-glob" + ], + "_resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "_spec": "2.0.4", + "_where": "/workspaces/upload-google-play", + "description": "Get the status of a file with some features", + "engines": { + "node": ">= 8" + }, + "gitHead": "cb5f7e893a986164c3b847a4f1faef6c54cadd68", + "keywords": [ + "NodeLib", + "fs", + "FileSystem", + "file system", + "stat" + ], + "license": "MIT", + "main": "out/index.js", + "name": "@nodelib/fs.stat", + "repository": { + "type": "git", + "url": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat" + }, + "scripts": { + "build": "npm run clean && npm run compile && npm run lint && npm test", + "clean": "rimraf {tsconfig.tsbuildinfo,out}", + "compile": "tsc -b .", + "compile:watch": "tsc -p . --watch --sourceMap", + "lint": "eslint \"src/**/*.ts\" --cache", + "test": "mocha \"out/**/*.spec.js\" -s 0", + "watch": "npm run clean && npm run compile:watch" + }, + "typings": "out/index.d.ts", + "version": "2.0.4" +} diff --git a/node_modules/@nodelib/fs.stat/src/adapters/fs.spec.ts b/node_modules/@nodelib/fs.stat/src/adapters/fs.spec.ts new file mode 100644 index 00000000..e274bc03 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/adapters/fs.spec.ts @@ -0,0 +1,31 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; + +import { Stats } from '../../../fs.macchiato'; + +import * as adapter from './fs'; + +describe('Adapters → FileSystem', () => { + it('should return original FS methods', () => { + const expected: adapter.FileSystemAdapter = adapter.FILE_SYSTEM_ADAPTER; + + const actual = adapter.createFileSystemAdapter(); + + assert.deepStrictEqual(actual, expected); + }); + + it('should return custom FS methods', () => { + const customLstatSyncMethod: typeof fs.lstatSync = () => new Stats(); + + const expected: adapter.FileSystemAdapter = { + ...adapter.FILE_SYSTEM_ADAPTER, + lstatSync: customLstatSyncMethod + }; + + const actual = adapter.createFileSystemAdapter({ + lstatSync: customLstatSyncMethod + }); + + assert.deepStrictEqual(actual, expected); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/src/adapters/fs.ts b/node_modules/@nodelib/fs.stat/src/adapters/fs.ts new file mode 100644 index 00000000..7f31cbb6 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/adapters/fs.ts @@ -0,0 +1,26 @@ +import * as fs from 'fs'; + +export type FileSystemAdapter = { + lstat: typeof fs.lstat; + stat: typeof fs.stat; + lstatSync: typeof fs.lstatSync; + statSync: typeof fs.statSync; +}; + +export const FILE_SYSTEM_ADAPTER: FileSystemAdapter = { + lstat: fs.lstat, + stat: fs.stat, + lstatSync: fs.lstatSync, + statSync: fs.statSync +}; + +export function createFileSystemAdapter(fsMethods?: Partial): FileSystemAdapter { + if (fsMethods === undefined) { + return FILE_SYSTEM_ADAPTER; + } + + return { + ...FILE_SYSTEM_ADAPTER, + ...fsMethods + }; +} diff --git a/node_modules/@nodelib/fs.stat/src/index.spec.ts b/node_modules/@nodelib/fs.stat/src/index.spec.ts new file mode 100644 index 00000000..7affed90 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/index.spec.ts @@ -0,0 +1,70 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; + +import * as rimraf from 'rimraf'; + +import { stat, statSync, Settings } from '.'; + +describe('Package', () => { + before(() => { + rimraf.sync('fixtures'); + + fs.mkdirSync('fixtures'); + fs.mkdirSync('fixtures/a'); + fs.symlinkSync('a', 'fixtures/b', 'junction'); + }); + + after(() => { + rimraf.sync('fixtures'); + }); + + describe('.stat', () => { + it('should work without options or settings', (done) => { + stat('fixtures/b', (error, stats) => { + assert.strictEqual(error, null); + assert.ok(stats); + done(); + }); + }); + + it('should work with options', (done) => { + stat('fixtures/b', { markSymbolicLink: true }, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.isSymbolicLink(), true); + done(); + }); + }); + + it('should work with settings', (done) => { + const settings = new Settings({ markSymbolicLink: true }); + + stat('fixtures/b', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.isSymbolicLink(), true); + done(); + }); + }); + }); + + describe('.statSync', () => { + it('should work without options or settings', () => { + const actual = statSync('fixtures/b'); + + assert.ok(actual); + }); + + it('should work with options', () => { + const actual = statSync('fixtures/b', { markSymbolicLink: true }); + + assert.strictEqual(actual.isSymbolicLink(), true); + }); + + it('should work with settings', () => { + const settings = new Settings({ markSymbolicLink: true }); + + const actual = statSync('fixtures/b', settings); + + assert.strictEqual(actual.isSymbolicLink(), true); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/src/index.ts b/node_modules/@nodelib/fs.stat/src/index.ts new file mode 100644 index 00000000..992f7216 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/index.ts @@ -0,0 +1,50 @@ +import { FileSystemAdapter } from './adapters/fs'; +import * as async from './providers/async'; +import * as sync from './providers/sync'; +import Settings, { Options } from './settings'; +import { Stats } from './types'; + +type AsyncCallback = async.AsyncCallback; + +function stat(path: string, callback: AsyncCallback): void; +function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +function stat(path: string, optionsOrSettingsOrCallback: Options | Settings | AsyncCallback, callback?: AsyncCallback): void { + if (typeof optionsOrSettingsOrCallback === 'function') { + return async.read(path, getSettings(), optionsOrSettingsOrCallback); + } + + async.read(path, getSettings(optionsOrSettingsOrCallback), callback as AsyncCallback); +} + +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +declare namespace stat { + function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise; +} + +function statSync(path: string, optionsOrSettings?: Options | Settings): Stats { + const settings = getSettings(optionsOrSettings); + + return sync.read(path, settings); +} + +function getSettings(settingsOrOptions: Settings | Options = {}): Settings { + if (settingsOrOptions instanceof Settings) { + return settingsOrOptions; + } + + return new Settings(settingsOrOptions); +} + +export { + Settings, + stat, + statSync, + + // https://github.com/typescript-eslint/typescript-eslint/issues/131 + // eslint-disable-next-line no-undef + AsyncCallback, + FileSystemAdapter, + Options, + Stats +}; diff --git a/node_modules/@nodelib/fs.stat/src/providers/async.spec.ts b/node_modules/@nodelib/fs.stat/src/providers/async.spec.ts new file mode 100644 index 00000000..19ecf310 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/providers/async.spec.ts @@ -0,0 +1,102 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; + +import * as sinon from 'sinon'; + +import { Stats } from '../../../fs.macchiato'; +import Settings from '../settings'; +import * as provider from './async'; + +describe('Providers → Async', () => { + describe('.read', () => { + it('should return lstat for non-symlink entry', (done) => { + const lstat = sinon.stub().yields(null, new Stats()) as unknown as typeof fs.lstat; + + const settings = new Settings({ + fs: { lstat } + }); + + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.ino, 0); + done(); + }); + }); + + it('should return lstat for symlink entry when the "followSymbolicLink" option is disabled', (done) => { + const lstat = sinon.stub().yields(null, new Stats({ isSymbolicLink: true })) as unknown as typeof fs.lstat; + + const settings = new Settings({ + followSymbolicLink: false, + fs: { lstat } + }); + + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.ino, 0); + done(); + }); + }); + + it('should return stat for symlink entry', (done) => { + const lstat = sinon.stub().yields(null, new Stats({ isSymbolicLink: true })) as unknown as typeof fs.lstat; + const stat = sinon.stub().yields(null, new Stats({ ino: 1 })) as unknown as typeof fs.stat; + + const settings = new Settings({ + fs: { lstat, stat } + }); + + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.ino, 1); + done(); + }); + }); + + it('should return marked stat for symlink entry when the "markSymbolicLink" option is enabled', (done) => { + const lstat = sinon.stub().yields(null, new Stats({ isSymbolicLink: true })) as unknown as typeof fs.lstat; + const stat = sinon.stub().yields(null, new Stats({ ino: 1 })) as unknown as typeof fs.stat; + + const settings = new Settings({ + fs: { lstat, stat }, + markSymbolicLink: true + }); + + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.isSymbolicLink(), true); + done(); + }); + }); + + it('should return lstat for broken symlink entry when the "throwErrorOnBrokenSymbolicLink" option is disabled', (done) => { + const lstat = sinon.stub().yields(null, new Stats({ isSymbolicLink: true })) as unknown as typeof fs.lstat; + const stat = sinon.stub().yields(new Error()) as unknown as typeof fs.stat; + + const settings = new Settings({ + fs: { lstat, stat }, + throwErrorOnBrokenSymbolicLink: false + }); + + provider.read('filepath', settings, (error, stats) => { + assert.strictEqual(error, null); + assert.strictEqual(stats.ino, 0); + done(); + }); + }); + + it('should throw an error when symlink entry is broken', (done) => { + const lstat = sinon.stub().yields(null, new Stats({ isSymbolicLink: true })) as unknown as typeof fs.lstat; + const stat = sinon.stub().yields(new Error('broken')) as unknown as typeof fs.stat; + + const settings = new Settings({ + fs: { lstat, stat } + }); + + provider.read('filepath', settings, (error) => { + assert.strictEqual(error.message, 'broken'); + done(); + }); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/src/providers/async.ts b/node_modules/@nodelib/fs.stat/src/providers/async.ts new file mode 100644 index 00000000..1ec6c28a --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/providers/async.ts @@ -0,0 +1,43 @@ +import Settings from '../settings'; +import { ErrnoException, Stats } from '../types'; + +type FailureCallback = (err: ErrnoException) => void; +type SuccessCallback = (err: null, stats: Stats) => void; + +export type AsyncCallback = (err: ErrnoException, stats: Stats) => void; + +export function read(path: string, settings: Settings, callback: AsyncCallback): void { + settings.fs.lstat(path, (lstatError, lstat) => { + if (lstatError !== null) { + return callFailureCallback(callback, lstatError); + } + + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return callSuccessCallback(callback, lstat); + } + + settings.fs.stat(path, (statError, stat) => { + if (statError !== null) { + if (settings.throwErrorOnBrokenSymbolicLink) { + return callFailureCallback(callback, statError); + } + + return callSuccessCallback(callback, lstat); + } + + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + + callSuccessCallback(callback, stat); + }); + }); +} + +function callFailureCallback(callback: AsyncCallback, error: ErrnoException): void { + (callback as FailureCallback)(error); +} + +function callSuccessCallback(callback: AsyncCallback, result: Stats): void { + (callback as unknown as SuccessCallback)(null, result); +} diff --git a/node_modules/@nodelib/fs.stat/src/providers/sync.spec.ts b/node_modules/@nodelib/fs.stat/src/providers/sync.spec.ts new file mode 100644 index 00000000..f027cda4 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/providers/sync.spec.ts @@ -0,0 +1,90 @@ +import * as assert from 'assert'; + +import * as sinon from 'sinon'; + +import { Stats } from '../../../fs.macchiato'; +import Settings from '../settings'; +import * as provider from './sync'; + +describe('Providers → Sync', () => { + describe('.read', () => { + it('should return lstat for non-symlink entry', () => { + const lstatSync = sinon.stub().returns(new Stats()); + + const settings = new Settings({ + fs: { lstatSync } + }); + + const actual = provider.read('filepath', settings); + + assert.strictEqual(actual.ino, 0); + }); + + it('should return lstat for symlink entry when the "followSymbolicLink" option is disabled', () => { + const lstatSync = sinon.stub().returns(new Stats({ isSymbolicLink: true })); + + const settings = new Settings({ + followSymbolicLink: false, + fs: { lstatSync } + }); + + const actual = provider.read('filepath', settings); + + assert.strictEqual(actual.ino, 0); + }); + + it('should return stat for symlink entry', () => { + const lstatSync = sinon.stub().returns(new Stats({ isSymbolicLink: true })); + const statSync = sinon.stub().returns(new Stats({ ino: 1 })); + + const settings = new Settings({ + fs: { lstatSync, statSync } + }); + + const actual = provider.read('filepath', settings); + + assert.strictEqual(actual.ino, 1); + }); + + it('should return marked stat for symlink entry when the "markSymbolicLink" option is enabled', () => { + const lstatSync = sinon.stub().returns(new Stats({ isSymbolicLink: true })); + const statSync = sinon.stub().returns(new Stats({ ino: 1 })); + + const settings = new Settings({ + markSymbolicLink: true, + fs: { lstatSync, statSync } + }); + + const actual = provider.read('filepath', settings); + + assert.strictEqual(actual.isSymbolicLink(), true); + }); + + it('should return lstat for broken symlink entry when the "throwErrorOnBrokenSymbolicLink" option is disabled', () => { + const lstatSync = sinon.stub().returns(new Stats({ isSymbolicLink: true })); + const statSync = sinon.stub().throws(new Error('error')); + + const settings = new Settings({ + fs: { lstatSync, statSync }, + throwErrorOnBrokenSymbolicLink: false + }); + + const actual = provider.read('filepath', settings); + + assert.strictEqual(actual.ino, 0); + }); + + it('should throw an error when symlink entry is broken', () => { + const lstatSync = sinon.stub().returns(new Stats({ isSymbolicLink: true })); + const statSync = sinon.stub().throws(new Error('broken')); + + const settings = new Settings({ + fs: { lstatSync, statSync } + }); + + const expectedErrorMessageRe = /broken/; + + assert.throws(() => provider.read('filepath', settings), expectedErrorMessageRe); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/src/providers/sync.ts b/node_modules/@nodelib/fs.stat/src/providers/sync.ts new file mode 100644 index 00000000..a1a36ceb --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/providers/sync.ts @@ -0,0 +1,26 @@ +import Settings from '../settings'; +import { Stats } from '../types'; + +export function read(path: string, settings: Settings): Stats { + const lstat = settings.fs.lstatSync(path); + + if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) { + return lstat; + } + + try { + const stat = settings.fs.statSync(path); + + if (settings.markSymbolicLink) { + stat.isSymbolicLink = () => true; + } + + return stat; + } catch (error) { + if (!settings.throwErrorOnBrokenSymbolicLink) { + return lstat; + } + + throw error; + } +} diff --git a/node_modules/@nodelib/fs.stat/src/settings.spec.ts b/node_modules/@nodelib/fs.stat/src/settings.spec.ts new file mode 100644 index 00000000..d8d33b8d --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/settings.spec.ts @@ -0,0 +1,31 @@ +import * as assert from 'assert'; + +import { Stats } from '../../fs.macchiato'; + +import * as fs from './adapters/fs'; +import Settings from './settings'; + +describe('Settings', () => { + it('should return instance with default values', () => { + const settings = new Settings(); + + assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter()); + assert.ok(settings.throwErrorOnBrokenSymbolicLink); + assert.ok(!settings.markSymbolicLink); + assert.ok(settings.followSymbolicLink); + }); + + it('should return instance with custom values', () => { + const lstatSync = (): Stats => new Stats(); + + const settings = new Settings({ + followSymbolicLink: false, + fs: fs.createFileSystemAdapter({ lstatSync }), + throwErrorOnBrokenSymbolicLink: false + }); + + assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter({ lstatSync })); + assert.ok(!settings.throwErrorOnBrokenSymbolicLink); + assert.ok(!settings.followSymbolicLink); + }); +}); diff --git a/node_modules/@nodelib/fs.stat/src/settings.ts b/node_modules/@nodelib/fs.stat/src/settings.ts new file mode 100644 index 00000000..e9d8a70b --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/settings.ts @@ -0,0 +1,21 @@ +import * as fs from './adapters/fs'; + +export type Options = { + followSymbolicLink?: boolean; + fs?: Partial; + markSymbolicLink?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +}; + +export default class Settings { + public readonly followSymbolicLink: boolean = this._getValue(this._options.followSymbolicLink, true); + public readonly fs: fs.FileSystemAdapter = fs.createFileSystemAdapter(this._options.fs); + public readonly markSymbolicLink: boolean = this._getValue(this._options.markSymbolicLink, false); + public readonly throwErrorOnBrokenSymbolicLink: boolean = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + + constructor(private readonly _options: Options = {}) { } + + private _getValue(option: T | undefined, value: T): T { + return option ?? value; + } +} diff --git a/node_modules/@nodelib/fs.stat/src/types/index.ts b/node_modules/@nodelib/fs.stat/src/types/index.ts new file mode 100644 index 00000000..f12709a5 --- /dev/null +++ b/node_modules/@nodelib/fs.stat/src/types/index.ts @@ -0,0 +1,4 @@ +import * as fs from 'fs'; + +export type Stats = fs.Stats; +export type ErrnoException = NodeJS.ErrnoException; diff --git a/node_modules/@nodelib/fs.stat/tsconfig.json b/node_modules/@nodelib/fs.stat/tsconfig.json new file mode 100644 index 00000000..7a98c7bf --- /dev/null +++ b/node_modules/@nodelib/fs.stat/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "out" + }, + "references": [ + { + "path": "../fs.macchiato" + } + ] +} diff --git a/node_modules/@nodelib/fs.walk/LICENSE b/node_modules/@nodelib/fs.walk/LICENSE new file mode 100644 index 00000000..65a99946 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Denis Malinochkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/@nodelib/fs.walk/README.md b/node_modules/@nodelib/fs.walk/README.md new file mode 100644 index 00000000..6ccc08db --- /dev/null +++ b/node_modules/@nodelib/fs.walk/README.md @@ -0,0 +1,215 @@ +# @nodelib/fs.walk + +> A library for efficiently walking a directory recursively. + +## :bulb: Highlights + +* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional). +* :rocket: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type for performance reasons. See [`old` and `modern` mode](https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode). +* :gear: Built-in directories/files and error filtering system. +* :link: Can safely work with broken symbolic links. + +## Install + +```console +npm install @nodelib/fs.walk +``` + +## Usage + +```ts +import * as fsWalk from '@nodelib/fs.walk'; + +fsWalk.walk('path', (error, entries) => { /* … */ }); +``` + +## API + +### .walk(path, [optionsOrSettings], callback) + +Reads the directory recursively and asynchronously. Requires a callback function. + +> :book: If you want to use the Promise API, use `util.promisify`. + +```ts +fsWalk.walk('path', (error, entries) => { /* … */ }); +fsWalk.walk('path', {}, (error, entries) => { /* … */ }); +fsWalk.walk('path', new fsWalk.Settings(), (error, entries) => { /* … */ }); +``` + +### .walkStream(path, [optionsOrSettings]) + +Reads the directory recursively and asynchronously. [Readable Stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_readable_streams) is used as a provider. + +```ts +const stream = fsWalk.walkStream('path'); +const stream = fsWalk.walkStream('path', {}); +const stream = fsWalk.walkStream('path', new fsWalk.Settings()); +``` + +### .walkSync(path, [optionsOrSettings]) + +Reads the directory recursively and synchronously. Returns an array of entries. + +```ts +const entries = fsWalk.walkSync('path'); +const entries = fsWalk.walkSync('path', {}); +const entries = fsWalk.walkSync('path', new fsWalk.Settings()); +``` + +#### path + +* Required: `true` +* Type: `string | Buffer | URL` + +A path to a file. If a URL is provided, it must use the `file:` protocol. + +#### optionsOrSettings + +* Required: `false` +* Type: `Options | Settings` +* Default: An instance of `Settings` class + +An [`Options`](#options) object or an instance of [`Settings`](#settings) class. + +> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class. + +### Settings([options]) + +A class of full settings of the package. + +```ts +const settings = new fsWalk.Settings({ followSymbolicLinks: true }); + +const entries = fsWalk.walkSync('path', settings); +``` + +## Entry + +* `name` — The name of the entry (`unknown.txt`). +* `path` — The path of the entry relative to call directory (`root/unknown.txt`). +* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. +* [`stats`] — An instance of `fs.Stats` class. + +## Options + +### basePath + +* Type: `string` +* Default: `undefined` + +By default, all paths are built relative to the root path. You can use this option to set custom root path. + +In the example below we read the files from the `root` directory, but in the results the root path will be `custom`. + +```ts +fsWalk.walkSync('root'); // → ['root/file.txt'] +fsWalk.walkSync('root', { basePath: 'custom' }); // → ['custom/file.txt'] +``` + +### concurrency + +* Type: `number` +* Default: `Infinity` + +The maximum number of concurrent calls to `fs.readdir`. + +> :book: The higher the number, the higher performance and the load on the File System. If you want to read in quiet mode, set the value to `4 * os.cpus().length` (4 is default size of [thread pool work scheduling](http://docs.libuv.org/en/v1.x/threadpool.html#thread-pool-work-scheduling)). + +### deepFilter + +* Type: [`DeepFilterFunction`](./src/settings.ts) +* Default: `undefined` + +A function that indicates whether the directory will be read deep or not. + +```ts +// Skip all directories that starts with `node_modules` +const filter: DeepFilterFunction = (entry) => !entry.path.startsWith('node_modules'); +``` + +### entryFilter + +* Type: [`EntryFilterFunction`](./src/settings.ts) +* Default: `undefined` + +A function that indicates whether the entry will be included to results or not. + +```ts +// Exclude all `.js` files from results +const filter: EntryFilterFunction = (entry) => !entry.name.endsWith('.js'); +``` + +### errorFilter + +* Type: [`ErrorFilterFunction`](./src/settings.ts) +* Default: `undefined` + +A function that allows you to skip errors that occur when reading directories. + +For example, you can skip `ENOENT` errors if required: + +```ts +// Skip all ENOENT errors +const filter: ErrorFilterFunction = (error) => error.code == 'ENOENT'; +``` + +### stats + +* Type: `boolean` +* Default: `false` + +Adds an instance of `fs.Stats` class to the [`Entry`](#entry). + +> :book: Always use `fs.readdir` with additional `fs.lstat/fs.stat` calls to determine the entry type. + +### followSymbolicLinks + +* Type: `boolean` +* Default: `false` + +Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`. + +### `throwErrorOnBrokenSymbolicLink` + +* Type: `boolean` +* Default: `true` + +Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. + +### `pathSegmentSeparator` + +* Type: `string` +* Default: `path.sep` + +By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead. + +### `fs` + +* Type: `FileSystemAdapter` +* Default: A default FS methods + +By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own. + +```ts +interface FileSystemAdapter { + lstat: typeof fs.lstat; + stat: typeof fs.stat; + lstatSync: typeof fs.lstatSync; + statSync: typeof fs.statSync; + readdir: typeof fs.readdir; + readdirSync: typeof fs.readdirSync; +} + +const settings = new fsWalk.Settings({ + fs: { lstat: fakeLstat } +}); +``` + +## Changelog + +See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version. + +## License + +This software is released under the terms of the MIT license. diff --git a/node_modules/@nodelib/fs.walk/out/index.d.ts b/node_modules/@nodelib/fs.walk/out/index.d.ts new file mode 100644 index 00000000..5070b6a0 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/index.d.ts @@ -0,0 +1,15 @@ +/// +import { Readable } from 'stream'; +import { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir'; +import { AsyncCallback } from './providers/async'; +import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings'; +import { Entry } from './types'; +declare function walk(directory: string, callback: AsyncCallback): void; +declare function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +declare namespace walk { + function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise; +} +declare function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[]; +declare function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable; +export { walk, walkSync, walkStream, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options, DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/index.d.ts.map b/node_modules/@nodelib/fs.walk/out/index.d.ts.map new file mode 100644 index 00000000..8e8ff950 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAsB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGjE,OAAO,QAAQ,EAAE,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7G,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,iBAAS,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAChE,iBAAS,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,GAAG,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAWvG,OAAO,WAAW,IAAI,CAAC;IACtB,SAAS,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;CACpG;AAED,iBAAS,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,EAAE,CAKpF;AAED,iBAAS,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAKvF;AAUD,OAAO,EACN,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,QAAQ,EAER,aAAa,EACb,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/index.js b/node_modules/@nodelib/fs.walk/out/index.js new file mode 100644 index 00000000..664644d7 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/index.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0; +const async_1 = require("./providers/async"); +const stream_1 = require("./providers/stream"); +const sync_1 = require("./providers/sync"); +const settings_1 = require("./settings"); +exports.Settings = settings_1.default; +function walk(directory, optionsOrSettingsOrCallback, callback) { + if (typeof optionsOrSettingsOrCallback === 'function') { + return new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback); + } + new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback); +} +exports.walk = walk; +function walkSync(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new sync_1.default(directory, settings); + return provider.read(); +} +exports.walkSync = walkSync; +function walkStream(directory, optionsOrSettings) { + const settings = getSettings(optionsOrSettings); + const provider = new stream_1.default(directory, settings); + return provider.read(); +} +exports.walkStream = walkStream; +function getSettings(settingsOrOptions = {}) { + if (settingsOrOptions instanceof settings_1.default) { + return settingsOrOptions; + } + return new settings_1.default(settingsOrOptions); +} diff --git a/node_modules/@nodelib/fs.walk/out/index.spec.d.ts b/node_modules/@nodelib/fs.walk/out/index.spec.d.ts new file mode 100644 index 00000000..4e9d2bbe --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/index.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=index.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/index.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/index.spec.d.ts.map new file mode 100644 index 00000000..47bd6666 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/index.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/index.spec.js b/node_modules/@nodelib/fs.walk/out/index.spec.js new file mode 100644 index 00000000..c854df32 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/index.spec.js @@ -0,0 +1,99 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const fs = require("fs"); +const rimraf = require("rimraf"); +const _1 = require("."); +const entryFilter = (entry) => !entry.dirent.isDirectory(); +function streamToPromise(stream) { + const entries = []; + return new Promise((resolve, reject) => { + stream.on('data', (entry) => entries.push(entry)); + stream.once('error', reject); + stream.once('end', () => resolve(entries)); + }); +} +describe('Package', () => { + before(() => { + rimraf.sync('fixtures'); + fs.mkdirSync('fixtures'); + fs.writeFileSync('fixtures/file.txt', ''); + fs.mkdirSync('fixtures/nested'); + fs.writeFileSync('fixtures/nested/file.txt', ''); + }); + after(() => { + rimraf.sync('fixtures'); + }); + describe('.walk', () => { + it('should throw an error for non-exist directory', (done) => { + _1.walk('non-exist-directory', (error, entries) => { + assert.strictEqual(error.code, 'ENOENT'); + assert.strictEqual(entries, undefined); + done(); + }); + }); + it('should work without options or settings', (done) => { + _1.walk('fixtures', (error, entries) => { + assert.strictEqual(error, null); + assert.strictEqual(entries.length, 3); + done(); + }); + }); + it('should work with options', (done) => { + _1.walk('fixtures', { entryFilter }, (error, entries) => { + assert.strictEqual(error, null); + assert.strictEqual(entries.length, 2); + done(); + }); + }); + it('should work with settings', (done) => { + const settings = new _1.Settings({ entryFilter }); + _1.walk('fixtures', settings, (error, entries) => { + assert.strictEqual(error, null); + assert.strictEqual(entries.length, 2); + done(); + }); + }); + }); + describe('.walkStream', () => { + it('should throw an error for non-exist directory', async () => { + const stream = _1.walkStream('non-exist-directory'); + await assert.rejects(() => streamToPromise(stream), (error) => error.code === 'ENOENT'); + }); + it('should work without options or settings', async () => { + const stream = _1.walkStream('fixtures'); + const actual = await streamToPromise(stream); + assert.strictEqual(actual.length, 3); + }); + it('should work with options', async () => { + const stream = _1.walkStream('fixtures', { entryFilter }); + const actual = await streamToPromise(stream); + assert.strictEqual(actual.length, 2); + }); + it('should work with settings', async () => { + const settings = new _1.Settings({ entryFilter }); + const stream = _1.walkStream('fixtures', settings); + const actual = await streamToPromise(stream); + assert.strictEqual(actual.length, 2); + }); + }); + describe('.walkSync', () => { + it('should throw an error for non-exist directory', () => { + const matcher = (error) => error.code === 'ENOENT'; + assert.throws(() => _1.walkSync('non-exist-directory'), matcher); + }); + it('should work without options or settings', () => { + const actual = _1.walkSync('fixtures'); + assert.strictEqual(actual.length, 3); + }); + it('should work with options', () => { + const actual = _1.walkSync('fixtures', { entryFilter }); + assert.strictEqual(actual.length, 2); + }); + it('should work with settings', () => { + const settings = new _1.Settings({ entryFilter }); + const actual = _1.walkSync('fixtures', settings); + assert.strictEqual(actual.length, 2); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.d.ts b/node_modules/@nodelib/fs.walk/out/providers/async.d.ts new file mode 100644 index 00000000..1f5f1bac --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/async.d.ts @@ -0,0 +1,13 @@ +import AsyncReader from '../readers/async'; +import Settings from '../settings'; +import { Entry, Errno } from '../types'; +export declare type AsyncCallback = (err: Errno, entries: Entry[]) => void; +export default class AsyncProvider { + private readonly _root; + private readonly _settings; + protected readonly _reader: AsyncReader; + private readonly _storage; + constructor(_root: string, _settings: Settings); + read(callback: AsyncCallback): void; +} +//# sourceMappingURL=async.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.d.ts.map b/node_modules/@nodelib/fs.walk/out/providers/async.d.ts.map new file mode 100644 index 00000000..8da402f2 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/async.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/providers/async.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKxC,oBAAY,aAAa,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;AAEnE,MAAM,CAAC,OAAO,OAAO,aAAa;IAKrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAU,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJtE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAA+C;IAEtF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;gBAErB,KAAK,EAAE,MAAM,EAAmB,SAAS,EAAE,QAAQ;IAEzE,IAAI,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;CAe1C"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.js b/node_modules/@nodelib/fs.walk/out/providers/async.js new file mode 100644 index 00000000..20e4ab5d --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/async.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const async_1 = require("../readers/async"); +class AsyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._storage = new Set(); + } + read(callback) { + this._reader.onError((error) => { + callFailureCallback(callback, error); + }); + this._reader.onEntry((entry) => { + this._storage.add(entry); + }); + this._reader.onEnd(() => { + callSuccessCallback(callback, [...this._storage]); + }); + this._reader.read(); + } +} +exports.default = AsyncProvider; +function callFailureCallback(callback, error) { + callback(error); +} +function callSuccessCallback(callback, entries) { + callback(null, entries); +} diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.spec.d.ts b/node_modules/@nodelib/fs.walk/out/providers/async.spec.d.ts new file mode 100644 index 00000000..c3f82484 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/async.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=async.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/providers/async.spec.d.ts.map new file mode 100644 index 00000000..a67f476b --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/async.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.spec.d.ts","sourceRoot":"","sources":["../../src/providers/async.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/async.spec.js b/node_modules/@nodelib/fs.walk/out/providers/async.spec.js new file mode 100644 index 00000000..b947d31a --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/async.spec.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const sinon = require("sinon"); +const settings_1 = require("../settings"); +const tests = require("../tests"); +const async_1 = require("./async"); +class TestProvider extends async_1.default { + constructor(_root, _settings = new settings_1.default()) { + super(_root, _settings); + this._reader = new tests.TestAsyncReader(); + } + get reader() { + return this._reader; + } +} +describe('Providers → Async', () => { + describe('.read', () => { + it('should call reader function with correct set of arguments', () => { + const provider = new TestProvider('directory'); + const fakeCallback = sinon.stub(); + provider.read(fakeCallback); + assert.ok(provider.reader.read.called); + }); + it('should call callback with error for failed launch', () => { + const provider = new TestProvider('directory'); + const fakeCallback = sinon.stub(); + provider.reader.onError.yields(tests.EPERM_ERRNO); + provider.read(fakeCallback); + assert.deepStrictEqual(fakeCallback.args, [[tests.EPERM_ERRNO]]); + }); + it('should push entries to storage and call callback with array of entries', () => { + const provider = new TestProvider('directory'); + const fakeEntry = tests.buildFakeFileEntry(); + const fakeCallback = sinon.stub(); + provider.reader.onEntry.yields(fakeEntry); + provider.reader.onEnd.yields(); + provider.read(fakeCallback); + assert.deepStrictEqual(fakeCallback.args, [[null, [fakeEntry]]]); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/providers/index.d.ts b/node_modules/@nodelib/fs.walk/out/providers/index.d.ts new file mode 100644 index 00000000..cbdfb3b9 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/index.d.ts @@ -0,0 +1,5 @@ +import AsyncProvider from './async'; +import StreamProvider from './stream'; +import SyncProvider from './sync'; +export { AsyncProvider, StreamProvider, SyncProvider }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/index.d.ts.map b/node_modules/@nodelib/fs.walk/out/providers/index.d.ts.map new file mode 100644 index 00000000..b66c2b1f --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,OAAO,EACN,aAAa,EACb,cAAc,EACd,YAAY,EACZ,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/index.js b/node_modules/@nodelib/fs.walk/out/providers/index.js new file mode 100644 index 00000000..6d632d6a --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/index.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0; +const async_1 = require("./async"); +exports.AsyncProvider = async_1.default; +const stream_1 = require("./stream"); +exports.StreamProvider = stream_1.default; +const sync_1 = require("./sync"); +exports.SyncProvider = sync_1.default; diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts b/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts new file mode 100644 index 00000000..810111d4 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts @@ -0,0 +1,13 @@ +/// +import { Readable } from 'stream'; +import AsyncReader from '../readers/async'; +import Settings from '../settings'; +export default class StreamProvider { + private readonly _root; + private readonly _settings; + protected readonly _reader: AsyncReader; + protected readonly _stream: Readable; + constructor(_root: string, _settings: Settings); + read(): Readable; +} +//# sourceMappingURL=stream.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts.map b/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts.map new file mode 100644 index 00000000..47ad13ea --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/providers/stream.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,OAAO,OAAO,cAAc;IAYtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAU,OAAO,CAAC,QAAQ,CAAC,SAAS;IAXtE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAA+C;IACtF,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAQjC;gBAE0B,KAAK,EAAE,MAAM,EAAmB,SAAS,EAAE,QAAQ;IAEzE,IAAI,IAAI,QAAQ;CAiBvB"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.js b/node_modules/@nodelib/fs.walk/out/providers/stream.js new file mode 100644 index 00000000..3bd49493 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/stream.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = require("stream"); +const async_1 = require("../readers/async"); +class StreamProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new async_1.default(this._root, this._settings); + this._stream = new stream_1.Readable({ + objectMode: true, + read: () => { }, + destroy: () => { + if (!this._reader.isDestroyed) { + this._reader.destroy(); + } + } + }); + } + read() { + this._reader.onError((error) => { + this._stream.emit('error', error); + }); + this._reader.onEntry((entry) => { + this._stream.push(entry); + }); + this._reader.onEnd(() => { + this._stream.push(null); + }); + this._reader.read(); + return this._stream; + } +} +exports.default = StreamProvider; diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.spec.d.ts b/node_modules/@nodelib/fs.walk/out/providers/stream.spec.d.ts new file mode 100644 index 00000000..b45ee18e --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/stream.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=stream.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/providers/stream.spec.d.ts.map new file mode 100644 index 00000000..d16ea614 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/stream.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stream.spec.d.ts","sourceRoot":"","sources":["../../src/providers/stream.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/stream.spec.js b/node_modules/@nodelib/fs.walk/out/providers/stream.spec.js new file mode 100644 index 00000000..79a6b29f --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/stream.spec.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const stream_1 = require("stream"); +const sinon = require("sinon"); +const settings_1 = require("../settings"); +const tests = require("../tests"); +const stream_2 = require("./stream"); +class TestProvider extends stream_2.default { + constructor(_root, _settings = new settings_1.default()) { + super(_root, _settings); + this._reader = new tests.TestAsyncReader(); + this._stream.emit = sinon.stub(); + this._stream.push = sinon.stub(); + } + get reader() { + return this._reader; + } + get stream() { + return this._stream; + } +} +describe('Providers → Stream', () => { + describe('.read', () => { + it('should return stream', () => { + const provider = new TestProvider('directory'); + const stream = provider.read(); + assert.ok(stream instanceof stream_1.Readable); + }); + it('should call reader function with correct set of arguments', () => { + const provider = new TestProvider('directory'); + provider.read(); + assert.ok(provider.reader.read.called); + }); + it('should re-emit the "error" event from reader', () => { + const provider = new TestProvider('directory'); + provider.reader.onError.yields(tests.EPERM_ERRNO); + provider.read(); + assert.deepStrictEqual(provider.stream.emit.args, [['error', tests.EPERM_ERRNO]]); + }); + it('should call the "push" method with entry value for the "entry" event from reader', () => { + const provider = new TestProvider('directory'); + const fakeEntry = tests.buildFakeFileEntry(); + provider.reader.onEntry.yields(fakeEntry); + provider.read(); + assert.deepStrictEqual(provider.stream.push.args, [[fakeEntry]]); + }); + it('should call the "push" method with "null" value for the "end" event from reader', () => { + const provider = new TestProvider('directory'); + provider.reader.onEnd.yields(); + provider.read(); + assert.deepStrictEqual(provider.stream.push.args, [[null]]); + }); + it('should do not destroy reader when it is already destroyed', () => { + const provider = new TestProvider('directory'); + const stream = provider.read(); + stream.destroy(); + assert.ok(stream.destroyed); + assert.doesNotThrow(() => stream.destroy()); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts b/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts new file mode 100644 index 00000000..9570fd11 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts @@ -0,0 +1,11 @@ +import SyncReader from '../readers/sync'; +import Settings from '../settings'; +import { Entry } from '../types'; +export default class SyncProvider { + private readonly _root; + private readonly _settings; + protected readonly _reader: SyncReader; + constructor(_root: string, _settings: Settings); + read(): Entry[]; +} +//# sourceMappingURL=sync.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts.map b/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts.map new file mode 100644 index 00000000..8d921973 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/providers/sync.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,CAAC,OAAO,OAAO,YAAY;IAGpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAU,OAAO,CAAC,QAAQ,CAAC,SAAS;IAFtE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAA8C;gBAEvD,KAAK,EAAE,MAAM,EAAmB,SAAS,EAAE,QAAQ;IAEzE,IAAI,IAAI,KAAK,EAAE;CAGtB"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.js b/node_modules/@nodelib/fs.walk/out/providers/sync.js new file mode 100644 index 00000000..fef1d8d8 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/sync.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sync_1 = require("../readers/sync"); +class SyncProvider { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._reader = new sync_1.default(this._root, this._settings); + } + read() { + return this._reader.read(); + } +} +exports.default = SyncProvider; diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.spec.d.ts b/node_modules/@nodelib/fs.walk/out/providers/sync.spec.d.ts new file mode 100644 index 00000000..5167ab33 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/sync.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=sync.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/providers/sync.spec.d.ts.map new file mode 100644 index 00000000..aae94987 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/sync.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sync.spec.d.ts","sourceRoot":"","sources":["../../src/providers/sync.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/providers/sync.spec.js b/node_modules/@nodelib/fs.walk/out/providers/sync.spec.js new file mode 100644 index 00000000..1fe94c5d --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/providers/sync.spec.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const settings_1 = require("../settings"); +const tests = require("../tests"); +const sync_1 = require("./sync"); +class TestProvider extends sync_1.default { + constructor(_root, _settings = new settings_1.default()) { + super(_root, _settings); + this._reader = new tests.TestSyncReader(); + } + get reader() { + return this._reader; + } +} +describe('Providers → Sync', () => { + describe('.read', () => { + it('should call reader function with correct set of arguments and got result', () => { + const provider = new TestProvider('directory'); + const fakeEntry = tests.buildFakeFileEntry(); + provider.reader.read.returns([fakeEntry]); + const actual = provider.read(); + assert.deepStrictEqual(actual, [fakeEntry]); + assert.ok(provider.reader.read.called); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.d.ts b/node_modules/@nodelib/fs.walk/out/readers/async.d.ts new file mode 100644 index 00000000..80f9a8ca --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/async.d.ts @@ -0,0 +1,31 @@ +/// +import { EventEmitter } from 'events'; +import * as fsScandir from '@nodelib/fs.scandir'; +import Settings from '../settings'; +import { Entry, Errno } from '../types'; +import Reader from './reader'; +declare type EntryEventCallback = (entry: Entry) => void; +declare type ErrorEventCallback = (error: Errno) => void; +declare type EndEventCallback = () => void; +export default class AsyncReader extends Reader { + protected readonly _settings: Settings; + protected readonly _scandir: typeof fsScandir.scandir; + protected readonly _emitter: EventEmitter; + private readonly _queue; + private _isFatalError; + private _isDestroyed; + constructor(_root: string, _settings: Settings); + read(): EventEmitter; + get isDestroyed(): boolean; + destroy(): void; + onEntry(callback: EntryEventCallback): void; + onError(callback: ErrorEventCallback): void; + onEnd(callback: EndEventCallback): void; + private _pushToQueue; + private _worker; + private _handleError; + private _handleEntry; + private _emitEntry; +} +export {}; +//# sourceMappingURL=async.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.d.ts.map b/node_modules/@nodelib/fs.walk/out/readers/async.d.ts.map new file mode 100644 index 00000000..4e0defa7 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/async.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/readers/async.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AAGjD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAa,MAAM,UAAU,CAAC;AAEnD,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,aAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AACjD,aAAK,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AACjD,aAAK,gBAAgB,GAAG,MAAM,IAAI,CAAC;AAEnC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,MAAM;IAQnB,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ;IAPjE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,SAAS,CAAC,OAAO,CAAqB;IAC1E,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAsB;IAE/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2E;IAClG,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,YAAY,CAAkB;gBAE1B,KAAK,EAAE,MAAM,EAAqB,SAAS,EAAE,QAAQ;IAU1D,IAAI,IAAI,YAAY;IAW3B,IAAW,WAAW,IAAI,OAAO,CAEhC;IAEM,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAI3C,OAAO,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAI3C,KAAK,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAI9C,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,UAAU;CAGlB"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.js b/node_modules/@nodelib/fs.walk/out/readers/async.js new file mode 100644 index 00000000..93e6670b --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/async.js @@ -0,0 +1,96 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const events_1 = require("events"); +const fsScandir = require("@nodelib/fs.scandir"); +const fastq = require("fastq"); +const common = require("./common"); +const reader_1 = require("./reader"); +class AsyncReader extends reader_1.default { + constructor(_root, _settings) { + super(_root, _settings); + this._settings = _settings; + this._scandir = fsScandir.scandir; + this._emitter = new events_1.EventEmitter(); + this._queue = fastq(this._worker.bind(this), this._settings.concurrency); + this._isFatalError = false; + this._isDestroyed = false; + this._queue.drain = () => { + if (!this._isFatalError) { + this._emitter.emit('end'); + } + }; + } + read() { + this._isFatalError = false; + this._isDestroyed = false; + setImmediate(() => { + this._pushToQueue(this._root, this._settings.basePath); + }); + return this._emitter; + } + get isDestroyed() { + return this._isDestroyed; + } + destroy() { + if (this._isDestroyed) { + throw new Error('The reader is already destroyed'); + } + this._isDestroyed = true; + this._queue.killAndDrain(); + } + onEntry(callback) { + this._emitter.on('entry', callback); + } + onError(callback) { + this._emitter.once('error', callback); + } + onEnd(callback) { + this._emitter.once('end', callback); + } + _pushToQueue(directory, base) { + const queueItem = { directory, base }; + this._queue.push(queueItem, (error) => { + if (error !== null) { + this._handleError(error); + } + }); + } + _worker(item, done) { + this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => { + if (error !== null) { + return done(error, undefined); + } + for (const entry of entries) { + this._handleEntry(entry, item.base); + } + done(null, undefined); + }); + } + _handleError(error) { + if (this._isDestroyed || !common.isFatalError(this._settings, error)) { + return; + } + this._isFatalError = true; + this._isDestroyed = true; + this._emitter.emit('error', error); + } + _handleEntry(entry, base) { + if (this._isDestroyed || this._isFatalError) { + return; + } + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._emitEntry(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, entry.path); + } + } + _emitEntry(entry) { + this._emitter.emit('entry', entry); + } +} +exports.default = AsyncReader; diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.spec.d.ts b/node_modules/@nodelib/fs.walk/out/readers/async.spec.d.ts new file mode 100644 index 00000000..c3f82484 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/async.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=async.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/readers/async.spec.d.ts.map new file mode 100644 index 00000000..94379426 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/async.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"async.spec.d.ts","sourceRoot":"","sources":["../../src/readers/async.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/async.spec.js b/node_modules/@nodelib/fs.walk/out/readers/async.spec.js new file mode 100644 index 00000000..32fd7859 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/async.spec.js @@ -0,0 +1,165 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const path = require("path"); +const sinon = require("sinon"); +const settings_1 = require("../settings"); +const tests = require("../tests"); +const async_1 = require("./async"); +class TestReader extends async_1.default { + constructor(_root, _settings = new settings_1.default()) { + super(_root, _settings); + this._scandir = sinon.stub(); + } + get scandir() { + return this._scandir; + } +} +describe('Readers → Async', () => { + describe('.read', () => { + it('should emit "error" event when the first call of scandir is broken', (done) => { + const reader = new TestReader('non-exist-directory'); + reader.scandir.yields(tests.EPERM_ERRNO); + reader.onError((error) => { + assert.ok(error); + done(); + }); + reader.read(); + }); + it('should emit "end" event when the first call of scandir is broken but this error can be suppressed', (done) => { + const settings = new settings_1.default({ + errorFilter: (error) => error.code === 'EPERM' + }); + const reader = new TestReader('non-exist-directory', settings); + reader.scandir.yields(tests.EPERM_ERRNO); + reader.onEnd(() => { + done(); + }); + reader.read(); + }); + it('should do not emit events after first broken scandir call', (done) => { + const reader = new TestReader('directory'); + const firstFakeDirectoryEntry = tests.buildFakeDirectoryEntry({ name: 'a', path: 'directory/a' }); + const secondFakeDirectoryEntry = tests.buildFakeDirectoryEntry({ name: 'b', path: 'directory/b' }); + reader.scandir.onFirstCall().yields(null, [firstFakeDirectoryEntry, secondFakeDirectoryEntry]); + reader.scandir.onSecondCall().yieldsAsync(tests.EPERM_ERRNO); + reader.scandir.onThirdCall().yieldsAsync(tests.EPERM_ERRNO); + /** + * If the behavior is broken, then a third scandir call will trigger an unhandled error. + */ + reader.onError((error) => { + assert.ok(error); + done(); + }); + reader.read(); + }); + it('should return entries', (done) => { + const reader = new TestReader('directory'); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + const entries = []; + reader.onEntry((entry) => entries.push(entry)); + reader.onEnd(() => { + assert.deepStrictEqual(entries, [fakeDirectoryEntry, fakeFileEntry]); + done(); + }); + reader.read(); + }); + it('should push to results only directories', (done) => { + const settings = new settings_1.default({ entryFilter: (entry) => !entry.dirent.isFile() }); + const reader = new TestReader('directory', settings); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + const entries = []; + reader.onEntry((entry) => entries.push(entry)); + reader.onEnd(() => { + assert.deepStrictEqual(entries, [fakeDirectoryEntry]); + done(); + }); + reader.read(); + }); + it('should do not read root directory', (done) => { + const settings = new settings_1.default({ deepFilter: () => false }); + const reader = new TestReader('directory', settings); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + const entries = []; + reader.onEntry((entry) => entries.push(entry)); + reader.onEnd(() => { + assert.deepStrictEqual(entries, [fakeDirectoryEntry]); + done(); + }); + reader.read(); + }); + it('should set base path to entry when the `basePath` option is exist', (done) => { + const settings = new settings_1.default({ basePath: 'base' }); + const reader = new TestReader('directory', settings); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + const entries = []; + reader.onEntry((entry) => entries.push(entry)); + reader.onEnd(() => { + assert.strictEqual(entries[0].path, path.join('base', fakeDirectoryEntry.name)); + assert.strictEqual(entries[1].path, path.join('base', 'fake', fakeFileEntry.name)); + done(); + }); + reader.read(); + }); + it('should set base path to entry when the `basePath` option is exist and value is an empty string', (done) => { + const settings = new settings_1.default({ basePath: '' }); + const reader = new TestReader('directory', settings); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + const entries = []; + reader.onEntry((entry) => entries.push(entry)); + reader.onEnd(() => { + assert.strictEqual(entries[0].path, path.join(fakeDirectoryEntry.name)); + assert.strictEqual(entries[1].path, path.join('fake', fakeFileEntry.name)); + done(); + }); + reader.read(); + }); + }); + describe('.destroy', () => { + it('should do not emit entries after destroy', (done) => { + const reader = new TestReader('directory'); + const firstFakeDirectoryEntry = tests.buildFakeDirectoryEntry({ name: 'a', path: 'directory/a' }); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().yields(null, [firstFakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + reader.onEntry((entry) => { + if (entry.name === 'a') { + reader.destroy(); + } + else { + assert.fail('should do not emit entries after destroy'); + } + }); + reader.onEnd(() => { + done(); + }); + reader.read(); + }); + it('should mark stream as "destroyed" after first destroy', () => { + const reader = new TestReader('directory'); + reader.destroy(); + assert.ok(reader.isDestroyed); + }); + it('should throw an error when trying to destroy reader twice', () => { + const reader = new TestReader('directory'); + const expectedErrorMessageRe = /The reader is already destroyed/; + reader.destroy(); + assert.throws(() => reader.destroy(), expectedErrorMessageRe); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.d.ts b/node_modules/@nodelib/fs.walk/out/readers/common.d.ts new file mode 100644 index 00000000..93bbae32 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/common.d.ts @@ -0,0 +1,7 @@ +import Settings, { FilterFunction } from '../settings'; +import { Errno } from '../types'; +export declare function isFatalError(settings: Settings, error: Errno): boolean; +export declare function isAppliedFilter(filter: FilterFunction | null, value: T): boolean; +export declare function replacePathSegmentSeparator(filepath: string, separator: string): string; +export declare function joinPathSegments(a: string, b: string, separator: string): string; +//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.d.ts.map b/node_modules/@nodelib/fs.walk/out/readers/common.d.ts.map new file mode 100644 index 00000000..8a5b96ea --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/common.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/readers/common.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAMtE;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAEtF;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvF;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAahF"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.js b/node_modules/@nodelib/fs.walk/out/readers/common.js new file mode 100644 index 00000000..8294d591 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/common.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0; +function isFatalError(settings, error) { + if (settings.errorFilter === null) { + return true; + } + return !settings.errorFilter(error); +} +exports.isFatalError = isFatalError; +function isAppliedFilter(filter, value) { + return filter === null || filter(value); +} +exports.isAppliedFilter = isAppliedFilter; +function replacePathSegmentSeparator(filepath, separator) { + return filepath.split(/[/\\]/).join(separator); +} +exports.replacePathSegmentSeparator = replacePathSegmentSeparator; +function joinPathSegments(a, b, separator) { + if (a === '') { + return b; + } + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + return a + separator + b; +} +exports.joinPathSegments = joinPathSegments; diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.spec.d.ts b/node_modules/@nodelib/fs.walk/out/readers/common.spec.d.ts new file mode 100644 index 00000000..c5ccf64b --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/common.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=common.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/readers/common.spec.d.ts.map new file mode 100644 index 00000000..14213d94 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/common.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"common.spec.d.ts","sourceRoot":"","sources":["../../src/readers/common.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/common.spec.js b/node_modules/@nodelib/fs.walk/out/readers/common.spec.js new file mode 100644 index 00000000..93734aaa --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/common.spec.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const path = require("path"); +const settings_1 = require("../settings"); +const tests = require("../tests"); +const common = require("./common"); +describe('Readers → Common', () => { + describe('.isFatalError', () => { + it('should return true when filter is not defined', () => { + const settings = new settings_1.default(); + const actual = common.isFatalError(settings, tests.EPERM_ERRNO); + assert.ok(actual); + }); + it('should return true when the error cannot be suppressed', () => { + const settings = new settings_1.default({ + errorFilter: (error) => error.code === 'ENOENT' + }); + const actual = common.isFatalError(settings, tests.EPERM_ERRNO); + assert.ok(actual); + }); + it('should return false when the error can be suppressed', () => { + const settings = new settings_1.default({ + errorFilter: (error) => error.code === 'EPERM' + }); + const actual = common.isFatalError(settings, tests.EPERM_ERRNO); + assert.ok(!actual); + }); + }); + describe('.isAppliedFilter', () => { + it('should return true when the filter is not defined', () => { + const settings = new settings_1.default(); + const entry = tests.buildFakeFileEntry(); + const actual = common.isAppliedFilter(settings.entryFilter, entry); + assert.ok(actual); + }); + it('should return true when the entry will be applied', () => { + const settings = new settings_1.default({ + entryFilter: (entry) => entry.name === 'fake.txt' + }); + const fakeEntry = tests.buildFakeFileEntry(); + const actual = common.isAppliedFilter(settings.entryFilter, fakeEntry); + assert.ok(actual); + }); + it('should return false when the entry will be skipped', () => { + const settings = new settings_1.default({ + entryFilter: (entry) => entry.name !== 'fake.txt' + }); + const fakeEntry = tests.buildFakeFileEntry(); + const actual = common.isAppliedFilter(settings.entryFilter, fakeEntry); + assert.ok(!actual); + }); + }); + describe('.replacePathSegmentSeparator', () => { + it('should replace path segment separator', () => { + const filepath = path.join('directory', 'file.txt'); + const expected = 'directory_file.txt'; + const actual = common.replacePathSegmentSeparator(filepath, '_'); + assert.strictEqual(actual, expected); + }); + }); + describe('.joinPathSegments', () => { + it('should return concatenated string', () => { + const expected = 'a&b'; + const actual = common.joinPathSegments('a', 'b', '&'); + assert.strictEqual(actual, expected); + }); + it('should return second part of path when the first path is an empty string', () => { + const expected = 'b'; + const actual = common.joinPathSegments('', 'b', '&'); + assert.strictEqual(actual, expected); + }); + it('should return correct string when the first segment ens with the separator symbol', () => { + // Unix + assert.strictEqual(common.joinPathSegments('/', 'a', '/'), '/a'); + assert.strictEqual(common.joinPathSegments('//', 'a', '/'), '//a'); + assert.strictEqual(common.joinPathSegments('/a/', 'b', '/'), '/a/b'); + // Windows + assert.strictEqual(common.joinPathSegments('C:/', 'Users', '/'), 'C:/Users'); + assert.strictEqual(common.joinPathSegments('C:\\', 'Users', '\\'), 'C:\\Users'); + assert.strictEqual(common.joinPathSegments('//?/C:/', 'Users', '/'), '//?/C:/Users'); + assert.strictEqual(common.joinPathSegments('\\\\?\\C:\\', 'Users', '\\'), '\\\\?\\C:\\Users'); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts b/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts new file mode 100644 index 00000000..688968f8 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts @@ -0,0 +1,7 @@ +import Settings from '../settings'; +export default class Reader { + protected readonly _root: string; + protected readonly _settings: Settings; + constructor(_root: string, _settings: Settings); +} +//# sourceMappingURL=reader.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts.map b/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts.map new file mode 100644 index 00000000..4b59981c --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/readers/reader.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,aAAa,CAAC;AAGnC,MAAM,CAAC,OAAO,OAAO,MAAM;IACd,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM;IAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ;gBAArD,KAAK,EAAE,MAAM,EAAqB,SAAS,EAAE,QAAQ;CAGpF"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.js b/node_modules/@nodelib/fs.walk/out/readers/reader.js new file mode 100644 index 00000000..25e7997f --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/reader.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const common = require("./common"); +class Reader { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + } +} +exports.default = Reader; diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.spec.d.ts b/node_modules/@nodelib/fs.walk/out/readers/reader.spec.d.ts new file mode 100644 index 00000000..eda56bb1 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/reader.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=reader.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/readers/reader.spec.d.ts.map new file mode 100644 index 00000000..bbe7c4cf --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/reader.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"reader.spec.d.ts","sourceRoot":"","sources":["../../src/readers/reader.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/reader.spec.js b/node_modules/@nodelib/fs.walk/out/readers/reader.spec.js new file mode 100644 index 00000000..a805ca88 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/reader.spec.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const path = require("path"); +const settings_1 = require("../settings"); +const reader_1 = require("./reader"); +class TestReader extends reader_1.default { + get root() { + return this._root; + } +} +function getReader(root, options = {}) { + return new TestReader(root, new settings_1.default(options)); +} +describe('Readers → Reader', () => { + describe('Constructor', () => { + it('should return root path with replaced path segment separators', () => { + const root = path.join('directory', 'file.txt'); + const reader = getReader(root, { pathSegmentSeparator: '_' }); + const expected = 'directory_file.txt'; + const actual = reader.root; + assert.strictEqual(actual, expected); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts b/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts new file mode 100644 index 00000000..b0bb2675 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts @@ -0,0 +1,16 @@ +import * as fsScandir from '@nodelib/fs.scandir'; +import { Entry } from '../types'; +import Reader from './reader'; +export default class SyncReader extends Reader { + protected readonly _scandir: typeof fsScandir.scandirSync; + private readonly _storage; + private readonly _queue; + read(): Entry[]; + private _pushToQueue; + private _handleQueue; + private _handleDirectory; + private _handleError; + private _handleEntry; + private _pushToStorage; +} +//# sourceMappingURL=sync.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts.map b/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts.map new file mode 100644 index 00000000..f6d327f5 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/readers/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAoB,MAAM,UAAU,CAAC;AAEnD,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,MAAM;IAC7C,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,SAAS,CAAC,WAAW,CAAyB;IAElF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IAE7C,IAAI,IAAI,KAAK,EAAE;IAOtB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,cAAc;CAGtB"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.js b/node_modules/@nodelib/fs.walk/out/readers/sync.js new file mode 100644 index 00000000..d0f06914 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/sync.js @@ -0,0 +1,59 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const fsScandir = require("@nodelib/fs.scandir"); +const common = require("./common"); +const reader_1 = require("./reader"); +class SyncReader extends reader_1.default { + constructor() { + super(...arguments); + this._scandir = fsScandir.scandirSync; + this._storage = new Set(); + this._queue = new Set(); + } + read() { + this._pushToQueue(this._root, this._settings.basePath); + this._handleQueue(); + return [...this._storage]; + } + _pushToQueue(directory, base) { + this._queue.add({ directory, base }); + } + _handleQueue() { + for (const item of this._queue.values()) { + this._handleDirectory(item.directory, item.base); + } + } + _handleDirectory(directory, base) { + try { + const entries = this._scandir(directory, this._settings.fsScandirSettings); + for (const entry of entries) { + this._handleEntry(entry, base); + } + } + catch (error) { + this._handleError(error); + } + } + _handleError(error) { + if (!common.isFatalError(this._settings, error)) { + return; + } + throw error; + } + _handleEntry(entry, base) { + const fullpath = entry.path; + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._pushToStorage(entry); + } + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, entry.path); + } + } + _pushToStorage(entry) { + this._storage.add(entry); + } +} +exports.default = SyncReader; diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.spec.d.ts b/node_modules/@nodelib/fs.walk/out/readers/sync.spec.d.ts new file mode 100644 index 00000000..5167ab33 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/sync.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=sync.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/readers/sync.spec.d.ts.map new file mode 100644 index 00000000..bae880e1 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/sync.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sync.spec.d.ts","sourceRoot":"","sources":["../../src/readers/sync.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/readers/sync.spec.js b/node_modules/@nodelib/fs.walk/out/readers/sync.spec.js new file mode 100644 index 00000000..bfd915f1 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/readers/sync.spec.js @@ -0,0 +1,89 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const path = require("path"); +const sinon = require("sinon"); +const settings_1 = require("../settings"); +const tests = require("../tests"); +const sync_1 = require("./sync"); +class TestReader extends sync_1.default { + constructor(_root, _settings = new settings_1.default()) { + super(_root, _settings); + this._scandir = sinon.stub(); + } + get scandir() { + return this._scandir; + } +} +describe('Readers → Sync', () => { + describe('.read', () => { + it('should throw an error when the first call of scandir is broken', () => { + const reader = new TestReader('non-exist-directory'); + reader.scandir.throws(tests.EPERM_ERRNO); + assert.throws(() => reader.read(), { code: 'EPERM' }); + }); + it('should return empty array when the first call of scandir is broken but this error can be suppressed', () => { + const settings = new settings_1.default({ + errorFilter: (error) => error.code === 'EPERM' + }); + const reader = new TestReader('non-exist-directory', settings); + reader.scandir.throws(tests.EPERM_ERRNO); + const actual = reader.read(); + assert.deepStrictEqual(actual, []); + }); + it('should return entries', () => { + const reader = new TestReader('directory'); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + const expected = [fakeDirectoryEntry, fakeFileEntry]; + const actual = reader.read(); + assert.deepStrictEqual(actual, expected); + }); + it('should push to results only directories', () => { + const settings = new settings_1.default({ entryFilter: (entry) => !entry.dirent.isFile() }); + const reader = new TestReader('directory', settings); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + const expected = [fakeDirectoryEntry]; + const actual = reader.read(); + assert.deepStrictEqual(actual, expected); + }); + it('should do not read root directory', () => { + const settings = new settings_1.default({ deepFilter: () => false }); + const reader = new TestReader('directory', settings); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + const expected = [fakeDirectoryEntry]; + const actual = reader.read(); + assert.deepStrictEqual(actual, expected); + }); + it('should set base path to entry when the `basePath` option is exist', () => { + const settings = new settings_1.default({ basePath: 'base' }); + const reader = new TestReader('directory', settings); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + const actual = reader.read(); + assert.strictEqual(actual[0].path, path.join('base', fakeDirectoryEntry.name)); + assert.strictEqual(actual[1].path, path.join('base', 'fake', fakeFileEntry.name)); + }); + it('should set base path to entry when the `basePath` option is exist and value is an empty string', () => { + const settings = new settings_1.default({ basePath: '' }); + const reader = new TestReader('directory', settings); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + const actual = reader.read(); + assert.strictEqual(actual[0].path, fakeDirectoryEntry.name); + assert.strictEqual(actual[1].path, path.join('fake', fakeFileEntry.name)); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/settings.d.ts b/node_modules/@nodelib/fs.walk/out/settings.d.ts new file mode 100644 index 00000000..bc1f9d55 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/settings.d.ts @@ -0,0 +1,31 @@ +import * as fsScandir from '@nodelib/fs.scandir'; +import { Entry, Errno } from './types'; +export declare type FilterFunction = (value: T) => boolean; +export declare type DeepFilterFunction = FilterFunction; +export declare type EntryFilterFunction = FilterFunction; +export declare type ErrorFilterFunction = FilterFunction; +export declare type Options = { + basePath?: string; + concurrency?: number; + deepFilter?: DeepFilterFunction; + entryFilter?: EntryFilterFunction; + errorFilter?: ErrorFilterFunction; + followSymbolicLinks?: boolean; + fs?: Partial; + pathSegmentSeparator?: string; + stats?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +}; +export default class Settings { + private readonly _options; + readonly basePath?: string; + readonly concurrency: number; + readonly deepFilter: DeepFilterFunction | null; + readonly entryFilter: EntryFilterFunction | null; + readonly errorFilter: ErrorFilterFunction | null; + readonly pathSegmentSeparator: string; + readonly fsScandirSettings: fsScandir.Settings; + constructor(_options?: Options); + private _getValue; +} +//# sourceMappingURL=settings.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/settings.d.ts.map b/node_modules/@nodelib/fs.walk/out/settings.d.ts.map new file mode 100644 index 00000000..007e06f4 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/settings.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEvC,oBAAY,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;AACtD,oBAAY,kBAAkB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AACvD,oBAAY,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AACxD,oBAAY,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAExD,oBAAY,OAAO,GAAG;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,EAAE,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8BAA8B,CAAC,EAAE,OAAO,CAAC;CACzC,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAQ;IAgBhB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAfrC,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAqD;IACtF,SAAgB,WAAW,EAAE,MAAM,CAAuD;IAC1F,SAAgB,UAAU,EAAE,kBAAkB,GAAG,IAAI,CAAkD;IACvG,SAAgB,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAmD;IAC1G,SAAgB,WAAW,EAAE,mBAAmB,GAAG,IAAI,CAAmD;IAC1G,SAAgB,oBAAoB,EAAE,MAAM,CAAgE;IAE5G,SAAgB,iBAAiB,EAAE,SAAS,CAAC,QAAQ,CAMlD;gBAE0B,QAAQ,GAAE,OAAY;IAEnD,OAAO,CAAC,SAAS;CAGjB"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/settings.js b/node_modules/@nodelib/fs.walk/out/settings.js new file mode 100644 index 00000000..d0e46574 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/settings.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const fsScandir = require("@nodelib/fs.scandir"); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.basePath = this._getValue(this._options.basePath, undefined); + this.concurrency = this._getValue(this._options.concurrency, Infinity); + this.deepFilter = this._getValue(this._options.deepFilter, null); + this.entryFilter = this._getValue(this._options.entryFilter, null); + this.errorFilter = this._getValue(this._options.errorFilter, null); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.fsScandirSettings = new fsScandir.Settings({ + followSymbolicLinks: this._options.followSymbolicLinks, + fs: this._options.fs, + pathSegmentSeparator: this._options.pathSegmentSeparator, + stats: this._options.stats, + throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option !== null && option !== void 0 ? option : value; + } +} +exports.default = Settings; diff --git a/node_modules/@nodelib/fs.walk/out/settings.spec.d.ts b/node_modules/@nodelib/fs.walk/out/settings.spec.d.ts new file mode 100644 index 00000000..ff5bc0fd --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/settings.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=settings.spec.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/settings.spec.d.ts.map b/node_modules/@nodelib/fs.walk/out/settings.spec.d.ts.map new file mode 100644 index 00000000..b69e1aa7 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/settings.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"settings.spec.d.ts","sourceRoot":"","sources":["../src/settings.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/settings.spec.js b/node_modules/@nodelib/fs.walk/out/settings.spec.js new file mode 100644 index 00000000..ed076888 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/settings.spec.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert = require("assert"); +const fsScandir = require("@nodelib/fs.scandir"); +const settings_1 = require("./settings"); +describe('Settings', () => { + it('should return instance with default values', () => { + const fsWalkSettings = new settings_1.default(); + const fsScandirSettings = new fsScandir.Settings({ + followSymbolicLinks: undefined, + fs: undefined, + pathSegmentSeparator: undefined, + stats: undefined, + throwErrorOnBrokenSymbolicLink: undefined + }); + assert.strictEqual(fsWalkSettings.basePath, undefined); + assert.strictEqual(fsWalkSettings.concurrency, Infinity); + assert.strictEqual(fsWalkSettings.deepFilter, null); + assert.strictEqual(fsWalkSettings.entryFilter, null); + assert.strictEqual(fsWalkSettings.errorFilter, null); + assert.deepStrictEqual(fsWalkSettings.fsScandirSettings, fsScandirSettings); + }); + it('should return instance with custom values', () => { + const filter = () => true; + const fsWalkSettings = new settings_1.default({ entryFilter: filter }); + assert.strictEqual(fsWalkSettings.entryFilter, filter); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/out/tests/index.d.ts b/node_modules/@nodelib/fs.walk/out/tests/index.d.ts new file mode 100644 index 00000000..0e54bb8d --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/tests/index.d.ts @@ -0,0 +1,16 @@ +import * as sinon from 'sinon'; +import { Entry, Errno } from '../types'; +export declare function buildFakeFileEntry(entry?: Partial): Entry; +export declare function buildFakeDirectoryEntry(entry?: Partial): Entry; +export declare const EPERM_ERRNO: Errno; +export declare class TestAsyncReader { + read: sinon.SinonStub; + destroy: sinon.SinonStub; + onError: sinon.SinonStub; + onEntry: sinon.SinonStub; + onEnd: sinon.SinonStub; +} +export declare class TestSyncReader { + read: sinon.SinonStub; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/tests/index.d.ts.map b/node_modules/@nodelib/fs.walk/out/tests/index.d.ts.map new file mode 100644 index 00000000..a0c2c66c --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tests/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAOhE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAOrE;AAED,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC;AAEF,qBAAa,eAAe;IACpB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAgB;IACrC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAgB;IACxC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAgB;IACxC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAgB;IACxC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAgB;CAC7C;AAED,qBAAa,cAAc;IACnB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAgB;CAC5C"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/tests/index.js b/node_modules/@nodelib/fs.walk/out/tests/index.js new file mode 100644 index 00000000..a53715fb --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/tests/index.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TestSyncReader = exports.TestAsyncReader = exports.EPERM_ERRNO = exports.buildFakeDirectoryEntry = exports.buildFakeFileEntry = void 0; +const sinon = require("sinon"); +const fs_macchiato_1 = require("../../../fs.macchiato"); +function buildFakeFileEntry(entry) { + return Object.assign({ name: 'fake.txt', path: 'directory/fake.txt', dirent: new fs_macchiato_1.Dirent({ name: 'fake.txt' }) }, entry); +} +exports.buildFakeFileEntry = buildFakeFileEntry; +function buildFakeDirectoryEntry(entry) { + return Object.assign({ name: 'fake', path: 'directory/fake', dirent: new fs_macchiato_1.Dirent({ name: 'fake', isFile: false, isDirectory: true }) }, entry); +} +exports.buildFakeDirectoryEntry = buildFakeDirectoryEntry; +exports.EPERM_ERRNO = { + name: 'EPERM', + code: 'EPERM', + message: 'EPERM' +}; +class TestAsyncReader { + constructor() { + this.read = sinon.stub(); + this.destroy = sinon.stub(); + this.onError = sinon.stub(); + this.onEntry = sinon.stub(); + this.onEnd = sinon.stub(); + } +} +exports.TestAsyncReader = TestAsyncReader; +class TestSyncReader { + constructor() { + this.read = sinon.stub(); + } +} +exports.TestSyncReader = TestSyncReader; diff --git a/node_modules/@nodelib/fs.walk/out/types/index.d.ts b/node_modules/@nodelib/fs.walk/out/types/index.d.ts new file mode 100644 index 00000000..75bc4ab5 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/types/index.d.ts @@ -0,0 +1,9 @@ +/// +import * as scandir from '@nodelib/fs.scandir'; +export declare type Entry = scandir.Entry; +export declare type Errno = NodeJS.ErrnoException; +export declare type QueueItem = { + directory: string; + base?: string; +}; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/types/index.d.ts.map b/node_modules/@nodelib/fs.walk/out/types/index.d.ts.map new file mode 100644 index 00000000..1a73ab65 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/types/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAE/C,oBAAY,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AAClC,oBAAY,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC;AAE1C,oBAAY,SAAS,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,CAAC"} \ No newline at end of file diff --git a/node_modules/@nodelib/fs.walk/out/types/index.js b/node_modules/@nodelib/fs.walk/out/types/index.js new file mode 100644 index 00000000..ce03781e --- /dev/null +++ b/node_modules/@nodelib/fs.walk/out/types/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/@nodelib/fs.walk/package.json b/node_modules/@nodelib/fs.walk/package.json new file mode 100644 index 00000000..2ce097ca --- /dev/null +++ b/node_modules/@nodelib/fs.walk/package.json @@ -0,0 +1,67 @@ +{ + "_args": [ + [ + "@nodelib/fs.walk@1.2.6", + "/workspaces/upload-google-play" + ] + ], + "_from": "@nodelib/fs.walk@1.2.6", + "_id": "@nodelib/fs.walk@1.2.6", + "_inBundle": false, + "_integrity": "sha512-8Broas6vTtW4GIXTAHDoE32hnN2M5ykgCpWGbuXHQ15vEMqr23pB76e/GZcYsZCHALv50ktd24qhEyKr6wBtow==", + "_location": "/@nodelib/fs.walk", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "@nodelib/fs.walk@1.2.6", + "name": "@nodelib/fs.walk", + "escapedName": "@nodelib%2ffs.walk", + "scope": "@nodelib", + "rawSpec": "1.2.6", + "saveSpec": null, + "fetchSpec": "1.2.6" + }, + "_requiredBy": [ + "/fast-glob" + ], + "_resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.6.tgz", + "_spec": "1.2.6", + "_where": "/workspaces/upload-google-play", + "dependencies": { + "@nodelib/fs.scandir": "2.1.4", + "fastq": "^1.6.0" + }, + "description": "A library for efficiently walking a directory recursively", + "engines": { + "node": ">= 8" + }, + "gitHead": "bd149ea6dc1ef18c234730278271f6a7f3882ed2", + "keywords": [ + "NodeLib", + "fs", + "FileSystem", + "file system", + "walk", + "scanner", + "crawler" + ], + "license": "MIT", + "main": "out/index.js", + "name": "@nodelib/fs.walk", + "repository": { + "type": "git", + "url": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk" + }, + "scripts": { + "build": "npm run clean && npm run compile && npm run lint && npm test", + "clean": "rimraf {tsconfig.tsbuildinfo,out}", + "compile": "tsc -b .", + "compile:watch": "tsc -p . --watch --sourceMap", + "lint": "eslint \"src/**/*.ts\" --cache", + "test": "mocha \"out/**/*.spec.js\" -s 0", + "watch": "npm run clean && npm run compile:watch" + }, + "typings": "out/index.d.ts", + "version": "1.2.6" +} diff --git a/node_modules/@nodelib/fs.walk/src/index.spec.ts b/node_modules/@nodelib/fs.walk/src/index.spec.ts new file mode 100644 index 00000000..6a2913e4 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/index.spec.ts @@ -0,0 +1,129 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; +import { Readable } from 'stream'; + +import * as rimraf from 'rimraf'; + +import { Errno } from './types'; +import { walk, walkSync, walkStream, Settings, Entry } from '.'; + +const entryFilter = (entry: Entry): boolean => !entry.dirent.isDirectory(); + +function streamToPromise(stream: Readable): Promise { + const entries: Entry[] = []; + + return new Promise((resolve, reject) => { + stream.on('data', (entry: Entry) => entries.push(entry)); + stream.once('error', reject); + stream.once('end', () => resolve(entries)); + }); +} + +describe('Package', () => { + before(() => { + rimraf.sync('fixtures'); + + fs.mkdirSync('fixtures'); + fs.writeFileSync('fixtures/file.txt', ''); + fs.mkdirSync('fixtures/nested'); + fs.writeFileSync('fixtures/nested/file.txt', ''); + }); + + after(() => { + rimraf.sync('fixtures'); + }); + + describe('.walk', () => { + it('should throw an error for non-exist directory', (done) => { + walk('non-exist-directory', (error, entries) => { + assert.strictEqual(error.code, 'ENOENT'); + assert.strictEqual(entries, undefined); + done(); + }); + }); + + it('should work without options or settings', (done) => { + walk('fixtures', (error, entries) => { + assert.strictEqual(error, null); + assert.strictEqual(entries.length, 3); + done(); + }); + }); + + it('should work with options', (done) => { + walk('fixtures', { entryFilter }, (error, entries) => { + assert.strictEqual(error, null); + assert.strictEqual(entries.length, 2); + done(); + }); + }); + + it('should work with settings', (done) => { + const settings = new Settings({ entryFilter }); + + walk('fixtures', settings, (error, entries) => { + assert.strictEqual(error, null); + assert.strictEqual(entries.length, 2); + done(); + }); + }); + }); + + describe('.walkStream', () => { + it('should throw an error for non-exist directory', async () => { + const stream = walkStream('non-exist-directory'); + + await assert.rejects(() => streamToPromise(stream), (error: Errno) => error.code === 'ENOENT'); + }); + + it('should work without options or settings', async () => { + const stream = walkStream('fixtures'); + const actual = await streamToPromise(stream); + + assert.strictEqual(actual.length, 3); + }); + + it('should work with options', async () => { + const stream = walkStream('fixtures', { entryFilter }); + const actual = await streamToPromise(stream); + + assert.strictEqual(actual.length, 2); + }); + + it('should work with settings', async () => { + const settings = new Settings({ entryFilter }); + const stream = walkStream('fixtures', settings); + const actual = await streamToPromise(stream); + + assert.strictEqual(actual.length, 2); + }); + }); + + describe('.walkSync', () => { + it('should throw an error for non-exist directory', () => { + const matcher = (error: Errno): boolean => error.code === 'ENOENT'; + + assert.throws(() => walkSync('non-exist-directory'), matcher); + }); + + it('should work without options or settings', () => { + const actual = walkSync('fixtures'); + + assert.strictEqual(actual.length, 3); + }); + + it('should work with options', () => { + const actual = walkSync('fixtures', { entryFilter }); + + assert.strictEqual(actual.length, 2); + }); + + it('should work with settings', () => { + const settings = new Settings({ entryFilter }); + + const actual = walkSync('fixtures', settings); + + assert.strictEqual(actual.length, 2); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/index.ts b/node_modules/@nodelib/fs.walk/src/index.ts new file mode 100644 index 00000000..5600dbfd --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/index.ts @@ -0,0 +1,63 @@ +import { Readable } from 'stream'; + +import { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir'; + +import AsyncProvider, { AsyncCallback } from './providers/async'; +import StreamProvider from './providers/stream'; +import SyncProvider from './providers/sync'; +import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings'; +import { Entry } from './types'; + +function walk(directory: string, callback: AsyncCallback): void; +function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void; +function walk(directory: string, optionsOrSettingsOrCallback: Options | Settings | AsyncCallback, callback?: AsyncCallback): void { + if (typeof optionsOrSettingsOrCallback === 'function') { + return new AsyncProvider(directory, getSettings()).read(optionsOrSettingsOrCallback); + } + + new AsyncProvider(directory, getSettings(optionsOrSettingsOrCallback)).read(callback as AsyncCallback); +} + +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +declare namespace walk { + function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise; +} + +function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[] { + const settings = getSettings(optionsOrSettings); + const provider = new SyncProvider(directory, settings); + + return provider.read(); +} + +function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable { + const settings = getSettings(optionsOrSettings); + const provider = new StreamProvider(directory, settings); + + return provider.read(); +} + +function getSettings(settingsOrOptions: Settings | Options = {}): Settings { + if (settingsOrOptions instanceof Settings) { + return settingsOrOptions; + } + + return new Settings(settingsOrOptions); +} + +export { + walk, + walkSync, + walkStream, + Settings, + + AsyncCallback, + Dirent, + Entry, + FileSystemAdapter, + Options, + DeepFilterFunction, + EntryFilterFunction, + ErrorFilterFunction +}; diff --git a/node_modules/@nodelib/fs.walk/src/providers/async.spec.ts b/node_modules/@nodelib/fs.walk/src/providers/async.spec.ts new file mode 100644 index 00000000..83f540ad --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/providers/async.spec.ts @@ -0,0 +1,57 @@ +import * as assert from 'assert'; + +import * as sinon from 'sinon'; + +import AsyncReader from '../readers/async'; +import Settings from '../settings'; +import * as tests from '../tests'; +import AsyncProvider from './async'; + +class TestProvider extends AsyncProvider { + protected readonly _reader: AsyncReader = new tests.TestAsyncReader() as unknown as AsyncReader; + + constructor(_root: string, _settings: Settings = new Settings()) { + super(_root, _settings); + } + + public get reader(): tests.TestAsyncReader { + return this._reader as unknown as tests.TestAsyncReader; + } +} + +describe('Providers → Async', () => { + describe('.read', () => { + it('should call reader function with correct set of arguments', () => { + const provider = new TestProvider('directory'); + const fakeCallback = sinon.stub(); + + provider.read(fakeCallback); + + assert.ok(provider.reader.read.called); + }); + + it('should call callback with error for failed launch', () => { + const provider = new TestProvider('directory'); + const fakeCallback = sinon.stub(); + + provider.reader.onError.yields(tests.EPERM_ERRNO); + + provider.read(fakeCallback); + + assert.deepStrictEqual(fakeCallback.args, [[tests.EPERM_ERRNO]]); + }); + + it('should push entries to storage and call callback with array of entries', () => { + const provider = new TestProvider('directory'); + const fakeEntry = tests.buildFakeFileEntry(); + const fakeCallback = sinon.stub(); + + provider.reader.onEntry.yields(fakeEntry); + provider.reader.onEnd.yields(); + + provider.read(fakeCallback); + + assert.deepStrictEqual(fakeCallback.args, [[null, [fakeEntry]]]); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/providers/async.ts b/node_modules/@nodelib/fs.walk/src/providers/async.ts new file mode 100644 index 00000000..0a59460c --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/providers/async.ts @@ -0,0 +1,40 @@ +import AsyncReader from '../readers/async'; +import Settings from '../settings'; +import { Entry, Errno } from '../types'; + +type FailureCallback = (err: Errno) => void; +type SuccessCallback = (err: null, entries: Entry[]) => void; + +export type AsyncCallback = (err: Errno, entries: Entry[]) => void; + +export default class AsyncProvider { + protected readonly _reader: AsyncReader = new AsyncReader(this._root, this._settings); + + private readonly _storage: Set = new Set(); + + constructor(private readonly _root: string, private readonly _settings: Settings) { } + + public read(callback: AsyncCallback): void { + this._reader.onError((error) => { + callFailureCallback(callback, error); + }); + + this._reader.onEntry((entry: Entry) => { + this._storage.add(entry); + }); + + this._reader.onEnd(() => { + callSuccessCallback(callback, [...this._storage]); + }); + + this._reader.read(); + } +} + +function callFailureCallback(callback: AsyncCallback, error: Errno): void { + (callback as FailureCallback)(error); +} + +function callSuccessCallback(callback: AsyncCallback, entries: Entry[]): void { + (callback as unknown as SuccessCallback)(null, entries); +} diff --git a/node_modules/@nodelib/fs.walk/src/providers/index.ts b/node_modules/@nodelib/fs.walk/src/providers/index.ts new file mode 100644 index 00000000..fa062301 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/providers/index.ts @@ -0,0 +1,9 @@ +import AsyncProvider from './async'; +import StreamProvider from './stream'; +import SyncProvider from './sync'; + +export { + AsyncProvider, + StreamProvider, + SyncProvider +}; diff --git a/node_modules/@nodelib/fs.walk/src/providers/stream.spec.ts b/node_modules/@nodelib/fs.walk/src/providers/stream.spec.ts new file mode 100644 index 00000000..b96f41c4 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/providers/stream.spec.ts @@ -0,0 +1,90 @@ +import * as assert from 'assert'; +import { Readable } from 'stream'; + +import * as sinon from 'sinon'; + +import AsyncReader from '../readers/async'; +import Settings from '../settings'; +import * as tests from '../tests'; +import StreamProvider from './stream'; + +class TestProvider extends StreamProvider { + protected readonly _reader: AsyncReader = new tests.TestAsyncReader() as unknown as AsyncReader; + + constructor(_root: string, _settings: Settings = new Settings()) { + super(_root, _settings); + + this._stream.emit = sinon.stub(); + this._stream.push = sinon.stub(); + } + + public get reader(): tests.TestAsyncReader { + return this._reader as unknown as tests.TestAsyncReader; + } + + public get stream(): sinon.SinonStubbedInstance { + return this._stream as unknown as sinon.SinonStubbedInstance; + } +} + +describe('Providers → Stream', () => { + describe('.read', () => { + it('should return stream', () => { + const provider = new TestProvider('directory'); + + const stream = provider.read(); + + assert.ok(stream instanceof Readable); + }); + + it('should call reader function with correct set of arguments', () => { + const provider = new TestProvider('directory'); + + provider.read(); + + assert.ok(provider.reader.read.called); + }); + + it('should re-emit the "error" event from reader', () => { + const provider = new TestProvider('directory'); + + provider.reader.onError.yields(tests.EPERM_ERRNO); + + provider.read(); + + assert.deepStrictEqual(provider.stream.emit.args, [['error', tests.EPERM_ERRNO]]); + }); + + it('should call the "push" method with entry value for the "entry" event from reader', () => { + const provider = new TestProvider('directory'); + const fakeEntry = tests.buildFakeFileEntry(); + + provider.reader.onEntry.yields(fakeEntry); + + provider.read(); + + assert.deepStrictEqual(provider.stream.push.args, [[fakeEntry]]); + }); + + it('should call the "push" method with "null" value for the "end" event from reader', () => { + const provider = new TestProvider('directory'); + + provider.reader.onEnd.yields(); + + provider.read(); + + assert.deepStrictEqual(provider.stream.push.args, [[null]]); + }); + + it('should do not destroy reader when it is already destroyed', () => { + const provider = new TestProvider('directory'); + + const stream = provider.read(); + + stream.destroy(); + + assert.ok(stream.destroyed); + assert.doesNotThrow(() => stream.destroy()); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/providers/stream.ts b/node_modules/@nodelib/fs.walk/src/providers/stream.ts new file mode 100644 index 00000000..a43a93a0 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/providers/stream.ts @@ -0,0 +1,36 @@ +import { Readable } from 'stream'; +import AsyncReader from '../readers/async'; +import Settings from '../settings'; + +export default class StreamProvider { + protected readonly _reader: AsyncReader = new AsyncReader(this._root, this._settings); + protected readonly _stream: Readable = new Readable({ + objectMode: true, + read: () => { /* noop */ }, + destroy: () => { + if (!this._reader.isDestroyed) { + this._reader.destroy(); + } + } + }); + + constructor(private readonly _root: string, private readonly _settings: Settings) { } + + public read(): Readable { + this._reader.onError((error) => { + this._stream.emit('error', error); + }); + + this._reader.onEntry((entry) => { + this._stream.push(entry); + }); + + this._reader.onEnd(() => { + this._stream.push(null); + }); + + this._reader.read(); + + return this._stream; + } +} diff --git a/node_modules/@nodelib/fs.walk/src/providers/sync.spec.ts b/node_modules/@nodelib/fs.walk/src/providers/sync.spec.ts new file mode 100644 index 00000000..1f45f831 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/providers/sync.spec.ts @@ -0,0 +1,34 @@ +import * as assert from 'assert'; + +import SyncReader from '../readers/sync'; +import Settings from '../settings'; +import * as tests from '../tests'; +import SyncProvider from './sync'; + +class TestProvider extends SyncProvider { + protected readonly _reader: SyncReader = new tests.TestSyncReader() as unknown as SyncReader; + + constructor(_root: string, _settings: Settings = new Settings()) { + super(_root, _settings); + } + + public get reader(): tests.TestSyncReader { + return this._reader as unknown as tests.TestSyncReader; + } +} + +describe('Providers → Sync', () => { + describe('.read', () => { + it('should call reader function with correct set of arguments and got result', () => { + const provider = new TestProvider('directory'); + const fakeEntry = tests.buildFakeFileEntry(); + + provider.reader.read.returns([fakeEntry]); + + const actual = provider.read(); + + assert.deepStrictEqual(actual, [fakeEntry]); + assert.ok(provider.reader.read.called); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/providers/sync.ts b/node_modules/@nodelib/fs.walk/src/providers/sync.ts new file mode 100644 index 00000000..3a951c9d --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/providers/sync.ts @@ -0,0 +1,13 @@ +import SyncReader from '../readers/sync'; +import Settings from '../settings'; +import { Entry } from '../types'; + +export default class SyncProvider { + protected readonly _reader: SyncReader = new SyncReader(this._root, this._settings); + + constructor(private readonly _root: string, private readonly _settings: Settings) { } + + public read(): Entry[] { + return this._reader.read(); + } +} diff --git a/node_modules/@nodelib/fs.walk/src/readers/async.spec.ts b/node_modules/@nodelib/fs.walk/src/readers/async.spec.ts new file mode 100644 index 00000000..07754390 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/readers/async.spec.ts @@ -0,0 +1,232 @@ +import * as assert from 'assert'; +import * as path from 'path'; + +import * as fsScandir from '@nodelib/fs.scandir'; +import * as sinon from 'sinon'; + +import Settings from '../settings'; +import * as tests from '../tests'; +import { Entry } from '../types'; +import AsyncReader from './async'; + +type ScandirSignature = typeof fsScandir.scandir; + +class TestReader extends AsyncReader { + protected readonly _scandir: ScandirSignature = sinon.stub() as unknown as ScandirSignature; + + constructor(_root: string, _settings: Settings = new Settings()) { + super(_root, _settings); + } + + public get scandir(): sinon.SinonStub { + return this._scandir as unknown as sinon.SinonStub; + } +} + +describe('Readers → Async', () => { + describe('.read', () => { + it('should emit "error" event when the first call of scandir is broken', (done) => { + const reader = new TestReader('non-exist-directory'); + + reader.scandir.yields(tests.EPERM_ERRNO); + + reader.onError((error) => { + assert.ok(error); + done(); + }); + + reader.read(); + }); + + it('should emit "end" event when the first call of scandir is broken but this error can be suppressed', (done) => { + const settings = new Settings({ + errorFilter: (error) => error.code === 'EPERM' + }); + const reader = new TestReader('non-exist-directory', settings); + + reader.scandir.yields(tests.EPERM_ERRNO); + + reader.onEnd(() => { + done(); + }); + + reader.read(); + }); + + it('should do not emit events after first broken scandir call', (done) => { + const reader = new TestReader('directory'); + + const firstFakeDirectoryEntry = tests.buildFakeDirectoryEntry({ name: 'a', path: 'directory/a' }); + const secondFakeDirectoryEntry = tests.buildFakeDirectoryEntry({ name: 'b', path: 'directory/b' }); + + reader.scandir.onFirstCall().yields(null, [firstFakeDirectoryEntry, secondFakeDirectoryEntry]); + reader.scandir.onSecondCall().yieldsAsync(tests.EPERM_ERRNO); + reader.scandir.onThirdCall().yieldsAsync(tests.EPERM_ERRNO); + + /** + * If the behavior is broken, then a third scandir call will trigger an unhandled error. + */ + reader.onError((error) => { + assert.ok(error); + done(); + }); + + reader.read(); + }); + + it('should return entries', (done) => { + const reader = new TestReader('directory'); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + + const entries: Entry[] = []; + + reader.onEntry((entry) => entries.push(entry)); + + reader.onEnd(() => { + assert.deepStrictEqual(entries, [fakeDirectoryEntry, fakeFileEntry]); + done(); + }); + + reader.read(); + }); + + it('should push to results only directories', (done) => { + const settings = new Settings({ entryFilter: (entry) => !entry.dirent.isFile() }); + const reader = new TestReader('directory', settings); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + + const entries: Entry[] = []; + + reader.onEntry((entry) => entries.push(entry)); + + reader.onEnd(() => { + assert.deepStrictEqual(entries, [fakeDirectoryEntry]); + done(); + }); + + reader.read(); + }); + + it('should do not read root directory', (done) => { + const settings = new Settings({ deepFilter: () => false }); + const reader = new TestReader('directory', settings); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + + const entries: Entry[] = []; + + reader.onEntry((entry) => entries.push(entry)); + + reader.onEnd(() => { + assert.deepStrictEqual(entries, [fakeDirectoryEntry]); + done(); + }); + + reader.read(); + }); + + it('should set base path to entry when the `basePath` option is exist', (done) => { + const settings = new Settings({ basePath: 'base' }); + const reader = new TestReader('directory', settings); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + + const entries: Entry[] = []; + + reader.onEntry((entry) => entries.push(entry)); + + reader.onEnd(() => { + assert.strictEqual(entries[0].path, path.join('base', fakeDirectoryEntry.name)); + assert.strictEqual(entries[1].path, path.join('base', 'fake', fakeFileEntry.name)); + done(); + }); + + reader.read(); + }); + + it('should set base path to entry when the `basePath` option is exist and value is an empty string', (done) => { + const settings = new Settings({ basePath: '' }); + const reader = new TestReader('directory', settings); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().yields(null, [fakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + + const entries: Entry[] = []; + + reader.onEntry((entry) => entries.push(entry)); + + reader.onEnd(() => { + assert.strictEqual(entries[0].path, path.join(fakeDirectoryEntry.name)); + assert.strictEqual(entries[1].path, path.join('fake', fakeFileEntry.name)); + done(); + }); + + reader.read(); + }); + }); + + describe('.destroy', () => { + it('should do not emit entries after destroy', (done) => { + const reader = new TestReader('directory'); + + const firstFakeDirectoryEntry = tests.buildFakeDirectoryEntry({ name: 'a', path: 'directory/a' }); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().yields(null, [firstFakeDirectoryEntry]); + reader.scandir.onSecondCall().yields(null, [fakeFileEntry]); + + reader.onEntry((entry) => { + if (entry.name === 'a') { + reader.destroy(); + } else { + assert.fail('should do not emit entries after destroy'); + } + }); + + reader.onEnd(() => { + done(); + }); + + reader.read(); + }); + + it('should mark stream as "destroyed" after first destroy', () => { + const reader = new TestReader('directory'); + + reader.destroy(); + + assert.ok(reader.isDestroyed); + }); + + it('should throw an error when trying to destroy reader twice', () => { + const reader = new TestReader('directory'); + + const expectedErrorMessageRe = /The reader is already destroyed/; + + reader.destroy(); + + assert.throws(() => reader.destroy(), expectedErrorMessageRe); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/readers/async.ts b/node_modules/@nodelib/fs.walk/src/readers/async.ts new file mode 100644 index 00000000..d82884a9 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/readers/async.ts @@ -0,0 +1,126 @@ +import { EventEmitter } from 'events'; + +import * as fsScandir from '@nodelib/fs.scandir'; +import * as fastq from 'fastq'; + +import Settings from '../settings'; +import { Entry, Errno, QueueItem } from '../types'; +import * as common from './common'; +import Reader from './reader'; + +type EntryEventCallback = (entry: Entry) => void; +type ErrorEventCallback = (error: Errno) => void; +type EndEventCallback = () => void; + +export default class AsyncReader extends Reader { + protected readonly _scandir: typeof fsScandir.scandir = fsScandir.scandir; + protected readonly _emitter: EventEmitter = new EventEmitter(); + + private readonly _queue: fastq.queue = fastq(this._worker.bind(this), this._settings.concurrency); + private _isFatalError: boolean = false; + private _isDestroyed: boolean = false; + + constructor(_root: string, protected readonly _settings: Settings) { + super(_root, _settings); + + this._queue.drain = () => { + if (!this._isFatalError) { + this._emitter.emit('end'); + } + }; + } + + public read(): EventEmitter { + this._isFatalError = false; + this._isDestroyed = false; + + setImmediate(() => { + this._pushToQueue(this._root, this._settings.basePath); + }); + + return this._emitter; + } + + public get isDestroyed(): boolean { + return this._isDestroyed; + } + + public destroy(): void { + if (this._isDestroyed) { + throw new Error('The reader is already destroyed'); + } + + this._isDestroyed = true; + this._queue.killAndDrain(); + } + + public onEntry(callback: EntryEventCallback): void { + this._emitter.on('entry', callback); + } + + public onError(callback: ErrorEventCallback): void { + this._emitter.once('error', callback); + } + + public onEnd(callback: EndEventCallback): void { + this._emitter.once('end', callback); + } + + private _pushToQueue(directory: string, base?: string): void { + const queueItem: QueueItem = { directory, base }; + + this._queue.push(queueItem, (error: Error | null) => { + if (error !== null) { + this._handleError(error); + } + }); + } + + private _worker(item: QueueItem, done: fastq.done): void { + this._scandir(item.directory, this._settings.fsScandirSettings, (error: NodeJS.ErrnoException | null, entries) => { + if (error !== null) { + return done(error, undefined); + } + + for (const entry of entries) { + this._handleEntry(entry, item.base); + } + + done(null as unknown as Error, undefined); + }); + } + + private _handleError(error: Error): void { + if (this._isDestroyed || !common.isFatalError(this._settings, error)) { + return; + } + + this._isFatalError = true; + this._isDestroyed = true; + this._emitter.emit('error', error); + } + + private _handleEntry(entry: Entry, base?: string): void { + if (this._isDestroyed || this._isFatalError) { + return; + } + + const fullpath = entry.path; + + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._emitEntry(entry); + } + + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, entry.path); + } + } + + private _emitEntry(entry: Entry): void { + this._emitter.emit('entry', entry); + } +} diff --git a/node_modules/@nodelib/fs.walk/src/readers/common.spec.ts b/node_modules/@nodelib/fs.walk/src/readers/common.spec.ts new file mode 100644 index 00000000..b883dddc --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/readers/common.spec.ts @@ -0,0 +1,114 @@ +import * as assert from 'assert'; +import * as path from 'path'; + +import Settings from '../settings'; +import * as tests from '../tests'; +import * as common from './common'; + +describe('Readers → Common', () => { + describe('.isFatalError', () => { + it('should return true when filter is not defined', () => { + const settings = new Settings(); + + const actual = common.isFatalError(settings, tests.EPERM_ERRNO); + + assert.ok(actual); + }); + + it('should return true when the error cannot be suppressed', () => { + const settings = new Settings({ + errorFilter: (error) => error.code === 'ENOENT' + }); + + const actual = common.isFatalError(settings, tests.EPERM_ERRNO); + + assert.ok(actual); + }); + + it('should return false when the error can be suppressed', () => { + const settings = new Settings({ + errorFilter: (error) => error.code === 'EPERM' + }); + + const actual = common.isFatalError(settings, tests.EPERM_ERRNO); + + assert.ok(!actual); + }); + }); + + describe('.isAppliedFilter', () => { + it('should return true when the filter is not defined', () => { + const settings = new Settings(); + const entry = tests.buildFakeFileEntry(); + + const actual = common.isAppliedFilter(settings.entryFilter, entry); + + assert.ok(actual); + }); + + it('should return true when the entry will be applied', () => { + const settings = new Settings({ + entryFilter: (entry) => entry.name === 'fake.txt' + }); + const fakeEntry = tests.buildFakeFileEntry(); + + const actual = common.isAppliedFilter(settings.entryFilter, fakeEntry); + + assert.ok(actual); + }); + + it('should return false when the entry will be skipped', () => { + const settings = new Settings({ + entryFilter: (entry) => entry.name !== 'fake.txt' + }); + const fakeEntry = tests.buildFakeFileEntry(); + + const actual = common.isAppliedFilter(settings.entryFilter, fakeEntry); + + assert.ok(!actual); + }); + }); + + describe('.replacePathSegmentSeparator', () => { + it('should replace path segment separator', () => { + const filepath = path.join('directory', 'file.txt'); + + const expected = 'directory_file.txt'; + + const actual = common.replacePathSegmentSeparator(filepath, '_'); + + assert.strictEqual(actual, expected); + }); + }); + + describe('.joinPathSegments', () => { + it('should return concatenated string', () => { + const expected = 'a&b'; + + const actual = common.joinPathSegments('a', 'b', '&'); + + assert.strictEqual(actual, expected); + }); + + it('should return second part of path when the first path is an empty string', () => { + const expected = 'b'; + + const actual = common.joinPathSegments('', 'b', '&'); + + assert.strictEqual(actual, expected); + }); + + it('should return correct string when the first segment ens with the separator symbol', () => { + // Unix + assert.strictEqual(common.joinPathSegments('/', 'a', '/'), '/a'); + assert.strictEqual(common.joinPathSegments('//', 'a', '/'), '//a'); + assert.strictEqual(common.joinPathSegments('/a/', 'b', '/'), '/a/b'); + + // Windows + assert.strictEqual(common.joinPathSegments('C:/', 'Users', '/'), 'C:/Users'); + assert.strictEqual(common.joinPathSegments('C:\\', 'Users', '\\'), 'C:\\Users'); + assert.strictEqual(common.joinPathSegments('//?/C:/', 'Users', '/'), '//?/C:/Users'); + assert.strictEqual(common.joinPathSegments('\\\\?\\C:\\', 'Users', '\\'), '\\\\?\\C:\\Users'); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/readers/common.ts b/node_modules/@nodelib/fs.walk/src/readers/common.ts new file mode 100644 index 00000000..eeec6674 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/readers/common.ts @@ -0,0 +1,33 @@ +import Settings, { FilterFunction } from '../settings'; +import { Errno } from '../types'; + +export function isFatalError(settings: Settings, error: Errno): boolean { + if (settings.errorFilter === null) { + return true; + } + + return !settings.errorFilter(error); +} + +export function isAppliedFilter(filter: FilterFunction | null, value: T): boolean { + return filter === null || filter(value); +} + +export function replacePathSegmentSeparator(filepath: string, separator: string): string { + return filepath.split(/[/\\]/).join(separator); +} + +export function joinPathSegments(a: string, b: string, separator: string): string { + if (a === '') { + return b; + } + + /** + * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`). + */ + if (a.endsWith(separator)) { + return a + b; + } + + return a + separator + b; +} diff --git a/node_modules/@nodelib/fs.walk/src/readers/reader.spec.ts b/node_modules/@nodelib/fs.walk/src/readers/reader.spec.ts new file mode 100644 index 00000000..2ac71bfd --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/readers/reader.spec.ts @@ -0,0 +1,30 @@ +import * as assert from 'assert'; +import * as path from 'path'; + +import Settings, { Options } from '../settings'; +import Reader from './reader'; + +class TestReader extends Reader { + public get root(): string { + return this._root; + } +} + +function getReader(root: string, options: Options = {}): TestReader { + return new TestReader(root, new Settings(options)); +} + +describe('Readers → Reader', () => { + describe('Constructor', () => { + it('should return root path with replaced path segment separators', () => { + const root = path.join('directory', 'file.txt'); + const reader = getReader(root, { pathSegmentSeparator: '_' }); + + const expected = 'directory_file.txt'; + + const actual = reader.root; + + assert.strictEqual(actual, expected); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/readers/reader.ts b/node_modules/@nodelib/fs.walk/src/readers/reader.ts new file mode 100644 index 00000000..fa434ad4 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/readers/reader.ts @@ -0,0 +1,8 @@ +import Settings from '../settings'; +import * as common from './common'; + +export default class Reader { + constructor(protected readonly _root: string, protected readonly _settings: Settings) { + this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + } +} diff --git a/node_modules/@nodelib/fs.walk/src/readers/sync.spec.ts b/node_modules/@nodelib/fs.walk/src/readers/sync.spec.ts new file mode 100644 index 00000000..d850d136 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/readers/sync.spec.ts @@ -0,0 +1,126 @@ +import * as assert from 'assert'; +import * as path from 'path'; + +import * as sinon from 'sinon'; + +import Settings from '../settings'; +import * as tests from '../tests'; +import SyncReader from './sync'; + +class TestReader extends SyncReader { + protected readonly _scandir: sinon.SinonStub = sinon.stub(); + + constructor(_root: string, _settings: Settings = new Settings()) { + super(_root, _settings); + } + + public get scandir(): sinon.SinonStub { + return this._scandir; + } +} + +describe('Readers → Sync', () => { + describe('.read', () => { + it('should throw an error when the first call of scandir is broken', () => { + const reader = new TestReader('non-exist-directory'); + + reader.scandir.throws(tests.EPERM_ERRNO); + + assert.throws(() => reader.read(), { code: 'EPERM' }); + }); + + it('should return empty array when the first call of scandir is broken but this error can be suppressed', () => { + const settings = new Settings({ + errorFilter: (error) => error.code === 'EPERM' + }); + const reader = new TestReader('non-exist-directory', settings); + + reader.scandir.throws(tests.EPERM_ERRNO); + + const actual = reader.read(); + + assert.deepStrictEqual(actual, []); + }); + + it('should return entries', () => { + const reader = new TestReader('directory'); + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + + const expected = [fakeDirectoryEntry, fakeFileEntry]; + + const actual = reader.read(); + + assert.deepStrictEqual(actual, expected); + }); + + it('should push to results only directories', () => { + const settings = new Settings({ entryFilter: (entry) => !entry.dirent.isFile() }); + const reader = new TestReader('directory', settings); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + + const expected = [fakeDirectoryEntry]; + + const actual = reader.read(); + + assert.deepStrictEqual(actual, expected); + }); + + it('should do not read root directory', () => { + const settings = new Settings({ deepFilter: () => false }); + const reader = new TestReader('directory', settings); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + + const expected = [fakeDirectoryEntry]; + + const actual = reader.read(); + + assert.deepStrictEqual(actual, expected); + }); + + it('should set base path to entry when the `basePath` option is exist', () => { + const settings = new Settings({ basePath: 'base' }); + const reader = new TestReader('directory', settings); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + + const actual = reader.read(); + + assert.strictEqual(actual[0].path, path.join('base', fakeDirectoryEntry.name)); + assert.strictEqual(actual[1].path, path.join('base', 'fake', fakeFileEntry.name)); + }); + + it('should set base path to entry when the `basePath` option is exist and value is an empty string', () => { + const settings = new Settings({ basePath: '' }); + const reader = new TestReader('directory', settings); + + const fakeDirectoryEntry = tests.buildFakeDirectoryEntry(); + const fakeFileEntry = tests.buildFakeFileEntry(); + + reader.scandir.onFirstCall().returns([fakeDirectoryEntry]); + reader.scandir.onSecondCall().returns([fakeFileEntry]); + + const actual = reader.read(); + + assert.strictEqual(actual[0].path, fakeDirectoryEntry.name); + assert.strictEqual(actual[1].path, path.join('fake', fakeFileEntry.name)); + }); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/readers/sync.ts b/node_modules/@nodelib/fs.walk/src/readers/sync.ts new file mode 100644 index 00000000..5e24f873 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/readers/sync.ts @@ -0,0 +1,69 @@ +import * as fsScandir from '@nodelib/fs.scandir'; + +import { Entry, Errno, QueueItem } from '../types'; +import * as common from './common'; +import Reader from './reader'; + +export default class SyncReader extends Reader { + protected readonly _scandir: typeof fsScandir.scandirSync = fsScandir.scandirSync; + + private readonly _storage: Set = new Set(); + private readonly _queue: Set = new Set(); + + public read(): Entry[] { + this._pushToQueue(this._root, this._settings.basePath); + this._handleQueue(); + + return [...this._storage]; + } + + private _pushToQueue(directory: string, base?: string): void { + this._queue.add({ directory, base }); + } + + private _handleQueue(): void { + for (const item of this._queue.values()) { + this._handleDirectory(item.directory, item.base); + } + } + + private _handleDirectory(directory: string, base?: string): void { + try { + const entries = this._scandir(directory, this._settings.fsScandirSettings); + + for (const entry of entries) { + this._handleEntry(entry, base); + } + } catch (error) { + this._handleError(error as Errno); + } + } + + private _handleError(error: Errno): void { + if (!common.isFatalError(this._settings, error)) { + return; + } + + throw error; + } + + private _handleEntry(entry: Entry, base?: string): void { + const fullpath = entry.path; + + if (base !== undefined) { + entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator); + } + + if (common.isAppliedFilter(this._settings.entryFilter, entry)) { + this._pushToStorage(entry); + } + + if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) { + this._pushToQueue(fullpath, entry.path); + } + } + + private _pushToStorage(entry: Entry): void { + this._storage.add(entry); + } +} diff --git a/node_modules/@nodelib/fs.walk/src/settings.spec.ts b/node_modules/@nodelib/fs.walk/src/settings.spec.ts new file mode 100644 index 00000000..2e1419e0 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/settings.spec.ts @@ -0,0 +1,33 @@ +import * as assert from 'assert'; + +import * as fsScandir from '@nodelib/fs.scandir'; + +import Settings from './settings'; + +describe('Settings', () => { + it('should return instance with default values', () => { + const fsWalkSettings = new Settings(); + const fsScandirSettings = new fsScandir.Settings({ + followSymbolicLinks: undefined, + fs: undefined, + pathSegmentSeparator: undefined, + stats: undefined, + throwErrorOnBrokenSymbolicLink: undefined + }); + + assert.strictEqual(fsWalkSettings.basePath, undefined); + assert.strictEqual(fsWalkSettings.concurrency, Infinity); + assert.strictEqual(fsWalkSettings.deepFilter, null); + assert.strictEqual(fsWalkSettings.entryFilter, null); + assert.strictEqual(fsWalkSettings.errorFilter, null); + assert.deepStrictEqual(fsWalkSettings.fsScandirSettings, fsScandirSettings); + }); + + it('should return instance with custom values', () => { + const filter = (): boolean => true; + + const fsWalkSettings = new Settings({ entryFilter: filter }); + + assert.strictEqual(fsWalkSettings.entryFilter, filter); + }); +}); diff --git a/node_modules/@nodelib/fs.walk/src/settings.ts b/node_modules/@nodelib/fs.walk/src/settings.ts new file mode 100644 index 00000000..3b7a25ad --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/settings.ts @@ -0,0 +1,46 @@ +import * as path from 'path'; + +import * as fsScandir from '@nodelib/fs.scandir'; + +import { Entry, Errno } from './types'; + +export type FilterFunction = (value: T) => boolean; +export type DeepFilterFunction = FilterFunction; +export type EntryFilterFunction = FilterFunction; +export type ErrorFilterFunction = FilterFunction; + +export type Options = { + basePath?: string; + concurrency?: number; + deepFilter?: DeepFilterFunction; + entryFilter?: EntryFilterFunction; + errorFilter?: ErrorFilterFunction; + followSymbolicLinks?: boolean; + fs?: Partial; + pathSegmentSeparator?: string; + stats?: boolean; + throwErrorOnBrokenSymbolicLink?: boolean; +}; + +export default class Settings { + public readonly basePath?: string = this._getValue(this._options.basePath, undefined); + public readonly concurrency: number = this._getValue(this._options.concurrency, Infinity); + public readonly deepFilter: DeepFilterFunction | null = this._getValue(this._options.deepFilter, null); + public readonly entryFilter: EntryFilterFunction | null = this._getValue(this._options.entryFilter, null); + public readonly errorFilter: ErrorFilterFunction | null = this._getValue(this._options.errorFilter, null); + public readonly pathSegmentSeparator: string = this._getValue(this._options.pathSegmentSeparator, path.sep); + + public readonly fsScandirSettings: fsScandir.Settings = new fsScandir.Settings({ + followSymbolicLinks: this._options.followSymbolicLinks, + fs: this._options.fs, + pathSegmentSeparator: this._options.pathSegmentSeparator, + stats: this._options.stats, + throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink + }); + + constructor(private readonly _options: Options = {}) { } + + private _getValue(option: T | undefined, value: T): T { + return option ?? value; + } +} diff --git a/node_modules/@nodelib/fs.walk/src/tests/index.ts b/node_modules/@nodelib/fs.walk/src/tests/index.ts new file mode 100644 index 00000000..651b2463 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/tests/index.ts @@ -0,0 +1,40 @@ +import * as sinon from 'sinon'; + +import { Dirent } from '../../../fs.macchiato'; +import { Entry, Errno } from '../types'; + +export function buildFakeFileEntry(entry?: Partial): Entry { + return { + name: 'fake.txt', + path: 'directory/fake.txt', + dirent: new Dirent({ name: 'fake.txt' }), + ...entry + }; +} + +export function buildFakeDirectoryEntry(entry?: Partial): Entry { + return { + name: 'fake', + path: 'directory/fake', + dirent: new Dirent({ name: 'fake', isFile: false, isDirectory: true }), + ...entry + }; +} + +export const EPERM_ERRNO: Errno = { + name: 'EPERM', + code: 'EPERM', + message: 'EPERM' +}; + +export class TestAsyncReader { + public read: sinon.SinonStub = sinon.stub(); + public destroy: sinon.SinonStub = sinon.stub(); + public onError: sinon.SinonStub = sinon.stub(); + public onEntry: sinon.SinonStub = sinon.stub(); + public onEnd: sinon.SinonStub = sinon.stub(); +} + +export class TestSyncReader { + public read: sinon.SinonStub = sinon.stub(); +} diff --git a/node_modules/@nodelib/fs.walk/src/types/index.ts b/node_modules/@nodelib/fs.walk/src/types/index.ts new file mode 100644 index 00000000..3dba47a9 --- /dev/null +++ b/node_modules/@nodelib/fs.walk/src/types/index.ts @@ -0,0 +1,9 @@ +import * as scandir from '@nodelib/fs.scandir'; + +export type Entry = scandir.Entry; +export type Errno = NodeJS.ErrnoException; + +export type QueueItem = { + directory: string; + base?: string; +}; diff --git a/node_modules/@nodelib/fs.walk/tsconfig.json b/node_modules/@nodelib/fs.walk/tsconfig.json new file mode 100644 index 00000000..3202b34f --- /dev/null +++ b/node_modules/@nodelib/fs.walk/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "rootDir": "src", + "outDir": "out" + }, + "references": [ + { + "path": "../fs.macchiato" + }, + { + "path": "../fs.scandir" + } + ] +} diff --git a/node_modules/fast-glob/LICENSE b/node_modules/fast-glob/LICENSE new file mode 100644 index 00000000..65a99946 --- /dev/null +++ b/node_modules/fast-glob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Denis Malinochkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/fast-glob/README.md b/node_modules/fast-glob/README.md new file mode 100644 index 00000000..5a913a64 --- /dev/null +++ b/node_modules/fast-glob/README.md @@ -0,0 +1,793 @@ +# fast-glob + +> It's a very fast and efficient [glob][glob_definition] library for [Node.js][node_js]. + +This package provides methods for traversing the file system and returning pathnames that matched a defined set of a specified pattern according to the rules used by the Unix Bash shell with some simplifications, meanwhile results are returned in **arbitrary order**. Quick, simple, effective. + +## Table of Contents + +
+Details + +* [Highlights](#highlights) +* [Donation](#donation) +* [Old and modern mode](#old-and-modern-mode) +* [Pattern syntax](#pattern-syntax) + * [Basic syntax](#basic-syntax) + * [Advanced syntax](#advanced-syntax) +* [Installation](#installation) +* [API](#api) + * [Asynchronous](#asynchronous) + * [Synchronous](#synchronous) + * [Stream](#stream) + * [patterns](#patterns) + * [[options]](#options) + * [Helpers](#helpers) + * [generateTasks](#generatetaskspatterns-options) + * [isDynamicPattern](#isdynamicpatternpattern-options) + * [escapePath](#escapepathpattern) +* [Options](#options-3) + * [Common](#common) + * [concurrency](#concurrency) + * [cwd](#cwd) + * [deep](#deep) + * [followSymbolicLinks](#followsymboliclinks) + * [fs](#fs) + * [ignore](#ignore) + * [suppressErrors](#suppresserrors) + * [throwErrorOnBrokenSymbolicLink](#throwerroronbrokensymboliclink) + * [Output control](#output-control) + * [absolute](#absolute) + * [markDirectories](#markdirectories) + * [objectMode](#objectmode) + * [onlyDirectories](#onlydirectories) + * [onlyFiles](#onlyfiles) + * [stats](#stats) + * [unique](#unique) + * [Matching control](#matching-control) + * [braceExpansion](#braceexpansion) + * [caseSensitiveMatch](#casesensitivematch) + * [dot](#dot) + * [extglob](#extglob) + * [globstar](#globstar) + * [baseNameMatch](#basenamematch) +* [FAQ](#faq) + * [What is a static or dynamic pattern?](#what-is-a-static-or-dynamic-pattern) + * [How to write patterns on Windows?](#how-to-write-patterns-on-windows) + * [Why are parentheses match wrong?](#why-are-parentheses-match-wrong) + * [How to exclude directory from reading?](#how-to-exclude-directory-from-reading) + * [How to use UNC path?](#how-to-use-unc-path) + * [Compatible with `node-glob`?](#compatible-with-node-glob) +* [Benchmarks](#benchmarks) + * [Server](#server) + * [Nettop](#nettop) +* [Changelog](#changelog) +* [License](#license) + +
+ +## Highlights + +* Fast. Probably the fastest. +* Supports multiple and negative patterns. +* Synchronous, Promise and Stream API. +* Object mode. Can return more than just strings. +* Error-tolerant. + +## Donation + +Do you like this project? Support it by donating, creating an issue or pull request. + +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)][paypal_mrmlnc] + +## Old and modern mode + +This package works in two modes, depending on the environment in which it is used. + +* **Old mode**. Node.js below 10.10 or when the [`stats`](#stats) option is *enabled*. +* **Modern mode**. Node.js 10.10+ and the [`stats`](#stats) option is *disabled*. + +The modern mode is faster. Learn more about the [internal mechanism][nodelib_fs_scandir_old_and_modern_modern]. + +## Pattern syntax + +> :warning: Always use forward-slashes in glob expressions (patterns and [`ignore`](#ignore) option). Use backslashes for escaping characters. + +There is more than one form of syntax: basic and advanced. Below is a brief overview of the supported features. Also pay attention to our [FAQ](#faq). + +> :book: This package uses a [`micromatch`][micromatch] as a library for pattern matching. + +### Basic syntax + +* An asterisk (`*`) — matches everything except slashes (path separators), hidden files (names starting with `.`). +* A double star or globstar (`**`) — matches zero or more directories. +* Question mark (`?`) – matches any single character except slashes (path separators). +* Sequence (`[seq]`) — matches any character in sequence. + +> :book: A few additional words about the [basic matching behavior][picomatch_matching_behavior]. + +Some examples: + +* `src/**/*.js` — matches all files in the `src` directory (any level of nesting) that have the `.js` extension. +* `src/*.??` — matches all files in the `src` directory (only first level of nesting) that have a two-character extension. +* `file-[01].js` — matches files: `file-0.js`, `file-1.js`. + +### Advanced syntax + +* [Escapes characters][micromatch_backslashes] (`\\`) — matching special characters (`$^*+?()[]`) as literals. +* [POSIX character classes][picomatch_posix_brackets] (`[[:digit:]]`). +* [Extended globs][micromatch_extglobs] (`?(pattern-list)`). +* [Bash style brace expansions][micromatch_braces] (`{}`). +* [Regexp character classes][micromatch_regex_character_classes] (`[1-5]`). +* [Regex groups][regular_expressions_brackets] (`(a|b)`). + +> :book: A few additional words about the [advanced matching behavior][micromatch_extended_globbing]. + +Some examples: + +* `src/**/*.{css,scss}` — matches all files in the `src` directory (any level of nesting) that have the `.css` or `.scss` extension. +* `file-[[:digit:]].js` — matches files: `file-0.js`, `file-1.js`, …, `file-9.js`. +* `file-{1..3}.js` — matches files: `file-1.js`, `file-2.js`, `file-3.js`. +* `file-(1|2)` — matches files: `file-1.js`, `file-2.js`. + +## Installation + +```console +npm install fast-glob +``` + +## API + +### Asynchronous + +```js +fg(patterns, [options]) +``` + +Returns a `Promise` with an array of matching entries. + +```js +const fg = require('fast-glob'); + +const entries = await fg(['.editorconfig', '**/index.js'], { dot: true }); + +// ['.editorconfig', 'services/index.js'] +``` + +### Synchronous + +```js +fg.sync(patterns, [options]) +``` + +Returns an array of matching entries. + +```js +const fg = require('fast-glob'); + +const entries = fg.sync(['.editorconfig', '**/index.js'], { dot: true }); + +// ['.editorconfig', 'services/index.js'] +``` + +### Stream + +```js +fg.stream(patterns, [options]) +``` + +Returns a [`ReadableStream`][node_js_stream_readable_streams] when the `data` event will be emitted with matching entry. + +```js +const fg = require('fast-glob'); + +const stream = fg.stream(['.editorconfig', '**/index.js'], { dot: true }); + +for await (const entry of stream) { + // .editorconfig + // services/index.js +} +``` + +#### patterns + +* Required: `true` +* Type: `string | string[]` + +Any correct pattern(s). + +> :1234: [Pattern syntax](#pattern-syntax) +> +> :warning: This package does not respect the order of patterns. First, all the negative patterns are applied, and only then the positive patterns. If you want to get a certain order of records, use sorting or split calls. + +#### [options] + +* Required: `false` +* Type: [`Options`](#options-3) + +See [Options](#options-3) section. + +### Helpers + +#### `generateTasks(patterns, [options])` + +Returns the internal representation of patterns ([`Task`](./src/managers/tasks.ts) is a combining patterns by base directory). + +```js +fg.generateTasks('*'); + +[{ + base: '.', // Parent directory for all patterns inside this task + dynamic: true, // Dynamic or static patterns are in this task + patterns: ['*'], + positive: ['*'], + negative: [] +}] +``` + +##### patterns + +* Required: `true` +* Type: `string | string[]` + +Any correct pattern(s). + +##### [options] + +* Required: `false` +* Type: [`Options`](#options-3) + +See [Options](#options-3) section. + +#### `isDynamicPattern(pattern, [options])` + +Returns `true` if the passed pattern is a dynamic pattern. + +> :1234: [What is a static or dynamic pattern?](#what-is-a-static-or-dynamic-pattern) + +```js +fg.isDynamicPattern('*'); // true +fg.isDynamicPattern('abc'); // false +``` + +##### pattern + +* Required: `true` +* Type: `string` + +Any correct pattern. + +##### [options] + +* Required: `false` +* Type: [`Options`](#options-3) + +See [Options](#options-3) section. + +#### `escapePath(pattern)` + +Returns a path with escaped special characters (`*?|(){}[]`, `!` at the beginning of line, `@+!` before the opening parenthesis). + +```js +fg.escapePath('!abc'); // \\!abc +fg.escapePath('C:/Program Files (x86)'); // C:/Program Files \\(x86\\) +``` + +##### pattern + +* Required: `true` +* Type: `string` + +Any string, for example, a path to a file. + +## Options + +### Common options + +#### concurrency + +* Type: `number` +* Default: `os.cpus().length` + +Specifies the maximum number of concurrent requests from a reader to read directories. + +> :book: The higher the number, the higher the performance and load on the file system. If you want to read in quiet mode, set the value to a comfortable number or `1`. + +#### cwd + +* Type: `string` +* Default: `process.cwd()` + +The current working directory in which to search. + +#### deep + +* Type: `number` +* Default: `Infinity` + +Specifies the maximum depth of a read directory relative to the start directory. + +For example, you have the following tree: + +```js +dir/ +└── one/ // 1 + └── two/ // 2 + └── file.js // 3 +``` + +```js +// With base directory +fg.sync('dir/**', { onlyFiles: false, deep: 1 }); // ['dir/one'] +fg.sync('dir/**', { onlyFiles: false, deep: 2 }); // ['dir/one', 'dir/one/two'] + +// With cwd option +fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 1 }); // ['one'] +fg.sync('**', { onlyFiles: false, cwd: 'dir', deep: 2 }); // ['one', 'one/two'] +``` + +> :book: If you specify a pattern with some base directory, this directory will not participate in the calculation of the depth of the found directories. Think of it as a [`cwd`](#cwd) option. + +#### followSymbolicLinks + +* Type: `boolean` +* Default: `true` + +Indicates whether to traverse descendants of symbolic link directories. + +> :book: If the [`stats`](#stats) option is specified, the information about the symbolic link (`fs.lstat`) will be replaced with information about the entry (`fs.stat`) behind it. + +#### fs + +* Type: `FileSystemAdapter` +* Default: `fs.*` + +Custom implementation of methods for working with the file system. + +```ts +export interface FileSystemAdapter { + lstat?: typeof fs.lstat; + stat?: typeof fs.stat; + lstatSync?: typeof fs.lstatSync; + statSync?: typeof fs.statSync; + readdir?: typeof fs.readdir; + readdirSync?: typeof fs.readdirSync; +} +``` + +#### ignore + +* Type: `string[]` +* Default: `[]` + +An array of glob patterns to exclude matches. This is an alternative way to use negative patterns. + +```js +dir/ +├── package-lock.json +└── package.json +``` + +```js +fg.sync(['*.json', '!package-lock.json']); // ['package.json'] +fg.sync('*.json', { ignore: ['package-lock.json'] }); // ['package.json'] +``` + +#### suppressErrors + +* Type: `boolean` +* Default: `false` + +By default this package suppress only `ENOENT` errors. Set to `true` to suppress any error. + +> :book: Can be useful when the directory has entries with a special level of access. + +#### throwErrorOnBrokenSymbolicLink + +* Type: `boolean` +* Default: `false` + +Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`. + +> :book: This option has no effect on errors when reading the symbolic link directory. + +### Output control + +#### absolute + +* Type: `boolean` +* Default: `false` + +Return the absolute path for entries. + +```js +fg.sync('*.js', { absolute: false }); // ['index.js'] +fg.sync('*.js', { absolute: true }); // ['/home/user/index.js'] +``` + +> :book: This option is required if you want to use negative patterns with absolute path, for example, `!${__dirname}/*.js`. + +#### markDirectories + +* Type: `boolean` +* Default: `false` + +Mark the directory path with the final slash. + +```js +fg.sync('*', { onlyFiles: false, markDirectories: false }); // ['index.js', 'controllers'] +fg.sync('*', { onlyFiles: false, markDirectories: true }); // ['index.js', 'controllers/'] +``` + +#### objectMode + +* Type: `boolean` +* Default: `false` + +Returns objects (instead of strings) describing entries. + +```js +fg.sync('*', { objectMode: false }); // ['src/index.js'] +fg.sync('*', { objectMode: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: }] +``` + +The object has the following fields: + +* name (`string`) — the last part of the path (basename) +* path (`string`) — full path relative to the pattern base directory +* dirent ([`fs.Dirent`][node_js_fs_class_fs_dirent]) — instance of `fs.Direct` + +> :book: An object is an internal representation of entry, so getting it does not affect performance. + +#### onlyDirectories + +* Type: `boolean` +* Default: `false` + +Return only directories. + +```js +fg.sync('*', { onlyDirectories: false }); // ['index.js', 'src'] +fg.sync('*', { onlyDirectories: true }); // ['src'] +``` + +> :book: If `true`, the [`onlyFiles`](#onlyfiles) option is automatically `false`. + +#### onlyFiles + +* Type: `boolean` +* Default: `true` + +Return only files. + +```js +fg.sync('*', { onlyFiles: false }); // ['index.js', 'src'] +fg.sync('*', { onlyFiles: true }); // ['index.js'] +``` + +#### stats + +* Type: `boolean` +* Default: `false` + +Enables an [object mode](#objectmode) with an additional field: + +* stats ([`fs.Stats`][node_js_fs_class_fs_stats]) — instance of `fs.Stats` + +```js +fg.sync('*', { stats: false }); // ['src/index.js'] +fg.sync('*', { stats: true }); // [{ name: 'index.js', path: 'src/index.js', dirent: , stats: }] +``` + +> :book: Returns `fs.stat` instead of `fs.lstat` for symbolic links when the [`followSymbolicLinks`](#followsymboliclinks) option is specified. +> +> :warning: Unlike [object mode](#objectmode) this mode requires additional calls to the file system. On average, this mode is slower at least twice. See [old and modern mode](#old-and-modern-mode) for more details. + +#### unique + +* Type: `boolean` +* Default: `true` + +Ensures that the returned entries are unique. + +```js +fg.sync(['*.json', 'package.json'], { unique: false }); // ['package.json', 'package.json'] +fg.sync(['*.json', 'package.json'], { unique: true }); // ['package.json'] +``` + +If `true` and similar entries are found, the result is the first found. + +### Matching control + +#### braceExpansion + +* Type: `boolean` +* Default: `true` + +Enables Bash-like brace expansion. + +> :1234: [Syntax description][bash_hackers_syntax_expansion_brace] or more [detailed description][micromatch_braces]. + +```js +dir/ +├── abd +├── acd +└── a{b,c}d +``` + +```js +fg.sync('a{b,c}d', { braceExpansion: false }); // ['a{b,c}d'] +fg.sync('a{b,c}d', { braceExpansion: true }); // ['abd', 'acd'] +``` + +#### caseSensitiveMatch + +* Type: `boolean` +* Default: `true` + +Enables a [case-sensitive][wikipedia_case_sensitivity] mode for matching files. + +```js +dir/ +├── file.txt +└── File.txt +``` + +```js +fg.sync('file.txt', { caseSensitiveMatch: false }); // ['file.txt', 'File.txt'] +fg.sync('file.txt', { caseSensitiveMatch: true }); // ['file.txt'] +``` + +#### dot + +* Type: `boolean` +* Default: `false` + +Allow patterns to match entries that begin with a period (`.`). + +> :book: Note that an explicit dot in a portion of the pattern will always match dot files. + +```js +dir/ +├── .editorconfig +└── package.json +``` + +```js +fg.sync('*', { dot: false }); // ['package.json'] +fg.sync('*', { dot: true }); // ['.editorconfig', 'package.json'] +``` + +#### extglob + +* Type: `boolean` +* Default: `true` + +Enables Bash-like `extglob` functionality. + +> :1234: [Syntax description][micromatch_extglobs]. + +```js +dir/ +├── README.md +└── package.json +``` + +```js +fg.sync('*.+(json|md)', { extglob: false }); // [] +fg.sync('*.+(json|md)', { extglob: true }); // ['README.md', 'package.json'] +``` + +#### globstar + +* Type: `boolean` +* Default: `true` + +Enables recursively repeats a pattern containing `**`. If `false`, `**` behaves exactly like `*`. + +```js +dir/ +└── a + └── b +``` + +```js +fg.sync('**', { onlyFiles: false, globstar: false }); // ['a'] +fg.sync('**', { onlyFiles: false, globstar: true }); // ['a', 'a/b'] +``` + +#### baseNameMatch + +* Type: `boolean` +* Default: `false` + +If set to `true`, then patterns without slashes will be matched against the basename of the path if it contains slashes. + +```js +dir/ +└── one/ + └── file.md +``` + +```js +fg.sync('*.md', { baseNameMatch: false }); // [] +fg.sync('*.md', { baseNameMatch: true }); // ['one/file.md'] +``` + +## FAQ + +## What is a static or dynamic pattern? + +All patterns can be divided into two types: + +* **static**. A pattern is considered static if it can be used to get an entry on the file system without using matching mechanisms. For example, the `file.js` pattern is a static pattern because we can just verify that it exists on the file system. +* **dynamic**. A pattern is considered dynamic if it cannot be used directly to find occurrences without using a matching mechanisms. For example, the `*` pattern is a dynamic pattern because we cannot use this pattern directly. + +A pattern is considered dynamic if it contains the following characters (`…` — any characters or their absence) or options: + +* The [`caseSensitiveMatch`](#casesensitivematch) option is disabled +* `\\` (the escape character) +* `*`, `?`, `!` (at the beginning of line) +* `[…]` +* `(…|…)` +* `@(…)`, `!(…)`, `*(…)`, `?(…)`, `+(…)` (respects the [`extglob`](#extglob) option) +* `{…,…}`, `{…..…}` (respects the [`braceExpansion`](#braceexpansion) option) + +## How to write patterns on Windows? + +Always use forward-slashes in glob expressions (patterns and [`ignore`](#ignore) option). Use backslashes for escaping characters. With the [`cwd`](#cwd) option use a convenient format. + +**Bad** + +```ts +[ + 'directory\\*', + path.join(process.cwd(), '**') +] +``` + +**Good** + +```ts +[ + 'directory/*', + path.join(process.cwd(), '**').replace(/\\/g, '/') +] +``` + +> :book: Use the [`normalize-path`][npm_normalize_path] or the [`unixify`][npm_unixify] package to convert Windows-style path to a Unix-style path. + +Read more about [matching with backslashes][micromatch_backslashes]. + +## Why are parentheses match wrong? + +```js +dir/ +└── (special-*file).txt +``` + +```js +fg.sync(['(special-*file).txt']) // [] +``` + +Refers to Bash. You need to escape special characters: + +```js +fg.sync(['\\(special-*file\\).txt']) // ['(special-*file).txt'] +``` + +Read more about [matching special characters as literals][picomatch_matching_special_characters_as_literals]. + +## How to exclude directory from reading? + +You can use a negative pattern like this: `!**/node_modules` or `!**/node_modules/**`. Also you can use [`ignore`](#ignore) option. Just look at the example below. + +```js +first/ +├── file.md +└── second/ + └── file.txt +``` + +If you don't want to read the `second` directory, you must write the following pattern: `!**/second` or `!**/second/**`. + +```js +fg.sync(['**/*.md', '!**/second']); // ['first/file.md'] +fg.sync(['**/*.md'], { ignore: ['**/second/**'] }); // ['first/file.md'] +``` + +> :warning: When you write `!**/second/**/*` it means that the directory will be **read**, but all the entries will not be included in the results. + +You have to understand that if you write the pattern to exclude directories, then the directory will not be read under any circumstances. + +## How to use UNC path? + +You cannot use [Uniform Naming Convention (UNC)][unc_path] paths as patterns (due to syntax), but you can use them as [`cwd`](#cwd) directory. + +```ts +fg.sync('*', { cwd: '\\\\?\\C:\\Python27' /* or //?/C:/Python27 */ }); +fg.sync('Python27/*', { cwd: '\\\\?\\C:\\' /* or //?/C:/ */ }); +``` + +## Compatible with `node-glob`? + +| node-glob | fast-glob | +| :----------: | :-------: | +| `cwd` | [`cwd`](#cwd) | +| `root` | – | +| `dot` | [`dot`](#dot) | +| `nomount` | – | +| `mark` | [`markDirectories`](#markdirectories) | +| `nosort` | – | +| `nounique` | [`unique`](#unique) | +| `nobrace` | [`braceExpansion`](#braceexpansion) | +| `noglobstar` | [`globstar`](#globstar) | +| `noext` | [`extglob`](#extglob) | +| `nocase` | [`caseSensitiveMatch`](#casesensitivematch) | +| `matchBase` | [`baseNameMatch`](#basenamematch) | +| `nodir` | [`onlyFiles`](#onlyfiles) | +| `ignore` | [`ignore`](#ignore) | +| `follow` | [`followSymbolicLinks`](#followsymboliclinks) | +| `realpath` | – | +| `absolute` | [`absolute`](#absolute) | + +## Benchmarks + +### Server + +Link: [Vultr Bare Metal][vultr_pricing_baremetal] + +* Processor: E3-1270v6 (8 CPU) +* RAM: 32GB +* Disk: SSD ([Intel DC S3520 SSDSC2BB240G7][intel_ssd]) + +You can see results [here][github_gist_benchmark_server] for latest release. + +### Nettop + +Link: [Zotac bi323][zotac_bi323] + +* Processor: Intel N3150 (4 CPU) +* RAM: 8GB +* Disk: SSD ([Silicon Power SP060GBSS3S55S25][silicon_power_ssd]) + +You can see results [here][github_gist_benchmark_nettop] for latest release. + +## Changelog + +See the [Releases section of our GitHub project][github_releases] for changelog for each release version. + +## License + +This software is released under the terms of the MIT license. + +[bash_hackers_syntax_expansion_brace]: https://wiki.bash-hackers.org/syntax/expansion/brace +[github_gist_benchmark_nettop]: https://gist.github.com/mrmlnc/f06246b197f53c356895fa35355a367c#file-fg-benchmark-nettop-product-txt +[github_gist_benchmark_server]: https://gist.github.com/mrmlnc/f06246b197f53c356895fa35355a367c#file-fg-benchmark-server-product-txt +[github_releases]: https://github.com/mrmlnc/fast-glob/releases +[glob_definition]: https://en.wikipedia.org/wiki/Glob_(programming) +[glob_linux_man]: http://man7.org/linux/man-pages/man3/glob.3.html +[intel_ssd]: https://ark.intel.com/content/www/us/en/ark/products/93012/intel-ssd-dc-s3520-series-240gb-2-5in-sata-6gb-s-3d1-mlc.html +[micromatch_backslashes]: https://github.com/micromatch/micromatch#backslashes +[micromatch_braces]: https://github.com/micromatch/braces +[micromatch_extended_globbing]: https://github.com/micromatch/micromatch#extended-globbing +[micromatch_extglobs]: https://github.com/micromatch/micromatch#extglobs +[micromatch_regex_character_classes]: https://github.com/micromatch/micromatch#regex-character-classes +[micromatch]: https://github.com/micromatch/micromatch +[node_js_fs_class_fs_dirent]: https://nodejs.org/api/fs.html#fs_class_fs_dirent +[node_js_fs_class_fs_stats]: https://nodejs.org/api/fs.html#fs_class_fs_stats +[node_js_stream_readable_streams]: https://nodejs.org/api/stream.html#stream_readable_streams +[node_js]: https://nodejs.org/en +[nodelib_fs_scandir_old_and_modern_modern]: https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode +[npm_normalize_path]: https://www.npmjs.com/package/normalize-path +[npm_unixify]: https://www.npmjs.com/package/unixify +[paypal_mrmlnc]:https://paypal.me/mrmlnc +[picomatch_matching_behavior]: https://github.com/micromatch/picomatch#matching-behavior-vs-bash +[picomatch_matching_special_characters_as_literals]: https://github.com/micromatch/picomatch#matching-special-characters-as-literals +[picomatch_posix_brackets]: https://github.com/micromatch/picomatch#posix-brackets +[regular_expressions_brackets]: https://www.regular-expressions.info/brackets.html +[silicon_power_ssd]: https://www.silicon-power.com/web/product-1 +[unc_path]: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/62e862f4-2a51-452e-8eeb-dc4ff5ee33cc +[vultr_pricing_baremetal]: https://www.vultr.com/pricing/baremetal +[wikipedia_case_sensitivity]: https://en.wikipedia.org/wiki/Case_sensitivity +[zotac_bi323]: https://www.zotac.com/ee/product/mini_pcs/zbox-bi323 diff --git a/node_modules/fast-glob/out/index.d.ts b/node_modules/fast-glob/out/index.d.ts new file mode 100644 index 00000000..54daa45a --- /dev/null +++ b/node_modules/fast-glob/out/index.d.ts @@ -0,0 +1,27 @@ +/// +import * as taskManager from './managers/tasks'; +import { Options as OptionsInternal } from './settings'; +import { Entry as EntryInternal, FileSystemAdapter as FileSystemAdapterInternal, Pattern as PatternInternal } from './types'; +declare type EntryObjectModePredicate = { + [TKey in keyof Pick]-?: true; +}; +declare type EntryStatsPredicate = { + [TKey in keyof Pick]-?: true; +}; +declare type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate; +declare function FastGlob(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): Promise; +declare function FastGlob(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Promise; +declare namespace FastGlob { + type Options = OptionsInternal; + type Entry = EntryInternal; + type Task = taskManager.Task; + type Pattern = PatternInternal; + type FileSystemAdapter = FileSystemAdapterInternal; + function sync(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): EntryInternal[]; + function sync(source: PatternInternal | PatternInternal[], options?: OptionsInternal): string[]; + function stream(source: PatternInternal | PatternInternal[], options?: OptionsInternal): NodeJS.ReadableStream; + function generateTasks(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Task[]; + function isDynamicPattern(source: PatternInternal, options?: OptionsInternal): boolean; + function escapePath(source: PatternInternal): PatternInternal; +} +export = FastGlob; diff --git a/node_modules/fast-glob/out/index.js b/node_modules/fast-glob/out/index.js new file mode 100644 index 00000000..94d441ba --- /dev/null +++ b/node_modules/fast-glob/out/index.js @@ -0,0 +1,67 @@ +"use strict"; +const taskManager = require("./managers/tasks"); +const async_1 = require("./providers/async"); +const stream_1 = require("./providers/stream"); +const sync_1 = require("./providers/sync"); +const settings_1 = require("./settings"); +const utils = require("./utils"); +async function FastGlob(source, options) { + assertPatternsInput(source); + const works = getWorks(source, async_1.default, options); + const result = await Promise.all(works); + return utils.array.flatten(result); +} +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +(function (FastGlob) { + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync_1.default, options); + return utils.array.flatten(works); + } + FastGlob.sync = sync; + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream_1.default, options); + /** + * The stream returned by the provider cannot work with an asynchronous iterator. + * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. + * This affects performance (+25%). I don't see best solution right now. + */ + return utils.stream.merge(works); + } + FastGlob.stream = stream; + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings_1.default(options); + return taskManager.generate(patterns, settings); + } + FastGlob.generateTasks = generateTasks; + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings_1.default(options); + return utils.pattern.isDynamicPattern(source, settings); + } + FastGlob.isDynamicPattern = isDynamicPattern; + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escape(source); + } + FastGlob.escapePath = escapePath; +})(FastGlob || (FastGlob = {})); +function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings_1.default(options); + const tasks = taskManager.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks.map(provider.read, provider); +} +function assertPatternsInput(input) { + const source = [].concat(input); + const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item)); + if (!isValidSource) { + throw new TypeError('Patterns must be a string (non empty) or an array of strings'); + } +} +module.exports = FastGlob; diff --git a/node_modules/fast-glob/out/managers/tasks.d.ts b/node_modules/fast-glob/out/managers/tasks.d.ts new file mode 100644 index 00000000..7da0f8ba --- /dev/null +++ b/node_modules/fast-glob/out/managers/tasks.d.ts @@ -0,0 +1,16 @@ +import Settings from '../settings'; +import { Pattern, PatternsGroup } from '../types'; +export declare type Task = { + base: string; + dynamic: boolean; + patterns: Pattern[]; + positive: Pattern[]; + negative: Pattern[]; +}; +export declare function generate(patterns: Pattern[], settings: Settings): Task[]; +export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): Task[]; +export declare function getPositivePatterns(patterns: Pattern[]): Pattern[]; +export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[]; +export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup; +export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): Task[]; +export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): Task; diff --git a/node_modules/fast-glob/out/managers/tasks.js b/node_modules/fast-glob/out/managers/tasks.js new file mode 100644 index 00000000..c1a98d61 --- /dev/null +++ b/node_modules/fast-glob/out/managers/tasks.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0; +const utils = require("../utils"); +function generate(patterns, settings) { + const positivePatterns = getPositivePatterns(patterns); + const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore); + const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings)); + const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings)); + const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, /* dynamic */ false); + const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, /* dynamic */ true); + return staticTasks.concat(dynamicTasks); +} +exports.generate = generate; +function convertPatternsToTasks(positive, negative, dynamic) { + const positivePatternsGroup = groupPatternsByBaseDirectory(positive); + // When we have a global group – there is no reason to divide the patterns into independent tasks. + // In this case, the global task covers the rest. + if ('.' in positivePatternsGroup) { + const task = convertPatternGroupToTask('.', positive, negative, dynamic); + return [task]; + } + return convertPatternGroupsToTasks(positivePatternsGroup, negative, dynamic); +} +exports.convertPatternsToTasks = convertPatternsToTasks; +function getPositivePatterns(patterns) { + return utils.pattern.getPositivePatterns(patterns); +} +exports.getPositivePatterns = getPositivePatterns; +function getNegativePatternsAsPositive(patterns, ignore) { + const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore); + const positive = negative.map(utils.pattern.convertToPositivePattern); + return positive; +} +exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive; +function groupPatternsByBaseDirectory(patterns) { + const group = {}; + return patterns.reduce((collection, pattern) => { + const base = utils.pattern.getBaseDirectory(pattern); + if (base in collection) { + collection[base].push(pattern); + } + else { + collection[base] = [pattern]; + } + return collection; + }, group); +} +exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory; +function convertPatternGroupsToTasks(positive, negative, dynamic) { + return Object.keys(positive).map((base) => { + return convertPatternGroupToTask(base, positive[base], negative, dynamic); + }); +} +exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks; +function convertPatternGroupToTask(base, positive, negative, dynamic) { + return { + dynamic, + positive, + negative, + base, + patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern)) + }; +} +exports.convertPatternGroupToTask = convertPatternGroupToTask; diff --git a/node_modules/fast-glob/out/providers/async.d.ts b/node_modules/fast-glob/out/providers/async.d.ts new file mode 100644 index 00000000..d8f1ff89 --- /dev/null +++ b/node_modules/fast-glob/out/providers/async.d.ts @@ -0,0 +1,11 @@ +/// +import { Readable } from 'stream'; +import { Task } from '../managers/tasks'; +import ReaderStream from '../readers/stream'; +import { EntryItem, ReaderOptions } from '../types'; +import Provider from './provider'; +export default class ProviderAsync extends Provider> { + protected _reader: ReaderStream; + read(task: Task): Promise; + api(root: string, task: Task, options: ReaderOptions): Readable; +} diff --git a/node_modules/fast-glob/out/providers/async.js b/node_modules/fast-glob/out/providers/async.js new file mode 100644 index 00000000..7b2b6689 --- /dev/null +++ b/node_modules/fast-glob/out/providers/async.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = require("../readers/stream"); +const provider_1 = require("./provider"); +class ProviderAsync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = []; + return new Promise((resolve, reject) => { + const stream = this.api(root, task, options); + stream.once('error', reject); + stream.on('data', (entry) => entries.push(options.transform(entry))); + stream.once('end', () => resolve(entries)); + }); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderAsync; diff --git a/node_modules/fast-glob/out/providers/filters/deep.d.ts b/node_modules/fast-glob/out/providers/filters/deep.d.ts new file mode 100644 index 00000000..22586a90 --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/deep.d.ts @@ -0,0 +1,16 @@ +import { MicromatchOptions, EntryFilterFunction, Pattern } from '../../types'; +import Settings from '../../settings'; +export default class DeepFilter { + private readonly _settings; + private readonly _micromatchOptions; + constructor(_settings: Settings, _micromatchOptions: MicromatchOptions); + getFilter(basePath: string, positive: Pattern[], negative: Pattern[]): EntryFilterFunction; + private _getMatcher; + private _getNegativePatternsRe; + private _filter; + private _isSkippedByDeep; + private _getEntryLevel; + private _isSkippedSymbolicLink; + private _isSkippedByPositivePatterns; + private _isSkippedByNegativePatterns; +} diff --git a/node_modules/fast-glob/out/providers/filters/deep.js b/node_modules/fast-glob/out/providers/filters/deep.js new file mode 100644 index 00000000..819c2603 --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/deep.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = require("../../utils"); +const partial_1 = require("../matchers/partial"); +class DeepFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + } + getFilter(basePath, positive, negative) { + const matcher = this._getMatcher(positive); + const negativeRe = this._getNegativePatternsRe(negative); + return (entry) => this._filter(basePath, entry, matcher, negativeRe); + } + _getMatcher(patterns) { + return new partial_1.default(patterns, this._settings, this._micromatchOptions); + } + _getNegativePatternsRe(patterns) { + const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern); + return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions); + } + _filter(basePath, entry, matcher, negativeRe) { + if (this._isSkippedByDeep(basePath, entry.path)) { + return false; + } + if (this._isSkippedSymbolicLink(entry)) { + return false; + } + const filepath = utils.path.removeLeadingDotSegment(entry.path); + if (this._isSkippedByPositivePatterns(filepath, matcher)) { + return false; + } + return this._isSkippedByNegativePatterns(filepath, negativeRe); + } + _isSkippedByDeep(basePath, entryPath) { + /** + * Avoid unnecessary depth calculations when it doesn't matter. + */ + if (this._settings.deep === Infinity) { + return false; + } + return this._getEntryLevel(basePath, entryPath) >= this._settings.deep; + } + _getEntryLevel(basePath, entryPath) { + const entryPathDepth = entryPath.split('/').length; + if (basePath === '') { + return entryPathDepth; + } + const basePathDepth = basePath.split('/').length; + return entryPathDepth - basePathDepth; + } + _isSkippedSymbolicLink(entry) { + return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink(); + } + _isSkippedByPositivePatterns(entryPath, matcher) { + return !this._settings.baseNameMatch && !matcher.match(entryPath); + } + _isSkippedByNegativePatterns(entryPath, patternsRe) { + return !utils.pattern.matchAny(entryPath, patternsRe); + } +} +exports.default = DeepFilter; diff --git a/node_modules/fast-glob/out/providers/filters/entry.d.ts b/node_modules/fast-glob/out/providers/filters/entry.d.ts new file mode 100644 index 00000000..2f21c434 --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/entry.d.ts @@ -0,0 +1,16 @@ +import Settings from '../../settings'; +import { EntryFilterFunction, MicromatchOptions, Pattern } from '../../types'; +export default class EntryFilter { + private readonly _settings; + private readonly _micromatchOptions; + readonly index: Map; + constructor(_settings: Settings, _micromatchOptions: MicromatchOptions); + getFilter(positive: Pattern[], negative: Pattern[]): EntryFilterFunction; + private _filter; + private _isDuplicateEntry; + private _createIndexRecord; + private _onlyFileFilter; + private _onlyDirectoryFilter; + private _isSkippedByAbsoluteNegativePatterns; + private _isMatchToPatterns; +} diff --git a/node_modules/fast-glob/out/providers/filters/entry.js b/node_modules/fast-glob/out/providers/filters/entry.js new file mode 100644 index 00000000..4e86438a --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/entry.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = require("../../utils"); +class EntryFilter { + constructor(_settings, _micromatchOptions) { + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this.index = new Map(); + } + getFilter(positive, negative) { + const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions); + const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions); + return (entry) => this._filter(entry, positiveRe, negativeRe); + } + _filter(entry, positiveRe, negativeRe) { + if (this._settings.unique && this._isDuplicateEntry(entry)) { + return false; + } + if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) { + return false; + } + if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) { + return false; + } + const filepath = this._settings.baseNameMatch ? entry.name : entry.path; + const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe); + if (this._settings.unique && isMatched) { + this._createIndexRecord(entry); + } + return isMatched; + } + _isDuplicateEntry(entry) { + return this.index.has(entry.path); + } + _createIndexRecord(entry) { + this.index.set(entry.path, undefined); + } + _onlyFileFilter(entry) { + return this._settings.onlyFiles && !entry.dirent.isFile(); + } + _onlyDirectoryFilter(entry) { + return this._settings.onlyDirectories && !entry.dirent.isDirectory(); + } + _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) { + if (!this._settings.absolute) { + return false; + } + const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath); + return utils.pattern.matchAny(fullpath, patternsRe); + } + _isMatchToPatterns(entryPath, patternsRe) { + const filepath = utils.path.removeLeadingDotSegment(entryPath); + return utils.pattern.matchAny(filepath, patternsRe); + } +} +exports.default = EntryFilter; diff --git a/node_modules/fast-glob/out/providers/filters/error.d.ts b/node_modules/fast-glob/out/providers/filters/error.d.ts new file mode 100644 index 00000000..1e9d738f --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/error.d.ts @@ -0,0 +1,8 @@ +import Settings from '../../settings'; +import { ErrorFilterFunction } from '../../types'; +export default class ErrorFilter { + private readonly _settings; + constructor(_settings: Settings); + getFilter(): ErrorFilterFunction; + private _isNonFatalError; +} diff --git a/node_modules/fast-glob/out/providers/filters/error.js b/node_modules/fast-glob/out/providers/filters/error.js new file mode 100644 index 00000000..f93bdc0c --- /dev/null +++ b/node_modules/fast-glob/out/providers/filters/error.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = require("../../utils"); +class ErrorFilter { + constructor(_settings) { + this._settings = _settings; + } + getFilter() { + return (error) => this._isNonFatalError(error); + } + _isNonFatalError(error) { + return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors; + } +} +exports.default = ErrorFilter; diff --git a/node_modules/fast-glob/out/providers/matchers/matcher.d.ts b/node_modules/fast-glob/out/providers/matchers/matcher.d.ts new file mode 100644 index 00000000..fde0bd50 --- /dev/null +++ b/node_modules/fast-glob/out/providers/matchers/matcher.d.ts @@ -0,0 +1,33 @@ +import { Pattern, MicromatchOptions, PatternRe } from '../../types'; +import Settings from '../../settings'; +export declare type PatternSegment = StaticPatternSegment | DynamicPatternSegment; +declare type StaticPatternSegment = { + dynamic: false; + pattern: Pattern; +}; +declare type DynamicPatternSegment = { + dynamic: true; + pattern: Pattern; + patternRe: PatternRe; +}; +export declare type PatternSection = PatternSegment[]; +export declare type PatternInfo = { + /** + * Indicates that the pattern has a globstar (more than a single section). + */ + complete: boolean; + pattern: Pattern; + segments: PatternSegment[]; + sections: PatternSection[]; +}; +export default abstract class Matcher { + private readonly _patterns; + private readonly _settings; + private readonly _micromatchOptions; + protected readonly _storage: PatternInfo[]; + constructor(_patterns: Pattern[], _settings: Settings, _micromatchOptions: MicromatchOptions); + private _fillStorage; + private _getPatternSegments; + private _splitSegmentsIntoSections; +} +export {}; diff --git a/node_modules/fast-glob/out/providers/matchers/matcher.js b/node_modules/fast-glob/out/providers/matchers/matcher.js new file mode 100644 index 00000000..44b2cc78 --- /dev/null +++ b/node_modules/fast-glob/out/providers/matchers/matcher.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = require("../../utils"); +class Matcher { + constructor(_patterns, _settings, _micromatchOptions) { + this._patterns = _patterns; + this._settings = _settings; + this._micromatchOptions = _micromatchOptions; + this._storage = []; + this._fillStorage(); + } + _fillStorage() { + /** + * The original pattern may include `{,*,**,a/*}`, which will lead to problems with matching (unresolved level). + * So, before expand patterns with brace expansion into separated patterns. + */ + const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns); + for (const pattern of patterns) { + const segments = this._getPatternSegments(pattern); + const sections = this._splitSegmentsIntoSections(segments); + this._storage.push({ + complete: sections.length <= 1, + pattern, + segments, + sections + }); + } + } + _getPatternSegments(pattern) { + const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions); + return parts.map((part) => { + const dynamic = utils.pattern.isDynamicPattern(part, this._settings); + if (!dynamic) { + return { + dynamic: false, + pattern: part + }; + } + return { + dynamic: true, + pattern: part, + patternRe: utils.pattern.makeRe(part, this._micromatchOptions) + }; + }); + } + _splitSegmentsIntoSections(segments) { + return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern)); + } +} +exports.default = Matcher; diff --git a/node_modules/fast-glob/out/providers/matchers/partial.d.ts b/node_modules/fast-glob/out/providers/matchers/partial.d.ts new file mode 100644 index 00000000..a5c93ba0 --- /dev/null +++ b/node_modules/fast-glob/out/providers/matchers/partial.d.ts @@ -0,0 +1,4 @@ +import Matcher from './matcher'; +export default class PartialMatcher extends Matcher { + match(filepath: string): boolean; +} diff --git a/node_modules/fast-glob/out/providers/matchers/partial.js b/node_modules/fast-glob/out/providers/matchers/partial.js new file mode 100644 index 00000000..f6a77e01 --- /dev/null +++ b/node_modules/fast-glob/out/providers/matchers/partial.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const matcher_1 = require("./matcher"); +class PartialMatcher extends matcher_1.default { + match(filepath) { + const parts = filepath.split('/'); + const levels = parts.length; + const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels); + for (const pattern of patterns) { + const section = pattern.sections[0]; + /** + * In this case, the pattern has a globstar and we must read all directories unconditionally, + * but only if the level has reached the end of the first group. + * + * fixtures/{a,b}/** + * ^ true/false ^ always true + */ + if (!pattern.complete && levels > section.length) { + return true; + } + const match = parts.every((part, index) => { + const segment = pattern.segments[index]; + if (segment.dynamic && segment.patternRe.test(part)) { + return true; + } + if (!segment.dynamic && segment.pattern === part) { + return true; + } + return false; + }); + if (match) { + return true; + } + } + return false; + } +} +exports.default = PartialMatcher; diff --git a/node_modules/fast-glob/out/providers/provider.d.ts b/node_modules/fast-glob/out/providers/provider.d.ts new file mode 100644 index 00000000..ccafd176 --- /dev/null +++ b/node_modules/fast-glob/out/providers/provider.d.ts @@ -0,0 +1,19 @@ +import { Task } from '../managers/tasks'; +import Settings from '../settings'; +import { MicromatchOptions, ReaderOptions } from '../types'; +import DeepFilter from './filters/deep'; +import EntryFilter from './filters/entry'; +import ErrorFilter from './filters/error'; +import EntryTransformer from './transformers/entry'; +export default abstract class Provider { + protected readonly _settings: Settings; + readonly errorFilter: ErrorFilter; + readonly entryFilter: EntryFilter; + readonly deepFilter: DeepFilter; + readonly entryTransformer: EntryTransformer; + constructor(_settings: Settings); + abstract read(_task: Task): T; + protected _getRootDirectory(task: Task): string; + protected _getReaderOptions(task: Task): ReaderOptions; + protected _getMicromatchOptions(): MicromatchOptions; +} diff --git a/node_modules/fast-glob/out/providers/provider.js b/node_modules/fast-glob/out/providers/provider.js new file mode 100644 index 00000000..5afb3893 --- /dev/null +++ b/node_modules/fast-glob/out/providers/provider.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const deep_1 = require("./filters/deep"); +const entry_1 = require("./filters/entry"); +const error_1 = require("./filters/error"); +const entry_2 = require("./transformers/entry"); +class Provider { + constructor(_settings) { + this._settings = _settings; + this.errorFilter = new error_1.default(this._settings); + this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions()); + this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions()); + this.entryTransformer = new entry_2.default(this._settings); + } + _getRootDirectory(task) { + return path.resolve(this._settings.cwd, task.base); + } + _getReaderOptions(task) { + const basePath = task.base === '.' ? '' : task.base; + return { + basePath, + pathSegmentSeparator: '/', + concurrency: this._settings.concurrency, + deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative), + entryFilter: this.entryFilter.getFilter(task.positive, task.negative), + errorFilter: this.errorFilter.getFilter(), + followSymbolicLinks: this._settings.followSymbolicLinks, + fs: this._settings.fs, + stats: this._settings.stats, + throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink, + transform: this.entryTransformer.getTransformer() + }; + } + _getMicromatchOptions() { + return { + dot: this._settings.dot, + matchBase: this._settings.baseNameMatch, + nobrace: !this._settings.braceExpansion, + nocase: !this._settings.caseSensitiveMatch, + noext: !this._settings.extglob, + noglobstar: !this._settings.globstar, + posix: true, + strictSlashes: false + }; + } +} +exports.default = Provider; diff --git a/node_modules/fast-glob/out/providers/stream.d.ts b/node_modules/fast-glob/out/providers/stream.d.ts new file mode 100644 index 00000000..bfa9201c --- /dev/null +++ b/node_modules/fast-glob/out/providers/stream.d.ts @@ -0,0 +1,11 @@ +/// +import { Readable } from 'stream'; +import { Task } from '../managers/tasks'; +import ReaderStream from '../readers/stream'; +import { ReaderOptions } from '../types'; +import Provider from './provider'; +export default class ProviderStream extends Provider { + protected _reader: ReaderStream; + read(task: Task): Readable; + api(root: string, task: Task, options: ReaderOptions): Readable; +} diff --git a/node_modules/fast-glob/out/providers/stream.js b/node_modules/fast-glob/out/providers/stream.js new file mode 100644 index 00000000..9e81c21f --- /dev/null +++ b/node_modules/fast-glob/out/providers/stream.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = require("stream"); +const stream_2 = require("../readers/stream"); +const provider_1 = require("./provider"); +class ProviderStream extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new stream_2.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const source = this.api(root, task, options); + const destination = new stream_1.Readable({ objectMode: true, read: () => { } }); + source + .once('error', (error) => destination.emit('error', error)) + .on('data', (entry) => destination.emit('data', options.transform(entry))) + .once('end', () => destination.emit('end')); + destination + .once('close', () => source.destroy()); + return destination; + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderStream; diff --git a/node_modules/fast-glob/out/providers/sync.d.ts b/node_modules/fast-glob/out/providers/sync.d.ts new file mode 100644 index 00000000..5861db4c --- /dev/null +++ b/node_modules/fast-glob/out/providers/sync.d.ts @@ -0,0 +1,9 @@ +import { Task } from '../managers/tasks'; +import ReaderSync from '../readers/sync'; +import { Entry, EntryItem, ReaderOptions } from '../types'; +import Provider from './provider'; +export default class ProviderSync extends Provider { + protected _reader: ReaderSync; + read(task: Task): EntryItem[]; + api(root: string, task: Task, options: ReaderOptions): Entry[]; +} diff --git a/node_modules/fast-glob/out/providers/sync.js b/node_modules/fast-glob/out/providers/sync.js new file mode 100644 index 00000000..9ed8f7cd --- /dev/null +++ b/node_modules/fast-glob/out/providers/sync.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sync_1 = require("../readers/sync"); +const provider_1 = require("./provider"); +class ProviderSync extends provider_1.default { + constructor() { + super(...arguments); + this._reader = new sync_1.default(this._settings); + } + read(task) { + const root = this._getRootDirectory(task); + const options = this._getReaderOptions(task); + const entries = this.api(root, task, options); + return entries.map(options.transform); + } + api(root, task, options) { + if (task.dynamic) { + return this._reader.dynamic(root, options); + } + return this._reader.static(task.patterns, options); + } +} +exports.default = ProviderSync; diff --git a/node_modules/fast-glob/out/providers/transformers/entry.d.ts b/node_modules/fast-glob/out/providers/transformers/entry.d.ts new file mode 100644 index 00000000..1874a380 --- /dev/null +++ b/node_modules/fast-glob/out/providers/transformers/entry.d.ts @@ -0,0 +1,8 @@ +import Settings from '../../settings'; +import { EntryTransformerFunction } from '../../types'; +export default class EntryTransformer { + private readonly _settings; + constructor(_settings: Settings); + getTransformer(): EntryTransformerFunction; + private _transform; +} diff --git a/node_modules/fast-glob/out/providers/transformers/entry.js b/node_modules/fast-glob/out/providers/transformers/entry.js new file mode 100644 index 00000000..3bef8038 --- /dev/null +++ b/node_modules/fast-glob/out/providers/transformers/entry.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = require("../../utils"); +class EntryTransformer { + constructor(_settings) { + this._settings = _settings; + } + getTransformer() { + return (entry) => this._transform(entry); + } + _transform(entry) { + let filepath = entry.path; + if (this._settings.absolute) { + filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); + filepath = utils.path.unixify(filepath); + } + if (this._settings.markDirectories && entry.dirent.isDirectory()) { + filepath += '/'; + } + if (!this._settings.objectMode) { + return filepath; + } + return Object.assign(Object.assign({}, entry), { path: filepath }); + } +} +exports.default = EntryTransformer; diff --git a/node_modules/fast-glob/out/readers/reader.d.ts b/node_modules/fast-glob/out/readers/reader.d.ts new file mode 100644 index 00000000..293b5889 --- /dev/null +++ b/node_modules/fast-glob/out/readers/reader.d.ts @@ -0,0 +1,15 @@ +/// +import * as fs from 'fs'; +import * as fsStat from '@nodelib/fs.stat'; +import Settings from '../settings'; +import { Entry, ErrnoException, Pattern, ReaderOptions } from '../types'; +export default abstract class Reader { + protected readonly _settings: Settings; + protected readonly _fsStatSettings: fsStat.Settings; + constructor(_settings: Settings); + abstract dynamic(root: string, options: ReaderOptions): T; + abstract static(patterns: Pattern[], options: ReaderOptions): T; + protected _getFullEntryPath(filepath: string): string; + protected _makeEntry(stats: fs.Stats, pattern: Pattern): Entry; + protected _isFatalError(error: ErrnoException): boolean; +} diff --git a/node_modules/fast-glob/out/readers/reader.js b/node_modules/fast-glob/out/readers/reader.js new file mode 100644 index 00000000..9e9469ce --- /dev/null +++ b/node_modules/fast-glob/out/readers/reader.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const path = require("path"); +const fsStat = require("@nodelib/fs.stat"); +const utils = require("../utils"); +class Reader { + constructor(_settings) { + this._settings = _settings; + this._fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this._settings.followSymbolicLinks, + fs: this._settings.fs, + throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks + }); + } + _getFullEntryPath(filepath) { + return path.resolve(this._settings.cwd, filepath); + } + _makeEntry(stats, pattern) { + const entry = { + name: pattern, + path: pattern, + dirent: utils.fs.createDirentFromStats(pattern, stats) + }; + if (this._settings.stats) { + entry.stats = stats; + } + return entry; + } + _isFatalError(error) { + return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors; + } +} +exports.default = Reader; diff --git a/node_modules/fast-glob/out/readers/stream.d.ts b/node_modules/fast-glob/out/readers/stream.d.ts new file mode 100644 index 00000000..b0c7018c --- /dev/null +++ b/node_modules/fast-glob/out/readers/stream.d.ts @@ -0,0 +1,14 @@ +/// +import { Readable } from 'stream'; +import * as fsStat from '@nodelib/fs.stat'; +import * as fsWalk from '@nodelib/fs.walk'; +import { Pattern, ReaderOptions } from '../types'; +import Reader from './reader'; +export default class ReaderStream extends Reader { + protected _walkStream: typeof fsWalk.walkStream; + protected _stat: typeof fsStat.stat; + dynamic(root: string, options: ReaderOptions): Readable; + static(patterns: Pattern[], options: ReaderOptions): Readable; + private _getEntry; + private _getStat; +} diff --git a/node_modules/fast-glob/out/readers/stream.js b/node_modules/fast-glob/out/readers/stream.js new file mode 100644 index 00000000..33b96f50 --- /dev/null +++ b/node_modules/fast-glob/out/readers/stream.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const stream_1 = require("stream"); +const fsStat = require("@nodelib/fs.stat"); +const fsWalk = require("@nodelib/fs.walk"); +const reader_1 = require("./reader"); +class ReaderStream extends reader_1.default { + constructor() { + super(...arguments); + this._walkStream = fsWalk.walkStream; + this._stat = fsStat.stat; + } + dynamic(root, options) { + return this._walkStream(root, options); + } + static(patterns, options) { + const filepaths = patterns.map(this._getFullEntryPath, this); + const stream = new stream_1.PassThrough({ objectMode: true }); + stream._write = (index, _enc, done) => { + return this._getEntry(filepaths[index], patterns[index], options) + .then((entry) => { + if (entry !== null && options.entryFilter(entry)) { + stream.push(entry); + } + if (index === filepaths.length - 1) { + stream.end(); + } + done(); + }) + .catch(done); + }; + for (let i = 0; i < filepaths.length; i++) { + stream.write(i); + } + return stream; + } + _getEntry(filepath, pattern, options) { + return this._getStat(filepath) + .then((stats) => this._makeEntry(stats, pattern)) + .catch((error) => { + if (options.errorFilter(error)) { + return null; + } + throw error; + }); + } + _getStat(filepath) { + return new Promise((resolve, reject) => { + this._stat(filepath, this._fsStatSettings, (error, stats) => { + return error === null ? resolve(stats) : reject(error); + }); + }); + } +} +exports.default = ReaderStream; diff --git a/node_modules/fast-glob/out/readers/sync.d.ts b/node_modules/fast-glob/out/readers/sync.d.ts new file mode 100644 index 00000000..1943ac60 --- /dev/null +++ b/node_modules/fast-glob/out/readers/sync.d.ts @@ -0,0 +1,12 @@ +import * as fsStat from '@nodelib/fs.stat'; +import * as fsWalk from '@nodelib/fs.walk'; +import { Entry, Pattern, ReaderOptions } from '../types'; +import Reader from './reader'; +export default class ReaderSync extends Reader { + protected _walkSync: typeof fsWalk.walkSync; + protected _statSync: typeof fsStat.statSync; + dynamic(root: string, options: ReaderOptions): Entry[]; + static(patterns: Pattern[], options: ReaderOptions): Entry[]; + private _getEntry; + private _getStat; +} diff --git a/node_modules/fast-glob/out/readers/sync.js b/node_modules/fast-glob/out/readers/sync.js new file mode 100644 index 00000000..c4e4a01d --- /dev/null +++ b/node_modules/fast-glob/out/readers/sync.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const fsStat = require("@nodelib/fs.stat"); +const fsWalk = require("@nodelib/fs.walk"); +const reader_1 = require("./reader"); +class ReaderSync extends reader_1.default { + constructor() { + super(...arguments); + this._walkSync = fsWalk.walkSync; + this._statSync = fsStat.statSync; + } + dynamic(root, options) { + return this._walkSync(root, options); + } + static(patterns, options) { + const entries = []; + for (const pattern of patterns) { + const filepath = this._getFullEntryPath(pattern); + const entry = this._getEntry(filepath, pattern, options); + if (entry === null || !options.entryFilter(entry)) { + continue; + } + entries.push(entry); + } + return entries; + } + _getEntry(filepath, pattern, options) { + try { + const stats = this._getStat(filepath); + return this._makeEntry(stats, pattern); + } + catch (error) { + if (options.errorFilter(error)) { + return null; + } + throw error; + } + } + _getStat(filepath) { + return this._statSync(filepath, this._fsStatSettings); + } +} +exports.default = ReaderSync; diff --git a/node_modules/fast-glob/out/settings.d.ts b/node_modules/fast-glob/out/settings.d.ts new file mode 100644 index 00000000..4e97c9b0 --- /dev/null +++ b/node_modules/fast-glob/out/settings.d.ts @@ -0,0 +1,164 @@ +import { FileSystemAdapter, Pattern } from './types'; +export declare const DEFAULT_FILE_SYSTEM_ADAPTER: FileSystemAdapter; +export declare type Options = { + /** + * Return the absolute path for entries. + * + * @default false + */ + absolute?: boolean; + /** + * If set to `true`, then patterns without slashes will be matched against + * the basename of the path if it contains slashes. + * + * @default false + */ + baseNameMatch?: boolean; + /** + * Enables Bash-like brace expansion. + * + * @default true + */ + braceExpansion?: boolean; + /** + * Enables a case-sensitive mode for matching files. + * + * @default true + */ + caseSensitiveMatch?: boolean; + /** + * Specifies the maximum number of concurrent requests from a reader to read + * directories. + * + * @default os.cpus().length + */ + concurrency?: number; + /** + * The current working directory in which to search. + * + * @default process.cwd() + */ + cwd?: string; + /** + * Specifies the maximum depth of a read directory relative to the start + * directory. + * + * @default Infinity + */ + deep?: number; + /** + * Allow patterns to match entries that begin with a period (`.`). + * + * @default false + */ + dot?: boolean; + /** + * Enables Bash-like `extglob` functionality. + * + * @default true + */ + extglob?: boolean; + /** + * Indicates whether to traverse descendants of symbolic link directories. + * + * @default true + */ + followSymbolicLinks?: boolean; + /** + * Custom implementation of methods for working with the file system. + * + * @default fs.* + */ + fs?: Partial; + /** + * Enables recursively repeats a pattern containing `**`. + * If `false`, `**` behaves exactly like `*`. + * + * @default true + */ + globstar?: boolean; + /** + * An array of glob patterns to exclude matches. + * This is an alternative way to use negative patterns. + * + * @default [] + */ + ignore?: Pattern[]; + /** + * Mark the directory path with the final slash. + * + * @default false + */ + markDirectories?: boolean; + /** + * Returns objects (instead of strings) describing entries. + * + * @default false + */ + objectMode?: boolean; + /** + * Return only directories. + * + * @default false + */ + onlyDirectories?: boolean; + /** + * Return only files. + * + * @default true + */ + onlyFiles?: boolean; + /** + * Enables an object mode (`objectMode`) with an additional `stats` field. + * + * @default false + */ + stats?: boolean; + /** + * By default this package suppress only `ENOENT` errors. + * Set to `true` to suppress any error. + * + * @default false + */ + suppressErrors?: boolean; + /** + * Throw an error when symbolic link is broken if `true` or safely + * return `lstat` call if `false`. + * + * @default false + */ + throwErrorOnBrokenSymbolicLink?: boolean; + /** + * Ensures that the returned entries are unique. + * + * @default true + */ + unique?: boolean; +}; +export default class Settings { + private readonly _options; + readonly absolute: boolean; + readonly baseNameMatch: boolean; + readonly braceExpansion: boolean; + readonly caseSensitiveMatch: boolean; + readonly concurrency: number; + readonly cwd: string; + readonly deep: number; + readonly dot: boolean; + readonly extglob: boolean; + readonly followSymbolicLinks: boolean; + readonly fs: FileSystemAdapter; + readonly globstar: boolean; + readonly ignore: Pattern[]; + readonly markDirectories: boolean; + readonly objectMode: boolean; + readonly onlyDirectories: boolean; + readonly onlyFiles: boolean; + readonly stats: boolean; + readonly suppressErrors: boolean; + readonly throwErrorOnBrokenSymbolicLink: boolean; + readonly unique: boolean; + constructor(_options?: Options); + private _getValue; + private _getFileSystemMethods; +} diff --git a/node_modules/fast-glob/out/settings.js b/node_modules/fast-glob/out/settings.js new file mode 100644 index 00000000..f95ac8ff --- /dev/null +++ b/node_modules/fast-glob/out/settings.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0; +const fs = require("fs"); +const os = require("os"); +/** + * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero. + * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107 + */ +const CPU_COUNT = Math.max(os.cpus().length, 1); +exports.DEFAULT_FILE_SYSTEM_ADAPTER = { + lstat: fs.lstat, + lstatSync: fs.lstatSync, + stat: fs.stat, + statSync: fs.statSync, + readdir: fs.readdir, + readdirSync: fs.readdirSync +}; +class Settings { + constructor(_options = {}) { + this._options = _options; + this.absolute = this._getValue(this._options.absolute, false); + this.baseNameMatch = this._getValue(this._options.baseNameMatch, false); + this.braceExpansion = this._getValue(this._options.braceExpansion, true); + this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true); + this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT); + this.cwd = this._getValue(this._options.cwd, process.cwd()); + this.deep = this._getValue(this._options.deep, Infinity); + this.dot = this._getValue(this._options.dot, false); + this.extglob = this._getValue(this._options.extglob, true); + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true); + this.fs = this._getFileSystemMethods(this._options.fs); + this.globstar = this._getValue(this._options.globstar, true); + this.ignore = this._getValue(this._options.ignore, []); + this.markDirectories = this._getValue(this._options.markDirectories, false); + this.objectMode = this._getValue(this._options.objectMode, false); + this.onlyDirectories = this._getValue(this._options.onlyDirectories, false); + this.onlyFiles = this._getValue(this._options.onlyFiles, true); + this.stats = this._getValue(this._options.stats, false); + this.suppressErrors = this._getValue(this._options.suppressErrors, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false); + this.unique = this._getValue(this._options.unique, true); + if (this.onlyDirectories) { + this.onlyFiles = false; + } + if (this.stats) { + this.objectMode = true; + } + } + _getValue(option, value) { + return option === undefined ? value : option; + } + _getFileSystemMethods(methods = {}) { + return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods); + } +} +exports.default = Settings; diff --git a/node_modules/fast-glob/out/types/index.d.ts b/node_modules/fast-glob/out/types/index.d.ts new file mode 100644 index 00000000..e8286893 --- /dev/null +++ b/node_modules/fast-glob/out/types/index.d.ts @@ -0,0 +1,31 @@ +/// +import * as fsWalk from '@nodelib/fs.walk'; +export declare type ErrnoException = NodeJS.ErrnoException; +export declare type Entry = fsWalk.Entry; +export declare type EntryItem = string | Entry; +export declare type Pattern = string; +export declare type PatternRe = RegExp; +export declare type PatternsGroup = Record; +export declare type ReaderOptions = fsWalk.Options & { + transform(entry: Entry): EntryItem; + deepFilter: DeepFilterFunction; + entryFilter: EntryFilterFunction; + errorFilter: ErrorFilterFunction; + fs: FileSystemAdapter; + stats: boolean; +}; +export declare type ErrorFilterFunction = fsWalk.ErrorFilterFunction; +export declare type EntryFilterFunction = fsWalk.EntryFilterFunction; +export declare type DeepFilterFunction = fsWalk.DeepFilterFunction; +export declare type EntryTransformerFunction = (entry: Entry) => EntryItem; +export declare type MicromatchOptions = { + dot?: boolean; + matchBase?: boolean; + nobrace?: boolean; + nocase?: boolean; + noext?: boolean; + noglobstar?: boolean; + posix?: boolean; + strictSlashes?: boolean; +}; +export declare type FileSystemAdapter = fsWalk.FileSystemAdapter; diff --git a/node_modules/fast-glob/out/types/index.js b/node_modules/fast-glob/out/types/index.js new file mode 100644 index 00000000..ce03781e --- /dev/null +++ b/node_modules/fast-glob/out/types/index.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/fast-glob/out/utils/array.d.ts b/node_modules/fast-glob/out/utils/array.d.ts new file mode 100644 index 00000000..7e585bc1 --- /dev/null +++ b/node_modules/fast-glob/out/utils/array.d.ts @@ -0,0 +1,2 @@ +export declare function flatten(items: T[][]): T[]; +export declare function splitWhen(items: T[], predicate: (item: T) => boolean): T[][]; diff --git a/node_modules/fast-glob/out/utils/array.js b/node_modules/fast-glob/out/utils/array.js new file mode 100644 index 00000000..f43f1145 --- /dev/null +++ b/node_modules/fast-glob/out/utils/array.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.splitWhen = exports.flatten = void 0; +function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); +} +exports.flatten = flatten; +function splitWhen(items, predicate) { + const result = [[]]; + let groupIndex = 0; + for (const item of items) { + if (predicate(item)) { + groupIndex++; + result[groupIndex] = []; + } + else { + result[groupIndex].push(item); + } + } + return result; +} +exports.splitWhen = splitWhen; diff --git a/node_modules/fast-glob/out/utils/errno.d.ts b/node_modules/fast-glob/out/utils/errno.d.ts new file mode 100644 index 00000000..0e52c0dc --- /dev/null +++ b/node_modules/fast-glob/out/utils/errno.d.ts @@ -0,0 +1,2 @@ +import { ErrnoException } from '../types'; +export declare function isEnoentCodeError(error: ErrnoException): boolean; diff --git a/node_modules/fast-glob/out/utils/errno.js b/node_modules/fast-glob/out/utils/errno.js new file mode 100644 index 00000000..178ace60 --- /dev/null +++ b/node_modules/fast-glob/out/utils/errno.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isEnoentCodeError = void 0; +function isEnoentCodeError(error) { + return error.code === 'ENOENT'; +} +exports.isEnoentCodeError = isEnoentCodeError; diff --git a/node_modules/fast-glob/out/utils/fs.d.ts b/node_modules/fast-glob/out/utils/fs.d.ts new file mode 100644 index 00000000..926c5ae9 --- /dev/null +++ b/node_modules/fast-glob/out/utils/fs.d.ts @@ -0,0 +1,4 @@ +/// +import * as fs from 'fs'; +import { Dirent } from '@nodelib/fs.walk'; +export declare function createDirentFromStats(name: string, stats: fs.Stats): Dirent; diff --git a/node_modules/fast-glob/out/utils/fs.js b/node_modules/fast-glob/out/utils/fs.js new file mode 100644 index 00000000..f15b8cf2 --- /dev/null +++ b/node_modules/fast-glob/out/utils/fs.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDirentFromStats = void 0; +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; diff --git a/node_modules/fast-glob/out/utils/index.d.ts b/node_modules/fast-glob/out/utils/index.d.ts new file mode 100644 index 00000000..d3e4f8f7 --- /dev/null +++ b/node_modules/fast-glob/out/utils/index.d.ts @@ -0,0 +1,8 @@ +import * as array from './array'; +import * as errno from './errno'; +import * as fs from './fs'; +import * as path from './path'; +import * as pattern from './pattern'; +import * as stream from './stream'; +import * as string from './string'; +export { array, errno, fs, path, pattern, stream, string }; diff --git a/node_modules/fast-glob/out/utils/index.js b/node_modules/fast-glob/out/utils/index.js new file mode 100644 index 00000000..8fc6703a --- /dev/null +++ b/node_modules/fast-glob/out/utils/index.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0; +const array = require("./array"); +exports.array = array; +const errno = require("./errno"); +exports.errno = errno; +const fs = require("./fs"); +exports.fs = fs; +const path = require("./path"); +exports.path = path; +const pattern = require("./pattern"); +exports.pattern = pattern; +const stream = require("./stream"); +exports.stream = stream; +const string = require("./string"); +exports.string = string; diff --git a/node_modules/fast-glob/out/utils/path.d.ts b/node_modules/fast-glob/out/utils/path.d.ts new file mode 100644 index 00000000..f90dc54d --- /dev/null +++ b/node_modules/fast-glob/out/utils/path.d.ts @@ -0,0 +1,8 @@ +import { Pattern } from '../types'; +/** + * Designed to work only with simple paths: `dir\\file`. + */ +export declare function unixify(filepath: string): string; +export declare function makeAbsolute(cwd: string, filepath: string): string; +export declare function escape(pattern: Pattern): Pattern; +export declare function removeLeadingDotSegment(entry: string): string; diff --git a/node_modules/fast-glob/out/utils/path.js b/node_modules/fast-glob/out/utils/path.js new file mode 100644 index 00000000..966fcc90 --- /dev/null +++ b/node_modules/fast-glob/out/utils/path.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.removeLeadingDotSegment = exports.escape = exports.makeAbsolute = exports.unixify = void 0; +const path = require("path"); +const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\ +const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g; +/** + * Designed to work only with simple paths: `dir\\file`. + */ +function unixify(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.unixify = unixify; +function makeAbsolute(cwd, filepath) { + return path.resolve(cwd, filepath); +} +exports.makeAbsolute = makeAbsolute; +function escape(pattern) { + return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escape = escape; +function removeLeadingDotSegment(entry) { + // We do not use `startsWith` because this is 10x slower than current implementation for some cases. + // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with + if (entry.charAt(0) === '.') { + const secondCharactery = entry.charAt(1); + if (secondCharactery === '/' || secondCharactery === '\\') { + return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); + } + } + return entry; +} +exports.removeLeadingDotSegment = removeLeadingDotSegment; diff --git a/node_modules/fast-glob/out/utils/pattern.d.ts b/node_modules/fast-glob/out/utils/pattern.d.ts new file mode 100644 index 00000000..5a2f23a6 --- /dev/null +++ b/node_modules/fast-glob/out/utils/pattern.d.ts @@ -0,0 +1,25 @@ +import { MicromatchOptions, Pattern, PatternRe } from '../types'; +declare type PatternTypeOptions = { + braceExpansion?: boolean; + caseSensitiveMatch?: boolean; + extglob?: boolean; +}; +export declare function isStaticPattern(pattern: Pattern, options?: PatternTypeOptions): boolean; +export declare function isDynamicPattern(pattern: Pattern, options?: PatternTypeOptions): boolean; +export declare function convertToPositivePattern(pattern: Pattern): Pattern; +export declare function convertToNegativePattern(pattern: Pattern): Pattern; +export declare function isNegativePattern(pattern: Pattern): boolean; +export declare function isPositivePattern(pattern: Pattern): boolean; +export declare function getNegativePatterns(patterns: Pattern[]): Pattern[]; +export declare function getPositivePatterns(patterns: Pattern[]): Pattern[]; +export declare function getBaseDirectory(pattern: Pattern): string; +export declare function hasGlobStar(pattern: Pattern): boolean; +export declare function endsWithSlashGlobStar(pattern: Pattern): boolean; +export declare function isAffectDepthOfReadingPattern(pattern: Pattern): boolean; +export declare function expandPatternsWithBraceExpansion(patterns: Pattern[]): Pattern[]; +export declare function expandBraceExpansion(pattern: Pattern): Pattern[]; +export declare function getPatternParts(pattern: Pattern, options: MicromatchOptions): Pattern[]; +export declare function makeRe(pattern: Pattern, options: MicromatchOptions): PatternRe; +export declare function convertPatternsToRe(patterns: Pattern[], options: MicromatchOptions): PatternRe[]; +export declare function matchAny(entry: string, patternsRe: PatternRe[]): boolean; +export {}; diff --git a/node_modules/fast-glob/out/utils/pattern.js b/node_modules/fast-glob/out/utils/pattern.js new file mode 100644 index 00000000..7dcadd53 --- /dev/null +++ b/node_modules/fast-glob/out/utils/pattern.js @@ -0,0 +1,132 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0; +const path = require("path"); +const globParent = require("glob-parent"); +const micromatch = require("micromatch"); +const picomatch = require("picomatch"); +const GLOBSTAR = '**'; +const ESCAPE_SYMBOL = '\\'; +const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/; +const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[.*]/; +const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\(.*\|.*\)/; +const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\(.*\)/; +const BRACE_EXPANSIONS_SYMBOLS_RE = /{.*(?:,|\.\.).*}/; +function isStaticPattern(pattern, options = {}) { + return !isDynamicPattern(pattern, options); +} +exports.isStaticPattern = isStaticPattern; +function isDynamicPattern(pattern, options = {}) { + /** + * A special case with an empty string is necessary for matching patterns that start with a forward slash. + * An empty string cannot be a dynamic pattern. + * For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'. + */ + if (pattern === '') { + return false; + } + /** + * When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check + * filepath directly (without read directory). + */ + if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) { + return true; + } + if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) { + return true; + } + if (options.braceExpansion !== false && BRACE_EXPANSIONS_SYMBOLS_RE.test(pattern)) { + return true; + } + return false; +} +exports.isDynamicPattern = isDynamicPattern; +function convertToPositivePattern(pattern) { + return isNegativePattern(pattern) ? pattern.slice(1) : pattern; +} +exports.convertToPositivePattern = convertToPositivePattern; +function convertToNegativePattern(pattern) { + return '!' + pattern; +} +exports.convertToNegativePattern = convertToNegativePattern; +function isNegativePattern(pattern) { + return pattern.startsWith('!') && pattern[1] !== '('; +} +exports.isNegativePattern = isNegativePattern; +function isPositivePattern(pattern) { + return !isNegativePattern(pattern); +} +exports.isPositivePattern = isPositivePattern; +function getNegativePatterns(patterns) { + return patterns.filter(isNegativePattern); +} +exports.getNegativePatterns = getNegativePatterns; +function getPositivePatterns(patterns) { + return patterns.filter(isPositivePattern); +} +exports.getPositivePatterns = getPositivePatterns; +function getBaseDirectory(pattern) { + return globParent(pattern, { flipBackslashes: false }); +} +exports.getBaseDirectory = getBaseDirectory; +function hasGlobStar(pattern) { + return pattern.includes(GLOBSTAR); +} +exports.hasGlobStar = hasGlobStar; +function endsWithSlashGlobStar(pattern) { + return pattern.endsWith('/' + GLOBSTAR); +} +exports.endsWithSlashGlobStar = endsWithSlashGlobStar; +function isAffectDepthOfReadingPattern(pattern) { + const basename = path.basename(pattern); + return endsWithSlashGlobStar(pattern) || isStaticPattern(basename); +} +exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern; +function expandPatternsWithBraceExpansion(patterns) { + return patterns.reduce((collection, pattern) => { + return collection.concat(expandBraceExpansion(pattern)); + }, []); +} +exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion; +function expandBraceExpansion(pattern) { + return micromatch.braces(pattern, { + expand: true, + nodupes: true + }); +} +exports.expandBraceExpansion = expandBraceExpansion; +function getPatternParts(pattern, options) { + let { parts } = picomatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true })); + /** + * The scan method returns an empty array in some cases. + * See micromatch/picomatch#58 for more details. + */ + if (parts.length === 0) { + parts = [pattern]; + } + /** + * The scan method does not return an empty part for the pattern with a forward slash. + * This is another part of micromatch/picomatch#58. + */ + if (parts[0].startsWith('/')) { + parts[0] = parts[0].slice(1); + parts.unshift(''); + } + return parts; +} +exports.getPatternParts = getPatternParts; +function makeRe(pattern, options) { + return micromatch.makeRe(pattern, options); +} +exports.makeRe = makeRe; +function convertPatternsToRe(patterns, options) { + return patterns.map((pattern) => makeRe(pattern, options)); +} +exports.convertPatternsToRe = convertPatternsToRe; +function matchAny(entry, patternsRe) { + return patternsRe.some((patternRe) => patternRe.test(entry)); +} +exports.matchAny = matchAny; diff --git a/node_modules/fast-glob/out/utils/stream.d.ts b/node_modules/fast-glob/out/utils/stream.d.ts new file mode 100644 index 00000000..167fab0a --- /dev/null +++ b/node_modules/fast-glob/out/utils/stream.d.ts @@ -0,0 +1,3 @@ +/// +import { Readable } from 'stream'; +export declare function merge(streams: Readable[]): NodeJS.ReadableStream; diff --git a/node_modules/fast-glob/out/utils/stream.js b/node_modules/fast-glob/out/utils/stream.js new file mode 100644 index 00000000..f1ab1f5b --- /dev/null +++ b/node_modules/fast-glob/out/utils/stream.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.merge = void 0; +const merge2 = require("merge2"); +function merge(streams) { + const mergedStream = merge2(streams); + streams.forEach((stream) => { + stream.once('error', (error) => mergedStream.emit('error', error)); + }); + mergedStream.once('close', () => propagateCloseEventToSources(streams)); + mergedStream.once('end', () => propagateCloseEventToSources(streams)); + return mergedStream; +} +exports.merge = merge; +function propagateCloseEventToSources(streams) { + streams.forEach((stream) => stream.emit('close')); +} diff --git a/node_modules/fast-glob/out/utils/string.d.ts b/node_modules/fast-glob/out/utils/string.d.ts new file mode 100644 index 00000000..d306bc9e --- /dev/null +++ b/node_modules/fast-glob/out/utils/string.d.ts @@ -0,0 +1,2 @@ +export declare function isString(input: unknown): input is string; +export declare function isEmpty(input: string): boolean; diff --git a/node_modules/fast-glob/out/utils/string.js b/node_modules/fast-glob/out/utils/string.js new file mode 100644 index 00000000..738c2270 --- /dev/null +++ b/node_modules/fast-glob/out/utils/string.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isEmpty = exports.isString = void 0; +function isString(input) { + return typeof input === 'string'; +} +exports.isString = isString; +function isEmpty(input) { + return input === ''; +} +exports.isEmpty = isEmpty; diff --git a/node_modules/fast-glob/package.json b/node_modules/fast-glob/package.json new file mode 100644 index 00000000..18d7d20b --- /dev/null +++ b/node_modules/fast-glob/package.json @@ -0,0 +1,123 @@ +{ + "_args": [ + [ + "fast-glob@3.2.5", + "/workspaces/upload-google-play" + ] + ], + "_from": "fast-glob@3.2.5", + "_id": "fast-glob@3.2.5", + "_inBundle": false, + "_integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "_location": "/fast-glob", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "fast-glob@3.2.5", + "name": "fast-glob", + "escapedName": "fast-glob", + "rawSpec": "3.2.5", + "saveSpec": null, + "fetchSpec": "3.2.5" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "_spec": "3.2.5", + "_where": "/workspaces/upload-google-play", + "author": { + "name": "Denis Malinochkin", + "url": "https://mrmlnc.com" + }, + "bugs": { + "url": "https://github.com/mrmlnc/fast-glob/issues" + }, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + }, + "description": "It's a very fast and efficient glob library for Node.js", + "devDependencies": { + "@nodelib/fs.macchiato": "^1.0.1", + "@types/compute-stdev": "^1.0.0", + "@types/easy-table": "^0.0.32", + "@types/glob": "^7.1.1", + "@types/glob-parent": "^5.1.0", + "@types/is-ci": "^2.0.0", + "@types/merge2": "^1.1.4", + "@types/micromatch": "^4.0.0", + "@types/minimist": "^1.2.0", + "@types/mocha": "^5.2.7", + "@types/node": "^12.7.8", + "@types/rimraf": "^2.0.2", + "@types/sinon": "^7.5.0", + "compute-stdev": "^1.0.0", + "easy-table": "^1.1.1", + "eslint": "^6.5.1", + "eslint-config-mrmlnc": "^1.1.0", + "execa": "^2.0.4", + "fast-glob": "^3.0.4", + "glob": "^7.1.4", + "is-ci": "^2.0.0", + "log-update": "^4.0.0", + "minimist": "^1.2.0", + "mocha": "^6.2.1", + "rimraf": "^3.0.0", + "sinon": "^7.5.0", + "tiny-glob": "^0.2.6", + "typescript": "^3.6.3" + }, + "engines": { + "node": ">=8" + }, + "homepage": "https://github.com/mrmlnc/fast-glob#readme", + "keywords": [ + "glob", + "patterns", + "fast", + "implementation" + ], + "license": "MIT", + "main": "out/index.js", + "name": "fast-glob", + "repository": { + "type": "git", + "url": "git+https://github.com/mrmlnc/fast-glob.git" + }, + "scripts": { + "bench": "npm run bench-async && npm run bench-stream && npm run bench-sync", + "bench-async": "npm run bench-async-flatten && npm run bench-async-deep && npm run bench-async-partial-flatten && npm run bench-async-partial-deep", + "bench-async-deep": "node ./out/benchmark --mode async --pattern \"**\"", + "bench-async-flatten": "node ./out/benchmark --mode async --pattern \"*\"", + "bench-async-partial-deep": "node ./out/benchmark --mode async --pattern \"{fixtures,out}/**\"", + "bench-async-partial-flatten": "node ./out/benchmark --mode async --pattern \"{fixtures,out}/{first,second}/*\"", + "bench-stream": "npm run bench-stream-flatten && npm run bench-stream-deep && npm run bench-stream-partial-flatten && npm run bench-stream-partial-deep", + "bench-stream-deep": "node ./out/benchmark --mode stream --pattern \"**\"", + "bench-stream-flatten": "node ./out/benchmark --mode stream --pattern \"*\"", + "bench-stream-partial-deep": "node ./out/benchmark --mode stream --pattern \"{fixtures,out}/**\"", + "bench-stream-partial-flatten": "node ./out/benchmark --mode stream --pattern \"{fixtures,out}/{first,second}/*\"", + "bench-sync": "npm run bench-sync-flatten && npm run bench-sync-deep && npm run bench-sync-partial-flatten && npm run bench-sync-partial-deep", + "bench-sync-deep": "node ./out/benchmark --mode sync --pattern \"**\"", + "bench-sync-flatten": "node ./out/benchmark --mode sync --pattern \"*\"", + "bench-sync-partial-deep": "node ./out/benchmark --mode sync --pattern \"{fixtures,out}/**\"", + "bench-sync-partial-flatten": "node ./out/benchmark --mode sync --pattern \"{fixtures,out}/{first,second}/*\"", + "build": "npm run clean && npm run compile && npm run lint && npm test", + "clean": "rimraf out", + "compile": "tsc", + "lint": "eslint \"src/**/*.ts\" --cache", + "smoke": "mocha \"out/**/*.smoke.js\" -s 0", + "smoke:async": "mocha \"out/**/*.smoke.js\" -s 0 --grep \"\\(async\\)\"", + "smoke:stream": "mocha \"out/**/*.smoke.js\" -s 0 --grep \"\\(stream\\)\"", + "smoke:sync": "mocha \"out/**/*.smoke.js\" -s 0 --grep \"\\(sync\\)\"", + "test": "mocha \"out/**/*.spec.js\" -s 0", + "watch": "npm run clean && npm run compile -- --sourceMap --watch" + }, + "typings": "out/index.d.ts", + "version": "3.2.5" +} diff --git a/node_modules/fastq/.github/workflows/ci.yml b/node_modules/fastq/.github/workflows/ci.yml new file mode 100644 index 00000000..d9ee2343 --- /dev/null +++ b/node_modules/fastq/.github/workflows/ci.yml @@ -0,0 +1,50 @@ +name: ci + +on: [push, pull_request] + +jobs: + legacy: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ['0.10', '0.12', 4.x, 6.x, 8.x] + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install + run: | + npm install --production && npm install tape + + - name: Run tests + run: | + npm run legacy + + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 13.x, 14.x, 15.x] + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install + run: | + npm install + + - name: Run tests + run: | + npm run test diff --git a/node_modules/fastq/LICENSE b/node_modules/fastq/LICENSE new file mode 100644 index 00000000..27c7bb46 --- /dev/null +++ b/node_modules/fastq/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2015-2020, Matteo Collina + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/fastq/README.md b/node_modules/fastq/README.md new file mode 100644 index 00000000..48aea357 --- /dev/null +++ b/node_modules/fastq/README.md @@ -0,0 +1,255 @@ +# fastq + +![ci][ci-url] +[![npm version][npm-badge]][npm-url] +[![Dependency Status][david-badge]][david-url] + +Fast, in memory work queue. + +Benchmarks (1 million tasks): + +* setImmediate: 812ms +* fastq: 854ms +* async.queue: 1298ms +* neoAsync.queue: 1249ms + +Obtained on node 12.16.1, on a dedicated server. + +If you need zero-overhead series function call, check out +[fastseries](http://npm.im/fastseries). For zero-overhead parallel +function call, check out [fastparallel](http://npm.im/fastparallel). + +[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard) + + * Installation + * Usage + * API + * Licence & copyright + +## Install + +`npm i fastq --save` + +## Usage + +```js +'use strict' + +var queue = require('fastq')(worker, 1) + +queue.push(42, function (err, result) { + if (err) { throw err } + console.log('the result is', result) +}) + +function worker (arg, cb) { + cb(null, 42 * 2) +} +``` + +or + +```js +var queue = require('fastq').promise(worker, 1) + +async function worker (arg) { + return 42 * 2 +} + +async function run () { + const result = await queue.push(42) + console.log('the result is', result) +}) +} + +run() +``` + +### Setting this + +```js +'use strict' + +var that = { hello: 'world' } +var queue = require('fastq')(that, worker, 1) + +queue.push(42, function (err, result) { + if (err) { throw err } + console.log(this) + console.log('the result is', result) +}) + +function worker (arg, cb) { + console.log(this) + cb(null, 42 * 2) +} +``` + +## API + +* fastqueue() +* queue#push() +* queue#unshift() +* queue#pause() +* queue#resume() +* queue#idle() +* queue#length() +* queue#getQueue() +* queue#kill() +* queue#killAndDrain() +* queue#error() +* queue#concurrency +* queue#drain +* queue#empty +* queue#saturated +* fastqueue.promise() + +------------------------------------------------------- + +### fastqueue([that], worker, concurrency) + +Creates a new queue. + +Arguments: + +* `that`, optional context of the `worker` function. +* `worker`, worker function, it would be called with `that` as `this`, + if that is specified. +* `concurrency`, number of concurrent tasks that could be executed in + parallel. + +------------------------------------------------------- + +### queue.push(task, done) + +Add a task at the end of the queue. `done(err, result)` will be called +when the task was processed. + +------------------------------------------------------- + +### queue.unshift(task, done) + +Add a task at the beginning of the queue. `done(err, result)` will be called +when the task was processed. + +------------------------------------------------------- + +### queue.pause() + +Pause the processing of tasks. Currently worked tasks are not +stopped. + +------------------------------------------------------- + +### queue.resume() + +Resume the processing of tasks. + +------------------------------------------------------- + +### queue.idle() + +Returns `false` if there are tasks being processed or waiting to be processed. +`true` otherwise. + +------------------------------------------------------- + +### queue.length() + +Returns the number of tasks waiting to be processed (in the queue). + +------------------------------------------------------- + +### queue.getQueue() + +Returns all the tasks be processed (in the queue). Returns empty array when there are no tasks + +------------------------------------------------------- + +### queue.kill() + +Removes all tasks waiting to be processed, and reset `drain` to an empty +function. + +------------------------------------------------------- + +### queue.killAndDrain() + +Same than `kill` but the `drain` function will be called before reset to empty. + +------------------------------------------------------- + +### queue.error(handler) + +Set a global error handler. `handler(err, task)` will be called +when any of the tasks return an error. + +------------------------------------------------------- + +### queue.concurrency + +Property that returns the number of concurrent tasks that could be executed in +parallel. It can be altered at runtime. + +------------------------------------------------------- + +### queue.drain + +Function that will be called when the last +item from the queue has been processed by a worker. +It can be altered at runtime. + +------------------------------------------------------- + +### queue.empty + +Function that will be called when the last +item from the queue has been assigned to a worker. +It can be altered at runtime. + +------------------------------------------------------- + +### queue.saturated + +Function that will be called when the queue hits the concurrency +limit. +It can be altered at runtime. + +------------------------------------------------------- + +### fastqueue.promise([that], worker(arg), concurrency) + +Creates a new queue with `Promise` apis. It also offers all the methods +and properties of the object returned by [`fastqueue`](#fastqueue) with the modified +[`push`](#pushPromise) and [`unshift`](#unshiftPromise) methods. + +Node v10+ is required to use the promisified version. + +Arguments: +* `that`, optional context of the `worker` function. +* `worker`, worker function, it would be called with `that` as `this`, + if that is specified. It MUST return a `Promise`. +* `concurrency`, number of concurrent tasks that could be executed in + parallel. + + +#### queue.push(task) => Promise + +Add a task at the end of the queue. The returned `Promise` will be fulfilled +when the task is processed. + + +#### queue.unshift(task) => Promise + +Add a task at the beginning of the queue. The returned `Promise` will be fulfilled +when the task is processed. + +## License + +ISC + +[ci-url]: https://github.com/mcollina/fastq/workflows/ci/badge.svg +[npm-badge]: https://badge.fury.io/js/fastq.svg +[npm-url]: https://badge.fury.io/js/fastq +[david-badge]: https://david-dm.org/mcollina/fastq.svg +[david-url]: https://david-dm.org/mcollina/fastq diff --git a/node_modules/fastq/bench.js b/node_modules/fastq/bench.js new file mode 100644 index 00000000..e7bb66ab --- /dev/null +++ b/node_modules/fastq/bench.js @@ -0,0 +1,66 @@ +'use strict' + +var max = 1000000 +var fastqueue = require('./')(worker, 1) +var { promisify } = require('util') +var immediate = promisify(setImmediate) +var qPromise = require('./').promise(immediate, 1) +var async = require('async') +var neo = require('neo-async') +var asyncqueue = async.queue(worker, 1) +var neoqueue = neo.queue(worker, 1) + +function bench (func, done) { + var key = max + '*' + func.name + var count = -1 + + console.time(key) + end() + + function end () { + if (++count < max) { + func(end) + } else { + console.timeEnd(key) + if (done) { + done() + } + } + } +} + +function benchFastQ (done) { + fastqueue.push(42, done) +} + +function benchAsyncQueue (done) { + asyncqueue.push(42, done) +} + +function benchNeoQueue (done) { + neoqueue.push(42, done) +} + +function worker (arg, cb) { + setImmediate(cb) +} + +function benchSetImmediate (cb) { + worker(42, cb) +} + +function benchFastQPromise (done) { + qPromise.push(42).then(function () { done() }, done) +} + +function runBench (done) { + async.eachSeries([ + benchSetImmediate, + benchFastQ, + benchNeoQueue, + benchAsyncQueue, + benchFastQPromise + ], bench, done) +} + +runBench(runBench) diff --git a/node_modules/fastq/example.js b/node_modules/fastq/example.js new file mode 100644 index 00000000..4f834c41 --- /dev/null +++ b/node_modules/fastq/example.js @@ -0,0 +1,12 @@ +'use strict' + +var queue = require('./')(worker, 1) + +queue.push(42, function (err, result) { + if (err) { throw err } + console.log('the result is', result) +}) + +function worker (arg, cb) { + cb(null, 42 * 2) +} diff --git a/node_modules/fastq/index.d.ts b/node_modules/fastq/index.d.ts new file mode 100644 index 00000000..33c1de7c --- /dev/null +++ b/node_modules/fastq/index.d.ts @@ -0,0 +1,35 @@ +declare function fastq(context: C, worker: fastq.worker, concurrency: number): fastq.queue +declare function fastq(worker: fastq.worker, concurrency: number): fastq.queue + +declare namespace fastq { + type worker = (this: C, task: T, cb: fastq.done) => void + type asyncWorker = (this: C, task: T) => Promise + type done = (err: Error | null, result?: R) => void + type errorHandler = (err: Error, task: T) => void + + interface queue { + push(task: T, done?: done): void + unshift(task: T, done?: done): void + pause(): any + resume(): any + idle(): boolean + length(): number + getQueue(): T[] + kill(): any + killAndDrain(): any + error(handler: errorHandler): void + concurrency: number + drain(): any + empty: () => void + saturated: () => void + } + + interface queueAsPromised extends queue { + push(task: T): Promise + } + + function promise(context: C, worker: fastq.asyncWorker, concurrency: number): fastq.queueAsPromised + function promise(worker: fastq.asyncWorker, concurrency: number): fastq.queueAsPromised +} + +export = fastq diff --git a/node_modules/fastq/package.json b/node_modules/fastq/package.json new file mode 100644 index 00000000..8801d022 --- /dev/null +++ b/node_modules/fastq/package.json @@ -0,0 +1,78 @@ +{ + "_args": [ + [ + "fastq@1.11.0", + "/workspaces/upload-google-play" + ] + ], + "_from": "fastq@1.11.0", + "_id": "fastq@1.11.0", + "_inBundle": false, + "_integrity": "sha512-7Eczs8gIPDrVzT+EksYBcupqMyxSHXXrHOLRRxU2/DicV8789MRBRR8+Hc2uWzUupOs4YS4JzBmBxjjCVBxD/g==", + "_location": "/fastq", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "fastq@1.11.0", + "name": "fastq", + "escapedName": "fastq", + "rawSpec": "1.11.0", + "saveSpec": null, + "fetchSpec": "1.11.0" + }, + "_requiredBy": [ + "/@nodelib/fs.walk" + ], + "_resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", + "_spec": "1.11.0", + "_where": "/workspaces/upload-google-play", + "author": { + "name": "Matteo Collina", + "email": "hello@matteocollina.com" + }, + "bugs": { + "url": "https://github.com/mcollina/fastq/issues" + }, + "dependencies": { + "reusify": "^1.0.4" + }, + "description": "Fast, in memory work queue", + "devDependencies": { + "async": "^3.1.0", + "neo-async": "^2.6.1", + "nyc": "^15.0.0", + "pre-commit": "^1.2.2", + "snazzy": "^9.0.0", + "standard": "^15.0.0", + "tape": "^5.0.0", + "typescript": "^4.0.2" + }, + "homepage": "https://github.com/mcollina/fastq#readme", + "keywords": [ + "fast", + "queue", + "async", + "worker" + ], + "license": "ISC", + "main": "queue.js", + "name": "fastq", + "pre-commit": [ + "test" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/mcollina/fastq.git" + }, + "scripts": { + "coverage": "nyc --reporter=html --reporter=cobertura --reporter=text tape test/test.js test/promise.js", + "legacy": "tape test/test.js", + "lint": "standard --verbose | snazzy", + "test": "npm run lint && npm run unit && npm run typescript", + "test:report": "npm run lint && npm run unit:report", + "typescript": "tsc --project ./test/tsconfig.json", + "unit": "nyc --lines 100 --branches 100 --functions 100 --check-coverage --reporter=text tape test/test.js test/promise.js" + }, + "version": "1.11.0" +} diff --git a/node_modules/fastq/queue.js b/node_modules/fastq/queue.js new file mode 100644 index 00000000..f543c092 --- /dev/null +++ b/node_modules/fastq/queue.js @@ -0,0 +1,253 @@ +'use strict' + +var reusify = require('reusify') + +function fastqueue (context, worker, concurrency) { + if (typeof context === 'function') { + concurrency = worker + worker = context + context = null + } + + if (concurrency < 1) { + throw new Error('fastqueue concurrency must be greater than 1') + } + + var cache = reusify(Task) + var queueHead = null + var queueTail = null + var _running = 0 + var errorHandler = null + + var self = { + push: push, + drain: noop, + saturated: noop, + pause: pause, + paused: false, + concurrency: concurrency, + running: running, + resume: resume, + idle: idle, + length: length, + getQueue: getQueue, + unshift: unshift, + empty: noop, + kill: kill, + killAndDrain: killAndDrain, + error: error + } + + return self + + function running () { + return _running + } + + function pause () { + self.paused = true + } + + function length () { + var current = queueHead + var counter = 0 + + while (current) { + current = current.next + counter++ + } + + return counter + } + + function getQueue () { + var current = queueHead + var tasks = [] + + while (current) { + tasks.push(current.value) + current = current.next + } + + return tasks + } + + function resume () { + if (!self.paused) return + self.paused = false + for (var i = 0; i < self.concurrency; i++) { + _running++ + release() + } + } + + function idle () { + return _running === 0 && self.length() === 0 + } + + function push (value, done) { + var current = cache.get() + + current.context = context + current.release = release + current.value = value + current.callback = done || noop + current.errorHandler = errorHandler + + if (_running === self.concurrency || self.paused) { + if (queueTail) { + queueTail.next = current + queueTail = current + } else { + queueHead = current + queueTail = current + self.saturated() + } + } else { + _running++ + worker.call(context, current.value, current.worked) + } + } + + function unshift (value, done) { + var current = cache.get() + + current.context = context + current.release = release + current.value = value + current.callback = done || noop + + if (_running === self.concurrency || self.paused) { + if (queueHead) { + current.next = queueHead + queueHead = current + } else { + queueHead = current + queueTail = current + self.saturated() + } + } else { + _running++ + worker.call(context, current.value, current.worked) + } + } + + function release (holder) { + if (holder) { + cache.release(holder) + } + var next = queueHead + if (next) { + if (!self.paused) { + if (queueTail === queueHead) { + queueTail = null + } + queueHead = next.next + next.next = null + worker.call(context, next.value, next.worked) + if (queueTail === null) { + self.empty() + } + } else { + _running-- + } + } else if (--_running === 0) { + self.drain() + } + } + + function kill () { + queueHead = null + queueTail = null + self.drain = noop + } + + function killAndDrain () { + queueHead = null + queueTail = null + self.drain() + self.drain = noop + } + + function error (handler) { + errorHandler = handler + } +} + +function noop () {} + +function Task () { + this.value = null + this.callback = noop + this.next = null + this.release = noop + this.context = null + this.errorHandler = null + + var self = this + + this.worked = function worked (err, result) { + var callback = self.callback + var errorHandler = self.errorHandler + var val = self.value + self.value = null + self.callback = noop + if (self.errorHandler) { + errorHandler(err, val) + } + callback.call(self.context, err, result) + self.release(self) + } +} + +function queueAsPromised (context, worker, concurrency) { + if (typeof context === 'function') { + concurrency = worker + worker = context + context = null + } + + function asyncWrapper (arg, cb) { + worker.call(this, arg) + .then(function (res) { + cb(null, res) + }, cb) + } + + var queue = fastqueue(context, asyncWrapper, concurrency) + + var pushCb = queue.push + var unshiftCb = queue.unshift + + queue.push = push + queue.unshift = unshift + + return queue + + function push (value) { + return new Promise(function (resolve, reject) { + pushCb(value, function (err, result) { + if (err) { + reject(err) + return + } + resolve(result) + }) + }) + } + + function unshift (value) { + return new Promise(function (resolve, reject) { + unshiftCb(value, function (err, result) { + if (err) { + reject(err) + return + } + resolve(result) + }) + }) + } +} + +module.exports = fastqueue +module.exports.promise = queueAsPromised diff --git a/node_modules/fastq/test/example.ts b/node_modules/fastq/test/example.ts new file mode 100644 index 00000000..c454e9d0 --- /dev/null +++ b/node_modules/fastq/test/example.ts @@ -0,0 +1,81 @@ +import * as fastq from '../' +import { promise as queueAsPromised } from '../' + +// Basic example + +const queue = fastq(worker, 1) + +queue.push('world', (err, result) => { + if (err) throw err + console.log('the result is', result) +}) + +queue.push('push without cb') + +queue.concurrency + +queue.drain() + +queue.empty = () => undefined + +console.log('the queue tasks are', queue.getQueue()) + +queue.idle() + +queue.kill() + +queue.killAndDrain() + +queue.length + +queue.pause() + +queue.resume() + +queue.saturated = () => undefined + +queue.unshift('world', (err, result) => { + if (err) throw err + console.log('the result is', result) +}) + +queue.unshift('unshift without cb') + +function worker(task: any, cb: fastq.done) { + cb(null, 'hello ' + task) +} + +// Generics example + +interface GenericsContext { + base: number; +} + +const genericsQueue = fastq({ base: 6 }, genericsWorker, 1) + +genericsQueue.push(7, (err, done) => { + if (err) throw err + console.log('the result is', done) +}) + +genericsQueue.unshift(7, (err, done) => { + if (err) throw err + console.log('the result is', done) +}) + +function genericsWorker(this: GenericsContext, task: number, cb: fastq.done) { + cb(null, 'the meaning of life is ' + (this.base * task)) +} + +const queue2 = queueAsPromised(asyncWorker, 1) + +async function asyncWorker(task: any) { + return 'hello ' + task +} + +async function run () { + await queue.push(42) + await queue.unshift(42) +} + +run() diff --git a/node_modules/fastq/test/promise.js b/node_modules/fastq/test/promise.js new file mode 100644 index 00000000..02b4710c --- /dev/null +++ b/node_modules/fastq/test/promise.js @@ -0,0 +1,120 @@ +'use strict' + +const test = require('tape') +const buildQueue = require('../').promise +const { promisify } = require('util') +const sleep = promisify(setTimeout) + +test('concurrency', function (t) { + t.plan(2) + t.throws(buildQueue.bind(null, worker, 0)) + t.doesNotThrow(buildQueue.bind(null, worker, 1)) + + async function worker (arg) { + return true + } +}) + +test('worker execution', async function (t) { + var queue = buildQueue(worker, 1) + + const result = await queue.push(42) + + t.equal(result, true, 'result matches') + + async function worker (arg) { + t.equal(arg, 42) + return true + } +}) + +test('limit', async function (t) { + var queue = buildQueue(worker, 1) + + const [res1, res2] = await Promise.all([queue.push(10), queue.push(0)]) + t.equal(res1, 10, 'the result matches') + t.equal(res2, 0, 'the result matches') + + async function worker (arg) { + await sleep(arg) + return arg + } +}) + +test('multiple executions', async function (t) { + var queue = buildQueue(worker, 1) + var toExec = [1, 2, 3, 4, 5] + var expected = ['a', 'b', 'c', 'd', 'e'] + var count = 0 + + await Promise.all(toExec.map(async function (task, i) { + const result = await queue.push(task) + t.equal(result, expected[i], 'the result matches') + })) + + async function worker (arg) { + t.equal(arg, toExec[count], 'arg matches') + return expected[count++] + } +}) + +test('set this', async function (t) { + t.plan(1) + var that = {} + var queue = buildQueue(that, worker, 1) + + await queue.push(42) + + async function worker (arg) { + t.equal(this, that, 'this matches') + } +}) + +test('unshift', async function (t) { + var queue = buildQueue(worker, 1) + var expected = [1, 2, 3, 4] + + await Promise.all([ + queue.push(1), + queue.push(4), + queue.unshift(3), + queue.unshift(2) + ]) + + t.is(expected.length, 0) + + async function worker (arg) { + t.equal(expected.shift(), arg, 'tasks come in order') + } +}) + +test('push with worker throwing error', async function (t) { + t.plan(5) + var q = buildQueue(async function (task, cb) { + throw new Error('test error') + }, 1) + q.error(function (err, task) { + t.ok(err instanceof Error, 'global error handler should catch the error') + t.match(err.message, /test error/, 'error message should be "test error"') + t.equal(task, 42, 'The task executed should be passed') + }) + try { + await q.push(42) + } catch (err) { + t.ok(err instanceof Error, 'push callback should catch the error') + t.match(err.message, /test error/, 'error message should be "test error"') + } +}) + +test('unshift with worker throwing error', async function (t) { + t.plan(2) + var q = buildQueue(async function (task, cb) { + throw new Error('test error') + }, 1) + try { + await q.unshift(42) + } catch (err) { + t.ok(err instanceof Error, 'push callback should catch the error') + t.match(err.message, /test error/, 'error message should be "test error"') + } +}) diff --git a/node_modules/fastq/test/test.js b/node_modules/fastq/test/test.js new file mode 100644 index 00000000..60b1de76 --- /dev/null +++ b/node_modules/fastq/test/test.js @@ -0,0 +1,564 @@ +'use strict' + +var test = require('tape') +var buildQueue = require('../') + +test('concurrency', function (t) { + t.plan(2) + t.throws(buildQueue.bind(null, worker, 0)) + t.doesNotThrow(buildQueue.bind(null, worker, 1)) + + function worker (arg, cb) { + cb(null, true) + } +}) + +test('worker execution', function (t) { + t.plan(3) + + var queue = buildQueue(worker, 1) + + queue.push(42, function (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + }) + + function worker (arg, cb) { + t.equal(arg, 42) + cb(null, true) + } +}) + +test('limit', function (t) { + t.plan(4) + + var expected = [10, 0] + var queue = buildQueue(worker, 1) + + queue.push(10, result) + queue.push(0, result) + + function result (err, arg) { + t.error(err, 'no error') + t.equal(arg, expected.shift(), 'the result matches') + } + + function worker (arg, cb) { + setTimeout(cb, arg, null, arg) + } +}) + +test('multiple executions', function (t) { + t.plan(15) + + var queue = buildQueue(worker, 1) + var toExec = [1, 2, 3, 4, 5] + var count = 0 + + toExec.forEach(function (task) { + queue.push(task, done) + }) + + function done (err, result) { + t.error(err, 'no error') + t.equal(result, toExec[count - 1], 'the result matches') + } + + function worker (arg, cb) { + t.equal(arg, toExec[count], 'arg matches') + count++ + setImmediate(cb, null, arg) + } +}) + +test('multiple executions, one after another', function (t) { + t.plan(15) + + var queue = buildQueue(worker, 1) + var toExec = [1, 2, 3, 4, 5] + var count = 0 + + queue.push(toExec[0], done) + + function done (err, result) { + t.error(err, 'no error') + t.equal(result, toExec[count - 1], 'the result matches') + if (count < toExec.length) { + queue.push(toExec[count], done) + } + } + + function worker (arg, cb) { + t.equal(arg, toExec[count], 'arg matches') + count++ + setImmediate(cb, null, arg) + } +}) + +test('set this', function (t) { + t.plan(3) + + var that = {} + var queue = buildQueue(that, worker, 1) + + queue.push(42, function (err, result) { + t.error(err, 'no error') + t.equal(this, that, 'this matches') + }) + + function worker (arg, cb) { + t.equal(this, that, 'this matches') + cb(null, true) + } +}) + +test('drain', function (t) { + t.plan(4) + + var queue = buildQueue(worker, 1) + var worked = false + + queue.push(42, function (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + }) + + queue.drain = function () { + t.equal(true, worked, 'drained') + } + + function worker (arg, cb) { + t.equal(arg, 42) + worked = true + setImmediate(cb, null, true) + } +}) + +test('pause && resume', function (t) { + t.plan(7) + + var queue = buildQueue(worker, 1) + var worked = false + + t.notOk(queue.paused, 'it should not be paused') + + queue.pause() + + queue.push(42, function (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + }) + + t.notOk(worked, 'it should be paused') + t.ok(queue.paused, 'it should be paused') + + queue.resume() + queue.resume() // second resume is a no-op + + t.notOk(queue.paused, 'it should not be paused') + + function worker (arg, cb) { + t.equal(arg, 42) + worked = true + cb(null, true) + } +}) + +test('pause in flight && resume', function (t) { + t.plan(9) + + var queue = buildQueue(worker, 1) + var expected = [42, 24] + + t.notOk(queue.paused, 'it should not be paused') + + queue.push(42, function (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + t.ok(queue.paused, 'it should be paused') + process.nextTick(function () { queue.resume() }) + }) + + queue.push(24, function (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + t.notOk(queue.paused, 'it should not be paused') + }) + + queue.pause() + + function worker (arg, cb) { + t.equal(arg, expected.shift()) + process.nextTick(function () { cb(null, true) }) + } +}) + +test('altering concurrency', function (t) { + t.plan(7) + + var queue = buildQueue(worker, 1) + var count = 0 + + queue.pause() + + queue.push(24, workDone) + queue.push(24, workDone) + + queue.concurrency = 2 + + queue.resume() + + t.equal(queue.running(), 2, '2 jobs running') + + function workDone (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + } + + function worker (arg, cb) { + t.equal(0, count, 'works in parallel') + setImmediate(function () { + count++ + cb(null, true) + }) + } +}) + +test('idle()', function (t) { + t.plan(12) + + var queue = buildQueue(worker, 1) + + t.ok(queue.idle(), 'queue is idle') + + queue.push(42, function (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + t.notOk(queue.idle(), 'queue is not idle') + }) + + queue.push(42, function (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + // it will go idle after executing this function + setImmediate(function () { + t.ok(queue.idle(), 'queue is now idle') + }) + }) + + t.notOk(queue.idle(), 'queue is not idle') + + function worker (arg, cb) { + t.notOk(queue.idle(), 'queue is not idle') + t.equal(arg, 42) + setImmediate(cb, null, true) + } +}) + +test('saturated', function (t) { + t.plan(9) + + var queue = buildQueue(worker, 1) + var preworked = 0 + var worked = 0 + + queue.saturated = function () { + t.pass('saturated') + t.equal(preworked, 1, 'started 1 task') + t.equal(worked, 0, 'worked zero task') + } + + queue.push(42, done) + queue.push(42, done) + + function done (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + } + + function worker (arg, cb) { + t.equal(arg, 42) + preworked++ + setImmediate(function () { + worked++ + cb(null, true) + }) + } +}) + +test('length', function (t) { + t.plan(7) + + var queue = buildQueue(worker, 1) + + t.equal(queue.length(), 0, 'nothing waiting') + queue.push(42, done) + t.equal(queue.length(), 0, 'nothing waiting') + queue.push(42, done) + t.equal(queue.length(), 1, 'one task waiting') + queue.push(42, done) + t.equal(queue.length(), 2, 'two tasks waiting') + + function done (err, result) { + t.error(err, 'no error') + } + + function worker (arg, cb) { + setImmediate(function () { + cb(null, true) + }) + } +}) + +test('getQueue', function (t) { + t.plan(10) + + var queue = buildQueue(worker, 1) + + t.equal(queue.getQueue().length, 0, 'nothing waiting') + queue.push(42, done) + t.equal(queue.getQueue().length, 0, 'nothing waiting') + queue.push(42, done) + t.equal(queue.getQueue().length, 1, 'one task waiting') + t.equal(queue.getQueue()[0], 42, 'should be equal') + queue.push(43, done) + t.equal(queue.getQueue().length, 2, 'two tasks waiting') + t.equal(queue.getQueue()[0], 42, 'should be equal') + t.equal(queue.getQueue()[1], 43, 'should be equal') + + function done (err, result) { + t.error(err, 'no error') + } + + function worker (arg, cb) { + setImmediate(function () { + cb(null, true) + }) + } +}) + +test('unshift', function (t) { + t.plan(8) + + var queue = buildQueue(worker, 1) + var expected = [1, 2, 3, 4] + + queue.push(1, done) + queue.push(4, done) + queue.unshift(3, done) + queue.unshift(2, done) + + function done (err, result) { + t.error(err, 'no error') + } + + function worker (arg, cb) { + t.equal(expected.shift(), arg, 'tasks come in order') + setImmediate(function () { + cb(null, true) + }) + } +}) + +test('unshift && empty', function (t) { + t.plan(2) + + var queue = buildQueue(worker, 1) + var completed = false + + queue.pause() + + queue.empty = function () { + t.notOk(completed, 'the task has not completed yet') + } + + queue.unshift(1, done) + + queue.resume() + + function done (err, result) { + completed = true + t.error(err, 'no error') + } + + function worker (arg, cb) { + setImmediate(function () { + cb(null, true) + }) + } +}) + +test('push && empty', function (t) { + t.plan(2) + + var queue = buildQueue(worker, 1) + var completed = false + + queue.pause() + + queue.empty = function () { + t.notOk(completed, 'the task has not completed yet') + } + + queue.push(1, done) + + queue.resume() + + function done (err, result) { + completed = true + t.error(err, 'no error') + } + + function worker (arg, cb) { + setImmediate(function () { + cb(null, true) + }) + } +}) + +test('kill', function (t) { + t.plan(5) + + var queue = buildQueue(worker, 1) + var expected = [1] + + var predrain = queue.drain + + queue.drain = function drain () { + t.fail('drain should never be called') + } + + queue.push(1, done) + queue.push(4, done) + queue.unshift(3, done) + queue.unshift(2, done) + queue.kill() + + function done (err, result) { + t.error(err, 'no error') + setImmediate(function () { + t.equal(queue.length(), 0, 'no queued tasks') + t.equal(queue.running(), 0, 'no running tasks') + t.equal(queue.drain, predrain, 'drain is back to default') + }) + } + + function worker (arg, cb) { + t.equal(expected.shift(), arg, 'tasks come in order') + setImmediate(function () { + cb(null, true) + }) + } +}) + +test('killAndDrain', function (t) { + t.plan(6) + + var queue = buildQueue(worker, 1) + var expected = [1] + + var predrain = queue.drain + + queue.drain = function drain () { + t.pass('drain has been called') + } + + queue.push(1, done) + queue.push(4, done) + queue.unshift(3, done) + queue.unshift(2, done) + queue.killAndDrain() + + function done (err, result) { + t.error(err, 'no error') + setImmediate(function () { + t.equal(queue.length(), 0, 'no queued tasks') + t.equal(queue.running(), 0, 'no running tasks') + t.equal(queue.drain, predrain, 'drain is back to default') + }) + } + + function worker (arg, cb) { + t.equal(expected.shift(), arg, 'tasks come in order') + setImmediate(function () { + cb(null, true) + }) + } +}) + +test('pause && idle', function (t) { + t.plan(11) + + var queue = buildQueue(worker, 1) + var worked = false + + t.notOk(queue.paused, 'it should not be paused') + t.ok(queue.idle(), 'should be idle') + + queue.pause() + + queue.push(42, function (err, result) { + t.error(err, 'no error') + t.equal(result, true, 'result matches') + }) + + t.notOk(worked, 'it should be paused') + t.ok(queue.paused, 'it should be paused') + t.notOk(queue.idle(), 'should not be idle') + + queue.resume() + + t.notOk(queue.paused, 'it should not be paused') + t.notOk(queue.idle(), 'it should not be idle') + + function worker (arg, cb) { + t.equal(arg, 42) + worked = true + process.nextTick(cb.bind(null, null, true)) + process.nextTick(function () { + t.ok(queue.idle(), 'is should be idle') + }) + } +}) + +test('push without cb', function (t) { + t.plan(1) + + var queue = buildQueue(worker, 1) + + queue.push(42) + + function worker (arg, cb) { + t.equal(arg, 42) + cb() + } +}) + +test('unshift without cb', function (t) { + t.plan(1) + + var queue = buildQueue(worker, 1) + + queue.unshift(42) + + function worker (arg, cb) { + t.equal(arg, 42) + cb() + } +}) + +test('push with worker throwing error', function (t) { + t.plan(5) + var q = buildQueue(function (task, cb) { + cb(new Error('test error'), null) + }, 1) + q.error(function (err, task) { + t.ok(err instanceof Error, 'global error handler should catch the error') + t.match(err.message, /test error/, 'error message should be "test error"') + t.equal(task, 42, 'The task executed should be passed') + }) + q.push(42, function (err) { + t.ok(err instanceof Error, 'push callback should catch the error') + t.match(err.message, /test error/, 'error message should be "test error"') + }) +}) diff --git a/node_modules/fastq/test/tsconfig.json b/node_modules/fastq/test/tsconfig.json new file mode 100644 index 00000000..66e16e93 --- /dev/null +++ b/node_modules/fastq/test/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es6", + "module": "commonjs", + "noEmit": true, + "strict": true + }, + "files": [ + "./example.ts" + ] +} diff --git a/node_modules/glob-parent/CHANGELOG.md b/node_modules/glob-parent/CHANGELOG.md new file mode 100644 index 00000000..fb9de961 --- /dev/null +++ b/node_modules/glob-parent/CHANGELOG.md @@ -0,0 +1,110 @@ +### [5.1.2](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) (2021-03-06) + + +### Bug Fixes + +* eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366)) + +### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27) + + +### Bug Fixes + +* unescape exclamation mark ([#26](https://github.com/gulpjs/glob-parent/issues/26)) ([a98874f](https://github.com/gulpjs/glob-parent/commit/a98874f1a59e407f4fb1beb0db4efa8392da60bb)) + +## [5.1.0](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.0) (2021-01-27) + + +### Features + +* add `flipBackslashes` option to disable auto conversion of slashes (closes [#24](https://github.com/gulpjs/glob-parent/issues/24)) ([#25](https://github.com/gulpjs/glob-parent/issues/25)) ([eecf91d](https://github.com/gulpjs/glob-parent/commit/eecf91d5e3834ed78aee39c4eaaae654d76b87b3)) + +## [5.0.0](https://github.com/gulpjs/glob-parent/compare/v4.0.0...v5.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* Drop support for node <6 & bump dependencies + +### Miscellaneous Chores + +* Drop support for node <6 & bump dependencies ([896c0c0](https://github.com/gulpjs/glob-parent/commit/896c0c00b4e7362f60b96e7fc295ae929245255a)) + +## [4.0.0](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v4.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* question marks are valid path characters on Windows so avoid flagging as a glob when alone +* Update is-glob dependency + +### Features + +* hoist regexps and strings for performance gains ([4a80667](https://github.com/gulpjs/glob-parent/commit/4a80667c69355c76a572a5892b0f133c8e1f457e)) +* question marks are valid path characters on Windows so avoid flagging as a glob when alone ([2a551dd](https://github.com/gulpjs/glob-parent/commit/2a551dd0dc3235e78bf3c94843d4107072d17841)) +* Update is-glob dependency ([e41fcd8](https://github.com/gulpjs/glob-parent/commit/e41fcd895d1f7bc617dba45c9d935a7949b9c281)) + +## [3.1.0](https://github.com/gulpjs/glob-parent/compare/v3.0.1...v3.1.0) (2021-01-27) + + +### Features + +* allow basic win32 backslash use ([272afa5](https://github.com/gulpjs/glob-parent/commit/272afa5fd070fc0f796386a5993d4ee4a846988b)) +* handle extglobs (parentheses) containing separators ([7db1bdb](https://github.com/gulpjs/glob-parent/commit/7db1bdb0756e55fd14619e8ce31aa31b17b117fd)) +* new approach to braces/brackets handling ([8269bd8](https://github.com/gulpjs/glob-parent/commit/8269bd89290d99fac9395a354fb56fdcdb80f0be)) +* pre-process braces/brackets sections ([9ef8a87](https://github.com/gulpjs/glob-parent/commit/9ef8a87f66b1a43d0591e7a8e4fc5a18415ee388)) +* preserve escaped brace/bracket at end of string ([8cfb0ba](https://github.com/gulpjs/glob-parent/commit/8cfb0ba84202d51571340dcbaf61b79d16a26c76)) + + +### Bug Fixes + +* trailing escaped square brackets ([99ec9fe](https://github.com/gulpjs/glob-parent/commit/99ec9fecc60ee488ded20a94dd4f18b4f55c4ccf)) + +### [3.0.1](https://github.com/gulpjs/glob-parent/compare/v3.0.0...v3.0.1) (2021-01-27) + + +### Features + +* use path-dirname ponyfill ([cdbea5f](https://github.com/gulpjs/glob-parent/commit/cdbea5f32a58a54e001a75ddd7c0fccd4776aacc)) + + +### Bug Fixes + +* unescape glob-escaped dirnames on output ([598c533](https://github.com/gulpjs/glob-parent/commit/598c533bdf49c1428bc063aa9b8db40c5a86b030)) + +## [3.0.0](https://github.com/gulpjs/glob-parent/compare/v2.0.0...v3.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* update is-glob dependency + +### Features + +* update is-glob dependency ([5c5f8ef](https://github.com/gulpjs/glob-parent/commit/5c5f8efcee362a8e7638cf8220666acd8784f6bd)) + +## [2.0.0](https://github.com/gulpjs/glob-parent/compare/v1.3.0...v2.0.0) (2021-01-27) + + +### Features + +* move up to dirname regardless of glob characters ([f97fb83](https://github.com/gulpjs/glob-parent/commit/f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2)) + +## [1.3.0](https://github.com/gulpjs/glob-parent/compare/v1.2.0...v1.3.0) (2021-01-27) + +## [1.2.0](https://github.com/gulpjs/glob-parent/compare/v1.1.0...v1.2.0) (2021-01-27) + + +### Reverts + +* feat: make regex test strings smaller ([dc80fa9](https://github.com/gulpjs/glob-parent/commit/dc80fa9658dca20549cfeba44bbd37d5246fcce0)) + +## [1.1.0](https://github.com/gulpjs/glob-parent/compare/v1.0.0...v1.1.0) (2021-01-27) + + +### Features + +* make regex test strings smaller ([cd83220](https://github.com/gulpjs/glob-parent/commit/cd832208638f45169f986d80fcf66e401f35d233)) + +## 1.0.0 (2021-01-27) + diff --git a/node_modules/glob-parent/LICENSE b/node_modules/glob-parent/LICENSE new file mode 100644 index 00000000..63222d7a --- /dev/null +++ b/node_modules/glob-parent/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2015, 2019 Elan Shanker + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/glob-parent/README.md b/node_modules/glob-parent/README.md new file mode 100644 index 00000000..36a27938 --- /dev/null +++ b/node_modules/glob-parent/README.md @@ -0,0 +1,137 @@ +

+ + + +

+ +# glob-parent + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] + +Extract the non-magic parent path from a glob string. + +## Usage + +```js +var globParent = require('glob-parent'); + +globParent('path/to/*.js'); // 'path/to' +globParent('/root/path/to/*.js'); // '/root/path/to' +globParent('/*.js'); // '/' +globParent('*.js'); // '.' +globParent('**/*.js'); // '.' +globParent('path/{to,from}'); // 'path' +globParent('path/!(to|from)'); // 'path' +globParent('path/?(to|from)'); // 'path' +globParent('path/+(to|from)'); // 'path' +globParent('path/*(to|from)'); // 'path' +globParent('path/@(to|from)'); // 'path' +globParent('path/**/*'); // 'path' + +// if provided a non-glob path, returns the nearest dir +globParent('path/foo/bar.js'); // 'path/foo' +globParent('path/foo/'); // 'path/foo' +globParent('path/foo'); // 'path' (see issue #3 for details) +``` + +## API + +### `globParent(maybeGlobString, [options])` + +Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below. + +#### options + +```js +{ + // Disables the automatic conversion of slashes for Windows + flipBackslashes: true +} +``` + +## Escaping + +The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: + +- `?` (question mark) unless used as a path segment alone +- `*` (asterisk) +- `|` (pipe) +- `(` (opening parenthesis) +- `)` (closing parenthesis) +- `{` (opening curly brace) +- `}` (closing curly brace) +- `[` (opening bracket) +- `]` (closing bracket) + +**Example** + +```js +globParent('foo/[bar]/') // 'foo' +globParent('foo/\\[bar]/') // 'foo/[bar]' +``` + +## Limitations + +### Braces & Brackets +This library attempts a quick and imperfect method of determining which path +parts have glob magic without fully parsing/lexing the pattern. There are some +advanced use cases that can trip it up, such as nested braces where the outer +pair is escaped and the inner one contains a path separator. If you find +yourself in the unlikely circumstance of being affected by this or need to +ensure higher-fidelity glob handling in your library, it is recommended that you +pre-process your input with [expand-braces] and/or [expand-brackets]. + +### Windows +Backslashes are not valid path separators for globs. If a path with backslashes +is provided anyway, for simple cases, glob-parent will replace the path +separator for you and return the non-glob parent path (now with +forward-slashes, which are still valid as Windows path separators). + +This cannot be used in conjunction with escape characters. + +```js +// BAD +globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)' + +// GOOD +globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)' +``` + +If you are using escape characters for a pattern without path parts (i.e. +relative to `cwd`), prefix with `./` to avoid confusing glob-parent. + +```js +// BAD +globParent('foo \\[bar]') // 'foo ' +globParent('foo \\[bar]*') // 'foo ' + +// GOOD +globParent('./foo \\[bar]') // 'foo [bar]' +globParent('./foo \\[bar]*') // '.' +``` + +## License + +ISC + +[expand-braces]: https://github.com/jonschlinkert/expand-braces +[expand-brackets]: https://github.com/jonschlinkert/expand-brackets + +[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg +[npm-url]: https://www.npmjs.com/package/glob-parent +[npm-image]: https://img.shields.io/npm/v/glob-parent.svg + +[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master +[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master + +[travis-url]: https://travis-ci.org/gulpjs/glob-parent +[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/node_modules/glob-parent/index.js b/node_modules/glob-parent/index.js new file mode 100644 index 00000000..09e257ea --- /dev/null +++ b/node_modules/glob-parent/index.js @@ -0,0 +1,42 @@ +'use strict'; + +var isGlob = require('is-glob'); +var pathPosixDirname = require('path').posix.dirname; +var isWin32 = require('os').platform() === 'win32'; + +var slash = '/'; +var backslash = /\\/g; +var enclosure = /[\{\[].*[\}\]]$/; +var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; +var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; + +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + * @returns {string} + */ +module.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + + // flip windows path separators + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } + + // special case for strings ending in enclosure containing path separator + if (enclosure.test(str)) { + str += slash; + } + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do { + str = pathPosixDirname(str); + } while (isGlob(str) || globby.test(str)); + + // remove escape chars and return result + return str.replace(escaped, '$1'); +}; diff --git a/node_modules/glob-parent/package.json b/node_modules/glob-parent/package.json new file mode 100644 index 00000000..746e3053 --- /dev/null +++ b/node_modules/glob-parent/package.json @@ -0,0 +1,93 @@ +{ + "_args": [ + [ + "glob-parent@5.1.2", + "/workspaces/upload-google-play" + ] + ], + "_from": "glob-parent@5.1.2", + "_id": "glob-parent@5.1.2", + "_inBundle": false, + "_integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "_location": "/glob-parent", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "glob-parent@5.1.2", + "name": "glob-parent", + "escapedName": "glob-parent", + "rawSpec": "5.1.2", + "saveSpec": null, + "fetchSpec": "5.1.2" + }, + "_requiredBy": [ + "/fast-glob" + ], + "_resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "_spec": "5.1.2", + "_where": "/workspaces/upload-google-play", + "author": { + "name": "Gulp Team", + "email": "team@gulpjs.com", + "url": "https://gulpjs.com/" + }, + "bugs": { + "url": "https://github.com/gulpjs/glob-parent/issues" + }, + "contributors": [ + { + "name": "Elan Shanker", + "url": "https://github.com/es128" + }, + { + "name": "Blaine Bublitz", + "email": "blaine.bublitz@gmail.com" + } + ], + "dependencies": { + "is-glob": "^4.0.1" + }, + "description": "Extract the non-magic parent path from a glob string.", + "devDependencies": { + "coveralls": "^3.0.11", + "eslint": "^2.13.1", + "eslint-config-gulp": "^3.0.1", + "expect": "^1.20.2", + "mocha": "^6.0.2", + "nyc": "^13.3.0" + }, + "engines": { + "node": ">= 6" + }, + "files": [ + "LICENSE", + "index.js" + ], + "homepage": "https://github.com/gulpjs/glob-parent#readme", + "keywords": [ + "glob", + "parent", + "strip", + "path", + "dirname", + "directory", + "base", + "wildcard" + ], + "license": "ISC", + "main": "index.js", + "name": "glob-parent", + "repository": { + "type": "git", + "url": "git+https://github.com/gulpjs/glob-parent.git" + }, + "scripts": { + "azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit", + "coveralls": "nyc report --reporter=text-lcov | coveralls", + "lint": "eslint .", + "pretest": "npm run lint", + "test": "nyc mocha --async-only" + }, + "version": "5.1.2" +} diff --git a/node_modules/is-extglob/LICENSE b/node_modules/is-extglob/LICENSE new file mode 100644 index 00000000..842218cf --- /dev/null +++ b/node_modules/is-extglob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, Jon Schlinkert + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/is-extglob/README.md b/node_modules/is-extglob/README.md new file mode 100644 index 00000000..0416af5c --- /dev/null +++ b/node_modules/is-extglob/README.md @@ -0,0 +1,107 @@ +# is-extglob [![NPM version](https://img.shields.io/npm/v/is-extglob.svg?style=flat)](https://www.npmjs.com/package/is-extglob) [![NPM downloads](https://img.shields.io/npm/dm/is-extglob.svg?style=flat)](https://npmjs.org/package/is-extglob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-extglob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-extglob) + +> Returns true if a string has an extglob. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-extglob +``` + +## Usage + +```js +var isExtglob = require('is-extglob'); +``` + +**True** + +```js +isExtglob('?(abc)'); +isExtglob('@(abc)'); +isExtglob('!(abc)'); +isExtglob('*(abc)'); +isExtglob('+(abc)'); +``` + +**False** + +Escaped extglobs: + +```js +isExtglob('\\?(abc)'); +isExtglob('\\@(abc)'); +isExtglob('\\!(abc)'); +isExtglob('\\*(abc)'); +isExtglob('\\+(abc)'); +``` + +Everything else... + +```js +isExtglob('foo.js'); +isExtglob('!foo.js'); +isExtglob('*.js'); +isExtglob('**/abc.js'); +isExtglob('abc/*.js'); +isExtglob('abc/(aaa|bbb).js'); +isExtglob('abc/[a-z].js'); +isExtglob('abc/{a,b}.js'); +isExtglob('abc/?.js'); +isExtglob('abc.js'); +isExtglob('abc/def/ghi.js'); +``` + +## History + +**v2.0** + +Adds support for escaping. Escaped exglobs no longer return true. + +## About + +### Related projects + +* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.") +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._ \ No newline at end of file diff --git a/node_modules/is-extglob/index.js b/node_modules/is-extglob/index.js new file mode 100644 index 00000000..c1d986fc --- /dev/null +++ b/node_modules/is-extglob/index.js @@ -0,0 +1,20 @@ +/*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +module.exports = function isExtglob(str) { + if (typeof str !== 'string' || str === '') { + return false; + } + + var match; + while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); + } + + return false; +}; diff --git a/node_modules/is-extglob/package.json b/node_modules/is-extglob/package.json new file mode 100644 index 00000000..e21cb0b5 --- /dev/null +++ b/node_modules/is-extglob/package.json @@ -0,0 +1,103 @@ +{ + "_args": [ + [ + "is-extglob@2.1.1", + "/workspaces/upload-google-play" + ] + ], + "_from": "is-extglob@2.1.1", + "_id": "is-extglob@2.1.1", + "_inBundle": false, + "_integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "_location": "/is-extglob", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "is-extglob@2.1.1", + "name": "is-extglob", + "escapedName": "is-extglob", + "rawSpec": "2.1.1", + "saveSpec": null, + "fetchSpec": "2.1.1" + }, + "_requiredBy": [ + "/is-glob" + ], + "_resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "_spec": "2.1.1", + "_where": "/workspaces/upload-google-play", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/jonschlinkert/is-extglob/issues" + }, + "description": "Returns true if a string has an extglob.", + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/jonschlinkert/is-extglob", + "keywords": [ + "bash", + "braces", + "check", + "exec", + "expression", + "extglob", + "glob", + "globbing", + "globstar", + "is", + "match", + "matches", + "pattern", + "regex", + "regular", + "string", + "test" + ], + "license": "MIT", + "main": "index.js", + "name": "is-extglob", + "repository": { + "type": "git", + "url": "git+https://github.com/jonschlinkert/is-extglob.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "has-glob", + "is-glob", + "micromatch" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + }, + "version": "2.1.1" +} diff --git a/node_modules/is-glob/LICENSE b/node_modules/is-glob/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/node_modules/is-glob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/is-glob/README.md b/node_modules/is-glob/README.md new file mode 100644 index 00000000..59444ebe --- /dev/null +++ b/node_modules/is-glob/README.md @@ -0,0 +1,206 @@ +# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Linux Build Status](https://img.shields.io/travis/micromatch/is-glob.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/is-glob) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/is-glob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/is-glob) + +> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-glob +``` + +You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob). + +## Usage + +```js +var isGlob = require('is-glob'); +``` + +### Default behavior + +**True** + +Patterns that have glob characters or regex patterns will return `true`: + +```js +isGlob('!foo.js'); +isGlob('*.js'); +isGlob('**/abc.js'); +isGlob('abc/*.js'); +isGlob('abc/(aaa|bbb).js'); +isGlob('abc/[a-z].js'); +isGlob('abc/{a,b}.js'); +//=> true +``` + +Extglobs + +```js +isGlob('abc/@(a).js'); +isGlob('abc/!(a).js'); +isGlob('abc/+(a).js'); +isGlob('abc/*(a).js'); +isGlob('abc/?(a).js'); +//=> true +``` + +**False** + +Escaped globs or extglobs return `false`: + +```js +isGlob('abc/\\@(a).js'); +isGlob('abc/\\!(a).js'); +isGlob('abc/\\+(a).js'); +isGlob('abc/\\*(a).js'); +isGlob('abc/\\?(a).js'); +isGlob('\\!foo.js'); +isGlob('\\*.js'); +isGlob('\\*\\*/abc.js'); +isGlob('abc/\\*.js'); +isGlob('abc/\\(aaa|bbb).js'); +isGlob('abc/\\[a-z].js'); +isGlob('abc/\\{a,b}.js'); +//=> false +``` + +Patterns that do not have glob patterns return `false`: + +```js +isGlob('abc.js'); +isGlob('abc/def/ghi.js'); +isGlob('foo.js'); +isGlob('abc/@.js'); +isGlob('abc/+.js'); +isGlob('abc/?.js'); +isGlob(); +isGlob(null); +//=> false +``` + +Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)): + +```js +isGlob(['**/*.js']); +isGlob(['foo.js']); +//=> false +``` + +### Option strict + +When `options.strict === false` the behavior is less strict in determining if a pattern is a glob. Meaning that +some patterns that would return `false` may return `true`. This is done so that matching libraries like [micromatch](https://github.com/micromatch/micromatch) have a chance at determining if the pattern is a glob or not. + +**True** + +Patterns that have glob characters or regex patterns will return `true`: + +```js +isGlob('!foo.js', {strict: false}); +isGlob('*.js', {strict: false}); +isGlob('**/abc.js', {strict: false}); +isGlob('abc/*.js', {strict: false}); +isGlob('abc/(aaa|bbb).js', {strict: false}); +isGlob('abc/[a-z].js', {strict: false}); +isGlob('abc/{a,b}.js', {strict: false}); +//=> true +``` + +Extglobs + +```js +isGlob('abc/@(a).js', {strict: false}); +isGlob('abc/!(a).js', {strict: false}); +isGlob('abc/+(a).js', {strict: false}); +isGlob('abc/*(a).js', {strict: false}); +isGlob('abc/?(a).js', {strict: false}); +//=> true +``` + +**False** + +Escaped globs or extglobs return `false`: + +```js +isGlob('\\!foo.js', {strict: false}); +isGlob('\\*.js', {strict: false}); +isGlob('\\*\\*/abc.js', {strict: false}); +isGlob('abc/\\*.js', {strict: false}); +isGlob('abc/\\(aaa|bbb).js', {strict: false}); +isGlob('abc/\\[a-z].js', {strict: false}); +isGlob('abc/\\{a,b}.js', {strict: false}); +//=> false +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit") +* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks") +* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.") +* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 47 | [jonschlinkert](https://github.com/jonschlinkert) | +| 5 | [doowb](https://github.com/doowb) | +| 1 | [phated](https://github.com/phated) | +| 1 | [danhper](https://github.com/danhper) | +| 1 | [paulmillr](https://github.com/paulmillr) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on March 27, 2019._ \ No newline at end of file diff --git a/node_modules/is-glob/index.js b/node_modules/is-glob/index.js new file mode 100644 index 00000000..55826510 --- /dev/null +++ b/node_modules/is-glob/index.js @@ -0,0 +1,48 @@ +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var isExtglob = require('is-extglob'); +var chars = { '{': '}', '(': ')', '[': ']'}; +var strictRegex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; +var relaxedRegex = /\\(.)|(^!|[*?{}()[\]]|\(\?)/; + +module.exports = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } + + var regex = strictRegex; + var match; + + // optionally relax regex + if (options && options.strict === false) { + regex = relaxedRegex; + } + + while ((match = regex.exec(str))) { + if (match[2]) return true; + var idx = match.index + match[0].length; + + // if an open bracket/brace/paren is escaped, + // set the index to the next closing character + var open = match[1]; + var close = open ? chars[open] : null; + if (open && close) { + var n = str.indexOf(close, idx); + if (n !== -1) { + idx = n + 1; + } + } + + str = str.slice(idx); + } + return false; +}; diff --git a/node_modules/is-glob/package.json b/node_modules/is-glob/package.json new file mode 100644 index 00000000..29cb6ab1 --- /dev/null +++ b/node_modules/is-glob/package.json @@ -0,0 +1,124 @@ +{ + "_args": [ + [ + "is-glob@4.0.1", + "/workspaces/upload-google-play" + ] + ], + "_from": "is-glob@4.0.1", + "_id": "is-glob@4.0.1", + "_inBundle": false, + "_integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "_location": "/is-glob", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "is-glob@4.0.1", + "name": "is-glob", + "escapedName": "is-glob", + "rawSpec": "4.0.1", + "saveSpec": null, + "fetchSpec": "4.0.1" + }, + "_requiredBy": [ + "/glob-parent" + ], + "_resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "_spec": "4.0.1", + "_where": "/workspaces/upload-google-play", + "author": { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + }, + "bugs": { + "url": "https://github.com/micromatch/is-glob/issues" + }, + "contributors": [ + { + "name": "Brian Woodward", + "url": "https://twitter.com/doowb" + }, + { + "name": "Daniel Perez", + "url": "https://tuvistavie.com" + }, + { + "name": "Jon Schlinkert", + "url": "http://twitter.com/jonschlinkert" + } + ], + "dependencies": { + "is-extglob": "^2.1.1" + }, + "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.", + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/micromatch/is-glob", + "keywords": [ + "bash", + "braces", + "check", + "exec", + "expression", + "extglob", + "glob", + "globbing", + "globstar", + "is", + "match", + "matches", + "pattern", + "regex", + "regular", + "string", + "test" + ], + "license": "MIT", + "main": "index.js", + "name": "is-glob", + "repository": { + "type": "git", + "url": "git+https://github.com/micromatch/is-glob.git" + }, + "scripts": { + "test": "mocha" + }, + "verb": { + "layout": "default", + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "assemble", + "base", + "update", + "verb" + ] + }, + "reflinks": [ + "assemble", + "bach", + "base", + "composer", + "gulp", + "has-glob", + "is-valid-glob", + "micromatch", + "npm", + "scaffold", + "verb", + "vinyl" + ] + }, + "version": "4.0.1" +} diff --git a/node_modules/merge2/LICENSE b/node_modules/merge2/LICENSE new file mode 100644 index 00000000..31dd9c72 --- /dev/null +++ b/node_modules/merge2/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2020 Teambition + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/merge2/README.md b/node_modules/merge2/README.md new file mode 100644 index 00000000..27f8eb99 --- /dev/null +++ b/node_modules/merge2/README.md @@ -0,0 +1,144 @@ +# merge2 + +Merge multiple streams into one stream in sequence or parallel. + +[![NPM version][npm-image]][npm-url] +[![Build Status][travis-image]][travis-url] +[![Downloads][downloads-image]][downloads-url] + +## Install + +Install with [npm](https://npmjs.org/package/merge2) + +```sh +npm install merge2 +``` + +## Usage + +```js +const gulp = require('gulp') +const merge2 = require('merge2') +const concat = require('gulp-concat') +const minifyHtml = require('gulp-minify-html') +const ngtemplate = require('gulp-ngtemplate') + +gulp.task('app-js', function () { + return merge2( + gulp.src('static/src/tpl/*.html') + .pipe(minifyHtml({empty: true})) + .pipe(ngtemplate({ + module: 'genTemplates', + standalone: true + }) + ), gulp.src([ + 'static/src/js/app.js', + 'static/src/js/locale_zh-cn.js', + 'static/src/js/router.js', + 'static/src/js/tools.js', + 'static/src/js/services.js', + 'static/src/js/filters.js', + 'static/src/js/directives.js', + 'static/src/js/controllers.js' + ]) + ) + .pipe(concat('app.js')) + .pipe(gulp.dest('static/dist/js/')) +}) +``` + +```js +const stream = merge2([stream1, stream2], stream3, {end: false}) +//... +stream.add(stream4, stream5) +//.. +stream.end() +``` + +```js +// equal to merge2([stream1, stream2], stream3) +const stream = merge2() +stream.add([stream1, stream2]) +stream.add(stream3) +``` + +```js +// merge order: +// 1. merge `stream1`; +// 2. merge `stream2` and `stream3` in parallel after `stream1` merged; +// 3. merge 'stream4' after `stream2` and `stream3` merged; +const stream = merge2(stream1, [stream2, stream3], stream4) + +// merge order: +// 1. merge `stream5` and `stream6` in parallel after `stream4` merged; +// 2. merge 'stream7' after `stream5` and `stream6` merged; +stream.add([stream5, stream6], stream7) +``` + +```js +// nest merge +// equal to merge2(stream1, stream2, stream6, stream3, [stream4, stream5]); +const streamA = merge2(stream1, stream2) +const streamB = merge2(stream3, [stream4, stream5]) +const stream = merge2(streamA, streamB) +streamA.add(stream6) +``` + +## API + +```js +const merge2 = require('merge2') +``` + +### merge2() + +### merge2(options) + +### merge2(stream1, stream2, ..., streamN) + +### merge2(stream1, stream2, ..., streamN, options) + +### merge2(stream1, [stream2, stream3, ...], streamN, options) + +return a duplex stream (mergedStream). streams in array will be merged in parallel. + +### mergedStream.add(stream) + +### mergedStream.add(stream1, [stream2, stream3, ...], ...) + +return the mergedStream. + +### mergedStream.on('queueDrain', function() {}) + +It will emit 'queueDrain' when all streams merged. If you set `end === false` in options, this event give you a notice that should add more streams to merge or end the mergedStream. + +#### stream + +*option* +Type: `Readable` or `Duplex` or `Transform` stream. + +#### options + +*option* +Type: `Object`. + +* **end** - `Boolean` - if `end === false` then mergedStream will not be auto ended, you should end by yourself. **Default:** `undefined` + +* **pipeError** - `Boolean` - if `pipeError === true` then mergedStream will emit `error` event from source streams. **Default:** `undefined` + +* **objectMode** - `Boolean` . **Default:** `true` + +`objectMode` and other options(`highWaterMark`, `defaultEncoding` ...) is same as Node.js `Stream`. + +## License + +MIT © [Teambition](https://www.teambition.com) + +[npm-url]: https://npmjs.org/package/merge2 +[npm-image]: http://img.shields.io/npm/v/merge2.svg + +[travis-url]: https://travis-ci.org/teambition/merge2 +[travis-image]: http://img.shields.io/travis/teambition/merge2.svg + +[downloads-url]: https://npmjs.org/package/merge2 +[downloads-image]: http://img.shields.io/npm/dm/merge2.svg?style=flat-square diff --git a/node_modules/merge2/index.js b/node_modules/merge2/index.js new file mode 100644 index 00000000..78a61edf --- /dev/null +++ b/node_modules/merge2/index.js @@ -0,0 +1,144 @@ +'use strict' +/* + * merge2 + * https://github.com/teambition/merge2 + * + * Copyright (c) 2014-2020 Teambition + * Licensed under the MIT license. + */ +const Stream = require('stream') +const PassThrough = Stream.PassThrough +const slice = Array.prototype.slice + +module.exports = merge2 + +function merge2 () { + const streamsQueue = [] + const args = slice.call(arguments) + let merging = false + let options = args[args.length - 1] + + if (options && !Array.isArray(options) && options.pipe == null) { + args.pop() + } else { + options = {} + } + + const doEnd = options.end !== false + const doPipeError = options.pipeError === true + if (options.objectMode == null) { + options.objectMode = true + } + if (options.highWaterMark == null) { + options.highWaterMark = 64 * 1024 + } + const mergedStream = PassThrough(options) + + function addStream () { + for (let i = 0, len = arguments.length; i < len; i++) { + streamsQueue.push(pauseStreams(arguments[i], options)) + } + mergeStream() + return this + } + + function mergeStream () { + if (merging) { + return + } + merging = true + + let streams = streamsQueue.shift() + if (!streams) { + process.nextTick(endStream) + return + } + if (!Array.isArray(streams)) { + streams = [streams] + } + + let pipesCount = streams.length + 1 + + function next () { + if (--pipesCount > 0) { + return + } + merging = false + mergeStream() + } + + function pipe (stream) { + function onend () { + stream.removeListener('merge2UnpipeEnd', onend) + stream.removeListener('end', onend) + if (doPipeError) { + stream.removeListener('error', onerror) + } + next() + } + function onerror (err) { + mergedStream.emit('error', err) + } + // skip ended stream + if (stream._readableState.endEmitted) { + return next() + } + + stream.on('merge2UnpipeEnd', onend) + stream.on('end', onend) + + if (doPipeError) { + stream.on('error', onerror) + } + + stream.pipe(mergedStream, { end: false }) + // compatible for old stream + stream.resume() + } + + for (let i = 0; i < streams.length; i++) { + pipe(streams[i]) + } + + next() + } + + function endStream () { + merging = false + // emit 'queueDrain' when all streams merged. + mergedStream.emit('queueDrain') + if (doEnd) { + mergedStream.end() + } + } + + mergedStream.setMaxListeners(0) + mergedStream.add = addStream + mergedStream.on('unpipe', function (stream) { + stream.emit('merge2UnpipeEnd') + }) + + if (args.length) { + addStream.apply(null, args) + } + return mergedStream +} + +// check and pause streams for pipe. +function pauseStreams (streams, options) { + if (!Array.isArray(streams)) { + // Backwards-compat with old-style streams + if (!streams._readableState && streams.pipe) { + streams = streams.pipe(PassThrough(options)) + } + if (!streams._readableState || !streams.pause || !streams.pipe) { + throw new Error('Only readable stream can be merged.') + } + streams.pause() + } else { + for (let i = 0, len = streams.length; i < len; i++) { + streams[i] = pauseStreams(streams[i], options) + } + } + return streams +} diff --git a/node_modules/merge2/package.json b/node_modules/merge2/package.json new file mode 100644 index 00000000..955cd16b --- /dev/null +++ b/node_modules/merge2/package.json @@ -0,0 +1,74 @@ +{ + "_args": [ + [ + "merge2@1.4.1", + "/workspaces/upload-google-play" + ] + ], + "_from": "merge2@1.4.1", + "_id": "merge2@1.4.1", + "_inBundle": false, + "_integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "_location": "/merge2", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "merge2@1.4.1", + "name": "merge2", + "escapedName": "merge2", + "rawSpec": "1.4.1", + "saveSpec": null, + "fetchSpec": "1.4.1" + }, + "_requiredBy": [ + "/fast-glob" + ], + "_resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "_spec": "1.4.1", + "_where": "/workspaces/upload-google-play", + "authors": [ + "Yan Qing " + ], + "bugs": { + "url": "https://github.com/teambition/merge2/issues" + }, + "dependencies": {}, + "description": "Merge multiple streams into one stream in sequence or parallel.", + "devDependencies": { + "standard": "^14.3.4", + "through2": "^3.0.1", + "thunks": "^4.9.6", + "tman": "^1.10.0", + "to-through": "^2.0.0" + }, + "engines": { + "node": ">= 8" + }, + "files": [ + "README.md", + "index.js" + ], + "homepage": "https://github.com/teambition/merge2", + "keywords": [ + "merge2", + "multiple", + "sequence", + "parallel", + "merge", + "stream", + "merge stream", + "sync" + ], + "license": "MIT", + "main": "./index.js", + "name": "merge2", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/teambition/merge2.git" + }, + "scripts": { + "test": "standard && tman" + }, + "version": "1.4.1" +} diff --git a/node_modules/queue-microtask/LICENSE b/node_modules/queue-microtask/LICENSE new file mode 100755 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/queue-microtask/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/queue-microtask/README.md b/node_modules/queue-microtask/README.md new file mode 100644 index 00000000..f3640128 --- /dev/null +++ b/node_modules/queue-microtask/README.md @@ -0,0 +1,90 @@ +# queue-microtask [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/queue-microtask/master.svg +[travis-url]: https://travis-ci.org/feross/queue-microtask +[npm-image]: https://img.shields.io/npm/v/queue-microtask.svg +[npm-url]: https://npmjs.org/package/queue-microtask +[downloads-image]: https://img.shields.io/npm/dm/queue-microtask.svg +[downloads-url]: https://npmjs.org/package/queue-microtask +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +### fast, tiny [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask) shim for modern engines + +- Use [`queueMicrotask`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/queueMicrotask) in all modern JS engines. +- No dependencies. Less than 10 lines. No shims or complicated fallbacks. +- Optimal performance in all modern environments + - Uses `queueMicrotask` in modern environments + - Fallback to `Promise.resolve().then(fn)` in Node.js 10 and earlier, and old browsers (same performance as `queueMicrotask`) + +## install + +``` +npm install queue-microtask +``` + +## usage + +```js +const queueMicrotask = require('queue-microtask') + +queueMicrotask(() => { /* this will run soon */ }) +``` + +## What is `queueMicrotask` and why would one use it? + +The `queueMicrotask` function is a WHATWG standard. It queues a microtask to be executed prior to control returning to the event loop. + +A microtask is a short function which will run after the current task has completed its work and when there is no other code waiting to be run before control of the execution context is returned to the event loop. + +The code `queueMicrotask(fn)` is equivalent to the code `Promise.resolve().then(fn)`. It is also very similar to [`process.nextTick(fn)`](https://nodejs.org/api/process.html#process_process_nexttick_callback_args) in Node. + +Using microtasks lets code run without interfering with any other, potentially higher priority, code that is pending, but before the JS engine regains control over the execution context. + +See the [spec](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing) or [Node documentation](https://nodejs.org/api/globals.html#globals_queuemicrotask_callback) for more information. + +## Who is this package for? + +This package allows you to use `queueMicrotask` safely in all modern JS engines. Use it if you prioritize small JS bundle size over support for old browsers. + +If you just need to support Node 12 and later, use `queueMicrotask` directly. If you need to support all versions of Node, use this package. + +## Why not use `process.nextTick`? + +In Node, `queueMicrotask` and `process.nextTick` are [essentially equivalent](https://nodejs.org/api/globals.html#globals_queuemicrotask_callback), though there are [subtle differences](https://github.com/YuzuJS/setImmediate#macrotasks-and-microtasks) that don't matter in most situations. + +You can think of `queueMicrotask` as a standardized version of `process.nextTick` that works in the browser. No need to rely on your browser bundler to shim `process` for the browser environment. + +## Why not use `setTimeout(fn, 0)`? + +This approach is the most compatible, but it has problems. Modern browsers throttle timers severely, so `setTimeout(…, 0)` usually takes at least 4ms to run. Furthermore, the throttling gets even worse if the page is backgrounded. If you have many `setTimeout` calls, then this can severely limit the performance of your program. + +## Why not use a microtask library like [`immediate`](https://www.npmjs.com/package/immediate) or [`asap`](https://www.npmjs.com/package/asap)? + +These packages are great! However, if you prioritize small JS bundle size over optimal performance in old browsers then you may want to consider this package. + +This package (`queue-microtask`) is four times smaller than `immediate`, twice as small as `asap`, and twice as small as using `process.nextTick` and letting the browser bundler shim it automatically. + +Note: This package throws an exception in JS environments which lack `Promise` support -- which are usually very old browsers and Node.js versions. + +Since the `queueMicrotask` API is supported in Node.js, Chrome, Firefox, Safari, Opera, and Edge, **the vast majority of users will get optimal performance**. Any JS environment with `Promise`, which is almost all of them, also get optimal performance. If you need support for JS environments which lack `Promise` support, use one of the alternative packages. + +## What is a shim? + +> In computer programming, a shim is a library that transparently intercepts API calls and changes the arguments passed, handles the operation itself or redirects the operation elsewhere. – [Wikipedia](https://en.wikipedia.org/wiki/Shim_(computing)) + +This package could also be described as a "ponyfill". + +> A ponyfill is almost the same as a polyfill, but not quite. Instead of patching functionality for older browsers, a ponyfill provides that functionality as a standalone module you can use. – [PonyFoo](https://ponyfoo.com/articles/polyfills-or-ponyfills) + +## API + +### `queueMicrotask(fn)` + +The `queueMicrotask()` method queues a microtask. + +The `fn` argument is a function to be executed after all pending tasks have completed but before yielding control to the browser's event loop. + +## license + +MIT. Copyright (c) [Feross Aboukhadijeh](https://feross.org). diff --git a/node_modules/queue-microtask/index.d.ts b/node_modules/queue-microtask/index.d.ts new file mode 100644 index 00000000..b6a86463 --- /dev/null +++ b/node_modules/queue-microtask/index.d.ts @@ -0,0 +1,2 @@ +declare const queueMicrotask: (cb: () => void) => void +export = queueMicrotask diff --git a/node_modules/queue-microtask/index.js b/node_modules/queue-microtask/index.js new file mode 100644 index 00000000..5766b9c6 --- /dev/null +++ b/node_modules/queue-microtask/index.js @@ -0,0 +1,9 @@ +/*! queue-microtask. MIT License. Feross Aboukhadijeh */ +let promise + +module.exports = typeof queueMicrotask === 'function' + ? queueMicrotask.bind(globalThis) + // reuse resolved promise, and allocate it lazily + : cb => (promise || (promise = Promise.resolve())) + .then(cb) + .catch(err => setTimeout(() => { throw err }, 0)) diff --git a/node_modules/queue-microtask/package.json b/node_modules/queue-microtask/package.json new file mode 100644 index 00000000..4002ac66 --- /dev/null +++ b/node_modules/queue-microtask/package.json @@ -0,0 +1,84 @@ +{ + "_args": [ + [ + "queue-microtask@1.2.2", + "/workspaces/upload-google-play" + ] + ], + "_from": "queue-microtask@1.2.2", + "_id": "queue-microtask@1.2.2", + "_inBundle": false, + "_integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", + "_location": "/queue-microtask", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "queue-microtask@1.2.2", + "name": "queue-microtask", + "escapedName": "queue-microtask", + "rawSpec": "1.2.2", + "saveSpec": null, + "fetchSpec": "1.2.2" + }, + "_requiredBy": [ + "/run-parallel" + ], + "_resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz", + "_spec": "1.2.2", + "_where": "/workspaces/upload-google-play", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "https://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/queue-microtask/issues" + }, + "dependencies": {}, + "description": "fast, tiny `queueMicrotask` shim for modern engines", + "devDependencies": { + "standard": "*", + "tape": "^5.0.1" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "homepage": "https://github.com/feross/queue-microtask", + "keywords": [ + "asap", + "immediate", + "micro task", + "microtask", + "nextTick", + "process.nextTick", + "queue micro task", + "queue microtask", + "queue-microtask", + "queueMicrotask", + "setImmediate", + "task" + ], + "license": "MIT", + "main": "index.js", + "name": "queue-microtask", + "repository": { + "type": "git", + "url": "git://github.com/feross/queue-microtask.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "version": "1.2.2" +} diff --git a/node_modules/reusify/.coveralls.yml b/node_modules/reusify/.coveralls.yml new file mode 100644 index 00000000..359f6834 --- /dev/null +++ b/node_modules/reusify/.coveralls.yml @@ -0,0 +1 @@ +repo_token: yIxhFqtaaz5iGVYfie9mODehFYogm8S8L diff --git a/node_modules/reusify/.travis.yml b/node_modules/reusify/.travis.yml new file mode 100644 index 00000000..19704768 --- /dev/null +++ b/node_modules/reusify/.travis.yml @@ -0,0 +1,28 @@ +language: node_js +sudo: false + +node_js: + - 9 + - 8 + - 7 + - 6 + - 5 + - 4 + - 4.0 + - iojs-v3 + - iojs-v2 + - iojs-v1 + - 0.12 + - 0.10 + +cache: + directories: + - node_modules + +after_script: +- npm run coverage + +notifications: + email: + on_success: never + on_failure: always diff --git a/node_modules/reusify/LICENSE b/node_modules/reusify/LICENSE new file mode 100644 index 00000000..fbf3a01d --- /dev/null +++ b/node_modules/reusify/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Matteo Collina + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/reusify/README.md b/node_modules/reusify/README.md new file mode 100644 index 00000000..badcb7cc --- /dev/null +++ b/node_modules/reusify/README.md @@ -0,0 +1,145 @@ +# reusify + +[![npm version][npm-badge]][npm-url] +[![Build Status][travis-badge]][travis-url] +[![Coverage Status][coveralls-badge]][coveralls-url] + +Reuse your objects and functions for maximum speed. This technique will +make any function run ~10% faster. You call your functions a +lot, and it adds up quickly in hot code paths. + +``` +$ node benchmarks/createNoCodeFunction.js +Total time 53133 +Total iterations 100000000 +Iteration/s 1882069.5236482036 + +$ node benchmarks/reuseNoCodeFunction.js +Total time 50617 +Total iterations 100000000 +Iteration/s 1975620.838848608 +``` + +The above benchmark uses fibonacci to simulate a real high-cpu load. +The actual numbers might differ for your use case, but the difference +should not. + +The benchmark was taken using Node v6.10.0. + +This library was extracted from +[fastparallel](http://npm.im/fastparallel). + +## Example + +```js +var reusify = require('reusify') +var fib = require('reusify/benchmarks/fib') +var instance = reusify(MyObject) + +// get an object from the cache, +// or creates a new one when cache is empty +var obj = instance.get() + +// set the state +obj.num = 100 +obj.func() + +// reset the state. +// if the state contains any external object +// do not use delete operator (it is slow) +// prefer set them to null +obj.num = 0 + +// store an object in the cache +instance.release(obj) + +function MyObject () { + // you need to define this property + // so V8 can compile MyObject into an + // hidden class + this.next = null + this.num = 0 + + var that = this + + // this function is never reallocated, + // so it can be optimized by V8 + this.func = function () { + if (null) { + // do nothing + } else { + // calculates fibonacci + fib(that.num) + } + } +} +``` + +The above example was intended for synchronous code, let's see async: +```js +var reusify = require('reusify') +var instance = reusify(MyObject) + +for (var i = 0; i < 100; i++) { + getData(i, console.log) +} + +function getData (value, cb) { + var obj = instance.get() + + obj.value = value + obj.cb = cb + obj.run() +} + +function MyObject () { + this.next = null + this.value = null + + var that = this + + this.run = function () { + asyncOperation(that.value, that.handle) + } + + this.handle = function (err, result) { + that.cb(err, result) + that.value = null + that.cb = null + instance.release(that) + } +} +``` + +Also note how in the above examples, the code, that consumes an istance of `MyObject`, +reset the state to initial condition, just before storing it in the cache. +That's needed so that every subsequent request for an instance from the cache, +could get a clean instance. + +## Why + +It is faster because V8 doesn't have to collect all the functions you +create. On a short-lived benchmark, it is as fast as creating the +nested function, but on a longer time frame it creates less +pressure on the garbage collector. + +## Other examples +If you want to see some complex example, checkout [middie](https://github.com/fastify/middie) and [steed](https://github.com/mcollina/steed). + +## Acknowledgements + +Thanks to [Trevor Norris](https://github.com/trevnorris) for +getting me down the rabbit hole of performance, and thanks to [Mathias +Buss](http://github.com/mafintosh) for suggesting me to share this +trick. + +## License + +MIT + +[npm-badge]: https://badge.fury.io/js/reusify.svg +[npm-url]: https://badge.fury.io/js/reusify +[travis-badge]: https://api.travis-ci.org/mcollina/reusify.svg +[travis-url]: https://travis-ci.org/mcollina/reusify +[coveralls-badge]: https://coveralls.io/repos/mcollina/reusify/badge.svg?branch=master&service=github +[coveralls-url]: https://coveralls.io/github/mcollina/reusify?branch=master diff --git a/node_modules/reusify/benchmarks/createNoCodeFunction.js b/node_modules/reusify/benchmarks/createNoCodeFunction.js new file mode 100644 index 00000000..ce1aac7b --- /dev/null +++ b/node_modules/reusify/benchmarks/createNoCodeFunction.js @@ -0,0 +1,30 @@ +'use strict' + +var fib = require('./fib') +var max = 100000000 +var start = Date.now() + +// create a funcion with the typical error +// pattern, that delegates the heavy load +// to something else +function createNoCodeFunction () { + /* eslint no-constant-condition: "off" */ + var num = 100 + + ;(function () { + if (null) { + // do nothing + } else { + fib(num) + } + })() +} + +for (var i = 0; i < max; i++) { + createNoCodeFunction() +} + +var time = Date.now() - start +console.log('Total time', time) +console.log('Total iterations', max) +console.log('Iteration/s', max / time * 1000) diff --git a/node_modules/reusify/benchmarks/fib.js b/node_modules/reusify/benchmarks/fib.js new file mode 100644 index 00000000..e22cc48d --- /dev/null +++ b/node_modules/reusify/benchmarks/fib.js @@ -0,0 +1,13 @@ +'use strict' + +function fib (num) { + var fib = [] + + fib[0] = 0 + fib[1] = 1 + for (var i = 2; i <= num; i++) { + fib[i] = fib[i - 2] + fib[i - 1] + } +} + +module.exports = fib diff --git a/node_modules/reusify/benchmarks/reuseNoCodeFunction.js b/node_modules/reusify/benchmarks/reuseNoCodeFunction.js new file mode 100644 index 00000000..3358d6e5 --- /dev/null +++ b/node_modules/reusify/benchmarks/reuseNoCodeFunction.js @@ -0,0 +1,38 @@ +'use strict' + +var reusify = require('../') +var fib = require('./fib') +var instance = reusify(MyObject) +var max = 100000000 +var start = Date.now() + +function reuseNoCodeFunction () { + var obj = instance.get() + obj.num = 100 + obj.func() + obj.num = 0 + instance.release(obj) +} + +function MyObject () { + this.next = null + var that = this + this.num = 0 + this.func = function () { + /* eslint no-constant-condition: "off" */ + if (null) { + // do nothing + } else { + fib(that.num) + } + } +} + +for (var i = 0; i < max; i++) { + reuseNoCodeFunction() +} + +var time = Date.now() - start +console.log('Total time', time) +console.log('Total iterations', max) +console.log('Iteration/s', max / time * 1000) diff --git a/node_modules/reusify/package.json b/node_modules/reusify/package.json new file mode 100644 index 00000000..185214e2 --- /dev/null +++ b/node_modules/reusify/package.json @@ -0,0 +1,76 @@ +{ + "_args": [ + [ + "reusify@1.0.4", + "/workspaces/upload-google-play" + ] + ], + "_from": "reusify@1.0.4", + "_id": "reusify@1.0.4", + "_inBundle": false, + "_integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "_location": "/reusify", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "reusify@1.0.4", + "name": "reusify", + "escapedName": "reusify", + "rawSpec": "1.0.4", + "saveSpec": null, + "fetchSpec": "1.0.4" + }, + "_requiredBy": [ + "/fastq" + ], + "_resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "_spec": "1.0.4", + "_where": "/workspaces/upload-google-play", + "author": { + "name": "Matteo Collina", + "email": "hello@matteocollina.com" + }, + "bugs": { + "url": "https://github.com/mcollina/reusify/issues" + }, + "description": "Reuse objects and functions with style", + "devDependencies": { + "coveralls": "^2.13.3", + "faucet": "0.0.1", + "istanbul": "^0.4.5", + "pre-commit": "^1.2.2", + "standard": "^10.0.3", + "tape": "^4.8.0" + }, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + }, + "homepage": "https://github.com/mcollina/reusify#readme", + "keywords": [ + "reuse", + "object", + "performance", + "function", + "fast" + ], + "license": "MIT", + "main": "reusify.js", + "name": "reusify", + "pre-commit": [ + "lint", + "test" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/mcollina/reusify.git" + }, + "scripts": { + "coverage": "npm run istanbul; cat coverage/lcov.info | coveralls", + "istanbul": "istanbul cover tape test.js", + "lint": "standard", + "test": "tape test.js | faucet" + }, + "version": "1.0.4" +} diff --git a/node_modules/reusify/reusify.js b/node_modules/reusify/reusify.js new file mode 100644 index 00000000..e6f36f3a --- /dev/null +++ b/node_modules/reusify/reusify.js @@ -0,0 +1,33 @@ +'use strict' + +function reusify (Constructor) { + var head = new Constructor() + var tail = head + + function get () { + var current = head + + if (current.next) { + head = current.next + } else { + head = new Constructor() + tail = head + } + + current.next = null + + return current + } + + function release (obj) { + tail.next = obj + tail = obj + } + + return { + get: get, + release: release + } +} + +module.exports = reusify diff --git a/node_modules/reusify/test.js b/node_modules/reusify/test.js new file mode 100644 index 00000000..929cfd71 --- /dev/null +++ b/node_modules/reusify/test.js @@ -0,0 +1,66 @@ +'use strict' + +var test = require('tape') +var reusify = require('./') + +test('reuse objects', function (t) { + t.plan(6) + + function MyObject () { + t.pass('constructor called') + this.next = null + } + + var instance = reusify(MyObject) + var obj = instance.get() + + t.notEqual(obj, instance.get(), 'two instance created') + t.notOk(obj.next, 'next must be null') + + instance.release(obj) + + // the internals keeps a hot copy ready for reuse + // putting this one back in the queue + instance.release(instance.get()) + + // comparing the old one with the one we got + // never do this in real code, after release you + // should never reuse that instance + t.equal(obj, instance.get(), 'instance must be reused') +}) + +test('reuse more than 2 objects', function (t) { + function MyObject () { + t.pass('constructor called') + this.next = null + } + + var instance = reusify(MyObject) + var obj = instance.get() + var obj2 = instance.get() + var obj3 = instance.get() + + t.notOk(obj.next, 'next must be null') + t.notOk(obj2.next, 'next must be null') + t.notOk(obj3.next, 'next must be null') + + t.notEqual(obj, obj2) + t.notEqual(obj, obj3) + t.notEqual(obj3, obj2) + + instance.release(obj) + instance.release(obj2) + instance.release(obj3) + + // skip one + instance.get() + + var obj4 = instance.get() + var obj5 = instance.get() + var obj6 = instance.get() + + t.equal(obj4, obj) + t.equal(obj5, obj2) + t.equal(obj6, obj3) + t.end() +}) diff --git a/node_modules/run-parallel/LICENSE b/node_modules/run-parallel/LICENSE new file mode 100644 index 00000000..c7e68527 --- /dev/null +++ b/node_modules/run-parallel/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/run-parallel/README.md b/node_modules/run-parallel/README.md new file mode 100644 index 00000000..edc3da45 --- /dev/null +++ b/node_modules/run-parallel/README.md @@ -0,0 +1,85 @@ +# run-parallel [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/run-parallel/master.svg +[travis-url]: https://travis-ci.org/feross/run-parallel +[npm-image]: https://img.shields.io/npm/v/run-parallel.svg +[npm-url]: https://npmjs.org/package/run-parallel +[downloads-image]: https://img.shields.io/npm/dm/run-parallel.svg +[downloads-url]: https://npmjs.org/package/run-parallel +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +### Run an array of functions in parallel + +![parallel](https://raw.githubusercontent.com/feross/run-parallel/master/img.png) [![Sauce Test Status](https://saucelabs.com/browser-matrix/run-parallel.svg)](https://saucelabs.com/u/run-parallel) + +### install + +``` +npm install run-parallel +``` + +### usage + +#### parallel(tasks, [callback]) + +Run the `tasks` array of functions in parallel, without waiting until the previous +function has completed. If any of the functions pass an error to its callback, the main +`callback` is immediately called with the value of the error. Once the `tasks` have +completed, the results are passed to the final `callback` as an array. + +It is also possible to use an object instead of an array. Each property will be run as a +function and the results will be passed to the final `callback` as an object instead of +an array. This can be a more readable way of handling the results. + +##### arguments + +- `tasks` - An array or object containing functions to run. Each function is passed a +`callback(err, result)` which it must call on completion with an error `err` (which can +be `null`) and an optional `result` value. +- `callback(err, results)` - An optional callback to run once all the functions have +completed. This function gets a results array (or object) containing all the result +arguments passed to the task callbacks. + +##### example + +```js +var parallel = require('run-parallel') + +parallel([ + function (callback) { + setTimeout(function () { + callback(null, 'one') + }, 200) + }, + function (callback) { + setTimeout(function () { + callback(null, 'two') + }, 100) + } +], +// optional callback +function (err, results) { + // the results array will equal ['one','two'] even though + // the second function had a shorter timeout. +}) +``` + +This module is basically equavalent to +[`async.parallel`](https://github.com/caolan/async#paralleltasks-callback), but it's +handy to just have the one function you need instead of the kitchen sink. Modularity! +Especially handy if you're serving to the browser and need to reduce your javascript +bundle size. + +Works great in the browser with [browserify](http://browserify.org/)! + +### see also + +- [run-auto](https://github.com/feross/run-auto) +- [run-parallel-limit](https://github.com/feross/run-parallel-limit) +- [run-series](https://github.com/feross/run-series) +- [run-waterfall](https://github.com/feross/run-waterfall) + +### license + +MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org). diff --git a/node_modules/run-parallel/index.js b/node_modules/run-parallel/index.js new file mode 100644 index 00000000..6307141d --- /dev/null +++ b/node_modules/run-parallel/index.js @@ -0,0 +1,51 @@ +/*! run-parallel. MIT License. Feross Aboukhadijeh */ +module.exports = runParallel + +const queueMicrotask = require('queue-microtask') + +function runParallel (tasks, cb) { + let results, pending, keys + let isSync = true + + if (Array.isArray(tasks)) { + results = [] + pending = tasks.length + } else { + keys = Object.keys(tasks) + results = {} + pending = keys.length + } + + function done (err) { + function end () { + if (cb) cb(err, results) + cb = null + } + if (isSync) queueMicrotask(end) + else end() + } + + function each (i, err, result) { + results[i] = result + if (--pending === 0 || err) { + done(err) + } + } + + if (!pending) { + // empty + done(null) + } else if (keys) { + // object + keys.forEach(function (key) { + tasks[key](function (err, result) { each(key, err, result) }) + }) + } else { + // array + tasks.forEach(function (task, i) { + task(function (err, result) { each(i, err, result) }) + }) + } + + isSync = false +} diff --git a/node_modules/run-parallel/package.json b/node_modules/run-parallel/package.json new file mode 100644 index 00000000..623d6907 --- /dev/null +++ b/node_modules/run-parallel/package.json @@ -0,0 +1,86 @@ +{ + "_args": [ + [ + "run-parallel@1.2.0", + "/workspaces/upload-google-play" + ] + ], + "_from": "run-parallel@1.2.0", + "_id": "run-parallel@1.2.0", + "_inBundle": false, + "_integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "_location": "/run-parallel", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "run-parallel@1.2.0", + "name": "run-parallel", + "escapedName": "run-parallel", + "rawSpec": "1.2.0", + "saveSpec": null, + "fetchSpec": "1.2.0" + }, + "_requiredBy": [ + "/@nodelib/fs.scandir" + ], + "_resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "_spec": "1.2.0", + "_where": "/workspaces/upload-google-play", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "https://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/run-parallel/issues" + }, + "dependencies": { + "queue-microtask": "^1.2.2" + }, + "description": "Run an array of functions in parallel", + "devDependencies": { + "airtap": "^3.0.0", + "standard": "*", + "tape": "^5.0.1" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "homepage": "https://github.com/feross/run-parallel", + "keywords": [ + "parallel", + "async", + "function", + "callback", + "asynchronous", + "run", + "array", + "run parallel" + ], + "license": "MIT", + "main": "index.js", + "name": "run-parallel", + "repository": { + "type": "git", + "url": "git://github.com/feross/run-parallel.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "airtap -- test/*.js", + "test-browser-local": "airtap --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "version": "1.2.0" +} diff --git a/package.json b/package.json index 5399127a..601498b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "upload-google-play", - "version": "1.0.10", + "version": "1.0.13", "private": true, "description": "Upload an Android release (.apk or .aab) to Google Play Console", "main": "lib/main.js",