@mui/internal-docs-infra 0.10.1-canary.1 → 0.10.1-canary.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-docs-infra",
|
|
3
|
-
"version": "0.10.1-canary.
|
|
3
|
+
"version": "0.10.1-canary.2",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "MUI Infra - internal documentation creation tools.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -643,5 +643,5 @@
|
|
|
643
643
|
"bin": {
|
|
644
644
|
"docs-infra": "./cli/index.mjs"
|
|
645
645
|
},
|
|
646
|
-
"gitSha": "
|
|
646
|
+
"gitSha": "7c06e2fc2908c14730ae31975a4e6fa27955fdcf"
|
|
647
647
|
}
|
|
@@ -25,7 +25,9 @@ export declare function getLockPath(socketDir?: string): string;
|
|
|
25
25
|
export declare function ensureSocketDir(socketDir?: string): Promise<void>;
|
|
26
26
|
/**
|
|
27
27
|
* Wait for the IPC endpoint to become available.
|
|
28
|
-
* On Unix:
|
|
28
|
+
* On Unix: Polls the filesystem for the socket file to appear. We avoid
|
|
29
|
+
* `fs.watch` here because on macOS it does not reliably fire events when a
|
|
30
|
+
* unix domain socket file is created.
|
|
29
31
|
* On Windows: Polls by attempting to connect to the named pipe.
|
|
30
32
|
* @param socketDir - Optional custom directory for socket files (Unix only)
|
|
31
33
|
* @param timeoutMs - Timeout in milliseconds (default: 5000)
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { connect } from 'node:net';
|
|
12
|
-
import { watch } from 'node:fs';
|
|
13
12
|
import { mkdir, stat } from 'node:fs/promises';
|
|
14
13
|
import { createHash } from 'node:crypto';
|
|
15
14
|
import { tmpdir } from 'node:os';
|
|
@@ -128,57 +127,42 @@ function sleep(ms) {
|
|
|
128
127
|
|
|
129
128
|
/**
|
|
130
129
|
* Wait for the IPC endpoint to become available.
|
|
131
|
-
* On Unix:
|
|
130
|
+
* On Unix: Polls the filesystem for the socket file to appear. We avoid
|
|
131
|
+
* `fs.watch` here because on macOS it does not reliably fire events when a
|
|
132
|
+
* unix domain socket file is created.
|
|
132
133
|
* On Windows: Polls by attempting to connect to the named pipe.
|
|
133
134
|
* @param socketDir - Optional custom directory for socket files (Unix only)
|
|
134
135
|
* @param timeoutMs - Timeout in milliseconds (default: 5000)
|
|
135
136
|
*/
|
|
136
137
|
export async function waitForSocketFile(socketDir, timeoutMs = 5000) {
|
|
137
138
|
const socketPath = getSocketPath(socketDir);
|
|
139
|
+
const pollInterval = 50;
|
|
140
|
+
const startTime = Date.now();
|
|
138
141
|
if (isWindows) {
|
|
139
|
-
// On Windows, named pipes don't create files - poll by trying to connect
|
|
140
|
-
const startTime = Date.now();
|
|
141
|
-
const pollInterval = 100; // ms
|
|
142
|
-
|
|
143
142
|
while (Date.now() - startTime < timeoutMs) {
|
|
144
143
|
// eslint-disable-next-line no-await-in-loop
|
|
145
144
|
if (await tryConnectToPipe(socketPath)) {
|
|
146
145
|
return;
|
|
147
146
|
}
|
|
148
|
-
|
|
149
|
-
// Wait before next poll
|
|
150
147
|
// eslint-disable-next-line no-await-in-loop
|
|
151
148
|
await sleep(pollInterval);
|
|
152
149
|
}
|
|
153
150
|
throw new Error(`Named pipe did not become available within ${timeoutMs}ms`);
|
|
154
151
|
}
|
|
155
152
|
|
|
156
|
-
//
|
|
157
|
-
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// Ensure the directory exists before watching
|
|
162
|
-
const dir = getEffectiveSocketDir(socketDir);
|
|
163
|
-
await mkdir(dir, {
|
|
153
|
+
// Ensure the directory exists so the first stat doesn't fail spuriously
|
|
154
|
+
await mkdir(getEffectiveSocketDir(socketDir), {
|
|
164
155
|
recursive: true
|
|
165
156
|
});
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
timer = setTimeout(() => {
|
|
178
|
-
watcher.close();
|
|
179
|
-
reject(new Error(`Socket file did not appear within ${timeoutMs}ms`));
|
|
180
|
-
}, timeoutMs);
|
|
181
|
-
});
|
|
157
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
158
|
+
// eslint-disable-next-line no-await-in-loop
|
|
159
|
+
if (await fileExists(socketPath)) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
// eslint-disable-next-line no-await-in-loop
|
|
163
|
+
await sleep(pollInterval);
|
|
164
|
+
}
|
|
165
|
+
throw new Error(`Socket file did not appear within ${timeoutMs}ms`);
|
|
182
166
|
}
|
|
183
167
|
|
|
184
168
|
// Store the release function globally so we can call it when needed
|