@moneko/core 3.16.6 → 3.17.0
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/build.mjs +1 -1
- package/lib/dev.mjs +1 -1
- package/lib/loader/css-in-js-minify.cjs +1 -1
- package/lib/loader/lightningcss.cjs +1 -1
- package/lib/loader/lightningcss.d.cts +1 -1
- package/lib/loader/mdx.cjs +1 -1
- package/lib/loader/solid-refresh.cjs +1 -1
- package/lib/loader/ts-doc.cjs +1 -1
- package/lib/utils/progress.d.mts +8 -8
- package/lib/utils/progress.mjs +1 -1
- package/package.json +1 -1
- package/lib/loader/swc-loader.cjs +0 -1
- package/lib/loader/swc-loader.d.cts +0 -3
package/lib/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeDirAll as o}from"@moneko/mdx";import r from"webpack";import{merge as
|
|
1
|
+
import{removeDirAll as o}from"@moneko/mdx";import r from"webpack";import{merge as t}from"webpack-merge";import m from"./build/common.mjs";import e from"./build/server.mjs";import{CONFIG as i}from"./config.mjs";import s from"./module.config.mjs";import n from"./paths.mjs";import l from"./plugin/done.mjs";import{SSR as a}from"./process-env.mjs";import p from"./utils/log.mjs";import f from"./utils/seo.mjs";import c from"./utils/progress.mjs";import u from"chalk";let{ProgressPlugin:g}=r,h=!!i.bar,d=t(m,{module:s(!1),plugins:[i.done&&new l({done:i.done}),new g({handler(o,r,...t){let m=i.bar||{};c({num:o,title:m.name||"Build",info:t.length?`[${r}] ${t.join(" ")}`:"",color:m.color,output:d.output?.path,showBar:h})}})].filter(Boolean)}),w=[d];a&&w.push(t(m,e));let j=r(w);async function b(){await new Promise(o=>{j.run((r,t)=>{if(r)throw r;if(t&&(t.hasErrors()||t.hasWarnings()))for(let o=0,r=t.stats.length;o<r;o++){let r=t.stats[o];for(let o=0,t=r.compilation.warnings.length;o<t;o++)p(u.yellowBright(r.compilation.warnings[o].message));for(let o=0,t=r.compilation.errors.length;o<t;o++)p(u.redBright(r.compilation.errors[o].message))}o(r)})}),i.seo&&f()}await b(),process.on("exit",function(){o(n.cachePath),o(n.vfsDtsPath)});
|
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{directoryExists as e,fileExists as t,loadFileSync as o,removeDirAll as i}from"@moneko/mdx";import s from"express";import r from"multer";import l from"webpack";import n from"webpack-dev-middleware";import m from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import c from"./build/server.mjs";import{commonConfig as p}from"./common.mjs";import{CONFIG as f}from"./config.mjs";import{PORT as
|
|
1
|
+
import{directoryExists as e,fileExists as t,loadFileSync as o,removeDirAll as i}from"@moneko/mdx";import s from"express";import r from"multer";import l from"webpack";import n from"webpack-dev-middleware";import m from"webpack-hot-middleware";import{merge as a}from"webpack-merge";import c from"./build/server.mjs";import{commonConfig as p}from"./common.mjs";import{CONFIG as f}from"./config.mjs";import{PORT as u,devLog as d,headers as h}from"./dev/config.mjs";import g from"./dev/mock.mjs";import w from"./dev/proxy.mjs";import x from"./module.config.mjs";import j,{CUSTOMCONFIG as $}from"./paths.mjs";import{SSR as k,isLibrary as y,isReact as b}from"./process-env.mjs";import v from"./utils/has-pkg.mjs";import{empty 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";let{HotModuleReplacementPlugin:U,ProgressPlugin:A,WatchIgnorePlugin:F}=l,H=v("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,O=v("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,R=b&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,T=["js","jsx","ts","tsx","json","html","vue"],q=T.join(","),E=["css","scss","sass","less","ts","tsx","js","jsx"],N=E.join(","),z=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],J=new URLSearchParams({timeout:2e3,reload:!(v("solid-refresh")||v("react-refresh")),quiet:!0,noInfo:!0,overlay:!0,dynamicPublicPath:!0}).toString(),K=p.output.path;k&&(K=_(`${y?"docs":"dist"}/client`));let Q=!!f.bar,V=a(p,{entry:{main:[`${B.hotMiddlewareClient}?name=client&path=//localhost:${u}/__hmr__&${J}`]},output:{path:K},module:x(!1),plugins:[new U,new F({paths:[/\.d\.ts$/]}),R&&new R,O&&new O({fix:!0,threads:!0,files:[`${f.alias["@"]}/**/*.{${q}}`,y&&`${f.alias["@pkg"]}/**/*.{${q}}`].filter(Boolean),extensions:T,exclude:z,cache:!0,cacheLocation:`${j.lineCachePath}/.eslintcache`,lintDirtyModulesOnly:!0}),H&&new H({fix:!0,threads:!0,files:[`${f.alias["@"]}/**/*.{${N}}`,y&&`${f.alias["@pkg"]}/**/*.{${N}}`].filter(Boolean),extensions:E,exclude:z,cache:!0,cacheLocation:`${j.lineCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),new A({handler(e,t,...o){let i=f.bar||{};S({num:e,title:i.name||"Build",info:o.length?`[${t}] ${o.join(" ")}`:"",color:i.color,output:V.output?.path,showBar:Q})}})].filter(Boolean)}),W=[V];k&&W.push(a(p,c));let X=l(W);X.compilers[0].hooks.done.tap("client-log",e=>{d(null,e)});let Y=s(),Z=r(),ee=n(X,{writeToDisk:!1,index:"index.html",headers:()=>h,serverSideRender:k,lastModified:!0});if(Y.use(ee),Y.use(m(X,{log:!1,path:"/__hmr__",heartbeat:2e3})),f.proxy&&w(Y,f.proxy),e(j.mockPath)){let e=g(j.mockPath);Y.use(e)}let et=`${V.output.path}/index.html`;Y.all("/*",Z.any(),function(e,t,o){if("GET"!==e.method)return o();{let e=ee.context.outputFileSystem,o=e?.readFileSync?.(et);t.end(o)}});let eo=Y.listen(u,()=>{});function ei(){process.exit(0)}function es(e,i){if(i&&t(e)){let t=(o(e)||"").trim().replace(/^\s*[\r\n]/gm,"");D(e,async function(){t!==(o(e)||"").trim().replace(/^\s*[\r\n]/gm,"")?(I(L.yellow(`检测到工程配置${L.blue(`[${i}]`)}变更, 程序即将重启...`)),G("win32"===process.platform?`netstat -ano | findstr :${u}`:`lsof -i :${u}`,(e,t,o)=>{let i=er?t.split(/\s+/).pop():t.split("\n")[1]?.split(/\s+/)[1];i?process.kill(Number(i),"SIGHUP"):I(`未找到占用端口 ${u} 的进程`)})):I(L.gray(`未变更`))})}}es(j.configPath,"index"),es(j.customConfigPath,$);let er="win32"===process.platform;process.on("SIGHUP",function(){ee.close(P),eo.close(P),eo.closeAllConnections(),function(){let e=M(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",ei)}()}),process.on("exit",function(){ee.close(P),eo.close(P),eo.closeAllConnections(),i(j.cachePath),i(j.vfsDtsPath)}),C(ei);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return n}});const t=require("@babel/core"),r=(e=require("@moneko/css/babel"))&&e.__esModule?e:{default:e};async function n(e){let n=this.async();try{let o=await (0,t.transformAsync)(e,{plugins:[[r.default,{}]]});n(null,o?.code||void 0,o?.map||void 0)}catch(e){n(e)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return n}});const e=require("buffer"),t=require("lightningcss"),r={Declaration:{custom(e){if("content"===e.name&&1===e.value.length){let t=e.value[0];if("token"===t.type&&"string"===t.value.type)return[{property:e.name,raw:JSON.stringify(t.value.value.replace(/[\u4e00-\u9faF]/g,function(e){return`\\${e.charCodeAt(0).toString(16)}`}))}]}}}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return n}});const e=require("buffer"),t=require("lightningcss"),r={Declaration:{custom(e){if("content"===e.name&&1===e.value.length){let t=e.value[0];if("token"===t.type&&"string"===t.value.type)return[{property:e.name,raw:JSON.stringify(t.value.value.replace(/[\u4e00-\u9faF]/g,function(e){return`\\${e.charCodeAt(0).toString(16)}`}))}]}}}};function n(n,i){let o=this.async(),{implementation:u,visitor:s,rem:a,...f}=this.getOptions();if(u&&"function"!=typeof u.transform){o(TypeError(`[lightningcss]: implementation.transform must be an 'lightningcss' transform function. Received ${typeof u.transform}`));return}let c=u?.transform?u.transform:t.transform;try{a&&!r.Length&&(r.Length=function(e){if("px"===e.unit)return{unit:"rem",value:e.value/16}});let{code:t,map:u}=c({filename:this.resourcePath,code:e.Buffer.from(n),minify:!0,visitor:{...r,...s},sourceMap:!!this.sourceMap,inputSourceMap:this.sourceMap&&i?JSON.stringify(i):void 0,...f});o(null,t.toString(),u&&JSON.parse(u.toString()))}catch(e){o(e)}}
|
|
@@ -4,4 +4,4 @@ export interface LightningCssLoaderOption extends Omit<TransformOptions<CustomAt
|
|
|
4
4
|
rem?: boolean;
|
|
5
5
|
implementation?: typeof import('lightningcss');
|
|
6
6
|
}
|
|
7
|
-
export default function LightningCssLoader(this: LoaderContext<LightningCssLoaderOption>, source: string, prevMap?: string):
|
|
7
|
+
export default function LightningCssLoader(this: LoaderContext<LightningCssLoaderOption>, source: string, prevMap?: string): void;
|
package/lib/loader/mdx.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t}});const e=require("@moneko/mdx");async function t(t){let
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t}});const e=require("@moneko/mdx");async function t(t){let r=this.async();try{let n=await (0,e.mdx)({value:t,filepath:this.resourcePath,...this.getOptions()});r(null,n.code)}catch(e){r(e)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),function(e,
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(exports,{custom:function(){return o},default:function(){return u}});const t=require("@babel/core"),r=(e=require("solid-refresh/babel"))&&e.__esModule?e:{default:e};async function n(e){let n=this.async();try{let o=await (0,t.transformAsync)(e,{plugins:[[r.default,{}]]});n(null,o?.code||void 0,o?.map||void 0)}catch(e){n(e)}}function o(e){return n.bind(this,e)}const u=n;
|
package/lib/loader/ts-doc.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return r}});const e=require("fs"),t={};function r(r){let s=this.resourcePath,{comment:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return r}});const e=require("fs"),t={};function r(r){let s=this.resourcePath,{comment:n,generateDoc:i,getCommentPath:c}=this.getOptions();try{let u=(0,e.statSync)(s).mtime.getTime();t[s]!==u&&(Object.assign(t,{[s]:u}),n.setData(c(s),i(r,s)))}catch(e){}return r}
|
package/lib/utils/progress.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
declare function progress(opt: {
|
|
2
|
+
num: number;
|
|
3
|
+
title: string;
|
|
4
|
+
info: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
output?: string;
|
|
7
|
+
showBar?: boolean;
|
|
8
|
+
}): void;
|
|
9
9
|
export default progress;
|
package/lib/utils/progress.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cursorTo as t,clearScreenDown as
|
|
1
|
+
import{cursorTo as t,clearScreenDown as o}from"readline";import{relative as e}from"path";import s from"chalk";import r from"./log.mjs";import i from"../paths.mjs";import{isDev as p}from"../process-env.mjs";let{blue:u,bgBlue:c,grey:m,green:d,yellow:l,red:n}=s,f={};export default function(a){let h=process.stdout.rows-2,$=Math.fround(24*a.num),w=a.color?[s.hex(a.color),s.bgHex(a.color)]:[u,c],g=w[0](`${a.title}:`),x=m(`${(100*a.num).toFixed()}%`),B=w[1](" ".repeat($))+w[1].inverse(" ".repeat(24-$));if(0===a.num&&(f[a.title]=process.hrtime(),a.showBar&&process.stdout.write("\n\n")),a.showBar&&(t(process.stdout,0,h),o(process.stdout),process.stdout.write(`${g} ${B} ${x}`),process.stdout.write("\n"),process.stdout.write(m(a.info.length>80?`${a.info.substring(0,80)}...`:a.info))),1===a.num){if(!p){let t=process.hrtime(f[a.title]),o=t[0]+t[1]/1e9,s=d;o<10?s=d:o<20?s=l:o<40&&(s=n),r(["",m(`Build completed ${d("successfully")}!`),m(`Output files are located in the ${u(`${e(i.programPath,a.output||"dist/")}/`)} directory.`),m(`Build took ${s(o.toFixed(2))} seconds.`),"",""])}t(process.stdout,0,h),o(process.stdout)}}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return t}});const e=require("@swc/core");function t(t,s){this.async();let r=this.async(),o=this.resourcePath,c=("function"==typeof this.getOptions?this.getOptions():require("loader-utils").getOptions(this))||{};Object.prototype.hasOwnProperty.call(c,"sourceMap")&&!Object.prototype.hasOwnProperty.call(c,"sourceMaps")&&(c=Object.assign({},c,{sourceMaps:c.sourceMap}),delete c.sourceMap),s&&"object"==typeof s&&(s=JSON.stringify(s));let a=Object.assign({},c,{filename:o,inputSourceMap:s||void 0,sourceMaps:void 0===c.sourceMaps?this.sourceMap:c.sourceMaps,sourceFileName:o});a.inputSourceMap||delete a.inputSourceMap;let p=a.sync,n=a.parseMap;delete a.sync,delete a.parseMap,delete a.customize,delete a.cacheDirectory,delete a.cacheIdentifier,delete a.cacheCompression,delete a.metadataSubscribers,this.mode&&a.jsc&&a.jsc.transform&&a.jsc.transform.react&&!Object.prototype.hasOwnProperty.call(a.jsc.transform.react,"development")&&(a.jsc.transform.react.development="development"===this.mode),"inline"===a.sourceMaps&&(a.sourceMaps=!0);try{if(p){let s=(0,e.transformSync)(t,a);r(null,s.code,n&&s.map?JSON.parse(s.map):s.map)}else(0,e.transform)(t,a).then(e=>{r(null,e.code,n&&e.map?JSON.parse(e.map):e.map)},e=>{r(e)})}catch(e){r(e)}}
|