@moneko/core 3.15.11 → 3.15.13

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{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import i,{CUSTOMCONFIG as a}from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as l,NODE_ENV as n,PACKAGENAME as m,isDev as p,isLibrary as c,isMobile as u,jsxImportSource as d,mainDirectory as h}from"./process-env.mjs";import{isFunction as f,resolveProgram as g}from"./utils/index.mjs";import x from"./utils/log.mjs";import P from"./utils/read-conf.mjs";import v from"./utils/setup-env.mjs";let C=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],j={devtool:p?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:v(n,r,l),basename:"/",publicPath:"/",rem:{designSize:u?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(h)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},cacheDirectory:i.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:C,js:C,media:C,font:C,wasm:[]},mdx:{jsx:!1,development:p,jsxImportSource:d,providerImportSource:`@moneko/${l}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${i.httpCachePath}/http.lock`,cacheLocation:`${i.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};c&&(j.alias=Object.assign(j.alias,{"@pkg":i.componentsPath,[m]:i.componentsPath}));let k=j,w={},b={};if(e(i.configPath)){let e=(await P(i.configPath,"index")).default;w=f(e)?e(process):e}if(a&&e(i.customConfigPath)){let e=(await P(i.customConfigPath,a)).default;b=f(e)?e(process):e}(!1===(k=o(k,w,b)).devtool||!1===k.sourceMap)&&(k.sourceMap=!1,k.devtool=!1),k.fixBrowserRouter&&k.htmlPluginOption&&(k.htmlPluginOption.tags||(k.htmlPluginOption.tags=[]),k.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))"}));export const CONFIG=k;export const PUBLICPATH=CONFIG.publicPath||"/";global.NEKOCLICONFIG={CONFIG,CUSTOMCONFIG:a,log:x};
1
+ import{fileExists as e}from"@moneko/mdx";import{merge as o}from"webpack-merge";import t from"./options/jsx-dom-expressions.mjs";import s from"./options/split-chunk.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{APPTYPE as r,FRAMEWORK as n,NODE_ENV as l,PACKAGENAME as p,isDev as m,isLibrary as c,isMobile as u,jsxImportSource as d,mainDirectory as h}from"./process-env.mjs";import{isFunction as f,resolveProgram as g}from"./utils/index.mjs";import x from"./utils/read-conf.mjs";import P from"./utils/setup-env.mjs";let v=["@moneko","neko-ui","antd","@antv","katex","font-pingfang-sc","font-pingfang-tc","react-photo-view","react-markdown-editor-lite","schema-design","@app",".cache/http/data"],k={devtool:m?"eval-cheap-module-source-map":"cheap-module-source-map",seo:!1,mode:"csr",bundleAnalyzer:!1,polyfill:!1,entry:{},minifier:{},sourceMap:{filename:"[file].map",publicPath:""},env:P(l,r,n),basename:"/",publicPath:"/",rem:{designSize:u?375:1680},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":g(h)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},cacheDirectory:a.webpackCachePath,devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:s,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:v,js:v,media:v,font:v,wasm:[]},mdx:{jsx:!1,development:m,jsxImportSource:d,providerImportSource:`@moneko/${n}/mdx`},jsxDomExpressions:t,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:{allowedUris:[],lockfileLocation:`${a.httpCachePath}/http.lock`,cacheLocation:`${a.httpCachePath}/data`,upgrade:!0},virtualModule:{},cssExtract:{}};c&&(k.alias=Object.assign(k.alias,{"@pkg":a.componentsPath,[p]:a.componentsPath}));let w=k,C={},j={};if(e(a.configPath)){let e=(await x(a.configPath,"index")).default;C=f(e)?e(process):e}if(i&&e(a.customConfigPath)){let e=(await x(a.customConfigPath,i)).default;j=f(e)?e(process):e}(!1===(w=o(w,C,j)).devtool||!1===w.sourceMap)&&(w.sourceMap=!1,w.devtool=!1),w.fixBrowserRouter&&w.htmlPluginOption&&(w.htmlPluginOption.tags||(w.htmlPluginOption.tags=[]),w.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))"}));export const CONFIG=w;export const PUBLICPATH=CONFIG.publicPath||"/";
@@ -1,3 +1,3 @@
1
- import t from"chalk";import{getIPv4 as o,getPort as e}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import s from"../utils/log.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=t,u=r.devServer||{},f=u.port||3e3;export const PORT=await e(f,u.host);u.port=PORT;let d="/"===r.basename?"":r.basename,T=u.port!==PORT&&m(`Port ${i(f)} is in use, trying ${n(PORT)} instead.
2
- `);function g(t){return`http://${"local"===t?u.host:o()}:${PORT}${d}`}let h=m("You application is running here:"),x=`${a(" Local ")} ${p(g("local"))}
3
- ${c(" Network ")} ${$(g("net"))}`;export function devLog(t,o){!t&&o&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([h,"",x,"",l(`Compiled successfully in ${n(`${o.endTime-o.startTime}ms`)}`)]),T&&s(T))}export const headers={"Access-Control-Allow-Origin":"*"};
1
+ import e from"chalk";import{getIPv4 as t,getPort as o}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import s from"../utils/log.mjs";let{yellow:i,green:n,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=e,d=r.devServer.port||3e3;export const PORT=await o(d,r.devServer.host);r.devServer.port=PORT;let u="/"===r.basename?"":r.basename,v=d!==PORT&&m(`Port ${i(d)} is in use, trying ${n(PORT)} instead.
2
+ `);function f(e){return`http://${"local"===e?r.devServer.host:t()}:${PORT}${u}`}let T=m("You application is running here:"),g=`${a(" Local ")} ${p(f("local"))}
3
+ ${c(" Network ")} ${$(f("net"))}`;export function devLog(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),s([T,"",g,"",l(`Compiled successfully in ${n(`${t.endTime-t.startTime}ms`)}`)]),v&&s(v))}export const headers={"Access-Control-Allow-Origin":"*"};
package/lib/dev.mjs CHANGED
@@ -1 +1 @@
1
- import{directoryExists as e,removeDirAll as t}from"@moneko/mdx";import o from"express";import i from"multer";import s from"webpack";import r from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as m}from"webpack-merge";import a from"./build/server.mjs";import{commonConfig as n}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{PORT as c,devLog as d,headers as h}from"./dev/config.mjs";import f from"./dev/mock.mjs";import u from"./dev/proxy.mjs";import w from"./module.config.mjs";import x from"./paths.mjs";import{SSR as j,isLibrary as g,isReact as k}from"./process-env.mjs";import $ from"./utils/has-pkg.mjs";import{empty as y,resolveProgram as b}from"./utils/index.mjs";import v from"./utils/progress.mjs";import P from"./utils/sigint-exit.mjs";import _ from"./options/reslove.mjs";let{HotModuleReplacementPlugin:S,ProgressPlugin:B,WatchIgnorePlugin:C}=s,D=$("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,M=$("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,L=k&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,F=["js","jsx","ts","tsx","json","html","vue"],O=F.join(","),R=["css","scss","sass","less","ts","tsx","js","jsx"],T=R.join(","),q=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],A=new URLSearchParams({timeout:2e3,reload:!($("solid-refresh")||$("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),E=n.output.path;j&&(E=b(`${g?"docs":"dist"}/client`));let G=m(n,{entry:{main:[`${_.hotMiddlewareClient}?name=client&path=//localhost:${c}/__hmr__&${A}`]},output:{path:E},module:w(!1),plugins:[new S,new C({paths:[/\.d\.ts$/]}),L&&new L,M&&new M({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${O}}`,g&&`${p.alias["@pkg"]}/**/*.{${O}}`].filter(Boolean),extensions:F,exclude:q,cache:!0,cacheLocation:`${x.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),D&&new D({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${T}}`,g&&`${p.alias["@pkg"]}/**/*.{${T}}`].filter(Boolean),extensions:R,exclude:q,cache:!0,cacheLocation:`${x.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),p.bar&&new B({handler(e,t,...o){let i=p.bar;v(e,i.name||"Build",o.length?`[${t}] ${o.join(" ")}`:"",i.color)}})].filter(Boolean)}),I=[G];j&&I.push(m(n,a));let U=s(I);U.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let z=o(),H=i(),J=r(U,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:j,lastModified:!0});if(z.use(J),z.use(l(U,{log:!1,path:"/__hmr__",heartbeat:2e3})),p.proxy&&u(z,p.proxy),e(x.mockPath)){let e=f(x.mockPath);z.use(e)}let K=`${G.output.path}/index.html`;z.all("/*",H.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=J.context.outputFileSystem,o=e?.readFileSync?.(K);t.end(o)}});let N=z.listen(c,()=>{});process.on("exit",function(){J.close(y),N.close(y),N.closeAllConnections(),t(x.cachePath),t(x.vfsDtsPath)}),P(()=>{process.exit(1)});
1
+ import{directoryExists as e,fileExists as o,removeDirAll as t}from"@moneko/mdx";import i from"express";import s from"multer";import r from"webpack";import l from"webpack-dev-middleware";import n from"webpack-hot-middleware";import{merge as m}from"webpack-merge";import a from"./build/server.mjs";import{commonConfig as c}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{PORT as f,devLog as u,headers as d}from"./dev/config.mjs";import h from"./dev/mock.mjs";import w from"./dev/proxy.mjs";import g from"./module.config.mjs";import j,{CUSTOMCONFIG as x}from"./paths.mjs";import{SSR as $,isLibrary as k,isReact as y}from"./process-env.mjs";import b from"./utils/has-pkg.mjs";import{empty as v,isFunction as P,resolveProgram as _}from"./utils/index.mjs";import S from"./utils/progress.mjs";import C from"./utils/sigint-exit.mjs";import B from"./options/reslove.mjs";import{watchFile as D}from"fs";import{spawn as M,exec as G}from"child_process";import I from"./utils/log.mjs";import L from"chalk";import U from"./utils/read-conf.mjs";import{isEqual as A}from"@moneko/common";let{HotModuleReplacementPlugin:F,ProgressPlugin:H,WatchIgnorePlugin:O}=r,R=b("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,T=b("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,q=y&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,E=["js","jsx","ts","tsx","json","html","vue"],N=E.join(","),z=["css","scss","sass","less","ts","tsx","js","jsx"],J=z.join(","),K=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Q=new URLSearchParams({timeout:2e3,reload:!(b("solid-refresh")||b("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),V=c.output.path;$&&(V=_(`${k?"docs":"dist"}/client`));let W=m(c,{entry:{main:[`${B.hotMiddlewareClient}?name=client&path=//localhost:${f}/__hmr__&${Q}`]},output:{path:V},module:g(!1),plugins:[new F,new O({paths:[/\.d\.ts$/]}),q&&new q,T&&new T({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${N}}`,k&&`${p.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:E,exclude:K,cache:!0,cacheLocation:`${j.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),R&&new R({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${J}}`,k&&`${p.alias["@pkg"]}/**/*.{${J}}`].filter(Boolean),extensions:z,exclude:K,cache:!0,cacheLocation:`${j.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),p.bar&&new H({handler(e,o,...t){let i=p.bar;S(e,i.name||"Build",t.length?`[${o}] ${t.join(" ")}`:"",i.color)}})].filter(Boolean)}),X=[W];$&&X.push(m(c,a));let Y=r(X);Y.compilers[0].hooks.done.tap("client-log",e=>{u(null,e)});let Z=i(),ee=s(),eo=l(Y,{writeToDisk:!1,index:"index.html",headers:()=>d,serverSideRender:$,lastModified:!0});if(Z.use(eo),Z.use(n(Y,{log:!1,path:"/__hmr__",heartbeat:2e3})),p.proxy&&w(Z,p.proxy),e(j.mockPath)){let e=h(j.mockPath);Z.use(e)}let et=`${W.output.path}/index.html`;Z.all("/*",ee.any(),function(e,o,t){if("GET"!==e.method)return t();{let e=eo.context.outputFileSystem,t=e?.readFileSync?.(et);o.end(t)}});let ei=Z.listen(f,()=>{});function es(){process.exit(0)}async function er(e,t){if(o(e)){let o=(await U(e,t)).default;return P(o)?o(process):o}}function el(e,t){if(t&&o(e)){let o=er(e,t);D(e,async function(){A(o,er(e,t))?I(L.gray(`未变更`)):(I(L.yellow(`检测到工程配置${L.blue(`[${t}]`)}变更, 程序即将重启...`)),G("win32"===process.platform?`netstat -ano | findstr :${f}`:`lsof -i :${f}`,(e,o,t)=>{let i=en?o.split(/\s+/).pop():o.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):I(`未找到占用端口 ${f} 的进程`)}))})}}el(j.configPath,"index"),el(j.customConfigPath,x);let en="win32"===process.platform;process.on("SIGHUP",function(){eo.close(v),ei.close(v),ei.closeAllConnections(),function(){let e=M(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",es)}()}),process.on("exit",function(){eo.close(v),ei.close(v),ei.closeAllConnections(),t(j.cachePath),t(j.vfsDtsPath)}),C(es);
@@ -1 +1 @@
1
- import s from"../utils/require.reslove.mjs";import e from"../utils/has-pkg.mjs";export default{styleLoader:s.resolve("style-loader"),cssLoader:s.resolve("css-loader"),sassLoader:e("sass")&&e("sass-loader")&&s.resolve("sass-loader"),lessLoader:s.resolve("less-loader"),swcLoader:s.resolve("swc-loader"),transformImports:e("@moneko/transform-imports")&&s.resolve("@moneko/transform-imports"),jsxDomExpressions:e("@moneko/jsx-dom-expressions")&&s.resolve("@moneko/jsx-dom-expressions"),hotMiddlewareClient:s.resolve("webpack-hot-middleware/client.js")};
1
+ import s from"../utils/require.mjs";import e from"../utils/has-pkg.mjs";export default{styleLoader:s.resolve("style-loader"),cssLoader:s.resolve("css-loader"),sassLoader:e("sass")&&e("sass-loader")&&s.resolve("sass-loader"),lessLoader:s.resolve("less-loader"),swcLoader:s.resolve("swc-loader"),transformImports:e("@moneko/transform-imports")&&s.resolve("@moneko/transform-imports"),jsxDomExpressions:e("@moneko/jsx-dom-expressions")&&s.resolve("@moneko/jsx-dom-expressions"),hotMiddlewareClient:s.resolve("webpack-hot-middleware/client.js")};
@@ -1 +1 @@
1
- export default function(e){let t=["SIGINT","SIGTERM","SIGQUIT"];for(let o=0,I=t.length;o<I;o++)process.on(t[o],e)}
1
+ export default function(o){process.on("SIGINT",o),process.on("SIGTERM",o),process.on("SIGQUIT",o)}
@@ -1 +1 @@
1
- export declare function watchFiles(root: string, ignored: RegExp, call: VoidFunction): void;
1
+ export declare function watchFiles(root: string, ignored?: RegExp, call?: VoidFunction): void;
package/lib/vm/utils.mjs CHANGED
@@ -1 +1 @@
1
- import{watch as i}from"chokidar";import t from"../utils/sigint-exit.mjs";export function watchFiles(n,o,e){let r=i(n,{ignored:(i,t)=>{if(t)return!t.isDirectory()&&o.test(i)},persistent:!0,ignoreInitial:!0});r.on("add",e).on("change",e).on("unlink",e),t(function(){r.unwatch(n),r.close()})}
1
+ import{watch as i}from"chokidar";import t from"../utils/sigint-exit.mjs";import{empty as n}from"../utils/index.mjs";export function watchFiles(o,r,e=n){let s=i(o,{ignored:(i,t)=>{if(t)return!t.isDirectory()&&r?.test(i)},persistent:!0,ignoreInitial:!0});s.on("add",e).on("change",e).on("unlink",e),t(function(){s.unwatch(o),s.close()})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.15.11",
3
+ "version": "3.15.13",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -12,6 +12,7 @@
12
12
  "license": "MIT",
13
13
  "dependencies": {
14
14
  "@babel/core": "7.24.5",
15
+ "@moneko/common": "1.3.2",
15
16
  "@moneko/mdx": "0.1.26",
16
17
  "@moneko/transform-imports": "0.5.1",
17
18
  "@swc/core": "1.5.7",
@@ -216,7 +216,7 @@ export declare type ConfigType = {
216
216
  /** 自定义缓存目录,为 false 时,不使用缓存 */
217
217
  cacheDirectory?: string | false;
218
218
  /** 开发服务器设置 */
219
- devServer?: {
219
+ devServer: {
220
220
  headers?: Record<string, string>;
221
221
  host?: string;
222
222
  port?: number;
@@ -577,9 +577,5 @@ export type SwcImportOnDemandTransform = Record<
577
577
  memberTransformers?: MemberTransformer[];
578
578
  }
579
579
  >;
580
- declare global {
581
- // eslint-disable-next-line vars-on-top,no-var
582
- var NEKOCLICONFIG: CommomType;
583
- }
584
580
 
585
581
  export {};
File without changes