@umijs/bundler-webpack 4.0.0-rc.4 → 4.0.0-rc.7

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 (43) hide show
  1. package/compiled/autoprefixer/browserslist/index.d.ts +2 -0
  2. package/compiled/autoprefixer/index.js +3 -3
  3. package/compiled/autoprefixer/postcss/lib/declaration.d.ts +1 -1
  4. package/compiled/autoprefixer/postcss/lib/node.d.ts +2 -2
  5. package/compiled/cssnano/index.js +5 -5
  6. package/compiled/express.d.ts +2 -0
  7. package/compiled/http-proxy-middleware/index.js +10 -10
  8. package/compiled/mini-css-extract-plugin/index.js +440 -401
  9. package/compiled/mini-css-extract-plugin/loader.js +3 -1
  10. package/compiled/mini-css-extract-plugin/utils.js +2 -0
  11. package/compiled/terser/index.js +1 -1
  12. package/compiled/webpack/index.js +3974 -3052
  13. package/compiled/webpack-manifest-plugin/index.js +1 -1
  14. package/dist/config/cssRules.js +1 -1
  15. package/dist/config/javaScriptRules.js +2 -5
  16. package/dist/index.d.ts +4 -1
  17. package/dist/plugins/ESBuildCSSMinifyPlugin.js +1 -3
  18. package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +1 -1
  19. package/dist/plugins/ParcelCSSMinifyPlugin.js +3 -2
  20. package/dist/plugins/RuntimePublicPathPlugin.js +1 -1
  21. package/dist/schema.js +4 -4
  22. package/dist/server/server.js +5 -2
  23. package/package.json +20 -25
  24. package/compiled/css-loader/LICENSE +0 -20
  25. package/compiled/css-loader/api.js +0 -102
  26. package/compiled/css-loader/getUrl.js +0 -29
  27. package/compiled/css-loader/index.js +0 -2
  28. package/compiled/css-loader/noSourceMaps.js +0 -5
  29. package/compiled/css-loader/package.json +0 -1
  30. package/compiled/css-loader/sourceMaps.js +0 -22
  31. package/compiled/express/LICENSE +0 -24
  32. package/compiled/express/body-parser/index.d.ts +0 -104
  33. package/compiled/express/connect/index.d.ts +0 -93
  34. package/compiled/express/express-serve-static-core/index.d.ts +0 -1252
  35. package/compiled/express/index.d.ts +0 -133
  36. package/compiled/express/index.js +0 -321
  37. package/compiled/express/mime/index.d.ts +0 -35
  38. package/compiled/express/package.json +0 -1
  39. package/compiled/express/qs/index.d.ts +0 -62
  40. package/compiled/express/range-parser/index.d.ts +0 -35
  41. package/compiled/express/serve-static/index.d.ts +0 -108
  42. package/compiled/less/index.js +0 -31
  43. package/compiled/less/package.json +0 -1
