@moneko/core 3.27.0-beta.0 → 3.27.0-beta.1

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/config.mjs CHANGED
@@ -1 +1 @@
1
- import{fileExists as e}from"@moneko/utils";import{merge as o}from"webpack-merge";import t from"./commom/paths.mjs";import n from"./commom/require.mjs";import i from"./commom/setup-env.mjs";import s from"./options/jsx-dom-expressions.mjs";import r from"./options/split-chunk.mjs";import{isFunction as l,resolveProgram as a}from"./utils/index.mjs";import{APPTYPE as m,coreName as p,FRAMEWORK as c,isDev as u,isLibrary as d,isMobile as f,jsxImportSource as h,mainDirectory as g,NODE_ENV as v,PACKAGENAME as x}from"./process-env.mjs";let P=["@app","@moneko","neko-ui",".cache/http/data","@ant-design","@antv","@antv/x6","@antv/x6-react-components","@element-plus","ant-design-vue","antd","antd-mini","antd-mobile","antd-mobile-icons","element-plus","element-ui","ng-zorro-antd","@antv","@mui","@du","ahooks","rc-queue-anim","umi","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design"];export function getConfig(o){return delete n.cache[o],new Promise(t=>{if(e(o)){let e=n(o).default;return t(l(e)?e(process):e)}return t({})})}let b=await Promise.all([i(v,m,c,[]),getConfig(t.configPath),getConfig(t.customConfigPath)]),C=b[0],w=b[1],j=b[2],k={devtool:u?"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:C,basename:"/",publicPath:"/",rem:{designSize:f?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":a(g)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3},htmlPluginOption:{title:x.toLocaleUpperCase(),favicon:`node_modules/${p}/lib/options/favicon.ico`},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:r,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:P,js:P,media:P,font:P,wasm:[]},mdx:{jsx:!1,development:u,jsxImportSource:h,providerImportSource:`@moneko/${c}/mdx`},jsxDomExpressions:s,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==c,bundleId:"com.moneko.bid",bundles:[],stylelint:!0,eslint:!0};d&&(k.alias=Object.assign(k.alias,{"@pkg":t.componentsPath,[x]:t.componentsPath}));let y=k;(!1===(y=o(y,w,j)).devtool||!1===y.sourceMap)&&(y.sourceMap=!1,y.devtool=!1),y.fixBrowserRouter&&y.htmlPluginOption&&(y.htmlPluginOption.tags||(y.htmlPluginOption.tags=[]),y.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))"}));export const CONFIG=y;export const PUBLICPATH=CONFIG.publicPath;
1
+ import{fileExists as e}from"@moneko/utils";import{merge as o}from"webpack-merge";import t from"./commom/paths.mjs";import n from"./commom/require.mjs";import i from"./commom/setup-env.mjs";import s from"./options/jsx-dom-expressions.mjs";import r from"./options/split-chunk.mjs";import{isFunction as l,resolveProgram as a}from"./utils/index.mjs";import{APPTYPE as m,coreName as p,FRAMEWORK as c,isDev as u,isLibrary as d,isMobile as f,jsxImportSource as h,mainDirectory as g,NODE_ENV as v,PACKAGENAME as x}from"./process-env.mjs";let C=["@app","@moneko","neko-ui",".cache/http/data","@ant-design","@antv","@antv/x6","@antv/x6-react-components","@element-plus","ant-design-vue","antd","antd-mini","antd-mobile","antd-mobile-icons","element-plus","element-ui","ng-zorro-antd","@antv","@mui","@du","ahooks","rc-queue-anim","umi","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design"];export function getConfig(o){return delete n.cache[o],new Promise(t=>{if(e(o)){let e=n(o).default;return t(l(e)?e(process):e)}return t({})})}let b=await Promise.all([i(v,m,c,[]),getConfig(t.configPath),getConfig(t.customConfigPath)]),P=b[0],w=b[1],j=b[2],k={devtool:u?"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:P,basename:"/",publicPath:"/",rem:{designSize:f?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":a(g)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3},htmlPluginOption:{title:x.toLocaleUpperCase(),favicon:`node_modules/${p}/lib/options/favicon.ico`},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:r,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:u,jsxImportSource:h,providerImportSource:`@moneko/${c}/mdx`},jsxDomExpressions:s,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==c,bundleId:"com.moneko.bid",bundles:[],stylelint:!0,eslint:!0};d&&(k.alias=Object.assign(k.alias,{"@pkg":t.componentsPath,[x]:t.componentsPath}));let y=k;(!1===(y=o(y,w,j)).devtool||!1===y.sourceMap)&&(y.sourceMap=!1,y.devtool=!1),y.fixBrowserRouter&&y.htmlPluginOption&&(y.htmlPluginOption.tags||(y.htmlPluginOption.tags=[]),y.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))"}));export const CONFIG=y;export const PUBLICPATH=CONFIG.publicPath;
package/lib/dev.mjs CHANGED
@@ -1 +1 @@
1
- import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import r from"@fastify/compress";import{fastifyMiddie as s}from"@fastify/middie";import{ink as i,loadFile as l,print as n,println as a,progressBar as m}from"@moneko/utils";import p from"fastify";import c from"webpack";import d from"webpack-dev-middleware";import u from"webpack-hot-middleware";import{merge as h}from"webpack-merge";import{diffObject as f}from"./commom/diff-object.mjs";import g from"./commom/has-pkg.mjs";import w,{config_files as y}from"./commom/paths.mjs";import x from"./commom/rule.mjs";import v from"./commom/sigint-exit.mjs";import{devLog as C,PORT as k}from"./dev/config.mjs";import $ from"./dev/mock.mjs";import{setupProxy as b}from"./dev/proxy.mjs";import j from"./options/reslove.mjs";import P from"./plugin/stylelint.mjs";import{empty as S,resolveProgram as A}from"./utils/index.mjs";import{commonConfig as E}from"./common.mjs";import{CONFIG as T,getConfig as I,PUBLICPATH as M}from"./config.mjs";import _ from"./module.config.mjs";import{isLibrary as R,isReact as B,refresh as H}from"./process-env.mjs";let O=T.eslint&&g("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,q=["js","jsx","ts","tsx","json","html","vue"],z=q.join(","),U=`${M.endsWith("/")?"":"/"}__hmr__`,D=new URLSearchParams({name:"client",path:U,dynamicPublicPath:!0,timeout:2e3,reload:!H,quiet:!0,noInfo:!0,overlay:!0,autoConnect:!0}).toString(),G=E.output.path,L=T.bar,W=L.name||"Build",F=h(E,{entry:{main:[`${j.hotMiddlewareClient}?${D}`]},output:{path:G},module:_(!1),optimization:{minimize:!1,concatenateModules:!1,removeAvailableModules:!1,removeEmptyChunks:!0,providedExports:!0,usedExports:!1,sideEffects:!1,splitChunks:{chunks:"all",minChunks:1,minSize:30720,maxSize:0,maxAsyncRequests:60,maxInitialRequests:50,hidePathInfo:!1,cacheGroups:{vendors:{test:x.node_modules,priority:-10,reuseExistingChunk:!0},default:{minChunks:1,priority:-20,reuseExistingChunk:!0}}}},plugins:[new c.HotModuleReplacementPlugin,new c.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app|@moneko)).+/,/\.d\.ts$/]})]});if(F.plugins||(F.plugins=[]),B){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;F.plugins.push(new e)}if(O&&F.plugins.push(new O({fix:!0,threads:!0,files:[`${T.alias["@"]}/**/*.{${z}}`,R&&`${T.alias["@pkg"]}/**/*.{${z}}`].filter(Boolean),extensions:q,exclude:["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],cache:!0,cacheLocation:`${w.lintCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,overrideConfigFile:A("eslint.config.mjs"),configType:"flat"})),T.stylelint){let e="css,scss,sass,less,ts,tsx,js,jsx";F.plugins.push(new P({fix:!0,files:[`${T.alias["@"]}/**/*.{${e}}`,R&&`${T.alias["@pkg"]}/**/*.{${e}}`].filter(Boolean),cache:!0,cacheLocation:`${w.lintCachePath}/.stylelintcache`}))}T.bar&&F.plugins.push(new c.ProgressPlugin({handler(e,t,...o){m(e||0,1,{msg:o.length?`[${t}] ${o.join(" ")}`:"",name:W,barColor:L.color,nameColor:L.nameColor,barBgColor:L.barBgColor,msgColor:L.msgColor}),1===e&&process.stdout.write("\r\x1b[2K")}}));let N=c(F);N.hooks.done.tap("client-log",e=>{C(null,e)});let K={};if(T.devServer.https){let[e,t]=await Promise.all([l(T.devServer.https.key),l(T.devServer.https.cert)]);e||(a(i(`法加载私钥。请检查路径和文件是否存在,并确保路径正确:${T.devServer.https.key}`,"red")),process.exit(1)),t||(a(i(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${T.devServer.https.cert}`,"red")),process.exit(1)),K.http2=!0,K.https={key:e,cert:t}}let X=d(N,{writeToDisk:!1,index:"index.html",headers:e=>({"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",...T.devServer.headers,"Access-Control-Allow-Origin":e.headers.origin||"*","Cache-Control":"no-store, no-cache, must-revalidate, proxy-revalidate",Pragma:"no-cache",Expires:"0"}),serverSideRender:!1,lastModified:!0,publicPath:F.output?.publicPath,cacheControl:!1,cacheImmutable:!1}),J=u(N,{log:!1,path:U,heartbeat:2e3}),Q=p({logger:!1,...K});await Q.register(s),Q.use(X),Q.use(U,J),$(Q,{directory:w.mockPath}),b(Q,T.proxy);let V=`${F.output.path}/index.html`;function Y(){process.exit(0)}Q.get("*",async(e,t)=>{if(e.headers.accept?.includes("text/html")){let e=X.context.outputFileSystem,o=e?.readFileSync?.(V);if(!t.sent){t.type("text/html").send(o);return}}else if(e.url?.endsWith(U)&&"text/event-stream"===e.headers.accept){e.raw.url=U,J(e.raw,t.raw,S);return}}),Q.addHook("onClose",()=>{X.close(S),Q.server.close(S)}),await Q.register(r,{global:!0}),Q.listen({port:k});let Z=await Promise.all(y.map(I)),ee=h(Z[0]||{},Z[1]||{});y.forEach(function(t){o(t,async function(){let[o,r]=await Promise.all(y.map(I)),s=h(o||{},r||{}),l=f(ee,s);1===Object.keys(l).length&&"proxy"in l?(n(i(`代理更新中...`,"yellow"),!0),await b(Q,s.proxy),n(i(`代理更新完成...`,"green"),!0),T.proxy=s.proxy,ee.proxy=s.proxy,ee=s):(ee=s,a(i(`检测到工程配置${i(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),e("win32"===process.platform?`netstat -ano | findstr :${k}`:`lsof -i :${k} -t`,(e,t)=>{if(e){a(i(`查找端口 ${k} 时发生错误: ${e.message}`,"red")),a(i("请尝试手动重启程序","yellow"));return}let o=t.trim().split("\n").filter(Boolean),r=et?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!r){a(i(`未找到占用端口 ${k} 的进程, 请尝试手动重启程序`,"yellow"));return}try{process.kill(Number(r),"SIGHUP")}catch(e){a(i(`终止进程 ${r} 时发生错误: ${e.message}`,"red"))}}))})});let et="win32"===process.platform;process.on("SIGHUP",function(){Q.close(S),function(){let e=t(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",Y)}()}),process.on("exit",function(){Q.close(S)}),v(Y);
1
+ import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import r from"@fastify/compress";import{fastifyMiddie as s}from"@fastify/middie";import{ink as i,loadFile as l,print as n,println as a,progressBar as m}from"@moneko/utils";import p from"fastify";import c from"webpack";import d from"webpack-dev-middleware";import u from"webpack-hot-middleware";import{merge as h}from"webpack-merge";import{diffObject as f}from"./commom/diff-object.mjs";import g from"./commom/has-pkg.mjs";import w,{config_files as y}from"./commom/paths.mjs";import x from"./commom/rule.mjs";import v from"./commom/sigint-exit.mjs";import{devLog as C,PORT as k}from"./dev/config.mjs";import $ from"./dev/mock.mjs";import{setupProxy as b}from"./dev/proxy.mjs";import j from"./options/reslove.mjs";import P from"./plugin/stylelint.mjs";import{empty as S,resolveProgram as A}from"./utils/index.mjs";import{commonConfig as E}from"./common.mjs";import{CONFIG as T,getConfig as I,PUBLICPATH as M}from"./config.mjs";import _ from"./module.config.mjs";import{isLibrary as R,isReact as B,refresh as H}from"./process-env.mjs";let O=T.eslint&&g("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,q=["js","jsx","ts","tsx","json","html","vue"],z=q.join(","),U=`${M.endsWith("/")?"":"/"}__hmr__`,D=new URLSearchParams({name:"client",path:U,dynamicPublicPath:!0,timeout:2e3,reload:!H,quiet:!0,noInfo:!0,overlay:!0,autoConnect:!0}).toString(),G=E.output.path,L=T.bar,W=L.name||"Build",F=h(E,{entry:{main:[`${j.hotMiddlewareClient}?${D}`]},output:{path:G},module:_(!1),optimization:{minimize:!1,concatenateModules:!1,removeAvailableModules:!1,removeEmptyChunks:!0,providedExports:!0,usedExports:!1,sideEffects:!1,splitChunks:{chunks:"all",minChunks:1,minSize:30720,maxSize:0,maxAsyncRequests:60,maxInitialRequests:50,hidePathInfo:!1,cacheGroups:{vendors:{test:x.node_modules,priority:-10,reuseExistingChunk:!0},default:{minChunks:1,priority:-20,reuseExistingChunk:!0}}}},plugins:[new c.HotModuleReplacementPlugin,new c.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app|@moneko)).+/,/\.d\.ts$/]})]});if(F.plugins||(F.plugins=[]),B){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;F.plugins.push(new e)}if(O&&F.plugins.push(new O({fix:!0,threads:!0,files:[`${T.alias["@"]}/**/*.{${z}}`,R&&`${T.alias["@pkg"]}/**/*.{${z}}`].filter(Boolean),extensions:q,exclude:["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],cache:!0,cacheLocation:`${w.lintCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,overrideConfigFile:A("eslint.config.mjs"),configType:"flat"})),T.stylelint){let e="css,scss,sass,less,ts,tsx,js,jsx";F.plugins.push(new P({fix:!0,files:[`${T.alias["@"]}/**/*.{${e}}`,R&&`${T.alias["@pkg"]}/**/*.{${e}}`].filter(Boolean),cache:!0,cacheLocation:`${w.lintCachePath}/.stylelintcache`}))}T.bar&&F.plugins.push(new c.ProgressPlugin({handler(e,t,...o){m(e||0,1,{msg:o.length?`[${t}] ${o.join(" ")}`:"",name:W,barColor:L.barColor,nameColor:L.nameColor,barBgColor:L.barBgColor,msgColor:L.msgColor}),1===e&&process.stdout.write("\r\x1b[2K")}}));let N=c(F);N.hooks.done.tap("client-log",e=>{C(null,e)});let K={};if(T.devServer.https){let[e,t]=await Promise.all([l(T.devServer.https.key),l(T.devServer.https.cert)]);e||(a(i(`法加载私钥。请检查路径和文件是否存在,并确保路径正确:${T.devServer.https.key}`,"red")),process.exit(1)),t||(a(i(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${T.devServer.https.cert}`,"red")),process.exit(1)),K.http2=!0,K.https={key:e,cert:t}}let X=d(N,{writeToDisk:!1,index:"index.html",headers:e=>({"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",...T.devServer.headers,"Access-Control-Allow-Origin":e.headers.origin||"*","Cache-Control":"no-store, no-cache, must-revalidate, proxy-revalidate",Pragma:"no-cache",Expires:"0"}),serverSideRender:!1,lastModified:!0,publicPath:F.output?.publicPath,cacheControl:!1,cacheImmutable:!1}),J=u(N,{log:!1,path:U,heartbeat:2e3}),Q=p({logger:!1,...K});await Q.register(s),Q.use(X),Q.use(U,J),$(Q,{directory:w.mockPath}),b(Q,T.proxy);let V=`${F.output.path}/index.html`;function Y(){process.exit(0)}Q.get("*",async(e,t)=>{if(e.headers.accept?.includes("text/html")){let e=X.context.outputFileSystem,o=e?.readFileSync?.(V);if(!t.sent){t.type("text/html").send(o);return}}else if(e.url?.endsWith(U)&&"text/event-stream"===e.headers.accept){e.raw.url=U,J(e.raw,t.raw,S);return}}),Q.addHook("onClose",()=>{X.close(S),Q.server.close(S)}),await Q.register(r,{global:!0}),Q.listen({port:k});let Z=await Promise.all(y.map(I)),ee=h(Z[0]||{},Z[1]||{});y.forEach(function(t){o(t,async function(){let[o,r]=await Promise.all(y.map(I)),s=h(o||{},r||{}),l=f(ee,s);1===Object.keys(l).length&&"proxy"in l?(n(i(`代理更新中...`,"yellow"),!0),await b(Q,s.proxy),n(i(`代理更新完成...`,"green"),!0),T.proxy=s.proxy,ee.proxy=s.proxy,ee=s):(ee=s,a(i(`检测到工程配置${i(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),e("win32"===process.platform?`netstat -ano | findstr :${k}`:`lsof -i :${k} -t`,(e,t)=>{if(e){a(i(`查找端口 ${k} 时发生错误: ${e.message}`,"red")),a(i("请尝试手动重启程序","yellow"));return}let o=t.trim().split("\n").filter(Boolean),r=et?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!r){a(i(`未找到占用端口 ${k} 的进程, 请尝试手动重启程序`,"yellow"));return}try{process.kill(Number(r),"SIGHUP")}catch(e){a(i(`终止进程 ${r} 时发生错误: ${e.message}`,"red"))}}))})});let et="win32"===process.platform;process.on("SIGHUP",function(){Q.close(S),function(){let e=t(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",Y)}()}),process.on("exit",function(){Q.close(S)}),v(Y);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.27.0-beta.0",
3
+ "version": "3.27.0-beta.1",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -420,13 +420,15 @@ export declare type ConfigType = {
420
420
  * @description 用于配置 SolidJS JSX 语法中 DOM 表达式的处理方式
421
421
  */
422
422
  jsxDomExpressions?: JsxDomExpressions;
423
- bar?: {
424
- name?: string;
425
- color?: string;
426
- nameColor?: string;
427
- barBgColor?: string;
428
- msgColor?: string;
429
- } | false;
423
+ bar?:
424
+ | {
425
+ name?: string;
426
+ barColor?: string;
427
+ nameColor?: string;
428
+ barBgColor?: string;
429
+ msgColor?: string;
430
+ }
431
+ | false;
430
432
  /** 虚拟模块
431
433
  * @example
432
434
  * const conf = {