@umijs/bundler-webpack 3.5.19 → 4.0.0-beta.11

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 (334) hide show
  1. package/README.md +2 -0
  2. package/bin/bundler-webpack.js +1 -2
  3. package/client/client/client.js +202 -0
  4. package/client/constants.js +12 -0
  5. package/client/utils/formatWebpackMessages.js +92 -0
  6. package/compiled/@svgr/webpack/LICENSE +7 -0
  7. package/compiled/@svgr/webpack/index.js +266 -0
  8. package/compiled/@svgr/webpack/package.json +1 -0
  9. package/compiled/autoprefixer/LICENSE +20 -0
  10. package/compiled/autoprefixer/browserslist/index.d.ts +172 -0
  11. package/compiled/autoprefixer/index.js +9 -0
  12. package/compiled/autoprefixer/lib/autoprefixer.d.ts +95 -0
  13. package/compiled/autoprefixer/package.json +1 -0
  14. package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +106 -0
  15. package/compiled/autoprefixer/postcss/lib/comment.d.ts +56 -0
  16. package/compiled/autoprefixer/postcss/lib/container.d.ts +442 -0
  17. package/compiled/autoprefixer/postcss/lib/css-syntax-error.d.ts +192 -0
  18. package/compiled/autoprefixer/postcss/lib/declaration.d.ts +124 -0
  19. package/compiled/autoprefixer/postcss/lib/document.d.ts +57 -0
  20. package/compiled/autoprefixer/postcss/lib/input.d.ts +130 -0
  21. package/compiled/autoprefixer/postcss/lib/lazy-result.d.ts +175 -0
  22. package/compiled/autoprefixer/postcss/lib/list.d.ts +51 -0
  23. package/compiled/autoprefixer/postcss/lib/node.d.ts +444 -0
  24. package/compiled/autoprefixer/postcss/lib/postcss.d.ts +472 -0
  25. package/compiled/autoprefixer/postcss/lib/previous-map.d.ts +72 -0
  26. package/compiled/autoprefixer/postcss/lib/processor.d.ts +101 -0
  27. package/compiled/autoprefixer/postcss/lib/result.d.ts +195 -0
  28. package/compiled/autoprefixer/postcss/lib/root.d.ts +73 -0
  29. package/compiled/autoprefixer/postcss/lib/rule.d.ts +104 -0
  30. package/compiled/autoprefixer/postcss/lib/warning.d.ts +104 -0
  31. package/compiled/autoprefixer/source-map-js/source-map.d.ts +98 -0
  32. package/compiled/babel-loader/LICENSE +22 -0
  33. package/compiled/babel-loader/index.js +3 -0
  34. package/compiled/babel-loader/package.json +1 -0
  35. package/compiled/compression/LICENSE +23 -0
  36. package/compiled/compression/index.js +57 -0
  37. package/compiled/compression/package.json +1 -0
  38. package/compiled/connect-history-api-fallback/LICENSE +21 -0
  39. package/compiled/connect-history-api-fallback/index.js +1 -0
  40. package/compiled/connect-history-api-fallback/package.json +1 -0
  41. package/{lib/webpack/plugins/mini-css-extract-plugin → compiled/copy-webpack-plugin}/LICENSE +0 -0
  42. package/compiled/copy-webpack-plugin/index.js +46 -0
  43. package/compiled/copy-webpack-plugin/package.json +1 -0
  44. package/{lib/webpack/plugins/terser-webpack-plugin → compiled/css-loader}/LICENSE +0 -0
  45. package/compiled/css-loader/api.js +102 -0
  46. package/compiled/css-loader/getUrl.js +29 -0
  47. package/compiled/css-loader/index.js +2 -0
  48. package/compiled/css-loader/noSourceMaps.js +5 -0
  49. package/compiled/css-loader/package.json +1 -0
  50. package/compiled/css-loader/sourceMaps.js +22 -0
  51. package/compiled/css-minimizer-webpack-plugin/LICENSE +20 -0
  52. package/compiled/css-minimizer-webpack-plugin/index.js +3 -0
  53. package/compiled/css-minimizer-webpack-plugin/minify.js +72 -0
  54. package/compiled/css-minimizer-webpack-plugin/package.json +1 -0
  55. package/compiled/css-minimizer-webpack-plugin/utils.js +166 -0
  56. package/compiled/cssnano/index.js +192 -0
  57. package/compiled/cssnano/package.json +1 -0
  58. package/compiled/express/LICENSE +24 -0
  59. package/compiled/express/body-parser/index.d.ts +104 -0
  60. package/compiled/express/connect/index.d.ts +93 -0
  61. package/compiled/express/express-serve-static-core/index.d.ts +1252 -0
  62. package/compiled/express/index.d.ts +133 -0
  63. package/compiled/express/index.js +338 -0
  64. package/compiled/express/mime/index.d.ts +35 -0
  65. package/compiled/express/package.json +1 -0
  66. package/compiled/express/qs/index.d.ts +62 -0
  67. package/compiled/express/range-parser/index.d.ts +35 -0
  68. package/compiled/express/serve-static/index.d.ts +108 -0
  69. package/compiled/http-proxy-middleware/LICENSE +22 -0
  70. package/compiled/http-proxy-middleware/dist/index.d.ts +4 -0
  71. package/compiled/http-proxy-middleware/dist/types.d.ts +54 -0
  72. package/compiled/http-proxy-middleware/http-proxy/index.d.ts +226 -0
  73. package/compiled/http-proxy-middleware/index.js +66 -0
  74. package/compiled/http-proxy-middleware/package.json +1 -0
  75. package/compiled/less/index.js +31 -0
  76. package/compiled/less/package.json +1 -0
  77. package/compiled/less-loader/LICENSE +20 -0
  78. package/compiled/less-loader/index.js +1 -0
  79. package/compiled/less-loader/package.json +1 -0
  80. package/compiled/mini-css-extract-plugin/LICENSE +20 -0
  81. package/{lib/webpack/plugins/mini-css-extract-plugin/src → compiled/mini-css-extract-plugin}/hmr/hotModuleReplacement.js +50 -52
  82. package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +35 -0
  83. package/compiled/mini-css-extract-plugin/index.js +11606 -0
  84. package/compiled/mini-css-extract-plugin/loader-options.json +32 -0
  85. package/compiled/mini-css-extract-plugin/loader.js +315 -0
  86. package/compiled/mini-css-extract-plugin/package.json +1 -0
  87. package/compiled/mini-css-extract-plugin/utils.js +154 -0
  88. package/compiled/postcss-flexbugs-fixes/LICENSE +20 -0
  89. package/compiled/postcss-flexbugs-fixes/index.js +1 -0
  90. package/compiled/postcss-flexbugs-fixes/package.json +1 -0
  91. package/compiled/postcss-loader/LICENSE +20 -0
  92. package/compiled/postcss-loader/index.js +1 -0
  93. package/compiled/postcss-loader/package.json +1 -0
  94. package/compiled/purgecss-webpack-plugin/LICENSE +21 -0
  95. package/compiled/purgecss-webpack-plugin/index.js +7781 -0
  96. package/compiled/purgecss-webpack-plugin/package.json +1 -0
  97. package/compiled/react-refresh/index.js +19 -0
  98. package/compiled/sass-loader/LICENSE +20 -0
  99. package/compiled/sass-loader/index.js +1 -0
  100. package/compiled/sass-loader/package.json +1 -0
  101. package/compiled/schema-utils/LICENSE +20 -0
  102. package/compiled/schema-utils/ajv/lib/ajv.d.ts +397 -0
  103. package/compiled/schema-utils/declarations/ValidationError.d.ts +74 -0
  104. package/compiled/schema-utils/declarations/index.d.ts +3 -0
  105. package/compiled/schema-utils/declarations/validate.d.ts +37 -0
  106. package/compiled/schema-utils/index.js +3 -0
  107. package/compiled/schema-utils/json-schema/index.d.ts +751 -0
  108. package/compiled/schema-utils/package.json +1 -0
  109. package/compiled/speed-measure-webpack-plugin/LICENSE +21 -0
  110. package/compiled/speed-measure-webpack-plugin/index.js +1 -0
  111. package/compiled/speed-measure-webpack-plugin/package.json +1 -0
  112. package/compiled/style-loader/LICENSE +20 -0
  113. package/compiled/style-loader/index.js +1 -0
  114. package/compiled/style-loader/package.json +1 -0
  115. package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
  116. package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +104 -0
  117. package/compiled/style-loader/runtime/insertBySelector.js +39 -0
  118. package/compiled/style-loader/runtime/insertStyleElement.js +11 -0
  119. package/compiled/style-loader/runtime/isEqualLocals.js +35 -0
  120. package/compiled/style-loader/runtime/isOldIE.js +19 -0
  121. package/compiled/style-loader/runtime/setAttributesWithAttributes.js +16 -0
  122. package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +10 -0
  123. package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +12 -0
  124. package/compiled/style-loader/runtime/singletonStyleDomAPI.js +93 -0
  125. package/compiled/style-loader/runtime/styleDomAPI.js +70 -0
  126. package/compiled/style-loader/runtime/styleTagTransform.js +16 -0
  127. package/compiled/svgo-loader/LICENSE +22 -0
  128. package/compiled/svgo-loader/index.js +4 -0
  129. package/compiled/svgo-loader/package.json +1 -0
  130. package/compiled/swc-loader/LICENSE +25 -0
  131. package/compiled/swc-loader/index.js +1 -0
  132. package/compiled/swc-loader/package.json +1 -0
  133. package/compiled/tapable/LICENSE +21 -0
  134. package/compiled/tapable/index.js +1 -0
  135. package/compiled/tapable/package.json +1 -0
  136. package/compiled/tapable/tapable.d.ts +116 -0
  137. package/compiled/terser/LICENSE +29 -0
  138. package/compiled/terser/index.js +1 -0
  139. package/compiled/terser/mappings.wasm +0 -0
  140. package/compiled/terser/package.json +1 -0
  141. package/compiled/terser/source-map/source-map.d.ts +369 -0
  142. package/compiled/terser/tools/terser.d.ts +207 -0
  143. package/compiled/terser-webpack-plugin/LICENSE +20 -0
  144. package/compiled/terser-webpack-plugin/ajv/lib/ajv.d.ts +397 -0
  145. package/compiled/terser-webpack-plugin/index.js +15142 -0
  146. package/compiled/terser-webpack-plugin/jest-worker/build/index.d.ts +49 -0
  147. package/compiled/terser-webpack-plugin/jest-worker/build/types.d.ts +142 -0
  148. package/compiled/terser-webpack-plugin/json-schema/index.d.ts +751 -0
  149. package/compiled/terser-webpack-plugin/minify.js +43 -0
  150. package/compiled/terser-webpack-plugin/package.json +1 -0
  151. package/compiled/terser-webpack-plugin/schema-utils/declarations/ValidationError.d.ts +74 -0
  152. package/compiled/terser-webpack-plugin/schema-utils/declarations/index.d.ts +3 -0
  153. package/compiled/terser-webpack-plugin/schema-utils/declarations/validate.d.ts +37 -0
  154. package/compiled/terser-webpack-plugin/source-map/source-map.d.ts +98 -0
  155. package/compiled/terser-webpack-plugin/types/cjs.d.ts +3 -0
  156. package/compiled/terser-webpack-plugin/types/index.d.ts +295 -0
  157. package/compiled/terser-webpack-plugin/types/utils.d.ts +105 -0
  158. package/compiled/terser-webpack-plugin/utils.js +594 -0
  159. package/compiled/url-loader/LICENSE +20 -0
  160. package/compiled/url-loader/index.js +15 -0
  161. package/compiled/url-loader/package.json +1 -0
  162. package/compiled/webpack/Chunk.js +1 -0
  163. package/compiled/webpack/Compilation.js +1 -0
  164. package/compiled/webpack/HotModuleReplacement.runtime.js +394 -0
  165. package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +462 -0
  166. package/compiled/webpack/LICENSE +20 -0
  167. package/compiled/webpack/LibraryTemplatePlugin.js +1 -0
  168. package/compiled/webpack/LoaderTargetPlugin.js +1 -0
  169. package/compiled/webpack/ModuleFilenameHelpers.js +1 -0
  170. package/compiled/webpack/NormalModule.js +1 -0
  171. package/compiled/webpack/RuntimeGlobals.js +1 -0
  172. package/compiled/webpack/RuntimeModule.js +1 -0
  173. package/compiled/webpack/SingleEntryPlugin.js +1 -0
  174. package/compiled/webpack/Template.js +1 -0
  175. package/compiled/webpack/ajv/lib/ajv.d.ts +397 -0
  176. package/compiled/webpack/deepImports.json +12 -0
  177. package/compiled/webpack/index.js +162861 -0
  178. package/compiled/webpack/json-schema/index.d.ts +751 -0
  179. package/compiled/webpack/lazy-compilation-node.js +40 -0
  180. package/compiled/webpack/lazy-compilation-web.js +74 -0
  181. package/compiled/webpack/package.json +5 -0
  182. package/compiled/webpack/schema-utils/declarations/ValidationError.d.ts +74 -0
  183. package/compiled/webpack/schema-utils/declarations/index.d.ts +3 -0
  184. package/compiled/webpack/schema-utils/declarations/validate.d.ts +37 -0
  185. package/compiled/webpack/types.d.ts +12664 -0
  186. package/compiled/webpack-5-chain/LICENSE +373 -0
  187. package/compiled/webpack-5-chain/index.js +1 -0
  188. package/compiled/webpack-5-chain/package.json +1 -0
  189. package/compiled/webpack-5-chain/types/index.d.ts +543 -0
  190. package/compiled/webpack-bundle-analyzer/LICENSE +20 -0
  191. package/compiled/webpack-bundle-analyzer/index.js +30 -0
  192. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  193. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  194. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  195. package/compiled/webpack-bundle-analyzer/public/viewer.js.map +1 -0
  196. package/compiled/webpack-dev-middleware/LICENSE +20 -0
  197. package/compiled/webpack-dev-middleware/index.js +21 -0
  198. package/compiled/webpack-dev-middleware/package.json +1 -0
  199. package/compiled/webpack-sources/LICENSE +21 -0
  200. package/compiled/webpack-sources/index.d.ts +20 -0
  201. package/compiled/webpack-sources/index.js +1 -0
  202. package/compiled/webpack-sources/lib/CachedSource.d.ts +18 -0
  203. package/compiled/webpack-sources/lib/CompatSource.d.ts +9 -0
  204. package/compiled/webpack-sources/lib/ConcatSource.d.ts +22 -0
  205. package/compiled/webpack-sources/lib/OriginalSource.d.ts +18 -0
  206. package/compiled/webpack-sources/lib/PrefixSource.d.ts +12 -0
  207. package/compiled/webpack-sources/lib/RawSource.d.ts +13 -0
  208. package/compiled/webpack-sources/lib/ReplaceSource.d.ts +35 -0
  209. package/compiled/webpack-sources/lib/SizeOnlySource.d.ts +7 -0
  210. package/compiled/webpack-sources/lib/Source.d.ts +45 -0
  211. package/compiled/webpack-sources/lib/SourceMapSource.d.ts +22 -0
  212. package/compiled/webpack-sources/lib/index.d.ts +60 -0
  213. package/compiled/webpack-sources/package.json +1 -0
  214. package/compiled/webpack-sources/source-list-map/index.d.ts +91 -0
  215. package/compiled/webpack-sources/source-map/source-map.d.ts +369 -0
  216. package/compiled/ws/LICENSE +19 -0
  217. package/compiled/ws/index.d.ts +359 -0
  218. package/compiled/ws/index.js +1 -0
  219. package/compiled/ws/package.json +1 -0
  220. package/dist/build.d.ts +17 -0
  221. package/dist/build.js +72 -0
  222. package/{lib → dist}/cli.d.ts +0 -0
  223. package/dist/cli.js +93 -0
  224. package/{lib/webpackHotDevClient/webpackHotDevClient.d.ts → dist/client/client.d.ts} +0 -0
  225. package/dist/client/client.js +239 -0
  226. package/dist/config/_sampleFeature.d.ts +10 -0
  227. package/dist/config/_sampleFeature.js +22 -0
  228. package/dist/config/assetRules.d.ts +11 -0
  229. package/dist/config/assetRules.js +69 -0
  230. package/dist/config/bundleAnalyzerPlugin.d.ts +10 -0
  231. package/dist/config/bundleAnalyzerPlugin.js +30 -0
  232. package/dist/config/compressPlugin.d.ts +10 -0
  233. package/dist/config/compressPlugin.js +77 -0
  234. package/dist/config/config.d.ts +20 -0
  235. package/dist/config/config.js +178 -0
  236. package/dist/config/copyPlugin.d.ts +10 -0
  237. package/dist/config/copyPlugin.js +49 -0
  238. package/dist/config/cssRules.d.ts +11 -0
  239. package/dist/config/cssRules.js +98 -0
  240. package/dist/config/definePlugin.d.ts +15 -0
  241. package/dist/config/definePlugin.js +45 -0
  242. package/dist/config/fastRefreshPlugin.d.ts +12 -0
  243. package/dist/config/fastRefreshPlugin.js +34 -0
  244. package/dist/config/ignorePlugin.d.ts +10 -0
  245. package/dist/config/ignorePlugin.js +27 -0
  246. package/dist/config/javaScriptRules.d.ts +14 -0
  247. package/dist/config/javaScriptRules.js +155 -0
  248. package/dist/config/miniCSSExtractPlugin.d.ts +10 -0
  249. package/dist/config/miniCSSExtractPlugin.js +34 -0
  250. package/dist/config/nodePolyfill.d.ts +10 -0
  251. package/dist/config/nodePolyfill.js +34 -0
  252. package/dist/config/progressPlugin.d.ts +11 -0
  253. package/dist/config/progressPlugin.js +27 -0
  254. package/dist/config/purgecssWebpackPlugin.d.ts +10 -0
  255. package/dist/config/purgecssWebpackPlugin.js +32 -0
  256. package/dist/config/speedMeasureWebpackPlugin.d.ts +6 -0
  257. package/dist/config/speedMeasureWebpackPlugin.js +34 -0
  258. package/dist/config/svgRules.d.ts +11 -0
  259. package/dist/config/svgRules.js +43 -0
  260. package/dist/constants.d.ts +11 -0
  261. package/dist/constants.js +15 -0
  262. package/dist/dev.d.ts +19 -0
  263. package/dist/dev.js +87 -0
  264. package/dist/index.d.ts +5 -0
  265. package/dist/index.js +16 -0
  266. package/dist/plugins/ESBuildCSSMinifyPlugin.d.ts +11 -0
  267. package/dist/plugins/ESBuildCSSMinifyPlugin.js +65 -0
  268. package/dist/plugins/ProgressPlugin.d.ts +15 -0
  269. package/dist/plugins/ProgressPlugin.js +44 -0
  270. package/dist/plugins/_SamplePlugin.d.ts +9 -0
  271. package/dist/plugins/_SamplePlugin.js +14 -0
  272. package/dist/requireHook.d.ts +1 -0
  273. package/dist/requireHook.js +31 -0
  274. package/dist/schema.d.ts +3 -0
  275. package/dist/schema.js +72 -0
  276. package/dist/server/server.d.ts +16 -0
  277. package/dist/server/server.js +158 -0
  278. package/dist/server/ws.d.ts +8 -0
  279. package/dist/server/ws.js +42 -0
  280. package/dist/swcPlugins/autoCSSModules.d.ts +8 -0
  281. package/dist/swcPlugins/autoCSSModules.js +35 -0
  282. package/dist/types.d.ts +100 -0
  283. package/dist/types.js +29 -0
  284. package/dist/utils/browsersList.d.ts +5 -0
  285. package/dist/utils/browsersList.js +10 -0
  286. package/dist/utils/depMatch.d.ts +6 -0
  287. package/dist/utils/depMatch.js +46 -0
  288. package/dist/utils/formatWebpackMessages.d.ts +12 -0
  289. package/dist/utils/formatWebpackMessages.js +100 -0
  290. package/package.json +170 -42
  291. package/bundled/css/hotModuleReplacement.js +0 -1203
  292. package/bundled/js/webpackHotDevClient.js +0 -13386
  293. package/lib/DevCompileDonePlugin.d.ts +0 -10
  294. package/lib/DevCompileDonePlugin.js +0 -53
  295. package/lib/cli.js +0 -184
  296. package/lib/getConfig/css.d.ts +0 -22
  297. package/lib/getConfig/css.js +0 -186
  298. package/lib/getConfig/getConfig.d.ts +0 -26
  299. package/lib/getConfig/getConfig.js +0 -578
  300. package/lib/getConfig/nodeModulesTransform.d.ts +0 -13
  301. package/lib/getConfig/nodeModulesTransform.js +0 -141
  302. package/lib/getConfig/pkgMatch.d.ts +0 -2
  303. package/lib/getConfig/pkgMatch.js +0 -58
  304. package/lib/getConfig/resolveDefine.d.ts +0 -5
  305. package/lib/getConfig/resolveDefine.js +0 -53
  306. package/lib/getConfig/runtimePublicPathEntry.d.ts +0 -1
  307. package/lib/getConfig/runtimePublicPathEntry.js +0 -3
  308. package/lib/getConfig/terserOptions.d.ts +0 -41
  309. package/lib/getConfig/terserOptions.js +0 -64
  310. package/lib/index.d.ts +0 -34
  311. package/lib/index.js +0 -314
  312. package/lib/requireHook.d.ts +0 -3
  313. package/lib/requireHook.js +0 -51
  314. package/lib/webpack/plugins/mini-css-extract-plugin/src/CssDependency.js +0 -94
  315. package/lib/webpack/plugins/mini-css-extract-plugin/src/CssDependencyTemplate.js +0 -26
  316. package/lib/webpack/plugins/mini-css-extract-plugin/src/CssLoadingRuntimeModule.js +0 -93
  317. package/lib/webpack/plugins/mini-css-extract-plugin/src/CssModule.js +0 -164
  318. package/lib/webpack/plugins/mini-css-extract-plugin/src/CssModuleFactory.js +0 -32
  319. package/lib/webpack/plugins/mini-css-extract-plugin/src/cjs.js +0 -15
  320. package/lib/webpack/plugins/mini-css-extract-plugin/src/index.js +0 -542
  321. package/lib/webpack/plugins/mini-css-extract-plugin/src/loader.js +0 -319
  322. package/lib/webpack/plugins/mini-css-extract-plugin/src/utils.js +0 -97
  323. package/lib/webpack/plugins/mini-css-extract-plugin.d.ts +0 -1
  324. package/lib/webpack/plugins/mini-css-extract-plugin.js +0 -15
  325. package/lib/webpack/plugins/terser-webpack-plugin/package.json +0 -3
  326. package/lib/webpack/plugins/terser-webpack-plugin/src/Webpack4Cache.js +0 -187
  327. package/lib/webpack/plugins/terser-webpack-plugin/src/Webpack5Cache.js +0 -61
  328. package/lib/webpack/plugins/terser-webpack-plugin/src/index.js +0 -683
  329. package/lib/webpack/plugins/terser-webpack-plugin/src/minify.js +0 -197
  330. package/lib/webpack/plugins/terser-webpack-plugin.d.ts +0 -1
  331. package/lib/webpack/plugins/terser-webpack-plugin.js +0 -15
  332. package/lib/webpackHotDevClient/formatWebpackMessages.d.ts +0 -11
  333. package/lib/webpackHotDevClient/formatWebpackMessages.js +0 -127
  334. package/lib/webpackHotDevClient/webpackHotDevClient.js +0 -311
