@mui/internal-docs-infra 0.13.1-canary.6 → 0.13.1-canary.7
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 +2 -2
- package/pipeline/loadServerTypesMeta/createOptimizedProgram.mjs +0 -2
- package/pipeline/loadServerTypesMeta/performanceTracking.d.mts +0 -1
- package/pipeline/loadServerTypesMeta/performanceTracking.mjs +1 -4
- package/pipeline/loadServerTypesMeta/socketServer.mjs +0 -4
- package/pipeline/loadServerTypesMeta/workerManager.mjs +8 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-docs-infra",
|
|
3
|
-
"version": "0.13.1-canary.
|
|
3
|
+
"version": "0.13.1-canary.7",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "MUI Infra - internal documentation creation tools.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -814,5 +814,5 @@
|
|
|
814
814
|
"bin": {
|
|
815
815
|
"docs-infra": "./cli/index.mjs"
|
|
816
816
|
},
|
|
817
|
-
"gitSha": "
|
|
817
|
+
"gitSha": "73b01ccc61d2096ec1bac12c735482f8d056c917"
|
|
818
818
|
}
|
|
@@ -10,7 +10,6 @@ export interface PerformanceLog {
|
|
|
10
10
|
export declare class PerformanceTracker {
|
|
11
11
|
private logs;
|
|
12
12
|
private baseTime;
|
|
13
|
-
constructor();
|
|
14
13
|
mark(name: string): number;
|
|
15
14
|
measure(name: string, startTime: number, endTime: number): void;
|
|
16
15
|
getLogs(): PerformanceLog[];
|
|
@@ -28,11 +28,7 @@ async function fileExists(path) {
|
|
|
28
28
|
* Socket server that handles requests from other workers
|
|
29
29
|
*/
|
|
30
30
|
export class SocketServer {
|
|
31
|
-
server;
|
|
32
|
-
socketPath;
|
|
33
31
|
connections = new Set();
|
|
34
|
-
requestHandler;
|
|
35
|
-
|
|
36
32
|
/**
|
|
37
33
|
* Request queue to serialize processTypes calls.
|
|
38
34
|
* The TypeScript language service is a singleton that uses setRootFiles()
|
|
@@ -6,6 +6,12 @@ import { fileURLToPath } from 'url';
|
|
|
6
6
|
// eslint-disable-next-line n/prefer-node-protocol
|
|
7
7
|
import { isMainThread, Worker } from 'worker_threads';
|
|
8
8
|
import { SocketClient, tryAcquireServerLock, releaseServerLock } from "./socketClient.mjs";
|
|
9
|
+
/**
|
|
10
|
+
* Returns the path of the worker file, which must be compiled JS, not TS.
|
|
11
|
+
*/
|
|
12
|
+
function getWorkerPath() {
|
|
13
|
+
return path.join(path.dirname(fileURLToPath(import.meta.url)), 'worker.mjs');
|
|
14
|
+
}
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
17
|
* Shared interface for types processing managers.
|
|
@@ -20,16 +26,9 @@ class TypesMetaWorkerManager {
|
|
|
20
26
|
worker = null;
|
|
21
27
|
pendingRequests = new Map();
|
|
22
28
|
requestId = 0;
|
|
23
|
-
workerPath;
|
|
24
|
-
constructor() {
|
|
25
|
-
// Worker file must be compiled JS, not TS
|
|
26
|
-
// Use import.meta.url to get current directory in ESM
|
|
27
|
-
const currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
28
|
-
this.workerPath = path.join(currentDir, 'worker.mjs');
|
|
29
|
-
}
|
|
30
29
|
ensureWorker() {
|
|
31
30
|
if (!this.worker) {
|
|
32
|
-
this.worker = new Worker(
|
|
31
|
+
this.worker = new Worker(getWorkerPath());
|
|
33
32
|
this.worker.on('message', response => {
|
|
34
33
|
const {
|
|
35
34
|
requestId,
|
|
@@ -111,9 +110,7 @@ class WorkerThreadTypesProcessor {
|
|
|
111
110
|
if (isServer) {
|
|
112
111
|
// We won the lock — spawn the bare worker which will become a socket server.
|
|
113
112
|
// Keep the lock held so no other worker tries to spawn a second server.
|
|
114
|
-
|
|
115
|
-
const workerPath = path.join(currentDir, 'worker.mjs');
|
|
116
|
-
this.serverWorker = new Worker(workerPath, {
|
|
113
|
+
this.serverWorker = new Worker(getWorkerPath(), {
|
|
117
114
|
workerData: {
|
|
118
115
|
isServer: true
|
|
119
116
|
}
|