@moneko/core 3.25.0-beta.2 → 3.26.0-beta.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/bin/build-app.d.ts +1 -0
- package/lib/bin/build-app.mjs +1 -0
- package/lib/bin/build.d.ts +1 -0
- package/lib/bin/build.mjs +1 -0
- package/lib/bin/changelog.d.ts +1 -0
- package/lib/bin/changelog.mjs +4 -0
- package/lib/bin/eslint.d.ts +1 -0
- package/lib/bin/eslint.mjs +1 -0
- package/lib/bin/file.d.ts +17 -0
- package/lib/bin/file.mjs +1 -0
- package/lib/bin/git-hooks.d.ts +1 -0
- package/lib/bin/git-hooks.mjs +1 -0
- package/lib/bin/index.d.ts +9 -0
- package/lib/bin/index.mjs +2 -0
- package/lib/bin/lessc.d.ts +1 -0
- package/lib/bin/lessc.mjs +1 -0
- package/lib/bin/runlint.d.ts +2 -0
- package/lib/bin/runlint.mjs +2 -0
- package/lib/bin/start.d.ts +1 -0
- package/lib/bin/start.mjs +1 -0
- package/lib/bin/stylelint.d.ts +1 -0
- package/lib/bin/stylelint.mjs +1 -0
- package/lib/bin/utils/bundle-app.d.ts +2 -0
- package/lib/bin/utils/bundle-app.mjs +1 -0
- package/lib/bin/utils/config.d.ts +6 -0
- package/lib/bin/utils/config.mjs +1 -0
- package/lib/bin/utils/require.d.ts +2 -0
- package/lib/bin/utils/require.mjs +1 -0
- package/lib/bin/utils/setup-env.d.ts +6 -0
- package/lib/bin/utils/setup-env.mjs +1 -0
- package/lib/bin/utils/setup-swcrc.d.ts +2 -0
- package/lib/bin/utils/setup-swcrc.mjs +1 -0
- package/lib/bin/version.d.ts +1 -0
- package/lib/bin/version.mjs +1 -0
- package/lib/config.mjs +1 -1
- package/lib/dev.mjs +1 -1
- package/package.json +5 -1
- package/typings/global.d.ts +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{program as r}from"commander";import{CONFIG as o}from"../config.mjs";let t=async()=>{try{let r=o.bundleId;if(!r)throw Error("请配置 bundleId");if(!/(^com\.)([a-zA-Z_][a-zA-Z0-9_]*[.])*([a-zA-Z_][a-zA-Z0-9_]*)$/.test(r)||3!==r.split(".").length)throw Error("软件包名不合法");let t=o.bundles;if(!t||0===t.length)throw Error("请配置 bundles (打包类型)");console.log(r,t)}catch{}};r.command("buildApp").description("编译将 h5 应用打包成移动客户端,使用 Flutter").action(t);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawn as e}from"child_process";import{join as o,relative as s}from"path";import{program as t}from"commander";import i from"./utils/setup-env.js";import{lesscCommonjs as r}from"./lessc.js";import{corePackageName as n,cwd as m,swcCachePath as l,runtimePath as c}from"./utils/config.js";import p from"./utils/setup-swcrc.js";import d from"./utils/require.js";import{__dirname as f}from"./file.js";import{deleteEmptyDirs as a,updateFileSync as u,removeDir as j,ink as $,println as y,scanFolderSync as g,removeFile as _}from"@moneko/utils";let b={stdio:"inherit",shell:!0};t.command("build <type> <framework>").description("编译项目").action(async(t,h,...x)=>{t||(y($(`type: 无效值 ${$(t,"245")}`,"red")),process.exit(1)),await i("production",t,h);let v=x[1].args.slice(2),C=!v.includes("no-docs"),w=!v.includes("no-lib"),E=!v.includes("no-es"),k=`${c} ${d.resolve(`${n}/lib/build.mjs`)}`;if("library"===t){let t=p(h),i=d.resolve("typescript/bin/tsc"),n=d.resolve("@swc/cli/bin/swc.js"),$=[w&&{type:"commonjs",dir:"lib",msg:"Convert to CommonJS"},E&&{type:"es6 -C jsc.target=es2015",dir:"es",msg:"Convert to ES Module"}].filter(Boolean),y=o(f,".types.json");$.length&&u(y,JSON.stringify({extends:s(f,o(m,"tsconfig.json")),include:[s(f,o(m,"components")),s(f,o(m,"typings"))],exclude:[s(f,o(m,"components/**/examples/*")),s(f,o(m,"components/**/__tests__/*")),s(f,o(m,"components/**/__mocks__/*"))]}));for(let s=0,p=$.length;s<p;s++){let p=o(m,`./${$[s].dir}`);j(p),e(`${c} ${n} components -d ${$[s].dir} -q --strip-leading-paths --config-file ${t} -C jsc.experimental.cacheRoot=${l} -C module.type=${$[s].type} -D --ignore "**/*.test.(js|ts)x?$"`,b).on("close",function(e){0===e&&(g(p,["README.mdx","examples","__*__"]).forEach(_),a(p),"commonjs"===$[s].type&&r())}),e(`${c} ${i} --project ${y} --outDir ${$[s].dir}`,b)}}("library"!==t||C&&"library"===t)&&e(k,b)});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{execSync as t}from"child_process";import{join as e}from"path";import{program as o}from"commander";import{cwd as r}from"./utils/config.js";import{updateFileSync as s}from"@moneko/utils";let i={feat:"✨ Features",fix:"🐛 Bug Fixes",docs:"📚 Documentation",style:"💎 Styles",refactor:"📦 Code Refactoring",perf:"🚀 Performance Improvements",test:"🚨 Tests",build:"🛠 Builds",ci:"⚙️ Continuous Integrations",chore:"♻️ Chores",revert:"🗑 Reverts"};function n(e,o){return function(t){let e=[];for(let o of t.trim().split("\n")){let[t,r,s,n,a]=o.split("|");if(a){let o=a.split(": "),l=i[o[0]];e.push({commitId:t,author:r,email:s,date:new Date(n).toLocaleString().replace(/\//g,"-"),message:l?o.slice(1).join(":"):a,type:l})}}return e}(t(`git log ${e?`${e}..`:""}${o||""} --format='%H|%an|%ae|%ad|%s'`,{encoding:"utf-8"}))}o.command("changelog <filename>").description("生成 CHANGELOG.md").action(o=>{let i=["# Change log"];try{t('git show-ref --quiet --verify "refs/heads/$(git rev-parse --abbrev-ref HEAD)";');let e=t('git config --get remote.origin.url | sed "s/\\.git$//"').toString().trim(),o=function(e){let o=t("git for-each-ref --sort='v:refname' --format '%(objectname) %(refname:short) %(creatordate:iso8601)' refs/tags",{encoding:"utf-8"}),r=[],s=o.trim().split("\n");return s.forEach((t,o)=>{let[i,n,a]=t.split(" "),l=s[o-1]?.split(" ")[1],c=`## ${n}`;l&&(c=`## [${n}](${e}/compare/${l}...${n}) (${new Date(a).toLocaleDateString().replace(/\//g,"-")})`),r.push({commitId:i,tag:n,date:a,title:c,logs:{}})}),r}(e);o.forEach((t,r)=>{if(r&&n(o[r-1].tag,t.tag).forEach(t=>{if(t.type){let s=o[r].logs[t.type]||[];s.push(`- ${t.message} ([${t.commitId.substring(0,7)}](${e}/commit/${t.commitId}))`),Object.assign(o[r].logs,{[t.type]:s})}}),r===o.length-1){let s=n(t.tag);s.length&&o.push({title:"## Last",logs:{}}),s.forEach(t=>{if(t.type){let s=o[r+1].logs[t.type]||[];s.push(`- ${t.message} ([${t.commitId.substring(0,7)}](${e}/commit/${t.commitId}))`),Object.assign(o[r+1].logs,{[t.type]:s})}})}}),o.reverse().forEach(t=>{for(let e in i.push(`
|
|
2
|
+
${t.title}`),t.logs)Object.prototype.hasOwnProperty.call(t.logs,e)&&(i.push(`
|
|
3
|
+
### ${e}
|
|
4
|
+
`),t.logs[e].forEach(t=>i.push(t)))})}catch{i.push("\n当前分支尚无任何提交\n")}s(e(r,o),i.join("\n"))});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as o,relative as i}from"path";import{program as t}from"commander";import{runLint as n}from"./runlint.js";import{cachePath as r,cwd as e,runtimePath as s}from"./utils/config.js";import c from"./utils/require.js";t.command("eslint <soucre>").option("-o, --output-file").option("-f, --format").option("--color, --no-color").option("--fix").option("--fix-dry-run").option("--ext").description("js代码规范检查").action((t,l,m)=>{let p=o(c.resolve("eslint"),"../../bin/eslint.js");n(`${s} ${p} ${i(e,t)} --config ${i(e,"eslint.config.mjs")} ${m.parent.args.slice(2).join(" ")} --cache --cache-location "${r}/.eslintcache"`,"eslint")});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const __filename: string;
|
|
2
|
+
export declare const __dirname: string;
|
|
3
|
+
/**
|
|
4
|
+
* 拷贝文件
|
|
5
|
+
* @param {String} source 源文件
|
|
6
|
+
* @param {String} target 目标文件
|
|
7
|
+
* @constructor
|
|
8
|
+
* */
|
|
9
|
+
export declare function copyFileSync(source: string, target: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* 拷贝文件夹
|
|
12
|
+
* @param {String} source 源文件夹
|
|
13
|
+
* @param {String} target 目标文件夹
|
|
14
|
+
* @param {String} sun 是否子文件夹
|
|
15
|
+
* @constructor
|
|
16
|
+
* */
|
|
17
|
+
export declare function copyFolderRecursiveSync(source: string, target: string, sun?: boolean): void;
|
package/lib/bin/file.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadFileSync as o,saveFileSync as e}from"@moneko/utils";import{statSync as i,readdirSync as r}from"fs";import t from"path";import n from"url";export const __filename=n.fileURLToPath(import.meta.url);export const __dirname=t.dirname(__filename);export function copyFileSync(r,n){let c=o(r);if(null!==c){let o=n;i(n).isDirectory()&&(o=t.join(n,t.basename(r))),e(o,c)}}export function copyFolderRecursiveSync(o,e,n){let c=e;n&&(c=t.join(e,t.basename(o))),i(o).isDirectory()&&r(o).forEach(function(e){let r=t.join(o,e);i(r).isDirectory()?copyFolderRecursiveSync(r,c,!0):copyFileSync(r,c)})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{program as o}from"commander";import{runLint as i}from"./runlint.js";o.command("githooks").description("git hooks工具").action((o,t)=>{let n="node_modules/.husky",m=t.args.map(o=>{let i=o.split("=");return`echo "${i[1]}" > ${n}/${i[0]}`}).join(" && ");i(`git init && husky ${n} && ${m}`,"githooks",[null])});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{program as i}from"commander";import"./version.js";import"./eslint.js";import"./stylelint.js";import"./build.js";import"./start.js";import"./build-app.js";import"./git-hooks.js";import"./changelog.js";i.option("-ig,--initgit","init git"),i.parse(process.argv),["SIGINT","SIGTERM","SIGQUIT"].forEach(i=>process.on(i,()=>{process.exit(0)}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lesscCommonjs(): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as s}from"path";import{exec as e}from"child_process";import{runtimePath as o,corePackageName as t}from"./utils/config.js";import i from"./utils/require.js";import{loadFile as l,saveFile as r,scanFolderSync as m}from"@moneko/utils";let n="";function a(t){let l=s(i.resolve("less"),"../bin/lessc");return new Promise((s,i)=>{e(`${o} ${l} --js ${n} ${t} > ${t.replace(/\.less$/g,".css")}`,function(e){if(e)return i(e);s(!0)})})}let c=/\*?\.less/g;async function f(s){let e=await l(s);e&&c.test(e)&&await r(s,e.replace(c,".css"))}export async function lesscCommonjs(){let s=m("lib",["\\.less$"]),e=(await import(i.resolve(`${t}/lib/options/modify-vars.mjs`))).default;for(let s in e)Object.hasOwnProperty.call(e,s)&&(n+=`--modify-var="${s}=${e[s]}" `);Promise.all(s.map(a)),s.length&&Promise.all(m("lib",["\\.js$"]).map(f))}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ink as t,print as s}from"@moneko/utils";import{spawnSync as e}from"child_process";export const runLint=(r,o,i="inherit")=>{let l=t(o,"cyan");s(l+": "+t("Runing...","yellow"),!0);let n=e(r,{stdio:i,shell:!0});s(l+": "+t(`✨ ${0!==n.status?"Error":"Successfully"}!
|
|
2
|
+
`,0!==n.status?"red":"green"),!0),process.exit(n.status||0)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spawn as e}from"child_process";import{program as i}from"commander";import{ink as o,println as r}from"@moneko/utils";import{corePackageName as t,runtimePath as s}from"./utils/config.js";import m from"./utils/setup-env.js";import p from"./utils/require.js";i.command("start <type> <framework>").description("运行项目").action(async(i,l,...n)=>{i||(r(o("type: 无效值 "+o(i,"245"),"red")),process.exit(1)),await m("development",i,l);let c=n[1].args.slice(2),f=c.indexOf("no-verify");-1!==f&&c.splice(f,1),e(`${s} ${p.resolve(`${t}/lib/dev.mjs`)}`,{stdio:"inherit",shell:!0})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{relative as o,join as t}from"path";import{program as i}from"commander";import{cachePath as s,cwd as e,runtimePath as n}from"./utils/config.js";import{runLint as r}from"./runlint.js";import l from"./utils/require.js";i.command("stylelint <soucre>").option("-o, --output-file").option("-f, --format").option("--color, --no-color").option("--fix").option("--fix-dry-run").option("--ext").description("css代码规范检查").action((i,c,m)=>{let p=t(l.resolve("stylelint"),"../../bin/stylelint.mjs");r(`${n} ${p} ${o(e,i)}/**/**/**/**/*.{less,css,scss,sass,style.ts,style.js} ${m.parent.args.slice(2).join(" ")} --cache --cache-location "${s}/.stylelintcache" --aei`,"stylelint")});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"path";import{renameSync as e}from"fs";import{execSync as n}from"child_process";import{bundleIpa as i,createDir as p,ink as l,print as t}from"@moneko/utils";export function bundleApk(i,a,u="-release"){t(l("正在编译 apk...","yellow"),!0),console.time("bundle apk "+u),n(`flutter build apk -${u}`),console.timeEnd("bundle apk "+u),p(a),e(o.join(i,`build/app/outputs/flutter-apk/app${u}.apk`),a),t("✨ "+l("Apk 编译","cyan")+": "+l("完成","cyan"),!0)}export function bundleIOS(a,u,r="-release"){t(l("正在编译 ipa...","yellow"),!0),console.time("bundle ipa "+r);let d=o.join(u,"Runner/Payload");n(`flutter build ios -${r} --no-codesign`),p(d),e(o.join(a,"build/ios/iphoneos/Runner.app"),d),i(o.join(u,"Runner"),u,r),console.timeEnd("bundle ipa "+r),t("✨ "+l("ipa 编译","cyan")+": "+l("完成","cyan"),!0)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as e,dirname as o}from"path";import{__dirname as c}from"../file.js";import t from"./require.js";let n=o(process.execPath);"win32"===process.platform&&n.includes(" ")&&(n=`"${n}"`);export const runtimePath=e(n,"undefined"!=typeof Deno?"deno":"undefined"!=typeof Bun?"bun":"node");export const cliVersion=t(e(c,"../package.json")).version;export const corePackageName="@moneko/core";export const cwd=process.cwd();export const cachePath=e(cwd,"node_modules/.cache");export const swcCachePath=e(cachePath,".swc");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"module";let e=t(import.meta.url);export default e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadFile as e}from"@moneko/utils";async function t(t,r,n){let i=[".env",".env/.env",`.env/.${"production"===t?"prod":"dev"}.env`],o={NODE_ENV:t,APPTYPE:r,FRAMEWORK:n};return(await Promise.all(i.map(e))).forEach(e=>{e&&Object.assign(o,e.split("\n").reduce((e,t)=>{if(!t||t.trim().startsWith("#"))return e;let[r,...n]=t.split("=");if(!r)return e;let i=n.join("=").trim();return e[r.trim()]=i.replace(/^["']|["']$/g,""),e},{}))}),Object.keys(o).forEach(e=>{let t=o[e];process.env[e]!==t&&(process.env[e]=o[e])}),o}export default t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{join as e}from"path";import{__dirname as o}from"../file.js";import r from"./require.js";import{updateFileSync as s}from"@moneko/utils";let m=e(o,".swcrc");export default function(e){let o="solid"===e;return s(m,JSON.stringify({$schema:"https://json.schemastore.org/swcrc",module:{type:"es6"},minify:!0,jsc:{minify:{mangle:!0,compress:!0,format:{comments:"some"}},parser:{syntax:"typescript",decorators:!0,dynamicImport:!0,tsx:!0},loose:!0,target:"es2022",externalHelpers:!1,transform:{legacyDecorator:!0,decoratorMetadata:!0,react:{runtime:"automatic",throwIfNamespace:!0,useBuiltins:!0,refresh:"react"===e,development:!1,importSource:o?"solid-js/h":void 0}},experimental:{plugins:[[r.resolve("@moneko/transform-imports"),{"@moneko/common":{transform:"@moneko/common/lib/${member}"},lodash:{transform:"lodash/${member}"},"@ant-design/icons":{transform:"es/icons/${member}"},antd:{transform:"es/${member}",memberTransformers:["dashed_case"]},"neko-ui":{transform:"es/${member}",memberTransformers:["dashed_case"]}}],o&&[r.resolve("@moneko/jsx-dom-expressions"),{moduleName:"solid-js/web",builtIns:["For","Show","Switch","Match","Suspense","SuspenseList","Portal","Index","Dynamic","ErrorBoundary"],contextToCustomElements:!0,wrapConditionals:!0,generate:"dom",hydratable:!1}]].filter(Boolean)}},sourceMaps:!0,exclude:["__tests__/","examples/"]})),m}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{program as o}from"commander";import{cliVersion as r}from"./utils/config.js";o.version(r,"-v, --version");
|
package/lib/config.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{merge as e}from"webpack-merge";import o from"./options/jsx-dom-expressions.mjs";import t from"./options/split-chunk.mjs";import n from"./paths.mjs";import{APPTYPE as s,FRAMEWORK as i,NODE_ENV as r,PACKAGENAME as l,isDev as a,isLibrary as m,isMobile as p,jsxImportSource as u,mainDirectory as c}from"./process-env.mjs";import{isFunction as d,resolveProgram as f}from"./utils/index.mjs";import h from"./utils/setup-env.mjs";import{fileExists as g}from"@moneko/utils";import x from"./utils/require.mjs";let v=["@app","@moneko","neko-ui",".cache/http/data","@ant-design","@antv","@antv/x6","@antv/x6-react-components","@element-plus","ant-design-vue","antd","antd-mini","antd-mobile","antd-mobile-icons","element-plus","element-ui","ng-zorro-antd","@antv","@mui","@du","ahooks","rc-queue-anim","umi","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design"];export function getConfig(e){return delete x.cache[e],new Promise(o=>{if(g(e)){let t=x(e).default;return o(d(t)?t(process):t)}return o({})})}let[P,w
|
|
1
|
+
import{merge as e}from"webpack-merge";import o from"./options/jsx-dom-expressions.mjs";import t from"./options/split-chunk.mjs";import n from"./paths.mjs";import{APPTYPE as s,FRAMEWORK as i,NODE_ENV as r,PACKAGENAME as l,isDev as a,isLibrary as m,isMobile as p,jsxImportSource as u,mainDirectory as c}from"./process-env.mjs";import{isFunction as d,resolveProgram as f}from"./utils/index.mjs";import h from"./utils/setup-env.mjs";import{fileExists as g}from"@moneko/utils";import x from"./utils/require.mjs";let v=["@app","@moneko","neko-ui",".cache/http/data","@ant-design","@antv","@antv/x6","@antv/x6-react-components","@element-plus","ant-design-vue","antd","antd-mini","antd-mobile","antd-mobile-icons","element-plus","element-ui","ng-zorro-antd","@antv","@mui","@du","ahooks","rc-queue-anim","umi","@fontsource","@fortawesome","font-pingfang-sc","font-pingfang-tc","katex","react-markdown-editor-lite","react-photo-view","schema-design"];export function getConfig(e){return delete x.cache[e],new Promise(o=>{if(g(e)){let t=x(e).default;return o(d(t)?t(process):t)}return o({})})}let[P,b,w]=await Promise.all([h(r,s,i),getConfig(n.configPath),getConfig(n.customConfigPath)]),C={devtool:a?"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,basename:"/",publicPath:"/",rem:{designSize:p?375:1920},fallbackCompPath:null,modifyVars:{},prefixCls:"n",alias:{"@":f(c)},moduleRules:[],prefixJsLoader:[],cssModules:[],cssModuleDefinition:!0,importOnDemand:{},proxy:{},devServer:{host:"localhost",port:3e3},htmlPluginOption:{},copy:{},routerMode:"browser",fixBrowserRouter:!1,plugins:[],resolvePlugins:[],overrideResolve:!1,splitChunk:t,runtimeChunk:"single",moduleFederation:[],rulesInclude:{css:v,js:v,media:v,font:v,wasm:[]},mdx:{jsx:!1,development:a,jsxImportSource:u,providerImportSource:`@moneko/${i}/mdx`},jsxDomExpressions:o,bar:{name:"Client",color:"#6f42c1"},normalizeCss:!0,externalsPresets:{},buildHttp:void 0,virtualModule:{},cssExtract:{},externals:["@swc/core"],lazyCompilation:!1,performance:!1,refresh:"solid"!==i,bundleId:"com.moneko.bid",bundles:[]};m&&(C.alias=Object.assign(C.alias,{"@pkg":n.componentsPath,[l]:n.componentsPath}));let j=C;(!1===(j=e(j,b,w)).devtool||!1===j.sourceMap)&&(j.sourceMap=!1,j.devtool=!1),j.fixBrowserRouter&&j.htmlPluginOption&&(j.htmlPluginOption.tags||(j.htmlPluginOption.tags=[]),j.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=j;export const PUBLICPATH=CONFIG.publicPath;
|
package/lib/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
let e;import t from"express";import o from"https";import s from"multer";import i from"webpack";import r from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as n}from"webpack-merge";import{commonConfig as a}from"./common.mjs";import{CONFIG as m,getConfig as c,PUBLICPATH as p}from"./config.mjs";import{PORT as d,devLog as u}from"./dev/config.mjs";import h from"./dev/mock.mjs";import f,{updateProxy as x}from"./dev/proxy.mjs";import
|
|
1
|
+
let e;import t from"express";import o from"https";import s from"multer";import i from"webpack";import r from"webpack-dev-middleware";import l from"webpack-hot-middleware";import{merge as n}from"webpack-merge";import{commonConfig as a}from"./common.mjs";import{CONFIG as m,getConfig as c,PUBLICPATH as p}from"./config.mjs";import{PORT as d,devLog as u}from"./dev/config.mjs";import h from"./dev/mock.mjs";import f,{updateProxy as x}from"./dev/proxy.mjs";import y from"./module.config.mjs";import w,{config_files as g}from"./paths.mjs";import{isLibrary as v,isReact as k,refresh as $}from"./process-env.mjs";import C from"./utils/has-pkg.mjs";import{empty as b,resolveProgram as j}from"./utils/index.mjs";import P from"./utils/sigint-exit.mjs";import S from"./options/reslove.mjs";import{watchFile as A}from"fs";import{join as T}from"path";import{spawn as E,exec as O}from"child_process";import{directoryExists as I,ink as M,loadFile as _,println as R,progressBar as q,print as z}from"@moneko/utils";import{diffObject as B}from"./utils/diff-object.mjs";let{HotModuleReplacementPlugin:D,ProgressPlugin:G,WatchIgnorePlugin:H}=i,U=!1!==m.stylelint&&C("stylelint-webpack-plugin")&&(await import("stylelint-webpack-plugin")).default,L=!1!==m.eslint&&C("eslint-webpack-plugin")&&(await import("eslint-webpack-plugin")).default,N=k&&(await import("@pmmmwh/react-refresh-webpack-plugin")).default,F=["js","jsx","ts","tsx","json","html","vue"],W=F.join(","),K=["css","scss","sass","less","ts","tsx","js","jsx"],X=K.join(","),J=["node_modules/","es/","lib/","umd/","docs/","coverage/","dist/"],Q=`${p.endsWith("/")?"":"/"}__hmr__`,V=new URLSearchParams({name:"client",path:Q,dynamicPublicPath:!0,timeout:2e3,reload:!$,quiet:!0,noInfo:!0,overlay:!0,autoConnect:!0}).toString(),Y=a.output.path,Z=m.bar.name||"Build",ee=n(a,{entry:{main:[`${S.hotMiddlewareClient}?${V}`]},output:{path:Y},module:y(!1),optimization:{minimize:!1,concatenateModules:!1,removeAvailableModules:!1,removeEmptyChunks:!0,providedExports:!0,usedExports:!1,sideEffects:!1,splitChunks:{chunks:"all",minChunks:1,minSize:30720,maxSize:0,maxAsyncRequests:60,maxInitialRequests:50,hidePathInfo:!1,cacheGroups:{vendors:{test:/[\\/]node_modules[\\/]/,priority:-10,reuseExistingChunk:!0},default:{minChunks:1,priority:-20,reuseExistingChunk:!0}}}},plugins:[new D,new H({paths:[/node_modules\/(?!(@app|@moneko)).+/,/\.d\.ts$/]}),N&&new N,L&&new L({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${W}}`,v&&`${m.alias["@pkg"]}/**/*.{${W}}`].filter(Boolean),extensions:F,exclude:J,cache:!0,cacheLocation:`${w.lintCachePath}/.eslintcache`,lintDirtyModulesOnly:!0,overrideConfigFile:j("eslint.config.mjs"),configType:"flat"}),U&&new U({fix:!0,threads:!0,files:[`${m.alias["@"]}/**/*.{${X}}`,v&&`${m.alias["@pkg"]}/**/*.{${X}}`].filter(Boolean),extensions:K,exclude:J,cache:!0,cacheLocation:`${w.lintCachePath}/.stylelintcache`,lintDirtyModulesOnly:!0}),!!m.bar&&new G({handler(e,t,...o){q(e||0,1,Z,o.length?`[${t}] ${o.join(" ")}`:""),1===e&&process.stdout.write("\r\x1b[2K")}})].filter(Boolean)}),et=i(ee);et.hooks.done.tap("client-log",e=>{u(null,e)});let eo=t(),es=s(),ei={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization","Access-Control-Allow-Methods":"GET, POST, OPTIONS, DELETE, PATCH, PUT",...m.devServer.headers},er=r(et,{writeToDisk:!1,index:"index.html",headers:e=>({...ei,"Access-Control-Allow-Origin":e.headers.origin||"*","Cache-Control":"no-store, no-cache, must-revalidate, proxy-revalidate",Pragma:"no-cache",Expires:"0"}),serverSideRender:!1,lastModified:!0,publicPath:ee.output?.publicPath,cacheControl:!1,cacheImmutable:!1}),el=l(et,{log:!1,path:Q,heartbeat:2e3});eo.use(t.static(T(w.programPath,"./public"))).use(er).use(Q,el),I(w.mockPath)&&eo.use(es.any(),h(w.mockPath)),m.proxy&&f(eo,m.proxy);let en=`${ee.output.path}/index.html`;if(eo.use((e,t,o)=>{if("GET"===e.method){let s=e.get("Accept");if(s?.includes("text/html")){let e=er.context.outputFileSystem,o=e?.readFileSync?.(en);t.headersSent||(t.setHeader("Content-Type","text/html"),t.send(o))}else if("text/event-stream"===s&&e.url.endsWith(Q))return e.url=Q,el(e,t,o);else return o()}else{if("OPTIONS"!==e.method)return o();t.sendStatus(200)}}),m.devServer.https){let[t,s]=await Promise.all([_(m.devServer.https.key),_(m.devServer.https.cert)]);t||(R(M(`无法加载私钥。请检查路径和文件是否存在,并确保路径正确:${m.devServer.https.key}`,"red")),process.exit(1)),s||(R(M(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${m.devServer.https.cert}`,"red")),process.exit(1)),e=o.createServer({key:t,cert:s},eo)}let ea=(e||eo).listen(d,"0.0.0.0",()=>{});function em(){process.exit(0)}let ec=await Promise.all(g.map(c)),ep=n(ec[0]||{},ec[1]||{});g.forEach(function(e){A(e,async function(){let[t,o]=await Promise.all(g.map(c)),s=n(t||{},o||{}),i=B(ep,s);1===Object.keys(i).length&&"proxy"in i?(z(M(`代理更新中...`,"yellow"),!0),x(eo,s.proxy),z(M(`代理更新完成...`,"green"),!0),m.proxy=s.proxy,ep.proxy=s.proxy,ep=s):(ep=s,R(M(`检测到工程配置${M(`[${e}]`,"blue")}变更, 程序即将重启...`,"yellow"),!0),O("win32"===process.platform?`netstat -ano | findstr :${d}`:`lsof -i :${d} -t`,(e,t)=>{if(e){R(M(`查找端口 ${d} 时发生错误: ${e.message}`,"red")),R(M("请尝试手动重启程序","yellow"));return}let o=t.trim().split("\n").filter(Boolean),s=ed?o[0]?.split(/\s+/).pop()?.trim():o[0]?.trim();if(!s){R(M(`未找到占用端口 ${d} 的进程, 请尝试手动重启程序`,"yellow"));return}try{process.kill(Number(s),"SIGHUP")}catch(e){R(M(`终止进程 ${s} 时发生错误: ${e.message}`,"red"))}}))})});let ed="win32"===process.platform;process.on("SIGHUP",function(){er.close(b),ea.close(b),ea.closeAllConnections(),function(){let e=E(process.argv[0],process.argv.slice(1),{detached:!1,stdio:"inherit"});e.unref(),e.on("close",em)}()}),process.on("exit",function(){er.close(b),ea.close(b),ea.closeAllConnections()}),P(em);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0-beta.0",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
"build": "rm -rf ./lib && tsc && swc src -d lib --strip-leading-paths -D && node convert",
|
|
10
10
|
"prepublishOnly": "npm run build"
|
|
11
11
|
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"mo": "./lib/bin/index.js"
|
|
14
|
+
},
|
|
12
15
|
"keywords": [],
|
|
13
16
|
"author": "moneko",
|
|
14
17
|
"license": "MIT",
|
|
@@ -21,6 +24,7 @@
|
|
|
21
24
|
"@typescript/vfs": "1.6.0",
|
|
22
25
|
"browserslist": "4.24.2",
|
|
23
26
|
"chokidar": "4.0.1",
|
|
27
|
+
"commander": "12.1.0",
|
|
24
28
|
"core-js": "3.39.0",
|
|
25
29
|
"core-js-compat": "3.39.0",
|
|
26
30
|
"css-loader": "7.1.2",
|
package/typings/global.d.ts
CHANGED
|
@@ -125,6 +125,9 @@ interface CacheConfig extends FileCacheOptions, MemoryCacheOptions {
|
|
|
125
125
|
type?: 'filesystem' | 'memory';
|
|
126
126
|
}
|
|
127
127
|
export declare type ConfigType = {
|
|
128
|
+
/** 软件包名称 */
|
|
129
|
+
bundleId?: string;
|
|
130
|
+
bundles?: ('apk -release' | 'apk -debug' | 'ios -release' | 'ios -debug')[];
|
|
128
131
|
/**
|
|
129
132
|
* @default true
|
|
130
133
|
*/
|