@mui/internal-docs-infra 0.10.1-canary.0 → 0.10.1-canary.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/cli/loadNextConfig.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ export type ExtractedNextConfigOptions = {
|
|
|
4
4
|
ordering?: OrderingConfig;
|
|
5
5
|
descriptionReplacements?: DescriptionReplacement[];
|
|
6
6
|
useVisibleDescription?: boolean;
|
|
7
|
+
socketDir?: string;
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* Dynamically imports the next config from the given directory and extracts
|
package/cli/loadNextConfig.mjs
CHANGED
|
@@ -29,7 +29,8 @@ function extractUseVisibleDescriptionFromRemarkPlugins(remarkPlugins) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Extracts
|
|
32
|
+
* Extracts docs-infra options (ordering, descriptionReplacements, socketDir,
|
|
33
|
+
* useVisibleDescription) from loader options in a single pass.
|
|
33
34
|
*/
|
|
34
35
|
function extractOptionsFromLoaderEntries(loaders) {
|
|
35
36
|
const result = {};
|
|
@@ -43,6 +44,9 @@ function extractOptionsFromLoaderEntries(loaders) {
|
|
|
43
44
|
if (!result.descriptionReplacements && loader.loader === TYPES_LOADER && loader.options?.descriptionReplacements) {
|
|
44
45
|
result.descriptionReplacements = loader.options.descriptionReplacements;
|
|
45
46
|
}
|
|
47
|
+
if (!result.socketDir && loader.loader === TYPES_LOADER && typeof loader.options?.socketDir === 'string') {
|
|
48
|
+
result.socketDir = loader.options.socketDir;
|
|
49
|
+
}
|
|
46
50
|
if (result.useVisibleDescription === undefined && loader.options?.remarkPlugins) {
|
|
47
51
|
const extracted = extractUseVisibleDescriptionFromRemarkPlugins(loader.options.remarkPlugins);
|
|
48
52
|
if (typeof extracted === 'boolean') {
|
|
@@ -54,7 +58,8 @@ function extractOptionsFromLoaderEntries(loaders) {
|
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
/**
|
|
57
|
-
* Searches turbopack rules for docs-infra options (ordering
|
|
61
|
+
* Searches turbopack rules for docs-infra options (ordering,
|
|
62
|
+
* descriptionReplacements, socketDir, useVisibleDescription).
|
|
58
63
|
*/
|
|
59
64
|
function extractOptionsFromTurbopack(config) {
|
|
60
65
|
const rules = config?.turbopack?.rules;
|
|
@@ -71,13 +76,15 @@ function extractOptionsFromTurbopack(config) {
|
|
|
71
76
|
merged.ordering ??= extracted.ordering;
|
|
72
77
|
merged.descriptionReplacements ??= extracted.descriptionReplacements;
|
|
73
78
|
merged.useVisibleDescription ??= extracted.useVisibleDescription;
|
|
79
|
+
merged.socketDir ??= extracted.socketDir;
|
|
74
80
|
}
|
|
75
81
|
return merged;
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
/**
|
|
79
85
|
* Calls the webpack function with a minimal config and extracts docs-infra
|
|
80
|
-
* options (ordering
|
|
86
|
+
* options (ordering, descriptionReplacements, socketDir, useVisibleDescription)
|
|
87
|
+
* from the resulting rules.
|
|
81
88
|
*/
|
|
82
89
|
function extractOptionsFromWebpack(config) {
|
|
83
90
|
if (typeof config?.webpack !== 'function') {
|
|
@@ -105,6 +112,7 @@ function extractOptionsFromWebpack(config) {
|
|
|
105
112
|
merged.ordering ??= extracted.ordering;
|
|
106
113
|
merged.descriptionReplacements ??= extracted.descriptionReplacements;
|
|
107
114
|
merged.useVisibleDescription ??= extracted.useVisibleDescription;
|
|
115
|
+
merged.socketDir ??= extracted.socketDir;
|
|
108
116
|
}
|
|
109
117
|
return merged;
|
|
110
118
|
} catch {
|
|
@@ -131,7 +139,8 @@ export async function extractDocsInfraOptionsFromNextConfig(dir) {
|
|
|
131
139
|
return {
|
|
132
140
|
ordering: turbopack.ordering ?? webpack.ordering,
|
|
133
141
|
descriptionReplacements: turbopack.descriptionReplacements ?? webpack.descriptionReplacements,
|
|
134
|
-
useVisibleDescription: turbopack.useVisibleDescription ?? webpack.useVisibleDescription
|
|
142
|
+
useVisibleDescription: turbopack.useVisibleDescription ?? webpack.useVisibleDescription,
|
|
143
|
+
socketDir: turbopack.socketDir ?? webpack.socketDir
|
|
135
144
|
};
|
|
136
145
|
} catch {
|
|
137
146
|
// Config not importable — use defaults
|
package/cli/runValidate.mjs
CHANGED
|
@@ -85,8 +85,10 @@ const runValidate = {
|
|
|
85
85
|
const {
|
|
86
86
|
ordering,
|
|
87
87
|
descriptionReplacements,
|
|
88
|
-
useVisibleDescription = false
|
|
88
|
+
useVisibleDescription = false,
|
|
89
|
+
socketDir: configSocketDir
|
|
89
90
|
} = await extractDocsInfraOptionsFromNextConfig(cwd);
|
|
91
|
+
const socketDir = configSocketDir ? path.resolve(cwd, configSocketDir) : undefined;
|
|
90
92
|
|
|
91
93
|
// If neither flag is set, run both. If one is set, run only that one.
|
|
92
94
|
const runIndexes = !typesOnly || indexesOnly;
|
|
@@ -282,7 +284,8 @@ const runValidate = {
|
|
|
282
284
|
markerDir: typesMarkerDir
|
|
283
285
|
},
|
|
284
286
|
ordering,
|
|
285
|
-
descriptionReplacements
|
|
287
|
+
descriptionReplacements,
|
|
288
|
+
socketDir
|
|
286
289
|
}
|
|
287
290
|
});
|
|
288
291
|
}));
|
package/cli/validateWorker.mjs
CHANGED
|
@@ -73,7 +73,8 @@ if (parentPort) {
|
|
|
73
73
|
watchSourceDirectly: Boolean(typesMetaCall.structuredOptions?.watchSourceDirectly),
|
|
74
74
|
updateParentIndex: excludeFromIndex ? undefined : task.syncTypesOptions.updateParentIndex,
|
|
75
75
|
ordering: task.syncTypesOptions.ordering,
|
|
76
|
-
descriptionReplacements: task.syncTypesOptions.descriptionReplacements
|
|
76
|
+
descriptionReplacements: task.syncTypesOptions.descriptionReplacements,
|
|
77
|
+
socketDir: task.syncTypesOptions.socketDir
|
|
77
78
|
});
|
|
78
79
|
parentPort.postMessage({
|
|
79
80
|
type: 'types',
|
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.1",
|
|
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": "eb63c846936de0d8b339188c5191c2c524357cc7"
|
|
647
647
|
}
|
|
@@ -11,11 +11,19 @@
|
|
|
11
11
|
import { connect } from 'node:net';
|
|
12
12
|
import { watch } from 'node:fs';
|
|
13
13
|
import { mkdir, stat } from 'node:fs/promises';
|
|
14
|
+
import { createHash } from 'node:crypto';
|
|
14
15
|
import { tmpdir } from 'node:os';
|
|
15
16
|
import { join } from 'node:path';
|
|
16
17
|
import lockfile from 'proper-lockfile';
|
|
17
18
|
const isWindows = process.platform === 'win32';
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Short, stable hash of the current project directory. Used to scope shared
|
|
22
|
+
* temp directories (CI runners, system tmp) so concurrent docs-infra processes
|
|
23
|
+
* from different projects don't collide on the same socket/lock files.
|
|
24
|
+
*/
|
|
25
|
+
const projectHash = createHash('sha256').update(process.cwd()).digest('hex').slice(0, 8);
|
|
26
|
+
|
|
19
27
|
/**
|
|
20
28
|
* Get the default socket directory.
|
|
21
29
|
* On Unix: Prefers CI-specific temp directories, then falls back to system temp.
|
|
@@ -32,17 +40,18 @@ function getDefaultSocketDir() {
|
|
|
32
40
|
|
|
33
41
|
/**
|
|
34
42
|
* Get the effective socket directory for Unix sockets and lock files.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
43
|
+
* An explicit `socketDir` is always used as-is (assumed to be project-scoped,
|
|
44
|
+
* e.g. inside `.next/`). When no `socketDir` is given, shared temp directories
|
|
45
|
+
* (CI runner temp or system tmp) are namespaced with a short hash of the project
|
|
46
|
+
* directory so concurrent docs-infra processes from different projects don't
|
|
47
|
+
* collide on the same socket/lock files.
|
|
37
48
|
* @param socketDir - Optional custom directory for socket files
|
|
38
49
|
*/
|
|
39
50
|
function getEffectiveSocketDir(socketDir) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (ciTempDir) {
|
|
43
|
-
return `${ciTempDir}/mui-docs-infra`;
|
|
51
|
+
if (socketDir) {
|
|
52
|
+
return socketDir;
|
|
44
53
|
}
|
|
45
|
-
return
|
|
54
|
+
return `${getDefaultSocketDir()}/mui-docs-infra-${projectHash}`;
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
/**
|