@modern-js/utils 1.3.6 → 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 (353) hide show
  1. package/.eslintrc.js +9 -0
  2. package/CHANGELOG.md +6 -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/{types/is → is}/type.d.ts +1 -1
  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/prettyInstructions.test.ts +1 -1
  240. package/tsconfig.json +3 -5
  241. package/dist/js/modern/FileSizeReporter.js +0 -156
  242. package/dist/js/modern/alias.js +0 -74
  243. package/dist/js/modern/applyOptionsChain.js +0 -27
  244. package/dist/js/modern/chalk.js +0 -2
  245. package/dist/js/modern/clearConsole.js +0 -5
  246. package/dist/js/modern/compatRequire.js +0 -26
  247. package/dist/js/modern/constants.js +0 -333
  248. package/dist/js/modern/emptyDir.js +0 -6
  249. package/dist/js/modern/findExists.js +0 -16
  250. package/dist/js/modern/format.js +0 -137
  251. package/dist/js/modern/generateMetaTags.js +0 -49
  252. package/dist/js/modern/getBrowserslist.js +0 -5
  253. package/dist/js/modern/getCacheIdentifier.js +0 -20
  254. package/dist/js/modern/getEntryOptions.js +0 -24
  255. package/dist/js/modern/getPackageManager.js +0 -37
  256. package/dist/js/modern/getPort.js +0 -52
  257. package/dist/js/modern/import.js +0 -11
  258. package/dist/js/modern/index.js +0 -34
  259. package/dist/js/modern/is/index.js +0 -77
  260. package/dist/js/modern/is/node-env.js +0 -5
  261. package/dist/js/modern/is/platform.js +0 -2
  262. package/dist/js/modern/is/type.js +0 -27
  263. package/dist/js/modern/logger.js +0 -152
  264. package/dist/js/modern/monorepo.js +0 -84
  265. package/dist/js/modern/nodeEnv.js +0 -31
  266. package/dist/js/modern/path.js +0 -5
  267. package/dist/js/modern/pkgUp.js +0 -2
  268. package/dist/js/modern/prettyInstructions.js +0 -79
  269. package/dist/js/modern/printBuildError.js +0 -40
  270. package/dist/js/modern/readTsConfig.js +0 -13
  271. package/dist/js/modern/removeSlash.js +0 -3
  272. package/dist/js/modern/runtimeExports.js +0 -52
  273. package/dist/js/modern/wait.js +0 -5
  274. package/dist/js/modern/watch.js +0 -43
  275. package/dist/js/node/FileSizeReporter.js +0 -175
  276. package/dist/js/node/alias.js +0 -97
  277. package/dist/js/node/applyOptionsChain.js +0 -37
  278. package/dist/js/node/chalk.js +0 -15
  279. package/dist/js/node/clearConsole.js +0 -14
  280. package/dist/js/node/compatRequire.js +0 -41
  281. package/dist/js/node/constants.js +0 -353
  282. package/dist/js/node/debug.js +0 -19
  283. package/dist/js/node/emptyDir.js +0 -18
  284. package/dist/js/node/ensureAbsolutePath.js +0 -20
  285. package/dist/js/node/findExists.js +0 -27
  286. package/dist/js/node/format.js +0 -141
  287. package/dist/js/node/generateMetaTags.js +0 -58
  288. package/dist/js/node/getBrowserslist.js +0 -17
  289. package/dist/js/node/getCacheIdentifier.js +0 -27
  290. package/dist/js/node/getEntryOptions.js +0 -35
  291. package/dist/js/node/getPackageManager.js +0 -51
  292. package/dist/js/node/getPort.js +0 -67
  293. package/dist/js/node/import.js +0 -19
  294. package/dist/js/node/index.js +0 -465
  295. package/dist/js/node/is/index.js +0 -150
  296. package/dist/js/node/is/node-env.js +0 -23
  297. package/dist/js/node/is/platform.js +0 -14
  298. package/dist/js/node/is/type.js +0 -48
  299. package/dist/js/node/logger.js +0 -162
  300. package/dist/js/node/monorepo.js +0 -118
  301. package/dist/js/node/nodeEnv.js +0 -45
  302. package/dist/js/node/path.js +0 -24
  303. package/dist/js/node/pkgUp.js +0 -15
  304. package/dist/js/node/prettyInstructions.js +0 -95
  305. package/dist/js/node/printBuildError.js +0 -52
  306. package/dist/js/node/readTsConfig.js +0 -28
  307. package/dist/js/node/removeSlash.js +0 -18
  308. package/dist/js/node/runtimeExports.js +0 -68
  309. package/dist/js/node/wait.js +0 -12
  310. package/dist/js/node/watch.js +0 -61
  311. package/dist/js/treeshaking/FileSizeReporter.js +0 -185
  312. package/dist/js/treeshaking/alias.js +0 -72
  313. package/dist/js/treeshaking/applyOptionsChain.js +0 -31
  314. package/dist/js/treeshaking/chalk.js +0 -2
  315. package/dist/js/treeshaking/clearConsole.js +0 -5
  316. package/dist/js/treeshaking/compatRequire.js +0 -29
  317. package/dist/js/treeshaking/constants.js +0 -333
  318. package/dist/js/treeshaking/debug.js +0 -10
  319. package/dist/js/treeshaking/emptyDir.js +0 -37
  320. package/dist/js/treeshaking/ensureAbsolutePath.js +0 -11
  321. package/dist/js/treeshaking/findExists.js +0 -33
  322. package/dist/js/treeshaking/format.js +0 -167
  323. package/dist/js/treeshaking/generateMetaTags.js +0 -55
  324. package/dist/js/treeshaking/getBrowserslist.js +0 -7
  325. package/dist/js/treeshaking/getCacheIdentifier.js +0 -35
  326. package/dist/js/treeshaking/getEntryOptions.js +0 -26
  327. package/dist/js/treeshaking/getPackageManager.js +0 -101
  328. package/dist/js/treeshaking/getPort.js +0 -103
  329. package/dist/js/treeshaking/import.js +0 -11
  330. package/dist/js/treeshaking/index.js +0 -34
  331. package/dist/js/treeshaking/is/index.js +0 -81
  332. package/dist/js/treeshaking/is/node-env.js +0 -13
  333. package/dist/js/treeshaking/is/platform.js +0 -6
  334. package/dist/js/treeshaking/is/type.js +0 -29
  335. package/dist/js/treeshaking/logger.js +0 -188
  336. package/dist/js/treeshaking/monorepo.js +0 -95
  337. package/dist/js/treeshaking/nodeEnv.js +0 -108
  338. package/dist/js/treeshaking/path.js +0 -11
  339. package/dist/js/treeshaking/pkgUp.js +0 -2
  340. package/dist/js/treeshaking/prettyInstructions.js +0 -100
  341. package/dist/js/treeshaking/printBuildError.js +0 -40
  342. package/dist/js/treeshaking/readTsConfig.js +0 -13
  343. package/dist/js/treeshaking/removeSlash.js +0 -9
  344. package/dist/js/treeshaking/runtimeExports.js +0 -61
  345. package/dist/js/treeshaking/wait.js +0 -8
  346. package/dist/js/treeshaking/watch.js +0 -112
  347. package/dist/types/applyOptionsChain.d.ts +0 -6
  348. package/dist/types/chalk.d.ts +0 -2
  349. package/dist/types/clearConsole.d.ts +0 -1
  350. package/dist/types/constants.d.ts +0 -219
  351. package/dist/types/emptyDir.d.ts +0 -1
  352. package/dist/types/is/platform.d.ts +0 -2
  353. package/dist/types/logger.d.ts +0 -63
