@moneko/core 3.9.17-beta.11 → 3.9.17-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/build/common.mjs +1 -0
- package/lib/build/server.mjs +1 -0
- package/lib/build.mjs +1 -1
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev/config.mjs +3 -0
- package/lib/dev/mock.mjs +1 -0
- package/lib/dev/proxy.d.mts +7 -0
- package/lib/dev.mjs +1 -1
- package/lib/html-plugin-option.mjs +1 -1
- package/lib/index.d.mts +7 -3
- package/lib/index.mjs +1 -1
- package/lib/loader/ts-doc.d.cts +1 -1
- package/lib/module-federation.mjs +1 -1
- package/lib/module.config.mjs +1 -1
- package/lib/plugin/add-entry-attribute.mjs +1 -1
- package/lib/plugin/virtual-module.mjs +1 -1
- package/lib/polyfills/targets.mjs +1 -0
- package/lib/swcrc.mjs +1 -1
- package/lib/utils/compiler-listener.d.mts +3 -0
- package/lib/utils/compiler-listener.mjs +1 -0
- package/lib/utils/esm.d.mts +2 -0
- package/lib/utils/esm.mjs +1 -0
- package/lib/utils/has-pkg.d.mts +2 -0
- package/lib/utils/has-pkg.mjs +1 -0
- package/lib/{utils.d.mts → utils/index.d.mts} +0 -6
- package/lib/utils/index.mjs +1 -0
- package/lib/utils/log.d.mts +2 -0
- package/lib/utils/log.mjs +2 -0
- package/lib/utils/read-conf.d.mts +2 -0
- package/lib/utils/read-conf.mjs +1 -0
- package/lib/utils/seo.mjs +1 -0
- package/lib/utils/tfc.d.mts +2 -0
- package/lib/utils/tfc.mjs +1 -0
- package/lib/vm/docs.d.mts +1 -1
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/example.d.mts +1 -1
- package/lib/vm/example.mjs +1 -1
- package/lib/{info.d.mts → vm/info.d.mts} +2 -2
- package/lib/vm/info.mjs +1 -0
- package/lib/vm/locales.d.mts +1 -1
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.mjs +1 -1
- package/lib/vm/routes.d.mts +1 -1
- package/lib/vm/routes.mjs +1 -1
- package/package.json +2 -2
- package/typings/global.d.ts +2 -3
- package/lib/build.common.mjs +0 -1
- package/lib/build.server.mjs +0 -1
- package/lib/dev-config.mjs +0 -3
- package/lib/dev-mock.mjs +0 -1
- package/lib/dev-proxy.d.mts +0 -4
- package/lib/has-pkg.d.mts +0 -1
- package/lib/has-pkg.mjs +0 -1
- package/lib/info.mjs +0 -1
- package/lib/seo.mjs +0 -1
- package/lib/targets.mjs +0 -1
- package/lib/tsloader.config.d.mts +0 -1
- package/lib/tsloader.config.mjs +0 -0
- package/lib/utils.mjs +0 -2
- /package/lib/{build.common.d.mts → build/common.d.mts} +0 -0
- /package/lib/{build.server.d.mts → build/server.d.mts} +0 -0
- /package/lib/{dev-config.d.mts → dev/config.d.mts} +0 -0
- /package/lib/{dev-mock.d.mts → dev/mock.d.mts} +0 -0
- /package/lib/{net.d.mts → dev/net.d.mts} +0 -0
- /package/lib/{net.mjs → dev/net.mjs} +0 -0
- /package/lib/{dev-proxy.mjs → dev/proxy.mjs} +0 -0
- /package/lib/{polyfills.d.mts → polyfills/polyfills.d.mts} +0 -0
- /package/lib/{polyfills.mjs → polyfills/polyfills.mjs} +0 -0
- /package/lib/{targets.d.mts → polyfills/targets.d.mts} +0 -0
- /package/lib/{os-tmp-dir.d.mts → utils/os-tmp-dir.d.mts} +0 -0
- /package/lib/{os-tmp-dir.mjs → utils/os-tmp-dir.mjs} +0 -0
- /package/lib/{reactive-object.d.mts → utils/reactive-object.d.mts} +0 -0
- /package/lib/{reactive-object.mjs → utils/reactive-object.mjs} +0 -0
- /package/lib/{resolver-sync.d.mts → utils/resolver-sync.d.mts} +0 -0
- /package/lib/{resolver-sync.mjs → utils/resolver-sync.mjs} +0 -0
- /package/lib/{seo.d.mts → utils/seo.d.mts} +0 -0
- /package/lib/{svg-to-data-uri.d.mts → utils/svg-to-data-uri.d.mts} +0 -0
- /package/lib/{svg-to-data-uri.mjs → utils/svg-to-data-uri.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as n}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as o}from"../common.mjs";import{CONFIG as t}from"../config.mjs";import{getMinifyOption as l}from"../minify.mjs";import p from"../plugin/lightningcss-plugin.mjs";let{optimize:{MinChunkSizePlugin:s,ModuleConcatenationPlugin:u}}=m,a=r(o,{plugins:[new u,new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),t.splitChunk&&new s({minChunkSize:1e4}),t.bundleAnalyzer&&new n(t.bundleAnalyzer)].filter(Boolean),optimization:{splitChunks:t.splitChunk,runtimeChunk:t.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:!!t.minifier&&[new i(l(t.minifier?.type||"swc",t.minifier?.options)),new p]||[]}});export default a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"webpack-node-externals";import o from"webpackbar";import r from"../module.config.mjs";import{CUSTOMCONFIG as s}from"../paths.mjs";import{isLibrary as t}from"../process-env.mjs";import{resolveProgramPath as m}from"../utils/index.mjs";let a={entry:{main:m("site/ssr.tsx")},output:{path:m(`${t?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[s,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[e({allowlist:["react","react-dom","solid-js","@app","@moneko"]})],plugins:[new o({name:"Server"})],module:r(!0),target:"node"};export default a;
|
package/lib/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeDirAll as o}from"@moneko/mdx";import m from"webpack";import{merge as r}from"webpack-merge";import e from"webpackbar";import i from"./build
|
|
1
|
+
import{removeDirAll as o}from"@moneko/mdx";import m from"webpack";import{merge as r}from"webpack-merge";import e from"webpackbar";import i from"./build/common.mjs";import s from"./build/server.mjs";import{CONFIG as t}from"./config.mjs";import p from"./module.config.mjs";import n from"./paths.mjs";import a from"./plugin/done.mjs";import{SSR as f}from"./process-env.mjs";import l from"./utils/compiler-listener.mjs";import c from"./utils/log.mjs";import u from"./utils/seo.mjs";let j=[r(i,{module:p(!1),plugins:[t.done&&new a({done:t.done}),t.bar&&new e(t.bar)].filter(Boolean)})];f&&j.push(r(i,s));let[d,g]=m(j).compilers,h=[l("client",d)];async function w(){m(j).run((o,m)=>{if(o)throw o;m&&m.stats.forEach(o=>{o.compilation.warnings.forEach(o=>c(o.message)),o.compilation.errors.forEach(o=>c(o.message))})}),await Promise.all(h),t.seo&&u()}g&&h.push(l("server",g)),await w(),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
|
|
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 a,isDev as l,isLibrary as p}from"./process-env.mjs";import{resolveNodeModulesPath as c,resolveProgramPath as m}from"./utils/index.mjs";export const outputConfig={path:m(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${l?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:i,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${i}`,pathinfo:l,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let u={main:[e.polyfill&&`${o.corePath}/polyfills/replace-children.js`,c("@app/entry")].filter(Boolean)};e.entry&&("string"==typeof e.entry?u={main:[e.entry]}:Object.keys(e.entry)&&(u=Object.assign(u,e.entry))),"string"==typeof u.main&&(u.main=[u.main]),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let f=!1;e.cacheDirectory&&(f={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:a});let d=Object.assign({original:e.alias["@"],override:s&&m(s)},e.overrideResolve);export const commonConfig={devtool:e.devtool,entry:u,mode:l?"development":"production",stats:"errors-only",cache:f,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:!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],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new r(d),...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 t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import{FRAMEWORK as i,PACKAGENAME as
|
|
1
|
+
import{fileExists as e}from"@moneko/mdx";import{merge as t}from"webpack-merge";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import{FRAMEWORK as i,PACKAGENAME as r,isDev as n,isLibrary as a,isMobile as l,isSolid as m,jsxImportSource as p,mainDirectory as c}from"./process-env.mjs";import{isFunction as u,resolveProgramPath as d}from"./utils/index.mjs";import h from"./utils/log.mjs";import f from"./utils/read-conf.mjs";let g=["@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"],x={devtool:n?"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:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:l?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":d(c)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:o.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{CHANGELOG:{test:/CHANGELOG\.md/,priority:-10,name:"CHANGELOG",reuseExistingChunk:!0},prismjs:{test:/(prism\.js|prism\/css\.ts)/,priority:-10,name:"vendors-prismjs",reuseExistingChunk:!0},site:{test:/site/,priority:-10,reuseExistingChunk:!0},marked:{test:/marked/,priority:-10,reuseExistingChunk:!0},"n-katex":{test:/n-katex/,priority:-10,reuseExistingChunk:!0},"n-code-live":{test:/n-code-live/,priority:-10,reuseExistingChunk:!0},"@moneko":{test:/@moneko/,priority:-10,reuseExistingChunk:!0}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:g,js:g,media:g,font:g,wasm:[]},mdx:{jsx:!1,development:n,jsxImportSource:p,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:{},bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${o.httpCachePath}/http.lock`,cacheLocation:`${o.httpCachePath}/data`,upgrade:!0},virtualModule:{}};m&&(x.jsxDomExpressions={moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}),a&&(x.alias=Object.assign(x.alias,{"@pkg":o.componentsPath,[r]:o.componentsPath}));let C=x,k={},P={};if(e(o.configPath)){let e=(await f(o.configPath,"index")).default;k=u(e)?e(process):e}if(s&&e(o.customConfigPath)){let e=(await f(o.customConfigPath,s)).default;P=u(e)?e(process):e}(!1===(C=t(C,k,P)).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||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:s,log:h};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import t from"chalk";import{getIPv4 as o,getPort as e}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:$}=t,u=r.devServer||{},f=u.port||3e3;export const PORT=await e(f,65535,u.host);u.port=PORT;let d="/"===r.basename?"":r.basename,T=u.port!==PORT&&m(`Port ${i(f)} is in use, trying ${n(PORT)} instead.
|
|
2
|
+
`);function g(t){return`http://${"local"===t?u.host:o()}:${PORT}${d}`}let h=m("You application is running here:"),x=`${a(" Local ")} ${p(g("local"))}
|
|
3
|
+
${c(" Network ")} ${$(g("net"))}`;export function devLog(t,o){!t&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([h,"",x,"",l(`Compiled successfully in ${n(`${o.endTime-o.startTime}ms`)}`)]),T&&s(T))}export const headers={"Access-Control-Allow-Origin":"*"};
|
package/lib/dev/mock.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"http";import{watch as t}from"chokidar";import o from"express";import{mock as r}from"mock-json-schema";import{match as a}from"path-to-regexp";import{merge as s}from"webpack-merge";import n from"../utils/esm.mjs";import i from"../utils/log.mjs";import p from"../utils/tfc.mjs";function c(e,t,o){if(o[t]){for(let r in o[t])Object.prototype.hasOwnProperty.call(o[t],r)&&delete e[r];o[t]=null,delete o[t]}}export const yApiSchemaMock=(t,o)=>new Promise((a,n)=>{e.get(`${t.host}/api/interface/get?id=${t.id}&token=${t.token}`,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{let e=JSON.parse(t);if(e?.data?.res_body_is_json_schema){let t=JSON.parse(e.data.res_body),n=r(t);void 0!==o?a(s(n,o)):a(n)}}catch(e){n(e)}})})});export const yApiMock=(t,o)=>new Promise((r,a)=>{let s=new URL(o.host),n={hostname:s.hostname,port:s.port,path:t.path.replace(new RegExp(o.pathRewrite),`/mock/${o.projectId}/`),method:t.method,headers:t.headers,query:t.query},i=e.request(n,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{r(JSON.parse(t))}catch(e){a(e)}})});i.on("error",e=>{a(e.message)}),i.write(JSON.stringify(t.body)),i.end()});export default(e=>{let r={},s={};return t(e).on("all",async function(e,t){process.stdout.write("update mock...");let o={};switch(e){case"add":case"change":c(s,t,r),o=(await import(n`${p(t)}`)).default,r[t]=o,s=Object.assign(s,o);break;case"unlink":c(s,t,r)}i("update mock success")}),function(e,t,r){let n=`${e.method} ${e.path}`,i=Object.keys(s).filter(function(e){return RegExp(`^${e.replace(/(:\w*)[^/]/g,"((?!/).)")}*$`).test(n)});if(!s[n]&&(!i||!(i.length>0)))return r();{let p;let c=e.get("Content-Type");switch(c){case"text/plain":p=o.raw({type:"text/plain"});break;case"text/html":p=o.text({type:"text/html"});break;case"application/x-www-form-urlencoded":p=o.urlencoded({extended:!1});break;default:p=o.json()}c?.startsWith("multipart/form-data;")&&(p=o.static("./public")),p(e,t,function(){let o=s[n]||s[i[0]];if("function"==typeof o){let s=a(i[0].split(" ")[1])(e.url);s&&Object.assign(e.params,s.params),o(e,t,r)}else t.json(o)})}}});
|
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{directoryExists as e,removeDirAll as
|
|
1
|
+
import{directoryExists as e,removeDirAll as t}from"@moneko/mdx";import o from"cors";import i from"express";import r from"multer";import s from"webpack";import m from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import n from"webpackbar";import p from"./build/server.mjs";import{commonConfig as c}from"./common.mjs";import{CONFIG as d}from"./config.mjs";import{PORT as u,devLog as f,headers as h}from"./dev/config.mjs";import w from"./dev/mock.mjs";import g from"./dev/proxy.mjs";import x from"./module.config.mjs";import k from"./paths.mjs";import{SSR as j,isLibrary as b,isReact as y}from"./process-env.mjs";import $ from"./utils/compiler-listener.mjs";import v from"./utils/has-pkg.mjs";import{resolveProgramPath as _}from"./utils/index.mjs";let{HotModuleReplacementPlugin:P}=s,S=v("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,D=v("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,T=y&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,B=["js","jsx","ts","tsx","json","html","vue"],I=B.join(","),E=["css","scss","sass","less","ts","tsx","js","jsx"],F=E.join(","),G=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],M=new URLSearchParams({timeout:2e3,reload:!0,quiet:!0,noInfo:!0,overlay:!1,dynamicPublicPath:!0}).toString(),O=c.output.path;j&&(O=_(`${b?"docs":"dist"}/client`));let R=a(c,{entry:{main:[`webpack-hot-middleware/client?name=client&path=//localhost:${u}/__hmr__&${M}`]},output:{path:O},module:x(!1),plugins:[new P,T&&new T,D&&new D({fix:!0,threads:!0,files:[`${d.alias["@"]}/**/*.{${I}}`,b&&`${d.alias["@pkg"]}/**/*.{${I}}`].filter(Boolean),extensions:B,exclude:G,cache:!0,lintDirtyModulesOnly:!0}),S&&new S({fix:!0,threads:!0,files:[`${d.alias["@"]}/**/*.{${F}}`,b&&`${d.alias["@pkg"]}/**/*.{${F}}`].filter(Boolean),extensions:E,exclude:G,cache:!0,lintDirtyModulesOnly:!0}),d.bar&&new n(d.bar)].filter(Boolean)}),U=[R];j&&U.push(a(c,p));let[q,L]=s(U).compilers;q.hooks.done.tap("client",e=>{f(null,e)});let N=i(),z=r(),A=m(q,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:j});if(N.use(o()),N.use(A),N.use(l(q,{log:!1,path:"/__hmr__",heartbeat:2e3,ignoreUnaccepted:!1,ignoreDeclined:!0,ignoreErrored:!0})),d.proxy&&g(N,d.proxy),e(k.mockPath)){let e=w(k.mockPath);N.use(e)}let C=`${R.output.path}/index.html`;N.all("/*",z.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=A.context.outputFileSystem,o=e?.readFileSync?.(C);t.end(o)}});let H=[$("client",q)];L&&(L.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3,stdin:!0},f),H.push($("server",L))),await Promise.all(H),N.listen(u,()=>{}),process.on("exit",function(){t(k.cachePath)}),process.on("SIGINT",function(){process.exit()});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{PACKAGENAME as i,coreName as o}from"./process-env.mjs";import{resolveProgramPath as m}from"./utils/index.mjs";import{description as r,keywords as a}from"./vm/info.mjs";let p=t.htmlPluginOption||{},n=p.favicon||`node_modules/${o}/template/favicon.ico`,l=p.template||`node_modules/${o}/template/index.html`,s=e({title:t.env?.PROJECTNAME||i.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{minifyJS:!0,minifyCSS:!0,collapseWhitespace:!0,removeComments:!0,removeRedundantAttributes:!1,removeScriptTypeAttributes:!1,removeStyleLinkTypeAttributes:!1,removeAttributeQuotes:!0,useShortDoctype:!0},meta:{charset:"UTF-8","X-UA-Compatible":{"http-equiv":"X-UA-Compatible",content:"IE=edge,Chrome=1"},HandheldFriendly:"true",MobileOptimized:"320","screen-orientation":"portrait","x5-orientation":"portrait",browsermode:"application","x5-page-mode":"app","msapplication-tap-highlight":"no",viewport:"width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:r,keywords:a},tags:[]},p,{template:m(l),favicon:m(n)});export default s;
|
package/lib/index.d.mts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export { default as paths, CUSTOMCONFIG } from './paths.mjs';
|
|
2
2
|
export { PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.mjs';
|
|
3
|
-
export { realResolve, resolveNodeModulesPath, resolveProgramPath
|
|
4
|
-
export {
|
|
5
|
-
export { default as
|
|
3
|
+
export { realResolve, resolveNodeModulesPath, resolveProgramPath } from './utils/index.mjs';
|
|
4
|
+
export { default as log } from './utils/log.mjs';
|
|
5
|
+
export { default as hasPkg } from './utils/has-pkg.mjs';
|
|
6
|
+
export { default as osTmpDir } from './utils/os-tmp-dir.mjs';
|
|
6
7
|
export type { MdxOptions } from '@moneko/mdx';
|
|
7
8
|
export type { OverrideResolverOption } from './plugin/override-resolve.mjs';
|
|
9
|
+
export { type YApiOption, type YApiOptionBySchema, yApiMock, yApiSchemaMock, type RequestFormData, type ProxyFuncType, type MockConfiguration, } from './dev/mock.mjs';
|
|
10
|
+
export type { ProxyConfig } from './dev/proxy.mjs';
|
|
11
|
+
export { getIPv4, getPort } from './dev/net.mjs';
|
|
8
12
|
export type * from '../typings/global.js';
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as paths,CUSTOMCONFIG}from"./paths.mjs";export{PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveNodeModulesPath,resolveProgramPath
|
|
1
|
+
export{default as paths,CUSTOMCONFIG}from"./paths.mjs";export{PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{realResolve,resolveNodeModulesPath,resolveProgramPath}from"./utils/index.mjs";export{default as log}from"./utils/log.mjs";export{default as hasPkg}from"./utils/has-pkg.mjs";export{default as osTmpDir}from"./utils/os-tmp-dir.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{getIPv4,getPort}from"./dev/net.mjs";
|
package/lib/loader/ts-doc.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack";import{CONFIG as r}from"./config.mjs";import t from"./plugin/external-remotes.mjs";import{realResolve as o}from"./utils.mjs";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,
|
|
1
|
+
import e from"webpack";import{CONFIG as r}from"./config.mjs";import t from"./plugin/external-remotes.mjs";import{realResolve as o}from"./utils/index.mjs";let{NormalModuleReplacementPlugin:s,container:{ModuleFederationPlugin:a}}=e,i={},m={},l={},n=r.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,s=t.filename||"remote_entry.js";if(l[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)i[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?m[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(m[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:l,exposes:m})});n.length&&(n.push(new t),n.push(new s(/(.*)/,e=>{i[e.request]&&(e.request=i[e.request])})));export default n;
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import
|
|
1
|
+
let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import r from"./modify-vars.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{getLightningCssTargets as l}from"./polyfills/targets.mjs";import{FRAMEWORK as n,isDev as m,isLibrary as d,isMicro as c}from"./process-env.mjs";import p from"./swcrc.mjs";import u from"./utils/has-pkg.mjs";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils/index.mjs";import g from"./utils/svg-to-data-uri.mjs";import{comment as j,getCommentPath as x}from"./vm/docs.mjs";import $ from"./vm/generate-doc.mjs";let v=c?o:"../",h={loader:s.loader,options:{publicPath:"/"!==v?v:"../"}},w={loader:`${a.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!t.sourceMap,analyzeDependencies:!1,targets:l(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!t.rem}};m&&(h="style-loader");let b=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(f),_=["components","example","mock","site","src","server"].map(y);function k(e){return _.concat(t.rulesInclude?.[e]?.map(f)||[])}i&&_.push(y(i)),t.overrideResolve&&t.overrideResolve.override&&_.push(t.overrideResolve.override);let M=k("css"),B=k("js"),L=k("media"),O=k("wasm"),P=k("font");u("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});let R=d&&m&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:t.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${a.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:$,getCommentPath:x}};export default(s=>{let o={loader:"swc-loader",options:p(s)},i={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=b.length;s<t;s++)if(e&&e?.includes(b[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:s},importLoaders:2}},l=[h,i,w,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:r,javascriptEnabled:!0}}}].filter(Boolean);return{noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[R,{oneOf:[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:/\.wasm$/i,type:"webassembly/async",include:O},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:L},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>g(e.toString())},include:L},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:L},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:L},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:P},{test:/\.(sa|sc)ss$/i,use:[h,i,w,e].filter(Boolean),include:M},{test:/\.less$/i,use:l,include:M},{test:/\.css$/i,use:[h,"css-loader",w].filter(Boolean),include:M},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,o].filter(Boolean),include:B},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,{loader:`${a.corePath}/loader/mdx.cjs`,options:t.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules].filter(e=>"object"==typeof e)}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default class{constructor(t){this.test=t.test}apply(
|
|
1
|
+
import t from"html-webpack-plugin";export default class{constructor(t){this.test=t.test}apply(s){s.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",e=>{let a=s.options.plugins.find(s=>s instanceof t);a&&a.getHooks(e).alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&t.attributes.src&&this.test.test(t.attributes.src)&&(t.attributes.entry=!0)}),t))})}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.mjs";import{resolveNodeModulesPath as e}from"../utils.mjs";import{comment as r,docs as m}from"../vm/docs.mjs";import{examples as p}from"../vm/example.mjs";import{locales as s}from"../vm/locales.mjs";import i from"../vm/modules.mjs";import{route as a}from"../vm/routes.mjs";export default class{constructor(o={}){this.options=o,this.hasTapped=!1}apply(l){let n=this.options,f=new o(i);function c(o,t){let r=e(o);f.writeModule(r,t||"")}f.apply(l),a.on("change",c),s.on("change",c),t&&(p.on("change",c),m.on("change",c),r.on("change",c)),l.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,n)if(Object.prototype.hasOwnProperty.call(n,o)){let t=n[o];c(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of p)c(...o);for(let o of m)c(...o);for(let o of r)c(...o)}})}}
|
|
1
|
+
import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.mjs";import{resolveNodeModulesPath as e}from"../utils/index.mjs";import{comment as r,docs as m}from"../vm/docs.mjs";import{examples as p}from"../vm/example.mjs";import{locales as s}from"../vm/locales.mjs";import i from"../vm/modules.mjs";import{route as a}from"../vm/routes.mjs";export default class{constructor(o={}){this.options=o,this.hasTapped=!1}apply(l){let n=this.options,f=new o(i);function c(o,t){let r=e(o);f.writeModule(r,t||"")}f.apply(l),a.on("change",c),s.on("change",c),t&&(p.on("change",c),m.on("change",c),r.on("change",c)),l.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,n)if(Object.prototype.hasOwnProperty.call(n,o)){let t=n[o];c(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of p)c(...o);for(let o of m)c(...o);for(let o of r)c(...o)}})}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let r,t;import e from"browserslist";import{browserslistToTargets as s}from"lightningcss";import o from"../paths.mjs";export function getBrowsersTargets(){return r||(r=e(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP"))),r}export function getLightningCssTargets(){return t||(t=s(getBrowsersTargets())),t}
|
package/lib/swcrc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import s from"./polyfills.mjs";import{isDev as t,isReact as
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./config.mjs";import r from"./paths.mjs";import s from"./polyfills/polyfills.mjs";import{isDev as t,isReact as l,isSolid as n,jsxImportSource as i}from"./process-env.mjs";export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};let p=function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{}),m={include:s(),mode:"entry",coreJs:"3.34"};export default(s=>e({module:{type:"es6",resolveFully:!0},jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:l&&t,development:t,importSource:i},optimizer:{simplify:!1}},minify:t?void 0:swcMinifyOption,experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[["swc-plugin-another-transform-imports",p],n&&["@moneko/jsx-dom-expressions",{...o.jsxDomExpressions,generate:s?"ssr":"dom",hydratable:!!s}]].filter(Boolean)}},env:o.polyfill?m:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(t):o.swcrc||{}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"./log.mjs";export default function(r,a){return new Promise((e,s)=>{a.hooks.failed.tap(r,o=>{s(o)}),a.hooks.done.tap(r,r=>{r.hasErrors()||e(!0),r.compilation.warnings.forEach(r=>o(r.message)),r.compilation.errors.forEach(r=>o(r.message))})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function(t,...e){let r=t.raw[0];for(let a=0;a<e.length;a++)r+=e[a]+t.raw[a+1];return`data:text/javascript;base64,${Buffer.from(r).toString("base64")}`}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fileExists as o}from"@moneko/mdx";import{resolveNodeModulesPath as m}from"./index.mjs";export default function(r){return o(m(`${r}/package.json`))}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
|
-
export declare function esm(templateStrings: TemplateStringsArray, ...substitutions: unknown[]): string;
|
|
3
|
-
export declare function log(msg: string | string[]): void;
|
|
4
|
-
export declare function tfc(filepath: string): string;
|
|
5
|
-
export declare function readConf(src: string, name: string): Promise<any>;
|
|
6
1
|
export declare function toUpperCaseString(string: string): string;
|
|
7
2
|
type ProgramPath<T extends string> = `${T extends string ? T : string}`;
|
|
8
3
|
type NodeModulesPath<T> = ProgramPath<`node_modules/${T extends string ? T : string}`>;
|
|
@@ -24,5 +19,4 @@ export declare const realResolve: (url: string) => string;
|
|
|
24
19
|
export declare function isObject(target: unknown): target is object;
|
|
25
20
|
export declare function isFunction(target: unknown): target is (...args: unknown[]) => unknown;
|
|
26
21
|
export declare function empty(): void;
|
|
27
|
-
export declare function compilerListener(name: string, compiler: Compiler): Promise<unknown>;
|
|
28
22
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve as t}from"path";import e from"./resolver-sync.mjs";import o from"../paths.mjs";export function toUpperCaseString(t){return t?.replace(/\b\w/g,t=>t.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(e){return t(o.programPath,`./${e}`)}export const resolveNodeModulesPath=t=>`${o.nodeModules}/${t}`;export const realResolve=t=>e.resolveSync({},o.programPath,t)||t;export function isObject(t){let e=typeof t;return null!==t&&("object"==e||"function"==e)}export function isFunction(t){if(!isObject(t))return!1;let e=Object.prototype.toString.call(t);return"[object Function]"==e||"[object AsyncFunction]"==e||"[object GeneratorFunction]"==e||"[object Proxy]"==e}export function empty(){}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{saveFileSync as m}from"@moneko/mdx";import t from"./tfc.mjs";import o from"../paths.mjs";export default function(r,e){let f=`${o.cachePath}/${e}.mjs`;return m(f,t(r)),import(f)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{resolveProgramPath as e}from"./index.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{isLibrary as s,routeDir as n}from"../process-env.mjs";export default(()=>{let{domain:f,nojekyll:a,path:j}=i.seo||{},l=j&&e(j)||p?.path;if(!f||!l)return;let x=`https://${f}${i.basename}`;o(m(l,"CNAME"),f),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(n,x,t(n,s)).join("\n")),a&&o(m(l,".nojekyll"),"")});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{transformFileSync as e}from"@swc/core";let o={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export default function(r){return e(r,o).code||"{}"}
|
package/lib/vm/docs.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ReactiveObject from '../reactive-object.mjs';
|
|
1
|
+
import ReactiveObject from '../utils/reactive-object.mjs';
|
|
2
2
|
export declare const docsModuleName = "@app/docs";
|
|
3
3
|
export declare const docs: ReactiveObject<Record<string, string>>;
|
|
4
4
|
export declare const comment: ReactiveObject<Record<string, string>>;
|
package/lib/vm/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.mjs";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isLibrary as a,isReact as
|
|
1
|
+
import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.mjs";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isLibrary as a,isReact as s,isSolid as m}from"../process-env.mjs";import p from"../utils/reactive-object.mjs";let l={react:"createElement",solid:"createComponent"}[n];export const docsModuleName="@app/docs";export const docs=new p({[docsModuleName]:"export default {}"});export const comment=new p({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,t=r.alias["@pkg"].length;return o=>o.substring(t).replace(e,"@app/comment/$1.md")}();if(a){let a={},p=`import { ${l}${m?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${m?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${s?"() =>":""}${l}(${m?"Dynamic":"'n-md'"}, {text: res.default, ${m?"component: 'n-md', ":""}css: 'table td a {display:inline-flex;align-items:center;gap:2px;}table td a n-img{display:inline-block;overflow:hidden;border-radius:var(--border-radius);inline-size:18px;block-size:18px;}' })};}`,c=(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(() => ${l}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let s={};for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(s[e]=Object.values(a[e]));docs.setData(docsModuleName,`${p}export default ${JSON.stringify(s).replace(/"rr\((.+?)\)rr"/g,"$1")}`)};comment.on("change",(e,t)=>{c(e,t?.length<0)}),t(r.alias["@pkg"]).filter(e=>/^(?![._]).*(?<!\.test)\.(tsx?)$/i.test(e)).forEach(t=>{let r=e(t);r&&comment.setData(getCommentPath(t),o(r,t))})}
|
package/lib/vm/example.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ReactiveObject from '../reactive-object.mjs';
|
|
1
|
+
import ReactiveObject from '../utils/reactive-object.mjs';
|
|
2
2
|
export declare const exampleModuleName = "@app/example";
|
|
3
3
|
export declare const examples: ReactiveObject<Record<string, string>>;
|
|
4
4
|
export declare function generatorDemo(): void;
|
package/lib/vm/example.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateExample as e}from"@moneko/mdx";import{watchFiles as
|
|
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";export const exampleModuleName="@app/example";function a(){try{return JSON.parse(e(o.componentsPath,"@app/example/"))}catch(e){return{}}}export const examples=new p(m?a():{});export function generatorDemo(){let e=a();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t])}m&&r&&t(o.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
|
|
@@ -4,10 +4,10 @@ declare const app: {
|
|
|
4
4
|
ssr: boolean;
|
|
5
5
|
version: string;
|
|
6
6
|
base: string;
|
|
7
|
-
type: import("
|
|
7
|
+
type: import("../index.mjs").AppType;
|
|
8
8
|
routerMode: "browser" | "hash" | "memory";
|
|
9
9
|
prefixCls: string | undefined;
|
|
10
|
-
theme: import("
|
|
10
|
+
theme: import("../index.mjs").Theme | undefined;
|
|
11
11
|
description: any;
|
|
12
12
|
author: any;
|
|
13
13
|
repository: any;
|
package/lib/vm/info.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"../config.mjs";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s,SSR as i}from"../process-env.mjs";import{resolveProgramPath as p,toUpperCaseString as m}from"../utils/index.mjs";let{description:n,author:a,repository:c,keywords:d}=JSON.parse(e(p("package.json"))||"{}"),f="string"==typeof a,l={name:t,projectName:m(t).replace(/-/g," "),ssr:i,version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:n,author:f?{name:a}:a,repository:f?{url:c}:c};export const description=n;export const keywords=Array.isArray(d)?d.toString():"";export default l;
|
package/lib/vm/locales.d.mts
CHANGED
package/lib/vm/locales.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{basename as e,join as t}from"path";import{directoryExists as o,scanFolder as a}from"@moneko/mdx";import{watch as l}from"chokidar";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isDev as s}from"../process-env.mjs";import c from"../reactive-object.mjs";import
|
|
2
|
-
export function interpolateString(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
|
|
1
|
+
import{basename as e,join as t}from"path";import{directoryExists as o,scanFolder as a}from"@moneko/mdx";import{watch as l}from"chokidar";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isDev as s}from"../process-env.mjs";import c from"../utils/esm.mjs";import i from"../utils/reactive-object.mjs";import g from"../utils/tfc.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;'}[n];function p(e,t){return`${u[n]}
|
|
2
|
+
export function interpolateString(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 i({[localesModuleName]:p([],{})});let m={};async function d(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete m[a]:Object.assign(m,{[a]:(await import(c`${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(r.alias["@"],"./locales");o(z)&&(a(z).filter(e=>!/^\..*/.test(e)&&!/!\.ts$/.test(e)&&!/\.d\.ts$/.test(e)).forEach(e=>{d(e,"added")}),s&&function(e,t){let o=l(e,{ignored:t,persistent:!0,ignoreInitial:!0});function a(){o.unwatch(e),o.close()}o.on("add",e=>{d(e,"added")}),o.on("change",e=>{d(e,"change")}),o.on("unlink",e=>{d(e,"deleted")}),o.once("ready",()=>{s||a()}),process.on("SIGINT",a)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/]));
|
package/lib/vm/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as
|
|
1
|
+
import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as e,getAppMergeRouter as p,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as n,docsModuleName as l}from"./docs.mjs";import{exampleModuleName as x}from"./example.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as g}from"./locales.mjs";import{route as j,routesModuleName as u}from"./routes.mjs";import{CONFIG as h}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as k,FRAMEWORK as z}from"../process-env.mjs";import{resolveNodeModulesPath as D,resolveProgramPath as b}from"../utils/index.mjs";export default{[D("@app/info")]:`export default ${JSON.stringify(c)}`,[D("@app/entry")]:o(m(h.alias["@"],"./index.ts"),!!h.rem,!!h.normalizeCss,k,z),[D("@app/rem")]:s(h.rem?.designSize||1680),[D("@app/fallback")]:r(h.fallbackCompPath),[D("@app/coverage")]:f(v.coveragePath),[D("@app/merge-router")]:p(),[D("@app/prefix-router")]:a(),[D("@app/normalize/index.css")]:t(),[D("@app/suspense/index.tsx")]:i(k,z),[D("@app/mdx-scope")]:e(b("site/mdx-scope.ts")),[D(u)]:j.getData(u),[D(x)]:"export default []",[D(g)]:d.getData(g),[D(l)]:n.getData(l)};
|
package/lib/vm/routes.d.mts
CHANGED
package/lib/vm/routes.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.mjs";import{CONFIG as t}from"../config.mjs";import{FRAMEWORK as r,isDev as m,isLibrary as s,routeDir as u}from"../process-env.mjs";import n from"../reactive-object.mjs";let i=s?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(u,`${t.alias["@"]}/router/index.ts`,r,i,s)}export const route=new n({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}m&&e(u,s?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
|
|
1
|
+
import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.mjs";import{CONFIG as t}from"../config.mjs";import{FRAMEWORK as r,isDev as m,isLibrary as s,routeDir as u}from"../process-env.mjs";import n from"../utils/reactive-object.mjs";let i=s?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(u,`${t.alias["@"]}/router/index.ts`,r,i,s)}export const route=new n({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}m&&e(u,s?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.9.17-beta.
|
|
3
|
+
"version": "3.9.17-beta.13",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"swc-loader": "0.2.3",
|
|
38
38
|
"swc-plugin-another-transform-imports": "0.2.7",
|
|
39
39
|
"typescript": "5.3.3",
|
|
40
|
-
"webpack": "5.
|
|
40
|
+
"webpack": "5.89.0",
|
|
41
41
|
"webpack-bundle-analyzer": "4.10.1",
|
|
42
42
|
"webpack-dev-middleware": "6.1.1",
|
|
43
43
|
"webpack-hot-middleware": "2.25.4",
|
package/typings/global.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
2
2
|
import WebpackBar from 'webpackbar';
|
|
3
3
|
import type { BundleAnalyzerOption } from './bundle-analyzer.d';
|
|
4
|
-
import type { OverrideResolverOption } from '../lib/index';
|
|
4
|
+
import type { OverrideResolverOption, ProxyConfig } from '../lib/index';
|
|
5
5
|
import type { DonePluginOption } from '../lib/plugin/done';
|
|
6
6
|
import type { MdxOptions } from '@moneko/mdx';
|
|
7
7
|
import type { Config as SwcConfig, JsMinifyOptions as SwcMinifyOptions } from '@swc/core';
|
|
8
8
|
import type { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
|
|
9
9
|
import type { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
10
|
-
import type { Options as ProxyConfig } from 'http-proxy-middleware';
|
|
11
10
|
import type { MinifyOptions as TerserMinifyOptions } from 'terser';
|
|
12
11
|
import type {
|
|
13
12
|
Configuration,
|
|
@@ -165,7 +164,7 @@ export declare type ConfigType = {
|
|
|
165
164
|
/** 按需引入 */
|
|
166
165
|
importOnDemand?: SwcImportOnDemandTransform;
|
|
167
166
|
/** 开发服务器代理 */
|
|
168
|
-
proxy?:
|
|
167
|
+
proxy?: ProxyConfig;
|
|
169
168
|
/** 自定义缓存目录,为 false 时,不使用缓存 */
|
|
170
169
|
cacheDirectory?: string | false;
|
|
171
170
|
/** 开发服务器设置 */
|
package/lib/build.common.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import i from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as n}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{commonConfig as o}from"./common.mjs";import{CONFIG as t}from"./config.mjs";import{getMinifyOption as l}from"./minify.mjs";import p from"./plugin/lightningcss-plugin.mjs";let{optimize:{MinChunkSizePlugin:s,ModuleConcatenationPlugin:u}}=m,a=r(o,{plugins:[new u,new e({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),t.splitChunk&&new s({minChunkSize:1e4}),t.bundleAnalyzer&&new n(t.bundleAnalyzer)].filter(Boolean),optimization:{splitChunks:t.splitChunk,runtimeChunk:t.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:!!t.minifier&&[new i(l(t.minifier?.type||"swc",t.minifier?.options)),new p]||[]}});export default a;
|
package/lib/build.server.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"webpack-node-externals";import o from"webpackbar";import r from"./module.config.mjs";import{CUSTOMCONFIG as s}from"./paths.mjs";import{isLibrary as t}from"./process-env.mjs";import{resolveProgramPath as m}from"./utils.mjs";let a={entry:{main:m("site/ssr.tsx")},output:{path:m(`${t?"docs":"dist"}/server`),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[chunkhash].cjs",globalObject:"global"},cache:{type:"filesystem",name:[s,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externalsPresets:{node:!0},externals:[e({allowlist:["react","react-dom","solid-js","@app","@moneko"]})],plugins:[new o({name:"Server"})],module:r(!0),target:"node"};export default a;
|
package/lib/dev-config.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import t from"chalk";import{CONFIG as o}from"./config.mjs";import{getIPv4 as e,getPort as r}from"./net.mjs";import{log as s}from"./utils.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=t,u=o.devServer||{},f=u.port||3e3;export const PORT=await r(f,65535,u.host);u.port=PORT;let d="/"===o.basename?"":o.basename,T=u.port!==PORT&&m(`Port ${i(f)} is in use, trying ${n(PORT)} instead.
|
|
2
|
-
`);function h(t){return`http://${"local"===t?u.host:e()}:${PORT}${d}`}let x=m("You application is running here:"),O=`${a(" Local ")} ${p(h("local"))}
|
|
3
|
-
${c(" Network ")} ${$(h("net"))}`;export function devLog(t,o){!t&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([x,"",O,"",l(`Compiled successfully in ${n(`${o.endTime-o.startTime}ms`)}`)]),T&&s(T))}export const headers={"Access-Control-Allow-Origin":"*"};
|
package/lib/dev-mock.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"http";import{watch as t}from"chokidar";import o from"express";import{mock as r}from"mock-json-schema";import{match as a}from"path-to-regexp";import{merge as n}from"webpack-merge";import{esm as s,log as i,tfc as c}from"./utils.mjs";function p(e,t,o){if(o[t]){for(let r in o[t])Object.prototype.hasOwnProperty.call(o[t],r)&&delete e[r];o[t]=null,delete o[t]}}export const yApiSchemaMock=(t,o)=>new Promise((a,s)=>{e.get(`${t.host}/api/interface/get?id=${t.id}&token=${t.token}`,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{let e=JSON.parse(t);if(e?.data?.res_body_is_json_schema){let t=JSON.parse(e.data.res_body),s=r(t);void 0!==o?a(n(s,o)):a(s)}}catch(e){s(e)}})})});export const yApiMock=(t,o)=>new Promise((r,a)=>{let n=new URL(o.host),s={hostname:n.hostname,port:n.port,path:t.path.replace(new RegExp(o.pathRewrite),`/mock/${o.projectId}/`),method:t.method,headers:t.headers,query:t.query},i=e.request(s,e=>{e.setEncoding("utf8");let t="";e.on("data",e=>{t+=e}),e.on("end",()=>{try{r(JSON.parse(t))}catch(e){a(e)}})});i.on("error",e=>{a(e.message)}),i.write(JSON.stringify(t.body)),i.end()});export default(e=>{let r={},n={};return t(e).on("all",async function(e,t){process.stdout.write("update mock...");let o={};switch(e){case"add":case"change":p(n,t,r),o=(await import(s`${c(t)}`)).default,r[t]=o,n=Object.assign(n,o);break;case"unlink":p(n,t,r)}i("update mock success")}),function(e,t,r){let s=`${e.method} ${e.path}`,i=Object.keys(n).filter(function(e){return RegExp(`^${e.replace(/(:\w*)[^/]/g,"((?!/).)")}*$`).test(s)});if(!n[s]&&(!i||!(i.length>0)))return r();{let c;let p=e.get("Content-Type");switch(p){case"text/plain":c=o.raw({type:"text/plain"});break;case"text/html":c=o.text({type:"text/html"});break;case"application/x-www-form-urlencoded":c=o.urlencoded({extended:!1});break;default:c=o.json()}p?.startsWith("multipart/form-data;")&&(c=o.static("./public")),c(e,t,function(){let o=n[s]||n[i[0]];if("function"==typeof o){let n=a(i[0].split(" ")[1])(e.url);n&&Object.assign(e.params,n.params),o(e,t,r)}else t.json(o)})}}});
|
package/lib/dev-proxy.d.mts
DELETED
package/lib/has-pkg.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function hasPkg(name: string): boolean;
|
package/lib/has-pkg.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{fileExists as o}from"@moneko/mdx";import{resolveNodeModulesPath as m}from"./utils.mjs";export function hasPkg(r){return o(m(`${r}/package.json`))}
|
package/lib/info.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"./config.mjs";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s,SSR as p}from"./process-env.mjs";import{resolveProgramPath as i,toUpperCaseString as m}from"./utils.mjs";let{description:n,author:a,repository:c,keywords:d}=JSON.parse(e(i("package.json"))||"{}"),f="string"==typeof a,l={name:t,projectName:m(t).replace(/-/g," "),ssr:p,version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:n,author:f?{name:a}:a,repository:f?{url:c}:c};export const description=n;export const keywords=Array.isArray(d)?d.toString():"";export default l;
|
package/lib/seo.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{outputConfig as e}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{isLibrary as i,routeDir as s}from"./process-env.mjs";import{resolveProgramPath as f}from"./utils.mjs";export default(()=>{let{domain:n,nojekyll:a,path:j}=p.seo||{},l=j&&f(j)||e?.path;if(!n||!l)return;let x=`https://${n}${p.basename}`;o(m(l,"CNAME"),n),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(s,x,t(s,i)).join("\n")),a&&o(m(l,".nojekyll"),"")});
|
package/lib/targets.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let r,t;import e from"browserslist";import{browserslistToTargets as s}from"lightningcss";import o from"./paths.mjs";export function getBrowsersTargets(){return r||(r=e(void 0,{path:o.programPath,env:process.env.NODE_ENV}).filter(r=>!r.endsWith(" TP"))),r}export function getLightningCssTargets(){return t||(t=s(getBrowsersTargets())),t}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/tsloader.config.mjs
DELETED
|
File without changes
|
package/lib/utils.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{resolve as o}from"path";import r from"readline";import{saveFileSync as t}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.mjs";import s from"./resolver-sync.mjs";export function esm(o,...r){let t=o.raw[0];for(let e=0;e<r.length;e++)t+=r[e]+o.raw[e+1];return`data:text/javascript;base64,${Buffer.from(t).toString("base64")}`}let c={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(o){Array.isArray(o)?o.forEach(o=>{log(`${o}
|
|
2
|
-
`)}):(r.cursorTo(process.stdout,0),process.stdout.write(o))}export function tfc(o){return e(o,c).code||"{}"}export function readConf(o,r){let e=`${n.cachePath}/${r}.mjs`;return t(e,tfc(o)),import(e)}export function toUpperCaseString(o){return o?.replace(/\b\w/g,o=>o.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return o(n.programPath,`./${r}`)}export const resolveNodeModulesPath=o=>`${n.nodeModules}/${o}`;export const realResolve=o=>s.resolveSync({},n.programPath,o)||o;export function isObject(o){let r=typeof o;return null!==o&&("object"==r||"function"==r)}export function isFunction(o){if(!isObject(o))return!1;let r=Object.prototype.toString.call(o);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}export function compilerListener(o,r){return new Promise((t,e)=>{r.hooks.failed.tap(o,o=>{e(o)}),r.hooks.done.tap(o,r=>{r.hasErrors()||t(!0),r.compilation.warnings.forEach(r=>log([o,r.message])),r.compilation.errors.forEach(r=>log([o,r.message]))})})}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|