@modern-js/utils 1.4.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/compiled/address/index.js +1 -0
  3. package/compiled/address/lib/address.d.ts +28 -0
  4. package/compiled/address/package.json +1 -0
  5. package/compiled/browserslist/index.js +1 -1
  6. package/compiled/dotenv/index.js +1 -0
  7. package/compiled/dotenv/license +23 -0
  8. package/compiled/dotenv/package.json +1 -0
  9. package/compiled/dotenv/types/index.d.ts +59 -0
  10. package/compiled/dotenv-expand/index.d.ts +15 -0
  11. package/compiled/dotenv-expand/index.js +1 -0
  12. package/compiled/dotenv-expand/license +24 -0
  13. package/compiled/dotenv-expand/package.json +1 -0
  14. package/compiled/fast-glob/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
  15. package/compiled/fast-glob/@nodelib/fs.scandir/out/index.d.ts +12 -0
  16. package/compiled/fast-glob/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
  17. package/compiled/fast-glob/@nodelib/fs.scandir/out/settings.d.ts +20 -0
  18. package/compiled/fast-glob/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
  19. package/compiled/fast-glob/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
  20. package/compiled/fast-glob/@nodelib/fs.stat/out/index.d.ts +12 -0
  21. package/compiled/fast-glob/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
  22. package/compiled/fast-glob/@nodelib/fs.stat/out/settings.d.ts +16 -0
  23. package/compiled/fast-glob/@nodelib/fs.stat/out/types/index.d.ts +4 -0
  24. package/compiled/fast-glob/@nodelib/fs.walk/out/index.d.ts +14 -0
  25. package/compiled/fast-glob/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
  26. package/compiled/fast-glob/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
  27. package/compiled/fast-glob/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
  28. package/compiled/fast-glob/@nodelib/fs.walk/out/settings.d.ts +30 -0
  29. package/compiled/fast-glob/@nodelib/fs.walk/out/types/index.d.ts +8 -0
  30. package/compiled/fast-glob/index.js +37 -0
  31. package/compiled/fast-glob/license +21 -0
  32. package/compiled/fast-glob/out/index.d.ts +27 -0
  33. package/compiled/fast-glob/out/managers/tasks.d.ts +22 -0
  34. package/compiled/fast-glob/out/settings.d.ts +164 -0
  35. package/compiled/fast-glob/out/types/index.d.ts +31 -0
  36. package/compiled/fast-glob/package.json +1 -0
  37. package/compiled/globby/index.d.ts +186 -0
  38. package/compiled/globby/index.js +1 -0
  39. package/compiled/globby/license +9 -0
  40. package/compiled/globby/package.json +1 -0
  41. package/compiled/inquirer/index.d.ts +997 -0
  42. package/compiled/inquirer/index.js +9 -0
  43. package/compiled/inquirer/lib/objects/choice.d.ts +65 -0
  44. package/compiled/inquirer/lib/objects/choices.d.ts +206 -0
  45. package/compiled/inquirer/lib/objects/separator.d.ts +37 -0
  46. package/compiled/inquirer/lib/ui/baseUI.d.ts +37 -0
  47. package/compiled/inquirer/lib/ui/bottom-bar.d.ts +65 -0
  48. package/compiled/inquirer/lib/ui/prompt.d.ts +104 -0
  49. package/compiled/inquirer/license +22 -0
  50. package/compiled/inquirer/package.json +1 -0
  51. package/compiled/inquirer/through/index.d.ts +25 -0
  52. package/compiled/json5/index.js +1 -0
  53. package/compiled/json5/lib/index.d.ts +4 -0
  54. package/compiled/json5/lib/parse.d.ts +15 -0
  55. package/compiled/json5/lib/stringify.d.ts +89 -0
  56. package/compiled/json5/package.json +1 -0
  57. package/compiled/lodash/index.js +4 -8
  58. package/compiled/mime-types/index.d.ts +14 -0
  59. package/compiled/mime-types/index.js +14 -0
  60. package/compiled/mime-types/license +23 -0
  61. package/compiled/mime-types/package.json +1 -0
  62. package/compiled/minimist/index.d.ts +95 -0
  63. package/compiled/minimist/index.js +1 -0
  64. package/compiled/minimist/license +18 -0
  65. package/compiled/minimist/package.json +1 -0
  66. package/compiled/ora/cli-spinners/index.d.ts +125 -0
  67. package/compiled/ora/index.d.ts +277 -0
  68. package/compiled/ora/index.js +3 -0
  69. package/compiled/ora/license +9 -0
  70. package/compiled/ora/package.json +1 -0
  71. package/compiled/semver/classes/comparator.d.ts +17 -0
  72. package/compiled/semver/classes/range.d.ts +21 -0
  73. package/compiled/semver/classes/semver.d.ts +62 -0
  74. package/compiled/semver/functions/clean.d.ts +8 -0
  75. package/compiled/semver/functions/cmp.d.ts +16 -0
  76. package/compiled/semver/functions/coerce.d.ts +12 -0
  77. package/compiled/semver/functions/compare-build.d.ts +16 -0
  78. package/compiled/semver/functions/compare-loose.d.ts +5 -0
  79. package/compiled/semver/functions/compare.d.ts +20 -0
  80. package/compiled/semver/functions/diff.d.ts +13 -0
  81. package/compiled/semver/functions/eq.d.ts +9 -0
  82. package/compiled/semver/functions/gt.d.ts +9 -0
  83. package/compiled/semver/functions/gte.d.ts +9 -0
  84. package/compiled/semver/functions/inc.d.ts +15 -0
  85. package/compiled/semver/functions/lt.d.ts +9 -0
  86. package/compiled/semver/functions/lte.d.ts +8 -0
  87. package/compiled/semver/functions/major.d.ts +9 -0
  88. package/compiled/semver/functions/minor.d.ts +9 -0
  89. package/compiled/semver/functions/neq.d.ts +9 -0
  90. package/compiled/semver/functions/parse.d.ts +12 -0
  91. package/compiled/semver/functions/patch.d.ts +9 -0
  92. package/compiled/semver/functions/prerelease.d.ts +12 -0
  93. package/compiled/semver/functions/rcompare.d.ts +15 -0
  94. package/compiled/semver/functions/rsort.d.ts +9 -0
  95. package/compiled/semver/functions/satisfies.d.ts +14 -0
  96. package/compiled/semver/functions/sort.d.ts +9 -0
  97. package/compiled/semver/functions/valid.d.ts +11 -0
  98. package/compiled/semver/index.d.ts +133 -0
  99. package/compiled/semver/index.js +1 -0
  100. package/compiled/semver/internals/identifiers.d.ts +13 -0
  101. package/compiled/semver/license +15 -0
  102. package/compiled/semver/package.json +1 -0
  103. package/compiled/semver/ranges/gtr.d.ts +14 -0
  104. package/compiled/semver/ranges/intersects.d.ts +13 -0
  105. package/compiled/semver/ranges/ltr.d.ts +14 -0
  106. package/compiled/semver/ranges/max-satisfying.d.ts +14 -0
  107. package/compiled/semver/ranges/min-satisfying.d.ts +14 -0
  108. package/compiled/semver/ranges/min-version.d.ts +10 -0
  109. package/compiled/semver/ranges/outside.d.ts +15 -0
  110. package/compiled/semver/ranges/simplify.d.ts +14 -0
  111. package/compiled/semver/ranges/subset.d.ts +13 -0
  112. package/compiled/semver/ranges/to-comparators.d.ts +9 -0
  113. package/compiled/semver/ranges/valid.d.ts +12 -0
  114. package/compiled/slash/index.d.ts +25 -0
  115. package/compiled/slash/index.js +1 -0
  116. package/compiled/slash/license +9 -0
  117. package/compiled/slash/package.json +1 -0
  118. package/compiled/url-join/index.d.ts +17 -0
  119. package/compiled/url-join/index.js +1 -0
  120. package/compiled/url-join/license +21 -0
  121. package/compiled/url-join/package.json +1 -0
  122. package/dist/alias.js +4 -1
  123. package/dist/analyzeProject.d.ts +1 -0
  124. package/dist/analyzeProject.js +31 -0
  125. package/dist/compiled.d.ts +34 -17
  126. package/dist/compiled.js +59 -21
  127. package/dist/constants.d.ts +1 -1
  128. package/dist/constants.js +1 -1
  129. package/dist/emptyDir.js +4 -13
  130. package/dist/format.js +6 -1
  131. package/dist/getEntryOptions.js +2 -1
  132. package/dist/getPackageManager.js +19 -30
  133. package/dist/getPort.js +3 -12
  134. package/dist/getServerConfig.js +2 -11
  135. package/dist/index.d.ts +2 -2
  136. package/dist/index.js +2 -2
  137. package/dist/logger.d.ts +3 -0
  138. package/dist/logger.js +21 -6
  139. package/dist/monorepo.js +4 -1
  140. package/dist/nodeEnv.js +24 -39
  141. package/dist/prettyInstructions.js +3 -3
  142. package/dist/runtimeExports.js +1 -1
  143. package/dist/{ssrHelpers.d.ts → ssr.d.ts} +3 -0
  144. package/dist/{ssrHelpers.js → ssr.js} +0 -0
  145. package/dist/storage.js +1 -1
  146. package/dist/watch.js +9 -18
  147. package/package.json +41 -35
  148. package/tsconfig.json +1 -0
  149. package/dist/getCacheIdentifier.d.ts +0 -7
  150. package/dist/getCacheIdentifier.js +0 -24
  151. package/modern.config.js +0 -6
  152. package/tests/.eslintrc.js +0 -6
  153. package/tests/__snapshots__/prettyInstructions.test.ts.snap +0 -19
  154. package/tests/applyOptionsChain.test.ts +0 -100
  155. package/tests/compatRequire.test.ts +0 -32
  156. package/tests/debug.test.ts +0 -25
  157. package/tests/ensureAbsolutePath.test.ts +0 -16
  158. package/tests/findExists.test.ts +0 -22
  159. package/tests/fixtures/browserlist/develop/package.json +0 -11
  160. package/tests/fixtures/browserlist/dotfile/.browserslistrc +0 -3
  161. package/tests/fixtures/browserlist/pkg/package.json +0 -7
  162. package/tests/fixtures/compat-require/cjs.js +0 -1
  163. package/tests/fixtures/compat-require/empty.js +0 -1
  164. package/tests/fixtures/compat-require/esm.js +0 -5
  165. package/tests/fixtures/compat-require/foo.js +0 -3
  166. package/tests/fixtures/file-exists/a.ejs +0 -0
  167. package/tests/fixtures/file-exists/a.js/.gitkeep +0 -0
  168. package/tests/fixtures/file-exists/a.mjs +0 -0
  169. package/tests/fixtures/file-exists/a.ts +0 -0
  170. package/tests/format.test.ts +0 -60
  171. package/tests/generateMetaTags.test.ts +0 -19
  172. package/tests/getBrowserslist.test.ts +0 -32
  173. package/tests/getCacheIdentifier.test.ts +0 -37
  174. package/tests/getEntryOptions.test.ts +0 -53
  175. package/tests/index.test.ts +0 -18
  176. package/tests/is.test.ts +0 -27
  177. package/tests/isPlatform.test.ts +0 -19
  178. package/tests/isType.test.ts +0 -85
  179. package/tests/logger.test.ts +0 -53
  180. package/tests/prettyInstructions.test.ts +0 -139
  181. package/tests/removeSlash.test.ts +0 -19
  182. package/tests/tsconfig.json +0 -11
  183. package/tests/wait.ts +0 -38