package/dist/format.js ADDED
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ /* eslint-disable no-param-reassign */
3
+ /**
4
+ * Copyright (c) 2015-present, Facebook, Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file at
8
+ * https://github.com/facebook/create-react-app/blob/master/LICENSE
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.formatProxyOptions = exports.formatWebpackMessages = void 0;
12
+ const friendlySyntaxErrorLabel = 'Syntax error:';
13
+ function isLikelyASyntaxError(message) {
14
+ return message.includes(friendlySyntaxErrorLabel);
15
+ }
16
+ // Cleans up webpack error messages.
17
+ function formatMessage(message) {
18
+ var _a;
19
+ let lines = [];
20
+ // webpack 5 stats error object
21
+ if (typeof message === 'object') {
22
+ message = `${(message.moduleName && `${message.moduleName}\n`)}${message.details || message.stack || message.message}`;
23
+ }
24
+ lines = message.split('\n');
25
+ // Strip webpack-added headers off errors/warnings
26
+ // https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
27
+ lines = lines.filter(line => !/Module [A-z ]+\(from/.test(line));
28
+ // Transform parsing error into syntax error
29
+ lines = lines.map(line => {
30
+ const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
31
+ if (!parsingError) {
32
+ return line;
33
+ }
34
+ const [, errorLine, errorColumn, errorMessage] = parsingError;
35
+ return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
36
+ });
37
+ message = lines.join('\n');
38
+ // Smoosh syntax errors (commonly found in CSS)
39
+ message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`);
40
+ lines = message.split('\n');
41
+ // Remove leading newline
42
+ if (lines.length > 2 && lines[1].trim() === '') {
43
+ lines.splice(1, 1);
44
+ }
45
+ // Clean up file name
46
+ lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1');
47
+ // Cleans up verbose "module not found" messages for files and packages.
48
+ if ((_a = lines[1]) === null || _a === void 0 ? void 0 : _a.startsWith('Module not found: ')) {
49
+ lines = [
50
+ lines[0],
51
+ lines[1]
52
+ .replace('Error: ', '')
53
+ .replace('Module not found: Cannot find file:', 'Cannot find file:')
54
+ .replace('[CaseSensitivePathsPlugin] ', '')
55
+ .replace("Cannot resolve 'file' or 'directory' ", ''),
56
+ ];
57
+ }
58
+ message = lines.join('\n');
59
+ // Internal stacks are generally useless so we strip them... with the
60
+ // exception of stacks containing `webpack:` because they're normally
61
+ // from user code generated by webpack. For more information see
62
+ // https://github.com/facebook/create-react-app/pull/1050
63
+ message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
64
+ message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
65
+ lines = message.split('\n');
66
+ // Remove duplicated newlines
67
+ lines = lines.filter((line, index, arr) => index === 0 ||
68
+ line.trim() !== '' ||
69
+ line.trim() !== arr[index - 1].trim());
70
+ // Reassemble the message
71
+ message = lines.join('\n');
72
+ return message.trim();
73
+ }
74
+ function formatWebpackMessages(json) {
75
+ var _a, _b, _c;
76
+ const formattedErrors = (_a = json.errors) === null || _a === void 0 ? void 0 : _a.map(formatMessage);
77
+ const formattedWarnings = (_b = json.warnings) === null || _b === void 0 ? void 0 : _b.map(formatMessage);
78
+ const result = {
79
+ errors: formattedErrors || [],
80
+ warnings: formattedWarnings || [],
81
+ };
82
+ if ((_c = result.errors) === null || _c === void 0 ? void 0 : _c.some(isLikelyASyntaxError)) {
83
+ // If there are any syntax errors, show just them.
84
+ result.errors = result.errors.filter(isLikelyASyntaxError);
85
+ }
86
+ // First error is usually it.
87
+ if (result.errors.length > 1) {
88
+ result.errors.length = 1;
89
+ }
90
+ return result;
91
+ }
92
+ exports.formatWebpackMessages = formatWebpackMessages;
93
+ /* eslint-enable no-param-reassign */
94
+ function formatProxyOptions(proxyOptions) {
95
+ const formatedProxy = [];
96
+ if (!Array.isArray(proxyOptions)) {
97
+ if ('target' in proxyOptions) {
98
+ formatedProxy.push(proxyOptions);
99
+ }
100
+ else {
101
+ Array.prototype.push.apply(formatedProxy, Object.keys(proxyOptions).reduce((total, source) => {
102
+ const option = proxyOptions[source];
103
+ total.push(Object.assign({ context: source, changeOrigin: true, logLevel: 'warn' }, (typeof option === 'string' ? { target: option } : option)));
104
+ return total;
105
+ }, []));
106
+ }
107
+ }
108
+ else {
109
+ formatedProxy.push(...proxyOptions);
110
+ }
111
+ return formatedProxy;
112
+ }
113
+ exports.formatProxyOptions = formatProxyOptions;
@@ -8,9 +8,9 @@
8
8
  * Modified from https://github.com/jantimon/html-webpack-plugin/blob/2f5de7ab9e8bca60e9e200f2e4b4cfab90db28d4/index.js#L800
