@moneko/core 3.0.0-beta.6 → 3.0.0-beta.61
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 +1 -0
- package/{build → lib}/common.d.ts +1 -1
- package/lib/common.js +12 -0
- package/{build → lib}/coverage.d.ts +1 -1
- package/{build → lib}/done.d.ts +2 -7
- package/lib/done.js +1 -0
- package/lib/envFlags.js +1 -0
- package/lib/esm.d.ts +1 -0
- package/lib/esm.js +1 -0
- package/lib/generate-api.d.ts +1 -0
- package/lib/generate-api.js +1 -0
- package/{build → lib}/html-plugin-option.d.ts +1 -1
- package/lib/html-plugin-option.js +1 -0
- package/lib/index.d.ts +4 -36
- package/lib/index.js +1 -1
- package/lib/module-federation.d.ts +5 -0
- package/lib/module-federation.js +1 -0
- package/lib/module.config.js +1 -0
- package/{build → lib}/process-env.d.ts +10 -3
- package/lib/process-env.js +1 -0
- package/{build → lib}/resolver-sync.d.ts +2 -1
- package/lib/resolver-sync.js +1 -0
- package/lib/routes.d.ts +1 -0
- package/lib/routes.js +1 -0
- package/lib/seo.js +1 -0
- package/lib/swcrc.js +1 -0
- package/lib/tsloader.config.js +1 -0
- package/{build → lib}/utils.d.ts +4 -3
- package/lib/utils.js +1 -0
- package/{build → lib}/webpack.common.d.ts +4 -0
- package/lib/webpack.common.js +1 -0
- package/lib/webpack.dev.js +4 -0
- package/lib/webpack.prod.d.ts +3 -0
- package/lib/webpack.prod.js +1 -0
- package/package.json +22 -32
- package/typings/global.d.ts +37 -18
- package/build/common.js +0 -12
- package/build/done.js +0 -1
- package/build/envFlags.js +0 -1
- package/build/html-plugin-option.js +0 -1
- package/build/index.d.ts +0 -2
- package/build/index.js +0 -1
- package/build/module-federation.d.ts +0 -4
- package/build/module-federation.js +0 -1
- package/build/module.config.js +0 -1
- package/build/process-env.js +0 -1
- package/build/resolver-sync.js +0 -1
- package/build/seo.js +0 -1
- package/build/swcrc.js +0 -1
- package/build/tsloader.config.js +0 -1
- package/build/utils.js +0 -1
- package/build/webpack.common.js +0 -1
- package/build/webpack.dev.js +0 -4
- package/build/webpack.prod.d.ts +0 -3
- package/build/webpack.prod.js +0 -1
- package/lib/normalize.css +0 -254
- package/lib/packages/library/bootstrap.js +0 -1
- package/lib/packages/library/index.d.ts +0 -4
- package/lib/packages/library/index.js +0 -1
- package/lib/refresh-rem.d.ts +0 -0
- package/lib/refresh-rem.js +0 -1
- package/lib/router/index.d.ts +0 -51
- package/lib/router/index.js +0 -1
- /package/lib/{packages/library/bootstrap.d.ts → cleanup.d.ts} +0 -0
- /package/{build → lib}/coverage.js +0 -0
- /package/{build → lib}/envFlags.d.ts +0 -0
- /package/{build → lib}/has-pkg.d.ts +0 -0
- /package/{build → lib}/has-pkg.js +0 -0
- /package/{build → lib}/html-add-entry-attr.d.ts +0 -0
- /package/{build → lib}/html-add-entry-attr.js +0 -0
- /package/{build → lib}/minify.d.ts +0 -0
- /package/{build → lib}/minify.js +0 -0
- /package/{build → lib}/modifyVars.d.ts +0 -0
- /package/{build → lib}/modifyVars.js +0 -0
- /package/{build → lib}/module.config.d.ts +0 -0
- /package/{build → lib}/seo.d.ts +0 -0
- /package/{build → lib}/swcrc.d.ts +0 -0
- /package/{build → lib}/tsloader.config.d.ts +0 -0
- /package/{build → lib}/webpack.dev.d.ts +0 -0
- /package/{build → lib}/yarn-argv.d.ts +0 -0
- /package/{build → lib}/yarn-argv.js +0 -0
package/lib/cleanup.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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 type { AppType, ConfigType } from '../typings/global.
|
|
1
|
+
import type { AppType, ConfigType } from '../typings/global.js';
|
|
2
2
|
export declare const ENTRYPATH: Record<AppType, string>;
|
|
3
3
|
export declare const log: (msg: string) => void;
|
|
4
4
|
export declare const CONFIG: ConfigType<"swc">;
|
package/lib/common.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import e from"fs";import t from"path";import o from"readline";import s from"chalk";import{merge as i}from"webpack-merge";import{APPTYPE as n,CUSTOMCONFIG as r,FRAMEWORK as l,jsxImportSource as a,pkgName as c,PROGRAMPATH as m}from"./process-env.js";import{isFunction as p,readConf as u}from"./utils.js";export const ENTRYPATH={mobile:"mobile",site:"site","back-stage":"back-stage","single-spa":"single-spa",library:"library","single-component":"single-component"};let d=[`@moneko/${l}`,"neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design"],h={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"}}};"single-component"===n&&(h=!1);let g={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:{analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1},entry:{},minifier:{js:{},css:{}},sourceMap:{filename:"[file].map",publicPath:""},env:{},routeBaseName:"/",publicPath:"/",designSize:"mobile"===n?375:1680,fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{},layoutSider:{},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:m+"/node_modules/.temp_cache",devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`./node_modules/${c}/template/index.html`,favicon:`./node_modules/${c}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],splitChunk:h,runtimeChunk:"single-component"!==n&&"single",moduleFederation:[],rulesInclude:{less:d,css:d,js:d,media:d,fonts:d},mdx:{jsxImportSource:a,useDynamicImport:!0,remarkPlugins:[],rehypePlugins:[]},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:"编译中",color:"#6f42c1"}};export const log=e=>{o.cursorTo(process.stdout,0),process.stdout.write(e)};let f=g,y=null,x={},b={};try{y=t.join(m,"./config/index.ts"),e.accessSync(y,e.constants.R_OK)}catch(e){y=null}if(y)try{let e=(await u(y,"index")).default;x=p(e)?e(process):e}catch(e){process.stdout.write(s.red(e))}if(r){let o=null;try{o=t.join(m,`./config/${r}.ts`),e.accessSync(o,e.constants.R_OK)}catch(e){o=null}if(null!==o)try{let e=(await u(o,r)).default;b=p(e)?e(process):e}catch(e){process.stdout.write(s.red(e))}}"tsc"===(f=i(f,x,b)).compiler&&f.minifier&&(f.minifier.js||Object.assign(f.minifier,{js:{type:"terser"}}),f.minifier.css||Object.assign(f.minifier,{css:{type:"cssnano"}})),!1===f.devtool&&(f.sourceMap=!1),!1===f.sourceMap&&(f.devtool=!1),f.fixBrowserRouter&&f.htmlPluginOption&&(f.htmlPluginOption.tags||(f.htmlPluginOption.tags=[]),f.htmlPluginOption.tags.push({textContent:`
|
|
2
|
+
(function(l) {
|
|
3
|
+
if (l.search[1] === '/' ) {
|
|
4
|
+
var decoded = l.search.slice(1).split('&').map(function(s) {
|
|
5
|
+
return s.replace(/~and~/g, '&')
|
|
6
|
+
}).join('?');
|
|
7
|
+
window.history.replaceState(null, null,
|
|
8
|
+
l.pathname.slice(0, -1) + decoded + l.hash
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
}(window.location))
|
|
12
|
+
`}));export const CONFIG=f;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,log};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CoverageType, ProjectCoverageType } from '../typings/global.
|
|
1
|
+
import type { CoverageType, ProjectCoverageType } from '../typings/global.js';
|
|
2
2
|
export declare const coverage: Record<string, CoverageType & Partial<ProjectCoverageType>>;
|
package/{build → lib}/done.d.ts
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Compiler } from 'webpack';
|
|
1
2
|
declare class DoneWebpackPlugin {
|
|
2
3
|
options: {
|
|
3
4
|
done?: () => void;
|
|
@@ -5,12 +6,6 @@ declare class DoneWebpackPlugin {
|
|
|
5
6
|
constructor(options: {
|
|
6
7
|
done?: () => void;
|
|
7
8
|
});
|
|
8
|
-
apply(compiler:
|
|
9
|
-
hooks: {
|
|
10
|
-
done: {
|
|
11
|
-
tap: (arg0: string, arg1: () => void) => void;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
}): void;
|
|
9
|
+
apply(compiler: Compiler): void;
|
|
15
10
|
}
|
|
16
11
|
export default DoneWebpackPlugin;
|
package/lib/done.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default class{constructor(o){this.options=Object.assign({},o)}apply(o){o.hooks.done.tap("DoneWebpackPlugin",()=>{this.options.done?.()})}};
|
package/lib/envFlags.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import i from"fs";import r from"path";import{CONFIG as t}from"./common.js";import{coverage as e}from"./coverage.js";import o from"./html-plugin-option.js";import{APPTYPE as s,NODE_ENV as n,PACKAGENAME as f,programInfo as a,PROGRAMPATH as c,hasAntd as m}from"./process-env.js";import{toUpperCaseString as p}from"./utils.js";let l="library"===s?"site":"src",g=!1;try{let t=r.join(c,"./src/index.ts");i.accessSync(t,i.constants.R_OK),g=t}catch(i){g=!1}let y={projectName:JSON.stringify(p(f)),projectCoverage:JSON.stringify(e),providerConfig:JSON.stringify({prefixCls:t.prefixCls,iconPrefixCls:t.prefixCls+"-icon",theme:t.theme}),fallbackCompPath:JSON.stringify(t.fallbackCompPath),ReactDOMPath:JSON.stringify("react-dom/client"),favicon:JSON.stringify(o.favicon),hasLocales:JSON.stringify(i.existsSync(r.join(c,`./${l}/locales`))),hasPersist:JSON.stringify(i.existsSync(r.join(c,`./${l}/persist.ts`))),layoutSider:JSON.stringify(t.layoutSider),hasAntd:JSON.stringify(m),APPTYPE:JSON.stringify(s),APPENTRY:JSON.stringify(g),programInfo:JSON.stringify({...a,routeBaseName:t.routeBaseName,designSize:t.designSize,routerMode:t.routerMode,renderMode:t.mode}),"process.env":JSON.stringify({NODE_ENV:n,iconfont:t.iconfont,...t.env})};export default y;
|
package/lib/esm.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function esm(templateStrings: TemplateStringsArray, ...substitutions: unknown[]): string;
|
package/lib/esm.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function t(t,...e){let r=t.raw[0];for(let a=0;a<e.length;a++)r+=e[a]+t.raw[a+1];return`data:text/javascript;base64,${Buffer.from(r).toString("base64")}`}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e;import{existsSync as t,mkdirSync as n,readFile as r,readFileSync as l,statSync as o,writeFile as i,unlink as c}from"fs";import{join as s,dirname as u}from"path";import{watch as a}from"chokidar";import f from"typescript";import{CONFIG as p}from"./common.js";import{APPTYPE as m,apiCacheDir as g,frameworkCacheDir as $}from"./process-env.js";import{resolveProgramPath as d}from"./utils.js";import{alias as b}from"./webpack.common.js";let{ScriptKind:x,ScriptTarget:y,SyntaxKind:h,createSourceFile:k,forEachChild:j,getLeadingCommentRanges:F,isInterfaceDeclaration:S,isQuestionToken:T,isPropertySignature:B,isFunctionTypeNode:C,isUnionTypeNode:N}=f,O={};function w(e){let t=F(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 A(e){if(!e)return null;let t=e.match(/@since\s+([^\n]+)/);return t?t[1].trim():null}let D=/(?<!['"])(unknown|any|void|bigint|object|undefined|null|boolean|number|string|symbol)(?!['"])/g;function E(e,t){if(!e)return null;let n=e.replace(/\b([A-Z][a-zA-Z0-9]*)\b/g,e=>{if(O[e]){let n="/"+[p.routeBaseName,O[e]].join("/").split("/").filter(Boolean).join("/");return t?`[\\color{#4ec9b0}{${e}}](${n})`:`[${e}](${n})`}return t?`\\color{#4ec9b0}{${e}}`:e});return t&&(n=n.replace(D,e=>`\\color{#4ec9b0}{${e}}`)),n}function _(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}")||"-"}let v=["#9C27B0","#673AB7","#3F51B5","#2196F3","#00BCD4","#009688","#4CAF50","#CDDC39","#FF9800","#795548"];function I(e){return e?e.replace(/^@default\s*.*$/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 K(){}let q={},z={};function L(o,a){t($)||n($),t(g)||n(g);let p=o.replace(RegExp(`^${b["@pkg"]}`),""),m=u(p).replace(/^\//,""),d=s(g,m),F=p.split("/").pop()?.replace(/\.tsx?/,".md");if(!F)return;q[m]||(q[m]=[]);let D=q[m].indexOf(F),L=s(d,F);if("deleted"===a)delete z[L],c(L,K),-1!==D&&q[m].splice(D,1);else{let e=function(e){let t=l(e,"utf-8"),n=k(e,t,y.Latest,!0,x.TS),r="";return j(n,e=>{S(e)?r+=function(e){let t=e.name.text;Object.assign(O,{[e.name.text]:u(e.getSourceFile().fileName).replace(b["@pkg"],"")});let n=w(e),r=A(n),l=I(n),o=l?`\\color{|4||0.45}{${t}}`:t,i=(function(e){let t=[];if(e.heritageClauses){for(let n of e.heritageClauses)if(n.token===f.SyntaxKind.ExtendsKeyword)for(let e of n.types)t.push(e.getText())}return t})(e)?.map((e,t)=>`<n-tag color="${v[t]}" css=".tag{gap:0px;}">${E(e)}</n-tag>`),c=[l,o,r&&`\\color{#52c11b|1||0.9}{${r}}`,i.length>0&&`<sub>\`extends\`</sub> ${i.join(" ")}`].filter(Boolean).join(" "),s=`## ${c}`;for(let t of(s+="\n| 属性 | 必要 | 说明 | 类型 | 默认值 | 版本 |\n| :- | :-: | :- | :- | :- | :- |",e.members))if(B(t)&&t.type?.kind!==h.NeverKeyword){let e=_(t.name.getText()),n=t.questionToken&&T(t.questionToken),r=w(t),l=_(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(r)),o=_(A(r)),i=E(_(t.type?.getText()),!0),c=_(I(r)),u=`\\color{${n?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${n?"✘":"✔"}}`,a=function(e){if(e.type){if(!N(e.type))return C(e.type);for(let t of e.type.types)if(C(t))return!0}return!1}(t)||i?.includes("=>");s+="\n",e.startsWith("\\color")||(a?e=`\\color{#f9a913}{${e}}`:/^("|')(.+)("|')$/.test(e)||(e=`\\color{#4c81db}{${e}}`)),s+=`| ${e} | ${u} | ${c} | ${i} | ${l} | ${o} |`}return s+"\n\n"}(e):f.isEnumDeclaration(e)&&(r+=function(e){let t=e.name.text;Object.assign(O,{[e.name.text]:u(e.getSourceFile().fileName).replace(b["@pkg"],"")});let n=`## ${t}`;for(let t of(n+="\n| 属性 | 说明 | 值 | 版本 |\n| -- | -- | -- | -- |",e.members)){let e=_(t.name.getText()),r=w(t),l=_(function(e){let t=e.initializer;return t&&f.isStringLiteral(t)?` '${t.text}'`:null}(t)),o=_(A(r)),i=_(I(r));n+="\n",e.startsWith("\\color")||/^("|')(.+)("|')$/.test(e)||(e=`\\color{#4c81db}{${e}}`),n+=`| ${e} | ${i} | ${l} | ${o} |`}return n+"\n\n"}(e))}),r}(o);if(e){let l=z[L];l?l!==e&&(t(d)||n(d),i(L,e,"utf-8",K)):r(L,{encoding:"utf-8"},(r,l)=>{(r||l!==e)&&(z[L]=l,t(d)||n(d),i(L,e,"utf-8",K))}),-1===D&&q[m].push(F)}else delete z[L],c(L,K),-1!==D&&q[m].splice(D,1)}let W=`export default ${JSON.stringify(q)};`;e!==W&&(e=W,i(s(g,"index.js"),W,"utf-8",K))}"library"===m&&function(){let e=[],t=a(d("components"),{ignored:[/(^|[\\/\\])\../,/(^|[\\/\\])__tests__([\\/\\]|$)/],persistent:!0,ignoreInitial:!1});function n(e){return/\.tsx?$/.test(e)&&o(e).isFile()}t.on("add",t=>{n(t)&&(L(t,"added"),e.push(t))}),t.on("change",e=>{n(e)&&L(e,"change")}),t.on("unlink",t=>{n(t)&&(L(t,"deleted"),e.splice(e.indexOf(t),1))}),t.on("ready",()=>{e.forEach(e=>{L(e,"change")})}),process.on("SIGINT",function(){t.close()})}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"path";import{merge as t}from"webpack-merge";import{CONFIG as i}from"./common.js";import{PROGRAMPATH as o,PACKAGENAME as a,programInfo as m,pkgName as p}from"./process-env.js";let{template:r,favicon:n,...l}=i.htmlPluginOption||{template:`./node_modules/${p}/template/index.html`,favicon:`./node_modules/${p}/template/favicon.ico`},s=t({title:i.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:m.description||""},tags:[],template:e.join(o,r),favicon:e.join(o,n)},l);export default s;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,36 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export type PartialCommomType<T = 'swc'> = Partial<CommomType<T>>;
|
|
6
|
-
/** 一些项目基本信息 */
|
|
7
|
-
export declare const projectBasicInfo: {
|
|
8
|
-
projectName: string;
|
|
9
|
-
providerConfig: {
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
prefixCls: string;
|
|
12
|
-
iconPrefixCls: string;
|
|
13
|
-
input: React.InputHTMLAttributes<HTMLInputElement>;
|
|
14
|
-
};
|
|
15
|
-
programInfo: {
|
|
16
|
-
name: string;
|
|
17
|
-
description: string;
|
|
18
|
-
version: string;
|
|
19
|
-
type: "mobile" | "site" | "back-stage" | "single-spa" | "library";
|
|
20
|
-
author: {
|
|
21
|
-
name: string;
|
|
22
|
-
url?: string | undefined;
|
|
23
|
-
email?: string | undefined;
|
|
24
|
-
};
|
|
25
|
-
repository: {
|
|
26
|
-
type?: string | undefined;
|
|
27
|
-
url?: string | undefined;
|
|
28
|
-
directory?: string | undefined;
|
|
29
|
-
};
|
|
30
|
-
routerMode: "hash" | "browser" | "memory";
|
|
31
|
-
routeBaseName: string;
|
|
32
|
-
designSize: number;
|
|
33
|
-
renderMode: "ssr" | "csr";
|
|
34
|
-
};
|
|
35
|
-
coverage: Record<string, CoverageType & Partial<ProjectCoverageType>>;
|
|
36
|
-
};
|
|
1
|
+
export * from './process-env.js';
|
|
2
|
+
export * from './utils.js';
|
|
3
|
+
export * from '../typings/global.js';
|
|
4
|
+
export { default as envFlags } from './envFlags.js';
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export*from"./process-env.js";export*from"./utils.js";export*from"../typings/global.js";export{default as envFlags}from"./envFlags.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import webpack from 'webpack';
|
|
2
|
+
import ModuleFederationPlugin from 'webpack/lib/container/ModuleFederationPlugin.js';
|
|
3
|
+
declare const NormalModuleReplacementPlugin: typeof webpack.NormalModuleReplacementPlugin;
|
|
4
|
+
export declare const moduleFederation: (typeof ModuleFederationPlugin | typeof NormalModuleReplacementPlugin)[];
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"external-remotes-plugin";import r from"webpack";import t from"webpack/lib/container/ModuleFederationPlugin.js";import{CONFIG as o}from"./common.js";import{resolve as l}from"./utils.js";let a=r.NormalModuleReplacementPlugin,i={},m={},n={};export const moduleFederation=o.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,l=t.filename||"remote_entry.js";if(n[o]=`${t.name}@${t.host}/${l}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)i[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?m[`./${t}`]=l(t):"[object Object]"===Object.prototype.toString.call(t)&&(m[`./${t.name}`]=l(t.path))}return new t({filename:"remote_entry.js",...e,remotes:n,exposes:m})});moduleFederation.length&&(moduleFederation.push(new e),moduleFederation.push(new a(/(.*)/,e=>{i[e.request]&&(e.request=i[e.request])})));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as o,PUBLICPATH as t}from"./common.js";import{hasPkg as l}from"./has-pkg.js";import r from"./modifyVars.js";import{APPTYPE as a,DEV as i,FRAMEWORK as n}from"./process-env.js";import c from"./swcrc.js";import m from"./tsloader.config.js";import{resolveNodeModulesPath as p,resolveProgramPath as d}from"./utils.js";let u="single-spa"===a?t:"../",f={loader:e.loader,options:{publicPath:"/"!==u?u:"../"}},y=l("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:await import("@moneko/postcss")}};i&&(f="style-loader");let x=[...o.cssModules,`@moneko/${n}`,"neko-ui"].map(p),g=[...["src/styles/variables/*.less","src/styles/mixins/*.less","site/styles/variables/*.less","site/styles/mixins/*.less"].map(d)],$=["components","example","mock","site","src"].map(d),j=[f,{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=x.length;s<o;s++)if(e&&e?.includes(x[s]))return/(.*(?<!\.global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},y,"css-unicode-loader",{loader:"less-loader",options:{sourceMap:!!o.sourceMap,lessOptions:{modifyVars:r,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:g}}].filter(Boolean),b={loader:"tsc"===o.compiler?"ts-loader":"swc-loader",options:"tsc"===o.compiler?m:c(i)},v={rules:[{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{resourceQuery:/\.wasm$/,type:"webassembly/async"},{test:/\.less$/,use:j,include:$.concat(o.rulesInclude?.less?.map(p)||[])},{test:/\.css$/,use:[f,"css-loader",y,"css-unicode-loader"].filter(Boolean),include:$.concat(o.rulesInclude?.css?.map(p)||[])},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",generator:{filename:"assets/images/[name][ext][query]"},include:$.concat(o.rulesInclude?.media?.map(p)||[])},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:$.concat(o.rulesInclude?.fonts?.map(p)||[])},{test:/\.svg$/,type:"asset/inline",generator:{dataUrl:e=>s("string"!=typeof e?e.toString():e)}},{test:/\.txt$/,type:"asset/source"},{test:/\.(cj|mj|t|j)s(|x)$/,use:[...o.prefixJsLoader,b].filter(Boolean),include:$.concat(o.rulesInclude?.js?.map(p)||[])},{test:/\.mdx?$/,use:[...o.prefixJsLoader,b,{loader:"@mdx-js/loader",options:o.mdx}].filter(Boolean),include:$,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...o.moduleRules]};export default v;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import type { AppType } from '../typings/global.
|
|
1
|
+
import type { AppType, Framework } from '../typings/global.js';
|
|
2
|
+
export declare const __dirname: string;
|
|
2
3
|
export declare const APPTYPE: AppType;
|
|
4
|
+
export declare const FRAMEWORK: Framework;
|
|
5
|
+
export declare const isReact: boolean;
|
|
6
|
+
export declare const isSolid: boolean;
|
|
7
|
+
export declare const jsxImportSource: string;
|
|
3
8
|
export declare const PROGRAMPATH: string;
|
|
4
9
|
export declare const PACKAGENAME: string;
|
|
5
10
|
export declare const PACKAGEVERSION: string;
|
|
6
11
|
export declare const pkgName: string;
|
|
12
|
+
export declare const DEV: boolean;
|
|
13
|
+
export declare const frameworkCacheDir: ".git/" | `node_modules/.cache/${string}`;
|
|
14
|
+
export declare const apiCacheDir: string;
|
|
15
|
+
export declare const cacheDir: string;
|
|
7
16
|
export declare const NODE_ENV: string | undefined;
|
|
8
17
|
export declare const CUSTOMCONFIG: string | undefined;
|
|
9
|
-
export declare const DEV: boolean;
|
|
10
18
|
export declare let hasEslintConfig: boolean;
|
|
11
19
|
export declare let hasStylelintConfig: boolean;
|
|
12
|
-
export declare const hasReact: boolean;
|
|
13
20
|
export declare const hasAntd: boolean;
|
|
14
21
|
export declare const programInfo: {
|
|
15
22
|
name: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readFileSync as e,existsSync as o,mkdirSync as r}from"fs";import{join as t}from"path";import s from"url";import{hasPkg as n}from"./has-pkg.js";import{resolveProgramPath as p}from"./utils.js";import c from"./yarn-argv.js";export const __dirname=s.fileURLToPath(new URL(".",import.meta.url));export const APPTYPE=process.env.APPTYPE;export const FRAMEWORK=process.env.FRAMEWORK;export const isReact="react"===FRAMEWORK;export const isSolid="solid-js"===FRAMEWORK;export const jsxImportSource={react:"react","solid-js":"solid-js/h"}[FRAMEWORK];export const PROGRAMPATH=process.cwd();export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;let a=e(t(__dirname,"../package.json"),{encoding:"utf-8"});export const pkgName=JSON.parse(a).name;export const DEV="development"===process.env.NODE_ENV;export const frameworkCacheDir=p(DEV?".git/":`node_modules/.cache/${PACKAGENAME}`);export const apiCacheDir=t(frameworkCacheDir,"./apis");export const cacheDir=t(PROGRAMPATH,"./node_modules/.cache/@moneko/cli/");o(cacheDir)||r(cacheDir,{recursive:!0});export const NODE_ENV=process.env.NODE_ENV;export const CUSTOMCONFIG=process.env.npm_config_config||c.config;export let hasEslintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_eslintConfig_")).length;export let hasStylelintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_stylelint_")).length;export const hasAntd=n("antd");export const programInfo={name:PACKAGENAME,version:PACKAGEVERSION,type:APPTYPE,description:process.env.npm_package_description,author:{name:process.env.npm_package_author_name,email:process.env.npm_package_author_email,url:process.env.npm_package_author_url},repository:{type:process.env.npm_package_repository_type,url:process.env.npm_package_repository_url,directory:process.env.npm_package_repository_directory}};if(parseInt(process.versions.node)>14){let o=e(p("package.json"),{encoding:"utf-8"}),{description:r,author:t,repository:s,eslintConfig:n,stylelint:c}=JSON.parse(o);programInfo.author="string"==typeof t?{name:t}:t,programInfo.repository="string"==typeof t?{url:s}:s,programInfo.description=r,hasEslintConfig=!!n,hasStylelintConfig=!!c}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import enhancedResolve from 'enhanced-resolve';
|
|
1
2
|
/**
|
|
2
3
|
* @examples
|
|
3
4
|
* ```javascript
|
|
@@ -5,5 +6,5 @@
|
|
|
5
6
|
* resolverSync.resolveSync({}, process.cwd(), "react")
|
|
6
7
|
* ```
|
|
7
8
|
*/
|
|
8
|
-
declare const resolverSync:
|
|
9
|
+
declare const resolverSync: enhancedResolve.Resolver;
|
|
9
10
|
export default resolverSync;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"fs";import s from"enhanced-resolve";let{CachedInputFileSystem:o,ResolverFactory:n}=s,m=n.createResolver({fileSystem:new o(e,4e3),conditionNames:["node"],extensions:[".js",".json",".node"],useSyncFileSystemCalls:!0,mainFields:["esm","module","main"]});export default m;
|
package/lib/routes.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/routes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e,t;import{readdirSync as r,statSync as o,writeFile as n,readFileSync as s,existsSync as i,mkdirSync as l}from"fs";import{join as c,relative as m}from"path";import{watch as p}from"chokidar";import{load as a}from"js-yaml";import{PROGRAMPATH as u,APPTYPE as f,FRAMEWORK as d,DEV as g,frameworkCacheDir as h}from"./process-env.js";let $=/^---\n([\s\S]+?)\n---\n/;function j(e,t){let{regex:n,alia:i,base:l=e,outputSource:p}=t,u=r(e);return u.reduce((r,u)=>{let f=c(e,u),d=o(f);if(d.isDirectory()){let e=j(f,{...t,base:l});if(e.length>0){let t={},o={path:u,key:m(l,f)};if(p)Object.assign(t,{children:e});else{let r=e.splice(0,1)[0];e.length?Object.assign(t,{children:[{...r,path:"/",key:o.key},...e]}):Object.assign(t,r)}r.push(Object.assign(t,o))}}else if(n.test(f)){let e=s(f,{encoding:"utf-8"}),t=function(e){let t=e.match($);return t&&t[1]?t[1].trim():null}(e),o=t?a(t):{},n=m(l,f);r.push(Object.assign({path:u,key:n,meta:{...o}},i&&{component:`rr(() => import(/* webpackChunkName: '${n}' */'${c(i,n)}'))rr`},p&&{codes:function(e){let t;let r={},o=/```(.+?)\n([\s\S]*?)\n```/g;for(;null!==(t=o.exec(e));){let[,e="jsx",o]=t,n=e.split(" ").pop()||"jsx";r[n]=o.trim()}return Object.keys(r).length?r:{jsx:e}}(e.replace($,"").replace(/^\n+|\n+$/g,""))}))}return r},[])}let x=c(u,"./components");function k(e){if(e)throw e}function y(){e&&clearTimeout(e),e=setTimeout(()=>{let e={react:"createElement","solid-js":"createComponent"}[d],t=`() => ${e}(SuspenseComp, { comp: $1 })`,r=`import { ${e} } from "${d}";import { SuspenseComp } from "@moneko/${d}";`;["react","solid-js"].includes(d)||(t="$1",r="");let o=JSON.stringify(j(x,{regex:/README\.mdx?$/,alia:"@pkg"})).replace(/"rr\((.+?)\)rr"/g,t);i(h)||l(h),n(c(h,"route.js"),`${r}export default ${o}`,"utf-8",k)},100)}function b(){t&&clearTimeout(t),i(h)||l(h),t=setTimeout(()=>{let e=Object.fromEntries(j(x,{regex:/\/examples\/(.+)\.md$/,outputSource:!0}).map(e=>[e.key,e.children?.[0].children?.filter(e=>e.codes)?.map(e=>({title:e.path.replace(/.md$/,""),order:0,...e.meta,codes:e.codes})).sort((e,t)=>e.order-t.order)]));n(c(h,"example.js"),`export default ${JSON.stringify(e)}`,"utf-8",k)},100)}function O(e,t,r){let o=p(e,{ignored:(e,r)=>{if(r)return!r?.isDirectory()&&t.test(e)},persistent:!0});o.on("add",()=>{r()}).on("change",()=>{r()}).on("unlink",()=>{r()}),process.on("SIGINT",function(){o.close()})}"library"===f&&(g?(O(x,/(?<!README\.mdx?)$/,y),O(x,/(?<!\/examples\/(.+)\.md)$/,b)):(y(),b()));
|
package/lib/seo.js
ADDED
|
@@ -0,0 +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 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)};
|
package/lib/swcrc.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./common.js";import r from"./envFlags.js";import{isReact as s,isSolid as t,jsxImportSource as n}from"./process-env.js";let a={env:{targets:["last 2 version","> 0.5%","ie 11","not dead"],mode:"entry",coreJs:"3"}};export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default((c=!1)=>{let l={module:{type:"es6",ignoreDynamic:!0,strict:!0,strictMode:!0,lazy:!0,noInterop:!0},jsc:{parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:s&&c,development:c,importSource:n},constModules:{globals:{"env-flags":r}},optimizer:{simplify:!1}},experimental:{plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),s=r.length;o<s;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})],t&&["@moneko/jsx-dom-expressions",o.jsxDomExpressions||{}]].filter(Boolean)}},sourceMaps:!0,parseMap:!0},i=Object.assign(l,!c&&a);return o.swcrc&&(i=e(i,"function"==typeof o.swcrc?o.swcrc(c):o.swcrc)),i});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"fs";import r from"ts-import-plugin";import o from"webpack-merge";import{CONFIG as e}from"./common.js";import{isFunction as m,resolveProgramPath as s,readConf as a}from"./utils.js";let i=[];Array.isArray(e.importOnDemand)&&Object.assign(i,e.importOnDemand.map(t=>r(t)));let n=[...i],p={transpileOnly:!0,getCustomTransformers:()=>({before:n})};try{let r=s("tsloader.config.ts");t.accessSync(r,t.constants.R_OK);let e=(await a(r,"tsloader.config")).default;p=o(p,m(e)?e(process):e)}catch(t){}export default p;
|
package/{build → lib}/utils.d.ts
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function tfc(filepath: string): string;
|
|
2
|
+
export declare function readConf(src: string, name: string): Promise<any>;
|
|
2
3
|
export declare function toUpperCaseString(string: string): string;
|
|
3
4
|
export declare function getIPAdress(): string | undefined | void;
|
|
4
|
-
type ProgramPath<T extends string> =
|
|
5
|
+
type ProgramPath<T extends string> = `${T extends string ? T : string}`;
|
|
5
6
|
type NodeModulesPath<T> = ProgramPath<`node_modules/${T extends string ? T : string}`>;
|
|
6
7
|
/** 位于项目根目录下的位置
|
|
7
8
|
* @param {string} src 路径
|
|
@@ -12,7 +13,7 @@ export declare function resolveProgramPath<T extends string>(src: T): ProgramPat
|
|
|
12
13
|
* @param {string} src 路径
|
|
13
14
|
* @returns {string} 位于项目根目录node_modules下的位置
|
|
14
15
|
*/
|
|
15
|
-
export declare const resolveNodeModulesPath: <T extends string>(src: T) =>
|
|
16
|
+
export declare const resolveNodeModulesPath: <T extends string>(src: T) => `${`node_modules/${T extends string ? T : string}` extends infer T_1 ? T_1 extends `node_modules/${T extends string ? T : string}` ? T_1 extends string ? T_1 : string : never : never}`;
|
|
16
17
|
/** 获取模块真实入口位置
|
|
17
18
|
* @param {string} url 路径
|
|
18
19
|
* @returns {string} 模块真实入口路径
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as e}from"fs";import{networkInterfaces as t}from"os";import r from"path";import{transformFileSync as o}from"@swc/core";import{cacheDir as n}from"./process-env.js";import s from"./resolver-sync.js";let c={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function tfc(e){return o(e,c).code||"{}"}export function readConf(t,o){let s=r.join(n,`${o}.mjs`);return e(s,tfc(t),"utf-8"),import(s)}export function toUpperCaseString(e){return e?.replace(/\b\w/g,e=>e.toUpperCase()).replace(/\./g," ")}export function getIPAdress(){let e=t();for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];for(let e=0;e<r.length;e++){let t=r[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.address.startsWith("169.254")&&!t.internal)return t.address}}}export function resolveProgramPath(e){return r.resolve(process.cwd(),"./"+e)}export const resolveNodeModulesPath=e=>resolveProgramPath(`node_modules/${e}`);export const resolve=e=>s.resolveSync({},process.cwd(),e)||e;export function isObject(e){let t=typeof e;return null!==e&&("object"==t||"function"==t)}export function isFunction(e){if(!isObject(e))return!1;let t=Object.prototype.toString.call(e);return"[object Function]"==t||"[object AsyncFunction]"==t||"[object GeneratorFunction]"==t||"[object Proxy]"==t}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import './routes.js';
|
|
1
2
|
import type { WebpackConfiguration } from 'webpack-dev-server';
|
|
3
|
+
import './cleanup.js';
|
|
4
|
+
import './generate-api.js';
|
|
5
|
+
export declare const alias: Record<string, string>;
|
|
2
6
|
export declare const outputConfig: WebpackConfiguration['output'];
|
|
3
7
|
declare const config: WebpackConfiguration;
|
|
4
8
|
export default config;
|
|
@@ -0,0 +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 a}from"./common.js";import r 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"./cleanup.js";import"./generate-api.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;export const alias={"@":C("src"),"@framework-cache-dir":x};Object.assign(alias,l.alias),"library"===d&&Object.assign(alias,{"@":C("site"),"@pkg":C("components"),[b]:C("components")});let M=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:a};let F=v(`@moneko/${w}/lib/packages/${i[d]}/index.js`);"single-component"===d&&(Object.assign(alias,{[b]:C("umd")}),F=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 K={main:F};l.entry&&("string"==typeof l.entry?K=l.entry:Object.keys(l.entry)&&Object.assign(K,l.entry)),l.output&&("string"==typeof l.output?outputConfig.path=l.output:Object.keys(l.output)&&Object.assign(outputConfig,l.output));let L=l.routeBaseName.split("/").filter(Boolean).length,W=Array(L).fill("..").join("/")+(L?"/":"")+"404.html",{pathSegmentsToKeep:D=L,path:R=W}=l.fixBrowserRouter||{},_={entry:K,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:R,inject:!1,templateContent:()=>`<html html><head><title>${c.title}</title><script>var pathSegmentsToKeep = ${D||L};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(M),"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 r({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:alias,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:f,externals:l.externals,output:outputConfig};export default _;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import e from"@soda/friendly-errors-webpack-plugin";import o from"chalk";import{getPort as r}from"portfinder";import t from"webpack";import{merge as s}from"webpack-merge";import{CONFIG as p}from"./common.js";import{hasPkg as i}from"./has-pkg.js";import{CUSTOMCONFIG as l,isReact as a}from"./process-env.js";import{getIPAdress as m,isFunction as n,resolveProgramPath as c}from"./utils.js";import d from"./webpack.common.js";let v=i("@moneko/mock"),h=v&&await import("@moneko/mock"),f=a&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,u=!1;p.cacheDirectory&&(u={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:p.cacheDirectory,name:`${l||"default"}-development`});let w=!1===p.devtool||p.devtool?p.devtool:"eval-cheap-module-source-map",g=new Promise(i=>{r({port:p.devServer.port,stopPort:9999},(r,l)=>{let a=[];p.devServer.port!==l&&a.push(`Port ${o.yellow(p.devServer.port)} is in use, trying ${o.green(l)} instead`),p.devServer.port=l;let v="/"===p.routeBaseName,g=p.devServer.https?"https:":"http:",k=v?"":p.routeBaseName,y=s(d,{devtool:w,mode:"development",cache:u,devServer:{headers:{"Access-Control-Allow-Origin":"*"},compress:p.devServer.compress,host:"0.0.0.0",port:l,historyApiFallback:v||{index:k.endsWith("/")?k:`${k}/`,disableDotRule:!0},https:p.devServer.https,proxy:p.proxy,allowedHosts:p.devServer.allowedHosts,client:{progress:!1,logging:"info",overlay:!1},static:{watch:{ignored:e=>e.endsWith(".d.ts")||/\/node_modules\//.test(e)}},setupMiddlewares:(e,o)=>{if(!o)throw Error("webpack-dev-server is not defined");return o.app&&n(h)&&h(o.app,c("mock/")),e},open:!1,hot:!0},plugins:[new t.HotModuleReplacementPlugin,f&&new f,new e({compilationSuccessInfo:{messages:[`You application is running here:
|
|
2
|
+
|
|
3
|
+
local: ${o.cyan(`${g}//${p.devServer.host}:${l}${k}`)}
|
|
4
|
+
network: ${o.cyan(`${g}//${m()}:${l}${k}`)}`],notes:a},clearConsole:!0})].filter(Boolean)});i(y)})});export default g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"css-minimizer-webpack-plugin";import i from"mini-css-extract-plugin";import n from"terser-webpack-plugin";import m from"webpack";import{BundleAnalyzerPlugin as o}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import{CONFIG as s}from"./common.js";import{getMinifyOption as t}from"./minify.js";import{CUSTOMCONFIG as c}from"./process-env.js";import p from"./webpack.common.js";let{cssnanoMinify:l,swcMinify:a}=e,u="swc"===s.compiler?"swc":"terser",f="swc"===s.compiler?"swc":"cssnano",d=[];s.minifier&&(s.minifier.js&&d.push(new n(t(s.minifier.js?.type||u,s.minifier.js?.options))),s.minifier.css&&d.push(new e({minify:{swc:a,cssnano:l}[s.minifier.css?.type||f],minimizerOptions:s.minifier.css?.options})));let h={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:d},k=!1;s.cacheDirectory&&(k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.cacheDirectory,name:`${c||"default"}-production`});export default r(p,{devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",cache:k,optimization:h,plugins:[new i({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),s.bundleAnalyzer&&new o(s.bundleAnalyzer),s.splitChunk&&new m.optimize.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
|
package/package.json
CHANGED
|
@@ -1,76 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.61",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "
|
|
9
|
-
"
|
|
10
|
-
"build-src": "swc src -d lib -C module.type=es6 -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true --copy-files",
|
|
11
|
-
"build:types": "tsc && tsc --project cli.json",
|
|
12
|
-
"postbuild": "node ./copy.js ./prefix ./lib",
|
|
13
|
-
"prebuild": "rm -rf ./build && rm -rf ./lib"
|
|
8
|
+
"build": "swc src -d lib -C module.type=nodenext -C jsc.target=esnext -C jsc.loose=true -C jsc.minify.mangle=true -C jsc.minify.compress=true -C minify=true -D",
|
|
9
|
+
"prebuild": "rm -rf ./lib && tsc"
|
|
14
10
|
},
|
|
15
11
|
"keywords": [],
|
|
16
12
|
"author": "moneko",
|
|
17
13
|
"license": "MIT",
|
|
18
14
|
"dependencies": {
|
|
19
|
-
"@emotion/css": "11.11.0",
|
|
20
|
-
"@mapbox/rehype-prism": "0.8.0",
|
|
21
15
|
"@mdx-js/loader": "2.3.0",
|
|
22
|
-
"@moneko/common": "1.1.0",
|
|
23
|
-
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
24
16
|
"@soda/friendly-errors-webpack-plugin": "1.8.1",
|
|
25
|
-
"@swc/core": "1.3.
|
|
26
|
-
"@swc/css": "0.0.
|
|
17
|
+
"@swc/core": "1.3.62",
|
|
18
|
+
"@swc/css": "0.0.28",
|
|
27
19
|
"@swc/helpers": "0.5.1",
|
|
28
20
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
29
|
-
"core-js": "3.
|
|
21
|
+
"core-js": "3.31.0",
|
|
30
22
|
"cross-env": "7.0.3",
|
|
31
|
-
"css-loader": "6.
|
|
32
|
-
"css-minimizer-webpack-plugin": "5.0.
|
|
23
|
+
"css-loader": "6.8.1",
|
|
24
|
+
"css-minimizer-webpack-plugin": "5.0.1",
|
|
33
25
|
"css-unicode-loader": "1.0.3",
|
|
34
26
|
"external-remotes-plugin": "1.0.0",
|
|
35
|
-
"html-webpack-plugin": "5.5.
|
|
27
|
+
"html-webpack-plugin": "5.5.3",
|
|
36
28
|
"less": "4.1.3",
|
|
37
|
-
"less-loader": "11.1.
|
|
38
|
-
"mini-css-extract-plugin": "2.7.
|
|
29
|
+
"less-loader": "11.1.3",
|
|
30
|
+
"mini-css-extract-plugin": "2.7.6",
|
|
39
31
|
"mini-svg-data-uri": "1.4.4",
|
|
40
32
|
"path-to-regexp": "6.2.1",
|
|
41
33
|
"portfinder": "1.0.32",
|
|
42
|
-
"
|
|
43
|
-
"rehype-figure": "1.0.1",
|
|
44
|
-
"style-loader": "3.3.2",
|
|
34
|
+
"style-loader": "3.3.3",
|
|
45
35
|
"style-resources-loader": "1.5.0",
|
|
46
36
|
"swc-loader": "0.2.3",
|
|
47
|
-
"swc-plugin-another-transform-imports": "0.2.
|
|
37
|
+
"swc-plugin-another-transform-imports": "0.2.4",
|
|
48
38
|
"ts-import-plugin": "3.0.0",
|
|
49
|
-
"ts-loader": "9.4.
|
|
50
|
-
"typescript": "
|
|
39
|
+
"ts-loader": "9.4.4",
|
|
40
|
+
"typescript": "5.0.4",
|
|
51
41
|
"webpack": "5.76.1",
|
|
52
|
-
"webpack-bundle-analyzer": "4.
|
|
42
|
+
"webpack-bundle-analyzer": "4.9.0",
|
|
53
43
|
"webpack-cli": "5.1.1",
|
|
54
44
|
"webpack-dev-server": "4.15.0",
|
|
55
|
-
"webpack-merge": "5.
|
|
45
|
+
"webpack-merge": "5.9.0",
|
|
56
46
|
"webpackbar": "5.0.2",
|
|
57
|
-
"xml2js": "0.
|
|
47
|
+
"xml2js": "0.6.0"
|
|
58
48
|
},
|
|
59
49
|
"devDependencies": {
|
|
60
|
-
"@
|
|
50
|
+
"@moneko/mock": "^1.0.10",
|
|
51
|
+
"@moneko/postcss": "^1.0.30",
|
|
61
52
|
"@swc/cli": "0.1.62",
|
|
53
|
+
"@types/js-yaml": "^4.0.5",
|
|
62
54
|
"@types/mini-css-extract-plugin": "^2.5.1",
|
|
63
55
|
"@types/shelljs": "^0.8.12",
|
|
64
56
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
65
|
-
"@types/webpack-env": "^1.18.
|
|
57
|
+
"@types/webpack-env": "^1.18.1",
|
|
66
58
|
"eslint-config-neko": "^1.0.23",
|
|
67
59
|
"shelljs": "^0.8.5",
|
|
68
|
-
"solid-js": "^1.7.5",
|
|
69
60
|
"stylelint-config-moneko": "^1.0.15"
|
|
70
61
|
},
|
|
71
62
|
"files": [
|
|
72
63
|
"lib",
|
|
73
|
-
"build",
|
|
74
64
|
"template",
|
|
75
65
|
"typings/global.d.ts"
|
|
76
66
|
]
|
package/typings/global.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
|
|
3
3
|
import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
4
4
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
5
|
+
import type { Options as MDXOptions } from '@mdx-js/loader';
|
|
5
6
|
import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
|
|
6
7
|
import type { CssNanoOptionsExtended } from 'css-minimizer-webpack-plugin';
|
|
7
8
|
import type { MinifyOptions } from 'terser';
|
|
@@ -13,6 +14,7 @@ import type {
|
|
|
13
14
|
ProxyConfigMap,
|
|
14
15
|
WebpackConfiguration,
|
|
15
16
|
} from 'webpack-dev-server';
|
|
17
|
+
import type { State } from 'webpackbar';
|
|
16
18
|
|
|
17
19
|
export type MinifierType = 'swc' | 'terser';
|
|
18
20
|
export declare type AppType =
|
|
@@ -22,6 +24,7 @@ export declare type AppType =
|
|
|
22
24
|
| 'back-stage'
|
|
23
25
|
| 'single-spa'
|
|
24
26
|
| 'library';
|
|
27
|
+
export declare type Framework = 'react' | 'solid-js';
|
|
25
28
|
export type TerserOptions = MinifyOptions;
|
|
26
29
|
export type SwcOptions = JsMinifyOptions;
|
|
27
30
|
export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
|
|
@@ -41,7 +44,7 @@ export interface Theme {
|
|
|
41
44
|
errorColor?: string;
|
|
42
45
|
warningColor?: string;
|
|
43
46
|
}
|
|
44
|
-
export declare type ConfigType<T
|
|
47
|
+
export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
45
48
|
/** 渲染模式
|
|
46
49
|
* @default 'csr'
|
|
47
50
|
*/
|
|
@@ -67,22 +70,28 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
67
70
|
**/
|
|
68
71
|
entry?: Record<string, string> | string;
|
|
69
72
|
/** 压缩配置 */
|
|
70
|
-
minifier:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
minifier:
|
|
74
|
+
| {
|
|
75
|
+
js?:
|
|
76
|
+
| {
|
|
77
|
+
/**
|
|
78
|
+
* @default 'swc'
|
|
79
|
+
*/
|
|
80
|
+
type?: MinifierType;
|
|
81
|
+
options?: SwcOptions | TerserOptions;
|
|
82
|
+
}
|
|
83
|
+
| false;
|
|
84
|
+
css?:
|
|
85
|
+
| {
|
|
86
|
+
/**
|
|
87
|
+
* @default 'swc'
|
|
88
|
+
*/
|
|
89
|
+
type?: CssMinify;
|
|
90
|
+
options?: CssNanoOptionsExtended;
|
|
91
|
+
}
|
|
92
|
+
| false;
|
|
93
|
+
}
|
|
94
|
+
| false;
|
|
86
95
|
/** 环境变量, 可通过 process.env 获取 */
|
|
87
96
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
97
|
env?: Record<string, any>;
|
|
@@ -174,7 +183,7 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
174
183
|
compress?: boolean;
|
|
175
184
|
};
|
|
176
185
|
/** HtmlWebpackPlugin Option */
|
|
177
|
-
htmlPluginOption: HtmlWebpackOption;
|
|
186
|
+
htmlPluginOption: HtmlWebpackOption | false;
|
|
178
187
|
/** 自定义插入 html 的 js 和 css
|
|
179
188
|
* @example
|
|
180
189
|
* const conf = {
|
|
@@ -255,6 +264,16 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
255
264
|
| false;
|
|
256
265
|
/** 📦 打包完成 */
|
|
257
266
|
done?: () => void;
|
|
267
|
+
mdx?: MDXOptions;
|
|
268
|
+
jsxDomExpressions?: {
|
|
269
|
+
moduleName?: string;
|
|
270
|
+
builtIns?: string[];
|
|
271
|
+
contextToCustomElements?: boolean;
|
|
272
|
+
wrapConditionals?: boolean;
|
|
273
|
+
generate?: 'ssr' | 'dom';
|
|
274
|
+
hydratable?: boolean;
|
|
275
|
+
};
|
|
276
|
+
bar?: Partial<State> | false;
|
|
258
277
|
};
|
|
259
278
|
export declare interface ModuleFederationOption {
|
|
260
279
|
/** 模块名称,唯一性,不能重名 */
|
package/build/common.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import fs from"fs";import path from"path";import readline from"readline";import chalk from"chalk";import{merge}from"webpack-merge";import{APPTYPE,CUSTOMCONFIG,pkgName,PROGRAMPATH}from"./process-env.js";import{tfc,isFunction}from"./utils.js";export const ENTRYPATH={mobile:"mobile",site:"site","back-stage":"back-stage","single-spa":"single-spa",library:"library","single-component":"single-component"};let includeModule=[pkgName,"neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design"],defaultSplitChunk={chunks:"all",minSize:1024,minChunks:1};"single-component"===APPTYPE&&(defaultSplitChunk=!1);let defaultConfig={seo:!1,mode:"csr",compiler:"swc",bundleAnalyzer:{analyzerMode:"static",reportFilename:"report.html",openAnalyzer:!1},entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:{},routeBaseName:"/",publicPath:"/",designSize:"mobile"===APPTYPE?375:1680,fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{},layoutSider:{},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:PROGRAMPATH+"/node_modules/.temp_cache",devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`./node_modules/${pkgName}/template/index.html`,favicon:`./node_modules/${pkgName}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],splitChunk:defaultSplitChunk,runtimeChunk:"single-component"!==APPTYPE&&"single",moduleFederation:[],rulesInclude:{less:includeModule,css:includeModule,js:includeModule,media:includeModule,fonts:includeModule}};export const log=e=>{readline.cursorTo(process.stdout,0),process.stdout.write(e)};let customConf=defaultConfig,configPath=null,normalConf={},envConf={};try{configPath=path.join(PROGRAMPATH,"./config/index.ts"),fs.accessSync(configPath,fs.constants.R_OK)}catch(error){configPath=null}if(configPath)try{let conf=eval(tfc(configPath)).default;normalConf=isFunction(conf)?conf(process):conf}catch(error){process.stdout.write(chalk.red(error))}if(CUSTOMCONFIG){let customConfigPath=null;try{customConfigPath=path.join(PROGRAMPATH,`./config/${CUSTOMCONFIG}.ts`),fs.accessSync(customConfigPath,fs.constants.R_OK)}catch(error){customConfigPath=null}if(null!==customConfigPath)try{let conf=eval(tfc(customConfigPath)).default;envConf=isFunction(conf)?conf(process):conf}catch(error){process.stdout.write(chalk.red(error))}}customConf=merge(customConf,normalConf,envConf),!1===customConf.devtool&&(customConf.sourceMap=!1),!1===customConf.sourceMap&&(customConf.devtool=!1),customConf.fixBrowserRouter&&(customConf.htmlPluginOption.tags||(customConf.htmlPluginOption.tags=[]),customConf.htmlPluginOption.tags.push({textContent:`
|
|
2
|
-
(function(l) {
|
|
3
|
-
if (l.search[1] === '/' ) {
|
|
4
|
-
var decoded = l.search.slice(1).split('&').map(function(s) {
|
|
5
|
-
return s.replace(/~and~/g, '&')
|
|
6
|
-
}).join('?');
|
|
7
|
-
window.history.replaceState(null, null,
|
|
8
|
-
l.pathname.slice(0, -1) + decoded + l.hash
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
}(window.location))
|
|
12
|
-
`}));export const CONFIG=customConf;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,log};
|
package/build/done.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default class{constructor(o){this.options=Object.assign({},o)}apply(o){let t=this;o.hooks.done.tap("DoneWebpackPlugin",function(){t.options.done?.()})}};
|
package/build/envFlags.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import i from"fs";import r from"path";import{CONFIG as e}from"./common.js";import{coverage as t}from"./coverage.js";import o from"./html-plugin-option.js";import{APPTYPE as s,NODE_ENV as n,PACKAGENAME as a,programInfo as f,PROGRAMPATH as c,hasAntd as m,hasReact as p}from"./process-env.js";import{toUpperCaseString as l}from"./utils.js";let g=p?require("react/package.json").version:"18",y=parseFloat(g)>=18?"react-dom/client":"react-dom",S="library"===s?"site":"src",N=!1;try{let e=r.join(c,"./src/index.ts");i.accessSync(e,i.constants.R_OK),N=e}catch(i){N=!1}let O={projectName:JSON.stringify(l(a)),projectCoverage:JSON.stringify(t),providerConfig:JSON.stringify({prefixCls:e.prefixCls,iconPrefixCls:e.prefixCls+"-icon",theme:e.theme}),fallbackCompPath:JSON.stringify(e.fallbackCompPath),ReactDOMPath:JSON.stringify(y),favicon:JSON.stringify(o.favicon),hasLocales:JSON.stringify(i.existsSync(r.join(c,`./${S}/locales`))),hasPersist:JSON.stringify(i.existsSync(r.join(c,`./${S}/persist.ts`))),layoutSider:JSON.stringify(e.layoutSider),hasAntd:JSON.stringify(m),APPTYPE:JSON.stringify(s),APPENTRY:JSON.stringify(N),programInfo:JSON.stringify({...f,routeBaseName:e.routeBaseName,designSize:e.designSize,routerMode:e.routerMode,renderMode:e.mode}),"process.env":JSON.stringify({NODE_ENV:n,iconfont:e.iconfont,...e.env})};export default O;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"path";import{merge as t}from"webpack-merge";import{CONFIG as i}from"./common.js";import{PROGRAMPATH as o,PACKAGENAME as r,programInfo as a}from"./process-env.js";let{template:p,favicon:m,...n}=i.htmlPluginOption,l=t({title:i.env?.PROJECTNAME||r.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:a.description||""},tags:[],template:e.join(o,p),favicon:e.join(o,m)},n);export default l;
|
package/build/index.d.ts
DELETED
package/build/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from"./process-env.js";export*from"./utils.js";
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import ExternalTemplateRemotesPlugin from 'external-remotes-plugin';
|
|
2
|
-
import { NormalModuleReplacementPlugin } from 'webpack';
|
|
3
|
-
import ModuleFederationPlugin from 'webpack/lib/container/ModuleFederationPlugin.js';
|
|
4
|
-
export declare const moduleFederation: (typeof ExternalTemplateRemotesPlugin | typeof ModuleFederationPlugin | typeof NormalModuleReplacementPlugin)[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"external-remotes-plugin";import{NormalModuleReplacementPlugin as r}from"webpack";import t from"webpack/lib/container/ModuleFederationPlugin.js";import{CONFIG as o}from"./common.js";import{resolve as i}from"./utils.js";let s={},a={},l={};export const moduleFederation=o.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,i=t.filename||"remote_entry.js";if(l[o]=`${t.name}@${t.host}/${i}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)s[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?a[`./${t}`]=i(t):"[object Object]"===Object.prototype.toString.call(t)&&(a[`./${t.name}`]=i(t.path))}return new t({filename:"remote_entry.js",...e,remotes:l,exposes:a})});moduleFederation.length&&(moduleFederation.push(new e),moduleFederation.push(new r(/(.*)/,e=>{s[e.request]&&(e.request=s[e.request])})));
|
package/build/module.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as o,PUBLICPATH as t}from"./common.js";import{hasPkg as r}from"./has-pkg.js";import l from"./modifyVars.js";import{APPTYPE as a,DEV as i,pkgName as c}from"./process-env.js";import n from"./swcrc.js";import p from"./tsloader.config.js";import{resolveNodeModulesPath as m,resolveProgramPath as u}from"./utils.js";let d="single-spa"===a?t:"../",f={loader:e.loader,options:{publicPath:"/"!==d?d:"../"}},y=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:require("@moneko/postcss")}};i&&(f="style-loader");let x=[...o.cssModules,c,"neko-ui"].map(m),g=[m(`${c}/lib/styles/eval/*.less`),...["src/styles/variables/*.less","src/styles/mixins/*.less","site/styles/variables/*.less","site/styles/mixins/*.less"].map(u)],j=["components","example","mock","site","src"].map(u),$=[f,{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=x.length;s<o;s++)if(e&&e?.includes(x[s]))return/(.*(?<!\.global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},y,"css-unicode-loader",{loader:"less-loader",options:{sourceMap:!!o.sourceMap,lessOptions:{modifyVars:l,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:g}}].filter(Boolean),b={loader:"tsc"===o.compiler?"ts-loader":"swc-loader",options:"tsc"===o.compiler?p:n(i)},h={rules:[{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{resourceQuery:/\.wasm$/,type:"webassembly/async"},{test:/\.less$/,use:$,include:j.concat(o.rulesInclude?.less?.map(m)||[])},{test:/\.css$/,use:[f,"css-loader",y,"css-unicode-loader"].filter(Boolean),include:j.concat(o.rulesInclude?.css?.map(m)||[])},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",generator:{filename:"assets/images/[name][ext][query]"},include:j.concat(o.rulesInclude?.media?.map(m)||[])},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:j.concat(o.rulesInclude?.fonts?.map(m)||[])},{test:/\.svg$/,type:"asset/inline",generator:{dataUrl:e=>s("string"!=typeof e?e.toString():e)}},{test:/\.txt$/,type:"asset/source"},{test:/\.(cj|mj|t|j)s(|x)$/,use:[...o.prefixJsLoader,b].filter(Boolean),include:j.concat(o.rulesInclude?.js?.map(m)||[])},{test:/\.mdx?$/,use:[...o.prefixJsLoader,b,{loader:"@mdx-js/loader",options:{jsxImportSource:"solid-js/h",rehypePlugins:[[require("@mapbox/rehype-prism"),{ignore:!0}],require("rehype-accessible-emojis").rehypeAccessibleEmojis,require("rehype-figure")],remarkPlugins:[]}}].filter(Boolean),include:j,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...o.moduleRules]};export default h;
|
package/build/process-env.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hasPkg as e}from"./has-pkg.js";import{resolveProgramPath as o}from"./utils.js";import r from"./yarn-argv.js";export const APPTYPE=process.env.APPTYPE;export const PROGRAMPATH=process.cwd();export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const pkgName=require("../package.json").name;export const NODE_ENV=process.env.NODE_ENV;export const CUSTOMCONFIG=process.env.npm_config_config||r.config;export const DEV="development"===process.env.NODE_ENV;export let hasEslintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_eslintConfig_")).length;export let hasStylelintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_stylelint_")).length;export const hasReact=e("react");export const hasAntd=e("antd");export const programInfo={name:PACKAGENAME,version:PACKAGEVERSION,type:APPTYPE,description:process.env.npm_package_description,author:{name:process.env.npm_package_author_name,email:process.env.npm_package_author_email,url:process.env.npm_package_author_url},repository:{type:process.env.npm_package_repository_type,url:process.env.npm_package_repository_url,directory:process.env.npm_package_repository_directory}};if(parseInt(process.versions.node)>14){let{description:e,author:r,repository:s,eslintConfig:n,stylelint:t}=require(o("package.json"));programInfo.author="string"==typeof r?{name:r}:r,programInfo.repository="string"==typeof r?{url:s}:s,programInfo.description=e,hasEslintConfig=!!n,hasStylelintConfig=!!t}
|
package/build/resolver-sync.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"fs";import{CachedInputFileSystem as s,ResolverFactory as o}from"enhanced-resolve";let n=o.createResolver({fileSystem:new s(e,4e3),conditionNames:["node"],extensions:[".js",".json",".node"],useSyncFileSystemCalls:!0,mainFields:["esm","module","main"]});export default n;
|
package/build/seo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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)};
|
package/build/swcrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./common.js";import r from"./envFlags.js";let t={env:{targets:["last 2 version","> 0.5%","ie 11","not dead"],mode:"entry",coreJs:"3"}};export const swcMinifyOption={compress:{top_retain:[],keep_infinity:!0,global_defs:{"@alert":"console.log"},pure_funcs:["console.log","console.warn","console.error","console.info"],toplevel:!1,drop_console:!0,drop_debugger:!0,module:!1,ecma:2015,ie8:!1,keep_classnames:void 0,keep_fnames:!1},mangle:!0};export default((s=!1)=>{let n={module:{type:"es6",ignoreDynamic:!0,strict:!0,strictMode:!0,lazy:!0,noInterop:!0},jsc:{parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!0,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:s,development:s},constModules:{globals:{"env-flags":r}},optimizer:{simplify:!1}},experimental:{plugins:[["swc-plugin-another-transform-imports",function(e){for(let o=0,r=Object.keys(e),t=r.length;o<t;o++)e[r[o]].transform=`${r[o]}/${e[r[o]].transform}`,e[r[o]].style&&(e[r[o]].style=`${r[o]}/${e[r[o]].style}`);return e}(o.importOnDemand||{})]]}},sourceMaps:!0,parseMap:!0},a=Object.assign(n,!s&&t);return o.swcrc&&(a=e(a,"function"==typeof o.swcrc?o.swcrc(s):o.swcrc)),a});
|
package/build/tsloader.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import fs from"fs";import transformerFactory from"ts-import-plugin";import merge from"webpack-merge";import{CONFIG}from"./common.js";import{tfc,isFunction,resolveProgramPath}from"./utils.js";let importOnDemand=[];Array.isArray(CONFIG.importOnDemand)&&Object.assign(importOnDemand,CONFIG.importOnDemand.map(r=>transformerFactory(r)));let beforeTransformers=[...importOnDemand],tsLoaderConfig={transpileOnly:!0,getCustomTransformers:()=>({before:beforeTransformers})};try{let customTsloaderConfigPath=resolveProgramPath("tsloader.config.ts");fs.accessSync(customTsloaderConfigPath,fs.constants.R_OK);let customTsloaderConfig=eval(tfc(customTsloaderConfigPath)).default;tsLoaderConfig=merge(tsLoaderConfig,isFunction(customTsloaderConfig)?customTsloaderConfig(process):customTsloaderConfig)}catch(error){}export default tsLoaderConfig;
|
package/build/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{networkInterfaces}from"os";import path from"path";import{transformFileSync}from"@swc/core";import resolverSync from"./resolver-sync.js";let swcOption={inputSourceMap:!1,sourceMaps:!1,module:{type:"commonjs"},jsc:{parser:{syntax:"typescript"},loose:!1}};export const tfc=filepath=>{let out=transformFileSync(filepath,swcOption).code||"{}";try{return eval(out)}catch(error){return out}};export function toUpperCaseString(e){return e?.replace(/\b\w/g,e=>e.toUpperCase()).replace(/\./g," ")}export function getIPAdress(){let e=networkInterfaces();for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];for(let e=0;e<r.length;e++){let t=r[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.address.startsWith("169.254")&&!t.internal)return t.address}}}export function resolveProgramPath(e){return path.resolve(process.cwd(),"./"+e)}export const resolveNodeModulesPath=e=>resolveProgramPath(`node_modules/${e}`);export const resolve=e=>resolverSync.resolveSync({},process.cwd(),e)||e;let funcTag="[object Function]",asyncTag="[object AsyncFunction]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";export function isObject(e){let t=typeof e;return null!==e&&("object"==t||"function"==t)}export function isFunction(e){if(!isObject(e))return!1;let t=Object.prototype.toString.call(e);return t==funcTag||t==asyncTag||t==genTag||t==proxyTag}
|
package/build/webpack.common.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"fs";import{join as t}from"path";import s from"url";import n from"add-asset-html-webpack-plugin";import o from"html-webpack-plugin";import{DefinePlugin as l,WatchIgnorePlugin as i,SourceMapDevToolPlugin as r,AutomaticPrefetchPlugin as a}from"webpack";import p from"webpackbar";import{CONFIG as m,ENTRYPATH as c,PUBLICPATH as u}from"./common.js";import f from"./done.js";import d from"./envFlags.js";import g from"./html-add-entry-attr.js";import j from"./html-plugin-option.js";import{moduleFederation as h}from"./module-federation.js";import b from"./module.config.js";import{APPTYPE as y,DEV as w,hasEslintConfig as x,hasStylelintConfig as k,PACKAGENAME as C,PROGRAMPATH as v}from"./process-env.js";import{seo as O}from"./seo.js";import{resolveProgramPath as T}from"./utils.js";let $=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],B=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],L=e.readdirSync(v),A=!1,R=!1;for(let e=0,t=L.length;e<t;e++)B.includes(L[e])&&(R=!0),$.includes(L[e])&&(A=!0);A||(A=x),R||(R=k);let S=R?require("stylelint-webpack-plugin"):null,F=A?require("eslint-webpack-plugin"):null,K={"@":T("src")};Object.assign(K,m.alias),"library"===y&&Object.assign(K,{"@":T("site"),"@pkg":T("components"),[C]:T("components")});let M=m.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:T("library"===y?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:C,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${C}`,pathinfo:!1,clean:!0,publicPath:u};let P=s.fileURLToPath(new URL(".",import.meta.url)),q=t(P,`../lib/packages/${c[y]}/index.js`);"single-component"===y&&(Object.assign(K,{[C]:T("umd")}),q=T(w?"example/index.ts":"src/index.ts"),outputConfig.path=T(w?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=C,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let U={main:q};m.entry&&("string"==typeof m.entry?U=m.entry:Object.keys(m.entry)&&Object.assign(U,m.entry)),m.output&&("string"==typeof m.output?outputConfig.path=m.output:Object.keys(m.output)&&Object.assign(outputConfig,m.output));let W=m.routeBaseName.split("/").filter(Boolean).length,_=Array(W).fill("..").join("/")+(W?"/":"")+"404.html",{pathSegmentsToKeep:E=W,path:G=_}=m.fixBrowserRouter||{},H={entry:U,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new a,...h,F&&new F({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),S&&new S({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new o(j),m.fixBrowserRouter&&new o({filename:G,inject:!1,templateContent:()=>`<html html><head><title>${j.title}</title><script>var pathSegmentsToKeep = ${E||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 n(M),"single-spa"===y&&new g(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new l(d),new i({paths:[/\.d\.ts$/]}),m.sourceMap&&new r(m.sourceMap),new p({name:"编译中",color:"#6f42c1"}),new f({done:()=>{!w&&m.seo&&O(),m.done?.()}}),...m.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:K,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:b,externals:m.externals,output:outputConfig};export default H;
|
package/build/webpack.dev.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import e from"@soda/friendly-errors-webpack-plugin";import o from"chalk";import{getPort as r}from"portfinder";import{HotModuleReplacementPlugin as t}from"webpack";import{merge as s}from"webpack-merge";import{CONFIG as p}from"./common.js";import{hasPkg as l}from"./has-pkg.js";import{hasReact as i}from"./process-env.js";import{getIPAdress as a,resolveProgramPath as m}from"./utils.js";import n from"./webpack.common.js";let c=l("@moneko/mock"),d=c?require("@moneko/mock").default:null,v=i?require("@pmmmwh/react-refresh-webpack-plugin").default:null,h=!1;p.cacheDirectory&&(h={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:p.cacheDirectory});let u=!1===p.devtool||p.devtool?p.devtool:"eval-cheap-module-source-map",f=new Promise(l=>{r({port:p.devServer.port,stopPort:9999},(r,f)=>{let w=[];p.devServer.port!==f&&w.push(`Port ${o.yellow(p.devServer.port)} is in use, trying ${o.green(f)} instead`),p.devServer.port=f;let g="/"===p.routeBaseName,k=p.devServer.https?"https:":"http:",y=g?"":p.routeBaseName,$=s(n,{devtool:u,mode:"development",cache:h,devServer:{headers:{"Access-Control-Allow-Origin":"*"},compress:p.devServer.compress,host:"0.0.0.0",port:f,historyApiFallback:g||{index:y,disableDotRule:!0},https:p.devServer.https,proxy:p.proxy,allowedHosts:p.devServer.allowedHosts,client:{progress:!1,logging:"info",overlay:!1},static:{watch:{ignored:e=>e.endsWith(".d.ts")}},setupMiddlewares:(e,o)=>{if(!o)throw Error("webpack-dev-server is not defined");return o.app&&c&&d(o.app,m("mock/")),e},open:!1,hot:!0},plugins:[new t,i&&new v,new e({compilationSuccessInfo:{messages:[`You application is running here:
|
|
2
|
-
|
|
3
|
-
local: ${o.cyan(`${k}//${p.devServer.host}:${f}${y}`)}
|
|
4
|
-
network: ${o.cyan(`${k}//${a()}:${f}${y}`)}`],notes:w},clearConsole:!0})].filter(Boolean)});l($)})});export default f;
|
package/build/webpack.prod.d.ts
DELETED
package/build/webpack.prod.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e,{cssnanoMinify as i,swcMinify as n}from"css-minimizer-webpack-plugin";import m from"mini-css-extract-plugin";import o from"terser-webpack-plugin";import{optimize as r}from"webpack";import{BundleAnalyzerPlugin as s}from"webpack-bundle-analyzer";import{merge as t}from"webpack-merge";import{CONFIG as c}from"./common.js";import{getMinifyOption as l}from"./minify.js";import p from"./webpack.common.js";let a="swc"===c.compiler?"swc":"terser",u="swc"===c.compiler?"swc":"cssnano",d={splitChunks:c.splitChunk,runtimeChunk:c.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:[new o(l(c.minifier.js?.type||a,c.minifier.js?.options)),new e({minify:{swc:n,cssnano:i}[c.minifier.css?.type||u],minimizerOptions:c.minifier.css?.options})]},f=!1;c.cacheDirectory&&(f={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:c.cacheDirectory});export default t(p,{devtool:!1===c.devtool||c.devtool?c.devtool:"cheap-module-source-map",mode:"production",cache:f,optimization:d,plugins:[new m({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),c.bundleAnalyzer&&new s(c.bundleAnalyzer),c.splitChunk&&new r.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
|
package/lib/normalize.css
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
@import url('tailwindcss/utilities');
|
|
2
|
-
|
|
3
|
-
html,
|
|
4
|
-
body {
|
|
5
|
-
margin: 0;
|
|
6
|
-
padding: 0;
|
|
7
|
-
inline-size: 100vi;
|
|
8
|
-
font-size: var(--font-size, 14px);
|
|
9
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
10
|
-
Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
11
|
-
'Noto Color Emoji', Helvetica, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans';
|
|
12
|
-
color: var(--text-color, rgb(0 0 0 / 65%));
|
|
13
|
-
line-height: 1.8;
|
|
14
|
-
transition-duration: var(--transition-duration, 0.3s);
|
|
15
|
-
transition-property: background-color, color;
|
|
16
|
-
transition-timing-function: var(--transition-timing-function, cubic-bezier(0.94, -0.1, 0.1, 1.2));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
#root {
|
|
20
|
-
display: flex;
|
|
21
|
-
-webkit-overflow-scrolling: touch;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
#root > main {
|
|
25
|
-
animation: route-in var(--transition-duration, 0.3s);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
input,
|
|
29
|
-
textarea {
|
|
30
|
-
caret-color: inherit;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
h1 {
|
|
34
|
-
margin: 0.67em 0;
|
|
35
|
-
font-size: 2em;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
hr {
|
|
39
|
-
overflow: visible;
|
|
40
|
-
block-size: 0;
|
|
41
|
-
box-sizing: content-box;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
pre {
|
|
45
|
-
font-size: 1em;
|
|
46
|
-
font-family: monospace;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
a {
|
|
50
|
-
text-decoration: none;
|
|
51
|
-
background-color: transparent;
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
abbr[title] {
|
|
56
|
-
border-block-end: none;
|
|
57
|
-
text-decoration: underline;
|
|
58
|
-
text-decoration: underline dotted;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
b,
|
|
62
|
-
strong {
|
|
63
|
-
font-weight: bolder;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
code,
|
|
67
|
-
kbd,
|
|
68
|
-
samp {
|
|
69
|
-
font-size: 1em;
|
|
70
|
-
font-family: monospace;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
small {
|
|
74
|
-
font-size: 80%;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
sub,
|
|
78
|
-
sup {
|
|
79
|
-
position: relative;
|
|
80
|
-
font-size: 75%;
|
|
81
|
-
line-height: 0;
|
|
82
|
-
vertical-align: baseline;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
sub {
|
|
86
|
-
inset-block-end: -0.25em;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
sup {
|
|
90
|
-
inset-block-start: -0.5em;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
img {
|
|
94
|
-
border-style: none;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
img,
|
|
98
|
-
button {
|
|
99
|
-
outline: 1px solid transparent;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
button,
|
|
103
|
-
input,
|
|
104
|
-
optgroup,
|
|
105
|
-
select,
|
|
106
|
-
textarea {
|
|
107
|
-
margin: 0;
|
|
108
|
-
font-size: 100%;
|
|
109
|
-
font-family: inherit;
|
|
110
|
-
line-height: 1.15;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
button,
|
|
114
|
-
input {
|
|
115
|
-
overflow: visible;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
button,
|
|
119
|
-
select {
|
|
120
|
-
text-transform: none;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
button,
|
|
124
|
-
[type='button'],
|
|
125
|
-
[type='reset'],
|
|
126
|
-
[type='submit'] {
|
|
127
|
-
appearance: button;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
button::-moz-focus-inner,
|
|
131
|
-
[type='button']::-moz-focus-inner,
|
|
132
|
-
[type='reset']::-moz-focus-inner,
|
|
133
|
-
[type='submit']::-moz-focus-inner {
|
|
134
|
-
border-style: none;
|
|
135
|
-
padding: 0;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
button:-moz-focusring,
|
|
139
|
-
[type='button']:-moz-focusring,
|
|
140
|
-
[type='reset']:-moz-focusring,
|
|
141
|
-
[type='submit']:-moz-focusring {
|
|
142
|
-
outline: 1px dotted var(--primary-outline);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
fieldset {
|
|
146
|
-
padding: 0.35em 0.75em 0.625em;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
legend {
|
|
150
|
-
display: table;
|
|
151
|
-
padding: 0;
|
|
152
|
-
max-inline-size: 100%;
|
|
153
|
-
white-space: normal;
|
|
154
|
-
color: inherit;
|
|
155
|
-
box-sizing: border-box;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
progress {
|
|
159
|
-
vertical-align: baseline;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
textarea {
|
|
163
|
-
overflow: auto;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
details {
|
|
167
|
-
display: block;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
summary {
|
|
171
|
-
display: list-item;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
template,
|
|
175
|
-
[hidden] {
|
|
176
|
-
display: none;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
[type='checkbox'],
|
|
180
|
-
[type='radio'] {
|
|
181
|
-
box-sizing: border-box;
|
|
182
|
-
padding: 0;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
[type='number']::-webkit-inner-spin-button,
|
|
186
|
-
[type='number']::-webkit-outer-spin-button {
|
|
187
|
-
block-size: auto;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
[type='search'] {
|
|
191
|
-
appearance: textfield;
|
|
192
|
-
outline-offset: -2px;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
[type='search']::-webkit-search-decoration {
|
|
196
|
-
appearance: none;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
::-webkit-file-upload-button {
|
|
200
|
-
appearance: button;
|
|
201
|
-
font: inherit;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
::-webkit-scrollbar {
|
|
205
|
-
inline-size: 4px;
|
|
206
|
-
block-size: 4px;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
::-webkit-scrollbar-track,
|
|
210
|
-
::-webkit-scrollbar-thumb {
|
|
211
|
-
border-radius: 5px;
|
|
212
|
-
background-color: transparent;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
:hover::-webkit-scrollbar-thumb {
|
|
216
|
-
background-color: var(--primary-selection);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
::-webkit-scrollbar-thumb:hover {
|
|
220
|
-
background-color: var(--primary-hover);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
::-webkit-scrollbar-thumb:active {
|
|
224
|
-
background-color: var(--primary-active);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
::-webkit-scrollbar-button {
|
|
228
|
-
display: none;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
@keyframes route-in {
|
|
232
|
-
from {
|
|
233
|
-
transform: translate3d(0, 16px, 0);
|
|
234
|
-
opacity: 0;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
to {
|
|
238
|
-
transform: translate3d(0, 0, 0);
|
|
239
|
-
opacity: 1;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
@keyframes route-out {
|
|
244
|
-
from {
|
|
245
|
-
transform: translate3d(0, 0, 0);
|
|
246
|
-
opacity: 1;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
to {
|
|
250
|
-
z-index: -1;
|
|
251
|
-
transform: translate3d(0, 1rem, 0);
|
|
252
|
-
opacity: 0;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{isFunction as o}from"@moneko/common";import{Router as n}from"@solidjs/router";import{render as t}from"solid-js/web";import r from"@/index";var e=APPENTRY?require(APPENTRY):null,u=document.getElementById("root");e&&o(e.bootstrap)&&(null==e.bootstrap||e.bootstrap());var m=function(){return React.createElement(n,null,React.createElement(r,null))};window.rootInstance={unmount:function(){return null},render:function(){window.rootInstance.unmount=t(m,u)}},window.rootInstance.render(m),e&&o(e.mount)&&(null==e.mount||e.mount());
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"../../refresh-rem";import"../../normalize.css";var r=await import("./bootstrap");export default r;
|
package/lib/refresh-rem.d.ts
DELETED
|
File without changes
|
package/lib/refresh-rem.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(o,n){var t=function(){var n=o.documentElement,t=n.clientWidth||o.body.clientWidth,e=t<=375?375:programInfo.designSize,i=t;i=t<=375?t:t<=programInfo.designSize?e:t;var l=16/e*i+"px";l!==n.style.fontSize&&(n.style.fontSize=l)};t(),"addEventListener"in o&&n.addEventListener("orientationchange"in n?"orientationchange":"resize",t,!1),window.scrollTo||(window.scrollTo=function(o){window.scrollLeft=o.left,window.scrollTop=o.top}),document.body.scrollTo||(Element.prototype.scrollTo=function(o){this.scrollLeft=o.left,this.scrollTop=o.top})}(document,window);
|
package/lib/router/index.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
type Any = any;
|
|
2
|
-
type MDXComponents = Record<string, Any>;
|
|
3
|
-
export interface RouterProps {
|
|
4
|
-
/** 菜单id */
|
|
5
|
-
key: string;
|
|
6
|
-
alive?: boolean;
|
|
7
|
-
/** 菜单图标 */
|
|
8
|
-
icon?: string;
|
|
9
|
-
dynamicTitle?: string;
|
|
10
|
-
/** 菜单名 */
|
|
11
|
-
i18n?: string | null;
|
|
12
|
-
hideMenu?: boolean;
|
|
13
|
-
hideTabs?: boolean;
|
|
14
|
-
onlyLogin?: boolean;
|
|
15
|
-
/** 菜单父id */
|
|
16
|
-
parentId?: string;
|
|
17
|
-
root?: boolean;
|
|
18
|
-
path?: string;
|
|
19
|
-
element?: Any;
|
|
20
|
-
fallback?: Any;
|
|
21
|
-
/** 可否关闭标签 */
|
|
22
|
-
closable?: boolean;
|
|
23
|
-
/** 子菜单 */
|
|
24
|
-
children?: RouterProps[];
|
|
25
|
-
props?: {
|
|
26
|
-
path: string;
|
|
27
|
-
components?: MDXComponents;
|
|
28
|
-
[key: string]: Any;
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export declare function lazyImport(filePath: string): Promise<unknown>;
|
|
32
|
-
export interface ExampleModule {
|
|
33
|
-
code: string;
|
|
34
|
-
title?: string;
|
|
35
|
-
description?: string | null;
|
|
36
|
-
noInline: boolean;
|
|
37
|
-
language: never;
|
|
38
|
-
}
|
|
39
|
-
export type MyPkg = RouterProps & {
|
|
40
|
-
type: string;
|
|
41
|
-
title: string;
|
|
42
|
-
subtitle?: string;
|
|
43
|
-
icon?: string;
|
|
44
|
-
};
|
|
45
|
-
export declare const myPkgs: MyPkg[];
|
|
46
|
-
export declare const myDemoKv: Record<string, ExampleModule[]>;
|
|
47
|
-
export declare const mdxComponents: MDXComponents;
|
|
48
|
-
export declare const onlyLoginRouter: RouterProps[];
|
|
49
|
-
export declare const router: RouterProps[];
|
|
50
|
-
export declare function matchUtil(pathname: string): RouterProps;
|
|
51
|
-
export {};
|
package/lib/router/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=Array(r);n<r;n++)t[n]=e[n];return t}function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}import{isUndefined as n}from"@moneko/common";import{pathToRegexp as t}from"path-to-regexp";export function lazyImport(e){return new Promise(function(r){return import("@/pages/"+e.replace(/:/g,"$").replace(/^\//,"")).then(r).catch(function(){return Promise.resolve({default:null})})})}export var myPkgs=[];export var myDemoKv={};export var mdxComponents={};if("library"===APPTYPE){var o,i,a=require.context("@pkg/",!0,/README\.mdx?$/),l={};try{l=require("@/components/components").default}catch(e){}Object.assign(mdxComponents,r({},l)),null==(o=a.keys())||o.forEach(function(e){var n=e.substring(2).split("/").slice(0,-1).join("/"),t=a(e),o=t.basic,i=t.default;myPkgs.push(r({key:n,path:n,element:i},o,{props:{components:mdxComponents,path:n}}))});var u=require.context("@pkg/",!0,/\/examples\/(.+)\.mdx$/);null==(i=u.keys())||i.forEach(function(r){var n=r.substring(2).split("/"),t=n[0];Array.isArray(myDemoKv[t])||(myDemoKv[t]=[]);for(var o,i,a=u(r),l=a.matchAll(/```([^\r\n]+)?\r?\n([\s\S]*?)\r?\n```/g),c="",p="",s=null,h=function(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=function(r,n){if(r){if("string"==typeof r)return e(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);if("Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return e(r,n)}}(r))){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(l);!(i=h()).done;){var y=i.value;p=y[1]||"tsx",c=y[2],s=a.replace(y[0],"")}myDemoKv[t].push({language:p,code:c,description:s,title:null==(o=n.pop())?void 0:o.replace(/\.mdx$/,""),noInline:/render\([^\\)]*\);?(?=\s*$)/.test(c)})})}var c=[];try{c=require("@/router").default}catch(e){console.info("自定义路由请在 router 目录下新建 index.ts, 类型: RouterProps[]",e)}function p(e,r){return["*"===r&&"*"!==e?void 0:r,e].filter(Boolean).join("/")}var s=function(e){for(var r=[],n=0;n<e.length;n++)for(var t=e[n].split("/").slice(0,-1),o=r,i=0;i<t.length;i++){var a=t[i];if(""!==a){"."===a&&(a="*");var l=o;if(Array.isArray(o)){for(var u=0;u<o.length;u++)if(o[u].path===a){o=o[u].children;break}}if(l===o){var c=i===t.length-1?e[n]:t.slice(0,i+1).join("/")+"/",p={key:c=c.substring(2,c.lastIndexOf("/")),path:a,i18n:"route-"+c,children:[],alive:!1,element:lazyImport(c),hideMenu:c.includes(":"),props:{path:c}};Array.isArray(o)&&o.push(p),o=p.children}}}return r}(require.context("@/pages/",!0,/\.(t|j)sx$/,"lazy").keys().map(function(e){return e.replace(/\$/g,":")}));function h(e,n,t){return void 0===e&&(e=[]),e.map(function(e){var o=r({},e);return void 0===o.key&&(o.key=p(e.path,t)),void 0===o.i18n&&(o.i18n="route-"+o.key),void 0===o.alive&&(o.alive=!1),"*"===o.path&&void 0===o.hideMenu&&(o.hideMenu=!0),Array.isArray(o.children)&&(o.children=o.children.length?h(o.children,n,o.key):void 0),o.element||(o.element=lazyImport(o.key),o.props={path:o.key}),!!o.onlyLogin!==n||o.root?o:null}).filter(Boolean)}for(var y=[].concat(c),f=0,d=s.length;f<d;f++)!function e(t,o,i){var a,l=t.find(function(e){return e.path===o.path});l?(l.key=p(l.path,i),n(l.i18n)&&(l.i18n="route-"+l.key),n(l.alive)&&(l.alive=!1),n(l.element)&&o.element&&(l.element=o.element,l.props=o.props),n(l.hideMenu)&&(l.hideMenu="*"===l.path||l.key.includes(":")),Object.assign(l,r({},o,l)),o.children&&(!l.children&&Array.isArray(o.children)&&(l.children=o.children),null==(a=o.children)||a.forEach(function(r){e(null==l?void 0:l.children,r,null==l?void 0:l.key)}))):t.push(o)}(y,s[f]);export var onlyLoginRouter=h(y,!1);export var router=h(y,!0);export function matchUtil(e){var r={key:""};return!function n(o){for(var i=0,a=o.length;i<a;i++){if(o[i].path&&"*"!==o[i].path&&o[i].key)try{if(t(o[i].key).exec(e.substring(1))){r=o[i];return}}catch(e){}Array.isArray(o[i].children)&&n(o[i].children)}}(router),r}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{build → lib}/minify.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{build → lib}/seo.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|