@moneko/core 3.24.5 → 3.24.7

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 +1 @@
1
- import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as r}from"webpack-bundle-analyzer";import{merge as m}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as o}from"../config.mjs";import{getMinifyOption as s}from"../options/js-minify.mjs";import{LightningCssMinifyPlugin as l}from"../plugin/lightningcss-plugin.mjs";import{getLightningCssTargets as p}from"../polyfills/targets.mjs";let{optimize:{MinChunkSizePlugin:a}}=n,u=[];o.minifier&&(u.push(new i(s(o.minifier.type,o.minifier.options))),u.push(new l({targets:p()})));let c=m(t,{plugins:[new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",ignoreOrder:!0}),o.splitChunk&&new a({minChunkSize:1e4}),o.bundleAnalyzer&&new r({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...o.bundleAnalyzer})].filter(Boolean),optimization:{concatenateModules:!0,realContentHash:!0,sideEffects:!0,usedExports:!0,providedExports:!0,emitOnErrors:!0,flagIncludedChunks:!0,innerGraph:!1,mangleExports:"deterministic",splitChunks:o.splitChunk,runtimeChunk:o.runtimeChunk,chunkIds:"deterministic",moduleIds:"deterministic",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!1,minimize:!0,minimizer:u}});export default c;
1
+ import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as m}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as t}from"../common.mjs";import{CONFIG as o}from"../config.mjs";import{getMinifyOption as l}from"../options/js-minify.mjs";import{LightningCssMinifyPlugin as s}from"../plugin/lightningcss-plugin.mjs";import{getLightningCssTargets as p}from"../polyfills/targets.mjs";let{optimize:{MinChunkSizePlugin:u}}=n,a=[];o.minifier&&(a.push(new i(l(o.minifier.type,o.minifier.options))),a.push(new s({targets:p()})));let f=r(t,{plugins:[new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",ignoreOrder:!0}),o.splitChunk&&new u({minChunkSize:1e4}),o.bundleAnalyzer&&new m({analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1,defaultSizes:"gzip",logLevel:"silent",...o.bundleAnalyzer})].filter(Boolean),optimization:{splitChunks:o.splitChunk,runtimeChunk:o.runtimeChunk,chunkIds:"deterministic",moduleIds:"deterministic",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:a}});export default f;
package/lib/build.mjs CHANGED
@@ -1 +1 @@
1
- import o from"webpack";import{merge as r}from"webpack-merge";import t from"./build/common.mjs";import i from"./build/server.mjs";import{CONFIG as m}from"./config.mjs";import e from"./module.config.mjs";import s from"./plugin/done.mjs";import{SSR as n}from"./process-env.mjs";import l from"./utils/print.mjs";import p from"./utils/seo.mjs";import a from"./utils/progress.mjs";import f from"chalk";import{empty as u}from"./utils/index.mjs";let{ProgressPlugin:g}=o,c=!!m.bar,h=r(t,{module:e(!1),plugins:[m.done&&new s({done:m.done}),new g({handler(o,r,...t){let i=m.bar||{};a({showBar:c,percentage:o,title:i.name||"Build",color:i.color,info:t.length?`[${r}] ${t.join(" ")}`:"",output:h.output?.path})}})].filter(Boolean)}),d=[h];n&&d.push(r(t,i));let j=o(d);async function w(){await new Promise(o=>{j.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++)l(f.yellowBright(r.compilation.warnings[o].message));for(let o=0,t=r.compilation.errors.length;o<t;o++)l(f.redBright(r.compilation.errors[o].message))}o(r)})}),m.seo&&p()}await w(),process.on("exit",u);
1
+ import o from"webpack";import{merge as r}from"webpack-merge";import t from"./build/common.mjs";import i from"./build/server.mjs";import{CONFIG as m}from"./config.mjs";import e from"./module.config.mjs";import s from"./plugin/done.mjs";import{SSR as n}from"./process-env.mjs";import l from"./utils/print.mjs";import p from"./utils/seo.mjs";import a from"./utils/progress.mjs";import f from"chalk";import{empty as u}from"./utils/index.mjs";let{ProgressPlugin:g}=o,c=r(t,{module:e(!1),plugins:[m.done&&new s({done:m.done}),!!m.bar&&new g({handler(o,r,...t){let i=m.bar;a({showBar:!0,percentage:o,title:i.name||"Build",color:i.color,info:t.length?`[${r}] ${t.join(" ")}`:"",output:c.output?.path})}})].filter(Boolean)}),h=[c];n&&h.push(r(t,i));let d=o(h);async function w(){await new Promise(o=>{d.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++)l(f.yellowBright(r.compilation.warnings[o].message));for(let o=0,t=r.compilation.errors.length;o<t;o++)l(f.redBright(r.compilation.errors[o].message))}o(r)})}),m.seo&&p()}await w(),process.on("exit",u);
package/lib/common.mjs CHANGED
@@ -1 +1 @@
1
- import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as a}from"./paths.mjs";import s from"./plugin/override-resolve.mjs";import n from"./plugins.config.mjs";import{PACKAGENAME as i,PACKAGEVERSION as r,isDev as l,isLibrary as m}from"./process-env.mjs";import{isObject as p,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";import y from"./vm/info.mjs";export const outputConfig={path:u(m?"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:`${y.projectName}`,type:"umd",umdNamedDefine:!0},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 b={main:[e.polyfill&&h(o.corePath,"./polyfills/replace-children.mjs"),c("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?b={main:[e.entry]}:Object.keys(e.entry)&&(b=Object.assign(b,e.entry))),"string"==typeof b.main&&(b.main=[b.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let j={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:o.webpackCachePath,memoryCacheUnaffected:!0,name:[a,process.env.NODE_ENV].filter(Boolean).join("-"),version:`${r}`};!1===e.cache?j=!1:p(e.cache)&&(j=Object.assign(j,e.cache));let v=Object.assign({original:e.alias["@"],override:a&&u(a)},e.overrideResolve);export const commonConfig={name:"client",target:"web",devtool:e.devtool,entry:b,mode:l?"development":"production",stats:"errors-only",cache:j,infrastructureLogging:{level:"error"},performance:e.performance,externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:e.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:p(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 s(v),...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 a}from"./paths.mjs";import s from"./plugin/override-resolve.mjs";import n from"./plugins.config.mjs";import{NODE_ENV as i,PACKAGENAME as l,PACKAGEVERSION as r,isDev as m,isLibrary as p}from"./process-env.mjs";import{isObject as c,node_modules as u,resolveProgram as h}from"./utils/index.mjs";import{join as d,resolve as f,extname as g}from"path";import{exampleModuleName as y}from"./vm/example.mjs";import b from"./vm/info.mjs";export const outputConfig={path:h(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${m?"name":"contenthash"}].js`,assetModuleFilename:e=>{let t=g(e.filename||"").substring(1);return`assets/${t?`${t}/`:""}[name]${"js"===t?"":"[hash]"}[ext]`},library:{name:`${b.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${l}`,pathinfo:m,clean:!0,publicPath:t,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"anonymous",enabledWasmLoadingTypes:["fetch"],hotUpdateChunkFilename:"[id].[fullhash].hot.js",hotUpdateMainFilename:"[runtime].[fullhash].hot.json"};let j={main:[e.polyfill&&d(o.corePath,"./polyfills/replace-children.mjs"),u("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?j={main:[e.entry]}:Object.keys(e.entry)&&(j=Object.assign(j,e.entry))),"string"==typeof j.main&&(j.main=[j.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let v={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:o.webpackCachePath,memoryCacheUnaffected:!0,name:`.${[a,i].filter(Boolean).join("-")}`,version:`${r}`};!1===e.cache?v=!1:c(e.cache)&&(v=Object.assign(v,e.cache));let C=Object.assign({original:e.alias["@"],override:a&&h(a)},e.overrideResolve);export const commonConfig={name:"client",target:"web",devtool:e.devtool,entry:j,mode:m?"development":"production",stats:"errors-only",cache:v,snapshot:{immutablePaths:[/node_modules\/(?!@app\/(?:locales|router|example|comment|docs)(?:\/|$))/],managedPaths:[/^@app\/.+/],buildDependencies:{timestamp:!0}},infrastructureLogging:{level:"error"},performance:e.performance,externalsPresets:e.externalsPresets,plugins:n,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:e.lazyCompilation&&m&&{imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(u(y))||t.startsWith(u("@app/comment"))||t.startsWith(o.pagesPath)||t.startsWith(o.componentsPath)))}},buildHttp:c(e.buildHttp)?{allowedUris:[],lockfileLocation:f(o.httpCachePath,"http.lock"),cacheLocation:f(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 s(C),...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 from"./paths.mjs";import{APPTYPE as n,FRAMEWORK as i,NODE_ENV as r,PACKAGENAME as l,isDev as a,isLibrary as m,isMobile as p,jsxImportSource as u,mainDirectory as c}from"./process-env.mjs";import{isFunction as d,resolveProgram as f}from"./utils/index.mjs";import h from"./utils/setup-env.mjs";import{fileExists as g}from"@moneko/utils";import x from"./utils/require.mjs";let v=["@app","@moneko","neko-ui",".cache/http/data","@ant-design","@element-plus","ant-design-vue","antd","antd-mini","antd-mobile","antd-mobile-icons","element-plus","element-ui","ng-zorro-antd","@antv","@mui","ahooks","rc-queue-anim","umi","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design"],P={devtool:a?"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:h(r,n,i),basename:"/",publicPath:"/",rem:{designSize:p?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(c)},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:v,js:v,media:v,font:v,wasm:[]},mdx:{jsx:!1,development:a,jsxImportSource:u,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:o,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:{maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js")},refresh:!0};function j(e){if(g(e)){let o=x(e).default;return d(o)?o(process):o}return{}}m&&(P.alias=Object.assign(P.alias,{"@pkg":s.componentsPath,[l]:s.componentsPath}));let b=P;(!1===(b=e(b,j(s.configPath),j(s.customConfigPath))).devtool||!1===b.sourceMap)&&(b.sourceMap=!1,b.devtool=!1),b.fixBrowserRouter&&b.htmlPluginOption&&(b.htmlPluginOption.tags||(b.htmlPluginOption.tags=[]),b.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=b;export const PUBLICPATH=CONFIG.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 from"./paths.mjs";import{APPTYPE as n,FRAMEWORK as i,NODE_ENV as r,PACKAGENAME as a,isDev as l,isLibrary as m,isMobile as p,jsxImportSource as u,mainDirectory as c}from"./process-env.mjs";import{isFunction as d,resolveProgram as f}from"./utils/index.mjs";import h from"./utils/setup-env.mjs";import{fileExists as g}from"@moneko/utils";import x from"./utils/require.mjs";let v=["@app","@moneko","neko-ui",".cache/http/data","@ant-design","@element-plus","ant-design-vue","antd","antd-mini","antd-mobile","antd-mobile-icons","element-plus","element-ui","ng-zorro-antd","@antv","@mui","@du","ahooks","rc-queue-anim","umi","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design"],P={devtool:l?"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:await h(r,n,i),basename:"/",publicPath:"/",rem:{designSize:p?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(c)},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:v,js:v,media:v,font:v,wasm:[]},mdx:{jsx:!1,development:l,jsxImportSource:u,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:o,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:{maxAssetSize:256e3,maxEntrypointSize:256e3,assetFilter:e=>!e.endsWith(".map")&&!e.endsWith("ce28377f3a428346.js")},refresh:!0};function j(e){if(g(e)){let o=x(e).default;return d(o)?o(process):o}return{}}m&&(P.alias=Object.assign(P.alias,{"@pkg":s.componentsPath,[a]:s.componentsPath}));let w=P;(!1===(w=e(w,j(s.configPath),j(s.customConfigPath))).devtool||!1===w.sourceMap)&&(w.sourceMap=!1,w.devtool=!1),w.fixBrowserRouter&&w.htmlPluginOption&&(w.htmlPluginOption.tags||(w.htmlPluginOption.tags=[]),w.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=w;export const PUBLICPATH=CONFIG.publicPath;
package/lib/dev.mjs CHANGED
@@ -1 +1 @@
1
- let e;import t from"express";import o from"https";import i from"multer";import r from"webpack";import s from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as n}from"webpack-merge";import m from"./build/server.mjs";import{commonConfig as a}from"./common.mjs";import{CONFIG as c,PUBLICPATH as p}from"./config.mjs";import{PORT as u,devLog as d}from"./dev/config.mjs";import f from"./dev/mock.mjs";import h from"./dev/proxy.mjs";import g from"./module.config.mjs";import w,{CUSTOMCONFIG as v}from"./paths.mjs";import{SSR as x,isLibrary as $,isReact as j,refresh as k}from"./process-env.mjs";import y from"./utils/has-pkg.mjs";import{empty as b,resolveProgram as P}from"./utils/index.mjs";import S from"./utils/progress.mjs";import C from"./utils/sigint-exit.mjs";import A from"./options/reslove.mjs";import{watchFile as T}from"fs";import{join as M}from"path";import{spawn as B,exec as O}from"child_process";import _ from"./utils/print.mjs";import D from"chalk";import{directoryExists as E,loadFile as I,loadFileSync as U}from"@moneko/utils";let{HotModuleReplacementPlugin:G,ProgressPlugin:H,WatchIgnorePlugin:L}=r,R=y("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,q=y("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,F=j&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,N=["js","jsx","ts","tsx","json","html","vue"],W=N.join(","),X=["css","scss","sass","less","ts","tsx","js","jsx"],z=X.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=`${p.endsWith("/")?"":"/"}__hmr__`,Q=new URLSearchParams({name:"client",path:J,dynamicPublicPath:!0,timeout:2e3,reload:!k,quiet:!0,noInfo:!0,overlay:!0}).toString(),V=a.output.path;x&&(V=P(`${$?"docs":"dist"}/client`));let Y=!!c.bar,Z=n(a,{entry:{main:[`${A.hotMiddlewareClient}?${Q}`]},output:{path:V},module:g(!1),plugins:[new G,new L({paths:[/\.d\.ts$/]}),F&&new F,q&&new q({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${W}}`,$&&`${c.alias["@pkg"]}/**/*.{${W}}`].filter(Boolean),extensions:N,exclude:K,cache:!0,cacheLocation:`${w.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,overrideConfigFile:P("eslint.config.mjs"),configType:"flat"}),R&&new R({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${z}}`,$&&`${c.alias["@pkg"]}/**/*.{${z}}`].filter(Boolean),extensions:X,exclude:K,cache:!0,cacheLocation:`${w.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new H({handler(e,t,...o){let i=c.bar||{};S({showBar:Y,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:Z.output?.path})}})].filter(Boolean)}),ee=[Z];x&&ee.push(n(a,m));let et=r(ee);et.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let eo=t(),ei=i(),er=s(et,{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",...c.devServer.headers}),serverSideRender:x,lastModified:!0,publicPath:Z.output?.publicPath}),es=l(et,{log:!1,path:J,heartbeat:2e3});eo.use(t.static(M(w.programPath,"./public"))).use(er).use(es),E(w.mockPath)&&eo.use(f(w.mockPath)),c.proxy&&h(eo,c.proxy);let el=`${Z.output.path}/index.html`;if(eo.all("/*foo",ei.any(),function(e,t,o){if("GET"!==e.method)return o();{let i=e.get("Accept");if(i?.includes("text/html")){let e=er.context.outputFileSystem,o=e?.readFileSync?.(el);t.end(o)}else if("text/event-stream"===i&&e.url.endsWith(J))return e.url=J,es(e,t,o);else return o()}}),c.devServer.https){let[t,i]=await Promise.all([I(c.devServer.https.key),I(c.devServer.https.cert)]);t||(_(D.redBright(`无法加载私钥。请检查路径和文件是否存在,并确保路径正确:${c.devServer.https.key}`)),process.exit(1)),i||(_(D.redBright(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${c.devServer.https.cert}`)),process.exit(1)),e=o.createServer({key:t,cert:i},eo)}let en=(e||eo).listen(u,"0.0.0.0",()=>{});function em(){process.exit(0)}function ea(e,t){let o=U(e);t&&null!==o&&T(e,async function(){let i=U(e);o.trim().replace(/^\s*[\r\n]/gm,"")!==i?.trim().replace(/^\s*[\r\n]/gm,"")?(_(D.yellow(`检测到工程配置${D.blue(`[${t}]`)}变更, 程序即将重启...`)),O("win32"===process.platform?`netstat -ano | findstr :${u}`:`lsof -i :${u}`,(e,t)=>{let o=ec?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];o?process.kill(Number(o),"SIGHUP"):_(`未找到占用端口 ${u} 的进程`)})):_(D.gray(`未变更`))})}ea(w.configPath,"index"),ea(w.customConfigPath,v);let ec="win32"===process.platform;process.on("SIGHUP",function(){er.close(b),en.close(b),en.closeAllConnections(),function(){let e=B(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",em)}()}),process.on("exit",function(){er.close(b),en.close(b),en.closeAllConnections()}),C(em);
1
+ let e;import t from"express";import o from"https";import i from"multer";import r from"webpack";import s from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as n}from"webpack-merge";import m from"./build/server.mjs";import{commonConfig as a}from"./common.mjs";import{CONFIG as c,PUBLICPATH as p}from"./config.mjs";import{PORT as u,devLog as d}from"./dev/config.mjs";import h from"./dev/mock.mjs";import f from"./dev/proxy.mjs";import g from"./module.config.mjs";import w,{CUSTOMCONFIG as v}from"./paths.mjs";import{SSR as x,isLibrary as k,isReact as y,refresh as $}from"./process-env.mjs";import j from"./utils/has-pkg.mjs";import{empty as b,resolveProgram as P}from"./utils/index.mjs";import C from"./utils/progress.mjs";import S from"./utils/sigint-exit.mjs";import A from"./options/reslove.mjs";import{watchFile as T}from"fs";import{join as M}from"path";import{spawn as B,exec as E}from"child_process";import O from"./utils/print.mjs";import _ from"chalk";import{directoryExists as D,loadFile as I,loadFileSync as U}from"@moneko/utils";let{HotModuleReplacementPlugin:G,ProgressPlugin:H,WatchIgnorePlugin:L}=r,R=j("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,q=j("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,z=y&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,F=["js","jsx","ts","tsx","json","html","vue"],N=F.join(","),W=["css","scss","sass","less","ts","tsx","js","jsx"],X=W.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=`${p.endsWith("/")?"":"/"}__hmr__`,Q=new URLSearchParams({name:"client",path:J,dynamicPublicPath:!0,timeout:2e3,reload:!$,quiet:!0,noInfo:!0,overlay:!0}).toString(),V=a.output.path;x&&(V=P(`${k?"docs":"dist"}/client`));let Y=n(a,{entry:{main:[`${A.hotMiddlewareClient}?${Q}`]},output:{path:V},module:g(!1),optimization:{minimize:!1,concatenateModules:!1,removeAvailableModules:!1,removeEmptyChunks:!1,splitChunks:!1},plugins:[new G,new L({paths:[/\.d\.ts$/]}),z&&new z,q&&new q({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${N}}`,k&&`${c.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:F,exclude:K,cache:!0,cacheLocation:`${w.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,overrideConfigFile:P("eslint.config.mjs"),configType:"flat"}),R&&new R({fix:!0,threads:!0,files:[`${c.alias["@"]}/**/*.{${X}}`,k&&`${c.alias["@pkg"]}/**/*.{${X}}`].filter(Boolean),extensions:W,exclude:K,cache:!0,cacheLocation:`${w.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),!!c.bar&&new H({handler(e,t,...o){let i=c.bar;C({showBar:!0,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(n(a,m));let ee=r(Z);ee.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let et=t(),eo=i(),ei=s(ee,{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",...c.devServer.headers}),serverSideRender:x,lastModified:!0,publicPath:Y.output?.publicPath}),er=l(ee,{log:!1,path:J,heartbeat:2e3});et.use(t.static(M(w.programPath,"./public"))).use(ei).use(J,er),D(w.mockPath)&&et.use(eo.any(),h(w.mockPath)),c.proxy&&f(et,c.proxy);let es=`${Y.output.path}/index.html`;if(et.use((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?.(es);t.end(o)}else if("text/event-stream"===i&&e.url.endsWith(J))return e.url=J,er(e,t,o);else return o()}}),c.devServer.https){let[t,i]=await Promise.all([I(c.devServer.https.key),I(c.devServer.https.cert)]);t||(O(_.redBright(`无法加载私钥。请检查路径和文件是否存在,并确保路径正确:${c.devServer.https.key}`)),process.exit(1)),i||(O(_.redBright(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${c.devServer.https.cert}`)),process.exit(1)),e=o.createServer({key:t,cert:i},et)}let el=(e||et).listen(u,"0.0.0.0",()=>{});function en(){process.exit(0)}function em(e,t){let o=U(e);t&&null!==o&&T(e,async function(){let i=U(e);o.trim().replace(/^\s*[\r\n]/gm,"")!==i?.trim().replace(/^\s*[\r\n]/gm,"")?(O(_.yellow(`检测到工程配置${_.blue(`[${t}]`)}变更, 程序即将重启...`)),E("win32"===process.platform?`netstat -ano | findstr :${u}`:`lsof -i :${u}`,(e,t)=>{let o=ea?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];o?process.kill(Number(o),"SIGHUP"):O(`未找到占用端口 ${u} 的进程`)})):O(_.gray(`未变更`))})}em(w.configPath,"index"),em(w.customConfigPath,v);let ea="win32"===process.platform;process.on("SIGHUP",function(){ei.close(b),el.close(b),el.closeAllConnections(),function(){let e=B(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",en)}()}),process.on("exit",function(){ei.close(b),el.close(b),el.closeAllConnections()}),S(en);
@@ -1 +1 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return u}});const t=require("fs"),r=(e=require("../utils/log.mjs"))&&e.__esModule?e:{default:e},s={};function u(e){let u=this.resourcePath,{comment:i,generateDoc:n,getCommentPath:a}=this.getOptions();try{let r=(0,t.statSync)(u).mtime.getTime();s[u]!==r&&(Object.assign(s,{[u]:r}),i.setData(a(u),n(e,u)))}catch(e){(0,r.default)(e)}return e}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return i}});const e=require("fs"),t=s(require("../utils/log.mjs")),r=s(require("../utils/parse-module-meta.mjs"));function s(e){return e&&e.__esModule?e:{default:e}}const u={};function i(s){let i=this.resourcePath,{comment:n,generateDoc:a,getCommentPath:l}=this.getOptions();try{let t=(0,e.statSync)(i).mtime.getTime();if(u[i]!==t){Object.assign(u,{[i]:t});let{file:e,pkg:o,meta:c}=(0,r.default)(l(i));n.setData(e,a(s,i)),n.setData(o,c)}}catch(e){(0,t.default)(e)}return s}
package/lib/paths.d.mts CHANGED
@@ -28,7 +28,6 @@ declare const paths: {
28
28
  pagesPath: string;
29
29
  componentsPath: string;
30
30
  mockPath: string;
31
- vfsDtsPath: string;
32
31
  };
33
32
  export declare const routeDir: string;
34
33
  export default paths;
package/lib/paths.mjs CHANGED
@@ -1 +1 @@
1
- import e from"url";import{dirname as o,resolve as t}from"path";let a=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const __filename=e.fileURLToPath(import.meta.url);export const __dirname=o(__filename);export const yarnArgv={};for(let e=0,o=a.length;e<o;e++){let o=a[e].split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let c=process.cwd(),n=t(c,"./node_modules"),r={__dirname,__filename,nodeModules:n,pnpmNodeModules:t(n,"./.pnpm/node_modules"),corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:c,webpackCachePath:t(n,"./.temp_cache"),lineCachePath:t(n,"./.cache"),httpCachePath:t(n,"./.cache/http"),swcCachePath:t(n,"./.cache/.swc"),configPath:t(c,"./config/index.ts"),customConfigPath:t(c,`./config/${CUSTOMCONFIG}.ts`),coveragePath:t(c,"./coverage/clover.xml"),pagesPath:t(c,"./src/pages"),componentsPath:t(c,"./components"),mockPath:t(c,"./mock"),vfsDtsPath:t(n,"./@app")};export const routeDir="library"===process.env.APPTYPE?r.componentsPath:r.pagesPath;export default r;
1
+ import e from"url";import{dirname as o,resolve as t}from"path";let a=JSON.parse(process.env.npm_config_argv||'{"original":[]}').original;export const __filename=e.fileURLToPath(import.meta.url);export const __dirname=o(__filename);export const yarnArgv={};for(let e=0,o=a.length;e<o;e++){let o=a[e].split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})}export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let c=process.cwd(),n=t(c,"./node_modules"),r={__dirname,__filename,nodeModules:n,pnpmNodeModules:t(n,"./.pnpm/node_modules"),corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:c,webpackCachePath:t(n,"./.cache"),lineCachePath:t(n,"./.cache"),httpCachePath:t(n,"./.cache/http"),swcCachePath:t(n,"./.cache/.swc"),configPath:t(c,"./config/index.ts"),customConfigPath:t(c,`./config/${CUSTOMCONFIG}.ts`),coveragePath:t(c,"./coverage/clover.xml"),pagesPath:t(c,"./src/pages"),componentsPath:t(c,"./components"),mockPath:t(c,"./mock")};export const routeDir="library"===process.env.APPTYPE?r.componentsPath:r.pagesPath;export default r;
@@ -1 +1 @@
1
- import t from"webpack-virtual-modules";import{isLibrary as o}from"../process-env.mjs";import{node_modules as i}from"../utils/index.mjs";import{comment as e,docs as s}from"../vm/docs.mjs";import{examples as r}from"../vm/example.mjs";import{locales as l}from"../vm/locales.mjs";import m from"../vm/modules.mjs";import{route as p}from"../vm/routes.mjs";import n from"../paths.mjs";export class VirtualModuleWebpackPlugin{constructor(o={}){this.virtualModules=new t(m),this.options={},this.init=!1;let i={};for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t)){let e=o[t];Object.assign(i,{[t]:"string"==typeof e?e:`export default ${JSON.stringify(e)}`})}this.options=i}modify(t,o,e){let s=e||"",r=o.startsWith(n.nodeModules)?o:i(o),l=t;for(;l&&l._inputFileSystem;)l=l._inputFileSystem;let m=l?._virtualFiles?.[r];m&&m.contents===s||this.virtualModules.writeModule(r,s)}apply(t){this.virtualModules.apply(t);let i=(o,i)=>{this.modify(t.inputFileSystem,o,i)};p.on("change",i),l.on("change",i),o&&(r.on("change",i),s.on("change",i),e.on("change",i)),t.hooks.beforeCompile.tap("VirtualModuleWebpackPlugin",()=>{if(!this.init){for(let t in this.init=!0,this.options)Object.prototype.hasOwnProperty.call(this.options,t)&&i(t,this.options[t]);for(let t of r)i(t[0],t[1]);for(let t of s)i(t[0],t[1]);for(let t of e)i(t[0],t[1])}})}}
1
+ import t from"webpack-virtual-modules";import{isLibrary as o}from"../process-env.mjs";import{node_modules as i}from"../utils/index.mjs";import e from"../utils/parse-module-meta.mjs";import{comment as s,docs as r}from"../vm/docs.mjs";import{examples as l}from"../vm/example.mjs";import{locales as m}from"../vm/locales.mjs";import n from"../vm/modules.mjs";import{route as p}from"../vm/routes.mjs";import a from"../paths.mjs";let f={};for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t)){let{file:o,pkg:i,meta:s}=e(t);f[i]=s,f[o]=n[t]}export class VirtualModuleWebpackPlugin{constructor(o={}){this.virtualModules=new t(f),this.options={},this.init=!1;let i={};for(let t in o)if(Object.prototype.hasOwnProperty.call(o,t)){let{file:s,pkg:r,meta:l}=e(t),m=o[t],n=m;n=s.endsWith("json")?"string"==typeof m?m:JSON.stringify(m):"string"==typeof m?m:`export default ${JSON.stringify(m)}`,Object.assign(i,{[s]:n,[r]:l})}this.options=i}modify(t,o,e){let s=e||"",r=o.startsWith(a.nodeModules)?o:i(o),l=t.inputFileSystem;for(;l&&l._inputFileSystem;)l=l._inputFileSystem;let m=l?._virtualFiles?.[r];m&&m.contents===s||(this.virtualModules.writeModule(r,s),t.watching?.invalidate())}apply(t){this.virtualModules.apply(t);let i=(o,i)=>{this.modify(t,o,i)};p.on("change",i),m.on("change",i),o&&(l.on("change",i),r.on("change",i),s.on("change",i)),t.hooks.beforeCompile.tap("VirtualModuleWebpackPlugin",()=>{if(!this.init){for(let t in this.init=!0,this.options)Object.prototype.hasOwnProperty.call(this.options,t)&&i(t,this.options[t]);for(let t of l)i(t[0],t[1]);for(let t of r)i(t[0],t[1]);for(let t of s)i(t[0],t[1])}})}}
@@ -0,0 +1,8 @@
1
+ declare function parseModuleMeta(path: string, version?: number): {
2
+ name: string;
3
+ main: string;
4
+ pkg: string;
5
+ file: string;
6
+ meta: string;
7
+ };
8
+ export default parseModuleMeta;
@@ -0,0 +1 @@
1
+ import{resolve as e}from"path";import n from"../paths.mjs";export default function(t,a=1){let i=t.replace(/^\/|\/$/g,""),o=i,m="index.ts",d=i.match(/(.+)\/index\.([^/]+)$/),r=i.match(/(.+)\.([^/]+)$/);return d?(o=d[1],m=`index.${d[2]}`):r&&(o=r[1],m=`index.${r[2]}`),{name:o,main:m,pkg:e(n.nodeModules,o,"package.json"),file:e(n.nodeModules,o,m),meta:`{"name":"${o}","main":"${m}","version":"0.0.${a}","description": ""}`}}
@@ -1,3 +1,6 @@
1
- import { type DotenvParseOutput } from 'dotenv';
2
- declare function setupEnv(mode: string, type: string, framework: string): DotenvParseOutput;
1
+ declare function setupEnv(mode: string, type: string, framework: string): Promise<{
2
+ NODE_ENV: string;
3
+ APPTYPE: string;
4
+ FRAMEWORK: string;
5
+ }>;
3
6
  export default setupEnv;
