@moneko/core 3.8.7-beta.7 → 3.8.7

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 (57) hide show
  1. package/lib/common.js +1 -1
  2. package/lib/config.js +1 -1
  3. package/lib/has-pkg.js +1 -1
  4. package/lib/html-plugin-option.js +1 -1
  5. package/lib/{vm/app.d.ts → info.d.ts} +2 -2
  6. package/lib/info.js +1 -0
  7. package/lib/loader/mdx.cjs +1 -1
  8. package/lib/loader/mdx.d.cts +1 -1
  9. package/lib/loader/ts-doc.cjs +1 -1
  10. package/lib/loader/ts-doc.d.cts +1 -1
  11. package/lib/module.config.js +1 -1
  12. package/lib/paths.js +1 -1
  13. package/lib/plugin/override-resolve.js +1 -1
  14. package/lib/plugin/virtual-module.js +1 -1
  15. package/lib/seo.js +1 -1
  16. package/lib/tsloader.config.js +1 -1
  17. package/lib/utils.d.ts +0 -5
  18. package/lib/utils.js +2 -2
  19. package/lib/vm/coverage.d.ts +2 -31
  20. package/lib/vm/coverage.js +1 -1
  21. package/lib/vm/docs.js +1 -1
  22. package/lib/vm/entry.d.ts +2 -0
  23. package/lib/vm/entry.js +1 -0
  24. package/lib/vm/example.js +1 -1
  25. package/lib/vm/generate-doc.js +1 -0
  26. package/lib/vm/locales.js +2 -2
  27. package/lib/vm/mdx-scope.d.ts +2 -0
  28. package/lib/vm/mdx-scope.js +1 -0
  29. package/lib/vm/routes.js +1 -1
  30. package/lib/vm/utils.d.ts +1 -1
  31. package/lib/vm/utils.js +1 -1
  32. package/package.json +2 -2
  33. package/lib/loader/app-comment.cjs +0 -1
  34. package/lib/loader/app-comment.d.cts +0 -6
  35. package/lib/loader/app-docs.cjs +0 -1
  36. package/lib/loader/app-docs.d.cts +0 -6
  37. package/lib/loader/generate-doc.cjs +0 -1
  38. package/lib/polyfills/rem.d.ts +0 -0
  39. package/lib/polyfills/rem.js +0 -0
  40. package/lib/virtual-modules.d.ts +0 -2
  41. package/lib/virtual-modules.js +0 -1
  42. package/lib/vm/app-entry.d.ts +0 -2
  43. package/lib/vm/app-entry.js +0 -1
  44. package/lib/vm/app.js +0 -1
  45. package/lib/vm/fallback.d.ts +0 -2
  46. package/lib/vm/fallback.js +0 -1
  47. package/lib/vm/init-files.d.ts +0 -0
  48. package/lib/vm/init-files.js +0 -0
  49. package/lib/vm/merge-router.d.ts +0 -2
  50. package/lib/vm/merge-router.js +0 -1
  51. package/lib/vm/normalize-css.d.ts +0 -2
  52. package/lib/vm/normalize-css.js +0 -1
  53. package/lib/vm/prefix-router.d.ts +0 -2
  54. package/lib/vm/prefix-router.js +0 -1
  55. package/lib/vm/rem.d.ts +0 -2
  56. package/lib/vm/rem.js +0 -1
  57. /package/lib/{loader/generate-doc.d.cts → vm/generate-doc.d.ts} +0 -0
