@moneko/core 3.9.1-beta.0 → 3.9.1
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/html-plugin-option.js +1 -1
- package/lib/info.d.ts +2 -1
- package/lib/info.js +1 -1
- package/lib/loader/hot-router.cjs +1 -0
- package/lib/loader/hot-router.d.cts +1 -0
- package/lib/loader/ts-doc.cjs +1 -1
- package/lib/plugin/virtual-module.js +1 -1
- package/lib/reactive-object.d.ts +1 -6
- package/lib/reactive-object.js +1 -1
- package/lib/seo.js +1 -1
- package/lib/vm/docs.js +1 -9
- package/lib/vm/example.d.ts +2 -1
- package/lib/vm/example.js +1 -1
- package/lib/vm/routes.d.ts +1 -2
- package/lib/vm/routes.js +1 -1
- package/lib/vm/utils.d.ts +1 -19
- package/lib/vm/utils.js +1 -1
- package/package.json +2 -2
- package/lib/vm/mdx-scope.d.ts +0 -2
- package/lib/vm/mdx-scope.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import i from"./info.js";import{PACKAGENAME as
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as t}from"./config.js";import{description as i,keywords as o}from"./info.js";import{PACKAGENAME as a,coreName as r}from"./process-env.js";import{resolveProgramPath as m}from"./utils.js";let{template:p,favicon:l,...n}=Object.assign({template:`node_modules/${r}/template/index.html`,favicon:`node_modules/${r}/template/favicon.ico`},t.htmlPluginOption||{}),s=e({title:t.env?.PROJECTNAME||a.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,keywords:o},tags:[],template:m(p),favicon:m(l)},n);export default s;
|
package/lib/info.d.ts
CHANGED
package/lib/info.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as
|
|
1
|
+
import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as o}from"./config.js";import{APPTYPE as r,PACKAGENAME as t,PACKAGEVERSION as s}from"./process-env.js";import{resolveProgramPath as p,toUpperCaseString as i}from"./utils.js";let{description:m,author:n,repository:a,keywords:c}=JSON.parse(e(p("package.json"))||"{}"),f="string"==typeof n,d={name:t,projectName:JSON.stringify(i(t).replace(/-/g," ")),version:s,base:o.basename,type:r,routerMode:o.routerMode,prefixCls:o.prefixCls,theme:o.theme,description:m,author:f?{name:n}:n,repository:f?{url:a}:a};export const description=m;export const keywords=c;export default d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return s}});const e=require("fs"),t={};function s(s){let i=this.resourcePath,{comment:r,generateDoc:n}=this.getOptions();return(0,e.stat)(i,(e,c)=>{if(!e){let e=c.mtime.getTime();t[i]!==e&&(Object.assign(t,{[i]:e}),r.setData(`@app/comment/${i.split("/").slice(-2).join("/").replace(/\.tsx?/,".md")}`,n(s,i)))}}),this.cacheable(!0),s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack-virtual-modules";import{CONFIG as
|
|
1
|
+
import{fileExists as e}from"@moneko/mdx";import t from"webpack-virtual-modules";import{CONFIG as o}from"../config.js";import n from"../info.js";import{FRAMEWORKNAME as r,isLibrary as i,isReact as a}from"../process-env.js";import{resolveNodeModulesPath as p,resolveProgramPath as l}from"../utils.js";import s from"../vm/coverage.js";import{comment as m,docs as c,docsModuleName as u}from"../vm/docs.js";import d from"../vm/entry.js";import{exampleModuleName as f,examples as b}from"../vm/example.js";import{locales as h,localesModuleName as g}from"../vm/locales.js";import{route as y,routesModuleName as x}from"../vm/routes.js";let k=o.fallbackCompPath&&`import F from "${o.fallbackCompPath}";export default F;`,v=o.rem?.designSize||1680,z="export default {};";e(l("site/mdx-scope.ts"))&&(z='import scope from "@/mdx-scope";export default scope');export default class{constructor(e){this.options=e,this.hasTapped=!1}apply(e){let o=new t({[p("@app/info")]:`export default ${JSON.stringify(n)}`,[p("@app/entry")]:d,[p("@app/rem")]:`!function(e,n){function t(){let n=e.documentElement,t=n.clientWidth||e.body.clientWidth,i=t<=375?375:${v},o=t;o=t<=375?t:t<=${v}?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);`,[p("@app/fallback")]:k||"export default null",[p("@app/coverage")]:s,[p("@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;",[p("@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;',[p("@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}',[p("@app/suspense/index.tsx")]:`import ${a?"React,":""}{Suspense,lazy} from "${r}";import Fallback from '@app/fallback';${i?'import scope from "@app/mdx-scope";':""}function SuspenseComp(props) {const Lazy = lazy(props.comp);return (<Suspense fallback={Fallback && <Fallback />}><Lazy ${i?"components={scope}":""}/></Suspense>);}export default SuspenseComp;`,[p("@app/mdx-scope")]:z,[p(x)]:y.getData(x),[p(f)]:"export default []",[p(g)]:h.getData(g),[p(u)]:c.getData(u)});function l(e,t){let n=p(e);o.writeModule(n,t||"")}o.apply(e),y.on("change",l),h.on("change",l),i&&(b.on("change",l),c.on("change",l),m.on("change",l)),e.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];l(e,"string"==typeof t?t:`export default ${JSON.stringify(t)}`)}for(let e of b)l(...e);for(let e of c)l(...e);for(let e of m)l(...e)}})}}
|
package/lib/reactive-object.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
|
-
declare class
|
|
3
|
+
declare class ReactiveObject<T extends object = Record<string, string | undefined>> extends EventEmitter {
|
|
4
4
|
readonly data: T;
|
|
5
5
|
constructor(props?: T);
|
|
6
6
|
setData(key: keyof T, value: T[keyof T]): void;
|
|
@@ -8,9 +8,4 @@ declare class WriteingReactiveObject<T extends object = Record<string, string |
|
|
|
8
8
|
removeData(key: keyof T): void;
|
|
9
9
|
[Symbol.iterator](): Iterator<[keyof T, T[keyof T]]>;
|
|
10
10
|
}
|
|
11
|
-
declare class ReactiveObject<T extends object = Record<string, string | undefined>> extends WriteingReactiveObject<T> {
|
|
12
|
-
readonly data: T;
|
|
13
|
-
constructor(props?: T);
|
|
14
|
-
setData(key: keyof T, value: T[keyof T]): void;
|
|
15
|
-
}
|
|
16
11
|
export default ReactiveObject;
|
package/lib/reactive-object.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"events";
|
|
1
|
+
import t from"events";class e extends t{constructor(t={}){super(),this.data=t}setData(t,e){e!=this.data[t]&&(this.data[t]=e,this.emit("change",t,e))}getData(t){return this.data[t]}removeData(t){Object.prototype.hasOwnProperty.call(this.data,t)&&(delete this.data[t],this.emit("change",t,null))}[Symbol.iterator](){let t=Object.keys(this.data),e=0;return{next:()=>{if(e<t.length){let a=t[e++];return{value:[a,this.data[a]],done:!1}}return{value:void 0,done:!0}}}}}export default e;
|
package/lib/seo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as t}from"path";import{saveFileSync as o}from"@moneko/mdx";import{outputConfig as
|
|
1
|
+
import{join as t}from"path";import{saveFileSync as o,scanRouter as m,sitemap as r}from"@moneko/mdx";import{outputConfig as p}from"./common.js";import{CONFIG as e}from"./config.js";import s from"./paths.js";import{isLibrary as i}from"./process-env.js";import{resolveProgramPath as a}from"./utils.js";export default(()=>{let{domain:n,nojekyll:f,path:j}=e.seo||{},h=j&&a(j)||p?.path;if(!n||!h)return;let l=i?s.componentsPath:s.pagesPath,c=`https://${n}${e.basename}`;o(t(h,"CNAME"),n),o(t(h,"robots"),`Sitemap: ${c}/sitemap.txt`),o(t(h,"sitemap.txt"),r(l,c,m(l,i)).join("\n")),f&&o(t(h,".nojekyll"),"")});
|
package/lib/vm/docs.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
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{FRAMEWORKNAME as n,createElement as
|
|
2
|
-
function getComment(name) {
|
|
3
|
-
return () =>
|
|
4
|
-
${m}(SuspenseComp, {
|
|
5
|
-
comp: () =>
|
|
6
|
-
import(${p?"":"/* webpackChunkName: `@app/comment/${name}` */ "}\`@app/comment/\${name}?raw\`).then((res) => ({default: ${a?"() =>":""}${m}(${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;}'})})),
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
`;comment.on("change",(e,t)=>{!function(e,t){let[o,r]=e.replace(/^@app\/comment\//,"").split("/");i[o]||(i[o]={}),t?i[o][r]&&delete i[o][r]:i[o][r]=`rr(getComment('${o}/${r}'))rr`;let n={};for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(n[e]=Object.values(i[e]));docs.setData(docsModuleName,`${l}export default ${JSON.stringify(n).replace(/"rr\((.+?)\)rr"/g,"$1")}`)}(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))});
|
|
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{FRAMEWORKNAME as n,createElement as p,isReact as s,isSolid as a}from"../process-env.js";import m from"../reactive-object.js";export const docsModuleName="@app/docs";export const docs=new m({[docsModuleName]:"export default {}"});export const comment=new m({});let l={},c=`import { ${p}${a?",Dynamic":""} } from "${n}${a?"/web":""}";import SuspenseComp from "@app/suspense";function call_then(res) {return {default: ${s?"() =>":""}${p}(${a?"Dynamic":"'n-md'"}, {text: res.default, ${a?"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;}' })};}`;comment.on("change",(e,t)=>{!function(e,t){let[o,r]=e.replace(/^@app\/comment\//,"").split("/");if(l[o]||(l[o]={}),t)l[o][r]&&delete l[o][r];else{let e=`@app/comment/${o}/${r}`;l[o][r]=`rr(() => ${p}(SuspenseComp, { comp: () => import(/* webpackChunkName: '${e}' */ '${e}?raw').then(call_then)}))rr`}let n={};for(let e in l)Object.prototype.hasOwnProperty.call(l,e)&&(n[e]=Object.values(l[e]));docs.setData(docsModuleName,`${c}export default ${JSON.stringify(n).replace(/"rr\((.+?)\)rr"/g,"$1")}`)}(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))});
|
package/lib/vm/example.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import ReactiveObject from '../reactive-object.js';
|
|
2
2
|
export declare const exampleModuleName = "@app/example";
|
|
3
|
-
export declare const examples: ReactiveObject<Record<string, string
|
|
3
|
+
export declare const examples: ReactiveObject<Record<string, string>>;
|
|
4
|
+
export declare function generatorDemo(): void;
|
package/lib/vm/example.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{generateExample as e}from"@moneko/mdx";import{watchFiles as o}from"./utils.js";import t from"../paths.js";import{isDev as r,isLibrary as p}from"../process-env.js";import m from"../reactive-object.js";export const exampleModuleName="@app/example";function a(){try{return JSON.parse(e(t.componentsPath,"@app/example/"))}catch(e){return{}}}export const examples=new m(a());export function generatorDemo(){let e=a();for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&examples.setData(o,e[o])}p&&r&&o(t.componentsPath,/(?<!\/examples\/(.+)\.md)$/,generatorDemo);
|
package/lib/vm/routes.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { type BaseRoute } from './utils.js';
|
|
2
1
|
import ReactiveObject from '../reactive-object.js';
|
|
3
2
|
export declare const routesModuleName = "@app/routes";
|
|
4
3
|
export declare const route: ReactiveObject<{
|
|
5
4
|
"@app/routes": string;
|
|
6
5
|
}>;
|
|
7
|
-
export declare
|
|
6
|
+
export declare function generatorRouter(): void;
|
package/lib/vm/routes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generateRouter as
|
|
1
|
+
import{generateRouter as o}from"@moneko/mdx";import{watchFiles as e}from"./utils.js";import{CONFIG as t}from"../config.js";import r from"../paths.js";import{FRAMEWORK as s,isDev as m,isLibrary as n}from"../process-env.js";import p from"../reactive-object.js";let a=n?r.componentsPath:r.pagesPath,u=n?"@pkg":"@/pages";export const routesModuleName="@app/routes";function i(){return o(a,`${t.alias["@"]}/router/index.ts`,s,u,n)}export const route=new p({[routesModuleName]:i()});export function generatorRouter(){route.setData(routesModuleName,i())}m&&e(a,n?/(?<!README\.mdx?)$/:/(?<!index\.tsx?)$/,generatorRouter);
|
package/lib/vm/utils.d.ts
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
path: string;
|
|
3
|
-
key: string;
|
|
4
|
-
component?: string;
|
|
5
|
-
meta?: object;
|
|
6
|
-
children?: BaseRoute[];
|
|
7
|
-
codes?: Record<string, string>;
|
|
8
|
-
order?: number;
|
|
9
|
-
};
|
|
10
|
-
export declare function mergeRouter(route: BaseRoute[], key: keyof BaseRoute): BaseRoute[] | undefined;
|
|
11
|
-
type TreeOption = {
|
|
12
|
-
files: string[];
|
|
13
|
-
base: string;
|
|
14
|
-
alia?: string;
|
|
15
|
-
outputSource?: boolean;
|
|
16
|
-
};
|
|
17
|
-
export declare function getTree(opt: TreeOption): BaseRoute[];
|
|
18
|
-
export declare function watchFiles(root: string, ignored: RegExp, call: (files: string[]) => void, files?: string[]): void;
|
|
19
|
-
export {};
|
|
1
|
+
export declare function watchFiles(root: string, ignored: RegExp, call: VoidFunction): void;
|
package/lib/vm/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{watch as n}from"chokidar";export function watchFiles(o,i,t){let e=n(o,{ignored:(n,o)=>{if(o)return!o.isDirectory()&&i.test(n)},persistent:!0,ignoreInitial:!0});e.on("add",t).on("change",t).on("unlink",t),process.on("SIGINT",function(){e.unwatch(o),e.close()})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.9.1
|
|
3
|
+
"version": "3.9.1",
|
|
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.16",
|
|
17
17
|
"@swc/core": "1.3.100",
|
|
18
18
|
"@swc/css": "0.0.28",
|
|
19
19
|
"@swc/helpers": "0.5.3",
|
package/lib/vm/mdx-scope.d.ts
DELETED
package/lib/vm/mdx-scope.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;
|