@mui/internal-code-infra 0.1.1-canary.16 → 0.1.1-canary.18

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  export type Args = {
3
3
  /**
4
- * - List of workspace names to process
4
+ * - Workspace names or root-relative paths to process
5
5
  */
6
6
  workspaces: string[];
7
7
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.1.1-canary.16",
3
+ "version": "0.1.1-canary.18",
4
4
  "author": "MUI Team",
5
5
  "description": "Infra scripts and configs to be used across MUI repos.",
6
6
  "license": "MIT",
@@ -81,8 +81,8 @@
81
81
  "@pnpm/config.version-policy": "^1100.2.7",
82
82
  "@pnpm/find-workspace-dir": "^1000.1.5",
83
83
  "@pnpm/parse-wanted-dependency": "^1001.0.0",
84
- "@typescript-eslint/types": "^8.71.1",
85
- "@typescript-eslint/utils": "^8.71.1",
84
+ "@typescript-eslint/types": "^8.71.2",
85
+ "@typescript-eslint/utils": "^8.71.2",
86
86
  "@vitest/eslint-plugin": "^1.6.27",
87
87
  "babel-plugin-optimize-clsx": "^2.6.2",
88
88
  "babel-plugin-react-compiler": "^1.0.0",
@@ -137,7 +137,7 @@
137
137
  "resolve-pkg-maps": "^1.0.0",
138
138
  "semver": "^7.8.5",
139
139
  "stylelint-config-standard": "^40.0.0",
140
- "typescript-eslint": "^8.71.1",
140
+ "typescript-eslint": "^8.71.2",
141
141
  "unified": "^11.0.5",
142
142
  "unified-lint-rule": "^3.0.1",
143
143
  "unist-util-visit": "^5.1.0",
@@ -166,12 +166,12 @@
166
166
  "@types/mdast": "4.0.4",
167
167
  "@types/regexp.escape": "2.0.0",
168
168
  "@types/yargs": "17.0.35",
169
- "@typescript-eslint/parser": "8.71.1",
170
- "@typescript-eslint/rule-tester": "8.71.1",
169
+ "@typescript-eslint/parser": "8.71.2",
170
+ "@typescript-eslint/rule-tester": "8.71.2",
171
171
  "@typescript/native": "npm:typescript@7.0.2",
172
172
  "eslint": "10.12.0",
173
173
  "get-port": "7.2.0",
174
- "prettier": "3.9.9",
174
+ "prettier": "3.9.10",
175
175
  "remark": "15.0.1",
176
176
  "remark-mdx": "3.1.1",
177
177
  "serve": "14.2.6",
@@ -190,7 +190,7 @@
190
190
  "publishConfig": {
191
191
  "access": "public"
192
192
  },
193
- "gitSha": "7909a2801b6402fec32dead2c01dad6d16dcf20d",
193
+ "gitSha": "c65b98d29d2338ba5f55d96a0e5bdd3bba589839",
194
194
  "scripts": {
195
195
  "build": "tsc -p tsconfig.build.json",
196
196
  "typescript": "tsc -noEmit",
@@ -4,7 +4,7 @@
4
4
 
5
5
  /**
6
6
  * @typedef {Object} Args
7
- * @property {string[]} workspaces - List of workspace names to process
7
+ * @property {string[]} workspaces - Workspace names or root-relative paths to process
8
8
  * @property {boolean} [check] - Check mode - error if the generated content differs from current
9
9
  * @property {string} [baseBranch] - Branch to compare PRs against (default: master)
10
10
  */
@@ -100,7 +100,7 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
100
100
  .positional('workspaces', {
101
101
  type: 'string',
102
102
  array: true,
103
- describe: 'List of workspace names to process',
103
+ describe: 'Workspace names or root-relative paths to process',
104
104
  demandOption: true,
105
105
  })
106
106
  .option('check', {
@@ -115,6 +115,7 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
115
115
  "Branch to compare PRs against (the site's production branch on Netlify). Production and branch deploys always rebuild regardless of this value.",
116
116
  })
117
117
  .example('$0 netlify-ignore @mui/internal-docs-infra', 'Update netlify.toml for a workspace')
118
+ .example('$0 netlify-ignore ./apps/dashboard', 'Update an unnamed workspace by path')
118
119
  .example(
119
120
  '$0 netlify-ignore @mui/internal-docs-infra @mui/internal-code-infra',
120
121
  'Update netlify.toml for multiple workspaces',
@@ -135,11 +136,17 @@ export default /** @type {import('yargs').CommandModule<{}, Args>} */ ({
135
136
 
136
137
  // Get all workspace packages and create workspace map
137
138
  const allWorkspaces = await getWorkspacePackages({ cwd: workspaceRoot });
138
- const workspaceMap = new Map(
139
- allWorkspaces.flatMap((workspace) =>
140
- workspace.name ? [[workspace.name, workspace.path]] : [],
141
- ),
142
- );
139
+ /** @type {Map<string, string>} */
140
+ const workspaceMap = new Map();
141
+ for (const workspace of allWorkspaces) {
142
+ if (workspace.name) {
143
+ workspaceMap.set(workspace.name, workspace.path);
144
+ }
145
+
146
+ // Paths also identify private workspaces that have no package name.
147
+ const relativePath = toPosixPath(path.relative(workspaceRoot, workspace.path));
148
+ workspaceMap.set(`./${relativePath}`, workspace.path);
149
+ }
143
150
 
144
151
  // Process each workspace concurrently
145
152
  await Promise.all(
@@ -128,6 +128,18 @@ function withDefinitionComments(plugin) {
128
128
  };
129
129
  }
130
130
 
131
+ /**
132
+ * Makes the processor output the source text unchanged. The preset only lints, and
133
+ * remark-stringify doesn't round-trip Markdown (it escapes GitHub alerts, rewrites bare
134
+ * URLs, ...). eslint-plugin-mdx offers the processed output as a whole-file fix for any
135
+ * remark message, so with this `eslint --fix` leaves Markdown alone.
136
+ *
137
+ * @this {import('unified').Processor}
138
+ */
139
+ function remarkPreserveSource() {
140
+ this.compiler = (_tree, file) => String(file);
141
+ }
142
+
131
143
  /**
132
144
  * Returns a remark preset wiring the MUI-authored remark-lint plugins together
133
145
  * with a curated set of community plugins. Drop this into `.remarkrc.mjs`:
@@ -181,14 +193,12 @@ export function createRemarkConfig({ overrides = [], allowDefinitionComments = f
181
193
  });
182
194
 
183
195
  return {
184
- settings: {
185
- bullet: '-',
186
- emphasis: '_',
187
- fence: '`',
188
- listItemIndent: 'one',
189
- resourceLink: true,
190
- rule: '-',
191
- },
192
- plugins: [[remarkFrontmatter, ['yaml', 'toml']], remarkGfm, remarkLint, ...entries],
196
+ plugins: [
197
+ [remarkFrontmatter, ['yaml', 'toml']],
198
+ remarkGfm,
199
+ remarkLint,
200
+ ...entries,
201
+ remarkPreserveSource,
202
+ ],
193
203
  };
194
204
  }
@@ -99,9 +99,7 @@ export default async function extractErrorCodes(args) {
99
99
  const packages = basePackages.filter(
100
100
  (pkg) =>
101
101
  // Ignore obvious packages that do not have user-facing errors
102
- !pkg.name.startsWith('@mui/internal-') &&
103
- !pkg.name.startsWith('@mui-internal/') &&
104
- !skipPackages.includes(pkg.name),
102
+ !pkg.name.startsWith('@mui/internal-') && !skipPackages.includes(pkg.name),
105
103
  );
106
104
  const files = await Promise.all(packages.map((pkg) => getFilesForPackage(pkg)));
107
105
  packages.forEach((pkg, index) => {