@moneko/core 3.26.13-beta.0 → 3.26.13-beta.2
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 +1 -1
- package/lib/dev.d.mts +1 -0
- package/lib/dev.mjs +1 -1
- package/package.json +2 -2
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:[]};d&&(k.alias=Object.assign(k.alias,{"@pkg":t.componentsPath,[x]:t.componentsPath}));let
|
|
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;
|
package/lib/dev.d.mts
CHANGED
|
@@ -25,6 +25,7 @@ import type { ConfigType } from './index.mjs';
|
|
|
25
25
|
import moduleConfig from './module.config.mjs';
|
|
26
26
|
import { isLibrary, isReact, refresh } from './process-env.mjs';
|
|
27
27
|
type WebpackPlugin = new(opt?: object) => WebpackPluginInstance;
|
|
28
|
+
declare const stylelintPath: string | false;
|
|
28
29
|
declare const StylelintPlugin: WebpackPlugin;
|
|
29
30
|
declare const ESLintPlugin: WebpackPlugin;
|
|
30
31
|
declare const ReactRefresh: WebpackPlugin;
|
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
|
|
1
|
+
import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import i from"@fastify/compress";import{fastifyMiddie as r}from"@fastify/middie";import{ink as s,loadFile as l,print as n,println as a,progressBar as m}from"@moneko/utils";import c from"fastify";import p 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 y from"./commom/has-pkg.mjs";import g,{config_files as w}from"./commom/paths.mjs";import x from"./commom/rule.mjs";import v from"./commom/sigint-exit.mjs";import{devLog as k,PORT as $}from"./dev/config.mjs";import j from"./dev/mock.mjs";import{setupProxy as b}from"./dev/proxy.mjs";import C from"./options/reslove.mjs";import{empty as P,resolveProgram as S}from"./utils/index.mjs";import{commonConfig as A}from"./common.mjs";import{CONFIG as E,getConfig as T,PUBLICPATH as M}from"./config.mjs";import I from"./module.config.mjs";import{isLibrary as _,isReact as O,refresh as R}from"./process-env.mjs";let H=y("@moneko/stylelint/stylelint"),q=E.stylelint&&H&&y("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,z=E.eslint&&y("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,B=O&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,D=["js","jsx","ts","tsx","json","html","vue"],U=D.join(","),G=["css","scss","sass","less","ts","tsx","js","jsx"],L=G.join(","),W=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],F=`${M.endsWith("/")?"":"/"}__hmr__`,N=new URLSearchParams({name:"client",path:F,dynamicPublicPath:!0,timeout:2e3,reload:!R,quiet:!0,noInfo:!0,overlay:!0,autoConnect:!0}).toString(),K=A.output.path,X=E.bar.name||"Build",J=h(A,{entry:{main:[`${C.hotMiddlewareClient}?${N}`]},output:{path:K},module:I(!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 p.HotModuleReplacementPlugin,new p.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app|@moneko)).+/,/\.d\.ts$/]}),B&&new B,z&&new z({fix:!0,threads:!0,files:[`${E.alias["@"]}/**/*.{${U}}`,_&&`${E.alias["@pkg"]}/**/*.{${U}}`].filter(Boolean),extensions:D,exclude:W,cache:!0,cacheLocation:`${g.lintCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,overrideConfigFile:S("eslint.config.mjs"),configType:"flat"}),q&&new q({fix:!0,threads:!0,files:[`${E.alias["@"]}/**/*.{${L}}`,_&&`${E.alias["@pkg"]}/**/*.{${L}}`].filter(Boolean),extensions:G,exclude:W,cache:!0,cacheLocation:`${g.lintCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0,stylelintPath:H}),!!E.bar&&new p.ProgressPlugin({handler(e,t,...o){m(e||0,1,X,o.length?`[${t}] ${o.join(" ")}`:""),1===e&&process.stdout.write("\r\x1b[2K")}})].filter(Boolean)}),Q=p(J);Q.hooks.done.tap("client-log",e=>{k(null,e)});let V={};if(E.devServer.https){let[e,t]=await Promise.all([l(E.devServer.https.key),l(E.devServer.https.cert)]);e||(a(s(`法加载私钥。请检查路径和文件是否存在,并确保路径正确:${E.devServer.https.key}`,"red")),process.exit(1)),t||(a(s(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${E.devServer.https.cert}`,"red")),process.exit(1)),V.http2=!0,V.https={key:e,cert:t}}let Y=d(Q,{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",...E.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:J.output?.publicPath,cacheControl:!1,cacheImmutable:!1}),Z=u(Q,{log:!1,path:F,heartbeat:2e3}),ee=c({logger:!1,...V});await ee.register(r),ee.use(Y),ee.use(F,Z),j(ee,{directory:g.mockPath}),b(ee,E.proxy);let et=`${J.output.path}/index.html`;function eo(){process.exit(0)}ee.get("*",async(e,t)=>{if(e.headers.accept?.includes("text/html")){let e=Y.context.outputFileSystem,o=e?.readFileSync?.(et);if(!t.sent){t.type("text/html").send(o);return}}else if(e.url?.endsWith(F)&&"text/event-stream"===e.headers.accept){e.raw.url=F,Z(e.raw,t.raw,P);return}}),ee.addHook("onClose",()=>{Y.close(P),ee.server.close(P)}),await ee.register(i,{global:!0}),ee.listen({port:$});let ei=await Promise.all(w.map(T)),er=h(ei[0]||{},ei[1]||{});w.forEach(function(t){o(t,async function(){let[o,i]=await Promise.all(w.map(T)),r=h(o||{},i||{}),l=f(er,r);1===Object.keys(l).length&&"proxy"in l?(n(s(`代理更新中...`,"yellow"),!0),await b(ee,r.proxy),n(s(`代理更新完成...`,"green"),!0),E.proxy=r.proxy,er.proxy=r.proxy,er=r):(er=r,a(s(`检测到工程配置${s(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),e("win32"===process.platform?`netstat -ano | findstr :${$}`:`lsof -i :${$} -t`,(e,t)=>{if(e){a(s(`查找端口 ${$} 时发生错误: ${e.message}`,"red")),a(s("请尝试手动重启程序","yellow"));return}let o=t.trim().split("\n").filter(Boolean),i=es?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!i){a(s(`未找到占用端口 ${$} 的进程, 请尝试手动重启程序`,"yellow"));return}try{process.kill(Number(i),"SIGHUP")}catch(e){a(s(`终止进程 ${i} 时发生错误: ${e.message}`,"red"))}}))})});let es="win32"===process.platform;process.on("SIGHUP",function(){ee.close(P),function(){let e=t(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",eo)}()}),process.on("exit",function(){ee.close(P)}),v(eo);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.26.13-beta.
|
|
3
|
+
"version": "3.26.13-beta.2",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@fastify/http-proxy": "9.5.0",
|
|
21
21
|
"@fastify/middie": "8.3.3",
|
|
22
22
|
"@moneko/mdx": "0.1.42",
|
|
23
|
-
"@moneko/stylelint": "1.0.0-beta.
|
|
23
|
+
"@moneko/stylelint": "1.0.0-beta.5",
|
|
24
24
|
"@moneko/transform-imports": "0.6.1",
|
|
25
25
|
"@moneko/utils": "0.1.19",
|
|
26
26
|
"@swc/cli": "0.5.2",
|