@reticlehq/vite-plugin 3.4.0 → 3.5.0
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/discover-port.d.ts +1 -1
- package/dist/discover-port.js +12 -3
- package/dist/index.cjs +8 -2
- package/package.json +4 -4
package/dist/discover-port.d.ts
CHANGED
|
@@ -34,4 +34,4 @@ export interface DaemonPortChoice {
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function chooseDaemonPort(sources: DaemonPortSources): DaemonPortChoice;
|
|
36
36
|
/** {@link chooseDaemonPort} over the real registry and the real `.reticle.json` above `cwd`. */
|
|
37
|
-
export declare function resolveDaemonPort(explicit: number | undefined, projectId: string | undefined, cwd: string): DaemonPortChoice;
|
|
37
|
+
export declare function resolveDaemonPort(explicit: number | undefined, projectId: string | undefined, cwd: string, env?: NodeJS.ProcessEnv): DaemonPortChoice;
|
package/dist/discover-port.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { readdirSync, readFileSync } from 'node:fs';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
|
-
import { daemonRegistryPort, DaemonRegistryEntrySchema, pickDaemonPort, } from '@reticlehq/core';
|
|
10
|
+
import { daemonRegistryPort, DaemonRegistryEntrySchema, pickDaemonPort, ReticleEnv, } from '@reticlehq/core';
|
|
11
11
|
import { stateHome } from './state-home.js';
|
|
12
12
|
import { readConfiguredPort } from './project-id.js';
|
|
13
13
|
import { RETICLE_VITE_PLUGIN_NAME } from './plugin-name.js';
|
|
14
|
+
const MAX_TCP_PORT = 65_535;
|
|
14
15
|
/** process.kill(pid, 0) throws iff the process is gone — the same liveness probe the daemon uses. */
|
|
15
16
|
function isAlive(pid) {
|
|
16
17
|
try {
|
|
@@ -77,10 +78,18 @@ export function chooseDaemonPort(sources) {
|
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
/** {@link chooseDaemonPort} over the real registry and the real `.reticle.json` above `cwd`. */
|
|
80
|
-
export function resolveDaemonPort(explicit, projectId, cwd) {
|
|
81
|
+
export function resolveDaemonPort(explicit, projectId, cwd, env = process.env) {
|
|
82
|
+
// The CLI treats RETICLE_PORT as an override across projects. A page must follow the same
|
|
83
|
+
// daemon even when an older instance is still registered or init wrote a different port.
|
|
84
|
+
const raw = env[ReticleEnv.PORT];
|
|
85
|
+
if (raw !== undefined && /^\d+$/.test(raw)) {
|
|
86
|
+
const port = Number(raw);
|
|
87
|
+
if (0 < port && port <= MAX_TCP_PORT)
|
|
88
|
+
return { port, warning: undefined };
|
|
89
|
+
}
|
|
81
90
|
const configured = readConfiguredPort(cwd);
|
|
82
91
|
return chooseDaemonPort({
|
|
83
|
-
discovered: discoverDaemonPort(projectId, stateHome(), isAlive, configured),
|
|
92
|
+
discovered: discoverDaemonPort(projectId, stateHome(env), isAlive, configured),
|
|
84
93
|
configured,
|
|
85
94
|
explicit,
|
|
86
95
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -4730,6 +4730,7 @@ function stateHome(env = process.env) {
|
|
|
4730
4730
|
var RETICLE_VITE_PLUGIN_NAME = "reticle";
|
|
4731
4731
|
|
|
4732
4732
|
// src/discover-port.ts
|
|
4733
|
+
var MAX_TCP_PORT2 = 65535;
|
|
4733
4734
|
function isAlive(pid) {
|
|
4734
4735
|
try {
|
|
4735
4736
|
process.kill(pid, 0);
|
|
@@ -4770,10 +4771,15 @@ function chooseDaemonPort(sources) {
|
|
|
4770
4771
|
warning: explicit === configured ? void 0 : portConflictWarning(explicit, configured, port)
|
|
4771
4772
|
};
|
|
4772
4773
|
}
|
|
4773
|
-
function resolveDaemonPort(explicit, projectId, cwd) {
|
|
4774
|
+
function resolveDaemonPort(explicit, projectId, cwd, env = process.env) {
|
|
4775
|
+
const raw = env[ReticleEnv.PORT];
|
|
4776
|
+
if (raw !== void 0 && /^\d+$/.test(raw)) {
|
|
4777
|
+
const port = Number(raw);
|
|
4778
|
+
if (0 < port && port <= MAX_TCP_PORT2) return { port, warning: void 0 };
|
|
4779
|
+
}
|
|
4774
4780
|
const configured = readConfiguredPort(cwd);
|
|
4775
4781
|
return chooseDaemonPort({
|
|
4776
|
-
discovered: discoverDaemonPort(projectId, stateHome(), isAlive, configured),
|
|
4782
|
+
discovered: discoverDaemonPort(projectId, stateHome(env), isAlive, configured),
|
|
4777
4783
|
configured,
|
|
4778
4784
|
explicit
|
|
4779
4785
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reticlehq/vite-plugin",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "Vite plugin for Reticle: dev-only source-map stamping plus auto-injected reticle.connect(). apply:'serve' guarantees it never ships to production.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/core": "^7.26.0",
|
|
44
|
-
"@reticlehq/babel-plugin": "3.
|
|
45
|
-
"@reticlehq/core": "3.
|
|
44
|
+
"@reticlehq/babel-plugin": "3.5.0",
|
|
45
|
+
"@reticlehq/core": "3.5.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/babel__core": "^7.20.5",
|
|
49
49
|
"esbuild": "^0.28.2",
|
|
50
50
|
"svelte": "^5.57.1",
|
|
51
51
|
"vite": "^8",
|
|
52
|
-
"@reticlehq/react": "3.
|
|
52
|
+
"@reticlehq/react": "3.5.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"vite": ">=4"
|