@moneko/core 3.56.14-beta.6 → 3.56.14
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/bin/help.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ink as e,println as t}from"@moneko/utils";let r=[{name:"start",description:"启动开发服务器",args:"<type> <framework>",arguments:[{name:"type",description:"backstage | library | site | micro | mobile"},{name:"framework",description:"react | solid | vue"}]},{name:"build",description:"构建应用(生产模式)",args:"<type> <framework>",arguments:[{name:"type",description:"backstage | library | site | micro | mobile"},{name:"framework",description:"react | solid | vue"}]},{name:"build-dev",description:"构建应用(开发模式)",args:"<type> <framework>",arguments:[{name:"type",description:"backstage | library | site | micro | mobile"},{name:"framework",description:"react | solid | vue"}]},{name:"eslint",description:"执行代码规范检查",args:"<source_path>",arguments:[{name:"source_path",description:"要检查的文件或目录路径"}]},{name:"stylelint",description:"执行样式规范检查",args:"<source_path>",arguments:[{name:"source_path",description:"要检查的文件或目录路径"}]},{name:"changelog",description:"生成项目变更日志",args:"<filename>",arguments:[{name:"filename",description:"输出的文件名"}]},{name:"server",description:"启动静态资源服务器",args:"[port] [root_dir] [https] [host]",arguments:[{name:"port",description:"number"},{name:"root_dir",description:"string"},{name:"https",description:"boolean"},{name:"host",description:"string"}]},{name:"setup",description:"设置一些默认行为; 比如开启 corepack、支持npm执行pre、post脚本等"},{name:"pin",description:"检查过时依赖",args:"[-u]",arguments:[{name:"-u",description:"写入更新到 package.json 中"}]},{name:"githooks",description:"配置 Git 钩子以自动化工作流"},{name:"buildApp",description:"将资产打包成App"}],i=[["mo","start","library react","# 启动开发服务器"],["mo","build","library react","#
|
|
1
|
+
import{ink as e,println as t}from"@moneko/utils";let r=[{name:"start",description:"启动开发服务器",args:"<type> <framework>",arguments:[{name:"type",description:"backstage | library | site | micro | mobile"},{name:"framework",description:"react | solid | vue"}]},{name:"build",description:"构建应用(生产模式)",args:"<type> <framework>",arguments:[{name:"type",description:"backstage | library | site | micro | mobile"},{name:"framework",description:"react | solid | vue"}]},{name:"build-dev",description:"构建应用(开发模式)",args:"<type> <framework>",arguments:[{name:"type",description:"backstage | library | site | micro | mobile"},{name:"framework",description:"react | solid | vue"}]},{name:"eslint",description:"执行代码规范检查",args:"<source_path>",arguments:[{name:"source_path",description:"要检查的文件或目录路径"}]},{name:"stylelint",description:"执行样式规范检查",args:"<source_path>",arguments:[{name:"source_path",description:"要检查的文件或目录路径"}]},{name:"changelog",description:"生成项目变更日志",args:"<filename>",arguments:[{name:"filename",description:"输出的文件名"}]},{name:"server",description:"启动静态资源服务器",args:"[port] [root_dir] [https] [host]",arguments:[{name:"port",description:"number"},{name:"root_dir",description:"string"},{name:"https",description:"boolean"},{name:"host",description:"string"}]},{name:"setup",description:"设置一些默认行为; 比如开启 corepack、支持npm执行pre、post脚本等"},{name:"pin",description:"检查过时依赖",args:"[-u]",arguments:[{name:"-u",description:"写入更新到 package.json 中"}]},{name:"githooks",description:"配置 Git 钩子以自动化工作流"},{name:"buildApp",description:"将资产打包成App"}],i=[["mo","start","library react","# 启动开发服务器"],["mo","build","library react","# 构建应用"],["mo","build-dev","library react","# 构建应用(开发模式,可用于输出一份支持 HMR 的模块联邦)"],["mo","eslint","components --fix","# 检查并修复components目录下的代码"],["mo","stylelint","src","# 检查src目录下的样式文件"],["mo","changelog","CHANGELOG.md","# 生成变更日志,输出到 CHANGELOG.md"],["mo","server","port=8080 root_dir=./dist","# 启动静态资源服务器,端口8080,根目录为./dist"],["mo","setup","","# 设置默认行为"],["mo","pin","-u","# 检查过时依赖并更新 package.json"],["mo","githooks",'pre-commit="npm run lint:commit" commit-msg="commit-lint"',"# 配置 Git 钩子,如 pre-commit 和 commit-msg"],["mo","buildApp","","# 打包应用"]];export default function(){let n=r.reduce((e,t)=>Math.max(e,t.name.length),0)+4,o=r.reduce((e,t)=>Math.max(e,t.args?.length||0),0)+4,a=r.map(t=>[" ",e(t.name.padEnd(n),"green"),e(`${t.args||""}`.padEnd(o),"208"),t.description,...(t.arguments||[]).map(t=>`
|
|
2
2
|
${" ".repeat(2+n+o)}${e(`${t.name}: `,"245",{bold:!0})}${e(t.description,"245",{italic:!0})}`),"\n"].join("")).join("\n"),m=i.reduce((e,t)=>Math.max(e,t[0].length+t[1].length+t[2].length),0),s=i.map(t=>` ${e(t[0],"blue")} ${e(t[1],"green")} ${e(t[2],"208")}${" ".padEnd(m-t[0].length-t[1].length-t[2].length+4)} ${e(t[3]||"","245")}`).join("\n");t(`
|
|
3
3
|
使用方法: ${e("mo","blue")} ${e("<命令>","green")} ${e("<必选参数>","208")} ${e("[可选参数]","yellow")}
|
|
4
4
|
|
package/lib/common.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{extname as e,join as t,resolve as o}from"node:path";import{argv as s}from"node:process";import a,{config_files as i,CUSTOMCONFIG as n,TMP_DIR as r}from"./commom/paths.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{digest as m,isObject as c,node_modules as p,resolveProgram as u}from"./utils/index.mjs";import{exampleModuleName as h}from"./vm/example.mjs";import d from"./vm/info.mjs";import{CONFIG as f}from"./config.mjs";import b from"./plugins.config.mjs";import{isCI as g,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as P}from"./process-env.mjs";export const outputConfig={path:u(j?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${P.name}`,pathinfo:y,clean:!0,publicPath:f.publicPath,workerPublicPath:f.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${d.projectName}`};let C={main:[p("@app/entry")]},x=[t(a.corePath,"./polyfills/public-path.mjs")];if(y&&f.refresh&&f.env.injectRemoteReactRefresh&&x.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),f.polyfill&&x.push(t(a.corePath,"./polyfills/replace-children.mjs")),f.entry&&("string"==typeof f.entry?C={...C,main:[f.entry]}:Object.keys(f.entry)&&(C=Object.assign(C,f.entry))),"string"==typeof C.main?C.main=[...x,C.main]:Array.isArray(C.main)&&(C.main=[...x,...C.main]),f.output){if("string"==typeof f.output)outputConfig.path=f.output;else if(Object.keys(f.output)){let e=f.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof f.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!
|
|
1
|
+
import{extname as e,join as t,resolve as o}from"node:path";import{argv as s}from"node:process";import a,{config_files as i,CUSTOMCONFIG as n,TMP_DIR as r}from"./commom/paths.mjs";import{OverrideResolverPlugin as l}from"./plugin/override-resolve.mjs";import{digest as m,isObject as c,node_modules as p,resolveProgram as u}from"./utils/index.mjs";import{exampleModuleName as h}from"./vm/example.mjs";import d from"./vm/info.mjs";import{CONFIG as f}from"./config.mjs";import b from"./plugins.config.mjs";import{isCI as g,isDev as y,isLibrary as j,NODE_ENV as v,packageJson as P}from"./process-env.mjs";export const outputConfig={path:u(j?"docs":"dist"),filename:"js/[name].[contenthash].bundle.js",chunkFilename:"js/[contenthash].chunk.js",assetModuleFilename:t=>{let o=e(t.filename||"").substring(1);return`assets/${o}/[hash][ext]`},library:{name:`${d.projectName}`,type:"umd",umdNamedDefine:!0},globalObject:"self",chunkLoadingGlobal:`webpackJsonp_${P.name}`,pathinfo:y,clean:!0,publicPath:f.publicPath,workerPublicPath:f.publicPath,asyncChunks:!0,charset:!0,iife:!0,crossOriginLoading:"use-credentials",enabledWasmLoadingTypes:["fetch"],uniqueName:`${d.projectName}`};let C={main:[p("@app/entry")]},x=[t(a.corePath,"./polyfills/public-path.mjs")];if(y&&f.refresh&&f.env.injectRemoteReactRefresh&&x.push(t(a.corePath,"./polyfills/inject-react-refresh.mjs")),f.polyfill&&x.push(t(a.corePath,"./polyfills/replace-children.mjs")),f.entry&&("string"==typeof f.entry?C={...C,main:[f.entry]}:Object.keys(f.entry)&&(C=Object.assign(C,f.entry))),"string"==typeof C.main?C.main=[...x,C.main]:Array.isArray(C.main)&&(C.main=[...x,...C.main]),f.output){if("string"==typeof f.output)outputConfig.path=f.output;else if(Object.keys(f.output)){let e=f.output,t={...outputConfig.library};Object.assign(outputConfig,e),"object"==typeof f.output&&e.library&&(outputConfig.library=Object.assign(t,e.library))}}let k={type:"filesystem",allowCollectingMemory:!0,cacheDirectory:a.webpackCachePath,memoryCacheUnaffected:!0,name:await m([s[2],n,v].join("-"),"SHA-256"),version:`${P.version}`,buildDependencies:{config:i},maxMemoryGenerations:1};!1===f.cache?k=!1:c(f.cache)&&(k=Object.assign(k,f.cache)),g&&(void 0===f.cache||f.cache&&!f.cache.cacheDirectory)&&(k.cacheDirectory=o(r,P.name));let M={},w={imports:!0,entries:!0,test:e=>{let t=e.nameForCondition();return!!(t&&(t.startsWith(p(h))||t.startsWith(p("@app/comment"))||t.startsWith(a.pagesPath)||t.startsWith(a.componentsPath)))}};f.lazyCompilation&&y&&"true"!==process.env.IS_BUILD?c(f.lazyCompilation)?Object.assign(M,w,f.lazyCompilation):Object.assign(M,w):M=!1;export const commonConfig={name:"client",target:"web",devtool:f.devtool,entry:C,mode:f.mode??"production",stats:"errors-only",cache:k,snapshot:{immutablePaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],managedPaths:[a.pnpmNodeModules,a.denoNodeModules,/node_modules\/(?!(@app)\/)/],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}},infrastructureLogging:{level:"error"},externalsPresets:f.externalsPresets,plugins:b,node:{global:!1,__filename:!1,__dirname:!1},experiments:{asyncWebAssembly:!0,cacheUnaffected:!0,lazyCompilation:M,buildHttp:c(f.buildHttp)?{allowedUris:[],lockfileLocation:o(a.httpCachePath,"http.lock"),cacheLocation:o(a.httpCachePath,"data"),upgrade:!0,...f.buildHttp}:f.buildHttp,backCompat:!0,futureDefaults:!0,css:!1,outputModule:!1},resolve:{extensions:[".mts",".mjs",".ts",".tsx",".js",".jsx",".json",".wasm"],alias:f.alias,modules:[a.nodeModules,a.pnpmNodeModules,a.denoNodeModules],mainFields:["browser","module","main"],mainFiles:["index"],plugins:f.resolvePlugins,preferAbsolute:!0,cache:!0,fallback:{}},externals:f.externals,output:outputConfig,recordsPath:f.recordsPath?t(a.programPath,f.recordsPath):t(a.webpackCachePath,"records.json")};f.overrideResolve&&commonConfig.resolve.plugins.push(new l(Object.assign({original:f.alias["@"],override:n&&u(n)},f.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 r}from"./polyfills/targets.mjs";import{commonConfig 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 r}from"./polyfills/targets.mjs";import{commonConfig as o}from"./common.mjs";import{CONFIG as t}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 a=[];t.minifier&&(a.push(new n({compress:{ecma:2015,toplevel:!1,module:!1,ie8:!1,keep_fnames:!1,top_retain:[],keep_infinity:!0},...t.minifier})),a.push(new m({targets:r()})));let c=i(o,{module:p(!1),plugins:[new e.HotModuleReplacementPlugin],optimization:{runtimeChunk:t.runtimeChunk,minimize:a.length>0,minimizer:a,chunkIds:"deterministic",moduleIds:"deterministic",concatenateModules:!0,emitOnErrors:!1,removeAvailableModules:!0,removeEmptyChunks:!0,mergeDuplicateChunks:!0,sideEffects:!0,providedExports:!0,flagIncludedChunks:!0,innerGraph:!1,mangleExports:!1,portableRecords:!0,realContentHash:!1}});if(s&&l){let e=(await import("@pmmmwh/react-refresh-webpack-plugin")).default;c.plugins.push(new e({overlay:!1}))}return i(c,u)}
|