@umijs/utils 3.5.20 → 4.0.0-beta.4

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 (223) hide show
  1. package/README.md +2 -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/axios/LICENSE +19 -0
  6. package/compiled/axios/index.d.ts +206 -0
  7. package/compiled/axios/index.js +1 -0
  8. package/compiled/axios/package.json +1 -0
  9. package/compiled/chalk/LICENSE +9 -0
  10. package/compiled/chalk/index.d.ts +415 -0
  11. package/compiled/chalk/index.js +1 -0
  12. package/compiled/chalk/package.json +1 -0
  13. package/compiled/cheerio/LICENSE +21 -0
  14. package/compiled/cheerio/domelementtype/lib/index.d.ts +48 -0
  15. package/compiled/cheerio/domhandler/lib/index.d.ts +85 -0
  16. package/compiled/cheerio/domhandler/lib/node.d.ts +169 -0
  17. package/compiled/cheerio/htmlparser2/lib/Parser.d.ts +159 -0
  18. package/compiled/cheerio/htmlparser2/lib/Tokenizer.d.ts +182 -0
  19. package/compiled/cheerio/htmlparser2/lib/index.d.ts +39 -0
  20. package/compiled/cheerio/index.js +16 -0
  21. package/compiled/cheerio/lib/api/attributes.d.ts +317 -0
  22. package/compiled/cheerio/lib/api/css.d.ts +41 -0
  23. package/compiled/cheerio/lib/api/forms.d.ts +31 -0
  24. package/compiled/cheerio/lib/api/manipulation.d.ts +496 -0
  25. package/compiled/cheerio/lib/api/traversing.d.ts +644 -0
  26. package/compiled/cheerio/lib/cheerio.d.ts +53 -0
  27. package/compiled/cheerio/lib/index.d.ts +91 -0
  28. package/compiled/cheerio/lib/load.d.ts +73 -0
  29. package/compiled/cheerio/lib/options.d.ts +31 -0
  30. package/compiled/cheerio/lib/static.d.ts +88 -0
  31. package/compiled/cheerio/lib/types.d.ts +20 -0
  32. package/compiled/cheerio/package.json +1 -0
  33. package/compiled/color/LICENSE +21 -0
  34. package/compiled/color/color-convert/conversions.d.ts +149 -0
  35. package/compiled/color/color-convert/index.d.ts +113 -0
  36. package/compiled/color/color-convert/route.d.ts +294 -0
  37. package/compiled/color/color-name/index.d.ts +161 -0
  38. package/compiled/color/index.d.ts +142 -0
  39. package/compiled/color/index.js +1 -0
  40. package/compiled/color/package.json +4 -0
  41. package/compiled/cross-spawn/LICENSE +21 -0
  42. package/compiled/cross-spawn/index.d.ts +36 -0
  43. package/compiled/cross-spawn/index.js +1 -0
  44. package/compiled/cross-spawn/package.json +1 -0
  45. package/compiled/debug/LICENSE +19 -0
  46. package/compiled/debug/index.d.ts +54 -0
  47. package/compiled/debug/index.js +1 -0
  48. package/compiled/debug/ms/index.d.ts +25 -0
  49. package/compiled/debug/package.json +1 -0
  50. package/compiled/deepmerge/index.d.ts +16 -0
  51. package/compiled/deepmerge/index.js +1 -0
  52. package/compiled/deepmerge/package.json +1 -0
  53. package/compiled/execa/LICENSE +9 -0
  54. package/compiled/execa/index.d.ts +564 -0
  55. package/compiled/execa/index.js +1 -0
  56. package/compiled/execa/package.json +1 -0
  57. package/compiled/fs-extra/LICENSE +15 -0
  58. package/compiled/fs-extra/index.d.ts +332 -0
  59. package/compiled/fs-extra/index.js +1 -0
  60. package/compiled/fs-extra/package.json +1 -0
  61. package/compiled/glob/LICENSE +21 -0
  62. package/compiled/glob/index.d.ts +89 -0
  63. package/compiled/glob/index.js +1 -0
  64. package/compiled/glob/minimatch/index.d.ts +204 -0
  65. package/compiled/glob/package.json +1 -0
  66. package/compiled/import-lazy/LICENSE +9 -0
  67. package/compiled/import-lazy/index.d.ts +26 -0
  68. package/compiled/import-lazy/index.js +1 -0
  69. package/compiled/import-lazy/package.json +1 -0
  70. package/compiled/lodash/LICENSE +47 -0
  71. package/compiled/lodash/common/array.d.ts +2126 -0
  72. package/compiled/lodash/common/collection.d.ts +1930 -0
  73. package/compiled/lodash/common/common.d.ts +280 -0
  74. package/compiled/lodash/common/date.d.ts +23 -0
  75. package/compiled/lodash/common/function.d.ts +1430 -0
  76. package/compiled/lodash/common/lang.d.ts +1692 -0
  77. package/compiled/lodash/common/math.d.ts +405 -0
  78. package/compiled/lodash/common/number.d.ts +131 -0
  79. package/compiled/lodash/common/object.d.ts +2519 -0
  80. package/compiled/lodash/common/seq.d.ts +210 -0
  81. package/compiled/lodash/common/string.d.ts +788 -0
  82. package/compiled/lodash/common/util.d.ts +1219 -0
  83. package/compiled/lodash/index.d.ts +46 -0
  84. package/compiled/lodash/index.js +9 -0
  85. package/compiled/lodash/package.json +1 -0
  86. package/compiled/mustache/LICENSE +11 -0
  87. package/compiled/mustache/index.d.ts +437 -0
  88. package/compiled/mustache/index.js +5 -0
  89. package/compiled/mustache/package.json +1 -0
  90. package/compiled/pkg-up/LICENSE +9 -0
  91. package/compiled/pkg-up/index.d.ts +48 -0
  92. package/compiled/pkg-up/index.js +1 -0
  93. package/compiled/pkg-up/package.json +1 -0
  94. package/compiled/portfinder/LICENSE +22 -0
  95. package/compiled/portfinder/index.js +1 -0
  96. package/compiled/portfinder/lib/portfinder.d.ts +47 -0
  97. package/compiled/portfinder/package.json +1 -0
  98. package/compiled/prettier/LICENSE +7 -0
  99. package/compiled/prettier/index.d.ts +867 -0
  100. package/compiled/prettier/index.js +475 -0
  101. package/compiled/prettier/package.json +5 -0
  102. package/compiled/prompts/LICENSE +21 -0
  103. package/compiled/prompts/index.d.ts +120 -0
  104. package/compiled/prompts/index.js +1 -0
  105. package/compiled/prompts/package.json +1 -0
  106. package/compiled/resolve/LICENSE +21 -0
  107. package/compiled/resolve/index.d.ts +166 -0
  108. package/compiled/resolve/index.js +1 -0
  109. package/compiled/resolve/package.json +1 -0
  110. package/compiled/rimraf/LICENSE +15 -0
  111. package/compiled/rimraf/glob/index.d.ts +89 -0
  112. package/compiled/rimraf/index.d.ts +49 -0
  113. package/compiled/rimraf/index.js +1 -0
  114. package/compiled/rimraf/minimatch/index.d.ts +204 -0
  115. package/compiled/rimraf/package.json +1 -0
  116. package/compiled/semver/LICENSE +15 -0
  117. package/compiled/semver/classes/comparator.d.ts +17 -0
  118. package/compiled/semver/classes/range.d.ts +21 -0
  119. package/compiled/semver/classes/semver.d.ts +62 -0
  120. package/compiled/semver/functions/clean.d.ts +8 -0
  121. package/compiled/semver/functions/cmp.d.ts +16 -0
  122. package/compiled/semver/functions/coerce.d.ts +12 -0
  123. package/compiled/semver/functions/compare-build.d.ts +16 -0
  124. package/compiled/semver/functions/compare-loose.d.ts +5 -0
  125. package/compiled/semver/functions/compare.d.ts +20 -0
  126. package/compiled/semver/functions/diff.d.ts +13 -0
  127. package/compiled/semver/functions/eq.d.ts +9 -0
  128. package/compiled/semver/functions/gt.d.ts +9 -0
  129. package/compiled/semver/functions/gte.d.ts +9 -0
  130. package/compiled/semver/functions/inc.d.ts +15 -0
  131. package/compiled/semver/functions/lt.d.ts +9 -0
  132. package/compiled/semver/functions/lte.d.ts +8 -0
  133. package/compiled/semver/functions/major.d.ts +9 -0
  134. package/compiled/semver/functions/minor.d.ts +9 -0
  135. package/compiled/semver/functions/neq.d.ts +9 -0
  136. package/compiled/semver/functions/parse.d.ts +12 -0
  137. package/compiled/semver/functions/patch.d.ts +9 -0
  138. package/compiled/semver/functions/prerelease.d.ts +12 -0
  139. package/compiled/semver/functions/rcompare.d.ts +15 -0
  140. package/compiled/semver/functions/rsort.d.ts +9 -0
  141. package/compiled/semver/functions/satisfies.d.ts +14 -0
  142. package/compiled/semver/functions/sort.d.ts +9 -0
  143. package/compiled/semver/functions/valid.d.ts +11 -0
  144. package/compiled/semver/index.d.ts +133 -0
  145. package/compiled/semver/index.js +1 -0
  146. package/compiled/semver/internals/identifiers.d.ts +13 -0
  147. package/compiled/semver/package.json +1 -0
  148. package/compiled/semver/ranges/gtr.d.ts +14 -0
  149. package/compiled/semver/ranges/intersects.d.ts +13 -0
  150. package/compiled/semver/ranges/ltr.d.ts +14 -0
  151. package/compiled/semver/ranges/max-satisfying.d.ts +14 -0
  152. package/compiled/semver/ranges/min-satisfying.d.ts +14 -0
  153. package/compiled/semver/ranges/min-version.d.ts +10 -0
  154. package/compiled/semver/ranges/outside.d.ts +15 -0
  155. package/compiled/semver/ranges/simplify.d.ts +14 -0
  156. package/compiled/semver/ranges/subset.d.ts +13 -0
  157. package/compiled/semver/ranges/to-comparators.d.ts +9 -0
  158. package/compiled/semver/ranges/valid.d.ts +12 -0
  159. package/compiled/strip-ansi/LICENSE +9 -0
  160. package/compiled/strip-ansi/index.d.ts +17 -0
  161. package/compiled/strip-ansi/index.js +1 -0
  162. package/compiled/strip-ansi/package.json +1 -0
  163. package/compiled/yargs-parser/index.d.ts +112 -0
  164. package/compiled/yargs-parser/index.js +1 -0
  165. package/compiled/yargs-parser/package.json +1 -0
  166. package/dist/BaseGenerator/BaseGenerator.d.ts +18 -0
  167. package/dist/BaseGenerator/BaseGenerator.js +58 -0
  168. package/dist/BaseGenerator/generateFile.d.ts +8 -0
  169. package/dist/BaseGenerator/generateFile.js +25 -0
  170. package/{lib → dist}/Generator/Generator.d.ts +3 -3
  171. package/dist/Generator/Generator.js +74 -0
  172. package/dist/importLazy.d.ts +6 -0
  173. package/dist/importLazy.js +17 -0
  174. package/dist/index.d.ts +33 -0
  175. package/dist/index.js +88 -0
  176. package/dist/installDeps.d.ts +9 -0
  177. package/dist/installDeps.js +39 -0
  178. package/dist/logger.d.ts +14 -0
  179. package/dist/logger.js +39 -0
  180. package/dist/npmClient.d.ts +15 -0
  181. package/dist/npmClient.js +43 -0
  182. package/dist/randomColor/randomColor.d.ts +6 -0
  183. package/dist/randomColor/randomColor.js +19 -0
  184. package/dist/register.d.ts +6 -0
  185. package/dist/register.js +47 -0
  186. package/dist/updatePackageJSON.d.ts +5 -0
  187. package/dist/updatePackageJSON.js +21 -0
  188. package/dist/winPath.d.ts +1 -0
  189. package/dist/winPath.js +11 -0
  190. package/package.json +96 -12
  191. package/lib/BabelRegister/BabelRegister.d.ts +0 -9
  192. package/lib/BabelRegister/BabelRegister.js +0 -66
  193. package/lib/Generator/Generator.js +0 -120
  194. package/lib/cheerio/cheerio.d.ts +0 -2
  195. package/lib/cheerio/cheerio.js +0 -37
  196. package/lib/cleanRequireCache/cleanRequireCache.d.ts +0 -1
  197. package/lib/cleanRequireCache/cleanRequireCache.js +0 -40
  198. package/lib/compatESModuleRequire/compatESModuleRequire.d.ts +0 -7
  199. package/lib/compatESModuleRequire/compatESModuleRequire.js +0 -22
  200. package/lib/delay/delay.d.ts +0 -1
  201. package/lib/delay/delay.js +0 -22
  202. package/lib/getFile/getFile.d.ts +0 -22
  203. package/lib/getFile/getFile.js +0 -85
  204. package/lib/index.d.ts +0 -66
  205. package/lib/index.js +0 -619
  206. package/lib/isLernaPackage/isLernaPackage.d.ts +0 -1
  207. package/lib/isLernaPackage/isLernaPackage.js +0 -42
  208. package/lib/mergeConfig/mergeConfig.d.ts +0 -8
  209. package/lib/mergeConfig/mergeConfig.js +0 -42
  210. package/lib/parseRequireDeps/parseRequireDeps.d.ts +0 -1
  211. package/lib/parseRequireDeps/parseRequireDeps.js +0 -98
  212. package/lib/randomColor/randomColor.d.ts +0 -6
  213. package/lib/randomColor/randomColor.js +0 -42
  214. package/lib/routes.d.ts +0 -11
  215. package/lib/routes.js +0 -53
  216. package/lib/ssr.d.ts +0 -12
  217. package/lib/ssr.js +0 -41
  218. package/lib/types.d.ts +0 -7
  219. package/lib/types.js +0 -17
  220. package/lib/winEOL/winEOL.d.ts +0 -7
  221. package/lib/winEOL/winEOL.js +0 -39
  222. package/lib/winPath/winPath.d.ts +0 -1
  223. package/lib/winPath/winPath.js +0 -28
