@umijs/bundler-webpack 4.0.0-rc.5 → 4.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/cssnano/index.js +5 -5
- package/compiled/mini-css-extract-plugin/index.js +440 -401
- package/compiled/mini-css-extract-plugin/loader.js +3 -1
- package/compiled/mini-css-extract-plugin/utils.js +2 -0
- package/compiled/webpack/index.js +3974 -3052
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/plugins/ESBuildCSSMinifyPlugin.js +1 -3
- package/dist/plugins/RuntimePublicPathPlugin.js +1 -1
- package/dist/schema.js +4 -4
- package/dist/server/server.js +4 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";var e={
|
|
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})();
|
package/dist/index.d.ts
CHANGED
|
@@ -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
|
});
|
|
@@ -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;
|
package/dist/server/server.js
CHANGED
|
@@ -137,7 +137,10 @@ function createServer(opts) {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
// after middlewares
|
|
140
|
-
(opts.afterMiddlewares || []).forEach((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.
|
|
3
|
+
"version": "4.0.0-rc.6",
|
|
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",
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"@svgr/plugin-jsx": "^6.2.1",
|
|
35
35
|
"@svgr/plugin-svgo": "^6.2.0",
|
|
36
36
|
"@types/hapi__joi": "17.1.8",
|
|
37
|
-
"@umijs/babel-preset-umi": "4.0.0-rc.
|
|
38
|
-
"@umijs/mfsu": "4.0.0-rc.
|
|
39
|
-
"@umijs/utils": "4.0.0-rc.
|
|
40
|
-
"css-loader": "6.
|
|
37
|
+
"@umijs/babel-preset-umi": "4.0.0-rc.6",
|
|
38
|
+
"@umijs/mfsu": "4.0.0-rc.6",
|
|
39
|
+
"@umijs/utils": "4.0.0-rc.6",
|
|
40
|
+
"css-loader": "6.7.1",
|
|
41
41
|
"es5-imcompatible-versions": "^0.1.73",
|
|
42
42
|
"jest-worker": "27.5.1",
|
|
43
43
|
"node-libs-browser": "2.2.1",
|
|
44
|
-
"postcss": "^8.4.
|
|
44
|
+
"postcss": "^8.4.8",
|
|
45
45
|
"postcss-preset-env": "7.4.2",
|
|
46
46
|
"react-error-overlay": "6.0.9"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@swc/core": "1.2.
|
|
49
|
+
"@swc/core": "1.2.151",
|
|
50
50
|
"@types/express": "4.17.13",
|
|
51
51
|
"@types/webpack-sources": "3.2.0",
|
|
52
52
|
"@types/ws": "8.5.2",
|
|
@@ -56,13 +56,13 @@
|
|
|
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.
|
|
59
|
+
"cssnano": "5.1.1",
|
|
60
60
|
"express": "4.17.3",
|
|
61
61
|
"fork-ts-checker-webpack-plugin": "7.2.1",
|
|
62
62
|
"http-proxy-middleware": "2.0.3",
|
|
63
63
|
"less": "4.1.2",
|
|
64
64
|
"less-loader": "10.2.0",
|
|
65
|
-
"mini-css-extract-plugin": "2.
|
|
65
|
+
"mini-css-extract-plugin": "2.6.0",
|
|
66
66
|
"postcss-flexbugs-fixes": "5.0.2",
|
|
67
67
|
"postcss-loader": "6.2.1",
|
|
68
68
|
"purgecss-webpack-plugin": "4.1.3",
|
|
@@ -76,11 +76,11 @@
|
|
|
76
76
|
"terser": "5.12.0",
|
|
77
77
|
"terser-webpack-plugin": "5.3.1",
|
|
78
78
|
"url-loader": "4.1.1",
|
|
79
|
-
"webpack": "5.
|
|
79
|
+
"webpack": "5.70.0",
|
|
80
80
|
"webpack-5-chain": "8.0.0",
|
|
81
81
|
"webpack-bundle-analyzer": "4.5.0",
|
|
82
82
|
"webpack-dev-middleware": "5.3.1",
|
|
83
|
-
"webpack-manifest-plugin": "
|
|
83
|
+
"webpack-manifest-plugin": "5.0.0",
|
|
84
84
|
"webpack-sources": "3.2.3",
|
|
85
85
|
"ws": "8.5.0"
|
|
86
86
|
},
|