@moneko/core 3.9.17-beta.9 → 3.9.18-beta.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.
Files changed (120) hide show
  1. package/lib/build/common.d.mts +3 -0
  2. package/lib/build/common.mjs +1 -0
  3. package/lib/build/server.d.mts +3 -0
  4. package/lib/build/server.mjs +1 -0
  5. package/lib/build.mjs +1 -1
  6. package/lib/common.mjs +1 -1
  7. package/lib/config.mjs +1 -1
  8. package/lib/dev/config.mjs +3 -0
  9. package/lib/dev/mock.d.mts +40 -0
  10. package/lib/dev/mock.mjs +1 -0
  11. package/lib/{net.d.mts → dev/net.d.mts} +1 -1
  12. package/lib/dev/net.mjs +1 -0
  13. package/lib/dev/proxy.d.mts +7 -0
  14. package/lib/dev/proxy.mjs +1 -0
  15. package/lib/dev.mjs +1 -1
  16. package/lib/index.d.mts +13 -5
  17. package/lib/index.mjs +1 -1
  18. package/lib/loader/ts-doc.d.cts +1 -1
  19. package/lib/module.config.mjs +1 -1
  20. package/lib/options/favicon.ico +0 -0
  21. package/lib/{html-plugin-option.d.mts → options/html-plugin-option.d.mts} +1 -1
  22. package/lib/options/html-plugin-option.mjs +11 -0
  23. package/lib/{minify.d.mts → options/js-minify.d.mts} +2 -2
  24. package/lib/options/js-minify.mjs +1 -0
  25. package/lib/options/jsx-dom-expressions.d.mts +10 -0
  26. package/lib/options/jsx-dom-expressions.mjs +1 -0
  27. package/lib/options/modify-vars.mjs +1 -0
  28. package/lib/options/split-chunk.d.mts +4 -0
  29. package/lib/options/split-chunk.mjs +1 -0
  30. package/lib/options/swcrc.d.mts +3 -0
  31. package/lib/options/swcrc.mjs +1 -0
  32. package/lib/paths.d.mts +4 -2
  33. package/lib/paths.mjs +1 -1
  34. package/lib/plugin/add-entry-attribute.d.mts +2 -3
  35. package/lib/plugin/add-entry-attribute.mjs +1 -1
  36. package/lib/plugin/external-remotes.mjs +1 -1
  37. package/lib/plugin/lightningcss-plugin.d.mts +2 -2
  38. package/lib/plugin/lightningcss-plugin.mjs +1 -1
  39. package/lib/plugin/module-federation.mjs +1 -0
  40. package/lib/plugin/virtual-module.d.mts +2 -3
  41. package/lib/plugin/virtual-module.mjs +1 -1
  42. package/lib/plugins.config.mjs +1 -1
  43. package/lib/{polyfills.mjs → polyfills/polyfills.mjs} +1 -1
  44. package/lib/polyfills/replace-children.mjs +1 -1
  45. package/lib/polyfills/targets.mjs +1 -0
  46. package/lib/process-env.d.mts +0 -1
  47. package/lib/process-env.mjs +1 -1
  48. package/lib/rule.d.mts +23 -0
  49. package/lib/rule.mjs +1 -0
  50. package/lib/utils/compiler-listener.d.mts +3 -0
  51. package/lib/utils/compiler-listener.mjs +1 -0
  52. package/lib/utils/esm.d.mts +2 -0
  53. package/lib/utils/esm.mjs +1 -0
  54. package/lib/utils/has-pkg.d.mts +2 -0
  55. package/lib/utils/has-pkg.mjs +1 -0
  56. package/lib/{utils.d.mts → utils/index.d.mts} +0 -6
  57. package/lib/utils/index.mjs +1 -0
  58. package/lib/utils/log.d.mts +2 -0
  59. package/lib/utils/log.mjs +2 -0
  60. package/lib/utils/match-path.d.mts +22 -0
  61. package/lib/utils/match-path.mjs +1 -0
  62. package/lib/utils/read-conf.d.mts +2 -0
  63. package/lib/utils/read-conf.mjs +1 -0
  64. package/lib/utils/run.d.mts +2 -0
  65. package/lib/utils/run.mjs +1 -0
  66. package/lib/utils/seo.mjs +1 -0
  67. package/lib/{svg-to-data-uri.mjs → utils/svg-to-data-uri.mjs} +1 -1
  68. package/lib/utils/tfc.d.mts +2 -0
  69. package/lib/utils/tfc.mjs +1 -0
  70. package/lib/vm/coverage.mjs +1 -1
  71. package/lib/vm/docs.d.mts +1 -1
  72. package/lib/vm/docs.mjs +1 -1
  73. package/lib/vm/example.d.mts +1 -1
  74. package/lib/vm/example.mjs +1 -1
  75. package/lib/vm/generate-doc.mjs +1 -1
  76. package/lib/{info.d.mts → vm/info.d.mts} +3 -3
  77. package/lib/vm/info.mjs +1 -0
  78. package/lib/vm/locales.d.mts +1 -1
  79. package/lib/vm/locales.mjs +2 -2
  80. package/lib/vm/modules.mjs +1 -1
  81. package/lib/vm/routes.d.mts +1 -1
  82. package/lib/vm/routes.mjs +1 -1
  83. package/package.json +17 -20
  84. package/typings/global.d.ts +57 -150
  85. package/lib/dev-config.mjs +0 -3
  86. package/lib/dev-old.d.mts +0 -1
  87. package/lib/dev-old.mjs +0 -0
  88. package/lib/has-pkg.d.mts +0 -1
  89. package/lib/has-pkg.mjs +0 -1
  90. package/lib/html-plugin-option.mjs +0 -1
  91. package/lib/info.mjs +0 -1
  92. package/lib/loader/hot-router.cjs +0 -1
  93. package/lib/loader/hot-router.d.cts +0 -1
  94. package/lib/minify.mjs +0 -1
  95. package/lib/modify-vars.mjs +0 -1
  96. package/lib/module-federation.mjs +0 -1
  97. package/lib/net.mjs +0 -1
  98. package/lib/seo.mjs +0 -1
  99. package/lib/swcrc.d.mts +0 -4
  100. package/lib/swcrc.mjs +0 -1
  101. package/lib/targets.mjs +0 -1
  102. package/lib/tsloader.config.d.mts +0 -1
  103. package/lib/tsloader.config.mjs +0 -0
  104. package/lib/utils.mjs +0 -2
  105. package/template/favicon.ico +0 -0
  106. package/template/index.html +0 -25
  107. package/template/index.ssr.html +0 -25
  108. /package/lib/{dev-config.d.mts → dev/config.d.mts} +0 -0
  109. /package/lib/{modify-vars.d.mts → options/modify-vars.d.mts} +0 -0
  110. /package/lib/{module-federation.d.mts → plugin/module-federation.d.mts} +0 -0
  111. /package/lib/{polyfills.d.mts → polyfills/polyfills.d.mts} +0 -0
  112. /package/lib/{targets.d.mts → polyfills/targets.d.mts} +0 -0
  113. /package/lib/{os-tmp-dir.d.mts → utils/os-tmp-dir.d.mts} +0 -0
  114. /package/lib/{os-tmp-dir.mjs → utils/os-tmp-dir.mjs} +0 -0
  115. /package/lib/{reactive-object.d.mts → utils/reactive-object.d.mts} +0 -0
  116. /package/lib/{reactive-object.mjs → utils/reactive-object.mjs} +0 -0
  117. /package/lib/{resolver-sync.d.mts → utils/resolver-sync.d.mts} +0 -0
  118. /package/lib/{resolver-sync.mjs → utils/resolver-sync.mjs} +0 -0
  119. /package/lib/{seo.d.mts → utils/seo.d.mts} +0 -0
  120. /package/lib/{svg-to-data-uri.d.mts → utils/svg-to-data-uri.d.mts} +0 -0
