unplugin-https-reverse-proxy 1.0.0-beta.1 → 1.0.0-beta.2
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/{chunk-Y5ZVZOMP.js → chunk-DDD5N75Y.js} +1 -1
- package/dist/{chunk-DUCXH7CX.js → chunk-N6ZBBGYD.js} +9 -5
- package/dist/{chunk-NNO3ZUSU.js → chunk-RUJE3YFB.js} +11 -0
- package/dist/{chunk-QIKJQBZH.js → chunk-VGLXVBHU.js} +1 -1
- package/dist/esbuild.cjs +19 -6
- package/dist/esbuild.js +2 -2
- package/dist/index.cjs +19 -6
- package/dist/index.js +2 -2
- package/dist/nuxt.cjs +19 -6
- package/dist/nuxt.js +4 -4
- package/dist/rollup.cjs +19 -6
- package/dist/rollup.js +2 -2
- package/dist/utils.cjs +12 -0
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +3 -1
- package/dist/vite.cjs +19 -6
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +19 -6
- package/dist/webpack.js +3 -3
- package/package.json +1 -1
- package/src/index.ts +10 -5
- package/src/utils.ts +11 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__spreadValues,
|
|
3
|
+
chmodRecursive,
|
|
3
4
|
consola,
|
|
4
5
|
isAdmin
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RUJE3YFB.js";
|
|
6
7
|
|
|
7
8
|
// src/index.ts
|
|
8
9
|
import process4 from "process";
|
|
9
|
-
import {
|
|
10
|
+
import { existsSync as existsSync2 } from "fs";
|
|
10
11
|
import { createUnplugin } from "unplugin";
|
|
11
12
|
import c from "picocolors";
|
|
12
13
|
|
|
@@ -390,15 +391,15 @@ var CaddyInstant = class {
|
|
|
390
391
|
// src/index.ts
|
|
391
392
|
var config;
|
|
392
393
|
var caddy;
|
|
394
|
+
var pwd = process4.cwd();
|
|
393
395
|
function vitePrintUrls(server, options, source, target, base = "/", _printUrls) {
|
|
394
396
|
_printUrls == null ? void 0 : _printUrls();
|
|
395
|
-
const pwd = process4.cwd();
|
|
396
397
|
const viteCacheDir = `${pwd}/node_modules/.vite`;
|
|
397
398
|
if (existsSync2(viteCacheDir))
|
|
398
|
-
|
|
399
|
+
chmodRecursive(viteCacheDir, 511);
|
|
399
400
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
400
401
|
if (existsSync2(nuxtCacheDir))
|
|
401
|
-
|
|
402
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
402
403
|
try {
|
|
403
404
|
if (caddy)
|
|
404
405
|
return;
|
|
@@ -469,6 +470,9 @@ var unpluginFactory = (options) => ({
|
|
|
469
470
|
consola.fail("please provide target");
|
|
470
471
|
return;
|
|
471
472
|
}
|
|
473
|
+
const nuxtCacheDir = `${pwd}/node_modules/.cache`;
|
|
474
|
+
if (existsSync2(nuxtCacheDir))
|
|
475
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
472
476
|
try {
|
|
473
477
|
const devServer = __spreadValues(__spreadValues({
|
|
474
478
|
host: "localhost",
|
|
@@ -17,11 +17,21 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
|
|
18
18
|
// src/utils.ts
|
|
19
19
|
import process from "process";
|
|
20
|
+
import path from "path";
|
|
21
|
+
import { chmod, readdir, stat } from "fs/promises";
|
|
20
22
|
import { execSync } from "child_process";
|
|
21
23
|
import { createConsola } from "consola";
|
|
22
24
|
var consola = createConsola({
|
|
23
25
|
level: 3
|
|
24
26
|
}).withTag("reverse-proxy");
|
|
27
|
+
async function chmodRecursive(_path, mode) {
|
|
28
|
+
await chmod(_path, mode);
|
|
29
|
+
if ((await stat(_path)).isDirectory()) {
|
|
30
|
+
const children = await readdir(_path);
|
|
31
|
+
for (const child of children)
|
|
32
|
+
await chmodRecursive(path.join(_path, child), mode);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
25
35
|
function once(fn) {
|
|
26
36
|
let called = false;
|
|
27
37
|
return (...args) => {
|
|
@@ -47,6 +57,7 @@ function isAdmin() {
|
|
|
47
57
|
export {
|
|
48
58
|
__spreadValues,
|
|
49
59
|
consola,
|
|
60
|
+
chmodRecursive,
|
|
50
61
|
once,
|
|
51
62
|
isAdmin
|
|
52
63
|
};
|
package/dist/esbuild.cjs
CHANGED
|
@@ -57,11 +57,21 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
57
57
|
|
|
58
58
|
// src/utils.ts
|
|
59
59
|
var import_node_process = __toESM(require("process"), 1);
|
|
60
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
61
|
+
var import_promises = require("fs/promises");
|
|
60
62
|
var import_node_child_process = require("child_process");
|
|
61
63
|
var import_consola = require("consola");
|
|
62
64
|
var consola = (0, import_consola.createConsola)({
|
|
63
65
|
level: 3
|
|
64
66
|
}).withTag("reverse-proxy");
|
|
67
|
+
async function chmodRecursive(_path, mode) {
|
|
68
|
+
await (0, import_promises.chmod)(_path, mode);
|
|
69
|
+
if ((await (0, import_promises.stat)(_path)).isDirectory()) {
|
|
70
|
+
const children = await (0, import_promises.readdir)(_path);
|
|
71
|
+
for (const child of children)
|
|
72
|
+
await chmodRecursive(import_node_path.default.join(_path, child), mode);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
65
75
|
function isAdmin() {
|
|
66
76
|
if (import_node_process.default.platform === "win32") {
|
|
67
77
|
try {
|
|
@@ -133,11 +143,11 @@ async function removeHost(ip, host) {
|
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
// src/caddy/constants.ts
|
|
136
|
-
var
|
|
146
|
+
var import_node_path2 = require("path");
|
|
137
147
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
138
148
|
var TEMP_DIR = import_node_process3.default.env.TEMP || import_node_process3.default.env.TMPDIR || "/tmp";
|
|
139
|
-
var caddyPath = (0,
|
|
140
|
-
var caddyFilePath = (0,
|
|
149
|
+
var caddyPath = (0, import_node_path2.join)(TEMP_DIR, `caddy${import_node_process3.default.platform === "win32" ? ".exe" : ""}`);
|
|
150
|
+
var caddyFilePath = (0, import_node_path2.join)(TEMP_DIR, "CADDYFILE");
|
|
141
151
|
var supportList = [
|
|
142
152
|
{
|
|
143
153
|
platform: "dragonfly",
|
|
@@ -455,15 +465,15 @@ var CaddyInstant = class {
|
|
|
455
465
|
// src/index.ts
|
|
456
466
|
var config;
|
|
457
467
|
var caddy;
|
|
468
|
+
var pwd = import_node_process5.default.cwd();
|
|
458
469
|
function vitePrintUrls(server, options, source, target, base = "/", _printUrls) {
|
|
459
470
|
_printUrls == null ? void 0 : _printUrls();
|
|
460
|
-
const pwd = import_node_process5.default.cwd();
|
|
461
471
|
const viteCacheDir = `${pwd}/node_modules/.vite`;
|
|
462
472
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
463
|
-
(
|
|
473
|
+
chmodRecursive(viteCacheDir, 511);
|
|
464
474
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
465
475
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
466
|
-
(
|
|
476
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
467
477
|
try {
|
|
468
478
|
if (caddy)
|
|
469
479
|
return;
|
|
@@ -534,6 +544,9 @@ var unpluginFactory = (options) => ({
|
|
|
534
544
|
consola.fail("please provide target");
|
|
535
545
|
return;
|
|
536
546
|
}
|
|
547
|
+
const nuxtCacheDir = `${pwd}/node_modules/.cache`;
|
|
548
|
+
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
549
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
537
550
|
try {
|
|
538
551
|
const devServer = __spreadValues(__spreadValues({
|
|
539
552
|
host: "localhost",
|
package/dist/esbuild.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -57,11 +57,21 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
57
57
|
|
|
58
58
|
// src/utils.ts
|
|
59
59
|
var import_node_process = __toESM(require("process"), 1);
|
|
60
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
61
|
+
var import_promises = require("fs/promises");
|
|
60
62
|
var import_node_child_process = require("child_process");
|
|
61
63
|
var import_consola = require("consola");
|
|
62
64
|
var consola = (0, import_consola.createConsola)({
|
|
63
65
|
level: 3
|
|
64
66
|
}).withTag("reverse-proxy");
|
|
67
|
+
async function chmodRecursive(_path, mode) {
|
|
68
|
+
await (0, import_promises.chmod)(_path, mode);
|
|
69
|
+
if ((await (0, import_promises.stat)(_path)).isDirectory()) {
|
|
70
|
+
const children = await (0, import_promises.readdir)(_path);
|
|
71
|
+
for (const child of children)
|
|
72
|
+
await chmodRecursive(import_node_path.default.join(_path, child), mode);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
65
75
|
function isAdmin() {
|
|
66
76
|
if (import_node_process.default.platform === "win32") {
|
|
67
77
|
try {
|
|
@@ -133,11 +143,11 @@ async function removeHost(ip, host) {
|
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
// src/caddy/constants.ts
|
|
136
|
-
var
|
|
146
|
+
var import_node_path2 = require("path");
|
|
137
147
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
138
148
|
var TEMP_DIR = import_node_process3.default.env.TEMP || import_node_process3.default.env.TMPDIR || "/tmp";
|
|
139
|
-
var caddyPath = (0,
|
|
140
|
-
var caddyFilePath = (0,
|
|
149
|
+
var caddyPath = (0, import_node_path2.join)(TEMP_DIR, `caddy${import_node_process3.default.platform === "win32" ? ".exe" : ""}`);
|
|
150
|
+
var caddyFilePath = (0, import_node_path2.join)(TEMP_DIR, "CADDYFILE");
|
|
141
151
|
var supportList = [
|
|
142
152
|
{
|
|
143
153
|
platform: "dragonfly",
|
|
@@ -455,15 +465,15 @@ var CaddyInstant = class {
|
|
|
455
465
|
// src/index.ts
|
|
456
466
|
var config;
|
|
457
467
|
var caddy;
|
|
468
|
+
var pwd = import_node_process5.default.cwd();
|
|
458
469
|
function vitePrintUrls(server, options, source, target, base = "/", _printUrls) {
|
|
459
470
|
_printUrls == null ? void 0 : _printUrls();
|
|
460
|
-
const pwd = import_node_process5.default.cwd();
|
|
461
471
|
const viteCacheDir = `${pwd}/node_modules/.vite`;
|
|
462
472
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
463
|
-
(
|
|
473
|
+
chmodRecursive(viteCacheDir, 511);
|
|
464
474
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
465
475
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
466
|
-
(
|
|
476
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
467
477
|
try {
|
|
468
478
|
if (caddy)
|
|
469
479
|
return;
|
|
@@ -534,6 +544,9 @@ var unpluginFactory = (options) => ({
|
|
|
534
544
|
consola.fail("please provide target");
|
|
535
545
|
return;
|
|
536
546
|
}
|
|
547
|
+
const nuxtCacheDir = `${pwd}/node_modules/.cache`;
|
|
548
|
+
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
549
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
537
550
|
try {
|
|
538
551
|
const devServer = __spreadValues(__spreadValues({
|
|
539
552
|
host: "localhost",
|
package/dist/index.js
CHANGED
package/dist/nuxt.cjs
CHANGED
|
@@ -60,11 +60,21 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
60
60
|
|
|
61
61
|
// src/utils.ts
|
|
62
62
|
var import_node_process = __toESM(require("process"), 1);
|
|
63
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
64
|
+
var import_promises = require("fs/promises");
|
|
63
65
|
var import_node_child_process = require("child_process");
|
|
64
66
|
var import_consola = require("consola");
|
|
65
67
|
var consola = (0, import_consola.createConsola)({
|
|
66
68
|
level: 3
|
|
67
69
|
}).withTag("reverse-proxy");
|
|
70
|
+
async function chmodRecursive(_path, mode) {
|
|
71
|
+
await (0, import_promises.chmod)(_path, mode);
|
|
72
|
+
if ((await (0, import_promises.stat)(_path)).isDirectory()) {
|
|
73
|
+
const children = await (0, import_promises.readdir)(_path);
|
|
74
|
+
for (const child of children)
|
|
75
|
+
await chmodRecursive(import_node_path.default.join(_path, child), mode);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
68
78
|
function once(fn) {
|
|
69
79
|
let called = false;
|
|
70
80
|
return (...args) => {
|
|
@@ -145,11 +155,11 @@ async function removeHost(ip, host) {
|
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
// src/caddy/constants.ts
|
|
148
|
-
var
|
|
158
|
+
var import_node_path2 = require("path");
|
|
149
159
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
150
160
|
var TEMP_DIR = import_node_process3.default.env.TEMP || import_node_process3.default.env.TMPDIR || "/tmp";
|
|
151
|
-
var caddyPath = (0,
|
|
152
|
-
var caddyFilePath = (0,
|
|
161
|
+
var caddyPath = (0, import_node_path2.join)(TEMP_DIR, `caddy${import_node_process3.default.platform === "win32" ? ".exe" : ""}`);
|
|
162
|
+
var caddyFilePath = (0, import_node_path2.join)(TEMP_DIR, "CADDYFILE");
|
|
153
163
|
var supportList = [
|
|
154
164
|
{
|
|
155
165
|
platform: "dragonfly",
|
|
@@ -467,15 +477,15 @@ var CaddyInstant = class {
|
|
|
467
477
|
// src/index.ts
|
|
468
478
|
var config;
|
|
469
479
|
var caddy;
|
|
480
|
+
var pwd = import_node_process5.default.cwd();
|
|
470
481
|
function vitePrintUrls(server, options, source, target, base = "/", _printUrls) {
|
|
471
482
|
_printUrls == null ? void 0 : _printUrls();
|
|
472
|
-
const pwd = import_node_process5.default.cwd();
|
|
473
483
|
const viteCacheDir = `${pwd}/node_modules/.vite`;
|
|
474
484
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
475
|
-
(
|
|
485
|
+
chmodRecursive(viteCacheDir, 511);
|
|
476
486
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
477
487
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
478
|
-
(
|
|
488
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
479
489
|
try {
|
|
480
490
|
if (caddy)
|
|
481
491
|
return;
|
|
@@ -546,6 +556,9 @@ var unpluginFactory = (options) => ({
|
|
|
546
556
|
consola.fail("please provide target");
|
|
547
557
|
return;
|
|
548
558
|
}
|
|
559
|
+
const nuxtCacheDir = `${pwd}/node_modules/.cache`;
|
|
560
|
+
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
561
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
549
562
|
try {
|
|
550
563
|
const devServer = __spreadValues(__spreadValues({
|
|
551
564
|
host: "localhost",
|
package/dist/nuxt.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
vite_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DDD5N75Y.js";
|
|
4
4
|
import {
|
|
5
5
|
webpack_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VGLXVBHU.js";
|
|
7
7
|
import {
|
|
8
8
|
vitePrintUrls
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-N6ZBBGYD.js";
|
|
10
10
|
import {
|
|
11
11
|
consola,
|
|
12
12
|
once
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-RUJE3YFB.js";
|
|
14
14
|
|
|
15
15
|
// src/nuxt.ts
|
|
16
16
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
package/dist/rollup.cjs
CHANGED
|
@@ -57,11 +57,21 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
57
57
|
|
|
58
58
|
// src/utils.ts
|
|
59
59
|
var import_node_process = __toESM(require("process"), 1);
|
|
60
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
61
|
+
var import_promises = require("fs/promises");
|
|
60
62
|
var import_node_child_process = require("child_process");
|
|
61
63
|
var import_consola = require("consola");
|
|
62
64
|
var consola = (0, import_consola.createConsola)({
|
|
63
65
|
level: 3
|
|
64
66
|
}).withTag("reverse-proxy");
|
|
67
|
+
async function chmodRecursive(_path, mode) {
|
|
68
|
+
await (0, import_promises.chmod)(_path, mode);
|
|
69
|
+
if ((await (0, import_promises.stat)(_path)).isDirectory()) {
|
|
70
|
+
const children = await (0, import_promises.readdir)(_path);
|
|
71
|
+
for (const child of children)
|
|
72
|
+
await chmodRecursive(import_node_path.default.join(_path, child), mode);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
65
75
|
function isAdmin() {
|
|
66
76
|
if (import_node_process.default.platform === "win32") {
|
|
67
77
|
try {
|
|
@@ -133,11 +143,11 @@ async function removeHost(ip, host) {
|
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
// src/caddy/constants.ts
|
|
136
|
-
var
|
|
146
|
+
var import_node_path2 = require("path");
|
|
137
147
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
138
148
|
var TEMP_DIR = import_node_process3.default.env.TEMP || import_node_process3.default.env.TMPDIR || "/tmp";
|
|
139
|
-
var caddyPath = (0,
|
|
140
|
-
var caddyFilePath = (0,
|
|
149
|
+
var caddyPath = (0, import_node_path2.join)(TEMP_DIR, `caddy${import_node_process3.default.platform === "win32" ? ".exe" : ""}`);
|
|
150
|
+
var caddyFilePath = (0, import_node_path2.join)(TEMP_DIR, "CADDYFILE");
|
|
141
151
|
var supportList = [
|
|
142
152
|
{
|
|
143
153
|
platform: "dragonfly",
|
|
@@ -455,15 +465,15 @@ var CaddyInstant = class {
|
|
|
455
465
|
// src/index.ts
|
|
456
466
|
var config;
|
|
457
467
|
var caddy;
|
|
468
|
+
var pwd = import_node_process5.default.cwd();
|
|
458
469
|
function vitePrintUrls(server, options, source, target, base = "/", _printUrls) {
|
|
459
470
|
_printUrls == null ? void 0 : _printUrls();
|
|
460
|
-
const pwd = import_node_process5.default.cwd();
|
|
461
471
|
const viteCacheDir = `${pwd}/node_modules/.vite`;
|
|
462
472
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
463
|
-
(
|
|
473
|
+
chmodRecursive(viteCacheDir, 511);
|
|
464
474
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
465
475
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
466
|
-
(
|
|
476
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
467
477
|
try {
|
|
468
478
|
if (caddy)
|
|
469
479
|
return;
|
|
@@ -534,6 +544,9 @@ var unpluginFactory = (options) => ({
|
|
|
534
544
|
consola.fail("please provide target");
|
|
535
545
|
return;
|
|
536
546
|
}
|
|
547
|
+
const nuxtCacheDir = `${pwd}/node_modules/.cache`;
|
|
548
|
+
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
549
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
537
550
|
try {
|
|
538
551
|
const devServer = __spreadValues(__spreadValues({
|
|
539
552
|
host: "localhost",
|
package/dist/rollup.js
CHANGED
package/dist/utils.cjs
CHANGED
|
@@ -30,17 +30,28 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/utils.ts
|
|
31
31
|
var utils_exports = {};
|
|
32
32
|
__export(utils_exports, {
|
|
33
|
+
chmodRecursive: () => chmodRecursive,
|
|
33
34
|
consola: () => consola,
|
|
34
35
|
isAdmin: () => isAdmin,
|
|
35
36
|
once: () => once
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(utils_exports);
|
|
38
39
|
var import_node_process = __toESM(require("process"), 1);
|
|
40
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
41
|
+
var import_promises = require("fs/promises");
|
|
39
42
|
var import_node_child_process = require("child_process");
|
|
40
43
|
var import_consola = require("consola");
|
|
41
44
|
var consola = (0, import_consola.createConsola)({
|
|
42
45
|
level: 3
|
|
43
46
|
}).withTag("reverse-proxy");
|
|
47
|
+
async function chmodRecursive(_path, mode) {
|
|
48
|
+
await (0, import_promises.chmod)(_path, mode);
|
|
49
|
+
if ((await (0, import_promises.stat)(_path)).isDirectory()) {
|
|
50
|
+
const children = await (0, import_promises.readdir)(_path);
|
|
51
|
+
for (const child of children)
|
|
52
|
+
await chmodRecursive(import_node_path.default.join(_path, child), mode);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
44
55
|
function once(fn) {
|
|
45
56
|
let called = false;
|
|
46
57
|
return (...args) => {
|
|
@@ -64,6 +75,7 @@ function isAdmin() {
|
|
|
64
75
|
}
|
|
65
76
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
77
|
0 && (module.exports = {
|
|
78
|
+
chmodRecursive,
|
|
67
79
|
consola,
|
|
68
80
|
isAdmin,
|
|
69
81
|
once
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as consola_dist_core from 'consola/dist/core';
|
|
2
2
|
|
|
3
3
|
declare const consola: consola_dist_core.ConsolaInstance;
|
|
4
|
+
declare function chmodRecursive(_path: string, mode: number): Promise<void>;
|
|
4
5
|
declare function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
5
6
|
declare function isAdmin(): boolean | undefined;
|
|
6
7
|
|
|
7
|
-
export { consola, isAdmin, once };
|
|
8
|
+
export { chmodRecursive, consola, isAdmin, once };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as consola_dist_core from 'consola/dist/core';
|
|
2
2
|
|
|
3
3
|
declare const consola: consola_dist_core.ConsolaInstance;
|
|
4
|
+
declare function chmodRecursive(_path: string, mode: number): Promise<void>;
|
|
4
5
|
declare function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
5
6
|
declare function isAdmin(): boolean | undefined;
|
|
6
7
|
|
|
7
|
-
export { consola, isAdmin, once };
|
|
8
|
+
export { chmodRecursive, consola, isAdmin, once };
|
package/dist/utils.js
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -57,11 +57,21 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
57
57
|
|
|
58
58
|
// src/utils.ts
|
|
59
59
|
var import_node_process = __toESM(require("process"), 1);
|
|
60
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
61
|
+
var import_promises = require("fs/promises");
|
|
60
62
|
var import_node_child_process = require("child_process");
|
|
61
63
|
var import_consola = require("consola");
|
|
62
64
|
var consola = (0, import_consola.createConsola)({
|
|
63
65
|
level: 3
|
|
64
66
|
}).withTag("reverse-proxy");
|
|
67
|
+
async function chmodRecursive(_path, mode) {
|
|
68
|
+
await (0, import_promises.chmod)(_path, mode);
|
|
69
|
+
if ((await (0, import_promises.stat)(_path)).isDirectory()) {
|
|
70
|
+
const children = await (0, import_promises.readdir)(_path);
|
|
71
|
+
for (const child of children)
|
|
72
|
+
await chmodRecursive(import_node_path.default.join(_path, child), mode);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
65
75
|
function isAdmin() {
|
|
66
76
|
if (import_node_process.default.platform === "win32") {
|
|
67
77
|
try {
|
|
@@ -133,11 +143,11 @@ async function removeHost(ip, host) {
|
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
// src/caddy/constants.ts
|
|
136
|
-
var
|
|
146
|
+
var import_node_path2 = require("path");
|
|
137
147
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
138
148
|
var TEMP_DIR = import_node_process3.default.env.TEMP || import_node_process3.default.env.TMPDIR || "/tmp";
|
|
139
|
-
var caddyPath = (0,
|
|
140
|
-
var caddyFilePath = (0,
|
|
149
|
+
var caddyPath = (0, import_node_path2.join)(TEMP_DIR, `caddy${import_node_process3.default.platform === "win32" ? ".exe" : ""}`);
|
|
150
|
+
var caddyFilePath = (0, import_node_path2.join)(TEMP_DIR, "CADDYFILE");
|
|
141
151
|
var supportList = [
|
|
142
152
|
{
|
|
143
153
|
platform: "dragonfly",
|
|
@@ -455,15 +465,15 @@ var CaddyInstant = class {
|
|
|
455
465
|
// src/index.ts
|
|
456
466
|
var config;
|
|
457
467
|
var caddy;
|
|
468
|
+
var pwd = import_node_process5.default.cwd();
|
|
458
469
|
function vitePrintUrls(server, options, source, target, base = "/", _printUrls) {
|
|
459
470
|
_printUrls == null ? void 0 : _printUrls();
|
|
460
|
-
const pwd = import_node_process5.default.cwd();
|
|
461
471
|
const viteCacheDir = `${pwd}/node_modules/.vite`;
|
|
462
472
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
463
|
-
(
|
|
473
|
+
chmodRecursive(viteCacheDir, 511);
|
|
464
474
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
465
475
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
466
|
-
(
|
|
476
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
467
477
|
try {
|
|
468
478
|
if (caddy)
|
|
469
479
|
return;
|
|
@@ -534,6 +544,9 @@ var unpluginFactory = (options) => ({
|
|
|
534
544
|
consola.fail("please provide target");
|
|
535
545
|
return;
|
|
536
546
|
}
|
|
547
|
+
const nuxtCacheDir = `${pwd}/node_modules/.cache`;
|
|
548
|
+
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
549
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
537
550
|
try {
|
|
538
551
|
const devServer = __spreadValues(__spreadValues({
|
|
539
552
|
host: "localhost",
|
package/dist/vite.js
CHANGED
package/dist/webpack.cjs
CHANGED
|
@@ -57,11 +57,21 @@ var import_picocolors = __toESM(require("picocolors"), 1);
|
|
|
57
57
|
|
|
58
58
|
// src/utils.ts
|
|
59
59
|
var import_node_process = __toESM(require("process"), 1);
|
|
60
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
61
|
+
var import_promises = require("fs/promises");
|
|
60
62
|
var import_node_child_process = require("child_process");
|
|
61
63
|
var import_consola = require("consola");
|
|
62
64
|
var consola = (0, import_consola.createConsola)({
|
|
63
65
|
level: 3
|
|
64
66
|
}).withTag("reverse-proxy");
|
|
67
|
+
async function chmodRecursive(_path, mode) {
|
|
68
|
+
await (0, import_promises.chmod)(_path, mode);
|
|
69
|
+
if ((await (0, import_promises.stat)(_path)).isDirectory()) {
|
|
70
|
+
const children = await (0, import_promises.readdir)(_path);
|
|
71
|
+
for (const child of children)
|
|
72
|
+
await chmodRecursive(import_node_path.default.join(_path, child), mode);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
65
75
|
function isAdmin() {
|
|
66
76
|
if (import_node_process.default.platform === "win32") {
|
|
67
77
|
try {
|
|
@@ -133,11 +143,11 @@ async function removeHost(ip, host) {
|
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
// src/caddy/constants.ts
|
|
136
|
-
var
|
|
146
|
+
var import_node_path2 = require("path");
|
|
137
147
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
138
148
|
var TEMP_DIR = import_node_process3.default.env.TEMP || import_node_process3.default.env.TMPDIR || "/tmp";
|
|
139
|
-
var caddyPath = (0,
|
|
140
|
-
var caddyFilePath = (0,
|
|
149
|
+
var caddyPath = (0, import_node_path2.join)(TEMP_DIR, `caddy${import_node_process3.default.platform === "win32" ? ".exe" : ""}`);
|
|
150
|
+
var caddyFilePath = (0, import_node_path2.join)(TEMP_DIR, "CADDYFILE");
|
|
141
151
|
var supportList = [
|
|
142
152
|
{
|
|
143
153
|
platform: "dragonfly",
|
|
@@ -455,15 +465,15 @@ var CaddyInstant = class {
|
|
|
455
465
|
// src/index.ts
|
|
456
466
|
var config;
|
|
457
467
|
var caddy;
|
|
468
|
+
var pwd = import_node_process5.default.cwd();
|
|
458
469
|
function vitePrintUrls(server, options, source, target, base = "/", _printUrls) {
|
|
459
470
|
_printUrls == null ? void 0 : _printUrls();
|
|
460
|
-
const pwd = import_node_process5.default.cwd();
|
|
461
471
|
const viteCacheDir = `${pwd}/node_modules/.vite`;
|
|
462
472
|
if ((0, import_node_fs3.existsSync)(viteCacheDir))
|
|
463
|
-
(
|
|
473
|
+
chmodRecursive(viteCacheDir, 511);
|
|
464
474
|
const nuxtCacheDir = `${pwd}/.nuxt`;
|
|
465
475
|
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
466
|
-
(
|
|
476
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
467
477
|
try {
|
|
468
478
|
if (caddy)
|
|
469
479
|
return;
|
|
@@ -534,6 +544,9 @@ var unpluginFactory = (options) => ({
|
|
|
534
544
|
consola.fail("please provide target");
|
|
535
545
|
return;
|
|
536
546
|
}
|
|
547
|
+
const nuxtCacheDir = `${pwd}/node_modules/.cache`;
|
|
548
|
+
if ((0, import_node_fs3.existsSync)(nuxtCacheDir))
|
|
549
|
+
chmodRecursive(nuxtCacheDir, 511);
|
|
537
550
|
try {
|
|
538
551
|
const devServer = __spreadValues(__spreadValues({
|
|
539
552
|
host: "localhost",
|
package/dist/webpack.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
webpack_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-VGLXVBHU.js";
|
|
4
|
+
import "./chunk-N6ZBBGYD.js";
|
|
5
|
+
import "./chunk-RUJE3YFB.js";
|
|
6
6
|
export {
|
|
7
7
|
webpack_default as default
|
|
8
8
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
-
import {
|
|
2
|
+
import { existsSync } from 'node:fs'
|
|
3
3
|
import type { UnpluginFactory } from 'unplugin'
|
|
4
4
|
import { createUnplugin } from 'unplugin'
|
|
5
5
|
import type { ResolvedConfig, ViteDevServer } from 'vite'
|
|
6
6
|
import c from 'picocolors'
|
|
7
|
-
import { consola, isAdmin } from './utils'
|
|
7
|
+
import { chmodRecursive, consola, isAdmin } from './utils'
|
|
8
8
|
import type { Options } from './types'
|
|
9
9
|
import { CaddyInstant } from './caddy'
|
|
10
10
|
|
|
@@ -12,6 +12,8 @@ let config: ResolvedConfig
|
|
|
12
12
|
|
|
13
13
|
let caddy: CaddyInstant
|
|
14
14
|
|
|
15
|
+
const pwd = process.cwd()
|
|
16
|
+
|
|
15
17
|
export function vitePrintUrls(
|
|
16
18
|
server: ViteDevServer,
|
|
17
19
|
options: Options,
|
|
@@ -23,13 +25,12 @@ export function vitePrintUrls(
|
|
|
23
25
|
_printUrls?.()
|
|
24
26
|
|
|
25
27
|
// fix `Error: EPERM: operation not permitted`
|
|
26
|
-
const pwd = process.cwd()
|
|
27
28
|
const viteCacheDir = `${pwd}/node_modules/.vite`
|
|
28
29
|
if (existsSync(viteCacheDir))
|
|
29
|
-
|
|
30
|
+
chmodRecursive(viteCacheDir, 0o777)
|
|
30
31
|
const nuxtCacheDir = `${pwd}/.nuxt`
|
|
31
32
|
if (existsSync(nuxtCacheDir))
|
|
32
|
-
|
|
33
|
+
chmodRecursive(nuxtCacheDir, 0o777)
|
|
33
34
|
|
|
34
35
|
try {
|
|
35
36
|
if (caddy)
|
|
@@ -111,6 +112,10 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
|
|
|
111
112
|
return
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
const nuxtCacheDir = `${pwd}/node_modules/.cache`
|
|
116
|
+
if (existsSync(nuxtCacheDir))
|
|
117
|
+
chmodRecursive(nuxtCacheDir, 0o777)
|
|
118
|
+
|
|
114
119
|
try {
|
|
115
120
|
const devServer = {
|
|
116
121
|
host: 'localhost',
|
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import process from 'node:process'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { chmod, readdir, stat } from 'node:fs/promises'
|
|
2
4
|
import { execSync } from 'node:child_process'
|
|
3
5
|
import { createConsola } from 'consola'
|
|
4
6
|
|
|
@@ -6,6 +8,15 @@ export const consola = createConsola({
|
|
|
6
8
|
level: 3,
|
|
7
9
|
}).withTag('reverse-proxy')
|
|
8
10
|
|
|
11
|
+
export async function chmodRecursive(_path: string, mode: number) {
|
|
12
|
+
await chmod(_path, mode)
|
|
13
|
+
if ((await stat(_path)).isDirectory()) {
|
|
14
|
+
const children = await readdir(_path)
|
|
15
|
+
for (const child of children)
|
|
16
|
+
await chmodRecursive(path.join(_path, child), mode)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
export function once<T extends (...args: any[]) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T> {
|
|
10
21
|
let called = false
|
|
11
22
|
return (...args: any[]) => {
|