@moneko/core 3.0.0-beta.6 → 3.0.0-beta.8

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/envFlags.js CHANGED
@@ -1 +1 @@
1
- import i from"fs";import r from"path";import{CONFIG as e}from"./common.js";import{coverage as t}from"./coverage.js";import o from"./html-plugin-option.js";import{APPTYPE as s,NODE_ENV as n,PACKAGENAME as a,programInfo as f,PROGRAMPATH as c,hasAntd as m,hasReact as p}from"./process-env.js";import{toUpperCaseString as l}from"./utils.js";let g=p?require("react/package.json").version:"18",y=parseFloat(g)>=18?"react-dom/client":"react-dom",S="library"===s?"site":"src",N=!1;try{let e=r.join(c,"./src/index.ts");i.accessSync(e,i.constants.R_OK),N=e}catch(i){N=!1}let O={projectName:JSON.stringify(l(a)),projectCoverage:JSON.stringify(t),providerConfig:JSON.stringify({prefixCls:e.prefixCls,iconPrefixCls:e.prefixCls+"-icon",theme:e.theme}),fallbackCompPath:JSON.stringify(e.fallbackCompPath),ReactDOMPath:JSON.stringify(y),favicon:JSON.stringify(o.favicon),hasLocales:JSON.stringify(i.existsSync(r.join(c,`./${S}/locales`))),hasPersist:JSON.stringify(i.existsSync(r.join(c,`./${S}/persist.ts`))),layoutSider:JSON.stringify(e.layoutSider),hasAntd:JSON.stringify(m),APPTYPE:JSON.stringify(s),APPENTRY:JSON.stringify(N),programInfo:JSON.stringify({...f,routeBaseName:e.routeBaseName,designSize:e.designSize,routerMode:e.routerMode,renderMode:e.mode}),"process.env":JSON.stringify({NODE_ENV:n,iconfont:e.iconfont,...e.env})};export default O;
1
+ import i from"fs";import r from"path";import{CONFIG as t}from"./common.js";import{coverage as e}from"./coverage.js";import o from"./html-plugin-option.js";import{APPTYPE as s,NODE_ENV as n,PACKAGENAME as f,programInfo as a,PROGRAMPATH as c,hasAntd as m}from"./process-env.js";import{toUpperCaseString as p}from"./utils.js";let l="library"===s?"site":"src",g=!1;try{let t=r.join(c,"./src/index.ts");i.accessSync(t,i.constants.R_OK),g=t}catch(i){g=!1}let y={projectName:JSON.stringify(p(f)),projectCoverage:JSON.stringify(e),providerConfig:JSON.stringify({prefixCls:t.prefixCls,iconPrefixCls:t.prefixCls+"-icon",theme:t.theme}),fallbackCompPath:JSON.stringify(t.fallbackCompPath),ReactDOMPath:JSON.stringify("react-dom/client"),favicon:JSON.stringify(o.favicon),hasLocales:JSON.stringify(i.existsSync(r.join(c,`./${l}/locales`))),hasPersist:JSON.stringify(i.existsSync(r.join(c,`./${l}/persist.ts`))),layoutSider:JSON.stringify(t.layoutSider),hasAntd:JSON.stringify(m),APPTYPE:JSON.stringify(s),APPENTRY:JSON.stringify(g),programInfo:JSON.stringify({...a,routeBaseName:t.routeBaseName,designSize:t.designSize,routerMode:t.routerMode,renderMode:t.mode}),"process.env":JSON.stringify({NODE_ENV:n,iconfont:t.iconfont,...t.env})};export default y;
@@ -1,4 +1,5 @@
1
- import ExternalTemplateRemotesPlugin from 'external-remotes-plugin';
2
- import { NormalModuleReplacementPlugin } from 'webpack';
1
+ import webpack from 'webpack';
3
2
  import ModuleFederationPlugin from 'webpack/lib/container/ModuleFederationPlugin.js';
