@moneko/core 3.17.38 → 3.17.40
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.d.mts +1 -4
- package/lib/dev/config.mjs +3 -3
- package/lib/dev.mjs +1 -1
- package/package.json +1 -3
package/lib/dev/config.d.mts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import webpack from 'webpack';
|
|
2
2
|
export declare const PORT: number;
|
|
3
3
|
export declare function devLog(err?: Error | null, stats?: webpack.Stats): void;
|
|
4
|
-
export declare const headers: {
|
|
5
|
-
'Access-Control-Allow-Origin': string;
|
|
6
|
-
'Access-Control-Allow-Headers': string;
|
|
7
|
-
};
|
|
4
|
+
export declare const headers: {};
|
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
|
-
${
|
|
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:m,gray:a,bgBlue:l,bgGreenBright:p,blueBright:c,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&&a(`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=a("You application is running here:"),h=`${l(" Local ")} ${c(f("local"))}
|
|
3
|
+
${p(" Network ")} ${$(f("net"))}`;export function devLog(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([T,"",h,"",m(`Compiled successfully in ${n(`${t.endTime-t.startTime}ms`)}`)]),v&&s(v))}export const headers={};
|
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"express";import t from"multer";import o from"webpack";import i from"webpack-dev-middleware";import s from"webpack-hot-middleware";import{merge as
|
|
1
|
+
import e from"express";import t from"multer";import o from"webpack";import i from"webpack-dev-middleware";import s from"webpack-hot-middleware";import{merge as l}from"webpack-merge";import r from"./build/server.mjs";import{commonConfig as n}from"./common.mjs";import{CONFIG as m,PUBLICPATH as a}from"./config.mjs";import{PORT as c,devLog as p,headers as u}from"./dev/config.mjs";import f from"./dev/mock.mjs";import d from"./dev/proxy.mjs";import h from"./module.config.mjs";import g,{CUSTOMCONFIG as w}from"./paths.mjs";import{SSR as x,isLibrary as j,isReact as $}from"./process-env.mjs";import k from"./utils/has-pkg.mjs";import{empty as y,resolveProgram as b}from"./utils/index.mjs";import P from"./utils/progress.mjs";import v from"./utils/sigint-exit.mjs";import A from"./options/reslove.mjs";import{watchFile as C}from"fs";import{spawn as T,exec as S}from"child_process";import M from"./utils/log.mjs";import O from"chalk";import{directoryExists as _,loadFileSync as D,removeDir as E}from"@moneko/utils";let{HotModuleReplacementPlugin:I,ProgressPlugin:U,WatchIgnorePlugin:B}=o,G=k("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,H=k("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,L=$&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,R=["js","jsx","ts","tsx","json","html","vue"],q=R.join(","),N=["css","scss","sass","less","ts","tsx","js","jsx"],W=N.join(","),F=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],X=k("solid-refresh")||k("react-refresh"),z=`${a.endsWith("/")?"":"/"}__hmr__`,K=new URLSearchParams({name:"client",path:z,dynamicPublicPath:!0,timeout:2e3,reload:!X,quiet:!0,noInfo:!0,overlay:!0}).toString(),J=n.output.path;x&&(J=b(`${j?"docs":"dist"}/client`));let Q=!!m.bar,V=l(n,{entry:{main:[`${A.hotMiddlewareClient}?${K}`]},output:{path:J},module:h(!1),plugins:[new I,new B({paths:[/\.d\.ts$/]}),L&&new L,H&&new H({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${q}}`,j&&`${m.alias["@pkg"]}/**/*.{${q}}`].filter(Boolean),extensions:R,exclude:F,cache:!0,cacheLocation:`${g.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),G&&new G({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${W}}`,j&&`${m.alias["@pkg"]}/**/*.{${W}}`].filter(Boolean),extensions:N,exclude:F,cache:!0,cacheLocation:`${g.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new U({handler(e,t,...o){let i=m.bar||{};P({showBar:Q,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:V.output?.path})}})].filter(Boolean)}),Y=[V];x&&Y.push(l(n,r));let Z=o(Y);Z.compilers[0].hooks.done.tap("client-log",e=>{p(null,e)});let ee=e(),et=t(),eo=i(Z,{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",...u}),serverSideRender:x,lastModified:!0}),ei=s(Z,{log:!1,path:z,heartbeat:2e3});if(ee.use(eo),ee.use(ei),ee.use(e.static(V.output.path)),m.proxy&&d(ee,m.proxy),_(g.mockPath)){let e=f(g.mockPath);ee.use(e)}let es=`${V.output.path}/index.html`;ee.all("/*",et.any(),function(e,t,o){if("GET"!==e.method)return o();{let i=e.get("Accept");if(i?.includes("text/html")){let e=eo.context.outputFileSystem,o=e?.readFileSync?.(es);t.end(o)}else if("text/event-stream"===i&&e.url.endsWith(z))return e.url=z,ei(e,t,o);else return o()}});let el=ee.listen(c,()=>{});function er(){process.exit(0)}function en(e,t){let o=D(e);t&&null!==o&&C(e,async function(){let i=D(e);o.trim().replace(/^\s*[\r\n]/gm,"")!==i?.trim().replace(/^\s*[\r\n]/gm,"")?(M(O.yellow(`检测到工程配置${O.blue(`[${t}]`)}变更, 程序即将重启...`)),S("win32"===process.platform?`netstat -ano | findstr :${c}`:`lsof -i :${c}`,(e,t,o)=>{let i=em?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):M(`未找到占用端口 ${c} 的进程`)})):M(O.gray(`未变更`))})}en(g.configPath,"index"),en(g.customConfigPath,w);let em="win32"===process.platform;process.on("SIGHUP",function(){eo.close(y),el.close(y),el.closeAllConnections(),function(){let e=T(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",er)}()}),process.on("exit",function(){eo.close(y),el.close(y),el.closeAllConnections(),E(g.cachePath)}),v(er);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.40",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"chokidar": "3.6.0",
|
|
23
23
|
"core-js": "3.37.1",
|
|
24
24
|
"core-js-compat": "3.37.1",
|
|
25
|
-
"cors": "2.8.5",
|
|
26
25
|
"css-loader": "7.1.2",
|
|
27
26
|
"dotenv": "16.4.5",
|
|
28
27
|
"express": "4.19.2",
|
|
@@ -51,7 +50,6 @@
|
|
|
51
50
|
"@moneko/css": "1.1.5",
|
|
52
51
|
"@swc/cli": "0.3.12",
|
|
53
52
|
"@types/babel__core": "7.20.5",
|
|
54
|
-
"@types/cors": "2.8.17",
|
|
55
53
|
"@types/express": "4.17.21",
|
|
56
54
|
"@types/multer": "1.4.11",
|
|
57
55
|
"@types/webpack-bundle-analyzer": "4.7.0",
|