@@ -1 +1 @@
1
- (function(){"use strict";var e={886:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t.transformFiles=t.reduceChunk=t.reduceAssets=t.generateManifest=void 0;const n=s(17);const generateManifest=(e,t,{generate:s,seed:n={}})=>{let o;if(s){const i=Array.from(e.entrypoints.entries());const a=i.reduce(((e,[t,s])=>Object.assign(e,{[t]:s.getFiles()})),{});o=s(n,t,a)}else{o=t.reduce(((e,t)=>Object.assign(e,{[t.name]:t.path})),n)}return o};t.generateManifest=generateManifest;const getFileType=(e,{transformExtensions:t})=>{const s=e.replace(/\?.*/,"");const n=s.split(".");const o=n.pop();return t.test(o)?`${n.pop()}.${o}`:o};const reduceAssets=(e,t,s)=>{let o;if(s[t.name]){o=s[t.name]}else if(t.info.sourceFilename){o=n.join(n.dirname(t.name),n.basename(t.info.sourceFilename))}if(o){return e.concat({isAsset:true,isChunk:false,isInitial:false,isModuleAsset:true,name:o,path:t.name})}const i=t.chunks&&t.chunks.length>0;if(i){return e}return e.concat({isAsset:true,isChunk:false,isInitial:false,isModuleAsset:false,name:t.name,path:t.name})};t.reduceAssets=reduceAssets;const reduceChunk=(e,t,s,o)=>{Array.from(t.auxiliaryFiles||[]).forEach((e=>{o[e]={isAsset:true,isChunk:false,isInitial:false,isModuleAsset:true,name:n.basename(e),path:e}}));return Array.from(t.files).reduce(((e,n)=>{let o=t.name?t.name:null;o=o?s.useEntryKeys&&!n.endsWith(".map")?o:`${o}.${getFileType(n,s)}`:n;return e.concat({chunk:t,isAsset:false,isChunk:true,isInitial:t.isOnlyInitial(),isModuleAsset:false,name:o,path:n})}),e)};t.reduceChunk=reduceChunk;const standardizeFilePaths=e=>{const t=Object.assign({},e);t.name=e.name.replace(/\\/g,"/");t.path=e.path.replace(/\\/g,"/");return t};const transformFiles=(e,t)=>["filter","map","sort"].filter((e=>!!t[e])).reduce(((e,s)=>e[s](t[s])),e).map(standardizeFilePaths);t.transformFiles=transformFiles},863:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t.normalModuleLoaderHook=t.getCompilerHooks=t.emitHook=t.beforeRunHook=void 0;const n=s(147);const o=s(17);const i=s(535);const a=s(728);const r=s(886);const u=new WeakMap;const getCompilerHooks=e=>{let t=u.get(e);if(typeof t==="undefined"){t={afterEmit:new i.SyncWaterfallHook(["manifest"]),beforeEmit:new i.SyncWaterfallHook(["manifest"])};u.set(e,t)}return t};t.getCompilerHooks=getCompilerHooks;const beforeRunHook=({emitCountMap:e,manifestFileName:t},s,n)=>{const o=e.get(t)||0;e.set(t,o+1);if(n){n()}};t.beforeRunHook=beforeRunHook;const l=function emit({compiler:e,emitCountMap:t,manifestAssetId:s,manifestFileName:i,moduleAssets:u,options:l},c){const p=t.get(i)-1;const m=c.getStats().toJson({all:false,assets:true,cachedAssets:true,ids:true,publicPath:true});const f=l.publicPath!==null?l.publicPath:m.publicPath;const{basePath:d,removeKeyHash:h}=l;t.set(i,p);const k={};let b=Array.from(c.chunks).reduce(((e,t)=>r.reduceChunk(e,t,l,k)),[]);b=m.assets.reduce(((e,t)=>r.reduceAssets(e,t,u)),b);b=b.filter((({name:s,path:n})=>{var i;return!n.includes("hot-update")&&typeof t.get(o.join(((i=e.options.output)===null||i===void 0?void 0:i.path)||"<unknown>",s))==="undefined"}));b.forEach((e=>{delete k[e.path]}));Object.keys(k).forEach((e=>{b=b.concat(k[e])}));b=b.map((e=>{const normalizePath=e=>{if(!e.endsWith("/")){return`${e}/`}return e};const t={name:d?normalizePath(d)+e.name:e.name,path:f?normalizePath(f)+e.path:e.path};t.name=h?t.name.replace(h,""):t.name;return Object.assign(e,t)}));b=r.transformFiles(b,l);let g=r.generateManifest(c,b,l);const _=p===0;g=getCompilerHooks(e).beforeEmit.call(g);if(_){const e=l.serialize(g);c.emitAsset(s,new a.RawSource(e));if(l.writeToFileEmit){n.mkdirSync(o.dirname(i),{recursive:true});n.writeFileSync(i,e)}}getCompilerHooks(e).afterEmit.call(g)};t.emitHook=l;const normalModuleLoaderHook=({moduleAssets:e},t,s)=>{const{emitFile:n}=t;t.emitFile=(t,i,a)=>{if(s.userRequest&&!e[t]){Object.assign(e,{[t]:o.join(o.dirname(t),o.basename(s.userRequest))})}return n.call(s,t,i,a)}};t.normalModuleLoaderHook=normalModuleLoaderHook},25:function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.WebpackManifestPlugin=t.getCompilerHooks=void 0;const o=s(17);const i=n(s(27));const a=n(s(205));const r=s(863);Object.defineProperty(t,"getCompilerHooks",{enumerable:true,get:function(){return r.getCompilerHooks}});const u=new Map;const l={assetHookStage:Infinity,basePath:"",fileName:"manifest.json",filter:null,generate:void 0,map:null,publicPath:null,removeKeyHash:/([a-f0-9]{16,32}\.?)/gi,seed:void 0,serialize(e){return JSON.stringify(e,null,2)},sort:null,transformExtensions:/^(gz|map)$/i,useEntryKeys:false,useLegacyEmit:false,writeToFileEmit:false};class WebpackManifestPlugin{constructor(e){this.options=Object.assign({},l,e)}apply(e){var t,s,n;const l={};const c=o.resolve(((t=e.options.output)===null||t===void 0?void 0:t.path)||"./",this.options.fileName);const p=o.relative(((s=e.options.output)===null||s===void 0?void 0:s.path)||"./",c);const m=r.beforeRunHook.bind(this,{emitCountMap:u,manifestFileName:c});const f=r.emitHook.bind(this,{compiler:e,emitCountMap:u,manifestAssetId:p,manifestFileName:c,moduleAssets:l,options:this.options});const d=r.normalModuleLoaderHook.bind(this,{moduleAssets:l});const h={name:"WebpackManifestPlugin",stage:this.options.assetHookStage};e.hooks.compilation.tap(h,(e=>{const t=!a.default.getCompilationHooks?e.hooks.normalModuleLoader:a.default.getCompilationHooks(e).loader;t.tap(h,d)}));if(((n=i.default.version)===null||n===void 0?void 0:n.startsWith("4"))||this.options.useLegacyEmit===true){e.hooks.emit.tap(h,f)}else{e.hooks.thisCompilation.tap(h,(e=>{e.hooks.processAssets.tap(h,(()=>f(e)))}))}e.hooks.run.tap(h,m);e.hooks.watchRun.tap(h,m)}}t.WebpackManifestPlugin=WebpackManifestPlugin},205:function(e){e.exports=require("../webpack/NormalModule")},535:function(e){e.exports=require("@umijs/bundler-webpack/compiled/tapable")},27:function(e){e.exports=require("@umijs/bundler-webpack/compiled/webpack")},728:function(e){e.exports=require("@umijs/bundler-webpack/compiled/webpack-sources")},147:function(e){e.exports=require("fs")},17:function(e){e.exports=require("path")}};var t={};function __nccwpck_require__(s){var n=t[s];if(n!==undefined){return n.exports}var o=t[s]={exports:{}};var i=true;try{e[s].call(o.exports,o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[s]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var s=__nccwpck_require__(25);module.exports=s})();
1
+ (function(){"use strict";var e={156:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t.transformFiles=t.reduceChunk=t.reduceAssets=t.generateManifest=void 0;const n=s(17);const generateManifest=(e,t,{generate:s,seed:n={}})=>{let o;if(s){const i=Array.from(e.entrypoints.entries());const a=i.reduce(((e,[t,s])=>Object.assign(e,{[t]:s.getFiles()})),{});o=s(n,t,a)}else{o=t.reduce(((e,t)=>Object.assign(e,{[t.name]:t.path})),n)}return o};t.generateManifest=generateManifest;const getFileType=(e,{transformExtensions:t})=>{const s=e.replace(/\?.*/,"");const n=s.split(".");const o=n.pop();return t.test(o)?`${n.pop()}.${o}`:o};const reduceAssets=(e,t,s)=>{let o;if(s[t.name]){o=s[t.name]}else if(t.info.sourceFilename){o=n.join(n.dirname(t.name),n.basename(t.info.sourceFilename))}if(o){return e.concat({isAsset:true,isChunk:false,isInitial:false,isModuleAsset:true,name:o,path:t.name})}const i=t.chunks&&t.chunks.length>0;if(i){return e}return e.concat({isAsset:true,isChunk:false,isInitial:false,isModuleAsset:false,name:t.name,path:t.name})};t.reduceAssets=reduceAssets;const reduceChunk=(e,t,s,o)=>{Array.from(t.auxiliaryFiles||[]).forEach((e=>{o[e]={isAsset:true,isChunk:false,isInitial:false,isModuleAsset:true,name:n.basename(e),path:e}}));return Array.from(t.files).reduce(((e,n)=>{let o=t.name?t.name:null;o=o?s.useEntryKeys&&!n.endsWith(".map")?o:`${o}.${getFileType(n,s)}`:n;return e.concat({chunk:t,isAsset:false,isChunk:true,isInitial:t.isOnlyInitial(),isModuleAsset:false,name:o,path:n})}),e)};t.reduceChunk=reduceChunk;const standardizeFilePaths=e=>{const t=Object.assign({},e);t.name=e.name.replace(/\\/g,"/");t.path=e.path.replace(/\\/g,"/");return t};const transformFiles=(e,t)=>["filter","map","sort"].filter((e=>!!t[e])).reduce(((e,s)=>e[s](t[s])),e).map(standardizeFilePaths);t.transformFiles=transformFiles},874:function(e,t,s){Object.defineProperty(t,"__esModule",{value:true});t.normalModuleLoaderHook=t.getCompilerHooks=t.emitHook=t.beforeRunHook=void 0;const n=s(147);const o=s(17);const i=s(535);const a=s(728);const r=s(156);const u=new WeakMap;const getCompilerHooks=e=>{let t=u.get(e);if(typeof t==="undefined"){t={afterEmit:new i.SyncWaterfallHook(["manifest"]),beforeEmit:new i.SyncWaterfallHook(["manifest"])};u.set(e,t)}return t};t.getCompilerHooks=getCompilerHooks;const beforeRunHook=({emitCountMap:e,manifestFileName:t},s,n)=>{const o=e.get(t)||0;e.set(t,o+1);if(n){n()}};t.beforeRunHook=beforeRunHook;const l=function emit({compiler:e,emitCountMap:t,manifestAssetId:s,manifestFileName:i,moduleAssets:u,options:l},c){const p=t.get(i)-1;const m=c.getStats().toJson({all:false,assets:true,cachedAssets:true,ids:true,publicPath:true});const f=l.publicPath!==null?l.publicPath:m.publicPath;const{basePath:d,removeKeyHash:h}=l;t.set(i,p);const k={};let b=Array.from(c.chunks).reduce(((e,t)=>r.reduceChunk(e,t,l,k)),[]);b=m.assets.reduce(((e,t)=>r.reduceAssets(e,t,u)),b);b=b.filter((({name:s,path:n})=>{var i;return!n.includes("hot-update")&&typeof t.get(o.join(((i=e.options.output)===null||i===void 0?void 0:i.path)||"<unknown>",s))==="undefined"}));b.forEach((e=>{delete k[e.path]}));Object.keys(k).forEach((e=>{b=b.concat(k[e])}));b=b.map((e=>{const normalizePath=e=>{if(!e.endsWith("/")){return`${e}/`}return e};const t={name:d?normalizePath(d)+e.name:e.name,path:f?normalizePath(f)+e.path:e.path};t.name=h?t.name.replace(h,""):t.name;return Object.assign(e,t)}));b=r.transformFiles(b,l);let g=r.generateManifest(c,b,l);const _=p===0;g=getCompilerHooks(e).beforeEmit.call(g);if(_){const e=l.serialize(g);c.emitAsset(s,new a.RawSource(e));if(l.writeToFileEmit){n.mkdirSync(o.dirname(i),{recursive:true});n.writeFileSync(i,e)}}getCompilerHooks(e).afterEmit.call(g)};t.emitHook=l;const normalModuleLoaderHook=({moduleAssets:e},t,s)=>{const{emitFile:n}=t;t.emitFile=(t,i,a)=>{if(s.userRequest&&!e[t]){Object.assign(e,{[t]:o.join(o.dirname(t),o.basename(s.userRequest))})}return n.call(s,t,i,a)}};t.normalModuleLoaderHook=normalModuleLoaderHook},131:function(e,t,s){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.WebpackManifestPlugin=t.getCompilerHooks=void 0;const o=s(17);const i=n(s(205));const a=s(874);Object.defineProperty(t,"getCompilerHooks",{enumerable:true,get:function(){return a.getCompilerHooks}});const r=new Map;const u={assetHookStage:Infinity,basePath:"",fileName:"manifest.json",filter:null,generate:void 0,map:null,publicPath:null,removeKeyHash:/([a-f0-9]{16,32}\.?)/gi,seed:void 0,serialize(e){return JSON.stringify(e,null,2)},sort:null,transformExtensions:/^(gz|map)$/i,useEntryKeys:false,useLegacyEmit:false,writeToFileEmit:false};class WebpackManifestPlugin{constructor(e){this.options=Object.assign({},u,e)}apply(e){var t,s;const n={};const u=o.resolve(((t=e.options.output)===null||t===void 0?void 0:t.path)||"./",this.options.fileName);const l=o.relative(((s=e.options.output)===null||s===void 0?void 0:s.path)||"./",u);const c=a.beforeRunHook.bind(this,{emitCountMap:r,manifestFileName:u});const p=a.emitHook.bind(this,{compiler:e,emitCountMap:r,manifestAssetId:l,manifestFileName:u,moduleAssets:n,options:this.options});const m=a.normalModuleLoaderHook.bind(this,{moduleAssets:n});const f={name:"WebpackManifestPlugin",stage:this.options.assetHookStage};e.hooks.compilation.tap(f,(e=>{const t=!i.default.getCompilationHooks?e.hooks.normalModuleLoader:i.default.getCompilationHooks(e).loader;t.tap(f,m)}));if(this.options.useLegacyEmit===true){e.hooks.emit.tap(f,p)}else{e.hooks.thisCompilation.tap(f,(e=>{e.hooks.processAssets.tap(f,(()=>p(e)))}))}e.hooks.run.tapAsync(f,c);e.hooks.watchRun.tapAsync(f,c)}}t.WebpackManifestPlugin=WebpackManifestPlugin},205:function(e){e.exports=require("../webpack/NormalModule")},535:function(e){e.exports=require("@umijs/bundler-webpack/compiled/tapable")},728:function(e){e.exports=require("@umijs/bundler-webpack/compiled/webpack-sources")},147:function(e){e.exports=require("fs")},17:function(e){e.exports=require("path")}};var t={};function __nccwpck_require__(s){var n=t[s];if(n!==undefined){return n.exports}var o=t[s]={exports:{}};var i=true;try{e[s].call(o.exports,o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[s]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var s=__nccwpck_require__(131);module.exports=s})();
@@ -20,7 +20,7 @@ function addCSSRules(opts) {
20
20
  test: /\.less(\?.*)?$/,
21
21
  loader: require.resolve('@umijs/bundler-webpack/compiled/less-loader'),
22
22
  loaderOptions: {
23
- implementation: require.resolve('@umijs/bundler-webpack/compiled/less'),
23
+ implementation: require.resolve('@umijs/bundler-utils/compiled/less'),
24
24
  lessOptions: Object.assign({ modifyVars: userConfig.theme, javascriptEnabled: true }, userConfig.lessLoader),
25
25
  },
26
26
  },
@@ -8,16 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.addJavaScriptRules = void 0;
16
13
  const mfsu_1 = require("@umijs/mfsu");
17
14
  const utils_1 = require("@umijs/utils");
18
15
  const webpack_1 = require("../../compiled/webpack");
19
16
  const constants_1 = require("../constants");
20
- const autoCSSModules_1 = __importDefault(require("../swcPlugins/autoCSSModules"));
21
17
  const types_1 = require("../types");
22
18
  const depMatch_1 = require("../utils/depMatch");
23
19
  function addJavaScriptRules(opts) {
@@ -118,11 +114,12 @@ function addJavaScriptRules(opts) {
118
114
  });
119
115
  }
120
116
  else if (srcTranspiler === types_1.Transpiler.swc) {
117
+ const AutoCSSModule = require('../swcPlugins/autoCSSModules').default;
121
118
  rule
122
119
  .use('swc-loader')
123
120
  .loader(require.resolve('../loader/swc'))
124
121
  .options({
125
- plugin: (m) => new autoCSSModules_1.default().visitProgram(m),
122
+ plugin: (m) => new AutoCSSModule().visitProgram(m),
126
123
  });
127
124
  }
128
125
  else if (srcTranspiler === types_1.Transpiler.esbuild) {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- export type { RequestHandler } from '../compiled/express';
1
+ import type webpack from '../compiled/webpack';
2
+ export type { RequestHandler } from '@umijs/bundler-utils/compiled/express';
3
+ export type { Compiler, Stats } from '../compiled/webpack';
2
4
  export * from './build';
3
5
  export * from './config/config';
4
6
  export * from './dev';
5
7
  export * from './schema';
8
+ export { webpack };
@@ -38,9 +38,7 @@ class ESBuildCSSMinifyPlugin {
38
38
  transformAssets(compilation) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  const { options: { devtool }, } = compilation.compiler;
41
- const sourcemap = this.options.sourcemap === undefined
42
- ? devtool && devtool
43
- : this.options.sourcemap;
41
+ const sourcemap = this.options.sourcemap === undefined ? !!devtool : this.options.sourcemap;
44
42
  const assets = compilation.getAssets().filter((asset) => {
45
43
  return !asset.info.minimized && RE_CSS_FILE.test(asset.name);
46
44
  });
@@ -1,4 +1,4 @@
1
- import { type TransformOptions } from '@parcel/css';
1
+ import type { TransformOptions } from '@parcel/css';
2
2
  import type { Compiler } from '../../compiled/webpack/types';
3
3
  declare type MinifyPluginOpts = Omit<TransformOptions, 'filename' | 'code' | 'minify'>;
4
4
  export declare class ParcelCSSMinifyPlugin {
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ParcelCSSMinifyPlugin = void 0;
13
- const css_1 = require("@parcel/css");
13
+ const utils_1 = require("@umijs/utils");
14
14
  const buffer_1 = require("buffer");
15
15
  const path_1 = require("path");
16
16
  const webpack_sources_1 = require("../../compiled/webpack-sources");
@@ -60,7 +60,8 @@ class ParcelCSSMinifyPlugin {
60
60
  const { source, map } = asset.source.sourceAndMap();
61
61
  const sourceAsString = source.toString();
62
62
  const code = typeof source === 'string' ? buffer_1.Buffer.from(source) : source;
63
- const result = yield (0, css_1.transform)(Object.assign({ filename: asset.name, code, minify: true, sourceMap: sourcemap }, this.options));
63
+ const { transform } = (0, utils_1.importLazy)('@parcel/css');
64
+ const result = yield transform(Object.assign({ filename: asset.name, code, minify: true, sourceMap: sourcemap }, this.options));
64
65
  const codeString = result.code.toString();
65
66
  compilation.updateAsset(asset.name,
66
67
  // @ts-ignore
@@ -11,7 +11,7 @@ class RuntimePublicPathPlugin {
11
11
  // https://github.com/webpack/webpack/blob/master/lib/runtime/PublicPathRuntimeModule.js
12
12
  if (module.constructor.name === 'PublicPathRuntimeModule') {
13
13
  // @ts-ignore
14
- module._cachedGeneratedCode = `__webpack_require__.p = window.publicPath;`;
14
+ module._cachedGeneratedCode = `__webpack_require__.p = (globalThis || window).publicPath;`;
15
15
  }
16
16
  });
17
17
  });
package/dist/schema.js CHANGED
@@ -34,10 +34,11 @@ function getSchemas() {
34
34
  cssLoaderModules: (Joi) => Joi.object(),
35
35
  cssMinifier: (Joi) => Joi.string().valid(types_1.CSSMinifier.cssnano, types_1.CSSMinifier.esbuild, types_1.CSSMinifier.parcelCSS, types_1.CSSMinifier.none),
36
36
  cssMinifierOptions: (Joi) => Joi.object(),
37
- define: (Joi) => Joi.object(),
38
37
  deadCode: (Joi) => Joi.object(),
38
+ define: (Joi) => Joi.object(),
39
39
  depTranspiler: (Joi) => Joi.string().valid(types_1.Transpiler.babel, types_1.Transpiler.esbuild, types_1.Transpiler.swc, types_1.Transpiler.none),
40
40
  devtool: (Joi) => Joi.alternatives().try(Joi.string().regex(DEVTOOL_REGEX), Joi.boolean()),
41
+ esm: (Joi) => Joi.object(),
41
42
  externals: (Joi) => Joi.alternatives().try(Joi.object(), Joi.string(), Joi.func()),
42
43
  extraBabelPlugins: (Joi) => Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object()))),
43
44
  extraBabelPresets: (Joi) => Joi.alternatives().try(Joi.string(), Joi.array().items(Joi.alternatives().try(Joi.string(), Joi.object()))),
@@ -69,12 +70,11 @@ function getSchemas() {
69
70
  sassLoader: (Joi) => Joi.object(),
70
71
  srcTranspiler: (Joi) => Joi.string().valid(types_1.Transpiler.babel, types_1.Transpiler.esbuild, types_1.Transpiler.swc, types_1.Transpiler.none),
71
72
  styleLoader: (Joi) => Joi.object(),
72
- svgr: (Joi) => Joi.object(),
73
73
  svgo: (Joi) => Joi.alternatives().try(Joi.object(), Joi.boolean()),
74
+ svgr: (Joi) => Joi.object(),
74
75
  targets: (Joi) => Joi.object(),
75
- writeToDisk: (Joi) => Joi.boolean(),
76
- esm: (Joi) => Joi.object(),
77
76
  theme: (Joi) => Joi.object(),
77
+ writeToDisk: (Joi) => Joi.boolean(),
78
78
  };
79
79
  }
80
80
  exports.getSchemas = getSchemas;
@@ -13,7 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.createServer = void 0;
16
- const express_1 = __importDefault(require("@umijs/bundler-webpack/compiled/express"));
16
+ const express_1 = __importDefault(require("@umijs/bundler-utils/compiled/express"));
17
17
  const http_proxy_middleware_1 = require("@umijs/bundler-webpack/compiled/http-proxy-middleware");
18
18
  const webpack_1 = __importDefault(require("@umijs/bundler-webpack/compiled/webpack"));
19
19
  const utils_1 = require("@umijs/utils");
@@ -137,7 +137,10 @@ function createServer(opts) {
137
137
  });