9
9
  */
10
10
  export declare type MetaAttributes = {
11
- [attributeName: string]: string | boolean;
11
+ [attributeName: string]: string | boolean;
12
12
  };
13
13
  export interface MetaOptions {
14
- [name: string]: string | false | MetaAttributes;
14
+ [name: string]: string | false | MetaAttributes;
15
15
  }
16
- export declare const generateMetaTags: (metaOptions?: MetaOptions | undefined) => string;
16
+ export declare const generateMetaTags: (metaOptions?: MetaOptions | undefined) => string;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateMetaTags = void 0;
4
+ const tagObjectToString = (tagDefinition) => {
5
+ const attributes = Object.keys(tagDefinition.attributes || {})
6
+ .filter(attributeName => tagDefinition.attributes[attributeName] !== false)
7
+ .map(attributeName => {
8
+ if (tagDefinition.attributes[attributeName] === true) {
9
+ return attributeName;
10
+ }
11
+ return `${attributeName}="${tagDefinition.attributes[attributeName]}"`;
12
+ });
13
+ return `<${[tagDefinition.tagName].concat(attributes).join(' ')}>${tagDefinition.innerHTML || ''}${tagDefinition.voidTag ? '' : `</${tagDefinition.tagName}>`}`;
14
+ };
15
+ const generateMetaTags = (metaOptions) => {
16
+ if (!metaOptions) {
17
+ return '';
18
+ }
19
+ // Make tags self-closing in case of xhtml
20
+ // Turn { "viewport" : "width=500, initial-scale=1" } into
21
+ // [{ name:"viewport" content:"width=500, initial-scale=1" }]
22
+ const metaTagAttributeObjects = Object.keys(metaOptions)
23
+ .map(metaName => {
24
+ const metaTagContent = metaOptions[metaName];
25
+ return typeof metaTagContent === 'string'
26
+ ? {
27
+ name: metaName,
28
+ content: metaTagContent,
29
+ }
30
+ : metaTagContent;
31
+ })
32
+ .filter(attribute => attribute !== false);
33
+ // Turn [{ name:"viewport" content:"width=500, initial-scale=1" }] into
34
+ // the html-webpack-plugin tag structure
35
+ return metaTagAttributeObjects
36
+ .map(metaTagAttributes => {
37
+ if (metaTagAttributes === false) {
38
+ throw new Error('Invalid meta tag');
39
+ }
40
+ return {
41
+ tagName: 'meta',
42
+ voidTag: true,
43
+ attributes: metaTagAttributes,
44
+ };
45
+ })
46
+ .reduce((memo, tagObject) => `${memo}\n${tagObjectToString(tagObject)}`, '');
47
+ };
48
+ exports.generateMetaTags = generateMetaTags;
@@ -1,2 +1,2 @@
1
1
  export declare const defaults: string[];
