@moneko/core 3.51.6 → 3.52.1
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.d.mts +0 -1
- package/lib/config.mjs +1 -1
- package/lib/dev.d.mts +1 -1
- package/lib/dev.mjs +2 -2
- package/lib/options/modify-vars.d.mts +1 -1
- package/lib/options/modify-vars.mjs +1 -1
- package/lib/options/swcrc.mjs +1 -1
- package/lib/plugin/exposes-declararion.d.mts +6 -1
- package/lib/plugin/exposes-declararion.mjs +1 -1
- package/lib/worker/dts.d.mts +2 -0
- package/lib/worker/dts.mjs +1 -0
- package/package.json +2 -2
- package/typings/global.d.ts +4 -0
package/lib/config.d.mts
CHANGED
|
@@ -24,6 +24,5 @@ declare const normalConf: ConfigType;
|
|
|
24
24
|
declare const envConf: ConfigType;
|
|
25
25
|
declare const defaultConfig: ConfigType;
|
|
26
26
|
declare let customConf: ConfigType;
|
|
27
|
-
declare const DEV_PUBLICPATH: string;
|
|
28
27
|
export declare const CONFIG: ConfigType;
|
|
29
28
|
export declare const PUBLICPATH: string;
|
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
|
|
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
|
|
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
|
|
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(
|
|
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
|
|
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
|
|
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;
|
package/lib/options/swcrc.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import r from"../commom/paths.mjs";import{CONFIG as o}from"../config.mjs";import t,{coreJsVersion as s}from"../polyfills/polyfills.mjs";import{isDev as m,isReact as a,isSolid as l,jsxImportSource as p}from"../process-env.mjs";import i from"./reslove.mjs";let c=function(e){for(let r=0,o=Object.keys(e),t=o.length;r<t;r++)e[o[r]].transform=`${o[r]}/${e[o[r]].transform}`,e[o[r]].style&&(e[o[r]].style=`${o[r]}/${e[o[r]].style}`);return e}(o.importOnDemand||{}),n={include:t(),mode:"entry",coreJs:s};export default((t,s={})=>e({module:{type:"es6",resolveFully:!0},sync:!0,jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,refresh:a&&m,development:m,importSource:p},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[[i.transformImports,c],l&&[i.jsxDomExpressions,{...o.jsxDomExpressions,generate:t?"ssr":"dom",hydratable:t}]].filter(Boolean)}},env:o.polyfill?n:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(m):o.swcrc||{},s));
|
|
1
|
+
import{merge as e}from"webpack-merge";import r from"../commom/paths.mjs";import{CONFIG as o}from"../config.mjs";import t,{coreJsVersion as s}from"../polyfills/polyfills.mjs";import{isDev as m,isReact as a,isSolid as l,jsxImportSource as p}from"../process-env.mjs";import i from"./reslove.mjs";let c=function(e){for(let r=0,o=Object.keys(e),t=o.length;r<t;r++)e[o[r]].transform=`${o[r]}/${e[o[r]].transform}`,e[o[r]].style&&(e[o[r]].style=`${o[r]}/${e[o[r]].style}`);return e}(o.importOnDemand||{}),n={include:t(),mode:"entry",coreJs:s};export default((t,s={})=>e({module:{type:"es6",resolveFully:!0},sync:!0,jsc:{parser:{syntax:"typescript",tsx:!0,decorators:!0,dynamicImport:!0},loose:!0,target:o.polyfill?void 0:"es2017",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:o.reactJsxRuntime||"automatic",throwIfNamespace:!0,refresh:a&&m,development:m,importSource:p},optimizer:{simplify:!1}},experimental:{emitAssertForImportAttributes:!0,cacheRoot:r.swcCachePath,plugins:[[i.transformImports,c],l&&[i.jsxDomExpressions,{...o.jsxDomExpressions,generate:t?"ssr":"dom",hydratable:t}]].filter(Boolean)}},env:o.polyfill?n:void 0,sourceMaps:!0,parseMap:!0},"function"==typeof o.swcrc?o.swcrc(m):o.swcrc||{},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 {
|
|
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,11 @@ interface ModuleFederationExposesDeclarationPluginOptions {
|
|
|
9
10
|
}
|
|
10
11
|
declare const PLUGIN_NAME: string;
|
|
11
12
|
export declare class ModuleFederationExposesDeclarationPlugin {
|
|
13
|
+
private name: string;
|
|
14
|
+
private assetName: string;
|
|
15
|
+
private dts: string;
|
|
12
16
|
private option: ModuleFederationExposesDeclarationPluginOptions;
|
|
17
|
+
private worker: Worker;
|
|
13
18
|
constructor(option: ModuleFederationExposesDeclarationPluginOptions);
|
|
14
19
|
apply(compiler: Compiler);
|
|
15
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{join as
|
|
1
|
+
import{join as e,parse as t,resolve as o}from"node:path";import{fileURLToPath as s}from"node:url";import{loadFile as i}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.assetName="module-federation.d.ts",this.dts="",this.option=e,this.worker=new a(s(new URL("../worker/dts.mjs",import.meta.url))),this.worker.postMessage({options:{compilerOptions:{outFile:this.assetName},include:Object.values(e.exposes)}}),this.worker.once("message",e=>{this.dts=e,this.worker.terminate()})}apply(s){let{exposes:a}=this.option,p=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]}});s.hooks.thisCompilation.tap({name:m,stage:s.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},o=>{o.hooks.processAssets.tapPromise(m,async()=>{let s=p.map(async o=>{if(null!==await i(o.originPath)){let s=t(o.originPath);return`${n(e(this.option.name,o.name),`export * from '${t(s.dir).name}/${s.name}'`)}`}return""}),a=await Promise.all(s);a.unshift(this.dts),o.emitAsset("module-federation.d.ts",new r.sources.RawSource(a.join("\n")),{javascriptModule:!1})})})}}
|
|
@@ -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.
|
|
3
|
+
"version": "3.52.1",
|
|
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.
|
|
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",
|
package/typings/global.d.ts
CHANGED