@modern-js/module-tools 2.0.0-beta.3 → 2.0.0-beta.6

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 (463) hide show
  1. package/CHANGELOG.md +331 -211
  2. package/bin/modern.js +1 -0
  3. package/compiled/@babel/code-frame/index.d.ts +1 -0
  4. package/compiled/@babel/code-frame/index.js +1 -0
  5. package/compiled/@babel/code-frame/license +22 -0
  6. package/compiled/@babel/code-frame/package.json +1 -0
  7. package/compiled/@babel/generator/index.d.ts +1 -0
  8. package/compiled/@babel/generator/index.js +1 -0
  9. package/compiled/@babel/generator/license +22 -0
  10. package/compiled/@babel/generator/package.json +1 -0
  11. package/compiled/@babel/helper-validator-identifier/index.d.ts +1 -0
  12. package/compiled/@babel/helper-validator-identifier/index.js +1 -0
  13. package/compiled/@babel/helper-validator-identifier/license +22 -0
  14. package/compiled/@babel/helper-validator-identifier/package.json +1 -0
  15. package/compiled/@babel/highlight/index.d.ts +1 -0
  16. package/compiled/@babel/highlight/index.js +1 -0
  17. package/compiled/@babel/highlight/license +22 -0
  18. package/compiled/@babel/highlight/package.json +1 -0
  19. package/compiled/@babel/parser/@babel/types/lib/index-legacy.d.ts +2742 -0
  20. package/compiled/@babel/parser/index.js +1 -0
  21. package/compiled/@babel/parser/license +19 -0
  22. package/compiled/@babel/parser/package.json +1 -0
  23. package/compiled/@babel/parser/typings/babel-parser.d.ts +214 -0
  24. package/compiled/@babel/template/index.d.ts +1 -0
  25. package/compiled/@babel/template/index.js +1 -0
  26. package/compiled/@babel/template/license +22 -0
  27. package/compiled/@babel/template/package.json +1 -0
  28. package/compiled/@babel/traverse/index.d.ts +1199 -0
  29. package/compiled/@babel/traverse/index.js +1 -0
  30. package/compiled/@babel/traverse/license +22 -0
  31. package/compiled/@babel/traverse/package.json +1 -0
  32. package/compiled/@babel/types/index.js +1 -0
  33. package/compiled/@babel/types/lib/index-legacy.d.ts +2732 -0
  34. package/compiled/@babel/types/license +22 -0
  35. package/compiled/@babel/types/package.json +1 -0
  36. package/compiled/@rollup/plugin-json/@rollup/pluginutils/types/index.d.ts +86 -0
  37. package/compiled/@rollup/plugin-json/estree/index.d.ts +548 -0
  38. package/compiled/@rollup/plugin-json/index.js +1 -0
  39. package/compiled/@rollup/plugin-json/license +21 -0
  40. package/compiled/@rollup/plugin-json/package.json +1 -0
  41. package/compiled/@rollup/plugin-json/rollup/dist/rollup.d.ts +948 -0
  42. package/compiled/@rollup/plugin-json/types/index.d.ts +41 -0
  43. package/compiled/find-up/index.d.ts +138 -0
  44. package/compiled/find-up/index.js +1 -0
  45. package/compiled/find-up/license +9 -0
  46. package/compiled/find-up/locate-path/index.d.ts +83 -0
  47. package/compiled/find-up/package.json +1 -0
  48. package/compiled/less/index.d.ts +282 -0
  49. package/compiled/less/index.js +1 -0
  50. package/compiled/less/package.json +1 -0
  51. package/compiled/normalize-path/index.d.ts +8 -0
  52. package/compiled/normalize-path/index.js +8 -0
  53. package/compiled/normalize-path/license +21 -0
  54. package/compiled/normalize-path/package.json +1 -0
  55. package/compiled/p-map/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
  56. package/compiled/p-map/cacheable-lookup/index.d.ts +139 -0
  57. package/compiled/p-map/cacheable-request/index.d.ts +137 -0
  58. package/compiled/p-map/got/dist/source/as-promise/index.d.ts +3 -0
  59. package/compiled/p-map/got/dist/source/as-promise/types.d.ts +256 -0
  60. package/compiled/p-map/got/dist/source/core/index.d.ts +1124 -0
  61. package/compiled/p-map/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
  62. package/compiled/p-map/got/dist/source/core/utils/options-to-url.d.ts +14 -0
  63. package/compiled/p-map/got/dist/source/core/utils/timed-out.d.ts +29 -0
  64. package/compiled/p-map/got/dist/source/index.d.ts +4 -0
  65. package/compiled/p-map/got/dist/source/types.d.ts +344 -0
  66. package/compiled/p-map/http-cache-semantics/index.d.ts +170 -0
  67. package/compiled/p-map/index.d.ts +67 -0
  68. package/compiled/p-map/index.js +1 -0
  69. package/compiled/p-map/keyv/src/index.d.ts +104 -0
  70. package/compiled/p-map/license +9 -0
  71. package/compiled/p-map/p-cancelable/index.d.ts +176 -0
  72. package/compiled/p-map/package.json +1 -0
  73. package/compiled/p-map/responselike/index.d.ts +34 -0
  74. package/compiled/postcss-custom-properties/index.d.ts +1 -0
  75. package/compiled/postcss-custom-properties/index.js +1 -0
  76. package/compiled/postcss-custom-properties/package.json +1 -0
  77. package/compiled/postcss-flexbugs-fixes/index.d.ts +1 -0
  78. package/compiled/postcss-flexbugs-fixes/index.js +1 -0
  79. package/compiled/postcss-flexbugs-fixes/license +20 -0
  80. package/compiled/postcss-flexbugs-fixes/package.json +1 -0
  81. package/compiled/postcss-font-variant/index.d.ts +1 -0
  82. package/compiled/postcss-font-variant/index.js +1 -0
  83. package/compiled/postcss-font-variant/license +20 -0
  84. package/compiled/postcss-font-variant/package.json +1 -0
  85. package/compiled/postcss-initial/index.d.ts +1 -0
  86. package/compiled/postcss-initial/index.js +1 -0
  87. package/compiled/postcss-initial/license +20 -0
  88. package/compiled/postcss-initial/package.json +1 -0
  89. package/compiled/postcss-media-minmax/index.d.ts +1 -0
  90. package/compiled/postcss-media-minmax/index.js +1 -0
  91. package/compiled/postcss-media-minmax/license +22 -0
  92. package/compiled/postcss-media-minmax/package.json +1 -0
  93. package/compiled/postcss-nesting/index.d.ts +1 -0
  94. package/compiled/postcss-nesting/index.js +2 -0
  95. package/compiled/postcss-nesting/package.json +1 -0
  96. package/compiled/postcss-page-break/index.d.ts +1 -0
  97. package/compiled/postcss-page-break/index.js +1 -0
  98. package/compiled/postcss-page-break/license +20 -0
  99. package/compiled/postcss-page-break/package.json +1 -0
  100. package/compiled/postcss-value-parser/index.d.ts +1 -0
  101. package/compiled/postcss-value-parser/index.js +1 -0
  102. package/compiled/postcss-value-parser/license +22 -0
  103. package/compiled/postcss-value-parser/package.json +1 -0
  104. package/compiled/rollup/fsevents.node +0 -0
  105. package/compiled/rollup/index.js +82 -0
  106. package/compiled/rollup/package.json +1 -0
  107. package/compiled/rollup/types/rollup.d.ts +948 -0
  108. package/compiled/rollup-plugin-dts/dist/rollup-plugin-dts.d.ts +21 -0
  109. package/compiled/rollup-plugin-dts/index.js +1 -0
  110. package/compiled/rollup-plugin-dts/package.json +1 -0
  111. package/compiled/rollup-plugin-dts/rollup/dist/rollup.d.ts +948 -0
  112. package/compiled/sass/index.js +1 -0
  113. package/compiled/sass/license +1619 -0
  114. package/compiled/sass/package.json +1 -0
  115. package/compiled/sass/types/compile.d.ts +152 -0
  116. package/compiled/sass/types/exception.d.ts +41 -0
  117. package/compiled/sass/types/importer.d.ts +294 -0
  118. package/compiled/sass/types/index.d.ts +80 -0
  119. package/compiled/sass/types/legacy/exception.d.ts +54 -0
  120. package/compiled/sass/types/legacy/function.d.ts +756 -0
  121. package/compiled/sass/types/legacy/importer.d.ts +168 -0
  122. package/compiled/sass/types/legacy/options.d.ts +642 -0
  123. package/compiled/sass/types/legacy/plugin_this.d.ts +73 -0
  124. package/compiled/sass/types/legacy/render.d.ts +139 -0
  125. package/compiled/sass/types/logger/index.d.ts +94 -0
  126. package/compiled/sass/types/logger/source_location.d.ts +21 -0
  127. package/compiled/sass/types/logger/source_span.d.ts +34 -0
  128. package/compiled/sass/types/options.d.ts +435 -0
  129. package/compiled/sass/types/util/promise_or.d.ts +17 -0
  130. package/compiled/sass/types/value/argument_list.d.ts +47 -0
  131. package/compiled/sass/types/value/boolean.d.ts +29 -0
  132. package/compiled/sass/types/value/color.d.ts +107 -0
  133. package/compiled/sass/types/value/function.d.ts +22 -0
  134. package/compiled/sass/types/value/index.d.ts +173 -0
  135. package/compiled/sass/types/value/list.d.ts +54 -0
  136. package/compiled/sass/types/value/map.d.ts +41 -0
  137. package/compiled/sass/types/value/number.d.ts +305 -0
  138. package/compiled/sass/types/value/string.d.ts +84 -0
  139. package/compiled/signal-exit/index.d.ts +24 -0
  140. package/compiled/signal-exit/index.js +1 -0
  141. package/compiled/signal-exit/package.json +1 -0
  142. package/dist/builder/build.d.ts +23 -0
  143. package/dist/builder/build.js +269 -0
  144. package/dist/builder/build.js.map +1 -0
  145. package/dist/builder/clear.d.ts +3 -0
  146. package/dist/builder/clear.js +67 -0
  147. package/dist/builder/clear.js.map +1 -0
  148. package/dist/builder/copy.d.ts +11 -0
  149. package/dist/builder/copy.js +196 -0
  150. package/dist/builder/copy.js.map +1 -0
  151. package/dist/builder/dts/index.d.ts +2 -0
  152. package/dist/builder/dts/index.js +32 -0
  153. package/dist/builder/dts/index.js.map +1 -0
  154. package/dist/builder/dts/rollup.d.ts +17 -0
  155. package/dist/builder/dts/rollup.js +167 -0
  156. package/dist/builder/dts/rollup.js.map +1 -0
  157. package/dist/builder/dts/tsc.d.ts +3 -0
  158. package/dist/builder/dts/tsc.js +153 -0
  159. package/dist/builder/dts/tsc.js.map +1 -0
  160. package/dist/builder/index.d.ts +8 -0
  161. package/dist/builder/index.js +116 -0
  162. package/dist/builder/index.js.map +1 -0
  163. package/dist/builder/platform.d.ts +4 -0
  164. package/dist/builder/platform.js +132 -0
  165. package/dist/builder/platform.js.map +1 -0
  166. package/dist/cli.d.ts +3 -0
  167. package/dist/cli.js +95 -0
  168. package/dist/cli.js.map +1 -0
  169. package/dist/command.d.ts +7 -0
  170. package/dist/command.js +164 -0
  171. package/dist/command.js.map +1 -0
  172. package/dist/config/defineConfig.d.ts +2 -0
  173. package/dist/config/defineConfig.js +29 -0
  174. package/dist/config/defineConfig.js.map +1 -0
  175. package/dist/config/normalize.d.ts +17 -0
  176. package/dist/config/normalize.js +168 -0
  177. package/dist/config/normalize.js.map +1 -0
  178. package/dist/config/schema.d.ts +641 -0
  179. package/dist/config/schema.js +215 -0
  180. package/dist/config/schema.js.map +1 -0
  181. package/dist/constants/build-presets.d.ts +81 -0
  182. package/dist/constants/build-presets.js +236 -0
  183. package/dist/constants/build-presets.js.map +1 -0
  184. package/dist/constants/build.d.ts +5 -0
  185. package/dist/constants/build.js +78 -0
  186. package/dist/constants/build.js.map +1 -0
  187. package/dist/constants/colors.d.ts +4 -0
  188. package/dist/constants/colors.js +35 -0
  189. package/dist/constants/colors.js.map +1 -0
  190. package/dist/constants/dts.d.ts +4 -0
  191. package/dist/constants/dts.js +52 -0
  192. package/dist/constants/dts.js.map +1 -0
  193. package/dist/constants/file.d.ts +3 -0
  194. package/dist/constants/file.js +35 -0
  195. package/dist/constants/file.js.map +1 -0
  196. package/dist/constants/legacy-build-presets.d.ts +13 -0
  197. package/dist/constants/legacy-build-presets.js +198 -0
  198. package/dist/constants/legacy-build-presets.js.map +1 -0
  199. package/dist/constants/log.d.ts +8 -0
  200. package/dist/constants/log.js +43 -0
  201. package/dist/constants/log.js.map +1 -0
  202. package/dist/dev.d.ts +10 -0
  203. package/dist/dev.js +129 -0
  204. package/dist/dev.js.map +1 -0
  205. package/dist/{types/features/build/error.d.ts → error.d.ts} +1 -1
  206. package/dist/error.js +148 -0
  207. package/dist/error.js.map +1 -0
  208. package/dist/hooks/build.d.ts +22 -0
  209. package/dist/hooks/build.js +39 -0
  210. package/dist/hooks/build.js.map +1 -0
  211. package/dist/hooks/dev.d.ts +12 -0
  212. package/dist/hooks/dev.js +37 -0
  213. package/dist/hooks/dev.js.map +1 -0
  214. package/dist/hooks/index.d.ts +29 -0
  215. package/dist/hooks/index.js +46 -0
  216. package/dist/hooks/index.js.map +1 -0
  217. package/dist/hooks/misc.d.ts +5 -0
  218. package/dist/hooks/misc.js +33 -0
  219. package/dist/hooks/misc.js.map +1 -0
  220. package/dist/index.d.ts +5 -0
  221. package/dist/index.js +37 -0
  222. package/dist/index.js.map +1 -0
  223. package/dist/{types/locale → locale}/en.d.ts +0 -0
  224. package/dist/locale/en.js +51 -0
  225. package/dist/locale/en.js.map +1 -0
  226. package/dist/{types/locale → locale}/index.d.ts +0 -0
  227. package/dist/locale/index.js +39 -0
  228. package/dist/locale/index.js.map +1 -0
  229. package/dist/{types/locale → locale}/zh.d.ts +0 -0
  230. package/dist/locale/zh.js +51 -0
  231. package/dist/locale/zh.js.map +1 -0
  232. package/dist/plugins.d.ts +2 -0
  233. package/dist/plugins.js +55 -0
  234. package/dist/plugins.js.map +1 -0
  235. package/dist/types/color.d.ts +1 -0
  236. package/dist/types/color.js +17 -0
  237. package/dist/types/color.js.map +1 -0
  238. package/dist/types/command.d.ts +11 -0
  239. package/dist/types/command.js +17 -0
  240. package/dist/types/command.js.map +1 -0
  241. package/dist/types/config/index.d.ts +92 -0
  242. package/dist/types/config/index.js +19 -0
  243. package/dist/types/config/index.js.map +1 -0
  244. package/dist/types/config/style.d.ts +12 -0
  245. package/dist/types/config/style.js +17 -0
  246. package/dist/types/config/style.js.map +1 -0
  247. package/dist/types/context.d.ts +5 -0
  248. package/dist/types/context.js +17 -0
  249. package/dist/types/context.js.map +1 -0
  250. package/dist/types/copy.d.ts +15 -0
  251. package/dist/types/copy.js +17 -0
  252. package/dist/types/copy.js.map +1 -0
  253. package/dist/types/{utils/tsconfig.d.ts → dts.d.ts} +11 -3
  254. package/dist/types/dts.js +17 -0
  255. package/dist/types/dts.js.map +1 -0
  256. package/dist/types/hooks.d.ts +25 -0
  257. package/dist/types/hooks.js +17 -0
  258. package/dist/types/hooks.js.map +1 -0
  259. package/dist/types/index.d.ts +17 -6
  260. package/dist/types/index.js +23 -0
  261. package/dist/types/index.js.map +1 -0
  262. package/dist/types/utils.d.ts +7 -0
  263. package/dist/types/utils.js +17 -0
  264. package/dist/types/utils.js.map +1 -0
  265. package/dist/utils/builder.d.ts +8 -0
  266. package/dist/utils/builder.js +104 -0
  267. package/dist/utils/builder.js.map +1 -0
  268. package/dist/utils/config.d.ts +6 -0
  269. package/dist/utils/config.js +167 -0
  270. package/dist/utils/config.js.map +1 -0
  271. package/dist/utils/context.d.ts +7 -0
  272. package/dist/utils/context.js +60 -0
  273. package/dist/utils/context.js.map +1 -0
  274. package/dist/utils/dts.d.ts +14 -0
  275. package/dist/utils/dts.js +186 -0
  276. package/dist/utils/dts.js.map +1 -0
  277. package/dist/utils/input.d.ts +16 -0
  278. package/dist/utils/input.js +113 -0
  279. package/dist/utils/input.js.map +1 -0
  280. package/dist/utils/language.d.ts +2 -0
  281. package/dist/utils/language.js +68 -0
  282. package/dist/utils/language.js.map +1 -0
  283. package/dist/utils/libuild-plugins.d.ts +6 -0
  284. package/dist/utils/libuild-plugins.js +83 -0
  285. package/dist/utils/libuild-plugins.js.map +1 -0
  286. package/dist/utils/log.d.ts +2 -0
  287. package/dist/utils/log.js +68 -0
  288. package/dist/utils/log.js.map +1 -0
  289. package/dist/utils/onExit.d.ts +1 -0
  290. package/dist/utils/onExit.js +63 -0
  291. package/dist/utils/onExit.js.map +1 -0
  292. package/dist/utils/path.d.ts +1 -0
  293. package/dist/utils/path.js +59 -0
  294. package/dist/utils/path.js.map +1 -0
  295. package/dist/utils/style.d.ts +31 -0
  296. package/dist/utils/style.js +129 -0
  297. package/dist/utils/style.js.map +1 -0
  298. package/dist/{types/utils/tspaths-transform/index.d.ts → utils/tspaths-transform.d.ts} +0 -0
  299. package/dist/utils/tspaths-transform.js +119 -0
  300. package/dist/utils/tspaths-transform.js.map +1 -0
  301. package/package.json +43 -72
  302. package/dist/js/modern/cli/build.js +0 -11
  303. package/dist/js/modern/cli/dev.js +0 -11
  304. package/dist/js/modern/cli/index.js +0 -3
  305. package/dist/js/modern/cli/new.js +0 -13
  306. package/dist/js/modern/commands/build.js +0 -69
  307. package/dist/js/modern/commands/dev.js +0 -43
  308. package/dist/js/modern/commands/index.js +0 -2
  309. package/dist/js/modern/features/build/build-platform.js +0 -69
  310. package/dist/js/modern/features/build/bundle/index.js +0 -9
  311. package/dist/js/modern/features/build/bundle/runRollup.js +0 -136
  312. package/dist/js/modern/features/build/bundle/runSpeedy.js +0 -176
  313. package/dist/js/modern/features/build/bundleless/copy-assets.js +0 -75
  314. package/dist/js/modern/features/build/bundleless/generator-dts/index.js +0 -106
  315. package/dist/js/modern/features/build/bundleless/generator-dts/utils.js +0 -94
  316. package/dist/js/modern/features/build/bundleless/index.js +0 -21
  317. package/dist/js/modern/features/build/bundleless/runBabel.js +0 -242
  318. package/dist/js/modern/features/build/bundleless/style.js +0 -241
  319. package/dist/js/modern/features/build/constants.js +0 -98
  320. package/dist/js/modern/features/build/error.js +0 -127
  321. package/dist/js/modern/features/build/index.js +0 -117
  322. package/dist/js/modern/features/build/legacy-constants.js +0 -103
  323. package/dist/js/modern/features/build/logger/index.js +0 -2
  324. package/dist/js/modern/features/build/logger/logText.js +0 -56
  325. package/dist/js/modern/features/build/logger/loggerManager.js +0 -93
  326. package/dist/js/modern/features/build/normalize.js +0 -277
  327. package/dist/js/modern/features/build/types.js +0 -0
  328. package/dist/js/modern/features/build/utils.js +0 -92
  329. package/dist/js/modern/features/dev/index.js +0 -47
  330. package/dist/js/modern/hooks/build.js +0 -20
  331. package/dist/js/modern/hooks/dev.js +0 -14
  332. package/dist/js/modern/hooks/index.js +0 -15
  333. package/dist/js/modern/index.js +0 -63
  334. package/dist/js/modern/locale/en.js +0 -25
  335. package/dist/js/modern/locale/index.js +0 -10
  336. package/dist/js/modern/locale/zh.js +0 -25
  337. package/dist/js/modern/schema/build-config.js +0 -117
  338. package/dist/js/modern/schema/index.js +0 -4
  339. package/dist/js/modern/schema/output.js +0 -45
  340. package/dist/js/modern/schema/source.js +0 -7
  341. package/dist/js/modern/schema/tools.js +0 -6
  342. package/dist/js/modern/schema/types.js +0 -0
  343. package/dist/js/modern/types.js +0 -0
  344. package/dist/js/modern/utils/babel.js +0 -84
  345. package/dist/js/modern/utils/color.js +0 -2
  346. package/dist/js/modern/utils/constants.js +0 -3
  347. package/dist/js/modern/utils/copy.js +0 -70
  348. package/dist/js/modern/utils/init-env.js +0 -13
  349. package/dist/js/modern/utils/json.js +0 -13
  350. package/dist/js/modern/utils/language.js +0 -6
  351. package/dist/js/modern/utils/logger.js +0 -96
  352. package/dist/js/modern/utils/readline.js +0 -17
  353. package/dist/js/modern/utils/tsconfig.js +0 -13
  354. package/dist/js/modern/utils/tspaths-transform/constants.js +0 -5
  355. package/dist/js/modern/utils/tspaths-transform/index.js +0 -113
  356. package/dist/js/modern/utils/tspaths-transform/utils.js +0 -18
  357. package/dist/js/modern/utils/valide.js +0 -26
  358. package/dist/js/node/cli/build.js +0 -18
  359. package/dist/js/node/cli/dev.js +0 -18
  360. package/dist/js/node/cli/index.js +0 -38
  361. package/dist/js/node/cli/new.js +0 -20
  362. package/dist/js/node/commands/build.js +0 -80
  363. package/dist/js/node/commands/dev.js +0 -52
  364. package/dist/js/node/commands/index.js +0 -19
  365. package/dist/js/node/features/build/build-platform.js +0 -76
  366. package/dist/js/node/features/build/bundle/index.js +0 -17
  367. package/dist/js/node/features/build/bundle/runRollup.js +0 -145
  368. package/dist/js/node/features/build/bundle/runSpeedy.js +0 -186
  369. package/dist/js/node/features/build/bundleless/copy-assets.js +0 -84
  370. package/dist/js/node/features/build/bundleless/generator-dts/index.js +0 -114
  371. package/dist/js/node/features/build/bundleless/generator-dts/utils.js +0 -105
  372. package/dist/js/node/features/build/bundleless/index.js +0 -29
  373. package/dist/js/node/features/build/bundleless/runBabel.js +0 -255
  374. package/dist/js/node/features/build/bundleless/style.js +0 -254
  375. package/dist/js/node/features/build/constants.js +0 -116
  376. package/dist/js/node/features/build/error.js +0 -139
  377. package/dist/js/node/features/build/index.js +0 -128
  378. package/dist/js/node/features/build/legacy-constants.js +0 -111
  379. package/dist/js/node/features/build/logger/index.js +0 -27
  380. package/dist/js/node/features/build/logger/logText.js +0 -66
  381. package/dist/js/node/features/build/logger/loggerManager.js +0 -95
  382. package/dist/js/node/features/build/normalize.js +0 -288
  383. package/dist/js/node/features/build/types.js +0 -0
  384. package/dist/js/node/features/build/utils.js +0 -107
  385. package/dist/js/node/features/dev/index.js +0 -56
  386. package/dist/js/node/hooks/build.js +0 -32
  387. package/dist/js/node/hooks/dev.js +0 -24
  388. package/dist/js/node/hooks/index.js +0 -36
  389. package/dist/js/node/index.js +0 -83
  390. package/dist/js/node/locale/en.js +0 -32
  391. package/dist/js/node/locale/index.js +0 -17
  392. package/dist/js/node/locale/zh.js +0 -32
  393. package/dist/js/node/schema/build-config.js +0 -126
  394. package/dist/js/node/schema/index.js +0 -11
  395. package/dist/js/node/schema/output.js +0 -52
  396. package/dist/js/node/schema/source.js +0 -14
  397. package/dist/js/node/schema/tools.js +0 -13
  398. package/dist/js/node/schema/types.js +0 -0
  399. package/dist/js/node/types.js +0 -0
  400. package/dist/js/node/utils/babel.js +0 -93
  401. package/dist/js/node/utils/color.js +0 -9
  402. package/dist/js/node/utils/constants.js +0 -11
  403. package/dist/js/node/utils/copy.js +0 -79
  404. package/dist/js/node/utils/init-env.js +0 -20
  405. package/dist/js/node/utils/json.js +0 -20
  406. package/dist/js/node/utils/language.js +0 -12
  407. package/dist/js/node/utils/logger.js +0 -107
  408. package/dist/js/node/utils/readline.js +0 -25
  409. package/dist/js/node/utils/tsconfig.js +0 -21
  410. package/dist/js/node/utils/tspaths-transform/constants.js +0 -12
  411. package/dist/js/node/utils/tspaths-transform/index.js +0 -123
  412. package/dist/js/node/utils/tspaths-transform/utils.js +0 -25
  413. package/dist/js/node/utils/valide.js +0 -34
  414. package/dist/types/cli/build.d.ts +0 -3
  415. package/dist/types/cli/dev.d.ts +0 -3
  416. package/dist/types/cli/index.d.ts +0 -3
  417. package/dist/types/cli/new.d.ts +0 -2
  418. package/dist/types/commands/build.d.ts +0 -17
  419. package/dist/types/commands/dev.d.ts +0 -5
  420. package/dist/types/commands/index.d.ts +0 -2
  421. package/dist/types/features/build/build-platform.d.ts +0 -7
  422. package/dist/types/features/build/bundle/index.d.ts +0 -3
  423. package/dist/types/features/build/bundle/runRollup.d.ts +0 -3
  424. package/dist/types/features/build/bundle/runSpeedy.d.ts +0 -10
  425. package/dist/types/features/build/bundleless/copy-assets.d.ts +0 -3
  426. package/dist/types/features/build/bundleless/generator-dts/index.d.ts +0 -3
  427. package/dist/types/features/build/bundleless/generator-dts/utils.d.ts +0 -21
  428. package/dist/types/features/build/bundleless/index.d.ts +0 -4
  429. package/dist/types/features/build/bundleless/runBabel.d.ts +0 -32
  430. package/dist/types/features/build/bundleless/style.d.ts +0 -25
  431. package/dist/types/features/build/constants.d.ts +0 -18
  432. package/dist/types/features/build/index.d.ts +0 -12
  433. package/dist/types/features/build/legacy-constants.d.ts +0 -8
  434. package/dist/types/features/build/logger/index.d.ts +0 -2
  435. package/dist/types/features/build/logger/logText.d.ts +0 -39
  436. package/dist/types/features/build/logger/loggerManager.d.ts +0 -40
  437. package/dist/types/features/build/normalize.d.ts +0 -19
  438. package/dist/types/features/build/types.d.ts +0 -15
  439. package/dist/types/features/build/utils.d.ts +0 -36
  440. package/dist/types/features/dev/index.d.ts +0 -9
  441. package/dist/types/hooks/build.d.ts +0 -46
  442. package/dist/types/hooks/dev.d.ts +0 -20
  443. package/dist/types/hooks/index.d.ts +0 -30
  444. package/dist/types/schema/build-config.d.ts +0 -205
  445. package/dist/types/schema/index.d.ts +0 -217
  446. package/dist/types/schema/output.d.ts +0 -215
  447. package/dist/types/schema/source.d.ts +0 -6
  448. package/dist/types/schema/tools.d.ts +0 -6
  449. package/dist/types/schema/types.d.ts +0 -45
  450. package/dist/types/types.d.ts +0 -51
  451. package/dist/types/utils/babel.d.ts +0 -8
  452. package/dist/types/utils/color.d.ts +0 -2
  453. package/dist/types/utils/constants.d.ts +0 -2
  454. package/dist/types/utils/copy.d.ts +0 -5
  455. package/dist/types/utils/init-env.d.ts +0 -21
  456. package/dist/types/utils/json.d.ts +0 -4
  457. package/dist/types/utils/language.d.ts +0 -1
  458. package/dist/types/utils/logger.d.ts +0 -58
  459. package/dist/types/utils/readline.d.ts +0 -9
  460. package/dist/types/utils/tspaths-transform/constants.d.ts +0 -1
  461. package/dist/types/utils/tspaths-transform/utils.d.ts +0 -4
  462. package/dist/types/utils/valide.d.ts +0 -12
  463. package/types.d.ts +0 -1