2
- export declare const getBrowserslist: (appDirectory: string) => string[];
2
+ export declare const getBrowserslist: (appDirectory: string) => string[];
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBrowserslist = exports.defaults = void 0;
4
+ const compiled_1 = require("./compiled");
5
+ exports.defaults = ['> 0.01%', 'not dead', 'not op_mini all'];
6
+ const getBrowserslist = (appDirectory) => compiled_1.browserslist.loadConfig({ path: appDirectory }) || exports.defaults;
7
+ exports.getBrowserslist = getBrowserslist;
@@ -2,6 +2,6 @@
2
2
  * Generate cache identifier from some packages and config files.
3
3
  */
4
4
  export declare function getCacheIdentifier(packages: {
5
- name: string;
6
- version: string;
7
- }[], _files?: string[]): string;
5
+ name: string;
6
+ version: string;
7
+ }[], _files?: string[]): string;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCacheIdentifier = void 0;
4
+ const is_1 = require("./is");
5
+ /**
6
+ * Generate cache identifier from some packages and config files.
7
+ */
8
+ function getCacheIdentifier(packages, _files) {
9
+ /* eslint-disable no-nested-ternary */
10
+ let cacheIdentifier = (0, is_1.isProd)()
11
+ ? 'production'
12
+ : (0, is_1.isDev)()
13
+ ? 'development'
14
+ : (0, is_1.isTest)()
15
+ ? 'test'
16
+ : '';
17
+ /* eslint-enable no-nested-ternary */
18
+ for (const { name, version } of packages) {
19
+ cacheIdentifier += `:${name}@${version}`;
20
+ }
21
+ // TODO: config file hash
22
+ return cacheIdentifier;
23
+ }
24
+ exports.getCacheIdentifier = getCacheIdentifier;
@@ -1 +1 @@
1
- export declare const getEntryOptions: <T>(name: string, baseOptions?: T | undefined, optionsByEntries?: Record<string, T> | undefined, packageName?: string | undefined) => T | undefined;
1
+ export declare const getEntryOptions: <T>(name: string, baseOptions?: T | undefined, optionsByEntries?: Record<string, T> | undefined, packageName?: string | undefined) => T | undefined;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEntryOptions = void 0;
4
+ const is_1 = require("./is");
5
+ const constants_1 = require("./constants");
6
+ const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
7
+ if (optionsByEntries) {
8
+ let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
9
+ // compatible with main entry using packageName as the key
10
+ if (optionsByEntry === undefined &&
11
+ name === constants_1.MAIN_ENTRY_NAME &&
12
+ packageName) {
13
+ optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
14
+ }
15
+ // eslint-disable-next-line no-nested-ternary
16
+ return optionsByEntry !== undefined
17
+ ? (0, is_1.isPlainObject)(optionsByEntry) && (0, is_1.isPlainObject)(baseOptions)
18
+ ? Object.assign(Object.assign({}, baseOptions), optionsByEntry) : optionsByEntry
19
+ : baseOptions;
20
+ }
21
+ else {
22
+ return baseOptions;
23
+ }
24
+ };
25
+ exports.getEntryOptions = getEntryOptions;
26
+ const getOptionsByEntryName = (name, optionsByEntries) => optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : undefined;
@@ -1 +1 @@
1
- export declare function getPackageManager(cwd?: string): Promise<"npm" | "yarn" | "pnpm">;
1
+ export declare function getPackageManager(cwd?: string): Promise<"npm" | "yarn" | "pnpm">;
@@ -0,0 +1,47 @@
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
+ exports.getPackageManager = void 0;
16
+ const os_1 = __importDefault(require("os"));
17
+ const path_1 = __importDefault(require("path"));
18
+ const compiled_1 = require("./compiled");
19
+ const nodeEnv_1 = require("./nodeEnv");
20
+ const MAX_TIMES = 5;
21
+ function getPackageManager(cwd = process.cwd()) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ let appDirectory = cwd;
24
+ let times = 0;
25
+ while (os_1.default.homedir() !== appDirectory && times < MAX_TIMES) {
26
+ times++;
27
+ if (compiled_1.fs.existsSync(path_1.default.resolve(appDirectory, 'pnpm-lock.yaml'))) {
28
+ return 'pnpm';
29
+ }
30
+ if (compiled_1.fs.existsSync(path_1.default.resolve(appDirectory, 'yarn.lock'))) {
31
+ return 'yarn';
32
+ }
33
+ if (compiled_1.fs.existsSync(path_1.default.resolve(appDirectory, 'package-lock.json'))) {
34
+ return 'npm';
35
+ }
36
+ appDirectory = path_1.default.join(appDirectory, '..');
37
+ }
38
+ if (yield (0, nodeEnv_1.canUsePnpm)()) {
39
+ return 'pnpm';
40
+ }
41
+ if (yield (0, nodeEnv_1.canUseYarn)()) {
42
+ return 'yarn';
43
+ }
44
+ return 'npm';
45
+ });
46
+ }
47
+ exports.getPackageManager = getPackageManager;
@@ -4,4 +4,4 @@
4
4
  * @param tryLimits - Maximum number of retries.
