@moneko/core 3.51.3 → 3.51.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/config.mjs CHANGED
@@ -1 +1 @@
1
- import{join as e,relative as o}from"node:path";import t from"node:process";import{fileExists as r}from"@moneko/utils";import{merge as n}from"webpack-merge";import s from"./commom/paths.mjs";import a from"./commom/require.mjs";import i from"./commom/setup-env.mjs";import l from"./options/jsx-dom-expressions.mjs";import m from"./options/split-chunk.mjs";import{isFunction as p,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{APPTYPE as d,FRAMEWORK as f,frameworkVersion as h,isCI as g,isDev as v,isLibrary as x,isMobile as P,isReact as j,jsxImportSource as C,mainDirectory as b,NODE_ENV as k,PACKAGENAME as w}from"./process-env.mjs";let O=["@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 a.cache[e],new Promise(o=>{if(r(e)){let r=a(e).default;return o(p(r)?r(t):r)}return o({})})}let S=await Promise.all([i(k,d,f,[]),getConfig(s.configPath),getConfig(s.customConfigPath)]),y=S[0],M=S[1],I=S[2],z={strict:!1,devtool:v?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:"",namespace:w,moduleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]",fallbackModuleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]"},env:y,basename:"/",publicPath:"/",rem:{designSize:P?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":u(b)},j&&h<18?{"react/package.json":c("react/package.json"),"react/jsx-runtime":c("react/jsx-runtime.js"),"react/jsx-dev-runtime":c("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0},htmlPluginOption:{title:w.toLocaleUpperCase(),favicon:o(s.programPath,`${s.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:m,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:O,js:O,media:O,font:O,wasm:[]},mdx:{jsx:!1,development:v,jsxImportSource:C,providerImportSource:`@moneko/${f}/mdx`},jsxDomExpressions:l,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:g},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==f,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1},minChunkSize:1e3,compression:v,manifest:{filename:"manifest.json"},corepack:!0};x&&(z.alias=Object.assign(z.alias,{"@pkg":s.componentsPath,[w]:s.componentsPath}));let F=z;(!1===(F=n(F,M,I)).devtool||!1===F.sourceMap)&&(F.sourceMap=!1,F.devtool=!1),F.htmlPluginOption&&(F.htmlPluginOption.tags||(F.htmlPluginOption.tags=[]),F.fixBrowserRouter&&F.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))"}),F.manifest&&F.htmlPluginOption.tags.push({href:e("auto"===F.publicPath?"":F.publicPath,F.manifest.filename).replaceAll(/\\/g,"/"),tag:"link",rel:"manifest"})),"true"===t.env.CODESPACES&&(F.devServer.https=!1),!1===F.devServer.https&&"darwin"===t.platform&&(F.devServer.open=!1);let $=`${F.devServer.https?"https":"http"}://${F.devServer.host}:${F.devServer.port}${F.basename}`;export const CONFIG=F;export const PUBLICPATH=v?$:"auto"===CONFIG.publicPath?"":CONFIG.publicPath;
1
+ import{join as e,relative as o}from"node:path";import t from"node:process";import{fileExists as r}from"@moneko/utils";import{merge as n}from"webpack-merge";import s from"./commom/paths.mjs";import a from"./commom/require.mjs";import i from"./commom/setup-env.mjs";import l from"./options/jsx-dom-expressions.mjs";import m from"./options/split-chunk.mjs";import{isFunction as p,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{APPTYPE as d,FRAMEWORK as f,frameworkVersion as h,isCI as g,isDev as v,isLibrary as P,isMobile as x,isReact as j,jsxImportSource as C,mainDirectory as b,NODE_ENV as k,PACKAGENAME as w}from"./process-env.mjs";let O=["@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 a.cache[e],new Promise(o=>{if(r(e)){let r=a(e).default;return o(p(r)?r(t):r)}return o({})})}let S=await Promise.all([i(k,d,f,[]),getConfig(s.configPath),getConfig(s.customConfigPath)]),y=S[0],M=S[1],I=S[2],z={strict:!1,devtool:v?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:"",namespace:w,moduleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]",fallbackModuleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]"},env:y,basename:"/",publicPath:"/",rem:{designSize:x?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":u(b)},j&&h<18?{"react/package.json":c("react/package.json"),"react/jsx-runtime":c("react/jsx-runtime.js"),"react/jsx-dev-runtime":c("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0},htmlPluginOption:{title:w.toLocaleUpperCase(),favicon:o(s.programPath,`${s.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:m,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:O,js:O,media:O,font:O,wasm:[]},mdx:{jsx:!1,development:v,jsxImportSource:C,providerImportSource:`@moneko/${f}/mdx`},jsxDomExpressions:l,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:g},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==f,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1},minChunkSize:1e3,compression:v,manifest:{filename:"manifest.json"},corepack:!0};P&&(z.alias=Object.assign(z.alias,{"@pkg":s.componentsPath,[w]:s.componentsPath}));let F=z;(!1===(F=n(F,M,I)).devtool||!1===F.sourceMap)&&(F.sourceMap=!1,F.devtool=!1),"true"===t.env.CODESPACES&&(F.devServer.https=!1),!1===F.devServer.https&&"darwin"===t.platform&&(F.devServer.open=!1);let $=`${F.devServer.https?"https":"http"}://${F.devServer.host}:${F.devServer.port}${F.basename}`;v&&(F.publicPath=$),F.htmlPluginOption&&(F.htmlPluginOption.tags||(F.htmlPluginOption.tags=[]),F.fixBrowserRouter&&F.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))"}),F.manifest&&F.htmlPluginOption.tags.push({href:e("auto"===F.publicPath?"":F.publicPath,F.manifest.filename).replaceAll(/\\/g,"/"),tag:"link",rel:"manifest"}));export const CONFIG=F;export const PUBLICPATH="auto"===CONFIG.publicPath?"":CONFIG.publicPath;
package/lib/dev.d.mts CHANGED
@@ -33,7 +33,7 @@ declare const clientParams: ClientOptions;
33
33
  declare const hotParams: string;
