@moneko/core 3.54.0-beta.2 → 3.54.0-beta.3

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.
Files changed (195) hide show
  1. package/lib/bin/commit-lint.d.mts +1 -42
  2. package/lib/bin/commit-lint.mjs +1 -1
  3. package/lib/bin/file.d.mts +0 -2
  4. package/lib/bin/index.d.mts +1 -5
  5. package/lib/bin/pin.d.mts +4 -38
  6. package/lib/bin/pure-lint.d.mts +1 -31
  7. package/lib/bin/pure-lint.mjs +1 -1
  8. package/lib/bin/setup.d.mts +0 -3
  9. package/lib/bin/utils/convert-solid.d.mts +3 -6
  10. package/lib/bin/utils/convert-solid.mjs +1 -1
  11. package/lib/bin/utils/setup-swcrc.d.mts +1 -3
  12. package/lib/build/common.d.mts +1 -10
  13. package/lib/build/server.d.mts +0 -5
  14. package/lib/build.d.mts +1 -16
  15. package/lib/commom/ca.d.mts +7 -17
  16. package/lib/commom/ca.mjs +1 -1
  17. package/lib/commom/esm.d.mts +1 -1
  18. package/lib/commom/has-pkg.d.mts +0 -1
  19. package/lib/commom/is-ci-environment.d.mts +4 -2
  20. package/lib/commom/log.d.mts +1 -6
  21. package/lib/commom/match-path.d.mts +16 -1
  22. package/lib/commom/parse-module-meta.d.mts +0 -2
  23. package/lib/commom/print-log.d.mts +0 -1
  24. package/lib/commom/require.d.mts +0 -6
  25. package/lib/commom/timer.d.mts +3 -4
  26. package/lib/common.d.mts +1 -14
  27. package/lib/config.d.mts +0 -24
  28. package/lib/dev/generate-progress-html.d.mts +1 -1
  29. package/lib/dev/json-schema.d.mts +3 -3
  30. package/lib/dev/proxy.d.mts +3 -7
  31. package/lib/dev.d.mts +1 -48
  32. package/lib/dev.mjs +2 -2
  33. package/lib/file-system.d.mts +1 -1
  34. package/lib/loader/lightning-css/runtime/api.d.cts +5 -3
  35. package/lib/loader/lightning-css/runtime/get-url.cjs +1 -1
  36. package/lib/loader/lightning-css/runtime/get-url.d.cts +1 -9
  37. package/lib/module.config.d.mts +3 -49
  38. package/lib/module.config.mjs +1 -1
  39. package/lib/options/css-extract.d.mts +0 -5
  40. package/lib/options/modify-vars.d.mts +0 -9
  41. package/lib/options/split-chunk.d.mts +0 -2
  42. package/lib/plugin/eslint.d.mts +6 -14
  43. package/lib/plugin/module-federation.d.mts +1 -19
  44. package/lib/plugin/stylelint.d.mts +6 -14
  45. package/lib/plugins.config.d.mts +1 -10
  46. package/lib/polyfills/replace-children.d.mts +1 -1
  47. package/lib/process-env.d.mts +4 -8
  48. package/lib/utils/compile-dts.d.mts +16 -3
  49. package/lib/utils/create-types.d.mts +0 -13
  50. package/lib/utils/create-types.mjs +1 -1
  51. package/lib/utils/dts.d.mts +12 -5
  52. package/lib/utils/svg-to-data-uri.d.mts +1 -58
  53. package/lib/utils/vts.d.mts +14 -6
  54. package/lib/vm/docs.d.mts +0 -11
  55. package/lib/vm/docs.mjs +1 -1
  56. package/lib/vm/info.d.mts +0 -3
  57. package/lib/vm/locales.d.mts +0 -24
  58. package/lib/vm/modules.d.mts +0 -25
  59. package/lib/vm/render-app.d.mts +0 -9
  60. package/lib/worker/dts.d.mts +1 -2
  61. package/lib/worker/eslint.d.mts +0 -6
  62. package/lib/worker/eslint.mjs +1 -1
  63. package/lib/worker/react-compiler.d.mts +23 -8
  64. package/lib/worker/react-compiler.mjs +1 -1
  65. package/lib/worker/stylelint.d.mts +0 -4
  66. package/lib/worker/swc-minify.d.mts +1 -2
  67. package/package.json +3 -3
  68. package/lib/bin/build-app.d.mts +0 -11
  69. package/lib/bin/build-app.mjs +0 -1
  70. package/lib/bin/build.d.mts +0 -13
  71. package/lib/bin/build.mjs +0 -1
  72. package/lib/bin/changelog.d.mts +0 -12
  73. package/lib/bin/changelog.mjs +0 -4
  74. package/lib/bin/eslint.d.mts +0 -6
  75. package/lib/bin/eslint.mjs +0 -2
  76. package/lib/bin/git-hooks.d.mts +0 -5
  77. package/lib/bin/git-hooks.mjs +0 -2
  78. package/lib/bin/help.d.mts +0 -85
  79. package/lib/bin/help.mjs +0 -13
  80. package/lib/bin/lessc.d.mts +0 -10
  81. package/lib/bin/lessc.mjs +0 -1
  82. package/lib/bin/server.d.mts +0 -14
  83. package/lib/bin/server.mjs +0 -1
  84. package/lib/bin/start.d.mts +0 -5
  85. package/lib/bin/start.mjs +0 -1
  86. package/lib/bin/stylelint.d.mts +0 -7
  87. package/lib/bin/stylelint.mjs +0 -2
  88. package/lib/bin/tsc.d.mts +0 -6
  89. package/lib/bin/tsc.mjs +0 -1
  90. package/lib/bin/utils/bundle-app.d.mts +0 -7
  91. package/lib/bin/utils/bundle-app.mjs +0 -1
  92. package/lib/bin/utils/config.d.mts +0 -13
  93. package/lib/bin/utils/config.mjs +0 -1
  94. package/lib/bin/utils/get-commit-files.d.mts +0 -3
  95. package/lib/bin/utils/get-commit-files.mjs +0 -1
  96. package/lib/commom/check-npm.d.mts +0 -4
  97. package/lib/commom/check-npm.mjs +0 -1
  98. package/lib/commom/corepack.d.mts +0 -12
  99. package/lib/commom/corepack.mjs +0 -1
  100. package/lib/commom/diff-object.d.mts +0 -2
  101. package/lib/commom/diff-object.mjs +0 -1
  102. package/lib/commom/host.d.mts +0 -3
  103. package/lib/commom/host.mjs +0 -19
  104. package/lib/commom/module-resolve.d.mts +0 -3
  105. package/lib/commom/module-resolve.mjs +0 -1
  106. package/lib/commom/net.d.mts +0 -4
  107. package/lib/commom/net.mjs +0 -1
  108. package/lib/commom/open.d.mts +0 -5
  109. package/lib/commom/open.mjs +0 -1
  110. package/lib/commom/paths.d.mts +0 -36
  111. package/lib/commom/paths.mjs +0 -1
  112. package/lib/commom/reactive-object.d.mts +0 -10
  113. package/lib/commom/reactive-object.mjs +0 -1
  114. package/lib/commom/rule.d.mts +0 -20
  115. package/lib/commom/rule.mjs +0 -1
  116. package/lib/commom/setup-env.d.mts +0 -4
  117. package/lib/commom/setup-env.mjs +0 -1
  118. package/lib/commom/sigint-exit.d.mts +0 -3
  119. package/lib/commom/sigint-exit.mjs +0 -1
  120. package/lib/commom/transform-solid-js.d.mts +0 -41
  121. package/lib/commom/transform-solid-js.mjs +0 -1
  122. package/lib/dev/config.d.mts +0 -14
  123. package/lib/dev/config.mjs +0 -2
  124. package/lib/dev/get-cert.d.mts +0 -10
  125. package/lib/dev/get-cert.mjs +0 -1
  126. package/lib/dev/mock.d.mts +0 -61
  127. package/lib/dev/mock.mjs +0 -1
  128. package/lib/dev/server.d.mts +0 -34
  129. package/lib/dev/server.mjs +0 -1
  130. package/lib/loader/css-in-js-minify.cjs +0 -1
  131. package/lib/loader/css-in-js-minify.d.cts +0 -22
  132. package/lib/loader/lightning-css/codegen.cjs +0 -20
  133. package/lib/loader/lightning-css/codegen.d.cts +0 -36
  134. package/lib/loader/lightning-css/loader.cjs +0 -1
  135. package/lib/loader/lightning-css/loader.d.cts +0 -49
  136. package/lib/loader/lightning-css/utils.cjs +0 -1
  137. package/lib/loader/lightning-css/utils.d.cts +0 -26
  138. package/lib/loader/mdx.cjs +0 -1
  139. package/lib/loader/mdx.d.cts +0 -4
  140. package/lib/loader/react-compiler.cjs +0 -1
  141. package/lib/loader/react-compiler.d.cts +0 -21
  142. package/lib/loader/solid.cjs +0 -1
  143. package/lib/loader/solid.d.cts +0 -9
  144. package/lib/loader/ts-doc.cjs +0 -1
  145. package/lib/loader/ts-doc.d.cts +0 -11
  146. package/lib/options/md-to-html.d.mts +0 -5
  147. package/lib/options/md-to-html.mjs +0 -1
  148. package/lib/options/reslove.d.mts +0 -11
  149. package/lib/options/reslove.mjs +0 -1
  150. package/lib/options/swcrc.d.mts +0 -21
  151. package/lib/options/swcrc.mjs +0 -1
  152. package/lib/plugin/compression.d.mts +0 -17
  153. package/lib/plugin/compression.mjs +0 -1
  154. package/lib/plugin/copy.d.mts +0 -21
  155. package/lib/plugin/copy.mjs +0 -1
  156. package/lib/plugin/done.d.mts +0 -11
  157. package/lib/plugin/done.mjs +0 -1
  158. package/lib/plugin/exposes-declararion.d.mts +0 -20
  159. package/lib/plugin/exposes-declararion.mjs +0 -1
  160. package/lib/plugin/external-remotes.d.mts +0 -8
  161. package/lib/plugin/external-remotes.mjs +0 -1
  162. package/lib/plugin/html-plugin.d.mts +0 -48
  163. package/lib/plugin/html-plugin.mjs +0 -1
  164. package/lib/plugin/lightningcss-plugin.d.mts +0 -31
  165. package/lib/plugin/lightningcss-plugin.mjs +0 -1
  166. package/lib/plugin/manifest.d.mts +0 -43
  167. package/lib/plugin/manifest.mjs +0 -1
  168. package/lib/plugin/override-resolve.d.mts +0 -14
  169. package/lib/plugin/override-resolve.mjs +0 -1
  170. package/lib/plugin/swc-minify-plugin.d.mts +0 -13
  171. package/lib/plugin/swc-minify-plugin.mjs +0 -1
  172. package/lib/plugin/virtual-module.d.mts +0 -24
  173. package/lib/plugin/virtual-module.mjs +0 -1
  174. package/lib/polyfills/polyfills.d.mts +0 -7
  175. package/lib/polyfills/polyfills.mjs +0 -1
  176. package/lib/polyfills/targets.d.mts +0 -8
  177. package/lib/polyfills/targets.mjs +0 -1
  178. package/lib/utils/fetch-module-federation-dts.d.mts +0 -6
  179. package/lib/utils/fetch-module-federation-dts.mjs +0 -1
  180. package/lib/utils/index.d.mts +0 -12
  181. package/lib/utils/index.mjs +0 -1
  182. package/lib/utils/run.d.mts +0 -3
  183. package/lib/utils/run.mjs +0 -1
  184. package/lib/utils/seo.d.mts +0 -10
  185. package/lib/utils/seo.mjs +0 -4
  186. package/lib/vm/coverage.d.mts +0 -39
  187. package/lib/vm/coverage.mjs +0 -1
  188. package/lib/vm/example.d.mts +0 -12
  189. package/lib/vm/example.mjs +0 -1
  190. package/lib/vm/generate-doc.d.mts +0 -35
  191. package/lib/vm/generate-doc.mjs +0 -1
  192. package/lib/vm/routes.d.mts +0 -17
  193. package/lib/vm/routes.mjs +0 -1
  194. package/lib/vm/utils.d.mts +0 -5
  195. package/lib/vm/utils.mjs +0 -1