5
5
  * @returns Available port number.
6
6
  */
7
- export declare const getPort: (port: string | number, tryLimits?: number) => Promise<number>;
7
+ export declare const getPort: (port: string | number, tryLimits?: number) => Promise<number>;
@@ -0,0 +1,62 @@
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
+ exports.getPort = void 0;
16
+ const net_1 = __importDefault(require("net"));
17
+ const compiled_1 = require("./compiled");
18
+ const logger_1 = require("./logger");
19
+ /**
20
+ * Get available free port.
21
+ * @param port - Current port want to use.
22
+ * @param tryLimits - Maximum number of retries.
23
+ * @returns Available port number.
24
+ */
25
+ /* eslint-disable no-param-reassign, @typescript-eslint/no-loop-func */
26
+ const getPort = (port, tryLimits = 20) => __awaiter(void 0, void 0, void 0, function* () {
27
+ if (typeof port === 'string') {
28
+ port = parseInt(port, 10);
29
+ }
30
+ const original = port;
31
+ let found = false;
32
+ let attempts = 0;
33
+ while (!found && attempts <= tryLimits) {
34
+ try {
35
+ yield new Promise((resolve, reject) => {
36
+ const server = net_1.default.createServer();
37
+ server.unref();
38
+ server.on('error', reject);
39
+ server.listen({
40
+ port,
41
+ host: '0.0.0.0',
42
+ }, () => {
43
+ found = true;
44
+ server.close(resolve);
45
+ });
46
+ });
47
+ }
48
+ catch (e) {
49
+ if (e.code !== 'EADDRINUSE') {
50
+ throw e;
51
+ }
52
+ port++;
53
+ attempts++;
54
+ }
55
+ }
56
+ if (port !== original) {
57
+ logger_1.logger.info(compiled_1.chalk.red(`Something is already running on port ${original}. ${compiled_1.chalk.yellow(`Use port ${port} instead.`)}`));
58
+ }
59
+ return port;
60
+ });
61
+ exports.getPort = getPort;
62
+ /* eslint-enable no-param-reassign, @typescript-eslint/no-loop-func */
@@ -1,5 +1,5 @@
1
1
  declare const lazy: (moduleName: string, requireFn: (id: string) => unknown) => any;