4
- export declare const moduleFederation: (typeof ExternalTemplateRemotesPlugin | typeof ModuleFederationPlugin | typeof NormalModuleReplacementPlugin)[];
3
+ declare const NormalModuleReplacementPlugin: typeof webpack.NormalModuleReplacementPlugin;
4
+ export declare const moduleFederation: (typeof ModuleFederationPlugin | typeof NormalModuleReplacementPlugin)[];
5
+ export {};
@@ -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.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
+ import e from"external-remotes-plugin";import r from"webpack";import o from"webpack/lib/container/ModuleFederationPlugin.js";import{CONFIG as t}from"./common.js";let l=r.NormalModuleReplacementPlugin,n={},a={},i={};export const moduleFederation=t.moduleFederation?.map(e=>{if(Array.isArray(e.remotes))for(let r=0,o=e.remotes.length;r<o;r++){let o=e.remotes[r],t=o.alias||o.name,l=o.filename||"remote_entry.js";if(i[t]=`${o.name}@${o.host}/${l}`,Array.isArray(o.library))for(let e=0,r=o.library.length;e<r;e++)n[o.library[e]]=`${t}/${o.library[e]}`}if(Array.isArray(e.exposes))for(let r=0,o=e.exposes.length;r<o;r++){let o=e.exposes[r];"string"==typeof o||Object.prototype.toString.call(o)}return new o({filename:"remote_entry.js",...e,remotes:i,exposes:a})});moduleFederation.length&&(moduleFederation.push(new e),moduleFederation.push(new l(/(.*)/,e=>{n[e.request]&&(e.request=n[e.request])})));
@@ -1 +1 @@
1
- import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as o,PUBLICPATH as t}from"./common.js";import{hasPkg as r}from"./has-pkg.js";import l from"./modifyVars.js";import{APPTYPE as a,DEV as i,pkgName as c}from"./process-env.js";import n from"./swcrc.js";import p from"./tsloader.config.js";import{resolveNodeModulesPath as m,resolveProgramPath as 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
+ import e from"mini-css-extract-plugin";import s from"mini-svg-data-uri";import{CONFIG as o,PUBLICPATH as t}from"./common.js";import{hasPkg as r}from"./has-pkg.js";import l from"./modifyVars.js";import{APPTYPE as a,DEV as i,pkgName as c}from"./process-env.js";import n from"./swcrc.js";import p from"./tsloader.config.js";import{resolveNodeModulesPath as m,resolveProgramPath as d}from"./utils.js";let u="single-spa"===a?t:"../",f={loader:e.loader,options:{publicPath:"/"!==u?u:"../"}},y=r("@moneko/postcss")&&{loader:"postcss-loader",options:{postcssOptions:await import("@moneko/postcss")}};i&&(f="style-loader");let x=[...o.cssModules,c,"neko-ui"].map(m),g=[m(`${c}/lib/styles/eval/*.less`),...["src/styles/variables/*.less","src/styles/mixins/*.less","site/styles/variables/*.less","site/styles/mixins/*.less"].map(d)],j=["components","example","mock","site","src"].map(d),$=[f,{loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,o=x.length;s<o;s++)if(e&&e?.includes(x[s]))return/(.*(?<!\.global\.(le|c)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.global\.(le|c)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly"},importLoaders:2}},y,"css-unicode-loader",{loader:"less-loader",options:{sourceMap:!!o.sourceMap,lessOptions:{modifyVars:l,javascriptEnabled:!0}}},{loader:"style-resources-loader",options:{patterns:g}}].filter(Boolean),b={loader:"tsc"===o.compiler?"ts-loader":"swc-loader",options:"tsc"===o.compiler?p:n(i)},h={rules:[{oneOf:[{resourceQuery:/raw/,type:"asset/source"},{resourceQuery:/\.wasm$/,type:"webassembly/async"},{test:/\.less$/,use:$,include:j.concat(o.rulesInclude?.less?.map(m)||[])},{test:/\.css$/,use:[f,"css-loader",y,"css-unicode-loader"].filter(Boolean),include:j.concat(o.rulesInclude?.css?.map(m)||[])},{test:/\.(gif|png|jpe?g|ico|mp4)$/i,type:"asset",generator:{filename:"assets/images/[name][ext][query]"},include:j.concat(o.rulesInclude?.media?.map(m)||[])},{test:/\.(eot|ttf|otf|woff(|2))$/,type:"asset",generator:{filename:"assets/fonts/[name][ext][query]"},include:j.concat(o.rulesInclude?.fonts?.map(m)||[])},{test:/\.svg$/,type:"asset/inline",generator:{dataUrl:e=>s("string"!=typeof e?e.toString():e)}},{test:/\.txt$/,type:"asset/source"},{test:/\.(cj|mj|t|j)s(|x)$/,use:[...o.prefixJsLoader,b].filter(Boolean),include:j.concat(o.rulesInclude?.js?.map(m)||[])},{test:/\.mdx?$/,use:[...o.prefixJsLoader,b,{loader:"@mdx-js/loader",options:{jsxImportSource:"solid-js/h",rehypePlugins:[[await import("@mapbox/rehype-prism"),{ignore:!0}],(await import("rehype-accessible-emojis")).rehypeAccessibleEmojis,await import("rehype-figure")],remarkPlugins:[]}}].filter(Boolean),include:j,exclude:[/(.+)\/examples\/(.+).mdx?$/i]},{test:/\.mdx?$/,type:"asset/source",include:[/(.+)\/examples\/(.+).mdx?$/i]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...o.moduleRules]};export default h;
@@ -1,4 +1,5 @@
1
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;
@@ -1 +1 @@
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}
1
+ import{readFileSync as e}from"fs";import{join as o}from"path";import r from"url";import{hasPkg as t}from"./has-pkg.js";import{resolveProgramPath as n}from"./utils.js";import p from"./yarn-argv.js";export const __dirname=r.fileURLToPath(new URL(".",import.meta.url));export const APPTYPE=process.env.APPTYPE;export const PROGRAMPATH=process.cwd();export const PACKAGENAME=process.env.npm_package_name;export const PACKAGEVERSION=process.env.npm_package_version;let s=e(o(__dirname,"../package.json"),{encoding:"utf-8"});export const pkgName=JSON.parse(s).name;export const NODE_ENV=process.env.NODE_ENV;export const CUSTOMCONFIG=process.env.npm_config_config||p.config;export const DEV="development"===process.env.NODE_ENV;export let hasEslintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_eslintConfig_")).length;export let hasStylelintConfig=!!Object.keys(process.env).filter(e=>e.startsWith("npm_package_stylelint_")).length;export const hasReact=t("react");export const hasAntd=t("antd");export const programInfo={name:PACKAGENAME,version:PACKAGEVERSION,type:APPTYPE,description:process.env.npm_package_description,author:{name:process.env.npm_package_author_name,email:process.env.npm_package_author_email,url:process.env.npm_package_author_url},repository:{type:process.env.npm_package_repository_type,url:process.env.npm_package_repository_url,directory:process.env.npm_package_repository_directory}};if(parseInt(process.versions.node)>14){let o=e(n("package.json"),{encoding:"utf-8"}),{description:r,author:t,repository:p,eslintConfig:s,stylelint:a}=JSON.parse(o);programInfo.author="string"==typeof t?{name:t}:t,programInfo.repository="string"==typeof t?{url:p}:p,programInfo.description=r,hasEslintConfig=!!s,hasStylelintConfig=!!a}
@@ -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: import("enhanced-resolve").Resolver;
9
+ declare const resolverSync: enhancedResolve.Resolver;
9
10
  export default resolverSync;
@@ -1 +1 @@
1
- import*as e from"fs";import{CachedInputFileSystem as s,ResolverFactory as o}from"enhanced-resolve";let n=o.createResolver({fileSystem:new s(e,4e3),conditionNames:["node"],extensions:[".js",".json",".node"],useSyncFileSystemCalls:!0,mainFields:["esm","module","main"]});export default n;
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/utils.d.ts CHANGED
@@ -13,11 +13,6 @@ export declare function resolveProgramPath<T extends string>(src: T): ProgramPat
13
13
  * @returns {string} 位于项目根目录node_modules下的位置
14
14
  */
15
15
  export declare const resolveNodeModulesPath: <T extends string>(src: T) => `~/${`node_modules/${T extends string ? T : string}` extends infer T_1 ? T_1 extends `node_modules/${T extends string ? T : string}` ? T_1 extends string ? T_1 : string : never : never}`;
16
- /** 获取模块真实入口位置
17
- * @param {string} url 路径
18
- * @returns {string} 模块真实入口路径
19
- */
20
- export declare const resolve: (url: string) => string;
21
16
  export declare function isObject(target: unknown): target is object;
22
17
  export declare function isFunction(target: unknown): target is (...args: unknown[]) => unknown;
23
18
  export {};
package/build/utils.js CHANGED
@@ -1 +1 @@
1
- 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
+ import{networkInterfaces}from"os";import path from"path";import{transformFileSync}from"@swc/core";let swcOption={inputSourceMap:!1,sourceMaps:!1,module:{type:"commonjs"},jsc:{parser:{syntax:"typescript"},loose:!1}};export const tfc=filepath=>{let out=transformFileSync(filepath,swcOption).code||"{}";try{return eval(out)}catch(error){return out}};export function toUpperCaseString(t){return t?.replace(/\b\w/g,t=>t.toUpperCase()).replace(/\./g," ")}export function getIPAdress(){let t=networkInterfaces();for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];for(let t=0;t<r.length;t++){let e=r[t];if("IPv4"===e.family&&"127.0.0.1"!==e.address&&!e.address.startsWith("169.254")&&!e.internal)return e.address}}}export function resolveProgramPath(t){return path.resolve(process.cwd(),"./"+t)}export const resolveNodeModulesPath=t=>resolveProgramPath(`node_modules/${t}`);let funcTag="[object Function]",asyncTag="[object AsyncFunction]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";export function isObject(t){let e=typeof t;return null!==t&&("object"==e||"function"==e)}export function isFunction(t){if(!isObject(t))return!1;let e=Object.prototype.toString.call(t);return e==funcTag||e==asyncTag||e==genTag||e==proxyTag}
@@ -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.js";import f from"./done.js";import d from"./envFlags.js";import g from"./html-add-entry-attr.js";import j from"./html-plugin-option.js";import{moduleFederation as h}from"./module-federation.js";import b from"./module.config.js";import{APPTYPE as y,DEV as w,hasEslintConfig as x,hasStylelintConfig as k,PACKAGENAME as C,PROGRAMPATH as v}from"./process-env.js";import{seo as O}from"./seo.js";import{resolveProgramPath as T}from"./utils.js";let $=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],B=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],L=e.readdirSync(v),A=!1,R=!1;for(let e=0,t=L.length;e<t;e++)B.includes(L[e])&&(R=!0),$.includes(L[e])&&(A=!0);A||(A=x),R||(R=k);let S=R?require("stylelint-webpack-plugin"):null,F=A?require("eslint-webpack-plugin"):null,K={"@":T("src")};Object.assign(K,m.alias),"library"===y&&Object.assign(K,{"@":T("site"),"@pkg":T("components"),[C]:T("components")});let M=m.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:T("library"===y?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:C,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${C}`,pathinfo:!1,clean:!0,publicPath:u};let P=s.fileURLToPath(new URL(".",import.meta.url)),q=t(P,`../lib/packages/${c[y]}/index.js`);"single-component"===y&&(Object.assign(K,{[C]:T("umd")}),q=T(w?"example/index.ts":"src/index.ts"),outputConfig.path=T(w?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=C,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let U={main:q};m.entry&&("string"==typeof m.entry?U=m.entry:Object.keys(m.entry)&&Object.assign(U,m.entry)),m.output&&("string"==typeof m.output?outputConfig.path=m.output:Object.keys(m.output)&&Object.assign(outputConfig,m.output));let W=m.routeBaseName.split("/").filter(Boolean).length,_=Array(W).fill("..").join("/")+(W?"/":"")+"404.html",{pathSegmentsToKeep:E=W,path:G=_}=m.fixBrowserRouter||{},H={entry:U,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new a,...h,F&&new F({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),S&&new S({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new o(j),m.fixBrowserRouter&&new o({filename:G,inject:!1,templateContent:()=>`<html html><head><title>${j.title}</title><script>var pathSegmentsToKeep = ${E||W};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new n(M),"single-spa"===y&&new g(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new l(d),new i({paths:[/\.d\.ts$/]}),m.sourceMap&&new r(m.sourceMap),new p({name:"编译中",color:"#6f42c1"}),new f({done:()=>{!w&&m.seo&&O(),m.done?.()}}),...m.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:K,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:b,externals:m.externals,output:outputConfig};export default H;
1
+ import e from"fs";import{join as t}from"path";import s from"add-asset-html-webpack-plugin";import n from"html-webpack-plugin";import o from"webpack";import l from"webpackbar";import{CONFIG as i,ENTRYPATH as a,PUBLICPATH as r}from"./common.js";import p from"./done.js";import m from"./envFlags.js";import c from"./html-add-entry-attr.js";import u from"./html-plugin-option.js";import{moduleFederation as d}from"./module-federation.js";import f from"./module.config.js";import{APPTYPE as g,DEV as j,hasEslintConfig as h,hasStylelintConfig as b,PACKAGENAME as y,PROGRAMPATH as w,__dirname as x}from"./process-env.js";import{seo as k}from"./seo.js";import{resolveProgramPath as C}from"./utils.js";let{DefinePlugin:v,WatchIgnorePlugin:O,SourceMapDevToolPlugin:$,AutomaticPrefetchPlugin:B}=o,T=[".eslintrc.js",".eslintrc.json",".eslintrc.yaml",".eslintrc.json"],A=[".stylelintrc",".stylelintrc.json",".stylelintrc.yaml",".stylelintrc.yml",".stylelintrc.js","stylelint.config.js","stylelint.config.cjs"],S=e.readdirSync(w),F=!1,K=!1;for(let e=0,t=S.length;e<t;e++)A.includes(S[e])&&(K=!0),T.includes(S[e])&&(F=!0);F||(F=h),K||(K=b);let L=K?(await import("stylelint-webpack-plugin")).default:null,M=F?(await import("eslint-webpack-plugin")).default:null,P={"@":C("src")};Object.assign(P,i.alias),"library"===g&&Object.assign(P,{"@":C("site"),"@pkg":C("components"),[y]:C("components")});let R=i.assetHtml.map(e=>({publicPath:"",...e}));export const outputConfig={path:C("library"===g?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:"js/[name].chunk.js",assetModuleFilename:"assets/[name].[hash][ext]",library:y,libraryTarget:"window",globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${y}`,pathinfo:!1,clean:!0,publicPath:r};let W=t(x,`../lib/packages/${a[g]}/index.js`);"single-component"===g&&(Object.assign(P,{[y]:C("umd")}),W=C(j?"example/index.ts":"src/index.ts"),outputConfig.path=C(j?"dist":"umd"),outputConfig.filename="index.js",outputConfig.library=y,outputConfig.libraryTarget="umd",outputConfig.libraryExport="default");let _={main:W};i.entry&&("string"==typeof i.entry?_=i.entry:Object.keys(i.entry)&&Object.assign(_,i.entry)),i.output&&("string"==typeof i.output?outputConfig.path=i.output:Object.keys(i.output)&&Object.assign(outputConfig,i.output));let E=i.routeBaseName.split("/").filter(Boolean).length,G=Array(E).fill("..").join("/")+(E?"/":"")+"404.html",{pathSegmentsToKeep:H=E,path:J=G}=i.fixBrowserRouter||{},N={entry:_,stats:"errors-only",infrastructureLogging:{level:"none"},target:"web",plugins:[new B,...d,M&&new M({threads:!0,extensions:["js","md","mdx","cjs","ejs","mjs","jsx","ts","tsx","json","html","coffee","vue"]}),L&&new L({fix:!0,threads:!0,extensions:["css","scss","sass","less","ts","tsx","js","jsx"],exclude:["node_modules/","es/","lib/","docs/","coverage/","dist/"]}),new n(u),i.fixBrowserRouter&&new n({filename:J,inject:!1,templateContent:()=>`<html html><head><title>${u.title}</title><script>var pathSegmentsToKeep = ${H||E};var l = window.location;l.replace(l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') + l.pathname.split('/').slice(0, 1 + pathSegmentsToKeep).join('/') + '/?/' + l.pathname.slice(1).split('/').slice(pathSegmentsToKeep).join('/').replace(/&/g, '~and~') + (l.search ? '&' + l.search.slice(1).replace(/&/g, '~and~') : '') + l.hash);</script></head><body></body></html>`}),new s(R),"single-spa"===g&&new c(e=>!!(e.match(/main\.(.*)\.bundle.js$/)||e.match("main.bundle.js"))),new v(m),new O({paths:[/\.d\.ts$/]}),i.sourceMap&&new $(i.sourceMap),new l({name:"编译中",color:"#6f42c1"}),new p({done:()=>{!j&&i.seo&&k(),i.done?.()}}),...i.plugins].filter(Boolean),experiments:{topLevelAwait:!0,syncWebAssembly:!0,asyncWebAssembly:!0},resolve:{extensions:[".tsx",".ts",".js",".jsx"],alias:P,fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},module:f,externals:i.externals,output:outputConfig};export default N;
@@ -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 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:
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
2
 
3
- local: ${o.cyan(`${k}//${p.devServer.host}:${f}${y}`)}
4
- network: ${o.cyan(`${k}//${a()}:${f}${y}`)}`],notes:w},clearConsole:!0})].filter(Boolean)});l($)})});export default f;
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;
@@ -1,3 +1,3 @@
1
- import type { Configuration } from 'webpack';
2
- declare const _default: Configuration;
1
+ import webpack from 'webpack';
2
+ declare const _default: webpack.Configuration;
3
3
  export default _default;
@@ -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 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)});
1
+ import e,{cssnanoMinify as i,swcMinify as n}from"css-minimizer-webpack-plugin";import m from"mini-css-extract-plugin";import o from"terser-webpack-plugin";import r from"webpack";import{BundleAnalyzerPlugin as s}from"webpack-bundle-analyzer";import{merge as t}from"webpack-merge";import{CONFIG as c}from"./common.js";import{getMinifyOption as l}from"./minify.js";import p from"./webpack.common.js";let a="swc"===c.compiler?"swc":"terser",u="swc"===c.compiler?"swc":"cssnano",d={splitChunks:c.splitChunk,runtimeChunk:c.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,minimize:!0,minimizer:[new o(l(c.minifier.js?.type||a,c.minifier.js?.options)),new e({minify:{swc:n,cssnano:i}[c.minifier.css?.type||u],minimizerOptions:c.minifier.css?.options})]},f=!1;c.cacheDirectory&&(f={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:c.cacheDirectory});export default t(p,{devtool:!1===c.devtool||c.devtool?c.devtool:"cheap-module-source-map",mode:"production",cache:f,optimization:d,plugins:[new m({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),c.bundleAnalyzer&&new s(c.bundleAnalyzer),c.splitChunk&&new r.optimize.MinChunkSizePlugin({minChunkSize:1e4})].filter(Boolean)});
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
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
- 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.d.ts';
3
+ import type { ConfigType, CommomType, CoverageType, ProjectCoverageType } from '../typings/global.d.ts';
4
4
  export type PartialConfigType<T = 'swc'> = Partial<ConfigType<T>>;
5
5
  export type PartialCommomType<T = 'swc'> = Partial<CommomType<T>>;
6
6
  /** 一些项目基本信息 */
@@ -1,4 +1,4 @@
1
- import '../../refresh-rem';
1
+ import '../../refresh-rem.js';
2
2
  import '../../normalize.css';
3
- declare const bootstrap: typeof import("./bootstrap");
3
+ declare const bootstrap: typeof import("./bootstrap.js");
4
4
  export default bootstrap;
@@ -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;
@@ -39,6 +39,7 @@ export interface ExampleModule {
39
39
  export type MyPkg = RouterProps & {
40
40
  type: string;
41
41
  title: string;
42
+ path: string;
42
43
  subtitle?: string;
43
44
  icon?: string;
44
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.8",
4
4
  "description": "core",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -47,7 +47,7 @@
47
47
  "swc-plugin-another-transform-imports": "0.2.3",
48
48
  "ts-import-plugin": "3.0.0",
49
49
  "ts-loader": "9.4.2",
50
- "typescript": "^5.0.4",
50
+ "typescript": "5.0.4",
51
51
  "webpack": "5.76.1",
52
52
  "webpack-bundle-analyzer": "4.8.0",
53
53
  "webpack-cli": "5.1.1",
@@ -57,6 +57,7 @@
57
57
  "xml2js": "0.5.0"
58
58
  },
59
59
  "devDependencies": {
60
+ "@moneko/mock": "^1.0.9",
60
61
  "@solidjs/router": "^0.8.2",
61
62
  "@swc/cli": "0.1.62",
62
63
  "@types/mini-css-extract-plugin": "^2.5.1",