package/lib/common.js CHANGED
@@ -1 +1 @@
1
- import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import{CONFIG as l,PUBLICPATH as r}from"./config.js";import s from"./html-plugin-option.js";import n from"./module-federation.js";import a from"./module.config.js";import i,{CUSTOMCONFIG as p}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import m from"./plugin/override-resolve.js";import u from"./plugin/virtual-module.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as b,resolveProgramPath as j}from"./utils.js";import w from"./virtual-modules.js";let{AutomaticPrefetchPlugin:v,DefinePlugin:k,SourceMapDevToolPlugin:x,WatchIgnorePlugin:C}=o,O=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:j(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:r,asyncChunks:!0,charset:!0};let $={main:b("@app/entry")};l.polyfill&&Object.assign($,{"dom-polyfills":[`${i.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?$={main:l.entry}:Object.keys(l.entry)&&Object.assign($,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let P=l.basename.split("/").filter(Boolean).length,B=`${Array(P).fill("..").join("/")+(P?"/":"")}404.html`,{pathSegmentsToKeep:D=P,path:M=B}=l.fixBrowserRouter||{},R=!1;l.cacheDirectory&&(R={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[p,process.env.NODE_ENV].filter(Boolean).join("-"),version:h});let A=Object.assign({original:l.alias["@"],override:p&&j(p)},l.overrideResolve);export const clientConfig={entry:$,stats:"errors-only",cache:R,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[...n,new u(w),new v,l.htmlPluginOption&&new t(s),l.fixBrowserRouter&&new t({filename:M,inject:!1,templateContent:()=>`<html lang="en"><head><title>${s.title}</title><script>const pathKeep = ${D||P};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(O),y&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new k({"process.env":JSON.stringify(l.env)}),new C({paths:[/\.d\.ts$/]}),l.sourceMap&&new x(l.sourceMap),...l.plugins].filter(e=>!!e),node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{imports:!0,entries:!0},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new m(A),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:a,externals:l.externals,output:outputConfig};
1
+ import e from"add-asset-html-webpack-plugin";import t from"html-webpack-plugin";import o from"webpack";import{CONFIG as l,PUBLICPATH as r}from"./config.js";import s from"./html-plugin-option.js";import n from"./module-federation.js";import a from"./module.config.js";import i,{CUSTOMCONFIG as p}from"./paths.js";import c from"./plugin/add-entry-attribute.js";import m from"./plugin/override-resolve.js";import u from"./plugin/virtual-module.js";import{PACKAGENAME as f,PACKAGEVERSION as h,isDev as d,isLibrary as g,isMicro as y}from"./process-env.js";import{resolveNodeModulesPath as b,resolveProgramPath as j}from"./utils.js";let{AutomaticPrefetchPlugin:w,DefinePlugin:v,SourceMapDevToolPlugin:k,WatchIgnorePlugin:x}=o,C=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:j(g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${d?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:f,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${f}`,pathinfo:d,clean:!0,publicPath:r,asyncChunks:!0,charset:!0};let O={main:b("@app/entry")};l.polyfill&&Object.assign(O,{"dom-polyfills":[`${i.corePath}/polyfills/replace-children.js`]}),l.entry&&("string"==typeof l.entry?O={main:l.entry}:Object.keys(l.entry)&&Object.assign(O,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let $=l.basename.split("/").filter(Boolean).length,P=`${Array($).fill("..").join("/")+($?"/":"")}404.html`,{pathSegmentsToKeep:M=$,path:B=P}=l.fixBrowserRouter||{},D=!1;l.cacheDirectory&&(D={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:l.cacheDirectory,memoryCacheUnaffected:!0,name:[p,process.env.NODE_ENV].filter(Boolean).join("-"),version:h});let R=Object.assign({original:l.alias["@"],override:p&&j(p)},l.overrideResolve);export const clientConfig={entry:O,stats:"errors-only",cache:D,infrastructureLogging:{level:"error"},target:"web",externalsPresets:l.externalsPresets,plugins:[...n,new u(l.virtualModule||{}),new w,l.htmlPluginOption&&new t(s),l.fixBrowserRouter&&new t({filename:B,inject:!1,templateContent:()=>`<html lang="en"><head><title>${s.title}</title><script>const pathKeep = ${M||$};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(C),y&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new v({"process.env":JSON.stringify(l.env)}),new x({paths:[/\.d\.ts$/]}),l.sourceMap&&new k(l.sourceMap),...l.plugins].filter(e=>!!e),node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:d&&{imports:!1,entries:!1},buildHttp:l.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:l.alias,plugins:[l.overrideResolve&&new m(R),...l.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:a,externals:l.externals,output:outputConfig};
package/lib/config.js CHANGED
@@ -1 +1 @@
1
- import{accessSync as e,constants as t}from"fs";import o from"chalk";import{merge as s}from"webpack-merge";import i,{CUSTOMCONFIG as a}from"./paths.js";import{FRAMEWORK as n,PACKAGENAME as r,coreName as l,isDev as c,isLibrary as m,isMobile as p,jsxImportSource as u,mainDirectory as d}from"./process-env.js";import{isFunction as h,log as f,readConf as g,resolveProgramPath as x}from"./utils.js";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"],P={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{js:{},css:{}},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:p?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":x(d)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:i.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${l}/template/index.html`,favicon:`node_modules/${l}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{route:{test:/[\\/].git[\\/]router/,priority:-10,reuseExistingChunk:!0,name:"route"},example:{test:/[\\/].git[\\/]example/,priority:-10,reuseExistingChunk:!0,name:"example"}}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:c,jsxImportSource:u,providerImportSource:`@moneko/${n}/mdx`},jsxDomExpressions:{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1},bar:{name:"Client",color:"#6f42c1"},virtualModule:{},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${i.httpCachePath}/http.lock`,cacheLocation:`${i.httpCachePath}/data`,upgrade:!0}};m&&(P.alias=Object.assign(P.alias,{"@pkg":i.componentsPath,[r]:i.componentsPath}));let w=P,b={},k={};try{e(i.configPath,t.R_OK);let o=(await g(i.configPath,"index")).default;b=h(o)?o(process):o}catch(e){f(o.red(e))}if(a)try{e(i.customConfigPath,t.R_OK);let o=(await g(i.customConfigPath,a)).default;k=h(o)?o(process):o}catch(e){f(o.red(e))}"tsc"===(w=s(w,b,k)).compiler&&w.minifier&&(w.minifier.js||Object.assign(w.minifier,{js:{type:"terser"}}),w.minifier.css||Object.assign(w.minifier,{css:{type:"cssnano"}})),!1===w.devtool&&(w.sourceMap=!1),!1===w.sourceMap&&(w.devtool=!1),w.fixBrowserRouter&&w.htmlPluginOption&&(w.htmlPluginOption.tags||(w.htmlPluginOption.tags=[]),w.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=w;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:a,log:f};
1
+ import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t,{CUSTOMCONFIG as s}from"./paths.js";import{FRAMEWORK as i,PACKAGENAME as a,coreName as n,isDev as l,isLibrary as r,isMobile as c,isSolid as m,jsxImportSource as p,mainDirectory as d}from"./process-env.js";import{isFunction as u,log as h,readConf as f,resolveProgramPath as g}from"./utils.js";let x=["@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={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{js:{},css:{}},sourceMap:{filename:"[file].map",publicPath:""},env:{NODE_ENV:process.env.NODE_ENV},basename:"/",publicPath:"/",rem:{designSize:c?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(d)},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:t.webpackCachePath,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`node_modules/${n}/template/index.html`,favicon:`node_modules/${n}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:{chunks:"all",minSize:1024,minChunks:1,cacheGroups:{}},runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:x,js:x,media:x,font:x,wasm:[]},mdx:{jsx:!1,development:l,jsxImportSource:p,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:{},bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${t.httpCachePath}/http.lock`,cacheLocation:`${t.httpCachePath}/data`,upgrade:!0}};m&&Object.assign(P,{jsxDomExpressions:{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}}),r&&(P.alias=Object.assign(P.alias,{"@pkg":t.componentsPath,[a]:t.componentsPath}));let w=P,C={},b={};if(e(t.configPath)){let e=(await f(t.configPath,"index")).default;C=u(e)?e(process):e}if(s&&e(t.customConfigPath)){let e=(await f(t.customConfigPath,s)).default;b=u(e)?e(process):e}"tsc"===(w=o(w,C,b)).compiler&&w.minifier&&(w.minifier.js||Object.assign(w.minifier,{js:{type:"terser"}}),w.minifier.css||Object.assign(w.minifier,{css:{type:"cssnano"}})),!1===w.devtool&&(w.sourceMap=!1),!1===w.sourceMap&&(w.devtool=!1),w.fixBrowserRouter&&w.htmlPluginOption&&(w.htmlPluginOption.tags||(w.htmlPluginOption.tags=[]),w.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=w;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:s,log:h};
package/lib/has-pkg.js CHANGED
@@ -1 +1 @@
1
- import{accessSync as t,constants as r}from"fs";import{resolveNodeModulesPath as o}from"./utils.js";export function hasPkg(s){let a;try{t(o(`${s}/package.json`),r.R_OK),a=!0}catch(t){a=!1}return a}
1
+ import{fileExists as o}from"@moneko/mdx";import{resolveNodeModulesPath as r}from"./utils.js";export function hasPkg(m){return o(r(`${m}/package.json`))}
@@ -1 +1 @@
1
- import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import{PACKAGENAME as i,coreName as o}from"./process-env.js";import{resolveProgramPath as a}from"./utils.js";import m from"./vm/app.js";let{template:p,favicon:r,...l}=Object.assign({template:`node_modules/${o}/template/index.html`,favicon:`node_modules/${o}/template/favicon.ico`},t.htmlPluginOption||{}),n=e({title:t.env?.PROJECTNAME||i.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{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,user-scalable=no","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:m.description||""},tags:[],template:a(p),favicon:a(r)},l);export default n;
1
+ import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import i from"./info.js";import{PACKAGENAME as o,coreName as a}from"./process-env.js";import{resolveProgramPath as r}from"./utils.js";let{template:m,favicon:p,...n}=Object.assign({template:`node_modules/${a}/template/index.html`,favicon:`node_modules/${a}/template/favicon.ico`},t.htmlPluginOption||{}),l=e({title:t.env?.PROJECTNAME||o.toLocaleUpperCase()||"Title",filename:"index.html",hash:!1,minify:{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,user-scalable=no","apple-mobile-web-app-capable":"yes",renderer:"webkit",description:i.description||""},tags:[],template:r(m),favicon:r(p)},n);export default l;
@@ -3,10 +3,10 @@ declare const app: {
3
3
  projectName: string;
4
4
  version: string;
5
5
  base: string;
6
- type: import("../index.js").AppType;
6
+ type: import("./index.js").AppType;
7
7
  routerMode: "browser" | "hash" | "memory";
8
8
  prefixCls: string | undefined;
9
- theme: import("../index.js").Theme | undefined;
9
+ theme: import("./index.js").Theme | undefined;
10
10
  description: any;
11
11
  author: any;
12
12
  repository: any;
package/lib/info.js ADDED
@@ -0,0 +1 @@
1
+ import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"./config.js";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s}from"./process-env.js";import{resolveProgramPath as p,toUpperCaseString as i}from"./utils.js";let{description:m,author:a,repository:n,keywords:f}=JSON.parse(e(p("package.json"))||"{}"),l={name:t,projectName:JSON.stringify(i(t).replace(/-/g," ")),version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:m,author:"string"==typeof a?{name:a}:a,repository:"string"==typeof a?{url:n}:n,keywords:f};export default l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t}});const e=require("@moneko/mdx");function t(t){return this.cacheable(!0),(0,e.mdxSync)({value:t,filepath:this.resourcePath,...this.getOptions()}).code}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t}});const e=require("@moneko/mdx");function t(t){let n=this.async();this.cacheable(!0),(0,e.mdx)({value:t,filepath:this.resourcePath,...this.getOptions()}).then(e=>{n(null,e.code)}).catch(n)}
@@ -1,3 +1,3 @@
1
1
  import { type MdxOptions } from '@moneko/mdx';
2
2
  import type { LoaderContext } from 'webpack';
3
- export default function (this: LoaderContext<Omit<MdxOptions, 'value'>>, value: string): string;
3
+ export default function (this: LoaderContext<Omit<MdxOptions, 'value'>>, value: string): void;
@@ -1 +1 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return c}});const t=require("fs"),r=(e=require("./generate-doc.cjs"))&&e.__esModule?e:{default:e},s={},i={};function c(e){let c=this.getOptions(),n=this.resourcePath;void 0===i[n]&&(i[n]=0);let a=(0,t.statSync)(n).mtime.getTime(),o=s[n]!==a;return o&&(i[n]=i[n]+1,Object.assign(s,{[n]:a}),c.comment.setData(`@app/comment/${n.split("/").slice(-2).join("/").replace(/\.tsx?/,".md")}`,(0,r.default)(e,n))),this.cacheable(i[n]>1&&o),e}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return i}});const e=require("fs"),t={},s={};function i(i){let r=this.resourcePath,{comment:n,generateDoc:c}=this.getOptions();return void 0===s[r]&&(s[r]=0),(0,e.stat)(r,(e,o)=>{if(!e){let e=o.mtime.getTime();t[r]!==e&&(s[r]=s[r]+1,Object.assign(t,{[r]:e}),n.setData(`@app/comment/${r.split("/").slice(-2).join("/").replace(/\.tsx?/,".md")}`,c(i,r)))}}),this.cacheable(!0),i}
@@ -1,6 +1,6 @@
1
1
  import type ReactiveObject from '../reactive-object.js';
2
2
  import type { LoaderContext } from 'webpack';
3
3
  export default function (this: LoaderContext<{
4
- test: RegExp;
5
4
  comment: ReactiveObject<Record<string, string>>;
5
+ generateDoc(content: string, path: string): string;
6
6
  }>, value: string): string;
@@ -1 +1 @@
1
- import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as t,PUBLICPATH as o}from"./config.js";import{hasPkg as r}from"./has-pkg.js";import l from"./modify-vars.js";import a,{CUSTOMCONFIG as i}from"./paths.js";import{FRAMEWORK as n,isDev as c,isLibrary as d,isMicro as m}from"./process-env.js";import p from"./swcrc.js";import u from"./tsloader.config.js";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.js";import{comment as x}from"./vm/docs.js";let $={loader:`${a.corePath}/loader/css-unicode.cjs`},g=m?o:"../",v={loader:e.loader,options:{publicPath:"/"!==g?g:"../"}},j=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:(await import("@moneko/postcss")).default}};c&&(v="style-loader");let w=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(f),h=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(y)],b=["components","example","mock","site","src","server"].map(y);i&&b.push(y(i)),t.overrideResolve&&t.overrideResolve.override&&b.push(t.overrideResolve.override);let _={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=w.length;s<t;s++)if(e&&e?.includes(w[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},k=c&&{loader:"@teamsupercell/typings-for-css-modules-loader",options:{verifyOnly:!c}},O=[v,k,_,j,$,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:l,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:h}}].filter(Boolean),B="tsc"===t.compiler,L={loader:B?"ts-loader":"swc-loader",options:B?u:p(c)};function P(e){return b.concat(t.rulesInclude?.[e]?.map(f)||[])}let R=P("media"),M={rules:[d&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:t.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",use:[{loader:`${a.corePath}/loader/ts-doc.cjs`,options:{comment:x}}]},{oneOf:[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:/\.wasm$/i,type:"webassembly/async",include:P("wasm")},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:R},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>s(e.toString())},include:R},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:R},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:R},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:P("font")},{test:/\.(sa|sc)ss$/i,use:[v,k,_,j,$,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:P("css")},{test:/\.less$/i,use:O,include:P("css")},{test:/\.css$/i,use:[v,"css-loader",j,$].filter(Boolean),include:P("css")},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,L].filter(Boolean),include:P("js")},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,{loader:`${a.corePath}/loader/mdx.cjs`,options:t.mdx}].filter(Boolean),include:b,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/i,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules].filter(e=>"object"==typeof e)};export default M;
1
+ import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as t,PUBLICPATH as o}from"./config.js";import{hasPkg as r}from"./has-pkg.js";import a from"./modify-vars.js";import l,{CUSTOMCONFIG as i}from"./paths.js";import{FRAMEWORK as n,isDev as c,isLibrary as d,isMicro as m}from"./process-env.js";import p from"./swcrc.js";import u from"./tsloader.config.js";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.js";import{comment as x}from"./vm/docs.js";import g from"./vm/generate-doc.js";let $={loader:`${l.corePath}/loader/css-unicode.cjs`},v=m?o:"../",j={loader:e.loader,options:{publicPath:"/"!==v?v:"../"}},w=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:(await import("@moneko/postcss")).default}};c&&(j="style-loader");let h=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(f),b=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(y)],_=["components","example","mock","site","src","server"].map(y);i&&_.push(y(i)),t.overrideResolve&&t.overrideResolve.override&&_.push(t.overrideResolve.override);let k={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=h.length;s<t;s++)if(e&&e?.includes(h[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},O=c&&{loader:"@teamsupercell/typings-for-css-modules-loader",options:{verifyOnly:!c}},B=[j,O,k,w,$,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:a,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:b}}].filter(Boolean),L="tsc"===t.compiler,P={loader:L?"ts-loader":"swc-loader",options:L?u:p(c)};function R(e){return _.concat(t.rulesInclude?.[e]?.map(f)||[])}let M=R("media"),I={rules:[d&&c&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:t.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${l.corePath}/loader/ts-doc.cjs`,options:{comment:x,generateDoc:g}},{oneOf:[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:/\.wasm$/i,type:"webassembly/async",include:R("wasm")},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:M},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>s(e.toString())},include:M},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:M},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:M},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:R("font")},{test:/\.(sa|sc)ss$/i,use:[j,O,k,w,$,{loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}}].filter(Boolean),include:R("css")},{test:/\.less$/i,use:B,include:R("css")},{test:/\.css$/i,use:[j,"css-loader",w,$].filter(Boolean),include:R("css")},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,P].filter(Boolean),include:R("js")},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,{loader:`${l.corePath}/loader/mdx.cjs`,options:t.mdx}].filter(Boolean),include:_,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/i,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules].filter(e=>"object"==typeof e)};export default I;
package/lib/paths.js CHANGED
@@ -1 +1 @@
1
- import{existsSync as e,mkdirSync as o}from"fs";import c from"url";let t=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};t?.forEach(e=>{let o=e.split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let a=process.cwd(),r=`${a}/node_modules/.cache/.mo`;e(r)||o(r,{recursive:!0});export default{corePath:c.fileURLToPath(new URL(".",import.meta.url)),programPath:a,webpackCachePath:`${a}/node_modules/.temp_cache`,cachePath:r,httpCachePath:`${a}/node_modules/.cache/http`,swcCachePath:`${a}/node_modules/.swc`,configPath:`${a}/config/index.ts`,customConfigPath:`${a}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${a}/coverage/clover.xml`,pagesPath:`${a}/src/pages`,componentsPath:`${a}/components`};
1
+ import e from"url";import{createDirAll as o,directoryExists as c}from"@moneko/mdx";let t=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};t?.forEach(e=>{let o=e.split("=");Object.assign(yarnArgv,{[o[0]]:o[1]||!0})});export const CUSTOMCONFIG=process.env.npm_config_config||yarnArgv.config;let a=process.cwd(),n=`${a}/node_modules/.cache/.mo`;c(n)||o(n);export default{corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:a,webpackCachePath:`${a}/node_modules/.temp_cache`,cachePath:n,httpCachePath:`${a}/node_modules/.cache/http`,swcCachePath:`${a}/node_modules/.swc`,configPath:`${a}/config/index.ts`,customConfigPath:`${a}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${a}/coverage/clover.xml`,pagesPath:`${a}/src/pages`,componentsPath:`${a}/components`};
@@ -1 +1 @@
1
- import{existsSync as t}from"fs";import{relative as e}from"path";import r from"../paths.js";let a="OverrideResolverPlugin";export default class{constructor(t){this.options=t}apply(i){let{override:s,original:o}=this.options;if(s&&o){let l=`./${e(r.programPath,o)}`,p=`./${e(r.programPath,s)}`;i.getHook("existing-file").tapAsync(a,(e,r,h)=>{let n=e.request||e.path;if(n&&n.startsWith(o)&&e.relativePath){let f=n.replace(o,s);if(t(f)){let t=e.relativePath.replace(l,p);return Object.assign(e,{path:f,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),i.doResolve("resolved",e,`${a} 使用目标模块${s}`,r,h)}}return h()})}}}
1
+ import{relative as e}from"path";import{fileExists as t}from"@moneko/mdx";import r from"../paths.js";let a="OverrideResolverPlugin";export default class{constructor(e){this.options=e}apply(i){let{override:o,original:s}=this.options;if(o&&s){let l=`./${e(r.programPath,s)}`,p=`./${e(r.programPath,o)}`;i.getHook("existing-file").tapAsync(a,(e,r,n)=>{let h=e.request||e.path;if(h&&h.startsWith(s)&&e.relativePath){let m=h.replace(s,o);if(t(m)){let t=e.relativePath.replace(l,p);return Object.assign(e,{path:m,relativePath:t,__innerRequest_relativePath:t,__innerRequest:t}),i.doResolve("resolved",e,`${a} 使用目标模块${o}`,r,n)}}return n()})}}}
@@ -1 +1 @@
1
- import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.js";import{resolveNodeModulesPath as e}from"../utils.js";import{comment as p,docs as s,docsModuleName as a}from"../vm/docs.js";import{exampleModuleName as r,examples as i}from"../vm/example.js";import{locales as l,localesModuleName as n}from"../vm/locales.js";import{route as f,routesModuleName as m}from"../vm/routes.js";export default class{constructor(o){this.options=o,this.hasTapped=!1}apply(c){let h=new o({[e(m)]:f.getData(m),[e(r)]:"export default []",[e(n)]:l.getData(n),[e(a)]:s.getData(a)});function u(o,t){let p=e(o);h.writeModule(p,t||"")}h.apply(c),f.on("change",u),l.on("change",u),t&&(i.on("change",u),s.on("change",u),p.on("change",u)),c.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let o in this.hasTapped=!0,this.options)if(Object.prototype.hasOwnProperty.call(this.options,o)){let t=this.options[o];u(o,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let o of i)u(...o);for(let o of s)u(...o);for(let o of p)u(...o)}})}}
1
+ import e from"webpack-virtual-modules";import{CONFIG as t}from"../config.js";import o from"../info.js";import{FRAMEWORKNAME as n,isLibrary as r,isReact as i}from"../process-env.js";import{resolveNodeModulesPath as a}from"../utils.js";import l from"../vm/coverage.js";import{comment as p,docs as s,docsModuleName as c}from"../vm/docs.js";import m from"../vm/entry.js";import{exampleModuleName as u,examples as d}from"../vm/example.js";import{locales as f,localesModuleName as b}from"../vm/locales.js";import h from"../vm/mdx-scope.js";import{route as g,routesModuleName as y}from"../vm/routes.js";let x=t.fallbackCompPath&&`import F from "${t.fallbackCompPath}";export default F;`,k=t.rem?.designSize||1680;export default class{constructor(e){this.options=e,this.hasTapped=!1}apply(t){let v=new e({[a("@app/info")]:`export default ${JSON.stringify(o)}`,[a("@app/entry")]:m,[a("@app/rem")]:`!function(e,n){function t(){let n=e.documentElement,t=n.clientWidth||e.body.clientWidth,i=t<=375?375:${k},o=t;o=t<=375?t:t<=${k}?i:t;let d=16/i*o+"px";d!==n.style.fontSize&&(n.style.fontSize=d)}t(),"addEventListener"in e&&n.addEventListener("orientationchange"in n?"orientationchange":"resize",t,!1)}(document,window);`,[a("@app/fallback")]:x||"export default null",[a("@app/coverage")]:l,[a("@app/merge-router")]:"function merge(e,r){if(!e.length)return void 0;const n=[];e.forEach(e=>{const t=n.findIndex(n=>n[r]==e[r]);if(t>-1){const i=[...n[t].children||[],...e.children||[]];n[t]=Object.assign(e,n[t],n[t].meta&&{meta:{...n[t].meta,...e.meta}});if(i.length){n[t].children=merge(i,r)}}else{n.push(Object.assign(e,Array.isArray(e.children)&&{children:merge(e.children,r)}))}});return n}export default merge;",[a("@app/prefix-router")]:'import { createElement, isValidElement } from "react";import { Outlet } from "react-router-dom";function prefix(e){return e.map(function(e){var n=Object.assign({key:e.path},e);return n.element?isValidElement(n.element)||(n.element=createElement(n.element,n.meta)):n.element=createElement(Outlet,null),Array.isArray(n.children)&&(n.children=prefix(n.children)),n})}export default prefix;',[a("@app/normalize/index.css")]:'html,body{margin:0;padding:0;line-height:1.8}input,textarea{caret-color:inherit}h1{margin:0.67em 0;font-size:2em}hr{overflow:visible;block-size:0;box-sizing:content-box}pre{font-size:1em;font-family:monospace}a{text-decoration:none;background-color:transparent;cursor:pointer}abbr[title]{border-block-end:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-size:1em;font-family:monospace}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{inset-block-end:-0.25em}sup{inset-block-start:-0.5em}img{border-style:none}img,button{outline:1px solid transparent}button,input,optgroup,select,textarea{margin:0;font-size:100%;font-family:inherit;line-height:1.15}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted var(--primary-outline)}fieldset{padding:0.35em 0.75em 0.625em}legend{display:table;padding:0;max-inline-size:100%;white-space:normal;color:inherit;box-sizing:border-box}progress{vertical-align:baseline}textarea{overflow:auto}details{display:block}summary{display:list-item}template,[hidden]{display:none}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{block-size:auto}[type="search"]{appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}::-webkit-scrollbar{inline-size:5px;block-size:5px}::-webkit-scrollbar-track,::-webkit-scrollbar-thumb{background-color:transparent}:hover::-webkit-scrollbar-thumb{background-color:var(--primary-selection)}::-webkit-scrollbar-thumb:hover{background-color:var(--primary-hover)}::-webkit-scrollbar-thumb:active{background-color:var(--primary-active)}::-webkit-scrollbar-button{display:none}',[a("@app/suspense/index.tsx")]:`import ${i?"React,":""}{Suspense,lazy} from "${n}";import Fallback from '@app/fallback';${r?'import scope from "@app/mdx-scope";':""}function SuspenseComp(props) {const Lazy = lazy(props.comp);return (<Suspense fallback={Fallback && <Fallback />}><Lazy ${r?"components={scope}":""}/></Suspense>);}export default SuspenseComp;`,[a("@app/mdx-scope")]:h,[a(y)]:g.getData(y),[a(u)]:"export default []",[a(b)]:f.getData(b),[a(c)]:s.getData(c)});function z(e,t){let o=a(e);v.writeModule(o,t||"")}v.apply(t),g.on("change",z),f.on("change",z),r&&(d.on("change",z),s.on("change",z),p.on("change",z)),t.hooks.compilation.tap("VirtualModuleWebpackPlugin",()=>{if(!this.hasTapped){for(let e in this.hasTapped=!0,this.options)if(Object.prototype.hasOwnProperty.call(this.options,e)){let t=this.options[e];z(e,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let e of d)z(...e);for(let e of s)z(...e);for(let e of p)z(...e)}})}}
package/lib/seo.js CHANGED
@@ -1 +1 @@
1
- import{existsSync as t,mkdirSync as o}from"fs";import{join as r}from"path";import{saveFileSync as m}from"@moneko/mdx";import{outputConfig as e}from"./common.js";import{CONFIG as i}from"./config.js";import{resolveProgramPath as s}from"./utils.js";import{routes as p}from"./vm/routes.js";export default(()=>{let{domain:f,nojekyll:n,path:a}=i.seo||{},h=a&&s(a)||e?.path;if(!f||!h)return;t(h)||o(h);let l=i.basename,c=l.endsWith("/")?l:`${l}/`;m(r(h,"CNAME"),f),m(r(h,"robots"),`Sitemap: https://${f}${c}sitemap.txt`);let j=[];!function t(o){o.forEach(o=>{j.push(`https://${f}${c}${o.key}`),Array.isArray(o.children)&&t(o.children)})}(p),m(r(h,"sitemap.txt"),j.join("\n")),n&&m(r(h,".nojekyll"),"")});
1
+ import{join as t}from"path";import{createDirAll as o,directoryExists as r,saveFileSync as m}from"@moneko/mdx";import{outputConfig as e}from"./common.js";import{CONFIG as i}from"./config.js";import{resolveProgramPath as s}from"./utils.js";import{routes as p}from"./vm/routes.js";export default(()=>{let{domain:n,nojekyll:a,path:f}=i.seo||{},h=f&&s(f)||e?.path;if(!n||!h)return;r(h)||o(h);let l=i.basename,c=l.endsWith("/")?l:`${l}/`;m(t(h,"CNAME"),n),m(t(h,"robots"),`Sitemap: https://${n}${c}sitemap.txt`);let j=[];!function t(o){o.forEach(o=>{j.push(`https://${n}${c}${o.key}`),Array.isArray(o.children)&&t(o.children)})}(p),m(t(h,"sitemap.txt"),j.join("\n")),a&&m(t(h,".nojekyll"),"")});
@@ -1 +1 @@
1
- import t from"fs";import r from"ts-import-plugin";import o from"webpack-merge";import{CONFIG as e}from"./config.js";import{isFunction as s,readConf as m,resolveProgramPath as a}from"./utils.js";let i=[];Array.isArray(e.importOnDemand)&&Object.assign(i,e.importOnDemand.map(t=>r(t)));let n=[...i],p={transpileOnly:!0,getCustomTransformers:()=>({before:n})};try{let r=a("tsloader.config.ts");t.accessSync(r,t.constants.R_OK);let e=(await m(r,"tsloader.config")).default;p=o(p,s(e)?e(process):e)}catch(t){}export default p;
1
+ import{fileExists as r}from"@moneko/mdx";import t from"ts-import-plugin";import o from"webpack-merge";import{CONFIG as e}from"./config.js";import{isFunction as m,readConf as i,resolveProgramPath as a}from"./utils.js";let s=[];Array.isArray(e.importOnDemand)&&Object.assign(s,e.importOnDemand.map(r=>t(r)));let p=[...s],f={transpileOnly:!0,getCustomTransformers:()=>({before:p})},n=a("tsloader.config.ts");if(r(n))try{let r=(await i(n,"tsloader.config")).default;f=o(f,m(r)?r(process):r)}catch(r){}export default f;
package/lib/utils.d.ts CHANGED
@@ -1,9 +1,4 @@
1
1
  export declare function esm(templateStrings: TemplateStringsArray, ...substitutions: unknown[]): string;
2
- /** 获取导出标识
3
- * @param {string} path 文件地址
4
- * @returns {string[]} 包含的标识
5
- */
6
- export declare function getExportTokens(path: string): string[];
7
2
  export declare function log(msg: string | string[]): void;
8
3
  export declare function tfc(filepath: string): string;
9
4
  export declare function readConf(src: string, name: string): Promise<any>;
package/lib/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- import{resolve as t}from"path";import e from"readline";import{loadFileSync as o,saveFileSync as r}from"@moneko/mdx";import{transformFileSync as n}from"@swc/core";import c from"./paths.js";import s from"./resolver-sync.js";export function esm(t,...e){let o=t.raw[0];for(let r=0;r<e.length;r++)o+=e[r]+t.raw[r+1];return`data:text/javascript;base64,${Buffer.from(o).toString("base64")}`}let p=/export\s+(?:async\s+)?(?:function|const)\s+(\w+)/g;export function getExportTokens(t){let e;let r=o(t)||"",n=[];for(;e=p.exec(r);)n.includes(e[1])||n.push(e[1]);return n}let a={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(t){Array.isArray(t)?t.forEach(t=>{log(`${t}
2
- `)}):(e.cursorTo(process.stdout,0),process.stdout.write(t))}export function tfc(t){return n(t,a).code||"{}"}export function readConf(t,e){let o=`${c.cachePath}/${e}.mjs`;return r(o,tfc(t)),import(o)}export function toUpperCaseString(t){return t?.replace(/\b\w/g,t=>t.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(e){return t(c.programPath,`./${e}`)}export const resolveNodeModulesPath=t=>resolveProgramPath(`node_modules/${t}`);export const realResolve=t=>s.resolveSync({},c.programPath,t)||t;export function isObject(t){let e=typeof t;return null!==t&&("object"==e||"function"==e)}export function isFunction(t){if(!isObject(t))return!1;let e=Object.prototype.toString.call(t);return"[object Function]"==e||"[object AsyncFunction]"==e||"[object GeneratorFunction]"==e||"[object Proxy]"==e}export function empty(){}
1
+ import{resolve as t}from"path";import r from"readline";import{saveFileSync as o}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.js";import c from"./resolver-sync.js";export function esm(t,...r){let o=t.raw[0];for(let e=0;e<r.length;e++)o+=r[e]+t.raw[e+1];return`data:text/javascript;base64,${Buffer.from(o).toString("base64")}`}let p={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(t){Array.isArray(t)?t.forEach(t=>{log(`${t}
2
+ `)}):(r.cursorTo(process.stdout,0),process.stdout.write(t))}export function tfc(t){return e(t,p).code||"{}"}export function readConf(t,r){let e=`${n.cachePath}/${r}.mjs`;return o(e,tfc(t)),import(e)}export function toUpperCaseString(t){return t?.replace(/\b\w/g,t=>t.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return t(n.programPath,`./${r}`)}export const resolveNodeModulesPath=t=>resolveProgramPath(`node_modules/${t}`);export const realResolve=t=>c.resolveSync({},n.programPath,t)||t;export function isObject(t){let r=typeof t;return null!==t&&("object"==r||"function"==r)}export function isFunction(t){if(!isObject(t))return!1;let r=Object.prototype.toString.call(t);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}
@@ -1,31 +1,2 @@
1
- type CoverageType = {
2
- /** 语句(statement coverage) */
3
- statements: string;
4
- /** 语句覆盖: 是不是每个语句都执行了 */
5
- coveredstatements: string;
6
- /** 条件(branch coverage) */
7
- conditionals: string;
8
- /** 条件覆盖: 是不是每个条件代码块都执行了 */
9
- coveredconditionals: string;
10
- /** 函数(function coverage) */
11
- methods: string;
12
- /** 函数覆盖: 是不是每个函数都调用了 */
13
- coveredmethods: string;
14
- };
15
- type ProjectCoverageType = {
16
- /** 元素 */
17
- elements: string;
18
- /** 覆盖元素 */
19
- coveredelements: string;
20
- complexity: string;
21
- loc: string;
22
- ncloc: string;
23
- /** 经过测试的组件 */
24
- packages: string;
25
- /** 经过测试的文件 */
26
- files: string;
27
- /** 经过测试的类 */
28
- classes: string;
29
- };
30
- export declare const coverage: Record<string, CoverageType & ProjectCoverageType>;
31
- export {};
1
+ declare let coverage: string;
2
+ export default coverage;
@@ -1 +1 @@
1
- import{accessSync as e,constants as r}from"fs";import{loadFileSync as o}from"@moneko/mdx";import{Parser as t}from"xml2js";import c from"../paths.js";import{PACKAGENAME as a,isLibrary as m}from"../process-env.js";export const coverage={};if(m)try{e(c.coveragePath,r.R_OK);let m=new t({explicitArray:!1,async:!1}).parseString,s=o(c.coveragePath);m(s,(e,r)=>{if(!e){let e=r.coverage.project.metrics.$,o=r.coverage.project.package;Object.assign(coverage,{[a]:e}),o.forEach(e=>{Object.assign(coverage,{[e.$.name]:e.metrics.$})})}})}catch(e){}
1
+ import{fileExists as e,loadFileSync as r}from"@moneko/mdx";import{Parser as t}from"xml2js";import o from"../paths.js";import{PACKAGENAME as a,isLibrary as c}from"../process-env.js";let s={},i="export default {}";if(c&&e(o.coveragePath))try{let e=r(o.coveragePath);(0,new t({explicitArray:!1,async:!1}).parseString)(e,(e,r)=>{e||(Object.assign(s,{[a]:r.coverage.project.metrics.$}),r.coverage.project.package.forEach(e=>{Object.assign(s,{[e.$.name]:e.metrics.$})})),i=`export default ${JSON.stringify(s)}`})}catch(e){}export default i;
package/lib/vm/docs.js CHANGED
@@ -1 +1 @@
1
- import{FRAMEWORK as e,FRAMEWORKNAME as o,createElement as t,isReact as r,isSolid as n}from"../process-env.js";import s from"../reactive-object.js";export const docsModuleName="@app/docs";export const docs=new s({[docsModuleName]:"export default {}"});export const comment=new s({});let p={},a=`() => ${t}(SuspenseComp, { comp: $1 })`,c=`import { ${t}${n?",Dynamic":""} } from "${o}${n?"/web":""}";import SuspenseComp from "@app/suspense";`;["react","solid"].includes(e)||(a="$1",c=""),comment.on("change",(e,o)=>{!function(e,o){let[s,l]=e.replace(/^@app\/comment\//,"").split("/");p[s]||(p[s]={}),o?p[s][l]&&delete p[s][l]:p[s][l]=`rr(() => import(/* webpackChunkName: '${e}' */'${e}?raw').then((res) => ({default: ${r?"() =>":""}${t}(${n?"Dynamic":"'n-md'"}, {text: res.default, ${n?"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;}'})})))rr`;let i={};for(let e in p)Object.prototype.hasOwnProperty.call(p,e)&&(i[e]=Object.values(p[e]));docs.setData(docsModuleName,`${c}export default ${JSON.stringify(i).replace(/"rr\((.+?)\)rr"/g,a)}`)}(e,o?.length<0)});
1
+ import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.js";import{CONFIG as r}from"../config.js";import{FRAMEWORK as s,FRAMEWORKNAME as n,createElement as p,isReact as a,isSolid as m}from"../process-env.js";import i from"../reactive-object.js";export const docsModuleName="@app/docs";export const docs=new i({[docsModuleName]:"export default {}"});export const comment=new i({});let c={},l=`() => ${p}(SuspenseComp, { comp: $1 })`,d=`import { ${p}${m?",Dynamic":""} } from "${n}${m?"/web":""}";import SuspenseComp from "@app/suspense";`;["react","solid"].includes(s)||(l="$1",d=""),comment.on("change",(e,t)=>{!function(e,t){let[o,r]=e.replace(/^@app\/comment\//,"").split("/");c[o]||(c[o]={}),t?c[o][r]&&delete c[o][r]:c[o][r]=`rr(() => import(/* webpackChunkName: '${e}' */'${e}?raw').then((res) => ({default: ${a?"() =>":""}${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;}'})})))rr`;let s={};for(let e in c)Object.prototype.hasOwnProperty.call(c,e)&&(s[e]=Object.values(c[e]));docs.setData(docsModuleName,`${d}export default ${JSON.stringify(s).replace(/"rr\((.+?)\)rr"/g,l)}`)}(e,t?.length<0)}),t(r.alias["@pkg"]).filter(e=>/^(?![._]).*(?<!\.test)\.(tsx?)$/i.test(e)).forEach(t=>{let r=e(t);r&&comment.setData(`@app/comment/${t.split("/").slice(-2).join("/").replace(/\.tsx?/,".md")}`,o(r,t))});
@@ -0,0 +1,2 @@
1
+ declare const _default: string;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ import{join as o}from"path";import{fileExists as p,loadFileSync as n}from"@moneko/mdx";import{CONFIG as t}from"../config.js";import{FRAMEWORK as e,isMicro as r,isMobile as i}from"../process-env.js";let s=/export\s+(?:async\s+)?(?:function|const)\s+(\w+)/g,m=o(t.alias["@"],"./index.ts"),u="",a=`const renderApp = (await import('@moneko/${e}/lib/entry.js')).default;`,_=[];if(p(m)){let o="";r&&(_=(function(o){let p;let t=n(o)||"",e=[];for(;p=s.exec(t);)e.includes(p[1])||e.push(p[1]);return e})(m).filter(Boolean)).length&&(o=`{${_.map(o=>`${o} as app${o}`).join(",")}} from `),u=`import ${o}"@/index.ts";`}t.rem&&(u+='import "@app/rem";'),t.normalizeCss&&(u+='import "@app/normalize/index.css";'),r?(u+="if (window.__POWERED_BY_QIANKUN__) {__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;}",a+=`if (!window.__POWERED_BY_QIANKUN__) {renderApp();}let unmountApp = void 0;export async function bootstrap() {console.log('app bootstraped');}export async function mount(props) {${_.includes("mount")?"appmount(props);":""}unmountApp = renderApp(props);}export async function unmount(props) {${_.includes("unmount")?"appunmount(props);":""}unmountApp();}`):a+="renderApp();",i&&(a+="window.H5RemoteRuntime = {bootstrap: renderApp};");export default`${u}${a}`;
package/lib/vm/example.js CHANGED
@@ -1 +1 @@
1
- let e;import{getTree as o,watchFiles as t}from"./utils.js";import r from"../paths.js";import{isLibrary as a}from"../process-env.js";import p from"../reactive-object.js";export const exampleModuleName="@app/example";export const examples=new p;a&&t(r.componentsPath,/(?<!\/examples\/(.+)\.md)$/,function(t){clearTimeout(e),e=setTimeout(()=>{clearTimeout(e),o({base:r.componentsPath,files:t,outputSource:!0}).forEach(e=>{let o=(e.children||[]).filter(e=>e.codes).map(e=>({title:e.path.replace(/.mdx$/,""),order:0,...e.meta,codes:e.codes})).sort((e,o)=>e.order-o.order);examples.setData(["@app/example",e.key].filter(Boolean).join("/"),`export default ${JSON.stringify(o)};`)})},10)});
1
+ import{scanFolder as e}from"@moneko/mdx";import{getTree as o,watchFiles as t}from"./utils.js";import r from"../paths.js";import{isDev as m,isLibrary as p}from"../process-env.js";import s from"../reactive-object.js";export const exampleModuleName="@app/example";export const examples=new s;function a(e){o({base:r.componentsPath,files:e,outputSource:!0}).forEach(e=>{let o=(e.children||[]).filter(e=>e.codes).map(e=>({title:e.path.replace(/.mdx$/,""),order:0,...e.meta,codes:e.codes})).sort((e,o)=>e.order-o.order);examples.setData(["@app/example",e.key].filter(Boolean).join("/"),`export default ${JSON.stringify(o)};`)})}let l=e(r.componentsPath).filter(e=>!/(?<!\/examples\/(.+)\.md)$/.test(e));p&&(a(l),m&&t(r.componentsPath,/(?<!\/examples\/(.+)\.md)$/,a,l));
@@ -0,0 +1 @@
1
+ import{dirname as e}from"path";import t from"typescript";import{CONFIG as n}from"../config.js";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}
package/lib/vm/locales.js CHANGED
@@ -1,2 +1,2 @@
1
- import{existsSync as e}from"fs";import{basename as t,join as o}from"path";import{watch as a}from"chokidar";import{CONFIG as l}from"../config.js";import{FRAMEWORK as r,isDev as n}from"../process-env.js";import c from"../reactive-object.js";import{empty as s,esm as i,tfc as g}from"../utils.js";let f={react:'import sso from "shared-store-object";',solid:'import { createEffect, createRoot, getOwner } from "solid-js";import { createStore } from "solid-js/store";'},u={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;'}[r];function p(e,t){return`${f[r]}
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);${u}`}export const localesModuleName="@app/locales";export const locales=new c({[localesModuleName]:p([],{})});let d={};async function m(e,o){let a=t(e).replace(/\.[^.]+$/,"");"deleted"===o?delete d[a]:Object.assign(d,{[a]:(await import(i`${g(e)}`)).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:c={}}=d[e];l.push({language:t,title:o,icon:n}),r[t]={language:t,title:o,icon:n,translation:c}}locales.setData(localesModuleName,p(l,r))}let z=o(l.alias["@"],"./locales");e(z)&&function(e,t){let o=[],l=a(e,{ignored:t,persistent:!0,ignoreInitial:!1});function r(){l.unwatch(e),l.close()}l.on("add",e=>{o.push(e),m(e,"added").finally(s)}),l.on("change",e=>{m(e,"change").finally(s)}),l.on("unlink",e=>{o.splice(o.indexOf(e),1),m(e,"deleted").finally(s)}),l.once("ready",()=>{o.forEach(e=>{m(e,"change").finally(s)}),n||r()}),process.on("SIGINT",r)}(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.js";import{FRAMEWORK as n,isDev as s}from"../process-env.js";import c from"../reactive-object.js";import{esm as i,tfc as g}from"../utils.js";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$/]));
@@ -0,0 +1,2 @@
1
+ declare let mdxScope: string;
2
+ export default mdxScope;
@@ -0,0 +1 @@
1
+ import{fileExists as o}from"@moneko/mdx";import{resolveProgramPath as e}from"../utils.js";let t="export default {};";o(e("site/mdx-scope.ts"))&&(t='import scope from "@/mdx-scope";export default scope');export default t;
package/lib/vm/routes.js CHANGED
@@ -1 +1 @@
1
- let e,r;import{accessSync as t,constants as o}from"fs";import{getTree as s,mergeRouter as p,watchFiles as m}from"./utils.js";import{CONFIG as u}from"../config.js";import i from"../paths.js";import{FRAMEWORK as a,FRAMEWORKNAME as c,createElement as f,isLibrary as l,isReact as n,isSolid as $}from"../process-env.js";import x from"../reactive-object.js";try{t(`${u.alias["@"]}/router/index.ts`,o.R_OK),e=!0}catch(r){e=!1}let d=`${$?"() => ":""}${f}(SuspenseComp, { comp: $1 })`,g=`import { ${f} } from "${c}";import SuspenseComp from "@app/suspense";${n?'import prefix from "@app/prefix-router";':""}`;e&&(g+='import merge from "@app/merge-router";import customRouter from "@/router";'),["react","solid"].includes(a)||(d="$1",g="");export const routesModuleName="@app/routes";export const route=new x({[routesModuleName]:"export default []"});export let routes=[];let h=l?i.componentsPath:i.pagesPath,j=l?"@pkg":"@/pages";m(h,l?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,function(t){clearTimeout(r),r=setTimeout(()=>{var o;clearTimeout(r),routes=p(s({base:h,files:t,alia:j}).reverse(),"key"),route.setData(routesModuleName,(o=JSON.stringify(routes).replace(/"rr\((.+?)\)rr"/g,d).slice(1,-1),`${g}const routes = [{ path: "/", children: [${$?'{ path: "/" },':""} ${o}] }];const _routes = ${e?'merge([...routes, ...customRouter], "path")':"routes"};export default ${n?"prefix(_routes)":"_routes"};`))},10)});
1
+ import{fileExists as e,scanFolder as r}from"@moneko/mdx";import{getTree as o,mergeRouter as t,watchFiles as s}from"./utils.js";import{CONFIG as p}from"../config.js";import m from"../paths.js";import{FRAMEWORK as u,FRAMEWORKNAME as i,createElement as a,isDev as f,isLibrary as n,isReact as l,isSolid as c}from"../process-env.js";import $ from"../reactive-object.js";let x=e(`${p.alias["@"]}/router/index.ts`),d=`${c?"() => ":""}${a}(SuspenseComp, { comp: $1 })`,g=`import { ${a} } from "${i}";import SuspenseComp from "@app/suspense";${l?'import prefix from "@app/prefix-router";':""}`;x&&(g+='import merge from "@app/merge-router";import customRouter from "@/router";'),["react","solid"].includes(u)||(d="$1",g="");export const routesModuleName="@app/routes";export const route=new $({[routesModuleName]:"export default []"});export let routes=[];let h=n?m.componentsPath:m.pagesPath,j=n?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,M=n?"@pkg":"@/pages";function N(e){var r;routes=t(o({base:h,files:e,alia:M}),"key"),route.setData(routesModuleName,(r=JSON.stringify(routes).replace(/"rr\((.+?)\)rr"/g,d).slice(1,-1),`${g}const routes = [{ path: "/", children: [${c?'{ path: "/" },':""} ${r}] }];const _routes = ${x?'merge([...routes, ...customRouter], "path")':"routes"};export default ${l?"prefix(_routes)":"_routes"};`))}let k=r(h).filter(e=>!j.test(e));N(k),f&&s(h,j,N,k);
package/lib/vm/utils.d.ts CHANGED
@@ -15,5 +15,5 @@ type TreeOption = {
15
15
  outputSource?: boolean;
16
16
  };
17
17
  export declare function getTree(opt: TreeOption): BaseRoute[];
18
- export declare function watchFiles(root: string, ignored: RegExp, call: (files: string[]) => void): void;
18
+ export declare function watchFiles(root: string, ignored: RegExp, call: (files: string[]) => void, files?: string[]): void;
19
19
  export {};
package/lib/vm/utils.js CHANGED
@@ -1 +1 @@
1
- import{join as e,relative as t}from"path";import{frontmatterSync as n,loadFileSync as r}from"@moneko/mdx";import{watch as i}from"chokidar";import{isDev as o,isSolid as a}from"../process-env.js";import l from"../reactive-object.js";let s=new l({}),c=a?"component":"element";export function mergeRouter(e,t){if(!e.length)return;let n=[];return e.forEach(e=>{let r=n.findIndex(n=>n[t]==e[t]);if(r>-1){let i=[...n[r].children||[],...e.children||[]];n[r]=Object.assign(e,n[r]),i.length&&(n[r].children=mergeRouter(i,t))}else n.push(Object.assign(e,Array.isArray(e.children)&&{children:mergeRouter(e.children,t)}))}),n.forEach((e,t)=>{if(e.children?.length){let{children:r=[],...i}=e;n[t]={path:i.path,key:i.key,children:[a&&{...i,path:e.path===i.path?"/":i.path},...r].filter(e=>e&&(e.component||e.children?.length))}}}),n}export function getTree(n){let r={};return n.files.forEach(i=>{let o=s.getData(i)||{code:""},a=t(n.base,i),l=n.base.split("/").filter(Boolean),h=i.split("/").filter(Boolean).slice(0,-1),p={},f=Object.assign({meta:JSON.parse(o.frontmatter||"{}")},n.alia&&{[c]:`rr(() => import(/* webpackChunkName: '${a}' */'${e(n.alia,a)}'))rr`},n.outputSource&&{codes:function(e){let t;let n={},r=/```(.+?)\n([\s\S]*?)\n```/g;for(;null!==(t=r.exec(e));){let[,e="jsx",r]=t;n[e.split(" ").pop()||"jsx"]=r.trim()}return Object.keys(n).length?n:{jsx:e}}(o.code.replace(/^\n+|\n+$/g,""))});for(let e=l.length;e<h.length;e++){let t={path:h[e],key:h[e]};e===l.length?(Object.assign(p,r[t.key],{path:t.path,key:t.key},e===h.length-1&&f),r[t.key]=p):(p.children=(p.children||[]).concat([t]),n.outputSource?(Object.assign(t,{path:i.split("/").pop(),key:i.split("/").pop()},f),t.children=getTree({...n,base:`${n.base}/${t.key}`,files:n.files.filter(e=>e.startsWith(`${n.base}/${t.key}`))})):Object.assign(t,{key:h.slice(l.length,e+1).join("/")},f),p=t)}}),Object.values(r)}function h(e,t,i){if(i)s.removeData(e),t.removeData(e);else{let i=r(e)||"";if(e.endsWith(".md")||e.endsWith(".mdx")){let r=n(i);s.setData(e,r),t.setData(e,!0)}else s.setData(e,{code:i,frontmatter:"{}"}),t.setData(e,!0)}}export function watchFiles(e,t,n){let r=new l({}),a=i(e,{ignored:(e,n)=>{if(n)return!n.isDirectory()&&t.test(e)},persistent:!0,ignoreInitial:!1});function s(){a.unwatch(e),a.close()}a.on("add",e=>{h(e,r)}).on("change",e=>{h(e,r)}).on("unlink",e=>{h(e,r,!0)}),a.once("ready",()=>{o||s()}),r.on("change",()=>{n(Object.keys(r.data))}),process.on("SIGINT",s)}
1
+ import{join as e,relative as t}from"path";import{frontmatterSync as n,loadFileSync as r}from"@moneko/mdx";import{watch as i}from"chokidar";import{isDev as l,isSolid as o}from"../process-env.js";let s=o?"component":"element";export function mergeRouter(e,t){if(!e.length)return;let n=[];return e.forEach(e=>{let r=n.findIndex(n=>n[t]==e[t]);if(r>-1){let i=[...n[r].children||[],...e.children||[]];n[r]=Object.assign(e,n[r]),i.length&&(n[r].children=mergeRouter(i,t))}else n.push(Object.assign(e,Array.isArray(e.children)&&{children:mergeRouter(e.children,t)}))}),n.forEach((e,t)=>{if(e.children?.length){let{children:r=[],...i}=e;n[t]={path:i.path,key:i.key,children:[o&&{...i,path:e.path===i.path?"/":i.path},...r].filter(e=>e&&(e.component||e.children?.length))}}}),n}export function getTree(i){let l={};return i.files.forEach(o=>{let c={code:"",frontmatter:"{}"},a=t(i.base,o),h=i.base.split("/").filter(Boolean),p=o.split("/").filter(Boolean).slice(0,-1);(o.endsWith(".md")||o.endsWith(".mdx"))&&Object.assign(c,n(r(o)));let d={},f=Object.assign({meta:JSON.parse(c.frontmatter)},i.alia&&{[s]:`rr(() => import(/* webpackChunkName: '${a}' */'${e(i.alia,a)}'))rr`},i.outputSource&&{codes:function(e){let t;let n={},r=/```(.+?)\n([\s\S]*?)\n```/g;for(;null!==(t=r.exec(e));){let[,e="jsx",r]=t;n[e.split(" ").pop()||"jsx"]=r.trim()}return Object.keys(n).length?n:{jsx:e}}(c.code.replace(/^\n+|\n+$/g,""))});for(let e=h.length;e<p.length;e++){let t={path:p[e],key:p[e]};e===h.length?(Object.assign(d,l[t.key],{path:t.path,key:t.key},e===p.length-1&&f),l[t.key]=d):(d.children=(d.children||[]).concat([t]),i.outputSource?(Object.assign(t,{path:o.split("/").pop(),key:o.split("/").pop()},f),t.children=getTree({...i,base:`${i.base}/${t.key}`,files:i.files.filter(e=>e.startsWith(`${i.base}/${t.key}`))})):Object.assign(t,{key:p.slice(h.length,e+1).join("/")},f),d=t)}}),Object.values(l)}export function watchFiles(e,t,n,r=[]){let o=i(e,{ignored:(e,n)=>{if(n)return!n.isDirectory()&&t.test(e)},persistent:!0,ignoreInitial:!0});function s(){o.unwatch(e),o.close()}o.on("add",e=>{r.includes(e)||r.push(e),n(r)}).on("change",e=>{r.includes(e)||r.push(e),n(r)}).on("unlink",e=>{let t=r.indexOf(e);-1!==t&&r.splice(t,1),n(r)}),o.once("ready",()=>{l||s()}),process.on("SIGINT",s)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.8.7-beta.7",
3
+ "version": "3.8.7",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "author": "moneko",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
- "@moneko/mdx": "0.1.10",
16
+ "@moneko/mdx": "0.1.13",
17
17
  "@swc/core": "1.3.100",
18
18
  "@swc/css": "0.0.28",
19
19
  "@swc/helpers": "0.5.3",
@@ -1 +0,0 @@
1
- "use strict";function e(e=""){let t=this.resourcePath,r=this.getOptions().comment.getData(`@app/comment/${t.split("/").slice(-2).join("/")}`);return this.cacheable(!0),r||e}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e}});
@@ -1,6 +0,0 @@
1
- import type ReactiveObject from '../reactive-object.js';
2
- import type { LoaderContext } from 'webpack';
3
- export default function (this: LoaderContext<{
4
- test: RegExp;
5
- comment: ReactiveObject<Record<string, string>>;
6
- }>, _?: string): string;
@@ -1 +0,0 @@
1
- "use strict";function e(e=""){let t=this.getOptions().docs.getData("@app/docs");return this.cacheable(!0),t||e}Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e}});
@@ -1,6 +0,0 @@
1
- import type ReactiveObject from '../reactive-object.js';
2
- import type { LoaderContext } from 'webpack';
3
- export default function (this: LoaderContext<{
4
- test: RegExp;
5
- docs: ReactiveObject<Record<string, string>>;
6
- }>, _?: string): string;
@@ -1 +0,0 @@
1
- "use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return k}});const t=require("path"),n=(e=require("typescript"))&&e.__esModule?e:{default:e},r=global.NEKOCLICONFIG.CONFIG,{ScriptKind:l,ScriptTarget:o,SyntaxKind:i,createSourceFile:u,forEachChild:a,getLeadingCommentRanges:c,isInterfaceDeclaration:s,isQuestionToken:f,isPropertySignature:p,isFunctionTypeNode:g,isUnionTypeNode:m,isMethodSignature:$}=n.default,d={};function b(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 h(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}function y(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 x(e){if(!e)return null;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():null}const j=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function T(e,t){if(!e)return null;let n=e.replace(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if(d[e]){let n=`/${[r.basename,d[e]].join("/").split("/").filter(Boolean).join("/")}`;return t?`[\\color{#009688}{${e}}](${n})`:`[${e}](${n})`}return t?`\\color{#009688}{${e}}`:e});return t&&(n=n.replace(j,e=>`\\color{#009688}{${e}}`)),n}function B(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 E(e){return e?e.replace(/^@[a-z].+/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}function k(e,c){let j=u(c,e,o.Latest,!0,l.TS),k="";return a(j,e=>{s(e)?k+=function(e){let l=e.name.text;Object.assign(d,{[e.name.text]:(0,t.dirname)(e.getSourceFile().fileName).replace(r.alias["@pkg"],"")});let o=b(e),u=h(o),a=E(o),c=x(o)?.split("|")||[],s=c.includes("comment"),j=c.includes("initial"),k=c.includes("optional"),w=c.includes("version"),S=c.includes("author"),v=a?`\\color{|4||0.45}{${l}}`:l,O=(function(e){let t=[];if(e.heritageClauses){for(let r of e.heritageClauses)if(r.token===n.default.SyntaxKind.ExtendsKeyword)for(let e of r.types)t.push(e.getText())}return t})(e)?.map(e=>`<n-tag color="#4c81db" css=".tag{gap:0px;}">${T(B(e))}</n-tag>`),F=[a,v,u&&`\\color{#52c11b|1||0.9}{${u}}`,O.length>0&&`<sub>\`extends\`</sub> ${O.join(" ")}`].filter(Boolean).join(" "),N=`## ${F}`,C=e.members.filter(e=>p(e)&&e.type?.kind!==i.NeverKeyword||$(e)),q=[];if(C.length){C.forEach(e=>{let t=T(B($(e)?`(${e.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${e.type?.getText()||"any"}`:e.type?.getText()||"any"),!0),n=b(e),r=B(e.name.getText());!r||r.startsWith("\\color")||($(e)||function(e){if(e.type){if(!m(e.type))return g(e.type);for(let t of e.type.types)if(g(t))return!0}return!1}(e)||t?.includes("=>")?r=`\\color{#f9a913}{${r}}`:/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`));let l=e.questionToken&&f(e.questionToken);q.push([r,!k&&`\\color{${l?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${l?"✘":"✔"}}`,!s&&B(E(n)),t,!j&&B(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(n)),!w&&B(h(n)),!S&&(y(n)||y(o))])});let e=!1,t=!1,n=!1,r=!1;q.forEach(l=>{!s&&l[2]&&(r=!0),!j&&l[4]&&(n=!0),!w&&l[5]&&(t=!0),!S&&l[6]&&(e=!0)}),N+="\n";let l=["属性",!k&&"必要",r&&"说明","类型",n&&"默认值",t&&"版本",e&&"作者"].filter(Boolean).join("|");N+=`|${l}|`;let i=[":-",!k&&":-",r&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);N+="\n";let u=i.join("|");N+=`|${u}|`,q.forEach(l=>{N+="\n";let o=[l[0]||"-",!k&&(l[1]||"-"),r&&(l[2]||"-"),l[3]||"-",n&&(l[4]||"-"),t&&(l[5]||"-"),e&&(l[6]||"-")].filter(Boolean).join("|");N+=`|${o}|`}),N+="\n"}return N+="\n"}(e):n.default.isEnumDeclaration(e)&&(k+=function(e){let l=e.name.text,o=b(e),i=E(o),u=h(o);Object.assign(d,{[e.name.text]:(0,t.dirname)(e.getSourceFile().fileName).replace(r.alias["@pkg"],"")});let a=i?`\\color{|4||0.45}{${l}}`:l,c=[i,a,u&&`\\color{#52c11b|1||0.9}{${u}}`].filter(Boolean).join(" "),s=x(o)?.split("|")||[],f=s.includes("comment"),p=s.includes("version"),g=s.includes("author"),m=`## ${c}`;if(e.members.length){let t=[];e.members.forEach(e=>{let r=B(e.name.getText()),l=b(e),i=B(function(e){let t=e.initializer;return t&&n.default.isStringLiteral(t)?` '${t.text}'`:null}(e)),u=B(h(l)),a=B(E(l));!r||r.startsWith("\\color")||/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`),t.push([r,!f&&a,i,!p&&u,!g&&(y(l)||y(o))])});let r=!1,l=!1,i=!1;t.forEach(e=>{!f&&e[1]&&(i=!0),!p&&e[3]&&(l=!0),!g&&e[4]&&(r=!0)}),m+="\n";let u=["属性",i&&"说明","值",l&&"版本",r&&"作者"].filter(Boolean).join("|");m+=`|${u}|`;let a=[":-",i&&":-",":-",l&&":-",r&&":-"].filter(Boolean);m+="\n";let c=a.join("|");m+=`|${c}|`,t.forEach(e=>{m+="\n";let t=[e[0]||"-",i&&(e[1]||"-"),e[2]||"-",l&&(e[3]||"-"),r&&(e[4]||"-")].filter(Boolean).join("|");m+=`|${t}|`})}return m+="\n\n"}(e))}),k}
File without changes
File without changes
@@ -1,2 +0,0 @@
1
- declare const virtualModules: Record<string, string | object>;
2
- export default virtualModules;
@@ -1 +0,0 @@
1
- import{accessSync as p,constants as o}from"fs";import{join as r}from"path";import{CONFIG as e}from"./config.js";import{FRAMEWORKNAME as m,isLibrary as s,isReact as t}from"./process-env.js";import{resolveProgramPath as a}from"./utils.js";import c from"./vm/app-entry.js";import f from"./vm/app.js";import{coverage as i}from"./vm/coverage.js";import l from"./vm/fallback.js";import n from"./vm/merge-router.js";import u from"./vm/normalize-css.js";import x from"./vm/prefix-router.js";let j={...e.virtualModule,"@app":f,"@app/fallback":l,"@app/coverage":i,"@app/normalize/index.css":u,"@app/prefix-router":x,"@app/suspense/index.tsx":`import ${t?"React,":""}{Suspense,lazy} from "${m}";import Fallback from '@app/fallback';${s?'import scope from "@app/mdx-scope";':""}function SuspenseComp(props) {const Lazy = lazy(props.comp);return (<Suspense fallback={Fallback && <Fallback />}><Lazy ${s?"components={scope}":""}/></Suspense>);}export default SuspenseComp;`,"@app/entry":c,"@app/merge-router":n},v={};if(s)try{let e=r(a("site"),"./mdx-scope.ts");p(e,o.R_OK),v='import scope from "@/mdx-scope";export default scope;'}catch(p){v={}}Object.assign(j,{"@app/mdx-scope":v});export default j;
@@ -1,2 +0,0 @@
1
- declare const appEntry: string;
2
- export default appEntry;
@@ -1 +0,0 @@
1
- import{existsSync as o}from"fs";import{join as p}from"path";import n from"./rem.js";import{CONFIG as t}from"../config.js";import{FRAMEWORK as r,isMicro as e,isMobile as i}from"../process-env.js";import{getExportTokens as m}from"../utils.js";let s=p(t.alias["@"],"./index.ts"),_=o(s),u="",a=`const renderApp = (await import('@moneko/${r}/lib/entry.js')).default;`,d=[];if(_){let o="";e&&(d=m(s).filter(Boolean)).length&&(o=`{${d.map(o=>`${o} as app${o}`).join(",")}} from `),u=`import ${o}"@/index.ts";`}u+=`import "@app/normalize/index.css";${n}`,e?(u+="if (window.__POWERED_BY_QIANKUN__) {__webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;}",a+=`if (!window.__POWERED_BY_QIANKUN__) {renderApp();}let unmountApp = void 0;export async function bootstrap() {console.log('app bootstraped');}export async function mount(props) {${d.includes("mount")?"appmount(props);":""}unmountApp = renderApp(props);}export async function unmount(props) {${d.includes("unmount")?"appunmount(props);":""}unmountApp();}`):a+="renderApp();",i&&(a+="window.H5RemoteRuntime = {bootstrap: renderApp};");let f=`${u}${a}`;export default f;
package/lib/vm/app.js DELETED
@@ -1 +0,0 @@
1
- import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"../config.js";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s}from"../process-env.js";import{resolveProgramPath as p,toUpperCaseString as i}from"../utils.js";let{description:m,author:a,repository:n,keywords:f}=JSON.parse(e(p("package.json"))||"{}"),l={name:t,projectName:JSON.stringify(i(t).replace(/-/g," ")),version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:m,author:"string"==typeof a?{name:a}:a,repository:"string"==typeof a?{url:n}:n,keywords:f};export default l;
@@ -1,2 +0,0 @@
1
- declare let fallback: string;
2
- export default fallback;
@@ -1 +0,0 @@
1
- import{CONFIG as l}from"../config.js";let a="export default null";l.fallbackCompPath&&(a=`import Fallback from "${l.fallbackCompPath}";export default Fallback;`);export default a;
File without changes
File without changes
@@ -1,2 +0,0 @@
1
- declare const _default: "function merge(e,r){if(!e.length)return void 0;const n=[];e.forEach(e=>{const t=n.findIndex(n=>n[r]==e[r]);if(t>-1){const i=[...n[t].children||[],...e.children||[]];n[t]=Object.assign(e,n[t],n[t].meta&&{meta:{...n[t].meta,...e.meta}});if(i.length){n[t].children=merge(i,r)}}else{n.push(Object.assign(e,Array.isArray(e.children)&&{children:merge(e.children,r)}))}});return n}export default merge;";
2
- export default _default;
@@ -1 +0,0 @@
1
- export default"function merge(e,r){if(!e.length)return void 0;const n=[];e.forEach(e=>{const t=n.findIndex(n=>n[r]==e[r]);if(t>-1){const i=[...n[t].children||[],...e.children||[]];n[t]=Object.assign(e,n[t],n[t].meta&&{meta:{...n[t].meta,...e.meta}});if(i.length){n[t].children=merge(i,r)}}else{n.push(Object.assign(e,Array.isArray(e.children)&&{children:merge(e.children,r)}))}});return n}export default merge;";
@@ -1,2 +0,0 @@
1
- declare let normalizeCss: string;
2
- export default normalizeCss;
@@ -1 +0,0 @@
1
- import{CONFIG as e}from"../config.js";let t="";e.normalizeCss&&(t='html,body{margin:0;padding:0;line-height:1.8}input,textarea{caret-color:inherit}h1{margin:0.67em 0;font-size:2em}hr{overflow:visible;block-size:0;box-sizing:content-box}pre{font-size:1em;font-family:monospace}a{text-decoration:none;background-color:transparent;cursor:pointer}abbr[title]{border-block-end:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-size:1em;font-family:monospace}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{inset-block-end:-0.25em}sup{inset-block-start:-0.5em}img{border-style:none}img,button{outline:1px solid transparent}button,input,optgroup,select,textarea{margin:0;font-size:100%;font-family:inherit;line-height:1.15}button,input{overflow:visible}button,select{text-transform:none}button,[type="button"],[type="reset"],[type="submit"]{appearance:button}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type="button"]:-moz-focusring,[type="reset"]:-moz-focusring,[type="submit"]:-moz-focusring{outline:1px dotted var(--primary-outline)}fieldset{padding:0.35em 0.75em 0.625em}legend{display:table;padding:0;max-inline-size:100%;white-space:normal;color:inherit;box-sizing:border-box}progress{vertical-align:baseline}textarea{overflow:auto}details{display:block}summary{display:list-item}template,[hidden]{display:none}[type="checkbox"],[type="radio"]{box-sizing:border-box;padding:0}[type="number"]::-webkit-inner-spin-button,[type="number"]::-webkit-outer-spin-button{block-size:auto}[type="search"]{appearance:textfield;outline-offset:-2px}[type="search"]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}::-webkit-scrollbar{inline-size:5px;block-size:5px}::-webkit-scrollbar-track,::-webkit-scrollbar-thumb{background-color:transparent}:hover::-webkit-scrollbar-thumb{background-color:var(--primary-selection)}::-webkit-scrollbar-thumb:hover{background-color:var(--primary-hover)}::-webkit-scrollbar-thumb:active{background-color:var(--primary-active)}::-webkit-scrollbar-button{display:none}');export default t;
@@ -1,2 +0,0 @@
1
- declare let prefixRouter: string;
2
- export default prefixRouter;
@@ -1 +0,0 @@
1
- import{isReact as e}from"../process-env.js";let t="";e&&(t='import { createElement, isValidElement } from "react";import { Outlet } from "react-router-dom";function prefix(e){return e.map(function(e){var n=Object.assign({key:e.path},e);return n.element?isValidElement(n.element)||(n.element=createElement(n.element,n.meta)):n.element=createElement(Outlet,null),Array.isArray(n.children)&&(n.children=prefix(n.children)),n})}export default prefix;');export default t;
package/lib/vm/rem.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare let rem: string;
2
- export default rem;
package/lib/vm/rem.js DELETED
@@ -1 +0,0 @@
1
- import{CONFIG as e}from"../config.js";let t="";e.rem.designSize&&(t=`!function(e,n){function t(){let n=e.documentElement,t=n.clientWidth||e.body.clientWidth,i=t<=375?375:${e.rem.designSize},o=t;o=t<=375?t:t<=${e.rem.designSize}?i:t;let d=16/i*o+"px";d!==n.style.fontSize&&(n.style.fontSize=d)}t(),"addEventListener"in e&&n.addEventListener("orientationchange"in n?"orientationchange":"resize",t,!1)}(document,window);`);export default t;