2
2
  export { lazy as lazyImport };
3
3
  export declare const Import: {
4
- lazy: (moduleName: string, requireFn: (id: string) => unknown) => any;
5
- };
4
+ lazy: (moduleName: string, requireFn: (id: string) => unknown) => any;
5
+ };
package/dist/import.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Import = exports.lazyImport = void 0;
4
+ // cover: https://rushstack.io/pages/api/node-core-library.import.lazy/
5
+ const lazy = (moduleName, requireFn) => {
6
+ const importLazyLocal = require('../compiled/import-lazy')(requireFn);
7
+ return importLazyLocal(moduleName);
8
+ };
9
+ exports.lazyImport = lazy;
10
+ exports.Import = { lazy };
@@ -0,0 +1,31 @@
1
+ export * from './compiled';
2
+ export * from './format';
3
+ export * from './FileSizeReporter';
4
+ export * from './printBuildError';
5
+ export * from './debug';
6
+ export * from './findExists';
7
+ export * from './is';
8
+ export * from './compatRequire';
9
+ export * from './logger';
10
+ export * from './constants';
11
+ export * from './ensureAbsolutePath';
12
+ export * from './getCacheIdentifier';
13
+ export * from './clearConsole';
14
+ export * from './applyOptionsChain';
15
+ export * from './getBrowserslist';
16
+ export * from './removeSlash';
17
+ export * from './getEntryOptions';
18
+ export * from './getPort';
19
+ export * from './monorepo';
20
+ export * from './getPackageManager';
21
+ export * from './runtimeExports';
22
+ export * from './readTsConfig';
23
+ export * from './path';
24
+ export * from './generateMetaTags';
25
+ export * from './prettyInstructions';
26
+ export * from './alias';
27
+ export * from './import';
28
+ export * from './watch';
29
+ export * from './nodeEnv';
30
+ export * from './wait';
31
+ export * from './emptyDir';
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./compiled"), exports);
14
+ __exportStar(require("./format"), exports);
15
+ __exportStar(require("./FileSizeReporter"), exports);
16
+ __exportStar(require("./printBuildError"), exports);
17
+ __exportStar(require("./debug"), exports);
18
+ __exportStar(require("./findExists"), exports);
19
+ __exportStar(require("./is"), exports);
20
+ __exportStar(require("./compatRequire"), exports);
21
+ __exportStar(require("./logger"), exports);
22
+ __exportStar(require("./constants"), exports);
23
+ __exportStar(require("./ensureAbsolutePath"), exports);
24
+ __exportStar(require("./getCacheIdentifier"), exports);
25
+ __exportStar(require("./clearConsole"), exports);
26
+ __exportStar(require("./applyOptionsChain"), exports);
27
+ __exportStar(require("./getBrowserslist"), exports);
28
+ __exportStar(require("./removeSlash"), exports);
29
+ __exportStar(require("./getEntryOptions"), exports);
30
+ __exportStar(require("./getPort"), exports);
31
+ __exportStar(require("./monorepo"), exports);
32
+ __exportStar(require("./getPackageManager"), exports);
33
+ __exportStar(require("./runtimeExports"), exports);
34
+ __exportStar(require("./readTsConfig"), exports);
35
+ __exportStar(require("./path"), exports);
36
+ __exportStar(require("./generateMetaTags"), exports);
37
+ __exportStar(require("./prettyInstructions"), exports);
38
+ __exportStar(require("./alias"), exports);
39
+ __exportStar(require("./import"), exports);
40
+ __exportStar(require("./watch"), exports);
41
+ __exportStar(require("./nodeEnv"), exports);
42
+ __exportStar(require("./wait"), exports);
43
+ __exportStar(require("./emptyDir"), exports);
@@ -12,7 +12,6 @@ export declare const isDepExists: (appDirectory: string, name: string) => boolea
12
12
  * @param root - App directory.
