@moneko/core 3.0.0-beta.2 → 3.0.0-beta.20
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 +12 -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 +2 -1
- 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 +1 -3
- package/lib/index.js +1 -1
- package/lib/normalize.css +4 -4
- 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 +8 -11
- package/typings/global.d.ts +2 -0
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{APPTYPE as n,CUSTOMCONFIG as i,hasReact as r,pkgName as a,PROGRAMPATH as c}from"./process-env.js";import{isFunction as p,readConf 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"===n&&(d=!1);let h={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"===n?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"!==n&&"single",moduleFederation:[],rulesInclude:{less:u,css:u,js:u,media:u,fonts:u},mdx:{jsxImportSource:r?"react":"solid-js/h",remarkPlugins:[],rehypePlugins:[]}};export const log=e=>{o.cursorTo(process.stdout,0),process.stdout.write(e)};let f=h,g=null,y={},w={};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 m(g,"index")).default;y=p(e)?e(process):e}catch(e){process.stdout.write(s.red(e))}if(i){let o=null;try{o=t.join(c,`./config/${i}.ts`),e.accessSync(o,e.constants.R_OK)}catch(e){o=null}if(null!==o)try{let e=(await m(o,i)).default;w=p(e)?e(process):e}catch(e){process.stdout.write(s.red(e))}}!1===(f=l(f,y,w)).devtool&&(f.sourceMap=!1),!1===f.sourceMap&&(f.devtool=!1),f.fixBrowserRouter&&(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};
|
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: TemplateStringsArray, ...substitutions: unknown[]): string;
|
package/build/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")}`}
|
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 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])})));
|
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 l}from"./has-pkg.js";import r from"./modifyVars.js";import{APPTYPE as a,DEV as i,pkgName 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,n,"neko-ui"].map(p),g=[p(`${n}/lib/styles/eval/*.less`),...["src/styles/variables/*.less","src/styles/mixins/*.less","site/styles/variables/*.less","site/styles/mixins/*.less"].map(d)],$=["components","example","mock","site","src"].map(d),j=[f,{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=x.length;s<o;s++)if(e&&e?.includes(x[s]))return/(.*(?<!\.global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},y,"css-unicode-loader",{loader:"less-loader",options:{sourceMap:!!o.sourceMap,lessOptions:{modifyVars:r,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:g}}].filter(Boolean),b={loader:"tsc"===o.compiler?"ts-loader":"swc-loader",options:"tsc"===o.compiler?m:c(i)},v={rules:[{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{resourceQuery:/\.wasm$/,type:"webassembly/async"},{test:/\.less$/,use:j,include:$.concat(o.rulesInclude?.less?.map(p)||[])},{test:/\.css$/,use:[f,"css-loader",y,"css-unicode-loader"].filter(Boolean),include:$.concat(o.rulesInclude?.css?.map(p)||[])},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",generator:{filename:"assets/images/[name][ext][query]"},include:$.concat(o.rulesInclude?.media?.map(p)||[])},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:$.concat(o.rulesInclude?.fonts?.map(p)||[])},{test:/\.svg$/,type:"asset/inline",generator:{dataUrl:e=>s("string"!=typeof e?e.toString():e)}},{test:/\.txt$/,type:"asset/source"},{test:/\.(cj|mj|t|j)s(|x)$/,use:[...o.prefixJsLoader,b].filter(Boolean),include:$.concat(o.rulesInclude?.js?.map(p)||[])},{test:/\.mdx?$/,use:[...o.prefixJsLoader,b,{loader:"@mdx-js/loader",options:o.mdx}].filter(Boolean),include:$,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...o.moduleRules]};export default v;
|
package/build/process-env.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
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;
|
|
7
|
+
export declare const cacheDir: string;
|
|
6
8
|
export declare const pkgName: string;
|
|
7
|
-
export declare const NODE_ENV: string;
|
|
8
|
-
export declare const CUSTOMCONFIG: string;
|
|
9
|
+
export declare const NODE_ENV: string | undefined;
|
|
10
|
+
export declare const CUSTOMCONFIG: string | undefined;
|
|
9
11
|
export declare const DEV: boolean;
|
|
10
12
|
export declare let hasEslintConfig: boolean;
|
|
11
13
|
export declare let hasStylelintConfig: boolean;
|
|
@@ -15,15 +17,15 @@ export declare const programInfo: {
|
|
|
15
17
|
name: string;
|
|
16
18
|
version: string;
|
|
17
19
|
type: AppType;
|
|
18
|
-
description: string;
|
|
20
|
+
description: string | undefined;
|
|
19
21
|
author: {
|
|
20
|
-
name: string;
|
|
21
|
-
email: string;
|
|
22
|
-
url: string;
|
|
22
|
+
name: string | undefined;
|
|
23
|
+
email: string | undefined;
|
|
24
|
+
url: string | undefined;
|
|
23
25
|
};
|
|
24
26
|
repository: {
|
|
25
|
-
type: string;
|
|
26
|
-
url: string;
|
|
27
|
-
directory: string;
|
|
27
|
+
type: string | undefined;
|
|
28
|
+
url: string | undefined;
|
|
29
|
+
directory: string | undefined;
|
|
28
30
|
};
|
|
29
31
|
};
|
package/build/process-env.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{readFileSync as e,existsSync as o,mkdirSync as r}from"fs";import{join as t}from"path";import n from"url";import{hasPkg as s}from"./has-pkg.js";import{resolveProgramPath as p}from"./utils.js";import a from"./yarn-argv.js";export const __dirname=n.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 c=e(t(__dirname,"../package.json"),{encoding:"utf-8"});export const cacheDir=t(PROGRAMPATH,"./node_modules/.cache/@moneko/cli/");o(cacheDir)||r(cacheDir,{recursive:!0});export const pkgName=JSON.parse(c).name;export const NODE_ENV=process.env.NODE_ENV;export const CUSTOMCONFIG=process.env.npm_config_config||a.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=s("react");export const hasAntd=s("antd");export const programInfo={name:PACKAGENAME,version:PACKAGEVERSION,type:APPTYPE,description:process.env.npm_package_description,author:{name:process.env.npm_package_author_name,email:process.env.npm_package_author_email,url:process.env.npm_package_author_url},repository:{type:process.env.npm_package_repository_type,url:process.env.npm_package_repository_url,directory:process.env.npm_package_repository_directory}};if(parseInt(process.versions.node)>14){let o=e(p("package.json"),{encoding:"utf-8"}),{description:r,author:t,repository:n,eslintConfig:s,stylelint:a}=JSON.parse(o);programInfo.author="string"==typeof t?{name:t}:t,programInfo.repository="string"==typeof t?{url:n}:n,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";import{hasReact as t}from"./process-env.js";let s={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((n=!1)=>{let a={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:t&&n,development:n,importSource:t?"react":"solid-js/h"},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},c=Object.assign(a,!n&&s);return o.swcrc&&(c=e(c,"function"==typeof o.swcrc?o.swcrc(n):o.swcrc)),c});
|
package/build/tsloader.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"fs";import r from"ts-import-plugin";import o from"webpack-merge";import{CONFIG as e}from"./common.js";import{isFunction as m,resolveProgramPath as s,readConf as a}from"./utils.js";let i=[];Array.isArray(e.importOnDemand)&&Object.assign(i,e.importOnDemand.map(t=>r(t)));let n=[...i],p={transpileOnly:!0,getCustomTransformers:()=>({before:n})};try{let r=s("tsloader.config.ts");t.accessSync(r,t.constants.R_OK);let e=(await a(r,"tsloader.config")).default;p=o(p,m(e)?e(process):e)}catch(t){}export default p;
|
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function tfc(filepath: string): string;
|
|
2
|
+
export declare function readConf(src: string, name: string): Promise<any>;
|
|
2
3
|
export declare function toUpperCaseString(string: string): string;
|
|
3
4
|
export declare function getIPAdress(): string | undefined | void;
|
|
4
5
|
type ProgramPath<T extends string> = `~/${T extends string ? T : string}`;
|
package/build/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{writeFileSync as e}from"fs";import{networkInterfaces as t}from"os";import r from"path";import{transformFileSync as o}from"@swc/core";import{cacheDir as n}from"./process-env.js";import s from"./resolver-sync.js";let c={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function tfc(e){return o(e,c).code||"{}"}export function readConf(t,o){let s=r.join(n,`${o}.mjs`);return e(s,tfc(t),"utf-8"),import(s)}export function toUpperCaseString(e){return e?.replace(/\b\w/g,e=>e.toUpperCase()).replace(/\./g," ")}export function getIPAdress(){let e=t();for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];for(let e=0;e<r.length;e++){let t=r[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.address.startsWith("169.254")&&!t.internal)return t.address}}}export function resolveProgramPath(e){return r.resolve(process.cwd(),"./"+e)}export const resolveNodeModulesPath=e=>resolveProgramPath(`node_modules/${e}`);export const resolve=e=>s.resolveSync({},process.cwd(),e)||e;export function isObject(e){let t=typeof e;return null!==e&&("object"==t||"function"==t)}export function isFunction(e){if(!isObject(e))return!1;let t=Object.prototype.toString.call(e);return"[object Function]"==t||"[object AsyncFunction]"==t||"[object GeneratorFunction]"==t||"[object Proxy]"==t}
|
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({fix:!0,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{
|
|
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
|
|
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 c from"./webpack.common.js";let{cssnanoMinify:l,swcMinify:p}=e,a="swc"===s.compiler?"swc":"terser",u="swc"===s.compiler?"swc":"cssnano",d={splitChunks:s.splitChunk,runtimeChunk:s.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:[new n(t(s.minifier.js?.type||a,s.minifier.js?.options)),new e({minify:{swc:p,cssnano:l}[s.minifier.css?.type||u],minimizerOptions:s.minifier.css?.options})]},f=!1;s.cacheDirectory&&(f={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.cacheDirectory});export default r(c,{devtool:!1===s.devtool||s.devtool?s.devtool:"cheap-module-source-map",mode:"production",cache:f,optimization:d,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/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,5 @@
|
|
|
1
|
-
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
1
|
import type { ConfigType, CommomType, CoverageType, ProjectCoverageType } from '../typings/global';
|
|
2
|
+
export type { ConfigType, AppType, CommomType, ProgramInfoType, MemberTransformer, CoverageType, TerserOptions, MinifierType, SourceMapDevToolPluginOptions, ProjectCoverageType, SharedConfig, SwcOptions, OptimizationSplitChunksOptions, SwcImportOnDemandTransform, Theme, } from '../typings/global';
|
|
4
3
|
export type PartialConfigType<T = 'swc'> = Partial<ConfigType<T>>;
|
|
5
4
|
export type PartialCommomType<T = 'swc'> = Partial<CommomType<T>>;
|
|
6
5
|
/** 一些项目基本信息 */
|
|
@@ -19,7 +18,6 @@ export declare const projectBasicInfo: {
|
|
|
19
18
|
type: "mobile" | "site" | "back-stage" | "single-spa" | "library";
|
|
20
19
|
author: {
|
|
21
20
|
name: string;
|
|
22
|
-
/** 一些项目基本信息 */
|
|
23
21
|
url?: string | undefined;
|
|
24
22
|
email?: string | undefined;
|
|
25
23
|
};
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var projectBasicInfo={projectName:projectName,providerConfig:providerConfig,programInfo:programInfo,coverage:projectCoverage};
|
package/lib/normalize.css
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
@import url('tailwindcss/utilities');
|
|
1
|
+
/* @import url('tailwindcss/utilities'); */
|
|
2
2
|
|
|
3
3
|
html,
|
|
4
4
|
body {
|
|
5
5
|
margin: 0;
|
|
6
6
|
padding: 0;
|
|
7
7
|
inline-size: 100vi;
|
|
8
|
-
font-size:
|
|
8
|
+
font-size: 14px;
|
|
9
9
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
10
10
|
Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
11
11
|
'Noto Color Emoji', Helvetica, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans';
|
|
12
12
|
color: var(--text-color, rgb(0 0 0 / 65%));
|
|
13
13
|
line-height: 1.8;
|
|
14
|
-
transition-duration:
|
|
14
|
+
transition-duration: 0.3s;
|
|
15
15
|
transition-property: background-color, color;
|
|
16
|
-
transition-timing-function:
|
|
16
|
+
transition-timing-function: cubic-bezier(0.94, -0.1, 0.1, 1.2);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
#root {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Router as o}from"@solidjs/router";import{render as n,createComponent as t}from"solid-js/web";import r from"@/index";function e(o){return["[object Function]","[object AsyncFunction]","[object GeneratorFunction]","[object Proxy]"].includes(Object.prototype.toString.call(o))}var i=APPENTRY?await import(APPENTRY):null,u=document.getElementById("root");i&&e(i.bootstrap)&&i.bootstrap(),window.rootInstance={unmount:function(){return null},render:function(){window.rootInstance.unmount=n(function(){return t(o,{children:r})},u)}},window.rootInstance.render(),i&&e(i.mount)&&i.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
|
|
1
|
+
function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function r(){return(r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}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&&import.meta.webpackContext){var n,o=import.meta.webpackContext("@pkg/",{recursive:!0,regExp:/README\.mdx?$/,mode:"sync"}),i={};try{i=(await import("@/components/components")).default}catch(e){}Object.assign(mdxComponents,r({},i)),null==(n=null==o?void 0:o.keys())||n.forEach(function(e){var t=e.substring(2).split("/").slice(0,-1).join("/"),n=o(e),i=n.basic,a=n.default;myPkgs.push(r({key:t,path:t,element:a},i,{props:{components:mdxComponents,path:t}}))});var a=import.meta.webpackContext("@pkg/",{recursive:!0,regExp:/\/examples\/(.+)\.mdx$/,mode:"sync"});a.keys().forEach(function(r){var t=r.substring(2).split("/"),n=t[0];Array.isArray(myDemoKv[n])||(myDemoKv[n]=[]);for(var o,i,l=a(r),c=l.matchAll(/```([^\r\n]+)?\r?\n([\s\S]*?)\r?\n```/g),p="",u="",s=null,m=function(r,t){var n="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(n)return(n=n.call(r)).next.bind(n);if(Array.isArray(r)||(n=function(r,t){if(r){if("string"==typeof r)return e(r,t);var n=Object.prototype.toString.call(r).slice(8,-1);if("Object"===n&&r.constructor&&(n=r.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(r,t)}}(r))){n&&(r=n);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.")}(c);!(i=m()).done;){var d=i.value;u=d[1]||"tsx",p=d[2],s=l.replace(d[0],"")}myDemoKv[n].push({language:u,code:p,description:s,title:null==(o=t.pop())?void 0:o.replace(/\.mdx$/,""),noInline:/render\([^\\)]*\);?(?=\s*$)/.test(p)})})}var l=[];try{l=(await import("@/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=[];import.meta.webpackContext&&(p=import.meta.webpackContext("@/pages/",{recursive:!0,regExp:/\.(t|j)sx$/,mode:"lazy"}));var u=function(e){for(var r=[],t=0;t<e.length;t++)for(var n=e[t].split("/").slice(0,-1),o=r,i=0;i<n.length;i++){var a=n[i];if(""!==a){"."===a&&(a="*");var l=o;if(Array.isArray(o)){for(var c=0;c<o.length;c++)if(o[c].path===a){o=o[c].children;break}}if(l===o){var p=i===n.length-1?e[t]:n.slice(0,i+1).join("/")+"/",u={key:p=p.substring(2,p.lastIndexOf("/")),path:a,i18n:"route-"+p,children:[],alive:!1,element:lazyImport(p),hideMenu:p.includes(":"),props:{path:p}};Array.isArray(o)&&o.push(u),o=u.children}}}return r}(p.keys().map(function(e){return e.replace(/\$/g,":")}));function s(e,t,n){return void 0===e&&(e=[]),e.map(function(e){var o=r({},e);return void 0===o.key&&(o.key=c(e.path,n)),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,t,o.key):void 0),o.element||(o.element=lazyImport(o.key),o.props={path:o.key}),!!o.onlyLogin!==t||o.root?o:null}).filter(Boolean)}for(var m=[].concat(l),d=0,h=u.length;d<h;d++)!function e(t,n,o){var i,a=t.find(function(e){return e.path===n.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&&n.element&&(a.element=n.element,a.props=n.props),void 0===a.hideMenu&&(a.hideMenu="*"===a.path||a.key.includes(":")),Object.assign(a,r({},n,a)),n.children&&(!a.children&&Array.isArray(n.children)&&(a.children=n.children),null==(i=n.children)||i.forEach(function(r){e(null==a?void 0:a.children,r,null==a?void 0:a.key)}))):t.push(n)}(m,u[d]);export var onlyLoginRouter=s(m,!1);export var router=s(m,!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}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.20",
|
|
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-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
|
|
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 -D",
|
|
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 -D",
|
|
10
11
|
"build:types": "tsc && tsc --project cli.json",
|
|
11
12
|
"postbuild": "node ./copy.js ./prefix ./lib",
|
|
12
13
|
"prebuild": "rm -rf ./build && rm -rf ./lib"
|
|
@@ -16,12 +17,9 @@
|
|
|
16
17
|
"license": "MIT",
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@emotion/css": "11.11.0",
|
|
19
|
-
"@mapbox/rehype-prism": "0.8.0",
|
|
20
|
-
"@mdx-js/esbuild": "^2.3.0",
|
|
21
20
|
"@mdx-js/loader": "2.3.0",
|
|
22
|
-
"@
|
|
21
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
23
22
|
"@soda/friendly-errors-webpack-plugin": "1.8.1",
|
|
24
|
-
"@solidjs/router": "^0.8.2",
|
|
25
23
|
"@swc/core": "1.3.56",
|
|
26
24
|
"@swc/css": "0.0.20",
|
|
27
25
|
"@swc/helpers": "0.5.1",
|
|
@@ -31,8 +29,6 @@
|
|
|
31
29
|
"css-loader": "6.7.3",
|
|
32
30
|
"css-minimizer-webpack-plugin": "5.0.0",
|
|
33
31
|
"css-unicode-loader": "1.0.3",
|
|
34
|
-
"esbuild": "^0.17.19",
|
|
35
|
-
"esbuild-loader": "^3.0.1",
|
|
36
32
|
"external-remotes-plugin": "1.0.0",
|
|
37
33
|
"html-webpack-plugin": "5.5.1",
|
|
38
34
|
"less": "4.1.3",
|
|
@@ -41,8 +37,6 @@
|
|
|
41
37
|
"mini-svg-data-uri": "1.4.4",
|
|
42
38
|
"path-to-regexp": "6.2.1",
|
|
43
39
|
"portfinder": "1.0.32",
|
|
44
|
-
"rehype-accessible-emojis": "0.3.2",
|
|
45
|
-
"rehype-figure": "1.0.1",
|
|
46
40
|
"style-loader": "3.3.2",
|
|
47
41
|
"style-resources-loader": "1.5.0",
|
|
48
42
|
"swc-loader": "0.2.3",
|
|
@@ -59,6 +53,9 @@
|
|
|
59
53
|
"xml2js": "0.5.0"
|
|
60
54
|
},
|
|
61
55
|
"devDependencies": {
|
|
56
|
+
"@moneko/mock": "^1.0.9",
|
|
57
|
+
"@moneko/postcss": "^1.0.30",
|
|
58
|
+
"@solidjs/router": "^0.8.2",
|
|
62
59
|
"@swc/cli": "0.1.62",
|
|
63
60
|
"@types/mini-css-extract-plugin": "^2.5.1",
|
|
64
61
|
"@types/shelljs": "^0.8.12",
|
package/typings/global.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Options as AssetHtmlOptions } from 'add-asset-html-webpack-plugin';
|
|
3
3
|
import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
4
4
|
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
5
|
+
import type { Options as MDXOptions } from '@mdx-js/loader';
|
|
5
6
|
import type { JsMinifyOptions, Config as SwcConfig } from '@swc/core';
|
|
6
7
|
import type { CssNanoOptionsExtended } from 'css-minimizer-webpack-plugin';
|
|
7
8
|
import type { MinifyOptions } from 'terser';
|
|
@@ -255,6 +256,7 @@ export declare type ConfigType<T = 'tsc'> = {
|
|
|
255
256
|
| false;
|
|
256
257
|
/** 📦 打包完成 */
|
|
257
258
|
done?: () => void;
|
|
259
|
+
mdx?: MDXOptions;
|
|
258
260
|
};
|
|
259
261
|
export declare interface ModuleFederationOption {
|
|
260
262
|
/** 模块名称,唯一性,不能重名 */
|