@@ -1 +1 @@
1
- import{relative as r}from"path";import{config as t}from"dotenv";import o from"../paths.mjs";export default function(e,a,p){let n=[r(o.programPath,".env"),r(o.programPath,".env/.env"),r(o.programPath,`.env/.${"production"===e?"prod":"dev"}.env`)],m={NODE_ENV:e,APPTYPE:a,FRAMEWORK:p};return n.forEach(r=>{let o=t({path:r,override:!0}).parsed;o&&Object.assign(m,o)}),m}
1
+ import{loadFile as e}from"@moneko/utils";async function t(t,r,n){let i=[".env",".env/.env",`.env/.${"production"===t?"prod":"dev"}.env`],o={NODE_ENV:t,APPTYPE:r,FRAMEWORK:n};return(await Promise.all(i.map(e))).forEach(e=>{e&&Object.assign(o,e.split("\n").reduce((e,t)=>{if(!t||t.trim().startsWith("#"))return e;let[r,...n]=t.split("=");if(!r)return e;let i=n.join("=").trim();return e[r.trim()]=i.replace(/^["']|["']$/g,""),e},{}))}),Object.keys(o).forEach(e=>{let t=o[e];process.env[e]!==t&&(process.env[e]=o[e])}),o}export default t;
package/lib/vm/docs.d.mts CHANGED
@@ -1,5 +1,7 @@
1
1
  import ReactiveObject from '../utils/reactive-object.mjs';
2
- export declare const docsModuleName = "@app/docs";
2
+ export declare const docsModuleName: string;
3
+ export declare const docsModulePkgJson: string;
4
+ export declare const docsModuleMeta: string;
3
5
  export declare const docs: ReactiveObject<Record<string, string>>;
4
6
  export declare const comment: ReactiveObject<Record<string, string>>;
5
7
  export declare const getCommentPath: (file: string) => string;
package/lib/vm/docs.mjs CHANGED
@@ -1 +1 @@
1
- import e from"./generate-doc.mjs";import{CONFIG as t}from"../config.mjs";import{FRAMEWORK as o,isLibrary as a,isReact as r,isSolid as n}from"../process-env.mjs";import m from"../utils/reactive-object.mjs";import s from"../rule.mjs";import{loadFile as l,scanFolderSync as c}from"@moneko/utils";let p={react:"createElement",solid:"createComponent"}[o];export const docsModuleName="@app/docs";export const docs=new m({[docsModuleName]:"export default {}"});export const comment=new m({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,o=t.alias["@pkg"]?.length;return t=>t.substring(o).replace(e,"@app/comment/$1.md")}();if(a&&!1!==t.htmlPluginOption){let a={},m=`import { ${p}${n?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[o]}${n?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${r?"() =>":""}${p}(${n?"Dynamic":"'div'"}, {${n?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,i=(e,t)=>{let o=e.replace(/^@app\/comment\//,"").split("/"),r=o.pop(),n=o.join("/");a[n]||(a[n]={}),t?a[n][r]&&delete a[n][r]:a[n][r]=`rr(() => ${p}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let l={};for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(l[e]=Object.values(a[e]));docs.setData(docsModuleName,`${m}export default ${JSON.stringify(l).replace(s.extract_func,"$1")}`)};comment.on("change",(e,t)=>{i(e,t?.length<0)});let d=c(t.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e));await Promise.all(d.map(async e=>({data:await l(e),file:e}))).then(t=>{for(let o=0;o<t.length;o++){let a=t[o];a.data&&comment.setData(getCommentPath(a.file),e(a.data,a.file))}})}
1
+ import{relative as e}from"path";import t from"./generate-doc.mjs";import{CONFIG as o}from"../config.mjs";import{FRAMEWORK as r,isLibrary as a,isReact as m,isSolid as n}from"../process-env.mjs";import s from"../utils/reactive-object.mjs";import l from"../rule.mjs";import{loadFile as p,scanFolderSync as c}from"@moneko/utils";import i from"../utils/parse-module-meta.mjs";import d from"../paths.mjs";let f={react:"createElement",solid:"createComponent"}[r],{file:u,pkg:h,meta:$}=i("@app/docs");export const docsModuleName=u;export const docsModulePkgJson=h;export const docsModuleMeta=$;export const docs=new s({[u]:"export default {}",[h]:$});export const comment=new s({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,t=o.alias["@pkg"]?.length;return o=>o.substring(t).replace(e,"@app/comment/$1.md")}();if(a&&!1!==o.htmlPluginOption){let a={},s=`import { ${f}${n?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[r]}${n?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${m?"() =>":""}${f}(${n?"Dynamic":"'div'"}, {${n?"innerHTML: res.default, component: 'div', class: 'n-md-box' ":"dangerouslySetInnerHTML: {__html:res.default}, className: 'n-md-box'"} })};}`,h=(e,t)=>{let o=e.replace(/^@app\/comment\//,"").split("/"),r=o.pop(),m=o.join("/");a[m]||(a[m]={}),t?a[m][r]&&delete a[m][r]:r.endsWith("package.json")||(a[m][r]=`rr(() => ${f}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`);let n={};for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(n[e]=Object.values(a[e]));docs.setData(u,`${s}export default ${JSON.stringify(n).replace(l.extract_func,"$1")}`)};comment.on("change",(t,o)=>{h(e(d.nodeModules,t),o?.length<0)});let $=c(o.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e));await Promise.all($.map(async e=>({data:await p(e),file:e}))).then(e=>{for(let o=0;o<e.length;o++){let r=e[o];if(r.data){let{file:e,pkg:o,meta:a}=i(getCommentPath(r.file));comment.setData(e,t(r.data,r.file)),comment.setData(o,a)}}})}
@@ -1 +1 @@
1
- import{generateExample as e}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import o from"../paths.mjs";import{isDev as r,isLibrary as m}from"../process-env.mjs";import p from"../utils/reactive-object.mjs";import a from"../rule.mjs";import{CONFIG as n}from"../config.mjs";export const exampleModuleName="@app/example";function l(){if(!m||!1===n.htmlPluginOption)return{};let t=JSON.parse(e(o.componentsPath,`${exampleModuleName}/`)),r={};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&Object.assign(r,{[e]:`rr(() => import('${e}'))rr`});return{...t,[`${exampleModuleName}/index.js`]:`export default ${JSON.stringify(r).replace(a.extract_func,"$1")}`}}export const examples=new p(l());export function generatorExample(){let e=l();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t])}m&&r&&!1!==n.htmlPluginOption&&t(o.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
1
+ import{generateExample as e}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import o from"../paths.mjs";import{isDev as r,isLibrary as m}from"../process-env.mjs";import p from"../utils/reactive-object.mjs";import l from"../rule.mjs";import{CONFIG as a}from"../config.mjs";import n from"../utils/parse-module-meta.mjs";export const exampleModuleName="@app/example";function s(){if(!m||!1===a.htmlPluginOption)return{};let t=JSON.parse(e(o.componentsPath,`${exampleModuleName}/`)),r={};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&Object.assign(r,{[e]:`rr(() => import('${e}'))rr`});let p={...t,[exampleModuleName]:`export default ${JSON.stringify(r).replace(l.extract_func,"$1")}`},s={};for(let e in p)if(Object.prototype.hasOwnProperty.call(p,e)){let{file:t,pkg:o,meta:r}=n(e);s[o]=r,s[t]=p[e]}return s}export const examples=new p(s());export function generatorExample(){let e=s();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t])}m&&r&&!1!==a.htmlPluginOption&&t(o.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorExample);
@@ -1,5 +1,5 @@
1
1
  import ReactiveObject from '../utils/reactive-object.mjs';
2
- export declare const localesModuleName = "@app/locales";
2
+ export declare const localesModuleName: string;
3
3
  export declare const locales: ReactiveObject<{
4
- "@app/locales": string;
4
+ [x: string]: string;
5
5
  }>;
@@ -1,2 +1,2 @@
1
- import{basename as e,join as t}from"path";import{watch as o}from"chokidar";import{CONFIG as a}from"../config.mjs";import{FRAMEWORK as l,isDev as r}from"../process-env.mjs";import n from"../utils/reactive-object.mjs";import s from"../utils/sigint-exit.mjs";import{directoryExists as c,scanFolderSync as i}from"@moneko/utils";import g from"../utils/require.mjs";let u={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},f={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||"zh_CN",{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[language]||resources.zh_CN),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||"zh_CN",{translation:l,...o}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[a]||resources.zh_CN),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[l];function p(e,t){return`${u[l]}
2
- export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${f}`}export const localesModuleName="@app/locales";export const locales=new n({[localesModuleName]:p([],{})});let m={};async function d(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete m[a]:(delete g.cache[t],Object.assign(m,{[a]:g(t).default}));let l=[],r={};for(let e in m)if(Object.prototype.hasOwnProperty.call(m,e)){let{language:t=a,title:o=t,icon:n,translation:s={}}=m[e];l.push({language:t,title:o,icon:n}),r[t]={language:t,title:o,icon:n,translation:s}}locales.setData(localesModuleName,p(l,r))}let z=t(a.alias["@"],"./locales");if(c(z)&&!1!==a.htmlPluginOption){let e=i(z,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(e=>d(e,"added"))),r&&function(e,t){let a=o(e,{ignored:t,persistent:!0,ignoreInitial:!0});function l(){a.unwatch(e),a.close()}a.on("add",e=>{d(e,"added")}),a.on("change",e=>{d(e,"change")}),a.on("unlink",e=>{d(e,"deleted")}),a.once("ready",()=>{r||l()}),s(l)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
1
+ import{basename as e,join as t}from"path";import{watch as o}from"chokidar";import{CONFIG as a}from"../config.mjs";import{FRAMEWORK as l,isDev as r}from"../process-env.mjs";import n from"../utils/reactive-object.mjs";import s from"../utils/sigint-exit.mjs";import{directoryExists as c,scanFolderSync as i}from"@moneko/utils";import g from"../utils/require.mjs";import u from"../utils/parse-module-meta.mjs";let f={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},p={react:'let storageKey="localizable.language",language=localStorage.getItem(storageKey)||"zh_CN",{translation:a,...defaultLocale}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[language]||resources.zh_CN),localizable=sso({lang:defaultLocale,t:a});export function setLang(a){let{translation:e,...l}=resources[a]||{};e&&(localizable.lang=l,localizable.t=e,localStorage.setItem(storageKey,l.language))}export default localizable;',solid:'let locale=createRoot(()=>{let e="localizable.language",a=localStorage.getItem(e)||"zh_CN",{translation:l,...o}=Object.assign({title:"简体中文",language:"zh_CN",translation:{}},resources[a]||resources.zh_CN),[n,c]=createStore({lang:o,t:l});return createEffect(()=>{let a=resources[n.lang.language]?.translation;a&&(c("t",a),localStorage.setItem(e,n.lang.language))}),{localizable:n,setLocalizable:c,setLang:function(e){let{translation:a,...l}=resources[e]||{};a&&c("lang",l)}}},getOwner());export const setLocalizable=locale.setLocalizable;export const t=locale.localizable.t;export const lang=locale.localizable.lang;export const setLang=locale.setLang;'}[l];function m(e,t){return`${f[l]}
2
+ export function template(r,n){return r.replace(/\\\${\\w+}/g,function(r){var t=r.slice(2,-1);var e=n[t];return e!==void 0?e.toString():""})}function deepFreeze(o) { const p = Reflect.ownKeys(o);for (const k of p) {const v = o[k];if ((v && typeof v === "object") || typeof v === "function") {deepFreeze(v);}}return Object.freeze(o);}export const locales = ${JSON.stringify(e)};const _res = ${JSON.stringify(t)};const resources = deepFreeze(_res);${p}`}let{file:d,pkg:z,meta:b}=u("@app/locales");export const localesModuleName=d;export const locales=new n({[d]:m([],{}),[z]:b});let h={};async function j(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete h[a]:(delete g.cache[t],Object.assign(h,{[a]:g(t).default}));let l=[],r={};for(let e in h)if(Object.prototype.hasOwnProperty.call(h,e)){let{language:t=a,title:o=t,icon:n,translation:s={}}=h[e];l.push({language:t,title:o,icon:n}),r[t]={language:t,title:o,icon:n,translation:s}}locales.setData(d,m(l,r)),locales.setData(z,b)}let y=t(a.alias["@"],"./locales");if(c(y)&&!1!==a.htmlPluginOption){let e=i(y,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(e=>j(e,"added"))),r&&function(e,t){let a=o(e,{ignored:t,persistent:!0,ignoreInitial:!0});function l(){a.unwatch(e),a.close()}a.on("add",e=>{j(e,"added")}),a.on("change",e=>{j(e,"change")}),a.on("unlink",e=>{j(e,"deleted")}),a.once("ready",()=>{r||l()}),s(l)}(y,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
@@ -1 +1 @@
1
- import{join as t}from"path";import{getAppEntry as e,getAppFallback as p,getAppMdxScope as r,getAppMergeRouter as o,getAppNormalizeCss as m,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as i}from"@moneko/mdx";import n from"./coverage.mjs";import{docs as f,docsModuleName as l}from"./docs.mjs";import d from"./info.mjs";import{locales as u,localesModuleName as x}from"./locales.mjs";import{route as j,routesModuleName as c}from"./routes.mjs";import{CONFIG as g}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as y,FRAMEWORK as h}from"../process-env.mjs";import{node_modules as k}from"../utils/index.mjs";import{generateDeclaration as O}from"../utils/dts.mjs";import S from"../utils/has-pkg.mjs";import{updateFileSync as b}from"@moneko/utils";import z from"../plugin/module-federation.mjs";import D from"../utils/create-types.mjs";import J from"../rule.mjs";let N=S(t(g.alias["@"],"./mdx-scope.tsx"))||S(t(g.alias["@"],"./mdx-scope.ts")),$={[k("@app/env.ts")]:`export default ${JSON.stringify(g.env)}`,[k("@app/info.ts")]:`export default ${JSON.stringify(d)}`,[k("@app/entry.ts")]:e(t(g.alias["@"],"./index.ts"),!!z.length,!!g.rem,!!g.normalizeCss,y,h),[k("@app/rem")]:a(g.rem?.designSize||1680),[k("@app/fallback")]:p(g.fallbackCompPath),[k("@app/coverage")]:n(v.coveragePath),[k("@app/merge-router")]:o(),[k("@app/prefix-router")]:s(),[k("@app/normalize/index.css")]:m(),[k("@app/suspense/index.tsx")]:i(y,h),[k("@app/mdx-scope.tsx")]:N?r(N):"export default {}",[k(c)]:j.getData(c),[k(x)]:u.getData(x),[k(l)]:f.getData(l)};b(k("@types/@app/index.d.ts"),["@app/env.ts","@app/info.ts","@app/entry.ts","@app/mdx-scope.tsx"].map(t=>{let e=k(t);return D(t.replace(J.js,""),O($[e],e))}).join("\n")),b(k("@types/@vm/index.d.ts"),Object.keys(g.virtualModule).map(t=>{let e=g.virtualModule[t];return D(t.replace(J.js,""),O("string"==typeof e?e:`export default ${JSON.stringify(e)}`,k(t)))}).join("\n"));export default $;
1
+ import{join as t}from"path";import{getAppEntry as p,getAppFallback as e,getAppMdxScope as o,getAppMergeRouter as r,getAppNormalizeCss as m,getAppPrefixRouter as s,getAppRem as a,getAppSuspense as i}from"@moneko/mdx";import l from"./coverage.mjs";import{docs as f,docsModuleName as n}from"./docs.mjs";import d from"./info.mjs";import{locales as u,localesModuleName as x}from"./locales.mjs";import{route as c,routesModuleName as j}from"./routes.mjs";import{CONFIG as g}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as y,FRAMEWORK as h}from"../process-env.mjs";import{node_modules as k}from"../utils/index.mjs";import{generateDeclaration as O}from"../utils/dts.mjs";import S from"../utils/has-pkg.mjs";import{updateFileSync as b}from"@moneko/utils";import z from"../plugin/module-federation.mjs";import D from"../utils/create-types.mjs";import J from"../rule.mjs";import N from"../utils/parse-module-meta.mjs";let $=S(t(g.alias["@"],"./mdx-scope.tsx"))||S(t(g.alias["@"],"./mdx-scope.ts")),C={"@app/env.ts":`export default ${JSON.stringify(g.env)}`,"@app/info.ts":`export default ${JSON.stringify(d)}`,"@app/entry.ts":p(t(g.alias["@"],"./index.ts"),!!z.length,!!g.rem,!!g.normalizeCss,y,h),"@app/rem":a(g.rem?.designSize||1680),"@app/fallback":e(g.fallbackCompPath),"@app/coverage":l(v.coveragePath),"@app/merge-router":r(),"@app/prefix-router":s(),"@app/normalize/index.css":m(),"@app/suspense/index.tsx":i(y,h),"@app/mdx-scope.tsx":$?o($):"export default {}","@app/routes":c.getData(j),"@app/locales":u.getData(x),"@app/docs":f.getData(n)};b(k("@types/@app/index.d.ts"),["@app/env.ts","@app/info.ts","@app/entry.ts","@app/mdx-scope.tsx"].map(t=>D(t.replace(J.js,""),O(C[t],t))).join("\n")),b(k("@types/@vm/index.d.ts"),Object.keys(g.virtualModule).map(t=>{let p=g.virtualModule[t],{file:e}=N(t);return D(t,O("string"==typeof p?p:`export default ${JSON.stringify(p)}`,e))}).join("\n"));export default C;
@@ -1,6 +1,8 @@
1
1
  import ReactiveObject from '../utils/reactive-object.mjs';
2
- export declare const routesModuleName = "@app/routes";
2
+ export declare const routesModuleName: string;
3
+ export declare const routesModulePkgJson: string;
4
+ export declare const routesModuleMeta: string;
3
5
  export declare const route: ReactiveObject<{
4
- "@app/routes": string;
6
+ [x: string]: string;
5
7
  }>;
6
8
  export declare function generatorRouter(): void;
package/lib/vm/routes.mjs CHANGED
@@ -1 +1 @@
1
- import{generateRouter as o}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import{CONFIG as e}from"../config.mjs";import{routeDir as r}from"../paths.mjs";import{FRAMEWORK as m,isDev as s,isLibrary as u}from"../process-env.mjs";import i from"../utils/reactive-object.mjs";let n=u?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return!1===e.htmlPluginOption?"":o(r,`${e.alias["@"]}/router/index.ts`,m,n,u)}export const route=new i({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}s&&t(r,u?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
1
+ import{generateRouter as o}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import{CONFIG as e}from"../config.mjs";import{routeDir as r}from"../paths.mjs";import{FRAMEWORK as m,isDev as s,isLibrary as n}from"../process-env.mjs";import p from"../utils/reactive-object.mjs";import u from"../utils/parse-module-meta.mjs";let i=n?"@pkg":"@/pages",{file:a,pkg:l,meta:c}=u("@app/routes");export const routesModuleName=a;export const routesModulePkgJson=l;export const routesModuleMeta=c;function f(){return!1===e.htmlPluginOption?"":o(r,`${e.alias["@"]}/router/index.ts`,m,i,n)}export const route=new p({[a]:f(),[l]:c});export function generatorRouter(){route.setData(a,f())}s&&t(r,n?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.24.5",
3
+ "version": "3.24.7",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -25,7 +25,6 @@
25
25
  "core-js": "3.39.0",
26
26
  "core-js-compat": "3.39.0",
27
27
  "css-loader": "7.1.2",
28
- "dotenv": "16.4.5",
29
28
  "express": "5.0.1",
30
29
  "html-webpack-plugin": "5.6.3",
31
30
  "http-proxy-middleware": "3.0.3",
@@ -59,7 +58,7 @@
59
58
  "@types/webpack-hot-middleware": "2.25.9",
60
59
  "babel-plugin-react-compiler": "19.0.0-beta-a7bf2bd-20241110",
61
60
  "oxlint": "0.11.1",
62
- "sass": "1.80.7",
61
+ "sass": "1.81.0",
63
62
  "sass-loader": "16.0.3",
64
63
  "solid-refresh": "0.7.5"
65
64
  },