@@ -1,288 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.normalizeModuleConfig = exports.normalizeBuildConfig = exports.getSourceMap = exports.getNormalizeModuleConfigByPackageModeAndFileds = exports.getFinalTsconfig = exports.getFinalDts = void 0;
7
- var _utils = require("@modern-js/utils");
8
- var _lodash = require("@modern-js/utils/lodash");
9
- var _constants = require("../../utils/constants");
10
- 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; }
11
- 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; }
12
- 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; }
13
- const constants = _utils.Import.lazy('./constants', require);
14
- const legacyConstants = _utils.Import.lazy('./legacy-constants', require);
15
- const getNormalizeModuleConfigByPackageModeAndFileds = (api, buildFeatOption) => {
16
- const {
17
- output: {
18
- packageMode,
19
- packageFields,
20
- disableTsChecker,
21
- importStyle
22
- }
23
- } = api.useResolvedConfigContext();
24
- let configs = [];
25
- if (buildFeatOption.styleOnly) {
26
- configs.push({
27
- buildType: 'bundleless',
28
- outputPath: './js/styles',
29
- bundlelessOptions: {
30
- sourceDir: './src',
31
- style: {
32
- compileMode: importStyle === 'source-code' ? 'only-source-code' : 'all'
33
- }
34
- }
35
- });
36
- configs.push({
37
- buildType: 'bundleless',
38
- outputPath: './styles',
39
- bundlelessOptions: {
40
- sourceDir: './styles',
41
- style: {
42
- compileMode: 'only-compiled-code'
43
- }
44
- }
45
- });
46
- return configs;
47
- }
48
- const commonConfig = {
49
- buildType: 'bundleless',
50
- bundlelessOptions: {
51
- sourceDir: './src',
52
- style: {
53
- path: '../styles',
54
- compileMode: false
55
- },
56
- static: {
57
- path: '../styles'
58
- }
59
- },
60
- outputPath: './'
61
- };
62
- commonConfig.tsconfig = getFinalTsconfig(commonConfig, buildFeatOption);
63
- if (!packageFields || typeof packageFields === 'object' && Object.keys(packageFields).length === 0) {
64
- const buildConfigs = legacyConstants.PACKAGE_MODES[packageMode || legacyConstants.DEFAULT_PACKAGE_MODE];
65
- configs = buildConfigs.map(config => _utils.lodash.mergeWith({}, commonConfig, config));
66
- } else {
67
- const getConfigsByJsSyntaxType = (js, outputPath) => {
68
- if (js === 'CJS+ES6') {
69
- return _utils.lodash.mergeWith({}, commonConfig, {
70
- format: 'cjs',
71
- target: 'es6',
72
- outputPath
73
- });
74
- } else if (js === 'ESM+ES5') {
75
- return _utils.lodash.mergeWith({}, commonConfig, {
76
- format: 'esm',
77
- target: 'es5',
78
- outputPath
79
- });
80
- }
81
- return _utils.lodash.mergeWith({}, commonConfig, {
82
- format: 'esm',
83
- target: 'es6',
84
- outputPath
85
- });
86
- };
87
- if (!packageFields['jsnext:modern'] && !packageFields.main && !packageFields.module) {
88
- throw new Error(`Unrecognized ${JSON.stringify(packageFields)} configuration, please use keys: 'modern, main, jupiter:modern' and use values: 'CJS+ES6, ESM+ES5, ESM+ES6'`);
89
- }
90
- // The fields configured in packageFields correspond to the main, module, and jsnext:modern fields on package.json,
91
- // and can also be used on package.json exports field.
92
- if (packageFields['jsnext:modern']) {
93
- configs.push(getConfigsByJsSyntaxType(packageFields['jsnext:modern'], 'js/modern'));
94
- }
95
- if (packageFields.main) {
96
- configs.push(getConfigsByJsSyntaxType(packageFields.main, 'js/node'));
97
- }
98
- if (packageFields.module) {
99
- configs.push(getConfigsByJsSyntaxType(packageFields.module, 'js/treeshaking'));
100
- }
101
- }
102
- if (configs.length > 0) {
103
- const firstConfig = configs[0];
104
- firstConfig.bundlelessOptions = _utils.lodash.mergeWith({}, firstConfig.bundlelessOptions, {
105
- style: {
106
- compileMode: importStyle === 'source-code' ? 'only-source-code' : 'all'
107
- }
108
- });
109
- }
110
-
111
- // [compatibe mode]: dts gen
112
- if (buildFeatOption.legacyTsc && !disableTsChecker) {
113
- configs.push({
114
- buildType: 'bundleless',
115
- outputPath: './types',
116
- enableDts: true,
117
- dtsOnly: true
118
- });
119
- }
120
- configs.push({
121
- buildType: 'bundleless',
122
- outputPath: './styles',
123
- bundlelessOptions: {
124
- sourceDir: './styles',
125
- style: {
126
- compileMode: 'only-compiled-code'
127
- }
128
- }
129
- });
130
- return configs;
131
- };
132
- exports.getNormalizeModuleConfigByPackageModeAndFileds = getNormalizeModuleConfigByPackageModeAndFileds;
133
- const getFinalTsconfig = (config, buildFeatOption) => {
134
- var _config$tsconfig;
135
- // cli tsconfig option > buildPreset tsconfig option
136
-
137
- // Since tsconfig configuration has default values,
138
- // compare the two to see if the user is configured with cli tsconfig
139
- if (buildFeatOption.tsconfigName !== _constants.cliTsConfigDefaultValue) {
140
- // TODO: transform tsconfig to absPath
141
- return buildFeatOption.tsconfigName;
142
- }
143
- return (_config$tsconfig = config.tsconfig) !== null && _config$tsconfig !== void 0 ? _config$tsconfig : './tsconfig.json';
144
- };
145
- exports.getFinalTsconfig = getFinalTsconfig;
146
- const getFinalDts = (config, buildFeatOption) => {
147
- var _config$enableDts;
148
- // is js project, should return false
149
- if (!buildFeatOption.isTsProject) {
150
- return false;
151
- }
152
- // when `build --dts`, then all build tasks`s enableDts is true
153
- if (buildFeatOption.enableDtsGen) {
154
- return true;
155
- }
156
- return (_config$enableDts = config.enableDts) !== null && _config$enableDts !== void 0 ? _config$enableDts : false;
157
- };
158
- exports.getFinalDts = getFinalDts;
159
- const getSourceMap = (config, buildType, api) => {
160
- // TODO: remove
161
- const {
162
- output: {
163
- disableSourceMap
164
- }
165
- } = api.useResolvedConfigContext();
166
- if (disableSourceMap) {
167
- return false;
168
- }
169
- if (config.sourceMap !== undefined) {
170
- return config.sourceMap;
171
- }
172
- return buildType === 'bundle';
173
- };
174
- exports.getSourceMap = getSourceMap;
175
- const normalizeBuildConfig = (context, buildConfig, deps = []) => {
176
- const {
177
- buildFeatOption,
178
- api
179
- } = context;
180
- const configArray = Array.isArray(buildConfig) ? buildConfig : [buildConfig];
181
- const normalizedModule = configArray.map(config => {
182
- var _config$format, _config$target, _bundleOptions$skipDe, _bundleOptions$minify, _bundleOptions$splitt, _config$outputPath, _config$dtsOnly;
183
- const format = (_config$format = config.format) !== null && _config$format !== void 0 ? _config$format : 'cjs';
184
- const target = (_config$target = config.target) !== null && _config$target !== void 0 ? _config$target : 'esnext';
185
- const {
186
- bundleOptions
187
- } = config;
188
- const skipDeps = (_bundleOptions$skipDe = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.skipDeps) !== null && _bundleOptions$skipDe !== void 0 ? _bundleOptions$skipDe : true;
189
- const externals = skipDeps === false ? (bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.externals) || [] : [...deps.map(dep => new RegExp(`^${dep}($|\\/|\\\\)`)), ...((bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.externals) || [])];
190
- const normalizedBundleOption = _objectSpread(_objectSpread({}, bundleOptions), {}, {
191
- entry: (bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.entry) || {
192
- index: `src/index.${buildFeatOption.isTsProject ? 'ts' : 'js'}`
193
- },
194
- platform: (bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.platform) || 'node',
195
- minify: (_bundleOptions$minify = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.minify) !== null && _bundleOptions$minify !== void 0 ? _bundleOptions$minify : false,
196
- externals,
197
- splitting: (_bundleOptions$splitt = bundleOptions === null || bundleOptions === void 0 ? void 0 : bundleOptions.splitting) !== null && _bundleOptions$splitt !== void 0 ? _bundleOptions$splitt : false,
198
- skipDeps
199
- });
200
- const normalizedBundlelessOptions = (0, _lodash.mergeWith)({}, {
201
- sourceDir: './src',
202
- style: {
203
- compileMode: 'all',
204
- path: './'
205
- },
206
- static: {
207
- path: './'
208
- }
209
- }, config.bundlelessOptions);
210
- const watch = buildFeatOption.enableWatchMode || false;
211
- const tsconfig = getFinalTsconfig(config, buildFeatOption);
212
- const enableDts = getFinalDts(config, buildFeatOption);
213
- const outputPath = (_config$outputPath = config.outputPath) !== null && _config$outputPath !== void 0 ? _config$outputPath : './';
214
- const sourceMap = getSourceMap(config, config.buildType, api);
215
- const dtsOnly = (_config$dtsOnly = config.dtsOnly) !== null && _config$dtsOnly !== void 0 ? _config$dtsOnly : false;
216
- const commmonConfig = {
217
- format,
218
- target,
219
- watch,
220
- tsconfig,
221
- enableDts,
222
- outputPath,
223
- dtsOnly,
224
- sourceMap
225
- };
226
- if (!buildFeatOption.isTsProject && (dtsOnly || enableDts)) {
227
- console.warn('[WARN] dtsOnly、enableDts 配置仅在 Ts 项目下生效');
228
- } else if (buildFeatOption.isTsProject && dtsOnly && !enableDts) {
229
- console.warn('[WARN] dtsOnly 配置仅在 enableDts 为 true 的时候生效. 请检查当前的 dtsOnly、enableDts 是否配置正确');
230
- }
231
- if (config.buildType === 'bundle') {
232
- return _objectSpread(_objectSpread({}, commmonConfig), {}, {
233
- buildType: 'bundle',
234
- bundleOptions: normalizedBundleOption
235
- });
236
- } else {
237
- return _objectSpread(_objectSpread({}, commmonConfig), {}, {
238
- buildType: 'bundleless',
239
- bundlelessOptions: normalizedBundlelessOptions
240
- });
241
- }
242
- });
243
- return normalizedModule;
244
- };
245
- exports.normalizeBuildConfig = normalizeBuildConfig;
246
- const normalizeModuleConfig = context => {
247
- const {
248
- buildFeatOption,
249
- api,
250
- deps
251
- } = context;
252
- const {
253
- output: {
254
- buildConfig,
255
- buildPreset
256
- }
257
- } = api.useResolvedConfigContext();
258
-
259
- // buildConfig is the most important.
260
- if (buildConfig) {
261
- return normalizeBuildConfig(context, buildConfig, deps);
262
- }
263
-
264
- // buildPreset is the second important. It can be used when buildConfig is not defined.
265
- // buildPreset -> buildConfig
266
- if (buildPreset) {
267
- const {
268
- unPresetConfigs,
269
- unPresetWithTargetConfigs
270
- } = constants;
271
- if (unPresetConfigs[buildPreset]) {
272
- return normalizeBuildConfig(context, unPresetConfigs[buildPreset], deps);
273
- } else if (unPresetWithTargetConfigs[buildPreset]) {
274
- return normalizeBuildConfig(context, unPresetWithTargetConfigs[buildPreset], deps);
275
- }
276
-
277
- // If the buildPreset is not found, then it is used 'npm-library'
278
- // TODO: Warning: The buildPreset 'npm-library' is not supported.
279
- return normalizeBuildConfig(context, unPresetConfigs['npm-library'], deps);
280
- }
281
-
282
- // If the user does not configure buildConfig and buildPreset,
283
- // the configuration is generated based on packageMode and packageField
284
- const legacyBuildConfig = getNormalizeModuleConfigByPackageModeAndFileds(api, buildFeatOption);
285
- return normalizeBuildConfig(context, legacyBuildConfig, deps);
286
- };
287
- /* eslint-enable max-lines */
288
- exports.normalizeModuleConfig = normalizeModuleConfig;
File without changes
@@ -1,107 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.watchSectionTitle = exports.logTemplate = exports.getPostcssOption = exports.getAllDeps = exports.SectionTitleStatus = exports.LogStack = void 0;
7
- var os = _interopRequireWildcard(require("os"));
8
- var _path = _interopRequireDefault(require("path"));
9
- var _utils = require("@modern-js/utils");
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- 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); }
12
- 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; }
13
- 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; }
14
- const constants = _utils.Import.lazy('./constants', require);
15
-
16
- /**
17
- * 处理日志信息
18
- */
19
- class LogStack {
20
- constructor() {
21
- _defineProperty(this, "_codeLogStack", void 0);
22
- this._codeLogStack = [];
23
- }
24
- update(latestLog, {
25
- splitEOL = false
26
- } = {}) {
27
- if (splitEOL) {
28
- latestLog.split(os.EOL).forEach(log => {
29
- this._codeLogStack.unshift(log.trim());
30
- });
31
- return;
32
- }
33
- this._codeLogStack.unshift(latestLog.trim());
34
- }
35
- clear() {
36
- this._codeLogStack = [];
37
- }
38
- get value() {
39
- return [...new Set(this._codeLogStack)];
40
- }
41
- }
42
- exports.LogStack = LogStack;
43
- const logTemplate = (title, messageStack, maxLength, {
44
- noBottomBorder: _noBottomBorder = false,
45
- bottomBorderText: _bottomBorderText = '',
46
- noLeftBorder: _noLeftBorder = false,
47
- leftBorder: _leftBorder = '│',
48
- contentColor: _contentColor = s => s
49
- } = {}) => {
50
- const leftBorderFlag = _noLeftBorder ? '' : _leftBorder;
51
- const messageFragments = messageStack.map(p => {
52
- p.trim();
53
- return `${leftBorderFlag}${p.replace(constants.clearFlag, '')}`;
54
- }) // 移除 clearFlag
55
- .slice(0, maxLength) // 控制长度
56
- .filter(s => s !== leftBorderFlag) // 过滤空字符串
57
- .reverse(); // 调换顺序,最新的消息在最后面
58
- const template = `${title}:
59
- ${_contentColor(messageFragments.join(os.EOL))}${_noBottomBorder ? '' : `\n${_bottomBorderText}`}`;
60
- return template;
61
- };
62
- exports.logTemplate = logTemplate;
63
- let SectionTitleStatus;
64
- exports.SectionTitleStatus = SectionTitleStatus;
65
- (function (SectionTitleStatus) {
66
- SectionTitleStatus[SectionTitleStatus["Success"] = 0] = "Success";
67
- SectionTitleStatus[SectionTitleStatus["Fail"] = 1] = "Fail";
68
- SectionTitleStatus[SectionTitleStatus["Log"] = 2] = "Log";
69
- })(SectionTitleStatus || (exports.SectionTitleStatus = SectionTitleStatus = {}));
70
- const watchSectionTitle = (str, status) => {
71
- if (status === SectionTitleStatus.Success) {
72
- return `${_utils.chalk.bgWhite.gray.underline(str)} ${_utils.chalk.green.underline('Successful')}`;
73
- } else if (status === SectionTitleStatus.Fail) {
74
- return `${_utils.chalk.bgWhite.gray.underline(str)} ${_utils.chalk.red.underline('Build Failed')}`;
75
- }
76
- return `${_utils.chalk.bgWhite.gray.underline(str)} ${_utils.chalk.blue.underline('Log')}`;
77
- };
78
-
79
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
80
- exports.watchSectionTitle = watchSectionTitle;
81
- const getPostcssOption = (...args) => {
82
- // const postcssOption: any = cssConfig.getPostcssConfig(
83
- // appDirectory,
84
- // modernConfig,
85
- // false,
86
- // );
87
- return {
88
- plugins: [],
89
- enableSourceMap: false,
90
- // plugins: postcssOption?.postcssOptions?.plugins || [],
91
- // enableSourceMap: (postcssOption as any)?.sourceMap || false,
92
- options: {}
93
- };
94
- };
95
- exports.getPostcssOption = getPostcssOption;
96
- const getAllDeps = appDirectory => {
97
- try {
98
- const json = JSON.parse(_utils.fs.readFileSync(_path.default.resolve(appDirectory, './package.json'), 'utf8'));
99
-
100
- // return json[packageJsonConfig ?? PACKAGE_JSON_CONFIG_NAME] as T | undefined;
101
- return [...Object.keys(json.dependencies || {}), ...Object.keys(json.devDependencies || {}), ...Object.keys(json.peerDependencies || {})];
102
- } catch (e) {
103
- console.warn('[WARN] package.json is broken');
104
- return [];
105
- }
106
- };
107
- exports.getAllDeps = getAllDeps;
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.showMenu = exports.runSubCmd = exports.devStorybook = void 0;
7
- var _utils = require("@modern-js/utils");
8
- const color = _utils.Import.lazy('../../utils/color', require);
9
- const showMenu = async (api, config) => {
10
- const runners = api.useHookRunners();
11
- const metas = await runners.moduleToolsMenu(undefined);
12
- if (metas.length <= 0) {
13
- console.info(_utils.chalk.yellow('No runnable development features found.\nYou can use the `new` command to enable the development features'));
14
- // eslint-disable-next-line no-process-exit
15
- process.exit(0);
16
- }
17
- const menuMessage = color.devMenuTitle('Select the debug mode:');
18
- const {
19
- type
20
- } = await _utils.inquirer.prompt([{
21
- name: 'type',
22
- message: menuMessage,
23
- type: 'list',
24
- choices: metas
25
- }]);
26
- const devMeta = metas.find(meta => meta.value === type);
27
- if (devMeta) {
28
- await devMeta.runTask(config);
29
- }
30
- };
31
- exports.showMenu = showMenu;
32
- const devStorybook = async (api, config) => {
33
- const runners = api.useHookRunners();
34
- const metas = await runners.moduleToolsMenu(undefined);
35
- const findStorybook = metas.find(meta => meta.value === 'storybook');
36
- if (findStorybook) {
37
- await findStorybook.runTask(config);
38
- } else {
39
- console.info(_utils.chalk.yellow('No development features found.\nYou can use the `new` command to enable the development features'));
40
- // eslint-disable-next-line no-process-exit
41
- process.exit(0);
42
- }
43
- };
44
- exports.devStorybook = devStorybook;
45
- const runSubCmd = async (api, subCmd, config) => {
46
- const runners = api.useHookRunners();
47
- const metas = await runners.moduleToolsMenu(undefined);
48
- const devMeta = metas.find(meta => meta.value === subCmd || Array.isArray(meta.aliasValues) && meta.aliasValues.includes(subCmd));
49
- if (devMeta) {
50
- await devMeta.runTask(config);
51
- } else {
52
- // eslint-disable-next-line no-process-exit
53
- process.exit(0);
54
- }
55
- };
56
- exports.runSubCmd = runSubCmd;
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.platformBuild = exports.moduleTailwindConfig = exports.moduleSassConfig = exports.moduleLessConfig = exports.lifecycle = exports.buildHooks = void 0;
7
- var _plugin = require("@modern-js/plugin");
8
- var _core = require("@modern-js/core");
9
- const platformBuild = (0, _plugin.createParallelWorkflow)();
10
- exports.platformBuild = platformBuild;
11
- const moduleLessConfig = (0, _plugin.createAsyncPipeline)();
12
- exports.moduleLessConfig = moduleLessConfig;
13
- const moduleSassConfig = (0, _plugin.createAsyncPipeline)();
14
- exports.moduleSassConfig = moduleSassConfig;
15
- const moduleTailwindConfig = (0, _plugin.createAsyncPipeline)();
16
- exports.moduleTailwindConfig = moduleTailwindConfig;
17
- const buildHooks = {
18
- platformBuild,
19
- moduleLessConfig,
20
- moduleSassConfig,
21
- moduleTailwindConfig
22
- };
23
- exports.buildHooks = buildHooks;
24
- const lifecycle = () => {
25
- (0, _core.registerHook)({
26
- moduleLessConfig,
27
- moduleSassConfig,
28
- moduleTailwindConfig,
29
- platformBuild
30
- });
31
- };
32
- exports.lifecycle = lifecycle;
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.moduleToolsMenu = exports.lifecycle = exports.devHooks = exports.afterDev = void 0;
7
- var _plugin = require("@modern-js/plugin");
8
- var _core = require("@modern-js/core");
9
- const moduleToolsMenu = (0, _plugin.createParallelWorkflow)();
10
- exports.moduleToolsMenu = moduleToolsMenu;
11
- const afterDev = (0, _plugin.createAsyncWorkflow)();
12
- exports.afterDev = afterDev;
13
- const devHooks = {
14
- moduleToolsMenu,
15
- afterDev
16
- };
17
- exports.devHooks = devHooks;
18
- const lifecycle = () => {
19
- (0, _core.registerHook)({
20
- moduleToolsMenu,
21
- afterDev
22
- });
23
- };
24
- exports.lifecycle = lifecycle;
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.addRuntimeExports = void 0;
7
- Object.defineProperty(exports, "buildLifeCycle", {
8
- enumerable: true,
9
- get: function () {
10
- return _build.lifecycle;
11
- }
12
- });
13
- Object.defineProperty(exports, "devLifeCycle", {
14
- enumerable: true,
15
- get: function () {
16
- return _dev.lifecycle;
17
- }
18
- });
19
- exports.lifecycle = exports.hooks = void 0;
20
- var _plugin = require("@modern-js/plugin");
21
- var _build = require("./build");
22
- var _dev = require("./dev");
23
- 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; }
24
- 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; }
25
- 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; }
26
- const lifecycle = () => {
27
- (0, _dev.lifecycle)();
28
- (0, _build.lifecycle)();
29
- };
30
- exports.lifecycle = lifecycle;
31
- const addRuntimeExports = (0, _plugin.createAsyncWaterfall)();
32
- exports.addRuntimeExports = addRuntimeExports;
33
- const hooks = _objectSpread(_objectSpread(_objectSpread({}, _build.buildHooks), _dev.devHooks), {}, {
34
- addRuntimeExports
35
- });
36
- exports.hooks = hooks;
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var _exportNames = {};
7
- exports.default = void 0;
8
- var _utils = require("@modern-js/utils");
9
- var _pluginChangeset = _interopRequireDefault(require("@modern-js/plugin-changeset"));
10
- var _pluginLint = _interopRequireDefault(require("@modern-js/plugin-lint"));
11
- var _hooks = require("./hooks");
12
- var _types = require("./types");
13
- Object.keys(_types).forEach(function (key) {
14
- if (key === "default" || key === "__esModule") return;
15
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
16
- if (key in exports && exports[key] === _types[key]) return;
17
- Object.defineProperty(exports, key, {
18
- enumerable: true,
19
- get: function () {
20
- return _types[key];
21
- }
22
- });
23
- });
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
- const upgradeModel = _utils.Import.lazy('@modern-js/upgrade', require);
26
- const cli = _utils.Import.lazy('./cli', require);
27
- const local = _utils.Import.lazy('./locale', require);
28
- const schema = _utils.Import.lazy('./schema', require);
29
- const lang = _utils.Import.lazy('./utils/language', require);
30
-
31
- // export { defineConfig } from '@modern-js/core';
32
-
33
- const isBuildMode = process.argv.slice(2)[0] === 'build';
34
- var _default = () => ({
35
- name: '@modern-js/module-tools',
36
- post: ['@modern-js/plugin-changeset'],
37
- registerHook: _hooks.hooks,
38
- usePlugins: isBuildMode ? [] : [(0, _pluginChangeset.default)(), (0, _pluginLint.default)()],
39
- setup: api => {
40
- const locale = lang.getLocaleLanguage();
41
- local.i18n.changeLanguage({
42
- locale
43
- });
44
- return {
45
- // copy from @modern-js/app-tools/src/analyze/index.ts
46
- async prepare() {
47
- const appContext = api.useAppContext();
48
- const hookRunners = api.useHookRunners();
49
- try {
50
- _utils.fs.emptydirSync(appContext.internalDirectory);
51
- } catch (_unused) {
52
- // FIXME:
53
- }
54
- await hookRunners.addRuntimeExports();
55
- },
56
- validateSchema() {
57
- return schema.addSchema();
58
- },
59
- config() {
60
- return {
61
- source: {},
62
- output: {
63
- enableSourceMap: false,
64
- jsPath: 'js'
65
- },
66
- tools: {}
67
- };
68
- },
69
- commands({
70
- program
71
- }) {
72
- cli.devCli(program, api);
73
- cli.buildCli(program, api);
74
- cli.newCli(program, locale);
75
- upgradeModel.defineCommand(program.command('upgrade'));
76
-
77
- // 便于其他插件辨别
78
- program.$$libraryName = 'module-tools';
79
- }
80
- };
81
- }
82
- });
83
- exports.default = _default;
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EN_LOCALE = void 0;
7
- const EN_LOCALE = {
8
- command: {
9
- build: {
10
- describe: 'command for building module',
11
- watch: 'building module in watch mode',
12
- tsconfig: 'Specify a path to the tsconfig.json file',
13
- style_only: 'only build style',
14
- platform: 'build the specified task or all tasks, If exist. (tasks: "storybook", "docs")',
15
- no_tsc: 'close tsc compiler to emit d.ts (Deprecated)',
16
- dts: 'Turn on dts generation and type checking',
17
- no_clear: 'disable auto clear dist dir',
18
- config: 'specify config file'
19
- },
20
- dev: {
21
- describe: 'start dev server'
22
- },
23
- new: {
24
- describe: 'generator runner for modern project',
25
- debug: 'using debug mode to log something',
26
- config: 'set default generator config(json string)',
27
- distTag: `use specified tag version for it's generator`,
28
- registry: 'set npm registry url to run npm command'
29
- }
30
- }
31
- };
32
- exports.EN_LOCALE = EN_LOCALE;
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.localeKeys = exports.i18n = void 0;
7
- var _utils = require("@modern-js/utils");
8
- var _zh = require("./zh");
9
- var _en = require("./en");
10
- const i18nPlugin = _utils.Import.lazy('@modern-js/plugin-i18n', require);
11
- const i18n = new i18nPlugin.I18n();
12
- exports.i18n = i18n;
13
- const localeKeys = i18n.init('zh', {
14
- zh: _zh.ZH_LOCALE,
15
- en: _en.EN_LOCALE
16
- });
17
- exports.localeKeys = localeKeys;