@@ -0,0 +1,10 @@
1
+ import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
2
+ import { Env, IConfig } from '../types';
3
+ interface IOpts {
4
+ config: Config;
5
+ userConfig: IConfig;
6
+ cwd: string;
7
+ env: Env;
8
+ }
9
+ export declare function addMiniCSSExtractPlugin(opts: IOpts): Promise<void>;
10
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.addMiniCSSExtractPlugin = void 0;
16
+ // @ts-ignore
17
+ const mini_css_extract_plugin_1 = __importDefault(require("@umijs/bundler-webpack/compiled/mini-css-extract-plugin"));
18
+ const types_1 = require("../types");
19
+ function addMiniCSSExtractPlugin(opts) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ const { config, userConfig, env } = opts;
22
+ const hash = env !== types_1.Env.development && userConfig.hash ? '.[contenthash:8]' : '';
23
+ if (!userConfig.styleLoader) {
24
+ config.plugin('mini-css-extract-plugin').use(mini_css_extract_plugin_1.default, [
25
+ {
26
+ filename: `[name]${hash}.css`,
27
+ chunkFilename: `[name]${hash}.chunk.css`,
28
+ ignoreOrder: true,
29
+ },
30
+ ]);
31
+ }
32
+ });
33
+ }
34
+ exports.addMiniCSSExtractPlugin = addMiniCSSExtractPlugin;
@@ -0,0 +1,10 @@
1
+ import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
2
+ import { Env, IConfig } from '../types';
3
+ interface IOpts {
4
+ config: Config;
5
+ userConfig: IConfig;
6
+ cwd: string;
7
+ env: Env;
8
+ }
9
+ export declare function addNodePolyfill(opts: IOpts): Promise<void>;
10
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.addNodePolyfill = void 0;
13
+ const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
14
+ function addNodePolyfill(opts) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ const { config } = opts;
17
+ const nodeLibs = require('node-libs-browser');
18
+ config.plugin('node-polyfill-provider').use(webpack_1.ProvidePlugin, [
19
+ {
20
+ Buffer: ['buffer', 'Buffer'],
21
+ },
22
+ ]);
23
+ config.resolve.fallback.merge(Object.assign(Object.assign({}, Object.keys(nodeLibs).reduce((memo, key) => {
24
+ if (nodeLibs[key]) {
25
+ memo[key] = nodeLibs[key];
26
+ }
27
+ else {
28
+ memo[key] = false;
29
+ }
30
+ return memo;
31
+ }, {})), { http: false, https: false }));
32
+ });
33
+ }
34
+ exports.addNodePolyfill = addNodePolyfill;
@@ -0,0 +1,11 @@
1
+ import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
2
+ import { Env, IConfig } from '../types';
3
+ interface IOpts {
4
+ name?: string;
5
+ config: Config;
6
+ userConfig: IConfig;
7
+ cwd: string;
8
+ env: Env;
9
+ }
10
+ export declare function addProgressPlugin(opts: IOpts): Promise<void>;
11
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.addProgressPlugin = void 0;
16
+ const ProgressPlugin_1 = __importDefault(require("../plugins/ProgressPlugin"));
17
+ function addProgressPlugin(opts) {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ const { config, name } = opts;
20
+ config.plugin('progress-plugin').use(ProgressPlugin_1.default, [
21
+ {
22
+ name,
23
+ },
24
+ ]);
25
+ });
26
+ }
27
+ exports.addProgressPlugin = addProgressPlugin;
@@ -0,0 +1,10 @@
1
+ import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
2
+ import { Env, IConfig } from '../types';
3
+ interface IOpts {
4
+ config: Config;
5
+ userConfig: IConfig;
6
+ cwd: string;
7
+ env: Env;
8
+ }
9
+ export declare function applyPurgeCSSWebpackPlugin(opts: IOpts): Promise<void>;
10
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.applyPurgeCSSWebpackPlugin = void 0;
13
+ const types_1 = require("../types");
14
+ function applyPurgeCSSWebpackPlugin(opts) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ const { config, userConfig, cwd, env } = opts;
17
+ config;
18
+ userConfig;
19
+ cwd;
20
+ env;
21
+ if (userConfig.purgeCSS && env === types_1.Env.production) {
22
+ config
23
+ .plugin('purgecss-webpack-plugin')
24
+ .use(require('@umijs/bundler-webpack/compiled/purgecss-webpack-plugin'), [
25
+ {
26
+ paths: [],
27
+ },
28
+ ]);
29
+ }
30
+ });
31
+ }
32
+ exports.applyPurgeCSSWebpackPlugin = applyPurgeCSSWebpackPlugin;
@@ -0,0 +1,6 @@
1
+ import { Configuration } from '@umijs/bundler-webpack/compiled/webpack';
2
+ interface IOpts {
3
+ webpackConfig: Configuration;
4
+ }
5
+ export declare function addSpeedMeasureWebpackPlugin(opts: IOpts): Promise<Configuration>;
6
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.addSpeedMeasureWebpackPlugin = void 0;
16
+ // @ts-ignore
17
+ const speed_measure_webpack_plugin_1 = __importDefault(require("@umijs/bundler-webpack/compiled/speed-measure-webpack-plugin"));
18
+ const path_1 = require("path");
19
+ function addSpeedMeasureWebpackPlugin(opts) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ let webpackConfig = opts.webpackConfig;
22
+ if (process.env.SPEED_MEASURE) {
23
+ const smpOption = process.env.SPEED_MEASURE === 'JSON'
24
+ ? {
25
+ outputFormat: 'json',
26
+ outputTarget: (0, path_1.join)(process.cwd(), 'SPEED_MEASURE.json'),
27
+ }
28
+ : { outputFormat: 'human', outputTarget: console.log };
29
+ webpackConfig = new speed_measure_webpack_plugin_1.default(smpOption).wrap(webpackConfig);
30
+ }
31
+ return webpackConfig;
32
+ });
33
+ }
34
+ exports.addSpeedMeasureWebpackPlugin = addSpeedMeasureWebpackPlugin;
@@ -0,0 +1,11 @@
1
+ import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
2
+ import { Env, IConfig } from '../types';
3
+ interface IOpts {
4
+ config: Config;
5
+ userConfig: IConfig;
6
+ cwd: string;
7
+ env: Env;
8
+ browsers: any;
9
+ }
10
+ export declare function addSVGRules(opts: IOpts): Promise<void>;
11
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.addSVGRules = void 0;
13
+ function addSVGRules(opts) {
14
+ return __awaiter(this, void 0, void 0, function* () {
15
+ const { config, userConfig } = opts;
16
+ const { svgr, svgo = {} } = userConfig;
17
+ if (svgr) {
18
+ const svgrRule = config.module.rule('svgr');
19
+ svgrRule
20
+ .test(/\.svg$/i)
21
+ .issuer(/\.[jt]sx?$/)
22
+ .use('svgr-loader')
23
+ .loader(require.resolve('@umijs/bundler-webpack/compiled/@svgr/webpack'))
24
+ .options(Object.assign(Object.assign({ svgoConfig: Object.assign({}, (svgo || {})) }, svgr), { svgo: !!svgo }));
25
+ }
26
+ if (svgo === false) {
27
+ const svgRule = config.module.rule('svg');
28
+ svgRule
29
+ .test(/\.svg$/)
30
+ .use('url-loader')
31
+ .loader(require.resolve('@umijs/bundler-webpack/compiled/url-loader'));
32
+ return;
33
+ }
34
+ const svgRule = config.module.rule('svg');
35
+ svgRule
36
+ .test(/\.svg$/)
37
+ .use('svgo-loader')
38
+ .loader(require.resolve('@umijs/bundler-webpack/compiled/svgo-loader'))
39
+ .options(Object.assign({ configFile: false }, svgo))
40
+ .end();
41
+ });
42
+ }
43
+ exports.addSVGRules = addSVGRules;
@@ -0,0 +1,11 @@
1
+ export declare const DEFAULT_DEVTOOL = "cheap-module-source-map";
2
+ export declare const DEFAULT_OUTPUT_PATH = "dist";
3
+ export declare const MFSU_NAME = "MFSU";
4
+ export declare enum MESSAGE_TYPE {
5
+ ok = "ok",
6
+ warnings = "warnings",
7
+ errors = "errors",
8
+ hash = "hash",
9
+ stillOk = "still-ok",
10
+ invalid = "invalid"
11
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MESSAGE_TYPE = exports.MFSU_NAME = exports.DEFAULT_OUTPUT_PATH = exports.DEFAULT_DEVTOOL = void 0;
4
+ exports.DEFAULT_DEVTOOL = 'cheap-module-source-map';
5
+ exports.DEFAULT_OUTPUT_PATH = 'dist';
6
+ exports.MFSU_NAME = 'MFSU';
7
+ var MESSAGE_TYPE;
8
+ (function (MESSAGE_TYPE) {
9
+ MESSAGE_TYPE["ok"] = "ok";
10
+ MESSAGE_TYPE["warnings"] = "warnings";
11
+ MESSAGE_TYPE["errors"] = "errors";
12
+ MESSAGE_TYPE["hash"] = "hash";
13
+ MESSAGE_TYPE["stillOk"] = "still-ok";
14
+ MESSAGE_TYPE["invalid"] = "invalid";
15
+ })(MESSAGE_TYPE = exports.MESSAGE_TYPE || (exports.MESSAGE_TYPE = {}));
package/dist/dev.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { IConfig } from './types';
2
+ interface IOpts {
3
+ afterMiddlewares?: any[];
4
+ beforeMiddlewares?: any[];
5
+ onDevCompileDone?: Function;
6
+ port?: number;
7
+ host?: string;
8
+ chainWebpack?: Function;
9
+ modifyWebpackConfig?: Function;
10
+ beforeBabelPlugins?: any[];
11
+ beforeBabelPresets?: any[];
12
+ extraBabelPlugins?: any[];
13
+ extraBabelPresets?: any[];
14
+ cwd: string;
15
+ config: IConfig;
16
+ entry: Record<string, string>;
17
+ }
18
+ export declare function dev(opts: IOpts): Promise<void>;
19
+ export {};
package/dist/dev.js ADDED
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.dev = void 0;
16
+ const mfsu_1 = require("@umijs/mfsu");
17
+ const webpack_1 = __importDefault(require("../compiled/webpack"));
18
+ const config_1 = require("./config/config");
19
+ const constants_1 = require("./constants");
20
+ const server_1 = require("./server/server");
21
+ const types_1 = require("./types");
22
+ function dev(opts) {
23
+ var _a;
24
+ var _b;
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const enableMFSU = opts.config.mfsu !== false;
27
+ let mfsu = null;
28
+ if (enableMFSU) {
29
+ mfsu = new mfsu_1.MFSU({
30
+ implementor: webpack_1.default,
31
+ buildDepWithESBuild: (_a = opts.config.mfsu) === null || _a === void 0 ? void 0 : _a.esbuild,
32
+ });
33
+ }
34
+ const webpackConfig = yield (0, config_1.getConfig)({
35
+ cwd: opts.cwd,
36
+ env: types_1.Env.development,
37
+ entry: opts.entry,
38
+ userConfig: opts.config,
39
+ extraBabelPlugins: [
40
+ ...(opts.beforeBabelPlugins || []),
41
+ ...((mfsu === null || mfsu === void 0 ? void 0 : mfsu.getBabelPlugins()) || []),
42
+ ...(opts.extraBabelPlugins || []),
43
+ ],
44
+ extraBabelPresets: [
45
+ ...(opts.beforeBabelPresets || []),
46
+ ...(opts.extraBabelPresets || []),
47
+ ],
48
+ chainWebpack: opts.chainWebpack,
49
+ modifyWebpackConfig: opts.modifyWebpackConfig,
50
+ hmr: true,
51
+ analyze: process.env.ANALYZE,
52
+ });
53
+ const depConfig = yield (0, config_1.getConfig)({
54
+ cwd: opts.cwd,
55
+ env: types_1.Env.development,
56
+ entry: opts.entry,
57
+ userConfig: opts.config,
58
+ hash: true,
59
+ staticPathPrefix: mfsu_1.MF_DEP_PREFIX,
60
+ name: constants_1.MFSU_NAME,
61
+ });
62
+ (_b = webpackConfig.resolve).alias || (_b.alias = {});
63
+ // TODO: REMOVE ME
64
+ ['@umijs/utils/compiled/strip-ansi', 'react-error-overlay'].forEach((dep) => {
65
+ // @ts-ignore
66
+ webpackConfig.resolve.alias[dep] = require.resolve(dep);
67
+ });
68
+ mfsu === null || mfsu === void 0 ? void 0 : mfsu.setWebpackConfig({
69
+ config: webpackConfig,
70
+ depConfig: depConfig,
71
+ });
72
+ yield (0, server_1.createServer)({
73
+ webpackConfig,
74
+ userConfig: opts.config,
75
+ cwd: opts.cwd,
76
+ beforeMiddlewares: [
77
+ ...((mfsu === null || mfsu === void 0 ? void 0 : mfsu.getMiddlewares()) || []),
78
+ ...(opts.beforeMiddlewares || []),
79
+ ],
80
+ port: opts.port,
81
+ host: opts.host,
82
+ afterMiddlewares: [...(opts.afterMiddlewares || [])],
83
+ onDevCompileDone: opts.onDevCompileDone,
84
+ });
85
+ });
86
+ }
87
+ exports.dev = dev;
@@ -0,0 +1,5 @@
1
+ export type { RequestHandler } from '../compiled/express';
2
+ export * from './build';
3
+ export * from './config/config';
4
+ export * from './dev';
5
+ export * from './schema';
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./build"), exports);
14
+ __exportStar(require("./config/config"), exports);
15
+ __exportStar(require("./dev"), exports);
16
+ __exportStar(require("./schema"), exports);
@@ -0,0 +1,11 @@
1
+ import { Compilation, Compiler } from '@umijs/bundler-webpack/compiled/webpack';
2
+ interface IOpts {
3
+ sourcemap?: any;
4
+ }
5
+ declare class ESBuildCSSMinifyPlugin {
6
+ options: IOpts;
7
+ constructor(options?: IOpts);
8
+ apply(compiler: Compiler): void;
9
+ transformAssets(compilation: Compilation): Promise<void>;
10
+ }
11
+ export default ESBuildCSSMinifyPlugin;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
13
+ const webpack_sources_1 = require("@umijs/bundler-webpack/compiled/webpack-sources");
14
+ const version = require('../../package.json');
15
+ const PLUGIN_NAME = 'ESBuildCSSMinifyPlugin';
16
+ const RE_CSS_FILE = /\.css(\?.*)?$/i;
17
+ class ESBuildCSSMinifyPlugin {
18
+ constructor(options = {}) {
19
+ this.options = options;
20
+ }
21
+ apply(compiler) {
22
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
23
+ compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_, hash) => {
24
+ hash.update(JSON.stringify({
25
+ version,
26
+ options: this.options,
27
+ }));
28
+ });
29
+ compilation.hooks.processAssets.tapPromise({
30
+ name: PLUGIN_NAME,
31
+ stage: 400,
32
+ additionalAssets: true,
33
+ }, () => __awaiter(this, void 0, void 0, function* () {
34
+ yield this.transformAssets(compilation);
35
+ }));
36
+ });
37
+ }
38
+ transformAssets(compilation) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const { options: { devtool }, } = compilation.compiler;
41
+ const sourcemap = this.options.sourcemap === undefined
42
+ ? devtool && devtool
43
+ : this.options.sourcemap;
44
+ const assets = compilation.getAssets().filter((asset) => {
45
+ return !asset.info.minimized && RE_CSS_FILE.test(asset.name);
46
+ });
47
+ yield Promise.all(assets.map((asset) => __awaiter(this, void 0, void 0, function* () {
48
+ const { source, map } = asset.source.sourceAndMap();
49
+ const sourceAsString = source.toString();
50
+ const result = yield (0, esbuild_1.transform)(sourceAsString, {
51
+ loader: 'css',
52
+ sourcemap,
53
+ sourcefile: asset.name,
54
+ minify: true,
55
+ });
56
+ compilation.updateAsset(asset.name,
57
+ // @ts-ignore
58
+ sourcemap
59
+ ? new webpack_sources_1.SourceMapSource(result.code, asset.name, result.map, sourceAsString, map, true)
60
+ : new webpack_sources_1.RawSource(result.code), Object.assign(Object.assign({}, asset.info), { minimized: true }));
61
+ })));
62
+ });
63
+ }
64
+ }
65
+ exports.default = ESBuildCSSMinifyPlugin;
@@ -0,0 +1,15 @@
1
+ import { Compiler, ProgressPlugin } from '@umijs/bundler-webpack/compiled/webpack';
2
+ interface IOpts {
3
+ name?: string;
4
+ }
5
+ declare class UmiProgressPlugin extends ProgressPlugin {
6
+ options: IOpts;
7
+ constructor(options?: IOpts);
8
+ apply(compiler: Compiler): void;
9
+ updateProgress(opts: {
10
+ percent: number;
11
+ message: string;
12
+ details: any[];
13
+ }): void;
14
+ }
15
+ export default UmiProgressPlugin;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
4
+ const utils_1 = require("@umijs/utils");
5
+ const PLUGIN_NAME = 'ProgressPlugin';
6
+ class UmiProgressPlugin extends webpack_1.ProgressPlugin {
7
+ constructor(options = {}) {
8
+ super({ activeModules: true });
9
+ this.options = options;
10
+ this.handler = (percent, message, ...details) => {
11
+ this.updateProgress({ percent, message, details });
12
+ };
13
+ }
14
+ apply(compiler) {
15
+ compiler.hooks.invalid.tap(PLUGIN_NAME, () => {
16
+ utils_1.logger.wait('compiling...');
17
+ });
18
+ compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
19
+ const { errors, warnings } = stats.toJson({
20
+ all: false,
21
+ warnings: true,
22
+ errors: true,
23
+ colors: true,
24
+ });
25
+ const hasErrors = !!(errors === null || errors === void 0 ? void 0 : errors.length);
26
+ const hasWarnings = !!(warnings === null || warnings === void 0 ? void 0 : warnings.length);
27
+ hasWarnings;
28
+ if (hasErrors) {
29
+ errors.forEach((error) => {
30
+ utils_1.logger.error(`${error.moduleName}${error.loc ? `:${error.loc}` : ''}`);
31
+ console.log(error.message);
32
+ });
33
+ }
34
+ else {
35
+ const prefix = this.options.name ? `${this.options.name} ` : '';
36
+ utils_1.logger.event(`${prefix}compiled successfully in ${stats.endTime - stats.startTime} ms (${stats.compilation.modules.size} modules)`);
37
+ }
38
+ });
39
+ }
40
+ updateProgress(opts) {
41
+ opts;
42
+ }
43
+ }
44
+ exports.default = UmiProgressPlugin;
@@ -0,0 +1,9 @@
1
+ import { Compiler } from '@umijs/bundler-webpack/compiled/webpack';
2
+ interface IOpts {
3
+ }
4
+ declare class _SamplePlugin {
5
+ options: IOpts;
6
+ constructor(options?: IOpts);
7
+ apply(compiler: Compiler): void;
8
+ }
9
+ export default _SamplePlugin;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const PLUGIN_NAME = 'SamplePlugin';
4
+ class _SamplePlugin {
5
+ constructor(options = {}) {
6
+ this.options = options;
7
+ }
8
+ apply(compiler) {
9
+ compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
10
+ compilation.hooks.chunkHash.tap(PLUGIN_NAME, (_) => { });
11
+ });
12
+ }
13
+ }
14
+ exports.default = _SamplePlugin;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // MIT: copy from https://github.com/vercel/next.js/blob/canary/packages/next/build/webpack/require-hook.ts
3
+ // sync injects a hook for webpack and webpack/... requires to use the internal ncc webpack version
4
+ // this is in order for userland plugins to attach to the same webpack instance as umi
5
+ // the individual compiled modules are as defined for the compilation in bundles/webpack/packages/*
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ // @ts-ignore
11
+ const deepImports_json_1 = __importDefault(require("@umijs/bundler-webpack/compiled/webpack/deepImports.json"));
12
+ const hookPropertyMap = new Map([
13
+ ['webpack', '@umijs/bundler-webpack/compiled/webpack'],
14
+ ['webpack/package', '@umijs/bundler-webpack/compiled/webpack/package'],
15
+ ['webpack/package.json', '@umijs/bundler-webpack/compiled/webpack/package'],
16
+ ['webpack/lib/webpack', '@umijs/bundler-webpack/compiled/webpack'],
17
+ ['webpack/lib/webpack.js', '@umijs/bundler-webpack/compiled/webpack'],
18
+ ]);
19
+ deepImports_json_1.default.forEach((item) => {
20
+ const name = item.split('/').unshift();
21
+ hookPropertyMap.set(item, `@umijs/bundler-webpack/compiled/webpack/${name}`);
22
+ hookPropertyMap.set(`${item}.js`, `@umijs/bundler-webpack/compiled/webpack/${name}`);
23
+ });
24
+ const mod = require('module');
25
+ const resolveFilename = mod._resolveFilename;
26
+ mod._resolveFilename = function (request, parent, isMain, options) {
27
+ const hookResolved = hookPropertyMap.get(request);
28
+ if (hookResolved)
29
+ request = hookResolved;
30
+ return resolveFilename.call(mod, request, parent, isMain, options);
31
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="hapi__joi" />
2
+ import type { Root } from '@hapi/joi';
3
+ export declare function getSchemas(): Record<string, (Joi: Root) => any>;