@moneko/core 3.8.8 → 3.9.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/paths.js +1 -1
- package/lib/prod.js +1 -1
- package/lib/seo.js +1 -1
- package/lib/vm/routes.js +1 -1
- package/lib/vm/utils.js +1 -1
- package/package.json +2 -2
package/lib/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"url";
|
|
1
|
+
import e from"url";let o=JSON.parse(process.env.npm_config_argv||"{}")?.original;export const yarnArgv={};o?.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 c=process.cwd(),t=`${c}/node_modules/.cache/.mo`;export default{corePath:e.fileURLToPath(new URL(".",import.meta.url)),programPath:c,webpackCachePath:`${c}/node_modules/.temp_cache`,cachePath:t,httpCachePath:`${c}/node_modules/.cache/http`,swcCachePath:`${c}/node_modules/.swc`,configPath:`${c}/config/index.ts`,customConfigPath:`${c}/config/${CUSTOMCONFIG}.ts`,coveragePath:`${c}/coverage/clover.xml`,pagesPath:`${c}/src/pages`,componentsPath:`${c}/components`};
|
package/lib/prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeDirAll as e}from"@moneko/mdx";import i from"css-minimizer-webpack-plugin";import o from"mini-css-extract-plugin";import
|
|
1
|
+
import{removeDirAll as e}from"@moneko/mdx";import i from"css-minimizer-webpack-plugin";import o from"mini-css-extract-plugin";import m from"terser-webpack-plugin";import n from"webpack";import{BundleAnalyzerPlugin as r}from"webpack-bundle-analyzer";import{merge as s}from"webpack-merge";import t from"webpackbar";import{clientConfig as p}from"./common.js";import{CONFIG as l}from"./config.js";import{getMinifyOption as a}from"./minify.js";import c from"./paths.js";import u from"./plugin/done.js";import f from"./seo.js";let{optimize:{MinChunkSizePlugin:d}}=n,{cssnanoMinify:h,swcMinify:w}=i,k="swc"===l.compiler,b=[];l.minifier&&(l.minifier.js&&b.push(new m(a(l.minifier.js?.type||(k?"swc":"terser"),l.minifier.js?.options))),l.minifier.css&&b.push(new i({minify:{swc:w,cssnano:h}[l.minifier.css?.type||(k?"swc":"cssnano")],minimizerOptions:l.minifier.css?.options})));let g={splitChunks:l.splitChunk,runtimeChunk:l.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:b},y=n(s(p,{devtool:!1===l.devtool||l.devtool?l.devtool:"cheap-module-source-map",mode:"production",optimization:g,plugins:[new o({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),l.splitChunk&&new d({minChunkSize:1e4}),l.bundleAnalyzer&&new r(l.bundleAnalyzer),l.bar&&new t(l.bar),new u({done:e=>{l.done?.(e),l.seo&&f()}})].filter(Boolean)}));y.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,stdin:!0},e=>{if(e)throw y.close(()=>{}),e;y.close(()=>{})}),process.on("exit",function(){e(c.cachePath)});
|
package/lib/seo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as t}from"path";import{
|
|
1
|
+
import{join as t}from"path";import{saveFileSync as o}from"@moneko/mdx";import{outputConfig as r}from"./common.js";import{CONFIG as m}from"./config.js";import{resolveProgramPath as e}from"./utils.js";import{routes as i}from"./vm/routes.js";export default(()=>{let{domain:s,nojekyll:p,path:n}=m.seo||{},a=n&&e(n)||r?.path;if(!s||!a)return;let f=m.basename,h=f.endsWith("/")?f:`${f}/`;o(t(a,"CNAME"),s),o(t(a,"robots"),`Sitemap: https://${s}${h}sitemap.txt`);let l=[];!function t(o){o.forEach(o=>{l.push(`https://${s}${h}${o.key}`),Array.isArray(o.children)&&t(o.children)})}(i),o(t(a,"sitemap.txt"),l.join("\n")),p&&o(t(a,".nojekyll"),"")});
|
package/lib/vm/routes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{generateRouter as e,generateRouterLibrary as t,scanFolder as o}from"@moneko/mdx";import{getTree as r,mergeRouter as s,watchFiles as a}from"./utils.js";import{CONFIG as m}from"../config.js";import p from"../paths.js";import{FRAMEWORK as i,isDev as u,isLibrary as n}from"../process-env.js";import l from"../reactive-object.js";export const routesModuleName="@app/routes";export const route=new l({[routesModuleName]:"export default []"});export let routes=[];let f=n?p.componentsPath:p.pagesPath,c=n?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,x=n?"@pkg":"@/pages",d=n?t:e;function j(e){routes=s(r({base:f,files:e,alia:x}),"key"),route.setData(routesModuleName,d(p.componentsPath,`${m.alias["@"]}/router/index.ts`,i,m.alias["@"]))}let g=o(f).filter(e=>!c.test(e));j(g),u&&a(f,c,j,g);
|
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{
|
|
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{isSolid as l}from"../process-env.js";let o=l?"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:[l&&{...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(s=>{let c={code:"",frontmatter:"{}"},a=t(i.base,s),h=i.base.split("/").filter(Boolean),p=s.split("/").filter(Boolean).slice(0,-1);(s.endsWith(".md")||s.endsWith(".mdx"))&&Object.assign(c,n(r(s)));let d={},f=Object.assign({meta:JSON.parse(c.frontmatter)},i.alia&&{[o]:`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:s.split("/").pop(),key:s.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).sort((e,t)=>e.key>t.key?1:-1)}export function watchFiles(e,t,n,r=[]){let l=i(e,{ignored:(e,n)=>{if(n)return!n.isDirectory()&&t.test(e)},persistent:!0,ignoreInitial:!0});function o(){l.unwatch(e),l.close()}l.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)}),l.once("ready",()=>{o()}),process.on("SIGINT",o)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1-beta.0",
|
|
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.
|
|
16
|
+
"@moneko/mdx": "0.1.14",
|
|
17
17
|
"@swc/core": "1.3.100",
|
|
18
18
|
"@swc/css": "0.0.28",
|
|
19
19
|
"@swc/helpers": "0.5.3",
|