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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (449) hide show
  1. package/CHANGELOG.md +207 -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 +265 -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 +74 -0
  147. package/dist/builder/clear.js.map +1 -0
  148. package/dist/builder/copy.d.ts +9 -0
  149. package/dist/builder/copy.js +207 -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 +27 -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 +180 -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 +160 -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 +124 -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 +140 -0
  165. package/dist/builder/platform.js.map +1 -0
  166. package/dist/cli.d.ts +3 -0
  167. package/dist/cli.js +103 -0
  168. package/dist/cli.js.map +1 -0
  169. package/dist/command.d.ts +7 -0
  170. package/dist/command.js +169 -0
  171. package/dist/command.js.map +1 -0
  172. package/dist/config/defineConfig.d.ts +2 -0
  173. package/dist/config/defineConfig.js +25 -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 +177 -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 +207 -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 +219 -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 +71 -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 +29 -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 +45 -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 +29 -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 +189 -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 +36 -0
  201. package/dist/constants/log.js.map +1 -0
  202. package/dist/dev.d.ts +10 -0
  203. package/dist/dev.js +135 -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 +139 -0
  207. package/dist/error.js.map +1 -0
  208. package/dist/hooks/build.d.ts +22 -0
  209. package/dist/hooks/build.js +35 -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 +33 -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 +44 -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 +29 -0
  219. package/dist/hooks/misc.js.map +1 -0
  220. package/dist/index.d.ts +5 -0
  221. package/dist/index.js +32 -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 +47 -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 +34 -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 +47 -0
  231. package/dist/locale/zh.js.map +1 -0
  232. package/dist/plugins.d.ts +2 -0
  233. package/dist/plugins.js +51 -0
  234. package/dist/plugins.js.map +1 -0
  235. package/dist/types/color.d.ts +1 -0
  236. package/dist/{js/modern/features/build/types.js → types/color.js} +0 -0
  237. package/dist/types/command.d.ts +11 -0
  238. package/dist/{js/modern/schema/types.js → types/command.js} +0 -0
  239. package/dist/types/config/index.d.ts +95 -0
  240. package/dist/types/config/index.js +19 -0
  241. package/dist/types/config/index.js.map +1 -0
  242. package/dist/types/config/style.d.ts +12 -0
  243. package/dist/{js/modern/types.js → types/config/style.js} +0 -0
  244. package/dist/types/context.d.ts +5 -0
  245. package/dist/{js/node/features/build/types.js → types/context.js} +0 -0
  246. package/dist/types/copy.d.ts +15 -0
  247. package/dist/{js/node/schema/types.js → types/copy.js} +0 -0
  248. package/dist/types/{utils/tsconfig.d.ts → dts.d.ts} +11 -3
  249. package/dist/{js/node/types.js → types/dts.js} +0 -0
  250. package/dist/types/hooks.d.ts +25 -0
  251. package/dist/types/hooks.js +0 -0
  252. package/dist/types/index.d.ts +17 -6
  253. package/dist/types/index.js +23 -0
  254. package/dist/types/index.js.map +1 -0
  255. package/dist/types/utils.d.ts +7 -0
  256. package/dist/types/utils.js +0 -0
  257. package/dist/utils/builder.d.ts +8 -0
  258. package/dist/utils/builder.js +117 -0
  259. package/dist/utils/builder.js.map +1 -0
  260. package/dist/utils/config.d.ts +6 -0
  261. package/dist/utils/config.js +172 -0
  262. package/dist/utils/config.js.map +1 -0
  263. package/dist/utils/context.d.ts +7 -0
  264. package/dist/utils/context.js +68 -0
  265. package/dist/utils/context.js.map +1 -0
  266. package/dist/utils/dts.d.ts +14 -0
  267. package/dist/utils/dts.js +197 -0
  268. package/dist/utils/dts.js.map +1 -0
  269. package/dist/utils/input.d.ts +16 -0
  270. package/dist/utils/input.js +124 -0
  271. package/dist/utils/input.js.map +1 -0
  272. package/dist/utils/language.d.ts +2 -0
  273. package/dist/utils/language.js +75 -0
  274. package/dist/utils/language.js.map +1 -0
  275. package/dist/utils/libuild-plugins.d.ts +6 -0
  276. package/dist/utils/libuild-plugins.js +90 -0
  277. package/dist/utils/libuild-plugins.js.map +1 -0
  278. package/dist/utils/log.d.ts +2 -0
  279. package/dist/utils/log.js +76 -0
  280. package/dist/utils/log.js.map +1 -0
  281. package/dist/utils/onExit.d.ts +1 -0
  282. package/dist/utils/onExit.js +71 -0
  283. package/dist/utils/onExit.js.map +1 -0
  284. package/dist/utils/path.d.ts +1 -0
  285. package/dist/utils/path.js +73 -0
  286. package/dist/utils/path.js.map +1 -0
  287. package/dist/utils/style.d.ts +31 -0
  288. package/dist/utils/style.js +134 -0
  289. package/dist/utils/style.js.map +1 -0
  290. package/dist/{types/utils/tspaths-transform/index.d.ts → utils/tspaths-transform.d.ts} +0 -0
  291. package/dist/utils/tspaths-transform.js +115 -0
  292. package/dist/utils/tspaths-transform.js.map +1 -0
  293. package/package.json +45 -72
  294. package/dist/js/modern/cli/build.js +0 -11
  295. package/dist/js/modern/cli/dev.js +0 -11
  296. package/dist/js/modern/cli/index.js +0 -3
  297. package/dist/js/modern/cli/new.js +0 -13
  298. package/dist/js/modern/commands/build.js +0 -69
  299. package/dist/js/modern/commands/dev.js +0 -43
  300. package/dist/js/modern/commands/index.js +0 -2
  301. package/dist/js/modern/features/build/build-platform.js +0 -69
  302. package/dist/js/modern/features/build/bundle/index.js +0 -9
  303. package/dist/js/modern/features/build/bundle/runRollup.js +0 -136
  304. package/dist/js/modern/features/build/bundle/runSpeedy.js +0 -176
  305. package/dist/js/modern/features/build/bundleless/copy-assets.js +0 -75
  306. package/dist/js/modern/features/build/bundleless/generator-dts/index.js +0 -106
  307. package/dist/js/modern/features/build/bundleless/generator-dts/utils.js +0 -94
  308. package/dist/js/modern/features/build/bundleless/index.js +0 -21
  309. package/dist/js/modern/features/build/bundleless/runBabel.js +0 -242
  310. package/dist/js/modern/features/build/bundleless/style.js +0 -241
  311. package/dist/js/modern/features/build/constants.js +0 -98
  312. package/dist/js/modern/features/build/error.js +0 -127
  313. package/dist/js/modern/features/build/index.js +0 -117
  314. package/dist/js/modern/features/build/legacy-constants.js +0 -103
  315. package/dist/js/modern/features/build/logger/index.js +0 -2
  316. package/dist/js/modern/features/build/logger/logText.js +0 -56
  317. package/dist/js/modern/features/build/logger/loggerManager.js +0 -93
  318. package/dist/js/modern/features/build/normalize.js +0 -277
  319. package/dist/js/modern/features/build/utils.js +0 -92
  320. package/dist/js/modern/features/dev/index.js +0 -47
  321. package/dist/js/modern/hooks/build.js +0 -20
  322. package/dist/js/modern/hooks/dev.js +0 -14
  323. package/dist/js/modern/hooks/index.js +0 -15
  324. package/dist/js/modern/index.js +0 -63
  325. package/dist/js/modern/locale/en.js +0 -25
  326. package/dist/js/modern/locale/index.js +0 -10
  327. package/dist/js/modern/locale/zh.js +0 -25
  328. package/dist/js/modern/schema/build-config.js +0 -117
  329. package/dist/js/modern/schema/index.js +0 -4
  330. package/dist/js/modern/schema/output.js +0 -45
  331. package/dist/js/modern/schema/source.js +0 -7
  332. package/dist/js/modern/schema/tools.js +0 -6
  333. package/dist/js/modern/utils/babel.js +0 -84
  334. package/dist/js/modern/utils/color.js +0 -2
  335. package/dist/js/modern/utils/constants.js +0 -3
  336. package/dist/js/modern/utils/copy.js +0 -70
  337. package/dist/js/modern/utils/init-env.js +0 -13
  338. package/dist/js/modern/utils/json.js +0 -13
  339. package/dist/js/modern/utils/language.js +0 -6
  340. package/dist/js/modern/utils/logger.js +0 -96
  341. package/dist/js/modern/utils/readline.js +0 -17
  342. package/dist/js/modern/utils/tsconfig.js +0 -13
  343. package/dist/js/modern/utils/tspaths-transform/constants.js +0 -5
  344. package/dist/js/modern/utils/tspaths-transform/index.js +0 -113
  345. package/dist/js/modern/utils/tspaths-transform/utils.js +0 -18
  346. package/dist/js/modern/utils/valide.js +0 -26
  347. package/dist/js/node/cli/build.js +0 -18
  348. package/dist/js/node/cli/dev.js +0 -18
  349. package/dist/js/node/cli/index.js +0 -38
  350. package/dist/js/node/cli/new.js +0 -20
  351. package/dist/js/node/commands/build.js +0 -80
  352. package/dist/js/node/commands/dev.js +0 -52
  353. package/dist/js/node/commands/index.js +0 -19
  354. package/dist/js/node/features/build/build-platform.js +0 -76
  355. package/dist/js/node/features/build/bundle/index.js +0 -17
  356. package/dist/js/node/features/build/bundle/runRollup.js +0 -145
  357. package/dist/js/node/features/build/bundle/runSpeedy.js +0 -186
  358. package/dist/js/node/features/build/bundleless/copy-assets.js +0 -84
  359. package/dist/js/node/features/build/bundleless/generator-dts/index.js +0 -114
  360. package/dist/js/node/features/build/bundleless/generator-dts/utils.js +0 -105
  361. package/dist/js/node/features/build/bundleless/index.js +0 -29
  362. package/dist/js/node/features/build/bundleless/runBabel.js +0 -255
  363. package/dist/js/node/features/build/bundleless/style.js +0 -254
  364. package/dist/js/node/features/build/constants.js +0 -116
  365. package/dist/js/node/features/build/error.js +0 -139
  366. package/dist/js/node/features/build/index.js +0 -128
  367. package/dist/js/node/features/build/legacy-constants.js +0 -111
  368. package/dist/js/node/features/build/logger/index.js +0 -27
  369. package/dist/js/node/features/build/logger/logText.js +0 -66
  370. package/dist/js/node/features/build/logger/loggerManager.js +0 -95
  371. package/dist/js/node/features/build/normalize.js +0 -288
  372. package/dist/js/node/features/build/utils.js +0 -107
  373. package/dist/js/node/features/dev/index.js +0 -56
  374. package/dist/js/node/hooks/build.js +0 -32
  375. package/dist/js/node/hooks/dev.js +0 -24
  376. package/dist/js/node/hooks/index.js +0 -36
  377. package/dist/js/node/index.js +0 -83
  378. package/dist/js/node/locale/en.js +0 -32
  379. package/dist/js/node/locale/index.js +0 -17
  380. package/dist/js/node/locale/zh.js +0 -32
  381. package/dist/js/node/schema/build-config.js +0 -126
  382. package/dist/js/node/schema/index.js +0 -11
  383. package/dist/js/node/schema/output.js +0 -52
  384. package/dist/js/node/schema/source.js +0 -14
  385. package/dist/js/node/schema/tools.js +0 -13
  386. package/dist/js/node/utils/babel.js +0 -93
  387. package/dist/js/node/utils/color.js +0 -9
  388. package/dist/js/node/utils/constants.js +0 -11
  389. package/dist/js/node/utils/copy.js +0 -79
  390. package/dist/js/node/utils/init-env.js +0 -20
  391. package/dist/js/node/utils/json.js +0 -20
  392. package/dist/js/node/utils/language.js +0 -12
  393. package/dist/js/node/utils/logger.js +0 -107
  394. package/dist/js/node/utils/readline.js +0 -25
  395. package/dist/js/node/utils/tsconfig.js +0 -21
  396. package/dist/js/node/utils/tspaths-transform/constants.js +0 -12
  397. package/dist/js/node/utils/tspaths-transform/index.js +0 -123
  398. package/dist/js/node/utils/tspaths-transform/utils.js +0 -25
  399. package/dist/js/node/utils/valide.js +0 -34
  400. package/dist/types/cli/build.d.ts +0 -3
  401. package/dist/types/cli/dev.d.ts +0 -3
  402. package/dist/types/cli/index.d.ts +0 -3
  403. package/dist/types/cli/new.d.ts +0 -2
  404. package/dist/types/commands/build.d.ts +0 -17
  405. package/dist/types/commands/dev.d.ts +0 -5
  406. package/dist/types/commands/index.d.ts +0 -2
  407. package/dist/types/features/build/build-platform.d.ts +0 -7
  408. package/dist/types/features/build/bundle/index.d.ts +0 -3
  409. package/dist/types/features/build/bundle/runRollup.d.ts +0 -3
  410. package/dist/types/features/build/bundle/runSpeedy.d.ts +0 -10
  411. package/dist/types/features/build/bundleless/copy-assets.d.ts +0 -3
  412. package/dist/types/features/build/bundleless/generator-dts/index.d.ts +0 -3
  413. package/dist/types/features/build/bundleless/generator-dts/utils.d.ts +0 -21
  414. package/dist/types/features/build/bundleless/index.d.ts +0 -4
  415. package/dist/types/features/build/bundleless/runBabel.d.ts +0 -32
  416. package/dist/types/features/build/bundleless/style.d.ts +0 -25
  417. package/dist/types/features/build/constants.d.ts +0 -18
  418. package/dist/types/features/build/index.d.ts +0 -12
  419. package/dist/types/features/build/legacy-constants.d.ts +0 -8
  420. package/dist/types/features/build/logger/index.d.ts +0 -2
  421. package/dist/types/features/build/logger/logText.d.ts +0 -39
  422. package/dist/types/features/build/logger/loggerManager.d.ts +0 -40
  423. package/dist/types/features/build/normalize.d.ts +0 -19
  424. package/dist/types/features/build/types.d.ts +0 -15
  425. package/dist/types/features/build/utils.d.ts +0 -36
  426. package/dist/types/features/dev/index.d.ts +0 -9
  427. package/dist/types/hooks/build.d.ts +0 -46
  428. package/dist/types/hooks/dev.d.ts +0 -20
  429. package/dist/types/hooks/index.d.ts +0 -30
  430. package/dist/types/schema/build-config.d.ts +0 -205
  431. package/dist/types/schema/index.d.ts +0 -217
  432. package/dist/types/schema/output.d.ts +0 -215
  433. package/dist/types/schema/source.d.ts +0 -6
  434. package/dist/types/schema/tools.d.ts +0 -6
  435. package/dist/types/schema/types.d.ts +0 -45
  436. package/dist/types/types.d.ts +0 -51
  437. package/dist/types/utils/babel.d.ts +0 -8
  438. package/dist/types/utils/color.d.ts +0 -2
  439. package/dist/types/utils/constants.d.ts +0 -2
  440. package/dist/types/utils/copy.d.ts +0 -5
  441. package/dist/types/utils/init-env.d.ts +0 -21
  442. package/dist/types/utils/json.d.ts +0 -4
  443. package/dist/types/utils/language.d.ts +0 -1
  444. package/dist/types/utils/logger.d.ts +0 -58
  445. package/dist/types/utils/readline.d.ts +0 -9
  446. package/dist/types/utils/tspaths-transform/constants.d.ts +0 -1
  447. package/dist/types/utils/tspaths-transform/utils.d.ts +0 -4
  448. package/dist/types/utils/valide.d.ts +0 -12
  449. package/types.d.ts +0 -1
