@modern-js/utils 1.3.4 → 1.3.7-alpha.prebundle.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (355) hide show
  1. package/.eslintrc.js +9 -0
  2. package/CHANGELOG.md +18 -0
  3. package/compiled/browserslist/index.d.ts +178 -0
  4. package/compiled/browserslist/index.js +1 -0
  5. package/compiled/browserslist/license +20 -0
  6. package/compiled/browserslist/package.json +1 -0
  7. package/compiled/chalk/index.d.ts +415 -0
  8. package/compiled/chalk/index.js +1 -0
  9. package/compiled/chalk/license +9 -0
  10. package/compiled/chalk/package.json +1 -0
  11. package/compiled/chokidar/anymatch/index.d.ts +19 -0
  12. package/compiled/chokidar/fsevents.node +0 -0
  13. package/compiled/chokidar/index.js +40 -0
  14. package/compiled/chokidar/license +21 -0
  15. package/compiled/chokidar/package.json +1 -0
  16. package/compiled/chokidar/types/index.d.ts +188 -0
  17. package/compiled/commander/index.js +1 -0
  18. package/compiled/commander/license +22 -0
  19. package/compiled/commander/package.json +1 -0
  20. package/compiled/commander/typings/index.d.ts +774 -0
  21. package/compiled/debug/index.d.ts +54 -0
  22. package/compiled/debug/index.js +1 -0
  23. package/compiled/debug/license +20 -0
  24. package/compiled/debug/ms/index.d.ts +25 -0
  25. package/compiled/debug/package.json +1 -0
  26. package/compiled/execa/index.d.ts +564 -0
  27. package/compiled/execa/index.js +1 -0
  28. package/compiled/execa/license +9 -0
  29. package/compiled/execa/package.json +1 -0
  30. package/compiled/filesize/filesize.d.ts +131 -0
  31. package/compiled/filesize/index.js +9 -0
  32. package/compiled/filesize/license +28 -0
  33. package/compiled/filesize/package.json +1 -0
  34. package/compiled/fs-extra/index.d.ts +563 -0
  35. package/compiled/fs-extra/index.js +1 -0
  36. package/compiled/fs-extra/license +15 -0
  37. package/compiled/fs-extra/package.json +1 -0
  38. package/compiled/glob/index.d.ts +91 -0
  39. package/compiled/glob/index.js +1 -0
  40. package/compiled/glob/license +21 -0
  41. package/compiled/glob/minimatch/index.d.ts +204 -0
  42. package/compiled/glob/package.json +1 -0
  43. package/compiled/gzip-size/index.d.ts +96 -0
  44. package/compiled/gzip-size/index.js +1 -0
  45. package/compiled/gzip-size/license +9 -0
  46. package/compiled/gzip-size/package.json +1 -0
  47. package/compiled/import-lazy/index.d.ts +26 -0
  48. package/compiled/import-lazy/index.js +1 -0
  49. package/compiled/import-lazy/license +9 -0
  50. package/compiled/import-lazy/package.json +1 -0
  51. package/compiled/js-yaml/index.d.ts +154 -0
  52. package/compiled/js-yaml/index.js +1 -0
  53. package/compiled/js-yaml/license +21 -0
  54. package/compiled/js-yaml/package.json +1 -0
  55. package/compiled/lodash/common/array.d.ts +2126 -0
  56. package/compiled/lodash/common/collection.d.ts +1930 -0
  57. package/compiled/lodash/common/common.d.ts +280 -0
  58. package/compiled/lodash/common/date.d.ts +23 -0
  59. package/compiled/lodash/common/function.d.ts +1446 -0
  60. package/compiled/lodash/common/lang.d.ts +1693 -0
  61. package/compiled/lodash/common/math.d.ts +405 -0
  62. package/compiled/lodash/common/number.d.ts +131 -0
  63. package/compiled/lodash/common/object.d.ts +2519 -0
  64. package/compiled/lodash/common/seq.d.ts +210 -0
  65. package/compiled/lodash/common/string.d.ts +788 -0
  66. package/compiled/lodash/common/util.d.ts +1220 -0
  67. package/compiled/lodash/index.d.ts +46 -0
  68. package/compiled/lodash/index.js +9 -0
  69. package/compiled/lodash/license +47 -0
  70. package/compiled/lodash/package.json +1 -0
  71. package/compiled/pkg-up/index.d.ts +48 -0
  72. package/compiled/pkg-up/index.js +1 -0
  73. package/compiled/pkg-up/license +9 -0
  74. package/compiled/pkg-up/package.json +1 -0
  75. package/compiled/recursive-readdir/index.d.ts +21 -0
  76. package/compiled/recursive-readdir/index.js +1 -0
  77. package/compiled/recursive-readdir/license +21 -0
  78. package/compiled/recursive-readdir/package.json +1 -0
  79. package/compiled/signale/index.d.ts +162 -0
  80. package/compiled/signale/index.js +1 -0
  81. package/compiled/signale/package.json +1 -0
  82. package/compiled/strip-ansi/index.d.ts +17 -0
  83. package/compiled/strip-ansi/index.js +1 -0
  84. package/compiled/strip-ansi/license +9 -0
  85. package/compiled/strip-ansi/package.json +1 -0
  86. package/compiled/upath/index.js +1 -0
  87. package/compiled/upath/license +22 -0
  88. package/compiled/upath/package.json +1 -0
  89. package/compiled/upath/upath.d.ts +241 -0
  90. package/dist/{types/FileSizeReporter.d.ts → FileSizeReporter.d.ts} +5 -5
  91. package/dist/FileSizeReporter.js +151 -0
  92. package/dist/{types/alias.d.ts → alias.d.ts} +12 -14
  93. package/dist/alias.js +62 -0
  94. package/dist/applyOptionsChain.d.ts +6 -0
  95. package/dist/applyOptionsChain.js +30 -0
  96. package/dist/clearConsole.d.ts +1 -0
  97. package/dist/clearConsole.js +9 -0
  98. package/dist/{types/compatRequire.d.ts → compatRequire.d.ts} +1 -1
  99. package/dist/compatRequire.js +28 -0
  100. package/dist/compiled/upath/index.d.ts +225 -0
  101. package/dist/compiled/upath/index.js +1 -0
  102. package/dist/compiled.d.ts +21 -0
  103. package/dist/compiled.js +33 -0
  104. package/dist/constants.d.ts +209 -0
  105. package/dist/constants.js +264 -0
  106. package/dist/{js/modern/debug.js → debug.d.ts} +1 -3
  107. package/dist/debug.js +11 -0
  108. package/dist/emptyDir.d.ts +1 -0
  109. package/dist/emptyDir.js +19 -0
  110. package/dist/{types/ensureAbsolutePath.d.ts → ensureAbsolutePath.d.ts} +1 -1
  111. package/dist/ensureAbsolutePath.js +15 -0
  112. package/dist/{types/findExists.d.ts → findExists.d.ts} +1 -1
  113. package/dist/findExists.js +21 -0
  114. package/dist/{types/format.d.ts → format.d.ts} +5 -5
  115. package/dist/format.js +113 -0
  116. package/dist/{types/generateMetaTags.d.ts → generateMetaTags.d.ts} +3 -3
  117. package/dist/generateMetaTags.js +48 -0
  118. package/dist/{types/getBrowserslist.d.ts → getBrowserslist.d.ts} +1 -1
  119. package/dist/getBrowserslist.js +7 -0
  120. package/dist/{types/getCacheIdentifier.d.ts → getCacheIdentifier.d.ts} +3 -3
  121. package/dist/getCacheIdentifier.js +24 -0
  122. package/dist/{types/getEntryOptions.d.ts → getEntryOptions.d.ts} +1 -1
  123. package/dist/getEntryOptions.js +26 -0
  124. package/dist/{types/getPackageManager.d.ts → getPackageManager.d.ts} +1 -1
  125. package/dist/getPackageManager.js +47 -0
  126. package/dist/{types/getPort.d.ts → getPort.d.ts} +1 -1
  127. package/dist/getPort.js +62 -0
  128. package/dist/{types/import.d.ts → import.d.ts} +2 -2
  129. package/dist/import.js +10 -0
  130. package/dist/index.d.ts +31 -0
  131. package/dist/index.js +43 -0
  132. package/dist/{types/is → is}/index.d.ts +1 -4
  133. package/dist/is/index.js +82 -0
  134. package/dist/{types/is → is}/node-env.d.ts +1 -1
  135. package/dist/is/node-env.js +12 -0
  136. package/dist/is/platform.d.ts +2 -0
  137. package/dist/is/platform.js +10 -0
  138. package/dist/is/type.d.ts +8 -0
  139. package/dist/is/type.js +38 -0
  140. package/dist/logger.d.ts +63 -0
  141. package/dist/logger.js +128 -0
  142. package/dist/{types/monorepo.d.ts → monorepo.d.ts} +3 -3
  143. package/dist/monorepo.js +80 -0
  144. package/dist/{types/nodeEnv.d.ts → nodeEnv.d.ts} +1 -1
  145. package/dist/nodeEnv.js +49 -0
  146. package/dist/{types/path.d.ts → path.d.ts} +1 -1
  147. package/dist/path.js +14 -0
  148. package/dist/{types/pkgUp.d.ts → pkgUp.d.ts} +1 -1
  149. package/dist/pkgUp.js +8 -0
  150. package/dist/{types/prettyInstructions.d.ts → prettyInstructions.d.ts} +2 -2
  151. package/dist/prettyInstructions.js +64 -0
  152. package/dist/{types/printBuildError.d.ts → printBuildError.d.ts} +1 -1
  153. package/dist/printBuildError.js +43 -0
  154. package/dist/{types/readTsConfig.d.ts → readTsConfig.d.ts} +1 -1
  155. package/dist/readTsConfig.js +19 -0
  156. package/dist/{types/removeSlash.d.ts → removeSlash.d.ts} +1 -1
  157. package/dist/removeSlash.js +9 -0
  158. package/dist/{types/runtimeExports.d.ts → runtimeExports.d.ts} +3 -3
  159. package/dist/runtimeExports.js +53 -0
  160. package/dist/src/FileSizeReporter.d.ts +16 -0
  161. package/dist/src/FileSizeReporter.js +152 -0
  162. package/dist/src/alias.d.ts +21 -0
  163. package/dist/src/alias.js +62 -0
  164. package/dist/src/applyOptionsChain.d.ts +6 -0
  165. package/dist/src/applyOptionsChain.js +30 -0
  166. package/dist/src/clearConsole.d.ts +1 -0
  167. package/dist/src/clearConsole.js +9 -0
  168. package/dist/src/compatRequire.d.ts +8 -0
  169. package/dist/src/compatRequire.js +28 -0
  170. package/dist/src/compiled.d.ts +7 -0
  171. package/dist/src/compiled.js +19 -0
  172. package/dist/src/constants.d.ts +209 -0
  173. package/dist/src/constants.js +264 -0
  174. package/dist/{types → src}/debug.d.ts +1 -2
  175. package/dist/src/debug.js +14 -0
  176. package/dist/src/emptyDir.d.ts +1 -0
  177. package/dist/src/emptyDir.js +22 -0
  178. package/dist/{js/modern/ensureAbsolutePath.js → src/ensureAbsolutePath.d.ts} +1 -3
  179. package/dist/src/ensureAbsolutePath.js +15 -0
  180. package/dist/src/findExists.d.ts +6 -0
  181. package/dist/src/findExists.js +21 -0
  182. package/dist/src/format.d.ts +16 -0
  183. package/dist/src/format.js +115 -0
  184. package/dist/src/generateMetaTags.d.ts +16 -0
  185. package/dist/src/generateMetaTags.js +48 -0
  186. package/dist/src/getBrowserslist.d.ts +2 -0
  187. package/dist/src/getBrowserslist.js +7 -0
  188. package/dist/src/getCacheIdentifier.d.ts +7 -0
  189. package/dist/src/getCacheIdentifier.js +24 -0
  190. package/dist/src/getEntryOptions.d.ts +1 -0
  191. package/dist/src/getEntryOptions.js +26 -0
  192. package/dist/src/getPackageManager.d.ts +1 -0
  193. package/dist/src/getPackageManager.js +47 -0
  194. package/dist/src/getPort.d.ts +7 -0
  195. package/dist/src/getPort.js +62 -0
  196. package/dist/src/import.d.ts +5 -0
  197. package/dist/src/import.js +10 -0
  198. package/dist/{types → src}/index.d.ts +2 -3
  199. package/dist/src/index.js +57 -0
  200. package/dist/src/is/index.d.ts +34 -0
  201. package/dist/src/is/index.js +82 -0
  202. package/dist/src/is/node-env.d.ts +4 -0
  203. package/dist/src/is/node-env.js +12 -0
  204. package/dist/src/is/platform.d.ts +2 -0
  205. package/dist/src/is/platform.js +10 -0
  206. package/dist/src/is/type.d.ts +8 -0
  207. package/dist/src/is/type.js +38 -0
  208. package/dist/src/logger.d.ts +63 -0
  209. package/dist/src/logger.js +129 -0
  210. package/dist/src/monorepo.d.ts +11 -0
  211. package/dist/src/monorepo.js +81 -0
  212. package/dist/src/nodeEnv.d.ts +3 -0
  213. package/dist/src/nodeEnv.js +52 -0
  214. package/dist/src/path.d.ts +3 -0
  215. package/dist/src/path.js +14 -0
  216. package/dist/src/prettyInstructions.d.ts +6 -0
  217. package/dist/src/prettyInstructions.js +64 -0
  218. package/dist/src/printBuildError.d.ts +8 -0
  219. package/dist/src/printBuildError.js +43 -0
  220. package/dist/src/readTsConfig.d.ts +2 -0
  221. package/dist/src/readTsConfig.js +19 -0
  222. package/dist/src/removeSlash.d.ts +3 -0
  223. package/dist/src/removeSlash.js +9 -0
  224. package/dist/src/runtimeExports.d.ts +4 -0
  225. package/dist/src/runtimeExports.js +53 -0
  226. package/dist/{types → src}/wait.d.ts +1 -1
  227. package/dist/src/wait.js +7 -0
  228. package/dist/{types → src}/watch.d.ts +3 -3
  229. package/dist/src/watch.js +65 -0
  230. package/dist/wait.d.ts +2 -0
  231. package/dist/wait.js +7 -0
  232. package/dist/watch.d.ts +8 -0
  233. package/dist/watch.js +64 -0
  234. package/jest.config.js +0 -1
  235. package/package.json +55 -39
  236. package/tests/debug.test.ts +2 -2
  237. package/tests/is.test.ts +27 -0
  238. package/tests/isPlatform.test.ts +19 -0
  239. package/tests/isType.test.ts +70 -2
  240. package/tests/prettyInstructions.test.ts +1 -1
  241. package/tsconfig.json +3 -5
  242. package/dist/js/modern/FileSizeReporter.js +0 -156
  243. package/dist/js/modern/alias.js +0 -74
  244. package/dist/js/modern/applyOptionsChain.js +0 -27
  245. package/dist/js/modern/chalk.js +0 -2
  246. package/dist/js/modern/clearConsole.js +0 -5
  247. package/dist/js/modern/compatRequire.js +0 -26
  248. package/dist/js/modern/constants.js +0 -338
  249. package/dist/js/modern/emptyDir.js +0 -6
  250. package/dist/js/modern/findExists.js +0 -16
  251. package/dist/js/modern/format.js +0 -137
  252. package/dist/js/modern/generateMetaTags.js +0 -49
  253. package/dist/js/modern/getBrowserslist.js +0 -5
  254. package/dist/js/modern/getCacheIdentifier.js +0 -20
  255. package/dist/js/modern/getEntryOptions.js +0 -24
  256. package/dist/js/modern/getPackageManager.js +0 -37
  257. package/dist/js/modern/getPort.js +0 -52
  258. package/dist/js/modern/import.js +0 -11
  259. package/dist/js/modern/index.js +0 -34
  260. package/dist/js/modern/is/index.js +0 -77
  261. package/dist/js/modern/is/node-env.js +0 -5
  262. package/dist/js/modern/is/platform.js +0 -2
  263. package/dist/js/modern/is/type.js +0 -28
  264. package/dist/js/modern/logger.js +0 -152
  265. package/dist/js/modern/monorepo.js +0 -84
  266. package/dist/js/modern/nodeEnv.js +0 -31
  267. package/dist/js/modern/path.js +0 -5
  268. package/dist/js/modern/pkgUp.js +0 -2
  269. package/dist/js/modern/prettyInstructions.js +0 -79
  270. package/dist/js/modern/printBuildError.js +0 -40
  271. package/dist/js/modern/readTsConfig.js +0 -13
  272. package/dist/js/modern/removeSlash.js +0 -3
  273. package/dist/js/modern/runtimeExports.js +0 -52
  274. package/dist/js/modern/wait.js +0 -5
  275. package/dist/js/modern/watch.js +0 -43
  276. package/dist/js/node/FileSizeReporter.js +0 -175
  277. package/dist/js/node/alias.js +0 -97
  278. package/dist/js/node/applyOptionsChain.js +0 -37
  279. package/dist/js/node/chalk.js +0 -15
  280. package/dist/js/node/clearConsole.js +0 -14
  281. package/dist/js/node/compatRequire.js +0 -41
  282. package/dist/js/node/constants.js +0 -358
  283. package/dist/js/node/debug.js +0 -19
  284. package/dist/js/node/emptyDir.js +0 -18
  285. package/dist/js/node/ensureAbsolutePath.js +0 -20
  286. package/dist/js/node/findExists.js +0 -27
  287. package/dist/js/node/format.js +0 -141
  288. package/dist/js/node/generateMetaTags.js +0 -58
  289. package/dist/js/node/getBrowserslist.js +0 -17
  290. package/dist/js/node/getCacheIdentifier.js +0 -27
  291. package/dist/js/node/getEntryOptions.js +0 -35
  292. package/dist/js/node/getPackageManager.js +0 -51
  293. package/dist/js/node/getPort.js +0 -67
  294. package/dist/js/node/import.js +0 -19
  295. package/dist/js/node/index.js +0 -465
  296. package/dist/js/node/is/index.js +0 -150
  297. package/dist/js/node/is/node-env.js +0 -23
  298. package/dist/js/node/is/platform.js +0 -14
  299. package/dist/js/node/is/type.js +0 -49
  300. package/dist/js/node/logger.js +0 -162
  301. package/dist/js/node/monorepo.js +0 -118
  302. package/dist/js/node/nodeEnv.js +0 -45
  303. package/dist/js/node/path.js +0 -24
  304. package/dist/js/node/pkgUp.js +0 -15
  305. package/dist/js/node/prettyInstructions.js +0 -95
  306. package/dist/js/node/printBuildError.js +0 -52
  307. package/dist/js/node/readTsConfig.js +0 -28
  308. package/dist/js/node/removeSlash.js +0 -18
  309. package/dist/js/node/runtimeExports.js +0 -68
  310. package/dist/js/node/wait.js +0 -12
  311. package/dist/js/node/watch.js +0 -61
  312. package/dist/js/treeshaking/FileSizeReporter.js +0 -185
  313. package/dist/js/treeshaking/alias.js +0 -72
  314. package/dist/js/treeshaking/applyOptionsChain.js +0 -31
  315. package/dist/js/treeshaking/chalk.js +0 -2
  316. package/dist/js/treeshaking/clearConsole.js +0 -5
  317. package/dist/js/treeshaking/compatRequire.js +0 -29
  318. package/dist/js/treeshaking/constants.js +0 -338
  319. package/dist/js/treeshaking/debug.js +0 -10
  320. package/dist/js/treeshaking/emptyDir.js +0 -37
  321. package/dist/js/treeshaking/ensureAbsolutePath.js +0 -11
  322. package/dist/js/treeshaking/findExists.js +0 -33
  323. package/dist/js/treeshaking/format.js +0 -167
  324. package/dist/js/treeshaking/generateMetaTags.js +0 -55
  325. package/dist/js/treeshaking/getBrowserslist.js +0 -7
  326. package/dist/js/treeshaking/getCacheIdentifier.js +0 -35
  327. package/dist/js/treeshaking/getEntryOptions.js +0 -26
  328. package/dist/js/treeshaking/getPackageManager.js +0 -101
  329. package/dist/js/treeshaking/getPort.js +0 -103
  330. package/dist/js/treeshaking/import.js +0 -11
  331. package/dist/js/treeshaking/index.js +0 -34
  332. package/dist/js/treeshaking/is/index.js +0 -81
  333. package/dist/js/treeshaking/is/node-env.js +0 -13
  334. package/dist/js/treeshaking/is/platform.js +0 -6
  335. package/dist/js/treeshaking/is/type.js +0 -30
  336. package/dist/js/treeshaking/logger.js +0 -188
  337. package/dist/js/treeshaking/monorepo.js +0 -95
  338. package/dist/js/treeshaking/nodeEnv.js +0 -108
  339. package/dist/js/treeshaking/path.js +0 -11
  340. package/dist/js/treeshaking/pkgUp.js +0 -2
  341. package/dist/js/treeshaking/prettyInstructions.js +0 -100
  342. package/dist/js/treeshaking/printBuildError.js +0 -40
  343. package/dist/js/treeshaking/readTsConfig.js +0 -13
  344. package/dist/js/treeshaking/removeSlash.js +0 -9
  345. package/dist/js/treeshaking/runtimeExports.js +0 -61
  346. package/dist/js/treeshaking/wait.js +0 -8
  347. package/dist/js/treeshaking/watch.js +0 -112
  348. package/dist/types/applyOptionsChain.d.ts +0 -6
  349. package/dist/types/chalk.d.ts +0 -2
  350. package/dist/types/clearConsole.d.ts +0 -1
  351. package/dist/types/constants.d.ts +0 -219
  352. package/dist/types/emptyDir.d.ts +0 -1
  353. package/dist/types/is/platform.d.ts +0 -2
  354. package/dist/types/is/type.d.ts +0 -8
  355. package/dist/types/logger.d.ts +0 -63
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getEntryOptions = void 0;
7
-
8
- var _is = require("./is");
9
-
10
- var _constants = require("./constants");
11
-
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
-
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
-
16
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
-
18
- const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
19
- if (optionsByEntries) {
20
- let optionsByEntry = getOptionsByEntryName(name, optionsByEntries); // compatible with main entry using packageName as the key
21
-
22
- if (optionsByEntry === undefined && name === _constants.MAIN_ENTRY_NAME && packageName) {
23
- optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
24
- } // eslint-disable-next-line no-nested-ternary
25
-
26
-
27
- return optionsByEntry !== undefined ? (0, _is.isPlainObject)(optionsByEntry) && (0, _is.isPlainObject)(baseOptions) ? _objectSpread(_objectSpread({}, baseOptions), optionsByEntry) : optionsByEntry : baseOptions;
28
- } else {
29
- return baseOptions;
30
- }
31
- };
32
-
33
- exports.getEntryOptions = getEntryOptions;
34
-
35
- const getOptionsByEntryName = (name, optionsByEntries) => optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : undefined;
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getPackageManager = getPackageManager;
7
-
8
- var _os = _interopRequireDefault(require("os"));
9
-
10
- var _path = _interopRequireDefault(require("path"));
11
-
12
- var _fsExtra = _interopRequireDefault(require("fs-extra"));
13
-
14
- var _nodeEnv = require("./nodeEnv");
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- const MAX_TIMES = 5;
19
-
20
- async function getPackageManager(cwd = process.cwd()) {
21
- let appDirectory = cwd;
22
- let times = 0;
23
-
24
- while (_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
25
- times++;
26
-
27
- if (_fsExtra.default.existsSync(_path.default.resolve(appDirectory, 'pnpm-lock.yaml'))) {
28
- return 'pnpm';
29
- }
30
-
31
- if (_fsExtra.default.existsSync(_path.default.resolve(appDirectory, 'yarn.lock'))) {
32
- return 'yarn';
33
- }
34
-
35
- if (_fsExtra.default.existsSync(_path.default.resolve(appDirectory, 'package-lock.json'))) {
36
- return 'npm';
37
- }
38
-
39
- appDirectory = _path.default.join(appDirectory, '..');
40
- }
41
-
42
- if (await (0, _nodeEnv.canUsePnpm)()) {
43
- return 'pnpm';
44
- }
45
-
46
- if (await (0, _nodeEnv.canUseYarn)()) {
47
- return 'yarn';
48
- }
49
-
50
- return 'npm';
51
- }
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getPort = void 0;
7
-
8
- var _net = _interopRequireDefault(require("net"));
9
-
10
- var _chalk = require("./chalk");
11
-
12
- var _logger = require("./logger");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- /**
17
- * Get available free port.
18
- * @param port - Current port want to use.
19
- * @param tryLimits - Maximum number of retries.
20
- * @returns Available port number.
21
- */
22
-
23
- /* eslint-disable no-param-reassign, @typescript-eslint/no-loop-func */
24
- const getPort = async (port, tryLimits = 20) => {
25
- if (typeof port === 'string') {
26
- port = parseInt(port, 10);
27
- }
28
-
29
- const original = port;
30
- let found = false;
31
- let attempts = 0;
32
-
33
- while (!found && attempts <= tryLimits) {
34
- try {
35
- await new Promise((resolve, reject) => {
36
- const server = _net.default.createServer();
37
-
38
- server.unref();
39
- server.on('error', reject);
40
- server.listen({
41
- port,
42
- host: '0.0.0.0'
43
- }, () => {
44
- found = true;
45
- server.close(resolve);
46
- });
47
- });
48
- } catch (e) {
49
- if (e.code !== 'EADDRINUSE') {
50
- throw e;
51
- }
52
-
53
- port++;
54
- attempts++;
55
- }
56
- }
57
-
58
- if (port !== original) {
59
- _logger.logger.info(_chalk.chalk.red(`Something is already running on port ${original}. ${_chalk.chalk.yellow(`Use port ${port} instead.`)}`));
60
- }
61
-
62
- return port;
63
- };
64
- /* eslint-enable no-param-reassign, @typescript-eslint/no-loop-func */
65
-
66
-
67
- exports.getPort = getPort;
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.lazyImport = exports.Import = void 0;
7
-
8
- // cover: https://rushstack.io/pages/api/node-core-library.import.lazy/
9
- const lazy = (moduleName, requireFn) => {
10
- const importLazyLocal = require('import-lazy')(requireFn);
11
-
12
- return importLazyLocal(moduleName);
13
- };
14
-
15
- exports.lazyImport = lazy;
16
- const Import = {
17
- lazy
18
- };
19
- exports.Import = Import;
@@ -1,465 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {
7
- fs: true
8
- };
9
- exports.fs = void 0;
10
-
11
- var _fs = _interopRequireWildcard(require("fs-extra"));
12
-
13
- exports.fs = _fs;
14
-
15
- var _chalk = require("./chalk");
16
-
17
- Object.keys(_chalk).forEach(function (key) {
18
- if (key === "default" || key === "__esModule") return;
19
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
- if (key in exports && exports[key] === _chalk[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _chalk[key];
25
- }
26
- });
27
- });
28
-
29
- var _format = require("./format");
30
-
31
- Object.keys(_format).forEach(function (key) {
32
- if (key === "default" || key === "__esModule") return;
33
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
34
- if (key in exports && exports[key] === _format[key]) return;
35
- Object.defineProperty(exports, key, {
36
- enumerable: true,
37
- get: function () {
38
- return _format[key];
39
- }
40
- });
41
- });
42
-
43
- var _FileSizeReporter = require("./FileSizeReporter");
44
-
45
- Object.keys(_FileSizeReporter).forEach(function (key) {
46
- if (key === "default" || key === "__esModule") return;
47
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
48
- if (key in exports && exports[key] === _FileSizeReporter[key]) return;
49
- Object.defineProperty(exports, key, {
50
- enumerable: true,
51
- get: function () {
52
- return _FileSizeReporter[key];
53
- }
54
- });
55
- });
56
-
57
- var _printBuildError = require("./printBuildError");
58
-
59
- Object.keys(_printBuildError).forEach(function (key) {
60
- if (key === "default" || key === "__esModule") return;
61
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
62
- if (key in exports && exports[key] === _printBuildError[key]) return;
63
- Object.defineProperty(exports, key, {
64
- enumerable: true,
65
- get: function () {
66
- return _printBuildError[key];
67
- }
68
- });
69
- });
70
-
71
- var _debug = require("./debug");
72
-
73
- Object.keys(_debug).forEach(function (key) {
74
- if (key === "default" || key === "__esModule") return;
75
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
76
- if (key in exports && exports[key] === _debug[key]) return;
77
- Object.defineProperty(exports, key, {
78
- enumerable: true,
79
- get: function () {
80
- return _debug[key];
81
- }
82
- });
83
- });
84
-
85
- var _findExists = require("./findExists");
86
-
87
- Object.keys(_findExists).forEach(function (key) {
88
- if (key === "default" || key === "__esModule") return;
89
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
90
- if (key in exports && exports[key] === _findExists[key]) return;
91
- Object.defineProperty(exports, key, {
92
- enumerable: true,
93
- get: function () {
94
- return _findExists[key];
95
- }
96
- });
97
- });
98
-
99
- var _is = require("./is");
100
-
101
- Object.keys(_is).forEach(function (key) {
102
- if (key === "default" || key === "__esModule") return;
103
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
104
- if (key in exports && exports[key] === _is[key]) return;
105
- Object.defineProperty(exports, key, {
106
- enumerable: true,
107
- get: function () {
108
- return _is[key];
109
- }
110
- });
111
- });
112
-
113
- var _compatRequire = require("./compatRequire");
114
-
115
- Object.keys(_compatRequire).forEach(function (key) {
116
- if (key === "default" || key === "__esModule") return;
117
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
118
- if (key in exports && exports[key] === _compatRequire[key]) return;
119
- Object.defineProperty(exports, key, {
120
- enumerable: true,
121
- get: function () {
122
- return _compatRequire[key];
123
- }
124
- });
125
- });
126
-
127
- var _logger = require("./logger");
128
-
129
- Object.keys(_logger).forEach(function (key) {
130
- if (key === "default" || key === "__esModule") return;
131
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
132
- if (key in exports && exports[key] === _logger[key]) return;
133
- Object.defineProperty(exports, key, {
134
- enumerable: true,
135
- get: function () {
136
- return _logger[key];
137
- }
138
- });
139
- });
140
-
141
- var _constants = require("./constants");
142
-
143
- Object.keys(_constants).forEach(function (key) {
144
- if (key === "default" || key === "__esModule") return;
145
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
146
- if (key in exports && exports[key] === _constants[key]) return;
147
- Object.defineProperty(exports, key, {
148
- enumerable: true,
149
- get: function () {
150
- return _constants[key];
151
- }
152
- });
153
- });
154
-
155
- var _ensureAbsolutePath = require("./ensureAbsolutePath");
156
-
157
- Object.keys(_ensureAbsolutePath).forEach(function (key) {
158
- if (key === "default" || key === "__esModule") return;
159
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
160
- if (key in exports && exports[key] === _ensureAbsolutePath[key]) return;
161
- Object.defineProperty(exports, key, {
162
- enumerable: true,
163
- get: function () {
164
- return _ensureAbsolutePath[key];
165
- }
166
- });
167
- });
168
-
169
- var _getCacheIdentifier = require("./getCacheIdentifier");
170
-
171
- Object.keys(_getCacheIdentifier).forEach(function (key) {
172
- if (key === "default" || key === "__esModule") return;
173
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
174
- if (key in exports && exports[key] === _getCacheIdentifier[key]) return;
175
- Object.defineProperty(exports, key, {
176
- enumerable: true,
177
- get: function () {
178
- return _getCacheIdentifier[key];
179
- }
180
- });
181
- });
182
-
183
- var _clearConsole = require("./clearConsole");
184
-
185
- Object.keys(_clearConsole).forEach(function (key) {
186
- if (key === "default" || key === "__esModule") return;
187
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
188
- if (key in exports && exports[key] === _clearConsole[key]) return;
189
- Object.defineProperty(exports, key, {
190
- enumerable: true,
191
- get: function () {
192
- return _clearConsole[key];
193
- }
194
- });
195
- });
196
-
197
- var _pkgUp = require("./pkgUp");
198
-
199
- Object.keys(_pkgUp).forEach(function (key) {
200
- if (key === "default" || key === "__esModule") return;
201
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
202
- if (key in exports && exports[key] === _pkgUp[key]) return;
203
- Object.defineProperty(exports, key, {
204
- enumerable: true,
205
- get: function () {
206
- return _pkgUp[key];
207
- }
208
- });
209
- });
210
-
211
- var _applyOptionsChain = require("./applyOptionsChain");
212
-
213
- Object.keys(_applyOptionsChain).forEach(function (key) {
214
- if (key === "default" || key === "__esModule") return;
215
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
216
- if (key in exports && exports[key] === _applyOptionsChain[key]) return;
217
- Object.defineProperty(exports, key, {
218
- enumerable: true,
219
- get: function () {
220
- return _applyOptionsChain[key];
221
- }
222
- });
223
- });
224
-
225
- var _getBrowserslist = require("./getBrowserslist");
226
-
227
- Object.keys(_getBrowserslist).forEach(function (key) {
228
- if (key === "default" || key === "__esModule") return;
229
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
230
- if (key in exports && exports[key] === _getBrowserslist[key]) return;
231
- Object.defineProperty(exports, key, {
232
- enumerable: true,
233
- get: function () {
234
- return _getBrowserslist[key];
235
- }
236
- });
237
- });
238
-
239
- var _removeSlash = require("./removeSlash");
240
-
241
- Object.keys(_removeSlash).forEach(function (key) {
242
- if (key === "default" || key === "__esModule") return;
243
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
244
- if (key in exports && exports[key] === _removeSlash[key]) return;
245
- Object.defineProperty(exports, key, {
246
- enumerable: true,
247
- get: function () {
248
- return _removeSlash[key];
249
- }
250
- });
251
- });
252
-
253
- var _getEntryOptions = require("./getEntryOptions");
254
-
255
- Object.keys(_getEntryOptions).forEach(function (key) {
256
- if (key === "default" || key === "__esModule") return;
257
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
258
- if (key in exports && exports[key] === _getEntryOptions[key]) return;
259
- Object.defineProperty(exports, key, {
260
- enumerable: true,
261
- get: function () {
262
- return _getEntryOptions[key];
263
- }
264
- });
265
- });
266
-
267
- var _getPort = require("./getPort");
268
-
269
- Object.keys(_getPort).forEach(function (key) {
270
- if (key === "default" || key === "__esModule") return;
271
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
272
- if (key in exports && exports[key] === _getPort[key]) return;
273
- Object.defineProperty(exports, key, {
274
- enumerable: true,
275
- get: function () {
276
- return _getPort[key];
277
- }
278
- });
279
- });
280
-
281
- var _monorepo = require("./monorepo");
282
-
283
- Object.keys(_monorepo).forEach(function (key) {
284
- if (key === "default" || key === "__esModule") return;
285
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
286
- if (key in exports && exports[key] === _monorepo[key]) return;
287
- Object.defineProperty(exports, key, {
288
- enumerable: true,
289
- get: function () {
290
- return _monorepo[key];
291
- }
292
- });
293
- });
294
-
295
- var _getPackageManager = require("./getPackageManager");
296
-
297
- Object.keys(_getPackageManager).forEach(function (key) {
298
- if (key === "default" || key === "__esModule") return;
299
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
300
- if (key in exports && exports[key] === _getPackageManager[key]) return;
301
- Object.defineProperty(exports, key, {
302
- enumerable: true,
303
- get: function () {
304
- return _getPackageManager[key];
305
- }
306
- });
307
- });
308
-
309
- var _runtimeExports = require("./runtimeExports");
310
-
311
- Object.keys(_runtimeExports).forEach(function (key) {
312
- if (key === "default" || key === "__esModule") return;
313
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
314
- if (key in exports && exports[key] === _runtimeExports[key]) return;
315
- Object.defineProperty(exports, key, {
316
- enumerable: true,
317
- get: function () {
318
- return _runtimeExports[key];
319
- }
320
- });
321
- });
322
-
323
- var _readTsConfig = require("./readTsConfig");
324
-
325
- Object.keys(_readTsConfig).forEach(function (key) {
326
- if (key === "default" || key === "__esModule") return;
327
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
328
- if (key in exports && exports[key] === _readTsConfig[key]) return;
329
- Object.defineProperty(exports, key, {
330
- enumerable: true,
331
- get: function () {
332
- return _readTsConfig[key];
333
- }
334
- });
335
- });
336
-
337
- var _path = require("./path");
338
-
339
- Object.keys(_path).forEach(function (key) {
340
- if (key === "default" || key === "__esModule") return;
341
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
342
- if (key in exports && exports[key] === _path[key]) return;
343
- Object.defineProperty(exports, key, {
344
- enumerable: true,
345
- get: function () {
346
- return _path[key];
347
- }
348
- });
349
- });
350
-
351
- var _generateMetaTags = require("./generateMetaTags");
352
-
353
- Object.keys(_generateMetaTags).forEach(function (key) {
354
- if (key === "default" || key === "__esModule") return;
355
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
356
- if (key in exports && exports[key] === _generateMetaTags[key]) return;
357
- Object.defineProperty(exports, key, {
358
- enumerable: true,
359
- get: function () {
360
- return _generateMetaTags[key];
361
- }
362
- });
363
- });
364
-
365
- var _prettyInstructions = require("./prettyInstructions");
366
-
367
- Object.keys(_prettyInstructions).forEach(function (key) {
368
- if (key === "default" || key === "__esModule") return;
369
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
370
- if (key in exports && exports[key] === _prettyInstructions[key]) return;
371
- Object.defineProperty(exports, key, {
372
- enumerable: true,
373
- get: function () {
374
- return _prettyInstructions[key];
375
- }
376
- });
377
- });
378
-
379
- var _alias = require("./alias");
380
-
381
- Object.keys(_alias).forEach(function (key) {
382
- if (key === "default" || key === "__esModule") return;
383
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
384
- if (key in exports && exports[key] === _alias[key]) return;
385
- Object.defineProperty(exports, key, {
386
- enumerable: true,
387
- get: function () {
388
- return _alias[key];
389
- }
390
- });
391
- });
392
-
393
- var _import = require("./import");
394
-
395
- Object.keys(_import).forEach(function (key) {
396
- if (key === "default" || key === "__esModule") return;
397
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
398
- if (key in exports && exports[key] === _import[key]) return;
399
- Object.defineProperty(exports, key, {
400
- enumerable: true,
401
- get: function () {
402
- return _import[key];
403
- }
404
- });
405
- });
406
-
407
- var _watch = require("./watch");
408
-
409
- Object.keys(_watch).forEach(function (key) {
410
- if (key === "default" || key === "__esModule") return;
411
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
412
- if (key in exports && exports[key] === _watch[key]) return;
413
- Object.defineProperty(exports, key, {
414
- enumerable: true,
415
- get: function () {
416
- return _watch[key];
417
- }
418
- });
419
- });
420
-
421
- var _nodeEnv = require("./nodeEnv");
422
-
423
- Object.keys(_nodeEnv).forEach(function (key) {
424
- if (key === "default" || key === "__esModule") return;
425
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
426
- if (key in exports && exports[key] === _nodeEnv[key]) return;
427
- Object.defineProperty(exports, key, {
428
- enumerable: true,
429
- get: function () {
430
- return _nodeEnv[key];
431
- }
432
- });
433
- });
434
-
435
- var _wait = require("./wait");
436
-
437
- Object.keys(_wait).forEach(function (key) {
438
- if (key === "default" || key === "__esModule") return;
439
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
440
- if (key in exports && exports[key] === _wait[key]) return;
441
- Object.defineProperty(exports, key, {
442
- enumerable: true,
443
- get: function () {
444
- return _wait[key];
445
- }
446
- });
447
- });
448
-
449
- var _emptyDir = require("./emptyDir");
450
-
451
- Object.keys(_emptyDir).forEach(function (key) {
452
- if (key === "default" || key === "__esModule") return;
453
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
454
- if (key in exports && exports[key] === _emptyDir[key]) return;
455
- Object.defineProperty(exports, key, {
456
- enumerable: true,
457
- get: function () {
458
- return _emptyDir[key];
459
- }
460
- });
461
- });
462
-
463
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
464
-
465
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }