@moneko/core 3.17.33 → 3.17.35
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/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev/config.d.mts +0 -1
- package/lib/dev/config.mjs +3 -3
- package/lib/dev.mjs +1 -1
- package/package.json +3 -1
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import a from"./plugin/override-resolve.mjs";import n from"./plugins.config.mjs";import{PACKAGENAME as i,PACKAGEVERSION as r,isDev as l,isLibrary as p}from"./process-env.mjs";import{isObject as m,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{join as h,resolve as d,extname as f}from"path";import{exampleModuleName as g}from"./vm/example.mjs";export const outputConfig={path:u(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${l?"name":"contenthash"}].js`,assetModuleFilename:e=>{let t=f(e.filename||"").substring(1);return`assets/${t?`${t}/`:""}[name]${"js"===t?"":"[hash]"}[ext]`},library:{name
|
|
1
|
+
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import a from"./plugin/override-resolve.mjs";import n from"./plugins.config.mjs";import{PACKAGENAME as i,PACKAGEVERSION as r,isDev as l,isLibrary as p}from"./process-env.mjs";import{isObject as m,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{join as h,resolve as d,extname as f}from"path";import{exampleModuleName as g}from"./vm/example.mjs";export const outputConfig={path:u(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${l?"name":"contenthash"}].js`,assetModuleFilename:e=>{let t=f(e.filename||"").substring(1);return`assets/${t?`${t}/`:""}[name]${"js"===t?"":"[hash]"}[ext]`},library:{name:`${i}`,type:"umd"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:l,clean:!0,publicPath:t,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],hotUpdateChunkFilename:"[id].[fullhash].hot.js",hotUpdateMainFilename:"[runtime].[fullhash].hot.json"};let y={main:[e.polyfill&&h(o.corePath,"./polyfills/replace-children.mjs"),c("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?y={main:[e.entry]}:Object.keys(e.entry)&&(y=Object.assign(y,e.entry))),"string"==typeof y.main&&(y.main=[y.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let b=!1;m(e.cache)&&(b=Object.assign({type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:o.webpackCachePath,memoryCacheUnaffected:!0,idleTimeoutForInitialStore:0,cacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:r,profile:!0},e.cache));let j=Object.assign({original:e.alias["@"],override:s&&u(s)},e.overrideResolve);export const commonConfig={name:"client",target:"web",devtool:e.devtool,entry:y,mode:l?"development":"production",stats:"errors-only",cache:b,infrastructureLogging:{level:"error"},performance:{maxAssetSize:307200,maxEntrypointSize:512e3,assetFilter:e=>e.endsWith(".js")},externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:l&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(c(g))||t.startsWith(c("@app/comment"))||t.startsWith(o.pagesPath)||t.startsWith(o.componentsPath)))}},buildHttp:m(e.buildHttp)?{allowedUris:[],lockfileLocation:d(o.httpCachePath,"http.lock"),cacheLocation:d(o.httpCachePath,"data"),upgrade:!0,...e.buildHttp}:e.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[o.nodeModules,o.pnpmNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new a(j),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},externals:e.externals,output:outputConfig};
|
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,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as n,FRAMEWORK as r,NODE_ENV as a,PACKAGENAME as l,isDev as m,isLibrary as p,isMobile as c,jsxImportSource as u,mainDirectory as d}from"./process-env.mjs";import{isFunction as f,resolveProgram as h}from"./utils/index.mjs";import g from"./utils/read-conf.mjs";import x from"./utils/setup-env.mjs";import{fileExists as v}from"@moneko/utils";let P=["@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"],w={devtool:m?"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:x(a,n,r),basename:"/",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,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as n,FRAMEWORK as r,NODE_ENV as a,PACKAGENAME as l,isDev as m,isLibrary as p,isMobile as c,jsxImportSource as u,mainDirectory as d}from"./process-env.mjs";import{isFunction as f,resolveProgram as h}from"./utils/index.mjs";import g from"./utils/read-conf.mjs";import x from"./utils/setup-env.mjs";import{fileExists as v}from"@moneko/utils";let P=["@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"],w={devtool:m?"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:x(a,n,r),basename:"/",publicPath:"auto",rem:{designSize:c?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":h(d)},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:P,js:P,media:P,font:P,wasm:[]},mdx:{jsx:!1,development:m,jsxImportSource:u,providerImportSource:`@moneko/${r}/mdx`},jsxDomExpressions:o,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"]};async function j(e,o){if(o&&v(e)){let t=(await g(e,o)).default;return f(t)?t(process):t}return{}}p&&(w.alias=Object.assign(w.alias,{"@pkg":s.componentsPath,[l]:s.componentsPath}));let k=w;(!1===(k=e(k,await j(s.configPath,"index"),await j(s.customConfigPath,i))).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||"auto";
|
package/lib/dev/config.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ 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
4
|
export declare const headers: {
|
|
5
|
-
'X-Content-Type-Options': string;
|
|
6
5
|
'Access-Control-Allow-Origin': string;
|
|
7
6
|
'Access-Control-Allow-Headers': string;
|
|
8
7
|
};
|
package/lib/dev/config.mjs
CHANGED
|
@@ -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 s from"../utils/log.mjs";let{yellow:
|
|
2
|
-
`);function
|
|
3
|
-
${a(" Network ")} ${d(
|
|
1
|
+
import e from"chalk";import{getIPv4 as o,getPort as t}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import s from"../utils/log.mjs";let{yellow:i,green:n,grey:l,gray:c,bgBlue:m,bgGreenBright:a,blueBright:p,greenBright:d}=e,$=r.devServer.port||3e3;export const PORT=await t($,r.devServer.host);r.devServer.port=PORT;let u="/"===r.basename?"":r.basename,v=$!==PORT&&c(`Port ${i($)} is in use, trying ${n(PORT)} instead.
|
|
2
|
+
`);function f(e){return`http://${"local"===e?r.devServer.host:o()}:${PORT}${u}`}let T=c("You application is running here:"),g=`${m(" Local ")} ${p(f("local"))}
|
|
3
|
+
${a(" Network ")} ${d(f("net"))}`;export function devLog(e,o){!e&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([T,"",g,"",l(`Compiled successfully in ${n(`${o.endTime-o.startTime}ms`)}`)]),v&&s(v))}export const headers={"Access-Control-Allow-Origin":"*","Access-Control-Allow-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 r}from"webpack-merge";import l 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 v from"./utils/progress.mjs";import P from"./utils/sigint-exit.mjs";import S from"./options/reslove.mjs";import{watchFile as C}from"fs";import{spawn as _,exec as B}from"child_process";import M from"./utils/log.mjs";import A from"chalk";import{directoryExists as D,loadFileSync as G,removeDir as I}from"@moneko/utils";let{HotModuleReplacementPlugin:
|
|
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 r}from"webpack-merge";import l 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 v from"./utils/progress.mjs";import P from"./utils/sigint-exit.mjs";import S from"./options/reslove.mjs";import{watchFile as C}from"fs";import{spawn as _,exec as B}from"child_process";import M from"./utils/log.mjs";import A from"chalk";import{directoryExists as D,loadFileSync as G,removeDir as I}from"@moneko/utils";import L from"cors";let{HotModuleReplacementPlugin:U,ProgressPlugin:F,WatchIgnorePlugin:H}=o,O=k("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,R=k("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,T=$&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,W=["js","jsx","ts","tsx","json","html","vue"],q=W.join(","),E=["css","scss","sass","less","ts","tsx","js","jsx"],N=E.join(","),z=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=k("solid-refresh")||k("react-refresh"),K=`${a.endsWith("/")?"":"/"}__hmr__`,Q=new URLSearchParams({name:"client",path:K,dynamicPublicPath:!0,timeout:2e3,reload:!J,quiet:!0,noInfo:!0,overlay:!0}).toString(),V=n.output.path;x&&(V=b(`${j?"docs":"dist"}/client`));let X=!!m.bar,Y=r(n,{entry:{main:[`${S.hotMiddlewareClient}?${Q}`]},output:{path:V},module:h(!1),plugins:[new U,new H({paths:[/\.d\.ts$/]}),T&&new T,R&&new R({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${q}}`,j&&`${m.alias["@pkg"]}/**/*.{${q}}`].filter(Boolean),extensions:W,exclude:z,cache:!0,cacheLocation:`${g.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),O&&new O({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${N}}`,j&&`${m.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:E,exclude:z,cache:!0,cacheLocation:`${g.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new F({handler(e,t,...o){let i=m.bar||{};v({showBar:X,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:Y.output?.path})}})].filter(Boolean)}),Z=[Y];x&&Z.push(r(n,l));let ee=o(Z);ee.compilers[0].hooks.done.tap("client-log",e=>{p(null,e)});let et=e(),eo=t(),ei=i(ee,{writeToDisk:!1,index:"index.html",headers:u,serverSideRender:x,lastModified:!0}),es=s(ee,{log:!1,path:K,heartbeat:2e3});if(et.use(ei),et.use(es),et.use(e.static(Y.output.path)),et.use(L({origin:"*"})),m.proxy&&d(et,m.proxy),D(g.mockPath)){let e=f(g.mockPath);et.use(e)}let er=`${Y.output.path}/index.html`;et.all("/*",eo.any(),function(e,t,o){if("GET"!==e.method)return o();{let i=e.get("Accept");if(i?.includes("text/html")){let e=ei.context.outputFileSystem,o=e?.readFileSync?.(er);t.end(o)}else if("text/event-stream"===i&&e.url.endsWith(K))return e.url=K,es(e,t,o);else return o()}});let el=et.listen(c,()=>{});function en(){process.exit(0)}function em(e,t){let o=G(e);t&&null!==o&&C(e,async function(){let i=G(e);o.trim().replace(/^\s*[\r\n]/gm,"")!==i?.trim().replace(/^\s*[\r\n]/gm,"")?(M(A.yellow(`检测到工程配置${A.blue(`[${t}]`)}变更, 程序即将重启...`)),B("win32"===process.platform?`netstat -ano | findstr :${c}`:`lsof -i :${c}`,(e,t,o)=>{let i=ea?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):M(`未找到占用端口 ${c} 的进程`)})):M(A.gray(`未变更`))})}em(g.configPath,"index"),em(g.customConfigPath,w);let ea="win32"===process.platform;process.on("SIGHUP",function(){ei.close(y),el.close(y),el.closeAllConnections(),function(){let e=_(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",en)}()}),process.on("exit",function(){ei.close(y),el.close(y),el.closeAllConnections(),I(g.cachePath)}),P(en);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.35",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,7 @@
|
|
|
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",
|
|
25
26
|
"css-loader": "7.1.2",
|
|
26
27
|
"dotenv": "16.4.5",
|
|
27
28
|
"express": "4.19.2",
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
"@moneko/css": "1.1.5",
|
|
51
52
|
"@swc/cli": "0.3.12",
|
|
52
53
|
"@types/babel__core": "7.20.5",
|
|
54
|
+
"@types/cors": "2.8.17",
|
|
53
55
|
"@types/express": "4.17.21",
|
|
54
56
|
"@types/multer": "1.4.11",
|
|
55
57
|
"@types/webpack-bundle-analyzer": "4.7.0",
|