@moneko/core 3.45.0 → 3.45.1
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 +1 -0
- package/lib/commom/ca.mjs +1 -1
- package/package.json +4 -4
package/lib/commom/ca.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import { platform } from 'node:process';
|
|
|
4
4
|
import { promisify } from 'node:util';
|
|
5
5
|
import { type CertificateResult, fileExists, generateCert, loadFile, normalCertificateAuthority, println, saveFile } from '@moneko/utils';
|
|
6
6
|
import log from './log.mjs';
|
|
7
|
+
import { getIPv4 } from './net.mjs';
|
|
7
8
|
import paths from './paths.mjs';
|
|
8
9
|
type ExecPromise = (command: string) => PromiseWithChild<{
|
|
9
10
|
stdout: string;
|
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,generateCert as n,loadFile as
|
|
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 l,normalCertificateAuthority as c,println as s,saveFile as m}from"@moneko/utils";import u from"./log.mjs";import{getIPv4 as f}from"./net.mjs";import p from"./paths.mjs";let d=i(t);async function y(t){try{if("darwin"===o){let{stdout:e}=await d(`security find-certificate -c "${t}" -a`);return e.length>0}if("win32"===o){let{stdout:e}=await d(`certutil -store -user Root | findstr /C:"${t}"`);return e.length>0}}catch(t){u(t)}return!1}function h(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}"`,h):"win32"===o?t(`certutil -addstore -user "Root" "${e}"`,h):void s(`⚠️ 暂不支持自动安装 CA 的平台: ${o}`)}export async function setupCert(t="localhost",o=!0){let i=r(p.programPath,`${p.corePath}/cert/cert.pem`),s=r(p.programPath,`${p.corePath}/cert/key.pem`),u=!a(i)||!a(s);if(u){let t=c();await Promise.all([m(i,t.cert),m(s,t.key)])}o&&(!await y("Local Root Certificate Authority - Moneko")||u)&&installCA(i);let d=e(p.CA_DIR,`${t}_cert.pem`),h=e(p.CA_DIR,`${t}_key.pem`);if(u||!a(d)||!a(h)){let e=await Promise.all([l(i),l(s)]),r=n(e[0],e[1],[...new Set([t,"localhost","127.0.0.1",f()].filter(Boolean))]);await Promise.all([m(d,r.cert),m(h,r.key)])}let w=await Promise.all([l(d),l(h)]);return{cert:w[0],key:w[1]}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneko/core",
|
|
3
|
-
"version": "3.45.
|
|
3
|
+
"version": "3.45.1",
|
|
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.3.
|
|
116
|
+
"@moneko/utils": "0.3.3",
|
|
117
117
|
"@swc/core": "1.6.13",
|
|
118
118
|
"browserslist": "4.24.5",
|
|
119
119
|
"chokidar": "4.0.3",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"style-loader": "4.0.0",
|
|
130
130
|
"swc-loader": "0.2.6",
|
|
131
131
|
"typescript": "5.8.3",
|
|
132
|
-
"webpack": "5.99.
|
|
132
|
+
"webpack": "5.99.9",
|
|
133
133
|
"webpack-hot-middleware": "2.26.1",
|
|
134
134
|
"webpack-merge": "6.0.1",
|
|
135
135
|
"webpack-virtual-modules": "0.6.2"
|
|
@@ -154,4 +154,4 @@
|
|
|
154
154
|
"lib",
|
|
155
155
|
"typings"
|
|
156
156
|
]
|
|
157
|
-
}
|
|
157
|
+
}
|