13
13
  * @returns Whether to use typescript.
14
14
  */
15
-
16
15
  export declare const isTypescript: (root: string) => boolean;
17
16
  /**
18
17
  * Is Empty object
@@ -20,7 +19,6 @@ export declare const isTypescript: (root: string) => boolean;
20
19
  * @param o - Any object.
21
20
  * @returns Whether it is empty object.
22
21
  */
23
-
24
22
  export declare const isEmpty: (o: Record<string, unknown>) => boolean;
25
23
  /**
26
24
  * Is SSR project
@@ -28,10 +26,9 @@ export declare const isEmpty: (o: Record<string, unknown>) => boolean;
28
26
  * @param config - User config.
29
27
  * @returns Whether to use server side render.
30
28
  */
31
-
32
29
  export declare const isSSR: (config: any) => boolean;
33
30
  export declare const isUseSSRBundle: (config: any) => boolean;
34
31
  export declare const isFastRefresh: () => boolean;
35
32
  export * from './node-env';
36
33
  export * from './platform';
37
- export * from './type';
34
+ export * from './type';
@@ -0,0 +1,82 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.isFastRefresh = exports.isUseSSRBundle = exports.isSSR = exports.isEmpty = exports.isTypescript = exports.isDepExists = void 0;
17
+ const fs_1 = __importDefault(require("fs"));
18
+ const path_1 = __importDefault(require("path"));
19
+ const node_env_1 = require("./node-env");
20
+ /**
21
+ * Check if the package name is in dependencies or devDependencies.
22
+ *
23
+ * @param appDirectory - Project root directory.
24
+ * @param name - Package name.
25
+ * @returns True if the name is in dependencies or devDependencies, false otherwise.
26
+ */
27
+ const isDepExists = (appDirectory, name) => {
28
+ const json = require(path_1.default.resolve(appDirectory, './package.json'));
29
+ const { dependencies = {}, devDependencies = {} } = json;
30
+ return (dependencies.hasOwnProperty(name) || devDependencies.hasOwnProperty(name));
31
+ };
32
+ exports.isDepExists = isDepExists;
33
+ /**
34
+ * Is typescript project.
35
+ *
36
+ * @param root - App directory.
37
+ * @returns Whether to use typescript.
38
+ */
39
+ const isTypescript = (root) => fs_1.default.existsSync(path_1.default.resolve(root, './tsconfig.json'));
40
+ exports.isTypescript = isTypescript;
41
+ /**
42
+ * Is Empty object
43
+ *
44
+ * @param o - Any object.
45
+ * @returns Whether it is empty object.
46
+ */
47
+ const isEmpty = (o) => Object.entries(o).length === 0 && o.constructor === Object;
48
+ exports.isEmpty = isEmpty;
49
+ /**
50
+ * Is SSR project
51
+ *
52
+ * @param config - User config.
53
+ * @returns Whether to use server side render.
54
+ */
55
+ const isSSR = (config) => {
56
+ const { server } = config;
57
+ if (server === null || server === void 0 ? void 0 : server.ssr) {
58
+ return true;
59
+ }
60
+ if ((server === null || server === void 0 ? void 0 : server.ssrByEntries) && !(0, exports.isEmpty)(server.ssrByEntries)) {
61
+ for (const name of Object.keys(server.ssrByEntries)) {
62
+ if (server.ssrByEntries[name]) {
63
+ return true;
64
+ }
65
+ }
66
+ }
67
+ return false;
68
+ };
69
+ exports.isSSR = isSSR;
70
+ const isUseSSRBundle = (config) => {
71
+ const { output } = config;
72
+ if (output === null || output === void 0 ? void 0 : output.ssg) {
73
+ return true;
74
+ }
75
+ return (0, exports.isSSR)(config);
76
+ };
77
+ exports.isUseSSRBundle = isUseSSRBundle;
78
+ const isFastRefresh = () => (0, node_env_1.isDev)() && process.env.FAST_REFRESH !== 'false';
79
+ exports.isFastRefresh = isFastRefresh;
80
+ __exportStar(require("./node-env"), exports);
81
+ __exportStar(require("./platform"), exports);
82
+ __exportStar(require("./type"), exports);
@@ -1,4 +1,4 @@
1
1
  export declare const isDev: () => boolean;