@@ -1,255 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.runBabelBuild = exports.jsFileSuffix = exports.haveNotAnyJsFile = exports.getWillCompilerCode = exports.buildSourceCode = exports.BabelBuildError = void 0;
7
- var _path = _interopRequireDefault(require("path"));
8
- var _utils = require("@modern-js/utils");
9
- var _error = require("../error");
10
- var _utils2 = require("../utils");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
- 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; }
14
- 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; }
15
- class BabelBuildError extends Error {
16
- constructor(message, opts) {
17
- super(message);
18
- _defineProperty(this, "summary", void 0);
19
- _defineProperty(this, "details", void 0);
20
- Error.captureStackTrace(this, this.constructor);
21
- this.summary = opts === null || opts === void 0 ? void 0 : opts.summary;
22
- this.details = opts === null || opts === void 0 ? void 0 : opts.details;
23
- }
24
- toString() {
25
- return this.formatError().join('\n');
26
- }
27
- formatError() {
28
- const msgs = [];
29
- const {
30
- summary,
31
- details = []
32
- } = this;
33
- msgs.push(_utils.chalk.red.bold(summary));
34
- for (const detail of details) {
35
- msgs.push(detail.content);
36
- msgs.push('\n');
37
- }
38
- return msgs;
39
- }
40
- }
41
- exports.BabelBuildError = BabelBuildError;
42
- const babelCompiler = _utils.Import.lazy('@modern-js/babel-compiler', require);
43
- const bc = _utils.Import.lazy('../../../utils/babel', require);
44
- const ts = _utils.Import.lazy('../../../utils/tsconfig', require);
45
-
46
- // const logger: typeof import('../logger') = Import.lazy('../logger', require);
47
-
48
- const getExts = (isTs, tsconfig) => {
49
- // TODO: 是否受控tsconfig.json 里的jsx配置
50
- let exts = [];
51
- if (isTs) {
52
- var _tsconfig$compilerOpt;
53
- exts = tsconfig !== null && tsconfig !== void 0 && (_tsconfig$compilerOpt = tsconfig.compilerOptions) !== null && _tsconfig$compilerOpt !== void 0 && _tsconfig$compilerOpt.allowJs ? ['.ts', '.tsx', '.js', '.jsx'] : ['.ts', '.tsx'];
54
- } else {
55
- exts = ['.js', '.jsx'];
56
- }
57
- return exts;
58
- };
59
- const getWillCompilerCode = (srcDirOrFile, option) => {
60
- const {
61
- tsconfig,
62
- isTsProject
63
- } = option;
64
- // 如果是一个文件路径,则直接返回
65
- if (_utils.fs.existsSync(srcDirOrFile) && _utils.fs.lstatSync(srcDirOrFile).isFile()) {
66
- return [srcDirOrFile];
67
- }
68
- const exts = getExts(isTsProject, tsconfig);
69
- const globPattern = `${srcDirOrFile}/**/*{${exts.join(',')}}`;
70
- const files = _utils.glob.sync(globPattern, {
71
- ignore: [`${srcDirOrFile}/**/*.d.ts`],
72
- absolute: true
73
- });
74
- return files;
75
- };
76
- exports.getWillCompilerCode = getWillCompilerCode;
77
- const buildSourceCode = async config => {
78
- const {
79
- willCompilerDirOrFile,
80
- tsconfigPath,
81
- babelConfig,
82
- srcRootDir,
83
- distDir,
84
- watch
85
- } = config;
86
- const tsconfig = ts.readTsConfig(tsconfigPath);
87
- const willCompilerFiles = getWillCompilerCode(willCompilerDirOrFile, {
88
- tsconfig,
89
- isTsProject: Boolean(tsconfig)
90
- });
91
- if (watch) {
92
- const emitter = await babelCompiler.compiler({
93
- quiet: true,
94
- enableVirtualDist: true,
95
- enableWatch: true,
96
- rootDir: srcRootDir,
97
- filenames: willCompilerFiles,
98
- distDir,
99
- watchDir: srcRootDir,
100
- extensions: getExts(Boolean(tsconfig), tsconfig),
101
- ignore: ['*.d.ts']
102
- }, babelConfig);
103
- return emitter;
104
- } else {
105
- return babelCompiler.compiler({
106
- quiet: true,
107
- enableVirtualDist: true,
108
- rootDir: srcRootDir,
109
- filenames: willCompilerFiles,
110
- distDir,
111
- // enableWatch: watch,
112
- ignore: ['*.d.ts']
113
- }, babelConfig);
114
- }
115
- };
116
- exports.buildSourceCode = buildSourceCode;
117
- const generatorRealFiles = virtualDists => {
118
- for (const virtualDist of virtualDists) {
119
- const {
120
- distPath,
121
- code,
122
- sourcemap,
123
- sourceMapPath
124
- } = virtualDist;
125
- _utils.fs.ensureFileSync(distPath);
126
- _utils.fs.writeFileSync(distPath, code);
127
- if (sourcemap.length > 0) {
128
- _utils.fs.ensureFileSync(sourceMapPath);
129
- _utils.fs.writeFileSync(sourceMapPath, sourcemap);
130
- }
131
- }
132
- };
133
- /**
134
- * when modern build, only throw Error or silent
135
- * @param outputResults
136
- * @param context
137
- */
138
- const outputDist = (outputResults, context) => {
139
- const {
140
- code,
141
- message,
142
- messageDetails,
143
- virtualDists = []
144
- } = outputResults;
145
- if (code === 0) {
146
- generatorRealFiles(virtualDists);
147
- } else if (messageDetails && messageDetails.length > 0) {
148
- const babelError = new BabelBuildError('bundleless failed', {
149
- summary: message,
150
- details: messageDetails
151
- });
152
- throw new _error.InternalBuildError(babelError, _objectSpread(_objectSpread({}, context), {}, {
153
- buildType: 'bundleless'
154
- }));
155
- }
156
- };
157
- const jsFileSuffix = ['js', 'jsx', 'ts', 'tsx'];
158
- exports.jsFileSuffix = jsFileSuffix;
159
- const haveNotAnyJsFile = async sourceDir => {
160
- const files = await (0, _utils.globby)((0, _utils.slash)(`${sourceDir}/**/*.{${jsFileSuffix.join(',')}}`));
161
- return files.length === 0;
162
- };
163
- exports.haveNotAnyJsFile = haveNotAnyJsFile;
164
- const runBabelBuild = async (api, config) => {
165
- const {
166
- bundlelessOptions,
167
- tsconfig,
168
- target,
169
- format,
170
- outputPath,
171
- watch,
172
- sourceMap
173
- } = config;
174
- const {
175
- appDirectory
176
- } = api.useAppContext();
177
- const modernConfig = api.useResolvedConfigContext();
178
- const {
179
- output: {
180
- path: distPath = 'dist'
181
- }
182
- } = modernConfig;
183
- const {
184
- sourceDir = './src'
185
- } = bundlelessOptions;
186
- const sourceAbsDir = _path.default.join(appDirectory, sourceDir);
187
- const tsconfigPath = _path.default.join(appDirectory, tsconfig);
188
- if (await haveNotAnyJsFile(sourceAbsDir)) {
189
- return;
190
- }
191
-
192
- // TODO: Refactoring based on format and target
193
- const syntax = target === 'es5' ? 'es5' : 'es6+';
194
- const type = format === 'cjs' ? 'commonjs' : 'module';
195
- const titleText = `[Bundleless:Babel: ${format}_${target}]`;
196
- const buildConfig = {
197
- format,
198
- target,
199
- babelConfig: bc.resolveBabelConfig(appDirectory, modernConfig, sourceMap, bundlelessOptions, {
200
- sourceAbsDir,
201
- tsconfigPath,
202
- syntax,
203
- type
204
- })
205
- };
206
- const distDir = _path.default.join(appDirectory, distPath, outputPath);
207
- const result = await buildSourceCode({
208
- appDirectory,
209
- distDir,
210
- srcRootDir: sourceAbsDir,
211
- willCompilerDirOrFile: sourceAbsDir,
212
- tsconfigPath,
213
- babelConfig: buildConfig.babelConfig,
214
- watch
215
- });
216
- if (watch) {
217
- const emitter = result;
218
- emitter.on(babelCompiler.BuildWatchEvent.firstCompiler, result => {
219
- if (result.code === 1) {
220
- console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Fail));
221
- console.error(result.message);
222
- for (const detail of result.messageDetails || []) {
223
- console.error(detail.content);
224
- }
225
- } else {
226
- generatorRealFiles(result.virtualDists);
227
- console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Success));
228
- }
229
- });
230
- emitter.on(babelCompiler.BuildWatchEvent.watchingCompiler, result => {
231
- if (result.code === 1) {
232
- var _result$virtualDists;
233
- // console.error(logger.clearFlag);
234
- console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Fail));
235
- console.error(result.message);
236
- for (const detail of result.messageDetails || []) {
237
- console.error(detail.content);
238
- }
239
- if (Array.isArray(result.virtualDists) && ((_result$virtualDists = result.virtualDists) === null || _result$virtualDists === void 0 ? void 0 : _result$virtualDists.length) > 0) {
240
- generatorRealFiles(result.virtualDists);
241
- }
242
- } else {
243
- generatorRealFiles(result.virtualDists);
244
- console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Success));
245
- }
246
- });
247
- await emitter.watch();
248
- } else {
249
- outputDist(result, {
250
- target,
251
- format
252
- });
253
- }
254
- };
255
- exports.runBabelBuild = runBabelBuild;
@@ -1,254 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.styleFileSuffix = exports.runBuild = exports.haveNotAnyStyles = exports.buildStyle = exports.StyleBuildError = void 0;
7
- var path = _interopRequireWildcard(require("path"));
8
- var _utils = require("@modern-js/utils");
9
- var _error = require("../error");
10
- var _utils2 = require("../utils");
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 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; }
14
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
- 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; }
16
- const compiler = _utils.Import.lazy('@modern-js/style-compiler', require);
17
- class StyleBuildError extends Error {
18
- constructor(message, opts) {
19
- super(message);
20
- _defineProperty(this, "summary", void 0);
21
- _defineProperty(this, "details", void 0);
22
- Error.captureStackTrace(this, this.constructor);
23
- this.summary = opts === null || opts === void 0 ? void 0 : opts.summary;
24
- this.details = opts === null || opts === void 0 ? void 0 : opts.details;
25
- }
26
- toString() {
27
- return this.formatError().join('\n');
28
- }
29
- formatError() {
30
- const msgs = [];
31
- const {
32
- summary,
33
- details = []
34
- } = this;
35
- msgs.push(_utils.chalk.red.bold(summary));
36
- for (const detail of details) {
37
- if (detail.error) {
38
- msgs.push(detail.error);
39
- msgs.push('\n');
40
- }
41
- }
42
- return msgs;
43
- }
44
- }
45
-
46
- /**
47
- * when modern build, only throw Error or silent
48
- * @param result
49
- * @param context
50
- */
51
- exports.StyleBuildError = StyleBuildError;
52
- const generatorFileOrLogError = (result, context) => {
53
- if (result.code === 0) {
54
- for (const file of result.dists) {
55
- _utils.fs.ensureFileSync(file.filename);
56
- _utils.fs.writeFileSync(file.filename, file.content);
57
- }
58
- } else {
59
- // for (const file of result.errors) {
60
- // console.error(file.error);
61
- // }
62
- const styleError = new StyleBuildError('bundleless failed', {
63
- summary: 'Style Compiler Failed',
64
- details: result.errors
65
- });
66
- throw new _error.InternalBuildError(styleError, _objectSpread({
67
- buildType: 'bundleless'
68
- }, context));
69
- }
70
- };
71
- const generatorFileAndLog = (result, titleText) => {
72
- if (result.code === 0) {
73
- for (const file of result.dists) {
74
- _utils.fs.ensureFileSync(file.filename);
75
- _utils.fs.writeFileSync(file.filename, file.content);
76
- }
77
- console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Success));
78
- } else {
79
- console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Fail));
80
- for (const file of result.errors) {
81
- console.error(file.error);
82
- }
83
- }
84
- };
85
- const copyOriginStyleFiles = ({
86
- targetDir,
87
- outputDir,
88
- ignoreCSS: _ignoreCSS = false
89
- }) => {
90
- const styleFiles = _utils.glob.sync(`${targetDir}/**/*.{${_ignoreCSS ? '' : 'css,'}sass,scss,less}`);
91
- if (styleFiles.length > 0) {
92
- _utils.fs.ensureDirSync(outputDir);
93
- }
94
- for (const styleFile of styleFiles) {
95
- const file = path.relative(targetDir, styleFile);
96
- _utils.fs.ensureDirSync(path.dirname(path.join(outputDir, file)));
97
- _utils.fs.copyFileSync(styleFile, path.join(outputDir, file));
98
- }
99
- };
100
- const runBuild = async option => {
101
- const {
102
- watch,
103
- appDirectory,
104
- srcDir,
105
- outDir,
106
- lessOption,
107
- sassOption,
108
- postcssOption
109
- } = option;
110
- if (watch) {
111
- const srcStyleEmitter = compiler.styleCompiler({
112
- watch: true,
113
- projectDir: appDirectory,
114
- stylesDir: srcDir,
115
- outDir,
116
- enableVirtualDist: true,
117
- compilerOption: {
118
- less: lessOption,
119
- sass: sassOption,
120
- postcss: postcssOption
121
- }
122
- });
123
- return srcStyleEmitter;
124
- } else {
125
- const srcStyleResult = await compiler.styleCompiler({
126
- projectDir: appDirectory,
127
- stylesDir: srcDir,
128
- outDir,
129
- enableVirtualDist: true,
130
- compilerOption: {
131
- less: lessOption,
132
- sass: sassOption,
133
- postcss: postcssOption
134
- }
135
- });
136
- return srcStyleResult;
137
- }
138
- };
139
- exports.runBuild = runBuild;
140
- const styleFileSuffix = ['css', 'less', 'sass', 'scss'];
141
- exports.styleFileSuffix = styleFileSuffix;
142
- const haveNotAnyStyles = async sourceDir => {
143
- const files = await (0, _utils.globby)((0, _utils.slash)(`${sourceDir}/**/*.{${styleFileSuffix.join(',')}}`));
144
- return files.length === 0;
145
- };
146
- exports.haveNotAnyStyles = haveNotAnyStyles;
147
- const buildStyle = async (api, config) => {
148
- var _style$path;
149
- const modernConfig = api.useResolvedConfigContext();
150
- const {
151
- appDirectory
152
- } = api.useAppContext();
153
- const {
154
- watch = false,
155
- outputPath,
156
- bundlelessOptions
157
- } = config;
158
- const {
159
- style,
160
- sourceDir
161
- } = bundlelessOptions;
162
- const {
163
- output: {
164
- path: distPath = 'dist'
165
- }
166
- } = modernConfig;
167
- const titleText = `[Bundleless:Style:${sourceDir}]`;
168
- if ((await haveNotAnyStyles(sourceDir)) || style.compileMode === false) {
169
- return;
170
- }
171
- const runner = api.useHookRunners();
172
- const lessOption = await runner.moduleLessConfig({
173
- modernConfig
174
- }, {
175
- onLast: async _ => undefined
176
- });
177
- const sassOption = await runner.moduleSassConfig({
178
- modernConfig
179
- }, {
180
- onLast: async _ => undefined
181
- });
182
- const tailwindPlugin = await runner.moduleTailwindConfig({
183
- modernConfig
184
- }, {
185
- onLast: async _ => undefined
186
- });
187
- const postcssOption = (0, _utils2.getPostcssOption)(appDirectory, modernConfig);
188
- if (tailwindPlugin) {
189
- var _postcssOption$plugin;
190
- (_postcssOption$plugin = postcssOption.plugins) === null || _postcssOption$plugin === void 0 ? void 0 : _postcssOption$plugin.push(tailwindPlugin);
191
- }
192
- const srcDir = path.resolve(appDirectory, sourceDir);
193
- const outputDirToSrc = path.join(appDirectory, distPath, outputPath, (_style$path = style.path) !== null && _style$path !== void 0 ? _style$path : './');
194
- if (style.compileMode === 'all' || style.compileMode === 'only-compiled-code') {
195
- const result = await runBuild({
196
- appDirectory,
197
- srcDir,
198
- watch,
199
- outDir: outputDirToSrc,
200
- lessOption,
201
- sassOption,
202
- postcssOption
203
- });
204
- if (watch) {
205
- const emitter = result;
206
- emitter.on(compiler.BuildWatchEvent.firstCompiler, result => {
207
- generatorFileAndLog(result, titleText);
208
- });
209
- emitter.on(compiler.BuildWatchEvent.watchingCompiler, srcStyleResult => {
210
- generatorFileAndLog(srcStyleResult, titleText);
211
- });
212
- await emitter.watch();
213
- } else {
214
- const srcStyleResult = result;
215
- generatorFileOrLogError(srcStyleResult, {
216
- target: config.target,
217
- format: config.format
218
- });
219
- }
220
- }
221
- if (style.compileMode === 'all' || style.compileMode === 'only-source-code') {
222
- if (watch) {
223
- copyOriginStyleFiles({
224
- targetDir: srcDir,
225
- outputDir: outputDirToSrc,
226
- ignoreCSS: style.compileMode === 'all'
227
- });
228
- console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Success));
229
- (0, _utils.watch)(`${srcDir}/**/*.{css,less,sass,scss}`, ({
230
- changeType,
231
- changedFilePath
232
- }) => {
233
- if (changeType === _utils.WatchChangeType.UNLINK) {
234
- const removeFile = path.normalize(`${outputDirToSrc}/${path.relative(srcDir, changedFilePath)}`);
235
- _utils.fs.removeSync(removeFile);
236
- } else {
237
- copyOriginStyleFiles({
238
- targetDir: srcDir,
239
- outputDir: outputDirToSrc,
240
- ignoreCSS: style.compileMode === 'all'
241
- });
242
- }
243
- console.info((0, _utils2.watchSectionTitle)(titleText, _utils2.SectionTitleStatus.Success));
244
- });
245
- } else {
246
- copyOriginStyleFiles({
247
- targetDir: srcDir,
248
- outputDir: outputDirToSrc,
249
- ignoreCSS: style.compileMode === 'all'
250
- });
251
- }
252
- }
253
- };
254
- exports.buildStyle = buildStyle;
@@ -1,116 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.unPresets = exports.unPresetWithTargetConfigs = exports.unPresetConfigs = exports.targets = exports.npmLibraryWithUmdPresetConfig = exports.npmLibraryPresetConfig = exports.npmComponentWithUmdPresetConfig = exports.npmComponentPresetConfig = exports.clearFlag = exports.buildingText = exports.buildSuccessText = exports.buildFailText = void 0;
7
- var _utils = require("@modern-js/utils");
8
- 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; }
9
- 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; }
10
- 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; }
11
- const clearFlag = '\x1Bc';
12
- exports.clearFlag = clearFlag;
13
- const buildingText = _utils.chalk.blue('Building...');
14
- exports.buildingText = buildingText;
15
- const buildSuccessText = _utils.chalk.green('Build succeed');
16
- exports.buildSuccessText = buildSuccessText;
17
- const buildFailText = _utils.chalk.red('Build Failed:');
18
- exports.buildFailText = buildFailText;
19
- const targets = ['es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'esnext'];
20
- exports.targets = targets;
21
- const npmLibraryPresetConfig = [{
22
- format: 'cjs',
23
- target: 'es6',
24
- buildType: 'bundle',
25
- outputPath: './lib'
26
- }, {
27
- format: 'esm',
28
- target: 'es6',
29
- buildType: 'bundle',
30
- outputPath: './es'
31
- }, {
32
- buildType: 'bundle',
33
- outputPath: './types',
34
- enableDts: true,
35
- dtsOnly: true
36
- }];
37
- exports.npmLibraryPresetConfig = npmLibraryPresetConfig;
38
- const npmLibraryWithUmdPresetConfig = [{
39
- format: 'cjs',
40
- target: 'es6',
41
- buildType: 'bundle',
42
- outputPath: './lib'
43
- }, {
44
- format: 'esm',
45
- target: 'es6',
46
- buildType: 'bundle',
47
- outputPath: './es'
48
- }, {
49
- format: 'umd',
50
- target: 'es6',
51
- buildType: 'bundle',
52
- outputPath: './umd'
53
- }, {
54
- buildType: 'bundle',
55
- outputPath: './types',
56
- enableDts: true,
57
- dtsOnly: true
58
- }];
59
- exports.npmLibraryWithUmdPresetConfig = npmLibraryWithUmdPresetConfig;
60
- const npmComponentPresetConfig = [{
61
- format: 'cjs',
62
- target: 'es6',
63
- buildType: 'bundleless',
64
- outputPath: './lib'
65
- }, {
66
- format: 'esm',
67
- target: 'es6',
68
- buildType: 'bundleless',
69
- outputPath: './es'
70
- }, {
71
- buildType: 'bundleless',
72
- outputPath: './types',
73
- enableDts: true,
74
- dtsOnly: true
75
- }];
76
- exports.npmComponentPresetConfig = npmComponentPresetConfig;
77
- const npmComponentWithUmdPresetConfig = [{
78
- format: 'cjs',
79
- target: 'es6',
80
- buildType: 'bundleless',
81
- outputPath: './lib'
82
- }, {
83
- format: 'esm',
84
- target: 'es6',
85
- buildType: 'bundleless',
86
- outputPath: './es'
87
- }, {
88
- format: 'umd',
89
- target: 'es6',
90
- buildType: 'bundle',
91
- outputPath: './umd'
92
- }, {
93
- buildType: 'bundleless',
94
- outputPath: './types',
95
- enableDts: true,
96
- dtsOnly: true
97
- }];
98
- exports.npmComponentWithUmdPresetConfig = npmComponentWithUmdPresetConfig;
99
- const unPresetConfigs = {
100
- 'npm-library': npmLibraryPresetConfig,
101
- 'npm-library-with-umd': npmLibraryWithUmdPresetConfig,
102
- 'npm-component': npmComponentPresetConfig,
103
- 'npm-component-with-umd': npmComponentWithUmdPresetConfig
104
- };
105
- exports.unPresetConfigs = unPresetConfigs;
106
- const unPresets = Object.keys(unPresetConfigs);
107
- exports.unPresets = unPresets;
108
- const unPresetWithTargetConfigs = unPresets.reduce((o, presetStr) => {
109
- const rets = targets.map(target => [`${presetStr}-${target}`.toLowerCase(), unPresetConfigs[presetStr].map(config => {
110
- return _objectSpread(_objectSpread({}, config), {}, {
111
- target
112
- });
113
- })]);
114
- return _objectSpread(_objectSpread({}, o), Object.fromEntries(rets));
115
- }, {});
116
- exports.unPresetWithTargetConfigs = unPresetWithTargetConfigs;