@moneko/core 3.0.0-beta.0 → 3.0.0-beta.10
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/build/common.d.ts +1 -1
- package/build/common.js +12 -1
- package/build/coverage.d.ts +1 -1
- package/build/coverage.js +1 -1
- package/build/done.d.ts +10 -2
- package/build/done.js +1 -1
- package/build/envFlags.js +1 -1
- package/build/esm.d.ts +1 -0
- package/build/esm.js +1 -0
- package/build/has-pkg.js +1 -1
- package/build/html-add-entry-attr.js +1 -1
- package/build/html-plugin-option.d.ts +1 -1
- package/build/html-plugin-option.js +1 -1
- package/build/index.d.ts +2 -2
- package/build/index.js +1 -1
- package/build/minify.d.ts +3 -3
- package/build/minify.js +1 -1
- package/build/modifyVars.js +1 -1
- package/build/module-federation.d.ts +4 -3
- package/build/module-federation.js +1 -1
- package/build/module.config.js +1 -1
- package/build/process-env.d.ts +11 -10
- package/build/process-env.js +1 -1
- package/build/resolver-sync.d.ts +2 -1
- package/build/resolver-sync.js +1 -1
- package/build/seo.js +1 -1
- package/build/swcrc.js +1 -1
- package/build/tsloader.config.js +1 -1
- package/build/utils.d.ts +1 -6
- package/build/utils.js +1 -1
- package/build/webpack.common.d.ts +0 -1
- package/build/webpack.common.js +1 -1
- package/build/webpack.dev.js +4 -1
- package/build/webpack.prod.d.ts +2 -2
- package/build/webpack.prod.js +1 -1
- package/build/yarn-argv.js +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/normalize.css +1 -1
- package/lib/packages/library/bootstrap.js +1 -1
- package/lib/packages/library/index.d.ts +2 -2
- package/lib/packages/library/index.js +1 -1
- package/lib/router/index.d.ts +1 -0
- package/lib/router/index.js +1 -1
- package/package.json +7 -7
package/build/common.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppType, ConfigType } from '../typings/global';
|
|
1
|
+
import type { AppType, ConfigType } from '../typings/global.d.ts';
|
|
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/build/common.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"fs";import t from"path";import o from"readline";import s from"chalk";import{merge as l}from"webpack-merge";import n from"./esm.js";import{APPTYPE as i,CUSTOMCONFIG as r,pkgName as a,PROGRAMPATH as c}from"./process-env.js";import{tfc as p,isFunction as m}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 u=[a,"neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design"],d={chunks:"all",minSize:1024,minChunks:1};"single-component"===i&&(d=!1);let f={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"===i?375:1680,fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{},layoutSider:{},moduleRules:[],prefixJsLoader:[],cssModules:[],importOnDemand:{},proxy:[],cacheDirectory:c+"/node_modules/.temp_cache",devServer:{allowedHosts:[".baidu.com"],host:"localhost",port:3e3,https:!1,compress:!1},htmlPluginOption:{template:`./node_modules/${a}/template/index.html`,favicon:`./node_modules/${a}/template/favicon.ico`,tags:[]},assetHtml:[],routerMode:"browser",fixBrowserRouter:!1,plugins:[],splitChunk:d,runtimeChunk:"single-component"!==i&&"single",moduleFederation:[],rulesInclude:{less:u,css:u,js:u,media:u,fonts:u}};export const log=e=>{o.cursorTo(process.stdout,0),process.stdout.write(e)};let h=f,g=null,w={},y={};try{g=t.join(c,"./config/index.ts"),e.accessSync(g,e.constants.R_OK)}catch(e){g=null}if(g)try{let e=(await import(n`${p(g)}`)).default;w=m(e)?e(process):e}catch(e){process.stdout.write(s.red(e))}if(r){let o=null;try{o=t.join(c,`./config/${r}.ts`),e.accessSync(o,e.constants.R_OK)}catch(e){o=null}if(null!==o)try{let e=(await import(n`${p(o)}`)).default;y=m(e)?e(process):e}catch(e){process.stdout.write(s.red(e))}}!1===(h=l(h,w,y)).devtool&&(h.sourceMap=!1),!1===h.sourceMap&&(h.devtool=!1),h.fixBrowserRouter&&(h.htmlPluginOption.tags||(h.htmlPluginOption.tags=[]),h.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=h;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,log};
|
package/build/coverage.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CoverageType, ProjectCoverageType } from '../typings/global';
|
|
1
|
+
import type { CoverageType, ProjectCoverageType } from '../typings/global.d.ts';
|
|
2
2
|
export declare const coverage: Record<string, CoverageType & Partial<ProjectCoverageType>>;
|
package/build/coverage.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync as
|
|
1
|
+
import{readFileSync as e,accessSync as r,constants 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");r(i,c.R_OK);let m=new t({explicitArray:!1,async:!1}),p=e(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/done.d.ts
CHANGED
|
@@ -2,7 +2,15 @@ declare class DoneWebpackPlugin {
|
|
|
2
2
|
options: {
|
|
3
3
|
done?: () => void;
|
|
4
4
|
};
|
|
5
|
-
constructor(options:
|
|
6
|
-
|
|
5
|
+
constructor(options: {
|
|
6
|
+
done?: () => void;
|
|
7
|
+
});
|
|
8
|
+
apply(compiler: {
|
|
9
|
+
hooks: {
|
|
10
|
+
done: {
|
|
11
|
+
tap: (arg0: string, arg1: () => void) => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}): void;
|
|
7
15
|
}
|
|
8
16
|
export default DoneWebpackPlugin;
|
package/build/done.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import i from"fs";import r from"path";import{CONFIG as t}from"./common.js";import{coverage as e}from"./coverage.js";import o from"./html-plugin-option.js";import{APPTYPE as s,NODE_ENV as n,PACKAGENAME as f,programInfo as a,PROGRAMPATH as c,hasAntd as m}from"./process-env.js";import{toUpperCaseString as p}from"./utils.js";let l="library"===s?"site":"src",g=!1;try{let t=r.join(c,"./src/index.ts");i.accessSync(t,i.constants.R_OK),g=t}catch(i){g=!1}let y={projectName:JSON.stringify(p(f)),projectCoverage:JSON.stringify(e),providerConfig:JSON.stringify({prefixCls:t.prefixCls,iconPrefixCls:t.prefixCls+"-icon",theme:t.theme}),fallbackCompPath:JSON.stringify(t.fallbackCompPath),ReactDOMPath:JSON.stringify("react-dom/client"),favicon:JSON.stringify(o.favicon),hasLocales:JSON.stringify(i.existsSync(r.join(c,`./${l}/locales`))),hasPersist:JSON.stringify(i.existsSync(r.join(c,`./${l}/persist.ts`))),layoutSider:JSON.stringify(t.layoutSider),hasAntd:JSON.stringify(m),APPTYPE:JSON.stringify(s),APPENTRY:JSON.stringify(g),programInfo:JSON.stringify({...a,routeBaseName:t.routeBaseName,designSize:t.designSize,routerMode:t.routerMode,renderMode:t.mode}),"process.env":JSON.stringify({NODE_ENV:n,iconfont:t.iconfont,...t.env})};export default y;
|
package/build/esm.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function esm(templateStrings: any, ...substitutions: unknown[]): string;
|
package/build/esm.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function t(t,...a){let e=t.raw[0];for(let r=0;r<a.length;r++)e+=a[r]+t.raw[r+1];return"data:text/javascript;base64,"+btoa(e)}
|
package/build/has-pkg.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{accessSync as o,constants as r}from"fs";import t from"path";import{PROGRAMPATH as
|
|
1
|
+
import{accessSync as o,constants as r}from"fs";import t from"path";import{PROGRAMPATH as e}from"./process-env.js";export function hasPkg(m){let n=!1;try{let p=t.join(e,`./node_modules/${m}/package.json`);o(p,r.R_OK),n=!0}catch(o){n=!1}return n}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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 +1 @@
|
|
|
1
|
-
import e from"path";import{merge as t}from"webpack-merge";import{CONFIG as i}from"./common";import{PROGRAMPATH as o,PACKAGENAME as r,programInfo as a}from"./process-env";
|
|
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
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './process-env';
|
|
2
|
-
export * from './utils';
|
|
1
|
+
export * from './process-env.js';
|
|
2
|
+
export * from './utils.js';
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./process-env";export*from"./utils";
|
|
1
|
+
export*from"./process-env.js";export*from"./utils.js";
|
package/build/minify.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
2
|
-
import type { MinifierType, SwcOptions, TerserOptions } from '../typings/global';
|
|
2
|
+
import type { MinifierType, SwcOptions, TerserOptions } from '../typings/global.d.ts';
|
|
3
3
|
import type { JsMinifyOptions } from '@swc/core/types';
|
|
4
4
|
type MinifyObject = {
|
|
5
5
|
terser: {
|
|
@@ -16,10 +16,10 @@ export declare const minify: MinifyObject;
|
|
|
16
16
|
export declare const getMinifyOption: (type: MinifierType, options?: SwcOptions | TerserOptions) => ({
|
|
17
17
|
minify: typeof TerserPlugin.terserMinify;
|
|
18
18
|
terserOptions: TerserOptions;
|
|
19
|
-
extractComments?: boolean;
|
|
19
|
+
extractComments?: boolean | undefined;
|
|
20
20
|
} | {
|
|
21
21
|
minify: typeof TerserPlugin.swcMinify;
|
|
22
|
-
terserOptions?:
|
|
22
|
+
terserOptions?: JsMinifyOptions | undefined;
|
|
23
23
|
}) & {
|
|
24
24
|
terserOptions: JsMinifyOptions | import("terser").MinifyOptions;
|
|
25
25
|
};
|
package/build/minify.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"terser-webpack-plugin";import{merge as
|
|
1
|
+
import e from"terser-webpack-plugin";import{merge as o}from"webpack-merge";import{swcMinifyOption as r}from"./swcrc.js";export const minify={terser:{minify:e.terserMinify,terserOptions:{ecma:2015,parse:{},compress:{global_defs:{"@alert":"console.log"},drop_console:!0,drop_debugger:!0,pure_funcs:["console.log","console.warn","console.error","console.info"]},toplevel:!1,mangle:!0,module:!1,format:{comments:!1},ie8:!1,keep_classnames:void 0,keep_fnames:!1,safari10:!1},extractComments:!1},swc:{minify:e.swcMinify,terserOptions:r}};export const getMinifyOption=(e,r={})=>{let s=minify[e];return Object.assign(s,{terserOptions:o(s.terserOptions,r)})};
|
package/build/modifyVars.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as i}from"./common";import o from"./html-plugin-option";
|
|
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,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { NormalModuleReplacementPlugin } from 'webpack';
|
|
1
|
+
import webpack from 'webpack';
|
|
3
2
|
import ModuleFederationPlugin from 'webpack/lib/container/ModuleFederationPlugin.js';
|
|
4
|
-
|
|
3
|
+
declare const NormalModuleReplacementPlugin: typeof webpack.NormalModuleReplacementPlugin;
|
|
4
|
+
export declare const moduleFederation: (typeof ModuleFederationPlugin | typeof NormalModuleReplacementPlugin)[];
|
|
5
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import 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,n={},a={},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++)n[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:a})});moduleFederation.length&&(moduleFederation.push(new e),moduleFederation.push(new l(/(.*)/,e=>{n[e.request]&&(e.request=n[e.request])})));
|
package/build/module.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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 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.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { AppType } from '../typings/global';
|
|
1
|
+
import type { AppType } from '../typings/global.d.ts';
|
|
2
|
+
export declare const __dirname: string;
|
|
2
3
|
export declare const APPTYPE: AppType;
|
|
3
4
|
export declare const PROGRAMPATH: string;
|
|
4
5
|
export declare const PACKAGENAME: string;
|
|
5
6
|
export declare const PACKAGEVERSION: string;
|
|
6
7
|
export declare const pkgName: string;
|
|
7
|
-
export declare const NODE_ENV: string;
|
|
8
|
-
export declare const CUSTOMCONFIG: string;
|
|
8
|
+
export declare const NODE_ENV: string | undefined;
|
|
9
|
+
export declare const CUSTOMCONFIG: string | undefined;
|
|
9
10
|
export declare const DEV: boolean;
|
|
10
11
|
export declare let hasEslintConfig: boolean;
|
|
11
12
|
export declare let hasStylelintConfig: boolean;
|
|
@@ -15,15 +16,15 @@ export declare const programInfo: {
|
|
|
15
16
|
name: string;
|
|
16
17
|
version: string;
|
|
17
18
|
type: AppType;
|
|
18
|
-
description: string;
|
|
19
|
+
description: string | undefined;
|
|
19
20
|
author: {
|
|
20
|
-
name: string;
|
|
21
|
-
email: string;
|
|
22
|
-
url: string;
|
|
21
|
+
name: string | undefined;
|
|
22
|
+
email: string | undefined;
|
|
23
|
+
url: string | undefined;
|
|
23
24
|
};
|
|
24
25
|
repository: {
|
|
25
|
-
type: string;
|
|
26
|
-
url: string;
|
|
27
|
-
directory: string;
|
|
26
|
+
type: string | undefined;
|
|
27
|
+
url: string | undefined;
|
|
28
|
+
directory: string | undefined;
|
|
28
29
|
};
|
|
29
30
|
};
|
package/build/process-env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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/resolver-sync.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import enhancedResolve from 'enhanced-resolve';
|
|
1
2
|
/**
|
|
2
3
|
* @examples
|
|
3
4
|
* ```javascript
|
|
@@ -5,5 +6,5 @@
|
|
|
5
6
|
* resolverSync.resolveSync({}, process.cwd(), "react")
|
|
6
7
|
* ```
|
|
7
8
|
*/
|
|
8
|
-
declare const resolverSync:
|
|
9
|
+
declare const resolverSync: enhancedResolve.Resolver;
|
|
9
10
|
export default resolverSync;
|
package/build/resolver-sync.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"fs";import
|
|
1
|
+
import*as e from"fs";import s from"enhanced-resolve";let{CachedInputFileSystem:o,ResolverFactory:n}=s,m=n.createResolver({fileSystem:new o(e,4e3),conditionNames:["node"],extensions:[".js",".json",".node"],useSyncFileSystemCalls:!0,mainFields:["esm","module","main"]});export default m;
|
package/build/seo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as t,mkdirSync as o,writeFile as
|
|
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import{CONFIG as o}from"./common";import r from"./envFlags";
|
|
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"fs";import t from"ts-import-plugin";import o from"webpack-merge";import{CONFIG as m}from"./common.js";import e from"./esm.js";import{tfc as s,isFunction as a,resolveProgramPath as i}from"./utils.js";let p=[];Array.isArray(m.importOnDemand)&&Object.assign(p,m.importOnDemand.map(r=>t(r)));let n=[...p],f={transpileOnly:!0,getCustomTransformers:()=>({before:n})};try{let t=i("tsloader.config.ts");r.accessSync(t,r.constants.R_OK);let m=(await import(e`${s(t)}`)).default;f=o(f,a(m)?m(process):m)}catch(r){}export default f;
|
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const tfc: (filepath: string) =>
|
|
1
|
+
export declare const tfc: (filepath: string) => string;
|
|
2
2
|
export declare function toUpperCaseString(string: string): string;
|
|
3
3
|
export declare function getIPAdress(): string | undefined | void;
|
|
4
4
|
type ProgramPath<T extends string> = `~/${T extends string ? T : string}`;
|
|
@@ -13,11 +13,6 @@ export declare function resolveProgramPath<T extends string>(src: T): ProgramPat
|
|
|
13
13
|
* @returns {string} 位于项目根目录node_modules下的位置
|
|
14
14
|
*/
|
|
15
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;
|
|
21
16
|
export declare function isObject(target: unknown): target is object;
|
|
22
17
|
export declare function isFunction(target: unknown): target is (...args: unknown[]) => unknown;
|
|
23
18
|
export {};
|
package/build/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{networkInterfaces as e}from"os";import t from"path";import{transformFileSync as o}from"@swc/core";let r={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export const tfc=e=>o(e,r).code||"{}";export function toUpperCaseString(e){return e?.replace(/\b\w/g,e=>e.toUpperCase()).replace(/\./g," ")}export function getIPAdress(){let t=e();for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let o=t[e];for(let e=0;e<o.length;e++){let t=o[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.address.startsWith("169.254")&&!t.internal)return t.address}}}export function resolveProgramPath(e){return t.resolve(process.cwd(),"./"+e)}export const resolveNodeModulesPath=e=>resolveProgramPath(`node_modules/${e}`);export function isObject(e){let t=typeof e;return null!==e&&("object"==t||"function"==t)}export function isFunction(e){if(!isObject(e))return!1;let t=Object.prototype.toString.call(e);return"[object Function]"==t||"[object AsyncFunction]"==t||"[object GeneratorFunction]"==t||"[object Proxy]"==t}
|
package/build/webpack.common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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 f}from"./module-federation.js";import d 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 v}from"./utils.js";let C=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],O=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],P=e.readdirSync(w),T=!1,$=!1;for(let e=0,t=P.length;e<t;e++)O.includes(P[e])&&($=!0),C.includes(P[e])&&(T=!0);T||(T=h),$||($=b);let A=$?(await import("stylelint-webpack-plugin")).default:null,B=T?(await import("eslint-webpack-plugin")).default:null,S={"@":v("src")};Object.assign(S,i.alias),"library"===g&&Object.assign(S,{"@":v("site"),"@pkg":v("components"),[y]:v("components")});let M=i.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:v("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 F=t(x,`../lib/packages/${a[g]}/index.js`);"single-component"===g&&(Object.assign(S,{[y]:v("umd")}),F=v(j?"example/index.ts":"src/index.ts"),outputConfig.path=v(j?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=y,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let K={main:F};i.entry&&("string"==typeof i.entry?K=i.entry:Object.keys(i.entry)&&Object.assign(K,i.entry)),i.output&&("string"==typeof i.output?outputConfig.path=i.output:Object.keys(i.output)&&Object.assign(outputConfig,i.output));let L=i.routeBaseName.split("/").filter(Boolean).length,W=Array(L).fill("..").join("/")+(L?"/":"")+"404.html",{pathSegmentsToKeep:D=L,path:R=W}=i.fixBrowserRouter||{},_={entry:K,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new o.AutomaticPrefetchPlugin,...f,B&&new B({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),A&&new A({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:R,inject:!1,templateContent:()=>`<html html><head><title>${u.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 s(M),"single-spa"===g&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new o.DefinePlugin(m),new o.WatchIgnorePlugin({paths:[/\.d\.ts$/]}),i.sourceMap&&new o.SourceMapDevToolPlugin(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:S,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:d,externals:i.externals,output:outputConfig};export default _;
|
package/build/webpack.dev.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
import e from"@soda/friendly-errors-webpack-plugin";import
|
|
1
|
+
import e from"@soda/friendly-errors-webpack-plugin";import o from"chalk";import{getPort as r}from"portfinder";import t from"webpack";import{merge as s}from"webpack-merge";import{CONFIG as p}from"./common.js";import{hasPkg as i}from"./has-pkg.js";import{hasReact as l}from"./process-env.js";import{getIPAdress as a,isFunction as m,resolveProgramPath as n}from"./utils.js";import c from"./webpack.common.js";let d=i("@moneko/mock"),v=d&&await import("@moneko/mock"),h=l&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,w=!1;p.cacheDirectory&&(w={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:p.cacheDirectory});let f=!1===p.devtool||p.devtool?p.devtool:"eval-cheap-module-source-map",u=new Promise(i=>{r({port:p.devServer.port,stopPort:9999},(r,d)=>{let u=[];p.devServer.port!==d&&u.push(`Port ${o.yellow(p.devServer.port)} is in use, trying ${o.green(d)} instead`),p.devServer.port=d;let g="/"===p.routeBaseName,k=p.devServer.https?"https:":"http:",y=g?"":p.routeBaseName,$=s(c,{devtool:f,mode:"development",cache:w,devServer:{headers:{"Access-Control-Allow-Origin":"*"},compress:p.devServer.compress,host:"0.0.0.0",port:d,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&&m(v)&&v(o.app,n("mock/")),e},open:!1,hot:!0},plugins:[new t.HotModuleReplacementPlugin,l&&h&&new h,new e({compilationSuccessInfo:{messages:[`You application is running here:
|
|
2
|
+
|
|
3
|
+
local: ${o.cyan(`${k}//${p.devServer.host}:${d}${y}`)}
|
|
4
|
+
network: ${o.cyan(`${k}//${a()}:${d}${y}`)}`],notes:u},clearConsole:!0})].filter(Boolean)});i($)})});export default u;
|
package/build/webpack.prod.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const _default: Configuration;
|
|
1
|
+
import webpack from 'webpack';
|
|
2
|
+
declare const _default: webpack.Configuration;
|
|
3
3
|
export default _default;
|
package/build/webpack.prod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{cssnanoMinify as i,swcMinify as n}from"css-minimizer-webpack-plugin";import
|
|
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/build/yarn-argv.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
let e=JSON.parse(process.env.npm_config_argv||"{}")?.original,a={};e?.forEach(e=>{let r=e.split("=");Object.assign(a,{[r[0]]:r[1]||!0})});export default a;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { ConfigType, CommomType, CoverageType, ProjectCoverageType } from '../typings/global.d.ts';
|
|
1
2
|
export { pathToRegexp } from 'path-to-regexp';
|
|
2
|
-
export type { ConfigType, AppType, CommomType, ProgramInfoType, MemberTransformer, CoverageType, TerserOptions, MinifierType, SourceMapDevToolPluginOptions, ProjectCoverageType, SharedConfig, SwcOptions, OptimizationSplitChunksOptions, SwcImportOnDemandTransform, Theme, } from '../typings/global';
|
|
3
|
-
import type { ConfigType, CommomType, CoverageType, ProjectCoverageType } from '../typings/global';
|
|
3
|
+
export type { ConfigType, AppType, CommomType, ProgramInfoType, MemberTransformer, CoverageType, TerserOptions, MinifierType, SourceMapDevToolPluginOptions, ProjectCoverageType, SharedConfig, SwcOptions, OptimizationSplitChunksOptions, SwcImportOnDemandTransform, Theme, } from '../typings/global.d.ts';
|
|
4
4
|
export type PartialConfigType<T = 'swc'> = Partial<ConfigType<T>>;
|
|
5
5
|
export type PartialCommomType<T = 'swc'> = Partial<CommomType<T>>;
|
|
6
6
|
/** 一些项目基本信息 */
|
|
@@ -19,7 +19,6 @@ export declare const projectBasicInfo: {
|
|
|
19
19
|
type: "mobile" | "site" | "back-stage" | "single-spa" | "library";
|
|
20
20
|
author: {
|
|
21
21
|
name: string;
|
|
22
|
-
/** 一些项目基本信息 */
|
|
23
22
|
url?: string | undefined;
|
|
24
23
|
email?: string | undefined;
|
|
25
24
|
};
|
package/lib/normalize.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Router as t}from"@solidjs/router";import{render as n}from"solid-js/web";import o from"@/index";function e(t){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]","[object Proxy]"].includes(Object.prototype.toString.call(t))}var r=APPENTRY?require(APPENTRY):null,u=document.getElementById("root");r&&e(r.bootstrap)&&(null==r.bootstrap||r.bootstrap());var c=function(){return React.createElement(t,null,React.createElement(o,null))};window.rootInstance={unmount:function(){return null},render:function(){window.rootInstance.unmount=n(c,u)}},window.rootInstance.render(c),r&&e(r.mount)&&(null==r.mount||r.mount());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../refresh-rem";import"../../normalize.css";var r=await import("./bootstrap");export default r;
|
|
1
|
+
import"../../refresh-rem.js";import"../../normalize.css";var r=await import("./bootstrap.js");export default r;
|
package/lib/router/index.d.ts
CHANGED
package/lib/router/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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{
|
|
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{pathToRegexp as n}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 t,o,i=require.context("@pkg/",!0,/README\.mdx?$/),a={};try{a=require("@/components/components").default}catch(e){}Object.assign(mdxComponents,r({},a)),null==(t=i.keys())||t.forEach(function(e){var n=e.substring(2).split("/").slice(0,-1).join("/"),t=i(e),o=t.basic,a=t.default;myPkgs.push(r({key:n,path:n,element:a},o,{props:{components:mdxComponents,path:n}}))});var l=require.context("@pkg/",!0,/\/examples\/(.+)\.mdx$/);null==(o=l.keys())||o.forEach(function(r){var n=r.substring(2).split("/"),t=n[0];Array.isArray(myDemoKv[t])||(myDemoKv[t]=[]);for(var o,i,a=l(r),u=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.")}(u);!(i=h()).done;){var d=i.value;p=d[1]||"tsx",c=d[2],s=a.replace(d[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 u=[];try{u=require("@/router").default}catch(e){console.info("自定义路由请在 router 目录下新建 index.ts, 类型: RouterProps[]",e)}function c(e,r){return["*"===r&&"*"!==e?void 0:r,e].filter(Boolean).join("/")}var p=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 s(e,n,t){return void 0===e&&(e=[]),e.map(function(e){var o=r({},e);return void 0===o.key&&(o.key=c(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?s(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 h=[].concat(u),d=0,y=p.length;d<y;d++)!function e(n,t,o){var i,a=n.find(function(e){return e.path===t.path});a?(a.key=c(a.path,o),void 0===a.i18n&&(a.i18n="route-"+a.key),void 0===a.alive&&(a.alive=!1),void 0===a.element&&t.element&&(a.element=t.element,a.props=t.props),void 0===a.hideMenu&&(a.hideMenu="*"===a.path||a.key.includes(":")),Object.assign(a,r({},t,a)),t.children&&(!a.children&&Array.isArray(t.children)&&(a.children=t.children),null==(i=t.children)||i.forEach(function(r){e(null==a?void 0:a.children,r,null==a?void 0:a.key)}))):n.push(t)}(h,p[d]);export var onlyLoginRouter=s(h,!1);export var router=s(h,!0);export function matchUtil(e){var r={key:""};return!function t(o){for(var i=0,a=o.length;i<a;i++){if(o[i].path&&"*"!==o[i].path&&o[i].key)try{if(n(o[i].key).exec(e.substring(1))){r=o[i];return}}catch(e){}Array.isArray(o[i].children)&&t(o[i].children)}}(router),r}
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.10",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"build": "npm run build-conf && npm run build-src && npm run build:types",
|
|
8
|
-
"build-conf": "swc config -d build -C module.type=
|
|
9
|
+
"build-conf": "swc config -d build -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 --copy-files",
|
|
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",
|
|
10
11
|
"build:types": "tsc && tsc --project cli.json",
|
|
11
12
|
"postbuild": "node ./copy.js ./prefix ./lib",
|
|
@@ -17,11 +18,9 @@
|
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@emotion/css": "11.11.0",
|
|
19
20
|
"@mapbox/rehype-prism": "0.8.0",
|
|
20
|
-
"@mdx-js/esbuild": "^2.3.0",
|
|
21
21
|
"@mdx-js/loader": "2.3.0",
|
|
22
|
-
"@
|
|
22
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
23
23
|
"@soda/friendly-errors-webpack-plugin": "1.8.1",
|
|
24
|
-
"@solidjs/router": "^0.8.2",
|
|
25
24
|
"@swc/core": "1.3.56",
|
|
26
25
|
"@swc/css": "0.0.20",
|
|
27
26
|
"@swc/helpers": "0.5.1",
|
|
@@ -31,8 +30,6 @@
|
|
|
31
30
|
"css-loader": "6.7.3",
|
|
32
31
|
"css-minimizer-webpack-plugin": "5.0.0",
|
|
33
32
|
"css-unicode-loader": "1.0.3",
|
|
34
|
-
"esbuild": "^0.17.19",
|
|
35
|
-
"esbuild-loader": "^3.0.1",
|
|
36
33
|
"external-remotes-plugin": "1.0.0",
|
|
37
34
|
"html-webpack-plugin": "5.5.1",
|
|
38
35
|
"less": "4.1.3",
|
|
@@ -59,6 +56,9 @@
|
|
|
59
56
|
"xml2js": "0.5.0"
|
|
60
57
|
},
|
|
61
58
|
"devDependencies": {
|
|
59
|
+
"@moneko/mock": "^1.0.9",
|
|
60
|
+
"@moneko/postcss": "^1.0.30",
|
|
61
|
+
"@solidjs/router": "^0.8.2",
|
|
62
62
|
"@swc/cli": "0.1.62",
|
|
63
63
|
"@types/mini-css-extract-plugin": "^2.5.1",
|
|
64
64
|
"@types/shelljs": "^0.8.12",
|