@moneko/core 3.51.6-beta.1 → 3.51.6-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/config.mjs CHANGED
@@ -1 +1 @@
1
- import{join as e,relative as o}from"node:path";import t from"node:process";import{fileExists as r}from"@moneko/utils";import{merge as n}from"webpack-merge";import s from"./commom/paths.mjs";import a from"./commom/require.mjs";import i from"./commom/setup-env.mjs";import l from"./options/jsx-dom-expressions.mjs";import m from"./options/split-chunk.mjs";import{isFunction as p,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{APPTYPE as d,FRAMEWORK as f,frameworkVersion as h,isCI as g,isDev as v,isLibrary as x,isMobile as j,isReact as C,jsxImportSource as P,mainDirectory as k,NODE_ENV as b,PACKAGENAME as w}from"./process-env.mjs";let O=["@app","@moneko","neko-ui",".cache/http/data","@element-plus","ant-design-vue","element-plus","element-ui","ng-zorro-antd","@mui","@du","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design","monaco-editor"];export function getConfig(e){return delete a.cache[e],new Promise(o=>{if(r(e)){let r=a(e).default;return o(p(r)?r(t):r)}return o({})})}let y=await Promise.all([i(b,d,f,[]),getConfig(s.configPath),getConfig(s.customConfigPath)]),S=y[0],M=y[1],I=y[2],z={strict:!1,devtool:v?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:"",namespace:w,moduleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]",fallbackModuleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]"},env:S,basename:"/",publicPath:"/",rem:{designSize:j?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":u(k)},C&&h<18?{"react/package.json":c("react/package.json"),"react/jsx-runtime":c("react/jsx-runtime.js"),"react/jsx-dev-runtime":c("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0},htmlPluginOption:{title:w.toLocaleUpperCase(),favicon:o(s.programPath,`${s.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:m,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:O,js:O,media:O,font:O,wasm:[]},mdx:{jsx:!1,development:v,jsxImportSource:P,providerImportSource:`@moneko/${f}/mdx`},jsxDomExpressions:l,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:g},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==f,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1},minChunkSize:1e3,compression:v,manifest:{filename:"manifest.json"},corepack:!0};x&&(z.alias=Object.assign(z.alias,{"@pkg":s.componentsPath,[w]:s.componentsPath}));let F=z;(!1===(F=n(F,M,I)).devtool||!1===F.sourceMap)&&(F.sourceMap=!1,F.devtool=!1),"true"===t.env.CODESPACES&&(F.devServer.https=!1),!1===F.devServer.https&&"darwin"===t.platform&&(F.devServer.open=!1),F.htmlPluginOption&&(F.htmlPluginOption.tags||(F.htmlPluginOption.tags=[]),F.fixBrowserRouter&&F.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}),F.manifest&&F.htmlPluginOption.tags.push({href:e(F.basename,F.manifest.filename).replaceAll(/\\/g,"/"),tag:"link",rel:"manifest"}));export const CONFIG=F;export const PUBLICPATH="auto"===CONFIG.publicPath?"":CONFIG.publicPath;
1
+ import{join as e,relative as o}from"node:path";import t from"node:process";import{fileExists as r}from"@moneko/utils";import{merge as n}from"webpack-merge";import s from"./commom/paths.mjs";import a from"./commom/require.mjs";import i from"./commom/setup-env.mjs";import l from"./options/jsx-dom-expressions.mjs";import m from"./options/split-chunk.mjs";import{isFunction as p,node_modules as c,resolveProgram as u}from"./utils/index.mjs";import{APPTYPE as d,FRAMEWORK as f,frameworkVersion as h,isCI as g,isDev as v,isLibrary as x,isMobile as j,isReact as C,jsxImportSource as P,mainDirectory as k,NODE_ENV as b,PACKAGENAME as w}from"./process-env.mjs";let O=["@app","@moneko","neko-ui",".cache/http/data","@element-plus","ant-design-vue","element-plus","element-ui","ng-zorro-antd","@mui","@du","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design","monaco-editor"];export function getConfig(e){return delete a.cache[e],new Promise(o=>{if(r(e)){let r=a(e).default;return o(p(r)?r(t):r)}return o({})})}let y=await Promise.all([i(b,d,f,[]),getConfig(s.configPath),getConfig(s.customConfigPath)]),S=y[0],M=y[1],I=y[2],z={strict:!1,devtool:v?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:"",namespace:w,moduleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]",fallbackModuleFilenameTemplate:"moneko://[namespace]/[resource-path]?[loaders]"},env:S,basename:"/",publicPath:"/",rem:{designSize:j?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:Object.assign({"@":u(k)},C&&h<18?{"react/package.json":c("react/package.json"),"react/jsx-runtime":c("react/jsx-runtime.js"),"react/jsx-dev-runtime":c("react/jsx-dev-runtime.js")}:{}),moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3,open:!0},htmlPluginOption:{title:w.toLocaleUpperCase(),favicon:o(s.programPath,`${s.corePath}/options/favicon.ico`)},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:m,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:O,js:O,media:O,font:O,wasm:[]},mdx:{jsx:!1,development:v,jsxImportSource:P,providerImportSource:`@moneko/${f}/mdx`},jsxDomExpressions:l,bar:{name:"Client",nameColor:"68",msgColor:"242",barBgColor:"15",barColor:"69",quiet:g},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==f,bundleId:"com.moneko.bid",bundles:[],stylelint:{},eslint:{lintDirtyModulesOnly:!1},minChunkSize:1e3,compression:v,manifest:{filename:"manifest.json"},corepack:!0,reactJsxRuntime:"automatic"};x&&(z.alias=Object.assign(z.alias,{"@pkg":s.componentsPath,[w]:s.componentsPath}));let F=z;(!1===(F=n(F,M,I)).devtool||!1===F.sourceMap)&&(F.sourceMap=!1,F.devtool=!1),"true"===t.env.CODESPACES&&(F.devServer.https=!1),!1===F.devServer.https&&"darwin"===t.platform&&(F.devServer.open=!1),F.htmlPluginOption&&(F.htmlPluginOption.tags||(F.htmlPluginOption.tags=[]),F.fixBrowserRouter&&F.htmlPluginOption.tags.push({textContent:"(function(l) {if (l.search[1] === '/' ) {var decoded = l.search.slice(1).split('&').map(function(s) {return s.replace(/~and~/g, '&')}).join('?');window.history.replaceState(null, null,l.pathname.slice(0, -1) + decoded + l.hash);}}(window.location))"}),F.manifest&&F.htmlPluginOption.tags.push({href:e(F.basename,F.manifest.filename).replaceAll(/\\/g,"/"),tag:"link",rel:"manifest"}));export const CONFIG=F;export const PUBLICPATH="auto"===CONFIG.publicPath?"":CONFIG.publicPath;
package/lib/dev.d.mts CHANGED
@@ -19,7 +19,7 @@ import { generateManifest } from './plugin/manifest.mjs';
19
19
  import { StylelintPlugin } from './plugin/stylelint.mjs';
20
20
  import { empty } from './utils/index.mjs';
21
21
  import { commonConfig } from './common.mjs';
22
- import { CONFIG, getConfig, PUBLICPATH } from './config.mjs';
22
+ import { CONFIG, getConfig } from './config.mjs';
23
23
  import { outputFileSystem } from './file-system.mjs';
24
24
  import type { ConfigType } from './index.mjs';
25
25
  import moduleConfig from './module.config.mjs';
package/lib/dev.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import{join as r,relative as n}from"node:path";import i from"node:process";import{URL as s}from"node:url";import{ink as a,print as m,println as l,progressBar as p}from"@moneko/utils";import c from"webpack";import f from"webpack-hot-middleware";import{merge as h}from"webpack-merge";import{diffObject as u}from"./commom/diff-object.mjs";import d,{config_files as g}from"./commom/paths.mjs";import w from"./commom/sigint-exit.mjs";import{devLog as y,PORT as j}from"./dev/config.mjs";import $ from"./dev/generate-progress-html.mjs";import v from"./dev/server.mjs";import b from"./options/reslove.mjs";import{ESLintPlugin as C}from"./plugin/eslint.mjs";import{generateManifest as x}from"./plugin/manifest.mjs";import{StylelintPlugin as _}from"./plugin/stylelint.mjs";import{empty as P}from"./utils/index.mjs";import{commonConfig as S}from"./common.mjs";import{CONFIG as k,getConfig as H,PUBLICPATH as O}from"./config.mjs";import{outputFileSystem as T}from"./file-system.mjs";import B from"./module.config.mjs";import{isLibrary as E,isReact as I,refresh as q}from"./process-env.mjs";let G=!1,L="/____progress____",N={percentage:0,info:""},R="/__hmr__",U=new URLSearchParams({name:"client",path:R.substring(1),dynamicPublicPath:!0,timeout:2e3,reload:!q,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),F=h(S,{watchOptions:{stdin:!0,aggregateTimeout:300,ignored:/node_modules\/(?!(@app)\/)/},entry:{main:[`${b.hotMiddlewareClient}?${U}`]},module:B(!1),plugins:[new c.HotModuleReplacementPlugin,new c.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app)\/)/,/\.d\.ts$/]}),new c.ProgressPlugin({handler(e,t,...o){let r=o.length?`[${t}] ${o.join(" ")}`:" ";G||(N.info=r,N.percentage=e,G=1===e);let n=k.bar;if(n){let t=n.name||"Build";n.quiet?i.stdout.write(`${r}
2
- `):(p(e||0,1,{msg:r,name:t,barColor:n.barColor,nameColor:n.nameColor,barBgColor:n.barBgColor,msgColor:n.msgColor}),1===e&&i.stdout.write("\r\x1b[2K"))}}})]});if(I){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;F.plugins.push(new e({overlay:!1}))}function J(e){let t=e.join(","),o=[n(d.programPath,`${k.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return E&&o.push(n(d.programPath,`${k.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}k.eslint&&F.plugins.push(new C({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:J(["js","jsx","ts","tsx","json","html","vue"]),...k.eslint})),k.stylelint&&F.plugins.push(new _({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.stylelintcache`,files:J(["css","scss","sass","less","ts","tsx","js","jsx"]),...k.stylelint}));let M=c(F);if(!M)throw Error("无法创建编译器");M.outputFileSystem=T;let A=M.watch(M.options.watchOptions,y);M.hooks.done.tap("client-log",e=>{y(null,e)});let K=`${k.basename}/${R}`.replace(/\/+/g,"/"),W=f(M,{log:!1,path:K,heartbeat:2e3}),z=!!k.manifest&&r(O,k.manifest.filename).replaceAll(/\\/g,"/"),D=await v({port:j,root_dir:M.options.output.path,fileSystem:M.outputFileSystem,headers:k.devServer.headers,https:k.devServer.https,host:k.devServer.host,open:k.devServer.open,basename:k.basename,onRequest(e,t){if(!t.writableEnded){if("GET"===e.method){let o=new s(`${k.devServer.https?"https":"http"}://${e.headers.host}${e.url}`);if(z&&o.pathname===z)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(x({}))),!0;if(o.pathname===L)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(N)),!0;if(!G)return t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end($(L,N)),!0;if(o.pathname===K&&"text/event-stream"===e.headers.accept)return W(e,t,P),!0}return!1}}});function Q(){i.exit(0)}D.on("close",()=>{A.close(P),W.close()});let V=await Promise.all(g.map(H)),X=h(V[0]||{},V[1]||{});g.forEach(function(t){o(t,async function(){let[o,r]=await Promise.all(g.map(H)),n=h(o||{},r||{}),s=u(X,n);1===Object.keys(s).length&&"proxy"in s?(m(a(`代理更新中...`,"yellow"),!0),m(a(`代理更新完成...`,"green"),!0),k.proxy=n.proxy,X.proxy=n.proxy,X=n):(X=n,l(a(`检测到工程配置${a(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),e(Y?`netstat -ano | findstr :${j}`:`lsof -i :${j} -t`,(e,t)=>{if(e){l(a(`查找端口 ${j} 时发生错误: ${e.message}`,"red")),l(a("请尝试手动重启程序","yellow"));return}let o=t.trim().replace(/\r\n/g,"\n").split("\n").filter(Boolean),r=Y?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!r){l(a(`未找到占用端口 ${j} 的进程, 请尝试手动重启程序`,"yellow"));return}try{i.kill(Number(r),"SIGHUP")}catch(e){l(a(`终止进程 ${r} 时发生错误: ${e.message}`,"red"))}}))})});let Y="win32"===i.platform;i.on("SIGHUP",function(){D.close(P),function(){let e=t(i.argv[0],i.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",Q)}()}),i.on("exit",function(){D.close(P)}),w(Q);
1
+ import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import{join as r,relative as n}from"node:path";import i from"node:process";import{URL as s}from"node:url";import{ink as a,print as m,println as l,progressBar as p}from"@moneko/utils";import c from"webpack";import f from"webpack-hot-middleware";import{merge as h}from"webpack-merge";import{diffObject as u}from"./commom/diff-object.mjs";import d,{config_files as g}from"./commom/paths.mjs";import w from"./commom/sigint-exit.mjs";import{devLog as y,PORT as $}from"./dev/config.mjs";import v from"./dev/generate-progress-html.mjs";import j from"./dev/server.mjs";import b from"./options/reslove.mjs";import{ESLintPlugin as C}from"./plugin/eslint.mjs";import{generateManifest as x}from"./plugin/manifest.mjs";import{StylelintPlugin as S}from"./plugin/stylelint.mjs";import{empty as P}from"./utils/index.mjs";import{commonConfig as _}from"./common.mjs";import{CONFIG as k,getConfig as H}from"./config.mjs";import{outputFileSystem as O}from"./file-system.mjs";import T from"./module.config.mjs";import{isLibrary as B,isReact as E,refresh as I}from"./process-env.mjs";let q=!1,G="/____progress____",L={percentage:0,info:""},N="/__hmr__",R=new URLSearchParams({name:"client",path:N.substring(1),dynamicPublicPath:!0,timeout:2e3,reload:!I,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),U=h(_,{output:{publicPath:`${k.devServer.https?"https":"http"}://${k.devServer.host}:${k.devServer.port}${k.basename}`},watchOptions:{stdin:!0,aggregateTimeout:300,ignored:/node_modules\/(?!(@app)\/)/},entry:{main:[`${b.hotMiddlewareClient}?${R}`]},module:T(!1),plugins:[new c.HotModuleReplacementPlugin,new c.WatchIgnorePlugin({paths:[/node_modules\/(?!(@app)\/)/,/\.d\.ts$/]}),new c.ProgressPlugin({handler(e,t,...o){let r=o.length?`[${t}] ${o.join(" ")}`:" ";q||(L.info=r,L.percentage=e,q=1===e);let n=k.bar;if(n){let t=n.name||"Build";n.quiet?i.stdout.write(`${r}
2
+ `):(p(e||0,1,{msg:r,name:t,barColor:n.barColor,nameColor:n.nameColor,barBgColor:n.barBgColor,msgColor:n.msgColor}),1===e&&i.stdout.write("\r\x1b[2K"))}}})]});if(E){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;U.plugins.push(new e({overlay:!1}))}function F(e){let t=e.join(","),o=[n(d.programPath,`${k.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return B&&o.push(n(d.programPath,`${k.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}k.eslint&&U.plugins.push(new C({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:F(["js","jsx","ts","tsx","json","html","vue"]),...k.eslint})),k.stylelint&&U.plugins.push(new S({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.stylelintcache`,files:F(["css","scss","sass","less","ts","tsx","js","jsx"]),...k.stylelint}));let J=c(U);if(!J)throw Error("无法创建编译器");J.outputFileSystem=O;let M=J.watch(J.options.watchOptions,y);J.hooks.done.tap("client-log",e=>{y(null,e)});let A=`${k.basename}/${N}`.replace(/\/+/g,"/"),K=f(J,{log:!1,path:A,heartbeat:2e3}),W=!!k.manifest&&r(k.basename,k.manifest.filename).replaceAll(/\\/g,"/"),z=await j({port:$,root_dir:J.options.output.path,fileSystem:J.outputFileSystem,headers:k.devServer.headers,https:k.devServer.https,host:k.devServer.host,open:k.devServer.open,basename:k.basename,onRequest(e,t){if(!t.writableEnded){if("GET"===e.method){let o=new s(`${k.devServer.https?"https":"http"}://${e.headers.host}${e.url}`);if(W&&o.pathname===W)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(x({}))),!0;if(o.pathname===G)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(L)),!0;if(!q)return t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end(v(G,L)),!0;if(o.pathname===A&&"text/event-stream"===e.headers.accept)return K(e,t,P),!0}return!1}}});function D(){i.exit(0)}z.on("close",()=>{M.close(P),K.close()});let Q=await Promise.all(g.map(H)),V=h(Q[0]||{},Q[1]||{});g.forEach(function(t){o(t,async function(){let[o,r]=await Promise.all(g.map(H)),n=h(o||{},r||{}),s=u(V,n);1===Object.keys(s).length&&"proxy"in s?(m(a(`代理更新中...`,"yellow"),!0),m(a(`代理更新完成...`,"green"),!0),k.proxy=n.proxy,V.proxy=n.proxy,V=n):(V=n,l(a(`检测到工程配置${a(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),e(X?`netstat -ano | findstr :${$}`:`lsof -i :${$} -t`,(e,t)=>{if(e){l(a(`查找端口 ${$} 时发生错误: ${e.message}`,"red")),l(a("请尝试手动重启程序","yellow"));return}let o=t.trim().replace(/\r\n/g,"\n").split("\n").filter(Boolean),r=X?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!r){l(a(`未找到占用端口 ${$} 的进程, 请尝试手动重启程序`,"yellow"));return}try{i.kill(Number(r),"SIGHUP")}catch(e){l(a(`终止进程 ${r} 时发生错误: ${e.message}`,"red"))}}))})});let X="win32"===i.platform;i.on("SIGHUP",function(){z.close(P),function(){let e=t(i.argv[0],i.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",D)}()}),i.on("exit",function(){z.close(P)}),w(D);
@@ -1,6 +1,6 @@
1
1
  import hasPkg from '../commom/has-pkg.mjs';
2
2
  import require from '../commom/require.mjs';
3
- import { CONFIG, PUBLICPATH } from '../config.mjs';
3
+ import { CONFIG } from '../config.mjs';
4
4
  import type { HtmlPluginOption } from '../plugin/html-plugin.mjs';
5
5
  declare const prefixCls: string;
6
6
  declare const favicon: string;
@@ -1 +1 @@
1
- import o from"../commom/has-pkg.mjs";import i from"../commom/require.mjs";import{CONFIG as e,PUBLICPATH as t}from"../config.mjs";let r=e.prefixCls||"n",s=e.htmlPluginOption?.favicon||"favicon.ico",m={"@prefix-cls":r,"@iconfont-css-prefix":`${r}-icon`,"@favicon":JSON.stringify(`${t}${s}`)},n={},c=o("antd/dist/default-theme.js");c&&Object.assign(n,{...i(c)},{"@ant-prefix":r,hack:`true;@import (optional, reference) "${i.resolve("antd/lib/style/color/colorPalette.less")}";`}),Object.assign(m,n,e.modifyVars);export default m;
1
+ import e from"../commom/has-pkg.mjs";import o from"../commom/require.mjs";import{CONFIG as i}from"../config.mjs";let t=i.prefixCls||"n",r=i.htmlPluginOption?.favicon||"favicon.ico",s={"@prefix-cls":t,"@iconfont-css-prefix":`${t}-icon`,"@favicon":JSON.stringify(`${i.basename}/${r}`.replaceAll(/\\/g,"/"))},m={},n=e("antd/dist/default-theme.js");n&&Object.assign(m,{...o(n)},{"@ant-prefix":t,hack:`true;@import (optional, reference) "${o.resolve("antd/lib/style/color/colorPalette.less")}";`}),Object.assign(s,m,i.modifyVars);export default s;
@@ -1,7 +1,8 @@
1
1
  import { join, parse, resolve } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
2
3
  import { loadFile } from '@moneko/utils';
3
4
  import webpack, { type Compilation, type Compiler } from 'webpack';
4
- import { compileDts } from '../utils/compile-dts.mjs';
5
+ import { Worker } from 'worker_threads';
5
6
  import createTypes from '../utils/create-types.mjs';
6
7
  interface ModuleFederationExposesDeclarationPluginOptions {
7
8
  name: string;
@@ -9,7 +10,9 @@ interface ModuleFederationExposesDeclarationPluginOptions {
9
10
  }
10
11
  declare const PLUGIN_NAME: string;
11
12
  export declare class ModuleFederationExposesDeclarationPlugin {
13
+ private name: string;
12
14
  private option: ModuleFederationExposesDeclarationPluginOptions;
15
+ private worker: Worker;
13
16
  constructor(option: ModuleFederationExposesDeclarationPluginOptions);
14
17
  apply(compiler: Compiler);
15
18
  }
@@ -1 +1 @@
1
- import{join as t,parse as e,resolve as o}from"node:path";import{loadFile as i}from"@moneko/utils";import s from"webpack";import{compileDts as a}from"../utils/compile-dts.mjs";import r from"../utils/create-types.mjs";let n="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(t){this.option=t}apply(p){let{exposes:m}=this.option,l=Object.keys(m).map(t=>{let e=t.replace(/\.tsx?$/i,"");return{key:t,name:e,path:o(`types/${this.option.name}/${e}.d.ts`),originPath:m[t]}}),c="module-federation.d.ts",u=a({compilerOptions:{outFile:`${c}.d.ts`},include:Object.values(m)});p.hooks.thisCompilation.tap({name:n,stage:p.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},o=>{o.hooks.processAssets.tapPromise(n,async()=>{let a=l.map(async o=>{if(null!==await i(o.originPath)){let i=e(o.originPath);return`${r(t(this.option.name,o.name),`export * from '${e(i.dir).name}/${i.name}'`)}`}return""}),n=await Promise.all(a);n.unshift(u),o.emitAsset(c,new s.sources.RawSource(n.join("\n")),{javascriptModule:!1})})})}}
1
+ import{join as e,parse as t,resolve as o}from"node:path";import{fileURLToPath as i}from"node:url";import{loadFile as s}from"@moneko/utils";import r from"webpack";import{Worker as a}from"worker_threads";import n from"../utils/create-types.mjs";let m="ModuleFederationExposesDeclarationPlugin";export class ModuleFederationExposesDeclarationPlugin{constructor(e){this.name="ModuleFederationExposesDeclarationPlugin",this.option=e,this.worker=new a(i(new URL("../worker/dts.mjs",import.meta.url)))}apply(i){let{exposes:a}=this.option,p="module-federation.d.ts",l="";this.worker.postMessage({options:{compilerOptions:{outFile:`${p}.d.ts`},include:Object.values(a)}}),this.worker.once("message",e=>{l=e}),i.hooks.shutdown.tap(this.name,()=>{this.worker.terminate()});let u=Object.keys(a).map(e=>{let t=e.replace(/\.tsx?$/i,"");return{key:e,name:t,path:o(`types/${this.option.name}/${t}.d.ts`),originPath:a[e]}});i.hooks.thisCompilation.tap({name:m,stage:i.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},o=>{o.hooks.processAssets.tapPromise(m,async()=>{let i=u.map(async o=>{if(null!==await s(o.originPath)){let i=t(o.originPath);return`${n(e(this.option.name,o.name),`export * from '${t(i.dir).name}/${i.name}'`)}`}return""}),a=await Promise.all(i);a.unshift(l),o.emitAsset(p,new r.sources.RawSource(a.join("\n")),{javascriptModule:!1})})})}}
@@ -0,0 +1,2 @@
1
+ import { parentPort } from 'worker_threads';
2
+ import { compileDts } from '../utils/compile-dts.mjs';
@@ -0,0 +1 @@
1
+ import{parentPort as r}from"worker_threads";import{compileDts as s}from"../utils/compile-dts.mjs";if(!r)throw Error("This file must be run as a worker");r.on("message",async({options:e})=>{let o=s(e);r.postMessage(o)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.51.6-beta.1",
3
+ "version": "3.51.6-beta.2",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -141,7 +141,7 @@
141
141
  "@types/stylis": "4.2.7",
142
142
  "@types/webpack-bundle-analyzer": "4.7.0",
143
143
  "@types/webpack-hot-middleware": "2.25.10",
144
- "sass": "1.91.0",
144
+ "sass": "1.92.0",
145
145
  "sass-loader": "16.0.5",
146
146
  "solid-refresh": "0.7.5",
147
147
  "stylis": "4.3.6",