@moneko/core 3.23.2 → 3.23.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/config.mjs CHANGED
@@ -1 +1 @@
1
- import{merge as e}from"webpack-merge";import o from"./options/jsx-dom-expressions.mjs";import t from"./options/split-chunk.mjs";import s from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as i,NODE_ENV as n,PACKAGENAME as l,isDev as a,isLibrary as m,isMobile as p,jsxImportSource as c,mainDirectory as u}from"./process-env.mjs";import{isFunction as d,resolveProgram as f}from"./utils/index.mjs";import h from"./utils/setup-env.mjs";import{fileExists as g}from"@moneko/utils";import x from"./utils/require.mjs";let v=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],P={devtool:a?"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:h(n,r,i),basename:"/",publicPath:"/",rem:{designSize:p?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(u)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:t,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:v,js:v,media:v,font:v,wasm:[]},mdx:{jsx:!1,development:a,jsxImportSource:c,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:o,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:{maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js")},refresh:!1};function j(e){if(g(e)){let o=x(e).default;return d(o)?o(process):o}return{}}m&&(P.alias=Object.assign(P.alias,{"@pkg":s.componentsPath,[l]:s.componentsPath}));let k=P;(!1===(k=e(k,j(s.configPath),j(s.customConfigPath))).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.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=k;export const PUBLICPATH=CONFIG.publicPath;
1
+ import{merge as e}from"webpack-merge";import o from"./options/jsx-dom-expressions.mjs";import t from"./options/split-chunk.mjs";import s from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as i,NODE_ENV as n,PACKAGENAME as l,isDev as a,isLibrary as m,isMobile as p,jsxImportSource as c,mainDirectory as u}from"./process-env.mjs";import{isFunction as d,resolveProgram as f}from"./utils/index.mjs";import h from"./utils/setup-env.mjs";import{fileExists as g}from"@moneko/utils";import x from"./utils/require.mjs";let v=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],P={devtool:a?"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:h(n,r,i),basename:"/",publicPath:"/",rem:{designSize:p?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(u)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:t,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:v,js:v,media:v,font:v,wasm:[]},mdx:{jsx:!1,development:a,jsxImportSource:c,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:o,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:{maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js")},refresh:!0};function j(e){if(g(e)){let o=x(e).default;return d(o)?o(process):o}return{}}m&&(P.alias=Object.assign(P.alias,{"@pkg":s.componentsPath,[l]:s.componentsPath}));let k=P;(!1===(k=e(k,j(s.configPath),j(s.customConfigPath))).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.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=k;export const PUBLICPATH=CONFIG.publicPath;
package/lib/dev.mjs CHANGED
@@ -1 +1 @@
1
- let e;import t from"express";import o from"https";import r from"multer";import i from"webpack";import s from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as n}from"webpack-merge";import m from"./build/server.mjs";import{commonConfig as a}from"./common.mjs";import{CONFIG as c,PUBLICPATH as p}from"./config.mjs";import{PORT as u,devLog as d}from"./dev/config.mjs";import f from"./dev/mock.mjs";import h from"./dev/proxy.mjs";import g from"./module.config.mjs";import w,{CUSTOMCONFIG as v}from"./paths.mjs";import{SSR as x,isLibrary as $,isReact as k,refresh as y}from"./process-env.mjs";import j from"./utils/has-pkg.mjs";import{empty as b,resolveProgram as P}from"./utils/index.mjs";import S from"./utils/progress.mjs";import A from"./utils/sigint-exit.mjs";import C from"./options/reslove.mjs";import{watchFile as T}from"fs";import{join as M}from"path";import{spawn as B,exec as O}from"child_process";import _ from"./utils/print.mjs";import D from"chalk";import{directoryExists as E,loadFile as I,loadFileSync as U}from"@moneko/utils";let{HotModuleReplacementPlugin:G,ProgressPlugin:H,WatchIgnorePlugin:L}=i,R=j("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,q=j("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,N=k&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,W=["js","jsx","ts","tsx","json","html","vue"],F=W.join(","),X=["css","scss","sass","less","ts","tsx","js","jsx"],z=X.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=`${p.endsWith("/")?"":"/"}__hmr__`,Q=new URLSearchParams({name:"client",path:J,dynamicPublicPath:!0,timeout:2e3,reload:!y,quiet:!0,noInfo:!0,overlay:!0}).toString(),V=a.output.path;x&&(V=P(`${$?"docs":"dist"}/client`));let Y=!!c.bar,Z=n(a,{entry:{main:[`${C.hotMiddlewareClient}?${Q}`]},output:{path:V},module:g(!1),plugins:[new G,new L({paths:[/\.d\.ts$/]}),N&&new N,q&&new q({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${F}}`,$&&`${c.alias["@pkg"]}/**/*.{${F}}`].filter(Boolean),extensions:W,exclude:K,cache:!0,cacheLocation:`${w.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,configType:"flat"}),R&&new R({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${z}}`,$&&`${c.alias["@pkg"]}/**/*.{${z}}`].filter(Boolean),extensions:X,exclude:K,cache:!0,cacheLocation:`${w.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new H({handler(e,t,...o){let r=c.bar||{};S({showBar:Y,percentage:e,title:r.name||"Build",color:r.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:Z.output?.path})}})].filter(Boolean)}),ee=[Z];x&&ee.push(n(a,m));let et=i(ee);et.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let eo=t(),er=r(),ei=s(et,{writeToDisk:!1,index:"index.html",headers:e=>({"Access-Control-Allow-Origin":e.headers.origin||"*","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",...c.devServer.headers}),serverSideRender:x,lastModified:!0,publicPath:Z.output?.publicPath}),es=l(et,{log:!1,path:J,heartbeat:2e3});if(eo.use(ei),eo.use(es),eo.use(t.static(M(w.programPath,"./public"))),c.proxy&&h(eo,c.proxy),E(w.mockPath)){let e=f(w.mockPath);eo.use(e)}let el=`${Z.output.path}/index.html`;if(eo.all("/*",er.any(),function(e,t,o){if("GET"!==e.method)return o();{let r=e.get("Accept");if(r?.includes("text/html")){let e=ei.context.outputFileSystem,o=e?.readFileSync?.(el);t.end(o)}else if("text/event-stream"===r&&e.url.endsWith(J))return e.url=J,es(e,t,o);else return o()}}),c.devServer.https){let[t,r]=await Promise.all([I(c.devServer.https.key),I(c.devServer.https.cert)]);t||(_(D.redBright(`无法加载私钥。请检查路径和文件是否存在,并确保路径正确:${c.devServer.https.key}`)),process.exit(1)),r||(_(D.redBright(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${c.devServer.https.cert}`)),process.exit(1)),e=o.createServer({key:t,cert:r},eo)}let en=(e||eo).listen(u,"0.0.0.0",()=>{});function em(){process.exit(0)}function ea(e,t){let o=U(e);t&&null!==o&&T(e,async function(){let r=U(e);o.trim().replace(/^\s*[\r\n]/gm,"")!==r?.trim().replace(/^\s*[\r\n]/gm,"")?(_(D.yellow(`检测到工程配置${D.blue(`[${t}]`)}变更, 程序即将重启...`)),O("win32"===process.platform?`netstat -ano | findstr :${u}`:`lsof -i :${u}`,(e,t)=>{let o=ec?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];o?process.kill(Number(o),"SIGHUP"):_(`未找到占用端口 ${u} 的进程`)})):_(D.gray(`未变更`))})}ea(w.configPath,"index"),ea(w.customConfigPath,v);let ec="win32"===process.platform;process.on("SIGHUP",function(){ei.close(b),en.close(b),en.closeAllConnections(),function(){let e=B(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",em)}()}),process.on("exit",function(){ei.close(b),en.close(b),en.closeAllConnections()}),A(em);
1
+ let e;import t from"express";import o from"https";import i from"multer";import r from"webpack";import s from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as n}from"webpack-merge";import m from"./build/server.mjs";import{commonConfig as a}from"./common.mjs";import{CONFIG as c,PUBLICPATH as p}from"./config.mjs";import{PORT as u,devLog as d}from"./dev/config.mjs";import f from"./dev/mock.mjs";import h from"./dev/proxy.mjs";import g from"./module.config.mjs";import w,{CUSTOMCONFIG as v}from"./paths.mjs";import{SSR as x,isLibrary as $,isReact as j,refresh as k}from"./process-env.mjs";import y from"./utils/has-pkg.mjs";import{empty as b,resolveProgram as P}from"./utils/index.mjs";import S from"./utils/progress.mjs";import C from"./utils/sigint-exit.mjs";import A from"./options/reslove.mjs";import{watchFile as T}from"fs";import{join as M}from"path";import{spawn as B,exec as O}from"child_process";import _ from"./utils/print.mjs";import D from"chalk";import{directoryExists as E,loadFile as I,loadFileSync as U}from"@moneko/utils";let{HotModuleReplacementPlugin:G,ProgressPlugin:H,WatchIgnorePlugin:L}=r,R=y("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,q=y("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,F=j&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,N=["js","jsx","ts","tsx","json","html","vue"],W=N.join(","),X=["css","scss","sass","less","ts","tsx","js","jsx"],z=X.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=`${p.endsWith("/")?"":"/"}__hmr__`,Q=new URLSearchParams({name:"client",path:J,dynamicPublicPath:!0,timeout:2e3,reload:!k,quiet:!0,noInfo:!0,overlay:!0}).toString(),V=a.output.path;x&&(V=P(`${$?"docs":"dist"}/client`));let Y=!!c.bar,Z=n(a,{entry:{main:[`${A.hotMiddlewareClient}?${Q}`]},output:{path:V},module:g(!1),plugins:[new G,new L({paths:[/\.d\.ts$/]}),F&&new F,q&&new q({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${W}}`,$&&`${c.alias["@pkg"]}/**/*.{${W}}`].filter(Boolean),extensions:N,exclude:K,cache:!0,cacheLocation:`${w.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,overrideConfigFile:P("eslint.config.mjs"),configType:"flat"}),R&&new R({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${z}}`,$&&`${c.alias["@pkg"]}/**/*.{${z}}`].filter(Boolean),extensions:X,exclude:K,cache:!0,cacheLocation:`${w.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new H({handler(e,t,...o){let i=c.bar||{};S({showBar:Y,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:Z.output?.path})}})].filter(Boolean)}),ee=[Z];x&&ee.push(n(a,m));let et=r(ee);et.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let eo=t(),ei=i(),er=s(et,{writeToDisk:!1,index:"index.html",headers:e=>({"Access-Control-Allow-Origin":e.headers.origin||"*","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",...c.devServer.headers}),serverSideRender:x,lastModified:!0,publicPath:Z.output?.publicPath}),es=l(et,{log:!1,path:J,heartbeat:2e3});if(eo.use(er),eo.use(es),eo.use(t.static(M(w.programPath,"./public"))),c.proxy&&h(eo,c.proxy),E(w.mockPath)){let e=f(w.mockPath);eo.use(e)}let el=`${Z.output.path}/index.html`;if(eo.all("/*",ei.any(),function(e,t,o){if("GET"!==e.method)return o();{let i=e.get("Accept");if(i?.includes("text/html")){let e=er.context.outputFileSystem,o=e?.readFileSync?.(el);t.end(o)}else if("text/event-stream"===i&&e.url.endsWith(J))return e.url=J,es(e,t,o);else return o()}}),c.devServer.https){let[t,i]=await Promise.all([I(c.devServer.https.key),I(c.devServer.https.cert)]);t||(_(D.redBright(`无法加载私钥。请检查路径和文件是否存在,并确保路径正确:${c.devServer.https.key}`)),process.exit(1)),i||(_(D.redBright(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${c.devServer.https.cert}`)),process.exit(1)),e=o.createServer({key:t,cert:i},eo)}let en=(e||eo).listen(u,"0.0.0.0",()=>{});function em(){process.exit(0)}function ea(e,t){let o=U(e);t&&null!==o&&T(e,async function(){let i=U(e);o.trim().replace(/^\s*[\r\n]/gm,"")!==i?.trim().replace(/^\s*[\r\n]/gm,"")?(_(D.yellow(`检测到工程配置${D.blue(`[${t}]`)}变更, 程序即将重启...`)),O("win32"===process.platform?`netstat -ano | findstr :${u}`:`lsof -i :${u}`,(e,t)=>{let o=ec?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];o?process.kill(Number(o),"SIGHUP"):_(`未找到占用端口 ${u} 的进程`)})):_(D.gray(`未变更`))})}ea(w.configPath,"index"),ea(w.customConfigPath,v);let ec="win32"===process.platform;process.on("SIGHUP",function(){er.close(b),en.close(b),en.closeAllConnections(),function(){let e=B(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",em)}()}),process.on("exit",function(){er.close(b),en.close(b),en.closeAllConnections()}),C(em);
@@ -1 +1 @@
1
- import{ModuleDeclarationKind as e,Project as t,SyntaxKind as r}from"ts-morph";import{resolve as o}from"path";let n=new t({useInMemoryFileSystem:!0});export default function(t,a){let s=[],d=o(`@types/${t}.d.ts`),i=n.createSourceFile(d,a);i.forEachDescendant(e=>{e.getKind()===r.DeclareKeyword&&e.replaceWithText(e.isFirstNodeOnLine()?"export":"")});let l=i.getStructure().statements;return i.removeText(),i.addModule({name:`'${t}'`,declarationKind:e.Module,hasDeclareKeyword:!0,statements:l}),s.push(`// remote module: ${t}`),s.push(i.getText(!0)),s.join("\n")}
1
+ import{ModuleDeclarationKind as e,Project as t,SyntaxKind as r}from"ts-morph";import{resolve as o}from"path";let n=new t({useInMemoryFileSystem:!0});export default function(t,a){let s=[],d=o(`@types/${t}.d.ts`),i=n.createSourceFile(d,a,{overwrite:!0});i.forEachDescendant(e=>{e.getKind()===r.DeclareKeyword&&e.replaceWithText(e.isFirstNodeOnLine()?"export":"")});let l=i.getStructure().statements;return i.removeText(),i.addModule({name:`'${t}'`,declarationKind:e.Module,hasDeclareKeyword:!0,statements:l}),s.push(`// remote module: ${t}`),s.push(i.getText(!0)),s.join("\n")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.23.2",
3
+ "version": "3.23.4",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "core-js-compat": "3.38.1",
27
27
  "css-loader": "7.1.2",
28
28
  "dotenv": "16.4.5",
29
- "express": "4.21.0",
29
+ "express": "4.19.2",
30
30
  "html-webpack-plugin": "5.6.0",
31
31
  "http-proxy-middleware": "3.0.3",
32
32
  "less": "4.2.0",
@@ -39,7 +39,7 @@
39
39
  "style-loader": "4.0.0",
40
40
  "swc-loader": "0.2.6",
41
41
  "terser-webpack-plugin": "5.3.10",
42
- "ts-morph": "23.0.0",
42
+ "ts-morph": "24.0.0",
43
43
  "typescript": "5.5.4",
44
44
  "webpack": "5.95.0",
45
45
  "webpack-bundle-analyzer": "4.10.2",
@@ -122,6 +122,9 @@ export interface Theme {
122
122
  warningColor?: string;
123
123
  }
124
124
  export declare type ConfigType = {
125
+ /**
126
+ * @default true
127
+ */
125
128
  refresh?: boolean;
126
129
  /** 启用 polyfill; 当设置为 `true` 时, 则根据 `browserslist` 设置自动polyfill
127
130
  * @default false