@@ -0,0 +1,23 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4
+ Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ 'Software'), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ {"name":"mime-types","version":"2.1.35","license":"MIT"}
@@ -0,0 +1,95 @@
1
+ // Type definitions for minimist 1.2
2
+ // Project: https://github.com/substack/minimist
3
+ // Definitions by: Bart van der Schoor <https://github.com/Bartvds>
4
+ // Necroskillz <https://github.com/Necroskillz>
5
+ // kamranayub <https://github.com/kamranayub>
6
+ // Piotr Błażejewicz <https://github.com/peterblazejewicz>
7
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8
+
9
+ /**
10
+ * Return an argument object populated with the array arguments from args
11
+ *
12
+ * @param [args] An optional argument array (typically `process.argv.slice(2)`)
13
+ * @param [opts] An optional options object to customize the parsing
14
+ */
15
+ declare function minimist(args?: string[], opts?: minimist.Opts): minimist.ParsedArgs;
16
+
17
+ /**
18
+ * Return an argument object populated with the array arguments from args. Strongly-typed
19
+ * to be the intersect of type T with minimist.ParsedArgs.
20
+ *
21
+ * `T` The type that will be intersected with minimist.ParsedArgs to represent the argument object
22
+ *
23
+ * @param [args] An optional argument array (typically `process.argv.slice(2)`)
24
+ * @param [opts] An optional options object to customize the parsing
25
+ */
26
+ declare function minimist<T>(args?: string[], opts?: minimist.Opts): T & minimist.ParsedArgs;
27
+
28
+ /**
29
+ * Return an argument object populated with the array arguments from args. Strongly-typed
30
+ * to be the the type T which should extend minimist.ParsedArgs
31
+ *
32
+ * `T` The type that extends minimist.ParsedArgs and represents the argument object
33
+ *
34
+ * @param [args] An optional argument array (typically `process.argv.slice(2)`)
35
+ * @param [opts] An optional options object to customize the parsing
36
+ */
37
+ declare function minimist<T extends minimist.ParsedArgs>(args?: string[], opts?: minimist.Opts): T;
38
+
39
+ declare namespace minimist {
40
+ interface Opts {
41
+ /**
42
+ * A string or array of strings argument names to always treat as strings
43
+ */
44
+ string?: string | string[] | undefined;
45
+
46
+ /**
47
+ * A boolean, string or array of strings to always treat as booleans. If true will treat
48
+ * all double hyphenated arguments without equals signs as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
49
+ */
50
+ boolean?: boolean | string | string[] | undefined;
51
+
52
+ /**
53
+ * An object mapping string names to strings or arrays of string argument names to use as aliases
54
+ */
55
+ alias?: { [key: string]: string | string[] } | undefined;
56
+
57
+ /**
58
+ * An object mapping string argument names to default values
59
+ */
60
+ default?: { [key: string]: any } | undefined;
61
+
62
+ /**
63
+ * When true, populate argv._ with everything after the first non-option
64
+ */
65
+ stopEarly?: boolean | undefined;
66
+
67
+ /**
68
+ * A function which is invoked with a command line parameter not defined in the opts
69
+ * configuration object. If the function returns false, the unknown option is not added to argv
70
+ */
71
+ unknown?: ((arg: string) => boolean) | undefined;
72
+
73
+ /**
74
+ * When true, populate argv._ with everything before the -- and argv['--'] with everything after the --.
75
+ * Note that with -- set, parsing for arguments still stops after the `--`.
76
+ */
77
+ '--'?: boolean | undefined;
78
+ }
79
+
80
+ interface ParsedArgs {
81
+ [arg: string]: any;
82
+
83
+ /**
84
+ * If opts['--'] is true, populated with everything after the --
85
+ */
86
+ '--'?: string[] | undefined;
87
+
88
+ /**
89
+ * Contains all the arguments that didn't have an option associated with them
90
+ */
91
+ _: string[];
92
+ }
93
+ }
94
+
95
+ export = minimist;
@@ -0,0 +1 @@
1
+ (()=>{var e={319:e=>{e.exports=function(e,t){if(!t)t={};var r={bools:{},strings:{},unknownFn:null};if(typeof t["unknown"]==="function"){r.unknownFn=t["unknown"]}if(typeof t["boolean"]==="boolean"&&t["boolean"]){r.allBools=true}else{[].concat(t["boolean"]).filter(Boolean).forEach((function(e){r.bools[e]=true}))}var n={};Object.keys(t.alias||{}).forEach((function(e){n[e]=[].concat(t.alias[e]);n[e].forEach((function(t){n[t]=[e].concat(n[e].filter((function(e){return t!==e})))}))}));[].concat(t.string).filter(Boolean).forEach((function(e){r.strings[e]=true;if(n[e]){r.strings[n[e]]=true}}));var o=t["default"]||{};var s={_:[]};Object.keys(r.bools).forEach((function(e){setArg(e,o[e]===undefined?false:o[e])}));var i=[];if(e.indexOf("--")!==-1){i=e.slice(e.indexOf("--")+1);e=e.slice(0,e.indexOf("--"))}function argDefined(e,t){return r.allBools&&/^--[^=]+$/.test(t)||r.strings[e]||r.bools[e]||n[e]}function setArg(e,t,o){if(o&&r.unknownFn&&!argDefined(e,o)){if(r.unknownFn(o)===false)return}var i=!r.strings[e]&&isNumber(t)?Number(t):t;setKey(s,e.split("."),i);(n[e]||[]).forEach((function(e){setKey(s,e.split("."),i)}))}function setKey(e,t,n){var o=e;for(var s=0;s<t.length-1;s++){var i=t[s];if(isConstructorOrProto(o,i))return;if(o[i]===undefined)o[i]={};if(o[i]===Object.prototype||o[i]===Number.prototype||o[i]===String.prototype)o[i]={};if(o[i]===Array.prototype)o[i]=[];o=o[i]}var i=t[t.length-1];if(isConstructorOrProto(o,i))return;if(o===Object.prototype||o===Number.prototype||o===String.prototype)o={};if(o===Array.prototype)o=[];if(o[i]===undefined||r.bools[i]||typeof o[i]==="boolean"){o[i]=n}else if(Array.isArray(o[i])){o[i].push(n)}else{o[i]=[o[i],n]}}function aliasIsBoolean(e){return n[e].some((function(e){return r.bools[e]}))}for(var a=0;a<e.length;a++){var f=e[a];if(/^--.+=/.test(f)){var u=f.match(/^--([^=]+)=([\s\S]*)$/);var l=u[1];var c=u[2];if(r.bools[l]){c=c!=="false"}setArg(l,c,f)}else if(/^--no-.+/.test(f)){var l=f.match(/^--no-(.+)/)[1];setArg(l,false,f)}else if(/^--.+/.test(f)){var l=f.match(/^--(.+)/)[1];var p=e[a+1];if(p!==undefined&&!/^-/.test(p)&&!r.bools[l]&&!r.allBools&&(n[l]?!aliasIsBoolean(l):true)){setArg(l,p,f);a++}else if(/^(true|false)$/.test(p)){setArg(l,p==="true",f);a++}else{setArg(l,r.strings[l]?"":true,f)}}else if(/^-[^-]+/.test(f)){var b=f.slice(1,-1).split("");var _=false;for(var g=0;g<b.length;g++){var p=f.slice(g+2);if(p==="-"){setArg(b[g],p,f);continue}if(/[A-Za-z]/.test(b[g])&&/=/.test(p)){setArg(b[g],p.split("=")[1],f);_=true;break}if(/[A-Za-z]/.test(b[g])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(p)){setArg(b[g],p,f);_=true;break}if(b[g+1]&&b[g+1].match(/\W/)){setArg(b[g],f.slice(g+2),f);_=true;break}else{setArg(b[g],r.strings[b[g]]?"":true,f)}}var l=f.slice(-1)[0];if(!_&&l!=="-"){if(e[a+1]&&!/^(-|--)[^-]/.test(e[a+1])&&!r.bools[l]&&(n[l]?!aliasIsBoolean(l):true)){setArg(l,e[a+1],f);a++}else if(e[a+1]&&/^(true|false)$/.test(e[a+1])){setArg(l,e[a+1]==="true",f);a++}else{setArg(l,r.strings[l]?"":true,f)}}}else{if(!r.unknownFn||r.unknownFn(f)!==false){s._.push(r.strings["_"]||!isNumber(f)?f:Number(f))}if(t.stopEarly){s._.push.apply(s._,e.slice(a+1));break}}}Object.keys(o).forEach((function(e){if(!hasKey(s,e.split("."))){setKey(s,e.split("."),o[e]);(n[e]||[]).forEach((function(t){setKey(s,t.split("."),o[e])}))}}));if(t["--"]){s["--"]=new Array;i.forEach((function(e){s["--"].push(e)}))}else{i.forEach((function(e){s._.push(e)}))}return s};function hasKey(e,t){var r=e;t.slice(0,-1).forEach((function(e){r=r[e]||{}}));var n=t[t.length-1];return n in r}function isNumber(e){if(typeof e==="number")return true;if(/^0x[0-9a-f]+$/i.test(e))return true;return/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function isConstructorOrProto(e,t){return t==="constructor"&&typeof e[t]==="function"||t==="__proto__"}}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var s=true;try{e[r](o,o.exports,__nccwpck_require__);s=false}finally{if(s)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(319);module.exports=r})();
@@ -0,0 +1,18 @@
1
+ This software is released under the MIT license:
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ {"name":"minimist","author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"version":"1.2.6","license":"MIT"}
@@ -0,0 +1,125 @@
1
+ declare namespace cliSpinners {
2
+ type SpinnerName =
3
+ | 'dots'
4
+ | 'dots2'
5
+ | 'dots3'
6
+ | 'dots4'
7
+ | 'dots5'
8
+ | 'dots6'
9
+ | 'dots7'
10
+ | 'dots8'
11
+ | 'dots9'
12
+ | 'dots10'
13
+ | 'dots11'
14
+ | 'dots12'
15
+ | 'dots8Bit'
16
+ | 'line'
17
+ | 'line2'
18
+ | 'pipe'
19
+ | 'simpleDots'
20
+ | 'simpleDotsScrolling'
21
+ | 'star'
22
+ | 'star2'
23
+ | 'flip'
24
+ | 'hamburger'
25
+ | 'growVertical'
26
+ | 'growHorizontal'
27
+ | 'balloon'
28
+ | 'balloon2'
29
+ | 'noise'
30
+ | 'bounce'
31
+ | 'boxBounce'
32
+ | 'boxBounce2'
33
+ | 'triangle'
34
+ | 'arc'
35
+ | 'circle'
36
+ | 'squareCorners'
37
+ | 'circleQuarters'
38
+ | 'circleHalves'
39
+ | 'squish'
40
+ | 'toggle'
41
+ | 'toggle2'
42
+ | 'toggle3'
43
+ | 'toggle4'
44
+ | 'toggle5'
45
+ | 'toggle6'
46
+ | 'toggle7'
47
+ | 'toggle8'
48
+ | 'toggle9'
49
+ | 'toggle10'
50
+ | 'toggle11'
51
+ | 'toggle12'
52
+ | 'toggle13'
53
+ | 'arrow'
54
+ | 'arrow2'
55
+ | 'arrow3'
56
+ | 'bouncingBar'
57
+ | 'bouncingBall'
58
+ | 'smiley'
59
+ | 'monkey'
60
+ | 'hearts'
61
+ | 'clock'
62
+ | 'earth'
63
+ | 'material'
64
+ | 'moon'
65
+ | 'runner'
66
+ | 'pong'
67
+ | 'shark'
68
+ | 'dqpb'
69
+ | 'weather'
70
+ | 'christmas'
71
+ | 'grenade'
72
+ | 'point'
73
+ | 'layer'
74
+ | 'betaWave'
75
+ | 'fingerDance'
76
+ | 'fistBump'
77
+ | 'soccerHeader'
78
+ | 'mindblown'
79
+ | 'speaker'
80
+ | 'orangePulse'
81
+ | 'bluePulse'
82
+ | 'orangeBluePulse'
83
+ | 'timeTravel'
84
+ | 'aesthetic';
85
+
86
+ interface Spinner {
87
+ /**
88
+ Recommended interval.
89
+ */
90
+ readonly interval: number;
91
+
92
+ /**
93
+ A list of frames to show for the spinner.
94
+ */
95
+ readonly frames: string[];
96
+ }
97
+ }
98
+
99
+ /**
100
+ 70+ spinners for use in the terminal.
101
+
102
+ @example
103
+ ```
104
+ import cliSpinners = require('../cli-spinners');
105
+
106
+ console.log(cliSpinners.dots);
107
+ // {
108
+ // interval: 80,
109
+ // frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
110
+ // }
111
+ ```
112
+ */
113
+ declare const cliSpinners: {
114
+ readonly [spinnerName in cliSpinners.SpinnerName]: cliSpinners.Spinner;
115
+ } & {
116
+ /**
117
+ Returns a random spinner each time it's called.
118
+ */
119
+ readonly random: cliSpinners.Spinner;
120
+
121
+ // TODO: Remove this for the next major release
122
+ default: typeof cliSpinners;
123
+ };
124
+
125
+ export = cliSpinners;
@@ -0,0 +1,277 @@
1
+ import {SpinnerName} from './cli-spinners';
2
+
3
+ declare namespace ora {
4
+ interface Spinner {
5
+ readonly interval?: number;
6
+ readonly frames: string[];
7
+ }
8
+
9
+ type Color =
10
+ | 'black'
11
+ | 'red'
12
+ | 'green'
13
+ | 'yellow'
14
+ | 'blue'
15
+ | 'magenta'
16
+ | 'cyan'
17
+ | 'white'
18
+ | 'gray';
19
+
20
+ type PrefixTextGenerator = () => string;
21
+
22
+ interface Options {
23
+ /**
24
+ Text to display after the spinner.
25
+ */
26
+ readonly text?: string;
27
+
28
+ /**
29
+ Text or a function that returns text to display before the spinner. No prefix text will be displayed if set to an empty string.
30
+ */
31
+ readonly prefixText?: string | PrefixTextGenerator;
32
+
33
+ /**
34
+ Name of one of the provided spinners. See [`example.js`](https://github.com/BendingBender/ora/blob/main/example.js) in this repo if you want to test out different spinners. On Windows, it will always use the line spinner as the Windows command-line doesn't have proper Unicode support.
35
+
36
+ @default 'dots'
37
+
38
+ Or an object like:
39
+
40
+ @example
41
+ ```
42
+ {
43
+ interval: 80, // Optional
44
+ frames: ['-', '+', '-']
45
+ }
46
+ ```
47
+ */
48
+ readonly spinner?: SpinnerName | Spinner;
49
+
50
+ /**
51
+ Color of the spinner.
52
+
53
+ @default 'cyan'
54
+ */
55
+ readonly color?: Color;
56
+
57
+ /**
58
+ Set to `false` to stop Ora from hiding the cursor.
59
+
60
+ @default true
61
+ */
62
+ readonly hideCursor?: boolean;
63
+
64
+ /**
65
+ Indent the spinner with the given number of spaces.
66
+
67
+ @default 0
68
+ */
69
+ readonly indent?: number;
70
+
71
+ /**
72
+ Interval between each frame.
73
+
74
+ Spinners provide their own recommended interval, so you don't really need to specify this.
75
+
76
+ Default: Provided by the spinner or `100`.
77
+ */
78
+ readonly interval?: number;
79
+
80
+ /**
81
+ Stream to write the output.
82
+
83
+ You could for example set this to `process.stdout` instead.
84
+
85
+ @default process.stderr
86
+ */
87
+ readonly stream?: NodeJS.WritableStream;
88
+
89
+ /**
90
+ Force enable/disable the spinner. If not specified, the spinner will be enabled if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment.
91
+
92
+ Note that `{isEnabled: false}` doesn't mean it won't output anything. It just means it won't output the spinner, colors, and other ansi escape codes. It will still log text.
93
+ */
94
+ readonly isEnabled?: boolean;
95
+
96
+ /**
97
+ Disable the spinner and all log text. All output is suppressed and `isEnabled` will be considered `false`.
98
+
99
+ @default false
100
+ */
101
+ readonly isSilent?: boolean;
102
+
103
+ /**
104
+ Discard stdin input (except Ctrl+C) while running if it's TTY. This prevents the spinner from twitching on input, outputting broken lines on `Enter` key presses, and prevents buffering of input while the spinner is running.
105
+
106
+ This has no effect on Windows as there's no good way to implement discarding stdin properly there.
107
+
108
+ @default true
109
+ */
110
+ readonly discardStdin?: boolean;
111
+ }
112
+
113
+ interface PersistOptions {
114
+ /**
115
+ Symbol to replace the spinner with.
116
+
117
+ @default ' '
118
+ */
119
+ readonly symbol?: string;
120
+
121
+ /**
122
+ Text to be persisted after the symbol.
123
+
124
+ Default: Current `text`.
125
+ */
126
+ readonly text?: string;
127
+
128
+ /**
129
+ Text or a function that returns text to be persisted before the symbol. No prefix text will be displayed if set to an empty string.
130
+
131
+ Default: Current `prefixText`.
132
+ */
133
+ readonly prefixText?: string | PrefixTextGenerator;
134
+ }
135
+
136
+ interface Ora {
137
+ /**
138
+ A boolean of whether the instance is currently spinning.
139
+ */
140
+ readonly isSpinning: boolean;
141
+
142
+ /**
143
+ Change the text after the spinner.
144
+ */
145
+ text: string;
146
+
147
+ /**
148
+ Change the text or function that returns text before the spinner. No prefix text will be displayed if set to an empty string.
149
+ */
150
+ prefixText: string | PrefixTextGenerator;
151
+
152
+ /**
153
+ Change the spinner color.
154
+ */
155
+ color: Color;
156
+
157
+ /**
158
+ Change the spinner.
159
+ */
160
+ spinner: SpinnerName | Spinner;
161
+
162
+ /**
163
+ Change the spinner indent.
164
+ */
165
+ indent: number;
166
+
167
+ /**
168
+ Start the spinner.
169
+
170
+ @param text - Set the current text.
171
+ @returns The spinner instance.
172
+ */
173
+ start(text?: string): Ora;
174
+
175
+ /**
176
+ Stop and clear the spinner.
177
+
178
+ @returns The spinner instance.
179
+ */
180
+ stop(): Ora;
181
+
182
+ /**
183
+ Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided.
184
+
185
+ @param text - Will persist text if provided.
186
+ @returns The spinner instance.
187
+ */
188
+ succeed(text?: string): Ora;
189
+
190
+ /**
191
+ Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided.
192
+
193
+ @param text - Will persist text if provided.
194
+ @returns The spinner instance.
195
+ */
196
+ fail(text?: string): Ora;
197
+
198
+ /**
199
+ Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided.
200
+
201
+ @param text - Will persist text if provided.
202
+ @returns The spinner instance.
203
+ */
204
+ warn(text?: string): Ora;
205
+
206
+ /**
207
+ Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided.
208
+
209
+ @param text - Will persist text if provided.
210
+ @returns The spinner instance.
211
+ */
212
+ info(text?: string): Ora;
213
+
214
+ /**
215
+ Stop the spinner and change the symbol or text.
216
+
217
+ @returns The spinner instance.
218
+ */
219
+ stopAndPersist(options?: PersistOptions): Ora;
220
+
221
+ /**
222
+ Clear the spinner.
223
+
224
+ @returns The spinner instance.
225
+ */
226
+ clear(): Ora;
227
+
228
+ /**
229
+ Manually render a new frame.
230
+
231
+ @returns The spinner instance.
232
+ */
233
+ render(): Ora;
234
+
235
+ /**
236
+ Get a new frame.
237
+
238
+ @returns The spinner instance text.
239
+ */
240
+ frame(): string;
241
+ }
242
+ }
243
+
244
+ declare const ora: {
245
+ /**
246
+ Elegant terminal spinner.
247
+
248
+ @param options - If a string is provided, it is treated as a shortcut for `options.text`.
249
+
250
+ @example
251
+ ```
252
+ import ora = require('./ora');
253
+
254
+ const spinner = ora('Loading unicorns').start();
255
+
256
+ setTimeout(() => {
257
+ spinner.color = 'yellow';
258
+ spinner.text = 'Loading rainbows';
259
+ }, 1000);
260
+ ```
261
+ */
262
+ (options?: ora.Options | string): ora.Ora;
263
+
264
+ /**
265
+ Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects.
266
+
267
+ @param action - The promise to start the spinner for.
268
+ @param options - If a string is provided, it is treated as a shortcut for `options.text`.
269
+ @returns The spinner instance.
270
+ */
271
+ promise(
272
+ action: PromiseLike<unknown>,
273
+ options?: ora.Options | string
274
+ ): ora.Ora;
275
+ };
276
+
277
+ export = ora;