@moneko/core 3.0.0-beta.7 → 3.0.0-beta.70
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}/coverage.js +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/lib/html-add-entry-attr.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/modifyVars.js +1 -0
- package/lib/module-federation.js +1 -0
- package/lib/module.config.js +1 -0
- package/lib/net.d.ts +3 -0
- package/lib/net.js +1 -0
- package/{build → lib}/process-env.d.ts +9 -3
- package/lib/process-env.js +1 -0
- package/lib/routes.d.ts +1 -0
- package/lib/routes.js +1 -0
- package/lib/seo.js +1 -0
- package/{build → lib}/swcrc.d.ts +1 -1
- package/lib/swcrc.js +1 -0
- package/{build → lib}/tsloader.config.d.ts +1 -1
- package/lib/tsloader.config.js +1 -0
- package/{build → lib}/utils.d.ts +9 -4
- 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 +27 -38
- package/typings/global.d.ts +38 -20
- package/build/common.js +0 -12
- package/build/done.js +0 -1
- package/build/envFlags.js +0 -1
- package/build/html-add-entry-attr.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/modifyVars.js +0 -1
- package/build/module-federation.js +0 -1
- package/build/module.config.js +0 -1
- package/build/process-env.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.d.ts +0 -2
- package/build/webpack.dev.js +0 -4
- 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}/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}/minify.d.ts +0 -0
- /package/{build → lib}/minify.js +0 -0
- /package/{build → lib}/modifyVars.d.ts +0 -0
- /package/{build → lib}/module-federation.d.ts +0 -0
- /package/{build → lib}/module.config.d.ts +0 -0
- /package/{build → lib}/resolver-sync.d.ts +0 -0
- /package/{build → lib}/resolver-sync.js +0 -0
- /package/{build → lib}/seo.d.ts +0 -0
- /package/{build/webpack.prod.d.ts → 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,readdirSync as t,rmdirSync 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)&&(t(i).forEach(o=>{let t=s(i,o);c(t).isDirectory()?e(t):n(t)}),r(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,PROGRAMPATH as a,jsxImportSource as c,pkgName 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:`${a}/node_modules/.temp_cache`,devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`./node_modules/${m}/template/index.html`,favicon:`./node_modules/${m}/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:c,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(a,"./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(a,`./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>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{accessSync as e,constants as r,readFileSync as c}from"fs";import{join as o}from"path";import{Parser as t}from"xml2js";import{PACKAGENAME as a,PROGRAMPATH as s}from"./process-env.js";export const coverage={};try{let i=o(s,"./coverage/clover.xml");e(i,r.R_OK);let m=new t({explicitArray:!1,async:!1}),p=c(i,{encoding:"utf-8"});m.parseString(p,(e,r)=>{if(!e){let e=r.coverage.project.metrics.$,c=r.coverage.project.package;Object.assign(coverage,{[a]:e}),c.forEach(e=>{Object.assign(coverage,{[e.$.name]:e.metrics.$})})}})}catch(e){}
|
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,PROGRAMPATH as a,hasAntd as c,programInfo 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(a,"./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(a,`./${l}/locales`))),hasPersist:JSON.stringify(i.existsSync(r.join(a,`./${l}/persist.ts`))),layoutSider:JSON.stringify(t.layoutSider),hasAntd:JSON.stringify(c),APPTYPE:JSON.stringify(s),APPENTRY:JSON.stringify(g),programInfo:JSON.stringify({...m,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,unlink as i,writeFile as c}from"fs";import{dirname as s,join as a}from"path";import{watch as u}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:j,forEachChild:k,getLeadingCommentRanges:T,isInterfaceDeclaration:F,isQuestionToken:S,isPropertySignature:B,isFunctionTypeNode:C,isUnionTypeNode:E,isMethodSignature:N}=f,O={};function w(e){let t=T(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,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 v(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 I=["#9C27B0","#673AB7","#3F51B5","#2196F3","#00BCD4","#009688","#4CAF50","#CDDC39","#FF9800","#795548"];function K(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 q(){}let z={},L={};function W(o,u){t($)||n($),t(g)||n(g);let p=o.replace(RegExp(`^${b["@pkg"]}`),""),m=s(p).replace(/^\//,""),d=a(g,m),T=p.split("/").pop()?.replace(/\.tsx?/,".md");if(!T)return;z[m]||(z[m]=[]);let D=z[m].indexOf(T),W=a(d,T);if("deleted"===u)delete L[W],i(W,q),-1!==D&&z[m].splice(D,1);else{let e=function(e){let t=l(e,"utf-8"),n=j(e,t,y.Latest,!0,x.TS),r="";return k(n,e=>{F(e)?r+=function(e){let t=e.name.text;Object.assign(O,{[e.name.text]:s(e.getSourceFile().fileName).replace(b["@pkg"],"")});let n=w(e),r=A(n),l=K(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="${I[t]}" css=".tag{gap:0px;}">${_(e)}</n-tag>`),c=[l,o,r&&`\\color{#52c11b|1||0.9}{${r}}`,i.length>0&&`<sub>\`extends\`</sub> ${i.join(" ")}`].filter(Boolean).join(" "),a=`## ${c}`;a+="\n| 属性 | 必要 | 说明 | 类型 | 默认值 | 版本 |\n| :- | :-: | :- | :- | :- | :- |";let u=e.members.filter(e=>B(e)&&e.type?.kind!==h.NeverKeyword||N(e));return u.length?u.forEach(e=>{let t=v(e.name.getText()),n=e.questionToken&&S(e.questionToken),r=w(e),l=v(function(e){if(!e)return null;let t=e.match(/@default\s+([^\n]+)/);return t?t[1].trim():null}(r)),o=v(A(r)),i=_(v(N(e)?`(${e.parameters.map(e=>`${e.name.getText()}: ${e.type?.getText()||"any"}`).join(", ")}): ${e.type?.getText()||"any"}`:e.type?.getText()||"any"),!0),c=v(K(r)),s=`\\color{${n?"#f9a913":"#52c11b"}\\|\\|\\|0.9}{${n?"✘":"✔"}}`;a+="\n",t.startsWith("\\color")||(N(e)||function(e){if(e.type){if(!E(e.type))return C(e.type);for(let t of e.type.types)if(C(t))return!0}return!1}(e)||i?.includes("=>")?t=`\\color{#f9a913}{${t}}`:/^("|')(.+)("|')$/.test(t)||(t=`\\color{#4c81db}{${t}}`)),a+=`| ${t} | ${s} | ${c} | ${i} | ${l} | ${o} |`}):a+="| - | - | - | - | - | - |",a+="\n\n"}(e):f.isEnumDeclaration(e)&&(r+=function(e){let t=e.name.text;Object.assign(O,{[e.name.text]:s(e.getSourceFile().fileName).replace(b["@pkg"],"")});let n=`## ${t}`;return n+="\n| 属性 | 说明 | 值 | 版本 |\n| -- | -- | -- | -- |",e.members.length?e.members.forEach(e=>{let t=v(e.name.getText()),r=w(e),l=v(function(e){let t=e.initializer;return t&&f.isStringLiteral(t)?` '${t.text}'`:null}(e)),o=v(A(r)),i=v(K(r));n+="\n",t.startsWith("\\color")||/^("|')(.+)("|')$/.test(t)||(t=`\\color{#4c81db}{${t}}`),n+=`| ${t} | ${i} | ${l} | ${o} |`}):n+="| - | - | - | - |",n+="\n\n"}(e))}),r}(o);if(e){let l=L[W];l?l!==e&&(t(d)||n(d),c(W,e,"utf-8",q)):r(W,{encoding:"utf-8"},(r,l)=>{(r||l!==e)&&(L[W]=l,t(d)||n(d),c(W,e,"utf-8",q))}),-1===D&&z[m].push(T)}else delete L[W],i(W,q),-1!==D&&z[m].splice(D,1)}let Z=`export default ${JSON.stringify(z)};`;e!==Z&&(e=Z,c(a(g,"index.js"),Z,"utf-8",q))}"library"===m&&function(){let e=[],t=u(d("components"),{ignored:[/(^|[\\/\\])\../,/(^|[\\/\\])__tests__([\\/\\]|$)/],persistent:!0,ignoreInitial:!1});function n(e){return/\.tsx?$/.test(e)&&o(e).isFile()}t.on("add",t=>{n(t)&&(W(t,"added"),e.push(t))}),t.on("change",e=>{n(e)&&W(e,"change")}),t.on("unlink",t=>{n(t)&&(W(t,"deleted"),e.splice(e.indexOf(t),1))}),t.on("ready",()=>{e.forEach(e=>{W(e,"change")})}),process.on("SIGINT",function(){t.close()})}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"html-webpack-plugin";export default class{constructor(t){this.entryMatchCallback=t}apply(a){a.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",e=>{let r=a.options.plugins.find(a=>a instanceof t);if(r){let t=r.getHooks(e);t.alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&"string"==typeof t.attributes?.src&&this.entryMatchCallback(t.attributes.src)&&(t.attributes.entry=!0)}),t))}})}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"path";import{merge as t}from"webpack-merge";import{CONFIG as i}from"./common.js";import{PACKAGENAME as o,PROGRAMPATH as a,pkgName as m,programInfo as p}from"./process-env.js";let{template:r,favicon:n,...l}=i.htmlPluginOption||{template:`./node_modules/${m}/template/index.html`,favicon:`./node_modules/${m}/template/favicon.ico`},s=t({title:i.env?.PROJECTNAME||o.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:p.description||""},tags:[],template:e.join(a,r),favicon:e.join(a,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 @@
|
|
|
1
|
+
import{CONFIG as i}from"./common.js";import o from"./html-plugin-option.js";let f=i.prefixCls||"n",n={};Object.assign(n,{"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":`${f}-icon`,"@favicon":JSON.stringify(o.favicon)},i.modifyVars||{});export default n;
|
|
@@ -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"},{test:/\.wasm$/,type:"webassembly/async"},{test:/\.txt$/,type:"asset/source"},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext][query]"},include:$.concat(o.rulesInclude?.media?.map(p)||[])},{test:/\.svg$/,type:"asset/inline",generator:{dataUrl:e=>s("string"!=typeof e?e.toString():e)}},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:$.concat(o.rulesInclude?.fonts?.map(p)||[])},{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:/\.(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;
|
package/lib/net.d.ts
ADDED
package/lib/net.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createConnection as t}from"net";import{networkInterfaces as e}from"os";import r from"webpack-dev-server";let{internalIPSync:o}=r;export function getNetworkAdress(){let t=e();for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];for(let t=0;t<r.length;t++){let e=r[t];if("IPv4"===e.family&&"127.0.0.1"!==e.address&&!e.address.startsWith("169.254")&&!e.internal)return e.address}}}export function getIPv4(){return o("v4")}export function getPort(e,r,o="0.0.0.0"){return new Promise(n=>{let s=t(e,o);s.on("connect",()=>{s.destroy(),n(getPort(e+1,r,o))}),s.on("error",()=>{n(e)})})}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
import type { AppType } from '../typings/global.
|
|
1
|
+
import type { AppType, Framework } from '../typings/global.js';
|
|
2
2
|
export declare const __dirname: string;
|
|
3
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;
|
|
4
8
|
export declare const PROGRAMPATH: string;
|
|
5
9
|
export declare const PACKAGENAME: string;
|
|
6
10
|
export declare const PACKAGEVERSION: string;
|
|
7
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;
|
|
8
16
|
export declare const NODE_ENV: string | undefined;
|
|
9
17
|
export declare const CUSTOMCONFIG: string | undefined;
|
|
10
|
-
export declare const DEV: boolean;
|
|
11
18
|
export declare let hasEslintConfig: boolean;
|
|
12
19
|
export declare let hasStylelintConfig: boolean;
|
|
13
|
-
export declare const hasReact: boolean;
|
|
14
20
|
export declare const hasAntd: boolean;
|
|
15
21
|
export declare const programInfo: {
|
|
16
22
|
name: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as e,mkdirSync as o,readFileSync 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=r(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/");e(cacheDir)||o(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 e=r(p("package.json"),{encoding:"utf-8"}),{description:o,author:t,repository:s,eslintConfig:n,stylelint:c}=JSON.parse(e);programInfo.author="string"==typeof t?{name:t}:t,programInfo.repository="string"==typeof t?{url:s}:s,programInfo.description=o,hasEslintConfig=!!n,hasStylelintConfig=!!c}
|
package/lib/routes.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/routes.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e,t;import{existsSync as r,mkdirSync as o,readFileSync as n,readdirSync as s,statSync as i,writeFile 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{APPTYPE as u,DEV as f,FRAMEWORK as d,PROGRAMPATH as g,frameworkCacheDir as h}from"./process-env.js";let $=/^---\n([\s\S]+?)\n---\n/;function j(e,t){let{regex:r,alia:o,base:l=e,outputSource:p}=t,u=s(e);return u.reduce((s,u)=>{let f=c(e,u),d=i(f);if(d.isDirectory()){let e=j(f,{...t,base:l});if(e.length>0){let t={},r={path:u,key:m(l,f)};if(p)Object.assign(t,{children:e});else{let o=e.splice(0,1)[0];e.length?Object.assign(t,{children:[{...o,path:"/",key:r.key},...e]}):Object.assign(t,o)}s.push(Object.assign(t,r))}}else if(r.test(f)){let e=n(f,{encoding:"utf-8"}),t=function(e){let t=e.match($);return t&&t[1]?t[1].trim():null}(e),r=t?a(t):{},i=m(l,f);s.push(Object.assign({path:u,key:i,meta:{...r}},o&&{component:`rr(() => import(/* webpackChunkName: '${i}' */'${c(o,i)}'))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 s},[])}let x=c(g,"./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 })`,n=`import { ${e} } from "${d}";import { SuspenseComp } from "@moneko/${d}";`;["react","solid-js"].includes(d)||(t="$1",n="");let s=JSON.stringify(j(x,{regex:/README\.mdx?$/,alia:"@pkg"})).replace(/"rr\((.+?)\)rr"/g,t);r(h)||o(h),l(c(h,"route.js"),`${n}export default ${s}`,"utf-8",k)},100)}function b(){t&&clearTimeout(t),r(h)||o(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)]));l(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"===u&&(f?(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,readdirSync as e,statSync as r,writeFile 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,$=h.endsWith("/")?h:`${h}/`,j=l&&c(l)||f?.path||process.cwd(),E=t=>{if(t)throw t};t(j)||o(j),s(m(j,"CNAME"),a,"utf-8",E),s(m(j,"robots"),`Sitemap: https://${a}${$}sitemap.txt`,"utf-8",E);let d="";"library"===p&&(d=(function t(o,s,m){let i=[],p=e(o);return p.forEach(function(e){if("static"===e)return!1;let p=`${o}/${e}`,c=r(p);c&&c.isDirectory()?i=i.concat(t(p,s,m)):p.endsWith("README.mdx")&&i.push(`https://${s}${m}${p.replace(`${n}/components/`,"").replace("/README.mdx","")}`)}),i})(m(n,"./components"),a,$).join("\n")),s(m(j,"sitemap.txt"),d,"utf-8",E),u&&s(m(j,".nojekyll"),"","utf-8",E)};
|
package/{build → lib}/swcrc.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config as SwcConfig
|
|
1
|
+
import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
|
|
2
2
|
export declare const swcMinifyOption: JsMinifyOptions;
|
|
3
3
|
declare const _default: (isDev?: boolean) => SwcConfig;
|
|
4
4
|
export default _default;
|
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,readConf as s,resolveProgramPath 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=a("tsloader.config.ts");t.accessSync(r,t.constants.R_OK);let e=(await s(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,7 @@
|
|
|
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
|
-
type ProgramPath<T extends string> = `~/${T extends string ? T : string}`;
|
|
4
|
+
type ProgramPath<T extends string> = `${T extends string ? T : string}`;
|
|
5
5
|
type NodeModulesPath<T> = ProgramPath<`node_modules/${T extends string ? T : string}`>;
|
|
6
6
|
/** 位于项目根目录下的位置
|
|
7
7
|
* @param {string} src 路径
|
|
@@ -12,7 +12,12 @@ export declare function resolveProgramPath<T extends string>(src: T): ProgramPat
|
|
|
12
12
|
* @param {string} src 路径
|
|
13
13
|
* @returns {string} 位于项目根目录node_modules下的位置
|
|
14
14
|
*/
|
|
15
|
-
export declare const resolveNodeModulesPath: <T extends string>(src: T) =>
|
|
15
|
+
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
|
+
* @param {string} url 路径
|
|
18
|
+
* @returns {string} 模块真实入口路径
|
|
19
|
+
*/
|
|
20
|
+
export declare const resolve: (url: string) => string;
|
|
16
21
|
export declare function isObject(target: unknown): target is object;
|
|
17
22
|
export declare function isFunction(target: unknown): target is (...args: unknown[]) => unknown;
|
|
18
23
|
export {};
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{writeFileSync as e}from"fs";import o from"path";import{transformFileSync as t}from"@swc/core";import{cacheDir as r}from"./process-env.js";import n from"./resolver-sync.js";let c={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function tfc(e){return t(e,c).code||"{}"}export function readConf(t,n){let c=o.join(r,`${n}.mjs`);return e(c,tfc(t),"utf-8"),import(c)}export function toUpperCaseString(e){return e?.replace(/\b\w/g,e=>e.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(e){return o.resolve(process.cwd(),`./${e}`)}export const resolveNodeModulesPath=e=>resolveProgramPath(`node_modules/${e}`);export const resolve=e=>n.resolveSync({},process.cwd(),e)||e;export function isObject(e){let o=typeof e;return null!==e&&("object"==o||"function"==o)}export function isFunction(e){if(!isObject(e))return!1;let o=Object.prototype.toString.call(e);return"[object Function]"==o||"[object AsyncFunction]"==o||"[object GeneratorFunction]"==o||"[object Proxy]"==o}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import './cleanup.js';
|
|
2
|
+
import './generate-api.js';
|
|
3
|
+
import './routes.js';
|
|
1
4
|
import type { WebpackConfiguration } from 'webpack-dev-server';
|
|
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"./cleanup.js";import{CONFIG as l,ENTRYPATH as i,PUBLICPATH as a}from"./common.js";import r from"./done.js";import p from"./envFlags.js";import"./generate-api.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,FRAMEWORK as j,PACKAGENAME as h,PROGRAMPATH as b,frameworkCacheDir as y,hasEslintConfig as w,hasStylelintConfig 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";let O=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],P=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],$=e.readdirSync(b),T=!1,A=!1;for(let e=0,t=$.length;e<t;e++)P.includes($[e])&&(A=!0),O.includes($[e])&&(T=!0);T||(T=w),A||(A=x);let B=A?(await import("stylelint-webpack-plugin")).default:null,S=T?(await import("eslint-webpack-plugin")).default:null;export const alias={"@":C("src"),"@framework-cache-dir":y};Object.assign(alias,l.alias),"library"===d&&Object.assign(alias,{"@":C("site"),"@pkg":C("components"),[h]: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][query]",library:h,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${h}`,pathinfo:!1,clean:!0,publicPath:a};let F=v(`@moneko/${j}/lib/packages/${i[d]}/index.js`);"single-component"===d&&(Object.assign(alias,{[h]:C("umd")}),F=C(g?"example/index.ts":"src/index.ts"),outputConfig.path=C(g?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=h,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 r from"webpack";import{merge as t}from"webpack-merge";import{CONFIG as s}from"./common.js";import{hasPkg as a}from"./has-pkg.js";import{getIPv4 as p,getPort as i}from"./net.js";import{CUSTOMCONFIG as l,isReact as m}from"./process-env.js";import{isFunction as n,resolveProgramPath as c}from"./utils.js";import d from"./webpack.common.js";let{yellow:v,green:h}=o,f=p(),u=s.devServer.port||3e3,w=await i(u,65535,s.devServer.host),g=s.devServer.port!==w,k=a("@moneko/mock"),y=k&&await import("@moneko/mock"),$=m&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,S=!1;s.cacheDirectory&&(S={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.cacheDirectory,name:`${l||"default"}-development`});let b=!1===s.devtool||s.devtool?s.devtool:"eval-cheap-module-source-map";s.devServer.port=w;let j="/"===s.routeBaseName,x=s.devServer.https?"https:":"http:",D=j?"":s.routeBaseName;export default t(d,{devtool:b,mode:"development",cache:S,devServer:{headers:{"Access-Control-Allow-Origin":"*"},compress:s.devServer.compress,host:"0.0.0.0",port:w,historyApiFallback:j||{index:D.endsWith("/")?D:`${D}/`,disableDotRule:!0},https:s.devServer.https,proxy:s.proxy,allowedHosts:s.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(y)&&y(o.app,c("mock/")),e},open:!1,hot:!0},plugins:[new r.HotModuleReplacementPlugin,$&&new $,new e({compilationSuccessInfo:{messages:[`You application is running here:
|
|
2
|
+
|
|
3
|
+
Local: ${o.cyan(`${x}//${s.devServer.host}:${w}${D}`)}
|
|
4
|
+
Network: ${o.cyan(`${x}//${f}:${w}${D}`)}`],notes:g?[`Port ${v(u)} is in use, trying ${h(w)} instead`]:[]},clearConsole:!0})].filter(Boolean)});
|
|
@@ -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,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.70",
|
|
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.1",
|
|
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
|
-
"
|
|
42
|
-
"rehype-accessible-emojis": "0.3.2",
|
|
43
|
-
"rehype-figure": "1.0.1",
|
|
44
|
-
"style-loader": "3.3.2",
|
|
33
|
+
"style-loader": "3.3.3",
|
|
45
34
|
"style-resources-loader": "1.5.0",
|
|
46
35
|
"swc-loader": "0.2.3",
|
|
47
|
-
"swc-plugin-another-transform-imports": "0.2.
|
|
36
|
+
"swc-plugin-another-transform-imports": "0.2.4",
|
|
48
37
|
"ts-import-plugin": "3.0.0",
|
|
49
|
-
"ts-loader": "9.4.
|
|
50
|
-
"typescript": "
|
|
51
|
-
"webpack": "5.
|
|
52
|
-
"webpack-bundle-analyzer": "4.
|
|
53
|
-
"webpack-cli": "5.1.
|
|
54
|
-
"webpack-dev-server": "4.15.
|
|
55
|
-
"webpack-merge": "5.
|
|
38
|
+
"ts-loader": "9.4.4",
|
|
39
|
+
"typescript": "5.0.4",
|
|
40
|
+
"webpack": "5.77.0",
|
|
41
|
+
"webpack-bundle-analyzer": "4.9.0",
|
|
42
|
+
"webpack-cli": "5.1.4",
|
|
43
|
+
"webpack-dev-server": "4.15.1",
|
|
44
|
+
"webpack-merge": "5.9.0",
|
|
56
45
|
"webpackbar": "5.0.2",
|
|
57
|
-
"xml2js": "0.
|
|
46
|
+
"xml2js": "0.6.1"
|
|
58
47
|
},
|
|
59
48
|
"devDependencies": {
|
|
60
|
-
"@
|
|
49
|
+
"@moneko/mock": "^1.0.10",
|
|
50
|
+
"@moneko/postcss": "^1.0.30",
|
|
61
51
|
"@swc/cli": "0.1.62",
|
|
52
|
+
"@types/js-yaml": "^4.0.5",
|
|
62
53
|
"@types/mini-css-extract-plugin": "^2.5.1",
|
|
63
54
|
"@types/shelljs": "^0.8.12",
|
|
64
55
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
65
|
-
"@types/webpack-env": "^1.18.
|
|
66
|
-
"eslint-config-neko": "^1.
|
|
56
|
+
"@types/webpack-env": "^1.18.1",
|
|
57
|
+
"eslint-config-neko": "^1.1.1",
|
|
67
58
|
"shelljs": "^0.8.5",
|
|
68
|
-
"
|
|
69
|
-
"stylelint-config-moneko": "^1.0.15"
|
|
59
|
+
"stylelint-config-moneko": "^1.0.17"
|
|
70
60
|
},
|
|
71
61
|
"files": [
|
|
72
62
|
"lib",
|
|
73
|
-
"build",
|
|
74
63
|
"template",
|
|
75
64
|
"typings/global.d.ts"
|
|
76
65
|
]
|
package/typings/global.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
1
|
import { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
|
|
3
2
|
import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
4
3
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
4
|
+
import type { Options as MDXOptions } from '@mdx-js/loader';
|
|
5
5
|
import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
|
|
6
6
|
import type { CssNanoOptionsExtended } from 'css-minimizer-webpack-plugin';
|
|
7
7
|
import type { MinifyOptions } from 'terser';
|
|
8
8
|
import type { Options } from 'ts-import-plugin';
|
|
9
|
-
import type { RuleSetRule, WebpackPluginInstance
|
|
9
|
+
import type { Configuration, RuleSetRule, WebpackPluginInstance } from 'webpack';
|
|
10
10
|
import type {
|
|
11
11
|
ProxyArray,
|
|
12
12
|
ProxyConfigArray,
|
|
13
13
|
ProxyConfigMap,
|
|
14
14
|
WebpackConfiguration,
|
|
15
15
|
} from 'webpack-dev-server';
|
|
16
|
+
import type { State } from 'webpackbar';
|
|
16
17
|
|
|
17
18
|
export type MinifierType = 'swc' | 'terser';
|
|
18
19
|
export declare type AppType =
|
|
@@ -22,6 +23,7 @@ export declare type AppType =
|
|
|
22
23
|
| 'back-stage'
|
|
23
24
|
| 'single-spa'
|
|
24
25
|
| 'library';
|
|
26
|
+
export declare type Framework = 'react' | 'solid-js';
|
|
25
27
|
export type TerserOptions = MinifyOptions;
|
|
26
28
|
export type SwcOptions = JsMinifyOptions;
|
|
27
29
|
export type HtmlWebpackOption = HtmlWebpackPluginOptions & {
|
|
@@ -41,7 +43,7 @@ export interface Theme {
|
|
|
41
43
|
errorColor?: string;
|
|
42
44
|
warningColor?: string;
|
|
43
45
|
}
|
|
44
|
-
export declare type ConfigType<T
|
|
46
|
+
export declare type ConfigType<T extends 'tsc' | 'swc' = 'swc'> = {
|
|
45
47
|
/** 渲染模式
|
|
46
48
|
* @default 'csr'
|
|
47
49
|
*/
|
|
@@ -67,22 +69,28 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
67
69
|
**/
|
|
68
70
|
entry?: Record<string, string> | string;
|
|
69
71
|
/** 压缩配置 */
|
|
70
|
-
minifier:
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
minifier:
|
|
73
|
+
| {
|
|
74
|
+
js?:
|
|
75
|
+
| {
|
|
76
|
+
/**
|
|
77
|
+
* @default 'swc'
|
|
78
|
+
*/
|
|
79
|
+
type?: MinifierType;
|
|
80
|
+
options?: SwcOptions | TerserOptions;
|
|
81
|
+
}
|
|
82
|
+
| false;
|
|
83
|
+
css?:
|
|
84
|
+
| {
|
|
85
|
+
/**
|
|
86
|
+
* @default 'swc'
|
|
87
|
+
*/
|
|
88
|
+
type?: CssMinify;
|
|
89
|
+
options?: CssNanoOptionsExtended;
|
|
90
|
+
}
|
|
91
|
+
| false;
|
|
92
|
+
}
|
|
93
|
+
| false;
|
|
86
94
|
/** 环境变量, 可通过 process.env 获取 */
|
|
87
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
96
|
env?: Record<string, any>;
|
|
@@ -174,7 +182,7 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
174
182
|
compress?: boolean;
|
|
175
183
|
};
|
|
176
184
|
/** HtmlWebpackPlugin Option */
|
|
177
|
-
htmlPluginOption: HtmlWebpackOption;
|
|
185
|
+
htmlPluginOption: HtmlWebpackOption | false;
|
|
178
186
|
/** 自定义插入 html 的 js 和 css
|
|
179
187
|
* @example
|
|
180
188
|
* const conf = {
|
|
@@ -255,6 +263,16 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
255
263
|
| false;
|
|
256
264
|
/** 📦 打包完成 */
|
|
257
265
|
done?: () => void;
|
|
266
|
+
mdx?: MDXOptions;
|
|
267
|
+
jsxDomExpressions?: {
|
|
268
|
+
moduleName?: string;
|
|
269
|
+
builtIns?: string[];
|
|
270
|
+
contextToCustomElements?: boolean;
|
|
271
|
+
wrapConditionals?: boolean;
|
|
272
|
+
generate?: 'ssr' | 'dom';
|
|
273
|
+
hydratable?: boolean;
|
|
274
|
+
};
|
|
275
|
+
bar?: Partial<State> | false;
|
|
258
276
|
};
|
|
259
277
|
export declare interface ModuleFederationOption {
|
|
260
278
|
/** 模块名称,唯一性,不能重名 */
|
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 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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default class{constructor(t){this.entryMatchCallback=t}apply(t){t.hooks.compilation.tap("AddEntryAttributeWebpackPlugin",a=>{let e=t.options.plugins.map(({constructor:t})=>t).find(t=>t&&"HtmlWebpackPlugin"===t.name);if(e){let t=e.getHooks(a);t.alterAssetTagGroups.tap("AddEntryAttributeWebpackPlugin",t=>(t.headTags.forEach(t=>{"script"===t.tagName&&"string"==typeof t.attributes?.src&&this.entryMatchCallback(t.attributes.src)&&(t.attributes.entry=!0)}),t))}})}};
|
|
@@ -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";
|
package/build/modifyVars.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{CONFIG as i}from"./common.js";import o from"./html-plugin-option.js";let f=i.prefixCls||"n",n={};Object.assign(n,{"@prefix-cls":f,"@ant-prefix":f,"@iconfont-css-prefix":f+"-icon","@favicon":JSON.stringify(o.favicon)},i.modifyVars||{});export default n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"external-remotes-plugin";import r from"webpack";import o from"webpack/lib/container/ModuleFederationPlugin.js";import{CONFIG as t}from"./common.js";let l=r.NormalModuleReplacementPlugin,a={},n={},i={};export const moduleFederation=t.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,o=e.remotes.length;r<o;r++){let o=e.remotes[r],t=o.alias||o.name,l=o.filename||"remote_entry.js";if(i[t]=`${o.name}@${o.host}/${l}`,Array.isArray(o.library))for(let e=0,r=o.library.length;e<r;e++)a[o.library[e]]=`${t}/${o.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,o=e.exposes.length;r<o;r++){let o=e.exposes[r];"string"==typeof o||Object.prototype.toString.call(o)}return new o({filename:"remote_entry.js",...e,remotes:i,exposes:n})});moduleFederation.length&&(moduleFederation.push(new e),moduleFederation.push(new l(/(.*)/,e=>{a[e.request]&&(e.request=a[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 d}from"./utils.js";let u="single-spa"===a?t:"../",f={loader:e.loader,options:{publicPath:"/"!==u?u:"../"}},y=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:await import("@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(d)],j=["components","example","mock","site","src"].map(d),$=[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:[[await import("@mapbox/rehype-prism"),{ignore:!0}],(await import("rehype-accessible-emojis")).rehypeAccessibleEmojis,await import("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{readFileSync as e}from"fs";import{join as o}from"path";import r from"url";import{hasPkg as t}from"./has-pkg.js";import{resolveProgramPath as n}from"./utils.js";import p from"./yarn-argv.js";export const __dirname=r.fileURLToPath(new URL(".",import.meta.url));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;let s=e(o(__dirname,"../package.json"),{encoding:"utf-8"});export const pkgName=JSON.parse(s).name;export const NODE_ENV=process.env.NODE_ENV;export const CUSTOMCONFIG=process.env.npm_config_config||p.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=t("react");export const hasAntd=t("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(n("package.json"),{encoding:"utf-8"}),{description:r,author:t,repository:p,eslintConfig:s,stylelint:a}=JSON.parse(o);programInfo.author="string"==typeof t?{name:t}:t,programInfo.repository="string"==typeof t?{url:p}:p,programInfo.description=r,hasEslintConfig=!!s,hasStylelintConfig=!!a}
|
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";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(t){return t?.replace(/\b\w/g,t=>t.toUpperCase()).replace(/\./g," ")}export function getIPAdress(){let t=networkInterfaces();for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];for(let t=0;t<r.length;t++){let e=r[t];if("IPv4"===e.family&&"127.0.0.1"!==e.address&&!e.address.startsWith("169.254")&&!e.internal)return e.address}}}export function resolveProgramPath(t){return path.resolve(process.cwd(),"./"+t)}export const resolveNodeModulesPath=t=>resolveProgramPath(`node_modules/${t}`);let funcTag="[object Function]",asyncTag="[object AsyncFunction]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";export function isObject(t){let e=typeof t;return null!==t&&("object"==e||"function"==e)}export function isFunction(t){if(!isObject(t))return!1;let e=Object.prototype.toString.call(t);return e==funcTag||e==asyncTag||e==genTag||e==proxyTag}
|
package/build/webpack.common.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"fs";import{join as t}from"path";import s from"add-asset-html-webpack-plugin";import n from"html-webpack-plugin";import o from"webpack";import l from"webpackbar";import{CONFIG as i,ENTRYPATH as a,PUBLICPATH as r}from"./common.js";import p from"./done.js";import m from"./envFlags.js";import c from"./html-add-entry-attr.js";import u from"./html-plugin-option.js";import{moduleFederation as d}from"./module-federation.js";import f from"./module.config.js";import{APPTYPE as g,DEV as j,hasEslintConfig as h,hasStylelintConfig as b,PACKAGENAME as y,PROGRAMPATH as w,__dirname as x}from"./process-env.js";import{seo as k}from"./seo.js";import{resolveProgramPath as C}from"./utils.js";let{DefinePlugin:v,WatchIgnorePlugin:O,SourceMapDevToolPlugin:$,AutomaticPrefetchPlugin:B}=o,T=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],A=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],S=e.readdirSync(w),F=!1,K=!1;for(let e=0,t=S.length;e<t;e++)A.includes(S[e])&&(K=!0),T.includes(S[e])&&(F=!0);F||(F=h),K||(K=b);let L=K?await import("stylelint-webpack-plugin"):null,M=F?await import("eslint-webpack-plugin"):null,P={"@":C("src")};Object.assign(P,i.alias),"library"===g&&Object.assign(P,{"@":C("site"),"@pkg":C("components"),[y]:C("components")});let R=i.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:C("library"===g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:y,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${y}`,pathinfo:!1,clean:!0,publicPath:r};let W=t(x,`../lib/packages/${a[g]}/index.js`);"single-component"===g&&(Object.assign(P,{[y]:C("umd")}),W=C(j?"example/index.ts":"src/index.ts"),outputConfig.path=C(j?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=y,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let _={main:W};i.entry&&("string"==typeof i.entry?_=i.entry:Object.keys(i.entry)&&Object.assign(_,i.entry)),i.output&&("string"==typeof i.output?outputConfig.path=i.output:Object.keys(i.output)&&Object.assign(outputConfig,i.output));let E=i.routeBaseName.split("/").filter(Boolean).length,G=Array(E).fill("..").join("/")+(E?"/":"")+"404.html",{pathSegmentsToKeep:H=E,path:J=G}=i.fixBrowserRouter||{},N={entry:_,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new B,...d,M&&new M.default({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),L&&new L.default({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new n(u),i.fixBrowserRouter&&new n({filename:J,inject:!1,templateContent:()=>`<html html><head><title>${u.title}</title><script>var pathSegmentsToKeep = ${H||E};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 s(R),"single-spa"===g&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new v(m),new O({paths:[/\.d\.ts$/]}),i.sourceMap&&new $(i.sourceMap),new l({name:"编译中",color:"#6f42c1"}),new p({done:()=>{!j&&i.seo&&k(),i.done?.()}}),...i.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:P,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:f,externals:i.externals,output:outputConfig};export default N;
|
package/build/webpack.dev.d.ts
DELETED
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 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?await import("@moneko/mock"):null,v=i?await import("@pmmmwh/react-refresh-webpack-plugin"):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",w=new Promise(l=>{r({port:p.devServer.port,stopPort:9999},(r,w)=>{let f=[];p.devServer.port!==w&&f.push(`Port ${o.yellow(p.devServer.port)} is in use, trying ${o.green(w)} instead`),p.devServer.port=w;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:w,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.HotModuleReplacementPlugin,i&&v&&new v.default,new e({compilationSuccessInfo:{messages:[`You application is running here:
|
|
2
|
-
|
|
3
|
-
local: ${o.cyan(`${k}//${p.devServer.host}:${w}${y}`)}
|
|
4
|
-
network: ${o.cyan(`${k}//${a()}:${w}${y}`)}`],notes:f},clearConsole:!0})].filter(Boolean)});l($)})});export default w;
|
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 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.optimize.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
|
/package/{build → lib}/minify.js
RENAMED
|
File without changes
|
|
File without changes
|
|
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
|