@moneko/core 3.13.0 → 3.14.0

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/config.mjs CHANGED
@@ -1 +1 @@
1
- import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as l,NODE_ENV as n,PACKAGENAME as m,isDev as p,isLibrary as c,isMobile as u,jsxImportSource as d,mainDirectory as h}from"./process-env.mjs";import{isFunction as f,resolveProgram as g}from"./utils/index.mjs";import x from"./utils/log.mjs";import P from"./utils/read-conf.mjs";import v from"./utils/setup-env.mjs";let C=["@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"],j={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(n,r,l),basename:"/",publicPath:"/",rem:{designSize:u?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(h)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:p,jsxImportSource:d,providerImportSource:`@moneko/${l}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};c&&(j.alias=Object.assign(j.alias,{"@pkg":a.componentsPath,[m]:a.componentsPath}));let k=j,w={},b={};if(e(a.configPath)){let e=(await P(a.configPath,"index")).default;w=f(e)?e(process):e}if(i&&e(a.customConfigPath)){let e=(await P(a.customConfigPath,i)).default;b=f(e)?e(process):e}(!1===(k=o(k,w,b)).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||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:i,log:x};
1
+ import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as l,NODE_ENV as n,PACKAGENAME as m,isDev as p,isLibrary as c,isMobile as u,jsxImportSource as d,mainDirectory as h}from"./process-env.mjs";import{isFunction as f,resolveProgram as g}from"./utils/index.mjs";import x from"./utils/log.mjs";import P from"./utils/read-conf.mjs";import v from"./utils/setup-env.mjs";let C=["@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"],j={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(n,r,l),basename:"/",publicPath:"/",rem:{designSize:u?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(h)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:p,jsxImportSource:d,providerImportSource:`@moneko/${l}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};c&&(j.alias=Object.assign(j.alias,{"@pkg":a.componentsPath,[m]:a.componentsPath}));let k=j,w={},b={};if(e(a.configPath)){let e=(await P(a.configPath,"index")).default;w=f(e)?e(process):e}if(i&&e(a.customConfigPath)){let e=(await P(a.customConfigPath,i)).default;b=f(e)?e(process):e}(!1===(k=o(k,w,b)).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||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:i,log:x};
@@ -0,0 +1,26 @@
1
+ import { Compiler } from 'webpack';
2
+ /** 需要拷贝的文件列表
3
+ * @example
4
+ * ```ts
5
+ * export default {
6
+ * copy: {
7
+ * // 将 public 下的 a.json 和 s.txt 添加到资源
8
+ * files: ['public/a.json', 'public/s.txt'],
9
+ * // 将 static 文件夹添加到资源
10
+ * dirs: ['static']
11
+ * }
12
+ * }
13
+ * ```
14
+ */
15
+ export interface CopyPluginOption {
16
+ /** 需要拷贝的文件列表 */
17
+ files?: string[];
18
+ /** 需要拷贝的文件夹 */
19
+ dirs?: string[];
20
+ }
21
+ export declare class CopyPlugin {
22
+ private option;
23
+ constructor(option: CopyPluginOption);
24
+ private writeFile;
25
+ apply(compiler: Compiler): void;
26
+ }
@@ -0,0 +1 @@
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,r){let l=r.compiler.outputFileSystem;if(l){let s=o(i),a=await t(p(i));l.writeFile(p(r.outputOptions.path,s),a,t=>{t&&e(`Error copying file ${s} to output directory: ${t}`)})}}apply(t){t.hooks.afterEmit.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 e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import l from"webpack";import{CONFIG as o}from"./config.mjs";import i from"./options/html-plugin-option.mjs";import{AddEntryAttributePlugin as r}from"./plugin/add-entry-attribute.mjs";import p from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as n}from"./plugin/virtual-module.mjs";import{isMicro as a}from"./process-env.mjs";let{DefinePlugin:m,SourceMapDevToolPlugin:s,IgnorePlugin:c}=l,u=o.basename.split("/").filter(Boolean).length,h=`${Array(u).fill("..").join("/")+(u?"/":"")}404.html`,{pathSegmentsToKeep:f=u,path:d=h}=o.fixBrowserRouter||{},g=o.assetHtml.map(e=>({publicPath:"",...e})),w=[...p,new n(o.virtualModule),o.htmlPluginOption&&new t(i),o.fixBrowserRouter&&new t({filename:d,inject:!1,templateContent:()=>`<html lang="en"><head><title>${i.title}</title><script>const pathKeep = ${f||u};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new e(g),a&&new r({test:/main\.bundle\.js$/}),new m({"process.env":JSON.stringify(o.env)}),new c({resourceRegExp:/\/__tests__\//}),o.sourceMap&&new s(o.sourceMap),...o.plugins].filter(e=>!!e);export default w;
1
+ import e from"html-webpack-plugin";import t from"webpack";import{CONFIG as o}from"./config.mjs";import l from"./options/html-plugin-option.mjs";import{AddEntryAttributePlugin as i}from"./plugin/add-entry-attribute.mjs";import r from"./plugin/module-federation.mjs";import{VirtualModuleWebpackPlugin as n}from"./plugin/virtual-module.mjs";import{isMicro as p}from"./process-env.mjs";import{CopyPlugin as m}from"./plugin/copy-plugin.mjs";let{DefinePlugin:s,SourceMapDevToolPlugin:a,IgnorePlugin:c}=t,u=o.basename.split("/").filter(Boolean).length,f=`${Array(u).fill("..").join("/")+(u?"/":"")}404.html`,{pathSegmentsToKeep:h=u,path:g=f}=o.fixBrowserRouter||{},d=[...r,new n(o.virtualModule),o.htmlPluginOption&&new e(l),o.fixBrowserRouter&&new e({filename:g,inject:!1,templateContent:()=>`<html lang="en"><head><title>${l.title}</title><script>const pathKeep = ${h||u};const l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new m(o.copy),p&&new i({test:/main\.bundle\.js$/}),new s({"process.env":JSON.stringify(o.env)}),new c({resourceRegExp:/\/__tests__\//}),o.sourceMap&&new a(o.sourceMap),...o.plugins].filter(e=>!!e);export default d;
package/lib/vm/docs.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import ReactiveObject from '../utils/reactive-object.mjs';
2
- export declare const docsModuleName = "@app/docs.ts";
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>>;
5
5
  export declare const getCommentPath: (file: 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 m,isReact as s,isSolid as a}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.ts";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}${a?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${a?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${s?"() =>":""}${c}(${a?"Dynamic":"'n-md'"}, {text: res.default, ${a?"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 s={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&(s[e]=Object.values(m[e]));docs.setData(docsModuleName,`${l}export default ${JSON.stringify(s).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))}}
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))}}
@@ -1,5 +1,5 @@
1
1
  import ReactiveObject from '../utils/reactive-object.mjs';
2
- export declare const localesModuleName = "@app/locales.ts";
2
+ export declare const localesModuleName = "@app/locales";
3
3
  export declare const locales: ReactiveObject<{
4
- "@app/locales.ts": string;
4
+ "@app/locales": string;
5
5
  }>;
@@ -1,2 +1,2 @@
1
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.ts";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$/])}
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$/])}
@@ -1 +1 @@
1
- import{join as t}from"path";import{getAppEntry as p,getAppFallback as e,getAppMdxScope as r,getAppMergeRouter as o,getAppNormalizeCss as s,getAppPrefixRouter as a,getAppRem as m,getAppSuspense as i,saveFile as f}from"@moneko/mdx";import n from"./coverage.mjs";import{docs as l,docsModuleName as c}from"./docs.mjs";import d from"./info.mjs";import{locales as x,localesModuleName as j}from"./locales.mjs";import{route as g,routesModuleName as u}from"./routes.mjs";import{CONFIG as v}from"../config.mjs";import y from"../paths.mjs";import{APPTYPE as _,FRAMEWORK as h}from"../process-env.mjs";import{node_modules as O,resolveProgram as $}from"../utils/index.mjs";import{generateDeclaration as b}from"../utils/dts.mjs";let k={app_env:O("@app/env.ts"),app_info:O("@app/info.ts"),app_entry:O("@app/entry.ts")},z={[k.app_env]:`export default ${JSON.stringify(v.env)}`,[k.app_info]:`export default ${JSON.stringify(d)}`,[k.app_entry]:p(t(v.alias["@"],"./index.ts"),!!v.rem,!!v.normalizeCss,_,h),[O("@app/rem.ts")]:m(v.rem?.designSize||1680),[O("@app/fallback.ts")]:e(v.fallbackCompPath),[O("@app/coverage.ts")]:n(y.coveragePath),[O("@app/merge-router.ts")]:o(),[O("@app/prefix-router.ts")]:a(),[O("@app/normalize/index.css")]:s(),[O("@app/suspense/index.tsx")]:i(_,h),[O("@app/mdx-scope.ts")]:r($("site/mdx-scope.ts")),[O(u)]:g.getData(u),[O(j)]:x.getData(j),[O(c)]:l.getData(c)},D=/\.tsx?/,P=/\.(j|t)sx?$/;for(let t in k)if(Object.prototype.hasOwnProperty.call(k,t)){let p=k[t];P.test(p)&&f(p.replace(D,".d$&"),b(z[p],p))}export default z;
1
+ import{join as p}from"path";import{getAppEntry as e,getAppFallback as t,getAppMdxScope as r,getAppMergeRouter as o,getAppNormalizeCss as a,getAppPrefixRouter as m,getAppRem as s,getAppSuspense as i,saveFile as f}from"@moneko/mdx";import n from"./coverage.mjs";import{docs as l,docsModuleName as c}from"./docs.mjs";import d from"./info.mjs";import{locales as x,localesModuleName as j}from"./locales.mjs";import{route as g,routesModuleName as u}from"./routes.mjs";import{CONFIG as v}from"../config.mjs";import y from"../paths.mjs";import{APPTYPE as _,FRAMEWORK as h}from"../process-env.mjs";import{node_modules as O,resolveProgram as $}from"../utils/index.mjs";import{generateDeclaration as b}from"../utils/dts.mjs";let k={app_env:O("@app/env.ts"),app_info:O("@app/info.ts"),app_entry:O("@app/entry.ts")},z={[k.app_env]:`export default ${JSON.stringify(v.env)}`,[k.app_info]:`export default ${JSON.stringify(d)}`,[k.app_entry]:e(p(v.alias["@"],"./index.ts"),!!v.rem,!!v.normalizeCss,_,h),[O("@app/rem")]:s(v.rem?.designSize||1680),[O("@app/fallback")]:t(v.fallbackCompPath),[O("@app/coverage")]:n(y.coveragePath),[O("@app/merge-router")]:o(),[O("@app/prefix-router")]:m(),[O("@app/normalize/index.css")]:a(),[O("@app/suspense/index.tsx")]:i(_,h),[O("@app/mdx-scope")]:r($("site/mdx-scope.ts")),[O(u)]:g.getData(u),[O(j)]:x.getData(j),[O(c)]:l.getData(c)},D=/\.tsx?/,P=/\.(j|t)sx?$/;for(let p in k)if(Object.prototype.hasOwnProperty.call(k,p)){let e=k[p];P.test(e)&&f(e.replace(D,".d$&"),b(z[e],e))}export default z;
@@ -1,6 +1,6 @@
1
1
  import ReactiveObject from '../utils/reactive-object.mjs';
2
- export declare const routesModuleName = "@app/routes.ts";
2
+ export declare const routesModuleName = "@app/routes";
3
3
  export declare const route: ReactiveObject<{
4
- "@app/routes.ts": string;
4
+ "@app/routes": string;
5
5
  }>;
6
6
  export declare function generatorRouter(): void;
package/lib/vm/routes.mjs CHANGED
@@ -1 +1 @@
1
- import{generateRouter as o}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import{CONFIG as e}from"../config.mjs";import{routeDir as r}from"../paths.mjs";import{FRAMEWORK as m,isDev as s,isLibrary as u}from"../process-env.mjs";import i from"../utils/reactive-object.mjs";let n=u?"@pkg":"@/pages";export const routesModuleName="@app/routes.ts";function p(){return o(r,`${e.alias["@"]}/router/index.ts`,m,n,u)}export const route=new i({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}s&&t(r,u?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
1
+ import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.mjs";import{CONFIG as t}from"../config.mjs";import{routeDir as r}from"../paths.mjs";import{FRAMEWORK as m,isDev as s,isLibrary as u}from"../process-env.mjs";import i from"../utils/reactive-object.mjs";let n=u?"@pkg":"@/pages";export const routesModuleName="@app/routes";function p(){return o(r,`${t.alias["@"]}/router/index.ts`,m,n,u)}export const route=new i({[routesModuleName]:p()});export function generatorRouter(){route.setData(routesModuleName,p())}s&&e(r,u?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.13.0",
3
+ "version": "3.14.0",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -15,7 +15,6 @@
15
15
  "@moneko/transform-imports": "0.5.1",
16
16
  "@swc/core": "1.5.0",
17
17
  "@typescript/vfs": "1.5.0",
18
- "add-asset-html-webpack-plugin": "6.0.0",
19
18
  "browserslist": "4.23.0",
20
19
  "chalk": "5.3.0",
21
20
  "chokidar": "3.6.0",
@@ -10,7 +10,6 @@ import type {
10
10
  import type { DonePluginOption } from '../lib/plugin/done';
11
11
  import type { MdxOptions } from '@moneko/mdx';
12
12
  import type { Config as SwcConfig, JsMinifyOptions as SwcMinifyOptions } from '@swc/core';
13
- import type { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
14
13
  import type { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
15
14
  import type { MinifyOptions as TerserMinifyOptions } from 'terser';
16
15
  import type {
@@ -21,6 +20,7 @@ import type {
21
20
  WebpackPluginInstance,
22
21
  } from 'webpack';
23
22
  import type { PluginOptions as MiniCssExtractPluginOptions } from 'mini-css-extract-plugin';
23
+ import type { CopyPluginOption } from '../lib/plugin/copy-plugin.mjs';
24
24
 
25
25
  export type { TerserMinifyOptions, SwcMinifyOptions, MiniCssExtractPluginOptions };
26
26
  export type MinifierType = 'swc' | 'terser';
@@ -220,22 +220,8 @@ export declare type ConfigType = {
220
220
  };
221
221
  /** HtmlWebpackPlugin Option */
222
222
  htmlPluginOption: HtmlWebpackOption | false;
223
- /** 自定义插入 html 的 js 和 css
224
- * @example
225
- * const conf = {
226
- * assetHtml: [
227
- * {
228
- * glob: './public/*.entry.css',
229
- * typeOfAsset: 'css',
230
- * },
231
- * {
232
- * glob: './public/*.entry.js',
233
- * typeOfAsset: 'js',
234
- * },
235
- * ]
236
- * }
237
- * */
238
- assetHtml: AssetHtmlOptions[];
223
+
224
+ copy: CopyPluginOption,
239
225
  /** 路由模式
240
226
  * @description
241
227
  * 当在不支持 browserRouter 的环境(GitHub pages)使用 browserRouter,