138
138
  }
139
139
  // after middlewares
140
- (opts.afterMiddlewares || []).forEach((m) => app.use(m));
140
+ (opts.afterMiddlewares || []).forEach((m) => {
141
+ // TODO: FIXME
142
+ app.use(m.toString().includes(`{ compiler }`) ? m({ compiler }) : m);
143
+ });
141
144
  // history fallback
142
145
  app.use(require('@umijs/bundler-webpack/compiled/connect-history-api-fallback')({
143
146
  index: '/',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.0-rc.4",
3
+ "version": "4.0.0-rc.7",
4
4
  "description": "@umijs/bundler-webpack",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-webpack#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -25,44 +25,42 @@
25
25
  "build:client": "pnpm tsc --project ./tsconfig.client.json",
26
26
  "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
27
27
  "dev": "pnpm build -- --watch",
28
- "generate:webpackPackages": "zx ./scripts/generateWebpackPackages.mjs"
28
+ "generate:webpackPackages": "zx ./scripts/generateWebpackPackages.mjs",
29
+ "test": "jest -c ../../jest.turbo.config.ts"
29
30
  },
30
31
  "dependencies": {
31
- "@parcel/css": "1.5.0",
32
+ "@parcel/css": "1.6.0",
32
33
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
33
34
  "@svgr/core": "6.2.1",
34
35
  "@svgr/plugin-jsx": "^6.2.1",
35
36
  "@svgr/plugin-svgo": "^6.2.0",
36
37
  "@types/hapi__joi": "17.1.8",
37
- "@umijs/babel-preset-umi": "4.0.0-rc.4",
38
- "@umijs/mfsu": "4.0.0-rc.4",
39
- "@umijs/utils": "4.0.0-rc.4",
40
- "css-loader": "6.6.0",
38
+ "@umijs/babel-preset-umi": "4.0.0-rc.7",
39
+ "@umijs/mfsu": "4.0.0-rc.7",
40
+ "@umijs/utils": "4.0.0-rc.7",
41
+ "css-loader": "6.7.1",
41
42
  "es5-imcompatible-versions": "^0.1.73",
42
43
  "jest-worker": "27.5.1",
43
44
  "node-libs-browser": "2.2.1",
44
- "postcss": "^8.4.7",
45
+ "postcss": "^8.4.12",
45
46
  "postcss-preset-env": "7.4.2",
46
47
  "react-error-overlay": "6.0.9"
47
48
  },
48
49
  "devDependencies": {
49
- "@swc/core": "1.2.147",
50
- "@types/express": "4.17.13",
50
+ "@swc/core": "1.2.156",
51
51
  "@types/webpack-sources": "3.2.0",
52
- "@types/ws": "8.5.2",
53
- "autoprefixer": "10.4.2",
52
+ "@types/ws": "8.5.3",
53
+ "autoprefixer": "10.4.4",
54
54
  "babel-loader": "8.2.3",
55
55
  "compression": "1.7.4",
56
56
  "connect-history-api-fallback": "1.6.0",
57
57
  "copy-webpack-plugin": "10.2.4",
58
58
  "css-minimizer-webpack-plugin": "3.4.1",
59
- "cssnano": "5.1.0",
60
- "express": "4.17.3",
59
+ "cssnano": "5.1.4",
61
60
  "fork-ts-checker-webpack-plugin": "7.2.1",
62
- "http-proxy-middleware": "2.0.3",
63
- "less": "4.1.2",
61
+ "http-proxy-middleware": "2.0.4",
64
62
  "less-loader": "10.2.0",
65
- "mini-css-extract-plugin": "2.5.3",
63
+ "mini-css-extract-plugin": "2.6.0",
66
64
  "postcss-flexbugs-fixes": "5.0.2",
67
65
  "postcss-loader": "6.2.1",
68
66
  "purgecss-webpack-plugin": "4.1.3",
@@ -73,14 +71,14 @@
73
71
  "style-loader": "3.3.1",
74
72
  "svgo-loader": "3.0.0",
75
73
  "tapable": "2.2.1",
76
- "terser": "5.12.0",
74
+ "terser": "5.12.1",
77
75
  "terser-webpack-plugin": "5.3.1",
78
76
  "url-loader": "4.1.1",
79
- "webpack": "5.69.1",
77
+ "webpack": "5.70.0",
80
78
  "webpack-5-chain": "8.0.0",
81
79
  "webpack-bundle-analyzer": "4.5.0",
82
80
  "webpack-dev-middleware": "5.3.1",
83
- "webpack-manifest-plugin": "4.1.1",
81
+ "webpack-manifest-plugin": "5.0.0",
84
82
  "webpack-sources": "3.2.3",
85
83
  "ws": "8.5.0"
86
84
  },
@@ -100,10 +98,8 @@
100
98
  "cssnano",
101
99
  "compression",
102
100
  "connect-history-api-fallback",
103
- "express",
104
101
  "fork-ts-checker-webpack-plugin",
105
102
  "http-proxy-middleware",
106
- "less",
107
103
  "less-loader",
108
104
  "mini-css-extract-plugin",
109
105
  "postcss-flexbugs-fixes",
@@ -132,9 +128,9 @@
132
128
  "@babel/core": "@umijs/bundler-utils/compiled/babel/core",
133
129
  "es-module-lexer": "@umijs/bundler-utils/compiled/es-module-lexer",
134
130
  "esbuild": "@umijs/bundler-utils/compiled/esbuild",
135
- "express": "$$LOCAL",
131
+ "express": "@umijs/bundler-utils/compiled/express",
136
132
  "jest-worker": "jest-worker",
137
- "less": "$$LOCAL",
133
+ "less": "@umijs/bundler-utils/compiled/less",
138
134
  "cssnano": "$$LOCAL",
139
135
  "postcss": "postcss",
140
136
  "tapable": "$$LOCAL",
@@ -173,7 +169,6 @@
173
169
  "compression",
174
170
  "connect-history-api-fallback",
175
171
  "fork-ts-checker-webpack-plugin",
176
- "less",
177
172
  "less-loader",
178
173
  "mini-css-extract-plugin",
179
174
  "postcss-flexbugs-fixes",
@@ -1,20 +0,0 @@
1
- Copyright JS Foundation and other contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- 'Software'), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,102 +0,0 @@
1
- "use strict";
2
-
3
- /*
4
- MIT License http://www.opensource.org/licenses/mit-license.php
5
- Author Tobias Koppers @sokra
6
- */
7
- module.exports = function (cssWithMappingToString) {
8
- var list = []; // return the list of modules as css string
9
-
10
- list.toString = function toString() {
11
- return this.map(function (item) {
12
- var content = "";
13
- var needLayer = typeof item[5] !== "undefined";
14
-
15
- if (item[4]) {
16
- content += "@supports (".concat(item[4], ") {");
17
- }
18
-
19
- if (item[2]) {
20
- content += "@media ".concat(item[2], " {");
21
- }
22
-
23
- if (needLayer) {
24
- content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
25
- }
26
-
27
- content += cssWithMappingToString(item);
28
-
29
- if (needLayer) {
30
- content += "}";
31
- }
32
-
33
- if (item[2]) {
34
- content += "}";
35
- }
36
-
37
- if (item[4]) {
38
- content += "}";
39
- }
40
-
41
- return content;
42
- }).join("");
43
- }; // import a list of modules into the list
44
-
45
-
46
- list.i = function i(modules, media, dedupe, supports, layer) {
47
- if (typeof modules === "string") {
48
- modules = [[null, modules, undefined]];
49
- }
50
-
51
- var alreadyImportedModules = {};
52
-
53
- if (dedupe) {
54
- for (var _i = 0; _i < this.length; _i++) {
55
- var id = this[_i][0];
56
-
57
- if (id != null) {
58
- alreadyImportedModules[id] = true;
59
- }
60
- }
61
- }
62
-
63
- for (var _i2 = 0; _i2 < modules.length; _i2++) {
64
- var item = [].concat(modules[_i2]);
65
-
66
- if (dedupe && alreadyImportedModules[item[0]]) {
67
- continue;
68
- }
69
-
70
- if (typeof layer !== "undefined") {
71
- if (typeof item[5] === "undefined") {
72
- item[5] = layer;
73
- } else {
74
- item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
75
- item[5] = layer;
76
- }
77
- }
78
-
79
- if (media) {
80
- if (!item[2]) {
81
- item[2] = media;
82
- } else {
83
- item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
84
- item[2] = media;
85
- }
86
- }
87
-
88
- if (supports) {
89
- if (!item[4]) {
90
- item[4] = "".concat(supports);
91
- } else {
92
- item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
93
- item[4] = supports;
94
- }
95
- }
96
-
97
- list.push(item);
98
- }
99
- };
100
-
101
- return list;
102
- };
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function (url, options) {
4
- if (!options) {
5
- options = {};
6
- }
7
-
8
- if (!url) {
9
- return url;
10
- }
11
-
12
- url = String(url.__esModule ? url.default : url); // If url is already wrapped in quotes, remove them
13
-
14
- if (/^['"].*['"]$/.test(url)) {
15
- url = url.slice(1, -1);
16
- }
17
-
18
- if (options.hash) {
19
- url += options.hash;
20
- } // Should url be wrapped?
21
- // See https://drafts.csswg.org/css-values-3/#urls
22
-
23
-
24
- if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) {
25
- return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\"");
26
- }
27
-
28
- return url;
29
- };