@moneko/core 3.15.12 → 3.15.13

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.
@@ -1,3 +1,3 @@
1
- import e from"chalk";import{getIPv4 as o,getPort as t}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import i from"../utils/log.mjs";let{yellow:n,green:s,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=e,d=r.devServer.port||3e3;export const PORT=await t(d,r.devServer.host);r.devServer.port=PORT;let u="/"===r.basename?"":r.basename,v=d!==PORT&&m(`Port ${n(d)} is in use, trying ${s(PORT)} instead.
2
- `);function f(e){return`http://${"local"===e?r.devServer.host:o()}:${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,o){!e&&o&&(i([T,"",g,"",l(`Compiled successfully in ${s(`${o.endTime-o.startTime}ms`)}`)]),v&&i(v))}export const headers={"Access-Control-Allow-Origin":"*"};
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 s from"express";import i from"multer";import l from"webpack";import r 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 d,headers as h}from"./dev/config.mjs";import u from"./dev/mock.mjs";import g from"./dev/proxy.mjs";import w from"./module.config.mjs";import x from"./paths.mjs";import{SSR as j,isLibrary as $,isReact as k}from"./process-env.mjs";import b from"./utils/has-pkg.mjs";import{empty as y,resolveProgram as P}from"./utils/index.mjs";import v from"./utils/progress.mjs";import _ from"./utils/sigint-exit.mjs";import S from"./options/reslove.mjs";import{watchFile as C,unwatchFile as B}from"fs";import{spawn as D,exec as M}from"child_process";let{HotModuleReplacementPlugin:G,ProgressPlugin:I,WatchIgnorePlugin:L}=l,U=b("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,A=b("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,F=k&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,H=["js","jsx","ts","tsx","json","html","vue"],O=H.join(","),R=["css","scss","sass","less","ts","tsx","js","jsx"],T=R.join(","),q=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],E=new URLSearchParams({timeout:2e3,reload:!(b("solid-refresh")||b("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),N=c.output.path;j&&(N=P(`${$?"docs":"dist"}/client`));let z=m(c,{entry:{main:[`${S.hotMiddlewareClient}?name=client&path=//localhost:${f}/__hmr__&${E}`]},output:{path:N},module:w(!1),plugins:[new G,new L({paths:[/\.d\.ts$/]}),F&&new F,A&&new A({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${O}}`,$&&`${p.alias["@pkg"]}/**/*.{${O}}`].filter(Boolean),extensions:H,exclude:q,cache:!0,cacheLocation:`${x.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),U&&new U({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${T}}`,$&&`${p.alias["@pkg"]}/**/*.{${T}}`].filter(Boolean),extensions:R,exclude:q,cache:!0,cacheLocation:`${x.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),p.bar&&new I({handler(e,o,...t){let s=p.bar;v(e,s.name||"Build",t.length?`[${o}] ${t.join(" ")}`:"",s.color)}})].filter(Boolean)}),J=[z];j&&J.push(m(c,a));let K=l(J);K.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let Q=s(),V=i(),W=r(K,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:j,lastModified:!0});if(Q.use(W),Q.use(n(K,{log:!1,path:"/__hmr__",heartbeat:2e3})),p.proxy&&g(Q,p.proxy),e(x.mockPath)){let e=u(x.mockPath);Q.use(e)}let X=`${z.output.path}/index.html`;Q.all("/*",V.any(),function(e,o,t){if("GET"!==e.method)return t();{let e=W.context.outputFileSystem,t=e?.readFileSync?.(X);o.end(t)}});let Y=Q.listen(f,()=>{});function Z(){console.log("listener"),M("win32"===process.platform?`netstat -ano | findstr :${f}`:`lsof -i :${f}`,(e,o,t)=>{let s=eo?o.split(/\s+/).pop():o.split("\n")[1]?.split(/\s+/)[1];s?process.kill(Number(s),"SIGHUP"):console.log(`未找到占用端口 ${f} 的进程`)})}function ee(){B(x.configPath,Z),B(x.customConfigPath,Z)}o(x.configPath)&&C(x.configPath,Z);let eo="win32"===process.platform;process.on("SIGHUP",function(){W.close(y),Y.close(y),Y.closeAllConnections(),ee(),function(){let e=D(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",()=>{process.exit(0)})}()}),process.on("exit",function(e){ee(),W.close(y),Y.close(y),Y.closeAllConnections(),t(x.cachePath),t(x.vfsDtsPath)}),_(()=>{process.exit(0)});
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{isEqual as A}from"@moneko/common";let{HotModuleReplacementPlugin:F,ProgressPlugin:H,WatchIgnorePlugin:O}=r,R=b("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,T=b("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,q=y&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,E=["js","jsx","ts","tsx","json","html","vue"],N=E.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 F,new O({paths:[/\.d\.ts$/]}),q&&new q,T&&new T({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${N}}`,k&&`${p.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:E,exclude:K,cache:!0,cacheLocation:`${j.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),R&&new R({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 H({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(){A(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.12",
3
+ "version": "3.15.13",
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",