@@ -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,17 @@
1
+ /**
2
+ Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
3
+
4
+ @example
5
+ ```
6
+ import stripAnsi = require('../strip-ansi');
7
+
8
+ stripAnsi('\u001B[4mUnicorn\u001B[0m');
9
+ //=> 'Unicorn'
10
+
11
+ stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
12
+ //=> 'Click'
13
+ ```
14
+ */
15
+ declare function stripAnsi(string: string): string;
16
+
17
+ export = stripAnsi;
@@ -0,0 +1 @@
1
+ (function(){"use strict";var e={705:function(e){e.exports=({onlyFirst:e=false}={})=>{const r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(r,e?undefined:"g")}},323:function(e,r,_){const n=_(705);e.exports=e=>typeof e==="string"?e.replace(n(),""):e}};var r={};function __nccwpck_require__(_){var n=r[_];if(n!==undefined){return n.exports}var t=r[_]={exports:{}};var i=true;try{e[_](t,t.exports,__nccwpck_require__);i=false}finally{if(i)delete r[_]}return t.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var _=__nccwpck_require__(323);module.exports=_})();
@@ -0,0 +1 @@
1
+ {"name":"strip-ansi","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"license":"MIT"}
@@ -0,0 +1,112 @@
1
+ // Type definitions for yargs-parser 20.2
2
+ // Project: https://github.com/yargs/yargs-parser#readme
3
+ // Definitions by: Miles Johnson <https://github.com/milesj>
4
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+ // TypeScript Version: 2.2
6
+
7
+ declare namespace yargsParser {
8
+ interface Arguments {
9
+ /** Non-option arguments */
10
+ _: string[];
11
+ /** The script name or node command */
12
+ $0: string;
13
+ /** All remaining options */
14
+ [argName: string]: any;
15
+ }
16
+
17
+ interface DetailedArguments {
18
+ /** An object representing the parsed value of `args` */
19
+ argv: Arguments;
20
+ /** Populated with an error object if an exception occurred during parsing. */
21
+ error: Error | null;
22
+ /** The inferred list of aliases built by combining lists in opts.alias. */
23
+ aliases: { [alias: string]: string[] };
24
+ /** Any new aliases added via camel-case expansion. */
25
+ newAliases: { [alias: string]: boolean };
26
+ /** The configuration loaded from the yargs stanza in package.json. */
27
+ configuration: Configuration;
28
+ }
29
+
30
+ interface Configuration {
31
+ /** Should variables prefixed with --no be treated as negations? Default is `true` */
32
+ 'boolean-negation': boolean;
33
+ /** Should hyphenated arguments be expanded into camel-case aliases? Default is `true` */
34
+ 'camel-case-expansion': boolean;
35
+ /** Should arrays be combined when provided by both command line arguments and a configuration file. Default is `false` */
36
+ 'combine-arrays': boolean;
37
+ /** Should keys that contain . be treated as objects? Default is `true` */
38
+ 'dot-notation': boolean;
39
+ /** Should arguments be coerced into an array when duplicated. Default is `true` */
40
+ 'duplicate-arguments-array': boolean;
41
+ /** Should array arguments be coerced into a single array when duplicated. Default is `true` */
42
+ 'flatten-duplicate-arrays': boolean;
43
+ /** Should arrays consume more than one positional argument following their flag. Default is `true` */
44
+ 'greedy-arrays': boolean;
45
+ /** Should nargs consume dash options as well as positional arguments. Default is `false` */
46
+ 'nargs-eats-options': boolean;
47
+ /** Should parsing stop at the first text argument? This is similar to how e.g. ssh parses its command line. Default is `false` */
48
+ 'halt-at-non-option': boolean;
49
+ /** The prefix to use for negated boolean variables. Default is `'no-'` */
50
+ 'negation-prefix': string;
51
+ /** Should keys that look like numbers be treated as such? Default is `true` */
52
+ 'parse-numbers': boolean;
53
+ /** Should positional keys that look like numbers be treated as such? Default is `true` */
54
+ 'parse-positional-numbers': boolean;
55
+ /** Should unparsed flags be stored in -- or _. Default is `false` */
56
+ 'populate--': boolean;
57
+ /** Should a placeholder be added for keys not set via the corresponding CLI argument? Default is `false` */
58
+ 'set-placeholder-key': boolean;
59
+ /** Should a group of short-options be treated as boolean flags? Default is `true` */
60
+ 'short-option-groups': boolean;
61
+ /** Should aliases be removed before returning results? Default is `false` */
62
+ 'strip-aliased': boolean;
63
+ /** Should dashed keys be removed before returning results? This option has no effect if camel-case-expansion is disabled. Default is `false` */
64
+ 'strip-dashed': boolean;
65
+ /** Should unknown options be treated like regular arguments? An unknown option is one that is not configured in opts. Default is `false` */
66
+ 'unknown-options-as-args': boolean;
67
+ }
68
+
69
+ interface Options {
70
+ /** An object representing the set of aliases for a key: `{ alias: { foo: ['f']} }`. */
71
+ alias?: { [key: string]: string | string[] } | undefined;
72
+ /**
73
+ * Indicate that keys should be parsed as an array: `{ array: ['foo', 'bar'] }`.
74
+ * Indicate that keys should be parsed as an array and coerced to booleans / numbers:
75
+ * { array: [ { key: 'foo', boolean: true }, {key: 'bar', number: true} ] }`.
76
+ */
77
+ array?: string[] | Array<{ key: string; boolean?: boolean | undefined, number?: boolean | undefined }> | undefined;
78
+ /** Arguments should be parsed as booleans: `{ boolean: ['x', 'y'] }`. */
79
+ boolean?: string[] | undefined;
80
+ /** Indicate a key that represents a path to a configuration file (this file will be loaded and parsed). */
81
+ config?: string | string[] | { [key: string]: boolean } | undefined;
82
+ /** Provide configuration options to the yargs-parser. */
83
+ configuration?: Partial<Configuration> | undefined;
84
+ /**
85
+ * Provide a custom synchronous function that returns a coerced value from the argument provided (or throws an error), e.g.
86
+ * `{ coerce: { foo: function (arg) { return modifiedArg } } }`.
87
+ */
88
+ coerce?: { [key: string]: (arg: any) => any } | undefined;
89
+ /** Indicate a key that should be used as a counter, e.g., `-vvv = {v: 3}`. */
90
+ count?: string[] | undefined;
91
+ /** Provide default values for keys: `{ default: { x: 33, y: 'hello world!' } }`. */
92
+ default?: { [key: string]: any } | undefined;
93
+ /** Environment variables (`process.env`) with the prefix provided should be parsed. */
94
+ envPrefix?: string | undefined;
95
+ /** Specify that a key requires n arguments: `{ narg: {x: 2} }`. */
96
+ narg?: { [key: string]: number } | undefined;
97
+ /** `path.normalize()` will be applied to values set to this key. */
98
+ normalize?: string[] | undefined;
99
+ /** Keys should be treated as strings (even if they resemble a number `-x 33`). */
100
+ string?: string[] | undefined;
101
+ /** Keys should be treated as numbers. */
102
+ number?: string[] | undefined;
103
+ }
104
+
105
+ interface Parser {
106
+ (argv: string | string[], opts?: Options): Arguments;
107
+ detailed(argv: string | string[], opts?: Options): DetailedArguments;
108
+ }
109
+ }
110
+
111
+ declare var yargsParser: yargsParser.Parser;
112
+ export = yargsParser;
@@ -0,0 +1 @@
1
+ (function(){var e={252:function(e,t,n){"use strict";var s=n(669);var r=n(747);var i=n(622);function camelCase(e){const t=e!==e.toLowerCase()&&e!==e.toUpperCase();if(!t){e=e.toLowerCase()}if(e.indexOf("-")===-1&&e.indexOf("_")===-1){return e}else{let t="";let n=false;const s=e.match(/^-+/);for(let r=s?s[0].length:0;r<e.length;r++){let s=e.charAt(r);if(n){n=false;s=s.toUpperCase()}if(r!==0&&(s==="-"||s==="_")){n=true}else if(s!=="-"&&s!=="_"){t+=s}}return t}}function decamelize(e,t){const n=e.toLowerCase();t=t||"-";let s="";for(let r=0;r<e.length;r++){const i=n.charAt(r);const a=e.charAt(r);if(i!==a&&r>0){s+=`${t}${n.charAt(r)}`}else{s+=a}}return s}function looksLikeNumber(e){if(e===null||e===undefined)return false;if(typeof e==="number")return true;if(/^0x[0-9a-f]+$/i.test(e))return true;if(/^0[^.]/.test(e))return false;return/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function tokenizeArgString(e){if(Array.isArray(e)){return e.map((e=>typeof e!=="string"?e+"":e))}e=e.trim();let t=0;let n=null;let s=null;let r=null;const i=[];for(let a=0;a<e.length;a++){n=s;s=e.charAt(a);if(s===" "&&!r){if(!(n===" ")){t++}continue}if(s===r){r=null}else if((s==="'"||s==='"')&&!r){r=s}if(!i[t])i[t]="";i[t]+=s}return i}var a;(function(e){e["BOOLEAN"]="boolean";e["STRING"]="string";e["NUMBER"]="number";e["ARRAY"]="array"})(a||(a={}));let o;class YargsParser{constructor(e){o=e}parse(e,t){const n=Object.assign({alias:undefined,array:undefined,boolean:undefined,config:undefined,configObjects:undefined,configuration:undefined,coerce:undefined,count:undefined,default:undefined,envPrefix:undefined,narg:undefined,normalize:undefined,string:undefined,number:undefined,__:undefined,key:undefined},t);const s=tokenizeArgString(e);const r=combineAliases(Object.assign(Object.create(null),n.alias));const i=Object.assign({"boolean-negation":true,"camel-case-expansion":true,"combine-arrays":false,"dot-notation":true,"duplicate-arguments-array":true,"flatten-duplicate-arrays":true,"greedy-arrays":true,"halt-at-non-option":false,"nargs-eats-options":false,"negation-prefix":"no-","parse-numbers":true,"parse-positional-numbers":true,"populate--":false,"set-placeholder-key":false,"short-option-groups":true,"strip-aliased":false,"strip-dashed":false,"unknown-options-as-args":false},n.configuration);const c=Object.assign(Object.create(null),n.default);const l=n.configObjects||[];const f=n.envPrefix;const u=i["populate--"];const p=u?"--":"_";const h=Object.create(null);const A=Object.create(null);const d=n.__||o.format;const g={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]};const y=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;const b=new RegExp("^--"+i["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach((function(e){const t=typeof e==="object"?e.key:e;const n=Object.keys(e).map((function(e){const t={boolean:"bools",string:"strings",number:"numbers"};return t[e]})).filter(Boolean).pop();if(n){g[n][t]=true}g.arrays[t]=true;g.keys.push(t)}));[].concat(n.boolean||[]).filter(Boolean).forEach((function(e){g.bools[e]=true;g.keys.push(e)}));[].concat(n.string||[]).filter(Boolean).forEach((function(e){g.strings[e]=true;g.keys.push(e)}));[].concat(n.number||[]).filter(Boolean).forEach((function(e){g.numbers[e]=true;g.keys.push(e)}));[].concat(n.count||[]).filter(Boolean).forEach((function(e){g.counts[e]=true;g.keys.push(e)}));[].concat(n.normalize||[]).filter(Boolean).forEach((function(e){g.normalize[e]=true;g.keys.push(e)}));if(typeof n.narg==="object"){Object.entries(n.narg).forEach((([e,t])=>{if(typeof t==="number"){g.nargs[e]=t;g.keys.push(e)}}))}if(typeof n.coerce==="object"){Object.entries(n.coerce).forEach((([e,t])=>{if(typeof t==="function"){g.coercions[e]=t;g.keys.push(e)}}))}if(typeof n.config!=="undefined"){if(Array.isArray(n.config)||typeof n.config==="string"){[].concat(n.config).filter(Boolean).forEach((function(e){g.configs[e]=true}))}else if(typeof n.config==="object"){Object.entries(n.config).forEach((([e,t])=>{if(typeof t==="boolean"||typeof t==="function"){g.configs[e]=t}}))}}extendAliases(n.key,r,n.default,g.arrays);Object.keys(c).forEach((function(e){(g.aliases[e]||[]).forEach((function(t){c[t]=c[e]}))}));let m=null;checkConfiguration();let k=[];const O=Object.assign(Object.create(null),{_:[]});const j={};for(let e=0;e<s.length;e++){const t=s[e];const n=t.replace(/^-{3,}/,"---");let r;let a;let o;let c;let l;let f;if(t!=="--"&&isUnknownOptionAsArg(t)){pushPositional(t)}else if(n.match(/---+(=|$)/)){pushPositional(t);continue}else if(t.match(/^--.+=/)||!i["short-option-groups"]&&t.match(/^-.+=/)){c=t.match(/^--?([^=]+)=([\s\S]*)$/);if(c!==null&&Array.isArray(c)&&c.length>=3){if(checkAllAliases(c[1],g.arrays)){e=eatArray(e,c[1],s,c[2])}else if(checkAllAliases(c[1],g.nargs)!==false){e=eatNargs(e,c[1],s,c[2])}else{setArg(c[1],c[2])}}}else if(t.match(b)&&i["boolean-negation"]){c=t.match(b);if(c!==null&&Array.isArray(c)&&c.length>=2){a=c[1];setArg(a,checkAllAliases(a,g.arrays)?[false]:false)}}else if(t.match(/^--.+/)||!i["short-option-groups"]&&t.match(/^-[^-]+/)){c=t.match(/^--?(.+)/);if(c!==null&&Array.isArray(c)&&c.length>=2){a=c[1];if(checkAllAliases(a,g.arrays)){e=eatArray(e,a,s)}else if(checkAllAliases(a,g.nargs)!==false){e=eatNargs(e,a,s)}else{l=s[e+1];if(l!==undefined&&(!l.match(/^-/)||l.match(y))&&!checkAllAliases(a,g.bools)&&!checkAllAliases(a,g.counts)){setArg(a,l);e++}else if(/^(true|false)$/.test(l)){setArg(a,l);e++}else{setArg(a,defaultValue(a))}}}}else if(t.match(/^-.\..+=/)){c=t.match(/^-([^=]+)=([\s\S]*)$/);if(c!==null&&Array.isArray(c)&&c.length>=3){setArg(c[1],c[2])}}else if(t.match(/^-.\..+/)&&!t.match(y)){l=s[e+1];c=t.match(/^-(.\..+)/);if(c!==null&&Array.isArray(c)&&c.length>=2){a=c[1];if(l!==undefined&&!l.match(/^-/)&&!checkAllAliases(a,g.bools)&&!checkAllAliases(a,g.counts)){setArg(a,l);e++}else{setArg(a,defaultValue(a))}}}else if(t.match(/^-[^-]+/)&&!t.match(y)){o=t.slice(1,-1).split("");r=false;for(let n=0;n<o.length;n++){l=t.slice(n+2);if(o[n+1]&&o[n+1]==="="){f=t.slice(n+3);a=o[n];if(checkAllAliases(a,g.arrays)){e=eatArray(e,a,s,f)}else if(checkAllAliases(a,g.nargs)!==false){e=eatNargs(e,a,s,f)}else{setArg(a,f)}r=true;break}if(l==="-"){setArg(o[n],l);continue}if(/[A-Za-z]/.test(o[n])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(l)&&checkAllAliases(l,g.bools)===false){setArg(o[n],l);r=true;break}if(o[n+1]&&o[n+1].match(/\W/)){setArg(o[n],l);r=true;break}else{setArg(o[n],defaultValue(o[n]))}}a=t.slice(-1)[0];if(!r&&a!=="-"){if(checkAllAliases(a,g.arrays)){e=eatArray(e,a,s)}else if(checkAllAliases(a,g.nargs)!==false){e=eatNargs(e,a,s)}else{l=s[e+1];if(l!==undefined&&(!/^(-|--)[^-]/.test(l)||l.match(y))&&!checkAllAliases(a,g.bools)&&!checkAllAliases(a,g.counts)){setArg(a,l);e++}else if(/^(true|false)$/.test(l)){setArg(a,l);e++}else{setArg(a,defaultValue(a))}}}}else if(t.match(/^-[0-9]$/)&&t.match(y)&&checkAllAliases(t.slice(1),g.bools)){a=t.slice(1);setArg(a,defaultValue(a))}else if(t==="--"){k=s.slice(e+1);break}else if(i["halt-at-non-option"]){k=s.slice(e);break}else{pushPositional(t)}}applyEnvVars(O,true);applyEnvVars(O,false);setConfig(O);setConfigObjects();applyDefaultsAndAliases(O,g.aliases,c,true);applyCoercions(O);if(i["set-placeholder-key"])setPlaceholderKeys(O);Object.keys(g.counts).forEach((function(e){if(!hasKey(O,e.split(".")))setArg(e,0)}));if(u&&k.length)O[p]=[];k.forEach((function(e){O[p].push(e)}));if(i["camel-case-expansion"]&&i["strip-dashed"]){Object.keys(O).filter((e=>e!=="--"&&e.includes("-"))).forEach((e=>{delete O[e]}))}if(i["strip-aliased"]){[].concat(...Object.keys(r).map((e=>r[e]))).forEach((e=>{if(i["camel-case-expansion"]&&e.includes("-")){delete O[e.split(".").map((e=>camelCase(e))).join(".")]}delete O[e]}))}function pushPositional(e){const t=maybeCoerceNumber("_",e);if(typeof t==="string"||typeof t==="number"){O._.push(t)}}function eatNargs(e,t,n,s){let r;let a=checkAllAliases(t,g.nargs);a=typeof a!=="number"||isNaN(a)?1:a;if(a===0){if(!isUndefined(s)){m=Error(d("Argument unexpected for: %s",t))}setArg(t,defaultValue(t));return e}let o=isUndefined(s)?0:1;if(i["nargs-eats-options"]){if(n.length-(e+1)+o<a){m=Error(d("Not enough arguments following: %s",t))}o=a}else{for(r=e+1;r<n.length;r++){if(!n[r].match(/^-[^0-9]/)||n[r].match(y)||isUnknownOptionAsArg(n[r]))o++;else break}if(o<a)m=Error(d("Not enough arguments following: %s",t))}let c=Math.min(o,a);if(!isUndefined(s)&&c>0){setArg(t,s);c--}for(r=e+1;r<c+e+1;r++){setArg(t,n[r])}return e+c}function eatArray(e,t,n,s){let r=[];let a=s||n[e+1];const o=checkAllAliases(t,g.nargs);if(checkAllAliases(t,g.bools)&&!/^(true|false)$/.test(a)){r.push(true)}else if(isUndefined(a)||isUndefined(s)&&/^-/.test(a)&&!y.test(a)&&!isUnknownOptionAsArg(a)){if(c[t]!==undefined){const e=c[t];r=Array.isArray(e)?e:[e]}}else{if(!isUndefined(s)){r.push(processValue(t,s))}for(let s=e+1;s<n.length;s++){if(!i["greedy-arrays"]&&r.length>0||o&&typeof o==="number"&&r.length>=o)break;a=n[s];if(/^-/.test(a)&&!y.test(a)&&!isUnknownOptionAsArg(a))break;e=s;r.push(processValue(t,a))}}if(typeof o==="number"&&(o&&r.length<o||isNaN(o)&&r.length===0)){m=Error(d("Not enough arguments following: %s",t))}setArg(t,r);return e}function setArg(e,t){if(/-/.test(e)&&i["camel-case-expansion"]){const t=e.split(".").map((function(e){return camelCase(e)})).join(".");addNewAlias(e,t)}const n=processValue(e,t);const s=e.split(".");setKey(O,s,n);if(g.aliases[e]){g.aliases[e].forEach((function(e){const t=e.split(".");setKey(O,t,n)}))}if(s.length>1&&i["dot-notation"]){(g.aliases[s[0]]||[]).forEach((function(t){let r=t.split(".");const i=[].concat(s);i.shift();r=r.concat(i);if(!(g.aliases[e]||[]).includes(r.join("."))){setKey(O,r,n)}}))}if(checkAllAliases(e,g.normalize)&&!checkAllAliases(e,g.arrays)){const n=[e].concat(g.aliases[e]||[]);n.forEach((function(e){Object.defineProperty(j,e,{enumerable:true,get(){return t},set(e){t=typeof e==="string"?o.normalize(e):e}})}))}}function addNewAlias(e,t){if(!(g.aliases[e]&&g.aliases[e].length)){g.aliases[e]=[t];h[t]=true}if(!(g.aliases[t]&&g.aliases[t].length)){addNewAlias(t,e)}}function processValue(e,t){if(typeof t==="string"&&(t[0]==="'"||t[0]==='"')&&t[t.length-1]===t[0]){t=t.substring(1,t.length-1)}if(checkAllAliases(e,g.bools)||checkAllAliases(e,g.counts)){if(typeof t==="string")t=t==="true"}let n=Array.isArray(t)?t.map((function(t){return maybeCoerceNumber(e,t)})):maybeCoerceNumber(e,t);if(checkAllAliases(e,g.counts)&&(isUndefined(n)||typeof n==="boolean")){n=increment()}if(checkAllAliases(e,g.normalize)&&checkAllAliases(e,g.arrays)){if(Array.isArray(t))n=t.map((e=>o.normalize(e)));else n=o.normalize(t)}return n}function maybeCoerceNumber(e,t){if(!i["parse-positional-numbers"]&&e==="_")return t;if(!checkAllAliases(e,g.strings)&&!checkAllAliases(e,g.bools)&&!Array.isArray(t)){const n=looksLikeNumber(t)&&i["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)));if(n||!isUndefined(t)&&checkAllAliases(e,g.numbers)){t=Number(t)}}return t}function setConfig(e){const t=Object.create(null);applyDefaultsAndAliases(t,g.aliases,c);Object.keys(g.configs).forEach((function(n){const s=e[n]||t[n];if(s){try{let e=null;const t=o.resolve(o.cwd(),s);const r=g.configs[n];if(typeof r==="function"){try{e=r(t)}catch(t){e=t}if(e instanceof Error){m=e;return}}else{e=o.require(t)}setConfigObject(e)}catch(t){if(t.name==="PermissionDenied")m=t;else if(e[n])m=Error(d("Invalid JSON config file: %s",s))}}}))}function setConfigObject(e,t){Object.keys(e).forEach((function(n){const s=e[n];const r=t?t+"."+n:n;if(typeof s==="object"&&s!==null&&!Array.isArray(s)&&i["dot-notation"]){setConfigObject(s,r)}else{if(!hasKey(O,r.split("."))||checkAllAliases(r,g.arrays)&&i["combine-arrays"]){setArg(r,s)}}}))}function setConfigObjects(){if(typeof l!=="undefined"){l.forEach((function(e){setConfigObject(e)}))}}function applyEnvVars(e,t){if(typeof f==="undefined")return;const n=typeof f==="string"?f:"";const s=o.env();Object.keys(s).forEach((function(r){if(n===""||r.lastIndexOf(n,0)===0){const i=r.split("__").map((function(e,t){if(t===0){e=e.substring(n.length)}return camelCase(e)}));if((t&&g.configs[i.join(".")]||!t)&&!hasKey(e,i)){setArg(i.join("."),s[r])}}}))}function applyCoercions(e){let t;const n=new Set;Object.keys(e).forEach((function(s){if(!n.has(s)){t=checkAllAliases(s,g.coercions);if(typeof t==="function"){try{const r=maybeCoerceNumber(s,t(e[s]));[].concat(g.aliases[s]||[],s).forEach((t=>{n.add(t);e[t]=r}))}catch(e){m=e}}}}))}function setPlaceholderKeys(e){g.keys.forEach((t=>{if(~t.indexOf("."))return;if(typeof e[t]==="undefined")e[t]=undefined}));return e}function applyDefaultsAndAliases(e,t,n,s=false){Object.keys(n).forEach((function(r){if(!hasKey(e,r.split("."))){setKey(e,r.split("."),n[r]);if(s)A[r]=true;(t[r]||[]).forEach((function(t){if(hasKey(e,t.split(".")))return;setKey(e,t.split("."),n[r])}))}}))}function hasKey(e,t){let n=e;if(!i["dot-notation"])t=[t.join(".")];t.slice(0,-1).forEach((function(e){n=n[e]||{}}));const s=t[t.length-1];if(typeof n!=="object")return false;else return s in n}function setKey(e,t,n){let s=e;if(!i["dot-notation"])t=[t.join(".")];t.slice(0,-1).forEach((function(e){e=sanitizeKey(e);if(typeof s==="object"&&s[e]===undefined){s[e]={}}if(typeof s[e]!=="object"||Array.isArray(s[e])){if(Array.isArray(s[e])){s[e].push({})}else{s[e]=[s[e],{}]}s=s[e][s[e].length-1]}else{s=s[e]}}));const r=sanitizeKey(t[t.length-1]);const a=checkAllAliases(t.join("."),g.arrays);const o=Array.isArray(n);let c=i["duplicate-arguments-array"];if(!c&&checkAllAliases(r,g.nargs)){c=true;if(!isUndefined(s[r])&&g.nargs[r]===1||Array.isArray(s[r])&&s[r].length===g.nargs[r]){s[r]=undefined}}if(n===increment()){s[r]=increment(s[r])}else if(Array.isArray(s[r])){if(c&&a&&o){s[r]=i["flatten-duplicate-arrays"]?s[r].concat(n):(Array.isArray(s[r][0])?s[r]:[s[r]]).concat([n])}else if(!c&&Boolean(a)===Boolean(o)){s[r]=n}else{s[r]=s[r].concat([n])}}else if(s[r]===undefined&&a){s[r]=o?n:[n]}else if(c&&!(s[r]===undefined||checkAllAliases(r,g.counts)||checkAllAliases(r,g.bools))){s[r]=[s[r],n]}else{s[r]=n}}function extendAliases(...e){e.forEach((function(e){Object.keys(e||{}).forEach((function(e){if(g.aliases[e])return;g.aliases[e]=[].concat(r[e]||[]);g.aliases[e].concat(e).forEach((function(t){if(/-/.test(t)&&i["camel-case-expansion"]){const n=camelCase(t);if(n!==e&&g.aliases[e].indexOf(n)===-1){g.aliases[e].push(n);h[n]=true}}}));g.aliases[e].concat(e).forEach((function(t){if(t.length>1&&/[A-Z]/.test(t)&&i["camel-case-expansion"]){const n=decamelize(t,"-");if(n!==e&&g.aliases[e].indexOf(n)===-1){g.aliases[e].push(n);h[n]=true}}}));g.aliases[e].forEach((function(t){g.aliases[t]=[e].concat(g.aliases[e].filter((function(e){return t!==e})))}))}))}))}function checkAllAliases(e,t){const n=[].concat(g.aliases[e]||[],e);const s=Object.keys(t);const r=n.find((e=>s.includes(e)));return r?t[r]:false}function hasAnyFlag(e){const t=Object.keys(g);const n=[].concat(t.map((e=>g[e])));return n.some((function(t){return Array.isArray(t)?t.includes(e):t[e]}))}function hasFlagsMatching(e,...t){const n=[].concat(...t);return n.some((function(t){const n=e.match(t);return n&&hasAnyFlag(n[1])}))}function hasAllShortFlags(e){if(e.match(y)||!e.match(/^-[^-]+/)){return false}let t=true;let n;const s=e.slice(1).split("");for(let r=0;r<s.length;r++){n=e.slice(r+2);if(!hasAnyFlag(s[r])){t=false;break}if(s[r+1]&&s[r+1]==="="||n==="-"||/[A-Za-z]/.test(s[r])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(n)||s[r+1]&&s[r+1].match(/\W/)){break}}return t}function isUnknownOptionAsArg(e){return i["unknown-options-as-args"]&&isUnknownOption(e)}function isUnknownOption(e){e=e.replace(/^-{3,}/,"--");if(e.match(y)){return false}if(hasAllShortFlags(e)){return false}const t=/^-+([^=]+?)=[\s\S]*$/;const n=/^-+([^=]+?)$/;const s=/^-+([^=]+?)-$/;const r=/^-+([^=]+?\d+)$/;const i=/^-+([^=]+?)\W+.*$/;return!hasFlagsMatching(e,t,b,n,s,r,i)}function defaultValue(e){if(!checkAllAliases(e,g.bools)&&!checkAllAliases(e,g.counts)&&`${e}`in c){return c[e]}else{return defaultForType(guessType(e))}}function defaultForType(e){const t={[a.BOOLEAN]:true,[a.STRING]:"",[a.NUMBER]:undefined,[a.ARRAY]:[]};return t[e]}function guessType(e){let t=a.BOOLEAN;if(checkAllAliases(e,g.strings))t=a.STRING;else if(checkAllAliases(e,g.numbers))t=a.NUMBER;else if(checkAllAliases(e,g.bools))t=a.BOOLEAN;else if(checkAllAliases(e,g.arrays))t=a.ARRAY;return t}function isUndefined(e){return e===undefined}function checkConfiguration(){Object.keys(g.counts).find((e=>{if(checkAllAliases(e,g.arrays)){m=Error(d("Invalid configuration: %s, opts.count excludes opts.array.",e));return true}else if(checkAllAliases(e,g.nargs)){m=Error(d("Invalid configuration: %s, opts.count excludes opts.narg.",e));return true}return false}))}return{aliases:Object.assign({},g.aliases),argv:Object.assign(j,O),configuration:i,defaulted:Object.assign({},A),error:m,newAliases:Object.assign({},h)}}}function combineAliases(e){const t=[];const n=Object.create(null);let s=true;Object.keys(e).forEach((function(n){t.push([].concat(e[n],n))}));while(s){s=false;for(let e=0;e<t.length;e++){for(let n=e+1;n<t.length;n++){const r=t[e].filter((function(e){return t[n].indexOf(e)!==-1}));if(r.length){t[e]=t[e].concat(t[n]);t.splice(n,1);s=true;break}}}}t.forEach((function(e){e=e.filter((function(e,t,n){return n.indexOf(e)===t}));const t=e.pop();if(t!==undefined&&typeof t==="string"){n[t]=e}}));return n}function increment(e){return e!==undefined?e+1:1}function sanitizeKey(e){if(e==="__proto__")return"___proto___";return e}const c=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):10;if(process&&process.version){const e=Number(process.version.match(/v([^.]+)/)[1]);if(e<c){throw Error(`yargs parser supports a minimum Node.js version of ${c}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)}}const l=process?process.env:{};const f=new YargsParser({cwd:process.cwd,env:()=>l,format:s.format,normalize:i.normalize,resolve:i.resolve,require:e=>{if(true){return n(148)(e)}else{}}});const u=function Parser(e,t){const n=f.parse(e.slice(),t);return n.argv};u.detailed=function(e,t){return f.parse(e.slice(),t)};u.camelCase=camelCase;u.decamelize=decamelize;u.looksLikeNumber=looksLikeNumber;e.exports=u},148:function(e){function webpackEmptyContext(e){var t=new Error("Cannot find module '"+e+"'");t.code="MODULE_NOT_FOUND";throw t}webpackEmptyContext.keys=function(){return[]};webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=148;e.exports=webpackEmptyContext},747:function(e){"use strict";e.exports=require("fs")},622:function(e){"use strict";e.exports=require("path")},669:function(e){"use strict";e.exports=require("util")}};var t={};function __nccwpck_require__(n){var s=t[n];if(s!==undefined){return s.exports}var r=t[n]={exports:{}};var i=true;try{e[n](r,r.exports,__nccwpck_require__);i=false}finally{if(i)delete t[n]}return r.exports}!function(){__nccwpck_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(252);module.exports=n})();
@@ -0,0 +1 @@
1
+ {"name":"yargs-parser","author":"Ben Coe <ben@npmjs.com>","license":"ISC"}
@@ -0,0 +1,18 @@
1
+ import prompts from '../../compiled/prompts';
2
+ import Generator from '../Generator/Generator';
3
+ interface IOpts {
4
+ path: string;
5
+ target: string;
6
+ data?: any;
7
+ questions?: prompts.PromptObject[];
8
+ }
9
+ export default class BaseGenerator extends Generator {
10
+ path: string;
11
+ target: string;
12
+ data: any;
13
+ questions: prompts.PromptObject[];
14
+ constructor({ path, target, data, questions }: IOpts);
15
+ prompting(): prompts.PromptObject<string>[];
16
+ writing(): Promise<void>;
17
+ }
18
+ export {};
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const fs_1 = require("fs");
16
+ const path_1 = require("path");
17
+ const fs_extra_1 = __importDefault(require("../../compiled/fs-extra"));
18
+ const Generator_1 = __importDefault(require("../Generator/Generator"));
19
+ class BaseGenerator extends Generator_1.default {
20
+ constructor({ path, target, data, questions }) {
21
+ super({ cwd: target, args: data });
22
+ this.path = path;
23
+ this.target = target;
24
+ this.data = data;
25
+ this.questions = questions || [];
26
+ }
27
+ prompting() {
28
+ return this.questions;
29
+ }
30
+ writing() {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const context = Object.assign(Object.assign({}, this.data), this.prompts);
33
+ if ((0, fs_1.statSync)(this.path).isDirectory()) {
34
+ this.copyDirectory({
35
+ context,
36
+ path: this.path,
37
+ target: this.target,
38
+ });
39
+ }
40
+ else {
41
+ const file = (0, path_1.basename)(this.path.replace(/\.tpl$/, ''));
42
+ if (this.path.endsWith('.tpl')) {
43
+ this.copyTpl({
44
+ templatePath: this.path,
45
+ target: (0, path_1.join)(this.target, file),
46
+ context,
47
+ });
48
+ }
49
+ else {
50
+ const absTarget = (0, path_1.join)(this.target, file);
51
+ fs_extra_1.default.mkdirpSync((0, path_1.dirname)(absTarget));
52
+ (0, fs_1.copyFileSync)(this.path, absTarget);
53
+ }
54
+ }
55
+ });
56
+ }
57
+ }
58
+ exports.default = BaseGenerator;
@@ -0,0 +1,8 @@
1
+ import prompts from '../../compiled/prompts';
2
+ declare const generateFile: ({ path, target, data, questions, }: {
3
+ path: string;
4
+ target: string;
5
+ data?: any;
6
+ questions?: prompts.PromptObject<string>[] | undefined;
7
+ }) => Promise<void>;
8
+ export default generateFile;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const BaseGenerator_1 = __importDefault(require("./BaseGenerator"));
16
+ const generateFile = ({ path, target, data, questions, }) => __awaiter(void 0, void 0, void 0, function* () {
17
+ const generator = new BaseGenerator_1.default({
18
+ path,
19
+ target,
20
+ data,
21
+ questions,
22
+ });
23
+ yield generator.run();
24
+ });
25
+ exports.default = generateFile;
@@ -1,11 +1,11 @@
1
- import { yargs } from '../index';
1
+ import yParser from '../../compiled/yargs-parser';
2
2
  interface IOpts {
3
3
  cwd: string;
4
- args: yargs.Arguments;
4
+ args: yParser.Arguments;
5
5
  }
6
6
  declare class Generator {
7
7
  cwd: string;
8
- args: yargs.Arguments;
8
+ args: yParser.Arguments;
9
9
  prompts: any;
10
10
  constructor({ cwd, args }: IOpts);
11
11
  run(): Promise<void>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const fs_1 = require("fs");
16
+ const path_1 = require("path");
17
+ const chalk_1 = __importDefault(require("../../compiled/chalk"));
18
+ const fs_extra_1 = __importDefault(require("../../compiled/fs-extra"));
19
+ const glob_1 = __importDefault(require("../../compiled/glob"));
20
+ const mustache_1 = __importDefault(require("../../compiled/mustache"));
21
+ const prompts_1 = __importDefault(require("../../compiled/prompts"));
22
+ class Generator {
23
+ constructor({ cwd, args }) {
24
+ this.cwd = cwd;
25
+ this.args = args;
26
+ this.prompts = {};
27
+ }
28
+ run() {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const questions = this.prompting();
31
+ this.prompts = yield (0, prompts_1.default)(questions);
32
+ yield this.writing();
33
+ });
34
+ }
35
+ prompting() {
36
+ return [];
37
+ }
38
+ writing() {
39
+ return __awaiter(this, void 0, void 0, function* () { });
40
+ }
41
+ copyTpl(opts) {
42
+ const tpl = (0, fs_1.readFileSync)(opts.templatePath, 'utf-8');
43
+ const content = mustache_1.default.render(tpl, opts.context);
44
+ fs_extra_1.default.mkdirpSync((0, path_1.dirname)(opts.target));
45
+ console.log(`${chalk_1.default.green('Write:')} ${(0, path_1.relative)(this.cwd, opts.target)}`);
46
+ (0, fs_1.writeFileSync)(opts.target, content, 'utf-8');
47
+ }
48
+ copyDirectory(opts) {
49
+ const files = glob_1.default.sync('**/*', {
50
+ cwd: opts.path,
51
+ dot: true,
52
+ ignore: ['**/node_modules/**'],
53
+ });
54
+ files.forEach((file) => {
55
+ const absFile = (0, path_1.join)(opts.path, file);
56
+ if ((0, fs_1.statSync)(absFile).isDirectory())
57
+ return;
58
+ if (file.endsWith('.tpl')) {
59
+ this.copyTpl({
60
+ templatePath: absFile,
61
+ target: (0, path_1.join)(opts.target, file.replace(/\.tpl$/, '')),
62
+ context: opts.context,
63
+ });
64
+ }
65
+ else {
66
+ console.log(`${chalk_1.default.green('Copy: ')} ${file}`);
67
+ const absTarget = (0, path_1.join)(opts.target, file);
68
+ fs_extra_1.default.mkdirpSync((0, path_1.dirname)(absTarget));
69
+ (0, fs_1.copyFileSync)(absFile, absTarget);
70
+ }
71
+ });
72
+ }
73
+ }
74
+ exports.default = Generator;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * ref:
3
+ * 1. https://rushstack.io/pages/api/node-core-library.import.lazy/
4
+ * 2. https://github.com/microsoft/rushstack/blob/90301e9/libraries/node-core-library/src/Import.ts#L175
5
+ */
6
+ export declare function importLazy(moduleName: string, requireFn?: (id: string) => unknown): any;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * ref:
4
+ * 1. https://rushstack.io/pages/api/node-core-library.import.lazy/
5
+ * 2. https://github.com/microsoft/rushstack/blob/90301e9/libraries/node-core-library/src/Import.ts#L175
6
+ */
7
+ var __importDefault = (this && this.__importDefault) || function (mod) {
8
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9
+ };
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.importLazy = void 0;
12
+ const import_lazy_1 = __importDefault(require("../compiled/import-lazy"));
13
+ function importLazy(moduleName, requireFn) {
14
+ const importLazyLocal = (0, import_lazy_1.default)(requireFn || require);
15
+ return importLazyLocal(moduleName);
16
+ }
17
+ exports.importLazy = importLazy;
@@ -0,0 +1,33 @@
1
+ import * as chokidar from 'chokidar';
2
+ import * as clipboardy from 'clipboardy';
3
+ import address from '../compiled/address';
4
+ import axios from '../compiled/axios';
5
+ import chalk from '../compiled/chalk';
6
+ import cheerio from '../compiled/cheerio';
7
+ import crossSpawn from '../compiled/cross-spawn';
8
+ import debug from '../compiled/debug';
9
+ import deepmerge from '../compiled/deepmerge';
10
+ import fsExtra from '../compiled/fs-extra';
11
+ import glob from '../compiled/glob';
12
+ import lodash from '../compiled/lodash';
13
+ import Mustache from '../compiled/mustache';
14
+ import pkgUp from '../compiled/pkg-up';
15
+ import portfinder from '../compiled/portfinder';
16
+ import prompts from '../compiled/prompts';
17
+ import resolve from '../compiled/resolve';
18
+ import rimraf from '../compiled/rimraf';
19
+ import semver from '../compiled/semver';
20
+ import stripAnsi from '../compiled/strip-ansi';
21
+ import yParser from '../compiled/yargs-parser';
22
+ import BaseGenerator from './BaseGenerator/BaseGenerator';
23
+ import generateFile from './BaseGenerator/generateFile';
24
+ import Generator from './Generator/Generator';
25
+ import installDeps from './installDeps';
26
+ import * as logger from './logger';
27
+ import updatePackageJSON from './updatePackageJSON';
28
+ export * from './importLazy';
29
+ export * from './npmClient';
30
+ export * from './randomColor/randomColor';
31
+ export * as register from './register';
32
+ export * from './winPath';
33
+ export { address, axios, chalk, cheerio, chokidar, clipboardy, crossSpawn, debug, deepmerge, fsExtra, glob, Generator, BaseGenerator, generateFile, installDeps, lodash, logger, Mustache, pkgUp, portfinder, prompts, resolve, rimraf, semver, stripAnsi, updatePackageJSON, yParser, };
package/dist/index.js ADDED
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.yParser = exports.updatePackageJSON = exports.stripAnsi = exports.semver = exports.rimraf = exports.resolve = exports.prompts = exports.portfinder = exports.pkgUp = exports.Mustache = exports.logger = exports.lodash = exports.installDeps = exports.generateFile = exports.BaseGenerator = exports.Generator = exports.glob = exports.fsExtra = exports.deepmerge = exports.debug = exports.crossSpawn = exports.clipboardy = exports.chokidar = exports.cheerio = exports.chalk = exports.axios = exports.address = exports.register = void 0;
29
+ const chokidar = __importStar(require("chokidar"));
30
+ exports.chokidar = chokidar;
31
+ const clipboardy = __importStar(require("clipboardy"));
32
+ exports.clipboardy = clipboardy;
33
+ const address_1 = __importDefault(require("../compiled/address"));
34
+ exports.address = address_1.default;
35
+ const axios_1 = __importDefault(require("../compiled/axios"));
36
+ exports.axios = axios_1.default;
37
+ const chalk_1 = __importDefault(require("../compiled/chalk"));
38
+ exports.chalk = chalk_1.default;
39
+ const cheerio_1 = __importDefault(require("../compiled/cheerio"));
40
+ exports.cheerio = cheerio_1.default;
41
+ const cross_spawn_1 = __importDefault(require("../compiled/cross-spawn"));
42
+ exports.crossSpawn = cross_spawn_1.default;
43
+ const debug_1 = __importDefault(require("../compiled/debug"));
44
+ exports.debug = debug_1.default;
45
+ const deepmerge_1 = __importDefault(require("../compiled/deepmerge"));
46
+ exports.deepmerge = deepmerge_1.default;
47
+ const fs_extra_1 = __importDefault(require("../compiled/fs-extra"));
48
+ exports.fsExtra = fs_extra_1.default;
49
+ const glob_1 = __importDefault(require("../compiled/glob"));
50
+ exports.glob = glob_1.default;
51
+ // import globby from '../compiled/globby';
52
+ const lodash_1 = __importDefault(require("../compiled/lodash"));
53
+ exports.lodash = lodash_1.default;
54
+ const mustache_1 = __importDefault(require("../compiled/mustache"));
55
+ exports.Mustache = mustache_1.default;
56
+ const pkg_up_1 = __importDefault(require("../compiled/pkg-up"));
57
+ exports.pkgUp = pkg_up_1.default;
58
+ const portfinder_1 = __importDefault(require("../compiled/portfinder"));
59
+ exports.portfinder = portfinder_1.default;
60
+ const prompts_1 = __importDefault(require("../compiled/prompts"));
61
+ exports.prompts = prompts_1.default;
62
+ const resolve_1 = __importDefault(require("../compiled/resolve"));
63
+ exports.resolve = resolve_1.default;
64
+ const rimraf_1 = __importDefault(require("../compiled/rimraf"));
65
+ exports.rimraf = rimraf_1.default;
66
+ const semver_1 = __importDefault(require("../compiled/semver"));
67
+ exports.semver = semver_1.default;
68
+ const strip_ansi_1 = __importDefault(require("../compiled/strip-ansi"));
69
+ exports.stripAnsi = strip_ansi_1.default;
70
+ const yargs_parser_1 = __importDefault(require("../compiled/yargs-parser"));
71
+ exports.yParser = yargs_parser_1.default;
72
+ const BaseGenerator_1 = __importDefault(require("./BaseGenerator/BaseGenerator"));
73
+ exports.BaseGenerator = BaseGenerator_1.default;
74
+ const generateFile_1 = __importDefault(require("./BaseGenerator/generateFile"));
75
+ exports.generateFile = generateFile_1.default;
76
+ const Generator_1 = __importDefault(require("./Generator/Generator"));
77
+ exports.Generator = Generator_1.default;
78
+ const installDeps_1 = __importDefault(require("./installDeps"));
79
+ exports.installDeps = installDeps_1.default;
80
+ const logger = __importStar(require("./logger"));
81
+ exports.logger = logger;
82
+ const updatePackageJSON_1 = __importDefault(require("./updatePackageJSON"));
83
+ exports.updatePackageJSON = updatePackageJSON_1.default;
84
+ __exportStar(require("./importLazy"), exports);
85
+ __exportStar(require("./npmClient"), exports);
86
+ __exportStar(require("./randomColor/randomColor"), exports);
87
+ exports.register = __importStar(require("./register"));
88
+ __exportStar(require("./winPath"), exports);
@@ -0,0 +1,9 @@
1
+ interface IInstallDeps {
2
+ devDependencies?: string[];
3
+ dependencies?: string[];
4
+ }
5
+ declare function installDeps({ opts, cwd, }: {
6
+ opts: IInstallDeps;
7
+ cwd?: string;
8
+ }): void;
9
+ export default installDeps;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = require("fs");
7
+ const path_1 = require("path");
8
+ const execa_1 = __importDefault(require("../compiled/execa"));
9
+ function installDeps({ opts, cwd = process.cwd(), }) {
10
+ const { dependencies, devDependencies } = opts;
11
+ const useYarn = (0, fs_1.existsSync)((0, path_1.join)(cwd, 'yarn.lock')) ||
12
+ (0, fs_1.existsSync)((0, path_1.join)(process.cwd(), 'yarn.lock'));
13
+ const usePnpm = (0, fs_1.existsSync)((0, path_1.join)(cwd, 'pnpm-workspace.yaml')) ||
14
+ (0, fs_1.existsSync)((0, path_1.join)(process.cwd(), 'pnpm-workspace.yaml'));
15
+ const runNpm = useYarn ? 'yarn' : usePnpm ? 'pnpm' : 'npm';
16
+ const install = useYarn || usePnpm ? 'add' : 'install';
17
+ const devTag = useYarn || usePnpm ? '--D' : '--save-dev';
18
+ const installDependencies = (deps, npmStr, insStr, devStr) => {
19
+ console.log(`${npmStr} install dependencies packages:${deps.join(' ')}`);
20
+ execa_1.default.commandSync([npmStr, insStr, devStr]
21
+ .concat(deps)
22
+ .filter((n) => n)
23
+ .join(' '), {
24
+ encoding: 'utf8',
25
+ cwd,
26
+ env: Object.assign({}, process.env),
27
+ stderr: 'pipe',
28
+ stdout: 'pipe',
29
+ });
30
+ console.log(`install dependencies packages success`);
31
+ };
32
+ if (dependencies) {
33
+ installDependencies(dependencies, runNpm, install);
34
+ }
35
+ if (devDependencies) {
36
+ installDependencies(devDependencies, runNpm, install, devTag);
37
+ }
38
+ }
39
+ exports.default = installDeps;
@@ -0,0 +1,14 @@
1
+ export declare const prefixes: {
2
+ wait: string;
3
+ error: string;
4
+ warn: string;
5
+ ready: string;
6
+ info: string;
7
+ event: string;
8
+ };
9
+ export declare function wait(...message: string[]): void;
10
+ export declare function error(...message: string[]): void;
11
+ export declare function warn(...message: string[]): void;
12
+ export declare function ready(...message: string[]): void;
13
+ export declare function info(...message: string[]): void;
14
+ export declare function event(...message: string[]): void;