34
34
  declare const clientOption: webpack.Configuration;
35
35
  declare function getLintFiles(exts: string[]);
36
- declare const compiler: Compiler;
36
+ declare const compiler: Compiler | null;
37
37
  declare const watching: Watching;
38
38
  declare const hotUrl: string;
39
39
  declare const hot: ReturnType<typeof hotMiddleware>;
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{join as r,relative as n}from"node:path";import i from"node:process";import{URL as s}from"node:url";import{ink as a,print as m,println as l,progressBar as p}from"@moneko/utils";import c from"webpack";import f from"webpack-hot-middleware";import{merge as h}from"webpack-merge";import{diffObject as u}from"./commom/diff-object.mjs";import d,{config_files as g}from"./commom/paths.mjs";import w from"./commom/sigint-exit.mjs";import{devLog as y,PORT as j}from"./dev/config.mjs";import $ from"./dev/generate-progress-html.mjs";import v from"./dev/server.mjs";import b from"./options/reslove.mjs";import{ESLintPlugin as C}from"./plugin/eslint.mjs";import{generateManifest as x}from"./plugin/manifest.mjs";import{StylelintPlugin as _}from"./plugin/stylelint.mjs";import{empty as P}from"./utils/index.mjs";import{commonConfig as S}from"./common.mjs";import{CONFIG as k,getConfig as H,PUBLICPATH as O}from"./config.mjs";import{outputFileSystem as T}from"./file-system.mjs";import B from"./module.config.mjs";import{isLibrary as I,isReact as q,refresh as E}from"./process-env.mjs";let G=!1,L="/____progress____",N={percentage:0,info:""},R="/__hmr__",U=new URLSearchParams({name:"client",path:R.substring(1),dynamicPublicPath:!0,timeout:2e3,reload:!E,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),F=h(S,{watchOptions:{stdin:!0,aggregateTimeout:300,ignored:/node_modules\/(?!(@app)\/)/},entry:{main:[`${b.hotMiddlewareClient}?${U}`]},module:B(!1),plugins:[new c.HotModuleReplacementPlugin,new c.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app)\/)/,/\.d\.ts$/]}),new c.ProgressPlugin({handler(e,t,...o){let r=o.length?`[${t}] ${o.join(" ")}`:" ";G||(N.info=r,N.percentage=e,G=1===e);let n=k.bar;if(n){let t=n.name||"Build";n.quiet?i.stdout.write(`${r}
2
- `):(p(e||0,1,{msg:r,name:t,barColor:n.barColor,nameColor:n.nameColor,barBgColor:n.barBgColor,msgColor:n.msgColor}),1===e&&i.stdout.write("\r\x1b[2K"))}}})]});if(q){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;F.plugins.push(new e({overlay:!1}))}function J(e){let t=e.join(","),o=[n(d.programPath,`${k.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return I&&o.push(n(d.programPath,`${k.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}k.eslint&&F.plugins.push(new C({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:J(["js","jsx","ts","tsx","json","html","vue"]),...k.eslint})),k.stylelint&&F.plugins.push(new _({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.stylelintcache`,files:J(["css","scss","sass","less","ts","tsx","js","jsx"]),...k.stylelint}));let M=c(F);M.outputFileSystem=T;let A=M.watch(M.options.watchOptions,y);M.hooks.done.tap("client-log",e=>{y(null,e)});let K=`${O}/${R}`.replace(/\/+/g,"/"),W=f(M,{log:!1,path:K,heartbeat:2e3}),z=!!k.manifest&&r(O,k.manifest.filename).replaceAll(/\\/g,"/"),D=await v({port:j,root_dir:M.options.output.path,fileSystem:M.outputFileSystem,headers:k.devServer.headers,https:k.devServer.https,host:k.devServer.host,open:k.devServer.open,basename:k.basename,onRequest(e,t){if(!t.writableEnded){if("GET"===e.method){let o=new s(`${k.devServer.https?"https":"http"}://${e.headers.host}${e.url}`);if(z&&o.pathname===z)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(x({}))),!0;if(o.pathname===L)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(N)),!0;if(!G)return t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end($(L,N)),!0;if(o.pathname===K&&"text/event-stream"===e.headers.accept)return W(e,t,P),!0}return!1}}});function Q(){i.exit(0)}D.on("close",()=>{A.close(P),W.close()});let V=await Promise.all(g.map(H)),X=h(V[0]||{},V[1]||{});g.forEach(function(t){o(t,async function(){let[o,r]=await Promise.all(g.map(H)),n=h(o||{},r||{}),s=u(X,n);1===Object.keys(s).length&&"proxy"in s?(m(a(`代理更新中...`,"yellow"),!0),m(a(`代理更新完成...`,"green"),!0),k.proxy=n.proxy,X.proxy=n.proxy,X=n):(X=n,l(a(`检测到工程配置${a(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),e(Y?`netstat -ano | findstr :${j}`:`lsof -i :${j} -t`,(e,t)=>{if(e){l(a(`查找端口 ${j} 时发生错误: ${e.message}`,"red")),l(a("请尝试手动重启程序","yellow"));return}let o=t.trim().replace(/\r\n/g,"\n").split("\n").filter(Boolean),r=Y?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!r){l(a(`未找到占用端口 ${j} 的进程, 请尝试手动重启程序`,"yellow"));return}try{i.kill(Number(r),"SIGHUP")}catch(e){l(a(`终止进程 ${r} 时发生错误: ${e.message}`,"red"))}}))})});let Y="win32"===i.platform;i.on("SIGHUP",function(){D.close(P),function(){let e=t(i.argv[0],i.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",Q)}()}),i.on("exit",function(){D.close(P)}),w(Q);
1
+ import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import{join as r,relative as n}from"node:path";import i from"node:process";import{URL as s}from"node:url";import{ink as a,print as m,println as l,progressBar as p}from"@moneko/utils";import c from"webpack";import f from"webpack-hot-middleware";import{merge as h}from"webpack-merge";import{diffObject as u}from"./commom/diff-object.mjs";import d,{config_files as g}from"./commom/paths.mjs";import w from"./commom/sigint-exit.mjs";import{devLog as y,PORT as j}from"./dev/config.mjs";import $ from"./dev/generate-progress-html.mjs";import v from"./dev/server.mjs";import b from"./options/reslove.mjs";import{ESLintPlugin as C}from"./plugin/eslint.mjs";import{generateManifest as x}from"./plugin/manifest.mjs";import{StylelintPlugin as _}from"./plugin/stylelint.mjs";import{empty as P}from"./utils/index.mjs";import{commonConfig as S}from"./common.mjs";import{CONFIG as k,getConfig as H,PUBLICPATH as O}from"./config.mjs";import{outputFileSystem as T}from"./file-system.mjs";import B from"./module.config.mjs";import{isLibrary as E,isReact as I,refresh as q}from"./process-env.mjs";let G=!1,L="/____progress____",N={percentage:0,info:""},R="/__hmr__",U=new URLSearchParams({name:"client",path:R.substring(1),dynamicPublicPath:!0,timeout:2e3,reload:!q,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),F=h(S,{watchOptions:{stdin:!0,aggregateTimeout:300,ignored:/node_modules\/(?!(@app)\/)/},entry:{main:[`${b.hotMiddlewareClient}?${U}`]},module:B(!1),plugins:[new c.HotModuleReplacementPlugin,new c.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app)\/)/,/\.d\.ts$/]}),new c.ProgressPlugin({handler(e,t,...o){let r=o.length?`[${t}] ${o.join(" ")}`:" ";G||(N.info=r,N.percentage=e,G=1===e);let n=k.bar;if(n){let t=n.name||"Build";n.quiet?i.stdout.write(`${r}
2
+ `):(p(e||0,1,{msg:r,name:t,barColor:n.barColor,nameColor:n.nameColor,barBgColor:n.barBgColor,msgColor:n.msgColor}),1===e&&i.stdout.write("\r\x1b[2K"))}}})]});if(I){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;F.plugins.push(new e({overlay:!1}))}function J(e){let t=e.join(","),o=[n(d.programPath,`${k.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return E&&o.push(n(d.programPath,`${k.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}k.eslint&&F.plugins.push(new C({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:J(["js","jsx","ts","tsx","json","html","vue"]),...k.eslint})),k.stylelint&&F.plugins.push(new _({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.stylelintcache`,files:J(["css","scss","sass","less","ts","tsx","js","jsx"]),...k.stylelint}));let M=c(F);if(!M)throw Error("无法创建编译器");M.outputFileSystem=T;let A=M.watch(M.options.watchOptions,y);M.hooks.done.tap("client-log",e=>{y(null,e)});let K=`${k.basename}/${R}`.replace(/\/+/g,"/"),W=f(M,{log:!1,path:K,heartbeat:2e3}),z=!!k.manifest&&r(O,k.manifest.filename).replaceAll(/\\/g,"/"),D=await v({port:j,root_dir:M.options.output.path,fileSystem:M.outputFileSystem,headers:k.devServer.headers,https:k.devServer.https,host:k.devServer.host,open:k.devServer.open,basename:k.basename,onRequest(e,t){if(!t.writableEnded){if("GET"===e.method){let o=new s(`${k.devServer.https?"https":"http"}://${e.headers.host}${e.url}`);if(z&&o.pathname===z)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(x({}))),!0;if(o.pathname===L)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(N)),!0;if(!G)return t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end($(L,N)),!0;if(o.pathname===K&&"text/event-stream"===e.headers.accept)return W(e,t,P),!0}return!1}}});function Q(){i.exit(0)}D.on("close",()=>{A.close(P),W.close()});let V=await Promise.all(g.map(H)),X=h(V[0]||{},V[1]||{});g.forEach(function(t){o(t,async function(){let[o,r]=await Promise.all(g.map(H)),n=h(o||{},r||{}),s=u(X,n);1===Object.keys(s).length&&"proxy"in s?(m(a(`代理更新中...`,"yellow"),!0),m(a(`代理更新完成...`,"green"),!0),k.proxy=n.proxy,X.proxy=n.proxy,X=n):(X=n,l(a(`检测到工程配置${a(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),e(Y?`netstat -ano | findstr :${j}`:`lsof -i :${j} -t`,(e,t)=>{if(e){l(a(`查找端口 ${j} 时发生错误: ${e.message}`,"red")),l(a("请尝试手动重启程序","yellow"));return}let o=t.trim().replace(/\r\n/g,"\n").split("\n").filter(Boolean),r=Y?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!r){l(a(`未找到占用端口 ${j} 的进程, 请尝试手动重启程序`,"yellow"));return}try{i.kill(Number(r),"SIGHUP")}catch(e){l(a(`终止进程 ${r} 时发生错误: ${e.message}`,"red"))}}))})});let Y="win32"===i.platform;i.on("SIGHUP",function(){D.close(P),function(){let e=t(i.argv[0],i.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",Q)}()}),i.on("exit",function(){D.close(P)}),w(Q);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.51.3",
3
+ "version": "3.51.5",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",