@moneko/core 3.17.5 → 3.17.6

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/build.mjs CHANGED
@@ -1 +1 @@
1
- import{removeDirAll as o}from"@moneko/mdx";import r from"webpack";import{merge as t}from"webpack-merge";import m from"./build/common.mjs";import e from"./build/server.mjs";import{CONFIG as i}from"./config.mjs";import s from"./module.config.mjs";import n from"./paths.mjs";import l from"./plugin/done.mjs";import{SSR as a}from"./process-env.mjs";import p from"./utils/log.mjs";import f from"./utils/seo.mjs";import c from"./utils/progress.mjs";import g from"chalk";let{ProgressPlugin:u}=r,h=!!i.bar,d=t(m,{module:s(!1),plugins:[i.done&&new l({done:i.done}),new u({handler(o,r,...t){let m=i.bar||{};c({showBar:h,percentage:o,title:m.name||"Build",color:m.color,info:t.length?`[${r}] ${t.join(" ")}`:"",output:d.output?.path})}})].filter(Boolean)}),j=[d];a&&j.push(t(m,e));let w=r(j);async function b(){await new Promise(o=>{w.run((r,t)=>{if(r)throw r;if(t&&(t.hasErrors()||t.hasWarnings()))for(let o=0,r=t.stats.length;o<r;o++){let r=t.stats[o];for(let o=0,t=r.compilation.warnings.length;o<t;o++)p(g.yellowBright(r.compilation.warnings[o].message));for(let o=0,t=r.compilation.errors.length;o<t;o++)p(g.redBright(r.compilation.errors[o].message))}o(r)})}),i.seo&&f()}await b(),process.on("exit",function(){o(n.cachePath),o(n.vfsDtsPath)});
1
+ import{removeDirAll as o}from"@moneko/mdx";import r from"webpack";import{merge as t}from"webpack-merge";import m from"./build/common.mjs";import e from"./build/server.mjs";import{CONFIG as i}from"./config.mjs";import s from"./module.config.mjs";import n from"./paths.mjs";import l from"./plugin/done.mjs";import{SSR as a}from"./process-env.mjs";import p from"./utils/log.mjs";import f from"./utils/seo.mjs";import c from"./utils/progress.mjs";import g from"chalk";let{ProgressPlugin:u}=r,h=!!i.bar,d=t(m,{module:s(!1),plugins:[i.done&&new l({done:i.done}),new u({handler(o,r,...t){let m=i.bar||{};c({showBar:h,percentage:o,title:m.name||"Build",color:m.color,info:t.length?`[${r}] ${t.join(" ")}`:"",output:d.output?.path})}})].filter(Boolean)}),j=[d];a&&j.push(t(m,e));let w=r(j);async function b(){await new Promise(o=>{w.run((r,t)=>{if(r)throw r;if(t&&(t.hasErrors()||t.hasWarnings()))for(let o=0,r=t.stats.length;o<r;o++){let r=t.stats[o];for(let o=0,t=r.compilation.warnings.length;o<t;o++)p(g.yellowBright(r.compilation.warnings[o].message));for(let o=0,t=r.compilation.errors.length;o<t;o++)p(g.redBright(r.compilation.errors[o].message))}o(r)})}),i.seo&&f()}await b(),process.on("exit",function(){o(n.cachePath)});
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 r from"./plugin/override-resolve.mjs";import n from"./plugins.config.mjs";import{PACKAGENAME as i,PACKAGEVERSION as l,isDev as a,isLibrary as p}from"./process-env.mjs";import m from"./rule.mjs";import{node_modules as u,resolveProgram as c}from"./utils/index.mjs";import{join as f}from"path";export const outputConfig={path:c(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${a?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t?.endsWith("?url")&&m.worker_file.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:a,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let d={main:[e.polyfill&&f(o.corePath,"./polyfills/replace-children.mjs"),u("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?d={main:[e.entry]}:Object.keys(e.entry)&&(d=Object.assign(d,e.entry))),"string"==typeof d.main&&(d.main=[d.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let y=!1;e.cacheDirectory&&(y={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:l});let g=Object.assign({original:e.alias["@"],override:s&&c(s)},e.overrideResolve);export const commonConfig={devtool:e.devtool,entry:d,mode:a?"development":"production",stats:"errors-only",cache:y,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:a&&{imports:!1,entries:!1},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,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 r(g),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},externals:e.externals,output:outputConfig};
1
+ import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import r from"./plugin/override-resolve.mjs";import n from"./plugins.config.mjs";import{PACKAGENAME as a,PACKAGEVERSION as i,isDev as l,isLibrary as m}from"./process-env.mjs";import p from"./rule.mjs";import{node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{join as f}from"path";import{exampleModuleName as d}from"./vm/example.mjs";export const outputConfig={path:u(m?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${l?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t?.endsWith("?url")&&p.worker_file.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:a,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${a}`,pathinfo:l,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let h={main:[e.polyfill&&f(o.corePath,"./polyfills/replace-children.mjs"),c("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?h={main:[e.entry]}:Object.keys(e.entry)&&(h=Object.assign(h,e.entry))),"string"==typeof h.main&&(h.main=[h.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let y=!1;e.cacheDirectory&&(y={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:i});let g=Object.assign({original:e.alias["@"],override:s&&u(s)},e.overrideResolve);export const commonConfig={devtool:e.devtool,entry:h,mode:l?"development":"production",stats:"errors-only",cache:y,infrastructureLogging:{level:"error"},target:"web",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(d))||t.startsWith(c("@app/comment"))||t.startsWith(o.pagesPath)||t.startsWith(o.componentsPath)))}},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,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 r(g),...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{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as n,NODE_ENV as l,PACKAGENAME as p,isDev as m,isLibrary as c,isMobile as u,jsxImportSource as d,mainDirectory as h}from"./process-env.mjs";import{isFunction as f,resolveProgram as g}from"./utils/index.mjs";import x from"./utils/read-conf.mjs";import P from"./utils/setup-env.mjs";let v=["@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:P(l,r,n),basename:"/",publicPath:"/",rem:{designSize:u?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(h)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:v,js:v,media:v,font:v,wasm:[]},mdx:{jsx:!1,development:m,jsxImportSource:d,providerImportSource:`@moneko/${n}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};async function k(o,t){if(t&&e(o)){let e=(await x(o,t)).default;return f(e)?e(process):e}return{}}c&&(w.alias=Object.assign(w.alias,{"@pkg":a.componentsPath,[p]:a.componentsPath}));let j=w;(!1===(j=o(j,await k(a.configPath,"index"),await k(a.customConfigPath,i))).devtool||!1===j.sourceMap)&&(j.sourceMap=!1,j.devtool=!1),j.fixBrowserRouter&&j.htmlPluginOption&&(j.htmlPluginOption.tags||(j.htmlPluginOption.tags=[]),j.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=j;export const PUBLICPATH=CONFIG.publicPath||"/";
1
+ import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import{resolve as t}from"path";import a from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import i,{CUSTOMCONFIG as r}from"./paths.mjs";import{APPTYPE as n,FRAMEWORK as l,NODE_ENV as p,PACKAGENAME as m,isDev as c,isLibrary as u,isMobile as d,jsxImportSource as h,mainDirectory as f}from"./process-env.mjs";import{isFunction as g,resolveProgram as x}from"./utils/index.mjs";import P from"./utils/read-conf.mjs";import v from"./utils/setup-env.mjs";let w=["@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"],k={devtool:c?"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:v(p,n,l),basename:"/",publicPath:"/",rem:{designSize:d?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":x(f)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},cacheDirectory:i.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:w,js:w,media:w,font:w,wasm:[]},mdx:{jsx:!1,development:c,jsxImportSource:h,providerImportSource:`@moneko/${l}/mdx`},jsxDomExpressions:a,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:t(i.httpCachePath,"http.lock"),cacheLocation:t(i.httpCachePath,"data"),upgrade:!0},virtualModule:{},cssExtract:{}};async function j(o,t){if(t&&e(o)){let e=(await P(o,t)).default;return g(e)?e(process):e}return{}}u&&(k.alias=Object.assign(k.alias,{"@pkg":i.componentsPath,[m]:i.componentsPath}));let C=k;(!1===(C=o(C,await j(i.configPath,"index"),await j(i.customConfigPath,r))).devtool||!1===C.sourceMap)&&(C.sourceMap=!1,C.devtool=!1),C.fixBrowserRouter&&C.htmlPluginOption&&(C.htmlPluginOption.tags||(C.htmlPluginOption.tags=[]),C.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=C;export const PUBLICPATH=CONFIG.publicPath||"/";
@@ -2,5 +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;
5
6
  'Access-Control-Allow-Origin': string;
6
7
  };
@@ -1,3 +1,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: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":"*"};
1
+ import e from"chalk";import{getIPv4 as t,getPort as o}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import n from"../utils/log.mjs";let{yellow:s,green:i,grey:l,gray:m,bgBlue:p,bgGreenBright:a,blueBright:c,greenBright:$}=e,d=r.devServer.port||3e3;export const PORT=await o(d,r.devServer.host);r.devServer.port=PORT;let f="/"===r.basename?"":r.basename,u=d!==PORT&&m(`Port ${s(d)} is in use, trying ${i(PORT)} instead.
2
+ `);function v(e){return`http://${"local"===e?r.devServer.host:t()}:${PORT}${f}`}let T=m("You application is running here:"),O=`${p(" Local ")} ${c(v("local"))}
3
+ ${a(" Network ")} ${$(v("net"))}`;export function devLog(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),n([T,"",O,"",l(`Compiled successfully in ${i(`${t.endTime-t.startTime}ms`)}`)]),u&&n(u))}export const headers={"X-Content-Type-Options":"nosniff","Access-Control-Allow-Origin":"*"};
package/lib/dev.mjs CHANGED
@@ -1 +1 @@
1
- import{directoryExists as e,fileExists as t,loadFileSync as o,removeDirAll as i}from"@moneko/mdx";import s from"express";import r from"multer";import l from"webpack";import n from"webpack-dev-middleware";import m from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import c from"./build/server.mjs";import{commonConfig as p}from"./common.mjs";import{CONFIG as f}from"./config.mjs";import{PORT as u,devLog as d,headers as h}from"./dev/config.mjs";import g from"./dev/mock.mjs";import w from"./dev/proxy.mjs";import x from"./module.config.mjs";import j,{CUSTOMCONFIG as $}from"./paths.mjs";import{SSR as k,isLibrary as y,isReact as b}from"./process-env.mjs";import v from"./utils/has-pkg.mjs";import{empty 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";let{HotModuleReplacementPlugin:U,ProgressPlugin:A,WatchIgnorePlugin:F}=l,H=v("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,O=v("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,R=b&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,T=["js","jsx","ts","tsx","json","html","vue"],q=T.join(","),E=["css","scss","sass","less","ts","tsx","js","jsx"],N=E.join(","),z=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=new URLSearchParams({timeout:2e3,reload:!(v("solid-refresh")||v("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),K=p.output.path;k&&(K=_(`${y?"docs":"dist"}/client`));let Q=!!f.bar,V=a(p,{entry:{main:[`${B.hotMiddlewareClient}?name=client&path=//localhost:${u}/__hmr__&${J}`]},output:{path:K},module:x(!1),plugins:[new U,new F({paths:[/\.d\.ts$/]}),R&&new R,O&&new O({fix:!0,threads:!0,files:[`${f.alias["@"]}/**/*.{${q}}`,y&&`${f.alias["@pkg"]}/**/*.{${q}}`].filter(Boolean),extensions:T,exclude:z,cache:!0,cacheLocation:`${j.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),H&&new H({fix:!0,threads:!0,files:[`${f.alias["@"]}/**/*.{${N}}`,y&&`${f.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:E,exclude:z,cache:!0,cacheLocation:`${j.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new A({handler(e,t,...o){let i=f.bar||{};S({showBar:Q,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:V.output?.path})}})].filter(Boolean)}),W=[V];k&&W.push(a(p,c));let X=l(W);X.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let Y=s(),Z=r(),ee=n(X,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:k,lastModified:!0});if(Y.use(ee),Y.use(m(X,{log:!1,path:"/__hmr__",heartbeat:2e3})),f.proxy&&w(Y,f.proxy),e(j.mockPath)){let e=g(j.mockPath);Y.use(e)}let et=`${V.output.path}/index.html`;Y.all("/*",Z.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=ee.context.outputFileSystem,o=e?.readFileSync?.(et);t.end(o)}});let eo=Y.listen(u,()=>{});function ei(){process.exit(0)}function es(e,i){if(i&&t(e)){let t=(o(e)||"").trim().replace(/^\s*[\r\n]/gm,"");D(e,async function(){t!==(o(e)||"").trim().replace(/^\s*[\r\n]/gm,"")?(I(L.yellow(`检测到工程配置${L.blue(`[${i}]`)}变更, 程序即将重启...`)),G("win32"===process.platform?`netstat -ano | findstr :${u}`:`lsof -i :${u}`,(e,t,o)=>{let i=er?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):I(`未找到占用端口 ${u} 的进程`)})):I(L.gray(`未变更`))})}}es(j.configPath,"index"),es(j.customConfigPath,$);let er="win32"===process.platform;process.on("SIGHUP",function(){ee.close(P),eo.close(P),eo.closeAllConnections(),function(){let e=M(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",ei)}()}),process.on("exit",function(){ee.close(P),eo.close(P),eo.closeAllConnections(),i(j.cachePath),i(j.vfsDtsPath)}),C(ei);
1
+ import{directoryExists as e,fileExists as t,loadFileSync as o,removeDirAll as i}from"@moneko/mdx";import s from"express";import r from"multer";import l from"webpack";import n from"webpack-dev-middleware";import m from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import c from"./build/server.mjs";import{commonConfig as p}from"./common.mjs";import{CONFIG as f}from"./config.mjs";import{PORT as u,devLog as d,headers as h}from"./dev/config.mjs";import g from"./dev/mock.mjs";import w from"./dev/proxy.mjs";import x from"./module.config.mjs";import j,{CUSTOMCONFIG as $}from"./paths.mjs";import{SSR as k,isLibrary as y,isReact as b}from"./process-env.mjs";import v from"./utils/has-pkg.mjs";import{empty 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 M}from"fs";import{spawn as D,exec as G}from"child_process";import I from"./utils/log.mjs";import L from"chalk";let{HotModuleReplacementPlugin:U,ProgressPlugin:A,WatchIgnorePlugin:F}=l,H=v("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,O=v("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,R=b&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,T=["js","jsx","ts","tsx","json","html","vue"],q=T.join(","),E=["css","scss","sass","less","ts","tsx","js","jsx"],N=E.join(","),z=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=new URLSearchParams({timeout:2e3,reload:!(v("solid-refresh")||v("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),K=p.output.path;k&&(K=_(`${y?"docs":"dist"}/client`));let Q=!!f.bar,V=a(p,{entry:{main:[`${B.hotMiddlewareClient}?name=client&path=//localhost:${u}/__hmr__&${J}`]},output:{path:K},module:x(!1),plugins:[new U,new F({paths:[/\.d\.ts$/]}),R&&new R,O&&new O({fix:!0,threads:!0,files:[`${f.alias["@"]}/**/*.{${q}}`,y&&`${f.alias["@pkg"]}/**/*.{${q}}`].filter(Boolean),extensions:T,exclude:z,cache:!0,cacheLocation:`${j.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),H&&new H({fix:!0,threads:!0,files:[`${f.alias["@"]}/**/*.{${N}}`,y&&`${f.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:E,exclude:z,cache:!0,cacheLocation:`${j.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new A({handler(e,t,...o){let i=f.bar||{};S({showBar:Q,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:V.output?.path})}})].filter(Boolean)}),W=[V];k&&W.push(a(p,c));let X=l(W);X.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let Y=s(),Z=r(),ee=n(X,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:k,lastModified:!0});if(Y.use(ee),Y.use(m(X,{log:!1,path:"/__hmr__",heartbeat:2e3})),f.proxy&&w(Y,f.proxy),e(j.mockPath)){let e=g(j.mockPath);Y.use(e)}let et=`${V.output.path}/index.html`;Y.all("/*",Z.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=ee.context.outputFileSystem,o=e?.readFileSync?.(et);t.end(o)}});let eo=Y.listen(u,()=>{});function ei(){process.exit(0)}function es(e,i){if(i&&t(e)){let t=(o(e)||"").trim().replace(/^\s*[\r\n]/gm,"");M(e,async function(){t!==(o(e)||"").trim().replace(/^\s*[\r\n]/gm,"")?(I(L.yellow(`检测到工程配置${L.blue(`[${i}]`)}变更, 程序即将重启...`)),G("win32"===process.platform?`netstat -ano | findstr :${u}`:`lsof -i :${u}`,(e,t,o)=>{let i=er?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):I(`未找到占用端口 ${u} 的进程`)})):I(L.gray(`未变更`))})}}es(j.configPath,"index"),es(j.customConfigPath,$);let er="win32"===process.platform;process.on("SIGHUP",function(){ee.close(P),eo.close(P),eo.closeAllConnections(),function(){let e=D(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",ei)}()}),process.on("exit",function(){ee.close(P),eo.close(P),eo.closeAllConnections(),i(j.cachePath)}),C(ei);
@@ -1 +1 @@
1
- import{join as p}from"path";import{getAppEntry as t,getAppFallback as e,getAppMdxScope as o,getAppMergeRouter as r,getAppNormalizeCss as a,getAppPrefixRouter as m,getAppRem as s,getAppSuspense as i,saveFile as f}from"@moneko/mdx";import n from"./coverage.mjs";import{docs as l,docsModuleName as x}from"./docs.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as j}from"./locales.mjs";import{route as g,routesModuleName as u}from"./routes.mjs";import{CONFIG as v}from"../config.mjs";import y from"../paths.mjs";import{APPTYPE as h,FRAMEWORK as _}from"../process-env.mjs";import{node_modules as k}from"../utils/index.mjs";import{generateDeclaration as O}from"../utils/dts.mjs";import $ from"../utils/has-pkg.mjs";let b=$(p(v.alias["@"],"./mdx-scope.tsx"))||$(p(v.alias["@"],"./mdx-scope.ts")),z={app_env:k("@app/env.ts"),app_info:k("@app/info.ts"),app_entry:k("@app/entry.ts")},D={[z.app_env]:`export default ${JSON.stringify(v.env)}`,[z.app_info]:`export default ${JSON.stringify(c)}`,[z.app_entry]:t(p(v.alias["@"],"./index.ts"),!!v.rem,!!v.normalizeCss,h,_),[k("@app/rem")]:s(v.rem?.designSize||1680),[k("@app/fallback")]:e(v.fallbackCompPath),[k("@app/coverage")]:n(y.coveragePath),[k("@app/merge-router")]:r(),[k("@app/prefix-router")]:m(),[k("@app/normalize/index.css")]:a(),[k("@app/suspense/index.tsx")]:i(h,_),[k("@app/mdx-scope")]:b?o(b):"export default {}",[k(u)]:g.getData(u),[k(j)]:d.getData(j),[k(x)]:l.getData(x)},P=/\.tsx?/,S=/\.(j|t)sx?$/;for(let p in z)if(Object.prototype.hasOwnProperty.call(z,p)){let t=z[p];S.test(t)&&f(t.replace(P,".d$&"),O(D[t],t))}export default D;
1
+ import{join as p}from"path";import{getAppEntry as e,getAppFallback as t,getAppMdxScope as o,getAppMergeRouter as r,getAppNormalizeCss as a,getAppPrefixRouter as s,getAppRem as m,getAppSuspense as i,loadFile as f,saveFile as n}from"@moneko/mdx";import l from"./coverage.mjs";import{docs as c,docsModuleName as x}from"./docs.mjs";import d from"./info.mjs";import{locales as j,localesModuleName as g}from"./locales.mjs";import{route as u,routesModuleName as _}from"./routes.mjs";import{CONFIG as h}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as y,FRAMEWORK as k}from"../process-env.mjs";import{node_modules as O}from"../utils/index.mjs";import{generateDeclaration as $}from"../utils/dts.mjs";import b from"../utils/has-pkg.mjs";let z=b(p(h.alias["@"],"./mdx-scope.tsx"))||b(p(h.alias["@"],"./mdx-scope.ts")),D={app_env:O("@app/env.ts"),app_info:O("@app/info.ts"),app_entry:O("@app/entry.ts"),app_mdx_scope:O("@app/mdx-scope.tsx")},P={[D.app_env]:`export default ${JSON.stringify(h.env)}`,[D.app_info]:`export default ${JSON.stringify(d)}`,[D.app_entry]:e(p(h.alias["@"],"./index.ts"),!!h.rem,!!h.normalizeCss,y,k),[O("@app/rem")]:m(h.rem?.designSize||1680),[O("@app/fallback")]:t(h.fallbackCompPath),[O("@app/coverage")]:l(v.coveragePath),[O("@app/merge-router")]:r(),[O("@app/prefix-router")]:s(),[O("@app/normalize/index.css")]:a(),[O("@app/suspense/index.tsx")]:i(y,k),[D.app_mdx_scope]:z?o(z):"export default {}",[O(_)]:u.getData(_),[O(g)]:j.getData(g),[O(x)]:c.getData(x)},S=/\.tsx?/,C=/\.(j|t)sx?$/;for(let p in D)if(Object.prototype.hasOwnProperty.call(D,p)){let e=D[p];if(C.test(e)){let p=e.replace(S,".d$&"),t=$(P[e],e);f(p).then(e=>{e!==t&&n(p,t)}).catch(p=>{console.error(p)})}}export default P;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.17.5",
3
+ "version": "3.17.6",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -21,7 +21,7 @@
21
21
  "chokidar": "3.6.0",
22
22
  "core-js": "3.37.1",
23
23
  "core-js-compat": "3.37.1",
24
- "css-loader": "7.1.1",
24
+ "css-loader": "7.1.2",
25
25
  "dotenv": "16.4.5",
26
26
  "enhanced-resolve": "5.16.1",
27
27
  "express": "4.19.2",