@moneko/core 3.44.11 → 3.45.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/commom/ca.d.mts +2 -4
- package/lib/commom/ca.mjs +1 -1
- package/lib/commom/host.d.mts +3 -0
- package/lib/commom/host.mjs +19 -0
- package/lib/dev/config.d.mts +1 -0
- package/lib/dev/config.mjs +3 -3
- package/package.json +5 -6
- package/lib/cert/cert.pem +0 -23
- package/lib/cert/key.pem +0 -27
package/lib/commom/ca.d.mts
CHANGED
|
@@ -2,10 +2,8 @@ import { type ChildProcess, exec, type ExecException, type PromiseWithChild } fr
|
|
|
2
2
|
import { join, relative } from 'node:path';
|
|
3
3
|
import { platform } from 'node:process';
|
|
4
4
|
import { promisify } from 'node:util';
|
|
5
|
-
import { fileExists, loadFile, println, saveFile } from '@moneko/utils';
|
|
6
|
-
import { type Certificate, createCA, createCert } from 'mkcert';
|
|
5
|
+
import { type CertificateResult, fileExists, generateCert, loadFile, normalCertificateAuthority, println, saveFile } from '@moneko/utils';
|
|
7
6
|
import log from './log.mjs';
|
|
8
|
-
import { getIPv4 } from './net.mjs';
|
|
9
7
|
import paths from './paths.mjs';
|
|
10
8
|
type ExecPromise = (command: string) => PromiseWithChild<{
|
|
11
9
|
stdout: string;
|
|
@@ -15,4 +13,4 @@ declare const execPromise: ExecPromise;
|
|
|
15
13
|
declare async function isCertificateInstalled(organization: string): Promise<boolean>;
|
|
16
14
|
declare function installCallback(error: ExecException | null, _stdout: string, stderr: string): void;
|
|
17
15
|
export declare function installCA(certPath: string): ChildProcess | void;
|
|
18
|
-
export declare async function setupCert(domain?: string, install?: boolean): Promise<
|
|
16
|
+
export declare async function setupCert(domain?: string, install?: boolean): Promise<CertificateResult>;
|
package/lib/commom/ca.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exec as t}from"node:child_process";import{join as e,relative as r}from"node:path";import{platform as o}from"node:process";import{promisify as i}from"node:util";import{fileExists as a,
|
|
1
|
+
import{exec as t}from"node:child_process";import{join as e,relative as r}from"node:path";import{platform as o}from"node:process";import{promisify as i}from"node:util";import{fileExists as a,generateCert as n,loadFile as c,normalCertificateAuthority as l,println as s,saveFile as m}from"@moneko/utils";import u from"./log.mjs";import f from"./paths.mjs";let p=i(t);async function d(t){try{if("darwin"===o){let{stdout:e}=await p(`security find-certificate -c "${t}" -a`);return e.length>0}if("win32"===o){let{stdout:e}=await p(`certutil -store -user Root | findstr /C:"${t}"`);return e.length>0}}catch(t){u(t)}return!1}function y(t,e,r){if(t&&!r.includes("already exists")){u(t);return}}export function installCA(e){return"darwin"===o?t(`sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "${e}"`,y):"win32"===o?t(`certutil -addstore -user "Root" "${e}"`,y):void s(`⚠️ 暂不支持自动安装 CA 的平台: ${o}`)}export async function setupCert(t="localhost",o=!0){let i=r(f.programPath,`${f.corePath}/cert/cert.pem`),s=r(f.programPath,`${f.corePath}/cert/key.pem`),u=!a(i)||!a(s);if(u){let t=l();await Promise.all([m(i,t.cert),m(s,t.key)])}o&&(!await d("Local Root Certificate Authority - Moneko")||u)&&installCA(i);let p=e(f.CA_DIR,`${t}_cert.pem`),y=e(f.CA_DIR,`${t}_key.pem`);if(u||!a(p)||!a(y)){let e=await Promise.all([c(i),c(s)]),r=n(e[0],e[1],t);await Promise.all([m(p,r.cert),m(y,r.key)])}let h=await Promise.all([c(p),c(y)]);return{cert:h[0],key:h[1]}}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
`)}
|
package/lib/dev/config.d.mts
CHANGED
package/lib/dev/config.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{ink as e,println as r,termClear as
|
|
2
|
-
`,"245");export function getServerAddress(e){return`${
|
|
3
|
-
${e(" Network ","231",{bg:"29"})} ${e(getServerAddress("net"),"green")}`;export function devLog(
|
|
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 s,getPort as n}from"../commom/net.mjs";import{CONFIG as m}from"../config.mjs";let i=m.devServer.port||3e3;export const PORT=await n(i);m.devServer.port=PORT;let a="/"===m.basename?"":m.basename,l=i!==PORT&&e(`Port ${e(`${i}`,"yellow")} is in use, trying ${e(`${PORT}`,"green")} instead.
|
|
2
|
+
`,"245");export function getServerAddress(e){return`${m.devServer.https?"https":"http"}://${"local"===e?m.devServer.host:s()}:${PORT}${a}`}let p=e("You application is running here:","245"),c=`${e(" Local ","231",{bg:"blue"})} ${e(getServerAddress("local"),"75")}
|
|
3
|
+
${e(" Network ","231",{bg:"29"})} ${e(getServerAddress("net"),"green")}`;export function devLog(s,n){o(3);let i=(n?.endTime??0)-(n?.startTime??0);r([p,"",c,"",e(`Compiled successfully in ${e(`${i}ms`,"green")}`,"245"),""].join("\n"),!0),l&&r(l),t(m.devServer.host),n&&(n.compilation.warnings.forEach(e=>{r(e.message)}),n.compilation.errors.forEach(e=>{r(e.message)})),s&&r(s.message)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.45.0",
|
|
4
4
|
"description": "core",
|
|
5
5
|
"main": "lib/index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"@moneko/raw-import": "0.0.3",
|
|
114
114
|
"@moneko/stylelint": "1.3.0",
|
|
115
115
|
"@moneko/transform-imports": "0.6.1",
|
|
116
|
-
"@moneko/utils": "0.
|
|
116
|
+
"@moneko/utils": "0.3.2",
|
|
117
117
|
"@swc/core": "1.6.13",
|
|
118
118
|
"browserslist": "4.24.5",
|
|
119
119
|
"chokidar": "4.0.3",
|
|
@@ -122,11 +122,10 @@
|
|
|
122
122
|
"husky": "9.1.7",
|
|
123
123
|
"less": "4.3.0",
|
|
124
124
|
"less-loader": "12.3.0",
|
|
125
|
-
"lightningcss": "1.30.
|
|
125
|
+
"lightningcss": "1.30.1",
|
|
126
126
|
"marked-completed": "1.2.14",
|
|
127
|
-
"memfs": "4.17.
|
|
127
|
+
"memfs": "4.17.2",
|
|
128
128
|
"mini-css-extract-plugin": "2.9.2",
|
|
129
|
-
"mkcert": "3.2.0",
|
|
130
129
|
"style-loader": "4.0.0",
|
|
131
130
|
"swc-loader": "0.2.6",
|
|
132
131
|
"typescript": "5.8.3",
|
|
@@ -141,7 +140,7 @@
|
|
|
141
140
|
"@types/stylis": "4.2.7",
|
|
142
141
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
143
142
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
144
|
-
"sass": "1.
|
|
143
|
+
"sass": "1.89.0",
|
|
145
144
|
"sass-loader": "16.0.5",
|
|
146
145
|
"solid-refresh": "0.7.5",
|
|
147
146
|
"stylis": "4.3.6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