@moneko/core 3.8.3-beta.4 → 3.8.3-beta.5

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/lib/common.js CHANGED
@@ -1 +1 @@
1
- import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import r from"webpackbar";import{CONFIG as l,PUBLICPATH as s}from"./config.js";import n from"./html-plugin-option.js";import{moduleFederation as a}from"./module-federation.js";import i from"./module.config.js";import p,{CUSTOMCONFIG as c}from"./paths.js";import m from"./plugin/add-entry-attribute.js";import u from"./plugin/override-resolve.js";import f from"./plugin/virtual-module.js";import{PACKAGENAME as h,PACKAGEVERSION as d,isDev as b,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as j,resolveProgramPath as w}from"./utils.js";import v from"./virtual-modules.js";let{AutomaticPrefetchPlugin:k,DefinePlugin:x,SourceMapDevToolPlugin:C,WatchIgnorePlugin:O}=o,$=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:w(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${b?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:h,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${h}`,pathinfo:b,clean:!0,publicPath:s,asyncChunks:!0,charset:!0};let P={main:j("@app/entry")};l.polyfill&&Object.assign(P,{"dom-polyfills":[`${p.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?P={main:l.entry}:Object.keys(l.entry)&&Object.assign(P,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let B=l.basename.split("/").filter(Boolean).length,D=`${Array(B).fill("..").join("/")+(B?"/":"")}404.html`,{pathSegmentsToKeep:M=B,path:R=D}=l.fixBrowserRouter||{},A=!1;l.cacheDirectory&&(A={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[c,process.env.NODE_ENV].filter(Boolean).join("-"),version:d});let H=Object.assign({original:l.alias["@"],override:c&&w(c)},l.overrideResolve);export const clientConfig={entry:P,stats:"errors-only",cache:A,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[new f(v),new k,...a,l.htmlPluginOption&&new t(n),l.fixBrowserRouter&&new t({filename:R,inject:!1,templateContent:()=>`<html lang="en"><head><title>${n.title}</title><script>const pathKeep = ${M||B};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new e($),y&&new m(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new x({"process.env":JSON.stringify(l.env)}),new O({paths:[/\.d\.ts$/]}),l.sourceMap&&new C(l.sourceMap),l.bar&&new r(l.bar),...l.plugins].filter(e=>!!e),experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:b&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new u(H),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
1
+ import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import{CONFIG as l,PUBLICPATH as r}from"./config.js";import s from"./html-plugin-option.js";import{moduleFederation as n}from"./module-federation.js";import i from"./module.config.js";import a,{CUSTOMCONFIG as p}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import m from"./plugin/override-resolve.js";import u from"./plugin/virtual-module.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as b,resolveProgramPath as j}from"./utils.js";import w from"./virtual-modules.js";let{AutomaticPrefetchPlugin:v,DefinePlugin:k,SourceMapDevToolPlugin:x,WatchIgnorePlugin:C}=o,O=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:j(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:r,asyncChunks:!0,charset:!0};let $={main:b("@app/entry")};l.polyfill&&Object.assign($,{"dom-polyfills":[`${a.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?$={main:l.entry}:Object.keys(l.entry)&&Object.assign($,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let P=l.basename.split("/").filter(Boolean).length,B=`${Array(P).fill("..").join("/")+(P?"/":"")}404.html`,{pathSegmentsToKeep:D=P,path:M=B}=l.fixBrowserRouter||{},R=!1;l.cacheDirectory&&(R={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[p,process.env.NODE_ENV].filter(Boolean).join("-"),version:h});let A=Object.assign({original:l.alias["@"],override:p&&j(p)},l.overrideResolve);export const clientConfig={entry:$,stats:"errors-only",cache:R,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[new u(w),new v,...n,l.htmlPluginOption&&new t(s),l.fixBrowserRouter&&new t({filename:M,inject:!1,templateContent:()=>`<html lang="en"><head><title>${s.title}</title><script>const pathKeep = ${D||P};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new e(O),y&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new k({"process.env":JSON.stringify(l.env)}),new C({paths:[/\.d\.ts$/]}),l.sourceMap&&new x(l.sourceMap),...l.plugins].filter(e=>!!e),experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new m(A),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:i,externals:l.externals,output:outputConfig};
package/lib/dev.js CHANGED
@@ -1,3 +1,3 @@
1
- import{readdirSync as e}from"fs";import t from"chalk";import o from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import{clientConfig as l}from"./common.js";import{CONFIG as i}from"./config.js";import{hasPkg as n}from"./has-pkg.js";import{getIPv4 as a,getPort as c}from"./net.js";import p from"./paths.js";import{hasEslintConfig as m,hasStylelintConfig as d,isLibrary as u,isReact as f}from"./process-env.js";import{cleanDir as h,isFunction as v,log as w,resolveProgramPath as g}from"./utils.js";let{HotModuleReplacementPlugin:j}=o,{yellow:k,green:y,grey:$,gray:x,bgBlue:b,bgGreenBright:S,blueBright:T,greenBright:C}=t,A=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],B=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],D=e(p.programPath),E=!1,H=!1;for(let e=0,t=D.length;e<t;e++)B.includes(D[e])&&(H=!0),A.includes(D[e])&&(E=!0);E||(E=m),H||(H=d);let M=H?(await import("stylelint-webpack-plugin")).default:null,O=E?(await import("eslint-webpack-plugin")).default:null,P=i.devServer.port||3e3,_=await c(P,65535,i.devServer.host),I=n("@moneko/mock")&&(await import("@moneko/mock")).default,J=f&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,N=!1===i.devtool||i.devtool?i.devtool:"eval-cheap-module-source-map";i.devServer.port=_;let W="/"===i.basename,F=i.devServer.https?"https:":"http:",G=W?"":i.basename,L=i.devServer.port!==_&&x(`Port ${k(P)} is in use, trying ${y(_)} instead.
2
- `);function R(e){return`${F}//${"local"===e?i.devServer.host:a()}:${_}${G}`}let Y=x("You application is running here:"),q=`${b(" Local ")} ${T(R("local"))}
3
- ${S(" Network ")} ${C(R("net"))}`,z=["js","md","mdx","jsx","ts","tsx","json","html","vue"],K=z.join(","),Q=["css","scss","sass","less","ts","tsx","js","jsx"],U=Q.join(","),V=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],X=[O&&new O({fix:!0,threads:!0,files:[`${i.alias["@"]}/**/*.{${K}}`,u&&`${i.alias["@pkg"]}/**/*.{${K}}`].filter(Boolean),extensions:z,exclude:V,cache:!1,lintDirtyModulesOnly:!0}),M&&new M({fix:!0,threads:!0,files:[`${i.alias["@"]}/**/*.{${U}}`,u&&`${i.alias["@pkg"]}/**/*.{${U}}`].filter(Boolean),extensions:Q,exclude:V,cache:!1,lintDirtyModulesOnly:!0}),new j,J&&new J].filter(Boolean),Z={headers:{"Access-Control-Allow-Origin":"*"},compress:i.devServer.compress,host:"0.0.0.0",port:_,historyApiFallback:W||{index:G.endsWith("/")?G:`${G}/`,disableDotRule:!0},https:i.devServer.https,proxy:i.proxy,allowedHosts:i.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,t)=>{if(!t)throw Error("devServer is not defined");return t.app&&v(I)&&I(t.app,g("mock/")),e},open:!1,hot:!0},ee=o(r(l,{devtool:N,mode:"development",plugins:X}));ee.watch({aggregateTimeout:600,ignored:/node_modules/,stdin:!0},(e,t)=>{!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),w([Y,"",q,"",$(`Compiled successfully in ${y(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>w(e.message)),t.compilation.errors.forEach(e=>w(e.message)),L&&w(L))});let et=new s(Z,ee);et.startCallback(e=>{e||w([Y,"",q])}),et.stopCallback(e=>{e||h(p.cachePath)}),process.on("exit",function(){ee.close(()=>{}),et.invalidate(),et.stop()}),process.on("SIGINT",()=>{process.exit()});
1
+ import{readdirSync as e}from"fs";import t from"chalk";import o from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import l from"webpackbar";import{clientConfig as i}from"./common.js";import{CONFIG as n}from"./config.js";import{hasPkg as a}from"./has-pkg.js";import{getIPv4 as c,getPort as p}from"./net.js";import m from"./paths.js";import{hasEslintConfig as d,hasStylelintConfig as f,isLibrary as u,isReact as h}from"./process-env.js";import{cleanDir as v,isFunction as w,log as g,resolveProgramPath as b}from"./utils.js";let{HotModuleReplacementPlugin:k}=o,{yellow:j,green:y,grey:$,gray:x,bgBlue:S,bgGreenBright:T,blueBright:C,greenBright:A}=t,B=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],D=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],E=e(m.programPath),H=!1,M=!1;for(let e=0,t=E.length;e<t;e++)D.includes(E[e])&&(M=!0),B.includes(E[e])&&(H=!0);H||(H=d),M||(M=f);let O=M?(await import("stylelint-webpack-plugin")).default:null,P=H?(await import("eslint-webpack-plugin")).default:null,_=n.devServer.port||3e3,I=await p(_,65535,n.devServer.host),J=a("@moneko/mock")&&(await import("@moneko/mock")).default,N=h&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,W=!1===n.devtool||n.devtool?n.devtool:"eval-cheap-module-source-map";n.devServer.port=I;let F="/"===n.basename,G=n.devServer.https?"https:":"http:",L=F?"":n.basename,R=n.devServer.port!==I&&x(`Port ${j(_)} is in use, trying ${y(I)} instead.
2
+ `);function Y(e){return`${G}//${"local"===e?n.devServer.host:c()}:${I}${L}`}let q=x("You application is running here:"),z=`${S(" Local ")} ${C(Y("local"))}
3
+ ${T(" Network ")} ${A(Y("net"))}`,K=["js","md","mdx","jsx","ts","tsx","json","html","vue"],Q=K.join(","),U=["css","scss","sass","less","ts","tsx","js","jsx"],V=U.join(","),X=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Z=[new k,N&&new N,P&&new P({fix:!0,threads:!0,files:[`${n.alias["@"]}/**/*.{${Q}}`,u&&`${n.alias["@pkg"]}/**/*.{${Q}}`].filter(Boolean),extensions:K,exclude:X,cache:!0,lintDirtyModulesOnly:!0}),O&&new O({fix:!0,threads:!0,files:[`${n.alias["@"]}/**/*.{${V}}`,u&&`${n.alias["@pkg"]}/**/*.{${V}}`].filter(Boolean),extensions:U,exclude:X,cache:!0,lintDirtyModulesOnly:!0}),n.bar&&new l(n.bar)].filter(Boolean),ee={headers:{"Access-Control-Allow-Origin":"*"},compress:n.devServer.compress,host:"0.0.0.0",port:I,historyApiFallback:F||{index:L.endsWith("/")?L:`${L}/`,disableDotRule:!0},https:n.devServer.https,proxy:n.proxy,allowedHosts:n.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,t)=>{if(!t)throw Error("devServer is not defined");return t.app&&w(J)&&J(t.app,b("mock/")),e},open:!1,hot:!0},et=o(r(i,{devtool:W,mode:"development",plugins:Z}));et.watch({aggregateTimeout:600,ignored:/node_modules/,stdin:!0},(e,t)=>{!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),g([q,"",z,"",$(`Compiled successfully in ${y(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>g(e.message)),t.compilation.errors.forEach(e=>g(e.message)),R&&g(R))});let eo=new s(ee,et);eo.startCallback(e=>{e||g([q,"",z])}),eo.stopCallback(e=>{e||v(m.cachePath)}),process.on("exit",function(){et.close(()=>{}),eo.invalidate(),eo.stop()}),process.on("SIGINT",()=>{process.exit()});
package/lib/prod.js CHANGED
@@ -1 +1 @@
1
- let e;import i from"css-minimizer-webpack-plugin";import o from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as t}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{clientConfig as s}from"./common.js";import{CONFIG as p}from"./config.js";import{getMinifyOption as l}from"./minify.js";import a from"./paths.js";import c from"./plugin/done.js";import{vmWriteing as u}from"./reactive-object.js";import f from"./seo.js";import{cleanDir as d}from"./utils.js";let{optimize:{MinChunkSizePlugin:h}}=m,{cssnanoMinify:w,swcMinify:k}=i,j="swc"===p.compiler,b=[];p.minifier&&(p.minifier.js&&b.push(new n(l(p.minifier.js?.type||(j?"swc":"terser"),p.minifier.js?.options))),p.minifier.css&&b.push(new i({minify:{swc:k,cssnano:w}[p.minifier.css?.type||(j?"swc":"cssnano")],minimizerOptions:p.minifier.css?.options})));let y={splitChunks:p.splitChunk,runtimeChunk:p.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:b},g=m(r(s,{devtool:!1===p.devtool||p.devtool?p.devtool:"cheap-module-source-map",mode:"production",optimization:y,plugins:[new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),p.bundleAnalyzer&&new t(p.bundleAnalyzer),p.splitChunk&&new h({minChunkSize:1e4}),new c({done:e=>{u.setData("done",!0),p.done?.(e),p.seo&&f(),u.setData("done",!1)}})].filter(Boolean)}));g.watch({},()=>{}),u.on("change",()=>{clearTimeout(e),e=setTimeout(()=>{clearTimeout(e);let i=u.data;if(!i.done&&!i.DoneDonePlugin){for(let e in i)if(Object.prototype.hasOwnProperty.call(i,e)&&i[e])return;g.close(()=>{})}},300)}),process.on("exit",function(){g.close(()=>{}),d(a.cachePath)});
1
+ let e;import i from"css-minimizer-webpack-plugin";import o from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as r}from"webpack-bundle-analyzer";import{merge as t}from"webpack-merge";import s from"webpackbar";import{clientConfig as p}from"./common.js";import{CONFIG as a}from"./config.js";import{getMinifyOption as l}from"./minify.js";import c from"./paths.js";import u from"./plugin/done.js";import{vmWriteing as f}from"./reactive-object.js";import d from"./seo.js";import{cleanDir as h}from"./utils.js";let{optimize:{MinChunkSizePlugin:w}}=m,{cssnanoMinify:k,swcMinify:b}=i,j="swc"===a.compiler,y=[];a.minifier&&(a.minifier.js&&y.push(new n(l(a.minifier.js?.type||(j?"swc":"terser"),a.minifier.js?.options))),a.minifier.css&&y.push(new i({minify:{swc:b,cssnano:k}[a.minifier.css?.type||(j?"swc":"cssnano")],minimizerOptions:a.minifier.css?.options})));let g={splitChunks:a.splitChunk,runtimeChunk:a.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:y},z=m(t(p,{devtool:!1===a.devtool||a.devtool?a.devtool:"cheap-module-source-map",mode:"production",optimization:g,plugins:[new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),a.bundleAnalyzer&&new r(a.bundleAnalyzer),a.splitChunk&&new w({minChunkSize:1e4}),a.bar&&new s(a.bar),new u({done:e=>{f.setData("done",!0),a.done?.(e),a.seo&&d(),f.setData("done",!1)}})].filter(Boolean)}));z.watch({},()=>{}),f.on("change",()=>{clearTimeout(e),e=setTimeout(()=>{clearTimeout(e);let i=f.data;if(!i.done&&!i.DoneDonePlugin){for(let e in i)if(Object.prototype.hasOwnProperty.call(i,e)&&i[e])return;z.close(()=>{})}},300)}),process.on("exit",function(){z.close(()=>{}),h(c.cachePath)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.8.3-beta.4",
3
+ "version": "3.8.3-beta.5",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",