@moneko/core 3.9.17-beta.6 → 3.9.17-beta.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/build.mjs +1 -1
- package/lib/common.mjs +1 -1
- package/lib/dev.mjs +3 -3
- package/lib/info.d.mts +1 -0
- package/lib/info.mjs +1 -1
- package/lib/module.config.mjs +1 -1
- package/lib/utils.mjs +1 -1
- package/package.json +5 -3
package/lib/build.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeDirAll as e}from"@moneko/mdx";import
|
|
1
|
+
import{removeDirAll as e}from"@moneko/mdx";import n from"mini-css-extract-plugin";import m from"terser-webpack-plugin";import o from"webpack";import{BundleAnalyzerPlugin as i}from"webpack-bundle-analyzer";import{merge as r}from"webpack-merge";import t from"webpack-node-externals";import s from"webpackbar";import{commonConfig as l}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{getMinifyOption as a}from"./minify.mjs";import u,{CUSTOMCONFIG as c}from"./paths.mjs";import f from"./plugin/lightningcss-plugin.mjs";import{SSR as h}from"./process-env.mjs";import{compilerListener as d,resolveProgramPath as b}from"./utils.mjs";import k from"./seo.mjs";import g from"./module.config.mjs";let{optimize:{MinChunkSizePlugin:w,ModuleConcatenationPlugin:j}}=o,y=[];p.minifier&&(y.push(new m(a(p.minifier?.type||"swc",p.minifier?.options))),y.push(new f));let z={splitChunks:p.splitChunk,runtimeChunk:p.runtimeChunk,chunkIds:"named",moduleIds:"named",removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,mangleWasmImports:!0,minimize:!0,minimizer:y},v=[new j,new n({filename:"style/[name].bundle.css",chunkFilename:"style/[name].chunk.css",experimentalUseImportModule:!0}),p.splitChunk&&new w({minChunkSize:1e4}),p.bundleAnalyzer&&new i(p.bundleAnalyzer)].filter(Boolean),C=[r(l,{optimization:z,module:g(!1),plugins:[...v,p.bar&&new s(p.bar)].filter(Boolean)})];if(h){let e=r(l,{entry:{main:b("site/ssr.tsx")},output:{clean:!1,path:b("ssr"),library:{type:"commonjs2",umdNamedDefine:!1},filename:"[name].cjs",chunkFilename:"[name].cjs",globalObject:"global"},cache:{type:"filesystem",name:[c,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externals:[t()],optimization:z,module:g(!0),target:"node",plugins:[...v,new s({name:"Server"})]});C.push(e)}let x=o(C),I=x.compilers.find(e=>"web"===e.options.target),A=x.compilers.find(e=>"node"===e.options.target);function B(e,n){if(e)throw e;n?.compilation.errors&&console.error(...n.compilation.errors)}let D=[];I&&(I.run(B),D.push(d("client",I))),A&&(A.run(B),D.push(d("server",A))),async function(){await Promise.all(D),p.done?.(),p.seo&&k()}(),process.on("exit",function(){e(u.cachePath)});
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import r from"./plugin/override-resolve.mjs";import l from"./plugins.config.mjs";import{PACKAGENAME as n,PACKAGEVERSION as a,isDev as i,isLibrary as p}from"./process-env.mjs";import{resolveNodeModulesPath as c,resolveProgramPath as
|
|
1
|
+
import{CONFIG as e,PUBLICPATH as t}from"./config.mjs";import o,{CUSTOMCONFIG as s}from"./paths.mjs";import r from"./plugin/override-resolve.mjs";import l from"./plugins.config.mjs";import{PACKAGENAME as n,PACKAGEVERSION as a,isDev as i,isLibrary as p}from"./process-env.mjs";import{resolveNodeModulesPath as c,resolveProgramPath as u}from"./utils.mjs";export const outputConfig={path:u(p?"docs":"dist"),filename:"js/[name].bundle.js",chunkFilename:`js/[${i?"name":"chunkhash"}].js`,assetModuleFilename:e=>{let t=e.filename;return t&&t.endsWith("?url")&&/(?:webworker|worker)(\.|\b).*\.(js|ts)\b/.test(t.replace("?url",""))?"worker/[name][ext]":"assets/[name][hash][ext]"},library:{name:n,type:"window"},globalObject:"window",chunkLoadingGlobal:`webpackJsonp_${n}`,pathinfo:i,clean:!0,publicPath:t,asyncChunks:!0,charset:!0};let m={main:c("@app/entry")};e.polyfill&&Object.assign(m,{"dom-polyfills":[`${o.corePath}/polyfills/replace-children.js`]}),e.entry&&("string"==typeof e.entry?m={main:[e.entry]}:Object.keys(e.entry)&&Object.assign(m,e.entry)),e.output&&("string"==typeof e.output?outputConfig.path=e.output:Object.keys(e.output)&&Object.assign(outputConfig,e.output));let d=!1;e.cacheDirectory&&(d={type:"filesystem",store:"pack",allowCollectingMemory:!0,cacheDirectory:e.cacheDirectory,memoryCacheUnaffected:!0,name:[s,process.env.NODE_ENV].filter(Boolean).join("-"),version:a});let f=Object.assign({original:e.alias["@"],override:s&&u(s)},e.overrideResolve),y=!1===e.devtool||e.devtool?e.devtool:i?"eval-cheap-module-source-map":"cheap-module-source-map";export const commonConfig={devtool:y,entry:m,mode:i?"development":"production",stats:"errors-only",cache:d,infrastructureLogging:{level:"error"},target:"web",externalsPresets:e.externalsPresets,plugins:l,node:{global:!1},experiments:{topLevelAwait:!0,asyncWebAssembly:!0,cacheUnaffected:!0,layers:!0,lazyCompilation:i&&{imports:!1,entries:!1},buildHttp:e.buildHttp,backCompat:!0,futureDefaults:!1,css:!1,outputModule:!1},resolve:{extensions:["...",".jsx",".ts",".tsx"],alias:e.alias,modules:[o.nodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:[e.overrideResolve&&new r(f),...e.resolvePlugins].filter(Boolean),fallback:{path:!1,fs:!1,crypto:!1,assert:!1}},externals:e.externals,output:outputConfig};
|
package/lib/dev.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import e from"chalk";import t from"webpack";import o from"webpack-node-externals";import s from"express";import
|
|
2
|
-
`);function
|
|
3
|
-
${
|
|
1
|
+
import e from"chalk";import t from"webpack";import o from"webpack-node-externals";import s from"express";import r from"cors";import a from"webpack-dev-middleware";import i from"webpack-hot-middleware";import{merge as l}from"webpack-merge";import n from"webpackbar";import{commonConfig as m}from"./common.mjs";import{CONFIG as p}from"./config.mjs";import{hasPkg as c}from"./has-pkg.mjs";import{getIPv4 as u,getPort as d}from"./net.mjs";import{SSR as f,isLibrary as h,isReact as w}from"./process-env.mjs";import{compilerListener as b,log as g,resolveProgramPath as k}from"./utils.mjs";import j from"./module.config.mjs";import{CUSTOMCONFIG as $}from"./paths.mjs";let{HotModuleReplacementPlugin:v,WatchIgnorePlugin:x}=t,{yellow:y,green:_,grey:S,gray:B,bgBlue:T,bgGreenBright:D,blueBright:E,greenBright:N}=e,O=c("eslint-webpack-plugin"),P=c("stylelint-webpack-plugin");c("@moneko/mock");let F=P?(await import("stylelint-webpack-plugin")).default:null,M=O?(await import("eslint-webpack-plugin")).default:null,C=p.devServer.port||3e3,I=await d(C,65535,p.devServer.host),J=w&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default;p.devServer.port=I;let U="/"===p.basename,G=p.devServer.https?"https:":"http:",H=U?"":p.basename,L=p.devServer.port!==I&&B(`Port ${y(C)} is in use, trying ${_(I)} instead.
|
|
2
|
+
`);function V(e){return`${G}//${"local"===e?p.devServer.host:u()}:${I}${H}`}let Y=B("You application is running here:"),q=`${T(" Local ")} ${E(V("local"))}
|
|
3
|
+
${D(" Network ")} ${N(V("net"))}`,z=["js","jsx","ts","tsx","json","html","vue"],A=z.join(","),K=["css","scss","sass","less","ts","tsx","js","jsx"],Q=K.join(","),R=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],W=[new x({paths:[/\.d\.ts$/]})].filter(Boolean),X=s(),Z=l(m,{entry:{main:[`webpack-hot-middleware/client?path=http://localhost:${I}/__webpack_hmr&timeout=2000`,...m.entry.main]},output:{hotUpdateMainFilename:"updates/[fullhash].hot-update.json",hotUpdateChunkFilename:"updates/[id].[fullhash].hot-update.js"},module:j(!1),plugins:[...W,new v,J&&new J,M&&new M({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${A}}`,h&&`${p.alias["@pkg"]}/**/*.{${A}}`].filter(Boolean),extensions:z,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),F&&new F({fix:!0,threads:!0,files:[`${p.alias["@"]}/**/*.{${Q}}`,h&&`${p.alias["@pkg"]}/**/*.{${Q}}`].filter(Boolean),extensions:K,exclude:R,cache:!0,lintDirtyModulesOnly:!0}),p.bar&&new n(p.bar)].filter(Boolean)}),ee=[Z];if(f){let e=l(m,{entry:{main:k("site/ssr.tsx")},output:{clean:!1,path:k("ssr"),library:{type:"commonjs2"},filename:"[name].cjs",chunkFilename:"[name].cjs",globalObject:"global"},cache:{type:"filesystem",name:[$,process.env.NODE_ENV,"server"].filter(Boolean).join("-")},externals:[o()],module:j(!0),target:"node",plugins:[...W,new n({name:"Server"})].filter(Boolean)});ee.push(e)}let et=t(ee),eo=et.compilers.find(e=>"web"===e.options.target),es=et.compilers.find(e=>"node"===e.options.target);X.use(r()),X.use(a(eo,{publicPath:Z.output.publicPath,stats:Z.stats,writeToDisk:!0})),X.use(i(eo,{log:!1,path:"/__webpack_hmr",heartbeat:2e3}));let er=[];eo&&er.push(b("client",eo)),es&&(es.watch({aggregateTimeout:20,ignored:/node_modules(?![\\/]@app)/,poll:1e3},function(e,t){!e&&t&&(process.stdout.write("\x1b[2J\x1b[3J\x1b[H"),g([Y,"",q,"",S(`Compiled successfully in ${_(`${t.endTime-t.startTime}ms`)}`)]),t.compilation.warnings.forEach(e=>g(e.message)),t.compilation.errors.forEach(e=>g(e.message)))}),er.push(b("server",es))),await Promise.all(er),X.listen(I,()=>{L&&g(L)}),process.on("exit",function(){}),process.on("SIGINT",()=>{process.exit()});
|
package/lib/info.d.mts
CHANGED
package/lib/info.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"./config.mjs";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s}from"./process-env.mjs";import{resolveProgramPath as
|
|
1
|
+
import{loadFileSync as e}from"@moneko/mdx";import{CONFIG as r}from"./config.mjs";import{APPTYPE as o,PACKAGENAME as t,PACKAGEVERSION as s,SSR as p}from"./process-env.mjs";import{resolveProgramPath as i,toUpperCaseString as m}from"./utils.mjs";let{description:n,author:a,repository:c,keywords:d}=JSON.parse(e(i("package.json"))||"{}"),f="string"==typeof a,l={name:t,projectName:m(t).replace(/-/g," "),ssr:p,version:s,base:r.basename,type:o,routerMode:r.routerMode,prefixCls:r.prefixCls,theme:r.theme,description:n,author:f?{name:a}:a,repository:f?{url:c}:c};export const description=n;export const keywords=Array.isArray(d)?d.toString():"";export default l;
|
package/lib/module.config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import r from"./modify-vars.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{FRAMEWORK as l,
|
|
1
|
+
let e;import s from"mini-css-extract-plugin";import{CONFIG as t,PUBLICPATH as o}from"./config.mjs";import r from"./modify-vars.mjs";import a,{CUSTOMCONFIG as i}from"./paths.mjs";import{FRAMEWORK as l,isDev as n,isLibrary as m,isMicro as d}from"./process-env.mjs";import c from"./svg-to-data-uri.mjs";import p from"./swcrc.mjs";import{getLightningCssTargets as u}from"./targets.mjs";import{resolveNodeModulesPath as f,resolveProgramPath as y}from"./utils.mjs";import{comment as g,getCommentPath as j}from"./vm/docs.mjs";import $ from"./vm/generate-doc.mjs";import{hasPkg as x}from"./has-pkg.mjs";let v=d?o:"../",h={loader:s.loader,options:{publicPath:"/"!==v?v:"../"}},w={loader:`${a.corePath}/loader/lightningcss.cjs`,options:{sourceMap:!!t.sourceMap,analyzeDependencies:!1,targets:u(),drafts:{nesting:!0,customMedia:!0},errorRecovery:!1,unusedSymbols:[],rem:!!t.rem}};n&&(h="style-loader");let b=[...t.cssModules,`@moneko/${l}`,"neko-ui"].map(f),_=["components","example","mock","site","src","server"].map(y);function k(e){return _.concat(t.rulesInclude?.[e]?.map(f)||[])}i&&_.push(y(i)),t.overrideResolve&&t.overrideResolve.override&&_.push(t.overrideResolve.override);let M=k("css"),B=k("js"),L=k("media"),O=k("wasm"),P=k("font");x("sass")&&(e={loader:"sass-loader",options:{implementation:await import("sass"),sassOptions:{}}});export default(s=>{let o={loader:"swc-loader",options:p(s)},i={loader:"css-loader",options:{modules:{auto:e=>{for(let s=0,t=b.length;s<t;s++)if(e&&e?.includes(b[s]))return/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e);return/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i.test(e)},localIdentName:"[path][name]__[local]",exportLocalsConvention:"dashesOnly",exportOnlyLocals:s},importLoaders:2}},l=[h,i,w,{loader:"less-loader",options:{sourceMap:!!t.sourceMap,lessOptions:{modifyVars:r,javascriptEnabled:!0}}}].filter(Boolean);return{noParse:[/jquery|lodash|prismjs|prism\.js/,/react\.min\.js$/,/marked\.min\.js$/],rules:[m&&n&&{test:/^(?![._]).*(?<!\.test)\.(tsx?)$/,include:t.alias["@pkg"],exclude:[/node_modules/,/(.+)\/__tests__\/(.+)/i],enforce:"pre",loader:`${a.corePath}/loader/ts-doc.cjs`,options:{comment:g,generateDoc:$,getCommentPath:j}},{oneOf:[{resourceQuery:/raw/i,type:"asset/source"},{resourceQuery:/url/i,type:"asset/resource",generator:{filename:e=>{let s=e.filename;return s&&s.endsWith("wasm?url")?"wasm/[name][ext]":"assets/[name][ext]"}}},{test:/\.wasm$/i,type:"webassembly/async",include:O},{test:/\.txt$/i,type:"asset/source"},{test:/\.ico$/i,type:"asset/inline",include:L},{test:/\.svg$/i,type:"asset/inline",generator:{dataUrl:e=>c(e.toString())},include:L},{test:/\.(gif|png|jpe?g|webp)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/images/[name][ext]"},include:L},{test:/\.(webm|mp4|ogv)$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/video/[name][ext]"},include:L},{test:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,type:"asset",dependency:{not:["url"]},generator:{filename:"assets/fonts/[name][ext]"},include:P},{test:/\.(sa|sc)ss$/i,use:[h,i,w,e].filter(Boolean),include:M},{test:/\.less$/i,use:l,include:M},{test:/\.css$/i,use:[h,"css-loader",w].filter(Boolean),include:M},{test:/\.(cj|mj|t|j)s(|x)$/i,use:[...t.prefixJsLoader,o].filter(Boolean),include:B},{test:/\.mdx?$/i,use:[...t.prefixJsLoader,{loader:`${a.corePath}/loader/mdx.cjs`,options:t.mdx}].filter(Boolean),exclude:[/node_modules/]},{type:"asset/source",include:[/(.+)\/examples\/(.+).*?$/i]}]},...t.moduleRules].filter(e=>"object"==typeof e)}});
|
package/lib/utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{resolve as o}from"path";import r from"readline";import{saveFileSync as t}from"@moneko/mdx";import{transformFileSync as e}from"@swc/core";import n from"./paths.mjs";import s from"./resolver-sync.mjs";export function esm(o,...r){let t=o.raw[0];for(let e=0;e<r.length;e++)t+=r[e]+o.raw[e+1];return`data:text/javascript;base64,${Buffer.from(t).toString("base64")}`}let c={inputSourceMap:!1,sourceMaps:!1,module:{type:"es6"},jsc:{parser:{syntax:"typescript"},loose:!1}};export function log(o){Array.isArray(o)?o.forEach(o=>{log(`${o}
|
|
2
|
-
`)}):(r.cursorTo(process.stdout,0),process.stdout.write(o))}export function tfc(o){return e(o,c).code||"{}"}export function readConf(o,r){let e=`${n.cachePath}/${r}.mjs`;return t(e,tfc(o)),import(e)}export function toUpperCaseString(o){return o?.replace(/\b\w/g,o=>o.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return o(n.programPath,`./${r}`)}export const resolveNodeModulesPath=o=>`${n.nodeModules}/${o}`;export const realResolve=o=>s.resolveSync({},n.programPath,o)||o;export function isObject(o){let r=typeof o;return null!==o&&("object"==r||"function"==r)}export function isFunction(o){if(!isObject(o))return!1;let r=Object.prototype.toString.call(o);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}export function compilerListener(o,r){return new Promise((t,e)=>{r.hooks.failed.tap(o,o=>{e(o)}),r.hooks.done.tap(o,o=>{o.hasErrors()||t(!0),o.
|
|
2
|
+
`)}):(r.cursorTo(process.stdout,0),process.stdout.write(o))}export function tfc(o){return e(o,c).code||"{}"}export function readConf(o,r){let e=`${n.cachePath}/${r}.mjs`;return t(e,tfc(o)),import(e)}export function toUpperCaseString(o){return o?.replace(/\b\w/g,o=>o.toUpperCase()).replace(/\./g," ")}export function resolveProgramPath(r){return o(n.programPath,`./${r}`)}export const resolveNodeModulesPath=o=>`${n.nodeModules}/${o}`;export const realResolve=o=>s.resolveSync({},n.programPath,o)||o;export function isObject(o){let r=typeof o;return null!==o&&("object"==r||"function"==r)}export function isFunction(o){if(!isObject(o))return!1;let r=Object.prototype.toString.call(o);return"[object Function]"==r||"[object AsyncFunction]"==r||"[object GeneratorFunction]"==r||"[object Proxy]"==r}export function empty(){}export function compilerListener(o,r){return new Promise((t,e)=>{r.hooks.failed.tap(o,o=>{e(o)}),r.hooks.done.tap(o,o=>{o.hasErrors()||t(!0),o.compilation.warnings.forEach(o=>log(o.message)),o.compilation.errors.forEach(o=>log(o.message))})})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.9.17-beta.
|
|
3
|
+
"version": "3.9.17-beta.7",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@swc/core": "1.3.101",
|
|
20
20
|
"add-asset-html-webpack-plugin": "6.0.0",
|
|
21
21
|
"chokidar": "3.5.3",
|
|
22
|
+
"compression": "1.7.4",
|
|
22
23
|
"core-js": "3.34.0",
|
|
23
24
|
"core-js-compat": "3.34.0",
|
|
24
25
|
"cors": "2.8.5",
|
|
@@ -46,8 +47,9 @@
|
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@swc/cli": "0.1.63",
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/
|
|
50
|
+
"@types/compression": "1.7.5",
|
|
51
|
+
"@types/cors": "2.8.17",
|
|
52
|
+
"@types/express": "4.17.21",
|
|
51
53
|
"eslint-webpack-plugin": "4.0.1",
|
|
52
54
|
"sass": "1.69.5",
|
|
53
55
|
"sass-loader": "13.3.2",
|