@moneko/core 3.17.45 → 3.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common.mjs +1 -1
- package/lib/config.mjs +1 -1
- package/lib/dev/mock.mjs +1 -1
- package/lib/options/html-plugin-option.mjs +1 -1
- package/lib/plugin/lightningcss-plugin.mjs +1 -1
- package/lib/process-env.d.mts +2 -0
- package/lib/process-env.mjs +1 -1
- package/lib/utils/index.d.mts +1 -1
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/require.mjs +1 -1
- package/lib/utils/vts.d.mts +13 -1
- package/lib/utils/vts.mjs +1 -1
- package/lib/vm/info.d.mts +0 -2
- package/lib/vm/info.mjs +1 -1
- package/lib/vm/locales.mjs +1 -1
- package/package.json +2 -2
- package/lib/utils/read-conf.d.mts +0 -1
- package/lib/utils/read-conf.mjs +0 -0
- package/lib/utils/tfc.d.mts +0 -1
- package/lib/utils/tfc.mjs +0 -0
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as
|
|
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=!1;p(e.cache)&&(j=Object.assign({type:"filesystem",allowCollectingMemory:!0,cacheDirectory:o.webpackCachePath,memoryCacheUnaffected:!0,name:[a,process.env.NODE_ENV].filter(Boolean).join("-"),version:`${r}`},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};
|
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
|
|
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 i,FRAMEWORK as r,NODE_ENV as n,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=["@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"],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(n,i,r),basename:"/",publicPath:"auto",rem:{designSize:p?375:1680},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/${r}/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(".js")}};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 k=P;(!1===(k=e(k,j(s.configPath),j(s.customConfigPath))).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}));export const CONFIG=k;export const PUBLICPATH=CONFIG.publicPath||"auto";
|
package/lib/dev/mock.mjs
CHANGED
|
@@ -1 +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{merge as a}from"webpack-merge";import s from"../utils/log.mjs";import n from"../utils/match-path.mjs";import
|
|
1
|
+
import e from"http";import{watch as t}from"chokidar";import o from"express";import{mock as r}from"mock-json-schema";import{merge as a}from"webpack-merge";import s from"../utils/log.mjs";import n from"../utils/match-path.mjs";import i from"../utils/require.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((s,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?s(a(n,o)):s(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={},a={};return t(e).on("all",async function(e,t){switch(process.stdout.write("update mock..."),e){case"add":case"change":c(a,t,r);let o=i(t).default;r[t]=o,a=Object.assign(a,o);break;case"unlink":c(a,t,r)}s("update mock success")}),function(e,t,r){let s=`${e.method} ${e.path}`,i=Object.keys(a).filter(function(e){return RegExp(`^${e.replace(/(:\w*)[^/]/g,"((?!/).)")}*$`).test(s)});if(!a[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=a[s]||a[i[0]];if("function"==typeof o){let a=n(i[0].split(" ")[1],e.url);a&&Object.assign(e.params,a.params),o(e,t,r)}else t.json(o)})}}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{PACKAGENAME as i,coreName as
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"../config.mjs";import{PACKAGENAME as i,description as o,keywords as r,coreName as a}from"../process-env.mjs";import{resolveProgram as n}from"../utils/index.mjs";let{favicon:l=`node_modules/${a}/lib/options/favicon.ico`,template:p,...m}=t.htmlPluginOption||{},s=t.seo&&`https://${t.seo.domain}${t.basename}`,d={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","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:o,keywords:Array.isArray(r)?r.toString():"","http-equiv":"refresh",viewport:"width=device-width, initial-scale=1"};s&&Object.assign(d,{relCanonical:{rel:"canonical",href:s}});let c=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:d,tags:[],favicon:l?n(l):l},m,p?{template:p?n(p):void 0}:{templateContent:function({htmlWebpackPlugin:{options:e}}){let t=e.tags,i="",o="";return t&&t.map(function(e){let{tag:t="script",textContent:r="",inject:a="head",...n}=e,l="";for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&(l+=`${e}="${n[e]}" `);let p=`<${t} ${l}>${r}</${t}>`;"body"===a?o+=p:i+=p}),`<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<title>${e.title}</title>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Buffer as s}from"buffer";import{transform as t}from"lightningcss";import i from"webpack";import{
|
|
1
|
+
import{Buffer as s}from"buffer";import{transform as t}from"lightningcss";import i from"webpack";import{PACKAGEVERSION as n,PACKAGENAME as o}from"../process-env.mjs";let{sources:{RawSource:e,SourceMapSource:r},ModuleFilenameHelpers:{matchObject:a}}=i,m="lightning-css-minify",p=/\.(c|le|sc|sa)ss(?:\?.*)?$/i;export class LightningCssMinifyPlugin{constructor(s={}){let{implementation:i,...n}=s;if(i&&"function"!=typeof i.transform)throw TypeError(`[LightningCssMinifyPlugin]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof i.transform}`);this.transform=i?.transform??t,this.options=n}apply(s){let t=JSON.stringify({name:o,version:n,options:this.options});s.hooks.compilation.tap(m,s=>{s.hooks.chunkHash.tap(m,(s,i)=>i.update(t)),s.hooks.processAssets.tapPromise({name:m,stage:s.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,additionalAssets:!0},async()=>await this.transformAssets(s)),s.hooks.statsPrinter.tap(m,s=>{s.hooks.print.for("asset.info.minimized").tap(m,(s,{green:t,formatFlag:i})=>s&&t&&i?t(i("minimized")):void 0)})})}async transformAssets(t){let{options:{devtool:i}}=t.compiler,{include:n,exclude:o,test:m,sourceMap:f=!!(i&&i.includes("source-map")),...c}=this.options,l=t.getAssets().filter(s=>!s.info.minimized&&(m||p).test(s.name)&&a({include:n,exclude:o},s.name));await Promise.all(l.map(async i=>{let n;let{source:o,map:a}=i.source.sourceAndMap(),m=o.toString(),p="string"==typeof o?s.from(o):o,l=this.transform({filename:i.name,code:p,minify:!0,sourceMap:f,...c}),g=l.code.toString();n=f?new r(g,i.name,l.map?JSON.parse(l.map.toString()):{},m,a,!0):new e(g),t.updateAsset(i.name,n,{...i.info,minimized:!0})}))}}
|
package/lib/process-env.d.mts
CHANGED
|
@@ -11,6 +11,8 @@ export declare const SSR: boolean;
|
|
|
11
11
|
/** 项目主要文件夹 */
|
|
12
12
|
export declare const mainDirectory: string;
|
|
13
13
|
export declare const jsxImportSource: string;
|
|
14
|
+
declare const description: any, author: any, repository: any, keywords: any;
|
|
15
|
+
export { description, author, repository, keywords };
|
|
14
16
|
/** 应用名称 */
|
|
15
17
|
export declare const PACKAGENAME: string;
|
|
16
18
|
/** 版本号 */
|
package/lib/process-env.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];export const PACKAGENAME=
|
|
1
|
+
import o from"./utils/require.mjs";export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const NODE_ENV=process.env.NODE_ENV;export const isLibrary="library"===APPTYPE;export const isMicro="micro"===APPTYPE;export const isMobile="mobile"===APPTYPE;export const isReact="react"===FRAMEWORK;export const isSolid="solid"===FRAMEWORK;export const SSR="true"===process.env.SSR;export const mainDirectory=isLibrary?"site":"src";export const jsxImportSource={react:"react",solid:"solid-js/h"}[FRAMEWORK];let{name:e,version:r,description:t,author:s,repository:c,keywords:i}=o(`${process.cwd()}/package.json`);export const PACKAGENAME=e;export const PACKAGEVERSION=r;export const coreName="@moneko/core";export const isDev="development"===NODE_ENV;export{t as description,s as author,c as repository,i as keywords};
|
package/lib/utils/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function toCamelCase(str: string): string;
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function convertToCamelCase(name: string): string;
|
|
3
3
|
type ProgramPath<T extends string> = `${T extends string ? T : string}`;
|
|
4
4
|
/** 位于项目根目录下的位置
|
|
5
5
|
* @param {string} src 路径
|
package/lib/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as
|
|
1
|
+
import{resolve as e}from"path";import t from"../paths.mjs";export function toCamelCase(e){return e.replace(/-./g,e=>e.charAt(1).toUpperCase())}export function convertToCamelCase(e){return e.toLowerCase().replace(/-(\w)/g,(e,t)=>t?t.toUpperCase():"").replace(/^./,e=>e.toUpperCase()).replace(/Ui$/,"UI")}export function resolveProgram(o){return e(t.programPath,`./${o}`)}export function node_modules(o){return e(t.nodeModules,`./${o}`)}export function isObject(e){let t=typeof e;return null!==e&&("object"===t||"function"===t)}export function isFunction(e){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]","[object Proxy]"].includes(Object.prototype.toString.call(e))}export function empty(){}
|
package/lib/utils/require.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as
|
|
1
|
+
import{createRequire as e}from"module";import{transformFileSync as o}from"@swc/core";let t=e(import.meta.url),s={sourceMaps:!1,module:{type:"commonjs"},jsc:{parser:{syntax:"typescript"}}};function r(e,t){return e._compile(o(t,s).code,t)}t.extensions[".ts"]=r,t.extensions[".mts"]=r,t.extensions[".mjs"]=r;export default t;
|
package/lib/utils/vts.d.mts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
+
interface VfsOptions {
|
|
2
|
+
namedExport?: boolean;
|
|
3
|
+
modules: Record<string, any>;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* 运行 ts 代码
|
|
3
7
|
* @param {String} filepath 文件名
|
|
4
8
|
* @returns {String} declaration
|
|
9
|
+
* @example
|
|
10
|
+
* // a.ts
|
|
11
|
+
* export default { user: 'admin' } as { user: 'admin' };
|
|
12
|
+
* // b.js
|
|
13
|
+
* const a = vts('fullpath/a.ts');
|
|
14
|
+
*
|
|
15
|
+
* console.log(a); // { user: 'admin' }
|
|
5
16
|
*/
|
|
6
|
-
export declare function vts<T>(filepath: string,
|
|
17
|
+
export declare function vts<T>(filepath: string, options?: VfsOptions): T;
|
|
18
|
+
export {};
|
package/lib/utils/vts.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{transformFileSync as e}from"@swc/core";import{Script as
|
|
1
|
+
import{transformFileSync as e}from"@swc/core";import{Script as o,createContext as r}from"vm";import*as t from"../index.mjs";import s from"./require.mjs";let m={inputSourceMap:!1,sourceMaps:!1,module:{type:"commonjs"},jsc:{target:"es2015",parser:{syntax:"typescript"},loose:!1}};export function vts(p,n){let u=e(p,m).code,i={exports:{default:null},require:e=>n?.modules[e]?n.modules[e]:"@moneko/core"===e?t:e.startsWith(".")?void 0:s(s.resolve(e))};return(r(i),new o(u,{filename:p}).runInNewContext(i),n?.namedExport)?i.exports:i.exports.default}
|
package/lib/vm/info.d.mts
CHANGED
package/lib/vm/info.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as
|
|
1
|
+
import{CONFIG as e}from"../config.mjs";import{description as r,author as o,repository as t,APPTYPE as s,PACKAGENAME as m,PACKAGEVERSION as i,SSR as p}from"../process-env.mjs";import{convertToCamelCase as n}from"../utils/index.mjs";let a="string"==typeof o,f={name:m,projectName:n(m),ssr:p,version:i,base:e.basename,type:s,routerMode:e.routerMode,prefixCls:e.prefixCls,theme:e.theme,description:r,author:a?{name:o}:o,repository:a?{url:t}:t};export default f;
|
package/lib/vm/locales.mjs
CHANGED
|
@@ -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
|
|
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
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 n({[localesModuleName]:p([],{})});let m={};async function d(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete m[a]:Object.assign(m,{[a]:g(t)});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$/])}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.1",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
56
56
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
57
57
|
"enhanced-resolve": "5.17.0",
|
|
58
|
-
"sass": "1.77.
|
|
58
|
+
"sass": "1.77.6",
|
|
59
59
|
"sass-loader": "14.2.1",
|
|
60
60
|
"solid-refresh": "0.7.5"
|
|
61
61
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/utils/read-conf.mjs
DELETED
|
File without changes
|
package/lib/utils/tfc.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/utils/tfc.mjs
DELETED
|
File without changes
|