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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -1,333 +0,0 @@
1
- /**
2
- * hmr socket connect path
3
- */
4
- export const HMR_SOCK_PATH = '/_modern_js_hmr_ws';
5
- /**
6
- * route specification file
7
- */
8
-
9
- export const ROUTE_SPEC_FILE = 'route.json';
10
- /**
11
- * main entry name
12
- */
13
-
14
- export const MAIN_ENTRY_NAME = 'main';
15
- /**
16
- * open editor request path
17
- */
18
-
19
- export const LAUNCH_EDITOR_ENDPOINT = '/__open-stack-frame-in-editor';
20
- /**
21
- * server side bundles directory, which relative to dist.
22
- */
23
-
24
- export const SERVER_BUNDLE_DIRECTORY = 'bundles';
25
- /**
26
- * entry name pattern used for ajv pattern properties.
27
- */
28
-
29
- export const ENTRY_NAME_PATTERN = '^[a-zA-Z0-9_-]+$';
30
- /**
31
- * SSR server render function name
32
- */
33
-
34
- export const SERVER_RENDER_FUNCTION_NAME = 'serverRender';
35
- /**
36
- * loadbale manifest json file
37
- */
38
-
39
- export const LOADABLE_STATS_FILE = 'loadable-stats.json';
40
- /**
41
- * internal specified folder
42
- */
43
-
44
- export const API_DIR = 'api';
45
- export const SERVER_DIR = 'server';
46
- export const SHARED_DIR = 'shared';
47
- /**
48
- * Internal plugins that work as soon as they are installed.
49
- */
50
-
51
- export const INTERNAL_PLUGINS = {
52
- '@modern-js/app-tools': {
53
- cli: '@modern-js/app-tools/cli'
54
- },
55
- '@modern-js/monorepo-tools': {
56
- cli: '@modern-js/monorepo-tools/cli'
57
- },
58
- '@modern-js/module-tools': {
59
- cli: '@modern-js/module-tools/cli'
60
- },
61
- '@modern-js/runtime': {
62
- cli: '@modern-js/runtime/cli'
63
- },
64
- '@modern-js/plugin-less': {
65
- cli: '@modern-js/plugin-less/cli'
66
- },
67
- '@modern-js/plugin-sass': {
68
- cli: '@modern-js/plugin-sass/cli'
69
- },
70
- '@modern-js/plugin-esbuild': {
71
- cli: '@modern-js/plugin-esbuild/cli'
72
- },
73
- '@modern-js/plugin-proxy': {
74
- cli: '@modern-js/plugin-proxy/cli'
75
- },
76
- '@modern-js/plugin-ssg': {
77
- cli: '@modern-js/plugin-ssg/cli'
78
- },
79
- '@modern-js/plugin-bff': {
80
- cli: '@modern-js/plugin-bff/cli',
81
- server: '@modern-js/plugin-bff/server'
82
- },
83
- '@modern-js/plugin-electron': {
84
- cli: '@modern-js/plugin-electron/cli'
85
- },
86
- '@modern-js/plugin-testing': {
87
- cli: '@modern-js/plugin-testing/cli'
88
- },
89
- '@modern-js/plugin-storybook': {
90
- cli: '@modern-js/plugin-storybook/cli'
91
- },
92
- '@modern-js/plugin-docsite': {
93
- cli: '@modern-js/plugin-docsite/cli'
94
- },
95
- '@modern-js/plugin-express': {
96
- cli: '@modern-js/plugin-express/cli',
97
- server: '@modern-js/plugin-express'
98
- },
99
- '@modern-js/plugin-egg': {
100
- cli: '@modern-js/plugin-egg/cli',
101
- server: '@modern-js/plugin-egg'
102
- },
103
- '@modern-js/plugin-koa': {
104
- cli: '@modern-js/plugin-koa/cli',
105
- server: '@modern-js/plugin-koa'
106
- },
107
- '@modern-js/plugin-nest': {
108
- cli: '@modern-js/plugin-nest/cli',
109
- server: '@modern-js/plugin-nest/server'
110
- },
111
- '@modern-js/plugin-unbundle': {
112
- cli: '@modern-js/plugin-unbundle'
113
- },
114
- '@modern-js/plugin-server-build': {
115
- cli: '@modern-js/plugin-server-build'
116
- },
117
- '@modern-js/plugin-server': {
118
- cli: '@modern-js/plugin-server/cli',
119
- server: '@modern-js/plugin-server/server'
120
- },
121
- '@modern-js/plugin-garfish': {
122
- cli: '@modern-js/plugin-garfish/cli'
123
- },
124
- '@modern-js/plugin-jarvis': {
125
- cli: '@modern-js/plugin-jarvis/cli'
126
- },
127
- '@modern-js/plugin-tailwindcss': {
128
- cli: '@modern-js/plugin-tailwindcss/cli'
129
- },
130
- '@modern-js/plugin-lambda-fc': {
131
- cli: '@modern-js/plugin-lambda-fc/cli'
132
- },
133
- '@modern-js/plugin-lambda-scf': {
134
- cli: '@modern-js/plugin-lambda-scf/cli'
135
- },
136
- '@modern-js/plugin-cdn-oss': {
137
- cli: '@modern-js/plugin-cdn-oss/cli'
138
- },
139
- '@modern-js/plugin-cdn-cos': {
140
- cli: '@modern-js/plugin-cdn-cos/cli'
141
- },
142
- '@modern-js/plugin-static-hosting': {
143
- cli: '@modern-js/plugin-static-hosting/cli'
144
- },
145
- '@modern-js/plugin-polyfill': {
146
- cli: '@modern-js/plugin-polyfill/cli',
147
- server: '@modern-js/plugin-polyfill'
148
- },
149
- '@modern-js/plugin-multiprocess': {
150
- cli: '@modern-js/plugin-multiprocess/cli'
151
- },
152
- '@modern-js/plugin-nocode': {
153
- cli: '@modern-js/plugin-nocode/cli'
154
- },
155
- '@modern-js/plugin-design-token': {
156
- cli: '@modern-js/plugin-design-token/cli'
157
- }
158
- };
159
- /**
160
- * The schema registered in the plugin.
161
- */
162
-
163
- export const PLUGIN_SCHEMAS = {
164
- '@modern-js/runtime': [{
165
- target: 'runtime',
166
- schema: {
167
- type: 'object',
168
- additionalProperties: false
169
- }
170
- }, {
171
- target: 'runtimeByEntries',
172
- schema: {
173
- type: 'object',
174
- patternProperties: {
175
- [ENTRY_NAME_PATTERN]: {
176
- type: 'object'
177
- }
178
- },
179
- additionalProperties: false
180
- }
181
- }],
182
- '@modern-js/plugin-bff': [{
183
- target: 'bff',
184
- schema: {
185
- type: 'object',
186
- properties: {
187
- prefix: {
188
- type: ['string', 'array'],
189
- items: {
190
- type: 'string'
191
- }
192
- },
193
- fetcher: {
194
- type: 'string'
195
- },
196
- proxy: {
197
- type: 'object'
198
- },
199
- requestCreator: {
200
- type: 'string'
201
- }
202
- }
203
- }
204
- }],
205
- '@modern-js/plugin-esbuild': [{
206
- target: 'tools.esbuild',
207
- schema: {
208
- typeof: ['object']
209
- }
210
- }],
211
- '@modern-js/plugin-less': [{
212
- target: 'tools.less',
213
- schema: {
214
- typeof: ['object', 'function']
215
- }
216
- }],
217
- '@modern-js/plugin-sass': [{
218
- target: 'tools.sass',
219
- schema: {
220
- typeof: ['object', 'function']
221
- }
222
- }],
223
- '@modern-js/plugin-tailwindcss': [{
224
- target: 'tools.tailwindcss',
225
- schema: {
226
- typeof: ['object', 'function']
227
- }
228
- }],
229
- '@modern-js/plugin-proxy': [{
230
- target: 'dev.proxy',
231
- schema: {
232
- typeof: ['string', 'object']
233
- }
234
- }],
235
- '@modern-js/plugin-unbundle': [{
236
- target: 'output.disableAutoImportStyle',
237
- schema: {
238
- type: 'boolean'
239
- }
240
- }, {
241
- target: 'dev.unbundle',
242
- schema: {
243
- type: 'object',
244
- properties: {
245
- ignore: {
246
- type: ['string', 'array'],
247
- items: {
248
- type: 'string'
249
- }
250
- },
251
- ignoreModuleCache: {
252
- type: 'boolean'
253
- },
254
- clearPdnCache: {
255
- type: 'boolean'
256
- },
257
- pdnHost: {
258
- type: 'string'
259
- }
260
- }
261
- }
262
- }],
263
- '@modern-js/plugin-ssg': [{
264
- target: 'output.ssg',
265
- schema: {
266
- oneOf: [{
267
- type: 'boolean'
268
- }, {
269
- type: 'object'
270
- }, {
271
- instanceof: 'Function'
272
- }]
273
- }
274
- }],
275
- '@modern-js/plugin-ssr': [{
276
- target: 'runtime.ssr',
277
- schema: {
278
- type: ['boolean', 'object']
279
- }
280
- }],
281
- '@modern-js/plugin-state': [{
282
- target: 'runtime.state',
283
- schema: {
284
- type: ['boolean', 'object']
285
- }
286
- }],
287
- '@modern-js/plugin-design-token': [// Legacy Features
288
- {
289
- target: 'source.designSystem',
290
- schema: {
291
- typeof: ['object']
292
- }
293
- }, {
294
- target: 'source.designSystem.supportStyledComponents',
295
- schema: {
296
- type: ['boolean']
297
- }
298
- }],
299
- '@modern-js/plugin-router': [{
300
- target: 'runtime.router',
301
- schema: {
302
- type: ['boolean', 'object']
303
- }
304
- }],
305
- '@modern-js/plugin-testing': [{
306
- target: 'testing',
307
- schema: {
308
- typeof: ['object']
309
- }
310
- }, {
311
- target: 'tools.jest',
312
- schema: {
313
- typeof: ['object', 'function']
314
- }
315
- }],
316
- '@modern-js/plugin-garfish': [{
317
- target: 'runtime.masterApp',
318
- schema: {
319
- type: ['boolean', 'object']
320
- }
321
- }, {
322
- target: 'dev.withMasterApp',
323
- schema: {
324
- type: ['object']
325
- }
326
- }, {
327
- target: 'deploy.microFrontend',
328
- schema: {
329
- type: ['boolean', 'object']
330
- }
331
- }],
332
- '@modern-js/plugin-nocode': []
333
- };
@@ -1,6 +0,0 @@
1
- import fs from 'fs-extra';
2
- export const emptyDir = async dir => {
3
- if (await fs.pathExists(dir)) {
4
- await fs.emptyDir(dir);
5
- }
6
- };
@@ -1,16 +0,0 @@
1
- import fs from 'fs';
2
- /**
3
- * Find first already exists file.
4
- * @param files - Asbolute file paths with extension.
5
- * @returns The file path if exists, or false if no file exists.
6
- */
7
-
8
- export const findExists = files => {
9
- for (const file of files) {
10
- if (fs.existsSync(file) && fs.statSync(file).isFile()) {
11
- return file;
12
- }
13
- }
14
-
15
- return false;
16
- };
@@ -1,137 +0,0 @@
1
- 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; }
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
- /* eslint-disable no-param-reassign */
8
-
9
- /* eslint-disable max-statements */
10
-
11
- /**
12
- * Copyright (c) 2015-present, Facebook, Inc.
13
- *
14
- * This source code is licensed under the MIT license found in the
15
- * LICENSE file at
16
- * https://github.com/facebook/create-react-app/blob/master/LICENSE
17
- */
18
- // Modified by Chao Xu (xuchaobei)
19
- const friendlySyntaxErrorLabel = 'Syntax error:';
20
-
21
- function isLikelyASyntaxError(message) {
22
- return message.includes(friendlySyntaxErrorLabel);
23
- } // Cleans up webpack error messages.
24
-
25
-
26
- function formatMessage(message) {
27
- var _lines$;
28
-
29
- let lines = []; // webpack 5 stats error object
30
-
31
- if (typeof message === 'object') {
32
- message = `${message.moduleName && `${message.moduleName}\n`}${message.details || message.stack || message.message}`;
33
- }
34
-
35
- lines = message.split('\n'); // Strip webpack-added headers off errors/warnings
36
- // https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
37
-
38
- lines = lines.filter(line => !/Module [A-z ]+\(from/.test(line)); // Transform parsing error into syntax error
39
-
40
- lines = lines.map(line => {
41
- const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec(line);
42
-
43
- if (!parsingError) {
44
- return line;
45
- }
46
-
47
- const [, errorLine, errorColumn, errorMessage] = parsingError;
48
- return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`;
49
- });
50
- message = lines.join('\n'); // Smoosh syntax errors (commonly found in CSS)
51
-
52
- message = message.replace(/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, `${friendlySyntaxErrorLabel} $3 ($1:$2)\n`);
53
- lines = message.split('\n'); // Remove leading newline
54
-
55
- if (lines.length > 2 && lines[1].trim() === '') {
56
- lines.splice(1, 1);
57
- } // Clean up file name
58
-
59
-
60
- lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1'); // Cleans up verbose "module not found" messages for files and packages.
61
-
62
- if ((_lines$ = lines[1]) !== null && _lines$ !== void 0 && _lines$.startsWith('Module not found: ')) {
63
- lines = [lines[0], lines[1].replace('Error: ', '').replace('Module not found: Cannot find file:', 'Cannot find file:').replace('[CaseSensitivePathsPlugin] ', '').replace("Cannot resolve 'file' or 'directory' ", '')];
64
- }
65
-
66
- message = lines.join('\n'); // Internal stacks are generally useless so we strip them... with the
67
- // exception of stacks containing `webpack:` because they're normally
68
- // from user code generated by webpack. For more information see
69
- // https://github.com/facebook/create-react-app/pull/1050
70
-
71
- message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
72
-
73
- message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous>
74
-
75
- lines = message.split('\n'); // Remove duplicated newlines
76
-
77
- lines = lines.filter((line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()); // Reassemble the message
78
-
79
- message = lines.join('\n');
80
- return message.trim();
81
- }
82
-
83
- function formatWebpackMessages(json) {
84
- var _json$errors, _json$warnings, _result$errors;
85
-
86
- const formattedErrors = (_json$errors = json.errors) === null || _json$errors === void 0 ? void 0 : _json$errors.map(formatMessage);
87
- const formattedWarnings = (_json$warnings = json.warnings) === null || _json$warnings === void 0 ? void 0 : _json$warnings.map(formatMessage);
88
- const result = {
89
- errors: formattedErrors || [],
90
- warnings: formattedWarnings || []
91
- };
92
-
93
- if ((_result$errors = result.errors) !== null && _result$errors !== void 0 && _result$errors.some(isLikelyASyntaxError)) {
94
- // If there are any syntax errors, show just them.
95
- result.errors = result.errors.filter(isLikelyASyntaxError);
96
- } // First error is usually it.
97
-
98
-
99
- if (result.errors.length > 1) {
100
- result.errors.length = 1;
101
- }
102
-
103
- return result;
104
- }
105
-
106
- export { formatWebpackMessages };
107
- /* eslint-enable max-statements */
108
-
109
- /* eslint-enable no-param-reassign */
110
-
111
- function formatProxyOptions(proxyOptions) {
112
- const formatedProxy = [];
113
-
114
- if (!Array.isArray(proxyOptions)) {
115
- if ('target' in proxyOptions) {
116
- formatedProxy.push(proxyOptions);
117
- } else {
118
- Array.prototype.push.apply(formatedProxy, Object.keys(proxyOptions).reduce((total, source) => {
119
- const option = proxyOptions[source];
120
- total.push(_objectSpread({
121
- context: source,
122
- changeOrigin: true,
123
- logLevel: 'warn'
124
- }, typeof option === 'string' ? {
125
- target: option
126
- } : option));
127
- return total;
128
- }, []));
129
- }
130
- } else {
131
- formatedProxy.push(...proxyOptions);
132
- }
133
-
134
- return formatedProxy;
135
- }
136
-
137
- export { formatProxyOptions };
@@ -1,49 +0,0 @@
1
- /**
2
- * Copyright JS Foundation and other contributors.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file at
6
- * https://github.com/jantimon/html-webpack-plugin/blob/main/LICENSE
7
- *
8
- * Modified from https://github.com/jantimon/html-webpack-plugin/blob/2f5de7ab9e8bca60e9e200f2e4b4cfab90db28d4/index.js#L800
9
- */
10
- const tagObjectToString = tagDefinition => {
11
- const attributes = Object.keys(tagDefinition.attributes || {}).filter(attributeName => tagDefinition.attributes[attributeName] !== false).map(attributeName => {
12
- if (tagDefinition.attributes[attributeName] === true) {
13
- return attributeName;
14
- }
15
-
16
- return `${attributeName}="${tagDefinition.attributes[attributeName]}"`;
17
- });
18
- return `<${[tagDefinition.tagName].concat(attributes).join(' ')}>${tagDefinition.innerHTML || ''}${tagDefinition.voidTag ? '' : `</${tagDefinition.tagName}>`}`;
19
- };
20
-
21
- export const generateMetaTags = metaOptions => {
22
- if (!metaOptions) {
23
- return '';
24
- } // Make tags self-closing in case of xhtml
25
- // Turn { "viewport" : "width=500, initial-scale=1" } into
26
- // [{ name:"viewport" content:"width=500, initial-scale=1" }]
27
-
28
-
29
- const metaTagAttributeObjects = Object.keys(metaOptions).map(metaName => {
30
- const metaTagContent = metaOptions[metaName];
31
- return typeof metaTagContent === 'string' ? {
32
- name: metaName,
33
- content: metaTagContent
34
- } : metaTagContent;
35
- }).filter(attribute => attribute !== false); // Turn [{ name:"viewport" content:"width=500, initial-scale=1" }] into
36
- // the html-webpack-plugin tag structure
37
-
38
- return metaTagAttributeObjects.map(metaTagAttributes => {
39
- if (metaTagAttributes === false) {
40
- throw new Error('Invalid meta tag');
41
- }
42
-
43
- return {
44
- tagName: 'meta',
45
- voidTag: true,
46
- attributes: metaTagAttributes
47
- };
48
- }).reduce((memo, tagObject) => `${memo}\n${tagObjectToString(tagObject)}`, '');
49
- };
@@ -1,5 +0,0 @@
1
- import { loadConfig } from 'browserslist';
2
- export const defaults = ['> 0.01%', 'not dead', 'not op_mini all'];
3
- export const getBrowserslist = appDirectory => loadConfig({
4
- path: appDirectory
5
- }) || defaults;
@@ -1,20 +0,0 @@
1
- import { isProd, isDev, isTest } from "./is";
2
- /**
3
- * Generate cache identifier from some packages and config files.
4
- */
5
-
6
- export function getCacheIdentifier(packages, _files) {
7
- /* eslint-disable no-nested-ternary */
8
- let cacheIdentifier = isProd() ? 'production' : isDev() ? 'development' : isTest() ? 'test' : '';
9
- /* eslint-enable no-nested-ternary */
10
-
11
- for (const {
12
- name,
13
- version
14
- } of packages) {
15
- cacheIdentifier += `:${name}@${version}`;
16
- } // TODO: config file hash
17
-
18
-
19
- return cacheIdentifier;
20
- }
@@ -1,24 +0,0 @@
1
- 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; }
2
-
3
- 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; }
4
-
5
- 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; }
6
-
7
- import { isPlainObject } from "./is";
8
- import { MAIN_ENTRY_NAME } from "./constants";
9
- export const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
10
- if (optionsByEntries) {
11
- let optionsByEntry = getOptionsByEntryName(name, optionsByEntries); // compatible with main entry using packageName as the key
12
-
13
- if (optionsByEntry === undefined && name === MAIN_ENTRY_NAME && packageName) {
14
- optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
15
- } // eslint-disable-next-line no-nested-ternary
16
-
17
-
18
- return optionsByEntry !== undefined ? isPlainObject(optionsByEntry) && isPlainObject(baseOptions) ? _objectSpread(_objectSpread({}, baseOptions), optionsByEntry) : optionsByEntry : baseOptions;
19
- } else {
20
- return baseOptions;
21
- }
22
- };
23
-
24
- const getOptionsByEntryName = (name, optionsByEntries) => optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : undefined;
@@ -1,37 +0,0 @@
1
- import os from 'os';
2
- import path from 'path';
3
- import fs from 'fs-extra';
4
- import { canUsePnpm, canUseYarn } from "./nodeEnv";
5
- const MAX_TIMES = 5;
6
- export async function getPackageManager(cwd = process.cwd()) {
7
- let appDirectory = cwd;
8
- let times = 0;
9
-
10
- while (os.homedir() !== appDirectory && times < MAX_TIMES) {
11
- times++;
12
-
13
- if (fs.existsSync(path.resolve(appDirectory, 'pnpm-lock.yaml'))) {
14
- return 'pnpm';
15
- }
16
-
17
- if (fs.existsSync(path.resolve(appDirectory, 'yarn.lock'))) {
18
- return 'yarn';
19
- }
20
-
21
- if (fs.existsSync(path.resolve(appDirectory, 'package-lock.json'))) {
22
- return 'npm';
23
- }
24
-
25
- appDirectory = path.join(appDirectory, '..');
26
- }
27
-
28
- if (await canUsePnpm()) {
29
- return 'pnpm';
30
- }
31
-
32
- if (await canUseYarn()) {
33
- return 'yarn';
34
- }
35
-
36
- return 'npm';
37
- }
@@ -1,52 +0,0 @@
1
- import net from 'net';
2
- import { chalk } from "./chalk";
3
- import { logger } from "./logger";
4
- /**
5
- * Get available free port.
6
- * @param port - Current port want to use.
7
- * @param tryLimits - Maximum number of retries.
8
- * @returns Available port number.
9
- */
10
-
11
- /* eslint-disable no-param-reassign, @typescript-eslint/no-loop-func */
12
-
13
- export const getPort = async (port, tryLimits = 20) => {
14
- if (typeof port === 'string') {
15
- port = parseInt(port, 10);
16
- }
17
-
18
- const original = port;
19
- let found = false;
20
- let attempts = 0;
21
-
22
- while (!found && attempts <= tryLimits) {
23
- try {
24
- await new Promise((resolve, reject) => {
25
- const server = net.createServer();
26
- server.unref();
27
- server.on('error', reject);
28
- server.listen({
29
- port,
30
- host: '0.0.0.0'
31
- }, () => {
32
- found = true;
33
- server.close(resolve);
34
- });
35
- });
36
- } catch (e) {
37
- if (e.code !== 'EADDRINUSE') {
38
- throw e;
39
- }
40
-
41
- port++;
42
- attempts++;
43
- }
44
- }
45
-
46
- if (port !== original) {
47
- logger.info(chalk.red(`Something is already running on port ${original}. ${chalk.yellow(`Use port ${port} instead.`)}`));
48
- }
49
-
50
- return port;
51
- };
52
- /* eslint-enable no-param-reassign, @typescript-eslint/no-loop-func */