@moneko/core 3.39.3 → 3.39.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/build/common.mjs +1 -1
- package/lib/commom/parse-module-meta.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev.mjs +1 -1
- package/package.json +2 -1
package/lib/build/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import i from"webpack";import{merge as n}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as
|
|
1
|
+
import e from"mini-css-extract-plugin";import i from"webpack";import{merge as n}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as r}from"../config.mjs";import{LightningCssMinifyPlugin as m}from"../plugin/lightningcss-plugin.mjs";import s from"../plugin/swc-minify-plugin.mjs";import{getLightningCssTargets as l}from"../polyfills/targets.mjs";let o=[];r.minifier&&(o.push(new s(r.minifier)),o.push(new m({targets:l()})));let p={maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js"),...r.performance},a=n(t,{performance:r.performance&&p,plugins:[new e({filename:"style/[contenthash].css",chunkFilename:"style/[contenthash].css",ignoreOrder:!0})],optimization:{splitChunks:r.splitChunk,runtimeChunk:r.runtimeChunk,chunkIds:"deterministic",moduleIds:"deterministic",concatenateModules:!0,emitOnErrors:!1,removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:o,sideEffects:!0,providedExports:!0}});if(r.splitChunk&&a.plugins?.push(new i.optimize.MinChunkSizePlugin({minChunkSize:51200})),r.bundleAnalyzer){let e=(await import("webpack-bundle-analyzer")).BundleAnalyzerPlugin;a.plugins?.push(new e({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...r.bundleAnalyzer}))}export default a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import n from"./paths.mjs";export default function(a,
|
|
1
|
+
import{resolve as e}from"node:path";import n from"./paths.mjs";export default function(a,t=1){let i=a.replace(/^\/|\/$/g,"").replace(/\\/g,"/"),o=i,d="index.ts",m=i.match(/(.+)\/index\.([^/]+)$/),r=i.match(/(.+)\.([^/]+)$/);return m?(o=m[1],d=`index.${m[2]}`):r&&(o=r[1],d=`index.${r[2]}`),{name:o,main:d,pkg:e(n.nodeModules,o,"package.json"),file:e(n.nodeModules,o,d),meta:`{"name":"${o}","main":"${d}","version":"0.0.${t}","description": "","sideEffects": false}`}}
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as e}from"node:path";import{fileExists as o}from"@moneko/utils";import{merge as t}from"webpack-merge";import r from"./commom/paths.mjs";import s from"./commom/require.mjs";import n from"./commom/setup-env.mjs";import i from"./options/jsx-dom-expressions.mjs";import a from"./options/split-chunk.mjs";import{isFunction as
|
|
1
|
+
import{relative as e}from"node:path";import{fileExists as o}from"@moneko/utils";import{merge as t}from"webpack-merge";import r from"./commom/paths.mjs";import s from"./commom/require.mjs";import n from"./commom/setup-env.mjs";import i from"./options/jsx-dom-expressions.mjs";import a from"./options/split-chunk.mjs";import{isFunction as l,node_modules as m,resolveProgram as p}from"./utils/index.mjs";import{APPTYPE as c,FRAMEWORK as u,frameworkVersion as d,isCI as f,isDev as h,isLibrary as g,isMobile as v,isReact as x,jsxImportSource as j,mainDirectory as C,NODE_ENV as P,PACKAGENAME as b}from"./process-env.mjs";let k=["@app","@moneko","neko-ui",".cache/http/data","@element-plus","ant-design-vue","element-plus","element-ui","ng-zorro-antd","@mui","@du","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design","monaco-editor"];export function getConfig(e){return delete s.cache[e],new Promise(t=>{if(o(e)){let o=s(e).default;return t(l(o)?o(process):o)}return t({})})}let w=await Promise.all([n(P,c,u,[]),getConfig(r.configPath),getConfig(r.customConfigPath)]),O=w[0],y=w[1],M=w[2],S={strict:!1,devtool:h?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:O,basename:"/",publicPath:"/",rem:{designSize:v?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":p(C)},x&&d<18?{"react/package.json":m("react/package.json"),"react/jsx-runtime":m("react/jsx-runtime.js"),"react/jsx-dev-runtime":m("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0,https:!1},htmlPluginOption:{title:b.toLocaleUpperCase(),favicon:e(r.programPath,`${r.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:a,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:k,js:k,media:k,font:k,wasm:[]},mdx:{jsx:!1,development:h,jsxImportSource:j,providerImportSource:`@moneko/${u}/mdx`},jsxDomExpressions:i,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:f},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==u,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1}};g&&(S.alias=Object.assign(S.alias,{"@pkg":r.componentsPath,[b]:r.componentsPath}));let I=S;(!1===(I=t(I,y,M)).devtool||!1===I.sourceMap)&&(I.sourceMap=!1,I.devtool=!1),I.fixBrowserRouter&&I.htmlPluginOption&&(I.htmlPluginOption.tags||(I.htmlPluginOption.tags=[]),I.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"})),"true"===process.env.CODESPACES&&(I.devServer.https=!1);export const CONFIG=I;export const PUBLICPATH=CONFIG.publicPath;
|
package/lib/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import{extname as r,relative as s,sep as n}from"node:path";import{ink as i,loadFile as l,print as a,println as c,progressBar as m}from"@moneko/utils";import p from"fastify";import d from"webpack";import h from"webpack-hot-middleware";import{merge as f}from"webpack-merge";import{setupCert as u}from"./commom/ca.mjs";import{diffObject as g}from"./commom/diff-object.mjs";import y from"./commom/mime.mjs";import v from"./commom/open.mjs";import w,{config_files as x}from"./commom/paths.mjs";import b from"./commom/sigint-exit.mjs";import{devLog as $,getServerAddress as j,PORT as k}from"./dev/config.mjs";import C from"./dev/mock.mjs";import{setupProxy as S}from"./dev/proxy.mjs";import P from"./options/reslove.mjs";import _ from"./plugin/eslint.mjs";import A from"./plugin/stylelint.mjs";import{empty as z}from"./utils/index.mjs";import{commonConfig as T}from"./common.mjs";import{CONFIG as E,getConfig as I,PUBLICPATH as O}from"./config.mjs";import{outputFileSystem as H}from"./file-system.mjs";import B from"./module.config.mjs";import{isLibrary as M,isReact as R,refresh as q}from"./process-env.mjs";let U=`${O.endsWith("/")?"":"/"}__hmr__`,F=new URLSearchParams({name:"client",path:U,dynamicPublicPath:!0,timeout:2e3,reload:!q,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),L=f(T,{watchOptions:{ignored:/node_modules\/(?!(@app|@moneko)).+/},entry:{main:[`${P.hotMiddlewareClient}?${F}`]},module:B(!1),plugins:[new d.HotModuleReplacementPlugin,new d.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app|@moneko)).+/,/\.d\.ts$/]})]});if(L.plugins||(L.plugins=[]),R){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;L.plugins.push(new e({overlay:!1}))}function N(e){let t=e.join(","),o=[s(w.programPath,`${E.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return M&&o.push(s(w.programPath,`${E.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}E.eslint&&L.plugins.push(new _({fix:!0,cache:!0,cacheLocation:`${w.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:N(["js","jsx","ts","tsx","json","html","vue"]),...E.eslint})),E.stylelint&&L.plugins.push(new A({fix:!0,cache:!0,cacheLocation:`${w.lintCachePath}/.stylelintcache`,files:N(["css","scss","sass","less","ts","tsx","js","jsx"]),...E.stylelint}));let D=!1,G="/____progress____",W={percentage:0,info:""};if(E.bar){let e=E.bar,t=e.name||"Build";L.plugins.push(new d.ProgressPlugin({handler(o,r,...s){let n=s.length?`[${r}] ${s.join(" ")}`:" ";D||(W.info=n,W.percentage=o,D=1===o),e.quiet?process.stdout.write(`${n}
|
|
1
|
+
import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import{extname as r,relative as s,sep as n}from"node:path";import{ink as i,loadFile as l,print as a,println as c,progressBar as m}from"@moneko/utils";import p from"fastify";import d from"webpack";import h from"webpack-hot-middleware";import{merge as f}from"webpack-merge";import{setupCert as u}from"./commom/ca.mjs";import{diffObject as g}from"./commom/diff-object.mjs";import y from"./commom/mime.mjs";import v from"./commom/open.mjs";import w,{config_files as x}from"./commom/paths.mjs";import b from"./commom/sigint-exit.mjs";import{devLog as $,getServerAddress as j,PORT as k}from"./dev/config.mjs";import C from"./dev/mock.mjs";import{setupProxy as S}from"./dev/proxy.mjs";import P from"./options/reslove.mjs";import _ from"./plugin/eslint.mjs";import A from"./plugin/stylelint.mjs";import{empty as z}from"./utils/index.mjs";import{commonConfig as T}from"./common.mjs";import{CONFIG as E,getConfig as I,PUBLICPATH as O}from"./config.mjs";import{outputFileSystem as H}from"./file-system.mjs";import B from"./module.config.mjs";import{isLibrary as M,isReact as R,refresh as q}from"./process-env.mjs";let U=`${O.endsWith("/")?"":"/"}__hmr__`,F=new URLSearchParams({name:"client",path:U,dynamicPublicPath:!0,timeout:2e3,reload:!q,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),L=f(T,{watchOptions:{stdin:!0,ignored:/node_modules\/(?!(@app|@moneko)).+/},entry:{main:[`${P.hotMiddlewareClient}?${F}`]},module:B(!1),plugins:[new d.HotModuleReplacementPlugin,new d.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app|@moneko)).+/,/\.d\.ts$/]})]});if(L.plugins||(L.plugins=[]),R){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;L.plugins.push(new e({overlay:!1}))}function N(e){let t=e.join(","),o=[s(w.programPath,`${E.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return M&&o.push(s(w.programPath,`${E.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}E.eslint&&L.plugins.push(new _({fix:!0,cache:!0,cacheLocation:`${w.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:N(["js","jsx","ts","tsx","json","html","vue"]),...E.eslint})),E.stylelint&&L.plugins.push(new A({fix:!0,cache:!0,cacheLocation:`${w.lintCachePath}/.stylelintcache`,files:N(["css","scss","sass","less","ts","tsx","js","jsx"]),...E.stylelint}));let D=!1,G="/____progress____",W={percentage:0,info:""};if(E.bar){let e=E.bar,t=e.name||"Build";L.plugins.push(new d.ProgressPlugin({handler(o,r,...s){let n=s.length?`[${r}] ${s.join(" ")}`:" ";D||(W.info=n,W.percentage=o,D=1===o),e.quiet?process.stdout.write(`${n}
|
|
2
2
|
`):(m(o||0,1,{msg:n,name:t,barColor:e.barColor,nameColor:e.nameColor,barBgColor:e.barBgColor,msgColor:e.msgColor}),1===o&&process.stdout.write("\r\x1b[2K"))}}))}let K=d(L);K.outputFileSystem=H;let X=K.watch(K.options.watchOptions,$);K.hooks.done.tap("client-log",e=>{$(null,e)});let Y={};async function J(){if("object"==typeof E.devServer.https&&"key"in E.devServer.https){let e=await Promise.all([l(E.devServer.https.key),l(E.devServer.https.cert)]);return e[0]||(c(i(`法加载私钥。请检查路径和文件是否存在,并确保路径正确:${E.devServer.https.key}`,"red")),process.exit(1)),e[1]||(c(i(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${E.devServer.https.cert}`,"red")),process.exit(1)),{key:e[0],cert:e[1]}}return u(E.devServer.host,!0===E.devServer.https||"object"==typeof E.devServer.https&&E.devServer.https.install)}E.devServer.https&&(Y.http2=!0,Y.https=await J());let Q=h(K,{log:!1,path:U,heartbeat:2e3}),V=p({logger:!1,...Y});C(V,{directory:w.mockPath}),S(V,E.proxy);let Z={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization","Access-Control-Allow-Methods":"GET, POST, OPTIONS, DELETE, PATCH, PUT","Access-Control-Allow-Origin":"*","Cache-Control":"no-store, no-cache, must-revalidate, proxy-revalidate",Pragma:"no-cache",Expires:"0",...E.devServer.headers||{}};function ee(e,t,o){t.headers(Z),e.headers.origin&&t.header("Access-Control-Allow-Origin",e.headers.origin);let s=K.outputFileSystem,n=e.headers["accept-encoding"],i=n?.includes("br"),l=`${o}.${i?"br":"gz"}`,a=s.existsSync?.(l);a&&t.header("content-encoding",i?"br":"gzip");let c=s.createReadStream?.(a?l:o,{autoClose:!0});c?.on("error",e=>{if(c.destroy(),!t.sent)return t.code(404).type("text/html").send(`File not found: ${e.message}`)});let m=y[r(o)];return m&&t.header("content-type",m),t.send(c)}function et(){process.exit(0)}V.get(G,(e,t)=>{t.headers(Z),t.send(W)}),V.get(`/${U}`.replace("//","/"),async(e,t)=>{if("text/event-stream"===e.headers.accept){e.raw.url=U,Q(e.raw,t.raw,()=>{t.raw.writableEnded&&(t.sent=!0)});return}}),V.addHook("onRequest",(e,t,o)=>{if(e.url===G)return o();if(!D)return t.type("text/html").send(function(e){let t=Math.floor(100*e.percentage);return`<!DOCTYPE html><html><head><title>Building...</title><link rel="image/x-icon" href="/favicon.ico"><style>html{ display:flex; justify-content:center; align-items:center; block-size:100vb;}.progress-container{ position:relative; overflow:hidden; margin:1rem auto; border:0.0625rem solid #ccc; border-radius:0.625rem; inline-size:18.75rem; block-size:1.25rem;}.progress-bar{ block-size:100%; background:#4caf50; inline-size:0%; transition:inline-size 0.5s ease;}#progress-text{ position:absolute; margin:auto; font-size:0.875rem; font-family:sans-serif; font-weight:600; text-align:center; color:#fff; text-shadow:0 0 0.0625rem black; inset-inline:0; inset-block:0; line-height:1.25rem;}#progress-info{ font-size:small; font-family:sans-serif; font-weight:100; text-align:center; opacity:0.5; margin-block-start:0.625rem;}</style></head><body><div class="progress-container"><div class="progress-bar"></div><div id="progress-text">${t}%</div></div><div id="progress-info">${e.info}</div><script>function checkProgress() {fetch('${G}').then(r => r.json()) .then(data => {const percentage = Math.floor(data.percentage * 100);document.querySelector('.progress-bar').style.width = percentage + '%';document.getElementById('progress-text').textContent = percentage + '%';document.getElementById('progress-info').textContent = data.info;if (percentage === 100) {window.location.reload();} else {setTimeout(checkProgress, 500);}});}checkProgress();</script></body></html>`}(W)),o();let r=decodeURIComponent(`${K.options.output.path}${n}${"/"===e.url?"index.html":e.url}`);return K.outputFileSystem?.existsSync?.(r)?ee(e,t,r):o()}),V.setNotFoundHandler((e,t)=>ee(e,t,`${K.options.output.path}${n}index.html`)),V.addHook("onClose",()=>{X.close(z),V.server.close(z)}),V.listen({port:k}),E.devServer.open&&v(j("local"));let eo=await Promise.all(x.map(I)),er=f(eo[0]||{},eo[1]||{});x.forEach(function(t){o(t,async function(){let[o,r]=await Promise.all(x.map(I)),s=f(o||{},r||{}),n=g(er,s);1===Object.keys(n).length&&"proxy"in n?(a(i(`代理更新中...`,"yellow"),!0),await S(V,s.proxy),a(i(`代理更新完成...`,"green"),!0),E.proxy=s.proxy,er.proxy=s.proxy,er=s):(er=s,c(i(`检测到工程配置${i(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),e(es?`netstat -ano | findstr :${k}`:`lsof -i :${k} -t`,(e,t)=>{if(e){c(i(`查找端口 ${k} 时发生错误: ${e.message}`,"red")),c(i("请尝试手动重启程序","yellow"));return}let o=t.trim().replace(/\r\n/g,"\n").split("\n").filter(Boolean),r=es?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!r){c(i(`未找到占用端口 ${k} 的进程, 请尝试手动重启程序`,"yellow"));return}try{process.kill(Number(r),"SIGHUP")}catch(e){c(i(`终止进程 ${r} 时发生错误: ${e.message}`,"red"))}}))})});let es="win32"===process.platform;process.on("SIGHUP",function(){V.close(z),function(){let e=t(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",et)}()}),process.on("exit",function(){V.close(z)}),b(et);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.39.
|
|
3
|
+
"version": "3.39.4",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"email": "poi.nyaa@qq.com"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
|
+
"sideEffects": false,
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"@fastify/http-proxy": "9.5.0",
|
|
23
24
|
"@moneko/convert": "1.0.1",
|