@moneko/core 3.15.11 → 3.15.12

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 o,getPort as t}from"./net.mjs";import{CONFIG as r}from"../config.mjs";import i from"../utils/log.mjs";let{yellow:n,green:s,grey:l,gray:m,bgBlue:a,bgGreenBright:c,blueBright:p,greenBright:$}=e,d=r.devServer.port||3e3;export const PORT=await t(d,r.devServer.host);r.devServer.port=PORT;let u="/"===r.basename?"":r.basename,v=d!==PORT&&m(`Port ${n(d)} is in use, trying ${s(PORT)} instead.
2
+ `);function f(e){return`http://${"local"===e?r.devServer.host:o()}:${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,o){!e&&o&&(i([T,"",g,"",l(`Compiled successfully in ${s(`${o.endTime-o.startTime}ms`)}`)]),v&&i(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 s from"express";import i from"multer";import l from"webpack";import r 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 d,headers as h}from"./dev/config.mjs";import u from"./dev/mock.mjs";import g from"./dev/proxy.mjs";import w from"./module.config.mjs";import x from"./paths.mjs";import{SSR as j,isLibrary as $,isReact as k}from"./process-env.mjs";import b from"./utils/has-pkg.mjs";import{empty as y,resolveProgram as P}from"./utils/index.mjs";import v from"./utils/progress.mjs";import _ from"./utils/sigint-exit.mjs";import S from"./options/reslove.mjs";import{watchFile as C,unwatchFile as B}from"fs";import{spawn as D,exec as M}from"child_process";let{HotModuleReplacementPlugin:G,ProgressPlugin:I,WatchIgnorePlugin:L}=l,U=b("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,A=b("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,F=k&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,H=["js","jsx","ts","tsx","json","html","vue"],O=H.join(","),R=["css","scss","sass","less","ts","tsx","js","jsx"],T=R.join(","),q=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],E=new URLSearchParams({timeout:2e3,reload:!(b("solid-refresh")||b("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),N=c.output.path;j&&(N=P(`${$?"docs":"dist"}/client`));let z=m(c,{entry:{main:[`${S.hotMiddlewareClient}?name=client&path=//localhost:${f}/__hmr__&${E}`]},output:{path:N},module:w(!1),plugins:[new G,new L({paths:[/\.d\.ts$/]}),F&&new F,A&&new A({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${O}}`,$&&`${p.alias["@pkg"]}/**/*.{${O}}`].filter(Boolean),extensions:H,exclude:q,cache:!0,cacheLocation:`${x.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),U&&new U({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${T}}`,$&&`${p.alias["@pkg"]}/**/*.{${T}}`].filter(Boolean),extensions:R,exclude:q,cache:!0,cacheLocation:`${x.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),p.bar&&new I({handler(e,o,...t){let s=p.bar;v(e,s.name||"Build",t.length?`[${o}] ${t.join(" ")}`:"",s.color)}})].filter(Boolean)}),J=[z];j&&J.push(m(c,a));let K=l(J);K.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let Q=s(),V=i(),W=r(K,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:j,lastModified:!0});if(Q.use(W),Q.use(n(K,{log:!1,path:"/__hmr__",heartbeat:2e3})),p.proxy&&g(Q,p.proxy),e(x.mockPath)){let e=u(x.mockPath);Q.use(e)}let X=`${z.output.path}/index.html`;Q.all("/*",V.any(),function(e,o,t){if("GET"!==e.method)return t();{let e=W.context.outputFileSystem,t=e?.readFileSync?.(X);o.end(t)}});let Y=Q.listen(f,()=>{});function Z(){console.log("listener"),M("win32"===process.platform?`netstat -ano | findstr :${f}`:`lsof -i :${f}`,(e,o,t)=>{let s=eo?o.split(/\s+/).pop():o.split("\n")[1]?.split(/\s+/)[1];s?process.kill(Number(s),"SIGHUP"):console.log(`未找到占用端口 ${f} 的进程`)})}function ee(){B(x.configPath,Z),B(x.customConfigPath,Z)}o(x.configPath)&&C(x.configPath,Z);let eo="win32"===process.platform;process.on("SIGHUP",function(){W.close(y),Y.close(y),Y.closeAllConnections(),ee(),function(){let e=D(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",()=>{process.exit(0)})}()}),process.on("exit",function(e){ee(),W.close(y),Y.close(y),Y.closeAllConnections(),t(x.cachePath),t(x.vfsDtsPath)}),_(()=>{process.exit(0)});
@@ -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.12",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",
@@ -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