Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
liuweiGL committed Nov 20, 2023
1 parent 363d66a commit 0a9e572
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type PluginOption } from 'vite';
import { MkcertBaseOptions } from './mkcert';
import { MkcertBaseOptions } from './mkcert/index';
export { BaseSource, type SourceInfo } from './mkcert/source';
export type MkcertPluginOptions = MkcertBaseOptions & {
/**
Expand Down
28 changes: 14 additions & 14 deletions dist/mkcert.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/mkcert.js.map

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions dist/mkcert.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ var Mkcert = class _Mkcert {
);
this.config = new config_default({ savePath: this.savePath });
}
async getMkcertBinnary() {
let binnary;
async getMkcertBinary() {
let binary;
if (this.localMkcert) {
if (await exists(this.localMkcert)) {
binnary = this.localMkcert;
binary = this.localMkcert;
} else {
this.logger.error(
pc.red(
Expand All @@ -448,9 +448,9 @@ var Mkcert = class _Mkcert {
);
}
} else if (await exists(this.savedMkcert)) {
binnary = this.savedMkcert;
binary = this.savedMkcert;
}
return binnary ? escape(binnary) : void 0;
return binary ? escape(binary) : void 0;
}
async checkCAExists() {
const files = await readDir(this.savePath);
Expand All @@ -460,8 +460,8 @@ var Mkcert = class _Mkcert {
if (await this.checkCAExists()) {
return;
}
const mkcertBinnary = await this.getMkcertBinnary();
const commandStatement = `${mkcertBinnary} -CAROOT`;
const mkcertBinary = await this.getMkcertBinary();
const commandStatement = `${mkcertBinary} -CAROOT`;
debug(`Exec ${commandStatement}`);
const commandResult = await exec(commandStatement);
const caDirPath = path4.resolve(
Expand All @@ -486,15 +486,15 @@ var Mkcert = class _Mkcert {
}
async createCertificate(hosts) {
const names = hosts.join(" ");
const mkcertBinnary = await this.getMkcertBinnary();
if (!mkcertBinnary) {
const mkcertBinary = await this.getMkcertBinary();
if (!mkcertBinary) {
debug(
`Mkcert does not exist, unable to generate certificate for ${names}`
);
}
await ensureDirExist(this.savePath);
await this.retainExistedCA();
const cmd = `${mkcertBinnary} -install -key-file ${escape(
const cmd = `${mkcertBinary} -install -key-file ${escape(
this.keyFilePath
)} -cert-file ${escape(this.certFilePath)} ${names}`;
await exec(cmd, {
Expand Down Expand Up @@ -524,8 +524,8 @@ ${this.certFilePath}`
async init() {
await ensureDirExist(this.savePath);
await this.config.init();
const mkcertBinnary = await this.getMkcertBinnary();
if (!mkcertBinnary) {
const mkcertBinary = await this.getMkcertBinary();
if (!mkcertBinary) {
await this.initMkcert();
} else if (this.autoUpgrade) {
await this.upgradeMkcert();
Expand Down Expand Up @@ -624,7 +624,7 @@ var plugin = (options = {}) => {
name: PLUGIN_NAME,
apply: "serve",
config: async ({ server = {}, logLevel }) => {
if (server.https === false) {
if (typeof server.https === "boolean" && server.https === false) {
return;
}
const { hosts = [], ...mkcertOptions } = options;
Expand All @@ -640,7 +640,7 @@ var plugin = (options = {}) => {
if (typeof server.host === "string") {
allHosts.push(server.host);
}
const uniqueHosts = Array.from(new Set(allHosts)).filter((item) => !!item);
const uniqueHosts = Array.from(new Set(allHosts)).filter(Boolean);
const certificate = await mkcert.install(uniqueHosts);
const httpsConfig = {
key: certificate.key && Buffer.from(certificate.key),
Expand Down
4 changes: 2 additions & 2 deletions dist/mkcert.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mkcert/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ declare class Mkcert {
private config;
static create(options: MkcertOptions): Mkcert;
private constructor();
private getMkcertBinnary;
private getMkcertBinary;
private checkCAExists;
private retainExistedCA;
private getCertificate;
Expand Down

0 comments on commit 0a9e572

Please sign in to comment.