@moneko/core 4.0.6 → 4.0.7
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/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extname as e,join as t,resolve as s}from"node:path";import o,{config_files as a,CUSTOMCONFIG as n,TMP_DIR as i}from"./commom/paths.mjs";import r from"./commom/rule.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as m,resolveProgram as c}from"./utils/index.mjs";import{CONFIG as p}from"./config.mjs";import u from"./plugins.config.mjs";import{app_schema as h,CACHE_NAME as d,isCI as f,isDev as g,isLibrary as y,packageJson as b,projectNameCamelCase as j}from"./process-env.mjs";export const outputConfig={path:c(y?"docs":"dist"),filename:e=>e.filename?.includes(".worker")?"worker/[name].js":"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",cssFilename:"style/[contenthash].css",cssChunkFilename:"style/[contenthash].chunk.css",assetModuleFilename:t=>{let s=e(t.filename||"").substring(1);return`assets/${s}/[hash][ext]`},library:{name:`${j}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${b.name}`,pathinfo:g,clean:!0,publicPath:p.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${j}`};let v={main:[`${h}:entry`]},C=[t(o.corePath,"./polyfills/public-path.mjs")];if(g&&p.refresh&&p.env.injectRemoteReactRefresh&&C.push(t(o.corePath,"./polyfills/inject-react-refresh.mjs")),p.polyfill&&C.push(t(o.corePath,"./polyfills/replace-children.mjs")),p.entry&&("string"==typeof p.entry?v={...v,main:[p.entry]}:Object.keys(p.entry)&&(v=Object.assign(v,p.entry))),"string"==typeof v.main?v.main=[...C,v.main]:Array.isArray(v.main)&&(v.main=[...C,...v.main]),p.output){if("string"==typeof p.output)outputConfig.path=p.output;else if(Object.keys(p.output)){let e=p.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof p.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let P={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:o.webpackCachePath,memoryCacheUnaffected:!
|
|
1
|
+
import{extname as e,join as t,resolve as s}from"node:path";import o,{config_files as a,CUSTOMCONFIG as n,TMP_DIR as i}from"./commom/paths.mjs";import r from"./commom/rule.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{isObject as m,resolveProgram as c}from"./utils/index.mjs";import{CONFIG as p}from"./config.mjs";import u from"./plugins.config.mjs";import{app_schema as h,CACHE_NAME as d,isCI as f,isDev as g,isLibrary as y,packageJson as b,projectNameCamelCase as j}from"./process-env.mjs";export const outputConfig={path:c(y?"docs":"dist"),filename:e=>e.filename?.includes(".worker")?"worker/[name].js":"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",cssFilename:"style/[contenthash].css",cssChunkFilename:"style/[contenthash].chunk.css",assetModuleFilename:t=>{let s=e(t.filename||"").substring(1);return`assets/${s}/[hash][ext]`},library:{name:`${j}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${b.name}`,pathinfo:g,clean:!0,publicPath:p.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${j}`};let v={main:[`${h}:entry`]},C=[t(o.corePath,"./polyfills/public-path.mjs")];if(g&&p.refresh&&p.env.injectRemoteReactRefresh&&C.push(t(o.corePath,"./polyfills/inject-react-refresh.mjs")),p.polyfill&&C.push(t(o.corePath,"./polyfills/replace-children.mjs")),p.entry&&("string"==typeof p.entry?v={...v,main:[p.entry]}:Object.keys(p.entry)&&(v=Object.assign(v,p.entry))),"string"==typeof v.main?v.main=[...C,v.main]:Array.isArray(v.main)&&(v.main=[...C,...v.main]),p.output){if("string"==typeof p.output)outputConfig.path=p.output;else if(Object.keys(p.output)){let e=p.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof p.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let P={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:o.webpackCachePath,memoryCacheUnaffected:!0,name:d,version:`${b.version}`,buildDependencies:{config:a},maxMemoryGenerations:1};!1===p.cache?P=!1:m(p.cache)&&(P=Object.assign(P,p.cache)),f&&(void 0===p.cache||p.cache&&!p.cache.cacheDirectory)&&(P.cacheDirectory=s(i,b.name));let k={},x={imports:!0,entries:!0,test:e=>{let s=e.nameForCondition();return!!(s&&(/^[a-z][a-z0-9]*:.+$/.test(s)||s?.startsWith(t(o.programPath,"src"))||s?.startsWith(t(o.programPath,"site"))||s?.startsWith(o.componentsPath)))}};p.lazyCompilation&&g&&"true"!==process.env.IS_BUILD?m(p.lazyCompilation)?Object.assign(k,x,p.lazyCompilation):Object.assign(k,x):k=!1;export const commonConfig={name:"client",target:"web",devtool:p.devtool,entry:v,mode:p.mode??"production",cache:P,snapshot:{immutablePaths:[o.pnpmNodeModules,o.denoNodeModules,r.node_modules],managedPaths:[o.pnpmNodeModules,o.denoNodeModules,r.node_modules],resolveBuildDependencies:{timestamp:!0,hash:!0},resolve:{timestamp:!0,hash:!0},module:{timestamp:!0,hash:!0},buildDependencies:{timestamp:!0,hash:!0},contextModule:{timestamp:!0,hash:!0}},stats:"errors-only",infrastructureLogging:{level:"error"},externalsPresets:p.externalsPresets,plugins:u,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:k,buildHttp:m(p.buildHttp)?{allowedUris:[],lockfileLocation:s(o.httpCachePath,"http.lock"),cacheLocation:s(o.httpCachePath,"data"),upgrade:!0,...p.buildHttp}:p.buildHttp,backCompat:!0,futureDefaults:!0,css:!0,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:p.alias,modules:[o.nodeModules,o.pnpmNodeModules,o.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:p.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:p.externals,output:outputConfig,recordsPath:p.recordsPath};p.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:p.alias["@"],override:n&&c(n)},p.overrideResolve)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"webpack";import{merge as i}from"webpack-merge";import{LightningCssMinifyPlugin as m}from"./plugin/lightningcss-plugin.mjs";import{SwcMinifyPlugin as n}from"./plugin/swc-minify-plugin.mjs";import{getLightningCssTargets as
|
|
1
|
+
import e from"webpack";import{merge as i}from"webpack-merge";import{LightningCssMinifyPlugin as m}from"./plugin/lightningcss-plugin.mjs";import{SwcMinifyPlugin as n}from"./plugin/swc-minify-plugin.mjs";import{getLightningCssTargets as o}from"./polyfills/targets.mjs";import{commonConfig as t}from"./common.mjs";import{CONFIG as r}from"./config.mjs";import p from"./module.config.mjs";import{isReact as s,refresh as l}from"./process-env.mjs";export async function createDevelopmentConfiguration(u={}){let f=[];r.minifier&&(f.push(new n({compress:{ecma:2015,toplevel:!1,module:!1,ie8:!1,keep_fnames:!1,top_retain:[],keep_infinity:!0},...r.minifier})),f.push(new m({targets:o()})));let c=i(t,{module:p(!1),plugins:[new e.HotModuleReplacementPlugin],optimization:{runtimeChunk:r.runtimeChunk,minimize:f.length>0,minimizer:f,chunkIds:"deterministic",moduleIds:"deterministic"}});if(s&&l){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;c.plugins.push(new e({overlay:!1}))}return i(c,u)}
|
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{relative as r}from"node:path";import i from"node:process";import{URL as
|
|
2
|
-
`):(l(e||0,1,{msg:r,name:t,barColor:
|
|
1
|
+
import{exec as e,spawn as t}from"node:child_process";import{watchFile as o}from"node:fs";import{relative as r}from"node:path";import i from"node:process";import{URL as n}from"node:url";import{ink as s,print as m,println as a,progressBar as l}from"@moneko/utils";import p from"webpack";import c from"webpack-hot-middleware";import{merge as f}from"webpack-merge";import{diffObject as h}from"./commom/diff-object.mjs";import d,{config_files as u}from"./commom/paths.mjs";import g from"./commom/rule.mjs";import w from"./commom/sigint-exit.mjs";import{devLog as y,PORT as $}from"./dev/config.mjs";import j from"./dev/generate-progress-html.mjs";import v from"./dev/server.mjs";import b from"./options/reslove.mjs";import{ESLintPlugin as x}from"./plugin/eslint.mjs";import{StylelintPlugin as C}from"./plugin/stylelint.mjs";import{empty as _}from"./utils/index.mjs";import{CONFIG as P,getConfig as S}from"./config.mjs";import{createDevelopmentConfiguration as k}from"./create-development-configuration.mjs";import{outputFileSystem as E}from"./file-system.mjs";import{isLibrary as B,refresh as H}from"./process-env.mjs";let I=!1,O="/____progress____",T={percentage:0,info:""},q="/__hmr__",G=new URLSearchParams({name:"client",path:q.substring(1),dynamicPublicPath:!0,timeout:2e3,reload:!H,quiet:!0,noInfo:!0,overlay:!1,autoConnect:!0}).toString(),L=await k({watchOptions:{stdin:!0,aggregateTimeout:300,ignored:g.node_modules},entry:{main:[`${b.hotMiddlewareClient}?${G}`]},plugins:[new p.WatchIgnorePlugin({paths:[g.node_modules,/\.d\.ts$/]}),new p.ProgressPlugin({handler(e,t,...o){let r=o.length?`[${t}] ${o.join(" ")}`:" ";I||(T.info=r,T.percentage=e,I=1===e);let n=P.bar;if(n){let t=n.name||"Build";n.quiet?i.stdout.write(`${r}
|
|
2
|
+
`):(l(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"))}}})],optimization:{minimize:!1}});function U(e){let t=e.join(","),o=[r(d.programPath,`${P.alias["@"]}/**/*.{${t}}`).replace(/\\/g,"/")];return B&&o.push(r(d.programPath,`${P.alias["@pkg"]}/**/*.{${t}}`).replace(/\\/g,"/")),o}P.eslint&&L.plugins.push(new x({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.eslintcache`,cacheStrategy:"metadata",files:U(["js","jsx","ts","tsx","json","html","vue"]),...P.eslint})),P.stylelint&&L.plugins.push(new C({fix:!0,cache:!0,cacheLocation:`${d.lintCachePath}/.stylelintcache`,files:U(["css","scss","sass","less","ts","tsx","js","jsx"]),...P.stylelint}));let z=p(L);if(!z)throw Error("无法创建编译器");z.outputFileSystem=E;let F=z.watch(z.options.watchOptions,y);if(!F)throw Error("无法创建监视器");z.hooks.done.tap("client-log",e=>{y(null,e)});let N=`${P.basename}/${q}`.replace(/\/+/g,"/"),R=c(z,{log:!1,path:N,heartbeat:2e3}),J=await v({port:$,root_dir:z.options.output.path,fileSystem:z.outputFileSystem,headers:P.devServer.headers,https:P.devServer.https,host:P.devServer.host,open:P.devServer.open,basename:P.basename,onRequest(e,t){if(!t.writableEnded){if("GET"===e.method){let o=new n(`${P.devServer.https?"https":"http"}://${e.headers.host}${e.url}`);if(o.pathname===O)return t.writeHead(200,{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}),t.end(JSON.stringify(T)),!0;if(!I)return t.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),t.end(j(O,T)),!0;if(o.pathname===N&&"text/event-stream"===e.headers.accept)return R(e,t,_),!0}return!1}}});function K(){i.exit(0)}J.on("close",()=>{F.close(_),R.close()});let M=await Promise.all(u.map(S)),W=f(M[0]||{},M[1]||{});u.forEach(function(t){o(t,async function(){var o;let[r,n]=await Promise.all(u.map(S)),l=f(r||{},n||{}),p=h(W,l);1===Object.keys(p).length&&"proxy"in p?(m(s(`代理更新中...`,"yellow"),!0),m(s(`代理更新完成...`,"green"),!0),P.proxy=l.proxy,W.proxy=l.proxy,W=l):(W=l,a(s(`检测到工程配置${s(`[${t}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),o=$,e(A?`netstat -ano | findstr :${o}`:`lsof -i :${o} -t`,(e,t)=>{if(e){a(s(`查找端口 ${o} 时发生错误: ${e.message}`,"red")),a(s("请尝试手动重启程序","yellow"));return}let r=t.trim().replace(/\r\n/g,"\n").split("\n").filter(Boolean),n=A?r[0]?.split(/\s+/).pop()?.trim():r[0]?.trim();if(!n)return void a(s(`未找到占用端口 ${o} 的进程, 请尝试手动重启程序`,"yellow"));try{i.kill(Number(n),"SIGHUP")}catch(e){a(s(`终止进程 ${n} 时发生错误: ${e.message}`,"red"))}}))})});let A="win32"===i.platform;i.on("SIGHUP",function(){let e;J.close(_),(e=t(i.argv[0],i.argv.slice(1),{detached:!1,stdio:"inherit"})).unref(),e.on("close",K)}),i.on("exit",function(){J.close(_)}),w(K);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"@moneko/stylelint": "1.7.0",
|
|
137
137
|
"@moneko/transform-imports": "1.3.1",
|
|
138
138
|
"@moneko/utils": "0.3.3",
|
|
139
|
-
"@swc/core": "1.15.
|
|
139
|
+
"@swc/core": "1.15.2",
|
|
140
140
|
"browserslist": "4.28.0",
|
|
141
141
|
"core-js": "3.46.0",
|
|
142
142
|
"core-js-compat": "3.46.0",
|
|
@@ -154,11 +154,11 @@
|
|
|
154
154
|
},
|
|
155
155
|
"devDependencies": {
|
|
156
156
|
"@moneko/css": "1.2.0",
|
|
157
|
-
"@types/react-refresh": "0.14.
|
|
157
|
+
"@types/react-refresh": "0.14.7",
|
|
158
158
|
"@types/stylis": "4.2.7",
|
|
159
159
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
160
160
|
"@types/webpack-hot-middleware": "2.25.12",
|
|
161
|
-
"sass": "1.94.
|
|
161
|
+
"sass": "1.94.1",
|
|
162
162
|
"sass-loader": "16.0.6",
|
|
163
163
|
"solid-refresh": "0.7.5",
|
|
164
164
|
"stylis": "4.3.6",
|