@moneko/core 3.15.12 → 3.15.14
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/dev/config.mjs +3 -3
- package/lib/dev.mjs +1 -1
- package/package.json +2 -1
package/lib/dev/config.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import e from"chalk";import{getIPv4 as
|
|
2
|
-
`);function f(e){return`http://${"local"===e?r.devServer.host:
|
|
3
|
-
${c(" Network ")} ${$(f("net"))}`;export function devLog(e,
|
|
1
|
+
import e from"chalk";import{getIPv4 as t,getPort as o}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import s from"../utils/log.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=e,d=r.devServer.port||3e3;export const PORT=await o(d,r.devServer.host);r.devServer.port=PORT;let u="/"===r.basename?"":r.basename,v=d!==PORT&&m(`Port ${i(d)} is in use, trying ${n(PORT)} instead.
|
|
2
|
+
`);function f(e){return`http://${"local"===e?r.devServer.host:t()}:${PORT}${u}`}let T=m("You application is running here:"),g=`${a(" Local ")} ${p(f("local"))}
|
|
3
|
+
${c(" Network ")} ${$(f("net"))}`;export function devLog(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([T,"",g,"",l(`Compiled successfully in ${n(`${t.endTime-t.startTime}ms`)}`)]),v&&s(v))}export const headers={"Access-Control-Allow-Origin":"*"};
|
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{directoryExists as e,fileExists as o,removeDirAll as t}from"@moneko/mdx";import
|
|
1
|
+
import{directoryExists as e,fileExists as o,removeDirAll as t}from"@moneko/mdx";import i from"express";import s from"multer";import r from"webpack";import l from"webpack-dev-middleware";import n from"webpack-hot-middleware";import{merge as m}from"webpack-merge";import a from"./build/server.mjs";import{commonConfig as c}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{PORT as f,devLog as u,headers as d}from"./dev/config.mjs";import h from"./dev/mock.mjs";import w from"./dev/proxy.mjs";import g from"./module.config.mjs";import j,{CUSTOMCONFIG as x}from"./paths.mjs";import{SSR as $,isLibrary as k,isReact as y}from"./process-env.mjs";import b from"./utils/has-pkg.mjs";import{empty as v,isFunction as P,resolveProgram as _}from"./utils/index.mjs";import S from"./utils/progress.mjs";import C from"./utils/sigint-exit.mjs";import B from"./options/reslove.mjs";import{watchFile as D}from"fs";import{spawn as M,exec as G}from"child_process";import I from"./utils/log.mjs";import L from"chalk";import U from"./utils/read-conf.mjs";import q from"@moneko/common/lib/isEqual";let{HotModuleReplacementPlugin:A,ProgressPlugin:E,WatchIgnorePlugin:F}=r,H=b("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,O=b("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,R=y&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,T=["js","jsx","ts","tsx","json","html","vue"],N=T.join(","),z=["css","scss","sass","less","ts","tsx","js","jsx"],J=z.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Q=new URLSearchParams({timeout:2e3,reload:!(b("solid-refresh")||b("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),V=c.output.path;$&&(V=_(`${k?"docs":"dist"}/client`));let W=m(c,{entry:{main:[`${B.hotMiddlewareClient}?name=client&path=//localhost:${f}/__hmr__&${Q}`]},output:{path:V},module:g(!1),plugins:[new A,new F({paths:[/\.d\.ts$/]}),R&&new R,O&&new O({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${N}}`,k&&`${p.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:T,exclude:K,cache:!0,cacheLocation:`${j.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),H&&new H({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${J}}`,k&&`${p.alias["@pkg"]}/**/*.{${J}}`].filter(Boolean),extensions:z,exclude:K,cache:!0,cacheLocation:`${j.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),p.bar&&new E({handler(e,o,...t){let i=p.bar;S(e,i.name||"Build",t.length?`[${o}] ${t.join(" ")}`:"",i.color)}})].filter(Boolean)}),X=[W];$&&X.push(m(c,a));let Y=r(X);Y.compilers[0].hooks.done.tap("client-log",e=>{u(null,e)});let Z=i(),ee=s(),eo=l(Y,{writeToDisk:!1,index:"index.html",headers:()=>d,serverSideRender:$,lastModified:!0});if(Z.use(eo),Z.use(n(Y,{log:!1,path:"/__hmr__",heartbeat:2e3})),p.proxy&&w(Z,p.proxy),e(j.mockPath)){let e=h(j.mockPath);Z.use(e)}let et=`${W.output.path}/index.html`;Z.all("/*",ee.any(),function(e,o,t){if("GET"!==e.method)return t();{let e=eo.context.outputFileSystem,t=e?.readFileSync?.(et);o.end(t)}});let ei=Z.listen(f,()=>{});function es(){process.exit(0)}async function er(e,t){if(o(e)){let o=(await U(e,t)).default;return P(o)?o(process):o}}function el(e,t){if(t&&o(e)){let o=er(e,t);D(e,async function(){q(o,er(e,t))?I(L.gray(`未变更`)):(I(L.yellow(`检测到工程配置${L.blue(`[${t}]`)}变更, 程序即将重启...`)),G("win32"===process.platform?`netstat -ano | findstr :${f}`:`lsof -i :${f}`,(e,o,t)=>{let i=en?o.split(/\s+/).pop():o.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):I(`未找到占用端口 ${f} 的进程`)}))})}}el(j.configPath,"index"),el(j.customConfigPath,x);let en="win32"===process.platform;process.on("SIGHUP",function(){eo.close(v),ei.close(v),ei.closeAllConnections(),function(){let e=M(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",es)}()}),process.on("exit",function(){eo.close(v),ei.close(v),ei.closeAllConnections(),t(j.cachePath),t(j.vfsDtsPath)}),C(es);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.14",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@babel/core": "7.24.5",
|
|
15
|
+
"@moneko/common": "1.3.2",
|
|
15
16
|
"@moneko/mdx": "0.1.26",
|
|
16
17
|
"@moneko/transform-imports": "0.5.1",
|
|
17
18
|
"@swc/core": "1.5.7",
|