@moneko/core 3.17.29 → 3.17.31
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/dev.mjs +1 -1
- package/lib/index.d.mts +1 -1
- package/lib/index.mjs +1 -1
- package/lib/plugin/module-federation.mjs +1 -1
- package/lib/utils/index.d.mts +0 -5
- package/lib/utils/index.mjs +1 -1
- package/package.json +1 -1
- package/lib/utils/resolver-sync.d.mts +0 -10
- package/lib/utils/resolver-sync.mjs +0 -1
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"express";import t from"multer";import o from"webpack";import i from"webpack-dev-middleware";import s from"webpack-hot-middleware";import{merge as l}from"webpack-merge";import r from"./build/server.mjs";import{commonConfig as n}from"./common.mjs";import{CONFIG as m}from"./config.mjs";import{PORT as a,devLog as c,headers as p}from"./dev/config.mjs";import f from"./dev/mock.mjs";import u from"./dev/proxy.mjs";import d from"./module.config.mjs";import h,{CUSTOMCONFIG as g}from"./paths.mjs";import{SSR as w,isLibrary as j,isReact as x}from"./process-env.mjs";import $ from"./utils/has-pkg.mjs";import{empty as k,resolveProgram as y}from"./utils/index.mjs";import b from"./utils/progress.mjs";import v from"./utils/sigint-exit.mjs";import P from"./options/reslove.mjs";import{watchFile as _}from"fs";import{spawn as S,exec as C}from"child_process";import B from"./utils/log.mjs";import M from"chalk";import{directoryExists as D,loadFileSync as G,removeDir as I}from"@moneko/utils";let{HotModuleReplacementPlugin:L,ProgressPlugin:U,WatchIgnorePlugin:A}=o,F=$("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,H=$("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,O=x&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,R=["js","jsx","ts","tsx","json","html","vue"],T=R.join(","),q=["css","scss","sass","less","ts","tsx","js","jsx"],E=q.join(","),N=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],z=new URLSearchParams({timeout:2e3,reload:!($("solid-refresh")||$("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),J=n.output.path;w&&(J=y(`${j?"docs":"dist"}/client`));let K=!!m.bar,Q=l(n,{entry:{main:[`${P.hotMiddlewareClient}?name=client&path=//localhost:${a}/__hmr__&${z}`]},output:{path:J},module:d(!1),plugins:[new L,new A({paths:[/\.d\.ts$/]}),O&&new O,H&&new H({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${T}}`,j&&`${m.alias["@pkg"]}/**/*.{${T}}`].filter(Boolean),extensions:R,exclude:N,cache:!0,cacheLocation:`${h.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),F&&new F({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${E}}`,j&&`${m.alias["@pkg"]}/**/*.{${E}}`].filter(Boolean),extensions:q,exclude:N,cache:!0,cacheLocation:`${h.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new U({handler(e,t,...o){let i=m.bar||{};b({showBar:K,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:Q.output?.path})}})].filter(Boolean)}),V=[Q];w&&V.push(l(n,r));let W=o(V);W.compilers[0].hooks.done.tap("client-log",e=>{c(null,e)});let X=e(),Y=t(),Z=i(W,{writeToDisk:!1,index:"index.html",headers:()=>p,serverSideRender:w,lastModified:!0});if(X.use(Z),X.use(s(W,{log:!1,path:"/__hmr__",heartbeat:2e3})),m.proxy&&u(X,m.proxy),D(h.mockPath)){let e=f(h.mockPath);X.use(e)}let ee=`${Q.output.path}/index.html`;X.all("/*",Y.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=Z.context.outputFileSystem,o=e?.readFileSync?.(ee);t.end(o)}});let et=X.listen(a,()=>{});function eo(){process.exit(0)}function ei(e,t){let o=G(e);t&&null!==o&&_(e,async function(){let i=G(e);o.trim().replace(/^\s*[\r\n]/gm,"")!==i?.trim().replace(/^\s*[\r\n]/gm,"")?(B(M.yellow(`检测到工程配置${M.blue(`[${t}]`)}变更, 程序即将重启...`)),C("win32"===process.platform?`netstat -ano | findstr :${a}`:`lsof -i :${a}`,(e,t,o)=>{let i=es?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):B(`未找到占用端口 ${a} 的进程`)})):B(M.gray(`未变更`))})}ei(h.configPath,"index"),ei(h.customConfigPath,g);let es="win32"===process.platform;process.on("SIGHUP",function(){Z.close(k),et.close(k),et.closeAllConnections(),function(){let e=S(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",eo)}()}),process.on("exit",function(){Z.close(k),et.close(k),et.closeAllConnections(),I(h.cachePath)}),v(eo);
|
|
1
|
+
import e from"express";import t from"multer";import o from"webpack";import i from"webpack-dev-middleware";import s from"webpack-hot-middleware";import{merge as l}from"webpack-merge";import r from"./build/server.mjs";import{commonConfig as n}from"./common.mjs";import{CONFIG as m}from"./config.mjs";import{PORT as a,devLog as c,headers as p}from"./dev/config.mjs";import f from"./dev/mock.mjs";import u from"./dev/proxy.mjs";import d from"./module.config.mjs";import h,{CUSTOMCONFIG as g}from"./paths.mjs";import{SSR as w,isLibrary as j,isReact as x}from"./process-env.mjs";import $ from"./utils/has-pkg.mjs";import{empty as k,resolveProgram as y}from"./utils/index.mjs";import b from"./utils/progress.mjs";import v from"./utils/sigint-exit.mjs";import P from"./options/reslove.mjs";import{watchFile as _}from"fs";import{spawn as S,exec as C}from"child_process";import B from"./utils/log.mjs";import M from"chalk";import{directoryExists as D,loadFileSync as G,removeDir as I}from"@moneko/utils";let{HotModuleReplacementPlugin:L,ProgressPlugin:U,WatchIgnorePlugin:A}=o,F=$("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,H=$("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,O=x&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,R=["js","jsx","ts","tsx","json","html","vue"],T=R.join(","),q=["css","scss","sass","less","ts","tsx","js","jsx"],E=q.join(","),N=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],z=new URLSearchParams({timeout:2e3,reload:!($("solid-refresh")||$("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),J=n.output.path;w&&(J=y(`${j?"docs":"dist"}/client`));let K=!!m.bar,Q=l(n,{entry:{main:[`${P.hotMiddlewareClient}?name=client&path=//localhost:${a}/__hmr__&${z}`]},output:{path:J},module:d(!1),plugins:[new L,new A({paths:[/\.d\.ts$/]}),O&&new O,H&&new H({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${T}}`,j&&`${m.alias["@pkg"]}/**/*.{${T}}`].filter(Boolean),extensions:R,exclude:N,cache:!0,cacheLocation:`${h.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),F&&new F({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${E}}`,j&&`${m.alias["@pkg"]}/**/*.{${E}}`].filter(Boolean),extensions:q,exclude:N,cache:!0,cacheLocation:`${h.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new U({handler(e,t,...o){let i=m.bar||{};b({showBar:K,percentage:e,title:i.name||"Build",color:i.color,info:o.length?`[${t}] ${o.join(" ")}`:"",output:Q.output?.path})}})].filter(Boolean)}),V=[Q];w&&V.push(l(n,r));let W=o(V);W.compilers[0].hooks.done.tap("client-log",e=>{c(null,e)});let X=e(),Y=t(),Z=i(W,{writeToDisk:!1,index:"index.html",headers:()=>p,serverSideRender:w,lastModified:!0});if(X.use(Z),X.use(s(W,{log:!1,path:"/__hmr__",heartbeat:2e3})),X.use(function(e,t,o){t.set(p),o()}),m.proxy&&u(X,m.proxy),D(h.mockPath)){let e=f(h.mockPath);X.use(e)}let ee=`${Q.output.path}/index.html`;X.all("/*",Y.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=Z.context.outputFileSystem,o=e?.readFileSync?.(ee);t.end(o)}});let et=X.listen(a,()=>{});function eo(){process.exit(0)}function ei(e,t){let o=G(e);t&&null!==o&&_(e,async function(){let i=G(e);o.trim().replace(/^\s*[\r\n]/gm,"")!==i?.trim().replace(/^\s*[\r\n]/gm,"")?(B(M.yellow(`检测到工程配置${M.blue(`[${t}]`)}变更, 程序即将重启...`)),C("win32"===process.platform?`netstat -ano | findstr :${a}`:`lsof -i :${a}`,(e,t,o)=>{let i=es?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):B(`未找到占用端口 ${a} 的进程`)})):B(M.gray(`未变更`))})}ei(h.configPath,"index"),ei(h.customConfigPath,g);let es="win32"===process.platform;process.on("SIGHUP",function(){Z.close(k),et.close(k),et.closeAllConnections(),function(){let e=S(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",eo)}()}),process.on("exit",function(){Z.close(k),et.close(k),et.closeAllConnections(),I(h.cachePath)}),v(eo);
|
package/lib/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as paths, CUSTOMCONFIG, yarnArgv, routeDir } from './paths.mjs';
|
|
2
2
|
export { APPTYPE, FRAMEWORK, PACKAGENAME, PACKAGEVERSION, coreName, isDev, isLibrary, isMicro, mainDirectory, } from './process-env.mjs';
|
|
3
|
-
export {
|
|
3
|
+
export { resolveProgram } from './utils/index.mjs';
|
|
4
4
|
export { default as log } from './utils/log.mjs';
|
|
5
5
|
export { default as hasPkg } from './utils/has-pkg.mjs';
|
|
6
6
|
export { default as osTmpDir } from './utils/os-tmp-dir.mjs';
|
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as paths,CUSTOMCONFIG,yarnArgv,routeDir}from"./paths.mjs";export{APPTYPE,FRAMEWORK,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{
|
|
1
|
+
export{default as paths,CUSTOMCONFIG,yarnArgv,routeDir}from"./paths.mjs";export{APPTYPE,FRAMEWORK,PACKAGENAME,PACKAGEVERSION,coreName,isDev,isLibrary,isMicro,mainDirectory}from"./process-env.mjs";export{resolveProgram}from"./utils/index.mjs";export{default as log}from"./utils/log.mjs";export{default as hasPkg}from"./utils/has-pkg.mjs";export{default as osTmpDir}from"./utils/os-tmp-dir.mjs";export{default as require}from"./utils/require.mjs";export{yApiMock,yApiSchemaMock}from"./dev/mock.mjs";export{getIPv4,getPort}from"./dev/net.mjs";export{default as jsxDomExpressions}from"./options/jsx-dom-expressions.mjs";export{default as splitChunk}from"./options/split-chunk.mjs";export{default as Rule}from"./rule.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack";import r from"./external-remotes.mjs";import{CONFIG as t}from"../config.mjs";import{
|
|
1
|
+
import e from"webpack";import r from"./external-remotes.mjs";import{CONFIG as t}from"../config.mjs";import o from"../utils/require.mjs";import{resolveProgram as s}from"../utils/index.mjs";let{NormalModuleReplacementPlugin:i,container:{ModuleFederationPlugin:a}}=e,m={},l={},n={},p=t.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,s=t.filename||"remote_entry.js";if(n[o]=`${t.name}@${t.host}/${s}`,Array.isArray(t.library))for(let e=0,r=t.library.length;e<r;e++)m[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.toString()}`]=o.resolve(t.startsWith(".")?s(t):t):"[object Object]"===Object.prototype.toString.call(t)&&(l[`./${t.name}`]=o.resolve(t.path.startsWith(".")?s(t.path):t.path))}return new a({filename:"remote_entry.js",...e,remotes:n,exposes:l})});p.length>0&&(p.push(new r),p.push(new i(/(.*)/,e=>{m[e.request]&&(e.request=m[e.request])})));export default p;
|
package/lib/utils/index.d.mts
CHANGED
|
@@ -10,11 +10,6 @@ export declare function resolveProgram<T extends string>(src: T): ProgramPath<T>
|
|
|
10
10
|
* @returns {string} 位于项目根目录node_modules下的位置
|
|
11
11
|
*/
|
|
12
12
|
export declare function node_modules<T extends string>(name: T): `node_modules/${T}`;
|
|
13
|
-
/** 获取模块真实入口位置
|
|
14
|
-
* @param {string} url 路径
|
|
15
|
-
* @returns {string} 模块真实入口路径
|
|
16
|
-
*/
|
|
17
|
-
export declare const realResolve: (url: string) => string;
|
|
18
13
|
export declare function isObject(target: unknown): target is object;
|
|
19
14
|
export declare function isFunction(target: unknown): target is (...args: unknown[]) => unknown;
|
|
20
15
|
export declare function empty(): void;
|
package/lib/utils/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolve as t}from"path";import e from"
|
|
1
|
+
import{resolve as t}from"path";import e from"../paths.mjs";export function toUpperCaseString(t){return t?.replaceAll(/\b\w/g,t=>t.toUpperCase()).replaceAll(/\./g," ")}export function resolveProgram(o){return t(e.programPath,`./${o}`)}export function node_modules(o){return t(e.nodeModules,`./${o}`)}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"[object Function]"===e||"[object AsyncFunction]"===e||"[object GeneratorFunction]"===e||"[object Proxy]"===e}export function empty(){}
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import enhancedResolve from 'enhanced-resolve';
|
|
2
|
-
/**
|
|
3
|
-
* @examples
|
|
4
|
-
* ```javascript
|
|
5
|
-
* // 获取 react 包入口路径,优先 esm,兜底 cjs
|
|
6
|
-
* resolverSync.resolveSync({}, process.cwd(), "react")
|
|
7
|
-
* ```
|
|
8
|
-
*/
|
|
9
|
-
declare const resolverSync: enhancedResolve.Resolver;
|
|
10
|
-
export default resolverSync;
|
|
@@ -1 +0,0 @@
|
|
|
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;
|