@marktrue/dsh-mobile-remote 3.2.2-rc.1-app → 3.2.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1260 -0
- package/CONTRIBUTING.md +59 -0
- package/FAQ.md +111 -0
- package/README.md +253 -6
- package/cordis.patch.yml +14 -0
- package/docs/00-/345/274/200/345/217/221/346/200/273/347/272/262.md +125 -0
- package/docs/01-PRD.md +148 -0
- package/docs/02-architecture.md +249 -0
- package/docs/03-api.md +930 -0
- package/docs/04-security.md +100 -0
- package/docs/05-test-cases.md +366 -0
- package/docs/06-install-run.md +372 -0
- package/docs/07-user-manual.md +66 -0
- package/docs/08-/346/211/251/345/261/225/345/274/200/345/217/221/346/214/207/345/215/227.md +86 -0
- package/docs/09-compatibility.md +223 -0
- package/docs/10-release.md +929 -0
- package/docs/screenshots/01-home.png +0 -0
- package/docs/screenshots/02-notifications.png +0 -0
- package/docs/screenshots/03-sessions.png +0 -0
- package/docs/screenshots/04-chat.png +0 -0
- package/docs/screenshots/05-settings.png +0 -0
- package/docs/screenshots/06-new-session.png +0 -0
- package/docs/screenshots/pgy-appstore.jpg +0 -0
- package/docs/screenshots/pgy-mobile-app.jpg +0 -0
- package/docs/screenshots/pgy-pc-client.jpg +0 -0
- package/docs/spec-app-auto-update.md +143 -0
- package/lib/account-usage.js +145 -0
- package/lib/app-alignment.js +112 -0
- package/lib/app-carrier-store.js +1972 -0
- package/lib/app-carrier.js +609 -0
- package/lib/client.js +1174 -0
- package/lib/desktop-form.js +738 -0
- package/lib/endpoint-registry.js +165 -0
- package/lib/git-read-bundled-provider.js +255 -0
- package/lib/git-read-service.js +322 -0
- package/lib/index.js +9467 -0
- package/lib/npm-update-source.js +226 -0
- package/lib/plugin-content-digest.js +80 -0
- package/lib/plugin-self-update.js +997 -0
- package/lib/plugin-update-controller.js +274 -0
- package/lib/plugin-update-log.js +164 -0
- package/lib/plugin-update-transaction.js +322 -0
- package/lib/plugin-update.js +309 -0
- package/lib/runtime-dependency-snapshot.js +345 -0
- package/lib/session-title-cache.js +123 -0
- package/lib/session-title-refresh.js +261 -0
- package/lib/tool-process.js +20 -0
- package/lib/update-fetch.js +24 -0
- package/lib/update-lock-arbiter.js +170 -0
- package/lib/update-supervisor.js +346 -0
- package/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/ansi-styles/index.d.ts +345 -0
- package/node_modules/ansi-styles/index.js +163 -0
- package/node_modules/ansi-styles/license +9 -0
- package/node_modules/ansi-styles/package.json +56 -0
- package/node_modules/ansi-styles/readme.md +152 -0
- package/node_modules/camelcase/index.d.ts +63 -0
- package/node_modules/camelcase/index.js +76 -0
- package/node_modules/camelcase/license +9 -0
- package/node_modules/camelcase/package.json +43 -0
- package/node_modules/camelcase/readme.md +99 -0
- package/node_modules/cliui/CHANGELOG.md +76 -0
- package/node_modules/cliui/LICENSE.txt +14 -0
- package/node_modules/cliui/README.md +115 -0
- package/node_modules/cliui/index.js +354 -0
- package/node_modules/cliui/package.json +65 -0
- package/node_modules/color-convert/CHANGELOG.md +54 -0
- package/node_modules/color-convert/LICENSE +21 -0
- package/node_modules/color-convert/README.md +68 -0
- package/node_modules/color-convert/conversions.js +839 -0
- package/node_modules/color-convert/index.js +81 -0
- package/node_modules/color-convert/package.json +48 -0
- package/node_modules/color-convert/route.js +97 -0
- package/node_modules/color-name/LICENSE +8 -0
- package/node_modules/color-name/README.md +11 -0
- package/node_modules/color-name/index.js +152 -0
- package/node_modules/color-name/package.json +28 -0
- package/node_modules/decamelize/index.js +13 -0
- package/node_modules/decamelize/license +21 -0
- package/node_modules/decamelize/package.json +38 -0
- package/node_modules/decamelize/readme.md +48 -0
- package/node_modules/dijkstrajs/.travis.yml +4 -0
- package/node_modules/dijkstrajs/CONTRIBUTING.md +8 -0
- package/node_modules/dijkstrajs/LICENSE.md +19 -0
- package/node_modules/dijkstrajs/README.md +18 -0
- package/node_modules/dijkstrajs/dijkstra.js +165 -0
- package/node_modules/dijkstrajs/package.json +60 -0
- package/node_modules/dijkstrajs/test/dijkstra.test.js +96 -0
- package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/emoji-regex/index.d.ts +23 -0
- package/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/emoji-regex/package.json +50 -0
- package/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/find-up/index.d.ts +137 -0
- package/node_modules/find-up/index.js +89 -0
- package/node_modules/find-up/license +9 -0
- package/node_modules/find-up/package.json +53 -0
- package/node_modules/find-up/readme.md +156 -0
- package/node_modules/get-caller-file/LICENSE.md +6 -0
- package/node_modules/get-caller-file/README.md +41 -0
- package/node_modules/get-caller-file/index.d.ts +2 -0
- package/node_modules/get-caller-file/index.js +22 -0
- package/node_modules/get-caller-file/index.js.map +1 -0
- package/node_modules/get-caller-file/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/node_modules/is-fullwidth-code-point/index.js +50 -0
- package/node_modules/is-fullwidth-code-point/license +9 -0
- package/node_modules/is-fullwidth-code-point/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/locate-path/index.d.ts +83 -0
- package/node_modules/locate-path/index.js +65 -0
- package/node_modules/locate-path/license +9 -0
- package/node_modules/locate-path/package.json +45 -0
- package/node_modules/locate-path/readme.md +122 -0
- package/node_modules/p-limit/index.d.ts +38 -0
- package/node_modules/p-limit/index.js +57 -0
- package/node_modules/p-limit/license +9 -0
- package/node_modules/p-limit/package.json +52 -0
- package/node_modules/p-limit/readme.md +101 -0
- package/node_modules/p-locate/index.d.ts +64 -0
- package/node_modules/p-locate/index.js +52 -0
- package/node_modules/p-locate/license +9 -0
- package/node_modules/p-locate/package.json +53 -0
- package/node_modules/p-locate/readme.md +90 -0
- package/node_modules/p-try/index.d.ts +39 -0
- package/node_modules/p-try/index.js +9 -0
- package/node_modules/p-try/license +9 -0
- package/node_modules/p-try/package.json +42 -0
- package/node_modules/p-try/readme.md +58 -0
- package/node_modules/path-exists/index.d.ts +28 -0
- package/node_modules/path-exists/index.js +23 -0
- package/node_modules/path-exists/license +9 -0
- package/node_modules/path-exists/package.json +39 -0
- package/node_modules/path-exists/readme.md +52 -0
- package/node_modules/pngjs/.eslintignore +2 -0
- package/node_modules/pngjs/.eslintrc.json +19 -0
- package/node_modules/pngjs/.prettierignore +3 -0
- package/node_modules/pngjs/LICENSE +20 -0
- package/node_modules/pngjs/README.md +429 -0
- package/node_modules/pngjs/browser.js +16096 -0
- package/node_modules/pngjs/coverage/lcov-report/base.css +354 -0
- package/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +881 -0
- package/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +554 -0
- package/node_modules/pngjs/coverage/lcov-report/block-navigation.js +77 -0
- package/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +647 -0
- package/node_modules/pngjs/coverage/lcov-report/constants.js.html +176 -0
- package/node_modules/pngjs/coverage/lcov-report/crc.js.html +200 -0
- package/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +593 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +152 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +143 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +611 -0
- package/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +359 -0
- package/node_modules/pngjs/coverage/lcov-report/index.html +426 -0
- package/node_modules/pngjs/coverage/lcov-report/interlace.js.html +365 -0
- package/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +230 -0
- package/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +248 -0
- package/node_modules/pngjs/coverage/lcov-report/packer.js.html +467 -0
- package/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +128 -0
- package/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +575 -0
- package/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +404 -0
- package/node_modules/pngjs/coverage/lcov-report/parser.js.html +950 -0
- package/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +116 -0
- package/node_modules/pngjs/coverage/lcov-report/png.js.html +662 -0
- package/node_modules/pngjs/coverage/lcov-report/prettify.css +101 -0
- package/node_modules/pngjs/coverage/lcov-report/prettify.js +1007 -0
- package/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/node_modules/pngjs/coverage/lcov-report/sorter.js +169 -0
- package/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +584 -0
- package/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +215 -0
- package/node_modules/pngjs/coverage/lcov.info +2177 -0
- package/node_modules/pngjs/lib/bitmapper.js +267 -0
- package/node_modules/pngjs/lib/bitpacker.js +158 -0
- package/node_modules/pngjs/lib/chunkstream.js +189 -0
- package/node_modules/pngjs/lib/constants.js +32 -0
- package/node_modules/pngjs/lib/crc.js +40 -0
- package/node_modules/pngjs/lib/filter-pack.js +171 -0
- package/node_modules/pngjs/lib/filter-parse-async.js +24 -0
- package/node_modules/pngjs/lib/filter-parse-sync.js +21 -0
- package/node_modules/pngjs/lib/filter-parse.js +177 -0
- package/node_modules/pngjs/lib/format-normaliser.js +93 -0
- package/node_modules/pngjs/lib/interlace.js +95 -0
- package/node_modules/pngjs/lib/packer-async.js +50 -0
- package/node_modules/pngjs/lib/packer-sync.js +56 -0
- package/node_modules/pngjs/lib/packer.js +129 -0
- package/node_modules/pngjs/lib/paeth-predictor.js +16 -0
- package/node_modules/pngjs/lib/parser-async.js +165 -0
- package/node_modules/pngjs/lib/parser-sync.js +108 -0
- package/node_modules/pngjs/lib/parser.js +290 -0
- package/node_modules/pngjs/lib/png-sync.js +12 -0
- package/node_modules/pngjs/lib/png.js +194 -0
- package/node_modules/pngjs/lib/sync-inflate.js +168 -0
- package/node_modules/pngjs/lib/sync-reader.js +45 -0
- package/node_modules/pngjs/package.json +73 -0
- package/node_modules/qrcode/README.md +770 -0
- package/node_modules/qrcode/bin/qrcode +159 -0
- package/node_modules/qrcode/helper/to-sjis-browser.js +2 -0
- package/node_modules/qrcode/helper/to-sjis.js +105 -0
- package/node_modules/qrcode/lib/browser.js +76 -0
- package/node_modules/qrcode/lib/can-promise.js +7 -0
- package/node_modules/qrcode/lib/core/alignment-pattern.js +83 -0
- package/node_modules/qrcode/lib/core/alphanumeric-data.js +59 -0
- package/node_modules/qrcode/lib/core/bit-buffer.js +37 -0
- package/node_modules/qrcode/lib/core/bit-matrix.js +65 -0
- package/node_modules/qrcode/lib/core/byte-data.js +30 -0
- package/node_modules/qrcode/lib/core/error-correction-code.js +135 -0
- package/node_modules/qrcode/lib/core/error-correction-level.js +50 -0
- package/node_modules/qrcode/lib/core/finder-pattern.js +22 -0
- package/node_modules/qrcode/lib/core/format-info.js +29 -0
- package/node_modules/qrcode/lib/core/galois-field.js +69 -0
- package/node_modules/qrcode/lib/core/kanji-data.js +54 -0
- package/node_modules/qrcode/lib/core/mask-pattern.js +234 -0
- package/node_modules/qrcode/lib/core/mode.js +167 -0
- package/node_modules/qrcode/lib/core/numeric-data.js +43 -0
- package/node_modules/qrcode/lib/core/polynomial.js +62 -0
- package/node_modules/qrcode/lib/core/qrcode.js +495 -0
- package/node_modules/qrcode/lib/core/reed-solomon-encoder.js +56 -0
- package/node_modules/qrcode/lib/core/regex.js +31 -0
- package/node_modules/qrcode/lib/core/segments.js +330 -0
- package/node_modules/qrcode/lib/core/utils.js +63 -0
- package/node_modules/qrcode/lib/core/version-check.js +9 -0
- package/node_modules/qrcode/lib/core/version.js +163 -0
- package/node_modules/qrcode/lib/index.js +12 -0
- package/node_modules/qrcode/lib/renderer/canvas.js +63 -0
- package/node_modules/qrcode/lib/renderer/png.js +78 -0
- package/node_modules/qrcode/lib/renderer/svg-tag.js +81 -0
- package/node_modules/qrcode/lib/renderer/svg.js +19 -0
- package/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +85 -0
- package/node_modules/qrcode/lib/renderer/terminal/terminal.js +49 -0
- package/node_modules/qrcode/lib/renderer/terminal.js +9 -0
- package/node_modules/qrcode/lib/renderer/utf8.js +71 -0
- package/node_modules/qrcode/lib/renderer/utils.js +99 -0
- package/node_modules/qrcode/lib/server.js +138 -0
- package/node_modules/qrcode/license +10 -0
- package/node_modules/qrcode/package.json +77 -0
- package/node_modules/require-directory/.jshintrc +67 -0
- package/node_modules/require-directory/.npmignore +1 -0
- package/node_modules/require-directory/.travis.yml +3 -0
- package/node_modules/require-directory/LICENSE +22 -0
- package/node_modules/require-directory/README.markdown +184 -0
- package/node_modules/require-directory/index.js +86 -0
- package/node_modules/require-directory/package.json +40 -0
- package/node_modules/require-main-filename/CHANGELOG.md +26 -0
- package/node_modules/require-main-filename/LICENSE.txt +14 -0
- package/node_modules/require-main-filename/README.md +26 -0
- package/node_modules/require-main-filename/index.js +18 -0
- package/node_modules/require-main-filename/package.json +35 -0
- package/node_modules/set-blocking/CHANGELOG.md +26 -0
- package/node_modules/set-blocking/LICENSE.txt +14 -0
- package/node_modules/set-blocking/README.md +31 -0
- package/node_modules/set-blocking/index.js +7 -0
- package/node_modules/set-blocking/package.json +42 -0
- package/node_modules/string-width/index.d.ts +29 -0
- package/node_modules/string-width/index.js +47 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +56 -0
- package/node_modules/string-width/readme.md +50 -0
- package/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/which-module/LICENSE +13 -0
- package/node_modules/which-module/README.md +58 -0
- package/node_modules/which-module/index.js +9 -0
- package/node_modules/which-module/package.json +41 -0
- package/node_modules/wrap-ansi/index.js +186 -0
- package/node_modules/wrap-ansi/license +9 -0
- package/node_modules/wrap-ansi/package.json +61 -0
- package/node_modules/wrap-ansi/readme.md +97 -0
- package/node_modules/y18n/CHANGELOG.md +35 -0
- package/node_modules/y18n/LICENSE +13 -0
- package/node_modules/y18n/README.md +109 -0
- package/node_modules/y18n/index.js +188 -0
- package/node_modules/y18n/package.json +39 -0
- package/node_modules/yargs/CHANGELOG.md +420 -0
- package/node_modules/yargs/LICENSE +21 -0
- package/node_modules/yargs/README.md +140 -0
- package/node_modules/yargs/build/lib/apply-extends.d.ts +2 -0
- package/node_modules/yargs/build/lib/apply-extends.js +65 -0
- package/node_modules/yargs/build/lib/argsert.d.ts +2 -0
- package/node_modules/yargs/build/lib/argsert.js +65 -0
- package/node_modules/yargs/build/lib/command.d.ts +64 -0
- package/node_modules/yargs/build/lib/command.js +416 -0
- package/node_modules/yargs/build/lib/common-types.d.ts +36 -0
- package/node_modules/yargs/build/lib/common-types.js +25 -0
- package/node_modules/yargs/build/lib/completion-templates.d.ts +2 -0
- package/node_modules/yargs/build/lib/completion-templates.js +50 -0
- package/node_modules/yargs/build/lib/completion.d.ts +21 -0
- package/node_modules/yargs/build/lib/completion.js +135 -0
- package/node_modules/yargs/build/lib/is-promise.d.ts +1 -0
- package/node_modules/yargs/build/lib/is-promise.js +9 -0
- package/node_modules/yargs/build/lib/levenshtein.d.ts +1 -0
- package/node_modules/yargs/build/lib/levenshtein.js +58 -0
- package/node_modules/yargs/build/lib/middleware.d.ts +10 -0
- package/node_modules/yargs/build/lib/middleware.js +57 -0
- package/node_modules/yargs/build/lib/obj-filter.d.ts +1 -0
- package/node_modules/yargs/build/lib/obj-filter.js +14 -0
- package/node_modules/yargs/build/lib/parse-command.d.ts +11 -0
- package/node_modules/yargs/build/lib/parse-command.js +36 -0
- package/node_modules/yargs/build/lib/process-argv.d.ts +2 -0
- package/node_modules/yargs/build/lib/process-argv.js +31 -0
- package/node_modules/yargs/build/lib/usage.d.ts +49 -0
- package/node_modules/yargs/build/lib/usage.js +540 -0
- package/node_modules/yargs/build/lib/validation.d.ts +34 -0
- package/node_modules/yargs/build/lib/validation.js +330 -0
- package/node_modules/yargs/build/lib/yargs.d.ts +274 -0
- package/node_modules/yargs/build/lib/yargs.js +1190 -0
- package/node_modules/yargs/build/lib/yerror.d.ts +4 -0
- package/node_modules/yargs/build/lib/yerror.js +11 -0
- package/node_modules/yargs/index.js +40 -0
- package/node_modules/yargs/locales/be.json +46 -0
- package/node_modules/yargs/locales/de.json +46 -0
- package/node_modules/yargs/locales/en.json +51 -0
- package/node_modules/yargs/locales/es.json +46 -0
- package/node_modules/yargs/locales/fi.json +49 -0
- package/node_modules/yargs/locales/fr.json +53 -0
- package/node_modules/yargs/locales/hi.json +49 -0
- package/node_modules/yargs/locales/hu.json +46 -0
- package/node_modules/yargs/locales/id.json +50 -0
- package/node_modules/yargs/locales/it.json +46 -0
- package/node_modules/yargs/locales/ja.json +51 -0
- package/node_modules/yargs/locales/ko.json +49 -0
- package/node_modules/yargs/locales/nb.json +44 -0
- package/node_modules/yargs/locales/nl.json +49 -0
- package/node_modules/yargs/locales/nn.json +44 -0
- package/node_modules/yargs/locales/pirate.json +13 -0
- package/node_modules/yargs/locales/pl.json +49 -0
- package/node_modules/yargs/locales/pt.json +45 -0
- package/node_modules/yargs/locales/pt_BR.json +48 -0
- package/node_modules/yargs/locales/ru.json +46 -0
- package/node_modules/yargs/locales/th.json +46 -0
- package/node_modules/yargs/locales/tr.json +48 -0
- package/node_modules/yargs/locales/zh_CN.json +48 -0
- package/node_modules/yargs/locales/zh_TW.json +47 -0
- package/node_modules/yargs/package.json +92 -0
- package/node_modules/yargs/yargs.js +14 -0
- package/node_modules/yargs-parser/CHANGELOG.md +601 -0
- package/node_modules/yargs-parser/LICENSE.txt +14 -0
- package/node_modules/yargs-parser/README.md +449 -0
- package/node_modules/yargs-parser/index.js +1032 -0
- package/node_modules/yargs-parser/lib/tokenize-arg-string.js +40 -0
- package/node_modules/yargs-parser/package.json +46 -0
- package/package.json +65 -12
- package/DSH-Remote-v3.2.2.apk +0 -4
- package/manifest.json +0 -21
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
declare namespace pLocate {
|
|
2
|
+
interface Options {
|
|
3
|
+
/**
|
|
4
|
+
Number of concurrently pending promises returned by `tester`. Minimum: `1`.
|
|
5
|
+
|
|
6
|
+
@default Infinity
|
|
7
|
+
*/
|
|
8
|
+
readonly concurrency?: number;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
Preserve `input` order when searching.
|
|
12
|
+
|
|
13
|
+
Disable this to improve performance if you don't care about the order.
|
|
14
|
+
|
|
15
|
+
@default true
|
|
16
|
+
*/
|
|
17
|
+
readonly preserveOrder?: boolean;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare const pLocate: {
|
|
22
|
+
/**
|
|
23
|
+
Get the first fulfilled promise that satisfies the provided testing function.
|
|
24
|
+
|
|
25
|
+
@param input - An iterable of promises/values to test.
|
|
26
|
+
@param tester - This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
|
|
27
|
+
@returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
|
|
28
|
+
|
|
29
|
+
@example
|
|
30
|
+
```
|
|
31
|
+
import pathExists = require('path-exists');
|
|
32
|
+
import pLocate = require('p-locate');
|
|
33
|
+
|
|
34
|
+
const files = [
|
|
35
|
+
'unicorn.png',
|
|
36
|
+
'rainbow.png', // Only this one actually exists on disk
|
|
37
|
+
'pony.png'
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
(async () => {
|
|
41
|
+
const foundPath = await pLocate(files, file => pathExists(file));
|
|
42
|
+
|
|
43
|
+
console.log(foundPath);
|
|
44
|
+
//=> 'rainbow'
|
|
45
|
+
})();
|
|
46
|
+
```
|
|
47
|
+
*/
|
|
48
|
+
<ValueType>(
|
|
49
|
+
input: Iterable<PromiseLike<ValueType> | ValueType>,
|
|
50
|
+
tester: (element: ValueType) => PromiseLike<boolean> | boolean,
|
|
51
|
+
options?: pLocate.Options
|
|
52
|
+
): Promise<ValueType | undefined>;
|
|
53
|
+
|
|
54
|
+
// TODO: Remove this for the next major release, refactor the whole definition to:
|
|
55
|
+
// declare function pLocate<ValueType>(
|
|
56
|
+
// input: Iterable<PromiseLike<ValueType> | ValueType>,
|
|
57
|
+
// tester: (element: ValueType) => PromiseLike<boolean> | boolean,
|
|
58
|
+
// options?: pLocate.Options
|
|
59
|
+
// ): Promise<ValueType | undefined>;
|
|
60
|
+
// export = pLocate;
|
|
61
|
+
default: typeof pLocate;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export = pLocate;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const pLimit = require('p-limit');
|
|
3
|
+
|
|
4
|
+
class EndError extends Error {
|
|
5
|
+
constructor(value) {
|
|
6
|
+
super();
|
|
7
|
+
this.value = value;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// The input can also be a promise, so we await it
|
|
12
|
+
const testElement = async (element, tester) => tester(await element);
|
|
13
|
+
|
|
14
|
+
// The input can also be a promise, so we `Promise.all()` them both
|
|
15
|
+
const finder = async element => {
|
|
16
|
+
const values = await Promise.all(element);
|
|
17
|
+
if (values[1] === true) {
|
|
18
|
+
throw new EndError(values[0]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const pLocate = async (iterable, tester, options) => {
|
|
25
|
+
options = {
|
|
26
|
+
concurrency: Infinity,
|
|
27
|
+
preserveOrder: true,
|
|
28
|
+
...options
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const limit = pLimit(options.concurrency);
|
|
32
|
+
|
|
33
|
+
// Start all the promises concurrently with optional limit
|
|
34
|
+
const items = [...iterable].map(element => [element, limit(testElement, element, tester)]);
|
|
35
|
+
|
|
36
|
+
// Check the promises either serially or concurrently
|
|
37
|
+
const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
await Promise.all(items.map(element => checkLimit(finder, element)));
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (error instanceof EndError) {
|
|
43
|
+
return error.value;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
module.exports = pLocate;
|
|
51
|
+
// TODO: Remove this for the next major release
|
|
52
|
+
module.exports.default = pLocate;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "p-locate",
|
|
3
|
+
"version": "4.1.0",
|
|
4
|
+
"description": "Get the first fulfilled promise that satisfies the provided testing function",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/p-locate",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Sindre Sorhus",
|
|
9
|
+
"email": "sindresorhus@gmail.com",
|
|
10
|
+
"url": "sindresorhus.com"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=8"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "xo && ava && tsd"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"index.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"promise",
|
|
24
|
+
"locate",
|
|
25
|
+
"find",
|
|
26
|
+
"finder",
|
|
27
|
+
"search",
|
|
28
|
+
"searcher",
|
|
29
|
+
"test",
|
|
30
|
+
"array",
|
|
31
|
+
"collection",
|
|
32
|
+
"iterable",
|
|
33
|
+
"iterator",
|
|
34
|
+
"race",
|
|
35
|
+
"fulfilled",
|
|
36
|
+
"fastest",
|
|
37
|
+
"async",
|
|
38
|
+
"await",
|
|
39
|
+
"promises",
|
|
40
|
+
"bluebird"
|
|
41
|
+
],
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"p-limit": "^2.2.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"ava": "^1.4.1",
|
|
47
|
+
"delay": "^4.1.0",
|
|
48
|
+
"in-range": "^1.0.0",
|
|
49
|
+
"time-span": "^3.0.0",
|
|
50
|
+
"tsd": "^0.7.2",
|
|
51
|
+
"xo": "^0.24.0"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# p-locate [](https://travis-ci.org/sindresorhus/p-locate)
|
|
2
|
+
|
|
3
|
+
> Get the first fulfilled promise that satisfies the provided testing function
|
|
4
|
+
|
|
5
|
+
Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
$ npm install p-locate
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
Here we find the first file that exists on disk, in array order.
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
const pathExists = require('path-exists');
|
|
21
|
+
const pLocate = require('p-locate');
|
|
22
|
+
|
|
23
|
+
const files = [
|
|
24
|
+
'unicorn.png',
|
|
25
|
+
'rainbow.png', // Only this one actually exists on disk
|
|
26
|
+
'pony.png'
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
(async () => {
|
|
30
|
+
const foundPath = await pLocate(files, file => pathExists(file));
|
|
31
|
+
|
|
32
|
+
console.log(foundPath);
|
|
33
|
+
//=> 'rainbow'
|
|
34
|
+
})();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## API
|
|
41
|
+
|
|
42
|
+
### pLocate(input, tester, [options])
|
|
43
|
+
|
|
44
|
+
Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
|
|
45
|
+
|
|
46
|
+
#### input
|
|
47
|
+
|
|
48
|
+
Type: `Iterable<Promise | unknown>`
|
|
49
|
+
|
|
50
|
+
An iterable of promises/values to test.
|
|
51
|
+
|
|
52
|
+
#### tester(element)
|
|
53
|
+
|
|
54
|
+
Type: `Function`
|
|
55
|
+
|
|
56
|
+
This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
|
|
57
|
+
|
|
58
|
+
#### options
|
|
59
|
+
|
|
60
|
+
Type: `Object`
|
|
61
|
+
|
|
62
|
+
##### concurrency
|
|
63
|
+
|
|
64
|
+
Type: `number`<br>
|
|
65
|
+
Default: `Infinity`<br>
|
|
66
|
+
Minimum: `1`
|
|
67
|
+
|
|
68
|
+
Number of concurrently pending promises returned by `tester`.
|
|
69
|
+
|
|
70
|
+
##### preserveOrder
|
|
71
|
+
|
|
72
|
+
Type: `boolean`<br>
|
|
73
|
+
Default: `true`
|
|
74
|
+
|
|
75
|
+
Preserve `input` order when searching.
|
|
76
|
+
|
|
77
|
+
Disable this to improve performance if you don't care about the order.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Related
|
|
81
|
+
|
|
82
|
+
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
|
|
83
|
+
- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently
|
|
84
|
+
- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled
|
|
85
|
+
- [More…](https://github.com/sindresorhus/promise-fun)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const pTry: {
|
|
2
|
+
/**
|
|
3
|
+
Start a promise chain.
|
|
4
|
+
|
|
5
|
+
@param fn - The function to run to start the promise chain.
|
|
6
|
+
@param arguments - Arguments to pass to `fn`.
|
|
7
|
+
@returns The value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error.
|
|
8
|
+
|
|
9
|
+
@example
|
|
10
|
+
```
|
|
11
|
+
import pTry = require('p-try');
|
|
12
|
+
|
|
13
|
+
(async () => {
|
|
14
|
+
try {
|
|
15
|
+
const value = await pTry(() => {
|
|
16
|
+
return synchronousFunctionThatMightThrow();
|
|
17
|
+
});
|
|
18
|
+
console.log(value);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error(error);
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
23
|
+
```
|
|
24
|
+
*/
|
|
25
|
+
<ValueType, ArgumentsType extends unknown[]>(
|
|
26
|
+
fn: (...arguments: ArgumentsType) => PromiseLike<ValueType> | ValueType,
|
|
27
|
+
...arguments: ArgumentsType
|
|
28
|
+
): Promise<ValueType>;
|
|
29
|
+
|
|
30
|
+
// TODO: remove this in the next major version, refactor the whole definition to:
|
|
31
|
+
// declare function pTry<ValueType, ArgumentsType extends unknown[]>(
|
|
32
|
+
// fn: (...arguments: ArgumentsType) => PromiseLike<ValueType> | ValueType,
|
|
33
|
+
// ...arguments: ArgumentsType
|
|
34
|
+
// ): Promise<ValueType>;
|
|
35
|
+
// export = pTry;
|
|
36
|
+
default: typeof pTry;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export = pTry;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "p-try",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "`Start a promise chain",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/p-try",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Sindre Sorhus",
|
|
9
|
+
"email": "sindresorhus@gmail.com",
|
|
10
|
+
"url": "sindresorhus.com"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=6"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "xo && ava && tsd"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"index.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"promise",
|
|
24
|
+
"try",
|
|
25
|
+
"resolve",
|
|
26
|
+
"function",
|
|
27
|
+
"catch",
|
|
28
|
+
"async",
|
|
29
|
+
"await",
|
|
30
|
+
"promises",
|
|
31
|
+
"settled",
|
|
32
|
+
"ponyfill",
|
|
33
|
+
"polyfill",
|
|
34
|
+
"shim",
|
|
35
|
+
"bluebird"
|
|
36
|
+
],
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"ava": "^1.4.1",
|
|
39
|
+
"tsd": "^0.7.1",
|
|
40
|
+
"xo": "^0.24.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# p-try [](https://travis-ci.org/sindresorhus/p-try)
|
|
2
|
+
|
|
3
|
+
> Start a promise chain
|
|
4
|
+
|
|
5
|
+
[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
$ npm install p-try
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const pTry = require('p-try');
|
|
19
|
+
|
|
20
|
+
(async () => {
|
|
21
|
+
try {
|
|
22
|
+
const value = await pTry(() => {
|
|
23
|
+
return synchronousFunctionThatMightThrow();
|
|
24
|
+
});
|
|
25
|
+
console.log(value);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(error);
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## API
|
|
34
|
+
|
|
35
|
+
### pTry(fn, ...arguments)
|
|
36
|
+
|
|
37
|
+
Returns a `Promise` resolved with the value of calling `fn(...arguments)`. If the function throws an error, the returned `Promise` will be rejected with that error.
|
|
38
|
+
|
|
39
|
+
Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions.
|
|
40
|
+
|
|
41
|
+
#### fn
|
|
42
|
+
|
|
43
|
+
The function to run to start the promise chain.
|
|
44
|
+
|
|
45
|
+
#### arguments
|
|
46
|
+
|
|
47
|
+
Arguments to pass to `fn`.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Related
|
|
51
|
+
|
|
52
|
+
- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome
|
|
53
|
+
- [More…](https://github.com/sindresorhus/promise-fun)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const pathExists: {
|
|
2
|
+
/**
|
|
3
|
+
Check if a path exists.
|
|
4
|
+
|
|
5
|
+
@returns Whether the path exists.
|
|
6
|
+
|
|
7
|
+
@example
|
|
8
|
+
```
|
|
9
|
+
// foo.ts
|
|
10
|
+
import pathExists = require('path-exists');
|
|
11
|
+
|
|
12
|
+
(async () => {
|
|
13
|
+
console.log(await pathExists('foo.ts'));
|
|
14
|
+
//=> true
|
|
15
|
+
})();
|
|
16
|
+
```
|
|
17
|
+
*/
|
|
18
|
+
(path: string): Promise<boolean>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
Synchronously check if a path exists.
|
|
22
|
+
|
|
23
|
+
@returns Whether the path exists.
|
|
24
|
+
*/
|
|
25
|
+
sync(path: string): boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export = pathExists;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const {promisify} = require('util');
|
|
4
|
+
|
|
5
|
+
const pAccess = promisify(fs.access);
|
|
6
|
+
|
|
7
|
+
module.exports = async path => {
|
|
8
|
+
try {
|
|
9
|
+
await pAccess(path);
|
|
10
|
+
return true;
|
|
11
|
+
} catch (_) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports.sync = path => {
|
|
17
|
+
try {
|
|
18
|
+
fs.accessSync(path);
|
|
19
|
+
return true;
|
|
20
|
+
} catch (_) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "path-exists",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Check if a path exists",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/path-exists",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Sindre Sorhus",
|
|
9
|
+
"email": "sindresorhus@gmail.com",
|
|
10
|
+
"url": "sindresorhus.com"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=8"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "xo && ava && tsd"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"index.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"path",
|
|
24
|
+
"exists",
|
|
25
|
+
"exist",
|
|
26
|
+
"file",
|
|
27
|
+
"filepath",
|
|
28
|
+
"fs",
|
|
29
|
+
"filesystem",
|
|
30
|
+
"file-system",
|
|
31
|
+
"access",
|
|
32
|
+
"stat"
|
|
33
|
+
],
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"ava": "^1.4.1",
|
|
36
|
+
"tsd": "^0.7.2",
|
|
37
|
+
"xo": "^0.24.0"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# path-exists [](https://travis-ci.org/sindresorhus/path-exists)
|
|
2
|
+
|
|
3
|
+
> Check if a path exists
|
|
4
|
+
|
|
5
|
+
NOTE: `fs.existsSync` has been un-deprecated in Node.js since 6.8.0. If you only need to check synchronously, this module is not needed.
|
|
6
|
+
|
|
7
|
+
While [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it.
|
|
8
|
+
|
|
9
|
+
Never use this before handling a file though:
|
|
10
|
+
|
|
11
|
+
> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
$ npm install path-exists
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
// foo.js
|
|
25
|
+
const pathExists = require('path-exists');
|
|
26
|
+
|
|
27
|
+
(async () => {
|
|
28
|
+
console.log(await pathExists('foo.js'));
|
|
29
|
+
//=> true
|
|
30
|
+
})();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
### pathExists(path)
|
|
37
|
+
|
|
38
|
+
Returns a `Promise<boolean>` of whether the path exists.
|
|
39
|
+
|
|
40
|
+
### pathExists.sync(path)
|
|
41
|
+
|
|
42
|
+
Returns a `boolean` of whether the path exists.
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Related
|
|
46
|
+
|
|
47
|
+
- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"parserOptions": { "ecmaVersion": 2018 },
|
|
3
|
+
"extends": ["eslint:recommended", "prettier"],
|
|
4
|
+
"env": {
|
|
5
|
+
"node": true,
|
|
6
|
+
"es6": true
|
|
7
|
+
},
|
|
8
|
+
"rules": {
|
|
9
|
+
"no-var": "error"
|
|
10
|
+
},
|
|
11
|
+
"overrides": [
|
|
12
|
+
{
|
|
13
|
+
"files": ["test/*.js", "examples/*.js"],
|
|
14
|
+
"rules": {
|
|
15
|
+
"no-console": "off"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
pngjs2 original work Copyright (c) 2015 Luke Page & Original Contributors
|
|
2
|
+
pngjs derived work Copyright (c) 2012 Kuba Niegowski
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|