@moneko/core 3.0.0-beta.56 → 3.0.0-beta.58

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/cleanup.js CHANGED
@@ -1 +1 @@
1
- import{existsSync as o,rmdirSync as r,readdirSync as t,statSync as c,unlinkSync as s}from"fs";import{join as e}from"path";import{apiCacheDir as i,frameworkCacheDir as p}from"./process-env.js";process.on("exit",async function(){try{s(e(p,"example.js"))}catch(o){}try{s(e(p,"route.js"))}catch(o){}!function i(p){o(p)&&(t(p).forEach(o=>{let r=e(p,o);c(r).isDirectory()?i(r):s(r)}),r(p))}(i),process.exit(0)});
1
+ import{existsSync as o,rmdirSync as t,readdirSync as r,statSync as c,unlinkSync as n}from"fs";import{join as s}from"path";import{apiCacheDir as e,frameworkCacheDir as i}from"./process-env.js";function f(){try{n(s(i,"example.js"))}catch(o){}try{n(s(i,"route.js"))}catch(o){}!function e(i){o(i)&&(r(i).forEach(o=>{let t=s(i,o);c(t).isDirectory()?e(t):n(t)}),t(i))}(e)}process.on("SIGINT",function(){f()}),process.on("exit",function(){f()});
@@ -1,4 +1,4 @@
1
- import{existsSync as e,mkdirSync as t,readFile as n,readFileSync as r,statSync as l,writeFile as i,unlink as o}from"fs";import{join as s}from"path";import{watch as u}from"chokidar";import c from"typescript";import{APPTYPE as f,PROGRAMPATH as a,apiCacheDir as p,frameworkCacheDir as m}from"./process-env.js";let{ScriptKind:g,ScriptTarget:d,SyntaxKind:$,createSourceFile:x,forEachChild:b,getLeadingCommentRanges:h,isInterfaceDeclaration:y,isQuestionToken:k,isPropertySignature:S}=c;function T(e){let t=h(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.substring(t[0].pos,t[0].end),r=n.match(/\/\*\*([\s\S]*?)\*\//);if(r){let e=r[1].replace(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim();return e}}return null}function C(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}function F(e,t){if(!e)return t;if(!t)return null;let n=t;return e.replace(/@see\s+{@link\s+([^|}]+)(?:\|([^}]+))?}/g,(e,t,r)=>{let l=r||n;return n=n.replace(new RegExp(l),`[${l}](${t})`),""}),n}function j(e){return e?.replace(/\*/g,"\\*").replace(/\|/g,"\\|")||"-"}let B=["#9C27B0","#673AB7","#3F51B5","#2196F3","#00BCD4","#009688","#4CAF50","#CDDC39","#FF9800","#795548"];function D(e){return e?e.replace(/^@default\s+([^(|\n)]+)/gm,"").replace(/^@since\s+([^\n]+)/gm,"").replace(/^@see\s+{@link\s+(.+?)(?:\|(.+?))?}/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}function _(){}let w={};function E(l,u){e(m)||t(m),e(p)||t(p);let f=l.split("/").slice(-2),a=s(p,f[0]),h=f[1].replace(/\.tsx?/,".md");e(a)||t(a),w[f[0]]||(w[f[0]]=[]);let E=w[f[0]].indexOf(h),I=s(a,h);if("deleted"===u)o(I,_),-1!==E&&w[f[0]].splice(E,1);else{let e=function(e){let t=r(e,"utf-8"),n=x(e,t,d.Latest,!0,g.TS),l="";return b(n,e=>{y(e)?l+=function(e){let t=T(e),n=C(t),r=D(t),l=e.name.text,i=r?`\\color{\\|4\\|\\|0.45}{${l}}`:l,o=(function(e){let t=[];if(e.heritageClauses){for(let n of e.heritageClauses)if(n.token===c.SyntaxKind.ExtendsKeyword)for(let e of n.types)t.push(e.getText())}return t})(e)?.map((e,n)=>`<n-tag color="${B[n]}" css=".tag{gap:0px;}">${F(t,e)}</n-tag>`),s=[r,i,n&&`\\color{#52c11b\\|1\\|\\|0.9}{${n}}`,o.length>0&&`<sub>\`extends\`</sub> ${o.join(" ")}`].filter(Boolean).join(" "),u=`## ${s}
1
+ import{existsSync as e,mkdirSync as t,readFile as n,readFileSync as r,statSync as l,writeFile as i,unlink as o}from"fs";import{join as s}from"path";import{watch as u}from"chokidar";import c from"typescript";import{APPTYPE as f,PROGRAMPATH as a,apiCacheDir as p,frameworkCacheDir as m}from"./process-env.js";let{ScriptKind:g,ScriptTarget:d,SyntaxKind:$,createSourceFile:x,forEachChild:b,getLeadingCommentRanges:h,isInterfaceDeclaration:y,isQuestionToken:k,isPropertySignature:S}=c;function T(e){let t=h(e.getSourceFile().text,e.pos);if(t){let n=e.getSourceFile().text.substring(t[0].pos,t[0].end),r=n.match(/\/\*\*([\s\S]*?)\*\//);if(r){let e=r[1].replace(/^\s*\* ?/gm,"").replace(/\s+$/,"").trim();return e}}return null}function C(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}function F(e,t){if(!e)return t;if(!t)return null;let n=t;return e.replace(/@see\s+{@link\s+([^|}]+)(?:\|([^}]+))?}/g,(e,t,r)=>{let l=r||n;return n=n.replace(new RegExp(l),`[${l}](${t})`),""}),n}function j(e){return e?.replace(/\*/g,"\\*").replace(/\|/g,"\\|")||"-"}let B=["#9C27B0","#673AB7","#3F51B5","#2196F3","#00BCD4","#009688","#4CAF50","#CDDC39","#FF9800","#795548"];function D(e){return e?e.replace(/^@default\s+([^(|\n)]+)/gm,"").replace(/^@since\s+([^\n]+)/gm,"").replace(/^@see\s+{@link\s+(.+?)(?:\|(.+?))?}/gm,"").replace(/(\n\s+)+/g,"<br />").replace(/\n/g,"<br />").replace(/(<br \/>)$/g,""):null}function _(){}let w={};function E(l,u){e(m)||t(m),e(p)||t(p);let f=l.split("/").slice(-2),a=s(p,f[0]),h=f[1].replace(/\.tsx?/,".md");e(a)||t(a),w[f[0]]||(w[f[0]]=[]);let E=w[f[0]].indexOf(h),I=s(a,h);if("deleted"===u)o(I,_),-1!==E&&w[f[0]].splice(E,1);else{let e=function(e){let t=r(e,"utf-8"),n=x(e,t,d.Latest,!0,g.TS),l="";return b(n,e=>{y(e)?l+=function(e){let t=T(e),n=C(t),r=D(t),l=e.name.text,i=r?`\\color{|4||0.45}{${l}}`:l,o=(function(e){let t=[];if(e.heritageClauses){for(let n of e.heritageClauses)if(n.token===c.SyntaxKind.ExtendsKeyword)for(let e of n.types)t.push(e.getText())}return t})(e)?.map((e,n)=>`<n-tag color="${B[n]}" css=".tag{gap:0px;}">${F(t,e)}</n-tag>`),s=[r,i,n&&`\\color{#52c11b|1||0.9}{${n}}`,o.length>0&&`<sub>\`extends\`</sub> ${o.join(" ")}`].filter(Boolean).join(" "),u=`## ${s}
2
2
  | 属性 | 必要 | 说明 | 类型 | 默认值 | 版本 |
3
3
  | :- | :-: | :- | :- | :- | :- |
4
4
  `;for(let t of e.members)if(S(t)&&t.type?.kind!==$.NeverKeyword){let e=j(t.name.getText()),n=t.questionToken&&k(t.questionToken),r=T(t),l=j(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(r)),i=j(C(r)),o=F(r,j(t.type?.getText())),s=j(D(r)),c=`\\color{${n?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${n?"✘":"✔"}}`;u+=`| ${e} | ${c} | ${s} | ${o} | ${l} | ${i} |
package/lib/seo.js CHANGED
@@ -1 +1 @@
1
- import{existsSync as t,mkdirSync as o,writeFile as e,readdirSync as r,statSync as s}from"fs";import{join as m}from"path";import{CONFIG as p}from"./common.js";import{APPTYPE as i,PROGRAMPATH as n}from"./process-env.js";import{resolveProgramPath as c}from"./utils.js";import{outputConfig as f}from"./webpack.common.js";export const seo=()=>{let{domain:a,nojekyll:u,path:l}=p.seo||{};if(!a)return;let h=l&&c(l)||f?.path||process.cwd(),j=t=>{if(t)throw t};t(h)||o(h),e(m(h,"CNAME"),a,"utf-8",j),e(m(h,"robots"),`Sitemap: https://${a}${p.routeBaseName}sitemap.txt`,"utf-8",j);let E="";"library"===i&&(E=(function t(o,e,m){let p=[],i=r(o);return i.forEach(function(r){if("static"===r)return!1;let i=o+"/"+r,c=s(i);c&&c.isDirectory()?p=p.concat(t(i,e,m)):i.endsWith("README.mdx")&&p.push("https://"+e+m+i.replace(n+"/components/","").replace("/README.mdx",""))}),p})(m(n,"./components"),a,p.routeBaseName).join("\n")),e(m(h,"sitemap.txt"),E,"utf-8",j),u&&e(m(h,".nojekyll"),"","utf-8",j)};
1
+ import{existsSync as t,mkdirSync as o,writeFile as e,readdirSync as r,statSync as s}from"fs";import{join as m}from"path";import{CONFIG as i}from"./common.js";import{APPTYPE as p,PROGRAMPATH as n}from"./process-env.js";import{resolveProgramPath as c}from"./utils.js";import{outputConfig as f}from"./webpack.common.js";export const seo=()=>{let{domain:a,nojekyll:u,path:l}=i.seo||{};if(!a)return;let h=i.routeBaseName,j=h.endsWith("/")?h:h+"/",E=l&&c(l)||f?.path||process.cwd(),d=t=>{if(t)throw t};t(E)||o(E),e(m(E,"CNAME"),a,"utf-8",d),e(m(E,"robots"),`Sitemap: https://${a}${j}sitemap.txt`,"utf-8",d);let x="";"library"===p&&(x=(function t(o,e,m){let i=[],p=r(o);return p.forEach(function(r){if("static"===r)return!1;let p=o+"/"+r,c=s(p);c&&c.isDirectory()?i=i.concat(t(p,e,m)):p.endsWith("README.mdx")&&i.push("https://"+e+m+p.replace(n+"/components/","").replace("/README.mdx",""))}),i})(m(n,"./components"),a,j).join("\n")),e(m(E,"sitemap.txt"),x,"utf-8",d),u&&e(m(E,".nojekyll"),"","utf-8",d)};
@@ -1 +1 @@
1
- import e from"fs";import t from"add-asset-html-webpack-plugin";import s from"html-webpack-plugin";import n from"webpack";import o from"webpackbar";import{CONFIG as l,ENTRYPATH as i,PUBLICPATH as r}from"./common.js";import a from"./done.js";import p from"./envFlags.js";import m from"./html-add-entry-attr.js";import c from"./html-plugin-option.js";import{moduleFederation as u}from"./module-federation.js";import f from"./module.config.js";import{APPTYPE as d,DEV as g,hasEslintConfig as j,hasStylelintConfig as h,PACKAGENAME as b,PROGRAMPATH as y,FRAMEWORK as w,frameworkCacheDir as x}from"./process-env.js";import"./routes.js";import{seo as k}from"./seo.js";import{resolveNodeModulesPath as v,resolveProgramPath as C}from"./utils.js";import"./generate-api.js";import"./cleanup.js";let O=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],P=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],$=e.readdirSync(y),T=!1,A=!1;for(let e=0,t=$.length;e<t;e++)P.includes($[e])&&(A=!0),O.includes($[e])&&(T=!0);T||(T=j),A||(A=h);let B=A?(await import("stylelint-webpack-plugin")).default:null,S=T?(await import("eslint-webpack-plugin")).default:null,M={"@":C("src"),"@framework-cache-dir":x};Object.assign(M,l.alias),"library"===d&&Object.assign(M,{"@":C("site"),"@pkg":C("components"),[b]:C("components")});let F=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:C("library"===d?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:b,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${b}`,pathinfo:!1,clean:!0,publicPath:r};let K=v(`@moneko/${w}/lib/packages/${i[d]}/index.js`);"single-component"===d&&(Object.assign(M,{[b]:C("umd")}),K=C(g?"example/index.ts":"src/index.ts"),outputConfig.path=C(g?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=b,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let L={main:K};l.entry&&("string"==typeof l.entry?L=l.entry:Object.keys(l.entry)&&Object.assign(L,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let W=l.routeBaseName.split("/").filter(Boolean).length,D=Array(W).fill("..").join("/")+(W?"/":"")+"404.html",{pathSegmentsToKeep:R=W,path:_=D}=l.fixBrowserRouter||{},E={entry:L,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new n.AutomaticPrefetchPlugin,...u,S&&new S({fix:!0,threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),B&&new B({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),l.htmlPluginOption&&new s(c),l.fixBrowserRouter&&new s({filename:_,inject:!1,templateContent:()=>`<html html><head><title>${c.title}</title><script>var pathSegmentsToKeep = ${R||W};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new t(F),"single-spa"===d&&new m(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new n.DefinePlugin(p),new n.WatchIgnorePlugin({paths:[/\.d\.ts$/]}),l.sourceMap&&new n.SourceMapDevToolPlugin(l.sourceMap),l.bar&&new o(l.bar),new a({done:()=>{!g&&l.seo&&k(),l.done?.(),g||process.exit(0)}}),...l.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:M,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:f,externals:l.externals,output:outputConfig};export default E;
1
+ import e from"fs";import t from"add-asset-html-webpack-plugin";import s from"html-webpack-plugin";import n from"webpack";import o from"webpackbar";import{CONFIG as l,ENTRYPATH as i,PUBLICPATH as r}from"./common.js";import a from"./done.js";import p from"./envFlags.js";import m from"./html-add-entry-attr.js";import c from"./html-plugin-option.js";import{moduleFederation as u}from"./module-federation.js";import f from"./module.config.js";import{APPTYPE as d,DEV as g,hasEslintConfig as j,hasStylelintConfig as h,PACKAGENAME as b,PROGRAMPATH as y,FRAMEWORK as w,frameworkCacheDir as x}from"./process-env.js";import"./routes.js";import{seo as k}from"./seo.js";import{resolveNodeModulesPath as v,resolveProgramPath as C}from"./utils.js";import"./generate-api.js";import"./cleanup.js";let O=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],P=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],T=e.readdirSync(y),$=!1,A=!1;for(let e=0,t=T.length;e<t;e++)P.includes(T[e])&&(A=!0),O.includes(T[e])&&($=!0);$||($=j),A||(A=h);let B=A?(await import("stylelint-webpack-plugin")).default:null,S=$?(await import("eslint-webpack-plugin")).default:null,M={"@":C("src"),"@framework-cache-dir":x};Object.assign(M,l.alias),"library"===d&&Object.assign(M,{"@":C("site"),"@pkg":C("components"),[b]:C("components")});let F=l.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:C("library"===d?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:b,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${b}`,pathinfo:!1,clean:!0,publicPath:r};let K=v(`@moneko/${w}/lib/packages/${i[d]}/index.js`);"single-component"===d&&(Object.assign(M,{[b]:C("umd")}),K=C(g?"example/index.ts":"src/index.ts"),outputConfig.path=C(g?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=b,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let L={main:K};l.entry&&("string"==typeof l.entry?L=l.entry:Object.keys(l.entry)&&Object.assign(L,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let W=l.routeBaseName.split("/").filter(Boolean).length,D=Array(W).fill("..").join("/")+(W?"/":"")+"404.html",{pathSegmentsToKeep:R=W,path:_=D}=l.fixBrowserRouter||{},E={entry:L,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new n.AutomaticPrefetchPlugin,...u,S&&new S({fix:!0,threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),B&&new B({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),l.htmlPluginOption&&new s(c),l.fixBrowserRouter&&new s({filename:_,inject:!1,templateContent:()=>`<html html><head><title>${c.title}</title><script>var pathSegmentsToKeep = ${R||W};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new t(F),"single-spa"===d&&new m(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new n.DefinePlugin(p),new n.WatchIgnorePlugin({paths:[/\.d\.ts$/]}),l.sourceMap&&new n.SourceMapDevToolPlugin(l.sourceMap),l.bar&&new o(l.bar),new a({done:()=>{!g&&l.seo&&k(),l.done?.(),g||setTimeout(()=>{process.exit(0)},2e3)}}),...l.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:M,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:f,externals:l.externals,output:outputConfig};export default E;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.0.0-beta.56",
3
+ "version": "3.0.0-beta.58",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",