@moneko/core 3.17.9-beta.1 → 3.17.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/build.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev.mjs +1 -1
- package/lib/module.config.mjs +1 -1
- package/lib/plugin/copy.mjs +1 -1
- package/lib/plugin/override-resolve.mjs +1 -1
- package/lib/utils/read-conf.mjs +1 -1
- package/lib/utils/seo.mjs +1 -1
- package/lib/vm/coverage.mjs +1 -1
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/locales.mjs +2 -2
- package/lib/vm/modules.mjs +1 -1
- package/package.json +1 -2
package/lib/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"webpack";import{merge as
|
|
1
|
+
import{removeDirAll as o}from"@moneko/mdx";import r from"webpack";import{merge as t}from"webpack-merge";import m from"./build/common.mjs";import e from"./build/server.mjs";import{CONFIG as i}from"./config.mjs";import s from"./module.config.mjs";import n from"./paths.mjs";import l from"./plugin/done.mjs";import{SSR as a}from"./process-env.mjs";import p from"./utils/log.mjs";import f from"./utils/seo.mjs";import c from"./utils/progress.mjs";import g from"chalk";let{ProgressPlugin:u}=r,h=!!i.bar,d=t(m,{module:s(!1),plugins:[i.done&&new l({done:i.done}),new u({handler(o,r,...t){let m=i.bar||{};c({showBar:h,percentage:o,title:m.name||"Build",color:m.color,info:t.length?`[${r}] ${t.join(" ")}`:"",output:d.output?.path})}})].filter(Boolean)}),j=[d];a&&j.push(t(m,e));let w=r(j);async function b(){await new Promise(o=>{w.run((r,t)=>{if(r)throw r;if(t&&(t.hasErrors()||t.hasWarnings()))for(let o=0,r=t.stats.length;o<r;o++){let r=t.stats[o];for(let o=0,t=r.compilation.warnings.length;o<t;o++)p(g.yellowBright(r.compilation.warnings[o].message));for(let o=0,t=r.compilation.errors.length;o<t;o++)p(g.redBright(r.compilation.errors[o].message))}o(r)})}),i.seo&&f()}await b(),process.on("exit",function(){o(n.cachePath)});
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import i,{CUSTOMCONFIG as r}from"./paths.mjs";import{APPTYPE as n,FRAMEWORK as a,NODE_ENV as l,PACKAGENAME as m,isDev as p,isLibrary as c,isMobile as u,jsxImportSource as d,mainDirectory as f}from"./process-env.mjs";import{isFunction as h,resolveProgram as g}from"./utils/index.mjs";import x from"./utils/read-conf.mjs";import v from"./utils/setup-env.mjs";let P=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],w={devtool:p?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:v(l,n,a),basename:"/",publicPath:"/",rem:{designSize:u?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(f)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},cacheDirectory:i.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:P,js:P,media:P,font:P,wasm:[]},mdx:{jsx:!1,development:p,jsxImportSource:d,providerImportSource:`@moneko/${a}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{}};async function j(o,t){if(t&&e(o)){let e=(await x(o,t)).default;return h(e)?e(process):e}return{}}c&&(w.alias=Object.assign(w.alias,{"@pkg":i.componentsPath,[m]:i.componentsPath}));let k=w;(!1===(k=o(k,await j(i.configPath,"index"),await j(i.customConfigPath,r))).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}));export const CONFIG=k;export const PUBLICPATH=CONFIG.publicPath||"/";
|
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"express";import
|
|
1
|
+
import{directoryExists as e,fileExists as t,loadFileSync as o,removeDirAll as i}from"@moneko/mdx";import s from"express";import r from"multer";import l from"webpack";import n from"webpack-dev-middleware";import m from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import c from"./build/server.mjs";import{commonConfig as p}from"./common.mjs";import{CONFIG as f}from"./config.mjs";import{PORT as u,devLog as d,headers as h}from"./dev/config.mjs";import g from"./dev/mock.mjs";import w from"./dev/proxy.mjs";import x from"./module.config.mjs";import j,{CUSTOMCONFIG as $}from"./paths.mjs";import{SSR as k,isLibrary as y,isReact as b}from"./process-env.mjs";import v from"./utils/has-pkg.mjs";import{empty as P,resolveProgram as _}from"./utils/index.mjs";import S from"./utils/progress.mjs";import C from"./utils/sigint-exit.mjs";import B from"./options/reslove.mjs";import{watchFile as M}from"fs";import{spawn as D,exec as G}from"child_process";import I from"./utils/log.mjs";import L from"chalk";let{HotModuleReplacementPlugin:U,ProgressPlugin:A,WatchIgnorePlugin:F}=l,H=v("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,O=v("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,R=b&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,T=["js","jsx","ts","tsx","json","html","vue"],q=T.join(","),E=["css","scss","sass","less","ts","tsx","js","jsx"],N=E.join(","),z=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=new URLSearchParams({timeout:2e3,reload:!(v("solid-refresh")||v("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),K=p.output.path;k&&(K=_(`${y?"docs":"dist"}/client`));let Q=!!f.bar,V=a(p,{entry:{main:[`${B.hotMiddlewareClient}?name=client&path=//localhost:${u}/__hmr__&${J}`]},output:{path:K},module:x(!1),plugins:[new U,new F({paths:[/\.d\.ts$/]}),R&&new R,O&&new O({fix:!0,threads:!0,files:[`${f.alias["@"]}/**/*.{${q}}`,y&&`${f.alias["@pkg"]}/**/*.{${q}}`].filter(Boolean),extensions:T,exclude:z,cache:!0,cacheLocation:`${j.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),H&&new H({fix:!0,threads:!0,files:[`${f.alias["@"]}/**/*.{${N}}`,y&&`${f.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:E,exclude:z,cache:!0,cacheLocation:`${j.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new A({handler(e,t,...o){let i=f.bar||{};S({showBar:Q,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:V.output?.path})}})].filter(Boolean)}),W=[V];k&&W.push(a(p,c));let X=l(W);X.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let Y=s(),Z=r(),ee=n(X,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:k,lastModified:!0});if(Y.use(ee),Y.use(m(X,{log:!1,path:"/__hmr__",heartbeat:2e3})),f.proxy&&w(Y,f.proxy),e(j.mockPath)){let e=g(j.mockPath);Y.use(e)}let et=`${V.output.path}/index.html`;Y.all("/*",Z.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=ee.context.outputFileSystem,o=e?.readFileSync?.(et);t.end(o)}});let eo=Y.listen(u,()=>{});function ei(){process.exit(0)}function es(e,i){if(i&&t(e)){let t=(o(e)||"").trim().replace(/^\s*[\r\n]/gm,"");M(e,async function(){t!==(o(e)||"").trim().replace(/^\s*[\r\n]/gm,"")?(I(L.yellow(`检测到工程配置${L.blue(`[${i}]`)}变更, 程序即将重启...`)),G("win32"===process.platform?`netstat -ano | findstr :${u}`:`lsof -i :${u}`,(e,t,o)=>{let i=er?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):I(`未找到占用端口 ${u} 的进程`)})):I(L.gray(`未变更`))})}}es(j.configPath,"index"),es(j.customConfigPath,$);let er="win32"===process.platform;process.on("SIGHUP",function(){ee.close(P),eo.close(P),eo.closeAllConnections(),function(){let e=D(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",ei)}()}),process.on("exit",function(){ee.close(P),eo.close(P),eo.closeAllConnections(),i(j.cachePath)}),C(ei);
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import{CONFIG as s}from"./config.mjs";import o from"./options/modify-vars.mjs";import t from"./options/swcrc.mjs";import r,{CUSTOMCONFIG as n}from"./paths.mjs";import{getLightningCssTargets as a}from"./polyfills/targets.mjs";import{FRAMEWORK as i,isDev as l,isLibrary as m}from"./process-env.mjs";import d from"./rule.mjs";import c from"./utils/has-pkg.mjs";import{node_modules as
|
|
1
|
+
let e;import{CONFIG as s}from"./config.mjs";import o from"./options/modify-vars.mjs";import t from"./options/swcrc.mjs";import r,{CUSTOMCONFIG as n}from"./paths.mjs";import{getLightningCssTargets as a}from"./polyfills/targets.mjs";import{FRAMEWORK as i,isDev as l,isLibrary as m}from"./process-env.mjs";import d from"./rule.mjs";import c from"./utils/has-pkg.mjs";import{node_modules as p,resolveProgram as u}from"./utils/index.mjs";import f from"./utils/svg-to-data-uri.mjs";import{comment as j,getCommentPath as y}from"./vm/docs.mjs";import v from"./vm/generate-doc.mjs";import g from"./options/css-extract.mjs";import{saveFile as h}from"@moneko/mdx";import x from"./utils/reactive-object.mjs";import _ from"./options/reslove.mjs";let w={loader:`${r.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!s.sourceMap,analyzeDependencies:!1,targets:a(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!s.rem}},L={loader:_.lessLoader,options:{sourceMap:!!s.sourceMap,lessOptions:{modifyVars:o,javascriptEnabled:!0}}},$=[...s.cssModules,`@moneko/${i}`,"neko-ui"].map(p),k=["components","example","mock","site","src","server"].map(u);function M(e){return[...k,...s.rulesInclude?.[e]?.map(p)||[]]}n&&k.push(u(n)),s.overrideResolve&&s.overrideResolve.override&&k.push(s.overrideResolve.override);let P=M("css"),O=M("js"),b=M("media"),R=M("wasm"),B=M("font");_.sassLoader&&(e={loader:_.sassLoader,options:{implementation:await import("sass"),sassOptions:{}}});let D=m&&l&&{test:d.tsdoc,include:s.alias["@pkg"],exclude:[d.node_modules,d.__tests__],enforce:"pre",loader:`${r.corePath}/loader/ts-doc.cjs`,options:{comment:j,generateDoc:v,getCommentPath:y}},S=[{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:d.wasm,type:"webassembly/async",include:R},{test:d.txt,type:"asset/source"},{test:d.ico,type:"asset/inline",include:b},{test:d.svg,type:"asset/inline",generator:{dataUrl:e=>f(e.toString())},include:b},{test:d.image,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:b},{test:d.video,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:b},{test:d.font,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:B}],I=s.prefixJsLoader.filter(Boolean)||[];l?c("solid-refresh")&&"solid"===i&&I.unshift(`${r.corePath}/loader/solid-refresh.cjs`):c("@moneko/css")&&I.unshift(`${r.corePath}/loader/css-in-js-minify.cjs`);let J=new x({});function N(e){J.setData(`${e.resourcePath}.d.ts`,e.exports.map(({name:e,value:s})=>`export const ${e}: '${s}';`).join("\n")+"\n")}J.on("change",(e,s)=>{h(e,s)});export default(o=>{let n={loader:_.swcLoader,options:t(o)},a={loader:_.cssLoader,options:{modules:{auto:e=>{if(e){for(let s=0,o=$.length;s<o;s++)if(e.includes($[s]))return d.css_module.test(e)}return d.node_modules_css_module.test(e)},localIdentName:"[path][name]_[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:o,getJSON:s.cssModuleDefinition?N:void 0},importLoaders:2}};return{noParse:d.no_parse,rules:[D,{oneOf:[...S,{test:d.js,use:[...I,n],include:O},{test:d.css,use:[g,_.cssLoader,w],include:P},e&&{test:d.scss,use:[g,a,w,e],include:P},{test:d.less,use:[g,a,w,L],include:P},{test:d.markdown,use:[...I,{loader:`${r.corePath}/loader/mdx.cjs`,options:s.mdx}],exclude:[d.node_modules]}].filter(Boolean)},...s.moduleRules].filter(Boolean)}});
|
package/lib/plugin/copy.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{loadFile as t,scanFolder as i}from"@moneko/mdx";import{basename as o,resolve as p}from"path";import e from"../utils/log.mjs";export class CopyPlugin{constructor(t){this.option=t}async writeFile(i,l){let r=l.compiler.outputFileSystem;if(r){let s=o(i),a=await t(p(i));r.writeFile(p(l.outputOptions.path,s),a,t=>{t&&e(`Error copying file ${s} to output directory: ${t}`)})}}apply(t){t.hooks.emit.tapPromise({name:"CopyPlugin",stage:t.webpack.Compilation.PROCESS_ASSETS_STAGE_REPORT},async t=>{if(this.option&&t.compiler.outputFileSystem){let o=[...this.option.files||[],...this.option.dirs?.flatMap(t=>i(t))||[]];await Promise.all(o.map(i=>this.writeFile(i,t)))}})}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{relative as e}from"path";import
|
|
1
|
+
import{relative as e}from"path";import{fileExists as t}from"@moneko/mdx";import r from"../paths.mjs";let o="OverrideResolverPlugin";export default class{constructor(e){this.options=e}apply(a){let i=a.ensureHook("resolved"),{override:s,original:l}=this.options;if(s&&l){let p=`./${e(r.programPath,l)}`,n=`./${e(r.programPath,s)}`;a.getHook("existing-file").tapAsync(o,(e,r,h)=>{let m=e.request||e.path;if(m&&m.startsWith(l)&&e.relativePath){let u=m.replace(l,s);if(t(u)){let t=e.relativePath.replace(p,n);return Object.assign(e,{path:u,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),a.doResolve(i,e,`${o} 使用目标模块${s}`,r,h)}}return h()})}}}
|
package/lib/utils/read-conf.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{updateFileSync as
|
|
1
|
+
import{updateFileSync as m}from"@moneko/mdx";import t from"./tfc.mjs";import o from"../paths.mjs";async function r(r,e){let f=`${o.cachePath}/${e}.mjs`;return m(f,t(r)),import(f)}export default r;
|
package/lib/utils/seo.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as m}from"path";import{
|
|
1
|
+
import{join as m}from"path";import{saveFileSync as o,scanRouter as t,sitemap as r}from"@moneko/mdx";import{resolveProgram as e}from"./index.mjs";import{outputConfig as p}from"../common.mjs";import{CONFIG as i}from"../config.mjs";import{routeDir as s}from"../paths.mjs";import{isLibrary as f}from"../process-env.mjs";export default(()=>{let{domain:n,jekyll:a,path:j}=i.seo||{},l=j&&e(j)||p?.path;if(!n||!l)return;let x=`https://${n}${i.basename}`;o(m(l,"CNAME"),n),o(m(l,"robots"),`Sitemap: ${x}/sitemap.txt`),o(m(l,"sitemap.txt"),r(s,x,t(s,f)).join("\n")),a||o(m(l,".nojekyll"),"")});
|
package/lib/vm/coverage.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fileExists as e,loadFileSync as t}from"@moneko/mdx";import{Parser as r}from"xml2js";import{PACKAGENAME as o}from"../process-env.mjs";export default function(i){let a={},n="export default {}";if(e(i))try{let e=t(i);(0,new r({explicitArray:!1,async:!1}).parseString)(e,(e,t)=>{if(!e){let{metrics:e,package:r}=t.coverage.project;Object.assign(a,{[o]:e.$});for(let e=0,t=r.length;e<t;e++){let t=r[e];Object.assign(a,{[t.$.name]:t.metrics.$})}}n=`export default ${JSON.stringify(a)}`})}catch(e){}return n}
|
package/lib/vm/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./generate-doc.mjs";import{CONFIG 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 m,isReact as a,isSolid as s}from"../process-env.mjs";import l from"../utils/reactive-object.mjs";import p from"../rule.mjs";let c={react:"createElement",solid:"createComponent"}[n];export const docsModuleName="@app/docs";export const docs=new l({[docsModuleName]:"export default {}"});export const comment=new l({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,t=r.alias["@pkg"]?.length;return o=>o.substring(t).replace(e,"@app/comment/$1.md")}();if(m){let m={},l=`import { ${c}${s?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${s?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${a?"() =>":""}${c}(${s?"Dynamic":"'n-md'"}, {text: res.default, ${s?"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;}' })};}`,i=(e,t)=>{let o=e.replace(/^@app\/comment\//,"").split("/"),r=o.pop(),n=o.join("/");m[n]||(m[n]={}),t?m[n][r]&&delete m[n][r]:m[n][r]=`rr(() => ${c}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let a={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&(a[e]=Object.values(m[e]));docs.setData(docsModuleName,`${l}export default ${JSON.stringify(a).replace(p.extract_func,"$1")}`)};comment.on("change",(e,t)=>{i(e,t?.length<0)});let d=t(r.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e));for(let t=0,r=d.length;t<r;t++){let r=d[t],n=e(r);n&&comment.setData(getCommentPath(r),o(n,r))}}
|
package/lib/vm/locales.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{basename as e,join as t}from"path";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);${
|
|
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";import u from"../utils/sigint-exit.mjs";let f={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},m={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`${f[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);${m}`}export const localesModuleName="@app/locales";export const locales=new i({[localesModuleName]:p([],{})});let d={};async function z(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete d[a]:Object.assign(d,{[a]:(await import(c`${g(t)}`)).default});let l=[],r={};for(let e in d)if(Object.prototype.hasOwnProperty.call(d,e)){let{language:t=a,title:o=t,icon:n,translation:s={}}=d[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 b=t(r.alias["@"],"./locales");if(o(b)){let e=a(b,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(e=>z(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=>{z(e,"added")}),o.on("change",e=>{z(e,"change")}),o.on("unlink",e=>{z(e,"deleted")}),o.once("ready",()=>{s||a()}),u(a)}(b,[/^\..*/,/!\.ts$/,/\.d\.ts$/])}
|
package/lib/vm/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as p}from"path";import{getAppEntry as t,getAppFallback as e,getAppMdxScope as o,getAppMergeRouter as r,getAppNormalizeCss as
|
|
1
|
+
import{join as p}from"path";import{getAppEntry as t,getAppFallback as e,getAppMdxScope as o,getAppMergeRouter as r,getAppNormalizeCss as a,getAppPrefixRouter as s,getAppRem as m,getAppSuspense as i,updateFile as f}from"@moneko/mdx";import n from"./coverage.mjs";import{docs as l,docsModuleName as x}from"./docs.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as j}from"./locales.mjs";import{route as g,routesModuleName as u}from"./routes.mjs";import{CONFIG as _}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 $ from"../utils/has-pkg.mjs";let b=$(p(_.alias["@"],"./mdx-scope.tsx"))||$(p(_.alias["@"],"./mdx-scope.ts")),z={app_env:k("@app/env.ts"),app_info:k("@app/info.ts"),app_entry:k("@app/entry.ts"),app_mdx_scope:k("@app/mdx-scope.tsx")},D={[z.app_env]:`export default ${JSON.stringify(_.env)}`,[z.app_info]:`export default ${JSON.stringify(c)}`,[z.app_entry]:t(p(_.alias["@"],"./index.ts"),!!_.rem,!!_.normalizeCss,y,h),[k("@app/rem")]:m(_.rem?.designSize||1680),[k("@app/fallback")]:e(_.fallbackCompPath),[k("@app/coverage")]:n(v.coveragePath),[k("@app/merge-router")]:r(),[k("@app/prefix-router")]:s(),[k("@app/normalize/index.css")]:a(),[k("@app/suspense/index.tsx")]:i(y,h),[z.app_mdx_scope]:b?o(b):"export default {}",[k(u)]:g.getData(u),[k(j)]:d.getData(j),[k(x)]:l.getData(x)},P=/\.tsx?/,S=/\.(j|t)sx?$/;for(let p in z)if(Object.prototype.hasOwnProperty.call(z,p)){let t=z[p];S.test(t)&&f(t.replace(P,".d$&"),O(D[t],t))}export default D;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.17.9
|
|
3
|
+
"version": "3.17.9",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@babel/core": "7.24.5",
|
|
15
15
|
"@moneko/mdx": "0.1.29",
|
|
16
|
-
"@moneko/utils": "0.1.1",
|
|
17
16
|
"@moneko/transform-imports": "0.5.1",
|
|
18
17
|
"@swc/core": "1.5.7",
|
|
19
18
|
"@typescript/vfs": "1.5.0",
|