@moneko/core 3.8.7-beta.4 → 3.8.7-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common.js +1 -1
- package/lib/config.js +1 -1
- package/lib/dev.js +3 -3
- package/lib/loader/generate-doc.cjs +1 -0
- package/lib/loader/generate-doc.d.cts +1 -0
- package/lib/loader/ts-doc.cjs +1 -1
- package/lib/module.config.js +1 -1
- package/lib/plugin/virtual-module.js +1 -1
- package/lib/vm/docs.d.ts +2 -1
- package/lib/vm/docs.js +1 -1
- package/lib/vm/example.js +1 -1
- package/lib/vm/routes.js +1 -1
- package/package.json +1 -1
- package/lib/generate-api.d.ts +0 -1
- package/lib/generate-api.js +0 -1
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:!
|
|
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:!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(A),...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
|
|
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 r,PACKAGENAME as n,coreName as l,isDev as c,isLibrary as m,isMobile as p,jsxImportSource as u,mainDirectory as d}from"./process-env.js";import{vmWriteing as h}from"./reactive-object.js";import{isFunction as f,log as g,readConf as x,resolveProgramPath as C}from"./utils.js";let P=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],w={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:{"@":C(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:P,js:P,media:P,font:P,wasm:[]},mdx:{jsx:!1,development:c,jsxImportSource:u,providerImportSource:`@moneko/${r}/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&&(w.alias=Object.assign(w.alias,{"@pkg":i.componentsPath,[n]:i.componentsPath}));let b=w,v={},k={};try{e(i.configPath,t.R_OK);let o=(await x(i.configPath,"index")).default;v=f(o)?o(process):o}catch(e){g(o.red(e))}if(a)try{e(i.customConfigPath,t.R_OK);let o=(await x(i.customConfigPath,a)).default;k=f(o)?o(process):o}catch(e){g(o.red(e))}"tsc"===(b=s(b,v,k)).compiler&&b.minifier&&(b.minifier.js||Object.assign(b.minifier,{js:{type:"terser"}}),b.minifier.css||Object.assign(b.minifier,{css:{type:"cssnano"}})),!1===b.devtool&&(b.sourceMap=!1),!1===b.sourceMap&&(b.devtool=!1),b.fixBrowserRouter&&b.htmlPluginOption&&(b.htmlPluginOption.tags||(b.htmlPluginOption.tags=[]),b.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=b;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:a,log:g,vmWriteing:h};
|
package/lib/dev.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{readdirSync as e}from"fs";import t from"chalk";import o from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import l from"webpackbar";import{clientConfig as i}from"./common.js";import{CONFIG as n}from"./config.js";import{hasPkg as a}from"./has-pkg.js";import{getIPv4 as c,getPort as p}from"./net.js";import m from"./paths.js";import{hasEslintConfig as d,hasStylelintConfig as f,isLibrary as u,isReact as h}from"./process-env.js";import{cleanDir as v,isFunction as w,log as g,resolveProgramPath as
|
|
2
|
-
`);function
|
|
3
|
-
${T(" Network ")} ${A(
|
|
1
|
+
import{readdirSync as e}from"fs";import t from"chalk";import o from"webpack";import s from"webpack-dev-server";import{merge as r}from"webpack-merge";import l from"webpackbar";import{clientConfig as i}from"./common.js";import{CONFIG as n}from"./config.js";import{hasPkg as a}from"./has-pkg.js";import{getIPv4 as c,getPort as p}from"./net.js";import m from"./paths.js";import{hasEslintConfig as d,hasStylelintConfig as f,isLibrary as u,isReact as h}from"./process-env.js";import{cleanDir as v,isFunction as w,log as g,resolveProgramPath as k}from"./utils.js";let{HotModuleReplacementPlugin:j}=o,{yellow:y,green:$,grey:b,gray:x,bgBlue:S,bgGreenBright:T,blueBright:C,greenBright:A}=t,B=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],D=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],E=e(m.programPath),M=!1,O=!1;for(let e=0,t=E.length;e<t;e++)D.includes(E[e])&&(O=!0),B.includes(E[e])&&(M=!0);M||(M=d),O||(O=f);let P=O?(await import("stylelint-webpack-plugin")).default:null,_=M?(await import("eslint-webpack-plugin")).default:null,H=n.devServer.port||3e3,I=await p(H,65535,n.devServer.host),N=a("@moneko/mock")&&(await import("@moneko/mock")).default,W=h&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,F=!1===n.devtool||n.devtool?n.devtool:"eval-cheap-module-source-map";n.devServer.port=I;let G="/"===n.basename,L=n.devServer.https?"https:":"http:",R=G?"":n.basename,Y=n.devServer.port!==I&&x(`Port ${y(H)} is in use, trying ${$(I)} instead.
|
|
2
|
+
`);function q(e){return`${L}//${"local"===e?n.devServer.host:c()}:${I}${R}`}let z=x("You application is running here:"),J=`${S(" Local ")} ${C(q("local"))}
|
|
3
|
+
${T(" Network ")} ${A(q("net"))}`,K=["js","md","mdx","jsx","ts","tsx","json","html","vue"],Q=K.join(","),U=["css","scss","sass","less","ts","tsx","js","jsx"],V=U.join(","),X=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Z=[new j,W&&new W,_&&new _({fix:!0,threads:!0,files:[`${n.alias["@"]}/**/*.{${Q}}`,u&&`${n.alias["@pkg"]}/**/*.{${Q}}`].filter(Boolean),extensions:K,exclude:X,cache:!0,lintDirtyModulesOnly:!0}),P&&new P({fix:!0,threads:!0,files:[`${n.alias["@"]}/**/*.{${V}}`,u&&`${n.alias["@pkg"]}/**/*.{${V}}`].filter(Boolean),extensions:U,exclude:X,cache:!0,lintDirtyModulesOnly:!0}),n.bar&&new l(n.bar)].filter(Boolean),ee={headers:{"Access-Control-Allow-Origin":"*"},compress:n.devServer.compress,host:"0.0.0.0",port:I,historyApiFallback:G||{index:R.endsWith("/")?R:`${R}/`,disableDotRule:!0},https:n.devServer.https,proxy:n.proxy,allowedHosts:n.devServer.allowedHosts,client:{reconnect:!0,progress:!1,logging:"info",overlay:!1,webSocketTransport:"ws"},webSocketServer:"ws",static:{watch:{ignored:e=>e.endsWith(".d.ts")||e.includes("/node_modules/")}},setupMiddlewares:(e,t)=>{if(!t)throw Error("devServer is not defined");return t.app&&w(N)&&N(t.app,k("mock/")),e},open:!1,hot:!0},et=o(r(i,{devtool:F,mode:"development",plugins:Z}));et.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,stdin:!0},(e,t)=>{!e&&t&&(g([z,"",J,"",b(`Compiled successfully in ${$(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>g(e.message)),t.compilation.errors.forEach(e=>g(e.message)),Y&&g(Y))});let eo=new s(ee,et);eo.startCallback(e=>{e||g([z,"",J])}),eo.stopCallback(e=>{e||v(m.cachePath)}),process.on("exit",function(){et.close(()=>{}),eo.invalidate(),eo.stop()}),process.on("SIGINT",()=>{process.exit()});
|
|
@@ -0,0 +1 @@
|
|
|
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}](${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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateDoc(content: string, path: string): string;
|
package/lib/loader/ts-doc.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return i}});const t=require("fs"),s=(e=require("./generate-doc.cjs"))&&e.__esModule?e:{default:e},r="library"===process.env.APPTYPE,a=process.cwd(),n={};function i(e){let i=this.async(),l=this.resourcePath;r&&l.startsWith(`${a}/components`)&&(0,t.stat)(l,(t,r)=>{if(!t){let t=r.mtime.getTime();n[l]&&n[l]===t?this.cacheable(!0):(global.NEKOCLICONFIG.vmWriteing.setData(l,!0),Object.assign(n,{[l]:t}),global.NEKOCLICONFIG.handleFileChange(l,"change",(0,s.default)(e,l)))}}),i(null,e)}
|
package/lib/module.config.js
CHANGED
|
@@ -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,isMicro as
|
|
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";let x={loader:`${a.corePath}/loader/css-unicode.cjs`},$=m?o:"../",g={loader:e.loader,options:{publicPath:"/"!==$?$:"../"}},v=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:(await import("@moneko/postcss")).default}};c&&(g="style-loader");let j=[...t.cssModules,`@moneko/${n}`,"neko-ui"].map(f),w=[...["src/styles/variables.less","src/styles/mixins.less","site/styles/variables.less","site/styles/mixins.less"].map(y)],h=["components","example","mock","site","src","server"].map(y);i&&h.push(y(i)),t.overrideResolve&&t.overrideResolve.override&&h.push(t.overrideResolve.override);let b={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=j.length;s<t;s++)if(e&&e?.includes(j[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=[g,k,b,v,x,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:l,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:w}}].filter(Boolean),B="tsc"===t.compiler,L={loader:B?"ts-loader":"swc-loader",options:B?u:p(c)};function P(e){return h.concat(t.rulesInclude?.[e]?.map(f)||[])}let R=P("media"),_={rules:[d&&{test:/\.tsx?$/i,include:t.alias["@pkg"],exclude:[/node_modules/],enforce:"pre",use:[`${a.corePath}/loader/ts-doc.cjs`]},{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:[g,k,b,v,x,{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:[g,"css-loader",v,x].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:h,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 _;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.js";import{vmWriteing as e}from"../reactive-object.js";import{docs as s}from"../vm/docs.js";import{exampleModuleName as
|
|
1
|
+
import o from"webpack-virtual-modules";import{isLibrary as t}from"../process-env.js";import{vmWriteing as e}from"../reactive-object.js";import{docs as s,docsModuleName as a}from"../vm/docs.js";import{exampleModuleName as p,examples as r}from"../vm/example.js";import{locales as l,localesModuleName as i}from"../vm/locales.js";import{route as n,routesModuleName as m}from"../vm/routes.js";let d="VirtualModuleWebpackPlugin";export default class{constructor(o){this.options=o,this.hasTapped=!1}apply(f){let c=new o({[`node_modules/${m}`]:n.getData(m),[`node_modules/${p}`]:"export default []",[`node_modules/${i}`]:l.getData(i),[`node_modules/${a}`]:"export default {}"});c.apply(f),f.hooks.compilation.tap(d,()=>{if(!this.hasTapped){let o=(o,t)=>{let s=`node_modules/${o}`;e.setData(s,!0),c.writeModule(s,t||""),f.hooks.done.tap(d,()=>{e.setData(s,!1)})};for(let t in this.options)if(Object.prototype.hasOwnProperty.call(this.options,t)){let e=this.options[t];o(t,"string"==typeof e?e:`export default ${JSON.stringify(e)}`)}for(let t of r)o(...t);for(let t of s)o(...t);n.on("change",o),l.on("change",o),t&&(r.on("change",o),s.on("change",o)),this.hasTapped=!0}})}}
|
package/lib/vm/docs.d.ts
CHANGED
package/lib/vm/docs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dirname as e,join as t}from"path";import{CONFIG as r}from"../config.js";import{FRAMEWORK as o,FRAMEWORKNAME as p,createElement as a,isReact as l,isSolid as s}from"../process-env.js";import i,{vmWriteing as n}from"../reactive-object.js";let c="@app/comment";export const docsModuleName="@app/docs";export const docs=new i({});let d={[c]:{}},m=`() => ${a}(SuspenseComp, { comp: $1 })`,f=`import { ${a}${s?",Dynamic":""} } from "${p}${s?"/web":""}";import SuspenseComp from "@app/suspense";`;["react","solid"].includes(o)||(m="$1",f=""),global.NEKOCLICONFIG.handleFileChange=function(o,p,i){let $=o.replace(RegExp(`^${r.alias["@pkg"]}`),""),u=e($).replace(/^\//,""),b=[c,u].join("/"),g=$.split("/").pop()?.replace(/\.tsx?/,".md");if(!g)return;d[c][u]||(d[c][u]={});let x=t(b,g);"deleted"===p?d[c][u][g]&&delete d[c][u][g]:(d[x]=i,i?d[c][u][g]=`rr(() => import(/* webpackChunkName: '${x}' */'${x}?raw').then((res) => ({default: ${l?"() =>":""}${a}(${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;}'})})))rr`:d[c][u][g]&&delete d[c][u][g]);let y={};for(let e in d)if(Object.prototype.hasOwnProperty.call(d,e)){let t=d[e];if(e===c)for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(y[e]=Object.values(t[e]));else docs.setData(e,t)}docs.setData("@app/docs",`${f}export default ${JSON.stringify(y).replace(/"rr\((.+?)\)rr"/g,m)}`),n.setData(o,!1)};
|
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 m from"../reactive-object.js";export const exampleModuleName="@app/example";export const examples=new m;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(/.md$/,""),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)};`)})},
|
|
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 m from"../reactive-object.js";export const exampleModuleName="@app/example";export const examples=new m;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(/.md$/,""),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)},"vm-examples");
|
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"};`))},
|
|
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)},"vm-router");
|
package/package.json
CHANGED
package/lib/generate-api.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function generateApi(path: string): string;
|
package/lib/generate-api.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{readFileSync as e}from"fs";import{dirname as t}from"path";import n from"typescript";import{CONFIG as r}from"./config.js";let{ScriptKind:l,ScriptTarget:o,SyntaxKind:i,createSourceFile:c,forEachChild:a,getLeadingCommentRanges:u,isInterfaceDeclaration:s,isQuestionToken:f,isPropertySignature:p,isFunctionTypeNode:m,isUnionTypeNode:g,isMethodSignature:$}=n,h={};function b(e){let t=u(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 d(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}](${n})`}return null}function x(e){if(!e)return null;let t=e.match(/@ignore\s+([^\n]+)/);return t?t[1].trim():null}let 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(h[e]){let n=`/${[r.basename,h[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 k(e){return e?e.replace(/^@[a-z].+/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}export default function w(u){let j=e(u,{encoding:"utf-8"}),w=c(u,j,o.Latest,!0,l.TS),E="";return a(w,e=>{s(e)?E+=function(e){let l=e.name.text;Object.assign(h,{[e.name.text]:t(e.getSourceFile().fileName).replace(r.alias["@pkg"],"")});let o=b(e),c=d(o),a=k(o),u=x(o)?.split("|")||[],s=u.includes("comment"),j=u.includes("initial"),w=u.includes("optional"),E=u.includes("version"),S=u.includes("author"),v=a?`\\color{|4||0.45}{${l}}`:l,F=(function(e){let t=[];if(e.heritageClauses){for(let r of e.heritageClauses)if(r.token===n.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>`),z=[a,v,c&&`\\color{#52c11b|1||0.9}{${c}}`,F.length>0&&`<sub>\`extends\`</sub> ${F.join(" ")}`].filter(Boolean).join(" "),K=`## ${z}`,N=e.members.filter(e=>p(e)&&e.type?.kind!==i.NeverKeyword||$(e)),q=[];if(N.length){N.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(!g(e.type))return m(e.type);for(let t of e.type.types)if(m(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,!w&&`\\color{${l?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${l?"✘":"✔"}}`,!s&&B(k(n)),t,!j&&B(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(n)),!E&&B(d(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),!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 i=[":-",!w&&":-",r&&":-",":-",n&&":-",t&&":-",e&&":-"].filter(Boolean);K+="\n";let c=i.join("|");K+=`|${c}|`,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"}(e):n.isEnumDeclaration(e)&&(E+=function(e){let l=e.name.text,o=b(e),i=k(o),c=d(o);Object.assign(h,{[e.name.text]:t(e.getSourceFile().fileName).replace(r.alias["@pkg"],"")});let a=i?`\\color{|4||0.45}{${l}}`:l,u=[i,a,c&&`\\color{#52c11b|1||0.9}{${c}}`].filter(Boolean).join(" "),s=x(o)?.split("|")||[],f=s.includes("comment"),p=s.includes("version"),m=s.includes("author"),g=`## ${u}`;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.isStringLiteral(t)?` '${t.text}'`:null}(e)),c=B(d(l)),a=B(k(l));!r||r.startsWith("\\color")||/^["'](.+)["']$/.test(r)||(r=`\\color{#4c81db}{${r}}`),t.push([r,!f&&a,i,!p&&c,!m&&(y(l)||y(o))])});let r=!1,l=!1,i=!1;t.forEach(e=>{!f&&e[1]&&(i=!0),!p&&e[3]&&(l=!0),!m&&e[4]&&(r=!0)}),g+="\n";let c=["属性",i&&"说明","值",l&&"版本",r&&"作者"].filter(Boolean).join("|");g+=`|${c}|`;let a=[":-",i&&":-",":-",l&&":-",r&&":-"].filter(Boolean);g+="\n";let u=a.join("|");g+=`|${u}|`,t.forEach(e=>{g+="\n";let t=[e[0]||"-",i&&(e[1]||"-"),e[2]||"-",l&&(e[3]||"-"),r&&(e[4]||"-")].filter(Boolean).join("|");g+=`|${t}|`})}return g+="\n\n"}(e))}),E}
|