@moneko/core 3.11.0-beta.7 → 3.11.0-beta.9
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/rule.d.mts +7 -0
- package/lib/rule.mjs +1 -1
- package/lib/vm/docs.mjs +1 -1
- package/lib/vm/example.mjs +1 -1
- package/lib/vm/modules.mjs +1 -1
- package/package.json +1 -1
package/lib/rule.d.mts
CHANGED
|
@@ -19,5 +19,12 @@ declare const Rule: {
|
|
|
19
19
|
__tests__: RegExp;
|
|
20
20
|
dev_watch_ignored: RegExp;
|
|
21
21
|
worker_file: RegExp;
|
|
22
|
+
/**
|
|
23
|
+
* 提取函数字符串
|
|
24
|
+
* @example
|
|
25
|
+
* // () => import('@app')
|
|
26
|
+
* "rr(() => import('@app'))rr".replace(Rule.extract_func, '$1')
|
|
27
|
+
* */
|
|
28
|
+
extract_func: RegExp;
|
|
22
29
|
};
|
|
23
30
|
export default Rule;
|
package/lib/rule.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default{js:/\.(cj|mj|t|j)s(|x)$/i,css:/\.css$/i,less:/\.less$/i,scss:/\.(sa|sc)ss$/i,wasm:/\.wasm$/i,txt:/\.txt$/i,ico:/\.ico$/i,svg:/\.svg$/i,image:/\.(gif|png|jpe?g|webp)$/i,video:/\.(webm|mp4|ogv)$/i,font:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,markdown:/\.mdx?$/i,tsdoc:/^(?![._]).*(?<!\.test)\.(tsx?)$/,css_module:/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules_css_module:/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,no_parse:[/jquery|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],node_modules:/node_modules/,__tests__:/(.+)\/__tests__\/(.+)/,dev_watch_ignored:/node_modules(?![\\/]@app)/,worker_file:/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/};
|
|
1
|
+
export default{js:/\.(cj|mj|t|j)s(|x)$/i,css:/\.css$/i,less:/\.less$/i,scss:/\.(sa|sc)ss$/i,wasm:/\.wasm$/i,txt:/\.txt$/i,ico:/\.ico$/i,svg:/\.svg$/i,image:/\.(gif|png|jpe?g|webp)$/i,video:/\.(webm|mp4|ogv)$/i,font:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,markdown:/\.mdx?$/i,tsdoc:/^(?![._]).*(?<!\.test)\.(tsx?)$/,css_module:/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules_css_module:/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,no_parse:[/jquery|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],node_modules:/node_modules/,__tests__:/(.+)\/__tests__\/(.+)/,dev_watch_ignored:/node_modules(?![\\/]@app)/,worker_file:/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/,extract_func:/"rr\((.+?)\)rr"/g};
|
package/lib/vm/docs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.mjs";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isLibrary as
|
|
1
|
+
import{loadFileSync as e,scanFolder as t}from"@moneko/mdx";import o from"./generate-doc.mjs";import{CONFIG as r}from"../config.mjs";import{FRAMEWORK as n,isLibrary as m,isReact as a,isSolid as s}from"../process-env.mjs";import l from"../utils/reactive-object.mjs";import p from"../rule.mjs";let c={react:"createElement",solid:"createComponent"}[n];export const docsModuleName="@app/docs";export const docs=new l({[docsModuleName]:"export default {}"});export const comment=new l({});export const getCommentPath=function(){let e=/^\/?(.+?)\.tsx?$/,t=r.alias["@pkg"]?.length;return o=>o.substring(t).replace(e,"@app/comment/$1.md")}();if(m){let m={},l=`import { ${c}${s?",Dynamic":""} } from "${{react:"react",solid:"solid-js"}[n]}${s?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${a?"() =>":""}${c}(${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;}' })};}`,i=(e,t)=>{let o=e.replace(/^@app\/comment\//,"").split("/"),r=o.pop(),n=o.join("/");m[n]||(m[n]={}),t?m[n][r]&&delete m[n][r]:m[n][r]=`rr(() => ${c}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`;let a={};for(let e in m)Object.prototype.hasOwnProperty.call(m,e)&&(a[e]=Object.values(m[e]));docs.setData(docsModuleName,`${l}export default ${JSON.stringify(a).replace(p.extract_func,"$1")}`)};comment.on("change",(e,t)=>{i(e,t?.length<0)});let d=t(r.alias["@pkg"],["\\.tsx?$"]).filter(e=>!/(^|\/)\.[^\\/\\.]|\.test\./i.test(e));for(let t=0,r=d.length;t<r;t++){let r=d[t],n=e(r);n&&comment.setData(getCommentPath(r),o(n,r))}}
|
package/lib/vm/example.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateExample as e}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import
|
|
1
|
+
import{generateExample as e}from"@moneko/mdx";import{watchFiles as t}from"./utils.mjs";import o from"../paths.mjs";import{isDev as r,isLibrary as a}from"../process-env.mjs";import m from"../utils/reactive-object.mjs";import p from"../rule.mjs";export const exampleModuleName="@app/example";function s(){try{return JSON.parse(e(o.componentsPath,`${exampleModuleName}/`))}catch(e){return{}}}export const examples=new m(a?s():{});function l(e){let t={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&Object.assign(t,{[o]:`rr(() => import('${o}'))rr`});examples.setData(exampleModuleName,`export default ${JSON.stringify(t).replace(p.extract_func,"$1")}`)}l(examples.data);export function generatorDemo(){let e=s();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&examples.setData(t,e[t]);l(examples.data)}a&&r&&t(o.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
|
package/lib/vm/modules.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as e,getAppMergeRouter as p,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as n,docsModuleName as l}from"./docs.mjs";import{exampleModuleName as x}from"./example.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as g}from"./locales.mjs";import{route as j,routesModuleName as u}from"./routes.mjs";import{CONFIG as h}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as k,FRAMEWORK as z}from"../process-env.mjs";import{resolveNodeModulesPath as D,resolveProgramPath as b}from"../utils/index.mjs";export default{[D("@app/info")]:`export default ${JSON.stringify(c)}`,[D("@app/entry")]:o(m(h.alias["@"],"./index.ts"),!!h.rem,!!h.normalizeCss,k,z),[D("@app/rem")]:s(h.rem?.designSize||1680),[D("@app/fallback")]:r(h.fallbackCompPath),[D("@app/coverage")]:f(v.coveragePath),[D("@app/merge-router")]:p(),[D("@app/prefix-router")]:a(),[D("@app/normalize/index.css")]:t(),[D("@app/suspense/index.tsx")]:i(k,z),[D("@app/mdx-scope")]:e(b("site/mdx-scope.ts")),[D(u)]:j.getData(u),[D(x)]:"export default
|
|
1
|
+
import{join as m}from"path";import{getAppEntry as o,getAppFallback as r,getAppMdxScope as e,getAppMergeRouter as p,getAppNormalizeCss as t,getAppPrefixRouter as a,getAppRem as s,getAppSuspense as i}from"@moneko/mdx";import f from"./coverage.mjs";import{docs as n,docsModuleName as l}from"./docs.mjs";import{exampleModuleName as x}from"./example.mjs";import c from"./info.mjs";import{locales as d,localesModuleName as g}from"./locales.mjs";import{route as j,routesModuleName as u}from"./routes.mjs";import{CONFIG as h}from"../config.mjs";import v from"../paths.mjs";import{APPTYPE as k,FRAMEWORK as z}from"../process-env.mjs";import{resolveNodeModulesPath as D,resolveProgramPath as b}from"../utils/index.mjs";export default{[D("@app/info")]:`export default ${JSON.stringify(c)}`,[D("@app/entry")]:o(m(h.alias["@"],"./index.ts"),!!h.rem,!!h.normalizeCss,k,z),[D("@app/rem")]:s(h.rem?.designSize||1680),[D("@app/fallback")]:r(h.fallbackCompPath),[D("@app/coverage")]:f(v.coveragePath),[D("@app/merge-router")]:p(),[D("@app/prefix-router")]:a(),[D("@app/normalize/index.css")]:t(),[D("@app/suspense/index.tsx")]:i(k,z),[D("@app/mdx-scope")]:e(b("site/mdx-scope.ts")),[D(u)]:j.getData(u),[D(x)]:"export default {}",[D(g)]:d.getData(g),[D(l)]:n.getData(l)};
|