@moneko/core 3.0.0-beta.3 → 3.0.0-beta.5

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 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,4 +1,4 @@
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";import{tfc,isFunction}from"./utils";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:`
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
2
  (function(l) {
3
3
  if (l.search[1] === '/' ) {
4
4
  var decoded = l.search.slice(1).split('&').map(function(s) {
@@ -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 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 i}from"./process-env";export const coverage={};try{let m=o(i,"./coverage/clover.xml");r(m,c.R_OK);let s=new t({explicitArray:!1,async:!1}),p=e(m,{encoding:"utf-8"});s.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){}
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/envFlags.js CHANGED
@@ -1 +1 @@
1
- import i from"fs";import r from"path";import{CONFIG as e}from"./common";import{coverage as t}from"./coverage";import o from"./html-plugin-option";import{APPTYPE as s,NODE_ENV as n,PACKAGENAME as a,programInfo as f,PROGRAMPATH as c,hasAntd as m,hasReact as p}from"./process-env";import{toUpperCaseString as l}from"./utils";let g=p?require("react/package.json").version:"18",y=parseFloat(g)>=18?"react-dom/client":"react-dom",S="library"===s?"site":"src",N=!1;try{let e=r.join(c,"./src/index.ts");i.accessSync(e,i.constants.R_OK),N=e}catch(i){N=!1}let O={projectName:JSON.stringify(l(a)),projectCoverage:JSON.stringify(t),providerConfig:JSON.stringify({prefixCls:e.prefixCls,iconPrefixCls:e.prefixCls+"-icon",theme:e.theme}),fallbackCompPath:JSON.stringify(e.fallbackCompPath),ReactDOMPath:JSON.stringify(y),favicon:JSON.stringify(o.favicon),hasLocales:JSON.stringify(i.existsSync(r.join(c,`./${S}/locales`))),hasPersist:JSON.stringify(i.existsSync(r.join(c,`./${S}/persist.ts`))),layoutSider:JSON.stringify(e.layoutSider),hasAntd:JSON.stringify(m),APPTYPE:JSON.stringify(s),APPENTRY:JSON.stringify(N),programInfo:JSON.stringify({...f,routeBaseName:e.routeBaseName,designSize:e.designSize,routerMode:e.routerMode,renderMode:e.mode}),"process.env":JSON.stringify({NODE_ENV:n,iconfont:e.iconfont,...e.env})};export default O;
1
+ import i from"fs";import r from"path";import{CONFIG as e}from"./common.js";import{coverage as t}from"./coverage.js";import o from"./html-plugin-option.js";import{APPTYPE as s,NODE_ENV as n,PACKAGENAME as a,programInfo as f,PROGRAMPATH as c,hasAntd as m,hasReact as p}from"./process-env.js";import{toUpperCaseString as l}from"./utils.js";let g=p?require("react/package.json").version:"18",y=parseFloat(g)>=18?"react-dom/client":"react-dom",S="library"===s?"site":"src",N=!1;try{let e=r.join(c,"./src/index.ts");i.accessSync(e,i.constants.R_OK),N=e}catch(i){N=!1}let O={projectName:JSON.stringify(l(a)),projectCoverage:JSON.stringify(t),providerConfig:JSON.stringify({prefixCls:e.prefixCls,iconPrefixCls:e.prefixCls+"-icon",theme:e.theme}),fallbackCompPath:JSON.stringify(e.fallbackCompPath),ReactDOMPath:JSON.stringify(y),favicon:JSON.stringify(o.favicon),hasLocales:JSON.stringify(i.existsSync(r.join(c,`./${S}/locales`))),hasPersist:JSON.stringify(i.existsSync(r.join(c,`./${S}/persist.ts`))),layoutSider:JSON.stringify(e.layoutSider),hasAntd:JSON.stringify(m),APPTYPE:JSON.stringify(s),APPENTRY:JSON.stringify(N),programInfo:JSON.stringify({...f,routeBaseName:e.routeBaseName,designSize:e.designSize,routerMode:e.routerMode,renderMode:e.mode}),"process.env":JSON.stringify({NODE_ENV:n,iconfont:e.iconfont,...e.env})};export default O;
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 e}from"./process-env";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
+ 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,3 +1,3 @@
1
- import type { HtmlWebpackOption } from '../typings/global';
1
+ import type { HtmlWebpackOption } from '../typings/global.d.ts';
2
2
  declare const htmlPluginOption: HtmlWebpackOption;
3
3
  export default htmlPluginOption;
@@ -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";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;
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: {
package/build/minify.js CHANGED
@@ -1 +1 @@
1
- import e from"terser-webpack-plugin";import{merge as o}from"webpack-merge";import{swcMinifyOption as r}from"./swcrc";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)})};
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)})};
@@ -1 +1 @@
1
- import{CONFIG as i}from"./common";import o from"./html-plugin-option";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
+ 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 +1 @@
1
- import e from"external-remotes-plugin";import{NormalModuleReplacementPlugin as r}from"webpack";import t from"webpack/lib/container/ModuleFederationPlugin.js";import{CONFIG as o}from"./common";import{resolve as i}from"./utils";let a={},l={},m={};export const moduleFederation=o.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,i=t.filename||"remote_entry.js";if(m[o]=`${t.name}@${t.host}/${i}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)a[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?l[`./${t}`]=i(t):"[object Object]"===Object.prototype.toString.call(t)&&(l[`./${t.name}`]=i(t.path))}return new t({filename:"remote_entry.js",...e,remotes:m,exposes:l})});moduleFederation.length&&(moduleFederation.push(new e),moduleFederation.push(new r(/(.*)/,e=>{a[e.request]&&(e.request=a[e.request])})));
1
+ import e from"external-remotes-plugin";import{NormalModuleReplacementPlugin as r}from"webpack";import t from"webpack/lib/container/ModuleFederationPlugin.js";import{CONFIG as o}from"./common.js";import{resolve as i}from"./utils.js";let s={},a={},l={};export const moduleFederation=o.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,t=e.remotes.length;r<t;r++){let t=e.remotes[r],o=t.alias||t.name,i=t.filename||"remote_entry.js";if(l[o]=`${t.name}@${t.host}/${i}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)s[t.library[e]]=`${o}/${t.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,t=e.exposes.length;r<t;r++){let t=e.exposes[r];"string"==typeof t?a[`./${t}`]=i(t):"[object Object]"===Object.prototype.toString.call(t)&&(a[`./${t.name}`]=i(t.path))}return new t({filename:"remote_entry.js",...e,remotes:l,exposes:a})});moduleFederation.length&&(moduleFederation.push(new e),moduleFederation.push(new r(/(.*)/,e=>{s[e.request]&&(e.request=s[e.request])})));
@@ -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";import{hasPkg as r}from"./has-pkg";import l from"./modifyVars";import{APPTYPE as a,DEV as i,pkgName as c}from"./process-env";import n from"./swcrc";import p from"./tsloader.config";import{resolveNodeModulesPath as m,resolveProgramPath as u}from"./utils";let d="single-spa"===a?t:"../",f={loader:e.loader,options:{publicPath:"/"!==d?d:"../"}},y=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:require("@moneko/postcss")}};i&&(f="style-loader");let x=[...o.cssModules,c,"neko-ui"].map(m),g=[m(`${c}/lib/styles/eval/*.less`),...["src/styles/variables/*.less","src/styles/mixins/*.less","site/styles/variables/*.less","site/styles/mixins/*.less"].map(u)],$=["components","example","mock","site","src"].map(u),b=[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),h={loader:"tsc"===o.compiler?"ts-loader":"swc-loader",options:"tsc"===o.compiler?p:n(i)},j={rules:[{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{resourceQuery:/\.wasm$/,type:"webassembly/async"},{test:/\.less$/,use:b,include:$.concat(o.rulesInclude?.less?.map(m)||[])},{test:/\.css$/,use:[f,"css-loader",y,"css-unicode-loader"].filter(Boolean),include:$.concat(o.rulesInclude?.css?.map(m)||[])},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",generator:{filename:"assets/images/[name][ext][query]"},include:$.concat(o.rulesInclude?.media?.map(m)||[])},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:$.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,h].filter(Boolean),include:$.concat(o.rulesInclude?.js?.map(m)||[])},{test:/\.mdx?$/,use:[...o.prefixJsLoader,h,{loader:"@mdx-js/loader",options:{jsxImportSource:"solid-js/h",rehypePlugins:[[require("@mapbox/rehype-prism"),{ignore:!0}],require("rehype-accessible-emojis").rehypeAccessibleEmojis,require("rehype-figure")],remarkPlugins:[]}}].filter(Boolean),include:$,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...o.moduleRules]};export default j;
1
+ import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as o,PUBLICPATH as t}from"./common.js";import{hasPkg as r}from"./has-pkg.js";import l from"./modifyVars.js";import{APPTYPE as a,DEV as i,pkgName as c}from"./process-env.js";import n from"./swcrc.js";import p from"./tsloader.config.js";import{resolveNodeModulesPath as m,resolveProgramPath as u}from"./utils.js";let d="single-spa"===a?t:"../",f={loader:e.loader,options:{publicPath:"/"!==d?d:"../"}},y=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:require("@moneko/postcss")}};i&&(f="style-loader");let x=[...o.cssModules,c,"neko-ui"].map(m),g=[m(`${c}/lib/styles/eval/*.less`),...["src/styles/variables/*.less","src/styles/mixins/*.less","site/styles/variables/*.less","site/styles/mixins/*.less"].map(u)],j=["components","example","mock","site","src"].map(u),$=[f,{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=x.length;s<o;s++)if(e&&e?.includes(x[s]))return/(.*(?<!\.global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},y,"css-unicode-loader",{loader:"less-loader",options:{sourceMap:!!o.sourceMap,lessOptions:{modifyVars:l,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:g}}].filter(Boolean),b={loader:"tsc"===o.compiler?"ts-loader":"swc-loader",options:"tsc"===o.compiler?p:n(i)},h={rules:[{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{resourceQuery:/\.wasm$/,type:"webassembly/async"},{test:/\.less$/,use:$,include:j.concat(o.rulesInclude?.less?.map(m)||[])},{test:/\.css$/,use:[f,"css-loader",y,"css-unicode-loader"].filter(Boolean),include:j.concat(o.rulesInclude?.css?.map(m)||[])},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",generator:{filename:"assets/images/[name][ext][query]"},include:j.concat(o.rulesInclude?.media?.map(m)||[])},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:j.concat(o.rulesInclude?.fonts?.map(m)||[])},{test:/\.svg$/,type:"asset/inline",generator:{dataUrl:e=>s("string"!=typeof e?e.toString():e)}},{test:/\.txt$/,type:"asset/source"},{test:/\.(cj|mj|t|j)s(|x)$/,use:[...o.prefixJsLoader,b].filter(Boolean),include:j.concat(o.rulesInclude?.js?.map(m)||[])},{test:/\.mdx?$/,use:[...o.prefixJsLoader,b,{loader:"@mdx-js/loader",options:{jsxImportSource:"solid-js/h",rehypePlugins:[[require("@mapbox/rehype-prism"),{ignore:!0}],require("rehype-accessible-emojis").rehypeAccessibleEmojis,require("rehype-figure")],remarkPlugins:[]}}].filter(Boolean),include:j,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...o.moduleRules]};export default h;
@@ -1,4 +1,4 @@
1
- import type { AppType } from '../typings/global';
1
+ import type { AppType } from '../typings/global.d.ts';
2
2
  export declare const APPTYPE: AppType;
3
3
  export declare const PROGRAMPATH: string;
4
4
  export declare const PACKAGENAME: string;
@@ -1 +1 @@
1
- import{hasPkg as e}from"./has-pkg";import{resolveProgramPath as o}from"./utils";import r from"./yarn-argv";export const APPTYPE=process.env.APPTYPE;export const PROGRAMPATH=process.cwd();export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const pkgName=require("../package.json").name;export const NODE_ENV=process.env.NODE_ENV;export const CUSTOMCONFIG=process.env.npm_config_config||r.config;export const DEV="development"===process.env.NODE_ENV;export let hasEslintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_eslintConfig_")).length;export let hasStylelintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_stylelint_")).length;export const hasReact=e("react");export const hasAntd=e("antd");export const programInfo={name:PACKAGENAME,version:PACKAGEVERSION,type:APPTYPE,description:process.env.npm_package_description,author:{name:process.env.npm_package_author_name,email:process.env.npm_package_author_email,url:process.env.npm_package_author_url},repository:{type:process.env.npm_package_repository_type,url:process.env.npm_package_repository_url,directory:process.env.npm_package_repository_directory}};if(parseInt(process.versions.node)>14){let{description:e,author:r,repository:n,eslintConfig:s,stylelint:t}=require(o("package.json"));programInfo.author="string"==typeof r?{name:r}:r,programInfo.repository="string"==typeof r?{url:n}:n,programInfo.description=e,hasEslintConfig=!!s,hasStylelintConfig=!!t}
1
+ import{hasPkg as e}from"./has-pkg.js";import{resolveProgramPath as o}from"./utils.js";import r from"./yarn-argv.js";export const APPTYPE=process.env.APPTYPE;export const PROGRAMPATH=process.cwd();export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;export const pkgName=require("../package.json").name;export const NODE_ENV=process.env.NODE_ENV;export const CUSTOMCONFIG=process.env.npm_config_config||r.config;export const DEV="development"===process.env.NODE_ENV;export let hasEslintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_eslintConfig_")).length;export let hasStylelintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_stylelint_")).length;export const hasReact=e("react");export const hasAntd=e("antd");export const programInfo={name:PACKAGENAME,version:PACKAGEVERSION,type:APPTYPE,description:process.env.npm_package_description,author:{name:process.env.npm_package_author_name,email:process.env.npm_package_author_email,url:process.env.npm_package_author_url},repository:{type:process.env.npm_package_repository_type,url:process.env.npm_package_repository_url,directory:process.env.npm_package_repository_directory}};if(parseInt(process.versions.node)>14){let{description:e,author:r,repository:s,eslintConfig:n,stylelint:t}=require(o("package.json"));programInfo.author="string"==typeof r?{name:r}:r,programInfo.repository="string"==typeof r?{url:s}:s,programInfo.description=e,hasEslintConfig=!!n,hasStylelintConfig=!!t}
package/build/seo.js CHANGED
@@ -1 +1 @@
1
- import{existsSync as t,mkdirSync as o,writeFile as e,readdirSync as r,statSync as m}from"fs";import{join as p}from"path";import{CONFIG as s}from"./common";import{APPTYPE as i,PROGRAMPATH as n}from"./process-env";import{resolveProgramPath as c}from"./utils";import{outputConfig as f}from"./webpack.common";export const seo=()=>{let{domain:a,nojekyll:u,path:l}=s.seo||{};if(!a)return;let h=l&&c(l)||f?.path||process.cwd(),E=t=>{if(t)throw t};t(h)||o(h),e(p(h,"CNAME"),a,"utf-8",E),e(p(h,"robots"),`Sitemap: https://${a}${s.routeBaseName}sitemap.txt`,"utf-8",E);let x="";"library"===i&&(x=(function t(o,e,p){let s=[],i=r(o);return i.forEach(function(r){if("static"===r)return!1;let i=o+"/"+r,c=m(i);c&&c.isDirectory()?s=s.concat(t(i,e,p)):i.endsWith("README.mdx")&&s.push("https://"+e+p+i.replace(n+"/components/","").replace("/README.mdx",""))}),s})(p(n,"./components"),a,s.routeBaseName).join("\n")),e(p(h,"sitemap.txt"),x,"utf-8",E),u&&e(p(h,".nojekyll"),"","utf-8",E)};
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";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});
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});
@@ -1 +1 @@
1
- import fs from"fs";import transformerFactory from"ts-import-plugin";import merge from"webpack-merge";import{CONFIG}from"./common";import{tfc,isFunction,resolveProgramPath}from"./utils";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;
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 CHANGED
@@ -1 +1 @@
1
- import{networkInterfaces}from"os";import path from"path";import{transformFileSync}from"@swc/core";import resolverSync from"./resolver-sync";let swcOption={inputSourceMap:!1,sourceMaps:!1,module:{type:"commonjs"},jsc:{parser:{syntax:"typescript"},loose:!1}};export const tfc=filepath=>{let out=transformFileSync(filepath,swcOption).code||"{}";try{return eval(out)}catch(error){return out}};export function toUpperCaseString(e){return e?.replace(/\b\w/g,e=>e.toUpperCase()).replace(/\./g," ")}export function getIPAdress(){let e=networkInterfaces();for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];for(let e=0;e<r.length;e++){let t=r[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.address.startsWith("169.254")&&!t.internal)return t.address}}}export function resolveProgramPath(e){return path.resolve(process.cwd(),"./"+e)}export const resolveNodeModulesPath=e=>resolveProgramPath(`node_modules/${e}`);export const resolve=e=>resolverSync.resolveSync({},process.cwd(),e)||e;let funcTag="[object Function]",asyncTag="[object AsyncFunction]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";export function isObject(e){let t=typeof e;return null!==e&&("object"==t||"function"==t)}export function isFunction(e){if(!isObject(e))return!1;let t=Object.prototype.toString.call(e);return t==funcTag||t==asyncTag||t==genTag||t==proxyTag}
1
+ import{networkInterfaces}from"os";import path from"path";import{transformFileSync}from"@swc/core";import resolverSync from"./resolver-sync.js";let swcOption={inputSourceMap:!1,sourceMaps:!1,module:{type:"commonjs"},jsc:{parser:{syntax:"typescript"},loose:!1}};export const tfc=filepath=>{let out=transformFileSync(filepath,swcOption).code||"{}";try{return eval(out)}catch(error){return out}};export function toUpperCaseString(e){return e?.replace(/\b\w/g,e=>e.toUpperCase()).replace(/\./g," ")}export function getIPAdress(){let e=networkInterfaces();for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];for(let e=0;e<r.length;e++){let t=r[e];if("IPv4"===t.family&&"127.0.0.1"!==t.address&&!t.address.startsWith("169.254")&&!t.internal)return t.address}}}export function resolveProgramPath(e){return path.resolve(process.cwd(),"./"+e)}export const resolveNodeModulesPath=e=>resolveProgramPath(`node_modules/${e}`);export const resolve=e=>resolverSync.resolveSync({},process.cwd(),e)||e;let funcTag="[object Function]",asyncTag="[object AsyncFunction]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";export function isObject(e){let t=typeof e;return null!==e&&("object"==t||"function"==t)}export function isFunction(e){if(!isObject(e))return!1;let t=Object.prototype.toString.call(e);return t==funcTag||t==asyncTag||t==genTag||t==proxyTag}
@@ -1 +1 @@
1
- import e from"fs";import{join as t}from"path";import s from"url";import n from"add-asset-html-webpack-plugin";import o from"html-webpack-plugin";import{DefinePlugin as l,WatchIgnorePlugin as i,SourceMapDevToolPlugin as r,AutomaticPrefetchPlugin as a}from"webpack";import p from"webpackbar";import{CONFIG as m,ENTRYPATH as c,PUBLICPATH as u}from"./common";import f from"./done";import d from"./envFlags";import g from"./html-add-entry-attr";import h from"./html-plugin-option";import{moduleFederation as b}from"./module-federation";import y from"./module.config";import{APPTYPE as j,DEV as w,hasEslintConfig as x,hasStylelintConfig as k,PACKAGENAME as C,PROGRAMPATH as v}from"./process-env";import{seo as O}from"./seo";import{resolveProgramPath as T}from"./utils";let $=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],B=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],L=e.readdirSync(v),A=!1,R=!1;for(let e=0,t=L.length;e<t;e++)B.includes(L[e])&&(R=!0),$.includes(L[e])&&(A=!0);A||(A=x),R||(R=k);let S=R?require("stylelint-webpack-plugin"):null,F=A?require("eslint-webpack-plugin"):null,K={"@":T("src")};Object.assign(K,m.alias),"library"===j&&Object.assign(K,{"@":T("site"),"@pkg":T("components"),[C]:T("components")});let M=m.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:T("library"===j?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:C,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${C}`,pathinfo:!1,clean:!0,publicPath:u};let P=s.fileURLToPath(new URL(".",import.meta.url)),q=t(P,`../lib/packages/${c[j]}/index.js`);"single-component"===j&&(Object.assign(K,{[C]:T("umd")}),q=T(w?"example/index.ts":"src/index.ts"),outputConfig.path=T(w?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=C,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let U={main:q};m.entry&&("string"==typeof m.entry?U=m.entry:Object.keys(m.entry)&&Object.assign(U,m.entry)),m.output&&("string"==typeof m.output?outputConfig.path=m.output:Object.keys(m.output)&&Object.assign(outputConfig,m.output));let W=m.routeBaseName.split("/").filter(Boolean).length,_=Array(W).fill("..").join("/")+(W?"/":"")+"404.html",{pathSegmentsToKeep:E=W,path:G=_}=m.fixBrowserRouter||{},H={entry:U,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new a,...b,F&&new F({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),S&&new S({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new o(h),m.fixBrowserRouter&&new o({filename:G,inject:!1,templateContent:()=>`<html html><head><title>${h.title}</title><script>var pathSegmentsToKeep = ${E||W};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new n(M),"single-spa"===j&&new g(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new l(d),new i({paths:[/\.d\.ts$/]}),m.sourceMap&&new r(m.sourceMap),new p({name:"编译中",color:"#6f42c1"}),new f({done:()=>{!w&&m.seo&&O(),m.done?.()}}),...m.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:K,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:y,externals:m.externals,output:outputConfig};export default H;
1
+ import e from"fs";import{join as t}from"path";import s from"url";import n from"add-asset-html-webpack-plugin";import o from"html-webpack-plugin";import{DefinePlugin as l,WatchIgnorePlugin as i,SourceMapDevToolPlugin as r,AutomaticPrefetchPlugin as a}from"webpack";import p from"webpackbar";import{CONFIG as m,ENTRYPATH as c,PUBLICPATH as u}from"./common.js";import f from"./done.js";import d from"./envFlags.js";import g from"./html-add-entry-attr.js";import j from"./html-plugin-option.js";import{moduleFederation as h}from"./module-federation.js";import b from"./module.config.js";import{APPTYPE as y,DEV as w,hasEslintConfig as x,hasStylelintConfig as k,PACKAGENAME as C,PROGRAMPATH as v}from"./process-env";import{seo as O}from"./seo";import{resolveProgramPath as T}from"./utils";let $=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],B=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],L=e.readdirSync(v),A=!1,R=!1;for(let e=0,t=L.length;e<t;e++)B.includes(L[e])&&(R=!0),$.includes(L[e])&&(A=!0);A||(A=x),R||(R=k);let S=R?require("stylelint-webpack-plugin"):null,F=A?require("eslint-webpack-plugin"):null,K={"@":T("src")};Object.assign(K,m.alias),"library"===y&&Object.assign(K,{"@":T("site"),"@pkg":T("components"),[C]:T("components")});let M=m.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:T("library"===y?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:C,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${C}`,pathinfo:!1,clean:!0,publicPath:u};let P=s.fileURLToPath(new URL(".",import.meta.url)),q=t(P,`../lib/packages/${c[y]}/index.js`);"single-component"===y&&(Object.assign(K,{[C]:T("umd")}),q=T(w?"example/index.ts":"src/index.ts"),outputConfig.path=T(w?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=C,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let U={main:q};m.entry&&("string"==typeof m.entry?U=m.entry:Object.keys(m.entry)&&Object.assign(U,m.entry)),m.output&&("string"==typeof m.output?outputConfig.path=m.output:Object.keys(m.output)&&Object.assign(outputConfig,m.output));let W=m.routeBaseName.split("/").filter(Boolean).length,_=Array(W).fill("..").join("/")+(W?"/":"")+"404.html",{pathSegmentsToKeep:E=W,path:G=_}=m.fixBrowserRouter||{},H={entry:U,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new a,...h,F&&new F({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),S&&new S({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new o(j),m.fixBrowserRouter&&new o({filename:G,inject:!1,templateContent:()=>`<html html><head><title>${j.title}</title><script>var pathSegmentsToKeep = ${E||W};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new n(M),"single-spa"===y&&new g(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new l(d),new i({paths:[/\.d\.ts$/]}),m.sourceMap&&new r(m.sourceMap),new p({name:"编译中",color:"#6f42c1"}),new f({done:()=>{!w&&m.seo&&O(),m.done?.()}}),...m.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:K,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:b,externals:m.externals,output:outputConfig};export default H;
@@ -1,4 +1,4 @@
1
- import e from"@soda/friendly-errors-webpack-plugin";import o from"chalk";import{getPort as r}from"portfinder";import{HotModuleReplacementPlugin as t}from"webpack";import{merge as p}from"webpack-merge";import{CONFIG as s}from"./common";import{hasPkg as l}from"./has-pkg";import{hasReact as i}from"./process-env";import{getIPAdress as a,resolveProgramPath as m}from"./utils";import n from"./webpack.common";let c=l("@moneko/mock"),d=c?require("@moneko/mock").default:null,v=i?require("@pmmmwh/react-refresh-webpack-plugin").default:null,h=!1;s.cacheDirectory&&(h={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:s.cacheDirectory});let u=!1===s.devtool||s.devtool?s.devtool:"eval-cheap-module-source-map",f=new Promise(l=>{r({port:s.devServer.port,stopPort:9999},(r,f)=>{let w=[];s.devServer.port!==f&&w.push(`Port ${o.yellow(s.devServer.port)} is in use, trying ${o.green(f)} instead`),s.devServer.port=f;let g="/"===s.routeBaseName,k=s.devServer.https?"https:":"http:",y=g?"":s.routeBaseName,$=p(n,{devtool:u,mode:"development",cache:h,devServer:{headers:{"Access-Control-Allow-Origin":"*"},compress:s.devServer.compress,host:"0.0.0.0",port:f,historyApiFallback:g||{index:y,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")}},setupMiddlewares:(e,o)=>{if(!o)throw Error("webpack-dev-server is not defined");return o.app&&c&&d(o.app,m("mock/")),e},open:!1,hot:!0},plugins:[new t,i&&new v,new e({compilationSuccessInfo:{messages:[`You application is running here:
1
+ import e from"@soda/friendly-errors-webpack-plugin";import o from"chalk";import{getPort as r}from"portfinder";import{HotModuleReplacementPlugin as t}from"webpack";import{merge as s}from"webpack-merge";import{CONFIG as p}from"./common.js";import{hasPkg as l}from"./has-pkg.js";import{hasReact as i}from"./process-env.js";import{getIPAdress as a,resolveProgramPath as m}from"./utils.js";import n from"./webpack.common.js";let c=l("@moneko/mock"),d=c?require("@moneko/mock").default:null,v=i?require("@pmmmwh/react-refresh-webpack-plugin").default:null,h=!1;p.cacheDirectory&&(h={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:p.cacheDirectory});let u=!1===p.devtool||p.devtool?p.devtool:"eval-cheap-module-source-map",f=new Promise(l=>{r({port:p.devServer.port,stopPort:9999},(r,f)=>{let w=[];p.devServer.port!==f&&w.push(`Port ${o.yellow(p.devServer.port)} is in use, trying ${o.green(f)} instead`),p.devServer.port=f;let g="/"===p.routeBaseName,k=p.devServer.https?"https:":"http:",y=g?"":p.routeBaseName,$=s(n,{devtool:u,mode:"development",cache:h,devServer:{headers:{"Access-Control-Allow-Origin":"*"},compress:p.devServer.compress,host:"0.0.0.0",port:f,historyApiFallback:g||{index:y,disableDotRule:!0},https:p.devServer.https,proxy:p.proxy,allowedHosts:p.devServer.allowedHosts,client:{progress:!1,logging:"info",overlay:!1},static:{watch:{ignored:e=>e.endsWith(".d.ts")}},setupMiddlewares:(e,o)=>{if(!o)throw Error("webpack-dev-server is not defined");return o.app&&c&&d(o.app,m("mock/")),e},open:!1,hot:!0},plugins:[new t,i&&new v,new e({compilationSuccessInfo:{messages:[`You application is running here:
2
2
 
3
- local: ${o.cyan(`${k}//${s.devServer.host}:${f}${y}`)}
3
+ local: ${o.cyan(`${k}//${p.devServer.host}:${f}${y}`)}
4
4
  network: ${o.cyan(`${k}//${a()}:${f}${y}`)}`],notes:w},clearConsole:!0})].filter(Boolean)});l($)})});export default f;
@@ -1 +1 @@
1
- import e,{cssnanoMinify as i,swcMinify as n}from"css-minimizer-webpack-plugin";import m from"mini-css-extract-plugin";import o from"terser-webpack-plugin";import{optimize as r}from"webpack";import{BundleAnalyzerPlugin as t}from"webpack-bundle-analyzer";import{merge as s}from"webpack-merge";import{CONFIG as c}from"./common";import{getMinifyOption as l}from"./minify";import p from"./webpack.common";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 s(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 t(c.bundleAnalyzer),c.splitChunk&&new r.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
1
+ import e,{cssnanoMinify as i,swcMinify as n}from"css-minimizer-webpack-plugin";import m from"mini-css-extract-plugin";import o from"terser-webpack-plugin";import{optimize as r}from"webpack";import{BundleAnalyzerPlugin as s}from"webpack-bundle-analyzer";import{merge as t}from"webpack-merge";import{CONFIG as c}from"./common.js";import{getMinifyOption as l}from"./minify.js";import p from"./webpack.common.js";let a="swc"===c.compiler?"swc":"terser",u="swc"===c.compiler?"swc":"cssnano",d={splitChunks:c.splitChunk,runtimeChunk:c.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:[new o(l(c.minifier.js?.type||a,c.minifier.js?.options)),new e({minify:{swc:n,cssnano:i}[c.minifier.css?.type||u],minimizerOptions:c.minifier.css?.options})]},f=!1;c.cacheDirectory&&(f={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:c.cacheDirectory});export default t(p,{devtool:!1===c.devtool||c.devtool?c.devtool:"cheap-module-source-map",mode:"production",cache:f,optimization:d,plugins:[new m({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),c.bundleAnalyzer&&new s(c.bundleAnalyzer),c.splitChunk&&new r.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.5",
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
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",