@@ -0,0 +1,22 @@
1
+ type MatchPath = {
2
+ path: string;
3
+ params: Record<string, unknown>;
4
+ };
5
+ /**
6
+ * RESTful 风格api
7
+ * @param {String} pattern pattern
8
+ * @param {String} path paths
9
+ * @example
10
+ * const pattern = '/users/:id';
11
+ * const pathToMatch = '/users/123';
12
+ * const result = matchPath(pattern, pathToMatch);
13
+ * if (result) {
14
+ * console.log('Match found:', result);
15
+ * console.log('Params:', result.params);
16
+ * } else {
17
+ * console.log('No match found.');
18
+ * }
19
+ * @returns {MatchPath|null} MatchPath
20
+ */
21
+ declare function matchPath(pattern: string, path: string): MatchPath | null;
22
+ export default matchPath;
@@ -0,0 +1 @@
1
+ export default function(t,l){let e=t.split("/"),n=l.split("/");if(e.length!==n.length)return null;let r={};for(let t=0;t<e.length;t++){let l=e[t],i=n[t];if(l.startsWith(":"))r[l.slice(1)]=i;else if(l!==i)return null}return{path:l,params:r}}
@@ -0,0 +1,2 @@
1
+ declare function readConf(src: string, name: string): Promise<any>;
2
+ export default readConf;
@@ -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,2 @@
1
+ declare function run(fileContent: string, filePath: string): any;
2
+ export default run;
@@ -0,0 +1 @@
1
+ import e from"vm";export default function(n,r){return e.runInThisContext(n||"",{filename:r,lineOffset:0,columnOffset:0,displayErrors:!0})}
@@ -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{routeDir as s}from"../paths.mjs";import{isLibrary as f}from"../process-env.mjs";export default(()=>{let{domain:n,nojekyll: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"),"")});
@@ -1 +1 @@
1
- let f={aqua:/#00ffff(ff)?(?!\w)|#0ff(f)?(?!\w)/gi,azure:/#f0ffff(ff)?(?!\w)/gi,beige:/#f5f5dc(ff)?(?!\w)/gi,bisque:/#ffe4c4(ff)?(?!\w)/gi,black:/#000000(ff)?(?!\w)|#000(f)?(?!\w)/gi,blue:/#0000ff(ff)?(?!\w)|#00f(f)?(?!\w)/gi,brown:/#a52a2a(ff)?(?!\w)/gi,coral:/#ff7f50(ff)?(?!\w)/gi,cornsilk:/#fff8dc(ff)?(?!\w)/gi,crimson:/#dc143c(ff)?(?!\w)/gi,cyan:/#00ffff(ff)?(?!\w)|#0ff(f)?(?!\w)/gi,darkblue:/#00008b(ff)?(?!\w)/gi,darkcyan:/#008b8b(ff)?(?!\w)/gi,darkgrey:/#a9a9a9(ff)?(?!\w)/gi,darkred:/#8b0000(ff)?(?!\w)/gi,deeppink:/#ff1493(ff)?(?!\w)/gi,dimgrey:/#696969(ff)?(?!\w)/gi,gold:/#ffd700(ff)?(?!\w)/gi,green:/#008000(ff)?(?!\w)/gi,grey:/#808080(ff)?(?!\w)/gi,honeydew:/#f0fff0(ff)?(?!\w)/gi,hotpink:/#ff69b4(ff)?(?!\w)/gi,indigo:/#4b0082(ff)?(?!\w)/gi,ivory:/#fffff0(ff)?(?!\w)/gi,khaki:/#f0e68c(ff)?(?!\w)/gi,lavender:/#e6e6fa(ff)?(?!\w)/gi,lime:/#00ff00(ff)?(?!\w)|#0f0(f)?(?!\w)/gi,linen:/#faf0e6(ff)?(?!\w)/gi,maroon:/#800000(ff)?(?!\w)/gi,moccasin:/#ffe4b5(ff)?(?!\w)/gi,navy:/#000080(ff)?(?!\w)/gi,oldlace:/#fdf5e6(ff)?(?!\w)/gi,olive:/#808000(ff)?(?!\w)/gi,orange:/#ffa500(ff)?(?!\w)/gi,orchid:/#da70d6(ff)?(?!\w)/gi,peru:/#cd853f(ff)?(?!\w)/gi,pink:/#ffc0cb(ff)?(?!\w)/gi,plum:/#dda0dd(ff)?(?!\w)/gi,purple:/#800080(ff)?(?!\w)/gi,red:/#ff0000(ff)?(?!\w)|#f00(f)?(?!\w)/gi,salmon:/#fa8072(ff)?(?!\w)/gi,seagreen:/#2e8b57(ff)?(?!\w)/gi,seashell:/#fff5ee(ff)?(?!\w)/gi,sienna:/#a0522d(ff)?(?!\w)/gi,silver:/#c0c0c0(ff)?(?!\w)/gi,skyblue:/#87ceeb(ff)?(?!\w)/gi,snow:/#fffafa(ff)?(?!\w)/gi,tan:/#d2b48c(ff)?(?!\w)/gi,teal:/#008080(ff)?(?!\w)/gi,thistle:/#d8bfd8(ff)?(?!\w)/gi,tomato:/#ff6347(ff)?(?!\w)/gi,violet:/#ee82ee(ff)?(?!\w)/gi,wheat:/#f5deb3(ff)?(?!\w)/gi,white:/#ffffff(ff)?(?!\w)|#fff(f)?(?!\w)/gi};export default function(e){let i;if("string"!=typeof e)throw TypeError(`Expected a string, but received ${typeof e}`);let g=(i=(65279===e.charCodeAt(0)?e.slice(1):e).trim().replace(/\s+/g," "),Object.keys(f).forEach(function(e){f[e].test(i)&&(i=i.replace(f[e],e))}),i).replace(/"/g,"'");return`data:image/svg+xml,${encodeURIComponent(g).replace(/%[\dA-F]{2}/g,function(f){switch(f){case"%20":return" ";case"%3D":return"=";case"%3A":return":";case"%2F":return"/";default:return f.toLowerCase()}})}`}
1
+ let f={aqua:/#00ffff(ff)?(?!\w)|#0ff(f)?(?!\w)/gi,azure:/#f0ffff(ff)?(?!\w)/gi,beige:/#f5f5dc(ff)?(?!\w)/gi,bisque:/#ffe4c4(ff)?(?!\w)/gi,black:/#000000(ff)?(?!\w)|#000(f)?(?!\w)/gi,blue:/#0000ff(ff)?(?!\w)|#00f(f)?(?!\w)/gi,brown:/#a52a2a(ff)?(?!\w)/gi,coral:/#ff7f50(ff)?(?!\w)/gi,cornsilk:/#fff8dc(ff)?(?!\w)/gi,crimson:/#dc143c(ff)?(?!\w)/gi,cyan:/#00ffff(ff)?(?!\w)|#0ff(f)?(?!\w)/gi,darkblue:/#00008b(ff)?(?!\w)/gi,darkcyan:/#008b8b(ff)?(?!\w)/gi,darkgrey:/#a9a9a9(ff)?(?!\w)/gi,darkred:/#8b0000(ff)?(?!\w)/gi,deeppink:/#ff1493(ff)?(?!\w)/gi,dimgrey:/#696969(ff)?(?!\w)/gi,gold:/#ffd700(ff)?(?!\w)/gi,green:/#008000(ff)?(?!\w)/gi,grey:/#808080(ff)?(?!\w)/gi,honeydew:/#f0fff0(ff)?(?!\w)/gi,hotpink:/#ff69b4(ff)?(?!\w)/gi,indigo:/#4b0082(ff)?(?!\w)/gi,ivory:/#fffff0(ff)?(?!\w)/gi,khaki:/#f0e68c(ff)?(?!\w)/gi,lavender:/#e6e6fa(ff)?(?!\w)/gi,lime:/#00ff00(ff)?(?!\w)|#0f0(f)?(?!\w)/gi,linen:/#faf0e6(ff)?(?!\w)/gi,maroon:/#800000(ff)?(?!\w)/gi,moccasin:/#ffe4b5(ff)?(?!\w)/gi,navy:/#000080(ff)?(?!\w)/gi,oldlace:/#fdf5e6(ff)?(?!\w)/gi,olive:/#808000(ff)?(?!\w)/gi,orange:/#ffa500(ff)?(?!\w)/gi,orchid:/#da70d6(ff)?(?!\w)/gi,peru:/#cd853f(ff)?(?!\w)/gi,pink:/#ffc0cb(ff)?(?!\w)/gi,plum:/#dda0dd(ff)?(?!\w)/gi,purple:/#800080(ff)?(?!\w)/gi,red:/#ff0000(ff)?(?!\w)|#f00(f)?(?!\w)/gi,salmon:/#fa8072(ff)?(?!\w)/gi,seagreen:/#2e8b57(ff)?(?!\w)/gi,seashell:/#fff5ee(ff)?(?!\w)/gi,sienna:/#a0522d(ff)?(?!\w)/gi,silver:/#c0c0c0(ff)?(?!\w)/gi,skyblue:/#87ceeb(ff)?(?!\w)/gi,snow:/#fffafa(ff)?(?!\w)/gi,tan:/#d2b48c(ff)?(?!\w)/gi,teal:/#008080(ff)?(?!\w)/gi,thistle:/#d8bfd8(ff)?(?!\w)/gi,tomato:/#ff6347(ff)?(?!\w)/gi,violet:/#ee82ee(ff)?(?!\w)/gi,wheat:/#f5deb3(ff)?(?!\w)/gi,white:/#ffffff(ff)?(?!\w)|#fff(f)?(?!\w)/gi};export default function(e){if("string"!=typeof e)throw TypeError(`Expected a string, but received ${typeof e}`);let i=(function(e){let i=e,g=Object.keys(f);for(let e=0,w=g.length;e<w;e++){let w=g[e];f[w].test(i)&&(i=i.replace(f[w],w))}return i})((65279===e.charCodeAt(0)?e.slice(1):e).trim().replaceAll(/\s+/g," ")).replaceAll('"',"'");return`data:image/svg+xml,${encodeURIComponent(i).replaceAll(/%[\dA-F]{2}/g,function(f){switch(f){case"%20":return" ";case"%3D":return"=";case"%3A":return":";case"%2F":return"/";default:return f.toLowerCase()}})}`}
@@ -0,0 +1,2 @@
1
+ declare function tfc(filepath: string): string;
2
+ export default tfc;
@@ -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||"{}"}
@@ -1 +1 @@
1
- import{fileExists as e,loadFileSync as r}from"@moneko/mdx";import{Parser as t}from"xml2js";import{PACKAGENAME as o}from"../process-env.mjs";export default function(c){let a={},i="export default {}";if(e(c))try{let e=r(c);(0,new t({explicitArray:!1,async:!1}).parseString)(e,(e,r)=>{e||(Object.assign(a,{[o]:r.coverage.project.metrics.$}),r.coverage.project.package.forEach(e=>{Object.assign(a,{[e.$.name]:e.metrics.$})})),i=`export default ${JSON.stringify(a)}`})}catch(e){}return i}
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.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 m,isSolid as s}from"../process-env.mjs";import p from"../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}${s?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${s?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${m?"() =>":""}${l}(${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;}' })};}`,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 m={};for(let e in a)Object.prototype.hasOwnProperty.call(a,e)&&(m[e]=Object.values(a[e]));docs.setData(docsModuleName,`${p}export default ${JSON.stringify(m).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))})}
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 l from"../utils/reactive-object.mjs";let p={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(a){let a={},l=`import { ${p}${m?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${m?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${s?"() =>":""}${p}(${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(() => ${p}(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,`${l}export default ${JSON.stringify(s).replace(/"rr\((.+?)\)rr"/g,"$1")}`)};comment.on("change",(e,t)=>{c(e,t?.length<0)});let i=t(r.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e));for(let t=0,r=i.length;t<r;t++){let r=i[t],n=e(r);n&&comment.setData(getCommentPath(r),o(n,r))}}
@@ -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;
@@ -1 +1 @@
1
- import{generateExample as e}from"@moneko/mdx";import{watchFiles as o}from"./utils.mjs";import t from"../paths.mjs";import{isDev as r,isLibrary as m}from"../process-env.mjs";import p from"../reactive-object.mjs";export const exampleModuleName="@app/example";function a(){try{return JSON.parse(e(t.componentsPath,"@app/example/"))}catch(e){return{}}}export const examples=new p(m?a():{});export function generatorDemo(){let e=a();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}m&&r&&o(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
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);
@@ -1 +1 @@
1
- import{dirname as e}from"path";import t from"typescript";import{CONFIG as n}from"../config.mjs";let{ScriptKind:r,ScriptTarget:l,SyntaxKind:o,createSourceFile:i,forEachChild:a,getLeadingCommentRanges:c,isInterfaceDeclaration:u,isQuestionToken:s,isPropertySignature:f,isFunctionTypeNode:p,isUnionTypeNode:m,isMethodSignature:g}=t,$={};function h(e){let t=c(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.substring(t[0].pos,t[0].end).match(/\/\*\*([\s\S]*?)\*\//);if(n)return n[1].replace(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim()}return null}function b(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}function d(e){if(!e)return null;let t=e.match(/@author (\w+)\s*(?:<([^>]+)>)?/);if(t?.length){let e=t[1].trim(),n=t[2]?.trim(),r=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(n);return n?r&&(n=`mailto:${n}`):n=`https://github.com/${e}`,`[![${e}](https://avatars.githubusercontent.com/${e}?s=64)${e}](${n})`}return null}function y(e){if(!e)return null;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():null}let x=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function j(e,t){if(!e)return null;let r=e.replace(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if($[e]){let r=`/${[n.basename,$[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${r})`:`[${e}](${r})`}return t?`\\color{#009688}{${e}}`:e});return t&&(r=r.replace(x,e=>`\\color{#009688}{${e}}`)),r}function T(e){return(function(e){let t;if(!e)return null;let n=[];for(;t=/\\color{([^|}]*)\|?([^|}]*)\|?([^|}]*)\|?([^}]*)}{([^}]*)}/g.exec(e);)n.push(t[0]);return e.replace(/[{}[\]()=>]|keyof|typeof|true|false/g,e=>n.some(t=>t.includes(e))?e:`\\color{#569cd6}{${e}}`)})(e)?.replace(/^\s*\|\s*|\s*\|\s*$/gm,"").replace(/\n/g,"<br/>").replace(/\*/g,"\\*").replace(/\|/g,"\\|").replace(/(['"])((?:(?!\1).)*)\1/g,"\\color{#ce9178}{$1$2$1}")}function B(e){return e?e.replace(/^@[a-z].+/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}export default function k(c,x){let k=i(x,c,l.Latest,!0,r.TS),w="";return a(k,r=>{u(r)?w+=function(r){let l=r.name.text;Object.assign($,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let i=h(r),a=b(i),c=B(i),u=y(i)?.split("|")||[],x=u.includes("comment"),k=u.includes("initial"),w=u.includes("optional"),E=u.includes("version"),S=u.includes("author"),v=c?`\\color{|4||0.45}{${l}}`:l,F=(function(e){let n=[];if(e.heritageClauses){for(let r of e.heritageClauses)if(r.token===t.SyntaxKind.ExtendsKeyword)for(let e of r.types)n.push(e.getText())}return n})(r)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${j(T(e))}</n-tag>`),z=[c,v,a&&`\\color{#52c11b|1||0.9}{${a}}`,F.length>0&&`<sub>\`extends\`</sub> ${F.join(" ")}`].filter(Boolean).join(" "),K=`## ${z}`,N=r.members.filter(e=>f(e)&&e.type?.kind!==o.NeverKeyword||g(e)),q=[];if(N.length){N.forEach(e=>{let t=j(T(g(e)?`(${e.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${e.type?.getText()||"any"}`:e.type?.getText()||"any"),!0),n=h(e),r=T(e.name.getText());!r||r.startsWith("\\color")||(g(e)||function(e){if(e.type){if(!m(e.type))return p(e.type);for(let t of e.type.types)if(p(t))return!0}return!1}(e)||t?.includes("=>")?r=`\\color{#f9a913}{${r}}`:/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`));let l=e.questionToken&&s(e.questionToken);q.push([r,!w&&`\\color{${l?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${l?"✘":"✔"}}`,!x&&T(B(n)),t,!k&&T(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(n)),!E&&T(b(n)),!S&&(d(n)||d(i))])});let e=!1,t=!1,n=!1,r=!1;q.forEach(l=>{!x&&l[2]&&(r=!0),!k&&l[4]&&(n=!0),!E&&l[5]&&(t=!0),!S&&l[6]&&(e=!0)}),K+="\n";let l=["属性",!w&&"必要",r&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");K+=`|${l}|`;let o=[":-",!w&&":-",r&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);K+="\n";let a=o.join("|");K+=`|${a}|`,q.forEach(l=>{K+="\n";let o=[l[0]||"-",!w&&(l[1]||"-"),r&&(l[2]||"-"),l[3]||"-",n&&(l[4]||"-"),t&&(l[5]||"-"),e&&(l[6]||"-")].filter(Boolean).join("|");K+=`|${o}|`}),K+="\n"}return K+="\n"}(r):t.isEnumDeclaration(r)&&(w+=function(r){let l=r.name.text,o=h(r),i=B(o),a=b(o);Object.assign($,{[r.name.text]:e(r.getSourceFile().fileName).replace(n.alias["@pkg"],"")});let c=i?`\\color{|4||0.45}{${l}}`:l,u=[i,c,a&&`\\color{#52c11b|1||0.9}{${a}}`].filter(Boolean).join(" "),s=y(o)?.split("|")||[],f=s.includes("comment"),p=s.includes("version"),m=s.includes("author"),g=`## ${u}`;if(r.members.length){let e=[];r.members.forEach(n=>{let r=T(n.name.getText()),l=h(n),i=T(function(e){let n=e.initializer;return n&&t.isStringLiteral(n)?` '${n.text}'`:null}(n)),a=T(b(l)),c=T(B(l));!r||r.startsWith("\\color")||/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`),e.push([r,!f&&c,i,!p&&a,!m&&(d(l)||d(o))])});let n=!1,l=!1,i=!1;e.forEach(e=>{!f&&e[1]&&(i=!0),!p&&e[3]&&(l=!0),!m&&e[4]&&(n=!0)}),g+="\n";let a=["属性",i&&"说明","值",l&&"版本",n&&"作者"].filter(Boolean).join("|");g+=`|${a}|`;let c=[":-",i&&":-",":-",l&&":-",n&&":-"].filter(Boolean);g+="\n";let u=c.join("|");g+=`|${u}|`,e.forEach(e=>{g+="\n";let t=[e[0]||"-",i&&(e[1]||"-"),e[2]||"-",l&&(e[3]||"-"),n&&(e[4]||"-")].filter(Boolean).join("|");g+=`|${t}|`})}return g+="\n\n"}(r))}),w}
1
+ import{dirname as e}from"node:path";import t from"typescript";import{CONFIG as l}from"../config.mjs";let{ScriptKind:n,ScriptTarget:r,SyntaxKind:o,createSourceFile:i,forEachChild:c,getLeadingCommentRanges:a,isInterfaceDeclaration:s,isQuestionToken:u,isPropertySignature:f,isFunctionTypeNode:m,isUnionTypeNode:p,isMethodSignature:g}=t,$={};function h(e){let t=a(e.getSourceFile().text,e.pos);if(t){let l=e.getSourceFile().text.slice(t[0].pos,t[0].end).match(/\/\*\*([\s\S]*?)\*\//);if(l)return l[1].replaceAll(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim()}}function d(e){if(!e)return;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():void 0}function b(e){if(!e)return;let t=e.match(/@author (\w+)\s*(?:<([^>]+)>)?/);if(t&&t.length>0){let e=t[1].trim(),l=t[2]?.trim(),n=/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/.test(l);return l?n&&(l=`mailto:${l}`):l=`https://github.com/${e}`,`[![${e}](https://avatars.githubusercontent.com/${e}?s=64)${e}](${l})`}}function y(e){if(!e)return;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():void 0}let x=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function j(e,t){if(!e)return;let n=e.replaceAll(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if($[e]){let n=`/${[l.basename,$[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${n})`:`[${e}](${n})`}return t?`\\color{#009688}{${e}}`:e});return t&&(n=n.replaceAll(x,e=>`\\color{#009688}{${e}}`)),n}function A(e){if(e)return(function(e){let t;if(!e)return;let l=[];for(;t=/\\color{([^|}]*)\|?([^|}]*)\|?([^|}]*)\|?([^}]*)}{([^}]*)}/g.exec(e);)l.push(t[0]);return e.replaceAll(/[{}[\]()=>]|keyof|typeof|true|false/g,e=>l.some(t=>t.includes(e))?e:`\\color{#569cd6}{${e}}`)})(e)?.replaceAll(/^\s*\|\s*|\s*\|\s*$/gm,"").replaceAll(/\n/g,"<br/>").replaceAll(/\*/g,"\\*").replaceAll(/\|/g,"\\|").replaceAll(/(['"])((?:(?!\1).)*)\1/g,"\\color{#ce9178}{$1$2$1}")}function T(e){if(e)return e.replaceAll(/^@[a-z].+/gm,"").replaceAll(/(\n\s+)+/g,"<br />").replaceAll(/\n/g,"<br />").replaceAll(/(<br \/>)$/g,"")}export default function B(a,x){let B=i(x,a,r.Latest,!0,n.TS),k="";return c(B,n=>{s(n)?k+=function(n){let r=n.name.text;Object.assign($,{[n.name.text]:e(n.getSourceFile().fileName).replace(l.alias["@pkg"],"")});let i=h(n),c=d(i),a=T(i),s=y(i)?.split("|")||[],x=s.includes("comment"),B=s.includes("initial"),k=s.includes("optional"),v=s.includes("version"),w=s.includes("author"),S=a?`\\color{|4||0.45}{${r}}`:r,F=(function(e){let l=[];if(e.heritageClauses){for(let n of e.heritageClauses)if(n.token===t.SyntaxKind.ExtendsKeyword)for(let e of n.types)l.push(e.getText())}return l})(n)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${j(A(e))}</n-tag>`),z=[a,S,c&&`\\color{#52c11b|1||0.9}{${c}}`,F.length>0&&`<sub>\`extends\`</sub> ${F.join(" ")}`].filter(Boolean).join(" "),K=`## ${z}`,N=n.members.filter(e=>f(e)&&e.type?.kind!==o.NeverKeyword||g(e)),q=[];if(N.length>0){for(let e=0,t=N.length;e<t;e++){let t=N[e],l=j(A(g(t)?`(${t.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${t.type?.getText()||"any"}`:t.type?.getText()||"any"),!0),n=h(t),r=A(t.name.getText());!r||r.startsWith("\\color")||(g(t)||function(e){if(e.type){if(!p(e.type))return m(e.type);for(let t of e.type.types)if(m(t))return!0}return!1}(t)||l?.includes("=>")?r=`\\color{#f9a913}{${r}}`:/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`));let o=t.questionToken&&u(t.questionToken);q.push([r,!k&&`\\color{${o?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${o?"✘":"✔"}}`,!x&&A(T(n)),l,!B&&A(function(e){if(!e)return;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():void 0}(n)),!v&&A(d(n)),!w&&(b(n)||b(i))])}let e=!1,t=!1,l=!1,n=!1;for(let r=0,o=q.length;r<o;r++){let o=q[r];!x&&o[2]&&(n=!0),!B&&o[4]&&(l=!0),!v&&o[5]&&(t=!0),!w&&o[6]&&(e=!0)}K+="\n";let r=["属性",!k&&"必要",n&&"说明","类型",l&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");K+=`|${r}|`;let o=[":-",!k&&":-",n&&":-",":-",l&&":-",t&&":-",e&&":-"].filter(Boolean);K+="\n";let c=o.join("|");K+=`|${c}|`;for(let r=0,o=q.length;r<o;r++){let o=q[r];K+="\n";let i=[o[0]||"-",!k&&(o[1]||"-"),n&&(o[2]||"-"),o[3]||"-",l&&(o[4]||"-"),t&&(o[5]||"-"),e&&(o[6]||"-")].filter(Boolean).join("|");K+=`|${i}|`}K+="\n"}return K+"\n"}(n):t.isEnumDeclaration(n)&&(k+=function(n){let r=n.name.text,o=h(n),i=T(o),c=d(o);Object.assign($,{[n.name.text]:e(n.getSourceFile().fileName).replace(l.alias["@pkg"],"")});let a=i?`\\color{|4||0.45}{${r}}`:r,s=[i,a,c&&`\\color{#52c11b|1||0.9}{${c}}`].filter(Boolean).join(" "),u=y(o)?.split("|")||[],f=u.includes("comment"),m=u.includes("version"),p=u.includes("author"),g=`## ${s}`;if(n.members.length>0){let e=[];for(let l=0,r=n.members.length;l<r;l++){let r=n.members[l],i=A(r.name.getText()),c=h(r),a=A(function(e){let l=e.initializer;if(l&&t.isStringLiteral(l))return` '${l.text}'`}(r)),s=A(d(c)),u=A(T(c));!i||i.startsWith("\\color")||/^["'](.+)["']$/.test(i)||(i=`\\color{#4c81db}{${i}}`),e.push([i,!f&&u,a,!m&&s,!p&&(b(c)||b(o))])}let l=!1,r=!1,i=!1;for(let t=0,n=e.length;t<n;t++){let n=e[t];!f&&n[1]&&(i=!0),!m&&n[3]&&(r=!0),!p&&n[4]&&(l=!0)}g+="\n";let c=["属性",i&&"说明","值",r&&"版本",l&&"作者"].filter(Boolean).join("|");g+=`|${c}|`;let a=[":-",i&&":-",":-",r&&":-",l&&":-"].filter(Boolean);g+="\n";let s=a.join("|");g+=`|${s}|`;for(let t=0,n=e.length;t<n;t++){let n=e[t];g+="\n";let o=[n[0]||"-",i&&(n[1]||"-"),n[2]||"-",r&&(n[3]||"-"),l&&(n[4]||"-")].filter(Boolean).join("|");g+=`|${o}|`}}return g+"\n\n"}(n))}),k}
@@ -4,10 +4,10 @@ declare const app: {
4
4
  ssr: boolean;
5
5
  version: string;
6
6
  base: string;
7
- type: import("./index.mjs").AppType;
8
- routerMode: "browser" | "hash" | "memory";
7
+ type: import("../index.mjs").AppType;
8
+ routerMode: "hash" | "browser" | "memory";
9
9
  prefixCls: string | undefined;
10
- theme: import("./index.mjs").Theme | undefined;
10
+ theme: import("../index.mjs").Theme | undefined;
11
11
  description: any;
12
12
  author: any;
13
13
  repository: any;
@@ -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;
@@ -1,4 +1,4 @@
1
- import ReactiveObject from '../reactive-object.mjs';
1
+ import ReactiveObject from '../utils/reactive-object.mjs';
2
2
  export declare const localesModuleName = "@app/locales";
3
3
  export declare const locales: ReactiveObject<{
4
4
  "@app/locales": string;
@@ -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{esm as i,tfc as g}from"../utils.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 c({[localesModuleName]:p([],{})});let d={};async function m(t,o){let a=e(t).replace(/\.[^.]+$/,"");"deleted"===o?delete d[a]:Object.assign(d,{[a]:(await import(i`${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 z=t(r.alias["@"],"./locales");o(z)&&(a(z).filter(e=>!/^\..*/.test(e)&&!/!\.ts$/.test(e)&&!/\.d\.ts$/.test(e)).forEach(e=>{m(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=>{m(e,"added")}),o.on("change",e=>{m(e,"change")}),o.on("unlink",e=>{m(e,"deleted")}),o.once("ready",()=>{s||a()}),process.on("SIGINT",a)}(z,[/^\..*/,/!\.ts$/,/\.d\.ts$/]));
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");if(o(z)){let e=a(z,[".ts$"]).filter(e=>!/^\..*|\.d\.ts$/.test(e));await Promise.all(e.map(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$/])}
@@ -1 +1 @@
1
- import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as p,getAppMergeRouter as e,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as l,docsModuleName as n}from"./docs.mjs";import{exampleModuleName as c}from"./example.mjs";import{locales as x,localesModuleName as d}from"./locales.mjs";import{route as g,routesModuleName as j}from"./routes.mjs";import{CONFIG as u}from"../config.mjs";import h from"../info.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.mjs";export default{[D("@app/info")]:`export default ${JSON.stringify(h)}`,[D("@app/entry")]:o(m(u.alias["@"],"./index.ts"),!!u.rem,!!u.normalizeCss,k,z),[D("@app/rem")]:s(u.rem?.designSize||1680),[D("@app/fallback")]:r(u.fallbackCompPath),[D("@app/coverage")]:f(v.coveragePath),[D("@app/merge-router")]:e(),[D("@app/prefix-router")]:a(),[D("@app/normalize/index.css")]:t(),[D("@app/suspense/index.tsx")]:i(k,z),[D("@app/mdx-scope")]:p(b("site/mdx-scope.ts")),[D(j)]:g.getData(j),[D(c)]:"export default []",[D(d)]:x.getData(d),[D(n)]:l.getData(n)};
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)};
@@ -1,4 +1,4 @@
1
- import ReactiveObject from '../reactive-object.mjs';
1
+ import ReactiveObject from '../utils/reactive-object.mjs';
2
2
  export declare const routesModuleName = "@app/routes";
3
3
  export declare const route: ReactiveObject<{
4
4
  "@app/routes": string;
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{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,10 +1,11 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.9.17-beta.9",
3
+ "version": "3.9.18-beta.0",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
7
7
  "scripts": {
8
+ "prebuild": "oxlint -D correctness -D restriction src",
8
9
  "build": "rm -rf ./lib && tsc && swc src -d lib -D",
9
10
  "postbuild": "npm run cjs && npm run mjs",
10
11
  "cjs": "find ./lib/loader/ -type f -name \"*.js\" -execdir bash -c 'mv \"$1\" \"${1%.js}.cjs\"' _ {} \\;",
@@ -14,31 +15,31 @@
14
15
  "author": "moneko",
15
16
  "license": "MIT",
16
17
  "dependencies": {
17
- "@loadable/webpack-plugin": "5.15.2",
18
- "@moneko/mdx": "0.1.23",
18
+ "@moneko/mdx": "0.1.26",
19
19
  "@swc/core": "1.3.101",
20
20
  "add-asset-html-webpack-plugin": "6.0.0",
21
21
  "chokidar": "3.5.3",
22
- "core-js": "3.34.0",
23
- "core-js-compat": "3.34.0",
24
- "cors": "2.8.5",
22
+ "core-js": "3.35.0",
23
+ "core-js-compat": "3.35.0",
25
24
  "cross-env": "7.0.3",
26
25
  "css-loader": "6.8.1",
27
26
  "express": "4.18.2",
28
- "html-webpack-plugin": "5.5.4",
27
+ "html-webpack-plugin": "5.6.0",
28
+ "http-proxy-middleware": "2.0.6",
29
29
  "less": "4.2.0",
30
- "less-loader": "11.1.3",
30
+ "less-loader": "11.1.4",
31
31
  "lightningcss": "1.22.1",
32
32
  "mini-css-extract-plugin": "2.7.6",
33
- "nodemon": "3.0.2",
33
+ "mock-json-schema": "1.1.1",
34
+ "multer": "1.4.5-lts.1",
34
35
  "style-loader": "3.3.3",
35
36
  "swc-loader": "0.2.3",
36
37
  "swc-plugin-another-transform-imports": "0.2.7",
37
38
  "typescript": "5.3.3",
38
- "webpack": "5.77.0",
39
+ "webpack": "5.89.0",
39
40
  "webpack-bundle-analyzer": "4.10.1",
40
- "webpack-dev-middleware": "6.1.1",
41
- "webpack-hot-middleware": "2.25.4",
41
+ "webpack-dev-middleware": "7.0.0",
42
+ "webpack-hot-middleware": "2.26.0",
42
43
  "webpack-merge": "5.10.0",
43
44
  "webpack-node-externals": "3.0.0",
44
45
  "webpack-virtual-modules": "0.6.1",
@@ -47,18 +48,14 @@
47
48
  },
48
49
  "devDependencies": {
49
50
  "@swc/cli": "0.1.63",
50
- "@types/cors": "2.8.17",
51
51
  "@types/express": "4.17.21",
52
- "@types/nodemon": "^1.19.6",
53
- "eslint-config-neko": "2.3.0",
54
- "eslint-webpack-plugin": "4.0.1",
55
- "sass": "1.69.5",
56
- "sass-loader": "13.3.2",
57
- "stylelint-webpack-plugin": "4.1.1"
52
+ "@types/multer": "1.4.11",
53
+ "oxlint": "0.0.22",
54
+ "sass": "1.69.6",
55
+ "sass-loader": "13.3.3"
58
56
  },
59
57
  "files": [
60
58
  "lib",
61
- "template",
62
59
  "typings/global.d.ts",
63
60
  "typings/bundle-analyzer.d.ts"
64
61
  ]
@@ -1,7 +1,13 @@
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 {
5
+ JsxDomExpressions,
6
+ OptimizationSplitChunksOptions,
7
+ OverrideResolverOption,
8
+ ProxyConfig,
9
+ VirtualModulePluginOption,
10
+ } from '../lib/index';
5
11
  import type { DonePluginOption } from '../lib/plugin/done';
6
12
  import type { MdxOptions } from '@moneko/mdx';
7
13
  import type { Config as SwcConfig, JsMinifyOptions as SwcMinifyOptions } from '@swc/core';
@@ -15,12 +21,6 @@ import type {
15
21
  RuleSetRule,
16
22
  WebpackPluginInstance,
17
23
  } from 'webpack';
18
- import type {
19
- Configuration as DevServerConfiguration,
20
- ProxyArray,
21
- ProxyConfigArray,
22
- ProxyConfigMap,
23
- } from 'webpack-dev-server';
24
24
 
25
25
  export type { TerserMinifyOptions, SwcMinifyOptions };
26
26
  export type WebpackBarOptions = ConstructorParameters<typeof WebpackBar>[0];
@@ -28,9 +28,49 @@ export type MinifierType = 'swc' | 'terser';
28
28
  export declare type AppType = 'mobile' | 'site' | 'backstage' | 'micro' | 'library';
29
29
  export declare type Framework = 'react' | 'solid';
30
30
  export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
31
+ /**
32
+ * 自定义额外的 tags, 当需要添加远程cdn时很有用
33
+ * @description
34
+ * 如果你配置了自定义的 template, 那么默认情况下 tags 将不生效, 请在你的 template 中按照下方案例进行修改
35
+ * @example
36
+ * ```html
37
+ * <!DOCTYPE html>
38
+ <html lang="en">
39
+ <head>
40
+ <title><%= htmlWebpackPlugin.options.title %></title>
41
+ <%
42
+ var customTag="";
43
+ if (htmlWebpackPlugin.options.tags) {
44
+ htmlWebpackPlugin.options.tags.forEach(function(item){
45
+ var { tag = "script", textContent = "", ...attrs } = item;
46
+ var _attrs = "";
47
+ for (const key in attrs) {
48
+ if (attrs.hasOwnProperty(key)) {
49
+ _attrs += `${key}="${attrs[key]}" `;
50
+ }
51
+ }
52
+ customTag += `<${tag} ${_attrs}>${textContent}</${tag}>`;
53
+ });
54
+ }
55
+ %>
56
+ <%= customTag %>
57
+ </head>
58
+ <body>
59
+ <div id="root"></div>
60
+ </body>
61
+ </html>
62
+ * ```
63
+ */
31
64
  tags?: {
65
+ /**
66
+ * 标签内容
67
+ */
32
68
  textContent?: string;
69
+ /** 标签
70
+ * @default script
71
+ */
33
72
  tag?: string;
73
+ inject?: 'body' | 'head';
34
74
  [key: string]: string | null | boolean | number;
35
75
  }[];
36
76
  };
@@ -168,13 +208,17 @@ export declare type ConfigType = {
168
208
  /** node_modules中, 需要开启 cssModules 的模块 */
169
209
  cssModules: string[];
170
210
  /** 按需引入 */
171
- importOnDemand: SwcImportOnDemandTransform;
211
+ importOnDemand?: SwcImportOnDemandTransform;
172
212
  /** 开发服务器代理 */
173
- proxy: ProxyArray | ProxyConfigArray | ProxyConfigMap;
213
+ proxy?: ProxyConfig;
174
214
  /** 自定义缓存目录,为 false 时,不使用缓存 */
175
- cacheDirectory: string | false;
215
+ cacheDirectory?: string | false;
176
216
  /** 开发服务器设置 */
177
- devServer: DevServerConfiguration;
217
+ devServer?: {
218
+ headers?: Record<string, string>;
219
+ host?: string;
220
+ port?: number;
221
+ };
178
222
  /** HtmlWebpackPlugin Option */
179
223
  htmlPluginOption: HtmlWebpackOption | false;
180
224
  /** 自定义插入 html 的 js 和 css
@@ -282,14 +326,7 @@ export declare type ConfigType = {
282
326
  /** 📦 打包完成 */
283
327
  done?: DonePluginOption;
284
328
  mdx?: Omit<MdxOptions, 'value' | 'filepath'>;
285
- jsxDomExpressions?: {
286
- moduleName?: string;
287
- builtIns?: string[];
288
- contextToCustomElements?: boolean;
289
- wrapConditionals?: boolean;
290
- generate?: 'ssr' | 'dom';
291
- hydratable?: boolean;
292
- };
329
+ jsxDomExpressions?: JsxDomExpressions;
293
330
  bar?: Partial<WebpackBarOptions> | false;
294
331
  /** 虚拟模块
295
332
  * @example
@@ -305,7 +342,7 @@ export declare type ConfigType = {
305
342
  * console.log(a); // { name: "user1" }
306
343
  * console.log(b); // { age: 12 }
307
344
  */
308
- virtualModule?: Record<string, string | object>;
345
+ virtualModule?: VirtualModulePluginOption;
309
346
  /** 是否使用 normalize css
310
347
  * @default true
311
348
  */
@@ -480,136 +517,6 @@ export declare interface SourceMapDevToolPluginOptions {
480
517
  test?: string | RegExp | Rule[];
481
518
  }
482
519
 
483
- export declare interface OptimizationSplitChunksOptions {
484
- /**
485
- * Sets the name delimiter for created chunks.
486
- */
487
- automaticNameDelimiter?: string;
488
-
489
- /**
490
- * Assign modules to a cache group (modules from different cache groups are tried to keep in separate chunks, default categories: 'default', 'defaultVendors').
491
- */
492
- cacheGroups?: {
493
- // eslint-disable-next-line @typescript-eslint/ban-types
494
- [index: string]: string | false | Function | RegExp | OptimizationSplitChunksCacheGroup;
495
- };
496
-
497
- /**
498
- * Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
499
- */
500
- chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
501
-
502
- /**
503
- * Sets the size types which are used when a number is used for sizes.
504
- */
505
- defaultSizeTypes?: string[];
506
-
507
- /**
508
- * Size threshold at which splitting is enforced and other restrictions (minRemainingSize, maxAsyncRequests, maxInitialRequests) are ignored.
509
- */
510
- enforceSizeThreshold?: number | { [index: string]: number };
511
-
512
- /**
513
- * Options for modules not selected by any other cache group.
514
- */
515
- fallbackCacheGroup?: {
516
- /**
517
- * Sets the name delimiter for created chunks.
518
- */
519
- automaticNameDelimiter?: string;
520
- /**
521
- * Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
522
- */
523
- chunks?: 'all' | 'initial' | 'async' | ((chunk: Chunk) => boolean);
524
- /**
525
- * Maximal size hint for the on-demand chunks.
526
- */
527
- maxAsyncSize?: number | { [index: string]: number };
528
- /**
529
- * Maximal size hint for the initial chunks.
530
- */
531
- maxInitialSize?: number | { [index: string]: number };
532
- /**
533
- * Maximal size hint for the created chunks.
534
- */
535
- maxSize?: number | { [index: string]: number };
536
- /**
537
- * Minimal size for the created chunk.
538
- */
539
- minSize?: number | { [index: string]: number };
540
- /**
541
- * Minimum size reduction due to the created chunk.
542
- */
543
- minSizeReduction?: number | { [index: string]: number };
544
- };
545
-
546
- /**
547
- * Sets the template for the filename for created chunks.
548
- */
549
- filename?: string | ((pathData: PathData, assetInfo?: AssetInfo) => string);
550
-
551
- /**
552
- * Prevents exposing path info when creating names for parts splitted by maxSize.
553
- */
554
- hidePathInfo?: boolean;
555
-
556
- /**
557
- * Maximum number of requests which are accepted for on-demand loading.
558
- */
559
- maxAsyncRequests?: number;
560
-
561
- /**
562
- * Maximal size hint for the on-demand chunks.
563
- */
564
- maxAsyncSize?: number | { [index: string]: number };
565
-
566
- /**
567
- * Maximum number of initial chunks which are accepted for an entry point.
568
- */
569
- maxInitialRequests?: number;
570
-
571
- /**
572
- * Maximal size hint for the initial chunks.
573
- */
574
- maxInitialSize?: number | { [index: string]: number };
575
-
576
- /**
577
- * Maximal size hint for the created chunks.
578
- */
579
- maxSize?: number | { [index: string]: number };
580
-
581
- /**
582
- * Minimum number of times a module has to be duplicated until it's considered for splitting.
583
- */
584
- minChunks?: number;
585
-
586
- /**
587
- * Minimal size for the chunks the stay after moving the modules to a new chunk.
588
- */
589
- minRemainingSize?: number | { [index: string]: number };
590
-
591
- /**
592
- * Minimal size for the created chunks.
593
- */
594
- minSize?: number | { [index: string]: number };
595
-
596
- /**
597
- * Minimum size reduction due to the created chunk.
598
- */
599
- minSizeReduction?: number | { [index: string]: number };
600
-
601
- /**
602
- * Give chunks created a name (chunks with equal name are merged).
603
- */
604
- // eslint-disable-next-line @typescript-eslint/ban-types
605
- name?: string | false | Function;
606
-
607
- /**
608
- * Compare used exports when checking common modules. Modules will only be put in the same chunk when exports are equal.
609
- */
610
- usedExports?: boolean;
611
- }
612
-
613
520
  export type MemberTransformer =
614
521
  /** 帕斯卡拼写法(大驼峰): 所有单词的首字母大写,然后直接连接起来,单词之间没有连接符 */
615
522
  | 'pascal_case'
@@ -1,3 +0,0 @@
1
- import e from"chalk";import{CONFIG as t}from"./config.mjs";import{getIPv4 as r,getPort as o}from"./net.mjs";import{log as s}from"./utils.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:p,bgGreenBright:a,blueBright:c,greenBright:v}=e,d=t.devServer.port||3e3;export const PORT=await o(d,65535,t.devServer.host);t.devServer.port=PORT;let $="/"===t.basename,u=t.devServer.https?"https:":"http:",f=$?"":t.basename,h=t.devServer.port!==PORT&&m(`Port ${i(d)} is in use, trying ${n(PORT)} instead.
2
- `);function T(e){return`${u}//${"local"===e?t.devServer.host:r()}:${PORT}${f}`}let x=m("You application is running here:"),O=`${p(" Local ")} ${c(T("local"))}
3
- ${a(" Network ")} ${v(T("net"))}`;export function devLog(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([x,"",O,"",l(`Compiled successfully in ${n(`${t.endTime-t.startTime}ms`)}`)]),h&&s(h))}export const headers={"Access-Control-Allow-Origin":"*"};
package/lib/dev-old.d.mts DELETED
@@ -1 +0,0 @@
1
- export {};
package/lib/dev-old.mjs DELETED
File without changes
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`))}
@@ -1 +0,0 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.mjs";import{description as i,keywords as o}from"./info.mjs";import{PACKAGENAME as m,coreName as r}from"./process-env.mjs";import{resolveProgramPath as a}from"./utils.mjs";let{template:p,favicon:n,...l}=Object.assign({template:`node_modules/${r}/template/index.html`,favicon:`node_modules/${r}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||m.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:i,keywords:o},tags:[],template:a(p),favicon:a(n),excludeChunks:["ssr"]},l);export default s;
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;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- export {};
package/lib/minify.mjs DELETED
@@ -1 +0,0 @@
1
- import e from"terser-webpack-plugin";import{merge as o}from"webpack-merge";import{swcMinifyOption as r}from"./swcrc.mjs";export const minify={terser:{minify:e.terserMinify,terserOptions:{ecma:2015,parse:{},compress:{global_defs:{"@alert":"console.log"},drop_console:!0,drop_debugger:!0,pure_funcs:["console.log","console.warn","console.error","console.info"]},toplevel:!1,mangle:!0,module:!1,format:{comments:!1},ie8:!1,keep_classnames:void 0,keep_fnames:!1,safari10:!1},extractComments:!1},swc:{minify:e.swcMinify,terserOptions:r}};export const getMinifyOption=(e,r={})=>{let s=minify[e];return Object.assign(s,{terserOptions:o(s.terserOptions,r)})};
@@ -1 +0,0 @@
1
- import{CONFIG as i}from"./config.mjs";import o from"./html-plugin-option.mjs";let f=i.prefixCls||"n",n={"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`,"@favicon":JSON.stringify(o.favicon)};Object.assign(n,i.modifyVars);export default n;
@@ -1 +0,0 @@
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,m={},i={},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++)m[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?i[`./${t}`]=o(t):"[object Object]"===Object.prototype.toString.call(t)&&(i[`./${t.name}`]=o(t.path))}return new a({filename:"remote_entry.js",...e,remotes:l,exposes:i})});n.length&&(n.push(new t),n.push(new s(/(.*)/,e=>{m[e.request]&&(e.request=m[e.request])})));export default n;