vite-plugin-phpsandbox 0.1.0 → 0.1.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/README.md +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ The plugin reads these environment variables by default:
|
|
|
50
50
|
- Resolves the public host from `publicHost`, or derives `${SUBDOMAIN}-${hmrPort}.${NOTEBOOK_HOST}`.
|
|
51
51
|
- Resolves the public client port from the `publicClientPort` option only.
|
|
52
52
|
- Defaults `server.host` to `true` only when the project has not set `server.host`.
|
|
53
|
-
- Merges the derived public host into `server.allowedHosts` by default instead of disabling host checks globally.
|
|
53
|
+
- Merges `.${NOTEBOOK_HOST}` and the derived public host into `server.allowedHosts` by default instead of disabling host checks globally.
|
|
54
54
|
- Creates a stable local HMR server on `0.0.0.0:${hmrPort}` unless `PHPSANDBOX_TYPE=laravel`.
|
|
55
55
|
- Advertises HMR over `wss://${publicHost}:${publicClientPort}` when a public host is available.
|
|
56
56
|
- Preserves `server.hmr = false` if the consuming project disables HMR explicitly.
|
package/dist/index.cjs
CHANGED
|
@@ -93,7 +93,7 @@ function releaseServer(state, port, server) {
|
|
|
93
93
|
server.close();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
function resolveAllowedHosts(existingAllowedHosts, optionAllowedHosts, publicHost) {
|
|
96
|
+
function resolveAllowedHosts(existingAllowedHosts, optionAllowedHosts, notebookHost, publicHost) {
|
|
97
97
|
if (optionAllowedHosts === true || existingAllowedHosts === true) {
|
|
98
98
|
return true;
|
|
99
99
|
}
|
|
@@ -103,6 +103,9 @@ function resolveAllowedHosts(existingAllowedHosts, optionAllowedHosts, publicHos
|
|
|
103
103
|
merged.add(host);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
+
if (notebookHost) {
|
|
107
|
+
merged.add(`.${notebookHost}`);
|
|
108
|
+
}
|
|
106
109
|
if (publicHost) {
|
|
107
110
|
merged.add(publicHost);
|
|
108
111
|
}
|
|
@@ -129,6 +132,7 @@ function phpSandboxPlugin(options = {}, env = process.env) {
|
|
|
129
132
|
const allowedHosts = resolveAllowedHosts(
|
|
130
133
|
existingServer.allowedHosts,
|
|
131
134
|
options.allowedHosts,
|
|
135
|
+
env.NOTEBOOK_HOST,
|
|
132
136
|
publicHost
|
|
133
137
|
);
|
|
134
138
|
const hmrServer = isLaravel || hmrDisabled ? void 0 : acquireServer(getGlobalState(), hmrPort);
|
package/dist/index.d.cts
CHANGED
|
@@ -7,7 +7,8 @@ type PhpSandboxEnv = {
|
|
|
7
7
|
};
|
|
8
8
|
type PhpSandboxOptions = {
|
|
9
9
|
/**
|
|
10
|
-
* Defaults to merging the derived public host into
|
|
10
|
+
* Defaults to merging `.${NOTEBOOK_HOST}` and the derived public host into
|
|
11
|
+
* `server.allowedHosts`.
|
|
11
12
|
* - true: disable host checks entirely
|
|
12
13
|
* - array: merge with existing allowedHosts
|
|
13
14
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ type PhpSandboxEnv = {
|
|
|
7
7
|
};
|
|
8
8
|
type PhpSandboxOptions = {
|
|
9
9
|
/**
|
|
10
|
-
* Defaults to merging the derived public host into
|
|
10
|
+
* Defaults to merging `.${NOTEBOOK_HOST}` and the derived public host into
|
|
11
|
+
* `server.allowedHosts`.
|
|
11
12
|
* - true: disable host checks entirely
|
|
12
13
|
* - array: merge with existing allowedHosts
|
|
13
14
|
*/
|
package/dist/index.js
CHANGED
|
@@ -57,7 +57,7 @@ function releaseServer(state, port, server) {
|
|
|
57
57
|
server.close();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
function resolveAllowedHosts(existingAllowedHosts, optionAllowedHosts, publicHost) {
|
|
60
|
+
function resolveAllowedHosts(existingAllowedHosts, optionAllowedHosts, notebookHost, publicHost) {
|
|
61
61
|
if (optionAllowedHosts === true || existingAllowedHosts === true) {
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
@@ -67,6 +67,9 @@ function resolveAllowedHosts(existingAllowedHosts, optionAllowedHosts, publicHos
|
|
|
67
67
|
merged.add(host);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
+
if (notebookHost) {
|
|
71
|
+
merged.add(`.${notebookHost}`);
|
|
72
|
+
}
|
|
70
73
|
if (publicHost) {
|
|
71
74
|
merged.add(publicHost);
|
|
72
75
|
}
|
|
@@ -93,6 +96,7 @@ function phpSandboxPlugin(options = {}, env = process.env) {
|
|
|
93
96
|
const allowedHosts = resolveAllowedHosts(
|
|
94
97
|
existingServer.allowedHosts,
|
|
95
98
|
options.allowedHosts,
|
|
99
|
+
env.NOTEBOOK_HOST,
|
|
96
100
|
publicHost
|
|
97
101
|
);
|
|
98
102
|
const hmrServer = isLaravel || hmrDisabled ? void 0 : acquireServer(getGlobalState(), hmrPort);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-phpsandbox",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vite plugin for PHP sandbox environments that need stable HMR over public proxy hosts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
38
38
|
"check": "tsc --noEmit",
|
|
39
39
|
"release:check": "npm run check && npm run build && npm pack --dry-run",
|
|
40
|
-
"release": "npm run release:check && npm publish",
|
|
40
|
+
"release": "npm version patch && npm run release:check && npm publish",
|
|
41
41
|
"prepublishOnly": "npm run build && npm run check"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|