@@ -1,11 +0,0 @@
1
- import { execSync } from 'node:child_process';
2
- import { existsSync, readdirSync, statSync } from 'node:fs';
3
- import path from 'node:path';
4
- import { argv, env, exit } from 'node:process';
5
- import { buildPlist, buildXml, createDir, ink, jsonToYaml, loadFileSync, parsePlist, parseXml, parseYaml, print, println, removeDir, saveFile, saveFileSync } from '@moneko/utils';
6
- import { bundleApk, bundleIOS } from './utils/bundle-app.mjs';
7
- import { cwd } from './utils/config.mjs';
8
- import { __dirname } from './file.mjs';
9
- export declare function copyFileSync(source: string, target: string);
10
- export declare function copyFolderRecursiveSync(source: string, target: string, sun?: boolean);
11
- export default async function createApp();
@@ -1 +0,0 @@
1
- import{execSync as e}from"node:child_process";import{existsSync as i,readdirSync as n,statSync as o}from"node:fs";import r from"node:path";import{argv as s,env as t,exit as l}from"node:process";import{buildPlist as a,buildXml as d,createDir as c,ink as p,jsonToYaml as m,loadFileSync as u,parsePlist as f,parseXml as y,parseYaml as S,print as $,println as b,removeDir as j,saveFile as _,saveFileSync as g}from"@moneko/utils";import{bundleApk as w,bundleIOS as k}from"./utils/bundle-app.mjs";import{cwd as O}from"./utils/config.mjs";import{__dirname as A}from"./file.mjs";export function copyFileSync(e,i){let n=u(e);if(null!==n){let s=i;o(i).isDirectory()&&(s=r.join(i,r.basename(e))),g(s,n)}}export function copyFolderRecursiveSync(e,i,s){let t=i;s&&(t=r.join(i,r.basename(e))),o(e).isDirectory()&&n(e).forEach(function(i){let n=r.join(e,i);o(n).isDirectory()?copyFolderRecursiveSync(n,t,!0):copyFileSync(n,t)})}export default async function N(){s.slice(3).forEach(e=>{let[i,n]=e.replace(/^--/,"").split("=");t[`__args__${i}__`]=n});let{CONFIG:g}=await import("../config.mjs"),N=g.bundleId;N||(b(p("请配置 bundleId","red")),l(1)),/(^com\.)([a-zA-Z_][a-zA-Z0-9_]*[.])*([a-zA-Z_][a-zA-Z0-9_]*)$/.test(N)&&3===N.split(".").length||(b(p("软件包名不合法","red")),l(1));let h=g.bundles;h&&0!==h.length||(b(p("请配置 bundles (打包类型)","red")),l(1));let E=N.split(".").splice(-1,1).join(""),R=r.join(O,"/dist"),T=`flutter create -t app --org ${N} -i swift -a kotlin ${E}`,V=r.join(O,`/${E}`),v=r.join(V,"assets/web/");e(T,{encoding:"utf-8"}),c(v),$(p("正在注册资产...","yellow"),!0),copyFolderRecursiveSync(R,v);let x=r.join(V,"pubspec.yaml"),I=JSON.parse(await S(x)||"{}"),J=[],D=(e,i="assets/web")=>{let r=n(e);!function n(s){s!=r.length&&(o(`${e}/${r[s]}`).isDirectory()&&(J.push(`${i}/${r[s]}/`),D(`${e}/${r[s]}`,`${i}/${r[s]}`)),n(s+1))}(0)};if(D(R),I.dependencies.webview_flutter_plus="^0.2.3",I.flutter.assets=["assets/web/",...J],_(x,await m(JSON.stringify(I))),$(`${p("注册资产","cyan")}: ${p("完成","cyan")}`,!0),h.includes("apk -release")||h.includes("apk -debug")){$(p("正在配置安卓权限...","yellow"),!0);let e=r.join(V,"android/app/src/main/AndroidManifest.xml"),i=JSON.parse(y(e));i.manifest.application.$["android:usesCleartextTraffic"]="true",i.manifest["uses-permission"]=[{$:{"android:name":"android.permission.INTERNET"}},{$:{"android:name":"android.permission.ACCESS_NETWORK_STATE"}},{$:{"android:name":"android.permission.WAKE_LOCK"}}],_(e,d(JSON.stringify(i)));let n=r.join(V,"android/app/build.gradle"),o=u(n)||"",s="minSdkVersion flutter.minSdkVersion";if(o?.includes(s))o=o.replace(s,"minSdkVersion 20");else{let e=o.indexOf("minSdkVersion "),i=o.substring(e,e+16);o=o.replace(i,"minSdkVersion 20")}let t="compileSdkVersion flutter.compileSdkVersion";o.includes(t)&&(o=o.replace(t,"compileSdkVersion 32")),_(n,o),$(`${p("安卓权限配置","cyan")}: ${p("完成","cyan")}`,!0)}if(h.includes("ios -release")||h.includes("ios -debug")){$(p("开始配置IOS权限","yellow"),!0);let e=r.join(V,"ios/Runner/Info.plist"),i=Object.assign(JSON.parse(await f(e)),{NSAppTransportSecurity:{NSAllowsArbitraryLoads:!0},"io.flutter.embedded_views_preview":!0});_(e,await a(JSON.stringify(i))),$(`${p("IOS权限配置","cyan")}: ${p("完成","cyan")}`,!0)}_(r.join(V,"lib/main.dart"),u(r.join(A,"./conf/bootstrap"))||"");let F=r.join(O,"./bundle/");c(F),setTimeout(()=>{h.forEach(e=>{let i=e.split(" ");"apk"===i[0]&&w(V,F,i[1]),"ios"===i[0]&&k(V,F,i[1])}),j(V),i(r.join(F,"Runner"))&&j(r.join(F,"Runner")),$(`✨ ${p("Done","green")}`,!0),l(0)},1e3)}
@@ -1,13 +0,0 @@
1
- import { join } from 'node:path';
2
- import { argv, exit } from 'node:process';
3
- import { convert } from '@moneko/convert';
4
- import { ink, println, removeDir } from '@moneko/utils';
5
- import setupEnv from '../commom/setup-env.mjs';
6
- import { TransformSolidJsOption } from '../commom/transform-solid-js.mjs';
7
- import { cwd, swcCachePath } from './utils/config.mjs';
8
- import { convertSolid } from './utils/convert-solid.mjs';
9
- import { getSwcOption } from './utils/setup-swcrc.mjs';
10
- import { lesscCommonjs } from './lessc.mjs';
11
- import tsc from './tsc.mjs';
12
- declare async function build();
13
- export default build;
package/lib/bin/build.mjs DELETED
@@ -1 +0,0 @@
1
- import{join as o}from"node:path";import{argv as t,exit as e}from"node:process";import{convert as s}from"@moneko/convert";import{ink as i,println as r,removeDir as m}from"@moneko/utils";import n from"../commom/setup-env.mjs";import{cwd as p,swcCachePath as l}from"./utils/config.mjs";import{convertSolid as c}from"./utils/convert-solid.mjs";import{getSwcOption as d}from"./utils/setup-swcrc.mjs";import{lesscCommonjs as j}from"./lessc.mjs";import a from"./tsc.mjs";async function u(){let u=t[3],f=t[4],x=t.slice(5);u||(r(i(`type: 无效值 ${i(u,"245")}`,"red")),e(1));let y=!x.includes("no-docs"),_=!x.includes("no-lib"),g=!x.includes("no-es"),D=!x.includes("no-dts"),$=x.filter(o=>!["no-docs","no-es","no-lib"].includes(o));if(await n("production",u,f,$),"library"===u){let{CONFIG:t}=await import("../config.mjs"),e="swc"===t.dts,i=[_&&{type:"commonjs",dir:"lib",msg:"Convert to CommonJS"},g&&{type:"es6",dir:"es",msg:"Convert to ES Module"}].filter(Boolean);for(let r=0,n=i.length;r<n;r++){if(m(o(p,`./${i[r].dir}`)),"react"===f){let o=d();"es6"===i[r].type&&(o.jsc.target="es2015"),o.jsc.experimental.emitIsolatedDts=D&&e,o.jsc.experimental.cacheRoot=l,o.module.type=i[r].type,s({outDir:i[r].dir,inputDir:"components",ignore:[/^.*\/__*__\//,/\.test\.(js|ts)x?$/,/\.DS_Store/,/\.mdx?$/,/^.*\/examples\//,/\.d\.(cj|mj|j|t|ct|mt)sx?$/],options:o})}else if("solid"===f){let o={jsxOptions:t.jsxDomExpressions,presetEnvOption:{modules:"commonjs"}};"es6"===i[r].type&&(o.presetEnvOption.modules=!1),c({outDir:i[r].dir,inputDir:"components",ignore:[/^.*\/__*__\//,/\.test\.(js|ts)x?$/,/\.DS_Store/,/\.mdx?$/,/^.*\/examples\//,/\.d\.(cj|mj|j|t|ct|mt)sx?$/],options:o})}"commonjs"===i[r].type&&j(),D&&!e&&a(i[r].dir)}}if("library"!==u||y&&"library"===u)try{await import("../build.mjs")}catch(o){r(i(Error(o).message,"red")),e(1)}}export default u;
@@ -1,12 +0,0 @@
1
- import { execSync } from 'node:child_process';
2
- import { join } from 'node:path';
3
- import { argv } from 'node:process';
4
- import { updateFileSync } from '@moneko/utils';
5
- import log from '../commom/log.mjs';
6
- import { cwd } from './utils/config.mjs';
7
- declare function getRemoteUrl();
8
- declare const types: Record<string, string>;
9
- declare function extractCommits(text: string);
10
- declare function getCommitsBetweenTags(tag1?: string, tag2?: string);
11
- declare function getTags(remoteUrl: string);
12
- export default function changelog();
@@ -1,4 +0,0 @@
1
- import{execSync as t}from"node:child_process";import{join as e}from"node:path";import{argv as o}from"node:process";import{updateFileSync as r}from"@moneko/utils";import s from"../commom/log.mjs";import{cwd as i}from"./utils/config.mjs";let n={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 l(e,o){return function(t){let e=[];for(let o of t.trim().split("\n")){let[t,r,s,i,l]=o.split("|");if(l){let o=l.split(": "),a=n[o[0]];e.push({commitId:t,author:r,email:s,date:new Date(i).toLocaleString().replace(/\//g,"-"),message:a?o.slice(1).join(":"):l,type:a})}}return e}(t(`git log ${e?`${e}..`:""}${o||""} --format="%H|%an|%ae|%ad|%s"`,{encoding:"utf-8"}))}export default function a(){let n=o[3],a=["# Change log"];try{let e=t('git config --get remote.origin.url | sed "s/\\.git$//"').toString().trim().replace(/^git@([^:]+):(.+)$/,"https://$1/$2"),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,l]=t.split(" "),a=s[o-1]?.split(" ")[1],c=`## ${n}`;a&&(c=`## [${n}](${e}/compare/${a}...${n}) (${new Date(l).toLocaleDateString().replace(/\//g,"-")})`),r.push({commitId:i,tag:n,date:l,title:c,logs:{}})}),r}(e);o.forEach((t,r)=>{if(r&&l(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=l(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 a.push(`
2
- ${t.title}`),t.logs)Object.prototype.hasOwnProperty.call(t.logs,e)&&(a.push(`
3
- ### ${e}
4
- `),t.logs[e].forEach(t=>a.push(t)))})}catch(t){a.push("\n当前分支尚无任何提交\n"),s(t)}r(e(i,n),a.join("\n"))}
@@ -1,6 +0,0 @@
1
- import { relative } from 'node:path';
2
- import { argv, exit, stdout } from 'node:process';
3
- import { ESLint } from '@moneko/eslint';
4
- import { ink, print } from '@moneko/utils';
5
- import { cachePath, cwd, parseBraced } from './utils/config.mjs';
6
- export default async function eslint();
@@ -1,2 +0,0 @@
1
- import{relative as e}from"node:path";import{argv as o,exit as t,stdout as i}from"node:process";import{ESLint as r}from"@moneko/eslint";import{ink as a,print as l}from"@moneko/utils";import{cachePath as n,cwd as s,parseBraced as c}from"./utils/config.mjs";export default async function m(){let m=a("eslint","cyan");l(`${m}: ${a("Runing...","yellow")}`,!0);let f=o[3],u=o.slice(4),p=u.includes("--fix"),d=new r({cache:!u.includes("--cache=false"),cacheLocation:`${n}/.eslintcache`,fix:p}),w=c(f).map(o=>e(s,o)),h=await d.lintFiles(w),$=await d.loadFormatter("stylish"),y=await $.format(h);p&&await r.outputFixes(h),y&&i.write(y);let x=h.some(e=>e.errorCount>0);l(`${m}: ${a(`✨ ${x?"Error":"Successfully"}!
2
- `,x?"red":"green")}`,!0),x&&t(1)}
@@ -1,5 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { argv, exit } from 'node:process';
3
- import { ink, print } from '@moneko/utils';
4
- import husky from 'husky';
5
- export default function githooks();
@@ -1,2 +0,0 @@
1
- import{spawn as o}from"node:child_process";import{argv as e,exit as l}from"node:process";import{ink as n,print as i}from"@moneko/utils";import t from"husky";export default function s(){let s=n("Git init","cyan"),r=o=>n(`✨ ${o?"Error":"Successfully"}!
2
- `,o?"red":"green");i(`${s}: ${n("Runing...","yellow")}`,!0),o("git init && git config core.ignorecase false",{stdio:[null],shell:!0}).on("close",function(c){i(`${s}: ${r(0!==c)}`,!0);let u=n("Git hooks","cyan");i(`${u}: ${n("Runing...","yellow")}`,!0);let $="node_modules/.husky";t($);let f=e.slice(3).map(o=>{let e=o.split("=");return`echo ${e[1]} > ${$}/${e[0]}`}).join(" && ");o(`${f}`,{stdio:[null],shell:!0}).on("close",function(o){i(`${u}: ${r(0!==o)}`,!0),l(o)})})}
@@ -1,85 +0,0 @@
1
- import { ink, println } from '@moneko/utils';
2
- declare const commands: readonly [{
3
- readonly name: string;
4
- readonly description: string;
5
- readonly args: string;
6
- readonly arguments: readonly [{
7
- readonly name: string;
8
- readonly description: string;
9
- }, {
10
- readonly name: string;
11
- readonly description: string;
12
- }];
13
- }, {
14
- readonly name: string;
15
- readonly description: string;
16
- readonly args: string;
17
- readonly arguments: readonly [{
18
- readonly name: string;
19
- readonly description: string;
20
- }, {
21
- readonly name: string;
22
- readonly description: string;
23
- }];
24
- }, {
25
- readonly name: string;
26
- readonly description: string;
27
- readonly args: string;
28
- readonly arguments: readonly [{
29
- readonly name: string;
30
- readonly description: string;
31
- }];
32
- }, {
33
- readonly name: string;
34
- readonly description: string;
35
- readonly args: string;
36
- readonly arguments: readonly [{
37
- readonly name: string;
38
- readonly description: string;
39
- }];
40
- }, {
41
- readonly name: string;
42
- readonly description: string;
43
- readonly args: string;
44
- readonly arguments: readonly [{
45
- readonly name: string;
46
- readonly description: string;
47
- }];
48
- }, {
49
- readonly name: string;
50
- readonly description: string;
51
- readonly args: string;
52
- readonly arguments: readonly [{
53
- readonly name: string;
54
- readonly description: string;
55
- }, {
56
- readonly name: string;
57
- readonly description: string;
58
- }, {
59
- readonly name: string;
60
- readonly description: string;
61
- }, {
62
- readonly name: string;
63
- readonly description: string;
64
- }];
65
- }, {
66
- readonly name: string;
67
- readonly description: string;
68
- }, {
69
- readonly name: string;
70
- readonly description: string;
71
- readonly args: string;
72
- readonly arguments: readonly [{
73
- readonly name: string;
74
- readonly description: string;
75
- }];
76
- }, {
77
- readonly name: string;
78
- readonly description: string;
79
- }, {
80
- readonly name: string;
81
- readonly description: string;
82
- }];
83
- declare const examples: readonly [readonly [string, string, string, string], readonly [string, string, string, string], readonly [string, string, string, string], readonly [string, string, string, string], readonly [string, string, string, string], readonly [string, string, string, string], readonly [string, string, string, string], readonly [string, string, string, string], readonly [string, string, string, string], readonly [string, string, string, string]];
84
- declare function printHelp();
85
- export default printHelp;
package/lib/bin/help.mjs DELETED
@@ -1,13 +0,0 @@
1
- import{ink as e,println as t}from"@moneko/utils";let n=[{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:"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"}],r=[["mo","start","library react","# 启动开发服务器"],["mo","build","library react","# 构建生产版本"],["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 i=n.reduce((e,t)=>Math.max(e,t.name.length),0)+4,o=n.reduce((e,t)=>Math.max(e,t.args?.length||0),0)+4,a=n.map(t=>[" ",e(t.name.padEnd(i),"green"),e(`${t.args||""}`.padEnd(o),"208"),t.description,...(t.arguments||[]).map(t=>`
2
- ${" ".repeat(2+i+o)}${e(`${t.name}: `,"245",{bold:!0})}${e(t.description,"245",{italic:!0})}`),"\n"].join("")).join("\n"),m=r.reduce((e,t)=>Math.max(e,t[0].length+t[1].length+t[2].length),0),s=r.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
- 使用方法: ${e("mo","blue")} ${e("<命令>","green")} ${e("<必选参数>","208")} ${e("[可选参数]","yellow")}
4
-
5
- 命令列表:
6
- ${a}
7
- ${e("选项:","white")}
8
- ${e("-v, --version","yellow")} 显示版本信息
9
- ${e("-h, --help","yellow")} 显示帮助信息
10
-
11
- 示例:
12
- ${s}
13
- `)}
@@ -1,10 +0,0 @@
1
- import { exec } from 'node:child_process';
2
- import { join } from 'node:path';
3
- import { loadFile, saveFile, scanFolderSync } from '@moneko/utils';
4
- import require from '../commom/require.mjs';
5
- import { runtimePath } from './utils/config.mjs';
6
- declare let modifyVarBash: string;
7
- declare function lessc(file: string);
8
- declare const lessRegExp: RegExp;
9
- declare async function lesscFile(filepath: string);
10
- export declare async function lesscCommonjs();
package/lib/bin/lessc.mjs DELETED
@@ -1 +0,0 @@
1
- import{exec as e}from"node:child_process";import{join as o}from"node:path";import{loadFile as s,saveFile as t,scanFolderSync as r}from"@moneko/utils";import i from"../commom/require.mjs";import{runtimePath as l}from"./utils/config.mjs";let m="";function n(s){let t=o(i.resolve("less"),"../bin/lessc");return new Promise((o,r)=>{e(`${l} ${t} --js ${m} ${s} > ${s.replace(/\.less$/g,".css")}`,function(e){if(e)return r(e);o(!0)})})}let a=/\*?\.less/g;async function c(e){let o=await s(e);o&&a.test(o)&&await t(e,o.replace(a,".css"))}export async function lesscCommonjs(){let e=r("lib",["\\.less$"]),o=(await import("../options/modify-vars.mjs")).default;for(let e in o)Object.hasOwnProperty.call(o,e)&&(m+=`--modify-var="${e}=${o[e]}" `);Promise.all(e.map(n)),e.length&&Promise.all(r("lib",["\\.js$"]).map(c))}
@@ -1,14 +0,0 @@
1
- import fs from 'node:fs';
2
- import { ink, println } from '@moneko/utils';
3
- import parseArgs from '../commom/parse-args.mjs';
4
- import printLog from '../commom/print-log.mjs';
5
- import { CONFIG } from '../config.mjs';
6
- import server from '../dev/server.mjs';
7
- interface ServerArgs {
8
- port?: number;
9
- root_dir?: string;
10
- https?: boolean;
11
- host?: string;
12
- }
13
- declare const _dts_1: () => any;
14
- export default _dts_1;
@@ -1 +0,0 @@
1
- import e from"node:fs";import{ink as r,println as o}from"@moneko/utils";import m from"../commom/parse-args.mjs";import s from"../commom/print-log.mjs";import{CONFIG as t}from"../config.mjs";import p from"../dev/server.mjs";export default(async()=>{let{argv:i}=process,{port:a=t.devServer.port??8080,root_dir:n="./dist",https:l=t.devServer.https,host:v=t.devServer.host??"localhost"}=m(i.slice(2));p({port:a,root_dir:n,https:l,host:v,fileSystem:e,headers:t.devServer.headers,open:t.devServer.open,basename:t.basename}),o(r("You application is running here:","245"),!0),o("",!0),s("Preview",`${l?"https":"http"}://${v}:${a}`,{timestamp:!1,labelBackgroundColor:"blue"}),o("",!0)});
@@ -1,5 +0,0 @@
1
- import { argv, exit } from 'node:process';
2
- import { ink, println } from '@moneko/utils';
3
- import setupEnv from '../commom/setup-env.mjs';
4
- declare async function start();
5
- export default start;
package/lib/bin/start.mjs DELETED
@@ -1 +0,0 @@
1
- import{argv as e,exit as o}from"node:process";import{ink as t,println as r}from"@moneko/utils";import m from"../commom/setup-env.mjs";async function i(){let i=e[3],s=e[4],p=e.slice(5);i||(r(t(`type: 无效值 ${t(i,"245")}`,"red")),o(1));let n=p.indexOf("no-verify");-1!==n&&p.splice(n,1),await m("development",i,s,p);try{await import("../dev.mjs")}catch(e){r(t(Error(e).message,"red")),o(1)}}export default i;
@@ -1,7 +0,0 @@
1
- import { relative } from 'node:path';
2
- import { argv, exit, stdout } from 'node:process';
3
- import { stylelint } from '@moneko/stylelint';
4
- import { ink, print } from '@moneko/utils';
5
- import { cachePath, cwd, parseBraced } from './utils/config.mjs';
6
- declare async function run();
7
- export default run;
@@ -1,2 +0,0 @@
1
- import{relative as e}from"node:path";import{argv as s,exit as t,stdout as r}from"node:process";import{stylelint as o}from"@moneko/stylelint";import{ink as i,print as l}from"@moneko/utils";import{cachePath as c,cwd as n,parseBraced as a}from"./utils/config.mjs";async function m(){let m=i("stylelint","cyan");l(`${m}: ${i("Runing...","yellow")}`,!0);let f=s[3],p=s.slice(4),u=p.includes("--fix"),d=await o.lint({files:a(f).map(s=>e(n,`${s}/**/*.{css,scss,sass,less,ts,tsx,js,jsx}`).replace(/\\/g,"/")),fix:u,cache:!p.includes("--cache=false"),cacheLocation:`${c}/.stylelintcache`,formatter:"string"}),y=d.errored;d.report&&r.write(d.report),l(`${m}: ${i(`✨ ${y?"Error":"Successfully"}!
2
- `,y?"red":"green")}`,!0),y&&t(1)}export default m;
package/lib/bin/tsc.d.mts DELETED
@@ -1,6 +0,0 @@
1
- import { join } from 'node:path';
2
- import { stdout } from 'node:process';
3
- import ts from 'typescript';
4
- import { cwd } from './utils/config.mjs';
5
- declare async function tsc(outDir: string);
6
- export default tsc;
package/lib/bin/tsc.mjs DELETED
@@ -1 +0,0 @@
1
- import{join as e}from"node:path";import{stdout as t}from"node:process";import o from"typescript";import{cwd as i}from"./utils/config.mjs";async function n(n){return new Promise(s=>{let r=o.parseJsonConfigFileContent({extends:e(i,"tsconfig.json"),compilerOptions:{outDir:n,typeRoots:["node_modules/@types/","node_modules/.pnpm/node_modules/@types/"],declaration:!0,emitDeclarationOnly:!0,skipLibCheck:!0,skipDefaultLibCheck:!0,noEmitOnError:!1},include:[e(i,"components"),e(i,"typings")],exclude:[e(i,"components/**/examples/*"),e(i,"components/**/__tests__/*"),e(i,"components/**/__mocks__/*")]},o.sys,i);r.options.incremental&&(r.options.tsBuildInfoFile=r.options.tsBuildInfoFile??e(n,".tsbuildinfo"));let l=o.createProgram(r.fileNames,r.options),m=l.emit();o.getPreEmitDiagnostics(l).concat(m.diagnostics).forEach(e=>{if(t.write("\n"),e.file){let{line:i,character:n}=e.file.getLineAndCharacterOfPosition(e.start),s=o.flattenDiagnosticMessageText(e.messageText,"\n");t.write(`${e.file.fileName} (${i+1},${n+1}): ${s}`)}else t.write(o.flattenDiagnosticMessageText(e.messageText,"\n"))}),s(!0)})}export default n;
@@ -1,7 +0,0 @@
1
- import { execSync } from 'node:child_process';
2
- import { renameSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { bundleIpa, createDir, ink, print } from '@moneko/utils';
5
- import timer from '../../commom/timer.mjs';
6
- export declare function bundleApk(outputPath: string, outputBundleDir: string, type?: string);
7
- export declare function bundleIOS(outputPath: string, outputBundleDir: string, type?: string);
@@ -1 +0,0 @@
1
- import{execSync as e}from"node:child_process";import{renameSync as o}from"node:fs";import{join as n}from"node:path";import{bundleIpa as p,createDir as t,ink as a,print as r}from"@moneko/utils";import l from"../../commom/timer.mjs";export function bundleApk(p,i,u="-release"){r(a("正在编译 apk...","yellow"),!0),l.start(`bundle apk ${u}`),e(`flutter build apk -${u}`),l.end(`bundle apk ${u}`),t(i),o(n(p,`build/app/outputs/flutter-apk/app${u}.apk`),i),r(`✨ ${a("Apk 编译","cyan")}: ${a("完成","cyan")}`,!0)}export function bundleIOS(i,u,d="-release"){r(a("正在编译 ipa...","yellow"),!0),l.start(`bundle ipa ${d}`);let m=n(u,"Runner/Payload");e(`flutter build ios -${d} --no-codesign`),t(m),o(n(i,"build/ios/iphoneos/Runner.app"),m),p(n(u,"Runner"),u,d),l.end(`bundle ipa ${d}`),r(`✨ ${a("ipa 编译","cyan")}: ${a("完成","cyan")}`,!0)}
@@ -1,13 +0,0 @@
1
- import { dirname, join } from 'node:path';
2
- import { cwd as _cwd, execPath, platform } from 'node:process';
3
- declare const Deno: VoidFunction;
4
- declare const Bun: VoidFunction;
5
- declare function getRuntime();
6
- declare const runtime: 'deno' | 'bun' | 'node';
7
- declare let runtimeDir: string;
8
- export declare const runtimePath: string;
9
- export declare const corePkg: string;
10
- export declare const cwd: string;
11
- export declare const cachePath: string;
12
- export declare const swcCachePath: string;
13
- export declare function parseBraced(input: string);
@@ -1 +0,0 @@
1
- import{dirname as e,join as o}from"node:path";import{cwd as t,execPath as n,platform as c}from"node:process";let r="undefined"!=typeof Deno?"deno":"undefined"!=typeof Bun?"bun":"node",s=e(n);"win32"===c&&s.includes(" ")&&(s=`"${s}"`);export const runtimePath=o(s,r);export const corePkg="@moneko/core";export const cwd=t();export const cachePath=o(cwd,"node_modules/.cache");export const swcCachePath=o(cachePath,".swc");export function parseBraced(e){return e.startsWith("[")&&e.endsWith("]")?e.slice(1,-1).split(","):[e]}
@@ -1,3 +0,0 @@
1
- import { type ChildProcessWithoutNullStreams, spawn } from 'node:child_process';
2
- declare function getCommitFiles();
3
- export default getCommitFiles;
@@ -1 +0,0 @@
1
- import{spawn as t}from"node:child_process";export default function(){return new Promise(function(n,o){let r=t("git",["diff","--name-only","HEAD^","HEAD"]),i="",e="";r.stdout.on("data",function(t){i+=t.toString()}),r.stderr.on("data",function(t){e+=t.toString()}),r.on("close",function(t){0===t?n(i.trim().split("\n")):o({code:t,error:e})})})}
@@ -1,4 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- declare function enablePrePostScripts();
3
- declare function checkNpm();
4
- export default checkNpm;
@@ -1 +0,0 @@
1
- import{spawn as t}from"node:child_process";export default function(){t("npm",["-v"],{stdio:"pipe",shell:!0}).stdout.on("data",e=>{e.toString().split(".")[0]<9&&t("npm",["config","get","enable-pre-post-scripts"],{stdio:"pipe",shell:!0}).stdout.on("data",e=>{"true"!==e.toString().trim()&&t("npm",["config","set","enable-pre-post-scripts","true","-L","project"],{stdio:"ignore",shell:!0})})})}
@@ -1,12 +0,0 @@
1
- import { spawn, type SpawnOptions } from 'node:child_process';
2
- import { dirname, join } from 'node:path';
3
- import { execPath, platform, versions } from 'node:process';
4
- import { ink, loadFile, loadFileSync, println, saveFile } from '@moneko/utils';
5
- import log from './log.mjs';
6
- declare const packageJsonPath: string;
7
- declare const packageJson: typeof import('package.json');
8
- declare const shim: string;
9
- declare const spawnOptions: SpawnOptions;
10
- declare function getManagerVersion(): string;
11
- declare function corepackInstalled(): Promise<boolean>;
12
- export declare function corepack(enable?: boolean);
@@ -1 +0,0 @@
1
- import{spawn as e}from"node:child_process";import{dirname as r,join as n}from"node:path";import{execPath as o,platform as a,versions as p}from"node:process";import{ink as c,loadFile as t,loadFileSync as i,println as m,saveFile as s}from"@moneko/utils";import l from"./log.mjs";let g=`${process.cwd()}/package.json`,d=JSON.parse(i(g)),f=c("corepack","magenta"),k={stdio:"ignore",shell:!0};export function corepack(i){new Promise(p=>{if(d.packageManager){let c=e("corepack",["-v"],k);c.on("error",e=>{l(e),p(!1)}),c.on("exit",e=>{0!==e&&p(!1);let c=d.packageManager.split("@")[0],i="win32"===a?`${c}.cmd`:c;t(n(r(o),i)).then(e=>{p(e.includes("corepack"))}).catch(e=>{l(e),p(!1)})})}else p(!1)}).then(r=>{if(i){if(d.packageManager||(d.packageManager=function(){let e=Number(p.node.split(".")[0]);return e<16?"pnpm@7.33.7":e<18?"pnpm@8.15.9":"pnpm@10.14.0"}(),s(g,JSON.stringify(d,null,2))),r)return;e("corepack",["enable"],k);return}r?m(`${f} is ${c("enabled","green")} ${c(`(${d.name})`,"245")}`):m(`${f} is ${c("disabled","yellow")} ${c(`(${d.name})`,"245")}`)}).catch(e=>{l(e)})}
@@ -1,2 +0,0 @@
1
- import type { ConfigType } from '../index.mjs';
2
- export declare function diffObject(prev?: Partial<ConfigType>, next?: Partial<ConfigType>);
@@ -1 +0,0 @@
1
- export function diffObject(e,t){let f={};if(!e||!t)return t||{};for(let n of new Set([...Object.keys(e),...Object.keys(t)])){if(!(n in t)){f[n]=void 0;continue}if(e[n]!==t[n]){if("object"==typeof e[n]&&"object"==typeof t[n]&&null!==e[n]&&null!==t[n]){let i=diffObject(e[n],t[n]);Object.keys(i).length>0&&(f[n]=i)}else f[n]=t[n]}}return f}
@@ -1,3 +0,0 @@
1
- import { addHost, checkHost, getHostsPath, ink, println } from '@moneko/utils';
2
- declare function flashDNS();
3
- export declare function hostHelp(domain: string);
@@ -1,19 +0,0 @@
1
- import{addHost as s,checkHost as t,getHostsPath as e,ink as o,println as l}from"@moneko/utils";export function hostHelp(r){let c="127.0.0.1";t(c,r)||s(c,r),t(c,r)||l(`
2
- ${o("🚦 域名解析配置提醒","yellow",{bold:!0})}
3
-
4
- 检测到您正在使用本地域名:${o(r,"yellow")},但系统未找到对应的本地解析记录
5
-
6
- 📝 请按以下步骤操作:
7
-
8
- 1. 使用文本编辑器【以管理员身份】打开 hosts 文件:
9
-
10
- ${o("hosts 文件地址:","242")} ${o(e(),"208")}
11
-
12
- 2. 在文件末尾添加解析规则:
13
-
14
- ${o(c,"39")} ${o(r,"39")}
15
-
16
- 3. 保存文件后,建议刷新DNS缓存:
17
-
18
- ${o(function(){switch(process.platform){case"darwin":return"sudo dscacheutil -flushcache";case"win32":return"ipconfig /flushdns";default:return"sudo systemctl restart systemd-resolved"}}(),"208")}
19
- `)}
@@ -1,3 +0,0 @@
1
- import require from './require.mjs';
2
- declare function moduleResolve(name: string, esm?: boolean);
3
- export default moduleResolve;
@@ -1 +0,0 @@
1
- import r from"./require.mjs";export default function t(e,o){try{return o&&"function"==typeof import.meta.resolve?import.meta.resolve(e):r.resolve(e)}catch{try{return t(e,!0)}catch{return e}}}
@@ -1,4 +0,0 @@
1
- import { createConnection } from 'node:net';
2
- import { networkInterfaces } from 'node:os';
3
- export declare function getIPv4();
4
- export declare function getPort<T = number>(start: T, host?: string);
@@ -1 +0,0 @@
1
- import{createConnection as e}from"node:net";import{networkInterfaces as t}from"node:os";export function getIPv4(){let e=t(),o=null,r=Object.keys(e);for(let t=0,n=r.length;t<n;t++){let n=e[r[t]]||[];for(let e=0,t=n.length;e<t;e++){let t=n[e];"IPv4"!==t.family||t.internal||(o=t.address)}}return o}export function getPort(t,o="0.0.0.0"){return new Promise((r,n)=>{if("number"!=typeof t)r(t);else{let l=e(t,o);l.on("connect",()=>{l.destroy(),r(getPort(t+1,o))}),l.on("error",e=>{l.destroy(e),"ECONNREFUSED"===e.code?r(t):n(e)})}})}
@@ -1,5 +0,0 @@
1
- import { type ChildProcess, spawn } from 'node:child_process';
2
- import { platform } from 'node:process';
3
- import { empty } from '../utils/index.mjs';
4
- declare function open(url: string);
5
- export default open;
@@ -1 +0,0 @@
1
- import{spawn as e}from"node:child_process";import{platform as o}from"node:process";import{empty as r}from"../utils/index.mjs";export default function(t){let n,d;"win32"===o?(n="cmd.exe",d=["/c","start",'""',"/b",t.replace(/&/g,"^&")]):(n="darwin"===o?"open":"xdg-open",d=[t]);let i=e(n,d,{detached:!0,stdio:"ignore"});i.on("error",r),i.unref()}
@@ -1,36 +0,0 @@
1
- import { tmpdir } from 'node:os';
2
- import { resolve } from 'node:path';
3
- import { argv, cwd, env } from 'node:process';
4
- import url from 'node:url';
5
- import { fileExists } from '@moneko/utils';
6
- import parseArgs from './parse-args.mjs';
7
- declare const original: string[];
8
- export declare const __dirname: string;
9
- export declare const yarnArgv: Record<string, string> & {
10
- config?: string;
11
- };
12
- export declare const CUSTOMCONFIG: string | undefined;
13
- declare const programPath: string;
14
- declare const nodeModules: string;
15
- export declare const TMP_DIR: string;
16
- declare const paths: {
17
- readonly nodeModules;
18
- readonly pnpmNodeModules;
19
- readonly denoNodeModules;
20
- readonly corePath;
21
- readonly programPath;
22
- readonly CA_DIR;
23
- readonly webpackCachePath;
24
- readonly lintCachePath;
25
- readonly httpCachePath;
26
- readonly swcCachePath;
27
- readonly configPath;
28
- readonly customConfigPath;
29
- readonly coveragePath;
30
- readonly pagesPath;
31
- readonly componentsPath;
32
- readonly mockPath;
33
- };
34
- export declare const config_files: string[];
35
- export declare const routeDir: string;
36
- export default paths;
@@ -1 +0,0 @@
1
- import{tmpdir as o}from"node:os";import{resolve as e}from"node:path";import{argv as t,cwd as n,env as a}from"node:process";import r from"node:url";import{fileExists as c}from"@moneko/utils";import i from"./parse-args.mjs";let s=JSON.parse(a.npm_config_argv||'{"original":[]}').original;export const __dirname=r.fileURLToPath(new URL("..",import.meta.url));export const yarnArgv={};for(let o=0,e=s.length;o<e;o++){let e=s[o].split("=");Object.assign(yarnArgv,{[e[0]]:e[1]||!0})}export const CUSTOMCONFIG=a.npm_config_config||yarnArgv.config||a.__args__config__||i(t.slice(2)).config;let m=n(),p=e(m,"node_modules");export const TMP_DIR=e(o(),"@moneko");let g={nodeModules:p,pnpmNodeModules:e(p,".pnpm/node_modules"),denoNodeModules:e(p,".deno"),corePath:__dirname,programPath:m,CA_DIR:e(TMP_DIR,".ca"),webpackCachePath:e(p,".cache"),lintCachePath:e(p,".cache"),httpCachePath:e(p,".cache/http"),swcCachePath:e(p,".cache/.swc"),configPath:e(m,"config/index.ts"),customConfigPath:e(m,`config/${CUSTOMCONFIG}.ts`),coveragePath:e(m,"coverage/clover.xml"),pagesPath:e(m,"src/pages"),componentsPath:e(m,"components"),mockPath:e(m,"mock")};export const config_files=[c(g.configPath)&&g.configPath,c(g.customConfigPath)&&g.customConfigPath].filter(Boolean);export const routeDir="library"===a.APPTYPE?g.componentsPath:g.pagesPath;export default g;
@@ -1,10 +0,0 @@
1
- import EventEmitter from 'node:events';
2
- declare class ReactiveObject<T extends object = Record<string, string | undefined>> extends EventEmitter {
3
- readonly data: T;
4
- constructor(props = {} as T);
5
- setData(key: keyof T, value: T[keyof T]);
6
- getData(key: keyof T);
7
- removeData(key: keyof T);
8
- [Symbol.iterator](): Iterator<[keyof T, T[keyof T]]>;
9
- }
10
- export default ReactiveObject;
@@ -1 +0,0 @@
1
- import t from"node:events";class e extends t{constructor(t={}){super(),this.data=t,this.setMaxListeners(0)}setData(t,e){this.data[t]!==e&&(this.data[t]=e,this.emit("change",t,e))}getData(t){return this.data[t]}removeData(t){Object.prototype.hasOwnProperty.call(this.data,t)&&(delete this.data[t],this.emit("change",t,null))}[Symbol.iterator](){let t=Object.keys(this.data),e=0;return{next:()=>{if(e<t.length){let a=t[e++];return{value:[a,this.data[a]],done:!1}}return{value:void 0,done:!0}}}}}export default e;
@@ -1,20 +0,0 @@
1
- declare const Rule: {
2
- readonly js: RegExp;
3
- readonly css: RegExp;
4
- readonly less: RegExp;
5
- readonly scss: RegExp;
6
- readonly wasm: RegExp;
7
- readonly txt: RegExp;
8
- readonly image: RegExp;
9
- readonly video: RegExp;
10
- readonly font: RegExp;
11
- readonly markdown: RegExp;
12
- readonly tsdoc: RegExp;
13
- readonly css_module: RegExp;
14
- readonly node_modules_css_module: RegExp;
15
- readonly node_modules: RegExp;
16
- readonly __tests__: RegExp;
17
- readonly dev_watch_ignored: RegExp;
18
- readonly extract_func: RegExp;
19
- };
20
- export default Rule;
@@ -1 +0,0 @@
1
- export default{js:/\.(cj|mj|t|j)s(|x)$/i,css:/\.css$/i,less:/\.less$/i,scss:/\.(sa|sc)ss$/i,wasm:/\.wasm$/i,txt:/\.txt$/i,image:/\.(gif|png|jpe?g|webp|svg|ico)$/i,video:/\.(webm|mp4|ogv)$/i,font:/\.(woff2?|eot|ttf|otf)(\?.*)?$/i,markdown:/\.mdx?$/i,tsdoc:/^(?![._]).*(?<!\.test)\.(tsx?)$/,css_module:/(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules_css_module:/(^(?!.*node_modules))(.*(?<!\.?global\.(le|c|sc|sa)ss)$)/i,node_modules:/node_modules/,__tests__:/(.+)\/__tests__\/(.+)/,dev_watch_ignored:/node_modules(?![\\/]@app)/,extract_func:/"rr\((.+?)\)rr"/g};
@@ -1,4 +0,0 @@
1
- import { env } from 'node:process';
2
- import { loadFile } from '@moneko/utils';
3
- declare async function setupEnv(mode: string, type: string, framework: string, args: string[]);
4
- export default setupEnv;
@@ -1 +0,0 @@
1
- import{env as e}from"node:process";import{loadFile as t}from"@moneko/utils";async function r(r,i,n,o){let s=[".env",".env/.env",`.env/.${"production"===r?"prod":"dev"}.env`],a={NODE_ENV:r,APPTYPE:i,FRAMEWORK:n};return o.forEach(e=>{let[t,r]=e.replace(/^--/,"").split("=");Object.assign(a,{[`__args__${t}__`]:r||!0})}),(await Promise.all(s.map(t))).forEach(e=>{e&&Object.assign(a,e.split("\n").reduce((e,t)=>{if(!t||t.trim().startsWith("#"))return e;let[r,...i]=t.split("=");if(!r)return e;let n=i.join("=").trim();return e[r.trim()]=n.replace(/^["']|["']$/g,""),e},{}))}),Object.keys(a).forEach(t=>{let r=a[t];e[t]!==r&&(e[t]=a[t])}),a}export default r;
@@ -1,3 +0,0 @@
1
- import process from 'node:process';
2
- declare function sigintExit(call: VoidFunction);
3
- export default sigintExit;
@@ -1 +0,0 @@
1
- import o from"node:process";export default function(n){o.on("SIGINT",n),o.on("SIGTERM",n),o.on("SIGQUIT",n)}
@@ -1,41 +0,0 @@
1
- import { type PluginItem, transformAsync, type TransformOptions } from '@moneko/eslint/babel-core';
2
- import BabelPresetEnv from '@moneko/eslint/babel-preset-env';
3
- import BabelPresetTypescript from '@moneko/eslint/babel-typescript';
4
- import jsxDomTransform from 'babel-plugin-jsx-dom-expressions';
5
- import BabelPluginSolidRefresh from 'solid-refresh/babel';
6
- import { JsxDomExpressions } from '../index.mjs';
7
- export interface TransformSolidJsOption extends TransformOptions {
8
- refresh?: boolean;
9
- jsxOptions?: JsxDomExpressions;
10
- typescriptOption?: TypescriptOption;
11
- presetEnvOption?: PresetEnvOption;
12
- }
13
- export interface TypescriptOption {
14
- ignoreExtensions?: boolean;
15
- allowNamespaces?: boolean;
16
- disallowAmbiguousJSXLike?: boolean;
17
- jsxPragma?: string;
18
- jsxPragmaFrag?: string;
19
- onlyRemoveTypeImports?: boolean;
20
- optimizeConstEnums?: boolean;
21
- rewriteImportExtensions?: boolean;
22
- }
23
- export interface PresetEnvOption {
24
- configPath?: string;
25
- corejs?: string | {
26
- version: string;
27
- proposals: boolean;
28
- };
29
- debug?: boolean;
30
- exclude?: Array<string | RegExp>;
31
- forceAllTransforms?: boolean;
32
- ignoreBrowserslistConfig?: boolean;
33
- include?: Array<string | RegExp>;
34
- modules?: 'amd' | 'umd' | 'systemjs' | 'commonjs' | 'cjs' | 'auto' | false;
35
- shippedProposals?: boolean;
36
- targets?: string | Array<string> | Record<string, string>;
37
- useBuiltIns?: 'usage' | 'entry' | false;
38
- browserslistEnv?: string;
39
- }
40
- declare const normalPresetEnvOption: PresetEnvOption;
41
- export declare async function transformSolidJs(sourceCode: string, { refresh, filename, jsxOptions, typescriptOption = {}, presetEnvOption = {}, ...options }: TransformSolidJsOption);
@@ -1 +0,0 @@
1
- import{transformAsync as e}from"@moneko/eslint/babel-core";import o from"@moneko/eslint/babel-preset-env";import r from"@moneko/eslint/babel-typescript";import l from"babel-plugin-jsx-dom-expressions";import n from"solid-refresh/babel";let s={modules:!1};export async function transformSolidJs(i,{refresh:t,filename:m,jsxOptions:p,typescriptOption:a={},presetEnvOption:b={},...f}){return e(i,{sourceFileName:m,filename:m,sourceMaps:"inline",cloneInputAst:!1,ast:!1,configFile:!1,babelrc:!1,...f,presets:[[o,{...s,...b}],[r,a]],plugins:[[l,p],t&&[n,{bundler:"webpack5"}]].filter(Boolean)})}
@@ -1,14 +0,0 @@
1
- import { ink, println, termClear } from '@moneko/utils';
2
- import webpack from 'webpack';
3
- import { hostHelp } from '../commom/host.mjs';
4
- import { getIPv4, getPort } from '../commom/net.mjs';
5
- import printUrlLog from '../commom/print-log.mjs';
6
- import { CONFIG } from '../config.mjs';
7
- declare const oldPord: number;
8
- export declare const PORT: number;
9
- declare const initRouteBase: boolean;
10
- declare const routeBase: string;
11
- declare const skipPortMsg: string | false;
12
- export declare function getServerAddress(type: 'local' | 'net');
13
- declare const welcomeMsg: string;
14
- export declare function devLog(err?: Error | null, stats?: webpack.Stats);
@@ -1,2 +0,0 @@
1
- import{ink as e,println as r,termClear as o}from"@moneko/utils";import{hostHelp as t}from"../commom/host.mjs";import{getIPv4 as m,getPort as s}from"../commom/net.mjs";import n from"../commom/print-log.mjs";import{CONFIG as i}from"../config.mjs";let a=i.devServer.port||3e3;export const PORT=await s(a);i.devServer.port=PORT;let l="/"===i.basename?"":i.basename,p=a!==PORT&&e(`Port ${e(`${a}`,"yellow")} is in use, trying ${e(`${PORT}`,"green")} instead.
2
- `,"245");export function getServerAddress(e){return`${i.devServer.https?"https":"http"}://${"local"===e?i.devServer.host:m()}:${PORT}${l}`}let c=e("You application is running here:","245");export function devLog(m,s){o(3);let a=(s?.endTime??0)-(s?.startTime??0);r(c,!0),r("",!0),n("Local",getServerAddress("local"),{timestamp:!1,labelBackgroundColor:"blue",labelLen:9}),n("Network",getServerAddress("net"),{timestamp:!1,labelBackgroundColor:"29"}),r("",!0),r(e(`Compiled successfully in ${e(`${a}ms`,"green")}`,"245"),!0),r("",!0),p&&r(p),t(i.devServer.host),s&&(s.compilation.warnings.forEach(e=>{r(e.message)}),s.compilation.errors.forEach(e=>{r(e.message)})),m&&r(m.message)}
@@ -1,10 +0,0 @@
1
- import { ink, loadFile, println } from '@moneko/utils';
2
- import { setupCert } from '../commom/ca.mjs';
3
- export type CertOption = {
4
- key: string;
5
- cert: string;
6
- } | {
7
- install: boolean;
8
- };
9
- declare async function getCert(domain: string, option: CertOption);
10
- export default getCert;
@@ -1 +0,0 @@
1
- import{ink as e,loadFile as r,println as t}from"@moneko/utils";import{setupCert as o}from"../commom/ca.mjs";async function i(i,m){if("key"in m){let o=await Promise.all([r(m.key),r(m.cert)]);return o[0]||(t(e(`法加载私钥。请检查路径和文件是否存在,并确保路径正确:${m.key}`,"red")),process.exit(1)),o[1]||(t(e(`无法加载证书。请检查路径和文件是否存在,并确保路径正确:${m.cert}`,"red")),process.exit(1)),{key:o[0],cert:o[1]}}return o(i,m.install)}export default i;