@mui/internal-code-infra 0.1.1-canary.11 → 0.1.1-canary.13
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/build/remark/config.d.mts +5 -14
- package/package.json +15 -15
- package/src/remark/config.mjs +41 -4
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import remarkGfm from 'remark-gfm';
|
|
2
|
-
import remarkLint from 'remark-lint';
|
|
3
1
|
/**
|
|
4
2
|
* Returns a remark preset wiring the MUI-authored remark-lint plugins together
|
|
5
3
|
* with a curated set of community plugins. Drop this into `.remarkrc.mjs`:
|
|
@@ -23,21 +21,14 @@ import remarkLint from 'remark-lint';
|
|
|
23
21
|
* ```
|
|
24
22
|
*
|
|
25
23
|
* @param {Object} [options]
|
|
24
|
+
* @param {boolean} [options.allowDefinitionComments=false] Allow titled `[//]` link-reference comments.
|
|
26
25
|
* @param {Array<{ files: string | string[], rules: Record<string, false | unknown[]> }>} [options.overrides]
|
|
26
|
+
* @returns {import('unified').Preset}
|
|
27
27
|
*/
|
|
28
|
-
export declare function createRemarkConfig({ overrides }?: {
|
|
28
|
+
export declare function createRemarkConfig({ overrides, allowDefinitionComments }?: {
|
|
29
|
+
allowDefinitionComments?: boolean;
|
|
29
30
|
overrides?: Array<{
|
|
30
31
|
files: string | string[];
|
|
31
32
|
rules: Record<string, false | unknown[]>;
|
|
32
33
|
}>;
|
|
33
|
-
}):
|
|
34
|
-
settings: {
|
|
35
|
-
bullet: string;
|
|
36
|
-
emphasis: string;
|
|
37
|
-
fence: string;
|
|
38
|
-
listItemIndent: string;
|
|
39
|
-
resourceLink: boolean;
|
|
40
|
-
rule: string;
|
|
41
|
-
};
|
|
42
|
-
plugins: (any[] | typeof remarkGfm | typeof remarkLint)[];
|
|
43
|
-
};
|
|
34
|
+
}): import('unified').Preset;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-code-infra",
|
|
3
|
-
"version": "0.1.1-canary.
|
|
3
|
+
"version": "0.1.1-canary.13",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Infra scripts and configs to be used across MUI repos.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,31 +53,31 @@
|
|
|
53
53
|
"code-infra": "./bin/code-infra.mjs"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@argos-ci/core": "6.8.
|
|
56
|
+
"@argos-ci/core": "6.8.7",
|
|
57
57
|
"@babel/cli": "^8.0.6",
|
|
58
|
-
"@babel/core": "^8.0.
|
|
58
|
+
"@babel/core": "^8.0.7",
|
|
59
59
|
"@babel/plugin-syntax-jsx": "^8.0.1",
|
|
60
60
|
"@babel/plugin-syntax-typescript": "^8.0.3",
|
|
61
61
|
"@babel/plugin-transform-react-pure-annotations": "^8.0.1",
|
|
62
62
|
"@babel/plugin-transform-runtime": "^8.0.6",
|
|
63
|
-
"@babel/preset-env": "^8.0.
|
|
63
|
+
"@babel/preset-env": "^8.0.7",
|
|
64
64
|
"@babel/preset-react": "^8.0.1",
|
|
65
|
-
"@babel/preset-typescript": "^8.0.
|
|
65
|
+
"@babel/preset-typescript": "^8.0.7",
|
|
66
66
|
"@eslint/compat": "^2.1.1",
|
|
67
67
|
"@eslint/js": "^10.0.1",
|
|
68
|
-
"@eslint/json": "^2.1.
|
|
69
|
-
"@inquirer/confirm": "^6.3.
|
|
70
|
-
"@inquirer/select": "^5.2.
|
|
71
|
-
"@mui/internal-babel-plugin-display-name": "2.0.1-canary.
|
|
72
|
-
"@mui/internal-babel-plugin-minify-errors": "3.0.1-canary.
|
|
73
|
-
"@mui/internal-babel-plugin-resolve-imports": "3.0.1-canary.
|
|
68
|
+
"@eslint/json": "^2.1.1",
|
|
69
|
+
"@inquirer/confirm": "^6.3.3",
|
|
70
|
+
"@inquirer/select": "^5.2.6",
|
|
71
|
+
"@mui/internal-babel-plugin-display-name": "2.0.1-canary.2",
|
|
72
|
+
"@mui/internal-babel-plugin-minify-errors": "3.0.1-canary.2",
|
|
73
|
+
"@mui/internal-babel-plugin-resolve-imports": "3.0.1-canary.3",
|
|
74
74
|
"@napi-rs/keyring": "^2.1.0",
|
|
75
75
|
"@octokit/auth-action": "^6.0.3",
|
|
76
76
|
"@octokit/oauth-methods": "^6.0.5",
|
|
77
77
|
"@octokit/plugin-retry": "^8.1.1",
|
|
78
78
|
"@octokit/plugin-throttling": "^11.0.5",
|
|
79
79
|
"@octokit/rest": "^22.0.1",
|
|
80
|
-
"@pnpm/config.version-policy": "^1100.2.
|
|
80
|
+
"@pnpm/config.version-policy": "^1100.2.7",
|
|
81
81
|
"@pnpm/find-workspace-dir": "^1000.1.5",
|
|
82
82
|
"@pnpm/parse-wanted-dependency": "^1001.0.0",
|
|
83
83
|
"@typescript-eslint/types": "^8.71.1",
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
|
|
105
105
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
106
106
|
"eslint-plugin-testing-library": "^7.16.2",
|
|
107
|
-
"execa": "^10.0
|
|
107
|
+
"execa": "^10.1.0",
|
|
108
108
|
"git-url-parse": "^16.1.0",
|
|
109
109
|
"globals": "^17.13.0",
|
|
110
110
|
"globby": "^16.2.4",
|
|
111
|
-
"html-validate": "^11.16.
|
|
111
|
+
"html-validate": "^11.16.2",
|
|
112
112
|
"minimatch": "^10.2.6",
|
|
113
113
|
"node-html-parser": "^9.0.4",
|
|
114
114
|
"open": "^11.0.4",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"publishConfig": {
|
|
190
190
|
"access": "public"
|
|
191
191
|
},
|
|
192
|
-
"gitSha": "
|
|
192
|
+
"gitSha": "abd0d2ce073f905bfa623ebf593a5d37de499b72",
|
|
193
193
|
"scripts": {
|
|
194
194
|
"build": "tsc -p tsconfig.build.json",
|
|
195
195
|
"typescript": "tsc -noEmit",
|
package/src/remark/config.mjs
CHANGED
|
@@ -97,6 +97,37 @@ function withOverrides(name, plugin, baseSettings, overrideEntries) {
|
|
|
97
97
|
return wrapper;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Allows link-reference comments while retaining diagnostics for real links and definitions.
|
|
102
|
+
* Existing docs generators use these markers in both Markdown and MDX and parse them as metadata.
|
|
103
|
+
* Authored MDX can use JSX comments without this compatibility option.
|
|
104
|
+
*
|
|
105
|
+
* @param {import('unified').Plugin<any[], any, any>} plugin
|
|
106
|
+
*/
|
|
107
|
+
function withDefinitionComments(plugin) {
|
|
108
|
+
/** @param {any[]} settings */
|
|
109
|
+
return function wrapper(...settings) {
|
|
110
|
+
const processor = unified().use(plugin, ...settings);
|
|
111
|
+
/** @type {import('unified').Transformer} */
|
|
112
|
+
return async function transformer(tree, file) {
|
|
113
|
+
const previousMessages = file.messages.length;
|
|
114
|
+
await processor.run(tree, file);
|
|
115
|
+
file.messages = file.messages.filter((message, index) => {
|
|
116
|
+
const node = message.ancestors?.at(-1);
|
|
117
|
+
return !(
|
|
118
|
+
index >= previousMessages &&
|
|
119
|
+
node?.type === 'definition' &&
|
|
120
|
+
'identifier' in node &&
|
|
121
|
+
node.identifier === '//' &&
|
|
122
|
+
'title' in node &&
|
|
123
|
+
typeof node.title === 'string' &&
|
|
124
|
+
node.title.length > 0
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
100
131
|
/**
|
|
101
132
|
* Returns a remark preset wiring the MUI-authored remark-lint plugins together
|
|
102
133
|
* with a curated set of community plugins. Drop this into `.remarkrc.mjs`:
|
|
@@ -120,9 +151,11 @@ function withOverrides(name, plugin, baseSettings, overrideEntries) {
|
|
|
120
151
|
* ```
|
|
121
152
|
*
|
|
122
153
|
* @param {Object} [options]
|
|
154
|
+
* @param {boolean} [options.allowDefinitionComments=false] Allow titled `[//]` link-reference comments.
|
|
123
155
|
* @param {Array<{ files: string | string[], rules: Record<string, false | unknown[]> }>} [options.overrides]
|
|
156
|
+
* @returns {import('unified').Preset}
|
|
124
157
|
*/
|
|
125
|
-
export function createRemarkConfig({ overrides = [] } = {}) {
|
|
158
|
+
export function createRemarkConfig({ overrides = [], allowDefinitionComments = false } = {}) {
|
|
126
159
|
for (const override of overrides) {
|
|
127
160
|
const unknown = Object.keys(override.rules).filter((ruleName) => !(ruleName in RULES));
|
|
128
161
|
if (unknown.length > 0) {
|
|
@@ -130,10 +163,14 @@ export function createRemarkConfig({ overrides = [] } = {}) {
|
|
|
130
163
|
}
|
|
131
164
|
}
|
|
132
165
|
|
|
166
|
+
/** @type {import('unified').PluggableList} */
|
|
133
167
|
const entries = Object.entries(RULES).map(([name, entry]) => {
|
|
134
|
-
const [
|
|
135
|
-
entry
|
|
136
|
-
|
|
168
|
+
const [rulePlugin, baseSettings] =
|
|
169
|
+
/** @type {[import('unified').Plugin<any[], any, any>, any]} */ (entry);
|
|
170
|
+
const plugin =
|
|
171
|
+
allowDefinitionComments && (name === 'no-empty-url' || name === 'no-unused-definitions')
|
|
172
|
+
? withDefinitionComments(rulePlugin)
|
|
173
|
+
: rulePlugin;
|
|
137
174
|
const overrideEntries = overrides
|
|
138
175
|
.filter((override) => name in override.rules)
|
|
139
176
|
.map((override) => ({ files: override.files, settings: override.rules[name] }));
|