unplugin-https-reverse-proxy 1.0.0-beta.15 → 1.0.0-beta.16

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/dist/webpack.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  unpluginFactory
3
- } from "./chunk-GV7Y22GZ.js";
4
- import "./chunk-UGWFCSQS.js";
3
+ } from "./chunk-QMYDD3HL.js";
4
+ import "./chunk-2VGRJ3QS.js";
5
5
 
6
6
  // src/webpack.ts
7
7
  import { createWebpackPlugin } from "unplugin";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unplugin-https-reverse-proxy",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.15",
4
+ "version": "1.0.0-beta.16",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/zcf0508/unplugin-https-reverse-proxy#readme",
@@ -84,6 +84,7 @@
84
84
  "@rsbuild/core": "^0.4.3",
85
85
  "@rspack/core": "^0.5.4",
86
86
  "esbuild": "*",
87
+ "proper-lockfile": "^4.1.2",
87
88
  "rollup": "^3",
88
89
  "vite": ">=3",
89
90
  "webpack": "^4 || ^5"
@@ -55,6 +55,7 @@ var import_got_cjs = require("got-cjs");
55
55
  var import_http_proxy_agent = require("http-proxy-agent");
56
56
  var import_https_proxy_agent = require("https-proxy-agent");
57
57
  var import_kill_port = __toESM(require("kill-port"), 1);
58
+ var lockfile = __toESM(require("proper-lockfile"), 1);
58
59
 
59
60
  // src/host/index.ts
60
61
  var import_node_process2 = __toESM(require("process"), 1);
@@ -7,6 +7,7 @@ import { got } from 'got-cjs'
7
7
  import { HttpProxyAgent } from 'http-proxy-agent'
8
8
  import { HttpsProxyAgent } from 'https-proxy-agent'
9
9
  import kill from 'kill-port'
10
+ import * as lockfile from 'proper-lockfile'
10
11
  import { chmodRecursive, consola, once } from '../utils'
11
12
  import { addHost, removeHost } from '../host'
12
13
  import { TEMP_DIR, caddyFilePath, caddyLockFilePath, caddyPath, supportList } from './constants'
@@ -108,8 +109,6 @@ export class CaddyInstant {
108
109
  private locked = false
109
110
  private caddyfile: string | undefined
110
111
 
111
- private lockfile: typeof import('proper-lockfile')
112
-
113
112
  constructor() {
114
113
  testCaddy().then(async () => {
115
114
  await this.getCaddyfile()
@@ -117,16 +116,13 @@ export class CaddyInstant {
117
116
  this.inited = true
118
117
  })
119
118
 
120
- // eslint-disable-next-line @typescript-eslint/no-require-imports
121
- this.lockfile = require('proper-lockfile')
122
-
123
119
  this.locked = this.checkLock()
124
120
  }
125
121
 
126
122
  checkLock() {
127
123
  if (!existsSync(caddyLockFilePath))
128
124
  writeFileSync(caddyLockFilePath, '')
129
- return this.lockfile.checkSync(caddyLockFilePath)
125
+ return lockfile.checkSync(caddyLockFilePath)
130
126
  }
131
127
 
132
128
  async getCaddyfile() {
@@ -283,7 +279,7 @@ ${target.split(':')[0]}${https ? '' : ':80'} {
283
279
  ? spawn('sudo', ['-E', caddyPath, 'run', '--config', caddyFilePath, '--watch'])
284
280
  : spawn(caddyPath, ['run', '--config', caddyFilePath, '--watch'])
285
281
 
286
- this.lockfile.lockSync(caddyLockFilePath)
282
+ lockfile.lockSync(caddyLockFilePath)
287
283
 
288
284
  child.on('error', (err) => {
289
285
  return reject(err)
@@ -328,7 +324,7 @@ ${target.split(':')[0]}${https ? '' : ':80'} {
328
324
  async baseCleanup() {
329
325
  if (!this.locked) {
330
326
  try {
331
- await this.lockfile.unlock(caddyLockFilePath)
327
+ await lockfile.unlock(caddyLockFilePath)
332
328
  await unlink(caddyFilePath)
333
329
  await unlink(caddyLockFilePath)
334
330
  }