2
2
  export declare const isProd: () => boolean;
3
3
  export declare const isTest: () => boolean;
4
- export declare const isProdProfile: () => boolean;
4
+ export declare const isProdProfile: () => boolean;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isProdProfile = exports.isTest = exports.isProd = exports.isDev = void 0;
4
+ const isDev = () => process.env.NODE_ENV === 'development';
5
+ exports.isDev = isDev;
6
+ const isProd = () => process.env.NODE_ENV === 'production';
7
+ exports.isProd = isProd;
8
+ const isTest = () => process.env.NODE_ENV === 'test';
9
+ exports.isTest = isTest;
10
+ // Variable used for enabling profiling in Production.
11
+ const isProdProfile = () => (0, exports.isProd)() && process.argv.includes('--profile');
12
+ exports.isProdProfile = isProdProfile;
@@ -0,0 +1,2 @@
1
+ export declare const isNodeJS: () => boolean;
2
+ export declare const isBrowser: () => boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBrowser = exports.isNodeJS = void 0;
4
+ const isNodeJS = () => typeof process !== 'undefined' &&
5
+ process.versions != null &&
6
+ process.versions.node != null &&
7
+ process.versions.electron == null;
8
+ exports.isNodeJS = isNodeJS;
9
+ const isBrowser = () => typeof window !== 'undefined';
10
+ exports.isBrowser = isBrowser;
@@ -5,4 +5,4 @@ export declare function isFunction(func: any): func is Function;
5
5
  export declare function isObject(obj: unknown): obj is Record<string, any>;
6
6
  export declare function isPlainObject(obj: unknown): obj is Record<string, any>;
7
7
  export declare function isPromise(obj: any): obj is Promise<any>;
8
- export declare function isRegExp(obj: any): obj is RegExp;
8
+ export declare function isRegExp(obj: any): obj is RegExp;